-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmixins.styl
120 lines (101 loc) · 2.12 KB
/
mixins.styl
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
pos(type, a, b = false, c = false, d = false)
position type
if a b c d
top a
right b
bottom c
left d
else if a b
top a
bottom a
right b
left b
else
top a
right a
bottom a
left a
min-size(a, b = false)
min-width a
if b
min-height b
else
min-height a
apply-borders(sides, width, color, style)
if not width
width = 1px
if not color
color = #000
if not style
style = solid
if sides
for side in sides
if side
border-{side} width color style
else
if length(width) > 1 or length(color) > 1 or length(style) > 1
border-width width
border-color color
border-style style
else
border width color style
sides = top right bottom left
border-styles = solid dashed dotted double groove ridge inset outset inherit
borders()
this-sides = false
this-width = false
this-color = false
this-style = false
for arg in arguments
if arg is a 'unit'
if this-width
push(this-width, arg)
else
this-width = arg
else if arg is a 'color' or arg == 'transparent'
if this-color
push(this-color, arg)
else
this-color = arg
else if arg in border-styles
if this-style
push(this-style, arg)
else
this-style = arg
else if arg in sides
// Aply border & reset border-side
if this-width or this-color or this-style
apply-borders this-sides this-width this-color this-style
this-width = false
this-color = false
this-style = false
this-sides = false
if this-sides
push(this-sides, arg)
else
this-sides = arg
apply-borders this-sides this-width this-color this-style
size(a, b = false)
width a
if b
height b
else
height a
block(a, b = false)
size a b
display block
inline-block(a, b = false)
size a b
display inline-block
type()
for arg in arguments
if arg is a 'color'
color arg
else if arg is a 'unit'
font-size arg
else if arg in alignment
text-align arg
reset()
padding 0
margin 0
border 0