Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

@mapbox/mapbox-gl-style-spec

Package Overview
Dependencies
Maintainers
14
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mapbox/mapbox-gl-style-spec - npm Package Compare versions

Comparing version 13.7.0 to 13.7.1

flow-typed/gl.js

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## 13.7.1
### 🐛 Bug fixes
* Fix format expression options validation ([#8339](https://github.com/mapbox/mapbox-gl-js/pull/8339))
* Fix SDK support information for style properties added in v13.7.0: ([#8384](https://github.com/mapbox/mapbox-gl-js/pull/8384))
* Add missing SDK support section for `text-radial-offset` property
* Assign SDK versions for `text-variable-anchor` and `text-justify: auto`
## 13.7.0

@@ -2,0 +10,0 @@

2

expression/compound_expression.js

@@ -50,3 +50,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
const op: string = (args[0]: any);

@@ -53,0 +53,0 @@ const definition = CompoundExpression.definitions[op];

@@ -40,3 +40,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length < 2)

@@ -43,0 +43,0 @@ return context.error(`Expected at least one argument.`);

@@ -24,3 +24,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length !== 3)

@@ -27,0 +27,0 @@ return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);

@@ -27,3 +27,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length < 4)

@@ -30,0 +30,0 @@ return context.error(`Expected at least 3 arguments, but found only ${args.length - 1}.`);

@@ -22,3 +22,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length < 2) {

@@ -25,0 +25,0 @@ return context.error("Expectected at least one argument.");

@@ -40,3 +40,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length < 2)

@@ -43,0 +43,0 @@ return context.error(`Expected at least one argument.`);

@@ -24,3 +24,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length !== 2)

@@ -27,0 +27,0 @@ return context.error(`Expected one argument.`);

@@ -81,3 +81,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length !== 3 && args.length !== 4)

@@ -84,0 +84,0 @@ return context.error(`Expected two or three arguments.`);

@@ -27,3 +27,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length < 3) {

@@ -30,0 +30,0 @@ return context.error(`Expected at least two arguments.`);

@@ -59,3 +59,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
let [operator, interpolation, input, ...rest] = args;

@@ -62,0 +62,0 @@

@@ -22,3 +22,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length !== 2)

@@ -25,0 +25,0 @@ return context.error(`Expected 1 argument, but found ${args.length - 1} instead.`);

@@ -30,3 +30,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length < 4)

@@ -33,0 +33,0 @@ return context.error(`Expected at least 3 arguments, but found ${args.length - 1} instead.`);

@@ -21,3 +21,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length !== 2)

@@ -24,0 +24,0 @@ return context.error(`'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`);

@@ -34,3 +34,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length < 5)

@@ -37,0 +37,0 @@ return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);

@@ -58,3 +58,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext): ?Expression {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext): ?Expression {
if (args.length !== 3)

@@ -61,0 +61,0 @@ return context.error(`Expected two arguments.`);

@@ -33,5 +33,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
let [ , input, ...rest] = args;
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length - 1 < 4) {

@@ -45,3 +43,3 @@ return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);

input = context.parse(input, 1, NumberType);
const input = context.parse(args[1], 1, NumberType);
if (!input) return null;

@@ -56,11 +54,9 @@

