@sugarat/theme 0.5.11 → 0.5.12-beta.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.
- package/node.d.ts +2 -4
- package/node.js +206 -156
- package/node.mjs +205 -154
- package/package.json +10 -14
- package/src/components/Alert.vue +308 -0
- package/src/components/Avatar.vue +66 -0
- package/src/components/BlogAlert.vue +4 -4
- package/src/components/BlogApp.vue +4 -0
- package/src/components/BlogArticleAnalyze.vue +70 -32
- package/src/components/BlogButtonAfterArticle.vue +4 -4
- package/src/components/BlogFriendLink.vue +54 -27
- package/src/components/BlogHomeInfo.vue +1 -3
- package/src/components/BlogHomeTags.vue +8 -14
- package/src/components/BlogHotArticle.vue +3 -3
- package/src/components/BlogImagePreview.vue +3 -3
- package/src/components/BlogList.vue +7 -8
- package/src/components/BlogRecommendArticle.vue +3 -3
- package/src/components/Button.vue +165 -0
- package/src/components/Carousel.vue +254 -0
- package/src/components/CarouselItem.vue +154 -0
- package/src/components/Image.vue +34 -0
- package/src/components/ImageViewer.vue +406 -0
- package/src/components/Pagination.vue +397 -0
- package/src/components/Tag.vue +163 -0
- package/src/components/UserWorks.vue +19 -22
- package/src/composables/config/blog.ts +6 -1
- package/src/composables/config/index.ts +2 -2
- package/src/index.ts +10 -17
- package/src/node.ts +0 -3
- package/src/styles/el-base.css +340 -0
- package/src/utils/client/index.ts +17 -0
- package/src/utils/node/mdPlugins.ts +1 -1
- package/src/utils/node/theme.ts +5 -2
- package/src/utils/node/vitePlugins.ts +51 -18
package/src/index.ts
CHANGED
|
@@ -2,26 +2,17 @@
|
|
|
2
2
|
// override style
|
|
3
3
|
import './styles/index.scss'
|
|
4
4
|
|
|
5
|
-
// element-ui
|
|
6
|
-
|
|
7
|
-
import 'element-plus/theme-chalk/base.css'
|
|
8
|
-
import 'element-plus/theme-chalk/el-button.css'
|
|
9
|
-
import 'element-plus/theme-chalk/el-tag.css'
|
|
10
|
-
import 'element-plus/theme-chalk/el-icon.css'
|
|
11
|
-
import 'element-plus/theme-chalk/el-avatar.css'
|
|
12
|
-
import 'element-plus/theme-chalk/el-image.css'
|
|
13
|
-
import 'element-plus/theme-chalk/el-image-viewer.css'
|
|
14
|
-
import 'element-plus/theme-chalk/el-pagination.css'
|
|
15
|
-
import 'element-plus/theme-chalk/el-carousel.css'
|
|
16
|
-
import 'element-plus/theme-chalk/el-carousel-item.css'
|
|
17
|
-
import 'element-plus/theme-chalk/el-alert.css'
|
|
18
|
-
import 'element-plus/theme-chalk/dark/css-vars.css'
|
|
5
|
+
// element-ui-copy
|
|
6
|
+
import './styles/el-base.css'
|
|
19
7
|
|
|
20
8
|
// 引入时间线组件样式
|
|
21
|
-
|
|
9
|
+
// replace-timeline-import-code
|
|
10
|
+
// import 'vitepress-markdown-timeline/dist/theme/index.css'
|
|
22
11
|
import type { Theme } from 'vitepress'
|
|
23
12
|
import DefaultTheme from 'vitepress/theme'
|
|
24
|
-
|
|
13
|
+
|
|
14
|
+
// replace-tabs-import-code
|
|
15
|
+
// import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client'
|
|
25
16
|
|
|
26
17
|
// 图表渲染组件
|
|
27
18
|
// replace-mermaid-import-code
|
|
@@ -36,13 +27,15 @@ import UserWorksPage from './components/UserWorks.vue'
|
|
|
36
27
|
import './styles/theme/inline-theme.var.css'
|
|
37
28
|
|
|
38
29
|
// 导入group icons,改由自定义插件导入
|
|
30
|
+
// replace-group-icon-import-code
|
|
39
31
|
// import 'virtual:group-icons.css'
|
|
40
32
|
|
|
41
33
|
export const BlogTheme: Theme = {
|
|
42
34
|
...DefaultTheme,
|
|
43
35
|
Layout: withConfigProvider(BlogApp),
|
|
44
36
|
enhanceApp(ctx) {
|
|
45
|
-
|
|
37
|
+
// replace-tabs-enhance-app-code
|
|
38
|
+
// enhanceAppWithTabs(ctx.app)
|
|
46
39
|
DefaultTheme.enhanceApp(ctx)
|
|
47
40
|
ctx.app.component('UserWorksPage', UserWorksPage as any)
|
|
48
41
|
// replace-mermaid-mounted-code
|
package/src/node.ts
CHANGED
|
@@ -80,9 +80,6 @@ export function defineLocaleConfig(cfg: Omit<Theme.BlogConfig, 'locales' | 'page
|
|
|
80
80
|
return cfg
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// 重新导包 tabsMarkdownPlugin 导出CJS格式支持
|
|
84
|
-
export { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
|
|
85
|
-
|
|
86
83
|
export function footerHTML(footerData: Theme.FooterItem | Theme.FooterItem[]) {
|
|
87
84
|
const data = [footerData || []].flat()
|
|
88
85
|
return data.map((d) => {
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--el-color-white: #ffffff;
|
|
5
|
+
--el-color-black: #000000;
|
|
6
|
+
--el-color-primary-rgb: 64, 158, 255;
|
|
7
|
+
--el-color-success-rgb: 103, 194, 58;
|
|
8
|
+
--el-color-warning-rgb: 230, 162, 60;
|
|
9
|
+
--el-color-danger-rgb: 245, 108, 108;
|
|
10
|
+
--el-color-error-rgb: 245, 108, 108;
|
|
11
|
+
--el-color-info-rgb: 144, 147, 153;
|
|
12
|
+
--el-font-size-extra-large: 20px;
|
|
13
|
+
--el-font-size-large: 18px;
|
|
14
|
+
--el-font-size-medium: 16px;
|
|
15
|
+
--el-font-size-base: 14px;
|
|
16
|
+
--el-font-size-small: 13px;
|
|
17
|
+
--el-font-size-extra-small: 12px;
|
|
18
|
+
--el-font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
|
|
19
|
+
--el-font-weight-primary: 500;
|
|
20
|
+
--el-font-line-height-primary: 24px;
|
|
21
|
+
--el-index-normal: 1;
|
|
22
|
+
--el-index-top: 1000;
|
|
23
|
+
--el-index-popper: 2000;
|
|
24
|
+
--el-border-radius-base: 4px;
|
|
25
|
+
--el-border-radius-small: 2px;
|
|
26
|
+
--el-border-radius-round: 20px;
|
|
27
|
+
--el-border-radius-circle: 100%;
|
|
28
|
+
--el-transition-duration: 0.3s;
|
|
29
|
+
--el-transition-duration-fast: 0.2s;
|
|
30
|
+
--el-transition-function-ease-in-out-bezier: cubic-bezier(0.645, 0.045, 0.355, 1);
|
|
31
|
+
--el-transition-function-fast-bezier: cubic-bezier(0.23, 1, 0.32, 1);
|
|
32
|
+
--el-transition-all: all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);
|
|
33
|
+
--el-transition-fade: opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);
|
|
34
|
+
--el-transition-md-fade: transform var(--el-transition-duration) var(--el-transition-function-fast-bezier), opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);
|
|
35
|
+
--el-transition-fade-linear: opacity var(--el-transition-duration-fast) linear;
|
|
36
|
+
--el-transition-border: border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);
|
|
37
|
+
--el-transition-box-shadow: box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);
|
|
38
|
+
--el-transition-color: color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);
|
|
39
|
+
--el-component-size-large: 40px;
|
|
40
|
+
--el-component-size: 32px;
|
|
41
|
+
--el-component-size-small: 24px
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:root {
|
|
45
|
+
color-scheme: light;
|
|
46
|
+
--el-color-primary: #409eff;
|
|
47
|
+
--el-color-primary-light-3: #79bbff;
|
|
48
|
+
--el-color-primary-light-5: #a0cfff;
|
|
49
|
+
--el-color-primary-light-7: #c6e2ff;
|
|
50
|
+
--el-color-primary-light-8: #d9ecff;
|
|
51
|
+
--el-color-primary-light-9: #ecf5ff;
|
|
52
|
+
--el-color-primary-dark-2: #337ecc;
|
|
53
|
+
--el-color-success: #67c23a;
|
|
54
|
+
--el-color-success-light-3: #95d475;
|
|
55
|
+
--el-color-success-light-5: #b3e19d;
|
|
56
|
+
--el-color-success-light-7: #d1edc4;
|
|
57
|
+
--el-color-success-light-8: #e1f3d8;
|
|
58
|
+
--el-color-success-light-9: #f0f9eb;
|
|
59
|
+
--el-color-success-dark-2: #529b2e;
|
|
60
|
+
--el-color-warning: #e6a23c;
|
|
61
|
+
--el-color-warning-light-3: #eebe77;
|
|
62
|
+
--el-color-warning-light-5: #f3d19e;
|
|
63
|
+
--el-color-warning-light-7: #f8e3c5;
|
|
64
|
+
--el-color-warning-light-8: #faecd8;
|
|
65
|
+
--el-color-warning-light-9: #fdf6ec;
|
|
66
|
+
--el-color-warning-dark-2: #b88230;
|
|
67
|
+
--el-color-danger: #f56c6c;
|
|
68
|
+
--el-color-danger-light-3: #f89898;
|
|
69
|
+
--el-color-danger-light-5: #fab6b6;
|
|
70
|
+
--el-color-danger-light-7: #fcd3d3;
|
|
71
|
+
--el-color-danger-light-8: #fde2e2;
|
|
72
|
+
--el-color-danger-light-9: #fef0f0;
|
|
73
|
+
--el-color-danger-dark-2: #c45656;
|
|
74
|
+
--el-color-error: #f56c6c;
|
|
75
|
+
--el-color-error-light-3: #f89898;
|
|
76
|
+
--el-color-error-light-5: #fab6b6;
|
|
77
|
+
--el-color-error-light-7: #fcd3d3;
|
|
78
|
+
--el-color-error-light-8: #fde2e2;
|
|
79
|
+
--el-color-error-light-9: #fef0f0;
|
|
80
|
+
--el-color-error-dark-2: #c45656;
|
|
81
|
+
--el-color-info: #909399;
|
|
82
|
+
--el-color-info-light-3: #b1b3b8;
|
|
83
|
+
--el-color-info-light-5: #c8c9cc;
|
|
84
|
+
--el-color-info-light-7: #dedfe0;
|
|
85
|
+
--el-color-info-light-8: #e9e9eb;
|
|
86
|
+
--el-color-info-light-9: #f4f4f5;
|
|
87
|
+
--el-color-info-dark-2: #73767a;
|
|
88
|
+
--el-bg-color: #ffffff;
|
|
89
|
+
--el-bg-color-page: #f2f3f5;
|
|
90
|
+
--el-bg-color-overlay: #ffffff;
|
|
91
|
+
--el-text-color-primary: #303133;
|
|
92
|
+
--el-text-color-regular: #606266;
|
|
93
|
+
--el-text-color-secondary: #909399;
|
|
94
|
+
--el-text-color-placeholder: #a8abb2;
|
|
95
|
+
--el-text-color-disabled: #c0c4cc;
|
|
96
|
+
--el-border-color: #dcdfe6;
|
|
97
|
+
--el-border-color-light: #e4e7ed;
|
|
98
|
+
--el-border-color-lighter: #ebeef5;
|
|
99
|
+
--el-border-color-extra-light: #f2f6fc;
|
|
100
|
+
--el-border-color-dark: #d4d7de;
|
|
101
|
+
--el-border-color-darker: #cdd0d6;
|
|
102
|
+
--el-fill-color: #f0f2f5;
|
|
103
|
+
--el-fill-color-light: #f5f7fa;
|
|
104
|
+
--el-fill-color-lighter: #fafafa;
|
|
105
|
+
--el-fill-color-extra-light: #fafcff;
|
|
106
|
+
--el-fill-color-dark: #ebedf0;
|
|
107
|
+
--el-fill-color-darker: #e6e8eb;
|
|
108
|
+
--el-fill-color-blank: #ffffff;
|
|
109
|
+
--el-box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.04), 0px 8px 20px rgba(0, 0, 0, 0.08);
|
|
110
|
+
--el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, 0.12);
|
|
111
|
+
--el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.12);
|
|
112
|
+
--el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, 0.08), 0px 12px 32px rgba(0, 0, 0, 0.12), 0px 8px 16px -8px rgba(0, 0, 0, 0.16);
|
|
113
|
+
--el-disabled-bg-color: var(--el-fill-color-light);
|
|
114
|
+
--el-disabled-text-color: var(--el-text-color-placeholder);
|
|
115
|
+
--el-disabled-border-color: var(--el-border-color-light);
|
|
116
|
+
--el-overlay-color: rgba(0, 0, 0, 0.8);
|
|
117
|
+
--el-overlay-color-light: rgba(0, 0, 0, 0.7);
|
|
118
|
+
--el-overlay-color-lighter: rgba(0, 0, 0, 0.5);
|
|
119
|
+
--el-mask-color: rgba(255, 255, 255, 0.9);
|
|
120
|
+
--el-mask-color-extra-light: rgba(255, 255, 255, 0.3);
|
|
121
|
+
--el-border-width: 1px;
|
|
122
|
+
--el-border-style: solid;
|
|
123
|
+
--el-border-color-hover: var(--el-text-color-disabled);
|
|
124
|
+
--el-border: var(--el-border-width) var(--el-border-style) var(--el-border-color);
|
|
125
|
+
--el-svg-monochrome-grey: var(--el-border-color)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fade-in-linear-enter-active,
|
|
129
|
+
.fade-in-linear-leave-active {
|
|
130
|
+
transition: var(--el-transition-fade-linear)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.fade-in-linear-enter-from,
|
|
134
|
+
.fade-in-linear-leave-to {
|
|
135
|
+
opacity: 0
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.el-fade-in-linear-enter-active,
|
|
139
|
+
.el-fade-in-linear-leave-active {
|
|
140
|
+
transition: var(--el-transition-fade-linear)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.el-fade-in-linear-enter-from,
|
|
144
|
+
.el-fade-in-linear-leave-to {
|
|
145
|
+
opacity: 0
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.el-fade-in-enter-active,
|
|
149
|
+
.el-fade-in-leave-active {
|
|
150
|
+
transition: all var(--el-transition-duration) cubic-bezier(.55, 0, .1, 1)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.el-fade-in-enter-from,
|
|
154
|
+
.el-fade-in-leave-active {
|
|
155
|
+
opacity: 0
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.el-zoom-in-center-enter-active,
|
|
159
|
+
.el-zoom-in-center-leave-active {
|
|
160
|
+
transition: all var(--el-transition-duration) cubic-bezier(.55, 0, .1, 1)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.el-zoom-in-center-enter-from,
|
|
164
|
+
.el-zoom-in-center-leave-active {
|
|
165
|
+
opacity: 0;
|
|
166
|
+
transform: scaleX(0)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.el-zoom-in-top-enter-active,
|
|
170
|
+
.el-zoom-in-top-leave-active {
|
|
171
|
+
opacity: 1;
|
|
172
|
+
transform: scaleY(1);
|
|
173
|
+
transform-origin: center top;
|
|
174
|
+
transition: var(--el-transition-md-fade)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.el-zoom-in-top-enter-active[data-popper-placement^=top],
|
|
178
|
+
.el-zoom-in-top-leave-active[data-popper-placement^=top] {
|
|
179
|
+
transform-origin: center bottom
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.el-zoom-in-top-enter-from,
|
|
183
|
+
.el-zoom-in-top-leave-active {
|
|
184
|
+
opacity: 0;
|
|
185
|
+
transform: scaleY(0)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.el-zoom-in-bottom-enter-active,
|
|
189
|
+
.el-zoom-in-bottom-leave-active {
|
|
190
|
+
opacity: 1;
|
|
191
|
+
transform: scaleY(1);
|
|
192
|
+
transform-origin: center bottom;
|
|
193
|
+
transition: var(--el-transition-md-fade)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.el-zoom-in-bottom-enter-from,
|
|
197
|
+
.el-zoom-in-bottom-leave-active {
|
|
198
|
+
opacity: 0;
|
|
199
|
+
transform: scaleY(0)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.el-zoom-in-left-enter-active,
|
|
203
|
+
.el-zoom-in-left-leave-active {
|
|
204
|
+
opacity: 1;
|
|
205
|
+
transform: scale(1);
|
|
206
|
+
transform-origin: top left;
|
|
207
|
+
transition: var(--el-transition-md-fade)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.el-zoom-in-left-enter-from,
|
|
211
|
+
.el-zoom-in-left-leave-active {
|
|
212
|
+
opacity: 0;
|
|
213
|
+
transform: scale(.45)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.collapse-transition {
|
|
217
|
+
transition: var(--el-transition-duration) height ease-in-out, var(--el-transition-duration) padding-top ease-in-out, var(--el-transition-duration) padding-bottom ease-in-out
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.el-collapse-transition-enter-active,
|
|
221
|
+
.el-collapse-transition-leave-active {
|
|
222
|
+
transition: var(--el-transition-duration) max-height ease-in-out, var(--el-transition-duration) padding-top ease-in-out, var(--el-transition-duration) padding-bottom ease-in-out
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.horizontal-collapse-transition {
|
|
226
|
+
transition: var(--el-transition-duration) width ease-in-out, var(--el-transition-duration) padding-left ease-in-out, var(--el-transition-duration) padding-right ease-in-out
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.el-list-enter-active,
|
|
230
|
+
.el-list-leave-active {
|
|
231
|
+
transition: all 1s
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.el-list-enter-from,
|
|
235
|
+
.el-list-leave-to {
|
|
236
|
+
opacity: 0;
|
|
237
|
+
transform: translateY(-30px)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.el-list-leave-active {
|
|
241
|
+
position: absolute !important
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.el-opacity-transition {
|
|
245
|
+
transition: opacity var(--el-transition-duration) cubic-bezier(.55, 0, .1, 1)
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
@-webkit-keyframes rotating {
|
|
250
|
+
0% {
|
|
251
|
+
transform: rotate(0deg)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
to {
|
|
255
|
+
transform: rotate(1turn)
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
@keyframes rotating {
|
|
260
|
+
0% {
|
|
261
|
+
transform: rotate(0deg)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
to {
|
|
265
|
+
transform: rotate(1turn)
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
html.dark {
|
|
270
|
+
color-scheme: dark;
|
|
271
|
+
--el-color-primary: #409eff;
|
|
272
|
+
--el-color-primary-light-3: #3375b9;
|
|
273
|
+
--el-color-primary-light-5: #2a598a;
|
|
274
|
+
--el-color-primary-light-7: #213d5b;
|
|
275
|
+
--el-color-primary-light-8: #1d3043;
|
|
276
|
+
--el-color-primary-light-9: #18222c;
|
|
277
|
+
--el-color-primary-dark-2: #66b1ff;
|
|
278
|
+
--el-color-success: #67c23a;
|
|
279
|
+
--el-color-success-light-3: #4e8e2f;
|
|
280
|
+
--el-color-success-light-5: #3e6b27;
|
|
281
|
+
--el-color-success-light-7: #2d481f;
|
|
282
|
+
--el-color-success-light-8: #25371c;
|
|
283
|
+
--el-color-success-light-9: #1c2518;
|
|
284
|
+
--el-color-success-dark-2: #85ce61;
|
|
285
|
+
--el-color-warning: #e6a23c;
|
|
286
|
+
--el-color-warning-light-3: #a77730;
|
|
287
|
+
--el-color-warning-light-5: #7d5b28;
|
|
288
|
+
--el-color-warning-light-7: #533f20;
|
|
289
|
+
--el-color-warning-light-8: #3e301c;
|
|
290
|
+
--el-color-warning-light-9: #292218;
|
|
291
|
+
--el-color-warning-dark-2: #ebb563;
|
|
292
|
+
--el-color-danger: #f56c6c;
|
|
293
|
+
--el-color-danger-light-3: #b25252;
|
|
294
|
+
--el-color-danger-light-5: #854040;
|
|
295
|
+
--el-color-danger-light-7: #582e2e;
|
|
296
|
+
--el-color-danger-light-8: #412626;
|
|
297
|
+
--el-color-danger-light-9: #2b1d1d;
|
|
298
|
+
--el-color-danger-dark-2: #f78989;
|
|
299
|
+
--el-color-error: #f56c6c;
|
|
300
|
+
--el-color-error-light-3: #b25252;
|
|
301
|
+
--el-color-error-light-5: #854040;
|
|
302
|
+
--el-color-error-light-7: #582e2e;
|
|
303
|
+
--el-color-error-light-8: #412626;
|
|
304
|
+
--el-color-error-light-9: #2b1d1d;
|
|
305
|
+
--el-color-error-dark-2: #f78989;
|
|
306
|
+
--el-color-info: #909399;
|
|
307
|
+
--el-color-info-light-3: #6b6d71;
|
|
308
|
+
--el-color-info-light-5: #525457;
|
|
309
|
+
--el-color-info-light-7: #393a3c;
|
|
310
|
+
--el-color-info-light-8: #2d2d2f;
|
|
311
|
+
--el-color-info-light-9: #202121;
|
|
312
|
+
--el-color-info-dark-2: #a6a9ad;
|
|
313
|
+
--el-box-shadow: 0px 12px 32px 4px rgba(0, 0, 0, 0.36), 0px 8px 20px rgba(0, 0, 0, 0.72);
|
|
314
|
+
--el-box-shadow-light: 0px 0px 12px rgba(0, 0, 0, 0.72);
|
|
315
|
+
--el-box-shadow-lighter: 0px 0px 6px rgba(0, 0, 0, 0.72);
|
|
316
|
+
--el-box-shadow-dark: 0px 16px 48px 16px rgba(0, 0, 0, 0.72), 0px 12px 32px #000000, 0px 8px 16px -8px #000000;
|
|
317
|
+
--el-bg-color-page: #0a0a0a;
|
|
318
|
+
--el-bg-color: #141414;
|
|
319
|
+
--el-bg-color-overlay: #1d1e1f;
|
|
320
|
+
--el-text-color-primary: #E5EAF3;
|
|
321
|
+
--el-text-color-regular: #CFD3DC;
|
|
322
|
+
--el-text-color-secondary: #A3A6AD;
|
|
323
|
+
--el-text-color-placeholder: #8D9095;
|
|
324
|
+
--el-text-color-disabled: #6C6E72;
|
|
325
|
+
--el-border-color-darker: #636466;
|
|
326
|
+
--el-border-color-dark: #58585B;
|
|
327
|
+
--el-border-color: #4C4D4F;
|
|
328
|
+
--el-border-color-light: #414243;
|
|
329
|
+
--el-border-color-lighter: #363637;
|
|
330
|
+
--el-border-color-extra-light: #2B2B2C;
|
|
331
|
+
--el-fill-color-darker: #424243;
|
|
332
|
+
--el-fill-color-dark: #39393A;
|
|
333
|
+
--el-fill-color: #303030;
|
|
334
|
+
--el-fill-color-light: #262727;
|
|
335
|
+
--el-fill-color-lighter: #1D1D1D;
|
|
336
|
+
--el-fill-color-extra-light: #191919;
|
|
337
|
+
--el-fill-color-blank: transparent;
|
|
338
|
+
--el-mask-color: rgba(0, 0, 0, 0.8);
|
|
339
|
+
--el-mask-color-extra-light: rgba(0, 0, 0, 0.3)
|
|
340
|
+
}
|
|
@@ -174,3 +174,20 @@ export function wrapperCleanUrls(cleanUrls: boolean, route: string) {
|
|
|
174
174
|
export function replaceValue(str: string, value: any) {
|
|
175
175
|
return str.replace(/\{\{value\}\}/, value)
|
|
176
176
|
}
|
|
177
|
+
|
|
178
|
+
// https://github.com/mdit-vue/mdit-vue/blob/main/packages/shared/src/slugify.ts
|
|
179
|
+
// eslint-disable-next-line no-control-regex
|
|
180
|
+
const rControl = /[\u0000-\u001F]/g
|
|
181
|
+
const rSpecial = /[\s~`!@#$%^&*()\-_+=[\]{}|\\;:"'“”‘’<>,.?/]+/g
|
|
182
|
+
const rCombining = /[\u0300-\u036F]/g
|
|
183
|
+
export function slugify(str: string) {
|
|
184
|
+
return str
|
|
185
|
+
.normalize('NFKD')
|
|
186
|
+
.replace(rCombining, '')
|
|
187
|
+
.replace(rControl, '')
|
|
188
|
+
.replace(rSpecial, '-')
|
|
189
|
+
.replace(/-{2,}/g, '-')
|
|
190
|
+
.replace(/^-+|-+$/g, '')
|
|
191
|
+
.replace(/^(\d)/, '_$1')
|
|
192
|
+
.toLowerCase()
|
|
193
|
+
}
|
|
@@ -78,7 +78,7 @@ export function patchOptimizeDeps(config: any) {
|
|
|
78
78
|
config.vite.optimizeDeps = {}
|
|
79
79
|
}
|
|
80
80
|
config.vite.optimizeDeps.exclude = ['vitepress-plugin-tabs', '@sugarat/theme']
|
|
81
|
-
config.vite.optimizeDeps.include = ['element-plus']
|
|
81
|
+
// config.vite.optimizeDeps.include = ['element-plus']
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export function supportRunExtendsPlugin(config: UserConfig<Theme.Config>) {
|
package/src/utils/node/theme.ts
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'node:path'
|
|
|
3
3
|
import { getDefaultTitle, getFileLastModifyTime, getTextSummary, getVitePressPages, grayMatter, normalizePath, renderDynamicMarkdown } from '@sugarat/theme-shared'
|
|
4
4
|
import type { SiteConfig } from 'vitepress'
|
|
5
5
|
import type { Theme } from '../../composables/config/index'
|
|
6
|
-
import { formatDate } from '../client'
|
|
6
|
+
import { formatDate, shuffleArray } from '../client'
|
|
7
7
|
import { getFirstImagURLFromMD } from './index'
|
|
8
8
|
|
|
9
9
|
export function patchDefaultThemeSideBar(cfg?: Partial<Theme.BlogConfig>) {
|
|
@@ -147,5 +147,8 @@ export function patchVPThemeConfig(
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
export function checkConfig(cfg?: Partial<Theme.BlogConfig>) {
|
|
150
|
-
|
|
150
|
+
const friendConfig = cfg?.friend
|
|
151
|
+
if (!Array.isArray(friendConfig) && friendConfig?.random) {
|
|
152
|
+
friendConfig.list = shuffleArray(friendConfig.list)
|
|
153
|
+
}
|
|
151
154
|
}
|
|
@@ -63,22 +63,35 @@ export function getVitePlugins(cfg: Partial<Theme.BlogConfig> = {}) {
|
|
|
63
63
|
plugins.push(groupIconVitePlugin(cfg?.groupIcon))
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
// patch tabs
|
|
67
|
+
if (cfg?.tabs !== false) {
|
|
68
|
+
plugins.push(patchTabsPlugin())
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// patch timeline
|
|
72
|
+
if (cfg?.timeline !== false) {
|
|
73
|
+
plugins.push(patchTimelinePlugin())
|
|
74
|
+
}
|
|
66
75
|
return plugins
|
|
67
76
|
}
|
|
68
77
|
|
|
69
78
|
export function patchGroupIconPlugin() {
|
|
70
|
-
return {
|
|
79
|
+
return createPatchPlugin({
|
|
71
80
|
name: '@sugarat/theme-plugin-patch-group-icon',
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// 匹配 theme/index.ts 或 theme/index.js 文件
|
|
75
|
-
if (id.match(/[\/\\]theme[\/\\]index\.(ts|js)$/)) {
|
|
76
|
-
// 在文件顶部插入 import 语句
|
|
77
|
-
return `import 'virtual:group-icons.css'\n${code}`
|
|
78
|
-
}
|
|
79
|
-
return code
|
|
81
|
+
replacements: {
|
|
82
|
+
'// replace-group-icon-import-code': 'import \'virtual:group-icons.css\''
|
|
80
83
|
}
|
|
81
|
-
}
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function patchTabsPlugin() {
|
|
88
|
+
return createPatchPlugin({
|
|
89
|
+
name: '@sugarat/theme-plugin-patch-tabs',
|
|
90
|
+
replacements: {
|
|
91
|
+
'// replace-tabs-import-code': 'import { enhanceAppWithTabs } from \'vitepress-plugin-tabs/client\'',
|
|
92
|
+
'// replace-tabs-enhance-app-code': 'enhanceAppWithTabs(ctx.app)'
|
|
93
|
+
}
|
|
94
|
+
})
|
|
82
95
|
}
|
|
83
96
|
|
|
84
97
|
export function registerVitePlugins(vpCfg: any, plugins: any[]) {
|
|
@@ -89,18 +102,30 @@ export function registerVitePlugins(vpCfg: any, plugins: any[]) {
|
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
export function inlineInjectMermaidClient() {
|
|
92
|
-
return {
|
|
105
|
+
return createPatchPlugin({
|
|
93
106
|
name: '@sugarat/theme-plugin-inline-inject-mermaid-client',
|
|
107
|
+
replacements: {
|
|
108
|
+
'// replace-mermaid-import-code': 'import Mermaid from \'vitepress-plugin-mermaid/Mermaid.vue\'',
|
|
109
|
+
'// replace-mermaid-mounted-code': 'if (!ctx.app.component(\'Mermaid\')) { ctx.app.component(\'Mermaid\', Mermaid as any) }'
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function createPatchPlugin({ name, replacements }: { name: string; replacements: Record<string, string> }) {
|
|
115
|
+
return {
|
|
116
|
+
name,
|
|
94
117
|
enforce: 'pre',
|
|
95
|
-
transform(code, id) {
|
|
96
|
-
if (id.endsWith('src/index.ts') && code.startsWith('// @sugarat/theme index')) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
118
|
+
transform(code: string, id: string) {
|
|
119
|
+
if (id.endsWith('theme/src/index.ts') && code.startsWith('// @sugarat/theme index')) {
|
|
120
|
+
let newCode = code
|
|
121
|
+
for (const [key, value] of Object.entries(replacements)) {
|
|
122
|
+
newCode = newCode.replace(key, value)
|
|
123
|
+
}
|
|
124
|
+
return newCode
|
|
100
125
|
}
|
|
101
126
|
return code
|
|
102
|
-
}
|
|
103
|
-
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
104
129
|
}
|
|
105
130
|
|
|
106
131
|
export function inlineBuildEndPlugin(buildEndFn: any[]) {
|
|
@@ -312,3 +337,11 @@ export function setThemeScript(
|
|
|
312
337
|
}
|
|
313
338
|
return pluginOps
|
|
314
339
|
}
|
|
340
|
+
function patchTimelinePlugin() {
|
|
341
|
+
return createPatchPlugin({
|
|
342
|
+
name: '@sugarat/theme-plugin-patch-timeline',
|
|
343
|
+
replacements: {
|
|
344
|
+
'// replace-timeline-import-code': 'import \'vitepress-markdown-timeline/dist/theme/index.css\''
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
}
|