0 | module Text.CSS.Property
5 | import Text.CSS.Angle
6 | import Text.CSS.Color
8 | import Text.CSS.Flexbox
10 | import Text.CSS.Length
11 | import Text.CSS.ListStyleType
12 | import Text.CSS.Percentage
18 | data BoxSizing = BorderBox | ContentBox
21 | Interpolation BoxSizing where
22 | interpolate BorderBox = "border-box"
23 | interpolate ContentBox = "content-box"
25 | namespace ContainerType
27 | data ContainerType : Type where
28 | Normal : ContainerType
29 | Size : ContainerType
30 | InlineSize : ContainerType
31 | ScrollState : ContainerType
32 | ScrollStateSize : ContainerType
33 | ScrollStateInlineSize : ContainerType
34 | Anchored : ContainerType
37 | Interpolation ContainerType where
38 | interpolate Normal = "normal"
39 | interpolate Size = "size"
40 | interpolate InlineSize = "inline-size"
41 | interpolate ScrollState = "scroll-state"
42 | interpolate ScrollStateSize = "scroll-state size"
43 | interpolate ScrollStateInlineSize = "scroll-state inline-size"
44 | interpolate Anchored = "anchor"
48 | data Direction = LTR | RTL
51 | Interpolation Direction where
52 | interpolate LTR = "ltr"
53 | interpolate RTL = "rtl"
57 | data Display : Type where
61 | Area : {0 n,m : Nat}
63 | -> {auto as : Show a}
64 | -> (rows : Vect (S m) GridValue)
65 | -> (columns : Vect (S n) GridValue)
66 | -> (area : Vect (S m) (Vect (S n) a))
70 | showTag : Show a => a -> String
76 | col : Show a => Vect (S n) a -> String
78 | let s := concat . intersperse " " . map showTag $
toList vs
84 | -> Vect (S m) GridValue
85 | -> Vect (S n) GridValue
86 | -> Vect (S m) (Vect (S n) a)
88 | renderArea rs cs as =
89 | let rsStr := "grid-template-rows: \{toList rs}"
90 | csStr := "grid-template-columns: \{toList cs}"
91 | aStr := fastConcat . intersperse " " . map col $
toList as
92 | in "display: grid; \{rsStr}; \{csStr}; grid-template-areas: \{aStr}"
96 | data FlexBasis : Type where
97 | FL : Length -> FlexBasis
98 | FP : Percentage -> FlexBasis
101 | Interpolation FlexBasis where
102 | interpolate (FL x) = interpolate x
103 | interpolate (FP x) = interpolate x
106 | Cast Length FlexBasis where
110 | Cast Percentage FlexBasis where
115 | data FontSize : Type where
116 | FL : Length -> FontSize
117 | FP : Percentage -> FontSize
125 | XXXLarge : FontSize
128 | Interpolation FontSize where
129 | interpolate (FL x) = interpolate x
130 | interpolate (FP x) = interpolate x
131 | interpolate XXSmall = "xx-small"
132 | interpolate XSmall = "x-small"
133 | interpolate Small = "small"
134 | interpolate Medium = "medium"
135 | interpolate Large = "large"
136 | interpolate XLarge = "x-large"
137 | interpolate XXLarge = "xx-large"
138 | interpolate XXXLarge = "xxx-large"
141 | Cast Length FontSize where
145 | Cast Percentage FontSize where
148 | namespace FontWeight
150 | data FontWeight : Type where
151 | Normal : FontWeight
153 | Lighter : FontWeight
154 | Bolder : FontWeight
166 | Interpolation FontWeight where
167 | interpolate Normal = "normal"
168 | interpolate Bold = "bold"
169 | interpolate Lighter = "lighter"
170 | interpolate Bolder = "bolder"
171 | interpolate FW100 = "100"
172 | interpolate FW200 = "200"
173 | interpolate FW300 = "300"
174 | interpolate FW400 = "400"
175 | interpolate FW500 = "500"
176 | interpolate FW600 = "600"
177 | interpolate FW700 = "700"
178 | interpolate FW800 = "800"
179 | interpolate FW900 = "900"
181 | namespace FontStyle
183 | data FontStyle : Type where
186 | Oblique_ : FontStyle
187 | Oblique : Angle -> FontStyle
190 | Interpolation FontStyle where
191 | interpolate Normal = "normal"
192 | interpolate Italic = "italic"
193 | interpolate Oblique_ = "oblique"
194 | interpolate (Oblique x) = "oblique \{x}"
197 | namespace BorderRadius
199 | data BorderRadius : Type where
200 | BL : Length -> BorderRadius
201 | BP : Percentage -> BorderRadius
202 | BS : String -> BorderRadius
205 | Interpolation BorderRadius where
206 | interpolate (BL x) = interpolate x
207 | interpolate (BP x) = interpolate x
208 | interpolate (BS x) = x
211 | Cast Length BorderRadius where
215 | Cast Percentage BorderRadius where
219 | FromString BorderRadius where
222 | namespace BorderStyle
224 | data BorderStyle : Type where
226 | Hidden : BorderStyle
227 | Dotted : BorderStyle
228 | Dashed : BorderStyle
229 | Solid : BorderStyle
231 | Groove : BorderStyle
232 | Ridge : BorderStyle
233 | Inset : BorderStyle
234 | Outset : BorderStyle
238 | Interpolation BorderStyle where
239 | interpolate None = "none"
240 | interpolate Hidden = "hidden"
241 | interpolate Dotted = "dotted"
242 | interpolate Dashed = "dashed"
243 | interpolate Solid = "solid"
244 | interpolate Dbl = "double"
245 | interpolate Groove = "groove"
246 | interpolate Ridge = "ridge"
247 | interpolate Inset = "inset"
248 | interpolate Outset = "outset"
250 | namespace BorderWidth
252 | data BorderWidth : Type where
253 | BL : Length -> BorderWidth
255 | Medium : BorderWidth
256 | Thick : BorderWidth
259 | Interpolation BorderWidth where
260 | interpolate (BL x) = interpolate x
261 | interpolate Thin = "thin"
262 | interpolate Medium = "medium"
263 | interpolate Thick = "thick"
266 | Cast Length BorderWidth where
271 | data Linecap : Type where
277 | Interpolation Linecap where
278 | interpolate Butt = "butt"
279 | interpolate Round = "round"
280 | interpolate Square = "square"
284 | data Linejoin : Type where
290 | Interpolation Linejoin where
291 | interpolate Bevel = "bevel"
292 | interpolate Miter = "miter"
293 | interpolate Round = "round"
295 | namespace LineHeight
297 | data LineHeight : Type where
298 | Normal : LineHeight
299 | LHD : Double -> LineHeight
300 | LHL : Length -> LineHeight
301 | LHP : Percentage -> LineHeight
304 | Interpolation LineHeight where
305 | interpolate Normal = "normal"
306 | interpolate (LHD x) = show x
307 | interpolate (LHL x) = interpolate x
308 | interpolate (LHP x) = interpolate x
311 | Cast Length LineHeight where
315 | Cast Percentage LineHeight where
319 | fromInteger : Integer -> LineHeight
320 | fromInteger = LHD . cast
323 | FromDouble LineHeight where
333 | data Overflow : Type where
359 | Interpolation Overflow where
360 | interpolate Visible = "visible"
361 | interpolate Hidden = "hidden"
362 | interpolate Clip = "clip"
363 | interpolate Scroll = "scroll"
364 | interpolate Auto = "auto"
368 | data Ratio : Type where
370 | RD : Double -> Ratio
371 | RDD : Double -> Double -> Ratio
374 | Interpolation Ratio where
375 | interpolate Auto = "auto"
376 | interpolate (RD x) = show x
377 | interpolate (RDD x y) = "\{show x}/\{show y}"
380 | fromInteger : Integer -> Ratio
381 | fromInteger = RD . cast
384 | FromDouble Ratio where
387 | namespace TextAlign
389 | data TextAlign : Type where
401 | Justify : TextAlign
404 | Interpolation TextAlign where
405 | interpolate Start = "start"
406 | interpolate End = "end"
407 | interpolate Left = "left"
408 | interpolate Right = "right"
409 | interpolate Center = "center"
410 | interpolate Justify = "justify"
412 | namespace TextDecorationLine
415 | data TextDecorationLine : Type where
416 | None : TextDecorationLine
417 | Underline : TextDecorationLine
418 | Overline : TextDecorationLine
419 | LineThrough : TextDecorationLine
422 | Interpolation TextDecorationLine where
423 | interpolate None = "none"
424 | interpolate Underline = "underline"
425 | interpolate Overline = "overline"
426 | interpolate LineThrough = "line-through"
428 | namespace TextDecorationStyle
431 | data TextDecorationStyle : Type where
432 | Solid : TextDecorationStyle
433 | Dbl : TextDecorationStyle
434 | Dotted : TextDecorationStyle
435 | Dashed : TextDecorationStyle
436 | Wavy : TextDecorationStyle
439 | Interpolation TextDecorationStyle where
440 | interpolate Solid = "solid"
441 | interpolate Dbl = "double"
442 | interpolate Dotted = "dotted"
443 | interpolate Dashed = "dashed"
444 | interpolate Wavy = "wavy"
446 | namespace TextOverflow
448 | data TextOverflow = Clip | Ellipsis
451 | Interpolation TextOverflow where
452 | interpolate Clip = "clip"
453 | interpolate Ellipsis = "ellipsis"
457 | data Width : Type where
458 | WL : Length -> Width
459 | WP : Percentage -> Width
462 | Interpolation Width where
463 | interpolate (WL x) = interpolate x
464 | interpolate (WP x) = interpolate x
467 | Cast Length Width where
471 | Cast Percentage Width where
474 | namespace WiteSpace
478 | data WhiteSpace : Type where
482 | Normal : WhiteSpace
485 | Nowrap : WhiteSpace
494 | PreWrap : WhiteSpace
497 | PreLine : WhiteSpace
508 | BreakSpaces : WhiteSpace
511 | Interpolation WhiteSpace where
512 | interpolate Normal = "normal"
513 | interpolate Nowrap = "nowrap"
514 | interpolate Pre = "pre"
515 | interpolate PreWrap = "pre-wrap"
516 | interpolate PreLine = "pre-line"
517 | interpolate BreakSpaces = "break-spaces"