doxa-maps/plugin-designs/posterverse/index.js
Doxa Maps 5a6b226a19 Posterverse: a capability-5 app shell for every poster plugin
<posterverse-app> is a vertical-tab rail of whole poster plugins, each mounted
as its real element from the manifest: UPG 100 List Posters (upg-100-mfe),
Country Posters (country-posters-mfe), Poster Design, and an Experimental
folder of Wall of People Groups, All People Groups, UPG Neighbor and Bible
Posters. It reuses VerticalTabsLayout, loadScriptOnce/whenTagDefined and the
Research Gallery's profile-config contract (urlSync:false, mapTitle, token
ladder, treeBase, assetsBase).

The whole rail is an allow-list (src/tabs.js), so a gated plugin such as
key-cities can never appear. Rows whose bundle is not in the tree are pruned;
Poster Design and Bible Posters carry provisional ids until their bundles land.
meta.json declares nested-mfe-spa and composes the five rows that exist, so
the Plugin Studio lists it under capability 5.

check:posterverse-shelf (in gates:pre) asserts the allow-list, the key-cities
exclusion, composite-not-leaf resolution, composes/rail agreement and
11-locale string parity; --self-test plants one defect per arm.
2026-09-30 21:32:51 +00:00

37 lines
1.5 KiB
JavaScript

/**
* posterverse / index.js — bundle entry (capability 5, nested-mfe-spa / app shell).
*
* ONE folder -> ONE bundle -> ONE custom element: <posterverse-app>. (A custom-element name needs a
* hyphen, so the tag cannot be the bare folder name.)
*
* It registers only its own tag. It never imports another plugin's components and never re-registers a
* tag another bundle owns: each nested poster plugin registers its own tag when its script loads.
*
* TREE BASE: to find each nested plugin's script, the shell needs the built tree's root URL. It is
* derived HERE, at IIFE load, from this script's own URL (.../<tree>/posterverse/posterverse.js, two
* levels up), so the element self-locates wherever the tree is served. A host can override it with
* the tree-base="" attribute or profile-config.treeBase.
*
* Usage from a host page:
* <script src="/dx-maps/posterverse/posterverse.js"></script>
* <posterverse-app></posterverse-app>
*/
import { defineCustomElement } from 'vue'
import Posterverse from './posterverse.vue'
import { deriveTreeBase } from '@map/utils/embedScript.js'
// Captured synchronously at IIFE load, while document.currentScript is still this bundle's tag.
const TREE_BASE = deriveTreeBase()
const PosterverseElement = defineCustomElement(Posterverse, {
configureApp(app) {
app.provide('pvTreeBase', TREE_BASE)
}
})
if (typeof customElements !== 'undefined' && !customElements.get('posterverse-app')) {
customElements.define('posterverse-app', PosterverseElement)
}
export default PosterverseElement