Add file headers, tidy the stylesheet and document the conventions

Headers:
- Every JavaScript file (sources, front, scripts, tests) starts with a
  /** @file … */ header, in the three levels used by sokko-g: a short
  description for simple files; Utilisé par / Attention / @see for
  shared modules; a full header (context, entry points, callers,
  dependencies, pitfalls) for index.js, the music queue, the web
  server, the storage manager and the jukebox page script.
- No @author, @version or @since: git already knows.
- test/fileHeaders.test.js fails `npm run check` when a header is
  missing or a central file's header is incomplete.

Stylesheet (no visual change, checked by comparing every element's
computed styles in Chromium at 1280, 800 and 400 px, hover included):
- Role header and section comments.
- Transparent shades derive from the colour variables with
  color-mix() instead of copied rgba() values; new tokens for repeated
  values (text, text on accent, accent gradient, white veils, shadow).
- Native nesting for buttons, the live indicator, upload rows and
  home cards; drop the unused .hero__visual--large and redundant rules.
- Utility classes move to the end so they win over components. The
  library list's u-mt-1, which never applied (.list reset it), is
  removed to keep the layout as it was.

Docs: CONTRIBUTING.md describes the language, header and stylesheet
conventions; CLAUDE.md points to it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-12-01 21:05:59 +01:00
parent e08dba41a3
commit 3795ee06cb
65 changed files with 843 additions and 163 deletions

View file

@ -186,7 +186,7 @@
placeholder="Rechercher un morceau…"
autocomplete="off"
/>
<ul id="libraryList" class="list list--stack u-mt-1"></ul>
<ul id="libraryList" class="list list--stack"></ul>
<p id="libraryEmpty" class="text--muted">Aucun fichier permanent enregistré.</p>
</section>

View file

@ -1,3 +1,12 @@
/**
* @file Outils de la page du jukebox indépendants de son affichage : mémoire du mot de passe et du nom,
* messages d'état, échappement HTML, formats de taille, durée et date, client de l'API.
*
* Utilisé par : public/scripts/jukebox.js.
* Attention : chargé tel quel par le navigateur (module ES, sans compilation). Le texte venu de l'API
* passe par escapeHtml avant d'être inséré en HTML.
*/
const API_KEY_STORAGE_KEY = "palico-api-key";
const DISPLAY_NAME_STORAGE_KEY = "palico-display-name";

View file

