doxa-maps/library/utils
Doxa Maps 725467a9de Country names in the reader's language, for all 242
Our data speaks ISO alpha-3. Intl.DisplayNames('region') takes alpha-2 or
UN M49 and NOT alpha-3, so every country name was stuck in English for want
of the join.

Vendored CLDR cldr-core 48.2.2 (Unicode-3.0, 36KB, sha256 and source URL
recorded in library/vendor/cldr/README.md). No npm dependency: a package
would pull the whole supplemental tree and make a shipped data file depend
on an install step, where a vendored copy lets the generator reproduce the
map offline -- which is the point of vendoring rather than merely having a
copy.

generate-iso3-to-alpha2.mjs joins it against the 242 codes in
countries.json and GRADES ITS OWN OUTPUT, writing nothing on failure: 242
coverage, injectivity, two-letter well-formedness, and that each documented
exception is still needed. KOS -> XK is the only exception -- Kosovo has no
ISO 3166-1 assignment, so no refresh will ever supply it, and XK is the
user-assigned code CLDR itself uses in locale ids. It is recorded with its
reason instead of patched into the vendored bytes.

countryName(iso3, locale) falls back localized name -> canonical English
name -> the code. Intl.DisplayNames THROWS on a missing or malformed code
rather than returning null, so the guard is checked before asking; the
probe demonstrates that throw rather than asserting it in a comment. An
unassigned-but-well-formed region returns the input unchanged, so that case
falls back instead of rendering "DE" as a name.

THE RESEARCH SPINE MAP IS NOT TOUCHED. iso3-to-iso2.json is a different
file with a different job -- the 176-country spine that drives the data
fetches -- and expanding it is a Driver decision, not a side effect of
adding country names. The generator cross-checks it and REPORTS
disagreements without rewriting. There are none: CLDR independently agrees
with all 176 values, including the two corrected this session.

Also fixes a duplicate "check:religion-label-not-value" key in
package.json, left by a merge. JSON keeps the last, so one description was
silently dead and check:doc-scripts could not see it; bun's parser warned.
The surviving entry absorbs the only fact the dead one carried, the two
library sites by name.
2026-09-27 04:14:31 +00:00
..
.gitkeep doxa-maps — portable bundler for embeddable JAMstack maps 2026-09-10 01:53:07 +00:00
apiBaseUrl.js doxa-maps — portable bundler for embeddable JAMstack maps 2026-09-10 01:53:07 +00:00
ClusterHelpers.js consolidate docs into documentation/ and deployment shells into deployment/ 2026-09-21 23:23:23 +00:00
colocation.js The prayer map's legends see the pins it draws 2026-09-27 02:17:35 +00:00
countries-meta.js Regions: one rollup, ported from theirs, instead of two copies 2026-09-24 04:01:34 +00:00
countryName.js Country names in the reader's language, for all 242 2026-09-27 04:14:31 +00:00
DataSourceManager.js Complete app-profiles->plugin-designs sweep across comments/docs; build green; layouts kept at root (load-bearing) 2026-09-17 18:18:19 +00:00
embedBase.js Dev server: every plugin reaches the asset pool again (no polygons, previews, fonts or tables in dev) 2026-09-25 23:17:35 +00:00
geoUtils.js Research tabs read at 15px; the status red is a step brighter 2026-09-17 02:38:38 -05:00
html.js Map popups show data as text: a people-group name or country field can no longer run script 2026-09-26 05:50:24 +00:00
loadPinnedUmd.js One pinned-UMD loader for PPLR and the Wall: library/utils/loadPinnedUmd.js 2026-09-26 07:24:25 +00:00
MSTClusteringUtil.js "MST" clustering draws again: a true spanning tree in under a second instead of a 12-second freeze 2026-09-26 04:38:59 +00:00
NetworkClusteringUtil.js doxa-maps — portable bundler for embeddable JAMstack maps 2026-09-10 01:53:07 +00:00
README.md Host-agnostic share links, token-endpoint chain, dev playground as reusable modules, share/asset gates, validated profile-type vocabulary 2026-09-16 12:10:38 -05:00
viewportScrim.js Land the prayer facet and the scrim helper 2026-09-22 21:50:32 +00:00

library/utils/ — pure JS helpers

No Vue, no Pinia, no Mapbox. Anything reactive is a composable; anything stateful is a store.

File Purpose
apiBaseUrl.js Resolves the API base URL at runtime (window.MAP_APP_API_URL / VITE_API_BASE_URL)
embedBase.js Share/embed URL ladder — the built bundle derives its tree root from its own script url (profileConfig.shareUrl / embedBaseUrl / window.MAP_EMBED_BASE_URL override) so tree-relative <bundle>/<profile>/index.html links work on any host
geoUtils.js Centroid, bounds, validation, GeoJSON helpers
ClusterHelpers.js Shared helpers for the two clustering utilities below
MSTClusteringUtil.js Minimum-spanning-tree clustering for affinity blocks
NetworkClusteringUtil.js Network-line clustering — connect nearby pins with edges
  • No import { ref } from 'vue' and no import mapboxgl in this folder — operate on plain [lng, lat] arrays.
  • Named exports (for tree-shaking), JSDoc on every export.
  • Writing reactive logic or needing Mapbox APIs? That's a composable — move it to ../composables/.