@maptiler/client 1.0.2 → 1.1.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.
Files changed (120) hide show
  1. package/.github/workflows/npm-publish.yml +0 -1
  2. package/dist/maptiler-client.cjs +465 -21
  3. package/dist/maptiler-client.cjs.map +1 -1
  4. package/dist/maptiler-client.d.ts +395 -2
  5. package/dist/maptiler-client.min.mjs +1 -1
  6. package/dist/maptiler-client.mjs +461 -22
  7. package/dist/maptiler-client.mjs.map +1 -1
  8. package/dist/maptiler-client.umd.js +465 -21
  9. package/dist/maptiler-client.umd.js.map +1 -1
  10. package/dist/maptiler-client.umd.min.js +1 -1
  11. package/docs/assets/custom.css +118 -0
  12. package/docs/assets/highlight.css +10 -10
  13. package/docs/assets/main.js +56 -52
  14. package/docs/assets/search.js +1 -1
  15. package/docs/assets/style.css +23 -0
  16. package/docs/classes/{ClientConfig.html → config.ClientConfig.html} +34 -24
  17. package/docs/classes/{ServiceError.html → services_ServiceError.ServiceError.html} +26 -16
  18. package/docs/functions/language.getAutoLanguageGeocoding.html +60 -0
  19. package/docs/functions/services_simplify.default.html +65 -0
  20. package/docs/images/maptiler-logo-256.png +0 -0
  21. package/docs/index.html +118 -57
  22. package/docs/modules/config.html +71 -0
  23. package/docs/modules/language.html +71 -0
  24. package/docs/modules/services_ServiceError.html +61 -0
  25. package/docs/modules/services_coordinates.html +84 -0
  26. package/docs/modules/services_data.html +66 -0
  27. package/docs/modules/services_geocoding.html +76 -0
  28. package/docs/modules/services_geolocation.html +68 -0
  29. package/docs/modules/services_simplify.html +61 -0
  30. package/docs/modules/services_staticMaps.html +74 -0
  31. package/docs/modules.html +23 -83
  32. package/docs/types/config.FetchFunction.html +71 -0
  33. package/docs/types/language.LanguageGeocodingString.html +58 -0
  34. package/docs/types/services_coordinates.CoordinateExport.html +71 -0
  35. package/docs/types/services_coordinates.CoordinateGrid.html +69 -0
  36. package/docs/types/services_coordinates.CoordinateId.html +71 -0
  37. package/docs/types/services_coordinates.CoordinateSearch.html +93 -0
  38. package/docs/types/services_coordinates.CoordinateSearchResult.html +75 -0
  39. package/docs/types/services_coordinates.CoordinateTransformResult.html +76 -0
  40. package/docs/types/services_coordinates.CoordinateTransformation.html +89 -0
  41. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +83 -0
  42. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +85 -0
  43. package/docs/types/services_coordinates.XYZ.html +73 -0
  44. package/docs/types/services_data.GetDataOptions.html +64 -0
  45. package/docs/types/services_geocoding.Coordinates.html +60 -0
  46. package/docs/types/services_geocoding.FeatureHierarchy.html +71 -0
  47. package/docs/types/services_geocoding.GeocodingFeature.html +60 -0
  48. package/docs/types/services_geocoding.GeocodingOptions.html +79 -0
  49. package/docs/types/services_geocoding.GeocodingSearchResult.html +77 -0
  50. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +71 -0
  51. package/docs/types/services_geolocation.GeolocationInfoOptions.html +65 -0
  52. package/docs/types/services_geolocation.GeolocationResult.html +128 -0
  53. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +61 -0
  54. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +61 -0
  55. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +61 -0
  56. package/docs/types/{StaticMapBaseOptions.html → services_staticMaps.StaticMapBaseOptions.html} +26 -45
  57. package/docs/types/services_staticMaps.StaticMapMarker.html +61 -0
  58. package/docs/variables/config.config.html +58 -0
  59. package/docs/variables/{LanguageGeocoding.html → language.LanguageGeocoding.html} +20 -42
  60. package/docs/variables/services_coordinates.coordinates.html +110 -0
  61. package/docs/variables/services_data.data.html +80 -0
  62. package/docs/variables/{geocoding.html → services_geocoding.geocoding.html} +35 -53
  63. package/docs/variables/services_geolocation.geolocation.html +79 -0
  64. package/docs/variables/services_staticMaps.staticMaps.html +128 -0
  65. package/docsmd/README.md +143 -36
  66. package/docsmd/assets/custom.css +118 -0
  67. package/docsmd/classes/ClientConfig.md +5 -5
  68. package/docsmd/classes/MapStyleVariant.md +217 -0
  69. package/docsmd/classes/ReferenceMapStyle.md +169 -0
  70. package/docsmd/classes/ServiceError.md +3 -3
  71. package/examples/test-browser-umd.html +1 -1
  72. package/images/maptiler-logo-256.png +0 -0
  73. package/package.json +5 -5
  74. package/readme.md +65 -5
  75. package/src/index.ts +17 -0
  76. package/src/mapstyle.ts +841 -0
  77. package/src/services/staticMaps.ts +5 -4
  78. package/tsconfig.json +0 -1
  79. package/typedoc.css +118 -0
  80. package/typedoc.json +7 -3
  81. package/docs/types/AutomaticStaticMapOptions.html +0 -80
  82. package/docs/types/BoundedStaticMapOptions.html +0 -80
  83. package/docs/types/CenteredStaticMapOptions.html +0 -80
  84. package/docs/types/CoordinateExport.html +0 -85
  85. package/docs/types/CoordinateGrid.html +0 -83
  86. package/docs/types/CoordinateId.html +0 -85
  87. package/docs/types/CoordinateSearch.html +0 -107
  88. package/docs/types/CoordinateSearchResult.html +0 -89
  89. package/docs/types/CoordinateTransformResult.html +0 -90
  90. package/docs/types/CoordinateTransformation.html +0 -103
  91. package/docs/types/Coordinates.html +0 -78
  92. package/docs/types/CoordinatesSearchOptions.html +0 -97
  93. package/docs/types/CoordinatesTransformOptions.html +0 -99
  94. package/docs/types/FeatureHierarchy.html +0 -89
  95. package/docs/types/FetchFunction.html +0 -93
  96. package/docs/types/GeocodingFeature.html +0 -78
  97. package/docs/types/GeocodingOptions.html +0 -97
  98. package/docs/types/GeocodingSearchResult.html +0 -95
  99. package/docs/types/GeolocationInfoOptions.html +0 -87
  100. package/docs/types/GeolocationResult.html +0 -150
  101. package/docs/types/GetDataOptions.html +0 -87
  102. package/docs/types/LanguageGeocodingString.html +0 -80
  103. package/docs/types/ReverseGeocodingOptions.html +0 -89
  104. package/docs/types/StaticMapMarker.html +0 -80
  105. package/docs/types/XYZ.html +0 -87
  106. package/docs/variables/config.html +0 -80
  107. package/docs/variables/coordinates-1.html +0 -124
  108. package/docs/variables/data.html +0 -103
  109. package/docs/variables/geolocation.html +0 -101
  110. package/docs/variables/staticMaps.html +0 -147
  111. package/docsmd/images/JS-logo.svg +0 -4
  112. package/docsmd/images/TS-logo.svg +0 -6
  113. package/docsmd/images/maptiler-client-logo.afdesign +0 -0
  114. package/docsmd/images/maptiler-client-logo.svg +0 -75
  115. package/docsmd/images/maptiler-logo.svg +0 -23
  116. package/docsmd/images/screenshots/static-bounded-europe-1024.png +0 -0
  117. package/docsmd/images/screenshots/static-bounded-europe-2048.png +0 -0
  118. package/docsmd/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
  119. package/docsmd/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
  120. package/docsmd/images/screenshots/static-with-path.png +0 -0
