maplibre-gl 3.4.1 → 3.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "maplibre-gl",
3
3
  "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",
4
- "version": "3.4.1",
4
+ "version": "3.5.0",
5
5
  "main": "dist/maplibre-gl.js",
6
6
  "style": "dist/maplibre-gl.css",
7
7
  "license": "BSD-3-Clause",
@@ -52,9 +52,9 @@
52
52
  "@types/benchmark": "^2.1.3",
53
53
  "@types/cssnano": "^5.0.0",
54
54
  "@types/d3": "^7.4.1",
55
- "@types/diff": "^5.0.5",
55
+ "@types/diff": "^5.0.6",
56
56
  "@types/earcut": "^2.1.2",
57
- "@types/eslint": "^8.44.3",
57
+ "@types/eslint": "^8.44.4",
58
58
  "@types/gl": "^6.0.3",
59
59
  "@types/glob": "^8.1.0",
60
60
  "@types/jest": "^29.5.3",
@@ -66,20 +66,20 @@
66
66
  "@types/offscreencanvas": "^2019.7.1",
67
67
  "@types/pixelmatch": "^5.2.4",
68
68
  "@types/pngjs": "^6.0.2",
69
- "@types/react": "^18.2.25",
70
- "@types/react-dom": "^18.2.11",
71
- "@types/request": "^2.48.9",
69
+ "@types/react": "^18.2.28",
70
+ "@types/react-dom": "^18.2.13",
71
+ "@types/request": "^2.48.10",
72
72
  "@types/shuffle-seed": "^1.1.0",
73
73
  "@types/window-or-global": "^1.0.4",
74
- "@typescript-eslint/eslint-plugin": "^6.7.4",
75
- "@typescript-eslint/parser": "^6.7.4",
74
+ "@typescript-eslint/eslint-plugin": "^6.7.5",
75
+ "@typescript-eslint/parser": "^6.7.5",
76
76
  "address": "^2.0.1",
77
77
  "benchmark": "^2.1.4",
78
78
  "canvas": "^2.11.2",
79
79
  "cssnano": "^6.0.1",
80
80
  "d3": "^7.8.5",
81
81
  "d3-queue": "^3.0.7",
82
- "devtools-protocol": "^0.0.1206220",
82
+ "devtools-protocol": "^0.0.1208070",
83
83
  "diff": "^5.1.0",
84
84
  "dts-bundle-generator": "^8.0.1",
85
85
  "eslint": "^8.51.0",
@@ -164,6 +164,17 @@ describe('RasterTileSource', () => {
164
164
  server.respond();
165
165
  });
166
166
 
167
+ test('supports updating tiles', () => {
168
+ const source = createSource({url: '/source.json'});
169
+ source.setTiles(['http://example.com/{z}/{x}/{y}.png?updated=true']);
170
+
171
+ source.on('data', (e) => {
172
+ if (e.sourceDataType === 'metadata') {
173
+ expect(source.tiles[0]).toBe('http://example.com/{z}/{x}/{y}.png?updated=true');
174
+ }
175
+ });
176
+ });
177
+
167
178
  test('cancels TileJSON request if removed', () => {
168
179
  const source = createSource({url: '/source.json'});
169
180
  source.onRemove();
@@ -124,6 +124,30 @@ export class RasterTileSource extends Evented implements Source {
124
124
  }
125
125
  }
126
126
 
127
+ setSourceProperty(callback: Function) {
128
+ if (this._tileJSONRequest) {
129
+ this._tileJSONRequest.cancel();
130
+ }
131
+
132
+ callback();
133
+
134
+ this.load();
135
+ }
136
+
137
+ /**
138
+ * Sets the source `tiles` property and re-renders the map.
139
+ *
140
+ * @param tiles - An array of one or more tile source URLs, as in the raster tiles spec (See the [Style Specification](https://maplibre.org/maplibre-style-spec/)
141
+ * @returns `this`
142
+ */
143
+ setTiles(tiles: Array<string>): this {
144
+ this.setSourceProperty(() => {
145
+ this._options.tiles = tiles;
146
+ });
147
+
148
+ return this;
149
+ }
150
+
127
151
  serialize() {
128
152
  return extend({}, this._options);
129
153
  }