Production-ready animations, transitions, backgrounds, and scenes for Remotion
TypeScript ai-agentsclaude-codedemo-videomcpmcp-servermodel-context-protocolmotion-designproduct-demoreactremotionshadcnvideo
{
"$schema": "https://ui.shadcn.com/schema/registry-item.json",
"name": "home-widget",
"title": "Home Widget",
"description": "A home screen widget is added and shows a weekly renders chart above app icons.",
"dependencies": ["remotion", "@remotion/google-fonts"],
"registryDependencies": ["@remocn/gsh"],
"files": [
{
"path": "registry/remocn/home-widget/index.tsx",
"content": "\"use client\";\n\nimport { loadFont } from \"@remotion/google-fonts/Onest\";\nimport type React from \"react\";\nimport { useId } from \"react\";\nimport {\n AbsoluteFill,\n Easing,\n interpolate,\n spring,\n useCurrentFrame,\n useVideoConfig,\n} from \"remotion\";\nimport type { GradientParams } from \"@/lib/remocn/gsh/gradient-engine\";\nimport { GshGround } from \"@/lib/remocn/gsh/gsh-ground\";\nimport type { GshPresetId } from \"@/lib/remocn/gsh/presets\";\n\nconst { fontFamily } = loadFont(\"normal\", {\n weights: [\"300\", \"400\"],\n subsets: [\"latin\"],\n});\n\nexport interface HomeWidgetProps {\n appName?: string;\n widgetName?: string;\n widgetDescription?: string;\n /** Size the user picks in the gallery and drops on the home screen. */\n size?: \"small\" | \"medium\";\n /** Headline number: counts from `from` to `to` once the widget is live. */\n stat?: { label: string; from: number; to: number; delta: string };\n /** Seven daily values for the bar chart; the last bar is today and grows live. */\n bars?: number[];\n accent?: string;\n speed?: number;\n /** `light` is a daytime wallpaper with light widgets; `dark` is dusk. */\n theme?: \"light\" | \"dark\";\n /** Off-device lines, one per beat: edit mode, gallery, live widget. */\n lines?: [string, string, string];\n ground?: GshPresetId;\n groundParams?: Partial<GradientParams>;\n}\n\nconst SW = 390;\nconst SH = 844;\nconst BEZEL = 12;\nconst BW = SW + BEZEL * 2;\nconst BH = SH + BEZEL * 2;\n\nconst ICON = 62;\nconst COL0 = 27;\nconst COL = 88;\nconst ROW0 = 74;\nconst ROW = 94;\nconst WH = ROW + ICON;\nconst SIZES = {\n small: { w: COL + ICON, h: WH },\n medium: { w: COL * 3 + ICON, h: WH },\n};\nconst SHEET_TOP = 54;\nconst PREVIEW_Y = 236;\n\nconst T_HOLD = 30;\nconst T_JIG = 46;\nconst T_PLUS = 66;\nconst T_ROW = 100;\nconst T_SWIPE = 122;\nconst T_SWIPE_UP = 132;\nconst T_ADD = 158;\nconst T_DONE = 198;\nconst T_LIVE = 206;\n\nconst clamp = { extrapolateLeft: \"clamp\", extrapolateRight: \"clamp\" } as const;\nconst glide = Easing.bezier(0.65, 0, 0.35, 1);\nconst camera = Easing.bezier(0.87, 0, 0.13, 1);\nconst easeOut = Easing.bezier(0.22, 1, 0.36, 1);\nconst sheetEase = Easing.bezier(0.32, 0.72, 0, 1);\nconst inOut = Easing.bezier(0.65, 0, 0.35, 1);\nconst exitEase = Easing.bezier(0.55, 0, 1, 0.45);\nconst HEAVY = { mass: 1, damping: 26, stiffness: 120 };\nconst CARD = { mass: 0.8, damping: 18, stiffness: 160 };\n\nconst LIGHT = {\n stage: \"rgba(244,243,240,0.24)\",\n copy: \"#16171a\",\n copyMuted: \"rgba(22,23,26,0.5)\",\n sky: [\"#3d7fd6\", \"#6fa6e4\", \"#a9cdee\", \"#e8f0f4\"],\n ridges: [\"#8eaacb\", \"#6a8db5\", \"#4a6f9b\", \"#2f5280\"],\n sun: \"#fff8e6\",\n widget: \"#ffffff\",\n text: \"#111113\",\n muted: \"#8a8a8e\",\n barIdle: \"#e3e3e8\",\n sheet: \"#f2f2f7\",\n group: \"#ffffff\",\n field: \"rgba(118,118,128,0.12)\",\n hair: \"rgba(60,60,67,0.14)\",\n blue: \"#007AFF\",\n badge: \"rgba(235,235,240,0.92)\",\n badgeInk: \"#3a3a3c\",\n chrome: \"rgba(255,255,255,0.32)\",\n phoneShadow:\n \"0 40px 80px rgba(30,32,40,0.2), 0 12px 28px rgba(30,32,40,0.12), 0 2px 6px rgba(30,32,40,0.08)\",\n};\nconst DARK: typeof LIGHT = {\n stage: \"rgba(6,4,4,0.3)\",\n copy: \"#f4f1ee\",\n copyMuted: \"rgba(244,241,238,0.5)\",\n sky: [\"#0d1530\", \"#2a2f5c\", \"#7a4e74\", \"#e09a7a\"],\n ridges: [\"#3b3a63\", \"#2a2b4c\", \"#1b1c36\", \"#11122a\"],\n sun: \"#ffd2a8\",\n widget: \"#232325\",\n text: \"#f5f5f7\",\n muted: \"#8d8d93\",\n barIdle: \"#3a3a3c\",\n sheet: \"#121214\",\n group: \"#232325\",\n field: \"rgba(118,118,128,0.24)\",\n hair: \"rgba(255,255,255,0.1)\",\n blue: \"#0A84FF\",\n badge: \"rgba(72,72,74,0.94)\",\n badgeInk: \"#f5f5f7\",\n chrome: \"rgba(255,255,255,0.2)\",\n phoneShadow: \"0 40px 90px rgba(0,0,0,0.55), 0 12px 30px rgba(0,0,0,0.4)\",\n};\ntype Palette = typeof LIGHT;\n\nconst PATH = {\n remocn:\n \"M4 6.5A2.5 2.5 0 016.5 4h11A2.5 2.5 0 0120 6.5v11a2.5 2.5 0 01-2.5 2.5h-11A2.5 2.5 0 014 17.5zM10 9v6l5-3z\",\n search: \"M10.5 4a6.5 6.5 0 110 13 6.5 6.5 0 010-13zM20 20l-4.8-4.8\",\n chevron: \"M9 6l6 6-6 6\",\n back: \"M15 18l-6-6 6-6\",\n plus: \"M12 5v14M5 12h14\",\n sun: \"M12 8a4 4 0 110 8 4 4 0 010-8zM12 2.5v2M12 19.5v2M2.5 12h2M19.5 12h2M5.3 5.3l1.4 1.4M17.3 17.3l1.4 1.4M5.3 18.7l1.4-1.4M17.3 6.7l1.4-1.4\",\n play: \"M8 5.5v13l10-6.5z\",\n skip: \"M6 6v12l8.5-6zM18 6v12\",\n};\n\ninterface AppDef {\n name: string;\n bg: [string, string];\n d: string;\n}\nconst APPS: AppDef[] = [\n {\n name: \"Orbitly\",\n bg: [\"#ff7a59\", \"#f0473c\"],\n d: \"M5 7h14v12H5zM5 11h14M9 4v4M15 4v4\",\n },\n {\n name: \"Lumen\",\n bg: [\"#5d6370\", \"#2f333b\"],\n d: \"M12 9a3.5 3.5 0 110 7 3.5 3.5 0 010-7zM4 8h16v11H4z\",\n },\n {\n name: \"Fernway\",\n bg: [\"#3fcf8e\", \"#1c9a63\"],\n d: \"M12 21s6-5.4 6-10.5a6 6 0 00-12 0C6 15.6 12 21 12 21zM12 8.5a2 2 0 110 4 2 2 0 010-4z\",\n },\n {\n name: \"Halcyon\",\n bg: [\"#5ab8ff\", \"#2f7fe8\"],\n d: \"M12 5v2M5 12H3M7 7L5.6 5.6M17 7l1.4-1.4M8 15.5a4.5 4.5 0 118 0M5 18.5h14\",\n },\n {\n name: \"Tessel\",\n bg: [\"#ffd65a\", \"#f5b52e\"],\n d: \"M7 4h10v16H7zM10 9h4M10 13h4\",\n },\n {\n name: \"Kitebase\",\n bg: [\"#4c8dff\", \"#2759e0\"],\n d: \"M4 7h16v10H4zM4 7l8 6 8-6\",\n },\n {\n name: \"Quarry\",\n bg: [\"#7b86a6\", \"#4b5470\"],\n d: \"M4 7.5A1.5 1.5 0 015.5 6H10l2 2h6.5A1.5 1.5 0 0120 9.5v8a1.5 1.5 0 01-1.5 1.5h-13A1.5 1.5 0 014 17.5z\",\n },\n { name: \"Pulse\", bg: [\"#ff6f91\", \"#e43f6f\"], d: \"M3 12h4l2-5 4 10 2-5h6\" },\n {\n name: \"Chord\",\n bg: [\"#ff8e5e\", \"#ef5b3b\"],\n d: \"M9 18V6l10-2v12M9 18a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zM19 16a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z\",\n },\n {\n name: \"Ledger\",\n bg: [\"#2fbf8f\", \"#14795a\"],\n d: \"M5 18V10M10 18V6M15 18v-5M20 18V8\",\n },\n {\n name: \"Atlas\",\n bg: [\"#53c7d9\", \"#2a8fb0\"],\n d: \"M12 3a9 9 0 110 18 9 9 0 010-18zM3 12h18M12 3c2.5 2.6 3.6 5.6 3.6 9s-1.1 6.4-3.6 9c-2.5-2.6-3.6-5.6-3.6-9s1.1-6.4 3.6-9z\",\n },\n {\n name: \"Tally\",\n bg: [\"#3a3a40\", \"#1c1c20\"],\n d: \"M6 4h12v16H6zM9 8h6M9 12h.01M12 12h.01M15 12h.01M9 16h.01M12 16h.01M15 16h.01\",\n },\n {\n name: \"Relay\",\n bg: [\"#5ee07a\", \"#2fb350\"],\n d: \"M12 4c4.4 0 8 3 8 6.8s-3.6 6.7-8 6.7c-1 0-2-.1-2.9-.4L5 19l1-3.6C4.8 14.2 4 12.6 4 10.8 4 7 7.6 4 12 4z\",\n },\n {\n name: \"Clockwork\",\n bg: [\"#2a2a2e\", \"#111114\"],\n d: \"M12 4a8 8 0 110 16 8 8 0 010-16zM12 8v4l3 2\",\n },\n {\n name: \"Frame\",\n bg: [\"#ffb34d\", \"#f07f2b\"],\n d: \"M4 6h16v12H4zM4 15l5-4 4 3 3-2 4 3\",\n },\n];\nconst DOCK: AppDef[] = [\n {\n name: \"Call\",\n bg: [\"#5ee07a\", \"#2fb350\"],\n d: \"M6.5 4h3l1.5 4-2 1.5a10 10 0 005.5 5.5L16 13l4 1.5v3a2 2 0 01-2 2A15 15 0 014.5 6a2 2 0 012-2z\",\n },\n APPS[12],\n APPS[10],\n APPS[8],\n];\nconst LIST = [\n \"Chord\",\n \"Fernway\",\n \"Halcyon\",\n \"Kitebase\",\n \"Ledger\",\n \"remocn\",\n \"Tessel\",\n];\nconst DAYS = [\"M\", \"T\", \"W\", \"T\", \"F\", \"S\", \"S\"];\n\nfunction Glyph({\n d,\n size = 24,\n color,\n sw = 1.8,\n fill = \"none\",\n}: {\n d: string;\n size?: number;\n color: string;\n sw?: number;\n fill?: string;\n}) {\n return (\n <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n <path\n d={d}\n fill={fill}\n stroke={color}\n strokeWidth={sw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n );\n}\n\nfunction AppTile({ app, size }: { app: AppDef; size: number }) {\n return (\n <div\n style={{\n width: size,\n height: size,\n borderRadius: size * 0.225,\n background: `linear-gradient(180deg, ${app.bg[0]}, ${app.bg[1]})`,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n flexShrink: 0,\n }}\n >\n <Glyph d={app.d} size={size * 0.52} color=\"#ffffff\" sw={1.7} />\n </div>\n );\n}\n\nfunction StatusIcons({ color }: { color: string }) {\n return (\n <div style={{ display: \"flex\", gap: 6, alignItems: \"center\" }}>\n <svg width=\"18\" height=\"12\" viewBox=\"0 0 18 12\">\n {[0, 1, 2, 3].map((i) => (\n <rect\n key={i}\n x={i * 4.6}\n y={9 - i * 3}\n width={3.2}\n height={3 + i * 3}\n rx={0.8}\n fill={color}\n />\n ))}\n </svg>\n <svg width=\"17\" height=\"12\" viewBox=\"0 0 17 12\">\n <path\n d=\"M8.5 11.5l2.4-2.9a3.6 3.6 0 00-4.8 0zM3.7 6.2a7 7 0 019.6 0l1.6-1.9a9.6 9.6 0 00-12.8 0zM.5 2.9a12 12 0 0116 0\"\n fill={color}\n stroke={color}\n strokeWidth={0.6}\n />\n </svg>\n <div\n style={{\n width: 26,\n height: 12.5,\n borderRadius: 4,\n border: `1px solid ${color}`,\n padding: 1.5,\n boxSizing: \"border-box\",\n }}\n >\n <div\n style={{\n width: \"80%\",\n height: \"100%\",\n borderRadius: 2,\n background: color,\n }}\n />\n </div>\n </div>\n );\n}\n\nfunction Frame({ children }: { children: React.ReactNode }) {\n const side = (s: \"left\" | \"right\", top: number, h: number) => (\n <div\n style={{\n position: \"absolute\",\n [s]: -2.5,\n top,\n width: 4,\n height: h,\n borderRadius: 2,\n background: \"linear-gradient(90deg,#6f6f75,#d6d6db 50%,#6f6f75)\",\n }}\n />\n );\n return (\n <div style={{ position: \"relative\", width: BW, height: BH }}>\n {side(\"left\", 168, 30)}\n {side(\"left\", 226, 60)}\n {side(\"left\", 298, 60)}\n {side(\"right\", 258, 96)}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 67,\n background:\n \"linear-gradient(140deg,#e4e4e8 0%,#8a8a91 16%,#cfcfd4 38%,#77777e 62%,#c8c8cd 84%,#8b8b91 100%)\",\n boxShadow: \"inset 0 0 0 1px rgba(0,0,0,0.35)\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n inset: 3,\n borderRadius: 64,\n background: \"#050506\",\n }}\n />\n <div\n style={{\n position: \"absolute\",\n left: BEZEL,\n top: BEZEL,\n width: SW,\n height: SH,\n borderRadius: 55,\n overflow: \"hidden\",\n background: \"#000\",\n }}\n >\n {children}\n <div\n style={{\n position: \"absolute\",\n top: 11,\n left: (SW - 124) / 2,\n width: 124,\n height: 36,\n borderRadius: 18,\n background: \"#000\",\n zIndex: 60,\n }}\n />\n <div\n style={{\n position: \"absolute\",\n bottom: 8,\n left: (SW - 136) / 2,\n width: 136,\n height: 5,\n borderRadius: 3,\n background: \"#ffffff\",\n zIndex: 60,\n }}\n />\n </div>\n </div>\n );\n}\n\nfunction Wallpaper({ c }: { c: Palette }) {\n const id = useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n const ridge = (y: number, amp: number, seed: number) => {\n let d = `M0 ${SH}L0 ${y}`;\n for (let x = 0; x <= SW; x += 6) {\n const h =\n Math.sin(x * 0.019 + seed) * amp +\n Math.sin(x * 0.051 + seed * 2.3) * amp * 0.35 +\n Math.sin(x * 0.17 + seed * 5.1) * amp * 0.08;\n d += `L${x} ${y + h}`;\n }\n return `${d}L${SW} ${SH}Z`;\n };\n return (\n <svg\n width={SW}\n height={SH}\n viewBox={`0 0 ${SW} ${SH}`}\n style={{ position: \"absolute\", inset: 0 }}\n >\n <defs>\n <linearGradient id={`sky${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0\" stopColor={c.sky[0]} />\n <stop offset=\"0.35\" stopColor={c.sky[1]} />\n <stop offset=\"0.6\" stopColor={c.sky[2]} />\n <stop offset=\"0.78\" stopColor={c.sky[3]} />\n </linearGradient>\n <radialGradient id={`sun${id}`} cx=\"0.62\" cy=\"0.6\" r=\"0.4\">\n <stop offset=\"0\" stopColor={c.sun} stopOpacity={0.9} />\n <stop offset=\"0.25\" stopColor={c.sun} stopOpacity={0.35} />\n <stop offset=\"1\" stopColor={c.sun} stopOpacity={0} />\n </radialGradient>\n {c.ridges.map((col, i) => (\n <linearGradient\n key={col}\n id={`r${i}${id}`}\n x1=\"0\"\n y1=\"0\"\n x2=\"0\"\n y2=\"1\"\n >\n <stop offset=\"0\" stopColor={col} />\n <stop offset=\"0.5\" stopColor={c.ridges[i + 1] ?? col} />\n </linearGradient>\n ))}\n </defs>\n <rect width={SW} height={SH} fill={`url(#sky${id})`} />\n <rect width={SW} height={SH} fill={`url(#sun${id})`} />\n {c.ridges.map((col, i) => (\n <path\n key={col}\n d={ridge(470 + i * 80, 34 - i * 4, i * 1.7 + 0.4)}\n fill={`url(#r${i}${id})`}\n />\n ))}\n </svg>\n );\n}\n\nfunction StatsWidget({\n c,\n accent,\n size,\n appName,\n stat,\n value,\n bars,\n}: {\n c: Palette;\n accent: string;\n size: \"small\" | \"medium\";\n appName: string;\n stat: NonNullable<HomeWidgetProps[\"stat\"]>;\n value: number;\n bars: number[];\n}) {\n const { w, h } = SIZES[size];\n const max = Math.max(...bars, 1);\n const medium = size === \"medium\";\n const chartH = medium ? 74 : 26;\n return (\n <div\n style={{\n width: w,\n height: h,\n borderRadius: 22,\n background: c.widget,\n padding: 15,\n boxSizing: \"border-box\",\n display: \"flex\",\n gap: 16,\n overflow: \"hidden\",\n }}\n >\n <div\n style={{\n flex: 1,\n display: \"flex\",\n flexDirection: \"column\",\n minWidth: 0,\n }}\n >\n <div style={{ display: \"flex\", alignItems: \"center\", gap: 6 }}>\n <div\n style={{\n width: 20,\n height: 20,\n borderRadius: 6,\n background: accent,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <Glyph d={PATH.remocn} size={14} color=\"#ffffff\" sw={2} />\n </div>\n <span style={{ fontSize: 13, fontWeight: 400, color: c.text }}>\n {appName}\n </span>\n </div>\n <div\n style={{\n marginTop: medium ? 16 : 12,\n fontSize: medium ? 34 : 30,\n fontWeight: 400,\n letterSpacing: \"-0.03em\",\n lineHeight: 1,\n color: c.text,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n {Math.round(value).toLocaleString(\"en-US\")}\n </div>\n <div style={{ fontSize: 12, color: c.muted, marginTop: 4 }}>\n {stat.label}\n </div>\n {medium ? (\n <div\n style={{\n marginTop: \"auto\",\n fontSize: 12,\n fontWeight: 400,\n color: \"#1f9d62\",\n }}\n >\n {stat.delta}\n </div>\n ) : (\n <div\n style={{\n marginTop: \"auto\",\n display: \"flex\",\n alignItems: \"flex-end\",\n gap: 4,\n height: chartH,\n }}\n >\n {bars.map((v, i) => (\n <div\n key={i}\n style={{\n flex: 1,\n height: Math.max(3, (v / max) * chartH),\n borderRadius: 2,\n background: i === bars.length - 1 ? accent : c.barIdle,\n }}\n />\n ))}\n </div>\n )}\n </div>\n {medium ? (\n <div\n style={{\n width: 138,\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"flex-end\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n alignItems: \"flex-end\",\n gap: 7,\n height: chartH,\n }}\n >\n {bars.map((v, i) => (\n <div\n key={i}\n style={{\n flex: 1,\n height: Math.max(4, (v / max) * chartH),\n borderRadius: 3,\n background: i === bars.length - 1 ? accent : c.barIdle,\n }}\n />\n ))}\n </div>\n <div style={{ display: \"flex\", gap: 7, marginTop: 6 }}>\n {DAYS.map((d, i) => (\n <span\n key={i}\n style={{\n flex: 1,\n textAlign: \"center\",\n fontSize: 12,\n fontWeight: 400,\n color: i === DAYS.length - 1 ? c.text : c.muted,\n }}\n >\n {d}\n </span>\n ))}\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\nfunction GalleryWidgets({ c, accent }: { c: Palette; accent: string }) {\n const card: React.CSSProperties = {\n position: \"absolute\",\n borderRadius: 22,\n overflow: \"hidden\",\n boxShadow: \"0 1px 3px rgba(0,0,0,0.06), 0 6px 16px -6px rgba(0,0,0,0.12)\",\n };\n return (\n <>\n <div\n style={{\n ...card,\n left: 20,\n top: 0,\n width: 168,\n height: 168,\n background: \"linear-gradient(180deg,#4a9cf0,#2a6fd6)\",\n color: \"#ffffff\",\n padding: 16,\n boxSizing: \"border-box\",\n }}\n >\n <div style={{ fontSize: 15, fontWeight: 400 }}>Lisbon</div>\n <div\n style={{\n fontSize: 44,\n fontWeight: 300,\n letterSpacing: \"-0.03em\",\n lineHeight: 1.05,\n }}\n >\n 21°\n </div>\n <div style={{ position: \"absolute\", left: 16, bottom: 16 }}>\n <Glyph d={PATH.sun} size={18} color=\"#ffd65a\" sw={2} />\n <div style={{ fontSize: 13, fontWeight: 400, marginTop: 4 }}>\n Sunny\n </div>\n <div style={{ fontSize: 12, opacity: 0.85 }}>H:24° L:16°</div>\n </div>\n </div>\n <div\n style={{\n ...card,\n left: 202,\n top: 0,\n width: 168,\n height: 168,\n background: c.group,\n padding: 16,\n boxSizing: \"border-box\",\n }}\n >\n <div\n style={{\n fontSize: 11,\n fontWeight: 400,\n color: \"#f0473c\",\n letterSpacing: \"0.04em\",\n }}\n >\n TUESDAY\n </div>\n <div\n style={{\n fontSize: 40,\n fontWeight: 400,\n color: c.text,\n lineHeight: 1.05,\n letterSpacing: \"-0.02em\",\n }}\n >\n 24\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 16,\n right: 16,\n bottom: 16,\n display: \"flex\",\n gap: 8,\n }}\n >\n <div style={{ width: 3, borderRadius: 2, background: accent }} />\n <div>\n <div style={{ fontSize: 13, fontWeight: 400, color: c.text }}>\n Design review\n </div>\n <div\n style={{\n fontSize: 12,\n color: c.muted,\n fontVariantNumeric: \"tabular-nums\",\n }}\n >\n 10:00–10:30\n </div>\n </div>\n </div>\n </div>\n <div\n style={{\n ...card,\n left: 20,\n top: 184,\n width: 350,\n height: 168,\n background: \"linear-gradient(135deg,#3a2a4a,#1d1a2a)\",\n padding: 16,\n boxSizing: \"border-box\",\n display: \"flex\",\n gap: 16,\n color: \"#ffffff\",\n }}\n >\n <svg\n width={136}\n height={136}\n viewBox=\"0 0 136 136\"\n style={{ borderRadius: 12, flexShrink: 0 }}\n >\n <rect width={136} height={136} fill=\"#ff8e5e\" />\n {[56, 42, 28, 14].map((r, i) => (\n <circle\n key={r}\n cx={92}\n cy={96}\n r={r}\n fill={[\"#ffb36b\", \"#ef5b3b\", \"#c43a54\", \"#5a2a6a\"][i]}\n />\n ))}\n </svg>\n <div style={{ display: \"flex\", flexDirection: \"column\", minWidth: 0 }}>\n <div style={{ fontSize: 12, fontWeight: 400, opacity: 0.6 }}>\n Now playing\n </div>\n <div\n style={{\n fontSize: 16,\n fontWeight: 400,\n marginTop: 6,\n lineHeight: 1.25,\n }}\n >\n Golden Hour Drive\n </div>\n <div style={{ fontSize: 13, opacity: 0.7, marginTop: 2 }}>\n Priya Raman\n </div>\n <div style={{ marginTop: \"auto\", display: \"flex\", gap: 22 }}>\n <Glyph\n d={PATH.play}\n size={22}\n color=\"#ffffff\"\n fill=\"#ffffff\"\n sw={1.2}\n />\n <Glyph\n d={PATH.skip}\n size={22}\n color=\"#ffffff\"\n fill=\"#ffffff\"\n sw={1.2}\n />\n </div>\n </div>\n </div>\n </>\n );\n}\n\nexport function HomeWidget({\n appName = \"remocn\",\n widgetName = \"Renders\",\n widgetDescription = \"Track renders and views at a glance.\",\n size = \"medium\",\n stat = {\n label: \"Renders this week\",\n from: 1236,\n to: 1284,\n delta: \"+12% vs last week\",\n },\n bars = [42, 58, 36, 70, 64, 88, 76],\n accent = \"#3B5BFD\",\n speed = 1,\n theme = \"light\",\n lines = [\n \"Hold the home screen.\",\n \"Pick the size that fits.\",\n \"Your week, one glance away.\",\n ],\n ground,\n groundParams,\n}: HomeWidgetProps) {\n const frame = useCurrentFrame();\n const { fps, width, height } = useVideoConfig();\n const f = frame * speed;\n const c: Palette = theme === \"dark\" ? DARK : LIGHT;\n const tall = height > width;\n const k = tall\n ? Math.min((height * 0.64) / BH, (width * 0.78) / BW)\n : (height * 0.92) / BH;\n const phoneCx = tall ? width / 2 : width * 0.69;\n const phoneCy = tall ? height - height * 0.035 - (BH * k) / 2 : height / 2;\n const W = SIZES[size];\n const medium = size === \"medium\";\n const remocnApp: AppDef = {\n name: appName,\n bg: [accent, accent],\n d: PATH.remocn,\n };\n\n const bump = (at: number) =>\n interpolate(f, [at - 1, at + 1, at + 6], [0, 1, 0], clamp);\n const rise = spring({ frame: f, fps, config: HEAVY });\n\n const jig =\n interpolate(f, [T_JIG, T_JIG + 6], [0, 1], clamp) *\n interpolate(f, [T_DONE + 1, T_DONE + 6], [1, 0], clamp);\n const jiggle = (i: number) => ({\n r: Math.sin((f / 7) * Math.PI * 2 + i * 1.9) * 1.7 * jig,\n y: Math.cos((f / 7) * Math.PI * 2 + i * 1.3) * 0.7 * jig,\n });\n\n const sheetIn = interpolate(f, [T_PLUS + 2, T_PLUS + 14], [0, 1], {\n ...clamp,\n easing: sheetEase,\n });\n const sheetOut = interpolate(f, [T_ADD + 1, T_ADD + 12], [0, 1], {\n ...clamp,\n easing: sheetEase,\n });\n const sheetY = SHEET_TOP + (SH - SHEET_TOP) * (1 - sheetIn + sheetOut);\n const sheetVis = sheetIn * (1 - sheetOut);\n const push = interpolate(f, [T_ROW + 2, T_ROW + 13], [0, 1], {\n ...clamp,\n easing: sheetEase,\n });\n const pageDrag = medium\n ? interpolate(f, [T_SWIPE, T_SWIPE_UP], [0, 0.6], {\n ...clamp,\n easing: inOut,\n }) +\n interpolate(f, [T_SWIPE_UP, T_SWIPE_UP + 12], [0, 0.4], {\n ...clamp,\n easing: easeOut,\n })\n : 0;\n const rowPress = bump(T_ROW);\n const addPress = bump(T_ADD - 1);\n\n const fly = spring({ frame: f - T_ADD, fps, config: CARD });\n const from = { x: (SW - W.w) / 2, y: SHEET_TOP + PREVIEW_Y };\n const slot = { x: COL0, y: ROW0 };\n const wx = from.x + (slot.x - from.x) * fly;\n const wy = from.y + (slot.y - from.y) * fly;\n const lift = Math.sin(Math.min(1, fly) * Math.PI) * 0.05;\n const landed = f >= T_ADD;\n\n const claims = new Set<number>();\n const span = medium ? 4 : 2;\n for (let r = 0; r < 2; r++)\n for (let col = 0; col < span; col++) claims.add(r * 4 + col);\n const freeCells: number[] = [];\n for (let i = 0; freeCells.length < APPS.length + 1; i++)\n if (!claims.has(i)) freeCells.push(i);\n const homeApps = [...APPS.slice(0, 11), remocnApp, ...APPS.slice(11, 15)];\n const cellXY = (cell: number) => ({\n x: COL0 + (cell % 4) * COL,\n y: ROW0 + Math.floor(cell / 4) * ROW,\n });\n\n const live = interpolate(f, [T_LIVE, T_LIVE + 50], [0, 1], {\n ...clamp,\n easing: easeOut,\n });\n const value = stat.from + (stat.to - stat.from) * live;\n const liveBars = bars.map((v, i) =>\n i === bars.length - 1 ? v * (0.4 + 0.6 * live) : v,\n );\n\n const camT = [\n 0,\n T_ROW + 4,\n T_ROW + 20,\n T_ADD - 6,\n T_ADD + 10,\n T_DONE + 4,\n T_DONE + 26,\n ];\n const camEase = { ...clamp, easing: camera };\n const camS = interpolate(\n f,\n camT,\n [1, 1, tall ? 1.1 : 1.08, tall ? 1.1 : 1.08, 1, 1, tall ? 1.22 : 1.36],\n camEase,\n );\n const camFy = interpolate(\n f,\n camT,\n [\n BH / 2,\n BH / 2,\n tall ? BEZEL + 468 : BH / 2,\n tall ? BEZEL + 468 : BH / 2,\n BH / 2,\n BH / 2,\n BEZEL + ROW0 + WH / 2 + 30,\n ],\n camEase,\n );\n const camFx = interpolate(\n f,\n camT,\n [BW / 2, BW / 2, BW / 2, BW / 2, BW / 2, BW / 2, BEZEL + COL0 + W.w / 2],\n camEase,\n );\n const S = k * camS;\n\n const rowIdx = LIST.indexOf(\"remocn\");\n const listTop = SHEET_TOP + 64 + 352 + 20;\n const touches = [\n { t: 16, x: 270, y: 600 },\n { t: T_HOLD, x: 210, y: 486 },\n { t: T_PLUS, x: 40, y: 30 },\n { t: T_ROW, x: 120, y: listTop + rowIdx * 50 + 25 },\n ...(medium\n ? [\n { t: T_SWIPE, x: 310, y: SHEET_TOP + PREVIEW_Y + 78 },\n { t: T_SWIPE_UP, x: 120, y: SHEET_TOP + PREVIEW_Y + 70 },\n ]\n : []),\n { t: T_ADD - 1, x: SW / 2 + 10, y: SH - 64 },\n { t: T_DONE, x: SW - 48, y: 30 },\n ];\n let touch = { x: touches[0].x, y: touches[0].y };\n for (let i = 0; i < touches.length - 1; i++) {\n const a = touches[i];\n const b = touches[i + 1];\n const dragging = a.t === T_SWIPE && medium;\n const start = a.t === T_HOLD ? T_JIG + 6 : dragging ? a.t : a.t + 3;\n const end = dragging ? b.t : b.t - 2;\n if (f >= start) {\n const p = Math.min(1, (f - start) / (end - start));\n const e = dragging ? inOut(p) : glide(p);\n const arc = dragging ? 0 : Math.sin(Math.PI * e) * 24;\n touch = {\n x: a.x + (b.x - a.x) * e + arc * 0.5,\n y: a.y + (b.y - a.y) * e - arc * 0.5,\n };\n }\n }\n const down = Math.min(\n 1,\n interpolate(\n f,\n [T_HOLD - 1, T_HOLD + 1, T_JIG + 4, T_JIG + 6],\n [0, 1, 1, 0],\n clamp,\n ) +\n bump(T_PLUS) +\n bump(T_ROW) +\n (medium\n ? interpolate(\n f,\n [T_SWIPE - 2, T_SWIPE, T_SWIPE_UP, T_SWIPE_UP + 2],\n [0, 1, 1, 0],\n clamp,\n )\n : 0) +\n bump(T_ADD - 1) +\n bump(T_DONE),\n );\n const touchOpacity = interpolate(\n f,\n [16, 22, T_DONE + 3, T_DONE + 8],\n [0, 1, 1, 0],\n clamp,\n );\n const plusPress = bump(T_PLUS);\n const donePress = bump(T_DONE);\n\n const statusOp = 1 - jig;\n const editOp =\n interpolate(f, [T_JIG, T_JIG + 5], [0, 1], clamp) *\n interpolate(f, [T_DONE + 1, T_DONE + 5], [1, 0], clamp);\n const homeDim = sheetVis;\n\n const widgetEl = (\n <StatsWidget\n c={c}\n accent={accent}\n size={size}\n appName={appName}\n stat={stat}\n value={value}\n bars={liveBars}\n />\n );\n const badge = (op: number) => (\n <div\n style={{\n position: \"absolute\",\n left: -7,\n top: -7,\n width: 22,\n height: 22,\n borderRadius: 11,\n background: c.badge,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: op,\n transform: `scale(${0.9 + op * 0.1})`,\n boxShadow: \"0 1px 3px rgba(0,0,0,0.18)\",\n }}\n >\n <div\n style={{\n width: 10,\n height: 2,\n borderRadius: 1,\n background: c.badgeInk,\n }}\n />\n </div>\n );\n\n return (\n <AbsoluteFill style={{ fontFamily, fontWeight: 400, overflow: \"hidden\" }}>\n <GshGround\n preset={ground ?? (theme === \"dark\" ? \"ember\" : \"paper-crease\")}\n params={groundParams}\n timeOffset={theme === \"dark\" ? 3 : 6}\n timeScale={0.3}\n />\n <AbsoluteFill style={{ background: c.stage }} />\n <div\n style={{\n position: \"absolute\",\n left: tall ? width * 0.08 : width * 0.075,\n top: tall ? height * 0.07 : height / 2 - height * 0.09,\n width: tall ? width * 0.84 : width * 0.44,\n height: (tall ? width * 0.085 : height * 0.09) * 2.3,\n fontSize: tall ? width * 0.085 : height * 0.09,\n fontWeight: 300,\n lineHeight: 1.08,\n letterSpacing: \"-0.035em\",\n color: c.copy,\n }}\n >\n {lines.map((line, i) => {\n const starts = [6, T_PLUS, T_ADD + 4];\n const ends = [T_PLUS, T_ADD + 4, 99999];\n const inP = interpolate(f, [starts[i], starts[i] + 14], [0, 1], {\n ...clamp,\n easing: sheetEase,\n });\n const outP = interpolate(f, [ends[i] - 8, ends[i]], [0, 1], {\n ...clamp,\n easing: exitEase,\n });\n if (inP <= 0 || outP >= 1) return null;\n return (\n <div\n key={line}\n style={{\n position: \"absolute\",\n inset: 0,\n overflow: \"hidden\",\n paddingBottom: \"0.12em\",\n }}\n >\n <div\n style={{\n transform: `translateY(${(1 - inP) * 70 - outP * 40}%)`,\n opacity: Math.min(1, inP * 1.4) * (1 - outP),\n textWrap: \"balance\",\n }}\n >\n {line}\n </div>\n </div>\n );\n })}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: 0,\n width: BW,\n height: BH,\n transformOrigin: \"0 0\",\n transform: `translate(${phoneCx - camFx * S}px, ${phoneCy - camFy * S + (1 - rise) * height}px) scale(${S})`,\n WebkitFontSmoothing: \"antialiased\",\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n borderRadius: 67,\n boxShadow: c.phoneShadow,\n }}\n />\n <Frame>\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `scale(${1 - homeDim * 0.06})`,\n borderRadius: 40 * homeDim,\n overflow: \"hidden\",\n }}\n >\n <Wallpaper c={c} />\n {homeApps.map((app, i) => {\n const a = cellXY(i);\n const b = cellXY(freeCells[i]);\n const t0 = T_ADD + (homeApps.length - 1 - i) * 0.25;\n const mv = interpolate(f, [t0, t0 + 14], [0, 1], {\n ...clamp,\n easing: inOut,\n });\n const j = jiggle(i);\n return (\n <div\n key={app.name}\n style={{\n position: \"absolute\",\n left: a.x + (b.x - a.x) * mv,\n top: a.y + (b.y - a.y) * mv,\n width: ICON,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n gap: 5,\n transform: `translateY(${j.y}px) rotate(${j.r}deg)`,\n }}\n >\n <AppTile app={app} size={ICON} />\n <span\n style={{\n fontSize: 12,\n fontWeight: 400,\n color: \"#ffffff\",\n textShadow: \"0 1px 2px rgba(0,0,0,0.3)\",\n whiteSpace: \"nowrap\",\n }}\n >\n {app.name}\n </span>\n {badge(editOp)}\n </div>\n );\n })}\n <div\n style={{\n position: \"absolute\",\n left: (SW - 82) / 2,\n bottom: 128,\n height: 30,\n width: 82,\n borderRadius: 15,\n background: c.chrome,\n color: \"#ffffff\",\n fontSize: 13,\n fontWeight: 400,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 4,\n }}\n >\n <Glyph d={PATH.search} size={13} color=\"#ffffff\" sw={2.2} />\n Search\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 12,\n right: 12,\n bottom: 12,\n height: 94,\n borderRadius: 34,\n background: c.chrome,\n backdropFilter: \"blur(20px)\",\n }}\n />\n {DOCK.map((app, i) => {\n const j = jiggle(30 + i);\n return (\n <div\n key={app.name}\n style={{\n position: \"absolute\",\n left: COL0 + i * COL,\n top: SH - 12 - 94 + 16,\n transform: `translateY(${j.y}px) rotate(${j.r}deg)`,\n }}\n >\n <AppTile app={app} size={ICON} />\n {badge(editOp)}\n </div>\n );\n })}\n <div\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n right: 0,\n height: 54,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n padding: \"4px 30px 0 52px\",\n color: \"#ffffff\",\n opacity: statusOp,\n }}\n >\n <span style={{ fontSize: 17, fontWeight: 400 }}>9:41</span>\n <StatusIcons color=\"#ffffff\" />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 20,\n top: 15,\n width: 40,\n height: 30,\n borderRadius: 15,\n background: c.chrome,\n backdropFilter: \"blur(16px)\",\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n opacity: editOp,\n transform: `scale(${(0.94 + editOp * 0.06) * (1 - plusPress * 0.06)})`,\n }}\n >\n <Glyph d={PATH.plus} size={18} color=\"#ffffff\" sw={2.4} />\n </div>\n <div\n style={{\n position: \"absolute\",\n right: 20,\n top: 15,\n height: 30,\n padding: \"0 14px\",\n borderRadius: 15,\n background: c.chrome,\n backdropFilter: \"blur(16px)\",\n display: \"flex\",\n alignItems: \"center\",\n color: \"#ffffff\",\n fontSize: 15,\n fontWeight: 400,\n opacity: editOp,\n transform: `scale(${(0.94 + editOp * 0.06) * (1 - donePress * 0.06)})`,\n }}\n >\n Done\n </div>\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: \"#000\",\n opacity: homeDim * 0.3,\n }}\n />\n </div>\n {sheetVis > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: sheetY,\n height: SH - SHEET_TOP,\n borderRadius: \"38px 38px 0 0\",\n background: c.sheet,\n overflow: \"hidden\",\n zIndex: 20,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `translateX(${-push * SW * 0.3}px)`,\n opacity: 1 - push * 0.6,\n }}\n >\n <div\n style={{\n position: \"absolute\",\n left: 20,\n right: 20,\n top: 18,\n height: 36,\n borderRadius: 10,\n background: c.field,\n display: \"flex\",\n alignItems: \"center\",\n gap: 6,\n padding: \"0 10px\",\n color: c.muted,\n fontSize: 17,\n }}\n >\n <Glyph d={PATH.search} size={17} color={c.muted} sw={2.2} />\n Search Widgets\n </div>\n <div\n style={{ position: \"absolute\", left: 0, right: 0, top: 64 }}\n >\n <GalleryWidgets c={c} accent={accent} />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 20,\n right: 20,\n top: listTop - SHEET_TOP,\n borderRadius: 12,\n background: c.group,\n overflow: \"hidden\",\n }}\n >\n {LIST.map((name, i) => {\n const app =\n name === \"remocn\"\n ? remocnApp\n : (APPS.find((a) => a.name === name) as AppDef);\n const pressed = name === \"remocn\" ? rowPress : 0;\n return (\n <div\n key={name}\n style={{\n height: 50,\n display: \"flex\",\n alignItems: \"center\",\n gap: 12,\n padding: \"0 14px\",\n position: \"relative\",\n background: pressed > 0 ? c.field : \"transparent\",\n }}\n >\n <AppTile\n app={\n name === \"remocn\" ? { ...app, name: appName } : app\n }\n size={30}\n />\n <span style={{ flex: 1, fontSize: 17, color: c.text }}>\n {name === \"remocn\" ? appName : name}\n </span>\n <Glyph\n d={PATH.chevron}\n size={16}\n color={c.muted}\n sw={2.2}\n />\n {i > 0 ? (\n <div\n style={{\n position: \"absolute\",\n left: 56,\n right: 0,\n top: 0,\n height: 1,\n background: c.hair,\n }}\n />\n ) : null}\n </div>\n );\n })}\n </div>\n </div>\n {push > 0 ? (\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n background: c.sheet,\n transform: `translateX(${(1 - push) * SW}px)`,\n boxShadow: \"-8px 0 24px rgba(0,0,0,0.08)\",\n }}\n >\n <div style={{ position: \"absolute\", left: 14, top: 18 }}>\n <Glyph d={PATH.back} size={28} color={c.blue} sw={2.4} />\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 24,\n right: 24,\n top: 62,\n textAlign: \"center\",\n }}\n >\n <div\n style={{\n fontSize: 24,\n fontWeight: 400,\n letterSpacing: \"-0.02em\",\n color: c.text,\n }}\n >\n {widgetName}\n </div>\n <div\n style={{\n fontSize: 15,\n color: c.muted,\n marginTop: 6,\n textWrap: \"balance\",\n }}\n >\n {widgetDescription}\n </div>\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n top: PREVIEW_Y,\n display: \"flex\",\n transform: `translateX(${-pageDrag * SW}px)`,\n }}\n >\n {([\"small\", \"medium\"] as const).map((sz) => (\n <div\n key={sz}\n style={{\n width: SW,\n display: \"flex\",\n justifyContent: \"center\",\n opacity: f >= T_ADD && sz === size ? 0 : 1,\n }}\n >\n <div\n style={{\n boxShadow:\n \"0 1px 3px rgba(0,0,0,0.06), 0 10px 30px -8px rgba(0,0,0,0.18)\",\n borderRadius: 22,\n }}\n >\n <StatsWidget\n c={c}\n accent={accent}\n size={sz}\n appName={appName}\n stat={stat}\n value={stat.from}\n bars={bars}\n />\n </div>\n </div>\n ))}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 0,\n right: 0,\n top: PREVIEW_Y + WH + 32,\n display: \"flex\",\n justifyContent: \"center\",\n gap: 8,\n }}\n >\n {[0, 1].map((i) => (\n <div\n key={i}\n style={{\n width: 7,\n height: 7,\n borderRadius: 4,\n background: c.text,\n opacity: (pageDrag > 0.5 ? i === 1 : i === 0)\n ? 0.85\n : 0.2,\n }}\n />\n ))}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: 20,\n right: 20,\n bottom: 34,\n height: 50,\n borderRadius: 25,\n background: c.blue,\n color: \"#ffffff\",\n fontSize: 17,\n fontWeight: 400,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n gap: 6,\n transform: `scale(${1 - addPress * 0.03})`,\n }}\n >\n <Glyph d={PATH.plus} size={18} color=\"#ffffff\" sw={2.4} />\n Add Widget\n </div>\n </div>\n ) : null}\n </div>\n ) : null}\n <div\n style={{\n position: \"absolute\",\n inset: 0,\n transform: `scale(${1 - homeDim * 0.06})`,\n zIndex: 25,\n }}\n >\n {landed ? (\n <div\n style={{\n position: \"absolute\",\n left: wx,\n top: wy,\n width: W.w,\n zIndex: 6,\n transform: `translateY(${jiggle(20).y}px) rotate(${jiggle(20).r * 0.5}deg) scale(${1 + lift})`,\n filter: `drop-shadow(0 ${10 * lift * 20}px ${24 * lift * 20}px rgba(0,0,0,${0.25 * lift * 20}))`,\n }}\n >\n {widgetEl}\n <div\n style={{\n marginTop: 6,\n textAlign: \"center\",\n fontSize: 12,\n fontWeight: 400,\n color: \"#ffffff\",\n textShadow: \"0 1px 2px rgba(0,0,0,0.3)\",\n opacity: interpolate(fly, [0.7, 1], [0, 1], clamp),\n }}\n >\n {appName}\n </div>\n {badge(editOp * interpolate(fly, [0.8, 1], [0, 1], clamp))}\n </div>\n ) : null}\n </div>\n <div\n style={{\n position: \"absolute\",\n left: touch.x - 22,\n top: touch.y - 22,\n width: 44,\n height: 44,\n borderRadius: 22,\n background: \"rgba(255,255,255,0.22)\",\n border: \"1.5px solid rgba(255,255,255,0.8)\",\n boxShadow: \"0 2px 10px rgba(0,0,0,0.25)\",\n opacity: touchOpacity,\n transform: `scale(${1 - down * 0.14})`,\n zIndex: 50,\n }}\n />\n </Frame>\n </div>\n </AbsoluteFill>\n );\n}\n",
"type": "registry:component",
"target": "components/remocn/home-widget.tsx"
}
],
"type": "registry:component"
}