@page-speed/maps 0.1.6 → 0.1.8
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/components/geo-map.cjs +85 -26
- package/dist/components/geo-map.cjs.map +1 -1
- package/dist/components/geo-map.js +85 -26
- package/dist/components/geo-map.js.map +1 -1
- package/dist/components/index.cjs +85 -26
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +85 -26
- package/dist/components/index.js.map +1 -1
- package/dist/core/MapLibre.cjs +42 -1
- package/dist/core/MapLibre.cjs.map +1 -1
- package/dist/core/MapLibre.js +42 -1
- package/dist/core/MapLibre.js.map +1 -1
- package/dist/core/index.cjs +42 -1
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.js +42 -1
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +85 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +85 -26
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -457,11 +457,52 @@ function MapLibre({
|
|
|
457
457
|
}
|
|
458
458
|
return getMapLibreStyleUrl("osm-bright", stadiaApiKey);
|
|
459
459
|
}, [mapStyle, stadiaApiKey, styleUrl]);
|
|
460
|
+
const containerRef = React3__default.useRef(null);
|
|
461
|
+
React3__default.useEffect(() => {
|
|
462
|
+
if (!mapRef.current || !containerRef.current) return;
|
|
463
|
+
const enforceContainerHeight = () => {
|
|
464
|
+
const container = containerRef.current;
|
|
465
|
+
const map = mapRef.current;
|
|
466
|
+
if (!container || !map) return;
|
|
467
|
+
const rect = container.getBoundingClientRect();
|
|
468
|
+
const maxHeight = Math.min(rect.height, window.innerHeight);
|
|
469
|
+
const canvas = map.getCanvas();
|
|
470
|
+
if (canvas && canvas.style.height) {
|
|
471
|
+
const canvasHeight = parseInt(canvas.style.height);
|
|
472
|
+
if (canvasHeight > maxHeight || canvasHeight > 2e3) {
|
|
473
|
+
map.resize();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const interval = setInterval(enforceContainerHeight, 1e3);
|
|
478
|
+
let resizeObserver = null;
|
|
479
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
480
|
+
resizeObserver = new ResizeObserver(() => {
|
|
481
|
+
enforceContainerHeight();
|
|
482
|
+
});
|
|
483
|
+
resizeObserver.observe(containerRef.current);
|
|
484
|
+
}
|
|
485
|
+
return () => {
|
|
486
|
+
clearInterval(interval);
|
|
487
|
+
if (resizeObserver) {
|
|
488
|
+
resizeObserver.disconnect();
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}, []);
|
|
460
492
|
return /* @__PURE__ */ jsx(
|
|
461
493
|
"div",
|
|
462
494
|
{
|
|
495
|
+
ref: containerRef,
|
|
463
496
|
className: joinClassNames("relative w-full h-full", className),
|
|
464
|
-
style: {
|
|
497
|
+
style: {
|
|
498
|
+
width: "100%",
|
|
499
|
+
height: "100%",
|
|
500
|
+
maxHeight: "100vh",
|
|
501
|
+
// Prevent excessive height
|
|
502
|
+
overflow: "hidden",
|
|
503
|
+
position: "relative",
|
|
504
|
+
...style
|
|
505
|
+
},
|
|
465
506
|
children: /* @__PURE__ */ jsxs(
|
|
466
507
|
Map$1,
|
|
467
508
|
{
|
|
@@ -1275,7 +1316,7 @@ function GeoMap({
|
|
|
1275
1316
|
"div",
|
|
1276
1317
|
{
|
|
1277
1318
|
className: cn(
|
|
1278
|
-
"relative w-
|
|
1319
|
+
"relative w-80 overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-2xl",
|
|
1279
1320
|
panelClassName
|
|
1280
1321
|
),
|
|
1281
1322
|
children: [
|
|
@@ -1349,7 +1390,7 @@ function GeoMap({
|
|
|
1349
1390
|
"div",
|
|
1350
1391
|
{
|
|
1351
1392
|
className: cn(
|
|
1352
|
-
"relative w-
|
|
1393
|
+
"relative w-80 overflow-hidden rounded-xl border border-border bg-card text-card-foreground p-4 shadow-2xl",
|
|
1353
1394
|
panelClassName
|
|
1354
1395
|
),
|
|
1355
1396
|
children: [
|
|
@@ -1395,32 +1436,50 @@ function GeoMap({
|
|
|
1395
1436
|
className
|
|
1396
1437
|
),
|
|
1397
1438
|
children: [
|
|
1398
|
-
/* @__PURE__ */ jsx(
|
|
1399
|
-
|
|
1439
|
+
/* @__PURE__ */ jsx(
|
|
1440
|
+
"div",
|
|
1400
1441
|
{
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1442
|
+
className: cn(
|
|
1443
|
+
"w-full",
|
|
1444
|
+
// Default height, can be overridden by mapWrapperClassName
|
|
1445
|
+
mapWrapperClassName || "h-[520px]"
|
|
1446
|
+
),
|
|
1447
|
+
style: {
|
|
1448
|
+
// CRITICAL: Always use explicit height to prevent MapLibre canvas expansion
|
|
1449
|
+
height: mapWrapperClassName ? void 0 : "520px",
|
|
1450
|
+
maxHeight: "100vh",
|
|
1451
|
+
// Prevent excessive growth
|
|
1452
|
+
position: "relative",
|
|
1453
|
+
overflow: "hidden"
|
|
1413
1454
|
},
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1455
|
+
children: /* @__PURE__ */ jsx(
|
|
1456
|
+
MapLibre,
|
|
1457
|
+
{
|
|
1458
|
+
stadiaApiKey,
|
|
1459
|
+
mapStyle,
|
|
1460
|
+
styleUrl,
|
|
1461
|
+
mapLibreCssHref,
|
|
1462
|
+
viewState: resolvedViewState,
|
|
1463
|
+
onViewStateChange: applyViewState,
|
|
1464
|
+
markers: mapMarkers,
|
|
1465
|
+
onClick: (coord) => {
|
|
1466
|
+
onMapClick?.(coord);
|
|
1467
|
+
if (clearSelectionOnMapClick) {
|
|
1468
|
+
clearSelection();
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
onMarkerDrag,
|
|
1472
|
+
showNavigationControl,
|
|
1473
|
+
showGeolocateControl,
|
|
1474
|
+
navigationControlPosition,
|
|
1475
|
+
geolocateControlPosition,
|
|
1476
|
+
flyToOptions,
|
|
1477
|
+
className: cn("h-full w-full", mapClassName),
|
|
1478
|
+
children: mapChildren
|
|
1479
|
+
}
|
|
1480
|
+
)
|
|
1422
1481
|
}
|
|
1423
|
-
)
|
|
1482
|
+
),
|
|
1424
1483
|
selection.type !== "none" ? /* @__PURE__ */ jsx(
|
|
1425
1484
|
"div",
|
|
1426
1485
|
{
|