From d9a8d68a763e692ead7b0ca011fc6001eb549c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20Fazekas?= Date: Tue, 12 Jul 2022 10:22:00 +0200 Subject: [PATCH] chore: Update style json, generate typescript for properties --- .../components/styles/RCTMGLStyleFactory.java | 92 ++ docs/LineLayer.md | 22 + docs/SymbolLayer.md | 2 +- docs/Terrain.md | 2 +- docs/docs.json | 26 +- ios/RCTMGL-v10/RCTMGLStyle.swift | 99 ++ javascript/components/Terrain.js | 2 +- javascript/utils/MapboxStyles.ts | 1452 +++++++++++++++++ javascript/utils/styleMap.js | 120 +- scripts/autogenHelpers/globals.js | 53 +- scripts/autogenerate.js | 54 +- scripts/templates/MapboxStyles.ts.ejs | 90 + scripts/templates/RCTMGLStyle.h.ejs | 1 + scripts/templates/RCTMGLStyle.m.ejs | 1 + scripts/templates/RCTMGLStyleFactory.java.ejs | 1 + .../templates/RCTMGLStyleFactoryv10.java.ejs | 1 + style-spec/v8.json | 417 ++++- 17 files changed, 2382 insertions(+), 53 deletions(-) create mode 100644 javascript/utils/MapboxStyles.ts create mode 100644 scripts/templates/MapboxStyles.ts.ejs diff --git a/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java b/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java index 704f25bca..19060bc60 100644 --- a/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java +++ b/android/rctmgl/src/main/java-v10/com/mapbox/rctmgl/components/styles/RCTMGLStyleFactory.java @@ -16,6 +16,7 @@ import com.mapbox.maps.extension.style.layers.generated.SymbolLayer; import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer; import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer; +import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere; // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility; import com.mapbox.maps.extension.style.layers.properties.generated.*; import com.mapbox.maps.extension.style.types.StyleTransition; @@ -184,6 +185,9 @@ public void onAllImagesLoaded() { case "lineGradient": RCTMGLStyleFactory.setLineGradient(layer, styleValue); break; + case "lineTrimOffset": + RCTMGLStyleFactory.setLineTrimOffset(layer, styleValue); + break; } } } @@ -820,6 +824,38 @@ public static void setLightLayerStyle(final Light layer, RCTMGLStyle style) { } } } + public static void setAtmosphereLayerStyle(final Atmosphere layer, RCTMGLStyle style) { + List styleKeys = style.getAllStyleKeys(); + + if (styleKeys.size() == 0) { + return; + } + + for (String styleKey : styleKeys) { + final RCTMGLStyleValue styleValue = style.getStyleValueForKey(styleKey); + + switch (styleKey) { + case "range": + RCTMGLStyleFactory.setRange(layer, styleValue); + break; + case "color": + RCTMGLStyleFactory.setColor(layer, styleValue); + break; + case "highColor": + RCTMGLStyleFactory.setHighColor(layer, styleValue); + break; + case "spaceColor": + RCTMGLStyleFactory.setSpaceColor(layer, styleValue); + break; + case "horizonBlend": + RCTMGLStyleFactory.setHorizonBlend(layer, styleValue); + break; + case "starIntensity": + RCTMGLStyleFactory.setStarIntensity(layer, styleValue); + break; + } + } + } public static void setFillSortKey(FillLayer layer, RCTMGLStyleValue styleValue) { if (styleValue.isExpression()) { @@ -1141,6 +1177,14 @@ public static void setLineGradient(LineLayer layer, RCTMGLStyleValue styleValue) } } + public static void setLineTrimOffset(LineLayer layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.lineTrimOffset(styleValue.getExpression()); + } else { + layer.lineTrimOffset(styleValue.getFloatArray(VALUE_KEY)); + } + } + public static void setSymbolPlacement(SymbolLayer layer, RCTMGLStyleValue styleValue) { if (styleValue.isExpression()) { layer.symbolPlacement(styleValue.getExpression()); @@ -2433,4 +2477,52 @@ public static void setIntensityTransition(Light layer, RCTMGLStyleValue styleVal } } + public static void setRange(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.range(styleValue.getExpression()); + } else { + layer.range(styleValue.getFloatArray(VALUE_KEY)); + } + } + + public static void setColor(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.color(styleValue.getExpression()); + } else { + layer.color(styleValue.getInt(VALUE_KEY)); + } + } + + public static void setHighColor(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.highColor(styleValue.getExpression()); + } else { + layer.highColor(styleValue.getInt(VALUE_KEY)); + } + } + + public static void setSpaceColor(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.spaceColor(styleValue.getExpression()); + } else { + layer.spaceColor(styleValue.getInt(VALUE_KEY)); + } + } + + public static void setHorizonBlend(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.horizonBlend(styleValue.getExpression()); + } else { + layer.horizonBlend(styleValue.getFloat(VALUE_KEY)); + } + } + + public static void setStarIntensity(Atmosphere layer, RCTMGLStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.starIntensity(styleValue.getExpression()); + } else { + layer.starIntensity(styleValue.getFloat(VALUE_KEY)); + } + } + } diff --git a/docs/LineLayer.md b/docs/LineLayer.md index 0ca1d8a32..3d09ece33 100644 --- a/docs/LineLayer.md +++ b/docs/LineLayer.md @@ -36,6 +36,7 @@ * lineDasharray
* linePattern
* lineGradient
+* lineTrimOffset
___ @@ -582,3 +583,24 @@ Defines a gradient with which to color a line feature. Can only be used with Geo Parameters: `line-progress` +___ + +#### lineTrimOffset +Name: `lineTrimOffset` + +#### Description +The line part between [trimStart, trimEnd] will be marked as transparent to make a route vanishing effect. The line trimOff offset is based on the whole line range [0.0, 1.0]. + +#### Type +`array` +#### Default Value +`[0,0]` + +#### Minimum +`0,0` + + +#### Maximum +`1,1` + + diff --git a/docs/SymbolLayer.md b/docs/SymbolLayer.md index 3d346fbc9..9bbe91d82 100644 --- a/docs/SymbolLayer.md +++ b/docs/SymbolLayer.md @@ -572,7 +572,7 @@ ___ Name: `textField` #### Description -Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. +Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored. #### Type `formatted` diff --git a/docs/Terrain.md b/docs/Terrain.md index 47eabc320..3f52717e6 100644 --- a/docs/Terrain.md +++ b/docs/Terrain.md @@ -1,6 +1,6 @@ ## -### Terrain renders a terran +### A global modifier that elevates layers and markers based on a DEM data source. ### props | Prop | Type | Default | Required | Description | diff --git a/docs/docs.json b/docs/docs.json index 3be25821b..67749922c 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -2555,6 +2555,28 @@ ] }, "transition": false + }, + { + "name": "lineTrimOffset", + "type": "array", + "values": [], + "minimum": [ + 0, + 0 + ], + "maximum": [ + 1, + 1 + ], + "default": [ + 0, + 0 + ], + "description": "The line part between [trimStart, trimEnd] will be marked as transparent to make a route vanishing effect. The line trimOff offset is based on the whole line range [0.0, 1.0].", + "requires": [], + "disabledBy": [], + "allowedFunctionTypes": [], + "transition": false } ] }, @@ -5020,7 +5042,7 @@ "type": "formatted", "values": [], "default": "", - "description": "Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.", + "description": "Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored.", "requires": [], "disabledBy": [], "allowedFunctionTypes": [], @@ -5829,7 +5851,7 @@ ] }, "Terrain": { - "description": "Terrain renders a terran", + "description": "A global modifier that elevates layers and markers based on a DEM data source.", "displayName": "Terrain", "methods": [ { diff --git a/ios/RCTMGL-v10/RCTMGLStyle.swift b/ios/RCTMGL-v10/RCTMGLStyle.swift index 17f0dced0..ba7b13c7b 100644 --- a/ios/RCTMGL-v10/RCTMGLStyle.swift +++ b/ios/RCTMGL-v10/RCTMGLStyle.swift @@ -164,6 +164,8 @@ func lineLayer(layer: inout LineLayer, reactStyle:Dictionary, apply self.setLinePatternTransition(&layer, styleValue:styleValue); } else if (prop == "lineGradient") { self.setLineGradient(&layer, styleValue:styleValue); + } else if (prop == "lineTrimOffset") { + self.setLineTrimOffset(&layer, styleValue:styleValue); } else { // TODO throw exception } @@ -735,6 +737,38 @@ func lightLayer(layer: inout Light, reactStyle:Dictionary, applyUpd } } +func atmosphereLayer(layer: inout Atmosphere, reactStyle:Dictionary, applyUpdater: @escaping ((inout Atmosphere)->Void)->Void, isValid: @escaping () -> Bool) +{ + guard self._hasReactStyle(reactStyle) else { + fatalError("Invlalid style: \(reactStyle)") + } + + let styleProps = reactStyle.keys + for prop in styleProps { + if (prop == "__MAPBOX_STYLESHEET__") { + continue; + } + + let styleValue = RCTMGLStyleValue.make(reactStyle[prop]) + + if (prop == "range") { + self.setRange(&layer, styleValue:styleValue); + } else if (prop == "color") { + self.setColor(&layer, styleValue:styleValue); + } else if (prop == "highColor") { + self.setHighColor(&layer, styleValue:styleValue); + } else if (prop == "spaceColor") { + self.setSpaceColor(&layer, styleValue:styleValue); + } else if (prop == "horizonBlend") { + self.setHorizonBlend(&layer, styleValue:styleValue); + } else if (prop == "starIntensity") { + self.setStarIntensity(&layer, styleValue:styleValue); + } else { + // TODO throw exception + } + } +} + @@ -1036,6 +1070,15 @@ func setLineGradient(_ layer: inout LineLayer, styleValue: RCTMGLStyleValue) } +func setLineTrimOffset(_ layer: inout LineLayer, styleValue: RCTMGLStyleValue) +{ + + + layer.lineTrimOffset = styleValue.mglStyleValueArrayNumber(); + + +} + func setSymbolPlacement(_ layer: inout SymbolLayer, styleValue: RCTMGLStyleValue) @@ -2312,6 +2355,62 @@ func setIntensityTransition(_ layer: inout Light, styleValue: RCTMGLStyleValue) +func setRange(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.range = styleValue.mglStyleValueArrayNumber(); + + +} + +func setColor(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.color = styleValue.mglStyleValueColor(); + + +} + +func setHighColor(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.highColor = styleValue.mglStyleValueColor(); + + +} + +func setSpaceColor(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.spaceColor = styleValue.mglStyleValueColor(); + + +} + +func setHorizonBlend(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.horizonBlend = styleValue.mglStyleValueNumber(); + + +} + +func setStarIntensity(_ layer: inout Atmosphere, styleValue: RCTMGLStyleValue) +{ + + + layer.starIntensity = styleValue.mglStyleValueNumber(); + + +} + + + func _hasReactStyle(_ reactStyle: Dictionary) -> Bool { return reactStyle != nil && reactStyle.keys.count > 0; diff --git a/javascript/components/Terrain.js b/javascript/components/Terrain.js index 71678b0a5..1ca9c8709 100644 --- a/javascript/components/Terrain.js +++ b/javascript/components/Terrain.js @@ -11,7 +11,7 @@ const MapboxGL = NativeModules.MGLModule; export const NATIVE_MODULE_NAME = 'RCTMGLTerrain'; /** - * Terrain renders a terran + * A global modifier that elevates layers and markers based on a DEM data source. */ class Terrain extends React.PureComponent { static propTypes = { diff --git a/javascript/utils/MapboxStyles.ts b/javascript/utils/MapboxStyles.ts new file mode 100644 index 000000000..1f41562d0 --- /dev/null +++ b/javascript/utils/MapboxStyles.ts @@ -0,0 +1,1452 @@ +/* This file was generated from MapboxStyle.ts.ejs do not modify */ + +export type Translation = { x: number; y: number } | [number, number]; + +export interface Transition { + duration: number; + delay: number; +} + +type ExpressionName = + // Types + | 'array' + | 'boolean' + | 'collator' + | 'format' + | 'image' + | 'literal' + | 'number' + | 'number-format' + | 'object' + | 'string' + | 'to-boolean' + | 'to-color' + | 'to-number' + | 'to-string' + | 'typeof' + // Feature data + | 'accumulated' + | 'feature-state' + | 'geometry-type' + | 'id' + | 'line-progress' + | 'properties' + // Lookup + | 'at' + | 'get' + | 'has' + | 'in' + | 'index-of' + | 'length' + | 'slice' + // Decision + | '!' + | '!=' + | '<' + | '<=' + | '==' + | '>' + | '>=' + | 'all' + | 'any' + | 'case' + | 'match' + | 'coalesce' + | 'within' + // Ramps, scales, curves + | 'interpolate' + | 'interpolate-hcl' + | 'interpolate-lab' + | 'step' + // Variable binding + | 'let' + | 'var' + // String + | 'concat' + | 'downcase' + | 'is-supported-script' + | 'resolved-locale' + | 'upcase' + // Color + | 'rgb' + | 'rgba' + | 'to-rgba' + // Math + | '-' + | '*' + | '/' + | '%' + | '^' + | '+' + | 'abs' + | 'acos' + | 'asin' + | 'atan' + | 'ceil' + | 'cos' + | 'distance' + | 'e' + | 'floor' + | 'ln' + | 'ln2' + | 'log10' + | 'log2' + | 'max' + | 'min' + | 'pi' + | 'round' + | 'sin' + | 'sqrt' + | 'tan' + // Zoom, Heatmap + | 'zoom' + | 'heatmap-density'; + +type ExpressionField = + | string + | number + | boolean + | Expression + | ExpressionField[] + | { [key: string]: ExpressionField }; + +export type Expression = [ExpressionName, ...ExpressionField[]]; + +type ExpressionParameters = + | 'zoom' + | 'feature' + | 'feature-state' + | 'sky-radial-progress' + | 'line-progress' + | 'heatmap-density'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type Value = + | T + | Expression; + +enum VisibilityEnum { + /** The layer is shown. */ + Visible = 'visible', + /** The layer is not shown. */ + None = 'none', +} +enum FillTranslateAnchorEnum { + /** The fill is translated relative to the map. */ + Map = 'map', + /** The fill is translated relative to the viewport. */ + Viewport = 'viewport', +} +enum LineCapEnum { + /** A cap with a squared-off end which is drawn to the exact endpoint of the line. */ + Butt = 'butt', + /** 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. */ + Round = 'round', + /** 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. */ + Square = 'square', +} +enum LineJoinEnum { + /** 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. */ + Bevel = 'bevel', + /** 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. */ + Round = 'round', + /** A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet. */ + Miter = 'miter', +} +enum LineTranslateAnchorEnum { + /** The line is translated relative to the map. */ + Map = 'map', + /** The line is translated relative to the viewport. */ + Viewport = 'viewport', +} +enum SymbolPlacementEnum { + /** The label is placed at the point where the geometry is located. */ + Point = 'point', + /** The label is placed along the line of the geometry. Can only be used on `LineString` and `Polygon` geometries. */ + Line = 'line', + /** The label is placed at the center of the line of the geometry. Can only be used on `LineString` and `Polygon` geometries. Note that a single feature in a vector tile may contain multiple line geometries. */ + LineCenter = 'line-center', +} +enum SymbolZOrderEnum { + /** Sorts symbols by `symbol-sort-key` if set. Otherwise, sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`. */ + Auto = 'auto', + /** Sorts symbols by their y-position relative to the viewport if `icon-allow-overlap` or `text-allow-overlap` is set to `true` or `icon-ignore-placement` or `text-ignore-placement` is `false`. */ + ViewportY = 'viewport-y', + /** Sorts symbols by `symbol-sort-key` if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data. */ + Source = 'source', +} +enum IconRotationAlignmentEnum { + /** When `symbol-placement` is set to `point`, aligns icons east-west. When `symbol-placement` is set to `line` or `line-center`, aligns icon x-axes with the line. */ + Map = 'map', + /** Produces icons whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. */ + Viewport = 'viewport', + /** When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line` or `line-center`, this is equivalent to `map`. */ + Auto = 'auto', +} +enum IconTextFitEnum { + /** The icon is displayed at its intrinsic aspect ratio. */ + None = 'none', + /** The icon is scaled in the x-dimension to fit the width of the text. */ + Width = 'width', + /** The icon is scaled in the y-dimension to fit the height of the text. */ + Height = 'height', + /** The icon is scaled in both x- and y-dimensions. */ + Both = 'both', +} +enum IconAnchorEnum { + /** The center of the icon is placed closest to the anchor. */ + Center = 'center', + /** The left side of the icon is placed closest to the anchor. */ + Left = 'left', + /** The right side of the icon is placed closest to the anchor. */ + Right = 'right', + /** The top of the icon is placed closest to the anchor. */ + Top = 'top', + /** The bottom of the icon is placed closest to the anchor. */ + Bottom = 'bottom', + /** The top left corner of the icon is placed closest to the anchor. */ + TopLeft = 'top-left', + /** The top right corner of the icon is placed closest to the anchor. */ + TopRight = 'top-right', + /** The bottom left corner of the icon is placed closest to the anchor. */ + BottomLeft = 'bottom-left', + /** The bottom right corner of the icon is placed closest to the anchor. */ + BottomRight = 'bottom-right', +} +enum IconPitchAlignmentEnum { + /** The icon is aligned to the plane of the map. */ + Map = 'map', + /** The icon is aligned to the plane of the viewport. */ + Viewport = 'viewport', + /** Automatically matches the value of `icon-rotation-alignment`. */ + Auto = 'auto', +} +enum TextPitchAlignmentEnum { + /** The text is aligned to the plane of the map. */ + Map = 'map', + /** The text is aligned to the plane of the viewport. */ + Viewport = 'viewport', + /** Automatically matches the value of `text-rotation-alignment`. */ + Auto = 'auto', +} +enum TextRotationAlignmentEnum { + /** When `symbol-placement` is set to `point`, aligns text east-west. When `symbol-placement` is set to `line` or `line-center`, aligns text x-axes with the line. */ + Map = 'map', + /** Produces glyphs whose x-axes are aligned with the x-axis of the viewport, regardless of the value of `symbol-placement`. */ + Viewport = 'viewport', + /** When `symbol-placement` is set to `point`, this is equivalent to `viewport`. When `symbol-placement` is set to `line` or `line-center`, this is equivalent to `map`. */ + Auto = 'auto', +} +enum TextJustifyEnum { + /** The text is aligned towards the anchor position. */ + Auto = 'auto', + /** The text is aligned to the left. */ + Left = 'left', + /** The text is centered. */ + Center = 'center', + /** The text is aligned to the right. */ + Right = 'right', +} +enum TextVariableAnchorEnum { + /** The center of the text is placed closest to the anchor. */ + Center = 'center', + /** The left side of the text is placed closest to the anchor. */ + Left = 'left', + /** The right side of the text is placed closest to the anchor. */ + Right = 'right', + /** The top of the text is placed closest to the anchor. */ + Top = 'top', + /** The bottom of the text is placed closest to the anchor. */ + Bottom = 'bottom', + /** The top left corner of the text is placed closest to the anchor. */ + TopLeft = 'top-left', + /** The top right corner of the text is placed closest to the anchor. */ + TopRight = 'top-right', + /** The bottom left corner of the text is placed closest to the anchor. */ + BottomLeft = 'bottom-left', + /** The bottom right corner of the text is placed closest to the anchor. */ + BottomRight = 'bottom-right', +} +enum TextAnchorEnum { + /** The center of the text is placed closest to the anchor. */ + Center = 'center', + /** The left side of the text is placed closest to the anchor. */ + Left = 'left', + /** The right side of the text is placed closest to the anchor. */ + Right = 'right', + /** The top of the text is placed closest to the anchor. */ + Top = 'top', + /** The bottom of the text is placed closest to the anchor. */ + Bottom = 'bottom', + /** The top left corner of the text is placed closest to the anchor. */ + TopLeft = 'top-left', + /** The top right corner of the text is placed closest to the anchor. */ + TopRight = 'top-right', + /** The bottom left corner of the text is placed closest to the anchor. */ + BottomLeft = 'bottom-left', + /** The bottom right corner of the text is placed closest to the anchor. */ + BottomRight = 'bottom-right', +} +enum TextWritingModeEnum { + /** If a text's language supports horizontal writing mode, symbols would be laid out horizontally. */ + Horizontal = 'horizontal', + /** If a text's language supports vertical writing mode, symbols would be laid out vertically. */ + Vertical = 'vertical', +} +enum TextTransformEnum { + /** The text is not altered. */ + None = 'none', + /** Forces all letters to be displayed in uppercase. */ + Uppercase = 'uppercase', + /** Forces all letters to be displayed in lowercase. */ + Lowercase = 'lowercase', +} +enum IconTranslateAnchorEnum { + /** Icons are translated relative to the map. */ + Map = 'map', + /** Icons are translated relative to the viewport. */ + Viewport = 'viewport', +} +enum TextTranslateAnchorEnum { + /** The text is translated relative to the map. */ + Map = 'map', + /** The text is translated relative to the viewport. */ + Viewport = 'viewport', +} +enum CircleTranslateAnchorEnum { + /** The circle is translated relative to the map. */ + Map = 'map', + /** The circle is translated relative to the viewport. */ + Viewport = 'viewport', +} +enum CirclePitchScaleEnum { + /** Circles are scaled according to their apparent distance to the camera. */ + Map = 'map', + /** Circles are not scaled. */ + Viewport = 'viewport', +} +enum CirclePitchAlignmentEnum { + /** The circle is aligned to the plane of the map. */ + Map = 'map', + /** The circle is aligned to the plane of the viewport. */ + Viewport = 'viewport', +} +enum FillExtrusionTranslateAnchorEnum { + /** The fill extrusion is translated relative to the map. */ + Map = 'map', + /** The fill extrusion is translated relative to the viewport. */ + Viewport = 'viewport', +} +enum RasterResamplingEnum { + /** (Bi)linear filtering interpolates pixel values using the weighted average of the four closest original source pixels creating a smooth but blurry look when overscaled */ + Linear = 'linear', + /** Nearest neighbor filtering interpolates pixel values using the nearest original source pixel creating a sharp but pixelated look when overscaled */ + Nearest = 'nearest', +} +enum HillshadeIlluminationAnchorEnum { + /** The hillshade illumination is relative to the north direction. */ + Map = 'map', + /** The hillshade illumination is relative to the top of the viewport. */ + Viewport = 'viewport', +} +enum SkyTypeEnum { + /** Renders the sky with a gradient that can be configured with `sky-gradient-radius` and `sky-gradient`. */ + Gradient = 'gradient', + /** Renders the sky with a simulated atmospheric scattering algorithm, the sun direction can be attached to the light position or explicitly set through `sky-atmosphere-sun`. */ + Atmosphere = 'atmosphere', +} +enum AnchorEnum { + /** The position of the light source is aligned to the rotation of the map. */ + Map = 'map', + /** The position of the light source is aligned to the rotation of the viewport. */ + Viewport = 'viewport', +} + +type Enum = EnumType | keyof EnumType; + +export interface FillLayerStyleProps { + /** + * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. + */ + fillSortKey?: Value; + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * Whether or not the fill should be antialiased. + */ + fillAntialias?: Value; + /** + * The opacity of the entire fill layer. In contrast to the `fillColor`, this value will also affect the 1px stroke around the fill, if the stroke is used. + */ + fillOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s fillOpacity property. + */ + fillOpacityTransition?: Transition; + /** + * 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. + * + * @disabledBy fillPattern + */ + fillColor?: Value; + + /** + * The transition affecting any changes to this layer’s fillColor property. + */ + fillColorTransition?: Transition; + /** + * The outline color of the fill. Matches the value of `fillColor` if unspecified. + * + * @disabledBy fillPattern + */ + fillOutlineColor?: Value; + + /** + * The transition affecting any changes to this layer’s fillOutlineColor property. + */ + fillOutlineColorTransition?: Transition; + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + */ + fillTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s fillTranslate property. + */ + fillTranslateTransition?: Transition; + /** + * Controls the frame of reference for `fillTranslate`. + * + * @requires fillTranslate + */ + fillTranslateAnchor?: Value; + /** + * 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 zoomDependent expressions will be evaluated only at integer zoom levels. + */ + fillPattern?: number | string; + + /** + * The transition affecting any changes to this layer’s fillPattern property. + */ + fillPatternTransition?: Transition; +} +export interface LineLayerStyleProps { + /** + * The display of line endings. + */ + lineCap?: Value, ['zoom', 'feature']>; + /** + * The display of lines when joining. + */ + lineJoin?: Value, ['zoom', 'feature']>; + /** + * Used to automatically convert miter joins to bevel joins for sharp angles. + */ + lineMiterLimit?: Value; + /** + * Used to automatically convert round joins to miter joins for shallow angles. + */ + lineRoundLimit?: Value; + /** + * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. + */ + lineSortKey?: Value; + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The opacity at which the line will be drawn. + */ + lineOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s lineOpacity property. + */ + lineOpacityTransition?: Transition; + /** + * The color with which the line will be drawn. + * + * @disabledBy linePattern + */ + lineColor?: Value; + + /** + * The transition affecting any changes to this layer’s lineColor property. + */ + lineColorTransition?: Transition; + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + */ + lineTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s lineTranslate property. + */ + lineTranslateTransition?: Transition; + /** + * Controls the frame of reference for `lineTranslate`. + * + * @requires lineTranslate + */ + lineTranslateAnchor?: Value; + /** + * Stroke thickness. + */ + lineWidth?: Value; + + /** + * The transition affecting any changes to this layer’s lineWidth property. + */ + lineWidthTransition?: Transition; + /** + * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. + */ + lineGapWidth?: Value; + + /** + * The transition affecting any changes to this layer’s lineGapWidth property. + */ + lineGapWidthTransition?: Transition; + /** + * 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. + */ + lineOffset?: Value; + + /** + * The transition affecting any changes to this layer’s lineOffset property. + */ + lineOffsetTransition?: Transition; + /** + * Blur applied to the line, in pixels. + */ + lineBlur?: Value; + + /** + * The transition affecting any changes to this layer’s lineBlur property. + */ + lineBlurTransition?: Transition; + /** + * 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 zoomDependent expressions will be evaluated only at integer zoom levels. + * + * @disabledBy linePattern + */ + lineDasharray?: Value; + + /** + * The transition affecting any changes to this layer’s lineDasharray property. + */ + lineDasharrayTransition?: Transition; + /** + * 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 zoomDependent expressions will be evaluated only at integer zoom levels. + */ + linePattern?: number | string; + + /** + * The transition affecting any changes to this layer’s linePattern property. + */ + linePatternTransition?: Transition; + /** + * Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify `"lineMetrics": true`. + * + * @disabledBy linePattern + */ + lineGradient?: Value; + /** + * The line part between [trimStart, trimEnd] will be marked as transparent to make a route vanishing effect. The line trimOff offset is based on the whole line range [0.0, 1.0]. + */ + lineTrimOffset?: number[]; +} +export interface SymbolLayerStyleProps { + /** + * Label placement relative to its geometry. + */ + symbolPlacement?: Value, ['zoom']>; + /** + * Distance between two symbol anchors. + */ + symbolSpacing?: Value; + /** + * 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. When using a client that supports global collision detection, like Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries. + */ + symbolAvoidEdges?: Value; + /** + * Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When `iconAllowOverlap` or `textAllowOverlap` is `false`, features with a lower sort key will have priority during placement. When `iconAllowOverlap` or `textAllowOverlap` is set to `true`, features with a higher sort key will overlap over features with a lower sort key. + */ + symbolSortKey?: Value; + /** + * Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their yPosition relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbolSortKey`. + */ + symbolZOrder?: Value, ['zoom']>; + /** + * If true, the icon will be visible even if it collides with other previously drawn symbols. + * + * @requires iconImage + */ + iconAllowOverlap?: Value; + /** + * If true, other symbols can be visible even if they collide with the icon. + * + * @requires iconImage + */ + iconIgnorePlacement?: Value; + /** + * If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. + * + * @requires iconImage, textField + */ + iconOptional?: Value; + /** + * In combination with `symbolPlacement`, determines the rotation behavior of icons. + * + * @requires iconImage + */ + iconRotationAlignment?: Value, ['zoom']>; + /** + * 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 `iconSize`. 1 is the original size; 3 triples the size of the image. + * + * @requires iconImage + */ + iconSize?: Value; + /** + * Scales the icon to fit around the associated text. + * + * @requires iconImage, textField + */ + iconTextFit?: Value, ['zoom']>; + /** + * Size of the additional area added to dimensions determined by `iconTextFit`, in clockwise order: top, right, bottom, left. + * + * @requires iconImage, textField + */ + iconTextFitPadding?: Value; + /** + * Name of image in sprite to use for drawing an image background. + */ + iconImage?: number | string; + + /** + * Rotates the icon clockwise. + * + * @requires iconImage + */ + iconRotate?: Value; + /** + * Size of the additional area around the icon bounding box used for detecting symbol collisions. + * + * @requires iconImage + */ + iconPadding?: Value; + /** + * If true, the icon may be flipped to prevent it from being rendered upsideDown. + * + * @requires iconImage + */ + iconKeepUpright?: Value; + /** + * 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 `iconSize` to obtain the final offset in pixels. When combined with `iconRotate` the offset will be as if the rotated direction was up. + * + * @requires iconImage + */ + iconOffset?: Value; + /** + * Part of the icon placed closest to the anchor. + * + * @requires iconImage + */ + iconAnchor?: Value, ['zoom', 'feature']>; + /** + * Orientation of icon when map is pitched. + * + * @requires iconImage + */ + iconPitchAlignment?: Value, ['zoom']>; + /** + * Orientation of text when map is pitched. + * + * @requires textField + */ + textPitchAlignment?: Value, ['zoom']>; + /** + * In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. + * + * @requires textField + */ + textRotationAlignment?: Value, ['zoom']>; + /** + * Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored. + */ + textField?: Value; + /** + * Font stack to use for displaying text. + * + * @requires textField + */ + textFont?: Value; + /** + * Font size. + * + * @requires textField + */ + textSize?: Value; + /** + * The maximum line width for text wrapping. + * + * @requires textField + */ + textMaxWidth?: Value; + /** + * Text leading value for multiLine text. + * + * @requires textField + */ + textLineHeight?: Value; + /** + * Text tracking amount. + * + * @requires textField + */ + textLetterSpacing?: Value; + /** + * Text justification options. + * + * @requires textField + */ + textJustify?: Value, ['zoom', 'feature']>; + /** + * Radial offset of text, in the direction of the symbol's anchor. Useful in combination with `textVariableAnchor`, which defaults to using the twoDimensional `textOffset` if present. + * + * @requires textField + */ + textRadialOffset?: Value; + /** + * To increase the chance of placing highPriority labels on the map, you can provide an array of `textAnchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `textJustify: auto` to choose justification based on anchor position. To apply an offset, use the `textRadialOffset` or the twoDimensional `textOffset`. + * + * @requires textField + */ + textVariableAnchor?: Value[], ['zoom']>; + /** + * Part of the text placed closest to the anchor. + * + * @requires textField + * + * @disabledBy textVariableAnchor + */ + textAnchor?: Value, ['zoom', 'feature']>; + /** + * Maximum angle change between adjacent characters. + * + * @requires textField + */ + textMaxAngle?: Value; + /** + * The property allows control over a symbol's orientation. Note that the property values act as a hint, so that a symbol whose language doesn’t support the provided orientation will be laid out in its natural orientation. Example: English point symbol will be rendered horizontally even if array value contains single 'vertical' enum value. For symbol with point placement, the order of elements in an array define priority order for the placement of an orientation variant. For symbol with line placement, the default text writing mode is either ['horizontal', 'vertical'] or ['vertical', 'horizontal'], the order doesn't affect the placement. + * + * @requires textField + */ + textWritingMode?: Value[], ['zoom']>; + /** + * Rotates the text clockwise. + * + * @requires textField + */ + textRotate?: Value; + /** + * Size of the additional area around the text bounding box used for detecting symbol collisions. + * + * @requires textField + */ + textPadding?: Value; + /** + * If true, the text may be flipped vertically to prevent it from being rendered upsideDown. + * + * @requires textField + */ + textKeepUpright?: Value; + /** + * Specifies how to capitalize text, similar to the CSS `textTransform` property. + * + * @requires textField + */ + textTransform?: Value, ['zoom', 'feature']>; + /** + * Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. If used with textVariableAnchor, input values will be taken as absolute values. Offsets along the x and yAxis will be applied automatically based on the anchor position. + * + * @requires textField + * + * @disabledBy textRadialOffset + */ + textOffset?: Value; + /** + * If true, the text will be visible even if it collides with other previously drawn symbols. + * + * @requires textField + */ + textAllowOverlap?: Value; + /** + * If true, other symbols can be visible even if they collide with the text. + * + * @requires textField + */ + textIgnorePlacement?: Value; + /** + * If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. + * + * @requires textField, iconImage + */ + textOptional?: Value; + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The opacity at which the icon will be drawn. + * + * @requires iconImage + */ + iconOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s iconOpacity property. + */ + iconOpacityTransition?: Transition; + /** + * The color of the icon. This can only be used with [SDF icons](/help/troubleshooting/usingRecolorableImagesInMapboxMaps/). + * + * @requires iconImage + */ + iconColor?: Value; + + /** + * The transition affecting any changes to this layer’s iconColor property. + */ + iconColorTransition?: Transition; + /** + * The color of the icon's halo. Icon halos can only be used with [SDF icons](/help/troubleshooting/usingRecolorableImagesInMapboxMaps/). + * + * @requires iconImage + */ + iconHaloColor?: Value; + + /** + * The transition affecting any changes to this layer’s iconHaloColor property. + */ + iconHaloColorTransition?: Transition; + /** + * Distance of halo to the icon outline. + * + * @requires iconImage + */ + iconHaloWidth?: Value; + + /** + * The transition affecting any changes to this layer’s iconHaloWidth property. + */ + iconHaloWidthTransition?: Transition; + /** + * Fade out the halo towards the outside. + * + * @requires iconImage + */ + iconHaloBlur?: Value; + + /** + * The transition affecting any changes to this layer’s iconHaloBlur property. + */ + iconHaloBlurTransition?: Transition; + /** + * 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. + * + * @requires iconImage + */ + iconTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s iconTranslate property. + */ + iconTranslateTransition?: Transition; + /** + * Controls the frame of reference for `iconTranslate`. + * + * @requires iconImage, iconTranslate + */ + iconTranslateAnchor?: Value; + /** + * The opacity at which the text will be drawn. + * + * @requires textField + */ + textOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s textOpacity property. + */ + textOpacityTransition?: Transition; + /** + * The color with which the text will be drawn. + * + * @requires textField + */ + textColor?: Value; + + /** + * The transition affecting any changes to this layer’s textColor property. + */ + textColorTransition?: Transition; + /** + * The color of the text's halo, which helps it stand out from backgrounds. + * + * @requires textField + */ + textHaloColor?: Value; + + /** + * The transition affecting any changes to this layer’s textHaloColor property. + */ + textHaloColorTransition?: Transition; + /** + * Distance of halo to the font outline. Max text halo width is 1/4 of the fontSize. + * + * @requires textField + */ + textHaloWidth?: Value; + + /** + * The transition affecting any changes to this layer’s textHaloWidth property. + */ + textHaloWidthTransition?: Transition; + /** + * The halo's fadeout distance towards the outside. + * + * @requires textField + */ + textHaloBlur?: Value; + + /** + * The transition affecting any changes to this layer’s textHaloBlur property. + */ + textHaloBlurTransition?: Transition; + /** + * 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. + * + * @requires textField + */ + textTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s textTranslate property. + */ + textTranslateTransition?: Transition; + /** + * Controls the frame of reference for `textTranslate`. + * + * @requires textField, textTranslate + */ + textTranslateAnchor?: Value; +} +export interface CircleLayerStyleProps { + /** + * Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key. + */ + circleSortKey?: Value; + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * Circle radius. + */ + circleRadius?: Value; + + /** + * The transition affecting any changes to this layer’s circleRadius property. + */ + circleRadiusTransition?: Transition; + /** + * The fill color of the circle. + */ + circleColor?: Value; + + /** + * The transition affecting any changes to this layer’s circleColor property. + */ + circleColorTransition?: Transition; + /** + * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. + */ + circleBlur?: Value; + + /** + * The transition affecting any changes to this layer’s circleBlur property. + */ + circleBlurTransition?: Transition; + /** + * The opacity at which the circle will be drawn. + */ + circleOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s circleOpacity property. + */ + circleOpacityTransition?: Transition; + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. + */ + circleTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s circleTranslate property. + */ + circleTranslateTransition?: Transition; + /** + * Controls the frame of reference for `circleTranslate`. + * + * @requires circleTranslate + */ + circleTranslateAnchor?: Value; + /** + * Controls the scaling behavior of the circle when the map is pitched. + */ + circlePitchScale?: Value, ['zoom']>; + /** + * Orientation of circle when map is pitched. + */ + circlePitchAlignment?: Value, ['zoom']>; + /** + * The width of the circle's stroke. Strokes are placed outside of the `circleRadius`. + */ + circleStrokeWidth?: Value; + + /** + * The transition affecting any changes to this layer’s circleStrokeWidth property. + */ + circleStrokeWidthTransition?: Transition; + /** + * The stroke color of the circle. + */ + circleStrokeColor?: Value; + + /** + * The transition affecting any changes to this layer’s circleStrokeColor property. + */ + circleStrokeColorTransition?: Transition; + /** + * The opacity of the circle's stroke. + */ + circleStrokeOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s circleStrokeOpacity property. + */ + circleStrokeOpacityTransition?: Transition; +} +export interface HeatmapLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed. `queryRenderedFeatures` on heatmap layers will return points within this radius. + */ + heatmapRadius?: Value; + + /** + * The transition affecting any changes to this layer’s heatmapRadius property. + */ + heatmapRadiusTransition?: Transition; + /** + * 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. + */ + heatmapWeight?: Value; + /** + * Similar to `heatmapWeight` but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level. + */ + heatmapIntensity?: Value; + + /** + * The transition affecting any changes to this layer’s heatmapIntensity property. + */ + heatmapIntensityTransition?: Transition; + /** + * Defines the color of each pixel based on its density value in a heatmap. Should be an expression that uses `["heatmapDensity"]` as input. + */ + heatmapColor?: Value; + /** + * The global opacity at which the heatmap layer will be drawn. + */ + heatmapOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s heatmapOpacity property. + */ + heatmapOpacityTransition?: Transition; +} +export interface FillExtrusionLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The opacity of the entire fill extrusion layer. This is rendered on a perLayer, not perFeature, basis, and dataDriven styling is not available. + */ + fillExtrusionOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s fillExtrusionOpacity property. + */ + fillExtrusionOpacityTransition?: Transition; + /** + * 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 `fillExtrusionOpacity` to set layer opacity. + * + * @disabledBy fillExtrusionPattern + */ + fillExtrusionColor?: Value; + + /** + * The transition affecting any changes to this layer’s fillExtrusionColor property. + */ + fillExtrusionColorTransition?: Transition; + /** + * The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively. + */ + fillExtrusionTranslate?: Value; + + /** + * The transition affecting any changes to this layer’s fillExtrusionTranslate property. + */ + fillExtrusionTranslateTransition?: Transition; + /** + * Controls the frame of reference for `fillExtrusionTranslate`. + * + * @requires fillExtrusionTranslate + */ + fillExtrusionTranslateAnchor?: Value; + /** + * 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 zoomDependent expressions will be evaluated only at integer zoom levels. + */ + fillExtrusionPattern?: number | string; + + /** + * The transition affecting any changes to this layer’s fillExtrusionPattern property. + */ + fillExtrusionPatternTransition?: Transition; + /** + * The height with which to extrude this layer. + */ + fillExtrusionHeight?: Value; + + /** + * The transition affecting any changes to this layer’s fillExtrusionHeight property. + */ + fillExtrusionHeightTransition?: Transition; + /** + * The height with which to extrude the base of this layer. Must be less than or equal to `fillExtrusionHeight`. + * + * @requires fillExtrusionHeight + */ + fillExtrusionBase?: Value; + + /** + * The transition affecting any changes to this layer’s fillExtrusionBase property. + */ + fillExtrusionBaseTransition?: Transition; + /** + * Whether to apply a vertical gradient to the sides of a fillExtrusion layer. If true, sides will be shaded slightly darker farther down. + */ + fillExtrusionVerticalGradient?: Value; +} +export interface RasterLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The opacity at which the image will be drawn. + */ + rasterOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s rasterOpacity property. + */ + rasterOpacityTransition?: Transition; + /** + * Rotates hues around the color wheel. + */ + rasterHueRotate?: Value; + + /** + * The transition affecting any changes to this layer’s rasterHueRotate property. + */ + rasterHueRotateTransition?: Transition; + /** + * Increase or reduce the brightness of the image. The value is the minimum brightness. + */ + rasterBrightnessMin?: Value; + + /** + * The transition affecting any changes to this layer’s rasterBrightnessMin property. + */ + rasterBrightnessMinTransition?: Transition; + /** + * Increase or reduce the brightness of the image. The value is the maximum brightness. + */ + rasterBrightnessMax?: Value; + + /** + * The transition affecting any changes to this layer’s rasterBrightnessMax property. + */ + rasterBrightnessMaxTransition?: Transition; + /** + * Increase or reduce the saturation of the image. + */ + rasterSaturation?: Value; + + /** + * The transition affecting any changes to this layer’s rasterSaturation property. + */ + rasterSaturationTransition?: Transition; + /** + * Increase or reduce the contrast of the image. + */ + rasterContrast?: Value; + + /** + * The transition affecting any changes to this layer’s rasterContrast property. + */ + rasterContrastTransition?: Transition; + /** + * The resampling/interpolation method to use for overscaling, also known as texture magnification filter + */ + rasterResampling?: Value, ['zoom']>; + /** + * Fade duration when a new tile is added. + */ + rasterFadeDuration?: Value; +} +export interface HillshadeLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The direction of the light source used to generate the hillshading with 0 as the top of the viewport if `hillshadeIlluminationAnchor` is set to `viewport` and due north if `hillshadeIlluminationAnchor` is set to `map`. + */ + hillshadeIlluminationDirection?: Value; + /** + * Direction of light source when map is rotated. + */ + hillshadeIlluminationAnchor?: Value< + Enum, + ['zoom'] + >; + /** + * Intensity of the hillshade + */ + hillshadeExaggeration?: Value; + + /** + * The transition affecting any changes to this layer’s hillshadeExaggeration property. + */ + hillshadeExaggerationTransition?: Transition; + /** + * The shading color of areas that face away from the light source. + */ + hillshadeShadowColor?: Value; + + /** + * The transition affecting any changes to this layer’s hillshadeShadowColor property. + */ + hillshadeShadowColorTransition?: Transition; + /** + * The shading color of areas that faces towards the light source. + */ + hillshadeHighlightColor?: Value; + + /** + * The transition affecting any changes to this layer’s hillshadeHighlightColor property. + */ + hillshadeHighlightColorTransition?: Transition; + /** + * The shading color used to accentuate rugged terrain like sharp cliffs and gorges. + */ + hillshadeAccentColor?: Value; + + /** + * The transition affecting any changes to this layer’s hillshadeAccentColor property. + */ + hillshadeAccentColorTransition?: Transition; +} +export interface BackgroundLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The color with which the background will be drawn. + * + * @disabledBy backgroundPattern + */ + backgroundColor?: Value; + + /** + * The transition affecting any changes to this layer’s backgroundColor property. + */ + backgroundColorTransition?: Transition; + /** + * 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 zoomDependent expressions will be evaluated only at integer zoom levels. + */ + backgroundPattern?: number | string; + + /** + * The transition affecting any changes to this layer’s backgroundPattern property. + */ + backgroundPatternTransition?: Transition; + /** + * The opacity at which the background will be drawn. + */ + backgroundOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s backgroundOpacity property. + */ + backgroundOpacityTransition?: Transition; +} +export interface SkyLayerStyleProps { + /** + * Whether this layer is displayed. + */ + visibility?: Enum; + /** + * The type of the sky + */ + skyType?: Value, ['zoom']>; + /** + * Position of the sun center [a azimuthal angle, p polar angle]. The azimuthal angle indicates the position of the sun relative to 0° north, where degrees proceed clockwise. The polar angle indicates the height of the sun, where 0° is directly above, at zenith, and 90° at the horizon. When this property is ommitted, the sun center is directly inherited from the light position. + */ + skyAtmosphereSun?: Value; + /** + * Intensity of the sun as a light source in the atmosphere (on a scale from 0 to a 100). Setting higher values will brighten up the sky. + */ + skyAtmosphereSunIntensity?: number; + /** + * Position of the gradient center [a azimuthal angle, p polar angle]. The azimuthal angle indicates the position of the gradient center relative to 0° north, where degrees proceed clockwise. The polar angle indicates the height of the gradient center, where 0° is directly above, at zenith, and 90° at the horizon. + */ + skyGradientCenter?: Value; + /** + * The angular distance (measured in degrees) from `skyGradientCenter` up to which the gradient extends. A value of 180 causes the gradient to wrap around to the opposite direction from `skyGradientCenter`. + */ + skyGradientRadius?: Value; + /** + * Defines a radial color gradient with which to color the sky. The color values can be interpolated with an expression using `skyRadialProgress`. The range [0, 1] for the interpolant covers a radial distance (in degrees) of [0, `skyGradientRadius`] centered at the position specified by `skyGradientCenter`. + */ + skyGradient?: Value; + /** + * A color applied to the atmosphere sun halo. The alpha channel describes how strongly the sun halo is represented in an atmosphere sky layer. + */ + skyAtmosphereHaloColor?: string; + /** + * A color used to tweak the main atmospheric scattering coefficients. Using white applies the default coefficients giving the natural blue color to the atmosphere. This color affects how heavily the corresponding wavelength is represented during scattering. The alpha channel describes the density of the atmosphere, with 1 maximum density and 0 no density. + */ + skyAtmosphereColor?: string; + /** + * The opacity of the entire sky layer. + */ + skyOpacity?: Value; + + /** + * The transition affecting any changes to this layer’s skyOpacity property. + */ + skyOpacityTransition?: Transition; +} +export interface LightLayerStyleProps { + /** + * Whether extruded geometries are lit relative to the map or viewport. + */ + anchor?: Value, ['zoom']>; + /** + * 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). + */ + position?: Value; + + /** + * The transition affecting any changes to this layer’s position property. + */ + positionTransition?: Transition; + /** + * Color tint for lighting extruded geometries. + */ + color?: Value; + + /** + * The transition affecting any changes to this layer’s color property. + */ + colorTransition?: Transition; + /** + * Intensity of lighting (on a scale from 0 to 1). Higher numbers will present as more extreme contrast. + */ + intensity?: Value; + + /** + * The transition affecting any changes to this layer’s intensity property. + */ + intensityTransition?: Transition; +} +export interface AtmosphereLayerStyleProps { + /** + * The start and end distance range in which fog fades from fully transparent to fully opaque. The distance to the point at the center of the map is defined as zero, so that negative range values are closer to the camera, and positive values are farther away. + */ + range?: Value; + + /** + * The transition affecting any changes to this layer’s range property. + */ + rangeTransition?: Transition; + /** + * The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizonBlend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn. + */ + color?: Value; + + /** + * The transition affecting any changes to this layer’s color property. + */ + colorTransition?: Transition; + /** + * The color of the atmosphere region above the horizon, `highColor` extends further above the horizon than the `color` property and its spread can be controlled with `horizonBlend`. The opacity can be set to `0` to remove the high atmosphere color contribution. + */ + highColor?: Value; + + /** + * The transition affecting any changes to this layer’s highColor property. + */ + highColorTransition?: Transition; + /** + * The color of the region above the horizon and after the end of the `horizonBlend` contribution. The opacity can be set to `0` to have a transparent background. + */ + spaceColor?: Value; + + /** + * The transition affecting any changes to this layer’s spaceColor property. + */ + spaceColorTransition?: Transition; + /** + * Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky. + */ + horizonBlend?: Value; + + /** + * The transition affecting any changes to this layer’s horizonBlend property. + */ + horizonBlendTransition?: Transition; + /** + * A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity. + */ + starIntensity?: Value; + + /** + * The transition affecting any changes to this layer’s starIntensity property. + */ + starIntensityTransition?: Transition; +} diff --git a/javascript/utils/styleMap.js b/javascript/utils/styleMap.js index 0d2564050..d8df62d8b 100644 --- a/javascript/utils/styleMap.js +++ b/javascript/utils/styleMap.js @@ -361,6 +361,11 @@ export const LineLayerStyleProp = PropTypes.shape({ PropTypes.string, PropTypes.array, ]), + + /** + * The line part between [trimStart, trimEnd] will be marked as transparent to make a route vanishing effect. The line trimOff offset is based on the whole line range [0.0, 1.0]. + */ + lineTrimOffset: PropTypes.arrayOf(PropTypes.number), }); export const SymbolLayerStyleProp = PropTypes.shape({ @@ -565,7 +570,7 @@ export const SymbolLayerStyleProp = PropTypes.shape({ ]), /** - * Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. + * Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored. */ textField: PropTypes.oneOfType([ PropTypes.string, @@ -1776,6 +1781,105 @@ export const LightLayerStyleProp = PropTypes.shape({ }), }); +export const AtmosphereLayerStyleProp = PropTypes.shape({ + + /** + * The start and end distance range in which fog fades from fully transparent to fully opaque. The distance to the point at the center of the map is defined as zero, so that negative range values are closer to the camera, and positive values are farther away. + */ + range: PropTypes.oneOfType([ + PropTypes.arrayOf(PropTypes.number), + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s range property. + */ + rangeTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), + + /** + * The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizonBlend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn. + */ + color: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s color property. + */ + colorTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), + + /** + * The color of the atmosphere region above the horizon, `highColor` extends further above the horizon than the `color` property and its spread can be controlled with `horizonBlend`. The opacity can be set to `0` to remove the high atmosphere color contribution. + */ + highColor: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s highColor property. + */ + highColorTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), + + /** + * The color of the region above the horizon and after the end of the `horizonBlend` contribution. The opacity can be set to `0` to have a transparent background. + */ + spaceColor: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s spaceColor property. + */ + spaceColorTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), + + /** + * Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky. + */ + horizonBlend: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s horizonBlend property. + */ + horizonBlendTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), + + /** + * A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity. + */ + starIntensity: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.array, + ]), + + /** + * The transition affecting any changes to this layer’s starIntensity property. + */ + starIntensityTransition: PropTypes.shape({ + duration: PropTypes.number, + delay: PropTypes.number, + }), +}); + const styleMap = { fillSortKey: StyleTypes.Constant, @@ -1817,6 +1921,7 @@ const styleMap = { linePattern: StyleTypes.Image, linePatternTransition: StyleTypes.Transition, lineGradient: StyleTypes.Color, + lineTrimOffset: StyleTypes.Constant, symbolPlacement: StyleTypes.Enum, symbolSpacing: StyleTypes.Constant, @@ -1983,6 +2088,19 @@ const styleMap = { intensity: StyleTypes.Constant, intensityTransition: StyleTypes.Transition, + range: StyleTypes.Constant, + rangeTransition: StyleTypes.Transition, + color: StyleTypes.Color, + colorTransition: StyleTypes.Transition, + highColor: StyleTypes.Color, + highColorTransition: StyleTypes.Transition, + spaceColor: StyleTypes.Color, + spaceColorTransition: StyleTypes.Transition, + horizonBlend: StyleTypes.Constant, + horizonBlendTransition: StyleTypes.Transition, + starIntensity: StyleTypes.Constant, + starIntensityTransition: StyleTypes.Transition, + visibility: StyleTypes.Constant, }; diff --git a/scripts/autogenHelpers/globals.js b/scripts/autogenHelpers/globals.js index 6af0b3727..17fce2979 100644 --- a/scripts/autogenHelpers/globals.js +++ b/scripts/autogenHelpers/globals.js @@ -1,3 +1,5 @@ +/* eslint-disable fp/no-mutating-methods */ + let iosPropNameOverrides = {}; const iosSpecOverrides = { @@ -105,6 +107,8 @@ global.getLayerType = function (layer, platform) { return isIOS ? 'MGLLight' : 'Light'; case 'sky': return isIOS ? 'MGLSkyLayer' : 'SkyLayer'; + case 'atmosphere': + return isIOS ? 'MGLAtmosphere' : 'Atmosphere'; default: throw new Error( `Is ${layer.name} a new layer? We should add support for it!`, @@ -249,11 +253,30 @@ global.jsDocPropRequires = function (prop) { return desc; }; +global.getEnums = function (layers) { + let result = {}; + + layers.forEach((layer) => { + layer.properties.forEach((property) => { + if ( + property.type === 'enum' || + (property.type === 'array' && property.value === 'enum') + ) { + result[property.name] = { + values: property.doc.values, + name: property.name, + }; + } + }); + }); + return Object.values(result); +}; + global.dtsInterfaceType = function (prop) { let propTypes = []; if (prop.name.indexOf('Translate') !== -1) { - propTypes.push('TranslationProps'); + propTypes.push('Translation'); } else if (prop.type === 'color') { propTypes.push('string'); // propTypes.push('ConstantPropType'); @@ -267,14 +290,16 @@ global.dtsInterfaceType = function (prop) { break; case 'string': propTypes.push('string[]'); - default: - propTypes.push('any[]'); + break; + case 'enum': + propTypes.push(`Enum<${pascelCase(prop.name)}Enum>[]`); + break; } // propTypes.push('ConstantPropType'); } else if (prop.type === 'number') { propTypes.push('number'); } else if (prop.type === 'enum') { - propTypes.push('any'); + propTypes.push(`Enum<${pascelCase(prop.name)}Enum>`); } else { // images can be required which result in a number if (prop.image) { @@ -283,16 +308,27 @@ global.dtsInterfaceType = function (prop) { propTypes.push('string'); } - if (prop.allowedFunctionTypes && prop.allowedFunctionTypes.length) { + /* + if (prop.allowedFunctionTypes && prop.allowedFunctionTypes.length > 0) { propTypes.push('StyleFunctionProps'); } + */ if (propTypes.length > 1) { - return `TransitionProps | -${propTypes.map((p) => startAtSpace(4, p)).join(' | ')}, + return `${propTypes.map((p) => startAtSpace(4, p)).join(' | ')}, ${startAtSpace(2, '')}`; } else { - return propTypes[0]; + if (prop.expressionSupported) { + let params = ''; + if (prop.expression && prop.expression.parameters) { + params = `,[${prop.expression.parameters + .map((v) => `'${v}'`) + .join(',')}]`; + } + return `Value<${propTypes[0]}${params}>`; + } else { + return propTypes[0]; + } } }; @@ -311,6 +347,7 @@ global.jsDocReactProp = function (prop) { break; case 'string': propTypes.push('PropTypes.arrayOf(PropTypes.string)'); + break; default: propTypes.push('PropTypes.array'); } diff --git a/scripts/autogenerate.js b/scripts/autogenerate.js index 03cdad674..594789766 100644 --- a/scripts/autogenerate.js +++ b/scripts/autogenerate.js @@ -1,3 +1,4 @@ +/* eslint-disable fp/no-mutating-methods */ require('./autogenHelpers/globals'); const fs = require('fs'); @@ -7,6 +8,7 @@ const { execSync } = require('child_process'); const ejs = require('ejs'); const prettier = require('prettier'); +const prettierrc = require('../.prettierrc.js'); const styleSpecJSON = require('../style-spec/v8.json'); const DocJSONBuilder = require('./autogenHelpers/DocJSONBuilder'); @@ -135,26 +137,43 @@ getSupportedLayers(Object.keys(styleSpecJSON.layer.type.values)).forEach( // add light as a layer layers.push({ name: 'light', - properties: getPropertiesForLight(), + properties: getPropertiesFor('light'), props: { - gl: getPropertiesForLight('gl'), - v10: getPropertiesForLight('v10'), + gl: getPropertiesFor('light', 'gl'), + v10: getPropertiesFor('light', 'v10'), }, support: { gl: true, v10: true }, }); -function getPropertiesForLight(only) { - const lightAttributes = styleSpecJSON.light; +// add atmosphere as a layer +layers.push({ + name: 'atmosphere', + properties: getPropertiesFor('fog'), + props: { + gl: getPropertiesFor('fog', 'gl'), + v10: removeTransitionsOnV10Before1070(getPropertiesFor('fog', 'v10')), + }, + support: { gl: false, v10: true }, +}); - const lightProps = getSupportedProperties(lightAttributes, only).map( - (attrName) => { - return Object.assign({}, buildProperties(lightAttributes, attrName), { - allowedFunctionTypes: [], - }); - }, - ); +function getPropertiesFor(kind, only) { + const attributes = styleSpecJSON[kind]; + + const props = getSupportedProperties(attributes, only).map((attrName) => { + return Object.assign({}, buildProperties(attributes, attrName), { + allowedFunctionTypes: [], + }); + }); - return lightProps; + return props; +} + +function removeTransitionsOnV10Before1070(props) { + let isv17orolder = isVersionGTE(iosVersion.v10, '10.7.0'); + + return props.map((i) => + !isv17orolder ? { ...i, transition: false } : { ...i }, + ); } function getPropertiesForLayer(layerName, only) { @@ -420,6 +439,10 @@ async function generate() { input: path.join(TMPL_PATH, 'index.d.ts.ejs'), output: path.join(IOS_OUTPUT_PATH, 'index.d.ts'), },*/ + { + input: path.join(TMPL_PATH, 'MapboxStyles.ts.ejs'), + output: path.join(JS_OUTPUT_PATH, 'MapboxStyles.ts'), + }, { input: path.join(TMPL_PATH, 'RCTMGLStyle.m.ejs'), output: path.join(IOS_OUTPUT_PATH, 'RCTMGLStyle.m'), @@ -466,7 +489,10 @@ async function generate() { let results = tmpl({ layers: filterOnly(layers, only) }); if (filename.endsWith('ts')) { - results = prettier.format(results, { filepath: filename }); + results = prettier.format(results, { + ...prettierrc, + filepath: filename, + }); } fs.writeFileSync(output, results); }); diff --git a/scripts/templates/MapboxStyles.ts.ejs b/scripts/templates/MapboxStyles.ts.ejs new file mode 100644 index 000000000..49ef8fcc6 --- /dev/null +++ b/scripts/templates/MapboxStyles.ts.ejs @@ -0,0 +1,90 @@ +<% + const layers = locals.layers; +-%> +/* This file was generated from MapboxStyle.ts.ejs do not modify */ + + +export type Translation = { x: number; y: number } | [number, number]; + +export interface Transition { + duration: number; + delay: number; +} + +type ExpressionName = + // Types + | 'array' | 'boolean' | 'collator' | 'format' | 'image' | 'literal' | 'number' | 'number-format' | 'object' | 'string' + | 'to-boolean' | 'to-color' | 'to-number' | 'to-string' | 'typeof' + // Feature data + | 'accumulated' | 'feature-state' | 'geometry-type' | 'id' | 'line-progress' | 'properties' + // Lookup + | 'at' | 'get' | 'has' | 'in' | 'index-of' | 'length' | 'slice' + // Decision + | '!' | '!=' | '<' | '<=' | '==' | '>' | '>=' | 'all' | 'any' | 'case' | 'match' | 'coalesce' | 'within' + // Ramps, scales, curves + | 'interpolate' | 'interpolate-hcl' | 'interpolate-lab' | 'step' + // Variable binding + | 'let' | 'var' + // String + | 'concat' | 'downcase' | 'is-supported-script' | 'resolved-locale' | 'upcase' + // Color + | 'rgb' | 'rgba' | 'to-rgba' + // Math + | '-' | '*' | '/' | '%' | '^' | '+' | 'abs' | 'acos' | 'asin' | 'atan' | 'ceil' | 'cos' | 'distance' | 'e' + | 'floor' | 'ln' | 'ln2' | 'log10' | 'log2' | 'max' | 'min' | 'pi' | 'round' | 'sin' | 'sqrt' | 'tan' + // Zoom, Heatmap + | 'zoom' | 'heatmap-density'; + +type ExpressionField = + | string + | number + | boolean + | Expression + | ExpressionField[] + | { [key: string]: ExpressionField }; + +export type Expression = [ExpressionName, ...ExpressionField[]]; + +type ExpressionParameters = 'zoom' | 'feature' | 'feature-state' | 'sky-radial-progress' | 'line-progress' | 'heatmap-density'; + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +type Value = + | T + | Expression; + +<%_ for (let enumInfo of getEnums(layers)) { _%> + enum <%- pascelCase(enumInfo.name) %>Enum { + <%_ for (let k of Object.keys(enumInfo.values)) { _%> + /** <%- enumInfo.values[k].doc %> */ + <%- pascelCase(k) %> = '<%- k %>', + <%_ } _%> + } +<%_ } _%> + +type Enum = EnumType | keyof EnumType; + +<%_ for (let layer of layers) { _%> + export interface <%- pascelCase(layer.name) %>LayerStyleProps { + <%_ for (let prop of layer.properties) { _%> + /** + * <%- prop.doc.description %> + <%_ if (prop.doc.requires.length) { _%> + * + * @requires <%- prop.doc.requires.join(', ') %> + <%_ } _%> + <%_ if (prop.doc.disabledBy.length) { _%> + * + * @disabledBy <%- prop.doc.disabledBy.join(', ') %> + <%_ } _%> + */ + <%= prop.name %>?: <%- dtsInterfaceType(prop) %> + <%_ if (true && prop.transition) { %> + /** + * The transition affecting any changes to this layer’s <%= prop.name %> property. + */ + <%= prop.name %>Transition?: Transition, + <%_ } _%> + <%_ } _%> + + }; +<%_ } _%> diff --git a/scripts/templates/RCTMGLStyle.h.ejs b/scripts/templates/RCTMGLStyle.h.ejs index 3d2d1cfd8..b955aa4fe 100644 --- a/scripts/templates/RCTMGLStyle.h.ejs +++ b/scripts/templates/RCTMGLStyle.h.ejs @@ -18,6 +18,7 @@ - (id)initWithMGLStyle:(MGLStyle*)mglStyle; <%_ for (const layer of layers) { _%> +<%_ if (layer.properties.length == 0) { continue } _%> - (void)<%- setLayerMethodName(layer, 'ios') -%>:(<%- getLayerType(layer, 'ios') -%> *)layer withReactStyle:(NSDictionary *)reactStyle isValid:(BOOL (^)(void)) isValid; <%_ } _%> diff --git a/scripts/templates/RCTMGLStyle.m.ejs b/scripts/templates/RCTMGLStyle.m.ejs index 8d686a44f..48645d179 100644 --- a/scripts/templates/RCTMGLStyle.m.ejs +++ b/scripts/templates/RCTMGLStyle.m.ejs @@ -18,6 +18,7 @@ } <% for (const layer of layers) { %> +<%_ if (layer.properties.length == 0) { continue } _%> - (void)<%- setLayerMethodName(layer, 'ios') -%>:(<%- getLayerType(layer, 'ios') -%> *)layer withReactStyle:(NSDictionary *)reactStyle isValid:(BOOL (^)(void)) isValid { if (![self _hasReactStyle:reactStyle]) { diff --git a/scripts/templates/RCTMGLStyleFactory.java.ejs b/scripts/templates/RCTMGLStyleFactory.java.ejs index bc62bb39a..49a2bebb7 100644 --- a/scripts/templates/RCTMGLStyleFactory.java.ejs +++ b/scripts/templates/RCTMGLStyleFactory.java.ejs @@ -29,6 +29,7 @@ public class RCTMGLStyleFactory { public static final String SHOULD_ADD_IMAGE_KEY = "shouldAddImage"; <%_ for (const layer of layers) { _%> + <%_ if (layer.properties.length == 0) { continue } _%> public static void <%- setLayerMethodName(layer) -%>(final <%- getLayerType(layer, 'android') -%> layer, RCTMGLStyle style) { List styleKeys = style.getAllStyleKeys(); diff --git a/scripts/templates/RCTMGLStyleFactoryv10.java.ejs b/scripts/templates/RCTMGLStyleFactoryv10.java.ejs index c0cc8f80b..82e50d649 100644 --- a/scripts/templates/RCTMGLStyleFactoryv10.java.ejs +++ b/scripts/templates/RCTMGLStyleFactoryv10.java.ejs @@ -19,6 +19,7 @@ import com.mapbox.maps.extension.style.layers.generated.RasterLayer; import com.mapbox.maps.extension.style.layers.generated.SymbolLayer; import com.mapbox.maps.extension.style.layers.generated.HeatmapLayer; import com.mapbox.maps.extension.style.layers.generated.HillshadeLayer; +import com.mapbox.maps.extension.style.atmosphere.generated.Atmosphere; // import com.mapbox.maps.extension.style.layers.properties.generated.Visibility; import com.mapbox.maps.extension.style.layers.properties.generated.*; import com.mapbox.maps.extension.style.types.StyleTransition; diff --git a/style-spec/v8.json b/style-spec/v8.json index 99780bbbc..0fa15ff9d 100644 --- a/style-spec/v8.json +++ b/style-spec/v8.json @@ -63,7 +63,7 @@ }, "fog": { "type": "fog", - "doc": "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features." + "doc": "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features. Note: fog is renamed to atmosphere in the Android and iOS SDKs and planned to be changed in GL-JS v.3.0.0." }, "sources": { "required": true, @@ -94,6 +94,15 @@ "delay": 0 } }, + "projection": { + "type": "projection", + "doc": "The projection the map should be rendered in. Supported projections are Mercator, Globe, Albers, Equal Earth, Equirectangular (WGS84), Lambert conformal conic, Natural Earth, and Winkel Tripel. Terrain, sky and fog are supported by only Mercator and globe. CustomLayerInterface is not supported outside of Mercator.", + "example": { + "name": "albers", + "center": [-154, 50], + "parallels": [55, 65] + } + }, "layers": { "required": true, "type": "array", @@ -652,7 +661,7 @@ }, "filter": { "type": "filter", - "doc": "A expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `feature-state` expression is not supported in filter expressions." + "doc": "An expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The `[\"feature-state\", ...]` expression is not supported in filter expressions. The `[\"pitch\"]` and `[\"distance-from-center\"]` expressions are supported only for filter expressions on the symbol layer." }, "layout": { "type": "layout", @@ -1738,7 +1747,7 @@ "type": "formatted", "default": "", "tokens": true, - "doc": "Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.", + "doc": "Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored.", "sdk-support": { "basic functionality": { "js": "0.10.0", @@ -2500,6 +2509,72 @@ "value": "*", "doc": "A filter selects specific features from a layer." }, + "filter_symbol": { + "type": "boolean", + "doc": "Expression which determines whether or not to display a symbol. Symbols support dynamic filtering, meaning this expression can use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature", "pitch", "distance-from-center"] + } + }, + "filter_fill": { + "type": "boolean", + "doc": "Expression which determines whether or not to display a polygon. Fill layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature"] + } + }, + "filter_line": { + "type": "boolean", + "doc": "Expression which determines whether or not to display a Polygon or LineString. Line layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature"] + } + }, + "filter_circle": { + "type": "boolean", + "doc": "Expression which determines whether or not to display a circle. Circle layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature"] + } + }, + "filter_fill-extrusion": { + "type": "boolean", + "doc": "Expression which determines whether or not to display a Polygon. Fill-extrusion layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature"] + } + }, + "filter_heatmap": { + "type": "boolean", + "doc": "Expression used to determine whether a point is being displayed or not. Heatmap layer does NOT support dynamic filtering, meaning this expression can NOT use the `[\"pitch\"]` and `[\"distance-from-center\"]` expressions to reference the current state of the view.", + "default": false, + "transition": false, + "property-type": "data-driven", + "expression": { + "interpolated": false, + "parameters": ["zoom", "feature"] + } + }, "filter_operator": { "type": "enum", "values": { @@ -2761,7 +2836,7 @@ } }, "coalesce": { - "doc": "Evaluates each expression in turn until the first non-null value is obtained, and returns that value.", + "doc": "Evaluates each expression in turn until the first valid value is obtained. Invalid values are `null` and [`'image'`](#types-image) expressions that are unavailable in the style. If all values are invalid, `coalesce` returns the first value listed.", "group": "Decision", "sdk-support": { "basic functionality": { @@ -2959,7 +3034,7 @@ } }, "image": { - "doc": "Returns an `image` type for use in `icon-image`, `*-pattern` entries and as a section in the `format` expression. If set, the `image` argument will check that the requested image exists in the style and will return either the resolved image name or `null`, depending on whether or not the image is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the `image` argument.", + "doc": "Returns a [`ResolvedImage`](/mapbox-gl-js/style-spec/types/#resolvedimage) for use in [`icon-image`](/mapbox-gl-js/style-spec/layers/#layout-symbol-icon-image), `*-pattern` entries, and as a section in the [`'format'`](#types-format) expression. A [`'coalesce'`](#coalesce) expression containing `image` expressions will evaluate to the first listed image that is currently in the style. This validation process is synchronous and requires the image to have been added to the style before requesting it in the `'image'` argument.", "group": "Types", "sdk-support": { "basic functionality": { @@ -2971,7 +3046,7 @@ } }, "number-format": { - "doc": "Converts the input number into a string representation using the providing formatting rules. If set, the `locale` argument specifies the locale to use, as a BCP 47 language tag. If set, the `currency` argument specifies an ISO 4217 code to use for currency-style formatting. If set, the `min-fraction-digits` and `max-fraction-digits` arguments specify the minimum and maximum number of fractional digits to include.", + "doc": "Converts the input number into a string representation using the providing formatting rules. If set, the `locale` argument specifies the locale to use, as a BCP 47 language tag. If set, the `currency` argument specifies an ISO 4217 code to use for currency-style formatting. If set, the `unit` argument specifies a [simple ECMAScript unit](https://tc39.es/proposal-unified-intl-numberformat/section6/locales-currencies-tz_proposed_out.html#sec-issanctionedsimpleunitidentifier) to use for unit-style formatting. If set, the `min-fraction-digits` and `max-fraction-digits` arguments specify the minimum and maximum number of fractional digits to include.", "group": "Types", "sdk-support": { "basic functionality": { @@ -2983,7 +3058,7 @@ } }, "to-string": { - "doc": "Converts the input value to a string. If the input is `null`, the result is `\"\"`. If the input is a boolean, the result is `\"true\"` or `\"false\"`. If the input is a number, it is converted to a string as specified by the [\"NumberToString\" algorithm](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type) of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form `\"rgba(r,g,b,a)\"`, where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the [`JSON.stringify`](https://tc39.github.io/ecma262/#sec-json.stringify) function of the ECMAScript Language Specification.", + "doc": "Converts the input value to a string. If the input is `null`, the result is `\"\"`. If the input is a [`boolean`](#types-boolean), the result is `\"true\"` or `\"false\"`. If the input is a number, it is converted to a string as specified by the [\"NumberToString\" algorithm](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type) of the ECMAScript Language Specification. If the input is a [`color`](#color), it is converted to a string of the form `\"rgba(r,g,b,a)\"`, where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. If the input is an [`'image'`](#types-image) expression, `'to-string'` returns the image name. Otherwise, the input is converted to a string in the format specified by the [`JSON.stringify`](https://tc39.github.io/ecma262/#sec-json.stringify) function of the ECMAScript Language Specification.", "group": "Types", "sdk-support": { "basic functionality": { @@ -3067,7 +3142,7 @@ } }, "get": { - "doc": "Retrieves a property value from the current feature's properties, or from another object if a second argument is provided. Returns null if the requested property is missing.", + "doc": "Retrieves a property value from the current feature's properties, or from another object if a second argument is provided. Returns `null` if the requested property is missing.", "group": "Lookup", "sdk-support": { "basic functionality": { @@ -3091,7 +3166,7 @@ } }, "length": { - "doc": "Gets the length of an array or string.", + "doc": "Returns the length of an array or string.", "group": "Lookup", "sdk-support": { "basic functionality": { @@ -3103,7 +3178,7 @@ } }, "properties": { - "doc": "Gets the feature properties object. Note that in some cases, it may be more efficient to use [\"get\", \"property_name\"] directly.", + "doc": "Returns the feature properties object. Note that in some cases, it may be more efficient to use `[\"get\", \"property_name\"]` directly.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3115,7 +3190,7 @@ } }, "feature-state": { - "doc": "Retrieves a property value from the current feature's state. Returns null if the requested property is not present on the feature's state. A feature's state is not part of the GeoJSON or vector tile data, and must be set programmatically on each feature. Features are identified by their `id` attribute, which must be an integer or a string that can be cast to an integer. Note that [\"feature-state\"] can only be used with paint properties that support data-driven styling.", + "doc": "Retrieves a property value from the current feature's state. Returns `null` if the requested property is not present on the feature's state. A feature's state is not part of the GeoJSON or vector tile data, and must be set programmatically on each feature. Features are identified by their `id` attribute, which must be an integer or a string that can be cast to an integer. Note that [\"feature-state\"] can only be used with paint properties that support data-driven styling.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3124,7 +3199,7 @@ } }, "geometry-type": { - "doc": "Gets the feature's geometry type: `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`. `Multi*` feature types are only returned in GeoJSON sources. When working with vector tile sources, use the singular forms.", + "doc": "Returns the feature's geometry type: `Point`, `MultiPoint`, `LineString`, `MultiLineString`, `Polygon`, `MultiPolygon`. `Multi*` feature types are only returned in GeoJSON sources. When working with vector tile sources, use the singular forms.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3136,7 +3211,7 @@ } }, "id": { - "doc": "Gets the feature's id, if it has one.", + "doc": "Returns the feature's id, if it has one.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3148,8 +3223,8 @@ } }, "zoom": { - "doc": "Gets the current zoom level. Note that in style layout and paint properties, [\"zoom\"] may only appear as the input to a top-level \"step\" or \"interpolate\" expression.", - "group": "Zoom", + "doc": "Returns the current zoom level. Note that in style layout and paint properties, [\"zoom\"] may only appear as the input to a top-level \"step\" or \"interpolate\" expression.", + "group": "Camera", "sdk-support": { "basic functionality": { "js": "0.41.0", @@ -3159,8 +3234,26 @@ } } }, + "pitch": { + "doc": "Returns the current pitch in degrees. `[\"pitch\"]` may only be used in the `filter` expression for a `symbol` layer.", + "group": "Camera", + "sdk-support": { + "basic functionality": { + "js": "2.6.0" + } + } + }, + "distance-from-center": { + "doc": "Returns the distance of a `symbol` instance from the center of the map. The distance is measured in pixels divided by the height of the map container. It measures 0 at the center, decreases towards the camera and increase away from the camera. For example, if the height of the map is 1000px, a value of -1 means 1000px away from the center towards the camera, and a value of 1 means a distance of 1000px away from the camera from the center. `[\"distance-from-center\"]` may only be used in the `filter` expression for a `symbol` layer.", + "group": "Camera", + "sdk-support": { + "basic functionality": { + "js": "2.6.0" + } + } + }, "heatmap-density": { - "doc": "Gets the kernel density estimation of a pixel in a heatmap layer, which is a relative measure of how many data points are crowded around a particular pixel. Can only be used in the `heatmap-color` property.", + "doc": "Returns the kernel density estimation of a pixel in a heatmap layer, which is a relative measure of how many data points are crowded around a particular pixel. Can only be used in the `heatmap-color` property.", "group": "Heatmap", "sdk-support": { "basic functionality": { @@ -3172,7 +3265,7 @@ } }, "line-progress": { - "doc": "Gets the progress along a gradient line. Can only be used in the `line-gradient` property.", + "doc": "Returns the progress along a gradient line. Can only be used in the `line-gradient` property.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3184,7 +3277,7 @@ } }, "sky-radial-progress": { - "doc": "Gets the distance of a point on the sky from the sun position. Returns 0 at sun position and 1 when the distance reaches `sky-gradient-radius`. Can only be used in the `sky-gradient` property.", + "doc": "Returns the distance of a point on the sky from the sun position. Returns 0 at sun position and 1 when the distance reaches `sky-gradient-radius`. Can only be used in the `sky-gradient` property.", "group": "sky", "sdk-support": { "basic functionality": { @@ -3195,7 +3288,7 @@ } }, "accumulated": { - "doc": "Gets the value of a cluster property accumulated so far. Can only be used in the `clusterProperties` option of a clustered GeoJSON source.", + "doc": "Returns the value of a cluster property accumulated so far. Can only be used in the `clusterProperties` option of a clustered GeoJSON source.", "group": "Feature data", "sdk-support": { "basic functionality": { @@ -3723,7 +3816,9 @@ ], "sdk-support": { "basic functionality": { - "js": "2.3.0" + "js": "2.3.0", + "android": "10.6.0", + "ios": "10.6.0" } } }, @@ -3738,17 +3833,86 @@ ] }, "transition": true, - "doc": "The color of the fog. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.", + "doc": "The color of the atmosphere region immediately below the horizon and within the `range` and above the horizon and within `horizon-blend`. Using opacity is recommended only for smoothly transitioning fog on/off as anything less than 100% opacity results in more tiles loaded and drawn.", "sdk-support": { "basic functionality": { - "js": "2.3.0" + "js": "2.3.0", + "android": "10.6.0", + "ios": "10.6.0" + } + } + }, + "high-color": { + "type": "color", + "property-type": "data-constant", + "default": "#245cdf", + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The color of the atmosphere region above the horizon, `high-color` extends further above the horizon than the `color` property and its spread can be controlled with `horizon-blend`. The opacity can be set to `0` to remove the high atmosphere color contribution.", + "sdk-support": { + "basic functionality": { + "js": "2.9.0", + "android": "10.6.0", + "ios": "10.6.0" + } + } + }, + "space-color": { + "type": "color", + "property-type": "data-constant", + + "default": + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 4, + "#010b19", + 7, + "#367ab9" + ], + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The color of the region above the horizon and after the end of the `horizon-blend` contribution. The opacity can be set to `0` to have a transparent background.", + "sdk-support": { + "basic functionality": { + "js": "2.9.0", + "android": "10.6.0", + "ios": "10.6.0" } } }, "horizon-blend": { "type": "number", "property-type": "data-constant", - "default": 0.1, + "default": + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 4, + 0.2, + 7, + 0.1 + ], "minimum": 0, "maximum": 1, "expression": { @@ -3758,10 +3922,47 @@ ] }, "transition": true, - "doc": "Horizon blend applies a smooth fade from the color of the fog to the color of the sky. A value of zero leaves a sharp transition from fog to sky. Increasing the value blends the color of fog into increasingly high angles of the sky.", + "doc": "Horizon blend applies a smooth fade from the color of the atmosphere to the color of space. A value of zero leaves a sharp transition from atmosphere to space. Increasing the value blends the color of atmosphere into increasingly high angles of the sky.", "sdk-support": { "basic functionality": { - "js": "2.3.0" + "js": "2.3.0", + "android": "10.6.0", + "ios": "10.6.0" + } + } + }, + "star-intensity": { + "type": "number", + "property-type": "data-constant", + "default": + [ + "interpolate", + [ + "linear" + ], + [ + "zoom" + ], + 5, + 0.35, + 6, + 0 + ], + "minimum": 0, + "maximum": 1, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "A value controlling the star intensity where `0` will show no stars and `1` will show stars at their maximum intensity.", + "sdk-support": { + "basic functionality": { + "js": "2.9.0", + "android": "10.6.0", + "ios": "10.6.0" } } } @@ -3874,6 +4075,99 @@ } } }, + "projection": { + "name": { + "type": "enum", + "values": { + "albers": { + "doc": "An Albers equal-area projection centered on the continental United States. You can configure the projection for a different region by setting `center` and `parallels` properties. You may want to set max bounds to constrain the map to the relevant region." + }, + "equalEarth": { + "doc": "An Equal Earth projection." + }, + "equirectangular": { + "doc": "An Equirectangular projection. This projection is very similar to the Plate Carrée projection." + }, + "lambertConformalConic": { + "doc": "A Lambert conformal conic projection. You can configure the projection for a region by setting `center` and `parallels` properties. You may want to set max bounds to constrain the map to the relevant region." + }, + "mercator": { + "doc": "The Mercator projection is the default projection." + }, + "naturalEarth": { + "doc": "A Natural Earth projection." + }, + "winkelTripel": { + "doc": "A Winkel Tripel projection." + }, + "globe": { + "doc": "A globe projection." + } + }, + "default": "mercator", + "doc": "The name of the projection to be used for rendering the map.", + "required": true, + "sdk-support": { + "basic functionality": { + "js": "2.6.0" + } + } + }, + "center": { + "type": "array", + "length": 2, + "value": "number", + "property-type": "data-constant", + "minimum": [-180, -90], + "maximum": [180, 90], + "transition": false, + "doc": "The reference longitude and latitude of the projection. `center` takes the form of [lng, lat]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic). All other projections are centered on [0, 0].", + "example": [ + -96, + 37.5 + ], + "requires": [ + { + "name": [ + "albers", + "lambertConformalConic" + ] + } + ], + "sdk-support": { + "basic functionality": { + "js": "2.6.0" + } + } + }, + "parallels": { + "type": "array", + "length": 2, + "value": "number", + "property-type": "data-constant", + "minimum": [-90, -90], + "maximum": [90, 90], + "transition": false, + "doc": "The standard parallels of the projection, denoting the desired latitude range with minimal distortion. `parallels` takes the form of [lat0, lat1]. This property is only configurable for conic projections (Albers and Lambert Conformal Conic).", + "example": [ + 29.5, + 45.5 + ], + "requires": [ + { + "name": [ + "albers", + "lambertConformalConic" + ] + } + ], + "sdk-support": { + "basic functionality": { + "js": "2.6.0" + } + } + } + }, "terrain" : { "source": { "type": "string", @@ -3901,6 +4195,9 @@ }, "transition": true, "doc": "Exaggerates the elevation of the terrain by multiplying the data from the DEM with this value.", + "requires": [ + "source" + ], "sdk-support": { "basic functionality": { "js": "2.0.0", @@ -4358,6 +4655,49 @@ ] }, "property-type": "data-constant" + }, + "fill-extrusion-ambient-occlusion-intensity": { + "property-type": "data-constant", + "type": "number", + "default": 0.0, + "minimum": 0, + "maximum": 1, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "Controls the intensity of ambient occlusion (AO) shading. Current AO implementation is a low-cost best-effort approach that shades area near ground and concave angles between walls. Default value 0.0 disables ambient occlusion and values around 0.3 provide the most plausible results for buildings.", + "sdk-support": { + "basic functionality": { + "js": "2.8.3", + "android": "10.7.0", + "ios": "10.7.0" + } + } + }, + "fill-extrusion-ambient-occlusion-radius": { + "property-type": "data-constant", + "type": "number", + "default": 3.0, + "minimum": 0, + "expression": { + "interpolated": true, + "parameters": [ + "zoom" + ] + }, + "transition": true, + "doc": "The radius of ambient occlusion (AO) shading, in meters. Current AO implementation is a low-cost best-effort approach that shades area near ground and concave angles between walls where the radius defines only vertical impact. Default value 3.0 corresponds to hight of one floor and brings the most plausible results for buildings.", + "sdk-support": { + "basic functionality": { + "js": "2.8.3", + "android": "10.7.0", + "ios": "10.7.0" + } + } } }, "paint_line": { @@ -4697,6 +5037,33 @@ ] }, "property-type": "color-ramp" + }, + "line-trim-offset": { + "type": "array", + "value": "number", + "doc": "The line part between [trim-start, trim-end] will be marked as transparent to make a route vanishing effect. The line trim-off offset is based on the whole line range [0.0, 1.0].", + "length": 2, + "default": [0.0, 0.0], + "minimum": [0.0, 0.0], + "maximum": [1.0, 1.0], + "transition": false, + "requires": [ + { + "source": "geojson", + "has": { + "lineMetrics": true + } + } + ], + "sdk-support": { + "basic functionality": { + "js": "2.9.0", + "android": "10.5.0", + "ios": "10.5.0", + "macos": "10.5.0" + } + }, + "property-type": "constant" } }, "paint_circle": {