Le scrollytelling interactif nécessite JavaScript. Le contenu de l’article reste disponible ci-dessous.
(function () {
'use strict';
const script = document.currentScript;
const widget = script && script.closest ? script.closest('.elementor-widget-html') : null;
const STYLE_ID = 'kmt-cds-scroll-runtime-style';
const TARGET_ID = 'kmt-cds-scroll-placeholder';
const componentMarkup = `
`;
const componentCss = `.kmt-cds-scroll-demo,
.kmt-cds-scroll {
--kmt-cds-bg: #02050a;
--kmt-cds-surface: #11151c;
--kmt-cds-surface-raised: #1a222d;
--kmt-cds-text: #fff;
--kmt-cds-text-muted: #b0b2b7;
--kmt-cds-brand-blue: #338ecd;
--kmt-cds-brand-blue-soft: rgb(51 142 205 / 12%);
--kmt-cds-source: #83d8f4;
--kmt-cds-model: #b6bfff;
--kmt-cds-consumer: #73c5fa;
--kmt-cds-governance: #fff;
--kmt-cds-line: #73c5fa;
--kmt-cds-border: #1e2228;
--kmt-cds-border-bright: #344a60;
--kmt-cds-shadow: rgb(0 0 0 / 22%);
--kmt-cds-sticky-offset: 5.5rem;
}
.kmt-cds-scroll *, .kmt-cds-scroll *::before, .kmt-cds-scroll *::after { box-sizing: border-box; }
.kmt-cds-scroll { max-width: 1405px; margin: 0 auto; padding: 36px 32px 0; color: var(--kmt-cds-text); font: inherit; border-top: 1px solid var(--kmt-cds-border-bright); }
.kmt-cds-scroll h2,.kmt-cds-scroll h3 { color: var(--kmt-cds-text); font-family: inherit; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.kmt-cds-scroll p { font-family: inherit; }
.kmt-cds-scroll__heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 36px; padding-bottom: 36px; }
.kmt-cds-scroll__heading h2 { margin: 0; font-size: clamp(25px,2.6vw,36px); }
.kmt-cds-scroll__heading h2 span { color: var(--kmt-cds-text-muted); }
.kmt-cds-scroll__heading>p { font-size: 12px; text-align: right; line-height: 1.8; color: var(--kmt-cds-text-muted); flex-shrink: 0; }
.kmt-cds-scroll__heading>p span { color: var(--kmt-cds-source); letter-spacing: .08em; }
.kmt-cds-scroll__eyebrow { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; font-size: 11px; font-weight: 650; letter-spacing: .12em; color: var(--kmt-cds-source); }
.kmt-cds-scroll__eyebrow span { display: inline-flex; justify-content: center; align-items: center; height: 34px; width: 34px; border: 1px solid var(--kmt-cds-border-bright); border-radius: 50%; font-size: 13px; letter-spacing: 0; }
.kmt-cds-scroll__step { margin: 0; padding: 48px 0; border-top: 1px solid var(--kmt-cds-border); }
.kmt-cds-scroll__step h3 { margin: 0 0 24px; font-size: clamp(30px,2.75vw,39px); }
.kmt-cds-scroll__copy>p:not(.kmt-cds-scroll__eyebrow):not(.kmt-cds-scroll__note) { font-size: 18px; line-height: 1.7; margin: 0 0 22px; color: var(--kmt-cds-text-muted); }
.kmt-cds-scroll .kmt-cds-scroll__note { font-size: 13px; line-height: 1.65; color: var(--kmt-cds-text-muted); padding-left: 15px; border-left: 1px solid var(--kmt-cds-border-bright); margin: 24px 0 0; }
.kmt-cds-scroll__visual { display: none; margin: 0; min-width: 0; }
.kmt-cds-scroll__visual-top { display: flex; justify-content: space-between; padding: 15px 14px; color: var(--kmt-cds-text-muted); border-bottom: 1px solid var(--kmt-cds-border); font-size: 10px; letter-spacing: .13em; }
.kmt-cds-scroll__visual-top [data-kmt-cds-scroll-status] { color: var(--kmt-cds-source); font-variant-numeric: tabular-nums; }
.kmt-cds-scroll__svg { display: block; width: 100%; height: auto; }
.kmt-cds-scroll__svg text { font-family: inherit; letter-spacing: normal; }
.kmt-cds-scroll__visual figcaption, .kmt-cds-scroll__fallback figcaption { font-size: 11px; line-height: 1.6; color: var(--kmt-cds-text-muted); padding: 14px; margin: 0; }
.kmt-cds-scroll__mobile { margin: 34px auto 0; max-width: 430px; }
.kmt-cds-scroll__fallback { margin: 35px auto; max-width: 830px; border: 1px solid var(--kmt-cds-border); border-radius: 18px; overflow: hidden; }
.kmt-cds-scroll__fallback img { display: block; width: 100%; height: auto; }
.kmt-cds-scroll__takeaway { max-width: 1020px; margin: 38px auto 0; padding: 48px 0; border-top: 1px solid var(--kmt-cds-border-bright); border-bottom: 1px solid var(--kmt-cds-border); font-size: clamp(25px,3vw,39px); font-weight: 500; line-height: 1.35; letter-spacing: -.025em; }
.kmt-cds-scroll__takeaway strong { color: var(--kmt-cds-source); font-weight: 600; }
.kmt-cds-scroll__debug { position: fixed; right: 8px; bottom: 8px; max-width: calc(100vw - 16px); z-index: 100; background: var(--kmt-cds-surface); color: var(--kmt-cds-text); border: 1px solid var(--kmt-cds-source); padding: 8px; font: 12px/1.5 monospace; }
.kmt-cds-scroll__debug[hidden] { display: none; }
@media (min-width: 760px) {
.kmt-cds-scroll:not([data-mode="animated"]) .kmt-cds-scroll__step { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.kmt-cds-scroll:not([data-mode="animated"]) .kmt-cds-scroll__mobile { margin-top: 0; width: 100%; }
}
@media (min-width: 1100px) and (min-height: 650px) and (prefers-reduced-motion: no-preference) {
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__layout { display: grid; grid-template-columns: minmax(0,35fr) minmax(0,65fr); gap: 36px; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__steps::after { content: ""; display: block; height: 18vh; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__step { min-height: 75vh; display: flex; align-items: center; padding: 42px 0; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__step:first-child { border: 0; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__mobile,
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__fallback { display: none; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__visual { display: block; position: sticky; top: var(--kmt-cds-sticky-offset); align-self: start; background: var(--kmt-cds-surface); border: 1px solid var(--kmt-cds-border-bright); border-radius: 18px; overflow: hidden; }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__visual>.kmt-cds-scroll__svg { max-height: calc(100vh - var(--kmt-cds-sticky-offset) - 150px); }
.kmt-cds-scroll[data-mode="animated"] .kmt-cds-scroll__step[data-active="true"] .kmt-cds-scroll__eyebrow span { background: var(--kmt-cds-brand-blue-soft); border-color: var(--kmt-cds-brand-blue); }
}
@media (max-width: 759px) {
.kmt-cds-scroll-demo__header { min-height: 64px; padding: 16px 20px; }
.kmt-cds-scroll-demo__header>span:last-child { max-width: 125px; font-size: 9px; text-align: right; }
.kmt-cds-scroll-demo__header b { display: none; }
.kmt-cds-scroll-demo__hero { padding: 48px 22px 28px; }
.kmt-cds-scroll-demo__hero h1 { font-size: clamp(36px,8.9vw,55px); }
.kmt-cds-scroll-demo__dek { font-size: 18px; }
.kmt-cds-scroll-demo__intro,.kmt-cds-scroll-demo__after { padding-left: 22px; padding-right: 22px; font-size: 17px; }
.kmt-cds-scroll-demo__question { font-size: 23px; padding-left: 18px; }
.kmt-cds-scroll { padding: 28px 20px 0; }
.kmt-cds-scroll__heading { display: block; padding-bottom: 12px; }
.kmt-cds-scroll__heading>p { text-align: left; margin-top: 24px; }
.kmt-cds-scroll__step { padding: 38px 0; }
.kmt-cds-scroll__copy>p:not(.kmt-cds-scroll__eyebrow):not(.kmt-cds-scroll__note) { font-size: 17px; }
.kmt-cds-scroll__takeaway { padding: 32px 0; }
.kmt-cds-scroll-demo__after { padding-top: 70px; padding-bottom: 70px; }
.kmt-cds-scroll-demo__after h2 { font-size: 33px; }
}
@media (prefers-reduced-motion: reduce) {
.kmt-cds-scroll *, .kmt-cds-scroll *::before, .kmt-cds-scroll *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
.kmt-cds-scroll__visual { display: none !important; }
.kmt-cds-scroll__mobile,.kmt-cds-scroll__fallback { display: block !important; }
.kmt-cds-scroll__layout { display: block !important; }
.kmt-cds-scroll__step { min-height: 0 !important; break-inside: avoid; }
.kmt-cds-scroll__debug { display: none !important; }
}
/* WordPress/Elementor integration guards */
#kmt-cds-scroll-placeholder { width: 100%; max-width: none; }
#kmt-cds-scroll-placeholder .kmt-cds-scroll { width: 100%; }
.kmt-cds-scroll__fallback > svg { display:block; width:100%; height:auto; }
.kmt-cds-scroll-slot-ready { margin-top: 1rem; }
`;
/**
* Local release candidate. Dependencies are supplied by the host.
* This module never loads libraries, captures scrolling, or mounts itself.
*/
const mounted = new WeakMap();
function mount(root, {
gsap = globalThis.gsap,
ScrollTrigger = globalThis.ScrollTrigger,
scroller,
subscribeRefresh
} = {}) {
if (!root?.matches?.("[data-kmt-cds-scroll]")) {
return { destroy() {}, refresh() {} };
}
if (mounted.has(root)) return mounted.get(root);
const win = root.ownerDocument.defaultView;
const media = win.matchMedia("(prefers-reduced-motion: reduce)");
const steps = [...root.querySelectorAll("article[data-step]")]
.sort((a, b) => Number(a.dataset.step) - Number(b.dataset.step));
const scene = root.querySelector("svg[data-kmt-cds-scroll-scene]");
const status = root.querySelector("[data-kmt-cds-scroll-status]");
const debug = root.querySelector("[data-kmt-cds-scroll-debug]");
const debugEnabled = new URLSearchParams(win.location.search).get("debug") === "1";
const hasEngine = Boolean(gsap?.context && gsap?.timeline && gsap?.set &&
ScrollTrigger?.create);
const query = (name) => [...(scene?.querySelectorAll(
'[data-motion="' + name + '"]') || [])];
const ownAttributes = (element, names) => names.map((name) =>
[element, name, element?.getAttribute(name)]);
const original = [
...ownAttributes(root, ["data-mode", "data-active-step"]),
...steps.flatMap((step) => ownAttributes(step, ["data-active"])),
...ownAttributes(debug, ["hidden"])
];
const statusText = status?.textContent;
const debugText = debug?.textContent;
// Restore only properties owned by this component, including SVG transforms.
const motionNodes = scene ? [...scene.querySelectorAll("[data-motion], [data-motion] path")] : [];
const visualOriginal = motionNodes.flatMap((node) =>
ownAttributes(node, ["style", "transform", "data-svg-origin"]));
let customScroller = scroller;
if (typeof scroller === "string") {
try { customScroller = root.ownerDocument.querySelector(scroller); }
catch { customScroller = null; }
}
if ([win, root.ownerDocument, root.ownerDocument.body,
root.ownerDocument.documentElement].includes(customScroller)) {
customScroller = null;
}
const scrollTarget = customScroller?.addEventListener ? customScroller : win;
let context;
let timeline;
let trigger;
let observer;
let unsubscribe;
let frame = 0;
let scrollFrame = 0;
let destroyed = false;
let refreshing = false;
let building = false;
let failed = false;
let activeStep = 1;
let lastWidth = -1;
function restore(attributes) {
for (const [element, name, value] of attributes) {
if (!element) continue;
if (value == null) element.removeAttribute(name);
else element.setAttribute(name, value);
}
}
function updateDebug() {
if (!debug) return;
debug.hidden = !debugEnabled;
if (!debugEnabled) return;
debug.textContent = [
"step " + activeStep + "/5",
"viewport " + win.innerWidth + "px",
"module " + Math.round(root.getBoundingClientRect().width) + "px",
"reduced-motion " + (media.matches ? "on" : "off"),
"ScrollTrigger " + (hasEngine ? "present" : "absent"),
"mode " + root.dataset.mode
].join(" · ");
}
function setStep(value) {
activeStep = Math.max(1, Math.min(5, value));
root.dataset.activeStep = String(activeStep);
steps.forEach((step) => {
step.dataset.active = String(Number(step.dataset.step) === activeStep);
});
if (status) status.textContent = String(activeStep).padStart(2, "0") + " / 05";
updateDebug();
}
function updateStaticStep() {
if (destroyed || root.dataset.mode === "animated" || !steps.length) return;
const viewport = customScroller?.getBoundingClientRect?.();
const center = viewport
? viewport.top + customScroller.clientHeight / 2
: win.innerHeight / 2;
let closest = steps[0];
let distance = Infinity;
for (const step of steps) {
const box = step.getBoundingClientRect();
const next = Math.abs(box.top + box.height / 2 - center);
if (next = 1100 && win.innerHeight >= 650 &&
root.getBoundingClientRect().width >= 960 &&
steps.length === 5 && scene;
}
function drawPaths(name) {
return query(name).flatMap((group) => [
...(group.matches("path") ? [group] : group.querySelectorAll("path"))
]).map((path) => {
const length = Math.max(1, path.getTotalLength());
gsap.set(path, { strokeDasharray: length, strokeDashoffset: length });
return path;
});
}
function startAnimation() {
building = true;
root.dataset.mode = "animated";
// Empty context first: even a build failure can revert its collected work.
context = gsap.context(() => {}, root);
context.add(() => {
const ventes = query("source-ventes");
const produits = query("source-produits");
if (!ventes.length || !produits.length) {
throw new Error("The persistent source groups are missing.");
}
gsap.set(ventes, {
x: 0, y: 126, scale: 0.65, svgOrigin: "0 0", smoothOrigin: false
});
gsap.set(produits, {
x: -520, y: 210, scale: 0.65, svgOrigin: "0 0", smoothOrigin: false
});
gsap.set([...query("source-details"), ...query("source-kicker")], { opacity: 0 });
gsap.set(query("repeats"), { opacity: 1 });
const hiddenGroups = ["compose-links", "model", "compose-label", "extend",
"consumers", "consumer-links", "governance"].flatMap(query);
gsap.set(hiddenGroups, { opacity: 0 });
gsap.set([...query("model"), ...query("extend"), ...query("consumers"),
...query("governance")], { y: 12 });
const composePaths = drawPaths("compose-links");
const consumerPaths = drawPaths("consumer-links");
const clock = { phase: 0 };
timeline = gsap.timeline({
paused: true,
defaults: { ease: "power1.inOut" },
onUpdate() {
if (!destroyed && timeline) setStep(Math.round(timeline.time()) + 1);
}
});
// Four equal intervals, each ending with a readable state plateau.
timeline.to(clock, { phase: 4, duration: 4, ease: "none" }, 0)
.to(query("repeats"), { opacity: 0, duration: 0.4 }, 0.02)
.to([...ventes, ...produits], { x: 0, y: 0, scale: 1, duration: 0.66 }, 0.02)
.to([...query("source-details"), ...query("source-kicker")],
{ opacity: 1, duration: 0.3 }, 0.38)
.to(query("compose-links"), { opacity: 1, duration: 0.12 }, 1.02)
.to(composePaths, { strokeDashoffset: 0, duration: 0.4, ease: "none" }, 1.04)
.to(query("compose-label"), { opacity: 1, duration: 0.24 }, 1.1)
.to(query("model"), { opacity: 1, y: 0, duration: 0.3 }, 1.18)
.to(query("extend"), { opacity: 1, y: 0, duration: 0.24 }, 1.46)
.to(query("consumer-links"), { opacity: 1, duration: 0.12 }, 2.02)
.to(consumerPaths, { strokeDashoffset: 0, duration: 0.4, ease: "none" }, 2.04)
.to(query("consumers"), { opacity: 1, y: 0, duration: 0.44 }, 2.24)
.to(query("governance"), { opacity: 1, y: 0, duration: 0.58 }, 3.1);
const config = {
trigger: steps[0],
start: "center center",
endTrigger: steps[4],
end: "center center",
animation: timeline,
scrub: 0.25
};
if (customScroller != null) config.scroller = customScroller;
trigger = ScrollTrigger.create(config);
trigger.refresh();
// Correct first render for a restored scroll position or an anchor link.
timeline.progress(trigger.progress || 0);
setStep(Math.round(timeline.time()) + 1);
});
building = false;
}
function reconcile() {
if (destroyed || refreshing || building) return;
refreshing = true;
try {
if (eligible()) {
if (!trigger) startAnimation();
else trigger.refresh();
} else {
if (trigger || context) stopAnimation();
root.dataset.mode = "static";
updateStaticStep();
}
updateDebug();
} catch (error) {
building = false;
fail(error);
} finally {
refreshing = false;
}
}
function refresh() {
if (destroyed || frame) return;
frame = win.requestAnimationFrame(() => {
frame = 0;
reconcile();
});
}
function onScroll() {
if (destroyed || scrollFrame || root.dataset.mode === "animated") return;
scrollFrame = win.requestAnimationFrame(() => {
scrollFrame = 0;
updateStaticStep();
});
}
function destroy() {
if (destroyed) return;
destroyed = true;
win.cancelAnimationFrame(frame);
win.cancelAnimationFrame(scrollFrame);
observer?.disconnect();
win.removeEventListener("resize", refresh);
win.removeEventListener("pageshow", refresh);
root.removeEventListener("load", refresh, true);
scrollTarget.removeEventListener("scroll", onScroll);
if (media.removeEventListener) media.removeEventListener("change", refresh);
else media.removeListener(refresh);
try { unsubscribe?.(); } catch (error) {
if (debugEnabled) win.console.warn("[kmt-cds-scroll] Cleanup:", error);
}
stopAnimation();
restore(original);
if (status) status.textContent = statusText;
if (debug) debug.textContent = debugText;
mounted.delete(root);
}
const controller = Object.freeze({ destroy, refresh });
mounted.set(root, controller);
root.dataset.mode = "static";
setStep(1);
try {
win.addEventListener("resize", refresh, { passive: true });
win.addEventListener("pageshow", refresh);
root.addEventListener("load", refresh, true);
scrollTarget.addEventListener("scroll", onScroll, { passive: true });
if (media.addEventListener) media.addEventListener("change", refresh);
else media.addListener(refresh);
if (win.ResizeObserver) {
observer = new win.ResizeObserver((entries) => {
const width = entries[0]?.contentRect.width;
if (width !== lastWidth) {
lastWidth = width;
refresh();
}
});
observer.observe(root);
}
if (typeof subscribeRefresh === "function") {
const cleanup = subscribeRefresh(refresh);
if (typeof cleanup === "function") unsubscribe = cleanup;
}
root.ownerDocument.fonts?.ready.then(() => {
if (!destroyed) refresh();
}).catch(() => {});
reconcile();
} catch (error) {
fail(error);
}
return controller;
}
function ensureStyle() {
if (document.getElementById(STYLE_ID)) return;
const style = document.createElement('style');
style.id = STYLE_ID;
style.textContent = componentCss;
document.head.appendChild(style);
}
function findScrollTrigger() {
if (window.ScrollTrigger) return window.ScrollTrigger;
if (window.gsap && window.gsap.plugins && window.gsap.plugins.ScrollTrigger) {
return window.gsap.plugins.ScrollTrigger;
}
return null;
}
function install() {
const target = document.getElementById(TARGET_ID);
if (!target) return false;
ensureStyle();
target.classList.add('kmt-cds-scroll-slot-ready');
const previous = target.__kmtCdsController;
if (previous && typeof previous.destroy === 'function') {
try { previous.destroy(); } catch (_) {}
}
target.innerHTML = componentMarkup;
const root = target.querySelector('[data-kmt-cds-scroll]');
if (!root) return false;
const gsap = window.gsap;
const ScrollTrigger = findScrollTrigger();
if (gsap && ScrollTrigger && typeof gsap.registerPlugin === 'function') {
try { gsap.registerPlugin(ScrollTrigger); } catch (_) {}
}
target.__kmtCdsController = mount(root, { gsap, ScrollTrigger });
// The Elementor widget is only the technical carrier; hide it after successful mount.
if (widget) widget.style.display = 'none';
// Host theme / fonts / delayed layout can affect measurements.
requestAnimationFrame(() => {
try { target.__kmtCdsController?.refresh?.(); } catch (_) {}
try { ScrollTrigger?.refresh?.(); } catch (_) {}
});
setTimeout(() => {
try { target.__kmtCdsController?.refresh?.(); } catch (_) {}
try { ScrollTrigger?.refresh?.(); } catch (_) {}
}, 500);
return true;
}
let tries = 0;
function boot() {
if (install()) return;
tries += 1;
if (tries < 40) setTimeout(boot, 150);
else if (widget) {
widget.style.display = '';
widget.innerHTML = '
Scrollytelling : emplacement cible introuvable. Vérifier le placeholder kmt-cds-scroll-placeholder.
';
}
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot, { once: true });
else boot();
})();