diff --git a/.gitattributes b/.gitattributes index a67d86b584d9af03f117b4d41f6444aa1bbc54cf..ec5cc2e047f89ca8252fb5d2f675cd56f5c2bf64 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,8 @@ quanxue/**/*.mp3 filter=lfs diff=lfs merge=lfs -text quanxue/**/*.woff2 filter=lfs diff=lfs merge=lfs -text quanxue/**/*.wasm filter=lfs diff=lfs merge=lfs -text quanxue/**/vendor/*.js filter=lfs diff=lfs merge=lfs -text +dengtaishan-src/public/fonts/cao.woff2 filter=lfs diff=lfs merge=lfs -text +dengtaishan-src/public/fonts/serif-900.woff2 filter=lfs diff=lfs merge=lfs -text +dengtaishan-src/public/fonts/kai.woff2 filter=lfs diff=lfs merge=lfs -text +dengtaishan-src/public/fonts/serif-500.woff2 filter=lfs diff=lfs merge=lfs -text +dengtaishan-src/public/fonts/xing.woff2 filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md index 750a93344be1c58935c0a6c0a14548f25de7af31..49a05e52a1307140e9470e7efb93407359f83377 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ pinned: false ## 四、实施步骤与进度(每完成一个大动作即推送同步) - [x] 1. 编写本计划(README)并推送 -- [ ] 2. 撰写旁白脚本,生成逐句旁白音频与时长清单;字体子集化 → 推送 +- [x] 2. 撰写旁白脚本,生成逐句旁白音频与时长清单;字体子集化 → 推送 - [ ] 3. 渲染引擎:时间轴、宣纸/水墨/山峦/云海/粒子等基础图层、字幕系统 → 推送 - [ ] 4. 九个篇章的场景动画(横屏 + 竖屏) → 推送 - [ ] 5. 程序化配乐与音效、混音与闪避、播放器(播放/暂停/拖动/章节跳转/全屏) → 推送 diff --git a/dengtaishan-src/index.html b/dengtaishan-src/index.html new file mode 100644 index 0000000000000000000000000000000000000000..8a3cc6a2a58863802426a9b21ef8102f5963857b --- /dev/null +++ b/dengtaishan-src/index.html @@ -0,0 +1,77 @@ + + + + + + + App + + + +
+ + + + + + Made by + + + + + + + + + + + + diff --git a/dengtaishan-src/package.json b/dengtaishan-src/package.json new file mode 100644 index 0000000000000000000000000000000000000000..308221113ec5d04b39e81d6441bd79528b1fc164 --- /dev/null +++ b/dengtaishan-src/package.json @@ -0,0 +1,85 @@ +{ + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "node scripts/check-env.cjs vite", + "build": "node scripts/check-env.cjs npm run build:client && npm run build:server", + "build:client": "vite build --outDir dist/client", + "build:server": "vite build --ssr src/entry-server.tsx --outDir dist/server", + "lint": "eslint .", + "preview": "vite preview", + "type-check": "tsc --noEmit --incremental" + }, + "dependencies": { + "@hookform/resolvers": "5.2.2", + "@radix-ui/react-accordion": "1.2.12", + "@radix-ui/react-aspect-ratio": "1.1.8", + "@radix-ui/react-avatar": "1.1.11", + "@radix-ui/react-checkbox": "1.3.3", + "@radix-ui/react-collapsible": "1.1.12", + "@radix-ui/react-context-menu": "2.2.16", + "@radix-ui/react-dialog": "1.1.15", + "@radix-ui/react-dropdown-menu": "2.1.16", + "@radix-ui/react-hover-card": "1.1.15", + "@radix-ui/react-label": "2.1.8", + "@radix-ui/react-menubar": "1.1.16", + "@radix-ui/react-navigation-menu": "1.2.14", + "@radix-ui/react-popover": "1.1.15", + "@radix-ui/react-progress": "1.1.8", + "@radix-ui/react-radio-group": "1.3.8", + "@radix-ui/react-scroll-area": "1.2.10", + "@radix-ui/react-select": "2.2.6", + "@radix-ui/react-separator": "1.1.8", + "@radix-ui/react-slider": "1.3.6", + "@radix-ui/react-slot": "1.2.4", + "@radix-ui/react-switch": "1.2.6", + "@radix-ui/react-tabs": "1.1.13", + "@radix-ui/react-toast": "1.2.15", + "@radix-ui/react-toggle": "1.1.10", + "@radix-ui/react-toggle-group": "1.1.11", + "@radix-ui/react-tooltip": "1.2.8", + "@surf-ai/theme": "latest", + "@tanstack/query-core": "5.94.5", + "@tanstack/react-query": "5.94.5", + "class-variance-authority": "0.7.1", + "clsx": "2.1.1", + "cmdk": "1.1.1", + "date-fns": "4.1.0", + "echarts": "5.6.0", + "echarts-for-react": "3.0.6", + "embla-carousel-react": "8.6.0", + "fflate": "^0.8.3", + "lucide-react": "0.454.0", + "mediabunny": "^1.62.1", + "next-themes": "0.4.6", + "react": "19.2.4", + "react-day-picker": "9.14.0", + "react-dom": "19.2.4", + "react-hook-form": "7.72.0", + "react-resizable-panels": "4.7.6", + "scheduler": "0.27.0", + "sonner": "1.7.4", + "tailwind-merge": "2.6.1", + "vaul": "1.1.2", + "zod": "3.25.76" + }, + "devDependencies": { + "@types/react": "19.2.14", + "@types/react-dom": "19.2.3", + "@types/node": "22.19.15", + "@eslint/js": "9.39.4", + "@vitejs/plugin-react": "4.7.0", + "@tailwindcss/vite": "4.2.2", + "eslint": "9.39.4", + "eslint-plugin-react-hooks": "5.2.0", + "eslint-plugin-react-refresh": "0.4.26", + "globals": "16.5.0", + "tailwindcss": "4.2.2", + "tw-animate-css": "1.4.0", + "typescript-eslint": "8.57.1", + "typescript": "5.9.3", + "vite": "6.4.2" + } +} diff --git a/dengtaishan-src/public/fonts/cao.woff2 b/dengtaishan-src/public/fonts/cao.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..e319c68c85444706ada2cc2b9f2e73ba978b51ab --- /dev/null +++ b/dengtaishan-src/public/fonts/cao.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9c738b21e85cb8e1d446616dc397b6c5022151561fd36858d36ce86efc94bdb +size 157584 diff --git a/dengtaishan-src/public/fonts/kai.woff2 b/dengtaishan-src/public/fonts/kai.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..020c0c541d86627001ccff814b855bfea0573f67 --- /dev/null +++ b/dengtaishan-src/public/fonts/kai.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d5b00f1017f8a2cc3bce26f41cae84b22d19b976b91c2eeec0168960f9c6eb5 +size 210396 diff --git a/dengtaishan-src/public/fonts/serif-500.woff2 b/dengtaishan-src/public/fonts/serif-500.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..b841f06796c11849e344799f4da55a9abf67df38 --- /dev/null +++ b/dengtaishan-src/public/fonts/serif-500.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a98e26a44e05f22c40bf6b6fc3fecb7421d43fc3721c8e95875f9199b2d257ce +size 129180 diff --git a/dengtaishan-src/public/fonts/serif-900.woff2 b/dengtaishan-src/public/fonts/serif-900.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..ce3d68b55a9c23d62326839323c54d94f90363ac --- /dev/null +++ b/dengtaishan-src/public/fonts/serif-900.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aefb1a52f29c12d8c410953d688c62b02b0daa53e0129f6dfbc23b8a6bfcc086 +size 129788 diff --git a/dengtaishan-src/public/fonts/xing.woff2 b/dengtaishan-src/public/fonts/xing.woff2 new file mode 100644 index 0000000000000000000000000000000000000000..bc7f6dc73487e43a384fea0a3136c464e13a2a0e --- /dev/null +++ b/dengtaishan-src/public/fonts/xing.woff2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:62ca6088670065e52a9d48836b4dde3d3404e5a7a2d22fabbce3f8e64628b6f5 +size 154916 diff --git a/dengtaishan-src/public/voice/a1.mp3 b/dengtaishan-src/public/voice/a1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a3674bbb2b312120dc4ff474e52dba32e7320cbb Binary files /dev/null and b/dengtaishan-src/public/voice/a1.mp3 differ diff --git a/dengtaishan-src/public/voice/a2.mp3 b/dengtaishan-src/public/voice/a2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..b30bbb995dffc790cd0f899a8d69313a8dfa5e8e Binary files /dev/null and b/dengtaishan-src/public/voice/a2.mp3 differ diff --git a/dengtaishan-src/public/voice/a3.mp3 b/dengtaishan-src/public/voice/a3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..628e7e572a220eed37677aab623a7a21c72a8332 Binary files /dev/null and b/dengtaishan-src/public/voice/a3.mp3 differ diff --git a/dengtaishan-src/public/voice/a4.mp3 b/dengtaishan-src/public/voice/a4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0707a49bd4e0c36f05ca5db49e3a7ba169a4c454 Binary files /dev/null and b/dengtaishan-src/public/voice/a4.mp3 differ diff --git a/dengtaishan-src/public/voice/a5.mp3 b/dengtaishan-src/public/voice/a5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..2f5ccf26fe3477a6b3ae226f79a84def5ebb1e09 Binary files /dev/null and b/dengtaishan-src/public/voice/a5.mp3 differ diff --git a/dengtaishan-src/public/voice/a6.mp3 b/dengtaishan-src/public/voice/a6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..93163f80d9533d8404b7910362e88cd1b9ded98e Binary files /dev/null and b/dengtaishan-src/public/voice/a6.mp3 differ diff --git a/dengtaishan-src/public/voice/a7.mp3 b/dengtaishan-src/public/voice/a7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..850949e5b61c935296c6c273189b810d73301c0e Binary files /dev/null and b/dengtaishan-src/public/voice/a7.mp3 differ diff --git a/dengtaishan-src/public/voice/a8.mp3 b/dengtaishan-src/public/voice/a8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d81a7b9ea85c18d41f985cafc15d959a9881651e Binary files /dev/null and b/dengtaishan-src/public/voice/a8.mp3 differ diff --git a/dengtaishan-src/public/voice/a9.mp3 b/dengtaishan-src/public/voice/a9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e05ff3dbd36296d3ceb7eea9a89849c42c79acdf Binary files /dev/null and b/dengtaishan-src/public/voice/a9.mp3 differ diff --git a/dengtaishan-src/public/voice/b1.mp3 b/dengtaishan-src/public/voice/b1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d70a1bf7d59d728d1ee192436a913ce9a03c749c Binary files /dev/null and b/dengtaishan-src/public/voice/b1.mp3 differ diff --git a/dengtaishan-src/public/voice/b10.mp3 b/dengtaishan-src/public/voice/b10.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a8ca1935c13742e7c997bf334d1aae0e20c9a87f Binary files /dev/null and b/dengtaishan-src/public/voice/b10.mp3 differ diff --git a/dengtaishan-src/public/voice/b11.mp3 b/dengtaishan-src/public/voice/b11.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..506d12fc8554f5f7a22f1a2d5ce76bf2fb3aa8dd Binary files /dev/null and b/dengtaishan-src/public/voice/b11.mp3 differ diff --git a/dengtaishan-src/public/voice/b12.mp3 b/dengtaishan-src/public/voice/b12.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e4367b2759cb09530390c3a449b062062718b02e Binary files /dev/null and b/dengtaishan-src/public/voice/b12.mp3 differ diff --git a/dengtaishan-src/public/voice/b13.mp3 b/dengtaishan-src/public/voice/b13.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..6b5c09f345fa18b41f2daf71d5401b1bd60fd145 Binary files /dev/null and b/dengtaishan-src/public/voice/b13.mp3 differ diff --git a/dengtaishan-src/public/voice/b14.mp3 b/dengtaishan-src/public/voice/b14.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8d1eb119defa6bbdad63308ae4fb66e60d1e508f Binary files /dev/null and b/dengtaishan-src/public/voice/b14.mp3 differ diff --git a/dengtaishan-src/public/voice/b15.mp3 b/dengtaishan-src/public/voice/b15.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..6674c11cc16f1b5b3fa998af6324ab28fcd58f46 Binary files /dev/null and b/dengtaishan-src/public/voice/b15.mp3 differ diff --git a/dengtaishan-src/public/voice/b16.mp3 b/dengtaishan-src/public/voice/b16.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0b8cf7d501b189a25eebc31e5a6ed30296d64fea Binary files /dev/null and b/dengtaishan-src/public/voice/b16.mp3 differ diff --git a/dengtaishan-src/public/voice/b2.mp3 b/dengtaishan-src/public/voice/b2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..19d2a54b3511707b540ee34945f90fe52cb9620e Binary files /dev/null and b/dengtaishan-src/public/voice/b2.mp3 differ diff --git a/dengtaishan-src/public/voice/b3.mp3 b/dengtaishan-src/public/voice/b3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..c7b5f8b85ebe28e2b558d195cc61af628786de35 Binary files /dev/null and b/dengtaishan-src/public/voice/b3.mp3 differ diff --git a/dengtaishan-src/public/voice/b4.mp3 b/dengtaishan-src/public/voice/b4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e9e768286a287434c247811491ab2a48e0568ef9 Binary files /dev/null and b/dengtaishan-src/public/voice/b4.mp3 differ diff --git a/dengtaishan-src/public/voice/b5.mp3 b/dengtaishan-src/public/voice/b5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..26dd8332a5af81e940ad1ec976db1406f2e604e0 Binary files /dev/null and b/dengtaishan-src/public/voice/b5.mp3 differ diff --git a/dengtaishan-src/public/voice/b6.mp3 b/dengtaishan-src/public/voice/b6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..644e7dbe4c3e77f0947159ef9993362800688b94 Binary files /dev/null and b/dengtaishan-src/public/voice/b6.mp3 differ diff --git a/dengtaishan-src/public/voice/b7.mp3 b/dengtaishan-src/public/voice/b7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..57981e39bb764e9004d5cff66da283c3d893638b Binary files /dev/null and b/dengtaishan-src/public/voice/b7.mp3 differ diff --git a/dengtaishan-src/public/voice/b8.mp3 b/dengtaishan-src/public/voice/b8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..659bff1fd6559c8e2f6c97d644206c6dd75eed35 Binary files /dev/null and b/dengtaishan-src/public/voice/b8.mp3 differ diff --git a/dengtaishan-src/public/voice/b9.mp3 b/dengtaishan-src/public/voice/b9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d7a43d597d8dbc57a671bcee2b12e36bc3b7b27a Binary files /dev/null and b/dengtaishan-src/public/voice/b9.mp3 differ diff --git a/dengtaishan-src/public/voice/c1.mp3 b/dengtaishan-src/public/voice/c1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0feada0e01be186b61ceadee70226e7e93c99817 Binary files /dev/null and b/dengtaishan-src/public/voice/c1.mp3 differ diff --git a/dengtaishan-src/public/voice/c10.mp3 b/dengtaishan-src/public/voice/c10.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e772d493721e55c57bbc3e1d34dc35eea10a7ce3 Binary files /dev/null and b/dengtaishan-src/public/voice/c10.mp3 differ diff --git a/dengtaishan-src/public/voice/c11.mp3 b/dengtaishan-src/public/voice/c11.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..5626f299bc5521f43bc55053ab1d0cfab5311ef4 Binary files /dev/null and b/dengtaishan-src/public/voice/c11.mp3 differ diff --git a/dengtaishan-src/public/voice/c12.mp3 b/dengtaishan-src/public/voice/c12.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fb4713c831da01afd1766b8d69d8597ab161e2a5 Binary files /dev/null and b/dengtaishan-src/public/voice/c12.mp3 differ diff --git a/dengtaishan-src/public/voice/c13.mp3 b/dengtaishan-src/public/voice/c13.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..cb6bdaac9e2f9f0950250af2e392daea2df21c0a Binary files /dev/null and b/dengtaishan-src/public/voice/c13.mp3 differ diff --git a/dengtaishan-src/public/voice/c14.mp3 b/dengtaishan-src/public/voice/c14.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..428c07de555ea567e2686d7d61e3ca6983aacb3a Binary files /dev/null and b/dengtaishan-src/public/voice/c14.mp3 differ diff --git a/dengtaishan-src/public/voice/c15.mp3 b/dengtaishan-src/public/voice/c15.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..49430ec1ffc94540a91703e03729bd8a9f9e64ba Binary files /dev/null and b/dengtaishan-src/public/voice/c15.mp3 differ diff --git a/dengtaishan-src/public/voice/c16.mp3 b/dengtaishan-src/public/voice/c16.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a28d799dd759495d003df75b6c5606101cd7b872 Binary files /dev/null and b/dengtaishan-src/public/voice/c16.mp3 differ diff --git a/dengtaishan-src/public/voice/c17.mp3 b/dengtaishan-src/public/voice/c17.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..55115b2f893fd0c73c5c74b495be48f3b096855a Binary files /dev/null and b/dengtaishan-src/public/voice/c17.mp3 differ diff --git a/dengtaishan-src/public/voice/c18.mp3 b/dengtaishan-src/public/voice/c18.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f60437f2168cfbb919db2971910321d75e8e2731 Binary files /dev/null and b/dengtaishan-src/public/voice/c18.mp3 differ diff --git a/dengtaishan-src/public/voice/c19.mp3 b/dengtaishan-src/public/voice/c19.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..ade2a26cc16c02409f2e097b2a5fa6a240e5947f Binary files /dev/null and b/dengtaishan-src/public/voice/c19.mp3 differ diff --git a/dengtaishan-src/public/voice/c2.mp3 b/dengtaishan-src/public/voice/c2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..4aa71fedf3de4659254d1d714081fa1b737b3c76 Binary files /dev/null and b/dengtaishan-src/public/voice/c2.mp3 differ diff --git a/dengtaishan-src/public/voice/c20.mp3 b/dengtaishan-src/public/voice/c20.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..896251df01f379496075615b70a2dd0055e8d721 Binary files /dev/null and b/dengtaishan-src/public/voice/c20.mp3 differ diff --git a/dengtaishan-src/public/voice/c21.mp3 b/dengtaishan-src/public/voice/c21.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e4a652847de667433b6501e9835517fcd5c23dfd Binary files /dev/null and b/dengtaishan-src/public/voice/c21.mp3 differ diff --git a/dengtaishan-src/public/voice/c22.mp3 b/dengtaishan-src/public/voice/c22.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..4e6b5e6056457b9361e8d062b558c71193ea2968 Binary files /dev/null and b/dengtaishan-src/public/voice/c22.mp3 differ diff --git a/dengtaishan-src/public/voice/c3.mp3 b/dengtaishan-src/public/voice/c3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..16cf20426de8630135521f8e09e8fe52fd19e23d Binary files /dev/null and b/dengtaishan-src/public/voice/c3.mp3 differ diff --git a/dengtaishan-src/public/voice/c4.mp3 b/dengtaishan-src/public/voice/c4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..ac3ca5db9f521aa983ebeef89fb5772f48d883c4 Binary files /dev/null and b/dengtaishan-src/public/voice/c4.mp3 differ diff --git a/dengtaishan-src/public/voice/c5.mp3 b/dengtaishan-src/public/voice/c5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..30824305122f46422e51d7104c08e331b4f2a89e Binary files /dev/null and b/dengtaishan-src/public/voice/c5.mp3 differ diff --git a/dengtaishan-src/public/voice/c6.mp3 b/dengtaishan-src/public/voice/c6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..07f9029a7c073d4d096521036a87b20cfd521550 Binary files /dev/null and b/dengtaishan-src/public/voice/c6.mp3 differ diff --git a/dengtaishan-src/public/voice/c7.mp3 b/dengtaishan-src/public/voice/c7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..7b31b7847a1217d8371277dc69f00fe0f1b743d9 Binary files /dev/null and b/dengtaishan-src/public/voice/c7.mp3 differ diff --git a/dengtaishan-src/public/voice/c8.mp3 b/dengtaishan-src/public/voice/c8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..ade5fd736214c4c9d22157458a379c9aa39222d7 Binary files /dev/null and b/dengtaishan-src/public/voice/c8.mp3 differ diff --git a/dengtaishan-src/public/voice/c9.mp3 b/dengtaishan-src/public/voice/c9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..9713ffbd8b897d044de13523e748b6c008811124 Binary files /dev/null and b/dengtaishan-src/public/voice/c9.mp3 differ diff --git a/dengtaishan-src/public/voice/d1.mp3 b/dengtaishan-src/public/voice/d1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..4a656d0515f721ef827dea789be465121a2f23ba Binary files /dev/null and b/dengtaishan-src/public/voice/d1.mp3 differ diff --git a/dengtaishan-src/public/voice/d2.mp3 b/dengtaishan-src/public/voice/d2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d24b6b35e0adb9aa3bba638ab947ca4cf7e24e6d Binary files /dev/null and b/dengtaishan-src/public/voice/d2.mp3 differ diff --git a/dengtaishan-src/public/voice/d3.mp3 b/dengtaishan-src/public/voice/d3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..98e524825fe7193c66ba67a2beabe9b2f1fe4d0c Binary files /dev/null and b/dengtaishan-src/public/voice/d3.mp3 differ diff --git a/dengtaishan-src/public/voice/d4.mp3 b/dengtaishan-src/public/voice/d4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..636337f404b5c4419b1fd7a58b4d64500f012fc4 Binary files /dev/null and b/dengtaishan-src/public/voice/d4.mp3 differ diff --git a/dengtaishan-src/public/voice/d5.mp3 b/dengtaishan-src/public/voice/d5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fd082dc0f22edcc3c6dcd6a12a3370a160aee4db Binary files /dev/null and b/dengtaishan-src/public/voice/d5.mp3 differ diff --git a/dengtaishan-src/public/voice/d6.mp3 b/dengtaishan-src/public/voice/d6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1696d7cb318e76b39ba3997a88b866a290326a27 Binary files /dev/null and b/dengtaishan-src/public/voice/d6.mp3 differ diff --git a/dengtaishan-src/public/voice/d7.mp3 b/dengtaishan-src/public/voice/d7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..6c5150d33f94a50947528003d1e3809f31aefb9e Binary files /dev/null and b/dengtaishan-src/public/voice/d7.mp3 differ diff --git a/dengtaishan-src/public/voice/e1.mp3 b/dengtaishan-src/public/voice/e1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..757e2e9392af93dbe5e2cb5f3575014aa01e1d93 Binary files /dev/null and b/dengtaishan-src/public/voice/e1.mp3 differ diff --git a/dengtaishan-src/public/voice/e2.mp3 b/dengtaishan-src/public/voice/e2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..6ddc7b89797083b52683052bb5e923e8b874e805 Binary files /dev/null and b/dengtaishan-src/public/voice/e2.mp3 differ diff --git a/dengtaishan-src/public/voice/e3.mp3 b/dengtaishan-src/public/voice/e3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..edc36a1d994032a0a02e2a83b7df194433717b31 Binary files /dev/null and b/dengtaishan-src/public/voice/e3.mp3 differ diff --git a/dengtaishan-src/public/voice/e4.mp3 b/dengtaishan-src/public/voice/e4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..b1635aeb8f234a6dfac049820eb016b7b389724f Binary files /dev/null and b/dengtaishan-src/public/voice/e4.mp3 differ diff --git a/dengtaishan-src/public/voice/e5.mp3 b/dengtaishan-src/public/voice/e5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..6ffadf4ca75a38a33ed08d0a442d4454319c3ed3 Binary files /dev/null and b/dengtaishan-src/public/voice/e5.mp3 differ diff --git a/dengtaishan-src/public/voice/e6.mp3 b/dengtaishan-src/public/voice/e6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..844c4f116a63692e421d35e7b6772ccc8d06d625 Binary files /dev/null and b/dengtaishan-src/public/voice/e6.mp3 differ diff --git a/dengtaishan-src/public/voice/e7.mp3 b/dengtaishan-src/public/voice/e7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..25a9fec8949ea6b0d53d861cc6e5d32012fd5a38 Binary files /dev/null and b/dengtaishan-src/public/voice/e7.mp3 differ diff --git a/dengtaishan-src/public/voice/e8.mp3 b/dengtaishan-src/public/voice/e8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fc770ba8d84a3732ec9adb2eae8595715c2a22ae Binary files /dev/null and b/dengtaishan-src/public/voice/e8.mp3 differ diff --git a/dengtaishan-src/public/voice/f1.mp3 b/dengtaishan-src/public/voice/f1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..84b53d144bd3843fa9092da06a835815b36f99a3 Binary files /dev/null and b/dengtaishan-src/public/voice/f1.mp3 differ diff --git a/dengtaishan-src/public/voice/f2.mp3 b/dengtaishan-src/public/voice/f2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..91e65dbbdf81bbf2d1b9ec8d54baaba98ed3502a Binary files /dev/null and b/dengtaishan-src/public/voice/f2.mp3 differ diff --git a/dengtaishan-src/public/voice/f3.mp3 b/dengtaishan-src/public/voice/f3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1b132844f8e54183440760e14a2c1f902e4d935a Binary files /dev/null and b/dengtaishan-src/public/voice/f3.mp3 differ diff --git a/dengtaishan-src/public/voice/f4.mp3 b/dengtaishan-src/public/voice/f4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..53e06d3d906736a0ab04d2e04775b18cbc919785 Binary files /dev/null and b/dengtaishan-src/public/voice/f4.mp3 differ diff --git a/dengtaishan-src/public/voice/f5.mp3 b/dengtaishan-src/public/voice/f5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..268e330bfe0d6f3cc439e27030e09af109216b2e Binary files /dev/null and b/dengtaishan-src/public/voice/f5.mp3 differ diff --git a/dengtaishan-src/public/voice/f6.mp3 b/dengtaishan-src/public/voice/f6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f3e7eb83bb23e7e1c001ea4490db61f15cdc436b Binary files /dev/null and b/dengtaishan-src/public/voice/f6.mp3 differ diff --git a/dengtaishan-src/public/voice/f7.mp3 b/dengtaishan-src/public/voice/f7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..0d734b67e1ea4b478efcb8061b90e00d10d2b4c3 Binary files /dev/null and b/dengtaishan-src/public/voice/f7.mp3 differ diff --git a/dengtaishan-src/public/voice/g1.mp3 b/dengtaishan-src/public/voice/g1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..57cf49ce04424e24521aa7dd9145353d0fcc2529 Binary files /dev/null and b/dengtaishan-src/public/voice/g1.mp3 differ diff --git a/dengtaishan-src/public/voice/g10.mp3 b/dengtaishan-src/public/voice/g10.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..c708957cf896f7cb69b2196d545295696d0e328b Binary files /dev/null and b/dengtaishan-src/public/voice/g10.mp3 differ diff --git a/dengtaishan-src/public/voice/g11.mp3 b/dengtaishan-src/public/voice/g11.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d9b4e326be70e69eab262b04f3c805ef6be7915e Binary files /dev/null and b/dengtaishan-src/public/voice/g11.mp3 differ diff --git a/dengtaishan-src/public/voice/g2.mp3 b/dengtaishan-src/public/voice/g2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1a7e924749fa99f7906a739b9f0185fd7a3b3908 Binary files /dev/null and b/dengtaishan-src/public/voice/g2.mp3 differ diff --git a/dengtaishan-src/public/voice/g3.mp3 b/dengtaishan-src/public/voice/g3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..5435aa50418ab89ddc3d695f03cf4d8d8ed9ad39 Binary files /dev/null and b/dengtaishan-src/public/voice/g3.mp3 differ diff --git a/dengtaishan-src/public/voice/g4.mp3 b/dengtaishan-src/public/voice/g4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..9aa8e8a3dac23daa9b87f5f0fc705e3922c86e6d Binary files /dev/null and b/dengtaishan-src/public/voice/g4.mp3 differ diff --git a/dengtaishan-src/public/voice/g5.mp3 b/dengtaishan-src/public/voice/g5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..cc4d5d957ddc0c0ce35e65c360d487abb30a403f Binary files /dev/null and b/dengtaishan-src/public/voice/g5.mp3 differ diff --git a/dengtaishan-src/public/voice/g6.mp3 b/dengtaishan-src/public/voice/g6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..28ac814cd2ae241fbc75e1f7fec682a6cb85ce78 Binary files /dev/null and b/dengtaishan-src/public/voice/g6.mp3 differ diff --git a/dengtaishan-src/public/voice/g7.mp3 b/dengtaishan-src/public/voice/g7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..553c26a6946a25476dc6ec7d5a0cd4a1eb69058d Binary files /dev/null and b/dengtaishan-src/public/voice/g7.mp3 differ diff --git a/dengtaishan-src/public/voice/g8.mp3 b/dengtaishan-src/public/voice/g8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..8e0919d7071c2055583ae4aa3255b82f6d624890 Binary files /dev/null and b/dengtaishan-src/public/voice/g8.mp3 differ diff --git a/dengtaishan-src/public/voice/g9.mp3 b/dengtaishan-src/public/voice/g9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..fad2d30e051b05c4e3b66dd99868cfd097cde1c5 Binary files /dev/null and b/dengtaishan-src/public/voice/g9.mp3 differ diff --git a/dengtaishan-src/public/voice/h1.mp3 b/dengtaishan-src/public/voice/h1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1e9474f432ecf4248634bc5c68b92a8e6dc06e2e Binary files /dev/null and b/dengtaishan-src/public/voice/h1.mp3 differ diff --git a/dengtaishan-src/public/voice/h2.mp3 b/dengtaishan-src/public/voice/h2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..a7a72d2fc579f897f1be130d29209cff5a87e127 Binary files /dev/null and b/dengtaishan-src/public/voice/h2.mp3 differ diff --git a/dengtaishan-src/public/voice/h3.mp3 b/dengtaishan-src/public/voice/h3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..7aace8fa400b1e02c70f2c8a077723e2db9c47d9 Binary files /dev/null and b/dengtaishan-src/public/voice/h3.mp3 differ diff --git a/dengtaishan-src/public/voice/h4.mp3 b/dengtaishan-src/public/voice/h4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..b3b3cf821d4a101bc7913d7c252e8f75975273d7 Binary files /dev/null and b/dengtaishan-src/public/voice/h4.mp3 differ diff --git a/dengtaishan-src/public/voice/p1.mp3 b/dengtaishan-src/public/voice/p1.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..145fbfa8f86b2543d342f06794502dd487e35d9c Binary files /dev/null and b/dengtaishan-src/public/voice/p1.mp3 differ diff --git a/dengtaishan-src/public/voice/p2.mp3 b/dengtaishan-src/public/voice/p2.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..f9be0c3249d258b6f49971bac9919a8a7bb87c53 Binary files /dev/null and b/dengtaishan-src/public/voice/p2.mp3 differ diff --git a/dengtaishan-src/public/voice/p3.mp3 b/dengtaishan-src/public/voice/p3.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..65091a2eb4502ceaf1e8830eea9b6c6693568382 Binary files /dev/null and b/dengtaishan-src/public/voice/p3.mp3 differ diff --git a/dengtaishan-src/public/voice/p4.mp3 b/dengtaishan-src/public/voice/p4.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..d9bcb985f10bd07b4f6334be7aa9979a4b8e7355 Binary files /dev/null and b/dengtaishan-src/public/voice/p4.mp3 differ diff --git a/dengtaishan-src/public/voice/p5.mp3 b/dengtaishan-src/public/voice/p5.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..1cf127d09495839281e52e6a751dee9f7100dc67 Binary files /dev/null and b/dengtaishan-src/public/voice/p5.mp3 differ diff --git a/dengtaishan-src/public/voice/p6.mp3 b/dengtaishan-src/public/voice/p6.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..089248504834a3edc6044df5a1c76e54e11ddfc4 Binary files /dev/null and b/dengtaishan-src/public/voice/p6.mp3 differ diff --git a/dengtaishan-src/public/voice/p7.mp3 b/dengtaishan-src/public/voice/p7.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..511fdea92f1166720449671c792e5d078a1217df Binary files /dev/null and b/dengtaishan-src/public/voice/p7.mp3 differ diff --git a/dengtaishan-src/public/voice/p8.mp3 b/dengtaishan-src/public/voice/p8.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..e59408a7a2766e532b33a3eea343edf0677505bd Binary files /dev/null and b/dengtaishan-src/public/voice/p8.mp3 differ diff --git a/dengtaishan-src/public/voice/p9.mp3 b/dengtaishan-src/public/voice/p9.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..193e4911ace785f4c759bd120cd7de354d7b3651 Binary files /dev/null and b/dengtaishan-src/public/voice/p9.mp3 differ diff --git a/dengtaishan-src/src/App.tsx b/dengtaishan-src/src/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..9f12606de706e7d27baae53e89f18955d586f3be --- /dev/null +++ b/dengtaishan-src/src/App.tsx @@ -0,0 +1,24 @@ +const SURF_LOGO_PATH = "M14.6875 13.333C15.0977 13.333 15.4859 13.5196 15.7422 13.8398L17.8721 16.502C17.9009 16.538 17.9308 16.5721 17.9619 16.6035C18.3091 16.9542 18.7529 17.3405 18.7529 17.834C18.7528 18.3399 18.3428 18.75 17.8369 18.75H17.5713C17.2123 18.75 16.8727 18.5869 16.6484 18.3066L15.4678 16.8311C14.761 15.9479 13.3369 16.4478 13.3369 17.5791V18.6494C13.3369 18.7062 13.2882 18.75 13.2314 18.75H11.3584C10.7127 18.75 10.1016 18.4564 9.69824 17.9521L8.80176 16.8311C8.09497 15.9477 6.66993 16.4478 6.66992 17.5791V18.6494C6.66991 18.7062 6.62124 18.75 6.56445 18.75H4.69141C4.04589 18.75 3.43548 18.4562 3.03223 17.9521L2.13477 16.8311C1.77885 16.3862 1.25293 15.931 1.25293 15.3613V13.4395C1.253 13.3822 1.29729 13.3331 1.35449 13.333C1.7646 13.3332 2.15295 13.5196 2.40918 13.8398L4.53809 16.502C5.24478 17.3853 6.66962 16.886 6.66992 15.7549V14.6836C6.67018 13.9379 7.27483 13.3332 8.02051 13.333C8.43065 13.333 8.81884 13.5197 9.0752 13.8398L11.2051 16.502C11.9097 17.3827 13.3282 16.8887 13.3369 15.7646V14.6836C13.3372 13.9378 13.9417 13.3331 14.6875 13.333ZM14.6875 6.66699C15.0978 6.66702 15.4859 6.85347 15.7422 7.17383L17.8721 9.83594C18.2276 10.2801 18.7526 10.7339 18.7529 11.3027V13.2266C18.7528 13.2833 18.7091 13.333 18.6523 13.333C18.2421 13.3329 17.8539 13.1465 17.5977 12.8262L15.4678 10.1641C14.7609 9.28113 13.3369 9.78089 13.3369 10.9121V11.9824C13.3369 12.7282 12.7321 13.3328 11.9863 13.333C11.5761 13.3329 11.187 13.1465 10.9307 12.8262L8.80176 10.1641C8.09497 9.28072 6.66993 9.78076 6.66992 10.9121V11.9824C6.66992 12.7284 6.06525 13.3329 5.31934 13.333C4.90908 13.3329 4.52094 13.1465 4.26465 12.8262L2.13477 10.1641C1.7788 9.71925 1.25293 9.26403 1.25293 8.69434V6.77344C1.253 6.71621 1.29728 6.6671 1.35449 6.66699C1.76461 6.66714 2.15295 6.85359 2.40918 7.17383L4.53809 9.83594C5.24487 10.7193 6.66989 10.2192 6.66992 9.08789V8.01758C6.66992 7.27168 7.27467 6.66722 8.02051 6.66699C8.43082 6.66699 8.81885 6.85345 9.0752 7.17383L11.2051 9.83594C11.9097 10.7163 13.3279 10.2223 13.3369 9.09863V8.01758C13.3369 7.27161 13.9416 6.6671 14.6875 6.66699ZM2.43555 1.25C2.79488 1.25 3.13499 1.41367 3.35938 1.69434L4.53809 3.16895C5.24485 4.05241 6.66991 3.55228 6.66992 2.4209V1.35059C6.66993 1.29391 6.71874 1.25017 6.77539 1.25H8.64844C9.29394 1.25 9.90438 1.5438 10.3076 2.04785L11.2051 3.16895C11.9097 4.04967 13.3282 3.55564 13.3369 2.43164V1.35059C13.3369 1.29391 13.3857 1.25017 13.4424 1.25H15.3154C15.9609 1.25 16.5714 1.5438 16.9746 2.04785L17.8721 3.16895C18.2275 3.61314 18.7526 4.06689 18.7529 4.63574V6.56055C18.7528 6.61728 18.7091 6.66699 18.6523 6.66699C18.2421 6.66688 17.8539 6.4795 17.5977 6.15918L15.4678 3.49805C14.761 2.61474 13.3371 3.11388 13.3369 4.24512V5.31543C13.3369 6.06126 12.7321 6.66673 11.9863 6.66699C11.5761 6.66693 11.187 6.47955 10.9307 6.15918L8.80176 3.49805C8.095 2.61474 6.67006 3.11388 6.66992 4.24512V5.31543C6.66992 6.06137 6.06525 6.66691 5.31934 6.66699C4.90908 6.66693 4.52094 6.47955 4.26465 6.15918L2.13477 3.49805C2.10558 3.46158 2.07543 3.42725 2.04395 3.39551C1.6966 3.04528 1.25293 2.6583 1.25293 2.16504C1.25317 1.65963 1.66348 1.25 2.16895 1.25H2.43555Z" + +function SurfLogo() { + return ( + + + + ) +} + +// Frontend API calls should use `src/lib/api.ts`, not absolute `/api/...` URLs. +export default function App() { + return ( +
+ +

+ GM, Builder. +

+

+ Start your crypto project here! +

+
+ ) +} diff --git a/dengtaishan-src/src/ErrorBoundary.tsx b/dengtaishan-src/src/ErrorBoundary.tsx new file mode 100644 index 0000000000000000000000000000000000000000..46b25fd85f8f22e4ff300deaa13e6f88cd82bd53 --- /dev/null +++ b/dengtaishan-src/src/ErrorBoundary.tsx @@ -0,0 +1,106 @@ +import { Component, type ReactNode } from 'react' + +interface Props { children: ReactNode; fallback?: ReactNode } +interface State { error: Error | null } + +// Auto-reload config for transient dep-optimization errors. +// Shares the same key as entry-client's cold-start guard so reload +// attempts are counted together, preventing double reload loops. +const RELOAD_KEY = '__dep_reload' +const MAX_RELOADS = 6 +// If the last reload was more than this many ms ago, reset the counter. +// This prevents stale counters from blocking legitimate retries on a +// later visit, while still capping rapid reload loops. +const RELOAD_WINDOW_MS = 60_000 + +// Patterns that indicate React modules loaded as stubs (dep optimization in progress) +const DEP_OPT_PATTERNS = [ + "reading 'useState'", + "reading 'useEffect'", + "reading 'useRef'", + "reading 'useCallback'", + "reading 'useMemo'", + "reading 'useContext'", + "reading 'useReducer'", +] + +function isDepOptError(msg: string): boolean { + return DEP_OPT_PATTERNS.some((p) => msg.includes(p)) +} + +// Shared format with entry-client: { c: count, t: timestamp } +function getReloadState(): { c: number; t: number } { + try { + const raw = sessionStorage.getItem(RELOAD_KEY) + if (raw) return JSON.parse(raw) + } catch { /* ignore parse errors */ } + return { c: 0, t: 0 } +} + +export default class ErrorBoundary extends Component { + state: State = { error: null } + + static getDerivedStateFromError(error: Error) { + return { error } + } + + componentDidCatch(error: Error) { + if (!isDepOptError(error.message)) return + // Vite dep optimization may serve React stubs during cold start. + // Auto-reload so the browser fetches the real modules once ready. + const prev = getReloadState() + // Reset counter if outside the rapid-reload window (stale from earlier visit) + const count = (Date.now() - prev.t > RELOAD_WINDOW_MS) ? 0 : prev.c + if (count < MAX_RELOADS) { + sessionStorage.setItem(RELOAD_KEY, JSON.stringify({ c: count + 1, t: Date.now() })) + setTimeout(() => location.reload(), 3000) + } + } + + render() { + if (this.state.error) { + if (this.props.fallback) return this.props.fallback + + // Show a friendlier message for dep optimization errors that will auto-reload + if (isDepOptError(this.state.error.message)) { + const { c, t } = getReloadState() + const fresh = (Date.now() - t <= RELOAD_WINDOW_MS) + if (!fresh || c < MAX_RELOADS) { + return ( +
+

Loading dependencies...

+

Reloading automatically

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

Component Error

+

{this.state.error.message}

+
+ ) + } + return this.props.children + } +} diff --git a/dengtaishan-src/src/entry-client.tsx b/dengtaishan-src/src/entry-client.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8f7d4065f7285727bd1ccd55f604ab76809946f2 --- /dev/null +++ b/dengtaishan-src/src/entry-client.tsx @@ -0,0 +1,112 @@ +import './index.css' + +// --------------------------------------------------------------------------- +// Cold-start guard: verify React is real BEFORE rendering. +// +// During Vite dep-optimization (cold start or after `npm install `), +// Vite may serve placeholder "stub" modules where all React exports are +// undefined. Rendering with stub hooks causes "Cannot read properties of +// null (reading 'useState')". +// +// Strategy: +// 1. Dynamic-import React and check if useState is a function. +// 2. If stub → show a loading banner, schedule a reload with increasing +// delay, and do NOT mount any React tree (avoids the error entirely). +// 3. If real → dynamic-import App/ErrorBoundary and render normally. +// 4. Use createElement (not JSX) in this file so Vite doesn't inject a +// static `import { jsx } from 'react/jsx-dev-runtime'` which would +// itself be a stub and crash before our guard runs. +// --------------------------------------------------------------------------- + +const RELOAD_KEY = '__dep_reload' +const MAX_RELOADS = 6 +const RELOAD_WINDOW = 60_000 // 1 minute + +function getReloads(): { c: number; t: number } { + try { + return JSON.parse(sessionStorage.getItem(RELOAD_KEY) || '{}') as { c: number; t: number } + } catch { return { c: 0, t: 0 } } +} + +async function boot() { + const root = document.getElementById('root')! + + try { + const React = await import('react') + + // If useState is not a function, React is a dep-optimization stub + if (typeof React.useState !== 'function') throw new Error('dep-stub') + + const { createElement } = React + const { createRoot, hydrateRoot } = await import('react-dom/client') + const { QueryClient, QueryClientProvider } = await import('@tanstack/react-query') + const { default: App } = await import('./App') + const { default: ErrorBoundary } = await import('./ErrorBoundary') + + const queryClient = new QueryClient({ + defaultOptions: { queries: { + refetchOnWindowFocus: false, + retry: 3, + retryDelay: (attempt) => Math.min(1000 * 2 ** attempt, 10000), + staleTime: 30_000, + } }, + }) + + const children = createElement(ErrorBoundary, null, + createElement(QueryClientProvider, { client: queryClient }, + createElement(App) + ) + ) + + // Use hydrateRoot only when SSR rendered real app content. The scaffold's + // server entry intentionally returns a lightweight placeholder shell so + // SSR-incompatible libraries (for example echarts-for-react) cannot crash + // deploy-time render. Placeholder markup must be client-rendered, not hydrated. + const hasPlaceholder = !!root.querySelector('[data-surf-placeholder]') + if (root.childNodes.length > 0 && root.innerHTML !== '' && !hasPlaceholder) { + hydrateRoot(root, children) + } else { + root.innerHTML = '' + createRoot(root).render(children) + } + + // React rendered successfully — signal to index.html fallback & reset counter + ;(window as any).__reactOk = true + sessionStorage.removeItem(RELOAD_KEY) + + // Notify parent frame when real app content renders (not the placeholder). + // DO NOT REMOVE — the hosting app uses this to dismiss the loading overlay. + function notifyParentReady() { + if (!document.querySelector('[data-surf-placeholder]')) { + try { window.parent.postMessage({ type: 'surf-app-ready' }, '*') } catch { /* cross-origin — ignore */ } + } + } + notifyParentReady() + new MutationObserver(notifyParentReady).observe(root, { childList: true, subtree: true }) + } catch { + // React is not ready — show loading banner and schedule reload + const prev = getReloads() + const count = (Date.now() - prev.t > RELOAD_WINDOW) ? 0 : prev.c + + if (count < MAX_RELOADS) { + root.innerHTML = [ + '
', + '

