Migration vers architecture Svelte + Kirby inspirée de design-to-pack

- Mise en place de Svelte 4 avec Vite pour le frontend (SPA)
- Simplification des templates PHP (header/footer minimalistes)
- Création de templates JSON pour API (home, about, expertise, portfolio, jouer, game, blog, article, project)
- Ajout d'un controller de site pour définir genericData globalement
- Structure des stores Svelte (page, navigation, locale, site)
- Router avec navaid pour navigation SPA et interception des liens
- Composants layout (Header, Footer, Cursor) et vues de base
- Build Vite vers assets/dist/ (index.js/css)
- Header PHP détecte assets/dist pour basculer dev/prod

Architecture fonctionnelle de base établie, à améliorer et compléter.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
isUnknown 2026-02-06 16:30:15 +01:00
parent c4456d587c
commit cbe89acb21
53 changed files with 3348 additions and 772 deletions

View file

@ -0,0 +1,68 @@
<script>
import { onMount } from 'svelte'
let cursorX = 0
let cursorY = 0
let outlineX = 0
let outlineY = 0
let rafId
onMount(() => {
const handleMouseMove = (e) => {
cursorX = e.clientX
cursorY = e.clientY
}
const animate = () => {
outlineX += (cursorX - outlineX) * 0.2
outlineY += (cursorY - outlineY) * 0.2
rafId = requestAnimationFrame(animate)
}
window.addEventListener('mousemove', handleMouseMove)
animate()
return () => {
window.removeEventListener('mousemove', handleMouseMove)
if (rafId) cancelAnimationFrame(rafId)
}
})
</script>
<div class="cursor" style="transform: translate({cursorX}px, {cursorY}px)"></div>
<div class="cursor-outline" style="transform: translate({outlineX}px, {outlineY}px)"></div>
<style>
.cursor,
.cursor-outline {
position: fixed;
top: 0;
left: 0;
pointer-events: none;
z-index: 9999;
}
.cursor {
width: 8px;
height: 8px;
background: #04fea0;
border-radius: 50%;
transform-origin: center;
}
.cursor-outline {
width: 40px;
height: 40px;
border: 2px solid #04fea0;
border-radius: 50%;
transform-origin: center;
margin: -16px 0 0 -16px;
}
@media (max-width: 768px) {
.cursor,
.cursor-outline {
display: none;
}
}
</style>

View file

@ -0,0 +1,73 @@
<script>
import { siteStore } from '@stores/site'
$: siteTitle = $siteStore.title || 'World Game'
$: currentYear = new Date().getFullYear()
</script>
<footer class="footer">
<div class="footer__container">
<div class="footer__brand">
<p class="footer__title">{siteTitle}</p>
<p class="footer__tagline">Play to Engage</p>
</div>
<div class="footer__copyright">
<p>&copy; {currentYear} {siteTitle}. Tous droits réservés.</p>
</div>
</div>
</footer>
<style>
.footer {
background: #000;
color: #fff;
padding: 3rem 2rem 2rem;
margin-top: auto;
}
.footer__container {
max-width: 1400px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
gap: 2rem;
}
.footer__brand {
flex: 1;
}
.footer__title {
font-size: 1.5rem;
font-weight: 700;
margin: 0 0 0.5rem;
}
.footer__tagline {
color: #04fea0;
margin: 0;
font-size: 0.9rem;
}
.footer__copyright {
font-size: 0.85rem;
color: rgba(255, 255, 255, 0.6);
}
.footer__copyright p {
margin: 0;
}
@media (max-width: 768px) {
.footer__container {
flex-direction: column;
text-align: center;
}
.footer__copyright {
order: 2;
}
}
</style>

View file

