@wot-ui/vitepress-theme 2.0.0-alpha.19 → 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.
@@ -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
- (route.path.startsWith('/component') || route.path.startsWith('/en-US/component')) && !route.path.includes('/use-') && demoIframeOptions !== false
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
  * 主题运行时可选能力配置。
@@ -218,7 +226,7 @@ export interface WotVitePressConfigOptions {
218
226
  /**
219
227
  * 站点默认语言。
220
228
  */
221
- lang: string;
229
+ lang?: string;
222
230
  /**
223
231
  * 站点描述。
224
232
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wot-ui/vitepress-theme",
3
- "version": "2.0.0-alpha.19",
3
+ "version": "2.0.0-alpha.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"