@maptiler/client 2.3.1 → 2.3.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # MapTiler Client Changelog
2
2
 
3
+ ## 2.3.2
4
+ ### New Features
5
+ None
6
+
7
+ ### Bug Fixes
8
+ None
9
+
10
+ ### Others
11
+ Added deprecation warning and field for styles that will be deprecated in the future.
12
+
3
13
  ## 2.3.1
4
14
  ### New Features
5
15
  None
@@ -1283,13 +1283,14 @@ function expandMapStyle(style) {
1283
1283
  return expandedStyle;
1284
1284
  }
1285
1285
  class MapStyleVariant {
1286
- constructor(name, variantType, id, referenceStyle, description, imageURL) {
1286
+ constructor(name, variantType, id, referenceStyle, description, imageURL, deprecated = false) {
1287
1287
  this.name = name;
1288
1288
  this.variantType = variantType;
1289
1289
  this.id = id;
1290
1290
  this.referenceStyle = referenceStyle;
1291
1291
  this.description = description;
1292
1292
  this.imageURL = imageURL;
1293
+ this.deprecated = deprecated;
1293
1294
  }
1294
1295
  /**
1295
1296
  * Get the human-friendly name
@@ -1344,14 +1345,19 @@ class MapStyleVariant {
1344
1345
  * @returns
1345
1346
  */
1346
1347
  getVariant(variantType) {
1347
- return this.referenceStyle.getVariant(variantType);
1348
+ const variant = this.referenceStyle.getVariant(variantType);
1349
+ this.warnIfDeprecated(variant);
1350
+ return variant;
1348
1351
  }
1349
1352
  /**
1350
1353
  * Get all the variants for _this_ variants, except _this_ current one
1351
1354
  * @returns
1352
1355
  */
1353
1356
  getVariants() {
1354
- return this.referenceStyle.getVariants().filter((v) => v !== this);
1357
+ return this.referenceStyle.getVariants().filter((v) => v !== this).map((v) => {
1358
+ this.warnIfDeprecated(v);
1359
+ return v;
1360
+ });
1355
1361
  }
1356
1362
  /**
1357
1363
  * Get the image URL that represent _this_ variant
@@ -1367,6 +1373,15 @@ class MapStyleVariant {
1367
1373
  getExpandedStyleURL() {
1368
1374
  return expandMapStyle(this.getId());
1369
1375
  }
1376
+ warnIfDeprecated(variant = this) {
1377
+ if (!variant.deprecated)
1378
+ return variant;
1379
+ const name = variant.getFullName();
1380
+ console.warn(
1381
+ `Style "${name}" is deprecated and will be removed in a future version.`
1382
+ );
1383
+ return variant;
1384
+ }
1370
1385
  }
1371
1386
  class ReferenceMapStyle {
1372
1387
  constructor(name, id) {
@@ -1432,7 +1447,7 @@ class ReferenceMapStyle {
1432
1447
  * @returns
1433
1448
  */
1434
1449
  getDefaultVariant() {
1435
- return this.orderedVariants[0];
1450
+ return this.orderedVariants[0].warnIfDeprecated();
1436
1451
  }
1437
1452
  }
1438
1453
  const mapStylePresetList = [
@@ -1541,6 +1556,7 @@ const mapStylePresetList = [
1541
1556
  variants: [
1542
1557
  {
1543
1558
  id: "hybrid",
1559
+ deprecated: true,
1544
1560
  name: "Default",
1545
1561
  variantType: "DEFAULT",
1546
1562
  description: "",
@@ -1647,6 +1663,7 @@ const mapStylePresetList = [
1647
1663
  {
1648
1664
  id: "topo-v2-shiny",
1649
1665
  name: "Shiny",
1666
+ deprecated: true,
1650
1667
  variantType: "SHINY",
1651
1668
  description: "",
1652
1669
  imageURL: ""
@@ -1675,6 +1692,7 @@ const mapStylePresetList = [
1675
1692
  {
1676
1693
  id: "voyager-v2",
1677
1694
  name: "Default",
1695
+ deprecated: true,
1678
1696
  variantType: "DEFAULT",
1679
1697
  description: "",
1680
1698
  imageURL: ""
@@ -1682,6 +1700,7 @@ const mapStylePresetList = [
1682
1700
  {
1683
1701
  id: "voyager-v2-darkmatter",
1684
1702
  name: "Darkmatter",
1703
+ deprecated: true,
1685
1704
  variantType: "DARK",
1686
1705
  description: "",
1687
1706
  imageURL: ""
@@ -1689,6 +1708,7 @@ const mapStylePresetList = [
1689
1708
  {
1690
1709
  id: "voyager-v2-positron",
1691
1710
  name: "Positron",
1711
+ deprecated: true,
1692
1712
  variantType: "LIGHT",
1693
1713
  description: "",
1694
1714
  imageURL: ""
@@ -1696,6 +1716,7 @@ const mapStylePresetList = [
1696
1716
  {
1697
1717
  id: "voyager-v2-vintage",
1698
1718
  name: "Vintage",
1719
+ deprecated: true,
1699
1720
  variantType: "VINTAGE",
1700
1721
  description: "",
1701
1722
  imageURL: ""
@@ -1718,6 +1739,7 @@ const mapStylePresetList = [
1718
1739
  id: "toner-v2-background",
1719
1740
  name: "Background",
1720
1741
  variantType: "BACKGROUND",
1742
+ deprecated: true,
1721
1743
  description: "",
1722
1744
  imageURL: ""
1723
1745
  },
@@ -1732,6 +1754,7 @@ const mapStylePresetList = [
1732
1754
  id: "toner-v2-lines",
1733
1755
  name: "Lines",
1734
1756
  variantType: "LINES",
1757
+ deprecated: true,
1735
1758
  description: "",
1736
1759
  imageURL: ""
1737
1760
  }
@@ -1873,7 +1896,8 @@ function makeReferenceStyleProxy(referenceStyle) {
1873
1896
  if (prop.toString().toUpperCase() === prop) {
1874
1897
  return referenceStyle.getDefaultVariant();
1875
1898
  }
1876
- return Reflect.get(target, prop, receiver);
1899
+ const style = Reflect.get(target, prop, receiver);
1900
+ return style;
1877
1901
  }
1878
1902
  });
1879
1903
  }
@@ -1896,8 +1920,10 @@ function buildMapStyles() {
1896
1920
  refStyle,
1897
1921
  // referenceStyle
1898
1922
  variantInfo.description,
1899
- variantInfo.imageURL
1923
+ variantInfo.imageURL,
1900
1924
  // imageURL
1925
+ variantInfo.deprecated
1926
+ // deprecated
1901
1927
  );
1902
1928
  refStyle.addVariant(variant);
1903
1929
  }