diff --git a/build/generate-flow-typed-style-spec.js b/build/generate-flow-typed-style-spec.js index d7a4070a801..d3eb1b3a842 100644 --- a/build/generate-flow-typed-style-spec.js +++ b/build/generate-flow-typed-style-spec.js @@ -1,5 +1,4 @@ const spec = require('../src/style-spec/reference/v8.json'); -const properties = require('../src/style-spec/util/properties'); const fs = require('fs'); function flowEnum(values) { @@ -41,11 +40,11 @@ function flowType(property) { } })(); - if (properties.supportsPropertyExpression(property)) { + if (property['property-function']) { return `DataDrivenPropertyValueSpecification<${baseType}>`; - } else if (properties.supportsZoomExpression(property)) { + } else if (property['zoom-function']) { return `PropertyValueSpecification<${baseType}>`; - } else if (property.expression) { + } else if (property.function) { return `ExpressionSpecification`; } else { return baseType; diff --git a/build/generate-struct-arrays.js b/build/generate-struct-arrays.js index e3ed0c2eff1..aad8fdf1c9c 100644 --- a/build/generate-struct-arrays.js +++ b/build/generate-struct-arrays.js @@ -226,6 +226,5 @@ ${arraysWithStructAccessors.map(structArrayJs).join('\n')} export { ${layouts.map(layout => layout.className).join(',\n ')}, ${[...arrayTypeEntries].join(',\n ')} -}; -`); +};`); diff --git a/build/generate-style-code.js b/build/generate-style-code.js index 8fa49c1bb21..38dab49b8f5 100644 --- a/build/generate-style-code.js +++ b/build/generate-style-code.js @@ -12,6 +12,10 @@ global.camelize = function (str) { }); }; +global.isDataDriven = function (property) { + return property['property-function'] === true; +}; + global.flowType = function (property) { switch (property.type) { case 'boolean': @@ -35,18 +39,14 @@ global.flowType = function (property) { }; global.propertyType = function (property) { - switch (property['property-type']) { - case 'data-driven': - return `DataDrivenProperty<${flowType(property)}>`; - case 'cross-faded': - return `CrossFadedProperty<${flowType(property)}>`; - case 'color-ramp': - return `ColorRampProperty`; - case 'data-constant': - case 'constant': - return `DataConstantProperty<${flowType(property)}>`; - default: - throw new Error(`unknown property-type "${property['property-type']}" for ${property.name}`); + if (isDataDriven(property)) { + return `DataDrivenProperty<${flowType(property)}>`; + } else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { + return `CrossFadedProperty<${flowType(property)}>`; + } else if (property.name === 'heatmap-color' || property.name === 'line-gradient') { + return `ColorRampProperty`; + } else { + return `DataConstantProperty<${flowType(property)}>`; } }; @@ -91,18 +91,14 @@ global.defaultValue = function (property) { }; global.propertyValue = function (property, type) { - switch (property['property-type']) { - case 'data-driven': - return `new DataDrivenProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; - case 'cross-faded': - return `new CrossFadedProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; - case 'color-ramp': - return `new ColorRampProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; - case 'data-constant': - case 'constant': - return `new DataConstantProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; - default: - throw new Error(`unknown property-type "${property['property-type']}" for ${property.name}`); + if (isDataDriven(property)) { + return `new DataDrivenProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; + } else if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { + return `new CrossFadedProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; + } else if (property.name === 'heatmap-color' || property.name === 'line-gradient') { + return `new ColorRampProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; + } else { + return `new DataConstantProperty(styleSpec["${type}_${property.layerType}"]["${property.name}"])`; } }; diff --git a/package.json b/package.json index cd066c7916c..402fb52fcc4 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "test-render": "node --max-old-space-size=2048 test/render.test.js", "test-query": "node test/query.test.js", "test-expressions": "build/run-node test/expression.test.js", - "test-flow": "build/run-node build/generate-flow-typed-style-spec && flow .", + "test-flow": "node build/generate-flow-typed-style-spec && flow .", "test-flow-cov": "flow-coverage-report -i 'src/**/*.js' -t html", "test-cov": "nyc --require=@mapbox/flow-remove-types/register --reporter=text-summary --reporter=lcov --cache run-s test-unit test-expressions test-query test-render", "prepublish": "in-publish && run-s build-dev build-min || not-in-publish", diff --git a/src/data/program_configuration.js b/src/data/program_configuration.js index 399cbeff2ca..7fd9164c40c 100644 --- a/src/data/program_configuration.js +++ b/src/data/program_configuration.js @@ -2,7 +2,6 @@ import { packUint8ToFloat } from '../shaders/encode_attribute'; import Color from '../style-spec/util/color'; -import { supportsPropertyExpression } from '../style-spec/util/properties'; import { register } from '../util/web_worker_transfer'; import { PossiblyEvaluatedPropertyValue } from '../style/properties'; import { StructArrayLayout1f4, StructArrayLayout2f8, StructArrayLayout4f16 } from './array_types'; @@ -292,7 +291,7 @@ export default class ProgramConfiguration { for (const property in layer.paint._values) { if (!filterProperties(property)) continue; const value = layer.paint.get(property); - if (!(value instanceof PossiblyEvaluatedPropertyValue) || !supportsPropertyExpression(value.property.specification)) { + if (!(value instanceof PossiblyEvaluatedPropertyValue) || !value.property.specification['property-function']) { continue; } const name = paintAttributeName(property, layer.type); diff --git a/src/style-spec/expression/index.js b/src/style-spec/expression/index.js index 97a35a5683a..a161abf6ba4 100644 --- a/src/style-spec/expression/index.js +++ b/src/style-spec/expression/index.js @@ -15,7 +15,6 @@ import definitions from './definitions'; import * as isConstant from './is_constant'; import RuntimeError from './runtime_error'; import { success, error } from '../util/result'; -import { supportsPropertyExpression, supportsZoomExpression, supportsInterpolation } from '../util/properties'; import type {Type} from './types'; import type {Value} from './values'; @@ -208,12 +207,12 @@ export function createPropertyExpression(expression: mixed, propertySpec: StyleP const parsed = expression.value.expression; const isFeatureConstant = isConstant.isFeatureConstant(parsed); - if (!isFeatureConstant && !supportsPropertyExpression(propertySpec)) { + if (!isFeatureConstant && !propertySpec['property-function']) { return error([new ParsingError('', 'property expressions not supported')]); } const isZoomConstant = isConstant.isGlobalPropertyConstant(parsed, ['zoom']); - if (!isZoomConstant && !supportsZoomExpression(propertySpec)) { + if (!isZoomConstant && propertySpec['zoom-function'] === false) { return error([new ParsingError('', 'zoom expressions not supported')]); } @@ -222,7 +221,7 @@ export function createPropertyExpression(expression: mixed, propertySpec: StyleP return error([new ParsingError('', '"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')]); } else if (zoomCurve instanceof ParsingError) { return error([zoomCurve]); - } else if (zoomCurve instanceof Interpolate && !supportsInterpolation(propertySpec)) { + } else if (zoomCurve instanceof Interpolate && propertySpec['function'] === 'piecewise-constant') { return error([new ParsingError('', '"interpolate" expressions cannot be used with this property')]); } diff --git a/src/style-spec/feature_filter/index.js b/src/style-spec/feature_filter/index.js index 3578373ab54..54cad4aaf3a 100644 --- a/src/style-spec/feature_filter/index.js +++ b/src/style-spec/feature_filter/index.js @@ -47,11 +47,9 @@ function isExpressionFilter(filter: any) { const filterSpec = { 'type': 'boolean', 'default': false, - 'property-type': 'data-driven', - 'expression': { - 'interpolated': true, - 'parameters': ['zoom', 'feature'] - } + 'function': true, + 'property-function': true, + 'zoom-function': true }; /** diff --git a/src/style-spec/function/convert.js b/src/style-spec/function/convert.js index 1fd944418f4..366ecb3390a 100644 --- a/src/style-spec/function/convert.js +++ b/src/style-spec/function/convert.js @@ -236,9 +236,10 @@ function appendStopPair(curve, input, output, isStep) { function getFunctionType(parameters, propertySpec) { if (parameters.type) { return parameters.type; + } else if (propertySpec.function) { + return propertySpec.function === 'interpolated' ? 'exponential' : 'interval'; } else { - assert(propertySpec.expression); - return (propertySpec.expression: any).interpolated ? 'exponential' : 'interval'; + return 'exponential'; } } diff --git a/src/style-spec/function/index.js b/src/style-spec/function/index.js index f6a3f884c82..b25d6e3a53f 100644 --- a/src/style-spec/function/index.js +++ b/src/style-spec/function/index.js @@ -5,7 +5,6 @@ import extend from '../util/extend'; import getType from '../util/get_type'; import * as interpolate from '../util/interpolate'; import Interpolate from '../expression/definitions/interpolate'; -import { supportsInterpolation } from '../util/properties'; export function isFunction(value) { return typeof value === 'object' && value !== null && !Array.isArray(value); @@ -20,7 +19,7 @@ export function createFunction(parameters, propertySpec) { const zoomAndFeatureDependent = parameters.stops && typeof parameters.stops[0][0] === 'object'; const featureDependent = zoomAndFeatureDependent || parameters.property !== undefined; const zoomDependent = zoomAndFeatureDependent || !featureDependent; - const type = parameters.type || (supportsInterpolation(propertySpec) ? 'exponential' : 'interval'); + const type = parameters.type || (propertySpec.function === 'interpolated' ? 'exponential' : 'interval'); if (isColor) { parameters = extend({}, parameters); diff --git a/src/style-spec/reference/v8.json b/src/style-spec/reference/v8.json index 5f8ad2f17ae..7ca76bdcecc 100644 --- a/src/style-spec/reference/v8.json +++ b/src/style-spec/reference/v8.json @@ -4,9 +4,7 @@ "version": { "required": true, "type": "enum", - "values": [ - 8 - ], + "values": [8], "doc": "Style specification version number. Must be 8.", "example": 8 }, @@ -23,10 +21,7 @@ "type": "array", "value": "number", "doc": "Default map center in longitude and latitude. The style center will be used only if the map has not been positioned by other means (e.g. map options or user interaction).", - "example": [ - -73.9749, - 40.7736 - ] + "example": [-73.9749, 40.7736] }, "zoom": { "type": "number", @@ -142,12 +137,7 @@ "type": "array", "value": "number", "length": 4, - "default": [ - -180, - -85.0511, - 180, - 85.0511 - ], + "default": [-180, -85.0511, 180, 85.0511], "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL." }, "minzoom": { @@ -175,7 +165,7 @@ "type": "enum", "values": { "raster": { - "doc": "A raster tile source." + "doc": "A raster tile source." } }, "doc": "The type of the source." @@ -193,12 +183,7 @@ "type": "array", "value": "number", "length": 4, - "default": [ - -180, - -85.0511, - 180, - 85.0511 - ], + "default": [-180, -85.0511, 180, 85.0511], "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL." }, "minzoom": { @@ -245,7 +230,7 @@ "type": "enum", "values": { "raster-dem": { - "doc": "A RGB-encoded raster DEM source" + "doc": "A RGB-encoded raster DEM source" } }, "doc": "The type of the source." @@ -263,12 +248,7 @@ "type": "array", "value": "number", "length": 4, - "default": [ - -180, - -85.0511, - 180, - 85.0511 - ], + "default": [-180, -85.0511, 180, 85.0511], "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL." }, "minzoom": { @@ -580,10 +560,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -595,8 +575,7 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "property-type": "constant" + } } }, "layout_fill": { @@ -604,10 +583,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -619,8 +598,7 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "property-type": "constant" + } } }, "layout_circle": { @@ -628,10 +606,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -643,8 +621,7 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "property-type": "constant" + } } }, "layout_heatmap": { @@ -652,10 +629,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -664,8 +641,7 @@ "basic functionality": { "js": "0.41.0" } - }, - "property-type": "constant" + } } }, "layout_fill-extrusion": { @@ -673,10 +649,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -688,22 +664,23 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "property-type": "constant" + } } }, "layout_line": { "line-cap": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "butt": { - "doc": "A cap with a squared-off end which is drawn to the exact endpoint of the line." + "doc": "A cap with a squared-off end which is drawn to the exact endpoint of the line." }, "round": { - "doc": "A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line." + "doc": "A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line." }, "square": { - "doc": "A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width." + "doc": "A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width." } }, "default": "butt", @@ -716,26 +693,22 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "line-join": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": { "bevel": { - "doc": "A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width." + "doc": "A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width." }, "round": { - "doc": "A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line." + "doc": "A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the line's width and centered on the endpoint of the line." }, "miter": { - "doc": "A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet." + "doc": "A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet." } }, "default": "miter", @@ -753,19 +726,13 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-miter-limit": { "type": "number", "default": 2, + "function": "interpolated", + "zoom-function": true, "doc": "Used to automatically convert miter joins to bevel joins for sharp angles.", "requires": [ { @@ -780,18 +747,13 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "line-round-limit": { "type": "number", "default": 1.05, + "function": "interpolated", + "zoom-function": true, "doc": "Used to automatically convert round joins to miter joins for shallow angles.", "requires": [ { @@ -806,23 +768,16 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "visibility": { "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -835,20 +790,21 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "property-type": "constant" + } } }, "layout_symbol": { "symbol-placement": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { - "point": { - "doc": "The label is placed at the point where the geometry is located." - }, - "line": { - "doc": "The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries." - } + "point": { + "doc": "The label is placed at the point where the geometry is located." + }, + "line": { + "doc": "The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries." + } }, "default": "point", "doc": "Label placement relative to its geometry.", @@ -860,19 +816,14 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "symbol-spacing": { "type": "number", "default": 250, "minimum": 1, + "function": "interpolated", + "zoom-function": true, "units": "pixels", "doc": "Distance between two symbol anchors.", "requires": [ @@ -888,17 +839,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "symbol-avoid-edges": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.", "sdk-support": { @@ -909,17 +855,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-allow-overlap": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, the icon will be visible even if it collides with other previously drawn symbols.", "requires": [ @@ -933,17 +874,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-ignore-placement": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the icon.", "requires": [ @@ -957,17 +893,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-optional": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.", "requires": [ @@ -982,26 +913,21 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-rotation-alignment": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "When `symbol-placement` is set to `point`, aligns icons east-west. When `symbol-placement` is set to `line`, aligns icon x-axes with the line." + "doc": "When `symbol-placement` is set to `point`, aligns icons east-west. When `symbol-placement` is set to `line`, aligns icon x-axes with the line." }, "viewport": { - "doc": "Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`." + "doc": "Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`." }, "auto": { - "doc": "When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line`, this is equivalent to `map`." + "doc": "When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line`, this is equivalent to `map`." } }, "default": "auto", @@ -1023,19 +949,15 @@ "macos": "0.3.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-size": { "type": "number", "default": 1, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "factor of the original icon size", "doc": "Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by `icon-size`. 1 is the original size; 3 triples the size of the image.", "requires": [ @@ -1054,30 +976,24 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-text-fit": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "none": { - "doc": "The icon is displayed at its intrinsic aspect ratio." + "doc": "The icon is displayed at its intrinsic aspect ratio." }, "width": { - "doc": "The icon is scaled in the x-dimension to fit the width of the text." + "doc": "The icon is scaled in the x-dimension to fit the width of the text." }, "height": { - "doc": "The icon is scaled in the y-dimension to fit the height of the text." + "doc": "The icon is scaled in the y-dimension to fit the height of the text." }, "both": { - "doc": "The icon is scaled in both x- and y-dimensions." + "doc": "The icon is scaled in both x- and y-dimensions." } }, "default": "none", @@ -1094,14 +1010,7 @@ "macos": "0.2.1" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-text-fit-padding": { "type": "array", @@ -1114,6 +1023,8 @@ 0 ], "units": "pixels", + "function": "interpolated", + "zoom-function": true, "doc": "Size of the additional area added to dimensions determined by `icon-text-fit`, in clockwise order: top, right, bottom, left.", "requires": [ "icon-image", @@ -1134,17 +1045,13 @@ "macos": "0.2.1" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-image": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "doc": "Name of image in sprite to use for drawing an image background.", "tokens": true, "sdk-support": { @@ -1160,20 +1067,15 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-rotate": { "type": "number", "default": 0, "period": 360, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "units": "degrees", "doc": "Rotates the icon clockwise.", "requires": [ @@ -1192,20 +1094,14 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-padding": { "type": "number", "default": 2, "minimum": 0, + "function": "interpolated", + "zoom-function": true, "units": "pixels", "doc": "Size of the additional area around the icon bounding box used for detecting symbol collisions.", "requires": [ @@ -1219,17 +1115,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-keep-upright": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, the icon may be flipped to prevent it from being rendered upside-down.", "requires": [ @@ -1249,14 +1140,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-offset": { "type": "array", @@ -1266,6 +1150,9 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of `icon-size` to obtain the final offset in pixels. When combined with `icon-rotate` the offset will be as if the rotated direction was up.", "requires": [ "icon-image" @@ -1283,45 +1170,40 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": { "center": { - "doc": "The center of the icon is placed closest to the anchor." + "doc": "The center of the icon is placed closest to the anchor." }, "left": { - "doc": "The left side of the icon is placed closest to the anchor." + "doc": "The left side of the icon is placed closest to the anchor." }, "right": { - "doc": "The right side of the icon is placed closest to the anchor." + "doc": "The right side of the icon is placed closest to the anchor." }, "top": { - "doc": "The top of the icon is placed closest to the anchor." + "doc": "The top of the icon is placed closest to the anchor." }, "bottom": { - "doc": "The bottom of the icon is placed closest to the anchor." + "doc": "The bottom of the icon is placed closest to the anchor." }, "top-left": { - "doc": "The top left corner of the icon is placed closest to the anchor." + "doc": "The top left corner of the icon is placed closest to the anchor." }, "top-right": { - "doc": "The top right corner of the icon is placed closest to the anchor." + "doc": "The top right corner of the icon is placed closest to the anchor." }, "bottom-left": { - "doc": "The bottom left corner of the icon is placed closest to the anchor." + "doc": "The bottom left corner of the icon is placed closest to the anchor." }, "bottom-right": { - "doc": "The bottom right corner of the icon is placed closest to the anchor." + "doc": "The bottom right corner of the icon is placed closest to the anchor." } }, "default": "center", @@ -1342,27 +1224,21 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-pitch-alignment": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The icon is aligned to the plane of the map." + "doc": "The icon is aligned to the plane of the map." }, "viewport": { - "doc": "The icon is aligned to the plane of the viewport." + "doc": "The icon is aligned to the plane of the viewport." }, "auto": { - "doc": "Automatically matches the value of `icon-rotation-alignment`." + "doc": "Automatically matches the value of `icon-rotation-alignment`." } }, "default": "auto", @@ -1378,26 +1254,21 @@ "macos": "0.6.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-pitch-alignment": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The text is aligned to the plane of the map." + "doc": "The text is aligned to the plane of the map." }, "viewport": { - "doc": "The text is aligned to the plane of the viewport." + "doc": "The text is aligned to the plane of the viewport." }, "auto": { - "doc": "Automatically matches the value of `text-rotation-alignment`." + "doc": "Automatically matches the value of `text-rotation-alignment`." } }, "default": "auto", @@ -1419,26 +1290,21 @@ "macos": "0.3.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-rotation-alignment": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "When `symbol-placement` is set to `point`, aligns text east-west. When `symbol-placement` is set to `line`, aligns text x-axes with the line." + "doc": "When `symbol-placement` is set to `point`, aligns text east-west. When `symbol-placement` is set to `line`, aligns text x-axes with the line." }, "viewport": { - "doc": "Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`." + "doc": "Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`." }, "auto": { - "doc": "When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line`, this is equivalent to `map`." + "doc": "When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line`, this is equivalent to `map`." } }, "default": "auto", @@ -1460,17 +1326,13 @@ "macos": "0.3.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-field": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "default": "", "tokens": true, "doc": "Value to use for a text label.", @@ -1487,23 +1349,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-font": { "type": "array", "value": "string", - "default": [ - "Open Sans Regular", - "Arial Unicode MS Regular" - ], + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, + "default": ["Open Sans Regular", "Arial Unicode MS Regular"], "doc": "Font stack to use for displaying text.", "requires": [ "text-field" @@ -1518,21 +1372,16 @@ "data-driven styling": { "js": "0.43.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-size": { "type": "number", "default": 16, "minimum": 0, "units": "pixels", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Font size.", "requires": [ "text-field" @@ -1550,21 +1399,16 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-max-width": { "type": "number", "default": 10, "minimum": 0, "units": "ems", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "The maximum line width for text wrapping.", "requires": [ "text-field" @@ -1582,20 +1426,14 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-line-height": { "type": "number", "default": 1.2, "units": "ems", + "function": "interpolated", + "zoom-function": true, "doc": "Text leading value for multi-line text.", "requires": [ "text-field" @@ -1608,19 +1446,15 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-letter-spacing": { "type": "number", "default": 0, "units": "ems", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Text tracking amount.", "requires": [ "text-field" @@ -1638,27 +1472,22 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-justify": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": { "left": { - "doc": "The text is aligned to the left." + "doc": "The text is aligned to the left." }, "center": { - "doc": "The text is centered." + "doc": "The text is centered." }, "right": { - "doc": "The text is aligned to the right." + "doc": "The text is aligned to the right." } }, "default": "center", @@ -1679,45 +1508,40 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": { "center": { - "doc": "The center of the text is placed closest to the anchor." + "doc": "The center of the text is placed closest to the anchor." }, "left": { - "doc": "The left side of the text is placed closest to the anchor." + "doc": "The left side of the text is placed closest to the anchor." }, "right": { - "doc": "The right side of the text is placed closest to the anchor." + "doc": "The right side of the text is placed closest to the anchor." }, "top": { - "doc": "The top of the text is placed closest to the anchor." + "doc": "The top of the text is placed closest to the anchor." }, "bottom": { - "doc": "The bottom of the text is placed closest to the anchor." + "doc": "The bottom of the text is placed closest to the anchor." }, "top-left": { - "doc": "The top left corner of the text is placed closest to the anchor." + "doc": "The top left corner of the text is placed closest to the anchor." }, "top-right": { - "doc": "The top right corner of the text is placed closest to the anchor." + "doc": "The top right corner of the text is placed closest to the anchor." }, "bottom-left": { - "doc": "The bottom left corner of the text is placed closest to the anchor." + "doc": "The bottom left corner of the text is placed closest to the anchor." }, "bottom-right": { - "doc": "The bottom right corner of the text is placed closest to the anchor." + "doc": "The bottom right corner of the text is placed closest to the anchor." } }, "default": "center", @@ -1738,20 +1562,14 @@ "ios": "3.7.0", "macos": "0.6.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-max-angle": { "type": "number", "default": 45, "units": "degrees", + "function": "interpolated", + "zoom-function": true, "doc": "Maximum angle change between adjacent characters.", "requires": [ "text-field", @@ -1767,20 +1585,16 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-rotate": { "type": "number", "default": 0, "period": 360, "units": "degrees", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "doc": "Rotates the text clockwise.", "requires": [ "text-field" @@ -1798,21 +1612,15 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-padding": { "type": "number", "default": 2, "minimum": 0, "units": "pixels", + "function": "interpolated", + "zoom-function": true, "doc": "Size of the additional area around the text bounding box used for detecting symbol collisions.", "requires": [ "text-field" @@ -1825,17 +1633,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-keep-upright": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": true, "doc": "If true, the text may be flipped vertically to prevent it from being rendered upside-down.", "requires": [ @@ -1855,26 +1658,22 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-transform": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "property-function": true, "values": { "none": { - "doc": "The text is not altered." + "doc": "The text is not altered." }, "uppercase": { - "doc": "Forces all letters to be displayed in uppercase." + "doc": "Forces all letters to be displayed in uppercase." }, "lowercase": { - "doc": "Forces all letters to be displayed in lowercase." + "doc": "Forces all letters to be displayed in lowercase." } }, "default": "none", @@ -1895,21 +1694,16 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-offset": { "type": "array", "doc": "Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up.", "value": "number", "units": "ems", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "length": 2, "default": [ 0, @@ -1931,18 +1725,12 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-allow-overlap": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, the text will be visible even if it collides with other previously drawn symbols.", "requires": [ @@ -1956,17 +1744,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-ignore-placement": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, other symbols can be visible even if they collide with the text.", "requires": [ @@ -1980,17 +1763,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-optional": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": false, "doc": "If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.", "requires": [ @@ -2005,23 +1783,16 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "visibility": { "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -2034,8 +1805,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "property-type": "constant" + } } }, "layout_raster": { @@ -2043,10 +1813,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -2059,8 +1829,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "property-type": "constant" + } } }, "layout_hillshade": { @@ -2068,10 +1837,10 @@ "type": "enum", "values": { "visible": { - "doc": "The layer is shown." + "doc": "The layer is shown." }, "none": { - "doc": "The layer is not shown." + "doc": "The layer is not shown." } }, "default": "visible", @@ -2081,8 +1850,7 @@ "js": "0.43.0" }, "data-driven styling": {} - }, - "property-type": "constant" + } } }, "filter": { @@ -2094,43 +1862,43 @@ "type": "enum", "values": { "==": { - "doc": "`[\"==\", key, value]` equality: `feature[key] = value`" + "doc": "`[\"==\", key, value]` equality: `feature[key] = value`" }, "!=": { - "doc": "`[\"!=\", key, value]` inequality: `feature[key] ≠ value`" + "doc": "`[\"!=\", key, value]` inequality: `feature[key] ≠ value`" }, ">": { - "doc": "`[\">\", key, value]` greater than: `feature[key] > value`" + "doc": "`[\">\", key, value]` greater than: `feature[key] > value`" }, ">=": { - "doc": "`[\">=\", key, value]` greater than or equal: `feature[key] ≥ value`" + "doc": "`[\">=\", key, value]` greater than or equal: `feature[key] ≥ value`" }, "<": { - "doc": "`[\"<\", key, value]` less than: `feature[key] < value`" + "doc": "`[\"<\", key, value]` less than: `feature[key] < value`" }, "<=": { - "doc": "`[\"<=\", key, value]` less than or equal: `feature[key] ≤ value`" + "doc": "`[\"<=\", key, value]` less than or equal: `feature[key] ≤ value`" }, "in": { - "doc": "`[\"in\", key, v0, ..., vn]` set inclusion: `feature[key] ∈ {v0, ..., vn}`" + "doc": "`[\"in\", key, v0, ..., vn]` set inclusion: `feature[key] ∈ {v0, ..., vn}`" }, "!in": { - "doc": "`[\"!in\", key, v0, ..., vn]` set exclusion: `feature[key] ∉ {v0, ..., vn}`" + "doc": "`[\"!in\", key, v0, ..., vn]` set exclusion: `feature[key] ∉ {v0, ..., vn}`" }, "all": { - "doc": "`[\"all\", f0, ..., fn]` logical `AND`: `f0 ∧ ... ∧ fn`" + "doc": "`[\"all\", f0, ..., fn]` logical `AND`: `f0 ∧ ... ∧ fn`" }, "any": { - "doc": "`[\"any\", f0, ..., fn]` logical `OR`: `f0 ∨ ... ∨ fn`" + "doc": "`[\"any\", f0, ..., fn]` logical `OR`: `f0 ∨ ... ∨ fn`" }, "none": { - "doc": "`[\"none\", f0, ..., fn]` logical `NOR`: `¬f0 ∧ ... ∧ ¬fn`" + "doc": "`[\"none\", f0, ..., fn]` logical `NOR`: `¬f0 ∧ ... ∧ ¬fn`" }, "has": { - "doc": "`[\"has\", key]` `feature[key]` exists" + "doc": "`[\"has\", key]` `feature[key]` exists" }, "!has": { - "doc": "`[\"!has\", key]` `feature[key]` does not exist" + "doc": "`[\"!has\", key]` `feature[key]` does not exist" } }, "doc": "The filter operator." @@ -2139,13 +1907,13 @@ "type": "enum", "values": { "Point": { - "doc": "Filter to point geometries." + "doc": "Filter to point geometries." }, "LineString": { - "doc": "Filter to line geometries." + "doc": "Filter to line geometries." }, "Polygon": { - "doc": "Filter to polygon geometries." + "doc": "Filter to polygon geometries." } }, "doc": "The geometry type for the filter to select." @@ -2174,18 +1942,18 @@ "type": { "type": "enum", "values": { - "identity": { - "doc": "Return the input value as the output value." - }, - "exponential": { - "doc": "Generate an output by interpolating between stops just less than and just greater than the function input." - }, - "interval": { - "doc": "Return the output value of the stop just less than the function input." - }, - "categorical": { - "doc": "Return the output value of the stop equal to the function input." - } + "identity": { + "doc": "Return the input value as the output value." + }, + "exponential": { + "doc": "Generate an output by interpolating between stops just less than and just greater than the function input." + }, + "interval": { + "doc": "Return the output value of the stop just less than the function input." + }, + "categorical": { + "doc": "Return the output value of the stop equal to the function input." + } }, "doc": "The interpolation strategy to use in function evaluation.", "default": "exponential" @@ -2193,15 +1961,15 @@ "colorSpace": { "type": "enum", "values": { - "rgb": { - "doc": "Use the RGB color space to interpolate color values" - }, - "lab": { - "doc": "Use the LAB color space to interpolate color values." - }, - "hcl": { - "doc": "Use the HCL color space to interpolate color values, interpolating the Hue, Chroma, and Luminance channels individually." - } + "rgb": { + "doc": "Use the RGB color space to interpolate color values" + }, + "lab": { + "doc": "Use the LAB color space to interpolate color values." + }, + "hcl": { + "doc": "Use the HCL color space to interpolate color values, interpolating the Hue, Chroma, and Luminance channels individually." + } }, "doc": "The color space in which colors interpolated. Interpolating colors in perceptual color spaces like LAB and HCL tend to produce color ramps that look more consistent and produce colors that can be differentiated more easily than those interpolated in RGB space.", "default": "rgb" @@ -2278,7 +2046,7 @@ } } }, - "case": { + "case": { "doc": "Selects the first output whose corresponding test condition evaluates to true.", "group": "Decision", "sdk-support": { @@ -2872,14 +2640,10 @@ "doc": "The position of the light source is aligned to the rotation of the viewport." } }, - "property-type": "data-constant", "transition": false, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, + "zoom-function": true, + "property-function": false, + "function": "piecewise-constant", "doc": "Whether extruded geometries are lit relative to the map or viewport.", "example": "map", "sdk-support": { @@ -2893,27 +2657,15 @@ }, "position": { "type": "array", - "default": [ - 1.15, - 210, - 30 - ], + "default": [1.15, 210, 30], "length": 3, "value": "number", - "property-type": "data-constant", "transition": true, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, + "function": "interpolated", + "zoom-function": true, + "property-function": false, "doc": "Position of the light source relative to lit (extruded) geometries, in [r radial coordinate, a azimuthal angle, p polar angle] where r indicates the distance from the center of the base of an object to its light, a indicates the position of the light relative to 0° (0° when `light.anchor` is set to `viewport` corresponds to the top of the viewport, or 0° when `light.anchor` is set to `map` corresponds to due north, and degrees proceed clockwise), and p indicates the height of the light (from 0°, directly above, to 180°, directly below).", - "example": [ - 1.5, - 90, - 80 - ], + "example": [1.5, 90, 80], "sdk-support": { "basic functionality": { "js": "0.27.0", @@ -2925,14 +2677,10 @@ }, "color": { "type": "color", - "property-type": "data-constant", "default": "#ffffff", - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, + "function": "interpolated", + "zoom-function": true, + "property-function": false, "transition": true, "doc": "Color tint for lighting extruded geometries.", "sdk-support": { @@ -2946,16 +2694,12 @@ }, "intensity": { "type": "number", - "property-type": "data-constant", "default": 0.5, "minimum": 0, "maximum": 1, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, + "function": "interpolated", + "zoom-function": true, + "property-function": false, "transition": true, "doc": "Intensity of lighting (on a scale from 0 to 1). Higher numbers will present as more extreme contrast.", "sdk-support": { @@ -2982,6 +2726,8 @@ "paint_fill": { "fill-antialias": { "type": "boolean", + "function": "piecewise-constant", + "zoom-function": true, "default": true, "doc": "Whether or not the fill should be antialiased.", "sdk-support": { @@ -2992,17 +2738,13 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-opacity": { "type": "number", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, @@ -3021,20 +2763,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "fill-color": { "type": "color", "default": "#000000", "doc": "The color of the filled part of this layer. This color can be specified as `rgba` with an alpha component and the color's opacity will not affect the opacity of the 1px stroke, if it is used.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -3054,19 +2791,14 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "fill-outline-color": { "type": "color", "doc": "The outline color of the fill. Matches the value of `fill-color` if unspecified.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -3089,15 +2821,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "fill-translate": { "type": "array", @@ -3107,6 +2831,8 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", @@ -3118,23 +2844,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The fill is translated relative to the map." + "doc": "The fill is translated relative to the map." }, "viewport": { - "doc": "The fill is translated relative to the viewport." + "doc": "The fill is translated relative to the viewport." } }, "doc": "Controls the frame of reference for `fill-translate`.", @@ -3150,17 +2871,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-pattern": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, "transition": true, "doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.", "sdk-support": { @@ -3171,19 +2887,15 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "cross-faded" + } } }, "paint_fill-extrusion": { "fill-extrusion-opacity": { "type": "number", + "function": "interpolated", + "zoom-function": true, + "property-function": false, "default": 1, "minimum": 0, "maximum": 1, @@ -3196,19 +2908,15 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-extrusion-color": { "type": "color", "default": "#000000", "doc": "The base color of the extruded fill. The extrusion's surfaces will be shaded differently based on this color in combination with the root `light` settings. If this color is specified as `rgba` with an alpha component, the alpha component will be ignored; use `fill-extrusion-opacity` to set layer opacity.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -3228,15 +2936,7 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "fill-extrusion-translate": { "type": "array", @@ -3246,6 +2946,8 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively.", @@ -3257,23 +2959,18 @@ "macos": "0.5.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-extrusion-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The fill extrusion is translated relative to the map." + "doc": "The fill extrusion is translated relative to the map." }, "viewport": { - "doc": "The fill extrusion is translated relative to the viewport." + "doc": "The fill extrusion is translated relative to the viewport." } }, "doc": "Controls the frame of reference for `fill-extrusion-translate`.", @@ -3289,17 +2986,12 @@ "macos": "0.5.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "fill-extrusion-pattern": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, "transition": true, "doc": "Name of image in sprite to use for drawing images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.", "sdk-support": { @@ -3310,17 +3002,13 @@ "macos": "0.5.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "cross-faded" + } }, "fill-extrusion-height": { "type": "number", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 0, "minimum": 0, "units": "meters", @@ -3339,18 +3027,13 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "fill-extrusion-base": { "type": "number", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 0, "minimum": 0, "units": "meters", @@ -3372,21 +3055,16 @@ "ios": "3.6.0", "macos": "0.5.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } } }, "paint_line": { "line-opacity": { "type": "number", "doc": "The opacity at which the line will be drawn.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "default": 1, "minimum": 0, "maximum": 1, @@ -3404,20 +3082,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-color": { "type": "color", "doc": "The color with which the line will be drawn.", "default": "#000000", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ { @@ -3437,15 +3110,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-translate": { "type": "array", @@ -3455,6 +3120,8 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", @@ -3466,23 +3133,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "line-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The line is translated relative to the map." + "doc": "The line is translated relative to the map." }, "viewport": { - "doc": "The line is translated relative to the viewport." + "doc": "The line is translated relative to the viewport." } }, "doc": "Controls the frame of reference for `line-translate`.", @@ -3498,19 +3160,15 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "line-width": { "type": "number", "default": 1, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Stroke thickness.", @@ -3524,21 +3182,16 @@ "data-driven styling": { "js": "0.39.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-gap-width": { "type": "number", "default": 0, "minimum": 0, "doc": "Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "sdk-support": { @@ -3554,20 +3207,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-offset": { "type": "number", "default": 0, "doc": "The line's offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "sdk-support": { @@ -3583,20 +3231,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-blur": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Blur applied to the line, in pixels.", @@ -3613,19 +3256,13 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "line-dasharray": { "type": "array", "value": "number", + "function": "piecewise-constant", + "zoom-function": true, "doc": "Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels.", "minimum": 0, "transition": true, @@ -3643,17 +3280,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "cross-faded" + } }, "line-pattern": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, "transition": true, "doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.", "sdk-support": { @@ -3664,18 +3296,14 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "cross-faded" + } }, "line-gradient": { "type": "color", "doc": "Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify `\"lineMetrics\": true`.", + "function": "interpolated", + "zoom-function": false, + "property-function": false, "transition": false, "requires": [ { @@ -3696,14 +3324,7 @@ "js": "0.45.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "line-progress" - ] - }, - "property-type": "color-ramp" + } } }, "paint_circle": { @@ -3711,6 +3332,9 @@ "type": "number", "default": 5, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Circle radius.", @@ -3727,20 +3351,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-color": { "type": "color", "default": "#000000", "doc": "The fill color of the circle.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -3755,20 +3374,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-blur": { "type": "number", "default": 0, "doc": "Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -3783,15 +3397,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-opacity": { "type": "number", @@ -3799,6 +3405,9 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -3813,24 +3422,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-translate": { "type": "array", "value": "number", "length": 2, - "default": [ - 0, - 0 - ], + "default": [0, 0], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively.", @@ -3842,23 +3442,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "circle-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The circle is translated relative to the map." + "doc": "The circle is translated relative to the map." }, "viewport": { - "doc": "The circle is translated relative to the viewport." + "doc": "The circle is translated relative to the viewport." } }, "doc": "Controls the frame of reference for `circle-translate`.", @@ -3874,23 +3469,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "circle-pitch-scale": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "Circles are scaled according to their apparent distance to the camera." + "doc": "Circles are scaled according to their apparent distance to the camera." }, "viewport": { - "doc": "Circles are not scaled." + "doc": "Circles are not scaled." } }, "default": "map", @@ -3903,23 +3493,18 @@ "macos": "0.2.1" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "circle-pitch-alignment": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The circle is aligned to the plane of the map." + "doc": "The circle is aligned to the plane of the map." }, "viewport": { - "doc": "The circle is aligned to the plane of the viewport." + "doc": "The circle is aligned to the plane of the viewport." } }, "default": "viewport", @@ -3932,19 +3517,15 @@ "macos": "0.6.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "circle-stroke-width": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "The width of the circle's stroke. Strokes are placed outside of the `circle-radius`.", @@ -3961,20 +3542,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-stroke-color": { "type": "color", "default": "#000000", "doc": "The stroke color of the circle.", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -3989,15 +3565,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "circle-stroke-opacity": { "type": "number", @@ -4005,6 +3573,9 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -4019,15 +3590,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } } }, "paint_heatmap": { @@ -4035,6 +3598,9 @@ "type": "number", "default": 30, "minimum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed.", @@ -4045,20 +3611,15 @@ "data-driven styling": { "js": "0.43.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "heatmap-weight": { "type": "number", "default": 1, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": false, "doc": "A measure of how much an individual point contributes to the heatmap. A value of 10 would be equivalent to having 10 points of weight 1 in the same spot. Especially useful when combined with clustering.", "sdk-support": { @@ -4068,20 +3629,15 @@ "data-driven styling": { "js": "0.41.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "heatmap-intensity": { "type": "number", "default": 1, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": false, "transition": true, "doc": "Similar to `heatmap-weight` but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level.", "sdk-support": { @@ -4089,53 +3645,32 @@ "js": "0.41.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "heatmap-color": { "type": "color", "default": [ "interpolate", - [ - "linear" - ], - [ - "heatmap-density" - ], - 0, - "rgba(0, 0, 255, 0)", - 0.1, - "royalblue", - 0.3, - "cyan", - 0.5, - "lime", - 0.7, - "yellow", - 1, - "red" + ["linear"], + ["heatmap-density"], + 0, "rgba(0, 0, 255, 0)", + 0.1, "royalblue", + 0.3, "cyan", + 0.5, "lime", + 0.7, "yellow", + 1, "red" ], "doc": "Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `[\"heatmap-density\"]` as input.", + "function": "interpolated", + "zoom-function": false, + "property-function": false, "transition": false, "sdk-support": { "basic functionality": { "js": "0.41.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "heatmap-density" - ] - }, - "property-type": "color-ramp" + } }, "heatmap-opacity": { "type": "number", @@ -4143,20 +3678,16 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": false, "transition": true, "sdk-support": { "basic functionality": { "js": "0.41.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } } }, "paint_symbol": { @@ -4166,6 +3697,9 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "icon-image" @@ -4183,19 +3717,14 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-color": { "type": "color", "default": "#000000", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon. This can only be used with sdf icons.", "requires": [ @@ -4214,19 +3743,14 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the icon's halo. Icon halos can only be used with SDF icons.", "requires": [ @@ -4245,20 +3769,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-halo-width": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the icon outline.", @@ -4278,20 +3797,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-halo-blur": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Fade out the halo towards the outside.", @@ -4311,15 +3825,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "icon-translate": { "type": "array", @@ -4329,6 +3835,8 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", @@ -4343,23 +3851,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "icon-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "Icons are translated relative to the map." + "doc": "Icons are translated relative to the map." }, "viewport": { - "doc": "Icons are translated relative to the viewport." + "doc": "Icons are translated relative to the viewport." } }, "doc": "Controls the frame of reference for `icon-translate`.", @@ -4376,14 +3879,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-opacity": { "type": "number", @@ -4391,6 +3887,9 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" @@ -4408,20 +3907,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-color": { "type": "color", "doc": "The color with which the text will be drawn.", "default": "#000000", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "requires": [ "text-field" @@ -4439,19 +3933,14 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-halo-color": { "type": "color", "default": "rgba(0, 0, 0, 0)", + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "doc": "The color of the text's halo, which helps it stand out from backgrounds.", "requires": [ @@ -4470,20 +3959,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-halo-width": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.", @@ -4503,20 +3987,15 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-halo-blur": { "type": "number", "default": 0, "minimum": 0, + "function": "interpolated", + "zoom-function": true, + "property-function": true, "transition": true, "units": "pixels", "doc": "The halo's fadeout distance towards the outside.", @@ -4536,15 +4015,7 @@ "ios": "3.5.0", "macos": "0.4.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom", - "feature" - ] - }, - "property-type": "data-driven" + } }, "text-translate": { "type": "array", @@ -4554,6 +4025,8 @@ 0, 0 ], + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "pixels", "doc": "Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.", @@ -4568,23 +4041,18 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "text-translate-anchor": { "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, "values": { "map": { - "doc": "The text is translated relative to the map." + "doc": "The text is translated relative to the map." }, "viewport": { - "doc": "The text is translated relative to the viewport." + "doc": "The text is translated relative to the viewport." } }, "doc": "Controls the frame of reference for `text-translate`.", @@ -4601,14 +4069,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } } }, "paint_raster": { @@ -4618,6 +4079,8 @@ "default": 1, "minimum": 0, "maximum": 1, + "function": "interpolated", + "zoom-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -4627,19 +4090,14 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-hue-rotate": { "type": "number", "default": 0, "period": 360, + "function": "interpolated", + "zoom-function": true, "transition": true, "units": "degrees", "doc": "Rotates hues around the color wheel.", @@ -4651,17 +4109,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-brightness-min": { "type": "number", + "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the minimum brightness.", "default": 0, "minimum": 0, @@ -4675,17 +4128,12 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-brightness-max": { "type": "number", + "function": "interpolated", + "zoom-function": true, "doc": "Increase or reduce the brightness of the image. The value is the maximum brightness.", "default": 1, "minimum": 0, @@ -4699,14 +4147,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-saturation": { "type": "number", @@ -4714,6 +4155,8 @@ "default": 0, "minimum": -1, "maximum": 1, + "function": "interpolated", + "zoom-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -4723,14 +4166,7 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-contrast": { "type": "number", @@ -4738,6 +4174,8 @@ "default": 0, "minimum": -1, "maximum": 1, + "function": "interpolated", + "zoom-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -4747,19 +4185,14 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "raster-fade-duration": { "type": "number", "default": 300, "minimum": 0, + "function": "interpolated", + "zoom-function": true, "transition": false, "units": "milliseconds", "doc": "Fade duration when a new tile is added.", @@ -4771,148 +4204,113 @@ "macos": "0.1.0" }, "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } } }, "paint_hillshade": { - "hillshade-illumination-direction": { - "type": "number", - "default": 335, - "minimum": 0, - "maximum": 359, - "doc": "The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshade-illumination-anchor` is set to `viewport` and due north if `hillshade-illumination-anchor` is set to `map`.", - "transition": false, - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - }, - "hillshade-illumination-anchor": { - "type": "enum", - "values": { - "map": { - "doc": "The hillshade illumination is relative to the north direction." + "hillshade-illumination-direction": { + "type": "number", + "default": 335, + "minimum": 0, + "maximum": 359, + "doc": "The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshade-illumination-anchor` is set to `viewport` and due north if `hillshade-illumination-anchor` is set to `map`.", + "function": "interpolated", + "zoom-function": true, + "transition": false, + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} + } + }, + "hillshade-illumination-anchor": { + "type": "enum", + "function": "piecewise-constant", + "zoom-function": true, + "values": { + "map": { + "doc": "The hillshade illumination is relative to the north direction." + }, + "viewport": { + "doc": "The hillshade illumination is relative to the top of the viewport." + } }, - "viewport": { - "doc": "The hillshade illumination is relative to the top of the viewport." + "default": "viewport", + "doc": "Direction of light source when map is rotated.", + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} + } + }, + "hillshade-exaggeration": { + "type": "number", + "doc": "Intensity of the hillshade", + "default": 0.5, + "minimum": 0, + "maximum": 1, + "function": "interpolated", + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} + } + }, + "hillshade-shadow-color": { + "type": "color", + "default": "#000000", + "doc": "The shading color of areas that face away from the light source.", + "function": "interpolated", + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} + } + }, + "hillshade-highlight-color": { + "type": "color", + "default": "#FFFFFF", + "doc": "The shading color of areas that faces towards the light source.", + "function": "interpolated", + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} + } + }, + "hillshade-accent-color": { + "type": "color", + "default": "#000000", + "doc": "The shading color used to accentuate rugged terrain like sharp cliffs and gorges.", + "function": "interpolated", + "zoom-function": true, + "transition": true, + "sdk-support": { + "basic functionality": { + "js": "0.43.0" + }, + "data-driven styling": {} } - }, - "default": "viewport", - "doc": "Direction of light source when map is rotated.", - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - }, - "hillshade-exaggeration": { - "type": "number", - "doc": "Intensity of the hillshade", - "default": 0.5, - "minimum": 0, - "maximum": 1, - "transition": true, - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - }, - "hillshade-shadow-color": { - "type": "color", - "default": "#000000", - "doc": "The shading color of areas that face away from the light source.", - "transition": true, - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - }, - "hillshade-highlight-color": { - "type": "color", - "default": "#FFFFFF", - "doc": "The shading color of areas that faces towards the light source.", - "transition": true, - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - }, - "hillshade-accent-color": { - "type": "color", - "default": "#000000", - "doc": "The shading color used to accentuate rugged terrain like sharp cliffs and gorges.", - "transition": true, - "sdk-support": { - "basic functionality": { - "js": "0.43.0" - }, - "data-driven styling": {} - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" - } + } }, "paint_background": { "background-color": { "type": "color", "default": "#000000", "doc": "The color with which the background will be drawn.", + "function": "interpolated", + "zoom-function": true, "transition": true, "requires": [ { @@ -4926,17 +4324,12 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } }, "background-pattern": { "type": "string", + "function": "piecewise-constant", + "zoom-function": true, "transition": true, "doc": "Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.", "sdk-support": { @@ -4946,14 +4339,7 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "expression": { - "interpolated": false, - "parameters": [ - "zoom" - ] - }, - "property-type": "cross-faded" + } }, "background-opacity": { "type": "number", @@ -4961,6 +4347,8 @@ "minimum": 0, "maximum": 1, "doc": "The opacity at which the background will be drawn.", + "function": "interpolated", + "zoom-function": true, "transition": true, "sdk-support": { "basic functionality": { @@ -4969,14 +4357,7 @@ "ios": "2.0.0", "macos": "0.1.0" } - }, - "expression": { - "interpolated": true, - "parameters": [ - "zoom" - ] - }, - "property-type": "data-constant" + } } }, "transition": { diff --git a/src/style-spec/style-spec.js b/src/style-spec/style-spec.js index 94dbf749f9b..51c6ac7b92c 100644 --- a/src/style-spec/style-spec.js +++ b/src/style-spec/style-spec.js @@ -1,52 +1,51 @@ // @flow -type ExpressionType = 'data-driven' | 'cross-faded' | 'cross-faded-data-driven' | 'color-ramp' | 'data-constant' | 'constant'; -type ExpressionParameters = Array<'zoom' | 'feature' | 'heatmap-density' | 'line-progress'>; - -type ExpressionSpecification = { - interpolated: boolean, - parameters: ExpressionParameters -} - export type StylePropertySpecification = { type: 'number', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, default?: number } | { type: 'string', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, default?: string, tokens?: boolean } | { type: 'boolean', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, default?: boolean } | { type: 'enum', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, values: {[string]: {}}, default?: string } | { type: 'color', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, default?: string } | { type: 'array', value: 'number', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, length?: number, default?: Array } | { type: 'array', value: 'string', - 'property-type': ExpressionType, - expression?: ExpressionSpecification, + 'function': boolean, + 'property-function': boolean, + 'zoom-function': boolean, length?: number, default?: Array }; diff --git a/src/style-spec/util/properties.js b/src/style-spec/util/properties.js deleted file mode 100644 index dbb3ef91442..00000000000 --- a/src/style-spec/util/properties.js +++ /dev/null @@ -1,15 +0,0 @@ -// @flow - -import type {StylePropertySpecification} from '../style-spec'; - -export function supportsPropertyExpression(spec: StylePropertySpecification): boolean { - return spec['property-type'] === 'data-driven' || spec['property-type'] === 'cross-faded-data-driven'; -} - -export function supportsZoomExpression(spec: StylePropertySpecification): boolean { - return !!spec.expression && spec.expression.parameters.indexOf('zoom') > -1; -} - -export function supportsInterpolation(spec: StylePropertySpecification): boolean { - return !!spec.expression && spec.expression.interpolated; -} diff --git a/src/style-spec/validate/validate.js b/src/style-spec/validate/validate.js index 231d9ff8686..86a04072a30 100644 --- a/src/style-spec/validate/validate.js +++ b/src/style-spec/validate/validate.js @@ -54,10 +54,10 @@ export default function validate(options) { const valueSpec = options.valueSpec; const styleSpec = options.styleSpec; - if (valueSpec.expression && isFunction(unbundle(value))) { + if (valueSpec.function && isFunction(unbundle(value))) { return validateFunction(options); - } else if (valueSpec.expression && isExpression(deepUnbundle(value))) { + } else if (valueSpec.function && isExpression(deepUnbundle(value))) { return validateExpression(options); } else if (valueSpec.type && VALIDATORS[valueSpec.type]) { diff --git a/src/style-spec/validate/validate_function.js b/src/style-spec/validate/validate_function.js index f34303a06dc..573e56d290b 100644 --- a/src/style-spec/validate/validate_function.js +++ b/src/style-spec/validate/validate_function.js @@ -6,11 +6,6 @@ import validateObject from './validate_object'; import validateArray from './validate_array'; import validateNumber from './validate_number'; import { unbundle } from '../util/unbundle_jsonlint'; -import { - supportsPropertyExpression, - supportsZoomExpression, - supportsInterpolation -} from '../util/properties'; export default function validateFunction(options) { const functionValueSpec = options.valueSpec; @@ -47,14 +42,14 @@ export default function validateFunction(options) { errors.push(new ValidationError(options.key, options.value, 'missing required property "stops"')); } - if (functionType === 'exponential' && options.valueSpec.expression && !supportsInterpolation(options.valueSpec)) { + if (functionType === 'exponential' && options.valueSpec['function'] === 'piecewise-constant') { errors.push(new ValidationError(options.key, options.value, 'exponential functions not supported')); } if (options.styleSpec.$version >= 8) { - if (isPropertyFunction && !supportsPropertyExpression(options.valueSpec)) { + if (isPropertyFunction && !options.valueSpec['property-function']) { errors.push(new ValidationError(options.key, options.value, 'property functions not supported')); - } else if (isZoomFunction && !supportsZoomExpression(options.valueSpec)) { + } else if (isZoomFunction && !options.valueSpec['zoom-function'] && options.objectKey !== 'heatmap-color' && options.objectKey !== 'line-gradient') { errors.push(new ValidationError(options.key, options.value, 'zoom functions not supported')); } } @@ -165,7 +160,7 @@ export default function validateFunction(options) { if (type !== 'number' && functionType !== 'categorical') { let message = `number expected, ${type} found`; - if (supportsPropertyExpression(functionValueSpec) && functionType === undefined) { + if (functionValueSpec['property-function'] && functionType === undefined) { message += '\nIf you intended to use a categorical function, specify `"type": "categorical"`.'; } return [new ValidationError(options.key, reportValue, message)]; diff --git a/src/style-spec/validate/validate_property.js b/src/style-spec/validate/validate_property.js index 2b9349d8e30..2e3905e25b9 100644 --- a/src/style-spec/validate/validate_property.js +++ b/src/style-spec/validate/validate_property.js @@ -4,7 +4,6 @@ import ValidationError from '../error/validation_error'; import getType from '../util/get_type'; import { isFunction } from '../function'; import { unbundle, deepUnbundle } from '../util/unbundle_jsonlint'; -import { supportsPropertyExpression } from '../util/properties'; export default function validateProperty(options, propertyType) { const key = options.key; @@ -33,7 +32,7 @@ export default function validateProperty(options, propertyType) { } let tokenMatch; - if (getType(value) === 'string' && supportsPropertyExpression(valueSpec) && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) { + if (getType(value) === 'string' && valueSpec['property-function'] && !valueSpec.tokens && (tokenMatch = /^{([^}]+)}$/.exec(value))) { return [new ValidationError( key, value, `"${propertyKey}" does not support interpolation syntax\n` + diff --git a/test/expression.test.js b/test/expression.test.js index c00be9388be..1270eb185a4 100644 --- a/test/expression.test.js +++ b/test/expression.test.js @@ -11,11 +11,8 @@ if (process.argv[1] === __filename && process.argv.length > 2) { expressionSuite.run('js', { ignores, tests }, (fixture) => { const spec = Object.assign({}, fixture.propertySpec); - spec['property-type'] = 'data-driven'; - spec['expression'] = { - 'interpolated': true, - 'parameters': ['zoom', 'feature'] - }; + spec['function'] = true; + spec['property-function'] = true; const evaluateExpression = (expression, compilationResult) => { if (expression.result === 'error') { diff --git a/test/integration/expression-tests/array/implicit-2/test.json b/test/integration/expression-tests/array/implicit-2/test.json index e8e753f5c84..9b04b10922a 100644 --- a/test/integration/expression-tests/array/implicit-2/test.json +++ b/test/integration/expression-tests/array/implicit-2/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["get", "array"], "inputs": [ diff --git a/test/integration/expression-tests/array/implicit-3/test.json b/test/integration/expression-tests/array/implicit-3/test.json index 2461d871701..b95a8a09d29 100644 --- a/test/integration/expression-tests/array/implicit-3/test.json +++ b/test/integration/expression-tests/array/implicit-3/test.json @@ -3,10 +3,8 @@ "type": "array", "value": "number", "length": 2, - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["get", "array"], "inputs": [ diff --git a/test/integration/expression-tests/at/infer-array-type/test.json b/test/integration/expression-tests/at/infer-array-type/test.json index 40214772e52..f3a94b2c736 100644 --- a/test/integration/expression-tests/at/infer-array-type/test.json +++ b/test/integration/expression-tests/at/infer-array-type/test.json @@ -1,10 +1,8 @@ { "propertySpec": { "type": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["at", 1, ["literal", [1, 2, 3]]], "inputs": [], diff --git a/test/integration/expression-tests/case/basic/test.json b/test/integration/expression-tests/case/basic/test.json index 2e4c8472982..1e15af7c2d9 100644 --- a/test/integration/expression-tests/case/basic/test.json +++ b/test/integration/expression-tests/case/basic/test.json @@ -1,10 +1,8 @@ { "propertySpec": { "type": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["case", ["get", "x"], "x", ["get", "y"], "y", "otherwise"], "inputs": [ diff --git a/test/integration/expression-tests/case/infer-array-type/test.json b/test/integration/expression-tests/case/infer-array-type/test.json index 046ff1defb3..bfefa8c2ee0 100644 --- a/test/integration/expression-tests/case/infer-array-type/test.json +++ b/test/integration/expression-tests/case/infer-array-type/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": [ "case", diff --git a/test/integration/expression-tests/coalesce/infer-array-type/test.json b/test/integration/expression-tests/coalesce/infer-array-type/test.json index 1270a45ae38..00fbe793e55 100644 --- a/test/integration/expression-tests/coalesce/infer-array-type/test.json +++ b/test/integration/expression-tests/coalesce/infer-array-type/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": [ "coalesce", diff --git a/test/integration/expression-tests/constant-folding/evaluation-error/test.json b/test/integration/expression-tests/constant-folding/evaluation-error/test.json index c64ad651ccb..e9c6b8e5204 100644 --- a/test/integration/expression-tests/constant-folding/evaluation-error/test.json +++ b/test/integration/expression-tests/constant-folding/evaluation-error/test.json @@ -1,10 +1,8 @@ { "propertySpec": { "type": "color", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["step", ["get", "x"], "black", 0, "invalid", 10, "blue"], "inputs": [ diff --git a/test/integration/expression-tests/heatmap-density/basic/test.json b/test/integration/expression-tests/heatmap-density/basic/test.json index ab9885b8061..163f9eb5189 100644 --- a/test/integration/expression-tests/heatmap-density/basic/test.json +++ b/test/integration/expression-tests/heatmap-density/basic/test.json @@ -11,10 +11,8 @@ [1, "red"] ] }, - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": [ "interpolate", diff --git a/test/integration/expression-tests/interpolate/infer-array-type/test.json b/test/integration/expression-tests/interpolate/infer-array-type/test.json index 1cd7e29a781..b7a27a673a5 100644 --- a/test/integration/expression-tests/interpolate/infer-array-type/test.json +++ b/test/integration/expression-tests/interpolate/infer-array-type/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": [ "step", diff --git a/test/integration/expression-tests/interpolate/linear/test.json b/test/integration/expression-tests/interpolate/linear/test.json index 85797017172..551d6de32d3 100644 --- a/test/integration/expression-tests/interpolate/linear/test.json +++ b/test/integration/expression-tests/interpolate/linear/test.json @@ -1,10 +1,8 @@ { "propertySpec": { "type": "number", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["interpolate", ["linear"], ["get", "x"], 0, 100, 10, 200], "inputs": [ diff --git a/test/integration/expression-tests/literal/infer-empty-array-type/test.json b/test/integration/expression-tests/literal/infer-empty-array-type/test.json index 09c9e3dcb36..7c8efd5efee 100644 --- a/test/integration/expression-tests/literal/infer-empty-array-type/test.json +++ b/test/integration/expression-tests/literal/infer-empty-array-type/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "number", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["literal", []], "inputs": [], diff --git a/test/integration/expression-tests/match/infer-array-type/test.json b/test/integration/expression-tests/match/infer-array-type/test.json index d5dea55e8f2..edd51f5d9ab 100644 --- a/test/integration/expression-tests/match/infer-array-type/test.json +++ b/test/integration/expression-tests/match/infer-array-type/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": [ "match", diff --git a/test/integration/expression-tests/typecheck/array-invalid-item/test.json b/test/integration/expression-tests/typecheck/array-invalid-item/test.json index 6eeb381cee2..60b48e96a37 100644 --- a/test/integration/expression-tests/typecheck/array-invalid-item/test.json +++ b/test/integration/expression-tests/typecheck/array-invalid-item/test.json @@ -3,10 +3,8 @@ "type": "array", "value": "string", "length": 2, - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["array", "number", 2, ["get", "x"]], "inputs": [], diff --git a/test/integration/expression-tests/typecheck/array-item-subtyping/test.json b/test/integration/expression-tests/typecheck/array-item-subtyping/test.json index 89e365f56d8..0459aef101d 100644 --- a/test/integration/expression-tests/typecheck/array-item-subtyping/test.json +++ b/test/integration/expression-tests/typecheck/array-item-subtyping/test.json @@ -1,10 +1,8 @@ { "propertySpec": { "type": "array", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["array", "number", 2, ["get", "x"]], "inputs": [], diff --git a/test/integration/expression-tests/typecheck/array-length-subtyping--no-length/test.json b/test/integration/expression-tests/typecheck/array-length-subtyping--no-length/test.json index 309312db483..f34b64d145b 100644 --- a/test/integration/expression-tests/typecheck/array-length-subtyping--no-length/test.json +++ b/test/integration/expression-tests/typecheck/array-length-subtyping--no-length/test.json @@ -3,10 +3,8 @@ "type": "array", "value": "number", "length": 3, - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["array", "number", ["get", "x"]], "inputs": [], diff --git a/test/integration/expression-tests/typecheck/array-length-subtyping/test.json b/test/integration/expression-tests/typecheck/array-length-subtyping/test.json index 28b9a050aff..ce900e79625 100644 --- a/test/integration/expression-tests/typecheck/array-length-subtyping/test.json +++ b/test/integration/expression-tests/typecheck/array-length-subtyping/test.json @@ -2,10 +2,8 @@ "propertySpec": { "type": "array", "value": "string", - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["array", "string", 2, ["get", "x"]], "inputs": [], diff --git a/test/integration/expression-tests/typecheck/array-wrong-length/test.json b/test/integration/expression-tests/typecheck/array-wrong-length/test.json index 4d09e80bf3f..4c822cc2a57 100644 --- a/test/integration/expression-tests/typecheck/array-wrong-length/test.json +++ b/test/integration/expression-tests/typecheck/array-wrong-length/test.json @@ -3,10 +3,8 @@ "type": "array", "value": "number", "length": 3, - "property-type": "data-driven", - "expression": { - "parameters": ["zoom", "feature"] - } + "function": true, + "property-function": true }, "expression": ["array", "number", 2, ["get", "x"]], "inputs": [], diff --git a/test/unit/style-spec/convert_function.test.js b/test/unit/style-spec/convert_function.test.js index 9100a135dab..3901871b9ca 100644 --- a/test/unit/style-spec/convert_function.test.js +++ b/test/unit/style-spec/convert_function.test.js @@ -16,11 +16,7 @@ test('convertFunction', (t) => { const expression = convertFunction(functionValue, { type: 'string', - 'property-type': 'data-constant', - expression: { - 'interpolated': false, - 'parameters': ['zoom'] - }, + function: 'piecewise-constant', tokens: true }); t.deepEqual(expression, [ @@ -66,11 +62,7 @@ test('convertFunction', (t) => { const expression = convertFunction(functionValue, { type: 'string', - 'property-type': 'data-constant', - expression: { - 'interpolated': false, - 'parameters': ['zoom'] - } + function: 'piecewise-constant' }); t.deepEqual(expression, [ 'step', @@ -97,11 +89,7 @@ test('convertFunction', (t) => { const expression = convertFunction(functionValue, { type: 'number', - 'property-type': 'data-constant', - expression: { - 'interpolated': true, - 'parameters': ['zoom'] - } + function: 'interpolated' }); t.deepEqual(expression, [ 'interpolate', diff --git a/test/unit/style-spec/expression.test.js b/test/unit/style-spec/expression.test.js index 28683011a58..598f5f74aa7 100644 --- a/test/unit/style-spec/expression.test.js +++ b/test/unit/style-spec/expression.test.js @@ -2,16 +2,12 @@ import { test } from 'mapbox-gl-js-test'; import { createPropertyExpression } from '../../../src/style-spec/expression'; test('createPropertyExpression', (t) => { - test('prohibits non-interpolable properties from using an "interpolate" expression', (t) => { + test('prohibits piecewise-constant properties from using an "interpolate" expression', (t) => { const {result, value} = createPropertyExpression([ 'interpolate', ['linear'], ['zoom'], 0, 0, 10, 10 ], { type: 'number', - 'property-type': 'data-constant', - expression: { - 'interpolated': false, - 'parameters': ['zoom'] - } + function: 'piecewise-constant' }); t.equal(result, 'error'); t.equal(value.length, 1); @@ -28,11 +24,7 @@ test('evaluate expression', (t) => { type: 'enum', values: {a: {}, b: {}, c: {}}, default: 'a', - 'property-type': 'data-driven', - expression: { - 'interpolated': false, - 'parameters': ['zoom', 'feature'] - } + 'property-function': true }); t.stub(console, 'warn'); diff --git a/test/unit/style-spec/function.test.js b/test/unit/style-spec/function.test.js index 6528bda0129..2b315adc952 100644 --- a/test/unit/style-spec/function.test.js +++ b/test/unit/style-spec/function.test.js @@ -9,11 +9,7 @@ test('binary search', (t) => { base: 2 }, { type: 'number', - 'property-type': 'data-constant', - expression: { - 'interpolated': true, - 'parameters': ['zoom'] - } + function: 'interpolated' }).evaluate; t.equal(f({zoom: 17}), 11); @@ -30,11 +26,7 @@ test('exponential function', (t) => { base: 2 }, { type: 'number', - 'property-type': 'data-constant', - expression: { - 'interpolated': true, - 'parameters': ['zoom'] - } + function: 'interpolated' }).evaluate; t.equalWithPrecision(f({zoom: 2}), 30 / 9, 1e-6); @@ -466,16 +458,12 @@ test('exponential function', (t) => { }); test('interval function', (t) => { - t.test('is the default for non-interpolated properties', (t) => { + t.test('is the default for piecewise-constant properties', (t) => { const f = createFunction({ stops: [[-1, 11], [0, 111]] }, { type: 'number', - 'property-type': 'data-constant', - expression: { - 'interpolated': false, - 'parameters': ['zoom'] - } + function: 'piecewise-constant' }).evaluate; t.equal(f({zoom: -1.5}), 11); diff --git a/test/unit/style-spec/spec.test.js b/test/unit/style-spec/spec.test.js index b37bba7c0f9..80751ba13de 100644 --- a/test/unit/style-spec/spec.test.js +++ b/test/unit/style-spec/spec.test.js @@ -42,8 +42,6 @@ function validSchema(k, t, obj, ref, version, kind) { 'zoom-function', 'property-function', 'function-output', - 'expression', - 'property-type', 'length', 'min-length', 'required', @@ -116,18 +114,11 @@ function validSchema(k, t, obj, ref, version, kind) { // schema key function checks if (obj.function !== undefined) { - t.ok(ref.$version < 8, 'migrated to `expression` schema in v8 spec'); if (ref.$version >= 7) { t.equal(true, ['interpolated', 'piecewise-constant'].indexOf(obj.function) >= 0, `function: ${obj.function}`); } else { t.equal('boolean', typeof obj.function, `${k}.required (boolean)`); } - } else if (obj.expression !== undefined) { - const expression = obj.expression; - t.equal(true, ['data-driven', 'cross-faded-data-driven', 'cross-faded', 'color-ramp', 'data-constant'].indexOf(obj['property-type']) >= 0, `${k}.expression: property-type: ${obj['property-type']}`); - t.equal('boolean', typeof expression.interpolated, `${k}.expression.interpolated.required (boolean)`); - t.equal(true, Array.isArray(expression.parameters), `${k}.expression.parameters array`); - if (obj['property-type'] !== 'color-ramp') t.equal(true, expression.parameters.every(k => k === 'zoom' || k === 'feature')); } // schema key required checks