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

ol-mapbox-style

Package Overview
Dependencies
Maintainers
3
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ol-mapbox-style - npm Package Compare versions

Comparing version 8.0.1 to 8.0.2

dist/index.d.ts.map

5

CHANGELOG.md
# Changelog
## 8.0.2
* Fix display of optional arguments in API docs
* Fix layer stack regression when layers from one source are spread across multiple OpenLayers layers
## 8.0.1

@@ -4,0 +9,0 @@

20

dist/apply.d.ts

@@ -33,3 +33,3 @@ /**

* @param {string|Object} glStyle Mapbox Style object.
* @param {string|Array<string>} [sourceOrLayers] `source` key or an array of layer `id`s from the
* @param {string|Array<string>} sourceOrLayers `source` key or an array of layer `id`s from the
* Mapbox Style object. When a `source` key is provided, all layers for the

@@ -39,5 +39,5 @@ * specified source will be included in the style function. When layer `id`s

* value, all layers using the first source specified in the glStyle will be rendered.
* @param {Options|string} [optionsOrPath={}] Options. Alternatively the path of the style file
* @param {Options|string} optionsOrPath Options. Alternatively the path of the style file
* (only required when a relative path is used for the `"sprite"` property of the style).
* @param {Array<number>} [resolutions] Resolutions for mapping resolution to zoom level.
* @param {Array<number>} resolutions Resolutions for mapping resolution to zoom level.
* Only needed when working with non-standard tile grids or projections.

@@ -47,3 +47,3 @@ * @return {Promise} Promise which will be resolved when the style can be used

*/
export function applyStyle(layer: VectorTileLayer | VectorLayer<any>, glStyle: string | any, sourceOrLayers?: string | string[] | undefined, optionsOrPath?: string | Options | undefined, resolutions?: number[] | undefined): Promise<any>;
export function applyStyle(layer: VectorTileLayer | VectorLayer<any>, glStyle: string | any, sourceOrLayers?: string | Array<string>, optionsOrPath?: Options | string, resolutions?: Array<number>): Promise<any>;
/**

@@ -63,6 +63,6 @@ * Applies properties of the Mapbox Style's first `background` layer to the

* @param {Object|string} glStyle Mapbox Style object or url.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise} Promise that resolves when the background is applied.
*/
export function applyBackground(mapOrLayer: Map | VectorTileLayer, glStyle: any | string, options?: Options | undefined): Promise<any>;
export function applyBackground(mapOrLayer: Map | VectorTileLayer, glStyle: any | string, options?: Options): Promise<any>;
/**

@@ -119,3 +119,3 @@ * Creates an OpenLayers VectorTile source for a gl source entry.

* is loaded and parsed.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise<Map>} A promise that resolves after all layers have been added to

@@ -126,3 +126,3 @@ * the OpenLayers Map instance, their sources set, and their styles applied. The

*/
export function apply(map: Map | HTMLElement | string, style: string | any, options?: Options | undefined): Promise<Map>;
export function apply(map: Map | HTMLElement | string, style: string | any, options?: Options): Promise<Map>;
/**

@@ -232,3 +232,3 @@ * Get the OpenLayers layer instance that contains the provided Mapbox Style

* @param {Map} map OpenLayers Map.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise} Returns a promise that resolves after the source has

@@ -238,2 +238,2 @@ * been set on the specified layer, and the style has been applied.

*/
declare function finalizeLayer(layer: Layer, layerIds: Array<string>, glStyle: any, styleUrl: string | undefined, map: Map, options?: Options | undefined): Promise<any>;
declare function finalizeLayer(layer: Layer, layerIds: Array<string>, glStyle: any, styleUrl: string | undefined, map: Map, options?: Options): Promise<any>;