@ -0,0 +1,245 @@
<script>
import { navigationStore } from '@stores/navigation'
import { localeStore } from '@stores/locale'
import { siteStore } from '@stores/site'
import { navigateTo } from '@lib/router'
$: isMenuOpen = $navigationStore.isMenuOpen
$: currentLang = $localeStore.current
$: site = $siteStore
$: logo = site.logo
$: siteTitle = site.title
$: navigation = site.navigation || []
$: languages = site.languages || []
function handleNav(path) {
navigateTo(path)
navigationStore.closeMenu()
}
function handleLanguageChange(langCode) {
// In a full implementation, this would switch to the translated URL
localeStore.setLanguage(langCode)
}
</script>
<header class="header" class:menu-open={isMenuOpen}>
<div class="header__container">
<!-- Logo -->
<a href="/" on:click|preventDefault={() => handleNav('/')} class="header__logo">
{#if logo}
<img src={logo} alt={siteTitle} />
{:else}
<span class="header__logo-text">{siteTitle}</span>
{/if}
</a>
<!-- Navigation -->
<nav class="header__nav" class:open={isMenuOpen}>
<ul class="header__nav-list">
{#each navigation as item}
{#if item.url}
<li class="header__nav-item" class:active={item.isActive}>
<a
href={item.url}
on:click|preventDefault={() => handleNav(item.url)}
>
{currentLang === 'en' ? item.label_en : item.label_fr}
</a>
</li>
{/if}
{/each}
</ul>
</nav>
<!-- Language Switcher -->
{#if languages.length > 1}
<div class="header__lang">
{#each languages as lang}
<button
class="header__lang-btn"
class:active={lang.code === currentLang}
on:click={() => handleLanguageChange(lang.code)}
>
{lang.code.toUpperCase()}
</button>
{/each}
</div>
{/if}
<!-- Mobile Menu Toggle -->
<button
class="header__toggle"
on:click={() => navigationStore.toggleMenu()}
aria-label="Menu"
>
<span></span>
<span></span>
<span></span>
</button>
</div>
</header>
<style>
.header {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1000;
background: rgba(0, 0, 0, 0.9);
backdrop-filter: blur(10px);
}
.header__container {
max-width: 1400px;
margin: 0 auto;
padding: 1.5rem 2rem;
display: flex;
align-items: center;
justify-content: space-between;
gap: 2rem;
}
.header__logo {
display: flex;
align-items: center;
text-decoration: none;
z-index: 1001;
}
.header__logo img {
height: 40px;
width: auto;
}
.header__logo-text {
font-size: 1.5rem;
font-weight: 700;
color: #fff;
}
.header__nav {
flex: 1;
display: flex;
justify-content: center;
}
.header__nav-list {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
}
.header__nav-item a {
color: #fff;
text-decoration: none;
font-weight: 500;
text-transform: uppercase;
font-size: 0.9rem;
letter-spacing: 0.05em;
transition: color 0.3s;
}
.header__nav-item a:hover,
.header__nav-item.active a {
color: #04fea0;
}
.header__lang {
display: flex;
gap: 0.5rem;
}
.header__lang-btn {
background: none;
border: 1px solid #fff;
color: #fff;
padding: 0.5rem 1rem;
cursor: pointer;
font-size: 0.8rem;
font-weight: 600;
transition: all 0.3s;
}
.header__lang-btn:hover,
.header__lang-btn.active {
background: #04fea0;
border-color: #04fea0;
color: #000;
}
.header__toggle {
display: none;
flex-direction: column;
gap: 4px;
background: none;
border: none;
cursor: pointer;
padding: 0.5rem;
z-index: 1001;
}
.header__toggle span {
width: 25px;
height: 2px;
background: #fff;
transition: all 0.3s;
}
@media (max-width: 768px) {
.header__container {
padding: 1rem;
}
.header__toggle {
display: flex;
}
.header__nav {
position: fixed;
top: 0;
right: 0;
bottom: 0;
width: 100%;
max-width: 300px;
background: rgba(0, 0, 0, 0.98);
transform: translateX(100%);
transition: transform 0.3s;
padding: 5rem 2rem 2rem;
}
.header__nav.open {
transform: translateX(0);
}
.header__nav-list {
flex-direction: column;
gap: 1.5rem;
}
.header__nav-item a {
font-size: 1.2rem;
}
.header__lang {
position: fixed;
bottom: 2rem;
right: 2rem;
}
.menu-open .header__toggle span:nth-child(1) {
transform: rotate(45deg) translate(5px, 5px);
}
.menu-open .header__toggle span:nth-child(2) {
opacity: 0;
}
.menu-open .header__toggle span:nth-child(3) {
transform: rotate(-45deg) translate(7px, -6px);
}
}
</style>

View file

@ -0,0 +1,98 @@
<script>
export let variant = 'primary' // primary, secondary, outline
export let size = 'medium' // small, medium, large
export let disabled = false
export let href = null
</script>
{#if href}
<a
{href}
class="btn btn--{variant} btn--{size}"
class:disabled
on:click
>
<slot />
</a>
{:else}
<button
class="btn btn--{variant} btn--{size}"
{disabled}
on:click
>
<slot />
</button>
{/if}
<style>
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.75rem 2rem;
font-weight: 600;
text-decoration: none;
border: 2px solid transparent;
cursor: pointer;
transition: all 0.3s;
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 0.9rem;
}
.btn--primary {
background: #04fea0;
color: #000;
border-color: #04fea0;
}
.btn--primary:hover {
background: #03d98c;
border-color: #03d98c;
}
.btn--secondary {
background: #000;
color: #04fea0;
border-color: #04fea0;
}
.btn--secondary:hover {
background: #04fea0;
color: #000;
}
.btn--outline {
background: transparent;
color: #fff;
border-color: #fff;
}
.btn--outline:hover {
background: #fff;
color: #000;
}
.btn--small {
padding: 0.5rem 1.5rem;
font-size: 0.8rem;
}
.btn--medium {
padding: 0.75rem 2rem;
font-size: 0.9rem;
}
.btn--large {
padding: 1rem 2.5rem;
font-size: 1rem;
}
.btn:disabled,
.btn.disabled {
opacity: 0.5;
cursor: not-allowed;
pointer-events: none;
}
</style>

View file

@ -0,0 +1,68 @@
<script>
import { onMount } from 'svelte'
export let src
export let poster = ''
export let overlay = true
let videoElement
onMount(() => {
if (videoElement && src) {
videoElement.play().catch(err => {
console.log('Autoplay failed:', err)
})
}
})
</script>
<div class="video-background">
{#if src}
<video
bind:this={videoElement}
{poster}
muted
loop
playsinline
preload="metadata"
class="video-background__video"
>
<source {src} type="video/mp4" />
</video>
{/if}
{#if overlay}
<div class="video-background__overlay"></div>
{/if}
</div>
<style>
.video-background {
position: absolute;
inset: 0;
overflow: hidden;
z-index: 0;
}
.video-background__video {
position: absolute;
top: 50%;
left: 50%;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
transform: translate(-50%, -50%);
object-fit: cover;
}
.video-background__overlay {
position: absolute;
inset: 0;
background: linear-gradient(
to bottom,
rgba(0, 0, 0, 0.3),
rgba(0, 0, 0, 0.7)
);
}
</style>