From ce1097da3ff12ca6622c45f654d2494d82b296e8 Mon Sep 17 00:00:00 2001 From: doxa-maps-88655c70 <88627970+doxa-maps-88655c70@users.noreply.github.com> Date: Fri, 25 Sep 2026 18:23:44 +0000 Subject: [PATCH] Delete the glFor copy: the instance sniff already lives in library, once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I landed glFor as a local copy of pplr-data-maps' helper and flagged the duplication as a decision on the record rather than drift. It did not need to be a decision at all: 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 gone and the part that could drift is delegated. What remains in the plugin is the namespace choice, one expression with nowhere to drift to. When exp-shepherd's engineFor(map) lands, that line goes too. WHAT IS PROVEN, and what is not, because the browser slots have been saturated for fifteen minutes and RULE 3 says gates green before committing. This is a pure expression substitution, so its logic is provable without a GPU: _chk-glfor-equivalence.mjs stubs the globals, builds BOTH implementations, and compares their decisions across every engine combination — mapbox map with both globals, maplibre map with both, either alone, and the case the whole fix exists for: a MapLibre map with no Mapbox global at all. Identical in all of them. That establishes the refactor cannot have changed the decision, so the pin-click integration result already measured still applies. It does NOT re-run that click; the browser re-proof is queued and will run when a slot frees. check:sri PASS, composite freshness PASS. --- .../src/RegionCountryMap.vue | 10 +- plugin-designs/regions-dashboard/src/glFor.js | 26 --- public/doxa-maps/doxa-maps-spa/manifest.json | 8 +- public/doxa-maps/manifest.json | 8 +- .../region-dashboards/index.html | 2 +- .../regions-dashboard/regions-dashboard.js | 152 +++++++++--------- .../regions-dashboard/regions-list/index.html | 2 +- .../regions-dashboard/regions-mfe/index.html | 2 +- 8 files changed, 96 insertions(+), 114 deletions(-) delete mode 100644 plugin-designs/regions-dashboard/src/glFor.js 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" + "script": "\n\n\n\n" } }, { @@ -922,7 +922,7 @@ "scriptUrl": "./regions-dashboard/regions-dashboard.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -936,7 +936,7 @@ "scriptUrl": "./regions-dashboard/regions-dashboard.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } } ] diff --git a/public/doxa-maps/manifest.json b/public/doxa-maps/manifest.json index 5b4f1f33f..b61250caf 100644 --- a/public/doxa-maps/manifest.json +++ b/public/doxa-maps/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" + "script": "\n\n\n\n" } }, { @@ -922,7 +922,7 @@ "scriptUrl": "./regions-dashboard/regions-dashboard.js", "embed": { "iframe": "", - "script": "\n\n" + "script": "\n\n" } }, { @@ -936,7 +936,7 @@ "scriptUrl": "./regions-dashboard/regions-dashboard.js", "embed": { "iframe": "", - "script": "\n\n\n\n" + "script": "\n\n\n\n" } } ] diff --git a/public/doxa-maps/regions-dashboard/region-dashboards/index.html b/public/doxa-maps/regions-dashboard/region-dashboards/index.html index 2a308470b..8155ef00b 100644 --- a/public/doxa-maps/regions-dashboard/region-dashboards/index.html +++ b/public/doxa-maps/regions-dashboard/region-dashboards/index.html @@ -29,7 +29,7 @@ - + - + - +