rest.unshift(-Infinity);
for (let i = 1; i < args.length; i += 2) {
const label = i === 1 ? -Infinity : args[i];
const value = args[i + 1];
for (let i = 0; i < rest.length; i += 2) {
const label = rest[i];
const value = rest[i + 1];
const labelKey = i;
const valueKey = i + 1;
const labelKey = i + 1;
const valueKey = i + 2;
if (typeof label !== 'number') {

@@ -67,0 +63,0 @@ return context.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.', labelKey);

@@ -19,3 +19,3 @@ // @flow

static parse(args: Array<mixed>, context: ParsingContext) {
static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) {
if (args.length !== 2 || typeof args[1] !== 'string')

@@ -22,0 +22,0 @@ return context.error(`'var' expression requires exactly one string literal argument.`);

@@ -27,4 +27,4 @@ // @flow

export type ExpressionParser = (args: Array<mixed>, context: ParsingContext) => ?Expression;
export type ExpressionParser = (args: $ReadOnlyArray<mixed>, context: ParsingContext) => ?Expression;
export type ExpressionRegistration = Class<Expression> & { +parse: ExpressionParser };
export type ExpressionRegistry = {[string]: ExpressionRegistration};

@@ -150,3 +150,3 @@ // @flow

_styleExpression: StyleExpression;
_interpolationType: ?InterpolationType;
interpolationType: ?InterpolationType;

@@ -159,3 +159,3 @@ constructor(kind: Kind, expression: StyleExpression, zoomCurve: Step | Interpolate) {

if (zoomCurve instanceof Interpolate) {
this._interpolationType = zoomCurve.interpolation;
this.interpolationType = zoomCurve.interpolation;
}

@@ -173,4 +173,4 @@ }

interpolationFactor(input: number, lower: number, upper: number): number {
if (this._interpolationType) {
return Interpolate.interpolationFactor(this._interpolationType, input, lower, upper);
if (this.interpolationType) {
return Interpolate.interpolationFactor(this.interpolationType, input, lower, upper);
} else {

@@ -197,3 +197,4 @@ return 0;

+interpolationFactor: (input: number, lower: number, upper: number) => number,
zoomStops: Array<number>
zoomStops: Array<number>,
interpolationType: ?InterpolationType
};

@@ -206,3 +207,4 @@

+interpolationFactor: (input: number, lower: number, upper: number) => number,
zoomStops: Array<number>
zoomStops: Array<number>,
interpolationType: ?InterpolationType
};

@@ -209,0 +211,0 @@

@@ -14,7 +14,7 @@ // @flow

export function findStopLessThanOrEqualTo(stops: Array<number>, input: number) {
const n = stops.length;
const lastIndex = stops.length - 1;
let lowerIndex = 0;
let upperIndex = n - 1;
let upperIndex = lastIndex;
let currentIndex = 0;
let currentValue, upperValue;
let currentValue, nextValue;

@@ -24,6 +24,9 @@ while (lowerIndex <= upperIndex) {

currentValue = stops[currentIndex];
upperValue = stops[currentIndex + 1];
if (input === currentValue || input > currentValue && input < upperValue) { // Search complete
return currentIndex;
} else if (currentValue < input) {
nextValue = stops[currentIndex + 1];
if (currentValue <= input) {
if (currentIndex === lastIndex || input < nextValue) { // Search complete
return currentIndex;
}
lowerIndex = currentIndex + 1;

@@ -37,3 +40,3 @@ } else if (currentValue > input) {

return Math.max(currentIndex - 1, 0);
return 0;
}
// @flow
'use strict';
declare module "@mapbox/mapbox-gl-supported" {
declare type isSupported = (options?: {failIfMajorPerformanceCaveat: boolean}) => boolean;
declare type isSupported = {
(options?: {failIfMajorPerformanceCaveat: boolean}): boolean,
webGLContextAttributes: WebGLContextAttributes
};
declare module.exports: isSupported;
}

@@ -10,2 +10,3 @@

import { supportsInterpolation } from '../util/properties';
import { findStopLessThanOrEqualTo } from '../expression/stops';

@@ -96,5 +97,7 @@ export function isFunction(value) {

const interpolationType = {name: 'linear'};
return {
kind: 'composite',
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, {name: 'linear'}),
interpolationType,
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
zoomStops: featureFunctionStops.map(s => s[0]),

@@ -109,7 +112,8 @@ evaluate({zoom}, properties) {

} else if (zoomDependent) {
const interpolationType = type === 'exponential' ?
{name: 'exponential', base: parameters.base !== undefined ? parameters.base : 1} : null;
return {
kind: 'camera',
interpolationFactor: type === 'exponential' ?
Interpolate.interpolationFactor.bind(undefined, {name: 'exponential', base: parameters.base !== undefined ? parameters.base : 1}) :
() => 0,
interpolationType,
interpolationFactor: Interpolate.interpolationFactor.bind(undefined, interpolationType),
zoomStops: parameters.stops.map(s => s[0]),

@@ -151,3 +155,3 @@ evaluate: ({zoom}) => innerFun(parameters, propertySpec, zoom, hashedStops, categoricalKeyType)

const index = findStopLessThanOrEqualTo(parameters.stops, input);
const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);

@@ -167,3 +171,3 @@ return parameters.stops[index][1];

const index = findStopLessThanOrEqualTo(parameters.stops, input);
const index = findStopLessThanOrEqualTo(parameters.stops.map((stop) => stop[0]), input);
const t = interpolationFactor(

@@ -212,30 +216,2 @@ input, base,

/**
* Returns the index of the last stop <= input, or 0 if it doesn't exist.
*
* @private
*/
function findStopLessThanOrEqualTo(stops, input) {
const n = stops.length;
let lowerIndex = 0;
let upperIndex = n - 1;
let currentIndex = 0;
let currentValue, upperValue;
while (lowerIndex <= upperIndex) {
currentIndex = Math.floor((lowerIndex + upperIndex) / 2);
currentValue = stops[currentIndex][0];
upperValue = stops[currentIndex + 1][0];
if (input === currentValue || input > currentValue && input < upperValue) { // Search complete
return currentIndex;
} else if (currentValue < input) {
lowerIndex = currentIndex + 1;
} else if (currentValue > input) {
upperIndex = currentIndex - 1;
}
}
return Math.max(currentIndex - 1, 0);
}
/**
* Returns a ratio that can be used to interpolate between exponential function

@@ -242,0 +218,0 @@ * stops.

@@ -48,9 +48,15 @@

* @param {Array<Layer>} layers
* @param {Object} [cachedKeys] - an object to keep already calculated keys.
* @returns {Array<Array<Layer>>}
*/
function groupByLayout(layers) {
function groupByLayout(layers, cachedKeys) {
const groups = {};
for (let i = 0; i < layers.length; i++) {
const k = getKey(layers[i]);
const k = (cachedKeys && cachedKeys[layers[i].id]) || getKey(layers[i]);
// update the cache if there is one
if (cachedKeys)
cachedKeys[layers[i].id] = k;
let group = groups[k];

@@ -57,0 +63,0 @@ if (!group) {

{
"name": "@mapbox/mapbox-gl-style-spec",
"description": "a specification for mapbox gl styles",
"version": "13.7.0",
"version": "13.7.1",
"author": "Mapbox",

@@ -6,0 +6,0 @@ "keywords": [

@@ -0,5 +1,8 @@

function isPrimitive(value) {
return value instanceof Number || value instanceof String || value instanceof Boolean;
}
// Turn jsonlint-lines-primitives objects into primitive objects
export function unbundle(value) {
if (value instanceof Number || value instanceof String || value instanceof Boolean) {
if (isPrimitive(value)) {
return value.valueOf();

@@ -14,5 +17,12 @@ } else {

return value.map(deepUnbundle);
} else if (value instanceof Object && !isPrimitive(value)) {
const unbundledValue = {};
for (const key in value) {
unbundledValue[key] = deepUnbundle(value[key]);
}
return unbundledValue;
}
return unbundle(value);
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc