@maptiler/client 2.3.1 → 2.4.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/CHANGELOG.md +20 -0
- package/dist/maptiler-client.cjs +38 -6
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +21 -1
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +38 -6
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# MapTiler Client Changelog
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
### New Features
|
|
5
|
+
- Added `elevation` option to Geolocation API
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
None
|
|
9
|
+
|
|
10
|
+
### Others
|
|
11
|
+
None
|
|
12
|
+
|
|
13
|
+
## 2.3.2
|
|
14
|
+
### New Features
|
|
15
|
+
None
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
None
|
|
19
|
+
|
|
20
|
+
### Others
|
|
21
|
+
Added deprecation warning and field for styles that will be deprecated in the future.
|
|
22
|
+
|
|
3
23
|
## 2.3.1
|
|
4
24
|
### New Features
|
|
5
25
|
None
|
package/dist/maptiler-client.cjs
CHANGED
|
@@ -1156,6 +1156,12 @@ const customMessages$3 = {
|
|
|
1156
1156
|
async function info(options = {}) {
|
|
1157
1157
|
const endpoint = new URL(`geolocation/ip.json`, defaults.maptilerApiURL);
|
|
1158
1158
|
endpoint.searchParams.set("key", options.apiKey ?? config.apiKey);
|
|
1159
|
+
if ("elevation" in options) {
|
|
1160
|
+
endpoint.searchParams.set(
|
|
1161
|
+
"elevation",
|
|
1162
|
+
options.elevation ? "true" : "false"
|
|
1163
|
+
);
|
|
1164
|
+
}
|
|
1159
1165
|
const urlWithParams = endpoint.toString();
|
|
1160
1166
|
const res = await callFetch(urlWithParams);
|
|
1161
1167
|
if (!res.ok) {
|
|
@@ -1283,13 +1289,14 @@ function expandMapStyle(style) {
|
|
|
1283
1289
|
return expandedStyle;
|
|
1284
1290
|
}
|
|
1285
1291
|
class MapStyleVariant {
|
|
1286
|
-
constructor(name, variantType, id, referenceStyle, description, imageURL) {
|
|
1292
|
+
constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false) {
|
|
1287
1293
|
this.name = name;
|
|
1288
1294
|
this.variantType = variantType;
|
|
1289
1295
|
this.id = id;
|
|
1290
1296
|
this.referenceStyle = referenceStyle;
|
|
1291
1297
|
this.description = description;
|
|
1292
1298
|
this.imageURL = imageURL;
|
|
1299
|
+
this.deprecated = deprecated;
|
|
1293
1300
|
}
|
|
1294
1301
|
/**
|
|
1295
1302
|
* Get the human-friendly name
|
|
@@ -1344,14 +1351,19 @@ class MapStyleVariant {
|
|
|
1344
1351
|
* @returns
|
|
1345
1352
|
*/
|
|
1346
1353
|
getVariant(variantType) {
|
|
1347
|
-
|
|
1354
|
+
const variant = this.referenceStyle.getVariant(variantType);
|
|
1355
|
+
this.warnIfDeprecated(variant);
|
|
1356
|
+
return variant;
|
|
1348
1357
|
}
|
|
1349
1358
|
/**
|
|
1350
1359
|
* Get all the variants for _this_ variants, except _this_ current one
|
|
1351
1360
|
* @returns
|
|
1352
1361
|
*/
|
|
1353
1362
|
getVariants() {
|
|
1354
|
-
return this.referenceStyle.getVariants().filter((v) => v !== this)
|
|
1363
|
+
return this.referenceStyle.getVariants().filter((v) => v !== this).map((v) => {
|
|
1364
|
+
this.warnIfDeprecated(v);
|
|
1365
|
+
return v;
|
|
1366
|
+
});
|
|
1355
1367
|
}
|
|
1356
1368
|
/**
|
|
1357
1369
|
* Get the image URL that represent _this_ variant
|
|
@@ -1367,6 +1379,15 @@ class MapStyleVariant {
|
|
|
1367
1379
|
getExpandedStyleURL() {
|
|
1368
1380
|
return expandMapStyle(this.getId());
|
|
1369
1381
|
}
|
|
1382
|
+
warnIfDeprecated(variant = this) {
|
|
1383
|
+
if (!variant.deprecated)
|
|
1384
|
+
return variant;
|
|
1385
|
+
const name = variant.getFullName();
|
|
1386
|
+
console.warn(
|
|
1387
|
+
`Style "${name}" is deprecated and will be removed in a future version.`
|
|
1388
|
+
);
|
|
1389
|
+
return variant;
|
|
1390
|
+
}
|
|
1370
1391
|
}
|
|
1371
1392
|
class ReferenceMapStyle {
|
|
1372
1393
|
constructor(name, id) {
|
|
@@ -1432,7 +1453,7 @@ class ReferenceMapStyle {
|
|
|
1432
1453
|
* @returns
|
|
1433
1454
|
*/
|
|
1434
1455
|
getDefaultVariant() {
|
|
1435
|
-
return this.orderedVariants[0];
|
|
1456
|
+
return this.orderedVariants[0].warnIfDeprecated();
|
|
1436
1457
|
}
|
|
1437
1458
|
}
|
|
1438
1459
|
const mapStylePresetList = [
|
|
@@ -1541,6 +1562,7 @@ const mapStylePresetList = [
|
|
|
1541
1562
|
variants: [
|
|
1542
1563
|
{
|
|
1543
1564
|
id: "hybrid",
|
|
1565
|
+
deprecated: true,
|
|
1544
1566
|
name: "Default",
|
|
1545
1567
|
variantType: "DEFAULT",
|
|
1546
1568
|
description: "",
|
|
@@ -1647,6 +1669,7 @@ const mapStylePresetList = [
|
|
|
1647
1669
|
{
|
|
1648
1670
|
id: "topo-v2-shiny",
|
|
1649
1671
|
name: "Shiny",
|
|
1672
|
+
deprecated: true,
|
|
1650
1673
|
variantType: "SHINY",
|
|
1651
1674
|
description: "",
|
|
1652
1675
|
imageURL: ""
|
|
@@ -1675,6 +1698,7 @@ const mapStylePresetList = [
|
|
|
1675
1698
|
{
|
|
1676
1699
|
id: "voyager-v2",
|
|
1677
1700
|
name: "Default",
|
|
1701
|
+
deprecated: true,
|
|
1678
1702
|
variantType: "DEFAULT",
|
|
1679
1703
|
description: "",
|
|
1680
1704
|
imageURL: ""
|
|
@@ -1682,6 +1706,7 @@ const mapStylePresetList = [
|
|
|
1682
1706
|
{
|
|
1683
1707
|
id: "voyager-v2-darkmatter",
|
|
1684
1708
|
name: "Darkmatter",
|
|
1709
|
+
deprecated: true,
|
|
1685
1710
|
variantType: "DARK",
|
|
1686
1711
|
description: "",
|
|
1687
1712
|
imageURL: ""
|
|
@@ -1689,6 +1714,7 @@ const mapStylePresetList = [
|
|
|
1689
1714
|
{
|
|
1690
1715
|
id: "voyager-v2-positron",
|
|
1691
1716
|
name: "Positron",
|
|
1717
|
+
deprecated: true,
|
|
1692
1718
|
variantType: "LIGHT",
|
|
1693
1719
|
description: "",
|
|
1694
1720
|
imageURL: ""
|
|
@@ -1696,6 +1722,7 @@ const mapStylePresetList = [
|
|
|
1696
1722
|
{
|
|
1697
1723
|
id: "voyager-v2-vintage",
|
|
1698
1724
|
name: "Vintage",
|
|
1725
|
+
deprecated: true,
|
|
1699
1726
|
variantType: "VINTAGE",
|
|
1700
1727
|
description: "",
|
|
1701
1728
|
imageURL: ""
|
|
@@ -1718,6 +1745,7 @@ const mapStylePresetList = [
|
|
|
1718
1745
|
id: "toner-v2-background",
|
|
1719
1746
|
name: "Background",
|
|
1720
1747
|
variantType: "BACKGROUND",
|
|
1748
|
+
deprecated: true,
|
|
1721
1749
|
description: "",
|
|
1722
1750
|
imageURL: ""
|
|
1723
1751
|
},
|
|
@@ -1732,6 +1760,7 @@ const mapStylePresetList = [
|
|
|
1732
1760
|
id: "toner-v2-lines",
|
|
1733
1761
|
name: "Lines",
|
|
1734
1762
|
variantType: "LINES",
|
|
1763
|
+
deprecated: true,
|
|
1735
1764
|
description: "",
|
|
1736
1765
|
imageURL: ""
|
|
1737
1766
|
}
|
|
@@ -1873,7 +1902,8 @@ function makeReferenceStyleProxy(referenceStyle) {
|
|
|
1873
1902
|
if (prop.toString().toUpperCase() === prop) {
|
|
1874
1903
|
return referenceStyle.getDefaultVariant();
|
|
1875
1904
|
}
|
|
1876
|
-
|
|
1905
|
+
const style = Reflect.get(target, prop, receiver);
|
|
1906
|
+
return style;
|
|
1877
1907
|
}
|
|
1878
1908
|
});
|
|
1879
1909
|
}
|
|
@@ -1896,8 +1926,10 @@ function buildMapStyles() {
|
|
|
1896
1926
|
refStyle,
|
|
1897
1927
|
// referenceStyle
|
|
1898
1928
|
variantInfo.description,
|
|
1899
|
-
variantInfo.imageURL
|
|
1929
|
+
variantInfo.imageURL,
|
|
1900
1930
|
// imageURL
|
|
1931
|
+
variantInfo.deprecated
|
|
1932
|
+
// deprecated
|
|
1901
1933
|
);
|
|
1902
1934
|
refStyle.addVariant(variant);
|
|
1903
1935
|
}
|