From c3496315f52ae90c9c86a2d72dd8690db67dbd04 Mon Sep 17 00:00:00 2001 From: Patrick Sier Date: Tue, 13 Aug 2019 03:40:17 -0500 Subject: Uses Bool instead of Expression for visibility (#51) --- style-generator/src/Decoder.elm | 3 +++ style-generator/src/MyElm/Syntax.elm | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'style-generator') diff --git a/style-generator/src/Decoder.elm b/style-generator/src/Decoder.elm index 1df0a73..ce18306 100644 --- a/style-generator/src/Decoder.elm +++ b/style-generator/src/Decoder.elm @@ -194,6 +194,9 @@ decodeAttrs = "filter" -> decodeAttr "filter" (D.oneOf [ Decoder.Legacy.filter, Decode.expression ]) attrValue + "visibility" -> + decodeAttr "visible" (D.map ((==) "visible" >> bool) D.string) attrValue + other -> decodeAttr (toCamelCaseLower attrName) Decode.expression attrValue ) diff --git a/style-generator/src/MyElm/Syntax.elm b/style-generator/src/MyElm/Syntax.elm index 7b99915..b207d17 100644 --- a/style-generator/src/MyElm/Syntax.elm +++ b/style-generator/src/MyElm/Syntax.elm @@ -1,6 +1,6 @@ module MyElm.Syntax exposing ( QualifiedName, local, valueName, typeName, constructorName - , Expression, string, float, int, list, pair, triple, call0, call1, call2, call3, call4, calln, pipe, record + , Expression, string, float, int, bool, list, pair, triple, call0, call1, call2, call3, call4, calln, pipe, record , Type, type0, type1, type2, typen, recordType, functionType, pairType, tripleType, typeVar , Declaration, variable, fun1, customType, typeAlias , build, Exposing, opaque, withConstructors, exposeFn @@ -321,6 +321,13 @@ int i = Literal (String.fromInt i) +{-| A bool literal. +-} +bool : Bool -> Expression +bool b = + Literal (if b then "True" else "False") + + {-| A list literal -} list : List Expression -> Expression -- cgit v1.2.3