feat: 暗色主题 + /2026 详情页 + 逐页标题 — 对齐原站剩余缺口

- 暗色主题 1:1:ThemeModeProvider 原逻辑(localStorage 'theme'
  light/dark/system、system 跟随 prefers-color-scheme、<html> class 切换),
  CSS tokens 按原站 .dark 块翻值(--label/--background-deep/--code-*);
  shellMedia 重构为 useSyncExternalStore 单例 store(Header 与 Canvas 共享)
- WebGL 主题分支:BackgroundFX 暗色渐变(#2c4bd5/#00000d/#00344C +
  outputMix .95/edgeIntensity -.82,原 sj 配置)、DotOverlay #0F1111、
  LoadingCurtain #191b1b、玻璃模型暗色参数组(shininess 100/fresnel .72/
  brightness .6/uDark=1 Hard-Light)与暗色 tint(hello #64c3ff、
  footer #8e9dc4/#64c3ff)
- /2026 路由:rewrite 补 2026(此前 404),workArticles 增加 /2026 占位文章
  (原站内容被服务端口令保密无法读取,已注释说明);解锁屏→刷新→服务端
  放行全链路 CDP 验证通过
- 逐页 <title>:app/work/[slug]/layout.tsx generateMetadata 映射作品名
  (reunimos→Reunimos™),受保护 /2026 未解锁时 SSR 'Protected'(原站行为),
  根标题改回原站 'HAOQI©2026'
This commit is contained in:
2026-09-02 14:31:28 +08:00
parent 696cfa8c2c
commit d5a1228aac
10 changed files with 337 additions and 68 deletions
+32 -3
View File
@@ -19,6 +19,7 @@ import {
} from "three";
import { usePointer } from "@/lib/pointer";
import { scrollBus } from "@/lib/scrollBus";
import { useResolvedTheme } from "@/lib/shellMedia";
/**
* Animated background — 1:1 port of the original `sz` + `sV` + `s$`
@@ -39,6 +40,11 @@ import { scrollBus } from "@/lib/scrollBus";
const BG_COLOR = "#ffead6";
const VIGNETTE_COLOR = "#6196ff";
const OUTPUT_COLOR = "#acffb9";
// Dark branch (original sL/sH/s_ + sj.dark): deep blue bg, near-black
// vignette, teal output; stronger output mix, much stronger edge falloff.
const DARK_BG_COLOR = "#2c4bd5";
const DARK_VIGNETTE_COLOR = "#00000d";
const DARK_OUTPUT_COLOR = "#00344C";
const OUTPUT_MIX = 0.65;
const MOUSE_POS = new Vector2(0.5, -0.1);
const CENTER = new Vector2(0.5, 0.5);
@@ -548,9 +554,32 @@ export function BackgroundFX() {
[]
);
const bgColor = useMemo(() => toVec3(BG_COLOR), []);
const vignetteColor = useMemo(() => toVec3(VIGNETTE_COLOR), []);
const outputColor = useMemo(() => toVec3(OUTPUT_COLOR), []);
const isDark = useResolvedTheme() === "dark";
// sj: light {outputMix:.65, edgeIntensity:-.16} / dark {outputMix:.95,
// edgeIntensity:-.82} — swapped on theme flip (original sz reads
// resolvedTheme and re-seeds the uniforms per branch).
const bgColor = useMemo(() => toVec3(isDark ? DARK_BG_COLOR : BG_COLOR), [isDark]);
const vignetteColor = useMemo(
() => toVec3(isDark ? DARK_VIGNETTE_COLOR : VIGNETTE_COLOR),
[isDark]
);
const outputColor = useMemo(
() => toVec3(isDark ? DARK_OUTPUT_COLOR : OUTPUT_COLOR),
[isDark]
);
// sj dark branch values + clear color: keep the RT clear in sync so the
// first pre-pass composites over the right base after a theme flip.
useEffect(() => {
materials.outputMaterial.uniforms.uOutputMix.value = isDark ? 0.95 : 0.65;
materials.vignetteMaterial.uniforms.uEdgeIntensity.value = isDark
? -0.82
: -0.16;
gl.setClearColor(new Color(isDark ? DARK_BG_COLOR : BG_COLOR), 1);
gl.setRenderTarget(rtsRef.current.read);
gl.clear();
gl.setRenderTarget(null);
}, [isDark, materials, gl]);
// Internal ortho scene for pre-passes (original v/A + first-pass mesh).
const preScene = useMemo(() => new Scene(), []);
+3 -2
View File
@@ -4,6 +4,7 @@ import { useLayoutEffect, useMemo, useRef } from "react";
import { useFrame, useThree } from "@react-three/fiber";
import { Color, Vector2 } from "three";
import { scrollBus } from "@/lib/scrollBus";
import { useResolvedTheme } from "@/lib/shellMedia";
/**
* Scroll dot-overlay — 1:1 port of the original `s1` (chunk
@@ -30,8 +31,8 @@ function sT(e?: number): number {
}
export function DotOverlay() {
// Light-only theme (original: resolvedTheme from useThemeMode).
const isDark = false;
// Original: resolvedTheme from useThemeMode (s1 picks e[0] dark / e[1] light).
const isDark = useResolvedTheme() === "dark";
const size = useThree((s) => s.size);
const materialRef = useRef<any>(null);
+53 -4
View File
@@ -8,6 +8,7 @@ import { mergeGeometries } from "three/examples/jsm/utils/BufferGeometryUtils.js
import { scrollBus } from "@/lib/scrollBus";
import { usePointer } from "@/lib/pointer";
import { loadingBus } from "@/lib/loadingBus";
import { useResolvedTheme } from "@/lib/shellMedia";
/**
* Glass models for the hero section, reverse-engineered 1:1 from the
@@ -259,6 +260,25 @@ const LIGHT_PARAMS = {
lightZ: 0.5,
};
// Dark-theme branch of the same cloned controls (original dark* control
// values): the glass switches to Hard-Light duotone mixing (uDark 1) with a
// different highlight/fresnel response.
const DARK_PARAMS = {
shininess: 100,
diffuseness: 0.05,
fresnelPower: 3,
fresnelStrength: 0.72,
brightness: 0.6,
contrast: 0.98,
gamma: 1,
saturation: 1.2,
tintMix: 1,
tintThicknessMinAlpha: 1,
tintThicknessMaxAlpha: 0.4,
tintColorA: "#64c3ff",
tintColorB: "#8e9dc4",
};
// Default uniforms from the bundle's uniform factory
const IOR = { R: 1.15, Y: 1.16, G: 1.18, C: 1.22, B: 1.22, P: 1.22 };
@@ -495,6 +515,35 @@ function GlassModel({
uniforms.uTintLocalYRange.value.set(tintYRange[0], tintYRange[1]);
}, [tintYRange, uniforms]);
// Theme branch (original cf(controls, theme) + E useMemo): swap the
// highlight/fresnel response and tint colors when the resolved theme
// flips. Per-model tingColor overrides: m[0]/m[1] light A/B,
// m[2]/m[3] dark A/B, missing entries fall back to the theme defaults.
const isDark = useResolvedTheme() === "dark";
useEffect(() => {
const P = isDark ? DARK_PARAMS : LIGHT_PARAMS;
uniforms.uShininess.value = P.shininess;
uniforms.uDiffuseness.value = P.diffuseness;
uniforms.uFresnelPower.value = P.fresnelPower;
uniforms.uFresnelStrength.value = P.fresnelStrength;
uniforms.uBrightness.value = P.brightness;
uniforms.uContrast.value = P.contrast;
uniforms.uGamma.value = P.gamma;
uniforms.uSaturation.value = P.saturation;
uniforms.uTintMix.value = P.tintMix;
uniforms.uTintThicknessMinAlpha.value = P.tintThicknessMinAlpha;
uniforms.uTintThicknessMaxAlpha.value = P.tintThicknessMaxAlpha;
const tintA = isDark
? (tintColors?.[2] ?? DARK_PARAMS.tintColorA)
: (tintColors?.[0] ?? LIGHT_PARAMS.tintColorA);
const tintB = isDark
? (tintColors?.[3] ?? DARK_PARAMS.tintColorB)
: (tintColors?.[1] ?? LIGHT_PARAMS.tintColorB);
uniforms.uTintColorA.value.copy(hexToVec4(tintA));
uniforms.uTintColorB.value.copy(hexToVec4(tintB));
uniforms.uDark.value = isDark ? 1 : 0;
}, [isDark, tintColors, uniforms]);
useEffect(() => {
const drawingBufferSize = gl.getDrawingBufferSize(new THREE.Vector2());
uniforms.uScreenResolutionPx.value.set(
@@ -675,9 +724,9 @@ export function CursorStar({ isMobile = false }: { isMobile?: boolean }) {
afterRotation={[0, 720, 0]}
rotation={[0, 0, 0]}
scale={0.1}
// Original tingColor light theme: tint A and B are BOTH #009dff
// (m[0]/m[1]); #64c3ff (m[2]/m[3]) is the dark-theme value.
tintColors={["#009dff", "#009dff"]}
// Original tingColor: light m[0]/m[1] both #009dff, dark m[2]/m[3]
// both #64c3ff.
tintColors={["#009dff", "#009dff", "#64c3ff", "#64c3ff"]}
tintEnabled
isMobile={isMobile}
scrollSyncFactor={0.72}
@@ -714,7 +763,7 @@ export function FooterModel() {
beforeRotation={[-180, 0, 0]}
rotation={[0, 0, 0]}
scale={19}
tintColors={["#FFFFFF", "#009dff"]}
tintColors={["#FFFFFF", "#009dff", "#8e9dc4", "#64c3ff"]}
tintEnabled
sectionTopDocY={geom.top}
sectionHeightPx={geom.height}
+4 -2
View File
@@ -6,6 +6,7 @@ import { Canvas, useFrame, useThree } from "@react-three/fiber";
import { Color, MathUtils, UnsignedByteType } from "three";
import { Effect, BlendFunction } from "postprocessing";
import { EffectComposer } from "@react-three/postprocessing";
import { useResolvedTheme } from "@/lib/shellMedia";
import { customCubic } from "@/lib/customCubic";
/**
@@ -253,8 +254,9 @@ function RadialHoleMask({
const { size } = useThree();
const invalidate = useThree((s) => s.invalidate);
// Light theme picks f[1] (#efede7).
const color = CURTAIN_COLORS[1];
// Original f(p): dark picks f[0] (#191b1b), light picks f[1] (#efede7).
const isDark = useResolvedTheme() === "dark";
const color = isDark ? CURTAIN_COLORS[0] : CURTAIN_COLORS[1];
const uniforms = useMemo(
() => ({