diff --git a/plugin-designs/regions-dashboard/src/RegionCountryMap.vue b/plugin-designs/regions-dashboard/src/RegionCountryMap.vue index 382b41f31..c289c4829 100644 --- a/plugin-designs/regions-dashboard/src/RegionCountryMap.vue +++ b/plugin-designs/regions-dashboard/src/RegionCountryMap.vue @@ -27,7 +27,15 @@ */ import { ref, computed, watch, onMounted, onBeforeUnmount, inject } from 'vue' import { useMapInstance } from '@map/composables/useMapInstance.js' -import { glFor } from './glFor.js' +import { isMapboxMap } from '@map/composables/useMapProvider.js' +// ★ THE INSTANCE SNIFF LIVES IN library/, ONCE. This was a local glFor.js copied from +// pplr-data-maps, and I flagged the duplication as a decision on the record. It turns out +// library/composables/useMapProvider.js already exports isMapboxMap(map) — the same per-instance +// test, documented for the same reason ("works even on dual-engine pages where both globals are +// loaded"). So the copy is deleted and the part that could drift is delegated; what remains here +// is only the namespace choice, which is one expression and has nowhere to drift to. +// When exp-shepherd's engineFor(map) lands this line goes too. +const glFor = (m) => (isMapboxMap(m) ? window.mapboxgl : (window.maplibregl || window.mapboxgl)) import { resolveMapProvider } from '@map/composables/useMapProvider.js' import { resolveAssetsBase } from '@map/utils/embedBase.js' import { useShadowStyles } from '@map/composables/useShadowStyles.js' diff --git a/plugin-designs/regions-dashboard/src/glFor.js b/plugin-designs/regions-dashboard/src/glFor.js deleted file mode 100644 index f577011d2..000000000 --- a/plugin-designs/regions-dashboard/src/glFor.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * The map-engine namespace that built a given map instance — Popup, Marker, NavigationControl. - * - * ★ WHY THIS EXISTS. Every view here was written against the Mapbox global, and under - * provider=maplibre that global does not exist. `new window.mapboxgl.Popup(...)` then throws, or — - * worse, and what this plugin actually did — the code guards with `if (!g) return` and the pin - * click silently does NOTHING. It has been passing only because each generated leaf
- * statically loads mapbox-gl, so a MapLibre map was opening a Mapbox popup. Those tags are being - * removed (a static Mapbox script leaks the visitor's IP to Mapbox even for a partner who chose - * MapLibre), so the engine has to be derived from the map, not assumed from a global. - * - * ★ WHY A COPY AND NOT AN IMPORT. The same function lives at - * plugin-designs/pplr-data-maps/src/utils/pplrData.js:64. Importing across plugin folders would - * couple two plugins through a path neither owns, and RULE 2 says default to the plugin folder; - * library/ is the right home the moment a THIRD consumer appears, at which point both copies - * should be deleted in the same commit rather than left to drift. - * - * Order matters: ask MapLibre first with an instanceof test, because a page can legitimately have - * BOTH globals loaded and only the instance knows which one made it. - */ -export function glFor(map) { - if (typeof window === 'undefined') return undefined - const ml = window.maplibregl - if (ml && map && ml.Map && map instanceof ml.Map) return ml - return window.mapboxgl || ml -} diff --git a/public/doxa-maps/doxa-maps-spa/manifest.json b/public/doxa-maps/doxa-maps-spa/manifest.json index 5b4f1f33f..b61250caf 100644 --- a/public/doxa-maps/doxa-maps-spa/manifest.json +++ b/public/doxa-maps/doxa-maps-spa/manifest.json @@ -888,7 +888,7 @@ "bundle": "regions-dashboard", "scriptUrl": "./regions-dashboard/regions-dashboard.js", "output": "doxa-maps/regions-dashboard/regions-dashboard.js", - "integrity": "sha384-s6fZzSXIqBkgA4KnbR4r7uYBrEly/OvCaFLqFM4VimcSqO8wNbr3mM1SC5USMMbI", + "integrity": "sha384-ZXuvbAcPZsF0Cs1Uu5muBUZ7X9EAf6e/UMA1PohxYCydopxQO4ytVsgbeC1H0BGH", "elements": [ "regions-dashboard" ], @@ -908,7 +908,7 @@ "scriptUrl": "./regions-dashboard/regions-dashboard.js", "embed": { "iframe": "", - "script": "\n\n\n\n