vitepress-theme-teek 1.6.0 → 1.6.2
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/es/components/theme/article-analyze/src/index.vue2.mjs +1 -1
- package/es/components/theme/article-info/src/index.vue2.mjs +3 -1
- package/es/components/theme/right-bottom-button/src/index.vue2.mjs +2 -3
- package/es/components/theme/right-bottom-button/src/theme-color.vue2.mjs +4 -3
- package/es/components/theme/theme-enhance/src/index.vue.d.ts +2 -0
- package/es/components/theme/theme-enhance/src/index.vue2.mjs +65 -20
- package/es/config/post/index.d.ts +4 -2
- package/es/config/post/index.mjs +9 -5
- package/es/index.css +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/index.css +1 -1
- package/index.js +75 -28
- package/index.min.js +30 -30
- package/index.min.mjs +32 -32
- package/index.mjs +75 -28
- package/lib/components/theme/article-analyze/src/index.vue2.js +1 -1
- package/lib/components/theme/article-info/src/index.vue2.js +3 -1
- package/lib/components/theme/right-bottom-button/src/index.vue2.js +2 -3
- package/lib/components/theme/right-bottom-button/src/theme-color.vue2.js +3 -2
- package/lib/components/theme/theme-enhance/src/index.vue.d.ts +2 -0
- package/lib/components/theme/theme-enhance/src/index.vue2.js +64 -19
- package/lib/config/post/index.d.ts +4 -2
- package/lib/config/post/index.js +8 -4
- package/lib/index.css +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/components/common/title-tag.scss +6 -2
- package/theme-chalk/tk-container.css +1 -1
|
@@ -107,7 +107,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
107
107
|
() => {
|
|
108
108
|
if (usePageView.value) {
|
|
109
109
|
if (statisticsConfig.value.permalink && router.state?.permalinkPlugin) {
|
|
110
|
-
|
|
110
|
+
setTimeout(request, 50);
|
|
111
111
|
} else request();
|
|
112
112
|
}
|
|
113
113
|
},
|
|
@@ -45,7 +45,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
45
|
const route = useRoute();
|
|
46
46
|
const createDate = computed(() => {
|
|
47
47
|
const originPosts = posts.value.originPosts;
|
|
48
|
-
const date = __props.post.date || originPosts.find(
|
|
48
|
+
const date = __props.post.date || originPosts.find(
|
|
49
|
+
(item) => [item.url, item.frontmatter.permalink, `${item.frontmatter.permalink}.html`].includes(decodeURI(route.path))
|
|
50
|
+
)?.date;
|
|
49
51
|
const { dateFormat: dateFormatConst, dateUTC } = articleConfig.value;
|
|
50
52
|
if (isFunction(dateFormatConst)) return dateFormatConst(date || "");
|
|
51
53
|
return formatDate(date || /* @__PURE__ */ new Date(), dateFormatConst, dateUTC);
|
|
@@ -41,9 +41,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
41
41
|
const isMobile = useMediaQuery(mobileMaxWidthMedia);
|
|
42
42
|
const disabledThemeColor = computed(() => {
|
|
43
43
|
const { enabled = true, themeColor = {}, position = "top" } = themeEnhanceConfig.value;
|
|
44
|
-
|
|
45
|
-
if (
|
|
46
|
-
if (isDisabled !== void 0) return isDisabled;
|
|
44
|
+
if (!enabled || themeColor.disabled) return true;
|
|
45
|
+
if (isMobile.value && themeColor.disabledInMobile !== void 0) return themeColor.disabledInMobile;
|
|
47
46
|
return !isMobile.value && position === "top";
|
|
48
47
|
});
|
|
49
48
|
return (_ctx, _cache) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, ref, watch, onMounted, openBlock, createBlock,
|
|
1
|
+
import { defineComponent, ref, watch, onMounted, unref, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle, createVNode, createCommentVNode } from 'vue';
|
|
2
2
|
import { useData } from 'vitepress';
|
|
3
3
|
import { isClient } from '../../../../helper/dist/index.mjs';
|
|
4
4
|
import 'vitepress-theme-teek/theme-chalk/tk-copy-banner.css';
|
|
@@ -77,7 +77,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
77
77
|
themeColorName.value = option.value;
|
|
78
78
|
};
|
|
79
79
|
return (_ctx, _cache) => {
|
|
80
|
-
return openBlock(), createBlock(unref(_sfc_main$1), {
|
|
80
|
+
return !(unref(themeEnhanceConfig).themeColor?.hidden ?? unref(themeEnhanceConfig).hidden ?? false) ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
81
|
+
key: 0,
|
|
81
82
|
class: normalizeClass(unref(ns).e("button")),
|
|
82
83
|
"popper-class": unref(ns).e("dropdown"),
|
|
83
84
|
placement: "left-start",
|
|
@@ -153,7 +154,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
153
154
|
]),
|
|
154
155
|
_: 1
|
|
155
156
|
/* STABLE */
|
|
156
|
-
}, 8, ["class", "popper-class", "transition-name", "title", "aria-label"]);
|
|
157
|
+
}, 8, ["class", "popper-class", "transition-name", "title", "aria-label"])) : createCommentVNode("v-if", true);
|
|
157
158
|
};
|
|
158
159
|
}
|
|
159
160
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed,
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, Fragment, unref, createBlock, normalizeClass, withCtx, createElementVNode, renderSlot, createVNode, createCommentVNode, withDirectives, vShow } from 'vue';
|
|
2
2
|
import readingIcon from '../../../../static/icons/reading.mjs';
|
|
3
3
|
import 'vitepress';
|
|
4
4
|
import 'vitepress-theme-teek/theme-chalk/tk-copy-banner.css';
|
|
@@ -32,22 +32,65 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
34
|
return (_ctx, _cache) => {
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
return openBlock(), createElementBlock(
|
|
36
|
+
Fragment,
|
|
37
|
+
null,
|
|
38
|
+
[
|
|
39
|
+
!unref(isMobile) && unref(themeEnhanceConfig).position === "top" && !(unref(themeEnhanceConfig).hidden ?? false) ? (openBlock(), createBlock(unref(_sfc_main$1), {
|
|
40
|
+
key: 0,
|
|
41
|
+
class: normalizeClass([unref(ns).b(), "flx-align-center"]),
|
|
42
|
+
"popper-class": unref(ns).e("popover"),
|
|
43
|
+
"y-offset": -15
|
|
44
|
+
}, {
|
|
45
|
+
reference: withCtx(() => [
|
|
46
|
+
createVNode(unref(_sfc_main$8), {
|
|
47
|
+
icon: unref(readingIcon),
|
|
48
|
+
size: 20
|
|
49
|
+
}, null, 8, ["icon"])
|
|
50
|
+
]),
|
|
51
|
+
default: withCtx(() => [
|
|
52
|
+
createElementVNode(
|
|
53
|
+
"div",
|
|
54
|
+
{
|
|
55
|
+
class: normalizeClass(unref(ns).e("content"))
|
|
56
|
+
},
|
|
57
|
+
[
|
|
58
|
+
renderSlot(_ctx.$slots, "teek-theme-enhance-top"),
|
|
59
|
+
!disabledList.value.layoutSwitch ? (openBlock(), createElementBlock(
|
|
60
|
+
Fragment,
|
|
61
|
+
{ key: 0 },
|
|
62
|
+
[
|
|
63
|
+
createVNode(_sfc_main$2),
|
|
64
|
+
createVNode(_sfc_main$3),
|
|
65
|
+
createVNode(_sfc_main$4)
|
|
66
|
+
],
|
|
67
|
+
64
|
|
68
|
+
/* STABLE_FRAGMENT */
|
|
69
|
+
)) : createCommentVNode("v-if", true),
|
|
70
|
+
!disabledList.value.themeColor ? (openBlock(), createBlock(_sfc_main$5, { key: 1 })) : createCommentVNode("v-if", true),
|
|
71
|
+
!disabledList.value.spotlight ? (openBlock(), createElementBlock(
|
|
72
|
+
Fragment,
|
|
73
|
+
{ key: 2 },
|
|
74
|
+
[
|
|
75
|
+
createVNode(_sfc_main$6),
|
|
76
|
+
createVNode(_sfc_main$7)
|
|
77
|
+
],
|
|
78
|
+
64
|
|
79
|
+
/* STABLE_FRAGMENT */
|
|
80
|
+
)) : createCommentVNode("v-if", true),
|
|
81
|
+
renderSlot(_ctx.$slots, "teek-theme-enhance-bottom")
|
|
82
|
+
],
|
|
83
|
+
2
|
|
84
|
+
/* CLASS */
|
|
85
|
+
)
|
|
86
|
+
]),
|
|
87
|
+
_: 3
|
|
88
|
+
/* FORWARDED */
|
|
89
|
+
}, 8, ["class", "popper-class"])) : createCommentVNode("v-if", true),
|
|
90
|
+
unref(themeEnhanceConfig).hidden ?? false ? withDirectives((openBlock(), createElementBlock(
|
|
49
91
|
"div",
|
|
50
92
|
{
|
|
93
|
+
key: 1,
|
|
51
94
|
class: normalizeClass(unref(ns).e("content"))
|
|
52
95
|
},
|
|
53
96
|
[
|
|
@@ -78,11 +121,13 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
78
121
|
],
|
|
79
122
|
2
|
|
80
123
|
/* CLASS */
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
124
|
+
)), [
|
|
125
|
+
[vShow, !(unref(themeEnhanceConfig).hidden ?? false)]
|
|
126
|
+
]) : createCommentVNode("v-if", true)
|
|
127
|
+
],
|
|
128
|
+
64
|
|
129
|
+
/* STABLE_FRAGMENT */
|
|
130
|
+
);
|
|
86
131
|
};
|
|
87
132
|
}
|
|
88
133
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FileContentLoaderData } from 'vitepress-plugin-file-content-loader';
|
|
2
|
-
import { TkContentData, PostData } from './types';
|
|
3
2
|
import { RequiredKeyPartialOther } from '../../helper';
|
|
3
|
+
import { TkContentData, PostData } from './types';
|
|
4
|
+
import { ArticleAnalyze } from '../interface';
|
|
4
5
|
/**
|
|
5
6
|
* 转换为文章数据
|
|
6
7
|
*/
|
|
@@ -20,8 +21,9 @@ export declare function getTitle(post: RequiredKeyPartialOther<TkContentData, "f
|
|
|
20
21
|
*
|
|
21
22
|
* @param post 文章数据
|
|
22
23
|
* @param srcDir 项目绝对路径
|
|
24
|
+
* @param articleAnalyze 文章信息配置
|
|
23
25
|
*/
|
|
24
|
-
export declare function getDate(post: RequiredKeyPartialOther<TkContentData, "frontmatter" | "relativePath">, srcDir: string): any;
|
|
26
|
+
export declare function getDate(post: RequiredKeyPartialOther<TkContentData, "frontmatter" | "relativePath">, srcDir: string, { dateFormat, dateUTC }: ArticleAnalyze): any;
|
|
25
27
|
/**
|
|
26
28
|
* 截取 markdown 文件前 count 数的内容
|
|
27
29
|
*
|
package/es/config/post/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getTitleFromMarkdown } from 'vitepress-plugin-sidebar-resolve';
|
|
2
2
|
import { join, basename } from 'node:path';
|
|
3
3
|
import { statSync } from 'node:fs';
|
|
4
|
-
import { formatDate } from '../../helper/dist/index.mjs';
|
|
4
|
+
import { isFunction, formatDate } from '../../helper/dist/index.mjs';
|
|
5
5
|
import { filterPosts, getSortPostsByDateAndSticky, getSortPostsByDate, groupByYear, groupByYearMonth, getGroupPosts, getGroupCards } from './helper.mjs';
|
|
6
6
|
import matter from 'gray-matter';
|
|
7
7
|
|
|
@@ -9,14 +9,17 @@ const transformData = (data) => {
|
|
|
9
9
|
const siteConfig = globalThis.VITEPRESS_CONFIG;
|
|
10
10
|
const { themeConfig } = siteConfig.userConfig;
|
|
11
11
|
const { frontmatter, url, relativePath, excerpt } = data;
|
|
12
|
-
|
|
12
|
+
const { dateFormat = "yyyy-MM-dd hh:mm:ss", dateUTC = true } = themeConfig.articleAnalyze ?? {};
|
|
13
|
+
if (frontmatter.date) {
|
|
14
|
+
frontmatter.date = isFunction(dateFormat) ? dateFormat(frontmatter.date) : formatDate(frontmatter.date, dateFormat, dateUTC);
|
|
15
|
+
}
|
|
13
16
|
return {
|
|
14
17
|
url,
|
|
15
18
|
relativePath,
|
|
16
19
|
frontmatter,
|
|
17
20
|
author: frontmatter.author || themeConfig.author,
|
|
18
21
|
title: getTitle(data),
|
|
19
|
-
date: getDate(data, siteConfig.srcDir),
|
|
22
|
+
date: getDate(data, siteConfig.srcDir, { dateFormat, dateUTC }),
|
|
20
23
|
excerpt,
|
|
21
24
|
capture: getCaptureText(data)
|
|
22
25
|
};
|
|
@@ -64,7 +67,7 @@ function getTitle(post) {
|
|
|
64
67
|
const name = splitName.length > 1 ? splitName[1] : splitName[0];
|
|
65
68
|
return getTitleFromMarkdown(content) || name || "";
|
|
66
69
|
}
|
|
67
|
-
function getDate(post, srcDir) {
|
|
70
|
+
function getDate(post, srcDir, { dateFormat = "yyyy-MM-dd hh:mm:ss", dateUTC = true }) {
|
|
68
71
|
const { frontmatter, relativePath } = post;
|
|
69
72
|
if (frontmatter.date) return frontmatter.date;
|
|
70
73
|
const filePath = join(
|
|
@@ -72,7 +75,8 @@ function getDate(post, srcDir) {
|
|
|
72
75
|
`${relativePath.endsWith("/") ? `${relativePath}/index` : relativePath.replace(/\.html$/, "")}.md`
|
|
73
76
|
);
|
|
74
77
|
const stat = statSync(filePath);
|
|
75
|
-
|
|
78
|
+
const originalDate = stat.birthtime || stat.atime;
|
|
79
|
+
return isFunction(dateFormat) ? dateFormat(String(originalDate)) : formatDate(originalDate, dateFormat, !dateUTC);
|
|
76
80
|
}
|
|
77
81
|
const getCaptureText = (post, count = 300) => {
|
|
78
82
|
const { content = "" } = matter(post.src || "", {});
|