@maptiler/sdk 4.0.0-rc.6 → 4.0.1

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 (195) hide show
  1. package/dist/maptiler-sdk.d.ts +1 -1
  2. package/dist/maptiler-sdk.mjs +1 -1
  3. package/package.json +5 -2
  4. package/.editorconfig +0 -13
  5. package/.husky/pre-commit +0 -3
  6. package/e2e/global.d.ts +0 -25
  7. package/e2e/public/animated-route.geojson +0 -82
  8. package/e2e/public/animatedRouteLayer.html +0 -24
  9. package/e2e/public/haloSpace.html +0 -25
  10. package/e2e/public/mapLoad.html +0 -24
  11. package/e2e/public/rtlTextPlugin.html +0 -24
  12. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-0-chromium-linux.png +0 -0
  13. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-1-chromium-linux.png +0 -0
  14. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-10-chromium-linux.png +0 -0
  15. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-11-chromium-linux.png +0 -0
  16. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-12-chromium-linux.png +0 -0
  17. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-13-chromium-linux.png +0 -0
  18. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-14-chromium-linux.png +0 -0
  19. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-15-chromium-linux.png +0 -0
  20. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-16-chromium-linux.png +0 -0
  21. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-17-chromium-linux.png +0 -0
  22. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-18-chromium-linux.png +0 -0
  23. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-19-chromium-linux.png +0 -0
  24. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-2-chromium-linux.png +0 -0
  25. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-3-chromium-linux.png +0 -0
  26. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-4-chromium-linux.png +0 -0
  27. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-5-chromium-linux.png +0 -0
  28. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-6-chromium-linux.png +0 -0
  29. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-7-chromium-linux.png +0 -0
  30. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-8-chromium-linux.png +0 -0
  31. package/e2e/snapshots/tests/AnimatedRouteLayer.test.ts-snapshots/animated-route-9-chromium-linux.png +0 -0
  32. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-catalogue-style-halo-constructor-override-chromium-linux.png +0 -0
  33. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-json-style-config-halo-constructor-override-chromium-linux.png +0 -0
  34. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-json-style-config-halo-rendered-chromium-linux.png +0 -0
  35. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-json-style-config-halo-rendered-chromium.png +0 -0
  36. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-json-style-config-halo-true-chromium-linux.png +0 -0
  37. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-no-style-config-halo-true-chromium-linux.png +0 -0
  38. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-remote-style-config-halo-constructor-override-chromium-linux.png +0 -0
  39. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-remote-style-config-halo-false-chromium-linux.png +0 -0
  40. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-remote-style-config-halo-true-chromium-linux.png +0 -0
  41. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-default-chromium-linux.png +0 -0
  42. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-default-chromium.png +0 -0
  43. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-false-chromium-linux.png +0 -0
  44. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-false-chromium.png +0 -0
  45. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-valid-chromium-linux.png +0 -0
  46. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-json-valid-chromium.png +0 -0
  47. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/halo-halo-style-config-halo-remote-valid-chromium-linux.png +0 -0
  48. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-catalogue-style-config-space-true-chromium-linux.png +0 -0
  49. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-catalogue-style-config-space-undefined-chromium-linux.png +0 -0
  50. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-json-style-config-space-true-chromium-linux.png +0 -0
  51. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-json-style-config-space-true-chromium.png +0 -0
  52. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-json-style-config-space-true-default-chromium-linux.png +0 -0
  53. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-json-style-config-space-true-default-chromium.png +0 -0
  54. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-constructor-undefined-with-json-style-config-chromium-linux.png +0 -0
  55. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-constructor-with-catalogue-style-config-chromium-linux.png +0 -0
  56. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-constructor-with-json-space-config-chromium-linux.png +0 -0
  57. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-constructor-with-json-space-config-chromium.png +0 -0
  58. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-false-with-json-style-config-chromium-linux.png +0 -0
  59. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-false-with-json-style-config-chromium.png +0 -0
  60. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-false-with-style-config-chromium-linux.png +0 -0
  61. package/e2e/snapshots/tests/haloSpace.test.ts-snapshots/space-space-style-config-space-true-no-style-config-chromium-linux.png +0 -0
  62. package/e2e/snapshots/tests/map-load.test.ts-snapshots/halo-halo-json-style-config-halo-rendered-chromium-linux.png +0 -0
  63. package/e2e/snapshots/tests/map-load.test.ts-snapshots/halo-halo-json-style-config-halo-true-chromium-linux.png +0 -0
  64. package/e2e/snapshots/tests/map-load.test.ts-snapshots/halo-halo-style-config-halo-json-default-chromium-linux.png +0 -0
  65. package/e2e/snapshots/tests/map-load.test.ts-snapshots/halo-halo-style-config-halo-json-false-chromium-linux.png +0 -0
  66. package/e2e/snapshots/tests/map-load.test.ts-snapshots/halo-halo-style-config-halo-json-valid-chromium-linux.png +0 -0
  67. package/e2e/snapshots/tests/map-load.test.ts-snapshots/mapLoad-chromium-linux.png +0 -0
  68. package/e2e/snapshots/tests/map-load.test.ts-snapshots/space-space-json-style-config-space-true-chromium-linux.png +0 -0
  69. package/e2e/snapshots/tests/map-load.test.ts-snapshots/space-space-json-style-config-space-true-chromium.png +0 -0
  70. package/e2e/snapshots/tests/map-load.test.ts-snapshots/space-space-json-style-config-space-true-default-chromium-linux.png +0 -0
  71. package/e2e/snapshots/tests/map-load.test.ts-snapshots/space-space-style-config-space-constructor-with-json-space-config-chromium-linux.png +0 -0
  72. package/e2e/snapshots/tests/map-load.test.ts-snapshots/space-space-style-config-space-false-with-json-style-config-chromium-linux.png +0 -0
  73. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/halo-halo-json-style-config-halo-rendered-chromium-linux.png +0 -0
  74. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/halo-halo-json-style-config-halo-true-chromium-linux.png +0 -0
  75. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/halo-halo-style-config-halo-json-default-chromium-linux.png +0 -0
  76. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/halo-halo-style-config-halo-json-false-chromium-linux.png +0 -0
  77. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/halo-halo-style-config-halo-json-valid-chromium-linux.png +0 -0
  78. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/space-space-json-style-config-space-true-chromium-linux.png +0 -0
  79. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/space-space-json-style-config-space-true-default-chromium-linux.png +0 -0
  80. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/space-space-style-config-space-constructor-with-json-space-config-chromium-linux.png +0 -0
  81. package/e2e/snapshots/tests/rtlTextPlugin.test.ts-snapshots/space-space-style-config-space-false-with-json-style-config-chromium-linux.png +0 -0
  82. package/e2e/tests/AnimatedRouteLayer.test.ts +0 -45
  83. package/e2e/tests/consts.ts +0 -0
  84. package/e2e/tests/expected-results/animatedRouteLayer-1.json +0 -202
  85. package/e2e/tests/haloSpace.test.ts +0 -809
  86. package/e2e/tests/helpers/fetchGeojson.ts +0 -21
  87. package/e2e/tests/helpers/getMapInstanceForFixture.ts +0 -87
  88. package/e2e/tests/helpers/injectGlobalVariables.ts +0 -13
  89. package/e2e/tests/helpers/loadFixtureAndGetMapHandle.ts +0 -109
  90. package/e2e/tests/map-load.test.ts +0 -14
  91. package/e2e/tests/mocks/maptiler-style-space-halo-invalid.json +0 -38
  92. package/e2e/tests/mocks/maptiler-style-space-halo.json +0 -41
  93. package/e2e/tests/mocks/maptiler-style.json +0 -28
  94. package/e2e/tests/mocks/terrain-tile.png +0 -0
  95. package/e2e/tests/mocks/tile.png +0 -0
  96. package/e2e/tests/rtlTextPlugin.test.ts +0 -22
  97. package/e2e/tsconfig.json +0 -16
  98. package/eslint.config.mjs +0 -141
  99. package/playwright.config.ts +0 -88
  100. package/test-results/tests-map-load-Awaits-until-map-ready-and-takes-snapshot-chromium/trace.zip +0 -0
  101. package/tsconfig.json +0 -42
  102. package/typedoc.css +0 -118
  103. package/typedoc.json +0 -13
  104. package/vitest-setup-tests.ts +0 -19
  105. /package/dist/{src/ColorRamp.d.ts → ColorRamp.d.ts} +0 -0
  106. /package/dist/{src/ImageViewer → ImageViewer}/ImageViewer.d.ts +0 -0
  107. /package/dist/{src/ImageViewer → ImageViewer}/ImageViewerMarker.d.ts +0 -0
  108. /package/dist/{src/ImageViewer → ImageViewer}/events.d.ts +0 -0
  109. /package/dist/{src/ImageViewer → ImageViewer}/index.d.ts +0 -0
  110. /package/dist/{src/ImageViewer → ImageViewer}/monkeyPatchML.d.ts +0 -0
  111. /package/dist/{src/ImageViewer → ImageViewer}/symbols.d.ts +0 -0
  112. /package/dist/{src/MLAdapters → MLAdapters}/AttributionControl.d.ts +0 -0
  113. /package/dist/{src/MLAdapters → MLAdapters}/BoxZoomHandler.d.ts +0 -0
  114. /package/dist/{src/MLAdapters → MLAdapters}/CanvasSource.d.ts +0 -0
  115. /package/dist/{src/MLAdapters → MLAdapters}/CooperativeGesturesHandler.d.ts +0 -0
  116. /package/dist/{src/MLAdapters → MLAdapters}/FullscreenControl.d.ts +0 -0
  117. /package/dist/{src/MLAdapters → MLAdapters}/GeoJSONSource.d.ts +0 -0
  118. /package/dist/{src/MLAdapters → MLAdapters}/GeolocateControl.d.ts +0 -0
  119. /package/dist/{src/MLAdapters → MLAdapters}/ImageSource.d.ts +0 -0
  120. /package/dist/{src/MLAdapters → MLAdapters}/KeyboardHandler.d.ts +0 -0
  121. /package/dist/{src/MLAdapters → MLAdapters}/LogoControl.d.ts +0 -0
  122. /package/dist/{src/MLAdapters → MLAdapters}/MapMouseEvent.d.ts +0 -0
  123. /package/dist/{src/MLAdapters → MLAdapters}/MapTouchEvent.d.ts +0 -0
  124. /package/dist/{src/MLAdapters → MLAdapters}/MapWheelEvent.d.ts +0 -0
  125. /package/dist/{src/MLAdapters → MLAdapters}/Marker.d.ts +0 -0
  126. /package/dist/{src/MLAdapters → MLAdapters}/NavigationControl.d.ts +0 -0
  127. /package/dist/{src/MLAdapters → MLAdapters}/Popup.d.ts +0 -0
  128. /package/dist/{src/MLAdapters → MLAdapters}/RasterDEMTileSource.d.ts +0 -0
  129. /package/dist/{src/MLAdapters → MLAdapters}/RasterTileSource.d.ts +0 -0
  130. /package/dist/{src/MLAdapters → MLAdapters}/ScaleControl.d.ts +0 -0
  131. /package/dist/{src/MLAdapters → MLAdapters}/ScrollZoomHandler.d.ts +0 -0
  132. /package/dist/{src/MLAdapters → MLAdapters}/Style.d.ts +0 -0
  133. /package/dist/{src/MLAdapters → MLAdapters}/TerrainControl.d.ts +0 -0
  134. /package/dist/{src/MLAdapters → MLAdapters}/TwoFingersTouchPitchHandler.d.ts +0 -0
  135. /package/dist/{src/MLAdapters → MLAdapters}/VectorTileSource.d.ts +0 -0
  136. /package/dist/{src/MLAdapters → MLAdapters}/VideoSource.d.ts +0 -0
  137. /package/dist/{src/Map.d.ts → Map.d.ts} +0 -0
  138. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/AnimationManager.d.ts +0 -0
  139. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/MaptilerAnimation.d.ts +0 -0
  140. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/animation-helpers.d.ts +0 -0
  141. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/easing.d.ts +0 -0
  142. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/index.d.ts +0 -0
  143. /package/dist/{src/MaptilerAnimation → MaptilerAnimation}/types.d.ts +0 -0
  144. /package/dist/{src/Point.d.ts → Point.d.ts} +0 -0
  145. /package/dist/{src/Telemetry.d.ts → Telemetry.d.ts} +0 -0
  146. /package/dist/{src/caching.d.ts → caching.d.ts} +0 -0
  147. /package/dist/{src/config.d.ts → config.d.ts} +0 -0
  148. /package/dist/{src/constants → constants}/defaults.d.ts +0 -0
  149. /package/dist/{src/controls → controls}/ImageViewerFitImageToBoundsControl.d.ts +0 -0
  150. /package/dist/{src/controls → controls}/MaptilerCustomControl.d.ts +0 -0
  151. /package/dist/{src/controls → controls}/MaptilerExternalControl.d.ts +0 -0
  152. /package/dist/{src/controls → controls}/MaptilerGeolocateControl.d.ts +0 -0
  153. /package/dist/{src/controls → controls}/MaptilerLogoControl.d.ts +0 -0
  154. /package/dist/{src/controls → controls}/MaptilerNavigationControl.d.ts +0 -0
  155. /package/dist/{src/controls → controls}/MaptilerProjectionControl.d.ts +0 -0
  156. /package/dist/{src/controls → controls}/MaptilerTerrainControl.d.ts +0 -0
  157. /package/dist/{src/controls → controls}/Minimap.d.ts +0 -0
  158. /package/dist/{src/controls → controls}/index.d.ts +0 -0
  159. /package/dist/{src/converters → converters}/index.d.ts +0 -0
  160. /package/dist/{src/converters → converters}/xml.d.ts +0 -0
  161. /package/dist/{src/custom-layers → custom-layers}/AnimatedRouteLayer/AnimatedRouteLayer.d.ts +0 -0
  162. /package/dist/{src/custom-layers → custom-layers}/AnimatedRouteLayer/index.d.ts +0 -0
  163. /package/dist/{src/custom-layers → custom-layers}/CubemapLayer/CubemapLayer.d.ts +0 -0
  164. /package/dist/{src/custom-layers → custom-layers}/CubemapLayer/constants.d.ts +0 -0
  165. /package/dist/{src/custom-layers → custom-layers}/CubemapLayer/index.d.ts +0 -0
  166. /package/dist/{src/custom-layers → custom-layers}/CubemapLayer/loadCubemapTexture.d.ts +0 -0
  167. /package/dist/{src/custom-layers → custom-layers}/CubemapLayer/types.d.ts +0 -0
  168. /package/dist/{src/custom-layers → custom-layers}/RadialGradientLayer/RadialGradientLayer.d.ts +0 -0
  169. /package/dist/{src/custom-layers → custom-layers}/RadialGradientLayer/index.d.ts +0 -0
  170. /package/dist/{src/custom-layers → custom-layers}/RadialGradientLayer/types.d.ts +0 -0
  171. /package/dist/{src/custom-layers → custom-layers}/extractCustomLayerStyle.d.ts +0 -0
  172. /package/dist/{src/custom-layers → custom-layers}/index.d.ts +0 -0
  173. /package/dist/{src/geocoding.d.ts → geocoding.d.ts} +0 -0
  174. /package/dist/{src/helpers → helpers}/index.d.ts +0 -0
  175. /package/dist/{src/helpers → helpers}/screenshot.d.ts +0 -0
  176. /package/dist/{src/helpers → helpers}/stylehelper.d.ts +0 -0
  177. /package/dist/{src/helpers → helpers}/vectorlayerhelpers.d.ts +0 -0
  178. /package/dist/{src/index.d.ts → index.d.ts} +0 -0
  179. /package/dist/{src/language.d.ts → language.d.ts} +0 -0
  180. /package/dist/{src/mapstyle.d.ts → mapstyle.d.ts} +0 -0
  181. /package/dist/{src/ml-types.d.ts → ml-types.d.ts} +0 -0
  182. /package/dist/{src/polyfills.d.ts → polyfills.d.ts} +0 -0
  183. /package/dist/{src/tools.d.ts → tools.d.ts} +0 -0
  184. /package/dist/{src/types.d.ts → types.d.ts} +0 -0
  185. /package/dist/{src/utils → utils}/array.d.ts +0 -0
  186. /package/dist/{src/utils → utils}/dom.d.ts +0 -0
  187. /package/dist/{src/utils → utils}/errors.d.ts +0 -0
  188. /package/dist/{src/utils → utils}/geo-utils.d.ts +0 -0
  189. /package/dist/{src/utils → utils}/index.d.ts +0 -0
  190. /package/dist/{src/utils → utils}/json.d.ts +0 -0
  191. /package/dist/{src/utils → utils}/logSDKVersion.d.ts +0 -0
  192. /package/dist/{src/utils → utils}/math-utils.d.ts +0 -0
  193. /package/dist/{src/utils → utils}/object.d.ts +0 -0
  194. /package/dist/{src/utils → utils}/string.d.ts +0 -0
  195. /package/dist/{src/utils → utils}/webgl-utils.d.ts +0 -0
