feat: ajoute le thème interactif Commodore 64 (prompt mC:>)
This commit is contained in:
1 parent
720070bee8
commit
579ad8b15d
7 files changed
+802
-3
No files matched your search
@@ -67,6 +67,7 @@
|
||||
.to-top,
|
||||
.theme-dock,
|
||||
.theme-modal,
|
||||
.c64-terminal,
|
||||
.reading-progress,
|
||||
.actions,
|
||||
.screen-only,
|
||||
|
||||
@@ -0,0 +1,504 @@
|
||||
/* ==========================================================================
|
||||
themes/c64-basic.css — Thème « Commodore 64 » (BASIC V2 / Ligne de commande)
|
||||
--------------------------------------------------------------------------
|
||||
Esthétique Commodore 64 authentique et haute lisibilité :
|
||||
- Bordure extérieure bleu clair C64 (#6C5EB5) entourant l'écran bleu
|
||||
profond (#352879)
|
||||
- Texte bleu pâle / blanc (#D9D9FF / #FFFFFF) — contraste WCAG AAA (> 8.5:1)
|
||||
- Police pixel « Press Start 2P » pour l'écran de démarrage et les invites,
|
||||
associée à JetBrains Mono pour le texte du CV
|
||||
- Au chargement, seuls l'en-tête, la liste des commandes et le prompt
|
||||
interactif « mC:> » sont affichés ; les 7 sections apparaissent à la
|
||||
demande (clavier ou clic)
|
||||
========================================================================== */
|
||||
|
||||
/* Le terminal C64 est masqué sur tous les autres thèmes */
|
||||
.c64-terminal {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@layer themes {
|
||||
|
||||
[data-theme="c64-basic"] {
|
||||
color-scheme: dark;
|
||||
|
||||
--c64-border: #6c5eb5;
|
||||
--c64-screen: #352879;
|
||||
--c64-screen-alt: #2b2066;
|
||||
--c64-ink: #e4e4ff;
|
||||
--c64-ink-bright: #ffffff;
|
||||
--c64-ink-muted: #b8b8f5;
|
||||
--c64-accent: #7ef7d4;
|
||||
--c64-line: rgb(184 184 245 / 35%);
|
||||
|
||||
--color-bg: var(--c64-border);
|
||||
--color-bg-translucent: rgb(53 40 121 / 94%);
|
||||
--color-surface: var(--c64-screen-alt);
|
||||
--color-surface-alt: #231a54;
|
||||
--color-line: var(--c64-line);
|
||||
--color-line-strong: var(--c64-ink-muted);
|
||||
|
||||
--color-ink: var(--c64-ink-bright);
|
||||
--color-ink-soft: var(--c64-ink);
|
||||
--color-ink-faint: var(--c64-ink-muted);
|
||||
--color-ink-inverse: var(--c64-screen);
|
||||
|
||||
--color-accent: var(--c64-accent);
|
||||
--color-accent-dark: var(--c64-accent);
|
||||
--color-accent-wash: rgb(126 247 212 / 14%);
|
||||
--color-accent-border: var(--c64-accent);
|
||||
--color-focus: var(--c64-accent);
|
||||
|
||||
--font-c64: "Press Start 2P", var(--font-mono);
|
||||
--font-sans: var(--font-mono);
|
||||
|
||||
--radius-sm: 0px;
|
||||
--radius-md: 0px;
|
||||
--shadow-sm: none;
|
||||
--shadow-md: none;
|
||||
--transition-fast: 120ms steps(2, end);
|
||||
--transition-base: 180ms ease-out;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
CADRE ÉCRAN C64 (bordure bleu clair + écran bleu profond)
|
||||
------------------------------------------------------------------------ */
|
||||
[data-theme="c64-basic"] body {
|
||||
background-color: var(--c64-border);
|
||||
color: var(--c64-ink);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] main {
|
||||
padding-block: var(--space-lg) var(--space-2xl);
|
||||
padding-inline: clamp(0.5rem, 2.5vw, 1.5rem);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] main > .container {
|
||||
background-color: var(--c64-screen);
|
||||
border: 4px solid var(--c64-ink-muted);
|
||||
padding: var(--space-xl) clamp(1rem, 3.5vw, 2.25rem) var(--space-2xl);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .reading-progress__bar {
|
||||
background: var(--c64-accent);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
EN-TÊTE & NAVIGATION
|
||||
------------------------------------------------------------------------ */
|
||||
[data-theme="c64-basic"] .site-header {
|
||||
background-color: var(--c64-screen);
|
||||
border-block-end: 3px solid var(--c64-ink-muted);
|
||||
backdrop-filter: none;
|
||||
-webkit-backdrop-filter: none;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-header__brand {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.7rem;
|
||||
color: var(--c64-ink-bright);
|
||||
letter-spacing: 0.03em;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-header__logo .logo-bars {
|
||||
color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-nav__link {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.78rem;
|
||||
text-transform: uppercase;
|
||||
color: var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-nav__link:hover,
|
||||
[data-theme="c64-basic"] .site-nav__link[aria-current="true"] {
|
||||
color: var(--c64-screen);
|
||||
background-color: var(--c64-ink-bright);
|
||||
padding-inline: 0.35rem;
|
||||
border-block-end-color: transparent;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .nav-toggle {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.68rem;
|
||||
color: var(--c64-ink-bright);
|
||||
border: 2px solid var(--c64-ink-muted);
|
||||
padding-inline: 0.6rem;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
MASTHEAD COMPACT C64
|
||||
------------------------------------------------------------------------ */
|
||||
[data-theme="c64-basic"] .masthead {
|
||||
padding-block: 0 var(--space-lg);
|
||||
border-block-end: 2px dashed var(--c64-line);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .eyebrow {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.65rem;
|
||||
text-transform: uppercase;
|
||||
color: var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .eyebrow::before {
|
||||
content: "*** ";
|
||||
color: var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .page-title {
|
||||
font-family: var(--font-c64);
|
||||
font-size: clamp(1.25rem, 0.9rem + 1.8vw, 2rem);
|
||||
line-height: 1.45;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: uppercase;
|
||||
color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .page-subtitle {
|
||||
font-family: var(--font-mono);
|
||||
color: var(--c64-ink);
|
||||
max-inline-size: none;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .contact-list {
|
||||
color: var(--c64-ink);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .contact-list a {
|
||||
color: var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .contact-list__icon {
|
||||
stroke: var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .button {
|
||||
font-family: var(--font-mono);
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .button--primary {
|
||||
background-color: var(--c64-ink-bright);
|
||||
color: var(--c64-screen);
|
||||
border: 2px solid var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .button--primary:hover {
|
||||
background-color: var(--c64-accent);
|
||||
border-color: var(--c64-accent);
|
||||
color: var(--c64-screen);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .button--secondary {
|
||||
background-color: transparent;
|
||||
color: var(--c64-ink-bright);
|
||||
border: 2px solid var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .button--secondary:hover {
|
||||
background-color: var(--c64-ink-bright);
|
||||
color: var(--c64-screen);
|
||||
border-color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
CONSOLE INTERACTIVE COMMODORE 64 (visible uniquement sur ce thème)
|
||||
------------------------------------------------------------------------ */
|
||||
[data-theme="c64-basic"] .c64-terminal {
|
||||
display: block;
|
||||
padding-block: var(--space-lg);
|
||||
border-block-end: 2px dashed var(--c64-line);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-boot {
|
||||
text-align: center;
|
||||
font-family: var(--font-c64);
|
||||
font-size: clamp(0.62rem, 0.5rem + 0.5vw, 0.82rem);
|
||||
line-height: 1.9;
|
||||
color: var(--c64-ink-bright);
|
||||
text-transform: uppercase;
|
||||
margin-block-end: var(--space-lg);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-boot__ram {
|
||||
color: var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-ready {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.72rem;
|
||||
color: var(--c64-ink-bright);
|
||||
margin-block-end: var(--space-sm);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-help {
|
||||
background-color: var(--c64-screen-alt);
|
||||
border: 2px solid var(--c64-line);
|
||||
padding: var(--space-md) var(--space-lg);
|
||||
margin-block-end: var(--space-lg);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-help__title {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.68rem;
|
||||
color: var(--c64-accent);
|
||||
margin-block-end: var(--space-sm);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-commands {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.45rem;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cmd-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-block-size: 2.1rem;
|
||||
padding: 0.25rem 0.65rem;
|
||||
background-color: var(--c64-screen);
|
||||
color: var(--c64-ink-bright);
|
||||
border: 1.5px solid var(--c64-ink-muted);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.04em;
|
||||
cursor: pointer;
|
||||
transition: background-color var(--transition-fast), color var(--transition-fast);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cmd-btn:hover {
|
||||
background-color: var(--c64-ink-bright);
|
||||
color: var(--c64-screen);
|
||||
border-color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cmd-btn[data-loaded="true"] {
|
||||
background-color: var(--c64-accent);
|
||||
color: var(--c64-screen);
|
||||
border-color: var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cmd-btn--util {
|
||||
border-style: dashed;
|
||||
color: var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cmd-btn--util:hover {
|
||||
background-color: var(--c64-accent);
|
||||
color: var(--c64-screen);
|
||||
border-color: var(--c64-accent);
|
||||
}
|
||||
|
||||
/* Log des commandes exécutées */
|
||||
[data-theme="c64-basic"] .c64-log {
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.84rem;
|
||||
line-height: 1.55;
|
||||
color: var(--c64-ink-muted);
|
||||
margin-block-end: var(--space-md);
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-log:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Invite interactive mC:> */
|
||||
[data-theme="c64-basic"] .c64-prompt-form {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.55rem;
|
||||
padding: 0.55rem 0.75rem;
|
||||
background-color: var(--c64-screen-alt);
|
||||
border: 2px solid var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-label {
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.82rem;
|
||||
color: var(--c64-accent);
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-input {
|
||||
flex: 1;
|
||||
min-inline-size: 0;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: var(--c64-ink-bright);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 0.96rem;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
caret-color: var(--c64-accent);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-input::placeholder {
|
||||
color: rgb(184 184 245 / 55%);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-submit {
|
||||
min-block-size: 2.1rem;
|
||||
padding: 0.25rem 0.75rem;
|
||||
background-color: var(--c64-accent);
|
||||
color: var(--c64-screen);
|
||||
font-family: var(--font-c64);
|
||||
font-size: 0.64rem;
|
||||
text-transform: uppercase;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-submit:hover {
|
||||
background-color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
@keyframes c64-blink {
|
||||
0%, 49% { opacity: 1; }
|
||||
50%, 100% { opacity: 0; }
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-cursor {
|
||||
display: inline-block;
|
||||
inline-size: 0.65em;
|
||||
block-size: 1.05em;
|
||||
vertical-align: -0.15em;
|
||||
background-color: var(--c64-accent);
|
||||
animation: c64-blink 900ms steps(1, end) infinite;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
VISIBILITÉ DES 7 SECTIONS PILOTÉE PAR COMMANDES (si JS actif)
|
||||
------------------------------------------------------------------------ */
|
||||
[data-js="true"][data-theme="c64-basic"] [data-section] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
[data-js="true"][data-theme="c64-basic"] [data-section][data-c64-visible="true"] {
|
||||
display: block;
|
||||
animation: c64-appear 200ms steps(4, end);
|
||||
}
|
||||
|
||||
@keyframes c64-appear {
|
||||
from { opacity: 0; transform: translateY(6px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
HABILLAGE DES SECTIONS CHARGÉES
|
||||
------------------------------------------------------------------------ */
|
||||
[data-theme="c64-basic"] .intro,
|
||||
[data-theme="c64-basic"] .section {
|
||||
padding-block: var(--space-xl);
|
||||
border-block-start: 2px dashed var(--c64-line);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .intro__heading,
|
||||
[data-theme="c64-basic"] .section-title {
|
||||
font-family: var(--font-c64);
|
||||
font-size: clamp(0.88rem, 0.72rem + 0.7vw, 1.15rem);
|
||||
line-height: 1.65;
|
||||
text-transform: uppercase;
|
||||
color: var(--c64-accent);
|
||||
max-inline-size: none;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .section-title::before {
|
||||
content: "READY. > ";
|
||||
color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .intro__text--highlight {
|
||||
background-color: var(--c64-screen-alt);
|
||||
border: 2px solid var(--c64-accent);
|
||||
padding: var(--space-md) var(--space-lg);
|
||||
color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .entry {
|
||||
border-inline-start: 2px dashed var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .entry::before {
|
||||
border-radius: 0;
|
||||
background-color: var(--c64-accent);
|
||||
border-color: var(--c64-ink-bright);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .course,
|
||||
[data-theme="c64-basic"] .project,
|
||||
[data-theme="c64-basic"] .card,
|
||||
[data-theme="c64-basic"] .contact-block {
|
||||
background-color: var(--c64-screen-alt);
|
||||
border: 2px solid var(--c64-line);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .badge {
|
||||
background-color: var(--c64-screen);
|
||||
color: var(--c64-accent);
|
||||
border: 1.5px solid var(--c64-accent);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .project__stack li {
|
||||
background-color: var(--c64-screen);
|
||||
color: var(--c64-ink-bright);
|
||||
border: 1px solid var(--c64-line);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-footer {
|
||||
background-color: var(--c64-screen);
|
||||
border-block-start: 3px solid var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .site-footer__inner {
|
||||
color: var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .to-top {
|
||||
background-color: var(--c64-screen-alt);
|
||||
border: 2px solid var(--c64-ink-bright);
|
||||
color: var(--c64-ink-bright);
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
@media (width <= 46rem) {
|
||||
[data-theme="c64-basic"] .site-nav {
|
||||
background-color: var(--c64-screen-alt);
|
||||
border-block-end: 3px solid var(--c64-ink-muted);
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-form {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
[data-theme="c64-basic"] .c64-prompt-submit {
|
||||
inline-size: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
[data-theme="c64-basic"] .c64-cursor {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
[data-js="true"][data-theme="c64-basic"] [data-section][data-c64-visible="true"] {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
import { initThemeManager } from "./modules/theme-manager.js";
|
||||
import { initThemeSwitcher } from "./modules/theme-switcher.js";
|
||||
import { initC64Terminal } from "./modules/c64-terminal.js";
|
||||
import { initMotion } from "./modules/motion.js";
|
||||
import { initNavigation } from "./modules/navigation.js";
|
||||
import { initScrollSpy } from "./modules/scroll-spy.js";
|
||||
@@ -43,6 +44,7 @@ function init() {
|
||||
|
||||
initThemeManager();
|
||||
initThemeSwitcher({ status: statusRegion });
|
||||
initC64Terminal({ status: statusRegion });
|
||||
|
||||
const motion = initMotion({
|
||||
progressBar: document.querySelector("[data-reading-progress]"),
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
/**
|
||||
* c64-terminal.js — Console interactive Commodore 64 (prompt mC:>)
|
||||
* =============================================================================
|
||||
* Actif uniquement lorsque data-theme="c64-basic".
|
||||
* Injecte la console C64 juste après .masthead et permet de révéler les 7
|
||||
* sections du CV existant (sans dupliquer aucun contenu HTML) soit :
|
||||
* - en tapant une commande au prompt « mC:> » (ex. PROFIL, ENSEIGNEMENT,
|
||||
* PROJETS, ALL, RUN, CLR, HELP — ou LOAD "PROFIL",8,1 en clin d'œil)
|
||||
* - en cliquant sur une commande dans l'aide
|
||||
* - en cliquant sur un lien de la barre de navigation
|
||||
*/
|
||||
|
||||
import { getActiveThemeId, onThemeChange } from "./theme-manager.js";
|
||||
|
||||
const C64_THEME_ID = "c64-basic";
|
||||
|
||||
const COMMAND_MAP = [
|
||||
{ cmd: "PROFIL", sectionId: "profil", label: "PROFIL" },
|
||||
{ cmd: "ENSEIGNEMENT", sectionId: "enseignement", label: "ENSEIGNEMENT" },
|
||||
{ cmd: "COORDINATION", sectionId: "coordination", label: "COORDINATION" },
|
||||
{ cmd: "PROJETS", sectionId: "projets", label: "PROJETS" },
|
||||
{ cmd: "COMPETENCES", sectionId: "competences", label: "COMPETENCES" },
|
||||
{ cmd: "FORMATION", sectionId: "formation", label: "FORMATION" },
|
||||
{ cmd: "CONTACT", sectionId: "contact", label: "CONTACT" },
|
||||
];
|
||||
|
||||
/**
|
||||
* Normalise une commande saisie (majuscules, sans accents, accepte LOAD "X",8,1).
|
||||
* @param {string} raw
|
||||
* @returns {string}
|
||||
*/
|
||||
function normalizeCommand(raw) {
|
||||
let clean = raw
|
||||
.trim()
|
||||
.normalize("NFD")
|
||||
.replace(/[\u0300-\u036f]/g, "")
|
||||
.toUpperCase();
|
||||
|
||||
// Accepte la syntaxe BASIC complète : LOAD "PROFIL",8,1 -> PROFIL
|
||||
const loadMatch = clean.match(/^LOAD\s+"([^"]+)"(?:\s*,\s*8(?:\s*,\s*1)?)?$/);
|
||||
if (loadMatch) clean = loadMatch[1].trim();
|
||||
|
||||
return clean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construit le bloc DOM de la console C64.
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
function buildTerminalElement() {
|
||||
const wrapper = document.createElement("section");
|
||||
wrapper.className = "c64-terminal screen-only";
|
||||
wrapper.setAttribute("aria-label", "Console interactive Commodore 64");
|
||||
|
||||
const cmdButtons = COMMAND_MAP.map(
|
||||
({ cmd }) =>
|
||||
`<li><button type="button" class="c64-cmd-btn" data-c64-cmd="${cmd}">${cmd}</button></li>`
|
||||
).join("");
|
||||
|
||||
wrapper.innerHTML = `
|
||||
<div class="c64-boot" aria-hidden="true">
|
||||
<div>**** COMMODORE 64 BASIC V2 ****</div>
|
||||
<div class="c64-boot__ram">64K RAM SYSTEM 38911 BASIC BYTES FREE</div>
|
||||
</div>
|
||||
|
||||
<div class="c64-ready">READY. <span class="c64-cursor" aria-hidden="true"></span></div>
|
||||
|
||||
<div class="c64-help">
|
||||
<div class="c64-help__title">COMMANDES DISPONIBLES (TAPEZ OU CLIQUEZ) :</div>
|
||||
<ul class="c64-commands" role="list">
|
||||
${cmdButtons}
|
||||
<li><button type="button" class="c64-cmd-btn c64-cmd-btn--util" data-c64-cmd="ALL">ALL / RUN</button></li>
|
||||
<li><button type="button" class="c64-cmd-btn c64-cmd-btn--util" data-c64-cmd="CLR">CLR</button></li>
|
||||
<li><button type="button" class="c64-cmd-btn c64-cmd-btn--util" data-c64-cmd="HELP">HELP</button></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="c64-log" data-c64-log aria-live="polite"></div>
|
||||
|
||||
<form class="c64-prompt-form" data-c64-form autocomplete="off">
|
||||
<label class="c64-prompt-label" for="c64-input">mC:></label>
|
||||
<input
|
||||
id="c64-input"
|
||||
class="c64-prompt-input"
|
||||
type="text"
|
||||
name="command"
|
||||
placeholder="TAPEZ PROFIL, PROJETS, ALL..."
|
||||
spellcheck="false"
|
||||
autocapitalize="characters"
|
||||
data-c64-input
|
||||
>
|
||||
<button type="submit" class="c64-prompt-submit">RUN</button>
|
||||
</form>
|
||||
`;
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise la console Commodore 64.
|
||||
*
|
||||
* @param {object} [options]
|
||||
* @param {HTMLElement | null} [options.status] - Région aria-live globale.
|
||||
* @returns {void}
|
||||
*/
|
||||
export function initC64Terminal({ status } = {}) {
|
||||
const masthead = document.querySelector(".masthead");
|
||||
if (!masthead) return;
|
||||
|
||||
const terminal = buildTerminalElement();
|
||||
masthead.insertAdjacentElement("afterend", terminal);
|
||||
|
||||
const form = terminal.querySelector("[data-c64-form]");
|
||||
const input = terminal.querySelector("[data-c64-input]");
|
||||
const logEl = terminal.querySelector("[data-c64-log]");
|
||||
const cmdButtons = terminal.querySelectorAll("[data-c64-cmd]");
|
||||
const sections = [...document.querySelectorAll("[data-section]")];
|
||||
const navLinks = document.querySelectorAll("[data-nav-link]");
|
||||
|
||||
/** Historique des commandes saisies (flèches Haut/Bas). */
|
||||
const history = [];
|
||||
let historyIndex = -1;
|
||||
|
||||
const syncCommandButtons = () => {
|
||||
cmdButtons.forEach((btn) => {
|
||||
const entry = COMMAND_MAP.find((item) => item.cmd === btn.dataset.c64Cmd);
|
||||
if (!entry) return;
|
||||
const section = document.getElementById(entry.sectionId);
|
||||
btn.dataset.loaded = String(section?.dataset.c64Visible === "true");
|
||||
});
|
||||
};
|
||||
|
||||
const setLog = (lines) => {
|
||||
if (logEl) logEl.textContent = lines.join("\n");
|
||||
};
|
||||
|
||||
const announce = (message) => {
|
||||
if (!status) return;
|
||||
status.textContent = "";
|
||||
requestAnimationFrame(() => {
|
||||
status.textContent = message;
|
||||
});
|
||||
};
|
||||
|
||||
const hideAllSections = () => {
|
||||
sections.forEach((sec) => {
|
||||
sec.dataset.c64Visible = "false";
|
||||
});
|
||||
syncCommandButtons();
|
||||
};
|
||||
|
||||
const showSection = (sectionId, { scroll = true } = {}) => {
|
||||
const target = document.getElementById(sectionId);
|
||||
if (!target) return;
|
||||
target.dataset.c64Visible = "true";
|
||||
target.dataset.revealed = "true";
|
||||
syncCommandButtons();
|
||||
|
||||
if (scroll) {
|
||||
const reduced = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
target.scrollIntoView({ behavior: reduced ? "auto" : "smooth", block: "start" });
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Exécute une commande saisie ou cliquée.
|
||||
* @param {string} rawCommand
|
||||
* @param {{ scroll?: boolean }} [options]
|
||||
*/
|
||||
const runCommand = (rawCommand, { scroll = true } = {}) => {
|
||||
const cmd = normalizeCommand(rawCommand);
|
||||
if (!cmd) return;
|
||||
|
||||
history.push(cmd);
|
||||
historyIndex = history.length;
|
||||
|
||||
if (cmd === "CLR" || cmd === "CLS" || cmd === "CLEAR") {
|
||||
hideAllSections();
|
||||
setLog([`mC:> ${cmd}`, "SCREEN CLEARED.", "READY."]);
|
||||
announce("Sections masquées, retour à l'invite Commodore 64.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd === "ALL" || cmd === "RUN" || cmd === "LIST") {
|
||||
sections.forEach((sec) => {
|
||||
sec.dataset.c64Visible = "true";
|
||||
sec.dataset.revealed = "true";
|
||||
});
|
||||
syncCommandButtons();
|
||||
setLog([`mC:> ${cmd}`, "LOADING ALL MODULES...", "READY."]);
|
||||
announce("Toutes les sections du CV sont affichées.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd === "HELP" || cmd === "?") {
|
||||
setLog([
|
||||
`mC:> ${cmd}`,
|
||||
"COMMANDES : PROFIL, ENSEIGNEMENT, COORDINATION, PROJETS, COMPETENCES, FORMATION, CONTACT",
|
||||
"UTILITAIRES : ALL (OU RUN) = TOUT AFFICHER | CLR = EFFACER",
|
||||
"READY.",
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
const match = COMMAND_MAP.find((item) => item.cmd === cmd);
|
||||
if (match) {
|
||||
showSection(match.sectionId, { scroll });
|
||||
setLog([
|
||||
`mC:> ${cmd}`,
|
||||
`SEARCHING FOR ${match.cmd}`,
|
||||
"LOADING",
|
||||
"READY.",
|
||||
]);
|
||||
announce(`Section ${match.label} affichée.`);
|
||||
return;
|
||||
}
|
||||
|
||||
setLog([
|
||||
`mC:> ${cmd}`,
|
||||
"?SYNTAX ERROR",
|
||||
"TAPEZ HELP POUR VOIR LES COMMANDES.",
|
||||
"READY.",
|
||||
]);
|
||||
};
|
||||
|
||||
// Soumission du prompt mC:>
|
||||
form?.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
if (!input) return;
|
||||
runCommand(input.value);
|
||||
input.value = "";
|
||||
});
|
||||
|
||||
// Navigation dans l'historique clavier (Flèche Haut / Bas)
|
||||
input?.addEventListener("keydown", (event) => {
|
||||
if (event.key === "ArrowUp" && history.length > 0) {
|
||||
event.preventDefault();
|
||||
historyIndex = Math.max(0, historyIndex - 1);
|
||||
input.value = history[historyIndex] ?? "";
|
||||
} else if (event.key === "ArrowDown" && history.length > 0) {
|
||||
event.preventDefault();
|
||||
historyIndex = Math.min(history.length, historyIndex + 1);
|
||||
input.value = history[historyIndex] ?? "";
|
||||
}
|
||||
});
|
||||
|
||||
// Clic sur les boutons de commande affichés dans la présentation
|
||||
terminal.addEventListener("click", (event) => {
|
||||
const btn = event.target.closest("[data-c64-cmd]");
|
||||
if (!btn) return;
|
||||
runCommand(btn.dataset.c64Cmd);
|
||||
input?.focus({ preventScroll: true });
|
||||
});
|
||||
|
||||
// Clic sur un lien de la barre de navigation en mode C64 : charge la section
|
||||
navLinks.forEach((link) => {
|
||||
link.addEventListener("click", () => {
|
||||
if (getActiveThemeId() !== C64_THEME_ID) return;
|
||||
const targetId = link.getAttribute("href")?.replace("#", "");
|
||||
const match = COMMAND_MAP.find((item) => item.sectionId === targetId);
|
||||
if (match) runCommand(match.cmd, { scroll: false });
|
||||
});
|
||||
});
|
||||
|
||||
// À l'activation du thème C64, on réinitialise sur l'écran propre (en-tête + commandes + mC:>)
|
||||
const syncThemeState = (themeId) => {
|
||||
if (themeId === C64_THEME_ID) {
|
||||
hideAllSections();
|
||||
setLog([]);
|
||||
}
|
||||
};
|
||||
|
||||
syncThemeState(getActiveThemeId());
|
||||
onThemeChange((theme) => syncThemeState(theme.id));
|
||||
}
|
||||
@@ -106,6 +106,20 @@ export const THEMES = Object.freeze([
|
||||
"https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&display=swap",
|
||||
],
|
||||
}),
|
||||
Object.freeze({
|
||||
id: "c64-basic",
|
||||
name: "Commodore 64",
|
||||
subtitle: "Ligne de commande BASIC V2",
|
||||
description:
|
||||
"Écran bleu Commodore 64, commandes interactives (PROFIL, PROJETS, ALL…) et prompt mC:> pour charger les sections du CV au clavier ou au clic.",
|
||||
tags: ["Rétro 8-bit", "CLI", "Interactif"],
|
||||
palette: ["#352879", "#6c5eb5", "#7ef7d4"],
|
||||
colorScheme: "dark",
|
||||
metaThemeColor: "#352879",
|
||||
fonts: [
|
||||
"https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap",
|
||||
],
|
||||
}),
|
||||
]);
|
||||
|
||||
/**
|
||||
|
||||
+4
-3
@@ -156,10 +156,11 @@
|
||||
<link rel="stylesheet" href="/assets/css/themes/obsidian-dark.css?v=20261126">
|
||||
<link rel="stylesheet" href="/assets/css/themes/liquid-glass.css?v=20261126">
|
||||
<link rel="stylesheet" href="/assets/css/themes/editorial-type.css?v=20261126">
|
||||
<link rel="stylesheet" href="/assets/css/themes/c64-basic.css?v=20261127">
|
||||
<link rel="stylesheet" href="/assets/css/utilities.css?v=20261126">
|
||||
<link rel="stylesheet" href="/assets/css/theme-switcher.css?v=20261126">
|
||||
<!-- Chargée uniquement à l'impression : ne pénalise pas le rendu écran -->
|
||||
<link rel="stylesheet" href="/assets/css/print.css?v=20261126" media="print">
|
||||
<link rel="stylesheet" href="/assets/css/print.css?v=20261127" media="print">
|
||||
|
||||
<!-- ==========================================================================
|
||||
INITIALISATION SYNCHRONE DU THÈME (anti-FOUC)
|
||||
@@ -170,7 +171,7 @@
|
||||
========================================================================== -->
|
||||
<script>
|
||||
(function () {
|
||||
var VALID = ["classic", "neo-brutalist", "bento-grid", "obsidian-dark", "liquid-glass", "editorial-type"];
|
||||
var VALID = ["classic", "neo-brutalist", "bento-grid", "obsidian-dark", "liquid-glass", "editorial-type", "c64-basic"];
|
||||
var KEY = "cm-theme";
|
||||
var chosen = null;
|
||||
try {
|
||||
@@ -197,7 +198,7 @@
|
||||
l'analyse du HTML, l'exécution a lieu après. Aucun blocage du rendu,
|
||||
donc pas besoin de l'écrire en fin de <body>.
|
||||
========================================================================== -->
|
||||
<script type="module" src="/assets/js/main.js?v=20261126"></script>
|
||||
<script type="module" src="/assets/js/main.js?v=20261127"></script>
|
||||
|
||||
<!-- ==========================================================================
|
||||
DONNÉES STRUCTURÉES — schema.org en JSON-LD
|
||||
|
||||
@@ -38,6 +38,7 @@ REQUIS=(
|
||||
"assets/css/themes/obsidian-dark.css"
|
||||
"assets/css/themes/liquid-glass.css"
|
||||
"assets/css/themes/editorial-type.css"
|
||||
"assets/css/themes/c64-basic.css"
|
||||
"assets/css/utilities.css"
|
||||
"assets/css/theme-switcher.css"
|
||||
"assets/css/print.css"
|
||||
@@ -46,6 +47,7 @@ REQUIS=(
|
||||
"assets/js/themes.js"
|
||||
"assets/js/modules/theme-manager.js"
|
||||
"assets/js/modules/theme-switcher.js"
|
||||
"assets/js/modules/c64-terminal.js"
|
||||
"assets/js/modules/motion.js"
|
||||
"assets/js/modules/navigation.js"
|
||||
"assets/js/modules/scroll-spy.js"
|
||||
|
||||
Reference in new issue
Block a user