@@ -26,5 +26,5 @@ /**

* `mapbox-layer` property.
* @param {boolean} [record=false] Recording of the style layer is on.
* @param {boolean} record Recording of the style layer is on.
*/
export function recordStyleLayer(record?: boolean | undefined): void;
export function recordStyleLayer(record?: boolean): void;
/**

@@ -77,11 +77,11 @@ * Creates a style function from the `glStyle` object for all layers that use

* are provided, they must be from layers that use the same source.
* @param {Array<number>} [resolutions=[78271.51696402048, 39135.75848201024, 19567.87924100512, 9783.93962050256, 4891.96981025128, 2445.98490512564, 1222.99245256282, 611.49622628141, 305.748113140705, 152.8740565703525, 76.43702828517625, 38.21851414258813, 19.109257071294063, 9.554628535647032, 4.777314267823516, 2.388657133911758, 1.194328566955879, 0.5971642834779395, 0.29858214173896974, 0.14929107086948487, 0.07464553543474244]]
* @param {Array<number>} resolutions
* Resolutions for mapping resolution to zoom level.
* @param {Object} [spriteData=undefined] Sprite data from the url specified in
* @param {Object} spriteData Sprite data from the url specified in
* the Mapbox Style object's `sprite` property. Only required if a `sprite`
* property is specified in the Mapbox Style object.
* @param {string} [spriteImageUrl=undefined] Sprite image url for the sprite
* @param {string} spriteImageUrl Sprite image url for the sprite
* specified in the Mapbox Style object's `sprite` property. Only required if a
* `sprite` property is specified in the Mapbox Style object.
* @param {function(Array<string>):Array<string>} [getFonts=undefined] Function that
* @param {function(Array<string>):Array<string>} getFonts Function that
* receives a font stack as arguments, and returns a (modified) font stack that

@@ -94,3 +94,3 @@ * is available. Font names are the names used in the Mapbox Style object. If

*/
export function stylefunction(olLayer: import("ol/layer/Vector").default<any> | VectorTileLayer, glStyle: string | any, sourceOrLayers: string | Array<string>, resolutions?: number[] | undefined, spriteData?: any, spriteImageUrl?: string | undefined, getFonts?: ((arg0: Array<string>) => Array<string>) | undefined): StyleFunction;
export function stylefunction(olLayer: import("ol/layer/Vector").default<any> | VectorTileLayer, glStyle: string | any, sourceOrLayers: string | Array<string>, resolutions?: Array<number>, spriteData?: any, spriteImageUrl?: string, getFonts?: (arg0: Array<string>) => Array<string>): StyleFunction;
export type VectorLayer = import("ol/layer/Vector").default<any>;

@@ -97,0 +97,0 @@ export type VectorTileLayer = import("ol/layer/VectorTile").default;

