@tnotesjs/core 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @tnotesjs/core might be problematic. Click here for more details.

Files changed (117) hide show
  1. package/README.md +105 -0
  2. package/dist/chunk-K3X5OP3N.js +1532 -0
  3. package/dist/cli/index.d.ts +2 -0
  4. package/dist/cli/index.js +4199 -0
  5. package/dist/index.d.ts +138 -0
  6. package/dist/index.js +9 -0
  7. package/package.json +74 -0
  8. package/types/config.ts +61 -0
  9. package/types/index.ts +11 -0
  10. package/types/note.ts +33 -0
  11. package/vitepress/assets/icons/icon__check.svg +3 -0
  12. package/vitepress/assets/icons/icon__clipboard.svg +8 -0
  13. package/vitepress/assets/icons/icon__close.svg +1 -0
  14. package/vitepress/assets/icons/icon__collapse.svg +1 -0
  15. package/vitepress/assets/icons/icon__confirm.svg +1 -0
  16. package/vitepress/assets/icons/icon__copy.svg +4 -0
  17. package/vitepress/assets/icons/icon__focus.svg +1 -0
  18. package/vitepress/assets/icons/icon__fold.svg +3 -0
  19. package/vitepress/assets/icons/icon__folder.svg +1 -0
  20. package/vitepress/assets/icons/icon__fullscreen.svg +1 -0
  21. package/vitepress/assets/icons/icon__fullscreen_exit.svg +1 -0
  22. package/vitepress/assets/icons/icon__github.svg +4 -0
  23. package/vitepress/assets/icons/icon__mindmap.svg +1 -0
  24. package/vitepress/assets/icons/icon__next.svg +1 -0
  25. package/vitepress/assets/icons/icon__number_gray.svg +1 -0
  26. package/vitepress/assets/icons/icon__number_purple.svg +1 -0
  27. package/vitepress/assets/icons/icon__prev.svg +1 -0
  28. package/vitepress/assets/icons/icon__restore.svg +1 -0
  29. package/vitepress/assets/icons/icon__rotate.svg +4 -0
  30. package/vitepress/assets/icons/icon__search.svg +1 -0
  31. package/vitepress/assets/icons/icon__sidebar_collapsed.svg +1 -0
  32. package/vitepress/assets/icons/icon__sidebar_opened.svg +1 -0
  33. package/vitepress/assets/icons/icon__totop.svg +6 -0
  34. package/vitepress/assets/icons/icon__vscode.svg +6 -0
  35. package/vitepress/assets/icons/icon__zoom_fit.svg +1 -0
  36. package/vitepress/assets/icons/icon__zoom_in.svg +1 -0
  37. package/vitepress/assets/icons/icon__zoom_out.svg +1 -0
  38. package/vitepress/assets/icons/icon__zoom_reset.svg +1 -0
  39. package/vitepress/assets/icons/index.ts +38 -0
  40. package/vitepress/components/BilibiliOutsidePlayer/BilibiliOutsidePlayer.vue +20 -0
  41. package/vitepress/components/CodeBlockFullscreen/CodeBlockFullscreen.vue +373 -0
  42. package/vitepress/components/CodeBlockFullscreen/index.ts +115 -0
  43. package/vitepress/components/CodeBlockFullscreen/styles.css +64 -0
  44. package/vitepress/components/Discussions/Discussions.module.scss +32 -0
  45. package/vitepress/components/Discussions/Discussions.vue +211 -0
  46. package/vitepress/components/EnWordList/EnWordList.module.scss +124 -0
  47. package/vitepress/components/EnWordList/EnWordList.vue +543 -0
  48. package/vitepress/components/EnWordList/RightClickMenu.module.scss +22 -0
  49. package/vitepress/components/EnWordList/RightClickMenu.vue +66 -0
  50. package/vitepress/components/Footprints/Footprints.module.scss +93 -0
  51. package/vitepress/components/Footprints/Footprints.vue +377 -0
  52. package/vitepress/components/Layout/AboutModal.module.scss +233 -0
  53. package/vitepress/components/Layout/AboutModal.vue +105 -0
  54. package/vitepress/components/Layout/AboutPanel.vue +266 -0
  55. package/vitepress/components/Layout/ContentCollapse.vue +603 -0
  56. package/vitepress/components/Layout/CustomSidebar.vue +605 -0
  57. package/vitepress/components/Layout/DocBeforeControls.vue +139 -0
  58. package/vitepress/components/Layout/DocFooter.vue +225 -0
  59. package/vitepress/components/Layout/ImagePreview.module.scss +201 -0
  60. package/vitepress/components/Layout/ImagePreview.vue +281 -0
  61. package/vitepress/components/Layout/Layout.module.scss +661 -0
  62. package/vitepress/components/Layout/Layout.vue +542 -0
  63. package/vitepress/components/Layout/NoteStatus.vue +140 -0
  64. package/vitepress/components/Layout/SidebarItems.vue +263 -0
  65. package/vitepress/components/Layout/SidebarNavBefore.vue +92 -0
  66. package/vitepress/components/Layout/Swiper.vue +167 -0
  67. package/vitepress/components/Layout/ToggleFullContent.module.scss +11 -0
  68. package/vitepress/components/Layout/ToggleFullContent.vue +34 -0
  69. package/vitepress/components/Layout/ToggleSidebar.module.scss +11 -0
  70. package/vitepress/components/Layout/ToggleSidebar.vue +35 -0
  71. package/vitepress/components/Layout/composables/useCollapseControl.ts +88 -0
  72. package/vitepress/components/Layout/composables/useNoteConfig.ts +121 -0
  73. package/vitepress/components/Layout/composables/useNoteSave.ts +173 -0
  74. package/vitepress/components/Layout/composables/useNoteValidation.ts +85 -0
  75. package/vitepress/components/Layout/composables/useRedirect.ts +110 -0
  76. package/vitepress/components/Layout/composables/useVSCodeIntegration.ts +85 -0
  77. package/vitepress/components/Layout/homeReadme.data.ts +124 -0
  78. package/vitepress/components/LoadingPage/LoadingPage.vue +192 -0
  79. package/vitepress/components/MarkMap/MarkMap.module.scss +159 -0
  80. package/vitepress/components/MarkMap/MarkMap.vue +404 -0
  81. package/vitepress/components/Mermaid/Mermaid.module.scss +275 -0
  82. package/vitepress/components/Mermaid/Mermaid.vue +364 -0
  83. package/vitepress/components/NotesTable/NotesTable.module.scss +77 -0
  84. package/vitepress/components/NotesTable/NotesTable.vue +98 -0
  85. package/vitepress/components/NotesTable/README.md +67 -0
  86. package/vitepress/components/Settings/Settings.module.scss +433 -0
  87. package/vitepress/components/Settings/Settings.vue +306 -0
  88. package/vitepress/components/SidebarCard/MindMapView.vue +483 -0
  89. package/vitepress/components/SidebarCard/NotesTrendChart.vue +108 -0
  90. package/vitepress/components/SidebarCard/SidebarCard.vue +948 -0
  91. package/vitepress/components/Tooltip/Tooltip.vue +70 -0
  92. package/vitepress/components/constants.ts +91 -0
  93. package/vitepress/components/notesConfig.data.ts +73 -0
  94. package/vitepress/components/sidebar.data.ts +59 -0
  95. package/vitepress/components/tnotes-config.data.ts +21 -0
  96. package/vitepress/components/utils.ts +26 -0
  97. package/vitepress/config/index.ts +126 -0
  98. package/vitepress/configs/constants.ts +26 -0
  99. package/vitepress/configs/head.config.ts +25 -0
  100. package/vitepress/configs/index.ts +9 -0
  101. package/vitepress/configs/markdown-it.d.ts +23 -0
  102. package/vitepress/configs/markdown.config.ts +366 -0
  103. package/vitepress/configs/theme.config.ts +108 -0
  104. package/vitepress/plugins/buildProgressPlugin.ts +390 -0
  105. package/vitepress/plugins/getNoteByConfigIdPlugin.ts +107 -0
  106. package/vitepress/plugins/renameNotePlugin.ts +60 -0
  107. package/vitepress/plugins/updateConfigPlugin.ts +63 -0
  108. package/vitepress/theme/index.ts +95 -0
  109. package/vitepress/theme/styles/base.scss +50 -0
  110. package/vitepress/theme/styles/components/404.scss +31 -0
  111. package/vitepress/theme/styles/components/collapse.scss +175 -0
  112. package/vitepress/theme/styles/components/markmap.scss +101 -0
  113. package/vitepress/theme/styles/components/swiper.scss +255 -0
  114. package/vitepress/theme/styles/index.scss +25 -0
  115. package/vitepress/theme/styles/layout.scss +62 -0
  116. package/vitepress/theme/styles/utilities.scss +39 -0
  117. package/vitepress/theme/styles/vitepress-override.scss +25 -0
@@ -0,0 +1,95 @@
1
+ /**
2
+ * .vitepress/tnotes/theme/index.ts
3
+ *
4
+ * 自定义主题
5
+ *
6
+ * 提供两种使用方式:
7
+ * 1. defineNotesTheme() 工厂函数(推荐)
8
+ * 2. export default(向后兼容)
9
+ *
10
+ * doc:
11
+ * v1 - https://vuejs.github.io/vitepress/v1/zh/guide/custom-theme
12
+ * v2 - https://vitepress.dev/zh/guide/custom-theme
13
+ */
14
+
15
+ import type { Theme, EnhanceAppContext } from 'vitepress'
16
+ import DefaultTheme from 'vitepress/theme'
17
+ import BilibiliOutsidePlayer from '../components/BilibiliOutsidePlayer/BilibiliOutsidePlayer.vue'
18
+ import Discussions from '../components/Discussions/Discussions.vue'
19
+ import EnWordList from '../components/EnWordList/EnWordList.vue'
20
+ import Footprints from '../components/Footprints/Footprints.vue'
21
+ import Layout from '../components/Layout/Layout.vue'
22
+ import LoadingPage from '../components/LoadingPage/LoadingPage.vue'
23
+ import MarkMap from '../components/MarkMap/MarkMap.vue'
24
+ import Mermaid from '../components/Mermaid/Mermaid.vue'
25
+ import NotesTable from '../components/NotesTable/NotesTable.vue'
26
+ import Settings from '../components/Settings/Settings.vue'
27
+ import SidebarCard from '../components/SidebarCard/SidebarCard.vue'
28
+ import Tooltip from '../components/Tooltip/Tooltip.vue'
29
+ import './styles/index.scss'
30
+
31
+ /**
32
+ * 注册 TNotes 核心全局组件
33
+ */
34
+ function registerCoreComponents(ctx: EnhanceAppContext) {
35
+ const { app } = ctx
36
+ app.component('BilibiliOutsidePlayer', BilibiliOutsidePlayer)
37
+ app.component('B', BilibiliOutsidePlayer)
38
+ app.component('Discussions', Discussions)
39
+ app.component('EnWordList', EnWordList)
40
+ app.component('E', EnWordList)
41
+ app.component('Footprints', Footprints)
42
+ app.component('F', Footprints)
43
+ app.component('LoadingPage', LoadingPage)
44
+ app.component('Settings', Settings)
45
+ app.component('S', Settings)
46
+ app.component('SidebarCard', SidebarCard)
47
+ app.component('MarkMap', MarkMap)
48
+ app.component('Mermaid', Mermaid)
49
+ app.component('NotesTable', NotesTable)
50
+ app.component('N', NotesTable)
51
+ app.component('Tooltip', Tooltip)
52
+ }
53
+
54
+ /**
55
+ * 覆盖选项
56
+ */
57
+ interface NotesThemeOverrides {
58
+ /** 覆盖 Layout 组件 */
59
+ Layout?: Theme['Layout']
60
+ /** 追加的 enhanceApp 逻辑(在核心组件注册之后调用) */
61
+ enhanceApp?: Theme['enhanceApp']
62
+ }
63
+
64
+ /**
65
+ * 创建 TNotes 主题配置
66
+ *
67
+ * @param overrides - 可选的覆盖选项
68
+ * @returns VitePress 主题对象
69
+ *
70
+ * @example
71
+ * // .vitepress/theme/index.ts
72
+ * import { defineNotesTheme } from '../tnotes/vitepress/theme'
73
+ * export default defineNotesTheme()
74
+ */
75
+ export function defineNotesTheme(overrides: NotesThemeOverrides = {}): Theme {
76
+ return {
77
+ extends: DefaultTheme,
78
+ Layout: overrides.Layout ?? Layout,
79
+ enhanceApp(ctx) {
80
+ registerCoreComponents(ctx)
81
+ overrides.enhanceApp?.(ctx)
82
+ },
83
+ }
84
+ }
85
+
86
+ /**
87
+ * 默认导出(向后兼容旧版 re-export 方式)
88
+ */
89
+ export default {
90
+ extends: DefaultTheme,
91
+ Layout,
92
+ enhanceApp(ctx: EnhanceAppContext) {
93
+ registerCoreComponents(ctx)
94
+ },
95
+ } satisfies Theme
@@ -0,0 +1,50 @@
1
+ /**
2
+ * 基础样式层
3
+ * - CSS 自定义属性(变量)
4
+ * - 全局样式重置
5
+ * - 通用样式规则
6
+ */
7
+
8
+ /* ===================================== */
9
+ /* #region CSS 变量定义 */
10
+ /* ===================================== */
11
+
12
+ :root {
13
+ /* 品牌色 */
14
+ --vp-c-brand-1: #646cff;
15
+ --vp-c-brand-2: #747bff;
16
+
17
+ /* TNotes 自定义变量 */
18
+ --tn-content-width: 688px;
19
+ }
20
+
21
+ /* #endregion */
22
+
23
+ /* ===================================== */
24
+ /* #region 全局样式重置 */
25
+ /* ===================================== */
26
+
27
+ /* 移除所有链接的下划线 */
28
+ a {
29
+ text-decoration: none !important;
30
+ }
31
+
32
+ /* 任务列表样式优化 */
33
+ ul > li.task-list-item {
34
+ list-style-type: none;
35
+ padding-left: 0;
36
+ margin-left: 0;
37
+ }
38
+
39
+ ul > li.task-list-item > ul {
40
+ padding-left: 3rem;
41
+ }
42
+
43
+ .vp-doc h2 {
44
+ // 默认值:
45
+ // margin: 48px 0 16px;
46
+ // 缩小上边距
47
+ // margin: 32px 0 16px;
48
+ }
49
+
50
+ /* #endregion */
@@ -0,0 +1,31 @@
1
+ /**
2
+ * ./vitepress/tnotes/vitepress/theme/styles/components/404.scss
3
+ *
4
+ * 404 页面样式
5
+ */
6
+
7
+ .not-found-container {
8
+ text-align: center;
9
+ padding: 2rem;
10
+ min-height: calc(100vh - var(--vp-nav-height));
11
+ display: flex;
12
+ flex-direction: column;
13
+ justify-content: center;
14
+ align-items: center;
15
+ animation: fadeIn 0.4s ease-out;
16
+ }
17
+
18
+ .not-found-container h1 {
19
+ font-size: 4rem;
20
+ line-height: 4rem;
21
+ margin-bottom: 1rem;
22
+ background: linear-gradient(135deg, var(--vp-c-brand-1), var(--vp-c-brand-2));
23
+ -webkit-background-clip: text;
24
+ -webkit-text-fill-color: transparent;
25
+ background-clip: text;
26
+ }
27
+
28
+ .not-found-container p {
29
+ font-size: 1.5rem;
30
+ color: var(--vp-c-text-2);
31
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Collapse(折叠/展开)组件全局样式
3
+ * 这些样式应用于文档内容中动态生成的折叠区域
4
+ *
5
+ * 由 ContentCollapse.vue 组件使用,所有样式必须是全局的
6
+ */
7
+
8
+ /* ===================================== */
9
+ /* #region 折叠按钮基础样式 */
10
+ /* ===================================== */
11
+
12
+ .collapse-toggle {
13
+ background: none;
14
+ border: none;
15
+ cursor: pointer;
16
+ padding: 4px;
17
+ margin: 0;
18
+ transition: all 0.25s ease;
19
+ line-height: 1;
20
+ display: inline-flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ pointer-events: none; /* 按钮本身不响应点击 */
24
+ transform-origin: center;
25
+
26
+ &.collapsed {
27
+ transform: rotate(0deg);
28
+ }
29
+ }
30
+
31
+ .collapse-icon {
32
+ width: 16px;
33
+ height: 16px;
34
+ transition: transform 0.25s ease;
35
+ transform: rotate(90deg); /* 默认向下(展开状态)*/
36
+ opacity: 0.3;
37
+ }
38
+
39
+ /* #endregion */
40
+
41
+ /* ===================================== */
42
+ /* #region TOC 折叠区域 */
43
+ /* ===================================== */
44
+
45
+ .toc-collapse-wrapper {
46
+ position: relative;
47
+ margin: 16px 0;
48
+ }
49
+
50
+ .toc-collapse-header {
51
+ display: flex;
52
+ align-items: center;
53
+ justify-content: space-between;
54
+ padding: 8px 12px;
55
+ cursor: pointer;
56
+ border-radius: 6px;
57
+ transition: all 0.2s ease;
58
+ background: transparent;
59
+
60
+ &:hover {
61
+ background: var(--vp-c-bg-soft);
62
+
63
+ .collapse-icon {
64
+ opacity: 1;
65
+ }
66
+ }
67
+
68
+ &.collapsed {
69
+ background: var(--vp-c-bg-soft);
70
+ border: 1px solid var(--vp-c-divider);
71
+
72
+ .toc-collapse-toggle img {
73
+ transform: rotate(0deg) !important; /* 折叠时向右 */
74
+ }
75
+
76
+ &:hover {
77
+ background: var(--vp-c-bg-mute);
78
+ border-color: var(--vp-c-brand-1);
79
+ }
80
+ }
81
+ }
82
+
83
+ .collapse-label {
84
+ font-weight: 600;
85
+ color: var(--vp-c-text-2);
86
+ font-size: 14px;
87
+ display: block;
88
+ }
89
+
90
+ .toc-collapse-toggle {
91
+ flex-shrink: 0;
92
+ }
93
+
94
+ /* #endregion */
95
+
96
+ /* ===================================== */
97
+ /* #region H2 折叠区域 */
98
+ /* ===================================== */
99
+
100
+ h2.collapsible-h2 {
101
+ position: relative !important;
102
+ cursor: pointer !important;
103
+ padding: 8px 40px 8px 12px !important; /* 右侧预留按钮空间 */
104
+ border-radius: 6px !important;
105
+ transition: all 0.2s ease !important;
106
+
107
+ &:hover {
108
+ background: var(--vp-c-bg-soft) !important;
109
+
110
+ .collapse-icon {
111
+ opacity: 1 !important;
112
+ }
113
+ }
114
+
115
+ &.collapsed {
116
+ background: var(--vp-c-bg-soft) !important;
117
+ border: 1px solid var(--vp-c-divider) !important;
118
+ // margin-top: 1rem !important;
119
+ margin: 12px 0 0 0 !important;
120
+
121
+ .collapse-icon {
122
+ transform: rotate(0deg) !important; /* 折叠时向右 */
123
+ }
124
+
125
+ &:hover {
126
+ background: var(--vp-c-bg-mute) !important;
127
+ border-color: var(--vp-c-brand-1) !important;
128
+ }
129
+ }
130
+
131
+ /* 修复 anchor 位置 */
132
+ .header-anchor {
133
+ top: 10px !important;
134
+ }
135
+ }
136
+
137
+ .h2-collapse-toggle {
138
+ position: absolute !important;
139
+ right: 8px !important;
140
+ top: 50% !important;
141
+ transform: translateY(-50%) !important;
142
+ flex-shrink: 0;
143
+ }
144
+
145
+ /* #endregion */
146
+
147
+ /* ===================================== */
148
+ /* #region 折叠内容区域 */
149
+ /* ===================================== */
150
+
151
+ .collapse-content {
152
+ overflow: hidden;
153
+ max-height: 10000px;
154
+ opacity: 1;
155
+ transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
156
+
157
+ &.collapsed {
158
+ max-height: 0 !important;
159
+ opacity: 0 !important;
160
+ margin-top: 0 !important;
161
+ margin-bottom: 0 !important;
162
+ padding-top: 0 !important;
163
+ padding-bottom: 0 !important;
164
+ }
165
+
166
+ > :first-child {
167
+ margin-top: 0;
168
+ }
169
+
170
+ > :last-child {
171
+ margin-bottom: 0;
172
+ }
173
+ }
174
+
175
+ /* #endregion */
@@ -0,0 +1,101 @@
1
+ /**
2
+ * MarkMap 组件全局样式
3
+ * Toolbar 由 markmap-toolbar 库动态生成,需要全局样式
4
+ */
5
+
6
+ /* ===================================== */
7
+ /* #region Toolbar 样式 */
8
+ /* ===================================== */
9
+
10
+ .mm-toolbar {
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 8px;
14
+ padding: 6px;
15
+ background: rgba(255, 255, 255, 0.9);
16
+ border-radius: 6px;
17
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
18
+ backdrop-filter: blur(8px);
19
+ opacity: 0;
20
+ pointer-events: none;
21
+ transition: opacity 0.3s ease;
22
+ color: var(--vp-c-tip-1);
23
+ font-weight: 700;
24
+ }
25
+
26
+ .mm-toolbar-item {
27
+ cursor: pointer;
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ width: 28px;
32
+ height: 28px;
33
+ border-radius: 4px;
34
+ transition: all 0.2s ease;
35
+ font-weight: 500;
36
+ }
37
+
38
+ .mm-toolbar-item:hover {
39
+ background-color: rgba(0, 0, 0, 0.08);
40
+ transform: scale(1.1);
41
+ }
42
+
43
+ .mm-toolbar-item:active {
44
+ transform: scale(0.95);
45
+ }
46
+
47
+ .mm-toolbar-item svg {
48
+ color: var(--vp-c-tip-1);
49
+ }
50
+
51
+ /* #endregion */
52
+
53
+ /* ===================================== */
54
+ /* #region SVG 动画 */
55
+ /* ===================================== */
56
+
57
+ .markmap g {
58
+ transition: transform 0.3s ease, opacity 0.3s ease;
59
+ }
60
+
61
+ /* #endregion */
62
+
63
+ /* ===================================== */
64
+ /* #region 暗色模式 */
65
+ /* ===================================== */
66
+
67
+ .markmap-dark .mm-toolbar {
68
+ background: rgba(30, 30, 30, 0.9);
69
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
70
+ }
71
+
72
+ .markmap-dark .mm-toolbar-item:hover {
73
+ background-color: rgba(255, 255, 255, 0.1);
74
+ }
75
+
76
+ /* #endregion */
77
+
78
+ /* ===================================== */
79
+ /* #region 响应式 */
80
+ /* ===================================== */
81
+
82
+ @media (max-width: 768px) {
83
+ .mm-toolbar {
84
+ scale: 0.9;
85
+ gap: 6px;
86
+ padding: 4px;
87
+ }
88
+
89
+ .mm-toolbar-item {
90
+ width: 24px;
91
+ height: 24px;
92
+ }
93
+ }
94
+
95
+ @media (max-width: 480px) {
96
+ .mm-toolbar {
97
+ scale: 0.8;
98
+ }
99
+ }
100
+
101
+ /* #endregion */
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Swiper 组件全局样式
3
+ * 由于 Swiper 组件动态生成 DOM,所有样式都需要是全局的
4
+ */
5
+
6
+ /* ===================================== */
7
+ /* #region Swiper Tabs */
8
+ /* ===================================== */
9
+
10
+ .tn-swiper-tabs {
11
+ position: relative;
12
+ z-index: 20;
13
+ display: flex;
14
+ overflow-x: auto;
15
+ overflow-y: hidden;
16
+ gap: 0.5rem;
17
+ background: var(--vp-c-bg);
18
+ border-bottom: 1px solid var(--vp-c-divider);
19
+ border-radius: 8px 8px 0 0;
20
+ background-color: var(--vp-code-tab-bg);
21
+ box-shadow: inset 0 -1px var(--vp-code-tab-divider);
22
+ }
23
+
24
+ .tn-swiper-tabs::-webkit-scrollbar {
25
+ height: 4px;
26
+ }
27
+
28
+ .tn-swiper-tabs::-webkit-scrollbar-track {
29
+ background: transparent;
30
+ }
31
+
32
+ .tn-swiper-tabs::-webkit-scrollbar-thumb {
33
+ background: var(--vp-c-divider);
34
+ border-radius: 2px;
35
+ }
36
+
37
+ .tn-swiper-tabs::-webkit-scrollbar-thumb:hover {
38
+ background: var(--vp-c-text-3);
39
+ }
40
+
41
+ /* #endregion */
42
+
43
+ /* ===================================== */
44
+ /* #region Tab 按钮 */
45
+ /* ===================================== */
46
+
47
+ .tn-tab {
48
+ position: relative;
49
+ padding: 0.25rem 0.75rem;
50
+ line-height: 2rem;
51
+ border-bottom: 1px solid transparent;
52
+ background: transparent;
53
+ cursor: pointer;
54
+ font-size: 0.875rem;
55
+ white-space: nowrap;
56
+ color: var(--vp-code-tab-text-color);
57
+ transition: color 0.25s ease, transform 0.2s ease;
58
+ border: none;
59
+ }
60
+
61
+ .tn-tab::after {
62
+ position: absolute;
63
+ right: 8px;
64
+ bottom: -1px;
65
+ left: 8px;
66
+ z-index: 1;
67
+ height: 2px;
68
+ border-radius: 2px;
69
+ content: '';
70
+ background-color: transparent;
71
+ transition: background-color 0.25s ease;
72
+ }
73
+
74
+ .tn-tab:hover {
75
+ color: var(--vp-code-tab-active-text-color);
76
+ transform: translateY(-1px);
77
+ }
78
+
79
+ .tn-tab.active {
80
+ color: var(--vp-code-tab-active-text-color);
81
+ font-weight: 500;
82
+ }
83
+
84
+ .tn-tab.active::after {
85
+ background-color: var(--vp-code-tab-active-bar-color);
86
+ }
87
+
88
+ /* #endregion */
89
+
90
+ /* ===================================== */
91
+ /* #region Tab 导航按钮 */
92
+ /* ===================================== */
93
+
94
+ .tn-tab-nav {
95
+ position: absolute;
96
+ top: 50%;
97
+ transform: translateY(-50%);
98
+ background: transparent;
99
+ border: none;
100
+ font-size: 0.8rem;
101
+ cursor: pointer;
102
+ color: var(--vp-code-tab-text-color);
103
+ padding: 0 0.3rem;
104
+ transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
105
+ user-select: none;
106
+ border-radius: 4px;
107
+ line-height: 1;
108
+ }
109
+
110
+ /* 只对翻页按钮(非分隔符)生效的 hover 样式 */
111
+ .tn-tab-prev:hover,
112
+ .tn-tab-next:hover {
113
+ color: var(--vp-code-tab-active-bar-color);
114
+ font-size: 1rem;
115
+ transform: translateY(-50%) scale(1.5);
116
+ }
117
+
118
+ .tn-tab-nav:active {
119
+ transform: translateY(-50%) scale(0.95);
120
+ }
121
+
122
+ .tn-tab-prev {
123
+ left: 0.5rem;
124
+ }
125
+
126
+ .tab-tab-line {
127
+ position: absolute;
128
+ left: 1.1rem;
129
+ top: 50%;
130
+ transform: translateY(-50%);
131
+ color: var(--vp-code-tab-active-bar-color);
132
+ user-select: none;
133
+ opacity: 0.5;
134
+ /* 移除 cursor,表示不可交互 */
135
+ cursor: default;
136
+ }
137
+
138
+ .tn-tab-next {
139
+ left: 1.5rem;
140
+ }
141
+
142
+ /* #endregion */
143
+
144
+ /* ===================================== */
145
+ /* #region Swiper 容器 */
146
+ /* ===================================== */
147
+
148
+ .swiper-container {
149
+ width: 100%;
150
+ position: relative;
151
+ overflow: hidden;
152
+ margin: 1rem 0;
153
+ transition: height 0.3s ease;
154
+ border-radius: 0 0 8px 8px;
155
+ background: var(--vp-c-bg-soft);
156
+ }
157
+
158
+ .swiper-container img {
159
+ display: block;
160
+ max-width: 100%;
161
+ margin: 0 auto;
162
+ height: auto;
163
+ object-fit: contain;
164
+ transition: opacity 0.3s ease;
165
+ }
166
+
167
+ .tn-swiper {
168
+ margin: 1.5rem 0;
169
+ border-radius: 8px;
170
+ overflow: hidden;
171
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
172
+ transition: box-shadow 0.3s ease;
173
+ }
174
+
175
+ .tn-swiper:hover {
176
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
177
+ }
178
+
179
+ .swiper-slide {
180
+ animation: swiperFadeIn 0.3s ease-out;
181
+ }
182
+
183
+ /* #endregion */
184
+
185
+ /* ===================================== */
186
+ /* #region 暗色模式 */
187
+ /* ===================================== */
188
+
189
+ html.dark .tn-swiper {
190
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
191
+ }
192
+
193
+ html.dark .tn-swiper:hover {
194
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
195
+ }
196
+
197
+ html.dark .swiper-container {
198
+ background: var(--vp-c-bg);
199
+ }
200
+
201
+ /* #endregion */
202
+
203
+ /* ===================================== */
204
+ /* #region 响应式 */
205
+ /* ===================================== */
206
+
207
+ @media (max-width: 640px) {
208
+ .tn-swiper-tabs {
209
+ gap: 0.25rem;
210
+ }
211
+
212
+ .tn-tab {
213
+ padding: 0.2rem 0.5rem;
214
+ font-size: 0.8rem;
215
+ line-height: 1.8rem;
216
+ }
217
+
218
+ .tn-tab-nav {
219
+ font-size: 0.7rem;
220
+ padding: 0 0.2rem;
221
+ }
222
+
223
+ .tn-tab-nav:hover {
224
+ font-size: 0.85rem;
225
+ }
226
+
227
+ .tn-tab-prev {
228
+ left: 0.3rem;
229
+ }
230
+
231
+ .tab-tab-line {
232
+ left: 0.8rem;
233
+ }
234
+
235
+ .tn-tab-next {
236
+ left: 1.2rem;
237
+ }
238
+ }
239
+
240
+ /* #endregion */
241
+
242
+ /* ===================================== */
243
+ /* #region 动画 */
244
+ /* ===================================== */
245
+
246
+ @keyframes swiperFadeIn {
247
+ from {
248
+ opacity: 0;
249
+ }
250
+ to {
251
+ opacity: 1;
252
+ }
253
+ }
254
+
255
+ /* #endregion */