feat(settings): pick your own map template or the theme style for MapLibre

The MapLibre style picker offers two more entries after the OpenFreeMap
styles: OpenFreeMap that follows the light or dark theme (trek:ofm-auto),
and the user's own map template (trek:template), which brings the template
field under the picker, and the CARTO key for a CARTO template. Where the
trip map will draw the template with the classic 2D map (Amap, a host the
CSP does not name) the form says so and the preview shows that map. The
preview draws exactly what the trip map will.

Every place the forms load or save a MapLibre style keeps a keyword now,
where it used to turn it into Liberty on the first unchanged save: the
user form on desktop and phone (load, save, the phone's mirrored field,
a provider switch there and back) and the admin defaults (provider switch,
preset pick, typed style). The rules live in mapSettingsModel, so both
shells render from one decision:

- the template keyword with an empty template saves Liberty;
- switching from Leaflet with a template and an empty MapLibre slot
  preselects the template, shown and not saved until Save;
- Leaflet never writes a keyword into the Mapbox slot, and Mapbox shows its
  default for one.

New strings in all locales.
This commit is contained in:
Maurice
2026-11-30 15:35:46 +01:00
parent d39d544297
commit 69eacd5316
40 changed files with 726 additions and 147 deletions
@@ -1,6 +1,7 @@
import { useEffect, useRef } from 'react'
import { isStandardFamily } from '../Map/mapboxSetup'
import { applyGl3d, glMapOptions } from '../Map/glMapOptions'
import type { GlStyle } from '../Map/glBasemap'
import { normalizeStyleForProvider, type GlMapProvider } from '../Map/glProviders'
import { buildGlMap } from '../Map/glSupport'
import { setBasemapConfig } from '../Map/useStandardBasemapConfig'
@@ -9,7 +10,8 @@ import { fs } from '../shared/DialogShell'
interface Props {
provider?: GlMapProvider
token?: string
style: string
/** A style URL, or the style a MapLibre keyword resolved to (useMapSettingsForm). */
style: GlStyle
lat: number
lng: number
zoom: number
@@ -34,7 +36,7 @@ export default function GlMapPreview({ provider = 'mapbox-gl', token = '', style
const onClickRef = useRef(onClick)
onClickRef.current = onClick
const isMapLibre = provider === 'maplibre-gl'
const glStyle = normalizeStyleForProvider(provider, style)
const glStyle = typeof style === 'string' ? normalizeStyleForProvider(provider, style) : style
const enableMapbox3d = !isMapLibre && enable3d
useEffect(() => {