{
"name": "ol-mapbox-style",
"version": "8.0.1",
"version": "8.0.2",
"description": "Create OpenLayers maps from Mapbox Style objects",

@@ -32,3 +32,3 @@ "type": "module",

"build": "tsc --project tsconfig-build.json && webpack-cli --mode=production --config ./webpack.config.olms.cjs && webpack-cli --mode=production --config ./webpack.config.examples.cjs",
"doc": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-missing-exports src/index.js --readme none --excludeExternals --internalNamespace 'types' --name API --hideBreadcrumbs --tsconfig tsconfig-typecheck.json && npx concat-md docs --hide-anchor-links=false | npx md-insert README.md -i --region apidoc",
"doc": "typedoc --plugin typedoc-plugin-markdown --plugin typedoc-plugin-missing-exports src/index.js --readme none --excludeExternals --internalNamespace 'types' --name API --hideBreadcrumbs --disableSources --tsconfig tsconfig-typecheck.json && npx concat-md docs --hide-anchor-links=false | npx md-insert README.md -i --region apidoc",
"karma": "karma start test/karma.conf.cjs",

@@ -35,0 +35,0 @@ "lint": "eslint test examples src",

@@ -171,3 +171,3 @@ # ol-mapbox-style

| `style` | `any` | JSON style object or style url pointing to a Mapbox Style object. When using Mapbox APIs, the url is the `styleUrl` shown in Mapbox Studio's "share" panel. In addition, the `accessToken` option (see below) must be set. When passed as JSON style object, all OpenLayers layers created by `apply()` will be immediately available, but they may not have a source yet (i.e. when they are defined by a TileJSON url in the Mapbox Style document). When passed as style url, layers will be added to the map when the Mapbox Style document is loaded and parsed. |
| `options` | [`Options`](#interfacestypesoptionsmd) | - |
| `options` | [`Options`](#interfacestypesoptionsmd) | Options. |

@@ -183,6 +183,2 @@ #### Returns

#### Defined in
[apply.js:769](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L769)
___

@@ -212,3 +208,3 @@

| `glStyle` | `any` | Mapbox Style object or url. |
| `options` | [`Options`](#interfacestypesoptionsmd) | - |
| `options` | [`Options`](#interfacestypesoptionsmd) | Options. |

@@ -221,6 +217,2 @@ #### Returns

#### Defined in
[apply.js:440](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L440)
___

@@ -230,3 +222,3 @@

▸ **applyStyle**(`layer`, `glStyle`, `sourceOrLayers`, `optionsOrPath?`, `resolutions`): `Promise`<`any`\>
▸ **applyStyle**(`layer`, `glStyle`, `sourceOrLayers?`, `optionsOrPath?`, `resolutions?`): `Promise`<`any`\>

@@ -261,9 +253,9 @@ Applies a style function to an `ol/layer/VectorTile` or `ol/layer/Vector`

| Name | Type | Description |
| :------ | :------ | :------ |
| `layer` | `VectorLayer`<`any`\> \| `VectorTileLayer` | OpenLayers layer. When the layer has a source configured, it will be modified to use the configuration from the glStyle's `source`. Options specified on the layer's source will override those from the glStyle's `source`, except for `url`, `tileUrlFunction` and `tileGrid` (exception: when the source projection is not `EPSG:3857`). |
| `glStyle` | `any` | Mapbox Style object. |
| `sourceOrLayers` | `string` \| `string`[] | - |
| `optionsOrPath` | `string` \| [`Options`](#interfacestypesoptionsmd) | - |
| `resolutions` | `number`[] | - |
| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `layer` | `VectorLayer`<`any`\> \| `VectorTileLayer` | `undefined` | OpenLayers layer. When the layer has a source configured, it will be modified to use the configuration from the glStyle's `source`. Options specified on the layer's source will override those from the glStyle's `source`, except for `url`, `tileUrlFunction` and `tileGrid` (exception: when the source projection is not `EPSG:3857`). |
| `glStyle` | `any` | `undefined` | Mapbox Style object. |
| `sourceOrLayers` | `string` \| `string`[] | `''` | `source` key or an array of layer `id`s from the Mapbox Style object. When a `source` key is provided, all layers for the specified source will be included in the style function. When layer `id`s are provided, they must be from layers that use the same source. When not provided or a falsey value, all layers using the first source specified in the glStyle will be rendered. |
| `optionsOrPath` | `string` \| [`Options`](#interfacestypesoptionsmd) | `{}` | Options. Alternatively the path of the style file (only required when a relative path is used for the `"sprite"` property of the style). |
| `resolutions` | `number`[] | `undefined` | Resolutions for mapping resolution to zoom level. Only needed when working with non-standard tile grids or projections. |

@@ -277,6 +269,2 @@ #### Returns

#### Defined in
[apply.js:128](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L128)
___

@@ -306,6 +294,2 @@

#### Defined in
[apply.js:997](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L997)
___

@@ -334,6 +318,2 @@

#### Defined in
[apply.js:913](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L913)
___

@@ -360,6 +340,2 @@

#### Defined in
[apply.js:929](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L929)
___

@@ -386,6 +362,2 @@

#### Defined in
[apply.js:946](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L946)
___

@@ -395,3 +367,3 @@

▸ **recordStyleLayer**(`record`): `void`
▸ **recordStyleLayer**(`record?`): `void`

@@ -404,5 +376,5 @@ Turns recording of the Mapbox Style's `layer` on and off. When turned on,

| Name | Type |
| :------ | :------ |
| `record` | `boolean` |
| Name | Type | Default value | Description |
| :------ | :------ | :------ | :------ |
| `record` | `boolean` | `false` | Recording of the style layer is on. |

@@ -413,6 +385,2 @@ #### Returns

#### Defined in
[stylefunction.js:226](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/stylefunction.js#L226)
___

@@ -439,6 +407,2 @@

#### Defined in
[stylefunction.js:166](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/stylefunction.js#L166)
___

@@ -469,6 +433,2 @@

#### Defined in
[apply.js:968](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L968)
___

@@ -478,3 +438,3 @@

▸ **stylefunction**(`olLayer`, `glStyle`, `sourceOrLayers`, `resolutions?`, `spriteData`, `spriteImageUrl`, `getFonts`): `StyleFunction`
▸ **stylefunction**(`olLayer`, `glStyle`, `sourceOrLayers`, `resolutions?`, `spriteData?`, `spriteImageUrl?`, `getFonts?`): `StyleFunction`

@@ -524,6 +484,6 @@ Creates a style function from the `glStyle` object for all layers that use

| `sourceOrLayers` | `string` \| `string`[] | `undefined` | `source` key or an array of layer `id`s from the Mapbox Style object. When a `source` key is provided, all layers for the specified source will be included in the style function. When layer `id`s are provided, they must be from layers that use the same source. |
| `resolutions` | `number`[] | `defaultResolutions` | - |
| `spriteData` | `any` | `undefined` | - |
| `spriteImageUrl` | `string` | `undefined` | - |
| `getFonts` | (`arg0`: `string`[]) => `string`[] | `undefined` | - |
| `resolutions` | `number`[] | `defaultResolutions` | Resolutions for mapping resolution to zoom level. |
| `spriteData` | `any` | `undefined` | Sprite data from the url specified in the Mapbox Style object's `sprite` property. Only required if a `sprite` property is specified in the Mapbox Style object. |
| `spriteImageUrl` | `string` | `undefined` | Sprite image url for the sprite specified in the Mapbox Style object's `sprite` property. Only required if a `sprite` property is specified in the Mapbox Style object. |
| `getFonts` | (`arg0`: `string`[]) => `string`[] | `undefined` | Function that receives a font stack as arguments, and returns a (modified) font stack that is available. Font names are the names used in the Mapbox Style object. If not provided, the font stack will be used as-is. This function can also be used for loading web fonts. |

@@ -537,7 +497,3 @@ #### Returns

#### Defined in
[stylefunction.js:293](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/stylefunction.js#L293)
<a name="interfacestypesfeatureidentifiermd"></a>

@@ -564,6 +520,2 @@

#### Defined in
[apply.js:42](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L42)
___

@@ -577,7 +529,3 @@

#### Defined in
[apply.js:43](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L43)
<a name="interfacestypesoptionsmd"></a>

@@ -607,6 +555,2 @@

#### Defined in
[apply.js:48](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L48)
___

@@ -620,6 +564,2 @@

#### Defined in
[apply.js:59](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L59)
___

@@ -634,6 +574,2 @@

#### Defined in
[apply.js:55](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L55)
___

@@ -648,6 +584,2 @@

#### Defined in
[apply.js:57](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L57)
___

@@ -680,7 +612,3 @@

#### Defined in
[apply.js:49](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L49)
<a name="modulestypesmd"></a>

@@ -707,6 +635,2 @@

#### Defined in
[apply.js:62](https://github.com/openlayers/ol-mapbox-style/blob/b0be4d4/src/apply.js#L62)
<!--apidoc end-->

@@ -116,3 +116,3 @@ /*

* @param {string|Object} glStyle Mapbox Style object.
* @param {string|Array<string>} [sourceOrLayers] `source` key or an array of layer `id`s from the
* @param {string|Array<string>} sourceOrLayers `source` key or an array of layer `id`s from the
* Mapbox Style object. When a `source` key is provided, all layers for the

@@ -122,5 +122,5 @@ * specified source will be included in the style function. When layer `id`s

* value, all layers using the first source specified in the glStyle will be rendered.
* @param {Options|string} [optionsOrPath={}] Options. Alternatively the path of the style file
* @param {Options|string} optionsOrPath Options. Alternatively the path of the style file
* (only required when a relative path is used for the `"sprite"` property of the style).
* @param {Array<number>} [resolutions] Resolutions for mapping resolution to zoom level.
* @param {Array<number>} resolutions Resolutions for mapping resolution to zoom level.
* Only needed when working with non-standard tile grids or projections.

@@ -133,5 +133,5 @@ * @return {Promise} Promise which will be resolved when the style can be used

glStyle,
sourceOrLayers,
sourceOrLayers = '',
optionsOrPath = {},
resolutions
resolutions = undefined
) {

@@ -148,2 +148,5 @@ let styleUrl, sourceId;

}
if (!resolutions) {
resolutions = options.resolutions;
}
if (

@@ -185,5 +188,2 @@ !styleUrl &&

});
if (!sourceId) {
return reject(new Error(`No ${type} source found in the glStyle.`));
}
} else if (Array.isArray(sourceOrLayers)) {

@@ -196,2 +196,5 @@ sourceId = glStyle.layers.find(function (layer) {

}
if (!sourceId) {
return reject(new Error(`No ${type} source found in the glStyle.`));
}

@@ -277,3 +280,3 @@ function assignSource() {

glStyle,
sourceId,
sourceOrLayers,
resolutions,

@@ -444,3 +447,3 @@ spriteData,

* @param {Object|string} glStyle Mapbox Style object or url.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise} Promise that resolves when the background is applied.

@@ -771,3 +774,3 @@ */

* is loaded and parsed.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise<Map>} A promise that resolves after all layers have been added to

@@ -832,3 +835,3 @@ * the OpenLayers Map instance, their sources set, and their styles applied. The

* @param {Map} map OpenLayers Map.
* @param {Options} [options] Options.
* @param {Options} options Options.
* @return {Promise} Returns a promise that resolves after the source has

@@ -835,0 +838,0 @@ * been set on the specified layer, and the style has been applied.

@@ -224,5 +224,5 @@ /*

* `mapbox-layer` property.
* @param {boolean} [record=false] Recording of the style layer is on.
* @param {boolean} record Recording of the style layer is on.
*/
export function recordStyleLayer(record) {
export function recordStyleLayer(record = false) {
recordLayer = record;

@@ -278,11 +278,11 @@ }

* are provided, they must be from layers that use the same source.
* @param {Array<number>} [resolutions=[78271.51696402048, 39135.75848201024, 19567.87924100512, 9783.93962050256, 4891.96981025128, 2445.98490512564, 1222.99245256282, 611.49622628141, 305.748113140705, 152.8740565703525, 76.43702828517625, 38.21851414258813, 19.109257071294063, 9.554628535647032, 4.777314267823516, 2.388657133911758, 1.194328566955879, 0.5971642834779395, 0.29858214173896974, 0.14929107086948487, 0.07464553543474244]]
* @param {Array<number>} resolutions
* Resolutions for mapping resolution to zoom level.
* @param {Object} [spriteData=undefined] Sprite data from the url specified in
* @param {Object} spriteData Sprite data from the url specified in
* the Mapbox Style object's `sprite` property. Only required if a `sprite`
* property is specified in the Mapbox Style object.
* @param {string} [spriteImageUrl=undefined] Sprite image url for the sprite
* @param {string} spriteImageUrl Sprite image url for the sprite
* specified in the Mapbox Style object's `sprite` property. Only required if a
* `sprite` property is specified in the Mapbox Style object.
* @param {function(Array<string>):Array<string>} [getFonts=undefined] Function that
* @param {function(Array<string>):Array<string>} getFonts Function that
* receives a font stack as arguments, and returns a (modified) font stack that

@@ -300,5 +300,5 @@ * is available. Font names are the names used in the Mapbox Style object. If

resolutions = defaultResolutions,
spriteData,
spriteImageUrl,
getFonts
spriteData = undefined,
spriteImageUrl = undefined,
getFonts = undefined
) {

@@ -305,0 +305,0 @@ if (typeof glStyle == 'string') {

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

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 not supported yet

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