-
-
Notifications
You must be signed in to change notification settings - Fork 389
Expand file tree
/
Copy pathprops.js
More file actions
241 lines (226 loc) · 5.22 KB
/
props.js
File metadata and controls
241 lines (226 loc) · 5.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/**
* A scheme for converting properties from array to regular style.
* All properties listed below will be transformed to a string separated by space.
*/
export const propArray = {
background: true,
'background-size': true,
'background-position': true,
border: true,
'border-bottom': true,
'border-left': true,
'border-top': true,
'border-right': true,
'border-radius': true,
'border-image': true,
'border-width': true,
'border-style': true,
'border-color': true,
'box-shadow': true,
flex: true,
margin: true,
padding: true,
outline: true,
'transform-origin': true,
transform: true,
transition: true
}
/**
* A scheme for converting arrays to regular styles inside of objects.
* For e.g.: "{position: [0, 0]}" => "background-position: 0 0;".
*/
export const propArrayInObj = {
position: true, // background-position
size: true // background-size
}
/**
* A scheme for parsing and building correct styles from passed objects.
*/
export const propObj = {
padding: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
margin: {
top: 0,
right: 0,
bottom: 0,
left: 0
},
background: {
image: null,
position: null,
size: null,
repeat: null,
attachment: null,
origin: null,
clip: null,
color: null,
'blend-mode': null,
blendMode: null,
},
border: {
width: null,
style: null,
color: null
},
'border-top': {
width: null,
style: null,
color: null
},
'border-right': {
width: null,
style: null,
color: null
},
'border-bottom': {
width: null,
style: null,
color: null
},
'border-left': {
width: null,
style: null,
color: null
},
outline: {
width: null,
style: null,
color: null
},
'list-style': {
type: null,
position: null,
image: null
},
transition: {
property: null,
duration: null,
'timing-function': null,
timingFunction: null, // Needed for avoiding comilation issues with jss-plugin-camel-case
delay: null
},
animation: {
name: null,
duration: null,
'timing-function': null,
timingFunction: null, // Needed to avoid compilation issues with jss-plugin-camel-case
delay: null,
'iteration-count': null,
iterationCount: null, // Needed to avoid compilation issues with jss-plugin-camel-case
direction: null,
'fill-mode': null,
fillMode: null, // Needed to avoid compilation issues with jss-plugin-camel-case
'play-state': null,
playState: null // Needed to avoid compilation issues with jss-plugin-camel-case
},
'box-shadow': {
x: 0,
y: 0,
blur: 0,
spread: 0,
color: null,
inset: null
},
'text-shadow': {
x: 0,
y: 0,
blur: null,
color: null
}
}
/**
* A scheme for converting non-standart properties inside object.
* For e.g.: include 'border-radius' property inside 'border' object.
*/
export const customPropObj = {
border: {
radius: 'border-radius',
image: 'border-image',
width: 'border-width',
style: 'border-style',
color: 'border-color'
},
'border-bottom': {
width: 'border-bottom-width',
style: 'border-bottom-style',
color: 'border-bottom-color'
},
'border-top': {
width: 'border-top-width',
style: 'border-top-style',
color: 'border-top-color'
},
'border-left': {
width: 'border-left-width',
style: 'border-left-style',
color: 'border-left-color'
},
'border-right': {
width: 'border-right-width',
style: 'border-right-style',
color: 'border-right-color'
},
background: {
blendMode: "background-blend-mode",
"blend-mode": "background-blend-mode",
color: "background-color",
},
font: {
style: 'font-style',
variant: 'font-variant',
weight: 'font-weight',
stretch: 'font-stretch',
size: 'font-size',
family: 'font-family',
lineHeight: 'line-height', // Needed to avoid compilation issues with jss-plugin-camel-case
'line-height': 'line-height'
},
flex: {
grow: 'flex-grow',
basis: 'flex-basis',
direction: 'flex-direction',
wrap: 'flex-wrap',
flow: 'flex-flow',
shrink: 'flex-shrink'
},
align: {
self: 'align-self',
items: 'align-items',
content: 'align-content'
},
grid: {
'template-columns': 'grid-template-columns',
templateColumns: 'grid-template-columns',
'template-rows': 'grid-template-rows',
templateRows: 'grid-template-rows',
'template-areas': 'grid-template-areas',
templateAreas: 'grid-template-areas',
template: 'grid-template',
'auto-columns': 'grid-auto-columns',
autoColumns: 'grid-auto-columns',
'auto-rows': 'grid-auto-rows',
autoRows: 'grid-auto-rows',
'auto-flow': 'grid-auto-flow',
autoFlow: 'grid-auto-flow',
row: 'grid-row',
column: 'grid-column',
'row-start': 'grid-row-start',
rowStart: 'grid-row-start',
'row-end': 'grid-row-end',
rowEnd: 'grid-row-end',
'column-start': 'grid-column-start',
columnStart: 'grid-column-start',
'column-end': 'grid-column-end',
columnEnd: 'grid-column-end',
area: 'grid-area',
gap: 'grid-gap',
'row-gap': 'grid-row-gap',
rowGap: 'grid-row-gap',
'column-gap': 'grid-column-gap',
columnGap: 'grid-column-gap'
}
}