@geolonia/maps-core 0.2.0 → 0.4.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.
@@ -51,296 +51,8 @@ __export(index_exports, {
51
51
  });
52
52
  module.exports = __toCommonJS(index_exports);
53
53
 
54
- // node_modules/@mapbox/point-geometry/index.js
55
- function Point(x, y) {
56
- this.x = x;
57
- this.y = y;
58
- }
59
- Point.prototype = {
60
- /**
61
- * Clone this point, returning a new point that can be modified
62
- * without affecting the old one.
63
- * @return {Point} the clone
64
- */
65
- clone() {
66
- return new Point(this.x, this.y);
67
- },
68
- /**
69
- * Add this point's x & y coordinates to another point,
70
- * yielding a new point.
71
- * @param {Point} p the other point
72
- * @return {Point} output point
73
- */
74
- add(p) {
75
- return this.clone()._add(p);
76
- },
77
- /**
78
- * Subtract this point's x & y coordinates to from point,
79
- * yielding a new point.
80
- * @param {Point} p the other point
81
- * @return {Point} output point
82
- */
83
- sub(p) {
84
- return this.clone()._sub(p);
85
- },
86
- /**
87
- * Multiply this point's x & y coordinates by point,
88
- * yielding a new point.
89
- * @param {Point} p the other point
90
- * @return {Point} output point
91
- */
92
- multByPoint(p) {
93
- return this.clone()._multByPoint(p);
94
- },
95
- /**
96
- * Divide this point's x & y coordinates by point,
97
- * yielding a new point.
98
- * @param {Point} p the other point
99
- * @return {Point} output point
100
- */
101
- divByPoint(p) {
102
- return this.clone()._divByPoint(p);
103
- },
104
- /**
105
- * Multiply this point's x & y coordinates by a factor,
106
- * yielding a new point.
107
- * @param {number} k factor
108
- * @return {Point} output point
109
- */
110
- mult(k) {
111
- return this.clone()._mult(k);
112
- },
113
- /**
114
- * Divide this point's x & y coordinates by a factor,
115
- * yielding a new point.
116
- * @param {number} k factor
117
- * @return {Point} output point
118
- */
119
- div(k) {
120
- return this.clone()._div(k);
121
- },
122
- /**
123
- * Rotate this point around the 0, 0 origin by an angle a,
124
- * given in radians
125
- * @param {number} a angle to rotate around, in radians
126
- * @return {Point} output point
127
- */
128
- rotate(a) {
129
- return this.clone()._rotate(a);
130
- },
131
- /**
132
- * Rotate this point around p point by an angle a,
133
- * given in radians
134
- * @param {number} a angle to rotate around, in radians
135
- * @param {Point} p Point to rotate around
136
- * @return {Point} output point
137
- */
138
- rotateAround(a, p) {
139
- return this.clone()._rotateAround(a, p);
140
- },
141
- /**
142
- * Multiply this point by a 4x1 transformation matrix
143
- * @param {[number, number, number, number]} m transformation matrix
144
- * @return {Point} output point
145
- */
146
- matMult(m) {
147
- return this.clone()._matMult(m);
148
- },
149
- /**
150
- * Calculate this point but as a unit vector from 0, 0, meaning
151
- * that the distance from the resulting point to the 0, 0
152
- * coordinate will be equal to 1 and the angle from the resulting
153
- * point to the 0, 0 coordinate will be the same as before.
154
- * @return {Point} unit vector point
155
- */
156
- unit() {
157
- return this.clone()._unit();
158
- },
159
- /**
160
- * Compute a perpendicular point, where the new y coordinate
161
- * is the old x coordinate and the new x coordinate is the old y
162
- * coordinate multiplied by -1
163
- * @return {Point} perpendicular point
164
- */
165
- perp() {
166
- return this.clone()._perp();
167
- },
168
- /**
169
- * Return a version of this point with the x & y coordinates
170
- * rounded to integers.
171
- * @return {Point} rounded point
172
- */
173
- round() {
174
- return this.clone()._round();
175
- },
176
- /**
177
- * Return the magnitude of this point: this is the Euclidean
178
- * distance from the 0, 0 coordinate to this point's x and y
179
- * coordinates.
180
- * @return {number} magnitude
181
- */
182
- mag() {
183
- return Math.sqrt(this.x * this.x + this.y * this.y);
184
- },
185
- /**
186
- * Judge whether this point is equal to another point, returning
187
- * true or false.
188
- * @param {Point} other the other point
189
- * @return {boolean} whether the points are equal
190
- */
191
- equals(other) {
192
- return this.x === other.x && this.y === other.y;
193
- },
194
- /**
195
- * Calculate the distance from this point to another point
196
- * @param {Point} p the other point
197
- * @return {number} distance
198
- */
199
- dist(p) {
200
- return Math.sqrt(this.distSqr(p));
201
- },
202
- /**
203
- * Calculate the distance from this point to another point,
204
- * without the square root step. Useful if you're comparing
205
- * relative distances.
206
- * @param {Point} p the other point
207
- * @return {number} distance
208
- */
209
- distSqr(p) {
210
- const dx = p.x - this.x, dy = p.y - this.y;
211
- return dx * dx + dy * dy;
212
- },
213
- /**
214
- * Get the angle from the 0, 0 coordinate to this point, in radians
215
- * coordinates.
216
- * @return {number} angle
217
- */
218
- angle() {
219
- return Math.atan2(this.y, this.x);
220
- },
221
- /**
222
- * Get the angle from this point to another point, in radians
223
- * @param {Point} b the other point
224
- * @return {number} angle
225
- */
226
- angleTo(b) {
227
- return Math.atan2(this.y - b.y, this.x - b.x);
228
- },
229
- /**
230
- * Get the angle between this point and another point, in radians
231
- * @param {Point} b the other point
232
- * @return {number} angle
233
- */
234
- angleWith(b) {
235
- return this.angleWithSep(b.x, b.y);
236
- },
237
- /**
238
- * Find the angle of the two vectors, solving the formula for
239
- * the cross product a x b = |a||b|sin(θ) for θ.
240
- * @param {number} x the x-coordinate
241
- * @param {number} y the y-coordinate
242
- * @return {number} the angle in radians
243
- */
244
- angleWithSep(x, y) {
245
- return Math.atan2(
246
- this.x * y - this.y * x,
247
- this.x * x + this.y * y
248
- );
249
- },
250
- /** @param {[number, number, number, number]} m */
251
- _matMult(m) {
252
- const x = m[0] * this.x + m[1] * this.y, y = m[2] * this.x + m[3] * this.y;
253
- this.x = x;
254
- this.y = y;
255
- return this;
256
- },
257
- /** @param {Point} p */
258
- _add(p) {
259
- this.x += p.x;
260
- this.y += p.y;
261
- return this;
262
- },
263
- /** @param {Point} p */
264
- _sub(p) {
265
- this.x -= p.x;
266
- this.y -= p.y;
267
- return this;
268
- },
269
- /** @param {number} k */
270
- _mult(k) {
271
- this.x *= k;
272
- this.y *= k;
273
- return this;
274
- },
275
- /** @param {number} k */
276
- _div(k) {
277
- this.x /= k;
278
- this.y /= k;
279
- return this;
280
- },
281
- /** @param {Point} p */
282
- _multByPoint(p) {
283
- this.x *= p.x;
284
- this.y *= p.y;
285
- return this;
286
- },
287
- /** @param {Point} p */
288
- _divByPoint(p) {
289
- this.x /= p.x;
290
- this.y /= p.y;
291
- return this;
292
- },
293
- _unit() {
294
- this._div(this.mag());
295
- return this;
296
- },
297
- _perp() {
298
- const y = this.y;
299
- this.y = this.x;
300
- this.x = -y;
301
- return this;
302
- },
303
- /** @param {number} angle */
304
- _rotate(angle) {
305
- const cos = Math.cos(angle), sin = Math.sin(angle), x = cos * this.x - sin * this.y, y = sin * this.x + cos * this.y;
306
- this.x = x;
307
- this.y = y;
308
- return this;
309
- },
310
- /**
311
- * @param {number} angle
312
- * @param {Point} p
313
- */
314
- _rotateAround(angle, p) {
315
- const cos = Math.cos(angle), sin = Math.sin(angle), x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y), y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
316
- this.x = x;
317
- this.y = y;
318
- return this;
319
- },
320
- _round() {
321
- this.x = Math.round(this.x);
322
- this.y = Math.round(this.y);
323
- return this;
324
- },
325
- constructor: Point
326
- };
327
- Point.convert = function(p) {
328
- if (p instanceof Point) {
329
- return (
330
- /** @type {Point} */
331
- p
332
- );
333
- }
334
- if (Array.isArray(p)) {
335
- return new Point(+p[0], +p[1]);
336
- }
337
- if (p.x !== void 0 && p.y !== void 0) {
338
- return new Point(+p.x, +p.y);
339
- }
340
- throw new Error("Expected [x, y] or {x, y} point format");
341
- };
342
-
343
54
  // src/lib/maplibre-util.ts
