@classic-homes/maps-react 0.2.4 → 0.2.6

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import * as React25 from 'react';
1
+ import * as React26 from 'react';
2
2
  import { useState, useEffect, useCallback } from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import { twMerge } from 'tailwind-merge';
@@ -7,8 +7,8 @@ import maplibregl from 'maplibre-gl';
7
7
  import 'maplibre-gl/dist/maplibre-gl.css';
8
8
  import '@classic-homes/maps-core/styles/controls.css';
9
9
  import '@classic-homes/maps-core/styles/marker.css';
10
- import { generateMapDescription, applyMarkerProtection, applyMarkerChildProtection, removeMarkerProtection, darkBasicStyle, lightBasicStyle, darkTheme, lightTheme, THEME_DARK, THEME_LIGHT, calculateBounds, computeVerticalOffsetStyle, computePositionClasses, formatCoordinates, getAvailableBasemaps, FREE_BASEMAPS, resolveBasemapThumbnail, createInitialLayerStates, getLayerCategories, searchLayers, groupLayersByCategory, toggleLayerVisibility, setLayerOpacity, getLayerStatesArray, reorderLayers, CATEGORY_META, resolveBasemapStyle, getLayerStyleForTheme, resolveLayerSourceUrl } from '@classic-homes/maps-core';
11
- export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, FLOOD_ZONES, FREE_BASEMAPS, OSM_STANDARD, PARKS, SCHOOL_DISTRICTS, SPORTS_FACILITIES, THEME_DARK, THEME_LIGHT, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
10
+ import { createPositioningCoordinator, generateMapDescription, applyMarkerProtection, applyMarkerChildProtection, removeMarkerProtection, DEFAULT_BASEMAP, darkTheme, lightTheme, THEME_DARK, THEME_LIGHT, calculateBounds, EDGE_MARGIN, formatCoordinates, getAvailableBasemaps, FREE_BASEMAPS, resolveBasemapThumbnail, createInitialLayerStates, getLayerCategories, searchLayers, groupLayersByCategory, toggleLayerVisibility, setLayerOpacity, getLayerStatesArray, reorderLayers, CATEGORY_META, resolveBasemapStyle, STACK_GAP, getLayerStyleForTheme, resolveLayerSourceUrl } from '@classic-homes/maps-core';
11
+ export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, DEFAULT_BASEMAP, FLOOD_ZONES, FREE_BASEMAPS, OSM_STANDARD, PARKS, PRIMARY_BASEMAPS, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
12
12
  import * as ReactDOM from 'react-dom';
13
13
  import { cva } from 'class-variance-authority';
14
14
  import '@classic-homes/maps-core/styles/basemap-switcher.css';
@@ -19,7 +19,7 @@ import { Switch } from '@classic-homes/theme-react';
19
19
  function cn(...inputs) {
20
20
  return twMerge(clsx(inputs));
21
21
  }
