@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
@@ -14,64 +14,64 @@
14
14
  * Reference: SVG 1.1 spec, CSS inheritance rules
15
15
  */
16
16
  export const inheritableAttrs = new Set([
17
- 'clip-rule',
18
- 'color',
19
- 'color-interpolation',
20
- 'color-interpolation-filters',
21
- 'color-profile',
22
- 'color-rendering',
23
- 'cursor',
24
- 'direction',
25
- 'dominant-baseline',
26
- 'fill',
27
- 'fill-opacity',
28
- 'fill-rule',
29
- 'font',
30
- 'font-family',
31
- 'font-size',
32
- 'font-size-adjust',
33
- 'font-stretch',
34
- 'font-style',
35
- 'font-variant',
36
- 'font-weight',
37
- 'glyph-orientation-horizontal',
38
- 'glyph-orientation-vertical',
39
- 'image-rendering',
40
- 'letter-spacing',
41
- 'marker',
42
- 'marker-end',
43
- 'marker-mid',
44
- 'marker-start',
45
- 'paint-order',
46
- 'pointer-events',
47
- 'shape-rendering',
48
- 'stroke',
49
- 'stroke-dasharray',
50
- 'stroke-dashoffset',
51
- 'stroke-linecap',
52
- 'stroke-linejoin',
53
- 'stroke-miterlimit',
54
- 'stroke-opacity',
55
- 'stroke-width',
56
- 'text-anchor',
57
- 'text-rendering',
58
- 'visibility',
59
- 'word-spacing',
60
- 'writing-mode',
17
+ "clip-rule",
18
+ "color",
19
+ "color-interpolation",
20
+ "color-interpolation-filters",
21
+ "color-profile",
22
+ "color-rendering",
23
+ "cursor",
24
+ "direction",
25
+ "dominant-baseline",
26
+ "fill",
27
+ "fill-opacity",
28
+ "fill-rule",
29
+ "font",
30
+ "font-family",
31
+ "font-size",
32
+ "font-size-adjust",
33
+ "font-stretch",
34
+ "font-style",
35
+ "font-variant",
36
+ "font-weight",
37
+ "glyph-orientation-horizontal",
38
+ "glyph-orientation-vertical",
39
+ "image-rendering",
40
+ "letter-spacing",
41
+ "marker",
42
+ "marker-end",
43
+ "marker-mid",
44
+ "marker-start",
45
+ "paint-order",
46
+ "pointer-events",
47
+ "shape-rendering",
48
+ "stroke",
49
+ "stroke-dasharray",
50
+ "stroke-dashoffset",
51
+ "stroke-linecap",
52
+ "stroke-linejoin",
53
+ "stroke-miterlimit",
54
+ "stroke-opacity",
55
+ "stroke-width",
56
+ "text-anchor",
57
+ "text-rendering",
58
+ "visibility",
59
+ "word-spacing",
60
+ "writing-mode",
61
61
  ]);
62
62
 
63
63
  /**
64
64
  * Presentation attributes that do NOT inherit
65
65
  */
66
66
  export const nonInheritableAttrs = new Set([
67
- 'clip-path',
68
- 'display',
69
- 'filter',
70
- 'mask',
71
- 'opacity',
72
- 'text-decoration',
73
- 'transform',
74
- 'unicode-bidi',
67
+ "clip-path",
68
+ "display",
69
+ "filter",
70
+ "mask",
71
+ "opacity",
72
+ "text-decoration",
73
+ "transform",
74
+ "unicode-bidi",
75
75
  ]);
76
76
 
77
77
  // ============================================================================
@@ -82,18 +82,18 @@ export const nonInheritableAttrs = new Set([
82
82
  * Attributes that can contain url() references to other elements
83
83
  */
84
84
  export const referencesProps = new Set([
85
- 'clip-path',
86
- 'color-profile',
87
- 'fill',
88
- 'filter',
89
- 'href',
90
- 'marker-end',
91
- 'marker-mid',
92
- 'marker-start',
93
- 'mask',
94
- 'stroke',
95
- 'style',
96
- 'xlink:href',
85
+ "clip-path",
86
+ "color-profile",
87
+ "fill",
88
+ "filter",
89
+ "href",
90
+ "marker-end",
91
+ "marker-mid",
92
+ "marker-start",
93
+ "mask",
94
+ "stroke",
95
+ "style",
96
+ "xlink:href",
97
97
  ]);
98
98
 
99
99
  // ============================================================================
@@ -103,46 +103,102 @@ export const referencesProps = new Set([
103
103
  export const elemsGroups = {
104
104
  animation: new Set([
105
105
  // Include both mixed-case and lowercase for case-insensitive matching
106
- 'animate', 'animateColor', 'animatecolor', 'animateMotion', 'animatemotion',
107
- 'animateTransform', 'animatetransform', 'set'
108
- ]),
109
- descriptive: new Set([
110
- 'desc', 'metadata', 'title'
106
+ "animate",
107
+ "animateColor",
108
+ "animatecolor",
109
+ "animateMotion",
110
+ "animatemotion",
111
+ "animateTransform",
112
+ "animatetransform",
113
+ "set",
111
114
  ]),
115
+ descriptive: new Set(["desc", "metadata", "title"]),
112
116
  shape: new Set([
113
- 'circle', 'ellipse', 'line', 'path', 'polygon', 'polyline', 'rect'
114
- ]),
115
- structural: new Set([
116
- 'defs', 'g', 'svg', 'symbol', 'use'
117
+ "circle",
118
+ "ellipse",
119
+ "line",
120
+ "path",
121
+ "polygon",
122
+ "polyline",
123
+ "rect",
117
124
  ]),
125
+ structural: new Set(["defs", "g", "svg", "symbol", "use"]),
118
126
  paintServer: new Set([
119
127
  // Include both mixed-case and lowercase for case-insensitive matching
120
- 'hatch', 'linearGradient', 'lineargradient', 'meshGradient', 'meshgradient',
121
- 'pattern', 'radialGradient', 'radialgradient', 'solidColor', 'solidcolor'
128
+ "hatch",
129
+ "linearGradient",
130
+ "lineargradient",
131
+ "meshGradient",
132
+ "meshgradient",
133
+ "pattern",
134
+ "radialGradient",
135
+ "radialgradient",
136
+ "solidColor",
137
+ "solidcolor",
122
138
  ]),
123
139
  nonRendering: new Set([
124
140
  // Include both mixed-case and lowercase for case-insensitive matching
125
- 'clipPath', 'clippath', 'filter', 'linearGradient', 'lineargradient',
126
- 'marker', 'mask', 'pattern', 'radialGradient', 'radialgradient',
127
- 'solidColor', 'solidcolor', 'symbol'
141
+ "clipPath",
142
+ "clippath",
143
+ "filter",
144
+ "linearGradient",
145
+ "lineargradient",
146
+ "marker",
147
+ "mask",
148
+ "pattern",
149
+ "radialGradient",
150
+ "radialgradient",
151
+ "solidColor",
152
+ "solidcolor",
153
+ "symbol",
128
154
  ]),
129
155
  container: new Set([
130
- 'a', 'defs', 'g', 'marker', 'mask', 'pattern', 'svg', 'switch', 'symbol'
156
+ "a",
157
+ "defs",
158
+ "g",
159
+ "marker",
160
+ "mask",
161
+ "pattern",
162
+ "svg",
163
+ "switch",
164
+ "symbol",
131
165
  ]),
132
166
  textContent: new Set([
133
- 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'glyph', 'glyphRef',
134
- 'text', 'textPath', 'tref', 'tspan'
167
+ "altGlyph",
168
+ "altGlyphDef",
169
+ "altGlyphItem",
170
+ "glyph",
171
+ "glyphRef",
172
+ "text",
173
+ "textPath",
174
+ "tref",
175
+ "tspan",
135
176
  ]),
136
177
  filterPrimitive: new Set([
137
- 'feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite',
138
- 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',
139
- 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR',
140
- 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology',
141
- 'feOffset', 'feSpecularLighting', 'feTile', 'feTurbulence'
142
- ]),
143
- lightSource: new Set([
144
- 'feDistantLight', 'fePointLight', 'feSpotLight'
178
+ "feBlend",
179
+ "feColorMatrix",
180
+ "feComponentTransfer",
181
+ "feComposite",
182
+ "feConvolveMatrix",
183
+ "feDiffuseLighting",
184
+ "feDisplacementMap",
185
+ "feDropShadow",
186
+ "feFlood",
187
+ "feFuncA",
188
+ "feFuncB",
189
+ "feFuncG",
190
+ "feFuncR",
191
+ "feGaussianBlur",
192
+ "feImage",
193
+ "feMerge",
194
+ "feMergeNode",
195
+ "feMorphology",
196
+ "feOffset",
197
+ "feSpecularLighting",
198
+ "feTile",
199
+ "feTurbulence",
145
200
  ]),
201
+ lightSource: new Set(["feDistantLight", "fePointLight", "feSpotLight"]),
146
202
  };
147
203
 
148
204
  // ============================================================================
@@ -153,33 +209,33 @@ export const elemsGroups = {
153
209
  * Namespaces used by various SVG editors that can be safely removed
154
210
  */
155
211
  export const editorNamespaces = new Set([
156
- 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd',
157
- 'http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd',
158
- 'http://www.inkscape.org/namespaces/inkscape',
159
- 'http://www.bohemiancoding.com/sketch/ns',
160
- 'http://ns.adobe.com/AdobeIllustrator/10.0/',
161
- 'http://ns.adobe.com/Graphs/1.0/',
162
- 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
163
- 'http://ns.adobe.com/Variables/1.0/',
164
- 'http://ns.adobe.com/SaveForWeb/1.0/',
165
- 'http://ns.adobe.com/Extensibility/1.0/',
166
- 'http://ns.adobe.com/Flows/1.0/',
167
- 'http://ns.adobe.com/ImageReplacement/1.0/',
168
- 'http://ns.adobe.com/GenericCustomNamespace/1.0/',
169
- 'http://ns.adobe.com/XPath/1.0/',
170
- 'http://schemas.microsoft.com/visio/2003/SVGExtensions/',
171
- 'http://taptrix.com/vectorillustrator/svg_extensions',
172
- 'http://www.figma.com/figma/ns',
173
- 'http://purl.org/dc/elements/1.1/',
174
- 'http://creativecommons.org/ns#',
175
- 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
176
- 'http://www.serif.com/',
177
- 'http://www.vector.evaxdesign.sk',
212
+ "http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd",
213
+ "http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd",
214
+ "http://www.inkscape.org/namespaces/inkscape",
215
+ "http://www.bohemiancoding.com/sketch/ns",
216
+ "http://ns.adobe.com/AdobeIllustrator/10.0/",
217
+ "http://ns.adobe.com/Graphs/1.0/",
218
+ "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/",
219
+ "http://ns.adobe.com/Variables/1.0/",
220
+ "http://ns.adobe.com/SaveForWeb/1.0/",
221
+ "http://ns.adobe.com/Extensibility/1.0/",
222
+ "http://ns.adobe.com/Flows/1.0/",
223
+ "http://ns.adobe.com/ImageReplacement/1.0/",
224
+ "http://ns.adobe.com/GenericCustomNamespace/1.0/",
225
+ "http://ns.adobe.com/XPath/1.0/",
226
+ "http://schemas.microsoft.com/visio/2003/SVGExtensions/",
227
+ "http://taptrix.com/vectorillustrator/svg_extensions",
228
+ "http://www.figma.com/figma/ns",
229
+ "http://purl.org/dc/elements/1.1/",
230
+ "http://creativecommons.org/ns#",
231
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
232
+ "http://www.serif.com/",
233
+ "http://www.vector.evaxdesign.sk",
178
234
  // Additional editor namespaces
179
- 'http://www.corel.com/coreldraw/svg',
180
- 'http://gravit.io/ns',
181
- 'http://serif.com/affinity',
182
- 'http://canva.com/ns',
235
+ "http://www.corel.com/coreldraw/svg",
236
+ "http://gravit.io/ns",
237
+ "http://serif.com/affinity",
238
+ "http://canva.com/ns",
183
239
  ]);
184
240
 
185
241
  // ============================================================================
@@ -192,193 +248,193 @@ export const editorNamespaces = new Set([
192
248
  * All keys are lowercase. When looking up colors, normalize input with .toLowerCase()
193
249
  */
194
250
  export const colorsNames = {
195
- 'aliceblue': '#f0f8ff',
196
- 'antiquewhite': '#faebd7',
197
- 'aqua': '#0ff',
198
- 'aquamarine': '#7fffd4',
199
- 'azure': '#f0ffff',
200
- 'beige': '#f5f5dc',
201
- 'bisque': '#ffe4c4',
202
- 'black': '#000',
203
- 'blanchedalmond': '#ffebcd',
204
- 'blue': '#00f',
205
- 'blueviolet': '#8a2be2',
206
- 'brown': '#a52a2a',
207
- 'burlywood': '#deb887',
208
- 'cadetblue': '#5f9ea0',
209
- 'chartreuse': '#7fff00',
210
- 'chocolate': '#d2691e',
211
- 'coral': '#ff7f50',
212
- 'cornflowerblue': '#6495ed',
213
- 'cornsilk': '#fff8dc',
214
- 'crimson': '#dc143c',
215
- 'cyan': '#0ff',
216
- 'darkblue': '#00008b',
217
- 'darkcyan': '#008b8b',
218
- 'darkgoldenrod': '#b8860b',
219
- 'darkgray': '#a9a9a9',
220
- 'darkgreen': '#006400',
221
- 'darkgrey': '#a9a9a9',
222
- 'darkkhaki': '#bdb76b',
223
- 'darkmagenta': '#8b008b',
224
- 'darkolivegreen': '#556b2f',
225
- 'darkorange': '#ff8c00',
226
- 'darkorchid': '#9932cc',
227
- 'darkred': '#8b0000',
228
- 'darksalmon': '#e9967a',
229
- 'darkseagreen': '#8fbc8f',
230
- 'darkslateblue': '#483d8b',
231
- 'darkslategray': '#2f4f4f',
232
- 'darkslategrey': '#2f4f4f',
233
- 'darkturquoise': '#00ced1',
234
- 'darkviolet': '#9400d3',
235
- 'deeppink': '#ff1493',
236
- 'deepskyblue': '#00bfff',
237
- 'dimgray': '#696969',
238
- 'dimgrey': '#696969',
239
- 'dodgerblue': '#1e90ff',
240
- 'firebrick': '#b22222',
241
- 'floralwhite': '#fffaf0',
242
- 'forestgreen': '#228b22',
243
- 'fuchsia': '#f0f',
244
- 'gainsboro': '#dcdcdc',
245
- 'ghostwhite': '#f8f8ff',
246
- 'gold': '#ffd700',
247
- 'goldenrod': '#daa520',
248
- 'gray': '#808080',
249
- 'green': '#008000',
250
- 'greenyellow': '#adff2f',
251
- 'grey': '#808080',
252
- 'honeydew': '#f0fff0',
253
- 'hotpink': '#ff69b4',
254
- 'indianred': '#cd5c5c',
255
- 'indigo': '#4b0082',
256
- 'ivory': '#fffff0',
257
- 'khaki': '#f0e68c',
258
- 'lavender': '#e6e6fa',
259
- 'lavenderblush': '#fff0f5',
260
- 'lawngreen': '#7cfc00',
261
- 'lemonchiffon': '#fffacd',
262
- 'lightblue': '#add8e6',
263
- 'lightcoral': '#f08080',
264
- 'lightcyan': '#e0ffff',
265
- 'lightgoldenrodyellow': '#fafad2',
266
- 'lightgray': '#d3d3d3',
267
- 'lightgreen': '#90ee90',
268
- 'lightgrey': '#d3d3d3',
269
- 'lightpink': '#ffb6c1',
270
- 'lightsalmon': '#ffa07a',
271
- 'lightseagreen': '#20b2aa',
272
- 'lightskyblue': '#87cefa',
273
- 'lightslategray': '#789',
274
- 'lightslategrey': '#789',
275
- 'lightsteelblue': '#b0c4de',
276
- 'lightyellow': '#ffffe0',
277
- 'lime': '#0f0',
278
- 'limegreen': '#32cd32',
279
- 'linen': '#faf0e6',
280
- 'magenta': '#f0f',
281
- 'maroon': '#800000',
282
- 'mediumaquamarine': '#66cdaa',
283
- 'mediumblue': '#0000cd',
284
- 'mediumorchid': '#ba55d3',
285
- 'mediumpurple': '#9370db',
286
- 'mediumseagreen': '#3cb371',
287
- 'mediumslateblue': '#7b68ee',
288
- 'mediumspringgreen': '#00fa9a',
289
- 'mediumturquoise': '#48d1cc',
290
- 'mediumvioletred': '#c71585',
291
- 'midnightblue': '#191970',
292
- 'mintcream': '#f5fffa',
293
- 'mistyrose': '#ffe4e1',
294
- 'moccasin': '#ffe4b5',
295
- 'navajowhite': '#ffdead',
296
- 'navy': '#000080',
297
- 'oldlace': '#fdf5e6',
298
- 'olive': '#808000',
299
- 'olivedrab': '#6b8e23',
300
- 'orange': '#ffa500',
301
- 'orangered': '#ff4500',
302
- 'orchid': '#da70d6',
303
- 'palegoldenrod': '#eee8aa',
304
- 'palegreen': '#98fb98',
305
- 'paleturquoise': '#afeeee',
306
- 'palevioletred': '#db7093',
307
- 'papayawhip': '#ffefd5',
308
- 'peachpuff': '#ffdab9',
309
- 'peru': '#cd853f',
310
- 'pink': '#ffc0cb',
311
- 'plum': '#dda0dd',
312
- 'powderblue': '#b0e0e6',
313
- 'purple': '#800080',
314
- 'rebeccapurple': '#639',
315
- 'red': '#f00',
316
- 'rosybrown': '#bc8f8f',
317
- 'royalblue': '#4169e1',
318
- 'saddlebrown': '#8b4513',
319
- 'salmon': '#fa8072',
320
- 'sandybrown': '#f4a460',
321
- 'seagreen': '#2e8b57',
322
- 'seashell': '#fff5ee',
323
- 'sienna': '#a0522d',
324
- 'silver': '#c0c0c0',
325
- 'skyblue': '#87ceeb',
326
- 'slateblue': '#6a5acd',
327
- 'slategray': '#708090',
328
- 'slategrey': '#708090',
329
- 'snow': '#fffafa',
330
- 'springgreen': '#00ff7f',
331
- 'steelblue': '#4682b4',
332
- 'tan': '#d2b48c',
333
- 'teal': '#008080',
334
- 'thistle': '#d8bfd8',
335
- 'tomato': '#ff6347',
336
- 'turquoise': '#40e0d0',
337
- 'violet': '#ee82ee',
338
- 'wheat': '#f5deb3',
339
- 'white': '#fff',
340
- 'whitesmoke': '#f5f5f5',
341
- 'yellow': '#ff0',
342
- 'yellowgreen': '#9acd32',
251
+ aliceblue: "#f0f8ff",
252
+ antiquewhite: "#faebd7",
253
+ aqua: "#0ff",
254
+ aquamarine: "#7fffd4",
255
+ azure: "#f0ffff",
256
+ beige: "#f5f5dc",
257
+ bisque: "#ffe4c4",
258
+ black: "#000",
259
+ blanchedalmond: "#ffebcd",
260
+ blue: "#00f",
261
+ blueviolet: "#8a2be2",
262
+ brown: "#a52a2a",
263
+ burlywood: "#deb887",
264
+ cadetblue: "#5f9ea0",
265
+ chartreuse: "#7fff00",
266
+ chocolate: "#d2691e",
267
+ coral: "#ff7f50",
268
+ cornflowerblue: "#6495ed",
269
+ cornsilk: "#fff8dc",
270
+ crimson: "#dc143c",
271
+ cyan: "#0ff",
272
+ darkblue: "#00008b",
273
+ darkcyan: "#008b8b",
274
+ darkgoldenrod: "#b8860b",
275
+ darkgray: "#a9a9a9",
276
+ darkgreen: "#006400",
277
+ darkgrey: "#a9a9a9",
278
+ darkkhaki: "#bdb76b",
279
+ darkmagenta: "#8b008b",
280
+ darkolivegreen: "#556b2f",
281
+ darkorange: "#ff8c00",
282
+ darkorchid: "#9932cc",
283
+ darkred: "#8b0000",
284
+ darksalmon: "#e9967a",
285
+ darkseagreen: "#8fbc8f",
286
+ darkslateblue: "#483d8b",
287
+ darkslategray: "#2f4f4f",
288
+ darkslategrey: "#2f4f4f",
289
+ darkturquoise: "#00ced1",
290
+ darkviolet: "#9400d3",
291
+ deeppink: "#ff1493",
292
+ deepskyblue: "#00bfff",
293
+ dimgray: "#696969",
294
+ dimgrey: "#696969",
295
+ dodgerblue: "#1e90ff",
296
+ firebrick: "#b22222",
297
+ floralwhite: "#fffaf0",
298
+ forestgreen: "#228b22",
299
+ fuchsia: "#f0f",
300
+ gainsboro: "#dcdcdc",
301
+ ghostwhite: "#f8f8ff",
302
+ gold: "#ffd700",
303
+ goldenrod: "#daa520",
304
+ gray: "#808080",
305
+ green: "#008000",
306
+ greenyellow: "#adff2f",
307
+ grey: "#808080",
308
+ honeydew: "#f0fff0",
309
+ hotpink: "#ff69b4",
310
+ indianred: "#cd5c5c",
311
+ indigo: "#4b0082",
312
+ ivory: "#fffff0",
313
+ khaki: "#f0e68c",
314
+ lavender: "#e6e6fa",
315
+ lavenderblush: "#fff0f5",
316
+ lawngreen: "#7cfc00",
317
+ lemonchiffon: "#fffacd",
318
+ lightblue: "#add8e6",
319
+ lightcoral: "#f08080",
320
+ lightcyan: "#e0ffff",
321
+ lightgoldenrodyellow: "#fafad2",
322
+ lightgray: "#d3d3d3",
323
+ lightgreen: "#90ee90",
324
+ lightgrey: "#d3d3d3",
325
+ lightpink: "#ffb6c1",
326
+ lightsalmon: "#ffa07a",
327
+ lightseagreen: "#20b2aa",
328
+ lightskyblue: "#87cefa",
329
+ lightslategray: "#789",
330
+ lightslategrey: "#789",
331
+ lightsteelblue: "#b0c4de",
332
+ lightyellow: "#ffffe0",
333
+ lime: "#0f0",
334
+ limegreen: "#32cd32",
335
+ linen: "#faf0e6",
336
+ magenta: "#f0f",
337
+ maroon: "#800000",
338
+ mediumaquamarine: "#66cdaa",
339
+ mediumblue: "#0000cd",
340
+ mediumorchid: "#ba55d3",
341
+ mediumpurple: "#9370db",
342
+ mediumseagreen: "#3cb371",
343
+ mediumslateblue: "#7b68ee",
344
+ mediumspringgreen: "#00fa9a",
345
+ mediumturquoise: "#48d1cc",
346
+ mediumvioletred: "#c71585",
347
+ midnightblue: "#191970",
348
+ mintcream: "#f5fffa",
349
+ mistyrose: "#ffe4e1",
350
+ moccasin: "#ffe4b5",
351
+ navajowhite: "#ffdead",
352
+ navy: "#000080",
353
+ oldlace: "#fdf5e6",
354
+ olive: "#808000",
355
+ olivedrab: "#6b8e23",
356
+ orange: "#ffa500",
357
+ orangered: "#ff4500",
358
+ orchid: "#da70d6",
359
+ palegoldenrod: "#eee8aa",
360
+ palegreen: "#98fb98",
361
+ paleturquoise: "#afeeee",
362
+ palevioletred: "#db7093",
363
+ papayawhip: "#ffefd5",
364
+ peachpuff: "#ffdab9",
365
+ peru: "#cd853f",
366
+ pink: "#ffc0cb",
367
+ plum: "#dda0dd",
368
+ powderblue: "#b0e0e6",
369
+ purple: "#800080",
370
+ rebeccapurple: "#639",
371
+ red: "#f00",
372
+ rosybrown: "#bc8f8f",
373
+ royalblue: "#4169e1",
374
+ saddlebrown: "#8b4513",
375
+ salmon: "#fa8072",
376
+ sandybrown: "#f4a460",
377
+ seagreen: "#2e8b57",
378
+ seashell: "#fff5ee",
379
+ sienna: "#a0522d",
380
+ silver: "#c0c0c0",
381
+ skyblue: "#87ceeb",
382
+ slateblue: "#6a5acd",
383
+ slategray: "#708090",
384
+ slategrey: "#708090",
385
+ snow: "#fffafa",
386
+ springgreen: "#00ff7f",
387
+ steelblue: "#4682b4",
388
+ tan: "#d2b48c",
389
+ teal: "#008080",
390
+ thistle: "#d8bfd8",
391
+ tomato: "#ff6347",
392
+ turquoise: "#40e0d0",
393
+ violet: "#ee82ee",
394
+ wheat: "#f5deb3",
395
+ white: "#fff",
396
+ whitesmoke: "#f5f5f5",
397
+ yellow: "#ff0",
398
+ yellowgreen: "#9acd32",
343
399
  };
344
400
 
345
401
  /**
346
402
  * Hex values that have shorter color names
347
403
  */
348
404
  export const colorsShortNames = {
349
- '#f0ffff': 'azure',
350
- '#f5f5dc': 'beige',
351
- '#ffe4c4': 'bisque',
352
- '#a52a2a': 'brown',
353
- '#ff7f50': 'coral',
354
- '#ffd700': 'gold',
355
- '#808080': 'gray',
356
- '#008000': 'green',
357
- '#4b0082': 'indigo',
358
- '#fffff0': 'ivory',
359
- '#f0e68c': 'khaki',
360
- '#faf0e6': 'linen',
361
- '#800000': 'maroon',
362
- '#000080': 'navy',
363
- '#808000': 'olive',
364
- '#ffa500': 'orange',
365
- '#da70d6': 'orchid',
366
- '#cd853f': 'peru',
367
- '#ffc0cb': 'pink',
368
- '#dda0dd': 'plum',
369
- '#800080': 'purple',
370
- '#f00': 'red',
371
- '#fa8072': 'salmon',
372
- '#a0522d': 'sienna',
373
- '#c0c0c0': 'silver',
374
- '#fffafa': 'snow',
375
- '#d2b48c': 'tan',
376
- '#008080': 'teal',
377
- '#ff6347': 'tomato',
378
- '#ee82ee': 'violet',
379
- '#f5deb3': 'wheat',
380
- '#fff': 'white',
381
- '#ff0': 'yellow',
405
+ "#f0ffff": "azure",
406
+ "#f5f5dc": "beige",
407
+ "#ffe4c4": "bisque",
408
+ "#a52a2a": "brown",
409
+ "#ff7f50": "coral",
410
+ "#ffd700": "gold",
411
+ "#808080": "gray",
412
+ "#008000": "green",
413
+ "#4b0082": "indigo",
414
+ "#fffff0": "ivory",
415
+ "#f0e68c": "khaki",
416
+ "#faf0e6": "linen",
417
+ "#800000": "maroon",
418
+ "#000080": "navy",
419
+ "#808000": "olive",
420
+ "#ffa500": "orange",
421
+ "#da70d6": "orchid",
422
+ "#cd853f": "peru",
423
+ "#ffc0cb": "pink",
424
+ "#dda0dd": "plum",
425
+ "#800080": "purple",
426
+ "#f00": "red",
427
+ "#fa8072": "salmon",
428
+ "#a0522d": "sienna",
429
+ "#c0c0c0": "silver",
430
+ "#fffafa": "snow",
431
+ "#d2b48c": "tan",
432
+ "#008080": "teal",
433
+ "#ff6347": "tomato",
434
+ "#ee82ee": "violet",
435
+ "#f5deb3": "wheat",
436
+ "#fff": "white",
437
+ "#ff0": "yellow",
382
438
  };
383
439
 
384
440
  // ============================================================================
@@ -389,12 +445,12 @@ export const colorsShortNames = {
389
445
  * Attributes that accept color values
390
446
  */
391
447
  export const colorsProps = new Set([
392
- 'color',
393
- 'fill',
394
- 'flood-color',
395
- 'lighting-color',
396
- 'stop-color',
397
- 'stroke',
448
+ "color",
449
+ "fill",
450
+ "flood-color",
451
+ "lighting-color",
452
+ "stop-color",
453
+ "stroke",
398
454
  ]);
399
455
 
400
456
  // ============================================================================
@@ -406,31 +462,88 @@ export const colorsProps = new Set([
406
462
  */
407
463
  export const knownElements = new Set([
408
464
  // Structural elements
409
- 'svg', 'g', 'defs', 'symbol', 'use',
465
+ "svg",
466
+ "g",
467
+ "defs",
468
+ "symbol",
469
+ "use",
410
470
  // Shape elements
411
- 'path', 'rect', 'circle', 'ellipse', 'line', 'polyline', 'polygon',
471
+ "path",
472
+ "rect",
473
+ "circle",
474
+ "ellipse",
475
+ "line",
476
+ "polyline",
477
+ "polygon",
412
478
  // Text elements
413
- 'text', 'tspan', 'tref', 'textPath', 'altGlyph', 'altGlyphDef',
414
- 'altGlyphItem', 'glyph', 'glyphRef',
479
+ "text",
480
+ "tspan",
481
+ "tref",
482
+ "textPath",
483
+ "altGlyph",
484
+ "altGlyphDef",
485
+ "altGlyphItem",
486
+ "glyph",
487
+ "glyphRef",
415
488
  // Gradient elements
416
- 'linearGradient', 'radialGradient', 'meshGradient', 'stop',
489
+ "linearGradient",
490
+ "radialGradient",
491
+ "meshGradient",
492
+ "stop",
417
493
  // Container elements
418
- 'a', 'marker', 'mask', 'pattern', 'clipPath', 'switch',
494
+ "a",
495
+ "marker",
496
+ "mask",
497
+ "pattern",
498
+ "clipPath",
499
+ "switch",
419
500
  // Filter elements
420
- 'filter', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
421
- 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
422
- 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood',
423
- 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur',
424
- 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset',
425
- 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile',
426
- 'feTurbulence',
501
+ "filter",
502
+ "feBlend",
503
+ "feColorMatrix",
504
+ "feComponentTransfer",
505
+ "feComposite",
506
+ "feConvolveMatrix",
507
+ "feDiffuseLighting",
508
+ "feDisplacementMap",
509
+ "feDistantLight",
510
+ "feDropShadow",
511
+ "feFlood",
512
+ "feFuncA",
513
+ "feFuncB",
514
+ "feFuncG",
515
+ "feFuncR",
516
+ "feGaussianBlur",
517
+ "feImage",
518
+ "feMerge",
519
+ "feMergeNode",
520
+ "feMorphology",
521
+ "feOffset",
522
+ "fePointLight",
523
+ "feSpecularLighting",
524
+ "feSpotLight",
525
+ "feTile",
526
+ "feTurbulence",
427
527
  // Descriptive elements
428
- 'title', 'desc', 'metadata',
528
+ "title",
529
+ "desc",
530
+ "metadata",
429
531
  // Animation elements
430
- 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'set', 'mpath',
532
+ "animate",
533
+ "animateColor",
534
+ "animateMotion",
535
+ "animateTransform",
536
+ "set",
537
+ "mpath",
431
538
  // Other elements
432
- 'image', 'foreignObject', 'view', 'style', 'script',
433
- 'solidColor', 'hatch', 'hatchpath',
539
+ "image",
540
+ "foreignObject",
541
+ "view",
542
+ "style",
543
+ "script",
544
+ "solidColor",
545
+ "hatch",
546
+ "hatchpath",
434
547
  ]);
435
548
 
436
549
  // ============================================================================
@@ -442,146 +555,204 @@ export const knownElements = new Set([
442
555
  */
443
556
  export const presentationDefaults = {
444
557
  // Fill defaults
445
- 'fill': '#000',
446
- 'fill-opacity': '1',
447
- 'fill-rule': 'nonzero',
558
+ fill: "#000",
559
+ "fill-opacity": "1",
560
+ "fill-rule": "nonzero",
448
561
 
449
562
  // Stroke defaults
450
- 'stroke': 'none',
451
- 'stroke-width': '1',
452
- 'stroke-opacity': '1',
453
- 'stroke-linecap': 'butt',
454
- 'stroke-linejoin': 'miter',
455
- 'stroke-miterlimit': '4',
456
- 'stroke-dasharray': 'none',
457
- 'stroke-dashoffset': '0',
563
+ stroke: "none",
564
+ "stroke-width": "1",
565
+ "stroke-opacity": "1",
566
+ "stroke-linecap": "butt",
567
+ "stroke-linejoin": "miter",
568
+ "stroke-miterlimit": "4",
569
+ "stroke-dasharray": "none",
570
+ "stroke-dashoffset": "0",
458
571
 
459
572
  // Opacity/visibility defaults
460
- 'opacity': '1',
461
- 'visibility': 'visible',
462
- 'display': 'inline',
573
+ opacity: "1",
574
+ visibility: "visible",
575
+ display: "inline",
463
576
 
464
577
  // Clip/mask defaults
465
- 'clip': 'auto',
466
- 'clip-path': 'none',
467
- 'clip-rule': 'nonzero',
468
- 'mask': 'none',
578
+ clip: "auto",
579
+ "clip-path": "none",
580
+ "clip-rule": "nonzero",
581
+ mask: "none",
469
582
 
470
583
  // Marker defaults
471
- 'marker-start': 'none',
472
- 'marker-mid': 'none',
473
- 'marker-end': 'none',
584
+ "marker-start": "none",
585
+ "marker-mid": "none",
586
+ "marker-end": "none",
474
587
 
475
588
  // Color defaults
476
- 'stop-color': '#000',
477
- 'stop-opacity': '1',
478
- 'flood-color': '#000',
479
- 'flood-opacity': '1',
480
- 'lighting-color': '#fff',
589
+ "stop-color": "#000",
590
+ "stop-opacity": "1",
591
+ "flood-color": "#000",
592
+ "flood-opacity": "1",
593
+ "lighting-color": "#fff",
481
594
 
482
595
  // Rendering defaults
483
- 'color-interpolation': 'sRGB',
484
- 'color-interpolation-filters': 'linearRGB',
485
- 'color-rendering': 'auto',
486
- 'shape-rendering': 'auto',
487
- 'text-rendering': 'auto',
488
- 'image-rendering': 'auto',
596
+ "color-interpolation": "sRGB",
597
+ "color-interpolation-filters": "linearRGB",
598
+ "color-rendering": "auto",
599
+ "shape-rendering": "auto",
600
+ "text-rendering": "auto",
601
+ "image-rendering": "auto",
489
602
 
490
603
  // Paint defaults
491
- 'paint-order': 'normal',
492
- 'vector-effect': 'none',
604
+ "paint-order": "normal",
605
+ "vector-effect": "none",
493
606
 
494
607
  // Text defaults
495
- 'text-anchor': 'start',
496
- 'text-overflow': 'clip',
497
- 'text-decoration': 'none',
498
- 'dominant-baseline': 'auto',
499
- 'alignment-baseline': 'baseline',
500
- 'baseline-shift': 'baseline',
501
- 'writing-mode': 'lr-tb',
502
- 'direction': 'ltr',
503
- 'unicode-bidi': 'normal',
504
- 'letter-spacing': 'normal',
505
- 'word-spacing': 'normal',
608
+ "text-anchor": "start",
609
+ "text-overflow": "clip",
610
+ "text-decoration": "none",
611
+ "dominant-baseline": "auto",
612
+ "alignment-baseline": "baseline",
613
+ "baseline-shift": "baseline",
614
+ "writing-mode": "lr-tb",
615
+ direction: "ltr",
616
+ "unicode-bidi": "normal",
617
+ "letter-spacing": "normal",
618
+ "word-spacing": "normal",
506
619
 
507
620
  // Font defaults
508
- 'font-style': 'normal',
509
- 'font-variant': 'normal',
510
- 'font-weight': 'normal',
511
- 'font-stretch': 'normal',
512
- 'font-size': 'medium',
513
- 'font-size-adjust': 'none',
621
+ "font-style": "normal",
622
+ "font-variant": "normal",
623
+ "font-weight": "normal",
624
+ "font-stretch": "normal",
625
+ "font-size": "medium",
626
+ "font-size-adjust": "none",
514
627
 
515
628
  // Deprecated but still present
516
- 'glyph-orientation-vertical': 'auto',
517
- 'glyph-orientation-horizontal': '0deg',
629
+ "glyph-orientation-vertical": "auto",
630
+ "glyph-orientation-horizontal": "0deg",
518
631
  };
519
632
 
520
633
  /**
521
634
  * Element-specific default values
522
635
  */
523
636
  export const elementDefaults = {
524
- 'circle': { 'cx': '0', 'cy': '0' },
525
- 'ellipse': { 'cx': '0', 'cy': '0' },
526
- 'line': { 'x1': '0', 'y1': '0', 'x2': '0', 'y2': '0' },
527
- 'rect': { 'x': '0', 'y': '0', 'rx': '0', 'ry': '0' },
528
- 'image': { 'x': '0', 'y': '0', 'preserveAspectRatio': 'xMidYMid meet' },
529
- 'svg': { 'x': '0', 'y': '0', 'preserveAspectRatio': 'xMidYMid meet' },
530
- 'symbol': { 'preserveAspectRatio': 'xMidYMid meet' },
531
- 'marker': {
532
- 'markerUnits': 'strokeWidth',
533
- 'refX': '0', 'refY': '0',
534
- 'markerWidth': '3', 'markerHeight': '3'
637
+ circle: { cx: "0", cy: "0" },
638
+ ellipse: { cx: "0", cy: "0" },
639
+ line: { x1: "0", y1: "0", x2: "0", y2: "0" },
640
+ rect: { x: "0", y: "0", rx: "0", ry: "0" },
641
+ image: { x: "0", y: "0", preserveAspectRatio: "xMidYMid meet" },
642
+ svg: { x: "0", y: "0", preserveAspectRatio: "xMidYMid meet" },
643
+ symbol: { preserveAspectRatio: "xMidYMid meet" },
644
+ marker: {
645
+ markerUnits: "strokeWidth",
646
+ refX: "0",
647
+ refY: "0",
648
+ markerWidth: "3",
649
+ markerHeight: "3",
535
650
  },
536
- 'linearGradient': {
537
- 'x1': '0', 'y1': '0', 'x2': '100%', 'y2': '0',
538
- 'spreadMethod': 'pad'
651
+ linearGradient: {
652
+ x1: "0",
653
+ y1: "0",
654
+ x2: "100%",
655
+ y2: "0",
656
+ spreadMethod: "pad",
539
657
  },
540
- 'radialGradient': {
541
- 'cx': '50%', 'cy': '50%', 'r': '50%',
658
+ radialGradient: {
659
+ cx: "50%",
660
+ cy: "50%",
661
+ r: "50%",
542
662
  // Note: fx and fy default to cx and cy values respectively per SVG spec,
543
663
  // but this cannot be expressed in static defaults. Omitted to avoid incorrect values.
544
- 'spreadMethod': 'pad'
664
+ spreadMethod: "pad",
665
+ },
666
+ pattern: {
667
+ x: "0",
668
+ y: "0",
669
+ patternUnits: "objectBoundingBox",
670
+ patternContentUnits: "userSpaceOnUse",
671
+ },
672
+ clipPath: { clipPathUnits: "userSpaceOnUse" },
673
+ mask: {
674
+ maskUnits: "objectBoundingBox",
675
+ maskContentUnits: "userSpaceOnUse",
676
+ x: "-10%",
677
+ y: "-10%",
678
+ width: "120%",
679
+ height: "120%",
680
+ },
681
+ filter: {
682
+ primitiveUnits: "objectBoundingBox",
683
+ x: "-10%",
684
+ y: "-10%",
685
+ width: "120%",
686
+ height: "120%",
687
+ },
688
+ feBlend: { mode: "normal" },
689
+ feColorMatrix: { type: "matrix" },
690
+ feComposite: { operator: "over", k1: "0", k2: "0", k3: "0", k4: "0" },
691
+ feConvolveMatrix: {
692
+ order: "3",
693
+ bias: "0",
694
+ edgeMode: "duplicate",
695
+ preserveAlpha: "false",
545
696
  },
546
- 'pattern': {
547
- 'x': '0', 'y': '0',
548
- 'patternUnits': 'objectBoundingBox',
549
- 'patternContentUnits': 'userSpaceOnUse'
697
+ feDisplacementMap: {
698
+ scale: "0",
699
+ xChannelSelector: "A",
700
+ yChannelSelector: "A",
550
701
  },
551
- 'clipPath': { 'clipPathUnits': 'userSpaceOnUse' },
552
- 'mask': {
553
- 'maskUnits': 'objectBoundingBox',
554
- 'maskContentUnits': 'userSpaceOnUse',
555
- 'x': '-10%', 'y': '-10%', 'width': '120%', 'height': '120%'
702
+ feDistantLight: { azimuth: "0", elevation: "0" },
703
+ fePointLight: { x: "0", y: "0", z: "0" },
704
+ feSpotLight: {
705
+ x: "0",
706
+ y: "0",
707
+ z: "0",
708
+ pointsAtX: "0",
709
+ pointsAtY: "0",
710
+ pointsAtZ: "0",
711
+ specularExponent: "1",
556
712
  },
557
- 'filter': {
558
- 'primitiveUnits': 'objectBoundingBox',
559
- 'x': '-10%', 'y': '-10%', 'width': '120%', 'height': '120%'
713
+ feTurbulence: {
714
+ baseFrequency: "0",
715
+ numOctaves: "1",
716
+ seed: "0",
717
+ stitchTiles: "noStitch",
718
+ type: "turbulence",
560
719
  },
561
- 'feBlend': { 'mode': 'normal' },
562
- 'feColorMatrix': { 'type': 'matrix' },
563
- 'feComposite': { 'operator': 'over', 'k1': '0', 'k2': '0', 'k3': '0', 'k4': '0' },
564
- 'feConvolveMatrix': { 'order': '3', 'bias': '0', 'edgeMode': 'duplicate', 'preserveAlpha': 'false' },
565
- 'feDisplacementMap': { 'scale': '0', 'xChannelSelector': 'A', 'yChannelSelector': 'A' },
566
- 'feDistantLight': { 'azimuth': '0', 'elevation': '0' },
567
- 'fePointLight': { 'x': '0', 'y': '0', 'z': '0' },
568
- 'feSpotLight': {
569
- 'x': '0', 'y': '0', 'z': '0',
570
- 'pointsAtX': '0', 'pointsAtY': '0', 'pointsAtZ': '0',
571
- 'specularExponent': '1'
720
+ feFuncR: {
721
+ type: "identity",
722
+ slope: "1",
723
+ intercept: "0",
724
+ amplitude: "1",
725
+ exponent: "1",
726
+ offset: "0",
572
727
  },
573
- 'feTurbulence': {
574
- 'baseFrequency': '0', 'numOctaves': '1', 'seed': '0',
575
- 'stitchTiles': 'noStitch', 'type': 'turbulence'
728
+ feFuncG: {
729
+ type: "identity",
730
+ slope: "1",
731
+ intercept: "0",
732
+ amplitude: "1",
733
+ exponent: "1",
734
+ offset: "0",
576
735
  },
577
- 'feFuncR': { 'type': 'identity', 'slope': '1', 'intercept': '0', 'amplitude': '1', 'exponent': '1', 'offset': '0' },
578
- 'feFuncG': { 'type': 'identity', 'slope': '1', 'intercept': '0', 'amplitude': '1', 'exponent': '1', 'offset': '0' },
579
- 'feFuncB': { 'type': 'identity', 'slope': '1', 'intercept': '0', 'amplitude': '1', 'exponent': '1', 'offset': '0' },
580
- 'feFuncA': { 'type': 'identity', 'slope': '1', 'intercept': '0', 'amplitude': '1', 'exponent': '1', 'offset': '0' },
581
- 'a': { 'target': '_self' },
582
- 'textPath': { 'startOffset': '0' },
583
- 'animate': { 'begin': '0s' },
584
- 'animateMotion': { 'rotate': '0' },
736
+ feFuncB: {
737
+ type: "identity",
738
+ slope: "1",
739
+ intercept: "0",
740
+ amplitude: "1",
741
+ exponent: "1",
742
+ offset: "0",
743
+ },
744
+ feFuncA: {
745
+ type: "identity",
746
+ slope: "1",
747
+ intercept: "0",
748
+ amplitude: "1",
749
+ exponent: "1",
750
+ offset: "0",
751
+ },
752
+ a: { target: "_self" },
753
+ textPath: { startOffset: "0" },
754
+ animate: { begin: "0s" },
755
+ animateMotion: { rotate: "0" },
585
756
  };
586
757
 
587
758
  // ============================================================================
@@ -592,15 +763,19 @@ export const elementDefaults = {
592
763
  * Text-related elements that can contain text content
593
764
  */
594
765
  export const textElems = new Set([
595
- 'altGlyph', 'textPath', 'tref', 'tspan', 'text', 'title', 'desc'
766
+ "altGlyph",
767
+ "textPath",
768
+ "tref",
769
+ "tspan",
770
+ "text",
771
+ "title",
772
+ "desc",
596
773
  ]);
597
774
 
598
775
  /**
599
776
  * Elements that can contain path data
600
777
  */
601
- export const pathElems = new Set([
602
- 'glyph', 'missing-glyph', 'path'
603
- ]);
778
+ export const pathElems = new Set(["glyph", "missing-glyph", "path"]);
604
779
 
605
780
  // ============================================================================
606
781
  // ATTRIBUTE GROUPS (P4-4: 15 SVGO-compatible attribute groups)
@@ -610,74 +785,206 @@ export const pathElems = new Set([
610
785
  * Complete attribute groups matching SVGO's _collections.js
611
786
  */
612
787
  export const attrsGroups = {
613
- animationAddition: new Set([
614
- 'additive', 'accumulate'
615
- ]),
616
- animationAttributeTarget: new Set([
617
- 'attributeType', 'attributeName'
618
- ]),
619
- animationEvent: new Set([
620
- 'onbegin', 'onend', 'onrepeat', 'onload'
621
- ]),
788
+ animationAddition: new Set(["additive", "accumulate"]),
789
+ animationAttributeTarget: new Set(["attributeType", "attributeName"]),
790
+ animationEvent: new Set(["onbegin", "onend", "onrepeat", "onload"]),
622
791
  animationTiming: new Set([
623
- 'begin', 'dur', 'end', 'min', 'max', 'restart', 'repeatCount', 'repeatDur', 'fill'
792
+ "begin",
793
+ "dur",
794
+ "end",
795
+ "min",
796
+ "max",
797
+ "restart",
798
+ "repeatCount",
799
+ "repeatDur",
800
+ "fill",
624
801
  ]),
625
802
  animationValue: new Set([
626
- 'calcMode', 'values', 'keyTimes', 'keySplines', 'from', 'to', 'by'
803
+ "calcMode",
804
+ "values",
805
+ "keyTimes",
806
+ "keySplines",
807
+ "from",
808
+ "to",
809
+ "by",
627
810
  ]),
628
811
  conditionalProcessing: new Set([
629
- 'requiredFeatures', 'requiredExtensions', 'systemLanguage'
812
+ "requiredFeatures",
813
+ "requiredExtensions",
814
+ "systemLanguage",
630
815
  ]),
631
816
  core: new Set([
632
- 'id', 'tabindex', 'xml:base', 'xml:lang', 'xml:space', 'lang'
817
+ "id",
818
+ "tabindex",
819
+ "xml:base",
820
+ "xml:lang",
821
+ "xml:space",
822
+ "lang",
633
823
  ]),
634
824
  graphicalEvent: new Set([
635
- 'onfocusin', 'onfocusout', 'onactivate', 'onclick', 'onmousedown',
636
- 'onmouseup', 'onmouseover', 'onmousemove', 'onmouseout', 'onload'
825
+ "onfocusin",
826
+ "onfocusout",
827
+ "onactivate",
828
+ "onclick",
829
+ "onmousedown",
830
+ "onmouseup",
831
+ "onmouseover",
832
+ "onmousemove",
833
+ "onmouseout",
834
+ "onload",
637
835
  ]),
638
836
  presentation: new Set([
639
- 'alignment-baseline', 'baseline-shift', 'clip', 'clip-path', 'clip-rule',
640
- 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile',
641
- 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline',
642
- 'enable-background', 'fill', 'fill-opacity', 'fill-rule', 'filter',
643
- 'flood-color', 'flood-opacity', 'font', 'font-family', 'font-size',
644
- 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight',
645
- 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering',
646
- 'kerning', 'letter-spacing', 'lighting-color', 'marker', 'marker-end',
647
- 'marker-mid', 'marker-start', 'mask', 'opacity', 'overflow', 'paint-order',
648
- 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke',
649
- 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin',
650
- 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor',
651
- 'text-decoration', 'text-rendering', 'transform', 'transform-origin',
652
- 'unicode-bidi', 'vector-effect', 'visibility', 'word-spacing', 'writing-mode'
837
+ "alignment-baseline",
838
+ "baseline-shift",
839
+ "clip",
840
+ "clip-path",
841
+ "clip-rule",
842
+ "color",
843
+ "color-interpolation",
844
+ "color-interpolation-filters",
845
+ "color-profile",
846
+ "color-rendering",
847
+ "cursor",
848
+ "direction",
849
+ "display",
850
+ "dominant-baseline",
851
+ "enable-background",
852
+ "fill",
853
+ "fill-opacity",
854
+ "fill-rule",
855
+ "filter",
856
+ "flood-color",
857
+ "flood-opacity",
858
+ "font",
859
+ "font-family",
860
+ "font-size",
861
+ "font-size-adjust",
862
+ "font-stretch",
863
+ "font-style",
864
+ "font-variant",
865
+ "font-weight",
866
+ "glyph-orientation-horizontal",
867
+ "glyph-orientation-vertical",
868
+ "image-rendering",
869
+ "kerning",
870
+ "letter-spacing",
871
+ "lighting-color",
872
+ "marker",
873
+ "marker-end",
874
+ "marker-mid",
875
+ "marker-start",
876
+ "mask",
877
+ "opacity",
878
+ "overflow",
879
+ "paint-order",
880
+ "pointer-events",
881
+ "shape-rendering",
882
+ "stop-color",
883
+ "stop-opacity",
884
+ "stroke",
885
+ "stroke-dasharray",
886
+ "stroke-dashoffset",
887
+ "stroke-linecap",
888
+ "stroke-linejoin",
889
+ "stroke-miterlimit",
890
+ "stroke-opacity",
891
+ "stroke-width",
892
+ "text-anchor",
893
+ "text-decoration",
894
+ "text-rendering",
895
+ "transform",
896
+ "transform-origin",
897
+ "unicode-bidi",
898
+ "vector-effect",
899
+ "visibility",
900
+ "word-spacing",
901
+ "writing-mode",
653
902
  ]),
654
903
  xlink: new Set([
655
- 'xlink:href', 'xlink:show', 'xlink:actuate', 'xlink:type', 'xlink:role',
656
- 'xlink:arcrole', 'xlink:title'
904
+ "xlink:href",
905
+ "xlink:show",
906
+ "xlink:actuate",
907
+ "xlink:type",
908
+ "xlink:role",
909
+ "xlink:arcrole",
910
+ "xlink:title",
657
911
  ]),
658
912
  documentEvent: new Set([
659
- 'onunload', 'onabort', 'onerror', 'onresize', 'onscroll', 'onzoom'
660
- ]),
661
- documentElementEvent: new Set([
662
- 'oncopy', 'oncut', 'onpaste'
913
+ "onunload",
914
+ "onabort",
915
+ "onerror",
916
+ "onresize",
917
+ "onscroll",
918
+ "onzoom",
663
919
  ]),
920
+ documentElementEvent: new Set(["oncopy", "oncut", "onpaste"]),
664
921
  globalEvent: new Set([
665
- 'oncancel', 'oncanplay', 'oncanplaythrough', 'onchange', 'onclick', 'onclose',
666
- 'oncuechange', 'ondblclick', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave',
667
- 'ondragover', 'ondragstart', 'ondrop', 'ondurationchange', 'onemptied', 'onended',
668
- 'onerror', 'onfocus', 'oninput', 'oninvalid', 'onkeydown', 'onkeypress', 'onkeyup',
669
- 'onload', 'onloadeddata', 'onloadedmetadata', 'onloadstart', 'onmousedown',
670
- 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover',
671
- 'onmouseup', 'onmousewheel', 'onpause', 'onplay', 'onplaying', 'onprogress',
672
- 'onratechange', 'onreset', 'onresize', 'onscroll', 'onseeked', 'onseeking',
673
- 'onselect', 'onshow', 'onstalled', 'onsubmit', 'onsuspend', 'ontimeupdate',
674
- 'ontoggle', 'onvolumechange', 'onwaiting'
675
- ]),
676
- filterPrimitive: new Set([
677
- 'x', 'y', 'width', 'height', 'result'
922
+ "oncancel",
923
+ "oncanplay",
924
+ "oncanplaythrough",
925
+ "onchange",
926
+ "onclick",
927
+ "onclose",
928
+ "oncuechange",
929
+ "ondblclick",
930
+ "ondrag",
931
+ "ondragend",
932
+ "ondragenter",
933
+ "ondragleave",
934
+ "ondragover",
935
+ "ondragstart",
936
+ "ondrop",
937
+ "ondurationchange",
938
+ "onemptied",
939
+ "onended",
940
+ "onerror",
941
+ "onfocus",
942
+ "oninput",
943
+ "oninvalid",
944
+ "onkeydown",
945
+ "onkeypress",
946
+ "onkeyup",
947
+ "onload",
948
+ "onloadeddata",
949
+ "onloadedmetadata",
950
+ "onloadstart",
951
+ "onmousedown",
952
+ "onmouseenter",
953
+ "onmouseleave",
954
+ "onmousemove",
955
+ "onmouseout",
956
+ "onmouseover",
957
+ "onmouseup",
958
+ "onmousewheel",
959
+ "onpause",
960
+ "onplay",
961
+ "onplaying",
962
+ "onprogress",
963
+ "onratechange",
964
+ "onreset",
965
+ "onresize",
966
+ "onscroll",
967
+ "onseeked",
968
+ "onseeking",
969
+ "onselect",
970
+ "onshow",
971
+ "onstalled",
972
+ "onsubmit",
973
+ "onsuspend",
974
+ "ontimeupdate",
975
+ "ontoggle",
976
+ "onvolumechange",
977
+ "onwaiting",
678
978
  ]),
979
+ filterPrimitive: new Set(["x", "y", "width", "height", "result"]),
679
980
  transferFunction: new Set([
680
- 'type', 'tableValues', 'slope', 'intercept', 'amplitude', 'exponent', 'offset'
981
+ "type",
982
+ "tableValues",
983
+ "slope",
984
+ "intercept",
985
+ "amplitude",
986
+ "exponent",
987
+ "offset",
681
988
  ]),
682
989
  };
683
990
 
@@ -690,15 +997,21 @@ export const attrsGroups = {
690
997
  */
691
998
  export const attrsGroupsDeprecated = {
692
999
  presentation: new Set([
693
- 'enable-background', 'glyph-orientation-horizontal', 'glyph-orientation-vertical',
694
- 'kerning', 'clip'
1000
+ "enable-background",
1001
+ "glyph-orientation-horizontal",
1002
+ "glyph-orientation-vertical",
1003
+ "kerning",
1004
+ "clip",
695
1005
  ]),
696
1006
  xlink: new Set([
697
- 'xlink:type', 'xlink:role', 'xlink:arcrole', 'xlink:title', 'xlink:show', 'xlink:actuate'
698
- ]),
699
- core: new Set([
700
- 'xml:base', 'xml:lang', 'xml:space'
1007
+ "xlink:type",
1008
+ "xlink:role",
1009
+ "xlink:arcrole",
1010
+ "xlink:title",
1011
+ "xlink:show",
1012
+ "xlink:actuate",
701
1013
  ]),
1014
+ core: new Set(["xml:base", "xml:lang", "xml:space"]),
702
1015
  };
703
1016
 
704
1017
  // ============================================================================
@@ -710,182 +1023,719 @@ export const attrsGroupsDeprecated = {
710
1023
  * Used for validation and removing invalid children
711
1024
  */
712
1025
  export const allowedChildrenPerElement = {
713
- 'svg': new Set([
714
- 'a', 'altGlyphDef', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
715
- 'circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
716
- 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
717
- 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script',
718
- 'set', 'style', 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
719
- ]),
720
- 'g': new Set([
721
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
722
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
723
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
724
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
725
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
726
- ]),
727
- 'defs': new Set([
728
- 'a', 'altGlyphDef', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
729
- 'circle', 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face',
730
- 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
731
- 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script',
732
- 'set', 'style', 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view',
1026
+ svg: new Set([
1027
+ "a",
1028
+ "altGlyphDef",
1029
+ "animate",
1030
+ "animateColor",
1031
+ "animateMotion",
1032
+ "animateTransform",
1033
+ "circle",
1034
+ "clipPath",
1035
+ "cursor",
1036
+ "defs",
1037
+ "desc",
1038
+ "ellipse",
1039
+ "filter",
1040
+ "font",
1041
+ "font-face",
1042
+ "foreignObject",
1043
+ "g",
1044
+ "image",
1045
+ "line",
1046
+ "linearGradient",
1047
+ "marker",
1048
+ "mask",
1049
+ "metadata",
1050
+ "mpath",
1051
+ "path",
1052
+ "pattern",
1053
+ "polygon",
1054
+ "polyline",
1055
+ "radialGradient",
1056
+ "rect",
1057
+ "script",
1058
+ "set",
1059
+ "style",
1060
+ "svg",
1061
+ "switch",
1062
+ "symbol",
1063
+ "text",
1064
+ "title",
1065
+ "use",
1066
+ "view",
1067
+ ]),
1068
+ g: new Set([
1069
+ "a",
1070
+ "animate",
1071
+ "animateColor",
1072
+ "animateMotion",
1073
+ "animateTransform",
1074
+ "circle",
1075
+ "clipPath",
1076
+ "cursor",
1077
+ "defs",
1078
+ "desc",
1079
+ "ellipse",
1080
+ "filter",
1081
+ "font",
1082
+ "font-face",
1083
+ "foreignObject",
1084
+ "g",
1085
+ "image",
1086
+ "line",
1087
+ "linearGradient",
1088
+ "marker",
1089
+ "mask",
1090
+ "metadata",
1091
+ "path",
1092
+ "pattern",
1093
+ "polygon",
1094
+ "polyline",
1095
+ "radialGradient",
1096
+ "rect",
1097
+ "script",
1098
+ "set",
1099
+ "style",
1100
+ "svg",
1101
+ "switch",
1102
+ "symbol",
1103
+ "text",
1104
+ "title",
1105
+ "use",
1106
+ "view",
1107
+ ]),
1108
+ defs: new Set([
1109
+ "a",
1110
+ "altGlyphDef",
1111
+ "animate",
1112
+ "animateColor",
1113
+ "animateMotion",
1114
+ "animateTransform",
1115
+ "circle",
1116
+ "clipPath",
1117
+ "cursor",
1118
+ "defs",
1119
+ "desc",
1120
+ "ellipse",
1121
+ "filter",
1122
+ "font",
1123
+ "font-face",
1124
+ "foreignObject",
1125
+ "g",
1126
+ "image",
1127
+ "line",
1128
+ "linearGradient",
1129
+ "marker",
1130
+ "mask",
1131
+ "metadata",
1132
+ "mpath",
1133
+ "path",
1134
+ "pattern",
1135
+ "polygon",
1136
+ "polyline",
1137
+ "radialGradient",
1138
+ "rect",
1139
+ "script",
1140
+ "set",
1141
+ "style",
1142
+ "svg",
1143
+ "switch",
1144
+ "symbol",
1145
+ "text",
1146
+ "title",
1147
+ "use",
1148
+ "view",
733
1149
  // SVG 2.0 elements
734
- 'meshgradient', 'meshGradient', 'hatch', 'solidcolor', 'solidColor'
735
- ]),
736
- 'symbol': new Set([
737
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
738
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
739
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
740
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
741
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
742
- ]),
743
- 'marker': new Set([
744
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
745
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
746
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
747
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
748
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
749
- ]),
750
- 'clipPath': new Set([
751
- 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'desc',
752
- 'ellipse', 'line', 'metadata', 'path', 'polygon', 'polyline', 'rect', 'set', 'text',
753
- 'title', 'use'
754
- ]),
755
- 'mask': new Set([
756
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
757
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
758
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
759
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
760
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
761
- ]),
762
- 'pattern': new Set([
763
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
764
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
765
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
766
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
767
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
768
- ]),
769
- 'a': new Set([
770
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
771
- 'clipPath', 'cursor', 'defs', 'desc', 'ellipse', 'filter', 'font', 'font-face', 'foreignObject',
772
- 'g', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'path',
773
- 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'style',
774
- 'svg', 'switch', 'symbol', 'text', 'title', 'use', 'view'
775
- ]),
776
- 'switch': new Set([
777
- 'a', 'animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle',
778
- 'cursor', 'desc', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'metadata', 'path',
779
- 'polygon', 'polyline', 'rect', 'set', 'svg', 'switch', 'text', 'title', 'use', 'view'
780
- ]),
781
- 'text': new Set([
782
- 'a', 'altGlyph', 'animate', 'animateColor', 'animateMotion', 'animateTransform',
783
- 'desc', 'metadata', 'set', 'textPath', 'title', 'tref', 'tspan'
784
- ]),
785
- 'textPath': new Set([
786
- 'a', 'altGlyph', 'animate', 'animateColor', 'desc', 'metadata', 'set', 'title', 'tref', 'tspan'
787
- ]),
788
- 'tspan': new Set([
789
- 'a', 'altGlyph', 'animate', 'animateColor', 'desc', 'metadata', 'set', 'title', 'tref', 'tspan'
790
- ]),
791
- 'linearGradient': new Set([
792
- 'animate', 'animateTransform', 'desc', 'metadata', 'set', 'stop', 'title'
793
- ]),
794
- 'radialGradient': new Set([
795
- 'animate', 'animateTransform', 'desc', 'metadata', 'set', 'stop', 'title'
1150
+ "meshgradient",
1151
+ "meshGradient",
1152
+ "hatch",
1153
+ "solidcolor",
1154
+ "solidColor",
796
1155
  ]),
797
- // SVG 2.0 mesh gradient element hierarchy
798
- 'meshgradient': new Set([
799
- 'animate', 'animateTransform', 'desc', 'metadata', 'meshrow', 'set', 'title'
1156
+ symbol: new Set([
1157
+ "a",
1158
+ "animate",
1159
+ "animateColor",
1160
+ "animateMotion",
1161
+ "animateTransform",
1162
+ "circle",
1163
+ "clipPath",
1164
+ "cursor",
1165
+ "defs",
1166
+ "desc",
1167
+ "ellipse",
1168
+ "filter",
1169
+ "font",
1170
+ "font-face",
1171
+ "foreignObject",
1172
+ "g",
1173
+ "image",
1174
+ "line",
1175
+ "linearGradient",
1176
+ "marker",
1177
+ "mask",
1178
+ "metadata",
1179
+ "path",
1180
+ "pattern",
1181
+ "polygon",
1182
+ "polyline",
1183
+ "radialGradient",
1184
+ "rect",
1185
+ "script",
1186
+ "set",
1187
+ "style",
1188
+ "svg",
1189
+ "switch",
1190
+ "symbol",
1191
+ "text",
1192
+ "title",
1193
+ "use",
1194
+ "view",
1195
+ ]),
1196
+ marker: new Set([
1197
+ "a",
1198
+ "animate",
1199
+ "animateColor",
1200
+ "animateMotion",
1201
+ "animateTransform",
1202
+ "circle",
1203
+ "clipPath",
1204
+ "cursor",
1205
+ "defs",
1206
+ "desc",
1207
+ "ellipse",
1208
+ "filter",
1209
+ "font",
1210
+ "font-face",
1211
+ "foreignObject",
1212
+ "g",
1213
+ "image",
1214
+ "line",
1215
+ "linearGradient",
1216
+ "marker",
1217
+ "mask",
1218
+ "metadata",
1219
+ "path",
1220
+ "pattern",
1221
+ "polygon",
1222
+ "polyline",
1223
+ "radialGradient",
1224
+ "rect",
1225
+ "script",
1226
+ "set",
1227
+ "style",
1228
+ "svg",
1229
+ "switch",
1230
+ "symbol",
1231
+ "text",
1232
+ "title",
1233
+ "use",
1234
+ "view",
1235
+ ]),
1236
+ clipPath: new Set([
1237
+ "animate",
1238
+ "animateColor",
1239
+ "animateMotion",
1240
+ "animateTransform",
1241
+ "circle",
1242
+ "desc",
1243
+ "ellipse",
1244
+ "line",
1245
+ "metadata",
1246
+ "path",
1247
+ "polygon",
1248
+ "polyline",
1249
+ "rect",
1250
+ "set",
1251
+ "text",
1252
+ "title",
1253
+ "use",
1254
+ ]),
1255
+ mask: new Set([
1256
+ "a",
1257
+ "animate",
1258
+ "animateColor",
1259
+ "animateMotion",
1260
+ "animateTransform",
1261
+ "circle",
1262
+ "clipPath",
1263
+ "cursor",
1264
+ "defs",
1265
+ "desc",
1266
+ "ellipse",
1267
+ "filter",
1268
+ "font",
1269
+ "font-face",
1270
+ "foreignObject",
1271
+ "g",
1272
+ "image",
1273
+ "line",
1274
+ "linearGradient",
1275
+ "marker",
1276
+ "mask",
1277
+ "metadata",
1278
+ "path",
1279
+ "pattern",
1280
+ "polygon",
1281
+ "polyline",
1282
+ "radialGradient",
1283
+ "rect",
1284
+ "script",
1285
+ "set",
1286
+ "style",
1287
+ "svg",
1288
+ "switch",
1289
+ "symbol",
1290
+ "text",
1291
+ "title",
1292
+ "use",
1293
+ "view",
1294
+ ]),
1295
+ pattern: new Set([
1296
+ "a",
1297
+ "animate",
1298
+ "animateColor",
1299
+ "animateMotion",
1300
+ "animateTransform",
1301
+ "circle",
1302
+ "clipPath",
1303
+ "cursor",
1304
+ "defs",
1305
+ "desc",
1306
+ "ellipse",
1307
+ "filter",
1308
+ "font",
1309
+ "font-face",
1310
+ "foreignObject",
1311
+ "g",
1312
+ "image",
1313
+ "line",
1314
+ "linearGradient",
1315
+ "marker",
1316
+ "mask",
1317
+ "metadata",
1318
+ "path",
1319
+ "pattern",
1320
+ "polygon",
1321
+ "polyline",
1322
+ "radialGradient",
1323
+ "rect",
1324
+ "script",
1325
+ "set",
1326
+ "style",
1327
+ "svg",
1328
+ "switch",
1329
+ "symbol",
1330
+ "text",
1331
+ "title",
1332
+ "use",
1333
+ "view",
1334
+ ]),
1335
+ a: new Set([
1336
+ "a",
1337
+ "animate",
1338
+ "animateColor",
1339
+ "animateMotion",
1340
+ "animateTransform",
1341
+ "circle",
1342
+ "clipPath",
1343
+ "cursor",
1344
+ "defs",
1345
+ "desc",
1346
+ "ellipse",
1347
+ "filter",
1348
+ "font",
1349
+ "font-face",
1350
+ "foreignObject",
1351
+ "g",
1352
+ "image",
1353
+ "line",
1354
+ "linearGradient",
1355
+ "marker",
1356
+ "mask",
1357
+ "metadata",
1358
+ "path",
1359
+ "pattern",
1360
+ "polygon",
1361
+ "polyline",
1362
+ "radialGradient",
1363
+ "rect",
1364
+ "script",
1365
+ "set",
1366
+ "style",
1367
+ "svg",
1368
+ "switch",
1369
+ "symbol",
1370
+ "text",
1371
+ "title",
1372
+ "use",
1373
+ "view",
1374
+ ]),
1375
+ switch: new Set([
1376
+ "a",
1377
+ "animate",
1378
+ "animateColor",
1379
+ "animateMotion",
1380
+ "animateTransform",
1381
+ "circle",
1382
+ "cursor",
1383
+ "desc",
1384
+ "ellipse",
1385
+ "foreignObject",
1386
+ "g",
1387
+ "image",
1388
+ "line",
1389
+ "metadata",
1390
+ "path",
1391
+ "polygon",
1392
+ "polyline",
1393
+ "rect",
1394
+ "set",
1395
+ "svg",
1396
+ "switch",
1397
+ "text",
1398
+ "title",
1399
+ "use",
1400
+ "view",
1401
+ ]),
1402
+ text: new Set([
1403
+ "a",
1404
+ "altGlyph",
1405
+ "animate",
1406
+ "animateColor",
1407
+ "animateMotion",
1408
+ "animateTransform",
1409
+ "desc",
1410
+ "metadata",
1411
+ "set",
1412
+ "textPath",
1413
+ "title",
1414
+ "tref",
1415
+ "tspan",
800
1416
  ]),
801
- 'meshGradient': new Set([
802
- 'animate', 'animateTransform', 'desc', 'metadata', 'meshrow', 'set', 'title'
1417
+ textPath: new Set([
1418
+ "a",
1419
+ "altGlyph",
1420
+ "animate",
1421
+ "animateColor",
1422
+ "desc",
1423
+ "metadata",
1424
+ "set",
1425
+ "title",
1426
+ "tref",
1427
+ "tspan",
803
1428
  ]),
804
- 'meshrow': new Set([
805
- 'meshpatch'
1429
+ tspan: new Set([
1430
+ "a",
1431
+ "altGlyph",
1432
+ "animate",
1433
+ "animateColor",
1434
+ "desc",
1435
+ "metadata",
1436
+ "set",
1437
+ "title",
1438
+ "tref",
1439
+ "tspan",
806
1440
  ]),
807
- 'meshpatch': new Set([
808
- 'stop'
1441
+ linearGradient: new Set([
1442
+ "animate",
1443
+ "animateTransform",
1444
+ "desc",
1445
+ "metadata",
1446
+ "set",
1447
+ "stop",
1448
+ "title",
809
1449
  ]),
1450
+ radialGradient: new Set([
1451
+ "animate",
1452
+ "animateTransform",
1453
+ "desc",
1454
+ "metadata",
1455
+ "set",
1456
+ "stop",
1457
+ "title",
1458
+ ]),
1459
+ // SVG 2.0 mesh gradient element hierarchy
1460
+ meshgradient: new Set([
1461
+ "animate",
1462
+ "animateTransform",
1463
+ "desc",
1464
+ "metadata",
1465
+ "meshrow",
1466
+ "set",
1467
+ "title",
1468
+ ]),
1469
+ meshGradient: new Set([
1470
+ "animate",
1471
+ "animateTransform",
1472
+ "desc",
1473
+ "metadata",
1474
+ "meshrow",
1475
+ "set",
1476
+ "title",
1477
+ ]),
1478
+ meshrow: new Set(["meshpatch"]),
1479
+ meshpatch: new Set(["stop"]),
810
1480
  // SVG 2.0 hatch element
811
- 'hatch': new Set([
812
- 'animate', 'animateTransform', 'desc', 'hatchpath', 'hatchPath', 'metadata', 'script', 'set', 'style', 'title'
813
- ]),
814
- 'hatchpath': new Set([
815
- 'animate', 'animateTransform', 'desc', 'metadata', 'script', 'set', 'title'
816
- ]),
817
- 'hatchPath': new Set([
818
- 'animate', 'animateTransform', 'desc', 'metadata', 'script', 'set', 'title'
819
- ]),
820
- 'filter': new Set([
821
- 'animate', 'animateTransform', 'desc', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
822
- 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap',
823
- 'feDropShadow', 'feFlood', 'feGaussianBlur', 'feImage', 'feMerge', 'feMorphology',
824
- 'feOffset', 'feSpecularLighting', 'feTile', 'feTurbulence', 'metadata', 'set', 'title'
825
- ]),
826
- 'feBlend': new Set(['animate', 'set']),
827
- 'feColorMatrix': new Set(['animate', 'set']),
828
- 'feComponentTransfer': new Set(['feFuncA', 'feFuncB', 'feFuncG', 'feFuncR']),
829
- 'feComposite': new Set(['animate', 'set']),
830
- 'feConvolveMatrix': new Set(['animate', 'set']),
831
- 'feDiffuseLighting': new Set(['animate', 'feDistantLight', 'fePointLight', 'feSpotLight', 'set']),
832
- 'feDisplacementMap': new Set(['animate', 'set']),
833
- 'feDropShadow': new Set(['animate', 'set']),
834
- 'feFlood': new Set(['animate', 'set']),
835
- 'feFuncA': new Set(['animate', 'set']),
836
- 'feFuncB': new Set(['animate', 'set']),
837
- 'feFuncG': new Set(['animate', 'set']),
838
- 'feFuncR': new Set(['animate', 'set']),
839
- 'feGaussianBlur': new Set(['animate', 'set']),
840
- 'feImage': new Set(['animate', 'set']),
841
- 'feMerge': new Set(['feMergeNode']),
842
- 'feMergeNode': new Set(['animate', 'set']),
843
- 'feMorphology': new Set(['animate', 'set']),
844
- 'feOffset': new Set(['animate', 'set']),
845
- 'feSpecularLighting': new Set(['animate', 'feDistantLight', 'fePointLight', 'feSpotLight', 'set']),
846
- 'feTile': new Set(['animate', 'set']),
847
- 'feTurbulence': new Set(['animate', 'set']),
848
- 'animate': new Set(['desc', 'metadata', 'title']),
849
- 'animateColor': new Set(['desc', 'metadata', 'title']),
850
- 'animateMotion': new Set(['desc', 'metadata', 'mpath', 'title']),
851
- 'animateTransform': new Set(['desc', 'metadata', 'title']),
852
- 'set': new Set(['desc', 'metadata', 'title']),
1481
+ hatch: new Set([
1482
+ "animate",
1483
+ "animateTransform",
1484
+ "desc",
1485
+ "hatchpath",
1486
+ "hatchPath",
1487
+ "metadata",
1488
+ "script",
1489
+ "set",
1490
+ "style",
1491
+ "title",
1492
+ ]),
1493
+ hatchpath: new Set([
1494
+ "animate",
1495
+ "animateTransform",
1496
+ "desc",
1497
+ "metadata",
1498
+ "script",
1499
+ "set",
1500
+ "title",
1501
+ ]),
1502
+ hatchPath: new Set([
1503
+ "animate",
1504
+ "animateTransform",
1505
+ "desc",
1506
+ "metadata",
1507
+ "script",
1508
+ "set",
1509
+ "title",
1510
+ ]),
1511
+ filter: new Set([
1512
+ "animate",
1513
+ "animateTransform",
1514
+ "desc",
1515
+ "feBlend",
1516
+ "feColorMatrix",
1517
+ "feComponentTransfer",
1518
+ "feComposite",
1519
+ "feConvolveMatrix",
1520
+ "feDiffuseLighting",
1521
+ "feDisplacementMap",
1522
+ "feDropShadow",
1523
+ "feFlood",
1524
+ "feGaussianBlur",
1525
+ "feImage",
1526
+ "feMerge",
1527
+ "feMorphology",
1528
+ "feOffset",
1529
+ "feSpecularLighting",
1530
+ "feTile",
1531
+ "feTurbulence",
1532
+ "metadata",
1533
+ "set",
1534
+ "title",
1535
+ ]),
1536
+ feBlend: new Set(["animate", "set"]),
1537
+ feColorMatrix: new Set(["animate", "set"]),
1538
+ feComponentTransfer: new Set(["feFuncA", "feFuncB", "feFuncG", "feFuncR"]),
1539
+ feComposite: new Set(["animate", "set"]),
1540
+ feConvolveMatrix: new Set(["animate", "set"]),
1541
+ feDiffuseLighting: new Set([
1542
+ "animate",
1543
+ "feDistantLight",
1544
+ "fePointLight",
1545
+ "feSpotLight",
1546
+ "set",
1547
+ ]),
1548
+ feDisplacementMap: new Set(["animate", "set"]),
1549
+ feDropShadow: new Set(["animate", "set"]),
1550
+ feFlood: new Set(["animate", "set"]),
1551
+ feFuncA: new Set(["animate", "set"]),
1552
+ feFuncB: new Set(["animate", "set"]),
1553
+ feFuncG: new Set(["animate", "set"]),
1554
+ feFuncR: new Set(["animate", "set"]),
1555
+ feGaussianBlur: new Set(["animate", "set"]),
1556
+ feImage: new Set(["animate", "set"]),
1557
+ feMerge: new Set(["feMergeNode"]),
1558
+ feMergeNode: new Set(["animate", "set"]),
1559
+ feMorphology: new Set(["animate", "set"]),
1560
+ feOffset: new Set(["animate", "set"]),
1561
+ feSpecularLighting: new Set([
1562
+ "animate",
1563
+ "feDistantLight",
1564
+ "fePointLight",
1565
+ "feSpotLight",
1566
+ "set",
1567
+ ]),
1568
+ feTile: new Set(["animate", "set"]),
1569
+ feTurbulence: new Set(["animate", "set"]),
1570
+ animate: new Set(["desc", "metadata", "title"]),
1571
+ animateColor: new Set(["desc", "metadata", "title"]),
1572
+ animateMotion: new Set(["desc", "metadata", "mpath", "title"]),
1573
+ animateTransform: new Set(["desc", "metadata", "title"]),
1574
+ set: new Set(["desc", "metadata", "title"]),
853
1575
  // Shape elements cannot have children (except animation)
854
- 'circle': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
855
- 'ellipse': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
856
- 'line': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
857
- 'path': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
858
- 'polygon': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
859
- 'polyline': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
860
- 'rect': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
861
- 'image': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
862
- 'use': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
1576
+ circle: new Set([
1577
+ "animate",
1578
+ "animateColor",
1579
+ "animateMotion",
1580
+ "animateTransform",
1581
+ "desc",
1582
+ "metadata",
1583
+ "set",
1584
+ "title",
1585
+ ]),
1586
+ ellipse: new Set([
1587
+ "animate",
1588
+ "animateColor",
1589
+ "animateMotion",
1590
+ "animateTransform",
1591
+ "desc",
1592
+ "metadata",
1593
+ "set",
1594
+ "title",
1595
+ ]),
1596
+ line: new Set([
1597
+ "animate",
1598
+ "animateColor",
1599
+ "animateMotion",
1600
+ "animateTransform",
1601
+ "desc",
1602
+ "metadata",
1603
+ "set",
1604
+ "title",
1605
+ ]),
1606
+ path: new Set([
1607
+ "animate",
1608
+ "animateColor",
1609
+ "animateMotion",
1610
+ "animateTransform",
1611
+ "desc",
1612
+ "metadata",
1613
+ "set",
1614
+ "title",
1615
+ ]),
1616
+ polygon: new Set([
1617
+ "animate",
1618
+ "animateColor",
1619
+ "animateMotion",
1620
+ "animateTransform",
1621
+ "desc",
1622
+ "metadata",
1623
+ "set",
1624
+ "title",
1625
+ ]),
1626
+ polyline: new Set([
1627
+ "animate",
1628
+ "animateColor",
1629
+ "animateMotion",
1630
+ "animateTransform",
1631
+ "desc",
1632
+ "metadata",
1633
+ "set",
1634
+ "title",
1635
+ ]),
1636
+ rect: new Set([
1637
+ "animate",
1638
+ "animateColor",
1639
+ "animateMotion",
1640
+ "animateTransform",
1641
+ "desc",
1642
+ "metadata",
1643
+ "set",
1644
+ "title",
1645
+ ]),
1646
+ image: new Set([
1647
+ "animate",
1648
+ "animateColor",
1649
+ "animateMotion",
1650
+ "animateTransform",
1651
+ "desc",
1652
+ "metadata",
1653
+ "set",
1654
+ "title",
1655
+ ]),
1656
+ use: new Set([
1657
+ "animate",
1658
+ "animateColor",
1659
+ "animateMotion",
1660
+ "animateTransform",
1661
+ "desc",
1662
+ "metadata",
1663
+ "set",
1664
+ "title",
1665
+ ]),
863
1666
  // Descriptive elements have no children
864
- 'title': new Set([]),
865
- 'desc': new Set([]),
866
- 'metadata': new Set([]), // Can have any XML content, but SVG-wise empty
1667
+ title: new Set([]),
1668
+ desc: new Set([]),
1669
+ metadata: new Set([]), // Can have any XML content, but SVG-wise empty
867
1670
  // Light source elements
868
- 'feDistantLight': new Set(['animate', 'set']),
869
- 'fePointLight': new Set(['animate', 'set']),
870
- 'feSpotLight': new Set(['animate', 'set']),
1671
+ feDistantLight: new Set(["animate", "set"]),
1672
+ fePointLight: new Set(["animate", "set"]),
1673
+ feSpotLight: new Set(["animate", "set"]),
871
1674
  // Stop element
872
- 'stop': new Set(['animate', 'set']),
1675
+ stop: new Set(["animate", "set"]),
873
1676
  // SVG 2.0 solidColor element (paint server)
874
- 'solidColor': new Set(['animate', 'animateColor', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
875
- 'solidcolor': new Set(['animate', 'animateColor', 'animateTransform', 'desc', 'metadata', 'set', 'title']),
1677
+ solidColor: new Set([
1678
+ "animate",
1679
+ "animateColor",
1680
+ "animateTransform",
1681
+ "desc",
1682
+ "metadata",
1683
+ "set",
1684
+ "title",
1685
+ ]),
1686
+ solidcolor: new Set([
1687
+ "animate",
1688
+ "animateColor",
1689
+ "animateTransform",
1690
+ "desc",
1691
+ "metadata",
1692
+ "set",
1693
+ "title",
1694
+ ]),
876
1695
  // Text content elements
877
- 'tref': new Set(['animate', 'animateColor', 'desc', 'metadata', 'set', 'title']),
878
- 'altGlyph': new Set(['animate', 'animateColor', 'desc', 'metadata', 'set', 'title']),
879
- 'altGlyphDef': new Set(['altGlyphItem']),
880
- 'altGlyphItem': new Set(['glyphRef', 'altGlyphItem']),
881
- 'glyph': new Set(['animate', 'animateColor', 'animateMotion', 'animateTransform', 'circle', 'desc', 'ellipse', 'line', 'metadata', 'path', 'polygon', 'polyline', 'rect', 'set', 'title', 'use']),
882
- 'glyphRef': new Set([]),
1696
+ tref: new Set([
1697
+ "animate",
1698
+ "animateColor",
1699
+ "desc",
1700
+ "metadata",
1701
+ "set",
1702
+ "title",
1703
+ ]),
1704
+ altGlyph: new Set([
1705
+ "animate",
1706
+ "animateColor",
1707
+ "desc",
1708
+ "metadata",
1709
+ "set",
1710
+ "title",
1711
+ ]),
1712
+ altGlyphDef: new Set(["altGlyphItem"]),
1713
+ altGlyphItem: new Set(["glyphRef", "altGlyphItem"]),
1714
+ glyph: new Set([
1715
+ "animate",
1716
+ "animateColor",
1717
+ "animateMotion",
1718
+ "animateTransform",
1719
+ "circle",
1720
+ "desc",
1721
+ "ellipse",
1722
+ "line",
1723
+ "metadata",
1724
+ "path",
1725
+ "polygon",
1726
+ "polyline",
1727
+ "rect",
1728
+ "set",
1729
+ "title",
1730
+ "use",
1731
+ ]),
1732
+ glyphRef: new Set([]),
883
1733
  // Other elements
884
- 'foreignObject': new Set([]), // Can contain any non-SVG content
885
- 'style': new Set([]),
886
- 'script': new Set([]),
887
- 'view': new Set(['desc', 'metadata', 'title']),
888
- 'mpath': new Set(['desc', 'metadata', 'title']),
1734
+ foreignObject: new Set([]), // Can contain any non-SVG content
1735
+ style: new Set([]),
1736
+ script: new Set([]),
1737
+ view: new Set(["desc", "metadata", "title"]),
1738
+ mpath: new Set(["desc", "metadata", "title"]),
889
1739
  };
890
1740
 
891
1741
  // ============================================================================
@@ -899,37 +1749,66 @@ export const allowedChildrenPerElement = {
899
1749
  export const pseudoClasses = {
900
1750
  // User action pseudo-classes - cannot be evaluated
901
1751
  userAction: new Set([
902
- ':hover', ':active', ':focus', ':focus-within', ':focus-visible'
1752
+ ":hover",
1753
+ ":active",
1754
+ ":focus",
1755
+ ":focus-within",
1756
+ ":focus-visible",
903
1757
  ]),
904
1758
  // Tree-structural pseudo-classes - can sometimes be evaluated
905
1759
  treeStructural: new Set([
906
- ':root', ':empty', ':first-child', ':last-child', ':only-child',
907
- ':first-of-type', ':last-of-type', ':only-of-type',
908
- ':nth-child', ':nth-last-child', ':nth-of-type', ':nth-last-of-type'
1760
+ ":root",
1761
+ ":empty",
1762
+ ":first-child",
1763
+ ":last-child",
1764
+ ":only-child",
1765
+ ":first-of-type",
1766
+ ":last-of-type",
1767
+ ":only-of-type",
1768
+ ":nth-child",
1769
+ ":nth-last-child",
1770
+ ":nth-of-type",
1771
+ ":nth-last-of-type",
909
1772
  ]),
910
1773
  // Link pseudo-classes
911
- link: new Set([
912
- ':link', ':visited', ':any-link', ':local-link', ':target'
913
- ]),
1774
+ link: new Set([":link", ":visited", ":any-link", ":local-link", ":target"]),
914
1775
  // Input pseudo-classes
915
1776
  input: new Set([
916
- ':enabled', ':disabled', ':read-only', ':read-write', ':placeholder-shown',
917
- ':default', ':checked', ':indeterminate', ':valid', ':invalid', ':in-range',
918
- ':out-of-range', ':required', ':optional'
1777
+ ":enabled",
1778
+ ":disabled",
1779
+ ":read-only",
1780
+ ":read-write",
1781
+ ":placeholder-shown",
1782
+ ":default",
1783
+ ":checked",
1784
+ ":indeterminate",
1785
+ ":valid",
1786
+ ":invalid",
1787
+ ":in-range",
1788
+ ":out-of-range",
1789
+ ":required",
1790
+ ":optional",
919
1791
  ]),
920
1792
  // Linguistic pseudo-classes
921
- linguistic: new Set([
922
- ':lang', ':dir'
923
- ]),
1793
+ linguistic: new Set([":lang", ":dir"]),
924
1794
  // Negation and matching
925
- functional: new Set([
926
- ':not', ':is', ':where', ':has'
927
- ]),
1795
+ functional: new Set([":not", ":is", ":where", ":has"]),
928
1796
  // All pseudo-classes that prevent inlining
929
1797
  preventInlining: new Set([
930
- ':hover', ':active', ':focus', ':focus-within', ':focus-visible',
931
- ':visited', ':target', ':lang', ':dir', ':not', ':is', ':where', ':has'
932
- ])
1798
+ ":hover",
1799
+ ":active",
1800
+ ":focus",
1801
+ ":focus-within",
1802
+ ":focus-visible",
1803
+ ":visited",
1804
+ ":target",
1805
+ ":lang",
1806
+ ":dir",
1807
+ ":not",
1808
+ ":is",
1809
+ ":where",
1810
+ ":has",
1811
+ ]),
933
1812
  };
934
1813
 
935
1814
  // ============================================================================
@@ -943,11 +1822,11 @@ export const pseudoClasses = {
943
1822
  */
944
1823
  export const additionalEditorNamespaces = new Set([
945
1824
  // CorelDraw
946
- 'http://www.corel.com/coreldraw/svg',
1825
+ "http://www.corel.com/coreldraw/svg",
947
1826
  // Gravit Designer
948
- 'http://gravit.io/ns',
1827
+ "http://gravit.io/ns",
949
1828
  // Affinity
950
- 'http://serif.com/affinity',
1829
+ "http://serif.com/affinity",
951
1830
  // Canva
952
- 'http://canva.com/ns',
1831
+ "http://canva.com/ns",
953
1832
  ]);