Here's a thinking process that leads to the suggested product style guide solution:
-
Analyze the Request:
- Goal: Create a "live product style guide that ingests release diffs, flags drift, and streamlines sign-offs with component snapshots."
- Implied Functionality: This isn't just a static UI kit. It needs to simulate a dynamic tool that:
- Shows component styles (Typography, Spacing, Colors, shadows/depth).
- Simulates "release diffs" (comparing versions).
- Flags drift (detecting changes).
- Streamlines sign-offs (approval workflow, signature/stamps).
- Uses component snapshots (visual representations of UI elements).
- Role: Top-tier creative frontend engineer/UI-UX designer.
- Tech Stack: HTML, Tailwind CSS (via CDN), JavaScript (vanilla), GSAP (for animations), modern CSS features. No external build steps.
- Design Principles: Swiss/Minimalist, deep typography, negative space, bold color use (maybe dark mode + neon), 3D depth/particles, non-linear layouts where appropriate, "bento" grids.
- Language: English (user request is English).
-
Conceptualization & Design Strategy:
- Theme: "Nexus Style Guide" – A futuristic, high-fidelity control center for design systems.
- Visual Style: Dark mode base (
#0a0a0a) with "cyber blue" and "sunset orange" accents. Swiss typography (Inter/Playfair Display). Heavy use of glassmorphism and grain. Dynamic background with a Three.js or Canvas particle system to give it that "alive" feel (space/depth).
- Layout:
- Header: Title, version controls, global status.
- Hero Section: Brief intro, dashboard stats (e.g., "Drift Detected: 3", "Sign-offs Pending: 5").
- Main Content - The Grid: A Bento-style grid organizing the style guide.
- Card 1: Typography (Live editing preview).
- Card 2: Color Palette (Selected state interaction).
- Card 3: Spacing/Grid (Visual ruler).
- Card 4: Component Snapshot (The core feature). Here we simulate a component (like a button or card) and show a "diff" overlay when "release changes" are toggled.
- Card 5: Drift Detector (List of changed tokens).
- Card 6: Sign-off Workflow (Form/Button to approve).
- Interactivity:
- Micro-interactions: Buttons magnetic feel, entry animations with GSAP ScrollTrigger.
- Simulation: A "Simulate Diff" button that visually alters the component snapshot and updates the drift list, demonstrating the tool's purpose.
- Sign-off: A "Sign-off" button that clears drift and generates a success animation (confetti or checkmark).
-
Technical Implementation Steps:
- HTML Structure: Set up the container, canvas for background, sections, and Bento grid.
- Tailwind CSS: Use the CDN. Configure custom colors in
tailwind.config.
- Three.js (via CDN): Create a simple background mesh/particle field that responds slightly to mouse movement to meet the "3D depth" requirement without overcomplicating.
- GSAP (via CDN): Use
ScrollTrigger for scroll animations, and TweenMax for button hovers/diffs.
- JavaScript Logic:
- State management:
currentVersion, driftList, isSignedOff.
- Functions:
initThreeJS(), animateBackground(), renderComponentSnapshot(), toggleDiffMode(), approveChanges().
- Event Listeners.
-
Drafting the Design (Mental Sandbox):
- Typography: H1 huge size (80px+), tight tracking. Body text legible (18px).
- Colors: Background
bg-zinc-950. Text text-zinc-100. Accent cyan-500. Diff highlight bg-red-500/20 border-red-500.
- Components:
- Button: Gradient border, glow effect.
relative overflow-hidden.
- Card:
bg-zinc-900/80 backdrop-blur-md border border-white/10.
- The "Diff" Simulation:
- State 1 (Current): Rounded corners
border-radius: 8px, color blue-500.
- State 2 (Proposed/Drift): Rounded corners
12px, color purple-500.
- Visual representation: Use
mix-blend-mode or a ghost overlay to show the old vs new side-by-side or as a heatmap. Let's go with a side-by-side view within the snapshot card: Left = Baseline (Locked), Right = Incoming (Drift). Or a split toggle. A "Split View" slider would be cool but complex code-wise. Let's do a "View Modes" toggle: "Baseline", "Proposed", "Diff". "Diff" shows a transparent overlay of the diff.
-
Refining the "Drift & Sign-off" Logic:
- The user wants to "ingest release diffs". I'll simulate this by having a button labeled "Fetch New Release". When clicked, it fetches "data" (randomly generated or preset) showing changes (e.g., Primary Color changed, Border Radius changed).
- Those changes populate the "Drift Detector" list.
- The component snapshot updates to show the "Proposed" state.
- The user reviews, then clicks "Approve & Deploy". This clears the drift list, updates the "Baseline" to match "Proposed", and shows a success toast.
-
Writing the Code (Iterative Process):
- Setup: HTML skeleton, load Tailwind script, load GSAP, load Three.js from unpkg/cdnjs.
- CSS: Custom font import (Inter, Playfair Display). Add custom scrollbar. Add
cursor: none for a custom cursor maybe? Let's stick to standard cursor but add hover states.
- Three.js Background: A slow-moving starfield or flowing mesh. Let's do a "Waving Mesh" using
THREE.Points for that "digital dust" look.
- UI Construction:
- Navbar: "Lumina Style Guide // v2.4.0".
- Dashboard rows using
grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6.
- Cards with
rounded-2xl, overflow-hidden.
- Key Card Implementation:
- Typography Swatches: Display font vs body font.
- Color Swatches: Interactive circle clicks to copy hex.
- Spacing: Visual blocks with labels.
- Component Snapshot: This is the star. I'll build a "Button" and a "Card" inside. I'll use CSS variables (
--btn-radius, --btn-color) to easily manipulate them via JS for the diff simulation.
- Diff Log: A scrolling list of items. Drift items in red/orange.
- Sign-off: A sticky bottom panel or a distinct card.
-
Polishing the Experience (The "Awwwards" Touch):
- Entrance Animation: On load, elements cascade in using GSAP timeline.
- Magnetic Buttons: Add a slight movement to buttons on hover using
lerp.
- Noise Texture: Add a fixed
pointer-events-none overlay with a base64 noise image to give it a film grain texture.
- Lighting: Use CSS radial gradients on cards to simulate vignette.
- Responsiveness: Ensure grid collapses nicely on mobile.
-
Code Structure (Simulated):
<html>
<head>
<!-- Tailwind, Fonts, Styles -->
</head>
<body class="bg-black text-white overflow-x-hidden">
<canvas id="bg-canvas"></canvas>
<div id="app">
<header>...</header>
<main class="container mx-auto px-6 py-12">
<div class="grid ...">
<!-- Widgets -->
</div>
</main>
<div id="toast">...</div>
</div>
<script>
// Three.js logic
// GSAP intro
// State & Interaction Logic
</script>
</body>
</html>
-
Detailed Logic for "Live Diff":
- Define
designTokens (Baseline).
- Define
proposedTokens (New Release).
- When "Release Detected" event fires:
- Compare tokens. Mark differences.
- Set
pendingChanges = true.
- In Snapshot Card, switch display to "Proposed".
- Show differences in Drift List.
- Animation: Shake the "Sign Off" button to draw attention.
- When "Sign Off" clicked:
- Update
designTokens = proposedTokens.
- Clear
driftList.
- Update Snapshot back to "Baseline" (visually same as Proposed now).
- Show success state.
-
Refining Code & Constraints:
- Constraint Check: Single HTML file. No external CSS/JS files (use CDNs).
- Interactive: Everything must work.
- Language: English.
-
Self-Correction/Review during drafting:
- Issue: Three.js might be too heavy code-wise to write a complex shader in a single file while maintaining readability.
- Fix: Use a simple, elegant
THREE.Points system moving slowly. It's performant and looks premium.
- Issue: Tailwind CDN doesn't support arbitrary values easily without config.
- Fix: Use inline styles for dynamic values (like specific hex colors or radii). Use Tailwind for structure.
- Issue: "Non-linear layout" - should I overlap things?
- Fix: Use
z-index and absolute positioning for the "Noise" texture and some decorative circles/bokeh elements to create depth.
-
** Final Polish:**
- Add a custom SVG filter for "Gooey" or "Glow"? Maybe a glow filter via CSS
filter: drop-shadow(...).
- Ensure the "Drift" list shows exactly what changed (e.g.,
--primary-color: #3b82f6 -> #8b5cf6).
- Ensure the component snapshot actually changes its appearance (border radius, background color, font weight) based on the diff value.
-
Generating the Output: (Proceeding to write the actual HTML code based on these thoughts.) -> Self-correction: Ensure the language used in the code comments and UI is English as requested.
- View: "Cyber-Zen".
- Font: Inter & Space Grotesk (tech feel). Playfair Display for headings? Maybe stick to Inter/Orbitron for this "system" look, but mix with adisplay serif for titles. Let's do
Space Grotesk for UI, Inter for body, Playfair Display for main headers to get that Swiss style clash.
-
Final Code Assembly: (Writing the actual response). I will construct a fully contained HTML file.
- Key Features:
- Background: Three.js particle dust.
- Noise Overlay: CSS grain.
- Hero: "System Integrity: 98%".
- Bento Grid: 2x2 layout with one spanning column.
- Diff Viewer: Visual "Previous vs Current" overlay.
- Workflow: "Deploy to Production" button with magnetic effect.
-
Executing the Code Generation. (Proceeding to output).
Here is a complete, self-contained "Live Product Style Guide" interface. It features a fully interactive simulation of release diffs, drift detection, and approval workflows, wrapped in a high-end Swiss/Cyber aesthetic with Three.js background and GSAP animations.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lumina • Live Style Guide & Drift Monitor</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Space+Grotesk:wght@300;500;700&display=swap" rel="stylesheet">
<!-- GSAP -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/ScrollTrigger.min.js"></script>
<!-- Three.js -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
brand: {
dark: '#050505',
surface: '#121214',
surfaceHighlight: '#1C1C21',
accent: '#3B82F6', // Cyber Blue
accentGlow: 'rgba(59, 130, 246, 0.5)',
warning: '#F59E0B',
danger: '#EF4444',
success: '#10B981'
}
},
fontFamily: {
display: ['"Playfair Display"', 'serif'],
ui: ['"Space Grotesk"', 'sans-serif'],
body: ['"Inter"', 'sans-serif'],
},
boxShadow: {
'glow': '0 0 20px var(--brand-accent-glow)',
'card': '0 4px 24px -4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05)',
},
backgroundImage: {
'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
}
}
}
}
</script>
<style>
/* Base Styles & Utilities */
body {
background-color: #050505;
color: #e2e8f0;
overflow-x: hidden;
}
/* Grain Texture Overlay */
.noise-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 9998;
opacity: 0.035;
background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}
/* Custom scrollbar */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #050505;
}
::-webkit-scrollbar-thumb {
background: #333;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #3B82F6;
}
/* Card Glassmorphism */
.glass-panel {
background: rgba(18, 18, 20, 0.6);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid rgba(255,255,255,0.08);
box-shadow: 0 4px 32px rgba(0,0,0,0.4);
}
/* Magnetic Button Effect Class */
.magnetic-wrap {
position: relative;
display: inline-block;
}
.component-preview-base {
transition: all 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Drift Alert Pulse */
@keyframes pulse-red {
0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.drift-active {
animation: pulse-red 2s infinite;
}
/* Interactive Subtle Grid Background */
.grid-bg {
background-size: 40px 40px;
background-image: linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px);
mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}
</style>
</head>
<body class="antialiased selection:bg-brand-accent selection:text-white font-body relative">
<!-- Noise Texture -->
<div class="noise-overlay"></div>
<!-- Three.js Background Container -->
<div id="canvas-container" class="fixed inset-0 z-0 pointer-events-none"></div>
<!-- Main Content -->
<div class="relative z-10 container mx-auto px-6 py-12 md:py-20">
<!-- Header -->
<header class="flex flex-col md:flex-row justify-between items-end mb-20 border-b border-white/10 pb-8">
<div>
<div class="flex items-center gap-3 mb-2">
<span class="w-2 h-2 bg-brand-accent rounded-full animate-pulse"></span>
<span class="text-xs font-bold tracking-[0.2em] uppercase text-brand-accent">System Online</span>
</div>
<h1 class="text-5xl md:text-7xl font-display font-bold tracking-tight leading-none">
Lumina <span class="text-transparent bg-clip-text bg-gradient-to-r from-white to-zinc-500">Design</span> OS
</h1>
</div>
<div class="mt-6 md:mt-0 text-right">
<div class="text-sm text-zinc-400 mb-1">Style Guide Version</div>
<div class="text-2xl font-ui font-medium tracking-widest text-white">v2.4.0</div>
</div>
</header>
<!-- Dashboard Grid -->
<div class="grid grid-cols-1 md:grid-cols-12 gap-6 auto-rows-auto">
<!-- 1. Typography (Width 4) -->
<div class="md:col-span-4 glass-panel rounded-3xl p-8 group hover:border-brand-accent/30 transition-colors duration-500">
<h3 class="text-sm uppercase tracking-widest text-zinc-400 mb-6 font-ui font-bold flex items-center justify-between">
Typography
<span class="w-8 h-[1px] bg-white/20"></span>
</h3>
<div class="space-y-8">
<div>
<p class="font-display text-5xl font-medium">Aa</p>
<p class="text-xs text-brand-accent mt-2">Playfair Display</p>
</div>
<div>
<p class="font-ui text-4xl font-light">The quick brown fox</p>
<p class="text-xs text-zinc-500 mt-2">Space Grotesk / Light</p>
</div>
<div>
<p class="font-body text-lg text-zinc-300 max-w-xs leading-relaxed">
Design is not just what it looks like and feels like. Design is how it works. Drift detection ensures consistency.
</p>
</div>
</div>
<!-- Micro interaction: Hover changes opacity -->
<div class="absolute inset-0 bg-gradient-to-br from-white/[0.02] to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500 pointer-events-none rounded-3xl"></div>
</div>
<!-- 2. Colors & Spacing (Width 4) -->
<div class="md:col-span-4 glass-panel rounded-3xl p-8 flex flex-col hover:border-white/20 transition-colors duration-500">
<h3 class="text-sm uppercase tracking-widest text-zinc-400 mb-6 font-ui font-bold">Palette</h3>
<div class="flex-1 grid grid-cols-2 gap-4">
<div class="space-y-3">
<div class="color-swatch h-20 rounded-2xl bg-black border border-white/20 relative overflow-hidden cursor-pointer" data-code="#000000" onclick="copyColor(this)">
<span class="absolute bottom-2 right-2 text-[10px] font-mono opacity-70">#000</span>
</div>
<div class="color-swatch h-20 rounded-2xl bg-white border border-white/10 relative overflow-hidden cursor-pointer" data-code="#FFFFFF" onclick="copyColor(this)">
<span class="absolute bottom-2 right-2 text-[10px] font-mono text-black opacity-70">#FFF</span>
</div>
</div>
<div class="space-y-3">
<div class="h-20 rounded-2xl bg-brand-accent border border-brand-accent relative overflow-hidden shadow-[0_0_15px_rgba(59,130,246,0.4)] cursor-pointer group">
<span class="absolute bottom-2 right-2 text-[10px] font-mono text-white opacity-80 group-hover:opacity-100">PRIMARY</span>
</div>
<div class="h-20 rounded-2xl bg-brand-warning border border-brand-warning shadow-[0_0_10px_rgba(245,158,11,0.3)]"></div>
</div>
</div>
<div class="mt-6 pt-6 border-t border-white/10">
<div class="text-xs text-zinc-500 mb-2">SPACING UNIT</div>
<div class="flex items-end gap-2">
<div class="w-4 h-4 bg-brand-accent/20 border border-brand-accent rounded-sm"></div>
<div class="w-8 h-4 bg-brand-accent/20 border border-brand-accent rounded-sm"></div>
<div class="w-12 h-4 bg-brand-accent/20 border border-brand-accent rounded-sm"></div>
<div class="w-16 h-4 bg-brand-accent/20 border border-brand-accent rounded-sm"></div>
<div class="w-24 h-4 bg-brand-accent/20 border border-brand-accent rounded-sm"></div>
</div>
</div>
</div>
<!-- 3. The Drift Detector (Width 4 - Full Width Bottom) -->
<div class="md:col-span-4 glass-panel rounded-3xl p-8 flex flex-col relative overflow-hidden" id="drift-panel">
<div class="flex justify-between items-center mb-4">
<h3 class="text-sm uppercase tracking-widest text-zinc-400 font-ui font-bold">Drift Monitor</h3>
<div id="drift-badge" class="px-3 py-1 bg-transparent border border-zinc-700 rounded-full text-xs font-mono text-zinc-500 transition-all">No changes</div>
</div>
<div id="drift-list" class="flex-1 overflow-y-auto pr-2 space-y-2">
<div class="text-sm text-zinc-500 italic font-light py-4 text-center border border-dashed border-zinc-800 rounded-xl">
Waiting for release pipeline...
</div>
</div>
<!-- Decorative Background Elements -->
<div class="absolute -right-10 -bottom-10 w-32 h-32 bg-brand-accent/10 blur-[50px] rounded-full pointer-events-none"></div>
</div>
<!-- 4. Component Snapshot (Width 8 - Large) -->
<div class="md:col-span-8 glass-panel rounded-3xl p-10 relative min-h-[500px] flex flex-col" id="snapshot-card">
<div class="flex justify-between items-start z-10">
<div>
<h3 class="text-sm uppercase tracking-widest text-zinc-400 font-ui font-bold mb-1">Component Snapshot</h3>
<p class="text-xl font-ui font-light text-white">Interactive Preview</p>
</div>
<div class="flex gap-2">
<button id="btn-baseline" class="px-4 py-2 text-xs font-bold bg-white/10 border border-white/10 rounded-lg hover:bg-white/20 transition active" disabled>Baseline</button>
<button id="btn-proposed" class="px-4 py-2 text-xs font-bold bg-transparent border border-brand-accent/50 text-brand-accent rounded-lg hover:bg-brand-accent/10 transition">Proposed</button>
<button id="btn-diff" class="px-4 py-2 text-xs font-bold bg-transparent border border-zinc-700 text-zinc-300 rounded-lg hover:bg-white/5 transition">Diff</button>
</div>
</div>
<!-- The Stage -->
<div class="flex-1 flex items-center justify-center relative p-8 mt-4 rounded-2xl bg-zinc-900/50 border border-white/5 overflow-hidden" id="preview-stage">
<!-- Grid lines assist -->
<div class="absolute inset-0 grid-bg opacity-30 pointer-events-none"></div>
<!-- Component: The Product Card -->
<div id="component-under-test" class="relative w-[320px] p-6 rounded-[var(--rad,12px)] bg-[var(--bg,surface-light)] border border-[var(--border,rgba(255,255,255,0.1)] shadow-lg transition-all duration-500 ease-out"
style="--bg: #1C1C21; --border: rgba(255,255,255,0.15); --rad: 12px;">
<!-- Diff Overlay -->
<div id="diff-overlay" class="absolute inset-auto bottom-0 left-0 w-full h-1 bg-red-500 origin-left transform scale-x-0 z-20 pointer-events-none"></div>
<div class="flex justify-between items-start mb-4">
<div class="w-10 h-10 rounded-full bg-zinc-700 flex items-center justify-center text-xs font-bold text-white">AI</div>
<span class="text-xs font-mono text-brand-accent" id="comp-tag">Pro v2.0</span>
</div>
<h4 class="text-xl font-display font-bold text-white mb-2 leading-tight" id="comp-title">Neural Interface</h4>
<p class="text-sm text-zinc-400 leading-relaxed mb-6" id="comp-desc">
An advanced control unit for synthetic media manipulation with zero-latency haptic feedback.
</p>
<button class="w-full py-3 rounded-lg bg-white text-black font-ui font-bold text-sm transition-colors hover:bg-brand-accent hover:text-white border border-transparent hover:border-white/20" id="comp-btn">
Integrate Now
</button>
</div>
<!-- Comparison Ghost (Visible only in Diff/Proposed mode) -->
<div id="ghost-component" class="absolute inset-auto bottom-0 left-0 w-[320px] p-6 rounded-[var(--ghost-rad,4px)] bg-[var(--ghost-bg,rgba(255,255,255,0.05)] border border-red-500/30 shadow-lg transform translate-y-4 opacity-0 transition-all duration-500 pointer-events-none z-0"
style="--ghost-bg: rgba(239,68,68,0.05); --ghost-rad: 4px; --ghost-border: rgba(239,68,68,0.4);">
<div class="flex justify-between items-start mb-4">
<div class="w-10 h-10 rounded-full bg-red-500/20 flex items-center justify-center text-xs font-bold text-white">AI</div>
<span class="text-xs font-mono text-red-400">Drift Detected</span>
</div>
<h4 class="text-xl font-display font-bold text-red-400 mb-2 leading-tight">Neural Interface</h4>
<p class="text-sm text-zinc-500 leading-relaxed mb-6">Legacy protocol support disabled. Requires firmware v5.0+.</p>
<button class="w-full py-3 rounded-lg bg-red-500 text-white font-ui font-bold text-sm transition-colors hover:bg-red-600 border-none shadow-[0_0_15px_rgba(239,68,68,0.4)]">Update Firmware</button>
</div>
</div>
</div>
<!-- 5. Release Controls (Width 4) -->
<div class="md:col-span-4 glass-panel rounded-3xl p-8 flex flex-col justify-between">
<div>
<h3 class="text-sm uppercase tracking-widest text-zinc-400 font-ui font-bold mb-6">Pipeline Control</h3>
<div class="space-y-4">
<div class="group cursor-pointer">
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-white">Current Stability</span>
<span class="text-sm font-mono text-brand-success">98.2%</span>
</div>
<div class="w-full h-1 bg-zinc-800 rounded-full overflow-hidden">
<div class="h-full w-[98%] bg-brand-success transition-all"></div>
</div>
</div>
<div class="group cursor-pointer">
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-white">Design Drift</span>
<span class="text-sm font-mono text-brand-danger" id="drift-score-display">0%</span>
</div>
<div class="w-full h-1 bg-zinc-800 rounded-full overflow-hidden">
<div id="drift-bar" class="h-full w-0 bg-brand-danger transition-all"></div>
</div>
</div>
</div>
</div>
<div class="mt-8 pt-8 border-t border-white/10 space-y-4">
<button id="fetch-btn" class="magnetic-btn w-full py-4 rounded-xl bg-zinc-900 border border-zinc-700 hover:border-white text-left group transition-all duration-300 relative overflow-hidden">
<div class="absolute inset-0 w-0 bg-zinc-800 transition-all duration-300 group-hover:w-full"></div>
<div class="relative flex items-center justify-between px-6">
<span class="font-ui font-medium tracking-wide group-hover:translate-x-2 transition-transform">Fetch New Release</span>
<svg class="w-5 h-5 text-brand-accent group-hover:rotate-12 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path></svg>
</div>
</button>
<button id="approve-btn" class="magnetic-btn hidden w-full py-4 rounded-xl bg-brand-accent text-black font-bold text-sm tracking-widest uppercase shadow-glow hover:bg-[#60a5fa] transition-all disabled:opacity-50 disabled:cursor-not-allowed">
Approve & Deploy
</button>
</div>
</div>
</div>
<!-- Footer -->
<footer class="mt-20 pt-8 border-t border-white/10 flex justify-between items-center text-xs text-zinc-600 font-ui tracking-wide">
<div>© 2024 Lumina Systems. All tokens verified.</div>
<div class="flex gap-6">
<a href="#" class="hover:text-white transition-colors">Documentation</a>
<a href="#" class="hover:text-white transition-colors">API Status</a>
</div>
</footer>
</div>
<!-- Custom Toast Notification -->
<div id="toast" class="fixed bottom-8 right-8 glass-panel px-6 py-4 rounded-xl text-white transform translate-y-20 opacity-0 transition-all duration-500 z-50 flex items-center gap-4 border-l-4 border-brand-success">
<svg class="w-6 h-6 text-brand-success" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg>
<span class="font-medium">Deployment Successful. Baseline updated.</span>
</div>
<!-- Scripts -->
<script>
/**
* ------------------------------------------------------------------
* CONFIGURATION & STATE
* ------------------------------------------------------------------
*/
const state = {
baseline: {
radius: 12,
color: '#1C1C21',
border: 'rgba(255,255,255,0.15)',
titleClass: 'text-white',
tagClass: 'text-brand-accent',
btnBg: 'bg-white',
btnText: 'text-black',
btnHoverText: 'text-white',
btnHoverBg: 'hover:bg-brand-accent'
},
proposed: {
radius: 4,
color: 'rgba(239,68,68,0.05)',
border: 'rgba(239,68,68,0.4)',
titleClass: 'text-red-400',
tagClass: 'text-red-400',
btnBg: 'bg-red-500',
btnText: 'text-white',
btnHoverText: 'text-white',
btnHoverBg: 'hover:bg-red-600'
},
diffThreshold: 5, // percentage change to flag drift
driftActive: false,
viewMode: 'baseline' // baseline, proposed, diff
};
// DOM Elements
const el = {
component: document.getElementById('component-under-test'),
ghost: document.getElementById('ghost-component'),
diffOverlay: document.getElementById('diff-overlay'),
title: document.getElementById('comp-title'),
tag: document.getElementById('comp-tag'),
btn: document.getElementById('comp-btn'),
previewStage: document.getElementById('preview-stage'),
driftList: document.getElementById('drift-list'),
driftBadge: document.getElementById('drift-badge'),
driftBar: document.getElementById('drift-bar'),
driftScore: document.getElementById('drift-score-display'),
fetchBtn: document.getElementById('fetch-btn'),
approveBtn: document.getElementById('approve-btn'),
btnBaseline: document.getElementById('btn-baseline'),
btnProposed: document.getElementById('btn-proposed'),
btnDiff: document.getElementById('btn-diff'),
toast: document.getElementById('toast')
};
/**
* ------------------------------------------------------------------
* THREE.JS BACKGROUND (Particles)
* ------------------------------------------------------------------
*/
const initThreeJS = () => {
const canvas = document.createElement('canvas');
canvas.id = 'bg-canvas';
// We insert manually to avoid conflicting with existing container
const container = document.getElementById('canvas-container');
container.appendChild(canvas);
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer({ canvas, alpha: true, antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
// Particles
const particlesGeometry = new THREE.BufferGeometry();
const count = 1200;
const positions = new Float32Array(count * 3);
for(let i = 0; i < count * 3; i++) {
positions[i] = (Math.random() - 0.5) * 20; // Spread
}
particlesGeometry.setAttribute('position', new THREE.BufferAttribute(positions, 3));
// Custom Shader Material or simple PointsMaterial for depth
const particlesMaterial = new THREE.PointsMaterial({
size: 0.02,
color: 0x3B82F6, // Brand Blue
transparent: true,
opacity: 0.6,
});
const particlesMesh = new THREE.Points(particlesGeometry, particlesMaterial);
scene.add(particlesMesh);
camera.position.z = 3;
// Animation Loop
const animate = () => {
requestAnimationFrame(animate);
// Gentle rotation
particlesMesh.rotation.x += 0.0003;
particlesMesh.rotation.y += 0.0005;
// Mouse interaction could be added here
renderer.render(scene, camera);
};
animate();
// Resize handler
window.addEventListener('resize', () => {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize(window.innerWidth, window.innerHeight);
});
};
/**
* ------------------------------------------------------------------
* LOGIC: DRIFT & DIFF MANAGEMENT
* ------------------------------------------------------------------
*/
const generateDriftData = () => {
// Simulate an incoming "release" that modifies tokens
return {
title: "v2.5.0-rc.1 (Release Candidate)",
changes: [
{ token: "borderRadius.primary", from: "12px", to: "4px", severity: "High" },
{ token: "colors.surfaceLight", from: "#1C1C21", to: "rgba(239,68,68,0.05)", severity: "High" },
{ token: "textColor.primary", from: "#FFFFFF", to: "#EF4444", severity: "High" },
{ token: "spacing.grid", from: "40px", to: "20px", severity: "Low" },
{ token: "fontWeight.button", from: "700", to: "500", severity: "Medium" }
]
};
};
const renderDriftList = (changes) => {
el.driftList.innerHTML = '';
changes.forEach((change, index) => {
const item = document.createElement('div');
item.className = 'p-3 bg-red-500/5 border border-red-500/20 rounded-lg flex items-center justify-between animate-slide-up';
item.style.animationFillMode = 'backwards';
item.style.animationDelay = `${index * 100}ms`;
const severityColor = change.severity === 'High' ? 'text-red-400' : 'text-yellow-500';
item.innerHTML = `
<div class="flex items-center gap-3">
<div class="w-2 h-2 rounded-full bg-brand-danger pulse"></div>
<div class="text-sm font-mono">
<span class="text-zinc-400">${change.token}</span>
</div>
</div>
<div class="flex items-center gap-4 text-sm font-mono">
<span class="line-through text-zinc-600">${change.from}</span>
<span class="${severityColor} transition-colors">➜ ${change.to}</span>
</div>
`;
el.driftList.appendChild(item);
});
};
const applyDiffVisuals = (mode) => {
el.component.style.transition = 'all 0.6s cubic-bezier(0.22, 1, 0.36, 1)';
if (mode === 'baseline') {
// Reset to baseline tokens
el.component.style.setProperty('--bg', state.baseline.color);
el.component.style.setProperty('--border', state.baseline.border);
el.component.style.setProperty('--rad', `${state.baseline.radius}px`);
el.title.className = `text-xl font-display font-bold leading-tight ${state.baseline.titleClass}`;
el.tag.className = `text-xs font-mono ${state.baseline.tagClass}`;
el.btn.className = `w-full py-3 rounded-lg ${state.baseline.btnBg} ${state.baseline.btnText} font-ui font-bold text-sm transition-colors ${state.baseline.btnHoverBg}`;
el.ghost.style.opacity = '0';
el.ghost.style.transform = 'translateY(20px)';
el.diffOverlay.style.transform = 'scaleX(0)';
el.btnBaseline.classList.add('bg-white/20', 'text-white', 'border-white/20');
el.btnBaseline.disabled = false;
el.btnProposed.classList.remove('bg-brand-accent', 'text-black');
el.btnProposed.classList.add('bg-transparent', 'text-brand-accent', 'border-brand-accent/50');
el.btnDiff.classList.remove('bg-brand-accent', 'text-black');
} else if (mode === 'proposed') {
// Apply proposed tokens
el.component.style.setProperty('--bg', state.proposed.color);
el.component.style.setProperty('--border', state.proposed.border);
el.component.style.setProperty('--rad', `${state.proposed.radius}px`);
el.title.className = `text-xl font-display font-bold leading-tight ${state.proposed.titleClass}`;
el.tag.className = `text-xs font-mono ${state.proposed.tagClass}`;
el.btn.className = `w-full py-3 rounded-lg ${state.proposed.btnBg} ${state.proposed.btnText} font-ui font-bold text-sm transition-colors ${state.proposed.btnHoverBg} shadow-[0_0_15px_rgba(239,68,68,0.4)]`;
el.ghost.style.opacity = '0'; // Ghost only for Diff overlay mode usually, but we keep it hidden
el.diffOverlay.style.transform = 'scaleX(0)';
// Active button state
el.btnProposed.classList.remove('bg-transparent', 'text-brand-accent', 'border-brand-accent/50');
el.btnProposed.classList.add('bg-brand-accent', 'text-black');
el.btnBaseline.classList.remove('bg-white/20', 'text-white');
el.btnBaseline.classList.add('bg-transparent', 'text-zinc-400', 'border-zinc-700');
el.btnBaseline.disabled = true; // Cannot go to baseline if drift exists logically? In this demo maybe allow.
el.btnDiff.classList.remove('bg-brand-accent', 'text-black');
} else if (mode === 'diff') {
// Show ghost behind component for visual comparison
const baselineValues = getComputedStyle(el.component);
const ghostRad = state.baseline.radius;
const ghostBg = state.baseline.color;
el.ghost.style.setProperty('--ghost-rad', `${ghostRad}px`);
el.ghost.style.setProperty('--ghost-bg', state.baseline.color === '#1C1C21' ? '#1C1C21' : 'rgba(255,255,255,0.05)');
el.ghost.style.transform = 'translateY(10px)'; // Offset slightly
el.ghost.style.opacity = '1';
el.diffOverlay.style.transform = 'scaleX(1)'; // Show red diff line at bottom
el.btnDiff.classList.add('bg-brand-accent', 'text-black');
el.btnDiff.classList.remove('bg-transparent', 'text-zinc-300');
}
};
const toggleDriftMode = (isActive) => {
state.driftActive = isActive;
if (isActive) {
el.previewStage.classList.add('drift-active');
el.driftBadge.textContent = "CRITICAL DRIFT DETECTED";
el.driftBadge.classList.remove('bg-transparent', 'border-zinc-700', 'text-zinc-500');
el.driftBadge.classList.add('bg-red-500/20', 'text-red-400', 'border-red-500/50', 'px-4');
el.approveBtn.classList.remove('hidden');
el.fetchBtn.classList.add('hidden');
el.driftBar.classList.add('bg-brand-danger');
el.driftBar.style.width = '85%'; // Arbitrary high drift
el.driftScore.textContent = '85%';
// Switch to proposed to show the "new" state automatically for user review
applyDiffVisuals('proposed');
} else {
el.previewStage.classList.remove('drift-active');
el.driftBadge.textContent = "System Aligned";
el.driftBadge.classList.add('bg-transparent', 'border-zinc-700', 'text-zinc-500');
el.driftBadge.classList.remove('bg-green-500/20', 'text-green-400', 'border-green-500/50', 'px-4');
el.approveBtn.classList.add('hidden');
el.fetchBtn.classList.remove('hidden');
el.driftBar.classList.remove('bg-brand-danger');
el.driftBar.classList.add('bg-brand-success');
el.driftBar.style.width = '0%';
el.driftScore.textContent = '0%';
}
};
/**
* ------------------------------------------------------------------
* INTERACTION HANDLERS
* ------------------------------------------------------------------
*/
// Color Copy
window.copyColor = (el) => {
const color = el.getAttribute('data-code');
navigator.clipboard.writeText(color).then(() => {
// Visual feedback
const original = el.innerHTML;
el.innerHTML = '<span class="text-[10px] italic">Copied!</span>';
setTimeout(() => el.innerHTML = original, 1000);
});
};
// Fetch Button
el.fetchBtn.addEventListener('click', () => {
// Simulate API loading
el.fetchBtn.disabled = true;
const originalContent = el.fetchBtn.innerHTML;
el.fetchBtn.innerHTML = `
<div class="flex items-center justify-between px-6">
<span class="font-ui font-medium">Scanning Repository...</span>
<svg class="animate-spin w-5 h-5 text-brand-accent" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg>
</div>
`;
setTimeout(() => {
// Restore button
el.fetchBtn.innerHTML = originalContent;
el.fetchBtn.disabled = false;
// Trigger Drift
const driftData = generateDriftData();
renderDriftList(driftData.changes);
toggleDriftMode(true);
// Switch view to "Proposed" automatically
applyDiffVisuals('proposed');
}, 1500);
});
// Approve Button
el.approveBtn.addEventListener('click', () => {
// Animation
el.approveBtn.innerHTML = "Deploying...";
setTimeout(() => {
// Update baseline to match proposed (logically clearing drift)
state.baseline = { ...state.proposed }; // Deep copy would be better but simple assignment works for ref
toggleDriftMode(false);
// Reset Drift List UI
el.driftList.innerHTML = `
<div class="text-sm text-zinc-500 italic font-light py-4 text-center border border-dashed border-green-900/50 rounded-xl text-green-400">
Design Tokens synchronized successfully.
</div>
`;
// Show Toast
el.toast.classList.remove('translate-y-20', 'opacity-0');
setTimeout(() => {
el.toast.classList.add('translate-y-20', 'opacity-0');
}, 3000);
el.approveBtn.innerHTML = "Approve & Deploy";
}, 1200);
});
// View Mode Buttons
el.btnBaseline.addEventListener('click', () => applyDiffVisuals('baseline'));
el.btnProposed.addEventListener('click', () => applyDiffVisuals('proposed'));
el.btnDiff.addEventListener('click', () => applyDiffVisuals('diff'));
// Initially set Baseline as active state
el.btnBaseline.addEventListener('load', applyDiffVisuals('baseline'));
/**
* ------------------------------------------------------------------
* ASSETS: MAGNETIC BUTTONS & ANIMATIONS
* ------------------------------------------------------------------
*/
const initInteractions = () => {
// Magnetic Effect
const magnets = document.querySelectorAll('.magnetic-wrap, .magnetic-btn');
magnets.forEach((magnet) => {
magnet.addEventListener('mousemove', (e) => {
const rect = magnet.getBoundingClientRect();
const x = e.clientX - rect.left - rect.width / 2;
const y = e.clientY - rect.top - rect.height / 2;
gsap.to(magnet, {
x: x * 0.3,
y: y * 0.3,
duration: 0.3,
ease: 'power2.out'
});
});
magnet.addEventListener('mouseleave', () => {
gsap.to(magnet, {
x: 0,
y: 0,
duration: 0.8,
ease: 'elastic.out(1, 0.3)'
});
});
});
// GSAP Entrance Animations
gsap.registerPlugin(ScrollTrigger);
const tl = gsap.timeline();
tl.from('header', { y: -50, opacity: 0, duration: 1, ease: 'power3.out' })
.from('.grid > div', {
y: 30,
opacity: 0,
duration: 0.8,
stagger: 0.1,
ease: 'power3.out'
}, '-=0.5');
};
/**
* ------------------------------------------------------------------
* INITIALIZATION
* ------------------------------------------------------------------
*/
window.addEventListener('DOMContentLoaded', () => {
initThreeJS();
initInteractions();
// Set initial baseline visual explicitly
applyDiffVisuals('baseline');
});
</script>
</body>
</html>