@ -1,3 +1,20 @@
/**
* @file Page du jukebox : connexion (Discord ou mot de passe), lecteur, file d'attente, bibliothèque
* et ajout de morceaux.
*
* Contexte : servi tel quel au navigateur (module ES, sans compilation) ; ne parle qu'à l'API de
* src/web/.
* Points d'entrée : initialize (au chargement), connectEvents (flux en direct), refreshAll.
* Utilisé par : public/jukebox.html.
* Dépend de : common.js, et des identifiants des éléments de jukebox.html (objet `elements`).
* Attention :
* - L'état arrive par le flux /api/events ; tant qu'il est coupé, chaque action recharge tout.
* - Le flux est lu avec fetch, et non EventSource, qui ne permet pas d'envoyer la clé.
* - Connecté avec Discord, la session (cookie) remplace la clé : pas d'en-tête Authorization.
* - Tout texte venu de l'API passe par escapeHtml avant d'aller dans innerHTML.
* @see README.md#jukebox
*/
import {
createApiClient,
createStatusManager,

View file

@ -1,20 +1,45 @@
/*
* Rôle : feuille de style unique du site, pour la page d'accueil (index.html) et la page du jukebox
* (jukebox.html), y compris les éléments créés par public/scripts/jukebox.js.
* Chargé par : public/index.html et public/jukebox.html.
* Attention : servie telle quelle, sans compilation. Les couleurs viennent des variables de :root ;
* leurs versions transparentes en dérivent avec color-mix() au lieu d'être recopiées en rgba().
*/
/* ------------------------------------------------------------------------------------------------
* Variables
*/
:root {
color-scheme: dark;
--bg: #06030d;
--bg: #050109;
--bg-card: rgba(22, 14, 36, 0.9);
--bg-glass: rgba(42, 25, 66, 0.65);
--border: rgba(255, 255, 255, 0.08);
--accent: #b259ff;
--accent-strong: #d66bff;
--text: #f7f1ff;
--muted: #cbc4d5;
--muted-dark: #8c7ea7;
--accent: #b259ff;
--accent-strong: #d66bff;
--accent-gradient: linear-gradient(120deg, var(--accent), var(--accent-strong));
/* Texte posé sur l'accent (boutons principaux). */
--on-accent: #08010f;
--danger: #ff4d6d;
--success: #59ffa7;
/* Voiles blancs, du plus léger au plus marqué : fonds de champs, bordures, pastilles, boutons. */
--surface-soft: rgba(255, 255, 255, 0.05);
--border: rgba(255, 255, 255, 0.08);
--border-strong: rgba(255, 255, 255, 0.12);
--surface-strong: rgba(255, 255, 255, 0.15);
--shadow: rgba(2, 0, 8, 0.45);
--gradient: radial-gradient(circle at 20% 20%, #2d1a49, transparent 45%),
radial-gradient(circle at 80% 0%, #551e8c, transparent 40%),
radial-gradient(circle at 50% 80%, #150b28, transparent 30%);
}
/* ------------------------------------------------------------------------------------------------
* Base
*/
* {
box-sizing: border-box;
}
@ -33,7 +58,7 @@
}
code {
background: rgba(255, 255, 255, 0.08);
background: var(--border);
border-radius: 6px;
padding: 0.1rem 0.35rem;
}
@ -42,8 +67,8 @@ body {
margin: 0;
min-height: 100vh;
font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--gradient), #050109;
color: #f7f1ff;
background: var(--gradient), var(--bg);
color: var(--text);
}
main {
@ -68,6 +93,10 @@ p {
text-align: center;
}
/* ------------------------------------------------------------------------------------------------
* En-tête des pages (illustration, titre, connexion)
*/
.hero {
display: flex;
flex-wrap: wrap;
@ -79,33 +108,31 @@ p {
margin: 0 auto;
}
/* Page d'accueil : illustration plus grande. */
.hero--home {
flex-direction: row;
align-items: center;
text-align: left;
gap: 2.75rem;
}
.hero--home .hero__visual img {
max-width: 320px;
& .hero__visual img {
max-width: 320px;
}
}
.hero__content {
flex: 1;
min-width: 280px;
}
.hero__content h1 {
font-size: 2.2rem;
line-height: 1.1;
margin-top: 1rem;
margin-bottom: 1rem;
}
& h1 {
font-size: 2.2rem;
line-height: 1.1;
margin-top: 1rem;
margin-bottom: 1rem;
}
.hero__content p {
color: var(--muted);
font-size: 1.05rem;
max-width: 500px;
& p {
color: var(--muted);
font-size: 1.05rem;
max-width: 500px;
}
}
.hero__actions {
@ -123,17 +150,13 @@ p {
min-width: 200px;
display: flex;
justify-content: center;
}
.hero__visual img {
max-width: 200px;
width: 100%;
height: auto;
filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.45));
}
.hero__visual--large img {
max-width: 270px;
& img {
max-width: 200px;
width: 100%;
height: auto;
filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.45));
}
}
.hero__auth {
@ -147,12 +170,16 @@ p {
font-size: 0.9rem;
padding: 0.35rem 0.85rem;
border-radius: 999px;
background: rgba(255, 255, 255, 0.08);
background: var(--border);
color: var(--muted);
letter-spacing: 0.05em;
text-transform: uppercase;
}
/* ------------------------------------------------------------------------------------------------
* Panneaux
*/
.panel {
border-radius: 18px;
padding: 1.75rem;
@ -162,10 +189,11 @@ p {
.panel--glass {
background: var(--bg-glass);
box-shadow: 0 20px 38px rgba(2, 0, 8, 0.45);
box-shadow: 0 20px 38px var(--shadow);
backdrop-filter: blur(18px);
}
/* Fichiers glissés au-dessus de la section d'ajout. */
.panel--dragover {
border-color: var(--accent);
border-style: dashed;
@ -187,12 +215,16 @@ p {
.badge {
padding: 0.35rem 0.9rem;
background: rgba(178, 89, 255, 0.2);
background: color-mix(in srgb, var(--accent) 20%, transparent);
color: var(--accent);
border-radius: 12px;
font-size: 0.85rem;
}
/* ------------------------------------------------------------------------------------------------
* Formulaires
*/
label {
display: block;
font-size: 0.95rem;
@ -210,8 +242,8 @@ textarea {
width: 100%;
padding: 0.7rem 0.9rem;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.12);
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--border-strong);
background: var(--surface-soft);
color: #fff;
font-size: 1rem;
}
@ -223,8 +255,8 @@ input[type="file"] {
input:focus,
textarea:focus,
select:focus {
outline: 2px solid rgba(178, 89, 255, 0.5);
border-color: rgba(178, 89, 255, 0.6);
outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}
.form-checkbox {
@ -238,36 +270,53 @@ select:focus {
margin-top: 0.25rem;
}
/* Section repliable du mot de passe, quand la connexion avec Discord est proposée. */
.key-login summary {
cursor: pointer;
color: var(--muted);
margin: 1rem 0 0.75rem;
}
.form-actions {
margin-top: 1.25rem;
display: flex;
justify-content: flex-end;
}
/* ------------------------------------------------------------------------------------------------
* Boutons
*/
.btn {
border: none;
border-radius: 999px;
padding: 0.65rem 1.55rem;
font-weight: 600;
cursor: pointer;
background: linear-gradient(120deg, var(--accent), var(--accent-strong));
color: #08010f;
background: var(--accent-gradient);
color: var(--on-accent);
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover {
transform: translateY(-1px);
box-shadow: 0 10px 25px rgba(178, 89, 255, 0.35);
}
&:hover {
transform: translateY(-1px);
box-shadow: 0 10px 25px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn:disabled {
opacity: 0.55;
cursor: not-allowed;
box-shadow: none;
transform: none;
&:disabled {
opacity: 0.55;
cursor: not-allowed;
box-shadow: none;
transform: none;
}
}
.btn--secondary {
background: rgba(255, 255, 255, 0.15);
background: var(--surface-strong);
color: #fff;
}
.btn--danger {
background: linear-gradient(120deg, #ff4d6d, #ff89a5);
background: linear-gradient(120deg, var(--danger), #ff89a5);
color: #fff;
}
@ -299,31 +348,30 @@ a.btn {
padding: 0.6rem 0.9rem;
font-size: 0.95rem;
line-height: 1.2;
text-align: center;
border: 1px solid #6f7bff;
border-radius: 10px;
background: #5865f2;
box-shadow: 0 6px 16px rgba(35, 39, 96, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.14);
color: #fff;
font-weight: 700;
text-decoration: none;
}
.btn.btn--discord svg {
flex: 0 0 24px;
width: 24px;
height: 24px;
}
.btn.btn--discord:hover {
border-color: #7c86ff;
background: #4752c4;
box-shadow: 0 8px 20px rgba(35, 39, 96, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.16);
& svg {
flex: 0 0 24px;
width: 24px;
height: 24px;
}
&:hover {
border-color: #7c86ff;
background: #4752c4;
box-shadow: 0 8px 20px rgba(35, 39, 96, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
}
/* Bouton à bascule activé (boucle) : reprend l'aspect du bouton principal. */
.btn[aria-pressed="true"] {
background: linear-gradient(120deg, var(--accent), var(--accent-strong));
color: #08010f;
background: var(--accent-gradient);
color: var(--on-accent);
}
.btn:focus-visible {
@ -337,12 +385,17 @@ a.btn {
gap: 0.5rem;
}
.key-login summary {
cursor: pointer;
color: var(--muted);
margin: 1rem 0 0.75rem;
.control-group {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-top: 1.25rem;
}
/* ------------------------------------------------------------------------------------------------
* Lecteur : indicateur du flux en direct, morceau en cours, progression
*/
.live-indicator {
display: inline-flex;
align-items: center;
@ -350,23 +403,35 @@ a.btn {
font-size: 0.85rem;
color: var(--muted-dark);
white-space: nowrap;
&::before {
content: "";
width: 0.55rem;
height: 0.55rem;
border-radius: 50%;
background: var(--muted-dark);
}
&[data-live="true"] {
color: var(--success);
}
&[data-live="true"]::before {
background: var(--success);
box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent);
}
}
.live-indicator::before {
content: "";
width: 0.55rem;
height: 0.55rem;
border-radius: 50%;
background: var(--muted-dark);
.player-current {
background: rgba(0, 0, 0, 0.25);
border-radius: 16px;
padding: 1.2rem;
border: 1px solid var(--border);
}
.live-indicator[data-live="true"] {
color: var(--success);
}
.live-indicator[data-live="true"]::before {
background: var(--success);
box-shadow: 0 0 0 4px rgba(89, 255, 167, 0.15);
.player-current--empty {
color: var(--muted);
text-align: center;
}
.progress {
@ -383,7 +448,8 @@ a.btn {
.progress__bar {
height: 100%;
width: 0;
background: linear-gradient(120deg, var(--accent), var(--accent-strong));
background: var(--accent-gradient);
/* La largeur est mise à jour chaque seconde : la transition rend l'avancée continue. */
transition: width 0.9s linear;
}
@ -396,6 +462,10 @@ a.btn {
font-variant-numeric: tabular-nums;
}
/* ------------------------------------------------------------------------------------------------
* Ajout de morceaux : envois en cours, ajout par lien
*/
.upload-list {
margin-top: 1rem;
}
@ -407,6 +477,19 @@ a.btn {
gap: 0.75rem;
padding: 0.4rem 0;
font-size: 0.9rem;
& progress {
width: 100%;
accent-color: var(--accent);
}
&[data-state="ok"] .upload-list__state {
color: var(--success);
}
&[data-state="error"] .upload-list__state {
color: var(--danger);
}
}
.upload-list__name {
@ -415,23 +498,10 @@ a.btn {
white-space: nowrap;
}
.upload-list__item progress {
width: 100%;
accent-color: var(--accent);
}
.upload-list__state {
color: var(--muted);
}
.upload-list__item[data-state="ok"] .upload-list__state {
color: var(--success);
}
.upload-list__item[data-state="error"] .upload-list__state {
color: var(--danger);
}
.url-form {
border-top: 1px solid var(--border);
padding-top: 1.25rem;
@ -449,31 +519,9 @@ a.btn {
margin: 0.5rem 0 0;
}
.control-group {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
margin-top: 1.25rem;
}
.grid {
display: grid;
gap: 1rem;
}
.grid--two {
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.u-mt-1 {
margin-top: 1rem;
}
.form-actions {
margin-top: 1.25rem;
display: flex;
justify-content: flex-end;
}
/* ------------------------------------------------------------------------------------------------
* Messages d'état (voir createStatusManager dans common.js)
*/
.status {
padding: 0.85rem 1.25rem;
@ -484,20 +532,24 @@ a.btn {
}
.status--info {
background: rgba(178, 89, 255, 0.2);
background: color-mix(in srgb, var(--accent) 20%, transparent);
color: var(--accent);
}
.status--error {
background: rgba(255, 77, 109, 0.15);
background: color-mix(in srgb, var(--danger) 15%, transparent);
color: var(--danger);
}
.status--success {
background: rgba(89, 255, 167, 0.15);
background: color-mix(in srgb, var(--success) 15%, transparent);
color: var(--success);
}
/* ------------------------------------------------------------------------------------------------
* Listes de morceaux (file d'attente, bibliothèque)
*/
.list {
list-style: none;
padding: 0;
@ -505,7 +557,7 @@ a.btn {
}
.list--stack > li {
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
border-bottom: 1px solid var(--border);
}
.media-item {
@ -536,17 +588,9 @@ a.btn {
gap: 0.4rem;
}
.player-current {
background: rgba(0, 0, 0, 0.25);
border-radius: 16px;
padding: 1.2rem;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.player-current--empty {
color: var(--muted);
text-align: center;
}
/* ------------------------------------------------------------------------------------------------
* Page d'accueil : cartes vers les pages du site
*/
.feature-grid {
display: grid;
@ -563,20 +607,40 @@ a.btn {
padding: 1.25rem 1.5rem;
background: var(--bg-card);
transition: transform 0.15s ease, box-shadow 0.15s ease;
&:hover {
transform: translateY(-3px);
box-shadow: 0 15px 30px var(--shadow);
}
& .pill {
margin-bottom: 0.5rem;
}
}
.feature-grid__card:hover {
transform: translateY(-3px);
box-shadow: 0 15px 30px rgba(2, 0, 8, 0.45);
/* ------------------------------------------------------------------------------------------------
* Utilitaires de mise en page
*/
.grid {
display: grid;
gap: 1rem;
}
.feature-grid__card .pill {
margin-bottom: 0.5rem;
.grid--two {
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.u-mt-1 {
margin-top: 1rem;
}
/* ------------------------------------------------------------------------------------------------
* Petits écrans
*/
@media (max-width: 900px) {
.hero,
.hero--home {
.hero {
flex-direction: column;
text-align: center;
}
@ -596,18 +660,11 @@ a.btn {
}
@media (max-width: 600px) {
.btn,
input[type="text"],
input[type="file"],
select,
textarea {
.btn {
width: 100%;
}
.control-group {
flex-direction: column;
}
.control-group,
.url-form__row {
flex-direction: column;
}