vitepress-theme-teek 1.5.6 → 1.5.7

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 (33) hide show
  1. package/es/components/common/ImageViewer/src/ImageViewer.vue2.mjs +1 -0
  2. package/es/components/common/ImageViewer/src/imageViewer.d.ts +7 -0
  3. package/es/components/theme/ArticleOverviewPage/src/index.vue2.mjs +1 -1
  4. package/es/components/theme/ConfigProvider/index.mjs +14 -6
  5. package/es/components/theme/HomeFriendLinkCard/src/ItemInfo.vue.d.ts +3 -1
  6. package/es/components/theme/HomeFriendLinkCard/src/ItemInfo.vue2.mjs +19 -3
  7. package/es/components/theme/HomeFriendLinkCard/src/index.vue2.mjs +1 -1
  8. package/es/components/theme/Layout/src/index.vue2.mjs +7 -6
  9. package/es/config/types.d.ts +1 -1
  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 +44 -18
  15. package/index.min.js +21 -21
  16. package/index.min.mjs +39 -39
  17. package/index.mjs +45 -19
  18. package/lib/components/common/ImageViewer/src/ImageViewer.vue2.js +1 -0
  19. package/lib/components/common/ImageViewer/src/imageViewer.d.ts +7 -0
  20. package/lib/components/theme/ArticleOverviewPage/src/index.vue2.js +1 -1
  21. package/lib/components/theme/ConfigProvider/index.js +14 -6
  22. package/lib/components/theme/HomeFriendLinkCard/src/ItemInfo.vue.d.ts +3 -1
  23. package/lib/components/theme/HomeFriendLinkCard/src/ItemInfo.vue2.js +18 -2
  24. package/lib/components/theme/HomeFriendLinkCard/src/index.vue2.js +1 -1
  25. package/lib/components/theme/Layout/src/index.vue2.js +7 -6
  26. package/lib/config/types.d.ts +1 -1
  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 +6 -6
  31. package/theme-chalk/index.css +1 -1
  32. package/theme-chalk/src/components/theme/body-bg-image.scss +4 -1
  33. package/theme-chalk/tk-body-bg-image.css +1 -1
@@ -24,6 +24,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
24
24
  ...{ name: "ImageViewer" },
25
25
  __name: "ImageViewer",
