1- import { regExpToken , tokens } from '../tokenTypes'
1+ import { tokens } from '../tokenTypes'
2+ import border from './border'
23import boxShadow from './boxShadow'
34import flex from './flex'
5+ import flexFlow from './flexFlow'
46import font from './font'
57import fontFamily from './fontFamily'
68import textShadow from './textShadow'
79import textDecoration from './textDecoration'
810import textDecorationLine from './textDecorationLine'
911import transform from './transform'
10- import { directionFactory , anyOrderFactory , shadowOffsetFactory } from './util'
12+ import { directionFactory , parseShadowOffset } from './util'
1113
1214const {
1315 IDENT ,
@@ -20,21 +22,7 @@ const {
2022} = tokens
2123
2224const background = tokenStream => ( {
23- $merge : { backgroundColor : tokenStream . expect ( COLOR ) } ,
24- } )
25- const border = anyOrderFactory ( {
26- borderWidth : {
27- tokens : [ LENGTH , UNSUPPORTED_LENGTH_UNIT ] ,
28- default : 1 ,
29- } ,
30- borderColor : {
31- tokens : [ COLOR ] ,
32- default : 'black' ,
33- } ,
34- borderStyle : {
35- tokens : [ regExpToken ( / ^ ( s o l i d | d a s h e d | d o t t e d ) $ / ) ] ,
36- default : 'solid' ,
37- } ,
25+ backgroundColor : tokenStream . expect ( COLOR ) ,
3826} )
3927const borderColor = directionFactory ( {
4028 types : [ WORD ] ,
@@ -52,20 +40,18 @@ const margin = directionFactory({
5240 prefix : 'margin' ,
5341} )
5442const padding = directionFactory ( { prefix : 'padding' } )
55- const flexFlow = anyOrderFactory ( {
56- flexWrap : {
57- tokens : [ regExpToken ( / ( n o w r a p | w r a p | w r a p - r e v e r s e ) / ) ] ,
58- default : 'nowrap' ,
59- } ,
60- flexDirection : {
61- tokens : [ regExpToken ( / ( r o w | r o w - r e v e r s e | c o l u m n | c o l u m n - r e v e r s e ) / ) ] ,
62- default : 'row' ,
63- } ,
43+ const fontVariant = tokenStream => ( {
44+ fontVariant : [ tokenStream . expect ( IDENT ) ] ,
45+ } )
46+ const fontWeight = tokenStream => ( {
47+ fontWeight : tokenStream . expect ( WORD ) , // Also match numbers as strings
48+ } )
49+ const shadowOffset = tokenStream => ( {
50+ shadowOffset : parseShadowOffset ( tokenStream ) ,
51+ } )
52+ const textShadowOffset = tokenStream => ( {
53+ textShadowOffset : parseShadowOffset ( tokenStream ) ,
6454} )
65- const fontVariant = tokenStream => [ tokenStream . expect ( IDENT ) ]
66- const fontWeight = tokenStream => tokenStream . expect ( WORD ) // Also match numbers as strings
67- const shadowOffset = shadowOffsetFactory ( )
68- const textShadowOffset = shadowOffsetFactory ( )
6955
7056export default {
7157 background,
0 commit comments