// U-CENTER — Keyboard editor (all in one file to avoid cross-file Babel scoping issues) // ==================== KEYBOARD LAYOUT DATA ==================== const KB_ROWS = [ // Row 0 — Function [ { code: 'Esc', label: 'Esc' }, { code: 'gap', w: 0.5, type: 'gap' }, { code: 'F1', label: 'F1' }, { code: 'F2', label: 'F2' }, { code: 'F3', label: 'F3' }, { code: 'F4', label: 'F4' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'F5', label: 'F5' }, { code: 'F6', label: 'F6' }, { code: 'F7', label: 'F7' }, { code: 'F8', label: 'F8' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'F9', label: 'F9' }, { code: 'F10', label: 'F10' }, { code: 'F11', label: 'F11' }, { code: 'F12', label: 'F12' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'PrtSc', label: 'Druck', sub: 'S-Abf' }, { code: 'ScrLk', label: 'Rollen' }, { code: 'Pause', label: 'Pause', sub: 'Untbr' }, ], // Row 1 — Numbers (DE ISO) [ { code: 'Grave', label: '^', sub: '°' }, { code: '1', label: '1', sub: '!' }, { code: '2', label: '2', sub: '"' }, { code: '3', label: '3', sub: '§' }, { code: '4', label: '4', sub: '$' }, { code: '5', label: '5', sub: '%' }, { code: '6', label: '6', sub: '&' }, { code: '7', label: '7', sub: '/' }, { code: '8', label: '8', sub: '(' }, { code: '9', label: '9', sub: ')' }, { code: '0', label: '0', sub: '=' }, { code: 'ss', label: 'ß', sub: '?' }, { code: 'accent', label: '´', sub: '`' }, { code: 'Backspace', label: 'Backspace', w: 2, type: 'mod' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'Ins', label: 'Einfg' }, { code: 'Home', label: 'Pos1' }, { code: 'PgUp', label: 'Bild', sub: '↑' }, ], // Row 2 — QWERTZ [ { code: 'Tab', label: 'Tab', w: 1.5, type: 'mod' }, { code: 'Q', label: 'Q' }, { code: 'W', label: 'W' }, { code: 'E', label: 'E' }, { code: 'R', label: 'R' }, { code: 'T', label: 'T' }, { code: 'Z', label: 'Z' }, { code: 'U', label: 'U' }, { code: 'I', label: 'I' }, { code: 'O', label: 'O' }, { code: 'P', label: 'P' }, { code: 'Ue', label: 'Ü' }, { code: 'Plus', label: '+', sub: '*' }, { code: 'Enter', label: 'Enter', w: 1.5, type: 'mod' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'Del', label: 'Entf' }, { code: 'End', label: 'Ende' }, { code: 'PgDn', label: 'Bild', sub: '↓' }, ], // Row 3 — ASDF [ { code: 'Caps', label: 'Caps', w: 1.75, type: 'mod' }, { code: 'A', label: 'A' }, { code: 'S', label: 'S' }, { code: 'D', label: 'D' }, { code: 'F', label: 'F' }, { code: 'G', label: 'G' }, { code: 'H', label: 'H' }, { code: 'J', label: 'J' }, { code: 'K', label: 'K' }, { code: 'L', label: 'L' }, { code: 'Oe', label: 'Ö' }, { code: 'Ae', label: 'Ä' }, { code: 'Hash', label: '#', sub: "'" }, { code: 'EnterFake', w: 1.25, type: 'gap' }, ], // Row 4 — ZXCV [ { code: 'LShift', label: 'Shift', w: 1.25, type: 'mod' }, { code: 'Less', label: '<', sub: '>' }, { code: 'Y', label: 'Y' }, { code: 'X', label: 'X' }, { code: 'C', label: 'C' }, { code: 'V', label: 'V' }, { code: 'B', label: 'B' }, { code: 'N', label: 'N' }, { code: 'M', label: 'M' }, { code: 'Comma', label: ',', sub: ';' }, { code: 'Period', label: '.', sub: ':' }, { code: 'Minus', label: '-', sub: '_' }, { code: 'RShift', label: 'Shift', w: 2.75, type: 'mod' }, { code: 'gap', w: 1.3, type: 'gap' }, { code: 'Up', label: '↑', type: 'nav' }, { code: 'gap', w: 1, type: 'gap' }, ], // Row 5 — Bottom [ { code: 'LCtrl', label: 'Strg', w: 1.25, type: 'mod' }, { code: 'LWin', label: 'Win', w: 1.25, type: 'mod' }, { code: 'LAlt', label: 'Alt', w: 1.25, type: 'mod' }, { code: 'Space', w: 6.25, type: 'space' }, { code: 'RAlt', label: 'Alt Gr', w: 1.25, type: 'mod' }, { code: 'FN', label: 'FN', w: 1.25, type: 'mod' }, { code: 'Menu', label: 'Menu', w: 1.25, type: 'mod' }, { code: 'RCtrl', label: 'Strg', w: 1.25, type: 'mod' }, { code: 'gap', w: 0.3, type: 'gap' }, { code: 'Left', label: '←', type: 'nav' }, { code: 'Down', label: '↓', type: 'nav' }, { code: 'Right', label: '→', type: 'nav' }, ], ]; // ==================== RGB EFFECTS ==================== const RGB_EFFECTS = [ { id: 'static', label: 'Statisch', desc: 'Alle Tasten in einer Farbe', preview: 'solid' }, { id: 'wave', label: 'Farbwelle', desc: 'Horizontaler Regenbogen', preview: 'wave' }, { id: 'breathe', label: 'Atmen', desc: 'Sanftes Pulsieren', preview: 'breathe' }, { id: 'ripple', label: 'Ripple', desc: 'Welle bei Tastendruck', preview: 'ripple' }, { id: 'reactive',label: 'Reaktiv', desc: 'Taste leuchtet bei Druck', preview: 'reactive' }, { id: 'rain', label: 'Regen', desc: 'Zufällige Tropfen', preview: 'rain' }, { id: 'tornado', label: 'Tornado', desc: 'Rotierende Spirale', preview: 'tornado' }, { id: 'matrix', label: 'Matrix', desc: 'Fallende Zeichen', preview: 'matrix' }, { id: 'custom', label: 'Per-Key', desc: 'Jede Taste individuell', preview: 'perkey' }, ]; const RGB_PRESETS = [ { name: 'uRage Purple', colors: ['#a54cff', '#7b28e0', '#4b0f9a'] }, { name: 'Cyber Cyan', colors: ['#22e0ff', '#0ea5e9', '#0369a1'] }, { name: 'Toxic Green', colors: ['#7fff9a', '#22c55e', '#166534'] }, { name: 'Blood Red', colors: ['#ff4a4a', '#dc2626', '#7f1d1d'] }, { name: 'Solar Orange', colors: ['#ffb347', '#ea580c', '#7c2d12'] }, { name: 'Ocean Fade', colors: ['#7dd3fc', '#a78bfa', '#f472b6'] }, ]; const PROFILES = [ { id: 'default', name: 'Standard', color: '#a54cff', game: '—', keys: 0 }, { id: 'fps', name: 'FPS — Valorant', color: '#22e0ff', game: 'Valorant', keys: 14, active: true }, { id: 'mmo', name: 'MMO — WoW', color: '#7fff9a', game: 'WoW', keys: 48 }, { id: 'work', name: 'Produktivität', color: '#ffb347', game: 'Office', keys: 6 }, ]; const REMAP_CATEGORIES = [ { id: 'std', label: 'Standard-Taste', desc: 'QWERTZ-Zeichen belegen' }, { id: 'media', label: 'Medien', desc: 'Play/Pause, Vol, Track' }, { id: 'mouse', label: 'Maus', desc: 'Klicks, Scroll, DPI-Stage' }, { id: 'combo', label: 'Tastenkombination', desc: 'Ctrl+C, Alt+F4, …' }, { id: 'macro', label: 'Makro auslösen', desc: 'Gespeichertes Makro starten' }, { id: 'app', label: 'App / Datei', desc: 'Programm oder URL' }, ]; // ==================== HELPERS ==================== const KEY_UNIT = 42; const KEY_GAP = 4; function computeKeyColor(effectId, rowIdx, keyIdx, cols, baseHue, staticColor) { if (effectId === 'static') return staticColor; if (effectId === 'wave') { const h = (keyIdx / Math.max(cols - 1, 1)) * 360; return `hsl(${h} 85% 55%)`; } if (effectId === 'breathe') return staticColor; if (effectId === 'rain') { const rnd = ((rowIdx * 13 + keyIdx * 7) % 100) / 100; return rnd > 0.7 ? `hsl(${baseHue} 90% 60%)` : `hsl(${baseHue} 90% 22%)`; } if (effectId === 'tornado') { const cx = 8, cy = 3; const angle = Math.atan2(rowIdx - cy, keyIdx - cx) * (180 / Math.PI); return `hsl(${(angle + 180) % 360} 85% 55%)`; } if (effectId === 'matrix') { const on = ((rowIdx + keyIdx) * 17) % 5 === 0; return on ? 'hsl(140 90% 55%)' : 'hsl(140 90% 18%)'; } if (effectId === 'reactive' || effectId === 'ripple') { return `hsl(${baseHue} 60% 22%)`; } if (effectId === 'custom') { return `hsl(${(rowIdx * 60 + keyIdx * 15) % 360} 80% 50%)`; } return staticColor; } // ==================== SINGLE KEY ==================== function Key(props) { const k = props.k; const selected = props.selected; const onSelect = props.onSelect; const color = props.color; const brightness = props.brightness; const effect = props.effect; if (k.type === 'gap') { return
; } const w = (k.w || 1) * KEY_UNIT + ((k.w || 1) - 1) * KEY_GAP; const b = brightness / 100; return ( ); } // ==================== KEYBOARD VISUAL ==================== function KeyboardVisual(props) { const selected = props.selected; const setSelected = props.setSelected; const keyColors = props.keyColors; const brightness = props.brightness; const effect = props.effect; const staticColor = props.staticColor; return (