@maptiler/client 2.5.1 → 2.6.0-rc.2
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 +12 -0
- package/dist/maptiler-client.cjs +163 -19
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +84 -4
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +163 -19
- package/dist/maptiler-client.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# MapTiler Client Changelog
|
|
2
2
|
|
|
3
|
+
## NEXT
|
|
4
|
+
### New Features
|
|
5
|
+
- Bumps 'Streets' & 'Landscape' styles (and their variants) to new v4 styles.
|
|
6
|
+
- Adds the new 'Base' style and its variants.
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
None
|
|
10
|
+
|
|
11
|
+
### Others
|
|
12
|
+
- Adds custom deprecation warnings.
|
|
13
|
+
- Deprecates the older v2 styles and adds warnings regarding their usage.
|
|
14
|
+
|
|
3
15
|
## 2.5.1
|
|
4
16
|
### New Features
|
|
5
17
|
None
|
package/dist/maptiler-client.cjs
CHANGED
|
@@ -1289,7 +1289,7 @@ function expandMapStyle(style) {
|
|
|
1289
1289
|
return expandedStyle;
|
|
1290
1290
|
}
|
|
1291
1291
|
class MapStyleVariant {
|
|
1292
|
-
constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false) {
|
|
1292
|
+
constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false, deprecationMessage) {
|
|
1293
1293
|
this.name = name;
|
|
1294
1294
|
this.variantType = variantType;
|
|
1295
1295
|
this.id = id;
|
|
@@ -1297,6 +1297,7 @@ class MapStyleVariant {
|
|
|
1297
1297
|
this.description = description;
|
|
1298
1298
|
this.imageURL = imageURL;
|
|
1299
1299
|
this.deprecated = deprecated;
|
|
1300
|
+
this.deprecationMessage = deprecationMessage;
|
|
1300
1301
|
}
|
|
1301
1302
|
/**
|
|
1302
1303
|
* Get the human-friendly name
|
|
@@ -1382,10 +1383,14 @@ class MapStyleVariant {
|
|
|
1382
1383
|
warnIfDeprecated(variant = this) {
|
|
1383
1384
|
if (!variant.deprecated)
|
|
1384
1385
|
return variant;
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1386
|
+
if (variant.deprecationMessage) {
|
|
1387
|
+
console.warn(variant.deprecationMessage);
|
|
1388
|
+
} else {
|
|
1389
|
+
const name = variant.getFullName();
|
|
1390
|
+
console.warn(
|
|
1391
|
+
`Style "${name}" is deprecated and will be removed in a future version.`
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1389
1394
|
return variant;
|
|
1390
1395
|
}
|
|
1391
1396
|
}
|
|
@@ -1458,40 +1463,78 @@ class ReferenceMapStyle {
|
|
|
1458
1463
|
}
|
|
1459
1464
|
const mapStylePresetList = [
|
|
1460
1465
|
{
|
|
1461
|
-
referenceStyleID: "
|
|
1466
|
+
referenceStyleID: "STREETS_V2",
|
|
1462
1467
|
name: "Streets",
|
|
1463
1468
|
description: "",
|
|
1464
1469
|
variants: [
|
|
1465
1470
|
{
|
|
1466
1471
|
id: "streets-v2",
|
|
1467
|
-
name: "Default",
|
|
1472
|
+
name: "Default v2",
|
|
1468
1473
|
variantType: "DEFAULT",
|
|
1469
1474
|
description: "",
|
|
1470
|
-
imageURL: ""
|
|
1475
|
+
imageURL: "",
|
|
1476
|
+
deprecated: true,
|
|
1477
|
+
deprecationMessage: `"streets-v2" is deprecated, use "streets-v4" instead`
|
|
1471
1478
|
},
|
|
1472
1479
|
{
|
|
1473
1480
|
id: "streets-v2-dark",
|
|
1474
|
-
name: "Dark",
|
|
1481
|
+
name: "Dark v2",
|
|
1475
1482
|
variantType: "DARK",
|
|
1476
1483
|
description: "",
|
|
1477
|
-
imageURL: ""
|
|
1484
|
+
imageURL: "",
|
|
1485
|
+
deprecated: true,
|
|
1486
|
+
deprecationMessage: `"streets-v2-dark" is deprecated, use "streets-v4-dark" instead`
|
|
1478
1487
|
},
|
|
1479
1488
|
{
|
|
1480
1489
|
id: "streets-v2-light",
|
|
1481
|
-
name: "Light",
|
|
1490
|
+
name: "Light v2",
|
|
1482
1491
|
variantType: "LIGHT",
|
|
1483
1492
|
description: "",
|
|
1484
|
-
imageURL: ""
|
|
1493
|
+
imageURL: "",
|
|
1494
|
+
deprecated: true,
|
|
1495
|
+
deprecationMessage: `"streets-v2-light" is deprecated, use "streets-v4-light" instead`
|
|
1485
1496
|
},
|
|
1486
1497
|
{
|
|
1487
1498
|
id: "streets-v2-night",
|
|
1488
|
-
name: "Night",
|
|
1499
|
+
name: "Night v2",
|
|
1489
1500
|
variantType: "NIGHT",
|
|
1490
1501
|
description: "",
|
|
1491
|
-
imageURL: ""
|
|
1502
|
+
imageURL: "",
|
|
1503
|
+
deprecated: true,
|
|
1504
|
+
deprecationMessage: `"streets-v2-night" is deprecated, use "streets-v4-night" instead`
|
|
1492
1505
|
},
|
|
1493
1506
|
{
|
|
1494
1507
|
id: "streets-v2-pastel",
|
|
1508
|
+
name: "Pastel v2",
|
|
1509
|
+
variantType: "PASTEL",
|
|
1510
|
+
description: "",
|
|
1511
|
+
imageURL: "",
|
|
1512
|
+
deprecated: true,
|
|
1513
|
+
deprecationMessage: `"streets-v2-pastel" is deprecated, use "streets-v4-pastel" instead`
|
|
1514
|
+
}
|
|
1515
|
+
]
|
|
1516
|
+
},
|
|
1517
|
+
{
|
|
1518
|
+
referenceStyleID: "STREETS_V4",
|
|
1519
|
+
name: "Streets",
|
|
1520
|
+
description: "",
|
|
1521
|
+
variants: [
|
|
1522
|
+
{
|
|
1523
|
+
id: "streets-v4",
|
|
1524
|
+
name: "Default",
|
|
1525
|
+
variantType: "DEFAULT",
|
|
1526
|
+
description: "",
|
|
1527
|
+
imageURL: ""
|
|
1528
|
+
},
|
|
1529
|
+
{
|
|
1530
|
+
id: "streets-v4-dark",
|
|
1531
|
+
name: "Dark",
|
|
1532
|
+
variantType: "DARK",
|
|
1533
|
+
description: "",
|
|
1534
|
+
imageURL: ""
|
|
1535
|
+
},
|
|
1536
|
+
{
|
|
1537
|
+
id: "streets-v4-pastel",
|
|
1495
1538
|
name: "Pastel",
|
|
1496
1539
|
variantType: "PASTEL",
|
|
1497
1540
|
description: "",
|
|
@@ -1499,6 +1542,41 @@ const mapStylePresetList = [
|
|
|
1499
1542
|
}
|
|
1500
1543
|
]
|
|
1501
1544
|
},
|
|
1545
|
+
{
|
|
1546
|
+
referenceStyleID: "BASE_V4",
|
|
1547
|
+
name: "Base",
|
|
1548
|
+
description: "",
|
|
1549
|
+
variants: [
|
|
1550
|
+
{
|
|
1551
|
+
id: "base-v4",
|
|
1552
|
+
name: "Default",
|
|
1553
|
+
variantType: "DEFAULT",
|
|
1554
|
+
description: "",
|
|
1555
|
+
imageURL: ""
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
id: "base-v4-dark",
|
|
1559
|
+
name: "Dark",
|
|
1560
|
+
variantType: "DARK",
|
|
1561
|
+
description: "",
|
|
1562
|
+
imageURL: ""
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
id: "base-v4-light",
|
|
1566
|
+
name: "Light",
|
|
1567
|
+
variantType: "LIGHT",
|
|
1568
|
+
description: "",
|
|
1569
|
+
imageURL: ""
|
|
1570
|
+
},
|
|
1571
|
+
{
|
|
1572
|
+
id: "base-v4-ai",
|
|
1573
|
+
name: "Base AI",
|
|
1574
|
+
variantType: "NIGHT",
|
|
1575
|
+
description: "",
|
|
1576
|
+
imageURL: ""
|
|
1577
|
+
}
|
|
1578
|
+
]
|
|
1579
|
+
},
|
|
1502
1580
|
{
|
|
1503
1581
|
referenceStyleID: "OUTDOOR",
|
|
1504
1582
|
name: "Outdoor",
|
|
@@ -1570,7 +1648,7 @@ const mapStylePresetList = [
|
|
|
1570
1648
|
]
|
|
1571
1649
|
},
|
|
1572
1650
|
{
|
|
1573
|
-
referenceStyleID: "
|
|
1651
|
+
referenceStyleID: "BASIC_V2",
|
|
1574
1652
|
name: "Basic",
|
|
1575
1653
|
description: "",
|
|
1576
1654
|
variants: [
|
|
@@ -1579,7 +1657,9 @@ const mapStylePresetList = [
|
|
|
1579
1657
|
name: "Default",
|
|
1580
1658
|
variantType: "DEFAULT",
|
|
1581
1659
|
description: "",
|
|
1582
|
-
imageURL: ""
|
|
1660
|
+
imageURL: "",
|
|
1661
|
+
deprecated: true,
|
|
1662
|
+
deprecationMessage: `"basic-v2" is deprecated, use "basic-v4" instead`
|
|
1583
1663
|
},
|
|
1584
1664
|
{
|
|
1585
1665
|
id: "basic-v2-dark",
|
|
@@ -1864,7 +1944,7 @@ const mapStylePresetList = [
|
|
|
1864
1944
|
]
|
|
1865
1945
|
},
|
|
1866
1946
|
{
|
|
1867
|
-
referenceStyleID: "
|
|
1947
|
+
referenceStyleID: "LANDSCAPE_V2",
|
|
1868
1948
|
name: "Landscape",
|
|
1869
1949
|
description: "Terrain map for data overlays and visualisations",
|
|
1870
1950
|
variants: [
|
|
@@ -1873,25 +1953,89 @@ const mapStylePresetList = [
|
|
|
1873
1953
|
name: "Default",
|
|
1874
1954
|
variantType: "DEFAULT",
|
|
1875
1955
|
description: "",
|
|
1876
|
-
imageURL: ""
|
|
1956
|
+
imageURL: "",
|
|
1957
|
+
deprecated: true,
|
|
1958
|
+
deprecationMessage: `"landscape" is deprecated, use "landscape-v4" instead`
|
|
1877
1959
|
},
|
|
1878
1960
|
{
|
|
1879
1961
|
id: "landscape-dark",
|
|
1880
1962
|
name: "Dark",
|
|
1881
1963
|
variantType: "DARK",
|
|
1882
1964
|
description: "",
|
|
1883
|
-
imageURL: ""
|
|
1965
|
+
imageURL: "",
|
|
1966
|
+
deprecated: true,
|
|
1967
|
+
deprecationMessage: `"landscape-dark" is deprecated, use "landscape-v4-dark" instead`
|
|
1884
1968
|
},
|
|
1885
1969
|
{
|
|
1886
1970
|
id: "landscape-vivid",
|
|
1887
1971
|
name: "Vivid",
|
|
1888
1972
|
variantType: "VIVID",
|
|
1889
1973
|
description: "",
|
|
1974
|
+
imageURL: "",
|
|
1975
|
+
deprecated: true,
|
|
1976
|
+
deprecationMessage: `"landscape-vivid" is deprecated, use "landscape-v4-vivid" instead`
|
|
1977
|
+
}
|
|
1978
|
+
]
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
referenceStyleID: "LANDSCAPE_V4",
|
|
1982
|
+
name: "Landscape",
|
|
1983
|
+
description: "Terrain map for data overlays and visualisations",
|
|
1984
|
+
variants: [
|
|
1985
|
+
{
|
|
1986
|
+
id: "landscape-v4",
|
|
1987
|
+
name: "Default",
|
|
1988
|
+
variantType: "DEFAULT",
|
|
1989
|
+
description: "",
|
|
1990
|
+
imageURL: ""
|
|
1991
|
+
},
|
|
1992
|
+
{
|
|
1993
|
+
id: "landscape-v4-dark",
|
|
1994
|
+
name: "Dark",
|
|
1995
|
+
variantType: "DARK",
|
|
1996
|
+
description: "",
|
|
1997
|
+
imageURL: ""
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
id: "landscape-v4-vivid",
|
|
2001
|
+
name: "Vivid",
|
|
2002
|
+
variantType: "VIVID",
|
|
2003
|
+
description: "",
|
|
1890
2004
|
imageURL: ""
|
|
1891
2005
|
}
|
|
1892
2006
|
]
|
|
1893
2007
|
}
|
|
1894
2008
|
];
|
|
2009
|
+
const defaultReferenceStyleMap = {
|
|
2010
|
+
STREETS: "STREETS_V2",
|
|
2011
|
+
BASIC: "BASIC_V2",
|
|
2012
|
+
LANDSCAPE: "LANDSCAPE_V2"
|
|
2013
|
+
};
|
|
2014
|
+
function applyVersionToDefaultReferenceStyle(defaultKey, referenceKey) {
|
|
2015
|
+
if (mapStylePresetList.find((style) => style.referenceStyleID === defaultKey)) {
|
|
2016
|
+
console.warn(
|
|
2017
|
+
`Default reference style ${defaultKey} already exists, it will be overwritten...`
|
|
2018
|
+
);
|
|
2019
|
+
}
|
|
2020
|
+
const versionedMapStyle = mapStylePresetList.find(
|
|
2021
|
+
(style) => style.referenceStyleID === referenceKey
|
|
2022
|
+
);
|
|
2023
|
+
if (!versionedMapStyle) {
|
|
2024
|
+
throw new Error(
|
|
2025
|
+
`Versioned map style not found for reference style: ${referenceKey}`
|
|
2026
|
+
);
|
|
2027
|
+
}
|
|
2028
|
+
const defaultStyle = {
|
|
2029
|
+
...versionedMapStyle,
|
|
2030
|
+
referenceStyleID: defaultKey
|
|
2031
|
+
};
|
|
2032
|
+
mapStylePresetList.push(defaultStyle);
|
|
2033
|
+
}
|
|
2034
|
+
Object.entries(defaultReferenceStyleMap).forEach(
|
|
2035
|
+
([defaultKey, referenceKey]) => {
|
|
2036
|
+
applyVersionToDefaultReferenceStyle(defaultKey, referenceKey);
|
|
2037
|
+
}
|
|
2038
|
+
);
|
|
1895
2039
|
function makeReferenceStyleProxy(referenceStyle) {
|
|
1896
2040
|
return new Proxy(referenceStyle, {
|
|
1897
2041
|
get(target, prop, receiver) {
|