vitepress-theme-teek 1.6.0 → 1.6.1

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.
Files changed (32) hide show
  1. package/es/components/common/message/src/index.vue.d.ts +3 -3
  2. package/es/components/theme/article-analyze/src/index.vue2.mjs +1 -1
  3. package/es/components/theme/article-info/src/index.vue2.mjs +3 -1
  4. package/es/components/theme/right-bottom-button/src/index.vue2.mjs +2 -3
  5. package/es/components/theme/right-bottom-button/src/theme-color.vue2.mjs +4 -3
  6. package/es/components/theme/theme-enhance/src/index.vue.d.ts +2 -0
  7. package/es/components/theme/theme-enhance/src/index.vue2.mjs +65 -20
  8. package/es/config/post/index.d.ts +4 -2
  9. package/es/config/post/index.mjs +6 -4
  10. package/es/index.css +1 -1
  11. package/es/version.d.ts +1 -1
  12. package/es/version.mjs +1 -1
  13. package/index.css +1 -1
  14. package/index.js +75 -28
  15. package/index.min.js +30 -30
  16. package/index.min.mjs +32 -32
  17. package/index.mjs +75 -28
  18. package/lib/components/common/message/src/index.vue.d.ts +3 -3
  19. package/lib/components/theme/article-analyze/src/index.vue2.js +1 -1
  20. package/lib/components/theme/article-info/src/index.vue2.js +3 -1
  21. package/lib/components/theme/right-bottom-button/src/index.vue2.js +2 -3
  22. package/lib/components/theme/right-bottom-button/src/theme-color.vue2.js +3 -2
  23. package/lib/components/theme/theme-enhance/src/index.vue.d.ts +2 -0
  24. package/lib/components/theme/theme-enhance/src/index.vue2.js +64 -19
  25. package/lib/config/post/index.d.ts +4 -2
  26. package/lib/config/post/index.js +5 -3
  27. package/lib/index.css +1 -1
  28. package/lib/version.d.ts +1 -1
  29. package/lib/version.js +1 -1
  30. package/package.json +1 -1
  31. package/theme-chalk/index.css +1 -1
  32. package/theme-chalk/src/components/common/title-tag.scss +6 -2
@@ -21,16 +21,16 @@ declare const __VLS_component: DefineComponent<MessageProps, {
21
21
  }, string, PublicProps, Readonly<MessageProps> & Readonly<{
22
22
  onDestroy?: (() => any) | undefined;
23
23
  }>, {
24
- icon: string | Object | Component | IconifyIcon;
25
- zIndex: number;
26
24
  center: boolean;
27
25
  id: string;
28
26
  type: MessageType;
29
27
  offset: number;
28
+ icon: string | Object | Component | IconifyIcon;
30
29
  onClose: () => void;
31
- duration: number;
30
+ zIndex: number;
32
31
  customClass: string;
33
32
  dangerouslyUseHTMLString: boolean;
33
+ duration: number;
34
34
  message: string | VNode | (() => VNode);
35
35
  showClose: boolean;
36
36
  plain: boolean;
@@ -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
- nextTick(request);
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((item) => [item.url, item.frontmatter.permalink].includes(route.path))?.date;
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
- const isDisabled = themeColor.disabled ?? themeColor.disabledInMobile;
45
- if (!enabled) return true;
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, unref, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, normalizeStyle, createVNode } from 'vue';
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
  });
@@ -3,6 +3,8 @@ declare function __VLS_template(): {
3
3
  attrs: Partial<{}>;
4
4
  slots: {
5
5
  'teek-theme-enhance-top'?(_: {}): any;
6
+ 'teek-theme-enhance-top'?(_: {}): any;
7
+ 'teek-theme-enhance-bottom'?(_: {}): any;
6
8
  'teek-theme-enhance-bottom'?(_: {}): any;
7
9
  };
8
10
  refs: {};
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, unref, openBlock, createBlock, normalizeClass, withCtx, createElementVNode, renderSlot, createElementBlock, Fragment, createVNode, createCommentVNode } from 'vue';
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 !unref(isMobile) && unref(themeEnhanceConfig).position === "top" ? (openBlock(), createBlock(unref(_sfc_main$1), {
36
- key: 0,
37
- class: normalizeClass([unref(ns).b(), "flx-align-center"]),
38
- "popper-class": unref(ns).e("popover"),
39
- "y-offset": -15
40
- }, {
41
- reference: withCtx(() => [
42
- createVNode(unref(_sfc_main$8), {
43
- icon: unref(readingIcon),
44
- size: 20
45
- }, null, 8, ["icon"])
46
- ]),
47
- default: withCtx(() => [
48
- createElementVNode(
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
- _: 3
84
- /* FORWARDED */
85
- }, 8, ["class", "popper-class"])) : createCommentVNode("v-if", true);
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, articleAnalyze: ArticleAnalyze): any;
25
27
  /**
26
28
  * 截取 markdown 文件前 count 数的内容
27
29
  *
@@ -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
 
@@ -16,7 +16,7 @@ const transformData = (data) => {
16
16
  frontmatter,
17
17
  author: frontmatter.author || themeConfig.author,
18
18
  title: getTitle(data),
19
- date: getDate(data, siteConfig.srcDir),
19
+ date: getDate(data, siteConfig.srcDir, themeConfig.articleAnalyze),
20
20
  excerpt,
21
21
  capture: getCaptureText(data)
22
22
  };
@@ -64,7 +64,7 @@ function getTitle(post) {
64
64
  const name = splitName.length > 1 ? splitName[1] : splitName[0];
65
65
  return getTitleFromMarkdown(content) || name || "";
66
66
  }
67
- function getDate(post, srcDir) {
67
+ function getDate(post, srcDir, articleAnalyze) {
68
68
  const { frontmatter, relativePath } = post;
69
69
  if (frontmatter.date) return frontmatter.date;
70
70
  const filePath = join(
@@ -72,7 +72,9 @@ function getDate(post, srcDir) {
72
72
  `${relativePath.endsWith("/") ? `${relativePath}/index` : relativePath.replace(/\.html$/, "")}.md`
73
73
  );
74
74
  const stat = statSync(filePath);
75
- return formatDate(stat.birthtime || stat.atime, "yyyy-MM-dd hh:mm:ss", true);
75
+ const originalDate = stat.birthtime || stat.atime;
76
+ if (isFunction(articleAnalyze.dateFormat)) return articleAnalyze.dateFormat(String(originalDate));
77
+ return formatDate(String(originalDate), articleAnalyze.dateFormat, !(articleAnalyze.dateUTC ?? true));
76
78
  }
77
79
  const getCaptureText = (post, count = 300) => {
78
80
  const { content = "" } = matter(post.src || "", {});