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
59 | InlineBlock : Display
62 | Area : {0 n,m : Nat}
64 | -> {auto as : Show a}
65 | -> (rows : Vect (S m) GridValue)
66 | -> (columns : Vect (S n) GridValue)
67 | -> (area : Vect (S m) (Vect (S n) a))
71 | showTag : Show a => a -> String
73 | case toLower $
show v of
77 | col : Show a => Vect (S n) a -> String
79 | let s := concat . intersperse " " . map showTag $
toList vs
85 | -> Vect (S m) GridValue
86 | -> Vect (S n) GridValue
87 | -> Vect (S m) (Vect (S n) a)
89 | renderArea rs cs as =
90 | let rsStr := "grid-template-rows: \{toList rs}"
91 | csStr := "grid-template-columns: \{toList cs}"
92 | aStr := fastConcat . intersperse " " . map col $
toList as
93 | in "display: grid; \{rsStr}; \{csStr}; grid-template-areas: \{aStr}"
97 | data FlexBasis : Type where
98 | FL : Length -> FlexBasis
99 | FP : Percentage -> FlexBasis
102 | Interpolation FlexBasis where
103 | interpolate (FL x) = interpolate x
104 | interpolate (FP x) = interpolate x
107 | Cast Length FlexBasis where
111 | Cast Percentage FlexBasis where
116 | data FontSize : Type where
117 | FL : Length -> FontSize
118 | FP : Percentage -> FontSize
126 | XXXLarge : FontSize
129 | Interpolation FontSize where
130 | interpolate (FL x) = interpolate x
131 | interpolate (FP x) = interpolate x
132 | interpolate XXSmall = "xx-small"
133 | interpolate XSmall = "x-small"
134 | interpolate Small = "small"
135 | interpolate Medium = "medium"
136 | interpolate Large = "large"
137 | interpolate XLarge = "x-large"
138 | interpolate XXLarge = "xx-large"
139 | interpolate XXXLarge = "xxx-large"
142 | Cast Length FontSize where
146 | Cast Percentage FontSize where
149 | namespace FontWeight
151 | data FontWeight : Type where
152 | Normal : FontWeight
154 | Lighter : FontWeight
155 | Bolder : FontWeight
167 | Interpolation FontWeight where
168 | interpolate Normal = "normal"
169 | interpolate Bold = "bold"
170 | interpolate Lighter = "lighter"
171 | interpolate Bolder = "bolder"
172 | interpolate FW100 = "100"
173 | interpolate FW200 = "200"
174 | interpolate FW300 = "300"
175 | interpolate FW400 = "400"
176 | interpolate FW500 = "500"
177 | interpolate FW600 = "600"
178 | interpolate FW700 = "700"
179 | interpolate FW800 = "800"
180 | interpolate FW900 = "900"
182 | namespace FontStyle
184 | data FontStyle : Type where
187 | Oblique_ : FontStyle
188 | Oblique : Angle -> FontStyle
191 | Interpolation FontStyle where
192 | interpolate Normal = "normal"
193 | interpolate Italic = "italic"
194 | interpolate Oblique_ = "oblique"
195 | interpolate (Oblique x) = "oblique \{x}"
198 | namespace BorderRadius
200 | data BorderRadius : Type where
201 | BL : Length -> BorderRadius
202 | BP : Percentage -> BorderRadius
203 | BS : String -> BorderRadius
206 | Interpolation BorderRadius where
207 | interpolate (BL x) = interpolate x
208 | interpolate (BP x) = interpolate x
209 | interpolate (BS x) = x
212 | Cast Length BorderRadius where
216 | Cast Percentage BorderRadius where
220 | FromString BorderRadius where
223 | namespace BorderStyle
225 | data BorderStyle : Type where
227 | Hidden : BorderStyle
228 | Dotted : BorderStyle
229 | Dashed : BorderStyle
230 | Solid : BorderStyle
232 | Groove : BorderStyle
233 | Ridge : BorderStyle
234 | Inset : BorderStyle
235 | Outset : BorderStyle
239 | Interpolation BorderStyle where
240 | interpolate None = "none"
241 | interpolate Hidden = "hidden"
242 | interpolate Dotted = "dotted"
243 | interpolate Dashed = "dashed"
244 | interpolate Solid = "solid"
245 | interpolate Dbl = "double"
246 | interpolate Groove = "groove"
247 | interpolate Ridge = "ridge"
248 | interpolate Inset = "inset"
249 | interpolate Outset = "outset"
251 | namespace BorderWidth
253 | data BorderWidth : Type where
254 | BL : Length -> BorderWidth
256 | Medium : BorderWidth
257 | Thick : BorderWidth
260 | Interpolation BorderWidth where
261 | interpolate (BL x) = interpolate x
262 | interpolate Thin = "thin"
263 | interpolate Medium = "medium"
264 | interpolate Thick = "thick"
267 | Cast Length BorderWidth where
272 | data Linecap : Type where
278 | Interpolation Linecap where
279 | interpolate Butt = "butt"
280 | interpolate Round = "round"
281 | interpolate Square = "square"
285 | data Linejoin : Type where
291 | Interpolation Linejoin where
292 | interpolate Bevel = "bevel"
293 | interpolate Miter = "miter"
294 | interpolate Round = "round"
296 | namespace LineHeight
298 | data LineHeight : Type where
299 | Normal : LineHeight
300 | LHD : Double -> LineHeight
301 | LHL : Length -> LineHeight
302 | LHP : Percentage -> LineHeight
305 | Interpolation LineHeight where
306 | interpolate Normal = "normal"
307 | interpolate (LHD x) = show x
308 | interpolate (LHL x) = interpolate x
309 | interpolate (LHP x) = interpolate x
312 | Cast Length LineHeight where
316 | Cast Percentage LineHeight where
320 | fromInteger : Integer -> LineHeight
321 | fromInteger = LHD . cast
324 | FromDouble LineHeight where
334 | data Overflow : Type where
360 | Interpolation Overflow where
361 | interpolate Visible = "visible"
362 | interpolate Hidden = "hidden"
363 | interpolate Clip = "clip"
364 | interpolate Scroll = "scroll"
365 | interpolate Auto = "auto"
369 | data Pos : Type where
371 | PP : Percentage -> Pos
374 | Interpolation Pos where
375 | interpolate (PL x) = interpolate x
376 | interpolate (PP x) = interpolate x
379 | Cast Length Pos where
383 | Cast Percentage Pos where
388 | data Position = Static | Relative | Absolute | Fixed | Sticky
391 | Interpolation Position where
392 | interpolate Static = "static"
393 | interpolate Relative = "relative"
394 | interpolate Absolute = "absolute"
395 | interpolate Fixed = "fixed"
396 | interpolate Sticky = "sticky"
400 | data Ratio : Type where
402 | RD : Double -> Ratio
403 | RDD : Double -> Double -> Ratio
406 | Interpolation Ratio where
407 | interpolate Auto = "auto"
408 | interpolate (RD x) = show x
409 | interpolate (RDD x y) = "\{show x}/\{show y}"
412 | fromInteger : Integer -> Ratio
413 | fromInteger = RD . cast
416 | FromDouble Ratio where
421 | data Resize = None | Vertical | Horizontal | Both
424 | Interpolation Resize where
425 | interpolate None = "none"
426 | interpolate Vertical = "vertical"
427 | interpolate Horizontal = "horizontal"
428 | interpolate Both = "both"
430 | namespace ScrollbarGutter
432 | data ScrollbarGutter = Auto | Stable | BothEdges
435 | Interpolation ScrollbarGutter where
436 | interpolate Auto = "auto"
437 | interpolate Stable = "stable"
438 | interpolate BothEdges = "stable both-edges"
440 | namespace TextAlign
442 | data TextAlign : Type where
454 | Justify : TextAlign
457 | Interpolation TextAlign where
458 | interpolate Start = "start"
459 | interpolate End = "end"
460 | interpolate Left = "left"
461 | interpolate Right = "right"
462 | interpolate Center = "center"
463 | interpolate Justify = "justify"
465 | namespace TextDecorationLine
468 | data TextDecorationLine : Type where
469 | None : TextDecorationLine
470 | Underline : TextDecorationLine
471 | Overline : TextDecorationLine
472 | LineThrough : TextDecorationLine
475 | Interpolation TextDecorationLine where
476 | interpolate None = "none"
477 | interpolate Underline = "underline"
478 | interpolate Overline = "overline"
479 | interpolate LineThrough = "line-through"
481 | namespace TextDecorationStyle
484 | data TextDecorationStyle : Type where
485 | Solid : TextDecorationStyle
486 | Dbl : TextDecorationStyle
487 | Dotted : TextDecorationStyle
488 | Dashed : TextDecorationStyle
489 | Wavy : TextDecorationStyle
492 | Interpolation TextDecorationStyle where
493 | interpolate Solid = "solid"
494 | interpolate Dbl = "double"
495 | interpolate Dotted = "dotted"
496 | interpolate Dashed = "dashed"
497 | interpolate Wavy = "wavy"
499 | namespace TextOverflow
501 | data TextOverflow = Clip | Ellipsis
504 | Interpolation TextOverflow where
505 | interpolate Clip = "clip"
506 | interpolate Ellipsis = "ellipsis"
510 | data Width : Type where
511 | WL : Length -> Width
512 | WP : Percentage -> Width
515 | Interpolation Width where
516 | interpolate (WL x) = interpolate x
517 | interpolate (WP x) = interpolate x
520 | Cast Length Width where
524 | Cast Percentage Width where
527 | namespace Visibility
530 | data Visibility = Visible | Hidden | Collapse
533 | Interpolation Visibility where
534 | interpolate Visible = "visible"
535 | interpolate Hidden = "hidden"
536 | interpolate Collapse = "collapse"
538 | namespace WiteSpace
542 | data WhiteSpace : Type where
546 | Normal : WhiteSpace
549 | Nowrap : WhiteSpace
558 | PreWrap : WhiteSpace
561 | PreLine : WhiteSpace
572 | BreakSpaces : WhiteSpace
575 | Interpolation WhiteSpace where
576 | interpolate Normal = "normal"
577 | interpolate Nowrap = "nowrap"
578 | interpolate Pre = "pre"
579 | interpolate PreWrap = "pre-wrap"
580 | interpolate PreLine = "pre-line"
581 | interpolate BreakSpaces = "break-spaces"