@varlet/cli 3.2.11 → 3.2.12-alpha.1717078222679

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/README.md CHANGED
@@ -45,6 +45,7 @@ Also refer to `@varlet/ui` [varlet.config.mjs](https://github.com/varletjs/varle
45
45
  | `namespace` | Component library namespace, will be used as component prefix | _string_ | `var` |
46
46
  | `host` | Development server host | _number_ | `localhost` |
47
47
  | `port` | Development server port | _number_ | `8080` |
48
+ | `proxy` | Development server proxy | _Record<string, string \| ProxyOptions>_ | `-` |
48
49
  | `title` | The title of the component library in the document | _string_ | `VARLET` |
49
50
  | `logo` | The logo of the component library in the document | _string_ | `-` |
50
51
  | `alias` | Path alias (root is src folder when use relative path) | _Record<string, string>_ | `-` |
package/README.zh-CN.md CHANGED
@@ -45,6 +45,7 @@ varlet-cli gen
45
45
  | `namespace` | 组件库命名空间, 会作为组件前缀 | _string_ | `var` |
46
46
  | `host` | 开发服务器主机 | _number_ | `localhost` |
47
47
  | `port` | 开发服务器端口 | _number_ | `8080` |
48
+ | `proxy` | 开发服务器代理 | _Record<string, string \| ProxyOptions>_ | `-` |
48
49
  | `title` | 文档中组件库的标题 | _string_ | `VARLET` |
49
50
  | `logo` | 文档中组件库的 logo | _string_ | `-` |
50
51
  | `alias` | 路径别名 (使用相对路径时,根路径为 src 文件夹) | _Record<string, string>_ | `-` |
@@ -1,5 +1,6 @@
1
1
  import { type VIConfig } from '@varlet/icon-builder';
2
2
  import { type CopyOptions } from '@varlet/vite-plugins';
3
+ import { ProxyOptions } from 'vite';
3
4
  export interface VarletConfigIcons extends VIConfig {
4
5
  /**
5
6
  * @default true
@@ -38,6 +39,17 @@ export interface VarletConfigPcHeader {
38
39
  }[];
39
40
  }[];
40
41
  }
42
+ export interface VarletConfigPcAd {
43
+ id?: string;
44
+ logo?: string;
45
+ logoHeight?: string;
46
+ description?: Record<string, string>;
47
+ descriptionBackground?: string;
48
+ descriptionTextColor?: string;
49
+ link?: Record<string, string>;
50
+ background?: string;
51
+ textColor?: string;
52
+ }
41
53
  export interface VarletConfigMobileHeader {
42
54
  i18n?: Record<string, string>;
43
55
  github?: string;
@@ -82,6 +94,7 @@ export interface VarletConfigPc {
82
94
  redirect?: string;
83
95
  clipboard?: Record<string, string>;
84
96
  indexPage?: VarletConfigPcIndexPage;
97
+ ad?: VarletConfigPcAd;
85
98
  header?: VarletConfigPcHeader;
86
99
  menu?: VarletConfigPcMenu[];
87
100
  htmlInject?: VarletConfigHtmlInject;
@@ -119,6 +132,7 @@ export interface VarletConfig {
119
132
  * Local dev server port
120
133
  */
121
134
  port?: number;
135
+ proxy?: Record<string, string | ProxyOptions>;
122
136
  title?: string;
123
137
  logo?: string;
124
138
  themeKey?: string;
@@ -42,6 +42,7 @@ export function getDevConfig(varletConfig) {
42
42
  server: {
43
43
  port: get(varletConfig, 'port'),
44
44
  host: host === 'localhost' ? '0.0.0.0' : host,
45
+ proxy: get(varletConfig, 'proxy', {}),
45
46
  },
46
47
  publicDir: SITE_PUBLIC_PATH,
47
48
  plugins: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/cli",
3
- "version": "3.2.11",
3
+ "version": "3.2.12-alpha.1717078222679",
4
4
  "type": "module",
5
5
  "description": "cli of varlet",
6
6
  "bin": {
@@ -64,8 +64,8 @@
64
64
  "semver": "^7.3.5",
65
65
  "sharp": "0.31.1",
66
66
  "typescript": "^5.1.5",
67
- "@varlet/shared": "3.2.11",
68
- "@varlet/vite-plugins": "3.2.11"
67
+ "@varlet/shared": "3.2.12-alpha.1717078222679",
68
+ "@varlet/vite-plugins": "3.2.12-alpha.1717078222679"
69
69
  },
70
70
  "devDependencies": {
71
71
  "@types/babel__core": "^7.20.1",
@@ -80,9 +80,9 @@
80
80
  "@types/semver": "^7.3.9",
81
81
  "@types/sharp": "0.31.1",
82
82
  "rimraf": "^5.0.1",
83
- "@varlet/ui": "3.2.11",
84
- "@varlet/touch-emulator": "3.2.11",
85
- "@varlet/icons": "3.2.11"
83
+ "@varlet/ui": "3.2.12-alpha.1717078222679",
84
+ "@varlet/icons": "3.2.12-alpha.1717078222679",
85
+ "@varlet/touch-emulator": "3.2.12-alpha.1717078222679"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "@vue/runtime-core": "3.4.21",
@@ -95,9 +95,9 @@
95
95
  "lodash-es": "^4.17.21",
96
96
  "vue": "3.4.21",
97
97
  "vue-router": "4.2.0",
98
- "@varlet/ui": "3.2.11",
99
- "@varlet/icons": "3.2.11",
100
- "@varlet/touch-emulator": "3.2.11"
98
+ "@varlet/icons": "3.2.12-alpha.1717078222679",
99
+ "@varlet/ui": "3.2.12-alpha.1717078222679",
100
+ "@varlet/touch-emulator": "3.2.12-alpha.1717078222679"
101
101
  },
102
102
  "scripts": {
103
103
  "dev": "tsc --watch",
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import config from '@config'
3
+ import AppAd from './components/AppAd.vue'
3
4
  import AppMobile from './components/AppMobile.vue'
4
5
  import AppHeader from './components/AppHeader.vue'
5
6
  import AppSidebar from './components/AppSidebar.vue'
@@ -23,7 +24,7 @@ const doc: Ref<HTMLElement | null> = ref(null)
23
24
  const route = useRoute()
24
25
 
25
26
  const getComponentNameByMenuName = (menuName: string) => {
26
- const currentMenu = menu.value.find(menu => menu.doc === menuName)
27
+ const currentMenu = menu.value.find((menu) => menu.doc === menuName)
27
28
  return currentMenu?.type === MenuTypes.COMPONENT ? menuName : mobileRedirect.slice(1)
28
29
  }
29
30
 
@@ -31,9 +32,7 @@ const init = () => {
31
32
  const { menuName } = getPCLocationInfo()
32
33
 
33
34
  nextTick(() => {
34
- const children = document
35
- .querySelector('.varlet-site-sidebar')!
36
- .getElementsByClassName('var-cell')
35
+ const children = document.querySelector('.varlet-site-sidebar')!.getElementsByClassName('var-cell')
37
36
  const index = menu.value.findIndex((item) => item.doc === menuName)
38
37
 
39
38
  if (index !== -1) {
@@ -90,7 +89,7 @@ watch(
90
89
  menuName.value = _menuName
91
90
  hash.value = _hash
92
91
  language.value = lang
93
- useMobile.value = menu.value.find(item => item.doc === _menuName)?.useMobile ?? get(config, 'useMobile')
92
+ useMobile.value = menu.value.find((item) => item.doc === _menuName)?.useMobile ?? get(config, 'useMobile')
94
93
  document.title = get(config, 'pc.title')[lang] as string
95
94
  },
96
95
  { immediate: true }
@@ -99,22 +98,15 @@ watch(
99
98
 
100
99
  <template>
101
100
  <div class="varlet-site">
102
- <app-header :language="language"/>
101
+ <app-ad :language="language" />
102
+
103
+ <app-header :language="language" />
103
104
 
104
105
  <div class="varlet-site-content">
105
- <app-sidebar
106
- :language="language"
107
- :menu="menu"
108
- :menu-name="menuName"
109
- @change="handleSidebarChange"
110
- />
106
+ <app-sidebar :language="language" :menu="menu" :menu-name="menuName" @change="handleSidebarChange" />
111
107
 
112
- <div
113
- class="varlet-site-doc-container"
114
- ref="doc"
115
- :class="[!useMobile && 'varlet-site-doc-container--pc-only']"
116
- >
117
- <router-view/>
108
+ <div class="varlet-site-doc-container" ref="doc" :class="[!useMobile && 'varlet-site-doc-container--pc-only']">
109
+ <router-view />
118
110
  </div>
119
111
 
120
112
  <app-mobile
@@ -127,13 +119,15 @@ watch(
127
119
  </div>
128
120
  </div>
129
121
 
130
- <var-popup
131
- position="right"
132
- :show="context.showPlayground"
133
- @click-overlay="confirmClose"
134
- >
122
+ <var-popup position="right" :show="context.showPlayground" @click-overlay="confirmClose">
135
123
  <div class="varlet-site-playground-container">
136
- <iframe v-if="context.showPlayground" id="playground" class="varlet-site-playground-iframe" :src="context.playgroundURL" allow="clipboard-write">
124
+ <iframe
125
+ v-if="context.showPlayground"
126
+ id="playground"
127
+ class="varlet-site-playground-iframe"
128
+ :src="context.playgroundURL"
129
+ allow="clipboard-write"
130
+ >
137
131
  </iframe>
138
132
  </div>
139
133
  </var-popup>
@@ -143,51 +137,69 @@ watch(
143
137
  .hljs {
144
138
  background: var(--site-config-color-hl-background) !important;
145
139
  padding: 0 !important;
146
- transition: all .25s
140
+ transition: all 0.25s;
147
141
  }
148
142
 
149
143
  .hljs code {
150
144
  line-height: 31px;
151
145
  }
152
146
 
153
- .hljs-comment, .hljs-meta, .hljs-quote {
154
- color: var(--site-config-color-hl-group-a)
147
+ .hljs-comment,
148
+ .hljs-meta,
149
+ .hljs-quote {
150
+ color: var(--site-config-color-hl-group-a);
155
151
  }
156
152
 
157
- .hljs-keyword, .hljs-name, .hljs-selector-tag, .hljs-tag {
158
- color: var(--site-config-color-hl-group-b)
153
+ .hljs-keyword,
154
+ .hljs-name,
155
+ .hljs-selector-tag,
156
+ .hljs-tag {
157
+ color: var(--site-config-color-hl-group-b);
159
158
  }
160
159
 
161
- .hljs-attribute, .hljs-selector-id {
162
- color: var(--site-config-color-hl-group-c)
160
+ .hljs-attribute,
161
+ .hljs-selector-id {
162
+ color: var(--site-config-color-hl-group-c);
163
163
  }
164
164
 
165
- .hljs-addition, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-string {
166
- color: var(--site-config-color-hl-group-d)
165
+ .hljs-addition,
166
+ .hljs-selector-attr,
167
+ .hljs-selector-pseudo,
168
+ .hljs-string {
169
+ color: var(--site-config-color-hl-group-d);
167
170
  }
168
171
 
169
172
  .hljs-subst {
170
- color: var(--site-config-color-hl-group-e)
173
+ color: var(--site-config-color-hl-group-e);
171
174
  }
172
175
 
173
- .hljs-link, .hljs-regexp {
174
- color: var(--site-config-color-hl-group-f)
176
+ .hljs-link,
177
+ .hljs-regexp {
178
+ color: var(--site-config-color-hl-group-f);
175
179
  }
176
180
 
177
- .hljs-doctag, .hljs-section, .hljs-title, .hljs-type {
178
- color: var(--site-config-color-hl-group-g)
181
+ .hljs-doctag,
182
+ .hljs-section,
183
+ .hljs-title,
184
+ .hljs-type {
185
+ color: var(--site-config-color-hl-group-g);
179
186
  }
180
187
 
181
- .hljs-bullet, .hljs-literal, .hljs-symbol, .hljs-template-variable, .hljs-variable {
182
- color: var(--site-config-color-hl-group-h)
188
+ .hljs-bullet,
189
+ .hljs-literal,
190
+ .hljs-symbol,
191
+ .hljs-template-variable,
192
+ .hljs-variable {
193
+ color: var(--site-config-color-hl-group-h);
183
194
  }
184
195
 
185
- .hljs-deletion, .hljs-number {
186
- color: var(--site-config-color-hl-group-i)
196
+ .hljs-deletion,
197
+ .hljs-number {
198
+ color: var(--site-config-color-hl-group-i);
187
199
  }
188
200
 
189
201
  .var-popup__content {
190
- background-color: rgba(0, 0, 0, 0)
202
+ background-color: rgba(0, 0, 0, 0);
191
203
  }
192
204
  </style>
193
205
 
@@ -197,7 +209,7 @@ watch(
197
209
  font-family: inherit;
198
210
  padding: 0;
199
211
  white-space: pre-wrap;
200
- }
212
+ };
201
213
 
202
214
  iframe {
203
215
  display: block;
@@ -246,12 +258,10 @@ iframe {
246
258
 
247
259
  &-site {
248
260
  min-width: 1200px;
249
- padding: 60px 0 0;
250
261
 
251
262
  &-content {
252
263
  display: flex;
253
264
  background: var(--site-config-color-body);
254
- margin-left: 246px;
255
265
  min-height: calc(100vh - 60px);
256
266
  }
257
267
 
@@ -283,7 +293,6 @@ iframe {
283
293
  }
284
294
  }
285
295
 
286
-
287
296
  a {
288
297
  color: var(--site-config-color-link);
289
298
  -webkit-font-smoothing: antialiased;
@@ -346,7 +355,8 @@ iframe {
346
355
  }
347
356
  }
348
357
 
349
- ul,ol {
358
+ ul,
359
+ ol {
350
360
  padding: 0 0 0 18px;
351
361
  }
352
362
 
@@ -439,7 +449,7 @@ iframe {
439
449
  background: var(--site-config-color-bar);
440
450
  padding: 20px;
441
451
  margin-bottom: 30px;
442
- box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
452
+ box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
443
453
 
444
454
  &:first-child {
445
455
  margin-top: 30px;
@@ -0,0 +1,123 @@
1
+ <script setup lang="ts">
2
+ import config from '@config'
3
+ import { get } from 'lodash-es'
4
+ import { ref } from 'vue'
5
+
6
+ defineProps({
7
+ language: {
8
+ type: String,
9
+ required: true,
10
+ },
11
+ })
12
+
13
+ const ad = ref(get(config, 'pc.ad'))
14
+ const storageKey = `varlet-site-ad-closed-${ad.value?.id}`
15
+ const isClose = ref(localStorage.getItem(storageKey) == 'true')
16
+
17
+ function handleClose() {
18
+ localStorage.setItem(`varlet-site-ad-closed-${ad.value?.id}`, 'true')
19
+ isClose.value = true
20
+ }
21
+ </script>
22
+
23
+ <template>
24
+ <a
25
+ class="varlet-site-ad varlet-site-ad--animation"
26
+ :href="ad?.link[language]"
27
+ target="_blank"
28
+ :class="{ 'varlet-site-ad--close': isClose || !ad }"
29
+ :style="{ background: ad?.background, color: ad?.textColor }"
30
+ >
31
+ <img class="varlet-site-ad__logo" :style="{ height: ad?.logoHeight }" :src="ad.logo" v-if="ad.logo" />
32
+ <div
33
+ class="varlet-site-ad__description"
34
+ :style="{ background: ad?.descriptionBackground, color: ad?.descriptionTextColor }"
35
+ v-if="ad.description"
36
+ >
37
+ <span>{{ ad.description[language] }}</span>
38
+ <var-icon style="margin-left: 4px" name="chevron-right" :size="24" />
39
+ </div>
40
+ <var-button class="varlet-site-ad__close-button" text round @click.prevent="handleClose">
41
+ <var-icon name="window-close" :size="20" />
42
+ </var-button>
43
+ </a>
44
+ </template>
45
+
46
+ <style lang="less">
47
+ .varlet-site-ad {
48
+ width: 100%;
49
+ position: relative;
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: center;
53
+ height: 52px;
54
+ color: #fff;
55
+ text-decoration: unset;
56
+ overflow: hidden;
57
+
58
+ @keyframes varlet-site-ad-animation {
59
+ from {
60
+ transform: translateX(-100%);
61
+ }
62
+
63
+ to {
64
+ transform: translateX(100%);
65
+ }
66
+ }
67
+
68
+ &__logo {
69
+ height: 36px;
70
+ border-radius: 8px;
71
+ transition: all 0.2s;
72
+
73
+ &:hover {
74
+ transform: scale(1.1);
75
+ }
76
+ }
77
+
78
+ &__description {
79
+ display: flex;
80
+ align-items: center;
81
+ height: 32px;
82
+ border-radius: 100px;
83
+ padding: 0 18px;
84
+ margin-left: 12px;
85
+ font-size: 15px;
86
+ background: #d0bcff;
87
+ color: #381e72;
88
+ transition: all 0.2s;
89
+ transform-origin: left;
90
+
91
+ &:hover {
92
+ transform: scale(1.05);
93
+ }
94
+ }
95
+
96
+ &__close-button {
97
+ position: absolute;
98
+ top: 50%;
99
+ right: 35px;
100
+ transform: translateY(-50%);
101
+ }
102
+
103
+ &--close {
104
+ height: 0;
105
+ }
106
+
107
+ &--animation {
108
+ &::after {
109
+ content: '';
110
+ position: absolute;
111
+ top: 0;
112
+ left: 0;
113
+ width: 100%;
114
+ height: 100%;
115
+ z-index: 1;
116
+ pointer-events: none;
117
+ animation: varlet-site-ad-animation 8s infinite;
118
+ background: linear-gradient(90deg, hsla(0, 0%, 100%, 0), hsla(0, 0%, 100%, 0.2), hsla(0, 0%, 100%, 0));
119
+ transition: 0.25s background-color;
120
+ }
121
+ }
122
+ }
123
+ </style>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="varlet-site-header">
3
3
  <div class="varlet-site-header__lead">
4
- <img class="varlet-site-header__logo" :src="config.logo" @click="backRoot"/>
4
+ <img class="varlet-site-header__logo" :src="config.logo" @click="backRoot" />
5
5
  <div class="varlet-site-header__title" v-if="title" @click="backRoot">{{ title }}</div>
6
6
  </div>
7
7
 
@@ -12,8 +12,8 @@
12
12
  @mouseleave="isOpenVersionsMenu = false"
13
13
  v-if="isShowVersion"
14
14
  >
15
- <span style="font-size: 16px;">{{ currentVersion }}</span>
16
- <var-icon name="chevron-down"/>
15
+ <span style="font-size: 16px">{{ currentVersion }}</span>
16
+ <var-icon name="chevron-down" />
17
17
  <transition name="fade">
18
18
  <div
19
19
  class="varlet-site-header__animation-list varlet-site-header__animation-versions var-elevation--5"
@@ -27,20 +27,27 @@
27
27
  :class="{ 'varlet-site-header__animation-list--active': currentVersion === i.label }"
28
28
  @click="open(i.link)"
29
29
  >
30
- {{ i.label }}
30
+ {{ i.label }}
31
31
  </var-cell>
32
32
  </div>
33
33
  </transition>
34
34
  </div>
35
35
 
36
- <a class="varlet-site-header__link" style="margin-right: 8px;" target="_blank" :href="changelog" v-ripple v-if="changelog">
37
- <var-icon name="history" :size="28"/>
36
+ <a
37
+ class="varlet-site-header__link"
38
+ style="margin-right: 8px"
39
+ target="_blank"
40
+ :href="changelog"
41
+ v-ripple
42
+ v-if="changelog"
43
+ >
44
+ <var-icon name="history" :size="28" />
38
45
  </a>
39
46
  <a class="varlet-site-header__link" target="_blank" :href="playground" v-ripple v-if="playground">
40
- <var-icon name="code-json" :size="24"/>
47
+ <var-icon name="code-json" :size="24" />
41
48
  </a>
42
49
  <a class="varlet-site-header__link" target="_blank" :href="github" v-ripple v-if="github">
43
- <var-icon name="github" :size="28"/>
50
+ <var-icon name="github" :size="28" />
44
51
  </a>
45
52
  <div
46
53
  class="varlet-site-header__theme"
@@ -49,7 +56,7 @@
49
56
  v-if="themes.length > 1"
50
57
  >
51
58
  <var-icon name="palette" :size="28" />
52
- <var-icon name="chevron-down"/>
59
+ <var-icon name="chevron-down" />
53
60
  <transition name="fade">
54
61
  <div
55
62
  class="varlet-site-header__animation-list var-elevation--5"
@@ -62,7 +69,7 @@
62
69
  :key="t.value"
63
70
  :class="{ 'varlet-site-header__animation-list--active': currentTheme === t.value }"
64
71
  @click="() => toggleTheme(t.value as Theme)"
65
- >{{ t[language as keyof typeof t] }}
72
+ >{{ t[language as keyof typeof t] }}
66
73
  </var-cell>
67
74
  </div>
68
75
  </transition>
@@ -73,8 +80,8 @@
73
80
  @mouseleave="isOpenLanguageMenu = false"
74
81
  v-if="languages"
75
82
  >
76
- <var-icon name="translate" :size="26"/>
77
- <var-icon name="chevron-down"/>
83
+ <var-icon name="translate" :size="26" />
84
+ <var-icon name="chevron-down" />
78
85
  <transition name="fade">
79
86
  <div
80
87
  class="varlet-site-header__animation-list var-elevation--5"
@@ -87,12 +94,11 @@
87
94
  :key="key"
88
95
  :class="{ 'varlet-site-header__animation-list--active': language === key }"
89
96
  @click="handleLanguageChange(key)"
90
- >{{ value }}
97
+ >{{ value }}
91
98
  </var-cell>
92
99
  </div>
93
100
  </transition>
94
101
  </div>
95
-
96
102
  </div>
97
103
  </div>
98
104
  </template>
@@ -111,16 +117,18 @@ export default defineComponent({
111
117
  props: {
112
118
  language: {
113
119
  type: String,
114
- }
120
+ },
115
121
  },
116
122
  setup() {
117
123
  const title: Ref<string> = ref(get(config, 'title'))
118
124
  const logo: Ref<string> = ref(get(config, 'logo'))
119
125
  const languages: Ref<Record<string, string>> = ref(get(config, 'pc.header.i18n'))
120
126
  const currentVersion: Ref<string> = ref(get(config, 'pc.header.currentVersion'))
121
- const versions = get(config, 'pc.header.versions')
127
+ const versions = get(config, 'pc.header.versions')
122
128
  const isShowVersion: Ref<boolean> = ref(!!versions)
123
- const versionItems: Ref<Array<Record<string, any>>> = ref((versions ?? []).find((i: any) => window.location.host.includes(i.name))?.items ?? versions?.[0]?.items ?? [])
129
+ const versionItems: Ref<Array<Record<string, any>>> = ref(
130
+ (versions ?? []).find((i: any) => window.location.host.includes(i.name))?.items ?? versions?.[0]?.items ?? []
131
+ )
124
132
  const playground: Ref<string> = ref(get(config, 'pc.header.playground'))
125
133
  const github: Ref<string> = ref(get(config, 'pc.header.github'))
126
134
  const themes: Ref<Record<string, any>> = ref(get(config, 'pc.header.themes'))
@@ -163,7 +171,8 @@ export default defineComponent({
163
171
  }
164
172
 
165
173
  const notifyThemeChange = (target: 'mobile' | 'window') => {
166
- const contentWindow = target === 'window' ? window : (document.getElementById(target) as HTMLIFrameElement | undefined)?.contentWindow
174
+ const contentWindow =
175
+ target === 'window' ? window : (document.getElementById(target) as HTMLIFrameElement | undefined)?.contentWindow
167
176
  if (!contentWindow) {
168
177
  return
169
178
  }
@@ -218,7 +227,7 @@ export default defineComponent({
218
227
 
219
228
  <style lang="less">
220
229
  .varlet-site-header {
221
- position: fixed;
230
+ position: sticky;
222
231
  top: 0;
223
232
  left: 0;
224
233
  display: flex;
@@ -1,7 +1,12 @@
1
1
  <template>
2
2
  <div class="varlet-site-mobile varlet-site-mobile--375">
3
3
  <div class="varlet-site-mobile-content">
4
- <iframe id="mobile" :src="`${getMobileIndex()}#/${componentName}?language=${language}&platform=pc&replace=${replace}${hash ? `#${hash}` : ''}`"></iframe>
4
+ <iframe
5
+ id="mobile"
6
+ :src="`${getMobileIndex()}#/${componentName}?language=${language}&platform=pc&replace=${replace}${
7
+ hash ? `#${hash}` : ''
8
+ }`"
9
+ ></iframe>
5
10
  </div>
6
11
  </div>
7
12
  </template>
@@ -13,23 +18,23 @@ export default {
13
18
  name: 'AppMobile',
14
19
  props: {
15
20
  componentName: {
16
- type: String
21
+ type: String,
17
22
  },
18
23
  language: {
19
- type: String
24
+ type: String,
20
25
  },
21
26
  replace: {
22
- type: String
27
+ type: String,
23
28
  },
24
29
  hash: {
25
- type: String
26
- }
30
+ type: String,
31
+ },
27
32
  },
28
33
  setup() {
29
34
  return {
30
- getMobileIndex
35
+ getMobileIndex,
31
36
  }
32
- }
37
+ },
33
38
  }
34
39
  </script>
35
40
 
@@ -43,6 +48,7 @@ export default {
43
48
  overflow: hidden;
44
49
  box-shadow: 0 0 14px 6px var(--site-config-color-shadow);
45
50
  border-radius: 2px;
51
+ margin-top: 20px;
46
52
 
47
53
  @media screen and (min-width: 1600px) {
48
54
  &--375 {
@@ -62,11 +62,10 @@ const changeRoute = (item: Menu) => {
62
62
 
63
63
  .varlet-site-sidebar {
64
64
  padding: 0 0 15px;
65
- position: fixed;
65
+ position: sticky;
66
66
  width: 246px;
67
+ height: 100vh;
67
68
  top: 60px;
68
- bottom: 0;
69
- left: 0;
70
69
  z-index: 6;
71
70
  overflow-y: scroll;
72
71
  box-shadow: 0 8px 12px var(--site-config-color-shadow);
@@ -1,17 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  import config from '@config'
3
3
  import AppHeader from '../../components/AppHeader.vue'
4
+ import AppAd from '../../components/AppAd.vue'
4
5
  import { get } from 'lodash-es'
5
6
  import { ref, watch, type Ref } from 'vue'
6
7
  import { useRoute, useRouter } from 'vue-router'
7
- import {
8
- getPCLocationInfo,
9
- watchTheme,
10
- onThemeChange,
11
- getBrowserTheme,
12
- setTheme,
13
- type Theme
14
- } from '@varlet/cli/client'
8
+ import { getPCLocationInfo, watchTheme, onThemeChange, getBrowserTheme, setTheme, type Theme } from '@varlet/cli/client'
15
9
 
16
10
  const route = useRoute()
17
11
  const router = useRouter()
@@ -59,20 +53,25 @@ watchTheme((theme, from) => {
59
53
 
60
54
  onThemeChange()
61
55
 
62
- watch(() => route.path, () => {
63
- language.value = getPCLocationInfo().language
64
- setLocale()
65
- }, { immediate: true })
56
+ watch(
57
+ () => route.path,
58
+ () => {
59
+ language.value = getPCLocationInfo().language
60
+ setLocale()
61
+ },
62
+ { immediate: true }
63
+ )
66
64
  </script>
67
65
 
68
66
  <template>
69
- <app-header :language="language" />
70
67
  <div class="varlet-doc-index">
68
+ <app-ad :language="language" />
69
+ <app-header :language="language" />
71
70
  <div class="varlet-doc-index__layout">
72
71
  <div class="varlet-doc-index__main-container">
73
72
  <div class="varlet-doc-index__logo-container">
74
73
  <div class="varlet-doc-index__logo-background-mask"></div>
75
- <img class="varlet-doc-index__logo" :src="config.logo" alt="">
74
+ <img class="varlet-doc-index__logo" :src="config.logo" alt="" />
76
75
  </div>
77
76
  <div class="varlet-doc-index__info-container">
78
77
  <div class="varlet-doc-index__title">{{ title }}</div>
@@ -80,7 +79,7 @@ watch(() => route.path, () => {
80
79
 
81
80
  <var-space size="large">
82
81
  <var-button class="varlet-doc-index__link-button" type="primary" style="line-height: 1.2" @click="getStar">
83
- {{ indexPage.started[language] }}
82
+ {{ indexPage.started[language] }}
84
83
  </var-button>
85
84
  <var-button class="varlet-doc-index__github-button" style="line-height: 1.2" @click="toGithub">
86
85
  {{ indexPage.viewOnGithub[language] }}
@@ -88,7 +87,7 @@ watch(() => route.path, () => {
88
87
  </var-space>
89
88
  </div>
90
89
  </div>
91
-
90
+
92
91
  <div class="varlet-doc-index__features" v-if="indexPage.features">
93
92
  <div class="varlet-doc-index__feature" v-for="feature in indexPage.features">
94
93
  <div class="varlet-doc-index__feature-name">{{ feature.name[language] }}</div>
@@ -101,13 +100,25 @@ watch(() => route.path, () => {
101
100
 
102
101
  <div class="varlet-doc-index__team-members-container">
103
102
  <div class="varlet-doc-index__team-member" v-for="member in indexPage.teamMembers.members">
104
- <img class="varlet-doc-index__team-member-avatar" :src="member.avatar">
103
+ <img class="varlet-doc-index__team-member-avatar" :src="member.avatar" />
105
104
  <div class="varlet-doc-index__team-member-name">{{ member.name[language] }}</div>
106
105
  <div class="varlet-doc-index__team-member-title">{{ member.title[language] }}</div>
107
106
  <div class="varlet-doc-index__team-member-description">{{ member.description[language] }}</div>
108
107
  <div class="varlet-doc-index__team-member-social">
109
- <var-icon class="varlet-doc-index__team-member-social-icon" name="github" :size="24" @click="to(member.github)" v-if="member.github" />
110
- <var-icon class="varlet-doc-index__team-member-social-icon" name="twitter" :size="24" @click="to(member.twitter)" v-if="member.twitter" />
108
+ <var-icon
109
+ class="varlet-doc-index__team-member-social-icon"
110
+ name="github"
111
+ :size="24"
112
+ @click="to(member.github)"
113
+ v-if="member.github"
114
+ />
115
+ <var-icon
116
+ class="varlet-doc-index__team-member-social-icon"
117
+ name="twitter"
118
+ :size="24"
119
+ @click="to(member.twitter)"
120
+ v-if="member.twitter"
121
+ />
111
122
  </div>
112
123
  </div>
113
124
  </div>
@@ -117,7 +128,7 @@ watch(() => route.path, () => {
117
128
  <div class="varlet-doc-index__contributors-title">{{ indexPage.contributors.label[language] }}</div>
118
129
 
119
130
  <a class="varlet-doc-index__contributors-link" :href="indexPage.contributors.link">
120
- <img class="varlet-doc-index__contributors-image" :src="indexPage.contributors.image">
131
+ <img class="varlet-doc-index__contributors-image" :src="indexPage.contributors.image" />
121
132
  </a>
122
133
  </div>
123
134
 
@@ -125,7 +136,7 @@ watch(() => route.path, () => {
125
136
  <div class="varlet-doc-index__sponsors-title">{{ indexPage.sponsors.label[language] }}</div>
126
137
 
127
138
  <a class="varlet-doc-index__sponsors-link" :href="indexPage.sponsors.link">
128
- <img class="varlet-doc-index__sponsors-image" :src="indexPage.sponsors.image">
139
+ <img class="varlet-doc-index__sponsors-image" :src="indexPage.sponsors.image" />
129
140
  </a>
130
141
  </div>
131
142
 
@@ -173,7 +184,7 @@ watch(() => route.path, () => {
173
184
  box-sizing: border-box;
174
185
  background: var(--site-config-color-index-page-background);
175
186
  padding-bottom: 100px;
176
- min-width: 1050px;
187
+ min-width: 1200px;
177
188
 
178
189
  &__layout {
179
190
  display: flex;
@@ -181,7 +192,7 @@ watch(() => route.path, () => {
181
192
  align-items: center;
182
193
  padding: 170px 0;
183
194
  max-width: 1200px;
184
- transition: all .2s;
195
+ transition: all 0.2s;
185
196
  }
186
197
 
187
198
  &__main-container {
@@ -215,7 +226,7 @@ watch(() => route.path, () => {
215
226
  bottom: -40px;
216
227
  right: -40px;
217
228
  background: var(--site-config-color-index-page-logo-mask-background);
218
- transition: background-color .2s;
229
+ transition: background-color 0.2s;
219
230
  filter: blur(45px);
220
231
  border-radius: 50%;
221
232
  animation: logo-wave 6s infinite linear;
@@ -240,7 +251,7 @@ watch(() => route.path, () => {
240
251
  width: 170px !important;
241
252
  height: 48px !important;
242
253
  font-size: 19px !important;
243
- transition: all .2s !important;
254
+ transition: all 0.2s !important;
244
255
  margin-top: 38px !important;
245
256
  }
246
257
 
@@ -248,7 +259,7 @@ watch(() => route.path, () => {
248
259
  width: 170px !important;
249
260
  height: 48px !important;
250
261
  font-size: 19px !important;
251
- transition: all .2s !important;
262
+ transition: all 0.2s !important;
252
263
  margin-top: 38px !important;
253
264
  }
254
265
 
@@ -275,7 +286,8 @@ watch(() => route.path, () => {
275
286
  line-height: 1.7;
276
287
  }
277
288
 
278
- &__contributors, &__team-members {
289
+ &__contributors,
290
+ &__team-members {
279
291
  width: 100%;
280
292
  display: flex;
281
293
  flex-direction: column;
@@ -283,14 +295,15 @@ watch(() => route.path, () => {
283
295
  margin-top: 90px;
284
296
  }
285
297
 
286
- &__contributors-title, &__team-members-title {
298
+ &__contributors-title,
299
+ &__team-members-title {
287
300
  padding-top: 24px;
288
301
  line-height: 32px;
289
302
  font-size: 24px;
290
303
  border-top: 2px solid var(--site-config-color-index-page-divider-color);
291
304
  color: var(--site-config-color-index-page-second-text-color);
292
305
  letter-spacing: 1px;
293
- transition: all .2s;
306
+ transition: all 0.2s;
294
307
  }
295
308
 
296
309
  &__team-members-container {
@@ -311,7 +324,6 @@ watch(() => route.path, () => {
311
324
  background: var(--site-config-color-index-page-feature-background);
312
325
  box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
313
326
 
314
-
315
327
  &-avatar {
316
328
  width: 80px;
317
329
  height: 80px;
@@ -324,7 +336,8 @@ watch(() => route.path, () => {
324
336
  margin-top: 20px;
325
337
  }
326
338
 
327
- &-title, &-description {
339
+ &-title,
340
+ &-description {
328
341
  color: var(--site-config-color-index-page-second-text-color);
329
342
  font-size: 14px;
330
343
  margin-top: 10px;
@@ -338,7 +351,7 @@ watch(() => route.path, () => {
338
351
  &-icon {
339
352
  margin: 10px 6px 0;
340
353
  transition: all 0.25s !important;
341
-
354
+
342
355
  &:hover {
343
356
  opacity: 0.7;
344
357
  transform: scale(1.25);
@@ -373,7 +386,7 @@ watch(() => route.path, () => {
373
386
  border-top: 2px solid var(--site-config-color-index-page-divider-color);
374
387
  color: var(--site-config-color-index-page-second-text-color);
375
388
  letter-spacing: 1px;
376
- transition: all .2s;
389
+ transition: all 0.2s;
377
390
  }
378
391
 
379
392
  &__sponsors-link {
@@ -400,7 +413,7 @@ watch(() => route.path, () => {
400
413
  color: var(--site-config-color-index-page-second-text-color);
401
414
  font-size: 14px;
402
415
  line-height: 26px;
403
- transition: all .2s;
416
+ transition: all 0.2s;
404
417
  }
405
418
  }
406
419
  </style>