@@ -15,6 +15,122 @@ private[vdom] object VDomBuilder {
1515
1616 val attrTranslations =
1717 specialCaseAttrs.toList.map(x => x.toLowerCase -> x).toMap ++ specialNameAttrs
18+
19+ // May as well just copy Scalatags and customise
20+ // cat ~/crap/ReactStyles.scala | fgrep -- - | egrep -v '^ *\* ' | fgrep -v '= this :=' | perl -pe 's/^.+(".+").+(".+-.+").*$/GOL \2 -> \1,/' | grep GOL | cut -b4- | sort
21+ val styleTranslations = Map (
22+ " animation-delay" -> " animationDelay" ,
23+ " animation-direction" -> " animationDirection" ,
24+ " animation-duration" -> " animationDuration" ,
25+ " animation-fill-mode" -> " animationFillMode" ,
26+ " animation-iteration-count" -> " animationIterationCount" ,
27+ " animation-name" -> " animationName" ,
28+ " animation-play-state" -> " animationPlayState" ,
29+ " animation-timing-function" -> " animationTimingFunction" ,
30+ " backface-visibility" -> " backfaceVisibility" ,
31+ " background-attachment" -> " backgroundAttachment" ,
32+ " background-clip" -> " backgroundClip" ,
33+ " background-color" -> " backgroundColor" ,
34+ " background-image" -> " backgroundImage" ,
35+ " background-origin" -> " backgroundOrigin" ,
36+ " background-position" -> " backgroundPosition" ,
37+ " background-repeat" -> " backgroundRepeat" ,
38+ " background-size" -> " backgroundSize" ,
39+ " border-bottom" -> " borderBottom" ,
40+ " border-bottom-color" -> " borderBottomColor" ,
41+ " border-bottom-left-radius" -> " borderBottomLeftRadius" ,
42+ " border-bottom-right-radius" -> " borderBottomRightRadius" ,
43+ " border-bottom-style" -> " borderBottomStyle" ,
44+ " border-bottom-width" -> " borderBottomWidth" ,
45+ " border-collapse" -> " borderCollapse" ,
46+ " border-color" -> " borderColor" ,
47+ " border-left" -> " borderLeft" ,
48+ " border-left-color" -> " borderLeftColor" ,
49+ " border-left-style" -> " borderLeftStyle" ,
50+ " border-left-width" -> " borderLeftWidth" ,
51+ " border-radius" -> " borderRadius" ,
52+ " border-right" -> " borderRight" ,
53+ " border-right-color" -> " borderRightColor" ,
54+ " border-right-style" -> " bocrderRightStyle" ,
55+ " border-right-width" -> " borderRightWidth" ,
56+ " border-spacing" -> " borderSpacing" ,
57+ " border-style" -> " borderStyle" ,
58+ " border-top" -> " borderTop" ,
59+ " border-top-color" -> " borderTopColor" ,
60+ " border-top-left-radius" -> " borderTopLeftRadius" ,
61+ " border-top-right-radius" -> " borderTopRightRadius" ,
62+ " border-top-style" -> " borderTopStyle" ,
63+ " border-top-width" -> " borderTopWidth" ,
64+ " border-width" -> " borderWidth" ,
65+ " box-shadow" -> " boxShadow" ,
66+ " box-sizing" -> " boxSizing" ,
67+ " caption-side" -> " captionSide" ,
68+ " column-count" -> " columnCount" ,
69+ " column-fill" -> " columnFill" ,
70+ " column-gap" -> " columnGap" ,
71+ " column-rule-color" -> " columnRuleColor" ,
72+ " column-rule" -> " columnRule" ,
73+ " column-rule-style" -> " columnRuleStyle" ,
74+ " column-rule-width" -> " columnRuleWidth" ,
75+ " column-span" -> " columnSpan" ,
76+ " column-width" -> " columnWidth" ,
77+ " counter-increment" -> " counterIncrement" ,
78+ " counter-reset" -> " counterReset" ,
79+ " empty-cells" -> " emptyCells" ,
80+ " font-family" -> " fontFamily" ,
81+ " font-feature-settings" -> " fontFeatureSettings" ,
82+ " font-size-adjust" -> " fontSizeAdjust" ,
83+ " font-size" -> " fontSize" ,
84+ " font-style" -> " fontStyle" ,
85+ " font-weight" -> " fontWeight" ,
86+ " letter-spacing" -> " letterSpacing" ,
87+ " list-style-image" -> " listStyleImage" ,
88+ " list-style" -> " listStyle" ,
89+ " list-style-position" -> " listStylePosition" ,
90+ " list-style-type" -> " listStyleType" ,
91+ " margin-bottom" -> " marginBottom" ,
92+ " margin-left" -> " marginLeft" ,
93+ " margin-right" -> " marginRight" ,
94+ " margin-top" -> " marginTop" ,
95+ " max-height" -> " maxHeight" ,
96+ " max-width" -> " maxWidth" ,
97+ " min-height" -> " minHeight" ,
98+ " outline-color" -> " outlineColor" ,
99+ " outline-style" -> " outlineStyle" ,
100+ " outline-width" -> " outlineWidth" ,
101+ " overflow-x" -> " overflowX" ,
102+ " overflow-y" -> " overflowY" ,
103+ " padding-bottom" -> " paddingBottom" ,
104+ " padding-left" -> " paddingLeft" ,
105+ " padding-right" -> " paddingRight" ,
106+ " padding-top" -> " paddingTop" ,
107+ " page-break-after" -> " pageBreakAfter" ,
108+ " page-break-before" -> " pageBreakBefore" ,
109+ " page-break-inside" -> " pageBreakInside" ,
110+ " perspective-origin" -> " perspectiveOrigin" ,
111+ " pointer-events" -> " pointerEvents" ,
112+ " table-layout" -> " tableLayout" ,
113+ " text-align-last" -> " textAlignLast" ,
114+ " text-align" -> " textAlign" ,
115+ " text-decoration" -> " textDecoration" ,
116+ " text-indent" -> " textIndent" ,
117+ " text-overflow" -> " textOverflow" ,
118+ " text-shadow" -> " textShadow" ,
119+ " text-transform" -> " textTransform" ,
120+ " text-underline-position" -> " textUnderlinePosition" ,
121+ " transform-origin" -> " transformOrigin" ,
122+ " transform-style" -> " transformStyle" ,
123+ " transition-delay" -> " transitionDelay" ,
124+ " transition-duration" -> " transitionDuration" ,
125+ " transition-property" -> " transitionProperty" ,
126+ " transition-timing-function" -> " transitionTimingFunction" ,
127+ " unicode-bidi" -> " unicodeBidi" ,
128+ " vertical-align" -> " verticalAlign" ,
129+ " white-space" -> " whiteSpace" ,
130+ " word-break" -> " wordBreak" ,
131+ " word-spacing" -> " wordSpacing" ,
132+ " word-wrap" -> " wordWrap" ,
133+ " z-index" -> " zIndex" )
18134}
19135
20136private [vdom] final class VDomBuilder {
@@ -31,7 +147,7 @@ private[vdom] final class VDomBuilder {
31147 set(props, attrTranslations.getOrElse(k, k), v)
32148
33149 def addStyle (k : String , v : String ): Unit =
34- set(style, k , v)
150+ set(style, styleTranslations.getOrElse(k, k) , v)
35151
36152 @ inline private [this ] def set (o : js.Object , k : String , v : js.Any ): Unit =
37153 o.asInstanceOf [js.Dynamic ].updateDynamic(k)(v)
0 commit comments