import { motion, AnimatePresence } from "framer-motion"; import type { ThemeProps } from "../../types"; import logo from "../../assets/icon.png"; import "./aurora.css"; // 15 根频谱的交错延迟 const spectrumDelays = [ -0.2, -0.5, -0.1, -0.7, -0.3, -0.6, -0.2, -0.8, -0.4, -0.1, -0.5, -0.3, -0.7, -0.2, -0.6, ]; const mirrorBars = [ { h: 28 }, { h: 22 }, { h: 14 }, { h: 14 }, { h: 22 }, { h: 28 }, ]; export default function AuroraTheme({ config, state }: ThemeProps) { const { step, progress, installPath } = state; const { primaryColor, accentColor, successColor, texts } = config; const getStatusText = () => { for (let i = texts.progressFrames.length - 1; i >= 0; i--) { if (progress <= texts.progressFrames[i].limit) return texts.progressFrames[i].text; } return texts.progressFrames[texts.progressFrames.length - 1]?.text ?? ""; }; // 为每个 theme 实例注入 CSS 变量,让所有内嵌 rgba 也能从 config 派生 const cssVars: React.CSSProperties = { // @ts-expect-error -- CSS 自定义属性 "--theme-primary": primaryColor, "--theme-accent": accentColor, "--theme-success": successColor, }; return (
{/* 系统极光 */}
{/* 头部 */}
Logo
{config.appDisplayName}
{/* 主交互视窗 */}
{/* 步骤 1:欢迎 */} {step === 1 && (
{/* 镜像声谱 */}
{[false, true].map((flip) => (
{mirrorBars.map((b, i) => (
3 ? primaryColor : accentColor, } as React.CSSProperties } /> ))}
))}

{texts.welcomeTitle}

{texts.welcomeSubtitle}

{installPath}
)} {/* 步骤 2:安装中 */} {step === 2 && ( {/* 反应堆徽章 */} {[0, 0.7, 1.4].map((d) => (
))}
{/* 百分比 */} {progress}% {/* 状态文案 */} {getStatusText()} {/* 频谱 */} {spectrumDelays.map((d, i) => (
))} )} {/* 步骤 3:成功 */} {step === 3 && (
{/* 粒子爆发 */} {Array.from({ length: 12 }).map((_, i) => { const angle = (i / 12) * Math.PI * 2; const dx = Math.cos(angle) * 70; const dy = Math.sin(angle) * 70; const color = i % 3 === 0 ? successColor : i % 3 === 1 ? accentColor : "#a3e635"; return ( ); })}
{texts.successTitle} {texts.successSubtitle}
{texts.features.map((p, i) => ( {p.label} ))}
)}
{/* 底部操作区 */}
我已同意并接受{" "} {texts.licenseAgreement}
); }