@classic-homes/maps-react 0.6.1 → 0.7.4
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/README.md +20 -1
- package/dist/index.cjs +123 -57
- package/dist/index.css +170 -156
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +115 -47
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MapProps, PositioningCoordinator, SourceProps, MarkerProps, PopupProps, FeatureClickEventParams, FeatureHoverEventParams, BaseLayerProps, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, MapTheme, MapStyleSpec, ControlType, ControlOffset } from '@classic-homes/maps-core';
|
|
3
3
|
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterCircleStyleOptions, ClusterExpandOptions, ClusterFeatureProperties, ClusterLayerStyles, ClusterTextStyleOptions, ControlOffset, ControlPriority, ControlType, CoordinateDisplayProps, DEFAULT_BASEMAP, ExtendedControlPosition, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PRIMARY_BASEMAPS, PopupProps, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, UnclusteredPointStyleOptions, ValidationResult, WATERSHEDS, ZIndexLayer, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createClusterCirclePaint, createClusterStyles, createClusterTextLayout, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
|
|
4
|
-
import
|
|
4
|
+
import * as maplibregl from 'maplibre-gl';
|
|
5
|
+
import { Map as Map$1, StyleSpecification } from 'maplibre-gl';
|
|
5
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
7
|
import { VariantProps } from 'class-variance-authority';
|
|
7
8
|
import { ClassValue } from 'clsx';
|
|
@@ -370,7 +371,7 @@ interface CustomControlProps {
|
|
|
370
371
|
* ```tsx
|
|
371
372
|
* <Map>
|
|
372
373
|
* <CustomControl position="top-right">
|
|
373
|
-
* <div className="bg-
|
|
374
|
+
* <div className="bg-card p-2 rounded shadow">
|
|
374
375
|
* Custom widget content
|
|
375
376
|
* </div>
|
|
376
377
|
* </CustomControl>
|
|
@@ -415,7 +416,11 @@ interface DeckOverlayProps {
|
|
|
415
416
|
isHovering: boolean;
|
|
416
417
|
isDragging: boolean;
|
|
417
418
|
}) => string;
|
|
418
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* Whether to enable interleaved rendering (default: true). Ignored on
|
|
421
|
+
* MapLibre 6, which deck.gl cannot interleave into yet: the overlay is
|
|
422
|
+
* drawn on its own canvas above the map instead.
|
|
423
|
+
*/
|
|
419
424
|
interleaved?: boolean;
|
|
420
425
|
/** Deck.gl effects */
|
|
421
426
|
effects?: unknown[];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MapProps, PositioningCoordinator, SourceProps, MarkerProps, PopupProps, FeatureClickEventParams, FeatureHoverEventParams, BaseLayerProps, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, LegendProps, LegendGroupProps, CoordinateDisplayProps, BasemapSwitcherProps, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, MapTheme, MapStyleSpec, ControlType, ControlOffset } from '@classic-homes/maps-core';
|
|
3
3
|
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, BaseMapProps, BasemapApiKeys, BasemapCategory, BasemapDefinition, BasemapProvider, BasemapSwitcherProps, BoundsArray, CATEGORY_META, CITY_LIMITS, CircleLayerProps, ClusterCircleStyleOptions, ClusterExpandOptions, ClusterFeatureProperties, ClusterLayerStyles, ClusterTextStyleOptions, ControlOffset, ControlPriority, ControlType, CoordinateDisplayProps, DEFAULT_BASEMAP, ExtendedControlPosition, FLOOD_ZONES, FREE_BASEMAPS, FeatureClickEventParams, FeatureHoverEventParams, FillExtrusionLayerProps, FillLayerProps, GeoJSONFeature, GeoJSONFeatureCollection, GradientStop, HeatmapLayerProps, LayerManagerProps, LegendConfig, LegendGroupProps, LegendItem, LegendProps, LineLayerProps, LngLat, LoadGeoJSONOptions, LoadGeoJSONResult, MapBounds, MapClickEventParams, MapHoverEventParams, MapMoveEventParams, MapProps, MapViewport, MarkerClickEventParams, MarkerData, MarkerDragEventParams, MarkerProps, OSM_STANDARD, OverlayApiKeys, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, PARKS, PRIMARY_BASEMAPS, PopupProps, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, SourceProps, SymbolLayerProps, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, UnclusteredPointStyleOptions, ValidationResult, WATERSHEDS, ZIndexLayer, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createClusterCirclePaint, createClusterStyles, createClusterTextLayout, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
|
|
4
|
-
import
|
|
4
|
+
import * as maplibregl from 'maplibre-gl';
|
|
5
|
+
import { Map as Map$1, StyleSpecification } from 'maplibre-gl';
|
|
5
6
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
7
|
import { VariantProps } from 'class-variance-authority';
|
|
7
8
|
import { ClassValue } from 'clsx';
|
|
@@ -370,7 +371,7 @@ interface CustomControlProps {
|
|
|
370
371
|
* ```tsx
|
|
371
372
|
* <Map>
|
|
372
373
|
* <CustomControl position="top-right">
|
|
373
|
-
* <div className="bg-
|
|
374
|
+
* <div className="bg-card p-2 rounded shadow">
|
|
374
375
|
* Custom widget content
|
|
375
376
|
* </div>
|
|
376
377
|
* </CustomControl>
|
|
@@ -415,7 +416,11 @@ interface DeckOverlayProps {
|
|
|
415
416
|
isHovering: boolean;
|
|
416
417
|
isDragging: boolean;
|
|
417
418
|
}) => string;
|
|
418
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* Whether to enable interleaved rendering (default: true). Ignored on
|
|
421
|
+
* MapLibre 6, which deck.gl cannot interleave into yet: the overlay is
|
|
422
|
+
* drawn on its own canvas above the map instead.
|
|
423
|
+
*/
|
|
419
424
|
interleaved?: boolean;
|
|
420
425
|
/** Deck.gl effects */
|
|
421
426
|
effects?: unknown[];
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import { useState, useEffect, useCallback } from 'react';
|
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
6
|
-
import maplibregl from 'maplibre-gl';
|
|
6
|
+
import * as maplibregl from 'maplibre-gl';
|
|
7
7
|
import 'maplibre-gl/dist/maplibre-gl.css';
|
|
8
8
|
import '@classic-homes/maps-core/styles/controls.css';
|
|
9
9
|
import '@classic-homes/maps-core/styles/marker.css';
|
|
10
|
-
import { createPositioningCoordinator, generateMapDescription, applyMarkerProtection, applyMarkerChildProtection, removeMarkerProtection, DEFAULT_BASEMAP, darkTheme, lightTheme, THEME_DARK, THEME_LIGHT, calculateBounds, getChangedPaintProps, EDGE_MARGIN, formatCoordinates, getAvailableBasemaps, FREE_BASEMAPS, resolveBasemapThumbnail, createInitialLayerStates, getLayerCategories, searchLayers, groupLayersByCategory, toggleLayerVisibility, setLayerOpacity, getLayerStatesArray, reorderLayers, CATEGORY_META, resolveBasemapStyle, getGridNavigationIndex, STACK_GAP, getLayerStyleForTheme, resolveLayerSourceUrl } from '@classic-homes/maps-core';
|
|
10
|
+
import { createPositioningCoordinator, generateMapDescription, warnIfWorkerUrlMissing, markerColor, applyMarkerProtection, applyMarkerChildProtection, removeMarkerProtection, DEFAULT_BASEMAP, darkTheme, lightTheme, THEME_DARK, THEME_LIGHT, calculateBounds, getChangedPaintProps, EDGE_MARGIN, formatCoordinates, getAvailableBasemaps, FREE_BASEMAPS, resolveBasemapThumbnail, createInitialLayerStates, getLayerCategories, searchLayers, groupLayersByCategory, toggleLayerVisibility, setLayerOpacity, getLayerStatesArray, reorderLayers, CATEGORY_META, resolveBasemapStyle, getGridNavigationIndex, STACK_GAP, resolveDeckInterleaved, getLayerStyleForTheme, resolveLayerSourceUrl, getOutlineStyleForTheme, OUTLINE_LAYER_SUFFIX } from '@classic-homes/maps-core';
|
|
11
11
|
export { BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, DEFAULT_BASEMAP, FLOOD_ZONES, FREE_BASEMAPS, OSM_STANDARD, PARKS, PRIMARY_BASEMAPS, SATELLITE_BASEMAP, SCHOOL_DISTRICTS, SPORTS_FACILITIES, THEME_DARK, THEME_LIGHT, TOPO_BASEMAP, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, calculateBounds, calculateCentroid, combineBounds, countFeaturesByType, createClusterCirclePaint, createClusterStyles, createClusterTextLayout, createHoverExpression, createInitialLayerStates, createSelectionExpression, darkBasicStyle, darkTheme, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, formatArea, formatCoordinates, formatDistance, generateMapDescription, getAvailableBasemaps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStyleForTheme, getLayersByCategory, getSelectionStyle, groupLayersByCategory, isClusterFeature, isValidBounds, lightBasicStyle, lightTheme, loadGeoJSON, resolveBasemapStyle, resolveLayerSourceUrl, searchLayers, setLayerOpacity, toggleLayerVisibility, validateGeoJSON } from '@classic-homes/maps-core';
|
|
12
12
|
import * as ReactDOM from 'react-dom';
|
|
13
13
|
import { panToFitPopup, normalizePadding } from '@classic-homes/maps-core/utils';
|
|
@@ -82,7 +82,7 @@ var MapError = React6.forwardRef(
|
|
|
82
82
|
{
|
|
83
83
|
ref,
|
|
84
84
|
className: cn(
|
|
85
|
-
"flex flex-col items-center justify-center rounded-lg border border-destructive
|
|
85
|
+
"flex flex-col items-center justify-center rounded-lg border border-destructive bg-background",
|
|
86
86
|
className
|
|
87
87
|
),
|
|
88
88
|
style: { height: heightStyle },
|
|
@@ -120,7 +120,7 @@ var MapError = React6.forwardRef(
|
|
|
120
120
|
"button",
|
|
121
121
|
{
|
|
122
122
|
onClick: onRetry,
|
|
123
|
-
className: "mt-2 rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm hover:bg-
|
|
123
|
+
className: "mt-2 rounded-md border border-input bg-background px-4 py-2 text-sm font-medium shadow-sm hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
124
124
|
children: "Retry"
|
|
125
125
|
}
|
|
126
126
|
)
|
|
@@ -138,7 +138,7 @@ var MapEmpty = React6.forwardRef(
|
|
|
138
138
|
{
|
|
139
139
|
ref,
|
|
140
140
|
className: cn(
|
|
141
|
-
"flex flex-col items-center justify-center rounded-lg border border-border bg-muted
|
|
141
|
+
"flex flex-col items-center justify-center rounded-lg border border-border bg-muted",
|
|
142
142
|
className
|
|
143
143
|
),
|
|
144
144
|
style: { height: heightStyle },
|
|
@@ -295,7 +295,7 @@ function getStyleKey(style) {
|
|
|
295
295
|
if (!style) return "";
|
|
296
296
|
return typeof style === "string" ? style : JSON.stringify(style);
|
|
297
297
|
}
|
|
298
|
-
var
|
|
298
|
+
var Map3 = React6.forwardRef(
|
|
299
299
|
({
|
|
300
300
|
// Base props
|
|
301
301
|
title,
|
|
@@ -425,6 +425,7 @@ var Map2 = React6.forwardRef(
|
|
|
425
425
|
React6.useEffect(() => {
|
|
426
426
|
if (!containerRef.current || mapRef.current) return;
|
|
427
427
|
try {
|
|
428
|
+
warnIfWorkerUrlMissing(maplibregl);
|
|
428
429
|
const map = new maplibregl.Map({
|
|
429
430
|
container: containerRef.current,
|
|
430
431
|
style: mapStyle,
|
|
@@ -734,7 +735,7 @@ var Map2 = React6.forwardRef(
|
|
|
734
735
|
);
|
|
735
736
|
}
|
|
736
737
|
);
|
|
737
|
-
|
|
738
|
+
Map3.displayName = "Map";
|
|
738
739
|
function createSourceRegistry() {
|
|
739
740
|
const versions = /* @__PURE__ */ new Map();
|
|
740
741
|
const stacking = /* @__PURE__ */ new Map();
|
|
@@ -1052,11 +1053,12 @@ var Source = ({
|
|
|
1052
1053
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
1053
1054
|
};
|
|
1054
1055
|
Source.displayName = "Source";
|
|
1055
|
-
var
|
|
1056
|
+
var Marker2 = React6.forwardRef(
|
|
1056
1057
|
({
|
|
1057
1058
|
id,
|
|
1058
1059
|
coordinates,
|
|
1059
|
-
|
|
1060
|
+
// Heritage Teal, as in Svelte (MapLibre's own default is a light blue)
|
|
1061
|
+
color = markerColor,
|
|
1060
1062
|
anchor = "bottom",
|
|
1061
1063
|
offset,
|
|
1062
1064
|
rotation,
|
|
@@ -1264,7 +1266,7 @@ var Marker = React6.forwardRef(
|
|
|
1264
1266
|
return null;
|
|
1265
1267
|
}
|
|
1266
1268
|
);
|
|
1267
|
-
|
|
1269
|
+
Marker2.displayName = "Marker";
|
|
1268
1270
|
function useStructuralValue(next) {
|
|
1269
1271
|
const ref = React6.useRef(next);
|
|
1270
1272
|
if (ref.current !== next && JSON.stringify(ref.current) !== JSON.stringify(next)) {
|
|
@@ -1272,7 +1274,7 @@ function useStructuralValue(next) {
|
|
|
1272
1274
|
}
|
|
1273
1275
|
return ref.current;
|
|
1274
1276
|
}
|
|
1275
|
-
var
|
|
1277
|
+
var Popup2 = React6.forwardRef(
|
|
1276
1278
|
({
|
|
1277
1279
|
coordinates: coordinatesProp,
|
|
1278
1280
|
closeButton = true,
|
|
@@ -1395,7 +1397,7 @@ var Popup = React6.forwardRef(
|
|
|
1395
1397
|
);
|
|
1396
1398
|
}
|
|
1397
1399
|
);
|
|
1398
|
-
|
|
1400
|
+
Popup2.displayName = "Popup";
|
|
1399
1401
|
var PopupCard = React6.forwardRef(
|
|
1400
1402
|
({ className, children, ...props }, ref) => {
|
|
1401
1403
|
return /* @__PURE__ */ jsx("div", { ref, className: cn("bg-popover text-popover-foreground", className), ...props, children });
|
|
@@ -1423,7 +1425,7 @@ var PopupHeader = React6.forwardRef(
|
|
|
1423
1425
|
{
|
|
1424
1426
|
ref,
|
|
1425
1427
|
className: cn(
|
|
1426
|
-
"flex items-start justify-between gap-2 border-b border-
|
|
1428
|
+
"flex items-start justify-between gap-2 border-b border-border bg-muted px-4 py-3 pr-12",
|
|
1427
1429
|
className
|
|
1428
1430
|
),
|
|
1429
1431
|
...props,
|
|
@@ -1449,7 +1451,7 @@ var PopupFooter = React6.forwardRef(
|
|
|
1449
1451
|
{
|
|
1450
1452
|
ref,
|
|
1451
1453
|
className: cn(
|
|
1452
|
-
"flex justify-end gap-2 border-t border-
|
|
1454
|
+
"flex justify-end gap-2 border-t border-border bg-muted px-4 py-3",
|
|
1453
1455
|
className
|
|
1454
1456
|
),
|
|
1455
1457
|
...props,
|
|
@@ -2378,7 +2380,7 @@ var Legend = ({
|
|
|
2378
2380
|
{
|
|
2379
2381
|
ref: legendRef,
|
|
2380
2382
|
className: cn(
|
|
2381
|
-
"absolute bg-card rounded-lg shadow-lg border border-
|
|
2383
|
+
"absolute bg-card rounded-lg shadow-lg border border-border",
|
|
2382
2384
|
"text-sm min-w-[140px]",
|
|
2383
2385
|
!visible && "invisible",
|
|
2384
2386
|
className
|
|
@@ -2428,8 +2430,7 @@ var Legend = ({
|
|
|
2428
2430
|
className: cn(
|
|
2429
2431
|
"flex items-center gap-2 w-full text-left rounded px-1 -mx-1",
|
|
2430
2432
|
onItemClick && "hover:bg-muted cursor-pointer",
|
|
2431
|
-
!onItemClick && "cursor-default"
|
|
2432
|
-
item.active === false && "opacity-50"
|
|
2433
|
+
!onItemClick && "cursor-default"
|
|
2433
2434
|
),
|
|
2434
2435
|
onClick: () => handleItemClick(item, index),
|
|
2435
2436
|
disabled: !onItemClick,
|
|
@@ -2437,11 +2438,21 @@ var Legend = ({
|
|
|
2437
2438
|
/* @__PURE__ */ jsx(
|
|
2438
2439
|
"span",
|
|
2439
2440
|
{
|
|
2440
|
-
className: "w-4 h-4 rounded flex-shrink-0",
|
|
2441
|
-
style: {
|
|
2441
|
+
className: "w-4 h-4 rounded flex-shrink-0 border border-foreground",
|
|
2442
|
+
style: {
|
|
2443
|
+
backgroundColor: item.active === false ? "transparent" : item.color
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
),
|
|
2447
|
+
/* @__PURE__ */ jsx(
|
|
2448
|
+
"span",
|
|
2449
|
+
{
|
|
2450
|
+
className: cn(
|
|
2451
|
+
item.active === false ? "text-muted-foreground line-through" : "text-foreground"
|
|
2452
|
+
),
|
|
2453
|
+
children: item.label
|
|
2442
2454
|
}
|
|
2443
2455
|
),
|
|
2444
|
-
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: item.label }),
|
|
2445
2456
|
item.value !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: item.value })
|
|
2446
2457
|
]
|
|
2447
2458
|
}
|
|
@@ -2507,7 +2518,7 @@ var LegendGroup = ({
|
|
|
2507
2518
|
{
|
|
2508
2519
|
ref: containerRef,
|
|
2509
2520
|
className: cn(
|
|
2510
|
-
"absolute bg-card rounded-lg shadow-lg border border-
|
|
2521
|
+
"absolute bg-card rounded-lg shadow-lg border border-border",
|
|
2511
2522
|
"text-sm min-w-[160px] max-w-[280px]",
|
|
2512
2523
|
!visible && "invisible",
|
|
2513
2524
|
className
|
|
@@ -2572,8 +2583,7 @@ var LegendGroup = ({
|
|
|
2572
2583
|
className: cn(
|
|
2573
2584
|
"flex items-center gap-2 w-full text-left rounded px-1 -mx-1",
|
|
2574
2585
|
legend.onItemClick && "hover:bg-muted cursor-pointer",
|
|
2575
|
-
!legend.onItemClick && "cursor-default"
|
|
2576
|
-
item.active === false && "opacity-50"
|
|
2586
|
+
!legend.onItemClick && "cursor-default"
|
|
2577
2587
|
),
|
|
2578
2588
|
onClick: () => handleItemClick(legend, item, index),
|
|
2579
2589
|
disabled: !legend.onItemClick,
|
|
@@ -2581,11 +2591,22 @@ var LegendGroup = ({
|
|
|
2581
2591
|
/* @__PURE__ */ jsx(
|
|
2582
2592
|
"span",
|
|
2583
2593
|
{
|
|
2584
|
-
className: "w-4 h-4 rounded flex-shrink-0",
|
|
2585
|
-
style: {
|
|
2594
|
+
className: "w-4 h-4 rounded flex-shrink-0 border border-foreground",
|
|
2595
|
+
style: {
|
|
2596
|
+
backgroundColor: item.active === false ? "transparent" : item.color
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
),
|
|
2600
|
+
/* @__PURE__ */ jsx(
|
|
2601
|
+
"span",
|
|
2602
|
+
{
|
|
2603
|
+
className: cn(
|
|
2604
|
+
"truncate flex-1",
|
|
2605
|
+
item.active === false ? "text-muted-foreground line-through" : "text-foreground"
|
|
2606
|
+
),
|
|
2607
|
+
children: item.label
|
|
2586
2608
|
}
|
|
2587
2609
|
),
|
|
2588
|
-
/* @__PURE__ */ jsx("span", { className: "text-foreground truncate flex-1", children: item.label }),
|
|
2589
2610
|
item.value !== void 0 && /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: item.value })
|
|
2590
2611
|
]
|
|
2591
2612
|
}
|
|
@@ -2697,14 +2718,14 @@ var CoordinateDisplay = ({
|
|
|
2697
2718
|
className: cn(
|
|
2698
2719
|
"absolute bg-card rounded px-2 py-1",
|
|
2699
2720
|
"text-xs font-mono text-muted-foreground",
|
|
2700
|
-
"border border-
|
|
2721
|
+
"border border-border shadow-sm",
|
|
2701
2722
|
"flex items-center gap-3",
|
|
2702
2723
|
!visible && "invisible",
|
|
2703
2724
|
className
|
|
2704
2725
|
),
|
|
2705
2726
|
style: adjustedStyle,
|
|
2706
2727
|
children: [
|
|
2707
|
-
cursorLngLat ? /* @__PURE__ */ jsx("span", { title: "Cursor coordinates", children: formatCoord(cursorLngLat) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground
|
|
2728
|
+
cursorLngLat ? /* @__PURE__ */ jsx("span", { title: "Cursor coordinates", children: formatCoord(cursorLngLat) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Move cursor over map" }),
|
|
2708
2729
|
showZoom && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2709
2730
|
/* @__PURE__ */ jsx("span", { className: "text-border", children: "|" }),
|
|
2710
2731
|
/* @__PURE__ */ jsxs("span", { title: "Zoom level", children: [
|
|
@@ -2838,7 +2859,7 @@ var BasemapSwitcher = ({
|
|
|
2838
2859
|
ref: panelRef,
|
|
2839
2860
|
className: cn(
|
|
2840
2861
|
"absolute classic-basemap-panel-enter",
|
|
2841
|
-
"bg-card rounded-lg shadow-lg border border-
|
|
2862
|
+
"bg-card rounded-lg shadow-lg border border-border",
|
|
2842
2863
|
"p-2",
|
|
2843
2864
|
isTop ? "top-full mt-1" : "bottom-full mb-1",
|
|
2844
2865
|
position.includes("right") ? "right-0" : "left-0"
|
|
@@ -2871,8 +2892,9 @@ var BasemapSwitcher = ({
|
|
|
2871
2892
|
tabIndex: index === tabStopIndex ? 0 : -1,
|
|
2872
2893
|
className: cn(
|
|
2873
2894
|
"flex flex-col items-center gap-1 p-1 rounded cursor-pointer",
|
|
2874
|
-
|
|
2875
|
-
|
|
2895
|
+
// Selected: Linen, a check and a bold label. The ring is the focus
|
|
2896
|
+
// indicator only, so arrowing onto an option never looks selected
|
|
2897
|
+
isActive ? "bg-accent" : "hover:bg-muted"
|
|
2876
2898
|
),
|
|
2877
2899
|
onFocus: () => setTabStopIndex(index),
|
|
2878
2900
|
onClick: () => handleSelect(basemap),
|
|
@@ -2891,7 +2913,34 @@ var BasemapSwitcher = ({
|
|
|
2891
2913
|
}
|
|
2892
2914
|
}
|
|
2893
2915
|
),
|
|
2894
|
-
/* @__PURE__ */
|
|
2916
|
+
/* @__PURE__ */ jsxs(
|
|
2917
|
+
"span",
|
|
2918
|
+
{
|
|
2919
|
+
className: cn(
|
|
2920
|
+
"text-[10px] text-foreground truncate w-full text-center leading-tight",
|
|
2921
|
+
isActive && "font-semibold"
|
|
2922
|
+
),
|
|
2923
|
+
children: [
|
|
2924
|
+
isActive && /* @__PURE__ */ jsx(
|
|
2925
|
+
"svg",
|
|
2926
|
+
{
|
|
2927
|
+
"aria-hidden": "true",
|
|
2928
|
+
width: "10",
|
|
2929
|
+
height: "10",
|
|
2930
|
+
viewBox: "0 0 24 24",
|
|
2931
|
+
fill: "none",
|
|
2932
|
+
stroke: "currentColor",
|
|
2933
|
+
strokeWidth: "3",
|
|
2934
|
+
strokeLinecap: "round",
|
|
2935
|
+
strokeLinejoin: "round",
|
|
2936
|
+
style: { display: "inline", verticalAlign: "-1px", marginRight: 2 },
|
|
2937
|
+
children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" })
|
|
2938
|
+
}
|
|
2939
|
+
),
|
|
2940
|
+
basemap.label ?? basemap.name
|
|
2941
|
+
]
|
|
2942
|
+
}
|
|
2943
|
+
)
|
|
2895
2944
|
]
|
|
2896
2945
|
},
|
|
2897
2946
|
basemap.id
|
|
@@ -2908,7 +2957,7 @@ var BasemapSwitcher = ({
|
|
|
2908
2957
|
type: "button",
|
|
2909
2958
|
className: cn(
|
|
2910
2959
|
"w-[40px] h-[40px] flex items-center justify-center",
|
|
2911
|
-
"bg-card rounded shadow-lg border border-
|
|
2960
|
+
"bg-card rounded shadow-lg border border-border",
|
|
2912
2961
|
"hover:bg-muted cursor-pointer",
|
|
2913
2962
|
"text-foreground"
|
|
2914
2963
|
),
|
|
@@ -3173,17 +3222,32 @@ var LayerManager = ({
|
|
|
3173
3222
|
icon: paint["icon-opacity"] ?? 1
|
|
3174
3223
|
};
|
|
3175
3224
|
switch (layer.style.renderType) {
|
|
3176
|
-
case "fill":
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3225
|
+
case "fill": {
|
|
3226
|
+
const outline = getOutlineStyleForTheme(layer, theme);
|
|
3227
|
+
layerComponent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3228
|
+
/* @__PURE__ */ jsx(
|
|
3229
|
+
FillLayer,
|
|
3230
|
+
{
|
|
3231
|
+
...layerProps,
|
|
3232
|
+
fillColor: paint["fill-color"],
|
|
3233
|
+
fillOpacity: baseOpacity.fill * state.opacity,
|
|
3234
|
+
fillOutlineColor: paint["fill-outline-color"]
|
|
3235
|
+
}
|
|
3236
|
+
),
|
|
3237
|
+
outline && /* @__PURE__ */ jsx(
|
|
3238
|
+
LineLayer,
|
|
3239
|
+
{
|
|
3240
|
+
...layerProps,
|
|
3241
|
+
id: `${layerProps.id}${OUTLINE_LAYER_SUFFIX}`,
|
|
3242
|
+
lineColor: outline["line-color"],
|
|
3243
|
+
lineWidth: outline["line-width"],
|
|
3244
|
+
lineOpacity: (outline["line-opacity"] ?? 1) * state.opacity,
|
|
3245
|
+
lineDasharray: outline["line-dasharray"]
|
|
3246
|
+
}
|
|
3247
|
+
)
|
|
3248
|
+
] });
|
|
3186
3249
|
break;
|
|
3250
|
+
}
|
|
3187
3251
|
case "line":
|
|
3188
3252
|
layerComponent = /* @__PURE__ */ jsx(
|
|
3189
3253
|
LineLayer,
|
|
@@ -3380,7 +3444,7 @@ var LayerManager = ({
|
|
|
3380
3444
|
{
|
|
3381
3445
|
className: cn(
|
|
3382
3446
|
"absolute classic-layer-panel-enter",
|
|
3383
|
-
"bg-card rounded-lg shadow-lg border border-
|
|
3447
|
+
"bg-card rounded-lg shadow-lg border border-border",
|
|
3384
3448
|
"w-64",
|
|
3385
3449
|
isTop ? "top-full mt-1" : "bottom-full mb-1",
|
|
3386
3450
|
position.includes("right") ? "right-0" : "left-0"
|
|
@@ -3427,6 +3491,7 @@ var LayerManager = ({
|
|
|
3427
3491
|
type: "button",
|
|
3428
3492
|
className: "classic-layer-tab",
|
|
3429
3493
|
"data-active": activeCategory === "all",
|
|
3494
|
+
"aria-pressed": activeCategory === "all",
|
|
3430
3495
|
onClick: () => setActiveCategory("all"),
|
|
3431
3496
|
children: "All"
|
|
3432
3497
|
}
|
|
@@ -3437,6 +3502,7 @@ var LayerManager = ({
|
|
|
3437
3502
|
type: "button",
|
|
3438
3503
|
className: "classic-layer-tab",
|
|
3439
3504
|
"data-active": activeCategory === cat,
|
|
3505
|
+
"aria-pressed": activeCategory === cat,
|
|
3440
3506
|
onClick: () => setActiveCategory(cat),
|
|
3441
3507
|
children: CATEGORY_META[cat].label
|
|
3442
3508
|
},
|
|
@@ -3475,7 +3541,7 @@ var LayerManager = ({
|
|
|
3475
3541
|
type: "button",
|
|
3476
3542
|
className: cn(
|
|
3477
3543
|
"w-[40px] h-[40px] flex items-center justify-center",
|
|
3478
|
-
"bg-card rounded shadow-lg border border-
|
|
3544
|
+
"bg-card rounded shadow-lg border border-border",
|
|
3479
3545
|
"hover:bg-muted cursor-pointer",
|
|
3480
3546
|
"text-foreground"
|
|
3481
3547
|
),
|
|
@@ -3569,7 +3635,9 @@ var DeckOverlay = ({
|
|
|
3569
3635
|
const MapboxOverlay = deckMapbox.MapboxOverlay;
|
|
3570
3636
|
MapboxOverlayRef.current = MapboxOverlay;
|
|
3571
3637
|
const overlay = new MapboxOverlay({
|
|
3572
|
-
|
|
3638
|
+
// deck.gl reads map.transform, which MapLibre 6 no longer has: every
|
|
3639
|
+
// interleaved frame would throw, so fall back to overlaid rendering
|
|
3640
|
+
interleaved: resolveDeckInterleaved(map, interleaved),
|
|
3573
3641
|
layers: layersRef.current,
|
|
3574
3642
|
onHover,
|
|
3575
3643
|
onClick,
|
|
@@ -3622,4 +3690,4 @@ var DeckOverlay = ({
|
|
|
3622
3690
|
};
|
|
3623
3691
|
DeckOverlay.displayName = "DeckOverlay";
|
|
3624
3692
|
|
|
3625
|
-
export { BasemapSwitcher, CircleLayer, CoordinateDisplay, CustomControl, DeckOverlay, FillExtrusionLayer, FillLayer, HeatmapLayer, LayerManager, Legend, LegendGroup, LineLayer,
|
|
3693
|
+
export { BasemapSwitcher, CircleLayer, CoordinateDisplay, CustomControl, DeckOverlay, FillExtrusionLayer, FillLayer, HeatmapLayer, LayerManager, Legend, LegendGroup, LineLayer, Map3 as Map, MapContainer, MapContext, MapEmpty, MapError, MapSkeleton, Marker2 as Marker, Popup2 as Popup, PopupCard, PopupContent, PopupFooter, PopupHeader, Source, SymbolLayer, cn, useControlPosition, useCustomControl, useLayer, useMap, useMapInstance, useMapTheme, useReducedMotion };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/maps-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "React MapLibre components for Classic Theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maps",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"test": "vitest run"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@classic-homes/maps-core": "
|
|
49
|
+
"@classic-homes/maps-core": "^0.7.4",
|
|
50
50
|
"@classic-homes/theme-react": "*",
|
|
51
51
|
"class-variance-authority": "^0.7.0",
|
|
52
52
|
"clsx": "^2.1.0",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@deck.gl/core": "^9.0.0",
|
|
57
57
|
"@deck.gl/layers": "^9.0.0",
|
|
58
58
|
"@deck.gl/mapbox": "^9.0.0",
|
|
59
|
-
"maplibre-gl": "^
|
|
59
|
+
"maplibre-gl": "^5.0.0 || ^6.11.0",
|
|
60
60
|
"react": "^18.0.0 || ^19.0.0",
|
|
61
61
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
62
62
|
},
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@types/react": "^18.2.0",
|
|
79
79
|
"@types/react-dom": "^18.2.0",
|
|
80
80
|
"jsdom": "^28.1.0",
|
|
81
|
-
"maplibre-gl": "^
|
|
81
|
+
"maplibre-gl": "^6.14.0",
|
|
82
82
|
"react": "^18.2.0",
|
|
83
83
|
"react-dom": "^18.2.0",
|
|
84
84
|
"tsup": "^8.0.0",
|