Prototype XL (lot 6a) : page xl-proto.html, style papier et trait, glyphes locaux, table d'épingles et ses tests
Seconde entrée Vite bâtie dans une passe à part (la démo reste identique à l'octet près), maplibre-gl 6.16.0 et pmtiles 4.5.0 importés par xl-proto.html seulement, glyphes Noto Sans servis par le build, quatre épingles posées aux centres de communes (geo.api.gouv.fr). Les tuiles (public/tuiles/*.pmtiles) restent hors git : pipeline/xl/README.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWGVn3MeAPFsoCSyLs2zZW
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fc9944468f
commit
0f98449cea
+101
@@ -0,0 +1,101 @@
|
||||
// Lecture de la table d'épingles XL (content/xl-epingles.md). Module pur : il reçoit le texte,
|
||||
// il rend des objets, ou une erreur qui dit la ligne à corriger. Aucun import de la carte ici,
|
||||
// pour que les tests le lisent sans navigateur.
|
||||
|
||||
/** Le rectangle de la carte (brief D1) : ouest, sud, est, nord. */
|
||||
export const RECTANGLE = { ouest: -0.4, sud: 42.65, est: 0.55, nord: 43.55 } as const;
|
||||
|
||||
export const COUCHES = ['existant', 'propose'] as const;
|
||||
export type Couche = (typeof COUCHES)[number];
|
||||
|
||||
export interface Epingle {
|
||||
id: string;
|
||||
lon: number;
|
||||
lat: number;
|
||||
couche: Couche;
|
||||
titre: string;
|
||||
base: string;
|
||||
statut: string;
|
||||
precision: string;
|
||||
phrase: string;
|
||||
ouvre?: string;
|
||||
}
|
||||
|
||||
const COLONNES = ['id', 'lon', 'lat', 'couche', 'titre', 'base', 'statut', 'precision', 'phrase', 'ouvre'] as const;
|
||||
|
||||
export class ErreurEpingles extends Error {
|
||||
ligne: number;
|
||||
constructor(ligne: number, message: string) {
|
||||
super(`content/xl-epingles.md, ligne ${ligne} : ${message}`);
|
||||
this.name = 'ErreurEpingles';
|
||||
this.ligne = ligne;
|
||||
}
|
||||
}
|
||||
|
||||
const cellules = (l: string) => l.trim().replace(/^\|/, '').replace(/\|$/, '').split('|').map((c) => c.trim());
|
||||
|
||||
/** Lit la première table du fichier dont l'en-tête commence par `id | lon | lat`. */
|
||||
export function lireEpingles(md: string): Epingle[] {
|
||||
const lignes = md.split(/\r?\n/);
|
||||
const debut = lignes.findIndex((l) => /^\|\s*id\s*\|\s*lon\s*\|\s*lat\s*\|/.test(l));
|
||||
if (debut < 0) throw new ErreurEpingles(1, 'aucune table « id | lon | lat | … » trouvée');
|
||||
const entete = cellules(lignes[debut]!);
|
||||
COLONNES.forEach((c, i) => {
|
||||
if (entete[i] !== c) throw new ErreurEpingles(debut + 1, `colonne ${i + 1} attendue « ${c} », trouvée « ${entete[i] ?? ''} »`);
|
||||
});
|
||||
const vues = new Set<string>();
|
||||
const sortie: Epingle[] = [];
|
||||
for (let i = debut + 2; i < lignes.length; i++) {
|
||||
const brute = lignes[i]!;
|
||||
if (!brute.trim().startsWith('|')) break;
|
||||
const n = i + 1;
|
||||
const c = cellules(brute);
|
||||
if (c.length !== COLONNES.length) throw new ErreurEpingles(n, `${c.length} cellules au lieu de ${COLONNES.length}`);
|
||||
const [id, lonT, latT, couche, titre, base, statut, precision, phrase, ouvre] = c as [string, string, string, string, string, string, string, string, string, string];
|
||||
if (!/^[a-z0-9-]+$/.test(id)) throw new ErreurEpingles(n, `identifiant « ${id} » : minuscules, chiffres et tirets seulement`);
|
||||
if (vues.has(id)) throw new ErreurEpingles(n, `identifiant « ${id} » en double`);
|
||||
vues.add(id);
|
||||
const lon = Number(lonT.replace(',', '.'));
|
||||
const lat = Number(latT.replace(',', '.'));
|
||||
if (!Number.isFinite(lon) || lon < RECTANGLE.ouest || lon > RECTANGLE.est) throw new ErreurEpingles(n, `longitude « ${lonT} » hors du rectangle (${RECTANGLE.ouest} à ${RECTANGLE.est})`);
|
||||
if (!Number.isFinite(lat) || lat < RECTANGLE.sud || lat > RECTANGLE.nord) throw new ErreurEpingles(n, `latitude « ${latT} » hors du rectangle (${RECTANGLE.sud} à ${RECTANGLE.nord})`);
|
||||
if (!(COUCHES as readonly string[]).includes(couche)) throw new ErreurEpingles(n, `couche « ${couche} » inconnue (existant ou propose)`);
|
||||
if (!titre) throw new ErreurEpingles(n, 'titre vide');
|
||||
if (!base) throw new ErreurEpingles(n, 'entrée de la base vide');
|
||||
if (ouvre && !/^https:\/\/[^\s]+$/.test(ouvre)) throw new ErreurEpingles(n, `lien « ${ouvre} » : une adresse https:// ou rien`);
|
||||
sortie.push({ id, lon, lat, couche: couche as Couche, titre, base, statut, precision, phrase, ...(ouvre ? { ouvre } : {}) });
|
||||
}
|
||||
if (!sortie.length) throw new ErreurEpingles(debut + 1, 'table vide');
|
||||
return sortie;
|
||||
}
|
||||
|
||||
/** Les épingles visibles quand seules les couches `actives` sont allumées. */
|
||||
export function filtrerParCouche(epingles: readonly Epingle[], actives: ReadonlySet<Couche>): Epingle[] {
|
||||
return epingles.filter((e) => actives.has(e.couche));
|
||||
}
|
||||
|
||||
/** Statut affiché tel quel quand il appelle une réserve (brief §4). */
|
||||
export function statutAffiche(statut: string): string | null {
|
||||
return /vérifier|partiel|visiter/i.test(statut) ? statut : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Décalage d'affichage (en pixels) pour les épingles posées au même point : elles s'écartent
|
||||
* en cercle autour du centre de la commune. La donnée ne bouge pas, seul le dessin s'écarte.
|
||||
*/
|
||||
export function decalages(epingles: readonly Epingle[], rayon = 24): Map<string, [number, number]> {
|
||||
const groupes = new Map<string, Epingle[]>();
|
||||
for (const e of epingles) {
|
||||
const k = `${e.lon.toFixed(5)},${e.lat.toFixed(5)}`;
|
||||
groupes.set(k, [...(groupes.get(k) ?? []), e]);
|
||||
}
|
||||
const sortie = new Map<string, [number, number]>();
|
||||
for (const g of groupes.values()) {
|
||||
g.forEach((e, i) => {
|
||||
if (g.length === 1) return void sortie.set(e.id, [0, 0]);
|
||||
const a = (2 * Math.PI * i) / g.length - Math.PI / 2;
|
||||
sortie.set(e.id, [Math.round(Math.cos(a) * rayon), Math.round(Math.sin(a) * rayon)]);
|
||||
});
|
||||
}
|
||||
return sortie;
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
// Prototype XL (lot ⑥a) : la Bigorre en carte vectorielle, tout servi par le build.
|
||||
// Bibliothèque groupée par Vite, worker copié dans dist/, glyphes dans public/xl/glyphs,
|
||||
// tuiles dans public/tuiles/bigorre.pmtiles (hors git, pipeline/xl/README.md). Aucun tiers.
|
||||
import '@fontsource/barlow/latin-400.css';
|
||||
import '@fontsource/barlow/latin-600.css';
|
||||
import 'maplibre-gl/dist/maplibre-gl.css';
|
||||
import './xl.css';
|
||||
import { Map as Carte, Marker, AttributionControl, NavigationControl, addProtocol, setWorkerUrl } from 'maplibre-gl';
|
||||
import urlWorker from 'maplibre-gl/dist/maplibre-gl-worker.mjs?url';
|
||||
import { Protocol } from 'pmtiles';
|
||||
import tableEpingles from '../content/xl-epingles.md?raw';
|
||||
import { lireEpingles, filtrerParCouche, statutAffiche, decalages, type Couche, type Epingle } from './epingles.ts';
|
||||
import { construireStyle, VUE_DEPART, BORNES, ZOOM_MIN, ZOOM_MAX, TUILES } from './style.ts';
|
||||
|
||||
const $ = <T extends HTMLElement>(s: string) => document.querySelector(s) as T;
|
||||
const etat = $<HTMLParagraphElement>('#etat');
|
||||
const dire = (t: string, erreur = false) => {
|
||||
etat.textContent = t;
|
||||
etat.hidden = !t;
|
||||
etat.classList.toggle('erreur', erreur);
|
||||
};
|
||||
const mouvementReduit = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||
|
||||
/** Le fichier de tuiles est-il là, et servi par plages ? (sinon : un message lisible, pas une carte vide) */
|
||||
async function tuilesPresentes(url: string): Promise<boolean> {
|
||||
try {
|
||||
const r = await fetch(url, { headers: { Range: 'bytes=0-6' } });
|
||||
if (!r.ok) return false;
|
||||
const debut = new TextDecoder().decode(new Uint8Array(await r.arrayBuffer()).slice(0, 7));
|
||||
return debut === 'PMTiles';
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
async function demarrer() {
|
||||
let epingles: Epingle[];
|
||||
try {
|
||||
epingles = lireEpingles(tableEpingles);
|
||||
} catch (e) {
|
||||
dire(String((e as Error).message), true);
|
||||
throw e;
|
||||
}
|
||||
const urlTuiles = new URL(TUILES, location.href).href;
|
||||
if (!(await tuilesPresentes(urlTuiles))) {
|
||||
dire('Le fond de carte n’est pas encore posé sur ce serveur (fichier tuiles/bigorre.pmtiles absent). Les épingles restent dans content/xl-epingles.md.', true);
|
||||
document.body.classList.add('sans-tuiles');
|
||||
return;
|
||||
}
|
||||
|
||||
setWorkerUrl(urlWorker);
|
||||
const protocole = new Protocol();
|
||||
addProtocol('pmtiles', protocole.tile);
|
||||
|
||||
const carte = new Carte({
|
||||
container: 'carte',
|
||||
style: construireStyle(location.href),
|
||||
center: VUE_DEPART.centre,
|
||||
zoom: VUE_DEPART.zoom,
|
||||
pitch: VUE_DEPART.pitch,
|
||||
bearing: VUE_DEPART.bearing,
|
||||
minZoom: ZOOM_MIN,
|
||||
maxZoom: ZOOM_MAX,
|
||||
maxBounds: BORNES,
|
||||
attributionControl: false,
|
||||
fadeDuration: mouvementReduit ? 0 : 300,
|
||||
cooperativeGestures: false,
|
||||
});
|
||||
carte.addControl(new AttributionControl({ compact: false }), 'bottom-right');
|
||||
carte.addControl(new NavigationControl({ showZoom: false, visualizePitch: true }), 'top-right');
|
||||
(window as any).__xl = { carte, repos: false };
|
||||
|
||||
carte.once('load', () => dire(''));
|
||||
carte.on('idle', () => ((window as any).__xl.repos = true));
|
||||
carte.on('error', (e) => console.warn('carte :', e.error?.message ?? e));
|
||||
|
||||
// Les épingles : des boutons HTML posés par des marqueurs (P6 : clavier, cibles ≥ 40 px).
|
||||
const panneau = $<HTMLElement>('#panneau');
|
||||
const ecarts = decalages(epingles);
|
||||
const marqueurs = new Map<string, { m: Marker; e: Epingle }>();
|
||||
for (const e of epingles) {
|
||||
const b = document.createElement('button');
|
||||
b.type = 'button';
|
||||
b.className = `epingle c-${e.couche}`;
|
||||
b.dataset.id = e.id;
|
||||
b.setAttribute('aria-label', `${e.titre} (${e.couche === 'existant' ? 'l’existant' : 'ce qu’on propose'})`);
|
||||
b.innerHTML = '<span aria-hidden="true"></span>';
|
||||
b.addEventListener('click', (ev) => {
|
||||
ev.stopPropagation();
|
||||
ouvrir(e);
|
||||
});
|
||||
const m = new Marker({ element: b, offset: ecarts.get(e.id) ?? [0, 0], pitchAlignment: 'viewport', rotationAlignment: 'viewport' }).setLngLat([e.lon, e.lat]).addTo(carte);
|
||||
marqueurs.set(e.id, { m, e });
|
||||
}
|
||||
|
||||
function ouvrir(e: Epingle) {
|
||||
panneau.querySelector('.couche')!.textContent = e.couche === 'existant' ? 'L’existant' : 'Ce qu’on propose';
|
||||
panneau.querySelector('h2')!.textContent = e.titre;
|
||||
panneau.querySelector('.phrase')!.textContent = e.phrase;
|
||||
const s = statutAffiche(e.statut);
|
||||
panneau.querySelector('.statut')!.textContent = `${s ? `Statut dans la base : ${s}. ` : ''}Position provisoire : centre de la commune (${e.precision}).`;
|
||||
const lien = panneau.querySelector('.lien')!;
|
||||
lien.replaceChildren();
|
||||
if (e.ouvre) {
|
||||
const a = document.createElement('a');
|
||||
a.href = e.ouvre;
|
||||
a.target = '_blank';
|
||||
a.rel = 'noopener';
|
||||
a.textContent = `${new URL(e.ouvre).hostname} (nouvel onglet)`;
|
||||
lien.append(a);
|
||||
}
|
||||
panneau.hidden = false;
|
||||
document.querySelectorAll('.epingle').forEach((x) => x.classList.toggle('active', (x as HTMLElement).dataset.id === e.id));
|
||||
const cible = { center: [e.lon, e.lat] as [number, number], offset: [0, -window.innerHeight * 0.12] as [number, number] };
|
||||
if (mouvementReduit) carte.jumpTo(cible);
|
||||
else carte.easeTo({ ...cible, duration: 600 });
|
||||
(panneau.querySelector('.fermer') as HTMLButtonElement).focus({ preventScroll: true });
|
||||
}
|
||||
const fermer = () => {
|
||||
panneau.hidden = true;
|
||||
document.querySelectorAll('.epingle.active').forEach((x) => x.classList.remove('active'));
|
||||
};
|
||||
panneau.querySelector('.fermer')!.addEventListener('click', fermer);
|
||||
document.addEventListener('keydown', (ev) => ev.key === 'Escape' && fermer());
|
||||
|
||||
// Les deux filtres (§4) : deux boutons à bascule, les deux allumés au départ.
|
||||
const actives = new Set<Couche>(['existant', 'propose']);
|
||||
document.querySelectorAll<HTMLButtonElement>('.filtre').forEach((b) =>
|
||||
b.addEventListener('click', () => {
|
||||
const c = b.dataset.couche as Couche;
|
||||
if (actives.has(c)) actives.delete(c);
|
||||
else actives.add(c);
|
||||
b.setAttribute('aria-pressed', String(actives.has(c)));
|
||||
const visibles = new Set(filtrerParCouche(epingles, actives).map((e) => e.id));
|
||||
for (const [id, { m }] of marqueurs) m.getElement().hidden = !visibles.has(id);
|
||||
if (!panneau.hidden && !visibles.has(String(document.querySelector<HTMLElement>('.epingle.active')?.dataset.id))) fermer();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
demarrer().catch((e) => console.error(e));
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
// Le style « papier et trait » de la carte XL (brief P3). Tout vient de la palette de la démo
|
||||
// (maquette/style.css) ; aucune adresse d'un autre hôte : les glyphes et les tuiles sont résolus
|
||||
// depuis l'adresse de la page, au moment de construire le style.
|
||||
import type { StyleSpecification, LayerSpecification } from 'maplibre-gl';
|
||||
|
||||
// --- Constantes qui renversent les décisions (RECAP §2) ---------------------------------------
|
||||
|
||||
/** Zoom maximal des tuiles extraites (D2 : plus grand zoom dont le fichier reste sous 60 Mo). */
|
||||
export const ZOOM_MAX = 14;
|
||||
/** Zoom minimal de la vue (P4). */
|
||||
export const ZOOM_MIN = 8;
|
||||
/** Vue de départ (P4) : Tarbes, inclinaison 45°, cap nord. `zoom` est le réglage qui pèse le plus sur le premier affichage. */
|
||||
export const VUE_DEPART = { centre: [0.0653, 43.2387] as [number, number], zoom: 10, pitch: 45, bearing: 0 };
|
||||
/** Bornes de la vue (P4) : le rectangle de D1. */
|
||||
export const BORNES: [[number, number], [number, number]] = [[-0.4, 42.65], [0.55, 43.55]];
|
||||
/** Fichier de tuiles, relatif à la page (D4). */
|
||||
export const TUILES = 'tuiles/bigorre.pmtiles';
|
||||
/** Police des étiquettes : un seul jeu de glyphes servi par le build (P1). */
|
||||
export const POLICE = 'NotoSansRegular';
|
||||
/** Routes visibles avant le zoom 11 : départementales et au-dessus (P3). */
|
||||
export const ROUTES_TOT = ['highway', 'major_road'];
|
||||
/** Zoom d'apparition du bâti (P3). */
|
||||
export const ZOOM_BATI = 13;
|
||||
|
||||
// Palette : recopiée de maquette/style.css (:root). Aucun hex nouveau.
|
||||
export const PAL = {
|
||||
papier: '#efeee2', // --papier
|
||||
papier2: '#fffdf6', // --papier-2
|
||||
encre: '#102a3a', // --encre
|
||||
encre2: '#3f5563', // --encre-2
|
||||
trait: '#ddd8c4', // --trait
|
||||
eau: '#3a74a8', // --eau
|
||||
eauFond: '#e1ebf5', // --eau-fond
|
||||
vivant: '#8f7b22', // --vivant
|
||||
auj: '#6b6458', // --auj
|
||||
} as const;
|
||||
|
||||
export const ATTRIBUTION =
|
||||
'<a href="https://protomaps.com" target="_blank" rel="noopener">Protomaps</a> · <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener">© OpenStreetMap</a>';
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
const nom: any = ['coalesce', ['get', 'name:fr'], ['get', 'name']];
|
||||
|
||||
function couches(): LayerSpecification[] {
|
||||
return [
|
||||
{ id: 'fond', type: 'background', paint: { 'background-color': PAL.papier } },
|
||||
{
|
||||
id: 'forets',
|
||||
type: 'fill',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'landuse',
|
||||
filter: ['in', ['get', 'kind'], ['literal', ['forest', 'wood']]],
|
||||
paint: { 'fill-color': PAL.vivant, 'fill-opacity': 0.2, 'fill-antialias': false },
|
||||
},
|
||||
{
|
||||
id: 'eau-surfaces',
|
||||
type: 'fill',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'water',
|
||||
filter: ['==', ['geometry-type'], 'Polygon'],
|
||||
paint: { 'fill-color': PAL.eau, 'fill-opacity': 0.42 },
|
||||
},
|
||||
{
|
||||
id: 'eau-cours',
|
||||
type: 'line',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'water',
|
||||
filter: ['all', ['==', ['geometry-type'], 'LineString'], ['any', ['in', ['get', 'kind'], ['literal', ['river', 'canal']]], ['>=', ['zoom'], 11]]],
|
||||
paint: { 'line-color': PAL.eau, 'line-opacity': 0.75, 'line-width': ['interpolate', ['linear'], ['zoom'], 8, 0.5, 12, 1.2, 14, 2] },
|
||||
},
|
||||
{
|
||||
id: 'bati',
|
||||
type: 'fill',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'buildings',
|
||||
minzoom: ZOOM_BATI,
|
||||
paint: { 'fill-color': PAL.auj, 'fill-opacity': 0.28 },
|
||||
},
|
||||
{
|
||||
id: 'limites-communes',
|
||||
type: 'line',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'boundaries',
|
||||
filter: ['all', ['==', ['get', 'kind'], 'locality'], ['==', ['to-string', ['get', 'kind_detail']], '8']],
|
||||
paint: { 'line-color': PAL.encre2, 'line-opacity': 0.32, 'line-width': 0.7, 'line-dasharray': [2, 3] },
|
||||
},
|
||||
{
|
||||
id: 'routes',
|
||||
type: 'line',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'roads',
|
||||
filter: [
|
||||
'any',
|
||||
['in', ['get', 'kind'], ['literal', ROUTES_TOT]],
|
||||
['all', ['>=', ['zoom'], 11], ['==', ['get', 'kind'], 'minor_road']],
|
||||
],
|
||||
layout: { 'line-cap': 'round', 'line-join': 'round' },
|
||||
paint: {
|
||||
'line-color': PAL.auj,
|
||||
'line-opacity': ['match', ['get', 'kind'], 'minor_road', 0.4, 0.7],
|
||||
'line-width': ['interpolate', ['linear'], ['zoom'], 8, ['match', ['get', 'kind'], 'highway', 0.9, 0.5], 12, ['match', ['get', 'kind'], 'highway', 1.6, 'minor_road', 0.5, 1], 14, ['match', ['get', 'kind'], 'highway', 2.4, 'minor_road', 1, 1.6]],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'communes',
|
||||
type: 'symbol',
|
||||
source: 'bigorre',
|
||||
'source-layer': 'places',
|
||||
filter: ['all', ['==', ['get', 'kind'], 'locality'], ['in', ['get', 'kind_detail'], ['literal', ['city', 'town', 'village']]], ['<=', ['coalesce', ['get', 'min_zoom'], 0], ['+', ['zoom'], 1]]],
|
||||
layout: {
|
||||
'text-field': nom,
|
||||
'text-font': [POLICE],
|
||||
'text-size': ['interpolate', ['linear'], ['zoom'], 8, ['match', ['get', 'kind_detail'], 'city', 15, 'town', 12, 10.5], 13, ['match', ['get', 'kind_detail'], 'city', 19, 'town', 16, 14]],
|
||||
'symbol-sort-key': ['-', 0, ['coalesce', ['get', 'population_rank'], 0]],
|
||||
'text-padding': 4,
|
||||
'text-max-width': 8,
|
||||
},
|
||||
paint: { 'text-color': PAL.encre2, 'text-halo-color': PAL.papier2, 'text-halo-width': 1.4 },
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/** Le style complet. `page` est l'adresse de la page (location.href) : tout se résout depuis elle. */
|
||||
export function construireStyle(page: string): StyleSpecification {
|
||||
const base = new URL('./', page).href;
|
||||
return {
|
||||
version: 8,
|
||||
name: 'Bigorre, papier et trait (prototype XL)',
|
||||
glyphs: `${base}xl/glyphs/{fontstack}/{range}.pbf`,
|
||||
sources: {
|
||||
bigorre: {
|
||||
type: 'vector',
|
||||
url: `pmtiles://${base}${TUILES}`,
|
||||
attribution: ATTRIBUTION,
|
||||
},
|
||||
},
|
||||
layers: couches(),
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/* Prototype XL : la page autour de la carte. Couleurs de maquette/style.css, recopiées. */
|
||||
:root {
|
||||
--papier: #efeee2; --papier-2: #fffdf6; --encre: #102a3a; --encre-2: #3f5563; --trait: #ddd8c4;
|
||||
--eau: #3a74a8; --vivant: #8f7b22; --vivant-encre: #62560f; --auj: #6b6458; --auj-encre: #4a443b;
|
||||
--ombre: 0 10px 30px rgba(16, 42, 58, .14);
|
||||
}
|
||||
html, body { margin: 0; height: 100%; background: var(--papier); color: var(--encre); font-family: Barlow, system-ui, sans-serif; }
|
||||
#xl { position: fixed; inset: 0; overflow: hidden; }
|
||||
#carte { position: absolute; inset: 0; background: var(--papier); }
|
||||
button { font: inherit; color: inherit; }
|
||||
|
||||
.filtres { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; display: flex; gap: 8px; z-index: 3; }
|
||||
.filtre { min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1.5px solid var(--encre-2); background: var(--papier-2); font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: var(--ombre); }
|
||||
.filtre[data-couche="existant"] { border-color: var(--auj-encre); }
|
||||
.filtre[data-couche="propose"] { border-color: var(--vivant-encre); }
|
||||
.filtre[aria-pressed="true"][data-couche="existant"] { background: var(--auj-encre); color: var(--papier-2); }
|
||||
.filtre[aria-pressed="true"][data-couche="propose"] { background: var(--vivant-encre); color: var(--papier-2); }
|
||||
.filtre:focus-visible, .epingle:focus-visible, .quartier:focus-visible, .fermer:focus-visible { outline: 3px solid var(--eau); outline-offset: 2px; }
|
||||
|
||||
.etat { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); margin: 0; max-width: 300px; padding: 12px 16px; text-align: center; border-radius: 10px; background: var(--papier-2); color: var(--encre-2); box-shadow: var(--ombre); z-index: 2; font-size: 15px; }
|
||||
.etat.erreur { color: var(--encre); border: 1.5px solid var(--auj-encre); }
|
||||
.etat[hidden] { display: none; }
|
||||
|
||||
/* Épingles : une cible de 40 px, un rond de 18 px dedans. */
|
||||
.epingle { width: 40px; height: 40px; padding: 0; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
|
||||
.epingle[hidden] { display: none; }
|
||||
.epingle > span { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--papier-2); box-shadow: 0 1px 4px rgba(16, 42, 58, .35); }
|
||||
.epingle.c-existant > span { background: var(--auj-encre); }
|
||||
.epingle.c-propose > span { background: var(--vivant-encre); }
|
||||
.epingle.active > span { width: 24px; height: 24px; border-color: var(--encre); }
|
||||
|
||||
.panneau { position: absolute; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 4; max-height: 40vh; overflow: auto; padding: 14px 44px 14px 16px; border-radius: 14px; background: var(--papier-2); box-shadow: var(--ombre); }
|
||||
.panneau[hidden] { display: none; }
|
||||
.panneau h2 { margin: 2px 0 6px; font-size: 18px; line-height: 1.2; }
|
||||
.panneau p { margin: 0 0 6px; font-size: 15px; line-height: 1.35; }
|
||||
.panneau .couche { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--encre-2); }
|
||||
.panneau .statut { font-size: 13px; color: var(--encre-2); }
|
||||
.panneau .lien a { color: var(--eau); font-weight: 600; }
|
||||
.fermer { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: var(--encre-2); }
|
||||
|
||||
.quartier { position: absolute; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3; min-height: 44px; display: flex; align-items: center; padding: 0 20px; border-radius: 22px; background: var(--encre); color: var(--papier-2); font-weight: 600; font-size: 16px; text-decoration: none; box-shadow: var(--ombre); white-space: nowrap; }
|
||||
|
||||
/* Attribution : lisible à 390 px, au-dessus du bouton du bas. */
|
||||
.maplibregl-ctrl-bottom-right { bottom: calc(60px + env(safe-area-inset-bottom)); }
|
||||
.maplibregl-ctrl-attrib { background: rgba(255, 253, 246, .85) !important; font-size: 12px; }
|
||||
.maplibregl-ctrl-attrib a { color: var(--encre-2); }
|
||||
.maplibregl-ctrl-top-right { top: calc(56px + env(safe-area-inset-top)); }
|
||||
body.sans-tuiles .filtres { opacity: .5; }
|
||||
Reference in New Issue
Block a user