UNPKG

7.2 kBJavaScriptView Raw
1/**
2 * Copyright (c) 2013-present, Facebook, Inc.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 */
8
9'use strict';
10
11var NS = {
12 xlink: 'http://www.w3.org/1999/xlink',
13 xml: 'http://www.w3.org/XML/1998/namespace'
14};
15
16// We use attributes for everything SVG so let's avoid some duplication and run
17// code instead.
18// The following are all specified in the HTML config already so we exclude here.
19// - class (as className)
20// - color
21// - height
22// - id
23// - lang
24// - max
25// - media
26// - method
27// - min
28// - name
29// - style
30// - target
31// - type
32// - width
33var ATTRS = {
34 accentHeight: 'accent-height',
35 accumulate: 0,
36 additive: 0,
37 alignmentBaseline: 'alignment-baseline',
38 allowReorder: 'allowReorder',
39 alphabetic: 0,
40 amplitude: 0,
41 arabicForm: 'arabic-form',
42 ascent: 0,
43 attributeName: 'attributeName',
44 attributeType: 'attributeType',
45 autoReverse: 'autoReverse',
46 azimuth: 0,
47 baseFrequency: 'baseFrequency',
48 baseProfile: 'baseProfile',
49 baselineShift: 'baseline-shift',
50 bbox: 0,
51 begin: 0,
52 bias: 0,
53 by: 0,
54 calcMode: 'calcMode',
55 capHeight: 'cap-height',
56 clip: 0,
57 clipPath: 'clip-path',
58 clipRule: 'clip-rule',
59 clipPathUnits: 'clipPathUnits',
60 colorInterpolation: 'color-interpolation',
61 colorInterpolationFilters: 'color-interpolation-filters',
62 colorProfile: 'color-profile',
63 colorRendering: 'color-rendering',
64 contentScriptType: 'contentScriptType',
65 contentStyleType: 'contentStyleType',
66 cursor: 0,
67 cx: 0,
68 cy: 0,
69 d: 0,
70 decelerate: 0,
71 descent: 0,
72 diffuseConstant: 'diffuseConstant',
73 direction: 0,
74 display: 0,
75 divisor: 0,
76 dominantBaseline: 'dominant-baseline',
77 dur: 0,
78 dx: 0,
79 dy: 0,
80 edgeMode: 'edgeMode',
81 elevation: 0,
82 enableBackground: 'enable-background',
83 end: 0,
84 exponent: 0,
85 externalResourcesRequired: 'externalResourcesRequired',
86 fill: 0,
87 fillOpacity: 'fill-opacity',
88 fillRule: 'fill-rule',
89 filter: 0,
90 filterRes: 'filterRes',
91 filterUnits: 'filterUnits',
92 floodColor: 'flood-color',
93 floodOpacity: 'flood-opacity',
94 focusable: 0,
95 fontFamily: 'font-family',
96 fontSize: 'font-size',
97 fontSizeAdjust: 'font-size-adjust',
98 fontStretch: 'font-stretch',
99 fontStyle: 'font-style',
100 fontVariant: 'font-variant',
101 fontWeight: 'font-weight',
102 format: 0,
103 from: 0,
104 fx: 0,
105 fy: 0,
106 g1: 0,
107 g2: 0,
108 glyphName: 'glyph-name',
109 glyphOrientationHorizontal: 'glyph-orientation-horizontal',
110 glyphOrientationVertical: 'glyph-orientation-vertical',
111 glyphRef: 'glyphRef',
112 gradientTransform: 'gradientTransform',
113 gradientUnits: 'gradientUnits',
114 hanging: 0,
115 horizAdvX: 'horiz-adv-x',
116 horizOriginX: 'horiz-origin-x',
117 ideographic: 0,
118 imageRendering: 'image-rendering',
119 'in': 0,
120 in2: 0,
121 intercept: 0,
122 k: 0,
123 k1: 0,
124 k2: 0,
125 k3: 0,
126 k4: 0,
127 kernelMatrix: 'kernelMatrix',
128 kernelUnitLength: 'kernelUnitLength',
129 kerning: 0,
130 keyPoints: 'keyPoints',
131 keySplines: 'keySplines',
132 keyTimes: 'keyTimes',
133 lengthAdjust: 'lengthAdjust',
134 letterSpacing: 'letter-spacing',
135 lightingColor: 'lighting-color',
136 limitingConeAngle: 'limitingConeAngle',
137 local: 0,
138 markerEnd: 'marker-end',
139 markerMid: 'marker-mid',
140 markerStart: 'marker-start',
141 markerHeight: 'markerHeight',
142 markerUnits: 'markerUnits',
143 markerWidth: 'markerWidth',
144 mask: 0,
145 maskContentUnits: 'maskContentUnits',
146 maskUnits: 'maskUnits',
147 mathematical: 0,
148 mode: 0,
149 numOctaves: 'numOctaves',
150 offset: 0,
151 opacity: 0,
152 operator: 0,
153 order: 0,
154 orient: 0,
155 orientation: 0,
156 origin: 0,
157 overflow: 0,
158 overlinePosition: 'overline-position',
159 overlineThickness: 'overline-thickness',
160 paintOrder: 'paint-order',
161 panose1: 'panose-1',
162 pathLength: 'pathLength',
163 patternContentUnits: 'patternContentUnits',
164 patternTransform: 'patternTransform',
165 patternUnits: 'patternUnits',
166 pointerEvents: 'pointer-events',
167 points: 0,
168 pointsAtX: 'pointsAtX',
169 pointsAtY: 'pointsAtY',
170 pointsAtZ: 'pointsAtZ',
171 preserveAlpha: 'preserveAlpha',
172 preserveAspectRatio: 'preserveAspectRatio',
173 primitiveUnits: 'primitiveUnits',
174 r: 0,
175 radius: 0,
176 refX: 'refX',
177 refY: 'refY',
178 renderingIntent: 'rendering-intent',
179 repeatCount: 'repeatCount',
180 repeatDur: 'repeatDur',
181 requiredExtensions: 'requiredExtensions',
182 requiredFeatures: 'requiredFeatures',
183 restart: 0,
184 result: 0,
185 rotate: 0,
186 rx: 0,
187 ry: 0,
188 scale: 0,
189 seed: 0,
190 shapeRendering: 'shape-rendering',
191 slope: 0,
192 spacing: 0,
193 specularConstant: 'specularConstant',
194 specularExponent: 'specularExponent',
195 speed: 0,
196 spreadMethod: 'spreadMethod',
197 startOffset: 'startOffset',
198 stdDeviation: 'stdDeviation',
199 stemh: 0,
200 stemv: 0,
201 stitchTiles: 'stitchTiles',
202 stopColor: 'stop-color',
203 stopOpacity: 'stop-opacity',
204 strikethroughPosition: 'strikethrough-position',
205 strikethroughThickness: 'strikethrough-thickness',
206 string: 0,
207 stroke: 0,
208 strokeDasharray: 'stroke-dasharray',
209 strokeDashoffset: 'stroke-dashoffset',
210 strokeLinecap: 'stroke-linecap',
211 strokeLinejoin: 'stroke-linejoin',
212 strokeMiterlimit: 'stroke-miterlimit',
213 strokeOpacity: 'stroke-opacity',
214 strokeWidth: 'stroke-width',
215 surfaceScale: 'surfaceScale',
216 systemLanguage: 'systemLanguage',
217 tableValues: 'tableValues',
218 targetX: 'targetX',
219 targetY: 'targetY',
220 textAnchor: 'text-anchor',
221 textDecoration: 'text-decoration',
222 textRendering: 'text-rendering',
223 textLength: 'textLength',
224 to: 0,
225 transform: 0,
226 u1: 0,
227 u2: 0,
228 underlinePosition: 'underline-position',
229 underlineThickness: 'underline-thickness',
230 unicode: 0,
231 unicodeBidi: 'unicode-bidi',
232 unicodeRange: 'unicode-range',
233 unitsPerEm: 'units-per-em',
234 vAlphabetic: 'v-alphabetic',
235 vHanging: 'v-hanging',
236 vIdeographic: 'v-ideographic',
237 vMathematical: 'v-mathematical',
238 values: 0,
239 vectorEffect: 'vector-effect',
240 version: 0,
241 vertAdvY: 'vert-adv-y',
242 vertOriginX: 'vert-origin-x',
243 vertOriginY: 'vert-origin-y',
244 viewBox: 'viewBox',
245 viewTarget: 'viewTarget',
246 visibility: 0,
247 widths: 0,
248 wordSpacing: 'word-spacing',
249 writingMode: 'writing-mode',
250 x: 0,
251 xHeight: 'x-height',
252 x1: 0,
253 x2: 0,
254 xChannelSelector: 'xChannelSelector',
255 xlinkActuate: 'xlink:actuate',
256 xlinkArcrole: 'xlink:arcrole',
257 xlinkHref: 'xlink:href',
258 xlinkRole: 'xlink:role',
259 xlinkShow: 'xlink:show',
260 xlinkTitle: 'xlink:title',
261 xlinkType: 'xlink:type',
262 xmlBase: 'xml:base',
263 xmlns: 0,
264 xmlnsXlink: 'xmlns:xlink',
265 xmlLang: 'xml:lang',
266 xmlSpace: 'xml:space',
267 y: 0,
268 y1: 0,
269 y2: 0,
270 yChannelSelector: 'yChannelSelector',
271 z: 0,
272 zoomAndPan: 'zoomAndPan'
273};
274
275var SVGDOMPropertyConfig = {
276 Properties: {},
277 DOMAttributeNamespaces: {
278 xlinkActuate: NS.xlink,
279 xlinkArcrole: NS.xlink,
280 xlinkHref: NS.xlink,
281 xlinkRole: NS.xlink,
282 xlinkShow: NS.xlink,
283 xlinkTitle: NS.xlink,
284 xlinkType: NS.xlink,
285 xmlBase: NS.xml,
286 xmlLang: NS.xml,
287 xmlSpace: NS.xml
288 },
289 DOMAttributeNames: {}
290};
291
292Object.keys(ATTRS).forEach(function (key) {
293 SVGDOMPropertyConfig.Properties[key] = 0;
294 if (ATTRS[key]) {
295 SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key];
296 }
297});
298
299module.exports = SVGDOMPropertyConfig;
\No newline at end of file