@maplibre/maplibre-gl-style-spec
Advanced tools
Comparing version 14.0.2 to 15.0.0
@@ -0,1 +1,7 @@ | ||
## 15.0.0 | ||
### Breaking changes | ||
* The migration to TypeScript [#209](https://github.com/maplibre/maplibre-gl-js/pull/209) removed support for the `mapbox://` protocol. | ||
## 14.0.2 | ||
@@ -2,0 +8,0 @@ |
@@ -81,6 +81,6 @@ import {isExpressionFilter} from './index'; | ||
) { | ||
const [, property, value] = (filter as any); | ||
converted = convertComparisonOp(property, value, op, expectedTypes); | ||
const [, property, value] = filter; | ||
converted = convertComparisonOp(property as string, value, op, expectedTypes); | ||
} else if (op === 'any') { | ||
const children = (filter as any).slice(1).map(f => { | ||
const children = (filter).slice(1).map((f: FilterSpecification) => { | ||
const types = {}; | ||
@@ -91,16 +91,16 @@ const child = _convertFilter(f, types); | ||
}); | ||
return ['any'].concat(children); | ||
return ['any'].concat(children as string[]); | ||
} else if (op === 'all') { | ||
const children = (filter as any).slice(1).map(f => _convertFilter(f, expectedTypes)); | ||
return children.length > 1 ? ['all'].concat(children) : [].concat(...children); | ||
const children = (filter).slice(1).map(f => _convertFilter(f as FilterSpecification, expectedTypes)); | ||
return children.length > 1 ? ['all'].concat(children as string[]) : [].concat(...children); | ||
} else if (op === 'none') { | ||
return ['!', _convertFilter(['any'].concat(filter.slice(1) as any), {})]; | ||
return ['!', _convertFilter(['any'].concat(filter.slice(1) as string[]) as string[], {})]; | ||
} else if (op === 'in') { | ||
converted = convertInOp(filter[1] as any, filter.slice(2)); | ||
converted = convertInOp(filter[1] as string, filter.slice(2)); | ||
} else if (op === '!in') { | ||
converted = convertInOp(filter[1] as any, filter.slice(2), true); | ||
converted = convertInOp(filter[1] as string, filter.slice(2), true); | ||
} else if (op === 'has') { | ||
converted = convertHasOp(filter[1] as any); | ||
converted = convertHasOp(filter[1] as string); | ||
} else if (op === '!has') { | ||
converted = ['!', convertHasOp(filter[1] as any)]; | ||
converted = ['!', convertHasOp(filter[1] as string)]; | ||
} else { | ||
@@ -107,0 +107,0 @@ converted = true; |
@@ -21,3 +21,3 @@ | ||
/** | ||
* Format a Mapbox GL Style. Returns a stringified style with its keys | ||
* Format a MapLibre GL Style. Returns a stringified style with its keys | ||
* sorted in the same order as the reference style. | ||
@@ -32,3 +32,3 @@ * | ||
* @private | ||
* @param {Object} style a Mapbox GL Style | ||
* @param {Object} style a MapLibre GL Style | ||
* @param {number} [space] space argument to pass to `JSON.stringify` | ||
@@ -35,0 +35,0 @@ * @returns {string} stringified formatted JSON |
{ | ||
"name": "@maplibre/maplibre-gl-style-spec", | ||
"description": "a specification for maplibre gl styles", | ||
"version": "14.0.2", | ||
"version": "15.0.0", | ||
"author": "MapLibre", | ||
@@ -17,2 +17,3 @@ "keywords": [ | ||
"module": "./dist/index.es.js", | ||
"type": "module", | ||
"scripts": { | ||
@@ -19,0 +20,0 @@ }, |
740
types.ts
@@ -1,2 +0,2 @@ | ||
// Generated code; do not edit. Edit build/generate-flow-typed-style-spec.js instead. | ||
// Generated code; do not edit. Edit build/generate-style-spec.ts instead. | ||
/* eslint-disable */ | ||
@@ -12,7 +12,36 @@ | ||
export type FilterSpecification = ["has", string] | ["!has", string] | ["==", string, string | number | boolean] | ["!=", string, string | number | boolean] | [">", string, string | number | boolean] | [">=", string, string | number | boolean] | ["<", string, string | number | boolean] | ["<=", string, string | number | boolean] | Array<string | FilterSpecification>; // Can't type in, !in, all, any, none -- https://github.com/facebook/flow/issues/2443 | ||
export type FilterSpecificationInputType = string | number | boolean; | ||
export type FilterSpecification = | ||
// Lookup | ||
| ['at', number, (number |string)[]] | ||
| ['get', string, Record<string, unknown>?] | ||
| ['has', string, Record<string, unknown>?] | ||
| ['in', ...FilterSpecificationInputType[], FilterSpecificationInputType | FilterSpecificationInputType[]] | ||
| ['index-of', FilterSpecificationInputType, FilterSpecificationInputType | FilterSpecificationInputType[]] | ||
| ['length', string | string[]] | ||
| ['slice', string | string[], number] | ||
// Decision | ||
| ['!', FilterSpecification] | ||
| ['!=', string | FilterSpecification, FilterSpecificationInputType] | ||
| ['<', string | FilterSpecification, FilterSpecificationInputType] | ||
| ['<=', string | FilterSpecification, FilterSpecificationInputType] | ||
| ['==', string | FilterSpecification, FilterSpecificationInputType] | ||
| ['>', string | FilterSpecification, FilterSpecificationInputType] | ||
| ['>=', string | FilterSpecification, FilterSpecificationInputType] | ||
| ["all", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["any", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["case", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["coalesce", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["match", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["within", ...FilterSpecification[], FilterSpecificationInputType] | ||
// Used in convert.ts | ||
| ["!in", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["!has", ...FilterSpecification[], FilterSpecificationInputType] | ||
| ["none", ...FilterSpecification[], FilterSpecificationInputType] | ||
// Fallbak for others | ||
| Array<string | FilterSpecification> | ||
export type TransitionSpecification = { | ||
duration?: number, | ||
delay?: number | ||
duration?: number, | ||
delay?: number | ||
}; | ||
@@ -22,420 +51,403 @@ | ||
export type CameraFunctionSpecification<T> = { | ||
type: "exponential", | ||
stops: Array<[number, T]> | ||
} | { | ||
type: "interval", | ||
stops: Array<[number, T]> | ||
}; | ||
export type CameraFunctionSpecification<T> = | ||
{ type: 'exponential', stops: Array<[number, T]> } | ||
| { type: 'interval', stops: Array<[number, T]> }; | ||
export type SourceFunctionSpecification<T> = { | ||
type: "exponential", | ||
stops: Array<[number, T]>, | ||
property: string, | ||
default?: T | ||
} | { | ||
type: "interval", | ||
stops: Array<[number, T]>, | ||
property: string, | ||
default?: T | ||
} | { | ||
type: "categorical", | ||
stops: Array<[string | number | boolean, T]>, | ||
property: string, | ||
default?: T | ||
} | { | ||
type: "identity", | ||
property: string, | ||
default?: T | ||
}; | ||
export type SourceFunctionSpecification<T> = | ||
{ type: 'exponential', stops: Array<[number, T]>, property: string, default?: T } | ||
| { type: 'interval', stops: Array<[number, T]>, property: string, default?: T } | ||
| { type: 'categorical', stops: Array<[string | number | boolean, T]>, property: string, default?: T } | ||
| { type: 'identity', property: string, default?: T }; | ||
export type CompositeFunctionSpecification<T> = { | ||
type: "exponential", | ||
stops: Array<[{ | ||
zoom: number, | ||
value: number | ||
}, T]>, | ||
property: string, | ||
default?: T | ||
} | { | ||
type: "interval", | ||
stops: Array<[{ | ||
zoom: number, | ||
value: number | ||
}, T]>, | ||
property: string, | ||
default?: T | ||
} | { | ||
type: "categorical", | ||
stops: Array<[{ | ||
zoom: number, | ||
value: string | number | boolean | ||
}, T]>, | ||
property: string, | ||
default?: T | ||
}; | ||
export type CompositeFunctionSpecification<T> = | ||
{ type: 'exponential', stops: Array<[{zoom: number, value: number}, T]>, property: string, default?: T } | ||
| { type: 'interval', stops: Array<[{zoom: number, value: number}, T]>, property: string, default?: T } | ||
| { type: 'categorical', stops: Array<[{zoom: number, value: string | number | boolean}, T]>, property: string, default?: T }; | ||
export type ExpressionSpecification = Array<unknown>; | ||
export type ExpressionSpecificationArray = Array<unknown>; | ||
export type PropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | ExpressionSpecification; | ||
export type PropertyValueSpecification<T> = | ||
T | ||
| CameraFunctionSpecification<T> | ||
| ExpressionSpecificationArray; | ||
export type DataDrivenPropertyValueSpecification<T> = T | CameraFunctionSpecification<T> | SourceFunctionSpecification<T> | CompositeFunctionSpecification<T> | ExpressionSpecification; | ||
export type DataDrivenPropertyValueSpecification<T> = | ||
T | ||
| CameraFunctionSpecification<T> | ||
| SourceFunctionSpecification<T> | ||
| CompositeFunctionSpecification<T> | ||
| ExpressionSpecificationArray; | ||
export type StyleSpecification = { | ||
"version": 8, | ||
"name"?: string, | ||
"metadata"?: unknown, | ||
"center"?: Array<number>, | ||
"zoom"?: number, | ||
"bearing"?: number, | ||
"pitch"?: number, | ||
"light"?: LightSpecification, | ||
"sources": {[_: string]: SourceSpecification}, | ||
"sprite"?: string, | ||
"glyphs"?: string, | ||
"transition"?: TransitionSpecification, | ||
"layers": Array<LayerSpecification> | ||
"version": 8, | ||
"name"?: string, | ||
"metadata"?: unknown, | ||
"center"?: Array<number>, | ||
"zoom"?: number, | ||
"bearing"?: number, | ||
"pitch"?: number, | ||
"light"?: LightSpecification, | ||
"sources": {[_: string]: SourceSpecification}, | ||
"sprite"?: string, | ||
"glyphs"?: string, | ||
"transition"?: TransitionSpecification, | ||
"layers": Array<LayerSpecification> | ||
}; | ||
export type LightSpecification = { | ||
"anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"position"?: PropertyValueSpecification<[number, number, number]>, | ||
"color"?: PropertyValueSpecification<ColorSpecification>, | ||
"intensity"?: PropertyValueSpecification<number> | ||
"anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"position"?: PropertyValueSpecification<[number, number, number]>, | ||
"color"?: PropertyValueSpecification<ColorSpecification>, | ||
"intensity"?: PropertyValueSpecification<number> | ||
}; | ||
export type VectorSourceSpecification = { | ||
"type": "vector", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"scheme"?: "xyz" | "tms", | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"attribution"?: string, | ||
"promoteId"?: PromoteIdSpecification, | ||
"volatile"?: boolean | ||
"type": "vector", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"scheme"?: "xyz" | "tms", | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"attribution"?: string, | ||
"promoteId"?: PromoteIdSpecification, | ||
"volatile"?: boolean | ||
}; | ||
export type RasterSourceSpecification = { | ||
"type": "raster", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"tileSize"?: number, | ||
"scheme"?: "xyz" | "tms", | ||
"attribution"?: string, | ||
"volatile"?: boolean | ||
"type": "raster", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"tileSize"?: number, | ||
"scheme"?: "xyz" | "tms", | ||
"attribution"?: string, | ||
"volatile"?: boolean | ||
}; | ||
export type RasterDEMSourceSpecification = { | ||
"type": "raster-dem", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"tileSize"?: number, | ||
"attribution"?: string, | ||
"encoding"?: "terrarium" | "mapbox", | ||
"volatile"?: boolean | ||
"type": "raster-dem", | ||
"url"?: string, | ||
"tiles"?: Array<string>, | ||
"bounds"?: [number, number, number, number], | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"tileSize"?: number, | ||
"attribution"?: string, | ||
"encoding"?: "terrarium" | "mapbox", | ||
"volatile"?: boolean | ||
}; | ||
export type GeoJSONSourceSpecification = { | ||
"type": "geojson", | ||
"data"?: unknown, | ||
"maxzoom"?: number, | ||
"attribution"?: string, | ||
"buffer"?: number, | ||
"filter"?: unknown, | ||
"tolerance"?: number, | ||
"cluster"?: boolean, | ||
"clusterRadius"?: number, | ||
"clusterMaxZoom"?: number, | ||
"clusterMinPoints"?: number, | ||
"clusterProperties"?: unknown, | ||
"lineMetrics"?: boolean, | ||
"generateId"?: boolean, | ||
"promoteId"?: PromoteIdSpecification | ||
"type": "geojson", | ||
"data"?: unknown, | ||
"maxzoom"?: number, | ||
"attribution"?: string, | ||
"buffer"?: number, | ||
"filter"?: unknown, | ||
"tolerance"?: number, | ||
"cluster"?: boolean, | ||
"clusterRadius"?: number, | ||
"clusterMaxZoom"?: number, | ||
"clusterMinPoints"?: number, | ||
"clusterProperties"?: unknown, | ||
"lineMetrics"?: boolean, | ||
"generateId"?: boolean, | ||
"promoteId"?: PromoteIdSpecification | ||
}; | ||
export type VideoSourceSpecification = { | ||
"type": "video", | ||
"urls": Array<string>, | ||
"coordinates": [[number, number], [number, number], [number, number], [number, number]] | ||
"type": "video", | ||
"urls": Array<string>, | ||
"coordinates": [[number, number], [number, number], [number, number], [number, number]] | ||
}; | ||
export type ImageSourceSpecification = { | ||
"type": "image", | ||
"url": string, | ||
"coordinates": [[number, number], [number, number], [number, number], [number, number]] | ||
"type": "image", | ||
"url": string, | ||
"coordinates": [[number, number], [number, number], [number, number], [number, number]] | ||
}; | ||
export type SourceSpecification = VectorSourceSpecification | RasterSourceSpecification | RasterDEMSourceSpecification | GeoJSONSourceSpecification | VideoSourceSpecification | ImageSourceSpecification; | ||
export type SourceSpecification = | ||
| VectorSourceSpecification | ||
| RasterSourceSpecification | ||
| RasterDEMSourceSpecification | ||
| GeoJSONSourceSpecification | ||
| VideoSourceSpecification | ||
| ImageSourceSpecification | ||
export type FillLayerSpecification = { | ||
"id": string, | ||
"type": "fill", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"fill-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"fill-antialias"?: PropertyValueSpecification<boolean>, | ||
"fill-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-outline-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-translate"?: PropertyValueSpecification<[number, number]>, | ||
"fill-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"fill-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification> | ||
} | ||
"id": string, | ||
"type": "fill", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"fill-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"fill-antialias"?: PropertyValueSpecification<boolean>, | ||
"fill-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-outline-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-translate"?: PropertyValueSpecification<[number, number]>, | ||
"fill-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"fill-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification> | ||
} | ||
}; | ||
export type LineLayerSpecification = { | ||
"id": string, | ||
"type": "line", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"line-cap"?: PropertyValueSpecification<"butt" | "round" | "square">, | ||
"line-join"?: DataDrivenPropertyValueSpecification<"bevel" | "round" | "miter">, | ||
"line-miter-limit"?: PropertyValueSpecification<number>, | ||
"line-round-limit"?: PropertyValueSpecification<number>, | ||
"line-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"line-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"line-translate"?: PropertyValueSpecification<[number, number]>, | ||
"line-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"line-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-gap-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-offset"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-dasharray"?: PropertyValueSpecification<Array<number>>, | ||
"line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"line-gradient"?: ExpressionSpecification | ||
} | ||
"id": string, | ||
"type": "line", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"line-cap"?: PropertyValueSpecification<"butt" | "round" | "square">, | ||
"line-join"?: DataDrivenPropertyValueSpecification<"bevel" | "round" | "miter">, | ||
"line-miter-limit"?: PropertyValueSpecification<number>, | ||
"line-round-limit"?: PropertyValueSpecification<number>, | ||
"line-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"line-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"line-translate"?: PropertyValueSpecification<[number, number]>, | ||
"line-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"line-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-gap-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-offset"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"line-dasharray"?: PropertyValueSpecification<Array<number>>, | ||
"line-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"line-gradient"?: ExpressionSpecificationArray | ||
} | ||
}; | ||
export type SymbolLayerSpecification = { | ||
"id": string, | ||
"type": "symbol", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"symbol-placement"?: PropertyValueSpecification<"point" | "line" | "line-center">, | ||
"symbol-spacing"?: PropertyValueSpecification<number>, | ||
"symbol-avoid-edges"?: PropertyValueSpecification<boolean>, | ||
"symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"symbol-z-order"?: PropertyValueSpecification<"auto" | "viewport-y" | "source">, | ||
"icon-allow-overlap"?: PropertyValueSpecification<boolean>, | ||
"icon-ignore-placement"?: PropertyValueSpecification<boolean>, | ||
"icon-optional"?: PropertyValueSpecification<boolean>, | ||
"icon-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"icon-size"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-text-fit"?: PropertyValueSpecification<"none" | "width" | "height" | "both">, | ||
"icon-text-fit-padding"?: PropertyValueSpecification<[number, number, number, number]>, | ||
"icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"icon-rotate"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-padding"?: PropertyValueSpecification<number>, | ||
"icon-keep-upright"?: PropertyValueSpecification<boolean>, | ||
"icon-offset"?: DataDrivenPropertyValueSpecification<[number, number]>, | ||
"icon-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">, | ||
"icon-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-field"?: DataDrivenPropertyValueSpecification<FormattedSpecification>, | ||
"text-font"?: DataDrivenPropertyValueSpecification<Array<string>>, | ||
"text-size"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-max-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-line-height"?: PropertyValueSpecification<number>, | ||
"text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-justify"?: DataDrivenPropertyValueSpecification<"auto" | "left" | "center" | "right">, | ||
"text-radial-offset"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-variable-anchor"?: PropertyValueSpecification<Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">>, | ||
"text-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">, | ||
"text-max-angle"?: PropertyValueSpecification<number>, | ||
"text-writing-mode"?: PropertyValueSpecification<Array<"horizontal" | "vertical">>, | ||
"text-rotate"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-padding"?: PropertyValueSpecification<number>, | ||
"text-keep-upright"?: PropertyValueSpecification<boolean>, | ||
"text-transform"?: DataDrivenPropertyValueSpecification<"none" | "uppercase" | "lowercase">, | ||
"text-offset"?: DataDrivenPropertyValueSpecification<[number, number]>, | ||
"text-allow-overlap"?: PropertyValueSpecification<boolean>, | ||
"text-ignore-placement"?: PropertyValueSpecification<boolean>, | ||
"text-optional"?: PropertyValueSpecification<boolean>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"icon-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"icon-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"icon-halo-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-halo-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-translate"?: PropertyValueSpecification<[number, number]>, | ||
"icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"text-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"text-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"text-halo-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-halo-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-translate"?: PropertyValueSpecification<[number, number]>, | ||
"text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport"> | ||
} | ||
"id": string, | ||
"type": "symbol", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"symbol-placement"?: PropertyValueSpecification<"point" | "line" | "line-center">, | ||
"symbol-spacing"?: PropertyValueSpecification<number>, | ||
"symbol-avoid-edges"?: PropertyValueSpecification<boolean>, | ||
"symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"symbol-z-order"?: PropertyValueSpecification<"auto" | "viewport-y" | "source">, | ||
"icon-allow-overlap"?: PropertyValueSpecification<boolean>, | ||
"icon-ignore-placement"?: PropertyValueSpecification<boolean>, | ||
"icon-optional"?: PropertyValueSpecification<boolean>, | ||
"icon-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"icon-size"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-text-fit"?: PropertyValueSpecification<"none" | "width" | "height" | "both">, | ||
"icon-text-fit-padding"?: PropertyValueSpecification<[number, number, number, number]>, | ||
"icon-image"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"icon-rotate"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-padding"?: PropertyValueSpecification<number>, | ||
"icon-keep-upright"?: PropertyValueSpecification<boolean>, | ||
"icon-offset"?: DataDrivenPropertyValueSpecification<[number, number]>, | ||
"icon-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">, | ||
"icon-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">, | ||
"text-field"?: DataDrivenPropertyValueSpecification<FormattedSpecification>, | ||
"text-font"?: DataDrivenPropertyValueSpecification<Array<string>>, | ||
"text-size"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-max-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-line-height"?: PropertyValueSpecification<number>, | ||
"text-letter-spacing"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-justify"?: DataDrivenPropertyValueSpecification<"auto" | "left" | "center" | "right">, | ||
"text-radial-offset"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-variable-anchor"?: PropertyValueSpecification<Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">>, | ||
"text-anchor"?: DataDrivenPropertyValueSpecification<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">, | ||
"text-max-angle"?: PropertyValueSpecification<number>, | ||
"text-writing-mode"?: PropertyValueSpecification<Array<"horizontal" | "vertical">>, | ||
"text-rotate"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-padding"?: PropertyValueSpecification<number>, | ||
"text-keep-upright"?: PropertyValueSpecification<boolean>, | ||
"text-transform"?: DataDrivenPropertyValueSpecification<"none" | "uppercase" | "lowercase">, | ||
"text-offset"?: DataDrivenPropertyValueSpecification<[number, number]>, | ||
"text-allow-overlap"?: PropertyValueSpecification<boolean>, | ||
"text-ignore-placement"?: PropertyValueSpecification<boolean>, | ||
"text-optional"?: PropertyValueSpecification<boolean>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"icon-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"icon-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"icon-halo-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-halo-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"icon-translate"?: PropertyValueSpecification<[number, number]>, | ||
"icon-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"text-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"text-halo-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"text-halo-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-halo-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"text-translate"?: PropertyValueSpecification<[number, number]>, | ||
"text-translate-anchor"?: PropertyValueSpecification<"map" | "viewport"> | ||
} | ||
}; | ||
export type CircleLayerSpecification = { | ||
"id": string, | ||
"type": "circle", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"circle-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"circle-radius"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"circle-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-translate"?: PropertyValueSpecification<[number, number]>, | ||
"circle-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-pitch-scale"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-stroke-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-stroke-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"circle-stroke-opacity"?: DataDrivenPropertyValueSpecification<number> | ||
} | ||
"id": string, | ||
"type": "circle", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"circle-sort-key"?: DataDrivenPropertyValueSpecification<number>, | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"circle-radius"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"circle-blur"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-opacity"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-translate"?: PropertyValueSpecification<[number, number]>, | ||
"circle-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-pitch-scale"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-pitch-alignment"?: PropertyValueSpecification<"map" | "viewport">, | ||
"circle-stroke-width"?: DataDrivenPropertyValueSpecification<number>, | ||
"circle-stroke-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"circle-stroke-opacity"?: DataDrivenPropertyValueSpecification<number> | ||
} | ||
}; | ||
export type HeatmapLayerSpecification = { | ||
"id": string, | ||
"type": "heatmap", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"heatmap-radius"?: DataDrivenPropertyValueSpecification<number>, | ||
"heatmap-weight"?: DataDrivenPropertyValueSpecification<number>, | ||
"heatmap-intensity"?: PropertyValueSpecification<number>, | ||
"heatmap-color"?: ExpressionSpecification, | ||
"heatmap-opacity"?: PropertyValueSpecification<number> | ||
} | ||
"id": string, | ||
"type": "heatmap", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"heatmap-radius"?: DataDrivenPropertyValueSpecification<number>, | ||
"heatmap-weight"?: DataDrivenPropertyValueSpecification<number>, | ||
"heatmap-intensity"?: PropertyValueSpecification<number>, | ||
"heatmap-color"?: ExpressionSpecificationArray, | ||
"heatmap-opacity"?: PropertyValueSpecification<number> | ||
} | ||
}; | ||
export type FillExtrusionLayerSpecification = { | ||
"id": string, | ||
"type": "fill-extrusion", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"fill-extrusion-opacity"?: PropertyValueSpecification<number>, | ||
"fill-extrusion-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-extrusion-translate"?: PropertyValueSpecification<[number, number]>, | ||
"fill-extrusion-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"fill-extrusion-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"fill-extrusion-height"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean> | ||
} | ||
"id": string, | ||
"type": "fill-extrusion", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"fill-extrusion-opacity"?: PropertyValueSpecification<number>, | ||
"fill-extrusion-color"?: DataDrivenPropertyValueSpecification<ColorSpecification>, | ||
"fill-extrusion-translate"?: PropertyValueSpecification<[number, number]>, | ||
"fill-extrusion-translate-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"fill-extrusion-pattern"?: DataDrivenPropertyValueSpecification<ResolvedImageSpecification>, | ||
"fill-extrusion-height"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-extrusion-base"?: DataDrivenPropertyValueSpecification<number>, | ||
"fill-extrusion-vertical-gradient"?: PropertyValueSpecification<boolean> | ||
} | ||
}; | ||
export type RasterLayerSpecification = { | ||
"id": string, | ||
"type": "raster", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"raster-opacity"?: PropertyValueSpecification<number>, | ||
"raster-hue-rotate"?: PropertyValueSpecification<number>, | ||
"raster-brightness-min"?: PropertyValueSpecification<number>, | ||
"raster-brightness-max"?: PropertyValueSpecification<number>, | ||
"raster-saturation"?: PropertyValueSpecification<number>, | ||
"raster-contrast"?: PropertyValueSpecification<number>, | ||
"raster-resampling"?: PropertyValueSpecification<"linear" | "nearest">, | ||
"raster-fade-duration"?: PropertyValueSpecification<number> | ||
} | ||
"id": string, | ||
"type": "raster", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"raster-opacity"?: PropertyValueSpecification<number>, | ||
"raster-hue-rotate"?: PropertyValueSpecification<number>, | ||
"raster-brightness-min"?: PropertyValueSpecification<number>, | ||
"raster-brightness-max"?: PropertyValueSpecification<number>, | ||
"raster-saturation"?: PropertyValueSpecification<number>, | ||
"raster-contrast"?: PropertyValueSpecification<number>, | ||
"raster-resampling"?: PropertyValueSpecification<"linear" | "nearest">, | ||
"raster-fade-duration"?: PropertyValueSpecification<number> | ||
} | ||
}; | ||
export type HillshadeLayerSpecification = { | ||
"id": string, | ||
"type": "hillshade", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"hillshade-illumination-direction"?: PropertyValueSpecification<number>, | ||
"hillshade-illumination-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"hillshade-exaggeration"?: PropertyValueSpecification<number>, | ||
"hillshade-shadow-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"hillshade-highlight-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"hillshade-accent-color"?: PropertyValueSpecification<ColorSpecification> | ||
} | ||
"id": string, | ||
"type": "hillshade", | ||
"metadata"?: unknown, | ||
"source": string, | ||
"source-layer"?: string, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"filter"?: FilterSpecification, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"hillshade-illumination-direction"?: PropertyValueSpecification<number>, | ||
"hillshade-illumination-anchor"?: PropertyValueSpecification<"map" | "viewport">, | ||
"hillshade-exaggeration"?: PropertyValueSpecification<number>, | ||
"hillshade-shadow-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"hillshade-highlight-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"hillshade-accent-color"?: PropertyValueSpecification<ColorSpecification> | ||
} | ||
}; | ||
export type BackgroundLayerSpecification = { | ||
"id": string, | ||
"type": "background", | ||
"metadata"?: unknown, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"background-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"background-pattern"?: PropertyValueSpecification<ResolvedImageSpecification>, | ||
"background-opacity"?: PropertyValueSpecification<number> | ||
} | ||
"id": string, | ||
"type": "background", | ||
"metadata"?: unknown, | ||
"minzoom"?: number, | ||
"maxzoom"?: number, | ||
"layout"?: { | ||
"visibility"?: "visible" | "none" | ||
}, | ||
"paint"?: { | ||
"background-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"background-pattern"?: PropertyValueSpecification<ResolvedImageSpecification>, | ||
"background-opacity"?: PropertyValueSpecification<number> | ||
} | ||
}; | ||
export type LayerSpecification = FillLayerSpecification | LineLayerSpecification | SymbolLayerSpecification | CircleLayerSpecification | HeatmapLayerSpecification | FillExtrusionLayerSpecification | RasterLayerSpecification | HillshadeLayerSpecification | BackgroundLayerSpecification; | ||
export type LayerSpecification = | ||
| FillLayerSpecification | ||
| LineLayerSpecification | ||
| SymbolLayerSpecification | ||
| CircleLayerSpecification | ||
| HeatmapLayerSpecification | ||
| FillExtrusionLayerSpecification | ||
| RasterLayerSpecification | ||
| HillshadeLayerSpecification | ||
| BackgroundLayerSpecification; | ||
@@ -15,3 +15,3 @@ | ||
/** | ||
* Validate a Mapbox GL style against the style specification. This entrypoint, | ||
* Validate a MapLibre GL style against the style specification. This entrypoint, | ||
* `maplibre-gl-style-spec/lib/validate_style.min`, is designed to produce as | ||
@@ -18,0 +18,0 @@ * small a browserify bundle as possible by omitting unnecessary functionality |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2943883
125
46193
0
Yes