aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generate-elm.js6
-rw-r--r--package-lock.json188
-rw-r--r--src/Mapbox/Layer.elm6
-rw-r--r--style-generator/src/Decoder.elm3
-rw-r--r--style-generator/src/MyElm/Syntax.elm9
5 files changed, 155 insertions, 57 deletions
diff --git a/generate-elm.js b/generate-elm.js
index 181c4c1..ec1e889 100644
--- a/generate-elm.js
+++ b/generate-elm.js
@@ -258,9 +258,9 @@ filter =
Expression.encode >> Top "filter"
{-| Whether this layer is displayed. -}
-visible : Expression CameraExpression Bool -> LayerAttr any
-visible vis =
- Layout "visibility" <| Expression.encode <| Expression.ifElse vis (Expression.str "visible") (Expression.str "none")
+visible : Bool -> LayerAttr any
+visible isVisible =
+ Layout "visibility" <| Expression.encode <| Expression.str <| if isVisible then "visible" else "none"
${Object.entries(codes)
.map(([section, codes]) => `-- ${section}\n\n${codes.join("\n")}`)
diff --git a/package-lock.json b/package-lock.json
index a17b137..0b802c4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -487,6 +487,12 @@
"readdirp": "^2.0.0"
}
},
+ "chownr": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz",
+ "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==",
+ "dev": true
+ },
"class-utils": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz",
@@ -704,12 +710,75 @@
"dev": true
},
"elm-format": {
- "version": "0.8.1",
- "resolved": "https://registry.npmjs.org/elm-format/-/elm-format-0.8.1.tgz",
- "integrity": "sha512-uLcDICdmEoRBaCp3PobcvHtUej2RJFHRYfMd7i3CSH+RsajJYTdiPkviKIq823Kd4gfjQMpNajEyM1lLFez7+A==",
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/elm-format/-/elm-format-0.8.2.tgz",
+ "integrity": "sha512-BRQaVQOGt9gxK1hqSJn1MISxDGdln22PSYzmHMjqpQY3S9OJY/3kPn5HoiH3bHQYQFwC+X0apsMZldK9VxySow==",
"dev": true,
"requires": {
- "binwrap": "^0.2.0"
+ "binwrap": "^0.2.2"
+ },
+ "dependencies": {
+ "binwrap": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/binwrap/-/binwrap-0.2.2.tgz",
+ "integrity": "sha512-Y+Wvypk3JhH5GPZAvlwJAWOVH/OsOhQMSj37vySuWHwQivoALplPxfBA8b973rFJI7OS+O+1YmmYXIiEXVMAcw==",
+ "dev": true,
+ "requires": {
+ "mustache": "^3.0.1",
+ "request": "^2.88.0",
+ "request-promise": "^4.2.4",
+ "tar": "^4.4.10",
+ "unzip-stream": "^0.3.0"
+ }
+ },
+ "mustache": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-3.0.3.tgz",
+ "integrity": "sha512-vM5FkMHamTYmVYeAujypihuPrJQDtaUIlKeeVb1AMJ73OZLtWiF7GprqrjxD0gJWT53W9JfqXxf97nXQjMQkqA==",
+ "dev": true
+ },
+ "request-promise": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/request-promise/-/request-promise-4.2.4.tgz",
+ "integrity": "sha512-8wgMrvE546PzbR5WbYxUQogUnUDfM0S7QIFZMID+J73vdFARkFy+HElj4T+MWYhpXwlLp0EQ8Zoj8xUA0he4Vg==",
+ "dev": true,
+ "requires": {
+ "bluebird": "^3.5.0",
+ "request-promise-core": "1.1.2",
+ "stealthy-require": "^1.1.1",
+ "tough-cookie": "^2.3.3"
+ }
+ },
+ "request-promise-core": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.2.tgz",
+ "integrity": "sha512-UHYyq1MO8GsefGEt7EprS8UrXsm1TxEvFUX1IMTuSLU2Rh7fTIdFtl8xD7JiEYiWU2dl+NYAjCTksTehQUxPag==",
+ "dev": true,
+ "requires": {
+ "lodash": "^4.17.11"
+ }
+ },
+ "tar": {
+ "version": "4.4.10",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz",
+ "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==",
+ "dev": true,
+ "requires": {
+ "chownr": "^1.1.1",
+ "fs-minipass": "^1.2.5",
+ "minipass": "^2.3.5",
+ "minizlib": "^1.2.1",
+ "mkdirp": "^0.5.0",
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.3"
+ }
+ },
+ "yallist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
+ "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
+ "dev": true
+ }
}
},
"elm-test": {
@@ -1357,11 +1426,6 @@
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
},
- "esm": {
- "version": "3.0.84",
- "resolved": "https://registry.npmjs.org/esm/-/esm-3.0.84.tgz",
- "integrity": "sha512-SzSGoZc17S7P+12R9cg21Bdb7eybX25RnIeRZ80xZs+VZ3kdQKzqTp2k4hZJjR7p9l0186TTXSgrxzlMDBktlw=="
- },
"esprima": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-1.0.4.tgz",
@@ -1554,6 +1618,15 @@
"rimraf": "^2.2.8"
}
},
+ "fs-minipass": {
+ "version": "1.2.6",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.6.tgz",
+ "integrity": "sha512-crhvyXcMejjv3Z5d2Fa9sf5xLYVCF5O1c71QxbVnbLsmYMBEvDAftewesN/HhY03YRoA7zOMxjNGrF5svGaaeQ==",
+ "dev": true,
+ "requires": {
+ "minipass": "^2.2.1"
+ }
+ },
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -2141,9 +2214,9 @@
}
},
"gl-matrix": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.0.0.tgz",
- "integrity": "sha512-PD4mVH/C/Zs64kOozeFnKY8ybhgwxXXQYGWdB4h68krAHknWJgk9uKOn6z8YElh5//vs++90pb6csrTIDWnexA=="
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/gl-matrix/-/gl-matrix-3.1.0.tgz",
+ "integrity": "sha512-526NA+3EA+ztAQi0IZpSWiM0fyQXIp7IbRvfJ4wS/TjjQD0uv0fVybXwwqqSOlq33UckivI0yMDlVtboWm3k7A=="
},
"glob": {
"version": "7.1.3",
@@ -2435,9 +2508,9 @@
"dev": true
},
"is-reference": {
- "version": "1.1.2",
- "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.2.tgz",
- "integrity": "sha512-Kn5g8c7XHKejFOpTf2QN9YjiHHKl5xRj+2uAZf9iM2//nkBNi/NNeB5JMoun28nEaUVHyPUzqzhfRlfAirEjXg==",
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.3.tgz",
+ "integrity": "sha512-W1iHHv/oyBb2pPxkBxtaewxa1BC58Pn5J0hogyCdefwUIvb6R+TGbAcIa4qPNYLqLhb3EnOgUf2MQkkF76BcKw==",
"dev": true,
"requires": {
"@types/estree": "0.0.39"
@@ -2572,9 +2645,9 @@
}
},
"magic-string": {
- "version": "0.25.2",
- "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.2.tgz",
- "integrity": "sha512-iLs9mPjh9IuTtRsqqhNGYcZXGei0Nh/A4xirrsqW7c+QhKVFL2vm7U09ru6cHRD22azaP/wMDgI+HCqbETMTtg==",
+ "version": "0.25.3",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.3.tgz",
+ "integrity": "sha512-6QK0OpF/phMz0Q2AxILkX2mFhi7m+WMwTRg0LQKq/WBB0cDP4rYH3Wp4/d3OTXlrPLVJT/RFqj8tFeAR4nk8AA==",
"dev": true,
"requires": {
"sourcemap-codec": "^1.4.4"
@@ -2596,9 +2669,9 @@
}
},
"mapbox-gl": {
- "version": "1.2.0",
- "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-1.2.0.tgz",
- "integrity": "sha512-RDo0kMuo9gs6HFX2Maj+tYO5bUT6WFTQkFbJoKdfe2pK8SY/RgyG3SNJRgZypdBR8loxGCG9geeOwc+JJqblHQ==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-1.3.0.tgz",
+ "integrity": "sha512-mhxIXNQwyqqlFImVUuFucSydxXIeKS4ul/5ES6A5zA4loLvcEXOrlH1PewjqkGoYjfdRHjqsaxpP8czbVuHg3g==",
"requires": {
"@mapbox/geojson-rewind": "^0.4.0",
"@mapbox/geojson-types": "^1.0.2",
@@ -2611,7 +2684,6 @@
"@mapbox/whoots-js": "^3.1.0",
"csscolorparser": "~1.0.2",
"earcut": "^2.1.5",
- "esm": "~3.0.84",
"geojson-vt": "^3.2.1",
"gl-matrix": "^3.0.0",
"grid-index": "^1.1.0",
@@ -2689,10 +2761,37 @@
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
},
+ "minipass": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.5.0.tgz",
+ "integrity": "sha512-9FwMVYhn6ERvMR8XFdOavRz4QK/VJV8elU1x50vYexf9lslDcWe/f4HBRxCPd185ekRSjU6CfYyJCECa/CQy7Q==",
+ "dev": true,
+ "requires": {
+ "safe-buffer": "^5.1.2",
+ "yallist": "^3.0.0"
+ },
+ "dependencies": {
+ "yallist": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz",
+ "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==",
+ "dev": true
+ }
+ }
+ },
+ "minizlib": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz",
+ "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==",
+ "dev": true,
+ "requires": {
+ "minipass": "^2.2.1"
+ }
+ },
"mixin-deep": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
- "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==",
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz",
+ "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==",
"dev": true,
"requires": {
"for-in": "^1.0.2",
@@ -3528,26 +3627,26 @@
}
},
"rollup": {
- "version": "1.18.0",
- "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.18.0.tgz",
- "integrity": "sha512-MBAWr6ectF948gW/bs/yfi0jW7DzwI8n0tEYG/ZMQutmK+blF/Oazyhg3oPqtScCGV8bzCtL9KzlzPtTriEOJA==",
+ "version": "1.20.3",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-1.20.3.tgz",
+ "integrity": "sha512-/OMCkY0c6E8tleeVm4vQVDz24CkVgvueK3r8zTYu2AQNpjrcaPwO9hE+pWj5LTFrvvkaxt4MYIp2zha4y0lRvg==",
"dev": true,
"requires": {
"@types/estree": "0.0.39",
- "@types/node": "^12.6.3",
- "acorn": "^6.2.0"
+ "@types/node": "^12.7.2",
+ "acorn": "^7.0.0"
},
"dependencies": {
"@types/node": {
- "version": "12.6.9",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.9.tgz",
- "integrity": "sha512-+YB9FtyxXGyD54p8rXwWaN1EWEyar5L58GlGWgtH2I9rGmLGBQcw63+0jw+ujqVavNuO47S1ByAjm9zdHMnskw==",
+ "version": "12.7.3",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.3.tgz",
+ "integrity": "sha512-3SiLAIBkDWDg6vFo0+5YJyHPWU9uwu40Qe+v+0MH8wRKYBimHvvAOyk3EzMrD/TrIlLYfXrqDqrg913PynrMJQ==",
"dev": true
},
"acorn": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.2.1.tgz",
- "integrity": "sha512-JD0xT5FCRDNyjDda3Lrg/IxFscp9q4tiYtxE1/nOzlKCk7hIRuYjhq1kCNkbPjMRMZuFq20HNQn1I9k8Oj0E+Q==",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.0.0.tgz",
+ "integrity": "sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ==",
"dev": true
}
}
@@ -3563,9 +3662,9 @@
}
},
"rollup-plugin-commonjs": {
- "version": "10.0.1",
- "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.0.1.tgz",
- "integrity": "sha512-x0PcCVdEc4J8igv1qe2vttz8JKAKcTs3wfIA3L8xEty3VzxgORLrzZrNWaVMc+pBC4U3aDOb9BnWLAQ8J11vkA==",
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz",
+ "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==",
"dev": true,
"requires": {
"estree-walker": "^0.6.1",
@@ -3573,17 +3672,6 @@
"magic-string": "^0.25.2",
"resolve": "^1.11.0",
"rollup-pluginutils": "^2.8.1"
- },
- "dependencies": {
- "rollup-pluginutils": {
- "version": "2.8.1",
- "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.1.tgz",
- "integrity": "sha512-J5oAoysWar6GuZo0s+3bZ6sVZAC0pfqKz68De7ZgDi5z63jOVZn1uJL/+z1jeKHNbGII8kAyHF5q8LnxSX5lQg==",
- "dev": true,
- "requires": {
- "estree-walker": "^0.6.1"
- }
- }
}
},
"rollup-plugin-node-resolve": {
diff --git a/src/Mapbox/Layer.elm b/src/Mapbox/Layer.elm
index dea484c..2c24fb5 100644
--- a/src/Mapbox/Layer.elm
+++ b/src/Mapbox/Layer.elm
@@ -319,9 +319,9 @@ filter =
{-| Whether this layer is displayed.
-}
-visible : Expression CameraExpression Bool -> LayerAttr any
-visible vis =
- Layout "visibility" <| Expression.encode <| Expression.ifElse vis (Expression.str "visible") (Expression.str "none")
+visible : Bool -> LayerAttr any
+visible isVisible =
+ Layout "visibility" <| Expression.encode <| Expression.str <| if isVisible then "visible" else "none"
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