From a844b262504197a192e724ddd40a11987e6f5b67 Mon Sep 17 00:00:00 2001 From: chenchun Date: Tue, 1 Sep 2026 20:33:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B7=AF=E7=94=B1=E8=BD=AC=E5=9C=BA+?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5+=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E6=9D=A1+=E5=B8=B8=E6=98=BE=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E7=BA=BF+=E9=82=AE=E7=AE=B1=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 FullscreenTransitionProvider + RouteTransitionOverlay: cover(0.8s b1 遮罩 wipe) → push → reveal 状态机(原 73475/34841 移植), Work 卡片与详情页链接全部走 startNavigation(同路径点击回顶部) - 新增 app/work/[slug] 详情页:content/workArticles.ts 从原站 6 个详情页 1:1 提取(MDX 文章+Metadata+iframe 预览+Links),/2026 锁定时渲染解锁屏 - 新增 CustomScrollbar:桌面右缘 SVG 轨道+拖拽 thumb(188 轨道/min20)、 点击跳转、2s 自动隐藏;移动端底部进度环回顶按钮(原 72443 移植) - BackgroundGrid 重写为原版算法(3 行十字/12px 缺口/12 列内分数纵线, 主页 loading 时隐藏其余时间常显);层叠改为原版结构:canvas z-auto 最前 → grid z-20 → DOM 内容,移除各 section 的 z-30 - 修复 BGM:持久化开启时首次手势自动恢复播放(autoplay 策略被拒后 pointerdown/keydown/touchstart 重试),enabled 闭包改用 ref - 页脚邮箱改为 chenchun@virtheart.com --- app/layout.tsx | 28 ++- app/page.tsx | 6 +- app/work/[slug]/page.tsx | 270 +++++++++++++++++++++ components/canvas/HeroScene.tsx | 6 +- components/dom/BackgroundGrid.tsx | 126 ++++++---- components/dom/CustomScrollbar.tsx | 273 ++++++++++++++++++++++ components/dom/FooterSection.tsx | 23 +- components/dom/HyperSpaceSection.tsx | 2 +- components/dom/RouteTransitionOverlay.tsx | 164 +++++++++++++ components/dom/WorkSection.tsx | 30 ++- content/workArticles.ts | 267 +++++++++++++++++++++ lib/routeTransition.tsx | 131 +++++++++++ lib/scrollEnv.ts | 37 ++- lib/useBgm.ts | 40 +++- lib/workItems.ts | 6 +- 15 files changed, 1325 insertions(+), 84 deletions(-) create mode 100644 app/work/[slug]/page.tsx create mode 100644 components/dom/CustomScrollbar.tsx create mode 100644 components/dom/RouteTransitionOverlay.tsx create mode 100644 content/workArticles.ts create mode 100644 lib/routeTransition.tsx diff --git a/app/layout.tsx b/app/layout.tsx index 908e0ee..6541ee2 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -4,9 +4,12 @@ import "./globals.css"; import SmoothScroller from "@/components/dom/SmoothScroller"; import Header from "@/components/dom/Header"; import BackgroundGrid from "@/components/dom/BackgroundGrid"; +import CustomScrollbar from "@/components/dom/CustomScrollbar"; import LoadingOverlay from "@/components/dom/LoadingOverlay"; import { HeroScene } from "@/components/canvas/HeroScene"; import { PasscodeAccessProvider } from "@/components/dom/PasscodeAccess"; +import { FullscreenTransitionProvider } from "@/lib/routeTransition"; +import RouteTransitionOverlay from "@/components/dom/RouteTransitionOverlay"; import { getPasscodeAccessServer } from "@/lib/passcodeServer"; const tiktokSans = localFont({ @@ -39,15 +42,26 @@ export default async function RootLayout({ }>) { const initialAccess = await getPasscodeAccessServer(); return ( - + - - - -
- {children} - + + {/* Original stacking (1:1): the WebGL canvas host is a plain `fixed` + z-auto element first in the body; the grid overlay (z-20) comes + AFTER it in DOM order so it paints above the canvas, exactly like + the original's main > canvas + z-20 grid sibling. */} + + + +
+ {children} + + + + diff --git a/app/page.tsx b/app/page.tsx index caaf99c..ccde5a3 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -24,7 +24,7 @@ export default function Home() { data-section="banner" className="grid grid-cols-12 grid-rows-[auto_1fr] px-4 lg:px-14 py-18 lg:py-24 w-full h-dvh lg:h-screen" > -
+

@@ -39,7 +39,7 @@ export default function Home() {
@@ -49,7 +49,7 @@ export default function Home() {
{/* Signature / About Section */} -
+

+ *

+ *
+ *
h1 + date + hr + year
+ *
blocks
+ *
+ * + * Content comes from content/workArticles.ts (extracted from the live + * pages). Passcode-protected scopes (/2026) render the unlock screen when + * locked, exactly like the original. + */ +import { Suspense, useMemo } from "react"; +import Link from "next/link"; +import { useParams } from "next/navigation"; +import { + WORK_ARTICLES, + type ArticleBlock, + type InlineSeg, +} from "@/content/workArticles"; +import { usePasscodeAllowed } from "@/components/dom/PasscodeAccess"; +import { useRouteTransitionController } from "@/lib/routeTransition"; +import { PasscodeUnlockScreen } from "@/components/dom/PasscodeUnlockScreen"; +import { buildPasscodeUnlockHref, primaryPasscodePath, scopeToPath } from "@/lib/passcode"; +import CustomScrollbar from "@/components/dom/CustomScrollbar"; + +const PROSE_CLASS = + "[&_p+p]:mt-3 [&_p]:mb-0 text-l2 [&_p]:text-sm [&_p]:text-l1 [&_p]:leading-relaxed lg:[&_p]:text-base"; + +function Inline({ segs }: { segs: InlineSeg[] }) { + return ( + <> + {segs.map((s, i) => + s.t === "link" ? ( + + {s.v} + + ) : ( + {s.v} + ) + )} + + ); +} + +function Block({ block }: { block: ArticleBlock }) { + switch (block.type) { + case "p": + return ( +

+ +

+ ); + case "h2": + return

{block.text}

; + case "h3": + return

{block.text}

; + case "img": + // eslint-disable-next-line @next/next/no-img-element -- original uses plain img with cursor-zoom-in + return ( + + ); + case "hr": + return
; + case "list": + return block.ordered ? ( +
    + {block.items.map((li, i) => ( +
  1. + +
  2. + ))} +
+ ) : ( +
    + {block.items.map((li, i) => ( +
  • + +
  • + ))} +
+ ); + case "quote": + return ( +
+ {block.items.map((q, i) => ( +

+ {q} +

+ ))} +
+ ); + case "code": + return ( +
+          {block.text}
+        
+ ); + default: + return null; + } +} + +function Article({ slug }: { slug: string }) { + const article = WORK_ARTICLES[slug]; + if (!article) { + return ( +
+
+
+
+

+ 404 +

+

+ No article for this work yet. +

+
+

+ + ← Home + +

+
+
+
+
+ ); + } + return ( +
+
+
+
+

+ {article.title} +

+

+ {article.date} +

+
+

+ {article.year} +

+
+
+ {article.blocks.map((b, i) => ( + + ))} + {article.iframe && ( +