rn-css 1.6.12 → 1.6.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cssToRN/convert.js +159 -1
- package/package.json +1 -1
- package/src/cssToRN/convert.ts +158 -1
package/dist/cssToRN/convert.js
CHANGED
|
@@ -89,8 +89,9 @@ function placeContent(value) {
|
|
|
89
89
|
exports.placeContent = placeContent;
|
|
90
90
|
function background(value) {
|
|
91
91
|
const values = value.split(/\s+/mg);
|
|
92
|
+
const color = values.pop();
|
|
92
93
|
// The background-color is the only one that we support and it's the last value
|
|
93
|
-
return { backgroundColor:
|
|
94
|
+
return { backgroundColor: isColor(color) ? color : 'transparent' };
|
|
94
95
|
}
|
|
95
96
|
exports.background = background;
|
|
96
97
|
function textDecoration(value) {
|
|
@@ -212,3 +213,160 @@ function cornerValue(prefixKey, value, postFix) {
|
|
|
212
213
|
};
|
|
213
214
|
}
|
|
214
215
|
exports.cornerValue = cornerValue;
|
|
216
|
+
function isColor(value) {
|
|
217
|
+
if (!value)
|
|
218
|
+
return false;
|
|
219
|
+
if (value.startsWith('#') || value.startsWith('rgb') || value.startsWith('hsl'))
|
|
220
|
+
return true;
|
|
221
|
+
const CSS_COLOR_NAMES = [
|
|
222
|
+
'aliceblue',
|
|
223
|
+
'antiquewhite',
|
|
224
|
+
'aqua',
|
|
225
|
+
'aquamarine',
|
|
226
|
+
'azure',
|
|
227
|
+
'beige',
|
|
228
|
+
'bisque',
|
|
229
|
+
'black',
|
|
230
|
+
'blanchedalmond',
|
|
231
|
+
'blue',
|
|
232
|
+
'blueviolet',
|
|
233
|
+
'brown',
|
|
234
|
+
'burlywood',
|
|
235
|
+
'cadetblue',
|
|
236
|
+
'chartreuse',
|
|
237
|
+
'chocolate',
|
|
238
|
+
'coral',
|
|
239
|
+
'cornflowerblue',
|
|
240
|
+
'cornsilk',
|
|
241
|
+
'crimson',
|
|
242
|
+
'cyan',
|
|
243
|
+
'darkblue',
|
|
244
|
+
'darkcyan',
|
|
245
|
+
'darkgoldenrod',
|
|
246
|
+
'darkgray',
|
|
247
|
+
'darkgrey',
|
|
248
|
+
'darkgreen',
|
|
249
|
+
'darkkhaki',
|
|
250
|
+
'darkmagenta',
|
|
251
|
+
'darkolivegreen',
|
|
252
|
+
'darkorange',
|
|
253
|
+
'darkorchid',
|
|
254
|
+
'darkred',
|
|
255
|
+
'darksalmon',
|
|
256
|
+
'darkseagreen',
|
|
257
|
+
'darkslateblue',
|
|
258
|
+
'darkslategray',
|
|
259
|
+
'darkslategrey',
|
|
260
|
+
'darkturquoise',
|
|
261
|
+
'darkviolet',
|
|
262
|
+
'deeppink',
|
|
263
|
+
'deepskyblue',
|
|
264
|
+
'dimgray',
|
|
265
|
+
'dimgrey',
|
|
266
|
+
'dodgerblue',
|
|
267
|
+
'firebrick',
|
|
268
|
+
'floralwhite',
|
|
269
|
+
'forestgreen',
|
|
270
|
+
'fuchsia',
|
|
271
|
+
'gainsboro',
|
|
272
|
+
'ghostwhite',
|
|
273
|
+
'gold',
|
|
274
|
+
'goldenrod',
|
|
275
|
+
'gray',
|
|
276
|
+
'grey',
|
|
277
|
+
'green',
|
|
278
|
+
'greenyellow',
|
|
279
|
+
'honeydew',
|
|
280
|
+
'hotpink',
|
|
281
|
+
'indianred',
|
|
282
|
+
'indigo',
|
|
283
|
+
'ivory',
|
|
284
|
+
'khaki',
|
|
285
|
+
'lavender',
|
|
286
|
+
'lavenderblush',
|
|
287
|
+
'lawngreen',
|
|
288
|
+
'lemonchiffon',
|
|
289
|
+
'lightblue',
|
|
290
|
+
'lightcoral',
|
|
291
|
+
'lightcyan',
|
|
292
|
+
'lightgoldenrodyellow',
|
|
293
|
+
'lightgray',
|
|
294
|
+
'lightgrey',
|
|
295
|
+
'lightgreen',
|
|
296
|
+
'lightpink',
|
|
297
|
+
'lightsalmon',
|
|
298
|
+
'lightseagreen',
|
|
299
|
+
'lightskyblue',
|
|
300
|
+
'lightslategray',
|
|
301
|
+
'lightslategrey',
|
|
302
|
+
'lightsteelblue',
|
|
303
|
+
'lightyellow',
|
|
304
|
+
'lime',
|
|
305
|
+
'limegreen',
|
|
306
|
+
'linen',
|
|
307
|
+
'magenta',
|
|
308
|
+
'maroon',
|
|
309
|
+
'mediumaquamarine',
|
|
310
|
+
'mediumblue',
|
|
311
|
+
'mediumorchid',
|
|
312
|
+
'mediumpurple',
|
|
313
|
+
'mediumseagreen',
|
|
314
|
+
'mediumslateblue',
|
|
315
|
+
'mediumspringgreen',
|
|
316
|
+
'mediumturquoise',
|
|
317
|
+
'mediumvioletred',
|
|
318
|
+
'midnightblue',
|
|
319
|
+
'mintcream',
|
|
320
|
+
'mistyrose',
|
|
321
|
+
'moccasin',
|
|
322
|
+
'navajowhite',
|
|
323
|
+
'navy',
|
|
324
|
+
'oldlace',
|
|
325
|
+
'olive',
|
|
326
|
+
'olivedrab',
|
|
327
|
+
'orange',
|
|
328
|
+
'orangered',
|
|
329
|
+
'orchid',
|
|
330
|
+
'palegoldenrod',
|
|
331
|
+
'palegreen',
|
|
332
|
+
'paleturquoise',
|
|
333
|
+
'palevioletred',
|
|
334
|
+
'papayawhip',
|
|
335
|
+
'peachpuff',
|
|
336
|
+
'peru',
|
|
337
|
+
'pink',
|
|
338
|
+
'plum',
|
|
339
|
+
'powderblue',
|
|
340
|
+
'purple',
|
|
341
|
+
'rebeccapurple',
|
|
342
|
+
'red',
|
|
343
|
+
'rosybrown',
|
|
344
|
+
'royalblue',
|
|
345
|
+
'saddlebrown',
|
|
346
|
+
'salmon',
|
|
347
|
+
'sandybrown',
|
|
348
|
+
'seagreen',
|
|
349
|
+
'seashell',
|
|
350
|
+
'sienna',
|
|
351
|
+
'silver',
|
|
352
|
+
'skyblue',
|
|
353
|
+
'slateblue',
|
|
354
|
+
'slategray',
|
|
355
|
+
'slategrey',
|
|
356
|
+
'snow',
|
|
357
|
+
'springgreen',
|
|
358
|
+
'steelblue',
|
|
359
|
+
'tan',
|
|
360
|
+
'teal',
|
|
361
|
+
'thistle',
|
|
362
|
+
'tomato',
|
|
363
|
+
'turquoise',
|
|
364
|
+
'violet',
|
|
365
|
+
'wheat',
|
|
366
|
+
'white',
|
|
367
|
+
'whitesmoke',
|
|
368
|
+
'yellow',
|
|
369
|
+
'yellowgreen'
|
|
370
|
+
];
|
|
371
|
+
return CSS_COLOR_NAMES.includes(value);
|
|
372
|
+
}
|
package/package.json
CHANGED
package/src/cssToRN/convert.ts
CHANGED
|
@@ -77,8 +77,9 @@ export function placeContent (value: string) {
|
|
|
77
77
|
|
|
78
78
|
export function background (value: string) {
|
|
79
79
|
const values = value.split(/\s+/mg)
|
|
80
|
+
const color = values.pop()
|
|
80
81
|
// The background-color is the only one that we support and it's the last value
|
|
81
|
-
return { backgroundColor:
|
|
82
|
+
return { backgroundColor: isColor(color) ? color : 'transparent' }
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
export function textDecoration (value: string) {
|
|
@@ -184,3 +185,159 @@ export function cornerValue (prefixKey: 'border', value: string, postFix: 'Radiu
|
|
|
184
185
|
[prefixKey + 'BottomRight' + postFix]: bottomRight
|
|
185
186
|
}
|
|
186
187
|
}
|
|
188
|
+
|
|
189
|
+
function isColor (value?: string) {
|
|
190
|
+
if (!value) return false
|
|
191
|
+
if (value.startsWith('#') || value.startsWith('rgb') || value.startsWith('hsl')) return true
|
|
192
|
+
const CSS_COLOR_NAMES = [
|
|
193
|
+
'aliceblue',
|
|
194
|
+
'antiquewhite',
|
|
195
|
+
'aqua',
|
|
196
|
+
'aquamarine',
|
|
197
|
+
'azure',
|
|
198
|
+
'beige',
|
|
199
|
+
'bisque',
|
|
200
|
+
'black',
|
|
201
|
+
'blanchedalmond',
|
|
202
|
+
'blue',
|
|
203
|
+
'blueviolet',
|
|
204
|
+
'brown',
|
|
205
|
+
'burlywood',
|
|
206
|
+
'cadetblue',
|
|
207
|
+
'chartreuse',
|
|
208
|
+
'chocolate',
|
|
209
|
+
'coral',
|
|
210
|
+
'cornflowerblue',
|
|
211
|
+
'cornsilk',
|
|
212
|
+
'crimson',
|
|
213
|
+
'cyan',
|
|
214
|
+
'darkblue',
|
|
215
|
+
'darkcyan',
|
|
216
|
+
'darkgoldenrod',
|
|
217
|
+
'darkgray',
|
|
218
|
+
'darkgrey',
|
|
219
|
+
'darkgreen',
|
|
220
|
+
'darkkhaki',
|
|
221
|
+
'darkmagenta',
|
|
222
|
+
'darkolivegreen',
|
|
223
|
+
'darkorange',
|
|
224
|
+
'darkorchid',
|
|
225
|
+
'darkred',
|
|
226
|
+
'darksalmon',
|
|
227
|
+
'darkseagreen',
|
|
228
|
+
'darkslateblue',
|
|
229
|
+
'darkslategray',
|
|
230
|
+
'darkslategrey',
|
|
231
|
+
'darkturquoise',
|
|
232
|
+
'darkviolet',
|
|
233
|
+
'deeppink',
|
|
234
|
+
'deepskyblue',
|
|
235
|
+
'dimgray',
|
|
236
|
+
'dimgrey',
|
|
237
|
+
'dodgerblue',
|
|
238
|
+
'firebrick',
|
|
239
|
+
'floralwhite',
|
|
240
|
+
'forestgreen',
|
|
241
|
+
'fuchsia',
|
|
242
|
+
'gainsboro',
|
|
243
|
+
'ghostwhite',
|
|
244
|
+
'gold',
|
|
245
|
+
'goldenrod',
|
|
246
|
+
'gray',
|
|
247
|
+
'grey',
|
|
248
|
+
'green',
|
|
249
|
+
'greenyellow',
|
|
250
|
+
'honeydew',
|
|
251
|
+
'hotpink',
|
|
252
|
+
'indianred',
|
|
253
|
+
'indigo',
|
|
254
|
+
'ivory',
|
|
255
|
+
'khaki',
|
|
256
|
+
'lavender',
|
|
257
|
+
'lavenderblush',
|
|
258
|
+
'lawngreen',
|
|
259
|
+
'lemonchiffon',
|
|
260
|
+
'lightblue',
|
|
261
|
+
'lightcoral',
|
|
262
|
+
'lightcyan',
|
|
263
|
+
'lightgoldenrodyellow',
|
|
264
|
+
'lightgray',
|
|
265
|
+
'lightgrey',
|
|
266
|
+
'lightgreen',
|
|
267
|
+
'lightpink',
|
|
268
|
+
'lightsalmon',
|
|
269
|
+
'lightseagreen',
|
|
270
|
+
'lightskyblue',
|
|
271
|
+
'lightslategray',
|
|
272
|
+
'lightslategrey',
|
|
273
|
+
'lightsteelblue',
|
|
274
|
+
'lightyellow',
|
|
275
|
+
'lime',
|
|
276
|
+
'limegreen',
|
|
277
|
+
'linen',
|
|
278
|
+
'magenta',
|
|
279
|
+
'maroon',
|
|
280
|
+
'mediumaquamarine',
|
|
281
|
+
'mediumblue',
|
|
282
|
+
'mediumorchid',
|
|
283
|
+
'mediumpurple',
|
|
284
|
+
'mediumseagreen',
|
|
285
|
+
'mediumslateblue',
|
|
286
|
+
'mediumspringgreen',
|
|
287
|
+
'mediumturquoise',
|
|
288
|
+
'mediumvioletred',
|
|
289
|
+
'midnightblue',
|
|
290
|
+
'mintcream',
|
|
291
|
+
'mistyrose',
|
|
292
|
+
'moccasin',
|
|
293
|
+
'navajowhite',
|
|
294
|
+
'navy',
|
|
295
|
+
'oldlace',
|
|
296
|
+
'olive',
|
|
297
|
+
'olivedrab',
|
|
298
|
+
'orange',
|
|
299
|
+
'orangered',
|
|
300
|
+
'orchid',
|
|
301
|
+
'palegoldenrod',
|
|
302
|
+
'palegreen',
|
|
303
|
+
'paleturquoise',
|
|
304
|
+
'palevioletred',
|
|
305
|
+
'papayawhip',
|
|
306
|
+
'peachpuff',
|
|
307
|
+
'peru',
|
|
308
|
+
'pink',
|
|
309
|
+
'plum',
|
|
310
|
+
'powderblue',
|
|
311
|
+
'purple',
|
|
312
|
+
'rebeccapurple',
|
|
313
|
+
'red',
|
|
314
|
+
'rosybrown',
|
|
315
|
+
'royalblue',
|
|
316
|
+
'saddlebrown',
|
|
317
|
+
'salmon',
|
|
318
|
+
'sandybrown',
|
|
319
|
+
'seagreen',
|
|
320
|
+
'seashell',
|
|
321
|
+
'sienna',
|
|
322
|
+
'silver',
|
|
323
|
+
'skyblue',
|
|
324
|
+
'slateblue',
|
|
325
|
+
'slategray',
|
|
326
|
+
'slategrey',
|
|
327
|
+
'snow',
|
|
328
|
+
'springgreen',
|
|
329
|
+
'steelblue',
|
|
330
|
+
'tan',
|
|
331
|
+
'teal',
|
|
332
|
+
'thistle',
|
|
333
|
+
'tomato',
|
|
334
|
+
'turquoise',
|
|
335
|
+
'violet',
|
|
336
|
+
'wheat',
|
|
337
|
+
'white',
|
|
338
|
+
'whitesmoke',
|
|
339
|
+
'yellow',
|
|
340
|
+
'yellowgreen'
|
|
341
|
+
]
|
|
342
|
+
return CSS_COLOR_NAMES.includes(value)
|
|
343
|
+
}
|