@maplibre/maplibre-gl-style-spec
Advanced tools
Comparing version 20.2.0 to 20.3.0
@@ -511,2 +511,3 @@ // Generated by dts-bundle-generator v9.5.1 | ||
"sky"?: SkySpecification; | ||
"projection"?: ProjectionSpecification; | ||
"terrain"?: TerrainSpecification; | ||
@@ -533,5 +534,8 @@ "sources": { | ||
"sky-color"?: PropertyValueSpecification<ColorSpecification>; | ||
"horizon-color"?: PropertyValueSpecification<ColorSpecification>; | ||
"fog-color"?: PropertyValueSpecification<ColorSpecification>; | ||
"fog-blend"?: PropertyValueSpecification<number>; | ||
"horizon-blend"?: PropertyValueSpecification<number>; | ||
"fog-ground-blend"?: PropertyValueSpecification<number>; | ||
"horizon-fog-blend"?: PropertyValueSpecification<number>; | ||
"sky-horizon-blend"?: PropertyValueSpecification<number>; | ||
"atmosphere-blend"?: PropertyValueSpecification<number>; | ||
}; | ||
@@ -542,2 +546,5 @@ export type TerrainSpecification = { | ||
}; | ||
export type ProjectionSpecification = { | ||
"type"?: "mercator" | "globe"; | ||
}; | ||
export type VectorSourceSpecification = { | ||
@@ -1028,2 +1035,5 @@ "type": "vector"; | ||
]; | ||
"setProjection": [ | ||
ProjectionSpecification | ||
]; | ||
}; | ||
@@ -1030,0 +1040,0 @@ export type DiffOperations = keyof DiffOperationsMap; |
{ | ||
"name": "@maplibre/maplibre-gl-style-spec", | ||
"description": "a specification for maplibre styles", | ||
"version": "20.2.0", | ||
"version": "20.3.0", | ||
"author": "MapLibre", | ||
@@ -62,3 +62,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^25.0.7", | ||
"@rollup/plugin-commonjs": "^25.0.8", | ||
"@rollup/plugin-json": "^6.1.0", | ||
@@ -73,5 +73,5 @@ "@rollup/plugin-node-resolve": "^15.2.3", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^20.12.7", | ||
"@typescript-eslint/eslint-plugin": "^7.7.1", | ||
"@typescript-eslint/parser": "^7.7.1", | ||
"@types/node": "^20.12.12", | ||
"@typescript-eslint/eslint-plugin": "^7.10.0", | ||
"@typescript-eslint/parser": "^7.10.0", | ||
"dts-bundle-generator": "^9.5.1", | ||
@@ -82,13 +82,13 @@ "eslint": "^8.57.0", | ||
"eslint-plugin-import": "^2.29.1", | ||
"eslint-plugin-jest": "^28.3.0", | ||
"eslint-plugin-jsdoc": "^48.2.3", | ||
"eslint-plugin-jest": "^28.5.0", | ||
"eslint-plugin-jsdoc": "^48.2.6", | ||
"eslint-plugin-react": "^7.34.1", | ||
"glob": "^10.3.12", | ||
"glob": "^10.4.1", | ||
"jest": "^29.7.0", | ||
"jest-canvas-mock": "^2.5.2", | ||
"jest-environment-jsdom": "^29.7.0", | ||
"rollup": "^4.17.0", | ||
"rollup": "^4.18.0", | ||
"rollup-plugin-preserve-shebang": "^1.0.1", | ||
"semver": "^7.5.4", | ||
"ts-jest": "^29.1.2", | ||
"ts-jest": "^29.1.3", | ||
"ts-node": "^10.9.2", | ||
@@ -95,0 +95,0 @@ "tslib": "^2.6.2", |
@@ -560,8 +560,20 @@ import diffStyles from './diff'; | ||
'fog-color': 'green', | ||
'fog-blend': 0.2 | ||
'fog-ground-blend': 0.2 | ||
} | ||
} as StyleSpecification)).toEqual([ | ||
{command: 'setSky', args: [{'fog-color': 'green', 'fog-blend': 0.2}]}, | ||
{command: 'setSky', args: [{'fog-color': 'green', 'fog-ground-blend': 0.2}]}, | ||
]); | ||
}); | ||
test('set projection', () => { | ||
expect(diffStyles({ | ||
} as StyleSpecification, | ||
{ | ||
projection: { | ||
type: 'globe' | ||
} | ||
} as StyleSpecification)).toEqual([ | ||
{command: 'setProjection', args: [{type: 'globe'}]}, | ||
]); | ||
}); | ||
}); |
import {GeoJSONSourceSpecification, LayerSpecification, LightSpecification, SkySpecification, SourceSpecification, SpriteSpecification, StyleSpecification, TerrainSpecification, TransitionSpecification} from './types.g'; | ||
import {GeoJSONSourceSpecification, LayerSpecification, LightSpecification, ProjectionSpecification, SkySpecification, SourceSpecification, SpriteSpecification, StyleSpecification, TerrainSpecification, TransitionSpecification} from './types.g'; | ||
import isEqual from './util/deep_equal'; | ||
@@ -31,2 +31,3 @@ | ||
'setSky': [SkySpecification]; | ||
'setProjection': [ProjectionSpecification]; | ||
} | ||
@@ -308,2 +309,5 @@ | ||
} | ||
if (!isEqual(before.projection, after.projection)) { | ||
commands.push({command: 'setProjection', args: [after.projection]}); | ||
} | ||
@@ -310,0 +314,0 @@ // Handle changes to `sources` |
import {createPropertyExpression, Feature, GlobalProperties, StylePropertyExpression} from '../expression'; | ||
import definitions from './definitions'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
import {createExpression, ICanonicalTileID, StyleExpression, StylePropertySpecification} from '..'; | ||
@@ -5,0 +5,0 @@ import ParsingError from './parsing_error'; |
@@ -72,3 +72,3 @@ type ExpressionType = 'data-driven' | 'cross-faded' | 'cross-faded-data-driven' | 'color-ramp' | 'data-constant' | 'constant'; | ||
import v8Spec from './reference/v8.json' assert {type: 'json'}; | ||
import v8Spec from './reference/v8.json' with {type: 'json'}; | ||
const v8 = v8Spec as any; | ||
@@ -75,0 +75,0 @@ import latest from './reference/latest'; |
import migrate from './migrate'; | ||
import * as spec from '.'; | ||
import v8 from './reference/v8.json' assert {type: 'json'}; | ||
import v8 from './reference/v8.json' with {type: 'json'}; | ||
import validate from './validate_style'; | ||
@@ -5,0 +5,0 @@ |
import spec from './v8.json' assert { type: 'json' }; | ||
import spec from './v8.json' with { type: 'json' }; | ||
export default spec as any; |
@@ -205,2 +205,3 @@ // Generated code; do not edit. Edit build/generate-style-spec.ts instead. | ||
"sky"?: SkySpecification, | ||
"projection"?: ProjectionSpecification, | ||
"terrain"?: TerrainSpecification, | ||
@@ -223,5 +224,8 @@ "sources": {[_: string]: SourceSpecification}, | ||
"sky-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"horizon-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"fog-color"?: PropertyValueSpecification<ColorSpecification>, | ||
"fog-blend"?: PropertyValueSpecification<number>, | ||
"horizon-blend"?: PropertyValueSpecification<number> | ||
"fog-ground-blend"?: PropertyValueSpecification<number>, | ||
"horizon-fog-blend"?: PropertyValueSpecification<number>, | ||
"sky-horizon-blend"?: PropertyValueSpecification<number>, | ||
"atmosphere-blend"?: PropertyValueSpecification<number> | ||
}; | ||
@@ -234,2 +238,6 @@ | ||
export type ProjectionSpecification = { | ||
"type"?: "mercator" | "globe" | ||
}; | ||
export type VectorSourceSpecification = { | ||
@@ -236,0 +244,0 @@ "type": "vector", |
import validateSpec from './validate'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
import validateRasterDEMSource from './validate_raster_dem_source'; | ||
@@ -4,0 +4,0 @@ import {RasterDEMSourceSpecification} from '../types.g'; |
import ValidationError from '../error/validation_error'; | ||
import getType from '../util/get_type'; | ||
import type {RasterDEMSourceSpecification, StyleSpecification} from '../types.g'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
import {unbundle} from '../util/unbundle_jsonlint'; | ||
@@ -6,0 +6,0 @@ |
import validateSky from './validate_sky'; | ||
import validateSpec from './validate'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
import {SkySpecification} from '../types.g'; | ||
@@ -27,12 +27,12 @@ | ||
test('Should return errors according to spec violations', () => { | ||
const errors = validateSky({validateSpec, value: {'sky-color': 1 as any, 'fog-color': 2 as any, 'horizon-blend': {} as any, 'fog-blend': 'foo' as any}, styleSpec: v8, style: {} as any}); | ||
const errors = validateSky({validateSpec, value: {'sky-color': 1 as any, 'fog-color': 2 as any, 'horizon-fog-blend': {} as any, 'fog-ground-blend': 'foo' as any}, styleSpec: v8, style: {} as any}); | ||
expect(errors).toHaveLength(4); | ||
expect(errors[0].message).toBe('sky-color: color expected, number found'); | ||
expect(errors[1].message).toBe('fog-color: color expected, number found'); | ||
expect(errors[2].message).toBe('horizon-blend: missing required property "stops"'); | ||
expect(errors[3].message).toBe('fog-blend: number expected, string found'); | ||
expect(errors[2].message).toBe('horizon-fog-blend: missing required property "stops"'); | ||
expect(errors[3].message).toBe('fog-ground-blend: number expected, string found'); | ||
}); | ||
test('Should pass if everything is according to spec', () => { | ||
const errors = validateSky({validateSpec, value: {'sky-color': 'red', 'fog-color': '#123456', 'horizon-blend': 1, 'fog-blend': 0}, styleSpec: v8, style: {} as any}); | ||
const errors = validateSky({validateSpec, value: {'sky-color': 'red', 'fog-color': '#123456', 'horizon-fog-blend': 1, 'fog-ground-blend': 0}, styleSpec: v8, style: {} as any}); | ||
expect(errors).toHaveLength(0); | ||
@@ -39,0 +39,0 @@ }); |
import ValidationError from '../error/validation_error'; | ||
import getType from '../util/get_type'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
import {SkySpecification, StyleSpecification} from '../types.g'; | ||
@@ -5,0 +5,0 @@ |
import validateSpec from './validate'; | ||
import validateTerrain from './validate_terrain'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
@@ -5,0 +5,0 @@ describe('Validate Terrain', () => { |
import ValidationError from '../error/validation_error'; | ||
import getType from '../util/get_type'; | ||
import type {StyleSpecification, TerrainSpecification} from '../types.g'; | ||
import v8 from '../reference/v8.json' assert {type: 'json'}; | ||
import v8 from '../reference/v8.json' with {type: 'json'}; | ||
@@ -6,0 +6,0 @@ export default function validateTerrain( |
@@ -29,2 +29,3 @@ | ||
import ValidationError from '../error/validation_error'; | ||
import validateProjection from './validate_projection'; | ||
@@ -49,2 +50,3 @@ const VALIDATORS = { | ||
'terrain': validateTerrain, | ||
'projection': validateProjection, | ||
'string': validateString, | ||
@@ -51,0 +53,0 @@ 'formatted': validateFormatted, |
@@ -1,2 +0,2 @@ | ||
import Reference from './reference/v8.json' assert {type: 'json'}; | ||
import Reference from './reference/v8.json' with {type: 'json'}; | ||
import type {StylePropertySpecification} from '.'; | ||
@@ -3,0 +3,0 @@ import type { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9071182
161
95749