doxa-maps/plugin-designs/country-posters/index.js
Doxa Maps 45d931fa40 Repair what the union resolution duplicated
Resolving package.json conflicts by unioning unique lines is right for a file
that holds one entry per line. Applied to ordinary source it duplicates
declarations, because both sides of a hunk keep their copy and nothing
de-duplicates across the join.

Eleven plugin entry points ended with the same import twice, and the poster
renderer with two identical `const sheet`. Each is a SyntaxError: every one of
those bundles would have failed to build, and the poster export would not run.

Found by parse-checking every changed .js against the merge base, not by the
gates -- gates:pre passed 101 of 102 with all twelve files broken, because its
parse gates do not cover plugin entry points.

One measurement trap worth recording. `node --check` on a .js file parses it as
CommonJS, so a bare `import` is a syntax error and ALL 28 entry points appear
broken, on development too. That reading says the tree is on fire and is simply
wrong. Copying each file to a .mjs and checking that parses it as a module,
which separates the eleven that are genuinely broken here from the rest that
are fine.
2026-09-29 16:01:45 +00:00

62 lines
3 KiB
JavaScript

import { defineMapElement } from '@map/elements/defineMapElement.js'
/**
* plugin-designs/country-posters/index.js
*
* Bundle entry — registers the country-posters web component.
*
* Registers ONE custom-element tag:
* - <country-posters-map>
*
* Usage from a host page:
* <script src="/app/country-posters.js"></script>
* <country-posters-map profile-config='{"profile":"countries-map","tk":"pk.YOUR_MAPBOX_TOKEN"}'></country-posters-map>
* <country-posters-map profile-config='{"profile":"country-poster-wall"}'></country-posters-map>
*
* TWO PROFILES, ONE BUNDLE — the same shape as my-upg-100-list:
* countries-map.vue the map; legend opens on the COUNTRY level
* country-poster-wall.vue the poster grid, grouped by region, collapsible
*
* WHY A SEPARATE BUNDLE rather than two more profiles in my-upg-100-list:
* > design note 2026-08-01: "I don't mind creating multiple application profiles, one
* > for each application. I do mind that we really need to make sure every
* > component that we're [re]usable is added to the library."
* PROFILES duplicate; COMPONENTS get promoted to library/ and parameterized. The
* wall here is @map/components/poster/PosterWall.vue — the same component the
* 100-list renders — differing only in data, taxonomy and copy.
*
* Profile registry — ProfileLoader lives inside @map and cannot use
* import.meta.glob to reach into a bundle's folder. The bundle MUST evaluate
* import.meta.glob('./*.vue') locally and hand the result to the loader via
* app.provide('profileModules', ...).
*/
// ─── Bundle-private profile registry ─────────────────────────────────────────
const profileModules = import.meta.glob('./*.vue')
// ★ THE LOCAL COLOUR GLOB IS GONE (C1b). This bundle registered its own src/colors/*.js over the
// shared set; all three modules (doxa-region, affinity-block, resource) now live in library/colors/
// where _registry.js discovers them for every bundle, and src/colors/ holds no .js at all. The glob
// matched nothing, so leaving it would be dead code that reads as a deliberate override.
// RTL text plugin (Arabic/Hebrew/Persian shaping): installed by useMapInstance through
// library/maps/rtl-text.js, on BOTH engines, before every map is constructed. Do not re-add a
// hand-rolled mapboxgl-only block here -- it was a strict subset of that call.
/**
* Each instance gets its own Pinia + i18n so multiple embeds on one page never
* bleed state into each other.
*/
function buildCountryPostersElement() {
return defineMapElement({ profileModules })
}
const CountryPostersElement = buildCountryPostersElement()
// Guard prevents "already registered" errors when this IIFE is loaded twice.
if (typeof customElements !== 'undefined') {
if (!customElements.get('country-posters-map')) {
customElements.define('country-posters-map', CountryPostersElement)
}
}
export default CountryPostersElement