vitepress-theme-teek 1.4.1 → 1.4.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.
@@ -471,7 +471,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
471
471
  key: url,
472
472
  src: url,
473
473
  style: normalizeStyle(imgStyle.value),
474
- class: normalizeClass(unref(ns).e("img")),
474
+ class: normalizeClass([unref(ns).e("img"), "image-viewer__img"]),
475
475
  crossorigin: _ctx.crossorigin,
476
476
  onLoad: handleImgLoad,
477
477
  onError: handleImgError,
@@ -1,16 +1,13 @@
1
+ export { createImageViewer } from './ImageViewer/index.mjs';
1
2
  export { default as TkArticlePage } from './ArticlePage/src/index.vue2.mjs';
2
3
  export { default as TkDocAsideOutline } from './ArticlePage/src/components/DocAsideOutline.vue2.mjs';
3
4
  export { default as TkAvatar } from './Avatar/src/index.vue2.mjs';
4
5
  export { default as TkBreadcrumb } from './Breadcrumb/src/Breadcrumb.vue2.mjs';
5
6
  export { default as TkBreadcrumbItem } from './Breadcrumb/src/BreadcrumbItem.vue2.mjs';
6
- export { default as TkFocusTrap } from './FocusTrap/src/index.vue.mjs';
7
7
  export { default as TkIcon } from './Icon/src/index.vue2.mjs';
8
- export { WhatsApp, bilibili, email, gitee, github, moblieQQ, music, telegram } from './Icon/src/SocialIcons.mjs';
9
- export { addCollection as addIcons } from '@iconify/vue';
10
- export { createImageViewer } from './ImageViewer/index.mjs';
8
+ export { default as TkImageViewer } from './ImageViewer/src/index.vue2.mjs';
11
9
  export { default as TkInputSlide } from './InputSlide/src/index.vue2.mjs';
12
10
  export { default as TkMessage } from './Message/src/method.mjs';
13
- export { getInstance, getLastOffset, getOffsetOrSpace, instances } from './Message/src/instance.mjs';
14
11
  export { default as TkPagination } from './Pagination/src/index.vue2.mjs';
15
12
  export { default as TkPopover } from './Popover/src/index.vue2.mjs';
16
13
  export { default as TkSegmented } from './Segmented/src/Segmented.vue2.mjs';
@@ -19,4 +16,7 @@ export { default as TkTitleTag } from './TitleTag/src/index.vue2.mjs';
19
16
  export { default as TkTransitionCollapse } from './TransitionCollapse/src/index.vue2.mjs';
20
17
  export { default as TkVerifyCode } from './VerifyCode/src/index.vue2.mjs';
21
18
  export { default as TkVpContainer } from './VpContainer/src/index.vue2.mjs';
22
- export { default as TkImageViewer } from './ImageViewer/src/index.vue2.mjs';
19
+ export { default as TkFocusTrap } from './FocusTrap/src/index.vue.mjs';
20
+ export { addCollection as addIcons } from '@iconify/vue';
21
+ export { WhatsApp, bilibili, email, gitee, github, moblieQQ, music, telegram } from './Icon/src/SocialIcons.mjs';
22
+ export { getInstance, getLastOffset, getOffsetOrSpace, instances } from './Message/src/instance.mjs';
@@ -15,7 +15,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
15
15
  });