55
+ var import_maplibre_gl = require("maplibre-gl");
344
56
  var _docStyle, _userSelect, _selectProp, _transformProp;
345
57
  var _DOM = class _DOM {
346
58
  static testProp(props) {
@@ -391,7 +103,7 @@ var _DOM = class _DOM {
391
103
  }
392
104
  static mousePos(el, e) {
393
105
  const rect = el.getBoundingClientRect();
394
- return new Point(
106
+ return new import_maplibre_gl.Point(
395
107
  e.clientX - rect.left - el.clientLeft,
396
108
  e.clientY - rect.top - el.clientTop
397
109
  );
@@ -401,7 +113,7 @@ var _DOM = class _DOM {
401
113
  const points = [];
402
114
  for (let i = 0; i < touches.length; i++) {
403
115
  points.push(
404
- new Point(
116
+ new import_maplibre_gl.Point(
405
117
  touches[i].clientX - rect.left - el.clientLeft,
406
118
  touches[i].clientY - rect.top - el.clientTop
407
119
  )
@@ -561,7 +273,6 @@ var ATTRIBUTION_CSS = `
561
273
  `;
562
274
  var CustomAttributionControl = class {
563
275
  constructor(options = {}) {
564
- this._editLink = null;
565
276
  this.options = options;
566
277
  bindAll(
567
278
  [
@@ -611,8 +322,8 @@ var CustomAttributionControl = class {
611
322
  this.printQuery = window.matchMedia("print");
612
323
  this.onMediaPrintChange = (e) => {
613
324
  if (e.matches) {
614
- this._shadowContainer.setAttribute("open", "");
615
- this._shadowContainer.classList.remove("maplibregl-compact-show");
325
+ this._shadowContainer?.setAttribute("open", "");
326
+ this._shadowContainer?.classList.remove("maplibregl-compact-show");
616
327
  }
617
328
  };
618
329
  this.printQuery.addEventListener("change", this.onMediaPrintChange);
@@ -660,7 +371,7 @@ var CustomAttributionControl = class {
660
371
  }
661
372
  }
662
373
  _updateAttributions() {
663
- if (!this._map || !this._map.style) return;
374
+ if (!this._map?.style) return;
664
375
  let attributions = [];
665
376
  if (this.options.customAttribution) {
666
377
  if (Array.isArray(this.options.customAttribution)) {
@@ -673,11 +384,6 @@ var CustomAttributionControl = class {
673
384
  attributions.push(this.options.customAttribution);
674
385
  }
675
386
  }
676
- if (this._map.style.stylesheet) {
677
- const stylesheet = this._map.style.stylesheet;
678
- this.styleOwner = stylesheet.owner;
679
- this.styleId = stylesheet.id;
680
- }
681
387
  const sourceCaches = this._map.style.sourceCaches;
682
388
  for (const id in sourceCaches) {
683
389
  const sourceCache = sourceCaches[id];
@@ -702,13 +408,12 @@ var CustomAttributionControl = class {
702
408
  if (attribHTML === this._attribHTML) return;
703
409
  this._attribHTML = attribHTML;
704
410
  if (attributions.length) {
705
- this._innerContainer.innerHTML = attribHTML;
706
- this._shadowContainer.classList.remove("maplibregl-attrib-empty");
411
+ if (this._innerContainer) this._innerContainer.innerHTML = attribHTML;
412
+ this._shadowContainer?.classList.remove("maplibregl-attrib-empty");
707
413
  } else {
708
- this._shadowContainer.classList.add("maplibregl-attrib-empty");
414
+ this._shadowContainer?.classList.add("maplibregl-attrib-empty");
709
415
  }
710
416
  this._updateCompact();
711
- this._editLink = null;
712
417
  }
713
418
  _updateCompact() {
714
419
  if (!this._map || !this._shadowContainer) return;
@@ -774,11 +479,11 @@ var GeoloniaControl = class {
774
479
  };
775
480
 
776
481
  // src/lib/geolonia-map.ts
777
- var import_maplibre_gl4 = __toESM(require("maplibre-gl"), 1);
482
+ var import_maplibre_gl5 = __toESM(require("maplibre-gl"), 1);
778
483
  var import_pmtiles = require("pmtiles");
779
484
 
780
485
  // src/lib/geolonia-marker.ts
781
- var import_maplibre_gl = __toESM(require("maplibre-gl"), 1);
486
+ var import_maplibre_gl2 = __toESM(require("maplibre-gl"), 1);
782
487
  var import_tinycolor2 = __toESM(require("tinycolor2"), 1);
783
488
  var MARKER_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 67">
784
489
  <path class="left" d="M26 0C11.664 0 0 11.663 0 26c0 22.14 26 41 26 41V26h0C26 11.663 26 0 26 0z" fill="#E4402F"/>
@@ -786,7 +491,7 @@ var MARKER_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 67">
786
491
  <circle cx="26" cy="26" r="9" fill="#FFF"/>
787
492
  </svg>`;
788
493
  var DEFAULT_COLOR = "#E4402F";
789
- var GeoloniaMarker = class extends import_maplibre_gl.default.Marker {
494
+ var GeoloniaMarker = class extends import_maplibre_gl2.default.Marker {
790
495
  constructor(options = {}) {
791
496
  if (!options.element) {
792
497
  const markerElement = document.createElement("div");
@@ -814,9 +519,9 @@ var GeoloniaMarker = class extends import_maplibre_gl.default.Marker {
814
519
  };
815
520
 
816
521
  // src/lib/simplestyle.ts
817
- var import_geojson_extent = __toESM(require("@mapbox/geojson-extent"), 1);
522
+ var import_bbox = __toESM(require("@turf/bbox"), 1);
818
523
  var import_center = __toESM(require("@turf/center"), 1);
819
- var import_maplibre_gl2 = __toESM(require("maplibre-gl"), 1);
524
+ var import_maplibre_gl3 = __toESM(require("maplibre-gl"), 1);
820
525
 
821
526
  // src/lib/keyring.ts
822
527
  var _apiKey, _stage, _isGeoloniaStyle;
@@ -862,6 +567,12 @@ var Keyring = class {
862
567
  if (style.match(/^https?:\/\//)) {
863
568
  return false;
864
569
  }
570
+ if (style.startsWith("geolonia://")) {
571
+ return true;
572
+ }
573
+ if (style.match(/^[a-z][a-z0-9+.-]*:\/\//i)) {
574
+ return false;
575
+ }
865
576
  if (style.endsWith(".json")) {
866
577
  return false;
867
578
  }
@@ -902,7 +613,7 @@ function getStyle(style, options) {
902
613
  throw new Error("[Geolonia] API key is required to use Geolonia styles.");
903
614
  }
904
615
  if (!style || style === "") {
905
- return `https://cdn.geolonia.com/style/geolonia/basic-v2/${lang === "ja" ? "ja" : "en"}.json`;
616
+ return `https://cdn.geolonia.com/style/geolonia/basic-v2/${lang === "ja" || lang === "ja-jp" ? "ja" : "en"}.json`;
906
617
  }
907
618
  const styleUrl = isURL(style);
908
619
  if (styleUrl) {
@@ -915,7 +626,7 @@ function getStyle(style, options) {
915
626
  return style;
916
627
  }
917
628
  }
918
- return `https://cdn.geolonia.com/style/${style}/${lang === "ja" ? "ja" : "en"}.json`;
629
+ return `https://cdn.geolonia.com/style/${style}/${lang === "ja" || lang === "ja-jp" ? "ja" : "en"}.json`;
919
630
  }
920
631
  function getLang() {
921
632
  if (typeof globalThis.navigator === "undefined") {
@@ -1029,14 +740,16 @@ var SimpleStyle = class {
1029
740
  const points = features.filter(
1030
741
  (feature) => feature.geometry.type.toLowerCase() === "point"
1031
742
  );
1032
- this.map.getSource(this.options.id).setData({
743
+ this.map.getSource(this.options.id)?.setData({
1033
744
  type: "FeatureCollection",
1034
745
  features: polygonAndLines
1035
746
  });
1036
- this.map.getSource(`${this.options.id}-points`).setData({
1037
- type: "FeatureCollection",
1038
- features: points
1039
- });
747
+ this.map.getSource(`${this.options.id}-points`)?.setData(
748
+ {
749
+ type: "FeatureCollection",
750
+ features: points
751
+ }
752
+ );
1040
753
  return this;
1041
754
  }
1042
755
  addTo(map) {
@@ -1123,7 +836,7 @@ var SimpleStyle = class {
1123
836
  padding: 30,
1124
837
  ...options
1125
838
  };
1126
- const bounds = (0, import_geojson_extent.default)(this.geojson);
839
+ const bounds = this.geojson.features.length > 0 ? (0, import_bbox.default)(this.geojson) : void 0;
1127
840
  if (bounds) {
1128
841
  window.requestAnimationFrame(() => {
1129
842
  this.map.fitBounds(bounds, _options);
@@ -1232,15 +945,16 @@ var SimpleStyle = class {
1232
945
  }
1233
946
  async setPopup(map, source) {
1234
947
  const clickHandler = async (e) => {
948
+ if (!e.features?.[0]) return;
1235
949
  const center = (0, import_center.default)(e.features[0]).geometry.coordinates;
1236
- const description = e.features[0].properties.description;
950
+ const description = e.features[0].properties?.description;
1237
951
  if (description) {
1238
952
  const sanitizedDescription = await sanitizeDescription(description);
1239
- new import_maplibre_gl2.default.Popup().setLngLat(center).setHTML(sanitizedDescription).addTo(map);
953
+ new import_maplibre_gl3.default.Popup().setLngLat(center).setHTML(sanitizedDescription).addTo(map);
1240
954
  }
1241
955
  };
1242
956
  const mouseEnterHandler = (e) => {
1243
- if (e.features[0].properties.description) {
957
+ if (e.features?.[0]?.properties?.description) {
1244
958
  map.getCanvas().style.cursor = "pointer";
1245
959
  }
1246
960
  };
@@ -1287,8 +1001,13 @@ var SimpleStyle = class {
1287
1001
  const features = this.map.queryRenderedFeatures(e.point, {
1288
1002
  layers: [clusterLayer]
1289
1003
  });
1290
- const clusterId = features[0].properties.cluster_id;
1291
- const zoom = await this.map.getSource(`${this.options.id}-points`).getClusterExpansionZoom(clusterId);
1004
+ if (!features[0]) return;
1005
+ const clusterId = features[0].properties?.cluster_id;
1006
+ if (clusterId === void 0) return;
1007
+ const source = this.map.getSource(
1008
+ `${this.options.id}-points`
1009
+ );
1010
+ const zoom = await source.getClusterExpansionZoom(clusterId);
1292
1011
  this.map.easeTo({
1293
1012
  center: features[0].geometry.coordinates,
1294
1013
  zoom
@@ -1353,7 +1072,7 @@ var SimpleStyle = class {
1353
1072
  const fetchGeoJSON = async () => {
1354
1073
  try {
1355
1074
  const response = await window.fetch(geojson);
1356
- const data = response.ok ? await response.json() : {};
1075
+ const data = response.ok ? await response.json() : template;
1357
1076
  this.geojson = data;
1358
1077
  this.updateData(data);
1359
1078
  if (this.callFitBounds) {
@@ -1365,7 +1084,7 @@ var SimpleStyle = class {
1365
1084
  }
1366
1085
  };
1367
1086
  this._loadingPromise = fetchGeoJSON();
1368
- } else {
1087
+ } else if (typeof geojson !== "string") {
1369
1088
  this.geojson = geojson;
1370
1089
  }
1371
1090
  }
@@ -1373,7 +1092,7 @@ var SimpleStyle = class {
1373
1092
 
1374
1093
  // src/lib/simplestyle-vector.ts
1375
1094
  var import_center2 = __toESM(require("@turf/center"), 1);
1376
- var import_maplibre_gl3 = __toESM(require("maplibre-gl"), 1);
1095
+ var import_maplibre_gl4 = __toESM(require("maplibre-gl"), 1);
1377
1096
  var textColor2 = "#000000";
1378
1097
  var textHaloColor2 = "#FFFFFF";
1379
1098
  var backgroundColor2 = "rgba(255, 0, 0, 0.4)";
@@ -1383,7 +1102,6 @@ var SimpleStyleVector = class {
1383
1102
  this.url = url;
1384
1103
  this.sourceName = "vt-geolonia-simple-style";
1385
1104
  }
1386
- /* eslint-disable @typescript-eslint/no-explicit-any */
1387
1105
  addTo(map) {
1388
1106
  const container = map.getContainer();
1389
1107
  if (!container.dataset || !container.dataset.lng && !container.dataset.lat) {
@@ -1393,7 +1111,7 @@ var SimpleStyleVector = class {
1393
1111
  return;
1394
1112
  }
1395
1113
  const source = map.getSource(event.sourceId);
1396
- const isLoaded = source && source.loaded();
1114
+ const isLoaded = source?.loaded();
1397
1115
  if (isLoaded !== true) {
1398
1116
  return;
1399
1117
  }
@@ -1401,10 +1119,13 @@ var SimpleStyleVector = class {
1401
1119
  return;
1402
1120
  }
1403
1121
  initialZoomDone = true;
1404
- map.fitBounds(source.bounds, {
1405
- duration: 0,
1406
- padding: 30
1407
- });
1122
+ map.fitBounds(
1123
+ source.bounds,
1124
+ {
1125
+ duration: 0,
1126
+ padding: 30
1127
+ }
1128
+ );
1408
1129
  });
1409
1130
  }
1410
1131
  map.addSource(this.sourceName, {
@@ -1572,15 +1293,16 @@ var SimpleStyleVector = class {
1572
1293
  }
1573
1294
  async setPopup(map, source) {
1574
1295
  map.on("click", source, async (e) => {
1296
+ if (!e.features?.[0]) return;
1575
1297
  const center = (0, import_center2.default)(e.features[0]).geometry.coordinates;
1576
- const description = e.features[0].properties.description;
1298
+ const description = e.features[0].properties?.description;
1577
1299
  if (description) {
1578
1300
  const sanitizedDescription = await sanitizeDescription(description);
1579
- new import_maplibre_gl3.default.Popup().setLngLat(center).setHTML(sanitizedDescription).addTo(map);
1301
+ new import_maplibre_gl4.default.Popup().setLngLat(center).setHTML(sanitizedDescription).addTo(map);
1580
1302
  }
1581
1303
  });
1582
1304
  map.on("mouseenter", source, (e) => {
1583
- if (e.features[0].properties.description) {
1305
+ if (e.features?.[0]?.properties?.description) {
1584
1306
  map.getCanvas().style.cursor = "pointer";
1585
1307
  }
1586
1308
  });
@@ -1597,9 +1319,10 @@ function ensurePMTiles() {
1597
1319
  if (pmtilesRegistered) return;
1598
1320
  pmtilesRegistered = true;
1599
1321
  const protocol = new import_pmtiles.Protocol();
1600
- import_maplibre_gl4.default.addProtocol("pmtiles", protocol.tile);
1322
+ import_maplibre_gl5.default.addProtocol("pmtiles", protocol.tile);
1601
1323
  }
1602
- var GeoloniaMap = class extends import_maplibre_gl4.default.Map {
1324
+ var GeoloniaMap = class extends import_maplibre_gl5.default.Map {
1325
+ // biome-ignore lint/correctness/noUnreachableSuper: intentional singleton pattern - returns existing map instance before super()
1603
1326
  constructor(options) {
1604
1327
  ensurePMTiles();
1605
1328
  if (options.apiKey) {
@@ -1728,24 +1451,24 @@ var GeoloniaMap = class extends import_maplibre_gl4.default.Map {
1728
1451
  const fullscreen = parseControlOption(options.fullscreenControl ?? false);
1729
1452
  if (fullscreen.enabled) {
1730
1453
  this.addControl(
1731
- new import_maplibre_gl4.FullscreenControl(),
1454
+ new import_maplibre_gl5.FullscreenControl(),
1732
1455
  fullscreen.position
1733
1456
  );
1734
1457
  }
1735
1458
  const nav = parseControlOption(options.navigationControl ?? true);
1736
1459
  if (nav.enabled) {
1737
- this.addControl(new import_maplibre_gl4.NavigationControl(), nav.position);
1460
+ this.addControl(new import_maplibre_gl5.NavigationControl(), nav.position);
1738
1461
  }
1739
1462
  const geolocate = parseControlOption(options.geolocateControl ?? false);
1740
1463
  if (geolocate.enabled) {
1741
1464
  this.addControl(
1742
- new import_maplibre_gl4.GeolocateControl({}),
1465
+ new import_maplibre_gl5.GeolocateControl({}),
1743
1466
  geolocate.position
1744
1467
  );
1745
1468
  }
1746
1469
  const scale = parseControlOption(options.scaleControl ?? false);
1747
1470
  if (scale.enabled) {
1748
- this.addControl(new import_maplibre_gl4.ScaleControl({}), scale.position);
1471
+ this.addControl(new import_maplibre_gl5.ScaleControl({}), scale.position);
1749
1472
  }
1750
1473
  this.on("load", (event) => {
1751
1474
  const map = event.target;
@@ -1756,12 +1479,12 @@ var GeoloniaMap = class extends import_maplibre_gl4.default.Map {
1756
1479
  }
1757
1480
  }
1758
1481
  if (options.gestureHandling !== false) {
1759
- import("@geolonia/mbgl-gesture-handling").then(({ default: GestureHandling }) => {
1482
+ import("@geolonia/maplibre-gesture-handling").then(({ default: GestureHandling }) => {
1760
1483
  const body = document.body;
1761
1484
  const html = document.documentElement;
1762
1485
  const isScrollable = body.scrollHeight > body.clientHeight || html.scrollHeight > html.clientHeight;
1763
1486
  if (isScrollable) {
1764
- new GestureHandling({ lang }).addTo(map);
1487
+ map.addControl(new GestureHandling({ lang }));
1765
1488
  }
1766
1489
  }).catch(() => {
1767
1490
  });
@@ -1788,7 +1511,7 @@ var GeoloniaMap = class extends import_maplibre_gl4.default.Map {
1788
1511
  }
1789
1512
  const content = container.dataset?.popupContent;
1790
1513
  if (content) {
1791
- const popup = new import_maplibre_gl4.Popup({ offset: [0, -25] }).setHTML(content);
1514
+ const popup = new import_maplibre_gl5.Popup({ offset: [0, -25] }).setHTML(content);
1792
1515
  marker.setPopup(popup);
1793
1516
  if (options.openPopup) {
1794
1517
  marker.togglePopup();