feat(entree): SchemaEchelles, le schéma S / M / XL en SVG déclaratif (B13-M2)
Port de drawEchelles (deck v3.3, slide 16) dans le template : rendu côté serveur, présent au premier affichage, aucune construction en onMounted. Anneaux en couronnes evenodd (une cible de pointeur par échelle, au moins 45 px d'épaisseur à 328 px de large), bleu nuit à 60 %, safran au survol et sur la porte ouverte (parti 2). - `taille="grand"` : figure + trois portes en liens HTML (lettre, titre, accroche de la slide 16) ; noms et arcs « ce qui sort / ce qui revient » gardés dans le SVG à partir de 1 024 px seulement. Ouvrir = push. - `taille="mini"` : barre au téléphone (retour au schéma + S M XL), colonne à partir de 1 024 px ; passer d'une porte à l'autre = replace. - Survol ou focus d'un anneau allume sa porte, et l'inverse. Au clavier, ce sont les liens qui agissent ; le SVG est une image décrite (grand) ou décoratif (mini). Retour au schéma = vrai lien (href), géré par la page. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JRiXG2Re6g7mF9c85FemTB
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
384297c795
commit
fa2a48157e
@@ -0,0 +1,485 @@
|
||||
<!--
|
||||
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). Noms et 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, les portes HTML les remplacent. Ouvrir une porte = `push`.
|
||||
taille="mini" (porte ouverte) : barre collante au téléphone (retour au schéma + S M XL),
|
||||
colonne à partir de 1 024 px (retour, figure réduite, portes titrées). 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>
|
||||
<component
|
||||
:is="taille === 'mini' ? 'nav' : 'div'"
|
||||
class="schema"
|
||||
:class="`schema--${taille}`"
|
||||
:aria-label="taille === 'mini' ? 'Portes S, M, XL' : undefined"
|
||||
@mouseleave="survol = null"
|
||||
>
|
||||
<div v-if="$slots.avant" class="schema__avant"><slot name="avant" /></div>
|
||||
|
||||
<a
|
||||
v-if="taille === 'mini'"
|
||||
:href="hrefSchema"
|
||||
class="schema__fermer"
|
||||
@click.prevent="emit('fermer')"
|
||||
>
|
||||
<svg class="schema__fermer-icone" viewBox="0 0 40 40" aria-hidden="true" focusable="false">
|
||||
<circle
|
||||
v-for="(r, id) in ICONE"
|
||||
:key="id"
|
||||
cx="20"
|
||||
cy="20"
|
||||
:r="r"
|
||||
:class="{ 'schema__fermer-actif': actif === id }"
|
||||
/>
|
||||
</svg>
|
||||
<span class="schema__fermer-texte">Revenir au schéma</span>
|
||||
</a>
|
||||
|
||||
<svg
|
||||
class="schema__figure"
|
||||
:viewBox="`0 0 ${SCHEMA_L} ${SCHEMA_H}`"
|
||||
:role="taille === 'grand' ? 'img' : undefined"
|
||||
:aria-label="taille === 'grand' ? description : undefined"
|
||||
:aria-hidden="taille === 'mini' ? '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"
|
||||
: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="22"
|
||||
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>
|
||||
|
||||
<ul class="schema__portes">
|
||||
<li v-for="id in ORDRE_ECHELLES" :key="id">
|
||||
<NuxtLink
|
||||
:to="lienPorte(id)"
|
||||
:replace="taille === 'mini'"
|
||||
class="schema__porte"
|
||||
:class="{ 'schema__porte--survol': survol === id, 'schema__porte--actif': actif === id }"
|
||||
:aria-current="actif === id ? 'true' : undefined"
|
||||
: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 v-if="taille === 'grand'" class="schema__porte-accroche">{{ ECHELLES[id].accroche }}</span>
|
||||
</span>
|
||||
<span v-if="taille === 'grand'" class="schema__porte-fleche" aria-hidden="true">›</span>
|
||||
</NuxtLink>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div v-if="$slots.apres" class="schema__apres"><slot name="apres" /></div>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useId } from '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,
|
||||
type ArcFlux, type SensFlux,
|
||||
} from '~/utils/figures'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
taille: 'grand' | 'mini'
|
||||
/** Porte ouverte (mini) : son anneau et son lien en safran. */
|
||||
actif?: EchelleId | null
|
||||
}>(), { actif: null })
|
||||
|
||||
const emit = defineEmits<{ fermer: [] }>()
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const uid = useId()
|
||||
|
||||
const anneaux = anneauxEchelles()
|
||||
const arcs = arcsFlux()
|
||||
const legende = legendeFlux()
|
||||
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 ICONE: Record<EchelleId, number> = { XL: 18, M: 12, S: 6 }
|
||||
|
||||
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. */
|
||||
const description = (() => {
|
||||
const anneauxTxt = ORDRE_ECHELLES.map((id) => `${id}, ${nomAnneau(id)}`).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}. ${flux('S', 'S et M')} ${flux('M', 'M et XL')}`
|
||||
})()
|
||||
|
||||
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) {
|
||||
if (props.taille === 'mini' && props.actif === id) return
|
||||
navigateTo(lienPorte(id), { replace: props.taille === 'mini' })
|
||||
}
|
||||
|
||||
// Points d'accroche du mouvement (B13-M6) : rien en M2.
|
||||
const styleAnneau = (_rang: number) => undefined
|
||||
const styleLettre = (_rang: number) => undefined
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ── Commun ────────────────────────────────────────────────────────────── */
|
||||
.schema__figure {
|
||||
display: block;
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.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 {
|
||||
display: none;
|
||||
fill: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
.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,
|
||||
.schema__porte--actif .schema__porte-lettre {
|
||||
background: var(--accent);
|
||||
color: var(--on-accent);
|
||||
}
|
||||
.schema__porte--actif {
|
||||
border-color: var(--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__figure {
|
||||
grid-area: figure;
|
||||
justify-self: center;
|
||||
width: 100%;
|
||||
max-width: 27.5rem;
|
||||
}
|
||||
.schema--grand .schema__portes { grid-area: portes; }
|
||||
.schema--grand .schema__apres { grid-area: apres; }
|
||||
|
||||
@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__figure { max-width: 604px; }
|
||||
.schema--grand .schema__nom,
|
||||
.schema--grand .schema__flux,
|
||||
.schema--grand .schema__legende { display: inline; }
|
||||
}
|
||||
|
||||
/* ── Mini : la porte ouverte ───────────────────────────────────────────── */
|
||||
.schema--mini {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
.schema--mini .schema__figure { display: none; }
|
||||
.schema--mini .schema__portes {
|
||||
flex-direction: row;
|
||||
gap: 4px;
|
||||
}
|
||||
.schema--mini .schema__porte {
|
||||
justify-content: center;
|
||||
min-width: 44px;
|
||||
padding: 0 var(--space-xs);
|
||||
}
|
||||
.schema--mini .schema__porte-lettre {
|
||||
min-width: 2rem;
|
||||
}
|
||||
/* Au téléphone, la lettre seule ; le titre reste lu par les lecteurs d'écran. */
|
||||
.schema--mini .schema__porte-titre,
|
||||
.schema__fermer-texte {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.schema__fermer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--space-xs);
|
||||
min-width: 44px;
|
||||
min-height: 44px;
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text);
|
||||
font-size: var(--fs-sm);
|
||||
font-weight: var(--fw-semibold);
|
||||
text-decoration: none;
|
||||
}
|
||||
.schema__fermer:hover { background: var(--bg-alt); }
|
||||
.schema__fermer:focus-visible {
|
||||
outline: 2px solid var(--focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
.schema__fermer-icone {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
overflow: visible;
|
||||
}
|
||||
.schema__fermer-icone circle {
|
||||
fill: color-mix(in srgb, var(--nav-primary-solid) 6%, transparent);
|
||||
stroke: color-mix(in srgb, var(--nav-primary-solid) 60%, transparent);
|
||||
stroke-width: 1.5px;
|
||||
}
|
||||
.schema__fermer-icone .schema__fermer-actif {
|
||||
fill: color-mix(in srgb, var(--accent) 35%, transparent);
|
||||
stroke: var(--accent);
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.schema--mini {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: var(--space-md);
|
||||
}
|
||||
.schema--mini .schema__fermer {
|
||||
justify-content: flex-start;
|
||||
padding: 0 var(--space-xs);
|
||||
}
|
||||
.schema--mini .schema__fermer-icone { display: none; }
|
||||
.schema--mini .schema__fermer-texte,
|
||||
.schema--mini .schema__porte-titre {
|
||||
position: static;
|
||||
width: auto;
|
||||
height: auto;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
clip: auto;
|
||||
white-space: normal;
|
||||
}
|
||||
.schema--mini .schema__fermer-texte::before {
|
||||
content: "← " / "";
|
||||
}
|
||||
.schema--mini .schema__figure {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 15rem;
|
||||
align-self: center;
|
||||
}
|
||||
.schema--mini .schema__portes { flex-direction: column; }
|
||||
.schema--mini .schema__porte {
|
||||
justify-content: flex-start;
|
||||
padding: var(--space-xs) var(--space-sm);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.schema__zone,
|
||||
.schema__trait,
|
||||
.schema__porte,
|
||||
.schema__porte-lettre { transition: none; }
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user