feat(entree): ouvrir une porte déplie la section dans la continuité (B13b-M2)
Le grand schéma reste à l'écran quand une porte s'ouvre (prop reduit). Téléphone : la figure passe à 40 % (280 ms), titre, portes et phrase se replient (grid-template-rows 1fr → 0fr), le bandeau et la section se déplient dessous. Bureau : la figure glisse vers la colonne de gauche en se réduisant (FLIP mesuré avant le rendu, transform seul, 350 ms), la section se déplie à droite. Fermer inverse le geste. Figure réduite : anneaux et lettres seuls, bandeaux arrêtés, anneaux en replace. URL, useEntree, fermeturePorte, latéral (±24 %, 280 ms) inchangés ; reduced motion : état final. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MYkaR9gSetC8qKAowoMKpM
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4cda84c581
commit
6d7c97f2a5
@@ -16,9 +16,15 @@
|
||||
<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).
|
||||
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).
|
||||
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) : le bandeau des portes S M XL, 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
|
||||
@@ -28,11 +34,12 @@
|
||||
<component
|
||||
:is="taille === 'mini' ? 'nav' : 'div'"
|
||||
class="schema"
|
||||
:class="[`schema--${taille}`, { 'schema--apparition': joueApparition }]"
|
||||
:class="[`schema--${taille}`, { 'schema--apparition': joueApparition, 'schema--reduit': taille === 'grand' && reduit }]"
|
||||
:aria-label="taille === 'mini' ? 'Portes S, M, XL' : undefined"
|
||||
@mouseleave="survol = null"
|
||||
>
|
||||
<div v-if="$slots.avant" class="schema__avant"><slot name="avant" /></div>
|
||||
<!-- 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>
|
||||
|
||||
<a
|
||||
v-if="taille === 'mini'"
|
||||
@@ -53,13 +60,22 @@
|
||||
<span class="schema__fermer-texte">Revenir au schéma</span>
|
||||
</a>
|
||||
|
||||
<!-- 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="taille === 'grand' ? 'img' : undefined"
|
||||
:aria-label="taille === 'grand' ? description : undefined"
|
||||
:aria-hidden="taille === 'mini' ? 'true' : undefined"
|
||||
:role="reduit ? undefined : 'img'"
|
||||
:aria-label="reduit ? undefined : description"
|
||||
:aria-hidden="reduit ? 'true' : undefined"
|
||||
focusable="false"
|
||||
>
|
||||
<g
|
||||
@@ -82,6 +98,7 @@
|
||||
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"
|
||||
@@ -163,31 +180,53 @@
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<ul class="schema__portes">
|
||||
<!-- 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>
|
||||
|
||||
<ul v-if="taille === 'mini'" class="schema__portes">
|
||||
<li v-for="id in ORDRE_ECHELLES" :key="id">
|
||||
<NuxtLink
|
||||
:to="lienPorte(id)"
|
||||
:replace="taille === 'mini'"
|
||||
replace
|
||||
class="schema__porte"
|
||||
:class="{ 'schema__porte--survol': survol === id, 'schema__porte--actif': actif === id }"
|
||||
:class="{ '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>
|
||||
<div v-if="$slots.apres" class="schema__plie schema__apres"><div class="schema__plie-dedans"><slot name="apres" /></div></div>
|
||||
</component>
|
||||
</template>
|
||||
|
||||
@@ -214,7 +253,12 @@ const props = withDefaults(defineProps<{
|
||||
* sans effet sous `prefers-reduced-motion` ou si `html.entree-vue` est posé.
|
||||
*/
|
||||
apparition?: boolean
|
||||
}>(), { actif: null, apparition: false })
|
||||
/**
|
||||
* 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: [] }>()
|
||||
|
||||
@@ -304,8 +348,10 @@ const lienPorte = (id: EchelleId) => ({ path: route.path, query: queryPorte(id)
|
||||
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' })
|
||||
// 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).
|
||||
@@ -330,6 +376,21 @@ const styleLettre = (rang: number) =>
|
||||
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;
|
||||
@@ -529,15 +590,70 @@ const styleLettre = (rang: number) =>
|
||||
margin-inline: auto;
|
||||
}
|
||||
.schema--grand .schema__avant { grid-area: avant; }
|
||||
.schema--grand .schema__figure {
|
||||
.schema--grand .schema__fig {
|
||||
grid-area: figure;
|
||||
justify-self: center;
|
||||
width: 100%;
|
||||
max-width: 27.5rem;
|
||||
}
|
||||
.schema--grand .schema__portes { grid-area: portes; }
|
||||
.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(14px);
|
||||
}
|
||||
|
||||
@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;
|
||||
@@ -551,7 +667,50 @@ const styleLettre = (rang: number) =>
|
||||
}
|
||||
.schema--grand .schema__avant { align-self: end; }
|
||||
.schema--grand .schema__apres { align-self: start; }
|
||||
.schema--grand .schema__figure { max-width: 604px; }
|
||||
.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 */
|
||||
@@ -639,12 +798,8 @@ const styleLettre = (rang: number) =>
|
||||
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,
|
||||
/* Le retour est porté par le grand schéma réduit, en tête de colonne. */
|
||||
.schema--mini .schema__fermer { display: none; }
|
||||
.schema--mini .schema__porte-titre {
|
||||
position: static;
|
||||
width: auto;
|
||||
@@ -654,15 +809,6 @@ const styleLettre = (rang: number) =>
|
||||
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;
|
||||
@@ -675,7 +821,16 @@ const styleLettre = (rang: number) =>
|
||||
.schema__trait,
|
||||
.schema__porte,
|
||||
.schema__porte-lettre,
|
||||
.schema__fermer-icone circle { transition: none; }
|
||||
.schema__fermer-icone circle,
|
||||
.schema--grand,
|
||||
.schema__lettre,
|
||||
.schema__fig,
|
||||
.schema__avant,
|
||||
.schema__apres,
|
||||
.schema__nom,
|
||||
.schema__bandeau,
|
||||
.schema__mots-s,
|
||||
.schema__pause { transition: none; }
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -723,7 +878,9 @@ const styleLettre = (rang: number) =>
|
||||
animation: aep-mot-s 17.5s linear infinite;
|
||||
}
|
||||
.schema__figure--fige .schema__tour,
|
||||
.schema__figure--fige .schema__mot-s {
|
||||
.schema__figure--fige .schema__mot-s,
|
||||
.schema--reduit .schema__tour,
|
||||
.schema--reduit .schema__mot-s {
|
||||
animation-play-state: paused;
|
||||
}
|
||||
@keyframes aep-schema-tour-horaire {
|
||||
|
||||
+145
-43
@@ -1,20 +1,32 @@
|
||||
<!--
|
||||
/entree — B13-M5. L'entrée du site par le schéma S / M / XL (CONCEPTION du 11/10).
|
||||
/entree — B13-M5, B13b-M2. L'entrée du site par le schéma S / M / XL (CONCEPTION du 11/10).
|
||||
Une page, trois états, l'URL fait foi (`?porte=`) :
|
||||
0 · schéma : les trois anneaux, la phrase de la slide 16, trois portes ;
|
||||
1 · porte ouverte : mini-schéma collant + la section de l'échelle ;
|
||||
1 · porte ouverte : le schéma reste, réduit, le bandeau S M XL, la section de l'échelle ;
|
||||
1' · latéral : d'une porte à l'autre, en `replace`.
|
||||
Au clavier, porte ouverte : ← et → passent aux voisines, Échap revient au schéma.
|
||||
Mouvement (B13-M6), CSS seul : apparition du schéma à la première visite (≤ 900 ms),
|
||||
ouverture 220 ms (mini-schéma en fondu 150 ms, section qui monte de 16 px), latéral
|
||||
280 ms (±24 %). Sous `prefers-reduced-motion` : état final, échange immédiat.
|
||||
Mouvement (B13-M6, B13b-M2), CSS seul : apparition du schéma à la première visite (≤ 900 ms).
|
||||
Ouvrir une porte ne remplace plus le schéma (retour de Jules du 13/10), on reste dans la
|
||||
continuité : au téléphone, la figure rétrécit à 40 % (280 ms) et la section se déplie dessous
|
||||
(hauteur 0fr → 1fr) ; au bureau, la figure glisse en se réduisant vers la colonne de gauche
|
||||
(FLIP : la position de départ est mesurée, puis `transform` seul, 350 ms) et la section se
|
||||
déplie à droite. Fermer inverse le geste. Latéral 280 ms (±24 %).
|
||||
Sous `prefers-reduced-motion` : état final, échange immédiat.
|
||||
Sur /entree tant que Jules n'a pas dit oui à la bascule de / (B14) : / reste la carte.
|
||||
Rien de lourd ici : ni Leaflet, ni données, ni chatbot, ni d3.
|
||||
-->
|
||||
<template>
|
||||
<div ref="racine" class="entree" :class="{ 'entree--ouverte': porte }">
|
||||
<Transition name="entree-bascule" :css="!mouvementReduit" :duration="{ enter: 220, leave: 0 }">
|
||||
<SchemaEchelles v-if="!porte" taille="grand" :apparition="premiere" class="entree__schema">
|
||||
<!-- Bureau : la colonne de gauche (figure réduite + bandeau), collante ; au téléphone elle s'efface (display: contents). -->
|
||||
<div class="entree__gauche">
|
||||
<SchemaEchelles
|
||||
taille="grand"
|
||||
:reduit="Boolean(porte)"
|
||||
:actif="porte"
|
||||
:apparition="premiere && !porte"
|
||||
class="entree__schema"
|
||||
@fermer="fermer"
|
||||
>
|
||||
<template #avant>
|
||||
<h1 class="entree__titre">{{ CADRE.titre }}</h1>
|
||||
</template>
|
||||
@@ -23,11 +35,17 @@
|
||||
</template>
|
||||
</SchemaEchelles>
|
||||
|
||||
<div v-else class="entree__porte">
|
||||
<h1 class="sr-only">{{ CADRE.titre }}</h1>
|
||||
<div class="entree__mini">
|
||||
<SchemaEchelles taille="mini" :actif="porte" @fermer="fermer" />
|
||||
<Transition name="entree-bandeau" :css="!mouvementReduit">
|
||||
<div v-if="porte" class="entree__mini">
|
||||
<div class="entree__mini-dedans">
|
||||
<SchemaEchelles taille="mini" :actif="porte" @fermer="fermer" />
|
||||
</div>
|
||||
</div>
|
||||
</Transition>
|
||||
</div>
|
||||
|
||||
<Transition name="entree-deplier" :css="!mouvementReduit">
|
||||
<div v-if="porte" class="entree__deplie">
|
||||
<div class="entree__scene">
|
||||
<Transition :name="`entree-lateral-${sens === 'arriere' ? 'arriere' : 'avant'}`" :css="!mouvementReduit">
|
||||
<SectionEchelle :key="porte" :echelle="porte" />
|
||||
@@ -72,12 +90,56 @@ function remonter() {
|
||||
if (window.scrollY > 0) window.scrollTo(0, 0)
|
||||
}
|
||||
|
||||
// Focus : le titre de la porte qui s'ouvre ; au retour au schéma, la porte d'où l'on vient.
|
||||
// ── Glissement de la figure au bureau (B13b-M2) ──
|
||||
const BUREAU = '(min-width: 1024px)'
|
||||
/** Durée du glissement (FLIP), dans la limite de 400 ms du brief. */
|
||||
const DUREE_GLISSE = 350
|
||||
|
||||
/**
|
||||
* FLIP : la figure a déjà sa nouvelle place (après le rendu) ; on la remet visuellement là
|
||||
* où elle était (`avant`) par un `transform`, puis on laisse la transition CSS la ramener.
|
||||
* Rien ne bouge dans la mise en page pendant le mouvement : seul `transform` est animé.
|
||||
*/
|
||||
function glisser(el: HTMLElement, avant: DOMRect) {
|
||||
const apres = el.getBoundingClientRect()
|
||||
if (!apres.width || !avant.width) return
|
||||
const dx = avant.left - apres.left
|
||||
const dy = avant.top - apres.top
|
||||
const s = avant.width / apres.width
|
||||
if (Math.abs(dx) < 1 && Math.abs(dy) < 1 && Math.abs(s - 1) < 0.01) return
|
||||
el.style.transformOrigin = '0 0'
|
||||
el.style.transition = 'none'
|
||||
el.style.transform = `translate(${dx}px, ${dy}px) scale(${s})`
|
||||
void el.offsetWidth
|
||||
el.style.transition = `transform ${DUREE_GLISSE}ms var(--ease-out)`
|
||||
el.style.transform = ''
|
||||
let fini = false
|
||||
const finir = (ev?: TransitionEvent) => {
|
||||
if (ev && (ev.target !== el || ev.propertyName !== 'transform')) return
|
||||
if (fini) return
|
||||
fini = true
|
||||
el.removeEventListener('transitionend', finir)
|
||||
el.style.transition = ''
|
||||
el.style.transformOrigin = ''
|
||||
}
|
||||
el.addEventListener('transitionend', finir)
|
||||
setTimeout(finir, DUREE_GLISSE + 50)
|
||||
}
|
||||
|
||||
// Ouvrir / fermer : la figure glisse (bureau) ; focus sur le titre de la porte qui s'ouvre,
|
||||
// au retour sur la porte d'où l'on vient. Le watcher passe avant le rendu : la position
|
||||
// de départ de la figure est mesurée avant que la page ne change de mise en page.
|
||||
watch(porte, async (n, o) => {
|
||||
if (!import.meta.client) return
|
||||
const bascule = Boolean(n) !== Boolean(o)
|
||||
const figure = bascule && !mouvementReduit.value && window.matchMedia(BUREAU).matches
|
||||
? racine.value?.querySelector<HTMLElement>('.entree__schema .schema__figure') ?? null
|
||||
: null
|
||||
const avant = figure?.getBoundingClientRect() ?? null
|
||||
if (!n) schemaAffiche()
|
||||
await nextTick()
|
||||
remonter()
|
||||
if (figure && avant) glisser(figure, avant)
|
||||
if (n) document.getElementById(`porte-titre-${n}`)?.focus({ preventScroll: true })
|
||||
else if (o) racine.value?.querySelector<HTMLElement>(`.entree__schema [data-porte="${o}"]`)?.focus({ preventScroll: true })
|
||||
})
|
||||
@@ -103,7 +165,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))
|
||||
<style scoped>
|
||||
.entree {
|
||||
min-height: 100%;
|
||||
/* le latéral déborde de ±24 % pendant 280 ms : rogné ici, sans créer de conteneur de défilement (le mini-schéma reste collant) */
|
||||
/* le latéral déborde de ±24 % pendant 280 ms : rogné ici, sans créer de conteneur de défilement (le bandeau reste collant) */
|
||||
overflow-x: clip;
|
||||
padding: var(--space-md) var(--space-md) var(--space-2xl);
|
||||
background: var(--bg);
|
||||
@@ -125,37 +187,53 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))
|
||||
color: color-mix(in srgb, var(--text) 78%, transparent);
|
||||
}
|
||||
|
||||
.entree__porte {
|
||||
max-width: 68rem;
|
||||
margin-inline: auto;
|
||||
}
|
||||
/* Téléphone : figure, bandeau, section, l'un sous l'autre. La colonne n'existe qu'au bureau. */
|
||||
.entree__gauche { display: contents; }
|
||||
|
||||
/* Téléphone : barre collante de 48 px, d'un bord à l'autre */
|
||||
/* Le bandeau, collant, d'un bord à l'autre */
|
||||
.entree__mini {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 5;
|
||||
margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) var(--space-lg);
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
margin: var(--space-sm) calc(-1 * var(--space-md)) var(--space-lg);
|
||||
padding: 2px var(--space-md);
|
||||
background: var(--bg);
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
.entree__mini-dedans { min-height: 0; min-width: 0; }
|
||||
|
||||
.entree__deplie {
|
||||
display: grid;
|
||||
grid-template-rows: 1fr;
|
||||
min-width: 0;
|
||||
}
|
||||
.entree__scene {
|
||||
position: relative;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
/* ── Mouvement ── */
|
||||
/* Ouverture : le grand schéma s'efface d'un coup, la porte arrive. */
|
||||
.entree-bascule-leave-active { display: none; }
|
||||
.entree-bascule-enter-active .entree__mini { transition: opacity 150ms var(--ease-out); }
|
||||
.entree-bascule-enter-from .entree__mini { opacity: 0; }
|
||||
.entree-bascule-enter-active .entree__scene { transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
|
||||
.entree-bascule-enter-from .entree__scene { opacity: 0; transform: translateY(16px); }
|
||||
/* Retour au schéma : fondu court. */
|
||||
.entree-bascule-enter-active.entree__schema { transition: opacity 150ms var(--ease-out); }
|
||||
.entree-bascule-enter-from.entree__schema { opacity: 0; }
|
||||
/* Téléphone : le bandeau et la section se déplient sous la figure, qui rétrécit (SchemaEchelles) ; fermer replie. */
|
||||
.entree-bandeau-enter-active,
|
||||
.entree-bandeau-leave-active,
|
||||
.entree-deplier-enter-active,
|
||||
.entree-deplier-leave-active {
|
||||
transition: grid-template-rows 280ms var(--ease-out), opacity 220ms var(--ease-out);
|
||||
}
|
||||
.entree-bandeau-enter-active > .entree__mini-dedans,
|
||||
.entree-bandeau-leave-active > .entree__mini-dedans,
|
||||
.entree-deplier-enter-active > .entree__scene,
|
||||
.entree-deplier-leave-active > .entree__scene { overflow: hidden; }
|
||||
.entree-bandeau-enter-from,
|
||||
.entree-bandeau-leave-to,
|
||||
.entree-deplier-enter-from,
|
||||
.entree-deplier-leave-to {
|
||||
grid-template-rows: 0fr;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* Latéral : la sortante file de 24 %, l'entrante arrive de l'autre côté. */
|
||||
.entree-lateral-avant-enter-active,
|
||||
@@ -176,16 +254,6 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))
|
||||
.entree-lateral-avant-leave-to,
|
||||
.entree-lateral-arriere-enter-from { transform: translateX(-24%); opacity: 0; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.entree-bascule-enter-active .entree__mini,
|
||||
.entree-bascule-enter-active .entree__scene,
|
||||
.entree-bascule-enter-active.entree__schema,
|
||||
.entree-lateral-avant-enter-active,
|
||||
.entree-lateral-avant-leave-active,
|
||||
.entree-lateral-arriere-enter-active,
|
||||
.entree-lateral-arriere-leave-active { transition: none; }
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.entree {
|
||||
padding: var(--space-xl) var(--space-xl) var(--space-2xl);
|
||||
@@ -194,21 +262,55 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown))
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.entree__porte {
|
||||
.entree__gauche {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
/* Porte ouverte : la colonne de gauche (collante) et la section à droite. */
|
||||
.entree--ouverte {
|
||||
display: grid;
|
||||
grid-template-columns: 20rem minmax(0, 1fr);
|
||||
grid-template-columns: 20rem minmax(0, 46rem);
|
||||
justify-content: center;
|
||||
column-gap: var(--space-2xl);
|
||||
align-items: start;
|
||||
}
|
||||
.entree__mini {
|
||||
.entree--ouverte .entree__gauche {
|
||||
position: sticky;
|
||||
top: var(--space-xl);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-md);
|
||||
}
|
||||
.entree__mini {
|
||||
position: static;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
background: none;
|
||||
border-bottom: 0;
|
||||
}
|
||||
.entree__scene {
|
||||
max-width: 46rem;
|
||||
/* Ouverture : la figure glisse (FLIP, script), le bandeau arrive en fondu, la section se déplie à droite. */
|
||||
.entree-bandeau-enter-active { transition: opacity 200ms var(--ease-out); }
|
||||
.entree-bandeau-enter-from { grid-template-rows: 1fr; }
|
||||
.entree-deplier-enter-active {
|
||||
transition: grid-template-rows 350ms var(--ease-out), opacity 350ms var(--ease-out), transform 350ms var(--ease-out);
|
||||
}
|
||||
.entree-deplier-enter-from { transform: translateX(24px); }
|
||||
/* Fermeture : la mise en page repasse au schéma ; la section et le bandeau s'effacent d'un coup, la figure regagne sa place. */
|
||||
.entree-bandeau-leave-active,
|
||||
.entree-deplier-leave-active {
|
||||
display: none;
|
||||
transition: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.entree-bandeau-enter-active,
|
||||
.entree-bandeau-leave-active,
|
||||
.entree-deplier-enter-active,
|
||||
.entree-deplier-leave-active,
|
||||
.entree-lateral-avant-enter-active,
|
||||
.entree-lateral-avant-leave-active,
|
||||
.entree-lateral-arriere-enter-active,
|
||||
.entree-lateral-arriere-leave-active { transition: none; }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user