doxa-maps/plugin-designs/pplr-data-maps/index.js
Doxa Maps 1c63481832 Six entries hand-rolled the RTL text plugin; the library already installs it
Every one of these bundle entries carried its own copy of

    if (window.mapboxgl?.setRTLTextPlugin) { setRTLTextPlugin(url, null, true) }

which is a strict SUBSET of what library/maps/rtl-text.js already does, so the
copies could not be covering anything the library misses:

  - useMapInstance calls installRtlTextPlugin(gl) at line 450, before it builds a
    map at 537/567 -- registration still precedes construction, the one ordering
    Mapbox cares about.
  - the call is identical in effect: same v0.3.0 URL, same null callback, same
    lazy flag.
  - the block is mapboxgl-only. The library installs on MapLibre too, so every
    keyless embed was covered by the library and never by these blocks.
  - the single raw `new gl.Map` site (upg-100-list.vue:1894) installs for itself
    at 1835 and never depended on its entry.

I first justified this as deleting DEAD code, on the theory that the engine is
injected lazily so window.mapboxgl would not exist when an entry runs. That is
wrong and the measurement says so: every leaf index.html loads mapbox-gl.js as a
blocking <head> script while ./index.js is a deferred module, so the guard did
pass and the blocks were live. The reason to delete them is redundancy, which is
the weaker and truer claim.

A three-line pointer replaces each block so the next reader does not re-add a
Mapbox-only copy.
2026-09-26 13:35:57 +00:00

28 lines
1.2 KiB
JavaScript

/**
* pplr-data-maps / index.js — bundle entry (emits pplr-data-maps.js), defines <pplr-data-maps>.
*
* The standard ProfileLoader shape (see doxa-simple-map/index.js): the glob captures this
* folder's one profile, pplr-data-maps.vue; its ten views live in src/views/. The Mapbox RTL
* text plugin is registered once here: many PG names are Arabic, Urdu or Hebrew.
*/
import { defineCustomElement } from 'vue'
import { createPinia } from 'pinia'
import ProfileLoader from '@map/ProfileLoader.vue'
import { createAppI18n } from '@map/i18n/index.js'
const profileModules = import.meta.glob('./*.vue')
// 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.
const El = defineCustomElement(ProfileLoader, {
configureApp(app) {
app.use(createPinia())
const i18n = createAppI18n()
app.use(i18n)
app.provide('appI18n', i18n)
app.provide('profileModules', profileModules)
}
})
if (typeof customElements !== 'undefined' && !customElements.get('pplr-data-maps')) customElements.define('pplr-data-maps', El)