@@ -17,7 +17,6 @@ jobs:
17
17
  node-version: 18
18
18
  registry-url: https://registry.npmjs.org/
19
19
  - run: npm ci
20
- - run: npm run prepare
21
20
  - run: npm test
22
21
  - run: npm publish
23
22
  env:
@@ -442,6 +442,445 @@ const data = {
442
442
  get
443
443
  };
444
444
 
445
+ class MapStyleVariant {
446
+ constructor(name, variantType, id, referenceStyle, description, imageURL) {
447
+ this.name = name;
448
+ this.variantType = variantType;
449
+ this.id = id;
450
+ this.referenceStyle = referenceStyle;
451
+ this.description = description;
452
+ this.imageURL = imageURL;
453
+ }
454
+ getName() {
455
+ return this.name;
456
+ }
457
+ getFullName() {
458
+ return `${this.referenceStyle.getName()} ${this.name}`;
459
+ }
460
+ getType() {
461
+ return this.variantType;
462
+ }
463
+ getId() {
464
+ return this.id;
465
+ }
466
+ getDescription() {
467
+ return this.description;
468
+ }
469
+ getReferenceStyle() {
470
+ return this.referenceStyle;
471
+ }
472
+ hasVariant(variantType) {
473
+ return this.referenceStyle.hasVariant(variantType);
474
+ }
475
+ getVariant(variantType) {
476
+ return this.referenceStyle.getVariant(variantType);
477
+ }
478
+ getVariants() {
479
+ return this.referenceStyle.getVariants().filter((v) => v !== this);
480
+ }
481
+ getImageURL() {
482
+ return this.imageURL;
483
+ }
484
+ }
485
+ class ReferenceMapStyle {
486
+ constructor(name, id) {
487
+ this.name = name;
488
+ this.id = id;
489
+ this.variants = {};
490
+ this.orderedVariants = [];
491
+ }
492
+ getName() {
493
+ return this.name;
494
+ }
495
+ getId() {
496
+ return this.id;
497
+ }
498
+ addVariant(v) {
499
+ this.variants[v.getType()] = v;
500
+ this.orderedVariants.push(v);
501
+ }
502
+ hasVariant(variantType) {
503
+ return variantType in this.variants;
504
+ }
505
+ getVariant(variantType) {
506
+ return variantType in this.variants ? this.variants[variantType] : this.orderedVariants[0];
507
+ }
508
+ getVariants() {
509
+ return Object.values(this.variants);
510
+ }
511
+ getDefaultVariant() {
512
+ return this.orderedVariants[0];
513
+ }
514
+ }
515
+ const mapStylePresetList = [
516
+ {
517
+ referenceStyleID: "STREETS",
518
+ name: "Streets",
519
+ description: "",
520
+ variants: [
521
+ {
522
+ id: "streets-v2",
523
+ name: "Default",
524
+ variantType: "DEFAULT",
525
+ description: "",
526
+ imageURL: ""
527
+ },
528
+ {
529
+ id: "streets-v2-dark",
530
+ name: "Dark",
531
+ variantType: "DARK",
532
+ description: "",
533
+ imageURL: ""
534
+ },
535
+ {
536
+ id: "streets-v2-light",
537
+ name: "Light",
538
+ variantType: "LIGHT",
539
+ description: "",
540
+ imageURL: ""
541
+ },
542
+ {
543
+ id: "streets-v2-pastel",
544
+ name: "Pastel",
545
+ variantType: "PASTEL",
546
+ description: "",
547
+ imageURL: ""
548
+ }
549
+ ]
550
+ },
551
+ {
552
+ referenceStyleID: "OUTDOOR",
553
+ name: "Outdoor",
554
+ description: "",
555
+ variants: [
556
+ {
557
+ id: "outdoor-v2",
558
+ name: "Default",
559
+ variantType: "DEFAULT",
560
+ description: "",
561
+ imageURL: ""
562
+ }
563
+ ]
564
+ },
565
+ {
566
+ referenceStyleID: "WINTER",
567
+ name: "Winter",
568
+ description: "",
569
+ variants: [
570
+ {
571
+ id: "winter-v2",
572
+ name: "Winter",
573
+ variantType: "DEFAULT",
574
+ description: "",
575
+ imageURL: ""
576
+ }
577
+ ]
578
+ },
579
+ {
580
+ referenceStyleID: "SATELLITE",
581
+ name: "Satellite",
582
+ description: "",
583
+ variants: [
584
+ {
585
+ id: "satellite",
586
+ name: "Default",
587
+ variantType: "DEFAULT",
588
+ description: "",
589
+ imageURL: ""
590
+ }
591
+ ]
592
+ },
593
+ {
594
+ referenceStyleID: "HYBRID",
595
+ name: "Hybrid",
596
+ description: "",
597
+ variants: [
598
+ {
599
+ id: "hybrid",
600
+ name: "Default",
601
+ variantType: "DEFAULT",
602
+ description: "",
603
+ imageURL: ""
604
+ }
605
+ ]
606
+ },
607
+ {
608
+ referenceStyleID: "BASIC",
609
+ name: "Basic",
610
+ description: "",
611
+ variants: [
612
+ {
613
+ id: "basic-v2",
614
+ name: "Default",
615
+ variantType: "DEFAULT",
616
+ description: "",
617
+ imageURL: ""
618
+ },
619
+ {
620
+ id: "basic-v2-dark",
621
+ name: "Dark",
622
+ variantType: "DARK",
623
+ description: "",
624
+ imageURL: ""
625
+ },
626
+ {
627
+ id: "basic-v2-light",
628
+ name: "Light",
629
+ variantType: "LIGHT",
630
+ description: "",
631
+ imageURL: ""
632
+ }
633
+ ]
634
+ },
635
+ {
636
+ referenceStyleID: "BRIGHT",
637
+ name: "Bright",
638
+ description: "",
639
+ variants: [
640
+ {
641
+ id: "bright-v2",
642
+ name: "Default",
643
+ variantType: "DEFAULT",
644
+ description: "",
645
+ imageURL: ""
646
+ },
647
+ {
648
+ id: "bright-v2-dark",
649
+ name: "Dark",
650
+ variantType: "DARK",
651
+ description: "",
652
+ imageURL: ""
653
+ },
654
+ {
655
+ id: "bright-v2-light",
656
+ name: "Light",
657
+ variantType: "LIGHT",
658
+ description: "",
659
+ imageURL: ""
660
+ },
661
+ {
662
+ id: "bright-v2-pastel",
663
+ name: "Pastel",
664
+ variantType: "PASTEL",
665
+ description: "",
666
+ imageURL: ""
667
+ }
668
+ ]
669
+ },
670
+ {
671
+ referenceStyleID: "OPENSTREETMAP",
672
+ name: "OpenStreetMap",
673
+ description: "",
674
+ variants: [
675
+ {
676
+ id: "openstreetmap",
677
+ name: "Default",
678
+ variantType: "DEFAULT",
679
+ description: "",
680
+ imageURL: ""
681
+ }
682
+ ]
683
+ },
684
+ {
685
+ referenceStyleID: "TOPO",
686
+ name: "Topo",
687
+ description: "",
688
+ variants: [
689
+ {
690
+ id: "topo-v2",
691
+ name: "Default",
692
+ variantType: "DEFAULT",
693
+ description: "",
694
+ imageURL: ""
695
+ },
696
+ {
697
+ id: "topo-v2-shiny",
698
+ name: "Shiny",
699
+ variantType: "SHINY",
700
+ description: "",
701
+ imageURL: ""
702
+ },
703
+ {
704
+ id: "topo-v2-pastel",
705
+ name: "Pastel",
706
+ variantType: "PASTEL",
707
+ description: "",
708
+ imageURL: ""
709
+ },
710
+ {
711
+ id: "topo-v2-topographique",
712
+ name: "Topographique",
713
+ variantType: "TOPOGRAPHIQUE",
714
+ description: "",
715
+ imageURL: ""
716
+ }
717
+ ]
718
+ },
719
+ {
720
+ referenceStyleID: "VOYAGER",
721
+ name: "Voyager",
722
+ description: "",
723
+ variants: [
724
+ {
725
+ id: "voyager-v2",
726
+ name: "Default",
727
+ variantType: "DEFAULT",
728
+ description: "",
729
+ imageURL: ""
730
+ },
731
+ {
732
+ id: "voyager-v2-darkmatter",
733
+ name: "Darkmatter",
734
+ variantType: "DARK",
735
+ description: "",
736
+ imageURL: ""
737
+ },
738
+ {
739
+ id: "voyager-v2-positron",
740
+ name: "Positron",
741
+ variantType: "LIGHT",
742
+ description: "",
743
+ imageURL: ""
744
+ },
745
+ {
746
+ id: "voyager-v2-vintage",
747
+ name: "Vintage",
748
+ variantType: "VINTAGE",
749
+ description: "",
750
+ imageURL: ""
751
+ }
752
+ ]
753
+ },
754
+ {
755
+ referenceStyleID: "TONER",
756
+ name: "Toner",
757
+ description: "",
758
+ variants: [
759
+ {
760
+ id: "toner-v2",
761
+ name: "Default",
762
+ variantType: "DEFAULT",
763
+ description: "",
764
+ imageURL: ""
765
+ },
766
+ {
767
+ id: "toner-v2-background",
768
+ name: "Background",
769
+ variantType: "BACKGROUND",
770
+ description: "",
771
+ imageURL: ""
772
+ },
773
+ {
774
+ id: "toner-v2-lite",
775
+ name: "Lite",
776
+ variantType: "LITE",
777
+ description: "",
778
+ imageURL: ""
779
+ },
780
+ {
781
+ id: "toner-v2-lines",
782
+ name: "Lines",
783
+ variantType: "LINES",
784
+ description: "",
785
+ imageURL: ""
786
+ }
787
+ ]
788
+ },
789
+ {
790
+ referenceStyleID: "STAGE",
791
+ name: "Stage",
792
+ description: "",
793
+ variants: [
794
+ {
795
+ id: "stage",
796
+ name: "Default",
797
+ variantType: "DEFAULT",
798
+ description: "",
799
+ imageURL: ""
800
+ },
801
+ {
802
+ id: "stage-dark",
803
+ name: "Dark",
804
+ variantType: "DARK",
805
+ description: "",
806
+ imageURL: ""
807
+ },
808
+ {
809
+ id: "stage-light",
810
+ name: "Light",
811
+ variantType: "LIGHT",
812
+ description: "",
813
+ imageURL: ""
814
+ }
815
+ ]
816
+ },
817
+ {
818
+ referenceStyleID: "OCEAN",
819
+ name: "Ocean",
820
+ description: "",
821
+ variants: [
822
+ {
823
+ id: "ocean",
824
+ name: "Default",
825
+ variantType: "DEFAULT",
826
+ description: "",
827
+ imageURL: ""
828
+ }
829
+ ]
830
+ }
831
+ ];
832
+ function makeReferenceStyleProxy(referenceStyle) {
833
+ return new Proxy(referenceStyle, {
834
+ get(target, prop, receiver) {
835
+ if (target.hasVariant(prop)) {
836
+ return target.getVariant(prop);
837
+ }
838
+ if (prop.toString().toUpperCase() === prop) {
839
+ return referenceStyle.getDefaultVariant();
840
+ }
841
+ return Reflect.get(target, prop, receiver);
842
+ }
843
+ });
844
+ }
845
+ function buildMapStyles() {
846
+ const mapStyle = {};
847
+ for (let i = 0; i < mapStylePresetList.length; i += 1) {
848
+ const refStyleInfo = mapStylePresetList[i];
849
+ const refStyle = makeReferenceStyleProxy(
850
+ new ReferenceMapStyle(refStyleInfo.name, refStyleInfo.referenceStyleID)
851
+ );
852
+ for (let j = 0; j < refStyleInfo.variants.length; j += 1) {
853
+ const variantInfo = refStyleInfo.variants[j];
854
+ const variant = new MapStyleVariant(
855
+ variantInfo.name,
856
+ variantInfo.variantType,
857
+ variantInfo.id,
858
+ refStyle,
859
+ variantInfo.description,
860
+ variantInfo.imageURL
861
+ );
862
+ refStyle.addVariant(variant);
863
+ }
864
+ mapStyle[refStyleInfo.referenceStyleID] = refStyle;
865
+ }
866
+ return mapStyle;
867
+ }
868
+ function styleToStyle(style) {
869
+ if (!style) {
870
+ return MapStyle[mapStylePresetList[0].referenceStyleID].getDefaultVariant().getId();
871
+ }
872
+ if (typeof style === "string" || style instanceof String) {
873
+ return style.trim().toLowerCase();
874
+ }
875
+ if (style instanceof MapStyleVariant) {
876
+ return style.getId();
877
+ }
878
+ if (style instanceof ReferenceMapStyle) {
879
+ return style.getDefaultVariant().getId();
880
+ }
881
+ }
882
+ const MapStyle = buildMapStyles();
883
+
445
884
  function getSqSegDist(p, p1, p2) {
446
885
  let x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
447
886
  if (dx !== 0 || dy !== 0) {
@@ -512,12 +951,12 @@ function simplifyAndStringify(path, maxNbChar = 3e3) {
512
951
  return str;
513
952
  }
514
953
  function centered(center, zoom, options = {}) {
515
- var _a, _b, _c, _d, _e, _f;
516
- const style = (_a = options.style) != null ? _a : defaults.mapStyle;
954
+ var _a, _b, _c, _d, _e;
955
+ const style = styleToStyle(options.style);
517
956
  const scale = options.hiDPI ? "@2x" : "";
518
- const format = (_b = options.format) != null ? _b : "png";
519
- let width = ~~((_c = options.width) != null ? _c : 1024);
520
- let height = ~~((_d = options.height) != null ? _d : 1024);
957
+ const format = (_a = options.format) != null ? _a : "png";
958
+ let width = ~~((_b = options.width) != null ? _b : 1024);
959
+ let height = ~~((_c = options.height) != null ? _c : 1024);
521
960
  if (options.hiDPI) {
522
961
  width = ~~(width / 2);
523
962
  height = ~~(height / 2);
@@ -547,7 +986,7 @@ function centered(center, zoom, options = {}) {
547
986
  }
548
987
  if ("path" in options) {
549
988
  let pathStr = "";
550
- pathStr += `fill:${(_e = options.pathFillColor) != null ? _e : "none"}|`;
989
+ pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
551
990
  if ("pathStrokeColor" in options) {
552
991
  pathStr += `stroke:${options.pathStrokeColor}|`;
553
992
  }
@@ -558,16 +997,16 @@ function centered(center, zoom, options = {}) {
558
997
  pathStr += simplifyAndStringify(options.path);
559
998
  endpoint.searchParams.set("path", pathStr);
560
999
  }
561
- endpoint.searchParams.set("key", (_f = options.apiKey) != null ? _f : config.apiKey);
1000
+ endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
562
1001
  return endpoint.toString();
563
1002
  }
564
1003
  function bounded(boundingBox, options = {}) {
565
- var _a, _b, _c, _d, _e, _f;
566
- const style = (_a = options.style) != null ? _a : defaults.mapStyle;
1004
+ var _a, _b, _c, _d, _e;
1005
+ const style = styleToStyle(options.style);
567
1006
  const scale = options.hiDPI ? "@2x" : "";
568
- const format = (_b = options.format) != null ? _b : "png";
569
- let width = ~~((_c = options.width) != null ? _c : 1024);
570
- let height = ~~((_d = options.height) != null ? _d : 1024);
1007
+ const format = (_a = options.format) != null ? _a : "png";
1008
+ let width = ~~((_b = options.width) != null ? _b : 1024);
1009
+ let height = ~~((_c = options.height) != null ? _c : 1024);
571
1010
  if (options.hiDPI) {
572
1011
  width = ~~(width / 2);
573
1012
  height = ~~(height / 2);
@@ -600,7 +1039,7 @@ function bounded(boundingBox, options = {}) {
600
1039
  }
601
1040
  if ("path" in options) {
602
1041
  let pathStr = "";
603
- pathStr += `fill:${(_e = options.pathFillColor) != null ? _e : "none"}|`;
1042
+ pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
604
1043
  if ("pathStrokeColor" in options) {
605
1044
  pathStr += `stroke:${options.pathStrokeColor}|`;
606
1045
  }
@@ -611,21 +1050,21 @@ function bounded(boundingBox, options = {}) {
611
1050
  pathStr += simplifyAndStringify(options.path);
612
1051
  endpoint.searchParams.set("path", pathStr);
613
1052
  }
614
- endpoint.searchParams.set("key", (_f = options.apiKey) != null ? _f : config.apiKey);
1053
+ endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
615
1054
  return endpoint.toString();
616
1055
  }
617
1056
  function automatic(options = {}) {
618
- var _a, _b, _c, _d, _e, _f;
1057
+ var _a, _b, _c, _d, _e;
619
1058
  if (!("markers" in options) && !("path" in options)) {
620
1059
  throw new Error(
621
1060
  "Automatic static maps require markers and/or path to be created."
622
1061
  );
623
1062
  }
624
- const style = (_a = options.style) != null ? _a : defaults.mapStyle;
1063
+ const style = styleToStyle(options.style);
625
1064
  const scale = options.hiDPI ? "@2x" : "";
626
- const format = (_b = options.format) != null ? _b : "png";
627
- let width = ~~((_c = options.width) != null ? _c : 1024);
628
- let height = ~~((_d = options.height) != null ? _d : 1024);
1065
+ const format = (_a = options.format) != null ? _a : "png";
1066
+ let width = ~~((_b = options.width) != null ? _b : 1024);
1067
+ let height = ~~((_c = options.height) != null ? _c : 1024);
629
1068
  if (options.hiDPI) {
630
1069
  width = ~~(width / 2);
631
1070
  height = ~~(height / 2);
@@ -660,7 +1099,7 @@ function automatic(options = {}) {
660
1099
  }
661
1100
  if ("path" in options) {
662
1101
  let pathStr = "";
663
- pathStr += `fill:${(_e = options.pathFillColor) != null ? _e : "none"}|`;
1102
+ pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
664
1103
  if ("pathStrokeColor" in options) {
665
1104
  pathStr += `stroke:${options.pathStrokeColor}|`;
666
1105
  }
@@ -671,7 +1110,7 @@ function automatic(options = {}) {
671
1110
  pathStr += simplifyAndStringify(options.path);
672
1111
  endpoint.searchParams.set("path", pathStr);
673
1112
  }
674
- endpoint.searchParams.set("key", (_f = options.apiKey) != null ? _f : config.apiKey);
1113
+ endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
675
1114
  return endpoint.toString();
676
1115
  }
677
1116
  const staticMaps = {
@@ -682,11 +1121,16 @@ const staticMaps = {
682
1121
 
683
1122
  exports.ClientConfig = ClientConfig;
684
1123
  exports.LanguageGeocoding = LanguageGeocoding;
1124
+ exports.MapStyle = MapStyle;
1125
+ exports.MapStyleVariant = MapStyleVariant;
1126
+ exports.ReferenceMapStyle = ReferenceMapStyle;
685
1127
  exports.ServiceError = ServiceError;
686
1128
  exports.config = config;
687
1129
  exports.coordinates = coordinates;
688
1130
  exports.data = data;
689
1131
  exports.geocoding = geocoding;
690
1132
  exports.geolocation = geolocation;
1133
+ exports.mapStylePresetList = mapStylePresetList;
691
1134
  exports.staticMaps = staticMaps;
1135
+ exports.styleToStyle = styleToStyle;
692
1136
  //# sourceMappingURL=maptiler-client.cjs.map