@maptiler/sdk 3.2.0 → 3.2.1-rc-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.
- package/dist/maptiler-sdk.mjs +17 -17
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/package.json +1 -1
package/dist/maptiler-sdk.mjs
CHANGED
|
@@ -5,8 +5,8 @@ var jr = (r) => {
|
|
|
5
5
|
var za = (r, e, t) => e in r ? _a(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
6
6
|
var L = (r, e, t) => za(r, typeof e != "symbol" ? e + "" : e, t), Rt = (r, e, t) => e.has(r) || jr("Cannot " + t);
|
|
7
7
|
var E = (r, e, t) => (Rt(r, e, "read from private field"), t ? t.call(r) : e.get(r)), ye = (r, e, t) => e.has(r) ? jr("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, t), xe = (r, e, t, n) => (Rt(r, e, "write to private field"), n ? n.call(r, t) : e.set(r, t), t), G = (r, e, t) => (Rt(r, e, "access private method"), t);
|
|
8
|
-
import S
|
|
9
|
-
import { Language as Pa, getLanguageInfoFromCode as
|
|
8
|
+
import S from "maplibre-gl";
|
|
9
|
+
import { Language as Pa, getLanguageInfoFromCode as Nr, config as $t, MapStyle as qe, mapStylePresetList as jt, expandMapStyle as Ra, MapStyleVariant as $a, ReferenceMapStyle as ja, toLanguageInfo as Or, getLanguageInfoFromFlag as Na, geolocation as Fr } from "@maptiler/client";
|
|
10
10
|
import { MapStyle as Vu, MapStyleVariant as Gu, ReferenceMapStyle as Hu, ServiceError as Ku, areSameLanguages as Wu, bufferToPixelDataBrowser as Zu, circumferenceAtLatitude as Ju, coordinates as Yu, data as Xu, elevation as Qu, expandMapStyle as ec, geocoding as tc, geolocation as rc, getAutoLanguage as nc, getBufferToPixelDataParser as ac, getLanguageInfoFromCode as oc, getLanguageInfoFromFlag as ic, getLanguageInfoFromKey as sc, getTileCache as lc, isLanguageInfo as uc, mapStylePresetList as cc, math as pc, misc as fc, staticMaps as dc, styleToStyle as yc, toLanguageInfo as mc } from "@maptiler/client";
|
|
11
11
|
import Oa from "events";
|
|
12
12
|
import { v4 as Fa } from "uuid";
|
|
@@ -60,12 +60,12 @@ const M = {
|
|
|
60
60
|
},
|
|
61
61
|
...Pa
|
|
62
62
|
};
|
|
63
|
-
function
|
|
63
|
+
function Dr() {
|
|
64
64
|
if (typeof navigator > "u") {
|
|
65
|
-
const e = Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0], t =
|
|
65
|
+
const e = Intl.DateTimeFormat().resolvedOptions().locale.split("-")[0], t = Nr(e);
|
|
66
66
|
return t || M.ENGLISH;
|
|
67
67
|
}
|
|
68
|
-
return Array.from(new Set(navigator.languages.map((e) => e.split("-")[0]))).map((e) =>
|
|
68
|
+
return Array.from(new Set(navigator.languages.map((e) => e.split("-")[0]))).map((e) => Nr(e)).filter((e) => e)[0] ?? M.LOCAL;
|
|
69
69
|
}
|
|
70
70
|
const V = {
|
|
71
71
|
maptilerLogoURL: "https://api.maptiler.com/resources/logo.svg",
|
|
@@ -170,7 +170,7 @@ class qa extends Oa {
|
|
|
170
170
|
return $t.fetch;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
const O = new qa(), Kt = "localcache_source", Wt = "localcache", Ba = "maptiler_sdk", Ua = 1e3, Va = 100, Zt = typeof caches < "u";
|
|
173
|
+
const O = new qa(), Kt = "localcache_source", Wt = "localcache", Ba = "maptiler_sdk", Ua = 1e3, Va = 100, Zt = typeof caches < "u", { addProtocol: qr } = S;
|
|
174
174
|
function Ga(r, e) {
|
|
175
175
|
if (Zt && O.caching && O.session && r.host === V.maptilerApiHost) {
|
|
176
176
|
if (e === "Source" && r.href.includes("tiles.json"))
|
|
@@ -191,7 +191,7 @@ async function Ha() {
|
|
|
191
191
|
r.delete(n);
|
|
192
192
|
}
|
|
193
193
|
function Ka() {
|
|
194
|
-
|
|
194
|
+
qr(
|
|
195
195
|
Kt,
|
|
196
196
|
async (r, e) => {
|
|
197
197
|
if (!r.url) throw new Error("");
|
|
@@ -205,7 +205,7 @@ function Ka() {
|
|
|
205
205
|
expires: n.headers.get("Expires")
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
),
|
|
208
|
+
), qr(Wt, async (r, e) => {
|
|
209
209
|
if (!r.url) throw new Error("");
|
|
210
210
|
r.url = r.url.replace(`${Wt}://`, "https://");
|
|
211
211
|
const t = new URL(r.url), n = new URL(t);
|
|
@@ -7942,7 +7942,7 @@ class Is {
|
|
|
7942
7942
|
this.projectionButton.classList.remove("maplibregl-ctrl-projection-globe"), this.projectionButton.classList.remove("maplibregl-ctrl-projection-mercator"), this.map.isGlobeProjection() ? (this.projectionButton.classList.add("maplibregl-ctrl-projection-mercator"), this.projectionButton.title = "Enable Mercator projection") : (this.projectionButton.classList.add("maplibregl-ctrl-projection-globe"), this.projectionButton.title = "Enable Globe projection");
|
|
7943
7943
|
}
|
|
7944
7944
|
}
|
|
7945
|
-
const Es = "@maptiler/sdk", Ms = "3.2.
|
|
7945
|
+
const Es = "@maptiler/sdk", Ms = "3.2.1rc-1", _s = "The Javascript & TypeScript map SDK tailored for MapTiler Cloud", zs = "MapTiler", Ps = "dist/maptiler-sdk.mjs", Rs = "dist/maptiler-sdk.d.ts", $s = "dist/maptiler-sdk.css", js = "module", Ns = { ".": { import: "./dist/maptiler-sdk.mjs", types: "./dist/maptiler-sdk.d.ts" }, "./dist/maptiler-sdk.css": { import: "./dist/maptiler-sdk.css" }, "./style.css": { import: "./dist/maptiler-sdk.css" } }, Os = ["maptiler", "map", "sdk", "webmap", "cloud", "webGL", "maplibre"], Fs = "https://docs.maptiler.com/sdk-js/", Ds = "BSD-3-Clause", qs = { type: "git", url: "https://github.com/maptiler/maptiler-sdk-js.git" }, Bs = { prepare: "husky", doc: "rm -rf docs/* && typedoc --out docs && cp -r images docs/", ncu: "npx npm-check-updates", lint: "eslint src", "lint:fix": "eslint src --fix", "test:watch": "vitest watch -c vite.config-test.ts --dom", test: "vitest run -c vite.config-test.ts --dom", "install:clean": "rm -rf build/ dist/ node_modules/ && npm ci", dev: 'concurrently "vite -c vite.config-dev.ts" "npm run dev-umd"', "dev-umd": "npm run build-css && tsc && NODE_ENV=development vite build -w -c vite.config-umd.ts", "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", "build-umd": "tsc && NODE_ENV=production vite build -c vite.config-umd.ts", "build-es": "tsc && NODE_ENV=production vite build -c vite.config-es.ts", build: "npm run build-es; npm run build-umd; npm run build-css", make: "npm run install:clean && npm run build" }, Us = { "@canvas/image-data": "^1.0.0", "@eslint/js": "^9.21.0", "@types/uuid": "^10.0.0", "@types/xmldom": "^0.1.31", "@vitest/web-worker": "^3.0.9", "@xmldom/xmldom": "^0.8.10", concurrently: "^9.1.2", eslint: "^9.21.0", "eslint-config-prettier": "^10.0.2", "eslint-plugin-prettier": "^5.2.3", "happy-dom": "^17.4.4", husky: "^8.0.0", "lint-staged": "^15.4.3", prettier: "3.5.2", typedoc: "^0.27.6", typescript: "^5.7.3", "typescript-eslint": "^8.25.0", vite: "^6.0.7", "vite-plugin-dts": "^4.5.0", vitest: "^3.0.9" }, Vs = { "@maplibre/maplibre-gl-style-spec": "^23.0.0", "@maptiler/client": "^2.3.2", events: "^3.3.0", "js-base64": "^3.7.7", "maplibre-gl": "^5.3.1", uuid: "^11.0.5" }, Gs = {
|
|
7946
7946
|
name: Es,
|
|
7947
7947
|
version: Ms,
|
|
7948
7948
|
description: _s,
|
|
@@ -8065,7 +8065,7 @@ class zr extends S.Map {
|
|
|
8065
8065
|
}), O.caching && !Zt && console.warn("The cache API is only available in secure contexts. More info at https://developer.mozilla.org/en-US/docs/Web/API/Cache"), O.caching && Zt && Ka(), typeof t.language > "u")
|
|
8066
8066
|
this.primaryLanguage = O.primaryLanguage;
|
|
8067
8067
|
else {
|
|
8068
|
-
const d =
|
|
8068
|
+
const d = Or(t.language, M);
|
|
8069
8069
|
this.primaryLanguage = d ?? O.primaryLanguage;
|
|
8070
8070
|
}
|
|
8071
8071
|
this.forceLanguageUpdate = !(this.primaryLanguage === M.STYLE || this.primaryLanguage === M.STYLE_LOCK), this.languageAlwaysBeenStyle = this.primaryLanguage === M.STYLE, this.terrainExaggeration = t.terrainExaggeration ?? this.terrainExaggeration, this.curentProjection = t.projection, this.on("styledata", () => {
|
|
@@ -8506,7 +8506,7 @@ class zr extends S.Map {
|
|
|
8506
8506
|
* Define the primary language of the map. Note that not all the languages shorthands provided are available.
|
|
8507
8507
|
*/
|
|
8508
8508
|
setPrimaryLanguage(t) {
|
|
8509
|
-
const n = this.getStyleLanguage(), a =
|
|
8509
|
+
const n = this.getStyleLanguage(), a = Or(t, M);
|
|
8510
8510
|
if (!a) {
|
|
8511
8511
|
console.warn(`The language "${a}" is not supported.`);
|
|
8512
8512
|
return;
|
|
@@ -8527,7 +8527,7 @@ class zr extends S.Map {
|
|
|
8527
8527
|
o = n;
|
|
8528
8528
|
}
|
|
8529
8529
|
let i = M.LOCAL.flag, s = ["get", i];
|
|
8530
|
-
o.flag === M.VISITOR.flag ? (i =
|
|
8530
|
+
o.flag === M.VISITOR.flag ? (i = Dr().flag, s = [
|
|
8531
8531
|
"case",
|
|
8532
8532
|
["all", ["has", i], ["has", M.LOCAL.flag]],
|
|
8533
8533
|
[
|
|
@@ -8549,7 +8549,7 @@ class zr extends S.Map {
|
|
|
8549
8549
|
`, ["get", M.LOCAL.flag], { "font-scale": 1.1 }]
|
|
8550
8550
|
],
|
|
8551
8551
|
["get", M.LOCAL.flag]
|
|
8552
|
-
]) : o.flag === M.AUTO.flag ? (i =
|
|
8552
|
+
]) : o.flag === M.AUTO.flag ? (i = Dr().flag, s = ["coalesce", ["get", i], ["get", M.LOCAL.flag]]) : o === M.LOCAL ? (i = M.LOCAL.flag, s = ["get", i]) : (i = o.flag, s = ["coalesce", ["get", i], ["get", M.LOCAL.flag]]);
|
|
8553
8553
|
const { layers: l } = this.getStyle(), u = this.originalLabelStyle.size === 0;
|
|
8554
8554
|
if (u) {
|
|
8555
8555
|
const c = oo(l, this);
|
|
@@ -8685,14 +8685,14 @@ class zr extends S.Map {
|
|
|
8685
8685
|
});
|
|
8686
8686
|
}
|
|
8687
8687
|
async fitToIpBounds() {
|
|
8688
|
-
const t = await
|
|
8688
|
+
const t = await Fr.info();
|
|
8689
8689
|
this.fitBounds(t.country_bounds, {
|
|
8690
8690
|
duration: 0,
|
|
8691
8691
|
padding: 100
|
|
8692
8692
|
});
|
|
8693
8693
|
}
|
|
8694
8694
|
async centerOnIpPoint(t) {
|
|
8695
|
-
const n = await
|
|
8695
|
+
const n = await Fr.info();
|
|
8696
8696
|
this.jumpTo({
|
|
8697
8697
|
center: [n.longitude ?? 0, n.latitude ?? 0],
|
|
8698
8698
|
zoom: t || 11
|
|
@@ -10628,7 +10628,7 @@ const Ol = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
|
10628
10628
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10629
10629
|
Wa();
|
|
10630
10630
|
function Fl() {
|
|
10631
|
-
return "3.2.
|
|
10631
|
+
return "3.2.1rc-1";
|
|
10632
10632
|
}
|
|
10633
10633
|
const Dl = S.Map, ql = S.Marker, Bl = S.Popup, Ul = S.Style, Vl = S.CanvasSource, Gl = S.GeoJSONSource, Hl = S.ImageSource, Kl = S.RasterTileSource, Wl = S.RasterDEMTileSource, Zl = S.VectorTileSource, Jl = S.VideoSource, Yl = S.NavigationControl, Xl = S.GeolocateControl, Ql = S.AttributionControl, eu = S.LogoControl, tu = S.ScaleControl, ru = S.FullscreenControl, nu = S.TerrainControl, au = S.BoxZoomHandler, ou = S.ScrollZoomHandler, iu = S.CooperativeGesturesHandler, su = S.KeyboardHandler, lu = S.TwoFingersTouchPitchHandler, uu = S.MapWheelEvent, cu = S.MapTouchEvent, pu = S.MapMouseEvent, fu = S.config, du = S.getVersion, {
|
|
10634
10634
|
setRTLTextPlugin: yu,
|
|
@@ -10759,7 +10759,7 @@ export {
|
|
|
10759
10759
|
tc as geocoding,
|
|
10760
10760
|
rc as geolocation,
|
|
10761
10761
|
nc as getAutoLanguage,
|
|
10762
|
-
|
|
10762
|
+
Dr as getBrowserLanguage,
|
|
10763
10763
|
ac as getBufferToPixelDataParser,
|
|
10764
10764
|
oc as getLanguageInfoFromCode,
|
|
10765
10765
|
ic as getLanguageInfoFromFlag,
|