Compare commits
238
Commits
@@ -7,3 +7,4 @@ dist
|
||||
*.log
|
||||
|
||||
*.tmp.*
|
||||
.firecrawl/
|
||||
|
||||
@@ -0,0 +1,163 @@
|
||||
# Design system nav-carte (AEP)
|
||||
|
||||
Ce fichier existe pour que B6 à B9 n'aient pas à relire les récaps de B3 (`1 PROJETS/DEV/AEP/Cascade-Refonte/recaps/B3-*.md` dans le vault Dropbox) pour comprendre ce qui a été posé. Si tu es sur B6+ et que tu touches au visuel de nav-carte, lis ceci d'abord.
|
||||
|
||||
## D'où viennent les tokens
|
||||
|
||||
Les couleurs, espacements, rayons, ombres, etc. ne sont **jamais** des valeurs en dur dans les composants nav-carte. Ils viennent de deux fichiers, chargés dans cet ordre dans `nuxt.config.ts` :
|
||||
|
||||
1. `@transformer/ui/tokens.css` — package npm partagé (`git+https://git.trans-former.fr/jules/design-system.git`), le schéma canonique de tokens par **rôle** (`--bg`, `--text`, `--primary`, `--focus-ring`, `--space-*`, `--radius-*`, `--fs-*`, etc.). Jamais cloné en local, jamais modifié depuis ce repo.
|
||||
2. `@transformer/ui/theme/aep.css` — la palette AEP spécifique (« Sobre institutionnel », validée par Jules), qui surcharge les rôles du point 1 avec les vraies couleurs : bleu nuit `#1a2238`, accent safran `#f5b342`, fond crème `#f8f6f1`. C'est ce fichier qui rend `--primary`, `--accent`, `--bg` etc. concrets pour AEP.
|
||||
|
||||
`assets/css/main.css` définit ensuite des variables `--nav-*` (héritées de l'ancienne palette V1, avant l'arrivée du DS). Elles sont **alias** des rôles ci-dessus : `--nav-bg: var(--bg)`, `--nav-text: var(--text)`, etc. Elles existent uniquement parce que tout le code existant (avant B3) les consomme — ne pas les supprimer sans grep préalable, ne pas en créer de nouvelles : pour du code neuf, consommer directement les tokens `--bg`/`--text`/`--primary`/... du DS.
|
||||
|
||||
**Trois variables restent volontairement non-aliasées**, propres à nav-carte :
|
||||
|
||||
- `--nav-primary-raw` — triplet RGB (`26, 34, 56`) utilisé dans des `rgba(var(--nav-primary-raw), x)`. Le DS n'expose pas de triplet RGB séparé, seulement des couleurs finales.
|
||||
- `--nav-primary-solid` — bleu nuit plein (`#1a2238` clair, `#c8d2f0` sombre). Différent de `--primary` du DS, qui est le bleu nuit à 60 % d'opacité (utilisé pour les surfaces translucides). `--nav-primary-solid` sert au texte et aux éléments qui doivent rester lisibles en plein (logo, soulignement d'onglet actif).
|
||||
- `--nav-text-on-primary` — texte de contraste, gardé en valeur littérale (`#f8f6f1` clair / `#111520` sombre) plutôt qu'aliasé sur `--on-primary` du DS. **Raison** : cette variable sert de texte de contraste sur DEUX fonds différents dans le code existant — `--nav-primary` (translucide) ET `--nav-primary-solid` (opaque) — qui ont une légèreté **inversée** en mode sombre (le translucide rend sombre une fois mélangé au fond, le solid `#c8d2f0` est un lavande clair). Le rôle `--on-primary` du DS ne colle qu'au premier cas ; l'aliaser cassait le contraste à une dizaine d'endroits (logo « AEP », boutons, bandeaux) en sombre. Si tu ajoutes un nouvel usage de cette variable, vérifie d'abord sur QUEL fond (translucide ou solid) le texte doit être lisible.
|
||||
|
||||
Dark mode : classe `.dark` posée sur `<html>` (`document.documentElement.classList.add('dark')`, persisté dans `localStorage.aep_theme`). `theme/aep.css` définit ses valeurs sombres sous le sélecteur `:root.dark, :root[data-theme="dark"]` — les deux formes sont acceptées, mais nav-carte n'utilise que `.dark`. Pas de bascule automatique par `prefers-color-scheme` (décision explicite : le site n'en a jamais eu, ça changerait ce que voient les visiteurs par défaut).
|
||||
|
||||
## Grammaire des chips par dimension
|
||||
|
||||
Trois dimensions, trois traitements visuels — posés en B3-M1, pensés pour rester stables jusqu'à B4+ (nouvelles dimensions à ajouter, pas à réinventer) :
|
||||
|
||||
| Dimension | Variant | Rendu inactif | Rendu actif |
|
||||
|---|---|---|---|
|
||||
| Échelle (national/régional/local) | `echelle` | outline, fond transparent | fond `--primary` plein, texte `--on-primary` |
|
||||
| Fonction / hashtag | `fonction` (défaut) | fond `--bg-alt` | fond `--primary` plein, texte `--on-primary` |
|
||||
| Posture (consommée depuis B4a : `postures` en mode Pratiques de `/`) | `posture` | outline safran (`--accent`) | fond `--accent` plein, texte `--on-accent` **sombre** — jamais blanc sur safran (voir règle de contraste plus bas) |
|
||||
|
||||
Composants : `components/Chip.vue` (une chip, `<button>` ou `<span>` selon `as`) et `components/ChipGroup.vue` (conteneur `role="group"`, `flex-wrap`, gap). Toujours les deux ensemble — jamais une chip nue hors groupe (accessibilité : le groupe porte l'`aria-label` qui dit ce qu'on filtre).
|
||||
|
||||
```vue
|
||||
<ChipGroup aria-label="Filtrer par fonction">
|
||||
<Chip
|
||||
v-for="fn in fonctions"
|
||||
:key="fn"
|
||||
:label="fn"
|
||||
variant="fonction"
|
||||
:active="selected.includes(fn)"
|
||||
@toggle="toggleFonction(fn)"
|
||||
/>
|
||||
</ChipGroup>
|
||||
```
|
||||
|
||||
Pour une chip non cliquable (affichage seul, ex. liste de résultats) : `as="span"` — pas de `type="button"`, pas d'`aria-pressed`, pas de handler `@toggle` nécessaire.
|
||||
|
||||
## FicheMiniCard + useFicheAdapter — brancher une nouvelle source
|
||||
|
||||
`composables/useFicheAdapter.ts` expose `toMini(source): MiniFiche`, où `MiniFiche = { id, nom, resume, chips, echelle?, geoloc, kind }`. Il distingue `Org` (NocoDB, mode `entraide` de `/`) et `StructureV2` (JSON statique `reseaux-bifurcation.json`, mode `pratiques` de `/`, ex-`/agences` depuis B4a) via `'famille_principale' in source` (seul champ propre à `StructureV2`).
|
||||
|
||||
**Pour brancher une 3e source** (B6+, ex. un nouveau type de fiche) :
|
||||
1. Ajoute son type à l'union `Org | StructureV2 | TonNouveauType` dans la signature de `toMini`.
|
||||
2. Ajoute une garde de type (comme `isStructure`) basée sur un champ qui n'existe QUE dans ton nouveau type — ne réutilise pas `famille_principale` ou un champ ambigu.
|
||||
3. Choisis l'ordre de repli du résumé : `buildResume([champA, champB, ...])` prend le premier champ non vide, en garde la première phrase, tronque à 110 caractères sur un mot. Vérifie quels champs de ton type contiennent du texte descriptif avant de les ordonner.
|
||||
4. `chips` = 3 étiquettes maximum (fonctions, hashtags, ou l'équivalent pour ton type). `geoloc` = `latitude != null && longitude != null` si ton type a des coordonnées, sinon `true` (pas de fiche à masquer côté carte).
|
||||
|
||||
`components/FicheMiniCard.vue` consomme uniquement `MiniFiche` (depuis B11, `MiniFiche` porte aussi `etiquettes`, `chipsDimension`, `coords`, `date`, `ville`, `texte` : voir §Vue fiches) — il n'a jamais besoin de connaître `Org` ou `StructureV2`. C'est ce découplage qui permet d'ajouter une source sans toucher au composant d'affichage.
|
||||
|
||||
## Vue fiches (B11 02/10/2026, détail B12 03/10/2026) — `VueFiches` + `useVueFiches`
|
||||
|
||||
Remplace `FichesPanel`, `NavSidebar`, `MobileSheet` et les onglets Métropolitain / Outre-mer / Toutes les fiches de `/` et `/agences` (tous retirés). Spécification : `1 PROJETS/DEV/AEP/Cadrage/SPEC-vue-fiches.md` (vault).
|
||||
|
||||
**Trois fichiers, trois rôles.**
|
||||
|
||||
| Fichier | Rôle | Testé par |
|
||||
|---|---|---|
|
||||
| `utils/vueFiches.ts` | logique pure : `lireQuery` / `ecrireQuery`, `filtrerFiches`, `compterEtiquettes`, `trierFiches`, `regrouper`, `ordreFiches` ; B12 : `lireFiche`, `queryAvecFiche`, `positionFiche`, `modeOuverture` / `modeFermeture`, `empreinteListe` | `node scripts/test-vue-fiches.mjs` |
|
||||
| `composables/useVueFiches.ts` | branche la logique sur la route ; rend un objet `reactive` (`vf`) | navigateur |
|
||||
| `components/VueFiches.vue` (+ `VueFichesFiltres.vue`) | barre d'outils, trois états, filtres, grille, poignée, feuille « Filtrer », panneau de détail (B12) | navigateur |
|
||||
|
||||
**L'URL est la source de vérité.** L'état se lit dans `route.query` (surveillée) et s'écrit par `router.replace`. Paramètres : `vue` (`carte` · `mixte` · `fiches`, absent = défaut par largeur), `q`, un paramètre par dimension (valeurs séparées par des virgules), `adresse=sans`, `tri`, `groupe`, et celui des sous-vues de carte (`carte=graphe` en mode Pratiques de `/`). Sur `/`, `mode=pratiques` choisit la base (B4a, ci-dessous) : la vue fiches ne le gère pas, elle le recopie. Un paramètre inconnu ou invalide est ignoré ; un paramètre que la vue ne gère pas (`territoire`, `random`) est recopié tel quel, `fiche=` aussi (un filtre changé garde la fiche ouverte). La recherche part dans l'URL 250 ms après la dernière touche.
|
||||
|
||||
**États.** Sans `vue=` : Mixte à partir de 1024 px, Fiches en dessous. Mixte n'existe pas sous 1024 px (il se lit Fiches). Avant le montage, la racine porte `vf--auto` et la CSS tranche seule, pour qu'un lien s'affiche sans saut. La poignée ‹ › bascule Mixte ↔ Carte ; le repli est retenu en `sessionStorage` (`aep_vue_fiches_liste_repliee`) et ne compte que si l'URL n'a pas de `vue=`. En état Fiches, la carte reste montée, invisible (Leaflet garde une taille) ; les cartes appellent `invalidateSize` par `ResizeObserver`.
|
||||
|
||||
**Filtres : OU dans une dimension, ET entre dimensions.** Compteur d'une chip = fiches qui portent l'étiquette parmi celles que laissent passer la recherche et les AUTRES dimensions ; 0 = chip grisée (`disabled`). Repli au-delà de 14 valeurs, dans l'ordre de la dimension (stable). Les filtres sont à UN endroit : panneau de gauche (Mixte), tête de grille (Fiches, ordinateur et tablette), feuille du bas (téléphone) ; en Carte, seules les pastilles actives, dans la barre. Une chip cliquée dans une carte-fiche ajoute le filtre (`MiniFiche.chipsDimension`).
|
||||
|
||||
**Tri** : `pertinence` (nombre d'étiquettes cochées, puis nom ; défaut dès qu'un filtre est actif), `nom` (défaut sinon), `recent` (date puis Id décroissant ; à n'offrir que si la source a une date). **Regroupement** : une fiche va sous sa PREMIÈRE étiquette de la dimension, jamais en double.
|
||||
|
||||
**Détail et fiche à fiche (B12).** Cliquer une carte-fiche (ou une épingle : la page appelle `vf.ouvrirFiche(id)`) écrit `fiche=<id>` par `router.push` ; passer d'une fiche à l'autre (Précédente / Suivante, ← →, balayage au téléphone) par `router.replace`. Fermer (✕, « ‹ N fiches », Échap) revient en arrière si l'entrée vient de la page et que la liste n'a pas changé depuis, sinon retire `fiche=` sur place (lien partagé, filtre changé fiche ouverte) : le retour du téléphone ferme la fiche, jamais la page. La fiche est cherchée dans TOUTES les fiches : hors du résultat, le panneau dit « Hors de vos filtres » et n'a pas de Précédente / Suivante. Panneau de 380 px en troisième colonne (ordinateur, dans les trois états ; la grille Fiches passe à 2 colonnes), 340 px sur tablette, plein écran par-dessus la vue au téléphone (barre, liste et carte en `inert`, fiche à fiche en pied). Le focus entre dans le panneau à l'ouverture et revient, à la fermeture, sur la carte-fiche de la dernière fiche lue ; la position de défilement de la liste est rendue. Actions du panneau : Ouvrir la page de la fiche (prop `lien-page`), Voir sur la carte (si la fiche a une épingle dans le résultat : Mixte sur ordinateur, Carte au téléphone ; la page lit `vf.centrage` et le passe à sa carte, prop `centrage` de `CarteUnifiee` et `EncartsOutremer`), Copier le lien (l'URL courante dit tout). Deux écritures d'URL dans le même tick s'enchaînent (la seconde part de la query en attente), elles ne s'écrasent plus.
|
||||
|
||||
**Contrat.**
|
||||
|
||||
```vue
|
||||
<VueFiches :vf="vf" intention="Une ligne." libelle-recherche="Rechercher…" :pending="pending"
|
||||
:lien-page="(f) => `/fiche/${f.id}`" @survol="…">
|
||||
<template #carte> <!-- carte(s) de la page, une par sous-vue, v-show sur vf.etat.sousVue --> </template>
|
||||
<template #detail="{ fiche, filtrer }"> <!-- contenu propre à la source ; filtrer(dimension, valeur) au clic d'une étiquette --> </template>
|
||||
<template #vide> <!-- optionnel --> </template>
|
||||
</VueFiches>
|
||||
```
|
||||
|
||||
Contenus de détail en place : `/` → `FicheDetail` (`compact`, `etiquettes-cliquables`) + commentaires, l'`Org` venant de la liste (même enregistrement NocoDB que `/api/fiche/:id`) ; `/?mode=pratiques` (ex-`/agences`) → `FicheReseauContenu` (corps de l'ancienne `FicheModalV2`, une structure liée s'ouvre dans le même panneau). `FicheModal` et `FicheModalV2` sont retirées ; la page `/fiche/:id` reste.
|
||||
|
||||
`const vf = useVueFiches(fiches, config)` : `fiches` = `MiniFiche[]` déjà adaptées, non filtrées (ref, computed ou getter) ; `config: ConfigVueFiches` = `{ dimensions, tris, groupes, etats, sousVues? }` (types dans `utils/vueFiches.ts`). Le composant ne charge rien et ne connaît pas la carte. La page lit `vf.idsResultat` pour ne montrer sur la carte que le résultat courant, `vf.survolId` pour allumer l'épingle (et l'écrit au survol d'une épingle), `vf.ficheId` / `vf.ficheOuverte` / `vf.position` pour la fiche ouverte (B12), `vf.largeur` et `vf.vueAffichee` pour placer ses boutons flottants.
|
||||
|
||||
**Brancher une troisième page** (Codev en B12, Outils, vue Œuvres) :
|
||||
1. Adaptateur dans `useFicheAdapter.ts` : remplir `etiquettes` avec une clé par dimension (= nom du paramètre d'URL), `chipsDimension`, `coords` si la source en a (sinon `geoloc: true`).
|
||||
2. Une `ConfigVueFiches` dans la page : dimensions (variante `fonction` pour la principale, `echelle` pour la secondaire), tris (pas de `recent` sans date), groupes, `etats` (`['carte', 'fiches']` si la page n'a pas la place pour Mixte), `sousVues` si la carte en a.
|
||||
3. Le slot `#carte`, et le slot `#detail` (contenu de la fiche ; une page sans contenu de détail affiche seulement les actions). Les épingles appellent `vf.ouvrirFiche(id)`.
|
||||
4. Ajouter des cas à `scripts/test-vue-fiches.mjs` si la page introduit une règle nouvelle.
|
||||
|
||||
**Carte unifiée (B4a).** `/` porte les deux bases : `?mode=entraide` (défaut, absent de l'URL ; Org NocoDB) et `?mode=pratiques` (StructureV2, l'ancienne `/agences`, en 301 vers `/?mode=pratiques` requête gardée). En tête, `components/carte/CommutateurMode.vue` : deux onglets (`tablist`, `aria-selected`, 44 px, ← →) et le lien « Bibliothèque » vers `/media` ; changer de mode garde `vue` et `q`, vide les filtres et ferme la fiche ; rien n'anime. Chaque mode garde ses dimensions, son détail, son chatbot et sa pop-up ; les deux ont la dimension `type` (contour bleu, variante `echelle`), le mode Pratiques la dimension `postures` (variante `posture`, contour safran) : `utils/taxonomie.ts` lit `data/taxonomie/organisations.json` et `toMini(source, classement)` pose les étiquettes. Une seule carte, `components/carte/CarteUnifiee.vue` (épingles génériques de `utils/carte.ts`, bornes France ou Europe), et en mode Entraide les DOM-TOM en encarts sur la même vue (`EncartsOutremer.vue` : à droite au bureau, un tiers au plus, sous la carte au téléphone ; un encart seulement pour un territoire qui a une épingle dans le résultat). Leaflet arrive par `composables/useLeaflet.ts` (une fois, `{ cluster }` pour la carte principale).
|
||||
|
||||
**Troisième page en place : `/outils?tab=partir-de-soi` (B6-M2)** — sept fiches, une par mot de la slide 17 (`components/OutilsPartirDeSoi.vue`, adaptateur `toMiniMot`). Trois extensions optionnelles du composant, sans effet sur `/` et `/agences` : tri `ordre` (ordre du tableau d'entrée) avec `config.triDefaut` (tri sans filtre ; la pertinence reste prioritaire dès qu'un filtre est actif) et `config.libellesTri` ; prop `libelles-vue` (`{ carte: 'Graphe' }` : le bouton, et « Voir dans le graphe » au lieu de « Voir sur la carte » ; l'URL garde `vue=carte`). Le slot `#carte` y est `GrapheMots.vue`, un SVG statique (nœud central, mots en couronne, ressources en feuilles) dans le vocabulaire du motif maillage. La page vit dans un onglet : `tab=` est un paramètre que la vue ne gère pas, donc recopié à chaque écriture.
|
||||
|
||||
**Quatrième page : `/connaissances` (B19, retouches B19b 29/10/2026)** — la couche de connaissances partagées (`data/connaissances/`, domaine pur dans `utils/connaissances/` : `valider`, `vocabulaire`, `lire`, `graphe` ; adaptateur `toMiniConnaissance`). Deux extensions optionnelles de plus, sans effet sur les autres pages : option `etatDefaut` en troisième argument de `useVueFiches(fiches, config, { etatDefaut: 'carte' })` (l'état rendu quand l'URL ne porte pas `vue=` ; l'URL prime toujours) ; prop `navigation-lineaire` de `VueFiches` (défaut `true` ; à `false`, Précédente / Suivante, le rang et la ligne d'aide des flèches disparaissent, les flèches clavier restent). Le slot `#carte` y est `GrapheConnaissances.vue` (SVG serveur, graine fixe, légende visible : rond = concept, carré = source, trait plein = énoncé par la source, pointillé = posé par AEP). La fiche se lit en trois étages : titre et en-tête de propriétés (`dl.cf__props`), texte (`cf__texte`), crédit et licence repliés (`details.cf__fond`).
|
||||
|
||||
**Les fiches de la couche s'écrivent en Markdown (B19b-B, 03/11/2026)** — une fiche par objet dans `content/connaissances/<préfixe>-<slug>.md` (`cpt-holoptisme.md`), le jeu dans `_jeu.md` ; mode d'emploi complet (les sept lignes, un exemple, les états, ce qui fait échouer le build) dans `content/connaissances/README.md`. Frontmatter = les champs de `data/connaissances/schema.json`, mêmes noms ; relations en wikilinks, une clé par type, écrites dans la fiche d'origine seulement ; corps = le texte long, Markdown ordinaire. `modules/connaissances.ts` compile le dossier au build (`utils/connaissances/compiler.ts`, `yaml` et `marked` en devDependencies, jamais dans le bundle client) et l'expose à la page (`#build/connaissances/jeu.mjs`) ; une erreur de validation arrête le build. Le texte long (`div.cf__texte-long`, 65ch, `##` rendu en `<h3>`) vient sous la définition courte et n'est rendu que si `texte_etat` vaut `publie` (absent = publie) ; en développement seulement, un brouillon s'affiche sous le bandeau « Brouillon, non relu ». Un wikilink du corps devient un lien vers la fiche (`a.cf__lien-fiche[data-fiche]`, ouvert sur place) et ne crée pas de relation. **Stockage (Q5)** : NocoDB reste la file d'entrée de B20 (le worker y écrit en `en_file`) ; le Markdown est la forme publiée, et B20 écrira des `.md` en `a_trier` depuis les lignes acceptées.
|
||||
|
||||
**`FicheMiniCard`** : racine `<article>`, toute la carte ouvre la fiche par un bouton étiré (`::after`) ; avec `etiquettes-cliquables`, les chips deviennent des boutons (impossible dans l'ancienne racine `<button>`). Props `actif` (liseré safran au survol d'épingle), `etiquettes-actives`. Résumé et « Sans localisation » en `color-mix(--text 78 %)` : `--text-muted` et `--text-subtle` échouaient au contraste.
|
||||
|
||||
**Carte de publication (`MediaTabProjets.vue`, lot XL publications, 03/11/2026)** : un lien externe sort du site, donc la carte entière est UN `<a class="projet-carte">` (pas de bouton étiré : rien d'autre n'est cliquable dedans), focus `--focus-ring` autour de la carte, « Découvrir » en indice visuel seulement ; image 800 × 600 WebP ≤ 60 000 o dans `public/medias/publications/<id>.webp`, `width`/`height` posés, crédit dans la carte ; données gardées par `scripts/test-media-data.mjs`.
|
||||
|
||||
## Intention d'abord
|
||||
|
||||
Principe de design validé par Jules pour B3 : un panneau (ou une carte) s'ouvre sur **une ligne d'intention** avant l'outillage (filtres, compteur, grille). La ligne d'intention dit en une phrase ce que montre l'écran et le premier geste possible (« Toutes les structures d'entraide, y compris celles sans adresse sur la carte. Cochez une fonction pour filtrer. »). Dans `VueFiches`, l'intention ouvre la liste, avant les filtres et la grille. Ne pas remonter le compteur ou les chips au-dessus de l'intention, même pour gagner de la place.
|
||||
|
||||
## Motif maillage (favicon)
|
||||
|
||||
Le favicon (`public/favicon.svg`, décliné en `favicon-32.png`, `favicon-16.png`, `apple-touch-icon.png`) dessine un petit graphe : un nœud central relié à cinq nœuds périphériques par des arêtes, sur fond bleu nuit avec des nœuds/arêtes safran. C'est un **motif à décliner**, pas une icône isolée — il préfigure les liens de graphe et les connexions entre fiches attendus en B4 (postures), B8 et B9 (structures liées, graphe de réseau déjà présent dans `FicheModalV2` via `structuresVoisines`). Si tu dessines un composant de graphe ou de connexions entre fiches dans ces batchs, reprends ce vocabulaire visuel (nœuds pleins, arêtes fines, un nœud central mis en avant) plutôt que d'en inventer un nouveau.
|
||||
|
||||
## Deux règles de contraste
|
||||
|
||||
1. **Texte sombre sur l'accent safran, jamais blanc.** `--accent`/`--on-accent` : le blanc sur `#f5b342` échoue le contrôle AA (décision DS du 20/07/2026). `--on-accent` est toujours une couleur sombre (`#1a2238` clair, `#111520` sombre). Vérifié au pixel sur la variante `posture` de `Chip.vue`.
|
||||
2. **`--nav-text-on-primary` reste une valeur littérale**, pas un alias — voir l'explication détaillée dans la section tokens ci-dessus. Si un nouveau composant a besoin de texte de contraste sur un fond bleu nuit, vérifie d'abord si ce fond est `--nav-primary` (translucide) ou `--nav-primary-solid` (opaque) avant de choisir la variable de texte : elles n'ont pas la même réponse en mode sombre.
|
||||
|
||||
## Navigation par échelles S / M / XL (B10, 02/10/2026 ; B14b, 03/11/2026 : les ronds et le volet)
|
||||
|
||||
**Source unique : `utils/echelles.ts`.** Chaque échelle porte ses `onglets` (`libelle`, `to`, `actif(route)`) ; `ORDRE_ECHELLES` fixe l'ordre S → M → XL ; `echelleDeRoute(route)` rend le groupe et l'onglet courants, ou `null` hors groupe (Manifeste, À propos, Proposer, Signaler, fiche, `/rag`) ; `echelleDeBarre(route)` y ajoute la porte ouverte de l'entrée (`/entree?porte=`, sans onglet). Aucun libellé d'échelle ni d'onglet ne se recopie dans un composant : ajouter un onglet = une ligne dans ce fichier, et `scripts/test-echelles-nav.mjs` (une ligne de cas).
|
||||
|
||||
| Échelle | Accroche | Onglets |
|
||||
|---|---|---|
|
||||
| S | Partir de soi | Jobs (`/trouver-du-taf`) · Outils (`/outils`) |
|
||||
| M | La communauté | Écosystème d'entraide et réseaux AEP (`/`, deux modes, B4a) · Codev (`/codev*`) · Connaissances partagées (`/connaissances`) |
|
||||
| XL | Contribuer | Recherche média (`/media`) · Publications (`/media?tab=projets`) |
|
||||
|
||||
**B14b : plus aucun onglet à plat dans la barre** (direction de Jules du 31/10 : « d'abord le bouton S · M · XL »). La barre porte les trois ronds de l'entrée (`BandeauEchelles`, prop `bouton` : des boutons, pas des liens) ; un rond ouvre le **volet** de son échelle (`VoletEchelle`) sous la barre, par-dessus la page, et c'est dans le volet qu'on choisit une section.
|
||||
|
||||
**Seuils** (CSS des composants, pas de breakpoint Tailwind : 1280 et 1440 n'en sont pas) :
|
||||
|
||||
| Largeur | En-tête |
|
||||
|---|---|
|
||||
| ≥ 1280 | logo complet · ronds 44 px · « Échelle · onglet » en petit · Manifeste · À propos · Soutenir (contour safran) · + Proposer (plein safran) · sombre |
|
||||
| 1024-1279 | logo complet · ronds 44 px · « Échelle · onglet » · Manifeste · + Proposer · sombre · « Menu » |
|
||||
| 768-1023 | logo réduit au bloc « AEP » · ronds 44 px · échelle et onglet l'un sous l'autre · Manifeste · + Proposer · sombre · « Menu » |
|
||||
| 480-767 | logo complet · ronds 36 px (cible 44 px) · sombre · + (icône) · ☰ |
|
||||
| < 480 | logo réduit au bloc « AEP » · ronds 36 px (cible 44 px) · sombre · + (icône) · ☰ |
|
||||
|
||||
Rien sous l'en-tête : la hauteur de la page (la carte de `/`) ne dépend plus de la largeur.
|
||||
|
||||
**Composants** :
|
||||
- `NavPortes.vue` (barre) : l'état du volet (`ouvert`), le clavier et les fermetures. Le rond de l'échelle courante reste `aria-current="page"` ; chaque rond porte `aria-expanded` et `aria-controls="volet-echelle"` ; son nom accessible est « S · Partir de soi » (le `sr-only` de `BandeauEchelles`). Volet ouvert : le rond ouvert en safran plein, celui de la page (s'il est autre) en contour safran. Fermer : second clic, Échap (aussi depuis la page, écouteur en capture), clic hors de la barre, focus qui sort, changement de route ; le focus revient au rond s'il était dans la barre ou le volet.
|
||||
- `VoletEchelle.vue` : `<section>` étiquetée par son `h2`, pas un dialogue. Les cercles imbriqués (géométrie `anneauxEchelles`, décoratifs), le titre, l'accroche, les sept mots immobiles ; les sections = une carte par onglet (l'onglet courant en `aria-current="page"`), « Proposer une ressource » (`lienProposer`), « Voir le schéma complet » (`/entree?porte=`). Absolu sous le `<header>` (qui est le bloc de référence), `--shadow-md`, 70 vh au plus.
|
||||
- Mouvement : volet par `grid-template-rows` 0fr → 1fr + fondu en `--dur-base` ; d'une échelle à l'autre, fondu `--dur-fast`, sans glissement ; `prefers-reduced-motion` : `<Transition :css="false">`, état final immédiat.
|
||||
- Clavier : Tab entre les ronds ; Entrée / Espace ouvre ; volet ouvert, ← → passent au rond voisin (le volet suit) ; Tab depuis le rond ouvert entre dans le volet, Maj+Tab sur son premier lien revient au rond ; Échap ferme.
|
||||
- `NavTiroir.vue` (menu < 1280 : `role="dialog"`, voile, Échap, focus piégé et rendu à l'élément d'ouverture, fermeture au changement de route et au passage à ≥ 1280) : la phrase courte de la slide 16, puis les trois ronds en liens vers `/entree?porte=` (le volet n'a pas de sens dans un tiroir), puis Manifeste, À propos, Signaler, Soutenir.
|
||||
- `NavEchelles.vue` et `FilEchelle.vue` (B10) sont retirés. Le lien de don vit dans `utils/liens.ts` (`SOUTENIR_URL`).
|
||||
|
||||
**Texte atténué** : `color-mix(in srgb, var(--text) 78 %, transparent)`, pas `--text-muted` (3,7:1 sur blanc, sous AA à 0,8 rem) ni `opacity` (qui éteindrait aussi l'anneau de focus).
|
||||
|
||||
**Signaler** n'est plus dans la barre d'ordinateur : il reste dans le tiroir, dans chaque fiche, et en pied d'À propos.
|
||||
@@ -204,6 +204,8 @@ cout_eur = ((tokens_in × 0.02 + tokens_out × 0.04) / 1_000_000) × 0.93
|
||||
|
||||
Le filtre NocoDB par date (`gte,YYYY-MM-DD`) n'est pas supporté en v0.301.5. Contournement : récupération de tous les records stats_usage (limit=1000) et filtre JavaScript par mois/année.
|
||||
|
||||
**Côté chatbot (AF5, 29/09)** : `server/utils/circuitBreaker.ts` n'appliquait pas ce contournement. Il envoyait `where=(timestamp,gte,…)&fields=cout_eur,timestamp` et recevait un 422 à chaque appel : fail-open silencieux, budget jamais vérifié depuis la V2. Il suit désormais le worker : **aucune colonne nommée dans la requête** (ni `where`, ni `fields`, ni `sort`), lecture paginée (`limit`/`offset` 1000), mois filtré en JS sur `timestamp`, sinon `CreatedAt`, sinon `created_at`. Chaque lecture écrit au journal `[circuitBreaker] budget lu : X € / 20 € (n lignes AAAA-MM sur N lues)` ; un échec écrit `budget NON vérifié`. Test : `node scripts/test-circuit-breaker.mjs` (faux NocoDB qui rejette en 422 toute colonne absente). Seule `/api/chatbot` vérifie le budget ; `-reseaux` et `-taff` ne le lisent ni ne l'écrivent (asymétrie pré-existante), et les appels servis par un tier gratuit s'inscrivent à 0 €.
|
||||
|
||||
---
|
||||
|
||||
## 7. Infrastructure
|
||||
@@ -330,3 +332,91 @@ Pattern à généraliser :
|
||||
4. Normalize(tags) → taxonomie contrôlée
|
||||
5. Log(usage) → stats_usage
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 11. B5 (2026-09-27) — Formulaire assoupli + pipe adapté (fusion, pas réécriture)
|
||||
|
||||
Ce qui suit documente les écarts posés par le batch B5 (décisions de la
|
||||
maîtrise d'œuvre du 27/09). Les sections 1 à 10 ci-dessus restent la
|
||||
référence de fond (taxonomie, système prompt d'origine, circuit breaker) ;
|
||||
cette section documente ce qui a changé dans `worker/enrich.js` et le pipe
|
||||
de soumission (`server/api/submit/`).
|
||||
|
||||
### 11.1 Mapping soumission libre → colonnes NocoDB existantes (M1)
|
||||
|
||||
Le formulaire `/proposer` assoupli (`components/FormLibre.vue`,
|
||||
`utils/submitLibre.ts`) écrit dans la table orgas existante, **aucune colonne
|
||||
nouvelle** :
|
||||
|
||||
| Champ formulaire | Colonne NocoDB | Règle |
|
||||
|---|---|---|
|
||||
| 1er lien de la liste | `url` | `null` si aucun lien |
|
||||
| texte « pourquoi » + tous les liens | `description_user` | `{texte}\n\nLiens :\n{lien1}\n{lien2}...` — et si aucun type suggéré, la ligne `Type : non précisé` est préfixée en tête |
|
||||
| — | `nom` | hostname du 1er lien, ou 60 premiers caractères du texte si aucun lien, préfixé `[à qualifier] ` |
|
||||
| chip type suggéré | `submission_type` | valeur choisie (`ecosysteme`/`reseau`/`job`/`outil`) ; si aucune chip → `ecosysteme` par défaut (voir ligne `Type : non précisé` ci-dessus) |
|
||||
| chip « Références » | *(table `ressources_references`, pas orgas)* | `titre`/`auteur` placeholders, `description` = texte + liens, comme les autres |
|
||||
| email (optionnel) | `submitted_by_email` | — |
|
||||
|
||||
**À faire au déploiement** : ajouter l'option `libre` à la liste de valeurs
|
||||
acceptées par `submission_type` si l'on veut un jour distinguer une
|
||||
soumission libre d'une soumission via un des 5 formulaires détaillés — non
|
||||
fait ici pour ne pas tester un ALTER contre la prod sans l'avoir vérifié.
|
||||
|
||||
### 11.2 Worker — écarts (M2)
|
||||
|
||||
| Sujet | NAV V2 (§1-10 ci-dessus) | AEP B5 |
|
||||
|---|---|---|
|
||||
| LLM | Mistral Nemo, appel direct | **Bifrost** (`${BIFROST_URL}/v1/chat/completions`, header `x-bf-vk`), modèle `WORKER_MODEL` (défaut `groq/openai/gpt-oss-20b` depuis le 28/09, voir §11.3) |
|
||||
| Scrape | crawl4ai (Python, `AsyncHTTPCrawlerStrategy`) | **fetch natif Node 22** — timeout 8 s, corps plafonné 500 Ko, extraction titre + meta description + `og:*` + texte visible tronqué à 4000 caractères, `User-Agent: AEP/2.0 contact@trans-former.fr` |
|
||||
| Notification | Resend (email Jules) | **ntfy** (`POST https://ntfy.sh/$NTFY_TOPIC`) — le message ne contient JAMAIS l'email ni le texte libre du contributeur, seulement id NocoDB / nom suggéré / type / confiance |
|
||||
| Seuil « 5 fiches pending » | Email si ≥ 5 en attente | **Retiré** (décision MOE : volume faible, une notif par fiche traitée suffit — à réactiver si le volume monte) |
|
||||
| Sortie JSON du LLM | `description_enrichie, points_cles, tags_fonction, echelle, territoire, localisation_ville, confiance` | `{nom, description, type_suggere, ville, tags[], confiance}` — le worker écrit ensuite dans les colonnes existantes (`description_enrichie`, `tags_fonction`, `localisation_ville`) |
|
||||
| Écriture de `nom` | jamais réécrit | réécrit **seulement** si le nom actuel commence par `[à qualifier]` (placeholder posé par le formulaire assoupli) |
|
||||
| Écriture de `submission_type` | jamais réécrit | réécrit **seulement** si `description_user` commence par `Type : non précisé` (l'utilisateur n'a pas choisi de chip) et que le type suggéré par le LLM est valide |
|
||||
| Prix des tokens | fixe (prix Mistral Nemo) | variables `WORKER_PRICE_IN_USD_PER_M` / `WORKER_PRICE_OUT_USD_PER_M`, défaut **0** (tier Groq du tier RAPIDE Bifrost, gratuit) |
|
||||
| Lock | `/tmp/nav-worker.lock` | `/tmp/aep-worker.lock` (configurable `WORKER_LOCK_FILE`) |
|
||||
| Chemin VPS | `/opt/nav-carte/worker/` | `/opt/aep-worker/` (voir `deploy/aep-worker/README.md`) |
|
||||
| Timer | 5 min | 15 min (`deploy/aep-worker/aep-worker.timer`) |
|
||||
|
||||
Le mode `--dry-run` (`node enrich.js --dry-run`) lit
|
||||
`worker/fixtures/dry-run-rows.json` au lieu de NocoDB, n'écrit rien, et par
|
||||
défaut mock aussi le scrape et l'appel Bifrost (`DRY_RUN_LIVE=1` pour
|
||||
forcer de vrais appels réseau sans jamais toucher NocoDB).
|
||||
|
||||
### 11.3 Modèles Groq retirés — bascule sur gpt-oss (2026-09-28)
|
||||
|
||||
Groq ne sert plus `llama-3.1-8b-instant` ni `llama-3.3-70b-versatile`
|
||||
(404 `model_not_found` via Bifrost, constaté au test M3 du 28/09).
|
||||
|
||||
| Consommateur | Avant | Après | Où |
|
||||
|---|---|---|---|
|
||||
| Worker (`worker/enrich.js`) | `groq/llama-3.1-8b-instant` | `groq/openai/gpt-oss-20b` | prod : `WORKER_MODEL` dans `/opt/aep/.env` depuis le 28/09 ; défaut du code aligné |
|
||||
| Chatbots, tier RAPIDE | `groq/llama-3.1-8b-instant` | `groq/openai/gpt-oss-20b` | `server/utils/bifrost.ts`, replis inchangés |
|
||||
| Chatbots, tier APPROFONDI | `groq/llama-3.3-70b-versatile` | `groq/openai/gpt-oss-120b` | `server/utils/bifrost.ts`, replis inchangés |
|
||||
| RAG Pensées (LightRAG) | `gemini-oai/models/gemini-2.5-flash-lite` | inchangé | `/opt/lightrag/.env`, hors de ce routage |
|
||||
|
||||
Entre le retrait et ce correctif, chaque appel chatbot partait sur le
|
||||
premier repli Gemini (`stats_usage` depuis le 23/09 environ) : service
|
||||
rendu, modèle primaire jamais servi.
|
||||
|
||||
**gpt-oss est un modèle à raisonnement.** Deux conséquences :
|
||||
- la réponse porte `choices[0].message.reasoning` à côté de `content`. Les
|
||||
trois routes (`chatbot`, `chatbot-reseaux`, `chatbot-taff`) et le worker ne
|
||||
lisent que `content` (JSON), `usage` et `extra_fields` : le champ est
|
||||
ignoré, rien n'en dépend. `chatbot-pensees` lit la réponse de LightRAG
|
||||
(`response`, `references`), pas celle de Bifrost ;
|
||||
- les tokens de raisonnement sont décomptés de `max_tokens`. Si le
|
||||
fournisseur rend un JSON tronqué en HTTP 200, Bifrost ne bascule pas et
|
||||
l'usager lit « Je n'ai pas pu analyser ta demande » (s'il le rejette en
|
||||
400, le repli Gemini prend le relais : dégradé, pas cassé). Les routes chatbot ajoutent donc
|
||||
`REASONING_MARGIN_TOKENS` (800) à leur budget de contenu (600 ou 700), et
|
||||
`bifrostContent()` écrit un avertissement au journal quand
|
||||
`finish_reason` vaut `length`. Le worker garde `max_tokens: 800` (sortie
|
||||
courte, M3 passé en 1,6 s) ; à relever si `tokens_out` approche 800 dans
|
||||
`stats_usage`.
|
||||
|
||||
**Non testé depuis Windows** (Bifrost écoute sur le loopback du VPS). Test
|
||||
réel au checkpoint : un appel par route, relever `extra_fields` (modèle
|
||||
réellement servi), `usage.completion_tokens`, `finish_reason`, et le
|
||||
modèle inscrit dans `stats_usage` pour `/api/chatbot`.
|
||||
|
||||
@@ -1,110 +1,58 @@
|
||||
<template>
|
||||
<div class="flex flex-col h-screen overflow-hidden" :class="{ dark: isDark }" style="background: var(--nav-bg);">
|
||||
|
||||
<!-- ═══════════════════════════════════════ TOP NAV GLOBAL -->
|
||||
<!-- ═══════════════════════════════════════ TOP NAV GLOBAL (B14b : les ronds S — M — XL et leur volet) ; absente sur event. (lot Y) -->
|
||||
<header
|
||||
class="flex items-center justify-between px-4 py-2.5 shrink-0 relative z-[9999] shadow-sm gap-3"
|
||||
v-if="!estEvenement"
|
||||
class="app-header flex items-center px-4 shrink-0 relative z-[9999] shadow-sm gap-3"
|
||||
style="background: var(--nav-surface); border-bottom: 1px solid var(--nav-bg-alt);"
|
||||
>
|
||||
<!-- Logo -->
|
||||
<a href="/" class="flex items-center gap-2 hover:opacity-90 transition-opacity shrink-0 group relative" title="Architecture d'Écologie Politique">
|
||||
<!-- Logo : texte complet sauf < 480 et 768-1023 (place des ronds et de l'échelle courante) -->
|
||||
<a href="/" class="logo-link flex items-center gap-2 hover:opacity-90 transition-opacity shrink-0" title="Architecture d'Écologie Politique">
|
||||
<div
|
||||
class="h-7 px-2 rounded-lg flex items-center justify-center shrink-0"
|
||||
class="h-8 px-2 rounded-lg flex items-center justify-center shrink-0"
|
||||
style="background: var(--nav-primary-solid);"
|
||||
>
|
||||
<span class="font-bold text-xs tracking-tight" style="color: var(--nav-text-on-primary);">AEP</span>
|
||||
</div>
|
||||
<div class="flex flex-col">
|
||||
<span class="font-bold text-base tracking-tight leading-tight" style="color: var(--nav-text);">AEP</span>
|
||||
<span class="text-xs leading-tight hidden lg:inline" style="color: var(--nav-text-muted);">Architecture d'Écologie Politique</span>
|
||||
</div>
|
||||
<!-- Tooltip sm (quand le sous-titre lg est caché) -->
|
||||
<div class="absolute left-0 top-full mt-2 px-2 py-1 rounded text-xs whitespace-nowrap pointer-events-none opacity-0 group-hover:opacity-100 transition-opacity lg:hidden z-50"
|
||||
style="background: var(--nav-primary-solid); color: var(--nav-text-on-primary);">
|
||||
Architecture d'Écologie Politique
|
||||
<div class="logo-text flex flex-col leading-tight">
|
||||
<span class="logo-line-1 font-bold tracking-tight" style="color: var(--nav-text);">Architecture</span>
|
||||
<span class="logo-line-2 font-bold tracking-tight" style="color: var(--nav-text);">d'Écologie Politique</span>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<!-- ── Onglets desktop (≥1024px) — remplace la barre de recherche ── -->
|
||||
<nav class="hidden lg:flex flex-1 justify-center items-end gap-0 mx-6" aria-label="Navigation projets">
|
||||
<NuxtLink
|
||||
to="/"
|
||||
class="nav-tab"
|
||||
:class="{ 'nav-tab--active': route.path === '/' }"
|
||||
>
|
||||
Écosystème Entraide Architecture
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
to="/agences"
|
||||
class="nav-tab"
|
||||
:class="{ 'nav-tab--active': route.path === '/agences' }"
|
||||
>
|
||||
Agences Inspirantes
|
||||
<span class="nav-tab-badge">en construction</span>
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
to="/rag"
|
||||
class="nav-tab"
|
||||
:class="{ 'nav-tab--active': route.path === '/rag' }"
|
||||
>
|
||||
RAG
|
||||
<span class="nav-tab-badge">en construction</span>
|
||||
</NuxtLink>
|
||||
</nav>
|
||||
|
||||
<!-- ── Barre recherche mobile (640px–1024px) — masquée < 640px car accessible dans la sheet -->
|
||||
<div class="hidden sm:flex lg:hidden flex-1 mx-2">
|
||||
<label class="flex items-center gap-2 w-full px-3 py-1.5 rounded-xl border" style="background: var(--nav-bg); border-color: var(--nav-bg-alt);">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="color: var(--nav-text-muted); flex-shrink: 0;">
|
||||
<circle cx="11" cy="11" r="8"/>
|
||||
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
||||
</svg>
|
||||
<input
|
||||
v-model="headerSearch"
|
||||
type="search"
|
||||
placeholder="Rechercher…"
|
||||
class="flex-1 bg-transparent border-0 outline-none text-sm"
|
||||
style="color: var(--nav-text); font-family: var(--nav-font);"
|
||||
autocomplete="off"
|
||||
@input="onHeaderSearch"
|
||||
@keydown.enter="onHeaderSearch"
|
||||
/>
|
||||
<button
|
||||
v-if="headerSearch"
|
||||
type="button"
|
||||
@click.stop="clearHeaderSearch"
|
||||
class="flex-shrink-0"
|
||||
style="color: var(--nav-text-muted);"
|
||||
aria-label="Effacer la recherche"
|
||||
>
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</label>
|
||||
</div>
|
||||
<!-- Échelles : les trois ronds à toutes les largeurs ; un rond ouvre le volet de son échelle (B14b) -->
|
||||
<NavPortes />
|
||||
<div class="flex-1" aria-hidden="true" />
|
||||
|
||||
<!-- Actions droite -->
|
||||
<div class="flex items-center gap-2 shrink-0">
|
||||
<NuxtLink
|
||||
to="/manifeste"
|
||||
class="header-lien hidden md:inline-flex"
|
||||
:aria-current="route.path === '/manifeste' ? 'page' : undefined"
|
||||
>
|
||||
Manifeste
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
to="/a-propos"
|
||||
class="px-3 py-1.5 rounded-lg text-sm font-medium transition-all hover:opacity-80 hidden md:inline-flex items-center gap-1"
|
||||
style="color: var(--nav-text-muted);"
|
||||
class="header-lien header-xl"
|
||||
:aria-current="route.path === '/a-propos' ? 'page' : undefined"
|
||||
>
|
||||
À propos
|
||||
</NuxtLink>
|
||||
<NuxtLink
|
||||
to="/signaler"
|
||||
class="px-3 py-1.5 rounded-lg text-sm font-medium transition-all hover:opacity-80 hidden lg:inline-flex items-center gap-1"
|
||||
style="color: var(--nav-text-muted);"
|
||||
<a
|
||||
:href="SOUTENIR_URL"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="header-soutenir header-xl"
|
||||
>
|
||||
Signaler
|
||||
</NuxtLink>
|
||||
Soutenir
|
||||
</a>
|
||||
<!-- Proposer une ressource -->
|
||||
<NuxtLink
|
||||
to="/contribuer"
|
||||
class="px-3 py-1.5 rounded-lg text-sm font-semibold transition-all hover:opacity-80 hidden sm:inline-flex items-center gap-1"
|
||||
style="background: var(--nav-accent); color: var(--nav-text);"
|
||||
to="/proposer"
|
||||
class="header-proposer hidden md:inline-flex"
|
||||
>
|
||||
+ Proposer
|
||||
</NuxtLink>
|
||||
@@ -129,69 +77,56 @@
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- Mobile : contribuer icône -->
|
||||
<!-- Mobile : proposer icône -->
|
||||
<NuxtLink
|
||||
to="/contribuer"
|
||||
class="sm:hidden p-2 rounded-lg"
|
||||
style="background: var(--nav-accent); color: var(--nav-text);"
|
||||
title="Contribuer une fiche"
|
||||
aria-label="Contribuer"
|
||||
to="/proposer"
|
||||
class="md:hidden p-2 rounded-lg"
|
||||
style="background: var(--accent); color: var(--on-accent);"
|
||||
title="Proposer une ressource"
|
||||
aria-label="Proposer"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
|
||||
</svg>
|
||||
</NuxtLink>
|
||||
|
||||
<!-- Hamburger mobile (lg:hidden) — toujours en dernier à droite -->
|
||||
<div class="lg:hidden relative">
|
||||
<button
|
||||
@click="hamburgerOpen = !hamburgerOpen"
|
||||
class="p-2 rounded-lg transition-all hover:opacity-80"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text-muted);"
|
||||
:aria-label="hamburgerOpen ? 'Fermer le menu' : 'Menu'"
|
||||
:aria-expanded="hamburgerOpen"
|
||||
>
|
||||
<svg v-if="!hamburgerOpen" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/>
|
||||
</svg>
|
||||
<svg v-else width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
<div
|
||||
v-if="hamburgerOpen"
|
||||
class="absolute right-0 top-full mt-1 rounded-lg shadow-lg min-w-[210px] py-1"
|
||||
style="background: var(--nav-surface); border: 1px solid var(--nav-bg-alt); z-index: 9999;"
|
||||
@click="hamburgerOpen = false"
|
||||
>
|
||||
<NuxtLink to="/" class="block px-4 py-2.5 text-sm font-medium transition-opacity hover:opacity-70" :style="route.path === '/' ? 'color: var(--nav-primary-solid); font-weight: 700;' : 'color: var(--nav-text);'">Écosystème Entraide Architecture</NuxtLink>
|
||||
<NuxtLink to="/agences" class="block px-4 py-2.5 text-sm transition-opacity hover:opacity-70" style="color: var(--nav-text);">Agences Inspirantes</NuxtLink>
|
||||
<NuxtLink to="/rag" class="block px-4 py-2.5 text-sm transition-opacity hover:opacity-70" style="color: var(--nav-text);">RAG</NuxtLink>
|
||||
<div style="height: 1px; background: var(--nav-bg-alt); margin: 4px 0;"></div>
|
||||
<NuxtLink to="/a-propos" class="block px-4 py-2.5 text-sm transition-opacity hover:opacity-70" style="color: var(--nav-text-muted);">À propos</NuxtLink>
|
||||
<NuxtLink to="/signaler" class="block px-4 py-2.5 text-sm transition-opacity hover:opacity-70" style="color: var(--nav-text-muted);">Signaler</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Menu (< 1280) : ouvre le tiroir ; le mot est écrit à partir de 768 -->
|
||||
<button
|
||||
type="button"
|
||||
class="header-menu"
|
||||
aria-label="Ouvrir le menu"
|
||||
aria-haspopup="dialog"
|
||||
:aria-expanded="menuOpen"
|
||||
@click="menuOpen = true"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="21" y2="12"/><line x1="3" y1="18" x2="21" y2="18"/>
|
||||
</svg>
|
||||
<span class="header-menu__mot" aria-hidden="true">Menu</span>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Contenu page (flex-1 pour remplir l'espace) -->
|
||||
<div class="flex-1" :class="route.path === '/' ? 'overflow-hidden' : 'overflow-y-auto'">
|
||||
<!-- Bandeau du prochain événement (B27) : pas sur la copie AEP des pages d'événement, qui est déjà la destination -->
|
||||
<BandeauEvenement v-if="!estEvenement && !route.path.startsWith('/evenements')" />
|
||||
|
||||
<!-- Contenu page (flex-1 pour remplir l'espace) ; sur event., / est l'index des événements : il défile -->
|
||||
<div class="flex-1 min-h-0" :class="route.path === '/' && !estEvenement ? 'overflow-hidden' : 'overflow-y-auto'">
|
||||
<NuxtPage />
|
||||
</div>
|
||||
|
||||
<!-- Bandeau bas — transparence IA + soutien + compteurs semaine -->
|
||||
<BandeauBas />
|
||||
|
||||
<NavTiroir v-if="!estEvenement" :open="menuOpen" @close="menuOpen = false" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
import { SOUTENIR_URL } from '~/utils/liens'
|
||||
import { estHoteEvenement } from '~/utils/evenements'
|
||||
|
||||
const hamburgerOpen = ref(false)
|
||||
watch(() => route.path, () => { hamburgerOpen.value = false })
|
||||
const route = useRoute()
|
||||
const estEvenement = estHoteEvenement(useRequestURL().hostname)
|
||||
|
||||
const menuOpen = ref(false)
|
||||
|
||||
// ── Dark mode ─────────────────────────────────────────────────────────────
|
||||
const isDark = ref(false)
|
||||
@@ -214,72 +149,118 @@ function toggleDark() {
|
||||
localStorage.setItem('aep_theme', 'light')
|
||||
}
|
||||
}
|
||||
|
||||
// ── Barre de recherche header mobile ─────────────────────────────────────
|
||||
const headerSearch = ref((route.query.q as string) ?? '')
|
||||
|
||||
// Sync depuis URL quand la route change
|
||||
watch(() => route.query.q, (v) => {
|
||||
headerSearch.value = (v as string) ?? ''
|
||||
})
|
||||
|
||||
function onHeaderSearch() {
|
||||
const q = headerSearch.value.trim()
|
||||
if (route.path === '/') {
|
||||
router.replace({ query: q ? { ...route.query, q } : { ...route.query, q: undefined } })
|
||||
} else if (q) {
|
||||
router.push({ path: '/', query: { q } })
|
||||
}
|
||||
}
|
||||
|
||||
function clearHeaderSearch() {
|
||||
headerSearch.value = ''
|
||||
if (route.path === '/') {
|
||||
const q = { ...route.query }
|
||||
delete q.q
|
||||
router.replace({ query: Object.keys(q).length ? q : undefined })
|
||||
}
|
||||
}
|
||||
|
||||
// ── Fiche aléatoire ───────────────────────────────────────────────────────
|
||||
function goRandom() {
|
||||
router.push({ path: '/', query: { random: '1' } })
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* ── Onglets header desktop ───────────────────────────────────────────── */
|
||||
.nav-tab {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
/* ── En-tête ──────────────────────────────────────────────────────────── */
|
||||
.app-header {
|
||||
min-height: 52px;
|
||||
}
|
||||
|
||||
/* ── Logo header (texte 2 lignes) ─────────────────────────────────────── */
|
||||
.logo-text {
|
||||
line-height: 1.05;
|
||||
}
|
||||
.logo-line-1, .logo-line-2 {
|
||||
font-size: 0.7rem;
|
||||
letter-spacing: -0.01em;
|
||||
}
|
||||
@media (min-width: 640px) {
|
||||
.logo-line-1, .logo-line-2 { font-size: 0.78rem; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.logo-line-1, .logo-line-2 { font-size: 0.85rem; }
|
||||
}
|
||||
/* Les ronds et l'échelle courante prennent la place du texte : téléphone étroit et 768-1023 */
|
||||
@media (max-width: 479px), (min-width: 768px) and (max-width: 1023px) {
|
||||
.logo-text { display: none; }
|
||||
}
|
||||
|
||||
/* ── Liens et boutons de droite ───────────────────────────────────────── */
|
||||
.header-lien {
|
||||
align-items: center;
|
||||
padding: 6px 16px 8px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
color: var(--nav-text-muted);
|
||||
padding: 6px 8px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
transition: color 0.15s;
|
||||
border-bottom: 2px solid transparent;
|
||||
gap: 2px;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.header-lien:hover,
|
||||
.header-lien[aria-current="page"] {
|
||||
color: var(--text);
|
||||
}
|
||||
.header-lien[aria-current="page"] {
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
|
||||
.nav-tab:hover {
|
||||
color: var(--nav-text);
|
||||
.header-soutenir {
|
||||
align-items: center;
|
||||
padding: 5px 10px;
|
||||
border: 1.5px solid var(--accent);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.nav-tab--active {
|
||||
color: var(--nav-text);
|
||||
border-bottom-color: var(--nav-primary-solid);
|
||||
font-weight: 600;
|
||||
.header-proposer {
|
||||
align-items: center;
|
||||
padding: 6px 11px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-tab-badge {
|
||||
font-size: 0.6rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--nav-text-muted);
|
||||
opacity: 0.65;
|
||||
.header-soutenir:hover,
|
||||
.header-proposer:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
.header-lien:focus-visible,
|
||||
.header-soutenir:focus-visible,
|
||||
.header-proposer:focus-visible,
|
||||
.header-menu:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* À propos et Soutenir : barre complète seulement (≥ 1280), sinon dans le tiroir */
|
||||
.header-xl { display: none; }
|
||||
@media (min-width: 1280px) {
|
||||
.header-xl { display: inline-flex; }
|
||||
}
|
||||
|
||||
.header-menu {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 8px;
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-alt);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
cursor: pointer;
|
||||
}
|
||||
.header-menu__mot { display: none; }
|
||||
@media (min-width: 768px) {
|
||||
.header-menu {
|
||||
padding: 5px 10px;
|
||||
border-color: var(--border);
|
||||
background: transparent;
|
||||
}
|
||||
.header-menu__mot { display: inline; }
|
||||
}
|
||||
@media (min-width: 1280px) {
|
||||
.header-menu { display: none; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { RouterConfig } from '@nuxt/schema'
|
||||
import { estHoteEvenement, routesPourHote } from '~/utils/evenements'
|
||||
|
||||
/**
|
||||
* Lot Y : sur event.trans-former.fr, seules les pages de pages/evenements/ existent,
|
||||
* servies sans le préfixe (/ruetz/foret). useRequestURL lit l'hôte de la requête côté
|
||||
* serveur et window.location côté client : les deux tables sont identiques.
|
||||
*/
|
||||
export default <RouterConfig>{
|
||||
routes: (routes) => routesPourHote(routes, estHoteEvenement(useRequestURL().hostname)),
|
||||
}
|
||||
+45
-16
@@ -3,28 +3,44 @@
|
||||
@tailwind utilities;
|
||||
|
||||
/* ── Palette NAV V2 — Sobre institutionnel ─────────────────────────────── */
|
||||
/* --nav-* sont désormais des ALIAS vers les rôles @transformer/ui (tokens.css
|
||||
+ theme/aep.css, chargés avant ce fichier dans nuxt.config.ts).
|
||||
--nav-primary-raw, --nav-primary-solid et --nav-text-on-primary restent des
|
||||
valeurs PROPRES à nav-carte (non aliasées) :
|
||||
- le DS n'a pas de triplet RGB (--nav-primary-raw) ;
|
||||
- le --text du DS en sombre (#e8ecf5) ne correspond pas à la teinte bleu
|
||||
nuit voulue ici pour --nav-primary-solid (#c8d2f0) ;
|
||||
- --nav-text-on-primary sert de texte de contraste à la fois sur
|
||||
--nav-primary (translucide, alias DS) ET sur --nav-primary-solid (opaque,
|
||||
propre à nav-carte) — deux fonds dont la légèreté s'inverse en sombre
|
||||
(translucide ≈ fond sombre, solid = lavande claire). Le rôle --on-primary
|
||||
du DS ne colle qu'au premier cas ; l'aliaser cassait le contraste du AEP
|
||||
logo, des boutons trouver-du-taf, BandeauBas, SimulateurFeature,
|
||||
FicheDetail (texte clair sur --primary-solid clair en sombre — testé au
|
||||
pixel le 25/09, illisible). Gardé littéral = identique à la prod avant B3.
|
||||
Idem --nav-accent-soft, sans équivalent DS. (B3-M0, 2026-09-25) */
|
||||
:root {
|
||||
/* Fonds */
|
||||
--nav-bg: #f8f6f1;
|
||||
--nav-bg-alt: #eee9df;
|
||||
--nav-surface: #ffffff;
|
||||
--nav-bg: var(--bg);
|
||||
--nav-bg-alt: var(--bg-alt);
|
||||
--nav-surface: var(--surface);
|
||||
|
||||
/* Bleu nuit — 60% d'opacité sur les surfaces */
|
||||
--nav-primary-raw: 26, 34, 56;
|
||||
--nav-primary: rgba(26, 34, 56, 0.6);
|
||||
--nav-primary: var(--primary);
|
||||
--nav-primary-solid: #1a2238;
|
||||
|
||||
/* Accent safran */
|
||||
--nav-accent: #f5b342;
|
||||
--nav-accent: var(--accent);
|
||||
--nav-accent-soft: rgba(245, 179, 66, 0.85);
|
||||
|
||||
/* Texte */
|
||||
--nav-text: #1a2238;
|
||||
--nav-text-muted: rgba(26, 34, 56, 0.55);
|
||||
--nav-text: var(--text);
|
||||
--nav-text-muted: var(--text-muted);
|
||||
--nav-text-on-primary: #f8f6f1;
|
||||
|
||||
/* Typographie */
|
||||
--nav-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
--nav-font: var(--font-body);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -58,25 +74,25 @@
|
||||
|
||||
/* Focus ring accessibilité */
|
||||
*:focus-visible {
|
||||
outline: 2px solid var(--nav-accent);
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ── Dark mode ──────────────────────────────────────────────────────────── */
|
||||
.dark {
|
||||
--nav-bg: #111520;
|
||||
--nav-bg-alt: #1e2538;
|
||||
--nav-surface: #1a2238;
|
||||
--nav-bg: var(--bg);
|
||||
--nav-bg-alt: var(--bg-alt);
|
||||
--nav-surface: var(--surface);
|
||||
|
||||
--nav-primary-raw: 200, 210, 240;
|
||||
--nav-primary: rgba(200, 210, 240, 0.15);
|
||||
--nav-primary: var(--primary);
|
||||
--nav-primary-solid: #c8d2f0;
|
||||
|
||||
--nav-accent: #f5b342;
|
||||
--nav-accent: var(--accent);
|
||||
--nav-accent-soft: rgba(245, 179, 66, 0.85);
|
||||
|
||||
--nav-text: #e8ecf5;
|
||||
--nav-text-muted: rgba(200, 210, 240, 0.55);
|
||||
--nav-text: var(--text);
|
||||
--nav-text-muted: var(--text-muted);
|
||||
--nav-text-on-primary: #111520;
|
||||
}
|
||||
|
||||
@@ -108,3 +124,16 @@
|
||||
.dark .leaflet-popup-tip {
|
||||
background: var(--nav-surface);
|
||||
}
|
||||
|
||||
/* ── Rendu Markdown chatbot (useMarkdown composable) ────────────────────── */
|
||||
.md-content { font-size: inherit; line-height: 1.6; }
|
||||
.md-content p { margin: 0 0 0.5em; }
|
||||
.md-content p:last-child { margin-bottom: 0; }
|
||||
.md-content strong, .md-h1, .md-h2, .md-h3 { font-weight: 700; }
|
||||
.md-h2 { font-size: 0.9375em; display: block; margin-bottom: 0.25em; }
|
||||
.md-h3 { font-size: 0.875em; display: block; }
|
||||
.md-content em { font-style: italic; }
|
||||
.md-list { margin: 0.375em 0 0.375em 1em; padding: 0; list-style: disc; }
|
||||
.md-list li { margin-bottom: 0.2em; }
|
||||
.md-link { text-decoration: underline; opacity: 0.85; }
|
||||
.md-link:hover { opacity: 1; }
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/* Palette familles V2 - variables locales, ne pas toucher --nav-* */
|
||||
:root {
|
||||
--bifurc-color-f1: #a85d3e; /* Réemploi & filières - terracotta */
|
||||
--bifurc-color-f2: #c4a472; /* Frugalité & low-tech - terre crue */
|
||||
--bifurc-color-f3: #d4a017; /* Architecture sociale - ocre */
|
||||
--bifurc-color-f4: #5a7a4a; /* Collectifs & AMO - vert mousse */
|
||||
--bifurc-color-f5: #3d6a8c; /* Urbanisme transition - bleu profond */
|
||||
|
||||
--bifurc-badge-f6: #6b3fa0; /* Recherche politique - violet */
|
||||
--bifurc-badge-cr: #2d8a6b; /* Centre ressources - vert foncé */
|
||||
--bifurc-badge-mm: #c44a2f; /* Mouvement manifeste - rouge brique */
|
||||
--bifurc-badge-cp: #1a3a6b; /* Contre-pouvoir - bleu nuit */
|
||||
|
||||
--bifurc-banner-bg: #faf8f5;
|
||||
--bifurc-banner-border: #e0d8cc;
|
||||
--bifurc-banner-text: #2c2416;
|
||||
}
|
||||
|
||||
.bifurc-pin-f1 { background: var(--bifurc-color-f1); }
|
||||
.bifurc-pin-f2 { background: var(--bifurc-color-f2); }
|
||||
.bifurc-pin-f3 { background: var(--bifurc-color-f3); }
|
||||
.bifurc-pin-f4 { background: var(--bifurc-color-f4); }
|
||||
.bifurc-pin-f5 { background: var(--bifurc-color-f5); }
|
||||
@@ -1,587 +0,0 @@
|
||||
<template>
|
||||
<!-- ═══════════════════════════════════════ BANDEAU BAS ═══════════════════ -->
|
||||
<!-- DESKTOP uniquement (≥1024px) — mobile a le FAB séparé -->
|
||||
<footer
|
||||
v-if="!isMobile"
|
||||
ref="bandeauEl"
|
||||
class="bandeau-bas shrink-0"
|
||||
:class="{ 'bandeau-collapsed': isCollapsed }"
|
||||
aria-label="Informations projet AEP"
|
||||
@mouseenter="onMouseEnter"
|
||||
@mouseleave="onMouseLeave"
|
||||
>
|
||||
<!-- Contenu plein -->
|
||||
<div class="bandeau-inner" :class="{ 'bandeau-inner--hidden': isCollapsed }">
|
||||
|
||||
<!-- ── GAUCHE : Transparence IA ──────────────────────────────────────── -->
|
||||
<div class="bandeau-col">
|
||||
<p class="bandeau-label">Transparence IA</p>
|
||||
<template v-if="stats">
|
||||
<p class="bandeau-value">
|
||||
Coût IA ce mois : <strong>{{ stats.cout_mois_eur.toFixed(2) }} €</strong>
|
||||
·
|
||||
Tokens : <strong>{{ stats.tokens_mois.toLocaleString('fr-FR') }}</strong>
|
||||
</p>
|
||||
<!-- Jauge -->
|
||||
<div class="jauge-track" aria-label="Budget IA consommé" role="progressbar" :aria-valuenow="jaugePct" aria-valuemin="0" aria-valuemax="100">
|
||||
<div class="jauge-fill" :style="{ width: jaugePct + '%' }" />
|
||||
</div>
|
||||
<p class="bandeau-sub">
|
||||
{{ stats.requetes_mois }} requête{{ stats.requetes_mois !== 1 ? 's' : '' }} ce mois
|
||||
</p>
|
||||
</template>
|
||||
<template v-else-if="loading">
|
||||
<p class="bandeau-sub">Chargement…</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="bandeau-sub">Données indisponibles</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- ── MILIEU : CTA Soutien ──────────────────────────────────────────── -->
|
||||
<div class="bandeau-col bandeau-col--center">
|
||||
<div class="soutenir-wrap">
|
||||
<button
|
||||
class="btn-soutenir"
|
||||
type="button"
|
||||
@click="modalOpen = true"
|
||||
@mouseenter="tooltipVisible = true"
|
||||
@mouseleave="tooltipVisible = false"
|
||||
@focus="tooltipVisible = true"
|
||||
@blur="tooltipVisible = false"
|
||||
aria-label="Soutenir le projet AEP sur Liberapay"
|
||||
>
|
||||
Soutenir le projet
|
||||
</button>
|
||||
<!-- Tooltip au hover -->
|
||||
<div v-if="tooltipVisible" class="soutenir-tooltip" role="tooltip">
|
||||
1 € = 30 fiches mises en ligne
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ── DROITE : Compteurs semaine ────────────────────────────────────── -->
|
||||
<div class="bandeau-col bandeau-col--right">
|
||||
<p class="bandeau-label">Cette semaine</p>
|
||||
<template v-if="stats">
|
||||
<p class="bandeau-value">
|
||||
{{ stats.fiches_semaine }} fiche{{ stats.fiches_semaine !== 1 ? 's' : '' }} ajoutée{{ stats.fiches_semaine !== 1 ? 's' : '' }}
|
||||
</p>
|
||||
<p class="bandeau-sub">
|
||||
{{ stats.requetes_chatbot_semaine }} requête{{ stats.requetes_chatbot_semaine !== 1 ? 's' : '' }} chatbot
|
||||
</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="bandeau-sub">—</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Barre fine (état collapsed) -->
|
||||
<div class="bandeau-thin" :class="{ 'bandeau-thin--visible': isCollapsed }">
|
||||
<span class="bandeau-thin-label">AEP · Transparence IA</span>
|
||||
</div>
|
||||
|
||||
<!-- ── MODAL Liberapay ───────────────────────────────────────────────── -->
|
||||
<Teleport to="body">
|
||||
<Transition name="backdrop">
|
||||
<div
|
||||
v-if="modalOpen"
|
||||
class="modal-backdrop"
|
||||
@click="modalOpen = false"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Transition>
|
||||
<Transition name="modal">
|
||||
<div
|
||||
v-if="modalOpen"
|
||||
class="modal-box"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="Soutenir AEP sur Liberapay"
|
||||
>
|
||||
<button
|
||||
class="modal-close"
|
||||
type="button"
|
||||
@click="modalOpen = false"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
<h2 class="modal-title">Soutenir AEP</h2>
|
||||
<p class="modal-desc">
|
||||
AEP est un outil libre, sans publicité, financé par les dons.
|
||||
1 € finance environ 30 fiches mises en ligne.
|
||||
</p>
|
||||
<div class="modal-widget">
|
||||
<iframe
|
||||
src="https://liberapay.com/trans-former.fr/widgets/button.html"
|
||||
width="95"
|
||||
height="22"
|
||||
style="border: 0;"
|
||||
title="Faire un don sur Liberapay"
|
||||
/>
|
||||
</div>
|
||||
<a
|
||||
href="https://liberapay.com/trans-former.fr/donate"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="modal-link"
|
||||
>
|
||||
Faire un don sur Liberapay →
|
||||
</a>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
</footer>
|
||||
|
||||
<!-- ═══════════════════════════════════════ FAB MOBILE (< 1024px) ════════ -->
|
||||
<div v-else>
|
||||
<!-- FAB soutenir (à gauche du chatbot) -->
|
||||
<button
|
||||
class="fab-soutenir"
|
||||
type="button"
|
||||
@click="fabSheetOpen = true"
|
||||
aria-label="Soutenir le projet AEP"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<!-- Bottom sheet FAB -->
|
||||
<Teleport to="body">
|
||||
<Transition name="backdrop">
|
||||
<div
|
||||
v-if="fabSheetOpen"
|
||||
class="fixed inset-0 z-[1020]"
|
||||
style="background: rgba(26,34,56,0.5);"
|
||||
@click="fabSheetOpen = false"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Transition>
|
||||
<Transition name="sheet">
|
||||
<div
|
||||
v-if="fabSheetOpen"
|
||||
class="fab-sheet"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="Soutenir AEP"
|
||||
>
|
||||
<!-- Poignée -->
|
||||
<div class="flex justify-center pt-3 pb-1">
|
||||
<div class="rounded-full" style="width: 36px; height: 4px; background: var(--nav-bg-alt);" />
|
||||
</div>
|
||||
<div class="px-5 pb-6">
|
||||
<h2 class="text-base font-bold mb-2" style="color: var(--nav-text);">Soutenir AEP</h2>
|
||||
<template v-if="stats">
|
||||
<p class="text-sm mb-1" style="color: var(--nav-text-muted);">
|
||||
Coût IA ce mois : <strong>{{ stats.cout_mois_eur.toFixed(2) }} €</strong>
|
||||
· Tokens : {{ stats.tokens_mois.toLocaleString('fr-FR') }}
|
||||
</p>
|
||||
<p class="text-sm mb-3" style="color: var(--nav-text-muted);">
|
||||
{{ stats.fiches_semaine }} fiche{{ stats.fiches_semaine !== 1 ? 's' : '' }} ajoutée{{ stats.fiches_semaine !== 1 ? 's' : '' }} cette semaine
|
||||
</p>
|
||||
</template>
|
||||
<p class="text-sm mb-4" style="color: var(--nav-text-muted); line-height: 1.5;">
|
||||
1 € = 30 fiches mises en ligne. AEP est libre, sans pub, financé par les dons.
|
||||
</p>
|
||||
<a
|
||||
href="https://liberapay.com/trans-former.fr/donate"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="block w-full text-center py-3 rounded-xl font-semibold text-sm"
|
||||
style="background: var(--nav-primary); color: var(--nav-text-on-primary); text-decoration: none;"
|
||||
@click="fabSheetOpen = false"
|
||||
>
|
||||
Soutenir sur Liberapay →
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface Stats {
|
||||
cout_mois_eur: number
|
||||
budget_mois: number
|
||||
tokens_mois: number
|
||||
co2_kg: number
|
||||
requetes_mois: number
|
||||
fiches_semaine: number
|
||||
requetes_chatbot_semaine: number
|
||||
}
|
||||
|
||||
const stats = ref<Stats | null>(null)
|
||||
const loading = ref(true)
|
||||
const modalOpen = ref(false)
|
||||
const fabSheetOpen = ref(false)
|
||||
const tooltipVisible = ref(false)
|
||||
|
||||
// Desktop — replié par défaut, déploie au hover, replie immédiatement à la sortie
|
||||
const bandeauEl = ref<HTMLElement | null>(null)
|
||||
const isCollapsed = ref(true) // replié par défaut
|
||||
|
||||
const REFRESH_MS = 5 * 60 * 1000 // 5 minutes
|
||||
|
||||
// Détection mobile côté client
|
||||
const isMobile = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
isMobile.value = window.innerWidth < 1024
|
||||
|
||||
const handleResize = () => {
|
||||
isMobile.value = window.innerWidth < 1024
|
||||
}
|
||||
window.addEventListener('resize', handleResize)
|
||||
onUnmounted(() => window.removeEventListener('resize', handleResize))
|
||||
|
||||
fetchStats()
|
||||
const interval = setInterval(fetchStats, REFRESH_MS)
|
||||
onUnmounted(() => clearInterval(interval))
|
||||
})
|
||||
|
||||
function onMouseEnter() {
|
||||
isCollapsed.value = false
|
||||
}
|
||||
|
||||
function onMouseLeave() {
|
||||
// Repli immédiat — pas de timer
|
||||
isCollapsed.value = true
|
||||
}
|
||||
|
||||
async function fetchStats() {
|
||||
try {
|
||||
const res = await $fetch<Stats>('/api/stats')
|
||||
stats.value = res
|
||||
} catch {
|
||||
stats.value = null
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const jaugePct = computed(() => {
|
||||
if (!stats.value) return 0
|
||||
return Math.min(100, Math.round((stats.value.cout_mois_eur / stats.value.budget_mois) * 100))
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ── Bandeau bas ─────────────────────────────────────────────────────────── */
|
||||
.bandeau-bas {
|
||||
background: rgba(26, 34, 56, 0.7); /* opacité 70% */
|
||||
color: var(--nav-text-on-primary);
|
||||
font-family: var(--nav-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
||||
transition: min-height 0.25s ease;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bandeau-collapsed {
|
||||
min-height: 32px !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bandeau-inner {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding: 10px 20px;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
min-height: 64px;
|
||||
transition: opacity 0.2s ease, max-height 0.3s ease;
|
||||
max-height: 200px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.bandeau-inner--hidden {
|
||||
opacity: 0;
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* Barre fine (collapsed) */
|
||||
.bandeau-thin {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.bandeau-thin--visible {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.bandeau-thin-label {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.08em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* ── Colonnes ────────────────────────────────────────────────────────────── */
|
||||
.bandeau-col {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 3px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.bandeau-col--center {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 0 0 auto;
|
||||
padding-top: 8px; /* décaler légèrement vers le bas pour mieux centrer dans la hauteur */
|
||||
}
|
||||
|
||||
.bandeau-col--right {
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
/* ── Typo ────────────────────────────────────────────────────────────────── */
|
||||
.bandeau-label {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.07em;
|
||||
opacity: 0.65;
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.bandeau-value {
|
||||
font-size: 0.775rem;
|
||||
font-weight: 500;
|
||||
color: var(--nav-text-on-primary);
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.bandeau-value strong {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.bandeau-sub {
|
||||
font-size: 0.68rem;
|
||||
opacity: 0.7;
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* ── Jauge budget ────────────────────────────────────────────────────────── */
|
||||
.jauge-track {
|
||||
width: 100%;
|
||||
max-width: 180px;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background: rgba(255, 255, 255, 0.18);
|
||||
overflow: hidden;
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
.jauge-fill {
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
background: var(--nav-accent);
|
||||
transition: width 0.6s ease;
|
||||
}
|
||||
|
||||
/* ── Bouton soutenir + tooltip ───────────────────────────────────────────── */
|
||||
.soutenir-wrap {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-soutenir {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 7px 16px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background: var(--nav-accent);
|
||||
color: var(--nav-text);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
white-space: nowrap;
|
||||
transition: opacity 0.15s, transform 0.1s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.btn-soutenir:hover { opacity: 0.88; transform: translateY(-1px); }
|
||||
.btn-soutenir:active { opacity: 1; transform: translateY(0); }
|
||||
|
||||
.soutenir-tooltip {
|
||||
position: absolute;
|
||||
bottom: calc(100% + 8px);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background: var(--nav-primary-solid, #1a2238);
|
||||
color: var(--nav-text-on-primary);
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
padding: 5px 10px;
|
||||
border-radius: 6px;
|
||||
white-space: nowrap;
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.soutenir-tooltip::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
border: 5px solid transparent;
|
||||
border-top-color: var(--nav-primary-solid, #1a2238);
|
||||
}
|
||||
|
||||
/* ── FAB mobile soutenir ─────────────────────────────────────────────────── */
|
||||
.fab-soutenir {
|
||||
position: fixed;
|
||||
bottom: 68px; /* au-dessus du FAB chatbot à 24px du bas + 48px de hauteur */
|
||||
left: 16px;
|
||||
z-index: 1000;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 50%;
|
||||
border: none;
|
||||
background: var(--nav-accent);
|
||||
color: var(--nav-text);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4px 16px rgba(26,34,56,0.25);
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s, transform 0.1s;
|
||||
}
|
||||
|
||||
.fab-soutenir:hover { opacity: 0.88; transform: translateY(-1px); }
|
||||
|
||||
/* ── Bottom sheet FAB ────────────────────────────────────────────────────── */
|
||||
.fab-sheet {
|
||||
position: fixed;
|
||||
inset-x: 0;
|
||||
bottom: 0;
|
||||
z-index: 1021;
|
||||
background: var(--nav-surface);
|
||||
border-radius: 16px 16px 0 0;
|
||||
box-shadow: 0 -4px 32px rgba(26,34,56,0.18);
|
||||
}
|
||||
|
||||
/* ── Modal ───────────────────────────────────────────────────────────────── */
|
||||
.modal-backdrop {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 2000;
|
||||
background: rgba(26, 34, 56, 0.55);
|
||||
}
|
||||
|
||||
.modal-box {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 2001;
|
||||
background: var(--nav-surface, #ffffff);
|
||||
border-radius: 16px;
|
||||
padding: 28px 24px 24px;
|
||||
width: min(380px, 90vw);
|
||||
box-shadow: 0 8px 40px rgba(26, 34, 56, 0.22);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.modal-close {
|
||||
position: absolute;
|
||||
top: 14px;
|
||||
right: 14px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background: var(--nav-bg-alt, #eee9df);
|
||||
color: var(--nav-text-muted, rgba(26,34,56,0.55));
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
.modal-close:hover { background: var(--nav-bg, #f8f6f1); }
|
||||
|
||||
.modal-title {
|
||||
font-size: 1.05rem;
|
||||
font-weight: 700;
|
||||
color: var(--nav-text, #1a2238);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.modal-desc {
|
||||
font-size: 0.85rem;
|
||||
color: var(--nav-text-muted, rgba(26,34,56,0.55));
|
||||
line-height: 1.6;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.modal-widget {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.modal-link {
|
||||
display: block;
|
||||
text-align: center;
|
||||
font-size: 0.8rem;
|
||||
color: var(--nav-primary-solid, #1a2238);
|
||||
text-decoration: underline;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
.modal-link:hover { opacity: 0.7; }
|
||||
|
||||
/* ── Transitions ─────────────────────────────────────────────────────────── */
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: opacity 0.2s ease; }
|
||||
.backdrop-enter-from, .backdrop-leave-to { opacity: 0; }
|
||||
|
||||
.modal-enter-active, .modal-leave-active { transition: opacity 0.2s ease, transform 0.2s ease; }
|
||||
.modal-enter-from, .modal-leave-to { opacity: 0; transform: translate(-50%, -48%); }
|
||||
|
||||
.sheet-enter-active, .sheet-leave-active { transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
|
||||
.sheet-enter-from, .sheet-leave-to { transform: translateY(100%); }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.btn-soutenir { transition: none; }
|
||||
.jauge-fill { transition: none; }
|
||||
.modal-enter-active, .modal-leave-active { transition: none; }
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: none; }
|
||||
.sheet-enter-active, .sheet-leave-active { transition: none; }
|
||||
.bandeau-bas { transition: none; }
|
||||
.bandeau-inner { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,169 @@
|
||||
<!--
|
||||
BandeauEvenement — B27
|
||||
Une ligne sous l'en-tête d'aep.trans-former.fr : le prochain événement (la plantation
|
||||
de Ruetz), lien vers sa page sur event.trans-former.fr. Monté dans app.vue, hôte AEP seul.
|
||||
|
||||
- Dates et lien lus dans data/evenements/ruetz-2026.ts (utils/bandeauEvenement.ts).
|
||||
- Retiré seul après le dernier jour, 23:59 heure de Paris (bandeauVisible, serveur et client).
|
||||
- Fermable ; la fermeture est gardée en localStorage (CLE_FERMETURE_BANDEAU). Rendu serveur = visible.
|
||||
Pour qu'un visiteur qui l'a fermé ne le voie pas clignoter (ni la carte sauter de sa
|
||||
hauteur) à chaque page, un script inline dans <head> pose `html.bandeau-evt-ferme` avant
|
||||
le premier rendu ; le CSS ci-dessous masque alors le bandeau, puis onMounted le retire.
|
||||
- Aucune animation.
|
||||
-->
|
||||
<template>
|
||||
<div
|
||||
v-if="affiche"
|
||||
class="bandeau-evt"
|
||||
role="region"
|
||||
aria-label="Prochain événement"
|
||||
>
|
||||
<a :href="lien" class="bandeau-evt__lien">
|
||||
<span class="bandeau-evt__annonce">{{ texte.annonce }}</span>
|
||||
{{ ' ' }}
|
||||
<span class="bandeau-evt__appel">{{ texte.appel }}</span>
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
class="bandeau-evt__fermer"
|
||||
aria-label="Fermer"
|
||||
title="Fermer"
|
||||
@click="fermer"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="6" y1="6" x2="18" y2="18" /><line x1="18" y1="6" x2="6" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { evenement } from '~/data/evenements/ruetz-2026'
|
||||
import { bandeauVisible, texteBandeauEvenement, lienBandeau, CLE_FERMETURE_BANDEAU } from '~/utils/bandeauEvenement'
|
||||
|
||||
const CLASSE_FERME = 'bandeau-evt-ferme'
|
||||
|
||||
const texte = texteBandeauEvenement(evenement)
|
||||
const lien = lienBandeau(evenement)
|
||||
|
||||
const dansLaPeriode = ref(bandeauVisible(new Date(), evenement))
|
||||
const ferme = ref(false)
|
||||
const affiche = computed(() => dansLaPeriode.value && !ferme.value)
|
||||
|
||||
// Avant le premier rendu : si le bandeau a déjà été fermé, `html.bandeau-evt-ferme` le masque (CSS).
|
||||
useHead({
|
||||
script: [{
|
||||
key: 'aep-bandeau-evt',
|
||||
tagPosition: 'head',
|
||||
innerHTML: `try{if(localStorage.getItem(${JSON.stringify(CLE_FERMETURE_BANDEAU)}))document.documentElement.classList.add(${JSON.stringify(CLASSE_FERME)})}catch(e){}`,
|
||||
}],
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// Une page servie juste avant minuit peut rester ouverte : on relit l'heure du client.
|
||||
dansLaPeriode.value = bandeauVisible(new Date(), evenement)
|
||||
try {
|
||||
ferme.value = !!localStorage.getItem(CLE_FERMETURE_BANDEAU)
|
||||
} catch {
|
||||
// localStorage indisponible (navigation privée stricte) : le bandeau reste, fermable pour la page.
|
||||
}
|
||||
})
|
||||
|
||||
function fermer() {
|
||||
ferme.value = true
|
||||
document.documentElement.classList.add(CLASSE_FERME)
|
||||
try {
|
||||
localStorage.setItem(CLE_FERMETURE_BANDEAU, '1')
|
||||
} catch {
|
||||
// rien : fermé pour cette page seulement
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Non scopé : la règle de masquage avant montage part de <html>. */
|
||||
html.bandeau-evt-ferme .bandeau-evt {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bandeau-evt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
gap: var(--space-xs);
|
||||
min-height: 36px;
|
||||
padding: 0 4px 0 var(--space-sm);
|
||||
background: color-mix(in srgb, var(--accent) 18%, var(--surface));
|
||||
border-bottom: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.bandeau-evt__lien {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 6px 0;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.bandeau-evt__appel {
|
||||
font-weight: var(--fw-semibold);
|
||||
white-space: nowrap;
|
||||
text-decoration: underline;
|
||||
text-decoration-thickness: 1px;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.bandeau-evt__lien:hover .bandeau-evt__annonce {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
|
||||
.bandeau-evt__fermer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 0;
|
||||
border-radius: var(--radius-sm);
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bandeau-evt__fermer:hover {
|
||||
background: color-mix(in srgb, var(--text) 10%, transparent);
|
||||
}
|
||||
|
||||
/* Le safran du focus disparaît sur le fond safran : l'anneau passe à l'encre. */
|
||||
.bandeau-evt__lien:focus-visible,
|
||||
.bandeau-evt__fermer:focus-visible {
|
||||
outline: 2px solid var(--text);
|
||||
outline-offset: -2px;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
/* Écran tactile : cible de fermeture de 44 px. */
|
||||
@media (pointer: coarse) {
|
||||
.bandeau-evt__fermer {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
}
|
||||
}
|
||||
|
||||
/* À partir de 768 px, la phrase tient sur une ligne : centrée, la croix au bord droit
|
||||
(marge gauche égale à la croix, pour un vrai centre). */
|
||||
@media (min-width: 48rem) {
|
||||
.bandeau-evt {
|
||||
padding-left: calc(32px + 4px + var(--space-xs));
|
||||
}
|
||||
.bandeau-evt__lien {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,372 @@
|
||||
<template>
|
||||
<div style="width: 100%; height: 100%; position: relative; background: #f5f3f0;">
|
||||
<svg ref="svgRef" style="width: 100%; height: 100%;"></svg>
|
||||
<div ref="tooltipRef" style="
|
||||
position: absolute; pointer-events: none;
|
||||
background: var(--nav-surface); border: 1px solid var(--nav-bg-alt);
|
||||
border-radius: 6px; padding: 8px 12px; font-size: 0.78rem;
|
||||
color: var(--nav-text); max-width: 240px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
opacity: 0; transition: opacity 0.15s; z-index: 100;
|
||||
"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface EcoleData { id: string; label: string; description: string; color: string; x_hint: number; y_hint: number }
|
||||
interface LivreRag { slug: string; titre: string; annee: number; couches: string[] }
|
||||
interface AuteurData { id: string; nom: string; dates: string; ecoles: string[]; ecole_principale: string; ingere: boolean; livres_rag: LivreRag[]; theses_cles: string[]; bio_courte: string; bio_courte_provisoire?: string }
|
||||
interface PenseesData { ecoles: EcoleData[]; auteurs: AuteurData[] }
|
||||
|
||||
// Liens d'influence inter-ecoles (Phase 7 - matrice de filiation)
|
||||
const LINKS_INFLUENCE = [
|
||||
// filiations directes
|
||||
{ source: 'eco-anarchisme', target: 'technocritique', auteurs_passerelle: ['Bookchin', 'Illich'], type: 'filiation' },
|
||||
{ source: 'eco-anarchisme', target: 'decroissance', auteurs_passerelle: ['Latouche', 'Kropotkine'], type: 'filiation' },
|
||||
{ source: 'ecosocialisme', target: 'decroissance', auteurs_passerelle: ['Saito', 'Gorz'], type: 'filiation' },
|
||||
{ source: 'ecosocialisme', target: 'ecologies-decoloniales', auteurs_passerelle: ['Klein', 'Ferdinand'], type: 'filiation' },
|
||||
{ source: 'ecofeminismes', target: 'ecologies-decoloniales', auteurs_passerelle: ['Shiva', 'Ouassak'], type: 'filiation' },
|
||||
{ source: 'ecofeminismes', target: 'pensees-vivant', auteurs_passerelle: ['Haraway', 'Despret'], type: 'filiation' },
|
||||
{ source: 'technocritique', target: 'decroissance', auteurs_passerelle: ['Ellul', 'Latouche'], type: 'filiation' },
|
||||
{ source: 'decroissance', target: 'pensees-vivant', auteurs_passerelle: ['Servigne', 'Despret'], type: 'filiation' },
|
||||
{ source: 'pensees-vivant', target: 'ethiques-environnementales', auteurs_passerelle: ['Naess', 'Latour'], type: 'filiation' },
|
||||
{ source: 'ecosocialisme', target: 'eco-anarchisme', auteurs_passerelle: ['Gorz', 'Graeber'], type: 'filiation' },
|
||||
// liens de critique
|
||||
{ source: 'ecosocialisme', target: 'capitalisme-vert', auteurs_passerelle: ['Klein', 'Malm'], type: 'critique' },
|
||||
{ source: 'decroissance', target: 'capitalisme-vert', auteurs_passerelle: ['Latouche', 'Meadows'], type: 'critique' },
|
||||
{ source: 'eco-anarchisme', target: 'capitalisme-vert', auteurs_passerelle: ['Bookchin'], type: 'critique' },
|
||||
{ source: 'ethiques-environnementales', target: 'ecofascismes', auteurs_passerelle: ['Naess'], type: 'critique' },
|
||||
{ source: 'capitalisme-vert', target: 'ecofascismes', auteurs_passerelle: [], type: 'critique' },
|
||||
]
|
||||
|
||||
const props = defineProps<{ data: PenseesData | null; active?: boolean }>()
|
||||
const emit = defineEmits<{ 'select-auteur': [id: string]; 'select-ecole': [id: string] }>()
|
||||
|
||||
const svgRef = ref<SVGElement | null>(null)
|
||||
const tooltipRef = ref<HTMLElement | null>(null)
|
||||
let simulation: any = null
|
||||
let d3LinkSel: any = null
|
||||
let d3InfluenceSel: any = null
|
||||
let d3NodeSel: any = null
|
||||
let d3EdgeLabelSel: any = null
|
||||
|
||||
async function initGraph() {
|
||||
if (!svgRef.value || !props.data) return
|
||||
const d3 = await import('d3')
|
||||
|
||||
const svgEl = svgRef.value
|
||||
const W = svgEl.clientWidth || 900
|
||||
const H = svgEl.clientHeight || 600
|
||||
|
||||
d3.select(svgEl).selectAll('*').remove()
|
||||
const svg = d3.select(svgEl).attr('viewBox', `0 0 ${W} ${H}`)
|
||||
const g = svg.append('g')
|
||||
|
||||
svg.call(d3.zoom<SVGElement, unknown>().scaleExtent([0.3, 4]).on('zoom', (e) => g.attr('transform', e.transform)) as any)
|
||||
|
||||
const ecoleMap = new Map<string, EcoleData>(props.data.ecoles.map(e => [e.id, e]))
|
||||
|
||||
// Positions fixes des ecoles (base pour forces D3)
|
||||
const ecolePositions = new Map<string, { tx: number; ty: number }>()
|
||||
props.data.ecoles.forEach(e => {
|
||||
ecolePositions.set(e.id, { tx: W * e.x_hint, ty: H * e.y_hint })
|
||||
})
|
||||
|
||||
// ---- LIENS D'INFLUENCE INTER-ECOLES (couche 3) ----
|
||||
const gInfluence = g.append('g').attr('class', 'links-influence')
|
||||
|
||||
LINKS_INFLUENCE.forEach(link => {
|
||||
const src = ecolePositions.get(link.source)
|
||||
const tgt = ecolePositions.get(link.target)
|
||||
if (!src || !tgt) return
|
||||
|
||||
const isCritique = link.type === 'critique'
|
||||
const lineEl = gInfluence.append('line')
|
||||
.attr('class', 'influence-link')
|
||||
.attr('x1', src.tx).attr('y1', src.ty)
|
||||
.attr('x2', tgt.tx).attr('y2', tgt.ty)
|
||||
.attr('stroke', isCritique ? '#d99' : '#9aa')
|
||||
.attr('stroke-width', 1)
|
||||
.attr('stroke-dasharray', isCritique ? '4,3' : '6,4')
|
||||
.attr('stroke-opacity', isCritique ? 0.2 : 0.22)
|
||||
|
||||
if (link.auteurs_passerelle && link.auteurs_passerelle.length > 0) {
|
||||
lineEl
|
||||
.on('mouseenter', (e: any) => {
|
||||
if (!tooltipRef.value) return
|
||||
tooltipRef.value.innerHTML = `<strong>Influence</strong><br><span style="opacity:0.8;font-size:0.72rem;">Passerelles : ${link.auteurs_passerelle.join(', ')}</span>`
|
||||
tooltipRef.value.style.opacity = '1'
|
||||
})
|
||||
.on('mousemove', (e: any) => {
|
||||
if (!tooltipRef.value || !svgEl) return
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
tooltipRef.value.style.left = (e.clientX - rect.left + 14) + 'px'
|
||||
tooltipRef.value.style.top = (e.clientY - rect.top - 10) + 'px'
|
||||
})
|
||||
.on('mouseleave', () => { if (tooltipRef.value) tooltipRef.value.style.opacity = '0' })
|
||||
}
|
||||
})
|
||||
|
||||
// ---- SIMULATION D3 (auteurs) ----
|
||||
const auteurNodes: any[] = props.data.auteurs.map(a => {
|
||||
const ecole = ecoleMap.get(a.ecole_principale)
|
||||
const jitter = () => (Math.random() - 0.5) * 80
|
||||
return {
|
||||
id: a.id, type: 'auteur', nom: a.nom, dates: a.dates,
|
||||
bio_courte: a.bio_courte,
|
||||
bio_provisoire: a.bio_courte_provisoire ?? '',
|
||||
ingere: a.ingere,
|
||||
ecole_principale: a.ecole_principale,
|
||||
color: ecole?.color ?? '#888', r: 11,
|
||||
x: W * (ecole?.x_hint ?? 0.5) + jitter(),
|
||||
y: H * (ecole?.y_hint ?? 0.5) + jitter(),
|
||||
}
|
||||
})
|
||||
|
||||
// Liens appartenance auteur -> ecole (vers centroid fixe)
|
||||
const links: any[] = []
|
||||
props.data.auteurs.forEach(a => {
|
||||
links.push({ source: a.id, target: a.ecole_principale, strength: 0.65, isSubcourant: false })
|
||||
a.ecoles.filter(e => e !== a.ecole_principale).forEach(e => {
|
||||
links.push({ source: a.id, target: e, strength: 0.25, isSubcourant: true })
|
||||
})
|
||||
})
|
||||
|
||||
// Nodes fictifs fixes pour les ecoles (cibles des liens appartenance)
|
||||
const ecoleFixedNodes: any[] = props.data.ecoles.map(e => ({
|
||||
id: e.id, type: 'ecole-fixed', ecoleId: e.id,
|
||||
x: W * e.x_hint, y: H * e.y_hint,
|
||||
fx: W * e.x_hint, fy: H * e.y_hint,
|
||||
}))
|
||||
|
||||
// Rayon proportionnel au nombre d'auteurs de l'ecole
|
||||
const ecoleAuteurCounts = new Map<string, number>()
|
||||
props.data.ecoles.forEach(e => ecoleAuteurCounts.set(e.id, 0))
|
||||
props.data.auteurs.forEach(a => ecoleAuteurCounts.set(a.ecole_principale, (ecoleAuteurCounts.get(a.ecole_principale) ?? 0) + 1))
|
||||
const ecoleRadius = (count: number) => Math.max(16, Math.min(36, 13 + count * 1.5))
|
||||
|
||||
const allNodes = [...ecoleFixedNodes, ...auteurNodes]
|
||||
|
||||
if (simulation) simulation.stop()
|
||||
simulation = d3.forceSimulation(allNodes)
|
||||
.force('link', d3.forceLink(links).id((d: any) => d.id).distance(120).strength((d: any) => d.strength ?? 0.5))
|
||||
.force('charge', d3.forceManyBody().strength(-70))
|
||||
.force('center', d3.forceCenter(W / 2, H / 2).strength(0.02))
|
||||
.force('collision', d3.forceCollide().radius((d: any) => d.type === 'ecole-fixed' ? ecoleRadius(ecoleAuteurCounts.get(d.ecoleId) ?? 0) + 4 : 12))
|
||||
.force('forceX', d3.forceX<any>((d: any) => {
|
||||
if (d.type === 'auteur') {
|
||||
const pos = ecolePositions.get(d.ecole_principale)
|
||||
return pos ? pos.tx : W / 2
|
||||
}
|
||||
return W / 2
|
||||
}).strength(0.15))
|
||||
.force('forceY', d3.forceY<any>((d: any) => {
|
||||
if (d.type === 'auteur') {
|
||||
const pos = ecolePositions.get(d.ecole_principale)
|
||||
return pos ? pos.ty : H / 2
|
||||
}
|
||||
return H / 2
|
||||
}).strength(0.15))
|
||||
|
||||
// ---- NOEUDS ECOLES visibles (couche 3.5) ----
|
||||
const gEcoles = g.append('g').attr('class', 'ecoles-nodes')
|
||||
ecoleFixedNodes.forEach(eNode => {
|
||||
const ecole = ecoleMap.get(eNode.ecoleId)
|
||||
if (!ecole) return
|
||||
const count = ecoleAuteurCounts.get(eNode.ecoleId) ?? 0
|
||||
const r = ecoleRadius(count)
|
||||
gEcoles.append('circle')
|
||||
.attr('cx', eNode.fx).attr('cy', eNode.fy).attr('r', r)
|
||||
.attr('fill', ecole.color).attr('fill-opacity', 0.82).attr('stroke', ecole.color).attr('stroke-width', 2)
|
||||
.attr('class', 'ecole-node').style('cursor', 'pointer')
|
||||
.on('mouseenter', (e: any) => {
|
||||
if (!tooltipRef.value) return
|
||||
tooltipRef.value.innerHTML = `<strong>${ecole.label}</strong> <span style="opacity:0.6;font-size:0.7rem;">${count} auteur${count > 1 ? 's' : ''}</span><br><span style="opacity:0.75;font-size:0.72rem;">${ecole.description}</span>`
|
||||
tooltipRef.value.style.opacity = '1'
|
||||
})
|
||||
.on('mousemove', (e: any) => {
|
||||
if (!tooltipRef.value || !svgEl) return
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
tooltipRef.value.style.left = (e.clientX - rect.left + 14) + 'px'
|
||||
tooltipRef.value.style.top = (e.clientY - rect.top - 10) + 'px'
|
||||
})
|
||||
.on('mouseleave', () => { if (tooltipRef.value) tooltipRef.value.style.opacity = '0' })
|
||||
.on('click', (e: any) => { e.stopPropagation(); emit('select-ecole', eNode.ecoleId) })
|
||||
|
||||
// ---- TITRES ECOLES visibles en permanence ----
|
||||
const labelText = ecole.label
|
||||
const words = labelText.split(' ')
|
||||
const fontSize = Math.max(12, r * 0.45)
|
||||
if (words.length > 2 || labelText.length > 12) {
|
||||
const mid = Math.ceil(words.length / 2)
|
||||
const line1 = words.slice(0, mid).join(' ')
|
||||
const line2 = words.slice(mid).join(' ')
|
||||
const textEl = gEcoles.append('text')
|
||||
.attr('x', eNode.fx)
|
||||
.attr('y', eNode.fy)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dominant-baseline', 'middle')
|
||||
.style('pointer-events', 'none')
|
||||
.style('font-weight', '700')
|
||||
.style('font-size', `${fontSize}px`)
|
||||
.style('fill', '#ffffff')
|
||||
.style('text-shadow', '0 1px 3px rgba(0,0,0,0.5)')
|
||||
.style('user-select', 'none')
|
||||
textEl.append('tspan')
|
||||
.attr('x', eNode.fx)
|
||||
.attr('dy', `-${fontSize * 0.6}px`)
|
||||
.text(line1)
|
||||
textEl.append('tspan')
|
||||
.attr('x', eNode.fx)
|
||||
.attr('dy', `${fontSize * 1.2}px`)
|
||||
.text(line2)
|
||||
} else {
|
||||
gEcoles.append('text')
|
||||
.attr('x', eNode.fx)
|
||||
.attr('y', eNode.fy)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dominant-baseline', 'middle')
|
||||
.style('pointer-events', 'none')
|
||||
.style('font-weight', '700')
|
||||
.style('font-size', `${fontSize}px`)
|
||||
.style('fill', '#ffffff')
|
||||
.style('user-select', 'none')
|
||||
.text(labelText)
|
||||
}
|
||||
})
|
||||
|
||||
// ---- LIENS APPARTENANCE (couche 4) ----
|
||||
const gLinks = g.append('g').attr('class', 'links-appartenance')
|
||||
d3LinkSel = gLinks.selectAll('line').data(links).join('line')
|
||||
.attr('stroke', 'rgba(150,150,150,0.28)').attr('stroke-width', 1.2)
|
||||
|
||||
// ---- EDGE LABELS - sous-courants (couche 4b) ----
|
||||
const subcourantLinks = links.filter((l: any) => l.isSubcourant)
|
||||
d3EdgeLabelSel = gLinks.selectAll('text.pensees-edge-label')
|
||||
.data(subcourantLinks)
|
||||
.join('text')
|
||||
.attr('class', 'pensees-edge-label')
|
||||
|
||||
// ---- NODES AUTEURS (couche 5) ----
|
||||
const gAuteurs = g.append('g').attr('class', 'auteurs')
|
||||
d3NodeSel = gAuteurs.selectAll('g').data(auteurNodes).join('g')
|
||||
.style('cursor', (d: any) => d.ingere ? 'pointer' : 'default')
|
||||
.call(d3.drag<any, any>()
|
||||
.on('start', (e: any, d: any) => { if (!e.active) simulation.alphaTarget(0.3).restart(); d.fx = d.x; d.fy = d.y })
|
||||
.on('drag', (e: any, d: any) => { d.fx = e.x; d.fy = e.y })
|
||||
.on('end', (e: any, d: any) => { if (!e.active) simulation.alphaTarget(0); d.fx = null; d.fy = null }))
|
||||
.on('click', (e: any, d: any) => {
|
||||
if (!d.ingere) return
|
||||
e.stopPropagation()
|
||||
emit('select-auteur', d.id)
|
||||
})
|
||||
|
||||
// Phase 8.D : grisage conditionnel auteurs non-ingeres
|
||||
d3NodeSel.append('circle')
|
||||
.attr('r', (d: any) => d.r)
|
||||
.attr('fill', (d: any) => d.ingere ? (d.color + 'cc') : '#bbbbbb')
|
||||
.attr('stroke', (d: any) => d.ingere ? d.color : '#999999')
|
||||
.attr('stroke-width', 1.5)
|
||||
.attr('opacity', (d: any) => d.ingere ? 1 : 0.35)
|
||||
|
||||
// ---- LABELS AUTEURS (couche 6 - drop-shadow blanc) ----
|
||||
d3NodeSel.append('text')
|
||||
.attr('class', 'pensees-auteur-label')
|
||||
.text((d: any) => d.nom.split(' ').pop() ?? d.nom)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dy', (d: any) => -(d.r + 4))
|
||||
.style('pointer-events', 'none')
|
||||
.style('opacity', (d: any) => d.ingere ? 1 : 0.3)
|
||||
.style('fill', (d: any) => d.ingere ? '#1a1a1a' : '#777777')
|
||||
|
||||
d3NodeSel
|
||||
.on('mouseenter', (e: any, d: any) => {
|
||||
if (!tooltipRef.value) return
|
||||
let tooltipHtml = ''
|
||||
if (d.ingere) {
|
||||
const rawBio = d.bio_courte || ''
|
||||
const bio = rawBio.length > 90 ? rawBio.slice(0, 87) + '...' : rawBio
|
||||
tooltipHtml = `<strong>${d.nom}</strong> <span style="opacity:0.6;font-size:0.7rem;">${d.dates}</span><br><span style="opacity:0.75;font-size:0.72rem;">${bio || 'Dans le RAG ATIS.'}</span>`
|
||||
} else {
|
||||
tooltipHtml = `<strong>${d.nom}</strong> <span style="opacity:0.6;font-size:0.7rem;">${d.dates}</span><br><span style="opacity:0.65;font-size:0.72rem;font-style:italic;">Présent dans Bonpote, pas encore ingéré dans le RAG ATIS.</span>`
|
||||
}
|
||||
tooltipRef.value.innerHTML = tooltipHtml
|
||||
tooltipRef.value.style.opacity = '1'
|
||||
})
|
||||
.on('mousemove', (e: any) => {
|
||||
if (!tooltipRef.value || !svgEl) return
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
tooltipRef.value.style.left = (e.clientX - rect.left + 14) + 'px'
|
||||
tooltipRef.value.style.top = (e.clientY - rect.top - 10) + 'px'
|
||||
})
|
||||
.on('mouseleave', () => { if (tooltipRef.value) tooltipRef.value.style.opacity = '0' })
|
||||
|
||||
simulation.on('tick', () => {
|
||||
d3LinkSel
|
||||
.attr('x1', (d: any) => d.source.x).attr('y1', (d: any) => d.source.y)
|
||||
.attr('x2', (d: any) => d.target.x).attr('y2', (d: any) => d.target.y)
|
||||
|
||||
d3EdgeLabelSel
|
||||
.attr('x', (d: any) => (d.source.x + d.target.x) / 2)
|
||||
.attr('y', (d: any) => (d.source.y + d.target.y) / 2)
|
||||
.text((d: any) => {
|
||||
const targetId = typeof d.target === 'object' ? d.target.id : d.target
|
||||
return targetId
|
||||
})
|
||||
|
||||
d3NodeSel.attr('transform', (d: any) => `translate(${d.x},${d.y})`)
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => props.active, (val) => {
|
||||
if (val && import.meta.client && props.data)
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
})
|
||||
watch(() => props.data, (val) => {
|
||||
if (val && props.active && import.meta.client)
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
})
|
||||
onMounted(async () => {
|
||||
if (import.meta.client && props.data && props.active) {
|
||||
await nextTick()
|
||||
initGraph()
|
||||
}
|
||||
})
|
||||
onUnmounted(() => { if (simulation) simulation.stop() })
|
||||
|
||||
function triggerResize() {
|
||||
if (simulation) {
|
||||
simulation.alpha(0.3).restart()
|
||||
} else if (import.meta.client && props.data && props.active) {
|
||||
initGraph()
|
||||
}
|
||||
}
|
||||
defineExpose({ triggerResize })
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.pensees-auteur-label {
|
||||
fill: #1a1a1a;
|
||||
font-weight: 600;
|
||||
font-size: 10px;
|
||||
filter: drop-shadow(0 0 2.5px rgba(255,255,255,0.95));
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.pensees-edge-label {
|
||||
fill: #555;
|
||||
font-size: 8.5px;
|
||||
font-style: italic;
|
||||
opacity: 0.7;
|
||||
text-anchor: middle;
|
||||
dominant-baseline: middle;
|
||||
user-select: none;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ecole-node {
|
||||
transition: opacity 0.15s, r 0.15s;
|
||||
}
|
||||
.ecole-node:hover {
|
||||
opacity: 0.75;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<span v-if="profondeur === 'approfondi'" class="chat-mode-badge">{{ CHAT_PROFONDEUR_LIBELLES.approfondi }}</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// Étiquette sobre sur une réponse donnée en mode approfondi (rien en mode rapide).
|
||||
defineProps<{ profondeur?: string }>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chat-mode-badge {
|
||||
display: inline-block;
|
||||
margin-bottom: 6px;
|
||||
padding: 1px 8px;
|
||||
border-radius: 9999px;
|
||||
border: 1px solid var(--nav-bg-alt);
|
||||
font-size: 0.66rem;
|
||||
font-family: var(--nav-font);
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<div class="chat-mode" role="radiogroup" aria-label="Mode de réponse">
|
||||
<button
|
||||
v-for="(p, i) in CHAT_PROFONDEURS"
|
||||
:key="p"
|
||||
:ref="(el) => (boutons[i] = el as HTMLButtonElement | null)"
|
||||
type="button"
|
||||
role="radio"
|
||||
class="chat-mode-option"
|
||||
:class="{ active: modelValue === p }"
|
||||
:aria-checked="modelValue === p"
|
||||
:tabindex="modelValue === p ? 0 : -1"
|
||||
:title="CHAT_PROFONDEUR_AIDES[p]"
|
||||
:disabled="disabled"
|
||||
@click="choisir(p)"
|
||||
@keydown="onKey($event, i)"
|
||||
>{{ CHAT_PROFONDEUR_LIBELLES[p] }}</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// Toggle 2 options partagé par les 5 chatbots. Libellés : utils/chatProfondeur.ts.
|
||||
// radiogroup : flèches déplacent la sélection, Tab entre/sort du groupe (roving tabindex).
|
||||
const props = defineProps<{ modelValue: 'rapide' | 'approfondi'; disabled?: boolean }>()
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: 'rapide' | 'approfondi'] }>()
|
||||
|
||||
const boutons = ref<(HTMLButtonElement | null)[]>([])
|
||||
|
||||
function choisir(p: ChatProfondeur) {
|
||||
if (!props.disabled) emit('update:modelValue', p)
|
||||
}
|
||||
|
||||
function onKey(e: KeyboardEvent, i: number) {
|
||||
const n = CHAT_PROFONDEURS.length
|
||||
let j = -1
|
||||
if (e.key === 'ArrowRight' || e.key === 'ArrowDown') j = (i + 1) % n
|
||||
else if (e.key === 'ArrowLeft' || e.key === 'ArrowUp') j = (i - 1 + n) % n
|
||||
else if (e.key === 'Home') j = 0
|
||||
else if (e.key === 'End') j = n - 1
|
||||
if (j < 0) return
|
||||
e.preventDefault()
|
||||
choisir(CHAT_PROFONDEURS[j])
|
||||
nextTick(() => boutons.value[j]?.focus())
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chat-mode {
|
||||
display: inline-flex;
|
||||
gap: 2px;
|
||||
padding: 2px;
|
||||
border-radius: 9999px;
|
||||
background: var(--nav-bg-alt);
|
||||
align-self: flex-start;
|
||||
}
|
||||
.chat-mode-option {
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--nav-text-muted);
|
||||
font-family: var(--nav-font);
|
||||
font-size: 0.72rem;
|
||||
line-height: 1.2;
|
||||
padding: 4px 10px;
|
||||
border-radius: 9999px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
.chat-mode-option:hover:not(.active):not(:disabled) { color: var(--nav-text); }
|
||||
.chat-mode-option.active {
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
.chat-mode-option:focus-visible { outline: 2px solid var(--nav-primary); outline-offset: 2px; }
|
||||
.chat-mode-option:disabled { opacity: 0.5; cursor: not-allowed; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.chat-mode-option { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<button type="button" class="chat-new-conversation" @click="emit('reset')">
|
||||
Nouvelle conversation
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
// Bouton sobre « Nouvelle conversation », partagé par les chatbots.
|
||||
// Le parent le rend seulement s'il y a un historique et gère la purge.
|
||||
const emit = defineEmits<{ reset: [] }>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chat-new-conversation {
|
||||
align-self: flex-end;
|
||||
flex-shrink: 0;
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding: 4px 6px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.72rem;
|
||||
font-family: var(--nav-font);
|
||||
color: var(--nav-text-muted);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chat-new-conversation:hover { color: var(--nav-text); background: var(--nav-bg-alt); }
|
||||
.chat-new-conversation:focus-visible { outline: 2px solid var(--nav-primary); outline-offset: 2px; }
|
||||
</style>
|
||||
@@ -0,0 +1,578 @@
|
||||
<template>
|
||||
<div class="chatbot-pensees" :class="{ inline: inline }">
|
||||
<!-- Header compact -->
|
||||
<div class="chatbot-header">
|
||||
<div class="chatbot-header-left">
|
||||
<div class="chatbot-icon">
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="chatbot-title">
|
||||
<template v-if="auteurContext">{{ auteurContext }}</template>
|
||||
<template v-else>Bibliothèque des pensées</template>
|
||||
</span>
|
||||
<span v-if="auteurContext" class="chatbot-corpus-badge">auteur</span>
|
||||
<span v-else class="chatbot-corpus-badge">FRACAS</span>
|
||||
</div>
|
||||
<div class="chatbot-header-right">
|
||||
<select v-model="corpusMode" class="chatbot-corpus-select" title="Corpus interrogé">
|
||||
<option value="pensees">Pensées éco.</option>
|
||||
<option value="both">Pensées + Projets</option>
|
||||
<option value="projets">Projets</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Zone messages -->
|
||||
<div ref="messagesContainer" class="chatbot-messages">
|
||||
<!-- Onboarding -->
|
||||
<div v-if="messages.length === 0" class="chatbot-onboarding">
|
||||
<template v-if="auteurContext">
|
||||
<p>Interroge le corpus de <strong>{{ auteurContext }}</strong> — ses livres, ses thèses, ses arguments.</p>
|
||||
<p class="chatbot-onboarding-hint">Ex : "Quelle est sa critique du capitalisme vert ?"</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p>Bibliothèque des pensées écologiques — <strong>~140 auteurs FRACAS</strong>, de l'écosocialisme à l'éthique environnementale.</p>
|
||||
<p class="chatbot-onboarding-hint">Ex : "Quelles différences entre décroissance et doughnut économics ?"</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Messages -->
|
||||
<template v-for="(msg, i) in messages" :key="i">
|
||||
<div v-if="msg.role === 'user'" class="chatbot-bubble user">{{ msg.content }}</div>
|
||||
<div v-else class="chatbot-bubble assistant">
|
||||
<ChatModeBadge :profondeur="msg.profondeur" />
|
||||
<div class="chatbot-md" v-html="renderMd(msg.content)" />
|
||||
<div v-if="msg.auteur" class="chatbot-auteur-tag">
|
||||
<span>{{ msg.auteur.nom }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- Chargement : texte d'attente progressif. L'annonce aux lecteurs d'écran passe par la région
|
||||
live persistante ci-dessous (une région insérée à chaud n'est pas fiablement annoncée). -->
|
||||
<div v-if="loading" class="chatbot-bubble assistant loading" aria-hidden="true">
|
||||
<span class="dot" /><span class="dot" /><span class="dot" />
|
||||
<span class="attente-texte">{{ attenteTexte }}</span>
|
||||
</div>
|
||||
<div class="sr-only" role="status" aria-live="polite" aria-atomic="true">{{ loading ? attenteTexte : '' }}</div>
|
||||
|
||||
<!-- Erreur -->
|
||||
<div v-if="errorMsg" class="chatbot-error" role="alert">
|
||||
<span>{{ errorMsg }}</span>
|
||||
<button v-if="peutReessayer" type="button" class="chatbot-retry-btn" @click="reessayer">Réessayer</button>
|
||||
</div>
|
||||
|
||||
<ChatNewConversation v-if="hasHistory && !loading" @reset="clearMessages" />
|
||||
</div>
|
||||
|
||||
<!-- Mode de réponse -->
|
||||
<div class="chatbot-mode-row">
|
||||
<ChatModeToggle v-model="profondeur" :disabled="loading" />
|
||||
</div>
|
||||
|
||||
<!-- Input -->
|
||||
<div class="chatbot-input-row">
|
||||
<input
|
||||
v-model="inputText"
|
||||
type="text"
|
||||
:disabled="loading"
|
||||
:placeholder="auteurContext ? `Interroger ${auteurContext}…` : 'Pose ta question sur les pensées éco…'"
|
||||
class="chatbot-input"
|
||||
@keydown.enter.prevent="sendMessage"
|
||||
/>
|
||||
<button
|
||||
:disabled="loading || !inputText.trim()"
|
||||
class="chatbot-send-btn"
|
||||
aria-label="Envoyer"
|
||||
@click="sendMessage"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<line x1="22" y1="2" x2="11" y2="13"/>
|
||||
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMarkdown } from '~/composables/useMarkdown'
|
||||
|
||||
const { render: renderMd } = useMarkdown()
|
||||
|
||||
interface ChatMessage {
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
auteur?: { slug: string; nom: string } | null
|
||||
profondeur?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
auteurContext: string | null
|
||||
inline?: boolean
|
||||
}>()
|
||||
|
||||
// Une conversation par contexte (corpus général ou un auteur) : changer d'auteur
|
||||
// ne mélange pas les historiques, et un rechargement restaure le bon.
|
||||
const sessionKey = computed(() => props.auteurContext ? `pensees-${slugify(props.auteurContext)}` : 'pensees')
|
||||
const { messages, hasHistory, clear } = useChatSession<ChatMessage>(sessionKey)
|
||||
// `profondeur` (et non `mode`, réservé au mode de recherche LightRAG côté serveur)
|
||||
const profondeur = useChatProfondeur('pensees')
|
||||
const inputText = ref('')
|
||||
const loading = ref(false)
|
||||
const errorMsg = ref('')
|
||||
const corpusMode = ref<'pensees' | 'projets' | 'both'>('pensees')
|
||||
const messagesContainer = ref<HTMLElement | null>(null)
|
||||
|
||||
// --- Attente et erreurs : état d'interface uniquement, jamais persisté (hors useChatSession) ---
|
||||
// Mesuré le 09/10 : récupération 2-5 s, génération 10-18 s, 19-29 s bout en bout. Les seuils suivent ces
|
||||
// phases ; le texte est une minuterie (le serveur renvoie tout d'un bloc : il faut la réponse complète
|
||||
// pour vérifier les citations, donc pas de flux de texte).
|
||||
const SEUIL_REDIGE_S = 6
|
||||
const SEUIL_LONG_S = 30
|
||||
// Au-delà du timeout serveur (90 s) : le front ne lâche jamais avant la route, et ne tourne jamais sans fin.
|
||||
const TIMEOUT_FRONT_MS = 95000
|
||||
|
||||
const attenteS = ref(0)
|
||||
const attenteTexte = computed(() => {
|
||||
if (attenteS.value >= SEUIL_LONG_S) return 'Le corpus est vaste, encore un instant…'
|
||||
if (attenteS.value >= SEUIL_REDIGE_S) return 'Je rédige…'
|
||||
return 'Je fouille le corpus…'
|
||||
})
|
||||
let attenteTimer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
function demarrerAttente() {
|
||||
arreterAttente()
|
||||
attenteS.value = 0
|
||||
const t0 = Date.now()
|
||||
attenteTimer = setInterval(() => { attenteS.value = Math.floor((Date.now() - t0) / 1000) }, 1000)
|
||||
}
|
||||
function arreterAttente() {
|
||||
if (attenteTimer) { clearInterval(attenteTimer); attenteTimer = null }
|
||||
}
|
||||
onBeforeUnmount(arreterAttente)
|
||||
|
||||
interface Envoi { query: string; profondeur: string; corpus: string; auteurSlug?: string }
|
||||
const dernierEnvoi = ref<Envoi | null>(null)
|
||||
const peutReessayer = ref(false)
|
||||
|
||||
watch(sessionKey, () => {
|
||||
errorMsg.value = ''
|
||||
peutReessayer.value = false
|
||||
dernierEnvoi.value = null
|
||||
})
|
||||
|
||||
function clearMessages() {
|
||||
clear()
|
||||
errorMsg.value = ''
|
||||
peutReessayer.value = false
|
||||
dernierEnvoi.value = null
|
||||
}
|
||||
|
||||
function messageErreur(e: any): { texte: string; reessayer: boolean } {
|
||||
const status = e?.statusCode ?? e?.status ?? e?.response?.status
|
||||
const detail = String(e?.data?.message ?? e?.statusMessage ?? e?.message ?? '')
|
||||
if (status === 429) {
|
||||
// 429 de la route : quota du jour (pas de réessai utile) ou RAG saturé (réessai possible)
|
||||
if (/satur/i.test(detail)) return { texte: 'Le corpus est très sollicité en ce moment. Patiente quelques secondes, puis réessaie.', reessayer: true }
|
||||
return { texte: 'Tu as atteint la limite de 20 questions par jour. Reviens demain, ou explore les fiches auteurs en attendant.', reessayer: false }
|
||||
}
|
||||
if (status === 503) return { texte: 'La bibliothèque est indisponible pour l\'instant. Réessaie dans quelques minutes.', reessayer: true }
|
||||
if (status === 504) return { texte: 'La bibliothèque met trop de temps à répondre : la question est peut-être trop large. Réessaie, ou reformule-la plus précisément.', reessayer: true }
|
||||
if (!status && /timeout|timed out|abort/i.test(`${detail} ${e?.name ?? ''} ${e?.cause?.name ?? ''}`)) {
|
||||
return { texte: 'Désolé, la réponse met plus de temps que prévu et n\'a pas abouti. Tu peux relancer la même question.', reessayer: true }
|
||||
}
|
||||
if (!status) return { texte: 'La connexion semble coupée : la question n\'est pas partie. Vérifie ton réseau puis réessaie.', reessayer: true }
|
||||
return { texte: 'Une erreur est survenue. Réessaie dans quelques instants.', reessayer: true }
|
||||
}
|
||||
|
||||
function scrollToBottom() {
|
||||
if (messagesContainer.value) {
|
||||
messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight
|
||||
}
|
||||
}
|
||||
|
||||
async function sendMessage() {
|
||||
const query = inputText.value.trim()
|
||||
if (!query || loading.value) return
|
||||
|
||||
inputText.value = ''
|
||||
messages.value.push({ role: 'user', content: query })
|
||||
await envoyer({
|
||||
query,
|
||||
profondeur: profondeur.value,
|
||||
corpus: corpusMode.value,
|
||||
auteurSlug: props.auteurContext ? slugify(props.auteurContext) : undefined,
|
||||
})
|
||||
}
|
||||
|
||||
// Reposte la même question (même mode, même corpus) sans dupliquer le message de l'usager.
|
||||
async function reessayer() {
|
||||
if (!dernierEnvoi.value || loading.value) return
|
||||
await envoyer(dernierEnvoi.value)
|
||||
}
|
||||
|
||||
async function envoyer(envoi: Envoi) {
|
||||
errorMsg.value = ''
|
||||
peutReessayer.value = false
|
||||
dernierEnvoi.value = envoi
|
||||
loading.value = true
|
||||
demarrerAttente()
|
||||
|
||||
await nextTick()
|
||||
scrollToBottom()
|
||||
|
||||
try {
|
||||
const res = await $fetch<{
|
||||
response: string
|
||||
auteur: { slug: string; nom: string } | null
|
||||
}>('/api/chatbot-pensees', {
|
||||
method: 'POST',
|
||||
timeout: TIMEOUT_FRONT_MS,
|
||||
body: {
|
||||
query: envoi.query,
|
||||
corpus: envoi.corpus,
|
||||
profondeur: envoi.profondeur,
|
||||
auteur_slug: envoi.auteurSlug,
|
||||
},
|
||||
})
|
||||
messages.value.push({
|
||||
role: 'assistant',
|
||||
content: res.response,
|
||||
auteur: res.auteur ?? null,
|
||||
profondeur: envoi.profondeur,
|
||||
})
|
||||
dernierEnvoi.value = null
|
||||
} catch (e: any) {
|
||||
const { texte, reessayer: ok } = messageErreur(e)
|
||||
errorMsg.value = texte
|
||||
peutReessayer.value = ok
|
||||
} finally {
|
||||
arreterAttente()
|
||||
loading.value = false
|
||||
await nextTick()
|
||||
scrollToBottom()
|
||||
}
|
||||
}
|
||||
|
||||
function slugify(str: string): string {
|
||||
return str.toLowerCase()
|
||||
.normalize('NFD').replace(/[̀-ͯ]/g, '')
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-|-$/g, '')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chatbot-pensees {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
background: var(--nav-bg);
|
||||
}
|
||||
|
||||
/* Header */
|
||||
.chatbot-header {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 6px 12px;
|
||||
background: var(--nav-surface);
|
||||
border-bottom: 1px solid rgba(180, 170, 160, 0.22);
|
||||
min-height: 36px;
|
||||
}
|
||||
|
||||
.chatbot-header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.chatbot-icon {
|
||||
flex-shrink: 0;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 50%;
|
||||
background: var(--nav-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--nav-text-on-primary);
|
||||
}
|
||||
|
||||
.chatbot-title {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
.chatbot-corpus-badge {
|
||||
flex-shrink: 0;
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
color: var(--nav-text-muted);
|
||||
background: var(--nav-bg-alt);
|
||||
border-radius: 4px;
|
||||
padding: 1px 5px;
|
||||
}
|
||||
|
||||
.chatbot-header-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.chatbot-clear-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--nav-text-muted);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
}
|
||||
|
||||
.chatbot-clear-btn:hover {
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text);
|
||||
}
|
||||
|
||||
.chatbot-corpus-select {
|
||||
font-size: 0.7rem;
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid rgba(180, 170, 160, 0.3);
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text-muted);
|
||||
cursor: pointer;
|
||||
max-width: 110px;
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
.chatbot-messages {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.chatbot-onboarding {
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.55;
|
||||
color: var(--nav-text-muted);
|
||||
background: var(--nav-bg-alt);
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.chatbot-onboarding p { margin: 0 0 6px; }
|
||||
.chatbot-onboarding p:last-child { margin-bottom: 0; }
|
||||
.chatbot-onboarding strong { color: var(--nav-text); font-weight: 600; }
|
||||
.chatbot-onboarding-hint { font-style: italic; font-size: 0.75rem; opacity: 0.75; }
|
||||
|
||||
/* Bulles */
|
||||
.chatbot-bubble {
|
||||
max-width: 88%;
|
||||
font-size: 0.825rem;
|
||||
line-height: 1.55;
|
||||
border-radius: 10px;
|
||||
padding: 8px 11px;
|
||||
}
|
||||
|
||||
.chatbot-bubble.user {
|
||||
align-self: flex-end;
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
border-radius: 10px 10px 3px 10px;
|
||||
}
|
||||
|
||||
.chatbot-bubble.assistant {
|
||||
align-self: flex-start;
|
||||
background: var(--nav-surface);
|
||||
border: 1px solid rgba(180, 170, 160, 0.22);
|
||||
color: var(--nav-text);
|
||||
border-radius: 10px 10px 10px 3px;
|
||||
}
|
||||
|
||||
/* Markdown dans les bulles */
|
||||
:deep(.chatbot-md) { font-size: inherit; line-height: 1.55; }
|
||||
:deep(.chatbot-md p) { margin: 0 0 0.35em; }
|
||||
:deep(.chatbot-md p:last-child) { margin-bottom: 0; }
|
||||
:deep(.chatbot-md strong) { font-weight: 700; }
|
||||
:deep(.chatbot-md em) { font-style: italic; }
|
||||
:deep(.chatbot-md ul) { margin: 0.25em 0 0.25em 1em; list-style: disc; padding: 0; }
|
||||
:deep(.chatbot-md li) { margin-bottom: 0.1em; }
|
||||
|
||||
.chatbot-auteur-tag {
|
||||
margin-top: 6px;
|
||||
font-size: 0.7rem;
|
||||
color: var(--nav-text-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Loading */
|
||||
.chatbot-bubble.loading {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
align-items: center;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.attente-texte {
|
||||
margin-left: 6px;
|
||||
font-size: 0.775rem;
|
||||
color: var(--nav-text-muted);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--nav-text-muted);
|
||||
animation: blink 1.2s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.dot:nth-child(2) { animation-delay: 0.2s; }
|
||||
.dot:nth-child(3) { animation-delay: 0.4s; }
|
||||
|
||||
@keyframes blink {
|
||||
0%, 80%, 100% { opacity: 0.25; }
|
||||
40% { opacity: 1; }
|
||||
}
|
||||
|
||||
/* Pas d'animation si l'usager la réduit : points fixes, le texte d'attente porte l'information */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.dot { animation: none; opacity: 0.6; }
|
||||
}
|
||||
|
||||
/* Erreur */
|
||||
.chatbot-error {
|
||||
align-self: flex-start;
|
||||
font-size: 0.775rem;
|
||||
color: #a85d3e;
|
||||
background: rgba(168, 93, 62, 0.08);
|
||||
border-radius: 8px;
|
||||
padding: 7px 10px;
|
||||
max-width: 90%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.chatbot-retry-btn {
|
||||
font: inherit;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text-on-primary);
|
||||
background: var(--nav-primary);
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 4px 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.chatbot-retry-btn:hover { opacity: 0.85; }
|
||||
.chatbot-retry-btn:focus-visible { outline: 2px solid var(--nav-primary); outline-offset: 2px; }
|
||||
|
||||
/* Mode de réponse */
|
||||
.chatbot-mode-row {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
padding: 6px 10px 0;
|
||||
border-top: 1px solid rgba(180, 170, 160, 0.22);
|
||||
background: var(--nav-surface);
|
||||
}
|
||||
.chatbot-mode-row + .chatbot-input-row { border-top: none; }
|
||||
|
||||
/* Input */
|
||||
.chatbot-input-row {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 10px;
|
||||
border-top: 1px solid rgba(180, 170, 160, 0.22);
|
||||
background: var(--nav-surface);
|
||||
}
|
||||
|
||||
.chatbot-input {
|
||||
flex: 1;
|
||||
padding: 6px 10px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(180, 170, 160, 0.3);
|
||||
background: var(--nav-bg);
|
||||
color: var(--nav-text);
|
||||
font-family: var(--nav-font);
|
||||
font-size: 0.8rem;
|
||||
min-width: 0;
|
||||
transition: border-color 0.15s;
|
||||
}
|
||||
|
||||
.chatbot-input:focus {
|
||||
outline: none;
|
||||
border-color: var(--nav-primary);
|
||||
}
|
||||
|
||||
.chatbot-input:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.chatbot-send-btn {
|
||||
flex-shrink: 0;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 7px;
|
||||
border: none;
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
|
||||
.chatbot-send-btn:disabled {
|
||||
opacity: 0.35;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.chatbot-send-btn:not(:disabled):hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
</style>
|
||||
@@ -12,7 +12,7 @@
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:aria-expanded="isExpanded"
|
||||
aria-label="Ouvrir l'assistant chatbot"
|
||||
:aria-label="`Ouvrir l'assistant : ${titre}`"
|
||||
@keydown.enter="toggleExpand"
|
||||
@keydown.space.prevent="toggleExpand"
|
||||
>
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
|
||||
<span class="flex-1 text-sm" style="color: var(--nav-text-muted);">
|
||||
{{ isExpanded ? 'Chatbot AEP' : 'Pose une question sur le réseau…' }}
|
||||
{{ isExpanded ? titre : placeholderReplie }}
|
||||
</span>
|
||||
|
||||
<!-- Chevron -->
|
||||
@@ -52,37 +52,44 @@
|
||||
<div class="chatbot-body-inner" ref="messagesContainer">
|
||||
<!-- Onboarding -->
|
||||
<div v-if="messages.length === 0" class="onboarding-bubble">
|
||||
<p>Ce chatbot fonctionne sur un serveur européen souverain
|
||||
(Mistral FR, zéro rétention), conçu sobre en énergie.</p>
|
||||
<p>Pour m'aider à te répondre efficacement,
|
||||
formule ta requête ainsi :</p>
|
||||
<ul>
|
||||
<li>• Besoin : [ce que tu cherches]</li>
|
||||
<li>• Thématique : [juridique / technique / économique / ...]</li>
|
||||
<li>• Lieu : [région ou ville]</li>
|
||||
</ul>
|
||||
<p class="example">Exemple : "Je suis salarié d'agence, litige avec mon
|
||||
employeur, besoin conseil juridique droit du travail,
|
||||
Île-de-France."</p>
|
||||
<p>{{ intro }}</p>
|
||||
<p v-if="exemple" class="example">{{ exemple }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Messages -->
|
||||
<template v-for="(msg, i) in messages" :key="i">
|
||||
<div v-if="msg.role === 'user'" class="user-bubble">{{ msg.content }}</div>
|
||||
<div v-else class="assistant-bubble">
|
||||
<p>{{ msg.content }}</p>
|
||||
<ChatModeBadge :profondeur="msg.profondeur" />
|
||||
<div v-if="rendreMarkdown" v-html="renderMd(msg.content)" />
|
||||
<p v-else>{{ msg.content }}</p>
|
||||
<div v-if="msg.fiches && msg.fiches.length > 0" class="fiches-list">
|
||||
<p class="fiches-title">Fiches recommandées :</p>
|
||||
<p class="fiches-title">{{ fichesTitre }}</p>
|
||||
<a
|
||||
v-for="fiche in msg.fiches"
|
||||
:key="fiche.id"
|
||||
:href="`/fiche/${fiche.id}`"
|
||||
:href="ficheLienModele.replace('{id}', String(fiche.id))"
|
||||
class="fiche-card"
|
||||
>
|
||||
<span class="fiche-nom">{{ fiche.nom }}</span>
|
||||
<span v-if="fiche.explication" class="fiche-expl">{{ fiche.explication }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div v-if="msg.suggestedHashtags && msg.suggestedHashtags.length" style="margin-top: 8px;">
|
||||
<p style="font-size: 0.7rem; color: var(--nav-text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;">Filtrer par :</p>
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 4px;">
|
||||
<span
|
||||
v-for="tag in msg.suggestedHashtags"
|
||||
:key="tag"
|
||||
style="
|
||||
padding: 2px 8px; border-radius: 9999px; font-size: 0.7rem; cursor: pointer;
|
||||
background: var(--nav-bg-alt); color: var(--nav-text); border: 1px solid var(--nav-bg-alt);
|
||||
transition: all 0.15s;
|
||||
"
|
||||
@click="emit('applyHashtag', tag)"
|
||||
>{{ tag }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -93,15 +100,22 @@ employeur, besoin conseil juridique droit du travail,
|
||||
|
||||
<!-- Erreur -->
|
||||
<div v-if="errorMsg" class="error-bubble">{{ errorMsg }}</div>
|
||||
|
||||
<ChatNewConversation v-if="hasHistory && !loading" @reset="nouvelleConversation" />
|
||||
</div>
|
||||
|
||||
<!-- Mode de réponse -->
|
||||
<div class="chatbot-mode-row" style="border-top: 1px solid var(--nav-bg-alt);">
|
||||
<ChatModeToggle v-model="profondeur" :disabled="loading" />
|
||||
</div>
|
||||
|
||||
<!-- Input -->
|
||||
<div class="chatbot-input-row" style="border-top: 1px solid var(--nav-bg-alt);">
|
||||
<div class="chatbot-input-row">
|
||||
<input
|
||||
v-model="inputText"
|
||||
type="text"
|
||||
:disabled="loading"
|
||||
placeholder="Pose ta question…"
|
||||
:placeholder="placeholderSaisie"
|
||||
class="chatbot-input"
|
||||
@keydown.enter.prevent="sendMessage"
|
||||
/>
|
||||
@@ -122,6 +136,9 @@ employeur, besoin conseil juridique droit du travail,
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMarkdown } from '~/composables/useMarkdown'
|
||||
const { render: renderMd } = useMarkdown()
|
||||
|
||||
interface FicheReco {
|
||||
id: number | string
|
||||
nom: string
|
||||
@@ -132,19 +149,100 @@ interface ChatMessage {
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
fiches?: FicheReco[]
|
||||
suggestedHashtags?: string[]
|
||||
profondeur?: string
|
||||
}
|
||||
|
||||
// Composant unique pour les deux chatbots desktop. Les défauts reproduisent
|
||||
// exactement le comportement de l'accueil (/api/chatbot, backend Entraide).
|
||||
// Les deux backends renvoient { reponse_texte, fiches_recommandees } ; seul
|
||||
// le rendu diffère (texte brut vs markdown, lien de fiche).
|
||||
const props = withDefaults(defineProps<{
|
||||
/** Route serveur appelée (body { question }) */
|
||||
endpoint?: string
|
||||
/** Titre affiché dans l'en-tête déplié */
|
||||
titre?: string
|
||||
/** Texte de l'en-tête replié */
|
||||
placeholderReplie?: string
|
||||
/** Placeholder du champ de saisie */
|
||||
placeholderSaisie?: string
|
||||
/** Texte d'accueil (première bulle) */
|
||||
intro?: string
|
||||
/** Exemple de question, affiché sous l'accueil */
|
||||
exemple?: string
|
||||
/** Intitulé de la liste de fiches/structures citées */
|
||||
fichesTitre?: string
|
||||
/** Modèle de lien vers une fiche, {id} est remplacé */
|
||||
ficheLienModele?: string
|
||||
/** Rendre la réponse en markdown (backend réseaux) plutôt qu'en texte brut */
|
||||
rendreMarkdown?: boolean
|
||||
/** Message affiché quand la limite quotidienne (429) est atteinte */
|
||||
messageLimite?: string
|
||||
/** Clé de persistance (sessionStorage). Même clé = même conversation (ex. mobile + desktop) */
|
||||
chatKey?: string
|
||||
}>(), {
|
||||
chatKey: 'accueil',
|
||||
endpoint: '/api/chatbot',
|
||||
titre: 'Chatbot AEP',
|
||||
placeholderReplie: 'Pose une question sur le réseau…',
|
||||
placeholderSaisie: 'Pose ta question…',
|
||||
intro: "Explore les 120 structures de la carte par la conversation. Je peux t'aider à trouver des collectifs, agences ou réseaux selon ta situation, ta pratique ou tes inspirations du moment.",
|
||||
exemple: 'Exemple : "Je cherche des acteurs de la rénovation de maisons individuelles en France, plutôt en milieu rural, avec des approches biosourcées ou low-tech."',
|
||||
fichesTitre: 'Fiches recommandees :',
|
||||
ficheLienModele: '/fiche/{id}',
|
||||
rendreMarkdown: false,
|
||||
messageLimite: 'Limite de 10 questions par jour atteinte. Reviens demain.',
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
'highlightOrgs': [ids: (number | string)[]]
|
||||
'applyHashtag': [tag: string]
|
||||
}>()
|
||||
|
||||
const isExpanded = ref(false)
|
||||
const messages = ref<ChatMessage[]>([])
|
||||
const { messages, hasHistory, clear } = useChatSession<ChatMessage>(() => props.chatKey)
|
||||
const profondeur = useChatProfondeur(() => props.chatKey)
|
||||
const inputText = ref('')
|
||||
const loading = ref(false)
|
||||
const errorMsg = ref('')
|
||||
const messagesContainer = ref<HTMLElement | null>(null)
|
||||
|
||||
// Detection hashtags depuis la question posee
|
||||
const HASHTAG_KEYWORDS: Record<string, string[]> = {
|
||||
'#reemploi-structurel': ['reemploi', 'materiaux recuperes', 'deconstruction', 'reemploi structurel'],
|
||||
'#reemploi-second-oeuvre': ['revetement', 'second oeuvre', 'reemploi'],
|
||||
'#biosource-geosource': ['biosource', 'geosource', 'paille', 'terre', 'chanvre', 'lin', 'biosource'],
|
||||
'#low-tech-experimentation': ['low-tech', 'low tech', 'technique simple', 'autonomie', 'lowtech'],
|
||||
'#chantier-ecole': ['formation', 'chantier ecole', 'chantier-ecole', 'apprendre', 'auto-construction', 'autoconstruction'],
|
||||
'#sobriete-energetique': ['sobriete', 'energie', 'renovation energetique', 'isolation', 'chauffage', 'economie energie'],
|
||||
'#mal-logement-precarite': ['mal-logement', 'precarite', 'sans-abri', 'logement social', 'squat', 'mal logement'],
|
||||
'#tiers-lieux-friches': ['friche', 'tiers-lieu', 'tiers lieu', 'espace intermediaire', 'temporaire', 'reconversion'],
|
||||
'#accompagnement-cooperatif': ['cooperative', 'accompagnement', 'cooperation', 'collectif', 'mutualisation'],
|
||||
'#transition-energetique-territoriale': ['territoire', 'transition', 'energetique', 'local', 'region', 'transition energetique'],
|
||||
'#communs-fonciers': ['communs', 'foncier', 'anti-speculatif', 'community land trust', 'commun foncier'],
|
||||
'#hack-juridique': ['juridique', 'montage', 'structure legale', 'sci', 'cooperative', 'statut'],
|
||||
'#retrofit-strates': ['retrofit', 'renovation lourde', 'sur-isolation', 'rehaussement'],
|
||||
'#phytoconstruction': ['plantes', 'vegetal', 'arbre', 'construction vivante', 'phyto'],
|
||||
}
|
||||
|
||||
function detectHashtagsFromQuery(query: string): string[] {
|
||||
const q = query.toLowerCase()
|
||||
.normalize('NFD')
|
||||
.replace(/[̀-ͯ]/g, '')
|
||||
const detected: string[] = []
|
||||
for (const [hashtag, keywords] of Object.entries(HASHTAG_KEYWORDS)) {
|
||||
if (keywords.some(kw => q.includes(kw))) {
|
||||
detected.push(hashtag)
|
||||
}
|
||||
}
|
||||
return detected.slice(0, 3)
|
||||
}
|
||||
|
||||
function nouvelleConversation() {
|
||||
clear()
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
function toggleExpand() {
|
||||
isExpanded.value = !isExpanded.value
|
||||
}
|
||||
@@ -157,6 +255,7 @@ async function sendMessage() {
|
||||
errorMsg.value = ''
|
||||
messages.value.push({ role: 'user', content: question })
|
||||
loading.value = true
|
||||
const mode = profondeur.value
|
||||
|
||||
await nextTick()
|
||||
scrollToBottom()
|
||||
@@ -165,15 +264,18 @@ async function sendMessage() {
|
||||
const res = await $fetch<{
|
||||
reponse_texte: string
|
||||
fiches_recommandees: { id: number | string; nom: string; explication: string }[]
|
||||
}>('/api/chatbot', {
|
||||
}>(props.endpoint, {
|
||||
method: 'POST',
|
||||
body: { question },
|
||||
body: { question, profondeur: mode },
|
||||
})
|
||||
|
||||
const suggestedHashtags = detectHashtagsFromQuery(question)
|
||||
const assistantMsg: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: res.reponse_texte,
|
||||
fiches: res.fiches_recommandees || [],
|
||||
suggestedHashtags: suggestedHashtags.length ? suggestedHashtags : undefined,
|
||||
profondeur: mode,
|
||||
}
|
||||
messages.value.push(assistantMsg)
|
||||
|
||||
@@ -183,7 +285,7 @@ async function sendMessage() {
|
||||
} catch (e: any) {
|
||||
const status = e?.statusCode ?? e?.status
|
||||
if (status === 429) {
|
||||
errorMsg.value = 'Limite de 10 questions par jour atteinte. Reviens demain.'
|
||||
errorMsg.value = props.messageLimite
|
||||
} else if (status === 503) {
|
||||
errorMsg.value = 'Le budget IA mensuel est épuisé. Soutiens NAV sur Liberapay pour continuer.'
|
||||
} else {
|
||||
@@ -265,6 +367,11 @@ function scrollToBottom() {
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.chatbot-mode-row {
|
||||
display: flex;
|
||||
padding: 8px 12px 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.chatbot-input-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<transition name="backdrop">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-0 z-[1010]"
|
||||
style="background: rgba(26,34,56,0.5);"
|
||||
@click="emit('update:modelValue', false)"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</transition>
|
||||
|
||||
<transition name="sheet">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-x-0 bottom-0 z-[1011] flex flex-col"
|
||||
style="background: var(--nav-surface); height: 100dvh; max-height: 100dvh; box-shadow: 0 -4px 32px rgba(26,34,56,0.18);"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label="Assistant Réseaux AEP"
|
||||
>
|
||||
<div class="flex justify-center pt-3 pb-1 shrink-0">
|
||||
<div class="rounded-full" style="width: 36px; height: 4px; background: var(--nav-bg-alt);" />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-between px-4 py-3 shrink-0 border-b" style="border-color: var(--nav-bg-alt);">
|
||||
<button
|
||||
@click="emit('update:modelValue', false)"
|
||||
class="flex items-center gap-2 text-sm font-medium transition-opacity hover:opacity-70"
|
||||
style="color: var(--nav-text-muted);"
|
||||
aria-label="Retour"
|
||||
>
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
|
||||
<polyline points="15 18 9 12 15 6"/>
|
||||
</svg>
|
||||
Retour
|
||||
</button>
|
||||
<div class="flex items-center gap-2">
|
||||
<div class="w-7 h-7 rounded-full flex items-center justify-center shrink-0" style="background: var(--nav-primary);">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="color: var(--nav-text-on-primary);">
|
||||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="font-bold text-sm" style="color: var(--nav-text);">Réseaux AEP</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ref="messagesContainer" class="flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-3">
|
||||
<div v-if="messages.length === 0" class="onboarding-bubble">
|
||||
<p>Je connais les <strong>120 réseaux, collectifs et agences</strong> cartographiés dans AEP — ceux qui portent une vision écologique et politique de l'architecture.</p>
|
||||
<p>Décris ta situation : tu cherches un collectif, une agence inspirante, un partenaire sur un projet en Occitanie, en transition énergétique ?</p>
|
||||
</div>
|
||||
|
||||
<template v-for="(msg, i) in messages" :key="i">
|
||||
<div v-if="msg.role === 'user'" class="user-bubble">{{ msg.content }}</div>
|
||||
<div v-else class="assistant-bubble">
|
||||
<ChatModeBadge :profondeur="msg.profondeur" />
|
||||
<div v-html="renderMd(msg.content)" />
|
||||
<div v-if="msg.fiches && msg.fiches.length > 0" class="fiches-list" style="margin-top:12px;">
|
||||
<p class="fiches-title">Structures recommandées :</p>
|
||||
<a
|
||||
v-for="fiche in msg.fiches"
|
||||
:key="fiche.id"
|
||||
:href="`/?mode=pratiques&fiche=${fiche.id}`"
|
||||
class="fiche-card"
|
||||
>
|
||||
<span class="fiche-nom">{{ fiche.nom }}</span>
|
||||
<span v-if="fiche.explication" class="fiche-expl">{{ fiche.explication }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="loading" class="assistant-bubble loading-bubble">
|
||||
<span class="dot" /><span class="dot" /><span class="dot" />
|
||||
</div>
|
||||
<div v-if="errorMsg" class="error-bubble">{{ errorMsg }}</div>
|
||||
<ChatNewConversation v-if="hasHistory && !loading" @reset="nouvelleConversation" />
|
||||
</div>
|
||||
|
||||
<div class="shrink-0 px-4 pt-3 border-t" style="border-color: var(--nav-bg-alt); padding-bottom: max(1rem, env(safe-area-inset-bottom));">
|
||||
<ChatModeToggle v-model="profondeur" :disabled="loading" class="mb-2" />
|
||||
<div class="flex items-center gap-2">
|
||||
<input
|
||||
v-model="inputText"
|
||||
type="text"
|
||||
:disabled="loading"
|
||||
placeholder="Décris ta situation…"
|
||||
class="flex-1 px-4 py-3 rounded-xl text-sm border"
|
||||
style="border-color: var(--nav-bg-alt); background: var(--nav-bg); color: var(--nav-text); font-family: var(--nav-font); font-size: 16px;"
|
||||
@keydown.enter.prevent="sendMessage"
|
||||
/>
|
||||
<button
|
||||
:disabled="loading || !inputText.trim()"
|
||||
class="w-11 h-11 rounded-xl flex items-center justify-center shrink-0 transition-opacity"
|
||||
style="background: var(--nav-primary);"
|
||||
:style="{ opacity: (loading || !inputText.trim()) ? 0.4 : 1 }"
|
||||
aria-label="Envoyer"
|
||||
@click="sendMessage"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" style="color: var(--nav-text-on-primary);">
|
||||
<line x1="22" y1="2" x2="11" y2="13"/>
|
||||
<polygon points="22 2 15 22 11 13 2 9 22 2"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMarkdown } from '~/composables/useMarkdown'
|
||||
const { render: renderMd } = useMarkdown()
|
||||
|
||||
interface FicheReco { id: number | string; nom: string; explication?: string }
|
||||
interface ChatMessage { role: 'user' | 'assistant'; content: string; fiches?: FicheReco[]; profondeur?: string }
|
||||
|
||||
const props = defineProps<{ modelValue: boolean }>()
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: boolean] }>()
|
||||
|
||||
const { messages, hasHistory, clear } = useChatSession<ChatMessage>('agences')
|
||||
const profondeur = useChatProfondeur('agences')
|
||||
const inputText = ref('')
|
||||
const loading = ref(false)
|
||||
const errorMsg = ref('')
|
||||
const messagesContainer = ref<HTMLElement | null>(null)
|
||||
|
||||
watch(() => props.modelValue, (open) => {
|
||||
if (typeof document === 'undefined') return
|
||||
document.body.style.overflow = open ? 'hidden' : ''
|
||||
document.documentElement.style.overflow = open ? 'hidden' : ''
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (typeof document !== 'undefined') {
|
||||
document.body.style.overflow = ''
|
||||
document.documentElement.style.overflow = ''
|
||||
}
|
||||
})
|
||||
|
||||
function nouvelleConversation() {
|
||||
clear()
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
async function sendMessage() {
|
||||
const question = inputText.value.trim()
|
||||
if (!question || loading.value) return
|
||||
inputText.value = ''
|
||||
errorMsg.value = ''
|
||||
messages.value.push({ role: 'user', content: question })
|
||||
loading.value = true
|
||||
await nextTick()
|
||||
if (messagesContainer.value) messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight
|
||||
|
||||
try {
|
||||
const mode = profondeur.value
|
||||
const res = await $fetch<{ reponse_texte: string; fiches_recommandees: FicheReco[] }>(
|
||||
'/api/chatbot-reseaux',
|
||||
{ method: 'POST', body: { question, profondeur: mode } }
|
||||
)
|
||||
messages.value.push({ role: 'assistant', content: res.reponse_texte, fiches: res.fiches_recommandees || [], profondeur: mode })
|
||||
} catch (e: any) {
|
||||
const s = e?.statusCode ?? e?.status
|
||||
errorMsg.value = s === 429
|
||||
? 'Limite de 20 questions par jour atteinte.'
|
||||
: 'Une erreur est survenue. Réessaie dans quelques instants.'
|
||||
} finally {
|
||||
loading.value = false
|
||||
await nextTick()
|
||||
if (messagesContainer.value) messagesContainer.value.scrollTop = messagesContainer.value.scrollHeight
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: opacity 0.2s ease; }
|
||||
.backdrop-enter-from, .backdrop-leave-to { opacity: 0; }
|
||||
.sheet-enter-active, .sheet-leave-active { transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1); }
|
||||
.sheet-enter-from, .sheet-leave-to { transform: translateY(100%); }
|
||||
|
||||
.onboarding-bubble {
|
||||
background: var(--nav-bg); border: 1px solid var(--nav-bg-alt);
|
||||
border-radius: 12px; padding: 16px;
|
||||
font-size: 0.85rem; line-height: 1.65; color: var(--nav-text-muted);
|
||||
}
|
||||
.onboarding-bubble p { margin-bottom: 10px; }
|
||||
.onboarding-bubble strong { font-weight: 700; color: var(--nav-text); }
|
||||
|
||||
.user-bubble {
|
||||
align-self: flex-end; max-width: 80%;
|
||||
background: var(--nav-primary); color: var(--nav-text-on-primary);
|
||||
border-radius: 16px 16px 4px 16px; padding: 10px 14px;
|
||||
font-size: 0.875rem; line-height: 1.5;
|
||||
}
|
||||
.assistant-bubble {
|
||||
align-self: flex-start; max-width: 90%;
|
||||
background: var(--nav-surface); border: 1px solid var(--nav-bg-alt);
|
||||
border-radius: 16px 16px 16px 4px; padding: 12px 14px;
|
||||
font-size: 0.875rem; line-height: 1.6; color: var(--nav-text);
|
||||
}
|
||||
.loading-bubble { display: flex; gap: 5px; align-items: center; }
|
||||
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--nav-text-muted); animation: blink 1.2s infinite; }
|
||||
.dot:nth-child(2) { animation-delay: 0.2s; }
|
||||
.dot:nth-child(3) { animation-delay: 0.4s; }
|
||||
@keyframes blink { 0%,80%,100% { opacity: 0.3; } 40% { opacity: 1; } }
|
||||
/* Pas d'animation si l'usager la réduit : points fixes (B1, exigence du brief ; posé au checkpoint du 22/10) */
|
||||
@media (prefers-reduced-motion: reduce) { .dot { animation: none; opacity: 0.6; } }
|
||||
|
||||
.error-bubble { align-self: flex-start; max-width: 90%; color: #a85d3e; font-size: 0.8rem; padding: 8px 12px; border-radius: 8px; background: rgba(168,93,62,0.08); }
|
||||
|
||||
.fiches-list { display: flex; flex-direction: column; gap: 6px; }
|
||||
.fiches-title { font-size: 0.75rem; font-weight: 600; color: var(--nav-text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
|
||||
.fiche-card { display: block; background: var(--nav-bg); border: 1px solid var(--nav-bg-alt); border-radius: 8px; padding: 8px 12px; text-decoration: none; transition: background 0.15s; }
|
||||
.fiche-card:hover { background: var(--nav-bg-alt); }
|
||||
.fiche-nom { display: block; font-size: 0.875rem; font-weight: 600; color: var(--nav-text); }
|
||||
.fiche-expl { display: block; font-size: 0.8rem; color: var(--nav-text-muted); margin-top: 2px; }
|
||||
</style>
|
||||
+32
-11
@@ -69,18 +69,13 @@
|
||||
<div ref="messagesContainer" class="flex-1 overflow-y-auto px-4 py-4 flex flex-col gap-3">
|
||||
<!-- Message onboarding (avant la première question) -->
|
||||
<div v-if="messages.length === 0" class="onboarding-bubble">
|
||||
<p>Ce chatbot fonctionne sur un serveur européen souverain
|
||||
(Mistral FR, zéro rétention), conçu sobre en énergie.</p>
|
||||
<p>Pour m'aider à te répondre efficacement,
|
||||
formule ta requête ainsi :</p>
|
||||
<p>Pour m'aider à te répondre efficacement, formule ta requête ainsi :</p>
|
||||
<ul>
|
||||
<li>• Besoin : [ce que tu cherches]</li>
|
||||
<li>• Thématique : [juridique / technique / économique / ...]</li>
|
||||
<li>• Lieu : [région ou ville]</li>
|
||||
</ul>
|
||||
<p class="example">Exemple : "Je suis salarié d'agence, litige avec mon
|
||||
employeur, besoin conseil juridique droit du travail,
|
||||
Île-de-France."</p>
|
||||
<p class="example">Exemple : "Je suis salarié d'agence, litige avec mon employeur, besoin conseil juridique droit du travail, Île-de-France."</p>
|
||||
</div>
|
||||
|
||||
<!-- Messages -->
|
||||
@@ -92,7 +87,8 @@ employeur, besoin conseil juridique droit du travail,
|
||||
|
||||
<!-- Message assistant -->
|
||||
<div v-else class="assistant-bubble">
|
||||
<p>{{ msg.content }}</p>
|
||||
<ChatModeBadge :profondeur="msg.profondeur" />
|
||||
<div class="md-content" v-html="renderMd(msg.content)" />
|
||||
|
||||
<!-- Fiches recommandées -->
|
||||
<div v-if="msg.fiches && msg.fiches.length > 0" class="fiches-list">
|
||||
@@ -119,6 +115,8 @@ employeur, besoin conseil juridique droit du travail,
|
||||
<div v-if="errorMsg" class="error-bubble">
|
||||
{{ errorMsg }}
|
||||
</div>
|
||||
|
||||
<ChatNewConversation v-if="hasHistory && !loading" @reset="nouvelleConversation" />
|
||||
</div>
|
||||
|
||||
<!-- Input -->
|
||||
@@ -126,6 +124,7 @@ employeur, besoin conseil juridique droit du travail,
|
||||
class="shrink-0 px-4 pt-3 border-t"
|
||||
style="border-color: var(--nav-bg-alt); padding-bottom: max(1rem, env(safe-area-inset-bottom));"
|
||||
>
|
||||
<ChatModeToggle v-model="profondeur" :disabled="loading" class="mb-2" />
|
||||
<div class="flex items-center gap-2">
|
||||
<input
|
||||
v-model="inputText"
|
||||
@@ -164,6 +163,9 @@ employeur, besoin conseil juridique droit du travail,
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useMarkdown } from '~/composables/useMarkdown'
|
||||
const { render: renderMd } = useMarkdown()
|
||||
|
||||
interface FicheReco {
|
||||
id: number | string
|
||||
nom: string
|
||||
@@ -174,6 +176,7 @@ interface ChatMessage {
|
||||
role: 'user' | 'assistant'
|
||||
content: string
|
||||
fiches?: FicheReco[]
|
||||
profondeur?: string
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -185,7 +188,8 @@ const emit = defineEmits<{
|
||||
'highlightOrgs': [ids: (number | string)[]]
|
||||
}>()
|
||||
|
||||
const messages = ref<ChatMessage[]>([])
|
||||
const { messages, hasHistory, clear } = useChatSession<ChatMessage>('accueil')
|
||||
const profondeur = useChatProfondeur('accueil')
|
||||
const inputText = ref('')
|
||||
const loading = ref(false)
|
||||
const errorMsg = ref('')
|
||||
@@ -209,6 +213,11 @@ onUnmounted(() => {
|
||||
}
|
||||
})
|
||||
|
||||
function nouvelleConversation() {
|
||||
clear()
|
||||
errorMsg.value = ''
|
||||
}
|
||||
|
||||
async function sendMessage() {
|
||||
const question = inputText.value.trim()
|
||||
if (!question || loading.value) return
|
||||
@@ -217,6 +226,7 @@ async function sendMessage() {
|
||||
errorMsg.value = ''
|
||||
messages.value.push({ role: 'user', content: question })
|
||||
loading.value = true
|
||||
const mode = profondeur.value
|
||||
|
||||
await nextTick()
|
||||
scrollToBottom()
|
||||
@@ -227,13 +237,14 @@ async function sendMessage() {
|
||||
fiches_recommandees: { id: number | string; nom: string; explication: string }[]
|
||||
}>('/api/chatbot', {
|
||||
method: 'POST',
|
||||
body: { question },
|
||||
body: { question, profondeur: mode },
|
||||
})
|
||||
|
||||
const assistantMsg: ChatMessage = {
|
||||
role: 'assistant',
|
||||
content: res.reponse_texte,
|
||||
fiches: res.fiches_recommandees || [],
|
||||
profondeur: mode,
|
||||
}
|
||||
messages.value.push(assistantMsg)
|
||||
|
||||
@@ -320,7 +331,17 @@ function scrollToBottom() {
|
||||
line-height: 1.6;
|
||||
color: var(--nav-text);
|
||||
}
|
||||
.assistant-bubble p { margin: 0; }
|
||||
.assistant-bubble > p { margin: 0; }
|
||||
|
||||
/* Markdown rendu via v-html — :deep() perce le scoped */
|
||||
:deep(.md-content) { font-size: inherit; line-height: 1.6; }
|
||||
:deep(.md-content p) { margin: 0 0 0.4em; }
|
||||
:deep(.md-content p:last-child) { margin-bottom: 0; }
|
||||
:deep(.md-content strong) { font-weight: 700; }
|
||||
:deep(.md-content em) { font-style: italic; }
|
||||
:deep(.md-content ul) { margin: 0.3em 0 0.3em 1.1em; list-style: disc; padding: 0; }
|
||||
:deep(.md-content li) { margin-bottom: 0.15em; }
|
||||
:deep(.md-content a) { text-decoration: underline; opacity: 0.8; }
|
||||
|
||||
/* Fiches recommandées */
|
||||
.fiches-list {
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
:type="as === 'button' ? 'button' : undefined"
|
||||
class="chip"
|
||||
:class="[`chip--${variant}`, { 'chip--active': active }]"
|
||||
:aria-pressed="as === 'button' ? active : undefined"
|
||||
@click="as === 'button' && emit('toggle')"
|
||||
>
|
||||
<span class="chip__label">{{ label }}</span>
|
||||
<span v-if="count !== undefined" class="chip__count">{{ count }}</span>
|
||||
<button
|
||||
v-if="removable"
|
||||
type="button"
|
||||
class="chip__remove"
|
||||
:aria-label="`Retirer ${label}`"
|
||||
@click.stop="emit('remove')"
|
||||
>
|
||||
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18" />
|
||||
<line x1="6" y1="6" x2="18" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
label: string
|
||||
variant?: 'echelle' | 'fonction' | 'posture'
|
||||
active?: boolean
|
||||
count?: number
|
||||
as?: 'button' | 'span'
|
||||
removable?: boolean
|
||||
}>(),
|
||||
{
|
||||
variant: 'fonction',
|
||||
active: false,
|
||||
count: undefined,
|
||||
as: 'button',
|
||||
removable: false,
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggle: []
|
||||
remove: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2xs);
|
||||
padding: var(--space-2xs) var(--space-sm);
|
||||
border-radius: var(--radius-full);
|
||||
font-size: var(--fs-xs);
|
||||
line-height: var(--lh-tight);
|
||||
font-weight: var(--fw-medium);
|
||||
border: 1.5px solid transparent;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
min-height: 32px;
|
||||
box-sizing: border-box;
|
||||
background: none;
|
||||
transition: background-color var(--dur-fast) var(--ease-out),
|
||||
color var(--dur-fast) var(--ease-out),
|
||||
border-color var(--dur-fast) var(--ease-out),
|
||||
transform var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.chip {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Survol : uniquement sur pointeur capable de survol. Sur tactile, :hover
|
||||
reste collé après un tap (chip « allumé » sans être actif). */
|
||||
@media (hover: hover) {
|
||||
.chip:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
}
|
||||
|
||||
.chip:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ── Échelle : outline bleu, fond transparent, actif = plein ────────────── */
|
||||
.chip--echelle {
|
||||
border-color: var(--primary);
|
||||
color: var(--text);
|
||||
background: transparent;
|
||||
}
|
||||
@media (hover: hover) {
|
||||
.chip--echelle:hover {
|
||||
background: var(--primary-hover);
|
||||
border-color: var(--primary-hover);
|
||||
color: var(--on-primary);
|
||||
}
|
||||
}
|
||||
/* Actif = fond PLEIN. --primary est translucide dans le thème AEP
|
||||
(rgba(26,34,56,.6) : 4,16:1 sur le fond de page, sous AA) ; le couple
|
||||
--nav-primary-solid / --nav-text-on-primary (≈14,6:1) reste lisible aussi
|
||||
en sombre. Le survol d'un chip actif ne change pas de fond. */
|
||||
.chip--echelle.chip--active {
|
||||
background: var(--nav-primary-solid);
|
||||
border-color: var(--nav-primary-solid);
|
||||
color: var(--nav-text-on-primary);
|
||||
}
|
||||
|
||||
/* ── Fonction/hashtag : pleine bleu, inactif = bg-alt ────────────────────── */
|
||||
.chip--fonction {
|
||||
border-color: transparent;
|
||||
background: var(--bg-alt);
|
||||
color: var(--text);
|
||||
}
|
||||
@media (hover: hover) {
|
||||
.chip--fonction:hover {
|
||||
background: var(--primary-hover);
|
||||
color: var(--on-primary);
|
||||
}
|
||||
}
|
||||
.chip--fonction.chip--active {
|
||||
background: var(--nav-primary-solid);
|
||||
color: var(--nav-text-on-primary);
|
||||
}
|
||||
|
||||
/* ── Posture (préparée pour plus tard) : outline safran ──────────────────── */
|
||||
.chip--posture {
|
||||
border-color: var(--accent);
|
||||
color: var(--text);
|
||||
background: transparent;
|
||||
}
|
||||
@media (hover: hover) {
|
||||
.chip--posture:hover {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
}
|
||||
.chip--posture.chip--active {
|
||||
background: var(--accent);
|
||||
border-color: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
|
||||
.chip__count {
|
||||
font-size: 0.85em;
|
||||
opacity: 0.75;
|
||||
}
|
||||
|
||||
.chip__remove {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
opacity: 0.7;
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-full);
|
||||
}
|
||||
.chip__remove:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.chip__remove:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div class="chip-group" role="group" :aria-label="ariaLabel">
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
ariaLabel: string
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.chip-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2xs) var(--space-xs);
|
||||
}
|
||||
</style>
|
||||
@@ -1,63 +0,0 @@
|
||||
<template>
|
||||
<div class="space-y-1.5">
|
||||
<p class="text-xs font-bold uppercase tracking-widest" style="color: var(--nav-text-muted);">Échelle</p>
|
||||
<!-- Inline sur 1 ligne — même pattern que FonctionFilter -->
|
||||
<div class="flex flex-wrap gap-x-4 gap-y-1.5">
|
||||
<label
|
||||
v-for="option in ECHELLES"
|
||||
:key="option"
|
||||
class="flex items-center gap-1.5 cursor-pointer select-none transition-opacity"
|
||||
>
|
||||
<!-- Case carrée -->
|
||||
<span
|
||||
class="flex items-center justify-center shrink-0 transition-all"
|
||||
style="width: 18px; height: 18px; border: 1.5px solid; border-radius: 3px;"
|
||||
:style="isSelected(option)
|
||||
? 'background: var(--nav-primary); border-color: var(--nav-primary); color: #ffffff;'
|
||||
: 'background: var(--nav-bg-alt); border-color: rgba(26,34,56,0.25); color: transparent;'"
|
||||
>
|
||||
<svg v-if="isSelected(option)" width="11" height="11" viewBox="0 0 12 12" fill="none">
|
||||
<polyline points="2,6 5,9 10,3" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
</span>
|
||||
<!-- Label -->
|
||||
<span
|
||||
class="text-sm leading-tight"
|
||||
:style="isSelected(option) ? 'color: var(--nav-text); font-weight: 600;' : 'color: var(--nav-text);'"
|
||||
>{{ option }}</span>
|
||||
<!-- Input réel (masqué) -->
|
||||
<input
|
||||
type="checkbox"
|
||||
class="sr-only"
|
||||
:checked="isSelected(option)"
|
||||
@change="toggle(option)"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const ECHELLES = ['National', 'Régional', 'Local'] as const
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string[]
|
||||
counts: Record<string, number>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string[]]
|
||||
}>()
|
||||
|
||||
function isSelected(option: string): boolean {
|
||||
return props.modelValue.includes(option)
|
||||
}
|
||||
|
||||
function toggle(option: string) {
|
||||
if (isSelected(option)) {
|
||||
emit('update:modelValue', props.modelValue.filter(v => v !== option))
|
||||
} else {
|
||||
emit('update:modelValue', [...props.modelValue, option])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,133 @@
|
||||
<template>
|
||||
<section class="echelle-tete" :class="{ 'echelle-tete--compact': compact }" :aria-label="`Échelle ${e.id} : ${e.titre}`">
|
||||
<component
|
||||
:is="titreNiveau ?? 'p'"
|
||||
:id="titreId"
|
||||
:tabindex="titreNiveau ? -1 : undefined"
|
||||
class="echelle-tete__kicker"
|
||||
>
|
||||
<span class="echelle-tete__badge" aria-hidden="true">{{ e.id }}</span>
|
||||
<span class="echelle-tete__titre">{{ e.titre }}<span v-if="e.sousTitre" class="echelle-tete__sous-titre">{{ ' ' + e.sousTitre }}</span></span>
|
||||
</component>
|
||||
<ul class="echelle-tete__mots">
|
||||
<li v-for="m in e.mots" :key="m">{{ m }}</li>
|
||||
</ul>
|
||||
<p class="echelle-tete__phrase">{{ e.phrase }}</p>
|
||||
<slot />
|
||||
<p v-if="contribuer" class="echelle-tete__contribuer">
|
||||
<span>{{ ECHELLES_CADRE_COURT }}</span>
|
||||
<NuxtLink :to="`/proposer?categorie=${e.categorieProposer}`" @click="$emit('navigate')">Proposer une ressource →</NuxtLink>
|
||||
</p>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ECHELLES, type EchelleId } from '~/utils/echelles'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
echelle: EchelleId
|
||||
/** Variante resserrée, pour une popup ou un en-tête centré. */
|
||||
compact?: boolean
|
||||
/** Affiche la ligne « on pose l'infrastructure, le collectif nourrit ». */
|
||||
contribuer?: boolean
|
||||
/**
|
||||
* Titre en vrai titre de section (B13 : la porte ouverte de l'entrée), focalisable
|
||||
* par programme (tabindex -1) ; sans lui, un paragraphe, comme avant.
|
||||
*/
|
||||
titreNiveau?: 'h2' | 'h3'
|
||||
/** id du titre, pour `aria-labelledby` et le focus. */
|
||||
titreId?: string
|
||||
}>(), { compact: false, contribuer: true, titreNiveau: undefined, titreId: undefined })
|
||||
|
||||
defineEmits<{ navigate: [] }>()
|
||||
|
||||
const e = computed(() => ECHELLES[props.echelle])
|
||||
const ECHELLES_CADRE_COURT = 'Chaque section est ouverte aux contributions.'
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.echelle-tete {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-sm);
|
||||
margin: 0 0 var(--space-md);
|
||||
}
|
||||
|
||||
.echelle-tete__kicker {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: var(--space-sm);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.echelle-tete__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 2rem;
|
||||
padding: 0.1rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: var(--fw-bold);
|
||||
font-size: var(--fs-sm);
|
||||
letter-spacing: 0.04em;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.echelle-tete__titre {
|
||||
font-size: var(--fs-lg);
|
||||
font-weight: var(--fw-bold);
|
||||
color: var(--text);
|
||||
line-height: var(--lh-tight);
|
||||
}
|
||||
|
||||
.echelle-tete__sous-titre {
|
||||
font-weight: var(--fw-regular);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.echelle-tete__mots {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.15rem 0;
|
||||
font-size: var(--fs-sm);
|
||||
color: var(--text);
|
||||
line-height: var(--lh-base);
|
||||
}
|
||||
.echelle-tete__mots li:not(:last-child)::after {
|
||||
content: '·';
|
||||
margin: 0 0.5rem;
|
||||
color: var(--accent);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
|
||||
.echelle-tete__phrase {
|
||||
margin: 0;
|
||||
font-size: var(--fs-sm);
|
||||
font-style: italic;
|
||||
color: var(--text-muted);
|
||||
line-height: var(--lh-base);
|
||||
}
|
||||
|
||||
.echelle-tete__contribuer {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem 0.75rem;
|
||||
font-size: var(--fs-xs);
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.echelle-tete__contribuer a {
|
||||
color: var(--link);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
.echelle-tete__contribuer a:hover { color: var(--link-hover); }
|
||||
|
||||
.echelle-tete--compact { text-align: left; }
|
||||
.echelle-tete--compact .echelle-tete__titre { font-size: var(--fs-base); }
|
||||
</style>
|
||||
+61
-28
@@ -6,12 +6,14 @@
|
||||
style="background: var(--nav-surface); border: 1px solid var(--nav-bg-alt);"
|
||||
>
|
||||
<!-- Bandeau titre -->
|
||||
<div class="px-6 pt-6 pb-4" style="border-bottom: 1px solid var(--nav-bg-alt);">
|
||||
<div class="flex flex-col sm:flex-row sm:items-start sm:justify-between gap-3 mb-3">
|
||||
<h1
|
||||
class="text-2xl font-bold leading-snug"
|
||||
<div :class="compact ? 'px-4 pt-4 pb-3' : 'px-6 pt-6 pb-4'" style="border-bottom: 1px solid var(--nav-bg-alt);">
|
||||
<div class="flex flex-col gap-3 mb-3" :class="compact ? '' : 'sm:flex-row sm:items-start sm:justify-between'">
|
||||
<component
|
||||
:is="compact ? 'h2' : 'h1'"
|
||||
class="font-bold leading-snug"
|
||||
:class="compact ? 'text-xl' : 'text-2xl'"
|
||||
style="color: var(--nav-text);"
|
||||
>{{ org.nom }}</h1>
|
||||
>{{ org.nom }}</component>
|
||||
|
||||
<a
|
||||
v-if="org.url"
|
||||
@@ -33,18 +35,28 @@
|
||||
</div>
|
||||
|
||||
<!-- Méta : échelle + ville -->
|
||||
<div class="flex flex-wrap items-center gap-2 text-sm mb-3" style="color: var(--nav-text-muted);">
|
||||
<div class="flex flex-wrap items-center gap-2 text-sm mb-3" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">
|
||||
<span
|
||||
v-if="org.echelle"
|
||||
class="px-2 py-0.5 rounded-full text-xs font-medium"
|
||||
style="background: var(--nav-primary); color: var(--nav-text-on-primary);"
|
||||
style="background: var(--nav-primary-solid); color: var(--nav-text-on-primary);"
|
||||
>{{ org.echelle }}</span>
|
||||
<span v-if="org.territoire && org.territoire !== 'Métropole'" class="text-xs" style="color: var(--nav-text-muted);">{{ org.territoire }}</span>
|
||||
<span v-if="org.localisation_ville" style="color: var(--nav-text-muted);">{{ org.localisation_ville }}</span>
|
||||
<span v-if="org.territoire && org.territoire !== 'Métropole'" class="text-xs" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">{{ org.territoire }}</span>
|
||||
<span v-if="org.localisation_ville" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">{{ org.localisation_ville }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Tags fonction -->
|
||||
<div v-if="fonctionTags.length" class="flex flex-wrap gap-1.5">
|
||||
<ChipGroup v-if="fonctionTags.length && etiquettesCliquables" :aria-label="`Fonctions de ${org.nom}`">
|
||||
<Chip
|
||||
v-for="tag in fonctionTags"
|
||||
:key="tag"
|
||||
variant="fonction"
|
||||
:label="tag"
|
||||
:aria-label="`Filtrer par ${tag}`"
|
||||
@toggle="emit('etiquette', tag)"
|
||||
/>
|
||||
</ChipGroup>
|
||||
<div v-else-if="fonctionTags.length" class="flex flex-wrap gap-1.5">
|
||||
<span
|
||||
v-for="tag in fonctionTags"
|
||||
:key="tag"
|
||||
@@ -55,13 +67,13 @@
|
||||
</div>
|
||||
|
||||
<!-- Corps : description + mini-carte -->
|
||||
<div class="p-6 flex flex-col lg:flex-row gap-6">
|
||||
<div class="flex flex-col gap-6" :class="compact ? 'p-4' : 'p-6 lg:flex-row'">
|
||||
|
||||
<!-- Descriptions -->
|
||||
<div class="flex-1 min-w-0">
|
||||
<!-- Description soumise par le contributeur -->
|
||||
<div v-if="descriptionUser" class="mb-4">
|
||||
<p class="text-sm leading-relaxed" style="color: var(--nav-text-muted);">Description communauté</p>
|
||||
<p class="text-sm leading-relaxed" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">Description communauté</p>
|
||||
<p class="mt-1 leading-relaxed" style="color: var(--nav-text);">{{ descriptionUser }}</p>
|
||||
</div>
|
||||
|
||||
@@ -70,7 +82,7 @@
|
||||
|
||||
<!-- Description enrichie IA -->
|
||||
<div v-if="descriptionEnrichie" class="mb-4">
|
||||
<p class="text-sm leading-relaxed flex items-center gap-1.5" style="color: var(--nav-text-muted);">
|
||||
<p class="text-sm leading-relaxed flex items-center gap-1.5" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" aria-hidden="true">
|
||||
<path d="M12 2L2 7l10 5 10-5-10-5z"/>
|
||||
<path d="M2 17l10 5 10-5"/>
|
||||
@@ -88,7 +100,7 @@
|
||||
|
||||
<!-- Points clés -->
|
||||
<div v-if="pointsCles.length" class="mt-4">
|
||||
<p class="text-sm font-medium mb-2" style="color: var(--nav-text-muted);">Points clés</p>
|
||||
<p class="text-sm font-medium mb-2" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">Points clés</p>
|
||||
<ul class="space-y-1">
|
||||
<li
|
||||
v-for="(point, i) in pointsCles"
|
||||
@@ -106,15 +118,16 @@
|
||||
<!-- Mini-carte Leaflet -->
|
||||
<div
|
||||
v-if="hasCoords"
|
||||
class="shrink-0 lg:w-56 xl:w-64 rounded-xl overflow-hidden"
|
||||
class="shrink-0 rounded-xl overflow-hidden"
|
||||
:class="compact ? '' : 'lg:w-56 xl:w-64'"
|
||||
style="height: 180px; border: 1px solid var(--nav-bg-alt);"
|
||||
>
|
||||
<ClientOnly>
|
||||
<div ref="mapContainer" class="w-full h-full"></div>
|
||||
<div ref="mapContainer" class="w-full h-full" role="img" :aria-label="`Carte : ${org.nom}${org.localisation_ville ? `, ${org.localisation_ville}` : ''}`"></div>
|
||||
<template #fallback>
|
||||
<div
|
||||
class="w-full h-full flex items-center justify-center text-xs"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text-muted);"
|
||||
style="background: var(--nav-bg-alt); color: color-mix(in srgb, var(--nav-text) 78%, transparent);"
|
||||
>Carte…</div>
|
||||
</template>
|
||||
</ClientOnly>
|
||||
@@ -140,7 +153,7 @@
|
||||
|
||||
<Transition name="report-form">
|
||||
<div v-if="reportOpen" class="report-panel">
|
||||
<p class="text-xs mb-3" style="color: var(--nav-text-muted);">
|
||||
<p class="text-xs mb-3" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent);">
|
||||
Tes suggestions seront transmises à l'équipe AEP par email.
|
||||
</p>
|
||||
<div class="flex flex-col gap-3">
|
||||
@@ -171,7 +184,7 @@
|
||||
</div>
|
||||
<p v-if="reportError" class="text-xs" style="color: #e53e3e;">{{ reportError }}</p>
|
||||
<p v-if="reportSuccess" class="text-xs" style="color: #38a169;">{{ reportSuccess }}</p>
|
||||
<p class="text-xs" style="color: var(--nav-text-muted); opacity: 0.6;">
|
||||
<p class="text-xs" style="color: color-mix(in srgb, var(--nav-text) 78%, transparent); opacity: 0.6;">
|
||||
{{ reportMessage.length }}/500
|
||||
</p>
|
||||
</div>
|
||||
@@ -183,9 +196,18 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const baseTiles = useBaseTiles()
|
||||
import type { Org } from '~/types/org'
|
||||
|
||||
const props = defineProps<{ org: Org }>()
|
||||
const props = defineProps<{
|
||||
org: Org
|
||||
/** Panneau de détail de la vue fiches (B12, 380 px) : tout en colonne, titre en h2. */
|
||||
compact?: boolean
|
||||
/** Fonctions en chips cliquables : la vue fiches ajoute le filtre. */
|
||||
etiquettesCliquables?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ etiquette: [fonction: string] }>()
|
||||
|
||||
// ── Champs ──────────────────────────────────────────────────────────────
|
||||
const descriptionUser = computed(() =>
|
||||
@@ -263,15 +285,25 @@ async function submitReport() {
|
||||
// ── Mini-carte Leaflet ────────────────────────────────────────────────
|
||||
const mapContainer = ref<HTMLElement | null>(null)
|
||||
|
||||
onMounted(async () => {
|
||||
if (!hasCoords.value || !mapContainer.value) return
|
||||
// Le conteneur est dans <ClientOnly>, rendu APRÈS le onMounted de ce composant
|
||||
// quand la fiche s'ouvre côté client (panneau de la vue fiches, B12) : on
|
||||
// attend qu'il existe au lieu de le lire au montage (il valait null, la
|
||||
// mini-carte restait un cadre vide).
|
||||
let mapInit = false
|
||||
watch(mapContainer, (el) => { if (el) initMap(el) }, { flush: 'post' })
|
||||
onMounted(() => { if (mapContainer.value) initMap(mapContainer.value) })
|
||||
|
||||
const L = (await import('leaflet')).default
|
||||
async function initMap(el: HTMLElement) {
|
||||
if (mapInit || !hasCoords.value) return
|
||||
mapInit = true
|
||||
|
||||
// Leaflet et sa feuille, chargés une fois pour toutes les cartes (useLeaflet, B4a).
|
||||
const L = await useLeaflet()
|
||||
|
||||
const lat = props.org.latitude as number
|
||||
const lng = props.org.longitude as number
|
||||
|
||||
const map = L.map(mapContainer.value, {
|
||||
const map = L.map(el, {
|
||||
center: [lat, lng],
|
||||
zoom: 10,
|
||||
zoomControl: false,
|
||||
@@ -283,7 +315,7 @@ onMounted(async () => {
|
||||
attributionControl: false,
|
||||
})
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
L.tileLayer(baseTiles.url(document.documentElement.classList.contains('dark')), {
|
||||
maxZoom: 18,
|
||||
}).addTo(map)
|
||||
|
||||
@@ -300,8 +332,9 @@ onMounted(async () => {
|
||||
iconAnchor: [7, 7],
|
||||
})
|
||||
|
||||
L.marker([lat, lng], { icon }).addTo(map)
|
||||
})
|
||||
// Épingle décorative : ni clic ni clavier (la mini-carte est une image, nommée par son conteneur)
|
||||
L.marker([lat, lng], { icon, interactive: false, keyboard: false }).addTo(map)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -311,7 +344,7 @@ onMounted(async () => {
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 0.78rem;
|
||||
color: var(--nav-text-muted);
|
||||
color: color-mix(in srgb, var(--nav-text) 78%, transparent);
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -0,0 +1,284 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<!-- Backdrop -->
|
||||
<Transition name="backdrop">
|
||||
<div
|
||||
v-if="modelValue && familleId != null"
|
||||
class="fixed inset-0 z-[1400]"
|
||||
style="background: rgba(26,34,56,0.55);"
|
||||
@click="close"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<!-- Modal -->
|
||||
<Transition name="modal">
|
||||
<div
|
||||
v-if="modelValue && familleId != null"
|
||||
class="fixed z-[1401] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col"
|
||||
style="
|
||||
width: min(720px, 94vw);
|
||||
max-height: 88vh;
|
||||
background: var(--nav-bg);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 16px 64px rgba(26,34,56,0.28);
|
||||
overflow: hidden;
|
||||
"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-label="familleLabel"
|
||||
@keydown.esc="close"
|
||||
>
|
||||
<!-- Header : background couleur famille -->
|
||||
<div
|
||||
class="flex items-center justify-between px-5 py-4 shrink-0"
|
||||
:style="`background: ${familleColor}; color: white;`"
|
||||
>
|
||||
<div class="flex items-center gap-3">
|
||||
<div
|
||||
class="w-3 h-3 rounded-full shrink-0"
|
||||
style="background: white;"
|
||||
/>
|
||||
<h2 class="text-lg font-bold" style="color: white;">{{ familleLabel }}</h2>
|
||||
</div>
|
||||
<button
|
||||
@click="close"
|
||||
class="w-8 h-8 rounded-lg flex items-center justify-center transition-colors"
|
||||
style="background: rgba(255,255,255,0.18); color: white;"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Body scrollable -->
|
||||
<div class="flex-1 overflow-y-auto px-5 py-5">
|
||||
<!-- Description longue editoriale -->
|
||||
<p
|
||||
class="text-sm leading-relaxed mb-5"
|
||||
style="color: var(--nav-text); white-space: pre-wrap;"
|
||||
>{{ familleDescription }}</p>
|
||||
|
||||
<!-- Separateur -->
|
||||
<div style="height: 1px; background: var(--nav-bg-alt); margin-bottom: 16px;" />
|
||||
|
||||
<!-- Mode fusion : Principal+Secondaire melanges (peu de secondaires) -->
|
||||
<template v-if="!showSplit">
|
||||
<h3
|
||||
class="text-xs font-bold uppercase tracking-wide mb-3"
|
||||
style="color: var(--nav-text-muted);"
|
||||
>{{ allStructures.length }} structure{{ allStructures.length > 1 ? 's' : '' }}</h3>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px;">
|
||||
<li
|
||||
v-for="s in allStructures"
|
||||
:key="s.id"
|
||||
@click="selectStructure(s.id)"
|
||||
class="structure-row"
|
||||
style="
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 8px 10px; border-radius: 6px;
|
||||
cursor: pointer; transition: background 0.1s;
|
||||
"
|
||||
>
|
||||
<span
|
||||
style="width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;"
|
||||
:style="`background: ${FAMILLE_COLORS[s.famille_principale] ?? '#888'};`"
|
||||
:title="`Famille principale : ${FAMILLE_LABELS[s.famille_principale] ?? ''}`"
|
||||
/>
|
||||
<span class="text-sm font-medium" style="color: var(--nav-text);">{{ s.nom }}</span>
|
||||
<span class="text-xs" style="color: var(--nav-text-muted);">{{ s.ville }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<!-- Mode split : Principal / Secondaire separes -->
|
||||
<template v-else>
|
||||
<div v-if="principalStructures.length" class="mb-5">
|
||||
<h3
|
||||
class="text-xs font-bold uppercase tracking-wide mb-3"
|
||||
style="color: var(--nav-text-muted);"
|
||||
>Principal ({{ principalStructures.length }})</h3>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px;">
|
||||
<li
|
||||
v-for="s in principalStructures"
|
||||
:key="s.id"
|
||||
@click="selectStructure(s.id)"
|
||||
class="structure-row"
|
||||
style="
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 8px 10px; border-radius: 6px;
|
||||
cursor: pointer; transition: background 0.1s;
|
||||
"
|
||||
>
|
||||
<span
|
||||
style="width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;"
|
||||
:style="`background: ${FAMILLE_COLORS[s.famille_principale] ?? '#888'};`"
|
||||
/>
|
||||
<span class="text-sm font-medium" style="color: var(--nav-text);">{{ s.nom }}</span>
|
||||
<span class="text-xs" style="color: var(--nav-text-muted);">{{ s.ville }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div v-if="secondaireStructures.length">
|
||||
<h3
|
||||
class="text-xs font-bold uppercase tracking-wide mb-3"
|
||||
style="color: var(--nav-text-muted);"
|
||||
>Secondaire ({{ secondaireStructures.length }})</h3>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px;">
|
||||
<li
|
||||
v-for="s in secondaireStructures"
|
||||
:key="s.id"
|
||||
@click="selectStructure(s.id)"
|
||||
class="structure-row"
|
||||
style="
|
||||
display: flex; align-items: center; gap: 10px;
|
||||
padding: 8px 10px; border-radius: 6px;
|
||||
cursor: pointer; transition: background 0.1s;
|
||||
"
|
||||
>
|
||||
<span
|
||||
style="width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;"
|
||||
:style="`background: ${FAMILLE_COLORS[s.famille_principale] ?? '#888'};`"
|
||||
:title="`Famille principale : ${FAMILLE_LABELS[s.famille_principale] ?? ''}`"
|
||||
/>
|
||||
<span class="text-sm font-medium" style="color: var(--nav-text);">{{ s.nom }}</span>
|
||||
<span class="text-xs" style="color: var(--nav-text-muted);">{{ s.ville }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div
|
||||
class="px-5 py-3 shrink-0 text-xs"
|
||||
style="border-top: 1px solid var(--nav-bg-alt); color: var(--nav-text-muted); background: var(--nav-surface);"
|
||||
>
|
||||
Click sur une structure pour ouvrir sa fiche
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ReseauxBifurcationData, StructureV2 } from '~/types/structure-v2'
|
||||
|
||||
const FAMILLE_COLORS: Record<number, string> = {
|
||||
1: '#a85d3e',
|
||||
2: '#c4a472',
|
||||
3: '#d4a017',
|
||||
4: '#5a7a4a',
|
||||
5: '#3d6a8c',
|
||||
6: '#6b3fa0',
|
||||
}
|
||||
|
||||
const FAMILLE_LABELS: Record<number, string> = {
|
||||
1: 'Reemploi & filieres',
|
||||
2: 'Frugalite & low-tech',
|
||||
3: 'Architecture sociale',
|
||||
4: 'Collectifs & AMO',
|
||||
5: 'Urbanisme de transition',
|
||||
6: 'Recherche-action',
|
||||
}
|
||||
|
||||
const FAMILLE_DESCRIPTIONS: Record<number, string> = {
|
||||
1: "Structures dont le geste premier est de travailler avec la matiere existante : deconstruction selective, plateformes de redistribution, filieres biosourcees et geosourcees.",
|
||||
2: "Pratiques qui partent du principe qu'on peut faire mieux avec moins. Renovation profonde, materiaux locaux, sobriete choisie.",
|
||||
3: "Structures dont le terrain premier est le mal-logement, la precarite, l'hospitalite. Architecture comme reponse a l'urgence sociale.",
|
||||
4: "Structures qui accompagnent les projets collectifs : cooperatives d'habitat, ecovillages, accompagnement vers l'autogestion ou la renovation.",
|
||||
5: "Demarches a l'echelle du territoire : villes en transition, PLU alternatifs, coalitions territoriales.",
|
||||
6: "Recherche-action et production de contre-savoirs (Forensic Architecture, Rural Studio, PEROU, Centrala). Badge transversal aux familles.",
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
familleId: number | null
|
||||
data: ReseauxBifurcationData | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
'select-structure': [id: string]
|
||||
}>()
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
function selectStructure(id: string) {
|
||||
// Fermer d'abord pour eviter superposition de modales
|
||||
emit('update:modelValue', false)
|
||||
emit('select-structure', id)
|
||||
}
|
||||
|
||||
// Fermeture Esc globale
|
||||
onMounted(() => {
|
||||
const handler = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape' && props.modelValue) close()
|
||||
}
|
||||
window.addEventListener('keydown', handler)
|
||||
onUnmounted(() => window.removeEventListener('keydown', handler))
|
||||
})
|
||||
|
||||
const familleColor = computed(() =>
|
||||
FAMILLE_COLORS[props.familleId ?? 0] ?? '#888'
|
||||
)
|
||||
|
||||
const familleLabel = computed(() =>
|
||||
FAMILLE_LABELS[props.familleId ?? 0] ?? ''
|
||||
)
|
||||
|
||||
const familleDescription = computed(() =>
|
||||
FAMILLE_DESCRIPTIONS[props.familleId ?? 0] ?? ''
|
||||
)
|
||||
|
||||
const principalStructures = computed<StructureV2[]>(() => {
|
||||
if (!props.data || props.familleId == null) return []
|
||||
return props.data.structures
|
||||
.filter(s => s.famille_principale === props.familleId)
|
||||
.sort((a, b) => a.nom.localeCompare(b.nom, 'fr'))
|
||||
})
|
||||
|
||||
const secondaireStructures = computed<StructureV2[]>(() => {
|
||||
if (!props.data || props.familleId == null) return []
|
||||
return props.data.structures
|
||||
.filter(s =>
|
||||
s.famille_principale !== props.familleId
|
||||
&& (s.familles_secondaires ?? []).includes(props.familleId as number)
|
||||
)
|
||||
.sort((a, b) => a.nom.localeCompare(b.nom, 'fr'))
|
||||
})
|
||||
|
||||
const allStructures = computed<StructureV2[]>(() => {
|
||||
return [...principalStructures.value, ...secondaireStructures.value]
|
||||
})
|
||||
|
||||
// Heuristique : si > 3 secondaires, separer en sections distinctes
|
||||
const showSplit = computed(() => secondaireStructures.value.length > 3)
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.structure-row:hover {
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: opacity 0.2s ease; }
|
||||
.backdrop-enter-from, .backdrop-leave-to { opacity: 0; }
|
||||
|
||||
.modal-enter-active, .modal-leave-active {
|
||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
.modal-enter-from, .modal-leave-to {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -52%);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: none; }
|
||||
.modal-enter-active, .modal-leave-active { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,170 @@
|
||||
<!--
|
||||
FicheMiniCard — B3-M2, B11-M2
|
||||
La carte entière ouvre la fiche (bouton étiré par ::after) ; avec
|
||||
`etiquettesCliquables`, les chips deviennent des boutons qui émettent
|
||||
`etiquette` (la vue fiches ajoute le filtre). Un bouton ne pouvant pas en
|
||||
contenir d'autres, la racine est un <article>, plus un <button> : apparence
|
||||
inchangée, page /dev/fiche-mini-card comprise.
|
||||
-->
|
||||
<template>
|
||||
<article class="fiche-mini-card" :class="{ 'fiche-mini-card--actif': actif }">
|
||||
<button
|
||||
type="button"
|
||||
class="fiche-mini-card__ouvrir"
|
||||
@click="emit('open')"
|
||||
>
|
||||
<span class="fiche-mini-card__nom">{{ fiche.nom }}</span>
|
||||
<span v-if="fiche.resume" class="fiche-mini-card__resume">{{ fiche.resume }}</span>
|
||||
</button>
|
||||
|
||||
<ChipGroup
|
||||
v-if="fiche.chips.length || fiche.echelle"
|
||||
:aria-label="`Étiquettes de ${fiche.nom}`"
|
||||
class="fiche-mini-card__chips"
|
||||
>
|
||||
<Chip v-if="fiche.echelle" as="span" variant="echelle" :label="fiche.echelle" />
|
||||
<template v-if="etiquettesCliquables">
|
||||
<Chip
|
||||
v-for="chip in fiche.chips"
|
||||
:key="chip"
|
||||
variant="fonction"
|
||||
:label="chip"
|
||||
:active="etiquettesActives?.includes(chip)"
|
||||
:aria-label="`Filtrer par ${chip}`"
|
||||
@toggle="emit('etiquette', chip)"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Chip v-for="chip in fiche.chips" :key="chip" as="span" variant="fonction" :label="chip" />
|
||||
</template>
|
||||
</ChipGroup>
|
||||
|
||||
<span v-if="!fiche.geoloc" class="fiche-mini-card__no-geo">Sans localisation</span>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { MiniFiche } from '~/composables/useFicheAdapter'
|
||||
|
||||
defineProps<{
|
||||
fiche: MiniFiche
|
||||
etiquettesCliquables?: boolean
|
||||
/** Libellés de chips déjà filtrés (affichés pressés). */
|
||||
etiquettesActives?: string[]
|
||||
/** Fiche survolée sur la carte ou sélectionnée. */
|
||||
actif?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
open: []
|
||||
etiquette: [label: string]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fiche-mini-card {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-sm);
|
||||
border: 1px solid transparent;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
text-align: left;
|
||||
box-sizing: border-box;
|
||||
transition: background-color var(--dur-fast) var(--ease-out),
|
||||
box-shadow var(--dur-fast) var(--ease-out),
|
||||
border-color var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.fiche-mini-card {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
.fiche-mini-card:hover {
|
||||
background: var(--surface-2);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
/* Survol d'une épingle ou fiche sélectionnée : liseré safran */
|
||||
.fiche-mini-card--actif {
|
||||
border-color: var(--accent);
|
||||
box-shadow: inset 3px 0 0 var(--accent);
|
||||
}
|
||||
|
||||
.fiche-mini-card:has(.fiche-mini-card__ouvrir:focus-visible) {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Bouton étiré : toute la carte ouvre la fiche, les chips cliquables passent dessus */
|
||||
.fiche-mini-card__ouvrir {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
color: inherit;
|
||||
text-align: left;
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
.fiche-mini-card__ouvrir::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: inherit;
|
||||
}
|
||||
.fiche-mini-card__ouvrir:focus-visible {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.fiche-mini-card__nom {
|
||||
width: 100%;
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
line-height: var(--lh-tight);
|
||||
color: var(--text);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.fiche-mini-card__resume {
|
||||
width: 100%;
|
||||
margin-top: var(--space-2xs);
|
||||
font-size: var(--fs-xs);
|
||||
line-height: var(--lh-base);
|
||||
/* --text-muted ne donne que 3,7:1 sur --surface (DESIGN-SYSTEM §Navigation) */
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fiche-mini-card__chips {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-top: var(--space-xs);
|
||||
pointer-events: none;
|
||||
}
|
||||
.fiche-mini-card__chips :deep(button) {
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.fiche-mini-card__no-geo {
|
||||
margin-top: var(--space-2xs);
|
||||
font-size: var(--fs-xs);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
</style>
|
||||
@@ -1,164 +0,0 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<!-- Backdrop -->
|
||||
<Transition name="backdrop">
|
||||
<div
|
||||
v-if="modelValue && orgId != null"
|
||||
class="fixed inset-0 z-[1500]"
|
||||
style="background: rgba(26,34,56,0.55);"
|
||||
@click="close"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<!-- Modal centré -->
|
||||
<Transition name="modal">
|
||||
<div
|
||||
v-if="modelValue && orgId != null"
|
||||
class="fixed z-[1501] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col"
|
||||
style="
|
||||
width: min(768px, 92vw);
|
||||
max-height: 90vh;
|
||||
background: var(--nav-bg);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 16px 64px rgba(26,34,56,0.28);
|
||||
overflow: hidden;
|
||||
"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-label="org?.nom ?? 'Fiche organisation'"
|
||||
@keydown.esc="close"
|
||||
>
|
||||
<!-- Header modal -->
|
||||
<div
|
||||
class="flex items-center justify-between px-5 py-3 shrink-0 border-b"
|
||||
style="background: var(--nav-surface); border-color: var(--nav-bg-alt);"
|
||||
>
|
||||
<span class="text-sm font-semibold" style="color: var(--nav-text-muted);">Fiche détaillée</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<!-- Lien fiche complète -->
|
||||
<a
|
||||
v-if="orgId"
|
||||
:href="`/fiche/${orgId}`"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium transition-opacity hover:opacity-70"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text);"
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
||||
<polyline points="15 3 21 3 21 9"/>
|
||||
<line x1="10" y1="14" x2="21" y2="3"/>
|
||||
</svg>
|
||||
Ouvrir
|
||||
</a>
|
||||
<!-- Fermer -->
|
||||
<button
|
||||
@click="close"
|
||||
class="w-8 h-8 rounded-lg flex items-center justify-center transition-colors"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text-muted);"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Contenu scrollable -->
|
||||
<div class="flex-1 overflow-y-auto px-5 py-5">
|
||||
<!-- Chargement -->
|
||||
<div v-if="pending" class="py-12 text-center text-sm" style="color: var(--nav-text-muted);">
|
||||
Chargement de la fiche…
|
||||
</div>
|
||||
|
||||
<!-- Erreur -->
|
||||
<div v-else-if="error" class="py-12 text-center">
|
||||
<p class="text-base font-semibold mb-2" style="color: var(--nav-text);">Fiche introuvable</p>
|
||||
<p class="text-sm" style="color: var(--nav-text-muted);">L'organisation demandée n'existe pas ou a été supprimée.</p>
|
||||
</div>
|
||||
|
||||
<!-- Contenu -->
|
||||
<template v-else-if="org">
|
||||
<FicheDetail :org="org" />
|
||||
<div class="mb-5" style="height: 1px; background: var(--nav-bg-alt);"></div>
|
||||
<CommentSection :org-id="org.Id" :refresh="commentRefreshTick" />
|
||||
<CommentForm :org-id="org.Id" @submitted="onCommentSubmitted" />
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Org } from '~/types/org'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
orgId: number | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: boolean]
|
||||
}>()
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
}
|
||||
|
||||
// Fermeture Esc globale
|
||||
onMounted(() => {
|
||||
const handler = (e: KeyboardEvent) => {
|
||||
if (e.key === 'Escape' && props.modelValue) close()
|
||||
}
|
||||
window.addEventListener('keydown', handler)
|
||||
onUnmounted(() => window.removeEventListener('keydown', handler))
|
||||
})
|
||||
|
||||
// Fetch fiche quand orgId change
|
||||
const org = ref<Org | null>(null)
|
||||
const pending = ref(false)
|
||||
const error = ref(false)
|
||||
|
||||
watch(() => props.orgId, async (id) => {
|
||||
if (id == null) return
|
||||
pending.value = true
|
||||
error.value = false
|
||||
org.value = null
|
||||
try {
|
||||
org.value = await $fetch<Org>(`/api/fiche/${id}`)
|
||||
} catch {
|
||||
error.value = true
|
||||
} finally {
|
||||
pending.value = false
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
const commentRefreshTick = ref(0)
|
||||
|
||||
function onCommentSubmitted() {
|
||||
commentRefreshTick.value++
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Backdrop */
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: opacity 0.2s ease; }
|
||||
.backdrop-enter-from, .backdrop-leave-to { opacity: 0; }
|
||||
|
||||
/* Modal */
|
||||
.modal-enter-active, .modal-leave-active {
|
||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||
}
|
||||
.modal-enter-from, .modal-leave-to {
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -52%);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: none; }
|
||||
.modal-enter-active, .modal-leave-active { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,291 @@
|
||||
<!--
|
||||
FicheReseauContenu — B12-M4. Le corps de l'ancienne FicheModalV2 (retirée),
|
||||
devenu un contenu : la vue fiches le pose dans son panneau de détail
|
||||
(slot #detail de VueFiches). Badges, hashtags, descriptions, pensées,
|
||||
projets, structures liées, sources.
|
||||
|
||||
Hashtag cliqué → `etiquette` (la vue fiches ajoute le filtre) ; structure
|
||||
liée cliquée → `voisin` (la page l'ouvre dans le même panneau).
|
||||
-->
|
||||
<template>
|
||||
<article v-if="structure" class="frc">
|
||||
<div class="frc-famille" :style="`border-bottom-color: ${familleColor};`">
|
||||
<span class="frc-famille__pastille" :style="`background: ${familleColor};`" aria-hidden="true" />
|
||||
<span class="frc-famille__libelle">{{ familleLabel }}</span>
|
||||
<span v-if="structure.badges.centre_ressources" class="frc-badge" style="background: #2d8a6b22; color: #1f6650;">Centre ressources</span>
|
||||
<span v-if="structure.badges.mouvement_manifeste" class="frc-badge" style="background: #c44a2f22; color: #9a3520;">Manifeste</span>
|
||||
<span v-if="structure.badges.contre_pouvoir_spatial" class="frc-badge" style="background: #1a3a6b22; color: #1a3a6b;">Contre-pouvoir</span>
|
||||
<span v-if="structure.badges.f6_recherche_politique" class="frc-badge" style="background: #6b3fa022; color: #5a3388;">Recherche pol.</span>
|
||||
</div>
|
||||
|
||||
<h2 class="frc-nom">{{ structure.nom }}</h2>
|
||||
<p class="frc-meta">
|
||||
<span>{{ structure.type_principal }}</span>
|
||||
<span aria-hidden="true"> · </span>
|
||||
<span>{{ structure.ville }}, {{ structure.pays }}</span>
|
||||
</p>
|
||||
|
||||
<a
|
||||
v-if="structure.url"
|
||||
:href="structure.url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="frc-site"
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" />
|
||||
<polyline points="15 3 21 3 21 9" />
|
||||
<line x1="10" y1="14" x2="21" y2="3" />
|
||||
</svg>
|
||||
Site web<span class="frc-sr"> (nouvel onglet)</span>
|
||||
</a>
|
||||
|
||||
<ChipGroup v-if="structure.hashtags.length" :aria-label="`Hashtags de ${structure.nom}`" class="frc-tags">
|
||||
<Chip
|
||||
v-for="tag in structure.hashtags"
|
||||
:key="tag"
|
||||
variant="fonction"
|
||||
:label="tag"
|
||||
:active="etiquettesActives?.includes(tag)"
|
||||
:aria-label="`Filtrer par ${tag}`"
|
||||
@toggle="emit('etiquette', tag)"
|
||||
/>
|
||||
</ChipGroup>
|
||||
|
||||
<p class="frc-texte">{{ structure.description_courte }}</p>
|
||||
|
||||
<div v-if="structure.description_longue" class="frc-bloc">
|
||||
<div class="frc-texte frc-long" :class="{ 'frc-long--replie': !showFullDesc }">{{ structure.description_longue }}</div>
|
||||
<button type="button" class="frc-lien" :aria-expanded="showFullDesc" @click="showFullDesc = !showFullDesc">
|
||||
{{ showFullDesc ? 'Réduire' : 'Lire la suite…' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<section v-if="structure.pensees && structure.pensees.length" class="frc-bloc">
|
||||
<h3 class="frc-titre">Pensées rattachées</h3>
|
||||
<div class="frc-liste-inline">
|
||||
<span
|
||||
v-for="pensee in structure.pensees"
|
||||
:key="pensee.id"
|
||||
class="frc-pensee"
|
||||
:class="{ 'frc-pensee--ia': pensee.confiance === 'ia_suggested' }"
|
||||
:title="pensee.confiance === 'ia_suggested' ? 'IA suggéré' : ''"
|
||||
>{{ pensee.label }}<span v-if="pensee.confiance === 'ia_suggested'" aria-hidden="true"> ~</span><span v-if="pensee.confiance === 'ia_suggested'" class="frc-sr"> (suggéré par l'IA)</span></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="projetsStructure.length" class="frc-bloc">
|
||||
<h3 class="frc-titre">Projets emblématiques</h3>
|
||||
<div class="frc-projets">
|
||||
<div v-for="projet in projetsStructure.slice(0, 5)" :key="projet.id" class="frc-projet">
|
||||
<div class="frc-projet__tete">
|
||||
<span class="frc-projet__nom">{{ projet.nom }}</span>
|
||||
<span v-if="projet.annee" class="frc-discret">{{ projet.annee }}</span>
|
||||
</div>
|
||||
<div v-if="projet.lieu" class="frc-discret">{{ projet.lieu }}</div>
|
||||
<p class="frc-projet__desc">{{ projet.description.slice(0, 120) }}{{ projet.description.length > 120 ? '…' : '' }}</p>
|
||||
<a v-if="projet.url" :href="projet.url" target="_blank" rel="noopener noreferrer" class="frc-lien">En savoir plus<span class="frc-sr"> sur {{ projet.nom }} (nouvel onglet)</span> →</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="structuresVoisines.length" class="frc-bloc">
|
||||
<h3 class="frc-titre">Structures liées</h3>
|
||||
<div class="frc-liste-inline">
|
||||
<button
|
||||
v-for="voisine in structuresVoisines.slice(0, 6)"
|
||||
:key="voisine.id"
|
||||
type="button"
|
||||
class="frc-voisin"
|
||||
@click="emit('voisin', voisine.id)"
|
||||
>{{ voisine.nom }}</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="structure.sources && structure.sources.length" class="frc-bloc">
|
||||
<h3 class="frc-titre">Sources</h3>
|
||||
<ul class="frc-sources">
|
||||
<li v-for="(source, i) in structure.sources" :key="i">
|
||||
<span class="frc-source__type">{{ source.type }}</span>
|
||||
<a v-if="source.url" :href="source.url" target="_blank" rel="noopener noreferrer" class="frc-lien">{{ source.titre }}</a>
|
||||
<span v-else>{{ source.titre }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<p class="frc-cta">
|
||||
<NuxtLink to="/contribuer" class="frc-lien">Signaler une erreur</NuxtLink>
|
||||
<NuxtLink to="/contribuer" class="frc-lien">Réclamer cette fiche</NuxtLink>
|
||||
</p>
|
||||
</article>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ReseauxBifurcationData, StructureV2, ProjetEmblematique } from '~/types/structure-v2'
|
||||
|
||||
const FAMILLE_COLORS: Record<number, string> = {
|
||||
1: '#a85d3e',
|
||||
2: '#c4a472',
|
||||
3: '#d4a017',
|
||||
4: '#5a7a4a',
|
||||
5: '#3d6a8c',
|
||||
}
|
||||
|
||||
const FAMILLE_LABELS: Record<number, string> = {
|
||||
1: 'Réemploi & filières',
|
||||
2: 'Frugalité & low-tech',
|
||||
3: 'Architecture sociale',
|
||||
4: 'Collectifs & AMO',
|
||||
5: 'Urbanisme de transition',
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
structureId: string
|
||||
data: ReseauxBifurcationData | null
|
||||
/** Hashtags actifs dans les filtres (avec leur « # ») : la chip s'allume. */
|
||||
etiquettesActives?: string[]
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
etiquette: [hashtag: string]
|
||||
voisin: [id: string]
|
||||
}>()
|
||||
|
||||
const showFullDesc = ref(false)
|
||||
watch(() => props.structureId, () => { showFullDesc.value = false })
|
||||
|
||||
const structure = computed<StructureV2 | null>(() =>
|
||||
props.data?.structures.find((s) => s.id === props.structureId) ?? null,
|
||||
)
|
||||
|
||||
const familleColor = computed(() => FAMILLE_COLORS[structure.value?.famille_principale ?? 1] ?? '#888')
|
||||
const familleLabel = computed(() => FAMILLE_LABELS[structure.value?.famille_principale ?? 1] ?? '')
|
||||
|
||||
const projetsStructure = computed<ProjetEmblematique[]>(() =>
|
||||
props.data?.projets?.filter((p) => p.structure_parent === props.structureId) ?? [],
|
||||
)
|
||||
|
||||
const structuresVoisines = computed<StructureV2[]>(() => {
|
||||
if (!props.data) return []
|
||||
const edges = props.data.graphe?.edges ?? []
|
||||
return edges
|
||||
.filter((e) => e.source === props.structureId || e.target === props.structureId)
|
||||
.sort((a, b) => (b.score ?? 0) - (a.score ?? 0))
|
||||
.map((e) => (e.source === props.structureId ? e.target : e.source))
|
||||
.slice(0, 8)
|
||||
.map((id) => props.data!.structures.find((s) => s.id === id))
|
||||
.filter(Boolean) as StructureV2[]
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.frc { color: var(--text); font-size: var(--fs-sm); }
|
||||
.frc-sr {
|
||||
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
|
||||
overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
|
||||
}
|
||||
|
||||
.frc-famille {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-2xs) var(--space-xs);
|
||||
padding-bottom: var(--space-xs);
|
||||
margin-bottom: var(--space-sm);
|
||||
border-bottom: 3px solid;
|
||||
}
|
||||
.frc-famille__pastille { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
|
||||
.frc-famille__libelle { font-weight: var(--fw-semibold); color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
.frc-badge {
|
||||
padding: 2px var(--space-xs);
|
||||
border-radius: var(--radius-full);
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
font-weight: var(--fw-medium);
|
||||
}
|
||||
|
||||
.frc-nom { margin: 0 0 var(--space-2xs); font-size: 1.25rem; font-weight: var(--fw-bold, 700); line-height: 1.25; }
|
||||
.frc-meta { margin: 0 0 var(--space-sm); color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
|
||||
.frc-site {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-2xs);
|
||||
min-height: 32px;
|
||||
padding: 0 var(--space-sm);
|
||||
margin-bottom: var(--space-sm);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-alt);
|
||||
color: var(--text);
|
||||
font-weight: var(--fw-medium);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.frc-tags { margin-bottom: var(--space-sm); }
|
||||
|
||||
.frc-texte { margin: 0 0 var(--space-sm); line-height: var(--lh-base, 1.55); }
|
||||
.frc-long { white-space: pre-wrap; margin: 0; }
|
||||
.frc-long--replie { max-height: 120px; overflow: hidden; }
|
||||
|
||||
.frc-bloc { margin-bottom: var(--space-md); }
|
||||
.frc-titre {
|
||||
margin: 0 0 var(--space-xs);
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
font-weight: var(--fw-bold, 700);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
.frc-liste-inline { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
|
||||
.frc-pensee {
|
||||
padding: 2px var(--space-xs);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-alt);
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
}
|
||||
.frc-pensee--ia { color: color-mix(in srgb, var(--text) 78%, transparent); border: 1px dashed var(--border); }
|
||||
|
||||
.frc-projets { display: flex; flex-direction: column; gap: var(--space-xs); }
|
||||
.frc-projet { padding: var(--space-sm); border-radius: var(--radius-md); background: var(--bg); border: 1px solid var(--border); }
|
||||
.frc-projet__tete { display: flex; justify-content: space-between; gap: var(--space-xs); }
|
||||
.frc-projet__nom { font-weight: var(--fw-medium); }
|
||||
.frc-projet__desc { margin: var(--space-2xs) 0; font-size: var(--fs-xs, 0.75rem); line-height: 1.5; color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
.frc-discret { font-size: var(--fs-xs, 0.75rem); color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
|
||||
.frc-voisin {
|
||||
min-height: 32px;
|
||||
padding: 0 var(--space-xs);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--bg-alt);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.frc-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2xs); }
|
||||
.frc-sources li { display: flex; align-items: baseline; gap: var(--space-xs); min-width: 0; font-size: var(--fs-xs, 0.75rem); overflow-wrap: anywhere; }
|
||||
.frc-source__type { flex-shrink: 0; padding: 1px var(--space-2xs); border-radius: var(--radius-sm); background: var(--bg-alt); }
|
||||
|
||||
.frc-lien {
|
||||
padding: 0;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.frc-cta { display: flex; gap: var(--space-sm); padding-top: var(--space-xs); margin: 0; border-top: 1px solid var(--border); }
|
||||
|
||||
.frc-site:focus-visible,
|
||||
.frc-lien:focus-visible,
|
||||
.frc-voisin:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,67 +0,0 @@
|
||||
<template>
|
||||
<div class="space-y-1.5">
|
||||
<p class="text-xs font-bold uppercase tracking-widest" style="color: var(--nav-text-muted);">Fonction</p>
|
||||
<div class="space-y-1">
|
||||
<button
|
||||
v-for="fn in FONCTIONS"
|
||||
:key="fn"
|
||||
@click="toggle(fn)"
|
||||
:aria-pressed="modelValue.includes(fn)"
|
||||
class="flex items-center gap-2.5 w-full rounded px-1 py-0.5 transition-all text-left hover:opacity-80"
|
||||
:style="modelValue.includes(fn) ? 'background: rgba(26,34,56,0.06);' : ''"
|
||||
>
|
||||
<!-- Case : affiche le rang de priorité si actif, sinon le nombre d'orgs -->
|
||||
<span
|
||||
class="flex items-center justify-center shrink-0 text-xs font-bold transition-all"
|
||||
style="width: 24px; height: 24px; border: 1.5px solid; border-radius: 4px;"
|
||||
:style="modelValue.includes(fn)
|
||||
? 'background: var(--nav-primary); border-color: var(--nav-primary); color: var(--nav-text-on-primary);'
|
||||
: 'background: var(--nav-bg-alt); border-color: var(--nav-bg-alt); color: var(--nav-text-muted);'"
|
||||
>
|
||||
{{ modelValue.includes(fn) ? (modelValue.indexOf(fn) + 1) : (counts[fn] ?? 0) }}
|
||||
</span>
|
||||
<!-- Label -->
|
||||
<span
|
||||
class="text-sm leading-tight"
|
||||
:style="modelValue.includes(fn) ? 'color: var(--nav-text); font-weight: 600;' : 'color: var(--nav-text);'"
|
||||
>{{ fn }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<p v-if="modelValue.length" class="text-xs pt-0.5" style="color: var(--nav-text-muted);">
|
||||
{{ modelValue.length }} actif{{ modelValue.length > 1 ? 's' : '' }}
|
||||
<button @click="emit('update:modelValue', [])" class="ml-2 underline hover:opacity-70">Effacer</button>
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const FONCTIONS = [
|
||||
'Juridique',
|
||||
'Technique',
|
||||
'Économique',
|
||||
'Administratif',
|
||||
'Chantier',
|
||||
'Comptabilité',
|
||||
'Développement',
|
||||
'Formation',
|
||||
"Gestion d'agence",
|
||||
'Santé mentale',
|
||||
] as const
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: string[]
|
||||
counts: Record<string, number>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string[]]
|
||||
}>()
|
||||
|
||||
function toggle(fn: string) {
|
||||
if (props.modelValue.includes(fn)) {
|
||||
emit('update:modelValue', props.modelValue.filter(f => f !== fn))
|
||||
} else {
|
||||
emit('update:modelValue', [...props.modelValue, fn])
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,184 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.nom }">
|
||||
<label for="eco-nom">Nom de l'organisation <span class="required">*</span></label>
|
||||
<input id="eco-nom" v-model="form.nom" type="text" placeholder="Ex : UNSFA, Maison de l'Architecture..." autocomplete="organization" @blur="validateField('nom')" />
|
||||
<span v-if="errors.nom" class="error-msg" role="alert">{{ errors.nom }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.url }">
|
||||
<label for="eco-url">Site web <span class="label-hint">(optionnel — recommandé pour l'enrichissement IA)</span></label>
|
||||
<input id="eco-url" v-model="form.url" type="url" placeholder="https://..." @blur="validateField('url')" />
|
||||
<span v-if="errors.url" class="error-msg" role="alert">{{ errors.url }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.description_user }">
|
||||
<label for="eco-desc">Description courte <span class="required">*</span> <span class="label-hint">(50 à 500 caractères)</span></label>
|
||||
<textarea id="eco-desc" v-model="form.description_user" rows="4" placeholder="Présente l'organisation en quelques mots : ses missions, son public, ce qu'elle apporte..." @blur="validateField('description_user')" />
|
||||
<div class="field-meta">
|
||||
<span v-if="errors.description_user" class="error-msg" role="alert">{{ errors.description_user }}</span>
|
||||
<span v-else class="char-count" :class="{ 'char-warn': form.description_user.length > 450 }">{{ form.description_user.length }}/500</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.echelle }">
|
||||
<fieldset>
|
||||
<legend>Échelle <span class="required">*</span> <span class="label-hint">(une seule)</span></legend>
|
||||
<div class="radio-group">
|
||||
<label v-for="opt in ECHELLES" :key="opt" class="radio-label" :class="{ active: form.echelle === opt }">
|
||||
<input type="radio" :value="opt" v-model="form.echelle" name="eco-echelle" @change="validateField('echelle')" />{{ opt }}
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<span v-if="errors.echelle" class="error-msg" role="alert">{{ errors.echelle }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.fonctions }">
|
||||
<fieldset>
|
||||
<legend>Fonctions <span class="required">*</span> <span class="label-hint">(1 à 5 — l'ordre de clic = priorité)</span></legend>
|
||||
<div class="checkbox-grid">
|
||||
<label v-for="fn in FONCTIONS" :key="fn" class="checkbox-label" :class="{ active: form.fonctions.includes(fn), disabled: !form.fonctions.includes(fn) && form.fonctions.length >= 5 }">
|
||||
<input type="checkbox" :value="fn" :checked="form.fonctions.includes(fn)" :disabled="!form.fonctions.includes(fn) && form.fonctions.length >= 5" @change="toggleFonction(fn)" />
|
||||
<span class="fn-order" v-if="form.fonctions.includes(fn)">{{ form.fonctions.indexOf(fn) + 1 }}</span>{{ fn }}
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<span v-if="errors.fonctions" class="error-msg" role="alert">{{ errors.fonctions }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.territoire }">
|
||||
<fieldset>
|
||||
<legend>Territoire <span class="required">*</span></legend>
|
||||
<div class="radio-group">
|
||||
<label v-for="t in TERRITOIRES" :key="t" class="radio-label" :class="{ active: form.territoire === t }">
|
||||
<input type="radio" :value="t" v-model="form.territoire" name="eco-territoire" @change="validateField('territoire')" />{{ t }}
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
<span v-if="errors.territoire" class="error-msg" role="alert">{{ errors.territoire }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.localisation_ville }">
|
||||
<label for="eco-ville">Ville principale <span class="label-hint">(optionnel — pour la géolocalisation sur la carte)</span></label>
|
||||
<input id="eco-ville" v-model="form.localisation_ville" type="text" placeholder="Ex : Paris, Lyon, Bordeaux..." />
|
||||
<span v-if="errors.localisation_ville" class="error-msg" role="alert">{{ errors.localisation_ville }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="eco-email">Ton email <span class="label-hint">(optionnel — pour le suivi de modération)</span></label>
|
||||
<input id="eco-email" v-model="form.submitted_by_email" type="email" placeholder="ton@email.fr" autocomplete="email" @blur="validateField('submitted_by_email')" />
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert"><strong>Erreur :</strong> {{ serverError }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">{{ submitting ? 'Envoi en cours...' : 'Proposer la fiche →' }}</button>
|
||||
</div>
|
||||
<p class="form-note">Ta fiche sera examinée par l'équipe avant publication.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { z } from 'zod'
|
||||
|
||||
const ECHELLES = ['National', 'Régional', 'Local'] as const
|
||||
const TERRITOIRES = ['Métropole', 'Guadeloupe', 'Martinique', 'Guyane', 'La Réunion', 'Mayotte'] as const
|
||||
const FONCTIONS = ['Juridique', 'Technique', 'Économique', 'Administratif', 'Chantier', 'Comptabilité', 'Développement', 'Formation', 'Gestion d\'agence', 'Santé mentale'] as const
|
||||
|
||||
const Schema = z.object({
|
||||
nom: z.string().min(3, 'Minimum 3 caractères').max(150, 'Maximum 150 caractères').trim(),
|
||||
url: z.string().url('URL invalide (commencer par https://)').optional().or(z.literal('')),
|
||||
description_user: z.string().min(50, 'Minimum 50 caractères').max(500, 'Maximum 500 caractères').trim(),
|
||||
echelle: z.enum(ECHELLES, { errorMap: () => ({ message: 'Sélectionne une échelle' }) }),
|
||||
fonctions: z.array(z.string()).min(1, 'Sélectionne au moins une fonction').max(5, 'Maximum 5 fonctions'),
|
||||
territoire: z.enum(TERRITOIRES, { errorMap: () => ({ message: 'Sélectionne un territoire' }) }),
|
||||
localisation_ville: z.string().max(100).optional(),
|
||||
submitted_by_email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const form = reactive({
|
||||
nom: '', url: '', description_user: '', echelle: '' as string,
|
||||
fonctions: [] as string[], territoire: '' as string,
|
||||
localisation_ville: '', submitted_by_email: '',
|
||||
})
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function validateField(field: string) {
|
||||
const partial = Schema.partial()
|
||||
const result = partial.safeParse({ [field]: (form as any)[field] })
|
||||
if (!result.success) {
|
||||
const fieldErrors = result.error.flatten().fieldErrors
|
||||
errors[field] = fieldErrors[field]?.[0] ?? ''
|
||||
} else {
|
||||
delete errors[field]
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(): boolean {
|
||||
const result = Schema.safeParse(form)
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach(k => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
function toggleFonction(fn: string) {
|
||||
const idx = form.fonctions.indexOf(fn)
|
||||
if (idx >= 0) form.fonctions.splice(idx, 1)
|
||||
else if (form.fonctions.length < 5) form.fonctions.push(fn)
|
||||
validateField('fonctions')
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll()) {
|
||||
await nextTick()
|
||||
const firstError = document.querySelector('.field-error')
|
||||
firstError?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
submission_type: 'ecosysteme',
|
||||
nom: form.nom,
|
||||
url: form.url || undefined,
|
||||
description_user: form.description_user,
|
||||
echelle: form.echelle,
|
||||
fonctions: form.fonctions,
|
||||
territoire: form.territoire,
|
||||
localisation_ville: form.localisation_ville || undefined,
|
||||
submitted_by_email: form.submitted_by_email || undefined,
|
||||
},
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
const fieldErrors = e.data
|
||||
Object.entries(fieldErrors).forEach(([k, v]) => { errors[k] = Array.isArray(v) ? v[0] : String(v) })
|
||||
serverError.value = 'Certains champs sont invalides — vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
</style>
|
||||
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.nom }">
|
||||
<label for="job-nom">Nom de la plateforme / job board <span class="required">*</span></label>
|
||||
<input id="job-nom" v-model="form.nom" type="text" placeholder="Ex : Houzz, Architoo, BOAMP..." @blur="validateField('nom')" />
|
||||
<span v-if="errors.nom" class="error-msg" role="alert">{{ errors.nom }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="job-type">Type de plateforme <span class="label-hint">(optionnel)</span></label>
|
||||
<div class="radio-group">
|
||||
<label v-for="t in TYPES" :key="t" class="radio-label" :class="{ active: form.type_plateforme === t }">
|
||||
<input type="radio" :value="t" v-model="form.type_plateforme" name="job-type" />{{ LABELS[t] }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.url }">
|
||||
<label for="job-url">Site web <span class="required">*</span></label>
|
||||
<input id="job-url" v-model="form.url" type="url" placeholder="https://..." @blur="validateField('url')" />
|
||||
<span v-if="errors.url" class="error-msg" role="alert">{{ errors.url }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.description_user }">
|
||||
<label for="job-desc">Description courte <span class="required">*</span> <span class="label-hint">(50 à 500 caractères)</span></label>
|
||||
<textarea id="job-desc" v-model="form.description_user" rows="4" placeholder="Décris la plateforme : qui la gère, quel type de missions, quel modèle économique..." @blur="validateField('description_user')" />
|
||||
<div class="field-meta">
|
||||
<span v-if="errors.description_user" class="error-msg" role="alert">{{ errors.description_user }}</span>
|
||||
<span v-else class="char-count" :class="{ 'char-warn': form.description_user.length > 450 }">{{ form.description_user.length }}/500</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="job-email">Ton email <span class="label-hint">(optionnel — pour le suivi)</span></label>
|
||||
<input id="job-email" v-model="form.submitted_by_email" type="email" placeholder="ton@email.fr" autocomplete="email" @blur="validateField('submitted_by_email')" />
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert"><strong>Erreur :</strong> {{ serverError }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">{{ submitting ? 'Envoi en cours...' : 'Proposer →' }}</button>
|
||||
</div>
|
||||
<p class="form-note">Ta proposition sera examinée par l'équipe avant publication.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { z } from 'zod'
|
||||
|
||||
const TYPES = ['mise-en-relation', 'appel-offre-public', 'communaute-pro'] as const
|
||||
const LABELS: Record<string, string> = { 'mise-en-relation': 'Mise en relation (B2C)', 'appel-offre-public': 'Appels d\'offres publics', 'communaute-pro': 'Communauté pro' }
|
||||
|
||||
const Schema = z.object({
|
||||
nom: z.string().min(3, 'Minimum 3 caractères').max(150, 'Maximum 150 caractères').trim(),
|
||||
url: z.string().url('URL invalide (commencer par https://)'),
|
||||
description_user: z.string().min(50, 'Minimum 50 caractères').max(500, 'Maximum 500 caractères').trim(),
|
||||
type_plateforme: z.string().optional(),
|
||||
submitted_by_email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const form = reactive({
|
||||
nom: '', url: '', description_user: '', type_plateforme: '', submitted_by_email: '',
|
||||
})
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function validateField(field: string) {
|
||||
const partial = Schema.partial()
|
||||
const result = partial.safeParse({ [field]: (form as any)[field] })
|
||||
if (!result.success) {
|
||||
const fieldErrors = result.error.flatten().fieldErrors
|
||||
errors[field] = fieldErrors[field]?.[0] ?? ''
|
||||
} else {
|
||||
delete errors[field]
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(): boolean {
|
||||
const result = Schema.safeParse(form)
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach(k => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll()) {
|
||||
await nextTick()
|
||||
const firstError = document.querySelector('.field-error')
|
||||
firstError?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
submission_type: 'job',
|
||||
nom: form.nom,
|
||||
url: form.url,
|
||||
description_user: form.description_user,
|
||||
type_plateforme: form.type_plateforme || undefined,
|
||||
submitted_by_email: form.submitted_by_email || undefined,
|
||||
},
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
const fieldErrors = e.data
|
||||
Object.entries(fieldErrors).forEach(([k, v]) => { errors[k] = Array.isArray(v) ? v[0] : String(v) })
|
||||
serverError.value = 'Certains champs sont invalides — vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
</style>
|
||||
@@ -0,0 +1,310 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form proposer-form--libre" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.texte }">
|
||||
<label id="libre-liens-label">Tes liens <span class="label-hint">(1 ou plusieurs — sites, PDF, articles...)</span></label>
|
||||
<div class="liens-list" role="group" aria-labelledby="libre-liens-label">
|
||||
<div v-for="(lien, i) in liens" :key="i" class="lien-row">
|
||||
<input
|
||||
:id="`libre-lien-${i}`"
|
||||
v-model="liens[i]"
|
||||
type="url"
|
||||
inputmode="url"
|
||||
placeholder="https://..."
|
||||
autocomplete="off"
|
||||
@blur="validateAll(false)"
|
||||
/>
|
||||
<button
|
||||
v-if="liens.length > 1"
|
||||
type="button"
|
||||
class="lien-remove"
|
||||
:aria-label="`Retirer ce lien`"
|
||||
@click="removeLien(i)"
|
||||
>×</button>
|
||||
</div>
|
||||
</div>
|
||||
<button v-if="liens.length < 10" type="button" class="btn-add-lien" @click="addLien">+ un autre lien</button>
|
||||
<span v-if="errors.texte" id="libre-texte-error" class="error-msg" role="alert">{{ errors.texte }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="libre-texte">Pourquoi c'est utile, pour toi ? <span class="label-hint">(pas de format imposé)</span></label>
|
||||
<textarea
|
||||
id="libre-texte"
|
||||
v-model="texte"
|
||||
rows="4"
|
||||
placeholder="Dis-le avec tes mots : ce que ça t'a apporté, pourquoi tu le partages..."
|
||||
:aria-describedby="errors.texte ? 'libre-texte-error' : undefined"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label id="libre-type-label">Type suggéré <span class="label-hint">(optionnel — un ou deux si tu hésites)</span></label>
|
||||
<ChipGroup aria-label="Type suggéré" aria-describedby="libre-type-hint">
|
||||
<Chip
|
||||
v-for="t in TYPES_SUGGERES"
|
||||
:key="t"
|
||||
:label="TYPES_SUGGERES_LABELS[t]"
|
||||
variant="fonction"
|
||||
:active="typeSuggere === t || typeSecondaire === t"
|
||||
:class="{ 'chip--secondaire': typeSecondaire === t }"
|
||||
@toggle="toggleType(t)"
|
||||
/>
|
||||
</ChipGroup>
|
||||
<span id="libre-type-hint" class="label-hint">
|
||||
Écosystème : {{ TYPES_SUGGERES_HINTS.ecosysteme }} · Réseau : {{ TYPES_SUGGERES_HINTS.reseau }} · Jobs : {{ TYPES_SUGGERES_HINTS.jobs }} · Outils : {{ TYPES_SUGGERES_HINTS.outils }} · Références : {{ TYPES_SUGGERES_HINTS.references }} · Recette : {{ TYPES_SUGGERES_HINTS.recette }}
|
||||
</span>
|
||||
<!-- Distinction non visuelle premier choix / second choix pour lecteurs d'écran :
|
||||
les deux chips actifs partagent le même aria-pressed, sans quoi rien ne dit
|
||||
lequel est principal. -->
|
||||
<span class="sr-only" aria-live="polite">
|
||||
<template v-if="typeSuggere && typeSecondaire">
|
||||
Principal : {{ TYPES_SUGGERES_LABELS[typeSuggere] }} · second choix : {{ TYPES_SUGGERES_LABELS[typeSecondaire] }}
|
||||
</template>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="libre-email">Ton email <span class="label-hint">(optionnel — pour qu'on te tienne au courant)</span></label>
|
||||
<input
|
||||
id="libre-email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
placeholder="ton@email.fr"
|
||||
autocomplete="email"
|
||||
@blur="validateAll(false)"
|
||||
/>
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<!-- Honeypot anti-spam : caché visuellement et aux lecteurs d'écran, un bot le remplit. -->
|
||||
<div class="hp-field" aria-hidden="true">
|
||||
<label for="libre-site-web">Site web</label>
|
||||
<input id="libre-site-web" v-model="siteWeb" type="text" tabindex="-1" autocomplete="off" />
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert" aria-live="assertive">
|
||||
<strong>Erreur :</strong> {{ serverError }}
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">
|
||||
{{ submitting ? 'Envoi en cours...' : 'Proposer →' }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="form-note">Ta proposition sera examinée par l'équipe avant publication.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { LibreSubmitSchema, TYPES_SUGGERES, TYPES_SUGGERES_LABELS, TYPES_SUGGERES_HINTS, type TypeSuggere } from '~/utils/submitLibre'
|
||||
|
||||
const props = defineProps<{ presetType?: TypeSuggere }>()
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const liens = reactive<string[]>([''])
|
||||
const texte = ref('')
|
||||
const email = ref('')
|
||||
const typeSuggere = ref<TypeSuggere | undefined>(props.presetType)
|
||||
// Deuxième chip optionnelle (B5-M2b) — pour les indécis entre deux types.
|
||||
const typeSecondaire = ref<TypeSuggere | undefined>()
|
||||
const siteWeb = ref('') // honeypot
|
||||
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function addLien() {
|
||||
if (liens.length < 10) liens.push('')
|
||||
}
|
||||
|
||||
function removeLien(i: number) {
|
||||
liens.splice(i, 1)
|
||||
if (liens.length === 0) liens.push('')
|
||||
}
|
||||
|
||||
/**
|
||||
* Deux chips maximum. Premier clic = principal, deuxième = secondaire.
|
||||
* Décocher le principal alors qu'un secondaire existe promeut ce dernier.
|
||||
* Troisième clic sur un chip inactif quand deux sont déjà actifs : remplace
|
||||
* le secondaire par le nouveau chip (choix le plus simple — pas de file d'attente).
|
||||
*/
|
||||
function toggleType(t: TypeSuggere) {
|
||||
if (typeSuggere.value === t) {
|
||||
typeSuggere.value = typeSecondaire.value
|
||||
typeSecondaire.value = undefined
|
||||
return
|
||||
}
|
||||
if (typeSecondaire.value === t) {
|
||||
typeSecondaire.value = undefined
|
||||
return
|
||||
}
|
||||
if (typeSuggere.value === undefined) {
|
||||
typeSuggere.value = t
|
||||
} else if (typeSecondaire.value === undefined) {
|
||||
typeSecondaire.value = t
|
||||
} else {
|
||||
typeSecondaire.value = t
|
||||
}
|
||||
}
|
||||
|
||||
function currentPayload() {
|
||||
return {
|
||||
liens: liens.map((l) => l.trim()).filter(Boolean),
|
||||
texte: texte.value,
|
||||
submitted_by_email: email.value || undefined,
|
||||
type_suggere: typeSuggere.value,
|
||||
type_secondaire: typeSecondaire.value,
|
||||
site_web: siteWeb.value,
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(scrollToError = true): boolean {
|
||||
const result = LibreSubmitSchema.safeParse(currentPayload())
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.keys(errors).forEach((k) => delete errors[k])
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
if (scrollToError) {
|
||||
nextTick(() => {
|
||||
document.querySelector('.field-error')?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
})
|
||||
}
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach((k) => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll(true)) return
|
||||
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit', {
|
||||
method: 'POST',
|
||||
body: { mode: 'libre', ...currentPayload() },
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(e.data as Record<string, string[]>).map(([k, v]) => [k, Array.isArray(v) ? v[0] : String(v)])))
|
||||
serverError.value = 'Vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
|
||||
.liens-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.375rem;
|
||||
}
|
||||
.lien-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.lien-row input {
|
||||
flex: 1;
|
||||
padding: 0.625rem 0.875rem;
|
||||
border: 1px solid rgba(26, 34, 56, 0.2);
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
color: var(--nav-text);
|
||||
background: var(--nav-surface);
|
||||
font-family: inherit;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lien-row input:focus {
|
||||
outline: none;
|
||||
border-color: var(--nav-primary-solid);
|
||||
box-shadow: 0 0 0 2px rgba(245, 179, 66, 0.4);
|
||||
}
|
||||
.lien-remove {
|
||||
flex-shrink: 0;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border: 1px solid rgba(26, 34, 56, 0.2);
|
||||
background: transparent;
|
||||
border-radius: 6px;
|
||||
color: var(--nav-text-muted);
|
||||
font-size: 1.1rem;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
.lien-remove:hover {
|
||||
border-color: #c0392b;
|
||||
color: #c0392b;
|
||||
}
|
||||
.btn-add-lien {
|
||||
align-self: flex-start;
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.4rem 0.75rem;
|
||||
background: transparent;
|
||||
border: 1px dashed rgba(26, 34, 56, 0.3);
|
||||
border-radius: 6px;
|
||||
font-size: 0.8rem;
|
||||
color: var(--nav-text-muted);
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
}
|
||||
.btn-add-lien:hover {
|
||||
border-color: var(--nav-primary-solid);
|
||||
color: var(--nav-text);
|
||||
}
|
||||
|
||||
.hp-field {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── B5-M2c : distinction principal / second choix ──
|
||||
Le principal actif (fond plein, ≈14,6:1) et le survol gardé par
|
||||
@media (hover: hover) viennent de Chip.vue depuis AF5 : les surcharges
|
||||
locales de AF4 (principal plein, survol collant neutralisé sur tactile)
|
||||
ont été retirées. */
|
||||
|
||||
/* Chip secondaire (deuxième choix) : contour au lieu de plein, pour ne
|
||||
jamais se confondre avec le principal — ni à l'œil ni au clic. Texte
|
||||
--nav-text sur le fond de page : contraste très large (>10:1), stable
|
||||
dans tous les états. */
|
||||
.field-group :deep(.chip--secondaire.chip--active) {
|
||||
background: transparent !important;
|
||||
border-color: var(--nav-primary-solid) !important;
|
||||
color: var(--nav-text) !important;
|
||||
}
|
||||
/* Survol du secondaire : pointeur capable de survol seulement, comme Chip.vue
|
||||
(sur tactile, :hover reste collé après un tap). */
|
||||
@media (hover: hover) {
|
||||
.field-group :deep(.chip--secondaire.chip--active:hover) {
|
||||
background: rgba(var(--nav-primary-raw), 0.08) !important;
|
||||
border-color: var(--nav-primary-solid) !important;
|
||||
color: var(--nav-text) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,134 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.nom }">
|
||||
<label for="out-nom">Nom de l'outil <span class="required">*</span></label>
|
||||
<input id="out-nom" v-model="form.nom" type="text" placeholder="Ex : Simulateur Autonomie, FreeCAD..." @blur="validateField('nom')" />
|
||||
<span v-if="errors.nom" class="error-msg" role="alert">{{ errors.nom }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label>Catégorie <span class="label-hint">(optionnelle)</span></label>
|
||||
<div class="radio-group">
|
||||
<label v-for="c in CATEGORIES" :key="c" class="radio-label" :class="{ active: form.categorie === c }">
|
||||
<input type="radio" :value="c" v-model="form.categorie" name="out-categorie" />{{ LABELS[c] }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.url }">
|
||||
<label for="out-url">Site web / lien <span class="label-hint">(optionnel — si pas de lien direct)</span></label>
|
||||
<input id="out-url" v-model="form.url" type="url" placeholder="https://..." @blur="validateField('url')" />
|
||||
<span v-if="errors.url" class="error-msg" role="alert">{{ errors.url }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.description_user }">
|
||||
<label for="out-desc">Description courte <span class="required">*</span> <span class="label-hint">(50 à 500 caractères)</span></label>
|
||||
<textarea id="out-desc" v-model="form.description_user" rows="4" placeholder="Décris l'outil : à quoi il sert, pour quel usage, ce qui le rend utile..." @blur="validateField('description_user')" />
|
||||
<div class="field-meta">
|
||||
<span v-if="errors.description_user" class="error-msg" role="alert">{{ errors.description_user }}</span>
|
||||
<span v-else class="char-count" :class="{ 'char-warn': form.description_user.length > 450 }">{{ form.description_user.length }}/500</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="out-email">Ton email <span class="label-hint">(optionnel — pour le suivi)</span></label>
|
||||
<input id="out-email" v-model="form.submitted_by_email" type="email" placeholder="ton@email.fr" autocomplete="email" @blur="validateField('submitted_by_email')" />
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert"><strong>Erreur :</strong> {{ serverError }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">{{ submitting ? 'Envoi en cours...' : 'Proposer →' }}</button>
|
||||
</div>
|
||||
<p class="form-note">Ta proposition sera examinée par l'équipe avant publication.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { z } from 'zod'
|
||||
|
||||
const CATEGORIES = ['simulateur', 'logiciel', 'guide', 'autre'] as const
|
||||
const LABELS: Record<string, string> = { simulateur: 'Simulateur', logiciel: 'Logiciel / app', guide: 'Guide / ressource', autre: 'Autre' }
|
||||
|
||||
const Schema = z.object({
|
||||
nom: z.string().min(3, 'Minimum 3 caractères').max(150, 'Maximum 150 caractères').trim(),
|
||||
url: z.string().url('URL invalide').optional().or(z.literal('')),
|
||||
description_user: z.string().min(50, 'Minimum 50 caractères').max(500, 'Maximum 500 caractères').trim(),
|
||||
categorie: z.string().optional(),
|
||||
submitted_by_email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const form = reactive({
|
||||
nom: '', url: '', description_user: '', categorie: '', submitted_by_email: '',
|
||||
})
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function validateField(field: string) {
|
||||
const partial = Schema.partial()
|
||||
const result = partial.safeParse({ [field]: (form as any)[field] })
|
||||
if (!result.success) {
|
||||
const fieldErrors = result.error.flatten().fieldErrors
|
||||
errors[field] = fieldErrors[field]?.[0] ?? ''
|
||||
} else {
|
||||
delete errors[field]
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(): boolean {
|
||||
const result = Schema.safeParse(form)
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach(k => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll()) {
|
||||
await nextTick()
|
||||
const firstError = document.querySelector('.field-error')
|
||||
firstError?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
submission_type: 'outil',
|
||||
nom: form.nom,
|
||||
url: form.url || undefined,
|
||||
description_user: form.description_user,
|
||||
categorie: form.categorie || undefined,
|
||||
submitted_by_email: form.submitted_by_email || undefined,
|
||||
},
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
const fieldErrors = e.data
|
||||
Object.entries(fieldErrors).forEach(([k, v]) => { errors[k] = Array.isArray(v) ? v[0] : String(v) })
|
||||
serverError.value = 'Certains champs sont invalides — vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
</style>
|
||||
@@ -0,0 +1,142 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.titre }">
|
||||
<label for="ref-titre">Titre du livre / document <span class="required">*</span></label>
|
||||
<input id="ref-titre" v-model="form.titre" type="text" placeholder="Ex : Repenser l'architecture..." @blur="validateField('titre')" />
|
||||
<span v-if="errors.titre" class="error-msg" role="alert">{{ errors.titre }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.auteur }">
|
||||
<label for="ref-auteur">Auteur·ice(s) <span class="required">*</span></label>
|
||||
<input id="ref-auteur" v-model="form.auteur" type="text" placeholder="Ex : Philippe Rahm, Doina Petrescu..." @blur="validateField('auteur')" />
|
||||
<span v-if="errors.auteur" class="error-msg" role="alert">{{ errors.auteur }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.url }">
|
||||
<label for="ref-url">Lien <span class="label-hint">(optionnel — éditeur, статье, PDF…)</span></label>
|
||||
<input id="ref-url" v-model="form.url" type="url" placeholder="https://..." @blur="validateField('url')" />
|
||||
<span v-if="errors.url" class="error-msg" role="alert">{{ errors.url }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.description }">
|
||||
<label for="ref-desc">Description de l'ouvrage <span class="required">*</span> <span class="label-hint">(50 à 1000 caractères)</span></label>
|
||||
<textarea id="ref-desc" v-model="form.description" rows="4" placeholder="Présente l'ouvrage : thèse principale, approche, pourquoi c'est important..." @blur="validateField('description')" />
|
||||
<div class="field-meta">
|
||||
<span v-if="errors.description" class="error-msg" role="alert">{{ errors.description }}</span>
|
||||
<span v-else class="char-count" :class="{ 'char-warn': form.description.length > 900 }">{{ form.description.length }}/1000</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="ref-pertinence">Pertinence pour le RAG <span class="label-hint">(optionnel — en quoi cette référence est utile ?)</span></label>
|
||||
<textarea id="ref-pertinence" v-model="form.pertinence_rag" rows="2" placeholder="Ex : Excellente source sur l'architecture participative..." maxlength="500" />
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="ref-hashtags">Hashtags <span class="label-hint">(optionnel — séparés par des virgules)</span></label>
|
||||
<input id="ref-hashtags" v-model="form.hashtags" type="text" placeholder="Ex : écologie, participation, matériaux bio..." />
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="ref-email">Ton email <span class="label-hint">(optionnel — pour le suivi)</span></label>
|
||||
<input id="ref-email" v-model="form.submitted_by_email" type="email" placeholder="ton@email.fr" autocomplete="email" @blur="validateField('submitted_by_email')" />
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert"><strong>Erreur :</strong> {{ serverError }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">{{ submitting ? 'Envoi en cours...' : 'Proposer la référence →' }}</button>
|
||||
</div>
|
||||
<p class="form-note">Ta référence sera examinée avant d'être intégrée au fonds documentaire RAG.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { z } from 'zod'
|
||||
|
||||
const Schema = z.object({
|
||||
titre: z.string().min(3, 'Minimum 3 caractères').max(200, 'Maximum 200 caractères').trim(),
|
||||
auteur: z.string().min(2, 'Minimum 2 caractères').max(200, 'Maximum 200 caractères').trim(),
|
||||
url: z.string().url('URL invalide').optional().or(z.literal('')),
|
||||
description: z.string().min(50, 'Minimum 50 caractères').max(1000, 'Maximum 1000 caractères').trim(),
|
||||
pertinence_rag: z.string().max(500).optional(),
|
||||
hashtags: z.string().max(300).optional(),
|
||||
submitted_by_email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const form = reactive({
|
||||
titre: '', auteur: '', url: '', description: '',
|
||||
pertinence_rag: '', hashtags: '', submitted_by_email: '',
|
||||
})
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function validateField(field: string) {
|
||||
const partial = Schema.partial()
|
||||
const result = partial.safeParse({ [field]: (form as any)[field] })
|
||||
if (!result.success) {
|
||||
const fieldErrors = result.error.flatten().fieldErrors
|
||||
errors[field] = fieldErrors[field]?.[0] ?? ''
|
||||
} else {
|
||||
delete errors[field]
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(): boolean {
|
||||
const result = Schema.safeParse(form)
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach(k => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll()) {
|
||||
await nextTick()
|
||||
const firstError = document.querySelector('.field-error')
|
||||
firstError?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit/reference', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
titre: form.titre,
|
||||
auteur: form.auteur,
|
||||
url: form.url || undefined,
|
||||
description: form.description,
|
||||
pertinence_rag: form.pertinence_rag || undefined,
|
||||
hashtags: form.hashtags || undefined,
|
||||
submitted_by_email: form.submitted_by_email || undefined,
|
||||
},
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
const fieldErrors = e.data
|
||||
Object.entries(fieldErrors).forEach(([k, v]) => { errors[k] = Array.isArray(v) ? v[0] : String(v) })
|
||||
serverError.value = 'Certains champs sont invalides — vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
</style>
|
||||
@@ -0,0 +1,158 @@
|
||||
<template>
|
||||
<form @submit.prevent="submit" class="proposer-form" novalidate>
|
||||
<div class="field-group" :class="{ 'field-error': errors.nom }">
|
||||
<label for="res-nom">Nom du réseau / collectif / ressource <span class="required">*</span></label>
|
||||
<input id="res-nom" v-model="form.nom" type="text" placeholder="Ex : Collectif des Arpenteurs, Archi'Résilience..." @blur="validateField('nom')" />
|
||||
<span v-if="errors.nom" class="error-msg" role="alert">{{ errors.nom }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.type_principal }">
|
||||
<fieldset>
|
||||
<legend>Type <span class="label-hint">(optionnel)</span></legend>
|
||||
<div class="radio-group">
|
||||
<label v-for="t in TYPES" :key="t" class="radio-label" :class="{ active: form.type_principal === t }">
|
||||
<input type="radio" :value="t" v-model="form.type_principal" name="res-type" />{{ LABELS[t] }}
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.url }">
|
||||
<label for="res-url">Site web <span class="label-hint">(optionnel)</span></label>
|
||||
<input id="res-url" v-model="form.url" type="url" placeholder="https://..." @blur="validateField('url')" />
|
||||
<span v-if="errors.url" class="error-msg" role="alert">{{ errors.url }}</span>
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.description_user }">
|
||||
<label for="res-desc">Description courte <span class="required">*</span> <span class="label-hint">(50 à 500 caractères)</span></label>
|
||||
<textarea id="res-desc" v-model="form.description_user" rows="4" placeholder="Présente ce réseau/collectif : son objet, son échelle, ce qui le distingue..." @blur="validateField('description_user')" />
|
||||
<div class="field-meta">
|
||||
<span v-if="errors.description_user" class="error-msg" role="alert">{{ errors.description_user }}</span>
|
||||
<span v-else class="char-count" :class="{ 'char-warn': form.description_user.length > 450 }">{{ form.description_user.length }}/500</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="res-ville">Ville principale <span class="label-hint">(optionnel)</span></label>
|
||||
<input id="res-ville" v-model="form.localisation_ville" type="text" placeholder="Ex : Paris, Lyon..." />
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="res-projet-lien">Lien vers un projet / réalisation <span class="label-hint">(optionnel)</span></label>
|
||||
<input id="res-projet-lien" v-model="form.projet_lien" type="url" placeholder="https://..." />
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<label for="res-projet-adresse">Adresse du projet <span class="label-hint">(optionnel)</span></label>
|
||||
<input id="res-projet-adresse" v-model="form.projet_adresse" type="text" placeholder="Ex : 12 rue des Lilas, 75000 Paris" />
|
||||
</div>
|
||||
|
||||
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
|
||||
<label for="res-email">Ton email <span class="label-hint">(optionnel — pour le suivi)</span></label>
|
||||
<input id="res-email" v-model="form.submitted_by_email" type="email" placeholder="ton@email.fr" autocomplete="email" @blur="validateField('submitted_by_email')" />
|
||||
<span v-if="errors.submitted_by_email" class="error-msg" role="alert">{{ errors.submitted_by_email }}</span>
|
||||
</div>
|
||||
|
||||
<div v-if="serverError" class="server-error" role="alert"><strong>Erreur :</strong> {{ serverError }}</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="btn-primary" :disabled="submitting">{{ submitting ? 'Envoi en cours...' : 'Proposer →' }}</button>
|
||||
</div>
|
||||
<p class="form-note">Ta proposition sera examinée par l'équipe avant publication.</p>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { z } from 'zod'
|
||||
|
||||
const TYPES = ['agence', 'collectif', 'reseau', 'asso', 'ressource'] as const
|
||||
const LABELS: Record<string, string> = { agence: 'Agence', collectif: 'Collectif', reseau: 'Réseau', asso: 'Association', ressource: 'Ressource' }
|
||||
|
||||
const Schema = z.object({
|
||||
nom: z.string().min(3, 'Minimum 3 caractères').max(150, 'Maximum 150 caractères').trim(),
|
||||
type_principal: z.string().optional(),
|
||||
url: z.string().url('URL invalide').optional().or(z.literal('')),
|
||||
description_user: z.string().min(50, 'Minimum 50 caractères').max(500, 'Maximum 500 caractères').trim(),
|
||||
localisation_ville: z.string().max(100).optional(),
|
||||
projet_lien: z.string().url('URL invalide').optional().or(z.literal('')),
|
||||
projet_adresse: z.string().max(200).optional(),
|
||||
submitted_by_email: z.string().email('Email invalide').optional().or(z.literal('')),
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ success: [] }>()
|
||||
|
||||
const form = reactive({
|
||||
nom: '', type_principal: '', url: '', description_user: '',
|
||||
localisation_ville: '', projet_lien: '', projet_adresse: '', submitted_by_email: '',
|
||||
})
|
||||
const errors = reactive<Record<string, string>>({})
|
||||
const submitting = ref(false)
|
||||
const serverError = ref('')
|
||||
|
||||
function validateField(field: string) {
|
||||
const partial = Schema.partial()
|
||||
const result = partial.safeParse({ [field]: (form as any)[field] })
|
||||
if (!result.success) {
|
||||
const fieldErrors = result.error.flatten().fieldErrors
|
||||
errors[field] = fieldErrors[field]?.[0] ?? ''
|
||||
} else {
|
||||
delete errors[field]
|
||||
}
|
||||
}
|
||||
|
||||
function validateAll(): boolean {
|
||||
const result = Schema.safeParse(form)
|
||||
if (!result.success) {
|
||||
const flat = result.error.flatten().fieldErrors
|
||||
Object.assign(errors, Object.fromEntries(Object.entries(flat).map(([k, v]) => [k, v?.[0] ?? ''])))
|
||||
return false
|
||||
}
|
||||
Object.keys(errors).forEach(k => delete errors[k])
|
||||
return true
|
||||
}
|
||||
|
||||
async function submit() {
|
||||
serverError.value = ''
|
||||
if (!validateAll()) {
|
||||
await nextTick()
|
||||
const firstError = document.querySelector('.field-error')
|
||||
firstError?.scrollIntoView({ behavior: 'smooth', block: 'center' })
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await $fetch('/api/submit', {
|
||||
method: 'POST',
|
||||
body: {
|
||||
submission_type: 'reseau',
|
||||
nom: form.nom,
|
||||
type_principal: form.type_principal || undefined,
|
||||
url: form.url || undefined,
|
||||
description_user: form.description_user,
|
||||
localisation_ville: form.localisation_ville || undefined,
|
||||
projet_lien: form.projet_lien || undefined,
|
||||
projet_adresse: form.projet_adresse || undefined,
|
||||
submitted_by_email: form.submitted_by_email || undefined,
|
||||
},
|
||||
})
|
||||
emit('success')
|
||||
} catch (e: any) {
|
||||
const status = e?.status ?? e?.statusCode
|
||||
if (status === 429) {
|
||||
serverError.value = 'Tu as déjà soumis 3 fiches aujourd\'hui. Réessaie demain.'
|
||||
} else if (status === 422 && e?.data) {
|
||||
const fieldErrors = e.data
|
||||
Object.entries(fieldErrors).forEach(([k, v]) => { errors[k] = Array.isArray(v) ? v[0] : String(v) })
|
||||
serverError.value = 'Certains champs sont invalides — vérifie les erreurs ci-dessus.'
|
||||
} else {
|
||||
serverError.value = 'Une erreur s\'est produite. Réessaie dans quelques instants.'
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import './form-styles.css';
|
||||
</style>
|
||||
@@ -0,0 +1,886 @@
|
||||
<template>
|
||||
<div class="graph-view" style="width: 100%; height: 100%; position: relative; background: var(--nav-bg);">
|
||||
<!-- Canvas SVG pour D3 (zone centrale, marge droite pour sidebar) -->
|
||||
<svg
|
||||
ref="svgRef"
|
||||
:style="{
|
||||
width: sidebarOpen ? 'calc(100% - 200px)' : 'calc(100% - 40px)',
|
||||
height: '100%',
|
||||
transition: 'width 0.2s ease',
|
||||
}"
|
||||
></svg>
|
||||
|
||||
<!-- Sidebar droite (repliable) - 3 sections : AFFICHER / HASHTAGS / MODE D'EMPLOI -->
|
||||
<aside
|
||||
:style="{
|
||||
position: 'absolute', top: '0', right: '0', bottom: '0',
|
||||
width: sidebarOpen ? '200px' : '40px',
|
||||
background: 'var(--nav-surface)',
|
||||
borderLeft: '1px solid var(--nav-bg-alt)',
|
||||
display: 'flex', flexDirection: 'column',
|
||||
transition: 'width 0.2s ease',
|
||||
zIndex: 10,
|
||||
}"
|
||||
>
|
||||
<!-- Toggle (toujours visible) -->
|
||||
<button
|
||||
@click="sidebarOpen = !sidebarOpen"
|
||||
:title="sidebarOpen ? 'Replier la sidebar' : 'Deplier la sidebar'"
|
||||
style="
|
||||
width: 100%; height: 36px; flex-shrink: 0;
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
background: var(--nav-bg-alt); border: none; cursor: pointer;
|
||||
color: var(--nav-text-muted); font-size: 0.78rem; font-weight: 700;
|
||||
border-bottom: 1px solid var(--nav-bg-alt);
|
||||
"
|
||||
>{{ sidebarOpen ? '>>' : '<<' }}</button>
|
||||
|
||||
<!-- Mode replie : label vertical -->
|
||||
<div
|
||||
v-if="!sidebarOpen"
|
||||
style="
|
||||
flex: 1; display: flex; align-items: center; justify-content: center;
|
||||
writing-mode: vertical-rl; transform: rotate(180deg);
|
||||
font-size: 0.7rem; font-weight: 700; color: var(--nav-text-muted);
|
||||
letter-spacing: 0.12em; text-transform: uppercase;
|
||||
"
|
||||
>HASHTAGS ({{ activeHashtags.length }}/{{ props.allHashtags.length }})</div>
|
||||
|
||||
<!-- Mode deplie : 3 sections empilees -->
|
||||
<template v-if="sidebarOpen">
|
||||
<div style="flex: 1; overflow-y: auto; display: flex; flex-direction: column;">
|
||||
|
||||
<!-- SECTION 1 : AFFICHER (toggles familles / pratiques) -->
|
||||
<div style="padding: 10px 12px; flex-shrink: 0;">
|
||||
<div style="font-size: 0.72rem; font-weight: 700; color: var(--nav-text); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px;">Afficher</div>
|
||||
<label
|
||||
:style="{
|
||||
display: 'flex', alignItems: 'center', gap: '8px',
|
||||
padding: '7px 10px', marginBottom: '4px',
|
||||
borderRadius: '6px', cursor: 'pointer',
|
||||
fontSize: '0.82rem', fontWeight: 600,
|
||||
background: showFamilles ? 'var(--nav-bg-alt)' : 'transparent',
|
||||
color: showFamilles ? 'var(--nav-text)' : 'var(--nav-text-muted)',
|
||||
transition: 'all 0.12s',
|
||||
}"
|
||||
>
|
||||
<input type="checkbox" v-model="showFamilles" style="cursor: pointer; width: 14px; height: 14px;" />
|
||||
<span>Familles</span>
|
||||
</label>
|
||||
<label
|
||||
:style="{
|
||||
display: 'flex', alignItems: 'center', gap: '8px',
|
||||
padding: '7px 10px',
|
||||
borderRadius: '6px', cursor: 'pointer',
|
||||
fontSize: '0.82rem', fontWeight: 600,
|
||||
background: showPratiques ? 'var(--nav-bg-alt)' : 'transparent',
|
||||
color: showPratiques ? 'var(--nav-text)' : 'var(--nav-text-muted)',
|
||||
transition: 'all 0.12s',
|
||||
}"
|
||||
>
|
||||
<input type="checkbox" v-model="showPratiques" style="cursor: pointer; width: 14px; height: 14px;" />
|
||||
<span>Pratiques</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- SECTION 2 : HASHTAGS (chips groupees) -->
|
||||
<div style="border-top: 1px solid var(--nav-bg-alt); margin-top: 0; padding: 10px 12px 8px; flex-shrink: 0;">
|
||||
<div style="display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px;">
|
||||
<span style="font-size: 0.72rem; font-weight: 700; color: var(--nav-text); text-transform: uppercase; letter-spacing: 0.08em;">Hashtags</span>
|
||||
<span style="font-size: 0.68rem; color: var(--nav-text-muted);">{{ activeHashtags.length }} actif{{ activeHashtags.length > 1 ? 's' : '' }}</span>
|
||||
</div>
|
||||
<button
|
||||
v-if="activeHashtags.length"
|
||||
@click="activeHashtags = []"
|
||||
style="margin-bottom: 6px; font-size: 0.68rem; color: var(--nav-text-muted); background: none; border: none; cursor: pointer; text-decoration: underline; padding: 0;"
|
||||
>Tout effacer</button>
|
||||
</div>
|
||||
|
||||
<div style="flex: 1; overflow-y: auto; padding: 0 10px 10px;">
|
||||
<div
|
||||
v-for="group in hashtagsByFamille"
|
||||
:key="group.famille"
|
||||
style="margin-bottom: 10px;"
|
||||
>
|
||||
<div
|
||||
:style="{
|
||||
fontSize: '0.65rem', fontWeight: 700,
|
||||
color: group.color, textTransform: 'uppercase',
|
||||
letterSpacing: '0.06em', marginBottom: '4px',
|
||||
paddingLeft: '2px',
|
||||
}"
|
||||
>{{ group.label }}</div>
|
||||
<div style="display: flex; flex-wrap: wrap; gap: 3px;">
|
||||
<span
|
||||
v-for="tag in group.tags"
|
||||
:key="tag"
|
||||
style="padding: 2px 7px; border-radius: 9999px; font-size: 0.66rem; cursor: pointer; transition: all 0.12s;"
|
||||
:style="activeHashtags.includes(tag)
|
||||
? `background: ${group.color}; color: white; font-weight: 600;`
|
||||
: 'background: var(--nav-bg-alt); color: var(--nav-text-muted);'"
|
||||
@click="toggleHashtag(tag)"
|
||||
>{{ tag }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SECTION 3 : MODE D'EMPLOI -->
|
||||
<div style="border-top: 1px solid var(--nav-bg-alt); padding: 10px 12px; flex-shrink: 0;">
|
||||
<div style="font-size: 0.72rem; font-weight: 700; color: var(--nav-text); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px;">Mode d'emploi</div>
|
||||
<div style="font-size: 0.7rem; color: var(--nav-text-muted); line-height: 1.5;">
|
||||
La carte croise des familles editoriales avec des pratiques (hashtags). Coche les couches a afficher, filtre par hashtag, clique sur un noeud pour en savoir plus.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
|
||||
<!-- Tooltip -->
|
||||
<div ref="tooltipRef" style="
|
||||
position: absolute; pointer-events: none;
|
||||
background: var(--nav-surface); border: 1px solid var(--nav-bg-alt);
|
||||
border-radius: 6px; padding: 8px 12px; font-size: 0.78rem;
|
||||
color: var(--nav-text); max-width: 220px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
opacity: 0; transition: opacity 0.15s; z-index: 100;
|
||||
"></div>
|
||||
|
||||
<!-- Popover unifie (famille OU hashtag) -->
|
||||
<div
|
||||
v-if="popover.open"
|
||||
:style="{
|
||||
position: 'absolute',
|
||||
left: popover.x + 'px',
|
||||
top: popover.y + 'px',
|
||||
background: 'var(--nav-surface)',
|
||||
border: '1px solid var(--nav-bg-alt)',
|
||||
borderRadius: '8px',
|
||||
padding: '12px 14px',
|
||||
maxWidth: '280px',
|
||||
boxShadow: '0 6px 18px rgba(0,0,0,0.18)',
|
||||
zIndex: 50,
|
||||
}"
|
||||
@click.stop
|
||||
>
|
||||
<button
|
||||
@click="closePopover"
|
||||
style="
|
||||
position: absolute; top: 4px; right: 6px;
|
||||
background: none; border: none; cursor: pointer;
|
||||
font-size: 1rem; color: var(--nav-text-muted); padding: 2px 6px;
|
||||
line-height: 1;
|
||||
"
|
||||
title="Fermer"
|
||||
>x</button>
|
||||
<div
|
||||
:style="{
|
||||
fontWeight: 700, fontSize: '0.92rem',
|
||||
color: popover.color, marginBottom: '6px',
|
||||
paddingRight: '14px',
|
||||
}"
|
||||
>{{ popover.title }}</div>
|
||||
|
||||
<!-- Body famille : description + compteur + 6 structures + bouton "Voir toutes" -->
|
||||
<div v-if="popover.kind === 'famille'">
|
||||
<div style="font-size: 0.78rem; line-height: 1.45; color: var(--nav-text); margin-bottom: 10px;">
|
||||
{{ popover.body }}
|
||||
</div>
|
||||
<div style="font-size: 0.72rem; color: var(--nav-text-muted); margin-bottom: 6px;">
|
||||
{{ popover.structures.length }} structure{{ popover.structures.length > 1 ? 's' : '' }} dans cette famille
|
||||
</div>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px;">
|
||||
<li
|
||||
v-for="s in popover.structures.slice(0, 6)"
|
||||
:key="s.id"
|
||||
@click="selectStructureFromPopover(s.id)"
|
||||
style="
|
||||
font-size: 0.78rem; color: var(--nav-text);
|
||||
padding: 4px 6px; border-radius: 4px;
|
||||
cursor: pointer; transition: background 0.1s;
|
||||
display: flex; align-items: center; gap: 6px;
|
||||
"
|
||||
@mouseenter="(e: any) => e.currentTarget.style.background = 'var(--nav-bg-alt)'"
|
||||
@mouseleave="(e: any) => e.currentTarget.style.background = 'transparent'"
|
||||
>
|
||||
<span
|
||||
style="width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;"
|
||||
:style="`background: ${popover.color};`"
|
||||
/>
|
||||
<span>{{ s.nom }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<button
|
||||
v-if="popover.familleId != null"
|
||||
@click="openFicheFamilleFromPopover"
|
||||
style="
|
||||
margin-top: 10px; width: 100%;
|
||||
padding: 7px 10px; border-radius: 6px;
|
||||
background: var(--nav-bg-alt); border: none;
|
||||
font-size: 0.75rem; font-weight: 600; cursor: pointer;
|
||||
color: var(--nav-text); transition: opacity 0.12s;
|
||||
text-align: left;
|
||||
"
|
||||
@mouseenter="(e: any) => e.currentTarget.style.opacity = '0.7'"
|
||||
@mouseleave="(e: any) => e.currentTarget.style.opacity = '1'"
|
||||
>Voir toutes les {{ popover.structures.length }} pratiques -></button>
|
||||
</div>
|
||||
|
||||
<!-- Body hashtag : ligne generique + compteur + liste structures cliquables -->
|
||||
<div v-else-if="popover.kind === 'hashtag'">
|
||||
<div
|
||||
style="
|
||||
font-size: 0.72rem; color: var(--nav-text-muted);
|
||||
font-style: italic; margin-bottom: 8px; line-height: 1.4;
|
||||
"
|
||||
>Pratique transversale - portee par {{ popover.structures.length }} structure{{ popover.structures.length > 1 ? 's' : '' }} de {{ popover.famillesCount }} famille{{ popover.famillesCount > 1 ? 's' : '' }}</div>
|
||||
<ul style="list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 3px;">
|
||||
<li
|
||||
v-for="s in popover.structures.slice(0, 6)"
|
||||
:key="s.id"
|
||||
@click="selectStructureFromPopover(s.id)"
|
||||
style="
|
||||
font-size: 0.78rem; color: var(--nav-text);
|
||||
padding: 4px 6px; border-radius: 4px;
|
||||
cursor: pointer; transition: background 0.1s;
|
||||
"
|
||||
@mouseenter="(e: any) => e.currentTarget.style.background = 'var(--nav-bg-alt)'"
|
||||
@mouseleave="(e: any) => e.currentTarget.style.background = 'transparent'"
|
||||
>{{ s.nom }}</li>
|
||||
</ul>
|
||||
<div
|
||||
v-if="popover.structures.length > 6"
|
||||
style="font-size: 0.7rem; color: var(--nav-text-muted); margin-top: 6px; padding-left: 6px;"
|
||||
>+ {{ popover.structures.length - 6 }} autre{{ popover.structures.length - 6 > 1 ? 's' : '' }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Fiche famille modale -->
|
||||
<FicheFamilleModal
|
||||
v-model="ficheFamilleOpen"
|
||||
:famille-id="ficheFamilleId"
|
||||
:data="props.data"
|
||||
@select-structure="(id) => emit('select-structure', id)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ReseauxBifurcationData } from '~/types/structure-v2'
|
||||
|
||||
const props = defineProps<{
|
||||
data: ReseauxBifurcationData | null
|
||||
allHashtags: string[]
|
||||
active?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'select-structure': [id: string]
|
||||
}>()
|
||||
|
||||
const svgRef = ref<SVGElement | null>(null)
|
||||
const tooltipRef = ref<HTMLElement | null>(null)
|
||||
|
||||
// Hashtag filter
|
||||
const activeHashtags = ref<string[]>([])
|
||||
const sidebarOpen = ref(true)
|
||||
|
||||
// Layers superposables (remplace viewMode exclusif PV2-5e)
|
||||
const showFamilles = ref(true)
|
||||
const showPratiques = ref(false)
|
||||
|
||||
function toggleHashtag(tag: string) {
|
||||
activeHashtags.value = activeHashtags.value.includes(tag)
|
||||
? activeHashtags.value.filter(t => t !== tag)
|
||||
: [...activeHashtags.value, tag]
|
||||
}
|
||||
|
||||
// Popover unifie (famille | hashtag)
|
||||
type PopoverState = {
|
||||
open: boolean
|
||||
kind: 'famille' | 'hashtag' | null
|
||||
x: number
|
||||
y: number
|
||||
title: string
|
||||
body: string
|
||||
color: string
|
||||
structures: { id: string; nom: string }[]
|
||||
familleId: number | null
|
||||
famillesCount: number
|
||||
}
|
||||
|
||||
const popover = ref<PopoverState>({
|
||||
open: false,
|
||||
kind: null,
|
||||
x: 0,
|
||||
y: 0,
|
||||
title: '',
|
||||
body: '',
|
||||
color: '#000',
|
||||
structures: [],
|
||||
familleId: null,
|
||||
famillesCount: 0,
|
||||
})
|
||||
|
||||
// Fiche famille modale
|
||||
const ficheFamilleOpen = ref(false)
|
||||
const ficheFamilleId = ref<number | null>(null)
|
||||
|
||||
function closePopover() {
|
||||
popover.value.open = false
|
||||
popover.value.kind = null
|
||||
}
|
||||
|
||||
function selectStructureFromPopover(id: string) {
|
||||
closePopover()
|
||||
emit('select-structure', id)
|
||||
}
|
||||
|
||||
function openFicheFamilleFromPopover() {
|
||||
if (popover.value.familleId == null) return
|
||||
ficheFamilleId.value = popover.value.familleId
|
||||
ficheFamilleOpen.value = true
|
||||
closePopover()
|
||||
}
|
||||
|
||||
// Mapping hashtag -> famille majoritaire
|
||||
// En cas d'egalite : prendre la famille la plus petite (visibilite minoritaires)
|
||||
const tagToFamille = computed<Record<string, number>>(() => {
|
||||
if (!props.data) return {}
|
||||
const counts: Record<string, Record<number, number>> = {}
|
||||
props.data.structures.forEach(s => {
|
||||
s.hashtags.forEach(tag => {
|
||||
if (!counts[tag]) counts[tag] = {}
|
||||
counts[tag][s.famille_principale] = (counts[tag][s.famille_principale] ?? 0) + 1
|
||||
})
|
||||
})
|
||||
const familleSize: Record<number, number> = {}
|
||||
props.data.structures.forEach(s => {
|
||||
familleSize[s.famille_principale] = (familleSize[s.famille_principale] ?? 0) + 1
|
||||
})
|
||||
const out: Record<string, number> = {}
|
||||
for (const tag in counts) {
|
||||
const entries = Object.entries(counts[tag])
|
||||
entries.sort((a, b) => {
|
||||
const diff = (b[1] as number) - (a[1] as number)
|
||||
if (diff !== 0) return diff
|
||||
return (familleSize[Number(a[0])] ?? 0) - (familleSize[Number(b[0])] ?? 0)
|
||||
})
|
||||
out[tag] = Number(entries[0][0])
|
||||
}
|
||||
return out
|
||||
})
|
||||
|
||||
const hashtagsByFamille = computed(() => {
|
||||
if (!props.data) return []
|
||||
const map = tagToFamille.value
|
||||
const groups: Record<number, string[]> = {}
|
||||
props.allHashtags.forEach(tag => {
|
||||
const fam = map[tag]
|
||||
if (fam == null) return
|
||||
if (!groups[fam]) groups[fam] = []
|
||||
groups[fam].push(tag)
|
||||
})
|
||||
return [1, 2, 3, 4, 5, 6]
|
||||
.filter(famId => groups[famId]?.length)
|
||||
.map(famId => ({
|
||||
famille: famId,
|
||||
label: FAMILLE_LABELS[famId],
|
||||
color: FAMILLE_COLORS[famId],
|
||||
tags: groups[famId].sort(),
|
||||
}))
|
||||
})
|
||||
|
||||
// Structures portant un hashtag donne (pour popover)
|
||||
function structuresForHashtag(tag: string): { id: string; nom: string }[] {
|
||||
if (!props.data) return []
|
||||
return props.data.structures
|
||||
.filter(s => s.hashtags.includes(tag))
|
||||
.map(s => ({ id: s.id, nom: s.nom }))
|
||||
}
|
||||
|
||||
// IDs de structures correspondant aux hashtags actifs
|
||||
const filteredStructureIds = computed(() => {
|
||||
if (!props.data || !activeHashtags.value.length) return null
|
||||
const ids = new Set(
|
||||
props.data.structures
|
||||
.filter(s => activeHashtags.value.every(h => s.hashtags.includes(h)))
|
||||
.map(s => s.id)
|
||||
)
|
||||
return ids
|
||||
})
|
||||
|
||||
const FAMILLE_COLORS: Record<number, string> = {
|
||||
1: '#a85d3e',
|
||||
2: '#c4a472',
|
||||
3: '#d4a017',
|
||||
4: '#5a7a4a',
|
||||
5: '#3d6a8c',
|
||||
6: '#6b3fa0',
|
||||
}
|
||||
|
||||
const FAMILLE_LABELS: Record<number, string> = {
|
||||
1: 'Reemploi',
|
||||
2: 'Frugalite',
|
||||
3: 'Social',
|
||||
4: 'Collectifs',
|
||||
5: 'Urbanisme',
|
||||
6: 'Recherche',
|
||||
}
|
||||
|
||||
const FAMILLE_DESCRIPTIONS: Record<number, string> = {
|
||||
1: "Structures dont le geste premier est de travailler avec la matiere existante : deconstruction selective, plateformes de redistribution, filieres biosourcees et geosourcees.",
|
||||
2: "Pratiques qui partent du principe qu'on peut faire mieux avec moins. Renovation profonde, materiaux locaux, sobriete choisie.",
|
||||
3: "Structures dont le terrain premier est le mal-logement, la precarite, l'hospitalite. Architecture comme reponse a l'urgence sociale.",
|
||||
4: "Structures qui accompagnent les projets collectifs : cooperatives d'habitat, ecovillages, accompagnement vers l'autogestion ou la renovation.",
|
||||
5: "Demarches a l'echelle du territoire : villes en transition, PLU alternatifs, coalitions territoriales.",
|
||||
6: "Recherche-action et production de contre-savoirs (Forensic Architecture, Rural Studio, PEROU, Centrala). Badge transversal aux familles.",
|
||||
}
|
||||
|
||||
let simulation: any = null
|
||||
let d3NodeSelection: any = null
|
||||
let d3LinkSelection: any = null
|
||||
|
||||
async function initGraph() {
|
||||
if (!svgRef.value || !props.data) return
|
||||
|
||||
const d3 = await import('d3')
|
||||
|
||||
const svgEl = svgRef.value
|
||||
const width = svgEl.clientWidth || 800
|
||||
const height = svgEl.clientHeight || 600
|
||||
|
||||
// Nettoyer
|
||||
d3.select(svgEl).selectAll('*').remove()
|
||||
closePopover()
|
||||
|
||||
const svg = d3.select(svgEl)
|
||||
.attr('viewBox', `0 0 ${width} ${height}`)
|
||||
|
||||
// Click sur le SVG vide -> fermer popover
|
||||
svg.on('click', (event: any) => {
|
||||
if (event.target === svgEl) closePopover()
|
||||
})
|
||||
|
||||
// Groupe principal avec zoom
|
||||
const g = svg.append('g')
|
||||
const zoomBehavior = d3.zoom<SVGElement, unknown>()
|
||||
.scaleExtent([0.2, 4])
|
||||
.on('zoom', (event) => {
|
||||
g.attr('transform', event.transform)
|
||||
closePopover()
|
||||
})
|
||||
|
||||
svg.call(zoomBehavior as any)
|
||||
|
||||
const { allNodes, links } = buildNodesLinks(width, height)
|
||||
|
||||
// Simulation force-directed
|
||||
if (simulation) simulation.stop()
|
||||
|
||||
// Adapter la charge selon le nombre de noeuds (mode "tout coche" = plus de repulsion)
|
||||
const heavyMode = showPratiques.value && allNodes.length > 150
|
||||
|
||||
simulation = d3.forceSimulation(allNodes)
|
||||
.force('link', d3.forceLink(links).id((d: any) => d.id)
|
||||
.distance((d: any) => {
|
||||
if (d.type === 'practice') return 90
|
||||
return d.type === 'primary' ? 80 : 120
|
||||
})
|
||||
.strength((d: any) => d.strength ?? 0.5))
|
||||
.force('charge', d3.forceManyBody().strength(heavyMode ? -80 : -120))
|
||||
.force('center', d3.forceCenter(width / 2, height / 2))
|
||||
.force('collision', d3.forceCollide().radius((d: any) => d.r + 4))
|
||||
|
||||
// Rendu liens
|
||||
d3LinkSelection = g.append('g').selectAll('line')
|
||||
.data(links)
|
||||
.join('line')
|
||||
.attr('stroke', (d: any) => {
|
||||
if (d.type === 'practice') return 'rgba(150,150,150,0.25)'
|
||||
return d.type === 'primary' ? 'rgba(150,150,150,0.45)' : 'rgba(150,150,150,0.35)'
|
||||
})
|
||||
.attr('stroke-width', 1.5)
|
||||
.attr('stroke-dasharray', null)
|
||||
|
||||
// Rendu noeuds (groupes g)
|
||||
d3NodeSelection = g.append('g').selectAll('g')
|
||||
.data(allNodes)
|
||||
.join('g')
|
||||
.style('cursor', (d: any) => {
|
||||
if (d.type === 'structure') return 'pointer'
|
||||
if (d.type === 'family') return 'pointer'
|
||||
if (d.type === 'hashtag') return 'pointer'
|
||||
return 'default'
|
||||
})
|
||||
.call(
|
||||
d3.drag<any, any>()
|
||||
.on('start', (event: any, d: any) => {
|
||||
if (!event.active) simulation.alphaTarget(0.3).restart()
|
||||
d.fx = d.x
|
||||
d.fy = d.y
|
||||
closePopover()
|
||||
})
|
||||
.on('drag', (event: any, d: any) => {
|
||||
d.fx = event.x
|
||||
d.fy = event.y
|
||||
})
|
||||
.on('end', (event: any, d: any) => {
|
||||
if (!event.active) simulation.alphaTarget(0)
|
||||
if (d.type !== 'family') {
|
||||
d.fx = null
|
||||
d.fy = null
|
||||
}
|
||||
})
|
||||
)
|
||||
.on('click', (event: any, d: any) => {
|
||||
event.stopPropagation()
|
||||
if (d.type === 'structure') {
|
||||
emit('select-structure', d.id)
|
||||
} else if (d.type === 'family') {
|
||||
openFamillePopover(d, event, svgEl)
|
||||
} else if (d.type === 'hashtag') {
|
||||
openHashtagPopover(d, event, svgEl)
|
||||
}
|
||||
})
|
||||
|
||||
// Cercles
|
||||
d3NodeSelection.append('circle')
|
||||
.attr('r', (d: any) => d.r)
|
||||
.attr('fill', (d: any) => {
|
||||
if (d.type === 'family') return d.color
|
||||
if (d.type === 'hashtag') return d.fill
|
||||
return d.color + 'cc'
|
||||
})
|
||||
.attr('stroke', (d: any) => {
|
||||
if (d.type === 'family') return 'white'
|
||||
if (d.type === 'hashtag') return d.stroke
|
||||
return d.color
|
||||
})
|
||||
.attr('stroke-width', (d: any) => {
|
||||
if (d.type === 'family') return 3
|
||||
if (d.type === 'hashtag') return 2
|
||||
return 1.5
|
||||
})
|
||||
|
||||
// Labels familles
|
||||
d3NodeSelection.filter((d: any) => d.type === 'family')
|
||||
.append('text')
|
||||
.text((d: any) => d.label)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dy', '0.35em')
|
||||
.attr('font-size', '11px')
|
||||
.attr('font-weight', '700')
|
||||
.attr('fill', 'white')
|
||||
.style('pointer-events', 'none')
|
||||
|
||||
// Labels hashtags : texte noir sur fond clair, tronque a 12 caracteres
|
||||
d3NodeSelection.filter((d: any) => d.type === 'hashtag')
|
||||
.append('text')
|
||||
.text((d: any) => {
|
||||
const raw = d.label as string
|
||||
return raw.length > 12 ? raw.slice(0, 12) + '...' : raw
|
||||
})
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dy', '0.35em')
|
||||
.attr('font-size', '9px')
|
||||
.attr('font-weight', '600')
|
||||
.attr('fill', '#2a2a2a')
|
||||
.style('pointer-events', 'none')
|
||||
|
||||
// Labels structures : nom au-dessus du cercle, halo pour lisibilite
|
||||
d3NodeSelection.filter((d: any) => d.type === 'structure')
|
||||
.append('text')
|
||||
.attr('class', 'graph-struct-label')
|
||||
.text((d: any) => {
|
||||
const raw = d.label as string
|
||||
return raw.length > 22 ? raw.slice(0, 20) + '…' : raw
|
||||
})
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('dy', (d: any) => -(d.r + 5))
|
||||
.attr('font-size', '9.5px')
|
||||
.attr('font-weight', '500')
|
||||
.style('pointer-events', 'none')
|
||||
|
||||
// Tooltip hover pour structures
|
||||
d3NodeSelection.filter((d: any) => d.type === 'structure')
|
||||
.on('mouseenter', (_event: any, d: any) => {
|
||||
if (!tooltipRef.value) return
|
||||
tooltipRef.value.style.opacity = '1'
|
||||
tooltipRef.value.innerHTML = `<strong>${d.label}</strong><br><span style="opacity:0.6;font-size:0.7rem;">${FAMILLE_LABELS[d.famille] ?? ''}</span>`
|
||||
})
|
||||
.on('mousemove', (event: any) => {
|
||||
if (!tooltipRef.value || !svgEl) return
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
tooltipRef.value.style.left = (event.clientX - rect.left + 12) + 'px'
|
||||
tooltipRef.value.style.top = (event.clientY - rect.top - 10) + 'px'
|
||||
})
|
||||
.on('mouseleave', () => {
|
||||
if (tooltipRef.value) tooltipRef.value.style.opacity = '0'
|
||||
})
|
||||
|
||||
// Tick - mise a jour positions
|
||||
simulation.on('tick', () => {
|
||||
d3LinkSelection
|
||||
.attr('x1', (d: any) => d.source.x)
|
||||
.attr('y1', (d: any) => d.source.y)
|
||||
.attr('x2', (d: any) => d.target.x)
|
||||
.attr('y2', (d: any) => d.target.y)
|
||||
|
||||
d3NodeSelection.attr('transform', (d: any) => `translate(${d.x},${d.y})`)
|
||||
|
||||
// Surlignage selon hashtags actifs
|
||||
applyHashtagFilter()
|
||||
})
|
||||
}
|
||||
|
||||
function buildNodesLinks(width: number, height: number) {
|
||||
const allNodes: any[] = []
|
||||
const links: any[] = []
|
||||
|
||||
if (!props.data) return { allNodes, links }
|
||||
|
||||
const tagFamilleMap = tagToFamille.value
|
||||
|
||||
// Noeuds structures (toujours presents)
|
||||
const structureNodes = props.data.structures.map(s => ({
|
||||
id: s.id,
|
||||
type: 'structure',
|
||||
label: s.nom,
|
||||
famille: s.famille_principale,
|
||||
familles_secondaires: s.familles_secondaires ?? [],
|
||||
hashtags: s.hashtags,
|
||||
color: FAMILLE_COLORS[s.famille_principale] ?? '#888',
|
||||
r: 8,
|
||||
}))
|
||||
allNodes.push(...structureNodes)
|
||||
|
||||
// Layer Familles : 6 noeuds famille fixes en etoile + liens primaires/secondaires
|
||||
if (showFamilles.value) {
|
||||
const familyNodes = [1, 2, 3, 4, 5, 6].map(id => ({
|
||||
id: `family-${id}`,
|
||||
type: 'family',
|
||||
familleId: id,
|
||||
label: FAMILLE_LABELS[id],
|
||||
color: FAMILLE_COLORS[id],
|
||||
r: 32,
|
||||
x: width / 2 + Math.cos((id - 1) * Math.PI * 2 / 6) * 180,
|
||||
y: height / 2 + Math.sin((id - 1) * Math.PI * 2 / 6) * 180,
|
||||
fx: width / 2 + Math.cos((id - 1) * Math.PI * 2 / 6) * 180,
|
||||
fy: height / 2 + Math.sin((id - 1) * Math.PI * 2 / 6) * 180,
|
||||
}))
|
||||
allNodes.push(...familyNodes)
|
||||
|
||||
structureNodes.forEach(s => {
|
||||
links.push({
|
||||
source: s.id,
|
||||
target: `family-${s.famille}`,
|
||||
type: 'primary',
|
||||
strength: 0.55,
|
||||
})
|
||||
;(s.familles_secondaires as number[]).forEach((f: number) => {
|
||||
links.push({
|
||||
source: s.id,
|
||||
target: `family-${f}`,
|
||||
type: 'secondary',
|
||||
strength: 0.45,
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Layer Pratiques : noeuds hashtag + liens structure -> hashtag
|
||||
if (showPratiques.value) {
|
||||
const uniqueTags = new Set<string>()
|
||||
props.data.structures.forEach(s => s.hashtags.forEach(t => uniqueTags.add(t)))
|
||||
const tagsArr = Array.from(uniqueTags).sort()
|
||||
|
||||
// Si seul layer Pratiques actif : disposition radiale comme reference
|
||||
// Si superpose avec Familles : laisser la simulation placer
|
||||
const radius = Math.min(width, height) * 0.32
|
||||
const hashtagNodes = tagsArr.map((tag, i) => {
|
||||
const famId = tagFamilleMap[tag]
|
||||
const strokeColor = famId != null ? FAMILLE_COLORS[famId] : '#888'
|
||||
const node: any = {
|
||||
id: `hashtag-${tag}`,
|
||||
type: 'hashtag',
|
||||
label: tag.startsWith('#') ? tag.slice(1) : tag,
|
||||
tag,
|
||||
fill: 'var(--nav-bg-alt)',
|
||||
stroke: strokeColor,
|
||||
color: strokeColor,
|
||||
r: 22,
|
||||
}
|
||||
if (!showFamilles.value) {
|
||||
const angle = (i / tagsArr.length) * Math.PI * 2
|
||||
node.x = width / 2 + Math.cos(angle) * radius
|
||||
node.y = height / 2 + Math.sin(angle) * radius
|
||||
}
|
||||
return node
|
||||
})
|
||||
allNodes.push(...hashtagNodes)
|
||||
|
||||
structureNodes.forEach(s => {
|
||||
s.hashtags.forEach(tag => {
|
||||
if (uniqueTags.has(tag)) {
|
||||
links.push({
|
||||
source: s.id,
|
||||
target: `hashtag-${tag}`,
|
||||
type: 'practice',
|
||||
strength: 0.3,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return { allNodes, links }
|
||||
}
|
||||
|
||||
function clampPopoverPosition(rect: DOMRect, evtX: number, evtY: number, w = 280, h = 180) {
|
||||
const margin = 12
|
||||
let x = evtX - rect.left + 14
|
||||
let y = evtY - rect.top + 10
|
||||
if (x + w > rect.width - margin) {
|
||||
x = Math.max(margin, rect.width - w - margin)
|
||||
}
|
||||
if (y + h > rect.height - margin) {
|
||||
y = Math.max(margin, rect.height - h - margin)
|
||||
}
|
||||
return { x, y }
|
||||
}
|
||||
|
||||
function structuresForFamille(famId: number): { id: string; nom: string }[] {
|
||||
if (!props.data) return []
|
||||
return props.data.structures
|
||||
.filter(s =>
|
||||
s.famille_principale === famId
|
||||
|| (s.familles_secondaires ?? []).includes(famId)
|
||||
)
|
||||
.sort((a, b) => a.nom.localeCompare(b.nom, 'fr'))
|
||||
.map(s => ({ id: s.id, nom: s.nom }))
|
||||
}
|
||||
|
||||
function openFamillePopover(d: any, event: any, svgEl: SVGElement) {
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
const famId = d.familleId as number
|
||||
const desc = FAMILLE_DESCRIPTIONS[famId] ?? ''
|
||||
const structures = structuresForFamille(famId)
|
||||
const { x, y } = clampPopoverPosition(rect, event.clientX, event.clientY, 280, 280)
|
||||
popover.value = {
|
||||
open: true,
|
||||
kind: 'famille',
|
||||
x,
|
||||
y,
|
||||
title: FAMILLE_LABELS[famId] ?? '',
|
||||
body: desc,
|
||||
color: FAMILLE_COLORS[famId] ?? '#000',
|
||||
structures,
|
||||
familleId: famId,
|
||||
famillesCount: 0,
|
||||
}
|
||||
}
|
||||
|
||||
function openHashtagPopover(d: any, event: any, svgEl: SVGElement) {
|
||||
const rect = (svgEl as HTMLElement).getBoundingClientRect()
|
||||
const tag = d.tag as string
|
||||
const structures = structuresForHashtag(tag)
|
||||
const famId = tagToFamille.value[tag]
|
||||
const color = famId != null ? FAMILLE_COLORS[famId] : '#444'
|
||||
// Compter les familles distinctes parmi les porteuses (famille_principale)
|
||||
const famSet = new Set<number>()
|
||||
if (props.data) {
|
||||
props.data.structures
|
||||
.filter(s => s.hashtags.includes(tag))
|
||||
.forEach(s => famSet.add(s.famille_principale))
|
||||
}
|
||||
const { x, y } = clampPopoverPosition(rect, event.clientX, event.clientY, 280, 220)
|
||||
popover.value = {
|
||||
open: true,
|
||||
kind: 'hashtag',
|
||||
x,
|
||||
y,
|
||||
title: tag.startsWith('#') ? tag : '#' + tag,
|
||||
body: '',
|
||||
color,
|
||||
structures,
|
||||
familleId: null,
|
||||
famillesCount: famSet.size,
|
||||
}
|
||||
}
|
||||
|
||||
function applyHashtagFilter() {
|
||||
if (!d3NodeSelection || !d3LinkSelection) return
|
||||
if (filteredStructureIds.value) {
|
||||
const ids = filteredStructureIds.value
|
||||
d3NodeSelection.filter((d: any) => d.type === 'structure').select('circle')
|
||||
.attr('opacity', (d: any) => ids.has(d.id) ? 1 : 0.1)
|
||||
d3LinkSelection.attr('opacity', (d: any) => {
|
||||
const srcId = typeof d.source === 'object' ? d.source.id : d.source
|
||||
const tgtId = typeof d.target === 'object' ? d.target.id : d.target
|
||||
return ids.has(srcId) || ids.has(tgtId) ? 1 : 0.05
|
||||
})
|
||||
} else {
|
||||
d3NodeSelection.select('circle').attr('opacity', 1)
|
||||
d3LinkSelection.attr('opacity', 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Declencher quand l'onglet devient visible
|
||||
watch(() => props.active, (val) => {
|
||||
if (val && import.meta.client && props.data) {
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
}
|
||||
})
|
||||
|
||||
// Relancer si les donnees arrivent apres l'activation
|
||||
watch(() => props.data, (val) => {
|
||||
if (val && props.active && import.meta.client) {
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
}
|
||||
})
|
||||
|
||||
// Re-appliquer le filtre visuel sans rebuild complet
|
||||
watch(activeHashtags, () => {
|
||||
applyHashtagFilter()
|
||||
if (simulation) simulation.alpha(0.01).restart()
|
||||
}, { deep: true })
|
||||
|
||||
// Watchers layers : rebuild simulation
|
||||
watch([showFamilles, showPratiques], () => {
|
||||
closePopover()
|
||||
if (import.meta.client && props.data && props.active) {
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
}
|
||||
})
|
||||
|
||||
// Toggle sidebar : largeur SVG change -> reinit graphe apres transition CSS
|
||||
watch(sidebarOpen, () => {
|
||||
if (!import.meta.client || !props.active || !props.data) return
|
||||
setTimeout(() => {
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => initGraph()))
|
||||
}, 220)
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
if (import.meta.client && props.data && props.active) {
|
||||
await nextTick()
|
||||
initGraph()
|
||||
}
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
if (simulation) simulation.stop()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
/* Labels des structures dans le graphe (D3 injecte les <text>, donc style global) */
|
||||
.graph-view .graph-struct-label {
|
||||
fill: var(--nav-text);
|
||||
paint-order: stroke;
|
||||
stroke: var(--nav-bg);
|
||||
stroke-width: 3px;
|
||||
stroke-linejoin: round;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,484 @@
|
||||
<!--
|
||||
GrapheConnaissances — B19-M2/M4. Un graphe biparti générique : des nœuds principaux
|
||||
(par défaut les concepts) et des nœuds secondaires (les sources : textes, organisations,
|
||||
outils), reliés par des liens typés. Écrit pour /connaissances, et pour être repris tel
|
||||
quel par la bibliothèque du corpus (B9 réécrit) : il ne connaît ni la vue fiches, ni la
|
||||
couche, seulement `noeuds`, `liens`, `selection`, `survol`.
|
||||
|
||||
La manière de GrapheMots (B6) : SVG rendu au serveur, taille mesurée, nœuds secondaires
|
||||
hors tabulation avec <title>, estompage. Rien de sa couronne de sept mots.
|
||||
Les gestes repris de l'explorateur Holosapiens (CONSTAT du 12/10, §4), en mieux :
|
||||
- clic = recadrage en 600 ms au plus, puis immobile ; aucune dérive perpétuelle ;
|
||||
- sœurs estompées, chemin allumé (liens de la sélection), un seul accent safran ;
|
||||
- nœuds principaux = <button>, au clavier ; `prefers-reduced-motion` = état final, sans transition ;
|
||||
- caméra bornée à la zone libre : le panneau de fiche est une colonne à part (VueFiches),
|
||||
la barre de pas et la poignée ont leur marge ; aucun nœud dessous.
|
||||
Graphe local (M4) : une sélection restreint le graphe à son voisinage à un ou deux pas
|
||||
(bascule « 1 pas / 2 pas / tout »), comme le graphe local d'Obsidian ; sans sélection,
|
||||
le graphe entier.
|
||||
|
||||
Layout : force simple à graine fixe, calculé depuis nœuds et liens (aucune position en
|
||||
données), mis en cache par signature du graphe (une fois par processus serveur), puis
|
||||
projeté sur la taille mesurée. Liens : trait plein = énoncé par la source, tirets = posé
|
||||
par la curation. La géométrie (disposer, cache, voisinage, boîte) vit dans
|
||||
`utils/connaissances/graphe.ts`, testée (B19b M4).
|
||||
-->
|
||||
<template>
|
||||
<div ref="racine" class="gc" :class="{ 'gc--fige': fige }">
|
||||
<svg class="gc__svg" :viewBox="`0 0 ${taille.w} ${taille.h}`" aria-hidden="true" focusable="false">
|
||||
<g class="gc__liens">
|
||||
<line
|
||||
v-for="l in liensVus"
|
||||
:key="l.cle"
|
||||
:x1="l.x1" :y1="l.y1" :x2="l.x2" :y2="l.y2"
|
||||
class="gc__lien"
|
||||
:class="[`gc__lien--${l.provenance}`, { 'gc__lien--vif': l.vif, 'gc__lien--eteint': l.eteint }]"
|
||||
/>
|
||||
</g>
|
||||
<g
|
||||
v-for="s in secondairesVus"
|
||||
:key="s.id"
|
||||
class="gc__source"
|
||||
:class="{ 'gc__source--sel': s.sel, 'gc__source--survol': s.survol, 'gc__source--eteint': s.eteint === 'fort', 'gc__source--loin': s.eteint === 'leger' }"
|
||||
:transform="`translate(${s.x} ${s.y})`"
|
||||
@click="emit('select', s.id)"
|
||||
@mouseenter="emit('survol', s.id)"
|
||||
@mouseleave="emit('survol', null)"
|
||||
>
|
||||
<title>{{ s.libelle }}</title>
|
||||
<rect x="-6" y="-6" width="12" height="12" rx="2" class="gc__carre" />
|
||||
<text v-if="s.etiquette" x="10" y="4" class="gc__source-texte">{{ s.etiquette }}</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
<div class="gc__noeuds" role="group" :aria-label="titre">
|
||||
<button
|
||||
v-for="p in principauxVus"
|
||||
:key="p.id"
|
||||
type="button"
|
||||
class="gc__noeud"
|
||||
:class="{ 'gc__noeud--sel': p.sel, 'gc__noeud--survol': p.survol, 'gc__noeud--eteint': p.eteint === 'fort', 'gc__noeud--loin': p.eteint === 'leger' }"
|
||||
:style="{ left: `${p.x}px`, top: `${p.y}px`, '--gc-r': `${p.r}px` }"
|
||||
:data-id="p.id"
|
||||
:aria-label="p.aria"
|
||||
:aria-pressed="p.sel ? 'true' : 'false'"
|
||||
@click="emit('select', p.id)"
|
||||
@mouseenter="emit('survol', p.id)"
|
||||
@mouseleave="emit('survol', null)"
|
||||
@focus="emit('survol', p.id)"
|
||||
@blur="emit('survol', null)"
|
||||
>
|
||||
<span class="gc__rond" aria-hidden="true" />
|
||||
<span class="gc__libelle" aria-hidden="true">{{ p.libelle }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="selVue" class="gc__barre" role="group" aria-label="Voisinage affiché">
|
||||
<button
|
||||
v-for="o in OPTIONS_PAS"
|
||||
:key="o.v"
|
||||
type="button"
|
||||
class="gc__pas"
|
||||
:aria-pressed="pas === o.v ? 'true' : 'false'"
|
||||
@click="pas = o.v"
|
||||
>{{ o.libelle }}</button>
|
||||
</div>
|
||||
<!-- Légende visible (retour de Jules du 27/10, n° 6 : « pourquoi des carrés, pourquoi des ronds ») -->
|
||||
<ul class="gc__legende" aria-label="Légende du graphe">
|
||||
<li><span class="gc__legende-rond" aria-hidden="true" />Concept</li>
|
||||
<li><span class="gc__legende-carre" aria-hidden="true" />Source (texte, organisation, outil)</li>
|
||||
<li><span class="gc__legende-trait" aria-hidden="true" />Énoncé par la source</li>
|
||||
<li><span class="gc__legende-trait gc__legende-trait--curation" aria-hidden="true" />Posé par AEP</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { boite, disposerEnCache, voisinage, type LienGraphe, type NoeudGraphe, type Pas, type Pt } from '~/utils/connaissances/graphe'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
noeuds: NoeudGraphe[]
|
||||
liens: LienGraphe[]
|
||||
selection: string | null
|
||||
survol: string | null
|
||||
/** Kinds rendus en nœuds principaux (ronds, boutons) ; les autres sont secondaires (carrés). */
|
||||
kindsPrincipaux?: string[]
|
||||
/** Pas du graphe local à l'ouverture d'une sélection. */
|
||||
pasDefaut?: Pas
|
||||
/** Nom accessible du groupe de nœuds. */
|
||||
titre?: string
|
||||
/** Libellé de kind pour les noms accessibles (« concept », « texte »…). */
|
||||
libelleKind?: (kind: string) => string
|
||||
/** Nœuds du résultat courant (filtres de la page) ; les autres s'estompent sans disparaître. null = tous. */
|
||||
retenus?: Set<string> | null
|
||||
}>(), {
|
||||
kindsPrincipaux: () => ['concept'],
|
||||
pasDefaut: 1,
|
||||
titre: 'Graphe',
|
||||
libelleKind: (k: string) => k,
|
||||
retenus: null,
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
select: [id: string]
|
||||
survol: [id: string | null]
|
||||
}>()
|
||||
|
||||
const OPTIONS_PAS: { v: Pas; libelle: string }[] = [
|
||||
{ v: 1, libelle: '1 pas' },
|
||||
{ v: 2, libelle: '2 pas' },
|
||||
{ v: 'tout', libelle: 'tout' },
|
||||
]
|
||||
const DUREE = 600 // recadrage : ≤ 700 ms, puis immobile
|
||||
const MARGE = { haut: 52, bas: 88, gauche: 96, droite: 96 } // bas : la légende (une ligne) et le libellé du dernier nœud, qui pend sous son rond
|
||||
const MARGE_TEL = { haut: 52, bas: 116, gauche: 64, droite: 64 } // < 768 : la légende tient sur deux lignes en bas ; les libellés sont tenus dans le cadre par la borne de `ecran`
|
||||
|
||||
// ── Taille mesurée (le rendu serveur part d'une taille plausible, comme GrapheMots) ──
|
||||
const racine = ref<HTMLElement | null>(null)
|
||||
const taille = reactive({ w: 720, h: 560 })
|
||||
const fige = ref(false) // prefers-reduced-motion : état final, sans transition
|
||||
let redim = false
|
||||
onMounted(() => {
|
||||
const mq = window.matchMedia('(prefers-reduced-motion: reduce)')
|
||||
fige.value = mq.matches
|
||||
const majMq = () => { fige.value = mq.matches }
|
||||
mq.addEventListener('change', majMq)
|
||||
const el = racine.value
|
||||
if (el && typeof ResizeObserver !== 'undefined') {
|
||||
const maj = (w: number, h: number, initiale = false) => {
|
||||
if (w > 40 && h > 40 && (Math.round(w) !== taille.w || Math.round(h) !== taille.h)) {
|
||||
redim = initiale // la première mesure saute ; un redimensionnement (fiche ouverte, fenêtre) se recadre en douceur
|
||||
taille.w = Math.round(w)
|
||||
taille.h = Math.round(h)
|
||||
}
|
||||
}
|
||||
maj(el.clientWidth, el.clientHeight, true)
|
||||
const ro = new ResizeObserver((e) => { const r = e[0]?.contentRect; if (r) maj(r.width, r.height) })
|
||||
ro.observe(el)
|
||||
onBeforeUnmount(() => ro.disconnect())
|
||||
}
|
||||
onBeforeUnmount(() => { mq.removeEventListener('change', majMq); if (raf) cancelAnimationFrame(raf) })
|
||||
})
|
||||
|
||||
// ── Layout (repère abstrait, en cache) ──
|
||||
const principaux = computed(() => new Set(props.kindsPrincipaux))
|
||||
const monde = computed(() => disposerEnCache(props.noeuds, props.liens, principaux.value))
|
||||
const ids = computed(() => new Set(props.noeuds.map((x) => x.id)))
|
||||
|
||||
// ── Sélection et voisinage ──
|
||||
const selVue = computed(() => (props.selection && ids.value.has(props.selection) ? props.selection : null))
|
||||
const pas = ref<Pas>(props.pasDefaut)
|
||||
watch(selVue, (s, avant) => { if (s && !avant) pas.value = props.pasDefaut })
|
||||
const visibles = computed<Set<string> | null>(() => (selVue.value ? voisinage(props.liens, selVue.value, pas.value) : null))
|
||||
const voisinsSel = computed(() => (selVue.value ? voisinage(props.liens, selVue.value, 1)! : null))
|
||||
const voisinsSurvol = computed(() => (props.survol && ids.value.has(props.survol) ? voisinage(props.liens, props.survol, 1)! : null))
|
||||
|
||||
// ── Caméra : boîte des nœuds visibles → zone libre ──
|
||||
interface Camera { cx: number; cy: number; s: number }
|
||||
const zone = computed(() => {
|
||||
const m = taille.w < 768 ? MARGE_TEL : MARGE
|
||||
return { x: m.gauche, y: m.haut, w: Math.max(40, taille.w - m.gauche - m.droite), h: Math.max(40, taille.h - m.haut - m.bas) }
|
||||
})
|
||||
/** Le dessin est-il en paysage ? Calculé une fois par layout (le monde est en cache), pas à chaque redimensionnement. */
|
||||
const paysage = computed(() => {
|
||||
const b = boite(monde.value.values())
|
||||
return b.x1 - b.x0 >= b.y1 - b.y0
|
||||
})
|
||||
/** Portrait d'écran et dessin paysage (ou l'inverse) : on tourne le dessin d'un quart. Projection, rien en base. */
|
||||
const tourne = computed(() => paysage.value !== zone.value.w >= zone.value.h)
|
||||
const pt = (id: string): Pt | null => {
|
||||
const p = monde.value.get(id)
|
||||
if (!p) return null
|
||||
return tourne.value ? { x: p.y, y: -p.x } : p
|
||||
}
|
||||
|
||||
const cible = computed<Camera>(() => {
|
||||
const vis = visibles.value
|
||||
const points = props.noeuds
|
||||
.filter((x) => !vis || vis.has(x.id))
|
||||
.map((x) => pt(x.id))
|
||||
.filter((p): p is Pt => !!p)
|
||||
const { x0, x1, y0, y1 } = boite(points)
|
||||
if (!Number.isFinite(x0)) return { cx: 0, cy: 0, s: 1 }
|
||||
const z = zone.value
|
||||
const plein = Math.min(z.w, z.h) // échelle du graphe entier (étendue 1)
|
||||
const s = Math.min(z.w / Math.max(x1 - x0, 1e-3), z.h / Math.max(y1 - y0, 1e-3), plein * 2.4)
|
||||
return { cx: (x0 + x1) / 2, cy: (y0 + y1) / 2, s }
|
||||
})
|
||||
|
||||
const camera = reactive<Camera>({ ...cible.value })
|
||||
let raf = 0
|
||||
watch(cible, (c) => {
|
||||
if (raf) { cancelAnimationFrame(raf); raf = 0 }
|
||||
if (!import.meta.client || fige.value || redim) {
|
||||
redim = false
|
||||
Object.assign(camera, c)
|
||||
return
|
||||
}
|
||||
const de = { ...camera }
|
||||
const t0 = performance.now()
|
||||
const pasAnim = (t: number) => {
|
||||
const u = Math.min(1, (t - t0) / DUREE)
|
||||
const e = 1 - Math.pow(1 - u, 3)
|
||||
camera.cx = de.cx + (c.cx - de.cx) * e
|
||||
camera.cy = de.cy + (c.cy - de.cy) * e
|
||||
camera.s = de.s + (c.s - de.s) * e
|
||||
raf = u < 1 ? requestAnimationFrame(pasAnim) : 0
|
||||
}
|
||||
raf = requestAnimationFrame(pasAnim)
|
||||
})
|
||||
|
||||
/** Bord à garder libre autour du centre d'un nœud : la demi-largeur maximale d'un libellé (9,5 rem) pour un principal. */
|
||||
const BORD_PRINCIPAL = 80 // 64 sous 768 px, où le libellé passe à 8 rem
|
||||
const BORD_SECONDAIRE = 12
|
||||
const kindDe = computed(() => new Map(props.noeuds.map((x) => [x.id, x.kind])))
|
||||
const ecran = (id: string): Pt | null => {
|
||||
const p = pt(id)
|
||||
if (!p) return null
|
||||
const z = zone.value
|
||||
const x = (p.x - camera.cx) * camera.s + z.x + z.w / 2
|
||||
// Garde-fou : aucun libellé ne sort du cadre, même en pleine animation ou sur une colonne étroite.
|
||||
const b = principaux.value.has(kindDe.value.get(id) ?? '') ? (taille.w < 768 ? 64 : BORD_PRINCIPAL) : BORD_SECONDAIRE
|
||||
const xBorne = taille.w > 2 * b ? Math.min(taille.w - b, Math.max(b, x)) : x
|
||||
return {
|
||||
x: Math.round(xBorne * 10) / 10,
|
||||
y: Math.round(((p.y - camera.cy) * camera.s + z.y + z.h / 2) * 10) / 10,
|
||||
}
|
||||
}
|
||||
|
||||
// ── Ce qui se dessine ──
|
||||
const estPrincipal = (kind: string) => principaux.value.has(kind)
|
||||
const vu = (id: string) => !visibles.value || visibles.value.has(id)
|
||||
/**
|
||||
* Estompé : hors du voisinage immédiat de la sélection. En « tout », les sœurs s'éteignent
|
||||
* franchement ; en graphe local à deux pas, le second cercle reste lisible, un ton en dessous.
|
||||
*/
|
||||
const eteint = (id: string): 'fort' | 'leger' | null => {
|
||||
if (!voisinsSel.value) return props.retenus && !props.retenus.has(id) ? 'fort' : null
|
||||
if (voisinsSel.value.has(id) || voisinsSurvol.value?.has(id)) return null
|
||||
return pas.value === 'tout' ? 'fort' : 'leger'
|
||||
}
|
||||
const degre = computed(() => {
|
||||
const d = new Map<string, number>()
|
||||
for (const l of props.liens) for (const id of [l.de, l.vers]) d.set(id, (d.get(id) ?? 0) + 1)
|
||||
return d
|
||||
})
|
||||
const tronquer = (t: string, max = 30) => (t.length > max ? `${t.slice(0, max - 1).trimEnd()}…` : t)
|
||||
|
||||
const principauxVus = computed(() => props.noeuds
|
||||
.filter((x) => estPrincipal(x.kind) && vu(x.id))
|
||||
.map((x) => {
|
||||
const p = ecran(x.id)!
|
||||
const n = degre.value.get(x.id) ?? 0
|
||||
return {
|
||||
id: x.id,
|
||||
libelle: x.libelle,
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
r: 7 + Math.min(x.poids ?? n, 6),
|
||||
sel: x.id === selVue.value,
|
||||
survol: x.id === props.survol,
|
||||
eteint: eteint(x.id),
|
||||
aria: `${x.libelle}, ${props.libelleKind(x.kind)}, ${n} ${n > 1 ? 'liens' : 'lien'}`,
|
||||
}
|
||||
}))
|
||||
|
||||
const secondairesVus = computed(() => props.noeuds
|
||||
.filter((x) => !estPrincipal(x.kind) && vu(x.id))
|
||||
.map((x) => {
|
||||
const p = ecran(x.id)!
|
||||
const enVue = !!visibles.value || !!voisinsSel.value?.has(x.id) || !!voisinsSurvol.value?.has(x.id) || x.id === props.survol
|
||||
return {
|
||||
id: x.id,
|
||||
libelle: x.libelle,
|
||||
etiquette: enVue ? tronquer(x.libelle) : '',
|
||||
x: p.x,
|
||||
y: p.y,
|
||||
sel: x.id === selVue.value,
|
||||
survol: x.id === props.survol,
|
||||
eteint: eteint(x.id),
|
||||
}
|
||||
}))
|
||||
|
||||
const liensVus = computed(() => props.liens
|
||||
.filter((l) => vu(l.de) && vu(l.vers))
|
||||
.map((l, i) => {
|
||||
const a = ecran(l.de)
|
||||
const b = ecran(l.vers)
|
||||
if (!a || !b) return null
|
||||
const sel = selVue.value
|
||||
const sv = props.survol
|
||||
const vif = (!!sel && (l.de === sel || l.vers === sel)) || (!!sv && (l.de === sv || l.vers === sv))
|
||||
return {
|
||||
cle: `${l.de}>${l.vers}>${l.type}>${i}`,
|
||||
x1: a.x, y1: a.y, x2: b.x, y2: b.y,
|
||||
provenance: l.provenance === 'curation' ? 'curation' : 'source',
|
||||
vif,
|
||||
eteint: !!sel && !vif && pas.value === 'tout',
|
||||
}
|
||||
})
|
||||
.filter((l): l is NonNullable<typeof l> => !!l))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.gc {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg-alt);
|
||||
color: var(--text);
|
||||
}
|
||||
.gc__svg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
/* Liens : encre fine ; tirets = posé par la curation */
|
||||
.gc__lien {
|
||||
stroke: color-mix(in srgb, var(--text) 38%, transparent);
|
||||
stroke-width: 1.1;
|
||||
transition: stroke var(--dur-fast) var(--ease-out), stroke-width var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.gc__lien--curation { stroke-dasharray: 4 3; }
|
||||
.gc__lien--vif { stroke: var(--text); stroke-width: 1.8; }
|
||||
.gc__lien--eteint { opacity: 0.25; }
|
||||
|
||||
/* Sources : carrés gris, hors tabulation (au clavier, on y va par la liste des fiches) */
|
||||
.gc__source { cursor: pointer; transition: opacity var(--dur-fast) var(--ease-out); }
|
||||
.gc__carre {
|
||||
fill: color-mix(in srgb, var(--text) 52%, var(--bg-alt));
|
||||
stroke: var(--bg-alt);
|
||||
stroke-width: 1.5;
|
||||
}
|
||||
.gc__source--survol .gc__carre { fill: var(--text); }
|
||||
.gc__source--sel .gc__carre { fill: var(--accent); stroke: var(--text); }
|
||||
.gc__source--eteint { opacity: 0.28; }
|
||||
.gc__source--loin { opacity: 0.6; }
|
||||
.gc__source-texte {
|
||||
fill: color-mix(in srgb, var(--text) 80%, transparent);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-medium);
|
||||
paint-order: stroke;
|
||||
stroke: var(--bg-alt);
|
||||
stroke-width: 3px;
|
||||
stroke-linejoin: round;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Concepts : boutons HTML posés sur le dessin */
|
||||
.gc__noeuds { position: absolute; inset: 0; pointer-events: none; }
|
||||
.gc__noeud {
|
||||
position: absolute;
|
||||
transform: translate(-50%, calc(-1 * var(--gc-r)));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 3px;
|
||||
max-width: 9.5rem;
|
||||
padding: 0 2px 2px;
|
||||
border: none;
|
||||
border-radius: var(--radius-sm);
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
pointer-events: auto;
|
||||
transition: opacity var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.gc__rond {
|
||||
width: calc(2 * var(--gc-r));
|
||||
height: calc(2 * var(--gc-r));
|
||||
border-radius: 50%;
|
||||
background: var(--surface);
|
||||
border: 2px solid var(--text);
|
||||
transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.gc__libelle {
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-semibold);
|
||||
line-height: 1.2;
|
||||
text-align: center;
|
||||
overflow-wrap: anywhere;
|
||||
padding: 0 3px;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--bg-alt) 82%, transparent);
|
||||
}
|
||||
.gc__noeud--survol .gc__rond { border-width: 3px; }
|
||||
.gc__noeud--sel .gc__rond { background: var(--accent); border-color: var(--text); }
|
||||
.gc__noeud--sel .gc__libelle { background: var(--accent); color: var(--on-accent); }
|
||||
.gc__noeud--eteint { opacity: 0.32; }
|
||||
.gc__noeud--loin { opacity: 0.62; }
|
||||
/* L'opacité éteindrait l'anneau de focus (DESIGN-SYSTEM §Texte atténué) : un nœud focalisé revient à l'opacité pleine. */
|
||||
.gc__noeud--eteint:focus-visible, .gc__noeud--loin:focus-visible { opacity: 1; }
|
||||
.gc__noeud:focus { outline: none; }
|
||||
.gc__noeud:focus-visible .gc__rond { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
|
||||
.gc__noeud:focus-visible .gc__libelle { outline: 2px solid var(--focus-ring); }
|
||||
|
||||
/* Barre du graphe local (en haut à gauche, hors de la poignée de la vue fiches) */
|
||||
.gc__barre {
|
||||
position: absolute;
|
||||
top: var(--space-xs);
|
||||
left: 32px;
|
||||
display: inline-flex;
|
||||
padding: 2px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.gc__pas {
|
||||
min-height: 44px;
|
||||
min-width: 44px;
|
||||
padding: 0 var(--space-sm);
|
||||
border: none;
|
||||
border-radius: calc(var(--radius-md) - 2px);
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
cursor: pointer;
|
||||
}
|
||||
.gc__pas[aria-pressed='true'] { background: var(--text); color: var(--surface); }
|
||||
.gc__pas:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
|
||||
/* Légende : une ligne en bas du graphe (deux au téléphone), hors de la poignée et de la barre des pas */
|
||||
.gc__legende {
|
||||
position: absolute;
|
||||
left: var(--space-lg);
|
||||
bottom: var(--space-xs);
|
||||
max-width: calc(100% - var(--space-lg) - var(--space-sm));
|
||||
margin: 0;
|
||||
padding: var(--space-2xs) var(--space-xs);
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-2xs) var(--space-sm);
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--bg-alt) 88%, transparent);
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.3;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
pointer-events: none;
|
||||
}
|
||||
.gc__legende li { display: inline-flex; align-items: center; gap: var(--space-2xs); }
|
||||
.gc__legende-rond { width: 10px; height: 10px; border-radius: var(--radius-full); border: 2px solid var(--text); background: var(--surface); }
|
||||
.gc__legende-carre { width: 9px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--text) 52%, var(--bg-alt)); }
|
||||
.gc__legende-trait { width: 18px; border-top: 1.5px solid currentColor; }
|
||||
.gc__legende-trait--curation { border-top-style: dashed; }
|
||||
@media (max-width: 767.98px) {
|
||||
.gc__noeud { max-width: 8rem; }
|
||||
}
|
||||
|
||||
/* Mouvement réduit : état final, sans transition (la caméra saute aussi, côté script) */
|
||||
.gc--fige .gc__lien, .gc--fige .gc__source, .gc--fige .gc__noeud, .gc--fige .gc__rond { transition: none; }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.gc__lien, .gc__source, .gc__noeud, .gc__rond { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,314 @@
|
||||
<!--
|
||||
GrapheMots — B6-M2. Le graphe des sept mots de « Partir de soi » : un nœud
|
||||
central, les mots en couronne (ordre de la slide, sens horaire depuis le
|
||||
haut), et autour de chaque mot ses ressources en petits nœuds-feuilles.
|
||||
Vocabulaire du motif maillage (DESIGN-SYSTEM) : nœuds pleins, arêtes fines,
|
||||
un nœud central mis en avant. Statique et déterministe : pas de simulation,
|
||||
rien ne bouge ; la mise en page est une fonction pure de la taille mesurée.
|
||||
|
||||
Il vit dans le slot #carte de VueFiches et ne connaît que `vf` :
|
||||
clic / Entrée sur un mot ouvre sa fiche (`vf.ouvrirFiche`), le mot ouvert
|
||||
(`vf.ficheId`) et le mot survolé dans la liste (`vf.survolId`) s'allument,
|
||||
les mots hors du résultat (`vf.idsResultat`) s'estompent sans disparaître.
|
||||
Les feuilles ne sont pas dans l'ordre de tabulation (on y accède par leur
|
||||
mot) ; leur libellé apparaît au survol.
|
||||
-->
|
||||
<template>
|
||||
<div ref="racine" class="gm">
|
||||
<svg
|
||||
class="gm__svg"
|
||||
:viewBox="`0 0 ${taille.w} ${taille.h}`"
|
||||
preserveAspectRatio="xMidYMid meet"
|
||||
role="group"
|
||||
aria-labelledby="gm-titre"
|
||||
>
|
||||
<title id="gm-titre">Graphe des sept mots de « Partir de soi » et des ressources de chacun</title>
|
||||
|
||||
<!-- Arêtes : centre → mot, mot → feuilles -->
|
||||
<g class="gm__aretes" aria-hidden="true">
|
||||
<template v-for="n in noeuds" :key="`a-${n.id}`">
|
||||
<line
|
||||
:x1="centre.x" :y1="centre.y" :x2="n.x" :y2="n.y"
|
||||
class="gm__arete" :class="{ 'gm__arete--vif': allume(n.id), 'gm__arete--hors': hors(n.id) }"
|
||||
/>
|
||||
<line
|
||||
v-for="f in n.feuilles" :key="`a-${n.id}-${f.id}`"
|
||||
:x1="n.x" :y1="n.y" :x2="f.x" :y2="f.y"
|
||||
class="gm__arete gm__arete--feuille" :class="{ 'gm__arete--vif': allume(n.id), 'gm__arete--hors': hors(n.id) }"
|
||||
/>
|
||||
</template>
|
||||
</g>
|
||||
|
||||
<!-- Nœud central -->
|
||||
<g class="gm__centre" aria-hidden="true">
|
||||
<circle :cx="centre.x" :cy="centre.y" :r="RAYON_CENTRE" class="gm__centre-rond" />
|
||||
<text :x="centre.x" :y="centre.y - 7" class="gm__centre-texte" text-anchor="middle">Partir</text>
|
||||
<text :x="centre.x" :y="centre.y + 8" class="gm__centre-texte" text-anchor="middle">de soi</text>
|
||||
</g>
|
||||
|
||||
<!-- Feuilles (ressources) -->
|
||||
<g v-for="n in noeuds" :key="`f-${n.id}`" class="gm__feuilles" :class="{ 'gm__feuilles--hors': hors(n.id) }">
|
||||
<circle
|
||||
v-for="f in n.feuilles" :key="f.id"
|
||||
:cx="f.x" :cy="f.y" r="5.5"
|
||||
class="gm__feuille" :class="{ 'gm__feuille--vive': allume(n.id) || survolFeuille === `${n.id}/${f.id}` }"
|
||||
@click="vf.ouvrirFiche(n.id)"
|
||||
@mouseenter="survolerFeuille(n.id, f.id)"
|
||||
@mouseleave="survolerFeuille(null, null)"
|
||||
>
|
||||
<title>{{ f.titre }}</title>
|
||||
</circle>
|
||||
</g>
|
||||
|
||||
<!-- Mots -->
|
||||
<g
|
||||
v-for="n in noeuds"
|
||||
:key="n.id"
|
||||
class="gm__mot"
|
||||
:class="{ 'gm__mot--actif': allume(n.id), 'gm__mot--hors': hors(n.id), 'gm__mot--vide': n.vide }"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
:aria-label="n.aria"
|
||||
:aria-pressed="actif(n.id)"
|
||||
@click="vf.ouvrirFiche(n.id)"
|
||||
@keydown.enter.prevent="vf.ouvrirFiche(n.id)"
|
||||
@keydown.space.prevent="vf.ouvrirFiche(n.id)"
|
||||
@mouseenter="vf.survolId = n.id"
|
||||
@mouseleave="vf.survolId = null"
|
||||
@focus="vf.survolId = n.id"
|
||||
@blur="vf.survolId = null"
|
||||
>
|
||||
<rect
|
||||
:x="n.x - n.l / 2" :y="n.y - n.h / 2" :width="n.l" :height="n.h" :rx="n.h / 2"
|
||||
class="gm__pilule"
|
||||
/>
|
||||
<text :x="n.x" :y="n.y" text-anchor="middle" class="gm__libelle" aria-hidden="true">
|
||||
<tspan v-for="(ligne, i) in n.lignes" :key="i" :x="n.x" :y="n.y + (i - (n.lignes.length - 1) / 2) * INTERLIGNE + 4.5">{{ ligne }}</tspan>
|
||||
</text>
|
||||
</g>
|
||||
|
||||
<!-- Libellé de la feuille survolée, au-dessus de tout -->
|
||||
<g v-if="bulle" class="gm__bulle" aria-hidden="true">
|
||||
<rect :x="bulle.x - bulle.l / 2" :y="bulle.y - 11" :width="bulle.l" height="22" rx="6" class="gm__bulle-fond" />
|
||||
<text :x="bulle.x" :y="bulle.y + 4" text-anchor="middle" class="gm__bulle-texte">{{ bulle.texte }}</text>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { VueFichesEtat } from '~/composables/useVueFiches'
|
||||
|
||||
const props = defineProps<{
|
||||
vf: VueFichesEtat
|
||||
mots: { id: string; mot: string; ressources: { id: string; titre: string }[]; vide?: boolean }[]
|
||||
}>()
|
||||
|
||||
const RAYON_CENTRE = 36
|
||||
const INTERLIGNE = 15
|
||||
const CARACTERES_LIGNE = 16
|
||||
const PORTEE_FEUILLES = 46
|
||||
const MARGE = 10
|
||||
|
||||
// ── Taille : mesurée au montage (le rendu serveur part d'une taille plausible) ──
|
||||
const racine = ref<HTMLElement | null>(null)
|
||||
const taille = reactive({ w: 720, h: 600 })
|
||||
onMounted(() => {
|
||||
const el = racine.value
|
||||
if (!el || typeof ResizeObserver === 'undefined') return
|
||||
const maj = (w: number, h: number) => {
|
||||
if (w > 40 && h > 40) { taille.w = Math.round(w); taille.h = Math.round(h) }
|
||||
}
|
||||
maj(el.clientWidth, el.clientHeight)
|
||||
const ro = new ResizeObserver((entrees) => {
|
||||
const r = entrees[0]?.contentRect
|
||||
if (r) maj(r.width, r.height)
|
||||
})
|
||||
ro.observe(el)
|
||||
onBeforeUnmount(() => ro.disconnect())
|
||||
})
|
||||
|
||||
// ── Mise en page : fonction pure de (taille, mots) ──
|
||||
/** Une ligne si ça tient, sinon deux lignes équilibrées (« naviguer / avec soi », pas « naviguer avec / soi »). */
|
||||
function couper(texte: string): string[] {
|
||||
if (texte.length <= CARACTERES_LIGNE) return [texte]
|
||||
const mots = texte.split(' ')
|
||||
let meilleur: string[] = [texte]
|
||||
let pire = Infinity
|
||||
for (let i = 1; i < mots.length; i++) {
|
||||
const l = [mots.slice(0, i).join(' '), mots.slice(i).join(' ')]
|
||||
const m = Math.max(l[0].length, l[1].length)
|
||||
if (m < pire) { pire = m; meilleur = l }
|
||||
}
|
||||
return meilleur
|
||||
}
|
||||
|
||||
function tronquer(t: string, max = 44): string {
|
||||
return t.length > max ? `${t.slice(0, max - 1).trimEnd()}…` : t
|
||||
}
|
||||
|
||||
const centre = computed(() => ({ x: taille.w / 2, y: taille.h / 2 }))
|
||||
|
||||
const noeuds = computed(() => {
|
||||
const n = props.mots.length
|
||||
const { w, h } = taille
|
||||
const base = props.mots.map((m) => {
|
||||
const lignes = couper(m.mot)
|
||||
return { m, lignes, l: Math.max(...lignes.map((x) => x.length)) * 6.9 + 24, h: lignes.length * INTERLIGNE + 11 }
|
||||
})
|
||||
const lMax = Math.max(...base.map((b) => b.l))
|
||||
const hMax = Math.max(...base.map((b) => b.h))
|
||||
const rx = Math.max(48, w / 2 - lMax / 2 - PORTEE_FEUILLES - MARGE)
|
||||
const ry = Math.max(70, h / 2 - hMax / 2 - PORTEE_FEUILLES - MARGE)
|
||||
const cx = centre.value.x
|
||||
const cy = centre.value.y
|
||||
|
||||
// Colonne étroite : la couronne ne tient plus (les mots du bas se chevaucheraient).
|
||||
// Les mots s'étagent alors en zigzag autour du centre, une rangée chacun, dans le
|
||||
// même sens de lecture (haut, puis la droite en descendant, puis la gauche en remontant),
|
||||
// et leurs ressources se rangent SOUS le mot.
|
||||
const etroit = rx < lMax * 1.3
|
||||
let place: { x: number; y: number }[]
|
||||
if (etroit) {
|
||||
const droite = Math.ceil((n - 1) / 2)
|
||||
const rangsDroite = Array.from({ length: droite }, (_, i) => 1 + 2 * i)
|
||||
const rangsGauche = Array.from({ length: n }, (_, i) => i).filter((r) => r > 0 && !rangsDroite.includes(r)).reverse()
|
||||
const rang = (i: number) => (i === 0 ? 0 : i <= droite ? rangsDroite[i - 1] : rangsGauche[i - droite - 1])
|
||||
const y0 = hMax / 2 + MARGE
|
||||
const y1 = h - hMax / 2 - MARGE - 24 // de la place sous le dernier mot pour ses feuilles
|
||||
const pas = n > 1 ? (y1 - y0) / (n - 1) : 0
|
||||
const dx = Math.max(0, w / 2 - lMax / 2 - 6)
|
||||
place = base.map((_, i) => ({ x: i === 0 ? cx : i <= droite ? cx + dx : cx - dx, y: y0 + rang(i) * pas }))
|
||||
} else {
|
||||
place = base.map((_, i) => {
|
||||
const a = -Math.PI / 2 + (i * 2 * Math.PI) / n // depuis le haut, sens horaire
|
||||
return { x: cx + rx * Math.cos(a), y: cy + ry * Math.sin(a) }
|
||||
})
|
||||
}
|
||||
|
||||
return base.map((b, i) => {
|
||||
const { x, y } = place[i]
|
||||
const k = b.m.ressources.length
|
||||
let feuilles: { id: string; titre: string; x: number; y: number }[]
|
||||
if (etroit) {
|
||||
const ecart = k > 1 ? Math.min(17, (b.l - 20) / (k - 1)) : 0
|
||||
feuilles = b.m.ressources.map((r, j) => ({
|
||||
id: r.id,
|
||||
titre: r.titre,
|
||||
x: x + (j - (k - 1) / 2) * ecart,
|
||||
y: y + b.h / 2 + 13 + (j % 2 ? 9 : 0),
|
||||
}))
|
||||
} else {
|
||||
// direction « vers l'extérieur » réelle (l'ellipse n'est pas un cercle)
|
||||
const dir = Math.atan2(y - cy, x - cx)
|
||||
const pas = Math.min(0.55, 2.3 / Math.max(k, 1))
|
||||
const dist = Math.abs(Math.cos(dir)) * (b.l / 2) + Math.abs(Math.sin(dir)) * (b.h / 2) + 20
|
||||
feuilles = b.m.ressources.map((r, j) => {
|
||||
const t = dir + (j - (k - 1) / 2) * pas
|
||||
const d = dist + (j % 2 ? 12 : 0)
|
||||
return {
|
||||
id: r.id,
|
||||
titre: r.titre,
|
||||
x: Math.min(w - 8, Math.max(8, x + d * Math.cos(t))),
|
||||
y: Math.min(h - 8, Math.max(8, y + d * Math.sin(t))),
|
||||
}
|
||||
})
|
||||
}
|
||||
return {
|
||||
id: b.m.id,
|
||||
x, y, l: b.l, h: b.h, lignes: b.lignes,
|
||||
vide: !!b.m.vide || k === 0,
|
||||
aria: `${b.m.mot}, ${k === 0 ? 'aucune ressource pour l’instant' : k === 1 ? '1 ressource' : `${k} ressources`}`,
|
||||
feuilles,
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
// ── États (tout vient de vf) ──
|
||||
const actif = (id: string) => String(props.vf.ficheId ?? '') === id
|
||||
const survol = (id: string) => props.vf.survolId != null && String(props.vf.survolId) === id
|
||||
const allume = (id: string) => actif(id) || survol(id)
|
||||
const hors = (id: string) => !props.vf.idsResultat.has(id)
|
||||
|
||||
const survolFeuille = ref<string | null>(null)
|
||||
function survolerFeuille(mot: string | null, feuille: string | null) {
|
||||
survolFeuille.value = mot && feuille ? `${mot}/${feuille}` : null
|
||||
props.vf.survolId = mot
|
||||
}
|
||||
|
||||
const bulle = computed(() => {
|
||||
if (!survolFeuille.value) return null
|
||||
const [mot, feuille] = survolFeuille.value.split('/')
|
||||
const f = noeuds.value.find((n) => n.id === mot)?.feuilles.find((x) => x.id === feuille)
|
||||
if (!f) return null
|
||||
const texte = tronquer(f.titre)
|
||||
const l = texte.length * 6.3 + 16
|
||||
const x = Math.min(taille.w - l / 2 - 4, Math.max(l / 2 + 4, f.x))
|
||||
const y = f.y < 30 ? f.y + 24 : f.y - 18
|
||||
return { x, y, l, texte }
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.gm {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
background: var(--bg-alt);
|
||||
}
|
||||
.gm__svg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
/* Arêtes fines */
|
||||
.gm__arete { stroke: var(--nav-primary-solid); stroke-width: 1; stroke-opacity: 0.35; }
|
||||
.gm__arete--feuille { stroke-opacity: 0.28; }
|
||||
.gm__arete--vif { stroke-width: 2; stroke-opacity: 0.8; }
|
||||
.gm__arete--hors { stroke-opacity: 0.12; }
|
||||
|
||||
/* Nœud central, mis en avant */
|
||||
.gm__centre-rond { fill: var(--nav-primary-solid); stroke: var(--accent); stroke-width: 3; }
|
||||
.gm__centre-texte { fill: var(--nav-text-on-primary); font-size: 12px; font-weight: 700; }
|
||||
|
||||
/* Feuilles : petits nœuds pleins */
|
||||
.gm__feuille {
|
||||
fill: var(--nav-primary-solid);
|
||||
stroke: var(--bg-alt);
|
||||
stroke-width: 1.5;
|
||||
cursor: pointer;
|
||||
transition: fill 120ms ease-out;
|
||||
}
|
||||
.gm__feuille--vive { fill: var(--accent); stroke: var(--nav-primary-solid); }
|
||||
.gm__feuilles--hors { opacity: 0.3; }
|
||||
|
||||
/* Mots : pastilles qui portent leur libellé */
|
||||
.gm__mot { cursor: pointer; outline: none; transition: opacity 120ms ease-out; }
|
||||
.gm__pilule {
|
||||
fill: var(--surface);
|
||||
stroke: var(--nav-primary-solid);
|
||||
stroke-width: 2;
|
||||
transition: fill 120ms ease-out, stroke 120ms ease-out;
|
||||
}
|
||||
.gm__libelle { fill: var(--text); font-size: 12.5px; font-weight: 600; pointer-events: none; }
|
||||
.gm__mot--vide .gm__pilule { stroke-dasharray: 5 4; }
|
||||
.gm__mot--actif .gm__pilule { fill: var(--accent); stroke: var(--nav-primary-solid); }
|
||||
.gm__mot--actif .gm__libelle { fill: var(--on-accent); }
|
||||
.gm__mot--hors { opacity: 0.4; }
|
||||
.gm__mot:focus-visible .gm__pilule { stroke: var(--focus-ring); stroke-width: 4; }
|
||||
|
||||
/* Libellé de feuille */
|
||||
.gm__bulle { pointer-events: none; }
|
||||
.gm__bulle-fond { fill: var(--surface); stroke: var(--nav-primary-solid); stroke-width: 1; }
|
||||
.gm__bulle-texte { fill: var(--text); font-size: 11.5px; font-weight: 500; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.gm__feuille, .gm__mot, .gm__pilule { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="fade">
|
||||
<div
|
||||
v-if="visible"
|
||||
class="intention-overlay"
|
||||
style="
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 2000;
|
||||
background: rgba(20, 18, 14, 0.85);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 24px;
|
||||
"
|
||||
@click.self="dismiss"
|
||||
>
|
||||
<div style="
|
||||
max-width: 540px;
|
||||
width: 100%;
|
||||
background: #faf8f5;
|
||||
border-radius: 8px;
|
||||
padding: 32px;
|
||||
color: #2c2416;
|
||||
">
|
||||
<p style="font-size: 1rem; line-height: 1.7; margin: 0 0 12px 0;">
|
||||
Cette carte recense les réseaux, collectifs, agences et projets où des
|
||||
pensées écologiques deviennent des pratiques d'architecture et d'habiter.
|
||||
</p>
|
||||
<p style="font-size: 0.875rem; line-height: 1.6; opacity: 0.75; margin: 0 0 24px 0;">
|
||||
Elle ne prétend pas à l'exhaustivité. Elle est un geste politique :
|
||||
rendre visible ce qui se transforme, comment, par qui, où.
|
||||
Six familles et des hashtags vous permettent d'explorer.
|
||||
</p>
|
||||
<button
|
||||
@click="dismiss"
|
||||
style="
|
||||
background: #2c2416;
|
||||
color: #faf8f5;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
padding: 10px 24px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
"
|
||||
>Explorer la carte</button>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const visible = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
if (typeof localStorage !== 'undefined' && !localStorage.getItem('aep_intention_seen')) {
|
||||
visible.value = true
|
||||
}
|
||||
})
|
||||
|
||||
function dismiss() {
|
||||
visible.value = false
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('aep_intention_seen', '1')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fade-enter-active, .fade-leave-active { transition: opacity 0.3s; }
|
||||
.fade-enter-from, .fade-leave-to { opacity: 0; }
|
||||
</style>
|
||||
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<div class="media-tab-backend" style="padding: 2rem; overflow-y: auto;">
|
||||
<div style="max-width: 640px;">
|
||||
<h2 style="font-weight: 700; font-size: 1.1rem; margin-bottom: 0.75rem; color: var(--nav-text);">LightRAG backend</h2>
|
||||
<p style="font-size: 0.9rem; line-height: 1.6; color: var(--nav-text); margin-bottom: 0.5rem;">
|
||||
Voici l'interface brute du <strong>LightRAG</strong> qui alimente la carte des pensées écologiques.
|
||||
C'est la "cuisine" du RAG : ingestion de documents, extraction d'entités, relations, requêtes.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<iframe
|
||||
src="https://lightrag.trans-former.fr/"
|
||||
style="width: 100%; height: 70vh; border: 1px solid var(--nav-bg-alt, #ddd); border-radius: 8px; margin-top: 1.5rem;"
|
||||
title="LightRAG backend AEP — lecture seule"
|
||||
sandbox="allow-same-origin allow-scripts"
|
||||
loading="lazy"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<!-- <main> : la page /media n'en avait pas (Lighthouse landmark-one-main) ; l'onglet visuel n'est pas touché. -->
|
||||
<main class="media-tab-projets" style="padding: 1.5rem; overflow-y: auto;">
|
||||
<div style="max-width: 70ch; margin-bottom: 1.5rem;">
|
||||
<h2 style="font-weight: 700; font-size: 1.1rem; margin-bottom: 0.5rem; color: var(--nav-text);">Publications</h2>
|
||||
<p style="font-size: 0.9rem; line-height: 1.6; color: var(--nav-text);">
|
||||
Mutualiser le savoir. Voici les PFE engagés publiés en ligne dont nous avons connaissance.
|
||||
Partage-nous le lien de ton travail si tu veux participer à cette initiative.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- Lot XL publications : toute la carte est le lien (un seul <a>), image en tête, auteurs nommés. -->
|
||||
<ul class="projets-grid" role="list">
|
||||
<li v-for="p in projets" :key="p.id">
|
||||
<a class="projet-carte" :href="p.url" target="_blank" rel="noopener">
|
||||
<img
|
||||
class="projet-carte__image"
|
||||
:src="p.illustration"
|
||||
:alt="altDe(p)"
|
||||
width="800"
|
||||
height="600"
|
||||
loading="lazy"
|
||||
decoding="async"
|
||||
/>
|
||||
<div class="projet-carte__corps">
|
||||
<h3 class="projet-carte__titre">{{ p.titre }}</h3>
|
||||
<span class="projet-carte__auteurs">{{ signature(p) }}</span>
|
||||
<span v-if="meta(p)" class="projet-carte__meta">{{ meta(p) }}</span>
|
||||
<span class="projet-carte__description">{{ p.description }}</span>
|
||||
<span v-if="p.credit_illustration" class="projet-carte__credit">Image : {{ minuscule(p.credit_illustration) }}</span>
|
||||
<span v-if="p.link_status === 'broken'" class="projet-carte__alerte">Lien d'origine cassé</span>
|
||||
<span class="projet-carte__indice">Découvrir<span class="sr-only"> (nouvel onglet)</span></span>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p style="margin-top: 2rem; font-size: 0.875rem; color: var(--nav-text-muted);">
|
||||
Tu as un PFE engagé à partager ? <a href="mailto:contact@trans-former.fr" style="color: var(--nav-primary-solid);">Écris-moi</a>.
|
||||
</p>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface Projet {
|
||||
id: string
|
||||
titre: string
|
||||
collectif?: string
|
||||
auteurs: string[]
|
||||
annee?: string | null
|
||||
ecole?: string | null
|
||||
url: string
|
||||
description: string
|
||||
illustration: string
|
||||
illustration_a_venir?: boolean
|
||||
credit_illustration?: string | null
|
||||
link_status?: string
|
||||
}
|
||||
|
||||
const { data: pfeData } = await useFetch<{ projets: Projet[] }>('/data/pfe-engages.json')
|
||||
const projets = computed(() => pfeData.value?.projets ?? [])
|
||||
|
||||
/** « A », « A et B », « A, B et C ». */
|
||||
function enumere(noms: string[]): string {
|
||||
const n = noms.filter(a => a && a !== 'Inconnu')
|
||||
return n.length < 2 ? (n[0] ?? '') : `${n.slice(0, -1).join(', ')} et ${n[n.length - 1]}`
|
||||
}
|
||||
function signature(p: Projet): string {
|
||||
const noms = enumere(p.auteurs || [])
|
||||
return p.collectif ? `${p.collectif} : ${noms}` : noms
|
||||
}
|
||||
function meta(p: Projet): string {
|
||||
return [p.ecole, p.annee].filter(v => v && v !== 'Inconnu').join(', ')
|
||||
}
|
||||
function minuscule(s: string): string {
|
||||
return s.charAt(0).toLowerCase() + s.slice(1)
|
||||
}
|
||||
function altDe(p: Projet): string {
|
||||
if (p.illustration_a_venir) return `Illustration à venir pour « ${p.titre} »`
|
||||
return `${p.credit_illustration ?? 'Illustration'} : « ${p.titre} », par ${enumere(p.auteurs || [])}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.projets-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
|
||||
gap: 1.25rem;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.projets-grid > li {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
.projet-carte {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 44px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--border, var(--bg-alt));
|
||||
border-radius: var(--radius-md, 10px);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
transition: background-color var(--dur-fast, 150ms) var(--ease-out, ease-out),
|
||||
box-shadow var(--dur-fast, 150ms) var(--ease-out, ease-out);
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.projet-carte { transition: none; }
|
||||
}
|
||||
.projet-carte:hover {
|
||||
background: var(--surface-2);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
.projet-carte:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.projet-carte__image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
aspect-ratio: 4 / 3;
|
||||
object-fit: cover;
|
||||
background: var(--bg-alt);
|
||||
}
|
||||
.projet-carte__corps {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
gap: 0.35rem;
|
||||
padding: var(--space-sm, 0.75rem) var(--space-md, 1rem) var(--space-md, 1rem);
|
||||
}
|
||||
.projet-carte__titre {
|
||||
margin: 0.15rem 0 0;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
line-height: 1.35;
|
||||
}
|
||||
.projet-carte__auteurs {
|
||||
font-size: 0.85rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
/* Texte atténué : color-mix, pas --text-muted (sous AA à 0,8 rem), cf. DESIGN-SYSTEM.md */
|
||||
.projet-carte__meta,
|
||||
.projet-carte__credit {
|
||||
font-size: 0.8rem;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.projet-carte__description {
|
||||
flex: 1;
|
||||
overflow-wrap: anywhere;
|
||||
margin-top: 0.25rem;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.projet-carte__alerte {
|
||||
font-size: 0.8rem;
|
||||
color: var(--warning, #b45309);
|
||||
}
|
||||
.projet-carte__indice {
|
||||
margin-top: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-primary-solid);
|
||||
}
|
||||
.projet-carte:hover .projet-carte__indice {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
padding: 0;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,651 @@
|
||||
<template>
|
||||
<div class="media-visuel">
|
||||
|
||||
<!-- Conteneur principal : carte → toolbar → chatbot (ou bonpote/rag-backend) -->
|
||||
<div class="layout-container">
|
||||
|
||||
<!-- SLOT CARTE D3 (mode carte uniquement) -->
|
||||
<div
|
||||
v-if="contentView === 'carte'"
|
||||
class="carte-slot"
|
||||
:class="[
|
||||
layoutMode === 'split' ? 'carte-split' : '',
|
||||
layoutMode === 'carte-full' ? 'carte-full' : '',
|
||||
layoutMode === 'chatbot-full' ? 'carte-hidden' : '',
|
||||
]"
|
||||
:style="layoutMode === 'split' ? { flexBasis: carteFlexBasis } : {}"
|
||||
style="position: relative;"
|
||||
>
|
||||
<ClientOnly>
|
||||
<CartePensees
|
||||
ref="cartePenseesRef"
|
||||
:data="penseesData"
|
||||
:active="true"
|
||||
@select-auteur="onSelectAuteur"
|
||||
@select-ecole="onSelectEcole"
|
||||
/>
|
||||
<template #fallback>
|
||||
<div class="w-full h-full flex items-center justify-center" style="color: var(--nav-text-muted);">
|
||||
Chargement de la carte...
|
||||
</div>
|
||||
</template>
|
||||
</ClientOnly>
|
||||
|
||||
<!-- Overlay PDF FRACAS -->
|
||||
<div
|
||||
v-if="showFracasPdf"
|
||||
class="fracas-overlay"
|
||||
:style="{ opacity: fracasOpacity / 100 }"
|
||||
>
|
||||
<embed
|
||||
src="/cartes/carte-fracas-bonpote-v2.pdf"
|
||||
type="application/pdf"
|
||||
style="width: 100%; height: 100%;"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- BARRE DE TOGGLE (entre carte et chatbot, toujours visible) -->
|
||||
<div class="layout-toggle-bar shrink-0">
|
||||
|
||||
<!-- Gauche : contrôles layout (seulement en mode carte) -->
|
||||
<template v-if="contentView === 'carte'">
|
||||
<button
|
||||
@click="layoutMode = 'carte-full'"
|
||||
:class="{ active: layoutMode === 'carte-full' }"
|
||||
class="toggle-btn"
|
||||
title="Carte en plein ecran"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/>
|
||||
<line x1="21" y1="3" x2="14" y2="10"/><line x1="3" y1="21" x2="10" y2="14"/>
|
||||
</svg>
|
||||
Carte plein ecran
|
||||
</button>
|
||||
<button
|
||||
v-if="layoutMode !== 'split'"
|
||||
@click="layoutMode = 'split'"
|
||||
class="toggle-btn"
|
||||
title="Vue partagee"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<rect x="3" y="3" width="18" height="18" rx="2"/><line x1="3" y1="12" x2="21" y2="12"/>
|
||||
</svg>
|
||||
Vue partagee
|
||||
</button>
|
||||
<button
|
||||
@click="layoutMode = 'chatbot-full'"
|
||||
:class="{ active: layoutMode === 'chatbot-full' }"
|
||||
class="toggle-btn"
|
||||
title="Chatbot plein ecran"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>
|
||||
</svg>
|
||||
Chatbot plein ecran
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<!-- Droite : contrôles contenu (toujours, indépendants du layoutMode) -->
|
||||
<div style="margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;">
|
||||
<!-- Slider opacité PDF -->
|
||||
<input
|
||||
v-if="showFracasPdf && contentView === 'carte'"
|
||||
type="range"
|
||||
min="0"
|
||||
max="100"
|
||||
v-model.number="fracasOpacity"
|
||||
class="opacity-slider"
|
||||
:title="`Opacité ${fracasOpacity}%`"
|
||||
/>
|
||||
|
||||
<!-- CARTE PRINCIPALE -->
|
||||
<button
|
||||
@click="showCarte"
|
||||
:class="{ active: contentView === 'carte' }"
|
||||
class="toggle-btn"
|
||||
title="Vue principale : carte D3 + chatbot"
|
||||
>
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="2"/><path d="M12 2a10 10 0 0 0-7.07 17.07M12 2a10 10 0 0 1 7.07 17.07M3.34 7h17.32M3.34 17h17.32"/>
|
||||
</svg>
|
||||
CARTE PRINCIPALE
|
||||
</button>
|
||||
|
||||
<!-- Tickbox PDF + carte des pensées -->
|
||||
<div class="carte-pensees-ctrl">
|
||||
<input
|
||||
type="checkbox"
|
||||
v-model="showFracasPdf"
|
||||
class="fracas-check"
|
||||
title="Superposer la carte FRACAS en PDF"
|
||||
/>
|
||||
<button
|
||||
@click="contentView = 'bonpote'"
|
||||
:class="{ active: contentView === 'bonpote' }"
|
||||
class="toggle-btn carte-pensees-btn"
|
||||
title="Carte des pensées écologiques — référence FRACAS Bonpote V2"
|
||||
>
|
||||
📗 carte des pensées écologiques
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- RAG backend -->
|
||||
<button
|
||||
@click="contentView = 'rag-backend'"
|
||||
:class="{ active: contentView === 'rag-backend' }"
|
||||
class="toggle-btn"
|
||||
title="Interface LightRAG backend"
|
||||
>
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<circle cx="12" cy="12" r="3"/><path d="M19.07 4.93a10 10 0 0 1 0 14.14M4.93 4.93a10 10 0 0 0 0 14.14"/>
|
||||
</svg>
|
||||
RAG backend
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- POIGNEE DRAGGABLE (split uniquement) -->
|
||||
<div
|
||||
v-if="contentView === 'carte' && layoutMode === 'split'"
|
||||
class="split-handle"
|
||||
@mousedown.prevent="onHandleMousedown"
|
||||
title="Redimensionner"
|
||||
>
|
||||
<span class="split-handle-grip"></span>
|
||||
</div>
|
||||
|
||||
<!-- SLOT CHATBOT (mode carte uniquement) -->
|
||||
<div
|
||||
v-if="contentView === 'carte'"
|
||||
class="chatbot-slot"
|
||||
:class="[
|
||||
layoutMode === 'split' ? 'chatbot-split' : '',
|
||||
layoutMode === 'chatbot-full' ? 'chatbot-full-mode' : '',
|
||||
layoutMode === 'carte-full' ? 'chatbot-hidden' : '',
|
||||
]"
|
||||
:style="layoutMode === 'split' ? { flexBasis: chatbotFlexBasis } : {}"
|
||||
>
|
||||
<ClientOnly>
|
||||
<ChatbotPensees :auteurContext="chatbotAuteur" :inline="true" />
|
||||
</ClientOnly>
|
||||
</div>
|
||||
|
||||
<!-- VUE BONPOTE -->
|
||||
<div
|
||||
v-if="contentView === 'bonpote'"
|
||||
class="flex-1 overflow-y-auto px-6 py-8"
|
||||
style="max-width: 680px; margin: 0 auto;"
|
||||
>
|
||||
<div class="mb-6">
|
||||
<p class="text-xs font-bold uppercase tracking-widest mb-2" style="color: var(--nav-text-muted);">Reference editoriale</p>
|
||||
<h2 class="text-xl font-bold mb-3" style="color: var(--nav-text);">Carte FRACAS des pensees ecologiques</h2>
|
||||
<p class="text-sm leading-relaxed mb-4" style="color: var(--nav-text);">
|
||||
FRACAS (Familles, Racines et Arpentages des Courants et Alternatives Solidaires) est une carte des ecoles de pensee ecologique publiee par Bonpote en octobre 2024. Elle reference ~140 auteurs et autrices reparti-es en 10 ecoles de pensee, depuis l'ecosocialisme jusqu'a l'ethique environnementale.
|
||||
</p>
|
||||
<p class="text-sm leading-relaxed mb-6" style="color: var(--nav-text);">
|
||||
Le RAG ATIS est construit sur cette reference : chaque auteur ingere dans la bibliotheque correspond a une entree de la carte FRACAS. Les ecoles de pensee, les positions et les couleurs de notre carte sont transposees 1:1 depuis Bonpote V2.
|
||||
</p>
|
||||
<div class="flex flex-col gap-3">
|
||||
<a href="https://bonpote.com/la-carte-des-pensees-ecologiques/"
|
||||
target="_blank" rel="noopener"
|
||||
class="flex items-center gap-3 px-4 py-3 rounded-lg hover:opacity-80 transition-opacity"
|
||||
style="background: var(--nav-primary, #3b6ea5); color: white; font-size: 0.875rem; font-weight: 600; text-decoration: none;">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg>
|
||||
Lire l'article Bonpote + carte interactive
|
||||
</a>
|
||||
<a href="https://bonpote.com/wp-content/uploads/2024/10/FRACAS_BONPOTE_CARTE_VERSO_V2-OCT2024.pdf"
|
||||
target="_blank" rel="noopener"
|
||||
class="flex items-center gap-3 px-4 py-3 rounded-lg hover:opacity-80 transition-opacity"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text); font-size: 0.875rem; font-weight: 500; text-decoration: none;">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" y1="15" x2="12" y2="3"/></svg>
|
||||
Telecharger le poster PDF (recto/verso)
|
||||
</a>
|
||||
<button
|
||||
@click="showCarte"
|
||||
class="flex items-center gap-3 px-4 py-3 rounded-lg hover:opacity-80 transition-opacity text-left"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text); font-size: 0.875rem; font-weight: 500; border: none; cursor: pointer;">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/></svg>
|
||||
Interroger le RAG ATIS sur ces pensees
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p class="text-xs font-bold uppercase tracking-widest mb-3" style="color: var(--nav-text-muted);">Les 10 ecoles de pensee (FRACAS V2)</p>
|
||||
<div class="flex flex-col gap-2">
|
||||
<div v-for="ecole in (penseesData?.ecoles ?? [])" :key="ecole.id"
|
||||
class="flex items-start gap-3 px-3 py-2 rounded-lg"
|
||||
style="background: var(--nav-bg-alt);">
|
||||
<span class="w-3 h-3 rounded-full shrink-0 mt-1" :style="`background:${ecole.color};`"></span>
|
||||
<div>
|
||||
<p class="text-sm font-semibold" style="color: var(--nav-text);">{{ ecole.label }}</p>
|
||||
<p class="text-xs mt-0.5 leading-relaxed" style="color: var(--nav-text-muted);">{{ ecole.description }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VUE RAG BACKEND -->
|
||||
<div
|
||||
v-if="contentView === 'rag-backend'"
|
||||
style="flex: 1; overflow: hidden; display: flex; flex-direction: column;"
|
||||
>
|
||||
<MediaTabBackend />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- Fiche auteur modal -->
|
||||
<FicheAuteur
|
||||
:open="ficheOpen"
|
||||
:auteurId="ficheAuteurId"
|
||||
:data="penseesData"
|
||||
@close="ficheOpen = false"
|
||||
@interroger-rag="onInterrogerRag"
|
||||
/>
|
||||
|
||||
<!-- Fiche ecole modal -->
|
||||
<FicheEcole
|
||||
:open="ficheEcoleOpen"
|
||||
:ecoleId="ficheEcoleId"
|
||||
:data="penseesData"
|
||||
@close="ficheEcoleOpen = false"
|
||||
@select-auteur="onSelectAuteurFromEcole"
|
||||
@interroger-ecole="onInterrogerEcole"
|
||||
/>
|
||||
|
||||
<!-- Modal info RAG -->
|
||||
<Teleport to="body">
|
||||
<Transition name="backdrop">
|
||||
<div v-if="ragInfoOpen" class="fixed inset-0 z-[2000]" style="background:rgba(26,34,56,0.55);" @click="ragInfoOpen = false" aria-hidden="true" />
|
||||
</Transition>
|
||||
<Transition name="modal">
|
||||
<div v-if="ragInfoOpen" class="fixed z-[2001] left-1/2 flex flex-col"
|
||||
style="top:50%;transform:translate(-50%,-50%);width:min(580px,94vw);max-height:85vh;background:var(--nav-bg);border-radius:14px;box-shadow:0 16px 64px rgba(26,34,56,0.28);overflow:hidden;"
|
||||
role="dialog" aria-modal="true" aria-label="À propos du RAG FRACAS">
|
||||
<div class="flex items-center justify-between px-5 py-4 shrink-0"
|
||||
style="border-bottom:2px solid var(--nav-bg-alt);background:var(--nav-surface);">
|
||||
<h2 class="font-bold text-base" style="color:var(--nav-text);">FRACAS - Bibliothèque des pensées écologiques</h2>
|
||||
<button @click="ragInfoOpen = false" class="ml-3 shrink-0 flex items-center justify-center w-8 h-8 rounded-full hover:opacity-70"
|
||||
style="background:var(--nav-bg-alt);color:var(--nav-text-muted);" aria-label="Fermer">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex-1 overflow-y-auto px-5 py-4" style="color:var(--nav-text);font-size:0.875rem;line-height:1.6;">
|
||||
<EchelleTete echelle="XL" compact @navigate="ragInfoOpen = false" />
|
||||
<p class="mb-3">Une bibliothèque parlante des pensées écologiques, organisée pour aider à créer une pensée complexe et nuancée, à soutenir l'écriture de nouveaux récits, des alternatives concrètes et des projets collectifs.</p>
|
||||
<p class="mb-4" style="color:var(--nav-text-muted);font-size:0.8rem;">Projet open source, ouvert à toutes et à tous - <a href="https://bonpote.com/la-carte-des-pensees-ecologiques/" target="_blank" rel="noopener" style="text-decoration:underline;">article + carte FRACAS Bonpote V2</a>.</p>
|
||||
<div class="flex flex-col gap-3">
|
||||
<div class="p-3 rounded-lg" style="background:var(--nav-bg-alt);">
|
||||
<p class="font-semibold mb-1" style="font-size:0.8rem;color:var(--nav-text-muted);text-transform:uppercase;letter-spacing:0.05em;">Ce qu'est un RAG</p>
|
||||
<p>Les textes sont vectorises dans un espace de 662 dimensions - chaque livre devient un nuage de points semantiques. La proximite entre les points capture la proximite entre les idees, pas les mots.</p>
|
||||
</div>
|
||||
<div class="p-3 rounded-lg" style="background:var(--nav-bg-alt);">
|
||||
<p class="font-semibold mb-1" style="font-size:0.8rem;color:var(--nav-text-muted);text-transform:uppercase;letter-spacing:0.05em;">Chunking intelligent</p>
|
||||
<p>Lors de l'ingestion, nous selectionnons les entites cles (concepts, auteurs, relations entre idees) plutot que de decouper mecaniquement les textes.</p>
|
||||
</div>
|
||||
<div class="p-3 rounded-lg" style="background:var(--nav-bg-alt);">
|
||||
<p class="font-semibold mb-2" style="font-size:0.8rem;color:var(--nav-text-muted);text-transform:uppercase;letter-spacing:0.05em;">Trois couches d'analyse</p>
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<div class="flex gap-2"><span class="font-semibold" style="min-width:70px;">Fond</span><span>Les idees, les theses, les arguments - ce qu'on interroge directement.</span></div>
|
||||
<div class="flex gap-2"><span class="font-semibold" style="min-width:70px;">Forme</span><span>Les modeles narratifs, la rhetorique, la construction argumentative.</span></div>
|
||||
<div class="flex gap-2"><span class="font-semibold" style="min-width:70px;">Structure</span><span>L'architecture des livres - comment les auteurs construisent leur pensee.</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface EcoleData { id: string; label: string; description: string; color: string; x_hint: number; y_hint: number }
|
||||
interface LivreRag { slug: string; titre: string; annee: number; couches: string[] }
|
||||
interface AuteurData { id: string; nom: string; dates: string; ecoles: string[]; ecole_principale: string; livres_rag: LivreRag[]; theses_cles: string[]; bio_courte: string }
|
||||
interface PenseesData { meta: any; ecoles: EcoleData[]; auteurs: AuteurData[] }
|
||||
|
||||
type LayoutMode = 'split' | 'carte-full' | 'chatbot-full'
|
||||
type ContentView = 'carte' | 'bonpote' | 'rag-backend'
|
||||
|
||||
const LAYOUT_KEY = 'media-layout-mode'
|
||||
const CONTENT_KEY = 'media-content-view'
|
||||
const SPLIT_RATIO_KEY = 'media-split-ratio'
|
||||
const DEFAULT_SPLIT_RATIO = 0.66
|
||||
|
||||
const ficheOpen = ref(false)
|
||||
const ficheAuteurId = ref<string | null>(null)
|
||||
const ficheEcoleOpen = ref(false)
|
||||
const ficheEcoleId = ref<string | null>(null)
|
||||
const ragInfoOpen = ref(false)
|
||||
const chatbotAuteur = ref<string | null>(null)
|
||||
|
||||
const layoutMode = ref<LayoutMode>('split')
|
||||
const contentView = ref<ContentView>('carte')
|
||||
const cartePenseesRef = ref<{ triggerResize: () => void } | null>(null)
|
||||
|
||||
const showFracasPdf = ref(false)
|
||||
const fracasOpacity = ref(60)
|
||||
|
||||
const penseesData = ref<PenseesData | null>(null)
|
||||
|
||||
const splitRatio = ref(DEFAULT_SPLIT_RATIO)
|
||||
const carteFlexBasis = computed(() => `${splitRatio.value * 100}%`)
|
||||
const chatbotFlexBasis = computed(() => `${(1 - splitRatio.value) * 100}%`)
|
||||
|
||||
let dragStartY = 0
|
||||
let dragStartRatio = DEFAULT_SPLIT_RATIO
|
||||
let containerHeight = 0
|
||||
|
||||
function showCarte() {
|
||||
contentView.value = 'carte'
|
||||
layoutMode.value = 'split'
|
||||
if (typeof window !== 'undefined') {
|
||||
localStorage.setItem(CONTENT_KEY, 'carte')
|
||||
localStorage.setItem(LAYOUT_KEY, 'split')
|
||||
}
|
||||
nextTick(() => cartePenseesRef.value?.triggerResize())
|
||||
}
|
||||
|
||||
function onHandleMousedown(e: MouseEvent) {
|
||||
dragStartY = e.clientY
|
||||
dragStartRatio = splitRatio.value
|
||||
const container = (e.target as HTMLElement)?.closest('.layout-container') as HTMLElement | null
|
||||
containerHeight = container ? container.clientHeight : window.innerHeight
|
||||
window.addEventListener('mousemove', onHandleMousemove)
|
||||
window.addEventListener('mouseup', onHandleMouseup)
|
||||
}
|
||||
|
||||
function onHandleMousemove(e: MouseEvent) {
|
||||
const delta = e.clientY - dragStartY
|
||||
const newRatio = dragStartRatio + delta / containerHeight
|
||||
splitRatio.value = Math.min(0.80, Math.max(0.20, newRatio))
|
||||
}
|
||||
|
||||
function onHandleMouseup() {
|
||||
window.removeEventListener('mousemove', onHandleMousemove)
|
||||
window.removeEventListener('mouseup', onHandleMouseup)
|
||||
if (typeof window !== 'undefined') localStorage.setItem(SPLIT_RATIO_KEY, String(splitRatio.value))
|
||||
cartePenseesRef.value?.triggerResize()
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
const savedLayout = localStorage.getItem(LAYOUT_KEY) as LayoutMode | null
|
||||
if (savedLayout && (['split', 'carte-full', 'chatbot-full'] as string[]).includes(savedLayout)) {
|
||||
layoutMode.value = savedLayout
|
||||
}
|
||||
const savedContent = localStorage.getItem(CONTENT_KEY) as ContentView | null
|
||||
if (savedContent && (['carte', 'bonpote', 'rag-backend'] as string[]).includes(savedContent)) {
|
||||
contentView.value = savedContent
|
||||
}
|
||||
const savedRatio = parseFloat(localStorage.getItem(SPLIT_RATIO_KEY) ?? '')
|
||||
if (!isNaN(savedRatio) && savedRatio >= 0.20 && savedRatio <= 0.80) {
|
||||
splitRatio.value = savedRatio
|
||||
}
|
||||
if (!localStorage.getItem('rag-fracas-info-seen')) {
|
||||
ragInfoOpen.value = true
|
||||
localStorage.setItem('rag-fracas-info-seen', '1')
|
||||
}
|
||||
}
|
||||
try {
|
||||
penseesData.value = await $fetch<PenseesData>('/data/auteurs-pensees.json')
|
||||
} catch (e) {
|
||||
console.error('Erreur chargement auteurs-pensees.json', e)
|
||||
}
|
||||
})
|
||||
|
||||
watch(layoutMode, (v) => {
|
||||
if (typeof window !== 'undefined') localStorage.setItem(LAYOUT_KEY, v)
|
||||
if (v === 'split' || v === 'carte-full') {
|
||||
setTimeout(() => cartePenseesRef.value?.triggerResize(), 350)
|
||||
}
|
||||
})
|
||||
|
||||
watch(contentView, (v) => {
|
||||
if (typeof window !== 'undefined') localStorage.setItem(CONTENT_KEY, v)
|
||||
})
|
||||
|
||||
function onSelectAuteur(id: string) {
|
||||
ficheAuteurId.value = id
|
||||
ficheOpen.value = true
|
||||
chatbotAuteur.value = null
|
||||
}
|
||||
|
||||
function onSelectEcole(id: string) {
|
||||
ficheEcoleId.value = id
|
||||
ficheEcoleOpen.value = true
|
||||
}
|
||||
|
||||
function onSelectAuteurFromEcole(auteurId: string) {
|
||||
ficheEcoleOpen.value = false
|
||||
onSelectAuteur(auteurId)
|
||||
}
|
||||
|
||||
function onInterrogerEcole(ecoleId: string) {
|
||||
ficheEcoleOpen.value = false
|
||||
const ecole = penseesData.value?.ecoles.find(e => e.id === ecoleId)
|
||||
chatbotAuteur.value = ecole?.label ?? null
|
||||
if (contentView.value !== 'carte') showCarte()
|
||||
else if (layoutMode.value === 'carte-full') layoutMode.value = 'split'
|
||||
}
|
||||
|
||||
function onInterrogerRag(auteurId: string) {
|
||||
ficheOpen.value = false
|
||||
const auteur = penseesData.value?.auteurs.find(a => a.id === auteurId)
|
||||
chatbotAuteur.value = auteur?.nom ?? null
|
||||
if (contentView.value !== 'carte') showCarte()
|
||||
else if (layoutMode.value === 'carte-full') layoutMode.value = 'split'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.media-visuel {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.layout-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* --- Slot carte --- */
|
||||
.carte-slot {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.carte-split {
|
||||
flex: 0 0 66%;
|
||||
min-height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.carte-full {
|
||||
flex: 1 1 100%;
|
||||
min-height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.carte-hidden {
|
||||
flex: 0 0 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* --- Overlay PDF FRACAS --- */
|
||||
.fracas-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 50;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* --- Barre de toggle (entre carte et chatbot) --- */
|
||||
.layout-toggle-bar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 12px;
|
||||
background: var(--nav-bg);
|
||||
border-top: 1px solid rgba(180, 170, 160, 0.22);
|
||||
border-bottom: 1px solid rgba(180, 170, 160, 0.22);
|
||||
min-height: 38px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.toggle-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 4px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text-muted);
|
||||
border: 1px solid transparent;
|
||||
transition: background 0.15s, color 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.toggle-btn:hover {
|
||||
background: var(--nav-surface);
|
||||
color: var(--nav-text);
|
||||
}
|
||||
|
||||
.toggle-btn.active {
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
border-color: var(--nav-primary);
|
||||
}
|
||||
|
||||
/* --- Contrôle fusionné carte des pensées --- */
|
||||
.carte-pensees-ctrl {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
border: 1px solid rgba(180, 170, 160, 0.3);
|
||||
}
|
||||
|
||||
.fracas-check {
|
||||
margin: 0 2px 0 7px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--nav-primary, #3b6ea5);
|
||||
}
|
||||
|
||||
.carte-pensees-btn {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.opacity-slider {
|
||||
width: 80px;
|
||||
cursor: pointer;
|
||||
accent-color: var(--nav-primary, #3b6ea5);
|
||||
}
|
||||
|
||||
/* --- Poignee draggable --- */
|
||||
.split-handle {
|
||||
flex-shrink: 0;
|
||||
height: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: row-resize;
|
||||
background: transparent;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.split-handle:hover {
|
||||
background: rgba(180, 170, 160, 0.18);
|
||||
}
|
||||
|
||||
.split-handle-grip {
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background: repeating-linear-gradient(
|
||||
to bottom,
|
||||
rgba(160, 150, 140, 0.55) 0px,
|
||||
rgba(160, 150, 140, 0.55) 1px,
|
||||
transparent 1px,
|
||||
transparent 3px
|
||||
);
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.split-handle { display: none; }
|
||||
}
|
||||
|
||||
/* --- Slot chatbot --- */
|
||||
.chatbot-slot {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
transition: opacity 0.2s ease;
|
||||
border-top: 1px solid rgba(180, 170, 160, 0.28);
|
||||
}
|
||||
|
||||
.chatbot-split {
|
||||
flex: 1 1 0;
|
||||
min-height: 120px;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.chatbot-full-mode {
|
||||
flex: 1 1 100%;
|
||||
min-height: 0;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.chatbot-hidden {
|
||||
flex: 0 0 0;
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* --- Transitions modal RAG info --- */
|
||||
.backdrop-enter-active,.backdrop-leave-active { transition: opacity 0.2s; }
|
||||
.backdrop-enter-from,.backdrop-leave-to { opacity: 0; }
|
||||
.modal-enter-active { transition: opacity 0.2s, transform 0.22s cubic-bezier(0.34,1.56,0.64,1); }
|
||||
.modal-leave-active { transition: opacity 0.18s, transform 0.18s ease-in; }
|
||||
.modal-enter-from { opacity: 0; transform: translate(-50%,-48%) scale(0.94); }
|
||||
.modal-leave-to { opacity: 0; transform: translate(-50%,-48%) scale(0.96); }
|
||||
|
||||
/* --- Mobile --- */
|
||||
@media (max-width: 767px) {
|
||||
.carte-split {
|
||||
flex: 0 0 60vh;
|
||||
height: 60vh;
|
||||
}
|
||||
.chatbot-split {
|
||||
flex: 1 1 0;
|
||||
min-height: 120px;
|
||||
}
|
||||
.toggle-btn {
|
||||
font-size: 0.7rem;
|
||||
padding: 3px 7px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="backdrop">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="fixed inset-0 z-[1500]"
|
||||
style="background: rgba(26,34,56,0.55);"
|
||||
@click="close"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</Transition>
|
||||
|
||||
<Transition name="modal">
|
||||
<div
|
||||
v-if="modelValue"
|
||||
class="mission-modal"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="mission-title"
|
||||
@keydown.esc="close"
|
||||
>
|
||||
<button
|
||||
class="mission-close"
|
||||
type="button"
|
||||
@click="close"
|
||||
aria-label="Fermer"
|
||||
>
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<div class="mission-body">
|
||||
<h2 id="mission-title" class="mission-title">{{ title }}</h2>
|
||||
<EchelleTete v-if="echelle" :echelle="echelle" compact @navigate="close" />
|
||||
<slot>
|
||||
<p class="mission-text">
|
||||
L'architecture est l'une des professions les plus complexes qui soit ; elle croise droit, technique, esthétique, économie, social, écologie — tout à la fois, tout simultanément, souvent sans filet. Paradoxalement, c'est aussi l'une des moins structurées sur le plan de l'entraide : peu de transmission horizontale, beaucoup d'isolement, une culture du chacun-pour-soi héritée d'une formation qui prépare à la compétition plus qu'à la coopération. On sort de l'école seul·e. On s'installe seul·e. On réinvente ce que d'autres ont déjà traversé.
|
||||
</p>
|
||||
<p class="mission-text">
|
||||
Cette carte est née de cette frustration — et de cette conviction : les ressources existent, les gens qui ont réussi à sortir la tête de l'eau aussi. L'enjeu, c'est de les documenter, de les rendre accessibles, de les ajuster en temps réel grâce aux retours de la communauté. Pas un catalogue figé ; un commun vivant, au service de ceux et celles qui cherchent à faire évoluer leur pratique vers quelque chose de plus épanouissant, mieux rémunéré, au service de la société — et qui prend soin de la santé, la nôtre et celle des gens pour qui nous construisons.
|
||||
</p>
|
||||
</slot>
|
||||
|
||||
<div class="mission-cta-wrap">
|
||||
<button class="btn-explorer" type="button" @click="close">{{ ctaLabel }}</button>
|
||||
<NuxtLink to="/manifeste" class="link-manifeste" @click="close">Lire le manifeste →</NuxtLink>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { EchelleId } from '~/utils/echelles'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
modelValue: boolean
|
||||
title?: string
|
||||
ctaLabel?: string
|
||||
storageKey?: string
|
||||
/** Tête d'échelle du deck (S / M / XL) affichée sous le titre. Absente sur /agences tant que l'arbitrage n° 1 n'est pas rendu. */
|
||||
echelle?: EchelleId
|
||||
}>(), {
|
||||
title: "L'écosystème d'entraide architecte",
|
||||
ctaLabel: 'Explorer la carte',
|
||||
storageKey: 'aep_mission_seen',
|
||||
})
|
||||
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: boolean] }>()
|
||||
|
||||
function close() {
|
||||
emit('update:modelValue', false)
|
||||
if (typeof window !== 'undefined') {
|
||||
try { localStorage.setItem(props.storageKey, '1') } catch {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mission-modal {
|
||||
position: fixed;
|
||||
z-index: 1501;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: min(560px, 92vw);
|
||||
max-height: calc(100dvh - 80px);
|
||||
background: var(--nav-bg);
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 16px 64px rgba(26,34,56,0.28);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mission-close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text-muted);
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background 0.15s;
|
||||
z-index: 1;
|
||||
}
|
||||
.mission-close:hover { background: var(--nav-surface); }
|
||||
|
||||
.mission-body {
|
||||
padding: 1.75rem 1.5rem 1.5rem;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.mission-title {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
color: var(--nav-text);
|
||||
margin: 0 0 1rem;
|
||||
line-height: 1.25;
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
.mission-text,
|
||||
:slotted(.mission-text) {
|
||||
font-size: 0.95rem;
|
||||
line-height: 1.65;
|
||||
color: var(--nav-text);
|
||||
margin: 0 0 1rem;
|
||||
}
|
||||
:slotted(.mission-text strong) { font-weight: 700; }
|
||||
:slotted(.mission-text a) { color: var(--nav-primary-solid); text-decoration: underline; }
|
||||
|
||||
.mission-cta-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
.btn-explorer {
|
||||
padding: 0.65rem 1.25rem;
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
.btn-explorer:hover { opacity: 0.88; }
|
||||
|
||||
.link-manifeste {
|
||||
font-size: 0.875rem;
|
||||
color: var(--nav-primary-solid);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 2px;
|
||||
}
|
||||
.link-manifeste:hover { opacity: 0.75; }
|
||||
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: opacity 0.2s ease; }
|
||||
.backdrop-enter-from, .backdrop-leave-to { opacity: 0; }
|
||||
|
||||
.modal-enter-active, .modal-leave-active { transition: opacity 0.2s ease, transform 0.2s ease; }
|
||||
.modal-enter-from, .modal-leave-to { opacity: 0; transform: translate(-50%, -48%); }
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.mission-body { padding: 1.5rem 1.1rem 1.25rem; }
|
||||
.mission-title { font-size: 1.1rem; }
|
||||
.mission-text { font-size: 0.9rem; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.modal-enter-active, .modal-leave-active { transition: none; }
|
||||
.backdrop-enter-active, .backdrop-leave-active { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,218 +0,0 @@
|
||||
<!--
|
||||
MobileSheet — Bottom sheet swipable 3 états (collapsed / half / full)
|
||||
Pattern Google Maps mobile
|
||||
|
||||
États :
|
||||
- collapsed : juste la poignée + compteur (~56px)
|
||||
- half : ~50dvh (état initial)
|
||||
- full : ~92dvh (plein écran)
|
||||
|
||||
Déclenché par touch/drag sur la poignée
|
||||
-->
|
||||
<template>
|
||||
<div
|
||||
class="mobile-sheet"
|
||||
:class="`mobile-sheet--${state}`"
|
||||
:style="{ transform: `translateY(${dragOffset}px)` }"
|
||||
>
|
||||
<!-- Poignée drag -->
|
||||
<div
|
||||
class="sheet-handle-area"
|
||||
@touchstart.passive="onTouchStart"
|
||||
@touchmove.passive="onTouchMove"
|
||||
@touchend="onTouchEnd"
|
||||
>
|
||||
<div class="sheet-handle-bar" />
|
||||
</div>
|
||||
|
||||
<!-- Compteur compact (toujours visible) -->
|
||||
<div class="sheet-header" @click="onHeaderClick">
|
||||
<span class="sheet-counter">
|
||||
<span v-if="pending">Chargement…</span>
|
||||
<span v-else>{{ resultCount }} fiche{{ resultCount > 1 ? 's' : '' }}</span>
|
||||
</span>
|
||||
<svg
|
||||
width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor"
|
||||
stroke-width="2.5" stroke-linecap="round" aria-hidden="true"
|
||||
class="sheet-chevron"
|
||||
:class="{ 'sheet-chevron--up': state !== 'collapsed' }"
|
||||
style="color: var(--nav-text-muted); flex-shrink: 0;"
|
||||
>
|
||||
<polyline points="18 15 12 9 6 15"/>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<!-- Contenu scrollable (caché si collapsed) -->
|
||||
<div
|
||||
v-show="state !== 'collapsed'"
|
||||
ref="contentEl"
|
||||
class="sheet-content"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
type SheetState = 'collapsed' | 'half' | 'full'
|
||||
|
||||
const props = defineProps<{
|
||||
resultCount: number
|
||||
pending?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'state-change': [state: SheetState]
|
||||
}>()
|
||||
|
||||
const state = ref<SheetState>('half')
|
||||
const dragOffset = ref(0)
|
||||
const contentEl = ref<HTMLElement | null>(null)
|
||||
|
||||
let touchStartY = 0
|
||||
let touchCurrentY = 0
|
||||
let isDragging = false
|
||||
|
||||
// Cycle états au clic header
|
||||
function onHeaderClick() {
|
||||
if (state.value === 'collapsed') {
|
||||
setSheetState('half')
|
||||
} else if (state.value === 'half') {
|
||||
setSheetState('full')
|
||||
} else {
|
||||
setSheetState('collapsed')
|
||||
}
|
||||
}
|
||||
|
||||
function setSheetState(next: SheetState) {
|
||||
state.value = next
|
||||
dragOffset.value = 0
|
||||
emit('state-change', next)
|
||||
}
|
||||
|
||||
// Touch handlers
|
||||
function onTouchStart(e: TouchEvent) {
|
||||
touchStartY = e.touches[0].clientY
|
||||
touchCurrentY = touchStartY
|
||||
isDragging = true
|
||||
dragOffset.value = 0
|
||||
}
|
||||
|
||||
function onTouchMove(e: TouchEvent) {
|
||||
if (!isDragging) return
|
||||
touchCurrentY = e.touches[0].clientY
|
||||
const delta = touchCurrentY - touchStartY
|
||||
// Limiter le drag visuellement (résistance)
|
||||
dragOffset.value = delta * 0.6
|
||||
}
|
||||
|
||||
function onTouchEnd() {
|
||||
if (!isDragging) return
|
||||
isDragging = false
|
||||
|
||||
const delta = touchCurrentY - touchStartY
|
||||
const threshold = 60 // px minimum pour changer d'état
|
||||
|
||||
if (delta > threshold) {
|
||||
// Swipe vers le bas → état inférieur
|
||||
if (state.value === 'full') setSheetState('half')
|
||||
else if (state.value === 'half') setSheetState('collapsed')
|
||||
else setSheetState('collapsed')
|
||||
} else if (delta < -threshold) {
|
||||
// Swipe vers le haut → état supérieur
|
||||
if (state.value === 'collapsed') setSheetState('half')
|
||||
else if (state.value === 'half') setSheetState('full')
|
||||
else setSheetState('full')
|
||||
} else {
|
||||
// Snap back
|
||||
dragOffset.value = 0
|
||||
}
|
||||
|
||||
// Transition smooth au relâchement
|
||||
dragOffset.value = 0
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.mobile-sheet {
|
||||
position: fixed;
|
||||
inset-x: 0;
|
||||
bottom: 0;
|
||||
z-index: 500;
|
||||
background: var(--nav-surface);
|
||||
border-radius: 16px 16px 0 0;
|
||||
box-shadow: 0 -4px 24px rgba(26, 34, 56, 0.14);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: height 0.3s cubic-bezier(0.32, 0.72, 0, 1), transform 0.05s linear;
|
||||
will-change: height, transform;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ── États hauteur ───────────────────────────────────────────────────── */
|
||||
.mobile-sheet--collapsed {
|
||||
height: 56px;
|
||||
}
|
||||
|
||||
.mobile-sheet--half {
|
||||
height: 50dvh;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.mobile-sheet--full {
|
||||
height: 92dvh;
|
||||
}
|
||||
|
||||
/* ── Poignée ─────────────────────────────────────────────────────────── */
|
||||
.sheet-handle-area {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 10px 0 4px;
|
||||
cursor: grab;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sheet-handle-area:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.sheet-handle-bar {
|
||||
width: 36px;
|
||||
height: 4px;
|
||||
border-radius: 2px;
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
/* ── Header compteur ─────────────────────────────────────────────────── */
|
||||
.sheet-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 16px 8px;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sheet-counter {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.sheet-chevron {
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
.sheet-chevron--up {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
/* ── Contenu scrollable ──────────────────────────────────────────────── */
|
||||
.sheet-content {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
}
|
||||
</style>
|
||||
@@ -1,241 +0,0 @@
|
||||
<template>
|
||||
<div class="relative w-full h-full">
|
||||
<div ref="mapContainer" class="w-full h-full rounded-none" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Map, Marker, DivIcon } from 'leaflet'
|
||||
|
||||
interface Org {
|
||||
Id: number
|
||||
nom: string
|
||||
latitude?: number | null
|
||||
longitude?: number | null
|
||||
echelle?: string
|
||||
tags_fonction?: string
|
||||
territoire?: string
|
||||
localisation_ville?: string
|
||||
url?: string
|
||||
prioritaire?: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
orgs: Org[]
|
||||
selectedId?: number | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'select-org': [id: number]
|
||||
}>()
|
||||
|
||||
const mapContainer = ref<HTMLElement | null>(null)
|
||||
let mapInstance: Map | null = null
|
||||
let clusterGroup: any = null
|
||||
const markers = new Map<number, Marker>()
|
||||
let tileLayerInstance: any = null
|
||||
|
||||
// Créer une DivIcon pour les pins personnalisés
|
||||
function createPinIcon(isPrioritaire: boolean, isSelected = false): DivIcon {
|
||||
const L = (window as any).L
|
||||
const bg = isPrioritaire ? '#f5b342' : 'rgba(26, 34, 56, 0.6)'
|
||||
const border = isPrioritaire ? '#1a2238' : '#ffffff'
|
||||
const size = isSelected ? 18 : 14
|
||||
const shadow = isSelected ? '0 0 0 4px rgba(245,179,66,0.5)' : 'none'
|
||||
|
||||
return L.divIcon({
|
||||
className: '',
|
||||
html: `<div style="
|
||||
width: ${size}px;
|
||||
height: ${size}px;
|
||||
border-radius: 50%;
|
||||
background: ${bg};
|
||||
border: 2px solid ${border};
|
||||
box-shadow: ${shadow};
|
||||
transition: all 0.2s;
|
||||
"></div>`,
|
||||
iconSize: [size, size],
|
||||
iconAnchor: [size / 2, size / 2],
|
||||
popupAnchor: [0, -(size / 2 + 4)],
|
||||
})
|
||||
}
|
||||
|
||||
async function initMap() {
|
||||
if (!mapContainer.value) return
|
||||
|
||||
const Lmod = await import('leaflet')
|
||||
const L: any = (Lmod as any).default || Lmod
|
||||
await import('leaflet/dist/leaflet.css')
|
||||
// @ts-ignore
|
||||
await import('leaflet.markercluster/dist/MarkerCluster.css')
|
||||
// @ts-ignore
|
||||
await import('leaflet.markercluster/dist/MarkerCluster.Default.css')
|
||||
|
||||
// Installer L globalement AVANT le plugin (markercluster lit window.L au load)
|
||||
;(window as any).L = L
|
||||
// @ts-ignore — étend L.MarkerClusterGroup en side effect
|
||||
await import('leaflet.markercluster')
|
||||
const MarkerClusterGroup = L.MarkerClusterGroup
|
||||
|
||||
mapInstance = L.map(mapContainer.value, {
|
||||
center: [46.6, 2.3],
|
||||
zoom: 6,
|
||||
zoomControl: true,
|
||||
attributionControl: true,
|
||||
maxBounds: [[41.0, -5.5], [51.5, 10.0]],
|
||||
maxBoundsViscosity: 1.0,
|
||||
minZoom: 5,
|
||||
maxZoom: 18,
|
||||
})
|
||||
|
||||
// Fond de carte CartoDB Positron (light ou dark selon theme)
|
||||
const isDark = typeof document !== 'undefined' && document.documentElement.classList.contains('dark')
|
||||
const tileUrl = isDark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
|
||||
|
||||
tileLayerInstance = L.tileLayer(tileUrl, {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>',
|
||||
maxZoom: 19,
|
||||
})
|
||||
tileLayerInstance.addTo(mapInstance!)
|
||||
|
||||
// Cluster dès 15+ pins
|
||||
clusterGroup = new MarkerClusterGroup({
|
||||
disableClusteringAtZoom: 14,
|
||||
maxClusterRadius: 50,
|
||||
showCoverageOnHover: false,
|
||||
iconCreateFunction: (cluster: any) => {
|
||||
const count = cluster.getChildCount()
|
||||
return L.divIcon({
|
||||
html: `<div style="
|
||||
width: 36px; height: 36px; border-radius: 50%;
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
display: flex; align-items: center; justify-content: center;
|
||||
font-weight: 700; font-size: 13px;
|
||||
border: 2px solid white;
|
||||
font-family: var(--nav-font);
|
||||
">${count}</div>`,
|
||||
className: '',
|
||||
iconSize: [36, 36],
|
||||
iconAnchor: [18, 18],
|
||||
})
|
||||
},
|
||||
})
|
||||
|
||||
mapInstance.addLayer(clusterGroup)
|
||||
updateMarkers(L)
|
||||
}
|
||||
|
||||
function updateMarkers(L?: any) {
|
||||
if (!mapInstance || !clusterGroup) return
|
||||
const leaflet = L || (window as any).L
|
||||
if (!leaflet) return
|
||||
|
||||
// Clear existing
|
||||
clusterGroup.clearLayers()
|
||||
markers.clear()
|
||||
|
||||
const orgsWithCoords = props.orgs.filter(
|
||||
(o) => o.latitude != null && o.longitude != null
|
||||
)
|
||||
|
||||
orgsWithCoords.forEach((org) => {
|
||||
const isSelected = org.Id === props.selectedId
|
||||
const icon = createPinIcon(!!org.prioritaire, isSelected)
|
||||
|
||||
const marker = leaflet.marker([org.latitude!, org.longitude!], { icon })
|
||||
|
||||
const fonctions = org.tags_fonction
|
||||
? org.tags_fonction.split(',').map((f: string) => f.trim()).filter(Boolean).slice(0, 2).join(', ')
|
||||
: ''
|
||||
|
||||
marker.bindPopup(`
|
||||
<div style="font-family: var(--nav-font); min-width: 180px; padding: 4px 0;">
|
||||
<div style="font-weight: 700; color: var(--nav-text); margin-bottom: 4px;">${org.nom}</div>
|
||||
${org.echelle ? `<div style="font-size: 11px; color: var(--nav-text-muted);">${org.echelle}${org.localisation_ville ? ' · ' + org.localisation_ville : ''}</div>` : ''}
|
||||
${fonctions ? `<div style="font-size: 11px; color: var(--nav-text-muted); margin-top: 2px;">${fonctions}</div>` : ''}
|
||||
<a href="/fiche/${org.Id}" style="
|
||||
display: inline-block; margin-top: 8px; font-size: 12px;
|
||||
color: var(--nav-primary-solid); text-decoration: underline;
|
||||
">Voir la fiche →</a>
|
||||
</div>
|
||||
`, { maxWidth: 240 })
|
||||
|
||||
marker.on('click', () => emit('select-org', org.Id))
|
||||
|
||||
markers.set(org.Id, marker)
|
||||
clusterGroup.addLayer(marker)
|
||||
})
|
||||
}
|
||||
|
||||
// Réagir aux changements de filtres (liste d'orgs)
|
||||
watch(
|
||||
() => props.orgs,
|
||||
() => updateMarkers(),
|
||||
{ deep: false }
|
||||
)
|
||||
|
||||
// Réagir à la sélection
|
||||
watch(
|
||||
() => props.selectedId,
|
||||
(newId, oldId) => {
|
||||
if (!mapInstance) return
|
||||
const leaflet = (window as any).L
|
||||
if (!leaflet) return
|
||||
|
||||
// Remettre l'ancien marker à la normale
|
||||
if (oldId != null) {
|
||||
const oldMarker = markers.get(oldId)
|
||||
const oldOrg = props.orgs.find(o => o.Id === oldId)
|
||||
if (oldMarker && oldOrg) {
|
||||
oldMarker.setIcon(createPinIcon(!!oldOrg.prioritaire, false))
|
||||
}
|
||||
}
|
||||
// Mettre en avant le nouveau marker
|
||||
if (newId != null) {
|
||||
const newMarker = markers.get(newId)
|
||||
const newOrg = props.orgs.find(o => o.Id === newId)
|
||||
if (newMarker && newOrg) {
|
||||
newMarker.setIcon(createPinIcon(!!newOrg.prioritaire, true))
|
||||
// Centrer si visible
|
||||
const latLng = newMarker.getLatLng()
|
||||
mapInstance.panTo(latLng, { animate: true })
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Watcher dark mode — switch tuile CartoDB light_all ↔ dark_all
|
||||
function updateTileTheme(dark: boolean) {
|
||||
if (!mapInstance || !tileLayerInstance) return
|
||||
const L = (window as any).L
|
||||
if (!L) return
|
||||
const url = dark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
|
||||
tileLayerInstance.setUrl(url)
|
||||
}
|
||||
|
||||
let themeObserver: MutationObserver | null = null
|
||||
|
||||
onMounted(() => {
|
||||
initMap()
|
||||
|
||||
// Observer les changements de classe dark sur <html>
|
||||
themeObserver = new MutationObserver(() => {
|
||||
const dark = document.documentElement.classList.contains('dark')
|
||||
updateTileTheme(dark)
|
||||
})
|
||||
themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
themeObserver?.disconnect()
|
||||
if (mapInstance) {
|
||||
mapInstance.remove()
|
||||
mapInstance = null
|
||||
}
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,210 @@
|
||||
<!--
|
||||
NavPortes — B14b-M2
|
||||
La barre des échelles à toutes les largeurs : les trois ronds S — M — XL de l'entrée
|
||||
(BandeauEchelles, en mode bouton), puis, à partir de 768 px, le nom de l'échelle courante
|
||||
et l'onglet courant en petit (« La communauté · Codev »). Plus aucun onglet à plat :
|
||||
un rond ouvre le volet de son échelle (VoletEchelle), sous la barre et par-dessus la page,
|
||||
et c'est dans le volet qu'on choisit une section (direction de Jules du 31/10).
|
||||
Le rond de l'échelle courante reste `aria-current="page"`, volet fermé ou non.
|
||||
Fermer : second clic sur le même rond, Échap, clic hors de la barre et du volet, focus
|
||||
qui sort, changement de route. Le focus revient au rond quand il était dans la barre.
|
||||
Clavier : Tab entre les ronds ; Entrée ou Espace ouvre ; volet ouvert, ← → passent d'un
|
||||
rond à l'autre (le volet suit) ; Tab depuis le rond ouvert entre dans le volet ; Échap ferme.
|
||||
Taille : 44 px à partir de 768 px ; 36 px dessous (trait plus court), cible tactile 44 px.
|
||||
Textes et ordre : utils/echelles.ts (echelleDeBarre), rien de recopié.
|
||||
-->
|
||||
<template>
|
||||
<div ref="racine" class="nav-portes" :class="{ 'nav-portes--ouvert': ouvert }" @keydown="onKeydown" @focusout="onFocusout">
|
||||
<BandeauEchelles
|
||||
class="nav-portes__pas"
|
||||
:actif="courant?.echelle ?? null"
|
||||
:lien="lienEntree"
|
||||
courant="page"
|
||||
libelle="Échelles S, M, XL : ouvrir une échelle"
|
||||
:nom="false"
|
||||
:bouton="{ ouvert, controle: ID_VOLET, choisir: basculer }"
|
||||
/>
|
||||
<p v-if="courant" class="nav-portes__ici">
|
||||
<span class="nav-portes__echelle">{{ ECHELLES[courant.echelle].titre }}</span>
|
||||
<template v-if="courant.onglet">
|
||||
<span class="nav-portes__sep" aria-hidden="true"> · </span>
|
||||
<span class="nav-portes__onglet">{{ courant.onglet.libelle }}</span>
|
||||
</template>
|
||||
</p>
|
||||
<VoletEchelle :id="ID_VOLET" ref="volet" :echelle="ouvert" @choisi="fermer(true)" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BandeauEchelles from '~/components/entree/BandeauEchelles.vue'
|
||||
import { ECHELLES, ORDRE_ECHELLES, PARAM_PORTE, echelleDeBarre, voisines, type EchelleId } from '~/utils/echelles'
|
||||
|
||||
const ID_VOLET = 'volet-echelle'
|
||||
|
||||
const route = useRoute()
|
||||
const courant = computed(() => echelleDeBarre(route))
|
||||
const ouvert = ref<EchelleId | null>(null)
|
||||
const racine = ref<HTMLElement | null>(null)
|
||||
const volet = ref<{ premierFocus: () => HTMLElement | null } | null>(null)
|
||||
|
||||
/** Le rond ne navigue pas ; `lien` sert de repli au composant et au tiroir : la porte de l'entrée. */
|
||||
const lienEntree = (id: EchelleId) => ({ path: '/entree', query: { [PARAM_PORTE]: id } })
|
||||
|
||||
const rond = (id: EchelleId) => racine.value?.querySelector<HTMLElement>(`.pas__rond[data-porte="${id}"]`) ?? null
|
||||
|
||||
function basculer(id: EchelleId) {
|
||||
ouvert.value = ouvert.value === id ? null : id
|
||||
}
|
||||
|
||||
/** `rendreFocus` : le focus était dans la barre ou le volet, il revient au rond qui avait ouvert. */
|
||||
function fermer(rendreFocus: boolean) {
|
||||
const id = ouvert.value
|
||||
if (!id) return
|
||||
ouvert.value = null
|
||||
if (rendreFocus) nextTick(() => rond(id)?.focus())
|
||||
}
|
||||
|
||||
function lateral(pas: -1 | 1) {
|
||||
if (!ouvert.value) return
|
||||
const v = voisines(ouvert.value)
|
||||
const cible = pas < 0 ? v.precedente : v.suivante
|
||||
if (!cible) return
|
||||
ouvert.value = cible
|
||||
rond(cible)?.focus()
|
||||
}
|
||||
|
||||
function onKeydown(ev: KeyboardEvent) {
|
||||
if (!ouvert.value || ev.altKey || ev.ctrlKey || ev.metaKey) return
|
||||
const cible = ev.target as HTMLElement
|
||||
const surRond = cible.classList?.contains('pas__rond')
|
||||
if (ev.key === 'Escape') {
|
||||
ev.preventDefault()
|
||||
fermer(true)
|
||||
} else if ((ev.key === 'ArrowLeft' || ev.key === 'ArrowRight') && !ev.shiftKey) {
|
||||
ev.preventDefault()
|
||||
lateral(ev.key === 'ArrowLeft' ? -1 : 1)
|
||||
} else if (ev.key === 'Tab' && !ev.shiftKey && surRond && cible.dataset.porte === ouvert.value) {
|
||||
// Depuis le rond ouvert, Tab entre dans le volet (les autres ronds restent à Tab dans l'ordre).
|
||||
const premier = volet.value?.premierFocus()
|
||||
if (premier) { ev.preventDefault(); premier.focus() }
|
||||
} else if (ev.key === 'Tab' && ev.shiftKey && cible === volet.value?.premierFocus()) {
|
||||
ev.preventDefault()
|
||||
rond(ouvert.value)?.focus()
|
||||
}
|
||||
}
|
||||
|
||||
/** Le focus quitte la barre et le volet (Tab au-delà du dernier lien, clic ailleurs) : on referme sans le reprendre. */
|
||||
function onFocusout(ev: FocusEvent) {
|
||||
const vers = ev.relatedTarget as Node | null
|
||||
if (ouvert.value && vers && !racine.value?.contains(vers)) fermer(false)
|
||||
}
|
||||
|
||||
// Clic hors de la barre et du volet : fermer, sans voler le focus de ce qu'on vient de toucher.
|
||||
function onPointerdown(ev: PointerEvent) {
|
||||
if (ouvert.value && !racine.value?.contains(ev.target as Node)) fermer(false)
|
||||
}
|
||||
// Échap ailleurs dans la page (focus resté sur la carte, par ex.) : en capture, avant l'entrée.
|
||||
function onEchap(ev: KeyboardEvent) {
|
||||
if (ev.key !== 'Escape' || !ouvert.value || racine.value?.contains(ev.target as Node)) return
|
||||
if (document.querySelector('[aria-modal="true"]')) return
|
||||
ev.preventDefault()
|
||||
fermer(false)
|
||||
}
|
||||
|
||||
watch(ouvert, (n) => {
|
||||
if (n) {
|
||||
document.addEventListener('pointerdown', onPointerdown)
|
||||
document.addEventListener('keydown', onEchap, true)
|
||||
} else {
|
||||
document.removeEventListener('pointerdown', onPointerdown)
|
||||
document.removeEventListener('keydown', onEchap, true)
|
||||
}
|
||||
})
|
||||
|
||||
// Changement de route (une section choisie, Précédent du navigateur) : le volet se referme.
|
||||
watch(() => route.fullPath, () => {
|
||||
if (!ouvert.value) return
|
||||
const dedans = racine.value?.contains(document.activeElement) ?? false
|
||||
fermer(dedans)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
document.removeEventListener('pointerdown', onPointerdown)
|
||||
document.removeEventListener('keydown', onEchap, true)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.nav-portes {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Sous 768 px : ronds de 36 px, trait plus court ; la cible reste de 44 px (pseudo-élément). */
|
||||
.nav-portes__pas :deep(.pas__rond) {
|
||||
position: relative;
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
font-size: var(--fs-xs);
|
||||
cursor: pointer;
|
||||
}
|
||||
.nav-portes__pas :deep(.pas__rond)::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -6px;
|
||||
}
|
||||
.nav-portes__pas :deep(.pas__item + .pas__item)::before {
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
/* Volet ouvert : le rond ouvert passe en safran plein (transition de BandeauEchelles) ;
|
||||
celui de la page, s'il est autre, garde un contour safran (on sait toujours où l'on est). */
|
||||
.nav-portes__pas :deep(.pas__rond--ouvert) {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
.nav-portes--ouvert .nav-portes__pas :deep(.pas__rond--actif:not(.pas__rond--ouvert)) {
|
||||
border-color: var(--accent);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.nav-portes__ici {
|
||||
display: none;
|
||||
margin: 0;
|
||||
min-width: 0;
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.3;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.nav-portes__echelle {
|
||||
font-weight: var(--fw-semibold);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.nav-portes__pas :deep(.pas__rond) {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: 15px;
|
||||
}
|
||||
.nav-portes__pas :deep(.pas__rond)::after { inset: 0; }
|
||||
.nav-portes__pas :deep(.pas__item + .pas__item)::before { width: 16px; }
|
||||
.nav-portes__ici { display: block; }
|
||||
}
|
||||
/* À partir de 768 : l'échelle et l'onglet l'un sous l'autre (la barre est étroite) ; sur une ligne à partir de 1024 (min-width seulement, PROTOCOLE) */
|
||||
@media (min-width: 768px) {
|
||||
.nav-portes__echelle,
|
||||
.nav-portes__onglet { display: block; white-space: nowrap; }
|
||||
.nav-portes__sep { display: none; }
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.nav-portes__echelle,
|
||||
.nav-portes__onglet,
|
||||
.nav-portes__sep { display: inline; }
|
||||
.nav-portes__ici { white-space: nowrap; }
|
||||
}
|
||||
</style>
|
||||
@@ -1,257 +0,0 @@
|
||||
<template>
|
||||
<aside
|
||||
class="flex flex-col h-full overflow-hidden"
|
||||
style="background: var(--nav-surface); border-right: 1px solid var(--nav-bg-alt);"
|
||||
>
|
||||
|
||||
<!-- ═══════════════════════════════════ BARRE DE RECHERCHE (tout en haut) -->
|
||||
<div
|
||||
class="shrink-0 px-4 pt-4 pb-3 border-b"
|
||||
style="border-color: var(--nav-bg-alt);"
|
||||
>
|
||||
<label class="sidebar-search-label" aria-label="Rechercher une organisation">
|
||||
<svg
|
||||
width="15" height="15" viewBox="0 0 24 24"
|
||||
fill="none" stroke="currentColor" stroke-width="2"
|
||||
stroke-linecap="round" stroke-linejoin="round"
|
||||
aria-hidden="true"
|
||||
class="sidebar-search-icon"
|
||||
>
|
||||
<circle cx="11" cy="11" r="8"/>
|
||||
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
|
||||
</svg>
|
||||
<input
|
||||
ref="searchInputEl"
|
||||
:value="search"
|
||||
type="search"
|
||||
placeholder="Rechercher une organisation…"
|
||||
class="sidebar-search-input"
|
||||
autocomplete="off"
|
||||
@input="emit('update:search', ($event.target as HTMLInputElement).value)"
|
||||
/>
|
||||
<button
|
||||
v-if="search"
|
||||
type="button"
|
||||
class="sidebar-search-clear"
|
||||
aria-label="Effacer la recherche"
|
||||
@click.stop="emit('update:search', '')"
|
||||
>
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
||||
<line x1="18" y1="6" x2="6" y2="18"/>
|
||||
<line x1="6" y1="6" x2="18" y2="18"/>
|
||||
</svg>
|
||||
</button>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- ═══════════════════════════════════ FILTRES (haut, compact) -->
|
||||
<div
|
||||
class="shrink-0 px-4 pt-3 pb-3 space-y-4 border-b"
|
||||
style="border-color: var(--nav-bg-alt);"
|
||||
>
|
||||
<!-- Échelle (checkbox compactes) -->
|
||||
<EchelleFilter
|
||||
:modelValue="echelle"
|
||||
:counts="echelleCount"
|
||||
@update:modelValue="emit('update:echelle', $event)"
|
||||
/>
|
||||
|
||||
<!-- Fonctions (checkbox compactes) -->
|
||||
<FonctionFilter
|
||||
:modelValue="fonctions"
|
||||
:counts="fonctionCount"
|
||||
@update:modelValue="emit('update:fonctions', $event)"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- ═══════════════════════════════════ LISTE FICHES (milieu, scrollable) -->
|
||||
<div class="flex-1 flex flex-col min-h-0">
|
||||
<!-- Header liste -->
|
||||
<div
|
||||
class="shrink-0 flex items-center justify-between px-4 py-2 border-b"
|
||||
style="border-color: var(--nav-bg-alt);"
|
||||
>
|
||||
<span class="text-xs font-bold uppercase tracking-widest" style="color: var(--nav-text-muted);">
|
||||
{{ resultCount }} résultat{{ resultCount > 1 ? 's' : '' }}
|
||||
</span>
|
||||
<button
|
||||
v-if="hasActiveFilters"
|
||||
@click="emit('reset-filters')"
|
||||
class="text-xs underline hover:opacity-70"
|
||||
style="color: var(--nav-text-muted);"
|
||||
>
|
||||
Effacer les filtres
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Liste scrollable -->
|
||||
<div class="flex-1 overflow-y-auto px-3 py-2 space-y-1.5">
|
||||
<div
|
||||
v-if="pending"
|
||||
class="flex items-center justify-center py-8"
|
||||
style="color: var(--nav-text-muted);"
|
||||
>
|
||||
Chargement…
|
||||
</div>
|
||||
|
||||
<div v-else-if="orgs.length === 0" class="text-center py-8">
|
||||
<p class="text-xs" style="color: var(--nav-text-muted);">Aucun résultat</p>
|
||||
</div>
|
||||
|
||||
<!-- Card fiche compacte -->
|
||||
<div
|
||||
v-for="org in orgs"
|
||||
:key="org.Id"
|
||||
class="rounded-lg px-3 py-2 cursor-pointer transition-all"
|
||||
:style="selectedId === org.Id
|
||||
? 'background: var(--nav-bg-alt); border-left: 3px solid var(--nav-accent); padding-left: 9px;'
|
||||
: 'background: var(--nav-bg); border-left: 3px solid transparent; padding-left: 9px;'"
|
||||
@click="emit('select-org', org.Id)"
|
||||
@mouseenter="emit('hover-org', org.Id)"
|
||||
@mouseleave="emit('hover-org', null)"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-1.5">
|
||||
<span
|
||||
class="font-semibold text-sm leading-snug"
|
||||
style="color: var(--nav-text);"
|
||||
>{{ org.nom }}</span>
|
||||
<span
|
||||
v-if="org.echelle"
|
||||
class="shrink-0 px-1.5 py-0.5 rounded-full text-xs"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text-muted); margin-top: 1px;"
|
||||
>{{ org.echelle }}</span>
|
||||
</div>
|
||||
<div v-if="orgFonctions(org).length" class="mt-1 flex flex-wrap gap-1">
|
||||
<span
|
||||
v-for="fn in orgFonctions(org)"
|
||||
:key="fn"
|
||||
class="px-1.5 py-0.5 rounded text-xs"
|
||||
style="background: var(--nav-bg-alt); color: var(--nav-text-muted);"
|
||||
>{{ fn }}</span>
|
||||
</div>
|
||||
<div v-if="org.localisation_ville" class="mt-0.5 text-xs" style="color: var(--nav-text-muted);">
|
||||
{{ org.localisation_ville }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface Org {
|
||||
Id: number
|
||||
nom: string
|
||||
echelle?: string
|
||||
tags_fonction?: string
|
||||
territoire?: string
|
||||
localisation_ville?: string
|
||||
latitude?: number | null
|
||||
longitude?: number | null
|
||||
prioritaire?: boolean
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
search: string
|
||||
modeValue: string // 'metropole' | 'outremer'
|
||||
echelle: string[]
|
||||
fonctions: string[]
|
||||
territoire: string | null
|
||||
echelleCount: Record<string, number>
|
||||
fonctionCount: Record<string, number>
|
||||
territoireCount: Record<string, number>
|
||||
resultCount: number
|
||||
orgs: Org[] // fiches filtrées à afficher dans la liste
|
||||
selectedId: number | null
|
||||
hasActiveFilters: boolean
|
||||
pending?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:search': [value: string]
|
||||
'update:mode': [value: string]
|
||||
'update:echelle': [value: string[]]
|
||||
'update:fonctions': [value: string[]]
|
||||
'update:territoire': [value: string | null]
|
||||
'select-org': [id: number]
|
||||
'hover-org': [id: number | null]
|
||||
'reset-filters': []
|
||||
}>()
|
||||
|
||||
const searchInputEl = ref<HTMLInputElement | null>(null)
|
||||
|
||||
function orgFonctions(org: Org): string[] {
|
||||
return (org.tags_fonction ?? '').split(',').map(f => f.trim()).filter(Boolean).slice(0, 2)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.sidebar-search-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border: 1.5px solid var(--nav-bg-alt);
|
||||
border-radius: 10px;
|
||||
background: var(--nav-bg);
|
||||
padding: 7px 10px;
|
||||
cursor: text;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
transition: border-color 0.2s;
|
||||
}
|
||||
|
||||
.sidebar-search-label:focus-within {
|
||||
border-color: var(--nav-primary);
|
||||
background: var(--nav-surface);
|
||||
}
|
||||
|
||||
.sidebar-search-icon {
|
||||
color: var(--nav-text-muted);
|
||||
flex-shrink: 0;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.sidebar-search-label:focus-within .sidebar-search-icon {
|
||||
color: var(--nav-primary-solid);
|
||||
}
|
||||
|
||||
.sidebar-search-input {
|
||||
border: none;
|
||||
outline: none;
|
||||
background: transparent;
|
||||
color: var(--nav-text);
|
||||
font-size: 13px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
font-family: var(--nav-font);
|
||||
}
|
||||
|
||||
.sidebar-search-input::placeholder {
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.sidebar-search-input::-webkit-search-cancel-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.sidebar-search-clear {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--nav-text-muted);
|
||||
flex-shrink: 0;
|
||||
padding: 2px;
|
||||
border-radius: 50%;
|
||||
transition: color 0.15s, background 0.15s;
|
||||
background: transparent;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar-search-clear:hover {
|
||||
color: var(--nav-text);
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,285 @@
|
||||
<!--
|
||||
NavTiroir — B10-M3, B14b-M4
|
||||
Menu < 1280 px : tiroir pleine hauteur à droite, voile, Échap, focus piégé,
|
||||
focus rendu à l'élément qui l'a ouvert. En tête, la phrase courte de la slide 16 et
|
||||
les trois ronds S — M — XL (BandeauEchelles), qui mènent à la porte de l'entrée
|
||||
(`/entree?porte=`) : plus d'onglets à plat (B14b), on passe par l'échelle. Puis
|
||||
Manifeste, À propos, Signaler, et Soutenir.
|
||||
Se ferme seul au changement de route et si la fenêtre passe à ≥ 1280 px.
|
||||
-->
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<Transition name="nav-tiroir">
|
||||
<div v-if="open" class="nav-tiroir" @keydown="onKeydown">
|
||||
<div class="nav-tiroir__voile" aria-hidden="true" @click="fermer" />
|
||||
<div
|
||||
ref="panneau"
|
||||
class="nav-tiroir__panneau"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="nav-tiroir-titre"
|
||||
>
|
||||
<div class="nav-tiroir__tete">
|
||||
<h2 id="nav-tiroir-titre" class="nav-tiroir__titre">Menu</h2>
|
||||
<button type="button" class="nav-tiroir__fermer" aria-label="Fermer le menu" @click="fermer">
|
||||
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" aria-hidden="true">
|
||||
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<nav class="nav-tiroir__corps" aria-label="Échelles et pages">
|
||||
<p class="nav-tiroir__cadre">{{ ECHELLES_CADRE_COURT }}</p>
|
||||
|
||||
<!-- B14b : plus d'onglets ici ; les trois ronds mènent à la porte de l'entrée -->
|
||||
<div class="nav-tiroir__pas" @click="fermerSurLien">
|
||||
<BandeauEchelles
|
||||
:actif="courant"
|
||||
:lien="lienEntree"
|
||||
libelle="Échelles S, M, XL : ouvrir l'entrée"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<hr class="nav-tiroir__sep" />
|
||||
|
||||
<ul class="nav-tiroir__liste">
|
||||
<li v-for="p in PAGES" :key="p.to">
|
||||
<NuxtLink
|
||||
:to="p.to"
|
||||
class="nav-tiroir__second"
|
||||
:aria-current="route.path === p.to ? 'page' : undefined"
|
||||
@click="fermer"
|
||||
>{{ p.libelle }}</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a :href="SOUTENIR_URL" target="_blank" rel="noopener noreferrer" class="nav-tiroir__soutenir">Soutenir</a>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import BandeauEchelles from '~/components/entree/BandeauEchelles.vue'
|
||||
import { ECHELLES_CADRE_COURT, PARAM_PORTE, echelleDeBarre, type EchelleId } from '~/utils/echelles'
|
||||
import { SOUTENIR_URL } from '~/utils/liens'
|
||||
|
||||
const props = defineProps<{ open: boolean }>()
|
||||
const emit = defineEmits<{ close: [] }>()
|
||||
|
||||
/** Le volet n'a pas de sens dans un tiroir : chaque rond ouvre la porte de son échelle sur l'entrée. */
|
||||
const lienEntree = (id: EchelleId) => ({ path: '/entree', query: { [PARAM_PORTE]: id } })
|
||||
const courant = computed(() => echelleDeBarre(route)?.echelle ?? null)
|
||||
/** Un rond vers la porte déjà ouverte ne change pas de route : le tiroir se ferme quand même. */
|
||||
function fermerSurLien(ev: MouseEvent) {
|
||||
if ((ev.target as HTMLElement).closest('a')) fermer()
|
||||
}
|
||||
|
||||
const PAGES = [
|
||||
{ libelle: 'Manifeste', to: '/manifeste' },
|
||||
{ libelle: 'À propos', to: '/a-propos' },
|
||||
{ libelle: 'Signaler', to: '/signaler' },
|
||||
]
|
||||
|
||||
const route = useRoute()
|
||||
const panneau = ref<HTMLElement | null>(null)
|
||||
let retourFocus: HTMLElement | null = null
|
||||
|
||||
function fermer() {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
function focusables(): HTMLElement[] {
|
||||
if (!panneau.value) return []
|
||||
return [...panneau.value.querySelectorAll<HTMLElement>('a[href], button:not([disabled])')]
|
||||
}
|
||||
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') {
|
||||
e.preventDefault()
|
||||
fermer()
|
||||
return
|
||||
}
|
||||
if (e.key !== 'Tab') return
|
||||
const els = focusables()
|
||||
if (!els.length) return
|
||||
const premier = els[0]
|
||||
const dernier = els[els.length - 1]
|
||||
if (e.shiftKey && document.activeElement === premier) {
|
||||
e.preventDefault()
|
||||
dernier.focus()
|
||||
} else if (!e.shiftKey && document.activeElement === dernier) {
|
||||
e.preventDefault()
|
||||
premier.focus()
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.open, async (ouvert) => {
|
||||
if (ouvert) {
|
||||
retourFocus = document.activeElement as HTMLElement | null
|
||||
await nextTick()
|
||||
focusables()[0]?.focus()
|
||||
} else if (retourFocus) {
|
||||
// Le bouton d'ouverture peut ne plus être visible (fenêtre élargie) : focus() est alors sans effet.
|
||||
retourFocus.focus()
|
||||
retourFocus = null
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => route.fullPath, () => { if (props.open) fermer() })
|
||||
|
||||
let mq: MediaQueryList | null = null
|
||||
function onLarge(e: MediaQueryListEvent) { if (e.matches && props.open) fermer() }
|
||||
onMounted(() => {
|
||||
mq = window.matchMedia('(min-width: 1280px)')
|
||||
mq.addEventListener('change', onLarge)
|
||||
})
|
||||
onBeforeUnmount(() => mq?.removeEventListener('change', onLarge))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.nav-tiroir {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.nav-tiroir__voile {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: rgba(var(--nav-primary-raw), 0.35);
|
||||
}
|
||||
|
||||
.nav-tiroir__panneau {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: min(320px, 88vw);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
box-shadow: var(--shadow-lg);
|
||||
}
|
||||
|
||||
.nav-tiroir__tete {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-shrink: 0;
|
||||
padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-md);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.nav-tiroir__titre {
|
||||
margin: 0;
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
}
|
||||
|
||||
.nav-tiroir__fermer {
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 0;
|
||||
border-radius: var(--radius-md);
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.nav-tiroir__corps {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow-y: auto;
|
||||
padding: var(--space-sm) var(--space-md) var(--space-lg);
|
||||
}
|
||||
|
||||
.nav-tiroir__cadre {
|
||||
margin: 0 0 var(--space-xs);
|
||||
font-size: var(--fs-xs);
|
||||
line-height: var(--lh-base);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
/* Les trois ronds, centrés, le nom de l'échelle de la page dessous (BandeauEchelles) */
|
||||
.nav-tiroir__pas {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: var(--space-sm);
|
||||
}
|
||||
|
||||
.nav-tiroir__liste {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav-tiroir__second {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-xs);
|
||||
border-radius: var(--radius-md);
|
||||
text-decoration: none;
|
||||
font-size: var(--fs-sm);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
.nav-tiroir__second:focus-visible,
|
||||
.nav-tiroir__soutenir:focus-visible,
|
||||
.nav-tiroir__fermer:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.nav-tiroir__sep {
|
||||
margin: var(--space-sm) 0;
|
||||
border: 0;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.nav-tiroir__soutenir {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 44px;
|
||||
margin-top: var(--space-sm);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav-tiroir-enter-active,
|
||||
.nav-tiroir-leave-active {
|
||||
transition: opacity var(--dur-base) var(--ease-out);
|
||||
}
|
||||
.nav-tiroir-enter-active .nav-tiroir__panneau,
|
||||
.nav-tiroir-leave-active .nav-tiroir__panneau {
|
||||
transition: transform var(--dur-base) var(--ease-out);
|
||||
}
|
||||
.nav-tiroir-enter-from,
|
||||
.nav-tiroir-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
.nav-tiroir-enter-from .nav-tiroir__panneau,
|
||||
.nav-tiroir-leave-to .nav-tiroir__panneau {
|
||||
transform: translateX(100%);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.nav-tiroir-enter-active,
|
||||
.nav-tiroir-leave-active,
|
||||
.nav-tiroir-enter-active .nav-tiroir__panneau,
|
||||
.nav-tiroir-leave-active .nav-tiroir__panneau {
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,45 +0,0 @@
|
||||
<template>
|
||||
<NuxtLink
|
||||
:to="`/fiche/${org.Id}`"
|
||||
class="block bg-white rounded-xl shadow-sm border border-warm-200 hover:shadow-md hover:border-sage-300 transition-all duration-200 p-5"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3 mb-2">
|
||||
<h2 class="font-semibold text-gray-900 text-base leading-snug">{{ org.nom }}</h2>
|
||||
<TypeBadge v-if="org.type_org" :type="org.type_org" class="shrink-0 mt-0.5" />
|
||||
</div>
|
||||
|
||||
<p class="text-gray-600 text-sm leading-relaxed mb-3 line-clamp-2">
|
||||
{{ org.description }}
|
||||
</p>
|
||||
|
||||
<div v-if="tags.length" class="flex flex-wrap gap-1.5">
|
||||
<TagBadge
|
||||
v-for="tag in tags"
|
||||
:key="tag"
|
||||
:tag="tag"
|
||||
@click="$emit('filter-tag', tag)"
|
||||
/>
|
||||
</div>
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
org: {
|
||||
Id: number
|
||||
nom: string
|
||||
type_org?: string
|
||||
description?: string
|
||||
tags?: string
|
||||
lien?: string
|
||||
}
|
||||
}>()
|
||||
|
||||
defineEmits<{ 'filter-tag': [tag: string] }>()
|
||||
|
||||
const tags = computed(() =>
|
||||
props.org.tags
|
||||
? props.org.tags.split(',').map((t) => t.trim()).filter(Boolean)
|
||||
: []
|
||||
)
|
||||
</script>
|
||||
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<component
|
||||
:is="url ? 'a' : 'div'"
|
||||
v-bind="url ? { href: url, target: '_blank', rel: 'noopener noreferrer' } : {}"
|
||||
class="outil-card"
|
||||
:class="{ 'outil-card--link': !!url, 'outil-card--disabled': !url }"
|
||||
>
|
||||
<div class="outil-card__header">
|
||||
<span class="outil-card__icon" aria-hidden="true">{{ icon }}</span>
|
||||
<span :class="['outil-card__badge', `outil-card__badge--${tag}`]">{{ tagLabel }}</span>
|
||||
</div>
|
||||
<h3 class="outil-card__titre">{{ titre }}</h3>
|
||||
<p class="outil-card__desc">{{ description }}</p>
|
||||
<span v-if="cta && url" class="outil-card__cta">{{ cta }}</span>
|
||||
<span v-else-if="!url" class="outil-card__cta outil-card__cta--disabled">Bientôt disponible</span>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
icon?: string
|
||||
titre: string
|
||||
url?: string | null
|
||||
description?: string
|
||||
cta?: string
|
||||
tag?: string
|
||||
}>()
|
||||
|
||||
const tagLabels: Record<string, string> = {
|
||||
'outil-aep': 'Outil AEP',
|
||||
'inspiration-externe': 'Inspiration',
|
||||
'disponible': 'Disponible',
|
||||
'recommande': 'Recommandé',
|
||||
'a-venir': 'À venir',
|
||||
}
|
||||
|
||||
const tagLabel = computed(() => props.tag ? (tagLabels[props.tag] ?? props.tag) : '')
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outil-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem 1.25rem;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--nav-bg-alt);
|
||||
background: var(--nav-surface);
|
||||
text-decoration: none;
|
||||
color: var(--nav-text);
|
||||
transition: box-shadow 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.outil-card--link:hover {
|
||||
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
|
||||
border-color: var(--nav-primary-solid);
|
||||
}
|
||||
|
||||
.outil-card--disabled {
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
.outil-card__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.outil-card__icon {
|
||||
font-size: 1.3rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.outil-card__badge {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
padding: 2px 7px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.outil-card__badge--outil-aep {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
.outil-card__badge--inspiration-externe {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
.outil-card__badge--disponible {
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
.outil-card__badge--recommande {
|
||||
background: #dbeafe;
|
||||
color: #1e40af;
|
||||
}
|
||||
.outil-card__badge--a-venir {
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.outil-card__titre {
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text);
|
||||
margin: 0;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
.outil-card__desc {
|
||||
font-size: 0.82rem;
|
||||
color: var(--nav-text-muted);
|
||||
margin: 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.outil-card__cta {
|
||||
font-size: 0.78rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-primary-solid);
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.outil-card__cta--disabled {
|
||||
color: var(--nav-text-muted);
|
||||
font-weight: 400;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Dark mode badge overrides */
|
||||
:global(.dark) .outil-card__badge--outil-aep {
|
||||
background: #064e3b;
|
||||
color: #a7f3d0;
|
||||
}
|
||||
:global(.dark) .outil-card__badge--inspiration-externe {
|
||||
background: #78350f;
|
||||
color: #fde68a;
|
||||
}
|
||||
:global(.dark) .outil-card__badge--disponible {
|
||||
background: #064e3b;
|
||||
color: #a7f3d0;
|
||||
}
|
||||
:global(.dark) .outil-card__badge--recommande {
|
||||
background: #1e3a5f;
|
||||
color: #93c5fd;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,227 @@
|
||||
<!--
|
||||
OutilsPartirDeSoi — B6-M2. Le sous-onglet « Partir de soi » de /outils : les
|
||||
sept mots de la slide 17 de la conférence, un mot = une fiche, rendus par
|
||||
la vue fiches partagée (état Mixte : liste des mots | graphe | fiche ouverte).
|
||||
Troisième page branchée sur VueFiches (DESIGN-SYSTEM §Brancher une troisième
|
||||
page). Les données viennent de `partir_de_soi` dans public/data/outils.json.
|
||||
|
||||
Monté seulement quand `?tab=partir-de-soi` : l'état de la vue (q, filtres,
|
||||
fiche…) vit dans l'URL et disparaît avec l'onglet. `tab=` est recopié par la
|
||||
vue à chacune de ses écritures (paramètre qu'elle ne gère pas).
|
||||
-->
|
||||
<template>
|
||||
<div class="ops">
|
||||
<VueFiches
|
||||
:vf="vf"
|
||||
:intention="props.data.intention"
|
||||
libelle-recherche="Rechercher une ressource…"
|
||||
:libelles-vue="{ carte: 'Graphe' }"
|
||||
:lien-page="() => null"
|
||||
>
|
||||
<template #carte>
|
||||
<GrapheMots :vf="vf" :mots="motsGraphe" />
|
||||
</template>
|
||||
|
||||
<template #detail="{ fiche, filtrer }">
|
||||
<article v-if="parId.get(String(fiche.id))" class="mot">
|
||||
<h2 class="mot__titre">{{ parId.get(String(fiche.id))!.mot }}</h2>
|
||||
<p class="mot__resume">{{ parId.get(String(fiche.id))!.resume }}</p>
|
||||
|
||||
<template v-if="parId.get(String(fiche.id))!.vide">
|
||||
<p class="mot__vide">{{ parId.get(String(fiche.id))!.vide }}</p>
|
||||
<NuxtLink to="/proposer?categorie=outils" class="mot__proposer">Proposer une ressource</NuxtLink>
|
||||
</template>
|
||||
|
||||
<ul v-else class="ress" :aria-label="`Ressources pour ${parId.get(String(fiche.id))!.mot}`">
|
||||
<li v-for="r in ressourcesDe(String(fiche.id))" :key="r.id" class="ress__carte">
|
||||
<p class="ress__titre">
|
||||
<a v-if="r.url" :href="r.url" target="_blank" rel="noopener noreferrer">{{ r.titre }}<span class="ress__ext" aria-hidden="true"> ↗</span><span class="vf-sr-mot"> (nouvel onglet)</span></a>
|
||||
<template v-else>{{ r.titre }}</template>
|
||||
</p>
|
||||
|
||||
<ChipGroup :aria-label="`Format et accès de ${r.titre}`" class="ress__chips">
|
||||
<Chip
|
||||
:label="r.format"
|
||||
variant="fonction"
|
||||
:active="(vf.etat.filtres.format ?? []).includes(slugEtiquette(r.format))"
|
||||
:aria-label="`Filtrer par format : ${r.format}`"
|
||||
@toggle="filtrer('format', slugEtiquette(r.format))"
|
||||
/>
|
||||
<Chip
|
||||
:label="r.acces"
|
||||
variant="echelle"
|
||||
:active="(vf.etat.filtres.acces ?? []).includes(slugEtiquette(r.acces))"
|
||||
:aria-label="`Filtrer par accès : ${r.acces}`"
|
||||
@toggle="filtrer('acces', slugEtiquette(r.acces))"
|
||||
/>
|
||||
</ChipGroup>
|
||||
|
||||
<p v-if="r.pourquoi" class="ress__pourquoi">{{ r.pourquoi }}</p>
|
||||
<p v-if="r.urls?.length" class="ress__liens">
|
||||
<template v-for="(u, i) in r.urls" :key="u">
|
||||
<span v-if="i > 0" aria-hidden="true"> · </span>
|
||||
<a :href="u" target="_blank" rel="noopener noreferrer">{{ u.replace(/^https:\/\//, '') }}<span class="vf-sr-mot"> (nouvel onglet)</span></a>
|
||||
</template>
|
||||
</p>
|
||||
<p v-if="r.note" class="ress__note">{{ r.note }}</p>
|
||||
|
||||
<ul v-if="r.episodes?.length" class="eps" :aria-label="`Épisodes de ${r.titre}`">
|
||||
<li v-for="ep in r.episodes" :key="ep.ep" class="eps__item" :class="{ 'eps__item--muet': !ep.url }">
|
||||
<span class="eps__ep">EP/{{ ep.ep }}</span>
|
||||
<span class="eps__corps">
|
||||
<a v-if="ep.url" :href="ep.url" target="_blank" rel="noopener noreferrer" class="eps__titre">{{ ep.titre }}<span class="vf-sr-mot"> (nouvel onglet)</span></a>
|
||||
<span v-else class="eps__titre">{{ ep.titre }}</span>
|
||||
<span class="eps__personnes"> — {{ ep.personnes }}</span>
|
||||
<span v-if="ep.note" class="eps__note"> ({{ ep.note }})</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</article>
|
||||
</template>
|
||||
</VueFiches>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { ConfigVueFiches } from '~/utils/vueFiches'
|
||||
import { toMiniMot, valeursRessources, slugEtiquette, type FicheMot, type RessourceMot } from '~/composables/useFicheAdapter'
|
||||
|
||||
interface RessourceComplete extends RessourceMot {
|
||||
url?: string | null
|
||||
urls?: string[]
|
||||
note?: string
|
||||
episodes?: { ep: string; titre: string; personnes: string; url?: string | null; note?: string }[]
|
||||
}
|
||||
interface DonneesPartirDeSoi {
|
||||
/** Phrase d'intention de l'onglet, lue dans outils.json (jamais en dur : checkpoint du 22/10). */
|
||||
intention: string
|
||||
fiches: (FicheMot & { vide?: string | null })[]
|
||||
ressources: RessourceComplete[]
|
||||
}
|
||||
|
||||
const props = defineProps<{ data: DonneesPartirDeSoi }>()
|
||||
|
||||
const ressourcesDe = (motId: string) => props.data.ressources.filter((r) => r.fiches.includes(motId))
|
||||
const parId = computed(() => new Map(props.data.fiches.map((f) => [f.id, f])))
|
||||
|
||||
// Étape 1 : adaptateur (un mot → une MiniFiche). L'ordre du tableau est celui de la slide.
|
||||
const fichesMini = computed(() => props.data.fiches.map((f) => toMiniMot(f, ressourcesDe(f.id))))
|
||||
|
||||
// Étape 2 : configuration. Sept fiches, pas de groupe ; tri « ordre de la slide » par défaut.
|
||||
const config = computed<ConfigVueFiches>(() => ({
|
||||
dimensions: [
|
||||
{ cle: 'format', libelle: 'Format', variante: 'fonction', valeurs: valeursRessources(props.data.ressources, 'format') },
|
||||
{ cle: 'acces', libelle: 'Accès', variante: 'echelle', valeurs: valeursRessources(props.data.ressources, 'acces') },
|
||||
],
|
||||
tris: ['ordre', 'pertinence', 'nom'],
|
||||
triDefaut: 'ordre',
|
||||
libellesTri: { ordre: 'Ordre de la slide' },
|
||||
groupes: [],
|
||||
etats: ['carte', 'mixte', 'fiches'],
|
||||
}))
|
||||
|
||||
const vf = useVueFiches(fichesMini, config)
|
||||
|
||||
// Étape 3 : le graphe (slot #carte) lit les mêmes données et l'état de la vue.
|
||||
const motsGraphe = computed(() =>
|
||||
props.data.fiches.map((f) => ({
|
||||
id: f.id,
|
||||
mot: f.mot,
|
||||
vide: !!f.vide,
|
||||
ressources: ressourcesDe(f.id).map((r) => ({ id: r.id, titre: r.titre })),
|
||||
})),
|
||||
)
|
||||
|
||||
// Une fiche ouverte donne son nom à l'onglet du navigateur.
|
||||
useSeoMeta({
|
||||
title: () => (vf.ficheOuverte ? `${vf.ficheOuverte.nom} — Partir de soi — AEP` : 'Outils — AEP — Partir de soi'),
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ops { height: 100%; min-height: 0; min-width: 0; }
|
||||
|
||||
/* Lecteurs d'écran seulement */
|
||||
.vf-sr-mot {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Fiche d'un mot */
|
||||
.mot__titre { margin: 0 0 var(--space-xs); font-size: 1.25rem; font-weight: var(--fw-bold); line-height: 1.25; }
|
||||
.mot__resume {
|
||||
margin: 0 0 var(--space-md);
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.55;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.mot__vide {
|
||||
margin: 0 0 var(--space-sm);
|
||||
padding: var(--space-sm);
|
||||
border: 1.5px dashed var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.55;
|
||||
}
|
||||
.mot__proposer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 40px;
|
||||
padding: 0 var(--space-md);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.mot__proposer:hover { opacity: 0.9; }
|
||||
.mot__proposer:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
|
||||
/* Ressources */
|
||||
.ress { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
|
||||
.ress__carte {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-xs);
|
||||
min-width: 0;
|
||||
padding: var(--space-sm);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg);
|
||||
}
|
||||
.ress__carte p { margin: 0; overflow-wrap: anywhere; }
|
||||
.ress__titre { font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: 1.35; }
|
||||
.ress__titre a,
|
||||
.ress__liens a { color: var(--nav-primary-solid); text-underline-offset: 2px; }
|
||||
.ress__titre a:focus-visible,
|
||||
.ress__liens a:focus-visible,
|
||||
.eps__titre:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
|
||||
.ress__pourquoi { font-size: var(--fs-sm); line-height: 1.5; }
|
||||
.ress__liens { font-size: var(--fs-xs, 0.75rem); }
|
||||
.ress__note { font-size: var(--fs-xs, 0.75rem); font-style: italic; color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
|
||||
/* Épisodes OFQA */
|
||||
.eps { list-style: none; margin: var(--space-2xs) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2xs); }
|
||||
.eps__item { display: flex; gap: var(--space-xs); align-items: baseline; font-size: var(--fs-sm); line-height: 1.4; }
|
||||
.eps__ep {
|
||||
flex: 0 0 3.6rem;
|
||||
font-family: var(--font-mono, 'JetBrains Mono', 'Courier New', monospace);
|
||||
font-size: var(--fs-xs, 0.75rem);
|
||||
font-weight: var(--fw-semibold);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.eps__corps { min-width: 0; overflow-wrap: anywhere; }
|
||||
.eps__titre { font-weight: var(--fw-medium); color: var(--text); }
|
||||
a.eps__titre { color: var(--nav-primary-solid); }
|
||||
.eps__personnes,
|
||||
.eps__note { color: color-mix(in srgb, var(--text) 78%, transparent); font-size: var(--fs-xs, 0.75rem); }
|
||||
.eps__note { font-style: italic; }
|
||||
.eps__item--muet .eps__titre { color: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
</style>
|
||||
@@ -1,279 +0,0 @@
|
||||
<template>
|
||||
<div class="outremer-accordion">
|
||||
<div
|
||||
v-for="dom in DOM_TOM"
|
||||
:key="dom.name"
|
||||
class="outremer-item"
|
||||
>
|
||||
<button
|
||||
class="outremer-header"
|
||||
@click="toggle(dom.name)"
|
||||
:aria-expanded="openDom === dom.name"
|
||||
>
|
||||
<span class="outremer-title">{{ dom.name }}</span>
|
||||
<span class="outremer-meta">
|
||||
<span class="outremer-count-badge" :style="orgCounts[dom.name] === 0 ? 'opacity:0.4' : ''">
|
||||
{{ orgCounts[dom.name] ?? 0 }} fiche{{ (orgCounts[dom.name] ?? 0) > 1 ? 's' : '' }}
|
||||
</span>
|
||||
<svg
|
||||
width="14" height="14" viewBox="0 0 24 24" fill="none"
|
||||
stroke="currentColor" stroke-width="2.5" stroke-linecap="round"
|
||||
aria-hidden="true"
|
||||
class="outremer-chevron"
|
||||
:class="{ 'outremer-chevron--open': openDom === dom.name }"
|
||||
>
|
||||
<polyline points="6 9 12 15 18 9"/>
|
||||
</svg>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<div
|
||||
v-show="openDom === dom.name"
|
||||
class="outremer-map-container"
|
||||
>
|
||||
<div :ref="el => { if (el) mapRefs[dom.name] = el as HTMLElement }" class="outremer-map" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Map as LeafletMap, TileLayer } from 'leaflet'
|
||||
|
||||
interface Org {
|
||||
Id: number
|
||||
nom: string
|
||||
latitude?: number | null
|
||||
longitude?: number | null
|
||||
territoire?: string
|
||||
echelle?: string
|
||||
tags_fonction?: string
|
||||
localisation_ville?: string
|
||||
prioritaire?: boolean
|
||||
}
|
||||
|
||||
const DOM_TOM = [
|
||||
{ name: 'Guadeloupe', center: [16.25, -61.58] as [number, number], zoom: 9 },
|
||||
{ name: 'Martinique', center: [14.65, -61.02] as [number, number], zoom: 9 },
|
||||
{ name: 'Guyane', center: [4.0, -53.0] as [number, number], zoom: 6 },
|
||||
{ name: 'La Réunion', center: [-21.11, 55.53] as [number, number], zoom: 9 },
|
||||
{ name: 'Mayotte', center: [-12.83, 45.16] as [number, number], zoom: 10 },
|
||||
]
|
||||
|
||||
const props = defineProps<{
|
||||
orgs: Org[]
|
||||
selectedId?: number | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'select-org': [id: number]
|
||||
}>()
|
||||
|
||||
const mapRefs: Record<string, HTMLElement> = {}
|
||||
const mapInstances: Record<string, LeafletMap> = {}
|
||||
const tileLayers: Record<string, TileLayer> = {}
|
||||
|
||||
const openDom = ref<string | null>(null)
|
||||
|
||||
const orgCounts = computed<Record<string, number>>(() => {
|
||||
const counts: Record<string, number> = {}
|
||||
DOM_TOM.forEach(d => { counts[d.name] = 0 })
|
||||
props.orgs.forEach(o => {
|
||||
if (o.territoire && counts[o.territoire] !== undefined) {
|
||||
counts[o.territoire]++
|
||||
}
|
||||
})
|
||||
return counts
|
||||
})
|
||||
|
||||
function toggle(name: string) {
|
||||
openDom.value = openDom.value === name ? null : name
|
||||
nextTick(() => {
|
||||
if (openDom.value === name && !mapInstances[name]) {
|
||||
initSingleMap(name)
|
||||
} else if (openDom.value === name) {
|
||||
mapInstances[name]?.invalidateSize()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function createPinIcon(L: any, isPrioritaire: boolean, isSelected = false) {
|
||||
const bg = isPrioritaire ? '#f5b342' : 'rgba(26, 34, 56, 0.6)'
|
||||
const border = isPrioritaire ? '#1a2238' : '#ffffff'
|
||||
const size = isSelected ? 16 : 12
|
||||
return L.divIcon({
|
||||
className: '',
|
||||
html: `<div style="width:${size}px;height:${size}px;border-radius:50%;background:${bg};border:2px solid ${border};"></div>`,
|
||||
iconSize: [size, size],
|
||||
iconAnchor: [size / 2, size / 2],
|
||||
popupAnchor: [0, -(size / 2 + 4)],
|
||||
})
|
||||
}
|
||||
|
||||
function getTileUrl(dark: boolean) {
|
||||
return dark
|
||||
? 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png'
|
||||
: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png'
|
||||
}
|
||||
|
||||
async function initSingleMap(domName: string) {
|
||||
const dom = DOM_TOM.find(d => d.name === domName)
|
||||
if (!dom) return
|
||||
const Lmod = await import('leaflet')
|
||||
const L: any = (Lmod as any).default || Lmod
|
||||
await import('leaflet/dist/leaflet.css')
|
||||
const isDark = typeof document !== 'undefined' && document.documentElement.classList.contains('dark')
|
||||
const el = mapRefs[domName]
|
||||
if (!el) return
|
||||
const map = L.map(el, {
|
||||
center: dom.center, zoom: dom.zoom,
|
||||
zoomControl: false, attributionControl: false,
|
||||
dragging: true, scrollWheelZoom: true, doubleClickZoom: true,
|
||||
touchZoom: true, keyboard: false,
|
||||
})
|
||||
const tileLayer = L.tileLayer(getTileUrl(isDark), {
|
||||
attribution: '© OpenStreetMap contributors © CARTO', maxZoom: 19,
|
||||
})
|
||||
tileLayer.addTo(map)
|
||||
tileLayers[domName] = tileLayer as unknown as TileLayer
|
||||
mapInstances[domName] = map as unknown as LeafletMap
|
||||
renderPins(L, domName)
|
||||
}
|
||||
|
||||
function updateTheme(dark: boolean) {
|
||||
const url = getTileUrl(dark)
|
||||
Object.values(tileLayers).forEach(tl => {
|
||||
(tl as any).setUrl(url)
|
||||
})
|
||||
}
|
||||
|
||||
function renderPins(L: any, domName: string) {
|
||||
const map = mapInstances[domName] as any
|
||||
if (!map) return
|
||||
|
||||
if (map._navMarkers) {
|
||||
map._navMarkers.forEach((m: any) => m.remove())
|
||||
}
|
||||
map._navMarkers = []
|
||||
|
||||
const domOrgs = props.orgs.filter(o => o.territoire === domName && o.latitude != null && o.longitude != null)
|
||||
domOrgs.forEach(org => {
|
||||
const icon = createPinIcon(L, !!org.prioritaire, org.Id === props.selectedId)
|
||||
const marker = L.marker([org.latitude!, org.longitude!], { icon })
|
||||
|
||||
const fonctions = org.tags_fonction
|
||||
? org.tags_fonction.split(',').map((f: string) => f.trim()).filter(Boolean).slice(0, 2).join(', ')
|
||||
: ''
|
||||
|
||||
marker.bindPopup(`
|
||||
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;min-width:160px;padding:4px 0;">
|
||||
<div style="font-weight:700;color:#1a2238;margin-bottom:2px;">${org.nom}</div>
|
||||
${org.echelle ? `<div style="font-size:11px;color:rgba(26,34,56,0.55);">${org.echelle}${org.localisation_ville ? ' · ' + org.localisation_ville : ''}</div>` : ''}
|
||||
${fonctions ? `<div style="font-size:11px;color:rgba(26,34,56,0.55);margin-top:2px;">${fonctions}</div>` : ''}
|
||||
<a href="/fiche/${org.Id}" style="display:inline-block;margin-top:8px;font-size:12px;color:#1a2238;text-decoration:underline;">Voir la fiche →</a>
|
||||
</div>
|
||||
`, { maxWidth: 200 })
|
||||
|
||||
marker.on('click', () => emit('select-org', org.Id))
|
||||
marker.addTo(map)
|
||||
map._navMarkers.push(marker)
|
||||
})
|
||||
}
|
||||
|
||||
watch(() => props.orgs, () => {
|
||||
DOM_TOM.forEach(dom => {
|
||||
if (mapInstances[dom.name]) {
|
||||
import('leaflet').then(L => renderPins(L, dom.name))
|
||||
}
|
||||
})
|
||||
}, { deep: false })
|
||||
|
||||
watch(() => props.selectedId, () => {
|
||||
DOM_TOM.forEach(dom => {
|
||||
if (mapInstances[dom.name]) {
|
||||
import('leaflet').then(L => renderPins(L, dom.name))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let themeObserver: MutationObserver | null = null
|
||||
|
||||
onMounted(() => {
|
||||
themeObserver = new MutationObserver(() => {
|
||||
const dark = document.documentElement.classList.contains('dark')
|
||||
updateTheme(dark)
|
||||
})
|
||||
themeObserver.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
themeObserver?.disconnect()
|
||||
Object.values(mapInstances).forEach(m => (m as any).remove())
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outremer-accordion {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.outremer-item {
|
||||
border-bottom: 1px solid var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.outremer-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 12px 16px;
|
||||
background: var(--nav-surface);
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.outremer-header:hover {
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.outremer-title {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text);
|
||||
}
|
||||
|
||||
.outremer-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.outremer-count-badge {
|
||||
font-size: 0.75rem;
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.outremer-chevron {
|
||||
color: var(--nav-text-muted);
|
||||
transition: transform 0.2s ease;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.outremer-chevron--open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.outremer-map-container {
|
||||
height: 220px;
|
||||
border-top: 1px solid var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.outremer-map {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<button
|
||||
type="button"
|
||||
class="taff-card"
|
||||
:style="`border-left-color: ${tagConfig.accent};`"
|
||||
@click="$emit('open', plateforme)"
|
||||
>
|
||||
<!-- Ligne 1 : tag + badge AO + lien -->
|
||||
<div class="taff-card-top">
|
||||
<div class="flex items-center gap-2 flex-wrap">
|
||||
<span class="taff-tag" :style="`background: ${tagConfig.bg}; color: ${tagConfig.text};`">
|
||||
{{ tagConfig.emoji }} {{ tagConfig.label }}
|
||||
</span>
|
||||
<span
|
||||
v-if="plateforme.type === 'appel-offre-public'"
|
||||
class="taff-badge-ao"
|
||||
>AO public</span>
|
||||
</div>
|
||||
<a
|
||||
:href="plateforme.url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="taff-visit-btn"
|
||||
@click.stop
|
||||
title="Visiter le site"
|
||||
>
|
||||
<svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
||||
<polyline points="15 3 21 3 21 9"/>
|
||||
<line x1="10" y1="14" x2="21" y2="3"/>
|
||||
</svg>
|
||||
Visiter
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Ligne 2 : nom -->
|
||||
<div class="taff-card-name">{{ plateforme.nom }}</div>
|
||||
|
||||
<!-- Ligne 3 : axes (icône + score, compacts) -->
|
||||
<div class="taff-card-axes">
|
||||
<template v-for="axe in AXES" :key="axe.id">
|
||||
<span
|
||||
v-if="plateforme.scoring[axe.id] !== null"
|
||||
class="taff-axe-chip"
|
||||
:style="`background: ${axeScoreBg(plateforme.scoring[axe.id])}; color: ${axeScoreText(plateforme.scoring[axe.id])};`"
|
||||
:title="axe.label"
|
||||
>{{ axe.icon }} {{ plateforme.scoring[axe.id] }}</span>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Ligne 4 : description (3 lignes max, lisible) -->
|
||||
<p class="taff-card-desc">{{ plateforme.description_courte }}</p>
|
||||
|
||||
<!-- Ligne 5 : secteurs + coût -->
|
||||
<div class="taff-card-footer">
|
||||
<div class="flex items-center gap-1.5 flex-wrap">
|
||||
<span
|
||||
v-for="s in plateforme.secteurs_servis.slice(0, 3)"
|
||||
:key="s"
|
||||
class="taff-secteur-chip"
|
||||
>{{ SECTEUR_LABELS[s] ?? s }}</span>
|
||||
<span v-if="plateforme.secteurs_servis.length > 3" class="taff-more">+{{ plateforme.secteurs_servis.length - 3 }}</span>
|
||||
</div>
|
||||
<span class="taff-cout">{{ COUT_LABELS[plateforme.cout_entree] ?? plateforme.cout_entree }}</span>
|
||||
</div>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { PlateformeTaff } from '~/types/plateforme-taff'
|
||||
|
||||
const props = defineProps<{ plateforme: PlateformeTaff }>()
|
||||
defineEmits<{ open: [p: PlateformeTaff] }>()
|
||||
|
||||
const AXES = [
|
||||
{ id: 'remuneration' as const, icon: '🪙', label: 'Rémunération' },
|
||||
{ id: 'transparence' as const, icon: '🔍', label: 'Transparence' },
|
||||
{ id: 'pratiques' as const, icon: '⚖️', label: 'Pratiques pro' },
|
||||
{ id: 'ecologie' as const, icon: '🌿', label: 'Écologie' },
|
||||
{ id: 'matching' as const, icon: '🎯', label: 'Matching' },
|
||||
]
|
||||
|
||||
const TAG_CONFIG = {
|
||||
'recommande': { emoji: '✅', label: 'Recommandé AEP', accent: '#5a7a4a', bg: 'rgba(90,122,74,0.12)', text: '#3d5534' },
|
||||
'sous-reserve': { emoji: '⚠️', label: 'Sous réserve', accent: '#c4a472', bg: 'rgba(196,164,114,0.15)', text: '#7a5f2a' },
|
||||
'a-eviter': { emoji: '❌', label: 'À éviter', accent: '#a85d3e', bg: 'rgba(168,93,62,0.12)', text: '#7a3322' },
|
||||
}
|
||||
|
||||
const tagConfig = computed(() => TAG_CONFIG[props.plateforme.scoring.tag_global] ?? TAG_CONFIG['sous-reserve'])
|
||||
|
||||
function axeScoreBg(score: string | null) {
|
||||
if (score === '✅') return 'rgba(90,122,74,0.12)'
|
||||
if (score === '⚠️') return 'rgba(196,164,114,0.15)'
|
||||
if (score === '❌') return 'rgba(168,93,62,0.12)'
|
||||
return 'var(--nav-bg-alt)'
|
||||
}
|
||||
function axeScoreText(score: string | null) {
|
||||
if (score === '✅') return '#3d5534'
|
||||
if (score === '⚠️') return '#7a5f2a'
|
||||
if (score === '❌') return '#7a3322'
|
||||
return 'var(--nav-text-muted)'
|
||||
}
|
||||
|
||||
const SECTEUR_LABELS: Record<string, string> = {
|
||||
'renovation': 'Rénovation', 'construction-neuve': 'Neuf', 'urbanisme': 'Urbanisme',
|
||||
'architecture-interieure': 'Archi intérieure', 'paysage': 'Paysage',
|
||||
'mar-conseil': 'MAR/Conseil', 'transversal': 'Transversal',
|
||||
}
|
||||
const COUT_LABELS: Record<string, string> = {
|
||||
'gratuit': 'Gratuit', 'freemium': 'Freemium', 'abonnement': 'Abonnement',
|
||||
'lead-paye': 'Lead payant', 'commission': 'Commission',
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.taff-card {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
border-radius: 12px;
|
||||
border: 1px solid var(--nav-bg-alt);
|
||||
border-left: 4px solid;
|
||||
background: var(--nav-surface);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
transition: box-shadow 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
.taff-card:hover { box-shadow: 0 4px 16px rgba(26,34,56,0.1); }
|
||||
.taff-card:focus-visible { outline: 2px solid var(--nav-accent); outline-offset: 2px; }
|
||||
|
||||
.taff-card-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
padding: 1rem 1rem 0.5rem;
|
||||
}
|
||||
|
||||
.taff-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 0.25rem 0.625rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.taff-badge-ao {
|
||||
display: inline-flex;
|
||||
padding: 0.25rem 0.5rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.6875rem;
|
||||
font-weight: 500;
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.taff-visit-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
border-radius: 8px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-text);
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
transition: opacity 0.15s;
|
||||
}
|
||||
.taff-visit-btn:hover { opacity: 0.7; }
|
||||
|
||||
.taff-card-name {
|
||||
padding: 0.25rem 1rem 0.75rem;
|
||||
font-size: 1.0625rem;
|
||||
font-weight: 700;
|
||||
color: var(--nav-text);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.taff-card-axes {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0 1rem 0.875rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.taff-axe-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
padding: 0.25rem 0.625rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.8125rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.taff-card-desc {
|
||||
padding: 0 1rem 1rem;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.65;
|
||||
color: var(--nav-text-muted);
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.taff-card-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem 1rem;
|
||||
border-top: 1px solid var(--nav-bg-alt);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.taff-secteur-chip {
|
||||
display: inline-block;
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 9999px;
|
||||
font-size: 0.75rem;
|
||||
background: var(--nav-bg);
|
||||
color: var(--nav-text-muted);
|
||||
border: 1px solid var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.taff-more {
|
||||
font-size: 0.75rem;
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.taff-cout {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text-muted);
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,172 @@
|
||||
<template>
|
||||
<component
|
||||
:is="url ? 'a' : 'div'"
|
||||
v-bind="url ? { href: url, target: '_blank', rel: 'noopener noreferrer' } : {}"
|
||||
class="simu-feature"
|
||||
:class="{ 'simu-feature--link': !!url }"
|
||||
>
|
||||
<div class="simu-feature__inner">
|
||||
<div class="simu-feature__left">
|
||||
<span class="simu-feature__icon" aria-hidden="true">{{ icon }}</span>
|
||||
<div class="simu-feature__body">
|
||||
<div class="simu-feature__header">
|
||||
<h3 class="simu-feature__titre">{{ titre }}</h3>
|
||||
<span v-if="tag" :class="['simu-feature__badge', `simu-feature__badge--${tag}`]">{{ tagLabel }}</span>
|
||||
</div>
|
||||
<p class="simu-feature__desc">{{ description }}</p>
|
||||
<p v-if="mention" class="simu-feature__mention">{{ mention }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<span v-if="cta && url" class="simu-feature__cta">{{ cta }}</span>
|
||||
</div>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
icon?: string
|
||||
titre: string
|
||||
url?: string | null
|
||||
description?: string
|
||||
cta?: string
|
||||
tag?: string
|
||||
/** Ligne de réserve datée sous la description (ex. « Ordre de grandeur — version du … »). */
|
||||
mention?: string | null
|
||||
}>()
|
||||
|
||||
const tagLabels: Record<string, string> = {
|
||||
'outil-aep': 'Outil AEP',
|
||||
'inspiration-externe': 'Inspiration externe',
|
||||
'disponible': 'Disponible',
|
||||
'recommande': 'Recommandé',
|
||||
'a-venir': 'À venir',
|
||||
}
|
||||
|
||||
const tagLabel = computed(() => props.tag ? (tagLabels[props.tag] ?? props.tag) : '')
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.simu-feature {
|
||||
display: block;
|
||||
padding: 1.5rem 1.75rem;
|
||||
border-radius: 14px;
|
||||
border: 1.5px solid var(--nav-bg-alt);
|
||||
background: var(--nav-surface);
|
||||
text-decoration: none;
|
||||
color: var(--nav-text);
|
||||
transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
|
||||
}
|
||||
|
||||
.simu-feature--link:hover {
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
|
||||
border-color: var(--nav-primary-solid);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.simu-feature__inner {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.simu-feature__left {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1rem;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.simu-feature__icon {
|
||||
font-size: 2rem;
|
||||
line-height: 1;
|
||||
flex-shrink: 0;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.simu-feature__body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.simu-feature__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 0.4rem;
|
||||
}
|
||||
|
||||
.simu-feature__titre {
|
||||
font-size: 1.05rem;
|
||||
font-weight: 700;
|
||||
color: var(--nav-text);
|
||||
margin: 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.simu-feature__badge {
|
||||
font-size: 0.65rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
background: #d1fae5;
|
||||
color: #065f46;
|
||||
}
|
||||
|
||||
.simu-feature__badge--inspiration-externe {
|
||||
background: #fef3c7;
|
||||
color: #92400e;
|
||||
}
|
||||
|
||||
.simu-feature__desc {
|
||||
font-size: 0.88rem;
|
||||
color: var(--nav-text-muted);
|
||||
margin: 0;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.simu-feature__mention {
|
||||
font-size: 0.78rem;
|
||||
font-style: italic;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
margin: 0.4rem 0 0;
|
||||
}
|
||||
|
||||
.simu-feature__cta {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0.6rem 1.25rem;
|
||||
background: var(--nav-primary-solid);
|
||||
color: var(--nav-text-on-primary);
|
||||
border-radius: 8px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
transition: opacity 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.simu-feature--link:hover .simu-feature__cta {
|
||||
opacity: 0.88;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.simu-feature { padding: 1.1rem 1rem; }
|
||||
.simu-feature__inner { flex-direction: column; align-items: stretch; gap: 1rem; }
|
||||
.simu-feature__cta { justify-content: center; }
|
||||
}
|
||||
|
||||
:global(.dark) .simu-feature__badge {
|
||||
background: #064e3b;
|
||||
color: #a7f3d0;
|
||||
}
|
||||
:global(.dark) .simu-feature__badge--inspiration-externe {
|
||||
background: #78350f;
|
||||
color: #fde68a;
|
||||
}
|
||||
</style>
|
||||
@@ -1,11 +0,0 @@
|
||||
<template>
|
||||
<span
|
||||
class="inline-block px-2 py-0.5 rounded-full text-xs font-medium bg-sage-100 text-sage-700 border border-sage-200 cursor-pointer hover:bg-sage-200 transition-colors"
|
||||
@click.prevent="$emit('click', tag)"
|
||||
>{{ tag }}</span>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{ tag: string }>()
|
||||
defineEmits<{ click: [tag: string] }>()
|
||||
</script>
|
||||
@@ -0,0 +1,201 @@
|
||||
<template>
|
||||
<ul class="tree-ascii" :class="{ 'tree-ascii--root': depth === 0 }" :style="{ '--depth': depth }">
|
||||
<li
|
||||
v-for="(node, i) in tree.children"
|
||||
:key="i"
|
||||
class="tree-ascii__node"
|
||||
>
|
||||
<!-- Nœud avec enfants : bouton toggle -->
|
||||
<template v-if="node.children && node.children.length">
|
||||
<button
|
||||
class="tree-ascii__branch"
|
||||
:aria-expanded="!!open[i]"
|
||||
@click="toggle(i)"
|
||||
>
|
||||
<span class="tree-ascii__chevron" aria-hidden="true">{{ open[i] ? '▼' : '▶' }}</span>
|
||||
<span class="tree-ascii__label">{{ node.name }}</span>
|
||||
<span class="tree-ascii__count">({{ node.children.length }})</span>
|
||||
</button>
|
||||
<TreeASCII
|
||||
v-if="open[i]"
|
||||
:tree="node"
|
||||
:depth="depth + 1"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<!-- Feuille avec URL : lien cliquable -->
|
||||
<template v-else-if="node.url">
|
||||
<a
|
||||
:href="node.url"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="tree-ascii__leaf tree-ascii__leaf--link"
|
||||
>
|
||||
<span class="tree-ascii__prefix" aria-hidden="true">└─</span>
|
||||
<span class="tree-ascii__label">{{ node.name }}</span>
|
||||
<span v-if="node.desc" class="tree-ascii__desc"> — {{ node.desc }}</span>
|
||||
<svg class="tree-ascii__ext" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
||||
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
|
||||
<polyline points="15 3 21 3 21 9"/>
|
||||
<line x1="10" y1="14" x2="21" y2="3"/>
|
||||
</svg>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<!-- Feuille sans URL -->
|
||||
<template v-else>
|
||||
<span class="tree-ascii__leaf">
|
||||
<span class="tree-ascii__prefix" aria-hidden="true">└─</span>
|
||||
<span class="tree-ascii__label">{{ node.name }}</span>
|
||||
<span v-if="node.desc" class="tree-ascii__desc"> — {{ node.desc }}</span>
|
||||
</span>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
export interface TreeNode {
|
||||
name: string
|
||||
url?: string
|
||||
desc?: string
|
||||
children?: TreeNode[]
|
||||
}
|
||||
|
||||
export interface TreeData {
|
||||
name?: string
|
||||
children?: TreeNode[]
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
tree: TreeData
|
||||
depth?: number
|
||||
}>(), {
|
||||
depth: 0
|
||||
})
|
||||
|
||||
// Toutes les branches fermées par défaut
|
||||
const open = ref<Record<number, boolean>>({})
|
||||
|
||||
function toggle(i: number) {
|
||||
open.value[i] = !open.value[i]
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tree-ascii {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
|
||||
font-size: 0.82rem;
|
||||
padding-left: calc(var(--depth, 0) * 1.25rem + 0.5rem);
|
||||
}
|
||||
|
||||
.tree-ascii--root {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.tree-ascii__node {
|
||||
margin: 2px 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
/* Bouton branche (nœud avec enfants) */
|
||||
.tree-ascii__branch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
color: var(--nav-text);
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
font-weight: 600;
|
||||
transition: background 0.1s, color 0.1s;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tree-ascii__branch:hover {
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-primary-solid);
|
||||
}
|
||||
|
||||
.tree-ascii__chevron {
|
||||
font-size: 0.65rem;
|
||||
color: var(--nav-text-muted);
|
||||
width: 12px;
|
||||
text-align: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tree-ascii__count {
|
||||
font-size: 0.7rem;
|
||||
color: var(--nav-text-muted);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* Feuille */
|
||||
.tree-ascii__leaf {
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
gap: 0.25rem;
|
||||
padding: 1px 6px;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.tree-ascii__leaf--link {
|
||||
color: var(--nav-text);
|
||||
cursor: pointer;
|
||||
transition: background 0.1s, color 0.1s;
|
||||
}
|
||||
|
||||
.tree-ascii__leaf--link:hover {
|
||||
background: var(--nav-bg-alt);
|
||||
color: var(--nav-primary-solid);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.tree-ascii__prefix {
|
||||
color: var(--nav-text-muted);
|
||||
opacity: 0.5;
|
||||
font-size: 0.75rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.tree-ascii__label {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tree-ascii__leaf--link .tree-ascii__label {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.tree-ascii__desc {
|
||||
color: var(--nav-text-muted);
|
||||
font-size: 0.78rem;
|
||||
font-style: italic;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
max-width: 60ch;
|
||||
}
|
||||
|
||||
.tree-ascii__ext {
|
||||
opacity: 0.4;
|
||||
flex-shrink: 0;
|
||||
margin-left: 2px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
.tree-ascii__desc {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,333 @@
|
||||
<!--
|
||||
VoletEchelle — B14b-M3
|
||||
Le volet d'une échelle, ouvert par son rond dans la barre (NavPortes) : pleine largeur,
|
||||
sous la barre et par-dessus la page (la carte de / et les pages ne se réagencent pas),
|
||||
hauteur au contenu, 70 vh au plus (défile au-delà). Un <section> étiqueté par le titre
|
||||
de l'échelle, pas un dialogue : la page reste accessible derrière.
|
||||
De gauche à droite au bureau, empilé au téléphone :
|
||||
① les trois cercles imbriqués (géométrie de la slide 16, utils/figures.ts), l'échelle
|
||||
ouverte allumée : ce qui explique les trois échelles d'un coup ; décoratif ;
|
||||
② le titre, l'accroche de la slide 16 et les sept mots, immobiles (l'entrée les fait tourner) ;
|
||||
③ les sections : une carte par onglet de l'échelle (l'onglet courant marqué), puis
|
||||
« Proposer une ressource » en contour et « Voir le schéma complet » vers l'entrée.
|
||||
Choisir une section navigue et referme le volet (`choisi`).
|
||||
Mouvement : ouverture et fermeture par la hauteur (grid-template-rows 0fr → 1fr) et un
|
||||
fondu, `--dur-base` ; d'une échelle à l'autre volet ouvert, le contenu change en fondu
|
||||
court (`--dur-fast`), sans glissement. `prefers-reduced-motion` : état final, immédiat.
|
||||
Textes et ordre : utils/echelles.ts, rien de recopié.
|
||||
-->
|
||||
<template>
|
||||
<div :id="id" class="volet">
|
||||
<Transition name="volet" :css="!mouvementReduit">
|
||||
<div v-if="echelle" class="volet__plie">
|
||||
<div class="volet__dedans">
|
||||
<Transition name="volet-echange" :css="!mouvementReduit">
|
||||
<section :key="echelle" class="volet__corps" :aria-labelledby="`${id}-titre`">
|
||||
<div class="volet__schema" aria-hidden="true">
|
||||
<svg :viewBox="cadre" focusable="false">
|
||||
<g
|
||||
v-for="a in anneaux"
|
||||
:key="a.id"
|
||||
class="volet__anneau"
|
||||
:class="[`volet__anneau--${a.id}`, { 'volet__anneau--actif': a.id === echelle }]"
|
||||
>
|
||||
<path class="volet__zone" :d="a.zone" fill-rule="evenodd" />
|
||||
<circle class="volet__trait" :cx="a.cx" :cy="a.cy" :r="a.r" />
|
||||
<text class="volet__lettre" :x="a.cx" :y="yLettre(a)" :font-size="CORPS_LETTRE" text-anchor="middle">{{ a.id }}</text>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div class="volet__texte">
|
||||
<h2 :id="`${id}-titre`" class="volet__titre">
|
||||
<span class="volet__pastille">{{ echelle }}</span>{{ e.titre }}
|
||||
</h2>
|
||||
<p class="volet__accroche">{{ e.accroche }}</p>
|
||||
<ul class="volet__mots">
|
||||
<li v-for="m in e.mots" :key="m">{{ m }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="volet__sections">
|
||||
<ul class="volet__cartes">
|
||||
<li v-for="o in e.onglets" :key="o.to">
|
||||
<NuxtLink
|
||||
:to="o.to"
|
||||
class="volet__carte"
|
||||
:class="{ 'volet__carte--courante': o.actif(route) }"
|
||||
:aria-current="o.actif(route) ? 'page' : undefined"
|
||||
@click="emit('choisi')"
|
||||
>{{ o.libelle }}</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="volet__pied">
|
||||
<NuxtLink :to="lienProposer(echelle)" class="volet__proposer" @click="emit('choisi')">{{ PORTE_EN_CONSTRUCTION.proposer }}</NuxtLink>
|
||||
<NuxtLink :to="{ path: '/entree', query: { [PARAM_PORTE]: echelle } }" class="volet__complet" @click="emit('choisi')">Voir le schéma complet</NuxtLink>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
</Transition>
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ECHELLES, PARAM_PORTE, PORTE_EN_CONSTRUCTION, lienProposer, type EchelleId } from '~/utils/echelles'
|
||||
import { anneauxEchelles, METRIQUE, type AnneauEchelle } from '~/utils/figures'
|
||||
|
||||
const props = defineProps<{
|
||||
/** Id du volet (cible d'`aria-controls` des ronds). */
|
||||
id: string
|
||||
/** Échelle ouverte, ou null : volet fermé. */
|
||||
echelle: EchelleId | null
|
||||
}>()
|
||||
const emit = defineEmits<{ choisi: [] }>()
|
||||
|
||||
const route = useRoute()
|
||||
const e = computed(() => ECHELLES[props.echelle ?? 'S'])
|
||||
|
||||
// Les cercles de la slide 16, cadrés sur l'anneau XL ; une lettre par anneau, au milieu de sa
|
||||
// couronne (S : au centre du disque). Corps en unités du dessin : 90 ≈ 15 px rendus à 8 rem.
|
||||
const anneaux = anneauxEchelles()
|
||||
const xl = anneaux[0]
|
||||
const marge = 6
|
||||
const cadre = `${xl.cx - xl.r - marge} ${xl.cy - xl.r - marge} ${2 * (xl.r + marge)} ${2 * (xl.r + marge)}`
|
||||
const CORPS_LETTRE = 90
|
||||
const yLettre = (a: AnneauEchelle) => {
|
||||
const milieu = a.rInterieur > 0 ? (a.r + a.rInterieur) / 2 : 0
|
||||
return Math.round((a.cy - milieu + (METRIQUE.capitale * CORPS_LETTRE) / 2) * 10) / 10
|
||||
}
|
||||
|
||||
// Mouvement réduit : pas de classes de transition du tout (sinon l'état de départ tient deux images).
|
||||
const mouvementReduit = ref(false)
|
||||
let mq: MediaQueryList | null = null
|
||||
const suivreMq = () => { mouvementReduit.value = !!mq?.matches }
|
||||
onMounted(() => {
|
||||
mq = window.matchMedia('(prefers-reduced-motion: reduce)')
|
||||
suivreMq()
|
||||
mq.addEventListener('change', suivreMq)
|
||||
})
|
||||
onBeforeUnmount(() => mq?.removeEventListener('change', suivreMq))
|
||||
|
||||
/** Premier lien du volet (Tab depuis le rond ouvert). */
|
||||
function premierFocus(): HTMLElement | null {
|
||||
if (!import.meta.client) return null
|
||||
return document.getElementById(props.id)?.querySelector<HTMLElement>('a[href]') ?? null
|
||||
}
|
||||
defineExpose({ premierFocus })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Sous la barre (le <header> d'app.vue est le bloc de référence), par-dessus la page. */
|
||||
.volet {
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.volet__plie {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
opacity: 1;
|
||||
background: var(--nav-surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
.volet__dedans {
|
||||
min-height: 0;
|
||||
max-height: 70vh;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
/* Ouvrir / fermer : la hauteur de 0fr à 1fr, et un fondu. */
|
||||
.volet-enter-active,
|
||||
.volet-leave-active {
|
||||
transition: grid-template-rows var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-out);
|
||||
}
|
||||
.volet-enter-from,
|
||||
.volet-leave-to {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
}
|
||||
.volet-enter-active .volet__dedans,
|
||||
.volet-leave-active .volet__dedans { overflow: hidden; }
|
||||
|
||||
/* D'une échelle à l'autre : l'ancien contenu part tout de suite, le nouveau arrive en fondu court. */
|
||||
.volet-echange-enter-active { transition: opacity var(--dur-fast) var(--ease-out); }
|
||||
.volet-echange-enter-from { opacity: 0; }
|
||||
.volet-echange-leave-active { display: none; }
|
||||
|
||||
/* ── Mise en page : empilée au téléphone ── */
|
||||
.volet__corps {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
gap: var(--space-sm) var(--space-md);
|
||||
align-items: start;
|
||||
max-width: 72rem;
|
||||
margin: 0 auto;
|
||||
padding: var(--space-md) var(--space-md) var(--space-lg);
|
||||
color: var(--text);
|
||||
}
|
||||
.volet__sections { grid-column: 1 / -1; }
|
||||
|
||||
.volet__schema { width: 5.5rem; }
|
||||
.volet__schema svg { display: block; width: 100%; height: auto; }
|
||||
|
||||
.volet__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 5%, transparent); }
|
||||
.volet__anneau--M .volet__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 8%, transparent); }
|
||||
.volet__anneau--S .volet__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 12%, transparent); }
|
||||
.volet__anneau.volet__anneau--actif .volet__zone { fill: color-mix(in srgb, var(--accent) 32%, transparent); }
|
||||
.volet__trait {
|
||||
fill: none;
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 1.5px;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
.volet__anneau--actif .volet__trait { stroke: var(--accent); stroke-width: 2.5px; }
|
||||
.volet__lettre {
|
||||
fill: var(--text);
|
||||
font-family: var(--font-body);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
|
||||
.volet__titre {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
margin: 0;
|
||||
font-size: var(--fs-lg);
|
||||
font-weight: var(--fw-bold);
|
||||
line-height: 1.2;
|
||||
}
|
||||
.volet__pastille {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1.75rem;
|
||||
padding: var(--space-2xs) var(--space-xs);
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
.volet__accroche {
|
||||
margin: var(--space-2xs) 0 0;
|
||||
font-size: var(--fs-sm);
|
||||
line-height: var(--lh-base);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.volet__mots {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2xs) 0;
|
||||
margin: var(--space-xs) 0 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: var(--fs-xs);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.volet__mots li:not(:last-child)::after {
|
||||
content: "·";
|
||||
margin: 0 var(--space-xs);
|
||||
color: var(--accent);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
|
||||
.volet__cartes {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
|
||||
gap: var(--space-xs);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.volet__carte {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
min-height: 48px;
|
||||
height: 100%;
|
||||
padding: var(--space-xs) var(--space-sm);
|
||||
border: 1.5px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
line-height: 1.25;
|
||||
text-decoration: none;
|
||||
transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.volet__carte:hover { border-color: var(--accent); }
|
||||
.volet__carte--courante {
|
||||
border-color: var(--accent);
|
||||
background: color-mix(in srgb, var(--accent) 16%, var(--bg));
|
||||
}
|
||||
|
||||
.volet__pied {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-xs) var(--space-md);
|
||||
margin: var(--space-sm) 0 0;
|
||||
}
|
||||
.volet__proposer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-sm);
|
||||
border: 1.5px solid var(--accent);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.volet__proposer:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
||||
.volet__complet {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
font-size: var(--fs-xs);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--border);
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
.volet__complet:hover { color: var(--text); }
|
||||
|
||||
.volet__carte:focus-visible,
|
||||
.volet__proposer:focus-visible,
|
||||
.volet__complet:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ≥ 768 : cercles et texte en tête, les sections dessous */
|
||||
@media (min-width: 768px) {
|
||||
.volet__corps {
|
||||
gap: var(--space-md) var(--space-lg);
|
||||
padding: var(--space-lg) var(--space-xl);
|
||||
}
|
||||
.volet__schema { width: 7rem; }
|
||||
}
|
||||
/* ≥ 1024 : trois colonnes, de gauche à droite */
|
||||
@media (min-width: 1024px) {
|
||||
.volet__corps { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.15fr); }
|
||||
.volet__sections { grid-column: auto; }
|
||||
.volet__schema { width: 8rem; }
|
||||
.volet__cartes { grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.volet-enter-active,
|
||||
.volet-leave-active,
|
||||
.volet-echange-enter-active,
|
||||
.volet__carte { transition: none; }
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,118 @@
|
||||
<!--
|
||||
VueFichesFiltres — B11-M4. Les chips de filtre d'une vue fiches, par
|
||||
dimension (Chip.vue, variante de la dimension). Monté à UN seul endroit selon
|
||||
l'état (SPEC §3) : panneau de gauche en Mixte, tête de grille en Fiches,
|
||||
feuille du bas sur téléphone. Compteur dans le résultat courant ; chip à 0
|
||||
grisée et inactive ; au-delà de 14 valeurs, repli « + N » (actives toujours
|
||||
visibles) ; « Tout effacer » dès qu'un filtre est actif.
|
||||
-->
|
||||
<template>
|
||||
<div class="vff">
|
||||
<ChipGroup v-if="vf.etat.sansAdresse" aria-label="Filtre de localisation">
|
||||
<Chip as="span" removable active variant="echelle" label="Sans adresse" @remove="vf.setSansAdresse(false)" />
|
||||
</ChipGroup>
|
||||
<div v-for="d in vf.cfg.dimensions" :key="d.cle" class="vff__dim">
|
||||
<p :id="`${idBase}-${d.cle}`" class="vff__titre">{{ d.libelle }}</p>
|
||||
<ChipGroup :aria-label="`Filtrer par ${d.libelle.toLowerCase()}`" :aria-describedby="`${idBase}-${d.cle}`">
|
||||
<Chip
|
||||
v-for="v in visibles(d)"
|
||||
:key="v.valeur"
|
||||
:label="v.libelle"
|
||||
:variant="d.variante"
|
||||
:active="actif(d.cle, v.valeur)"
|
||||
:count="vf.compteurs[d.cle]?.[v.valeur] ?? 0"
|
||||
:disabled="!actif(d.cle, v.valeur) && !(vf.compteurs[d.cle]?.[v.valeur])"
|
||||
class="vff__chip"
|
||||
@toggle="vf.toggle(d.cle, v.valeur)"
|
||||
/>
|
||||
<button
|
||||
v-if="d.valeurs.length > SEUIL"
|
||||
type="button"
|
||||
class="vff__plus"
|
||||
:aria-expanded="!!deplies[d.cle]"
|
||||
@click="deplies[d.cle] = !deplies[d.cle]"
|
||||
>{{ deplies[d.cle] ? 'Réduire' : `+ ${d.valeurs.length - visibles(d).length}` }}</button>
|
||||
</ChipGroup>
|
||||
</div>
|
||||
|
||||
<button
|
||||
v-if="vf.nbActifs || vf.q"
|
||||
type="button"
|
||||
class="vff__effacer"
|
||||
@click="vf.effacerTout()"
|
||||
>Tout effacer</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { VueFichesEtat } from '~/composables/useVueFiches'
|
||||
import type { DimensionFiltre } from '~/utils/vueFiches'
|
||||
|
||||
const props = defineProps<{ vf: VueFichesEtat; idBase: string }>()
|
||||
|
||||
const SEUIL = 14
|
||||
const deplies = reactive<Record<string, boolean>>({})
|
||||
|
||||
function actif(dim: string, valeur: string) {
|
||||
return (props.vf.etat.filtres[dim] ?? []).includes(valeur)
|
||||
}
|
||||
|
||||
/** Les 14 premières dans l'ordre de la dimension (stable : les chips ne bougent pas au clic) + les actives hors de ce lot. */
|
||||
function visibles(d: DimensionFiltre) {
|
||||
if (d.valeurs.length <= SEUIL || deplies[d.cle]) return d.valeurs
|
||||
return d.valeurs.filter((v, i) => i < SEUIL || actif(d.cle, v.valeur))
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.vff {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.vff__titre {
|
||||
margin: 0 0 var(--space-2xs);
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
.vff__chip:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.vff__plus {
|
||||
min-height: 32px;
|
||||
padding: var(--space-2xs) var(--space-sm);
|
||||
border: 1.5px dashed color-mix(in srgb, var(--text) 40%, transparent);
|
||||
border-radius: var(--radius-full);
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-xs);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vff__effacer {
|
||||
align-self: flex-start;
|
||||
padding: var(--space-2xs) 0;
|
||||
border: none;
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-xs);
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vff__plus:focus-visible,
|
||||
.vff__effacer:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,171 @@
|
||||
<!--
|
||||
CarteUnifiee — B4a-M2. La carte Leaflet de `/`, pour les deux modes : remplace NavMap
|
||||
(entraide) et NavMapV2 (pratiques), qui faisaient la même chose à 80 lignes près.
|
||||
Elle reçoit des épingles génériques (`utils/carte.ts`), un dessin (par fonction ou
|
||||
par famille, et bornes : France métropolitaine ou Europe), la sélection, le survol et le
|
||||
centrage ; elle émet `select` et `survol`. Leaflet arrive par `useLeaflet({ cluster })`.
|
||||
Les épingles d'outre-mer n'y vont pas : la page les donne aux encarts.
|
||||
-->
|
||||
<template>
|
||||
<div class="relative w-full h-full">
|
||||
<div ref="conteneur" class="w-full h-full rounded-none" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Map as CarteLeaflet, Marker } from 'leaflet'
|
||||
import { BORNES, dessinEpingle, popupHtml, type EpingleCarte, type StyleCarte } from '~/utils/carte'
|
||||
|
||||
const props = defineProps<{
|
||||
epingles: EpingleCarte[]
|
||||
/** Dessin des épingles et bornes : France métropolitaine (entraide) ou Europe (pratiques). */
|
||||
dessin: StyleCarte
|
||||
selectedId?: string | null
|
||||
/** Fiche survolée dans la liste : épingle safran, sans recentrer. */
|
||||
survolId?: string | null
|
||||
/** « Voir sur la carte » : zoome jusqu'à l'épingle, sortie de son cluster ; `n` change à chaque demande. */
|
||||
centrage?: { id: string; n: number } | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
select: [id: string]
|
||||
survol: [id: string | null]
|
||||
}>()
|
||||
|
||||
const baseTiles = useBaseTiles()
|
||||
const conteneur = ref<HTMLElement | null>(null)
|
||||
let L: any = null
|
||||
let carte: CarteLeaflet | null = null
|
||||
let grappe: any = null
|
||||
let tuiles: any = null
|
||||
const marqueurs = new Map<string, Marker>()
|
||||
let observateurTaille: ResizeObserver | null = null
|
||||
let observateurTheme: MutationObserver | null = null
|
||||
|
||||
function icone(e: EpingleCarte) {
|
||||
const d = dessinEpingle(props.dessin, e.cle, e.id === props.selectedId, e.id === props.survolId)
|
||||
return L.divIcon({ className: '', html: d.html, iconSize: [d.taille, d.taille], iconAnchor: [d.taille / 2, d.taille / 2], popupAnchor: [0, -(d.taille / 2 + 4)] })
|
||||
}
|
||||
|
||||
async function initialiser() {
|
||||
if (!conteneur.value) return
|
||||
L = await useLeaflet({ cluster: true })
|
||||
if (!conteneur.value?.isConnected) return // page quittée pendant le chargement (ex. ?random=1)
|
||||
|
||||
const b = BORNES[props.dessin]
|
||||
carte = L.map(conteneur.value, {
|
||||
center: b.centre,
|
||||
zoom: b.zoom,
|
||||
zoomControl: true,
|
||||
attributionControl: true,
|
||||
minZoom: b.minZoom,
|
||||
maxZoom: 18,
|
||||
...(b.maxBounds ? { maxBounds: b.maxBounds, maxBoundsViscosity: 1.0 } : {}),
|
||||
})
|
||||
|
||||
tuiles = L.tileLayer(baseTiles.url(document.documentElement.classList.contains('dark')), {
|
||||
attribution: baseTiles.attribution,
|
||||
maxZoom: 19,
|
||||
})
|
||||
tuiles.addTo(carte)
|
||||
|
||||
grappe = new L.MarkerClusterGroup({
|
||||
disableClusteringAtZoom: 14,
|
||||
maxClusterRadius: 50,
|
||||
showCoverageOnHover: false,
|
||||
iconCreateFunction: (cluster: any) => L.divIcon({
|
||||
html: `<div style="width:36px;height:36px;border-radius:50%;background:var(--nav-primary);color:var(--nav-text-on-primary);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;border:2px solid white;font-family:var(--nav-font);">${cluster.getChildCount()}</div>`,
|
||||
className: '',
|
||||
iconSize: [36, 36],
|
||||
iconAnchor: [18, 18],
|
||||
}),
|
||||
})
|
||||
carte!.addLayer(grappe)
|
||||
poserEpingles()
|
||||
|
||||
// La carte change de largeur sans que la fenêtre bouge (Mixte ↔ Carte ↔ Fiches)
|
||||
observateurTaille = new ResizeObserver(() => carte?.invalidateSize({ pan: false }))
|
||||
observateurTaille.observe(conteneur.value)
|
||||
}
|
||||
|
||||
function poserEpingles() {
|
||||
if (!carte || !grappe) return
|
||||
grappe.clearLayers()
|
||||
marqueurs.clear()
|
||||
for (const e of props.epingles) {
|
||||
const m = L.marker(e.coords, { icon: icone(e), title: e.nom })
|
||||
m.bindPopup(popupHtml(e), { maxWidth: 260 })
|
||||
// Sans lien, le bouton du popup ouvre la fiche dans le panneau (pratiques)
|
||||
m.on('popupopen', (ev: any) => {
|
||||
ev.popup.getElement()?.querySelector('[data-ouvrir]')?.addEventListener('click', () => emit('select', e.id), { once: true })
|
||||
})
|
||||
m.on('click', () => emit('select', e.id))
|
||||
m.on('mouseover', () => emit('survol', e.id))
|
||||
m.on('mouseout', () => emit('survol', null))
|
||||
marqueurs.set(e.id, m)
|
||||
grappe.addLayer(m)
|
||||
}
|
||||
}
|
||||
|
||||
function redessiner(id: string | null | undefined) {
|
||||
if (id == null) return
|
||||
const m = marqueurs.get(id)
|
||||
const e = props.epingles.find((x) => x.id === id)
|
||||
if (m && e) m.setIcon(icone(e))
|
||||
}
|
||||
|
||||
// Épingle regroupée dans un cluster : c'est le cluster visible qui s'allume
|
||||
function allumerGrappe(id: string | null | undefined, on: boolean) {
|
||||
const m = id == null ? undefined : marqueurs.get(id)
|
||||
const parent = m && grappe?.getVisibleParent(m)
|
||||
const el = parent && parent !== m ? (parent as any)._icon?.firstElementChild as HTMLElement | undefined : undefined
|
||||
if (el) el.style.boxShadow = on ? '0 0 0 4px #f5b342' : ''
|
||||
}
|
||||
|
||||
watch(() => props.epingles, () => poserEpingles())
|
||||
|
||||
watch(() => props.selectedId, (nouveau, ancien) => {
|
||||
if (!carte) return
|
||||
redessiner(ancien)
|
||||
redessiner(nouveau)
|
||||
const m = nouveau == null ? undefined : marqueurs.get(nouveau)
|
||||
if (m) carte.panTo(m.getLatLng(), { animate: true })
|
||||
})
|
||||
|
||||
watch(() => props.survolId, (nouveau, ancien) => {
|
||||
if (!carte) return
|
||||
for (const id of [ancien, nouveau]) {
|
||||
redessiner(id)
|
||||
allumerGrappe(id, id === nouveau)
|
||||
}
|
||||
})
|
||||
|
||||
// « Voir sur la carte » : la carte vient peut-être de s'afficher (Fiches → Mixte) ;
|
||||
// on attend sa taille réelle, puis on sort l'épingle de son cluster.
|
||||
watch(() => props.centrage?.n, () => {
|
||||
const c = props.centrage
|
||||
if (!c) return
|
||||
setTimeout(() => {
|
||||
if (!carte || !grappe) return
|
||||
carte.invalidateSize({ pan: false })
|
||||
const m = marqueurs.get(c.id)
|
||||
if (m) grappe.zoomToShowLayer(m, () => carte?.panTo(m.getLatLng(), { animate: true }))
|
||||
}, 260)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// Double rAF : laisser le navigateur calculer la hauteur du conteneur avant Leaflet
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => { initialiser() }))
|
||||
observateurTheme = new MutationObserver(() => {
|
||||
tuiles?.setUrl(baseTiles.url(document.documentElement.classList.contains('dark')))
|
||||
})
|
||||
observateurTheme.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
observateurTheme?.disconnect()
|
||||
observateurTaille?.disconnect()
|
||||
carte?.remove()
|
||||
carte = null
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,121 @@
|
||||
<!--
|
||||
CommutateurMode — B4a-M4. En tête de la carte unifiée : deux onglets, « Entraide » et
|
||||
« Pratiques inspirantes » (rôle tablist, aria-selected, 44 px, flèches ← → entre les deux),
|
||||
puis « Bibliothèque », un LIEN vers /media (le mode RAG de la taxonomie N est l'onglet XL
|
||||
existant). Il n'écrit pas l'URL : il émet `choisir`, la page s'en charge. Rien n'anime.
|
||||
-->
|
||||
<template>
|
||||
<div class="modes">
|
||||
<div class="modes__onglets" role="tablist" aria-label="Ce que montre la carte">
|
||||
<button
|
||||
v-for="(m, i) in MODES"
|
||||
:id="`mode-${m.valeur}`"
|
||||
:key="m.valeur"
|
||||
ref="onglets"
|
||||
type="button"
|
||||
role="tab"
|
||||
class="modes__onglet"
|
||||
:aria-selected="mode === m.valeur"
|
||||
:aria-controls="panneau"
|
||||
:tabindex="mode === m.valeur ? 0 : -1"
|
||||
@click="emit('choisir', m.valeur)"
|
||||
@keydown.right.prevent="voisin(i, 1)"
|
||||
@keydown.left.prevent="voisin(i, -1)"
|
||||
>{{ m.court }}<span v-if="m.suite" class="modes__suite">{{ m.suite }}</span></button>
|
||||
</div>
|
||||
<NuxtLink to="/media" class="modes__lien">Bibliothèque</NuxtLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
export type ModeCarte = 'entraide' | 'pratiques'
|
||||
|
||||
defineProps<{
|
||||
mode: ModeCarte
|
||||
/** Id du panneau que les onglets commandent (la vue fiches). */
|
||||
panneau: string
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ choisir: [mode: ModeCarte] }>()
|
||||
|
||||
/** « Pratiques inspirantes » : « inspirantes » se replie sous 420 px (gardé pour les lecteurs d'écran). */
|
||||
const MODES: { valeur: ModeCarte; court: string; suite?: string }[] = [
|
||||
{ valeur: 'entraide', court: 'Entraide' },
|
||||
{ valeur: 'pratiques', court: 'Pratiques', suite: ' inspirantes' },
|
||||
]
|
||||
|
||||
const onglets = ref<HTMLButtonElement[]>([])
|
||||
|
||||
function voisin(i: number, pas: number) {
|
||||
const j = (i + pas + MODES.length) % MODES.length
|
||||
emit('choisir', MODES[j].valeur)
|
||||
nextTick(() => onglets.value[j]?.focus())
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modes {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
padding: 0 var(--space-xs);
|
||||
background: var(--surface);
|
||||
border-bottom: 1px solid var(--border);
|
||||
min-width: 0;
|
||||
}
|
||||
.modes__onglets {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
}
|
||||
.modes__onglet,
|
||||
.modes__lien {
|
||||
min-height: 44px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 0 var(--space-sm);
|
||||
border: none;
|
||||
border-bottom: 3px solid transparent;
|
||||
background: none;
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-medium);
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
.modes__onglet[aria-selected='true'] {
|
||||
border-bottom-color: var(--nav-primary-solid);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
.modes__lien {
|
||||
margin-left: auto;
|
||||
color: var(--text);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 3px;
|
||||
}
|
||||
.modes__onglet:focus-visible,
|
||||
.modes__lien:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
/* Mobile-first (PROTOCOLE §1, checkpoint 07/11) : étroit en base, « inspirantes » repliée ; à partir de 26.25rem (420 px) le libellé entier et les espacements. */
|
||||
.modes__suite {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
@media (min-width: 26.25rem) {
|
||||
.modes { padding: 0 var(--space-md); gap: var(--space-sm); }
|
||||
.modes__suite {
|
||||
position: static;
|
||||
width: auto;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
clip: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,178 @@
|
||||
<!--
|
||||
EncartsOutremer — B4a-M2. Les DOM-TOM sur la même vue que la carte principale : un encart
|
||||
par territoire qui a au moins une épingle dans le résultat courant (aucun encart vide),
|
||||
chacun une petite carte Leaflet centrée sur son territoire, titrée, avec ses épingles.
|
||||
Remplace OutremerMap (accordéon, sous-vue « Outre-mer ») : même cadre par territoire,
|
||||
mêmes épingles, mais toujours visibles, et chargés par `useLeaflet()`.
|
||||
La page place la colonne : à droite de la carte au bureau, sous la carte au téléphone.
|
||||
-->
|
||||
<template>
|
||||
<div v-if="encarts.length" class="encarts" role="region" aria-label="Outre-mer">
|
||||
<section v-for="e in encarts" :key="e.territoire.nom" class="encart">
|
||||
<h3 class="encart__titre">{{ e.territoire.nom }} <span class="encart__n">· {{ e.n }} {{ e.n > 1 ? 'fiches' : 'fiche' }}</span></h3>
|
||||
<div :ref="(el) => poserRef(e.territoire.nom, el as HTMLElement | null)" class="encart__carte" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Marker } from 'leaflet'
|
||||
import { dessinEpingle, encartsAMontrer, popupHtml, type EpingleCarte, type StyleCarte } from '~/utils/carte'
|
||||
|
||||
const props = defineProps<{
|
||||
/** Épingles d'outre-mer du résultat courant (champ `territoire` posé). */
|
||||
epingles: EpingleCarte[]
|
||||
dessin: StyleCarte
|
||||
selectedId?: string | null
|
||||
/** « Voir sur la carte » d'une fiche d'outre-mer : l'encart vient à l'écran, la carte se recentre. */
|
||||
centrage?: { id: string; n: number } | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{ select: [id: string] }>()
|
||||
|
||||
const baseTiles = useBaseTiles()
|
||||
const encarts = computed(() => encartsAMontrer(props.epingles))
|
||||
|
||||
const elements = new Map<string, HTMLElement>()
|
||||
const cartes = new Map<string, any>()
|
||||
const tuiles = new Map<string, any>()
|
||||
const marqueurs = new Map<string, Marker>()
|
||||
let L: any = null
|
||||
let observateurTheme: MutationObserver | null = null
|
||||
// Un encart change de taille avec la colonne (Mixte ↔ Carte, rotation) : Leaflet doit le savoir
|
||||
const observateurTaille = import.meta.client ? new ResizeObserver((entrees) => {
|
||||
for (const en of entrees) for (const c of cartes.values()) if (c.getContainer() === en.target) c.invalidateSize({ pan: false })
|
||||
}) : null
|
||||
|
||||
function poserRef(nom: string, el: HTMLElement | null) {
|
||||
if (el) elements.set(nom, el)
|
||||
else elements.delete(nom)
|
||||
}
|
||||
|
||||
function icone(e: EpingleCarte) {
|
||||
const d = dessinEpingle(props.dessin, e.cle, e.id === props.selectedId, false, true)
|
||||
return L.divIcon({ className: '', html: d.html, iconSize: [d.taille, d.taille], iconAnchor: [d.taille / 2, d.taille / 2], popupAnchor: [0, -(d.taille / 2 + 4)] })
|
||||
}
|
||||
|
||||
/** Monte les encarts apparus, démonte ceux qui ont disparu, repose toutes les épingles. */
|
||||
async function synchroniser() {
|
||||
L ??= await useLeaflet()
|
||||
await nextTick()
|
||||
const voulus = new Set(encarts.value.map((e) => e.territoire.nom))
|
||||
for (const [nom, c] of cartes) {
|
||||
if (!voulus.has(nom) || !elements.get(nom)?.isConnected || c.getContainer() !== elements.get(nom)) {
|
||||
observateurTaille?.unobserve(c.getContainer())
|
||||
c.remove()
|
||||
cartes.delete(nom)
|
||||
tuiles.delete(nom)
|
||||
}
|
||||
}
|
||||
const sombre = document.documentElement.classList.contains('dark')
|
||||
for (const { territoire: t } of encarts.value) {
|
||||
const el = elements.get(t.nom)
|
||||
if (!el || cartes.has(t.nom)) continue
|
||||
const c = L.map(el, { center: t.centre, zoom: t.zoom, zoomControl: false, attributionControl: false, keyboard: false })
|
||||
const tl = L.tileLayer(baseTiles.url(sombre), { attribution: baseTiles.attribution, maxZoom: 19 })
|
||||
tl.addTo(c)
|
||||
cartes.set(t.nom, c)
|
||||
observateurTaille?.observe(el)
|
||||
tuiles.set(t.nom, tl)
|
||||
}
|
||||
poserEpingles()
|
||||
}
|
||||
|
||||
function poserEpingles() {
|
||||
for (const m of marqueurs.values()) m.remove()
|
||||
marqueurs.clear()
|
||||
for (const e of props.epingles) {
|
||||
const c = e.territoire ? cartes.get(e.territoire) : null
|
||||
if (!c) continue
|
||||
const m = L.marker(e.coords, { icon: icone(e), title: e.nom })
|
||||
m.bindPopup(popupHtml(e), { maxWidth: 220 })
|
||||
m.on('popupopen', (ev: any) => {
|
||||
ev.popup.getElement()?.querySelector('[data-ouvrir]')?.addEventListener('click', () => emit('select', e.id), { once: true })
|
||||
})
|
||||
m.on('click', () => emit('select', e.id))
|
||||
m.addTo(c)
|
||||
marqueurs.set(e.id, m)
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => props.epingles, () => { synchroniser() })
|
||||
|
||||
watch(() => props.selectedId, (nouveau, ancien) => {
|
||||
if (!L) return
|
||||
for (const id of [ancien, nouveau]) {
|
||||
const m = id == null ? undefined : marqueurs.get(id)
|
||||
const e = props.epingles.find((x) => x.id === id)
|
||||
if (m && e) m.setIcon(icone(e))
|
||||
}
|
||||
})
|
||||
|
||||
watch(() => props.centrage?.n, () => {
|
||||
const c = props.centrage
|
||||
if (!c) return
|
||||
setTimeout(() => {
|
||||
const e = props.epingles.find((x) => x.id === c.id)
|
||||
const carte = e?.territoire ? cartes.get(e.territoire) : null
|
||||
const m = marqueurs.get(c.id)
|
||||
if (!carte || !m) return
|
||||
elements.get(e!.territoire!)?.scrollIntoView({ block: 'nearest' })
|
||||
carte.invalidateSize({ pan: false })
|
||||
carte.panTo(m.getLatLng(), { animate: true })
|
||||
}, 260)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
if (props.epingles.length) synchroniser()
|
||||
observateurTheme = new MutationObserver(() => {
|
||||
const url = baseTiles.url(document.documentElement.classList.contains('dark'))
|
||||
for (const tl of tuiles.values()) tl.setUrl(url)
|
||||
})
|
||||
observateurTheme.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] })
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
observateurTheme?.disconnect()
|
||||
observateurTaille?.disconnect()
|
||||
for (const c of cartes.values()) c.remove()
|
||||
cartes.clear()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.encarts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-xs);
|
||||
padding: var(--space-xs);
|
||||
background: var(--bg);
|
||||
overflow-y: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.encart {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: var(--radius-md);
|
||||
overflow: hidden;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.encart__titre {
|
||||
margin: 0;
|
||||
padding: var(--space-2xs) var(--space-sm);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
color: var(--text);
|
||||
}
|
||||
.encart__n {
|
||||
font-weight: var(--fw-regular);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent); /* DESIGN-SYSTEM §Texte atténué, pas --text-muted */
|
||||
}
|
||||
.encart__carte {
|
||||
height: 170px;
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
@@ -37,9 +37,11 @@ const props = withDefaults(defineProps<{
|
||||
fiches: CodevFiche[]
|
||||
matches?: CodevMatch[]
|
||||
mode?: 'none' | 'solution' | 'alliance' | 'surprise'
|
||||
showLabels?: boolean
|
||||
}>(), {
|
||||
matches: () => [],
|
||||
mode: 'none',
|
||||
showLabels: false,
|
||||
})
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -146,18 +148,15 @@ function rebuildLinks() {
|
||||
currentLinks = buildLinks(currentNodes)
|
||||
if (!gLinks || !simulation) return
|
||||
|
||||
const linkSel = gLinks
|
||||
// .join() moderne D3 pour garantir le re-rendu complet
|
||||
gLinks
|
||||
.selectAll<SVGLineElement, SimLink>('line')
|
||||
.data(currentLinks, (d: SimLink) => {
|
||||
const s = d.source as SimNode
|
||||
const t = d.target as SimNode
|
||||
return `${s.id}-${t.id}-${d.mode}`
|
||||
})
|
||||
|
||||
linkSel.exit().remove()
|
||||
|
||||
linkSel.enter()
|
||||
.append('line')
|
||||
.data(currentLinks)
|
||||
.join(
|
||||
enter => enter.append('line'),
|
||||
update => update,
|
||||
exit => exit.remove()
|
||||
)
|
||||
.attr('stroke', d => linkColor(d.mode))
|
||||
.attr('stroke-width', d => 1 + d.score * 3)
|
||||
.attr('stroke-opacity', 0.7)
|
||||
@@ -223,12 +222,12 @@ function render() {
|
||||
.attr('stroke', '#fff')
|
||||
.attr('stroke-width', 1.5)
|
||||
|
||||
// Pastille besoin (bas-droite, orange)
|
||||
// Pastille besoin (bas-droite, bleu)
|
||||
nodeGroups.append('circle')
|
||||
.attr('r', 6)
|
||||
.attr('cx', r * 0.65)
|
||||
.attr('cy', r * 0.65)
|
||||
.attr('fill', '#f97316')
|
||||
.attr('fill', '#3b82f6')
|
||||
.attr('stroke', '#fff')
|
||||
.attr('stroke-width', 1.5)
|
||||
|
||||
@@ -236,6 +235,57 @@ function render() {
|
||||
nodeGroups.append('title')
|
||||
.text(d => `${d.nom}\nOffre : ${d.offre}\nBesoin : ${d.besoin}`)
|
||||
|
||||
// Groupe label bulle (affiche si showLabels)
|
||||
const labelGroups = nodeGroups.append('g')
|
||||
.attr('class', 'label-bubble')
|
||||
.attr('visibility', props.showLabels ? 'visible' : 'hidden')
|
||||
|
||||
// Fond bulle besoin (dessous du noeud)
|
||||
labelGroups.append('rect')
|
||||
.attr('class', 'bubble-besoin-bg')
|
||||
.attr('x', -(r + 50))
|
||||
.attr('y', r + 4)
|
||||
.attr('width', 100)
|
||||
.attr('height', 28)
|
||||
.attr('rx', 6)
|
||||
.attr('fill', '#eff6ff')
|
||||
.attr('stroke', '#3b82f6')
|
||||
.attr('stroke-width', 1)
|
||||
|
||||
// Texte besoin
|
||||
labelGroups.append('text')
|
||||
.attr('class', 'bubble-besoin-txt')
|
||||
.attr('x', -(r) + 50)
|
||||
.attr('y', r + 22)
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('font-size', 9)
|
||||
.attr('fill', '#1e40af')
|
||||
.attr('pointer-events', 'none')
|
||||
.text(d => truncate(d.besoin, 18))
|
||||
|
||||
// Fond bulle offre (dessus du noeud)
|
||||
labelGroups.append('rect')
|
||||
.attr('class', 'bubble-offre-bg')
|
||||
.attr('x', -(r + 50))
|
||||
.attr('y', -(r + 32))
|
||||
.attr('width', 100)
|
||||
.attr('height', 28)
|
||||
.attr('rx', 6)
|
||||
.attr('fill', '#f0fdf4')
|
||||
.attr('stroke', '#22c55e')
|
||||
.attr('stroke-width', 1)
|
||||
|
||||
// Texte offre
|
||||
labelGroups.append('text')
|
||||
.attr('class', 'bubble-offre-txt')
|
||||
.attr('x', -(r) + 50)
|
||||
.attr('y', -(r + 14))
|
||||
.attr('text-anchor', 'middle')
|
||||
.attr('font-size', 9)
|
||||
.attr('fill', '#166534')
|
||||
.attr('pointer-events', 'none')
|
||||
.text(d => truncate(d.offre, 18))
|
||||
|
||||
// Simulation
|
||||
simulation = d3.forceSimulation<SimNode, SimLink>(currentNodes)
|
||||
.force('link', d3.forceLink<SimNode, SimLink>(currentLinks)
|
||||
@@ -245,6 +295,8 @@ function render() {
|
||||
.force('charge', d3.forceManyBody<SimNode>().strength(-400))
|
||||
.force('center', d3.forceCenter(width.value / 2, height.value / 2))
|
||||
.force('collide', d3.forceCollide<SimNode>().radius(r + 12))
|
||||
.force('x', d3.forceX(width.value / 2).strength(0.05))
|
||||
.force('y', d3.forceY(height.value / 2).strength(0.05))
|
||||
.alphaDecay(0.02)
|
||||
.on('tick', tick)
|
||||
|
||||
@@ -254,16 +306,21 @@ function render() {
|
||||
}
|
||||
|
||||
function tick() {
|
||||
const r = nodeRadius.value
|
||||
if (!gLinks || !gNodes) return
|
||||
|
||||
gLinks.selectAll<SVGLineElement, SimLink>('line')
|
||||
.attr('x1', d => (d.source as SimNode).x ?? 0)
|
||||
.attr('y1', d => (d.source as SimNode).y ?? 0)
|
||||
.attr('x2', d => (d.target as SimNode).x ?? 0)
|
||||
.attr('y2', d => (d.target as SimNode).y ?? 0)
|
||||
.attr('x1', d => Math.max(r, Math.min(width.value - r, (d.source as SimNode).x ?? 0)))
|
||||
.attr('y1', d => Math.max(r, Math.min(height.value - r, (d.source as SimNode).y ?? 0)))
|
||||
.attr('x2', d => Math.max(r, Math.min(width.value - r, (d.target as SimNode).x ?? 0)))
|
||||
.attr('y2', d => Math.max(r, Math.min(height.value - r, (d.target as SimNode).y ?? 0)))
|
||||
|
||||
gNodes.selectAll<SVGGElement, SimNode>('g.node')
|
||||
.attr('transform', d => `translate(${d.x ?? 0},${d.y ?? 0})`)
|
||||
.attr('transform', d => {
|
||||
const x = Math.max(r, Math.min(width.value - r, d.x ?? 0))
|
||||
const y = Math.max(r, Math.min(height.value - r, d.y ?? 0))
|
||||
return `translate(${x},${y})`
|
||||
})
|
||||
}
|
||||
|
||||
// ── Watch matches/mode (hook pour M4) ─────────────────────────────────────
|
||||
@@ -271,13 +328,21 @@ function tick() {
|
||||
watch(() => [props.matches, props.mode] as const, () => {
|
||||
if (!simulation) return
|
||||
rebuildLinks()
|
||||
simulation.force('link', d3.forceLink<SimNode, SimLink>(currentLinks)
|
||||
.id(d => d.id)
|
||||
const newForce = d3.forceLink<SimNode, SimLink>(currentLinks)
|
||||
.id(d => String(d.id))
|
||||
.distance(120)
|
||||
.strength(0.3))
|
||||
simulation.alpha(0.5).restart()
|
||||
.strength(0.5)
|
||||
simulation.force('link', newForce)
|
||||
simulation.alpha(0.8).restart()
|
||||
}, { deep: true })
|
||||
|
||||
// ── Watch showLabels ──────────────────────────────────────────────────────
|
||||
|
||||
watch(() => props.showLabels, (val) => {
|
||||
if (!svgEl.value) return
|
||||
d3.select(svgEl.value).selectAll('.label-bubble').attr('visibility', val ? 'visible' : 'hidden')
|
||||
})
|
||||
|
||||
// ── Watch fiches (re-render si nouvelles fiches) ───────────────────────────
|
||||
|
||||
watch(() => props.fiches, () => {
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<template>
|
||||
<figure class="barre">
|
||||
<svg viewBox="0 0 600 244" role="img" aria-labelledby="barre-titre barre-desc">
|
||||
<title id="barre-titre">Deux heures, découpées</title>
|
||||
<desc id="barre-desc">
|
||||
Coucou, 10 minutes. Temps collectif, 20 à 30 minutes. Entraide, 1 heure 20 : un quart d'heure par personne,
|
||||
cinq minutes pour poser le sujet, cinq pour les questions, cinq pour les conseils. Clôture, 5 minutes.
|
||||
</desc>
|
||||
<!-- noms au-dessus : les deux longs segments -->
|
||||
<text x="52" y="26" class="b-nom">Temps collectif</text>
|
||||
<text x="375" y="26" class="b-nom" text-anchor="middle">Entraide</text>
|
||||
<!-- la barre : 10 + 25 + 80 + 5 = 120 minutes, 5 unités par minute -->
|
||||
<rect x="0" y="40" width="48" height="52" rx="6" class="b-seg b-seg--clair" />
|
||||
<rect x="51" y="40" width="122" height="52" rx="6" class="b-seg b-seg--moyen" />
|
||||
<rect x="176" y="40" width="397" height="52" rx="6" class="b-seg b-seg--fort" />
|
||||
<rect x="576" y="40" width="24" height="52" rx="6" class="b-seg b-seg--clair" />
|
||||
<text x="24" y="74" class="b-duree" text-anchor="middle">10′</text>
|
||||
<text x="112" y="74" class="b-duree" text-anchor="middle">20-30′</text>
|
||||
<text x="375" y="74" class="b-duree b-duree--inverse" text-anchor="middle">1 h 20</text>
|
||||
<!-- noms en dessous : les deux courts -->
|
||||
<text x="0" y="122" class="b-nom">Coucou · 10′</text>
|
||||
<text x="600" y="122" class="b-nom" text-anchor="end">Clôture · 5′</text>
|
||||
<!-- zoom : un quart d'heure par personne -->
|
||||
<path d="M176 96 L176 146 M573 96 L573 146" class="b-zoom" />
|
||||
<g v-for="(s, i) in ['sujet', 'questions', 'conseils']" :key="s" :transform="`translate(${176 + i * 133.5} 146)`">
|
||||
<rect width="130" height="60" rx="5" class="b-sous" />
|
||||
<text x="65" y="26" class="b-sous-txt" text-anchor="middle">{{ s }}</text>
|
||||
<text x="65" y="49" class="b-sous-txt b-sous-txt--duree" text-anchor="middle">5′</text>
|
||||
</g>
|
||||
<text x="374.5" y="236" class="b-legende" text-anchor="middle">un quart d'heure par personne</text>
|
||||
</svg>
|
||||
</figure>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.barre { margin: var(--space-lg) 0; }
|
||||
.barre svg { display: block; width: 100%; height: auto; overflow: visible; }
|
||||
.b-nom { font-size: 23px; font-weight: 700; fill: var(--text); }
|
||||
.b-seg--clair { fill: var(--bg-alt); stroke: var(--border-strong); }
|
||||
.b-seg--moyen { fill: color-mix(in srgb, var(--nav-primary-solid) 28%, var(--surface)); }
|
||||
.b-seg--fort { fill: var(--nav-primary-solid); }
|
||||
.b-duree { font-size: 23px; font-weight: 700; fill: var(--text); }
|
||||
.b-duree--inverse { fill: var(--nav-text-on-primary); }
|
||||
.b-zoom { stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 4 4; fill: none; }
|
||||
.b-sous { fill: var(--surface); stroke: var(--nav-primary-solid); stroke-width: 1.5; }
|
||||
.b-sous-txt { font-size: 21px; font-weight: 600; fill: var(--text); }
|
||||
.b-sous-txt--duree { font-weight: 400; }
|
||||
.b-legende { font-size: 20px; fill: color-mix(in srgb, var(--text) 78%, transparent); }
|
||||
</style>
|
||||
@@ -0,0 +1,141 @@
|
||||
<!--
|
||||
BandeauEchelles — B13b-M3
|
||||
Les trois échelles en trois ronds reliés par un trait, comme un « 1 2 3 » (retour de Jules
|
||||
du 13/10) : S — M — XL, centrés ; l'active en safran plein (`--accent` / `--on-accent`),
|
||||
les autres en contour ; le nom de l'active en petit dessous (un seul texte, jamais trois).
|
||||
Le rond est le lien (≥ 44 px, lettre à 15 px) : plus de pastille dans un bouton.
|
||||
Ordre et textes : utils/echelles.ts (ORDRE_ECHELLES, ECHELLES[id].titre), rien de recopié.
|
||||
|
||||
Le composant ne connaît ni l'entrée ni la route : `lien(id)` dit où mène chaque rond,
|
||||
`replace` comment, `actif` lequel est allumé. Sur l'entrée : `?porte=` en `replace`.
|
||||
Pour B14 (remplacer la barre NavEchelles sur toutes les pages) : `lien` vise la porte
|
||||
de l'entrée, `actif` lit `echelleDeRoute(route)?.echelle`, `courant="page"`, `:nom="false"`
|
||||
si la barre n'a pas la hauteur du nom ; aucune réécriture du composant. Ce qu'il ne porte
|
||||
pas : les onglets de chaque groupe (NavEchelles en affiche sept) ; sur l'entrée, ils sont
|
||||
dans la rangée de boutons de la porte.
|
||||
B14b : `bouton` (facultatif) fait des ronds des boutons, pas des liens : la barre du site
|
||||
(NavPortes) ouvre le volet d'une échelle au lieu de naviguer. `ouvert` = le rond dont le
|
||||
volet est ouvert (`aria-expanded`), `controle` = l'id du volet (`aria-controls`), `choisir`
|
||||
= ce que fait un clic. Sans `bouton`, rien ne change (l'entrée, le tiroir).
|
||||
-->
|
||||
<template>
|
||||
<nav class="pas" :aria-label="libelle">
|
||||
<ol class="pas__liste">
|
||||
<li v-for="id in ORDRE_ECHELLES" :key="id" class="pas__item">
|
||||
<button
|
||||
v-if="bouton"
|
||||
type="button"
|
||||
class="pas__rond"
|
||||
:class="{ 'pas__rond--actif': actif === id, 'pas__rond--ouvert': bouton.ouvert === id }"
|
||||
:aria-current="actif === id ? courant : undefined"
|
||||
:aria-expanded="bouton.ouvert === id ? 'true' : 'false'"
|
||||
:aria-controls="bouton.controle"
|
||||
:data-porte="id"
|
||||
@click="bouton.choisir(id)"
|
||||
><span aria-hidden="true">{{ id }}</span><span class="sr-only">{{ id }} · {{ ECHELLES[id].titre }}</span></button>
|
||||
<NuxtLink
|
||||
v-else
|
||||
:to="lien(id)"
|
||||
:replace="replace"
|
||||
class="pas__rond"
|
||||
:class="{ 'pas__rond--actif': actif === id }"
|
||||
:aria-current="actif === id ? courant : undefined"
|
||||
:data-porte="id"
|
||||
><span aria-hidden="true">{{ id }}</span><span class="sr-only">{{ id }} · {{ ECHELLES[id].titre }}</span></NuxtLink>
|
||||
</li>
|
||||
</ol>
|
||||
<p v-if="actif && nom" class="pas__nom" aria-hidden="true">{{ ECHELLES[actif].titre }}</p>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { RouteLocationRaw } from 'vue-router'
|
||||
import { ECHELLES, ORDRE_ECHELLES, type EchelleId } from '~/utils/echelles'
|
||||
|
||||
withDefaults(defineProps<{
|
||||
/** Échelle allumée (safran plein), ou aucune. */
|
||||
actif?: EchelleId | null
|
||||
/** Où mène chaque rond. */
|
||||
lien: (id: EchelleId) => RouteLocationRaw
|
||||
/** Navigation en `replace` (passage latéral de l'entrée). */
|
||||
replace?: boolean
|
||||
/** Valeur d'`aria-current` sur l'actif : `true` sur l'entrée, `page` dans une barre de site. */
|
||||
courant?: 'true' | 'page' | 'location'
|
||||
/** Nom de la navigation pour les lecteurs d'écran. */
|
||||
libelle?: string
|
||||
/** Le nom de l'échelle active, en petit sous les ronds. */
|
||||
nom?: boolean
|
||||
/** B14b : ronds en boutons (barre du site, NavPortes) ; absent, ce sont des liens. */
|
||||
bouton?: { ouvert: EchelleId | null; controle: string; choisir: (id: EchelleId) => void } | null
|
||||
}>(), { actif: null, replace: false, courant: 'true', libelle: 'Échelles S, M, XL', nom: true, bouton: null })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pas {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.pas__liste {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.pas__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
/* Le trait qui relie deux ronds */
|
||||
.pas__item + .pas__item::before {
|
||||
content: "";
|
||||
width: 16px;
|
||||
height: 2px;
|
||||
background: var(--border-strong);
|
||||
}
|
||||
|
||||
.pas__rond {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 2px solid var(--border-strong);
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
font-size: 15px;
|
||||
font-weight: var(--fw-bold);
|
||||
letter-spacing: 0.02em;
|
||||
line-height: 1;
|
||||
text-decoration: none;
|
||||
transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
|
||||
}
|
||||
.pas__rond:hover { border-color: var(--accent); }
|
||||
.pas__rond:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.pas__rond--actif {
|
||||
border-color: var(--accent);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
|
||||
.pas__nom {
|
||||
margin: 0;
|
||||
font-size: var(--fs-xs);
|
||||
font-weight: var(--fw-semibold);
|
||||
line-height: 1.3;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.pas__rond { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,856 @@
|
||||
<!--
|
||||
SchemaEchelles — B13-M2
|
||||
Le schéma des trois échelles (deck v3.3, slide 16, `drawEchelles`), porté en SVG
|
||||
déclaratif : rendu côté serveur, présent au premier affichage (CONCEPTION §7).
|
||||
Géométrie : utils/figures.ts ; textes : utils/echelles.ts (source unique).
|
||||
|
||||
taille="grand" (état 0 de l'entrée) : la figure + les trois portes en liens HTML
|
||||
(lettre, titre, accroche de la slide 16). Arcs « ce qui sort / ce qui revient »
|
||||
gardés dans le SVG à partir de 1 024 px seulement (16 px environ) ; en dessous ils
|
||||
seraient à 9 px. Ouvrir une porte = `push`.
|
||||
B13b-M1 : chaque anneau porte sa lettre et son nom à toutes les tailles (nom à 26 unités,
|
||||
11,4 px rendus à 390 px), et les sept mots de son échelle (ECHELLES[id].mots) :
|
||||
M et XL en bandeau le long du bord extérieur, qui tourne (M horaire, XL antihoraire,
|
||||
un tour en 75 s) ; S, un mot à la fois au centre, en fondu (2,5 s par mot). Les bandeaux
|
||||
et les mots de S sont des calques HTML posés sur la figure (un <svg> par bandeau, un
|
||||
<span> par mot) : `transform` et `opacity` y tournent sur le compositeur, sans repeindre
|
||||
le SVG ni réveiller le fil principal. CSS seul ; arrêt sous `prefers-reduced-motion`
|
||||
(bandeaux immobiles, premier mot de S) et par le bouton pause (WCAG 2.2.2).
|
||||
B13b-M2 : le grand schéma reste à l'écran quand une porte s'ouvre (`reduit`), la page
|
||||
ne le remplace plus. Téléphone : la figure passe à 40 % de sa largeur (280 ms), le titre,
|
||||
les portes et la phrase se replient (hauteur 1fr → 0fr) ; bureau : la figure se réduit
|
||||
à 15rem en tête de colonne, sous « ← Revenir au schéma » (la page la fait glisser, FLIP).
|
||||
Réduite, la figure est décorative : ni noms ni mots (illisibles à cette taille), bandeaux
|
||||
arrêtés ; ses anneaux restent des cibles (passage latéral, `replace`).
|
||||
taille="mini" (porte ouverte, B13b-M3) : le bandeau, trois ronds S — M — XL reliés
|
||||
(BandeauEchelles), centrés, l'actif en safran ; au téléphone, « ← Schéma » à gauche
|
||||
(au bureau, le retour est en tête de colonne, porté par le grand schéma réduit).
|
||||
Collant au téléphone, sous la figure réduite au bureau. Passer d'une porte à l'autre
|
||||
= `replace` (une seule entrée d'historique par visite).
|
||||
|
||||
Survol ou focus d'un anneau allume sa porte, et l'inverse. Les anneaux sont des
|
||||
cibles de pointeur ; au clavier, ce sont les liens qui portent l'action (le SVG est
|
||||
une image décrite en `grand`, décoratif en `mini`).
|
||||
-->
|
||||
<template>
|
||||
<div
|
||||
class="schema"
|
||||
:class="[`schema--${taille}`, { 'schema--apparition': joueApparition, 'schema--reduit': taille === 'grand' && reduit }]"
|
||||
@mouseleave="survol = null"
|
||||
>
|
||||
<!-- Repliables (B13b-M2) : une grille d'une ligne qui passe de 1fr à 0fr. -->
|
||||
<div v-if="$slots.avant" class="schema__plie schema__avant"><div class="schema__plie-dedans"><slot name="avant" /></div></div>
|
||||
|
||||
<!-- Mini : le bandeau. Au téléphone, le retour au schéma à gauche, les trois ronds au centre. -->
|
||||
<template v-if="taille === 'mini'">
|
||||
<a
|
||||
:href="hrefSchema"
|
||||
class="schema__fermer"
|
||||
@click.prevent="emit('fermer')"
|
||||
><span aria-hidden="true">←</span><span class="sr-only">Revenir au </span>Schéma</a>
|
||||
<BandeauEchelles :actif="actif" :lien="lienPorte" replace class="schema__pas" />
|
||||
</template>
|
||||
|
||||
<!-- Bureau, porte ouverte : le retour en tête de colonne, au-dessus de la figure réduite. -->
|
||||
<a
|
||||
v-if="taille === 'grand' && reduit"
|
||||
:href="hrefSchema"
|
||||
class="schema__retour"
|
||||
@click.prevent="emit('fermer')"
|
||||
><span aria-hidden="true">←</span>Revenir au schéma</a>
|
||||
|
||||
<div v-if="taille === 'grand'" class="schema__plie schema__fig"><div class="schema__plie-dedans">
|
||||
<div class="schema__figure" :class="{ 'schema__figure--fige': fige }">
|
||||
<svg
|
||||
class="schema__dessin"
|
||||
:viewBox="`0 0 ${SCHEMA_L} ${SCHEMA_H}`"
|
||||
:role="reduit ? undefined : 'img'"
|
||||
:aria-label="reduit ? undefined : description"
|
||||
:aria-hidden="reduit ? 'true' : undefined"
|
||||
focusable="false"
|
||||
>
|
||||
<g
|
||||
v-for="a in anneaux"
|
||||
:key="a.id"
|
||||
class="schema__anneau"
|
||||
:class="[
|
||||
`schema__anneau--${a.id}`,
|
||||
{ 'schema__anneau--survol': survol === a.id, 'schema__anneau--actif': actif === a.id },
|
||||
]"
|
||||
:style="styleAnneau(a.rang)"
|
||||
@mouseenter="survol = a.id"
|
||||
@click="choisir(a.id)"
|
||||
>
|
||||
<path class="schema__zone" :d="a.zone" fill-rule="evenodd" />
|
||||
<circle class="schema__trait" :cx="a.cx" :cy="a.cy" :r="a.r" />
|
||||
</g>
|
||||
|
||||
<text
|
||||
v-for="a in anneaux"
|
||||
:key="`lettre-${a.id}`"
|
||||
class="schema__lettre"
|
||||
:class="`schema__lettre--${a.id}`"
|
||||
:x="a.cx"
|
||||
:y="a.yLettre"
|
||||
:font-size="a.tailleLettre"
|
||||
text-anchor="middle"
|
||||
:style="styleLettre(a.rang)"
|
||||
>{{ a.id }}</text>
|
||||
|
||||
<template v-if="taille === 'grand'">
|
||||
<text
|
||||
v-for="a in anneaux"
|
||||
:key="`nom-${a.id}`"
|
||||
class="schema__nom"
|
||||
:x="a.cx"
|
||||
:y="a.yNom"
|
||||
:font-size="CORPS.nom"
|
||||
text-anchor="middle"
|
||||
:style="styleLettre(a.rang)"
|
||||
>{{ nomAnneau(a.id) }}</text>
|
||||
|
||||
<defs>
|
||||
<path v-for="arc in arcs" :id="idArc(arc)" :key="idArc(arc)" :d="arc.d" />
|
||||
</defs>
|
||||
<text
|
||||
v-for="arc in arcs"
|
||||
:key="`flux-${idArc(arc)}`"
|
||||
class="schema__flux"
|
||||
font-size="22"
|
||||
><textPath :href="`#${idArc(arc)}`" startOffset="50%" text-anchor="middle">{{ FLECHE[arc.sens] }} {{ ECHELLES_FLUX[arc.frontiere][arc.sens] }}</textPath></text>
|
||||
|
||||
<text class="schema__legende" :x="legende.x" :y="legende.ySort" :font-size="legende.taille" text-anchor="end">{{ FLECHE.sort }} {{ ECHELLES_FLUX_LEGENDE.sort }}</text>
|
||||
<text class="schema__legende" :x="legende.x" :y="legende.yRevient" :font-size="legende.taille" text-anchor="end">{{ FLECHE.revient }} {{ ECHELLES_FLUX_LEGENDE.revient }}</text>
|
||||
</template>
|
||||
</svg>
|
||||
|
||||
<template v-if="taille === 'grand'">
|
||||
<!-- Bandeaux M et XL : un calque par anneau, qui tourne autour du centre de la figure. -->
|
||||
<div
|
||||
v-for="b in bandeaux"
|
||||
:key="`bandeau-${b.id}`"
|
||||
class="schema__bandeau"
|
||||
:class="[`schema__bandeau--${b.id}`, { 'schema__bandeau--masque': MASQUE_BANDEAU[b.id] }]"
|
||||
:style="styleBandeau(b)"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<svg
|
||||
class="schema__tour"
|
||||
:class="`schema__tour--${b.sens}`"
|
||||
:viewBox="`0 0 ${SCHEMA_L} ${SCHEMA_H}`"
|
||||
:style="styleTour"
|
||||
focusable="false"
|
||||
>
|
||||
<defs><path :id="idBandeau(b.id)" :d="b.d" /></defs>
|
||||
<text class="schema__mots" :font-size="CORPS.mot" :textLength="b.longueur" lengthAdjust="spacing"><textPath :href="`#${idBandeau(b.id)}`">{{ textesBandeaux[b.id] }}</textPath></text>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<!-- S : un mot à la fois, au centre du disque, sous le nom. -->
|
||||
<div class="schema__mots-s" :style="styleMotsS" aria-hidden="true">
|
||||
<span
|
||||
v-for="(m, i) in ECHELLES.S.mots"
|
||||
:key="m"
|
||||
class="schema__mot-s"
|
||||
:class="{ 'schema__mot-s--premier': i === 0 }"
|
||||
:style="styleMotS(i)"
|
||||
><span v-for="ligne in lignesMotS(m)" :key="ligne" class="schema__mot-ligne">{{ ligne }}</span></span>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="schema__pause"
|
||||
:aria-pressed="fige ? 'true' : 'false'"
|
||||
@click="fige = !fige"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||
<path v-if="fige" d="M8 5.5v13l10.5-6.5z" />
|
||||
<path v-else d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" />
|
||||
</svg>
|
||||
<span class="sr-only">Mettre les mots en pause</span>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<!-- Grand : les trois portes, qui se replient dans le bandeau quand une porte s'ouvre. -->
|
||||
<Transition name="schema-plier">
|
||||
<div v-if="taille === 'grand' && !reduit" class="schema__plie schema__portes-plie"><div class="schema__plie-dedans">
|
||||
<ul class="schema__portes">
|
||||
<li v-for="id in ORDRE_ECHELLES" :key="id">
|
||||
<NuxtLink
|
||||
:to="lienPorte(id)"
|
||||
class="schema__porte"
|
||||
:class="{ 'schema__porte--survol': survol === id }"
|
||||
:data-porte="id"
|
||||
@mouseenter="survol = id"
|
||||
@focus="survol = id"
|
||||
@blur="survol = null"
|
||||
>
|
||||
<span class="schema__porte-lettre">{{ id }}</span>
|
||||
<span class="schema__porte-texte">
|
||||
<span class="schema__porte-titre">{{ ECHELLES[id].titre }}</span>
|
||||
<span class="schema__porte-accroche">{{ ECHELLES[id].accroche }}</span>
|
||||
</span>
|
||||
<span class="schema__porte-fleche" aria-hidden="true">›</span>
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</div></div>
|
||||
</Transition>
|
||||
|
||||
<div v-if="$slots.apres" class="schema__plie schema__apres"><div class="schema__plie-dedans"><slot name="apres" /></div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useId } from 'vue'
|
||||
import BandeauEchelles from '~/components/entree/BandeauEchelles.vue'
|
||||
import {
|
||||
ECHELLES, ORDRE_ECHELLES, ECHELLES_FLUX, ECHELLES_FLUX_LEGENDE, PARAM_PORTE,
|
||||
type EchelleId,
|
||||
} from '~/utils/echelles'
|
||||
import {
|
||||
SCHEMA_L, SCHEMA_H, anneauxEchelles, arcsFlux, legendeFlux, delaisApparition, finApparition,
|
||||
CORPS, MOUVEMENT_MOTS, MASQUE_BANDEAU, bandeauxAnneaux, motsBandeau, texteBandeau,
|
||||
cadreMotS, lignesMotS, masqueSecteurBas,
|
||||
type ArcFlux, type SensFlux, type BandeauAnneau,
|
||||
} from '~/utils/figures'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
taille: 'grand' | 'mini'
|
||||
/** Porte ouverte (mini) : son anneau et son lien en safran. */
|
||||
actif?: EchelleId | null
|
||||
/**
|
||||
* Première vue du schéma (grand) : les anneaux apparaissent du dehors vers le dedans
|
||||
* (XL, M, S), puis les lettres, en 900 ms au plus, une fois (B13-M6). CSS seul ;
|
||||
* sans effet sous `prefers-reduced-motion` ou si `html.entree-vue` est posé.
|
||||
*/
|
||||
apparition?: boolean
|
||||
/**
|
||||
* Grand, porte ouverte (B13b-M2) : la figure reste, réduite, et ses anneaux passent
|
||||
* d'une porte à l'autre en `replace` ; le titre, les portes et la phrase se replient.
|
||||
*/
|
||||
reduit?: boolean
|
||||
}>(), { actif: null, apparition: false, reduit: false })
|
||||
|
||||
const emit = defineEmits<{ fermer: [] }>()
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const uid = useId()
|
||||
|
||||
const anneaux = anneauxEchelles()
|
||||
const arcs = arcsFlux()
|
||||
const legende = legendeFlux()
|
||||
const bandeaux = bandeauxAnneaux()
|
||||
/** Texte de chaque bandeau : les sept mots d'echelles.ts, repris pour remplir le tour. */
|
||||
const textesBandeaux = Object.fromEntries(
|
||||
bandeaux.map((b) => [b.id, texteBandeau(motsBandeau(ECHELLES[b.id].mots, b.longueur))]),
|
||||
) as Record<BandeauAnneau['id'], string>
|
||||
const rangDe = (id: EchelleId) => anneaux.find((a) => a.id === id)?.rang ?? 0
|
||||
/** Mots arrêtés par le visiteur (bouton pause) : bandeaux immobiles, mot de S figé. */
|
||||
const fige = ref(false)
|
||||
const FLECHE: Record<SensFlux, string> = { sort: '↓', revient: '↑' }
|
||||
/** Icône du retour au schéma (téléphone) : trois cercles, rayons dans l'ordre XL, M, S. */
|
||||
|
||||
const survol = ref<EchelleId | null>(null)
|
||||
|
||||
/** Le nom écrit dans l'anneau, comme sur la slide 16 : le titre de l'échelle, initiale en minuscule. */
|
||||
const nomAnneau = (id: EchelleId) => {
|
||||
const t = ECHELLES[id].titre
|
||||
return t.charAt(0).toLowerCase() + t.slice(1)
|
||||
}
|
||||
|
||||
const idArc = (arc: ArcFlux) => `${uid}-arc-${arc.frontiere}-${arc.sens}`
|
||||
|
||||
/**
|
||||
* Description de la figure, sur le modèle de l'aria-label du deck ; B13b : une phrase par
|
||||
* anneau avec ses sept mots (séparés par des points-virgules, certains portent une virgule).
|
||||
*/
|
||||
const description = (() => {
|
||||
const anneauxTxt = ORDRE_ECHELLES.map((id) => `${id}, ${nomAnneau(id)}`).join(' ; ')
|
||||
const mots = ORDRE_ECHELLES.map((id) => `${id}, ${nomAnneau(id)} : ${ECHELLES[id].mots.join(' ; ')}.`).join(' ')
|
||||
const flux = (f: 'S' | 'M', entre: string) =>
|
||||
`Entre ${entre}, ${ECHELLES_FLUX_LEGENDE.sort} : ${ECHELLES_FLUX[f].sort} ; ${ECHELLES_FLUX_LEGENDE.revient} : ${ECHELLES_FLUX[f].revient}.`
|
||||
return `Trois anneaux imbriqués, S au centre : ${anneauxTxt}. ${mots} ${flux('S', 'S et M')} ${flux('M', 'M et XL')}`
|
||||
})()
|
||||
|
||||
const idBandeau = (id: EchelleId) => `${uid}-bandeau-${id}`
|
||||
|
||||
// Mouvement des mots (B13b-M1) : durées et délais tirés d'utils/figures.ts.
|
||||
// Les bandeaux démarrent après l'apparition du schéma (finApparition, 900 ms).
|
||||
const styleTour = { animationDuration: `${MOUVEMENT_MOTS.tour}ms`, animationDelay: `${finApparition()}ms` }
|
||||
const styleBandeau = (b: BandeauAnneau) => {
|
||||
const masque = MASQUE_BANDEAU[b.id]
|
||||
return {
|
||||
...(masque ? { '--masque': masqueSecteurBas(masque) } : {}),
|
||||
...(joueApparition.value ? { animationDelay: `${delaisApparition(rangDe(b.id)).lettre}ms` } : {}),
|
||||
}
|
||||
}
|
||||
const cadreS = cadreMotS()
|
||||
const styleMotsS = computed(() => ({
|
||||
left: `${(cadreS.x / SCHEMA_L) * 100}%`,
|
||||
top: `${(cadreS.y / SCHEMA_H) * 100}%`,
|
||||
width: `${(cadreS.l / SCHEMA_L) * 100}%`,
|
||||
height: `${(cadreS.h / SCHEMA_H) * 100}%`,
|
||||
...(joueApparition.value ? { animationDelay: `${delaisApparition(rangDe('S')).lettre}ms` } : {}),
|
||||
}))
|
||||
/**
|
||||
* Mot i de S : une boucle de 7 × 2,5 s par mot, décalée de i × 2,5 s. Le premier mot part
|
||||
* à 0 (visible dès l'arrivée, il s'efface à 2,1 s) ; les suivants, à rebours d'un tour,
|
||||
* restent éteints jusqu'à leur tour : le premier changement vient après l'apparition.
|
||||
*/
|
||||
const styleMotS = (i: number) => {
|
||||
const tour = ECHELLES.S.mots.length * MOUVEMENT_MOTS.cadence
|
||||
return {
|
||||
animationDuration: `${tour}ms`,
|
||||
animationDelay: `${i === 0 ? 0 : i * MOUVEMENT_MOTS.cadence - tour}ms`,
|
||||
}
|
||||
}
|
||||
|
||||
function queryPorte(id: EchelleId | null) {
|
||||
const q: Record<string, unknown> = { ...route.query }
|
||||
if (id) q[PARAM_PORTE] = id
|
||||
else delete q[PARAM_PORTE]
|
||||
return q as Record<string, string>
|
||||
}
|
||||
const lienPorte = (id: EchelleId) => ({ path: route.path, query: queryPorte(id) })
|
||||
|
||||
/** Adresse du schéma : le retour reste un vrai lien (nouvel onglet, sans JavaScript). */
|
||||
const hrefSchema = computed(() => router.resolve({ path: route.path, query: queryPorte(null) }).href)
|
||||
|
||||
function choisir(id: EchelleId) {
|
||||
// Porte déjà ouverte (mini, ou grand réduit) : un anneau fait passer à la voisine, en `replace`.
|
||||
const lateral = props.taille === 'mini' || props.reduit
|
||||
if (lateral && props.actif === id) return
|
||||
navigateTo(lienPorte(id), { replace: lateral })
|
||||
}
|
||||
|
||||
// Apparition (B13-M6) : délais par rang, du dehors vers le dedans (utils/figures.ts).
|
||||
const joueApparition = computed(() => props.apparition && props.taille === 'grand')
|
||||
const styleAnneau = (rang: number) =>
|
||||
joueApparition.value ? { animationDelay: `${delaisApparition(rang).anneau}ms` } : undefined
|
||||
const styleLettre = (rang: number) =>
|
||||
joueApparition.value ? { animationDelay: `${delaisApparition(rang).lettre}ms` } : undefined
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ── Commun ────────────────────────────────────────────────────────────── */
|
||||
.schema__figure {
|
||||
position: relative;
|
||||
/* les calques (bandeaux, mots de S) se règlent en unités de la figure */
|
||||
container-type: inline-size;
|
||||
}
|
||||
.schema__dessin {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/* Repliables (B13b-M2) : la hauteur passe de 1fr à 0fr, CSS seul. */
|
||||
.schema__plie {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
min-width: 0;
|
||||
}
|
||||
.schema__plie-dedans { min-height: 0; min-width: 0; }
|
||||
.schema__avant > .schema__plie-dedans,
|
||||
.schema__apres > .schema__plie-dedans { overflow: hidden; }
|
||||
.schema-plier-enter-active > .schema__plie-dedans,
|
||||
.schema-plier-leave-active > .schema__plie-dedans { overflow: hidden; }
|
||||
|
||||
/* Retour au schéma, en tête de colonne (bureau seulement ; au téléphone, il est dans le bandeau). */
|
||||
.schema__retour { display: none; }
|
||||
|
||||
.schema__zone {
|
||||
fill: color-mix(in srgb, var(--nav-primary-solid) 5%, transparent);
|
||||
cursor: pointer;
|
||||
transition: fill 200ms var(--ease-out);
|
||||
}
|
||||
.schema__anneau--M .schema__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 8%, transparent); }
|
||||
.schema__anneau--S .schema__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 12%, transparent); }
|
||||
|
||||
.schema__trait {
|
||||
fill: none;
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 2px;
|
||||
vector-effect: non-scaling-stroke;
|
||||
pointer-events: none;
|
||||
transition: stroke 200ms var(--ease-out);
|
||||
}
|
||||
|
||||
.schema__anneau--survol .schema__zone { fill: color-mix(in srgb, var(--accent) 20%, transparent); }
|
||||
.schema__anneau--actif .schema__zone { fill: color-mix(in srgb, var(--accent) 32%, transparent); }
|
||||
.schema__anneau--survol .schema__trait,
|
||||
.schema__anneau--actif .schema__trait {
|
||||
stroke: var(--accent);
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.schema__lettre,
|
||||
.schema__nom,
|
||||
.schema__flux,
|
||||
.schema__legende {
|
||||
pointer-events: none;
|
||||
font-family: var(--font-body);
|
||||
}
|
||||
.schema__lettre {
|
||||
fill: var(--text);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
.schema__nom,
|
||||
.schema__flux,
|
||||
.schema__legende {
|
||||
fill: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.schema__nom { font-weight: var(--fw-semibold); }
|
||||
.schema__flux,
|
||||
.schema__legende { display: none; }
|
||||
|
||||
/* ── Les mots (B13b-M1) ── */
|
||||
.schema__bandeau {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
/* le calque tourne : ses coins ne doivent pas élargir la page */
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.schema__tour {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
}
|
||||
.schema__mots {
|
||||
font-family: var(--font-body);
|
||||
font-size: 26px;
|
||||
fill: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.schema__mots-s {
|
||||
position: absolute;
|
||||
display: grid;
|
||||
pointer-events: none;
|
||||
}
|
||||
.schema__mot-s {
|
||||
grid-area: 1 / 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
/* 26 unités du viewBox (820 de large) : 11,4 px rendus à 390 px */
|
||||
font-size: calc(100cqw * 26 / 820);
|
||||
line-height: 1.2;
|
||||
color: var(--text);
|
||||
opacity: 0;
|
||||
}
|
||||
.schema__mot-s--premier { opacity: 1; }
|
||||
/* Coupure écrite par lignesMotS (utils/figures.ts) : une ligne ne se recoupe pas. */
|
||||
.schema__mot-ligne { white-space: nowrap; }
|
||||
.schema__pause {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--surface);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
cursor: pointer;
|
||||
}
|
||||
.schema__pause svg {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
fill: currentColor;
|
||||
}
|
||||
.schema__pause:hover { color: var(--text); border-color: var(--accent); }
|
||||
.schema__pause:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.schema__flux { font-style: italic; }
|
||||
.schema__legende { font-family: var(--font-mono); }
|
||||
|
||||
.schema__portes {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
|
||||
.schema__porte {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
min-height: 44px;
|
||||
padding: var(--space-xs) var(--space-sm);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
text-decoration: none;
|
||||
transition: background-color 200ms var(--ease-out), border-color 200ms var(--ease-out);
|
||||
}
|
||||
.schema__porte:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.schema__porte-lettre {
|
||||
flex: 0 0 auto;
|
||||
min-width: 2.25rem;
|
||||
padding: 0.15rem 0.4rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: color-mix(in srgb, var(--nav-primary-solid) 10%, transparent);
|
||||
color: var(--text);
|
||||
font-weight: var(--fw-bold);
|
||||
font-size: var(--fs-sm);
|
||||
text-align: center;
|
||||
letter-spacing: 0.04em;
|
||||
transition: background-color 200ms var(--ease-out);
|
||||
}
|
||||
.schema__porte-texte {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
.schema__porte-titre {
|
||||
font-weight: var(--fw-semibold);
|
||||
font-size: var(--fs-base);
|
||||
line-height: var(--lh-tight);
|
||||
}
|
||||
.schema__porte-accroche {
|
||||
margin-top: 0.15rem;
|
||||
font-size: var(--fs-sm);
|
||||
line-height: 1.35;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.schema__porte-fleche {
|
||||
margin-left: auto;
|
||||
font-size: var(--fs-xl);
|
||||
line-height: 1;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
.schema__porte:hover,
|
||||
.schema__porte--survol {
|
||||
border-color: var(--accent);
|
||||
background: color-mix(in srgb, var(--accent) 14%, var(--surface));
|
||||
}
|
||||
.schema__porte:hover .schema__porte-lettre,
|
||||
.schema__porte--survol .schema__porte-lettre {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
|
||||
/* ── Grand : l'état 0 ──────────────────────────────────────────────────── */
|
||||
.schema--grand {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-areas: "avant" "figure" "portes" "apres";
|
||||
gap: var(--space-sm);
|
||||
width: 100%;
|
||||
max-width: 30rem;
|
||||
margin-inline: auto;
|
||||
}
|
||||
.schema--grand .schema__avant { grid-area: avant; }
|
||||
.schema--grand .schema__fig {
|
||||
grid-area: figure;
|
||||
justify-self: center;
|
||||
width: 100%;
|
||||
max-width: 27.5rem;
|
||||
}
|
||||
.schema--grand .schema__portes-plie { grid-area: portes; }
|
||||
.schema--grand .schema__apres { grid-area: apres; }
|
||||
|
||||
/* ── Grand réduit : la porte est ouverte, le schéma reste (B13b-M2) ───── */
|
||||
.schema--reduit .schema__avant,
|
||||
.schema--reduit .schema__apres {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
}
|
||||
/* Le titre reste lu (h1 de la page) ; la phrase sort de l'arbre une fois repliée. */
|
||||
.schema--reduit .schema__apres { visibility: hidden; }
|
||||
/* Réduite, la figure n'a plus que ses anneaux et ses lettres, plus grandes pour rester lisibles. */
|
||||
.schema--reduit .schema__nom,
|
||||
.schema--reduit .schema__flux,
|
||||
.schema--reduit .schema__legende,
|
||||
.schema--reduit .schema__bandeau,
|
||||
.schema--reduit .schema__mots-s,
|
||||
.schema--reduit .schema__pause {
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
}
|
||||
.schema--reduit .schema__lettre { font-size: 60px; }
|
||||
.schema--reduit .schema__lettre--S {
|
||||
transform: translateY(22px);
|
||||
}
|
||||
|
||||
@media (max-width: 1023.98px) {
|
||||
.schema--reduit .schema__fig { width: 40%; }
|
||||
.schema--grand.schema--reduit { row-gap: 0; }
|
||||
.schema--grand { transition: row-gap 280ms var(--ease-out); }
|
||||
.schema--grand .schema__fig { transition: width 280ms var(--ease-out); }
|
||||
.schema__lettre { transition: font-size 280ms var(--ease-out), transform 280ms var(--ease-out); }
|
||||
.schema__avant,
|
||||
.schema__apres {
|
||||
transition: grid-template-rows 280ms var(--ease-out), opacity 200ms var(--ease-out), visibility 0s linear 0s;
|
||||
}
|
||||
.schema--reduit .schema__apres { transition-delay: 0s, 0s, 280ms; }
|
||||
.schema__nom,
|
||||
.schema__bandeau,
|
||||
.schema__mots-s,
|
||||
.schema__pause {
|
||||
transition: opacity 150ms var(--ease-out), visibility 0s linear 0s;
|
||||
}
|
||||
.schema--reduit .schema__nom,
|
||||
.schema--reduit .schema__bandeau,
|
||||
.schema--reduit .schema__mots-s,
|
||||
.schema--reduit .schema__pause { transition-delay: 0s, 150ms; }
|
||||
.schema-plier-enter-active,
|
||||
.schema-plier-leave-active {
|
||||
transition: grid-template-rows 280ms var(--ease-out), opacity 200ms var(--ease-out);
|
||||
}
|
||||
.schema-plier-enter-from,
|
||||
.schema-plier-leave-to {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.schema--grand {
|
||||
max-width: 68rem;
|
||||
grid-template-columns: minmax(0, 604px) minmax(0, 26rem);
|
||||
grid-template-rows: 1fr auto 1fr;
|
||||
grid-template-areas: "figure avant" "figure portes" "figure apres";
|
||||
column-gap: var(--space-2xl);
|
||||
row-gap: var(--space-md);
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.schema--grand .schema__avant { align-self: end; }
|
||||
.schema--grand .schema__apres { align-self: start; }
|
||||
.schema--grand .schema__fig { max-width: 604px; }
|
||||
|
||||
/* Porte ouverte : une colonne, le retour, la figure réduite (la page la fait glisser). */
|
||||
.schema--grand.schema--reduit {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: var(--space-md);
|
||||
max-width: none;
|
||||
}
|
||||
.schema--reduit .schema__fig {
|
||||
max-width: 15rem;
|
||||
align-self: center;
|
||||
}
|
||||
.schema--reduit .schema__avant {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.schema--reduit .schema__apres { display: none; }
|
||||
.schema__retour {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
align-self: flex-start;
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-xs);
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.schema__retour:hover { background: var(--bg-alt); }
|
||||
.schema__retour:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
/* Retour au schéma : les portes reviennent en fondu, la figure glisse. */
|
||||
.schema-plier-enter-active { transition: opacity 200ms var(--ease-out); }
|
||||
.schema-plier-enter-from { opacity: 0; }
|
||||
.schema--grand .schema__flux,
|
||||
.schema--grand .schema__legende { display: inline; }
|
||||
/* Corps du deck pour les noms (16 px environ à 1 440), mots un peu plus petits qu'au téléphone */
|
||||
.schema--grand .schema__nom { font-size: 22px; }
|
||||
.schema__mots { font-size: 23px; }
|
||||
.schema__mot-s { font-size: calc(100cqw * 23 / 820); }
|
||||
/* Les arcs sont à l'écran : le bandeau M passe derrière le secteur de « ce qui revient » */
|
||||
.schema__bandeau--masque {
|
||||
-webkit-mask-image: var(--masque);
|
||||
mask-image: var(--masque);
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Mini : le bandeau de la porte ouverte (B13b-M3) ───────────────────── */
|
||||
/* Téléphone : « ← Schéma » | trois ronds au centre exact | une colonne vide de même largeur. */
|
||||
.schema--mini {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
|
||||
align-items: center;
|
||||
column-gap: var(--space-xs);
|
||||
padding: 4px 0;
|
||||
}
|
||||
.schema--mini .schema__pas { grid-column: 2; }
|
||||
|
||||
.schema__fermer {
|
||||
grid-column: 1;
|
||||
justify-self: start;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.3em;
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-xs) 0 0;
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
white-space: nowrap;
|
||||
text-decoration: none;
|
||||
}
|
||||
.schema__fermer:hover { text-decoration: underline; text-underline-offset: 3px; }
|
||||
.schema__fermer:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
/* Bureau : les ronds centrés dans la colonne ; le retour est en tête de colonne (grand réduit). */
|
||||
.schema--mini {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 0;
|
||||
}
|
||||
.schema--mini .schema__fermer { display: none; }
|
||||
}
|
||||
|
||||
/*
|
||||
Mouvement réduit : état final, échange immédiat. `!important` : ces règles doivent l'emporter
|
||||
sur les transitions posées plus haut avec un sélecteur plus fort (téléphone, figure réduite) ;
|
||||
sans transition, la <Transition> de Vue retire aussi les portes sans attendre.
|
||||
*/
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.schema__zone,
|
||||
.schema__trait,
|
||||
.schema__porte,
|
||||
.schema__porte-lettre,
|
||||
.schema--grand,
|
||||
.schema__lettre,
|
||||
.schema__fig,
|
||||
.schema__avant,
|
||||
.schema__apres,
|
||||
.schema__nom,
|
||||
.schema__flux,
|
||||
.schema__legende,
|
||||
.schema__bandeau,
|
||||
.schema__mots-s,
|
||||
.schema__pause,
|
||||
.schema-plier-enter-active,
|
||||
.schema-plier-leave-active { transition: none !important; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<!--
|
||||
Apparition (B13-M6), hors du bloc scoped : les @keyframes gardent leur nom et
|
||||
`html.entree-vue` (posé avant le premier rendu par la page si l'apparition a
|
||||
déjà été vue) doit pouvoir l'éteindre. Délais en style en ligne (rang).
|
||||
Reduced motion = état final au premier rendu : `animation: none`, pas une durée
|
||||
raccourcie (le deck gardait les délais et cachait des éléments près d'une seconde).
|
||||
-->
|
||||
<style>
|
||||
.schema--apparition .schema__anneau {
|
||||
animation: aep-schema-anneau 450ms var(--ease-out) backwards;
|
||||
transform-box: fill-box;
|
||||
transform-origin: center;
|
||||
}
|
||||
.schema--apparition .schema__lettre,
|
||||
.schema--apparition .schema__nom {
|
||||
animation: aep-schema-texte 250ms var(--ease-out) backwards;
|
||||
}
|
||||
.schema--apparition .schema__flux,
|
||||
.schema--apparition .schema__legende {
|
||||
animation: aep-schema-texte 250ms var(--ease-out) 650ms backwards;
|
||||
}
|
||||
.schema--apparition .schema__bandeau,
|
||||
.schema--apparition .schema__mots-s {
|
||||
animation: aep-schema-texte 250ms var(--ease-out) backwards;
|
||||
}
|
||||
@keyframes aep-schema-anneau {
|
||||
from { opacity: 0; transform: scale(0.9); }
|
||||
to { opacity: 1; transform: none; }
|
||||
}
|
||||
|
||||
/*
|
||||
Les mots en mouvement (B13b-M1). Durées et délais en style en ligne (utils/figures.ts,
|
||||
MOUVEMENT_MOTS) : un tour de bandeau en 75 s après l'apparition ; un mot de S toutes
|
||||
les 2,5 s. Les pourcentages de `aep-mot-s` valent pour 7 mots : 2,1 s visible
|
||||
(12 %), fondu de 400 ms jusqu'à 2,5 s (14,286 %), éteint, fondu d'entrée à 17,1 s (97,714 %).
|
||||
*/
|
||||
.schema__tour {
|
||||
animation: aep-schema-tour-horaire 75s linear 900ms infinite;
|
||||
}
|
||||
.schema__tour--antihoraire { animation-name: aep-schema-tour-antihoraire; }
|
||||
.schema__mot-s {
|
||||
animation: aep-mot-s 17.5s linear infinite;
|
||||
}
|
||||
.schema__figure--fige .schema__tour,
|
||||
.schema__figure--fige .schema__mot-s,
|
||||
.schema--reduit .schema__tour,
|
||||
.schema--reduit .schema__mot-s {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
@keyframes aep-schema-tour-horaire {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
@keyframes aep-schema-tour-antihoraire {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(-360deg); }
|
||||
}
|
||||
@keyframes aep-mot-s {
|
||||
0%, 12% { opacity: 1; }
|
||||
14.286%, 97.714% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
@keyframes aep-schema-texte {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
html.entree-vue .schema--apparition .schema__anneau,
|
||||
html.entree-vue .schema--apparition .schema__lettre,
|
||||
html.entree-vue .schema--apparition .schema__nom,
|
||||
html.entree-vue .schema--apparition .schema__flux,
|
||||
html.entree-vue .schema--apparition .schema__legende,
|
||||
html.entree-vue .schema--apparition .schema__bandeau,
|
||||
html.entree-vue .schema--apparition .schema__mots-s {
|
||||
animation: none;
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.schema--apparition .schema__anneau,
|
||||
.schema--apparition .schema__lettre,
|
||||
.schema--apparition .schema__nom,
|
||||
.schema--apparition .schema__flux,
|
||||
.schema--apparition .schema__legende,
|
||||
.schema--apparition .schema__bandeau,
|
||||
.schema--apparition .schema__mots-s,
|
||||
.schema__tour,
|
||||
.schema__mot-s {
|
||||
animation: none;
|
||||
}
|
||||
/* rien ne bouge : le bouton pause n'a plus d'objet */
|
||||
.schema__pause { display: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,238 @@
|
||||
<!--
|
||||
SectionEchelle — B13-M4
|
||||
La porte ouverte d'une échelle, sous le mini-schéma de l'entrée (CONCEPTION §1, état 1).
|
||||
Dans l'ordre de lecture à l'écran (parti 1 : une intention, puis un geste) :
|
||||
titre (h2, cible du focus après ouverture ou passage latéral)
|
||||
intention = la phrase de l'échelle
|
||||
une seule rangée de boutons de même style (B13b-M5, `PORTES_ECHELLES[id]`) : le geste,
|
||||
puis les onglets d'une autre cible ; sur M, un bouton « Écosystème d'entraide et
|
||||
réseaux AEP » (la barre B10 garde ses deux onglets jusqu'à B4)
|
||||
anneau (AnneauEchelle, en safran) + les sept mots
|
||||
<slot /> : la matière de l'échelle (B15 pour XL, B16 pour M et S) ; tant qu'il est vide,
|
||||
« Cette échelle est en construction. » et « Proposer une ressource » (B13b-M6) :
|
||||
la condition porte sur le slot, la ligne disparaîtra d'elle-même
|
||||
puis les voisines (passage latéral, en `replace`)
|
||||
Liens sortants sans préchargement : l'entrée ne tire ni la carte (Leaflet), ni le chatbot,
|
||||
ni d3 tant que le visiteur n'a pas choisi (la barre B10 d'app.vue, elle, précharge dès 768 px).
|
||||
B13b-M4 : un clic simple sur un lien sortant émet `partir` (la page replie la section vers
|
||||
le haut, puis navigue) ; un clic modifié (Ctrl, Cmd, Maj, molette) garde la navigation
|
||||
du navigateur. Les `href` rendus ne changent pas : le lien marche sans JavaScript.
|
||||
Titre, phrase et mots viennent d'EchelleTete (contrat B10) ; la section ne fait que
|
||||
les replacer en grille et y glisser le geste et l'anneau. Aucun texte recopié :
|
||||
utils/echelles.ts fait foi.
|
||||
-->
|
||||
<template>
|
||||
<section class="porte" :class="`porte--${echelle}`" :aria-labelledby="titreId">
|
||||
<EchelleTete
|
||||
:echelle="echelle"
|
||||
:contribuer="false"
|
||||
titre-niveau="h2"
|
||||
:titre-id="titreId"
|
||||
class="porte__tete"
|
||||
>
|
||||
<nav class="porte__rangee" :aria-label="`Pages de l'échelle ${e.id}`">
|
||||
<ul class="porte__boutons">
|
||||
<li v-for="b in boutons" :key="b.to">
|
||||
<NuxtLink v-slot="{ href }" :to="b.to" custom no-prefetch>
|
||||
<a :href="href" class="porte__bouton" @click="partir($event, b.to)">{{ b.libelle }}<span aria-hidden="true">→</span></a>
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<AnneauEchelle :echelle="echelle" actif class="porte__anneau" />
|
||||
</EchelleTete>
|
||||
|
||||
<div v-if="$slots.default" class="porte__matiere"><slot /></div>
|
||||
<p v-else class="porte__construction">
|
||||
<span>{{ PORTE_EN_CONSTRUCTION.texte }}</span>
|
||||
<NuxtLink v-slot="{ href }" :to="lienProposer(echelle)" custom no-prefetch>
|
||||
<a :href="href" class="porte__proposer" @click="partir($event, lienProposer(echelle))">{{ PORTE_EN_CONSTRUCTION.proposer }}<span aria-hidden="true">→</span></a>
|
||||
</NuxtLink>
|
||||
</p>
|
||||
|
||||
<nav v-if="v.precedente || v.suivante" class="porte__voisines" aria-label="Échelles voisines">
|
||||
<NuxtLink
|
||||
v-if="v.precedente"
|
||||
:to="lienPorte(v.precedente)"
|
||||
replace
|
||||
class="porte__voisine porte__voisine--precedente"
|
||||
><span aria-hidden="true">←</span>{{ v.precedente }} · {{ ECHELLES[v.precedente].titre }}</NuxtLink>
|
||||
<NuxtLink
|
||||
v-if="v.suivante"
|
||||
:to="lienPorte(v.suivante)"
|
||||
replace
|
||||
class="porte__voisine porte__voisine--suivante"
|
||||
>{{ v.suivante }} · {{ ECHELLES[v.suivante].titre }}<span aria-hidden="true">→</span></NuxtLink>
|
||||
</nav>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ECHELLES, PARAM_PORTE, PORTES_ECHELLES, PORTE_EN_CONSTRUCTION, lienProposer, voisines,
|
||||
type EchelleId,
|
||||
} from '~/utils/echelles'
|
||||
import AnneauEchelle from '~/components/figures/AnneauEchelle.vue'
|
||||
|
||||
const props = defineProps<{ echelle: EchelleId }>()
|
||||
const emit = defineEmits<{ partir: [to: string] }>()
|
||||
|
||||
/**
|
||||
* Lien sortant (B13b-M4) : clic simple → la page replie l'entrée puis navigue ;
|
||||
* clic modifié ou autre bouton → rien n'est intercepté, le navigateur fait son travail.
|
||||
*/
|
||||
function partir(ev: MouseEvent, to: string) {
|
||||
if (ev.defaultPrevented || ev.button !== 0 || ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) return
|
||||
ev.preventDefault()
|
||||
emit('partir', to)
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
const e = computed(() => ECHELLES[props.echelle])
|
||||
/**
|
||||
* La rangée de boutons de la porte (geste et onglets réunis, sans doublon). En M, la carte
|
||||
* vers /connaissances (B19-M5, amendement à B16 M2) dérive de l'onglet « Connaissances
|
||||
* partagées » posé dans utils/echelles.ts au checkpoint B18-B19 (Q7) : rien à ajouter ici.
|
||||
*/
|
||||
const boutons = computed(() => PORTES_ECHELLES[props.echelle])
|
||||
const v = computed(() => voisines(props.echelle))
|
||||
/** id stable par échelle : la page y pose le focus après une ouverture ou un passage latéral. */
|
||||
const titreId = computed(() => `porte-titre-${props.echelle}`)
|
||||
|
||||
const lienPorte = (id: EchelleId) => ({ path: route.path, query: { ...route.query, [PARAM_PORTE]: id } })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.porte {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-lg);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* EchelleTete replacée en grille : titre, intention, rangée de boutons, puis l'anneau à côté des mots. */
|
||||
.porte .porte__tete {
|
||||
display: grid;
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
grid-template-areas:
|
||||
"titre titre"
|
||||
"phrase phrase"
|
||||
"geste geste"
|
||||
"anneau mots";
|
||||
column-gap: var(--space-md);
|
||||
row-gap: var(--space-sm);
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
}
|
||||
.porte__tete :deep(.echelle-tete__kicker) {
|
||||
grid-area: titre;
|
||||
scroll-margin-top: 4.5rem;
|
||||
}
|
||||
.porte__tete :deep(.echelle-tete__kicker:focus) { outline: none; }
|
||||
.porte__tete :deep(.echelle-tete__kicker:focus-visible) {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 4px;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
.porte__tete :deep(.echelle-tete__titre) { font-size: var(--fs-xl); }
|
||||
/* Texte atténué lisible (DESIGN-SYSTEM §Navigation : 78 %, pas --text-muted), ici seulement. */
|
||||
.porte__tete :deep(.echelle-tete__sous-titre) {
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.porte__tete :deep(.echelle-tete__phrase) {
|
||||
grid-area: phrase;
|
||||
font-size: var(--fs-base);
|
||||
font-style: normal;
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.porte__tete :deep(.echelle-tete__mots) { grid-area: mots; }
|
||||
|
||||
/* Une seule rangée, tous les boutons du style du geste (B13b-M5) ; retour à la ligne permis. */
|
||||
.porte__rangee { grid-area: geste; }
|
||||
.porte__boutons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-xs);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
.porte__bouton {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
min-height: 44px;
|
||||
padding: var(--space-xs) var(--space-md);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: var(--fw-semibold);
|
||||
line-height: var(--lh-tight);
|
||||
text-decoration: none;
|
||||
}
|
||||
.porte__bouton:hover { opacity: 0.88; }
|
||||
.porte__bouton:focus-visible,
|
||||
.porte__proposer:focus-visible,
|
||||
.porte__voisine:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* En construction (B13b-M6) : une ligne, puis un bouton secondaire (contour, pas safran). */
|
||||
.porte__construction {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-xs) var(--space-sm);
|
||||
margin: 0;
|
||||
font-size: var(--fs-sm);
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.porte__proposer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
min-height: 44px;
|
||||
padding: var(--space-xs) var(--space-md);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
background: transparent;
|
||||
color: var(--text);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.porte__proposer:hover { border-color: var(--accent); }
|
||||
|
||||
.porte__anneau {
|
||||
grid-area: anneau;
|
||||
width: 4.5rem;
|
||||
}
|
||||
|
||||
.porte__voisines {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-xs);
|
||||
padding-top: var(--space-md);
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.porte__voisine {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-sm);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.porte__voisine:hover { border-color: var(--accent); }
|
||||
.porte__voisine--suivante { margin-left: auto; }
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.porte__anneau { width: 6rem; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<!-- Le cercle des trois échelles d'aep.trans-former.fr/entree (B13b, components/entree/SchemaEchelles.vue),
|
||||
demandé par Jules pour la page codev (B26) : la figure seule. Même géométrie (utils/figures.ts),
|
||||
mêmes textes (utils/echelles.ts) ; ni portes, ni arcs « ce qui sort / ce qui revient ».
|
||||
Cadre resserré sur l'anneau XL (le schéma d'AEP garde de la place pour la légende des arcs) :
|
||||
les mots y gagnent 12 %, 11 px rendus à 360 px. M et XL : un bandeau de mots qui tourne
|
||||
(calque HTML, `transform` sur le compositeur) ; S : un mot à la fois, en fondu. CSS seul,
|
||||
arrêté par le bouton pause (WCAG 2.2.2) et sous `prefers-reduced-motion`. -->
|
||||
<div class="cercle" :class="{ 'cercle--fige': fige }">
|
||||
<svg class="cercle__dessin" :viewBox="VB" role="img" :aria-label="description" focusable="false">
|
||||
<g v-for="a in anneaux" :key="a.id" :class="`cercle__anneau cercle__anneau--${a.id}`">
|
||||
<path class="cercle__zone" :d="a.zone" fill-rule="evenodd" />
|
||||
<circle class="cercle__trait" :cx="a.cx" :cy="a.cy" :r="a.r" />
|
||||
</g>
|
||||
<text
|
||||
v-for="a in anneaux"
|
||||
:key="`lettre-${a.id}`"
|
||||
class="cercle__lettre"
|
||||
:x="a.cx"
|
||||
:y="a.yLettre"
|
||||
:font-size="a.tailleLettre"
|
||||
text-anchor="middle"
|
||||
>{{ a.id }}</text>
|
||||
<text
|
||||
v-for="a in anneaux"
|
||||
:key="`nom-${a.id}`"
|
||||
class="cercle__nom"
|
||||
:x="a.cx"
|
||||
:y="a.yNom"
|
||||
:font-size="CORPS.nom"
|
||||
text-anchor="middle"
|
||||
>{{ nomAnneau(a.id) }}</text>
|
||||
</svg>
|
||||
|
||||
<div v-for="b in bandeaux" :key="`bandeau-${b.id}`" class="cercle__bandeau" aria-hidden="true">
|
||||
<svg class="cercle__tour" :class="`cercle__tour--${b.sens}`" :viewBox="VB" focusable="false">
|
||||
<defs><path :id="idBandeau(b.id)" :d="b.d" /></defs>
|
||||
<text class="cercle__mots" :font-size="CORPS.mot" :textLength="b.longueur" lengthAdjust="spacing"><textPath :href="`#${idBandeau(b.id)}`">{{ textesBandeaux[b.id] }}</textPath></text>
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
<div class="cercle__mots-s" :style="styleMotsS" aria-hidden="true">
|
||||
<span
|
||||
v-for="(m, i) in ECHELLES.S.mots"
|
||||
:key="m"
|
||||
class="cercle__mot-s"
|
||||
:class="{ 'cercle__mot-s--premier': i === 0 }"
|
||||
:style="styleMotS(i)"
|
||||
><span v-for="ligne in lignesMotS(m)" :key="ligne" class="cercle__mot-ligne">{{ ligne }}</span></span>
|
||||
</div>
|
||||
|
||||
<button type="button" class="cercle__pause" :aria-pressed="fige ? 'true' : 'false'" @click="fige = !fige">
|
||||
<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false">
|
||||
<path v-if="fige" d="M8 5.5v13l10.5-6.5z" />
|
||||
<path v-else d="M7 5h3.5v14H7zM13.5 5H17v14h-3.5z" />
|
||||
</svg>
|
||||
<span class="evt-sr">Mettre les mots en pause</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useId } from 'vue'
|
||||
import { ECHELLES, ORDRE_ECHELLES, type EchelleId } from '~/utils/echelles'
|
||||
import {
|
||||
anneauxEchelles, bandeauxAnneaux, motsBandeau, texteBandeau, cadreMotS, lignesMotS,
|
||||
CORPS, MOUVEMENT_MOTS, type BandeauAnneau,
|
||||
} from '~/utils/figures'
|
||||
|
||||
const uid = useId()
|
||||
const anneaux = anneauxEchelles()
|
||||
const bandeaux = bandeauxAnneaux()
|
||||
|
||||
/** Cadre carré autour de l'anneau XL, trait compris : les calques (bandeaux, mots de S) le partagent. */
|
||||
const xl = anneaux[0]
|
||||
const COTE = 2 * (xl.r + 4)
|
||||
const X0 = xl.cx - COTE / 2
|
||||
const Y0 = xl.cy - COTE / 2
|
||||
const VB = `${X0} ${Y0} ${COTE} ${COTE}`
|
||||
|
||||
const textesBandeaux = Object.fromEntries(
|
||||
bandeaux.map((b) => [b.id, texteBandeau(motsBandeau(ECHELLES[b.id].mots, b.longueur))]),
|
||||
) as Record<BandeauAnneau['id'], string>
|
||||
const idBandeau = (id: EchelleId) => `${uid}-bandeau-${id}`
|
||||
|
||||
/** Le nom écrit dans l'anneau, comme sur aep : le titre de l'échelle, initiale en minuscule. */
|
||||
const nomAnneau = (id: EchelleId) => {
|
||||
const t = ECHELLES[id].titre
|
||||
return t.charAt(0).toLowerCase() + t.slice(1)
|
||||
}
|
||||
|
||||
/** Sur le modèle de SchemaEchelles : les anneaux, puis les sept mots de chacun. */
|
||||
const description = (() => {
|
||||
const anneauxTxt = ORDRE_ECHELLES.map((id) => `${id}, ${nomAnneau(id)}`).join(' ; ')
|
||||
const mots = ORDRE_ECHELLES.map((id) => `${id}, ${nomAnneau(id)} : ${ECHELLES[id].mots.join(' ; ')}.`).join(' ')
|
||||
return `Trois anneaux imbriqués, S au centre : ${anneauxTxt}. ${mots}`
|
||||
})()
|
||||
|
||||
/** Pause du visiteur : bandeaux immobiles, mot de S figé. */
|
||||
const fige = ref(false)
|
||||
|
||||
const cadreS = cadreMotS()
|
||||
const styleMotsS = {
|
||||
left: `${((cadreS.x - X0) / COTE) * 100}%`,
|
||||
top: `${((cadreS.y - Y0) / COTE) * 100}%`,
|
||||
width: `${(cadreS.l / COTE) * 100}%`,
|
||||
height: `${(cadreS.h / COTE) * 100}%`,
|
||||
fontSize: `calc(100cqw * ${CORPS.mot} / ${COTE})`,
|
||||
}
|
||||
/** Mot i de S : une boucle de 7 × 2,5 s, décalée de i × 2,5 s ; le premier est visible dès l'arrivée. */
|
||||
const styleMotS = (i: number) => {
|
||||
const tour = ECHELLES.S.mots.length * MOUVEMENT_MOTS.cadence
|
||||
return { animationDuration: `${tour}ms`, animationDelay: `${i === 0 ? 0 : i * MOUVEMENT_MOTS.cadence - tour}ms` }
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cercle {
|
||||
position: relative;
|
||||
/* les calques (bandeaux, mots de S) se règlent en unités de la figure */
|
||||
container-type: inline-size;
|
||||
}
|
||||
.cercle__dessin { display: block; width: 100%; height: auto; }
|
||||
|
||||
/* Les teintes du schéma d'aep : bleu nuit en voile, de plus en plus dense vers le centre */
|
||||
.cercle__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 5%, transparent); }
|
||||
.cercle__anneau--M .cercle__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 8%, transparent); }
|
||||
.cercle__anneau--S .cercle__zone { fill: color-mix(in srgb, var(--nav-primary-solid) 12%, transparent); }
|
||||
.cercle__trait {
|
||||
fill: none;
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 2px;
|
||||
vector-effect: non-scaling-stroke;
|
||||
}
|
||||
.cercle__lettre, .cercle__nom, .cercle__mots { font-family: var(--font-body); }
|
||||
.cercle__lettre { fill: var(--text); font-weight: var(--fw-bold); }
|
||||
.cercle__nom { fill: var(--evt-attenue); font-weight: var(--fw-semibold); }
|
||||
.cercle__mots { fill: var(--evt-attenue); }
|
||||
|
||||
.cercle__bandeau {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
/* le calque tourne : ses coins ne doivent pas élargir la page */
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
}
|
||||
.cercle__tour {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
animation: tour-horaire 75s linear infinite;
|
||||
}
|
||||
.cercle__tour--antihoraire { animation-name: tour-antihoraire; }
|
||||
|
||||
.cercle__mots-s { position: absolute; display: grid; pointer-events: none; }
|
||||
.cercle__mot-s {
|
||||
grid-area: 1 / 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
line-height: 1.2;
|
||||
color: var(--text);
|
||||
opacity: 0;
|
||||
animation: mot-s 17.5s linear infinite;
|
||||
}
|
||||
.cercle__mot-s--premier { opacity: 1; }
|
||||
.cercle__mot-ligne { white-space: nowrap; }
|
||||
|
||||
.cercle--fige .cercle__tour,
|
||||
.cercle--fige .cercle__mot-s { animation-play-state: paused; }
|
||||
|
||||
.cercle__pause {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--surface);
|
||||
color: var(--evt-attenue);
|
||||
cursor: pointer;
|
||||
}
|
||||
.cercle__pause svg { width: 18px; height: 18px; fill: currentColor; }
|
||||
.cercle__pause:hover { color: var(--text); border-color: var(--accent); }
|
||||
|
||||
@keyframes tour-horaire { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
|
||||
@keyframes tour-antihoraire { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
|
||||
/* Pour 7 mots : 2,1 s visible (12 %), fondu de 400 ms jusqu'à 2,5 s (14,286 %), éteint, fondu d'entrée à 17,1 s */
|
||||
@keyframes mot-s {
|
||||
0%, 12% { opacity: 1; }
|
||||
14.286%, 97.714% { opacity: 0; }
|
||||
100% { opacity: 1; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.cercle__tour, .cercle__mot-s { animation: none; }
|
||||
/* rien ne bouge : le bouton pause n'a plus d'objet */
|
||||
.cercle__pause { display: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<!-- Seize pastilles qui se remplissent : on voit les places, pas un pourcentage.
|
||||
Le texte se lit seul ; les pastilles sont décoratives. -->
|
||||
<p class="cpt" :class="{ 'cpt--complet': complet }">
|
||||
<span class="cpt__pastilles" aria-hidden="true">
|
||||
<span v-for="i in capacite" :key="i" class="cpt__pastille" :class="{ 'cpt__pastille--prise': i <= pris }" />
|
||||
</span>
|
||||
<span class="cpt__texte">{{ texte }}</span>
|
||||
</p>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { texteCompteur } from '~/utils/inscriptionEvenement'
|
||||
|
||||
const props = defineProps<{ inscrits: number; capacite: number; complet: boolean }>()
|
||||
|
||||
const pris = computed(() => (props.complet ? props.capacite : Math.min(props.inscrits, props.capacite)))
|
||||
const texte = computed(() => texteCompteur(props.inscrits, props.capacite, props.complet))
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.cpt { display: flex; flex-direction: column; gap: var(--space-2xs); margin: 0; }
|
||||
.cpt__pastilles { display: flex; flex-wrap: wrap; gap: 5px; max-width: 100%; }
|
||||
.cpt__pastille {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: var(--radius-full);
|
||||
border: 1.5px solid var(--border-strong);
|
||||
background: transparent;
|
||||
}
|
||||
.cpt__pastille--prise { background: var(--evt-nuit); border-color: var(--evt-nuit); }
|
||||
.cpt__texte { font-weight: var(--fw-semibold); }
|
||||
|
||||
/* Le seul mouvement de la page, parce qu'il dit vrai : les places prises arrivent, une à une.
|
||||
Rendu serveur déjà rempli ; l'animation ne fait que l'ajouter, et se coupe en mouvement réduit. */
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.cpt__pastille--prise { animation: cpt-arrive 0.45s var(--ease-out) backwards; }
|
||||
.cpt__pastille--prise:nth-child(2) { animation-delay: 60ms; }
|
||||
.cpt__pastille--prise:nth-child(3) { animation-delay: 120ms; }
|
||||
.cpt__pastille--prise:nth-child(n + 4) { animation-delay: 180ms; }
|
||||
}
|
||||
@keyframes cpt-arrive { from { transform: scale(0.3); opacity: 0; } }
|
||||
</style>
|
||||
@@ -0,0 +1,351 @@
|
||||
<template>
|
||||
<div class="fi">
|
||||
<!-- Confirmation -->
|
||||
<div v-if="etat === 'ok'" ref="confirmation" class="fi-message fi-message--ok" tabindex="-1" role="status">
|
||||
<template v-if="attente">
|
||||
<p class="fi-message__titre">Merci, vous êtes sur la liste d'attente.</p>
|
||||
<p>Jules vous écrit si une place se libère.</p>
|
||||
</template>
|
||||
<template v-else>
|
||||
<p class="fi-message__titre">Merci, c'est noté.</p>
|
||||
<p>Jules vous écrit avec les détails<template v-if="page === 'codev'"> et les coordonnées pour le virement</template>.</p>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- Complet : le formulaire reste, l'inscription va en liste d'attente (codev 23/10, forêt 25/10). 409 : serveur d'avant. -->
|
||||
<div v-else-if="etat === 'complet'" class="fi-message" role="status">
|
||||
<p class="fi-message__titre">C'est complet.</p>
|
||||
<p>Écrivez-nous : <a :href="`mailto:${contact}`">{{ contact }}</a></p>
|
||||
</div>
|
||||
|
||||
<!-- Table non configurée -->
|
||||
<div v-else-if="!disponible || etat === 'indisponible'" class="fi-message" role="status">
|
||||
<p>Pour vous inscrire, écrivez à <a :href="`mailto:${contact}`">{{ contact }}</a></p>
|
||||
</div>
|
||||
|
||||
<form v-else novalidate :aria-describedby="`fi-${page}-donnees`" @submit.prevent="envoyer">
|
||||
<div class="fi-duo">
|
||||
<div class="fi-champ">
|
||||
<label :for="id('prenom')">Prénom</label>
|
||||
<input :id="id('prenom')" v-model="f.prenom" v-bind="aria('prenom')" autocomplete="given-name" maxlength="60" required>
|
||||
<p v-if="err.prenom" :id="id('prenom-err')" class="fi-err">{{ err.prenom }}</p>
|
||||
</div>
|
||||
<div class="fi-champ">
|
||||
<label :for="id('nom')">Nom</label>
|
||||
<input :id="id('nom')" v-model="f.nom" v-bind="aria('nom')" autocomplete="family-name" maxlength="80" required>
|
||||
<p v-if="err.nom" :id="id('nom-err')" class="fi-err">{{ err.nom }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="fi-champ">
|
||||
<label :for="id('email')">Email</label>
|
||||
<input :id="id('email')" v-model="f.email" v-bind="aria('email')" type="email" autocomplete="email" inputmode="email" maxlength="200" required>
|
||||
<p v-if="err.email" :id="id('email-err')" class="fi-err">{{ err.email }}</p>
|
||||
</div>
|
||||
|
||||
<div class="fi-champ">
|
||||
<label :for="id('telephone')">Téléphone <span class="fi-facultatif">facultatif, pour le covoiturage</span></label>
|
||||
<input :id="id('telephone')" v-model="f.telephone" v-bind="aria('telephone')" type="tel" autocomplete="tel" inputmode="tel" maxlength="30">
|
||||
<p v-if="err.telephone" :id="id('telephone-err')" class="fi-err">{{ err.telephone }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Codev : dates. Un seul jour d'arrivée (le 21) : pas de question, il part d'office -->
|
||||
<template v-if="page === 'codev'">
|
||||
<fieldset v-if="ARRIVEES_CODEV.length > 1" class="fi-champ" v-bind="ariaGroupe('arrivee')">
|
||||
<legend>J'arrive le</legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="d in ARRIVEES_CODEV" :key="d" class="fi-option">
|
||||
<input v-model="f.arrivee" type="radio" :name="id('arrivee')" :value="d">
|
||||
<span>{{ jourLong(d) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="err.arrivee" :id="id('arrivee-err')" class="fi-err">{{ err.arrivee }}</p>
|
||||
</fieldset>
|
||||
<fieldset class="fi-champ" v-bind="ariaGroupe('depart')">
|
||||
<legend>Je repars le</legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="d in DEPARTS_CODEV" :key="d" class="fi-option">
|
||||
<input v-model="f.depart" type="radio" :name="id('depart')" :value="d">
|
||||
<span>{{ jourLong(d) }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="err.depart" :id="id('depart-err')" class="fi-err">{{ err.depart }}</p>
|
||||
</fieldset>
|
||||
</template>
|
||||
|
||||
<!-- Forêt : qui, quand. Plus de question « je dors sur place » : tout le monde dort sur place (Jules, 25/10) -->
|
||||
<template v-else>
|
||||
<div class="fi-duo">
|
||||
<div class="fi-champ">
|
||||
<label :for="id('nb_personnes')">Nombre de personnes</label>
|
||||
<select :id="id('nb_personnes')" v-model.number="f.nb_personnes" v-bind="aria('nb_personnes')">
|
||||
<option v-for="n in 8" :key="n" :value="n">{{ n }}</option>
|
||||
</select>
|
||||
<p v-if="err.nb_personnes" :id="id('nb_personnes-err')" class="fi-err">{{ err.nb_personnes }}</p>
|
||||
</div>
|
||||
<div class="fi-champ">
|
||||
<label :for="id('nb_enfants')">dont enfants</label>
|
||||
<select :id="id('nb_enfants')" v-model.number="f.nb_enfants" v-bind="aria('nb_enfants')">
|
||||
<option v-for="n in 8" :key="n - 1" :value="n - 1">{{ n - 1 }}</option>
|
||||
</select>
|
||||
<p v-if="err.nb_enfants" :id="id('nb_enfants-err')" class="fi-err">{{ err.nb_enfants }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<fieldset class="fi-champ" v-bind="ariaGroupe('arrivee')">
|
||||
<legend>J'arrive</legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="a in ARRIVEES_FORET" :key="a" class="fi-option">
|
||||
<input v-model="f.arrivee" type="radio" :name="id('arrivee')" :value="a">
|
||||
<span>{{ ARRIVEES_FORET_LABELS[a] }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="err.arrivee" :id="id('arrivee-err')" class="fi-err">{{ err.arrivee }}</p>
|
||||
</fieldset>
|
||||
<!-- Lit (Jules, 04/11) : pour préparer l'attribution des chambres -->
|
||||
<fieldset class="fi-champ" v-bind="ariaGroupe('lit')">
|
||||
<legend>Lit</legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="l in LITS" :key="l" class="fi-option">
|
||||
<input v-model="f.lit" type="radio" :name="id('lit')" :value="l" required>
|
||||
<span>{{ LITS_LABELS[l] }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="err.lit" :id="id('lit-err')" class="fi-err">{{ err.lit }}</p>
|
||||
</fieldset>
|
||||
<div v-if="f.lit === 'double'" class="fi-champ">
|
||||
<label :for="id('lit_avec')">Avec qui ? (prénom et nom)</label>
|
||||
<input
|
||||
:id="id('lit_avec')" v-model="f.lit_avec" maxlength="140" required autocomplete="off"
|
||||
:aria-invalid="err.lit_avec ? 'true' : undefined"
|
||||
:aria-describedby="err.lit_avec ? `${id('lit_avec-aide')} ${id('lit_avec-err')}` : id('lit_avec-aide')"
|
||||
>
|
||||
<p :id="id('lit_avec-aide')" class="fi-aide">Cette personne doit aussi s'inscrire avec ce formulaire.</p>
|
||||
<p v-if="err.lit_avec" :id="id('lit_avec-err')" class="fi-err">{{ err.lit_avec }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="fi-champ">
|
||||
<label :for="id('besoin')">Les repas sont végétariens. Un besoin particulier ? <span class="fi-facultatif">facultatif</span></label>
|
||||
<input :id="id('besoin')" v-model="f.besoin_alimentaire" v-bind="aria('besoin_alimentaire')" maxlength="300">
|
||||
<p v-if="err.besoin_alimentaire" :id="id('besoin_alimentaire-err')" class="fi-err">{{ err.besoin_alimentaire }}</p>
|
||||
</div>
|
||||
|
||||
<fieldset class="fi-champ" v-bind="ariaGroupe('voiture')">
|
||||
<legend>Covoiturage</legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="v in VOITURES" :key="v" class="fi-option">
|
||||
<input v-model="f.voiture" type="radio" :name="id('voiture')" :value="v">
|
||||
<span>{{ VOITURES_LABELS[v] }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<p v-if="err.voiture" :id="id('voiture-err')" class="fi-err">{{ err.voiture }}</p>
|
||||
</fieldset>
|
||||
|
||||
<!-- Décision de Jules du 22/10 : par quelle échelle on entre en ce moment (facultatif, codev seulement) -->
|
||||
<fieldset v-if="page === 'codev'" class="fi-champ">
|
||||
<legend>En ce moment, vous entrez plutôt par <span class="fi-facultatif">facultatif</span></legend>
|
||||
<div class="fi-choix">
|
||||
<label v-for="v in ENTREES" :key="v" class="fi-option">
|
||||
<input v-model="f.entree" type="radio" :name="id('entree')" :value="v">
|
||||
<span>{{ ENTREES_LABELS[v] }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="fi-champ">
|
||||
<label :for="id('mot')">Un mot <span class="fi-facultatif">facultatif</span></label>
|
||||
<textarea :id="id('mot')" v-model="f.mot" v-bind="aria('mot')" rows="3" maxlength="1000" />
|
||||
<p v-if="err.mot" :id="id('mot-err')" class="fi-err">{{ err.mot }}</p>
|
||||
</div>
|
||||
|
||||
<!-- Honeypot : invisible pour un humain, rempli par un robot -->
|
||||
<div class="fi-pot" aria-hidden="true">
|
||||
<label :for="id('site_web')">Site web</label>
|
||||
<input :id="id('site_web')" v-model="f.site_web" tabindex="-1" autocomplete="off">
|
||||
</div>
|
||||
|
||||
<p v-if="page === 'codev' && complet" class="fi-avant">
|
||||
Les {{ evenement.codev.capacite }} places sont prises : votre inscription va sur la liste d'attente.
|
||||
</p>
|
||||
<p v-else-if="complet" class="fi-avant">C'est complet : votre inscription va sur la liste d'attente.</p>
|
||||
<p v-else-if="page === 'codev'" class="fi-avant">{{ evenement.codev.prixJour }} € par jour, par virement ; les coordonnées vous arrivent par email.</p>
|
||||
<p v-else class="fi-avant">Rien à régler.</p>
|
||||
|
||||
<p v-if="erreurEnvoi" class="fi-err fi-err--envoi" role="alert">{{ erreurEnvoi }}</p>
|
||||
|
||||
<button type="submit" class="evt-btn fi-envoyer" :disabled="etat === 'envoi'">
|
||||
{{ etat === 'envoi' ? 'Envoi…' : complet ? 'M\'inscrire sur la liste d\'attente' : page === 'foret' ? 'Je viens planter' : 'Je m\'inscris' }}
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<p :id="`fi-${page}-donnees`" class="fi-donnees">
|
||||
Ces informations servent seulement à organiser le séjour (repas, couchage, covoiturage).
|
||||
Elles sont effacées le 31 décembre 2026 et ne sont transmises à personne.
|
||||
Pour les modifier ou les effacer avant : <a :href="`mailto:${contact}`">{{ contact }}</a>.
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
ARRIVEES_CODEV, DEPARTS_CODEV, ARRIVEES_FORET, ARRIVEES_FORET_LABELS, VOITURES, VOITURES_LABELS, ENTREES, ENTREES_LABELS, LITS, LITS_LABELS,
|
||||
InscriptionSchema, erreursParChamp, type PageInscription,
|
||||
} from '~/utils/inscriptionEvenement'
|
||||
import { evenement } from '~/data/evenements/ruetz-2026'
|
||||
|
||||
const props = defineProps<{
|
||||
page: PageInscription
|
||||
contact: string
|
||||
/** false : table non configurée, la page renvoie vers l'email. */
|
||||
disponible: boolean
|
||||
complet: boolean
|
||||
}>()
|
||||
const emit = defineEmits<{ inscrit: [] }>()
|
||||
|
||||
const f = reactive({
|
||||
prenom: '', nom: '', email: '', telephone: '',
|
||||
arrivee: (props.page === 'codev' && ARRIVEES_CODEV.length === 1 ? ARRIVEES_CODEV[0] : '') as string,
|
||||
depart: '' as string,
|
||||
nb_personnes: 1, nb_enfants: 0, lit: '' as string, lit_avec: '',
|
||||
besoin_alimentaire: '', voiture: '' as string, mot: '', site_web: '', entree: '' as string,
|
||||
})
|
||||
const err = ref<Record<string, string>>({})
|
||||
const etat = ref<'saisie' | 'envoi' | 'ok' | 'complet' | 'indisponible'>('saisie')
|
||||
const erreurEnvoi = ref('')
|
||||
/** Le serveur a mis l'inscription en liste d'attente (page complète). */
|
||||
const attente = ref(false)
|
||||
const confirmation = ref<HTMLElement | null>(null)
|
||||
|
||||
const id = (k: string) => `fi-${props.page}-${k}`
|
||||
const aria = (k: string) => ({
|
||||
'aria-invalid': err.value[k] ? 'true' : undefined,
|
||||
'aria-describedby': err.value[k] ? id(`${k}-err`) : undefined,
|
||||
})
|
||||
const ariaGroupe = (k: string) => ({ 'aria-describedby': err.value[k] ? id(`${k}-err`) : undefined })
|
||||
|
||||
const JOURS: Record<string, string> = {
|
||||
'2026-11-21': 'Samedi 21', '2026-11-22': 'Dimanche 22', '2026-11-23': 'Lundi 23',
|
||||
'2026-11-25': 'Mercredi 25', '2026-11-26': 'Jeudi 26', '2026-11-27': 'Vendredi 27',
|
||||
'2026-11-29': 'Dimanche 29 : je reste pour la plantation',
|
||||
}
|
||||
const jourLong = (d: string) => JOURS[d] ?? d
|
||||
|
||||
function corps() {
|
||||
const commun = {
|
||||
page: props.page, prenom: f.prenom, nom: f.nom, email: f.email, telephone: f.telephone,
|
||||
besoin_alimentaire: f.besoin_alimentaire, voiture: f.voiture, mot: f.mot, site_web: f.site_web,
|
||||
}
|
||||
return props.page === 'codev'
|
||||
? { ...commun, arrivee: f.arrivee, depart: f.depart, entree: f.entree }
|
||||
: { ...commun, nb_personnes: f.nb_personnes, nb_enfants: f.nb_enfants, arrivee: f.arrivee, lit: f.lit, lit_avec: f.lit === 'double' ? f.lit_avec : '' }
|
||||
}
|
||||
|
||||
function focusPremiereErreur() {
|
||||
nextTick(() => {
|
||||
const el = document.querySelector<HTMLElement>('.fi [aria-invalid="true"], .fi fieldset[aria-describedby] input')
|
||||
el?.focus()
|
||||
})
|
||||
}
|
||||
|
||||
async function envoyer() {
|
||||
erreurEnvoi.value = ''
|
||||
const body = corps()
|
||||
const parsed = InscriptionSchema.safeParse(body)
|
||||
if (!parsed.success) {
|
||||
err.value = erreursParChamp(parsed.error)
|
||||
focusPremiereErreur()
|
||||
return
|
||||
}
|
||||
err.value = {}
|
||||
etat.value = 'envoi'
|
||||
try {
|
||||
const r = await $fetch<{ ok: boolean; attente?: boolean }>('/api/evenements/inscription', { method: 'POST', body })
|
||||
attente.value = !!r?.attente
|
||||
etat.value = 'ok'
|
||||
emit('inscrit')
|
||||
nextTick(() => confirmation.value?.focus())
|
||||
} catch (e: any) {
|
||||
const code = e?.statusCode ?? e?.response?.status
|
||||
etat.value = 'saisie'
|
||||
if (code === 422 && e?.data?.data) {
|
||||
err.value = e.data.data
|
||||
focusPremiereErreur()
|
||||
} else if (code === 409) {
|
||||
etat.value = 'complet'
|
||||
} else if (code === 503) {
|
||||
etat.value = 'indisponible'
|
||||
} else if (code === 429) {
|
||||
erreurEnvoi.value = `Trop d'inscriptions depuis cette connexion aujourd'hui. Écrivez à ${props.contact}.`
|
||||
} else {
|
||||
erreurEnvoi.value = `L'inscription n'est pas passée. Réessayez dans un instant, ou écrivez à ${props.contact}.`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.fi { margin-top: var(--space-lg); }
|
||||
form { display: flex; flex-direction: column; gap: var(--space-md); }
|
||||
.fi-duo { display: grid; gap: var(--space-md); grid-template-columns: 1fr; }
|
||||
@media (min-width: 480px) { .fi-duo { grid-template-columns: 1fr 1fr; } }
|
||||
|
||||
.fi-champ { display: flex; flex-direction: column; gap: var(--space-2xs); margin: 0; padding: 0; border: 0; min-width: 0; }
|
||||
.fi-champ > label, legend { font-weight: var(--fw-semibold); padding: 0; margin-bottom: var(--space-2xs); }
|
||||
.fi-facultatif { font-weight: var(--fw-regular); font-size: var(--fs-sm); color: var(--evt-attenue); }
|
||||
.fi-facultatif::before { content: '· '; }
|
||||
|
||||
input:not([type="radio"]):not([type="checkbox"]), select, textarea {
|
||||
width: 100%;
|
||||
min-height: 48px;
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
color: var(--text);
|
||||
font: inherit;
|
||||
font-size: 1rem; /* 16 px : iOS ne zoome pas */
|
||||
}
|
||||
textarea { min-height: 96px; resize: vertical; }
|
||||
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; border-color: var(--text); }
|
||||
[aria-invalid="true"] { border-color: var(--danger) !important; }
|
||||
|
||||
.fi-choix { display: grid; gap: var(--space-xs); }
|
||||
.fi-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-sm);
|
||||
min-height: 48px;
|
||||
padding: 8px 12px;
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--surface);
|
||||
font-weight: var(--fw-regular);
|
||||
cursor: pointer;
|
||||
}
|
||||
.fi-option:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
|
||||
.fi-option:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
|
||||
.fi-option input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--nav-primary-solid); }
|
||||
|
||||
.fi-aide { margin: 0; font-size: var(--fs-sm); color: var(--evt-attenue); }
|
||||
.fi-err { margin: 0; font-size: var(--fs-sm); color: var(--danger); font-weight: var(--fw-semibold); }
|
||||
.fi-err--envoi { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-md); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
|
||||
|
||||
.fi-pot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
|
||||
|
||||
.fi-avant { margin: 0; font-weight: var(--fw-semibold); }
|
||||
.fi-envoyer { align-self: flex-start; min-width: 200px; }
|
||||
@media (max-width: 479px) { .fi-envoyer { align-self: stretch; } }
|
||||
|
||||
.fi-message {
|
||||
padding: var(--space-lg);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.fi-message--ok { border: 2px solid var(--accent); }
|
||||
.fi-message:focus { outline: none; }
|
||||
.fi-message p { margin: 0; }
|
||||
.fi-message__titre { font-size: var(--fs-lg); font-weight: var(--fw-bold); margin-bottom: var(--space-xs) !important; }
|
||||
|
||||
.fi-donnees { margin-top: var(--space-md); font-size: var(--fs-sm); color: var(--evt-attenue); }
|
||||
</style>
|
||||
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<figure class="evt-figure frise">
|
||||
<div class="frise__toile">
|
||||
<svg viewBox="0 0 540 132" role="img" aria-labelledby="frise-titre frise-desc">
|
||||
<title id="frise-titre">La semaine, jour par jour</title>
|
||||
<desc id="frise-desc">
|
||||
Samedi 21 et dimanche 22 : on atterrit ensemble. Du lundi 23 au vendredi 27 : la semaine d'entraide.
|
||||
Samedi 28 et dimanche 29 : la plantation de la forêt.
|
||||
</desc>
|
||||
<g v-for="(j, i) in jours" :key="j.iso" :transform="`translate(${i * COL} 0)`">
|
||||
<text :x="COL / 2" y="20" class="frise__jour">{{ j.jour }}</text>
|
||||
<text :x="COL / 2" y="46" class="frise__num">{{ j.num }}</text>
|
||||
</g>
|
||||
<!-- 21-22 : tout le monde arrive, on atterrit ensemble -->
|
||||
<rect x="3" y="60" :width="2 * COL - 6" height="64" rx="8" class="frise__arrivee" />
|
||||
<text :x="COL" y="88" class="frise__label frise__label--ligne">on atterrit</text>
|
||||
<text :x="COL" y="110" class="frise__label frise__label--ligne">ensemble</text>
|
||||
<!-- 23-27 : codev -->
|
||||
<rect :x="2 * COL + 3" y="60" :width="5 * COL - 6" height="64" rx="8" class="frise__codev" />
|
||||
<text :x="4.5 * COL" y="99" class="frise__label frise__label--codev">la semaine d'entraide</text>
|
||||
<!-- 28-29 : plantation, cliquable (le lien est posé dessus, en HTML) -->
|
||||
<g class="frise__foret-g">
|
||||
<rect :x="7 * COL + 3" y="60" :width="2 * COL - 6" height="64" rx="8" class="frise__foret" />
|
||||
<text :x="8 * COL" y="96" class="frise__label frise__label--foret">plantation</text>
|
||||
<line :x1="8 * COL - 44" :x2="8 * COL + 44" y1="104" y2="104" class="frise__souligne" />
|
||||
</g>
|
||||
</svg>
|
||||
<NuxtLink :to="lienForet" class="frise__clic" aria-label="La page forêt" />
|
||||
</div>
|
||||
<figcaption class="frise__legende">
|
||||
<span>Arrivée le samedi 21 : on atterrit ensemble. Les 28 et 29, on plante une forêt.</span>
|
||||
<NuxtLink :to="lienForet" class="evt-lien-foret"><EvenementsIcone nom="arbre" />La page forêt</NuxtLink>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { jourCourt } from '~/utils/evenements'
|
||||
|
||||
defineProps<{ lienForet: string }>()
|
||||
|
||||
const COL = 60
|
||||
const jours = Array.from({ length: 9 }, (_, i) => {
|
||||
const iso = `2026-11-${21 + i}`
|
||||
return { iso, ...jourCourt(iso) }
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.frise svg { border-radius: 0; overflow: visible; }
|
||||
.frise__toile { position: relative; }
|
||||
.frise__jour { font-size: 19px; text-anchor: middle; fill: var(--evt-attenue); }
|
||||
.frise__num { font-family: var(--evt-titre); font-size: 26px; font-weight: 600; text-anchor: middle; fill: var(--text); }
|
||||
.frise__arrivee { fill: color-mix(in srgb, var(--evt-nuit) 16%, var(--surface)); }
|
||||
.frise__codev { fill: var(--evt-nuit); }
|
||||
.frise__foret { fill: var(--accent); }
|
||||
.frise__label { font-size: 21px; font-weight: 700; text-anchor: middle; }
|
||||
.frise__label--ligne { font-size: 18px; font-weight: 600; fill: var(--text); }
|
||||
.frise__label--codev { fill: var(--evt-sur-nuit); }
|
||||
.frise__label--foret { font-size: 19px; fill: var(--on-accent); }
|
||||
.frise__souligne { stroke: var(--on-accent); stroke-width: 1.5; }
|
||||
|
||||
/* Le bloc plantation se lit comme un bouton : ombre au repos, levé au survol, anneau au focus.
|
||||
Le lien HTML couvre exactement le bloc (positions en % du viewBox 540 × 132). */
|
||||
.frise__foret-g {
|
||||
filter: drop-shadow(0 1px 1.5px rgb(26 34 56 / 0.25));
|
||||
transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.frise__clic {
|
||||
position: absolute;
|
||||
left: calc(423 / 540 * 100%);
|
||||
top: calc(60 / 132 * 100%);
|
||||
width: calc(114 / 540 * 100%);
|
||||
height: calc(64 / 132 * 100%);
|
||||
border-radius: 8px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.frise__toile:has(.frise__clic:hover) .frise__foret-g,
|
||||
.frise__toile:has(.frise__clic:focus-visible) .frise__foret-g {
|
||||
transform: translateY(-3px);
|
||||
filter: drop-shadow(0 4px 6px rgb(26 34 56 / 0.28)) brightness(1.04);
|
||||
}
|
||||
.frise__clic:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }
|
||||
|
||||
.frise__legende {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-xs) var(--space-md);
|
||||
}
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.frise__foret-g { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<ol class="gestes" role="list">
|
||||
<li class="geste">
|
||||
<svg viewBox="0 0 200 150" aria-hidden="true">
|
||||
<path class="g-sol" d="M0 96 H64 Q100 132 136 96 H200 V150 H0 Z" />
|
||||
<path class="g-trou" d="M64 96 Q100 132 136 96" />
|
||||
<line class="g-tronc" x1="100" y1="112" x2="100" y2="34" />
|
||||
<ellipse class="g-houppe" cx="100" cy="30" rx="30" ry="20" />
|
||||
<path class="g-motte" d="M86 112 q14 14 28 0 q-14 -8 -28 0 Z" />
|
||||
<path class="g-fleche" d="M150 30 V78 M142 70 L150 80 L158 70" />
|
||||
</svg>
|
||||
<p><span class="geste__num">1</span>Les trous sont déjà faits : on met l'arbre principal en terre.</p>
|
||||
</li>
|
||||
<li class="geste">
|
||||
<svg viewBox="0 0 200 150" aria-hidden="true">
|
||||
<path class="g-sol" d="M0 92 H200 V150 H0 Z" />
|
||||
<line class="g-repere" x1="0" y1="92" x2="200" y2="92" />
|
||||
<line class="g-bouture" x1="78" y1="132" x2="82" y2="22" />
|
||||
<circle class="g-oeil" cx="81" cy="44" r="3.5" />
|
||||
<circle class="g-oeil" cx="79.6" cy="108" r="3.5" /><circle class="g-oeil" cx="79" cy="124" r="3.5" />
|
||||
<path class="g-cote" d="M122 92 V132 M116 92 H128 M116 132 H128" />
|
||||
<text x="134" y="117" class="g-texte">20 cm</text>
|
||||
</svg>
|
||||
<p><span class="geste__num">2</span>Les boutures autour : au moins deux yeux sous terre, 20 cm.</p>
|
||||
</li>
|
||||
<li class="geste">
|
||||
<svg viewBox="0 0 200 150" aria-hidden="true">
|
||||
<path class="g-sol" d="M0 112 H200 V150 H0 Z" />
|
||||
<path class="g-paille" d="M30 112 Q100 82 170 112 Z" />
|
||||
<path class="g-brins" d="M50 104 l14 -4 M78 96 l16 -2 M110 95 l14 3 M136 100 l14 5" />
|
||||
<line class="g-tronc" x1="100" y1="100" x2="100" y2="34" />
|
||||
<ellipse class="g-houppe" cx="100" cy="30" rx="26" ry="17" />
|
||||
<path class="g-grillage" d="M82 104 V44 M118 104 V44 M82 44 H118 M82 64 H118 M82 84 H118 M91 44 V104 M100 44 V58 M109 44 V104" />
|
||||
</svg>
|
||||
<p><span class="geste__num">3</span>La paille, et la protection contre les chevreuils.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.gestes { list-style: none; margin: var(--space-md) 0 0; padding: 0; display: grid; gap: var(--space-md); grid-template-columns: 1fr; }
|
||||
@media (min-width: 560px) { .gestes { grid-template-columns: repeat(3, 1fr); } }
|
||||
.geste svg { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto var(--space-xs); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
|
||||
.geste p { margin: 0; font-size: var(--fs-sm); }
|
||||
.geste__num {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin-right: var(--space-xs);
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: var(--fw-bold);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.g-sol { fill: var(--bg-alt); }
|
||||
.g-trou { fill: none; stroke: var(--text); stroke-width: 2; stroke-dasharray: 4 4; }
|
||||
.g-tronc { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
|
||||
.g-houppe { fill: color-mix(in srgb, var(--nav-primary-solid) 20%, var(--surface)); stroke: var(--text); stroke-width: 2; }
|
||||
.g-motte { fill: color-mix(in srgb, var(--text) 45%, var(--bg-alt)); }
|
||||
.g-fleche { fill: none; stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
|
||||
.g-repere { stroke: var(--text); stroke-width: 2; }
|
||||
.g-bouture { stroke: var(--text); stroke-width: 5; stroke-linecap: round; }
|
||||
.g-oeil { fill: var(--accent); stroke: var(--text); stroke-width: 1.2; }
|
||||
.g-cote { fill: none; stroke: var(--text); stroke-width: 1.5; }
|
||||
.g-texte { font-size: 15px; font-weight: 700; fill: var(--text); }
|
||||
.g-paille { fill: var(--accent); opacity: 0.85; }
|
||||
.g-brins { stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; opacity: 0.6; }
|
||||
.g-grillage { fill: none; stroke: var(--text); stroke-width: 1.3; opacity: 0.75; }
|
||||
</style>
|
||||
@@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<!-- Pictogrammes des pages d'événement : grille 24, trait 1,75, currentColor, décoratifs -->
|
||||
<svg class="evt-icone" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"
|
||||
fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
|
||||
<template v-if="nom === 'places'">
|
||||
<circle cx="9" cy="8" r="3" />
|
||||
<path d="M3.5 19.5c.6-3.3 2.8-5.2 5.5-5.2s4.9 1.9 5.5 5.2" />
|
||||
<circle cx="16.5" cy="9" r="2.4" />
|
||||
<path d="M16 14.3c2.5 0 4 1.7 4.5 4.6" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'argent'">
|
||||
<circle cx="12" cy="12" r="8.5" />
|
||||
<path d="M15 8.9a3.9 3.9 0 1 0 0 6.2" />
|
||||
<path d="M7.6 11h5M7.6 13.2h5" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'maison'">
|
||||
<path d="M3.5 11.5 12 4.5l8.5 7" />
|
||||
<path d="M6 9.8v9.7h12V9.8" />
|
||||
<path d="M10 19.5v-5h4v5" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'train'">
|
||||
<rect x="6" y="3.5" width="12" height="13" rx="3" />
|
||||
<path d="M6 10h12" />
|
||||
<path d="M8.5 16.5 6.5 20.5M15.5 16.5l2 4M7.6 18.5h8.8" />
|
||||
<circle cx="9" cy="13.3" r=".6" fill="currentColor" />
|
||||
<circle cx="15" cy="13.3" r=".6" fill="currentColor" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'lit'">
|
||||
<path d="M3 5.5v14M3 14.5h18v5" />
|
||||
<path d="M21 14.5v-2a2.5 2.5 0 0 0-2.5-2.5H10.5v4.5" />
|
||||
<circle cx="6.8" cy="11.3" r="1.8" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'sac'">
|
||||
<rect x="5.5" y="7" width="13" height="13.5" rx="3" />
|
||||
<path d="M9.5 7V5.5a2.5 2.5 0 0 1 5 0V7" />
|
||||
<path d="M9 14h6v3.5H9z" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'bol'">
|
||||
<path d="M4 11h16c0 4.4-3.6 8-8 8s-8-3.6-8-8z" />
|
||||
<path d="M9.5 3.8c-.9 1-.9 2.2 0 3.2M14.5 3.8c-.9 1-.9 2.2 0 3.2" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'calendrier'">
|
||||
<rect x="4" y="5.5" width="16" height="14.5" rx="2.5" />
|
||||
<path d="M4 10h16M8.5 3.5v4M15.5 3.5v4" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'lieu'">
|
||||
<path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11z" />
|
||||
<circle cx="12" cy="10" r="2.4" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'voiture'">
|
||||
<path d="M5.5 11 7.2 6.8A1.8 1.8 0 0 1 8.9 5.6h6.2a1.8 1.8 0 0 1 1.7 1.2l1.7 4.2" />
|
||||
<path d="M3.5 13a2 2 0 0 1 2-2h13a2 2 0 0 1 2 2v4h-17z" />
|
||||
<path d="M6.5 17v2M17.5 17v2" />
|
||||
<circle cx="7.4" cy="14" r=".9" fill="currentColor" />
|
||||
<circle cx="16.6" cy="14" r=".9" fill="currentColor" />
|
||||
</template>
|
||||
<template v-else-if="nom === 'arbre'">
|
||||
<path d="M12 3.5a5 5 0 0 0-4.7 6.6A3.9 3.9 0 0 0 9 17.5h6a3.9 3.9 0 0 0 1.7-7.4A5 5 0 0 0 12 3.5z" />
|
||||
<path d="M12 11.5v9M12 15l2.4-2" />
|
||||
</template>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{ nom: 'places' | 'argent' | 'maison' | 'train' | 'lit' | 'sac' | 'bol' | 'calendrier' | 'lieu' | 'arbre' | 'voiture' }>()
|
||||
</script>
|
||||
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<!-- Le lieu-dit, cliquable vers Google Maps (au téléphone, l'URL maps/search ouvre l'application) -->
|
||||
<a :href="evenement.mapsUrl" target="_blank" rel="noopener" class="evt-lieu-lien">
|
||||
<slot>{{ evenement.lieu }}</slot><span class="evt-sr"> (Google Maps, nouvel onglet)</span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { evenement } from '~/data/evenements/ruetz-2026'
|
||||
</script>
|
||||
@@ -0,0 +1,380 @@
|
||||
<template>
|
||||
<div class="evt" :class="ton ? `evt--${ton}` : null">
|
||||
<!-- Le fond : des courbes de niveau, en écho aux lignes du plan de Sacha qui suivent le relief.
|
||||
Seulement derrière l'en-tête, estompées avant le texte courant. -->
|
||||
<div class="evt-fond" aria-hidden="true" />
|
||||
<!-- Un bandeau pleine largeur au-dessus de la colonne (le tableau de Ruetz sur la page codev, B26) -->
|
||||
<slot name="bandeau" />
|
||||
<div class="evt__col">
|
||||
<nav v-if="retour" class="evt-retour" aria-label="Retour">
|
||||
<NuxtLink :to="retour.to">← {{ retour.label }}</NuxtLink>
|
||||
</nav>
|
||||
<main id="contenu">
|
||||
<slot />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{
|
||||
retour?: { to: string; label: string }
|
||||
/** 'foret' : la sauge remplace l'ocre (pictos, récap, courbes). */
|
||||
ton?: 'foret'
|
||||
}>()
|
||||
|
||||
// Une seule police ajoutée, pour les titres : précharger évite le saut de l'en-tête (font-display: swap).
|
||||
useHead({
|
||||
link: [
|
||||
{ rel: 'preload', href: '/medias/evenements/polices/fraunces-600-latin.woff2', as: 'font', type: 'font/woff2', crossorigin: '' },
|
||||
// Icônes du Ruetz, à la place de celles d'AEP (clés identiques à nuxt.config.ts)
|
||||
{ key: 'icon-svg', rel: 'icon', type: 'image/svg+xml', href: '/favicon-event.svg' },
|
||||
{ key: 'icon-32', rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-event-32.png' },
|
||||
{ key: 'icon-16', rel: 'icon', type: 'image/png', sizes: '16x16', href: '/favicon-event-16.png' },
|
||||
{ key: 'icon-apple', rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon-event.png' },
|
||||
],
|
||||
})
|
||||
</script>
|
||||
|
||||
<!--
|
||||
Gabarit des pages d'événement (lot Y, passe design B25) : colonne de lecture de 640 px.
|
||||
Styles non scopés, préfixe evt- : partagés par les pages et les composants evenements/.
|
||||
Tokens du DS (tokens.css + theme/aep.css) ; safran (--accent) réservé à la plantation et au
|
||||
bouton principal ; bleu nuit plein = --nav-primary-solid. Du deck e-codev (frontend-slides) :
|
||||
Fraunces pour les titres, l'ocre et la sauge.
|
||||
-->
|
||||
<style>
|
||||
/* Fraunces (Undercase Type, SIL OFL 1.1), graisse 600, axe optique 9-144, sous-ensemble latin : 35 Ko */
|
||||
@font-face {
|
||||
font-family: 'Fraunces';
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
font-display: swap;
|
||||
src: url('/medias/evenements/polices/fraunces-600-latin.woff2') format('woff2');
|
||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
||||
}
|
||||
|
||||
.evt {
|
||||
--evt-attenue: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
--evt-nuit: var(--nav-primary-solid);
|
||||
--evt-sur-nuit: var(--nav-text-on-primary);
|
||||
/* Deux teintes du deck e-codev : ocre = ce qui sort, les petits libellés ; sauge = ce qui revient, le vivant */
|
||||
--evt-ocre: #9a5f12;
|
||||
--evt-sauge: #3f6b4e;
|
||||
--evt-teinte: var(--evt-ocre);
|
||||
--evt-papier: color-mix(in srgb, var(--surface) 60%, var(--bg));
|
||||
--evt-courbes: color-mix(in srgb, var(--text) 9%, transparent);
|
||||
--evt-titre: 'Fraunces', Georgia, 'Times New Roman', serif;
|
||||
/* Un dessin sur papier blanc se fond dans la crème ; en sombre, il reste une feuille (B26) */
|
||||
--evt-fusion-dessin: multiply;
|
||||
position: relative;
|
||||
isolation: isolate;
|
||||
min-height: 100%;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: var(--font-body);
|
||||
line-height: 1.6;
|
||||
}
|
||||
.evt--foret { --evt-teinte: var(--evt-sauge); --evt-courbes: color-mix(in srgb, var(--evt-sauge) 15%, transparent); }
|
||||
.dark .evt { --evt-ocre: #e3a95c; --evt-sauge: #8fc09e; --evt-fusion-dessin: normal; }
|
||||
|
||||
.evt-fond {
|
||||
position: absolute;
|
||||
inset: 0 0 auto;
|
||||
height: 480px;
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
background: var(--evt-courbes);
|
||||
-webkit-mask: url('/medias/evenements/courbes-niveau.svg') top center / 1600px 480px repeat-x;
|
||||
mask: url('/medias/evenements/courbes-niveau.svg') top center / 1600px 480px repeat-x;
|
||||
}
|
||||
/* Peint le fond par-dessus les courbes, de plus en plus : elles s'estompent avant le texte courant */
|
||||
.evt-fond::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background: linear-gradient(to bottom, transparent 30%, var(--bg) 92%);
|
||||
}
|
||||
|
||||
.evt__col {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
padding: var(--space-md) var(--space-md) var(--space-3xl);
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.evt__col { padding: var(--space-xl) var(--space-lg) var(--space-3xl); }
|
||||
}
|
||||
/* Grand écran : une colonne un peu plus large (titres sur deux lignes, moins de retours), B26 */
|
||||
@media (min-width: 1024px) {
|
||||
.evt__col { max-width: 760px; }
|
||||
}
|
||||
/* Blocs qui sortent de la colonne au bureau (deux colonnes, bandes de photos) : jusqu'à 1 200 px, 4 vw de marge */
|
||||
@media (min-width: 900px) {
|
||||
.evt-large { margin-inline: calc(50% - min(46vw, 600px)); }
|
||||
}
|
||||
|
||||
/* Le mot d'accueil, sous le titre, à la première personne */
|
||||
.evt p.evt-accueil { font-size: var(--fs-lg); line-height: 1.5; margin: 0 0 var(--space-md); text-wrap: pretty; }
|
||||
|
||||
/* Le preflight Tailwind retire le soulignement : un lien des pages d'événement se voit lien */
|
||||
.evt a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
|
||||
.evt a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
|
||||
/* Anneau d'encre : le safran du DS ne fait que 1,7:1 sur la crème */
|
||||
.evt :focus-visible { outline: 2.5px solid var(--text); outline-offset: 3px; border-radius: 3px; }
|
||||
|
||||
.evt-retour { margin-bottom: var(--space-sm); }
|
||||
.evt-retour a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 44px;
|
||||
font-size: 0.8rem;
|
||||
font-weight: var(--fw-bold);
|
||||
letter-spacing: 0.1em;
|
||||
text-transform: uppercase;
|
||||
color: var(--evt-ocre);
|
||||
text-decoration: none;
|
||||
}
|
||||
.evt-retour a:hover { color: var(--text); text-decoration: underline; }
|
||||
|
||||
/* ── Titres : Fraunces, le reste en police système ── */
|
||||
.evt-h1, .evt-h2, .evt-h3 { font-family: var(--evt-titre); font-weight: 600; font-optical-sizing: auto; }
|
||||
.evt-tete { margin: var(--space-md) 0 var(--space-xl); }
|
||||
.evt-h1 {
|
||||
font-size: clamp(2rem, 7.4vw, 3.1rem);
|
||||
line-height: 1.06;
|
||||
letter-spacing: -0.02em;
|
||||
margin: 0 0 var(--space-md);
|
||||
text-wrap: balance;
|
||||
}
|
||||
.evt-sous {
|
||||
font-size: var(--fs-lg);
|
||||
font-weight: var(--fw-semibold);
|
||||
margin: 0 0 var(--space-2xs);
|
||||
}
|
||||
.evt-lieu { color: var(--evt-attenue); margin: 0; }
|
||||
.evt-sr {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Récap pratique en tête : dates, lieu, trajet, repas ── */
|
||||
.evt-recap { list-style: none; margin: var(--space-md) 0 0; padding: 0; display: grid; gap: var(--space-xs); }
|
||||
.evt-recap li { display: flex; align-items: flex-start; gap: var(--space-sm); line-height: 1.45; }
|
||||
.evt-recap .evt-icone { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--evt-teinte); }
|
||||
.evt-recap .evt-lieu-lien { padding: 2px 0; margin: -2px 0; }
|
||||
.evt-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--space-md) var(--space-lg);
|
||||
margin-top: var(--space-lg);
|
||||
}
|
||||
|
||||
/* ── Sections ── */
|
||||
.evt-section { margin-top: clamp(3rem, 10vw, 4.5rem); }
|
||||
.evt-h2 {
|
||||
font-size: clamp(1.55rem, 5.4vw, 2rem);
|
||||
line-height: 1.15;
|
||||
letter-spacing: -0.012em;
|
||||
margin: 0 0 var(--space-md);
|
||||
text-wrap: balance;
|
||||
}
|
||||
.evt-h3 { font-size: 1.15rem; line-height: 1.25; margin: 0 0 var(--space-xs); }
|
||||
.evt p { margin: 0 0 var(--space-md); }
|
||||
.evt-note { font-size: var(--fs-sm); color: var(--evt-attenue); }
|
||||
.evt-citation-source { font-size: var(--fs-sm); color: var(--evt-attenue); margin-top: calc(-1 * var(--space-xs)); }
|
||||
|
||||
/* ── Boutons ── */
|
||||
.evt-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-xs);
|
||||
min-height: 48px;
|
||||
padding: 0 var(--space-lg);
|
||||
border: 0;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font: inherit;
|
||||
font-weight: var(--fw-bold);
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 1px 0 rgb(26 34 56 / 0.18), 0 2px 6px rgb(26 34 56 / 0.08);
|
||||
transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
|
||||
}
|
||||
.evt a.evt-btn { color: var(--on-accent); text-decoration: none; }
|
||||
.evt-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 0 rgb(26 34 56 / 0.18), 0 6px 14px rgb(26 34 56 / 0.12); }
|
||||
.evt-btn[disabled] { opacity: 0.6; cursor: progress; transform: none; }
|
||||
/* Second bouton (le tableau de covoiturage, B26) : bleu nuit plein ; le safran reste à l'inscription */
|
||||
.evt a.evt-btn--nuit { background: var(--evt-nuit); color: var(--evt-sur-nuit); }
|
||||
.evt a.evt-btn--nuit:hover { color: var(--evt-sur-nuit); }
|
||||
.evt-btn .evt-icone { width: 22px; height: 22px; flex: none; }
|
||||
|
||||
/* Lien vers la forêt : safran (réservé à la plantation), en teinte pour ne pas doubler le bouton principal */
|
||||
.evt a.evt-lien-foret {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
min-height: 44px;
|
||||
padding: 0 var(--space-md) 0 var(--space-sm);
|
||||
border: 1.5px solid var(--accent);
|
||||
border-radius: var(--radius-full);
|
||||
background: color-mix(in srgb, var(--accent) 28%, var(--surface));
|
||||
color: var(--text);
|
||||
font-weight: var(--fw-bold);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.evt a.evt-lien-foret:hover { background: var(--accent); color: var(--on-accent); }
|
||||
.evt-lien-foret .evt-icone { width: 20px; height: 20px; }
|
||||
|
||||
/* ── Cartes (pratique, venir) : papier chaud, picto dans un cadre teinté ── */
|
||||
.evt-cartes { display: grid; gap: var(--space-sm); grid-template-columns: 1fr; }
|
||||
@media (min-width: 560px) {
|
||||
.evt-cartes--2 { grid-template-columns: 1fr 1fr; }
|
||||
.evt-carte--large { grid-column: 1 / -1; }
|
||||
}
|
||||
.evt-carte {
|
||||
padding: var(--space-md);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--evt-papier);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.evt-carte p:last-child { margin-bottom: 0; }
|
||||
.evt-carte__tete { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
|
||||
.evt-carte__tete .evt-h3 { margin: 0; }
|
||||
.evt-picto {
|
||||
flex: none;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 12px;
|
||||
background: color-mix(in srgb, var(--evt-teinte) 13%, var(--surface));
|
||||
color: var(--evt-teinte);
|
||||
}
|
||||
|
||||
/* ── Figures et photos (cadrées, légendées, comme dans le deck) ── */
|
||||
.evt-figure { margin: var(--space-lg) 0; }
|
||||
.evt-figure img, .evt-figure svg { display: block; width: 100%; height: auto; border-radius: var(--radius-md); }
|
||||
.evt-figure figcaption { margin-top: var(--space-xs); font-size: var(--fs-sm); color: var(--evt-attenue); }
|
||||
.evt-photo img { border: 1px solid var(--border); }
|
||||
.evt-photo figcaption { font-style: italic; }
|
||||
.evt-pleine { margin-left: calc(-1 * var(--space-md)); margin-right: calc(-1 * var(--space-md)); }
|
||||
.evt-pleine img { border-radius: 0; border-left: 0; border-right: 0; }
|
||||
.evt-pleine figcaption { padding: 0 var(--space-md); }
|
||||
@media (min-width: 672px) {
|
||||
.evt-pleine { margin-left: 0; margin-right: 0; }
|
||||
.evt-pleine img { border-radius: var(--radius-md); border: 1px solid var(--border); }
|
||||
.evt-pleine figcaption { padding: 0; }
|
||||
}
|
||||
/* Les photos regroupées en une bande, 4:3, une légende pour toutes (Jules, B26) : au téléphone deux par ligne,
|
||||
la première en grand si elles sont en nombre impair ; au bureau, toutes sur une ligne, plus large que la colonne */
|
||||
.evt-bande { margin-top: clamp(3rem, 10vw, 4.5rem); }
|
||||
.evt-bande__photos { display: grid; gap: var(--space-sm); grid-template-columns: 1fr 1fr; }
|
||||
.evt-bande__photos > :first-child:nth-last-child(odd) { grid-column: 1 / -1; }
|
||||
.evt-bande .evt-figure { margin: 0; }
|
||||
.evt-bande img { aspect-ratio: 4 / 3; object-fit: cover; }
|
||||
.evt-bande .evt-note { margin: var(--space-xs) 0 0; }
|
||||
@media (min-width: 900px) {
|
||||
.evt-bande__photos { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 1fr; }
|
||||
.evt-bande__photos > :first-child:nth-last-child(odd) { grid-column: auto; }
|
||||
}
|
||||
/* Six photos en deux rangées de trois, à toutes les largeurs (page codev, Jules 28/10) */
|
||||
.evt-bande__photos.evt-bande__photos--3 { grid-template-columns: repeat(3, 1fr); grid-auto-flow: row; grid-auto-columns: auto; }
|
||||
|
||||
/* ── Dépliables ── */
|
||||
.evt-details {
|
||||
margin-top: var(--space-md);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--evt-papier);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.evt-details > summary {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--space-sm);
|
||||
min-height: 56px;
|
||||
padding: var(--space-sm) var(--space-md);
|
||||
font-family: var(--evt-titre);
|
||||
font-weight: 600;
|
||||
font-size: 1.12rem;
|
||||
cursor: pointer;
|
||||
list-style: none;
|
||||
}
|
||||
.evt-details > summary::-webkit-details-marker { display: none; }
|
||||
.evt-details > summary::after {
|
||||
content: '+';
|
||||
flex: none;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: var(--radius-full);
|
||||
background: color-mix(in srgb, var(--evt-teinte) 13%, var(--surface));
|
||||
color: var(--evt-teinte);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
font-family: var(--font-body);
|
||||
font-size: 1.15rem;
|
||||
line-height: 1;
|
||||
}
|
||||
.evt-details[open] > summary::after { content: '−'; }
|
||||
.evt-details > summary:hover::after { background: color-mix(in srgb, var(--evt-teinte) 24%, var(--surface)); }
|
||||
.evt-details__corps { padding: 0 var(--space-md) var(--space-md); }
|
||||
|
||||
/* ── Listes ── */
|
||||
.evt-liste { margin: 0 0 var(--space-md); padding-left: 1.2em; }
|
||||
.evt-liste li { margin-bottom: var(--space-xs); }
|
||||
/* Le déroulé : des points safran reliés par un fil (plus de bordure épaisse) */
|
||||
.evt-deroule { margin: 0; padding: 0; list-style: none; }
|
||||
.evt-deroule li { position: relative; padding: 0 0 var(--space-lg) var(--space-xl); }
|
||||
.evt-deroule li::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 3px;
|
||||
top: 0.4em;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
border-radius: var(--radius-full);
|
||||
background: var(--accent);
|
||||
box-shadow: 0 0 0 3px var(--bg);
|
||||
}
|
||||
.evt-deroule li::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 9px;
|
||||
top: 1.5em;
|
||||
bottom: 0.1em;
|
||||
width: 1px;
|
||||
background: var(--border-strong);
|
||||
}
|
||||
.evt-deroule li:last-child { padding-bottom: 0; }
|
||||
.evt-deroule li:last-child::after { display: none; }
|
||||
.evt-deroule strong { display: block; font-family: var(--evt-titre); font-weight: 600; font-size: 1.1rem; margin-bottom: 2px; }
|
||||
|
||||
/* ── Encadré ── */
|
||||
.evt-encadre {
|
||||
padding: var(--space-md);
|
||||
border-radius: var(--radius-lg);
|
||||
background: var(--bg-alt);
|
||||
}
|
||||
.evt-encadre p:last-child { margin-bottom: 0; }
|
||||
|
||||
/* ── Pied ── */
|
||||
.evt-pied {
|
||||
margin-top: var(--space-3xl);
|
||||
padding-top: var(--space-lg);
|
||||
border-top: 1px solid var(--border);
|
||||
font-size: var(--fs-sm);
|
||||
}
|
||||
.evt-pied p { margin-bottom: var(--space-xs); }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.evt-btn, .evt-btn:hover { transition: none; transform: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,10 @@
|
||||
<template>
|
||||
<footer class="evt-pied">
|
||||
<slot />
|
||||
<p>Contact : <a :href="`mailto:${contact}`">{{ contact }}</a></p>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineProps<{ contact: string }>()
|
||||
</script>
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<!-- « Le sens de la semaine » : ouvert par défaut, le « − » le replie (Jules, B26). Le cercle
|
||||
animé d'aep (EvenementsCercle) remplace le schéma « ce qui sort / ce qui revient » de B25 ;
|
||||
la légende et les noms se lisent dans utils/echelles.ts, comme sur aep. Les zooms S et M
|
||||
gardent le texte du deck e-codev (slides 08-09) ; leurs nuages de mots, que le cercle fait
|
||||
déjà tourner, sont retirés. -->
|
||||
<details class="evt-details sens" open>
|
||||
<summary>Le sens de la semaine</summary>
|
||||
<div class="evt-details__corps">
|
||||
<EvenementsCercle class="sens__cercle" />
|
||||
|
||||
<dl class="sens__echelles">
|
||||
<div v-for="id in ORDRE_ECHELLES" :key="id">
|
||||
<dt><span class="sens__badge">{{ id }}</span>{{ ECHELLES[id].titre }}</dt>
|
||||
<dd>{{ ACCROCHES[id] ?? ECHELLES[id].accroche }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p class="sens__boucle">Pas un escalier, une boucle : ça circule dans les deux sens, et on y repasse toute sa vie.</p>
|
||||
|
||||
<div class="sens__zoom">
|
||||
<h3 class="evt-h3"><span class="sens__badge">S</span>Partir de soi : sortir la tête de l'eau</h3>
|
||||
<p>
|
||||
C'est le gros du travail, et c'est celui qu'on fait seul par défaut : avoir assez d'air dans la semaine
|
||||
pour se poser la question du sens. Matériel et mutualisé : des ressources, des méthodes, des pairs qui
|
||||
vivent la même chose.
|
||||
</p>
|
||||
</div>
|
||||
<div class="sens__zoom">
|
||||
<h3 class="evt-h3"><span class="sens__badge">M</span>La communauté</h3>
|
||||
<p>
|
||||
Le chemin a des hauts et des bas. Trop gros pour y arriver seul : c'est le groupe qui remet un individu
|
||||
debout. L'affinité fait tenir, la confrontation fait avancer.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ECHELLES, ORDRE_ECHELLES, type EchelleId } from '~/utils/echelles'
|
||||
|
||||
/**
|
||||
* Accroches propres à la page codev, celles du deck e-codev du 23/10 (v2, slide 07) ; les autres viennent
|
||||
* d'utils/echelles.ts, comme sur aep. Pas dans echelles.ts : aep garde son texte (conférence du 23/09).
|
||||
*/
|
||||
const ACCROCHES: Partial<Record<EchelleId, string>> = {
|
||||
XL: 'le sens et l\'utilité de ce qu\'on fait : un métier et des pratiques alignés, au service de la société et de son évolution',
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* Le cercle déborde un peu du padding de la carte : 11 px de texte à 360 px d'écran */
|
||||
.sens__cercle { max-width: 440px; margin: 0 calc(-1 * var(--space-sm)) var(--space-lg); }
|
||||
@media (min-width: 480px) { .sens__cercle { margin: var(--space-xs) auto var(--space-lg); } }
|
||||
|
||||
.sens__badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 2rem;
|
||||
margin-right: var(--space-sm);
|
||||
padding: 0.1rem 0.5rem;
|
||||
border-radius: var(--radius-sm);
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
font-weight: var(--fw-bold);
|
||||
font-size: var(--fs-sm);
|
||||
letter-spacing: 0.04em;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.sens__echelles { margin: 0 0 var(--space-md); display: grid; gap: var(--space-sm); }
|
||||
.sens__echelles dt { font-weight: var(--fw-bold); }
|
||||
.sens__echelles dd { margin: 2px 0 0; color: var(--evt-attenue); }
|
||||
.sens__boucle { font-family: var(--evt-titre); font-weight: 600; font-size: 1.3rem; line-height: 1.3; text-wrap: balance; }
|
||||
.sens__zoom { margin-top: var(--space-lg); padding-top: var(--space-md); border-top: 1px solid var(--border); }
|
||||
.sens__zoom .evt-h3 { display: flex; align-items: baseline; font-size: var(--fs-lg); line-height: 1.3; }
|
||||
</style>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<figure class="evt-figure strates">
|
||||
<svg viewBox="0 0 560 300" role="img" aria-labelledby="strates-titre strates-desc">
|
||||
<title id="strates-titre">Les étages de la forêt</title>
|
||||
<desc id="strates-desc">
|
||||
De haut en bas : la strate haute, les grands arbres ; la strate moyenne, les fruitiers ;
|
||||
la strate basse, les petits fruits et les boutures ; au sol, la consoude.
|
||||
</desc>
|
||||
<!-- repères d'étage -->
|
||||
<g class="strates__repere">
|
||||
<line x1="0" x2="560" y1="58" y2="58" />
|
||||
<line x1="0" x2="560" y1="138" y2="138" />
|
||||
<line x1="0" x2="560" y1="208" y2="208" />
|
||||
</g>
|
||||
<g class="strates__etiquette">
|
||||
<text x="4" y="50">haute</text>
|
||||
<text x="4" y="130">moyenne</text>
|
||||
<text x="4" y="200">basse</text>
|
||||
<text x="4" y="262">herbacée</text>
|
||||
</g>
|
||||
|
||||
<!-- sol -->
|
||||
<path class="strates__sol" d="M0 268 Q140 262 280 268 T560 266 V300 H0 Z" />
|
||||
|
||||
<!-- haute : grand arbre -->
|
||||
<g class="strates__arbre strates__arbre--haut">
|
||||
<line x1="440" y1="268" x2="440" y2="96" />
|
||||
<line x1="440" y1="150" x2="410" y2="118" /><line x1="440" y1="132" x2="472" y2="104" />
|
||||
<ellipse cx="440" cy="62" rx="76" ry="48" />
|
||||
</g>
|
||||
<!-- moyenne : fruitier -->
|
||||
<g class="strates__arbre strates__arbre--moyen">
|
||||
<line x1="300" y1="268" x2="300" y2="166" />
|
||||
<ellipse cx="300" cy="142" rx="54" ry="34" />
|
||||
<circle class="strates__fruit" cx="282" cy="150" r="5" /><circle class="strates__fruit" cx="318" cy="138" r="5" /><circle class="strates__fruit" cx="304" cy="158" r="5" />
|
||||
</g>
|
||||
<!-- basse : arbuste + bouture -->
|
||||
<g class="strates__arbre strates__arbre--bas">
|
||||
<line x1="190" y1="268" x2="190" y2="226" />
|
||||
<ellipse cx="190" cy="214" rx="36" ry="22" />
|
||||
<circle class="strates__fruit" cx="178" cy="220" r="4" /><circle class="strates__fruit" cx="198" cy="210" r="4" />
|
||||
<line class="strates__bouture" x1="244" y1="268" x2="248" y2="216" />
|
||||
<path class="strates__feuille" d="M248 222 q10 -6 14 -16 q-12 2 -14 16 Z M247 234 q-10 -4 -14 -14 q12 1 14 14 Z" />
|
||||
</g>
|
||||
<!-- herbacée : consoude -->
|
||||
<g class="strates__herbe" transform="translate(40 0)">
|
||||
<path d="M110 268 q-14 -18 -20 -34 q14 8 20 34 Z" />
|
||||
<path d="M112 268 q2 -24 10 -40 q4 18 -10 40 Z" />
|
||||
<path d="M116 268 q14 -14 28 -22 q-6 16 -28 22 Z" />
|
||||
</g>
|
||||
<!-- paille au sol -->
|
||||
<path class="strates__paille" d="M60 268 l18 -4 M150 267 l22 -3 M340 268 l20 -4 M500 267 l24 -3" />
|
||||
</svg>
|
||||
</figure>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.strates svg { background: var(--surface); border: 1px solid var(--border); }
|
||||
.strates__repere line { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 6; }
|
||||
.strates__etiquette text { font-size: 20px; font-weight: 700; fill: var(--evt-attenue); }
|
||||
.strates__sol { fill: var(--bg-alt); }
|
||||
.strates__arbre line, .strates__bouture { stroke: var(--text); stroke-width: 4; stroke-linecap: round; }
|
||||
.strates__arbre ellipse { stroke: var(--text); stroke-width: 2; }
|
||||
.strates__arbre--haut ellipse { fill: color-mix(in srgb, var(--nav-primary-solid) 30%, var(--surface)); }
|
||||
.strates__arbre--moyen ellipse { fill: color-mix(in srgb, var(--nav-primary-solid) 18%, var(--surface)); }
|
||||
.strates__arbre--bas ellipse { fill: color-mix(in srgb, var(--nav-primary-solid) 10%, var(--surface)); }
|
||||
.strates__fruit { fill: var(--accent); stroke: var(--text); stroke-width: 1; }
|
||||
.strates__feuille, .strates__herbe path { fill: color-mix(in srgb, var(--nav-primary-solid) 22%, var(--surface)); stroke: var(--text); stroke-width: 1.5; }
|
||||
.strates__bouture { stroke-width: 3; }
|
||||
.strates__paille { stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
|
||||
</style>
|
||||
@@ -0,0 +1,89 @@
|
||||
<!--
|
||||
AnneauEchelle — B13-M3
|
||||
L'anneau seul d'une échelle (deck v3.3, slides 17-19, `drawRing`) : un cercle plein,
|
||||
un cercle intérieur en pointillés, la lettre. Le nom que le deck écrivait au bas de
|
||||
l'anneau tombe : à la taille d'une vignette il serait illisible, et le titre de
|
||||
l'échelle est juste à côté.
|
||||
Décoratif (aria-hidden) : le titre et les sept mots portent le sens.
|
||||
Bleu nuit à 60 % (parti 2), safran quand `actif`. Géométrie : utils/figures.ts.
|
||||
La taille se règle de l'extérieur (largeur CSS) ; le trait garde son épaisseur à toute taille.
|
||||
-->
|
||||
<template>
|
||||
<svg
|
||||
class="anneau-echelle"
|
||||
:class="{ 'anneau-echelle--actif': actif }"
|
||||
:viewBox="`0 0 ${ANNEAU_L} ${ANNEAU_L}`"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
>
|
||||
<circle class="anneau-echelle__plein" :cx="g.cx" :cy="g.cy" :r="g.r" />
|
||||
<circle class="anneau-echelle__pointilles" :cx="g.cx" :cy="g.cy" :r="g.rPointilles" />
|
||||
<text
|
||||
class="anneau-echelle__lettre"
|
||||
:x="g.cx"
|
||||
:y="g.yLettre"
|
||||
text-anchor="middle"
|
||||
:font-size="g.tailleLettre"
|
||||
>{{ echelle }}</text>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { EchelleId } from '~/utils/echelles'
|
||||
import { ANNEAU_L, anneauSeul } from '~/utils/figures'
|
||||
|
||||
withDefaults(defineProps<{
|
||||
echelle: EchelleId
|
||||
/** Échelle courante : anneau en safran. */
|
||||
actif?: boolean
|
||||
}>(), { actif: false })
|
||||
|
||||
const g = anneauSeul()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.anneau-echelle {
|
||||
display: block;
|
||||
width: 4.5rem;
|
||||
height: auto;
|
||||
aspect-ratio: 1;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.anneau-echelle__plein {
|
||||
fill: color-mix(in srgb, var(--nav-primary-solid) 8%, transparent);
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 2px;
|
||||
vector-effect: non-scaling-stroke;
|
||||
transition: fill 200ms var(--ease-out), stroke 200ms var(--ease-out);
|
||||
}
|
||||
|
||||
.anneau-echelle__pointilles {
|
||||
fill: none;
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 1.5px;
|
||||
stroke-dasharray: 3 4;
|
||||
vector-effect: non-scaling-stroke;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.anneau-echelle__lettre {
|
||||
fill: var(--text);
|
||||
font-family: var(--font-body);
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
|
||||
.anneau-echelle--actif .anneau-echelle__plein {
|
||||
fill: color-mix(in srgb, var(--accent) 22%, transparent);
|
||||
stroke: var(--accent);
|
||||
stroke-width: 3px;
|
||||
}
|
||||
|
||||
.anneau-echelle--actif .anneau-echelle__pointilles {
|
||||
stroke: var(--accent);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.anneau-echelle__plein { transition: none; }
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,240 @@
|
||||
.proposer-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
|
||||
.field-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
.field-group label,
|
||||
.field-group legend {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--nav-text);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.field-group fieldset {
|
||||
border: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.required { color: #c0392b; }
|
||||
|
||||
.label-hint {
|
||||
font-weight: 400;
|
||||
color: var(--nav-text-muted);
|
||||
font-size: 0.8rem;
|
||||
margin-left: 0.25rem;
|
||||
}
|
||||
|
||||
.field-group input[type="text"],
|
||||
.field-group input[type="url"],
|
||||
.field-group input[type="email"],
|
||||
.field-group textarea {
|
||||
width: 100%;
|
||||
padding: 0.625rem 0.875rem;
|
||||
border: 1px solid rgba(26, 34, 56, 0.2);
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
color: var(--nav-text);
|
||||
background: var(--nav-surface);
|
||||
font-family: inherit;
|
||||
transition: border-color 0.15s, box-shadow 0.15s;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.field-group input:focus,
|
||||
.field-group textarea:focus {
|
||||
outline: none;
|
||||
border-color: var(--nav-primary-solid);
|
||||
box-shadow: 0 0 0 2px rgba(245, 179, 66, 0.4);
|
||||
}
|
||||
|
||||
.field-group textarea {
|
||||
resize: vertical;
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.field-error input,
|
||||
.field-error textarea {
|
||||
border-color: #c0392b !important;
|
||||
}
|
||||
|
||||
.error-msg {
|
||||
font-size: 0.8rem;
|
||||
color: #c0392b;
|
||||
}
|
||||
|
||||
.field-meta {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.char-count {
|
||||
font-size: 0.75rem;
|
||||
color: var(--nav-text-muted);
|
||||
}
|
||||
|
||||
.char-warn {
|
||||
color: #e67e22;
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.375rem;
|
||||
}
|
||||
|
||||
.radio-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
border: 1px solid rgba(26, 34, 56, 0.2);
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--nav-text);
|
||||
background: var(--nav-surface);
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.radio-label input[type="radio"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.radio-label:hover {
|
||||
border-color: var(--nav-primary-solid);
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.radio-label.active {
|
||||
background: var(--nav-primary);
|
||||
border-color: transparent;
|
||||
color: var(--nav-text-on-primary);
|
||||
}
|
||||
|
||||
.checkbox-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0.5rem;
|
||||
margin-top: 0.375rem;
|
||||
}
|
||||
|
||||
@media (max-width: 400px) {
|
||||
.checkbox-grid { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
.checkbox-label {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.375rem;
|
||||
padding: 0.375rem 0.75rem;
|
||||
border: 1px solid rgba(26, 34, 56, 0.2);
|
||||
border-radius: 6px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--nav-text);
|
||||
background: var(--nav-surface);
|
||||
cursor: pointer;
|
||||
transition: all 0.15s;
|
||||
user-select: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.checkbox-label input[type="checkbox"] {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.checkbox-label:hover:not(.disabled) {
|
||||
border-color: var(--nav-primary-solid);
|
||||
background: var(--nav-bg-alt);
|
||||
}
|
||||
|
||||
.checkbox-label.active {
|
||||
background: var(--nav-primary);
|
||||
border-color: transparent;
|
||||
color: var(--nav-text-on-primary);
|
||||
}
|
||||
|
||||
.checkbox-label.disabled {
|
||||
opacity: 0.4;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.fn-order {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
background: var(--nav-accent);
|
||||
color: var(--nav-text);
|
||||
border-radius: 50%;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 700;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.server-error {
|
||||
padding: 0.875rem 1rem;
|
||||
background: #fdf0ee;
|
||||
border: 1px solid #e74c3c;
|
||||
border-radius: 8px;
|
||||
font-size: 0.875rem;
|
||||
color: #c0392b;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
justify-content: flex-end;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
padding: 0.75rem 1.5rem;
|
||||
background: var(--nav-primary);
|
||||
color: var(--nav-text-on-primary);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
transition: background 0.15s, opacity 0.15s;
|
||||
}
|
||||
|
||||
.btn-primary:hover:not(:disabled) {
|
||||
background: rgba(26, 34, 56, 0.75);
|
||||
}
|
||||
|
||||
.btn-primary:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.form-note {
|
||||
font-size: 0.75rem;
|
||||
color: var(--nav-text-muted);
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.form-actions { flex-direction: column-reverse; }
|
||||
.btn-primary { width: 100%; justify-content: center; }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Fond de carte commun aux cartes Leaflet.
|
||||
// CARTO exige une clé depuis le 23/09/2026 (sans clé : filigrane « API KEY REQUIRED »).
|
||||
// Clé fournie au runtime par NUXT_PUBLIC_CARTO_KEY ; sans clé, repli sur le Plan IGN (Géoplateforme, sans clé).
|
||||
const IGN_URL = 'https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0'
|
||||
+ '&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&TILEMATRIXSET=PM_0_19&FORMAT=image/png'
|
||||
+ '&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}'
|
||||
|
||||
export function useBaseTiles() {
|
||||
const key = useRuntimeConfig().public.cartoKey as string
|
||||
|
||||
function url(dark: boolean) {
|
||||
if (!key) return IGN_URL
|
||||
const style = dark ? 'dark_all' : 'light_all'
|
||||
return `https://{s}.basemaps.cartocdn.com/${style}/{z}/{x}/{y}{r}.png?key=${encodeURIComponent(key)}`
|
||||
}
|
||||
|
||||
const attribution = key
|
||||
? '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors © <a href="https://carto.com/attributions">CARTO</a>'
|
||||
: '© <a href="https://www.ign.fr/">IGN</a> – Géoplateforme'
|
||||
|
||||
return { url, attribution }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Mode de profondeur courant d'un chatbot (M3). État partagé par clé via useState :
|
||||
* desktop et mobile d'un même chatbot (clés 'accueil', 'agences'…) restent synchronisés.
|
||||
* Volontairement non persisté : le mode est un choix par question, 'rapide' à chaque visite.
|
||||
*/
|
||||
export function useChatProfondeur(key: string | (() => string) = 'defaut') {
|
||||
const k = typeof key === 'function' ? key : () => key
|
||||
const store = useState<Record<string, ChatProfondeur>>('aep-chat-profondeur', () => ({}))
|
||||
return computed<ChatProfondeur>({
|
||||
get: () => store.value[k()] ?? CHAT_PROFONDEUR_DEFAUT,
|
||||
set: (v) => { store.value = { ...store.value, [k()]: normaliserProfondeur(v) } },
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
import type { MaybeRefOrGetter } from 'vue'
|
||||
|
||||
/**
|
||||
* Persistance de l'historique d'un chatbot dans sessionStorage.
|
||||
*
|
||||
* - Clé de stockage : `aep-chat-<pageKey>`, valeur `{ v: 1, messages: [...] }`
|
||||
* (une valeur d'une autre version est ignorée).
|
||||
* - SSR-safe : aucun accès au stockage hors de onMounted. Côté serveur et à
|
||||
* l'hydratation l'historique est vide, il est restauré juste après le mount.
|
||||
* - Partagé : deux composants (desktop + mobile) qui déclarent la même clé
|
||||
* lisent et écrivent le même tableau (useState), donc un redimensionnement
|
||||
* ne perd rien et un composant n'écrase pas l'autre.
|
||||
* - Tolérant : toute lecture/écriture est dans un try/catch (navigation
|
||||
* privée, stockage bloqué, quota). En cas d'échec le chatbot fonctionne
|
||||
* comme avant, sans persistance.
|
||||
* - Les messages marqués `transient: true` (erreurs) restent affichés mais ne
|
||||
* sont jamais écrits. Chargement et erreurs vivent hors de l'historique.
|
||||
* - La forme des messages est libre (fiches, auteur, mode...) : tout champ
|
||||
* sérialisable est conservé.
|
||||
*/
|
||||
export interface ChatSessionMessage {
|
||||
role: string
|
||||
content: string
|
||||
transient?: boolean
|
||||
}
|
||||
|
||||
const STORAGE_PREFIX = 'aep-chat-'
|
||||
const SCHEMA_VERSION = 1
|
||||
const DEFAULT_MAX = 40
|
||||
|
||||
export function useChatSession<T extends ChatSessionMessage>(
|
||||
pageKey: MaybeRefOrGetter<string>,
|
||||
options: { max?: number } = {},
|
||||
) {
|
||||
const max = options.max ?? DEFAULT_MAX
|
||||
const store = useState<Record<string, T[]>>('aep-chat-store', () => ({}))
|
||||
const restored = useState<Record<string, boolean>>('aep-chat-restored', () => ({}))
|
||||
const key = computed(() => toValue(pageKey))
|
||||
const mounted = ref(false)
|
||||
|
||||
function ensure(k: string) {
|
||||
if (!store.value[k]) store.value[k] = []
|
||||
}
|
||||
|
||||
const messages = computed<T[]>({
|
||||
get: () => store.value[key.value] ?? [],
|
||||
set: (list) => { store.value[key.value] = list },
|
||||
})
|
||||
const hasHistory = computed(() => messages.value.length > 0)
|
||||
|
||||
function isValid(m: any): m is T {
|
||||
return !!m && typeof m === 'object' && typeof m.role === 'string' && typeof m.content === 'string'
|
||||
}
|
||||
|
||||
function restore() {
|
||||
const k = key.value
|
||||
if (restored.value[k]) return
|
||||
restored.value[k] = true
|
||||
ensure(k)
|
||||
try {
|
||||
const raw = sessionStorage.getItem(STORAGE_PREFIX + k)
|
||||
if (!raw) return
|
||||
const data = JSON.parse(raw)
|
||||
if (!data || data.v !== SCHEMA_VERSION || !Array.isArray(data.messages)) return
|
||||
const valid = (data.messages as unknown[]).filter(isValid).slice(-max)
|
||||
if (valid.length && store.value[k].length === 0) store.value[k] = valid
|
||||
} catch {
|
||||
/* stockage indisponible ou valeur corrompue : on repart de zéro */
|
||||
}
|
||||
}
|
||||
|
||||
function save() {
|
||||
if (!mounted.value) return
|
||||
try {
|
||||
const list = messages.value.filter(m => !m.transient).slice(-max)
|
||||
const sk = STORAGE_PREFIX + key.value
|
||||
if (list.length === 0) sessionStorage.removeItem(sk)
|
||||
else sessionStorage.setItem(sk, JSON.stringify({ v: SCHEMA_VERSION, messages: list }))
|
||||
} catch {
|
||||
/* quota, navigation privée : pas de persistance, pas d'erreur */
|
||||
}
|
||||
}
|
||||
|
||||
/** Efface l'historique affiché et la clé de stockage. */
|
||||
function clear() {
|
||||
store.value[key.value] = []
|
||||
try { sessionStorage.removeItem(STORAGE_PREFIX + key.value) } catch { /* ignoré */ }
|
||||
}
|
||||
|
||||
watch(key, (k) => {
|
||||
ensure(k)
|
||||
if (mounted.value) restore()
|
||||
}, { immediate: true })
|
||||
|
||||
watch(messages, save, { deep: true })
|
||||
|
||||
onMounted(() => {
|
||||
restore()
|
||||
mounted.value = true
|
||||
})
|
||||
|
||||
return { messages, hasHistory, clear }
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* useEntree — B13-M5. L'état de l'entrée par le schéma S / M / XL, branché sur l'URL.
|
||||
*
|
||||
* L'URL fait foi (`?porte=S|M|XL`, CONCEPTION §4), comme `vue=` et `fiche=` (B11-B12) :
|
||||
* - `ouvrir` = `push` : le retour du navigateur ramène au schéma ;
|
||||
* - `voisine` = `replace` : passer d'une porte à l'autre n'empile rien
|
||||
* (une entrée d'historique par visite) ;
|
||||
* - `fermer` = `back()` si l'entrée d'avant est le schéma de cette page, sinon
|
||||
* `replace` (lien partagé, arrivée d'une autre page) : jamais de sortie du site.
|
||||
* Le Précédent du navigateur n'est jamais détourné (CONSTAT Holosapiens §4 : `push`, pas `replace`).
|
||||
*
|
||||
* Logique pure et tests : `utils/echelles.ts` (`lirePorte`, `voisines`, `fermeturePorte`),
|
||||
* `scripts/test-echelles-nav.mjs`.
|
||||
*
|
||||
* Mouvement (B13-M6) : `premiere` = l'apparition du schéma reste à jouer (clé
|
||||
* `localStorage.aep_entree_vue` absente, lue dans un `try`) ; `mouvementReduit`
|
||||
* suit `prefers-reduced-motion`. Le stockage ne sert qu'à « apparition jouée » ;
|
||||
* B14 s'en servira pour ne plus ouvrir de popup d'office.
|
||||
*/
|
||||
import { ORDRE_ECHELLES, PARAM_PORTE, lirePorte, voisines, fermeturePorte, type EchelleId } from '~/utils/echelles'
|
||||
import { finApparition } from '~/utils/figures'
|
||||
|
||||
/** Clé posée quand le schéma a été vu une fois (apparition jouée). */
|
||||
export const CLE_ENTREE_VUE = 'aep_entree_vue'
|
||||
|
||||
/** Script de tête : pose `html.entree-vue` avant le premier rendu si la clé existe (pas d'apparition rejouée). */
|
||||
export const SCRIPT_ENTREE_VUE =
|
||||
`try{if(localStorage.getItem('${CLE_ENTREE_VUE}')!==null)document.documentElement.classList.add('entree-vue')}catch(e){}`
|
||||
|
||||
function lireVue(): boolean {
|
||||
try {
|
||||
return localStorage.getItem(CLE_ENTREE_VUE) !== null
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
function marquerVue() {
|
||||
try {
|
||||
localStorage.setItem(CLE_ENTREE_VUE, '1')
|
||||
} catch {
|
||||
// stockage refusé (navigation privée, réglages) : l'apparition se rejouera, rien d'autre
|
||||
}
|
||||
}
|
||||
|
||||
/** Sens du dernier changement de porte : choisit la transition et la cible du focus. */
|
||||
export type SensPassage = 'ouvrir' | 'fermer' | 'avant' | 'arriere'
|
||||
|
||||
export function useEntree() {
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const porte = computed<EchelleId | null>(() => lirePorte(route.query))
|
||||
|
||||
const sens = ref<SensPassage>('ouvrir')
|
||||
// `sync` : le sens est connu avant le rendu qui change de porte.
|
||||
watch(porte, (n, o) => {
|
||||
if (n && !o) sens.value = 'ouvrir'
|
||||
else if (!n) sens.value = 'fermer'
|
||||
else sens.value = ORDRE_ECHELLES.indexOf(n) > ORDRE_ECHELLES.indexOf(o as EchelleId) ? 'avant' : 'arriere'
|
||||
}, { flush: 'sync' })
|
||||
|
||||
function query(id: EchelleId | null) {
|
||||
const q: Record<string, unknown> = { ...route.query }
|
||||
if (id) q[PARAM_PORTE] = id
|
||||
else delete q[PARAM_PORTE]
|
||||
return q as Record<string, string>
|
||||
}
|
||||
|
||||
function ouvrir(id: EchelleId) {
|
||||
if (porte.value === id) return
|
||||
return router.push({ path: route.path, query: query(id) })
|
||||
}
|
||||
|
||||
function voisine(id: EchelleId) {
|
||||
if (porte.value === id) return
|
||||
return router.replace({ path: route.path, query: query(id) })
|
||||
}
|
||||
|
||||
/** ← / → au clavier, ou les liens « voisines ». */
|
||||
function lateral(pas: -1 | 1) {
|
||||
if (!porte.value) return
|
||||
const v = voisines(porte.value)
|
||||
const cible = pas < 0 ? v.precedente : v.suivante
|
||||
if (cible) return voisine(cible)
|
||||
}
|
||||
|
||||
function fermer() {
|
||||
if (!porte.value) return
|
||||
// Vue Router range l'adresse de l'entrée précédente dans history.state.back.
|
||||
const precedente = import.meta.client ? (window.history.state as { back?: unknown } | null)?.back : null
|
||||
if (fermeturePorte(precedente, route.path) === 'back') return router.back()
|
||||
return router.replace({ path: route.path, query: query(null) })
|
||||
}
|
||||
|
||||
// ── Mouvement ──
|
||||
// Rendu serveur : true (la tête de page éteint l'apparition si la clé existe).
|
||||
// Navigation interne vers l'entrée : lu tout de suite, avant le premier rendu.
|
||||
const premiere = useState('aep-entree-premiere', () => (import.meta.client ? !lireVue() : true))
|
||||
const dejaVue = ref(false)
|
||||
const mouvementReduit = ref(false)
|
||||
|
||||
let minuteur: ReturnType<typeof setTimeout> | null = null
|
||||
/** À appeler quand le grand schéma est à l'écran : la clé est posée, l'apparition ne se rejouera plus. */
|
||||
function schemaAffiche() {
|
||||
if (!import.meta.client) return
|
||||
dejaVue.value = lireVue()
|
||||
if (dejaVue.value || mouvementReduit.value) {
|
||||
marquerVue()
|
||||
premiere.value = false
|
||||
return
|
||||
}
|
||||
marquerVue()
|
||||
// On laisse finir l'animation avant de retirer la classe (la retirer en cours la couperait net).
|
||||
if (minuteur) clearTimeout(minuteur)
|
||||
minuteur = setTimeout(() => { premiere.value = false }, finApparition() + 100)
|
||||
}
|
||||
|
||||
let mq: MediaQueryList | null = null
|
||||
const suivreMq = () => { mouvementReduit.value = !!mq?.matches }
|
||||
onMounted(() => {
|
||||
mq = window.matchMedia('(prefers-reduced-motion: reduce)')
|
||||
suivreMq()
|
||||
mq.addEventListener('change', suivreMq)
|
||||
dejaVue.value = lireVue()
|
||||
})
|
||||
onBeforeUnmount(() => {
|
||||
mq?.removeEventListener('change', suivreMq)
|
||||
// Partie avant la fin : l'apparition est jouée, elle ne recommencera pas au retour.
|
||||
if (minuteur) { clearTimeout(minuteur); premiere.value = false }
|
||||
})
|
||||
|
||||
return { porte, sens, ouvrir, voisine, lateral, fermer, premiere, dejaVue, mouvementReduit, schemaAffiche }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { canoniqueEvenement, estHoteEvenement, lienEvenement } from '~/utils/evenements'
|
||||
import { SITE_EVENT } from '~/utils/seo'
|
||||
|
||||
/**
|
||||
* Pages d'événement : sur quel hôte on est, comment écrire un lien, et la tête de partage
|
||||
* (titre, description, Open Graph, Twitter), que le plugin B23 ne pose pas.
|
||||
* La canonique et le robots ne sont plus posés ici (B29, 24/10) : plugins/seo.ts les pose
|
||||
* sur chaque page depuis utils/seo.ts, mêmes valeurs. `ogUrl` reprend la même canonique.
|
||||
*/
|
||||
export function useEvenement() {
|
||||
const surEvent = estHoteEvenement(useRequestURL().hostname)
|
||||
const lien = (chemin: string) => lienEvenement(chemin, surEvent)
|
||||
|
||||
function seo(o: { chemin: string; titre: string; description: string; image: string; alt: string }) {
|
||||
const canon = canoniqueEvenement(o.chemin)
|
||||
const image = SITE_EVENT + o.image
|
||||
useSeoMeta({
|
||||
title: o.titre,
|
||||
description: o.description,
|
||||
ogTitle: o.titre,
|
||||
ogDescription: o.description,
|
||||
ogImage: image,
|
||||
ogImageAlt: o.alt,
|
||||
ogUrl: canon,
|
||||
ogType: 'website',
|
||||
ogLocale: 'fr_FR',
|
||||
twitterCard: 'summary_large_image',
|
||||
})
|
||||
}
|
||||
|
||||
return { surEvent, lien, seo }
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
/**
|
||||
* useFicheAdapter — B3-M2, étendu en B11-M2
|
||||
* Adaptateur léger Org | StructureV2 → MiniFiche, format commun consommé par
|
||||
* FicheMiniCard / VueFiches. Aucune mutation des types sources.
|
||||
*
|
||||
* Repli résumé (brief B3, le champ `resume_court` du batch B2b n'existe pas
|
||||
* encore) : première phrase du premier champ non vide parmi une liste de
|
||||
* candidats ordonnée par type, tronquée proprement à ~110 caractères sur un
|
||||
* mot (jamais au milieu).
|
||||
*
|
||||
* B11 : chaque fiche porte ses `etiquettes` par dimension (clé = paramètre
|
||||
* d'URL de la dimension : `fonctions`, `echelle`, `territoire` pour l'Entraide ;
|
||||
* `tags`, `famille`, `pays` pour Réseaux AEP). C'est ce que filtre, trie et
|
||||
* regroupe `utils/vueFiches.ts` ; `chips` et `echelle` restent l'affichage
|
||||
* de la carte-fiche, inchangé.
|
||||
*
|
||||
* B4a : `toMini(source, classer)` ajoute `type` (type d'organisation) et `postures` aux
|
||||
* étiquettes, lus par `classer` dans le mapping `data/taxonomie/organisations.json`
|
||||
* (`utils/taxonomie.ts`, passé par la page de la carte : les autres pages n'embarquent
|
||||
* pas le mapping). Sans `classer`, rien ne change.
|
||||
*/
|
||||
import type { Org } from '~/types/org'
|
||||
import type { StructureV2 } from '~/types/structure-v2'
|
||||
import type { JeuConnaissances, ObjetConnaissance } from '../utils/connaissances/valider'
|
||||
import { lecture, porteursDe, estRendu, type Lecture } from '../utils/connaissances/lire'
|
||||
import { ECHELLES, LIBELLES_NATURE, RE_PREFIXE } from '../utils/connaissances/vocabulaire'
|
||||
|
||||
export interface MiniFiche {
|
||||
id: string | number
|
||||
nom: string
|
||||
resume: string
|
||||
/** Étiquettes affichées sur la carte-fiche (3 au plus). */
|
||||
chips: string[]
|
||||
/** Dimension d'où viennent `chips` : les rend cliquables dans la vue fiches. */
|
||||
chipsDimension?: string
|
||||
echelle?: string
|
||||
geoloc: boolean
|
||||
kind: 'org' | 'structure' | 'mot' | 'concept' | 'texte' | 'organisation' | 'outil'
|
||||
/** Étiquettes complètes par dimension (valeurs telles qu'écrites dans l'URL). */
|
||||
etiquettes?: Record<string, string[]>
|
||||
coords?: [number, number]
|
||||
/** Date ISO si la source en a une (tri « récent »). */
|
||||
date?: string
|
||||
ville?: string
|
||||
/** Texte cherchable en plus du nom, de la ville et du résumé. */
|
||||
texte?: string
|
||||
}
|
||||
|
||||
export const DOM_TOM = ['Guadeloupe', 'Martinique', 'Guyane', 'La Réunion', 'Mayotte']
|
||||
|
||||
const RESUME_MAX = 110
|
||||
|
||||
/** Première phrase d'un texte (coupe sur ". "/"! "/"? " ou fin de chaîne). */
|
||||
function firstSentence(text: string): string {
|
||||
const match = text.match(/^.*?[.!?](?=\s|$)/)
|
||||
return (match ? match[0] : text).trim()
|
||||
}
|
||||
|
||||
/** Tronque proprement sur un mot, jamais au milieu. */
|
||||
function truncateOnWord(text: string, max = RESUME_MAX): string {
|
||||
if (text.length <= max) return text
|
||||
const slice = text.slice(0, max)
|
||||
const lastSpace = slice.lastIndexOf(' ')
|
||||
const cut = lastSpace > max * 0.4 ? slice.slice(0, lastSpace) : slice
|
||||
return `${cut.trimEnd()}…`
|
||||
}
|
||||
|
||||
function buildResume(candidates: Array<string | null | undefined>): string {
|
||||
const source = candidates.find((c) => !!c && c.trim().length > 0)
|
||||
if (!source) return ''
|
||||
return truncateOnWord(firstSentence(source.trim()))
|
||||
}
|
||||
|
||||
function isStructure(source: Org | StructureV2): source is StructureV2 {
|
||||
return 'famille_principale' in source
|
||||
}
|
||||
|
||||
function orgFonctions(org: Org): string[] {
|
||||
return (org.tags_fonction ?? '')
|
||||
.split(',')
|
||||
.map((f) => f.trim())
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function coordsDe(lat?: number | null, lon?: number | null): [number, number] | undefined {
|
||||
return lat != null && lon != null ? [lat, lon] : undefined
|
||||
}
|
||||
|
||||
/** Hashtag sans son « # » : c'est la forme de l'URL (`tags=reemploi-structurel`). */
|
||||
export function sansDiese(tag: string): string {
|
||||
return tag.replace(/^#/, '')
|
||||
}
|
||||
|
||||
/** Familles d'une structure : principale, secondaires, et 6 pour le badge recherche politique. */
|
||||
function famillesDe(s: StructureV2): string[] {
|
||||
const ids = [s.famille_principale, ...(s.familles_secondaires ?? [])]
|
||||
if (s.badges?.f6_recherche_politique) ids.push(6 as any)
|
||||
return [...new Set(ids.map(String))]
|
||||
}
|
||||
|
||||
/** Classement d'une fiche par son identifiant de mapping (`org:108`, `structure:f1-rotor`) : `classement` de utils/taxonomie.ts. */
|
||||
export type ClasseurFiche = (id: string) => { type: string; postures: string[] }
|
||||
|
||||
/** `type` et `postures` en étiquettes (B4a). `classer` peut arriver en index de `map` : seule une fonction compte. */
|
||||
function etiquettesTaxonomie(id: string, classer?: unknown): Record<string, string[]> {
|
||||
if (typeof classer !== 'function') return {}
|
||||
const c = (classer as ClasseurFiche)(id)
|
||||
return { type: [c.type], postures: [...c.postures] }
|
||||
}
|
||||
|
||||
export function toMini(source: Org | StructureV2, classer?: ClasseurFiche): MiniFiche {
|
||||
if (isStructure(source)) {
|
||||
const hashtags = source.hashtags ?? []
|
||||
return {
|
||||
id: source.id,
|
||||
nom: source.nom,
|
||||
resume: buildResume([source.description_courte, source.description_longue]),
|
||||
chips: hashtags.slice(0, 3),
|
||||
chipsDimension: 'tags',
|
||||
geoloc: source.latitude != null && source.longitude != null,
|
||||
kind: 'structure',
|
||||
etiquettes: {
|
||||
tags: hashtags.map(sansDiese),
|
||||
famille: famillesDe(source),
|
||||
pays: source.pays ? [source.pays] : [],
|
||||
...etiquettesTaxonomie(`structure:${source.id}`, classer),
|
||||
},
|
||||
coords: coordsDe(source.latitude, source.longitude),
|
||||
ville: source.ville,
|
||||
// Portée de la recherche d'avant B11 sur /agences : description courte et hashtags.
|
||||
texte: [source.description_courte, ...hashtags].filter(Boolean).join(' '),
|
||||
}
|
||||
}
|
||||
|
||||
const fonctions = orgFonctions(source)
|
||||
return {
|
||||
id: source.Id,
|
||||
nom: source.nom,
|
||||
resume: buildResume([source.description_enrichie, source.description]),
|
||||
chips: fonctions.slice(0, 3),
|
||||
chipsDimension: 'fonctions',
|
||||
echelle: source.echelle,
|
||||
geoloc: source.latitude != null && source.longitude != null,
|
||||
kind: 'org',
|
||||
etiquettes: {
|
||||
fonctions,
|
||||
echelle: source.echelle ? [source.echelle] : [],
|
||||
territoire: [source.territoire && DOM_TOM.includes(source.territoire) ? source.territoire : 'Métropole'],
|
||||
...etiquettesTaxonomie(`org:${source.Id}`, classer),
|
||||
},
|
||||
coords: coordsDe(source.latitude, source.longitude),
|
||||
date: source.submitted_at,
|
||||
ville: source.localisation_ville,
|
||||
}
|
||||
}
|
||||
|
||||
// ── Partir de soi (B6-M2) : un mot de la slide 17 = une fiche ─────────────
|
||||
|
||||
/** Une fiche de `public/data/outils.json` → `partir_de_soi.fiches[]`. */
|
||||
export interface FicheMot {
|
||||
id: string
|
||||
mot: string
|
||||
resume: string
|
||||
vide?: string | null
|
||||
}
|
||||
|
||||
/** Une ressource de `partir_de_soi.ressources[]`, reliée à ses mots par `fiches`. */
|
||||
export interface RessourceMot {
|
||||
id: string
|
||||
titre: string
|
||||
format: string
|
||||
acces: string
|
||||
pourquoi?: string
|
||||
fiches: string[]
|
||||
}
|
||||
|
||||
/** « don libre » → `don-libre` : la forme d'une valeur de filtre dans l'URL (`acces=don-libre`). */
|
||||
export function slugEtiquette(s: string): string {
|
||||
return s.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')
|
||||
}
|
||||
|
||||
/** Valeurs distinctes d'un champ des ressources, dans l'ordre de première apparition (ordre stable des chips). */
|
||||
export function valeursRessources(ressources: RessourceMot[], champ: 'format' | 'acces'): { valeur: string; libelle: string }[] {
|
||||
const vus = new Map<string, string>()
|
||||
for (const r of ressources) {
|
||||
const l = r[champ]
|
||||
if (l && !vus.has(slugEtiquette(l))) vus.set(slugEtiquette(l), l)
|
||||
}
|
||||
return [...vus].map(([valeur, libelle]) => ({ valeur, libelle }))
|
||||
}
|
||||
|
||||
/**
|
||||
* Un mot de la conférence → `MiniFiche`. `ressources` = celles qui portent ce mot.
|
||||
* Pas de carte géographique : `geoloc: true` (aucune fiche « sans adresse »).
|
||||
* La recherche couvre aussi les titres et les « pourquoi » des ressources.
|
||||
*/
|
||||
export function toMiniMot(fiche: FicheMot, ressources: RessourceMot[]): MiniFiche {
|
||||
const formats = [...new Set(ressources.map((r) => r.format).filter(Boolean))]
|
||||
const acces = [...new Set(ressources.map((r) => r.acces).filter(Boolean))]
|
||||
return {
|
||||
id: fiche.id,
|
||||
nom: fiche.mot,
|
||||
resume: buildResume([fiche.resume, fiche.vide]),
|
||||
chips: formats.slice(0, 3),
|
||||
chipsDimension: 'format',
|
||||
geoloc: true,
|
||||
kind: 'mot',
|
||||
etiquettes: {
|
||||
format: formats.map(slugEtiquette),
|
||||
acces: acces.map(slugEtiquette),
|
||||
},
|
||||
texte: [fiche.resume, ...ressources.flatMap((r) => [r.titre, r.pourquoi])].filter(Boolean).join(' '),
|
||||
}
|
||||
}
|
||||
|
||||
// ── Connaissances partagées (B19-M1) : un objet de la couche = une fiche ──────
|
||||
// Types : `utils/connaissances/valider.ts` (les seuls de la couche). Vocabulaire :
|
||||
// `utils/connaissances/vocabulaire.ts`. Lecture du jeu (index, porteurs) : `lire.ts`.
|
||||
|
||||
/** `org:holosapiens` → `holosapiens` : la forme d'un porteur dans l'URL (`porteur=holosapiens`). */
|
||||
export const valeurPorteur = (id: string) => id.replace(RE_PREFIXE, '')
|
||||
|
||||
/** Échelles d'un objet : les siennes ; pour une source, celles des concepts publiés qui en sont extraits (projection, rien en base). */
|
||||
function echellesDe(o: ObjetConnaissance, l: Lecture): string[] {
|
||||
if (o.echelles?.length) return [...o.echelles]
|
||||
const out = new Set<string>()
|
||||
for (const r of l.jeu.relations) {
|
||||
if (r.type !== 'extrait_de' || r.vers !== o.id) continue
|
||||
for (const e of l.rendus.get(r.de)?.echelles ?? []) out.add(e)
|
||||
}
|
||||
return ECHELLES.filter((e) => out.has(e))
|
||||
}
|
||||
|
||||
/**
|
||||
* Un objet de la couche → `MiniFiche`. `id` = identifiant préfixé (`cpt:holoptisme`),
|
||||
* `kind` = nature, résumé = définition dans nos mots (concept) ou titre et porteur (objet).
|
||||
* Pas de géographie : `geoloc: true`, comme `toMiniMot` (sinon la vue annoncerait « N sans
|
||||
* adresse » et n'offrirait pas « Voir dans le graphe »).
|
||||
*/
|
||||
export function toMiniConnaissance(objet: ObjetConnaissance, jeu: JeuConnaissances): MiniFiche {
|
||||
// L'index du jeu est construit une fois par jeu (`lecture`, mémorisé), pas une fois par fiche.
|
||||
const l = lecture(jeu)
|
||||
const porteurs = porteursDe(l, objet)
|
||||
const echelles = echellesDe(objet, l)
|
||||
const nomsPorteurs = porteurs.filter((p) => p.id !== objet.id).map((p) => p.nom_canonique)
|
||||
// Une organisation se porte elle-même : « titre — porteur » redirait son nom ; on dit son statut et son adresse.
|
||||
const domaine = typeof objet.url_canonique === 'string' ? objet.url_canonique.replace(/^https?:\/\/(www\.)?/, '').replace(/\/.*$/, '') : ''
|
||||
const resume = objet.nature === 'concept'
|
||||
? (objet.definition_courte ?? '')
|
||||
: objet.nature === 'organisation'
|
||||
? [objet.statut ? `statut : ${objet.statut}` : '', domaine].filter(Boolean).join(', ')
|
||||
: [objet.nom_canonique, nomsPorteurs.join(', ')].filter(Boolean).join(', ')
|
||||
return {
|
||||
id: objet.id,
|
||||
kind: objet.nature,
|
||||
nom: objet.nom_canonique,
|
||||
resume: truncateOnWord(resume, 140),
|
||||
chips: echelles,
|
||||
chipsDimension: 'echelle',
|
||||
/** Badge non cliquable de la carte-fiche : la nature. */
|
||||
echelle: LIBELLES_NATURE[objet.nature],
|
||||
geoloc: true,
|
||||
etiquettes: {
|
||||
nature: [objet.nature],
|
||||
echelle: echelles,
|
||||
porteur: porteurs.map((p) => valeurPorteur(p.id)),
|
||||
couche: objet.couche ? [objet.couche] : [],
|
||||
},
|
||||
date: objet.date_original ?? undefined,
|
||||
texte: [objet.libelle_source, objet.credit, ...(objet.variantes ?? []), ...nomsPorteurs].filter(Boolean).join(' '),
|
||||
}
|
||||
}
|
||||
|
||||
/** Les fiches de la page : objets publiés, dans l'ordre du jeu. */
|
||||
export function fichesConnaissances(jeu: JeuConnaissances): MiniFiche[] {
|
||||
return [...lecture(jeu).rendus.values()].map((o) => toMiniConnaissance(o, jeu))
|
||||
}
|
||||
|
||||
/**
|
||||
* Nœuds et liens du graphe, depuis les seuls objets publiés et les relations publiées
|
||||
* entre eux (`renvoie_a` et les porteurs du registre restent hors du graphe : ils visent
|
||||
* une autre base). Aucune position ni degré : `GrapheConnaissances` les calcule, une fois.
|
||||
*/
|
||||
export function grapheConnaissances(jeu: JeuConnaissances): {
|
||||
noeuds: { id: string; libelle: string; kind: string }[]
|
||||
liens: { de: string; vers: string; type: string; provenance: string }[]
|
||||
} {
|
||||
const { rendus } = lecture(jeu)
|
||||
const liens = jeu.relations
|
||||
.filter((r) => estRendu(r) && r.type !== 'renvoie_a' && rendus.has(r.de) && rendus.has(r.vers))
|
||||
.map((r) => ({ de: r.de, vers: r.vers, type: r.type, provenance: r.provenance }))
|
||||
const noeuds = [...rendus.values()].map((o) => ({ id: o.id, libelle: o.nom_canonique, kind: o.nature }))
|
||||
return { noeuds, liens }
|
||||
}
|
||||
|
||||
export function useFicheAdapter() {
|
||||
return { toMini, toMiniMot, toMiniConnaissance }
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* useLeaflet — B4a-M2. Charge Leaflet une seule fois côté client et rend `L`.
|
||||
*
|
||||
* La séquence « import Leaflet, sa feuille, le plugin de cluster » vivait recopiée dans
|
||||
* quatre composants (NavMap, NavMapV2, OutremerMap, FicheDetail ; dette du socle perf du
|
||||
* 29/10). Elle vit ici : imports dynamiques (Leaflet reste hors du premier chargement),
|
||||
* promesses mémorisées au niveau du module (deux cartes montées ensemble ne chargent rien
|
||||
* deux fois), `window.L` posé AVANT le plugin (leaflet.markercluster lit `window.L` à son
|
||||
* chargement).
|
||||
*
|
||||
* const L = await useLeaflet({ cluster: true }) // carte à clusters
|
||||
* const L = await useLeaflet() // mini-carte, encart
|
||||
*
|
||||
* Côté serveur : la promesse est rejetée (une carte ne se monte que dans <ClientOnly> ou
|
||||
* `onMounted`).
|
||||
*/
|
||||
let base: Promise<any> | null = null
|
||||
let avecCluster: Promise<any> | null = null
|
||||
|
||||
async function chargerBase(): Promise<any> {
|
||||
const mod: any = await import('leaflet')
|
||||
const L = mod.default || mod
|
||||
await import('leaflet/dist/leaflet.css')
|
||||
return L
|
||||
}
|
||||
|
||||
async function chargerCluster(): Promise<any> {
|
||||
const L = await useLeaflet()
|
||||
await Promise.all([
|
||||
// @ts-ignore — feuilles du plugin, sans types
|
||||
import('leaflet.markercluster/dist/MarkerCluster.css'),
|
||||
// @ts-ignore
|
||||
import('leaflet.markercluster/dist/MarkerCluster.Default.css'),
|
||||
])
|
||||
;(window as any).L = L
|
||||
// @ts-ignore — étend L.MarkerClusterGroup en effet de bord
|
||||
await import('leaflet.markercluster')
|
||||
return L
|
||||
}
|
||||
|
||||
export function useLeaflet(options: { cluster?: boolean } = {}): Promise<any> {
|
||||
if (import.meta.server) return Promise.reject(new Error('useLeaflet : côté client seulement'))
|
||||
if (options.cluster) {
|
||||
avecCluster ??= chargerCluster().catch((e) => { avecCluster = null; throw e })
|
||||
return avecCluster
|
||||
}
|
||||
base ??= chargerBase().catch((e) => { base = null; throw e })
|
||||
return base
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* Convertit du Markdown Mistral en HTML avec inline styles.
|
||||
* Inline styles = zéro dépendance CSS, fonctionne dans tout contexte Vue (scoped, v-html, etc.)
|
||||
*/
|
||||
export function useMarkdown() {
|
||||
const S = {
|
||||
p: 'style="margin:0 0 0.45em;line-height:1.6;"',
|
||||
strong: 'style="font-weight:700;"',
|
||||
em: 'style="font-style:italic;"',
|
||||
h2: 'style="font-weight:700;display:block;margin-bottom:0.2em;"',
|
||||
h3: 'style="font-weight:700;display:block;font-size:0.95em;margin-bottom:0.15em;"',
|
||||
ul: 'style="margin:0.3em 0 0.3em 1.2em;padding:0;list-style:disc;"',
|
||||
li: 'style="margin-bottom:0.15em;"',
|
||||
a: 'style="text-decoration:underline;opacity:0.85;"',
|
||||
}
|
||||
|
||||
function render(text: string): string {
|
||||
if (!text) return ''
|
||||
let html = text
|
||||
.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
|
||||
.replace(/^### (.+)$/gm, `<strong ${S.h3}>$1</strong>`)
|
||||
.replace(/^## (.+)$/gm, `<strong ${S.h2}>$1</strong>`)
|
||||
.replace(/^# (.+)$/gm, `<strong ${S.h2}>$1</strong>`)
|
||||
.replace(/\*\*(.+?)\*\*/g, `<strong ${S.strong}>$1</strong>`)
|
||||
.replace(/\*(.+?)\*/g, `<em ${S.em}>$1</em>`)
|
||||
.replace(/^[-•]\s+(.+)$/gm, `<li ${S.li}>$1</li>`)
|
||||
.replace(/\[([^\]]+)\]\(([^)]+)\)/g, `<a href="$2" target="_blank" rel="noopener" ${S.a}>$1</a>`)
|
||||
|
||||
html = html.replace(/(<li[^>]*>.*<\/li>\n?)+/g, m => `<ul ${S.ul}>${m}</ul>`)
|
||||
html = html.replace(/\n{2,}/g, `</p><p ${S.p}>`)
|
||||
html = html.replace(/\n/g, '<br>')
|
||||
return `<p ${S.p}>${html}</p>`
|
||||
}
|
||||
|
||||
return { render }
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
/**
|
||||
* useVueFiches — B11-M1. L'état de la vue fiches, branché sur l'URL.
|
||||
*
|
||||
* L'URL est la source de vérité (SPEC-vue-fiches §5) : l'état se LIT dans
|
||||
* `route.query` (surveillée : un lien interne vers `?vue=fiches` depuis la même
|
||||
* page change l'écran) et s'ÉCRIT par `router.replace` (pas d'entrée
|
||||
* d'historique par clic de filtre). Seule la recherche a un tampon local, pour
|
||||
* ne pas perdre de lettres pendant la frappe : elle part dans l'URL 250 ms
|
||||
* après la dernière touche.
|
||||
*
|
||||
* La page crée l'état (elle en a besoin pour sa carte) et le passe tel quel à
|
||||
* `<VueFiches :vf="vf">`. Logique pure et tests : `utils/vueFiches.ts`,
|
||||
* `scripts/test-vue-fiches.mjs`.
|
||||
*/
|
||||
import type { MaybeRefOrGetter } from 'vue'
|
||||
import type { MiniFiche } from '~/composables/useFicheAdapter'
|
||||
import {
|
||||
lireQuery, ecrireQuery, filtresValides, filtrerFiches, compterEtiquettes,
|
||||
triEffectif, trierFiches, regrouper, ordreFiches, nbFiltresActifs,
|
||||
lireFiche, queryAvecFiche, positionFiche, modeOuverture, modeFermeture, empreinteListe,
|
||||
type ConfigVueFiches, type EtatFiches, type EtatVue, type TriFiches,
|
||||
} from '~/utils/vueFiches'
|
||||
|
||||
/** Largeur d'écran ; null avant le montage (SSR) : la CSS tranche alors seule. */
|
||||
export type Largeur = 'telephone' | 'tablette' | 'ordinateur' | null
|
||||
|
||||
const CLE_REPLI = 'aep_vue_fiches_liste_repliee'
|
||||
|
||||
/**
|
||||
* État rendu (logique pure, testée par `scripts/test-vue-fiches.mjs`). `auto` avant le
|
||||
* montage quand l'URL ne tranche pas (ou dit `mixte`) : la CSS rend Mixte à partir de
|
||||
* 1024 px et Fiches en dessous, sans saut à l'hydratation. Mixte n'existe pas sous 1024 px :
|
||||
* il se lit Fiches. B19b : `etatDefaut` (option de la page) tient lieu de `vue=` absent ;
|
||||
* sans lui, rien ne change. L'URL prime toujours.
|
||||
*/
|
||||
export function vueRendue(
|
||||
vue: EtatVue | null,
|
||||
etats: EtatVue[],
|
||||
largeur: Largeur,
|
||||
listeRepliee: boolean,
|
||||
etatDefaut: EtatVue | null = null,
|
||||
): EtatVue | 'auto' {
|
||||
const v = vue ?? (etatDefaut && etats.includes(etatDefaut) ? etatDefaut : null)
|
||||
// `auto` rend Mixte à partir de 1024 px : seulement pour une page qui a cet état
|
||||
if (largeur === null) return v && v !== 'mixte' ? v : etats.includes('mixte') ? 'auto' : 'fiches'
|
||||
const ordinateur = largeur === 'ordinateur'
|
||||
if (v === 'mixte' || v === null) {
|
||||
if (!ordinateur || !etats.includes('mixte')) return 'fiches'
|
||||
if (v === null && listeRepliee) return 'carte'
|
||||
return 'mixte'
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
/** Options de la page, hors configuration des filtres (B19b). */
|
||||
export interface OptionsVueFiches {
|
||||
/** État quand l'URL n'a pas de `vue=` (défaut : Mixte ou Fiches selon la largeur). */
|
||||
etatDefaut?: EtatVue
|
||||
}
|
||||
|
||||
export function useVueFiches(
|
||||
fiches: MaybeRefOrGetter<MiniFiche[]>,
|
||||
config: MaybeRefOrGetter<ConfigVueFiches>,
|
||||
options: OptionsVueFiches = {},
|
||||
) {
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const cfg = computed(() => toValue(config))
|
||||
|
||||
// ── Lecture ──
|
||||
const brut = computed(() => lireQuery(route.query, cfg.value))
|
||||
|
||||
const q = ref(brut.value.q)
|
||||
let qEcrit = q.value
|
||||
let minuteurQ: ReturnType<typeof setTimeout> | null = null
|
||||
watch(() => brut.value.q, (v) => {
|
||||
if (v !== qEcrit) { q.value = v; qEcrit = v }
|
||||
})
|
||||
|
||||
const etat = computed<EtatFiches>(() => ({
|
||||
...brut.value,
|
||||
q: q.value,
|
||||
filtres: filtresValides(brut.value.filtres, cfg.value),
|
||||
}))
|
||||
|
||||
// ── Écriture ──
|
||||
// La navigation est asynchrone : une query écrite n'est dans `route.query`
|
||||
// qu'au tick suivant. Deux écritures du même tick (« Voir sur la carte » :
|
||||
// Mixte, puis la sous-vue de la page) partent donc de la dernière query
|
||||
// écrite, sinon la seconde efface la première.
|
||||
let enAttente: Record<string, string> | null = null
|
||||
watch(() => route.query, () => { enAttente = null })
|
||||
const queryBase = () => enAttente ?? route.query
|
||||
function naviguer(query: Record<string, string>, mode: 'push' | 'replace' = 'replace') {
|
||||
enAttente = query
|
||||
if (mode === 'push') router.push({ query })
|
||||
else router.replace({ query })
|
||||
}
|
||||
function etatDepuis(base: Record<string, unknown>): EtatFiches {
|
||||
const b = lireQuery(base, cfg.value)
|
||||
return { ...b, q: q.value, filtres: filtresValides(b.filtres, cfg.value) }
|
||||
}
|
||||
|
||||
function ecrire(partiel: Partial<EtatFiches>) {
|
||||
const base = queryBase()
|
||||
const nouvel = { ...etatDepuis(base), ...partiel }
|
||||
qEcrit = nouvel.q
|
||||
if (minuteurQ && partiel.q === undefined) { clearTimeout(minuteurQ); minuteurQ = null }
|
||||
naviguer(ecrireQuery(nouvel, cfg.value, base))
|
||||
}
|
||||
|
||||
function setQ(v: string) {
|
||||
q.value = v
|
||||
if (minuteurQ) clearTimeout(minuteurQ)
|
||||
minuteurQ = setTimeout(() => { minuteurQ = null; ecrire({ q: v }) }, 250)
|
||||
}
|
||||
|
||||
function avecFiltre(dim: string, valeurs: string[]) {
|
||||
return { ...etat.value.filtres, [dim]: valeurs }
|
||||
}
|
||||
function toggle(dim: string, valeur: string) {
|
||||
const vals = etat.value.filtres[dim] ?? []
|
||||
ecrire({ filtres: avecFiltre(dim, vals.includes(valeur) ? vals.filter((v) => v !== valeur) : [...vals, valeur]) })
|
||||
}
|
||||
function ajouterFiltre(dim: string, valeur: string) {
|
||||
const vals = etat.value.filtres[dim] ?? []
|
||||
if (!vals.includes(valeur)) ecrire({ filtres: avecFiltre(dim, [...vals, valeur]) })
|
||||
}
|
||||
function effacerTout() {
|
||||
q.value = ''
|
||||
const vides: Record<string, string[]> = {}
|
||||
for (const d of cfg.value.dimensions) vides[d.cle] = []
|
||||
ecrire({ q: '', filtres: vides, sansAdresse: false })
|
||||
}
|
||||
const setTri = (tri: TriFiches) => ecrire({ tri })
|
||||
const setGroupe = (groupe: string | null) => ecrire({ groupe })
|
||||
const setSousVue = (sousVue: string) => ecrire({ sousVue })
|
||||
const setSansAdresse = (sansAdresse: boolean) => ecrire({ sansAdresse })
|
||||
|
||||
// ── Largeur et état affiché ──
|
||||
const largeur = ref<Largeur>(null)
|
||||
const listeRepliee = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
const mq768 = window.matchMedia('(min-width: 768px)')
|
||||
const mq1024 = window.matchMedia('(min-width: 1024px)')
|
||||
const maj = () => {
|
||||
largeur.value = mq1024.matches ? 'ordinateur' : mq768.matches ? 'tablette' : 'telephone'
|
||||
}
|
||||
maj()
|
||||
mq768.addEventListener('change', maj)
|
||||
mq1024.addEventListener('change', maj)
|
||||
onBeforeUnmount(() => {
|
||||
mq768.removeEventListener('change', maj)
|
||||
mq1024.removeEventListener('change', maj)
|
||||
})
|
||||
try { listeRepliee.value = sessionStorage.getItem(CLE_REPLI) === '1' } catch {}
|
||||
})
|
||||
|
||||
/** État rendu : `vueRendue`, ci-dessus. */
|
||||
const vueAffichee = computed<EtatVue | 'auto'>(() =>
|
||||
vueRendue(etat.value.vue, cfg.value.etats, largeur.value, listeRepliee.value, options.etatDefaut ?? null))
|
||||
|
||||
function setVue(v: EtatVue) {
|
||||
if (largeur.value === 'ordinateur' && (v === 'mixte' || v === 'carte')) {
|
||||
listeRepliee.value = v === 'carte'
|
||||
try { sessionStorage.setItem(CLE_REPLI, listeRepliee.value ? '1' : '0') } catch {}
|
||||
}
|
||||
ecrire({ vue: v })
|
||||
}
|
||||
|
||||
// ── Résultat ──
|
||||
const sansAdresseIgnore = computed(() => ({ ...etat.value, sansAdresse: false }))
|
||||
const filtrees = computed(() => filtrerFiches(toValue(fiches), etat.value, cfg.value))
|
||||
const tri = computed(() => triEffectif(etat.value, cfg.value))
|
||||
const resultat = computed(() => trierFiches(filtrees.value, tri.value, etat.value))
|
||||
const groupeDef = computed(() => cfg.value.groupes.find((g) => g.cle === etat.value.groupe) ?? null)
|
||||
const groupes = computed(() => regrouper(resultat.value, groupeDef.value, cfg.value))
|
||||
const ordre = computed(() => ordreFiches(groupes.value))
|
||||
const compteurs = computed(() => compterEtiquettes(toValue(fiches), etat.value, cfg.value))
|
||||
const idsResultat = computed(() => new Set(resultat.value.map((f) => String(f.id))))
|
||||
const nbSansAdresse = computed(() =>
|
||||
filtrerFiches(toValue(fiches), sansAdresseIgnore.value, cfg.value).filter((f) => !f.geoloc).length,
|
||||
)
|
||||
const total = computed(() => toValue(fiches).length)
|
||||
const nbActifs = computed(() => nbFiltresActifs(etat.value))
|
||||
|
||||
function voirSansAdresse() {
|
||||
ecrire({ sansAdresse: true, vue: 'fiches' })
|
||||
}
|
||||
|
||||
/** Fiche survolée (liste ↔ épingle) ; la carte de la page s'en sert, et peut l'écrire. */
|
||||
const survolId = ref<string | number | null>(null)
|
||||
|
||||
// ── Fiche ouverte (B12) : `fiche=` dans l'URL, lu aussi au rendu serveur ──
|
||||
const ficheId = computed(() => lireFiche(route.query))
|
||||
/** La fiche ouverte, cherchée dans TOUTES les fiches (elle peut être hors filtres). null = pas encore chargée ou inconnue. */
|
||||
const ficheOuverte = computed<MiniFiche | null>(() => {
|
||||
const id = ficheId.value
|
||||
return id == null ? null : toValue(fiches).find((f) => String(f.id) === id) ?? null
|
||||
})
|
||||
/** Rang dans l'ordre courant ; null = hors de vos filtres (ou pas de fiche). */
|
||||
const position = computed(() => positionFiche(ordre.value, ficheId.value))
|
||||
/**
|
||||
* Empreinte de la liste au moment où CETTE page a ajouté l'entrée
|
||||
* d'historique de la fiche ; null = fiche venue d'un lien partagé.
|
||||
*/
|
||||
let listeALOuverture: string | null = null
|
||||
|
||||
function ouvrirFiche(id: string | number) {
|
||||
if (String(id) === lireFiche(queryBase())) return
|
||||
const base = queryBase()
|
||||
const mode = modeOuverture(lireFiche(base))
|
||||
if (mode === 'push') listeALOuverture = empreinteListe(base)
|
||||
naviguer(queryAvecFiche(base, id), mode)
|
||||
}
|
||||
|
||||
function fermerFiche() {
|
||||
if (lireFiche(queryBase()) == null) return
|
||||
const mode = modeFermeture(listeALOuverture != null, listeALOuverture === empreinteListe(queryBase()))
|
||||
listeALOuverture = null
|
||||
if (mode === 'back') { enAttente = null; router.back() }
|
||||
else naviguer(queryAvecFiche(queryBase(), null))
|
||||
}
|
||||
|
||||
/** Étiquette cliquée dans le détail : ajoute le filtre ; `fermer` (téléphone) referme la fiche dans le même geste. */
|
||||
function filtrerDepuisFiche(dim: string, valeur: string, fermer: boolean) {
|
||||
const base = queryBase()
|
||||
const e = etatDepuis(base)
|
||||
const vals = e.filtres[dim] ?? []
|
||||
const filtres = vals.includes(valeur) ? e.filtres : { ...e.filtres, [dim]: [...vals, valeur] }
|
||||
const query = ecrireQuery({ ...e, filtres }, cfg.value, base)
|
||||
if (fermer) listeALOuverture = null
|
||||
naviguer(fermer ? queryAvecFiche(query, null) : query)
|
||||
}
|
||||
|
||||
// Retour arrière du navigateur (ou lien interne) : l'URL a perdu `fiche=`.
|
||||
watch(ficheId, (id) => { if (id == null) listeALOuverture = null })
|
||||
|
||||
const fichePrecedente = () => { if (position.value?.precedente) ouvrirFiche(position.value.precedente.id) }
|
||||
const ficheSuivante = () => { if (position.value?.suivante) ouvrirFiche(position.value.suivante.id) }
|
||||
|
||||
/**
|
||||
* « Voir sur la carte » : ordinateur → Mixte, la fiche reste ouverte ;
|
||||
* téléphone et tablette (pas de Mixte) → Carte, la fiche se ferme (elle
|
||||
* couvrirait la carte). La page lit `centrage` et centre son épingle.
|
||||
*/
|
||||
const centrage = ref<{ id: string; n: number } | null>(null)
|
||||
function voirSurCarte(id: string | number) {
|
||||
centrage.value = { id: String(id), n: (centrage.value?.n ?? 0) + 1 }
|
||||
if (largeur.value === 'ordinateur' && cfg.value.etats.includes('mixte')) {
|
||||
setVue('mixte')
|
||||
return
|
||||
}
|
||||
listeALOuverture = null
|
||||
const base = queryBase()
|
||||
naviguer(queryAvecFiche(ecrireQuery({ ...etatDepuis(base), vue: 'carte' }, cfg.value, base), null))
|
||||
}
|
||||
|
||||
return reactive({
|
||||
cfg, etat, q, largeur, vueAffichee, tri, resultat, groupes, ordre, compteurs,
|
||||
idsResultat, nbSansAdresse, total, nbActifs, survolId,
|
||||
ficheId, ficheOuverte, position, centrage,
|
||||
setVue, setQ, toggle, ajouterFiltre, effacerTout, setTri, setGroupe, setSousVue,
|
||||
setSansAdresse, voirSansAdresse,
|
||||
ouvrirFiche, fermerFiche, fichePrecedente, ficheSuivante, voirSurCarte, filtrerDepuisFiche,
|
||||
})
|
||||
}
|
||||
|
||||
export type VueFichesEtat = ReturnType<typeof useVueFiches>
|
||||
@@ -0,0 +1,91 @@
|
||||
# Couche de connaissances partagées : les fiches
|
||||
|
||||
Une fiche par objet de la couche (un concept, un texte, une organisation, un outil). Ce dossier est **la seule source** de la page `/connaissances` : le site le lit au build, rien d'autre. Ce fichier-ci est ignoré par le build.
|
||||
|
||||
## Corriger une phrase
|
||||
|
||||
Ouvrir la fiche (`cpt-holoptisme.md`), modifier le texte sous le second `---`, enregistrer. Rien d'autre à savoir : le build relit le dossier et vérifie tout. Si quelque chose ne va pas, le build s'arrête et nomme le fichier et la règle.
|
||||
|
||||
## Publier un texte long
|
||||
|
||||
Les textes longs naissent en `texte_etat: a_trier` : **ils ne s'affichent nulle part en public** tant que la ligne ne dit pas `publie`. Après relecture, remplacer `a_trier` par `publie` dans la fiche, c'est tout.
|
||||
|
||||
## La forme d'une fiche
|
||||
|
||||
Les sept lignes de la fiche (retour de Jules du 27/10), et le champ du schéma qui porte chacune :
|
||||
|
||||
| Ligne | Champ(s) du frontmatter |
|
||||
|---|---|
|
||||
| id | `id: cpt:holoptisme` (préfixe = nature : `cpt:` concept, `txt:` texte, `org:` organisation, `out:` outil ; c'est la cible des wikilinks) |
|
||||
| nom | `nom_canonique` |
|
||||
| variantes | `variantes` |
|
||||
| échelles | `echelles: [S, M]` (S, M, XL) |
|
||||
| sources | `extrait_de: ["[[txt:…]]"]` : au moins une, sinon un concept n'est pas publié |
|
||||
| relations | une clé par type : `condition_de`, `precise`, `recoupe`, `contredit`, `porte_par`, `republication_de`, `meme_objet_que`, `homonyme_de`, `renvoie_a` |
|
||||
| crédit | `credit`, `licence`, `dettes_non_creditees` (rendus dans « Crédit, licence et dettes », replié) |
|
||||
|
||||
Puis le texte, dans nos mots : **ce que ça dit, d'où ça vient, ce que ça change pour AEP**.
|
||||
|
||||
Longueur : 200 à 400 mots (forme de B19b-B). Exception depuis le 07/11 : les trois définitions AEP (matrice, pyramide, rhizome) vont jusqu'à 700 mots, sur la direction de Jules du 06/11 (des textes plus longs et problématisés). Le lot d'écriture des fiches en profondeur (⑦) redéfinit la borne et la forme pour toutes.
|
||||
|
||||
Exemple complet (les champs de `data/connaissances/schema.json`, mêmes noms) :
|
||||
|
||||
```markdown
|
||||
---
|
||||
id: cpt:holoptisme
|
||||
nature: concept
|
||||
nom_canonique: Holoptisme
|
||||
libelle_source: Holoptisme
|
||||
definition_courte: Chaque membre perçoit le tout et s’y ajuste.
|
||||
credit: Jean-François Noubel
|
||||
licence: CC BY-SA 4.0
|
||||
dettes_non_creditees: ["« panoptisme », pris à Foucault, dans un autre sens"]
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [S, M]
|
||||
porteur_ids: [org:holosapiens]
|
||||
extrait_de: ["[[txt:hs-holo-sapiens-fr]]", "[[txt:hs-economie-du-don]]"]
|
||||
condition_de: ["[[cpt:economie-du-don]]"]
|
||||
precise:
|
||||
- vers: "[[cpt:quatre-formes-ic]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
note: la forme originelle
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Un résumé de trois à cinq phrases, dans nos mots.
|
||||
|
||||
## D'où ça vient
|
||||
|
||||
La source, l'auteur, la date, en citant la fiche : [[txt:hs-holo-sapiens-fr]].
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
Deux à quatre phrases, et le lien avec les échelles S, M, XL de la fiche.
|
||||
```
|
||||
|
||||
## Les relations
|
||||
|
||||
- **Écrites dans la fiche d'origine seulement** (le côté « de ») : `cpt:holoptisme` dit `condition_de: ["[[cpt:economie-du-don]]"]`, la fiche de l'économie du don ne la répète pas, elle la lit d'elle-même (« a pour condition »). L'écrire des deux côtés arrête le build.
|
||||
- **Forme courte** `"[[cpt:x]]"` : la source l'énonce (`provenance: source`) et elle est publiée (`etat: publie`).
|
||||
- **Forme longue** quand il faut autre chose : `{ vers: "[[cpt:x]]", provenance: curation, etat: a_creuser, note: "…" }` (`curation` : c'est AEP qui la pose).
|
||||
- Un wikilink **dans le texte** (`[[cpt:economie-du-don]]`) devient un lien vers la fiche, avec son nom ; il ne crée **pas** de relation dans le graphe. `[[cpt:x|autre libellé]]` change le libellé.
|
||||
|
||||
## Les états
|
||||
|
||||
Même vocabulaire pour `etat` (l'objet), `texte_etat` (son texte long) et chaque relation : `en_file` (arrivé, pas encore vu) · `a_trier` (à relire) · `publie` (rendu en public) · `a_creuser` (dit, pas rendu comme lien) · `ecarte` (gardé, jamais rendu). Seul `publie` s'affiche. `texte_etat` absent = `publie`.
|
||||
|
||||
## Ce qui arrête le build
|
||||
|
||||
Un identifiant en double ; un wikilink (relation ou texte) vers un identifiant absent du dossier ; un concept publié sans `extrait_de` ; un champ qui n'est pas dans le schéma (ou un champ de rendu : position, couleur…) ; une relation écrite deux fois ou des deux côtés ; une date qui n'est pas au format `2026-10-12` ; une définition qui recopie plus de douze mots du libellé source ; du YAML illisible. Dans le texte : une image, ou un lien qui ne commence pas par `https:`, `http:`, `mailto:`, `/` ou `#`. Le HTML écrit dans le texte s'affiche tel quel, il n'est jamais exécuté.
|
||||
|
||||
## `_jeu.md`
|
||||
|
||||
Les champs du jeu : `version`, `licence_couche` (CC BY-SA 4.0, ne couvre pas les textes cités), `lot`, `note`, `fusions`, et `ordre`, l'ordre des fiches dans la page et le graphe. Une fiche nouvelle absente d'`ordre` vient après les autres, par nom de fichier : rien à faire pour l'ajouter.
|
||||
|
||||
## D'où viennent les fiches (Q5)
|
||||
|
||||
NocoDB reste la file d'entrée des propositions (`/proposer`, le worker de B20 y écrit en `en_file`). Le Markdown est la forme publiée : B20 écrira ici des fiches en `a_trier` depuis les lignes acceptées. Le vault n'est jamais lu par le code.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
version: 1
|
||||
licence_couche: CC BY-SA 4.0
|
||||
lot: lot 2 — premier graphe (CONCEPTION - couche connaissances partagees (12-10) §7 b)
|
||||
note: "Jeu de test B18. Six concepts lus dans les fiches Holosapiens du lot 2, trois nœuds AEP sourcés sur le deck public du 23/09/2026, l'homonyme d'Ansoff pour que homonyme_de ait deux bouts. Définitions dans nos mots ; de Holosapiens, seulement titres, URL et dates. État publie posé par B18 d'après §7 b, sans verdict humain objet par objet : le premier triage réel est celui de B20."
|
||||
ordre: [org:holosapiens, org:aep, txt:hs-holo-sapiens-fr, txt:hs-economie-du-don, txt:noubel-economie-du-don, txt:hs-modele-de-richesses, txt:hs-les-quatre-formes-ic, txt:hs-manifeste, txt:hs-signaux-faibles, txt:noubel-signaux-faibles, txt:hs-charte-editoriale, txt:hs-methodologie, txt:deck-aep-2026-09-23, txt:ansoff-1975, cpt:holoptisme, cpt:quatre-formes-ic, cpt:economie-du-don, cpt:architectures-invisibles, cpt:signaux-faibles-noubel, cpt:trois-statuts-enonce, cpt:matrice-aep, cpt:pyramide-aep, cpt:rhizome-aep, cpt:signaux-faibles-ansoff]
|
||||
fusions:
|
||||
- garder: cpt:signaux-faibles-noubel
|
||||
absorber: cpt:signaux-faibles-ansoff
|
||||
etat: refusee
|
||||
motif: "homonyme_de : même mot, autre auteur, autre sens"
|
||||
---
|
||||
|
||||
Les champs du jeu de la couche de connaissances : version, licence, lot, fusions, et l’ordre des fiches (une fiche absente de la liste vient après, par nom de fichier). Le mode d’emploi est dans README.md.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
id: cpt:architectures-invisibles
|
||||
nature: concept
|
||||
nom_canonique: Architectures invisibles
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Architectures invisibles
|
||||
definition_courte: Les structures qui orientent nos actes sans qu’on les voie.
|
||||
premiere_occurrence: txt:noubel-signaux-faibles
|
||||
date_original: 2013-03-14
|
||||
credit: Jean-François Noubel
|
||||
dettes_non_creditees: ["parenté avec Lessig, non prouvée"]
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de:
|
||||
- vers: "[[txt:hs-manifeste]]"
|
||||
provenance: source
|
||||
etat: a_creuser
|
||||
note: §IV
|
||||
- "[[txt:hs-signaux-faibles]]"
|
||||
recoupe:
|
||||
- vers: "[[cpt:matrice-aep]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
note: "Jules, 08/10 : « les deux mots », crédité"
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
L’argent, la langue, les codes, les récits, les lois : des structures qui orientent nos actes sans qu’on les voie, et qui gouvernent d’autant mieux qu’on ne les regarde pas. Le mot vient de l’architecture elle-même : en disposant les volumes, ce qu’on peut et ne peut pas faire, et les ambiances, un bâtiment décide en grande partie de la manière dont un groupe s’y comporte. Les architectures invisibles font la même chose à l’échelle d’une société. Les récits en sont un exemple : ce qu’une société tient pour évident s’inscrit dans les histoires qu’elle se raconte sur elle-même. La langue en est un autre : on ne voit bien que ce que l’on nomme.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
Le concept est de Jean-François Noubel. Il traverse les huit zones de recherche d’Holosapiens, de l’économie au langage, comme le fil qui les relie. La première occurrence relevée est l’article [[txt:hs-signaux-faibles]], du 14 mars 2013, repris par Holosapiens ; le manifeste d’Holosapiens y revient dans sa quatrième partie ([[txt:hs-manifeste]], à creuser). C’est le lexique d’Holosapiens qui fonde le terme sur l’architecture. Une parenté avec d’autres auteurs est possible mais non prouvée ; elle est dite dans le fond de la fiche.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
AEP nomme « matrice » ce qu’il lit de ces structures dans une société : la grille qui demande qui prend, qui décide et qui raconte. Jules garde les deux mots, en créditant Noubel ; le lien avec la [[cpt:matrice-aep]] est posé par AEP. L’échelle est XL : une architecture invisible se lit au niveau d’une société entière, et c’est là que le deck d’AEP place la contribution à de nouveaux récits. Le mot rappelle aussi qu’une structure se construit, donc qu’elle peut se construire autrement.
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
id: cpt:economie-du-don
|
||||
nature: concept
|
||||
nom_canonique: Économie du don
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Économie du don
|
||||
definition_courte: "Offrir sans contrepartie ni dette : ni échange, ni gratuité."
|
||||
premiere_occurrence: txt:noubel-economie-du-don
|
||||
date_original: 2015-08-08
|
||||
credit: Jean-François Noubel
|
||||
dettes_non_creditees: ["Mauss, écarté sans être nommé"]
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [S, M]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de:
|
||||
- "[[txt:hs-economie-du-don]]"
|
||||
- vers: "[[txt:hs-modele-de-richesses]]"
|
||||
provenance: source
|
||||
etat: a_creuser
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Donner, au sens de Noubel, c’est offrir sans contrepartie ni dette, mais jamais sans contexte : à qui, quoi, combien, pourquoi maintenant. « Gratuit » et « payant » sont des mots du marché, qui disent seulement si l’on paie ; le don se définit ailleurs. Celui qui reçoit ne rembourse pas : la gratitude répond au don sans l’acquitter, et se sentir en dette, c’est encore échanger. Le don est l’une des trois manières dont les richesses circulent, avec la prise et l’échange ; Noubel soutient même que c’est le don qui rend le marché possible, une thèse qu’il affirme plus qu’il ne la démontre.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
L’article « L’économie du don » de Jean-François Noubel date du 8 août 2015 ; Holosapiens le republie sous licence libre ([[txt:hs-economie-du-don]]), l’original de noubel.com restant à relever ([[txt:noubel-economie-du-don]]). Noubel vit lui-même au don depuis septembre 2011 : un test du sens avant d’accepter, l’open source comme condition, et une facture ordinaire si quelqu’un choisit de lui donner de l’argent. Il dit aussi ses limites : un horizon de deux ou trois semaines, aucune réserve. Il conteste le don et contre-don de Mauss, pour qui le retour fait le lien ; pour lui, un lien fondé sur la dette relève de l’échange. La dette envers Mauss, écarté sans être nommé en 2015, est dite dans le fond. Le [[txt:hs-modele-de-richesses]] d’Holosapiens reste à creuser.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
Le don ne tient qu’à l’échelle où chacun voit le tout : l’[[cpt:holoptisme]] en est la condition, Noubel l’écrit dès 2013. D’où un test avant tout prix libre ou toute participation consciente, à l’échelle M : chaque contributeur peut-il voir ce que coûte ce qu’il reçoit, et ce que produit ce qu’il donne ? Sinon, il faut d’abord le rendre visible, ou fixer un prix ; un prix fixe n’est pas une défaite. À l’échelle S, c’est une posture : clarifier le contexte avant de donner, et apprendre à recevoir sans se sentir en dette.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
id: cpt:holoptisme
|
||||
nature: concept
|
||||
nom_canonique: Holoptisme
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Holoptisme
|
||||
definition_courte: Chaque membre perçoit le tout et s’y ajuste.
|
||||
premiere_occurrence: null
|
||||
date_original: 2015-08-08
|
||||
credit: Jean-François Noubel
|
||||
dettes_non_creditees: ["« panoptisme », pris à Foucault, dans un autre sens"]
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [S, M]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:hs-holo-sapiens-fr]]", "[[txt:hs-economie-du-don]]"]
|
||||
condition_de: ["[[cpt:economie-du-don]]"]
|
||||
precise:
|
||||
- vers: "[[cpt:quatre-formes-ic]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
note: la forme originelle
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Un collectif fonctionne bien quand chacun de ses membres perçoit l’ensemble : ce qui se passe, ce qui manque, ce que son propre geste change. Il s’y ajuste en temps réel, et l’ensemble, en retour, perçoit chacun. Cette capacité est naturelle dans un petit groupe : le groupe de jazz, l’équipe de sport, le village. Elle se perd quand le groupe grandit : au-delà de quelques dizaines de personnes qui partagent un même lieu, le nombre et la distance la défont. Vient alors la vue d’en haut, celle de la pyramide, où le sommet voit l’ensemble sans le détail et la base le détail sans l’ensemble.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
Le mot est de Jean-François Noubel, qui l’emploie depuis les années 2000. Holosapiens le reprend dans le texte [[txt:hs-holo-sapiens-fr]] (4 octobre 2026) et dans l’article [[txt:hs-economie-du-don]] (2015), où Noubel en fait la condition du don. Le lexique d’Holosapiens le forme sur le grec *holos*, le tout, et *optikè*, voir. Pour les grands nombres, Noubel propose un « holoptisme augmenté » : un système d’information distribué qui dit ce qui existe, chez qui et en quelle quantité. C’est un programme, sans prototype publié. Le mot voisin, « panoptisme », change de sens d’un texte à l’autre ; la dette envers Foucault est dite dans le fond de la fiche.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
Une question à poser à chaque groupe, au codev comme au binôme : chaque membre voit-il le tout ? Qui fait quoi, ce qui manque, ce que son geste change. Si non, le groupe glisse vers la pyramide, où quelqu’un voit pour les autres, ou vers l’épuisement de ceux qui donnent sans voir où ça va. C’est d’abord l’échelle M, la communauté. C’est aussi l’échelle S : voir le tout s’apprend, comme le joueur qui lit le jeu autant que le ballon. Une limite à garder : un groupe qui voit tout, tout le temps, s’épuise aussi ; un dispositif qui donne à voir doit permettre de s’en retirer. L’holoptisme est la condition de l’[[cpt:economie-du-don]] et précise la forme originelle des [[cpt:quatre-formes-ic]].
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
id: cpt:matrice-aep
|
||||
nature: concept
|
||||
nom_canonique: Matrice (AEP)
|
||||
confiance: haute
|
||||
porteur_ids: [org:aep]
|
||||
libelle_source: Matrice
|
||||
definition_courte: "Un moule de société, décrit par trois questions : qui prend, qui décide, qui raconte."
|
||||
premiere_occurrence: txt:deck-aep-2026-09-23
|
||||
date_original: 2026-09-23
|
||||
credit: AEP, deck du 23/09/2026
|
||||
dettes_non_creditees: []
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: publie
|
||||
couche: socle
|
||||
echelles: [XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
note: "Relue et réécrite le 07/11 contre le deck de référence (v3.3 du 28/09) et sa déclinaison e-codev (23/10), lot ⑥ ; publiée sur la direction du 31/10 (④), Jules corrige à l’usage. La date est celle de la conférence ; les trois questions datent de la version de diffusion (v3.2 du 24/09, v3.3 du 28/09)."
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:deck-aep-2026-09-23]]"]
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Une matrice est un moule : elle donne forme à ce qui passe dedans sans qu’on la voie. Le deck d’AEP la décrit par trois questions à poser à toute société : qui prend, qui décide, qui raconte. Les trois réponses, ensemble, font une matrice.
|
||||
|
||||
L’empire en est une. Qui prend : l’apologie de la force, le plus fort prend et les ressources montent ; aujourd’hui, cela s’appelle l’offre et la demande, et 10 % de l’humanité possèdent 75 % de la richesse du monde. Qui décide : la même structure partout, de la famille au monde, la [[cpt:pyramide-aep]]. Qui raconte : tout est récit, la nation, l’argent, le droit, l’écran, jusqu’à la phrase qui clôt le débat, « il n’y a pas d’alternative ». De Rome à 2026, dit le deck, elle change d’habits, pas de nature.
|
||||
|
||||
Le [[cpt:rhizome-aep]] est l’autre matrice : les mêmes trois questions, d’autres réponses. Le besoin et la ressource au lieu de l’offre et la demande ; des polycentres au lieu de la même structure partout ; des récits qui se réécrivent au lieu de « il n’y a pas d’alternative ». On ne passe donc pas d’un système au vide : on change de matrice.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
La grille vient du deck de la conférence « Démonter la pyramide pour construire une forêt », Conférences de l’Intime n° 4, le 23 septembre 2026 ([[txt:deck-aep-2026-09-23]]), dans sa version de diffusion du 28 septembre. Le deck projeté ce soir-là rangeait déjà l’empire et le rhizome en trois briques, mais sans question commune : « la matrice » ne nommait que la première brique de l’empire, et le rhizome alignait la biorégion, les polycentres et les compétences psychosociales. La version de diffusion a posé les trois questions des deux côtés, et chaque brique a trouvé sa place : la biorégion est devenue l’échelle où le besoin et la ressource se voient, et les compétences psychosociales le moyen de réécrire les récits. Le mot « matrice » nomme depuis chaque colonne entière.
|
||||
|
||||
L’idée d’un empire qui n’a jamais pris fin vient de Philip K. Dick (« The Empire never ended »), reprise par Pacôme Thiellement dans *L’Empire n’a jamais pris fin* (Blast et Massot, 2024). Chaque question a ses appuis dans le deck : Simone Weil, *L’Iliade ou le poème de la force* (1940), et le World Inequality Report 2026 pour qui prend ; Héritier, Bourdieu et Passeron, le pape François et Nkrumah pour qui décide ; Harari, Mark Fisher et La Boétie pour qui raconte. Le mot rejoint les [[cpt:architectures-invisibles]] de Jean-François Noubel, les structures qu’on ne voit pas et qui organisent tout. Le lien est posé par AEP, qui garde les deux mots, crédités.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
La matrice sert à lire avant d’agir. Devant une institution, un projet ou un groupe, poser les trois questions : qui prend, qui décide, qui raconte. Les réponses disent dans quelle matrice on est, le plus souvent sans l’avoir choisie.
|
||||
|
||||
Son échelle est XL, la société. La déclinaison du deck pour la visio e-codev du 23 octobre l’appelle « le cadre de tout ça ». Le cadre pèse sur chacun et sur chaque groupe. En retour, chaque groupe qui change sa façon de faire change un peu le cadre : les trois échelles s’échangent dans les deux sens. Contribuer, dit le même deck, c’est savoir contre quoi on construit, et pour quoi.
|
||||
|
||||
Deux garde-fous. Une matrice fabrique ceux qui vivent dedans : le deck cite Rousseau, dans l’*Émile* (1762), à propos de la même structure partout, « un régime produit des types humains ». C’est pourquoi on la porte sans la voir. Et une autre matrice ne s’invente pas : « depuis Rome on n’invente rien, on choisit une filiation ». Le rhizome a toujours existé à côté de l’empire ; changer de matrice, c’est le remettre en avant.
|
||||
@@ -0,0 +1,48 @@
|
||||
---
|
||||
id: cpt:pyramide-aep
|
||||
nature: concept
|
||||
nom_canonique: Pyramide (AEP)
|
||||
confiance: haute
|
||||
porteur_ids: [org:aep]
|
||||
libelle_source: Pyramide
|
||||
definition_courte: "La forme de l’empire : la décision descend d’un sommet, la même dans chaque groupe."
|
||||
premiere_occurrence: txt:deck-aep-2026-09-23
|
||||
date_original: 2026-09-23
|
||||
credit: AEP, deck du 23/09/2026
|
||||
dettes_non_creditees: []
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: publie
|
||||
couche: socle
|
||||
echelles: [M, XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
note: "Relue et réécrite le 07/11 contre le deck de référence (v3.3 du 28/09) et sa déclinaison e-codev (23/10), lot ⑥ ; échelles M et XL (la déclinaison e-codev range l’empire en XL ; M est une lecture d’AEP, sur les étages famille, entreprise, école) ; publiée sur la direction du 31/10 (④), Jules corrige à l’usage."
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:deck-aep-2026-09-23]]"]
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
La pyramide est la forme de l’empire dans le deck d’AEP, sa réponse à la deuxième question de la [[cpt:matrice-aep]] : qui décide. La décision descend d’un sommet vers la base ; la déclinaison e-codev du deck ajoute qu’elle « vient toujours d’ailleurs, d’un autre que soi ». Et la même structure se répète à chaque étage de la vie :
|
||||
|
||||
- dans la famille, le patriarche sur la femme, sur les enfants : le patriarcat ;
|
||||
- dans l’entreprise et l’école, le patron et la direction sur les cadres et les profs, sur les salariés et les élèves : le classisme ;
|
||||
- dans l’Église, le pape sur les prêtres, sur les croyants : le cléricalisme ;
|
||||
- dans le monde, cinq vetos à l’ONU, le Nord sur le Sud : le néocolonialisme.
|
||||
|
||||
Le deck la résume en une ligne : « une monoculture verticale : elle centralise, extrait, concentre, creuse, dépossède ».
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
Le deck de la conférence du 23 septembre 2026 ([[txt:deck-aep-2026-09-23]]) appuie chaque étage sur une source : Françoise Héritier, *Masculin/Féminin* (1996), pour le patriarcat ; Pierre Bourdieu et Jean-Claude Passeron, *La Reproduction* (1970), pour le classisme ; le pape François, qui dénonce le cléricalisme en 2018 ; Kwame Nkrumah (1965) et l’article 27 de la Charte des Nations unies pour le néocolonialisme. Il cite Rousseau, dans l’*Émile* (1762) : un régime produit des types humains. La pyramide forme aussi les gens qui vivent dedans.
|
||||
|
||||
Le deck ajoute que l’empire, dont elle est la forme, est fragile, à deux endroits. Dans nos têtes : il ne tient que parce qu’on le porte. « Soyez résolus de ne servir plus, et vous voilà libres », écrivait Étienne de La Boétie vers 1548, dans le *Discours de la servitude volontaire*. Dans ses tuyaux : centralisé et à flux tendu, il flanche dès qu’un seul point cède. Si les camions s’arrêtent, les stations-service sont à sec en un à deux jours, les rayons vides en trois, l’eau potable coupée en deux à quatre semaines (American Trucking Associations, pour les États-Unis ; Servigne et Stevens, *Comment tout peut s’effondrer*, 2015).
|
||||
|
||||
La forme pyramidale des [[cpt:quatre-formes-ic]] de Noubel est une parenté, pas une source : le lien est posé par AEP.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
On ne renverse pas un sommet. Le deck propose de recâbler un point à la fois, comme une acupuncture du corps social : trouver le nœud, là où plusieurs problèmes n’en font qu’un, et y planter une aiguille, car un panorama ne pique rien. « Chacun son point. La même pyramide dessous. »
|
||||
|
||||
Les échelles de la fiche sont M et XL. XL, parce que la pyramide est la forme de l’empire, le cadre de la société ; la déclinaison e-codev du deck range tout ce module à cette échelle. M est une lecture d’AEP : les étages que le deck nomme, la famille, l’entreprise, l’école, sont les groupes où l’on passe ses journées. C’est là qu’un groupe peut choisir une autre forme. Le contraire de la pyramide, dans le deck, est le [[cpt:rhizome-aep]].
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: cpt:quatre-formes-ic
|
||||
nature: concept
|
||||
nom_canonique: Quatre formes d’intelligence collective
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Les quatre formes d’intelligence collective
|
||||
definition_courte: Essaim, originelle, pyramidale, holomidale.
|
||||
premiere_occurrence: null
|
||||
date_original: 2025-12-22
|
||||
credit: Jean-François Noubel, typologie de 2004
|
||||
dettes_non_creditees: ["Freeman, non crédité"]
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [M, XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:hs-les-quatre-formes-ic]]"]
|
||||
precise:
|
||||
- vers: "[[cpt:pyramide-aep]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
- vers: "[[cpt:rhizome-aep]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
renvoie_a:
|
||||
- vers: "[[registre:P2-18]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
note: la typologie vient du livre de 2004
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Il y a intelligence collective chaque fois qu’un groupe collabore pour un avantage à la fois individuel et collectif. Noubel en distingue quatre formes. L’essaim : la fourmilière, et chez l’humain la foule du métro. L’originelle : l’équipe, le groupe de jazz, le village, de cinq à quelques dizaines de personnes, bornée par le nombre et la distance. La pyramidale : l’État, l’armée, la grande entreprise, reconnaissable à quatre signatures, le pouvoir centralisé, les chaînes de commandement, la division du travail et la monnaie rare. L’holomidale : Wikipédia, Linux, Burning Man, des réseaux sans centre à grande échelle. Une même journée les traverse toutes : le métro, la tour de bureaux, la machine à café, le téléphone.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
La typologie est de Jean-François Noubel, posée dès son livre de 2004, *Intelligence collective, la révolution invisible*. Holosapiens la présente dans [[txt:hs-les-quatre-formes-ic]], une vidéo du 22 décembre 2025. Noubel y joint une histoire en trois sauts : l’oralité du petit groupe ; l’écriture, qui rend la pyramide possible parce qu’elle permet de compter, d’archiver et de commander à distance ; puis le réseau et les technologies distribuées, qui ouvrent l’holomidale. Ce qui est propre à Noubel, c’est l’idée que l’infrastructure précède la conscience : l’écriture a permis la pyramide, le réseau permet l’holomidale. Une dette non créditée est relevée dans le fond de la fiche.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
La grille donne des mots précis à ce que le deck d’AEP oppose. La forme pyramidale précise la [[cpt:pyramide-aep]] du deck, et l’holomidale son [[cpt:rhizome-aep]] ; pour la pyramide, Noubel est une parenté d’AEP, pas sa source, et les deux liens sont posés par AEP. À l’échelle M, la communauté, la forme originelle rappelle qu’un groupe qui tient repose sur l’[[cpt:holoptisme]] et sur une taille où chacun voit le tout. À l’échelle XL, la société, la question devient : qu’est-ce qui permettrait à l’holomidale de tenir là où la pyramide règne encore ?
|
||||
@@ -0,0 +1,49 @@
|
||||
---
|
||||
id: cpt:rhizome-aep
|
||||
nature: concept
|
||||
nom_canonique: Rhizome (AEP)
|
||||
confiance: haute
|
||||
porteur_ids: [org:aep]
|
||||
libelle_source: Rhizome
|
||||
definition_courte: Une organisation en réseau, sans sommet, à plusieurs centres emboîtés, structurée par des règles visibles.
|
||||
premiere_occurrence: txt:deck-aep-2026-09-23
|
||||
date_original: 2026-09-23
|
||||
credit: "AEP, deck du 23/09/2026 ; le mot : Gilles Deleuze et Félix Guattari"
|
||||
dettes_non_creditees: []
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: publie
|
||||
couche: socle
|
||||
echelles: [M, XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
note: "Relue et réécrite le 07/11 contre le deck de référence (v3.3 du 28/09) et sa déclinaison e-codev (23/10), lot ⑥ ; dette Deleuze et Guattari levée (crédités slide 09 de la v3.3) ; échelles M et XL ; publiée sur la direction du 31/10 (④), Jules corrige à l’usage."
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:deck-aep-2026-09-23]]"]
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Le rhizome est l’autre matrice du deck d’AEP : les mêmes trois questions que l’empire, d’autres réponses. Le deck le décrit comme « un réseau de racines qui parcourt la terre, échange, absorbe les chocs. Ni début ni fin, ni centre ni périphérie ». La forêt est l’image ; le rhizome est sa forme.
|
||||
|
||||
- Qui prend : le besoin et la ressource, ce qu’il faut et ce qu’il y a, au lieu de l’offre et la demande. À l’échelle où on le voit, la biorégion : un bassin, ses sols, ses savoir-faire ; ne déplacer que l’irremplaçable.
|
||||
- Qui décide : des polycentres, plusieurs centres emboîtés, aucun au-dessus. Horizontal, et structuré : des règles visibles, écrites par ceux qui les vivent.
|
||||
- Qui raconte : des récits qui se réécrivent. La compétition est un récit ; l’entraide est un besoin.
|
||||
|
||||
Un rhizome n’est donc pas l’absence de structure : c’est une structure horizontale. Sa [[cpt:matrice-aep]] répond point par point à celle de l’empire.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
Le mot vient de Gilles Deleuze et Félix Guattari, dans l’introduction de *Mille plateaux* (1980), que le deck de la conférence du 23 septembre 2026 ([[txt:deck-aep-2026-09-23]]) crédite. Chaque réponse a ses appuis dans le deck :
|
||||
|
||||
- le besoin et la ressource : Timothée Parrique, *Ralentir ou périr* (2022) ; la biorégion de Berg et Dasmann (1977), de Magnaghi (2014) et de Rollot (2018) ; et Édouard Glissant : « Agis dans ton lieu, pense avec le monde » ;
|
||||
- les polycentres : Elinor Ostrom, *Gouvernance des biens communs* (1990, traduit en 2010), et ses huit conditions : frontières claires, règles adaptées au lieu, ceux qui subissent écrivent, surveillance par les pairs, sanctions graduées, résolution des conflits, droit de s’organiser, unités emboîtées. Le deck cite des communs européens qui durent depuis des siècles, les pâturages de Törbel en Suisse depuis 1483, le Tribunal des eaux de Valence, attesté en 1435. Et Jo Freeman, *La tyrannie de l’absence de structure* (1972) : un groupe « sans structure » en a toujours une, cachée, donc sans recours ;
|
||||
- les récits : Pierre Kropotkine, *L’Entraide* (1902), qui voit en Sibérie survivre celui qui coopère, quand « le plus fort survit » est de Spencer, pas de Darwin ; Servigne et Chapelle (2017) ; et les compétences psychosociales de l’OMS (1993), parce que l’entraide s’apprend, en groupe.
|
||||
|
||||
Le deck rappelle aussi que le rhizome a toujours existé : les gnostiques du IIe siècle, sans seigneur, aux prêtres tirés au sort ; les cathares du XIIe, sans hiérarchie ; la Commune de 1871, soixante-douze jours de gouvernement direct (Thiellement ; Simone Weil, lettre à Déodat Roché, 1941). Aujourd’hui, Porto Alegre (1989), Marinaleda (1979) et le Rojava (2012) ; la déclinaison pour la visio e-codev du 23 octobre ajoute Cherán, au Mexique (2011). Le lien avec la forme holomidale des [[cpt:quatre-formes-ic]] de Noubel est posé par AEP.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
AEP essaie d’en être un. La déclinaison e-codev du deck décrit le projet comme un réseau de réseaux, des cercles et pas une pyramide : chaque groupe sa recette et son rythme, aucun au-dessus d’un autre ; au cœur, AEP soutient et propose, il ne décide pas ; ce qui circule, ce sont des besoins, des recettes, des ressources, pas des ordres. Les échelles de la fiche sont M, la communauté, où l’entraide se pratique, comme dans le codev, et XL, la société, où le rhizome répond à l’empire.
|
||||
|
||||
Deux fragilités. Les exemples d’aujourd’hui ne sont pas acquis, la déclinaison e-codev le précise : le budget participatif de Porto Alegre est suspendu en 2017, le Rojava repasse sous le contrôle de Damas en 2026. Elle le dit en une phrase : « Écrasé, il repousse ailleurs. » Et l’horizontal a son piège, celui que nomme Freeman : un groupe qui refuse toute structure en fabrique une, cachée. D’où l’insistance du deck sur des règles visibles, écrites par ceux qui les vivent. Le contraire du rhizome, dans le deck, est la [[cpt:pyramide-aep]].
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
id: cpt:signaux-faibles-ansoff
|
||||
nature: concept
|
||||
nom_canonique: Signaux faibles (Ansoff)
|
||||
confiance: moyenne
|
||||
porteur_ids: []
|
||||
libelle_source: weak signals
|
||||
definition_courte: Des indices précoces et ambigus d’un changement, à guetter pour ne pas être pris de court.
|
||||
premiere_occurrence: txt:ansoff-1975
|
||||
homonymes: [cpt:signaux-faibles-noubel]
|
||||
date_original: "1975"
|
||||
credit: H. Igor Ansoff
|
||||
dettes_non_creditees: []
|
||||
licence: CC BY-SA 4.0
|
||||
etat: a_trier
|
||||
couche: socle
|
||||
echelles: []
|
||||
provenance:
|
||||
lot: lot 2
|
||||
note: Posé par B18 pour que homonyme_de ait deux bouts ; publication au triage.
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de:
|
||||
- vers: "[[txt:ansoff-1975]]"
|
||||
provenance: source
|
||||
etat: a_trier
|
||||
---
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
id: cpt:signaux-faibles-noubel
|
||||
nature: concept
|
||||
nom_canonique: Signaux faibles (Noubel)
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Les signaux faibles
|
||||
definition_courte: La croissance continue que l’attention aux ruptures ne perçoit pas.
|
||||
premiere_occurrence: txt:noubel-signaux-faibles
|
||||
homonymes: [cpt:signaux-faibles-ansoff]
|
||||
date_original: 2013-03-14
|
||||
credit: Jean-François Noubel
|
||||
dettes_non_creditees: [maxime proverbiale]
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [XL]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:hs-signaux-faibles]]"]
|
||||
homonyme_de:
|
||||
- vers: "[[cpt:signaux-faibles-ansoff]]"
|
||||
provenance: curation
|
||||
etat: publie
|
||||
note: "même mot, autre auteur, autre sens : la fusion est refusée"
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Chez Noubel, le signal faible n’est pas l’indice précoce d’une rupture qui vient. C’est ce qui pousse en continu, sans bruit, et que notre attention ne perçoit pas parce qu’elle est réglée sur les événements. Un proverbe le dit : un arbre qui tombe fait plus de bruit qu’une forêt qui pousse. Les récits que l’on se raconte sont faits d’une suite de signaux forts et laissent hors champ la croissance lente. Noubel en tire une conclusion d’action : « le monde de demain ne naîtra pas de nos réactions, il naîtra de nos créations ».
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
L’article « Les signaux faibles » de Jean-François Noubel date du 14 mars 2013. Holosapiens le republie sous licence libre ([[txt:hs-signaux-faibles]]) ; l’original de noubel.com reste à relever ([[txt:noubel-signaux-faibles]]). La phrase sur la réaction et la création y reprend une ligne de son « Vœu de richesse » de 2009. Le même mot désigne autre chose chez Igor Ansoff, en 1975 : des indices précoces et ambigus d’un changement, à guetter pour ne pas être pris de court. Les deux concepts sont des homonymes ; la fiche [[cpt:signaux-faibles-ansoff]] existe pour que leur fusion soit refusée.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
Le deck d’AEP s’intitule « Démonter la pyramide pour construire une forêt ». Les signaux faibles mettent en garde contre la première moitié du titre : l’arbre qui tombe attire l’attention, la forêt qui pousse fait le travail. Un récit qui s’arrêterait à démonter resterait dans la réaction. À l’échelle XL, celle de la société, le concept invite à chercher et à raconter ce qui pousse déjà, plutôt que ce qui s’effondre ; le deck finit d’ailleurs sur la phrase du vœu, créditée à Noubel. Les [[cpt:architectures-invisibles]] ont leur première occurrence relevée dans le même article de 2013.
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
id: cpt:trois-statuts-enonce
|
||||
nature: concept
|
||||
nom_canonique: Trois statuts d’énoncé
|
||||
confiance: haute
|
||||
porteur_ids: [org:holosapiens]
|
||||
libelle_source: Trois statuts d’énoncé
|
||||
definition_courte: "Trois statuts d’énoncé : observation, hypothèse, expérience vécue."
|
||||
premiere_occurrence: null
|
||||
date_original: 2026-10-07
|
||||
credit: Holosapiens
|
||||
dettes_non_creditees: ["« f-prime », d’après l’E-Prime, auteurs non nommés"]
|
||||
note: "Libellé de la source non relevé : celui de la fiche du lot 2."
|
||||
licence: CC BY-SA 4.0
|
||||
etat: publie
|
||||
texte_etat: a_trier
|
||||
couche: socle
|
||||
echelles: [M]
|
||||
provenance:
|
||||
lot: lot 2
|
||||
# Relations : écrites dans la fiche d’origine seulement ; la fiche d’arrivée les lit d’elle-même.
|
||||
extrait_de: ["[[txt:hs-charte-editoriale]]", "[[txt:hs-methodologie]]"]
|
||||
---
|
||||
|
||||
## Ce que ça dit
|
||||
|
||||
Une règle de rigueur pour écrire et parler : chaque énoncé dit de quel statut il relève. Une observation, c’est ce qui a été constaté. Une hypothèse, c’est ce qu’on avance sans l’avoir établi. Une expérience vécue, c’est ce qu’on rapporte de l’intérieur, à la première personne. Les trois ont leur place ; ce que la règle demande, c’est de ne pas les confondre. Holosapiens l’applique à ses propres textes : sa thèse d’une évolution qui suivrait une direction y est présentée comme une hypothèse, et dite telle.
|
||||
|
||||
## D’où ça vient
|
||||
|
||||
La règle vient de deux pages d’Holosapiens, sa [[txt:hs-charte-editoriale]] et sa [[txt:hs-methodologie]]. Aucune des deux n’affiche de date ; elles étaient en ligne le 7 octobre 2026. Le libellé exact de la source n’a pas été relevé : le nom de cette fiche est celui du premier lot de curation. La règle s’inscrit dans le perspectivisme d’Holosapiens, l’idée qu’il n’y a que des points de vue et qu’on les additionne. Elle a une cousine dans la langue, le f-prime, qui parle sans le verbe « être » et nomme l’observateur : « Joséphine est timide » devient « je la trouve timide ». Tout le site est écrit ainsi. Le f-prime dérive de l’E-Prime, dont les auteurs ne sont pas nommés ; la dette est dite dans le fond de la fiche.
|
||||
|
||||
## Ce que ça change pour AEP
|
||||
|
||||
C’est une méthode plus qu’un concept, un cas limite de nature que la curation laisse à un humain le soin de trancher. La couche de connaissances d’AEP pratique déjà une règle voisine : chaque relation dit si la source l’énonce ou si AEP la pose, et chaque définition est signalée comme écrite par AEP, dans ses mots. L’échelle de la fiche est M : dans un groupe, la règle invite à nommer qui observe, qui suppose et qui témoigne de son vécu.
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
id: org:aep
|
||||
nature: organisation
|
||||
nom_canonique: AEP
|
||||
confiance: haute
|
||||
url_canonique: https://aep.trans-former.fr
|
||||
urls_vues: [https://aep.trans-former.fr]
|
||||
porteur_ids: []
|
||||
statut: vivant
|
||||
methode_saisie: manuelle
|
||||
licence: null
|
||||
credit: AEP
|
||||
etat: publie
|
||||
couche: socle
|
||||
provenance:
|
||||
lot: lot 2
|
||||
---
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user