@maptiler/sdk 3.0.0-rc.4 → 3.0.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 (52) hide show
  1. package/dist/maptiler-sdk.css +2 -2
  2. package/dist/maptiler-sdk.d.ts +1 -0
  3. package/dist/maptiler-sdk.mjs +222 -255
  4. package/dist/maptiler-sdk.mjs.map +1 -1
  5. package/dist/src/MLAdapters/AttributionControl.d.ts +0 -1
  6. package/dist/src/MLAdapters/BoxZoomHandler.d.ts +0 -1
  7. package/dist/src/MLAdapters/CanvasSource.d.ts +0 -1
  8. package/dist/src/MLAdapters/CooperativeGesturesHandler.d.ts +0 -1
  9. package/dist/src/MLAdapters/FullscreenControl.d.ts +0 -1
  10. package/dist/src/MLAdapters/GeoJSONSource.d.ts +0 -1
  11. package/dist/src/MLAdapters/GeolocateControl.d.ts +0 -1
  12. package/dist/src/MLAdapters/ImageSource.d.ts +0 -1
  13. package/dist/src/MLAdapters/KeyboardHandler.d.ts +0 -1
  14. package/dist/src/MLAdapters/LogoControl.d.ts +0 -1
  15. package/dist/src/MLAdapters/MapMouseEvent.d.ts +0 -1
  16. package/dist/src/MLAdapters/MapTouchEvent.d.ts +0 -1
  17. package/dist/src/MLAdapters/MapWheelEvent.d.ts +0 -1
  18. package/dist/src/MLAdapters/Marker.d.ts +0 -1
  19. package/dist/src/MLAdapters/NavigationControl.d.ts +0 -1
  20. package/dist/src/MLAdapters/Popup.d.ts +0 -1
  21. package/dist/src/MLAdapters/RasterDEMTileSource.d.ts +0 -1
  22. package/dist/src/MLAdapters/RasterTileSource.d.ts +0 -1
  23. package/dist/src/MLAdapters/ScaleControl.d.ts +0 -1
  24. package/dist/src/MLAdapters/ScrollZoomHandler.d.ts +0 -1
  25. package/dist/src/MLAdapters/Style.d.ts +0 -1
  26. package/dist/src/MLAdapters/TerrainControl.d.ts +0 -1
  27. package/dist/src/MLAdapters/TwoFingersTouchPitchHandler.d.ts +0 -1
  28. package/dist/src/MLAdapters/VectorTileSource.d.ts +0 -1
  29. package/dist/src/MLAdapters/VideoSource.d.ts +0 -1
  30. package/dist/src/Map.d.ts +4 -5
  31. package/dist/src/MaptilerGeolocateControl.d.ts +1 -1
  32. package/dist/src/MaptilerLogoControl.d.ts +0 -1
  33. package/dist/src/MaptilerNavigationControl.d.ts +0 -1
  34. package/dist/src/MaptilerProjectionControl.d.ts +0 -1
  35. package/dist/src/MaptilerTerrainControl.d.ts +0 -1
  36. package/dist/src/Minimap.d.ts +0 -1
  37. package/dist/src/Telemetry.d.ts +0 -1
  38. package/dist/src/caching.d.ts +0 -1
  39. package/dist/src/config.d.ts +0 -1
  40. package/dist/src/helpers/index.d.ts +0 -1
  41. package/dist/src/helpers/screenshot.d.ts +0 -1
  42. package/dist/src/helpers/stylehelper.d.ts +0 -1
  43. package/dist/src/helpers/vectorlayerhelpers.d.ts +0 -1
  44. package/dist/src/index.d.ts +1 -2
  45. package/dist/src/language.d.ts +0 -1
  46. package/dist/src/mapstyle.d.ts +0 -1
  47. package/dist/src/tools.d.ts +0 -1
  48. package/package.json +16 -16
  49. package/readme.md +35 -2
  50. package/vite.config-dev.ts +27 -0
  51. package/vite.config-umd.ts +4 -10
  52. /package/{vite.config.ts → vite.config-test.ts} +0 -0
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class AttributionControl extends maplibregl.AttributionControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class BoxZoomHandler extends maplibregl.BoxZoomHandler {
5
4
  constructor(map: SDKMap | MapMLGL, options: {
6
5
  clickTolerance: number;
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class CanvasSource extends maplibregl.CanvasSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, GestureOptions, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class CooperativeGesturesHandler extends maplibregl.CooperativeGesturesHandler {
5
4
  constructor(map: SDKMap | MapMLGL, options: GestureOptions);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class FullscreenControl extends maplibregl.FullscreenControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class GeoJSONSource extends maplibregl.GeoJSONSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class GeolocateControl extends maplibregl.GeolocateControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class ImageSource extends maplibregl.ImageSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class KeyboardHandler extends maplibregl.KeyboardHandler {
5
4
  constructor(map: SDKMap | MapMLGL);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class LogoControl extends maplibregl.LogoControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class MapMouseEvent extends maplibregl.MapMouseEvent {
5
4
  constructor(type: string, map: SDKMap | MapMLGL, originalEvent: MouseEvent, data?: any);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class MapTouchEvent extends maplibregl.MapTouchEvent {
5
4
  constructor(type: string, map: SDKMap | MapMLGL, originalEvent: TouchEvent);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class MapWheelEvent extends maplibregl.MapWheelEvent {
5
4
  constructor(type: string, map: SDKMap | MapMLGL, originalEvent: WheelEvent);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class Marker extends maplibregl.Marker {
5
4
  addTo(map: SDKMap | MapMLGL): this;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class NavigationControl extends maplibregl.NavigationControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class Popup extends maplibregl.Popup {
5
4
  addTo(map: SDKMap | MapMLGL): this;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class RasterDEMTileSource extends maplibregl.RasterDEMTileSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class RasterTileSource extends maplibregl.RasterTileSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class ScaleControl extends maplibregl.ScaleControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class ScrollZoomHandler extends maplibregl.ScrollZoomHandler {
5
4
  constructor(map: SDKMap | MapMLGL, triggerRenderFrame: () => void);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, StyleOptions } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class Style extends maplibregl.Style {
5
4
  constructor(map: SDKMap, options?: StyleOptions);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class TerrainControl extends maplibregl.TerrainControl {
5
4
  onAdd(map: SDKMap | MapMLGL): HTMLElement;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class TwoFingersTouchPitchHandler extends maplibregl.TwoFingersTouchPitchHandler {
5
4
  constructor(map: SDKMap | MapMLGL);
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class VectorTileSource extends maplibregl.VectorTileSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, Map as MapMLGL } from 'maplibre-gl';
2
2
  import { Map as SDKMap } from '../Map';
3
-
4
3
  export declare class VideoSource extends maplibregl.VideoSource {
5
4
  onAdd(map: SDKMap | MapMLGL): void;
6
5
  }
package/dist/src/Map.d.ts CHANGED
@@ -4,7 +4,6 @@ import { SdkConfig } from './config';
4
4
  import { LanguageInfo } from './language';
5
5
  import { MinimapOptionsInput } from './Minimap';
6
6
  import { Telemetry } from './Telemetry';
7
-
8
7
  export type LoadWithTerrainEvent = {
9
8
  type: "loadWithTerrain";
10
9
  target: Map;
@@ -381,13 +380,13 @@ export declare class Map extends maplibregl.Map {
381
380
  */
382
381
  isGlobeProjection(): boolean;
383
382
  /**
384
- * Uses the globe projection. Animated by default, it can be disabled
383
+ * Activate the globe projection.
385
384
  */
386
- enableGlobeProjection(animate?: boolean): void;
385
+ enableGlobeProjection(): void;
387
386
  /**
388
- * Uses the Mercator projection. Animated by default, it can be disabled
387
+ * Activate the mercator projection.
389
388
  */
390
- enableMercatorProjection(animate?: boolean): void;
389
+ enableMercatorProjection(): void;
391
390
  /**
392
391
  * Returns `true` is the language was ever updated, meaning changed
393
392
  * from what is delivered in the style.
@@ -1,5 +1,4 @@
1
1
  import { GeolocateControl } from './MLAdapters/GeolocateControl';
2
-
3
2
  /**
4
3
  * The MaptilerGeolocateControl is an extension of the original GeolocateControl
5
4
  * with a few changes. In this version, the active mode persists as long as the
@@ -18,4 +17,5 @@ export declare class MaptilerGeolocateControl extends GeolocateControl {
18
17
  _finishSetupUI: (supported: boolean) => void;
19
18
  _updateCircleRadius(): void;
20
19
  _onZoom: () => void;
20
+ _setErrorState(): void;
21
21
  }
@@ -1,7 +1,6 @@
1
1
  import { LogoControlOptions as LogoControlOptionsML } from 'maplibre-gl';
2
2
  import { LogoControl } from './MLAdapters/LogoControl';
3
3
  import { Map as SDKMap } from './Map';
4
-
5
4
  type LogoControlOptions = LogoControlOptionsML & {
6
5
  logoURL?: string;
7
6
  linkURL?: string;
@@ -1,6 +1,5 @@
1
1
  import { NavigationControlOptions } from 'maplibre-gl';
2
2
  import { NavigationControl } from './MLAdapters/NavigationControl';
3
-
4
3
  type HTMLButtonElementPlus = HTMLButtonElement & {
5
4
  clickFunction: (e?: Event) => unknown;
6
5
  };
@@ -1,6 +1,5 @@
1
1
  import { Map as SDKMap } from './Map';
2
2
  import { IControl } from 'maplibre-gl';
3
-
4
3
  /**
5
4
  * A `MaptilerProjectionControl` control adds a button to switch from Mercator to Globe projection.
6
5
  */
@@ -1,6 +1,5 @@
1
1
  import { Map as SDKMap } from './Map';
2
2
  import { IControl } from 'maplibre-gl';
3
-
4
3
  /**
5
4
  * A `MaptilerTerrainControl` control adds a button to turn terrain on and off
6
5
  * by triggering the terrain logic that is already deployed in the Map object.
@@ -1,7 +1,6 @@
1
1
  import { Map as SDKMap, MapOptions } from './Map';
2
2
  import { ControlPosition, CustomLayerInterface, FillLayerSpecification, FilterSpecification, IControl, LayerSpecification, LineLayerSpecification, SourceSpecification, StyleOptions, StyleSetterOptions, StyleSpecification, StyleSwapOptions } from 'maplibre-gl';
3
3
  import { MapStyleVariant, ReferenceMapStyle } from '@maptiler/client';
4
-
5
4
  export interface ParentRect {
6
5
  lineLayout: LineLayerSpecification["layout"];
7
6
  linePaint: LineLayerSpecification["paint"];
@@ -1,5 +1,4 @@
1
1
  import { Map as MapSDK } from './Map';
2
-
3
2
  /**
4
3
  * A Telemetry instance sends some usage and merics to a dedicated endpoint at MapTiler Cloud.
5
4
  */
@@ -1,5 +1,4 @@
1
1
  import { ResourceType } from 'maplibre-gl';
2
-
3
2
  export declare const CACHE_API_AVAILABLE: boolean;
4
3
  export declare function localCacheTransformRequest(reqUrl: URL, resourceType?: ResourceType): string;
5
4
  export declare function registerLocalCacheProtocol(): void;
@@ -2,7 +2,6 @@ import { default as EventEmitter } from 'events';
2
2
  import { LanguageInfo } from './language';
3
3
  import { FetchFunction } from '@maptiler/client';
4
4
  import { Unit } from './unit';
5
-
6
5
  export declare const MAPTILER_SESSION_ID: string;
7
6
  /**
8
7
  * Configuration class for the SDK
@@ -1,6 +1,5 @@
1
1
  import { takeScreenshot } from './screenshot';
2
2
  import { addPolyline, addPolygon, addPoint, addHeatmap } from './vectorlayerhelpers';
3
-
4
3
  export type { ZoomStringValues, ZoomNumberValues, PropertyValues, CommonShapeLayerOptions, PolylineLayerOptions, PolygonLayerOptions, PointLayerOptions, HeatmapLayerOptions, } from './vectorlayerhelpers';
5
4
  /**
6
5
  * Helpers are a set of functions to facilitate the creation of sources and layers
@@ -1,5 +1,4 @@
1
1
  import { Map as MapSDK } from '../Map';
2
-
3
2
  /**
4
3
  * Takes a screenshot (PNG file) of the curent map view.
5
4
  * Depending on the options, this function can automatically trigger a download of te file.
@@ -1,7 +1,6 @@
1
1
  import { DataDrivenPropertyValueSpecification, ExpressionSpecification } from 'maplibre-gl';
2
2
  import { ColorRamp } from '../colorramp';
3
3
  import { DataDrivenStyle, PropertyValues, ZoomNumberValues, ZoomStringValues } from './vectorlayerhelpers';
4
-
5
4
  export type ColorPalette = [string, string, string, string];
6
5
  export declare const colorPalettes: Array<ColorPalette>;
7
6
  export declare function getRandomColor(): string;
@@ -1,7 +1,6 @@
1
1
  import { FeatureCollection } from 'geojson';
2
2
  import { Map as SDKMap } from '../Map';
3
3
  import { ColorRamp } from '../colorramp';
4
-
5
4
  /**
6
5
  * Array of string values that depend on zoom level
7
6
  */
@@ -1,5 +1,4 @@
1
1
  import { default as maplibregl } from 'maplibre-gl';
2
-
3
2
  export type * from 'maplibre-gl';
4
3
  /**
5
4
  * Get the version of MapTiler SDK
@@ -84,7 +83,7 @@ export { type AutomaticStaticMapOptions, type BoundedStaticMapOptions, type Buff
84
83
  export { getWebGLSupportError } from './tools';
85
84
  export { config, SdkConfig } from './config';
86
85
  export * from './language';
87
- export { type Unit } from './unit';
86
+ export type { Unit } from './unit';
88
87
  export * from './Minimap';
89
88
  export * from './converters';
90
89
  export * from './colorramp';
@@ -1,5 +1,4 @@
1
1
  import { LanguageInfo } from '@maptiler/client';
2
-
3
2
  declare const Language: {
4
3
  readonly ALBANIAN: LanguageInfo;
5
4
  readonly AMHARIC: LanguageInfo;
@@ -1,5 +1,4 @@
1
1
  import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
2
-
3
2
  export declare function styleToStyle(style: string | ReferenceMapStyle | MapStyleVariant | maplibregl.StyleSpecification | null | undefined): {
4
3
  style: string | maplibregl.StyleSpecification;
5
4
  requiresUrlMonitoring: boolean;
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
2
2
  import { Map as MapSDK } from './Map';
3
-
4
3
  export declare function enableRTL(): void;
5
4
  export declare function bindAll(fns: Array<string>, context: any): void;
6
5
  export declare function DOMcreate<K extends keyof HTMLElementTagNameMap>(tagName: K, className?: string, container?: HTMLElement): HTMLElementTagNameMap[K];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.0.0-rc.4",
3
+ "version": "3.0.0",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "module": "dist/maptiler-sdk.mjs",
6
6
  "types": "dist/maptiler-sdk.d.ts",
@@ -37,35 +37,35 @@
37
37
  "biome": "biome check --max-diagnostics=1000",
38
38
  "biome:fix": "npx @biomejs/biome check --max-diagnostics=1000 --write",
39
39
  "doc": "rm -rf docs/* && typedoc --out docs && cp -r images docs/",
40
- "test": "vitest run",
41
- "build-css": "node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css",
40
+ "test": "vitest run -c vite.config-test.ts",
41
+ "build-css": "mkdir -p dist build && node scripts/replace-path-with-content.js src/style/style_template.css dist/tmp_maptiler-sdk.css && cat node_modules/maplibre-gl/dist/maplibre-gl.css dist/tmp_maptiler-sdk.css > dist/maptiler-sdk.css && rm dist/tmp_maptiler-sdk.css && cp dist/maptiler-sdk.css build/maptiler-sdk.css",
42
42
  "build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts",
43
43
  "build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts",
44
44
  "build": "npm run build-es; npm run build-umd; npm run build-css",
45
45
  "make": "npm run biome:fix && npm run build",
46
+ "dev": "concurrently \"vite -c vite.config-dev.ts\" \"npm run dev-umd\"",
46
47
  "dev-umd": "npm run build-css && tsc && NODE_ENV=dev vite build -w -c vite.config-umd.ts",
47
- "help": "vite build --help"
48
+ "ncu": "npx npm-check-updates"
48
49
  },
49
50
  "author": "MapTiler",
50
51
  "devDependencies": {
51
- "@biomejs/biome": "1.8.3",
52
- "@types/uuid": "^9.0.2",
52
+ "@biomejs/biome": "1.9.4",
53
+ "@types/uuid": "^10.0.0",
53
54
  "@types/xmldom": "^0.1.31",
54
55
  "@xmldom/xmldom": "^0.8.10",
55
- "serve": "^14.2.0",
56
- "terser": "^5.17.1",
57
- "typedoc": "^0.24.8",
58
- "typescript": "^5.1.6",
59
- "vite": "^5.3.4",
60
- "vite-plugin-dts": "^4.0.0-beta.0",
61
- "vitest": "^0.34.2"
56
+ "concurrently": "^9.1.2",
57
+ "typedoc": "^0.27.6",
58
+ "typescript": "^5.7.2",
59
+ "vite": "^6.0.7",
60
+ "vite-plugin-dts": "^4.4.0",
61
+ "vitest": "^2.1.8"
62
62
  },
63
63
  "dependencies": {
64
64
  "@maplibre/maplibre-gl-style-spec": "^22.0.1",
65
65
  "@maptiler/client": "^2.2.0",
66
66
  "events": "^3.3.0",
67
- "js-base64": "^3.7.4",
68
- "maplibre-gl": "^5.0.0-pre.9",
69
- "uuid": "^9.0.0"
67
+ "js-base64": "^3.7.7",
68
+ "maplibre-gl": "^5.0.0",
69
+ "uuid": "^11.0.4"
70
70
  }
71
71
  }
package/readme.md CHANGED
@@ -136,7 +136,7 @@ The SDK hosted on our CDN is bundled as *[Universal Module Definition](https://g
136
136
  <body>
137
137
  <div id="map-container"></div>
138
138
 
139
- <script src ="dist/maptiler-sdk.umd.js"></script>
139
+ <script src ="dist/maptiler-sdk.umd.min.js"></script>
140
140
 
141
141
  <script>
142
142
  // Add your MapTiler Cloud API key to the config
@@ -1103,7 +1103,40 @@ Turning off *zoom compensation* allows for more accurate adjustments to the visu
1103
1103
 
1104
1104
  All the other options are documented on [our reference page](https://docs.maptiler.com/sdk-js/api/helpers/#heatmap) and more examples are available [here](https://docs.maptiler.com/sdk-js/examples/?q=heatmap+helper).
1105
1105
 
1106
- # Other helper
1106
+ # Other helpers
1107
+ ## Convert GPX and KML to GeoJSON
1108
+ In the [Polyline helper section](#polyline-layer-helper) above, we have seen that one can feed the helper directly with a path to a GPX or KML file, that is then converted under the hood client-side into a GeoJSON `FeatureCollection` object. This conversion feature is also exposed and can be used as such:
1109
+
1110
+ ```ts
1111
+ import { gpx } from "@maptiler/sdk";
1112
+
1113
+ // ... assuming inside an async function
1114
+
1115
+ // Fetching the GPX file as a string:
1116
+ const gpxFilePath = "some_gps_trace.gpx";
1117
+ const gpxResponse = await fetch(gpxFilePath);
1118
+ const gpxStr = await res.text();
1119
+
1120
+ // Converting the GPX payload into a GeoJSON FeatureCollection:
1121
+ const features = maptilersdk.gpx(gpxStr);
1122
+ ```
1123
+
1124
+ And for KML files:
1125
+ ```ts
1126
+ import { kml } from "@maptiler/sdk";
1127
+
1128
+ // ... assuming inside an async function
1129
+
1130
+ // Fetching the KML file as a string:
1131
+ const kmlFilePath = "some_gps_trace.kml";
1132
+ const kmlResponse = await fetch(kmlFilePath);
1133
+ const kmlStr = await res.text();
1134
+
1135
+ // Converting the KML payload into a GeoJSON FeatureCollection:
1136
+ const features = maptilersdk.gpx(kmlStr);
1137
+ ```
1138
+
1139
+
1107
1140
  ## Take Screenshots, programmatically
1108
1141
  There are two different ways to create screenshot, corresponding to two very different usecases. Note that screenshots will not contain *DOM elements* such as `Marker` and `Popup`, since those are not part of the rendering context.
1109
1142
 
@@ -0,0 +1,27 @@
1
+ import { defineConfig } from "vitest/config";
2
+
3
+ export default defineConfig({
4
+ plugins: [
5
+ {
6
+ name: 'url-override',
7
+ /**
8
+ * Changing logged URLs to include the path to the demo directory.
9
+ */
10
+ configureServer: (server) => {
11
+ const printUrls = server.printUrls;
12
+
13
+ server.printUrls = () => {
14
+ if (server.resolvedUrls !== null) {
15
+ for (const [key, value] of Object.entries(server.resolvedUrls)) {
16
+ for (let i = 0; i < value.length; i++) {
17
+ server.resolvedUrls[key][i] += "demos/index.html";
18
+ }
19
+ }
20
+ }
21
+
22
+ printUrls();
23
+ }
24
+ }
25
+ }
26
+ ],
27
+ });
@@ -2,26 +2,20 @@ import { resolve } from 'path';
2
2
  import { defineConfig } from 'vite';
3
3
 
4
4
  const isProduction = process.env.NODE_ENV === "production";
5
- const bundleFilename = isProduction ? "maptiler-sdk.umd.min.js" : "maptiler-sdk.umd.js"
6
-
7
- const plugins = [];
8
-
9
5
 
10
6
  export default defineConfig({
11
7
  mode: isProduction ? "production" : "development",
12
8
  build: {
13
9
  outDir: "build",
14
- minify: isProduction,
10
+ minify: true,
15
11
  emptyOutDir: isProduction,
16
12
  sourcemap: true,
17
13
  lib: {
18
- // Could also be a dictionary or array of multiple entry points
19
14
  entry: resolve(__dirname, 'src/index.ts'),
20
15
  name: 'maptilersdk',
21
- // the proper extensions will be added
22
- fileName: (format, entryName) => bundleFilename,
16
+ fileName: (format, entryName) => "maptiler-sdk.umd.min.js",
23
17
  formats: ['umd'],
24
18
  }
25
19
  },
26
- plugins,
27
- })
20
+ plugins: [],
21
+ });
File without changes