diff options
Diffstat (limited to 'stdlib/source/library/lux/data/format/css/value.lux')
-rw-r--r-- | stdlib/source/library/lux/data/format/css/value.lux | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/stdlib/source/library/lux/data/format/css/value.lux b/stdlib/source/library/lux/data/format/css/value.lux index 743cd781b..61a8be4fb 100644 --- a/stdlib/source/library/lux/data/format/css/value.lux +++ b/stdlib/source/library/lux/data/format/css/value.lux @@ -33,28 +33,30 @@ (syntax (_ [symbol <code>.text]) (in (list (code.local (text.replaced "-" "_" symbol)))))) -(template: (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+) - [(primitive: .public <abstraction> - <representation> +(def: enumeration: + (template (enumeration: <abstraction> <representation> <out> <sample>+ <definition>+) + [(primitive: .public <abstraction> + <representation> - (def: .public <out> - (-> <abstraction> <representation>) - (|>> representation)) + (def: .public <out> + (-> <abstraction> <representation>) + (|>> representation)) - (`` (template [<name> <value>] - [(def: .public <name> <abstraction> (abstraction <value>))] + (`` (with_template [<name> <value>] + [(def: .public <name> <abstraction> (abstraction <value>))] - (~~ (template.spliced <sample>+)) - )) + (~~ (template.spliced <sample>+)) + )) - (template.spliced <definition>+))]) + (template.spliced <definition>+))])) -(template: (multi: <multi> <type> <separator>) - [(def: .public (<multi> pre post) - (-> (Value <type>) (Value <type>) (Value <type>)) - (abstraction (format (representation pre) - <separator> - (representation post))))]) +(def: multi: + (template (multi: <multi> <type> <separator>) + [(def: .public (<multi> pre post) + (-> (Value <type>) (Value <type>) (Value <type>)) + (abstraction (format (representation pre) + <separator> + (representation post))))])) (def: (%number value) (Format Frac) @@ -70,7 +72,7 @@ (-> (Value Any) Text) (|>> representation)) - (template [<name> <value>] + (with_template [<name> <value>] [(def: .public <name> Value (abstraction <value>))] [initial "initial"] @@ -80,7 +82,7 @@ (primitive: .public (Numeric kind) Any) - (template [<name>] + (with_template [<name>] [(with_expansions [<name>' (template.symbol [<name> "'"])] (primitive: .public <name>' Any) (type: .public <name> @@ -92,10 +94,10 @@ [Percentage] ) - (template [<brand> <alias>+ <value>+] + (with_template [<brand> <alias>+ <value>+] [(primitive: .public <brand> Any) - (`` (template [<name> <value>] + (`` (with_template [<name> <value>] [(def: .public <name> (Value <brand>) (abstraction <value>))] @@ -103,7 +105,7 @@ (~~ (template.spliced <alias>+)))) (with_expansions [<rows> (template.spliced <value>+)] - (template [<value>] + (with_template [<value>] [(`` (def: .public (~~ (..text_symbol <value>)) (Value <brand>) (abstraction <value>)))] @@ -807,7 +809,7 @@ (list#each %number) (..apply "cubic-bezier"))) - (template [<name> <brand>] + (with_template [<name> <brand>] [(def: .public <name> (-> Nat (Value <brand>)) (|>> %.nat abstraction))] @@ -840,7 +842,7 @@ "1.0" (format "0" (%.rev _#alpha))))))) - (template [<name> <suffix>] + (with_template [<name> <suffix>] [(def: .public (<name> value) (-> Frac (Value Length)) (abstraction (format (%number value) <suffix>)))] @@ -869,7 +871,7 @@ (%.int value) (%.nat (.nat value)))) - (template [<name> <suffix>] + (with_template [<name> <suffix>] [(def: .public (<name> value) (-> Int (Value Time)) (abstraction (format (if (i.< +0 value) @@ -949,7 +951,7 @@ (-> Nat Angle) (abstraction (format (%.nat (n.% ..degree_limit value)) "deg"))) - (template [<degree> <name>] + (with_template [<degree> <name>] [(def: .public <name> Angle (..degree <degree>))] @@ -960,7 +962,7 @@ [270 to_left] ) - (template [<name> <function>] + (with_template [<name> <function>] [(def: .public (<name> angle start next) (-> Angle Stop (List/1 [(Maybe Hint) Stop]) (Value Image)) (let [[now after] next] @@ -988,8 +990,8 @@ (abstraction (format (representation horizontal) ..slice_separator (representation vertical)))) - (template [<input> <pre> <function>+] - [(`` (template [<name> <function>] + (with_template [<input> <pre> <function>+] + [(`` (with_template [<name> <function>] [(def: .public <name> (-> <input> (Value Filter)) (|>> <pre> (list) (..apply <function>)))] @@ -1032,7 +1034,7 @@ (def: length_separator " ") - (template [<name> <type>] + (with_template [<name> <type>] [(def: .public (<name> horizontal vertical) (-> (Value Length) (Value Length) (Value <type>)) (abstraction (format (representation horizontal) @@ -1067,7 +1069,7 @@ [farthest_corner "farthest-corner"]] []) - (template [<name> <function>] + (with_template [<name> <function>] [(def: .public (<name> shape extent location start next) (-> Shape (Maybe Extent) (Value Location) Stop (List/1 [(Maybe Hint) Stop]) @@ -1115,7 +1117,7 @@ (def: .public (clip rectangle) (-> Rectangle (Value Clip)) - (`` (..apply "rect" (list (~~ (template [<side>] + (`` (..apply "rect" (list (~~ (with_template [<side>] [(representation (the <side> rectangle))] [#top] [#right] [#bottom] [#left])))))) @@ -1255,7 +1257,7 @@ (list#each %number) (..apply "matrix3d"))) - (template [<name> <function> <input_types> <input_values>] + (with_template [<name> <function> <input_types> <input_values>] [(`` (def: .public (<name> [(~~ (template.spliced <input_values>))]) (-> [(~~ (template.spliced <input_types>))] (Value Transform)) (|> (list (~~ (template.spliced <input_values>))) @@ -1277,7 +1279,7 @@ [perspective "perspective" [Frac] [value]] ) - (template [<name> <function> <input_types> <input_values>] + (with_template [<name> <function> <input_types> <input_values>] [(`` (def: .public (<name> [(~~ (template.spliced <input_values>))]) (-> [(~~ (template.spliced <input_types>))] (Value Transform)) (|> (list (~~ (template.spliced <input_values>))) @@ -1327,7 +1329,7 @@ (multi: multi_content Content " ") ... https://developer.mozilla.org/en-US/docs/Web/CSS/calc() - (template [<name> <parameter>] + (with_template [<name> <parameter>] [(def: .public (<name> parameter subject) (.All (_ kind) (-> (Value <parameter>) (Value (Numeric kind)) |