diff --git a/src/renderers/dom/shared/SVGDOMPropertyConfig.js b/src/renderers/dom/shared/SVGDOMPropertyConfig.js index 3ca1b94d9b..73908bc694 100644 --- a/src/renderers/dom/shared/SVGDOMPropertyConfig.js +++ b/src/renderers/dom/shared/SVGDOMPropertyConfig.js @@ -16,258 +16,263 @@ var NS = { xml: 'http://www.w3.org/XML/1998/namespace', }; +// We use attributes for everything SVG so let's avoid some duplication and run +// code instead. + +var ATTRS = { + accentHeight: 'accent-height', + accumulate: null, + additive: null, + alignmentBaseline: 'alignment-baseline', + allowReorder: 'allowReorder', + alphabetic: null, + amplitude: null, + arabicForm: 'arabic-form', + ascent: null, + attributeName: 'attributeName', + attributeType: 'attributeType', + autoReverse: 'autoReverse', + azimuth: null, + baseFrequency: 'baseFrequency', + baseProfile: 'baseProfile', + baselineShift: 'baseline-shift', + bbox: null, + begin: null, + bias: null, + by: null, + calcMode: 'calcMode', + capHeight: 'cap-height', + class: null, + clip: null, + clipPath: 'clip-path', + clipRule: 'clip-rule', + clipPathUnits: 'clipPathUnits', + color: null, + colorInterpolation: 'color-interpolation', + colorInterpolationFilters: 'color-interpolation-filters', + colorProfile: 'color-profile', + colorRendering: 'color-rendering', + contentScriptType: 'contentScriptType', + contentStyleType: 'contentStyleType', + cursor: null, + cx: null, + cy: null, + d: null, + decelerate: null, + descent: null, + diffuseConstant: 'diffuseConstant', + direction: null, + display: null, + divisor: null, + dominantBaseline: 'dominant-baseline', + dur: null, + dx: null, + dy: null, + edgeMode: 'edgeMode', + elevation: null, + enableBackground: 'enable-background', + end: null, + exponent: null, + externalResourcesRequired: 'externalResourcesRequired', + fill: null, + fillOpacity: 'fill-opacity', + fillRule: 'fill-rule', + filter: null, + filterRes: 'filterRes', + filterUnits: 'filterUnits', + floodColor: 'flood-color', + floodOpacity: 'flood-opacity', + fontFamily: 'font-family', + fontSize: 'font-size', + fontSizeAdjust: 'font-size-adjust', + fontStretch: 'font-stretch', + fontStyle: 'font-style', + fontVariant: 'font-variant', + fontWeight: 'font-weight', + format: null, + from: null, + fx: null, + fy: null, + g1: null, + g2: null, + glyphName: 'glyph-name', + glyphOrientationHorizontal: 'glyph-orientation-horizontal', + glyphOrientationVertical: 'glyph-orientation-vertical', + glyphRef: 'glyphRef', + gradientTransform: 'gradientTransform', + gradientUnits: 'gradientUnits', + hanging: null, + height: null, + horizAdvX: 'horiz-adv-x', + horizOriginX: 'horiz-origin-x', + id: null, + ideographic: null, + imageRendering: 'image-rendering', + in: null, + in2: null, + intercept: null, + k: null, + k1: null, + k2: null, + k3: null, + k4: null, + kernelMatrix: 'kernelMatrix', + kernelUnitLength: 'kernelUnitLength', + kerning: null, + keyPoints: 'keyPoints', + keySplines: 'keySplines', + keyTimes: 'keyTimes', + lang: null, + lengthAdjust: 'lengthAdjust', + letterSpacing: 'letter-spacing', + lightingColor: 'lighting-color', + limitingConeAngle: 'limitingConeAngle', + local: null, + markerEnd: 'marker-end', + markerMid: 'marker-mid', + markerStart: 'marker-start', + markerHeight: 'markerHeight', + markerUnits: 'markerUnits', + markerWidth: 'markerWidth', + mask: null, + maskContentUnits: 'maskContentUnits', + maskUnits: 'maskUnits', + mathematical: null, + max: null, + media: null, + method: null, + min: null, + mode: null, + name: null, + numOctaves: 'numOctaves', + offset: null, + opacity: null, + operator: null, + order: null, + orient: null, + orientation: null, + origin: null, + overflow: null, + overlinePosition: 'overline-position', + overlineThickness: 'overline-thickness', + paintOrder: 'paint-order', + panose1: 'panose-1', + pathLength: 'pathLength', + patternContentUnits: 'patternContentUnits', + patternTransform: 'patternTransform', + patternUnits: 'patternUnits', + pointerEvents: 'pointer-events', + points: null, + pointsAtX: 'pointsAtX', + pointsAtY: 'pointsAtY', + pointsAtZ: 'pointsAtZ', + preserveAlpha: 'preserveAlpha', + preserveAspectRatio: 'preserveAspectRatio', + primitiveUnits: 'primitiveUnits', + r: null, + radius: null, + refX: 'refX', + refY: 'refY', + renderingIntent: 'rendering-intent', + repeatCount: 'repeatCount', + repeatDur: 'repeatDur', + requiredExtensions: 'requiredExtensions', + requiredFeatures: 'requiredFeatures', + restart: null, + result: null, + rotate: null, + rx: null, + ry: null, + scale: null, + seed: null, + shapeRendering: 'shape-rendering', + slope: null, + spacing: null, + specularConstant: 'specularConstant', + specularExponent: 'specularExponent', + speed: null, + spreadMethod: 'spreadMethod', + startOffset: 'startOffset', + stdDeviation: 'stdDeviation', + stemh: null, + stemv: null, + stitchTiles: 'stitchTiles', + stopColor: 'stop-color', + stopOpacity: 'stop-opacity', + strikethroughPosition: 'strikethrough-position', + strikethroughThickness: 'strikethrough-thickness', + string: null, + stroke: null, + strokeDasharray: 'stroke-dasharray', + strokeDashoffset: 'stroke-dashoffset', + strokeLinecap: 'stroke-linecap', + strokeLinejoin: 'stroke-linejoin', + strokeMiterlimit: 'stroke-miterlimit', + strokeOpacity: 'stroke-opacity', + strokeWidth: 'stroke-width', + style: null, + surfaceScale: 'surfaceScale', + systemLanguage: 'systemLanguage', + tableValues: 'tableValues', + target: null, + targetX: 'targetX', + targetY: 'targetY', + textAnchor: 'text-anchor', + textDecoration: 'text-decoration', + textRendering: 'text-rendering', + textLength: 'textLength', + to: null, + transform: null, + type: null, + u1: null, + u2: null, + underlinePosition: 'underline-position', + underlineThickness: 'underline-thickness', + unicode: null, + unicodeBidi: 'unicode-bidi', + unicodeRange: 'unicode-range', + unitsPerEm: 'units-per-em', + vAlphabetic: 'v-alphabetic', + vHanging: 'v-hanging', + vIdeographic: 'v-ideographic', + vMathematical: 'v-mathematical', + values: null, + version: null, + vertAdvY: 'vert-adv-y', + vertOriginX: 'vert-origin-x', + vertOriginY: 'vert-origin-y', + viewBox: 'viewBox', + viewTarget: 'viewTarget', + visibility: null, + width: null, + widths: null, + wordSpacing: 'word-spacing', + writingMode: 'writing-mode', + x: null, + xHeight: 'x-height', + x1: null, + x2: null, + xChannelSelector: 'xChannelSelector', + xlinkActuate: 'xlink:actuate', + xlinkArcrole: 'xlink:arcrole', + xlinkHref: 'xlink:href', + xlinkRole: 'xlink:role', + xlinkShow: 'xlink:show', + xlinkTitle: 'xlink:title', + xlinkType: 'xlink:type', + xmlBase: 'xml:base', + xmlLang: 'xml:lang', + xmlSpace: 'xml:space', + y: null, + y1: null, + y2: null, + yChannelSelector: 'yChannelSelector', + z: null, + zoomAndPan: 'zoomAndPan', +}; + var SVGDOMPropertyConfig = { - Properties: { - accentHeight: null, - accumulate: null, - additive: null, - alignmentBaseline: null, - allowReorder: null, - alphabetic: null, - amplitude: null, - arabicForm: null, - ascent: null, - attributeName: null, - attributeType: null, - autoReverse: null, - azimuth: null, - baseFrequency: null, - baselineShift: null, - baseProfile: null, - bbox: null, - begin: null, - bias: null, - by: null, - calcMode: null, - capHeight: null, - class: null, - clip: null, - clipPath: null, - clipPathUnits: null, - clipRule: null, - color: null, - colorInterpolation: null, - colorInterpolationFilters: null, - colorProfile: null, - colorRendering: null, - contentScriptType: null, - contentStyleType: null, - cursor: null, - cx: null, - cy: null, - d: null, - decelerate: null, - descent: null, - diffuseConstant: null, - direction: null, - display: null, - divisor: null, - dominantBaseline: null, - dur: null, - dx: null, - dy: null, - edgeMode: null, - elevation: null, - enableBackground: null, - end: null, - exponent: null, - externalResourcesRequired: null, - fill: null, - fillOpacity: null, - fillRule: null, - filter: null, - filterRes: null, - filterUnits: null, - floodColor: null, - floodOpacity: null, - fontFamily: null, - fontSize: null, - fontSizeAdjust: null, - fontStretch: null, - fontStyle: null, - fontVariant: null, - fontWeight: null, - format: null, - from: null, - fx: null, - fy: null, - g1: null, - g2: null, - glyphName: null, - glyphOrientationHorizontal: null, - glyphOrientationVertical: null, - glyphRef: null, - gradientTransform: null, - gradientUnits: null, - hanging: null, - height: null, - horizAdvX: null, - horizOriginX: null, - id: null, - ideographic: null, - imageRendering: null, - in: null, - in2: null, - intercept: null, - k: null, - k1: null, - k2: null, - k3: null, - k4: null, - kernelMatrix: null, - kernelUnitLength: null, - kerning: null, - keyPoints: null, - keySplines: null, - keyTimes: null, - lang: null, - lengthAdjust: null, - letterSpacing: null, - lightingColor: null, - limitingConeAngle: null, - local: null, - markerEnd: null, - markerHeight: null, - markerMid: null, - markerStart: null, - markerUnits: null, - markerWidth: null, - mask: null, - maskContentUnits: null, - maskUnits: null, - mathematical: null, - max: null, - media: null, - method: null, - min: null, - mode: null, - name: null, - numOctaves: null, - offset: null, - opacity: null, - operator: null, - order: null, - orient: null, - orientation: null, - origin: null, - overflow: null, - overlinePosition: null, - overlineThickness: null, - paintOrder: null, - panose1: null, - pathLength: null, - patternContentUnits: null, - patternTransform: null, - patternUnits: null, - pointerEvents: null, - points: null, - pointsAtX: null, - pointsAtY: null, - pointsAtZ: null, - preserveAlpha: null, - preserveAspectRatio: null, - primitiveUnits: null, - r: null, - radius: null, - refX: null, - refY: null, - renderingIntent: null, - repeatCount: null, - repeatDur: null, - requiredExtensions: null, - requiredFeatures: null, - restart: null, - result: null, - rotate: null, - rx: null, - ry: null, - scale: null, - seed: null, - shapeRendering: null, - slope: null, - spacing: null, - specularConstant: null, - specularExponent: null, - speed: null, - spreadMethod: null, - startOffset: null, - stdDeviation: null, - stemh: null, - stemv: null, - stitchTiles: null, - stopColor: null, - stopOpacity: null, - strikethroughPosition: null, - strikethroughThickness: null, - string: null, - stroke: null, - strokeDasharray: null, - strokeDashoffset: null, - strokeLinecap: null, - strokeLinejoin: null, - strokeMiterlimit: null, - strokeOpacity: null, - strokeWidth: null, - style: null, - surfaceScale: null, - systemLanguage: null, - tableValues: null, - target: null, - targetX: null, - targetY: null, - textAnchor: null, - textDecoration: null, - textLength: null, - textRendering: null, - to: null, - transform: null, - type: null, - u1: null, - u2: null, - underlinePosition: null, - underlineThickness: null, - unicode: null, - unicodeBidi: null, - unicodeRange: null, - unitsPerEm: null, - vAlphabetic: null, - values: null, - version: null, - vertAdvY: null, - vertOriginX: null, - vertOriginY: null, - vHanging: null, - vIdeographic: null, - viewBox: null, - viewTarget: null, - visibility: null, - vMathematical: null, - width: null, - widths: null, - wordSpacing: null, - writingMode: null, - x: null, - x1: null, - x2: null, - xChannelSelector: null, - xHeight: null, - xlinkActuate: null, - xlinkArcrole: null, - xlinkHref: null, - xlinkRole: null, - xlinkShow: null, - xlinkTitle: null, - xlinkType: null, - xmlBase: null, - xmlLang: null, - xmlSpace: null, - y: null, - y1: null, - y2: null, - yChannelSelector: null, - z: null, - zoomAndPan: null, - }, + Properties: {}, DOMAttributeNamespaces: { xlinkActuate: NS.xlink, xlinkArcrole: NS.xlink, @@ -280,153 +285,14 @@ var SVGDOMPropertyConfig = { xmlLang: NS.xml, xmlSpace: NS.xml, }, - DOMAttributeNames: { - accentHeight: 'accent-height', - alignmentBaseline: 'alignment-baseline', - allowReorder: 'allowReorder', - arabicForm: 'arabic-form', - attributeName: 'attributeName', - attributeType: 'attributeType', - autoReverse: 'autoReverse', - baseFrequency: 'baseFrequency', - baselineShift: 'baseline-shift', - baseProfile: 'baseProfile', - calcMode: 'calcMode', - capHeight: 'cap-height', - clipPath: 'clip-path', - clipPathUnits: 'clipPathUnits', - clipRule: 'clip-rule', - colorInterpolation: 'color-interpolation', - colorInterpolationFilters: 'color-interpolation-filters', - colorProfile: 'color-profile', - colorRendering: 'color-rendering', - contentScriptType: 'contentScriptType', - contentStyleType: 'contentStyleType', - diffuseConstant: 'diffuseConstant', - dominantBaseline: 'dominant-baseline', - edgeMode: 'edgeMode', - enableBackground: 'enable-background', - externalResourcesRequired: 'externalResourcesRequired', - fillOpacity: 'fill-opacity', - fillRule: 'fill-rule', - filterRes: 'filterRes', - filterUnits: 'filterUnits', - floodColor: 'flood-color', - floodOpacity: 'flood-opacity', - fontFamily: 'font-family', - fontSize: 'font-size', - fontSizeAdjust: 'font-size-adjust', - fontStretch: 'font-stretch', - fontStyle: 'font-style', - fontVariant: 'font-variant', - fontWeight: 'font-weight', - glyphName: 'glyph-name', - glyphOrientationHorizontal: 'glyph-orientation-horizontal', - glyphOrientationVertical: 'glyph-orientation-vertical', - glyphRef: 'glyphRef', - gradientTransform: 'gradientTransform', - gradientUnits: 'gradientUnits', - horizAdvX: 'horiz-adv-x', - horizOriginX: 'horiz-origin-x', - imageRendering: 'image-rendering', - kernelMatrix: 'kernelMatrix', - kernelUnitLength: 'kernelUnitLength', - keyPoints: 'keyPoints', - keySplines: 'keySplines', - keyTimes: 'keyTimes', - lengthAdjust: 'lengthAdjust', - letterSpacing: 'letter-spacing', - lightingColor: 'lighting-color', - limitingConeAngle: 'limitingConeAngle', - markerEnd: 'marker-end', - markerHeight: 'markerHeight', - markerMid: 'marker-mid', - markerStart: 'marker-start', - markerUnits: 'markerUnits', - markerWidth: 'markerWidth', - maskContentUnits: 'maskContentUnits', - maskUnits: 'maskUnits', - numOctaves: 'numOctaves', - overlinePosition: 'overline-position', - overlineThickness: 'overline-thickness', - paintOrder: 'paint-order', - panose1: 'panose-1', - pathLength: 'pathLength', - patternContentUnits: 'patternContentUnits', - patternTransform: 'patternTransform', - patternUnits: 'patternUnits', - pointerEvents: 'pointer-events', - pointsAtX: 'pointsAtX', - pointsAtY: 'pointsAtY', - pointsAtZ: 'pointsAtZ', - preserveAlpha: 'preserveAlpha', - preserveAspectRatio: 'preserveAspectRatio', - primitiveUnits: 'primitiveUnits', - refX: 'refX', - refY: 'refY', - renderingIntent: 'rendering-intent', - repeatCount: 'repeatCount', - repeatDur: 'repeatDur', - requiredExtensions: 'requiredExtensions', - requiredFeatures: 'requiredFeatures', - shapeRendering: 'shape-rendering', - specularConstant: 'specularConstant', - specularExponent: 'specularExponent', - spreadMethod: 'spreadMethod', - startOffset: 'startOffset', - stdDeviation: 'stdDeviation', - stitchTiles: 'stitchTiles', - stopColor: 'stop-color', - stopOpacity: 'stop-opacity', - strikethroughPosition: 'strikethrough-position', - strikethroughThickness: 'strikethrough-thickness', - strokeDasharray: 'stroke-dasharray', - strokeDashoffset: 'stroke-dashoffset', - strokeLinecap: 'stroke-linecap', - strokeLinejoin: 'stroke-linejoin', - strokeMiterlimit: 'stroke-miterlimit', - strokeOpacity: 'stroke-opacity', - strokeWidth: 'stroke-width', - surfaceScale: 'surfaceScale', - systemLanguage: 'systemLanguage', - tableValues: 'tableValues', - targetX: 'targetX', - targetY: 'targetY', - textAnchor: 'text-anchor', - textDecoration: 'text-decoration', - textLength: 'textLength', - textRendering: 'text-rendering', - underlinePosition: 'underline-position', - underlineThickness: 'underline-thickness', - unicodeBidi: 'unicode-bidi', - unicodeRange: 'unicode-range', - unitsPerEm: 'units-per-em', - vAlphabetic: 'v-alphabetic', - vertAdvY: 'vert-adv-y', - vertOriginX: 'vert-origin-x', - vertOriginY: 'vert-origin-y', - vHanging: 'v-hanging', - vIdeographic: 'v-ideographic', - viewBox: 'viewBox', - viewTarget: 'viewTarget', - vMathematical: 'v-mathematical', - wordSpacing: 'word-spacing', - writingMode: 'writing-mode', - xChannelSelector: 'xChannelSelector', - xHeight: 'x-height', - xlinkActuate: 'xlink:actuate', - xlinkArcrole: 'xlink:arcrole', - xlinkHref: 'xlink:href', - xlinkRole: 'xlink:role', - xlinkShow: 'xlink:show', - xlinkTitle: 'xlink:title', - xlinkType: 'xlink:type', - xmlBase: 'xml:base', - xmlLang: 'xml:lang', - xmlSpace: 'xml:space', - yChannelSelector: 'yChannelSelector', - zoomAndPan: 'zoomAndPan', - }, + DOMAttributeNames: {}, }; +Object.keys(ATTRS).map((key) => { + SVGDOMPropertyConfig.Properties[key] = null; + if (ATTRS[key]) { + SVGDOMPropertyConfig.DOMAttributeNames[key] = ATTRS[key]; + } +}); + module.exports = SVGDOMPropertyConfig;