26
26
  props: {
27
+ enabled: { type: Boolean },
27
28
  urlList: { default: () => [] },
28
29
  zIndex: {},
29
30
  initialIndex: { default: 0 },
@@ -1,5 +1,12 @@
1
1
  export type ImageViewerAction = "zoomIn" | "zoomOut" | "clockwise" | "anticlockwise";
2
2
  export interface ImageViewerProps {
3
+ /**
4
+ * 是否启用图片查看器
5
+ *
6
+ * @default true
7
+ * @since v1.5.7
8
+ */
9
+ enabled?: boolean;
3
10
  /**
4
11
  * 用于预览的图片链接列表
5
12
  *
@@ -33,7 +33,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
33
33
  const categoriesPageLink = computed(() => {
34
34
  const localeIndexConst = localeIndex.value;
35
35
  const localeName = localeIndexConst !== "root" ? `/${localeIndexConst}` : "";
36
- return `${localeName}${categoryConfig.value.path}${site.value.cleanUrls ? "" : ".html"}`;
36
+ return withBase(`${localeName}${categoryConfig.value.path}${site.value.cleanUrls ? "" : ".html"}`);
37
37
  });
38
38
  const getFileWords = (url) => {
39
39
  return eachFileWords.value.filter((item) => {
@@ -56,11 +56,19 @@ const usePageState = () => {
56
56
  );
57
57
  const isCategoriesPage = computed(() => !!frontmatter.value.categoriesPage);
58
58
  const isTagsPage = computed(() => !!frontmatter.value.tagsPage);
59
- const isArchivesPage = computed(() => !!frontmatter.value.archivesPage);
60
- const isCataloguePage = computed(() => !!frontmatter.value.catalogue);
61
- const isArticleOverviewPage = computed(() => !!frontmatter.value.articleOverviewPage);
62
- const isLoginUrl = computed(() => !!frontmatter.value.loginPage);
63
- const isRiskLinkPage = computed(() => !!frontmatter.value.riskLinkPage);
59
+ const isArchivesPage = computed(
60
+ () => !!frontmatter.value.archivesPage || frontmatter.value.layout === "TkArchivesPage"
61
+ );
62
+ const isCataloguePage = computed(
63
+ () => !!frontmatter.value.catalogue || frontmatter.value.layout === "TkCataloguePage"
64
+ );
65
+ const isArticleOverviewPage = computed(
66
+ () => !!frontmatter.value.articleOverviewPage || frontmatter.value.layout === "TkArticleOverviewPage"
67
+ );
68
+ const isLoginUrl = computed(() => !!frontmatter.value.loginPage || frontmatter.value.layout === "TkLoginPage");
69
+ const isRiskLinkPage = computed(
70
+ () => !!frontmatter.value.riskLinkPage || frontmatter.value.layout === "TkRiskLinkPage"
71
+ );
64
72
  return {
65
73
  isHomePage,
66
74
  isCategoriesPage,
@@ -99,7 +107,7 @@ const usePagePath = () => {
99
107
  url
100
108
  } = item;
101
109
  const isPageLayout = layout === "page";
102
- if (layout === "TkCataloguePage" || isPageLayout && archivesPage === true) archivesUrl = url;
110
+ if (layout === "TkArchivesPage" || isPageLayout && archivesPage === true) archivesUrl = url;
103
111
  if (layout === "TkArticleOverviewPage" || isPageLayout && articleOverviewPage === true) {
104
112
  articleOverviewUrl = url;
105
113
  }
@@ -5,5 +5,7 @@ type __VLS_Props = {
5
5
  item: FriendLinkItem;
6
6
  ns: UseNamespaceReturn;
7
7
  };
8
- declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLAnchorElement>;
8
+ declare const _default: DefineComponent<__VLS_Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
9
+ imgInstance: HTMLImageElement;
10
+ }, HTMLAnchorElement>;
9
11
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineComponent, openBlock, createElementBlock, unref, createElementVNode, normalizeClass, toDisplayString } from 'vue';
1
+ import { defineComponent, useTemplateRef, onMounted, openBlock, createElementBlock, unref, createElementVNode, normalizeClass, toDisplayString } from 'vue';
2
2
  import { withBase } from 'vitepress';
3
3
 
4
4
  const _hoisted_1 = ["href", "aria-label"];
@@ -13,6 +13,20 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
13
13
  ns: {}
14
14
  },
15
15
  setup(__props) {
16
+ const imgInstance = useTemplateRef("imgInstance");
17
+ const addLoadedClass = (e) => {
18
+ if (e?.target) e.target.classList.add("loaded");
19
+ else if (imgInstance.value) imgInstance.value.classList.add("loaded");
20
+ };
21
+ onMounted(() => {
22
+ const img = imgInstance.value;
23
+ if (!img) return;
24
+ if (img.complete) addLoadedClass();
25
+ else {
26
+ img.addEventListener("load", () => addLoadedClass());
27
+ img.addEventListener("error", () => addLoadedClass());
28
+ }
29
+ });
16
30
  return (_ctx, _cache) => {
17
31
  return openBlock(), createElementBlock("a", {
18
32
  href: __props.item.link && unref(withBase)(__props.item.link),
@@ -22,12 +36,14 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
22
36
  }, [
23
37
  createElementVNode("div", _hoisted_2, [
24
38
  createElementVNode("img", {
39
+ ref_key: "imgInstance",
40
+ ref: imgInstance,
25
41
  src: __props.item.avatar && unref(withBase)(__props.item.avatar),
26
42
  class: "avatar",
27
43
  alt: __props.item.alt || __props.item.name,
28
44
  "aria-hidden": "true",
29
- onLoad: _cache[0] || (_cache[0] = (e) => e.target?.classList.add("loaded")),
30
- onError: _cache[1] || (_cache[1] = (e) => e.target?.classList.add("loaded"))
45
+ onLoad: addLoadedClass,
46
+ onError: addLoadedClass
31
47
  }, null, 40, _hoisted_3)
32
48
  ]),
33
49
  createElementVNode(
@@ -68,7 +68,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
68
68
  pageSize: unref(friendLinkConfig).limit,
69
69
  total: unref(friendLinkConfig).list.length,
70
70
  title: finalTitle.value,
71
- titleClick: unref(friendLinkConfig).titleClick ? handleTitleClick : void 0,
71
+ titleClick: unref(friendLinkConfig).titleClick !== void 0 ? handleTitleClick : void 0,
72
72
  autoPage: unref(friendLinkConfig).autoPage,
73
73
  pageSpeed: unref(friendLinkConfig).pageSpeed,
74
74
  class: normalizeClass(unref(ns).b()),
@@ -80,9 +80,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
80
80
  riskLink: { enabled: false },
81
81
  themeEnhance: { enabled: true },
82
82
  articleBanner: { enabled: false },
83
- pageStyle: "default"
83
+ pageStyle: "default",
84
+ articleAnalyze: {}
84
85
  });
85
- const loading = ref(teekConfig.value.loading);
86
+ const loading = ref(!!teekConfig.value.loading);
86
87
  const commentConfig = computed(() => {
87
88
  const frontmatterComment = frontmatter.value.comment;
88
89
  const configComment = teekConfig.value.comment;
@@ -369,17 +370,17 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
369
370
  64
370
371
  /* STABLE_FRAGMENT */
371
372
  )) : createCommentVNode("v-if", true),
