@opentiny/vue-docs 3.26.6 → 3.26.8

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/env/.env.saas CHANGED
@@ -1,5 +1,5 @@
1
1
  # 1、声明一个变量
2
- VITE_CONTEXT=/tiny-vue/
2
+ VITE_CONTEXT=/tiny-vue-saas/
3
3
  VITE_BUILD_TARGET='open'
4
4
  VITE_TINY_THEME='saas'
5
5
  # 官网应用类型:pc / mobile / mobile-first
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opentiny/vue-docs",
3
3
  "type": "module",
4
- "version": "3.26.6",
4
+ "version": "3.26.8",
5
5
  "license": "MIT",
6
6
  "dependencies": {
7
7
  "@docsearch/css": "^3.8.0",
@@ -28,23 +28,23 @@
28
28
  "vue-router": "4.1.5",
29
29
  "zod": "^3.24.4",
30
30
  "@opentiny/utils": "~3.26.0",
31
+ "@opentiny/vue-common": "~3.26.0",
31
32
  "@opentiny/vue": "~3.26.0",
32
33
  "@opentiny/vue-design-aurora": "~3.26.0",
33
- "@opentiny/vue-common": "~3.26.0",
34
34
  "@opentiny/vue-design-saas": "~3.26.0",
35
35
  "@opentiny/vue-design-smb": "~3.26.0",
36
- "@opentiny/vue-directive": "~3.26.0",
37
36
  "@opentiny/vue-flowchart": "~3.26.0",
37
+ "@opentiny/vue-directive": "~3.26.0",
38
38
  "@opentiny/vue-hooks": "~3.26.0",
39
- "@opentiny/vue-huicharts": "~3.26.0",
40
39
  "@opentiny/vue-icon": "~3.26.0",
41
- "@opentiny/vue-icon-saas": "~3.26.0",
40
+ "@opentiny/vue-huicharts": "~3.26.0",
41
+ "@opentiny/vue-icon-multicolor": "~3.26.0",
42
42
  "@opentiny/vue-locale": "~3.26.0",
43
43
  "@opentiny/vue-modal": "~3.26.0",
44
+ "@opentiny/vue-icon-saas": "~3.26.0",
44
45
  "@opentiny/vue-renderless": "~3.26.0",
45
46
  "@opentiny/vue-theme": "~3.26.0",
46
- "@opentiny/vue-theme-saas": "~3.26.2",
47
- "@opentiny/vue-icon-multicolor": "~3.26.0"
47
+ "@opentiny/vue-theme-saas": "~3.26.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@playwright/test": "~1.49.0",
package/src/App.vue CHANGED
@@ -14,6 +14,7 @@
14
14
  import { onMounted, provide, ref } from 'vue'
15
15
  import { TinyConfigProvider, TinyModal } from '@opentiny/vue'
16
16
  import { iconClose } from '@opentiny/vue-icon'
17
+ import { isSaas } from './const'
17
18
 
18
19
  import useTheme from './tools/useTheme'
19
20
 
@@ -24,7 +25,7 @@ const tinyIconClose = iconClose()
24
25
  onMounted(() => {
25
26
  // 加载header
26
27
  const common = new window.TDCommon(['#header'], {
27
- allowDarkTheme: true,
28
+ allowDarkTheme: !isSaas,
28
29
  searchConfig: {
29
30
  show: true
30
31
  },
@@ -2,11 +2,11 @@
2
2
  <div v-if="links.length" class="cmp-page-anchor catalog">
3
3
  <tiny-anchor
4
4
  id="anchor"
5
- :tiny_mode="theme === 'saas' ? 'pc' : 'mobile-first'"
5
+ :tiny_mode="isSaas ? 'pc' : 'mobile-first'"
6
6
  :offset-top="56"
7
7
  :links="links"
8
8
  :is-affix="props.anchorAffix"
9
- :type="theme === 'saas' ? 'line' : 'dot'"
9
+ :type="isSaas ? 'line' : 'dot'"
10
10
  container-id="#doc-layout-scroller"
11
11
  @link-click="handleAnchorClick"
12
12
  >
@@ -17,13 +17,12 @@
17
17
  <script setup lang="ts">
18
18
  import { computed } from 'vue'
19
19
  import { TinyAnchor } from '@opentiny/vue'
20
+ import { isSaas } from '../const'
20
21
 
21
22
  const props = defineProps({ anchorAffix: {}, currentJson: {}, activeTab: {}, langKey: {}, apiTypes: {} })
22
23
 
23
24
  const emit = defineEmits(['link-click'])
24
25
 
25
- const theme = import.meta.env.VITE_TINY_THEME
26
-
27
26
  // 实例锚点
28
27
  const demoAnchorLinks = computed(() => {
29
28
  const links =
@@ -184,7 +184,9 @@ const getDemoCodeFn = async (demo, forceUpdate?: boolean) => {
184
184
  const demoName = apiModeFn.getDemoName(`${getWebdocPath(cmpId)}/${fileName}`)
185
185
  let code = ''
186
186
 
187
- const path = isMobileFirst.value ? `@demos/mobile-first/app/${demoName}` : `${staticDemoPath}/${demoName}`
187
+ const path = isMobileFirst.value
188
+ ? `@demos/mobile-first/app/${demoName.replace('mobile-first/', '')}`
189
+ : `${staticDemoPath}/${demoName}`
188
190
  code = await fetchDemosFile(path)
189
191
  .then((code) => {
190
192
  return code
package/src/const.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { tinyOldTheme, tinyAuroraTheme, tinyDarkTheme } from '@opentiny/vue-theme/theme-tool'
2
2
 
3
+ export const isSaas = import.meta.env.VITE_TINY_THEME === 'saas'
4
+
3
5
  // localStorage中保存语言的key
4
6
  export const LANG_KEY = '_lang'
5
7
  // localStorage中保存语言的value
package/src/main.js CHANGED
@@ -20,7 +20,7 @@ import { i18n } from './i18n/index'
20
20
  import { router } from './router'
21
21
  import App from './App.vue'
22
22
  import { appData } from './tools'
23
- import { ZH_CN_LANG, EN_US_LANG, LANG_PATH_MAP, ES_LA_LANG, PT_BR_LANG } from './const'
23
+ import { ZH_CN_LANG, EN_US_LANG, LANG_PATH_MAP, ES_LA_LANG, PT_BR_LANG, isSaas } from './const'
24
24
  import demoConfig from '@demos/config.js'
25
25
 
26
26
  import hljs from 'highlight.js/lib/core'
@@ -38,9 +38,6 @@ import { t } from '@opentiny/vue-locale'
38
38
  import { registerMcpConfig, customDesignConfig } from '@opentiny/vue-common'
39
39
  import { twMerge } from 'tailwind-merge'
40
40
 
41
- const envTarget = import.meta.env.VITE_BUILD_TARGET || 'open'
42
- const isSaas = import.meta.env.VITE_TINY_THEME === 'saas'
43
-
44
41
  // 适配层集成twMerge能力
45
42
  if (isSaas) {
46
43
  customDesignConfig.twMerge = twMerge
@@ -61,10 +58,7 @@ if (!location.href.includes('tiny-vue-plus')) {
61
58
  })
62
59
  }
63
60
 
64
- if (envTarget !== 'open') {
65
- // 支持本地开发和内网使用全局搜索
66
- doSearchEverySite()
67
- }
61
+ doSearchEverySite()
68
62
 
69
63
  // 实验后发现,先调用一次预热一下,后续再调用会有速度的提示,因此在main中预热一下。
70
64
  setTimeout(() => {
@@ -97,7 +91,7 @@ app.config.performance = true
97
91
  // 注入全局的saas主题变量
98
92
  app.config.globalProperties.tiny_theme = { value: import.meta.env.VITE_TINY_THEME }
99
93
 
100
- if (import.meta.env.VITE_TINY_THEME === 'saas') {
94
+ if (isSaas) {
101
95
  import('./tailwind.css')
102
96
  }
103
97
  // 注册TinyVue组件mcp配置
package/src/menus.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { docMenus, cmpMenus } from '@menu/menus.js'
2
2
  import { appData, $split } from './tools'
3
+ import { isSaas } from './const'
3
4
 
4
5
  /**
5
6
  * 聚合doc / cmp 两个页面的所有菜单.
@@ -27,7 +28,7 @@ function genMenus() {
27
28
  ]
28
29
 
29
30
  // 使用指南只在DEV下生效
30
- const isShowDoc = import.meta.env.DEV || import.meta.env.VITE_TINY_THEME === 'saas'
31
+ const isShowDoc = import.meta.env.DEV || isSaas
31
32
  const docOptions = isShowDoc
32
33
  ? docMenus.map((menu) => ({
33
34
  ...menu,
@@ -1,3 +1,5 @@
1
+ import { isSaas } from '../const'
2
+
1
3
  const OPEN_TINY_URL = 'https://opentiny.design'
2
4
 
3
5
  export const doSearchEverySite = () => {
@@ -7,6 +9,10 @@ export const doSearchEverySite = () => {
7
9
  data.content = data.content.replaceAll(OPEN_TINY_URL, window.location.origin)
8
10
  }
9
11
 
12
+ if (isSaas) {
13
+ data.content = data.content.replace('/tiny-vue/', '/tiny-vue-saas/')
14
+ }
15
+
10
16
  resolve(data)
11
17
  }
12
18
  }
@@ -3,11 +3,12 @@ import { router } from '@/router.js'
3
3
  import { getAllComponents } from '@/menus'
4
4
  import demoConfig from '@demos/config.js'
5
5
  import { staticDemoPath } from '../views/components-doc/cmp-config'
6
+ import { isSaas } from '../const'
6
7
 
7
8
  const allMenus = getAllComponents()
8
9
 
9
10
  const templateModeState = reactive({
10
- isSaas: import.meta.env.VITE_TINY_THEME === 'saas',
11
+ isSaas,
11
12
  modeList: [],
12
13
  mode: null
13
14
  })
@@ -4,7 +4,7 @@ import designSaasConfig from '@opentiny/vue-design-saas'
4
4
  import designSMBConfig from '@opentiny/vue-design-smb'
5
5
  import { router } from '@/router'
6
6
  import { appData } from './appData'
7
- import { CURRENT_THEME_KEY, DEFAULT_THEME, AURORA_THEME, OLD_THEME, themeToolValuesMap } from '../const'
7
+ import { CURRENT_THEME_KEY, DEFAULT_THEME, AURORA_THEME, OLD_THEME, themeToolValuesMap, isSaas } from '../const'
8
8
  import glaciers from '@/assets/images/glaciers.png'
9
9
  import glaciersIcon from '@/assets/images/glaciers-icon.png'
10
10
 
@@ -51,7 +51,7 @@ watch(
51
51
  )
52
52
 
53
53
  const designConfig = computed(() => {
54
- if (import.meta.env.VITE_TINY_THEME === 'saas') {
54
+ if (isSaas) {
55
55
  return designSaasConfig
56
56
  }
57
57
  if (router.currentRoute.value.params.theme === 'smb-theme') {
@@ -1,6 +1,7 @@
1
+ import { isSaas } from '../../const'
2
+
1
3
  // 批量导入vue组件示例文件, 进行vue组件示例的渲染
2
4
  const vueFiles = import.meta.glob(`@demos/app/**/*.vue`)
3
- const isSaas = import.meta.env.VITE_TINY_THEME === 'saas'
4
5
  const mobileFirstVueFiles = isSaas ? import.meta.glob(`../../../demos/mobile-first/app/**/*.vue`) : null
5
6
  // 所有demo组件实例
6
7
  const vueComponents = Object.create(null)
package/vite.extend.ts CHANGED
@@ -28,9 +28,6 @@ export const delStaticPlugin = () => {
28
28
 
29
29
  // 修改@docsearch依赖,使其支持内外网官网
30
30
  export const viteDocsearchPlugin = (env) => {
31
- if (env.VITE_BUILD_TARGET !== 'inner') {
32
- return null
33
- }
34
31
  return {
35
32
  name: 'vite-docsearch-plugin',
36
33
  enforce: 'pre',