@classic-homes/maps-svelte 0.4.2 → 0.5.1

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.
@@ -51,8 +51,12 @@
51
51
 
52
52
  function toggleCollapse() {
53
53
  if (collapsible) {
54
+ // Read the shown state before flipping userToggled: isCollapsed switches
55
+ // to localCollapsed the moment userToggled is set, and read after it the
56
+ // stale local value made the first click on a collapsed legend a no-op.
57
+ const next = !isCollapsed;
54
58
  userToggled = true;
55
- localCollapsed = !isCollapsed;
59
+ localCollapsed = next;
56
60
  }
57
61
  }
58
62
 
@@ -109,7 +109,10 @@
109
109
  if (!map || !popup) return;
110
110
 
111
111
  if (open) {
112
- popup.setLngLat(coordinates as [number, number]).addTo(map);
112
+ popup.setLngLat(coordinates as [number, number]);
113
+ // addTo() removes an existing attachment and emits close. Coordinate or
114
+ // callback updates must move the current popup without clearing selection.
115
+ if (!popup.isOpen()) popup.addTo(map);
113
116
 
114
117
  // Auto-pan to fit popup after it renders
115
118
  if (autoPan) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/maps-svelte",
3
- "version": "0.4.2",
3
+ "version": "0.5.1",
4
4
  "description": "Svelte MapLibre components for Classic Theme",
5
5
  "keywords": [
6
6
  "maps",