372
- createVNode(unref(_sfc_main$m)),
373
+ unref(teekConfig).articleAnalyze.imageViewer?.enabled ?? true ? (openBlock(), createBlock(unref(_sfc_main$m), { key: 1 })) : createCommentVNode("v-if", true),
373
374
  createVNode(unref(_sfc_main$n)),
374
- unref(teekConfig).codeBlock.enabled ?? true ? (openBlock(), createBlock(unref(_sfc_main$o), { key: 1 })) : createCommentVNode("v-if", true),
375
+ unref(teekConfig).codeBlock.enabled ?? true ? (openBlock(), createBlock(unref(_sfc_main$o), { key: 2 })) : createCommentVNode("v-if", true),
375
376
  topTipConfig.value ? (openBlock(), createBlock(
376
377
  unref(_sfc_main$k),
377
- normalizeProps(mergeProps({ key: 2 }, unref(isBoolean)(topTipConfig.value) ? {} : topTipConfig.value)),
378
+ normalizeProps(mergeProps({ key: 3 }, unref(isBoolean)(topTipConfig.value) ? {} : topTipConfig.value)),
378
379
  null,
379
380
  16
380
381
  /* FULL_PROPS */
381
382
  )) : createCommentVNode("v-if", true),
382
- unref(teekConfig).sidebarTrigger ? (openBlock(), createBlock(unref(_sfc_main$p), { key: 3 }, {
383
+ unref(teekConfig).sidebarTrigger ? (openBlock(), createBlock(unref(_sfc_main$p), { key: 4 }, {
383
384
  default: withCtx((scope) => [
384
385
  renderSlot(_ctx.$slots, "teek-sidebar-trigger", normalizeProps(guardReactiveProps(scope)))
385
386
  ]),
@@ -71,7 +71,7 @@ export interface TeekConfig {
71
71
  /**
72
72
  * 页面加载 Loading 动画,如果为 boolean,则控制是否启用,如果为字符串,则指定加载 Loading 动画的文案
73
73
  *
74
- * @default true
74
+ * @default false
75
75
  */
76
76
  loading?: boolean | string;
77
77
  /**