@mapbox/mapbox-gl-style-spec
Advanced tools
Comparing version 12.0.0-pre.1 to 12.0.0
## 12.0.0 | ||
### ⚠️ Breaking changes | ||
* The `"to-string"` expression operator now converts null to an empty string rather than to `"null"`. [#6534](https://github.com/mapbox/mapbox-gl-js/pull/6534) | ||
### ✨ Features and improvements | ||
* 🌈 Add line-gradient property [#6303](https://github.com/mapbox/mapbox-gl-js/pull/6303) | ||
* Add collator expression for controlling case and diacritic sensitivity in string comparisons [#6270](https://github.com/mapbox/mapbox-gl-js/pull/6270) | ||
* Add `is-supported-script` expression for determining if a script is supported. [#6260](https://github.com/mapbox/mapbox-gl-js/pull/6260) | ||
* Add `collator` expression for controlling case and diacritic sensitivity in string comparisons [#6270](https://github.com/mapbox/mapbox-gl-js/pull/6270) | ||
* Add `abs`, `round`, `floor`, and `ceil` expression operators [#6496](https://github.com/mapbox/mapbox-gl-js/pull/6496) | ||
* Add support for Mapzen Terrarium tiles in raster-dem sources [#6110](https://github.com/mapbox/mapbox-gl-js/pull/6110) | ||
### 🐛 Bug fixes | ||
- Fix Rollup build [6575](https://github.com/mapbox/mapbox-gl-js/pull/6575) | ||
## 11.1.1 | ||
@@ -23,2 +39,3 @@ | ||
* Introduce client-side hillshading with `raster-dem` source type and `hillshade` layer type [#5286](https://github.com/mapbox/mapbox-gl-js/pull/5286) | ||
* Add Color#toString and expose Color publicly [#5866](https://github.com/mapbox/mapbox-gl-js/pull/5866) | ||
@@ -25,0 +42,0 @@ * Improve typing for `==` and `!=` expressions [#5840](https://github.com/mapbox/mapbox-gl-js/pull/5840) |
@@ -68,12 +68,2 @@ // @flow | ||
} | ||
serialize() { | ||
const options = {}; | ||
options['caseSensitive'] = this.sensitivity === 'variant' || this.sensitivity === 'case'; | ||
options['diacriticSensitive'] = this.sensitivity === 'variant' || this.sensitivity === 'accent'; | ||
if (this.locale) { | ||
options['locale'] = this.locale; | ||
} | ||
return ["collator", options]; | ||
} | ||
} | ||
@@ -103,7 +93,7 @@ | ||
const caseSensitive = context.parse( | ||
options['caseSensitive'] === undefined ? false : options['caseSensitive'], 1, BooleanType); | ||
options['case-sensitive'] === undefined ? false : options['case-sensitive'], 1, BooleanType); | ||
if (!caseSensitive) return null; | ||
const diacriticSensitive = context.parse( | ||
options['diacriticSensitive'] === undefined ? false : options['diacriticSensitive'], 1, BooleanType); | ||
options['diacritic-sensitive'] === undefined ? false : options['diacritic-sensitive'], 1, BooleanType); | ||
if (!diacriticSensitive) return null; | ||
@@ -142,4 +132,4 @@ | ||
const options = {}; | ||
options['caseSensitive'] = this.caseSensitive.serialize(); | ||
options['diacriticSensitive'] = this.diacriticSensitive.serialize(); | ||
options['case-sensitive'] = this.caseSensitive.serialize(); | ||
options['diacritic-sensitive'] = this.diacriticSensitive.serialize(); | ||
if (this.locale) { | ||
@@ -146,0 +136,0 @@ options['locale'] = this.locale.serialize(); |
@@ -172,7 +172,2 @@ // @flow | ||
}, | ||
'feature-state': [ | ||
ValueType, | ||
[StringType], | ||
(ctx, [key]) => get(key.evaluate(ctx), ctx.state()) | ||
], | ||
'properties': [ | ||
@@ -179,0 +174,0 @@ ObjectType, |
// @flow | ||
import assert from 'assert'; | ||
import { isValue, typeOf, Color, Collator } from '../values'; | ||
import { isValue, typeOf, Color } from '../values'; | ||
@@ -63,6 +63,2 @@ import type { Type } from '../types'; | ||
return ["rgba"].concat(this.value.toArray()); | ||
} else if (this.value instanceof Collator) { | ||
// Same as Color above: literal serialization delegated to | ||
// Collator (not CollatorExpression) | ||
return this.value.serialize(); | ||
} else { | ||
@@ -69,0 +65,0 @@ assert(this.value === null || |
@@ -31,6 +31,2 @@ // @flow | ||
state() { | ||
return this.feature && this.feature.state || {}; | ||
} | ||
parseColor(input: string): ?Color { | ||
@@ -37,0 +33,0 @@ let cached = this._parseColorCache[input]; |
@@ -123,3 +123,2 @@ // @flow | ||
kind: Kind; | ||
isStateDependent: boolean; | ||
_styleExpression: StyleExpression; | ||
@@ -130,3 +129,2 @@ | ||
this._styleExpression = expression; | ||
this.isStateDependent = kind !== 'constant' && !isConstant.isStateConstant(expression.expression); | ||
} | ||
@@ -146,3 +144,2 @@ | ||
zoomStops: Array<number>; | ||
isStateDependent: boolean; | ||
@@ -156,3 +153,2 @@ _styleExpression: StyleExpression; | ||
this._styleExpression = expression; | ||
this.isStateDependent = kind !== 'camera' && !isConstant.isStateConstant(expression.expression); | ||
if (zoomCurve instanceof Interpolate) { | ||
@@ -187,3 +183,2 @@ this._interpolationType = zoomCurve.interpolation; | ||
kind: 'source', | ||
isStateDependent: boolean, | ||
+evaluate: (globals: GlobalProperties, feature?: Feature) => any, | ||
@@ -201,3 +196,2 @@ }; | ||
kind: 'composite', | ||
isStateDependent: boolean, | ||
+evaluate: (globals: GlobalProperties, feature?: Feature) => any, | ||
@@ -204,0 +198,0 @@ +interpolationFactor: (input: number, lower: number, upper: number) => number, |
@@ -11,4 +11,2 @@ // @flow | ||
return false; | ||
} else if (e.name === 'feature-state') { | ||
return false; | ||
} else if (e.name === 'has' && e.args.length === 1) { | ||
@@ -34,15 +32,2 @@ return false; | ||
function isStateConstant(e: Expression) { | ||
if (e instanceof CompoundExpression) { | ||
if (e.name === 'feature-state') { | ||
return false; | ||
} | ||
} | ||
let result = true; | ||
e.eachChild(arg => { | ||
if (result && !isStateConstant(arg)) { result = false; } | ||
}); | ||
return result; | ||
} | ||
function isGlobalPropertyConstant(e: Expression, properties: Array<string>) { | ||
@@ -57,2 +42,2 @@ if (e instanceof CompoundExpression && properties.indexOf(e.name) >= 0) { return false; } | ||
export { isFeatureConstant, isGlobalPropertyConstant, isStateConstant }; | ||
export { isFeatureConstant, isGlobalPropertyConstant }; |
{ | ||
"name": "@mapbox/mapbox-gl-style-spec", | ||
"description": "a specification for mapbox gl styles", | ||
"version": "12.0.0-pre.1", | ||
"version": "12.0.0", | ||
"author": "Mapbox", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -54,4 +54,2 @@ // @flow | ||
import v8 from './reference/v8.json'; | ||
export {v8}; | ||
import latest from './reference/latest'; | ||
@@ -72,3 +70,21 @@ import format from './format'; | ||
const exported = { | ||
const expression = { | ||
StyleExpression, | ||
isExpression, | ||
createExpression, | ||
createPropertyExpression, | ||
normalizePropertyExpression, | ||
ZoomConstantExpression, | ||
ZoomDependentExpression, | ||
StylePropertyFunction | ||
}; | ||
const styleFunction = { | ||
convertFunction, | ||
createFunction, | ||
isFunction | ||
}; | ||
export { | ||
v8, | ||
latest, | ||
@@ -81,25 +97,10 @@ format, | ||
ParsingError, | ||
expression: { | ||
StyleExpression, | ||
isExpression, | ||
createExpression, | ||
createPropertyExpression, | ||
normalizePropertyExpression, | ||
ZoomConstantExpression, | ||
ZoomDependentExpression, | ||
StylePropertyFunction | ||
}, | ||
expression, | ||
featureFilter, | ||
Color, | ||
function: { | ||
convertFunction, | ||
createFunction, | ||
isFunction | ||
}, | ||
styleFunction as function, | ||
validate | ||
}; | ||
export default exported; | ||
validate.parsed = validate; | ||
validate.latest = validate; |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1335896
103
18745
1