doxa-maps/plugin-designs/gospel-resources/index.js
Doxa Maps e19697673d
Some checks are pending
Deploy to GitHub Pages / build (push) Waiting to run
Deploy to GitHub Pages / deploy (push) Blocked by required conditions
Doxa Maps — the map bundler, 7 production plugins and the Experimental shelf
2026-09-25 20:07:59 +00:00

51 lines
2 KiB
JavaScript

/**
* plugin-designs/gospel-resources/index.js — bundle entry for GOSPEL RESOURCES.
*
* Registers ONE custom-element tag:
* <gospel-resources-map profile-config='{"profile":"resources-list"}'></gospel-resources-map>
*
* Same shape as country-posters/index.js — folder = bundle, each flat .vue = a
* profile, `profile` is the FILENAME not the folder. ProfileLoader lives in @map
* and cannot glob into a bundle folder, so the BUNDLE evaluates the glob and hands
* the registry over via app.provide('profileModules').
*
* NO COLOR STRATEGIES registered here: this bundle currently ships a list profile
* only. When the map profile lands it will need one, and it goes in src/colors/
* where the registry auto-discovers it by filename.
*
* NO MAPBOX RTL PLUGIN either — nothing here renders a basemap yet. Adding the
* plugin call before a map exists would be dead code implying a capability the
* bundle does not have.
*/
import { defineCustomElement } from 'vue'
import { createPinia } from 'pinia'
import ProfileLoader from '@map/ProfileLoader.vue'
import { createAppI18n } from '@map/i18n/index.js'
// Evaluated by Vite at build time relative to THIS file, so it captures only this
// bundle's profiles.
const profileModules = import.meta.glob('./*.vue')
function buildGospelResourcesElement() {
return defineCustomElement(ProfileLoader, {
configureApp(app) {
// Per-instance Pinia + i18n so multiple embeds on one page never bleed state.
app.use(createPinia())
app.use(createAppI18n())
app.provide('profileModules', profileModules)
},
})
}
const GospelResourcesElement = buildGospelResourcesElement()
// Guarded: customElements.define() is one-shot per tag per page session, so an
// IIFE loaded twice would throw without this.
if (typeof customElements !== 'undefined') {
if (!customElements.get('gospel-resources-map')) {
customElements.define('gospel-resources-map', GospelResourcesElement)
}
}
export default GospelResourcesElement