Loading dependencies...

', + '

Reloading automatically

', + '
', + ].join('') + sessionStorage.setItem(RELOAD_KEY, JSON.stringify({ c: count + 1, t: Date.now() })) + // Increasing delay: 3s, 4s, 5s, ... gives Vite more time to finish + setTimeout(() => location.reload(), 3000 + count * 1000) + } else { + root.innerHTML = [ + '
', + '

Failed to load dependencies

', + '

Please refresh the page

', + '
', + ].join('') + } + } +} + +boot() diff --git a/dengtaishan-src/src/entry-server.tsx b/dengtaishan-src/src/entry-server.tsx new file mode 100644 index 0000000000000000000000000000000000000000..2a726419042dc915310c7a7d48d0b9fcafa8482a --- /dev/null +++ b/dengtaishan-src/src/entry-server.tsx @@ -0,0 +1,13 @@ +import { renderToString } from 'react-dom/server' + +export function render() { + return renderToString( +
+ ) +} diff --git a/dengtaishan-src/src/hooks/use-toast.ts b/dengtaishan-src/src/hooks/use-toast.ts new file mode 100644 index 0000000000000000000000000000000000000000..5507d2ebeab92ae96ea5eb3aa0913788b13628c8 --- /dev/null +++ b/dengtaishan-src/src/hooks/use-toast.ts @@ -0,0 +1,95 @@ +import * as React from "react" + +const TOAST_LIMIT = 1 +const TOAST_REMOVE_DELAY = 1000000 + +type ToasterToast = { + id: string + title?: React.ReactNode + description?: React.ReactNode + action?: React.ReactElement + open?: boolean + onOpenChange?: (open: boolean) => void + variant?: "default" | "destructive" +} + +const actionTypes = { + ADD_TOAST: "ADD_TOAST", + UPDATE_TOAST: "UPDATE_TOAST", + DISMISS_TOAST: "DISMISS_TOAST", + REMOVE_TOAST: "REMOVE_TOAST", +} as const + +let count = 0 + +function genId() { + count = (count + 1) % Number.MAX_SAFE_INTEGER + return count.toString() +} + +type Action = + | { type: typeof actionTypes.ADD_TOAST; toast: ToasterToast } + | { type: typeof actionTypes.UPDATE_TOAST; toast: Partial } + | { type: typeof actionTypes.DISMISS_TOAST; toastId?: string } + | { type: typeof actionTypes.REMOVE_TOAST; toastId?: string } + +interface State { + toasts: ToasterToast[] +} + +const toastTimeouts = new Map>() + +const addToRemoveQueue = (toastId: string) => { + if (toastTimeouts.has(toastId)) return + const timeout = setTimeout(() => { + toastTimeouts.delete(toastId) + dispatch({ type: actionTypes.REMOVE_TOAST, toastId }) + }, TOAST_REMOVE_DELAY) + toastTimeouts.set(toastId, timeout) +} + +export const reducer = (state: State, action: Action): State => { + switch (action.type) { + case actionTypes.ADD_TOAST: + return { ...state, toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT) } + case actionTypes.UPDATE_TOAST: + return { ...state, toasts: state.toasts.map((t) => (t.id === action.toast.id ? { ...t, ...action.toast } : t)) } + case actionTypes.DISMISS_TOAST: { + const { toastId } = action + if (toastId) addToRemoveQueue(toastId) + else state.toasts.forEach((t) => addToRemoveQueue(t.id)) + return { ...state, toasts: state.toasts.map((t) => (toastId == null || t.id === toastId ? { ...t, open: false } : t)) } + } + case actionTypes.REMOVE_TOAST: + return { ...state, toasts: action.toastId == null ? [] : state.toasts.filter((t) => t.id !== action.toastId) } + } +} + +const listeners: Array<(state: State) => void> = [] +let memoryState: State = { toasts: [] } + +function dispatch(action: Action) { + memoryState = reducer(memoryState, action) + listeners.forEach((listener) => listener(memoryState)) +} + +type Toast = Omit + +function toast({ ...props }: Toast) { + const id = genId() + const update = (props: ToasterToast) => dispatch({ type: actionTypes.UPDATE_TOAST, toast: { ...props, id } }) + const dismiss = () => dispatch({ type: actionTypes.DISMISS_TOAST, toastId: id }) + dispatch({ type: actionTypes.ADD_TOAST, toast: { ...props, id, open: true, onOpenChange: (open) => { if (!open) dismiss() } } }) + return { id, dismiss, update } +} + +function useToast() { + const [state, setState] = React.useState(memoryState) + React.useEffect(() => { + listeners.push(setState) + return () => { const i = listeners.indexOf(setState); if (i > -1) listeners.splice(i, 1) } + }, [state]) + return { ...state, toast, dismiss: (toastId?: string) => dispatch({ type: actionTypes.DISMISS_TOAST, toastId }) } +} + +export { useToast, toast } diff --git a/dengtaishan-src/src/index.css b/dengtaishan-src/src/index.css new file mode 100644 index 0000000000000000000000000000000000000000..65196c048d7deee001b2e21a61363ad44536a92b --- /dev/null +++ b/dengtaishan-src/src/index.css @@ -0,0 +1,314 @@ +@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;600;700;900&family=Roboto+Mono:wght@400;500&display=swap'); + +@import "tailwindcss"; +@import "tw-animate-css"; + +/* ===== Tailwind CSS 4 Theme — maps CSS vars to Tailwind tokens ===== */ +@theme inline { + --color-background: var(--background); + --color-foreground: var(--foreground); + --color-card: var(--card); + --color-card-foreground: var(--card-foreground); + --color-popover: var(--popover); + --color-popover-foreground: var(--popover-foreground); + --color-primary: var(--primary); + --color-primary-foreground: var(--primary-foreground); + --color-secondary: var(--secondary); + --color-secondary-foreground: var(--secondary-foreground); + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + --color-accent: var(--accent); + --color-accent-foreground: var(--accent-foreground); + --color-destructive: var(--destructive); + --color-destructive-foreground: var(--destructive-foreground); + --color-border: var(--border); + --color-input: var(--input); + --color-ring: var(--ring); + --radius-sm: calc(var(--radius) - 4px); + --radius-md: calc(var(--radius) - 2px); + --radius-lg: var(--radius); + --radius-xl: calc(var(--radius) + 4px); + --animate-accordion-down: accordion-down 0.2s ease-out; + --animate-accordion-up: accordion-up 0.2s ease-out; + + /* Surf Semantic — Background */ + --color-bg-subtle: var(--bg-subtle); + --color-bg-subtle-hover: var(--bg-subtle-hover); + --color-bg-base: var(--bg-base); + --color-bg-base-opaque: var(--bg-base-opaque); + --color-bg-menu: var(--bg-menu); + --color-bg-chat: var(--bg-chat); + --color-bg-chat-nav: var(--bg-chat-nav); + + /* Surf Semantic — Foreground */ + --color-fg-base: var(--fg-base); + --color-fg-subtle: var(--fg-subtle); + --color-fg-muted: var(--fg-muted); + --color-fg-disabled: var(--fg-disabled); + + /* Surf Semantic — Border */ + --color-border-base: var(--border-base); + --color-border-strong: var(--border-strong); + --color-border-contrast: var(--border-contrast); + --color-border-focus: var(--border-focus); + + /* Surf Brand */ + --color-brand-100: var(--brand-100); + --color-brand-60: var(--brand-60); + --color-brand-30: var(--brand-30); + --color-brand-10: var(--brand-10); + + /* Surf Visualizer (Chart/Status) */ + --color-visualizer-rose-pop: var(--visualizer-rose-pop); + --color-visualizer-indigo-breeze: var(--visualizer-indigo-breeze); + --color-visualizer-emerald-mint: var(--visualizer-emerald-mint); + --color-visualizer-golden-amber: var(--visualizer-golden-amber); + --color-visualizer-royal-blue: var(--visualizer-royal-blue); + --color-visualizer-crimson-spark: var(--visualizer-crimson-spark); + --color-visualizer-aqua-glow: var(--visualizer-aqua-glow); + --color-visualizer-sunbeam-yellow: var(--visualizer-sunbeam-yellow); + + /* Surf Tags */ + --color-tag-blue-10: var(--tag-blue-10); + --color-tag-blue-100: var(--tag-blue-100); + --color-tag-yellow-10: var(--tag-yellow-10); + --color-tag-yellow-100: var(--tag-yellow-100); + --color-tag-purple-10: var(--tag-purple-10); + --color-tag-purple-100: var(--tag-purple-100); + --color-tag-cyan-10: var(--tag-cyan-10); + --color-tag-cyan-100: var(--tag-cyan-100); + --color-tag-pink-10: var(--tag-pink-10); + --color-tag-pink-100: var(--tag-pink-100); + --color-tag-orange-10: var(--tag-orange-10); + --color-tag-orange-100: var(--tag-orange-100); + + /* Neutral */ + --color-neutral-0: var(--neutral-0); +} + +@keyframes accordion-down { + from { height: 0; } + to { height: var(--radix-accordion-content-height); } +} + +@keyframes accordion-up { + from { height: var(--radix-accordion-content-height); } + to { height: 0; } +} + +/* ===== Light Mode (default) ===== */ +:root { + /* shadcn semantic tokens (Surf Light) */ + --background: hsl(0 0% 100%); + --foreground: hsl(0 0% 13%); + --card: hsl(0 0% 100%); + --card-foreground: hsl(0 0% 13%); + --popover: hsl(0 0% 100%); + --popover-foreground: hsl(0 0% 13%); + --primary: hsl(339 100% 58%); + --primary-foreground: hsl(0 0% 100%); + --secondary: hsl(0 3% 95%); + --secondary-foreground: hsl(0 0% 13%); + --muted: hsl(0 3% 95%); + --muted-foreground: hsl(0 0% 48%); + --accent: hsl(0 3% 95%); + --accent-foreground: hsl(0 0% 13%); + --destructive: hsl(357 91% 55%); + --destructive-foreground: hsl(0 0% 100%); + --border: hsl(0 0% 91%); + --input: hsl(0 0% 91%); + --ring: #212121; + --radius: 0.5rem; + + /* Surf Neutral Palette */ + --neutral-0: #ffffff; + --neutral-50: #fafafa; + --neutral-100: #f5f4f4; + --neutral-200: #e7e7e7; + --neutral-300: #d8d8d8; + --neutral-400: #aaaaaa; + --neutral-500: #7a7a7a; + --neutral-600: #5b5b5b; + --neutral-700: #464646; + --neutral-800: #2a2a2a; + --neutral-900: #212121; + --neutral-950: #1b1b1b; + --neutral-1000: #101010; + + /* Surf Brand */ + --brand-100: #ff2882; + --brand-60: rgba(255, 40, 130, 0.6); + --brand-30: rgba(255, 40, 130, 0.3); + --brand-10: rgba(255, 40, 130, 0.1); + + /* Surf Brand Extended */ + --brand-seafoam: #b6cfd0; + --brand-dusty-teal: #6ba4b8; + --brand-black-aqua: #002f38; + --brand-deep-teal-blue: #07272d; + + /* Surf Visualizer (Chart) Colors */ + --visualizer-rose-pop: #fd4b96; + --visualizer-indigo-breeze: #6366f1; + --visualizer-emerald-mint: #10b981; + --visualizer-golden-amber: #f59e0b; + --visualizer-royal-blue: #1d4ed8; + --visualizer-crimson-spark: #ef4444; + --visualizer-aqua-glow: #06b6d4; + --visualizer-sunbeam-yellow: #facc15; + + /* Surf Semantic Tokens (Light) */ + --bg-subtle: rgba(42, 42, 42, 0.04); + --bg-subtle-hover: rgba(42, 42, 42, 0.06); + --bg-base: rgba(255, 255, 255, 0.88); + --bg-base-opaque: #ffffff; + --bg-menu: #ffffff; + --bg-chat: #fcfcfc; + --bg-chat-nav: #f4f4f4; + --fg-base: #212121; + --fg-subtle: #7a7a7a; + --fg-muted: #aaaaaa; + --fg-disabled: #d8d8d8; + --border-base: rgba(42, 42, 42, 0.04); + --border-strong: rgba(42, 42, 42, 0.08); + --border-contrast: rgba(42, 42, 42, 0.12); + --border-focus: rgba(42, 42, 42, 0.4); + + /* Tag Colors */ + --tag-blue-10: rgba(91, 181, 255, 0.1); + --tag-blue-100: #5bb5ff; + --tag-yellow-10: rgba(222, 195, 120, 0.1); + --tag-yellow-100: #dec378; + --tag-purple-10: rgba(144, 142, 184, 0.1); + --tag-purple-100: #908eb8; + --tag-cyan-10: rgba(116, 173, 164, 0.1); + --tag-cyan-100: #74ada4; + --tag-pink-10: rgba(184, 142, 167, 0.1); + --tag-pink-100: #b88ea7; + --tag-orange-10: rgba(184, 160, 142, 0.1); + --tag-orange-100: #b8a08e; + + /* Surf Gradient Definitions (raw, mode-independent) */ + --gradient-max-dark: linear-gradient(213deg, #8c421d 2%, #fbe67b 31%, #fcfbe7 53%, #f7d14e 77%, #d4a041 100%); + --gradient-max-light: linear-gradient(125deg, #8c421d 22%, #d2af00 47%, #cd9124 67%, #d4a041 88%); + --gradient-pro-dark: linear-gradient(213deg, #7a96ac 1%, #c5d6e2 27%, #eaeff3 47%, #c5d6e2 65%, #a3bccf 89%); + --gradient-pro-light: linear-gradient(129deg, #7a96ac 4%, #6d7f8d 27%, #9fb9ce 55%, #6d7f8d 90%); + --gradient-plus-dark: linear-gradient(214deg, #986732 0%, #a7825b 23%, #f6d0ab 45%, #a07043 66%, #9d774e 100%); + --gradient-plus-light: linear-gradient(129deg, #9e8976 5%, #7a5e50 19%, #f6d0ab 35%, #9d774e 49%, #c99b70 65%, #795f52 78%); + --gradient-upgrade-dark: linear-gradient(214deg, #ffedf3 0%, #ff9fbf 30%, #fd5d92 59%, #ffdab2 100%); + --gradient-upgrade-light: linear-gradient(32deg, #fc3bb2 6%, #f7906e 79%); + --gradient-new-function: linear-gradient(33deg, #6e86ff 17%, #ff2882 55%, #ff98a4 103%); + --gradient-suggestion: linear-gradient(32deg, #fd538c 4%, #5aa6e0 47%, #ffdab2 98%); + --gradient-g1: linear-gradient(189deg, #ffacc6 6%, #b6e0f5 99%); + --gradient-g2: linear-gradient(34deg, #9796f0 9%, #fbc7d4 84%); + --gradient-g3: linear-gradient(to right, #ed4264, #ffedbc); + --gradient-g4: linear-gradient(232deg, #fedc2a 4%, #dd5789 56%, #7a2c9e 104%); + --gradient-g5: linear-gradient(32deg, #fc3bb2 6%, #f7906e 79%); + + /* Surf Gradients (semantic, auto-switch by mode) */ + --gradient-max: var(--gradient-max-light); + --gradient-pro: var(--gradient-pro-light); + --gradient-plus: var(--gradient-plus-light); + --gradient-upgrade: var(--gradient-upgrade-light); + + /* Spacing */ + --spacing-2: 2px; + --spacing-4: 4px; + --spacing-6: 6px; + --spacing-8: 8px; + --spacing-10: 10px; + --spacing-12: 12px; + --spacing-16: 16px; + --spacing-24: 24px; + --spacing-32: 32px; + --spacing-40: 40px; + --spacing-64: 64px; + --spacing-96: 96px; + --spacing-128: 128px; + + /* Border Radius */ + --radius-2: 2px; + --radius-4: 4px; + --radius-6: 6px; + --radius-8: 8px; + --radius-10: 10px; + --radius-12: 12px; + --radius-16: 16px; + --radius-20: 20px; + --radius-24: 24px; + --radius-full: 999px; + + /* Typography */ + --font-family-header: "Lato", "PingFang SC", sans-serif; + --font-family-body: "Lato", "PingFang SC", sans-serif; + --font-family-code: "Roboto Mono", monospace; +} + +/* ===== Dark Mode ===== */ +.dark { + /* shadcn semantic tokens (Surf Dark) */ + --background: hsl(0 0% 9%); + --foreground: hsl(0 0% 91%); + --card: hsl(0 0% 9%); + --card-foreground: hsl(0 0% 91%); + --popover: hsl(0 0% 15%); + --popover-foreground: hsl(0 0% 91%); + --primary: hsl(339 100% 58%); + --primary-foreground: hsl(0 0% 100%); + --secondary: hsl(0 0% 16%); + --secondary-foreground: hsl(0 0% 91%); + --muted: hsl(0 0% 16%); + --muted-foreground: hsl(0 0% 67%); + --accent: hsl(0 0% 16%); + --accent-foreground: hsl(0 0% 91%); + --destructive: hsl(359 100% 65%); + --destructive-foreground: hsl(0 0% 100%); + --border: hsl(0 0% 20%); + --input: hsl(0 0% 20%); + --ring: #e7e7e7; + + /* Surf Gradients (Dark) */ + --gradient-max: var(--gradient-max-dark); + --gradient-pro: var(--gradient-pro-dark); + --gradient-plus: var(--gradient-plus-dark); + --gradient-upgrade: var(--gradient-upgrade-dark); + + /* Surf Semantic Tokens (Dark) */ + --bg-subtle: rgba(255, 255, 255, 0.04); + --bg-subtle-hover: rgba(255, 255, 255, 0.12); + --bg-base: rgba(42, 42, 42, 0.8); + --bg-base-opaque: #171717; + --bg-menu: #252525; + --bg-chat: #101010; + --bg-chat-nav: #171717; + --fg-base: #e7e7e7; + --fg-subtle: #aaaaaa; + --fg-muted: #7a7a7a; + --fg-disabled: #5b5b5b; + --border-base: rgba(255, 255, 255, 0.04); + --border-strong: rgba(255, 255, 255, 0.08); + --border-contrast: rgba(255, 255, 255, 0.12); + --border-focus: rgba(255, 255, 255, 0.4); +} + +@layer base { + *, + ::after, + ::before { + border-color: var(--color-border); + } + body { + background-color: var(--color-background); + color: var(--color-foreground); + font-family: "Lato", "PingFang SC", sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + } +} + +@media (max-width: 768px) { + :root { + --spacing-96: 64px; + --spacing-128: 64px; + } +} diff --git a/dengtaishan-src/src/lib/api.ts b/dengtaishan-src/src/lib/api.ts new file mode 100644 index 0000000000000000000000000000000000000000..6a7f0aef64e6c00aefc87cd09f39f58265f6840a --- /dev/null +++ b/dengtaishan-src/src/lib/api.ts @@ -0,0 +1,3 @@ +export function api(path: string) { + return `${import.meta.env.BASE_URL}api/${path.replace(/^\/+/, '')}` +} diff --git a/dengtaishan-src/src/lib/utils.ts b/dengtaishan-src/src/lib/utils.ts new file mode 100644 index 0000000000000000000000000000000000000000..d084ccade0d8b5bd77fd5174993bcef7b57644c9 --- /dev/null +++ b/dengtaishan-src/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from "clsx" +import { twMerge } from "tailwind-merge" + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)) +} diff --git a/dengtaishan-src/src/video/script.json b/dengtaishan-src/src/video/script.json new file mode 100644 index 0000000000000000000000000000000000000000..6e2fe40c923e6b1797a95c54e2557eda2405d17d --- /dev/null +++ b/dengtaishan-src/src/video/script.json @@ -0,0 +1,145 @@ +[ + { + "id": "prologue", "no": "序", "title": "一篇流水账?", "en": "PROLOGUE", + "lines": [ + { "id": "p1", "k": "n", "t": "乾隆三十九年,冬。" }, + { "id": "p2", "k": "n", "t": "一个四十四岁的男人,辞去了京城的官职。" }, + { "id": "p3", "k": "n", "t": "他离开京城,迎着漫天风雪,一路向南,去登一座山。" }, + { "id": "p4", "k": "n", "t": "这个人,叫姚鼐。这座山,叫泰山。" }, + { "id": "p5", "k": "n", "t": "他留下了一篇不到五百字的文章——《登泰山记》。" }, + { "id": "p6", "k": "n", "t": "很多同学说,它太枯燥了:满篇的地名、日期、里程,像一本流水账。" }, + { "id": "p7", "k": "n", "t": "但如果你换一种方式去读,就会发现——" }, + { "id": "p8", "k": "n", "t": "这是一部用文字拍成的电影。" }, + { "id": "p9", "k": "n", "t": "全片只有五个镜头。看懂这五个镜头,你就能读懂它,也能背下它。" } + ] + }, + { + "id": "shot1", "no": "一", "title": "航拍", "en": "AERIAL", + "para": "泰山之阳,汶水西流;其阴,济水东流。阳谷皆入汶,阴谷皆入济。当其南北分者,古长城也。最高日观峰,在长城南十五里。", + "lines": [ + { "id": "a1", "k": "n", "t": "镜头一,航拍。" }, + { "id": "a2", "k": "n", "t": "姚鼐没有从自己写起,而是先把镜头升到高空。" }, + { "id": "a3", "k": "q", "t": "泰山之阳,汶水西流;其阴,济水东流。" }, + { "id": "a4", "k": "n", "t": "山南为阳,山北为阴。南边的汶水向西流,北边的济水向东流。" }, + { "id": "a5", "k": "q", "t": "阳谷皆入汶,阴谷皆入济。当其南北分者,古长城也。" }, + { "id": "a6", "k": "n", "t": "一座山,把水分成了两路;而在南北分界线上,横着一道古长城。" }, + { "id": "a7", "k": "q", "t": "最高日观峰,在长城南十五里。" }, + { "id": "a8", "k": "n", "t": "镜头最后落在一个点上——日观峰。这是全文的终点,也是他将要等待日出的地方。" }, + { "id": "a9", "k": "n", "t": "记住这一镜:阳汶西,阴济东,长城分南北,日观在其南。" } + ] + }, + { + "id": "shot2", "no": "二", "title": "跟拍", "en": "TRACKING", + "para": "余以乾隆三十九年十二月,自京师乘风雪,历齐河、长清,穿泰山西北谷,越长城之限,至于泰安。是月丁未,与知府朱孝纯子颍由南麓登。四十五里,道皆砌石为磴,其级七千有余。泰山正南面有三谷。中谷绕泰安城下,郦道元所谓环水也。余始循以入,道少半,越中岭,复循西谷,遂至其巅。古时登山,循东谷入,道有天门。东谷者,古谓之天门溪水,余所不至也。今所经中岭及山巅崖限当道者,世皆谓之天门云。道中迷雾冰滑,磴几不可登。及既上,苍山负雪,明烛天南。望晚日照城郭,汶水、徂徕如画,而半山居雾若带然。", + "lines": [ + { "id": "b1", "k": "n", "t": "镜头二,跟拍。人物入画。" }, + { "id": "b2", "k": "q", "t": "余以乾隆三十九年十二月,自京师乘风雪,历齐河、长清,穿泰山西北谷,越长城之限,至于泰安。" }, + { "id": "b3", "k": "n", "t": "注意这个“乘”字。不是冒着风雪,是乘着风雪——风雪不是阻碍,而是他借来的力。" }, + { "id": "b4", "k": "n", "t": "历、穿、越、至,四个动词,就是一条完整的路线。" }, + { "id": "b5", "k": "q", "t": "是月丁未,与知府朱孝纯子颍由南麓登。四十五里,道皆砌石为磴,其级七千有余。" }, + { "id": "b6", "k": "n", "t": "四十五里山路,七千多级石阶。" }, + { "id": "b7", "k": "q", "t": "余始循以入,道少半,越中岭,复循西谷,遂至其巅。" }, + { "id": "b8", "k": "n", "t": "循、越、循、至——又是一串动词。默写时抓住动词,路线就不会乱。" }, + { "id": "b9", "k": "n", "t": "中间,他还顺笔考证了古人走的东谷与天门:走到哪里,查证到哪里,这是考据学者的习惯。" }, + { "id": "b10", "k": "q", "t": "道中迷雾冰滑,磴几不可登。" }, + { "id": "b11", "k": "n", "t": "然后,镜头一转——" }, + { "id": "b12", "k": "q", "t": "及既上,苍山负雪,明烛天南。" }, + { "id": "b13", "k": "n", "t": "青黑色的山,背负着白雪;雪光像烛火,照亮了南方的天空。" }, + { "id": "b14", "k": "n", "t": "一个“负”字,让山有了脊背;一个“烛”字,让雪有了光。" }, + { "id": "b15", "k": "q", "t": "望晚日照城郭,汶水、徂徕如画,而半山居雾若带然。" }, + { "id": "b16", "k": "n", "t": "夕阳、城郭、河流、远山,层层铺开,最后收回到半山腰——一条静止的雾带。" } + ] + }, + { + "id": "shot3", "no": "三", "title": "延时", "en": "TIME-LAPSE", + "para": "戊申晦,五鼓,与子颍坐日观亭,待日出。大风扬积雪击面。亭东自足下皆云漫。稍见云中白若樗蒱数十立者,山也。极天云一线异色,须臾成五彩。日上,正赤如丹,下有红光动摇承之。或曰,此东海也。回视日观以西峰,或得日或否,绛皓驳色,而皆若偻。", + "lines": [ + { "id": "c1", "k": "n", "t": "镜头三,是全片最华彩的一段:一场日出的延时摄影。" }, + { "id": "c2", "k": "q", "t": "戊申晦,五鼓,与子颍坐日观亭,待日出。" }, + { "id": "c3", "k": "n", "t": "晦,是农历每月的最后一天。这一年的腊月,最后一天,正是除夕。" }, + { "id": "c4", "k": "n", "t": "五鼓,是凌晨三点到五点。一年中最后一个黎明,他坐在泰山之巅,等太阳。" }, + { "id": "c5", "k": "q", "t": "大风扬积雪击面。亭东自足下皆云漫。" }, + { "id": "c6", "k": "q", "t": "稍见云中白若樗蒱数十立者,山也。" }, + { "id": "c7", "k": "n", "t": "樗蒱,是古代一种博戏,所用的骰子一面黑、一面白。几十座山峰顶着雪露出云海,就像一颗颗白色的骰子,立在云中。" }, + { "id": "c8", "k": "n", "t": "接下来,请盯住颜色。" }, + { "id": "c9", "k": "q", "t": "极天云一线异色," }, + { "id": "c10", "k": "n", "t": "天边,先裂开一条异样的线;" }, + { "id": "c11", "k": "q", "t": "须臾成五彩。" }, + { "id": "c12", "k": "n", "t": "转眼之间,化作五彩。" }, + { "id": "c13", "k": "q", "t": "日上,正赤如丹," }, + { "id": "c14", "k": "n", "t": "太阳跃出,红得像朱砂;" }, + { "id": "c15", "k": "q", "t": "下有红光动摇承之。" }, + { "id": "c16", "k": "n", "t": "下面,有一片晃动的红光托着它。" }, + { "id": "c17", "k": "q", "t": "或曰,此东海也。" }, + { "id": "c18", "k": "n", "t": "有人说,那就是东海。" }, + { "id": "c19", "k": "n", "t": "从白,到一线异色,到五彩,到正赤,再到红光。三十多个字,完成了一次完整的色彩变化。" }, + { "id": "c20", "k": "q", "t": "回视日观以西峰,或得日或否,绛皓驳色,而皆若偻。" }, + { "id": "c21", "k": "n", "t": "再回头看西边的群峰:照到阳光的是红色,没照到的仍是白色——绛皓驳色。" }, + { "id": "c22", "k": "n", "t": "而它们都像弯着腰,仿佛群山,正在向日出鞠躬。" } + ] + }, + { + "id": "shot4", "no": "四", "title": "特写", "en": "CLOSE-UP", + "para": "亭西有岱祠,又有碧霞元君祠。皇帝行宫在碧霞元君祠东。是日,观道中石刻,自唐显庆以来;其远古刻尽漫失。僻不当道者,皆不及往。", + "lines": [ + { "id": "d1", "k": "n", "t": "镜头四,特写。从自然,切到人文。" }, + { "id": "d2", "k": "q", "t": "亭西有岱祠,又有碧霞元君祠。皇帝行宫在碧霞元君祠东。" }, + { "id": "d3", "k": "n", "t": "以日观亭为原点,西边两座祠,再往东是行宫,方位清清楚楚。" }, + { "id": "d4", "k": "q", "t": "是日,观道中石刻,自唐显庆以来;其远古刻尽漫失。" }, + { "id": "d5", "k": "n", "t": "他看到了唐代显庆年间以来的石刻;而更古老的,早已被风雨磨平。" }, + { "id": "d6", "k": "q", "t": "僻不当道者,皆不及往。" }, + { "id": "d7", "k": "n", "t": "他记录的不只是风景,还有时间留下的痕迹,以及时间抹去的东西。这是一双考据学者的眼睛。" } + ] + }, + { + "id": "shot5", "no": "五", "title": "空镜", "en": "STILL", + "para": "山多石,少土。石苍黑色,多平方,少圜。少杂树,多松,生石罅,皆平顶。冰雪,无瀑水,无鸟兽音迹。至日观数里内无树,而雪与人膝齐。桐城姚鼐记。", + "lines": [ + { "id": "e1", "k": "n", "t": "最后一个镜头,是空镜。没有人,没有事,只有山本身。" }, + { "id": "e2", "k": "q", "t": "山多石,少土。石苍黑色,多平方,少圜。" }, + { "id": "e3", "k": "q", "t": "少杂树,多松,生石罅,皆平顶。" }, + { "id": "e4", "k": "n", "t": "多与少,交替出现。像一位画家,一笔一笔,勾出山的骨骼。" }, + { "id": "e5", "k": "q", "t": "冰雪,无瀑水,无鸟兽音迹。" }, + { "id": "e6", "k": "q", "t": "至日观数里内无树,而雪与人膝齐。" }, + { "id": "e7", "k": "n", "t": "全文在一片寂静中结束。没有抒情,没有感叹,只有齐膝的雪。" }, + { "id": "e8", "k": "q", "t": "桐城姚鼐记。" } + ] + }, + { + "id": "depth", "no": "深", "title": "为什么这样写", "en": "WHY", + "lines": [ + { "id": "f1", "k": "n", "t": "为什么要这样写?" }, + { "id": "f2", "k": "n", "t": "姚鼐是桐城派的集大成者。他主张:义理、考据、辞章,三者不可偏废。" }, + { "id": "f3", "k": "n", "t": "第一段的山川方位,是考据;" }, + { "id": "f4", "k": "n", "t": "第三段的日出,是辞章;" }, + { "id": "f5", "k": "n", "t": "而那个辞官之后、在除夕凌晨的风雪中静坐等待日出的人,本身,就是义理。" }, + { "id": "f6", "k": "n", "t": "桐城派讲究“雅洁”:删去一切多余的情绪,只留下准确。" }, + { "id": "f7", "k": "n", "t": "他不说“我很激动”。他只写:日上,正赤如丹。" } + ] + }, + { + "id": "recite", "no": "背", "title": "五镜记忆法", "en": "MEMORY MAP", + "lines": [ + { "id": "g1", "k": "n", "t": "现在,把五个镜头连起来,就是整篇课文的骨架。" }, + { "id": "g2", "k": "n", "t": "镜头一,航拍定位:阳汶西,阴济东,长城分,日观南。" }, + { "id": "g3", "k": "n", "t": "镜头二,跟拍登山:历穿越至,循越循至;苍山负雪,明烛天南。" }, + { "id": "g4", "k": "n", "t": "镜头三,日出延时:云漫、樗蒱、一线、五彩、正赤、红光、驳色、若偻。" }, + { "id": "g5", "k": "n", "t": "镜头四,人文特写:岱祠、元君祠、行宫、石刻。" }, + { "id": "g6", "k": "n", "t": "镜头五,山之空镜:多石少土,多方少圜,多松平顶,无瀑无鸟,雪与膝齐。" }, + { "id": "g7", "k": "n", "t": "最后,默写时最容易写错的几个字,请特别留意:" }, + { "id": "g8", "k": "n", "t": "砌石为磴的“磴”,是石字旁;" }, + { "id": "g9", "k": "n", "t": "樗蒱,木字旁的“樗”,草字头的“蒱”;" }, + { "id": "g10", "k": "n", "t": "徂徕,两个字都是双人旁;" }, + { "id": "g11", "k": "n", "t": "而皆若偻的“偻”,单人旁;生石罅的“罅”,缶字旁;少圜的“圜”,国字框。" } + ] + }, + { + "id": "epilogue", "no": "终", "title": "等来了光", "en": "EPILOGUE", + "lines": [ + { "id": "h1", "k": "n", "t": "两百五十年前的那个除夕,姚鼐在泰山之巅等到的太阳," }, + { "id": "h2", "k": "n", "t": "和今天升起的,是同一个。" }, + { "id": "h3", "k": "n", "t": "下次你再读到“正赤如丹”,希望你看到的不只是四个字——" }, + { "id": "h4", "k": "n", "t": "而是一个人,在风雪里,等来了光。" } + ] + } +] diff --git a/dengtaishan-src/src/video/voice.json b/dengtaishan-src/src/video/voice.json new file mode 100644 index 0000000000000000000000000000000000000000..2550e89953a338e620ea5208310c778d624cc838 --- /dev/null +++ b/dengtaishan-src/src/video/voice.json @@ -0,0 +1,95 @@ +{ +"p1": 2.376, +"p2": 3.96, +"p3": 5.496, +"p4": 4.296, +"p5": 4.08, +"p6": 6.768, +"p7": 3.744, +"p8": 2.88, +"p9": 6.384, +"a1": 2.064, +"a2": 4.728, +"a3": 5.04, +"a4": 6.84, +"a5": 6.672, +"a6": 6.72, +"a7": 3.888, +"a8": 7.488, +"a9": 6.024, +"b1": 3.288, +"b2": 10.44, +"b3": 7.344, +"b4": 5.64, +"b5": 9.456, +"b6": 3.12, +"b7": 5.88, +"b8": 7.56, +"b9": 8.04, +"b10": 3.432, +"b11": 2.184, +"b12": 4.152, +"b13": 5.952, +"b14": 5.304, +"b15": 6.288, +"b16": 7.752, +"c1": 5.208, +"c2": 5.064, +"c3": 6.528, +"c4": 7.632, +"c5": 5.088, +"c6": 4.344, +"c7": 11.304, +"c8": 2.424, +"c9": 2.424, +"c10": 3.024, +"c11": 1.968, +"c12": 2.52, +"c13": 2.376, +"c14": 2.976, +"c15": 2.784, +"c16": 3.336, +"c17": 2.376, +"c18": 2.472, +"c19": 9.024, +"c20": 6.12, +"c21": 6.84, +"c22": 5.016, +"d1": 4.488, +"d2": 7.128, +"d3": 6.192, +"d4": 6.216, +"d5": 6.456, +"d6": 3.0, +"d7": 8.352, +"e1": 5.592, +"e2": 5.664, +"e3": 4.224, +"e4": 6.264, +"e5": 3.576, +"e6": 3.96, +"e7": 6.312, +"e8": 2.088, +"f1": 1.872, +"f2": 7.44, +"f3": 2.928, +"f4": 2.616, +"f5": 7.32, +"f6": 5.16, +"f7": 5.016, +"g1": 4.68, +"g2": 5.712, +"g3": 6.624, +"g4": 7.848, +"g5": 5.256, +"g6": 7.536, +"g7": 4.392, +"g8": 3.024, +"g9": 3.888, +"g10": 3.0, +"g11": 7.08, +"h1": 5.04, +"h2": 2.784, +"h3": 4.872, +"h4": 3.84 +} \ No newline at end of file diff --git a/dengtaishan-src/src/vite-env.d.ts b/dengtaishan-src/src/vite-env.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..11f02fe2a0061d6e6e1f271b21da95423b448b32 --- /dev/null +++ b/dengtaishan-src/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/dengtaishan-src/tools/gen_voice.py b/dengtaishan-src/tools/gen_voice.py new file mode 100644 index 0000000000000000000000000000000000000000..a609875e2fa14ee1770aacca5619474f2407919f --- /dev/null +++ b/dengtaishan-src/tools/gen_voice.py @@ -0,0 +1,41 @@ +# 旁白生成:读取 script.json,逐句调用 edge-tts 生成 mp3,并写出时长清单 +import asyncio, json, os, sys, re +import edge_tts +from mutagen.mp3 import MP3 +ROOT = sys.argv[1] if len(sys.argv) > 1 else "/workspaces/frontend" +VOICE = "zh-CN-YunyangNeural" +# 生僻字/多音字 → 同音字(仅用于朗读,不影响字幕) +SUBS = [ + ("砌石为磴", "砌石维邓"), ("磴几不可登", "邓机不可登"), + ("姚鼐", "姚耐"), ("汶水", "问水"), ("入汶", "入问"), ("阳汶西", "阳问西"), + ("济水", "挤水"), ("入济", "入挤"), ("阴济东", "阴挤东"), + ("樗蒱", "出蒲"), ("“樗”", "“出”"), ("“蒱”", "“蒲”"), ("徂徕", "粗来"), + ("若偻", "若吕"), ("“偻”", "“吕”"), ("罅", "下"), ("圜", "圆"), + ("子颍", "子影"), ("“磴”", "“邓”"), ("日观", "日关"), ("绛皓", "匠浩"), ("长清", "常清"), +] +def spoken(t): + for a, b in SUBS: t = t.replace(a, b) + return t.replace("“", "").replace("”", "") +async def one(sem, line, out): + async with sem: + rate = "-14%" if line["k"] == "q" else "-3%" + pitch = "-4Hz" if line["k"] == "q" else "+0Hz" + path = os.path.join(out, line["id"] + ".mp3") + for attempt in range(4): + try: + c = edge_tts.Communicate(spoken(line["t"]), VOICE, rate=rate, pitch=pitch) + await c.save(path) + break + except Exception as e: + print("retry", line["id"], e); await asyncio.sleep(2) + return line["id"], round(MP3(path).info.length, 3) +async def main(): + script = json.load(open(os.path.join(ROOT, "src/video/script.json"), encoding="utf-8")) + out = os.path.join(ROOT, "public/voice"); os.makedirs(out, exist_ok=True) + sem = asyncio.Semaphore(5) + lines = [l for s in script for l in s["lines"]] + res = await asyncio.gather(*[one(sem, l, out) for l in lines]) + man = {k: v for k, v in res} + json.dump(man, open(os.path.join(ROOT, "src/video/voice.json"), "w"), ensure_ascii=False, indent=0) + print(len(man), "lines, total", round(sum(man.values()), 1), "s") +asyncio.run(main()) diff --git a/dengtaishan-src/tools/subset_fonts.py b/dengtaishan-src/tools/subset_fonts.py new file mode 100644 index 0000000000000000000000000000000000000000..dda5cfede6626d2366acd7f0c4dec820fb14f732 --- /dev/null +++ b/dengtaishan-src/tools/subset_fonts.py @@ -0,0 +1,20 @@ +# 字体子集化:扫描源码中出现的全部字符,生成 woff2 子集 +import os, re, sys, subprocess +SRC = "/workspaces/frontend/src"; OUT = "/workspaces/frontend/public/fonts"; FD = "/tmp/fonts" +os.makedirs(OUT, exist_ok=True) +chars = set() +for root, _, files in os.walk(SRC): + for f in files: + if f.endswith((".ts", ".tsx", ".json", ".css")): + chars |= set(open(os.path.join(root, f), encoding="utf-8").read()) +chars |= set("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ·—…“”‘’《》〈〉「」『』,。、;:?!()·-:/%.+|#@&") +text = "".join(sorted(c for c in chars if ord(c) >= 32)) +open("/tmp/fonts/chars.txt", "w", encoding="utf-8").write(text) +print("chars:", len(text)) +def run(*a): subprocess.run(a, check=True) +if not os.path.exists(f"{FD}/serif500.ttf"): + run("fonttools", "varLib.instancer", f"{FD}/NotoSerifSC[wght].ttf", "wght=500", "-o", f"{FD}/serif500.ttf") + run("fonttools", "varLib.instancer", f"{FD}/NotoSerifSC[wght].ttf", "wght=900", "-o", f"{FD}/serif900.ttf") +for src, name in [("serif500.ttf", "serif-500"), ("serif900.ttf", "serif-900"), ("MaShanZheng-Regular.ttf", "kai"), ("ZhiMangXing-Regular.ttf", "xing"), ("LiuJianMaoCao-Regular.ttf", "cao")]: + run("pyftsubset", f"{FD}/{src}", "--text-file=/tmp/fonts/chars.txt", "--flavor=woff2", f"--output-file={OUT}/{name}.woff2", "--layout-features=*") +for f in sorted(os.listdir(OUT)): print(f, os.path.getsize(os.path.join(OUT, f))) diff --git a/dengtaishan-src/tsconfig.json b/dengtaishan-src/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..5c9fa4a457fc113cfa49233d8f7954244638cad6 --- /dev/null +++ b/dengtaishan-src/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + "strict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noFallthroughCasesInSwitch": true, + "paths": { + "@/*": ["./src/*"] + } + }, + "include": ["src"] +} diff --git a/dengtaishan-src/vite.config.ts b/dengtaishan-src/vite.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..ce299d5c830c3fb2e40554a678a9609b95217092 --- /dev/null +++ b/dengtaishan-src/vite.config.ts @@ -0,0 +1,57 @@ +import viteErrorReporter from "./.vulcan-error-reporter.js"; +import path from 'path' +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' +import tailwindcss from '@tailwindcss/vite' + +export default defineConfig(() => { + const frontendPort = Number.parseInt(process.env.PORT || '', 10) + const backendPort = Number.parseInt(process.env.BACKEND_PORT || '', 10) + const base = process.env.BASE_PATH || './' + const hasAbsBase = base.startsWith('/') + const apiBasePrefix = hasAbsBase ? base.replace(/\/$/, '') : '' + + const backendProxy = { + target: `http://127.0.0.1:${backendPort}`, + changeOrigin: true, + ...(hasAbsBase && { + rewrite: (requestPath: string) => requestPath.replace(base, '/'), + }), + } + + return { + cacheDir: process.env.VITE_CACHE_DIR || 'node_modules/.vite', + plugins: [ + viteErrorReporter({ vulcanDir: "/workspaces/.vulcan" }),react(), tailwindcss()], + server: { + allowedHosts: true, + host: '0.0.0.0', + port: frontendPort || undefined, + proxy: { + [`${apiBasePrefix}/api`]: backendProxy, + }, + hmr: { + path: 'ws/vite-hmr', + }, + }, + resolve: { + alias: { + '@': path.resolve(__dirname, './src'), + }, + dedupe: ['react', 'react-dom'], + preserveSymlinks: true, + }, + optimizeDeps: { + include: [ + 'react', + 'react-dom', + 'react-dom/client', + 'react/jsx-dev-runtime', + 'react/jsx-runtime', + '@tanstack/react-query', + '@tanstack/query-core', + ], + }, + base, + } +})