22
- var MapSkeleton = React25.forwardRef(
22
+ var MapSkeleton = React26.forwardRef(
23
23
  ({ height = 400, className, ...props }, ref) => {
24
24
  const heightStyle = typeof height === "number" ? `${height}px` : height;
25
25
  return /* @__PURE__ */ jsxs(
@@ -73,7 +73,7 @@ var MapSkeleton = React25.forwardRef(
73
73
  }
74
74
  );
75
75
  MapSkeleton.displayName = "MapSkeleton";
76
- var MapError = React25.forwardRef(
76
+ var MapError = React26.forwardRef(
77
77
  ({ message = "Failed to load map", height = 400, onRetry, className, ...props }, ref) => {
78
78
  const heightStyle = typeof height === "number" ? `${height}px` : height;
79
79
  return /* @__PURE__ */ jsx(
@@ -129,7 +129,7 @@ var MapError = React25.forwardRef(
129
129
  }
130
130
  );
131
131
  MapError.displayName = "MapError";
132
- var MapEmpty = React25.forwardRef(
132
+ var MapEmpty = React26.forwardRef(
133
133
  ({ message = "No map data to display", height = 400, className, ...props }, ref) => {
134
134
  const heightStyle = typeof height === "number" ? `${height}px` : height;
135
135
  return /* @__PURE__ */ jsx(
@@ -172,7 +172,7 @@ var MapEmpty = React25.forwardRef(
172
172
  }
173
173
  );
174
174
  MapEmpty.displayName = "MapEmpty";
175
- var MapContainer = React25.forwardRef(
175
+ var MapContainer = React26.forwardRef(
176
176
  ({
177
177
  title,
178
178
  description,
@@ -257,7 +257,8 @@ function useMapTheme(preference = "auto") {
257
257
  return {
258
258
  themeName: isDark ? THEME_DARK : THEME_LIGHT,
259
259
  theme: isDark ? darkTheme : lightTheme,
260
- style: isDark ? darkBasicStyle : lightBasicStyle,
260
+ // Use the default MapTiler basemap style (works well for both light and dark modes)
261
+ style: DEFAULT_BASEMAP.style,
261
262
  isDark
262
263
  };
263
264
  }
@@ -277,9 +278,9 @@ function useReducedMotion() {
277
278
  }, []);
278
279
  return prefersReducedMotion2;
279
280
  }
280
- var MapContext = React25.createContext(null);
281
+ var MapContext = React26.createContext(null);
281
282
  function useMap() {
282
- const context = React25.useContext(MapContext);
283
+ const context = React26.useContext(MapContext);
283
284
  if (!context) {
284
285
  throw new Error("useMap must be used within a Map component");
285
286
  }
@@ -289,7 +290,7 @@ function useMapInstance() {
289
290
  const { map, loaded } = useMap();
290
291
  return loaded ? map : null;
291
292
  }
292
- var Map2 = React25.forwardRef(
293
+ var Map2 = React26.forwardRef(
293
294
  ({
294
295
  // Base props
295
296
  title,
@@ -343,108 +344,56 @@ var Map2 = React25.forwardRef(
343
344
  onZoom,
344
345
  onError
345
346
  }, ref) => {
346
- const containerRef = React25.useRef(null);
347
- const mapRef = React25.useRef(null);
348
- const [mapLoaded, setMapLoaded] = React25.useState(false);
349
- const [mapError, setMapError] = React25.useState(null);
350
- const [styleVersion, setStyleVersion] = React25.useState(0);
351
- const activeStyleOverrideRef = React25.useRef(
347
+ const containerRef = React26.useRef(null);
348
+ const mapRef = React26.useRef(null);
349
+ const [mapLoaded, setMapLoaded] = React26.useState(false);
350
+ const [mapError, setMapError] = React26.useState(null);
351
+ const [styleVersion, setStyleVersion] = React26.useState(0);
352
+ const activeStyleOverrideRef = React26.useRef(
352
353
  null
353
354
  );
354
- const setMapStyle = React25.useCallback((style) => {
355
+ const positioningCoordinatorRef = React26.useRef(null);
356
+ if (!positioningCoordinatorRef.current) {
357
+ positioningCoordinatorRef.current = createPositioningCoordinator();
358
+ }
359
+ const positioningCoordinator = positioningCoordinatorRef.current;
360
+ const setMapStyle = React26.useCallback((style) => {
355
361
  activeStyleOverrideRef.current = style;
356
362
  mapRef.current?.setStyle(style);
357
363
  }, []);
358
- const customControlRegistryRef = React25.useRef({
359
- "top-left": [],
360
- "top-right": [],
361
- "bottom-left": [],
362
- "bottom-right": []
363
- });
364
- const [, forceUpdate] = React25.useReducer((x) => x + 1, 0);
365
364
  const prefersReducedMotion2 = useReducedMotion();
366
365
  const { style: themeStyle } = useMapTheme(themePref);
367
- const onLoadRef = React25.useRef(onLoad);
366
+ const onLoadRef = React26.useRef(onLoad);
368
367
  onLoadRef.current = onLoad;
369
- const onErrorRef = React25.useRef(onError);
368
+ const onErrorRef = React26.useRef(onError);
370
369
  onErrorRef.current = onError;
371
370
  const mapStyle = customStyle || themeStyle;
372
- const controlOffsets = React25.useMemo(() => {
373
- const offsets = {
374
- "top-left": 0,
375
- "top-right": 0,
376
- "bottom-left": 0,
377
- "bottom-right": 0
378
- };
379
- if (navigationControl) {
380
- offsets[navigationControlPosition] += 100;
381
- }
382
- if (scaleControl) {
383
- offsets[scaleControlPosition] += 28;
384
- }
385
- if (fullscreenControl) {
386
- offsets[fullscreenControlPosition] += 38;
387
- }
388
- if (geolocateControl) {
389
- offsets[geolocateControlPosition] += 38;
390
- }
391
- if (attributionControl) {
392
- offsets["bottom-right"] += 32;
393
- }
394
- return offsets;
395
- }, [
396
- navigationControl,
397
- navigationControlPosition,
398
- scaleControl,
399
- scaleControlPosition,
400
- fullscreenControl,
401
- fullscreenControlPosition,
402
- geolocateControl,
403
- geolocateControlPosition,
404
- attributionControl
405
- ]);
406
- const registerControl = React25.useCallback(
407
- (id, position, height2) => {
408
- const registry = customControlRegistryRef.current;
409
- const positionControls = registry[position] || [];
410
- const existingIndex = positionControls.findIndex((c) => c.id === id);
411
- if (existingIndex >= 0) {
412
- positionControls[existingIndex].height = height2;
413
- } else {
414
- positionControls.push({ id, height: height2 });
415
- forceUpdate();
416
- }
417
- registry[position] = positionControls;
418
- let offset = 0;
419
- for (const control of positionControls) {
420
- if (control.id === id) break;
421
- offset += control.height + 8;
422
- }
423
- return offset;
424
- },
425
- []
426
- );
427
- const unregisterControl = React25.useCallback((id, position) => {
428
- const registry = customControlRegistryRef.current;
429
- const positionControls = registry[position] || [];
430
- registry[position] = positionControls.filter((c) => c.id !== id);
431
- forceUpdate();
432
- }, []);
433
- const getCustomControlOffset = React25.useCallback((id, position) => {
434
- const registry = customControlRegistryRef.current;
435
- const positionControls = registry[position] || [];
436
- let offset = 0;
437
- for (const control of positionControls) {
438
- if (control.id === id) break;
439
- offset += control.height + 8;
440
- }
441
- return offset;
442
- }, []);
443
371
  const accessibleDescription = description || generateMapDescription(title, {
444
372
  center,
445
373
  zoom
446
374
  });
447
- React25.useEffect(() => {
375
+ React26.useEffect(() => {
376
+ if (!containerRef.current || !positioningCoordinator) return;
377
+ const updateDimensions = () => {
378
+ if (!containerRef.current) return;
379
+ positioningCoordinator.setMapDimensions({
380
+ width: containerRef.current.offsetWidth,
381
+ height: containerRef.current.offsetHeight
382
+ });
383
+ };
384
+ updateDimensions();
385
+ const resizeObserver = new ResizeObserver(updateDimensions);
386
+ resizeObserver.observe(containerRef.current);
387
+ return () => {
388
+ resizeObserver.disconnect();
389
+ };
390
+ }, [positioningCoordinator]);
391
+ React26.useEffect(() => {
392
+ return () => {
393
+ positioningCoordinator.destroy();
394
+ };
395
+ }, [positioningCoordinator]);
396
+ React26.useEffect(() => {
448
397
  if (!containerRef.current || mapRef.current) return;
449
398
  try {
450
399
  const map = new maplibregl.Map({
@@ -479,12 +428,45 @@ var Map2 = React25.forwardRef(
479
428
  }),
480
429
  navigationControlPosition
481
430
  );
431
+ positioningCoordinator.register({
432
+ id: "maplibre-navigation-control",
433
+ type: "navigation",
434
+ isBuiltIn: true,
435
+ dimensions: { width: 29, height: 91 },
436
+ position: {
437
+ primary: navigationControlPosition
438
+ },
439
+ priority: "critical",
440
+ zLayer: "base"
441
+ });
482
442
  }
483
443
  if (scaleControl) {
484
444
  map.addControl(new maplibregl.ScaleControl({ unit: "metric" }), scaleControlPosition);
445
+ positioningCoordinator.register({
446
+ id: "maplibre-scale-control",
447
+ type: "scale",
448
+ isBuiltIn: true,
449
+ dimensions: { width: 100, height: 20 },
450
+ position: {
451
+ primary: scaleControlPosition
452
+ },
453
+ priority: "critical",
454
+ zLayer: "base"
455
+ });
485
456
  }
486
457
  if (fullscreenControl) {
487
458
  map.addControl(new maplibregl.FullscreenControl(), fullscreenControlPosition);
459
+ positioningCoordinator.register({
460
+ id: "maplibre-fullscreen-control",
461
+ type: "custom",
462
+ isBuiltIn: true,
463
+ dimensions: { width: 29, height: 29 },
464
+ position: {
465
+ primary: fullscreenControlPosition
466
+ },
467
+ priority: "critical",
468
+ zLayer: "base"
469
+ });
488
470
  }
489
471
  if (geolocateControl) {
490
472
  map.addControl(
@@ -494,6 +476,17 @@ var Map2 = React25.forwardRef(
494
476
  }),
495
477
  geolocateControlPosition
496
478
  );
479
+ positioningCoordinator.register({
480
+ id: "maplibre-geolocate-control",
481
+ type: "custom",
482
+ isBuiltIn: true,
483
+ dimensions: { width: 29, height: 29 },
484
+ position: {
485
+ primary: geolocateControlPosition
486
+ },
487
+ priority: "critical",
488
+ zLayer: "base"
489
+ });
497
490
  }
498
491
  map.on("load", () => {
499
492
  setMapLoaded(true);
@@ -524,8 +517,8 @@ var Map2 = React25.forwardRef(
524
517
  onErrorRef.current?.({ type: "error", message: errorMessage, error: err });
525
518
  }
526
519
  }, []);
527
- const styleInitialized = React25.useRef(false);
528
- React25.useEffect(() => {
520
+ const styleInitialized = React26.useRef(false);
521
+ React26.useEffect(() => {
529
522
  if (!mapRef.current || !mapLoaded) return;
530
523
  if (!styleInitialized.current) {
531
524
  styleInitialized.current = true;
@@ -534,12 +527,12 @@ var Map2 = React25.forwardRef(
534
527
  if (activeStyleOverrideRef.current) return;
535
528
  mapRef.current.setStyle(mapStyle);
536
529
  }, [mapStyle, mapLoaded]);
537
- React25.useEffect(() => {
530
+ React26.useEffect(() => {
538
531
  if (customStyle) {
539
532
  activeStyleOverrideRef.current = null;
540
533
  }
541
534
  }, [customStyle]);
542
- React25.useEffect(() => {
535
+ React26.useEffect(() => {
543
536
  const map = mapRef.current;
544
537
  if (!map || !mapLoaded) return;
545
538
  const createEventParams = (e) => ({
@@ -656,12 +649,9 @@ var Map2 = React25.forwardRef(
656
649
  value: {
657
650
  map: mapRef.current,
658
651
  loaded: mapLoaded,
659
- controlOffsets,
660
- registerControl,
661
- unregisterControl,
662
- getCustomControlOffset,
663
652
  styleVersion,
664
- setMapStyle
653
+ setMapStyle,
654
+ positioningCoordinator
665
655
  },
666
656
  children: [
667
657
  /* @__PURE__ */ jsx("div", { ref: containerRef, className: "absolute inset-0" }),
@@ -694,9 +684,9 @@ var Source = ({
694
684
  children
695
685
  }) => {
696
686
  const { map, loaded, styleVersion } = useMap();
697
- const sourceAdded = React25.useRef(false);
698
- const initialFitDone = React25.useRef(false);
699
- const fitBoundsParamsRef = React25.useRef({
687
+ const initialFitDone = React26.useRef(false);
688
+ const lastStyleVersionRef = React26.useRef(styleVersion);
689
+ const fitBoundsParamsRef = React26.useRef({
700
690
  shouldFitBounds,
701
691
  data,
702
692
  fitBoundsPadding,
@@ -712,7 +702,7 @@ var Source = ({
712
702
  fitBoundsAnimate,
713
703
  type
714
704
  };
715
- const performFitBounds = React25.useCallback(
705
+ const performFitBounds = React26.useCallback(
716
706
  (cancelledRef) => {
717
707
  const params = fitBoundsParamsRef.current;
718
708
  if (cancelledRef.current || !params.shouldFitBounds || initialFitDone.current) return;
@@ -756,10 +746,13 @@ var Source = ({
756
746
  },
757
747
  [map]
758
748
  );
759
- React25.useEffect(() => {
760
- if (!map || !loaded || sourceAdded.current) return;
749
+ React26.useEffect(() => {
750
+ if (!map || !loaded) return;
751
+ if (styleVersion !== lastStyleVersionRef.current) {
752
+ lastStyleVersionRef.current = styleVersion;
753
+ initialFitDone.current = false;
754
+ }
761
755
  if (map.getSource(id)) {
762
- sourceAdded.current = true;
763
756
  return;
764
757
  }
765
758
  try {
@@ -846,7 +839,6 @@ var Source = ({
846
839
  };
847
840
  map.once("idle", handleIdle);
848
841
  map.addSource(id, sourceConfig);
849
- sourceAdded.current = true;
850
842
  const source = map.getSource(id);
851
843
  if (source && map.isSourceLoaded(id)) {
852
844
  map.off("sourcedata", handleSourceData);
@@ -864,7 +856,7 @@ var Source = ({
864
856
  };
865
857
  return () => {
866
858
  cleanupListeners();
867
- if (map && sourceAdded.current) {
859
+ if (map) {
868
860
  try {
869
861
  const style = map.getStyle();
870
862
  if (style?.layers) {
@@ -881,7 +873,6 @@ var Source = ({
881
873
  }
882
874
  } catch {
883
875
  }
884
- sourceAdded.current = false;
885
876
  }
886
877
  };
887
878
  } catch (err) {
@@ -906,8 +897,8 @@ var Source = ({
906
897
  styleVersion
907
898
  // re-add source after basemap style changes
908
899
  ]);
909
- React25.useEffect(() => {
910
- if (!map || !loaded || !sourceAdded.current || type !== "geojson") return;
900
+ React26.useEffect(() => {
901
+ if (!map || !loaded || type !== "geojson") return;
911
902
  const source = map.getSource(id);
912
903
  if (!source) return;
913
904
  let cancelled = false;
@@ -938,7 +929,7 @@ var Source = ({
938
929
  return /* @__PURE__ */ jsx(Fragment, { children });
939
930
  };
940
931
  Source.displayName = "Source";
941
- var Marker = React25.forwardRef(
932
+ var Marker = React26.forwardRef(
942
933
  ({
943
934
  id,
944
935
  coordinates,
@@ -954,27 +945,27 @@ var Marker = React25.forwardRef(
954
945
  children
955
946
  }, ref) => {
956
947
  const { map, loaded } = useMap();
957
- const markerRef = React25.useRef(null);
958
- const elementRef = React25.useRef(null);
959
- const originalLngLatRef = React25.useRef();
960
- const clickHandlerRef = React25.useRef(null);
961
- const [mounted, setMounted] = React25.useState(false);
962
- const onClickRef = React25.useRef(onClick);
948
+ const markerRef = React26.useRef(null);
949
+ const elementRef = React26.useRef(null);
950
+ const originalLngLatRef = React26.useRef();
951
+ const clickHandlerRef = React26.useRef(null);
952
+ const [mounted, setMounted] = React26.useState(false);
953
+ const onClickRef = React26.useRef(onClick);
963
954
  onClickRef.current = onClick;
964
- const onDragRef = React25.useRef(onDrag);
955
+ const onDragRef = React26.useRef(onDrag);
965
956
  onDragRef.current = onDrag;
966
- const onDragEndRef = React25.useRef(onDragEnd);
957
+ const onDragEndRef = React26.useRef(onDragEnd);
967
958
  onDragEndRef.current = onDragEnd;
968
- React25.useEffect(() => {
959
+ React26.useEffect(() => {
969
960
  setMounted(true);
970
961
  return () => setMounted(false);
971
962
  }, []);
972
- React25.useEffect(() => {
963
+ React26.useEffect(() => {
973
964
  if (children && !elementRef.current) {
974
965
  elementRef.current = document.createElement("div");
975
966
  }
976
967
  }, [children]);
977
- React25.useEffect(() => {
968
+ React26.useEffect(() => {
978
969
  if (!map || !loaded || !mounted) return;
979
970
  if (markerRef.current) return;
980
971
  const markerOptions = {
@@ -1058,17 +1049,17 @@ var Marker = React25.forwardRef(
1058
1049
  }
1059
1050
  };
1060
1051
  }, [map, loaded, mounted]);
1061
- React25.useEffect(() => {
1052
+ React26.useEffect(() => {
1062
1053
  if (markerRef.current) {
1063
1054
  markerRef.current.setLngLat(coordinates);
1064
1055
  }
1065
1056
  }, [coordinates]);
1066
- React25.useEffect(() => {
1057
+ React26.useEffect(() => {
1067
1058
  if (markerRef.current) {
1068
1059
  markerRef.current.setDraggable(draggable);
1069
1060
  }
1070
1061
  }, [draggable]);
1071
- React25.useEffect(() => {
1062
+ React26.useEffect(() => {
1072
1063
  if (markerRef.current && rotation !== void 0) {
1073
1064
  markerRef.current.setRotation(rotation);
1074
1065
  }
@@ -1114,7 +1105,7 @@ function panToFitPopup(map, popup, padding) {
1114
1105
  });
1115
1106
  }
1116
1107
  }
1117
- var Popup = React25.forwardRef(
1108
+ var Popup = React26.forwardRef(
1118
1109
  ({
1119
1110
  coordinates,
1120
1111
  closeButton = true,
@@ -1132,25 +1123,25 @@ var Popup = React25.forwardRef(
1132
1123
  children
1133
1124
  }, ref) => {
1134
1125
  const { map, loaded } = useMap();
1135
- const popupRef = React25.useRef(null);
1136
- const onOpenRef = React25.useRef(onOpen);
1126
+ const popupRef = React26.useRef(null);
1127
+ const onOpenRef = React26.useRef(onOpen);
1137
1128
  onOpenRef.current = onOpen;
1138
- const onCloseRef = React25.useRef(onClose);
1129
+ const onCloseRef = React26.useRef(onClose);
1139
1130
  onCloseRef.current = onClose;
1140
- const coordinatesRef = React25.useRef(coordinates);
1131
+ const coordinatesRef = React26.useRef(coordinates);
1141
1132
  coordinatesRef.current = coordinates;
1142
- const containerRef = React25.useRef(null);
1133
+ const containerRef = React26.useRef(null);
1143
1134
  if (!containerRef.current && typeof document !== "undefined") {
1144
1135
  containerRef.current = document.createElement("div");
1145
1136
  containerRef.current.className = "maplibregl-popup-content-wrapper";
1146
1137
  }
1147
- const [contentReady, setContentReady] = React25.useState(false);
1148
- const contentCallbackRef = React25.useCallback((node) => {
1138
+ const [contentReady, setContentReady] = React26.useState(false);
1139
+ const contentCallbackRef = React26.useCallback((node) => {
1149
1140
  if (node && containerRef.current) {
1150
1141
  setContentReady(true);
1151
1142
  }
1152
1143
  }, []);
1153
- React25.useEffect(() => {
1144
+ React26.useEffect(() => {
1154
1145
  if (!map || !loaded || !containerRef.current) return;
1155
1146
  const popup = new maplibregl.Popup({
1156
1147
  closeButton,
@@ -1190,7 +1181,7 @@ var Popup = React25.forwardRef(
1190
1181
  maxWidth,
1191
1182
  focusAfterOpen
1192
1183
  ]);
1193
- React25.useEffect(() => {
1184
+ React26.useEffect(() => {
1194
1185
  if (!popupRef.current || !ref) return;
1195
1186
  if (typeof ref === "function") {
1196
1187
  ref(popupRef.current);
@@ -1198,12 +1189,12 @@ var Popup = React25.forwardRef(
1198
1189
  ref.current = popupRef.current;
1199
1190
  }
1200
1191
  }, [ref]);
1201
- React25.useEffect(() => {
1192
+ React26.useEffect(() => {
1202
1193
  if (popupRef.current) {
1203
1194
  popupRef.current.setLngLat(coordinates);
1204
1195
  }
1205
1196
  }, [coordinates]);
1206
- React25.useEffect(() => {
1197
+ React26.useEffect(() => {
1207
1198
  if (!map || !popupRef.current || !contentReady) return;
1208
1199
  let rafHandle;
1209
1200
  if (open) {
@@ -1232,7 +1223,7 @@ var Popup = React25.forwardRef(
1232
1223
  }
1233
1224
  );
1234
1225
  Popup.displayName = "Popup";
1235
- var PopupCard = React25.forwardRef(
1226
+ var PopupCard = React26.forwardRef(
1236
1227
  ({ className, children, ...props }, ref) => {
1237
1228
  return /* @__PURE__ */ jsx("div", { ref, className: cn("bg-popover text-popover-foreground", className), ...props, children });
1238
1229
  }
@@ -1252,7 +1243,7 @@ var badgeVariants = cva("text-xs px-1.5 py-0.5 rounded font-medium flex-shrink-0
1252
1243
  badgeVariant: "secondary"
1253
1244
  }
1254
1245
  });
1255
- var PopupHeader = React25.forwardRef(
1246
+ var PopupHeader = React26.forwardRef(
1256
1247
  ({ className, title, badge, badgeVariant, ...props }, ref) => {
1257
1248
  return /* @__PURE__ */ jsxs(
1258
1249
  "div",
@@ -1272,13 +1263,13 @@ var PopupHeader = React25.forwardRef(
1272
1263
  }
1273
1264
  );
1274
1265
  PopupHeader.displayName = "PopupHeader";
1275
- var PopupContent = React25.forwardRef(
1266
+ var PopupContent = React26.forwardRef(
1276
1267
  ({ className, children, ...props }, ref) => {
1277
1268
  return /* @__PURE__ */ jsx("div", { ref, className: cn("px-4 py-3 text-sm", className), ...props, children });
1278
1269
  }
1279
1270
  );
1280
1271
  PopupContent.displayName = "PopupContent";
1281
- var PopupFooter = React25.forwardRef(
1272
+ var PopupFooter = React26.forwardRef(
1282
1273
  ({ className, children, ...props }, ref) => {
1283
1274
  return /* @__PURE__ */ jsx(
1284
1275
  "div",
@@ -1313,14 +1304,14 @@ function useLayer({
1313
1304
  hoverThrottleMs = 0
1314
1305
  }) {
1315
1306
  const { map, loaded, styleVersion } = useMap();
1316
- const [layerAdded, setLayerAdded] = React25.useState(false);
1317
- const hoveredFeatureId = React25.useRef(null);
1318
- const lastHoverCallTime = React25.useRef(0);
1319
- const lastMousePosition = React25.useRef(null);
1320
- React25.useEffect(() => {
1307
+ const [layerAdded, setLayerAdded] = React26.useState(false);
1308
+ const hoveredFeatureId = React26.useRef(null);
1309
+ const lastHoverCallTime = React26.useRef(0);
1310
+ const lastMousePosition = React26.useRef(null);
1311
+ React26.useEffect(() => {
1321
1312
  hoveredFeatureId.current = null;
1322
1313
  }, [styleVersion]);
1323
- React25.useEffect(() => {
1314
+ React26.useEffect(() => {
1324
1315
  if (!map || !loaded) return;
1325
1316
  if (!map.getSource(source)) {
1326
1317
  let timeoutId = null;
@@ -1391,24 +1382,24 @@ function useLayer({
1391
1382
  }
1392
1383
  };
1393
1384
  }, [map, loaded, id, source, sourceLayer, type, beforeId, styleVersion]);
1394
- React25.useEffect(() => {
1385
+ React26.useEffect(() => {
1395
1386
  if (!map || !layerAdded) return;
1396
1387
  if (!map.getLayer(id)) return;
1397
1388
  map.setLayoutProperty(id, "visibility", visible ? "visible" : "none");
1398
1389
  }, [map, id, visible, layerAdded]);
1399
- React25.useEffect(() => {
1390
+ React26.useEffect(() => {
1400
1391
  if (!map || !layerAdded) return;
1401
1392
  if (!map.getLayer(id)) return;
1402
1393
  Object.entries(paint).forEach(([key, value]) => {
1403
1394
  map.setPaintProperty(id, key, value);
1404
1395
  });
1405
1396
  }, [map, id, paint, layerAdded]);
1406
- React25.useEffect(() => {
1397
+ React26.useEffect(() => {
1407
1398
  if (!map || !layerAdded || !filter) return;
1408
1399
  if (!map.getLayer(id)) return;
1409
1400
  map.setFilter(id, filter);
1410
1401
  }, [map, id, filter, layerAdded]);
1411
- React25.useEffect(() => {
1402
+ React26.useEffect(() => {
1412
1403
  if (!map || !layerAdded) return;
1413
1404
  const createFeatureParams = (e) => {
1414
1405
  const feature = e.features?.[0];
@@ -1544,7 +1535,7 @@ var FillLayer = ({
1544
1535
  fillTranslate,
1545
1536
  fillAntialias
1546
1537
  }) => {
1547
- const paint = React25.useMemo(() => {
1538
+ const paint = React26.useMemo(() => {
1548
1539
  const p = {};
1549
1540
  if (fillColor !== void 0) p["fill-color"] = fillColor;
1550
1541
  if (fillOpacity !== void 0) p["fill-opacity"] = fillOpacity;
@@ -1565,7 +1556,7 @@ var FillLayer = ({
1565
1556
  fillAntialias,
1566
1557
  opacity
1567
1558
  ]);
1568
- const layout = React25.useMemo(() => ({}), []);
1559
+ const layout = React26.useMemo(() => ({}), []);
1569
1560
  useLayer({
1570
1561
  id,
1571
1562
  source,
@@ -1609,7 +1600,7 @@ var LineLayer = ({
1609
1600
  lineOffset,
1610
1601
  lineGradient
1611
1602
  }) => {
1612
- const paint = React25.useMemo(() => {
1603
+ const paint = React26.useMemo(() => {
1613
1604
  const p = {};
1614
1605
  if (lineColor !== void 0) p["line-color"] = lineColor;
1615
1606
  if (lineWidth !== void 0) p["line-width"] = lineWidth;
@@ -1634,7 +1625,7 @@ var LineLayer = ({
1634
1625
  lineGradient,
1635
1626
  opacity
1636
1627
  ]);
1637
- const layout = React25.useMemo(() => {
1628
+ const layout = React26.useMemo(() => {
1638
1629
  const l = {};
1639
1630
  if (lineCap !== void 0) l["line-cap"] = lineCap;
1640
1631
  if (lineJoin !== void 0) l["line-join"] = lineJoin;
@@ -1683,7 +1674,7 @@ var CircleLayer = ({
1683
1674
  circlePitchScale,
1684
1675
  circleTranslate
1685
1676
  }) => {
1686
- const paint = React25.useMemo(() => {
1677
+ const paint = React26.useMemo(() => {
1687
1678
  const p = {};
1688
1679
  if (circleRadius !== void 0) p["circle-radius"] = circleRadius;
1689
1680
  if (circleColor !== void 0) p["circle-color"] = circleColor;
@@ -1712,7 +1703,7 @@ var CircleLayer = ({
1712
1703
  circleTranslate,
1713
1704
  opacity
1714
1705
  ]);
1715
- const layout = React25.useMemo(() => ({}), []);
1706
+ const layout = React26.useMemo(() => ({}), []);
1716
1707
  useLayer({
1717
1708
  id,
1718
1709
  source,
@@ -1772,7 +1763,7 @@ var SymbolLayer = ({
1772
1763
  symbolSpacing,
1773
1764
  symbolSortKey
1774
1765
  }) => {
1775
- const paint = React25.useMemo(() => {
1766
+ const paint = React26.useMemo(() => {
1776
1767
  const p = {};
1777
1768
  if (iconOpacity !== void 0) p["icon-opacity"] = iconOpacity;
1778
1769
  if (iconColor !== void 0) p["icon-color"] = iconColor;
@@ -1793,7 +1784,7 @@ var SymbolLayer = ({
1793
1784
  textHaloColor,
1794
1785
  textHaloWidth
1795
1786
  ]);
1796
- const layout = React25.useMemo(() => {
1787
+ const layout = React26.useMemo(() => {
1797
1788
  const l = {};
1798
1789
  if (iconImage !== void 0) l["icon-image"] = iconImage;
1799
1790
  if (iconSize !== void 0) l["icon-size"] = iconSize;
@@ -1874,7 +1865,7 @@ var FillExtrusionLayer = ({
1874
1865
  fillExtrusionTranslate,
1875
1866
  fillExtrusionVerticalGradient
1876
1867
  }) => {
1877
- const paint = React25.useMemo(() => {
1868
+ const paint = React26.useMemo(() => {
1878
1869
  const p = {};
1879
1870
  if (fillExtrusionHeight !== void 0) p["fill-extrusion-height"] = fillExtrusionHeight;
1880
1871
  if (fillExtrusionBase !== void 0) p["fill-extrusion-base"] = fillExtrusionBase;
@@ -1900,7 +1891,7 @@ var FillExtrusionLayer = ({
1900
1891
  fillExtrusionVerticalGradient,
1901
1892
  opacity
1902
1893
  ]);
1903
- const layout = React25.useMemo(() => ({}), []);
1894
+ const layout = React26.useMemo(() => ({}), []);
1904
1895
  useLayer({
1905
1896
  id,
1906
1897
  source,
@@ -1939,7 +1930,7 @@ var HeatmapLayer = ({
1939
1930
  heatmapRadius,
1940
1931
  heatmapOpacity
1941
1932
  }) => {
1942
- const paint = React25.useMemo(() => {
1933
+ const paint = React26.useMemo(() => {
1943
1934
  const p = {};
1944
1935
  if (heatmapIntensity !== void 0) p["heatmap-intensity"] = heatmapIntensity;
1945
1936
  if (heatmapWeight !== void 0) p["heatmap-weight"] = heatmapWeight;
@@ -1951,7 +1942,7 @@ var HeatmapLayer = ({
1951
1942
  }
1952
1943
  return p;
1953
1944
  }, [heatmapIntensity, heatmapWeight, heatmapColor, heatmapRadius, heatmapOpacity, opacity]);
1954
- const layout = React25.useMemo(() => ({}), []);
1945
+ const layout = React26.useMemo(() => ({}), []);
1955
1946
  useLayer({
1956
1947
  id,
1957
1948
  source,
@@ -1971,6 +1962,127 @@ var HeatmapLayer = ({
1971
1962
  return null;
1972
1963
  };
1973
1964
  HeatmapLayer.displayName = "HeatmapLayer";
1965
+ function useControlPosition(ref, options) {
1966
+ const {
1967
+ id,
1968
+ type,
1969
+ position,
1970
+ fallbacks,
1971
+ priority = "normal",
1972
+ zLayer = "interactive",
1973
+ hasExpandedState = false,
1974
+ isBuiltIn = false
1975
+ } = options;
1976
+ const { positioningCoordinator } = useMap();
1977
+ const [offset, setOffset] = React26.useState(null);
1978
+ React26.useEffect(() => {
1979
+ if (!ref.current || !positioningCoordinator) return;
1980
+ const element = ref.current;
1981
+ const initialOffset = positioningCoordinator.register({
1982
+ id,
1983
+ type,
1984
+ isBuiltIn,
1985
+ dimensions: {
1986
+ width: element.offsetWidth || 200,
1987
+ height: element.offsetHeight || 100
1988
+ },
1989
+ position: {
1990
+ primary: position,
1991
+ fallbacks
1992
+ },
1993
+ priority,
1994
+ zLayer,
1995
+ hasExpandedState,
1996
+ isExpanded: false
1997
+ });
1998
+ setOffset(initialOffset);
1999
+ const unsubscribe = positioningCoordinator.subscribe((event) => {
2000
+ const newOffset = event.offsets.get(id);
2001
+ if (newOffset) {
2002
+ setOffset(newOffset);
2003
+ }
2004
+ });
2005
+ const resizeObserver = new ResizeObserver(() => {
2006
+ if (!element) return;
2007
+ positioningCoordinator.update(id, {
2008
+ dimensions: {
2009
+ width: element.offsetWidth,
2010
+ height: element.offsetHeight
2011
+ }
2012
+ });
2013
+ });
2014
+ resizeObserver.observe(element);
2015
+ return () => {
2016
+ resizeObserver.disconnect();
2017
+ unsubscribe();
2018
+ positioningCoordinator.unregister(id);
2019
+ };
2020
+ }, [
2021
+ id,
2022
+ type,
2023
+ position,
2024
+ fallbacks,
2025
+ priority,
2026
+ zLayer,
2027
+ hasExpandedState,
2028
+ isBuiltIn,
2029
+ positioningCoordinator,
2030
+ ref
2031
+ ]);
2032
+ React26.useEffect(() => {
2033
+ if (!positioningCoordinator) return;
2034
+ positioningCoordinator.update(id, {
2035
+ position: {
2036
+ primary: position,
2037
+ fallbacks
2038
+ },
2039
+ priority,
2040
+ zLayer
2041
+ });
2042
+ }, [id, position, fallbacks, priority, zLayer, positioningCoordinator]);
2043
+ const setExpanded = React26.useCallback(
2044
+ (isExpanded) => {
2045
+ if (positioningCoordinator) {
2046
+ positioningCoordinator.setExpanded(id, isExpanded);
2047
+ }
2048
+ },
2049
+ [id, positioningCoordinator]
2050
+ );
2051
+ const style = React26.useMemo(() => {
2052
+ if (!offset) {
2053
+ return {
2054
+ position: "absolute",
2055
+ visibility: "hidden"
2056
+ };
2057
+ }
2058
+ const resolvedPosition = offset.position;
2059
+ const isLeftPosition = resolvedPosition.includes("left") || resolvedPosition.includes("center");
2060
+ const isCenterHorizontal = resolvedPosition.includes("center");
2061
+ const baseStyle = {
2062
+ position: "absolute",
2063
+ zIndex: offset.zIndex
2064
+ };
2065
+ if (isCenterHorizontal) {
2066
+ baseStyle.left = offset.x;
2067
+ } else if (isLeftPosition) {
2068
+ baseStyle.left = offset.x;
2069
+ } else {
2070
+ baseStyle.right = offset.x;
2071
+ }
2072
+ if (resolvedPosition.startsWith("bottom")) {
2073
+ baseStyle.bottom = offset.y;
2074
+ } else {
2075
+ baseStyle.top = offset.y;
2076
+ }
2077
+ return baseStyle;
2078
+ }, [offset]);
2079
+ return {
2080
+ offset,
2081
+ setExpanded,
2082
+ style,
2083
+ visible: offset?.visible ?? false
2084
+ };
2085
+ }
1974
2086
  var legendIdCounter = 0;
1975
2087
  var Legend = ({
1976
2088
  title,
@@ -1985,30 +2097,17 @@ var Legend = ({
1985
2097
  class: className,
1986
2098
  onItemClick
1987
2099
  }) => {
1988
- const { controlOffsets, registerControl, unregisterControl } = useMap();
1989
- const [isCollapsed, setIsCollapsed] = React25.useState(initialCollapsed);
1990
- const [customControlOffset, setCustomControlOffset] = React25.useState(0);
1991
- const legendRef = React25.useRef(null);
1992
- const legendIdRef = React25.useRef(`legend-${++legendIdCounter}`);
1993
- React25.useEffect(() => {
1994
- if (!legendRef.current || !registerControl) return;
1995
- const updatePosition = () => {
1996
- if (!legendRef.current) return;
1997
- const height = legendRef.current.offsetHeight;
1998
- const offset = registerControl(legendIdRef.current, position, height);
1999
- setCustomControlOffset(offset);
2000
- };
2001
- updatePosition();
2002
- const observer = new ResizeObserver(updatePosition);
2003
- observer.observe(legendRef.current);
2004
- return () => {
2005
- observer.disconnect();
2006
- unregisterControl?.(legendIdRef.current, position);
2007
- };
2008
- }, [position, registerControl, unregisterControl]);
2009
- const verticalOffsetStyle = React25.useMemo(() => {
2010
- return computeVerticalOffsetStyle(position, customControlOffset);
2011
- }, [customControlOffset, position]);
2100
+ const [isCollapsed, setIsCollapsed] = React26.useState(initialCollapsed);
2101
+ const legendRef = React26.useRef(null);
2102
+ const legendIdRef = React26.useRef(`legend-${++legendIdCounter}`);
2103
+ const { style, visible } = useControlPosition(legendRef, {
2104
+ id: legendIdRef.current,
2105
+ type: "legend",
2106
+ position,
2107
+ priority: "normal",
2108
+ zLayer: "interactive",
2109
+ hasExpandedState: collapsible
2110
+ });
2012
2111
  const handleItemClick = (item, index) => {
2013
2112
  if (onItemClick) {
2014
2113
  onItemClick(item, index);
@@ -2019,26 +2118,22 @@ var Legend = ({
2019
2118
  setIsCollapsed(!isCollapsed);
2020
2119
  }
2021
2120
  };
2022
- const gradientStyle = React25.useMemo(() => {
2121
+ const gradientStyle = React26.useMemo(() => {
2023
2122
  if (type !== "gradient" || gradient.length === 0) return "";
2024
2123
  const stops = gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
2025
2124
  return `linear-gradient(to right, ${stops})`;
2026
2125
  }, [type, gradient]);
2027
- const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2028
- const computedPositionClasses = React25.useMemo(() => {
2029
- return computePositionClasses(position, hasControlsAtPosition);
2030
- }, [position, hasControlsAtPosition]);
2031
2126
  return /* @__PURE__ */ jsxs(
2032
2127
  "div",
2033
2128
  {
2034
2129
  ref: legendRef,
2035
2130
  className: cn(
2036
- "absolute z-10 bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
2131
+ "absolute bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
2037
2132
  "text-sm min-w-[140px] max-w-[280px]",
2038
- computedPositionClasses,
2133
+ !visible && "invisible",
2039
2134
  className
2040
2135
  ),
2041
- style: verticalOffsetStyle,
2136
+ style,
2042
2137
  children: [
2043
2138
  (title || collapsible) && /* @__PURE__ */ jsxs(
2044
2139
  "button",
@@ -2124,45 +2219,31 @@ var LegendGroup = ({
2124
2219
  allowCollapseAll = false,
2125
2220
  class: className
2126
2221
  }) => {
2127
- const { controlOffsets, registerControl, unregisterControl } = useMap();
2128
- const containerRef = React25.useRef(null);
2129
- const groupIdRef = React25.useRef(`legend-group-${++legendGroupIdCounter}`);
2130
- const [customControlOffset, setCustomControlOffset] = React25.useState(0);
2222
+ const containerRef = React26.useRef(null);
2223
+ const groupIdRef = React26.useRef(`legend-group-${++legendGroupIdCounter}`);
2131
2224
  const getInitialExpanded = () => {
2132
2225
  if (controlledExpanded !== void 0) return controlledExpanded;
2133
2226
  if (defaultExpanded) return defaultExpanded;
2134
2227
  return legends[0]?.id || null;
2135
2228
  };
2136
- const [internalExpanded, setInternalExpanded] = React25.useState(getInitialExpanded);
2229
+ const [internalExpanded, setInternalExpanded] = React26.useState(getInitialExpanded);
2137
2230
  const expandedId = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
2231
+ const { style, visible, setExpanded } = useControlPosition(containerRef, {
2232
+ id: groupIdRef.current,
2233
+ type: "legend-group",
2234
+ position,
2235
+ priority: "normal",
2236
+ zLayer: "interactive",
2237
+ hasExpandedState: true
2238
+ });
2138
2239
  const handleToggle = (id) => {
2139
2240
  const newExpanded = expandedId === id ? allowCollapseAll ? null : id : id;
2140
2241
  if (controlledExpanded === void 0) {
2141
2242
  setInternalExpanded(newExpanded);
2142
2243
  }
2244
+ setExpanded(newExpanded !== null);
2143
2245
  onExpandedChange?.(newExpanded);
2144
2246
  };
2145
- React25.useEffect(() => {
2146
- if (!containerRef.current || !registerControl) return;
2147
- const timeoutId = setTimeout(() => {
2148
- if (containerRef.current) {
2149
- const height = containerRef.current.offsetHeight;
2150
- const offset = registerControl(groupIdRef.current, position, height);
2151
- setCustomControlOffset(offset);
2152
- }
2153
- }, 50);
2154
- return () => {
2155
- clearTimeout(timeoutId);
2156
- unregisterControl?.(groupIdRef.current, position);
2157
- };
2158
- }, [position, expandedId, registerControl, unregisterControl]);
2159
- const verticalOffsetStyle = React25.useMemo(() => {
2160
- return computeVerticalOffsetStyle(position, customControlOffset);
2161
- }, [customControlOffset, position]);
2162
- const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2163
- const computedPositionClasses = React25.useMemo(() => {
2164
- return computePositionClasses(position, hasControlsAtPosition);
2165
- }, [position, hasControlsAtPosition]);
2166
2247
  const getGradientStyle = (legend) => {
2167
2248
  if (legend.type !== "gradient" || !legend.gradient?.length) return "";
2168
2249
  const stops = legend.gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
@@ -2176,12 +2257,12 @@ var LegendGroup = ({
2176
2257
  {
2177
2258
  ref: containerRef,
2178
2259
  className: cn(
2179
- "absolute z-10 bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
2260
+ "absolute bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
2180
2261
  "text-sm min-w-[160px] max-w-[280px]",
2181
- computedPositionClasses,
2262
+ !visible && "invisible",
2182
2263
  className
2183
2264
  ),
2184
- style: verticalOffsetStyle,
2265
+ style,
2185
2266
  children: legends.map((legend, legendIndex) => {
2186
2267
  const isExpanded = expandedId === legend.id;
2187
2268
  const isFirst = legendIndex === 0;
@@ -2282,6 +2363,7 @@ var LegendGroup = ({
2282
2363
  };
2283
2364
  LegendGroup.displayName = "LegendGroup";
2284
2365
  var coordDisplayIdCounter = 0;
2366
+ var NAV_CONTROL_WIDTH = 29;
2285
2367
  var CoordinateDisplay = ({
2286
2368
  position = "bottom-right",
2287
2369
  format = "decimal",
@@ -2290,33 +2372,40 @@ var CoordinateDisplay = ({
2290
2372
  showBearing = false,
2291
2373
  class: className
2292
2374
  }) => {
2293
- const { map, loaded, controlOffsets, registerControl, unregisterControl } = useMap();
2294
- const [cursorLngLat, setCursorLngLat] = React25.useState(null);
2295
- const [currentZoom, setCurrentZoom] = React25.useState(0);
2296
- const [currentBearing, setCurrentBearing] = React25.useState(0);
2297
- const [customControlOffset, setCustomControlOffset] = React25.useState(0);
2298
- const controlRef = React25.useRef(null);
2299
- const controlIdRef = React25.useRef(`coord-display-${++coordDisplayIdCounter}`);
2300
- React25.useEffect(() => {
2301
- if (!controlRef.current || !registerControl) return;
2302
- const updatePosition = () => {
2303
- if (!controlRef.current) return;
2304
- const height = controlRef.current.offsetHeight;
2305
- const offset = registerControl(controlIdRef.current, position, height);
2306
- setCustomControlOffset(offset);
2307
- };
2308
- updatePosition();
2309
- const observer = new ResizeObserver(updatePosition);
2310
- observer.observe(controlRef.current);
2311
- return () => {
2312
- observer.disconnect();
2313
- unregisterControl?.(controlIdRef.current, position);
2314
- };
2315
- }, [position, registerControl, unregisterControl]);
2316
- const verticalOffsetStyle = React25.useMemo(() => {
2317
- return computeVerticalOffsetStyle(position, customControlOffset);
2318
- }, [customControlOffset, position]);
2319
- const formatCoord = React25.useCallback(
2375
+ const { map, loaded } = useMap();
2376
+ const [cursorLngLat, setCursorLngLat] = React26.useState(null);
2377
+ const [currentZoom, setCurrentZoom] = React26.useState(0);
2378
+ const [currentBearing, setCurrentBearing] = React26.useState(0);
2379
+ const controlRef = React26.useRef(null);
2380
+ const controlIdRef = React26.useRef(`coord-display-${++coordDisplayIdCounter}`);
2381
+ const { style, visible } = useControlPosition(controlRef, {
2382
+ id: controlIdRef.current,
2383
+ type: "coordinate-display",
2384
+ position,
2385
+ priority: "critical",
2386
+ zLayer: "base"
2387
+ });
2388
+ const adjustedStyle = React26.useMemo(() => {
2389
+ if (!style) return style;
2390
+ if (position === "top-right") {
2391
+ const rightOffset = NAV_CONTROL_WIDTH + STACK_GAP + EDGE_MARGIN;
2392
+ return {
2393
+ ...style,
2394
+ top: EDGE_MARGIN,
2395
+ right: rightOffset
2396
+ };
2397
+ }
2398
+ if (position === "bottom-right") {
2399
+ const ATTRIBUTION_HEIGHT = 32;
2400
+ const bottomOffset = EDGE_MARGIN + ATTRIBUTION_HEIGHT;
2401
+ return {
2402
+ ...style,
2403
+ bottom: bottomOffset
2404
+ };
2405
+ }
2406
+ return style;
2407
+ }, [position, style]);
2408
+ const formatCoord = React26.useCallback(
2320
2409
  (lngLat) => {
2321
2410
  return formatCoordinates(lngLat, precision, format);
2322
2411
  },
@@ -2329,11 +2418,7 @@ var CoordinateDisplay = ({
2329
2418
  const normalized = (bearing % 360 + 360) % 360;
2330
2419
  return `${normalized.toFixed(0)}\xB0`;
2331
2420
  };
2332
- const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2333
- const computedPositionClasses = React25.useMemo(() => {
2334
- return computePositionClasses(position, hasControlsAtPosition);
2335
- }, [position, hasControlsAtPosition]);
2336
- React25.useEffect(() => {
2421
+ React26.useEffect(() => {
2337
2422
  if (!map || !loaded) return;
2338
2423
  setCurrentZoom(map.getZoom());
2339
2424
  setCurrentBearing(map.getBearing());
@@ -2360,14 +2445,14 @@ var CoordinateDisplay = ({
2360
2445
  {
2361
2446
  ref: controlRef,
2362
2447
  className: cn(
2363
- "absolute z-10 bg-card rounded px-2 py-1",
2448
+ "absolute bg-card rounded px-2 py-1",
2364
2449
  "text-xs font-mono text-muted-foreground",
2365
2450
  "border border-black dark:border-gray-400 shadow-sm",
2366
2451
  "flex items-center gap-3",
2367
- computedPositionClasses,
2452
+ !visible && "invisible",
2368
2453
  className
2369
2454
  ),
2370
- style: verticalOffsetStyle,
2455
+ style: adjustedStyle,
2371
2456
  children: [
2372
2457
  cursorLngLat ? /* @__PURE__ */ jsx("span", { title: "Cursor coordinates", children: formatCoord(cursorLngLat) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground/60", children: "Move cursor over map" }),
2373
2458
  showZoom && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -2399,17 +2484,16 @@ var BasemapSwitcher = ({
2399
2484
  position = "bottom-right",
2400
2485
  class: className
2401
2486
  }) => {
2402
- const { controlOffsets, registerControl, unregisterControl, setMapStyle } = useMap();
2403
- const [isOpen, setIsOpen] = React25.useState(false);
2404
- const [internalActiveId, setInternalActiveId] = React25.useState(
2487
+ const { setMapStyle } = useMap();
2488
+ const [isOpen, setIsOpen] = React26.useState(false);
2489
+ const [internalActiveId, setInternalActiveId] = React26.useState(
2405
2490
  defaultBasemapId
2406
2491
  );
2407
- const [customControlOffset, setCustomControlOffset] = React25.useState(0);
2408
- const containerRef = React25.useRef(null);
2409
- const panelRef = React25.useRef(null);
2410
- const switcherIdRef = React25.useRef(`basemap-switcher-${++switcherIdCounter}`);
2492
+ const containerRef = React26.useRef(null);
2493
+ const panelRef = React26.useRef(null);
2494
+ const switcherIdRef = React26.useRef(`basemap-switcher-${++switcherIdCounter}`);
2411
2495
  const sourceBasemaps = basemaps ?? FREE_BASEMAPS;
2412
- const availableBasemaps = React25.useMemo(() => {
2496
+ const availableBasemaps = React26.useMemo(() => {
2413
2497
  const available = getAvailableBasemaps(sourceBasemaps, apiKeys);
2414
2498
  if (extraBasemaps?.length) {
2415
2499
  return [...available, ...getAvailableBasemaps(extraBasemaps, apiKeys)];
@@ -2417,66 +2501,59 @@ var BasemapSwitcher = ({
2417
2501
  return available;
2418
2502
  }, [sourceBasemaps, extraBasemaps, apiKeys]);
2419
2503
  const currentActiveId = activeBasemapId ?? internalActiveId ?? availableBasemaps[0]?.id;
2420
- React25.useEffect(() => {
2421
- if (!containerRef.current || !registerControl) return;
2422
- const updatePosition = () => {
2423
- if (!containerRef.current) return;
2424
- const height = containerRef.current.offsetHeight;
2425
- const offset = registerControl(switcherIdRef.current, position, height);
2426
- setCustomControlOffset(offset);
2427
- };
2428
- updatePosition();
2429
- const observer = new ResizeObserver(updatePosition);
2430
- observer.observe(containerRef.current);
2431
- return () => {
2432
- observer.disconnect();
2433
- unregisterControl?.(switcherIdRef.current, position);
2434
- };
2435
- }, [position, registerControl, unregisterControl]);
2436
- React25.useEffect(() => {
2504
+ const { style, visible, setExpanded } = useControlPosition(containerRef, {
2505
+ id: switcherIdRef.current,
2506
+ type: "basemap-switcher",
2507
+ position,
2508
+ priority: "normal",
2509
+ zLayer: "interactive",
2510
+ hasExpandedState: true
2511
+ });
2512
+ React26.useEffect(() => {
2437
2513
  if (!isOpen) return;
2438
2514
  const handleMouseDown = (e) => {
2439
2515
  if (containerRef.current && !containerRef.current.contains(e.target)) {
2440
2516
  setIsOpen(false);
2517
+ setExpanded(false);
2441
2518
  }
2442
2519
  };
2443
2520
  document.addEventListener("mousedown", handleMouseDown);
2444
2521
  return () => document.removeEventListener("mousedown", handleMouseDown);
2445
- }, [isOpen]);
2446
- React25.useEffect(() => {
2522
+ }, [isOpen, setExpanded]);
2523
+ React26.useEffect(() => {
2447
2524
  if (!isOpen) return;
2448
2525
  const handleKeyDown = (e) => {
2449
2526
  if (e.key === "Escape") {
2450
2527
  setIsOpen(false);
2528
+ setExpanded(false);
2451
2529
  }
2452
2530
  };
2453
2531
  document.addEventListener("keydown", handleKeyDown);
2454
2532
  return () => document.removeEventListener("keydown", handleKeyDown);
2455
- }, [isOpen]);
2533
+ }, [isOpen, setExpanded]);
2456
2534
  const handleSelect = (basemap) => {
2457
- const style = resolveBasemapStyle(basemap, apiKeys);
2458
- if (!style) return;
2535
+ const resolvedStyle = resolveBasemapStyle(basemap, apiKeys);
2536
+ if (!resolvedStyle) return;
2459
2537
  if (!activeBasemapId) {
2460
2538
  setInternalActiveId(basemap.id);
2461
2539
  }
2462
- setMapStyle?.(style);
2540
+ setMapStyle?.(resolvedStyle);
2463
2541
  onBasemapChange?.(basemap);
2464
2542
  setIsOpen(false);
2543
+ setExpanded(false);
2544
+ };
2545
+ const handleToggle = () => {
2546
+ const newState = !isOpen;
2547
+ setIsOpen(newState);
2548
+ setExpanded(newState);
2465
2549
  };
2466
- const verticalOffsetStyle = React25.useMemo(() => {
2467
- return computeVerticalOffsetStyle(position, customControlOffset);
2468
- }, [customControlOffset, position]);
2469
- const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2470
- const computedPositionClasses = React25.useMemo(() => {
2471
- return computePositionClasses(position, hasControlsAtPosition);
2472
- }, [position, hasControlsAtPosition]);
2473
2550
  const isTop = position.startsWith("top");
2474
2551
  return /* @__PURE__ */ jsxs(
2475
2552
  "div",
2476
2553
  {
2477
2554
  ref: containerRef,
2478
- className: cn("absolute z-10", computedPositionClasses, className),
2479
- style: verticalOffsetStyle,
2555
+ className: cn("absolute", !visible && "invisible", className),
2556
+ style,
2480
2557
  children: [
2481
2558
  isOpen && /* @__PURE__ */ jsx(
2482
2559
  "div",
@@ -2551,7 +2628,7 @@ var BasemapSwitcher = ({
2551
2628
  "hover:bg-muted transition-colors cursor-pointer",
2552
2629
  "text-foreground"
2553
2630
  ),
2554
- onClick: () => setIsOpen(!isOpen),
2631
+ onClick: handleToggle,
2555
2632
  "aria-label": "Switch basemap",
2556
2633
  "aria-expanded": isOpen,
2557
2634
  "aria-haspopup": "true",
@@ -2594,22 +2671,28 @@ var LayerManager = ({
2594
2671
  onLayerChange,
2595
2672
  class: className
2596
2673
  }) => {
2597
- const { controlOffsets, registerControl, unregisterControl } = useMap();
2598
2674
  const { isDark } = useMapTheme();
2599
- const [isOpen, setIsOpen] = React25.useState(false);
2600
- const [layerStates, setLayerStates] = React25.useState(
2675
+ const [isOpen, setIsOpen] = React26.useState(false);
2676
+ const [layerStates, setLayerStates] = React26.useState(
2601
2677
  () => createInitialLayerStates(layers, initialActiveLayers)
2602
2678
  );
2603
- const [searchQuery, setSearchQuery] = React25.useState("");
2604
- const [activeCategory, setActiveCategory] = React25.useState("all");
2605
- const [customControlOffset, setCustomControlOffset] = React25.useState(0);
2606
- const [expandedOpacity, setExpandedOpacity] = React25.useState(null);
2607
- const [draggedId, setDraggedId] = React25.useState(null);
2608
- const [dragOver, setDragOver] = React25.useState(null);
2609
- const containerRef = React25.useRef(null);
2610
- const managerIdRef = React25.useRef(`layer-manager-${++managerIdCounter}`);
2611
- const lastLayerIdsRef = React25.useRef(new Set(layers.map((l) => l.id)));
2612
- React25.useEffect(() => {
2679
+ const [searchQuery, setSearchQuery] = React26.useState("");
2680
+ const [activeCategory, setActiveCategory] = React26.useState("all");
2681
+ const [expandedOpacity, setExpandedOpacity] = React26.useState(null);
2682
+ const [draggedId, setDraggedId] = React26.useState(null);
2683
+ const [dragOver, setDragOver] = React26.useState(null);
2684
+ const containerRef = React26.useRef(null);
2685
+ const managerIdRef = React26.useRef(`layer-manager-${++managerIdCounter}`);
2686
+ const lastLayerIdsRef = React26.useRef(new Set(layers.map((l) => l.id)));
2687
+ const { style, visible, setExpanded } = useControlPosition(containerRef, {
2688
+ id: managerIdRef.current,
2689
+ type: "layer-manager",
2690
+ position,
2691
+ priority: "high",
2692
+ zLayer: "interactive",
2693
+ hasExpandedState: true
2694
+ });
2695
+ React26.useEffect(() => {
2613
2696
  const currentLayerIds = new Set(layers.map((l) => l.id));
2614
2697
  const hasNewLayers = layers.some((l) => !lastLayerIdsRef.current.has(l.id));
2615
2698
  const hasRemovedLayers = Array.from(lastLayerIdsRef.current).some(
@@ -2640,8 +2723,8 @@ var LayerManager = ({
2640
2723
  lastLayerIdsRef.current = currentLayerIds;
2641
2724
  }
2642
2725
  }, [layers, initialActiveLayers]);
2643
- const categories = React25.useMemo(() => getLayerCategories(layers), [layers]);
2644
- const filteredLayers = React25.useMemo(() => {
2726
+ const categories = React26.useMemo(() => getLayerCategories(layers), [layers]);
2727
+ const filteredLayers = React26.useMemo(() => {
2645
2728
  let result = layers;
2646
2729
  if (searchQuery) {
2647
2730
  result = searchLayers(result, searchQuery);
@@ -2655,47 +2738,33 @@ var LayerManager = ({
2655
2738
  return orderA - orderB;
2656
2739
  });
2657
2740
  }, [layers, searchQuery, activeCategory, layerStates]);
2658
- const layerGroups = React25.useMemo(
2741
+ const layerGroups = React26.useMemo(
2659
2742
  () => showCategories ? groupLayersByCategory(filteredLayers) : null,
2660
2743
  [filteredLayers, showCategories]
2661
2744
  );
2662
- React25.useEffect(() => {
2663
- if (!containerRef.current || !registerControl) return;
2664
- const updatePosition = () => {
2665
- if (!containerRef.current) return;
2666
- const height = containerRef.current.offsetHeight;
2667
- const offset = registerControl(managerIdRef.current, position, height);
2668
- setCustomControlOffset(offset);
2669
- };
2670
- updatePosition();
2671
- const observer = new ResizeObserver(updatePosition);
2672
- observer.observe(containerRef.current);
2673
- return () => {
2674
- observer.disconnect();
2675
- unregisterControl?.(managerIdRef.current, position);
2676
- };
2677
- }, [position, registerControl, unregisterControl]);
2678
- React25.useEffect(() => {
2745
+ React26.useEffect(() => {
2679
2746
  if (!isOpen) return;
2680
2747
  const handleMouseDown = (e) => {
2681
2748
  if (containerRef.current && !containerRef.current.contains(e.target)) {
2682
2749
  setIsOpen(false);
2750
+ setExpanded(false);
2683
2751
  }
2684
2752
  };
2685
2753
  document.addEventListener("mousedown", handleMouseDown);
2686
2754
  return () => document.removeEventListener("mousedown", handleMouseDown);
2687
- }, [isOpen]);
2688
- React25.useEffect(() => {
2755
+ }, [isOpen, setExpanded]);
2756
+ React26.useEffect(() => {
2689
2757
  if (!isOpen) return;
2690
2758
  const handleKeyDown = (e) => {
2691
2759
  if (e.key === "Escape") {
2692
2760
  setIsOpen(false);
2761
+ setExpanded(false);
2693
2762
  }
2694
2763
  };
2695
2764
  document.addEventListener("keydown", handleKeyDown);
2696
2765
  return () => document.removeEventListener("keydown", handleKeyDown);
2697
- }, [isOpen]);
2698
- const handleToggleLayer = React25.useCallback(
2766
+ }, [isOpen, setExpanded]);
2767
+ const handleToggleLayer = React26.useCallback(
2699
2768
  (layerId) => {
2700
2769
  setLayerStates((prev) => {
2701
2770
  const newStates = toggleLayerVisibility(prev, layerId);
@@ -2708,7 +2777,7 @@ var LayerManager = ({
2708
2777
  },
2709
2778
  [onLayerChange]
2710
2779
  );
2711
- const handleOpacityChange = React25.useCallback(
2780
+ const handleOpacityChange = React26.useCallback(
2712
2781
  (layerId, opacity) => {
2713
2782
  setLayerStates((prev) => {
2714
2783
  const newStates = setLayerOpacity(prev, layerId, opacity);
@@ -2721,12 +2790,12 @@ var LayerManager = ({
2721
2790
  },
2722
2791
  [onLayerChange]
2723
2792
  );
2724
- const handleDragStart = React25.useCallback((e, layerId) => {
2793
+ const handleDragStart = React26.useCallback((e, layerId) => {
2725
2794
  setDraggedId(layerId);
2726
2795
  e.dataTransfer.effectAllowed = "move";
2727
2796
  e.dataTransfer.setData("text/plain", layerId);
2728
2797
  }, []);
2729
- const handleDragOver = React25.useCallback(
2798
+ const handleDragOver = React26.useCallback(
2730
2799
  (e, layerId) => {
2731
2800
  e.preventDefault();
2732
2801
  e.dataTransfer.dropEffect = "move";
@@ -2746,14 +2815,14 @@ var LayerManager = ({
2746
2815
  },
2747
2816
  [draggedId, dragOver]
2748
2817
  );
2749
- const handleDragLeave = React25.useCallback(() => {
2818
+ const handleDragLeave = React26.useCallback(() => {
2750
2819
  setDragOver(null);
2751
2820
  }, []);
2752
- const handleDragEnd = React25.useCallback(() => {
2821
+ const handleDragEnd = React26.useCallback(() => {
2753
2822
  setDraggedId(null);
2754
2823
  setDragOver(null);
2755
2824
  }, []);
2756
- const handleDrop = React25.useCallback(
2825
+ const handleDrop = React26.useCallback(
2757
2826
  (e, targetLayerId) => {
2758
2827
  e.preventDefault();
2759
2828
  const sourceLayerId = e.dataTransfer.getData("text/plain");
@@ -2783,13 +2852,6 @@ var LayerManager = ({
2783
2852
  },
2784
2853
  [layerStates, onLayerChange, dragOver]
2785
2854
  );
2786
- const verticalOffsetStyle = React25.useMemo(() => {
2787
- return computeVerticalOffsetStyle(position, customControlOffset);
2788
- }, [customControlOffset, position]);
2789
- const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
2790
- const computedPositionClasses = React25.useMemo(() => {
2791
- return computePositionClasses(position, hasControlsAtPosition);
2792
- }, [position, hasControlsAtPosition]);
2793
2855
  const isTop = position.startsWith("top");
2794
2856
  const renderLayer = (layer, state) => {
2795
2857
  if (!state.visible) return null;
@@ -3000,6 +3062,11 @@ var LayerManager = ({
3000
3062
  ] }) });
3001
3063
  };
3002
3064
  const visibleLayerStates = getLayerStatesArray(layerStates).filter((s) => s.visible);
3065
+ const handleToggle = () => {
3066
+ const newState = !isOpen;
3067
+ setIsOpen(newState);
3068
+ setExpanded(newState);
3069
+ };
3003
3070
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3004
3071
  visibleLayerStates.map((state) => {
3005
3072
  const layer = layers.find((l) => l.id === state.id);
@@ -3009,8 +3076,8 @@ var LayerManager = ({
3009
3076
  "div",
3010
3077
  {
3011
3078
  ref: containerRef,
3012
- className: cn("absolute z-10", computedPositionClasses, className),
3013
- style: verticalOffsetStyle,
3079
+ className: cn("absolute", !visible && "invisible", className),
3080
+ style,
3014
3081
  children: [
3015
3082
  isOpen && /* @__PURE__ */ jsxs(
3016
3083
  "div",
@@ -3088,7 +3155,7 @@ var LayerManager = ({
3088
3155
  if (catLayers.length === 0) return null;
3089
3156
  return /* @__PURE__ */ jsxs("div", { children: [
3090
3157
  /* @__PURE__ */ jsx("div", { className: "px-3 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider", children: CATEGORY_META[cat].label }),
3091
- catLayers.map((layer) => /* @__PURE__ */ jsxs(React25.Fragment, { children: [
3158
+ catLayers.map((layer) => /* @__PURE__ */ jsxs(React26.Fragment, { children: [
3092
3159
  renderLayerItem(layer),
3093
3160
  renderOpacitySlider(layer.id)
3094
3161
  ] }, layer.id))
@@ -3096,7 +3163,7 @@ var LayerManager = ({
3096
3163
  })
3097
3164
  ) : (
3098
3165
  // Flat list
3099
- filteredLayers.map((layer) => /* @__PURE__ */ jsxs(React25.Fragment, { children: [
3166
+ filteredLayers.map((layer) => /* @__PURE__ */ jsxs(React26.Fragment, { children: [
3100
3167
  renderLayerItem(layer),
3101
3168
  renderOpacitySlider(layer.id)
3102
3169
  ] }, layer.id))
@@ -3116,7 +3183,7 @@ var LayerManager = ({
3116
3183
  "hover:bg-muted transition-colors cursor-pointer",
3117
3184
  "text-foreground"
3118
3185
  ),
3119
- onClick: () => setIsOpen(!isOpen),
3186
+ onClick: handleToggle,
3120
3187
  "aria-label": "Toggle layer manager",
3121
3188
  "aria-expanded": isOpen,
3122
3189
  "aria-haspopup": "true",
@@ -3146,6 +3213,42 @@ var LayerManager = ({
3146
3213
  ] });
3147
3214
  };
3148
3215
  LayerManager.displayName = "LayerManager";
3216
+ var customControlIdCounter = 0;
3217
+ var CustomControl = ({
3218
+ position = "top-right",
3219
+ fallbacks,
3220
+ priority = "normal",
3221
+ zLayer = "interactive",
3222
+ id,
3223
+ hasExpandedState = false,
3224
+ className,
3225
+ style: userStyle,
3226
+ children
3227
+ }) => {
3228
+ const controlRef = React26.useRef(null);
3229
+ const controlIdRef = React26.useRef(id ?? `custom-control-${++customControlIdCounter}`);
3230
+ const { style, visible, setExpanded } = useControlPosition(controlRef, {
3231
+ id: controlIdRef.current,
3232
+ type: "custom",
3233
+ position,
3234
+ fallbacks,
3235
+ priority,
3236
+ zLayer,
3237
+ hasExpandedState
3238
+ });
3239
+ const mergedStyle = React26.useMemo(() => ({ ...style, ...userStyle }), [style, userStyle]);
3240
+ const contextValue = React26.useMemo(() => ({ setExpanded }), [setExpanded]);
3241
+ return /* @__PURE__ */ jsx(CustomControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx("div", { ref: controlRef, className: cn(!visible && "invisible", className), style: mergedStyle, children }) });
3242
+ };
3243
+ CustomControl.displayName = "CustomControl";
3244
+ var CustomControlContext = React26.createContext(null);
3245
+ function useCustomControl() {
3246
+ const context = React26.useContext(CustomControlContext);
3247
+ if (!context) {
3248
+ throw new Error("useCustomControl must be used within a CustomControl");
3249
+ }
3250
+ return context;
3251
+ }
3149
3252
  var DeckOverlay = ({
3150
3253
  layers = [],
3151
3254
  onHover,
@@ -3156,9 +3259,9 @@ var DeckOverlay = ({
3156
3259
  deckProps = {}
3157
3260
  }) => {
3158
3261
  const { map, loaded } = useMap();
3159
- const overlayRef = React25.useRef(null);
3160
- const MapboxOverlayRef = React25.useRef(null);
3161
- React25.useEffect(() => {
3262
+ const overlayRef = React26.useRef(null);
3263
+ const MapboxOverlayRef = React26.useRef(null);
3264
+ React26.useEffect(() => {
3162
3265
  if (!map || !loaded) return;
3163
3266
  let cancelled = false;
3164
3267
  const initOverlay = async () => {
@@ -3198,12 +3301,12 @@ var DeckOverlay = ({
3198
3301
  }
3199
3302
  };
3200
3303
  }, [map, loaded, interleaved]);
3201
- React25.useEffect(() => {
3304
+ React26.useEffect(() => {
3202
3305
  if (overlayRef.current && "setProps" in overlayRef.current) {
3203
3306
  overlayRef.current.setProps({ layers });
3204
3307
  }
3205
3308
  }, [layers]);
3206
- React25.useEffect(() => {
3309
+ React26.useEffect(() => {
3207
3310
  if (overlayRef.current && "setProps" in overlayRef.current) {
3208
3311
  overlayRef.current.setProps({
3209
3312
  onHover,
@@ -3211,7 +3314,7 @@ var DeckOverlay = ({
3211
3314
  });
3212
3315
  }
3213
3316
  }, [onHover, onClick]);
3214
- React25.useEffect(() => {
3317
+ React26.useEffect(() => {
3215
3318
  if (overlayRef.current && effects && "setProps" in overlayRef.current) {
3216
3319
  overlayRef.current.setProps({ effects });
3217
3320
  }
@@ -3220,4 +3323,4 @@ var DeckOverlay = ({
3220
3323
  };
3221
3324
  DeckOverlay.displayName = "DeckOverlay";
3222
3325
 
3223
- export { BasemapSwitcher, CircleLayer, CoordinateDisplay, DeckOverlay, FillExtrusionLayer, FillLayer, HeatmapLayer, LayerManager, Legend, LegendGroup, LineLayer, Map2 as Map, MapContainer, MapContext, MapEmpty, MapError, MapSkeleton, Marker, Popup, PopupCard, PopupContent, PopupFooter, PopupHeader, Source, SymbolLayer, cn, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };
3326
+ export { BasemapSwitcher, CircleLayer, CoordinateDisplay, CustomControl, DeckOverlay, FillExtrusionLayer, FillLayer, HeatmapLayer, LayerManager, Legend, LegendGroup, LineLayer, Map2 as Map, MapContainer, MapContext, MapEmpty, MapError, MapSkeleton, Marker, Popup, PopupCard, PopupContent, PopupFooter, PopupHeader, Source, SymbolLayer, cn, useControlPosition, useCustomControl, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };