余白 UI:按设计稿模块化还原 + 站主自定义 CSS + 详情 neighbors + 静态缓存头

前端(新增 ui/yohaku/,各视图按 ui_id=vivid 分支渲染;classic 与后台不受影响)
- 令牌层:设计稿数值原样落地,28 个 --v-* 为站主接口(自定义 CSS 可覆盖,
  放 @layer 让出优先级);另加防线,中和 styles.css 裸选择器
  (h1 衬线 / body 行高 / 后台 .stat/.toolbar/.chip 卡片)漏进余白元素
- 顶栏(滚动收缩态)/ 阅读进度(顶部 2px + READ n%)/ 页脚
- 首页:hero(统计条)/ 筛选(类型分段 + 标签 chips + 搜索)/
  长文卡片与短文纸条 / 分页 / 作品展示区(3 件 + 查看所有,参照 diygod.cc);
  面板栅格改 1.6fr 1fr 1fr 且高度自适应内容(标签云明显大一圈)
- 文章页:三栏「纸」—— 左时间线(前后各两篇)/ 中纸张 / 右目录与阅读进度;
  短文详情不显示标题(h1 视觉隐藏保留无障碍)
- 全部规则收敛在 html[data-ui='vivid'] 前缀下;无 !important

后端
- GET /api/posts/:slug 增 neighbors(前后各两篇,详情页侧栏时间线用)
- SPA 缓存头:index.html no-cache,assets/ 带 hash 长期 immutable
  (此前无缓存头,浏览器会一直拿旧构建)

其他
- 站主自定义 CSS 管线(customCss.js + ui/sections.js,按分区注入,仅 vivid)
- 删除旧 vivid 覆盖层实现(VividNav/Hero/Footer/Timeline/Toc、ui/vivid.css)
- 设计稿原型附于仓库根 index.html;作品表清掉外链 diygod.cc 的示例封面,
  改用本地占位图(public/covers/)
This commit is contained in:
Sakurasan committed 2026-09-23 15:37:42 +08:00
1 parent 3238175ef0
commit fbda293072
46 files changed
+4266 -35

No files matched your search