16
16
  const previewImage = (e) => {
17
17
  const target = e.target;
18
- if (target.tagName.toLowerCase() === "img" && !target.className.includes("no-preview")) {
18
+ if (target.tagName.toLowerCase() === "img" && !target.className.includes("image-viewer__img") && // 处于预览状态,点击/拖拽图片时,不重新触发预览
19
+ !target.className.includes("no-preview")) {
19
20
  const imgDoms = target.querySelectorAll(".content-container .main img");
20
21
  const imgs = Array.from(imgDoms);
21
22
  const urlList = imgs.map((el) => el.src);
package/es/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { EnhanceAppContext } from 'vitepress';
1
2
  import { default as DefaultTheme } from 'vitepress/theme';
2
3
  export type DefaultThemeType = typeof DefaultTheme;
3
4
  export type * from './config';
@@ -8,7 +9,8 @@ export * from './composables';
8
9
  export * from './locale';
9
10
  export * from './markdown/helper';
10
11
  export * from './version';
11
- declare const _default: DefaultThemeType & {
12
+ declare const _default: Omit<DefaultThemeType, "enhanceApp"> & {
12
13
  extends: DefaultThemeType;
14
+ enhanceApp: (options: EnhanceAppContext) => Promise<void>;
13
15
  };
14
16
  export default _default;
package/es/index.mjs CHANGED
@@ -188,7 +188,7 @@ export { useThemeColorList } from './components/theme/ThemeEnhance/src/useThemeC
188
188
  var index = {
189
189
  extends: DefaultTheme,
190
190
  Layout: TeekConfigProvider(_sfc_main$8),
191
- enhanceApp({ app, siteData, router }) {
191
+ async enhanceApp({ app, siteData, router }) {
192
192
  app.component("TkCataloguePage", _sfc_main);
193
193
  app.component("TkArchivesPage", _sfc_main$1);
194
194
  app.component("TkArticleOverviewPage", _sfc_main$2);
@@ -200,7 +200,7 @@ var index = {
200
200
  if (!isClient) return;
201
201
  const { themeConfig } = siteData.value;
202
202
  processSiteAnalytics(themeConfig);
203
- processPermalinkNotFoundWhenFirstLoaded({ siteData, router });
203
+ await processPermalinkNotFoundWhenFirstLoaded({ siteData, router });
204
204
  }
205
205
  };
206
206
  const processSiteAnalytics = (themeConfig) => {
@@ -217,15 +217,16 @@ const processSiteAnalytics = (themeConfig) => {
217
217
  siteAnalysis[item.provider]?.(item.options);
218
218
  });
219
219
  };
220
- const processPermalinkNotFoundWhenFirstLoaded = ({ siteData, router }) => {
220
+ const processPermalinkNotFoundWhenFirstLoaded = async ({ siteData, router }) => {
221
221
  const { base, cleanUrls, themeConfig } = siteData.value;
222
- if (router.route.path !== base && router.route.data.isNotFound) {
223
- const decodePath = "/" + decodeURIComponent(location.href.slice(base.length)).replace(/\/$/, "").replace(/\.html/, "");
222
+ if (router.route.path === base && router.route.data.isNotFound) {
223
+ const { pathname, search, hash } = new URL(location.href);
224
+ const decodePath = "/" + decodeURIComponent(pathname.slice(base.length)).replace(/\/$/, "").replace(/\.html/, "");
224
225
  const link = cleanUrls ? decodePath : decodePath + ".html";
225
226
  const filePath = themeConfig.permalinks.inv[link];
226
227
  if (filePath) {
227
- router.go(filePath);
228
- return false;
228
+ const targetUrl = base + filePath + search + hash;
229
+ await router.go(targetUrl);
229
230
  }
230
231
  }
231
232
  };
package/es/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const version = "1.4.1";
1
+ export declare const version = "1.4.2";
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "1.4.1";
1
+ const version = "1.4.2";
2
2
 
3
3
  export { version };
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! vitepress-theme-teek v1.4.1 */
1
+ /*! vitepress-theme-teek v1.4.2 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vitepress/theme'), require('vue'), require('vitepress'), require('@iconify/vue')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vitepress/theme', 'vue', 'vitepress', '@iconify/vue'], factory) :
@@ -4489,7 +4489,7 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`
4489
4489
  key: url,
4490
4490
  src: url,
4491
4491
  style: Vue.normalizeStyle(imgStyle.value),
4492
- class: Vue.normalizeClass(Vue.unref(ns).e("img")),
4492
+ class: Vue.normalizeClass([Vue.unref(ns).e("img"), "image-viewer__img"]),
4493
4493
  crossorigin: _ctx.crossorigin,
4494
4494
  onLoad: handleImgLoad,
4495
4495
  onError: handleImgError,
@@ -13281,7 +13281,8 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
13281
13281
  });
13282
13282
  const previewImage = (e) => {
13283
13283
  const target = e.target;
13284
- if (target.tagName.toLowerCase() === "img" && !target.className.includes("no-preview")) {
13284
+ if (target.tagName.toLowerCase() === "img" && !target.className.includes("image-viewer__img") && // 处于预览状态,点击/拖拽图片时,不重新触发预览
13285
+ !target.className.includes("no-preview")) {
13285
13286
  const imgDoms = target.querySelectorAll(".content-container .main img");
13286
13287
  const imgs = Array.from(imgDoms);
13287
13288
  const urlList = imgs.map((el) => el.src);
@@ -25023,12 +25024,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
25023
25024
  };
25024
25025
  };
25025
25026
 
25026
- const version = "1.4.1";
25027
+ const version = "1.4.2";
25027
25028
 
25028
25029
  var index = {
25029
25030
  extends: DefaultTheme,
25030
25031
  Layout: TeekConfigProvider(_sfc_main),
25031
- enhanceApp({ app, siteData, router }) {
25032
+ async enhanceApp({ app, siteData, router }) {
25032
25033
  app.component("TkCataloguePage", _sfc_main$S);
25033
25034
  app.component("TkArchivesPage", _sfc_main$15);
25034
25035
  app.component("TkArticleOverviewPage", _sfc_main$Y);
@@ -25040,7 +25041,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
25040
25041
  if (!isClient) return;
25041
25042
  const { themeConfig } = siteData.value;
25042
25043
  processSiteAnalytics(themeConfig);
25043
- processPermalinkNotFoundWhenFirstLoaded({ siteData, router });
25044
+ await processPermalinkNotFoundWhenFirstLoaded({ siteData, router });
25044
25045
  }
25045
25046
  };
25046
25047
  const processSiteAnalytics = (themeConfig) => {
@@ -25057,15 +25058,16 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
25057
25058
  siteAnalysis[item.provider]?.(item.options);
25058
25059
  });
25059
25060
  };
25060
- const processPermalinkNotFoundWhenFirstLoaded = ({ siteData, router }) => {
25061
+ const processPermalinkNotFoundWhenFirstLoaded = async ({ siteData, router }) => {
25061
25062
  const { base, cleanUrls, themeConfig } = siteData.value;
25062
- if (router.route.path !== base && router.route.data.isNotFound) {
25063
- const decodePath = "/" + decodeURIComponent(location.href.slice(base.length)).replace(/\/$/, "").replace(/\.html/, "");
25063
+ if (router.route.path === base && router.route.data.isNotFound) {
25064
+ const { pathname, search, hash } = new URL(location.href);
25065
+ const decodePath = "/" + decodeURIComponent(pathname.slice(base.length)).replace(/\/$/, "").replace(/\.html/, "");
25064
25066
  const link = cleanUrls ? decodePath : decodePath + ".html";
25065
25067
  const filePath = themeConfig.permalinks.inv[link];
25066
25068
  if (filePath) {
25067
- router.go(filePath);
25068
- return false;
25069
+ const targetUrl = base + filePath + search + hash;
25070
+ await router.go(targetUrl);
25069
25071
  }
25070
25072
  }
25071
25073
  };