@@ -1,21 +0,0 @@
1
- import { KeyframeableGeoJSONFeature } from "../../../src";
2
-
3
- type GeoJSON = {
4
- type: "FeatureCollection";
5
- features: KeyframeableGeoJSONFeature[];
6
- };
7
-
8
- export default async function fetchGeoJSON(assetUrl: string): Promise<GeoJSON> {
9
- try {
10
- const response = await fetch(assetUrl);
11
-
12
- if (!response.ok) {
13
- throw new Error(`Failed to fetch GeoJSON: ${response.statusText}`);
14
- }
15
-
16
- const geojson = await response.json();
17
- return geojson as GeoJSON;
18
- } catch (e) {
19
- throw e;
20
- }
21
- }
@@ -1,87 +0,0 @@
1
- import { Page, expect } from "@playwright/test";
2
- import path from "path";
3
- import { injectGlobalVariables } from "./injectGlobalVariables";
4
-
5
- interface IgetMapInstanceForFixture {
6
- fixture: string;
7
- page: Page;
8
- mockStyle?: boolean;
9
- mockTiles?: boolean;
10
- debug?: boolean;
11
- timeout?: number;
12
- }
13
-
14
- export default async function getMapInstanceForFixture({ fixture, page, mockStyle = true, mockTiles = true, debug = false, timeout = 10000 }: IgetMapInstanceForFixture) {
15
- await injectGlobalVariables(page);
16
- await page.addInitScript((plt) => {
17
- window.__pageLoadTimeout = plt;
18
- }, timeout);
19
-
20
- if (mockStyle) {
21
- // mock style response
22
- await page.route("https://api.maptiler.com/maps/*/*.json*", async (route) => {
23
- if (debug) console.info(`ℹ️ Style intercepted at ${route.request().url()}`);
24
- await route.fulfill({
25
- status: 200,
26
- contentType: "application/json",
27
- path: path.resolve(import.meta.dirname, "../mocks/maptiler-style.json"),
28
- });
29
- });
30
- }
31
-
32
- if (mockTiles) {
33
- // mocks the tile response always returning the mock tile
34
- await page.route("https://api.maptiler.com/tiles/*/*/*/*.jpg?key=*&*", (route) => {
35
- if (debug) console.info(`ℹ️ Tile intercepted at ${route.request().url()}`);
36
- return route.fulfill({
37
- status: 200,
38
- contentType: "image/png",
39
- path: path.resolve(import.meta.dirname, "../mocks/tile.png"),
40
- });
41
- });
42
- }
43
-
44
- page.on("console", (msg) => {
45
- console.log("FIXTURE LOG:", msg.text());
46
- if (debug) {
47
- console.log("DEBUG FIXTURE LOG:", msg.location(), msg.text());
48
- }
49
- });
50
-
51
- page.addListener("requestfinished", async (request) => {
52
- const response = await request.response();
53
- if (response && response.status() >= 400) {
54
- console.error(`\n\nFailed to load ${request.url()}\n status: ${response.status()}\n\n`);
55
- expect(response.status()).toBeLessThan(400);
56
- }
57
- });
58
-
59
- await page.goto(`http://localhost:5173/${fixture}.html`, {
60
- waitUntil: "domcontentloaded",
61
- });
62
-
63
- try {
64
- const map = await page.evaluateHandle(() => {
65
- return Promise.race([
66
- new Promise(async (resolve) => {
67
- console.log("Window.__map", window.__map);
68
- window.__map.on("idle", () => {;
69
- resolve(window.__map);
70
- });
71
- }),
72
- new Promise((_, reject) => {
73
- setTimeout(() => {
74
- reject(new Error("Map did not load in time"));
75
- }, window.__pageLoadTimeout);
76
- }),
77
- ]);
78
- });
79
-
80
- return {
81
- map,
82
- };
83
- } catch (e) {
84
- console.error(e);
85
- return {};
86
- }
87
- }
@@ -1,13 +0,0 @@
1
- import { Page } from "@playwright/test";
2
- import packagejson from "../../../package.json" assert { type: "json" };
3
-
4
- export async function injectGlobalVariables(page: Page) {
5
- console.log("injecting global variables");
6
- await page.addInitScript(
7
- ({ version, nodeEnv }) => {
8
- window.__MT_SDK_VERSION__ = version;
9
- window.__MT_NODE_ENV__ = nodeEnv;
10
- },
11
- { version: packagejson.version, nodeEnv: process.env.NODE_ENV },
12
- );
13
- }
@@ -1,109 +0,0 @@
1
- import type { Map } from "../../../src/index";
2
- import { JSHandle, Page, expect } from "@playwright/test";
3
- import path from "path";
4
- import { injectGlobalVariables } from "./injectGlobalVariables";
5
-
6
- export interface LoadFixtureAndGetMapHandleOptions {
7
- fixture: string;
8
- page: Page;
9
- mockStyle?: boolean | string;
10
- mockTiles?: boolean | string;
11
- debug?: boolean;
12
- waitUntil?: "load" | "domcontentloaded" | "networkidle";
13
- queryParams?: Record<string, string>;
14
- lazy?: boolean;
15
- }
16
-
17
- export default async function loadFixtureAndGetMapHandle({
18
- fixture,
19
- page,
20
- mockStyle = true,
21
- mockTiles = true,
22
- debug = false,
23
- waitUntil = "load",
24
- queryParams,
25
- lazy = false,
26
- }: LoadFixtureAndGetMapHandleOptions): Promise<{ mapHandle: JSHandle<Map | null> | null }> {
27
- await injectGlobalVariables(page);
28
- if (mockStyle) {
29
- // mock style response
30
- await page.route("https://api.maptiler.com/maps/*/*.json*", async (route) => {
31
- if (debug) console.info(`ℹ️ Style intercepted at ${route.request().url()}`);
32
- const mockFileName = typeof mockStyle === "string" ? mockStyle : "maptiler-style.json";
33
- await route.fulfill({
34
- status: 200,
35
- contentType: "application/json",
36
- path: path.resolve(import.meta.dirname, `../mocks/${mockFileName}`),
37
- });
38
- });
39
- }
40
-
41
- if (mockTiles) {
42
- // mocks the tile response always returning the mock tile
43
- await page.route("https://api.maptiler.com/tiles/*/*/*/*.jpg?key=*&*", (route) => {
44
- if (debug) console.info(`ℹ️ Tile intercepted at ${route.request().url()}`);
45
- return route.fulfill({
46
- status: 200,
47
- contentType: "image/png",
48
- path: path.resolve(import.meta.dirname, `../mocks/tile.png`),
49
- });
50
- });
51
- }
52
-
53
- page.on("console", (msg) => {
54
- if (debug) {
55
- console.log("DEBUG FIXTURE LOG:", msg.location(), msg.text());
56
- }
57
- });
58
-
59
- page.addListener("requestfinished", async (request) => {
60
- const response = await request.response();
61
- if (response && response.status() >= 400) {
62
- console.error(`\n\nFailed to load ${request.url()}\n status: ${response.status()}\n\n`);
63
- expect(response.status()).toBeLessThan(400);
64
- }
65
- });
66
-
67
- await page.goto([`http://localhost:5173/${fixture}.html`, queryParams && new URLSearchParams(queryParams).toString()].filter(Boolean).join("?"), {
68
- waitUntil,
69
- });
70
-
71
- if (!lazy) {
72
- try {
73
- const mapHandle = await page.evaluateHandle<Map | null>(() => {
74
- return Promise.race<Map | null>([
75
- new Promise<Map | null>(async (resolve) => {
76
- try {
77
- window.__map.on("idle", () => {
78
- resolve(window.__map as Map);
79
- });
80
- } catch (e) {
81
- console.error("Error getting map instance", e);
82
- resolve(null);
83
- }
84
- }),
85
- new Promise<Map | null>((resolve) => {
86
- setTimeout(() => {
87
- console.error("Map did not load in time");
88
- resolve(null);
89
- }, 10000);
90
- }),
91
- ]);
92
- });
93
-
94
- return {
95
- mapHandle,
96
- };
97
- } catch (e) {
98
- console.error(e);
99
- const nullMap = await page.evaluateHandle(() => null);
100
- return {
101
- mapHandle: nullMap as JSHandle<Map | null>,
102
- };
103
- }
104
- }
105
-
106
- return {
107
- mapHandle: null,
108
- };
109
- }
@@ -1,14 +0,0 @@
1
- import { expect, test } from "@playwright/test";
2
-
3
- import loadFixtureAndGetMapHandle from "./helpers/loadFixtureAndGetMapHandle";
4
-
5
- test("Awaits until map ready and takes snapshot", async ({ page }, testInfo) => {
6
- await loadFixtureAndGetMapHandle({
7
- fixture: "mapLoad",
8
- page,
9
- });
10
-
11
- expect(await page.title()).toBe("MapTiler E2E Map Load");
12
-
13
- await expect(page).toHaveScreenshot("mapLoad.png");
14
- });
@@ -1,38 +0,0 @@
1
- {
2
- "version": 8,
3
- "sources": {
4
- "raster": {
5
- "type": "raster",
6
- "tiles": [
7
- "https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=DOESNT_MATTER"
8
- ],
9
- "tileSize": 256
10
- }
11
- },
12
- "layers": [
13
- {
14
- "id": "raster",
15
- "type": "raster",
16
- "source": "raster",
17
- "minzoom": 0,
18
- "maxzoom": 22
19
- }
20
- ],
21
- "projection": { "type": "globe" },
22
- "metadata": {
23
- "maptiler": {
24
- "version": "1.0.0",
25
- "attribution": "© MapTiler © OpenStreetMap contributors",
26
- "halo": {
27
- "scale": "letter",
28
- "stops": {
29
- "is": "an object"
30
- }
31
- },
32
- "space": {
33
- "color": [1234,1234],
34
- "preset": 3
35
- }
36
- }
37
- }
38
- }
@@ -1,41 +0,0 @@
1
- {
2
- "version": 8,
3
- "sources": {
4
- "raster": {
5
- "type": "raster",
6
- "tiles": [
7
- "https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=DOESNT_MATTER"
8
- ],
9
- "tileSize": 256
10
- }
11
- },
12
- "layers": [
13
- {
14
- "id": "raster",
15
- "type": "raster",
16
- "source": "raster",
17
- "minzoom": 0,
18
- "maxzoom": 22
19
- }
20
- ],
21
- "projection": { "type": "globe" },
22
- "metadata": {
23
- "maptiler": {
24
- "version": "1.0.0",
25
- "attribution": "© MapTiler © OpenStreetMap contributors",
26
- "halo": {
27
- "scale": 1.5,
28
- "stops": [
29
- [0.2, "transparent"],
30
- [0.2, "red"],
31
- [0.4, "red"],
32
- [0.4, "transparent"]
33
- ]
34
- },
35
- "space": {
36
- "color": "green",
37
- "preset": "space"
38
- }
39
- }
40
- }
41
- }
@@ -1,28 +0,0 @@
1
- {
2
- "version": 8,
3
- "sources": {
4
- "raster": {
5
- "type": "raster",
6
- "tiles": [
7
- "https://api.maptiler.com/tiles/satellite/{z}/{x}/{y}.jpg?key=DOESNT_MATTER"
8
- ],
9
- "tileSize": 256
10
- }
11
- },
12
- "projection": { "type": "globe" },
13
- "layers": [
14
- {
15
- "id": "raster",
16
- "type": "raster",
17
- "source": "raster",
18
- "minzoom": 0,
19
- "maxzoom": 22
20
- }
21
- ],
22
- "metadata": {
23
- "maptiler": {
24
- "version": "1.0.0",
25
- "attribution": "© MapTiler © OpenStreetMap contributors"
26
- }
27
- }
28
- }
Binary file
Binary file
@@ -1,22 +0,0 @@
1
- import { expect, test } from "@playwright/test";
2
- import loadFixtureAndGetMapHandle from "./helpers/loadFixtureAndGetMapHandle";
3
-
4
- test("Renders RTL text correctly when RTL plugin is enabled and incorrectly when disabled", async ({ page }) => {
5
- await page.exposeFunction("notifyScreenshotStateReady", async (data: Record<string, TTestTransferData>) => {
6
- const screenshotname = data.disabled ? "rtlTextPlugin-disabled.png" : "rtlTextPlugin-enabled.png";
7
- await expect(page).toHaveScreenshot(screenshotname);
8
- });
9
-
10
- await loadFixtureAndGetMapHandle({
11
- fixture: "rtlTextPlugin",
12
- page,
13
- });
14
-
15
- expect(await page.title()).toBe("MapTiler E2E RTL Text Plugin");
16
-
17
- await loadFixtureAndGetMapHandle({
18
- fixture: "rtlTextPlugin",
19
- page,
20
- queryParams: { "disable-rtl": "true" },
21
- });
22
- });
package/e2e/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "types": ["./global.d.ts", "node"],
5
- "noUnusedLocals": false,
6
- "noUnusedParameters": false,
7
- "moduleResolution": "node",
8
- "resolveJsonModule": true,
9
- },
10
- "include": [
11
- "./tests/**/*.test.ts",
12
- "./tests/helpers/*.ts",
13
- "./src/**/*.ts",
14
- "../src/**/*.d.ts"
15
- ]
16
- }
package/eslint.config.mjs DELETED
@@ -1,141 +0,0 @@
1
- // @ts-nocheck
2
-
3
- import tseslint from "typescript-eslint";
4
- import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
5
- import eslintPluginCompat from "eslint-plugin-compat";
6
-
7
- export default tseslint.config(
8
- // https://typescript-eslint.io/getting-started/typed-linting/
9
- tseslint.configs.strictTypeChecked,
10
- tseslint.configs.stylisticTypeChecked,
11
- tseslint.configs.recommendedTypeChecked,
12
- {
13
- // forked from https://www.npmjs.com/package/eslint-plugin-restrict-imports
14
- plugins: {
15
- compat: eslintPluginCompat,
16
- import: {
17
- rules: {
18
- "default-imports-only": {
19
- meta: {
20
- type: "suggestion",
21
- docs: {},
22
- schema: [
23
- {
24
- bannedImport: {
25
- locations: ["filePaths"],
26
- message: "string",
27
- fixedLocation: "string",
28
- },
29
- },
30
- ],
31
- },
32
- create: function (context) {
33
- const filePath = context.getFilename();
34
- const options = context.options[0] || {
35
- "^/(.*)": {
36
- locations: ["(.*)"],
37
- },
38
- };
39
-
40
- return {
41
- ImportDeclaration: (node) => {
42
- Object.entries(options).forEach(([bannedImport, config]) => {
43
- const importLocationRegex = new RegExp(bannedImport);
44
-
45
- if (config.ignoreTypeImports && node.importKind === "type") return;
46
-
47
- if (importLocationRegex.test(node.source.value)) {
48
- config.locations.forEach((fp) => {
49
- const bannedLocationRegex = new RegExp(fp);
50
-
51
- if (bannedLocationRegex.test(filePath)) {
52
- node.specifiers.forEach((specifier) => {
53
- if (specifier.type !== "ImportDefaultSpecifier") {
54
- context.report({
55
- // @ts-expect-error `message` seems to work with this...
56
- message: config.message ?? `Importing from '${bannedImport}' is banned in '${fp}'`,
57
- node,
58
- });
59
- }
60
- });
61
- }
62
- });
63
- }
64
- });
65
- },
66
- };
67
- },
68
- },
69
- },
70
- },
71
- },
72
- settings: {
73
- // eslint-plugin-compat polyfill
74
- polyfills: ["requestIdleCallback"],
75
- },
76
- rules: {
77
- "compat/compat": "error",
78
- "import/default-imports-only": [
79
- "error",
80
- {
81
- "maplibre-gl$": {
82
- locations: ["^(?!.*\.d\.ts$).*\.((ts|js))$"],
83
- message: `Maplibre-gl uses CJS modules, only default imports are supported, named imports may fail on some setups.`,
84
- ignoreTypeImports: true,
85
- },
86
- },
87
- ],
88
- },
89
- },
90
- {
91
- languageOptions: {
92
- parserOptions: {
93
- projectService: true,
94
- tsconfigRootDir: import.meta.dirname,
95
- },
96
- },
97
- },
98
- // https://github.com/prettier/eslint-plugin-prettier
99
- eslintPluginPrettierRecommended,
100
- //
101
- {
102
- rules: {
103
- "@typescript-eslint/array-type": "off",
104
- "@typescript-eslint/consistent-indexed-object-style": "warn",
105
- "@typescript-eslint/consistent-type-definitions": "off",
106
- "@typescript-eslint/no-base-to-string": "warn",
107
- "@typescript-eslint/no-confusing-void-expression": "warn",
108
- "@typescript-eslint/no-explicit-any": "warn",
109
- "@typescript-eslint/no-empty-function": "warn", // this is to satisfy maplibre-gl custom layer interface
110
- "@typescript-eslint/no-floating-promises": "warn",
111
- "@typescript-eslint/no-inferrable-types": "off",
112
- "@typescript-eslint/no-misused-promises": "warn",
113
- "@typescript-eslint/no-unnecessary-boolean-literal-compare": "off",
114
- "@typescript-eslint/no-unnecessary-condition": "warn",
115
- "@typescript-eslint/no-unnecessary-type-arguments": "off",
116
- "@typescript-eslint/no-unnecessary-type-assertion": "off",
117
- "@typescript-eslint/no-unnecessary-type-parameters": "off",
118
- "@typescript-eslint/no-unused-vars": "warn",
119
- "@typescript-eslint/no-unsafe-argument": "warn",
120
- "@typescript-eslint/no-unsafe-assignment": "warn",
121
- "@typescript-eslint/no-unsafe-call": "warn",
122
- "@typescript-eslint/no-unsafe-enum-comparison": "off",
123
- "@typescript-eslint/no-unsafe-member-access": "warn",
124
- "@typescript-eslint/no-unsafe-return": "warn",
125
- "@typescript-eslint/no-non-null-assertion": "warn",
126
- "@typescript-eslint/non-nullable-type-assertion-style": "warn",
127
- "@typescript-eslint/prefer-for-of": "off",
128
- "@typescript-eslint/prefer-nullish-coalescing": "warn",
129
- "@typescript-eslint/prefer-optional-chain": "off",
130
- "@typescript-eslint/prefer-return-this-type": "off",
131
- "@typescript-eslint/prefer-string-starts-ends-with": "warn",
132
- "@typescript-eslint/restrict-plus-operands": "warn",
133
- "@typescript-eslint/restrict-template-expressions": "warn",
134
- "@typescript-eslint/related-getter-setter-pairs": "off",
135
- "@typescript-eslint/unbound-method": "warn",
136
- "@typescript-eslint/use-unknown-in-catch-callback-variable": "warn",
137
- "@typescript-eslint/unified-signatures": ["error", { ignoreOverloadsWithDifferentJSDoc: true }],
138
- },
139
- },
140
- //
141
- );
@@ -1,88 +0,0 @@
1
- import { defineConfig, devices } from '@playwright/test';
2
- import packagejson from './package.json' assert { type: 'json' };
3
- /**
4
- * Read environment variables from file.
5
- * https://github.com/motdotla/dotenv
6
- */
7
- // import dotenv from 'dotenv';
8
- // import path from 'path';
9
- // dotenv.config({ path: path.resolve(__dirname, '.env') });
10
-
11
- /**
12
- * See https://playwright.dev/docs/test-configuration.
13
- */
14
- export default defineConfig({
15
- testDir: 'e2e',
16
- // testMatch: '**/*.test.ts',
17
- /* Run tests in files in parallel */
18
- fullyParallel: true,
19
- /* Fail the build on CI if you accidentally left test.only in the source code. */
20
- forbidOnly: !!process.env.CI,
21
- /* Retry on CI only */
22
- retries: process.env.CI ? 2 : 0,
23
- /* Opt out of parallel tests on CI. */
24
- workers: process.env.CI ? 1 : undefined,
25
- /* Reporter to use. See https://playwright.dev/docs/test-reporters */
26
- reporter: 'html',
27
- tsconfig: './e2e/tsconfig.json',
28
-
29
- /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
30
- use: {
31
- /* Base URL to use in actions like `await page.goto('/')`. */
32
- // baseURL: 'http://127.0.0.1:3000',
33
-
34
- /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
35
- trace: 'on-first-retry',
36
- launchOptions: {
37
- env: {
38
- __MT_SDK_VERSION__: packagejson.version,
39
- __MT_NODE_ENV__: process.env.NODE_ENV,
40
- }
41
- }
42
- },
43
- snapshotDir: './e2e/snapshots',
44
- /* Configure projects for major browsers */
45
- projects: [
46
- {
47
- name: 'chromium',
48
- use: { ...devices['Desktop Chrome'], },
49
-
50
- },
51
-
52
- // {
53
- // name: 'firefox',
54
- // use: { ...devices['Desktop Firefox'] },
55
- // },
56
-
57
- // {
58
- // name: 'webkit',
59
- // use: { ...devices['Desktop Safari'] },
60
- // },
61
- /* Test against mobile viewports. */
62
- // {
63
- // name: 'Mobile Chrome',
64
- // use: { ...devices['Pixel 5'] },
65
- // },
66
- // {
67
- // name: 'Mobile Safari',
68
- // use: { ...devices['iPhone 12'] },
69
- // },
70
-
71
- /* Test against branded browsers. */
72
- // {
73
- // name: 'Microsoft Edge',
74
- // use: { ...devices['Desktop Edge'], channel: 'msedge' },
75
- // },
76
- // {
77
- // name: 'Google Chrome',
78
- // use: { ...devices['Desktop Chrome'], channel: 'chrome' },
79
- // },
80
- ],
81
-
82
- /* Run your local dev server before starting the tests */
83
- // webServer: {
84
- // command: 'npm run e2e:serve',
85
- // url: 'http://localhost:5173',
86
- // reuseExistingServer: !process.env.CI,
87
- // },
88
- });
package/tsconfig.json DELETED
@@ -1,42 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "src",
4
- "moduleResolution": "Node",
5
- "target": "es2021",
6
- "useDefineForClassFields": true,
7
- "module": "ESNext",
8
- "lib": [
9
- "es2023",
10
- "DOM",
11
- "DOM.Iterable"
12
- ],
13
- "skipLibCheck": true,
14
- /* Bundler mode */
15
- "resolveJsonModule": true,
16
- "isolatedModules": true,
17
- "noEmit": true,
18
- /* Linting */
19
- "strict": true,
20
- "noUnusedLocals": true,
21
- "noUnusedParameters": true,
22
- "noFallthroughCasesInSwitch": true,
23
- "declaration": true,
24
- "allowSyntheticDefaultImports": true,
25
- "allowJs": true,
26
- },
27
- "exclude": [
28
- "vite.config-*.ts",
29
- "vitest-setup-tests.ts",
30
- "dist"
31
- ],
32
- "include": [
33
- "vite.config-dev.ts",
34
- "vite.config-es.ts",
35
- "vite.config-umd.ts",
36
- "vite.config-test.ts",
37
- "vitest-setup-tests.ts",
38
- "src",
39
- "demos",
40
- "test"
41
- ],
42
- }