UNPKG

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