// Caret landing — primitives: Icon (Lucide), KeyCap, KeyCombo, Eyebrow, Alias const { useState, useEffect, useRef } = React; function pascal(n){ return n.replace(/(^|-)([a-z])/g,(_,__,c)=>c.toUpperCase()); } function Icon({ name, size = 22, stroke = 2, color = 'currentColor', style, fill = 'none' }) { const entry = window.lucide && window.lucide.icons && window.lucide.icons[pascal(name)]; // lucide 0.4xx: entry = ["svg", attrs, [ [tag, attrs], ... ]] const children = (Array.isArray(entry) && Array.isArray(entry[2])) ? entry[2] : []; return ( {children.map(([t, a], i) => React.createElement(t, { key: i, ...a }))} ); } // A single physical key. dark = use the HUD (dark surface) variant. function Key({ children, dark, lg }) { const cls = (dark ? 'kbd-d' : 'kbd') + (lg ? ' kbd-lg' : ''); return {children}; } // A combo like ⌥ + Space rendered as separate caps. function Combo({ keys, dark, lg, sep = false }) { return ( {keys.map((k, i) => ( {i > 0 && sep && +} {k} ))} ); } function Eyebrow({ children, onMesh }) { return
{children}
; } function Alias({ children, dark }) { return {children}; } // Reveal-on-scroll wrapper (adds .rise once visible) function Reveal({ children, delay = 0, style, className = '' }) { const ref = useRef(null); const [seen, setSeen] = useState(false); useEffect(() => { const el = ref.current; if (!el) return; const io = new IntersectionObserver(([e]) => { if (e.isIntersecting) { setSeen(true); io.disconnect(); } }, { threshold: 0.12 }); io.observe(el); return () => io.disconnect(); }, []); return (
{children}
); } Object.assign(window, { Icon, Key, Combo, Eyebrow, Alias, Reveal });