1
- import { regExpToken , tokens } from '../tokenTypes'
1
+ import { tokens } from '../tokenTypes'
2
+ import border from './border'
2
3
import boxShadow from './boxShadow'
3
4
import flex from './flex'
5
+ import flexFlow from './flexFlow'
4
6
import font from './font'
5
7
import fontFamily from './fontFamily'
6
8
import textShadow from './textShadow'
7
9
import textDecoration from './textDecoration'
8
10
import textDecorationLine from './textDecorationLine'
9
11
import transform from './transform'
10
- import { directionFactory , anyOrderFactory , shadowOffsetFactory } from './util'
12
+ import { directionFactory , parseShadowOffset } from './util'
11
13
12
14
const {
13
15
IDENT ,
@@ -20,21 +22,7 @@ const {
20
22
} = tokens
21
23
22
24
const 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 ) ,
38
26
} )
39
27
const borderColor = directionFactory ( {
40
28
types : [ WORD ] ,
@@ -52,20 +40,18 @@ const margin = directionFactory({
52
40
prefix : 'margin' ,
53
41
} )
54
42
const 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 ) ,
64
54
} )
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 ( )
69
55
70
56
export default {
71
57
background,
0 commit comments