@wot-ui/vitepress-theme 2.0.0-alpha.16 → 2.0.0-alpha.18
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/theme/components/VPDoc.vue +1 -1
- package/dist/theme/components/WwAds.vue +1 -1
- package/dist/theme/composables/adsData.js +9 -5
- package/dist/theme/composables/banner.js +9 -5
- package/dist/theme/composables/cases.js +27 -25
- package/dist/theme/composables/friendly.js +9 -5
- package/dist/theme/composables/specialSponsor.js +9 -5
- package/dist/theme/composables/sponsor.js +8 -5
- package/dist/theme/composables/team.js +9 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Theme } from 'vitepress';
|
|
2
2
|
import 'element-plus/dist/index.css';
|
|
3
3
|
import 'element-plus/theme-chalk/dark/css-vars.css';
|
|
4
|
-
import type { WotVitePressThemeOptions } from './types
|
|
4
|
+
import type { WotVitePressThemeOptions } from './types';
|
|
5
5
|
import './theme/styles/vars.css';
|
|
6
6
|
import './theme/styles/custom.css';
|
|
7
7
|
declare global {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import DefaultTheme
|
|
1
|
+
import DefaultTheme from "vitepress/theme";
|
|
2
2
|
import ElementPlus from "element-plus";
|
|
3
3
|
import "element-plus/dist/index.css";
|
|
4
4
|
import "element-plus/theme-chalk/dark/css-vars.css";
|
|
@@ -27,7 +27,6 @@ function enhanceAppWithOptions(ctx, options) {
|
|
|
27
27
|
const { app, router } = ctx;
|
|
28
28
|
app.component("SvgImage", SvgImage);
|
|
29
29
|
app.component("ExternalLink", ExternalLink);
|
|
30
|
-
app.component("Badge", VPBadge);
|
|
31
30
|
app.use(ElementPlus);
|
|
32
31
|
app.provide(wotThemeOptionsKey, options);
|
|
33
32
|
if (!options.analytics.trackBaiduRoute || typeof window === "undefined") {
|
|
@@ -6,7 +6,7 @@ import VPDocFooter from 'vitepress/dist/client/theme-default/components/VPDocFoo
|
|
|
6
6
|
import { useData } from 'vitepress'
|
|
7
7
|
import { useLayout } from 'vitepress/theme'
|
|
8
8
|
import VPIframe from './VPIframe.vue'
|
|
9
|
-
import { wotThemeOptionsKey } from '../options
|
|
9
|
+
import { wotThemeOptionsKey } from '../options'
|
|
10
10
|
|
|
11
11
|
const { theme }: any = useData()
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<script setup lang="ts">
|
|
3
3
|
import { onMounted, ref, inject } from 'vue'
|
|
4
4
|
import AsideSponsors from './AsideSponsors.vue'
|
|
5
|
-
import { wotThemeOptionsKey } from '../options
|
|
5
|
+
import { wotThemeOptionsKey } from '../options'
|
|
6
6
|
|
|
7
7
|
const showTemp = ref(false)
|
|
8
8
|
const options = inject(wotThemeOptionsKey)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useAds() {
|
|
@@ -13,11 +12,16 @@ function useAds() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.ads ? result.ads : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useBanner() {
|
|
@@ -13,11 +12,16 @@ function useBanner() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.data ? result.data : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useCaseData() {
|
|
@@ -10,34 +9,37 @@ function useCaseData() {
|
|
|
10
9
|
return;
|
|
11
10
|
}
|
|
12
11
|
const urls = casesOptions.urls || [];
|
|
12
|
+
const getFullImageUrl = (image, baseUrl) => {
|
|
13
|
+
if (!image)
|
|
14
|
+
return "";
|
|
15
|
+
if (image.startsWith("http://") || image.startsWith("https://")) {
|
|
16
|
+
return image;
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const { origin } = new URL(baseUrl);
|
|
20
|
+
return origin + image;
|
|
21
|
+
} catch {
|
|
22
|
+
return baseUrl + image;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
13
25
|
const fetchData = async () => {
|
|
14
26
|
for (const url of urls) {
|
|
15
27
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const data2 = response.data && response.data.data ? response.data.data : [];
|
|
21
|
-
const getFullImageUrl = (image, baseUrl) => {
|
|
22
|
-
if (!image)
|
|
23
|
-
return "";
|
|
24
|
-
if (image.startsWith("http://") || image.startsWith("https://")) {
|
|
25
|
-
return image;
|
|
26
|
-
}
|
|
27
|
-
try {
|
|
28
|
-
const { origin } = new URL(baseUrl);
|
|
29
|
-
return origin + image;
|
|
30
|
-
} catch {
|
|
31
|
-
return baseUrl + image;
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
return data2.map((item) => {
|
|
35
|
-
return {
|
|
36
|
-
name: item.name,
|
|
37
|
-
image: getFullImageUrl(item.image, url),
|
|
38
|
-
description: item.description
|
|
39
|
-
};
|
|
28
|
+
const controller = new AbortController();
|
|
29
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
30
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
31
|
+
signal: controller.signal
|
|
40
32
|
});
|
|
33
|
+
clearTimeout(timeoutId);
|
|
34
|
+
if (!response.ok)
|
|
35
|
+
continue;
|
|
36
|
+
const result = await response.json();
|
|
37
|
+
const caseData = result && result.data ? result.data : [];
|
|
38
|
+
return caseData.map((item) => ({
|
|
39
|
+
name: item.name,
|
|
40
|
+
image: getFullImageUrl(item.image, url),
|
|
41
|
+
description: item.description
|
|
42
|
+
}));
|
|
41
43
|
} catch (error) {
|
|
42
44
|
console.warn(`Failed to fetch from ${url}`);
|
|
43
45
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useFriendly() {
|
|
@@ -13,11 +12,16 @@ function useFriendly() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result && result.links ? result.links : [];
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useSpecialSponsor() {
|
|
@@ -13,11 +12,16 @@ function useSpecialSponsor() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
const result = await response.json();
|
|
24
|
+
return result?.data;
|
|
21
25
|
} catch (error) {
|
|
22
26
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
27
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref();
|
|
5
4
|
function useSponsor() {
|
|
@@ -13,11 +12,15 @@ function useSponsor() {
|
|
|
13
12
|
const fetchData = async () => {
|
|
14
13
|
for (const url of urls) {
|
|
15
14
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const controller = new AbortController();
|
|
16
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
17
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
18
|
+
signal: controller.signal
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
clearTimeout(timeoutId);
|
|
21
|
+
if (!response.ok)
|
|
22
|
+
continue;
|
|
23
|
+
return await response.json();
|
|
21
24
|
} catch (error) {
|
|
22
25
|
console.warn(`Failed to fetch from ${url}`);
|
|
23
26
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ref, onMounted, inject } from "vue";
|
|
2
|
-
import axios from "axios";
|
|
3
2
|
import { wotThemeOptionsKey } from "../options.js";
|
|
4
3
|
const data = ref([]);
|
|
5
4
|
function useTeam() {
|
|
@@ -28,10 +27,16 @@ function useTeam() {
|
|
|
28
27
|
const fetchData = async () => {
|
|
29
28
|
for (const url of urls) {
|
|
30
29
|
try {
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
const controller = new AbortController();
|
|
31
|
+
const timeoutId = setTimeout(() => controller.abort(), 5e3);
|
|
32
|
+
const response = await fetch(url + "?t=" + Date.now(), {
|
|
33
|
+
signal: controller.signal
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
if (!response.ok)
|
|
37
|
+
continue;
|
|
38
|
+
const result = await response.json();
|
|
39
|
+
const members = result && result.members ? result.members : [];
|
|
35
40
|
return normalizeMembers(members);
|
|
36
41
|
} catch (error) {
|
|
37
42
|
console.warn(`Failed to fetch team from ${url}`);
|