+243
View File
@@ -0,0 +1,243 @@
/* ONE · 余白(yohaku)· 由设计稿按节拆分 / 窄屏
*
* 由设计稿(仓库根 index.html 的 <style>)按它自己的分节原样拆分。
* 只做了一件事:给每条规则加 html[data-ui='vivid'] 前缀(@media 内部的
* 规则也逐条加,at-rule 本身不加),并把 :root[data-theme="dark"] 映射到
* 本站的 vivid-dark。数值一律未改,规则也没有被拆开过。
*
* 前缀是硬要求:组件 scoped 样式编译后是 .foo[data-v-HASH](0,2,0),
* html[data-ui='vivid'] .foo 是(0,2,1)才能稳定取胜;scoped 是懒加载
* chunk,入口 CSS 之后才到位,平手时按源码顺序反而会赢。
*/
/* ---- 设计稿分节:Hero ---- */
/* ---- Hero ---- */
html[data-ui='vivid'] .hero{
max-width:1100px;margin:0 auto;padding:72px 28px 48px;
position:relative;
}
html[data-ui='vivid'] .hero .kicker{
display:inline-flex;align-items:center;gap:8px;
font-size:12px;font-weight:700;letter-spacing:.14em;
color:var(--accent);text-transform:uppercase;
margin-bottom:20px;
}
html[data-ui='vivid'] .hero .kicker::before{
content:"";width:20px;height:1.5px;background:var(--accent);border-radius:2px;
}
html[data-ui='vivid'] .hero h1{
margin:0;font-size:clamp(36px,5.5vw,56px);font-weight:800;
letter-spacing:-.03em;line-height:1.15;max-width:16ch;
color:var(--ink);
}
html[data-ui='vivid'] .hero h1 .hl{
color:var(--accent);
position:relative;
}
html[data-ui='vivid'] .hero h1 .hl::after{
content:"";position:absolute;left:0;right:0;bottom:4px;height:8px;
background:var(--accent-soft);z-index:-1;border-radius:2px;
}
html[data-ui='vivid'] .hero .lead{
margin:18px 0 0;max-width:480px;font-size:16px;
color:var(--soft);line-height:1.8;
}
html[data-ui='vivid'] .hero .lead strong{color:var(--text);font-weight:700}
html[data-ui='vivid'] .stats{display:flex;gap:28px;margin-top:32px;flex-wrap:wrap}
html[data-ui='vivid'] .stat b{
display:block;font-size:22px;font-weight:800;letter-spacing:-.02em;
color:var(--ink);font-variant-numeric:tabular-nums;
}
html[data-ui='vivid'] .stat span{font-size:12px;color:var(--muted);font-weight:600}
/* ---- 设计稿分节:筛选 ---- */
/* ---- 筛选 ---- */
html[data-ui='vivid'] .wrap{max-width:1100px;margin:0 auto;padding:8px 28px 48px}
html[data-ui='vivid'] .toolbar{
display:flex;gap:10px;flex-wrap:wrap;align-items:center;
padding-bottom:20px;margin-bottom:8px;
border-bottom:1px solid var(--line);
}
html[data-ui='vivid'] .seg{
display:inline-flex;background:color-mix(in srgb,var(--ink) 5%,transparent);
border-radius:999px;padding:3px;gap:2px;
}
html[data-ui='vivid'] .seg button{
font-size:13px;font-weight:600;color:var(--soft);
padding:7px 16px;border-radius:999px;
transition:background .3s var(--ease),color .3s var(--ease),transform .5s var(--spring);
}
html[data-ui='vivid'] .seg button:hover{color:var(--ink)}
html[data-ui='vivid'] .seg button.on{
background:var(--card);color:var(--accent);
box-shadow:var(--shadow);
transform:scale(1.02);
}
html[data-ui='vivid'] .chips{display:flex;gap:6px;flex-wrap:wrap;flex:1}
html[data-ui='vivid'] .chip{
font-size:12.5px;font-weight:600;color:var(--soft);
padding:7px 14px;border-radius:999px;
border:1px solid var(--line);
transition:all .35s var(--spring);
}
html[data-ui='vivid'] .chip:hover{border-color:var(--accent);color:var(--accent);transform:translateY(-2px)}
html[data-ui='vivid'] .chip.on{
background:var(--accent);border-color:var(--accent);color:#fff;
box-shadow:0 6px 16px var(--accent-glow);
transform:translateY(-1px);
}
html[data-ui='vivid'] .search{
display:flex;align-items:center;gap:6px;
background:color-mix(in srgb,var(--ink) 4%,transparent);
border-radius:999px;padding:2px 4px 2px 14px;
border:1px solid transparent;
transition:border-color .3s,background .3s,box-shadow .3s;
}
html[data-ui='vivid'] .search:focus-within{
border-color:var(--accent);background:var(--card);
box-shadow:0 0 0 3px var(--accent-soft);
}
html[data-ui='vivid'] .search input{
border:0;background:transparent;outline:none;font:inherit;font-size:13.5px;
width:150px;padding:7px 0;color:var(--ink);
}
html[data-ui='vivid'] .search input::placeholder{color:var(--muted)}
html[data-ui='vivid'] .search button{
width:32px;height:32px;border-radius:50%;
background:var(--accent);color:#fff;font-size:13px;
transition:transform .5s var(--spring),box-shadow .3s;
}
html[data-ui='vivid'] .search button:hover{transform:scale(1.1);box-shadow:0 4px 12px var(--accent-glow)}
/* ---- 设计稿分节:列表:长文卡片 / 短文纸条 ---- */
/* ---- 列表:长文卡片 / 短文纸条 ---- */
html[data-ui='vivid'] .feed{display:flex;flex-direction:column;gap:18px;padding-top:24px}
/* 长文:干净卡片 */
html[data-ui='vivid'] .card{
display:block;background:var(--card);
border:1px solid var(--line);
border-radius:var(--radius-lg);
overflow:hidden;
box-shadow:var(--shadow);
transition:transform .55s var(--spring),box-shadow .45s var(--ease),border-color .3s;
position:relative;
}
html[data-ui='vivid'] .card:hover{
transform:translateY(-4px) scale(1.005);
box-shadow:var(--shadow-lg);
border-color:color-mix(in srgb,var(--accent) 35%,transparent);
}
html[data-ui='vivid'] .card:active{transform:translateY(-1px) scale(.998);transition-duration:.15s}
html[data-ui='vivid'] .card .cov{
height:180px;background:linear-gradient(
135deg,
color-mix(in srgb,var(--accent) 25%,var(--paper)),
color-mix(in srgb,var(--accent) 8%,var(--paper))
);
position:relative;overflow:hidden;
}
html[data-ui='vivid'] .card .cov img{width:100%;height:100%;object-fit:cover;transition:transform .8s var(--ease)}
html[data-ui='vivid'] .card:hover .cov img{transform:scale(1.04)}
html[data-ui='vivid'] .card .body{padding:22px 26px 24px}
html[data-ui='vivid'] .card .meta{
display:flex;gap:10px;align-items:center;flex-wrap:wrap;
font-size:12px;color:var(--muted);font-weight:600;margin-bottom:10px;
}
html[data-ui='vivid'] .badge{
font-size:10.5px;font-weight:800;letter-spacing:.06em;
padding:3px 9px;border-radius:999px;
}
html[data-ui='vivid'] .badge.long{background:var(--accent-soft);color:var(--accent)}
html[data-ui='vivid'] .badge.short{background:rgba(52,199,89,.14);color:#28a745}
html[data-ui='vivid'] .card h2{
margin:0 0 10px;font-size:clamp(19px,2.2vw,23px);font-weight:800;
letter-spacing:-.02em;line-height:1.35;color:var(--ink);
transition:color .25s;
}
html[data-ui='vivid'] .card:hover h2{color:var(--accent)}
html[data-ui='vivid'] .card .sum{
margin:0;font-size:14.5px;line-height:1.75;color:var(--soft);
display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;
}
html[data-ui='vivid'] .card .tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:14px}
html[data-ui='vivid'] .tg{
font-size:11.5px;font-weight:700;color:var(--soft);
padding:4px 11px;border-radius:999px;
background:color-mix(in srgb,var(--ink) 5%,transparent);
transition:all .4s var(--spring);
}
html[data-ui='vivid'] .tg:hover{background:var(--accent-soft);color:var(--accent);transform:translateY(-2px)}
/* 短文:纸条,无框更轻 */
html[data-ui='vivid'] .note{
display:block;background:transparent;
border-left:3px solid var(--accent);
border-radius:0 var(--radius) var(--radius) 0;
padding:18px 24px;
margin-left:12px;
position:relative;
transition:background .35s var(--ease),transform .55s var(--spring),border-color .3s;
}
html[data-ui='vivid'] .note:hover{
background:var(--card);
transform:translateX(6px);
box-shadow:var(--shadow);
}
html[data-ui='vivid'] .note .meta{
display:flex;gap:10px;align-items:center;
font-size:12px;color:var(--muted);font-weight:600;margin-bottom:8px;
}
html[data-ui='vivid'] .note .body{
margin:0;font-size:15.5px;line-height:1.8;color:var(--text);
}
html[data-ui='vivid'] .note .body a{
color:var(--accent);font-weight:600;
border-bottom:1px solid color-mix(in srgb,var(--accent) 40%,transparent);
transition:border-color .25s;
}
html[data-ui='vivid'] .note .body a:hover{border-bottom-color:var(--accent)}
html[data-ui='vivid'] .note .tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:12px}
/* ---- 设计稿分节:分页 ---- */
/* ---- 分页 ---- */
html[data-ui='vivid'] .pager{
display:flex;gap:8px;align-items:center;justify-content:center;
margin-top:36px;flex-wrap:wrap;
}
html[data-ui='vivid'] .pager button{
font-size:13px;font-weight:700;padding:9px 16px;border-radius:999px;
color:var(--soft);border:1px solid var(--line);background:var(--card);
transition:all .45s var(--spring);
}
html[data-ui='vivid'] .pager button:hover:not(:disabled){
border-color:var(--accent);color:var(--accent);transform:translateY(-2px);
box-shadow:0 6px 16px var(--accent-soft);
}
html[data-ui='vivid'] .pager button:disabled{opacity:.4;cursor:not-allowed}
html[data-ui='vivid'] .pager .cur{
background:var(--accent);border-color:var(--accent);color:#fff;
box-shadow:0 6px 16px var(--accent-glow);
}
html[data-ui='vivid'] .pager .info{border:0;background:none;color:var(--muted);font-weight:600;font-size:12.5px}
/* ---- 首页作品展示区(参照 diygod.cc:只展示部分 + 查看所有) ---- */
html[data-ui='vivid'] .showcase{
max-width:1100px;margin:56px auto 0;padding:0 28px;
}
html[data-ui='vivid'] .show-head{
display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:20px;
}
html[data-ui='vivid'] .show-head h2{
margin:0;font-size:1.4rem;font-weight:650;letter-spacing:0.01em;
}
html[data-ui='vivid'] .show-head .en{color:var(--muted)}
html[data-ui='vivid'] .show-head .push{margin-left:auto;color:var(--muted)}
html[data-ui='vivid'] .show-head .push:hover{color:var(--accent-deep)}
html[data-ui='vivid'] .show-more{display:flex;justify-content:center;margin-top:26px}
html[data-ui='vivid'] .show-more .chip{font-size:13px;padding:9px 22px}
@media (max-width:860px){
html[data-ui='vivid'] .showcase{
padding-left:max(18px, env(safe-area-inset-left));
padding-right:max(18px, env(safe-area-inset-right));
}
}