@classic-homes/maps-react 0.1.3 → 0.1.5
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.cjs +1040 -133
- package/dist/index.d.cts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +930 -129
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React25 = require('react');
|
|
4
4
|
var clsx = require('clsx');
|
|
5
5
|
var tailwindMerge = require('tailwind-merge');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -11,6 +11,9 @@ require('@classic-homes/maps-core/styles/marker.css');
|
|
|
11
11
|
var mapsCore = require('@classic-homes/maps-core');
|
|
12
12
|
var ReactDOM = require('react-dom');
|
|
13
13
|
var classVarianceAuthority = require('class-variance-authority');
|
|
14
|
+
require('@classic-homes/maps-core/styles/basemap-switcher.css');
|
|
15
|
+
require('@classic-homes/maps-core/styles/layer-manager.css');
|
|
16
|
+
var themeReact = require('@classic-homes/theme-react');
|
|
14
17
|
|
|
15
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
19
|
|
|
@@ -32,7 +35,7 @@ function _interopNamespace(e) {
|
|
|
32
35
|
return Object.freeze(n);
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
var
|
|
38
|
+
var React25__namespace = /*#__PURE__*/_interopNamespace(React25);
|
|
36
39
|
var maplibregl__default = /*#__PURE__*/_interopDefault(maplibregl);
|
|
37
40
|
var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
38
41
|
|
|
@@ -40,7 +43,7 @@ var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
|
|
|
40
43
|
function cn(...inputs) {
|
|
41
44
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
42
45
|
}
|
|
43
|
-
var MapSkeleton =
|
|
46
|
+
var MapSkeleton = React25__namespace.forwardRef(
|
|
44
47
|
({ height = 400, className, ...props }, ref) => {
|
|
45
48
|
const heightStyle = typeof height === "number" ? `${height}px` : height;
|
|
46
49
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -94,7 +97,7 @@ var MapSkeleton = React6__namespace.forwardRef(
|
|
|
94
97
|
}
|
|
95
98
|
);
|
|
96
99
|
MapSkeleton.displayName = "MapSkeleton";
|
|
97
|
-
var MapError =
|
|
100
|
+
var MapError = React25__namespace.forwardRef(
|
|
98
101
|
({ message = "Failed to load map", height = 400, onRetry, className, ...props }, ref) => {
|
|
99
102
|
const heightStyle = typeof height === "number" ? `${height}px` : height;
|
|
100
103
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -148,7 +151,7 @@ var MapError = React6__namespace.forwardRef(
|
|
|
148
151
|
}
|
|
149
152
|
);
|
|
150
153
|
MapError.displayName = "MapError";
|
|
151
|
-
var MapEmpty =
|
|
154
|
+
var MapEmpty = React25__namespace.forwardRef(
|
|
152
155
|
({ message = "No map data to display", height = 400, className, ...props }, ref) => {
|
|
153
156
|
const heightStyle = typeof height === "number" ? `${height}px` : height;
|
|
154
157
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -191,7 +194,7 @@ var MapEmpty = React6__namespace.forwardRef(
|
|
|
191
194
|
}
|
|
192
195
|
);
|
|
193
196
|
MapEmpty.displayName = "MapEmpty";
|
|
194
|
-
var MapContainer =
|
|
197
|
+
var MapContainer = React25__namespace.forwardRef(
|
|
195
198
|
({
|
|
196
199
|
title,
|
|
197
200
|
description,
|
|
@@ -240,8 +243,8 @@ var MapContainer = React6__namespace.forwardRef(
|
|
|
240
243
|
);
|
|
241
244
|
MapContainer.displayName = "MapContainer";
|
|
242
245
|
function useMapTheme(preference = "auto") {
|
|
243
|
-
const [isDark, setIsDark] =
|
|
244
|
-
const updateTheme =
|
|
246
|
+
const [isDark, setIsDark] = React25.useState(false);
|
|
247
|
+
const updateTheme = React25.useCallback(() => {
|
|
245
248
|
if (preference !== "auto") {
|
|
246
249
|
setIsDark(preference === "dark");
|
|
247
250
|
return;
|
|
@@ -251,7 +254,7 @@ function useMapTheme(preference = "auto") {
|
|
|
251
254
|
setIsDark(hasDarkClass);
|
|
252
255
|
}
|
|
253
256
|
}, [preference]);
|
|
254
|
-
|
|
257
|
+
React25.useEffect(() => {
|
|
255
258
|
updateTheme();
|
|
256
259
|
if (preference !== "auto" || typeof document === "undefined") return;
|
|
257
260
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -281,8 +284,8 @@ function useMapTheme(preference = "auto") {
|
|
|
281
284
|
};
|
|
282
285
|
}
|
|
283
286
|
function useReducedMotion() {
|
|
284
|
-
const [prefersReducedMotion2, setPrefersReducedMotion] =
|
|
285
|
-
|
|
287
|
+
const [prefersReducedMotion2, setPrefersReducedMotion] = React25.useState(false);
|
|
288
|
+
React25.useEffect(() => {
|
|
286
289
|
if (typeof window === "undefined") return;
|
|
287
290
|
const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
288
291
|
setPrefersReducedMotion(mediaQuery.matches);
|
|
@@ -296,9 +299,9 @@ function useReducedMotion() {
|
|
|
296
299
|
}, []);
|
|
297
300
|
return prefersReducedMotion2;
|
|
298
301
|
}
|
|
299
|
-
var MapContext =
|
|
302
|
+
var MapContext = React25__namespace.createContext(null);
|
|
300
303
|
function useMap() {
|
|
301
|
-
const context =
|
|
304
|
+
const context = React25__namespace.useContext(MapContext);
|
|
302
305
|
if (!context) {
|
|
303
306
|
throw new Error("useMap must be used within a Map component");
|
|
304
307
|
}
|
|
@@ -308,7 +311,7 @@ function useMapInstance() {
|
|
|
308
311
|
const { map, loaded } = useMap();
|
|
309
312
|
return loaded ? map : null;
|
|
310
313
|
}
|
|
311
|
-
var
|
|
314
|
+
var Map2 = React25__namespace.forwardRef(
|
|
312
315
|
({
|
|
313
316
|
// Base props
|
|
314
317
|
title,
|
|
@@ -362,25 +365,33 @@ var Map = React6__namespace.forwardRef(
|
|
|
362
365
|
onZoom,
|
|
363
366
|
onError
|
|
364
367
|
}, ref) => {
|
|
365
|
-
const containerRef =
|
|
366
|
-
const mapRef =
|
|
367
|
-
const [mapLoaded, setMapLoaded] =
|
|
368
|
-
const [mapError, setMapError] =
|
|
369
|
-
const
|
|
368
|
+
const containerRef = React25__namespace.useRef(null);
|
|
369
|
+
const mapRef = React25__namespace.useRef(null);
|
|
370
|
+
const [mapLoaded, setMapLoaded] = React25__namespace.useState(false);
|
|
371
|
+
const [mapError, setMapError] = React25__namespace.useState(null);
|
|
372
|
+
const [styleVersion, setStyleVersion] = React25__namespace.useState(0);
|
|
373
|
+
const activeStyleOverrideRef = React25__namespace.useRef(
|
|
374
|
+
null
|
|
375
|
+
);
|
|
376
|
+
const setMapStyle = React25__namespace.useCallback((style) => {
|
|
377
|
+
activeStyleOverrideRef.current = style;
|
|
378
|
+
mapRef.current?.setStyle(style);
|
|
379
|
+
}, []);
|
|
380
|
+
const customControlRegistryRef = React25__namespace.useRef({
|
|
370
381
|
"top-left": [],
|
|
371
382
|
"top-right": [],
|
|
372
383
|
"bottom-left": [],
|
|
373
384
|
"bottom-right": []
|
|
374
385
|
});
|
|
375
|
-
const [, forceUpdate] =
|
|
386
|
+
const [, forceUpdate] = React25__namespace.useReducer((x) => x + 1, 0);
|
|
376
387
|
const prefersReducedMotion2 = useReducedMotion();
|
|
377
388
|
const { style: themeStyle } = useMapTheme(themePref);
|
|
378
|
-
const onLoadRef =
|
|
389
|
+
const onLoadRef = React25__namespace.useRef(onLoad);
|
|
379
390
|
onLoadRef.current = onLoad;
|
|
380
|
-
const onErrorRef =
|
|
391
|
+
const onErrorRef = React25__namespace.useRef(onError);
|
|
381
392
|
onErrorRef.current = onError;
|
|
382
393
|
const mapStyle = customStyle || themeStyle;
|
|
383
|
-
const controlOffsets =
|
|
394
|
+
const controlOffsets = React25__namespace.useMemo(() => {
|
|
384
395
|
const offsets = {
|
|
385
396
|
"top-left": 0,
|
|
386
397
|
"top-right": 0,
|
|
@@ -410,7 +421,7 @@ var Map = React6__namespace.forwardRef(
|
|
|
410
421
|
geolocateControl,
|
|
411
422
|
geolocateControlPosition
|
|
412
423
|
]);
|
|
413
|
-
const registerControl =
|
|
424
|
+
const registerControl = React25__namespace.useCallback(
|
|
414
425
|
(id, position, height2) => {
|
|
415
426
|
const registry = customControlRegistryRef.current;
|
|
416
427
|
const positionControls = registry[position] || [];
|
|
@@ -431,13 +442,13 @@ var Map = React6__namespace.forwardRef(
|
|
|
431
442
|
},
|
|
432
443
|
[]
|
|
433
444
|
);
|
|
434
|
-
const unregisterControl =
|
|
445
|
+
const unregisterControl = React25__namespace.useCallback((id, position) => {
|
|
435
446
|
const registry = customControlRegistryRef.current;
|
|
436
447
|
const positionControls = registry[position] || [];
|
|
437
448
|
registry[position] = positionControls.filter((c) => c.id !== id);
|
|
438
449
|
forceUpdate();
|
|
439
450
|
}, []);
|
|
440
|
-
const getCustomControlOffset =
|
|
451
|
+
const getCustomControlOffset = React25__namespace.useCallback((id, position) => {
|
|
441
452
|
const registry = customControlRegistryRef.current;
|
|
442
453
|
const positionControls = registry[position] || [];
|
|
443
454
|
let offset = 0;
|
|
@@ -451,7 +462,7 @@ var Map = React6__namespace.forwardRef(
|
|
|
451
462
|
center,
|
|
452
463
|
zoom
|
|
453
464
|
});
|
|
454
|
-
|
|
465
|
+
React25__namespace.useEffect(() => {
|
|
455
466
|
if (!containerRef.current || mapRef.current) return;
|
|
456
467
|
try {
|
|
457
468
|
const map = new maplibregl__default.default.Map({
|
|
@@ -474,6 +485,9 @@ var Map = React6__namespace.forwardRef(
|
|
|
474
485
|
attributionControl: attributionControl ? { customAttribution } : false
|
|
475
486
|
});
|
|
476
487
|
mapRef.current = map;
|
|
488
|
+
map.on("style.load", () => {
|
|
489
|
+
setStyleVersion((v) => v + 1);
|
|
490
|
+
});
|
|
477
491
|
if (navigationControl) {
|
|
478
492
|
map.addControl(
|
|
479
493
|
new maplibregl__default.default.NavigationControl({
|
|
@@ -528,16 +542,22 @@ var Map = React6__namespace.forwardRef(
|
|
|
528
542
|
onErrorRef.current?.({ type: "error", message: errorMessage, error: err });
|
|
529
543
|
}
|
|
530
544
|
}, []);
|
|
531
|
-
const styleInitialized =
|
|
532
|
-
|
|
545
|
+
const styleInitialized = React25__namespace.useRef(false);
|
|
546
|
+
React25__namespace.useEffect(() => {
|
|
533
547
|
if (!mapRef.current || !mapLoaded) return;
|
|
534
548
|
if (!styleInitialized.current) {
|
|
535
549
|
styleInitialized.current = true;
|
|
536
550
|
return;
|
|
537
551
|
}
|
|
552
|
+
if (activeStyleOverrideRef.current) return;
|
|
538
553
|
mapRef.current.setStyle(mapStyle);
|
|
539
554
|
}, [mapStyle, mapLoaded]);
|
|
540
|
-
|
|
555
|
+
React25__namespace.useEffect(() => {
|
|
556
|
+
if (customStyle) {
|
|
557
|
+
activeStyleOverrideRef.current = null;
|
|
558
|
+
}
|
|
559
|
+
}, [customStyle]);
|
|
560
|
+
React25__namespace.useEffect(() => {
|
|
541
561
|
const map = mapRef.current;
|
|
542
562
|
if (!map || !mapLoaded) return;
|
|
543
563
|
const createEventParams = (e) => ({
|
|
@@ -657,7 +677,9 @@ var Map = React6__namespace.forwardRef(
|
|
|
657
677
|
controlOffsets,
|
|
658
678
|
registerControl,
|
|
659
679
|
unregisterControl,
|
|
660
|
-
getCustomControlOffset
|
|
680
|
+
getCustomControlOffset,
|
|
681
|
+
styleVersion,
|
|
682
|
+
setMapStyle
|
|
661
683
|
},
|
|
662
684
|
children: [
|
|
663
685
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: "absolute inset-0" }),
|
|
@@ -669,7 +691,7 @@ var Map = React6__namespace.forwardRef(
|
|
|
669
691
|
);
|
|
670
692
|
}
|
|
671
693
|
);
|
|
672
|
-
|
|
694
|
+
Map2.displayName = "Map";
|
|
673
695
|
var Source = ({
|
|
674
696
|
id,
|
|
675
697
|
type,
|
|
@@ -689,10 +711,10 @@ var Source = ({
|
|
|
689
711
|
fitBoundsAnimate = true,
|
|
690
712
|
children
|
|
691
713
|
}) => {
|
|
692
|
-
const { map, loaded } = useMap();
|
|
693
|
-
const sourceAdded =
|
|
694
|
-
const initialFitDone =
|
|
695
|
-
const fitBoundsParamsRef =
|
|
714
|
+
const { map, loaded, styleVersion } = useMap();
|
|
715
|
+
const sourceAdded = React25__namespace.useRef(false);
|
|
716
|
+
const initialFitDone = React25__namespace.useRef(false);
|
|
717
|
+
const fitBoundsParamsRef = React25__namespace.useRef({
|
|
696
718
|
shouldFitBounds,
|
|
697
719
|
data,
|
|
698
720
|
fitBoundsPadding,
|
|
@@ -708,7 +730,7 @@ var Source = ({
|
|
|
708
730
|
fitBoundsAnimate,
|
|
709
731
|
type
|
|
710
732
|
};
|
|
711
|
-
const performFitBounds =
|
|
733
|
+
const performFitBounds = React25__namespace.useCallback(
|
|
712
734
|
(cancelledRef) => {
|
|
713
735
|
const params = fitBoundsParamsRef.current;
|
|
714
736
|
if (cancelledRef.current || !params.shouldFitBounds || initialFitDone.current) return;
|
|
@@ -752,7 +774,7 @@ var Source = ({
|
|
|
752
774
|
},
|
|
753
775
|
[map]
|
|
754
776
|
);
|
|
755
|
-
|
|
777
|
+
React25__namespace.useEffect(() => {
|
|
756
778
|
if (!map || !loaded || sourceAdded.current) return;
|
|
757
779
|
if (map.getSource(id)) {
|
|
758
780
|
sourceAdded.current = true;
|
|
@@ -878,7 +900,6 @@ var Source = ({
|
|
|
878
900
|
} catch {
|
|
879
901
|
}
|
|
880
902
|
sourceAdded.current = false;
|
|
881
|
-
initialFitDone.current = false;
|
|
882
903
|
}
|
|
883
904
|
};
|
|
884
905
|
} catch (err) {
|
|
@@ -898,27 +919,44 @@ var Source = ({
|
|
|
898
919
|
clusterMaxZoom,
|
|
899
920
|
generateId,
|
|
900
921
|
promoteId,
|
|
901
|
-
performFitBounds
|
|
922
|
+
performFitBounds,
|
|
902
923
|
// stable due to using ref for params
|
|
924
|
+
styleVersion
|
|
925
|
+
// re-add source after basemap style changes
|
|
903
926
|
]);
|
|
904
|
-
|
|
927
|
+
React25__namespace.useEffect(() => {
|
|
905
928
|
if (!map || !loaded || !sourceAdded.current || type !== "geojson") return;
|
|
906
929
|
const source = map.getSource(id);
|
|
907
930
|
if (!source) return;
|
|
931
|
+
let cancelled = false;
|
|
908
932
|
try {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
933
|
+
const newData = typeof data === "string" ? data : data && typeof data === "object" ? data : null;
|
|
934
|
+
if (!newData) return;
|
|
935
|
+
const handleSourceData = (e) => {
|
|
936
|
+
if (cancelled) return;
|
|
937
|
+
if (e.sourceId === id && e.isSourceLoaded) {
|
|
938
|
+
map.off("sourcedata", handleSourceData);
|
|
939
|
+
map.triggerRepaint();
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
if (cluster) {
|
|
943
|
+
map.on("sourcedata", handleSourceData);
|
|
913
944
|
}
|
|
945
|
+
source.setData(newData);
|
|
946
|
+
return () => {
|
|
947
|
+
cancelled = true;
|
|
948
|
+
if (cluster) {
|
|
949
|
+
map.off("sourcedata", handleSourceData);
|
|
950
|
+
}
|
|
951
|
+
};
|
|
914
952
|
} catch (err) {
|
|
915
953
|
console.error(`[maps-react] Failed to update source "${id}" data:`, err);
|
|
916
954
|
}
|
|
917
|
-
}, [map, loaded, id, type, data]);
|
|
955
|
+
}, [map, loaded, id, type, data, cluster]);
|
|
918
956
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
919
957
|
};
|
|
920
958
|
Source.displayName = "Source";
|
|
921
|
-
var Marker =
|
|
959
|
+
var Marker = React25__namespace.forwardRef(
|
|
922
960
|
({
|
|
923
961
|
id,
|
|
924
962
|
coordinates,
|
|
@@ -934,27 +972,27 @@ var Marker = React6__namespace.forwardRef(
|
|
|
934
972
|
children
|
|
935
973
|
}, ref) => {
|
|
936
974
|
const { map, loaded } = useMap();
|
|
937
|
-
const markerRef =
|
|
938
|
-
const elementRef =
|
|
939
|
-
const originalLngLatRef =
|
|
940
|
-
const clickHandlerRef =
|
|
941
|
-
const [mounted, setMounted] =
|
|
942
|
-
const onClickRef =
|
|
975
|
+
const markerRef = React25__namespace.useRef(null);
|
|
976
|
+
const elementRef = React25__namespace.useRef(null);
|
|
977
|
+
const originalLngLatRef = React25__namespace.useRef();
|
|
978
|
+
const clickHandlerRef = React25__namespace.useRef(null);
|
|
979
|
+
const [mounted, setMounted] = React25__namespace.useState(false);
|
|
980
|
+
const onClickRef = React25__namespace.useRef(onClick);
|
|
943
981
|
onClickRef.current = onClick;
|
|
944
|
-
const onDragRef =
|
|
982
|
+
const onDragRef = React25__namespace.useRef(onDrag);
|
|
945
983
|
onDragRef.current = onDrag;
|
|
946
|
-
const onDragEndRef =
|
|
984
|
+
const onDragEndRef = React25__namespace.useRef(onDragEnd);
|
|
947
985
|
onDragEndRef.current = onDragEnd;
|
|
948
|
-
|
|
986
|
+
React25__namespace.useEffect(() => {
|
|
949
987
|
setMounted(true);
|
|
950
988
|
return () => setMounted(false);
|
|
951
989
|
}, []);
|
|
952
|
-
|
|
990
|
+
React25__namespace.useEffect(() => {
|
|
953
991
|
if (children && !elementRef.current) {
|
|
954
992
|
elementRef.current = document.createElement("div");
|
|
955
993
|
}
|
|
956
994
|
}, [children]);
|
|
957
|
-
|
|
995
|
+
React25__namespace.useEffect(() => {
|
|
958
996
|
if (!map || !loaded || !mounted) return;
|
|
959
997
|
if (markerRef.current) return;
|
|
960
998
|
const markerOptions = {
|
|
@@ -1038,17 +1076,17 @@ var Marker = React6__namespace.forwardRef(
|
|
|
1038
1076
|
}
|
|
1039
1077
|
};
|
|
1040
1078
|
}, [map, loaded, mounted]);
|
|
1041
|
-
|
|
1079
|
+
React25__namespace.useEffect(() => {
|
|
1042
1080
|
if (markerRef.current) {
|
|
1043
1081
|
markerRef.current.setLngLat(coordinates);
|
|
1044
1082
|
}
|
|
1045
1083
|
}, [coordinates]);
|
|
1046
|
-
|
|
1084
|
+
React25__namespace.useEffect(() => {
|
|
1047
1085
|
if (markerRef.current) {
|
|
1048
1086
|
markerRef.current.setDraggable(draggable);
|
|
1049
1087
|
}
|
|
1050
1088
|
}, [draggable]);
|
|
1051
|
-
|
|
1089
|
+
React25__namespace.useEffect(() => {
|
|
1052
1090
|
if (markerRef.current && rotation !== void 0) {
|
|
1053
1091
|
markerRef.current.setRotation(rotation);
|
|
1054
1092
|
}
|
|
@@ -1094,7 +1132,7 @@ function panToFitPopup(map, popup, padding) {
|
|
|
1094
1132
|
});
|
|
1095
1133
|
}
|
|
1096
1134
|
}
|
|
1097
|
-
var Popup =
|
|
1135
|
+
var Popup = React25__namespace.forwardRef(
|
|
1098
1136
|
({
|
|
1099
1137
|
coordinates,
|
|
1100
1138
|
closeButton = true,
|
|
@@ -1112,25 +1150,25 @@ var Popup = React6__namespace.forwardRef(
|
|
|
1112
1150
|
children
|
|
1113
1151
|
}, ref) => {
|
|
1114
1152
|
const { map, loaded } = useMap();
|
|
1115
|
-
const popupRef =
|
|
1116
|
-
const onOpenRef =
|
|
1153
|
+
const popupRef = React25__namespace.useRef(null);
|
|
1154
|
+
const onOpenRef = React25__namespace.useRef(onOpen);
|
|
1117
1155
|
onOpenRef.current = onOpen;
|
|
1118
|
-
const onCloseRef =
|
|
1156
|
+
const onCloseRef = React25__namespace.useRef(onClose);
|
|
1119
1157
|
onCloseRef.current = onClose;
|
|
1120
|
-
const coordinatesRef =
|
|
1158
|
+
const coordinatesRef = React25__namespace.useRef(coordinates);
|
|
1121
1159
|
coordinatesRef.current = coordinates;
|
|
1122
|
-
const containerRef =
|
|
1160
|
+
const containerRef = React25__namespace.useRef(null);
|
|
1123
1161
|
if (!containerRef.current && typeof document !== "undefined") {
|
|
1124
1162
|
containerRef.current = document.createElement("div");
|
|
1125
1163
|
containerRef.current.className = "maplibregl-popup-content-wrapper";
|
|
1126
1164
|
}
|
|
1127
|
-
const [contentReady, setContentReady] =
|
|
1128
|
-
const contentCallbackRef =
|
|
1165
|
+
const [contentReady, setContentReady] = React25__namespace.useState(false);
|
|
1166
|
+
const contentCallbackRef = React25__namespace.useCallback((node) => {
|
|
1129
1167
|
if (node && containerRef.current) {
|
|
1130
1168
|
setContentReady(true);
|
|
1131
1169
|
}
|
|
1132
1170
|
}, []);
|
|
1133
|
-
|
|
1171
|
+
React25__namespace.useEffect(() => {
|
|
1134
1172
|
if (!map || !loaded || !containerRef.current) return;
|
|
1135
1173
|
const popup = new maplibregl__default.default.Popup({
|
|
1136
1174
|
closeButton,
|
|
@@ -1170,7 +1208,7 @@ var Popup = React6__namespace.forwardRef(
|
|
|
1170
1208
|
maxWidth,
|
|
1171
1209
|
focusAfterOpen
|
|
1172
1210
|
]);
|
|
1173
|
-
|
|
1211
|
+
React25__namespace.useEffect(() => {
|
|
1174
1212
|
if (!popupRef.current || !ref) return;
|
|
1175
1213
|
if (typeof ref === "function") {
|
|
1176
1214
|
ref(popupRef.current);
|
|
@@ -1178,12 +1216,12 @@ var Popup = React6__namespace.forwardRef(
|
|
|
1178
1216
|
ref.current = popupRef.current;
|
|
1179
1217
|
}
|
|
1180
1218
|
}, [ref]);
|
|
1181
|
-
|
|
1219
|
+
React25__namespace.useEffect(() => {
|
|
1182
1220
|
if (popupRef.current) {
|
|
1183
1221
|
popupRef.current.setLngLat(coordinates);
|
|
1184
1222
|
}
|
|
1185
1223
|
}, [coordinates]);
|
|
1186
|
-
|
|
1224
|
+
React25__namespace.useEffect(() => {
|
|
1187
1225
|
if (!map || !popupRef.current || !contentReady) return;
|
|
1188
1226
|
let rafHandle;
|
|
1189
1227
|
if (open) {
|
|
@@ -1212,7 +1250,7 @@ var Popup = React6__namespace.forwardRef(
|
|
|
1212
1250
|
}
|
|
1213
1251
|
);
|
|
1214
1252
|
Popup.displayName = "Popup";
|
|
1215
|
-
var PopupCard =
|
|
1253
|
+
var PopupCard = React25__namespace.forwardRef(
|
|
1216
1254
|
({ className, children, ...props }, ref) => {
|
|
1217
1255
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("bg-popover text-popover-foreground", className), ...props, children });
|
|
1218
1256
|
}
|
|
@@ -1232,7 +1270,7 @@ var badgeVariants = classVarianceAuthority.cva("text-xs px-1.5 py-0.5 rounded fo
|
|
|
1232
1270
|
badgeVariant: "secondary"
|
|
1233
1271
|
}
|
|
1234
1272
|
});
|
|
1235
|
-
var PopupHeader =
|
|
1273
|
+
var PopupHeader = React25__namespace.forwardRef(
|
|
1236
1274
|
({ className, title, badge, badgeVariant, ...props }, ref) => {
|
|
1237
1275
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1238
1276
|
"div",
|
|
@@ -1252,13 +1290,13 @@ var PopupHeader = React6__namespace.forwardRef(
|
|
|
1252
1290
|
}
|
|
1253
1291
|
);
|
|
1254
1292
|
PopupHeader.displayName = "PopupHeader";
|
|
1255
|
-
var PopupContent =
|
|
1293
|
+
var PopupContent = React25__namespace.forwardRef(
|
|
1256
1294
|
({ className, children, ...props }, ref) => {
|
|
1257
1295
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("px-4 py-3 text-sm", className), ...props, children });
|
|
1258
1296
|
}
|
|
1259
1297
|
);
|
|
1260
1298
|
PopupContent.displayName = "PopupContent";
|
|
1261
|
-
var PopupFooter =
|
|
1299
|
+
var PopupFooter = React25__namespace.forwardRef(
|
|
1262
1300
|
({ className, children, ...props }, ref) => {
|
|
1263
1301
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1264
1302
|
"div",
|
|
@@ -1292,12 +1330,15 @@ function useLayer({
|
|
|
1292
1330
|
onHover,
|
|
1293
1331
|
hoverThrottleMs = 0
|
|
1294
1332
|
}) {
|
|
1295
|
-
const { map, loaded } = useMap();
|
|
1296
|
-
const [layerAdded, setLayerAdded] =
|
|
1297
|
-
const hoveredFeatureId =
|
|
1298
|
-
const lastHoverCallTime =
|
|
1299
|
-
const lastMousePosition =
|
|
1300
|
-
|
|
1333
|
+
const { map, loaded, styleVersion } = useMap();
|
|
1334
|
+
const [layerAdded, setLayerAdded] = React25__namespace.useState(false);
|
|
1335
|
+
const hoveredFeatureId = React25__namespace.useRef(null);
|
|
1336
|
+
const lastHoverCallTime = React25__namespace.useRef(0);
|
|
1337
|
+
const lastMousePosition = React25__namespace.useRef(null);
|
|
1338
|
+
React25__namespace.useEffect(() => {
|
|
1339
|
+
hoveredFeatureId.current = null;
|
|
1340
|
+
}, [styleVersion]);
|
|
1341
|
+
React25__namespace.useEffect(() => {
|
|
1301
1342
|
if (!map || !loaded) return;
|
|
1302
1343
|
if (!map.getSource(source)) {
|
|
1303
1344
|
let timeoutId = null;
|
|
@@ -1367,25 +1408,25 @@ function useLayer({
|
|
|
1367
1408
|
setLayerAdded(false);
|
|
1368
1409
|
}
|
|
1369
1410
|
};
|
|
1370
|
-
}, [map, loaded, id, source, sourceLayer, type, beforeId]);
|
|
1371
|
-
|
|
1411
|
+
}, [map, loaded, id, source, sourceLayer, type, beforeId, styleVersion]);
|
|
1412
|
+
React25__namespace.useEffect(() => {
|
|
1372
1413
|
if (!map || !layerAdded) return;
|
|
1373
1414
|
if (!map.getLayer(id)) return;
|
|
1374
1415
|
map.setLayoutProperty(id, "visibility", visible ? "visible" : "none");
|
|
1375
1416
|
}, [map, id, visible, layerAdded]);
|
|
1376
|
-
|
|
1417
|
+
React25__namespace.useEffect(() => {
|
|
1377
1418
|
if (!map || !layerAdded) return;
|
|
1378
1419
|
if (!map.getLayer(id)) return;
|
|
1379
1420
|
Object.entries(paint).forEach(([key, value]) => {
|
|
1380
1421
|
map.setPaintProperty(id, key, value);
|
|
1381
1422
|
});
|
|
1382
1423
|
}, [map, id, paint, layerAdded]);
|
|
1383
|
-
|
|
1424
|
+
React25__namespace.useEffect(() => {
|
|
1384
1425
|
if (!map || !layerAdded || !filter) return;
|
|
1385
1426
|
if (!map.getLayer(id)) return;
|
|
1386
1427
|
map.setFilter(id, filter);
|
|
1387
1428
|
}, [map, id, filter, layerAdded]);
|
|
1388
|
-
|
|
1429
|
+
React25__namespace.useEffect(() => {
|
|
1389
1430
|
if (!map || !layerAdded) return;
|
|
1390
1431
|
const createFeatureParams = (e) => {
|
|
1391
1432
|
const feature = e.features?.[0];
|
|
@@ -1521,7 +1562,7 @@ var FillLayer = ({
|
|
|
1521
1562
|
fillTranslate,
|
|
1522
1563
|
fillAntialias
|
|
1523
1564
|
}) => {
|
|
1524
|
-
const paint =
|
|
1565
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1525
1566
|
const p = {};
|
|
1526
1567
|
if (fillColor !== void 0) p["fill-color"] = fillColor;
|
|
1527
1568
|
if (fillOpacity !== void 0) p["fill-opacity"] = fillOpacity;
|
|
@@ -1542,7 +1583,7 @@ var FillLayer = ({
|
|
|
1542
1583
|
fillAntialias,
|
|
1543
1584
|
opacity
|
|
1544
1585
|
]);
|
|
1545
|
-
const layout =
|
|
1586
|
+
const layout = React25__namespace.useMemo(() => ({}), []);
|
|
1546
1587
|
useLayer({
|
|
1547
1588
|
id,
|
|
1548
1589
|
source,
|
|
@@ -1586,7 +1627,7 @@ var LineLayer = ({
|
|
|
1586
1627
|
lineOffset,
|
|
1587
1628
|
lineGradient
|
|
1588
1629
|
}) => {
|
|
1589
|
-
const paint =
|
|
1630
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1590
1631
|
const p = {};
|
|
1591
1632
|
if (lineColor !== void 0) p["line-color"] = lineColor;
|
|
1592
1633
|
if (lineWidth !== void 0) p["line-width"] = lineWidth;
|
|
@@ -1611,7 +1652,7 @@ var LineLayer = ({
|
|
|
1611
1652
|
lineGradient,
|
|
1612
1653
|
opacity
|
|
1613
1654
|
]);
|
|
1614
|
-
const layout =
|
|
1655
|
+
const layout = React25__namespace.useMemo(() => {
|
|
1615
1656
|
const l = {};
|
|
1616
1657
|
if (lineCap !== void 0) l["line-cap"] = lineCap;
|
|
1617
1658
|
if (lineJoin !== void 0) l["line-join"] = lineJoin;
|
|
@@ -1660,7 +1701,7 @@ var CircleLayer = ({
|
|
|
1660
1701
|
circlePitchScale,
|
|
1661
1702
|
circleTranslate
|
|
1662
1703
|
}) => {
|
|
1663
|
-
const paint =
|
|
1704
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1664
1705
|
const p = {};
|
|
1665
1706
|
if (circleRadius !== void 0) p["circle-radius"] = circleRadius;
|
|
1666
1707
|
if (circleColor !== void 0) p["circle-color"] = circleColor;
|
|
@@ -1689,7 +1730,7 @@ var CircleLayer = ({
|
|
|
1689
1730
|
circleTranslate,
|
|
1690
1731
|
opacity
|
|
1691
1732
|
]);
|
|
1692
|
-
const layout =
|
|
1733
|
+
const layout = React25__namespace.useMemo(() => ({}), []);
|
|
1693
1734
|
useLayer({
|
|
1694
1735
|
id,
|
|
1695
1736
|
source,
|
|
@@ -1749,7 +1790,7 @@ var SymbolLayer = ({
|
|
|
1749
1790
|
symbolSpacing,
|
|
1750
1791
|
symbolSortKey
|
|
1751
1792
|
}) => {
|
|
1752
|
-
const paint =
|
|
1793
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1753
1794
|
const p = {};
|
|
1754
1795
|
if (iconOpacity !== void 0) p["icon-opacity"] = iconOpacity;
|
|
1755
1796
|
if (iconColor !== void 0) p["icon-color"] = iconColor;
|
|
@@ -1770,7 +1811,7 @@ var SymbolLayer = ({
|
|
|
1770
1811
|
textHaloColor,
|
|
1771
1812
|
textHaloWidth
|
|
1772
1813
|
]);
|
|
1773
|
-
const layout =
|
|
1814
|
+
const layout = React25__namespace.useMemo(() => {
|
|
1774
1815
|
const l = {};
|
|
1775
1816
|
if (iconImage !== void 0) l["icon-image"] = iconImage;
|
|
1776
1817
|
if (iconSize !== void 0) l["icon-size"] = iconSize;
|
|
@@ -1851,7 +1892,7 @@ var FillExtrusionLayer = ({
|
|
|
1851
1892
|
fillExtrusionTranslate,
|
|
1852
1893
|
fillExtrusionVerticalGradient
|
|
1853
1894
|
}) => {
|
|
1854
|
-
const paint =
|
|
1895
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1855
1896
|
const p = {};
|
|
1856
1897
|
if (fillExtrusionHeight !== void 0) p["fill-extrusion-height"] = fillExtrusionHeight;
|
|
1857
1898
|
if (fillExtrusionBase !== void 0) p["fill-extrusion-base"] = fillExtrusionBase;
|
|
@@ -1877,7 +1918,7 @@ var FillExtrusionLayer = ({
|
|
|
1877
1918
|
fillExtrusionVerticalGradient,
|
|
1878
1919
|
opacity
|
|
1879
1920
|
]);
|
|
1880
|
-
const layout =
|
|
1921
|
+
const layout = React25__namespace.useMemo(() => ({}), []);
|
|
1881
1922
|
useLayer({
|
|
1882
1923
|
id,
|
|
1883
1924
|
source,
|
|
@@ -1916,7 +1957,7 @@ var HeatmapLayer = ({
|
|
|
1916
1957
|
heatmapRadius,
|
|
1917
1958
|
heatmapOpacity
|
|
1918
1959
|
}) => {
|
|
1919
|
-
const paint =
|
|
1960
|
+
const paint = React25__namespace.useMemo(() => {
|
|
1920
1961
|
const p = {};
|
|
1921
1962
|
if (heatmapIntensity !== void 0) p["heatmap-intensity"] = heatmapIntensity;
|
|
1922
1963
|
if (heatmapWeight !== void 0) p["heatmap-weight"] = heatmapWeight;
|
|
@@ -1928,7 +1969,7 @@ var HeatmapLayer = ({
|
|
|
1928
1969
|
}
|
|
1929
1970
|
return p;
|
|
1930
1971
|
}, [heatmapIntensity, heatmapWeight, heatmapColor, heatmapRadius, heatmapOpacity, opacity]);
|
|
1931
|
-
const layout =
|
|
1972
|
+
const layout = React25__namespace.useMemo(() => ({}), []);
|
|
1932
1973
|
useLayer({
|
|
1933
1974
|
id,
|
|
1934
1975
|
source,
|
|
@@ -1963,11 +2004,11 @@ var Legend = ({
|
|
|
1963
2004
|
onItemClick
|
|
1964
2005
|
}) => {
|
|
1965
2006
|
const { controlOffsets, registerControl, unregisterControl } = useMap();
|
|
1966
|
-
const [isCollapsed, setIsCollapsed] =
|
|
1967
|
-
const [customControlOffset, setCustomControlOffset] =
|
|
1968
|
-
const legendRef =
|
|
1969
|
-
const legendIdRef =
|
|
1970
|
-
|
|
2007
|
+
const [isCollapsed, setIsCollapsed] = React25__namespace.useState(initialCollapsed);
|
|
2008
|
+
const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
|
|
2009
|
+
const legendRef = React25__namespace.useRef(null);
|
|
2010
|
+
const legendIdRef = React25__namespace.useRef(`legend-${++legendIdCounter}`);
|
|
2011
|
+
React25__namespace.useEffect(() => {
|
|
1971
2012
|
if (!legendRef.current || !registerControl) return;
|
|
1972
2013
|
const updatePosition = () => {
|
|
1973
2014
|
if (!legendRef.current) return;
|
|
@@ -1983,7 +2024,7 @@ var Legend = ({
|
|
|
1983
2024
|
unregisterControl?.(legendIdRef.current, position);
|
|
1984
2025
|
};
|
|
1985
2026
|
}, [position, registerControl, unregisterControl]);
|
|
1986
|
-
const verticalOffsetStyle =
|
|
2027
|
+
const verticalOffsetStyle = React25__namespace.useMemo(() => {
|
|
1987
2028
|
return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
|
|
1988
2029
|
}, [customControlOffset, position]);
|
|
1989
2030
|
const handleItemClick = (item, index) => {
|
|
@@ -1996,13 +2037,13 @@ var Legend = ({
|
|
|
1996
2037
|
setIsCollapsed(!isCollapsed);
|
|
1997
2038
|
}
|
|
1998
2039
|
};
|
|
1999
|
-
const gradientStyle =
|
|
2040
|
+
const gradientStyle = React25__namespace.useMemo(() => {
|
|
2000
2041
|
if (type !== "gradient" || gradient.length === 0) return "";
|
|
2001
2042
|
const stops = gradient.map((stop) => `${stop.color} ${stop.position * 100}%`).join(", ");
|
|
2002
2043
|
return `linear-gradient(to right, ${stops})`;
|
|
2003
2044
|
}, [type, gradient]);
|
|
2004
2045
|
const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
|
|
2005
|
-
const computedPositionClasses =
|
|
2046
|
+
const computedPositionClasses = React25__namespace.useMemo(() => {
|
|
2006
2047
|
return mapsCore.computePositionClasses(position, hasControlsAtPosition);
|
|
2007
2048
|
}, [position, hasControlsAtPosition]);
|
|
2008
2049
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2101,15 +2142,15 @@ var LegendGroup = ({
|
|
|
2101
2142
|
class: className
|
|
2102
2143
|
}) => {
|
|
2103
2144
|
const { controlOffsets, registerControl, unregisterControl } = useMap();
|
|
2104
|
-
const containerRef =
|
|
2105
|
-
const groupIdRef =
|
|
2106
|
-
const [customControlOffset, setCustomControlOffset] =
|
|
2145
|
+
const containerRef = React25__namespace.useRef(null);
|
|
2146
|
+
const groupIdRef = React25__namespace.useRef(`legend-group-${++legendGroupIdCounter}`);
|
|
2147
|
+
const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
|
|
2107
2148
|
const getInitialExpanded = () => {
|
|
2108
2149
|
if (controlledExpanded !== void 0) return controlledExpanded;
|
|
2109
2150
|
if (defaultExpanded) return defaultExpanded;
|
|
2110
2151
|
return legends[0]?.id || null;
|
|
2111
2152
|
};
|
|
2112
|
-
const [internalExpanded, setInternalExpanded] =
|
|
2153
|
+
const [internalExpanded, setInternalExpanded] = React25__namespace.useState(getInitialExpanded);
|
|
2113
2154
|
const expandedId = controlledExpanded !== void 0 ? controlledExpanded : internalExpanded;
|
|
2114
2155
|
const handleToggle = (id) => {
|
|
2115
2156
|
const newExpanded = expandedId === id ? allowCollapseAll ? null : id : id;
|
|
@@ -2118,7 +2159,7 @@ var LegendGroup = ({
|
|
|
2118
2159
|
}
|
|
2119
2160
|
onExpandedChange?.(newExpanded);
|
|
2120
2161
|
};
|
|
2121
|
-
|
|
2162
|
+
React25__namespace.useEffect(() => {
|
|
2122
2163
|
if (!containerRef.current || !registerControl) return;
|
|
2123
2164
|
const timeoutId = setTimeout(() => {
|
|
2124
2165
|
if (containerRef.current) {
|
|
@@ -2132,11 +2173,11 @@ var LegendGroup = ({
|
|
|
2132
2173
|
unregisterControl?.(groupIdRef.current, position);
|
|
2133
2174
|
};
|
|
2134
2175
|
}, [position, expandedId, registerControl, unregisterControl]);
|
|
2135
|
-
const verticalOffsetStyle =
|
|
2176
|
+
const verticalOffsetStyle = React25__namespace.useMemo(() => {
|
|
2136
2177
|
return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
|
|
2137
2178
|
}, [customControlOffset, position]);
|
|
2138
2179
|
const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
|
|
2139
|
-
const computedPositionClasses =
|
|
2180
|
+
const computedPositionClasses = React25__namespace.useMemo(() => {
|
|
2140
2181
|
return mapsCore.computePositionClasses(position, hasControlsAtPosition);
|
|
2141
2182
|
}, [position, hasControlsAtPosition]);
|
|
2142
2183
|
const getGradientStyle = (legend) => {
|
|
@@ -2267,13 +2308,13 @@ var CoordinateDisplay = ({
|
|
|
2267
2308
|
class: className
|
|
2268
2309
|
}) => {
|
|
2269
2310
|
const { map, loaded, controlOffsets, registerControl, unregisterControl } = useMap();
|
|
2270
|
-
const [cursorLngLat, setCursorLngLat] =
|
|
2271
|
-
const [currentZoom, setCurrentZoom] =
|
|
2272
|
-
const [currentBearing, setCurrentBearing] =
|
|
2273
|
-
const [customControlOffset, setCustomControlOffset] =
|
|
2274
|
-
const controlRef =
|
|
2275
|
-
const controlIdRef =
|
|
2276
|
-
|
|
2311
|
+
const [cursorLngLat, setCursorLngLat] = React25__namespace.useState(null);
|
|
2312
|
+
const [currentZoom, setCurrentZoom] = React25__namespace.useState(0);
|
|
2313
|
+
const [currentBearing, setCurrentBearing] = React25__namespace.useState(0);
|
|
2314
|
+
const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
|
|
2315
|
+
const controlRef = React25__namespace.useRef(null);
|
|
2316
|
+
const controlIdRef = React25__namespace.useRef(`coord-display-${++coordDisplayIdCounter}`);
|
|
2317
|
+
React25__namespace.useEffect(() => {
|
|
2277
2318
|
if (!controlRef.current || !registerControl) return;
|
|
2278
2319
|
const updatePosition = () => {
|
|
2279
2320
|
if (!controlRef.current) return;
|
|
@@ -2289,10 +2330,10 @@ var CoordinateDisplay = ({
|
|
|
2289
2330
|
unregisterControl?.(controlIdRef.current, position);
|
|
2290
2331
|
};
|
|
2291
2332
|
}, [position, registerControl, unregisterControl]);
|
|
2292
|
-
const verticalOffsetStyle =
|
|
2333
|
+
const verticalOffsetStyle = React25__namespace.useMemo(() => {
|
|
2293
2334
|
return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
|
|
2294
2335
|
}, [customControlOffset, position]);
|
|
2295
|
-
const formatCoord =
|
|
2336
|
+
const formatCoord = React25__namespace.useCallback(
|
|
2296
2337
|
(lngLat) => {
|
|
2297
2338
|
return mapsCore.formatCoordinates(lngLat, precision, format);
|
|
2298
2339
|
},
|
|
@@ -2306,10 +2347,10 @@ var CoordinateDisplay = ({
|
|
|
2306
2347
|
return `${normalized.toFixed(0)}\xB0`;
|
|
2307
2348
|
};
|
|
2308
2349
|
const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
|
|
2309
|
-
const computedPositionClasses =
|
|
2350
|
+
const computedPositionClasses = React25__namespace.useMemo(() => {
|
|
2310
2351
|
return mapsCore.computePositionClasses(position, hasControlsAtPosition);
|
|
2311
2352
|
}, [position, hasControlsAtPosition]);
|
|
2312
|
-
|
|
2353
|
+
React25__namespace.useEffect(() => {
|
|
2313
2354
|
if (!map || !loaded) return;
|
|
2314
2355
|
setCurrentZoom(map.getZoom());
|
|
2315
2356
|
setCurrentBearing(map.getBearing());
|
|
@@ -2362,6 +2403,766 @@ var CoordinateDisplay = ({
|
|
|
2362
2403
|
);
|
|
2363
2404
|
};
|
|
2364
2405
|
CoordinateDisplay.displayName = "CoordinateDisplay";
|
|
2406
|
+
var switcherIdCounter = 0;
|
|
2407
|
+
var BasemapSwitcher = ({
|
|
2408
|
+
basemaps,
|
|
2409
|
+
extraBasemaps,
|
|
2410
|
+
apiKeys,
|
|
2411
|
+
defaultBasemapId,
|
|
2412
|
+
activeBasemapId,
|
|
2413
|
+
onBasemapChange,
|
|
2414
|
+
columns = 3,
|
|
2415
|
+
thumbnailSize = 64,
|
|
2416
|
+
position = "bottom-right",
|
|
2417
|
+
class: className
|
|
2418
|
+
}) => {
|
|
2419
|
+
const { controlOffsets, registerControl, unregisterControl, setMapStyle } = useMap();
|
|
2420
|
+
const [isOpen, setIsOpen] = React25__namespace.useState(false);
|
|
2421
|
+
const [internalActiveId, setInternalActiveId] = React25__namespace.useState(
|
|
2422
|
+
defaultBasemapId
|
|
2423
|
+
);
|
|
2424
|
+
const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
|
|
2425
|
+
const containerRef = React25__namespace.useRef(null);
|
|
2426
|
+
const panelRef = React25__namespace.useRef(null);
|
|
2427
|
+
const switcherIdRef = React25__namespace.useRef(`basemap-switcher-${++switcherIdCounter}`);
|
|
2428
|
+
const sourceBasemaps = basemaps ?? mapsCore.FREE_BASEMAPS;
|
|
2429
|
+
const availableBasemaps = React25__namespace.useMemo(() => {
|
|
2430
|
+
const available = mapsCore.getAvailableBasemaps(sourceBasemaps, apiKeys);
|
|
2431
|
+
if (extraBasemaps?.length) {
|
|
2432
|
+
return [...available, ...mapsCore.getAvailableBasemaps(extraBasemaps, apiKeys)];
|
|
2433
|
+
}
|
|
2434
|
+
return available;
|
|
2435
|
+
}, [sourceBasemaps, extraBasemaps, apiKeys]);
|
|
2436
|
+
const currentActiveId = activeBasemapId ?? internalActiveId ?? availableBasemaps[0]?.id;
|
|
2437
|
+
React25__namespace.useEffect(() => {
|
|
2438
|
+
if (!containerRef.current || !registerControl) return;
|
|
2439
|
+
const updatePosition = () => {
|
|
2440
|
+
if (!containerRef.current) return;
|
|
2441
|
+
const height = containerRef.current.offsetHeight;
|
|
2442
|
+
const offset = registerControl(switcherIdRef.current, position, height);
|
|
2443
|
+
setCustomControlOffset(offset);
|
|
2444
|
+
};
|
|
2445
|
+
updatePosition();
|
|
2446
|
+
const observer = new ResizeObserver(updatePosition);
|
|
2447
|
+
observer.observe(containerRef.current);
|
|
2448
|
+
return () => {
|
|
2449
|
+
observer.disconnect();
|
|
2450
|
+
unregisterControl?.(switcherIdRef.current, position);
|
|
2451
|
+
};
|
|
2452
|
+
}, [position, registerControl, unregisterControl]);
|
|
2453
|
+
React25__namespace.useEffect(() => {
|
|
2454
|
+
if (!isOpen) return;
|
|
2455
|
+
const handleMouseDown = (e) => {
|
|
2456
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
2457
|
+
setIsOpen(false);
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
2461
|
+
return () => document.removeEventListener("mousedown", handleMouseDown);
|
|
2462
|
+
}, [isOpen]);
|
|
2463
|
+
React25__namespace.useEffect(() => {
|
|
2464
|
+
if (!isOpen) return;
|
|
2465
|
+
const handleKeyDown = (e) => {
|
|
2466
|
+
if (e.key === "Escape") {
|
|
2467
|
+
setIsOpen(false);
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2470
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2471
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2472
|
+
}, [isOpen]);
|
|
2473
|
+
const handleSelect = (basemap) => {
|
|
2474
|
+
const style = mapsCore.resolveBasemapStyle(basemap, apiKeys);
|
|
2475
|
+
if (!style) return;
|
|
2476
|
+
if (!activeBasemapId) {
|
|
2477
|
+
setInternalActiveId(basemap.id);
|
|
2478
|
+
}
|
|
2479
|
+
setMapStyle?.(style);
|
|
2480
|
+
onBasemapChange?.(basemap);
|
|
2481
|
+
setIsOpen(false);
|
|
2482
|
+
};
|
|
2483
|
+
const verticalOffsetStyle = React25__namespace.useMemo(() => {
|
|
2484
|
+
return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
|
|
2485
|
+
}, [customControlOffset, position]);
|
|
2486
|
+
const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
|
|
2487
|
+
const computedPositionClasses = React25__namespace.useMemo(() => {
|
|
2488
|
+
return mapsCore.computePositionClasses(position, hasControlsAtPosition);
|
|
2489
|
+
}, [position, hasControlsAtPosition]);
|
|
2490
|
+
const isTop = position.startsWith("top");
|
|
2491
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2492
|
+
"div",
|
|
2493
|
+
{
|
|
2494
|
+
ref: containerRef,
|
|
2495
|
+
className: cn("absolute z-10", computedPositionClasses, className),
|
|
2496
|
+
style: verticalOffsetStyle,
|
|
2497
|
+
children: [
|
|
2498
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2499
|
+
"div",
|
|
2500
|
+
{
|
|
2501
|
+
ref: panelRef,
|
|
2502
|
+
className: cn(
|
|
2503
|
+
"absolute classic-basemap-panel-enter",
|
|
2504
|
+
"bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
|
|
2505
|
+
"p-2",
|
|
2506
|
+
isTop ? "top-full mt-1" : "bottom-full mb-1",
|
|
2507
|
+
position.includes("right") ? "right-0" : "left-0"
|
|
2508
|
+
),
|
|
2509
|
+
style: {
|
|
2510
|
+
width: columns * (thumbnailSize + 12) + 16
|
|
2511
|
+
},
|
|
2512
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2513
|
+
"div",
|
|
2514
|
+
{
|
|
2515
|
+
role: "listbox",
|
|
2516
|
+
"aria-label": "Select basemap",
|
|
2517
|
+
className: "grid gap-1.5",
|
|
2518
|
+
style: {
|
|
2519
|
+
gridTemplateColumns: `repeat(${columns}, 1fr)`
|
|
2520
|
+
},
|
|
2521
|
+
children: availableBasemaps.map((basemap) => {
|
|
2522
|
+
const isActive = basemap.id === currentActiveId;
|
|
2523
|
+
const thumbUrl = mapsCore.resolveBasemapThumbnail(basemap, apiKeys);
|
|
2524
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2525
|
+
"button",
|
|
2526
|
+
{
|
|
2527
|
+
type: "button",
|
|
2528
|
+
role: "option",
|
|
2529
|
+
"aria-selected": isActive,
|
|
2530
|
+
className: cn(
|
|
2531
|
+
"flex flex-col items-center gap-1 p-1 rounded cursor-pointer",
|
|
2532
|
+
"hover:bg-muted transition-colors",
|
|
2533
|
+
isActive && "ring-2 ring-primary"
|
|
2534
|
+
),
|
|
2535
|
+
onClick: () => handleSelect(basemap),
|
|
2536
|
+
title: basemap.name,
|
|
2537
|
+
children: [
|
|
2538
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2539
|
+
"img",
|
|
2540
|
+
{
|
|
2541
|
+
src: thumbUrl,
|
|
2542
|
+
alt: basemap.name,
|
|
2543
|
+
loading: "lazy",
|
|
2544
|
+
className: "rounded object-cover",
|
|
2545
|
+
style: {
|
|
2546
|
+
width: thumbnailSize,
|
|
2547
|
+
height: thumbnailSize
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
),
|
|
2551
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-foreground truncate w-full text-center leading-tight", children: basemap.label ?? basemap.name })
|
|
2552
|
+
]
|
|
2553
|
+
},
|
|
2554
|
+
basemap.id
|
|
2555
|
+
);
|
|
2556
|
+
})
|
|
2557
|
+
}
|
|
2558
|
+
)
|
|
2559
|
+
}
|
|
2560
|
+
),
|
|
2561
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2562
|
+
"button",
|
|
2563
|
+
{
|
|
2564
|
+
type: "button",
|
|
2565
|
+
className: cn(
|
|
2566
|
+
"w-[40px] h-[40px] flex items-center justify-center",
|
|
2567
|
+
"bg-card rounded shadow-lg border border-black dark:border-gray-400",
|
|
2568
|
+
"hover:bg-muted transition-colors cursor-pointer",
|
|
2569
|
+
"text-foreground"
|
|
2570
|
+
),
|
|
2571
|
+
onClick: () => setIsOpen(!isOpen),
|
|
2572
|
+
"aria-label": "Switch basemap",
|
|
2573
|
+
"aria-expanded": isOpen,
|
|
2574
|
+
"aria-haspopup": "true",
|
|
2575
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2576
|
+
"svg",
|
|
2577
|
+
{
|
|
2578
|
+
width: "20",
|
|
2579
|
+
height: "20",
|
|
2580
|
+
viewBox: "0 0 24 24",
|
|
2581
|
+
fill: "none",
|
|
2582
|
+
stroke: "currentColor",
|
|
2583
|
+
strokeWidth: "2",
|
|
2584
|
+
strokeLinecap: "round",
|
|
2585
|
+
strokeLinejoin: "round",
|
|
2586
|
+
children: [
|
|
2587
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2L2 7l10 5 10-5-10-5z" }),
|
|
2588
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 17l10 5 10-5" }),
|
|
2589
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 12l10 5 10-5" })
|
|
2590
|
+
]
|
|
2591
|
+
}
|
|
2592
|
+
)
|
|
2593
|
+
}
|
|
2594
|
+
)
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
};
|
|
2599
|
+
BasemapSwitcher.displayName = "BasemapSwitcher";
|
|
2600
|
+
var managerIdCounter = 0;
|
|
2601
|
+
var LayerManager = ({
|
|
2602
|
+
layers,
|
|
2603
|
+
apiKeys,
|
|
2604
|
+
initialActiveLayers,
|
|
2605
|
+
position = "top-right",
|
|
2606
|
+
showSearch = false,
|
|
2607
|
+
showCategories = false,
|
|
2608
|
+
allowReorder = false,
|
|
2609
|
+
showOpacity = false,
|
|
2610
|
+
collapsible = true,
|
|
2611
|
+
onLayerChange,
|
|
2612
|
+
class: className
|
|
2613
|
+
}) => {
|
|
2614
|
+
const { controlOffsets, registerControl, unregisterControl } = useMap();
|
|
2615
|
+
const { isDark } = useMapTheme();
|
|
2616
|
+
const [isOpen, setIsOpen] = React25__namespace.useState(false);
|
|
2617
|
+
const [layerStates, setLayerStates] = React25__namespace.useState(
|
|
2618
|
+
() => mapsCore.createInitialLayerStates(layers, initialActiveLayers)
|
|
2619
|
+
);
|
|
2620
|
+
const [searchQuery, setSearchQuery] = React25__namespace.useState("");
|
|
2621
|
+
const [activeCategory, setActiveCategory] = React25__namespace.useState("all");
|
|
2622
|
+
const [customControlOffset, setCustomControlOffset] = React25__namespace.useState(0);
|
|
2623
|
+
const [expandedOpacity, setExpandedOpacity] = React25__namespace.useState(null);
|
|
2624
|
+
const [draggedId, setDraggedId] = React25__namespace.useState(null);
|
|
2625
|
+
const [dragOver, setDragOver] = React25__namespace.useState(null);
|
|
2626
|
+
const containerRef = React25__namespace.useRef(null);
|
|
2627
|
+
const managerIdRef = React25__namespace.useRef(`layer-manager-${++managerIdCounter}`);
|
|
2628
|
+
const lastLayerIdsRef = React25__namespace.useRef(new Set(layers.map((l) => l.id)));
|
|
2629
|
+
React25__namespace.useEffect(() => {
|
|
2630
|
+
const currentLayerIds = new Set(layers.map((l) => l.id));
|
|
2631
|
+
const hasNewLayers = layers.some((l) => !lastLayerIdsRef.current.has(l.id));
|
|
2632
|
+
const hasRemovedLayers = Array.from(lastLayerIdsRef.current).some(
|
|
2633
|
+
(id) => !currentLayerIds.has(id)
|
|
2634
|
+
);
|
|
2635
|
+
if (hasNewLayers || hasRemovedLayers) {
|
|
2636
|
+
setLayerStates((prev) => {
|
|
2637
|
+
const newStates = new Map(prev);
|
|
2638
|
+
for (const layer of layers) {
|
|
2639
|
+
if (!newStates.has(layer.id)) {
|
|
2640
|
+
newStates.set(layer.id, {
|
|
2641
|
+
id: layer.id,
|
|
2642
|
+
visible: initialActiveLayers?.includes(layer.id) ?? false,
|
|
2643
|
+
opacity: 1,
|
|
2644
|
+
loading: false,
|
|
2645
|
+
error: null,
|
|
2646
|
+
order: newStates.size
|
|
2647
|
+
});
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
for (const id of lastLayerIdsRef.current) {
|
|
2651
|
+
if (!currentLayerIds.has(id)) {
|
|
2652
|
+
newStates.delete(id);
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
return newStates;
|
|
2656
|
+
});
|
|
2657
|
+
lastLayerIdsRef.current = currentLayerIds;
|
|
2658
|
+
}
|
|
2659
|
+
}, [layers, initialActiveLayers]);
|
|
2660
|
+
const categories = React25__namespace.useMemo(() => mapsCore.getLayerCategories(layers), [layers]);
|
|
2661
|
+
const filteredLayers = React25__namespace.useMemo(() => {
|
|
2662
|
+
let result = layers;
|
|
2663
|
+
if (searchQuery) {
|
|
2664
|
+
result = mapsCore.searchLayers(result, searchQuery);
|
|
2665
|
+
}
|
|
2666
|
+
if (activeCategory !== "all") {
|
|
2667
|
+
result = result.filter((l) => l.category === activeCategory);
|
|
2668
|
+
}
|
|
2669
|
+
return [...result].sort((a, b) => {
|
|
2670
|
+
const orderA = layerStates.get(a.id)?.order ?? 0;
|
|
2671
|
+
const orderB = layerStates.get(b.id)?.order ?? 0;
|
|
2672
|
+
return orderA - orderB;
|
|
2673
|
+
});
|
|
2674
|
+
}, [layers, searchQuery, activeCategory, layerStates]);
|
|
2675
|
+
const layerGroups = React25__namespace.useMemo(
|
|
2676
|
+
() => showCategories ? mapsCore.groupLayersByCategory(filteredLayers) : null,
|
|
2677
|
+
[filteredLayers, showCategories]
|
|
2678
|
+
);
|
|
2679
|
+
React25__namespace.useEffect(() => {
|
|
2680
|
+
if (!containerRef.current || !registerControl) return;
|
|
2681
|
+
const updatePosition = () => {
|
|
2682
|
+
if (!containerRef.current) return;
|
|
2683
|
+
const height = containerRef.current.offsetHeight;
|
|
2684
|
+
const offset = registerControl(managerIdRef.current, position, height);
|
|
2685
|
+
setCustomControlOffset(offset);
|
|
2686
|
+
};
|
|
2687
|
+
updatePosition();
|
|
2688
|
+
const observer = new ResizeObserver(updatePosition);
|
|
2689
|
+
observer.observe(containerRef.current);
|
|
2690
|
+
return () => {
|
|
2691
|
+
observer.disconnect();
|
|
2692
|
+
unregisterControl?.(managerIdRef.current, position);
|
|
2693
|
+
};
|
|
2694
|
+
}, [position, registerControl, unregisterControl]);
|
|
2695
|
+
React25__namespace.useEffect(() => {
|
|
2696
|
+
if (!isOpen) return;
|
|
2697
|
+
const handleMouseDown = (e) => {
|
|
2698
|
+
if (containerRef.current && !containerRef.current.contains(e.target)) {
|
|
2699
|
+
setIsOpen(false);
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
2702
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
2703
|
+
return () => document.removeEventListener("mousedown", handleMouseDown);
|
|
2704
|
+
}, [isOpen]);
|
|
2705
|
+
React25__namespace.useEffect(() => {
|
|
2706
|
+
if (!isOpen) return;
|
|
2707
|
+
const handleKeyDown = (e) => {
|
|
2708
|
+
if (e.key === "Escape") {
|
|
2709
|
+
setIsOpen(false);
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
2713
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
2714
|
+
}, [isOpen]);
|
|
2715
|
+
const handleToggleLayer = React25__namespace.useCallback(
|
|
2716
|
+
(layerId) => {
|
|
2717
|
+
setLayerStates((prev) => {
|
|
2718
|
+
const newStates = mapsCore.toggleLayerVisibility(prev, layerId);
|
|
2719
|
+
const state = newStates.get(layerId);
|
|
2720
|
+
if (state && onLayerChange) {
|
|
2721
|
+
onLayerChange(layerId, state);
|
|
2722
|
+
}
|
|
2723
|
+
return newStates;
|
|
2724
|
+
});
|
|
2725
|
+
},
|
|
2726
|
+
[onLayerChange]
|
|
2727
|
+
);
|
|
2728
|
+
const handleOpacityChange = React25__namespace.useCallback(
|
|
2729
|
+
(layerId, opacity) => {
|
|
2730
|
+
setLayerStates((prev) => {
|
|
2731
|
+
const newStates = mapsCore.setLayerOpacity(prev, layerId, opacity);
|
|
2732
|
+
const state = newStates.get(layerId);
|
|
2733
|
+
if (state && onLayerChange) {
|
|
2734
|
+
onLayerChange(layerId, state);
|
|
2735
|
+
}
|
|
2736
|
+
return newStates;
|
|
2737
|
+
});
|
|
2738
|
+
},
|
|
2739
|
+
[onLayerChange]
|
|
2740
|
+
);
|
|
2741
|
+
const handleDragStart = React25__namespace.useCallback((e, layerId) => {
|
|
2742
|
+
setDraggedId(layerId);
|
|
2743
|
+
e.dataTransfer.effectAllowed = "move";
|
|
2744
|
+
e.dataTransfer.setData("text/plain", layerId);
|
|
2745
|
+
}, []);
|
|
2746
|
+
const handleDragOver = React25__namespace.useCallback(
|
|
2747
|
+
(e, layerId) => {
|
|
2748
|
+
e.preventDefault();
|
|
2749
|
+
e.dataTransfer.dropEffect = "move";
|
|
2750
|
+
if (layerId !== draggedId) {
|
|
2751
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
2752
|
+
const relativeY = (e.clientY - rect.top) / rect.height;
|
|
2753
|
+
let position2;
|
|
2754
|
+
if (relativeY < 0.3) {
|
|
2755
|
+
position2 = "above";
|
|
2756
|
+
} else if (relativeY > 0.7) {
|
|
2757
|
+
position2 = "below";
|
|
2758
|
+
} else {
|
|
2759
|
+
position2 = dragOver?.id === layerId ? dragOver.position : "below";
|
|
2760
|
+
}
|
|
2761
|
+
setDragOver({ id: layerId, position: position2 });
|
|
2762
|
+
}
|
|
2763
|
+
},
|
|
2764
|
+
[draggedId, dragOver]
|
|
2765
|
+
);
|
|
2766
|
+
const handleDragLeave = React25__namespace.useCallback(() => {
|
|
2767
|
+
setDragOver(null);
|
|
2768
|
+
}, []);
|
|
2769
|
+
const handleDragEnd = React25__namespace.useCallback(() => {
|
|
2770
|
+
setDraggedId(null);
|
|
2771
|
+
setDragOver(null);
|
|
2772
|
+
}, []);
|
|
2773
|
+
const handleDrop = React25__namespace.useCallback(
|
|
2774
|
+
(e, targetLayerId) => {
|
|
2775
|
+
e.preventDefault();
|
|
2776
|
+
const sourceLayerId = e.dataTransfer.getData("text/plain");
|
|
2777
|
+
if (sourceLayerId && sourceLayerId !== targetLayerId) {
|
|
2778
|
+
const sortedStates = mapsCore.getLayerStatesArray(layerStates);
|
|
2779
|
+
const sourceIndex = sortedStates.findIndex((s) => s.id === sourceLayerId);
|
|
2780
|
+
let targetIndex = sortedStates.findIndex((s) => s.id === targetLayerId);
|
|
2781
|
+
if (targetIndex !== -1) {
|
|
2782
|
+
if (dragOver?.position === "below") {
|
|
2783
|
+
targetIndex += 1;
|
|
2784
|
+
}
|
|
2785
|
+
if (sourceIndex < targetIndex) {
|
|
2786
|
+
targetIndex -= 1;
|
|
2787
|
+
}
|
|
2788
|
+
setLayerStates((prev) => {
|
|
2789
|
+
const newStates = mapsCore.reorderLayers(prev, sourceLayerId, targetIndex);
|
|
2790
|
+
const state = newStates.get(sourceLayerId);
|
|
2791
|
+
if (state && onLayerChange) {
|
|
2792
|
+
onLayerChange(sourceLayerId, state);
|
|
2793
|
+
}
|
|
2794
|
+
return newStates;
|
|
2795
|
+
});
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
setDraggedId(null);
|
|
2799
|
+
setDragOver(null);
|
|
2800
|
+
},
|
|
2801
|
+
[layerStates, onLayerChange, dragOver]
|
|
2802
|
+
);
|
|
2803
|
+
const verticalOffsetStyle = React25__namespace.useMemo(() => {
|
|
2804
|
+
return mapsCore.computeVerticalOffsetStyle(position, customControlOffset);
|
|
2805
|
+
}, [customControlOffset, position]);
|
|
2806
|
+
const hasControlsAtPosition = (controlOffsets?.[position] ?? 0) > 0;
|
|
2807
|
+
const computedPositionClasses = React25__namespace.useMemo(() => {
|
|
2808
|
+
return mapsCore.computePositionClasses(position, hasControlsAtPosition);
|
|
2809
|
+
}, [position, hasControlsAtPosition]);
|
|
2810
|
+
const isTop = position.startsWith("top");
|
|
2811
|
+
const renderLayer = (layer, state) => {
|
|
2812
|
+
if (!state.visible) return null;
|
|
2813
|
+
const theme = isDark ? "dark" : "light";
|
|
2814
|
+
const paint = mapsCore.getLayerStyleForTheme(layer, theme);
|
|
2815
|
+
const sourceUrl = mapsCore.resolveLayerSourceUrl(layer, apiKeys);
|
|
2816
|
+
const sourceId = `lm-source-${layer.id}`;
|
|
2817
|
+
const sourceData = layer.source.type === "geojson-inline" ? layer.source.data : layer.source.type === "geojson-url" && sourceUrl ? sourceUrl : void 0;
|
|
2818
|
+
if (!sourceData && layer.source.type !== "vector-tiles") {
|
|
2819
|
+
return null;
|
|
2820
|
+
}
|
|
2821
|
+
const layerProps = {
|
|
2822
|
+
id: `lm-layer-${layer.id}`,
|
|
2823
|
+
source: sourceId,
|
|
2824
|
+
sourceLayer: layer.source.sourceLayer,
|
|
2825
|
+
visible: state.visible,
|
|
2826
|
+
opacity: state.opacity,
|
|
2827
|
+
minZoom: layer.style.minZoom,
|
|
2828
|
+
maxZoom: layer.style.maxZoom
|
|
2829
|
+
};
|
|
2830
|
+
let layerComponent = null;
|
|
2831
|
+
const baseOpacity = {
|
|
2832
|
+
fill: paint["fill-opacity"] ?? 1,
|
|
2833
|
+
line: paint["line-opacity"] ?? 1,
|
|
2834
|
+
circle: paint["circle-opacity"] ?? 1,
|
|
2835
|
+
icon: paint["icon-opacity"] ?? 1
|
|
2836
|
+
};
|
|
2837
|
+
switch (layer.style.renderType) {
|
|
2838
|
+
case "fill":
|
|
2839
|
+
layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2840
|
+
FillLayer,
|
|
2841
|
+
{
|
|
2842
|
+
...layerProps,
|
|
2843
|
+
fillColor: paint["fill-color"],
|
|
2844
|
+
fillOpacity: baseOpacity.fill * state.opacity,
|
|
2845
|
+
fillOutlineColor: paint["fill-outline-color"]
|
|
2846
|
+
}
|
|
2847
|
+
);
|
|
2848
|
+
break;
|
|
2849
|
+
case "line":
|
|
2850
|
+
layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2851
|
+
LineLayer,
|
|
2852
|
+
{
|
|
2853
|
+
...layerProps,
|
|
2854
|
+
lineColor: paint["line-color"],
|
|
2855
|
+
lineWidth: paint["line-width"],
|
|
2856
|
+
lineOpacity: baseOpacity.line * state.opacity,
|
|
2857
|
+
lineDasharray: paint["line-dasharray"]
|
|
2858
|
+
}
|
|
2859
|
+
);
|
|
2860
|
+
break;
|
|
2861
|
+
case "circle":
|
|
2862
|
+
layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2863
|
+
CircleLayer,
|
|
2864
|
+
{
|
|
2865
|
+
...layerProps,
|
|
2866
|
+
circleColor: paint["circle-color"],
|
|
2867
|
+
circleRadius: paint["circle-radius"],
|
|
2868
|
+
circleOpacity: baseOpacity.circle * state.opacity,
|
|
2869
|
+
circleStrokeWidth: paint["circle-stroke-width"],
|
|
2870
|
+
circleStrokeColor: paint["circle-stroke-color"]
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2873
|
+
break;
|
|
2874
|
+
case "symbol":
|
|
2875
|
+
layerComponent = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2876
|
+
SymbolLayer,
|
|
2877
|
+
{
|
|
2878
|
+
...layerProps,
|
|
2879
|
+
iconImage: paint["icon-image"],
|
|
2880
|
+
iconSize: paint["icon-size"],
|
|
2881
|
+
iconOpacity: baseOpacity.icon * state.opacity,
|
|
2882
|
+
textField: paint["text-field"],
|
|
2883
|
+
textSize: paint["text-size"],
|
|
2884
|
+
textColor: paint["text-color"]
|
|
2885
|
+
}
|
|
2886
|
+
);
|
|
2887
|
+
break;
|
|
2888
|
+
}
|
|
2889
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2890
|
+
Source,
|
|
2891
|
+
{
|
|
2892
|
+
id: sourceId,
|
|
2893
|
+
type: layer.source.type === "vector-tiles" ? "vector" : "geojson",
|
|
2894
|
+
data: layer.source.type !== "vector-tiles" ? sourceData : void 0,
|
|
2895
|
+
url: layer.source.type === "vector-tiles" ? sourceUrl ?? void 0 : void 0,
|
|
2896
|
+
tiles: layer.source.type === "vector-tiles" ? [sourceUrl ?? ""] : void 0,
|
|
2897
|
+
attribution: layer.source.attribution,
|
|
2898
|
+
children: layerComponent
|
|
2899
|
+
},
|
|
2900
|
+
layer.id
|
|
2901
|
+
);
|
|
2902
|
+
};
|
|
2903
|
+
const renderLayerItem = (layer) => {
|
|
2904
|
+
const state = layerStates.get(layer.id);
|
|
2905
|
+
if (!state) return null;
|
|
2906
|
+
const isDragging = draggedId === layer.id;
|
|
2907
|
+
const isDragOver = dragOver?.id === layer.id;
|
|
2908
|
+
const dragOverPosition = isDragOver ? dragOver.position : void 0;
|
|
2909
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2910
|
+
"div",
|
|
2911
|
+
{
|
|
2912
|
+
className: "classic-layer-item",
|
|
2913
|
+
draggable: allowReorder,
|
|
2914
|
+
onDragStart: allowReorder ? (e) => handleDragStart(e, layer.id) : void 0,
|
|
2915
|
+
onDragOver: allowReorder ? (e) => handleDragOver(e, layer.id) : void 0,
|
|
2916
|
+
onDragLeave: allowReorder ? handleDragLeave : void 0,
|
|
2917
|
+
onDragEnd: allowReorder ? handleDragEnd : void 0,
|
|
2918
|
+
onDrop: allowReorder ? (e) => handleDrop(e, layer.id) : void 0,
|
|
2919
|
+
"data-dragging": isDragging || void 0,
|
|
2920
|
+
"data-drag-over": dragOverPosition,
|
|
2921
|
+
children: [
|
|
2922
|
+
allowReorder && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "classic-layer-drag-handle text-muted-foreground", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2923
|
+
"svg",
|
|
2924
|
+
{
|
|
2925
|
+
width: "12",
|
|
2926
|
+
height: "12",
|
|
2927
|
+
viewBox: "0 0 24 24",
|
|
2928
|
+
fill: "none",
|
|
2929
|
+
stroke: "currentColor",
|
|
2930
|
+
strokeWidth: "2",
|
|
2931
|
+
children: [
|
|
2932
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "6", r: "1", fill: "currentColor" }),
|
|
2933
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "6", r: "1", fill: "currentColor" }),
|
|
2934
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "12", r: "1", fill: "currentColor" }),
|
|
2935
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "12", r: "1", fill: "currentColor" }),
|
|
2936
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "18", r: "1", fill: "currentColor" }),
|
|
2937
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "15", cy: "18", r: "1", fill: "currentColor" })
|
|
2938
|
+
]
|
|
2939
|
+
}
|
|
2940
|
+
) }),
|
|
2941
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2942
|
+
themeReact.Switch,
|
|
2943
|
+
{
|
|
2944
|
+
size: "sm",
|
|
2945
|
+
checked: state.visible,
|
|
2946
|
+
onCheckedChange: () => handleToggleLayer(layer.id),
|
|
2947
|
+
"aria-label": `Toggle ${layer.name}`
|
|
2948
|
+
}
|
|
2949
|
+
),
|
|
2950
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
2951
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2952
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-foreground truncate", children: layer.name }),
|
|
2953
|
+
state.loading && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2954
|
+
"svg",
|
|
2955
|
+
{
|
|
2956
|
+
className: "classic-layer-loading w-3 h-3 text-muted-foreground",
|
|
2957
|
+
viewBox: "0 0 24 24",
|
|
2958
|
+
fill: "none",
|
|
2959
|
+
stroke: "currentColor",
|
|
2960
|
+
strokeWidth: "2",
|
|
2961
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48l2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48l2.83-2.83" })
|
|
2962
|
+
}
|
|
2963
|
+
)
|
|
2964
|
+
] }),
|
|
2965
|
+
state.error && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "classic-layer-error", children: state.error })
|
|
2966
|
+
] }),
|
|
2967
|
+
showOpacity && state.visible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2968
|
+
"button",
|
|
2969
|
+
{
|
|
2970
|
+
type: "button",
|
|
2971
|
+
className: "text-muted-foreground hover:text-foreground p-1",
|
|
2972
|
+
onClick: () => setExpandedOpacity(expandedOpacity === layer.id ? null : layer.id),
|
|
2973
|
+
"aria-label": "Adjust opacity",
|
|
2974
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2975
|
+
"svg",
|
|
2976
|
+
{
|
|
2977
|
+
width: "14",
|
|
2978
|
+
height: "14",
|
|
2979
|
+
viewBox: "0 0 24 24",
|
|
2980
|
+
fill: "none",
|
|
2981
|
+
stroke: "currentColor",
|
|
2982
|
+
strokeWidth: "2",
|
|
2983
|
+
children: [
|
|
2984
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2985
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2a10 10 0 0 1 0 20", fill: "currentColor", opacity: "0.3" })
|
|
2986
|
+
]
|
|
2987
|
+
}
|
|
2988
|
+
)
|
|
2989
|
+
}
|
|
2990
|
+
)
|
|
2991
|
+
]
|
|
2992
|
+
},
|
|
2993
|
+
layer.id
|
|
2994
|
+
);
|
|
2995
|
+
};
|
|
2996
|
+
const renderOpacitySlider = (layerId) => {
|
|
2997
|
+
if (expandedOpacity !== layerId) return null;
|
|
2998
|
+
const state = layerStates.get(layerId);
|
|
2999
|
+
if (!state) return null;
|
|
3000
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
3001
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground w-12", children: "Opacity" }),
|
|
3002
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3003
|
+
"input",
|
|
3004
|
+
{
|
|
3005
|
+
type: "range",
|
|
3006
|
+
min: "0",
|
|
3007
|
+
max: "100",
|
|
3008
|
+
value: state.opacity * 100,
|
|
3009
|
+
onChange: (e) => handleOpacityChange(layerId, Number(e.target.value) / 100),
|
|
3010
|
+
className: "classic-layer-opacity-slider flex-1"
|
|
3011
|
+
}
|
|
3012
|
+
),
|
|
3013
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs text-muted-foreground w-8 text-right", children: [
|
|
3014
|
+
Math.round(state.opacity * 100),
|
|
3015
|
+
"%"
|
|
3016
|
+
] })
|
|
3017
|
+
] }) });
|
|
3018
|
+
};
|
|
3019
|
+
const visibleLayerStates = mapsCore.getLayerStatesArray(layerStates).filter((s) => s.visible);
|
|
3020
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3021
|
+
visibleLayerStates.map((state) => {
|
|
3022
|
+
const layer = layers.find((l) => l.id === state.id);
|
|
3023
|
+
return layer ? renderLayer(layer, state) : null;
|
|
3024
|
+
}),
|
|
3025
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3026
|
+
"div",
|
|
3027
|
+
{
|
|
3028
|
+
ref: containerRef,
|
|
3029
|
+
className: cn("absolute z-10", computedPositionClasses, className),
|
|
3030
|
+
style: verticalOffsetStyle,
|
|
3031
|
+
children: [
|
|
3032
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3033
|
+
"div",
|
|
3034
|
+
{
|
|
3035
|
+
className: cn(
|
|
3036
|
+
"absolute classic-layer-panel-enter",
|
|
3037
|
+
"bg-card rounded-lg shadow-lg border border-black dark:border-gray-400",
|
|
3038
|
+
"w-64",
|
|
3039
|
+
isTop ? "top-full mt-1" : "bottom-full mb-1",
|
|
3040
|
+
position.includes("right") ? "right-0" : "left-0"
|
|
3041
|
+
),
|
|
3042
|
+
children: [
|
|
3043
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between p-3 border-b border-border", children: [
|
|
3044
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-foreground", children: "Layers" }),
|
|
3045
|
+
collapsible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
3046
|
+
"button",
|
|
3047
|
+
{
|
|
3048
|
+
type: "button",
|
|
3049
|
+
className: "text-muted-foreground hover:text-foreground",
|
|
3050
|
+
onClick: () => setIsOpen(false),
|
|
3051
|
+
"aria-label": "Close layer manager",
|
|
3052
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3053
|
+
"svg",
|
|
3054
|
+
{
|
|
3055
|
+
width: "16",
|
|
3056
|
+
height: "16",
|
|
3057
|
+
viewBox: "0 0 24 24",
|
|
3058
|
+
fill: "none",
|
|
3059
|
+
stroke: "currentColor",
|
|
3060
|
+
strokeWidth: "2",
|
|
3061
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 6L6 18M6 6l12 12" })
|
|
3062
|
+
}
|
|
3063
|
+
)
|
|
3064
|
+
}
|
|
3065
|
+
)
|
|
3066
|
+
] }),
|
|
3067
|
+
showSearch && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3068
|
+
"input",
|
|
3069
|
+
{
|
|
3070
|
+
type: "text",
|
|
3071
|
+
placeholder: "Search layers...",
|
|
3072
|
+
value: searchQuery,
|
|
3073
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
3074
|
+
className: "classic-layer-search"
|
|
3075
|
+
}
|
|
3076
|
+
) }),
|
|
3077
|
+
showCategories && categories.length > 1 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2 border-b border-border", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "classic-layer-tabs", children: [
|
|
3078
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3079
|
+
"button",
|
|
3080
|
+
{
|
|
3081
|
+
type: "button",
|
|
3082
|
+
className: "classic-layer-tab",
|
|
3083
|
+
"data-active": activeCategory === "all",
|
|
3084
|
+
onClick: () => setActiveCategory("all"),
|
|
3085
|
+
children: "All"
|
|
3086
|
+
}
|
|
3087
|
+
),
|
|
3088
|
+
categories.map((cat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3089
|
+
"button",
|
|
3090
|
+
{
|
|
3091
|
+
type: "button",
|
|
3092
|
+
className: "classic-layer-tab",
|
|
3093
|
+
"data-active": activeCategory === cat,
|
|
3094
|
+
onClick: () => setActiveCategory(cat),
|
|
3095
|
+
children: mapsCore.CATEGORY_META[cat].label
|
|
3096
|
+
},
|
|
3097
|
+
cat
|
|
3098
|
+
))
|
|
3099
|
+
] }) }),
|
|
3100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-64 overflow-y-auto", children: [
|
|
3101
|
+
showCategories && layerGroups && activeCategory === "all" ? (
|
|
3102
|
+
// Grouped by category
|
|
3103
|
+
categories.map((cat) => {
|
|
3104
|
+
const catLayers = layerGroups[cat];
|
|
3105
|
+
if (catLayers.length === 0) return null;
|
|
3106
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
3107
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-xs font-medium text-muted-foreground uppercase tracking-wider", children: mapsCore.CATEGORY_META[cat].label }),
|
|
3108
|
+
catLayers.map((layer) => /* @__PURE__ */ jsxRuntime.jsxs(React25__namespace.Fragment, { children: [
|
|
3109
|
+
renderLayerItem(layer),
|
|
3110
|
+
renderOpacitySlider(layer.id)
|
|
3111
|
+
] }, layer.id))
|
|
3112
|
+
] }, cat);
|
|
3113
|
+
})
|
|
3114
|
+
) : (
|
|
3115
|
+
// Flat list
|
|
3116
|
+
filteredLayers.map((layer) => /* @__PURE__ */ jsxRuntime.jsxs(React25__namespace.Fragment, { children: [
|
|
3117
|
+
renderLayerItem(layer),
|
|
3118
|
+
renderOpacitySlider(layer.id)
|
|
3119
|
+
] }, layer.id))
|
|
3120
|
+
),
|
|
3121
|
+
filteredLayers.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "No layers found" })
|
|
3122
|
+
] })
|
|
3123
|
+
]
|
|
3124
|
+
}
|
|
3125
|
+
),
|
|
3126
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3127
|
+
"button",
|
|
3128
|
+
{
|
|
3129
|
+
type: "button",
|
|
3130
|
+
className: cn(
|
|
3131
|
+
"w-[40px] h-[40px] flex items-center justify-center",
|
|
3132
|
+
"bg-card rounded shadow-lg border border-black dark:border-gray-400",
|
|
3133
|
+
"hover:bg-muted transition-colors cursor-pointer",
|
|
3134
|
+
"text-foreground"
|
|
3135
|
+
),
|
|
3136
|
+
onClick: () => setIsOpen(!isOpen),
|
|
3137
|
+
"aria-label": "Toggle layer manager",
|
|
3138
|
+
"aria-expanded": isOpen,
|
|
3139
|
+
"aria-haspopup": "true",
|
|
3140
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3141
|
+
"svg",
|
|
3142
|
+
{
|
|
3143
|
+
width: "20",
|
|
3144
|
+
height: "20",
|
|
3145
|
+
viewBox: "0 0 24 24",
|
|
3146
|
+
fill: "none",
|
|
3147
|
+
stroke: "currentColor",
|
|
3148
|
+
strokeWidth: "2",
|
|
3149
|
+
strokeLinecap: "round",
|
|
3150
|
+
strokeLinejoin: "round",
|
|
3151
|
+
children: [
|
|
3152
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12.89 1.45l8 4A2 2 0 0 1 22 7.24v9.53a2 2 0 0 1-1.11 1.79l-8 4a2 2 0 0 1-1.78 0l-8-4a2 2 0 0 1-1.11-1.8V7.24a2 2 0 0 1 1.11-1.79l8-4a2 2 0 0 1 1.78 0z" }),
|
|
3153
|
+
/* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "2.32 6.16 12 11 21.68 6.16" }),
|
|
3154
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "22.76", x2: "12", y2: "11" })
|
|
3155
|
+
]
|
|
3156
|
+
}
|
|
3157
|
+
)
|
|
3158
|
+
}
|
|
3159
|
+
)
|
|
3160
|
+
]
|
|
3161
|
+
}
|
|
3162
|
+
)
|
|
3163
|
+
] });
|
|
3164
|
+
};
|
|
3165
|
+
LayerManager.displayName = "LayerManager";
|
|
2365
3166
|
var DeckOverlay = ({
|
|
2366
3167
|
layers = [],
|
|
2367
3168
|
onHover,
|
|
@@ -2372,9 +3173,9 @@ var DeckOverlay = ({
|
|
|
2372
3173
|
deckProps = {}
|
|
2373
3174
|
}) => {
|
|
2374
3175
|
const { map, loaded } = useMap();
|
|
2375
|
-
const overlayRef =
|
|
2376
|
-
const MapboxOverlayRef =
|
|
2377
|
-
|
|
3176
|
+
const overlayRef = React25__namespace.useRef(null);
|
|
3177
|
+
const MapboxOverlayRef = React25__namespace.useRef(null);
|
|
3178
|
+
React25__namespace.useEffect(() => {
|
|
2378
3179
|
if (!map || !loaded) return;
|
|
2379
3180
|
let cancelled = false;
|
|
2380
3181
|
const initOverlay = async () => {
|
|
@@ -2414,12 +3215,12 @@ var DeckOverlay = ({
|
|
|
2414
3215
|
}
|
|
2415
3216
|
};
|
|
2416
3217
|
}, [map, loaded, interleaved]);
|
|
2417
|
-
|
|
3218
|
+
React25__namespace.useEffect(() => {
|
|
2418
3219
|
if (overlayRef.current && "setProps" in overlayRef.current) {
|
|
2419
3220
|
overlayRef.current.setProps({ layers });
|
|
2420
3221
|
}
|
|
2421
3222
|
}, [layers]);
|
|
2422
|
-
|
|
3223
|
+
React25__namespace.useEffect(() => {
|
|
2423
3224
|
if (overlayRef.current && "setProps" in overlayRef.current) {
|
|
2424
3225
|
overlayRef.current.setProps({
|
|
2425
3226
|
onHover,
|
|
@@ -2427,7 +3228,7 @@ var DeckOverlay = ({
|
|
|
2427
3228
|
});
|
|
2428
3229
|
}
|
|
2429
3230
|
}, [onHover, onClick]);
|
|
2430
|
-
|
|
3231
|
+
React25__namespace.useEffect(() => {
|
|
2431
3232
|
if (overlayRef.current && effects && "setProps" in overlayRef.current) {
|
|
2432
3233
|
overlayRef.current.setProps({ effects });
|
|
2433
3234
|
}
|
|
@@ -2436,6 +3237,50 @@ var DeckOverlay = ({
|
|
|
2436
3237
|
};
|
|
2437
3238
|
DeckOverlay.displayName = "DeckOverlay";
|
|
2438
3239
|
|
|
3240
|
+
Object.defineProperty(exports, "BIKE_LANES", {
|
|
3241
|
+
enumerable: true,
|
|
3242
|
+
get: function () { return mapsCore.BIKE_LANES; }
|
|
3243
|
+
});
|
|
3244
|
+
Object.defineProperty(exports, "BUILTIN_BASEMAPS", {
|
|
3245
|
+
enumerable: true,
|
|
3246
|
+
get: function () { return mapsCore.BUILTIN_BASEMAPS; }
|
|
3247
|
+
});
|
|
3248
|
+
Object.defineProperty(exports, "BUILTIN_OVERLAY_LAYERS", {
|
|
3249
|
+
enumerable: true,
|
|
3250
|
+
get: function () { return mapsCore.BUILTIN_OVERLAY_LAYERS; }
|
|
3251
|
+
});
|
|
3252
|
+
Object.defineProperty(exports, "CATEGORY_META", {
|
|
3253
|
+
enumerable: true,
|
|
3254
|
+
get: function () { return mapsCore.CATEGORY_META; }
|
|
3255
|
+
});
|
|
3256
|
+
Object.defineProperty(exports, "CITY_LIMITS", {
|
|
3257
|
+
enumerable: true,
|
|
3258
|
+
get: function () { return mapsCore.CITY_LIMITS; }
|
|
3259
|
+
});
|
|
3260
|
+
Object.defineProperty(exports, "FLOOD_ZONES", {
|
|
3261
|
+
enumerable: true,
|
|
3262
|
+
get: function () { return mapsCore.FLOOD_ZONES; }
|
|
3263
|
+
});
|
|
3264
|
+
Object.defineProperty(exports, "FREE_BASEMAPS", {
|
|
3265
|
+
enumerable: true,
|
|
3266
|
+
get: function () { return mapsCore.FREE_BASEMAPS; }
|
|
3267
|
+
});
|
|
3268
|
+
Object.defineProperty(exports, "OSM_STANDARD", {
|
|
3269
|
+
enumerable: true,
|
|
3270
|
+
get: function () { return mapsCore.OSM_STANDARD; }
|
|
3271
|
+
});
|
|
3272
|
+
Object.defineProperty(exports, "PARKS", {
|
|
3273
|
+
enumerable: true,
|
|
3274
|
+
get: function () { return mapsCore.PARKS; }
|
|
3275
|
+
});
|
|
3276
|
+
Object.defineProperty(exports, "SCHOOL_DISTRICTS", {
|
|
3277
|
+
enumerable: true,
|
|
3278
|
+
get: function () { return mapsCore.SCHOOL_DISTRICTS; }
|
|
3279
|
+
});
|
|
3280
|
+
Object.defineProperty(exports, "SPORTS_FACILITIES", {
|
|
3281
|
+
enumerable: true,
|
|
3282
|
+
get: function () { return mapsCore.SPORTS_FACILITIES; }
|
|
3283
|
+
});
|
|
2439
3284
|
Object.defineProperty(exports, "THEME_DARK", {
|
|
2440
3285
|
enumerable: true,
|
|
2441
3286
|
get: function () { return mapsCore.THEME_DARK; }
|
|
@@ -2444,6 +3289,22 @@ Object.defineProperty(exports, "THEME_LIGHT", {
|
|
|
2444
3289
|
enumerable: true,
|
|
2445
3290
|
get: function () { return mapsCore.THEME_LIGHT; }
|
|
2446
3291
|
});
|
|
3292
|
+
Object.defineProperty(exports, "TRAILS", {
|
|
3293
|
+
enumerable: true,
|
|
3294
|
+
get: function () { return mapsCore.TRAILS; }
|
|
3295
|
+
});
|
|
3296
|
+
Object.defineProperty(exports, "TRANSIT_ROUTES", {
|
|
3297
|
+
enumerable: true,
|
|
3298
|
+
get: function () { return mapsCore.TRANSIT_ROUTES; }
|
|
3299
|
+
});
|
|
3300
|
+
Object.defineProperty(exports, "WATERSHEDS", {
|
|
3301
|
+
enumerable: true,
|
|
3302
|
+
get: function () { return mapsCore.WATERSHEDS; }
|
|
3303
|
+
});
|
|
3304
|
+
Object.defineProperty(exports, "ZONING_DISTRICTS", {
|
|
3305
|
+
enumerable: true,
|
|
3306
|
+
get: function () { return mapsCore.ZONING_DISTRICTS; }
|
|
3307
|
+
});
|
|
2447
3308
|
Object.defineProperty(exports, "calculateBounds", {
|
|
2448
3309
|
enumerable: true,
|
|
2449
3310
|
get: function () { return mapsCore.calculateBounds; }
|
|
@@ -2464,6 +3325,10 @@ Object.defineProperty(exports, "createHoverExpression", {
|
|
|
2464
3325
|
enumerable: true,
|
|
2465
3326
|
get: function () { return mapsCore.createHoverExpression; }
|
|
2466
3327
|
});
|
|
3328
|
+
Object.defineProperty(exports, "createInitialLayerStates", {
|
|
3329
|
+
enumerable: true,
|
|
3330
|
+
get: function () { return mapsCore.createInitialLayerStates; }
|
|
3331
|
+
});
|
|
2467
3332
|
Object.defineProperty(exports, "createSelectionExpression", {
|
|
2468
3333
|
enumerable: true,
|
|
2469
3334
|
get: function () { return mapsCore.createSelectionExpression; }
|
|
@@ -2508,6 +3373,10 @@ Object.defineProperty(exports, "generateMapDescription", {
|
|
|
2508
3373
|
enumerable: true,
|
|
2509
3374
|
get: function () { return mapsCore.generateMapDescription; }
|
|
2510
3375
|
});
|
|
3376
|
+
Object.defineProperty(exports, "getAvailableBasemaps", {
|
|
3377
|
+
enumerable: true,
|
|
3378
|
+
get: function () { return mapsCore.getAvailableBasemaps; }
|
|
3379
|
+
});
|
|
2511
3380
|
Object.defineProperty(exports, "getClusterBounds", {
|
|
2512
3381
|
enumerable: true,
|
|
2513
3382
|
get: function () { return mapsCore.getClusterBounds; }
|
|
@@ -2528,10 +3397,26 @@ Object.defineProperty(exports, "getHighlightStyle", {
|
|
|
2528
3397
|
enumerable: true,
|
|
2529
3398
|
get: function () { return mapsCore.getHighlightStyle; }
|
|
2530
3399
|
});
|
|
3400
|
+
Object.defineProperty(exports, "getLayerCategories", {
|
|
3401
|
+
enumerable: true,
|
|
3402
|
+
get: function () { return mapsCore.getLayerCategories; }
|
|
3403
|
+
});
|
|
3404
|
+
Object.defineProperty(exports, "getLayerStyleForTheme", {
|
|
3405
|
+
enumerable: true,
|
|
3406
|
+
get: function () { return mapsCore.getLayerStyleForTheme; }
|
|
3407
|
+
});
|
|
3408
|
+
Object.defineProperty(exports, "getLayersByCategory", {
|
|
3409
|
+
enumerable: true,
|
|
3410
|
+
get: function () { return mapsCore.getLayersByCategory; }
|
|
3411
|
+
});
|
|
2531
3412
|
Object.defineProperty(exports, "getSelectionStyle", {
|
|
2532
3413
|
enumerable: true,
|
|
2533
3414
|
get: function () { return mapsCore.getSelectionStyle; }
|
|
2534
3415
|
});
|
|
3416
|
+
Object.defineProperty(exports, "groupLayersByCategory", {
|
|
3417
|
+
enumerable: true,
|
|
3418
|
+
get: function () { return mapsCore.groupLayersByCategory; }
|
|
3419
|
+
});
|
|
2535
3420
|
Object.defineProperty(exports, "isClusterFeature", {
|
|
2536
3421
|
enumerable: true,
|
|
2537
3422
|
get: function () { return mapsCore.isClusterFeature; }
|
|
@@ -2552,20 +3437,42 @@ Object.defineProperty(exports, "loadGeoJSON", {
|
|
|
2552
3437
|
enumerable: true,
|
|
2553
3438
|
get: function () { return mapsCore.loadGeoJSON; }
|
|
2554
3439
|
});
|
|
3440
|
+
Object.defineProperty(exports, "resolveBasemapStyle", {
|
|
3441
|
+
enumerable: true,
|
|
3442
|
+
get: function () { return mapsCore.resolveBasemapStyle; }
|
|
3443
|
+
});
|
|
3444
|
+
Object.defineProperty(exports, "resolveLayerSourceUrl", {
|
|
3445
|
+
enumerable: true,
|
|
3446
|
+
get: function () { return mapsCore.resolveLayerSourceUrl; }
|
|
3447
|
+
});
|
|
3448
|
+
Object.defineProperty(exports, "searchLayers", {
|
|
3449
|
+
enumerable: true,
|
|
3450
|
+
get: function () { return mapsCore.searchLayers; }
|
|
3451
|
+
});
|
|
3452
|
+
Object.defineProperty(exports, "setLayerOpacity", {
|
|
3453
|
+
enumerable: true,
|
|
3454
|
+
get: function () { return mapsCore.setLayerOpacity; }
|
|
3455
|
+
});
|
|
3456
|
+
Object.defineProperty(exports, "toggleLayerVisibility", {
|
|
3457
|
+
enumerable: true,
|
|
3458
|
+
get: function () { return mapsCore.toggleLayerVisibility; }
|
|
3459
|
+
});
|
|
2555
3460
|
Object.defineProperty(exports, "validateGeoJSON", {
|
|
2556
3461
|
enumerable: true,
|
|
2557
3462
|
get: function () { return mapsCore.validateGeoJSON; }
|
|
2558
3463
|
});
|
|
3464
|
+
exports.BasemapSwitcher = BasemapSwitcher;
|
|
2559
3465
|
exports.CircleLayer = CircleLayer;
|
|
2560
3466
|
exports.CoordinateDisplay = CoordinateDisplay;
|
|
2561
3467
|
exports.DeckOverlay = DeckOverlay;
|
|
2562
3468
|
exports.FillExtrusionLayer = FillExtrusionLayer;
|
|
2563
3469
|
exports.FillLayer = FillLayer;
|
|
2564
3470
|
exports.HeatmapLayer = HeatmapLayer;
|
|
3471
|
+
exports.LayerManager = LayerManager;
|
|
2565
3472
|
exports.Legend = Legend;
|
|
2566
3473
|
exports.LegendGroup = LegendGroup;
|
|
2567
3474
|
exports.LineLayer = LineLayer;
|
|
2568
|
-
exports.Map =
|
|
3475
|
+
exports.Map = Map2;
|
|
2569
3476
|
exports.MapContainer = MapContainer;
|
|
2570
3477
|
exports.MapContext = MapContext;
|
|
2571
3478
|
exports.MapEmpty = MapEmpty;
|