_collections.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168
  1. 'use strict';
  2. // https://www.w3.org/TR/SVG11/intro.html#Definitions
  3. /**
  4. * @type {Record<string, Array<string>>}
  5. */
  6. exports.elemsGroups = {
  7. animation: [
  8. 'animate',
  9. 'animateColor',
  10. 'animateMotion',
  11. 'animateTransform',
  12. 'set',
  13. ],
  14. descriptive: ['desc', 'metadata', 'title'],
  15. shape: ['circle', 'ellipse', 'line', 'path', 'polygon', 'polyline', 'rect'],
  16. structural: ['defs', 'g', 'svg', 'symbol', 'use'],
  17. paintServer: [
  18. 'solidColor',
  19. 'linearGradient',
  20. 'radialGradient',
  21. 'meshGradient',
  22. 'pattern',
  23. 'hatch',
  24. ],
  25. nonRendering: [
  26. 'linearGradient',
  27. 'radialGradient',
  28. 'pattern',
  29. 'clipPath',
  30. 'mask',
  31. 'marker',
  32. 'symbol',
  33. 'filter',
  34. 'solidColor',
  35. ],
  36. container: [
  37. 'a',
  38. 'defs',
  39. 'g',
  40. 'marker',
  41. 'mask',
  42. 'missing-glyph',
  43. 'pattern',
  44. 'svg',
  45. 'switch',
  46. 'symbol',
  47. 'foreignObject',
  48. ],
  49. textContent: [
  50. 'altGlyph',
  51. 'altGlyphDef',
  52. 'altGlyphItem',
  53. 'glyph',
  54. 'glyphRef',
  55. 'textPath',
  56. 'text',
  57. 'tref',
  58. 'tspan',
  59. ],
  60. textContentChild: ['altGlyph', 'textPath', 'tref', 'tspan'],
  61. lightSource: [
  62. 'feDiffuseLighting',
  63. 'feSpecularLighting',
  64. 'feDistantLight',
  65. 'fePointLight',
  66. 'feSpotLight',
  67. ],
  68. filterPrimitive: [
  69. 'feBlend',
  70. 'feColorMatrix',
  71. 'feComponentTransfer',
  72. 'feComposite',
  73. 'feConvolveMatrix',
  74. 'feDiffuseLighting',
  75. 'feDisplacementMap',
  76. 'feDropShadow',
  77. 'feFlood',
  78. 'feFuncA',
  79. 'feFuncB',
  80. 'feFuncG',
  81. 'feFuncR',
  82. 'feGaussianBlur',
  83. 'feImage',
  84. 'feMerge',
  85. 'feMergeNode',
  86. 'feMorphology',
  87. 'feOffset',
  88. 'feSpecularLighting',
  89. 'feTile',
  90. 'feTurbulence',
  91. ],
  92. };
  93. exports.textElems = exports.elemsGroups.textContent.concat('title');
  94. exports.pathElems = ['path', 'glyph', 'missing-glyph'];
  95. // https://www.w3.org/TR/SVG11/intro.html#Definitions
  96. /**
  97. * @type {Record<string, Array<string>>}
  98. */
  99. exports.attrsGroups = {
  100. animationAddition: ['additive', 'accumulate'],
  101. animationAttributeTarget: ['attributeType', 'attributeName'],
  102. animationEvent: ['onbegin', 'onend', 'onrepeat', 'onload'],
  103. animationTiming: [
  104. 'begin',
  105. 'dur',
  106. 'end',
  107. 'min',
  108. 'max',
  109. 'restart',
  110. 'repeatCount',
  111. 'repeatDur',
  112. 'fill',
  113. ],
  114. animationValue: [
  115. 'calcMode',
  116. 'values',
  117. 'keyTimes',
  118. 'keySplines',
  119. 'from',
  120. 'to',
  121. 'by',
  122. ],
  123. conditionalProcessing: [
  124. 'requiredFeatures',
  125. 'requiredExtensions',
  126. 'systemLanguage',
  127. ],
  128. core: ['id', 'tabindex', 'xml:base', 'xml:lang', 'xml:space'],
  129. graphicalEvent: [
  130. 'onfocusin',
  131. 'onfocusout',
  132. 'onactivate',
  133. 'onclick',
  134. 'onmousedown',
  135. 'onmouseup',
  136. 'onmouseover',
  137. 'onmousemove',
  138. 'onmouseout',
  139. 'onload',
  140. ],
  141. presentation: [
  142. 'alignment-baseline',
  143. 'baseline-shift',
  144. 'clip',
  145. 'clip-path',
  146. 'clip-rule',
  147. 'color',
  148. 'color-interpolation',
  149. 'color-interpolation-filters',
  150. 'color-profile',
  151. 'color-rendering',
  152. 'cursor',
  153. 'direction',
  154. 'display',
  155. 'dominant-baseline',
  156. 'enable-background',
  157. 'fill',
  158. 'fill-opacity',
  159. 'fill-rule',
  160. 'filter',
  161. 'flood-color',
  162. 'flood-opacity',
  163. 'font-family',
  164. 'font-size',
  165. 'font-size-adjust',
  166. 'font-stretch',
  167. 'font-style',
  168. 'font-variant',
  169. 'font-weight',
  170. 'glyph-orientation-horizontal',
  171. 'glyph-orientation-vertical',
  172. 'image-rendering',
  173. 'letter-spacing',
  174. 'lighting-color',
  175. 'marker-end',
  176. 'marker-mid',
  177. 'marker-start',
  178. 'mask',
  179. 'opacity',
  180. 'overflow',
  181. 'paint-order',
  182. 'pointer-events',
  183. 'shape-rendering',
  184. 'stop-color',
  185. 'stop-opacity',
  186. 'stroke',
  187. 'stroke-dasharray',
  188. 'stroke-dashoffset',
  189. 'stroke-linecap',
  190. 'stroke-linejoin',
  191. 'stroke-miterlimit',
  192. 'stroke-opacity',
  193. 'stroke-width',
  194. 'text-anchor',
  195. 'text-decoration',
  196. 'text-overflow',
  197. 'text-rendering',
  198. 'transform',
  199. 'transform-origin',
  200. 'unicode-bidi',
  201. 'vector-effect',
  202. 'visibility',
  203. 'word-spacing',
  204. 'writing-mode',
  205. ],
  206. xlink: [
  207. 'xlink:href',
  208. 'xlink:show',
  209. 'xlink:actuate',
  210. 'xlink:type',
  211. 'xlink:role',
  212. 'xlink:arcrole',
  213. 'xlink:title',
  214. ],
  215. documentEvent: [
  216. 'onunload',
  217. 'onabort',
  218. 'onerror',
  219. 'onresize',
  220. 'onscroll',
  221. 'onzoom',
  222. ],
  223. filterPrimitive: ['x', 'y', 'width', 'height', 'result'],
  224. transferFunction: [
  225. 'type',
  226. 'tableValues',
  227. 'slope',
  228. 'intercept',
  229. 'amplitude',
  230. 'exponent',
  231. 'offset',
  232. ],
  233. };
  234. /**
  235. * @type {Record<string, Record<string, string>>}
  236. */
  237. exports.attrsGroupsDefaults = {
  238. core: { 'xml:space': 'default' },
  239. presentation: {
  240. clip: 'auto',
  241. 'clip-path': 'none',
  242. 'clip-rule': 'nonzero',
  243. mask: 'none',
  244. opacity: '1',
  245. 'stop-color': '#000',
  246. 'stop-opacity': '1',
  247. 'fill-opacity': '1',
  248. 'fill-rule': 'nonzero',
  249. fill: '#000',
  250. stroke: 'none',
  251. 'stroke-width': '1',
  252. 'stroke-linecap': 'butt',
  253. 'stroke-linejoin': 'miter',
  254. 'stroke-miterlimit': '4',
  255. 'stroke-dasharray': 'none',
  256. 'stroke-dashoffset': '0',
  257. 'stroke-opacity': '1',
  258. 'paint-order': 'normal',
  259. 'vector-effect': 'none',
  260. display: 'inline',
  261. visibility: 'visible',
  262. 'marker-start': 'none',
  263. 'marker-mid': 'none',
  264. 'marker-end': 'none',
  265. 'color-interpolation': 'sRGB',
  266. 'color-interpolation-filters': 'linearRGB',
  267. 'color-rendering': 'auto',
  268. 'shape-rendering': 'auto',
  269. 'text-rendering': 'auto',
  270. 'image-rendering': 'auto',
  271. 'font-style': 'normal',
  272. 'font-variant': 'normal',
  273. 'font-weight': 'normal',
  274. 'font-stretch': 'normal',
  275. 'font-size': 'medium',
  276. 'font-size-adjust': 'none',
  277. kerning: 'auto',
  278. 'letter-spacing': 'normal',
  279. 'word-spacing': 'normal',
  280. 'text-decoration': 'none',
  281. 'text-anchor': 'start',
  282. 'text-overflow': 'clip',
  283. 'writing-mode': 'lr-tb',
  284. 'glyph-orientation-vertical': 'auto',
  285. 'glyph-orientation-horizontal': '0deg',
  286. direction: 'ltr',
  287. 'unicode-bidi': 'normal',
  288. 'dominant-baseline': 'auto',
  289. 'alignment-baseline': 'baseline',
  290. 'baseline-shift': 'baseline',
  291. },
  292. transferFunction: {
  293. slope: '1',
  294. intercept: '0',
  295. amplitude: '1',
  296. exponent: '1',
  297. offset: '0',
  298. },
  299. };
  300. // https://www.w3.org/TR/SVG11/eltindex.html
  301. /**
  302. * @type {Record<string, {
  303. * attrsGroups: Array<string>,
  304. * attrs?: Array<string>,
  305. * defaults?: Record<string, string>,
  306. * contentGroups?: Array<string>,
  307. * content?: Array<string>,
  308. * }>}
  309. */
  310. exports.elems = {
  311. a: {
  312. attrsGroups: [
  313. 'conditionalProcessing',
  314. 'core',
  315. 'graphicalEvent',
  316. 'presentation',
  317. 'xlink',
  318. ],
  319. attrs: [
  320. 'class',
  321. 'style',
  322. 'externalResourcesRequired',
  323. 'transform',
  324. 'target',
  325. ],
  326. defaults: {
  327. target: '_self',
  328. },
  329. contentGroups: [
  330. 'animation',
  331. 'descriptive',
  332. 'shape',
  333. 'structural',
  334. 'paintServer',
  335. ],
  336. content: [
  337. 'a',
  338. 'altGlyphDef',
  339. 'clipPath',
  340. 'color-profile',
  341. 'cursor',
  342. 'filter',
  343. 'font',
  344. 'font-face',
  345. 'foreignObject',
  346. 'image',
  347. 'marker',
  348. 'mask',
  349. 'pattern',
  350. 'script',
  351. 'style',
  352. 'switch',
  353. 'text',
  354. 'view',
  355. // not spec compliant
  356. 'tspan',
  357. ],
  358. },
  359. altGlyph: {
  360. attrsGroups: [
  361. 'conditionalProcessing',
  362. 'core',
  363. 'graphicalEvent',
  364. 'presentation',
  365. 'xlink',
  366. ],
  367. attrs: [
  368. 'class',
  369. 'style',
  370. 'externalResourcesRequired',
  371. 'x',
  372. 'y',
  373. 'dx',
  374. 'dy',
  375. 'glyphRef',
  376. 'format',
  377. 'rotate',
  378. ],
  379. },
  380. altGlyphDef: {
  381. attrsGroups: ['core'],
  382. content: ['glyphRef'],
  383. },
  384. altGlyphItem: {
  385. attrsGroups: ['core'],
  386. content: ['glyphRef', 'altGlyphItem'],
  387. },
  388. animate: {
  389. attrsGroups: [
  390. 'conditionalProcessing',
  391. 'core',
  392. 'animationAddition',
  393. 'animationAttributeTarget',
  394. 'animationEvent',
  395. 'animationTiming',
  396. 'animationValue',
  397. 'presentation',
  398. 'xlink',
  399. ],
  400. attrs: ['externalResourcesRequired'],
  401. contentGroups: ['descriptive'],
  402. },
  403. animateColor: {
  404. attrsGroups: [
  405. 'conditionalProcessing',
  406. 'core',
  407. 'animationEvent',
  408. 'xlink',
  409. 'animationAttributeTarget',
  410. 'animationTiming',
  411. 'animationValue',
  412. 'animationAddition',
  413. 'presentation',
  414. ],
  415. attrs: ['externalResourcesRequired'],
  416. contentGroups: ['descriptive'],
  417. },
  418. animateMotion: {
  419. attrsGroups: [
  420. 'conditionalProcessing',
  421. 'core',
  422. 'animationEvent',
  423. 'xlink',
  424. 'animationTiming',
  425. 'animationValue',
  426. 'animationAddition',
  427. ],
  428. attrs: [
  429. 'externalResourcesRequired',
  430. 'path',
  431. 'keyPoints',
  432. 'rotate',
  433. 'origin',
  434. ],
  435. defaults: {
  436. rotate: '0',
  437. },
  438. contentGroups: ['descriptive'],
  439. content: ['mpath'],
  440. },
  441. animateTransform: {
  442. attrsGroups: [
  443. 'conditionalProcessing',
  444. 'core',
  445. 'animationEvent',
  446. 'xlink',
  447. 'animationAttributeTarget',
  448. 'animationTiming',
  449. 'animationValue',
  450. 'animationAddition',
  451. ],
  452. attrs: ['externalResourcesRequired', 'type'],
  453. contentGroups: ['descriptive'],
  454. },
  455. circle: {
  456. attrsGroups: [
  457. 'conditionalProcessing',
  458. 'core',
  459. 'graphicalEvent',
  460. 'presentation',
  461. ],
  462. attrs: [
  463. 'class',
  464. 'style',
  465. 'externalResourcesRequired',
  466. 'transform',
  467. 'cx',
  468. 'cy',
  469. 'r',
  470. ],
  471. defaults: {
  472. cx: '0',
  473. cy: '0',
  474. },
  475. contentGroups: ['animation', 'descriptive'],
  476. },
  477. clipPath: {
  478. attrsGroups: ['conditionalProcessing', 'core', 'presentation'],
  479. attrs: [
  480. 'class',
  481. 'style',
  482. 'externalResourcesRequired',
  483. 'transform',
  484. 'clipPathUnits',
  485. ],
  486. defaults: {
  487. clipPathUnits: 'userSpaceOnUse',
  488. },
  489. contentGroups: ['animation', 'descriptive', 'shape'],
  490. content: ['text', 'use'],
  491. },
  492. 'color-profile': {
  493. attrsGroups: ['core', 'xlink'],
  494. attrs: ['local', 'name', 'rendering-intent'],
  495. defaults: {
  496. name: 'sRGB',
  497. 'rendering-intent': 'auto',
  498. },
  499. contentGroups: ['descriptive'],
  500. },
  501. cursor: {
  502. attrsGroups: ['core', 'conditionalProcessing', 'xlink'],
  503. attrs: ['externalResourcesRequired', 'x', 'y'],
  504. defaults: {
  505. x: '0',
  506. y: '0',
  507. },
  508. contentGroups: ['descriptive'],
  509. },
  510. defs: {
  511. attrsGroups: [
  512. 'conditionalProcessing',
  513. 'core',
  514. 'graphicalEvent',
  515. 'presentation',
  516. ],
  517. attrs: ['class', 'style', 'externalResourcesRequired', 'transform'],
  518. contentGroups: [
  519. 'animation',
  520. 'descriptive',
  521. 'shape',
  522. 'structural',
  523. 'paintServer',
  524. ],
  525. content: [
  526. 'a',
  527. 'altGlyphDef',
  528. 'clipPath',
  529. 'color-profile',
  530. 'cursor',
  531. 'filter',
  532. 'font',
  533. 'font-face',
  534. 'foreignObject',
  535. 'image',
  536. 'marker',
  537. 'mask',
  538. 'pattern',
  539. 'script',
  540. 'style',
  541. 'switch',
  542. 'text',
  543. 'view',
  544. ],
  545. },
  546. desc: {
  547. attrsGroups: ['core'],
  548. attrs: ['class', 'style'],
  549. },
  550. ellipse: {
  551. attrsGroups: [
  552. 'conditionalProcessing',
  553. 'core',
  554. 'graphicalEvent',
  555. 'presentation',
  556. ],
  557. attrs: [
  558. 'class',
  559. 'style',
  560. 'externalResourcesRequired',
  561. 'transform',
  562. 'cx',
  563. 'cy',
  564. 'rx',
  565. 'ry',
  566. ],
  567. defaults: {
  568. cx: '0',
  569. cy: '0',
  570. },
  571. contentGroups: ['animation', 'descriptive'],
  572. },
  573. feBlend: {
  574. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  575. attrs: [
  576. 'class',
  577. 'style',
  578. // TODO: in - 'If no value is provided and this is the first filter primitive,
  579. // then this filter primitive will use SourceGraphic as its input'
  580. 'in',
  581. 'in2',
  582. 'mode',
  583. ],
  584. defaults: {
  585. mode: 'normal',
  586. },
  587. content: ['animate', 'set'],
  588. },
  589. feColorMatrix: {
  590. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  591. attrs: ['class', 'style', 'in', 'type', 'values'],
  592. defaults: {
  593. type: 'matrix',
  594. },
  595. content: ['animate', 'set'],
  596. },
  597. feComponentTransfer: {
  598. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  599. attrs: ['class', 'style', 'in'],
  600. content: ['feFuncA', 'feFuncB', 'feFuncG', 'feFuncR'],
  601. },
  602. feComposite: {
  603. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  604. attrs: ['class', 'style', 'in', 'in2', 'operator', 'k1', 'k2', 'k3', 'k4'],
  605. defaults: {
  606. operator: 'over',
  607. k1: '0',
  608. k2: '0',
  609. k3: '0',
  610. k4: '0',
  611. },
  612. content: ['animate', 'set'],
  613. },
  614. feConvolveMatrix: {
  615. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  616. attrs: [
  617. 'class',
  618. 'style',
  619. 'in',
  620. 'order',
  621. 'kernelMatrix',
  622. // TODO: divisor - 'The default value is the sum of all values in kernelMatrix,
  623. // with the exception that if the sum is zero, then the divisor is set to 1'
  624. 'divisor',
  625. 'bias',
  626. // TODO: targetX - 'By default, the convolution matrix is centered in X over each
  627. // pixel of the input image (i.e., targetX = floor ( orderX / 2 ))'
  628. 'targetX',
  629. 'targetY',
  630. 'edgeMode',
  631. // TODO: kernelUnitLength - 'The first number is the <dx> value. The second number
  632. // is the <dy> value. If the <dy> value is not specified, it defaults to the same value as <dx>'
  633. 'kernelUnitLength',
  634. 'preserveAlpha',
  635. ],
  636. defaults: {
  637. order: '3',
  638. bias: '0',
  639. edgeMode: 'duplicate',
  640. preserveAlpha: 'false',
  641. },
  642. content: ['animate', 'set'],
  643. },
  644. feDiffuseLighting: {
  645. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  646. attrs: [
  647. 'class',
  648. 'style',
  649. 'in',
  650. 'surfaceScale',
  651. 'diffuseConstant',
  652. 'kernelUnitLength',
  653. ],
  654. defaults: {
  655. surfaceScale: '1',
  656. diffuseConstant: '1',
  657. },
  658. contentGroups: ['descriptive'],
  659. content: [
  660. // TODO: 'exactly one light source element, in any order'
  661. 'feDistantLight',
  662. 'fePointLight',
  663. 'feSpotLight',
  664. ],
  665. },
  666. feDisplacementMap: {
  667. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  668. attrs: [
  669. 'class',
  670. 'style',
  671. 'in',
  672. 'in2',
  673. 'scale',
  674. 'xChannelSelector',
  675. 'yChannelSelector',
  676. ],
  677. defaults: {
  678. scale: '0',
  679. xChannelSelector: 'A',
  680. yChannelSelector: 'A',
  681. },
  682. content: ['animate', 'set'],
  683. },
  684. feDistantLight: {
  685. attrsGroups: ['core'],
  686. attrs: ['azimuth', 'elevation'],
  687. defaults: {
  688. azimuth: '0',
  689. elevation: '0',
  690. },
  691. content: ['animate', 'set'],
  692. },
  693. feFlood: {
  694. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  695. attrs: ['class', 'style'],
  696. content: ['animate', 'animateColor', 'set'],
  697. },
  698. feFuncA: {
  699. attrsGroups: ['core', 'transferFunction'],
  700. content: ['set', 'animate'],
  701. },
  702. feFuncB: {
  703. attrsGroups: ['core', 'transferFunction'],
  704. content: ['set', 'animate'],
  705. },
  706. feFuncG: {
  707. attrsGroups: ['core', 'transferFunction'],
  708. content: ['set', 'animate'],
  709. },
  710. feFuncR: {
  711. attrsGroups: ['core', 'transferFunction'],
  712. content: ['set', 'animate'],
  713. },
  714. feGaussianBlur: {
  715. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  716. attrs: ['class', 'style', 'in', 'stdDeviation'],
  717. defaults: {
  718. stdDeviation: '0',
  719. },
  720. content: ['set', 'animate'],
  721. },
  722. feImage: {
  723. attrsGroups: ['core', 'presentation', 'filterPrimitive', 'xlink'],
  724. attrs: [
  725. 'class',
  726. 'style',
  727. 'externalResourcesRequired',
  728. 'preserveAspectRatio',
  729. 'href',
  730. 'xlink:href',
  731. ],
  732. defaults: {
  733. preserveAspectRatio: 'xMidYMid meet',
  734. },
  735. content: ['animate', 'animateTransform', 'set'],
  736. },
  737. feMerge: {
  738. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  739. attrs: ['class', 'style'],
  740. content: ['feMergeNode'],
  741. },
  742. feMergeNode: {
  743. attrsGroups: ['core'],
  744. attrs: ['in'],
  745. content: ['animate', 'set'],
  746. },
  747. feMorphology: {
  748. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  749. attrs: ['class', 'style', 'in', 'operator', 'radius'],
  750. defaults: {
  751. operator: 'erode',
  752. radius: '0',
  753. },
  754. content: ['animate', 'set'],
  755. },
  756. feOffset: {
  757. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  758. attrs: ['class', 'style', 'in', 'dx', 'dy'],
  759. defaults: {
  760. dx: '0',
  761. dy: '0',
  762. },
  763. content: ['animate', 'set'],
  764. },
  765. fePointLight: {
  766. attrsGroups: ['core'],
  767. attrs: ['x', 'y', 'z'],
  768. defaults: {
  769. x: '0',
  770. y: '0',
  771. z: '0',
  772. },
  773. content: ['animate', 'set'],
  774. },
  775. feSpecularLighting: {
  776. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  777. attrs: [
  778. 'class',
  779. 'style',
  780. 'in',
  781. 'surfaceScale',
  782. 'specularConstant',
  783. 'specularExponent',
  784. 'kernelUnitLength',
  785. ],
  786. defaults: {
  787. surfaceScale: '1',
  788. specularConstant: '1',
  789. specularExponent: '1',
  790. },
  791. contentGroups: [
  792. 'descriptive',
  793. // TODO: exactly one 'light source element'
  794. 'lightSource',
  795. ],
  796. },
  797. feSpotLight: {
  798. attrsGroups: ['core'],
  799. attrs: [
  800. 'x',
  801. 'y',
  802. 'z',
  803. 'pointsAtX',
  804. 'pointsAtY',
  805. 'pointsAtZ',
  806. 'specularExponent',
  807. 'limitingConeAngle',
  808. ],
  809. defaults: {
  810. x: '0',
  811. y: '0',
  812. z: '0',
  813. pointsAtX: '0',
  814. pointsAtY: '0',
  815. pointsAtZ: '0',
  816. specularExponent: '1',
  817. },
  818. content: ['animate', 'set'],
  819. },
  820. feTile: {
  821. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  822. attrs: ['class', 'style', 'in'],
  823. content: ['animate', 'set'],
  824. },
  825. feTurbulence: {
  826. attrsGroups: ['core', 'presentation', 'filterPrimitive'],
  827. attrs: [
  828. 'class',
  829. 'style',
  830. 'baseFrequency',
  831. 'numOctaves',
  832. 'seed',
  833. 'stitchTiles',
  834. 'type',
  835. ],
  836. defaults: {
  837. baseFrequency: '0',
  838. numOctaves: '1',
  839. seed: '0',
  840. stitchTiles: 'noStitch',
  841. type: 'turbulence',
  842. },
  843. content: ['animate', 'set'],
  844. },
  845. filter: {
  846. attrsGroups: ['core', 'presentation', 'xlink'],
  847. attrs: [
  848. 'class',
  849. 'style',
  850. 'externalResourcesRequired',
  851. 'x',
  852. 'y',
  853. 'width',
  854. 'height',
  855. 'filterRes',
  856. 'filterUnits',
  857. 'primitiveUnits',
  858. 'href',
  859. 'xlink:href',
  860. ],
  861. defaults: {
  862. primitiveUnits: 'userSpaceOnUse',
  863. x: '-10%',
  864. y: '-10%',
  865. width: '120%',
  866. height: '120%',
  867. },
  868. contentGroups: ['descriptive', 'filterPrimitive'],
  869. content: ['animate', 'set'],
  870. },
  871. font: {
  872. attrsGroups: ['core', 'presentation'],
  873. attrs: [
  874. 'class',
  875. 'style',
  876. 'externalResourcesRequired',
  877. 'horiz-origin-x',
  878. 'horiz-origin-y',
  879. 'horiz-adv-x',
  880. 'vert-origin-x',
  881. 'vert-origin-y',
  882. 'vert-adv-y',
  883. ],
  884. defaults: {
  885. 'horiz-origin-x': '0',
  886. 'horiz-origin-y': '0',
  887. },
  888. contentGroups: ['descriptive'],
  889. content: ['font-face', 'glyph', 'hkern', 'missing-glyph', 'vkern'],
  890. },
  891. 'font-face': {
  892. attrsGroups: ['core'],
  893. attrs: [
  894. 'font-family',
  895. 'font-style',
  896. 'font-variant',
  897. 'font-weight',
  898. 'font-stretch',
  899. 'font-size',
  900. 'unicode-range',
  901. 'units-per-em',
  902. 'panose-1',
  903. 'stemv',
  904. 'stemh',
  905. 'slope',
  906. 'cap-height',
  907. 'x-height',
  908. 'accent-height',
  909. 'ascent',
  910. 'descent',
  911. 'widths',
  912. 'bbox',
  913. 'ideographic',
  914. 'alphabetic',
  915. 'mathematical',
  916. 'hanging',
  917. 'v-ideographic',
  918. 'v-alphabetic',
  919. 'v-mathematical',
  920. 'v-hanging',
  921. 'underline-position',
  922. 'underline-thickness',
  923. 'strikethrough-position',
  924. 'strikethrough-thickness',
  925. 'overline-position',
  926. 'overline-thickness',
  927. ],
  928. defaults: {
  929. 'font-style': 'all',
  930. 'font-variant': 'normal',
  931. 'font-weight': 'all',
  932. 'font-stretch': 'normal',
  933. 'unicode-range': 'U+0-10FFFF',
  934. 'units-per-em': '1000',
  935. 'panose-1': '0 0 0 0 0 0 0 0 0 0',
  936. slope: '0',
  937. },
  938. contentGroups: ['descriptive'],
  939. content: [
  940. // TODO: "at most one 'font-face-src' element"
  941. 'font-face-src',
  942. ],
  943. },
  944. // TODO: empty content
  945. 'font-face-format': {
  946. attrsGroups: ['core'],
  947. attrs: ['string'],
  948. },
  949. 'font-face-name': {
  950. attrsGroups: ['core'],
  951. attrs: ['name'],
  952. },
  953. 'font-face-src': {
  954. attrsGroups: ['core'],
  955. content: ['font-face-name', 'font-face-uri'],
  956. },
  957. 'font-face-uri': {
  958. attrsGroups: ['core', 'xlink'],
  959. attrs: ['href', 'xlink:href'],
  960. content: ['font-face-format'],
  961. },
  962. foreignObject: {
  963. attrsGroups: [
  964. 'core',
  965. 'conditionalProcessing',
  966. 'graphicalEvent',
  967. 'presentation',
  968. ],
  969. attrs: [
  970. 'class',
  971. 'style',
  972. 'externalResourcesRequired',
  973. 'transform',
  974. 'x',
  975. 'y',
  976. 'width',
  977. 'height',
  978. ],
  979. defaults: {
  980. x: '0',
  981. y: '0',
  982. },
  983. },
  984. g: {
  985. attrsGroups: [
  986. 'conditionalProcessing',
  987. 'core',
  988. 'graphicalEvent',
  989. 'presentation',
  990. ],
  991. attrs: ['class', 'style', 'externalResourcesRequired', 'transform'],
  992. contentGroups: [
  993. 'animation',
  994. 'descriptive',
  995. 'shape',
  996. 'structural',
  997. 'paintServer',
  998. ],
  999. content: [
  1000. 'a',
  1001. 'altGlyphDef',
  1002. 'clipPath',
  1003. 'color-profile',
  1004. 'cursor',
  1005. 'filter',
  1006. 'font',
  1007. 'font-face',
  1008. 'foreignObject',
  1009. 'image',
  1010. 'marker',
  1011. 'mask',
  1012. 'pattern',
  1013. 'script',
  1014. 'style',
  1015. 'switch',
  1016. 'text',
  1017. 'view',
  1018. ],
  1019. },
  1020. glyph: {
  1021. attrsGroups: ['core', 'presentation'],
  1022. attrs: [
  1023. 'class',
  1024. 'style',
  1025. 'd',
  1026. 'horiz-adv-x',
  1027. 'vert-origin-x',
  1028. 'vert-origin-y',
  1029. 'vert-adv-y',
  1030. 'unicode',
  1031. 'glyph-name',
  1032. 'orientation',
  1033. 'arabic-form',
  1034. 'lang',
  1035. ],
  1036. defaults: {
  1037. 'arabic-form': 'initial',
  1038. },
  1039. contentGroups: [
  1040. 'animation',
  1041. 'descriptive',
  1042. 'shape',
  1043. 'structural',
  1044. 'paintServer',
  1045. ],
  1046. content: [
  1047. 'a',
  1048. 'altGlyphDef',
  1049. 'clipPath',
  1050. 'color-profile',
  1051. 'cursor',
  1052. 'filter',
  1053. 'font',
  1054. 'font-face',
  1055. 'foreignObject',
  1056. 'image',
  1057. 'marker',
  1058. 'mask',
  1059. 'pattern',
  1060. 'script',
  1061. 'style',
  1062. 'switch',
  1063. 'text',
  1064. 'view',
  1065. ],
  1066. },
  1067. glyphRef: {
  1068. attrsGroups: ['core', 'presentation'],
  1069. attrs: [
  1070. 'class',
  1071. 'style',
  1072. 'd',
  1073. 'horiz-adv-x',
  1074. 'vert-origin-x',
  1075. 'vert-origin-y',
  1076. 'vert-adv-y',
  1077. ],
  1078. contentGroups: [
  1079. 'animation',
  1080. 'descriptive',
  1081. 'shape',
  1082. 'structural',
  1083. 'paintServer',
  1084. ],
  1085. content: [
  1086. 'a',
  1087. 'altGlyphDef',
  1088. 'clipPath',
  1089. 'color-profile',
  1090. 'cursor',
  1091. 'filter',
  1092. 'font',
  1093. 'font-face',
  1094. 'foreignObject',
  1095. 'image',
  1096. 'marker',
  1097. 'mask',
  1098. 'pattern',
  1099. 'script',
  1100. 'style',
  1101. 'switch',
  1102. 'text',
  1103. 'view',
  1104. ],
  1105. },
  1106. hatch: {
  1107. attrsGroups: ['core', 'presentation', 'xlink'],
  1108. attrs: [
  1109. 'class',
  1110. 'style',
  1111. 'x',
  1112. 'y',
  1113. 'pitch',
  1114. 'rotate',
  1115. 'hatchUnits',
  1116. 'hatchContentUnits',
  1117. 'transform',
  1118. ],
  1119. defaults: {
  1120. hatchUnits: 'objectBoundingBox',
  1121. hatchContentUnits: 'userSpaceOnUse',
  1122. x: '0',
  1123. y: '0',
  1124. pitch: '0',
  1125. rotate: '0',
  1126. },
  1127. contentGroups: ['animation', 'descriptive'],
  1128. content: ['hatchPath'],
  1129. },
  1130. hatchPath: {
  1131. attrsGroups: ['core', 'presentation', 'xlink'],
  1132. attrs: ['class', 'style', 'd', 'offset'],
  1133. defaults: {
  1134. offset: '0',
  1135. },
  1136. contentGroups: ['animation', 'descriptive'],
  1137. },
  1138. hkern: {
  1139. attrsGroups: ['core'],
  1140. attrs: ['u1', 'g1', 'u2', 'g2', 'k'],
  1141. },
  1142. image: {
  1143. attrsGroups: [
  1144. 'core',
  1145. 'conditionalProcessing',
  1146. 'graphicalEvent',
  1147. 'xlink',
  1148. 'presentation',
  1149. ],
  1150. attrs: [
  1151. 'class',
  1152. 'style',
  1153. 'externalResourcesRequired',
  1154. 'preserveAspectRatio',
  1155. 'transform',
  1156. 'x',
  1157. 'y',
  1158. 'width',
  1159. 'height',
  1160. 'href',
  1161. 'xlink:href',
  1162. ],
  1163. defaults: {
  1164. x: '0',
  1165. y: '0',
  1166. preserveAspectRatio: 'xMidYMid meet',
  1167. },
  1168. contentGroups: ['animation', 'descriptive'],
  1169. },
  1170. line: {
  1171. attrsGroups: [
  1172. 'conditionalProcessing',
  1173. 'core',
  1174. 'graphicalEvent',
  1175. 'presentation',
  1176. ],
  1177. attrs: [
  1178. 'class',
  1179. 'style',
  1180. 'externalResourcesRequired',
  1181. 'transform',
  1182. 'x1',
  1183. 'y1',
  1184. 'x2',
  1185. 'y2',
  1186. ],
  1187. defaults: {
  1188. x1: '0',
  1189. y1: '0',
  1190. x2: '0',
  1191. y2: '0',
  1192. },
  1193. contentGroups: ['animation', 'descriptive'],
  1194. },
  1195. linearGradient: {
  1196. attrsGroups: ['core', 'presentation', 'xlink'],
  1197. attrs: [
  1198. 'class',
  1199. 'style',
  1200. 'externalResourcesRequired',
  1201. 'x1',
  1202. 'y1',
  1203. 'x2',
  1204. 'y2',
  1205. 'gradientUnits',
  1206. 'gradientTransform',
  1207. 'spreadMethod',
  1208. 'href',
  1209. 'xlink:href',
  1210. ],
  1211. defaults: {
  1212. x1: '0',
  1213. y1: '0',
  1214. x2: '100%',
  1215. y2: '0',
  1216. spreadMethod: 'pad',
  1217. },
  1218. contentGroups: ['descriptive'],
  1219. content: ['animate', 'animateTransform', 'set', 'stop'],
  1220. },
  1221. marker: {
  1222. attrsGroups: ['core', 'presentation'],
  1223. attrs: [
  1224. 'class',
  1225. 'style',
  1226. 'externalResourcesRequired',
  1227. 'viewBox',
  1228. 'preserveAspectRatio',
  1229. 'refX',
  1230. 'refY',
  1231. 'markerUnits',
  1232. 'markerWidth',
  1233. 'markerHeight',
  1234. 'orient',
  1235. ],
  1236. defaults: {
  1237. markerUnits: 'strokeWidth',
  1238. refX: '0',
  1239. refY: '0',
  1240. markerWidth: '3',
  1241. markerHeight: '3',
  1242. },
  1243. contentGroups: [
  1244. 'animation',
  1245. 'descriptive',
  1246. 'shape',
  1247. 'structural',
  1248. 'paintServer',
  1249. ],
  1250. content: [
  1251. 'a',
  1252. 'altGlyphDef',
  1253. 'clipPath',
  1254. 'color-profile',
  1255. 'cursor',
  1256. 'filter',
  1257. 'font',
  1258. 'font-face',
  1259. 'foreignObject',
  1260. 'image',
  1261. 'marker',
  1262. 'mask',
  1263. 'pattern',
  1264. 'script',
  1265. 'style',
  1266. 'switch',
  1267. 'text',
  1268. 'view',
  1269. ],
  1270. },
  1271. mask: {
  1272. attrsGroups: ['conditionalProcessing', 'core', 'presentation'],
  1273. attrs: [
  1274. 'class',
  1275. 'style',
  1276. 'externalResourcesRequired',
  1277. 'x',
  1278. 'y',
  1279. 'width',
  1280. 'height',
  1281. 'mask-type',
  1282. 'maskUnits',
  1283. 'maskContentUnits',
  1284. ],
  1285. defaults: {
  1286. maskUnits: 'objectBoundingBox',
  1287. maskContentUnits: 'userSpaceOnUse',
  1288. x: '-10%',
  1289. y: '-10%',
  1290. width: '120%',
  1291. height: '120%',
  1292. },
  1293. contentGroups: [
  1294. 'animation',
  1295. 'descriptive',
  1296. 'shape',
  1297. 'structural',
  1298. 'paintServer',
  1299. ],
  1300. content: [
  1301. 'a',
  1302. 'altGlyphDef',
  1303. 'clipPath',
  1304. 'color-profile',
  1305. 'cursor',
  1306. 'filter',
  1307. 'font',
  1308. 'font-face',
  1309. 'foreignObject',
  1310. 'image',
  1311. 'marker',
  1312. 'mask',
  1313. 'pattern',
  1314. 'script',
  1315. 'style',
  1316. 'switch',
  1317. 'text',
  1318. 'view',
  1319. ],
  1320. },
  1321. metadata: {
  1322. attrsGroups: ['core'],
  1323. },
  1324. 'missing-glyph': {
  1325. attrsGroups: ['core', 'presentation'],
  1326. attrs: [
  1327. 'class',
  1328. 'style',
  1329. 'd',
  1330. 'horiz-adv-x',
  1331. 'vert-origin-x',
  1332. 'vert-origin-y',
  1333. 'vert-adv-y',
  1334. ],
  1335. contentGroups: [
  1336. 'animation',
  1337. 'descriptive',
  1338. 'shape',
  1339. 'structural',
  1340. 'paintServer',
  1341. ],
  1342. content: [
  1343. 'a',
  1344. 'altGlyphDef',
  1345. 'clipPath',
  1346. 'color-profile',
  1347. 'cursor',
  1348. 'filter',
  1349. 'font',
  1350. 'font-face',
  1351. 'foreignObject',
  1352. 'image',
  1353. 'marker',
  1354. 'mask',
  1355. 'pattern',
  1356. 'script',
  1357. 'style',
  1358. 'switch',
  1359. 'text',
  1360. 'view',
  1361. ],
  1362. },
  1363. mpath: {
  1364. attrsGroups: ['core', 'xlink'],
  1365. attrs: ['externalResourcesRequired', 'href', 'xlink:href'],
  1366. contentGroups: ['descriptive'],
  1367. },
  1368. path: {
  1369. attrsGroups: [
  1370. 'conditionalProcessing',
  1371. 'core',
  1372. 'graphicalEvent',
  1373. 'presentation',
  1374. ],
  1375. attrs: [
  1376. 'class',
  1377. 'style',
  1378. 'externalResourcesRequired',
  1379. 'transform',
  1380. 'd',
  1381. 'pathLength',
  1382. ],
  1383. contentGroups: ['animation', 'descriptive'],
  1384. },
  1385. pattern: {
  1386. attrsGroups: ['conditionalProcessing', 'core', 'presentation', 'xlink'],
  1387. attrs: [
  1388. 'class',
  1389. 'style',
  1390. 'externalResourcesRequired',
  1391. 'viewBox',
  1392. 'preserveAspectRatio',
  1393. 'x',
  1394. 'y',
  1395. 'width',
  1396. 'height',
  1397. 'patternUnits',
  1398. 'patternContentUnits',
  1399. 'patternTransform',
  1400. 'href',
  1401. 'xlink:href',
  1402. ],
  1403. defaults: {
  1404. patternUnits: 'objectBoundingBox',
  1405. patternContentUnits: 'userSpaceOnUse',
  1406. x: '0',
  1407. y: '0',
  1408. width: '0',
  1409. height: '0',
  1410. preserveAspectRatio: 'xMidYMid meet',
  1411. },
  1412. contentGroups: [
  1413. 'animation',
  1414. 'descriptive',
  1415. 'paintServer',
  1416. 'shape',
  1417. 'structural',
  1418. ],
  1419. content: [
  1420. 'a',
  1421. 'altGlyphDef',
  1422. 'clipPath',
  1423. 'color-profile',
  1424. 'cursor',
  1425. 'filter',
  1426. 'font',
  1427. 'font-face',
  1428. 'foreignObject',
  1429. 'image',
  1430. 'marker',
  1431. 'mask',
  1432. 'pattern',
  1433. 'script',
  1434. 'style',
  1435. 'switch',
  1436. 'text',
  1437. 'view',
  1438. ],
  1439. },
  1440. polygon: {
  1441. attrsGroups: [
  1442. 'conditionalProcessing',
  1443. 'core',
  1444. 'graphicalEvent',
  1445. 'presentation',
  1446. ],
  1447. attrs: [
  1448. 'class',
  1449. 'style',
  1450. 'externalResourcesRequired',
  1451. 'transform',
  1452. 'points',
  1453. ],
  1454. contentGroups: ['animation', 'descriptive'],
  1455. },
  1456. polyline: {
  1457. attrsGroups: [
  1458. 'conditionalProcessing',
  1459. 'core',
  1460. 'graphicalEvent',
  1461. 'presentation',
  1462. ],
  1463. attrs: [
  1464. 'class',
  1465. 'style',
  1466. 'externalResourcesRequired',
  1467. 'transform',
  1468. 'points',
  1469. ],
  1470. contentGroups: ['animation', 'descriptive'],
  1471. },
  1472. radialGradient: {
  1473. attrsGroups: ['core', 'presentation', 'xlink'],
  1474. attrs: [
  1475. 'class',
  1476. 'style',
  1477. 'externalResourcesRequired',
  1478. 'cx',
  1479. 'cy',
  1480. 'r',
  1481. 'fx',
  1482. 'fy',
  1483. 'fr',
  1484. 'gradientUnits',
  1485. 'gradientTransform',
  1486. 'spreadMethod',
  1487. 'href',
  1488. 'xlink:href',
  1489. ],
  1490. defaults: {
  1491. gradientUnits: 'objectBoundingBox',
  1492. cx: '50%',
  1493. cy: '50%',
  1494. r: '50%',
  1495. },
  1496. contentGroups: ['descriptive'],
  1497. content: ['animate', 'animateTransform', 'set', 'stop'],
  1498. },
  1499. meshGradient: {
  1500. attrsGroups: ['core', 'presentation', 'xlink'],
  1501. attrs: ['class', 'style', 'x', 'y', 'gradientUnits', 'transform'],
  1502. contentGroups: ['descriptive', 'paintServer', 'animation'],
  1503. content: ['meshRow'],
  1504. },
  1505. meshRow: {
  1506. attrsGroups: ['core', 'presentation'],
  1507. attrs: ['class', 'style'],
  1508. contentGroups: ['descriptive'],
  1509. content: ['meshPatch'],
  1510. },
  1511. meshPatch: {
  1512. attrsGroups: ['core', 'presentation'],
  1513. attrs: ['class', 'style'],
  1514. contentGroups: ['descriptive'],
  1515. content: ['stop'],
  1516. },
  1517. rect: {
  1518. attrsGroups: [
  1519. 'conditionalProcessing',
  1520. 'core',
  1521. 'graphicalEvent',
  1522. 'presentation',
  1523. ],
  1524. attrs: [
  1525. 'class',
  1526. 'style',
  1527. 'externalResourcesRequired',
  1528. 'transform',
  1529. 'x',
  1530. 'y',
  1531. 'width',
  1532. 'height',
  1533. 'rx',
  1534. 'ry',
  1535. ],
  1536. defaults: {
  1537. x: '0',
  1538. y: '0',
  1539. },
  1540. contentGroups: ['animation', 'descriptive'],
  1541. },
  1542. script: {
  1543. attrsGroups: ['core', 'xlink'],
  1544. attrs: ['externalResourcesRequired', 'type', 'href', 'xlink:href'],
  1545. },
  1546. set: {
  1547. attrsGroups: [
  1548. 'conditionalProcessing',
  1549. 'core',
  1550. 'animation',
  1551. 'xlink',
  1552. 'animationAttributeTarget',
  1553. 'animationTiming',
  1554. ],
  1555. attrs: ['externalResourcesRequired', 'to'],
  1556. contentGroups: ['descriptive'],
  1557. },
  1558. solidColor: {
  1559. attrsGroups: ['core', 'presentation'],
  1560. attrs: ['class', 'style'],
  1561. contentGroups: ['paintServer'],
  1562. },
  1563. stop: {
  1564. attrsGroups: ['core', 'presentation'],
  1565. attrs: ['class', 'style', 'offset', 'path'],
  1566. content: ['animate', 'animateColor', 'set'],
  1567. },
  1568. style: {
  1569. attrsGroups: ['core'],
  1570. attrs: ['type', 'media', 'title'],
  1571. defaults: {
  1572. type: 'text/css',
  1573. },
  1574. },
  1575. svg: {
  1576. attrsGroups: [
  1577. 'conditionalProcessing',
  1578. 'core',
  1579. 'documentEvent',
  1580. 'graphicalEvent',
  1581. 'presentation',
  1582. ],
  1583. attrs: [
  1584. 'class',
  1585. 'style',
  1586. 'x',
  1587. 'y',
  1588. 'width',
  1589. 'height',
  1590. 'viewBox',
  1591. 'preserveAspectRatio',
  1592. 'zoomAndPan',
  1593. 'version',
  1594. 'baseProfile',
  1595. 'contentScriptType',
  1596. 'contentStyleType',
  1597. ],
  1598. defaults: {
  1599. x: '0',
  1600. y: '0',
  1601. width: '100%',
  1602. height: '100%',
  1603. preserveAspectRatio: 'xMidYMid meet',
  1604. zoomAndPan: 'magnify',
  1605. version: '1.1',
  1606. baseProfile: 'none',
  1607. contentScriptType: 'application/ecmascript',
  1608. contentStyleType: 'text/css',
  1609. },
  1610. contentGroups: [
  1611. 'animation',
  1612. 'descriptive',
  1613. 'shape',
  1614. 'structural',
  1615. 'paintServer',
  1616. ],
  1617. content: [
  1618. 'a',
  1619. 'altGlyphDef',
  1620. 'clipPath',
  1621. 'color-profile',
  1622. 'cursor',
  1623. 'filter',
  1624. 'font',
  1625. 'font-face',
  1626. 'foreignObject',
  1627. 'image',
  1628. 'marker',
  1629. 'mask',
  1630. 'pattern',
  1631. 'script',
  1632. 'style',
  1633. 'switch',
  1634. 'text',
  1635. 'view',
  1636. ],
  1637. },
  1638. switch: {
  1639. attrsGroups: [
  1640. 'conditionalProcessing',
  1641. 'core',
  1642. 'graphicalEvent',
  1643. 'presentation',
  1644. ],
  1645. attrs: ['class', 'style', 'externalResourcesRequired', 'transform'],
  1646. contentGroups: ['animation', 'descriptive', 'shape'],
  1647. content: [
  1648. 'a',
  1649. 'foreignObject',
  1650. 'g',
  1651. 'image',
  1652. 'svg',
  1653. 'switch',
  1654. 'text',
  1655. 'use',
  1656. ],
  1657. },
  1658. symbol: {
  1659. attrsGroups: ['core', 'graphicalEvent', 'presentation'],
  1660. attrs: [
  1661. 'class',
  1662. 'style',
  1663. 'externalResourcesRequired',
  1664. 'preserveAspectRatio',
  1665. 'viewBox',
  1666. 'refX',
  1667. 'refY',
  1668. ],
  1669. defaults: {
  1670. refX: '0',
  1671. refY: '0',
  1672. },
  1673. contentGroups: [
  1674. 'animation',
  1675. 'descriptive',
  1676. 'shape',
  1677. 'structural',
  1678. 'paintServer',
  1679. ],
  1680. content: [
  1681. 'a',
  1682. 'altGlyphDef',
  1683. 'clipPath',
  1684. 'color-profile',
  1685. 'cursor',
  1686. 'filter',
  1687. 'font',
  1688. 'font-face',
  1689. 'foreignObject',
  1690. 'image',
  1691. 'marker',
  1692. 'mask',
  1693. 'pattern',
  1694. 'script',
  1695. 'style',
  1696. 'switch',
  1697. 'text',
  1698. 'view',
  1699. ],
  1700. },
  1701. text: {
  1702. attrsGroups: [
  1703. 'conditionalProcessing',
  1704. 'core',
  1705. 'graphicalEvent',
  1706. 'presentation',
  1707. ],
  1708. attrs: [
  1709. 'class',
  1710. 'style',
  1711. 'externalResourcesRequired',
  1712. 'transform',
  1713. 'lengthAdjust',
  1714. 'x',
  1715. 'y',
  1716. 'dx',
  1717. 'dy',
  1718. 'rotate',
  1719. 'textLength',
  1720. ],
  1721. defaults: {
  1722. x: '0',
  1723. y: '0',
  1724. lengthAdjust: 'spacing',
  1725. },
  1726. contentGroups: ['animation', 'descriptive', 'textContentChild'],
  1727. content: ['a'],
  1728. },
  1729. textPath: {
  1730. attrsGroups: [
  1731. 'conditionalProcessing',
  1732. 'core',
  1733. 'graphicalEvent',
  1734. 'presentation',
  1735. 'xlink',
  1736. ],
  1737. attrs: [
  1738. 'class',
  1739. 'style',
  1740. 'externalResourcesRequired',
  1741. 'href',
  1742. 'xlink:href',
  1743. 'startOffset',
  1744. 'method',
  1745. 'spacing',
  1746. 'd',
  1747. ],
  1748. defaults: {
  1749. startOffset: '0',
  1750. method: 'align',
  1751. spacing: 'exact',
  1752. },
  1753. contentGroups: ['descriptive'],
  1754. content: [
  1755. 'a',
  1756. 'altGlyph',
  1757. 'animate',
  1758. 'animateColor',
  1759. 'set',
  1760. 'tref',
  1761. 'tspan',
  1762. ],
  1763. },
  1764. title: {
  1765. attrsGroups: ['core'],
  1766. attrs: ['class', 'style'],
  1767. },
  1768. tref: {
  1769. attrsGroups: [
  1770. 'conditionalProcessing',
  1771. 'core',
  1772. 'graphicalEvent',
  1773. 'presentation',
  1774. 'xlink',
  1775. ],
  1776. attrs: [
  1777. 'class',
  1778. 'style',
  1779. 'externalResourcesRequired',
  1780. 'href',
  1781. 'xlink:href',
  1782. ],
  1783. contentGroups: ['descriptive'],
  1784. content: ['animate', 'animateColor', 'set'],
  1785. },
  1786. tspan: {
  1787. attrsGroups: [
  1788. 'conditionalProcessing',
  1789. 'core',
  1790. 'graphicalEvent',
  1791. 'presentation',
  1792. ],
  1793. attrs: [
  1794. 'class',
  1795. 'style',
  1796. 'externalResourcesRequired',
  1797. 'x',
  1798. 'y',
  1799. 'dx',
  1800. 'dy',
  1801. 'rotate',
  1802. 'textLength',
  1803. 'lengthAdjust',
  1804. ],
  1805. contentGroups: ['descriptive'],
  1806. content: [
  1807. 'a',
  1808. 'altGlyph',
  1809. 'animate',
  1810. 'animateColor',
  1811. 'set',
  1812. 'tref',
  1813. 'tspan',
  1814. ],
  1815. },
  1816. use: {
  1817. attrsGroups: [
  1818. 'core',
  1819. 'conditionalProcessing',
  1820. 'graphicalEvent',
  1821. 'presentation',
  1822. 'xlink',
  1823. ],
  1824. attrs: [
  1825. 'class',
  1826. 'style',
  1827. 'externalResourcesRequired',
  1828. 'transform',
  1829. 'x',
  1830. 'y',
  1831. 'width',
  1832. 'height',
  1833. 'href',
  1834. 'xlink:href',
  1835. ],
  1836. defaults: {
  1837. x: '0',
  1838. y: '0',
  1839. },
  1840. contentGroups: ['animation', 'descriptive'],
  1841. },
  1842. view: {
  1843. attrsGroups: ['core'],
  1844. attrs: [
  1845. 'externalResourcesRequired',
  1846. 'viewBox',
  1847. 'preserveAspectRatio',
  1848. 'zoomAndPan',
  1849. 'viewTarget',
  1850. ],
  1851. contentGroups: ['descriptive'],
  1852. },
  1853. vkern: {
  1854. attrsGroups: ['core'],
  1855. attrs: ['u1', 'g1', 'u2', 'g2', 'k'],
  1856. },
  1857. };
  1858. // https://wiki.inkscape.org/wiki/index.php/Inkscape-specific_XML_attributes
  1859. exports.editorNamespaces = [
  1860. 'http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd',
  1861. 'http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd',
  1862. 'http://www.inkscape.org/namespaces/inkscape',
  1863. 'http://www.bohemiancoding.com/sketch/ns',
  1864. 'http://ns.adobe.com/AdobeIllustrator/10.0/',
  1865. 'http://ns.adobe.com/Graphs/1.0/',
  1866. 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
  1867. 'http://ns.adobe.com/Variables/1.0/',
  1868. 'http://ns.adobe.com/SaveForWeb/1.0/',
  1869. 'http://ns.adobe.com/Extensibility/1.0/',
  1870. 'http://ns.adobe.com/Flows/1.0/',
  1871. 'http://ns.adobe.com/ImageReplacement/1.0/',
  1872. 'http://ns.adobe.com/GenericCustomNamespace/1.0/',
  1873. 'http://ns.adobe.com/XPath/1.0/',
  1874. 'http://schemas.microsoft.com/visio/2003/SVGExtensions/',
  1875. 'http://taptrix.com/vectorillustrator/svg_extensions',
  1876. 'http://www.figma.com/figma/ns',
  1877. 'http://purl.org/dc/elements/1.1/',
  1878. 'http://creativecommons.org/ns#',
  1879. 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
  1880. 'http://www.serif.com/',
  1881. 'http://www.vector.evaxdesign.sk',
  1882. ];
  1883. // https://www.w3.org/TR/SVG11/linking.html#processingIRI
  1884. exports.referencesProps = [
  1885. 'clip-path',
  1886. 'color-profile',
  1887. 'fill',
  1888. 'filter',
  1889. 'marker-start',
  1890. 'marker-mid',
  1891. 'marker-end',
  1892. 'mask',
  1893. 'stroke',
  1894. 'style',
  1895. ];
  1896. // https://www.w3.org/TR/SVG11/propidx.html
  1897. exports.inheritableAttrs = [
  1898. 'clip-rule',
  1899. 'color',
  1900. 'color-interpolation',
  1901. 'color-interpolation-filters',
  1902. 'color-profile',
  1903. 'color-rendering',
  1904. 'cursor',
  1905. 'direction',
  1906. 'dominant-baseline',
  1907. 'fill',
  1908. 'fill-opacity',
  1909. 'fill-rule',
  1910. 'font',
  1911. 'font-family',
  1912. 'font-size',
  1913. 'font-size-adjust',
  1914. 'font-stretch',
  1915. 'font-style',
  1916. 'font-variant',
  1917. 'font-weight',
  1918. 'glyph-orientation-horizontal',
  1919. 'glyph-orientation-vertical',
  1920. 'image-rendering',
  1921. 'letter-spacing',
  1922. 'marker',
  1923. 'marker-end',
  1924. 'marker-mid',
  1925. 'marker-start',
  1926. 'paint-order',
  1927. 'pointer-events',
  1928. 'shape-rendering',
  1929. 'stroke',
  1930. 'stroke-dasharray',
  1931. 'stroke-dashoffset',
  1932. 'stroke-linecap',
  1933. 'stroke-linejoin',
  1934. 'stroke-miterlimit',
  1935. 'stroke-opacity',
  1936. 'stroke-width',
  1937. 'text-anchor',
  1938. 'text-rendering',
  1939. 'transform',
  1940. 'visibility',
  1941. 'word-spacing',
  1942. 'writing-mode',
  1943. ];
  1944. exports.presentationNonInheritableGroupAttrs = [
  1945. 'display',
  1946. 'clip-path',
  1947. 'filter',
  1948. 'mask',
  1949. 'opacity',
  1950. 'text-decoration',
  1951. 'transform',
  1952. 'unicode-bidi',
  1953. ];
  1954. /**
  1955. * https://www.w3.org/TR/SVG11/single-page.html#types-ColorKeywords
  1956. *
  1957. * @type {Record<string, string>}
  1958. */
  1959. exports.colorsNames = {
  1960. aliceblue: '#f0f8ff',
  1961. antiquewhite: '#faebd7',
  1962. aqua: '#0ff',
  1963. aquamarine: '#7fffd4',
  1964. azure: '#f0ffff',
  1965. beige: '#f5f5dc',
  1966. bisque: '#ffe4c4',
  1967. black: '#000',
  1968. blanchedalmond: '#ffebcd',
  1969. blue: '#00f',
  1970. blueviolet: '#8a2be2',
  1971. brown: '#a52a2a',
  1972. burlywood: '#deb887',
  1973. cadetblue: '#5f9ea0',
  1974. chartreuse: '#7fff00',
  1975. chocolate: '#d2691e',
  1976. coral: '#ff7f50',
  1977. cornflowerblue: '#6495ed',
  1978. cornsilk: '#fff8dc',
  1979. crimson: '#dc143c',
  1980. cyan: '#0ff',
  1981. darkblue: '#00008b',
  1982. darkcyan: '#008b8b',
  1983. darkgoldenrod: '#b8860b',
  1984. darkgray: '#a9a9a9',
  1985. darkgreen: '#006400',
  1986. darkgrey: '#a9a9a9',
  1987. darkkhaki: '#bdb76b',
  1988. darkmagenta: '#8b008b',
  1989. darkolivegreen: '#556b2f',
  1990. darkorange: '#ff8c00',
  1991. darkorchid: '#9932cc',
  1992. darkred: '#8b0000',
  1993. darksalmon: '#e9967a',
  1994. darkseagreen: '#8fbc8f',
  1995. darkslateblue: '#483d8b',
  1996. darkslategray: '#2f4f4f',
  1997. darkslategrey: '#2f4f4f',
  1998. darkturquoise: '#00ced1',
  1999. darkviolet: '#9400d3',
  2000. deeppink: '#ff1493',
  2001. deepskyblue: '#00bfff',
  2002. dimgray: '#696969',
  2003. dimgrey: '#696969',
  2004. dodgerblue: '#1e90ff',
  2005. firebrick: '#b22222',
  2006. floralwhite: '#fffaf0',
  2007. forestgreen: '#228b22',
  2008. fuchsia: '#f0f',
  2009. gainsboro: '#dcdcdc',
  2010. ghostwhite: '#f8f8ff',
  2011. gold: '#ffd700',
  2012. goldenrod: '#daa520',
  2013. gray: '#808080',
  2014. green: '#008000',
  2015. greenyellow: '#adff2f',
  2016. grey: '#808080',
  2017. honeydew: '#f0fff0',
  2018. hotpink: '#ff69b4',
  2019. indianred: '#cd5c5c',
  2020. indigo: '#4b0082',
  2021. ivory: '#fffff0',
  2022. khaki: '#f0e68c',
  2023. lavender: '#e6e6fa',
  2024. lavenderblush: '#fff0f5',
  2025. lawngreen: '#7cfc00',
  2026. lemonchiffon: '#fffacd',
  2027. lightblue: '#add8e6',
  2028. lightcoral: '#f08080',
  2029. lightcyan: '#e0ffff',
  2030. lightgoldenrodyellow: '#fafad2',
  2031. lightgray: '#d3d3d3',
  2032. lightgreen: '#90ee90',
  2033. lightgrey: '#d3d3d3',
  2034. lightpink: '#ffb6c1',
  2035. lightsalmon: '#ffa07a',
  2036. lightseagreen: '#20b2aa',
  2037. lightskyblue: '#87cefa',
  2038. lightslategray: '#789',
  2039. lightslategrey: '#789',
  2040. lightsteelblue: '#b0c4de',
  2041. lightyellow: '#ffffe0',
  2042. lime: '#0f0',
  2043. limegreen: '#32cd32',
  2044. linen: '#faf0e6',
  2045. magenta: '#f0f',
  2046. maroon: '#800000',
  2047. mediumaquamarine: '#66cdaa',
  2048. mediumblue: '#0000cd',
  2049. mediumorchid: '#ba55d3',
  2050. mediumpurple: '#9370db',
  2051. mediumseagreen: '#3cb371',
  2052. mediumslateblue: '#7b68ee',
  2053. mediumspringgreen: '#00fa9a',
  2054. mediumturquoise: '#48d1cc',
  2055. mediumvioletred: '#c71585',
  2056. midnightblue: '#191970',
  2057. mintcream: '#f5fffa',
  2058. mistyrose: '#ffe4e1',
  2059. moccasin: '#ffe4b5',
  2060. navajowhite: '#ffdead',
  2061. navy: '#000080',
  2062. oldlace: '#fdf5e6',
  2063. olive: '#808000',
  2064. olivedrab: '#6b8e23',
  2065. orange: '#ffa500',
  2066. orangered: '#ff4500',
  2067. orchid: '#da70d6',
  2068. palegoldenrod: '#eee8aa',
  2069. palegreen: '#98fb98',
  2070. paleturquoise: '#afeeee',
  2071. palevioletred: '#db7093',
  2072. papayawhip: '#ffefd5',
  2073. peachpuff: '#ffdab9',
  2074. peru: '#cd853f',
  2075. pink: '#ffc0cb',
  2076. plum: '#dda0dd',
  2077. powderblue: '#b0e0e6',
  2078. purple: '#800080',
  2079. rebeccapurple: '#639',
  2080. red: '#f00',
  2081. rosybrown: '#bc8f8f',
  2082. royalblue: '#4169e1',
  2083. saddlebrown: '#8b4513',
  2084. salmon: '#fa8072',
  2085. sandybrown: '#f4a460',
  2086. seagreen: '#2e8b57',
  2087. seashell: '#fff5ee',
  2088. sienna: '#a0522d',
  2089. silver: '#c0c0c0',
  2090. skyblue: '#87ceeb',
  2091. slateblue: '#6a5acd',
  2092. slategray: '#708090',
  2093. slategrey: '#708090',
  2094. snow: '#fffafa',
  2095. springgreen: '#00ff7f',
  2096. steelblue: '#4682b4',
  2097. tan: '#d2b48c',
  2098. teal: '#008080',
  2099. thistle: '#d8bfd8',
  2100. tomato: '#ff6347',
  2101. turquoise: '#40e0d0',
  2102. violet: '#ee82ee',
  2103. wheat: '#f5deb3',
  2104. white: '#fff',
  2105. whitesmoke: '#f5f5f5',
  2106. yellow: '#ff0',
  2107. yellowgreen: '#9acd32',
  2108. };
  2109. /**
  2110. * @type {Record<string, string>}
  2111. */
  2112. exports.colorsShortNames = {
  2113. '#f0ffff': 'azure',
  2114. '#f5f5dc': 'beige',
  2115. '#ffe4c4': 'bisque',
  2116. '#a52a2a': 'brown',
  2117. '#ff7f50': 'coral',
  2118. '#ffd700': 'gold',
  2119. '#808080': 'gray',
  2120. '#008000': 'green',
  2121. '#4b0082': 'indigo',
  2122. '#fffff0': 'ivory',
  2123. '#f0e68c': 'khaki',
  2124. '#faf0e6': 'linen',
  2125. '#800000': 'maroon',
  2126. '#000080': 'navy',
  2127. '#808000': 'olive',
  2128. '#ffa500': 'orange',
  2129. '#da70d6': 'orchid',
  2130. '#cd853f': 'peru',
  2131. '#ffc0cb': 'pink',
  2132. '#dda0dd': 'plum',
  2133. '#800080': 'purple',
  2134. '#f00': 'red',
  2135. '#ff0000': 'red',
  2136. '#fa8072': 'salmon',
  2137. '#a0522d': 'sienna',
  2138. '#c0c0c0': 'silver',
  2139. '#fffafa': 'snow',
  2140. '#d2b48c': 'tan',
  2141. '#008080': 'teal',
  2142. '#ff6347': 'tomato',
  2143. '#ee82ee': 'violet',
  2144. '#f5deb3': 'wheat',
  2145. };
  2146. // https://www.w3.org/TR/SVG11/single-page.html#types-DataTypeColor
  2147. exports.colorsProps = [
  2148. 'color',
  2149. 'fill',
  2150. 'stroke',
  2151. 'stop-color',
  2152. 'flood-color',
  2153. 'lighting-color',
  2154. ];