Some checks are pending
build-gate / build (push) Waiting to run
The cap-4 composite bakes research-dashboard's .vue directly, so it never runs
that bundle's entry file and has to repeat everything the entry does. It
repeated Pinia, i18n and the colour strategies. It did not repeat this one.
Measured in the shipped bundles:
research-dashboard.js ..... 1 occurrence of mapbox-gl-rtl-text
doxa-research-map.js ...... 1
dashboard-plus-grid.js .... 0
So Arabic, Hebrew and Persian labels rendered reversed inside the cap-5 shell
and correctly standalone. Not cosmetic here: Arab World has 99 rows and
Persian-Median 49, and a reversed label is a wrong NAME for exactly the groups
this map is about. It failed silently -- no error, no warning, just mirrored
text that reads as a font problem to anyone who does not read the script.
Fixed as a shared library function rather than a fourth hand-copy, which is
what the composite-registration card asks for: one definition, two callers,
nothing to drift. Idempotent by construction, since Mapbox throws on a second
setRTLTextPlugin in a session and that throw is swallowed.
Four of the five entry side effects fail silently; only provide('profileModules')
throws, and that is the one safe to omit because a baked composite does not use
ProfileLoader. So "it renders" is no evidence the entry's work was done.
Found by the map-beauty agent, which I verified independently before acting
rather than taking the bundle counts on report.
80 lines
4 KiB
JavaScript
80 lines
4 KiB
JavaScript
/**
|
|
* research-dashboard / index.js — Bundle entry (DOXA-LIB-2)
|
|
*
|
|
* Vite multi-entry build target. Emits app/research-dashboard.js.
|
|
*
|
|
* Mirrors plugin-designs/doxa-research-map/index.js (same ProfileLoader plumbing).
|
|
* Registers a SINGLE tag (UNCHANGED from the original profile — only the bundle folder
|
|
* is now plural so it can host N dashboard profiles tomorrow):
|
|
* - <research-dashboard-map> config-driven people-group research dashboard
|
|
*
|
|
* The dashboard mounts a Mapbox map in its center cell (Mapbox GL is loaded globally by
|
|
* index.html and the token arrives via profile-config.tk), so the RTL-text plugin is
|
|
* loaded once here, exactly like the map bundles.
|
|
*
|
|
* Profile registry — same Q3 contract as the map bundles: ProfileLoader lives in @map and
|
|
* cannot import.meta.glob across the package boundary, so the bundle evaluates
|
|
* import.meta.glob('./*.vue') HERE and hands the result to the loader via
|
|
* app.provide('profileModules'). The library panels live in @map/components/dashboards and
|
|
* are imported by the profile .vue — the glob only registers the profile screen(s).
|
|
*/
|
|
|
|
import { defineCustomElement } from 'vue'
|
|
import { createPinia } from 'pinia'
|
|
import ProfileLoader from '@map/ProfileLoader.vue'
|
|
import { createAppI18n } from '@map/i18n/index.js'
|
|
import { registerStrategies } from '@map/colors/_registry.js'
|
|
import { installRtlTextPlugin } from '@map/maps/rtl-text.js'
|
|
import affinityBlock from '../doxa-research-map/src/colors/affinity-block.js'
|
|
import doxaRegion from '../doxa-research-map/src/colors/doxa-region.js'
|
|
|
|
// ─── Bundle-private profile registry ─────────────────────────────────────────
|
|
const profileModules = import.meta.glob('./*.vue')
|
|
|
|
// ─── Bundle-private color strategies (card BUILD-STACKED-TREE-LEGEND) ────────
|
|
// The stacked tree legend colours its People and Place trees from the cap-3 research map's
|
|
// palettes, so the legend can never drift from the map's pins. Those two strategies are
|
|
// PROFILE-LOCAL to doxa-research-map (registered there by its own src/colors glob — see
|
|
// plugin-designs/doxa-research-map/index.js:38), so the dashboard bundle's registry does not
|
|
// contain them unless we register them here too.
|
|
//
|
|
// This MATTERS because the failure is silent: getColorStrategy() falls back to language-family
|
|
// for an unregistered mode, and useAffinityBlockLegendData.js:57 guards on propertyKey and
|
|
// returns {} — so without this, every People swatch would quietly be neutral grey and nothing
|
|
// would error. Registering the SAME modules means one palette, not a copied one.
|
|
//
|
|
// Imported EXPLICITLY rather than via import.meta.glob: a glob is resolved relative to this
|
|
// file by Vite and a cross-bundle relative glob that stops matching fails silently (zero
|
|
// strategies registered, grey swatches), whereas a named import fails loudly at build time.
|
|
registerStrategies({
|
|
'./affinity-block.js': { default: affinityBlock },
|
|
'./doxa-region.js': { default: doxaRegion },
|
|
})
|
|
|
|
// ─── Mapbox RTL text plugin — load ONCE before any map instance ──────────────
|
|
installRtlTextPlugin()
|
|
|
|
/**
|
|
* Build a fresh defineCustomElement-wrapped class. Each instance gets its own Pinia + i18n
|
|
* so multiple embeds on the same page don't bleed state.
|
|
*/
|
|
function buildDoxaResearchDashboardElement() {
|
|
return defineCustomElement(ProfileLoader, {
|
|
configureApp(app) {
|
|
app.use(createPinia())
|
|
app.use(createAppI18n())
|
|
app.provide('profileModules', profileModules)
|
|
}
|
|
})
|
|
}
|
|
|
|
const DoxaResearchDashboardElement = buildDoxaResearchDashboardElement()
|
|
|
|
// ─── Register ONE tag — <research-dashboard-map> ────────────────────────────
|
|
if (typeof customElements !== 'undefined') {
|
|
if (!customElements.get('research-dashboard-map')) {
|
|
customElements.define('research-dashboard-map', DoxaResearchDashboardElement)
|
|
}
|
|
}
|
|
|
|
export default DoxaResearchDashboardElement
|