aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/library/lux/web/css/style.lux
blob: 68944331cd9f145892d2dee058ca9e0165487593 (plain)
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
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except with)
   [data
    [text
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list (.use "[1]#[0]" mix)]]]
   [meta
    [type
     ["[0]" nominal (.except def)]]]]]
 ["[0]" //
  ["[1][0]" value (.only Value)]
  ["[1][0]" property (.only Property)]])

(nominal.def .public Style
  Text

  (def .public empty
    Style
    (abstraction ""))

  (def .public (with [property value])
    (All (_ brand)
      (-> [(Property brand) (Value brand)]
          (-> Style Style)))
    (|>> representation
         (format (//property.name property) ": " (//value.value value) ";")
         abstraction))

  (def .public inline
    (-> Style Text)
    (|>> representation))

  (def .public (style config)
    (-> (List (Ex (_ brand) [(Property brand) (Value brand)]))
        Style)
    (list#mix ..with ..empty config))
  )