@wot-ui/vitepress-theme 2.0.0-alpha.18 → 2.0.0-alpha.20
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/config.js +1 -0
- package/dist/theme/components/VPDoc.vue +18 -4
- package/dist/types.d.ts +12 -0
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -120,6 +120,7 @@ function createWotVitePressConfig(options) {
|
|
|
120
120
|
head: options.head,
|
|
121
121
|
locales: options.locales,
|
|
122
122
|
themeConfig: options.themeConfig,
|
|
123
|
+
lang: options.lang,
|
|
123
124
|
vite: {
|
|
124
125
|
...userVite,
|
|
125
126
|
plugins: [...internalPlugins, ...normalizePlugins(userVite.plugins)],
|
|
@@ -16,10 +16,24 @@ const themeOptions = inject(wotThemeOptionsKey)
|
|
|
16
16
|
const demoIframeOptions = themeOptions?.demoIframe
|
|
17
17
|
|
|
18
18
|
const pageName = computed(() => route.path.replace(/[./]+/g, '_').replace(/_html$/, ''))
|
|
19
|
-
const isComponent = computed(
|
|
20
|
-
()
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
const isComponent = computed(() => {
|
|
20
|
+
if (demoIframeOptions === false) return false
|
|
21
|
+
|
|
22
|
+
const { routePatterns, excludePatterns } = demoIframeOptions || {}
|
|
23
|
+
|
|
24
|
+
// 检查是否在排除列表中
|
|
25
|
+
if (excludePatterns && excludePatterns.some((pattern) => route.path.includes(pattern))) {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// 如果有自定义路由模式,使用自定义模式
|
|
30
|
+
if (routePatterns && routePatterns.length) {
|
|
31
|
+
return routePatterns.some((pattern) => route.path.includes(pattern))
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// 默认逻辑(保持向后兼容)
|
|
35
|
+
return (route.path.startsWith('/component') || route.path.startsWith('/en-US/component')) && !route.path.includes('/use-')
|
|
36
|
+
})
|
|
23
37
|
const expanded = ref(true)
|
|
24
38
|
</script>
|
|
25
39
|
|
package/dist/types.d.ts
CHANGED
|
@@ -79,6 +79,14 @@ export interface WotThemeDemoIframeOptions {
|
|
|
79
79
|
* 是否启用二维码。
|
|
80
80
|
*/
|
|
81
81
|
enabled?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* 自定义需要显示 iframe 的路由模式。
|
|
84
|
+
*/
|
|
85
|
+
routePatterns?: string[];
|
|
86
|
+
/**
|
|
87
|
+
* 自定义需要排除的路由模式。
|
|
88
|
+
*/
|
|
89
|
+
excludePatterns?: string[];
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
84
92
|
* 主题运行时可选能力配置。
|
|
@@ -215,6 +223,10 @@ export interface WotVitePressConfigOptions {
|
|
|
215
223
|
* 站点标题。
|
|
216
224
|
*/
|
|
217
225
|
title: string;
|
|
226
|
+
/**
|
|
227
|
+
* 站点默认语言。
|
|
228
|
+
*/
|
|
229
|
+
lang?: string;
|
|
218
230
|
/**
|
|
219
231
|
* 站点描述。
|
|
220
232
|
*/
|