@geowiki/map 0.16.9-dev.8 → 0.16.9
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/{GeoWikiMap-G2JPQNTZ.mjs → GeoWikiMap-OMS4RQ6H.mjs} +1 -1
- package/dist/{chunk-3LCQXIYM.mjs → chunk-ALCD7VXT.mjs} +262 -315
- package/dist/index.d.mts +145 -48
- package/dist/index.d.ts +145 -48
- package/dist/index.js +776 -643
- package/dist/index.mjs +457 -271
- package/dist/styles.css +1 -1
- package/package.json +43 -43
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
useEvolandStore,
|
|
39
39
|
useMapLayerStore,
|
|
40
40
|
useMapStore
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ALCD7VXT.mjs";
|
|
42
42
|
|
|
43
43
|
// src/Components/CanvasImage.tsx
|
|
44
44
|
var CanvasImage = () => {
|
|
@@ -224,10 +224,8 @@ var BingLayer = class extends L3.TileLayer {
|
|
|
224
224
|
for (let i = z4; i > 0; i--) {
|
|
225
225
|
let digit = 0;
|
|
226
226
|
const mask = 1 << i - 1;
|
|
227
|
-
if ((x & mask) !== 0)
|
|
228
|
-
|
|
229
|
-
if ((y & mask) !== 0)
|
|
230
|
-
digit += 2;
|
|
227
|
+
if ((x & mask) !== 0) digit += 1;
|
|
228
|
+
if ((y & mask) !== 0) digit += 2;
|
|
231
229
|
quad = quad + digit;
|
|
232
230
|
}
|
|
233
231
|
return quad;
|
|
@@ -241,8 +239,7 @@ var BingLayer = class extends L3.TileLayer {
|
|
|
241
239
|
}
|
|
242
240
|
loadMetadata() {
|
|
243
241
|
var _a;
|
|
244
|
-
if (this.metaRequested)
|
|
245
|
-
return;
|
|
242
|
+
if (this.metaRequested) return;
|
|
246
243
|
this.metaRequested = true;
|
|
247
244
|
const _this = this;
|
|
248
245
|
const cbid = "_bing_metadata_" + L3.Util.stamp(this);
|
|
@@ -250,8 +247,7 @@ var BingLayer = class extends L3.TileLayer {
|
|
|
250
247
|
var _a2;
|
|
251
248
|
window[cbid] = void 0;
|
|
252
249
|
const e = document.getElementById(cbid);
|
|
253
|
-
if (e)
|
|
254
|
-
(_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
|
|
250
|
+
if (e) (_a2 = e.parentNode) == null ? void 0 : _a2.removeChild(e);
|
|
255
251
|
if (meta.errorDetails) {
|
|
256
252
|
console.log(meta.errorDetails);
|
|
257
253
|
return;
|
|
@@ -295,8 +291,7 @@ var BingLayer = class extends L3.TileLayer {
|
|
|
295
291
|
this._update();
|
|
296
292
|
}
|
|
297
293
|
_update() {
|
|
298
|
-
if (this._url === null || !this._map)
|
|
299
|
-
return;
|
|
294
|
+
if (this._url === null || !this._map) return;
|
|
300
295
|
this._update_attribution();
|
|
301
296
|
super._update();
|
|
302
297
|
}
|
|
@@ -458,8 +453,7 @@ var useMapControlStore = create2((set) => ({
|
|
|
458
453
|
})),
|
|
459
454
|
toggleControlOpen: (id) => set((state) => {
|
|
460
455
|
const targetControl = state.controls.find((c) => c.id === id);
|
|
461
|
-
if (!targetControl)
|
|
462
|
-
return state;
|
|
456
|
+
if (!targetControl) return state;
|
|
463
457
|
const targetPosition = targetControl.position;
|
|
464
458
|
const shouldOpenTarget = !targetControl.isOpen;
|
|
465
459
|
const updatedControls = state.controls.map((control) => {
|
|
@@ -645,7 +639,7 @@ import { jsx as jsx10 } from "react/jsx-runtime";
|
|
|
645
639
|
var constructLegendUrl = (baseUrl, layer, format, style) => {
|
|
646
640
|
return `${baseUrl}?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=${format}&LAYER=${layer}&STYLE=${style}&legend_options=dpi:150`;
|
|
647
641
|
};
|
|
648
|
-
var fetchLegendData = (baseUrl, layerName, format, style) => __async(
|
|
642
|
+
var fetchLegendData = (baseUrl, layerName, format, style) => __async(null, null, function* () {
|
|
649
643
|
const legendGraphicUrl = constructLegendUrl(
|
|
650
644
|
baseUrl,
|
|
651
645
|
layerName,
|
|
@@ -1462,10 +1456,8 @@ var LayerSwitcher = memo2(() => {
|
|
|
1462
1456
|
},
|
|
1463
1457
|
[openHoverCardId]
|
|
1464
1458
|
);
|
|
1465
|
-
if (error)
|
|
1466
|
-
|
|
1467
|
-
if (isLoading)
|
|
1468
|
-
return /* @__PURE__ */ jsx14("div", { children: "Loading layers..." });
|
|
1459
|
+
if (error) return /* @__PURE__ */ jsx14("div", { children: "Error loading map layers" });
|
|
1460
|
+
if (isLoading) return /* @__PURE__ */ jsx14("div", { children: "Loading layers..." });
|
|
1469
1461
|
const mapMenus = parseMapMenuItems(mapMenuItems);
|
|
1470
1462
|
const hasRegularLayers = (mapMenus == null ? void 0 : mapMenus.length) > 0;
|
|
1471
1463
|
const hasCustomLayers = customLayers.length > 0;
|
|
@@ -1479,6 +1471,7 @@ var LayerSwitcher = memo2(() => {
|
|
|
1479
1471
|
/* @__PURE__ */ jsx14(
|
|
1480
1472
|
Disclosure,
|
|
1481
1473
|
{
|
|
1474
|
+
as: "div",
|
|
1482
1475
|
"data-component": menu.title,
|
|
1483
1476
|
defaultOpen: mapMenus.length === 1,
|
|
1484
1477
|
children: ({ open }) => {
|
|
@@ -1947,8 +1940,7 @@ var MapControlContainer = memo3(() => {
|
|
|
1947
1940
|
}, [controls]);
|
|
1948
1941
|
return /* @__PURE__ */ jsx18(TooltipProvider, { children: /* @__PURE__ */ jsx18(Fragment6, { children: Object.entries(POSITION_CLASSES).map(([position, className]) => {
|
|
1949
1942
|
const positionControls = controlsByPosition[position] || [];
|
|
1950
|
-
if (positionControls.length === 0)
|
|
1951
|
-
return null;
|
|
1943
|
+
if (positionControls.length === 0) return null;
|
|
1952
1944
|
return /* @__PURE__ */ jsx18(
|
|
1953
1945
|
PositionGroup,
|
|
1954
1946
|
{
|
|
@@ -1975,8 +1967,7 @@ var BasicMap = () => {
|
|
|
1975
1967
|
((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
|
|
1976
1968
|
];
|
|
1977
1969
|
useRenderInfo("BasicMap");
|
|
1978
|
-
if (isSettingsLoading)
|
|
1979
|
-
return /* @__PURE__ */ jsx19(LoaderFull, {});
|
|
1970
|
+
if (isSettingsLoading) return /* @__PURE__ */ jsx19(LoaderFull, {});
|
|
1980
1971
|
return /* @__PURE__ */ jsx19(Fragment7, { children: /* @__PURE__ */ jsxs12(
|
|
1981
1972
|
MapContainer2,
|
|
1982
1973
|
{
|
|
@@ -2048,8 +2039,7 @@ var useSelectedPixelStore = create3((set) => ({
|
|
|
2048
2039
|
set((state) => {
|
|
2049
2040
|
var _a;
|
|
2050
2041
|
const feat = (_a = geoJson.features[0]) == null ? void 0 : _a.id;
|
|
2051
|
-
if (!feat)
|
|
2052
|
-
return state;
|
|
2042
|
+
if (!feat) return state;
|
|
2053
2043
|
const existing = state.data.some(
|
|
2054
2044
|
(item) => item.features[0].id === geoJson.features[0].id
|
|
2055
2045
|
);
|
|
@@ -2722,7 +2712,7 @@ var BasfSelect = () => {
|
|
|
2722
2712
|
[selectedItems]
|
|
2723
2713
|
);
|
|
2724
2714
|
const onSubmit = useCallback4(
|
|
2725
|
-
(data) => __async(
|
|
2715
|
+
(data) => __async(null, null, function* () {
|
|
2726
2716
|
setIsSubmitting(true);
|
|
2727
2717
|
try {
|
|
2728
2718
|
if (checkIfItemExists(data)) {
|
|
@@ -2832,8 +2822,7 @@ function PolylineMeasureControl() {
|
|
|
2832
2822
|
const controlRef = useRef4(null);
|
|
2833
2823
|
const [active, setActive] = useState6(false);
|
|
2834
2824
|
useEffect8(() => {
|
|
2835
|
-
if (!map)
|
|
2836
|
-
return;
|
|
2825
|
+
if (!map) return;
|
|
2837
2826
|
controlRef.current = L5.control.polylineMeasure({
|
|
2838
2827
|
position: "topright",
|
|
2839
2828
|
unit: "metres",
|
|
@@ -2854,8 +2843,7 @@ function PolylineMeasureControl() {
|
|
|
2854
2843
|
};
|
|
2855
2844
|
}, [map]);
|
|
2856
2845
|
const togglePolylineMeasure = () => {
|
|
2857
|
-
if (!controlRef.current)
|
|
2858
|
-
return;
|
|
2846
|
+
if (!controlRef.current) return;
|
|
2859
2847
|
if (!controlRef.current._measureControl) {
|
|
2860
2848
|
console.warn("Measurement control not properly initialized");
|
|
2861
2849
|
return;
|
|
@@ -2871,8 +2859,7 @@ function PolylineMeasureControl() {
|
|
|
2871
2859
|
}
|
|
2872
2860
|
};
|
|
2873
2861
|
const clearMeasurements = () => {
|
|
2874
|
-
if (!controlRef.current)
|
|
2875
|
-
return;
|
|
2862
|
+
if (!controlRef.current) return;
|
|
2876
2863
|
controlRef.current._clearAllMeasurements();
|
|
2877
2864
|
trackMapEvent2.measurementTool("clear");
|
|
2878
2865
|
};
|
|
@@ -2981,8 +2968,7 @@ var BasfMapComponent = (_a) => {
|
|
|
2981
2968
|
Number((_i = (_h = (_g = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _g.Longitude) == null ? void 0 : _h.Text) != null ? _i : 16.3738)
|
|
2982
2969
|
];
|
|
2983
2970
|
const steps = (_k = (_j = mapSettings == null ? void 0 : mapSettings.MapSettings) == null ? void 0 : _j.TourSteps) == null ? void 0 : _k.Text;
|
|
2984
|
-
if (isSettingsLoading)
|
|
2985
|
-
return /* @__PURE__ */ jsx30(LoaderFull2, {});
|
|
2971
|
+
if (isSettingsLoading) return /* @__PURE__ */ jsx30(LoaderFull2, {});
|
|
2986
2972
|
return /* @__PURE__ */ jsx30(Fragment10, { children: /* @__PURE__ */ jsxs19(
|
|
2987
2973
|
MapContainer3,
|
|
2988
2974
|
__spreadProps(__spreadValues({
|
|
@@ -3052,7 +3038,7 @@ var GeoTreesDownloadContent = () => {
|
|
|
3052
3038
|
}
|
|
3053
3039
|
}, [session, setValue]);
|
|
3054
3040
|
useEffect10(() => {
|
|
3055
|
-
const fetchCountries = () => __async(
|
|
3041
|
+
const fetchCountries = () => __async(null, null, function* () {
|
|
3056
3042
|
try {
|
|
3057
3043
|
const response = yield fetch(
|
|
3058
3044
|
`${baseUrl}/api/plots/get-available-countries`,
|
|
@@ -3068,7 +3054,7 @@ var GeoTreesDownloadContent = () => {
|
|
|
3068
3054
|
console.error("Error fetching countries:", error);
|
|
3069
3055
|
}
|
|
3070
3056
|
});
|
|
3071
|
-
const fetchVersions = () => __async(
|
|
3057
|
+
const fetchVersions = () => __async(null, null, function* () {
|
|
3072
3058
|
try {
|
|
3073
3059
|
const response = yield fetch(
|
|
3074
3060
|
`${baseUrl}/api/plots/available-versions`,
|
|
@@ -3322,8 +3308,7 @@ var ScaleControl3 = ({
|
|
|
3322
3308
|
const [scale, setScale] = useState8("");
|
|
3323
3309
|
useEffect11(() => {
|
|
3324
3310
|
const updateScale = () => {
|
|
3325
|
-
if (!map)
|
|
3326
|
-
return;
|
|
3311
|
+
if (!map) return;
|
|
3327
3312
|
const center = map.getCenter();
|
|
3328
3313
|
const zoom = map.getZoom();
|
|
3329
3314
|
const metersPerPixel = 156543.03392 * Math.cos(center.lat * Math.PI / 180) / Math.pow(2, zoom);
|
|
@@ -3339,8 +3324,7 @@ var ScaleControl3 = ({
|
|
|
3339
3324
|
map.off("moveend", updateScale);
|
|
3340
3325
|
};
|
|
3341
3326
|
}, [map]);
|
|
3342
|
-
if (!scale)
|
|
3343
|
-
return null;
|
|
3327
|
+
if (!scale) return null;
|
|
3344
3328
|
return /* @__PURE__ */ jsx32(
|
|
3345
3329
|
"div",
|
|
3346
3330
|
{
|
|
@@ -3943,7 +3927,7 @@ var GeoTreesExternalLayer = forwardRef3(
|
|
|
3943
3927
|
const externalUrl = `${API_URL}/api/external/google-sheet-geojson`;
|
|
3944
3928
|
const { isLoading, error, data } = useQuery2({
|
|
3945
3929
|
queryKey: ["geoTreesExternal", externalUrl],
|
|
3946
|
-
queryFn: () => __async(
|
|
3930
|
+
queryFn: () => __async(null, null, function* () {
|
|
3947
3931
|
if (!API_URL) {
|
|
3948
3932
|
throw new Error("NEXT_PUBLIC_GEO_TREE_API_URL is not configured");
|
|
3949
3933
|
}
|
|
@@ -3975,8 +3959,7 @@ var GeoTreesExternalLayer = forwardRef3(
|
|
|
3975
3959
|
);
|
|
3976
3960
|
const addGeoTreesLayer = useCallback5(() => {
|
|
3977
3961
|
var _a2;
|
|
3978
|
-
if (!data)
|
|
3979
|
-
return;
|
|
3962
|
+
if (!data) return;
|
|
3980
3963
|
const layerId = "geotrees-external-layer";
|
|
3981
3964
|
if (hasLayerBeenAdded(layerId) || existingLayer || hasAddedLayer.current) {
|
|
3982
3965
|
console.warn("GEO-TREES BRM layer already exists, skipping addition", {
|
|
@@ -3989,8 +3972,7 @@ var GeoTreesExternalLayer = forwardRef3(
|
|
|
3989
3972
|
const filteredFeatures = ((_a2 = data.features) == null ? void 0 : _a2.filter((feature) => {
|
|
3990
3973
|
var _a3;
|
|
3991
3974
|
const status = (_a3 = feature.properties) == null ? void 0 : _a3.Status;
|
|
3992
|
-
if (!status)
|
|
3993
|
-
return true;
|
|
3975
|
+
if (!status) return true;
|
|
3994
3976
|
const statusKey = getStatusFromRaw(status);
|
|
3995
3977
|
return statusKey ? statusFilter[statusKey] : true;
|
|
3996
3978
|
})) || [];
|
|
@@ -4058,12 +4040,9 @@ var GeoTreesExternalLayer = forwardRef3(
|
|
|
4058
4040
|
addGeoTreesLayer();
|
|
4059
4041
|
}
|
|
4060
4042
|
}, [data, autoAdd, existingLayer, addGeoTreesLayer, hasLayerBeenAdded]);
|
|
4061
|
-
if (error)
|
|
4062
|
-
|
|
4063
|
-
if (
|
|
4064
|
-
return /* @__PURE__ */ jsx36(LoadingDisplay, {});
|
|
4065
|
-
if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length))
|
|
4066
|
-
return /* @__PURE__ */ jsx36(EmptyStateDisplay, {});
|
|
4043
|
+
if (error) return /* @__PURE__ */ jsx36(ErrorDisplay, { error });
|
|
4044
|
+
if (isLoading) return /* @__PURE__ */ jsx36(LoadingDisplay, {});
|
|
4045
|
+
if (!((_a = data == null ? void 0 : data.features) == null ? void 0 : _a.length)) return /* @__PURE__ */ jsx36(EmptyStateDisplay, {});
|
|
4067
4046
|
return null;
|
|
4068
4047
|
}
|
|
4069
4048
|
);
|
|
@@ -4114,8 +4093,7 @@ var GeoTreesMap = () => {
|
|
|
4114
4093
|
"Error loading map settings: ",
|
|
4115
4094
|
error.message
|
|
4116
4095
|
] }) });
|
|
4117
|
-
if (isSettingsLoading)
|
|
4118
|
-
return /* @__PURE__ */ jsx37(LoaderFull3, { showInCenter: false });
|
|
4096
|
+
if (isSettingsLoading) return /* @__PURE__ */ jsx37(LoaderFull3, { showInCenter: false });
|
|
4119
4097
|
const zoom = (_c = (_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) != null ? _c : 12;
|
|
4120
4098
|
const center = [
|
|
4121
4099
|
(_f = (_e = (_d = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _d.Latitude) == null ? void 0 : _e.Text) != null ? _f : 48.2082,
|
|
@@ -4182,8 +4160,7 @@ var useAreaSelect = ({
|
|
|
4182
4160
|
const rectangleRef = useRef7(null);
|
|
4183
4161
|
useEffect15(() => {
|
|
4184
4162
|
var _a;
|
|
4185
|
-
if (!map.selectArea)
|
|
4186
|
-
return;
|
|
4163
|
+
if (!map.selectArea) return;
|
|
4187
4164
|
(_a = map.selectArea) == null ? void 0 : _a.setControlKey(false);
|
|
4188
4165
|
if (!rectangleRef.current) {
|
|
4189
4166
|
rectangleRef.current = new Rectangle(
|
|
@@ -4196,8 +4173,7 @@ var useAreaSelect = ({
|
|
|
4196
4173
|
}
|
|
4197
4174
|
const handleAreaSelected = (e) => {
|
|
4198
4175
|
var _a2, _b, _c;
|
|
4199
|
-
if (!e.bounds)
|
|
4200
|
-
return;
|
|
4176
|
+
if (!e.bounds) return;
|
|
4201
4177
|
const boundsString = e.bounds.toBBoxString();
|
|
4202
4178
|
if (onAreaSelected) {
|
|
4203
4179
|
onAreaSelected(boundsString);
|
|
@@ -4270,9 +4246,8 @@ import { jsx as jsx38, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
|
4270
4246
|
var CanopyAtlasDownload = () => {
|
|
4271
4247
|
const [format, setFormat] = useState10("shape-zip");
|
|
4272
4248
|
const { bbox } = useAreaSelectStore();
|
|
4273
|
-
const handleDownload = () => __async(
|
|
4274
|
-
if (!bbox)
|
|
4275
|
-
return;
|
|
4249
|
+
const handleDownload = () => __async(null, null, function* () {
|
|
4250
|
+
if (!bbox) return;
|
|
4276
4251
|
const params = {
|
|
4277
4252
|
request: "GetFeature",
|
|
4278
4253
|
service: "WFS",
|
|
@@ -4287,8 +4262,7 @@ var CanopyAtlasDownload = () => {
|
|
|
4287
4262
|
const wfsUrl = baseUrl + L7.Util.getParamString(params, baseUrl, true);
|
|
4288
4263
|
try {
|
|
4289
4264
|
const response = yield fetch(wfsUrl);
|
|
4290
|
-
if (!response.ok)
|
|
4291
|
-
throw new Error("Download failed");
|
|
4265
|
+
if (!response.ok) throw new Error("Download failed");
|
|
4292
4266
|
const blob = yield response.blob();
|
|
4293
4267
|
const url = window.URL.createObjectURL(blob);
|
|
4294
4268
|
const a = document.createElement("a");
|
|
@@ -4470,20 +4444,15 @@ var CanopyFilter = memo11(({ onFilterChange }) => {
|
|
|
4470
4444
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(updatedFilters));
|
|
4471
4445
|
onFilterChange(updatedFilters);
|
|
4472
4446
|
};
|
|
4473
|
-
const handleDownload = () => __async(
|
|
4447
|
+
const handleDownload = () => __async(null, null, function* () {
|
|
4474
4448
|
const cqlFilters = [];
|
|
4475
|
-
if (filters.biome)
|
|
4476
|
-
|
|
4477
|
-
if (filters.
|
|
4478
|
-
cqlFilters.push(`realm='${filters.realm}'`);
|
|
4479
|
-
if (filters.access)
|
|
4480
|
-
cqlFilters.push(`access='${filters.access}'`);
|
|
4449
|
+
if (filters.biome) cqlFilters.push(`biome='${filters.biome}'`);
|
|
4450
|
+
if (filters.realm) cqlFilters.push(`realm='${filters.realm}'`);
|
|
4451
|
+
if (filters.access) cqlFilters.push(`access='${filters.access}'`);
|
|
4481
4452
|
if (filters.idunique)
|
|
4482
4453
|
cqlFilters.push(`IDunique LIKE '%${filters.idunique}%'`);
|
|
4483
|
-
if (filters.minyear)
|
|
4484
|
-
|
|
4485
|
-
if (filters.maxyear)
|
|
4486
|
-
cqlFilters.push(`minyear<=${filters.maxyear}`);
|
|
4454
|
+
if (filters.minyear) cqlFilters.push(`minyear>=${filters.minyear}`);
|
|
4455
|
+
if (filters.maxyear) cqlFilters.push(`minyear<=${filters.maxyear}`);
|
|
4487
4456
|
const params = __spreadValues({
|
|
4488
4457
|
request: "GetFeature",
|
|
4489
4458
|
service: "WFS",
|
|
@@ -4497,8 +4466,7 @@ var CanopyFilter = memo11(({ onFilterChange }) => {
|
|
|
4497
4466
|
const wfsUrl = baseUrl + L8.Util.getParamString(params, baseUrl, true);
|
|
4498
4467
|
try {
|
|
4499
4468
|
const response = yield fetch(wfsUrl);
|
|
4500
|
-
if (!response.ok)
|
|
4501
|
-
throw new Error("Download failed");
|
|
4469
|
+
if (!response.ok) throw new Error("Download failed");
|
|
4502
4470
|
const blob = yield response.blob();
|
|
4503
4471
|
const url = window.URL.createObjectURL(blob);
|
|
4504
4472
|
const a = document.createElement("a");
|
|
@@ -4732,10 +4700,8 @@ var constructCqlFilter = (filterParams) => {
|
|
|
4732
4700
|
return "";
|
|
4733
4701
|
}
|
|
4734
4702
|
let _a = filterParams || {}, { minyear, maxyear } = _a, rest = __objRest(_a, ["minyear", "maxyear"]);
|
|
4735
|
-
if (Array.isArray(minyear))
|
|
4736
|
-
|
|
4737
|
-
if (Array.isArray(maxyear))
|
|
4738
|
-
maxyear = maxyear[0];
|
|
4703
|
+
if (Array.isArray(minyear)) minyear = minyear[0];
|
|
4704
|
+
if (Array.isArray(maxyear)) maxyear = maxyear[0];
|
|
4739
4705
|
const cqlExpressions = [];
|
|
4740
4706
|
if (minyear && maxyear) {
|
|
4741
4707
|
cqlExpressions.push(
|
|
@@ -4842,16 +4808,14 @@ var formatPropertyValue = (value, propertyName) => {
|
|
|
4842
4808
|
return value.toString();
|
|
4843
4809
|
};
|
|
4844
4810
|
var createDefaultPopupContent = (feature, propertyNames) => {
|
|
4845
|
-
if (!feature.properties)
|
|
4846
|
-
return "";
|
|
4811
|
+
if (!feature.properties) return "";
|
|
4847
4812
|
const propertiesToShow = (propertyNames == null ? void 0 : propertyNames.length) ? propertyNames : DEFAULT_POPUP_PROPERTIES;
|
|
4848
4813
|
const properties = Object.entries(feature.properties).filter(([key]) => propertiesToShow.includes(key)).sort((a, b) => {
|
|
4849
4814
|
const indexA = propertiesToShow.indexOf(a[0]);
|
|
4850
4815
|
const indexB = propertiesToShow.indexOf(b[0]);
|
|
4851
4816
|
return indexA - indexB;
|
|
4852
4817
|
});
|
|
4853
|
-
if (properties.length === 0)
|
|
4854
|
-
return "";
|
|
4818
|
+
if (properties.length === 0) return "";
|
|
4855
4819
|
return `
|
|
4856
4820
|
<div class="leaflet-popup-content-wrapper" style="background-color: #fff; padding: 0; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.15);">
|
|
4857
4821
|
<div style="width: 100%; overflow-y: auto;">
|
|
@@ -4922,7 +4886,7 @@ var openDatabase = () => {
|
|
|
4922
4886
|
};
|
|
4923
4887
|
});
|
|
4924
4888
|
};
|
|
4925
|
-
var storeInIndexedDB = (key, data) => __async(
|
|
4889
|
+
var storeInIndexedDB = (key, data) => __async(null, null, function* () {
|
|
4926
4890
|
try {
|
|
4927
4891
|
const db = yield openDatabase();
|
|
4928
4892
|
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
@@ -4941,7 +4905,7 @@ var storeInIndexedDB = (key, data) => __async(void 0, null, function* () {
|
|
|
4941
4905
|
console.warn("Failed to store data in IndexedDB:", e);
|
|
4942
4906
|
}
|
|
4943
4907
|
});
|
|
4944
|
-
var getFromIndexedDB = (key) => __async(
|
|
4908
|
+
var getFromIndexedDB = (key) => __async(null, null, function* () {
|
|
4945
4909
|
try {
|
|
4946
4910
|
const db = yield openDatabase();
|
|
4947
4911
|
const transaction = db.transaction(STORE_NAME, "readonly");
|
|
@@ -4963,7 +4927,7 @@ var getFromIndexedDB = (key) => __async(void 0, null, function* () {
|
|
|
4963
4927
|
return null;
|
|
4964
4928
|
}
|
|
4965
4929
|
});
|
|
4966
|
-
var cleanupIndexedDB = () => __async(
|
|
4930
|
+
var cleanupIndexedDB = () => __async(null, null, function* () {
|
|
4967
4931
|
try {
|
|
4968
4932
|
const db = yield openDatabase();
|
|
4969
4933
|
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
@@ -5013,8 +4977,7 @@ var WfsLayer = ({
|
|
|
5013
4977
|
}
|
|
5014
4978
|
});
|
|
5015
4979
|
const stableFilterParams = useMemo4(() => {
|
|
5016
|
-
if (!filterParams)
|
|
5017
|
-
return null;
|
|
4980
|
+
if (!filterParams) return null;
|
|
5018
4981
|
return JSON.stringify(filterParams);
|
|
5019
4982
|
}, [filterParams]);
|
|
5020
4983
|
const queryKey = useMemo4(() => {
|
|
@@ -5036,7 +4999,7 @@ var WfsLayer = ({
|
|
|
5036
4999
|
}, [url, layerName, filterParams, useServerFiltering]);
|
|
5037
5000
|
const { data: geoJsonData, error } = useQuery3({
|
|
5038
5001
|
queryKey,
|
|
5039
|
-
queryFn: () => __async(
|
|
5002
|
+
queryFn: () => __async(null, null, function* () {
|
|
5040
5003
|
mapStore.setIsLoading(true);
|
|
5041
5004
|
const wfsUrl = constructWfsUrl();
|
|
5042
5005
|
const storageKey = `wfs-data-${queryKey.join("-")}`;
|
|
@@ -5101,8 +5064,7 @@ var WfsLayer = ({
|
|
|
5101
5064
|
const getFeatureStyle = useCallback6(
|
|
5102
5065
|
(feature) => {
|
|
5103
5066
|
var _a2;
|
|
5104
|
-
if (!feature)
|
|
5105
|
-
return defaultStyle;
|
|
5067
|
+
if (!feature) return defaultStyle;
|
|
5106
5068
|
const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
|
|
5107
5069
|
return featureId === selectedFeatureId ? highlightStyle : defaultStyle;
|
|
5108
5070
|
},
|
|
@@ -5113,8 +5075,7 @@ var WfsLayer = ({
|
|
|
5113
5075
|
var _a2;
|
|
5114
5076
|
const featureId = ((_a2 = feature.id) == null ? void 0 : _a2.toString()) || JSON.stringify(feature.properties);
|
|
5115
5077
|
layerRef.current[featureId] = layer;
|
|
5116
|
-
if (!popupOptions || !feature.properties)
|
|
5117
|
-
return;
|
|
5078
|
+
if (!popupOptions || !feature.properties) return;
|
|
5118
5079
|
let popupContent;
|
|
5119
5080
|
if (popupOptions.renderContent) {
|
|
5120
5081
|
popupContent = popupOptions.renderContent(feature);
|
|
@@ -5159,8 +5120,7 @@ var WfsLayer = ({
|
|
|
5159
5120
|
[]
|
|
5160
5121
|
);
|
|
5161
5122
|
const filteredGeoJson = useMemo4(() => {
|
|
5162
|
-
if (!geoJsonData)
|
|
5163
|
-
return null;
|
|
5123
|
+
if (!geoJsonData) return null;
|
|
5164
5124
|
if (useServerFiltering || !filterParams || Object.keys(filterParams).length === 0) {
|
|
5165
5125
|
return geoJsonData;
|
|
5166
5126
|
}
|
|
@@ -5397,15 +5357,14 @@ import { Fragment as Fragment16, jsx as jsx42, jsxs as jsxs29 } from "react/jsx-
|
|
|
5397
5357
|
var CanopyMap = () => {
|
|
5398
5358
|
var _a, _b, _c, _d, _e, _f;
|
|
5399
5359
|
const { data: mapSettings, isLoading: isSettingsLoading } = useMapSettings4();
|
|
5400
|
-
const mapRef = useRef10();
|
|
5360
|
+
const mapRef = useRef10(void 0);
|
|
5401
5361
|
const zoom = ((_b = (_a = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _a.Zoom) == null ? void 0 : _b.Value) || 5;
|
|
5402
5362
|
const center = [
|
|
5403
5363
|
((_d = (_c = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _c.Latitude) == null ? void 0 : _d.Text) || 48.2082,
|
|
5404
5364
|
((_f = (_e = mapSettings == null ? void 0 : mapSettings.LocationPart) == null ? void 0 : _e.Longitude) == null ? void 0 : _f.Text) || 16.3738
|
|
5405
5365
|
];
|
|
5406
5366
|
useRenderInfo2("BasicMap");
|
|
5407
|
-
if (isSettingsLoading)
|
|
5408
|
-
return /* @__PURE__ */ jsx42(LoaderFull4, { showInCenter: false });
|
|
5367
|
+
if (isSettingsLoading) return /* @__PURE__ */ jsx42(LoaderFull4, { showInCenter: false });
|
|
5409
5368
|
return /* @__PURE__ */ jsx42(Fragment16, { children: /* @__PURE__ */ jsxs29(
|
|
5410
5369
|
MapContainer5,
|
|
5411
5370
|
{
|
|
@@ -5529,7 +5488,7 @@ var BasfLeftPanel = () => {
|
|
|
5529
5488
|
[selectedItems]
|
|
5530
5489
|
);
|
|
5531
5490
|
const onSubmit = useCallback8(
|
|
5532
|
-
(data) => __async(
|
|
5491
|
+
(data) => __async(null, null, function* () {
|
|
5533
5492
|
setIsSubmitting(true);
|
|
5534
5493
|
try {
|
|
5535
5494
|
if (checkIfItemExists(data)) {
|
|
@@ -5632,8 +5591,7 @@ var WaybackTimelineMap = (props) => {
|
|
|
5632
5591
|
return null;
|
|
5633
5592
|
}
|
|
5634
5593
|
useEffect19(() => {
|
|
5635
|
-
if (props.mapping)
|
|
5636
|
-
setWAYBACK_SNAPSHOTS(props.mapping);
|
|
5594
|
+
if (props.mapping) setWAYBACK_SNAPSHOTS(props.mapping);
|
|
5637
5595
|
}, [props.mapping]);
|
|
5638
5596
|
const west = parseFloat(searchParams.get("xmin"));
|
|
5639
5597
|
const south = parseFloat(searchParams.get("ymin"));
|
|
@@ -5716,6 +5674,7 @@ var WaybackTimelineMap = (props) => {
|
|
|
5716
5674
|
import { useEffect as useEffect21, useRef as useRef12, useState as useState17 } from "react";
|
|
5717
5675
|
import { forwardRef as forwardRef5 } from "react";
|
|
5718
5676
|
import maplibregl from "maplibre-gl";
|
|
5677
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
5719
5678
|
import MapPinIcon3 from "@heroicons/react/24/solid/MapPinIcon";
|
|
5720
5679
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
5721
5680
|
|
|
@@ -6038,7 +5997,7 @@ var LayerItem2 = memo13(
|
|
|
6038
5997
|
}
|
|
6039
5998
|
);
|
|
6040
5999
|
LayerItem2.displayName = "LayerItem";
|
|
6041
|
-
var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
|
|
6000
|
+
var LayerSwitcher2 = memo13((({ mapMenuItems, customLayers }) => {
|
|
6042
6001
|
const store = useMapLayerStore2();
|
|
6043
6002
|
const [openHoverCardId, setOpenHoverCardId] = useState16(null);
|
|
6044
6003
|
useEffect20(() => {
|
|
@@ -6069,6 +6028,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
|
|
|
6069
6028
|
/* @__PURE__ */ jsx46(
|
|
6070
6029
|
Disclosure2,
|
|
6071
6030
|
{
|
|
6031
|
+
as: "div",
|
|
6072
6032
|
"data-component": menu.title,
|
|
6073
6033
|
defaultOpen: mapMenuItems.length === 1,
|
|
6074
6034
|
children: ({ open }) => {
|
|
@@ -6094,8 +6054,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
|
|
|
6094
6054
|
) !== -1,
|
|
6095
6055
|
onToggle: () => {
|
|
6096
6056
|
handleToggle(layer);
|
|
6097
|
-
if (layer.ontoggle)
|
|
6098
|
-
layer.ontoggle();
|
|
6057
|
+
if (layer.ontoggle) layer.ontoggle();
|
|
6099
6058
|
},
|
|
6100
6059
|
openHoverCardId,
|
|
6101
6060
|
onInfoClick: handleInfoClick
|
|
@@ -6151,7 +6110,7 @@ var LayerSwitcher2 = memo13(({ mapMenuItems, customLayers }) => {
|
|
|
6151
6110
|
] })
|
|
6152
6111
|
] }, menu.id);
|
|
6153
6112
|
}) });
|
|
6154
|
-
});
|
|
6113
|
+
}));
|
|
6155
6114
|
LayerSwitcher2.displayName = "LayerSwitcher";
|
|
6156
6115
|
|
|
6157
6116
|
// src/Components/Generic/Map/MapControlToolbar.tsx
|
|
@@ -6163,23 +6122,18 @@ import {
|
|
|
6163
6122
|
TooltipTrigger as TooltipTrigger2
|
|
6164
6123
|
} from "@geowiki/ui";
|
|
6165
6124
|
|
|
6166
|
-
// ../../node_modules/clsx/dist/clsx.
|
|
6125
|
+
// ../../node_modules/clsx/dist/clsx.mjs
|
|
6167
6126
|
function r(e) {
|
|
6168
6127
|
var t, f, n = "";
|
|
6169
|
-
if ("string" == typeof e || "number" == typeof e)
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
6175
|
-
else
|
|
6176
|
-
for (t in e)
|
|
6177
|
-
e[t] && (n && (n += " "), n += t);
|
|
6128
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
6129
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
6130
|
+
var o = e.length;
|
|
6131
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
6132
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
6178
6133
|
return n;
|
|
6179
6134
|
}
|
|
6180
6135
|
function clsx() {
|
|
6181
|
-
for (var e, t, f = 0, n = ""
|
|
6182
|
-
(e = arguments[f++]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
6136
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
6183
6137
|
return n;
|
|
6184
6138
|
}
|
|
6185
6139
|
|
|
@@ -6560,7 +6514,7 @@ var arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
|
|
|
6560
6514
|
var fractionRegex = /^\d+\/\d+$/;
|
|
6561
6515
|
var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
|
|
6562
6516
|
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
6563
|
-
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))
|
|
6517
|
+
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
|
|
6564
6518
|
var shadowRegex = /^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
6565
6519
|
function isLength(value) {
|
|
6566
6520
|
return isNumber(value) || stringLengths.has(value) || fractionRegex.test(value) || isArbitraryLength(value);
|
|
@@ -6660,8 +6614,11 @@ function getDefaultConfig() {
|
|
|
6660
6614
|
var getOverflow = function getOverflow2() {
|
|
6661
6615
|
return ["auto", "hidden", "clip", "visible", "scroll"];
|
|
6662
6616
|
};
|
|
6663
|
-
var
|
|
6664
|
-
return ["auto", spacing];
|
|
6617
|
+
var getSpacingWithAutoAndArbitrary = function getSpacingWithAutoAndArbitrary2() {
|
|
6618
|
+
return ["auto", isArbitraryValue, spacing];
|
|
6619
|
+
};
|
|
6620
|
+
var getSpacingWithArbitrary = function getSpacingWithArbitrary2() {
|
|
6621
|
+
return [isArbitraryValue, spacing];
|
|
6665
6622
|
};
|
|
6666
6623
|
var getLengthWithEmpty = function getLengthWithEmpty2() {
|
|
6667
6624
|
return ["", isLength];
|
|
@@ -6698,29 +6655,29 @@ function getDefaultConfig() {
|
|
|
6698
6655
|
theme: {
|
|
6699
6656
|
colors: [isAny],
|
|
6700
6657
|
spacing: [isLength],
|
|
6701
|
-
blur: ["none", "", isTshirtSize,
|
|
6658
|
+
blur: ["none", "", isTshirtSize, isArbitraryValue],
|
|
6702
6659
|
brightness: getNumber(),
|
|
6703
6660
|
borderColor: [colors],
|
|
6704
|
-
borderRadius: ["none", "", "full", isTshirtSize,
|
|
6705
|
-
borderSpacing:
|
|
6661
|
+
borderRadius: ["none", "", "full", isTshirtSize, isArbitraryValue],
|
|
6662
|
+
borderSpacing: getSpacingWithArbitrary(),
|
|
6706
6663
|
borderWidth: getLengthWithEmpty(),
|
|
6707
6664
|
contrast: getNumber(),
|
|
6708
6665
|
grayscale: getZeroAndEmpty(),
|
|
6709
6666
|
hueRotate: getNumberAndArbitrary(),
|
|
6710
6667
|
invert: getZeroAndEmpty(),
|
|
6711
|
-
gap:
|
|
6668
|
+
gap: getSpacingWithArbitrary(),
|
|
6712
6669
|
gradientColorStops: [colors],
|
|
6713
6670
|
gradientColorStopPositions: [isPercent, isArbitraryLength],
|
|
6714
|
-
inset:
|
|
6715
|
-
margin:
|
|
6671
|
+
inset: getSpacingWithAutoAndArbitrary(),
|
|
6672
|
+
margin: getSpacingWithAutoAndArbitrary(),
|
|
6716
6673
|
opacity: getNumber(),
|
|
6717
|
-
padding:
|
|
6674
|
+
padding: getSpacingWithArbitrary(),
|
|
6718
6675
|
saturate: getNumber(),
|
|
6719
6676
|
scale: getNumber(),
|
|
6720
6677
|
sepia: getZeroAndEmpty(),
|
|
6721
6678
|
skew: getNumberAndArbitrary(),
|
|
6722
|
-
space:
|
|
6723
|
-
translate:
|
|
6679
|
+
space: getSpacingWithArbitrary(),
|
|
6680
|
+
translate: getSpacingWithArbitrary()
|
|
6724
6681
|
},
|
|
6725
6682
|
classGroups: {
|
|
6726
6683
|
// Layout
|
|
@@ -6944,7 +6901,7 @@ function getDefaultConfig() {
|
|
|
6944
6901
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
6945
6902
|
*/
|
|
6946
6903
|
basis: [{
|
|
6947
|
-
basis:
|
|
6904
|
+
basis: getSpacingWithAutoAndArbitrary()
|
|
6948
6905
|
}],
|
|
6949
6906
|
/**
|
|
6950
6907
|
* Flex Direction
|
|
@@ -7001,7 +6958,7 @@ function getDefaultConfig() {
|
|
|
7001
6958
|
*/
|
|
7002
6959
|
"col-start-end": [{
|
|
7003
6960
|
col: ["auto", {
|
|
7004
|
-
span: [isInteger]
|
|
6961
|
+
span: ["full", isInteger]
|
|
7005
6962
|
}, isArbitraryValue]
|
|
7006
6963
|
}],
|
|
7007
6964
|
/**
|
|
@@ -7310,14 +7267,14 @@ function getDefaultConfig() {
|
|
|
7310
7267
|
* @see https://tailwindcss.com/docs/width
|
|
7311
7268
|
*/
|
|
7312
7269
|
w: [{
|
|
7313
|
-
w: ["auto", "min", "max", "fit", spacing]
|
|
7270
|
+
w: ["auto", "min", "max", "fit", isArbitraryValue, spacing]
|
|
7314
7271
|
}],
|
|
7315
7272
|
/**
|
|
7316
7273
|
* Min-Width
|
|
7317
7274
|
* @see https://tailwindcss.com/docs/min-width
|
|
7318
7275
|
*/
|
|
7319
7276
|
"min-w": [{
|
|
7320
|
-
"min-w": ["min", "max", "fit", isLength]
|
|
7277
|
+
"min-w": ["min", "max", "fit", isArbitraryValue, isLength]
|
|
7321
7278
|
}],
|
|
7322
7279
|
/**
|
|
7323
7280
|
* Max-Width
|
|
@@ -7326,28 +7283,28 @@ function getDefaultConfig() {
|
|
|
7326
7283
|
"max-w": [{
|
|
7327
7284
|
"max-w": ["0", "none", "full", "min", "max", "fit", "prose", {
|
|
7328
7285
|
screen: [isTshirtSize]
|
|
7329
|
-
}, isTshirtSize,
|
|
7286
|
+
}, isTshirtSize, isArbitraryValue]
|
|
7330
7287
|
}],
|
|
7331
7288
|
/**
|
|
7332
7289
|
* Height
|
|
7333
7290
|
* @see https://tailwindcss.com/docs/height
|
|
7334
7291
|
*/
|
|
7335
7292
|
h: [{
|
|
7336
|
-
h: [spacing, "auto", "min", "max", "fit"]
|
|
7293
|
+
h: [isArbitraryValue, spacing, "auto", "min", "max", "fit"]
|
|
7337
7294
|
}],
|
|
7338
7295
|
/**
|
|
7339
7296
|
* Min-Height
|
|
7340
7297
|
* @see https://tailwindcss.com/docs/min-height
|
|
7341
7298
|
*/
|
|
7342
7299
|
"min-h": [{
|
|
7343
|
-
"min-h": ["min", "max", "fit", isLength]
|
|
7300
|
+
"min-h": ["min", "max", "fit", isArbitraryValue, isLength]
|
|
7344
7301
|
}],
|
|
7345
7302
|
/**
|
|
7346
7303
|
* Max-Height
|
|
7347
7304
|
* @see https://tailwindcss.com/docs/max-height
|
|
7348
7305
|
*/
|
|
7349
7306
|
"max-h": [{
|
|
7350
|
-
"max-h": [spacing, "min", "max", "fit"]
|
|
7307
|
+
"max-h": [isArbitraryValue, spacing, "min", "max", "fit"]
|
|
7351
7308
|
}],
|
|
7352
7309
|
// Typography
|
|
7353
7310
|
/**
|
|
@@ -7416,7 +7373,7 @@ function getDefaultConfig() {
|
|
|
7416
7373
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
7417
7374
|
*/
|
|
7418
7375
|
tracking: [{
|
|
7419
|
-
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest",
|
|
7376
|
+
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", isArbitraryValue]
|
|
7420
7377
|
}],
|
|
7421
7378
|
/**
|
|
7422
7379
|
* Line Clamp
|
|
@@ -7430,7 +7387,7 @@ function getDefaultConfig() {
|
|
|
7430
7387
|
* @see https://tailwindcss.com/docs/line-height
|
|
7431
7388
|
*/
|
|
7432
7389
|
leading: [{
|
|
7433
|
-
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isLength]
|
|
7390
|
+
leading: ["none", "tight", "snug", "normal", "relaxed", "loose", isArbitraryValue, isLength]
|
|
7434
7391
|
}],
|
|
7435
7392
|
/**
|
|
7436
7393
|
* List Style Image
|
|
@@ -7513,7 +7470,7 @@ function getDefaultConfig() {
|
|
|
7513
7470
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
7514
7471
|
*/
|
|
7515
7472
|
"underline-offset": [{
|
|
7516
|
-
"underline-offset": ["auto", isLength]
|
|
7473
|
+
"underline-offset": ["auto", isArbitraryValue, isLength]
|
|
7517
7474
|
}],
|
|
7518
7475
|
/**
|
|
7519
7476
|
* Text Decoration Color
|
|
@@ -7537,14 +7494,14 @@ function getDefaultConfig() {
|
|
|
7537
7494
|
* @see https://tailwindcss.com/docs/text-indent
|
|
7538
7495
|
*/
|
|
7539
7496
|
indent: [{
|
|
7540
|
-
indent:
|
|
7497
|
+
indent: getSpacingWithArbitrary()
|
|
7541
7498
|
}],
|
|
7542
7499
|
/**
|
|
7543
7500
|
* Vertical Alignment
|
|
7544
7501
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
7545
7502
|
*/
|
|
7546
7503
|
"vertical-align": [{
|
|
7547
|
-
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super",
|
|
7504
|
+
align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", isArbitraryValue]
|
|
7548
7505
|
}],
|
|
7549
7506
|
/**
|
|
7550
7507
|
* Whitespace
|
|
@@ -7974,7 +7931,7 @@ function getDefaultConfig() {
|
|
|
7974
7931
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
7975
7932
|
*/
|
|
7976
7933
|
"outline-offset": [{
|
|
7977
|
-
"outline-offset": [isLength]
|
|
7934
|
+
"outline-offset": [isArbitraryValue, isLength]
|
|
7978
7935
|
}],
|
|
7979
7936
|
/**
|
|
7980
7937
|
* Outline Width
|
|
@@ -8053,7 +8010,7 @@ function getDefaultConfig() {
|
|
|
8053
8010
|
opacity: [opacity]
|
|
8054
8011
|
}],
|
|
8055
8012
|
/**
|
|
8056
|
-
* Mix
|
|
8013
|
+
* Mix Blend Mode
|
|
8057
8014
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
8058
8015
|
*/
|
|
8059
8016
|
"mix-blend": [{
|
|
@@ -8412,126 +8369,126 @@ function getDefaultConfig() {
|
|
|
8412
8369
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8413
8370
|
*/
|
|
8414
8371
|
"scroll-m": [{
|
|
8415
|
-
"scroll-m":
|
|
8372
|
+
"scroll-m": getSpacingWithArbitrary()
|
|
8416
8373
|
}],
|
|
8417
8374
|
/**
|
|
8418
8375
|
* Scroll Margin X
|
|
8419
8376
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8420
8377
|
*/
|
|
8421
8378
|
"scroll-mx": [{
|
|
8422
|
-
"scroll-mx":
|
|
8379
|
+
"scroll-mx": getSpacingWithArbitrary()
|
|
8423
8380
|
}],
|
|
8424
8381
|
/**
|
|
8425
8382
|
* Scroll Margin Y
|
|
8426
8383
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8427
8384
|
*/
|
|
8428
8385
|
"scroll-my": [{
|
|
8429
|
-
"scroll-my":
|
|
8386
|
+
"scroll-my": getSpacingWithArbitrary()
|
|
8430
8387
|
}],
|
|
8431
8388
|
/**
|
|
8432
8389
|
* Scroll Margin Start
|
|
8433
8390
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8434
8391
|
*/
|
|
8435
8392
|
"scroll-ms": [{
|
|
8436
|
-
"scroll-ms":
|
|
8393
|
+
"scroll-ms": getSpacingWithArbitrary()
|
|
8437
8394
|
}],
|
|
8438
8395
|
/**
|
|
8439
8396
|
* Scroll Margin End
|
|
8440
8397
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8441
8398
|
*/
|
|
8442
8399
|
"scroll-me": [{
|
|
8443
|
-
"scroll-me":
|
|
8400
|
+
"scroll-me": getSpacingWithArbitrary()
|
|
8444
8401
|
}],
|
|
8445
8402
|
/**
|
|
8446
8403
|
* Scroll Margin Top
|
|
8447
8404
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8448
8405
|
*/
|
|
8449
8406
|
"scroll-mt": [{
|
|
8450
|
-
"scroll-mt":
|
|
8407
|
+
"scroll-mt": getSpacingWithArbitrary()
|
|
8451
8408
|
}],
|
|
8452
8409
|
/**
|
|
8453
8410
|
* Scroll Margin Right
|
|
8454
8411
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8455
8412
|
*/
|
|
8456
8413
|
"scroll-mr": [{
|
|
8457
|
-
"scroll-mr":
|
|
8414
|
+
"scroll-mr": getSpacingWithArbitrary()
|
|
8458
8415
|
}],
|
|
8459
8416
|
/**
|
|
8460
8417
|
* Scroll Margin Bottom
|
|
8461
8418
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8462
8419
|
*/
|
|
8463
8420
|
"scroll-mb": [{
|
|
8464
|
-
"scroll-mb":
|
|
8421
|
+
"scroll-mb": getSpacingWithArbitrary()
|
|
8465
8422
|
}],
|
|
8466
8423
|
/**
|
|
8467
8424
|
* Scroll Margin Left
|
|
8468
8425
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
8469
8426
|
*/
|
|
8470
8427
|
"scroll-ml": [{
|
|
8471
|
-
"scroll-ml":
|
|
8428
|
+
"scroll-ml": getSpacingWithArbitrary()
|
|
8472
8429
|
}],
|
|
8473
8430
|
/**
|
|
8474
8431
|
* Scroll Padding
|
|
8475
8432
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8476
8433
|
*/
|
|
8477
8434
|
"scroll-p": [{
|
|
8478
|
-
"scroll-p":
|
|
8435
|
+
"scroll-p": getSpacingWithArbitrary()
|
|
8479
8436
|
}],
|
|
8480
8437
|
/**
|
|
8481
8438
|
* Scroll Padding X
|
|
8482
8439
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8483
8440
|
*/
|
|
8484
8441
|
"scroll-px": [{
|
|
8485
|
-
"scroll-px":
|
|
8442
|
+
"scroll-px": getSpacingWithArbitrary()
|
|
8486
8443
|
}],
|
|
8487
8444
|
/**
|
|
8488
8445
|
* Scroll Padding Y
|
|
8489
8446
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8490
8447
|
*/
|
|
8491
8448
|
"scroll-py": [{
|
|
8492
|
-
"scroll-py":
|
|
8449
|
+
"scroll-py": getSpacingWithArbitrary()
|
|
8493
8450
|
}],
|
|
8494
8451
|
/**
|
|
8495
8452
|
* Scroll Padding Start
|
|
8496
8453
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8497
8454
|
*/
|
|
8498
8455
|
"scroll-ps": [{
|
|
8499
|
-
"scroll-ps":
|
|
8456
|
+
"scroll-ps": getSpacingWithArbitrary()
|
|
8500
8457
|
}],
|
|
8501
8458
|
/**
|
|
8502
8459
|
* Scroll Padding End
|
|
8503
8460
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8504
8461
|
*/
|
|
8505
8462
|
"scroll-pe": [{
|
|
8506
|
-
"scroll-pe":
|
|
8463
|
+
"scroll-pe": getSpacingWithArbitrary()
|
|
8507
8464
|
}],
|
|
8508
8465
|
/**
|
|
8509
8466
|
* Scroll Padding Top
|
|
8510
8467
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8511
8468
|
*/
|
|
8512
8469
|
"scroll-pt": [{
|
|
8513
|
-
"scroll-pt":
|
|
8470
|
+
"scroll-pt": getSpacingWithArbitrary()
|
|
8514
8471
|
}],
|
|
8515
8472
|
/**
|
|
8516
8473
|
* Scroll Padding Right
|
|
8517
8474
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8518
8475
|
*/
|
|
8519
8476
|
"scroll-pr": [{
|
|
8520
|
-
"scroll-pr":
|
|
8477
|
+
"scroll-pr": getSpacingWithArbitrary()
|
|
8521
8478
|
}],
|
|
8522
8479
|
/**
|
|
8523
8480
|
* Scroll Padding Bottom
|
|
8524
8481
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8525
8482
|
*/
|
|
8526
8483
|
"scroll-pb": [{
|
|
8527
|
-
"scroll-pb":
|
|
8484
|
+
"scroll-pb": getSpacingWithArbitrary()
|
|
8528
8485
|
}],
|
|
8529
8486
|
/**
|
|
8530
8487
|
* Scroll Padding Left
|
|
8531
8488
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
8532
8489
|
*/
|
|
8533
8490
|
"scroll-pl": [{
|
|
8534
|
-
"scroll-pl":
|
|
8491
|
+
"scroll-pl": getSpacingWithArbitrary()
|
|
8535
8492
|
}],
|
|
8536
8493
|
/**
|
|
8537
8494
|
* Scroll Snap Align
|
|
@@ -8788,13 +8745,14 @@ MapControlToolbar.displayName = "MapControlToolbar";
|
|
|
8788
8745
|
// src/Components/Map/MapLibre.tsx
|
|
8789
8746
|
import { GlobeIcon as GlobeIcon2, PlusIcon as PlusIcon3, MinusIcon as MinusIcon3, LayerGroupIcon as LayerGroupIcon5 } from "@geowiki/ui";
|
|
8790
8747
|
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8791
|
-
var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData }, ref) => {
|
|
8748
|
+
var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData, show_popup, popup }, ref) => {
|
|
8792
8749
|
const mapContainer = ref;
|
|
8793
8750
|
const mapRef = useRef12(null);
|
|
8751
|
+
const [isMapReady, setIsMapReady] = useState17(false);
|
|
8752
|
+
const hasSatelliteLayer = baseLayers == null ? void 0 : baseLayers.find((layer) => layer.layer_type == "satellite");
|
|
8794
8753
|
const changeMapProjection = () => {
|
|
8795
8754
|
var _a;
|
|
8796
|
-
if (!mapRef.current)
|
|
8797
|
-
return;
|
|
8755
|
+
if (!mapRef.current) return;
|
|
8798
8756
|
const map = mapRef.current;
|
|
8799
8757
|
const currentProjection = (_a = map.getProjection()) == null ? void 0 : _a.type;
|
|
8800
8758
|
const newProjection = currentProjection === "mercator" ? "globe" : "mercator";
|
|
@@ -8803,29 +8761,30 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8803
8761
|
});
|
|
8804
8762
|
};
|
|
8805
8763
|
const zoomIn = () => {
|
|
8806
|
-
if (!mapRef.current)
|
|
8807
|
-
return;
|
|
8764
|
+
if (!mapRef.current) return;
|
|
8808
8765
|
const map = mapRef.current;
|
|
8809
8766
|
map.zoomIn();
|
|
8767
|
+
return map.getBounds();
|
|
8810
8768
|
};
|
|
8811
8769
|
const zoomOut = () => {
|
|
8812
|
-
if (!mapRef.current)
|
|
8813
|
-
return;
|
|
8770
|
+
if (!mapRef.current) return;
|
|
8814
8771
|
const map = mapRef.current;
|
|
8815
8772
|
map.zoomOut();
|
|
8773
|
+
return map.getBounds();
|
|
8816
8774
|
};
|
|
8817
|
-
function getLayersByPattern(
|
|
8818
|
-
|
|
8775
|
+
function getLayersByPattern(pattern) {
|
|
8776
|
+
if (!mapRef.current) return;
|
|
8777
|
+
const map = mapRef.current;
|
|
8778
|
+
return map == null ? void 0 : map.getStyle().layers.filter((layer) => pattern.test(layer.id)).map((layer) => layer.id);
|
|
8819
8779
|
}
|
|
8820
8780
|
const handleToggle = (layerId) => {
|
|
8821
|
-
if (!mapRef.current)
|
|
8822
|
-
return;
|
|
8781
|
+
if (!mapRef.current) return;
|
|
8823
8782
|
const map = mapRef.current;
|
|
8824
|
-
const layers = getLayersByPattern(
|
|
8825
|
-
layers.forEach((id) => {
|
|
8826
|
-
const visibility = map.getLayoutProperty(id, "visibility");
|
|
8783
|
+
const layers = getLayersByPattern(new RegExp(layerId));
|
|
8784
|
+
layers == null ? void 0 : layers.forEach((id) => {
|
|
8785
|
+
const visibility = map == null ? void 0 : map.getLayoutProperty(id, "visibility");
|
|
8827
8786
|
const newVisibility = visibility === "none" ? "visible" : "none";
|
|
8828
|
-
map.setLayoutProperty(id, "visibility", newVisibility);
|
|
8787
|
+
map == null ? void 0 : map.setLayoutProperty(id, "visibility", newVisibility);
|
|
8829
8788
|
});
|
|
8830
8789
|
};
|
|
8831
8790
|
const buildControls = (controls) => {
|
|
@@ -8848,7 +8807,11 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8848
8807
|
{
|
|
8849
8808
|
id: "zoomIn",
|
|
8850
8809
|
icon: PlusIcon3,
|
|
8851
|
-
onClick:
|
|
8810
|
+
onClick: () => {
|
|
8811
|
+
var _a;
|
|
8812
|
+
const bounds = zoomIn();
|
|
8813
|
+
(_a = c.get_bounds) == null ? void 0 : _a.call(c, bounds);
|
|
8814
|
+
},
|
|
8852
8815
|
position: "topright",
|
|
8853
8816
|
isOpen: true,
|
|
8854
8817
|
isDisplayOnly: false,
|
|
@@ -8858,7 +8821,11 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8858
8821
|
{
|
|
8859
8822
|
id: "zoomOut",
|
|
8860
8823
|
icon: MinusIcon3,
|
|
8861
|
-
onClick:
|
|
8824
|
+
onClick: () => {
|
|
8825
|
+
var _a;
|
|
8826
|
+
const bounds = zoomOut();
|
|
8827
|
+
(_a = c.get_bounds) == null ? void 0 : _a.call(c, bounds);
|
|
8828
|
+
},
|
|
8862
8829
|
position: "topright",
|
|
8863
8830
|
isOpen: true,
|
|
8864
8831
|
isDisplayOnly: false,
|
|
@@ -8887,6 +8854,7 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8887
8854
|
}
|
|
8888
8855
|
),
|
|
8889
8856
|
position: "topleft",
|
|
8857
|
+
title: "OVERLAY MAPS",
|
|
8890
8858
|
isOpen: false,
|
|
8891
8859
|
isDisplayOnly: false,
|
|
8892
8860
|
popoverDirection: "right",
|
|
@@ -8897,8 +8865,39 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8897
8865
|
}
|
|
8898
8866
|
}).flat();
|
|
8899
8867
|
};
|
|
8868
|
+
const buildBaseLayers = (baselayers) => {
|
|
8869
|
+
return baselayers.map((c) => {
|
|
8870
|
+
switch (c.layer_type) {
|
|
8871
|
+
case "satellite":
|
|
8872
|
+
return {
|
|
8873
|
+
name: "satellite",
|
|
8874
|
+
type: "raster",
|
|
8875
|
+
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2020_3857/default/g/{z}/{y}/{x}.jpg",
|
|
8876
|
+
tileSize: 256,
|
|
8877
|
+
layer_type: "satellite"
|
|
8878
|
+
};
|
|
8879
|
+
case "terrainSource":
|
|
8880
|
+
return {
|
|
8881
|
+
name: "terrainSource",
|
|
8882
|
+
type: "raster-dem",
|
|
8883
|
+
url: "https://tiles.mapterhorn.com/tilejson.json",
|
|
8884
|
+
tileSize: 256,
|
|
8885
|
+
layer_type: "terrainSource"
|
|
8886
|
+
};
|
|
8887
|
+
case "hillshade":
|
|
8888
|
+
return {
|
|
8889
|
+
name: "hillshadeSource",
|
|
8890
|
+
type: "raster-dem",
|
|
8891
|
+
url: "https://tiles.mapterhorn.com/tilejson.json",
|
|
8892
|
+
tileSize: 256,
|
|
8893
|
+
layer_type: "hillshade"
|
|
8894
|
+
};
|
|
8895
|
+
default:
|
|
8896
|
+
return null;
|
|
8897
|
+
}
|
|
8898
|
+
}).flat();
|
|
8899
|
+
};
|
|
8900
8900
|
const [mapControl, setMapControl] = useState17(() => buildControls(mapControls));
|
|
8901
|
-
console.log(mapControl);
|
|
8902
8901
|
const toggleControl = (id) => {
|
|
8903
8902
|
setMapControl((prevControls) => prevControls.map((control) => {
|
|
8904
8903
|
if (control.id === id) {
|
|
@@ -8907,82 +8906,81 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8907
8906
|
return control;
|
|
8908
8907
|
}));
|
|
8909
8908
|
};
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8927
|
-
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8938
|
-
|
|
8939
|
-
center: [16.3713, 48.2081],
|
|
8940
|
-
zoom: 3,
|
|
8941
|
-
minZoom: 1.5,
|
|
8942
|
-
renderWorldCopies: false,
|
|
8943
|
-
canvasContextAttributes: { antialias: true }
|
|
8944
|
-
});
|
|
8945
|
-
mapRef.current = map;
|
|
8946
|
-
map.scrollZoom.disable();
|
|
8947
|
-
mapRef.current.getContainer().addEventListener("mouseenter", () => map.scrollZoom.enable());
|
|
8948
|
-
mapRef.current.getContainer().addEventListener("mouseleave", () => map.scrollZoom.disable());
|
|
8949
|
-
function loadSvgImage() {
|
|
8950
|
-
return __async(this, null, function* () {
|
|
8951
|
-
let svgText = renderToStaticMarkup(
|
|
8952
|
-
/* @__PURE__ */ jsx48(MapPinIcon3, { className: "w-6 h-6" })
|
|
8953
|
-
);
|
|
8954
|
-
svgText = svgText.replace('fill="currentColor"', 'fill="#06b6d4"');
|
|
8955
|
-
const img = new Image();
|
|
8956
|
-
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgText);
|
|
8957
|
-
img.width = 35;
|
|
8958
|
-
img.height = 35;
|
|
8959
|
-
yield img.decode();
|
|
8960
|
-
return img;
|
|
8961
|
-
});
|
|
8909
|
+
const loadSvgImage = (color) => __async(null, null, function* () {
|
|
8910
|
+
let svgText = renderToStaticMarkup(
|
|
8911
|
+
/* @__PURE__ */ jsx48(MapPinIcon3, { className: "w-6 h-6" })
|
|
8912
|
+
);
|
|
8913
|
+
svgText = svgText.replace('fill="currentColor"', `fill="${color}"`);
|
|
8914
|
+
const img = new Image();
|
|
8915
|
+
img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(svgText);
|
|
8916
|
+
img.width = 35;
|
|
8917
|
+
img.height = 35;
|
|
8918
|
+
yield img.decode();
|
|
8919
|
+
return img;
|
|
8920
|
+
});
|
|
8921
|
+
const updatePinImage = (source) => __async(null, null, function* () {
|
|
8922
|
+
const map = mapRef.current;
|
|
8923
|
+
if (!map) return;
|
|
8924
|
+
const img = yield loadSvgImage(source.style.pin_color);
|
|
8925
|
+
const imgName = `${source.name}-pin`;
|
|
8926
|
+
if (map.hasImage(imgName)) map.removeImage(imgName);
|
|
8927
|
+
map.addImage(imgName, img);
|
|
8928
|
+
});
|
|
8929
|
+
const updateClusterColors = (source) => {
|
|
8930
|
+
const map = mapRef.current;
|
|
8931
|
+
if (!map) return;
|
|
8932
|
+
const layerId = `${source.name}-cluster-circles`;
|
|
8933
|
+
if (!map.getLayer(layerId)) return;
|
|
8934
|
+
const current = map.getPaintProperty(layerId, "circle-color");
|
|
8935
|
+
if (current !== source.style.cluster_color) {
|
|
8936
|
+
map.setPaintProperty(layerId, "circle-color", source.style.cluster_color);
|
|
8937
|
+
map.setPaintProperty(layerId, "circle-stroke-color", source.style.cluster_stroke_color);
|
|
8962
8938
|
}
|
|
8963
|
-
|
|
8964
|
-
|
|
8965
|
-
|
|
8966
|
-
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
|
|
8939
|
+
};
|
|
8940
|
+
const loadBaseLayers = () => {
|
|
8941
|
+
const map = mapRef.current;
|
|
8942
|
+
if (!map || !baseLayers || baseLayers.length === 0) return;
|
|
8943
|
+
const base_layers = buildBaseLayers(baseLayers);
|
|
8944
|
+
base_layers == null ? void 0 : base_layers.forEach((layer) => {
|
|
8945
|
+
if (!map.getLayer(layer.name)) {
|
|
8946
|
+
if (!map.getSource(layer == null ? void 0 : layer.name)) {
|
|
8947
|
+
if ((layer == null ? void 0 : layer.layer_type) == "satellite") {
|
|
8948
|
+
map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
|
|
8949
|
+
type: layer == null ? void 0 : layer.type,
|
|
8950
|
+
tiles: [layer == null ? void 0 : layer.url],
|
|
8951
|
+
tileSize: layer == null ? void 0 : layer.tileSize
|
|
8952
|
+
});
|
|
8953
|
+
map == null ? void 0 : map.addLayer({ id: layer == null ? void 0 : layer.name, type: layer == null ? void 0 : layer.type, source: layer == null ? void 0 : layer.name });
|
|
8954
|
+
} else
|
|
8955
|
+
map == null ? void 0 : map.addSource(layer == null ? void 0 : layer.name, {
|
|
8956
|
+
type: layer == null ? void 0 : layer.type,
|
|
8957
|
+
url: layer == null ? void 0 : layer.url,
|
|
8958
|
+
tileSize: layer == null ? void 0 : layer.tileSize
|
|
8959
|
+
});
|
|
8960
|
+
if ((layer == null ? void 0 : layer.layer_type) == "terrainSource")
|
|
8961
|
+
map == null ? void 0 : map.setTerrain({
|
|
8962
|
+
source: "terrainSource",
|
|
8963
|
+
exaggeration: 1
|
|
8964
|
+
});
|
|
8965
|
+
if ((layer == null ? void 0 : layer.layer_type) == "hillshade")
|
|
8966
|
+
map == null ? void 0 : map.addLayer({
|
|
8967
|
+
id: layer == null ? void 0 : layer.name,
|
|
8968
|
+
type: layer == null ? void 0 : layer.layer_type,
|
|
8969
|
+
source: layer == null ? void 0 : layer.name,
|
|
8970
|
+
paint: { "hillshade-shadow-color": "#473B24" },
|
|
8971
|
+
layout: { visibility: "visible" }
|
|
8972
|
+
});
|
|
8973
|
+
}
|
|
8974
|
+
}
|
|
8975
|
+
});
|
|
8976
|
+
};
|
|
8977
|
+
const loadSourceData = () => __async(null, null, function* () {
|
|
8978
|
+
var _a, _b, _c, _d;
|
|
8979
|
+
const map = mapRef.current;
|
|
8980
|
+
if (!map || (sourceData == null ? void 0 : sourceData.length) == 0) return;
|
|
8981
|
+
for (const source of sourceData) {
|
|
8982
|
+
const existing_data = map.getSource(source.name);
|
|
8983
|
+
if (!existing_data) {
|
|
8986
8984
|
if (source.is_cluster) {
|
|
8987
8985
|
map.addSource(source.name, {
|
|
8988
8986
|
type: source.type,
|
|
@@ -8991,22 +8989,26 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
8991
8989
|
clusterMaxZoom: 10,
|
|
8992
8990
|
clusterRadius: 50
|
|
8993
8991
|
});
|
|
8994
|
-
}
|
|
8992
|
+
} else
|
|
8993
|
+
map.addSource(source.name, {
|
|
8994
|
+
type: source.type,
|
|
8995
|
+
data: source.data
|
|
8996
|
+
});
|
|
8995
8997
|
if (source.show_cluster_count) {
|
|
8996
|
-
map.addLayer({
|
|
8998
|
+
map == null ? void 0 : map.addLayer({
|
|
8997
8999
|
id: `${source.name}-cluster-circles`,
|
|
8998
9000
|
type: "circle",
|
|
8999
9001
|
source: source.name,
|
|
9000
9002
|
filter: ["has", "point_count"],
|
|
9001
9003
|
paint: {
|
|
9002
|
-
"circle-color": source.style.cluster_color,
|
|
9004
|
+
"circle-color": (_a = source.style) == null ? void 0 : _a.cluster_color,
|
|
9003
9005
|
"circle-opacity": 1,
|
|
9004
9006
|
"circle-radius": 20,
|
|
9005
9007
|
"circle-stroke-width": 4,
|
|
9006
|
-
"circle-stroke-color": source.style.cluster_stroke_color
|
|
9008
|
+
"circle-stroke-color": (_b = source.style) == null ? void 0 : _b.cluster_stroke_color
|
|
9007
9009
|
}
|
|
9008
9010
|
});
|
|
9009
|
-
map.addLayer({
|
|
9011
|
+
map == null ? void 0 : map.addLayer({
|
|
9010
9012
|
id: `${source.name}-cluster-count`,
|
|
9011
9013
|
type: "symbol",
|
|
9012
9014
|
source: source.name,
|
|
@@ -9020,42 +9022,226 @@ var MapLibre = forwardRef5(({ baseLayers, customLayers, mapControls, sourceData
|
|
|
9020
9022
|
"text-color": "#f7f2f2"
|
|
9021
9023
|
}
|
|
9022
9024
|
});
|
|
9023
|
-
if (!map.hasImage(
|
|
9024
|
-
const img = yield loadSvgImage();
|
|
9025
|
-
map.addImage(
|
|
9025
|
+
if (!(map == null ? void 0 : map.hasImage(`${source.name}-pin`))) {
|
|
9026
|
+
const img = yield loadSvgImage(source.style.pin_color);
|
|
9027
|
+
map == null ? void 0 : map.addImage(`${source.name}-pin`, img);
|
|
9026
9028
|
}
|
|
9027
|
-
map.addLayer({
|
|
9028
|
-
id: source.name
|
|
9029
|
+
map == null ? void 0 : map.addLayer({
|
|
9030
|
+
id: `${source.name}-pins`,
|
|
9029
9031
|
type: "symbol",
|
|
9030
9032
|
source: source.name,
|
|
9031
9033
|
filter: ["!", ["has", "point_count"]],
|
|
9032
9034
|
layout: {
|
|
9033
|
-
"icon-image":
|
|
9035
|
+
"icon-image": `${source.name}-pin`,
|
|
9036
|
+
"icon-size": 1,
|
|
9037
|
+
"icon-allow-overlap": true,
|
|
9038
|
+
"icon-anchor": "bottom"
|
|
9039
|
+
}
|
|
9040
|
+
});
|
|
9041
|
+
} else if (source.custom_cluster) {
|
|
9042
|
+
map == null ? void 0 : map.addLayer({
|
|
9043
|
+
id: `${source.name}-cluster-circles`,
|
|
9044
|
+
type: "circle",
|
|
9045
|
+
source: source.name,
|
|
9046
|
+
filter: ["!=", ["get", "count"], null],
|
|
9047
|
+
paint: {
|
|
9048
|
+
"circle-color": (_c = source.style) == null ? void 0 : _c.cluster_color,
|
|
9049
|
+
"circle-opacity": 1,
|
|
9050
|
+
"circle-radius": 20,
|
|
9051
|
+
"circle-stroke-width": 4,
|
|
9052
|
+
"circle-stroke-color": (_d = source.style) == null ? void 0 : _d.cluster_stroke_color
|
|
9053
|
+
}
|
|
9054
|
+
});
|
|
9055
|
+
map == null ? void 0 : map.addLayer({
|
|
9056
|
+
id: `${source.name}-cluster-count`,
|
|
9057
|
+
type: "symbol",
|
|
9058
|
+
source: source.name,
|
|
9059
|
+
filter: ["!=", ["get", "count"], null],
|
|
9060
|
+
layout: {
|
|
9061
|
+
"text-field": "{count}",
|
|
9062
|
+
"text-font": ["Open Sans Bold"],
|
|
9063
|
+
"text-size": 14
|
|
9064
|
+
},
|
|
9065
|
+
paint: {
|
|
9066
|
+
"text-color": "#f7f2f2"
|
|
9067
|
+
}
|
|
9068
|
+
});
|
|
9069
|
+
if (!(map == null ? void 0 : map.hasImage(`${source.name}-pin`))) {
|
|
9070
|
+
const img = yield loadSvgImage(source.style.pin_color);
|
|
9071
|
+
map == null ? void 0 : map.addImage(`${source.name}-pin`, img);
|
|
9072
|
+
}
|
|
9073
|
+
map == null ? void 0 : map.addLayer({
|
|
9074
|
+
id: source.name + "-pins",
|
|
9075
|
+
type: "symbol",
|
|
9076
|
+
source: source.name,
|
|
9077
|
+
filter: ["==", ["get", "count"], null],
|
|
9078
|
+
layout: {
|
|
9079
|
+
"icon-image": `${source.name}-pin`,
|
|
9034
9080
|
"icon-size": 1,
|
|
9035
9081
|
"icon-allow-overlap": true,
|
|
9036
9082
|
"icon-anchor": "bottom"
|
|
9037
9083
|
}
|
|
9038
9084
|
});
|
|
9039
9085
|
}
|
|
9040
|
-
}
|
|
9086
|
+
} else {
|
|
9087
|
+
existing_data.setData(source.data);
|
|
9088
|
+
updateClusterColors(source);
|
|
9089
|
+
updatePinImage(source);
|
|
9090
|
+
}
|
|
9091
|
+
}
|
|
9092
|
+
});
|
|
9093
|
+
useEffect21(() => {
|
|
9094
|
+
if (typeof mapContainer === "function") return;
|
|
9095
|
+
if (!(mapContainer == null ? void 0 : mapContainer.current)) return;
|
|
9096
|
+
const map = new maplibregl.Map({
|
|
9097
|
+
container: mapContainer == null ? void 0 : mapContainer.current,
|
|
9098
|
+
style: {
|
|
9099
|
+
version: 8,
|
|
9100
|
+
sources: {
|
|
9101
|
+
osm: {
|
|
9102
|
+
type: "raster",
|
|
9103
|
+
tiles: ["https://a.tile.openstreetmap.org/{z}/{x}/{y}.png"],
|
|
9104
|
+
tileSize: 256,
|
|
9105
|
+
attribution: "© OpenStreetMap Contributors",
|
|
9106
|
+
maxzoom: 19
|
|
9107
|
+
}
|
|
9108
|
+
},
|
|
9109
|
+
layers: [
|
|
9110
|
+
{
|
|
9111
|
+
id: "osm",
|
|
9112
|
+
type: "raster",
|
|
9113
|
+
source: "osm"
|
|
9114
|
+
}
|
|
9115
|
+
],
|
|
9116
|
+
sky: {}
|
|
9117
|
+
},
|
|
9118
|
+
center: [16.3713, 48.2081],
|
|
9119
|
+
zoom: 3,
|
|
9120
|
+
minZoom: 1.5,
|
|
9121
|
+
renderWorldCopies: false,
|
|
9122
|
+
canvasContextAttributes: { antialias: true }
|
|
9123
|
+
});
|
|
9124
|
+
mapRef.current = map;
|
|
9125
|
+
map.scrollZoom.disable();
|
|
9126
|
+
mapRef.current.getContainer().addEventListener("mouseenter", () => map.scrollZoom.enable());
|
|
9127
|
+
mapRef.current.getContainer().addEventListener("mouseleave", () => map.scrollZoom.disable());
|
|
9128
|
+
map.on("load", () => __async(null, null, function* () {
|
|
9129
|
+
changeMapProjection();
|
|
9130
|
+
setIsMapReady(true);
|
|
9041
9131
|
}));
|
|
9042
9132
|
return () => {
|
|
9043
9133
|
map.remove();
|
|
9134
|
+
mapRef.current = null;
|
|
9135
|
+
};
|
|
9136
|
+
}, []);
|
|
9137
|
+
useEffect21(() => {
|
|
9138
|
+
const map = mapRef.current;
|
|
9139
|
+
if (!map || !isMapReady) return;
|
|
9140
|
+
const init = () => {
|
|
9141
|
+
loadBaseLayers();
|
|
9044
9142
|
};
|
|
9045
|
-
|
|
9046
|
-
|
|
9047
|
-
|
|
9048
|
-
|
|
9143
|
+
const zoom = () => {
|
|
9144
|
+
const bounds = map.getBounds();
|
|
9145
|
+
mapControls == null ? void 0 : mapControls.forEach((control) => {
|
|
9146
|
+
var _a;
|
|
9147
|
+
if (control.get_bounds)
|
|
9148
|
+
(_a = control.get_bounds) == null ? void 0 : _a.call(control, bounds);
|
|
9149
|
+
});
|
|
9150
|
+
};
|
|
9151
|
+
if (map.isStyleLoaded()) {
|
|
9152
|
+
init();
|
|
9153
|
+
map.on("zoomend", zoom);
|
|
9154
|
+
map.on("moveend", zoom);
|
|
9155
|
+
} else map.once("load", () => {
|
|
9156
|
+
init();
|
|
9157
|
+
map.on("zoomend", zoom);
|
|
9158
|
+
map.on("moveend", zoom);
|
|
9159
|
+
});
|
|
9160
|
+
return () => {
|
|
9161
|
+
map.off("zoomend", zoom);
|
|
9162
|
+
map.off("moveend", zoom);
|
|
9163
|
+
};
|
|
9164
|
+
}, [mapControls, baseLayers, isMapReady]);
|
|
9165
|
+
useEffect21(() => {
|
|
9166
|
+
var _a;
|
|
9167
|
+
const map = mapRef.current;
|
|
9168
|
+
if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
|
|
9169
|
+
const satelliteLayerLoaded = hasSatelliteLayer !== void 0 ? map.getLayer("satellite") !== void 0 ? true : false : true;
|
|
9170
|
+
map.on("sourcedata", function onData(e) {
|
|
9171
|
+
if (e.sourceId === "satellite" && e.isSourceLoaded) {
|
|
9172
|
+
map.off("sourcedata", onData);
|
|
9173
|
+
loadSourceData();
|
|
9174
|
+
}
|
|
9175
|
+
});
|
|
9176
|
+
if (map.isStyleLoaded() && satelliteLayerLoaded) {
|
|
9177
|
+
loadSourceData();
|
|
9178
|
+
} else {
|
|
9179
|
+
const handler = () => {
|
|
9180
|
+
if (satelliteLayerLoaded) loadSourceData();
|
|
9181
|
+
};
|
|
9182
|
+
map.once("load", handler);
|
|
9183
|
+
return () => {
|
|
9184
|
+
map.off("load", handler);
|
|
9185
|
+
};
|
|
9186
|
+
}
|
|
9187
|
+
if (show_popup && customLayers) {
|
|
9188
|
+
const layerId = ((_a = customLayers[0]) == null ? void 0 : _a.layerName) + "-pins";
|
|
9189
|
+
const onMouseEnter = () => {
|
|
9190
|
+
map.getCanvas().style.cursor = "pointer";
|
|
9191
|
+
};
|
|
9192
|
+
const onMouseLeave = () => {
|
|
9193
|
+
map.getCanvas().style.cursor = "";
|
|
9194
|
+
};
|
|
9195
|
+
const onLayerClick = (e) => {
|
|
9196
|
+
var _a2, _b, _c, _d;
|
|
9197
|
+
if (e.features) {
|
|
9198
|
+
const properties = (_a2 = e.features[0]) == null ? void 0 : _a2.properties;
|
|
9199
|
+
const coordinates = (_c = (_b = e.features[0]) == null ? void 0 : _b.geometry) == null ? void 0 : _c.coordinates.slice();
|
|
9200
|
+
const description = `
|
|
9201
|
+
<a class="popup-link text-primary text-xs hover:cursor-pointer">${(_d = e.features[0]) == null ? void 0 : _d.properties.description}</a>
|
|
9202
|
+
`;
|
|
9203
|
+
const popup_element = new maplibregl.Popup().setLngLat([coordinates[0], coordinates[1]]).setHTML(description).addTo(map);
|
|
9204
|
+
setTimeout(() => {
|
|
9205
|
+
const link = popup_element.getElement().querySelector(".popup-link");
|
|
9206
|
+
if (link && popup && popup.click) {
|
|
9207
|
+
link.onclick = (ev) => {
|
|
9208
|
+
ev.preventDefault();
|
|
9209
|
+
popup.click(properties);
|
|
9210
|
+
};
|
|
9211
|
+
}
|
|
9212
|
+
}, 0);
|
|
9213
|
+
}
|
|
9214
|
+
};
|
|
9215
|
+
map.on("mouseenter", layerId, onMouseEnter);
|
|
9216
|
+
map.on("mouseleave", layerId, onMouseLeave);
|
|
9217
|
+
map.on("click", layerId, onLayerClick);
|
|
9218
|
+
return () => {
|
|
9219
|
+
map.off("mouseenter", layerId, onMouseEnter);
|
|
9220
|
+
map.off("mouseleave", layerId, onMouseLeave);
|
|
9221
|
+
map.off("click", layerId, onLayerClick);
|
|
9222
|
+
};
|
|
9223
|
+
}
|
|
9224
|
+
}, [sourceData, customLayers, show_popup, popup, isMapReady]);
|
|
9225
|
+
useEffect21(() => {
|
|
9226
|
+
const map = mapRef.current;
|
|
9227
|
+
if (!map || !(sourceData == null ? void 0 : sourceData.length)) return;
|
|
9228
|
+
sourceData.forEach((source) => {
|
|
9229
|
+
const source_layer = map.getSource(source.name);
|
|
9230
|
+
if (source_layer) source_layer.setData(source.data);
|
|
9231
|
+
});
|
|
9232
|
+
}, [sourceData]);
|
|
9233
|
+
return /* @__PURE__ */ jsxs35("div", { className: "relative", style: { width: "100%", height: "100%" }, children: [
|
|
9049
9234
|
/* @__PURE__ */ jsx48("div", { ref: mapContainer, className: "w-full h-full" }),
|
|
9050
9235
|
/* @__PURE__ */ jsx48(MapControlToolbar, { controls: mapControl, onToggleControl: (id) => toggleControl(id) })
|
|
9051
9236
|
] });
|
|
9052
9237
|
});
|
|
9238
|
+
MapLibre.displayName = "MapLibre";
|
|
9053
9239
|
|
|
9054
9240
|
// src/features/components/GeoWikiMapContainer.tsx
|
|
9055
9241
|
import { Suspense, lazy, useEffect as useEffect22, useState as useState18 } from "react";
|
|
9056
9242
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
9057
9243
|
var MapComponent = lazy(
|
|
9058
|
-
() => import("./GeoWikiMap-
|
|
9244
|
+
() => import("./GeoWikiMap-OMS4RQ6H.mjs").then((m) => ({ default: m.GeoWikiMap }))
|
|
9059
9245
|
);
|
|
9060
9246
|
var ClientOnlyMap = ({ children }) => {
|
|
9061
9247
|
const [isClient, setIsClient] = useState18(false);
|