diff --git a/android/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java b/android/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java
index 6f5656faf..ab4f82a2b 100644
--- a/android/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java
+++ b/android/src/main/java/com/maplibre/rctmln/components/styles/RCTMLNStyleFactory.java
@@ -1,5 +1,5 @@
// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// This file is auto-generated from scripts/templates/RCTMLNStyleFactory.java.ejs
package com.maplibre.rctmln.components.styles;
diff --git a/docs/Annotation.md b/docs/Annotation.md
index 04b9f0274..e6f8db1b5 100644
--- a/docs/Annotation.md
+++ b/docs/Annotation.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/BackgroundLayer.md b/docs/BackgroundLayer.md
index 7e9763acc..d18be83ed 100644
--- a/docs/BackgroundLayer.md
+++ b/docs/BackgroundLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/Callout.md b/docs/Callout.md
index 8ae784a1b..0a5abb2b9 100644
--- a/docs/Callout.md
+++ b/docs/Callout.md
@@ -1,4 +1,4 @@
-
+
# ``
Callout that displays information about a selected annotation near the annotation.
diff --git a/docs/Camera.md b/docs/Camera.md
index fe924a6b4..0f5c09688 100644
--- a/docs/Camera.md
+++ b/docs/Camera.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/CircleLayer.md b/docs/CircleLayer.md
index 2710899cd..41252c94e 100644
--- a/docs/CircleLayer.md
+++ b/docs/CircleLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
CircleLayer is a style layer that renders one or more filled circles on the map.
diff --git a/docs/FillExtrusionLayer.md b/docs/FillExtrusionLayer.md
index 972426841..9508decf8 100644
--- a/docs/FillExtrusionLayer.md
+++ b/docs/FillExtrusionLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
FillExtrusionLayer is a style layer that renders one or more 3D extruded polygons on the map.
diff --git a/docs/FillLayer.md b/docs/FillLayer.md
index c691bb2be..fb310d5e7 100644
--- a/docs/FillLayer.md
+++ b/docs/FillLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
FillLayer is a style layer that renders one or more filled (and optionally stroked) polygons on the map.
diff --git a/docs/HeadingIndicator.md b/docs/HeadingIndicator.md
index 0f29abe4b..34cbaabf3 100644
--- a/docs/HeadingIndicator.md
+++ b/docs/HeadingIndicator.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/HeatmapLayer.md b/docs/HeatmapLayer.md
index e1b6a8fc5..e2e286de8 100644
--- a/docs/HeatmapLayer.md
+++ b/docs/HeatmapLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
HeatmapLayer is a style layer that renders one or more filled circles on the map.
diff --git a/docs/ImageSource.md b/docs/ImageSource.md
index 7b57a6a06..f9782bad5 100644
--- a/docs/ImageSource.md
+++ b/docs/ImageSource.md
@@ -1,4 +1,4 @@
-
+
# ``
ImageSource is a content source that is used for a georeferenced raster image to be shown on the map.
The georeferenced image scales and rotates as the user zooms and rotates the map
diff --git a/docs/Images.md b/docs/Images.md
index 8406e5adc..b4c77f1e7 100644
--- a/docs/Images.md
+++ b/docs/Images.md
@@ -1,4 +1,4 @@
-
+
# ``
Images defines the images used in Symbol etc layers
diff --git a/docs/Light.md b/docs/Light.md
index f2db63601..66179665a 100644
--- a/docs/Light.md
+++ b/docs/Light.md
@@ -1,4 +1,4 @@
-
+
# ``
Light represents the light source for extruded geometries
diff --git a/docs/LineLayer.md b/docs/LineLayer.md
index b2c7fd078..7fce88149 100644
--- a/docs/LineLayer.md
+++ b/docs/LineLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
LineLayer is a style layer that renders one or more stroked polylines on the map.
diff --git a/docs/MapView.md b/docs/MapView.md
index 9c8bda275..4605b9857 100644
--- a/docs/MapView.md
+++ b/docs/MapView.md
@@ -1,4 +1,4 @@
-
+
# ``
MapView backed by MapLibre Native
diff --git a/docs/MarkerView.md b/docs/MarkerView.md
index eb93e0af4..02e29f195 100644
--- a/docs/MarkerView.md
+++ b/docs/MarkerView.md
@@ -1,4 +1,4 @@
-
+
# ``
MarkerView allows you to place a interactive react native marker to the map.
If you have static view consider using PointAnnotation or SymbolLayer they'll offer much better performance
.
This is based on [MakerView plugin](https://docs.mapbox.com/android/plugins/overview/markerview/) on Android
and PointAnnotation on iOS.
diff --git a/docs/NativeUserLocation.md b/docs/NativeUserLocation.md
index a25195ca0..9e63e7eda 100644
--- a/docs/NativeUserLocation.md
+++ b/docs/NativeUserLocation.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/PointAnnotation.md b/docs/PointAnnotation.md
index 903b97b06..97c95f631 100644
--- a/docs/PointAnnotation.md
+++ b/docs/PointAnnotation.md
@@ -1,4 +1,4 @@
-
+
# ``
PointAnnotation represents a one-dimensional shape located at a single geographical coordinate.
Consider using ShapeSource and SymbolLayer instead, if you have many points and you have static images,
they'll offer much better performance
.
If you need interctive views please use MarkerView,
as with PointAnnotation on Android child views are rendered onto a bitmap for better performance.
diff --git a/docs/RasterLayer.md b/docs/RasterLayer.md
index 458dcbbb0..8a377762d 100644
--- a/docs/RasterLayer.md
+++ b/docs/RasterLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/RasterSource.md b/docs/RasterSource.md
index 90dbc4828..b54bb9926 100644
--- a/docs/RasterSource.md
+++ b/docs/RasterSource.md
@@ -1,4 +1,4 @@
-
+
# ``
RasterSource is a map content source that supplies raster image tiles to be shown on the map.
The location of and metadata about the tiles are defined either by an option dictionary
or by an external file that conforms to the TileJSON specification.
diff --git a/docs/ShapeSource.md b/docs/ShapeSource.md
index 285cafd70..73a7cb89e 100644
--- a/docs/ShapeSource.md
+++ b/docs/ShapeSource.md
@@ -1,4 +1,4 @@
-
+
# ``
ShapeSource is a map content source that supplies vector shapes to be shown on the map.
The shape may be a url or a GeoJSON object
diff --git a/docs/Style.md b/docs/Style.md
index 4a1a77217..1591334b9 100644
--- a/docs/Style.md
+++ b/docs/Style.md
@@ -1,4 +1,4 @@
-
+
# ``
Style is a component that automatically adds sources / layers to the map using MapLibre Style Spec.
Only [`sources`](https://maplibre.org/maplibre-gl-js-docs/style-spec/sources/) & [`layers`](https://maplibre.org/maplibre-gl-js-docs/style-spec/layers/) are supported.
Other fields such as `sprites`, `glyphs` etc. will be ignored. Not all layer / source attributes from the style spec are supported, in general the supported attributes will be mentioned under https://github.com/maplibre/maplibre-react-native/tree/main/docs.
TODO: Maintainer forking this project does not understand the above comment regarding what is supported.
diff --git a/docs/SymbolLayer.md b/docs/SymbolLayer.md
index 6772aacf5..4a4fe8ace 100644
--- a/docs/SymbolLayer.md
+++ b/docs/SymbolLayer.md
@@ -1,4 +1,4 @@
-
+
# ``
SymbolLayer is a style layer that renders icon and text labels at points or along lines on the map.
diff --git a/docs/UserLocation.md b/docs/UserLocation.md
index 2b4fd9a79..a99b32938 100644
--- a/docs/UserLocation.md
+++ b/docs/UserLocation.md
@@ -1,4 +1,4 @@
-
+
# ``
diff --git a/docs/VectorSource.md b/docs/VectorSource.md
index 16393244d..c80f3411e 100644
--- a/docs/VectorSource.md
+++ b/docs/VectorSource.md
@@ -1,4 +1,4 @@
-
+
# ``
VectorSource is a map content source that supplies tiled vector data in Mapbox Vector Tile format to be shown on the map.
The location of and metadata about the tiles are defined either by an option dictionary or by an external file that conforms to the TileJSON specification.
diff --git a/docs/coordinates.md b/docs/coordinates.md
index 36c9b04f2..e26f838b1 100644
--- a/docs/coordinates.md
+++ b/docs/coordinates.md
@@ -1,4 +1,4 @@
-
+
# ``
Coorinates sent by locationManager
diff --git a/docs/location.md b/docs/location.md
index ba2258c12..9c1604d9e 100644
--- a/docs/location.md
+++ b/docs/location.md
@@ -1,4 +1,4 @@
-
+
# ``
Location sent by locationManager
diff --git a/docs/offlineManager.md b/docs/offlineManager.md
index 9da6dde4f..380776dee 100644
--- a/docs/offlineManager.md
+++ b/docs/offlineManager.md
@@ -1,4 +1,4 @@
-
+
# ``
OfflineManager implements a singleton (shared object) that manages offline packs.
All of this class’s instance methods are asynchronous, reflecting the fact that offline resources are stored in a database.
The shared object maintains a canonical collection of offline packs.
diff --git a/docs/snapshotManager.md b/docs/snapshotManager.md
index d343b869e..958b74161 100644
--- a/docs/snapshotManager.md
+++ b/docs/snapshotManager.md
@@ -1,4 +1,4 @@
-
+
# ``
The snapshotManager generates static raster images of the map.
Each snapshot image depicts a portion of a map defined by an SnapshotOptions object you provide.
The snapshotter generates the snapshot asynchronous.
diff --git a/ios/RCTMLN/RCTMLNStyle.h b/ios/RCTMLN/RCTMLNStyle.h
index ef3d92889..549405305 100644
--- a/ios/RCTMLN/RCTMLNStyle.h
+++ b/ios/RCTMLN/RCTMLNStyle.h
@@ -1,5 +1,5 @@
// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// This file is auto-generated from scripts/templates/RCTMLNStyle.h.ejs
#import "RCTMLNStyle.h"
#import "RCTMLNStyleValue.h"
diff --git a/ios/RCTMLN/RCTMLNStyle.m b/ios/RCTMLN/RCTMLNStyle.m
index a5ffbe604..a6b13d531 100644
--- a/ios/RCTMLN/RCTMLNStyle.m
+++ b/ios/RCTMLN/RCTMLNStyle.m
@@ -1,5 +1,5 @@
// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// This file is auto-generated from scripts/templates/RCTMLNStyle.m.ejs
#import "RCTMLNStyle.h"
#import "RCTMLNUtils.h"
diff --git a/ios/RCTMLN/index.d.ts b/ios/RCTMLN/index.d.ts
deleted file mode 100644
index 26bcdd0c2..000000000
--- a/ios/RCTMLN/index.d.ts
+++ /dev/null
@@ -1,1183 +0,0 @@
-/* eslint-disable */
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
-
-export interface ConstantProps {
- styletype: string;
- payload: {
- value: any;
- };
-}
-
-export interface StyleFunctionProps {
- styletype: string;
- payload: {
- fn: string;
- attributeName: string;
- stops: any[];
- mode: any;
- };
-}
-
-export interface TransitionProps {
- duration: number;
- delay: number;
-}
-
-export type TranslationProps = { x: number; y: number } | number[];
-
-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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: Value;
-
- /**
- * The transition affecting any changes to this layer’s fillPattern property.
- */
- fillPatternTransition: TransitionProps;
-}
-
-export interface lineLayerStyleProps {
- /**
- * The display of line endings.
- */
- lineCap: Value, ["zoom"]>;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * Blur applied to the line, in pixels.
- */
- lineBlur: Value;
-
- /**
- * The transition affecting any changes to this layer’s lineBlur property.
- */
- lineBlurTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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;
-
- /**
- * The transition affecting any changes to this layer’s linePattern property.
- */
- linePatternTransition: TransitionProps;
-
- /**
- * Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify `"lineMetrics": true`.
- *
- * @disabledBy lineDasharray, linePattern
- */
- lineGradient: Value;
-}
-
-export interface symbolLayerStyleProps {
- /**
- * Label placement relative to its geometry.
- */
- symbolPlacement: Value<
- Enum,
- ["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 MapLibre 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
- *
- * @disabledBy iconOverlap
- */
- 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<
- Enum,
- ["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: Value;
-
- /**
- * Rotates the icon clockwise.
- *
- * @requires iconImage
- */
- iconRotate: Value;
-
- /**
- * 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.
- *
- * @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<
- Enum,
- ["zoom", "feature"]
- >;
-
- /**
- * Orientation of icon when map is pitched.
- *
- * @requires iconImage
- */
- iconPitchAlignment: Value<
- Enum,
- ["zoom"]
- >;
-
- /**
- * Orientation of text when map is pitched.
- *
- * @requires textField
- */
- textPitchAlignment: Value<
- Enum,
- ["zoom"]
- >;
-
- /**
- * In combination with `symbolPlacement`, determines the rotation behavior of the individual glyphs forming the text.
- *
- * @requires textField
- */
- textRotationAlignment: Value<
- Enum,
- ["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.
- */
- 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<
- Enum,
- ["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<
- Enum[],
- ["zoom"]
- >;
-
- /**
- * Part of the text placed closest to the anchor.
- *
- * @requires textField
- *
- * @disabledBy textVariableAnchor
- */
- textAnchor: Value<
- Enum,
- ["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. The order of elements in an array define priority order for the placement of an orientation variant.
- *
- * @requires textField
- */
- textWritingMode: Value<
- Enum[],
- ["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<
- Enum,
- ["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
- *
- * @disabledBy textOverlap
- */
- 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: TransitionProps;
-
- /**
- * The color of the icon. This can only be used with sdf icons.
- *
- * @requires iconImage
- */
- iconColor: Value;
-
- /**
- * The transition affecting any changes to this layer’s iconColor property.
- */
- iconColorTransition: TransitionProps;
-
- /**
- * The color of the icon's halo. Icon halos can only be used with SDF icons.
- *
- * @requires iconImage
- */
- iconHaloColor: Value;
-
- /**
- * The transition affecting any changes to this layer’s iconHaloColor property.
- */
- iconHaloColorTransition: TransitionProps;
-
- /**
- * Distance of halo to the icon outline.
- *
- * @requires iconImage
- */
- iconHaloWidth: Value;
-
- /**
- * The transition affecting any changes to this layer’s iconHaloWidth property.
- */
- iconHaloWidthTransition: TransitionProps;
-
- /**
- * Fade out the halo towards the outside.
- *
- * @requires iconImage
- */
- iconHaloBlur: Value;
-
- /**
- * The transition affecting any changes to this layer’s iconHaloBlur property.
- */
- iconHaloBlurTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * The halo's fadeout distance towards the outside.
- *
- * @requires textField
- */
- textHaloBlur: Value;
-
- /**
- * The transition affecting any changes to this layer’s textHaloBlur property.
- */
- textHaloBlurTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * The fill color of the circle.
- */
- circleColor: Value;
-
- /**
- * The transition affecting any changes to this layer’s circleColor property.
- */
- circleColorTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * The opacity at which the circle will be drawn.
- */
- circleOpacity: Value;
-
- /**
- * The transition affecting any changes to this layer’s circleOpacity property.
- */
- circleOpacityTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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<
- Enum,
- ["zoom"]
- >;
-
- /**
- * Orientation of circle when map is pitched.
- */
- circlePitchAlignment: Value<
- Enum,
- ["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: TransitionProps;
-
- /**
- * The stroke color of the circle.
- */
- circleStrokeColor: Value;
-
- /**
- * The transition affecting any changes to this layer’s circleStrokeColor property.
- */
- circleStrokeColorTransition: TransitionProps;
-
- /**
- * The opacity of the circle's stroke.
- */
- circleStrokeOpacity: Value;
-
- /**
- * The transition affecting any changes to this layer’s circleStrokeOpacity property.
- */
- circleStrokeOpacityTransition: TransitionProps;
-}
-
-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.
- */
- heatmapRadius: Value;
-
- /**
- * The transition affecting any changes to this layer’s heatmapRadius property.
- */
- heatmapRadiusTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-}
-
-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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: Value;
-
- /**
- * The transition affecting any changes to this layer’s fillExtrusionPattern property.
- */
- fillExtrusionPatternTransition: TransitionProps;
-
- /**
- * The height with which to extrude this layer.
- */
- fillExtrusionHeight: Value;
-
- /**
- * The transition affecting any changes to this layer’s fillExtrusionHeight property.
- */
- fillExtrusionHeightTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-}
-
-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: TransitionProps;
-
- /**
- * Rotates hues around the color wheel.
- */
- rasterHueRotate: Value;
-
- /**
- * The transition affecting any changes to this layer’s rasterHueRotate property.
- */
- rasterHueRotateTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * Increase or reduce the saturation of the image.
- */
- rasterSaturation: Value;
-
- /**
- * The transition affecting any changes to this layer’s rasterSaturation property.
- */
- rasterSaturationTransition: TransitionProps;
-
- /**
- * Increase or reduce the contrast of the image.
- */
- rasterContrast: Value;
-
- /**
- * The transition affecting any changes to this layer’s rasterContrast property.
- */
- rasterContrastTransition: TransitionProps;
-
- /**
- * The resampling/interpolation method to use for overscaling, also known as texture magnification filter
- */
- rasterResampling: Value<
- Enum,
- ["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<
- HillshadeIlluminationAnchorEnum,
- HillshadeIlluminationAnchorEnumValues
- >,
- ["zoom"]
- >;
-
- /**
- * Intensity of the hillshade
- */
- hillshadeExaggeration: Value;
-
- /**
- * The transition affecting any changes to this layer’s hillshadeExaggeration property.
- */
- hillshadeExaggerationTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-
- /**
- * 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: TransitionProps;
-}
-
-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: TransitionProps;
-
- /**
- * 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;
-
- /**
- * The transition affecting any changes to this layer’s backgroundPattern property.
- */
- backgroundPatternTransition: TransitionProps;
-
- /**
- * The opacity at which the background will be drawn.
- */
- backgroundOpacity: Value;
-
- /**
- * The transition affecting any changes to this layer’s backgroundOpacity property.
- */
- backgroundOpacityTransition: TransitionProps;
-}
-
-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: TransitionProps;
-
- /**
- * Color tint for lighting extruded geometries.
- */
- color: Value;
-
- /**
- * The transition affecting any changes to this layer’s color property.
- */
- colorTransition: TransitionProps;
-
- /**
- * 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: TransitionProps;
-}
diff --git a/javascript/utils/MaplibreStyles.d.ts b/javascript/utils/MaplibreStyles.d.ts
index c6ade1e41..d475d042c 100644
--- a/javascript/utils/MaplibreStyles.d.ts
+++ b/javascript/utils/MaplibreStyles.d.ts
@@ -1,4 +1,6 @@
-/* This file was generated from MapboxStyle.ts.ejs do not modify */
+// DO NOT MODIFY
+// This file is auto-generated from scripts/templates/MaplibreStyles.ts.ejs
+
import { type ImageSourcePropType } from "react-native";
export type Translation = { x: number; y: number } | [number, number];
diff --git a/javascript/utils/styleMap.ts b/javascript/utils/styleMap.ts
index b696f2ac6..dbd66dc3d 100644
--- a/javascript/utils/styleMap.ts
+++ b/javascript/utils/styleMap.ts
@@ -1,6 +1,6 @@
/* eslint-disable */
// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// This file is auto-generated from scripts/templates/styleMap.ts.ejs
import { isAndroid } from "./index";
diff --git a/scripts/codegen.ts b/scripts/codegen.ts
index db2416d46..753911fed 100644
--- a/scripts/codegen.ts
+++ b/scripts/codegen.ts
@@ -15,7 +15,7 @@ import {
isVersionGTE,
} from "./utils/getNativeVersion";
-const TMPL_PATH = path.join(__dirname, "templates");
+const TEMPLATES_PATH = path.join(__dirname, "templates");
const IOS_OUTPUT_PATH = path.join(__dirname, "..", "ios", "RCTMLN");
const ANDROID_OUTPUT_PATH = path.join(
@@ -36,23 +36,23 @@ const JS_OUTPUT_PATH = path.join(__dirname, "..", "javascript", "utils");
const TEMPLATE_MAPPINGS = [
{
- input: path.join(TMPL_PATH, "RCTMLNStyle.h.ejs"),
+ input: path.join(TEMPLATES_PATH, "RCTMLNStyle.h.ejs"),
output: path.join(IOS_OUTPUT_PATH, "RCTMLNStyle.h"),
},
{
- input: path.join(TMPL_PATH, "MaplibreStyles.ts.ejs"),
+ input: path.join(TEMPLATES_PATH, "MaplibreStyles.ts.ejs"),
output: path.join(JS_OUTPUT_PATH, "MaplibreStyles.d.ts"),
},
{
- input: path.join(TMPL_PATH, "RCTMLNStyle.m.ejs"),
+ input: path.join(TEMPLATES_PATH, "RCTMLNStyle.m.ejs"),
output: path.join(IOS_OUTPUT_PATH, "RCTMLNStyle.m"),
},
{
- input: path.join(TMPL_PATH, "RCTMLNStyleFactory.java.ejs"),
+ input: path.join(TEMPLATES_PATH, "RCTMLNStyleFactory.java.ejs"),
output: path.join(ANDROID_OUTPUT_PATH, "RCTMLNStyleFactory.java"),
},
{
- input: path.join(TMPL_PATH, "styleMap.ts.ejs"),
+ input: path.join(TEMPLATES_PATH, "styleMap.ts.ejs"),
output: path.join(JS_OUTPUT_PATH, "styleMap.ts"),
},
];
@@ -295,11 +295,15 @@ async function generate() {
const filename = path.parse(output).base;
console.log(`Generating ${filename}`);
- const tmpl = ejs.compile(await fs.readFile(input, "utf8"), {
+ const template = ejs.compile(await fs.readFile(input, "utf8"), {
strict: true,
async: true,
});
- let results = await tmpl({ layers, helpers: TemplateHelpers });
+ let results = await template({
+ layers,
+ filePath: path.relative(path.join(__dirname, ".."), input),
+ helpers: TemplateHelpers,
+ });
if (filename.endsWith("ts")) {
results = await prettier.format(results, {
filepath: filename,
diff --git a/scripts/templates/MaplibreStyles.ts.ejs b/scripts/templates/MaplibreStyles.ts.ejs
index 5a3ab27d4..14eff92a6 100644
--- a/scripts/templates/MaplibreStyles.ts.ejs
+++ b/scripts/templates/MaplibreStyles.ts.ejs
@@ -2,7 +2,9 @@
const layers = locals.layers;
const helpers = locals.helpers;
-%>
-/* This file was generated from MapboxStyle.ts.ejs do not modify */
+// <%= helpers.autoGeneratedHeader.doNotModify %>
+// <%= helpers.autoGeneratedHeader.generatedFrom(locals.filePath) %>
+
import { type ImageSourcePropType } from 'react-native';
export type Translation = { x: number; y: number } | [number, number];
diff --git a/scripts/templates/RCTMLNStyle.h.ejs b/scripts/templates/RCTMLNStyle.h.ejs
index 373730624..194f99295 100644
--- a/scripts/templates/RCTMLNStyle.h.ejs
+++ b/scripts/templates/RCTMLNStyle.h.ejs
@@ -2,8 +2,8 @@
const layers = locals.layers;
const helpers = locals.helpers;
-%>
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// <%= helpers.autoGeneratedHeader.doNotModify %>
+// <%= helpers.autoGeneratedHeader.generatedFrom(locals.filePath) %>
#import "RCTMLNStyle.h"
#import "RCTMLNStyleValue.h"
diff --git a/scripts/templates/RCTMLNStyle.m.ejs b/scripts/templates/RCTMLNStyle.m.ejs
index d21828f4e..575e5d31c 100644
--- a/scripts/templates/RCTMLNStyle.m.ejs
+++ b/scripts/templates/RCTMLNStyle.m.ejs
@@ -2,8 +2,8 @@
const layers = locals.layers;
const helpers = locals.helpers;
-%>
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// <%= helpers.autoGeneratedHeader.doNotModify %>
+// <%= helpers.autoGeneratedHeader.generatedFrom(locals.filePath) %>
#import "RCTMLNStyle.h"
#import "RCTMLNUtils.h"
diff --git a/scripts/templates/RCTMLNStyleFactory.java.ejs b/scripts/templates/RCTMLNStyleFactory.java.ejs
index e0727aefe..427edaf39 100644
--- a/scripts/templates/RCTMLNStyleFactory.java.ejs
+++ b/scripts/templates/RCTMLNStyleFactory.java.ejs
@@ -2,8 +2,8 @@
const layers = locals.layers;
const helpers = locals.helpers;
-%>
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// <%= helpers.autoGeneratedHeader.doNotModify %>
+// <%= helpers.autoGeneratedHeader.generatedFrom(locals.filePath) %>
package com.maplibre.rctmln.components.styles;
diff --git a/scripts/templates/component.md.ejs b/scripts/templates/component.md.ejs
index cb5c7ccc6..c3e6599cf 100644
--- a/scripts/templates/component.md.ejs
+++ b/scripts/templates/component.md.ejs
@@ -2,8 +2,8 @@
const component = locals.component;
const helpers = locals.helpers;
-%>
-
-
+
+
# ` />`
<%- helpers.replaceNewLine(component.description) %>
diff --git a/scripts/templates/index.d.ts.ejs b/scripts/templates/index.d.ts.ejs
deleted file mode 100644
index 5a8c20429..000000000
--- a/scripts/templates/index.d.ts.ejs
+++ /dev/null
@@ -1,86 +0,0 @@
-<%
- const layers = locals.layers;
- const helpers = locals.helpers;
--%>
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
-
-import { isAndroid } from './index';
-
-export const StyleTypes = {
- Constant: 'constant',
- Color: 'color',
- Transition: 'transition',
- Translation: 'translation',
- Function: 'function',
- Image: 'image',
- Enum: 'enum',
-};
-
-const styleMap = {
- <%_ for (let layer of layers) { _%>
- <%_ for (let prop of layer.properties) { _%>
- <%_ if (!['color', 'colorTransition', 'visibility'].includes(prop.name)) { _%>
- <%= prop.name %>: <%- helpers.jsStyleType(prop) %>,
- <%_ if (prop.transition) { _%>
- <%= prop.name %>Transition: StyleTypes.Transition,
- <%_ } _%>
- <%_ } _%>
- <%_ } _%>
-
- <%_ } _%>
-
- color: StyleTypes.Color,
- colorTransition: StyleTypes.Transition,
- visibility: StyleTypes.Constant,
-};
-
-export const styleExtras = {
- // padding
- iconTextFitPadding: {
- iosType: 'edgeinsets',
- },
-
- // offsets
- iconOffset: {
- iosType: 'vector',
- },
- textOffset: {
- iosType: 'vector',
- },
- lineOffset: {
- iosType: 'vector',
- },
-
- // translates
- fillTranslate: {
- iosType: 'vector',
- },
- lineTranslate: {
- iosType: 'vector',
- },
- iconTranslate: {
- iosType: 'vector',
- },
- textTranslate: {
- iosType: 'vector',
- },
- circleTranslate: {
- iosType: 'vector',
- },
- fillExtrusionTranslate: {
- iosType: 'vector',
- },
-};
-
-export function getStyleType(styleProp: keyof typeof styleExtras) {
- if (!isAndroid() && styleExtras[styleProp]) {
- return styleExtras[styleProp].iosType;
- }
-
- if (styleMap[styleProp]) {
- return styleMap[styleProp];
- }
-
- throw new Error(`${styleProp} is not a valid Mapbox layer style`);
-}
\ No newline at end of file
diff --git a/scripts/templates/styleMap.ts.ejs b/scripts/templates/styleMap.ts.ejs
index 321d42af3..bfdae141e 100644
--- a/scripts/templates/styleMap.ts.ejs
+++ b/scripts/templates/styleMap.ts.ejs
@@ -3,8 +3,8 @@
const helpers = locals.helpers;
-%>
/* eslint-disable */
-// DO NOT MODIFY
-// THIS FILE IS AUTOGENERATED
+// <%= helpers.autoGeneratedHeader.doNotModify %>
+// <%= helpers.autoGeneratedHeader.generatedFrom(locals.filePath) %>
import { isAndroid } from './index';
diff --git a/scripts/utils/MarkdownBuilder.ts b/scripts/utils/MarkdownBuilder.ts
index f0068ef14..5851be282 100644
--- a/scripts/utils/MarkdownBuilder.ts
+++ b/scripts/utils/MarkdownBuilder.ts
@@ -4,18 +4,18 @@ import path from "node:path";
import * as TemplateHelpers from "./TemplateHelpers";
-const TMPL_PATH = path.join(__dirname, "..", "templates");
+const TEMPLATE_PATH = path.join(__dirname, "..", "templates");
export class MarkdownBuilder {
async generateComponentFile(docJSON: any, componentName: string) {
- const tmpl = ejs.compile(
- await fs.readFile(path.join(TMPL_PATH, "component.md.ejs"), "utf8"),
+ const template = ejs.compile(
+ await fs.readFile(path.join(TEMPLATE_PATH, "component.md.ejs"), "utf8"),
{
async: true,
strict: true,
},
);
- const fileContents = await tmpl({
+ const fileContents = await template({
component: docJSON[componentName],
helpers: TemplateHelpers,
});
diff --git a/scripts/utils/TemplateHelpers.ts b/scripts/utils/TemplateHelpers.ts
index b0eec63bc..70fa98ad2 100644
--- a/scripts/utils/TemplateHelpers.ts
+++ b/scripts/utils/TemplateHelpers.ts
@@ -40,6 +40,12 @@ const iosSpecOverrides: Record = {
"text-writing-mode": "text-writing-modes",
};
+export const autoGeneratedHeader = {
+ doNotModify: "DO NOT MODIFY",
+ generatedFrom: (filePath: string) =>
+ `This file is auto-generated from ${filePath}`,
+};
+
export function exists(value: T): value is NonNullable {
return typeof value !== "undefined" && value !== null;
}