svg.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. 'use strict'
  2. var types = require('./util/types')
  3. var create = require('./util/create')
  4. var caseSensitiveTransform = require('./util/case-sensitive-transform')
  5. var boolean = types.boolean
  6. var number = types.number
  7. var spaceSeparated = types.spaceSeparated
  8. var commaSeparated = types.commaSeparated
  9. var commaOrSpaceSeparated = types.commaOrSpaceSeparated
  10. module.exports = create({
  11. space: 'svg',
  12. attributes: {
  13. accentHeight: 'accent-height',
  14. alignmentBaseline: 'alignment-baseline',
  15. arabicForm: 'arabic-form',
  16. baselineShift: 'baseline-shift',
  17. capHeight: 'cap-height',
  18. className: 'class',
  19. clipPath: 'clip-path',
  20. clipRule: 'clip-rule',
  21. colorInterpolation: 'color-interpolation',
  22. colorInterpolationFilters: 'color-interpolation-filters',
  23. colorProfile: 'color-profile',
  24. colorRendering: 'color-rendering',
  25. crossOrigin: 'crossorigin',
  26. dataType: 'datatype',
  27. dominantBaseline: 'dominant-baseline',
  28. enableBackground: 'enable-background',
  29. fillOpacity: 'fill-opacity',
  30. fillRule: 'fill-rule',
  31. floodColor: 'flood-color',
  32. floodOpacity: 'flood-opacity',
  33. fontFamily: 'font-family',
  34. fontSize: 'font-size',
  35. fontSizeAdjust: 'font-size-adjust',
  36. fontStretch: 'font-stretch',
  37. fontStyle: 'font-style',
  38. fontVariant: 'font-variant',
  39. fontWeight: 'font-weight',
  40. glyphName: 'glyph-name',
  41. glyphOrientationHorizontal: 'glyph-orientation-horizontal',
  42. glyphOrientationVertical: 'glyph-orientation-vertical',
  43. hrefLang: 'hreflang',
  44. horizAdvX: 'horiz-adv-x',
  45. horizOriginX: 'horiz-origin-x',
  46. horizOriginY: 'horiz-origin-y',
  47. imageRendering: 'image-rendering',
  48. letterSpacing: 'letter-spacing',
  49. lightingColor: 'lighting-color',
  50. markerEnd: 'marker-end',
  51. markerMid: 'marker-mid',
  52. markerStart: 'marker-start',
  53. navDown: 'nav-down',
  54. navDownLeft: 'nav-down-left',
  55. navDownRight: 'nav-down-right',
  56. navLeft: 'nav-left',
  57. navNext: 'nav-next',
  58. navPrev: 'nav-prev',
  59. navRight: 'nav-right',
  60. navUp: 'nav-up',
  61. navUpLeft: 'nav-up-left',
  62. navUpRight: 'nav-up-right',
  63. overlinePosition: 'overline-position',
  64. overlineThickness: 'overline-thickness',
  65. paintOrder: 'paint-order',
  66. panose1: 'panose-1',
  67. pointerEvents: 'pointer-events',
  68. renderingIntent: 'rendering-intent',
  69. shapeRendering: 'shape-rendering',
  70. stopColor: 'stop-color',
  71. stopOpacity: 'stop-opacity',
  72. strikethroughPosition: 'strikethrough-position',
  73. strikethroughThickness: 'strikethrough-thickness',
  74. strokeDashArray: 'stroke-dasharray',
  75. strokeDashOffset: 'stroke-dashoffset',
  76. strokeLineCap: 'stroke-linecap',
  77. strokeLineJoin: 'stroke-linejoin',
  78. strokeMiterLimit: 'stroke-miterlimit',
  79. strokeOpacity: 'stroke-opacity',
  80. strokeWidth: 'stroke-width',
  81. tabIndex: 'tabindex',
  82. textAnchor: 'text-anchor',
  83. textDecoration: 'text-decoration',
  84. textRendering: 'text-rendering',
  85. typeOf: 'typeof',
  86. underlinePosition: 'underline-position',
  87. underlineThickness: 'underline-thickness',
  88. unicodeBidi: 'unicode-bidi',
  89. unicodeRange: 'unicode-range',
  90. unitsPerEm: 'units-per-em',
  91. vAlphabetic: 'v-alphabetic',
  92. vHanging: 'v-hanging',
  93. vIdeographic: 'v-ideographic',
  94. vMathematical: 'v-mathematical',
  95. vectorEffect: 'vector-effect',
  96. vertAdvY: 'vert-adv-y',
  97. vertOriginX: 'vert-origin-x',
  98. vertOriginY: 'vert-origin-y',
  99. wordSpacing: 'word-spacing',
  100. writingMode: 'writing-mode',
  101. xHeight: 'x-height',
  102. // These were camelcased in Tiny. Now lowercased in SVG 2
  103. playbackOrder: 'playbackorder',
  104. timelineBegin: 'timelinebegin'
  105. },
  106. transform: caseSensitiveTransform,
  107. properties: {
  108. about: commaOrSpaceSeparated,
  109. accentHeight: number,
  110. accumulate: null,
  111. additive: null,
  112. alignmentBaseline: null,
  113. alphabetic: number,
  114. amplitude: number,
  115. arabicForm: null,
  116. ascent: number,
  117. attributeName: null,
  118. attributeType: null,
  119. azimuth: number,
  120. bandwidth: null,
  121. baselineShift: null,
  122. baseFrequency: null,
  123. baseProfile: null,
  124. bbox: null,
  125. begin: null,
  126. bias: number,
  127. by: null,
  128. calcMode: null,
  129. capHeight: number,
  130. className: spaceSeparated,
  131. clip: null,
  132. clipPath: null,
  133. clipPathUnits: null,
  134. clipRule: null,
  135. color: null,
  136. colorInterpolation: null,
  137. colorInterpolationFilters: null,
  138. colorProfile: null,
  139. colorRendering: null,
  140. content: null,
  141. contentScriptType: null,
  142. contentStyleType: null,
  143. crossOrigin: null,
  144. cursor: null,
  145. cx: null,
  146. cy: null,
  147. d: null,
  148. dataType: null,
  149. defaultAction: null,
  150. descent: number,
  151. diffuseConstant: number,
  152. direction: null,
  153. display: null,
  154. dur: null,
  155. divisor: number,
  156. dominantBaseline: null,
  157. download: boolean,
  158. dx: null,
  159. dy: null,
  160. edgeMode: null,
  161. editable: null,
  162. elevation: number,
  163. enableBackground: null,
  164. end: null,
  165. event: null,
  166. exponent: number,
  167. externalResourcesRequired: null,
  168. fill: null,
  169. fillOpacity: number,
  170. fillRule: null,
  171. filter: null,
  172. filterRes: null,
  173. filterUnits: null,
  174. floodColor: null,
  175. floodOpacity: null,
  176. focusable: null,
  177. focusHighlight: null,
  178. fontFamily: null,
  179. fontSize: null,
  180. fontSizeAdjust: null,
  181. fontStretch: null,
  182. fontStyle: null,
  183. fontVariant: null,
  184. fontWeight: null,
  185. format: null,
  186. fr: null,
  187. from: null,
  188. fx: null,
  189. fy: null,
  190. g1: commaSeparated,
  191. g2: commaSeparated,
  192. glyphName: commaSeparated,
  193. glyphOrientationHorizontal: null,
  194. glyphOrientationVertical: null,
  195. glyphRef: null,
  196. gradientTransform: null,
  197. gradientUnits: null,
  198. handler: null,
  199. hanging: number,
  200. hatchContentUnits: null,
  201. hatchUnits: null,
  202. height: null,
  203. href: null,
  204. hrefLang: null,
  205. horizAdvX: number,
  206. horizOriginX: number,
  207. horizOriginY: number,
  208. id: null,
  209. ideographic: number,
  210. imageRendering: null,
  211. initialVisibility: null,
  212. in: null,
  213. in2: null,
  214. intercept: number,
  215. k: number,
  216. k1: number,
  217. k2: number,
  218. k3: number,
  219. k4: number,
  220. kernelMatrix: commaOrSpaceSeparated,
  221. kernelUnitLength: null,
  222. keyPoints: null, // SEMI_COLON_SEPARATED
  223. keySplines: null, // SEMI_COLON_SEPARATED
  224. keyTimes: null, // SEMI_COLON_SEPARATED
  225. kerning: null,
  226. lang: null,
  227. lengthAdjust: null,
  228. letterSpacing: null,
  229. lightingColor: null,
  230. limitingConeAngle: number,
  231. local: null,
  232. markerEnd: null,
  233. markerMid: null,
  234. markerStart: null,
  235. markerHeight: null,
  236. markerUnits: null,
  237. markerWidth: null,
  238. mask: null,
  239. maskContentUnits: null,
  240. maskUnits: null,
  241. mathematical: null,
  242. max: null,
  243. media: null,
  244. mediaCharacterEncoding: null,
  245. mediaContentEncodings: null,
  246. mediaSize: number,
  247. mediaTime: null,
  248. method: null,
  249. min: null,
  250. mode: null,
  251. name: null,
  252. navDown: null,
  253. navDownLeft: null,
  254. navDownRight: null,
  255. navLeft: null,
  256. navNext: null,
  257. navPrev: null,
  258. navRight: null,
  259. navUp: null,
  260. navUpLeft: null,
  261. navUpRight: null,
  262. numOctaves: null,
  263. observer: null,
  264. offset: null,
  265. opacity: null,
  266. operator: null,
  267. order: null,
  268. orient: null,
  269. orientation: null,
  270. origin: null,
  271. overflow: null,
  272. overlay: null,
  273. overlinePosition: number,
  274. overlineThickness: number,
  275. paintOrder: null,
  276. panose1: null,
  277. path: null,
  278. pathLength: number,
  279. patternContentUnits: null,
  280. patternTransform: null,
  281. patternUnits: null,
  282. phase: null,
  283. pitch: null,
  284. playbackOrder: null,
  285. pointerEvents: null,
  286. points: null,
  287. pointsAtX: number,
  288. pointsAtY: number,
  289. pointsAtZ: number,
  290. preserveAlpha: null,
  291. preserveAspectRatio: null,
  292. primitiveUnits: null,
  293. propagate: null,
  294. property: commaOrSpaceSeparated,
  295. r: null,
  296. radius: null,
  297. refX: null,
  298. refY: null,
  299. rel: commaOrSpaceSeparated,
  300. rev: commaOrSpaceSeparated,
  301. renderingIntent: null,
  302. repeatCount: null,
  303. repeatDur: null,
  304. requiredExtensions: commaOrSpaceSeparated,
  305. requiredFeatures: commaOrSpaceSeparated,
  306. requiredFonts: commaOrSpaceSeparated,
  307. requiredFormats: commaOrSpaceSeparated,
  308. resource: null,
  309. restart: null,
  310. result: null,
  311. rotate: null,
  312. rx: null,
  313. ry: null,
  314. scale: null,
  315. seed: null,
  316. shapeRendering: null,
  317. side: null,
  318. slope: null,
  319. snapshotTime: null,
  320. specularConstant: number,
  321. specularExponent: number,
  322. spreadMethod: null,
  323. spacing: null,
  324. startOffset: null,
  325. stdDeviation: null,
  326. stemh: null,
  327. stemv: null,
  328. stitchTiles: null,
  329. stopColor: null,
  330. stopOpacity: null,
  331. strikethroughPosition: number,
  332. strikethroughThickness: number,
  333. string: null,
  334. stroke: null,
  335. strokeDashArray: commaOrSpaceSeparated,
  336. strokeDashOffset: null,
  337. strokeLineCap: null,
  338. strokeLineJoin: null,
  339. strokeMiterLimit: number,
  340. strokeOpacity: number,
  341. strokeWidth: null,
  342. style: null,
  343. surfaceScale: number,
  344. syncBehavior: null,
  345. syncBehaviorDefault: null,
  346. syncMaster: null,
  347. syncTolerance: null,
  348. syncToleranceDefault: null,
  349. systemLanguage: commaOrSpaceSeparated,
  350. tabIndex: number,
  351. tableValues: null,
  352. target: null,
  353. targetX: number,
  354. targetY: number,
  355. textAnchor: null,
  356. textDecoration: null,
  357. textRendering: null,
  358. textLength: null,
  359. timelineBegin: null,
  360. title: null,
  361. transformBehavior: null,
  362. type: null,
  363. typeOf: commaOrSpaceSeparated,
  364. to: null,
  365. transform: null,
  366. u1: null,
  367. u2: null,
  368. underlinePosition: number,
  369. underlineThickness: number,
  370. unicode: null,
  371. unicodeBidi: null,
  372. unicodeRange: null,
  373. unitsPerEm: number,
  374. values: null,
  375. vAlphabetic: number,
  376. vMathematical: number,
  377. vectorEffect: null,
  378. vHanging: number,
  379. vIdeographic: number,
  380. version: null,
  381. vertAdvY: number,
  382. vertOriginX: number,
  383. vertOriginY: number,
  384. viewBox: null,
  385. viewTarget: null,
  386. visibility: null,
  387. width: null,
  388. widths: null,
  389. wordSpacing: null,
  390. writingMode: null,
  391. x: null,
  392. x1: null,
  393. x2: null,
  394. xChannelSelector: null,
  395. xHeight: number,
  396. y: null,
  397. y1: null,
  398. y2: null,
  399. yChannelSelector: null,
  400. z: null,
  401. zoomAndPan: null
  402. }
  403. })