From a0f0586f4e4631bf025b70497cd7a60911ecb484 Mon Sep 17 00:00:00 2001 From: Ty Rauber Date: Tue, 24 Sep 2024 17:12:53 +0200 Subject: [PATCH] fix: scripts autogenerate and globals to accommodate new style-spec --- .../components/styles/RCTMLNStyleFactory.java | 13 +- docs/FillExtrusionLayer.md | 19 + docs/RasterLayer.md | 2 +- docs/SymbolLayer.md | 12 +- docs/docs.json | 31 +- ios/RCTMLN/RCTMLNStyle.h | 1 + ios/RCTMLN/RCTMLNStyle.m | 7 + javascript/utils/MaplibreStyles.d.ts | 430 ++++++++---------- javascript/utils/styleMap.ts | 1 + scripts/autogenHelpers/globals.js | 2 +- scripts/autogenerate.js | 13 +- 11 files changed, 273 insertions(+), 258 deletions(-) diff --git a/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java b/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java index 56118a255..6f5656faf 100644 --- a/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java +++ b/android/rctmln/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java @@ -582,6 +582,9 @@ public void onAllImagesLoaded() { case "fillExtrusionBaseTransition": RCTMLNStyleFactory.setFillExtrusionBaseTransition(layer, styleValue); break; + case "fillExtrusionVerticalGradient": + RCTMLNStyleFactory.setFillExtrusionVerticalGradient(layer, styleValue); + break; } } } @@ -1207,7 +1210,7 @@ public static void setIconPadding(SymbolLayer layer, RCTMLNStyleValue styleValue if (styleValue.isExpression()) { layer.setProperties(PropertyFactory.iconPadding(styleValue.getExpression())); } else { - layer.setProperties(PropertyFactory.iconPadding(styleValue.getFloat(VALUE_KEY))); + layer.setProperties(PropertyFactory.iconPadding(styleValue.getFloatArray(VALUE_KEY))); } } @@ -1975,6 +1978,14 @@ public static void setFillExtrusionBaseTransition(FillExtrusionLayer layer, RCTM } } + public static void setFillExtrusionVerticalGradient(FillExtrusionLayer layer, RCTMLNStyleValue styleValue) { + if (styleValue.isExpression()) { + layer.setProperties(PropertyFactory.fillExtrusionVerticalGradient(styleValue.getExpression())); + } else { + layer.setProperties(PropertyFactory.fillExtrusionVerticalGradient(styleValue.getBoolean(VALUE_KEY))); + } + } + public static void setVisibility(RasterLayer layer, RCTMLNStyleValue styleValue) { layer.setProperties(PropertyFactory.visibility(styleValue.getString(VALUE_KEY))); } diff --git a/docs/FillExtrusionLayer.md b/docs/FillExtrusionLayer.md index 84465f943..c0b469d87 100644 --- a/docs/FillExtrusionLayer.md +++ b/docs/FillExtrusionLayer.md @@ -19,6 +19,7 @@ * fillExtrusionPattern
* fillExtrusionHeight
* fillExtrusionBase
+* fillExtrusionVerticalGradient
___ @@ -317,3 +318,21 @@ The transition affecting any changes to this layer’s fillExtrusionBase propery `{duration: 300, delay: 0}` +___ + +#### Name +`fillExtrusionVerticalGradient` + +#### Description +Whether to apply a vertical gradient to the sides of a fillExtrusion layer. If true, sides will be shaded slightly darker farther down. + +#### Type +`boolean` +#### Default Value +`true` + + +#### Expression + +Parameters: `zoom` + diff --git a/docs/RasterLayer.md b/docs/RasterLayer.md index 36cf28064..e6c87fc4c 100644 --- a/docs/RasterLayer.md +++ b/docs/RasterLayer.md @@ -329,7 +329,7 @@ ___ `rasterFadeDuration` #### Description -Fade duration when a new tile is added. +Fade duration when a new tile is added, or when a video is started or its coordinates are updated. #### Type `number` diff --git a/docs/SymbolLayer.md b/docs/SymbolLayer.md index 05aa5ed15..fe12f9e9a 100644 --- a/docs/SymbolLayer.md +++ b/docs/SymbolLayer.md @@ -389,12 +389,12 @@ ___ `iconPadding` #### Description -Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides. +Size of additional area round the icon bounding box used for detecting symbol collisions. #### Type -`number` +`array` #### Default Value -`2` +`[2]` #### Units `pixels` @@ -1122,7 +1122,7 @@ ___ `iconColor` #### Description -The color of the icon. This can only be used with sdf icons. +The color of the icon. This can only be used with SDF icons. #### Type `color` @@ -1204,7 +1204,9 @@ ___ `iconHaloWidth` #### Description -Distance of halo to the icon outline. +Distance of halo to the icon outline. + +The unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc. #### Type `number` diff --git a/docs/docs.json b/docs/docs.json index f5202da66..d2c0d5aa6 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -1072,6 +1072,23 @@ ] }, "transition": true + }, + { + "name": "fillExtrusionVerticalGradient", + "type": "boolean", + "values": [], + "default": true, + "description": "Whether to apply a vertical gradient to the sides of a fillExtrusion layer. If true, sides will be shaded slightly darker farther down.", + "requires": [], + "disabledBy": [], + "allowedFunctionTypes": [], + "expression": { + "interpolated": false, + "parameters": [ + "zoom" + ] + }, + "transition": false } ] }, @@ -2966,7 +2983,7 @@ "minimum": 0, "units": "milliseconds", "default": 300, - "description": "Fade duration when a new tile is added.", + "description": "Fade duration when a new tile is added, or when a video is started or its coordinates are updated.", "requires": [], "disabledBy": [], "allowedFunctionTypes": [], @@ -3733,11 +3750,13 @@ }, { "name": "iconPadding", - "type": "number", + "type": "array", "values": [], "units": "pixels", - "default": 2, - "description": "Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides.", + "default": [ + 2 + ], + "description": "Size of additional area round the icon bounding box used for detecting symbol collisions.", "requires": [ "iconImage" ], @@ -4460,7 +4479,7 @@ "type": "color", "values": [], "default": "#000000", - "description": "The color of the icon. This can only be used with sdf icons.", + "description": "The color of the icon. This can only be used with SDF icons.", "requires": [ "iconImage" ], @@ -4504,7 +4523,7 @@ "minimum": 0, "units": "pixels", "default": 0, - "description": "Distance of halo to the icon outline.", + "description": "Distance of halo to the icon outline. \n\nThe unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.", "requires": [ "iconImage" ], diff --git a/ios/RCTMLN/RCTMLNStyle.h b/ios/RCTMLN/RCTMLNStyle.h index 383e6dea3..ef3d92889 100644 --- a/ios/RCTMLN/RCTMLNStyle.h +++ b/ios/RCTMLN/RCTMLNStyle.h @@ -177,6 +177,7 @@ - (void)setFillExtrusionHeightTransition:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; - (void)setFillExtrusionBase:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; - (void)setFillExtrusionBaseTransition:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; +- (void)setFillExtrusionVerticalGradient:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; - (void)setRasterStyleLayerVisibility:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; - (void)setRasterOpacity:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; - (void)setRasterOpacityTransition:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue; diff --git a/ios/RCTMLN/RCTMLNStyle.m b/ios/RCTMLN/RCTMLNStyle.m index a6be18488..a5ffbe604 100644 --- a/ios/RCTMLN/RCTMLNStyle.m +++ b/ios/RCTMLN/RCTMLNStyle.m @@ -499,6 +499,8 @@ - (void)fillExtrusionLayer:(MLNFillExtrusionStyleLayer *)layer withReactStyle:(N [self setFillExtrusionBase:layer withReactStyleValue:styleValue]; } else if ([prop isEqualToString:@"fillExtrusionBaseTransition"]) { [self setFillExtrusionBaseTransition:layer withReactStyleValue:styleValue]; + } else if ([prop isEqualToString:@"fillExtrusionVerticalGradient"]) { + [self setFillExtrusionVerticalGradient:layer withReactStyleValue:styleValue]; } else { // TODO throw exception } @@ -1457,6 +1459,11 @@ - (void)setFillExtrusionBaseTransition:(MLNFillExtrusionStyleLayer *)layer withR layer.fillExtrusionBaseTransition = [styleValue getTransition]; } +- (void)setFillExtrusionVerticalGradient:(MLNFillExtrusionStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue +{ + layer.fillExtrusionHasVerticalGradient = styleValue.mlnStyleValue; +} + - (void)setRasterStyleLayerVisibility:(MLNRasterStyleLayer *)layer withReactStyleValue:(RCTMLNStyleValue *)styleValue diff --git a/javascript/utils/MaplibreStyles.d.ts b/javascript/utils/MaplibreStyles.d.ts index 1bf803e06..6d121642f 100644 --- a/javascript/utils/MaplibreStyles.d.ts +++ b/javascript/utils/MaplibreStyles.d.ts @@ -132,21 +132,21 @@ export type Value = | T | Expression; -enum VisibilityEnum { +export enum VisibilityEnum { /** The layer is shown. */ Visible = "visible", /** The layer is not shown. */ None = "none", } type VisibilityEnumValues = "visible" | "none"; -enum FillTranslateAnchorEnum { +export enum FillTranslateAnchorEnum { /** The fill is translated relative to the map. */ Map = "map", /** The fill is translated relative to the viewport. */ Viewport = "viewport", } type FillTranslateAnchorEnumValues = "map" | "viewport"; -enum LineCapEnum { +export 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. */ @@ -155,7 +155,7 @@ enum LineCapEnum { Square = "square", } type LineCapEnumValues = "butt" | "round" | "square"; -enum LineJoinEnum { +export 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. */ @@ -164,14 +164,14 @@ enum LineJoinEnum { Miter = "miter", } type LineJoinEnumValues = "bevel" | "round" | "miter"; -enum LineTranslateAnchorEnum { +export enum LineTranslateAnchorEnum { /** The line is translated relative to the map. */ Map = "map", /** The line is translated relative to the viewport. */ Viewport = "viewport", } type LineTranslateAnchorEnumValues = "map" | "viewport"; -enum SymbolPlacementEnum { +export 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. */ @@ -180,7 +180,7 @@ enum SymbolPlacementEnum { LineCenter = "line-center", } type SymbolPlacementEnumValues = "point" | "line" | "line-center"; -enum SymbolZOrderEnum { +export 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`. */ @@ -189,7 +189,7 @@ enum SymbolZOrderEnum { Source = "source", } type SymbolZOrderEnumValues = "auto" | "viewport-y" | "source"; -enum IconRotationAlignmentEnum { +export 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`. */ @@ -198,7 +198,7 @@ enum IconRotationAlignmentEnum { Auto = "auto", } type IconRotationAlignmentEnumValues = "map" | "viewport" | "auto"; -enum IconTextFitEnum { +export 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. */ @@ -209,7 +209,7 @@ enum IconTextFitEnum { Both = "both", } type IconTextFitEnumValues = "none" | "width" | "height" | "both"; -enum IconAnchorEnum { +export 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. */ @@ -239,7 +239,7 @@ type IconAnchorEnumValues = | "top-right" | "bottom-left" | "bottom-right"; -enum IconPitchAlignmentEnum { +export enum IconPitchAlignmentEnum { /** The icon is aligned to the plane of the map. */ Map = "map", /** The icon is aligned to the plane of the viewport. */ @@ -248,7 +248,7 @@ enum IconPitchAlignmentEnum { Auto = "auto", } type IconPitchAlignmentEnumValues = "map" | "viewport" | "auto"; -enum TextPitchAlignmentEnum { +export enum TextPitchAlignmentEnum { /** The text is aligned to the plane of the map. */ Map = "map", /** The text is aligned to the plane of the viewport. */ @@ -257,7 +257,7 @@ enum TextPitchAlignmentEnum { Auto = "auto", } type TextPitchAlignmentEnumValues = "map" | "viewport" | "auto"; -enum TextRotationAlignmentEnum { +export 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`. */ @@ -272,7 +272,7 @@ type TextRotationAlignmentEnumValues = | "viewport" | "viewport-glyph" | "auto"; -enum TextJustifyEnum { +export enum TextJustifyEnum { /** The text is aligned towards the anchor position. */ Auto = "auto", /** The text is aligned to the left. */ @@ -283,7 +283,7 @@ enum TextJustifyEnum { Right = "right", } type TextJustifyEnumValues = "auto" | "left" | "center" | "right"; -enum TextVariableAnchorEnum { +export 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. */ @@ -313,7 +313,7 @@ type TextVariableAnchorEnumValues = | "top-right" | "bottom-left" | "bottom-right"; -enum TextAnchorEnum { +export 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. */ @@ -343,14 +343,14 @@ type TextAnchorEnumValues = | "top-right" | "bottom-left" | "bottom-right"; -enum TextWritingModeEnum { +export enum TextWritingModeEnum { /** If a text's language supports horizontal writing mode, symbols with point placement would be laid out horizontally. */ Horizontal = "horizontal", /** If a text's language supports vertical writing mode, symbols with point placement would be laid out vertically. */ Vertical = "vertical", } type TextWritingModeEnumValues = "horizontal" | "vertical"; -enum TextTransformEnum { +export enum TextTransformEnum { /** The text is not altered. */ None = "none", /** Forces all letters to be displayed in uppercase. */ @@ -359,63 +359,63 @@ enum TextTransformEnum { Lowercase = "lowercase", } type TextTransformEnumValues = "none" | "uppercase" | "lowercase"; -enum IconTranslateAnchorEnum { +export enum IconTranslateAnchorEnum { /** Icons are translated relative to the map. */ Map = "map", /** Icons are translated relative to the viewport. */ Viewport = "viewport", } type IconTranslateAnchorEnumValues = "map" | "viewport"; -enum TextTranslateAnchorEnum { +export enum TextTranslateAnchorEnum { /** The text is translated relative to the map. */ Map = "map", /** The text is translated relative to the viewport. */ Viewport = "viewport", } type TextTranslateAnchorEnumValues = "map" | "viewport"; -enum CircleTranslateAnchorEnum { +export enum CircleTranslateAnchorEnum { /** The circle is translated relative to the map. */ Map = "map", /** The circle is translated relative to the viewport. */ Viewport = "viewport", } type CircleTranslateAnchorEnumValues = "map" | "viewport"; -enum CirclePitchScaleEnum { +export enum CirclePitchScaleEnum { /** Circles are scaled according to their apparent distance to the camera. */ Map = "map", /** Circles are not scaled. */ Viewport = "viewport", } type CirclePitchScaleEnumValues = "map" | "viewport"; -enum CirclePitchAlignmentEnum { +export 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", } type CirclePitchAlignmentEnumValues = "map" | "viewport"; -enum FillExtrusionTranslateAnchorEnum { +export enum FillExtrusionTranslateAnchorEnum { /** The fill extrusion is translated relative to the map. */ Map = "map", /** The fill extrusion is translated relative to the viewport. */ Viewport = "viewport", } type FillExtrusionTranslateAnchorEnumValues = "map" | "viewport"; -enum RasterResamplingEnum { +export 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", } type RasterResamplingEnumValues = "linear" | "nearest"; -enum HillshadeIlluminationAnchorEnum { +export 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", } type HillshadeIlluminationAnchorEnumValues = "map" | "viewport"; -enum AnchorEnum { +export 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. */ @@ -429,19 +429,19 @@ 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; + fillSortKey?: number; /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * Whether or not the fill should be antialiased. */ - fillAntialias?: Value; + fillAntialias?: boolean; /** * 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; + fillOpacity?: number; /** * The transition affecting any changes to this layer’s fillOpacity property. @@ -452,7 +452,7 @@ export interface FillLayerStyleProps { * * @disabledBy fillPattern */ - fillColor?: Value; + fillColor?: string; /** * The transition affecting any changes to this layer’s fillColor property. @@ -463,7 +463,7 @@ export interface FillLayerStyleProps { * * @disabledBy fillPattern */ - fillOutlineColor?: Value; + fillOutlineColor?: string; /** * The transition affecting any changes to this layer’s fillOutlineColor property. @@ -472,7 +472,7 @@ export interface FillLayerStyleProps { /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. */ - fillTranslate?: Value; + fillTranslate?: any[]; /** * The transition affecting any changes to this layer’s fillTranslate property. @@ -483,14 +483,11 @@ export interface FillLayerStyleProps { * * @requires fillTranslate */ - fillTranslateAnchor?: Value< - Enum, - ["zoom"] - >; + fillTranslateAnchor?: "map" | "viewport"; /** * 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?: Value; + fillPattern?: string; /** * The transition affecting any changes to this layer’s fillPattern property. @@ -501,31 +498,31 @@ export interface LineLayerStyleProps { /** * The display of line endings. */ - lineCap?: Value, ["zoom"]>; + lineCap?: "butt" | "round" | "square"; /** * The display of lines when joining. */ - lineJoin?: Value, ["zoom", "feature"]>; + lineJoin?: "bevel" | "round" | "miter"; /** * Used to automatically convert miter joins to bevel joins for sharp angles. */ - lineMiterLimit?: Value; + lineMiterLimit?: number; /** * Used to automatically convert round joins to miter joins for shallow angles. */ - lineRoundLimit?: Value; + lineRoundLimit?: number; /** * 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; + lineSortKey?: number; /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * The opacity at which the line will be drawn. */ - lineOpacity?: Value; + lineOpacity?: number; /** * The transition affecting any changes to this layer’s lineOpacity property. @@ -536,7 +533,7 @@ export interface LineLayerStyleProps { * * @disabledBy linePattern */ - lineColor?: Value; + lineColor?: string; /** * The transition affecting any changes to this layer’s lineColor property. @@ -545,7 +542,7 @@ export interface LineLayerStyleProps { /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. */ - lineTranslate?: Value; + lineTranslate?: any[]; /** * The transition affecting any changes to this layer’s lineTranslate property. @@ -556,14 +553,11 @@ export interface LineLayerStyleProps { * * @requires lineTranslate */ - lineTranslateAnchor?: Value< - Enum, - ["zoom"] - >; + lineTranslateAnchor?: "map" | "viewport"; /** * Stroke thickness. */ - lineWidth?: Value; + lineWidth?: number; /** * The transition affecting any changes to this layer’s lineWidth property. @@ -572,7 +566,7 @@ export interface LineLayerStyleProps { /** * Draws a line casing outside of a line's actual path. Value indicates the width of the inner gap. */ - lineGapWidth?: Value; + lineGapWidth?: number; /** * The transition affecting any changes to this layer’s lineGapWidth property. @@ -581,7 +575,7 @@ export interface LineLayerStyleProps { /** * 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; + lineOffset?: number; /** * The transition affecting any changes to this layer’s lineOffset property. @@ -590,7 +584,7 @@ export interface LineLayerStyleProps { /** * Blur applied to the line, in pixels. */ - lineBlur?: Value; + lineBlur?: number; /** * The transition affecting any changes to this layer’s lineBlur property. @@ -601,7 +595,7 @@ export interface LineLayerStyleProps { * * @disabledBy linePattern */ - lineDasharray?: Value; + lineDasharray?: any[]; /** * The transition affecting any changes to this layer’s lineDasharray property. @@ -610,7 +604,7 @@ export interface LineLayerStyleProps { /** * 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?: Value; + linePattern?: string; /** * The transition affecting any changes to this layer’s linePattern property. @@ -621,35 +615,29 @@ export interface LineLayerStyleProps { * * @disabledBy lineDasharray, linePattern */ - lineGradient?: Value; + lineGradient?: string; } export interface SymbolLayerStyleProps { /** * Label placement relative to its geometry. */ - symbolPlacement?: Value< - Enum, - ["zoom"] - >; + symbolPlacement?: "point" | "line" | "line-center"; /** * Distance between two symbol anchors. */ - symbolSpacing?: Value; + symbolSpacing?: number; /** * 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 MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries. */ - symbolAvoidEdges?: Value; + symbolAvoidEdges?: boolean; /** * 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; + symbolSortKey?: number; /** * 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< - Enum, - ["zoom"] - >; + symbolZOrder?: "auto" | "viewport-y" | "source"; /** * If true, the icon will be visible even if it collides with other previously drawn symbols. * @@ -657,168 +645,156 @@ export interface SymbolLayerStyleProps { * * @disabledBy iconOverlap */ - iconAllowOverlap?: Value; + iconAllowOverlap?: boolean; /** * If true, other symbols can be visible even if they collide with the icon. * * @requires iconImage */ - iconIgnorePlacement?: Value; + iconIgnorePlacement?: boolean; /** * 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; + iconOptional?: boolean; /** * In combination with `symbolPlacement`, determines the rotation behavior of icons. * * @requires iconImage */ - iconRotationAlignment?: Value< - Enum, - ["zoom"] - >; + iconRotationAlignment?: "map" | "viewport" | "auto"; /** * 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; + iconSize?: number; /** * Scales the icon to fit around the associated text. * * @requires iconImage, textField */ - iconTextFit?: Value, ["zoom"]>; + iconTextFit?: "none" | "width" | "height" | "both"; /** * Size of the additional area added to dimensions determined by `iconTextFit`, in clockwise order: top, right, bottom, left. * * @requires iconImage, textField */ - iconTextFitPadding?: Value; + iconTextFitPadding?: any[]; /** * Name of image in sprite to use for drawing an image background. */ - iconImage?: Value; + iconImage?: string; /** * Rotates the icon clockwise. * * @requires iconImage */ - iconRotate?: Value; + iconRotate?: number; /** - * Size of additional area round the icon bounding box used for detecting symbol collisions. Values are declared using CSS margin shorthand syntax: a single value applies to all four sides; two values apply to [top/bottom, left/right]; three values apply to [top, left/right, bottom]; four values apply to [top, right, bottom, left]. For backwards compatibility, a single bare number is accepted, and treated the same as a oneElement array padding applied to all sides. + * Size of additional area round the icon bounding box used for detecting symbol collisions. * * @requires iconImage */ - iconPadding?: Value; + iconPadding?: any[]; /** * If true, the icon may be flipped to prevent it from being rendered upsideDown. * * @requires iconImage */ - iconKeepUpright?: Value; + iconKeepUpright?: boolean; /** * 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; + iconOffset?: any[]; /** * Part of the icon placed closest to the anchor. * * @requires iconImage */ - iconAnchor?: Value< - Enum, - ["zoom", "feature"] - >; + iconAnchor?: + | "center" + | "left" + | "right" + | "top" + | "bottom" + | "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; /** * Orientation of icon when map is pitched. * * @requires iconImage */ - iconPitchAlignment?: Value< - Enum, - ["zoom"] - >; + iconPitchAlignment?: "map" | "viewport" | "auto"; /** * Orientation of text when map is pitched. * * @requires textField */ - textPitchAlignment?: Value< - Enum, - ["zoom"] - >; + textPitchAlignment?: "map" | "viewport" | "auto"; /** * In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text. * * @requires textField */ - textRotationAlignment?: Value< - Enum, - ["zoom"] - >; + textRotationAlignment?: "map" | "viewport" | "viewport-glyph" | "auto"; /** * 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. */ - textField?: Value; + textField?: string; /** * Font stack to use for displaying text. * * @requires textField */ - textFont?: Value; + textFont?: any[]; /** * Font size. * * @requires textField */ - textSize?: Value; + textSize?: number; /** * The maximum line width for text wrapping. * * @requires textField */ - textMaxWidth?: Value; + textMaxWidth?: number; /** * Text leading value for multiLine text. * * @requires textField */ - textLineHeight?: Value; + textLineHeight?: number; /** * Text tracking amount. * * @requires textField */ - textLetterSpacing?: Value; + textLetterSpacing?: number; /** * Text justification options. * * @requires textField */ - textJustify?: Value< - Enum, - ["zoom", "feature"] - >; + textJustify?: "auto" | "left" | "center" | "right"; /** * 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; + textRadialOffset?: number; /** * 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< - Enum[], - ["zoom"] - >; + textVariableAnchor?: any[]; /** * Part of the text placed closest to the anchor. * @@ -826,52 +802,52 @@ export interface SymbolLayerStyleProps { * * @disabledBy textVariableAnchor */ - textAnchor?: Value< - Enum, - ["zoom", "feature"] - >; + textAnchor?: + | "center" + | "left" + | "right" + | "top" + | "bottom" + | "top-left" + | "top-right" + | "bottom-left" + | "bottom-right"; /** * Maximum angle change between adjacent characters. * * @requires textField */ - textMaxAngle?: Value; + textMaxAngle?: number; /** * 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. The order of elements in an array define priority order for the placement of an orientation variant. * * @requires textField */ - textWritingMode?: Value< - Enum[], - ["zoom"] - >; + textWritingMode?: any[]; /** * Rotates the text clockwise. * * @requires textField */ - textRotate?: Value; + textRotate?: number; /** * Size of the additional area around the text bounding box used for detecting symbol collisions. * * @requires textField */ - textPadding?: Value; + textPadding?: number; /** * If true, the text may be flipped vertically to prevent it from being rendered upsideDown. * * @requires textField */ - textKeepUpright?: Value; + textKeepUpright?: boolean; /** * Specifies how to capitalize text, similar to the CSS `textTransform` property. * * @requires textField */ - textTransform?: Value< - Enum, - ["zoom", "feature"] - >; + textTransform?: "none" | "uppercase" | "lowercase"; /** * 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. * @@ -879,7 +855,7 @@ export interface SymbolLayerStyleProps { * * @disabledBy textRadialOffset */ - textOffset?: Value; + textOffset?: any[]; /** * If true, the text will be visible even if it collides with other previously drawn symbols. * @@ -887,40 +863,40 @@ export interface SymbolLayerStyleProps { * * @disabledBy textOverlap */ - textAllowOverlap?: Value; + textAllowOverlap?: boolean; /** * If true, other symbols can be visible even if they collide with the text. * * @requires textField */ - textIgnorePlacement?: Value; + textIgnorePlacement?: boolean; /** * 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; + textOptional?: boolean; /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * The opacity at which the icon will be drawn. * * @requires iconImage */ - iconOpacity?: Value; + iconOpacity?: number; /** * 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. + * The color of the icon. This can only be used with SDF icons. * * @requires iconImage */ - iconColor?: Value; + iconColor?: string; /** * The transition affecting any changes to this layer’s iconColor property. @@ -931,18 +907,20 @@ export interface SymbolLayerStyleProps { * * @requires iconImage */ - iconHaloColor?: Value; + iconHaloColor?: string; /** * The transition affecting any changes to this layer’s iconHaloColor property. */ iconHaloColorTransition?: Transition; /** - * Distance of halo to the icon outline. - * - * @requires iconImage - */ - iconHaloWidth?: Value; + * Distance of halo to the icon outline. + +The unit is in pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc. + * + * @requires iconImage + */ + iconHaloWidth?: number; /** * The transition affecting any changes to this layer’s iconHaloWidth property. @@ -953,7 +931,7 @@ export interface SymbolLayerStyleProps { * * @requires iconImage */ - iconHaloBlur?: Value; + iconHaloBlur?: number; /** * The transition affecting any changes to this layer’s iconHaloBlur property. @@ -964,7 +942,7 @@ export interface SymbolLayerStyleProps { * * @requires iconImage */ - iconTranslate?: Value; + iconTranslate?: any[]; /** * The transition affecting any changes to this layer’s iconTranslate property. @@ -975,16 +953,13 @@ export interface SymbolLayerStyleProps { * * @requires iconImage, iconTranslate */ - iconTranslateAnchor?: Value< - Enum, - ["zoom"] - >; + iconTranslateAnchor?: "map" | "viewport"; /** * The opacity at which the text will be drawn. * * @requires textField */ - textOpacity?: Value; + textOpacity?: number; /** * The transition affecting any changes to this layer’s textOpacity property. @@ -995,7 +970,7 @@ export interface SymbolLayerStyleProps { * * @requires textField */ - textColor?: Value; + textColor?: string; /** * The transition affecting any changes to this layer’s textColor property. @@ -1006,7 +981,7 @@ export interface SymbolLayerStyleProps { * * @requires textField */ - textHaloColor?: Value; + textHaloColor?: string; /** * The transition affecting any changes to this layer’s textHaloColor property. @@ -1017,7 +992,7 @@ export interface SymbolLayerStyleProps { * * @requires textField */ - textHaloWidth?: Value; + textHaloWidth?: number; /** * The transition affecting any changes to this layer’s textHaloWidth property. @@ -1028,7 +1003,7 @@ export interface SymbolLayerStyleProps { * * @requires textField */ - textHaloBlur?: Value; + textHaloBlur?: number; /** * The transition affecting any changes to this layer’s textHaloBlur property. @@ -1039,7 +1014,7 @@ export interface SymbolLayerStyleProps { * * @requires textField */ - textTranslate?: Value; + textTranslate?: any[]; /** * The transition affecting any changes to this layer’s textTranslate property. @@ -1050,24 +1025,21 @@ export interface SymbolLayerStyleProps { * * @requires textField, textTranslate */ - textTranslateAnchor?: Value< - Enum, - ["zoom"] - >; + textTranslateAnchor?: "map" | "viewport"; } 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; + circleSortKey?: number; /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * Circle radius. */ - circleRadius?: Value; + circleRadius?: number; /** * The transition affecting any changes to this layer’s circleRadius property. @@ -1076,7 +1048,7 @@ export interface CircleLayerStyleProps { /** * The fill color of the circle. */ - circleColor?: Value; + circleColor?: string; /** * The transition affecting any changes to this layer’s circleColor property. @@ -1085,7 +1057,7 @@ export interface CircleLayerStyleProps { /** * Amount to blur the circle. 1 blurs the circle such that only the centerpoint is full opacity. */ - circleBlur?: Value; + circleBlur?: number; /** * The transition affecting any changes to this layer’s circleBlur property. @@ -1094,7 +1066,7 @@ export interface CircleLayerStyleProps { /** * The opacity at which the circle will be drawn. */ - circleOpacity?: Value; + circleOpacity?: number; /** * The transition affecting any changes to this layer’s circleOpacity property. @@ -1103,7 +1075,7 @@ export interface CircleLayerStyleProps { /** * The geometry's offset. Values are [x, y] where negatives indicate left and up, respectively. */ - circleTranslate?: Value; + circleTranslate?: any[]; /** * The transition affecting any changes to this layer’s circleTranslate property. @@ -1114,28 +1086,19 @@ export interface CircleLayerStyleProps { * * @requires circleTranslate */ - circleTranslateAnchor?: Value< - Enum, - ["zoom"] - >; + circleTranslateAnchor?: "map" | "viewport"; /** * Controls the scaling behavior of the circle when the map is pitched. */ - circlePitchScale?: Value< - Enum, - ["zoom"] - >; + circlePitchScale?: "map" | "viewport"; /** * Orientation of circle when map is pitched. */ - circlePitchAlignment?: Value< - Enum, - ["zoom"] - >; + circlePitchAlignment?: "map" | "viewport"; /** * The width of the circle's stroke. Strokes are placed outside of the `circleRadius`. */ - circleStrokeWidth?: Value; + circleStrokeWidth?: number; /** * The transition affecting any changes to this layer’s circleStrokeWidth property. @@ -1144,7 +1107,7 @@ export interface CircleLayerStyleProps { /** * The stroke color of the circle. */ - circleStrokeColor?: Value; + circleStrokeColor?: string; /** * The transition affecting any changes to this layer’s circleStrokeColor property. @@ -1153,7 +1116,7 @@ export interface CircleLayerStyleProps { /** * The opacity of the circle's stroke. */ - circleStrokeOpacity?: Value; + circleStrokeOpacity?: number; /** * The transition affecting any changes to this layer’s circleStrokeOpacity property. @@ -1164,11 +1127,11 @@ export interface HeatmapLayerStyleProps { /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * Radius of influence of one heatmap point in pixels. Increasing the value makes the heatmap smoother, but less detailed. */ - heatmapRadius?: Value; + heatmapRadius?: number; /** * The transition affecting any changes to this layer’s heatmapRadius property. @@ -1177,11 +1140,11 @@ export interface HeatmapLayerStyleProps { /** * 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; + heatmapWeight?: number; /** * Similar to `heatmapWeight` but controls the intensity of the heatmap globally. Primarily used for adjusting the heatmap based on zoom level. */ - heatmapIntensity?: Value; + heatmapIntensity?: number; /** * The transition affecting any changes to this layer’s heatmapIntensity property. @@ -1190,11 +1153,11 @@ export interface HeatmapLayerStyleProps { /** * 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; + heatmapColor?: string; /** * The global opacity at which the heatmap layer will be drawn. */ - heatmapOpacity?: Value; + heatmapOpacity?: number; /** * The transition affecting any changes to this layer’s heatmapOpacity property. @@ -1205,11 +1168,11 @@ export interface FillExtrusionLayerStyleProps { /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * 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; + fillExtrusionOpacity?: number; /** * The transition affecting any changes to this layer’s fillExtrusionOpacity property. @@ -1220,7 +1183,7 @@ export interface FillExtrusionLayerStyleProps { * * @disabledBy fillExtrusionPattern */ - fillExtrusionColor?: Value; + fillExtrusionColor?: string; /** * The transition affecting any changes to this layer’s fillExtrusionColor property. @@ -1229,7 +1192,7 @@ export interface FillExtrusionLayerStyleProps { /** * The geometry's offset. Values are [x, y] where negatives indicate left and up (on the flat plane), respectively. */ - fillExtrusionTranslate?: Value; + fillExtrusionTranslate?: any[]; /** * The transition affecting any changes to this layer’s fillExtrusionTranslate property. @@ -1240,17 +1203,11 @@ export interface FillExtrusionLayerStyleProps { * * @requires fillExtrusionTranslate */ - fillExtrusionTranslateAnchor?: Value< - Enum< - FillExtrusionTranslateAnchorEnum, - FillExtrusionTranslateAnchorEnumValues - >, - ["zoom"] - >; + fillExtrusionTranslateAnchor?: "map" | "viewport"; /** * 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?: Value; + fillExtrusionPattern?: string; /** * The transition affecting any changes to this layer’s fillExtrusionPattern property. @@ -1259,7 +1216,7 @@ export interface FillExtrusionLayerStyleProps { /** * The height with which to extrude this layer. */ - fillExtrusionHeight?: Value; + fillExtrusionHeight?: number; /** * The transition affecting any changes to this layer’s fillExtrusionHeight property. @@ -1270,22 +1227,26 @@ export interface FillExtrusionLayerStyleProps { * * @requires fillExtrusionHeight */ - fillExtrusionBase?: Value; + fillExtrusionBase?: number; /** * 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?: boolean; } export interface RasterLayerStyleProps { /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * The opacity at which the image will be drawn. */ - rasterOpacity?: Value; + rasterOpacity?: number; /** * The transition affecting any changes to this layer’s rasterOpacity property. @@ -1294,7 +1255,7 @@ export interface RasterLayerStyleProps { /** * Rotates hues around the color wheel. */ - rasterHueRotate?: Value; + rasterHueRotate?: number; /** * The transition affecting any changes to this layer’s rasterHueRotate property. @@ -1303,7 +1264,7 @@ export interface RasterLayerStyleProps { /** * Increase or reduce the brightness of the image. The value is the minimum brightness. */ - rasterBrightnessMin?: Value; + rasterBrightnessMin?: number; /** * The transition affecting any changes to this layer’s rasterBrightnessMin property. @@ -1312,7 +1273,7 @@ export interface RasterLayerStyleProps { /** * Increase or reduce the brightness of the image. The value is the maximum brightness. */ - rasterBrightnessMax?: Value; + rasterBrightnessMax?: number; /** * The transition affecting any changes to this layer’s rasterBrightnessMax property. @@ -1321,7 +1282,7 @@ export interface RasterLayerStyleProps { /** * Increase or reduce the saturation of the image. */ - rasterSaturation?: Value; + rasterSaturation?: number; /** * The transition affecting any changes to this layer’s rasterSaturation property. @@ -1330,7 +1291,7 @@ export interface RasterLayerStyleProps { /** * Increase or reduce the contrast of the image. */ - rasterContrast?: Value; + rasterContrast?: number; /** * The transition affecting any changes to this layer’s rasterContrast property. @@ -1339,38 +1300,29 @@ export interface RasterLayerStyleProps { /** * The resampling/interpolation method to use for overscaling, also known as texture magnification filter */ - rasterResampling?: Value< - Enum, - ["zoom"] - >; + rasterResampling?: "linear" | "nearest"; /** - * Fade duration when a new tile is added. + * Fade duration when a new tile is added, or when a video is started or its coordinates are updated. */ - rasterFadeDuration?: Value; + rasterFadeDuration?: number; } export interface HillshadeLayerStyleProps { /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * 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; + hillshadeIlluminationDirection?: number; /** * Direction of light source when map is rotated. */ - hillshadeIlluminationAnchor?: Value< - Enum< - HillshadeIlluminationAnchorEnum, - HillshadeIlluminationAnchorEnumValues - >, - ["zoom"] - >; + hillshadeIlluminationAnchor?: "map" | "viewport"; /** * Intensity of the hillshade */ - hillshadeExaggeration?: Value; + hillshadeExaggeration?: number; /** * The transition affecting any changes to this layer’s hillshadeExaggeration property. @@ -1379,7 +1331,7 @@ export interface HillshadeLayerStyleProps { /** * The shading color of areas that face away from the light source. */ - hillshadeShadowColor?: Value; + hillshadeShadowColor?: string; /** * The transition affecting any changes to this layer’s hillshadeShadowColor property. @@ -1388,7 +1340,7 @@ export interface HillshadeLayerStyleProps { /** * The shading color of areas that faces towards the light source. */ - hillshadeHighlightColor?: Value; + hillshadeHighlightColor?: string; /** * The transition affecting any changes to this layer’s hillshadeHighlightColor property. @@ -1397,7 +1349,7 @@ export interface HillshadeLayerStyleProps { /** * The shading color used to accentuate rugged terrain like sharp cliffs and gorges. */ - hillshadeAccentColor?: Value; + hillshadeAccentColor?: string; /** * The transition affecting any changes to this layer’s hillshadeAccentColor property. @@ -1408,13 +1360,13 @@ export interface BackgroundLayerStyleProps { /** * Whether this layer is displayed. */ - visibility?: Enum; + visibility?: "visible" | "none"; /** * The color with which the background will be drawn. * * @disabledBy backgroundPattern */ - backgroundColor?: Value; + backgroundColor?: string; /** * The transition affecting any changes to this layer’s backgroundColor property. @@ -1423,7 +1375,7 @@ export interface BackgroundLayerStyleProps { /** * 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?: Value; + backgroundPattern?: string; /** * The transition affecting any changes to this layer’s backgroundPattern property. @@ -1432,7 +1384,7 @@ export interface BackgroundLayerStyleProps { /** * The opacity at which the background will be drawn. */ - backgroundOpacity?: Value; + backgroundOpacity?: number; /** * The transition affecting any changes to this layer’s backgroundOpacity property. @@ -1443,11 +1395,11 @@ export interface LightLayerStyleProps { /** * Whether extruded geometries are lit relative to the map or viewport. */ - anchor?: Value, ["zoom"]>; + anchor?: "map" | "viewport"; /** * 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; + position?: any[]; /** * The transition affecting any changes to this layer’s position property. @@ -1456,7 +1408,7 @@ export interface LightLayerStyleProps { /** * Color tint for lighting extruded geometries. */ - color?: Value; + color?: string; /** * The transition affecting any changes to this layer’s color property. @@ -1465,7 +1417,7 @@ export interface LightLayerStyleProps { /** * Intensity of lighting (on a scale from 0 to 1). Higher numbers will present as more extreme contrast. */ - intensity?: Value; + intensity?: number; /** * The transition affecting any changes to this layer’s intensity property. diff --git a/javascript/utils/styleMap.ts b/javascript/utils/styleMap.ts index 4a7843da2..b696f2ac6 100644 --- a/javascript/utils/styleMap.ts +++ b/javascript/utils/styleMap.ts @@ -178,6 +178,7 @@ const styleMap = { fillExtrusionHeightTransition: StyleTypes.Transition, fillExtrusionBase: StyleTypes.Constant, fillExtrusionBaseTransition: StyleTypes.Transition, + fillExtrusionVerticalGradient: StyleTypes.Constant, rasterOpacity: StyleTypes.Constant, rasterOpacityTransition: StyleTypes.Transition, diff --git a/scripts/autogenHelpers/globals.js b/scripts/autogenHelpers/globals.js index 9f0a982ae..c89941a22 100644 --- a/scripts/autogenHelpers/globals.js +++ b/scripts/autogenHelpers/globals.js @@ -273,7 +273,7 @@ global.dtsInterfaceType = function (prop) { case 'array': return 'any[]'; case 'padding': - return '[number] | [number, number] | [number, number, number] | [number, number, number, number]'; + return 'number[]'; case 'enum': return prop.doc && prop.doc.values ? Object.keys(prop.doc.values).map(value => `'${value}'`).join(' | ') : diff --git a/scripts/autogenerate.js b/scripts/autogenerate.js index 86ca86d4e..250872989 100644 --- a/scripts/autogenerate.js +++ b/scripts/autogenerate.js @@ -139,7 +139,12 @@ function getPropertiesForLayer(layerName) { ) { prop.allowedFunctionTypes = ['camera']; } - + // Overide type padding + if(prop.type === 'padding') { + prop.type = 'array'; + prop.value = 'number'; + prop.length = 4; + } return prop; }); @@ -325,10 +330,6 @@ async function generate() { input: path.join(TMPL_PATH, 'RCTMLNStyle.h.ejs'), output: path.join(IOS_OUTPUT_PATH, 'RCTMLNStyle.h'), }, - /*{ - input: path.join(TMPL_PATH, 'index.d.ts.ejs'), - output: path.join(IOS_OUTPUT_PATH, 'index.d.ts'), - },*/ { input: path.join(TMPL_PATH, 'MaplibreStyles.ts.ejs'), output: path.join(JS_OUTPUT_PATH, 'MaplibreStyles.d.ts'), @@ -360,6 +361,8 @@ async function generate() { results = results.replace(/enum (\w+Enum) \{[^}]+\}\n/g, 'export $&'); // Replace Array with any[] results = results.replace(/Array/g, 'any[]'); + // Replace padding type with float array + results = results.replace(/padding: string;/g, 'padding: number[];'); } fs.writeFileSync(output, results); }));