fix(csp): docs + 418 sans style/script inline — CSS/JS externalisés, header/footer injectés par components.js (#h/#f), playground API déplacé dans docs-playground.js et docs.css

This commit is contained in:
riricdev 2026-09-07 15:34:23 +02:00
commit b65db0be44
7 changed files with 310 additions and 112 deletions

160
public/css/docs.css Normal file
View file

@ -0,0 +1,160 @@
/* Page de documentation des API (docs/maxspeed etc.) */
.docs-wrap {
flex: 1;
width: 100%;
min-height: 0;
display: flex;
gap: 32px;
align-items: flex-start;
max-width: 1180px;
margin: 0 auto;
padding: 40px clamp(1.25rem, 5vw, 2.5rem);
}
.docs-side {
flex: 0 0 240px;
position: sticky;
top: 24px;
font-size: 14px;
}
.docs-side h3 {
margin: 0 0 10px;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 0.08em;
opacity: 0.6;
}
.docs-side ul {
list-style: none;
margin: 0;
padding: 0;
}
.docs-side li {
margin: 4px 0;
}
.docs-side a {
color: inherit;
text-decoration: none;
opacity: 0.85;
}
.docs-side a:hover {
opacity: 1;
text-decoration: underline;
}
.docs-side a.active {
opacity: 1;
font-weight: 600;
}
.docs-body {
flex: 1 1 auto;
min-width: 0;
line-height: 1.7;
color: var(--text);
}
.docs-body h1 {
font-size: 1.9em;
border-bottom: 1px solid var(--border);
padding-bottom: 12px;
}
.docs-body h2 {
font-size: 1.35em;
margin-top: 2.2em;
border-bottom: 1px solid var(--border);
padding-bottom: 6px;
}
.docs-body h3 {
font-size: 1.1em;
margin-top: 1.6em;
}
.docs-body pre {
background: var(--bg-soft);
border: 1px solid var(--border);
border-radius: 8px;
padding: 14px;
overflow: auto;
font-size: 13px;
color: var(--text);
}
.docs-body code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.docs-body :not(pre) > code {
background: var(--bg-soft);
padding: 2px 5px;
border-radius: 4px;
font-size: 0.9em;
}
.docs-body table {
border-collapse: collapse;
width: 100%;
margin: 16px 0;
font-size: 14px;
}
.docs-body th,
.docs-body td {
border: 1px solid var(--border);
padding: 8px 12px;
text-align: left;
}
.docs-body th {
background: var(--bg-soft);
}
.docs-body blockquote {
border-left: 3px solid var(--accent);
margin: 16px 0;
padding: 4px 16px;
opacity: 0.85;
}
@media (max-width: 760px) {
.docs-wrap {
flex-direction: column;
}
.docs-side {
position: static;
flex: auto;
}
}
/* ===== Playground d'interrogation en direct (docs API) ===== */
.ms-playground {
background: var(--bg-soft);
border: 1px solid var(--border);
border-radius: 8px;
padding: 16px;
}
.ms-playground form {
display: flex;
gap: 12px;
flex-wrap: wrap;
align-items: end;
}
.ms-playground label {
display: flex;
flex-direction: column;
font-size: 12px;
gap: 4px;
}
.ms-playground input {
background: var(--bg);
color: inherit;
border: 1px solid var(--border);
border-radius: 4px;
padding: 6px 8px;
width: 130px;
}
.ms-playground button {
background: var(--bg-soft);
color: inherit;
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 14px;
cursor: pointer;
}
.ms-playground button:hover {
border-color: var(--accent);
}
.ms-out {
white-space: pre-wrap;
margin-top: 12px;
font-size: 13px;
}

104
public/css/teapot.css Normal file
View file

@ -0,0 +1,104 @@
/* Page easter egg 418 (I'm a Teapot — RFC 2324) */
.tea-hero {
text-align: center;
padding: clamp(5rem, 12vh, 8rem) 0 4rem;
position: relative;
}
.tea-hero::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(55% 45% at 50% 18%, var(--accent-soft) 0%, transparent 72%);
pointer-events: none;
}
.tea-hero > * {
position: relative;
}
.tea-hero h1 {
font-family: var(--font-head);
font-size: clamp(5rem, 18vw, 11rem);
font-weight: 900;
line-height: 1;
letter-spacing: -0.04em;
margin-bottom: 1.5rem;
}
.tea-hero .tea-sub {
color: var(--text-muted);
font-size: clamp(1rem, 2vw, 1.2rem);
max-width: 44ch;
margin: 0 auto 1.25rem;
line-height: 1.6;
}
.tea-stage {
position: relative;
width: min(340px, 80vw);
margin: 2rem auto;
}
.tea-pot {
display: block;
width: 100%;
color: var(--text);
}
.tea-steam {
position: absolute;
pointer-events: none;
}
.tea-steam span {
position: absolute;
bottom: 0;
display: block;
width: 14px;
height: 38px;
border-radius: 999px;
background: radial-gradient(circle at 50% 40%, var(--accent-soft) 0%, transparent 70%);
animation: tea-rise 3s ease-in infinite;
}
.tea-steam .ts1 { left: 44%; animation-delay: 0s; }
.tea-steam .ts2 { left: 52%; animation-delay: 1s; transform: scaleX(-1); }
.tea-steam .ts3 { left: 60%; animation-delay: 2s; }
@keyframes tea-rise {
0% { opacity: 0; transform: translateY(10px) scale(0.7); }
30% { opacity: 1; }
100% { opacity: 0; transform: translateY(-120px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
.tea-steam span { animation: none; opacity: 0.35; }
}
.tea-actions {
display: flex;
justify-content: center;
gap: 1rem;
flex-wrap: wrap;
}
.tea-hint {
color: var(--text-muted);
opacity: 0.7;
font-size: 0.85rem;
margin-top: 2.25rem;
}
.tea-note {
color: var(--text-muted);
font-size: 0.9rem;
letter-spacing: 0.02em;
}
.tea-toast {
position: fixed;
left: 50%;
bottom: 2rem;
transform: translateX(-50%);
background: var(--bg-card);
border: 1px solid var(--border);
color: var(--text);
padding: 0.8rem 1.2rem;
border-radius: 10px;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
opacity: 0;
transition: opacity 0.25s ease;
z-index: 50;
pointer-events: none;
max-width: 90vw;
text-align: center;
}
.tea-toast.show {
opacity: 1;
}