@classic-homes/maps-svelte 0.5.1 → 0.5.2
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/lib/components/controls/LayerManager.svelte +36 -3
- package/dist/lib/components/core/Map.svelte +11 -0
- package/dist/lib/components/core/Marker.svelte +31 -31
- package/dist/lib/components/core/Source.svelte +22 -0
- package/dist/lib/components/deck/DeckOverlay.svelte +10 -2
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/components/index.js +1 -1
- package/dist/lib/components/layers/index.d.ts +2 -1
- package/dist/lib/components/layers/index.js +1 -0
- package/dist/lib/components/layers/useLayer.svelte.js +48 -0
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.js +1 -1
- package/package.json +4 -2
|
@@ -219,17 +219,26 @@
|
|
|
219
219
|
lastKnownStyleVersion = sv;
|
|
220
220
|
addedSources.clear();
|
|
221
221
|
addedLayers.clear();
|
|
222
|
+
layerThemes.clear();
|
|
222
223
|
}
|
|
223
224
|
});
|
|
224
225
|
|
|
225
226
|
// Track pending map update
|
|
226
227
|
let mapUpdateTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
228
|
+
// Theme each added layer's paint was last applied for
|
|
229
|
+
const layerThemes = new Map<string, 'light' | 'dark'>();
|
|
227
230
|
|
|
228
231
|
// Manage sources and layers on the map
|
|
229
232
|
// Use setTimeout to debounce updates and break reactive chains
|
|
230
233
|
$effect(() => {
|
|
231
234
|
// Read visibleLayerStates to establish dependency
|
|
232
235
|
const states = visibleLayerStates;
|
|
236
|
+
// Also re-sync after a style reload (setStyle drops our sources/layers),
|
|
237
|
+
// once the map loads, and when the theme changes. These must be read here,
|
|
238
|
+
// synchronously: reads inside the setTimeout below are not tracked.
|
|
239
|
+
void mapContext.styleVersion;
|
|
240
|
+
void mapContext.loaded;
|
|
241
|
+
const theme = isDark ? 'dark' : 'light';
|
|
233
242
|
|
|
234
243
|
// Cancel any pending update
|
|
235
244
|
if (mapUpdateTimeout) {
|
|
@@ -244,7 +253,6 @@
|
|
|
244
253
|
const { map, loaded } = mapContext;
|
|
245
254
|
if (!map || !loaded) return;
|
|
246
255
|
|
|
247
|
-
const theme = isDark ? 'dark' : 'light';
|
|
248
256
|
const currentVisibleIds = new Set(states.map((s) => s.id));
|
|
249
257
|
|
|
250
258
|
// Add/update visible layers
|
|
@@ -318,11 +326,24 @@
|
|
|
318
326
|
|
|
319
327
|
map.addLayer(layerConfig);
|
|
320
328
|
addedLayers.add(layerId);
|
|
329
|
+
layerThemes.set(layerId, theme);
|
|
321
330
|
} catch (err) {
|
|
322
331
|
console.error(`[maps-svelte] LayerManager: Failed to add layer "${layerId}":`, err);
|
|
323
332
|
}
|
|
324
333
|
}
|
|
325
334
|
|
|
335
|
+
// Restyle an existing layer when the theme changed since it was styled
|
|
336
|
+
if (map.getLayer(layerId) && layerThemes.get(layerId) !== theme) {
|
|
337
|
+
for (const [prop, value] of Object.entries(paint)) {
|
|
338
|
+
try {
|
|
339
|
+
map.setPaintProperty(layerId, prop, value);
|
|
340
|
+
} catch {
|
|
341
|
+
// Ignore
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
layerThemes.set(layerId, theme);
|
|
345
|
+
}
|
|
346
|
+
|
|
326
347
|
// Update opacity if layer exists
|
|
327
348
|
// Multiply base opacity from style with state opacity so the slider acts as a multiplier
|
|
328
349
|
if (map.getLayer(layerId)) {
|
|
@@ -548,6 +569,12 @@
|
|
|
548
569
|
|
|
549
570
|
// Cleanup on destroy
|
|
550
571
|
onDestroy(() => {
|
|
572
|
+
// A pending debounced update would otherwise add sources/layers after cleanup
|
|
573
|
+
if (mapUpdateTimeout) {
|
|
574
|
+
clearTimeout(mapUpdateTimeout);
|
|
575
|
+
mapUpdateTimeout = null;
|
|
576
|
+
}
|
|
577
|
+
|
|
551
578
|
const { map } = mapContext;
|
|
552
579
|
if (!map) return;
|
|
553
580
|
|
|
@@ -746,7 +773,8 @@
|
|
|
746
773
|
class="text-muted-foreground hover:text-foreground p-1"
|
|
747
774
|
onclick={() =>
|
|
748
775
|
(expandedOpacity = expandedOpacity === layer.id ? null : layer.id)}
|
|
749
|
-
aria-label=
|
|
776
|
+
aria-label={`Adjust ${layer.name} opacity`}
|
|
777
|
+
aria-expanded={expandedOpacity === layer.id}
|
|
750
778
|
>
|
|
751
779
|
<svg
|
|
752
780
|
width="14"
|
|
@@ -772,6 +800,8 @@
|
|
|
772
800
|
min="0"
|
|
773
801
|
max="100"
|
|
774
802
|
value={state.opacity * 100}
|
|
803
|
+
aria-label={`${layer.name} opacity`}
|
|
804
|
+
aria-valuetext={`${Math.round(state.opacity * 100)}%`}
|
|
775
805
|
oninput={(e) =>
|
|
776
806
|
handleOpacityChange(
|
|
777
807
|
layer.id,
|
|
@@ -865,7 +895,8 @@
|
|
|
865
895
|
class="text-muted-foreground hover:text-foreground p-1"
|
|
866
896
|
onclick={() =>
|
|
867
897
|
(expandedOpacity = expandedOpacity === layer.id ? null : layer.id)}
|
|
868
|
-
aria-label=
|
|
898
|
+
aria-label={`Adjust ${layer.name} opacity`}
|
|
899
|
+
aria-expanded={expandedOpacity === layer.id}
|
|
869
900
|
>
|
|
870
901
|
<svg
|
|
871
902
|
width="14"
|
|
@@ -891,6 +922,8 @@
|
|
|
891
922
|
min="0"
|
|
892
923
|
max="100"
|
|
893
924
|
value={state.opacity * 100}
|
|
925
|
+
aria-label={`${layer.name} opacity`}
|
|
926
|
+
aria-valuetext={`${Math.round(state.opacity * 100)}%`}
|
|
894
927
|
oninput={(e) =>
|
|
895
928
|
handleOpacityChange(
|
|
896
929
|
layer.id,
|
|
@@ -196,6 +196,17 @@
|
|
|
196
196
|
keyboard,
|
|
197
197
|
cooperativeGestures,
|
|
198
198
|
attributionControl: attributionControl ? { customAttribution } : false,
|
|
199
|
+
// Frame the bounds from the first frame (as React's Map does); `center`
|
|
200
|
+
// /`zoom` alone put the map at its defaults until the load handler's
|
|
201
|
+
// fitBounds, which then flew in from the other side of the world.
|
|
202
|
+
...(bounds
|
|
203
|
+
? {
|
|
204
|
+
bounds: bounds as [[number, number], [number, number]],
|
|
205
|
+
fitBoundsOptions: {
|
|
206
|
+
padding: boundsPadding as number | maplibregl.PaddingOptions | undefined,
|
|
207
|
+
},
|
|
208
|
+
}
|
|
209
|
+
: {}),
|
|
199
210
|
});
|
|
200
211
|
|
|
201
212
|
map = newMap;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
removeMarkerProtection,
|
|
10
10
|
} from '@classic-homes/maps-core';
|
|
11
11
|
import type { MapContextValue } from '../../composables/useMapContext.svelte';
|
|
12
|
+
import { colors } from '@classic-homes/theme-tokens';
|
|
12
13
|
|
|
13
14
|
type Anchor =
|
|
14
15
|
| 'center'
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
let {
|
|
30
31
|
id,
|
|
31
32
|
coordinates,
|
|
32
|
-
color =
|
|
33
|
+
color = colors.teal[500],
|
|
33
34
|
anchor = 'bottom',
|
|
34
35
|
offset,
|
|
35
36
|
rotation,
|
|
@@ -96,37 +97,36 @@
|
|
|
96
97
|
|
|
97
98
|
marker = newMarker;
|
|
98
99
|
|
|
99
|
-
// Drag handlers
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
// Drag handlers — always registered (they no-op without callbacks) so
|
|
101
|
+
// they still fire when `draggable` is switched on after creation
|
|
102
|
+
newMarker.on('dragstart', () => {
|
|
103
|
+
const lngLat = newMarker.getLngLat();
|
|
104
|
+
originalLngLat = [lngLat.lng, lngLat.lat] as LngLat;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
newMarker.on('drag', () => {
|
|
108
|
+
if (onDrag) {
|
|
102
109
|
const lngLat = newMarker.getLngLat();
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
markerId: id || '',
|
|
124
|
-
lngLat: [lngLat.lng, lngLat.lat] as LngLat,
|
|
125
|
-
originalLngLat,
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
110
|
+
onDrag({
|
|
111
|
+
type: 'drag',
|
|
112
|
+
markerId: id || '',
|
|
113
|
+
lngLat: [lngLat.lng, lngLat.lat] as LngLat,
|
|
114
|
+
originalLngLat,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
newMarker.on('dragend', () => {
|
|
120
|
+
if (onDragEnd) {
|
|
121
|
+
const lngLat = newMarker.getLngLat();
|
|
122
|
+
onDragEnd({
|
|
123
|
+
type: 'dragend',
|
|
124
|
+
markerId: id || '',
|
|
125
|
+
lngLat: [lngLat.lng, lngLat.lat] as LngLat,
|
|
126
|
+
originalLngLat,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
// Handle click handler - separate effect to properly update when onClick prop changes
|
|
@@ -164,6 +164,9 @@
|
|
|
164
164
|
if (attribution !== undefined) sourceConfig.attribution = attribution;
|
|
165
165
|
|
|
166
166
|
map.addSource(id, sourceConfig);
|
|
167
|
+
// The source now holds `data`; record it so the data effect does not
|
|
168
|
+
// immediately re-send the same dataset (a full worker re-parse)
|
|
169
|
+
lastDataFingerprint = data ? createGeoJSONFingerprint(data) : null;
|
|
167
170
|
} else if (type === 'vector') {
|
|
168
171
|
const sourceConfig: maplibregl.VectorSourceSpecification = {
|
|
169
172
|
type: 'vector',
|
|
@@ -194,6 +197,25 @@
|
|
|
194
197
|
if (scheme !== undefined) sourceConfig.scheme = scheme;
|
|
195
198
|
|
|
196
199
|
map.addSource(id, sourceConfig);
|
|
200
|
+
} else if (type === 'raster-dem') {
|
|
201
|
+
const sourceConfig: maplibregl.RasterDEMSourceSpecification = {
|
|
202
|
+
type: 'raster-dem',
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
if (url) sourceConfig.url = url;
|
|
206
|
+
if (tiles) sourceConfig.tiles = tiles;
|
|
207
|
+
if (tileSize !== undefined) sourceConfig.tileSize = tileSize;
|
|
208
|
+
if (minzoom !== undefined) sourceConfig.minzoom = minzoom;
|
|
209
|
+
if (maxzoom !== undefined) sourceConfig.maxzoom = maxzoom;
|
|
210
|
+
if (attribution !== undefined) sourceConfig.attribution = attribution;
|
|
211
|
+
if (bounds !== undefined) sourceConfig.bounds = bounds as [number, number, number, number];
|
|
212
|
+
|
|
213
|
+
map.addSource(id, sourceConfig);
|
|
214
|
+
} else {
|
|
215
|
+
// Nothing was added: do not report the source as ready, or dependent
|
|
216
|
+
// layers would wait on it forever without a clue why
|
|
217
|
+
console.warn(`[maps-svelte] Source "${id}": type "${type}" is not supported.`);
|
|
218
|
+
return;
|
|
197
219
|
}
|
|
198
220
|
|
|
199
221
|
sourceAdded = true;
|
|
@@ -56,18 +56,24 @@
|
|
|
56
56
|
let overlayRef = $state<maplibregl.IControl | null>(null);
|
|
57
57
|
let MapboxOverlayClass = $state<MapboxOverlayClass | null>(null);
|
|
58
58
|
let initialized = $state(false);
|
|
59
|
+
// Plain (non-reactive) guards for the async import below
|
|
60
|
+
let initializing = false;
|
|
61
|
+
let destroyed = false;
|
|
59
62
|
|
|
60
63
|
// Initialize Deck.gl overlay
|
|
61
64
|
$effect(() => {
|
|
62
65
|
const { map, loaded } = mapContext;
|
|
63
66
|
|
|
64
|
-
if (!map || !loaded || initialized) return;
|
|
67
|
+
if (!map || !loaded || initialized || initializing) return;
|
|
68
|
+
initializing = true;
|
|
65
69
|
|
|
66
70
|
const initOverlay = async () => {
|
|
67
71
|
try {
|
|
68
72
|
// Dynamic import to make Deck.gl optional
|
|
69
|
-
// @ts-ignore - deck.gl types are optional peer dependencies
|
|
70
73
|
const deckMapbox = await import('@deck.gl/mapbox');
|
|
74
|
+
// Destroyed while the chunk loaded: onDestroy has already run, so an
|
|
75
|
+
// overlay added now would never be removed
|
|
76
|
+
if (destroyed) return;
|
|
71
77
|
MapboxOverlayClass = deckMapbox.MapboxOverlay as unknown as MapboxOverlayClass;
|
|
72
78
|
|
|
73
79
|
const overlay = new MapboxOverlayClass({
|
|
@@ -85,6 +91,7 @@
|
|
|
85
91
|
overlayRef = overlay;
|
|
86
92
|
initialized = true;
|
|
87
93
|
} catch (err) {
|
|
94
|
+
initializing = false;
|
|
88
95
|
console.warn(
|
|
89
96
|
'[maps-svelte] Deck.gl is not available. Install @deck.gl/core, @deck.gl/layers, and @deck.gl/mapbox to use DeckOverlay.',
|
|
90
97
|
err
|
|
@@ -122,6 +129,7 @@
|
|
|
122
129
|
|
|
123
130
|
// Cleanup on destroy
|
|
124
131
|
onDestroy(() => {
|
|
132
|
+
destroyed = true;
|
|
125
133
|
const { map } = mapContext;
|
|
126
134
|
|
|
127
135
|
if (overlayRef && map) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { MapContainer, MapSkeleton, MapError, MapEmpty } from './base/index.js';
|
|
2
2
|
export { Map, Source, Marker, Popup, PopupCard, PopupHeader, PopupContent, PopupFooter, } from './core/index.js';
|
|
3
|
-
export { FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, type SvelteFeatureClickEventParams, type SvelteFeatureHoverEventParams, } from './layers/index.js';
|
|
3
|
+
export { FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, useLayer, type UseLayerOptions, type SvelteFeatureClickEventParams, type SvelteFeatureHoverEventParams, } from './layers/index.js';
|
|
4
4
|
export { DeckOverlay } from './deck/index.js';
|
|
5
5
|
export { Legend, LegendGroup, CoordinateDisplay, BasemapSwitcher, LayerManager, CustomControl, type CustomControlProps, } from './controls/index.js';
|
|
@@ -3,7 +3,7 @@ export { MapContainer, MapSkeleton, MapError, MapEmpty } from './base/index.js';
|
|
|
3
3
|
// Core components
|
|
4
4
|
export { Map, Source, Marker, Popup, PopupCard, PopupHeader, PopupContent, PopupFooter, } from './core/index.js';
|
|
5
5
|
// Layer components
|
|
6
|
-
export { FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, } from './layers/index.js';
|
|
6
|
+
export { FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, useLayer, } from './layers/index.js';
|
|
7
7
|
// Deck.gl components
|
|
8
8
|
export { DeckOverlay } from './deck/index.js';
|
|
9
9
|
// Control components
|
|
@@ -4,4 +4,5 @@ export { default as CircleLayer } from './CircleLayer.svelte';
|
|
|
4
4
|
export { default as SymbolLayer } from './SymbolLayer.svelte';
|
|
5
5
|
export { default as FillExtrusionLayer } from './FillExtrusionLayer.svelte';
|
|
6
6
|
export { default as HeatmapLayer } from './HeatmapLayer.svelte';
|
|
7
|
-
export
|
|
7
|
+
export { useLayer } from './useLayer.svelte.js';
|
|
8
|
+
export type { UseLayerOptions, SvelteFeatureClickEventParams, SvelteFeatureHoverEventParams, } from './useLayer.svelte.js';
|
|
@@ -4,3 +4,4 @@ export { default as CircleLayer } from './CircleLayer.svelte';
|
|
|
4
4
|
export { default as SymbolLayer } from './SymbolLayer.svelte';
|
|
5
5
|
export { default as FillExtrusionLayer } from './FillExtrusionLayer.svelte';
|
|
6
6
|
export { default as HeatmapLayer } from './HeatmapLayer.svelte';
|
|
7
|
+
export { useLayer } from './useLayer.svelte.js';
|
|
@@ -16,6 +16,8 @@ export function useLayer(getOptions) {
|
|
|
16
16
|
let lastAppliedVisible = undefined;
|
|
17
17
|
let lastAppliedPaint = undefined;
|
|
18
18
|
let lastAppliedFilterSerialized = '';
|
|
19
|
+
let lastAppliedLayout = undefined;
|
|
20
|
+
let lastAppliedZoomRange = undefined;
|
|
19
21
|
// Track style version for re-initialization after basemap changes
|
|
20
22
|
let lastKnownStyleVersion = -1;
|
|
21
23
|
$effect(() => {
|
|
@@ -36,6 +38,8 @@ export function useLayer(getOptions) {
|
|
|
36
38
|
lastAppliedVisible = undefined;
|
|
37
39
|
lastAppliedPaint = undefined;
|
|
38
40
|
lastAppliedFilterSerialized = '';
|
|
41
|
+
lastAppliedLayout = undefined;
|
|
42
|
+
lastAppliedZoomRange = undefined;
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
45
|
const createFeatureParams = (e, options, map) => {
|
|
@@ -205,6 +209,50 @@ export function useLayer(getOptions) {
|
|
|
205
209
|
// Layer might not exist yet
|
|
206
210
|
}
|
|
207
211
|
});
|
|
212
|
+
// Update layout properties (except visibility, handled above; only changed
|
|
213
|
+
// properties). The add effect only applies layout once.
|
|
214
|
+
$effect(() => {
|
|
215
|
+
const options = getOptions();
|
|
216
|
+
const { map, loaded } = mapContext;
|
|
217
|
+
if (!map || !loaded || !layerAdded)
|
|
218
|
+
return;
|
|
219
|
+
const next = { ...(options.layout ?? {}) };
|
|
220
|
+
delete next.visibility;
|
|
221
|
+
const diff = getChangedPaintProps(lastAppliedLayout, next);
|
|
222
|
+
if (!diff.hasChanges)
|
|
223
|
+
return;
|
|
224
|
+
try {
|
|
225
|
+
for (const [key, value] of Object.entries(diff.changed)) {
|
|
226
|
+
map.setLayoutProperty(options.id, key, value);
|
|
227
|
+
}
|
|
228
|
+
for (const key of diff.removed) {
|
|
229
|
+
map.setLayoutProperty(options.id, key, undefined);
|
|
230
|
+
}
|
|
231
|
+
lastAppliedLayout = next;
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// Layer might not exist yet
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
// Update zoom range (only when changed)
|
|
238
|
+
$effect(() => {
|
|
239
|
+
const options = getOptions();
|
|
240
|
+
const { map, loaded } = mapContext;
|
|
241
|
+
if (!map || !loaded || !layerAdded)
|
|
242
|
+
return;
|
|
243
|
+
const minZoom = options.minZoom ?? 0;
|
|
244
|
+
const maxZoom = options.maxZoom ?? 24;
|
|
245
|
+
const key = `${minZoom}:${maxZoom}`;
|
|
246
|
+
if (lastAppliedZoomRange === key)
|
|
247
|
+
return;
|
|
248
|
+
try {
|
|
249
|
+
map.setLayerZoomRange(options.id, minZoom, maxZoom);
|
|
250
|
+
lastAppliedZoomRange = key;
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
// Layer might not exist yet
|
|
254
|
+
}
|
|
255
|
+
});
|
|
208
256
|
function setupEventHandlers(map, id, source, sourceLayer, onClick, onHover) {
|
|
209
257
|
// Click handler
|
|
210
258
|
const handleClick = (e) => {
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Svelte MapLibre components for the Classic Theme design system
|
|
5
5
|
*/
|
|
6
|
-
export { MapContainer, MapSkeleton, MapError, MapEmpty, Map, Source, Marker, Popup, PopupCard, PopupHeader, PopupContent, PopupFooter, FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, Legend, LegendGroup, CoordinateDisplay, BasemapSwitcher, LayerManager, CustomControl, type CustomControlProps, DeckOverlay, type SvelteFeatureClickEventParams, type SvelteFeatureHoverEventParams, } from './components/index.js';
|
|
6
|
+
export { MapContainer, MapSkeleton, MapError, MapEmpty, Map, Source, Marker, Popup, PopupCard, PopupHeader, PopupContent, PopupFooter, useLayer, type UseLayerOptions, FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer, Legend, LegendGroup, CoordinateDisplay, BasemapSwitcher, LayerManager, CustomControl, type CustomControlProps, DeckOverlay, type SvelteFeatureClickEventParams, type SvelteFeatureHoverEventParams, } from './components/index.js';
|
|
7
7
|
export { useMapTheme, useReducedMotion, useMapContext, tryUseMapContext, useMapInstance, useControlPosition, type MapContextValue, type UseControlPositionOptions, type UseControlPositionResult, } from './composables/index.js';
|
|
8
8
|
export { cn } from './utils.js';
|
|
9
|
-
export type { LngLat, MapBounds, BoundsArray, MapViewport, GeoJSONFeature, GeoJSONFeatureCollection, MarkerData, MapClickEventParams, MapHoverEventParams, FeatureClickEventParams, FeatureHoverEventParams, MarkerClickEventParams, MapMoveEventParams, BaseMapProps, MapProps, SourceProps, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, MarkerProps, PopupProps, LegendItem, GradientStop, LegendProps, CoordinateDisplayProps, LegendConfig, LegendGroupProps, BasemapProvider, BasemapCategory, BasemapDefinition, BasemapApiKeys, BasemapSwitcherProps, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, OverlayApiKeys, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, ControlType, ControlOffset, } from '@classic-homes/maps-core';
|
|
9
|
+
export type { LngLat, MapBounds, BoundsArray, MapViewport, GeoJSONFeature, GeoJSONFeatureCollection, MarkerData, MapClickEventParams, MapHoverEventParams, FeatureClickEventParams, FeatureHoverEventParams, MarkerClickEventParams, MarkerDragEventParams, MapMoveEventParams, BaseMapProps, MapProps, SourceProps, FillLayerProps, LineLayerProps, CircleLayerProps, SymbolLayerProps, FillExtrusionLayerProps, HeatmapLayerProps, MarkerProps, PopupProps, LegendItem, GradientStop, LegendProps, CoordinateDisplayProps, LegendConfig, LegendGroupProps, BasemapProvider, BasemapCategory, BasemapDefinition, BasemapApiKeys, BasemapSwitcherProps, OverlayLayerCategory, OverlayLayerDefinition, OverlayLayerState, OverlayApiKeys, LayerManagerProps, ExtendedControlPosition, ControlPriority, ZIndexLayer, ControlType, ControlOffset, } from '@classic-homes/maps-core';
|
|
10
10
|
export { CATEGORY_META, SCHOOL_DISTRICTS, CITY_LIMITS, ZONING_DISTRICTS, PARKS, TRAILS, SPORTS_FACILITIES, TRANSIT_ROUTES, BIKE_LANES, FLOOD_ZONES, WATERSHEDS, BUILTIN_OVERLAY_LAYERS, resolveLayerSourceUrl, getLayerStyleForTheme, searchLayers, getLayersByCategory, groupLayersByCategory, getLayerCategories, createInitialLayerStates, toggleLayerVisibility, setLayerOpacity, } from '@classic-homes/maps-core';
|
|
11
11
|
export { THEME_LIGHT, THEME_DARK, lightTheme, darkTheme, lightBasicStyle, darkBasicStyle, generateMapDescription, formatCoordinates, formatDistance, formatArea, createHoverExpression, createSelectionExpression, getHighlightStyle, getSelectionStyle, calculateBounds, extendBounds, combineBounds, isValidBounds, loadGeoJSON, validateGeoJSON, calculateCentroid, countFeaturesByType, filterByGeometryType, DEFAULT_BASEMAP, SATELLITE_BASEMAP, TOPO_BASEMAP, PRIMARY_BASEMAPS, BUILTIN_BASEMAPS, FREE_BASEMAPS, OSM_STANDARD, resolveBasemapStyle, getAvailableBasemaps, } from '@classic-homes/maps-core';
|
|
12
12
|
export type { LoadGeoJSONOptions, LoadGeoJSONResult, ValidationResult, ClusterFeatureProperties, ClusterExpandOptions, } from '@classic-homes/maps-core';
|
package/dist/lib/index.js
CHANGED
|
@@ -10,7 +10,7 @@ MapContainer, MapSkeleton, MapError, MapEmpty,
|
|
|
10
10
|
// Core
|
|
11
11
|
Map, Source, Marker, Popup, PopupCard, PopupHeader, PopupContent, PopupFooter,
|
|
12
12
|
// Layers
|
|
13
|
-
FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer,
|
|
13
|
+
useLayer, FillLayer, LineLayer, CircleLayer, SymbolLayer, FillExtrusionLayer, HeatmapLayer,
|
|
14
14
|
// Controls
|
|
15
15
|
Legend, LegendGroup, CoordinateDisplay, BasemapSwitcher, LayerManager, CustomControl,
|
|
16
16
|
// Deck.gl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/maps-svelte",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.2",
|
|
4
4
|
"description": "Svelte MapLibre components for Classic Theme",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maps",
|
|
@@ -67,10 +67,12 @@
|
|
|
67
67
|
"@deck.gl/mapbox": "^9.0.0",
|
|
68
68
|
"@sveltejs/package": "^2.3.0",
|
|
69
69
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
70
|
+
"jsdom": "^28.1.0",
|
|
70
71
|
"maplibre-gl": "^5.0.0",
|
|
71
72
|
"svelte": "^5.0.0",
|
|
72
73
|
"svelte-check": "^4.0.0",
|
|
73
|
-
"typescript": "^5.3.0"
|
|
74
|
+
"typescript": "^5.3.0",
|
|
75
|
+
"vitest": "^4.1.10"
|
|
74
76
|
},
|
|
75
77
|
"publishConfig": {
|
|
76
78
|
"access": "public"
|