-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathproperties.v
137 lines (121 loc) · 3.09 KB
/
properties.v
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
module css
import css.datatypes
const zero_px = datatypes.Length{
amount: 0
unit: .px
}
// collection of properties listed here:
// https://developer.mozilla.org/en-US/docs/Web/CSS/background
pub struct Background {
pub mut:
color ?ColorValue
image ?Image
}
// collection of properties listed here:
// https://developer.mozilla.org/en-US/docs/Web/CSS/border
pub struct Border {
pub mut:
collapse Keyword = 'separate'
colors BorderColors
styles BorderStyles
widths FourDimensions
radius BorderRadius
}
// used for shorthand properties of border-bottom, border-left etc.
pub struct SingleBorder {
pub mut:
color ?ColorValue
style BorderLineStyle = datatypes.LineStyle.@none
width DimensionValue = css.zero_px
}
// border-color
pub struct BorderColors {
pub mut:
top ?ColorValue
right ?ColorValue
bottom ?ColorValue
left ?ColorValue
}
// border-style
pub struct BorderStyles {
pub mut:
top BorderLineStyle = datatypes.LineStyle.@none
right BorderLineStyle = datatypes.LineStyle.@none
bottom BorderLineStyle = datatypes.LineStyle.@none
left BorderLineStyle = datatypes.LineStyle.@none
}
// border-radius
pub struct BorderRadius {
pub mut:
top_left SingleBorderRadius = []DimensionValue{len: 2, init: css.zero_px}
top_right SingleBorderRadius = []DimensionValue{len: 2, init: css.zero_px}
bottom_right SingleBorderRadius = []DimensionValue{len: 2, init: css.zero_px}
bottom_left SingleBorderRadius = []DimensionValue{len: 2, init: css.zero_px}
}
// border-top-left-radius
pub type SingleBorderRadius = []DimensionValue
// For properties like `margin` and `padding` that can have 4 dimensions values
// https://developer.mozilla.org/en-US/docs/Web/CSS/margin
pub struct FourDimensions {
pub mut:
top DimensionValue = css.zero_px
right DimensionValue = css.zero_px
bottom DimensionValue = css.zero_px
left DimensionValue = css.zero_px
}
pub struct Font {
pub mut:
family FontFamily
size DimensionValue = datatypes.Length{
amount: 16
unit: .px
}
stretch FontStretch
style Keyword = Keyword('normal')
weight FontWeight = 400
}
pub struct Text {
pub mut:
align ?string
align_last ?string
combine_upright ?TextCombineUpright
// decoration
// emphasis
indent ?DimensionValue
justify ?string
orientation ?string
overflow ?TextOverflow
rendering ?string
shadow []Shadow
transform ?string
wrap ?string
}
pub struct Shadow {
pub mut:
offset_x DimensionValue
offset_y DimensionValue
blur_radius DimensionValue = css.zero_px
spread_radius DimensionValue = css.zero_px
inset bool
color ColorValue
}
pub struct Overflow {
pub mut:
overflow_x Keyword = 'visible'
overflow_y Keyword = 'visible'
}
pub struct FlexBox {
pub mut:
basis DimensionValue = Keyword('auto')
direction FlexDirection = datatypes.FlexDirectionKind.row
// negative numbers are invalid
grow FlexSize = 0.0
// negative numbers are invalid
shrink FlexSize = 1.0
wrap FlexWrap = datatypes.FlexWrapKind.nowrap
}
pub struct Gap {
pub mut:
row DimensionValue = css.zero_px
column DimensionValue = css.zero_px
}