Country Posters' panes are in the page address: on its own leaf the open pane is ?pane= (Map; the first pane is the default), and nested it announces to the shell, the same opt-in as Regions and UPG100
This commit is contained in:
parent
c963a2a9fa
commit
4428156bfe
1 changed files with 9 additions and 1 deletions
|
|
@ -32,6 +32,7 @@
|
||||||
*/
|
*/
|
||||||
import { ref, computed, inject, onMounted, onBeforeUnmount } from 'vue'
|
import { ref, computed, inject, onMounted, onBeforeUnmount } from 'vue'
|
||||||
import { buildPaneColumn, PANE_GRID_STYLES } from '@map/layouts/pane-wrapper/pane-wrapper.js'
|
import { buildPaneColumn, PANE_GRID_STYLES } from '@map/layouts/pane-wrapper/pane-wrapper.js'
|
||||||
|
import { urlOwnerOf, ownAddress } from '@map/composables/useViewAddress.js'
|
||||||
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
|
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
|
||||||
import ViewSelect from '@map/components/ViewSelect.vue'
|
import ViewSelect from '@map/components/ViewSelect.vue'
|
||||||
import { countryName } from '@map/utils/countryName.js'
|
import { countryName } from '@map/utils/countryName.js'
|
||||||
|
|
@ -104,6 +105,11 @@ const view = computed({
|
||||||
})
|
})
|
||||||
let column = null
|
let column = null
|
||||||
let offScroll = null
|
let offScroll = null
|
||||||
|
let offOwn = null
|
||||||
|
// The page address (useViewAddress): ?pane= is the open view ('map'; the first pane is the default and never written).
|
||||||
|
// On this composite's own leaf it owns the address (ownAddress); nested in a shell it announces and the shell writes.
|
||||||
|
// The India pane exists only in an opted-in preview, so ?pane=india names nothing anywhere else.
|
||||||
|
const owner = () => urlOwnerOf(cfg.value)
|
||||||
|
|
||||||
// PAGE-LEVEL config keys a pane INHERITS from the host page. A cap-4 composite
|
// PAGE-LEVEL config keys a pane INHERITS from the host page. A cap-4 composite
|
||||||
// nests children as custom elements in THIS document, so anything the generator
|
// nests children as custom elements in THIS document, so anything the generator
|
||||||
|
|
@ -209,8 +215,9 @@ function onShowOnMap(e) {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
if (!stage.value) return
|
if (!stage.value) return
|
||||||
column = buildPaneColumn(spec.value, { host: stage.value })
|
column = buildPaneColumn(spec.value, { host: stage.value, address: { owner } })
|
||||||
if (!column) return
|
if (!column) return
|
||||||
|
offOwn = ownAddress(stage.value, owner)
|
||||||
for (const pane of column.panes) {
|
for (const pane of column.panes) {
|
||||||
if (!pane.config) continue
|
if (!pane.config) continue
|
||||||
// ★ KEEP THE ELEMENT. It used to be created and dropped on the same line, so there was no
|
// ★ KEEP THE ELEMENT. It used to be created and dropped on the same line, so there was no
|
||||||
|
|
@ -236,6 +243,7 @@ onMounted(() => {
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
window.removeEventListener(SHOW_ON_MAP, onShowOnMap)
|
window.removeEventListener(SHOW_ON_MAP, onShowOnMap)
|
||||||
offScroll?.()
|
offScroll?.()
|
||||||
|
offOwn?.()
|
||||||
column?.destroy()
|
column?.destroy()
|
||||||
column = null
|
column = null
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue