mirror of
https://github.com/Feather-2/paper-burner-x.git
synced 2026-09-17 17:18:15 +08:00
feat: CSS 架构重构 Phase 1-2 完成
Phase 1: 基础设施建设 - 创建分层目录结构(01-foundation, 02-layout, 03-components, 04-features, 05-utilities) - 创建完整的 CSS 变量系统(variables.css) - z-index 层级规范化 - 颜色、尺寸、间距、动画等设计令牌 - 创建 reset.css 和 typography.css 基础样式 Phase 2: TOC 模块重构 - 合并 toc-base.css + toc-extensions.css + toc-optimized.css - 创建统一的 toc.css(~700行) - 使用 CSS 变量替换所有硬编码值 - 移除大部分 !important(仅保留必要的) - 消除三个文件间的样式冲突(位置、尺寸、z-index) - 保持向后兼容性(ID 选择器) 主要改进: - 统一 z-index 使用 CSS 变量(--z-fixed, --z-popover) - 统一尺寸和间距使用变量 - 清晰的代码结构和注释 - 响应式设计优化 - 打印样式支持 下一步:Phase 3 沉浸模式重构、Phase 4 Dock 模块重构
This commit is contained in:
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* CSS Reset - 基础样式重置
|
||||
*
|
||||
* 职责:规范化浏览器默认样式,建立一致的基础
|
||||
* 作用域:全局
|
||||
* 依赖:variables.css(可选,主要用于一致性)
|
||||
*/
|
||||
|
||||
/* ==================== Box Model 规范 ==================== */
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* ==================== HTML & Body 基础设置 ==================== */
|
||||
|
||||
html {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
text-rendering: optimizeLegibility;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-family-base);
|
||||
font-size: var(--font-size-base);
|
||||
font-weight: var(--font-weight-normal);
|
||||
line-height: var(--line-height-base);
|
||||
color: var(--color-text-primary);
|
||||
background-color: var(--color-bg-base);
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* ==================== 语义化标签重置 ==================== */
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
line-height: var(--line-height-tight);
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--color-primary-hover);
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
/* ==================== 表单元素重置 ==================== */
|
||||
|
||||
button,
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
border: none;
|
||||
background: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
button:disabled {
|
||||
opacity: var(--disabled-opacity);
|
||||
cursor: var(--disabled-cursor);
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
outline: 2px solid var(--color-primary);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* ==================== 图片与媒体 ==================== */
|
||||
|
||||
img,
|
||||
svg,
|
||||
video,
|
||||
canvas {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* ==================== 表格重置 ==================== */
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* ==================== 其他元素 ==================== */
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid var(--color-border-light);
|
||||
margin: var(--spacing-md) 0;
|
||||
}
|
||||
|
||||
code,
|
||||
pre {
|
||||
font-family: var(--font-family-monospace);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
margin: 0;
|
||||
padding-left: var(--spacing-md);
|
||||
border-left: 4px solid var(--color-border-medium);
|
||||
}
|
||||
|
||||
/* ==================== 滚动条样式(Webkit) ==================== */
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: var(--color-bg-secondary);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--color-border-medium);
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--color-border-dark);
|
||||
}
|
||||
|
||||
/* ==================== 文本选择 ==================== */
|
||||
|
||||
::selection {
|
||||
background-color: var(--color-selection-bg);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
::-moz-selection {
|
||||
background-color: var(--color-selection-bg);
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
/* ==================== 辅助功能 ==================== */
|
||||
|
||||
/* 隐藏但对屏幕阅读器可见 */
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap;
|
||||
border-width: 0;
|
||||
}
|
||||
|
||||
/* 移除 focus 时的 outline(仅在非键盘导航时) */
|
||||
:focus:not(:focus-visible) {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* ==================== 打印样式 ==================== */
|
||||
|
||||
@media print {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
background: transparent !important;
|
||||
color: #000 !important;
|
||||
box-shadow: none !important;
|
||||
text-shadow: none !important;
|
||||
}
|
||||
|
||||
a,
|
||||
a:visited {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a[href]::after {
|
||||
content: " (" attr(href) ")";
|
||||
}
|
||||
|
||||
abbr[title]::after {
|
||||
content: " (" attr(title) ")";
|
||||
}
|
||||
|
||||
pre,
|
||||
blockquote {
|
||||
border: 1px solid #999;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
tr,
|
||||
img {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
p,
|
||||
h2,
|
||||
h3 {
|
||||
orphans: 3;
|
||||
widows: 3;
|
||||
}
|
||||
|
||||
h2,
|
||||
h3 {
|
||||
page-break-after: avoid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,332 @@
|
||||
/**
|
||||
* Typography - 排版系统
|
||||
*
|
||||
* 职责:定义标题、段落、列表等文本元素的样式
|
||||
* 作用域:全局与 .markdown-content 作用域
|
||||
* 依赖:variables.css
|
||||
*/
|
||||
|
||||
/* ==================== 标题层级 ==================== */
|
||||
|
||||
h1 {
|
||||
font-size: var(--font-size-xxl);
|
||||
font-weight: var(--font-weight-bold);
|
||||
line-height: var(--line-height-tight);
|
||||
margin-bottom: var(--spacing-lg);
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
line-height: var(--line-height-tight);
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
line-height: var(--line-height-base);
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
h4 {
|
||||
font-size: var(--font-size-md);
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: var(--line-height-base);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
h5 {
|
||||
font-size: var(--font-size-base);
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: var(--line-height-base);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
h6 {
|
||||
font-size: var(--font-size-sm);
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: var(--line-height-base);
|
||||
margin-bottom: var(--spacing-xs);
|
||||
}
|
||||
|
||||
/* ==================== 段落与文本块 ==================== */
|
||||
|
||||
p {
|
||||
margin-bottom: var(--spacing-md);
|
||||
line-height: var(--line-height-relaxed);
|
||||
}
|
||||
|
||||
p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* ==================== 列表 ==================== */
|
||||
|
||||
ul,
|
||||
ol {
|
||||
margin-bottom: var(--spacing-md);
|
||||
padding-left: var(--spacing-lg);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: var(--spacing-xs);
|
||||
line-height: var(--line-height-relaxed);
|
||||
}
|
||||
|
||||
li:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* 嵌套列表 */
|
||||
ul ul,
|
||||
ol ul {
|
||||
list-style-type: circle;
|
||||
margin-top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
ul ol,
|
||||
ol ol {
|
||||
list-style-type: lower-alpha;
|
||||
margin-top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
/* ==================== 链接 ==================== */
|
||||
|
||||
a {
|
||||
color: var(--color-primary);
|
||||
text-decoration: none;
|
||||
transition: color var(--transition-fast);
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--color-primary-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a:active {
|
||||
color: var(--color-primary-active);
|
||||
}
|
||||
|
||||
/* ==================== 强调与标记 ==================== */
|
||||
|
||||
strong,
|
||||
b {
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
em,
|
||||
i {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
mark {
|
||||
background-color: var(--color-highlight-bg);
|
||||
color: var(--color-text-primary);
|
||||
padding: 0 var(--spacing-xs);
|
||||
}
|
||||
|
||||
del,
|
||||
s {
|
||||
text-decoration: line-through;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
ins,
|
||||
u {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: var(--color-primary);
|
||||
}
|
||||
|
||||
small {
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
/* ==================== 代码 ==================== */
|
||||
|
||||
code {
|
||||
font-family: var(--font-family-monospace);
|
||||
font-size: 0.9em;
|
||||
background-color: var(--color-bg-secondary);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--radius-sm);
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
pre {
|
||||
font-family: var(--font-family-monospace);
|
||||
font-size: var(--font-size-sm);
|
||||
background-color: var(--color-bg-secondary);
|
||||
padding: var(--spacing-md);
|
||||
border-radius: var(--radius-md);
|
||||
overflow-x: auto;
|
||||
margin-bottom: var(--spacing-md);
|
||||
line-height: var(--line-height-relaxed);
|
||||
}
|
||||
|
||||
pre code {
|
||||
background-color: transparent;
|
||||
padding: 0;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* ==================== 引用 ==================== */
|
||||
|
||||
blockquote {
|
||||
margin: var(--spacing-md) 0;
|
||||
padding-left: var(--spacing-md);
|
||||
border-left: 4px solid var(--color-border-medium);
|
||||
color: var(--color-text-secondary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
blockquote p {
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
blockquote cite {
|
||||
display: block;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-muted);
|
||||
font-style: normal;
|
||||
margin-top: var(--spacing-sm);
|
||||
}
|
||||
|
||||
blockquote cite::before {
|
||||
content: "— ";
|
||||
}
|
||||
|
||||
/* ==================== 水平分隔线 ==================== */
|
||||
|
||||
hr {
|
||||
border: 0;
|
||||
border-top: 1px solid var(--color-border-light);
|
||||
margin: var(--spacing-lg) 0;
|
||||
}
|
||||
|
||||
/* ==================== 缩写与定义 ==================== */
|
||||
|
||||
abbr[title] {
|
||||
text-decoration: underline dotted;
|
||||
cursor: help;
|
||||
border-bottom: 1px dotted var(--color-border-medium);
|
||||
}
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
/* ==================== Markdown 内容特定样式 ==================== */
|
||||
|
||||
.markdown-content {
|
||||
/* 为 Markdown 渲染的内容提供额外的间距 */
|
||||
line-height: var(--line-height-relaxed);
|
||||
}
|
||||
|
||||
.markdown-content > *:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.markdown-content > *:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.markdown-content h1,
|
||||
.markdown-content h2 {
|
||||
padding-bottom: var(--spacing-sm);
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
margin-top: var(--spacing-xl);
|
||||
margin-bottom: var(--spacing-md);
|
||||
}
|
||||
|
||||
.markdown-content h3,
|
||||
.markdown-content h4,
|
||||
.markdown-content h5,
|
||||
.markdown-content h6 {
|
||||
margin-top: var(--spacing-lg);
|
||||
margin-bottom: var(--spacing-sm);
|
||||
}
|
||||
|
||||
.markdown-content img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
margin: var(--spacing-md) auto;
|
||||
border-radius: var(--radius-md);
|
||||
}
|
||||
|
||||
.markdown-content table {
|
||||
width: 100%;
|
||||
margin: var(--spacing-md) 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.markdown-content table th,
|
||||
.markdown-content table td {
|
||||
padding: var(--spacing-sm);
|
||||
border: 1px solid var(--color-border-light);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.markdown-content table th {
|
||||
background-color: var(--color-bg-secondary);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
|
||||
.markdown-content table tr:nth-child(even) {
|
||||
background-color: var(--color-bg-secondary);
|
||||
}
|
||||
|
||||
/* ==================== 工具类 ==================== */
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.text-left {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.text-right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: var(--color-text-muted);
|
||||
}
|
||||
|
||||
.text-small {
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
.text-large {
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
.text-bold {
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.text-truncate {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.text-nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.text-break {
|
||||
word-wrap: break-word;
|
||||
word-break: break-word;
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
/**
|
||||
* CSS Variables - History Detail 全局变量系统
|
||||
*
|
||||
* 职责:定义所有可复用的设计令牌(Design Tokens)
|
||||
* 作用域:全局(:root)
|
||||
* 修改时机:仅在需要全局调整设计系统时修改
|
||||
*
|
||||
* 组织结构:
|
||||
* 1. Z-Index 层级系统
|
||||
* 2. 颜色系统
|
||||
* 3. 尺寸系统(TOC、Dock、Immersive)
|
||||
* 4. 间距与圆角
|
||||
* 5. 动画与过渡
|
||||
* 6. 断点(响应式)
|
||||
*/
|
||||
|
||||
:root {
|
||||
/* ==================== Z-Index 层级系统 ==================== */
|
||||
/* 原则:使用语义化命名,避免数值碰撞 */
|
||||
|
||||
--z-base: 1; /* 基础层 */
|
||||
--z-dropdown: 1000; /* 下拉菜单 */
|
||||
--z-sticky: 1020; /* 粘性元素 */
|
||||
--z-fixed: 1030; /* 固定定位 */
|
||||
--z-modal-backdrop: 1040; /* 弹窗背景遮罩 */
|
||||
--z-modal: 1050; /* 弹窗主体 */
|
||||
--z-popover: 1060; /* 气泡提示 (TOC popup) */
|
||||
--z-tooltip: 1070; /* 工具提示 */
|
||||
--z-immersive-container: 1999; /* 沉浸模式容器 */
|
||||
--z-immersive-controls: 2000; /* 沉浸模式控制按钮 */
|
||||
--z-lightbox: 2010; /* 图片灯箱 */
|
||||
--z-critical: 9999; /* 关键 UI(慎用) */
|
||||
|
||||
/* ==================== 颜色系统 ==================== */
|
||||
|
||||
/* 主色 */
|
||||
--color-primary: #007bff;
|
||||
--color-primary-hover: #0056b3;
|
||||
--color-primary-active: #004085;
|
||||
|
||||
/* 背景色 */
|
||||
--color-bg-base: #ffffff;
|
||||
--color-bg-secondary: #f8f9fa;
|
||||
--color-bg-overlay: rgba(255, 255, 255, 0.95);
|
||||
--color-bg-dark: #1a1a1a;
|
||||
|
||||
/* 文本色 */
|
||||
--color-text-primary: #333333;
|
||||
--color-text-secondary: #666666;
|
||||
--color-text-muted: #999999;
|
||||
--color-text-inverse: #ffffff;
|
||||
|
||||
/* 边框色 */
|
||||
--color-border-light: #e0e0e0;
|
||||
--color-border-medium: #cccccc;
|
||||
--color-border-dark: #999999;
|
||||
|
||||
/* 状态色 */
|
||||
--color-success: #28a745;
|
||||
--color-warning: #ffc107;
|
||||
--color-danger: #dc3545;
|
||||
--color-info: #17a2b8;
|
||||
|
||||
/* 高亮与选中 */
|
||||
--color-highlight-bg: #fff3cd;
|
||||
--color-highlight-border: #ffc107;
|
||||
--color-selection-bg: #e3f2fd;
|
||||
|
||||
/* 阴影色 */
|
||||
--color-shadow-light: rgba(0, 0, 0, 0.05);
|
||||
--color-shadow-medium: rgba(0, 0, 0, 0.1);
|
||||
--color-shadow-strong: rgba(0, 0, 0, 0.2);
|
||||
|
||||
/* ==================== TOC 组件尺寸 ==================== */
|
||||
|
||||
--toc-button-size: 40px;
|
||||
--toc-button-left: 20px;
|
||||
--toc-button-top: 80px;
|
||||
--toc-button-z-index: var(--z-fixed);
|
||||
|
||||
--toc-popup-width: 280px;
|
||||
--toc-popup-max-height: 70vh;
|
||||
--toc-popup-left: 20px;
|
||||
--toc-popup-top: 130px;
|
||||
--toc-popup-z-index: var(--z-popover);
|
||||
|
||||
--toc-item-height: 32px;
|
||||
--toc-item-padding-x: 12px;
|
||||
--toc-item-padding-y: 6px;
|
||||
--toc-indent-width: 20px;
|
||||
|
||||
/* ==================== Dock 组件尺寸 ==================== */
|
||||
|
||||
--dock-width: 280px;
|
||||
--dock-min-width: 200px;
|
||||
--dock-max-width: 400px;
|
||||
|
||||
--dock-collapsed-height: 40px;
|
||||
--dock-expanded-height: auto;
|
||||
--dock-max-height: 300px;
|
||||
|
||||
--dock-position-bottom: 20px;
|
||||
--dock-position-left: 20px;
|
||||
--dock-z-index: var(--z-fixed);
|
||||
|
||||
--dock-stat-item-height: 28px;
|
||||
--dock-stat-font-size: 13px;
|
||||
|
||||
/* ==================== Immersive 沉浸模式尺寸 ==================== */
|
||||
|
||||
--immersive-toc-width: 15%;
|
||||
--immersive-toc-min-width: 200px;
|
||||
--immersive-toc-max-width: 350px;
|
||||
|
||||
--immersive-main-flex: 1;
|
||||
--immersive-main-min-width: 400px;
|
||||
|
||||
--immersive-chatbot-width: 20%;
|
||||
--immersive-chatbot-min-width: 280px;
|
||||
--immersive-chatbot-max-width: 500px;
|
||||
|
||||
--immersive-resize-handle-width: 6px;
|
||||
--immersive-resize-handle-hover-width: 10px;
|
||||
|
||||
--immersive-container-z-index: var(--z-immersive-container);
|
||||
--immersive-toggle-z-index: var(--z-immersive-controls);
|
||||
|
||||
/* ==================== Modal 弹窗尺寸 ==================== */
|
||||
|
||||
--modal-backdrop-z-index: var(--z-modal-backdrop);
|
||||
--modal-content-z-index: var(--z-modal);
|
||||
|
||||
--modal-width-small: 400px;
|
||||
--modal-width-medium: 600px;
|
||||
--modal-width-large: 800px;
|
||||
--modal-width-xlarge: 1000px;
|
||||
|
||||
--modal-max-height: 85vh;
|
||||
--modal-padding: 24px;
|
||||
|
||||
/* ==================== Lightbox 图片灯箱 ==================== */
|
||||
|
||||
--lightbox-z-index: var(--z-lightbox);
|
||||
--lightbox-backdrop-bg: rgba(0, 0, 0, 0.9);
|
||||
--lightbox-max-width: 90vw;
|
||||
--lightbox-max-height: 90vh;
|
||||
|
||||
/* ==================== Chatbot 相关 ==================== */
|
||||
|
||||
--chatbot-config-modal-z-index: 999999; /* 临时保留旧值,后续统一到 var(--z-modal) */
|
||||
--chatbot-message-action-z-index: var(--z-dropdown);
|
||||
|
||||
--chatbot-input-min-height: 60px;
|
||||
--chatbot-input-max-height: 200px;
|
||||
--chatbot-message-padding: 12px 16px;
|
||||
|
||||
/* ==================== 间距系统 ==================== */
|
||||
|
||||
--spacing-xs: 4px;
|
||||
--spacing-sm: 8px;
|
||||
--spacing-md: 16px;
|
||||
--spacing-lg: 24px;
|
||||
--spacing-xl: 32px;
|
||||
--spacing-xxl: 48px;
|
||||
|
||||
/* ==================== 圆角系统 ==================== */
|
||||
|
||||
--radius-sm: 4px;
|
||||
--radius-md: 6px;
|
||||
--radius-lg: 8px;
|
||||
--radius-xl: 12px;
|
||||
--radius-round: 50%;
|
||||
|
||||
/* ==================== 阴影系统 ==================== */
|
||||
|
||||
--shadow-sm: 0 1px 2px var(--color-shadow-light);
|
||||
--shadow-md: 0 2px 4px var(--color-shadow-medium);
|
||||
--shadow-lg: 0 4px 8px var(--color-shadow-medium);
|
||||
--shadow-xl: 0 8px 16px var(--color-shadow-strong);
|
||||
|
||||
--shadow-float: 0 2px 8px var(--color-shadow-medium);
|
||||
--shadow-modal: 0 10px 40px var(--color-shadow-strong);
|
||||
|
||||
/* ==================== 动画与过渡 ==================== */
|
||||
|
||||
--transition-fast: 150ms ease;
|
||||
--transition-base: 250ms ease;
|
||||
--transition-slow: 350ms ease;
|
||||
|
||||
--transition-timing-default: ease;
|
||||
--transition-timing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||
--transition-timing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
|
||||
|
||||
--animation-duration-short: 200ms;
|
||||
--animation-duration-base: 300ms;
|
||||
--animation-duration-long: 500ms;
|
||||
|
||||
/* ==================== 字体系统 ==================== */
|
||||
|
||||
--font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
--font-family-monospace: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", monospace;
|
||||
|
||||
--font-size-xs: 12px;
|
||||
--font-size-sm: 13px;
|
||||
--font-size-base: 14px;
|
||||
--font-size-md: 16px;
|
||||
--font-size-lg: 18px;
|
||||
--font-size-xl: 20px;
|
||||
--font-size-xxl: 24px;
|
||||
|
||||
--font-weight-normal: 400;
|
||||
--font-weight-medium: 500;
|
||||
--font-weight-semibold: 600;
|
||||
--font-weight-bold: 700;
|
||||
|
||||
--line-height-tight: 1.2;
|
||||
--line-height-base: 1.5;
|
||||
--line-height-relaxed: 1.8;
|
||||
|
||||
/* ==================== 响应式断点 ==================== */
|
||||
|
||||
--breakpoint-mobile: 700px;
|
||||
--breakpoint-tablet: 768px;
|
||||
--breakpoint-desktop: 1024px;
|
||||
--breakpoint-wide: 1280px;
|
||||
|
||||
/* ==================== 按钮尺寸 ==================== */
|
||||
|
||||
--button-size-tiny: 28px;
|
||||
--button-size-small: 32px;
|
||||
--button-size-medium: 36px;
|
||||
--button-size-large: 40px;
|
||||
|
||||
--button-padding-x-small: 12px;
|
||||
--button-padding-x-medium: 16px;
|
||||
--button-padding-x-large: 20px;
|
||||
|
||||
/* ==================== 特殊用途变量 ==================== */
|
||||
|
||||
/* 滚动容器标识(供 JavaScript 查询) */
|
||||
--scrollable-overflow: auto;
|
||||
|
||||
/* 拖拽状态 */
|
||||
--dragging-cursor: grabbing;
|
||||
--dragging-user-select: none;
|
||||
|
||||
/* 禁用状态 */
|
||||
--disabled-opacity: 0.5;
|
||||
--disabled-cursor: not-allowed;
|
||||
}
|
||||
|
||||
/* ==================== 暗色模式支持(预留) ==================== */
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
/* 未来可在此定义暗色模式变量 */
|
||||
/*
|
||||
--color-bg-base: #1a1a1a;
|
||||
--color-text-primary: #e0e0e0;
|
||||
...
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================== 使用示例 ==================== */
|
||||
|
||||
/*
|
||||
示例 1: TOC 按钮
|
||||
.toc__button {
|
||||
width: var(--toc-button-size);
|
||||
height: var(--toc-button-size);
|
||||
left: var(--toc-button-left);
|
||||
top: var(--toc-button-top);
|
||||
z-index: var(--toc-button-z-index);
|
||||
}
|
||||
|
||||
示例 2: Dock 容器
|
||||
.dock {
|
||||
width: var(--dock-width);
|
||||
bottom: var(--dock-position-bottom);
|
||||
left: var(--dock-position-left);
|
||||
z-index: var(--dock-z-index);
|
||||
box-shadow: var(--shadow-float);
|
||||
}
|
||||
|
||||
示例 3: 沉浸模式面板
|
||||
.immersive__toc-panel {
|
||||
width: var(--immersive-toc-width);
|
||||
min-width: var(--immersive-toc-min-width);
|
||||
max-width: var(--immersive-toc-max-width);
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,759 @@
|
||||
/**
|
||||
* TOC (Table of Contents) 组件样式
|
||||
*
|
||||
* 职责:目录浮动按钮、弹窗、列表项、层级结构等完整样式
|
||||
* 作用域:#toc-float-btn, #toc-popup 及其子元素
|
||||
* 依赖:variables.css
|
||||
*
|
||||
* 合并自:
|
||||
* - history_detail/toc-base.css (基础样式)
|
||||
* - history_detail/toc-extensions.css (扩展功能)
|
||||
* - toc-optimized.css (现代化设计,部分采纳)
|
||||
*
|
||||
* 重构说明:
|
||||
* 1. 使用 CSS 变量替换硬编码值
|
||||
* 2. 移除大部分 !important(保留少数必要的)
|
||||
* 3. 保持向后兼容(ID 选择器)
|
||||
* 4. 消除三个文件之间的样式冲突
|
||||
*/
|
||||
|
||||
/* ==================== 1. TOC 浮动按钮 ==================== */
|
||||
|
||||
#toc-float-btn {
|
||||
position: fixed;
|
||||
left: var(--toc-button-left);
|
||||
top: var(--toc-button-top);
|
||||
z-index: var(--toc-button-z-index);
|
||||
|
||||
/* 尺寸 - 由 .tiny-round-btn 类控制,此处保留兼容性 */
|
||||
width: var(--toc-button-size);
|
||||
height: var(--toc-button-size);
|
||||
|
||||
/* 布局 */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
/* 交互 */
|
||||
cursor: pointer;
|
||||
transition: background var(--transition-fast),
|
||||
transform var(--transition-fast);
|
||||
}
|
||||
|
||||
#toc-float-btn:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
#toc-float-btn:active {
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
/* TOC 按钮图标 - 由 .tiny-round-btn 控制,此处保留文档 */
|
||||
#toc-float-btn i {
|
||||
/* 样式由 .tiny-round-btn > i 控制 */
|
||||
}
|
||||
|
||||
/* ==================== 2. TOC 弹窗容器 ==================== */
|
||||
|
||||
#toc-popup {
|
||||
/* 显示控制 */
|
||||
display: none;
|
||||
|
||||
/* 定位 */
|
||||
position: fixed;
|
||||
left: var(--toc-popup-left);
|
||||
top: var(--toc-popup-top);
|
||||
z-index: var(--toc-popup-z-index);
|
||||
|
||||
/* 尺寸 */
|
||||
width: var(--toc-popup-width);
|
||||
max-width: 85vw;
|
||||
max-height: var(--toc-popup-max-height);
|
||||
|
||||
/* 样式 */
|
||||
background: var(--color-bg-overlay);
|
||||
border: 1px solid var(--color-border-light);
|
||||
border-radius: var(--radius-lg);
|
||||
box-shadow: var(--shadow-float);
|
||||
|
||||
/* 动画 */
|
||||
transition: opacity var(--transition-base),
|
||||
transform var(--transition-base),
|
||||
width var(--transition-base);
|
||||
transform: translateY(-10px);
|
||||
opacity: 0;
|
||||
|
||||
/* 溢出控制 */
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* TOC 弹窗显示状态 */
|
||||
#toc-popup.toc-popup-visible,
|
||||
#toc-popup.visible {
|
||||
display: block;
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
/* TOC 弹窗隐藏动画 */
|
||||
#toc-popup.toc-popup-hiding {
|
||||
opacity: 0;
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
/* TOC 展开模式 */
|
||||
#toc-popup.toc-expanded {
|
||||
width: 440px; /* 展开到2倍宽度 */
|
||||
}
|
||||
|
||||
/* ==================== 3. TOC 弹窗头部 ==================== */
|
||||
|
||||
#toc-popup-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
background: rgba(59, 130, 246, 0.05);
|
||||
}
|
||||
|
||||
#toc-popup-header span {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
font-size: var(--font-size-base);
|
||||
color: var(--color-text-primary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
}
|
||||
|
||||
#toc-popup-header i {
|
||||
color: var(--color-primary);
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
|
||||
/* 关闭按钮 */
|
||||
#toc-popup-close-btn {
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: var(--radius-md);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
cursor: pointer;
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-secondary);
|
||||
transition: background var(--transition-fast),
|
||||
color var(--transition-fast);
|
||||
}
|
||||
|
||||
#toc-popup-close-btn:hover {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* 展开按钮 */
|
||||
#toc-expand-btn {
|
||||
position: absolute;
|
||||
right: var(--spacing-sm);
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: var(--color-primary);
|
||||
cursor: pointer;
|
||||
font-size: var(--font-size-lg);
|
||||
padding: var(--spacing-xs);
|
||||
border-radius: var(--radius-sm);
|
||||
line-height: 1;
|
||||
opacity: 0.7;
|
||||
transition: opacity var(--transition-fast),
|
||||
background-color var(--transition-fast);
|
||||
}
|
||||
|
||||
#toc-expand-btn:hover {
|
||||
opacity: 1;
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
/* ==================== 4. TOC 模式选择器 ==================== */
|
||||
|
||||
.toc-mode-selector {
|
||||
display: none; /* 默认隐藏,由 JavaScript 控制显示 */
|
||||
gap: var(--spacing-xs);
|
||||
margin: var(--spacing-sm) var(--spacing-md);
|
||||
padding: var(--spacing-xs);
|
||||
background-color: var(--color-bg-secondary);
|
||||
border-radius: var(--radius-md);
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.toc-mode-btn {
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
border: 1px solid var(--color-border-medium);
|
||||
border-radius: var(--radius-sm);
|
||||
background-color: var(--color-bg-base);
|
||||
color: var(--color-text-secondary);
|
||||
cursor: pointer;
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-medium);
|
||||
transition: all var(--transition-base);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.toc-mode-btn:hover {
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
color: var(--color-primary);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.toc-mode-btn.active {
|
||||
background: var(--color-primary);
|
||||
color: var(--color-text-inverse);
|
||||
border-color: var(--color-primary);
|
||||
box-shadow: var(--shadow-md);
|
||||
}
|
||||
|
||||
/* ==================== 5. TOC 列表容器 ==================== */
|
||||
|
||||
#toc-list {
|
||||
list-style: none;
|
||||
padding: var(--spacing-sm) 0;
|
||||
margin: 0;
|
||||
font-size: var(--font-size-sm);
|
||||
max-height: 60vh;
|
||||
overflow-y: auto;
|
||||
|
||||
/* 滚动条样式 */
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--color-border-medium) transparent;
|
||||
}
|
||||
|
||||
#toc-list::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
#toc-list::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#toc-list::-webkit-scrollbar-thumb {
|
||||
background: var(--color-border-medium);
|
||||
border-radius: var(--radius-sm);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
#toc-list::-webkit-scrollbar-thumb:hover {
|
||||
background: var(--color-border-dark);
|
||||
}
|
||||
|
||||
/* TOC 子项容器 */
|
||||
#toc-list ul.toc-children {
|
||||
list-style: none;
|
||||
padding-left: 0;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
transition: height var(--transition-base),
|
||||
opacity var(--transition-base);
|
||||
}
|
||||
|
||||
/* 折叠状态下的子项容器 */
|
||||
#toc-list .toc-children.collapsed {
|
||||
height: 0 !important; /* !important 必要,用于覆盖 JS 设置的高度 */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
/* ==================== 6. TOC 列表项样式 ==================== */
|
||||
|
||||
#toc-list li {
|
||||
margin-bottom: 0;
|
||||
line-height: var(--line-height-base);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 不同层级标题的间距 */
|
||||
#toc-list li.toc-h1 {
|
||||
margin-top: var(--spacing-sm);
|
||||
}
|
||||
|
||||
#toc-list li.toc-h2 {
|
||||
margin-top: var(--spacing-xs);
|
||||
}
|
||||
|
||||
#toc-list li.toc-h3,
|
||||
#toc-list li.toc-h4,
|
||||
#toc-list li.toc-h5,
|
||||
#toc-list li.toc-h6 {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
/* TOC 链接样式 */
|
||||
#toc-list li a {
|
||||
display: block;
|
||||
padding: var(--toc-item-padding-y) var(--toc-item-padding-x);
|
||||
color: var(--color-text-primary);
|
||||
text-decoration: none;
|
||||
font-weight: var(--font-weight-medium);
|
||||
transition: background var(--transition-fast),
|
||||
color var(--transition-fast),
|
||||
border-left-color var(--transition-fast);
|
||||
border-left: 3px solid var(--color-border-light);
|
||||
|
||||
/* 多行支持 */
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
line-height: 1.3;
|
||||
padding-right: var(--spacing-sm);
|
||||
}
|
||||
|
||||
#toc-list li a:hover {
|
||||
background: var(--color-bg-secondary);
|
||||
color: var(--color-text-primary);
|
||||
border-left-color: var(--color-primary);
|
||||
}
|
||||
|
||||
#toc-list li a.active {
|
||||
background: var(--color-selection-bg);
|
||||
color: var(--color-primary);
|
||||
border-left-color: var(--color-primary);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
|
||||
/* 不同层级标题的缩进和字体大小 */
|
||||
#toc-list li.toc-h2 a {
|
||||
padding-left: calc(var(--toc-item-padding-x) + var(--toc-indent-width));
|
||||
font-size: 0.95em;
|
||||
}
|
||||
|
||||
#toc-list li.toc-h3 a {
|
||||
padding-left: calc(var(--toc-item-padding-x) + var(--toc-indent-width) * 2);
|
||||
font-size: 0.88em;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
#toc-list li.toc-h3 a:hover {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
#toc-list li.toc-h4 a {
|
||||
padding-left: calc(var(--toc-item-padding-x) + var(--toc-indent-width) * 3);
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
#toc-list li.toc-h5 a {
|
||||
padding-left: calc(var(--toc-item-padding-x) + var(--toc-indent-width) * 4);
|
||||
font-size: 0.83em;
|
||||
}
|
||||
|
||||
#toc-list li.toc-h6 a {
|
||||
padding-left: calc(var(--toc-item-padding-x) + var(--toc-indent-width) * 5);
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
/* ==================== 7. 折叠/展开功能 ==================== */
|
||||
|
||||
/* 折叠按钮 */
|
||||
#toc-list .toc-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
text-align: center;
|
||||
line-height: 16px;
|
||||
margin-right: var(--spacing-xs);
|
||||
font-size: 10px;
|
||||
color: var(--color-text-secondary);
|
||||
transition: transform var(--transition-fast),
|
||||
color var(--transition-fast),
|
||||
background-color var(--transition-fast);
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-sm);
|
||||
}
|
||||
|
||||
#toc-list .toc-toggle:hover {
|
||||
color: var(--color-primary);
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
#toc-list .toc-toggle.collapsed {
|
||||
transform: rotate(-90deg);
|
||||
}
|
||||
|
||||
/* 有子项的 TOC 项样式 */
|
||||
#toc-list li.has-children > a {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
|
||||
/* 修复悬停状态与折叠状态的冲突 */
|
||||
#toc-list li a:hover .toc-toggle {
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
/* ==================== 8. TOC 文本内容结构 ==================== */
|
||||
|
||||
/* 多行 TOC 文本布局 */
|
||||
#toc-list .toc-text {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
line-height: 1.5;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
#toc-list li.has-children > a .toc-text {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
/* TOC 内容 */
|
||||
.toc-content {
|
||||
display: inline-block;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
white-space: normal;
|
||||
font-weight: var(--font-weight-normal);
|
||||
}
|
||||
|
||||
/* TOC 英文翻译 */
|
||||
#toc-list span.toc-en-translation,
|
||||
.toc-en-translation {
|
||||
font-size: 0.85em;
|
||||
color: var(--color-text-muted);
|
||||
margin-left: var(--spacing-xs);
|
||||
font-weight: var(--font-weight-normal);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* 非展开模式下的文本显示限制 */
|
||||
#toc-popup:not(.toc-expanded) .toc-text {
|
||||
max-height: 3.9em; /* 三行文本高度 */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 3;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
/* 展开模式下取消文本限制 */
|
||||
#toc-popup.toc-expanded .toc-text {
|
||||
max-height: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: baseline;
|
||||
-webkit-line-clamp: unset;
|
||||
}
|
||||
|
||||
/* ==================== 9. 结构化标题样式 ==================== */
|
||||
|
||||
/* 通用结构化标题样式 */
|
||||
.toc-structured .toc-prefix {
|
||||
font-weight: var(--font-weight-bold);
|
||||
color: var(--color-primary);
|
||||
margin-right: var(--spacing-xs);
|
||||
display: inline-block;
|
||||
font-family: var(--font-family-monospace);
|
||||
background: rgba(59, 130, 246, 0.1);
|
||||
padding: 2px 6px;
|
||||
border-radius: var(--radius-sm);
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.toc-structured .toc-content {
|
||||
padding-left: 0;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
/* 结构化标题首字母 - 避免与前缀冲突 */
|
||||
.toc-structured .toc-content::first-letter {
|
||||
font-weight: var(--font-weight-normal);
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* 章节标题样式(如"第一章") */
|
||||
.toc-structure-chapter .toc-prefix {
|
||||
background: rgba(220, 38, 38, 0.1);
|
||||
color: #dc2626;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
/* 数字编号标题样式(如"1.1") */
|
||||
.toc-structure-numeric .toc-prefix {
|
||||
font-family: var(--font-family-monospace);
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* 罗马数字标题样式 */
|
||||
.toc-structure-roman .toc-prefix {
|
||||
font-style: italic;
|
||||
color: #6a1b9a;
|
||||
}
|
||||
|
||||
/* 字母标题样式 */
|
||||
.toc-structure-letter .toc-prefix {
|
||||
color: #00695c;
|
||||
}
|
||||
|
||||
/* 结构化标题缩进优化 */
|
||||
#toc-list > li.toc-structured {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
#toc-list .toc-structured.toc-h1 { padding-left: 0; }
|
||||
#toc-list .toc-structured.toc-h2 { padding-left: var(--spacing-md); }
|
||||
#toc-list .toc-structured.toc-h3 { padding-left: calc(var(--spacing-md) * 2); }
|
||||
#toc-list .toc-structured.toc-h4 { padding-left: calc(var(--spacing-md) * 3); }
|
||||
#toc-list .toc-structured.toc-h5 { padding-left: calc(var(--spacing-md) * 4); }
|
||||
#toc-list .toc-structured.toc-h6 { padding-left: calc(var(--spacing-md) * 5); }
|
||||
|
||||
/* 强化层级视觉效果 */
|
||||
.toc-structured {
|
||||
border-left: none;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.toc-structured.toc-h2 { border-left: 3px solid rgba(0, 102, 204, 0.1); }
|
||||
.toc-structured.toc-h3 { border-left: 3px solid rgba(0, 102, 204, 0.15); }
|
||||
.toc-structured.toc-h4 { border-left: 3px solid rgba(0, 102, 204, 0.2); }
|
||||
.toc-structured.toc-h5,
|
||||
.toc-structured.toc-h6 { border-left: 3px solid rgba(0, 102, 204, 0.25); }
|
||||
|
||||
/* 简单数字列表项样式 */
|
||||
.toc-simple-numbered {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.toc-simple-numbered .toc-prefix {
|
||||
color: var(--color-primary);
|
||||
font-weight: var(--font-weight-bold);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
#toc-list li.toc-simple-numbered {
|
||||
padding-left: var(--spacing-md) !important;
|
||||
}
|
||||
|
||||
.toc-simple-numbered::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
border-left: 2px dotted rgba(37, 99, 235, 0.3);
|
||||
}
|
||||
|
||||
.toc-simple-numbered:hover::before {
|
||||
border-left-color: rgba(37, 99, 235, 0.6);
|
||||
}
|
||||
|
||||
/* 带空格多级编号标题样式 */
|
||||
.toc-spaced-numeric .toc-prefix {
|
||||
font-family: var(--font-family-monospace);
|
||||
letter-spacing: 0.5px;
|
||||
color: var(--color-primary);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.toc-spaced-numeric:hover {
|
||||
background-color: rgba(0, 102, 204, 0.05);
|
||||
}
|
||||
|
||||
#toc-list .toc-spaced-numeric {
|
||||
padding-left: inherit;
|
||||
}
|
||||
|
||||
/* ==================== 10. 图表标题样式 ==================== */
|
||||
|
||||
/* 图表标题在 TOC 中的特殊样式 */
|
||||
#toc-list li.toc-caption a::before {
|
||||
content: "📊 ";
|
||||
margin-right: var(--spacing-xs);
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
|
||||
#toc-list li.toc-caption a {
|
||||
color: var(--color-primary);
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
#toc-list li.toc-caption a:hover {
|
||||
background-color: rgba(37, 99, 235, 0.1);
|
||||
}
|
||||
|
||||
/* 图表标题作为子项的样式调整 */
|
||||
.toc-caption {
|
||||
font-style: italic;
|
||||
color: var(--color-text-secondary);
|
||||
padding-left: var(--spacing-md) !important;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.toc-caption::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
border-left: 2px dotted rgba(97, 97, 97, 0.2);
|
||||
}
|
||||
|
||||
.toc-structured + li.toc-caption {
|
||||
padding-left: calc(var(--spacing-md) * 2) !important;
|
||||
}
|
||||
|
||||
/* 图表图标样式 */
|
||||
.toc-chart-icon {
|
||||
margin-right: var(--spacing-xs);
|
||||
font-size: 0.9em;
|
||||
opacity: 0.8;
|
||||
transition: opacity var(--transition-fast),
|
||||
transform var(--transition-fast);
|
||||
}
|
||||
|
||||
.toc-caption:hover .toc-chart-icon {
|
||||
opacity: 1;
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
/* 图表标题的内容样式 */
|
||||
.toc-caption .toc-content {
|
||||
font-style: italic;
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.toc-caption .toc-content::first-letter {
|
||||
font-weight: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* ==================== 11. 文件名占位符样式 ==================== */
|
||||
|
||||
#toc-list li a[href^="#placeholder-"] {
|
||||
font-weight: var(--font-weight-semibold);
|
||||
color: var(--color-primary);
|
||||
border-left-color: var(--color-primary);
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
padding-left: var(--toc-item-padding-x);
|
||||
}
|
||||
|
||||
#toc-list li a[href^="#placeholder-"]::before {
|
||||
content: "📄 ";
|
||||
margin-right: var(--spacing-xs);
|
||||
}
|
||||
|
||||
/* ==================== 12. TOC 控制按钮区域 ==================== */
|
||||
|
||||
.toc-controls {
|
||||
padding: var(--spacing-sm) var(--spacing-md);
|
||||
text-align: center;
|
||||
border-top: 1px solid var(--color-border-light);
|
||||
font-size: 0.8em;
|
||||
color: var(--color-text-muted);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: var(--spacing-sm);
|
||||
background: var(--color-bg-secondary);
|
||||
}
|
||||
|
||||
.toc-control-btn {
|
||||
background: transparent;
|
||||
border: none;
|
||||
margin: 0 var(--spacing-xs);
|
||||
padding: var(--spacing-xs) var(--spacing-sm);
|
||||
color: var(--color-primary);
|
||||
cursor: pointer;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: background-color var(--transition-fast);
|
||||
font-size: var(--font-size-xs);
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.toc-control-btn:hover {
|
||||
background-color: rgba(59, 130, 246, 0.1);
|
||||
}
|
||||
|
||||
/* ==================== 13. 特殊效果 ==================== */
|
||||
|
||||
/* 目标高亮效果(跳转后的高亮) */
|
||||
.toc-target-highlight {
|
||||
background: var(--color-selection-bg) !important;
|
||||
box-shadow: 0 0 20px rgba(59, 130, 246, 0.3) !important;
|
||||
border-left: 4px solid var(--color-primary) !important;
|
||||
transition: all var(--transition-base) !important;
|
||||
border-radius: var(--radius-md) !important;
|
||||
padding: var(--spacing-md) !important;
|
||||
}
|
||||
|
||||
/* TOC 弹窗显示/隐藏动画效果 */
|
||||
.toc-popup-visible {
|
||||
display: block !important;
|
||||
opacity: 1 !important;
|
||||
transform: translateY(0) !important;
|
||||
}
|
||||
|
||||
.toc-popup-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 强化TOC的视觉层级 */
|
||||
#toc-list ul.toc-children {
|
||||
margin-left: 0;
|
||||
border-left: 1px solid rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
/* ==================== 14. 响应式设计 ==================== */
|
||||
|
||||
@media (max-width: 768px) {
|
||||
#toc-float-btn {
|
||||
left: 15px;
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
font-size: var(--font-size-lg);
|
||||
}
|
||||
|
||||
#toc-popup {
|
||||
left: 15px;
|
||||
width: calc(100vw - 30px);
|
||||
max-width: 350px;
|
||||
}
|
||||
|
||||
.toc-mode-btn {
|
||||
padding: var(--spacing-xs) var(--spacing-md);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
#toc-list li a {
|
||||
padding: 10px 14px 10px 18px;
|
||||
margin: 2px 8px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
#toc-popup {
|
||||
width: calc(100vw - 20px);
|
||||
left: 10px;
|
||||
max-height: 70vh;
|
||||
}
|
||||
|
||||
#toc-popup-header {
|
||||
padding: var(--spacing-md) var(--spacing-lg) var(--spacing-sm) var(--spacing-lg);
|
||||
}
|
||||
|
||||
#toc-popup-header span {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ==================== 15. 打印样式 ==================== */
|
||||
|
||||
@media print {
|
||||
#toc-float-btn,
|
||||
#toc-popup {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user