@varlet/cli 2.15.1 → 2.16.0-alpha.1693852004525

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.
Files changed (60) hide show
  1. package/lib/node/config/varlet.config.js +2 -1
  2. package/lib/node/config/varlet.default.config.js +264 -7
  3. package/package.json +8 -7
  4. package/site/mobile/App.vue +25 -22
  5. package/site/mobile/{components/AppHome.vue → AppHome.vue} +6 -6
  6. package/site/mobile/main.ts +6 -21
  7. package/site/pc/App.vue +0 -5
  8. package/site/pc/Layout.vue +24 -28
  9. package/site/pc/components/AppHeader.vue +123 -122
  10. package/site/pc/components/AppMobile.vue +9 -2
  11. package/site/pc/components/AppSidebar.vue +18 -17
  12. package/site/{components → pc/components}/code-example/CodeExample.vue +8 -15
  13. package/site/pc/main.ts +6 -23
  14. package/site/pc/pages/index/index.vue +316 -47
  15. package/site/types.ts +6 -0
  16. package/template/generators/base/package.json +1 -0
  17. package/site/components/button/Button.vue +0 -106
  18. package/site/components/button/button.less +0 -183
  19. package/site/components/button/index.ts +0 -10
  20. package/site/components/button/props.ts +0 -78
  21. package/site/components/cell/Cell.vue +0 -54
  22. package/site/components/cell/cell.less +0 -78
  23. package/site/components/cell/index.ts +0 -10
  24. package/site/components/cell/props.ts +0 -27
  25. package/site/components/context/index.ts +0 -21
  26. package/site/components/context/lock.ts +0 -92
  27. package/site/components/context/zIndex.ts +0 -20
  28. package/site/components/icon/Icon.vue +0 -75
  29. package/site/components/icon/icon.less +0 -38
  30. package/site/components/icon/index.ts +0 -10
  31. package/site/components/icon/props.ts +0 -24
  32. package/site/components/loading/Loading.vue +0 -84
  33. package/site/components/loading/index.ts +0 -10
  34. package/site/components/loading/loading.less +0 -505
  35. package/site/components/loading/props.ts +0 -42
  36. package/site/components/popup/Popup.tsx +0 -102
  37. package/site/components/popup/index.ts +0 -10
  38. package/site/components/popup/popup.less +0 -125
  39. package/site/components/popup/props.ts +0 -63
  40. package/site/components/ripple/index.ts +0 -188
  41. package/site/components/ripple/ripple.less +0 -20
  42. package/site/components/snackbar/Snackbar.vue +0 -41
  43. package/site/components/snackbar/core.vue +0 -132
  44. package/site/components/snackbar/index.tsx +0 -270
  45. package/site/components/snackbar/props.ts +0 -97
  46. package/site/components/snackbar/snackbar.less +0 -135
  47. package/site/components/styles/common.less +0 -64
  48. package/site/components/styles/elevation.less +0 -126
  49. package/site/components/styles/var.less +0 -27
  50. package/site/components/utils/components.ts +0 -114
  51. package/site/components/utils/elements.ts +0 -104
  52. package/site/mobile/components/app-bar/AppBar.vue +0 -65
  53. package/site/mobile/components/app-bar/appBar.less +0 -57
  54. package/site/mobile/components/app-bar/index.ts +0 -10
  55. package/site/mobile/components/app-bar/props.ts +0 -25
  56. package/site/pc/components/AnimationBox.vue +0 -62
  57. package/site/pc/components/LogoAnimation.vue +0 -119
  58. package/site/pc/pages/index/index.less +0 -204
  59. /package/site/{components → pc/components}/code-example/codeExample.less +0 -0
  60. /package/site/{components → pc/components}/code-example/index.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import AnimationBox from '../../components/AnimationBox.vue'
3
2
  import config from '@config'
3
+ import AppHeader from '../../components/AppHeader.vue'
4
4
  import { get } from 'lodash-es'
5
5
  import { ref, watch, type Ref } from 'vue'
6
6
  import { useRoute, useRouter } from 'vue-router'
@@ -14,23 +14,20 @@ import { setTheme } from '../../../utils'
14
14
 
15
15
  const route = useRoute()
16
16
  const router = useRouter()
17
-
18
- const github = get(config, 'pc.header.github')
19
17
  const currentTheme = ref(getBrowserTheme())
20
- const darkMode: Ref<boolean> = ref(get(config, 'pc.header.darkMode'))
18
+ const github = get(config, 'pc.header.github')
21
19
  const title: Ref<string> = ref(get(config, 'title'))
22
20
  const language: Ref<string> = ref(get(config, 'defaultLanguage'))
23
- const languages: Ref<Record<string, string>> = ref(get(config, 'pc.header.i18n'))
24
21
  const indexPage: Ref<Record<string, any>> = ref(get(config, 'pc.indexPage'))
25
22
 
26
- const goGithub = () => {
27
- window.open(github)
28
- }
29
-
30
23
  const getStar = () => {
31
24
  router.push(`/${language.value}/home`)
32
25
  }
33
26
 
27
+ const toGithub = () => {
28
+ window.open(github)
29
+ }
30
+
34
31
  const getThemeMessage = () => ({ action: 'theme-change', from: 'pc', data: currentTheme.value })
35
32
 
36
33
  const setCurrentTheme = (theme: Theme) => {
@@ -39,12 +36,6 @@ const setCurrentTheme = (theme: Theme) => {
39
36
  window.localStorage.setItem(get(config, 'themeKey'), currentTheme.value)
40
37
  }
41
38
 
42
- const toggleTheme = () => {
43
- setCurrentTheme(currentTheme.value === 'darkTheme' ? 'lightTheme' : 'darkTheme')
44
- window.postMessage(getThemeMessage(), '*')
45
- ; (document.getElementById('mobile') as HTMLIFrameElement)?.contentWindow!.postMessage(getThemeMessage(), '*')
46
- }
47
-
48
39
  const setLocale = () => {
49
40
  const { language: lang } = getPCLocationInfo()
50
41
  if (!lang) return
@@ -53,14 +44,8 @@ const setLocale = () => {
53
44
  document.title = get(config, 'pc.title')[lang] as string
54
45
  }
55
46
 
56
- const toggleLanguages = () => {
57
- const { language: lang } = getPCLocationInfo()
58
-
59
- const { menuName } = getPCLocationInfo()
60
- const replaceStr = `/${lang === 'zh-CN' ? 'en-US' : 'zh-CN'}/${menuName}`
61
-
62
- language.value = lang
63
- router.replace(replaceStr)
47
+ const to = (url: string) => {
48
+ window.open(url)
64
49
  }
65
50
 
66
51
  setTheme(config, currentTheme.value)
@@ -71,35 +56,36 @@ watchTheme((theme, from) => {
71
56
  from === 'mobile' && setCurrentTheme(theme)
72
57
  })
73
58
 
74
- watch(() => route.path, setLocale, { immediate: true })
59
+ watch(() => route.path, () => {
60
+ language.value = getPCLocationInfo().language
61
+ setLocale()
62
+ }, { immediate: true })
75
63
  </script>
76
64
 
77
65
  <template>
66
+ <app-header :language="language" />
78
67
  <div class="varlet-doc-index">
79
68
  <div class="varlet-doc-index__layout">
80
- <div class="varlet-doc-index__logo-container">
81
- <div class="varlet-doc-index__logo-background-mask"></div>
82
- <animation-box class="varlet-doc-index__logo" />
83
- </div>
69
+ <div class="varlet-doc-index__main-container">
70
+ <div class="varlet-doc-index__logo-container">
71
+ <div class="varlet-doc-index__logo-background-mask"></div>
72
+ <img class="varlet-doc-index__logo" :src="config.logo" alt="">
73
+ </div>
74
+ <div class="varlet-doc-index__info-container">
75
+ <div class="varlet-doc-index__title">{{ title }}</div>
76
+ <div class="varlet-doc-index__description">{{ indexPage.description[language] }}</div>
84
77
 
85
- <div class="varlet-doc-index__title">{{ title }}</div>
86
- <div class="varlet-doc-index__description">{{ indexPage.description[language] }}</div>
87
- <div class="varlet-doc-index__link-button-group">
88
- <var-button class="varlet-doc-index__link-button" text outline @click="goGithub">
89
- <var-icon name="github" size="24px" />
90
- </var-button>
91
- <var-button class="varlet-doc-index__link-button" text outline v-if="darkMode" @click="toggleTheme">
92
- <var-icon size="24px" :name="currentTheme === 'lightTheme' ? 'white-balance-sunny' : 'weather-night'" />
93
- </var-button>
94
- <var-button class="varlet-doc-index__link-button" text outline v-if="languages" @click="toggleLanguages">
95
- <var-icon name="translate" size="24px" />
96
- </var-button>
97
- <var-button class="varlet-doc-index__link-button" type="primary" style="line-height: 1.2" @click="getStar">
98
- <span class="varlet-doc-index__link-button-text">{{ indexPage.started[language] }}</span>
99
- <var-icon style="transform: rotate(-90deg)" name="arrow-down" size="24px" />
100
- </var-button>
78
+ <var-space size="large">
79
+ <var-button class="varlet-doc-index__link-button" type="primary" style="line-height: 1.2" @click="getStar">
80
+ {{ indexPage.started[language] }}
81
+ </var-button>
82
+ <var-button class="varlet-doc-index__github-button" type="primary" style="line-height: 1.2" @click="toGithub">
83
+ {{ indexPage.viewOnGithub[language] }}
84
+ </var-button>
85
+ </var-space>
86
+ </div>
101
87
  </div>
102
-
88
+
103
89
  <div class="varlet-doc-index__features" v-if="indexPage.features">
104
90
  <div class="varlet-doc-index__feature" v-for="feature in indexPage.features">
105
91
  <div class="varlet-doc-index__feature-name">{{ feature.name[language] }}</div>
@@ -107,6 +93,23 @@ watch(() => route.path, setLocale, { immediate: true })
107
93
  </div>
108
94
  </div>
109
95
 
96
+ <div class="varlet-doc-index__team-members" v-if="indexPage.teamMembers">
97
+ <div class="varlet-doc-index__team-members-title">{{ indexPage.teamMembers.label[language] }}</div>
98
+
99
+ <div class="varlet-doc-index__team-members-container">
100
+ <div class="varlet-doc-index__team-member" v-for="member in indexPage.teamMembers.members">
101
+ <img class="varlet-doc-index__team-member-avatar" :src="member.avatar">
102
+ <div class="varlet-doc-index__team-member-name">{{ member.name[language] }}</div>
103
+ <div class="varlet-doc-index__team-member-title">{{ member.title[language] }}</div>
104
+ <div class="varlet-doc-index__team-member-description">{{ member.description[language] }}</div>
105
+ <div class="varlet-doc-index__team-member-social">
106
+ <var-icon class="varlet-doc-index__team-member-social-icon" name="github" :size="24" @click="to(member.github)" v-if="member.github" />
107
+ <var-icon class="varlet-doc-index__team-member-social-icon" name="twitter" :size="24" @click="to(member.twitter)" v-if="member.twitter" />
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+
110
113
  <div class="varlet-doc-index__contributors" v-if="indexPage.contributors">
111
114
  <div class="varlet-doc-index__contributors-title">{{ indexPage.contributors.label[language] }}</div>
112
115
 
@@ -131,6 +134,272 @@ watch(() => route.path, setLocale, { immediate: true })
131
134
  </div>
132
135
  </template>
133
136
 
134
- <style lang="less" scoped>
135
- @import './index';
137
+ <style lang="less">
138
+ @keyframes logo-wave {
139
+ 0% {
140
+ transform: translate(8%, 8%);
141
+ }
142
+
143
+ 20% {
144
+ transform: translate(-8%, 8%);
145
+ }
146
+
147
+ 40% {
148
+ transform: translate(-8%, -8%);
149
+ }
150
+
151
+ 60% {
152
+ transform: translate(-2%, 8%);
153
+ }
154
+
155
+ 80% {
156
+ transform: translate(8%, -8%);
157
+ }
158
+
159
+ 100% {
160
+ transform: translate(8%, 8%);
161
+ }
162
+ }
163
+
164
+ .varlet-doc-index {
165
+ position: relative;
166
+ display: flex;
167
+ flex-direction: column;
168
+ align-items: center;
169
+ min-height: 100vh;
170
+ box-sizing: border-box;
171
+ background: var(--site-config-color-index-page-background);
172
+ padding-bottom: 100px;
173
+ min-width: 1050px;
174
+
175
+ &__layout {
176
+ display: flex;
177
+ flex-direction: column;
178
+ align-items: center;
179
+ padding: 170px 0;
180
+ max-width: 1200px;
181
+ transition: all .2s;
182
+ }
183
+
184
+ &__main-container {
185
+ display: flex;
186
+ }
187
+
188
+ &__info-container {
189
+ margin-left: 100px;
190
+ }
191
+
192
+ &__logo {
193
+ width: 100%;
194
+ height: 100%;
195
+ flex-shrink: 0;
196
+ z-index: 2;
197
+ }
198
+
199
+ &__logo-container {
200
+ position: relative;
201
+ display: flex;
202
+ justify-content: center;
203
+ width: 174px;
204
+ height: 174px;
205
+ margin-top: 8px;
206
+ }
207
+
208
+ &__logo-background-mask {
209
+ position: absolute;
210
+ left: -40px;
211
+ top: -40px;
212
+ bottom: -40px;
213
+ right: -40px;
214
+ background: var(--site-config-color-index-page-logo-mask-background);
215
+ transition: background-color .2s;
216
+ filter: blur(45px);
217
+ border-radius: 50%;
218
+ animation: logo-wave 6s infinite linear;
219
+ }
220
+
221
+ &__title {
222
+ font-size: 60px;
223
+ }
224
+
225
+ &__description {
226
+ max-width: 700px;
227
+ width: 90vw;
228
+ font-size: 20px;
229
+ line-height: 38px;
230
+ margin-top: 14px;
231
+ padding-left: 2px;
232
+ box-sizing: border-box;
233
+ color: var(--site-config-color-index-page-second-text-color);
234
+ }
235
+
236
+ &__link-button {
237
+ width: 170px !important;
238
+ height: 48px !important;
239
+ font-size: 19px !important;
240
+ transition: all .2s !important;
241
+ margin-top: 38px !important;
242
+ background: var(--site-config-color-index-page-get-started-button) !important;
243
+ }
244
+
245
+ &__github-button {
246
+ width: 170px !important;
247
+ height: 48px !important;
248
+ font-size: 19px !important;
249
+ transition: all .2s !important;
250
+ margin-top: 38px !important;
251
+ background: var(--site-config-color-index-page-github-button) !important;
252
+ }
253
+
254
+ &__features {
255
+ display: flex;
256
+ justify-content: center;
257
+ flex-wrap: wrap;
258
+ margin-top: 90px;
259
+ }
260
+
261
+ &__feature {
262
+ width: 300px;
263
+ margin: 12px;
264
+ padding: 20px;
265
+ border-radius: 10px;
266
+ background: var(--site-config-color-index-page-feature-background);
267
+ 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);
268
+ }
269
+
270
+ &__feature-description {
271
+ color: var(--site-config-color-index-page-second-text-color);
272
+ font-size: 14px;
273
+ margin-top: 10px;
274
+ line-height: 1.5;
275
+ }
276
+
277
+ &__contributors, &__team-members {
278
+ width: 100%;
279
+ display: flex;
280
+ flex-direction: column;
281
+ align-items: center;
282
+ margin-top: 90px;
283
+ }
284
+
285
+ &__contributors-title, &__team-members-title {
286
+ padding-top: 24px;
287
+ line-height: 32px;
288
+ font-size: 22px;
289
+ border-top: 2px solid var(--site-config-color-index-page-divider-color);
290
+ color: var(--site-config-color-index-page-second-text-color);
291
+ letter-spacing: 1px;
292
+ transition: all .2s;
293
+ }
294
+
295
+ &__team-members-container {
296
+ width: 1098px;
297
+ display: flex;
298
+ flex-wrap: wrap;
299
+ margin-top: 70px;
300
+ }
301
+
302
+ &__team-member {
303
+ display: flex;
304
+ flex-direction: column;
305
+ align-items: center;
306
+ width: 300px;
307
+ margin: 12px;
308
+ padding: 30px 20px;
309
+ border-radius: 10px;
310
+ background: var(--site-config-color-index-page-feature-background);
311
+ 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);
312
+
313
+
314
+ &-avatar {
315
+ width: 80px;
316
+ height: 80px;
317
+ border-radius: 50%;
318
+ }
319
+
320
+ &-name {
321
+ font-weight: bold;
322
+ font-size: 20px;
323
+ margin-top: 20px;
324
+ }
325
+
326
+ &-title, &-description {
327
+ color: var(--site-config-color-index-page-second-text-color);
328
+ font-size: 14px;
329
+ margin-top: 10px;
330
+ min-height: 40px;
331
+ text-align: center;
332
+ }
333
+
334
+ &-social {
335
+ margin-top: 10px;
336
+
337
+ &-icon {
338
+ margin: 10px 6px 0;
339
+ transition: all 0.25s !important;
340
+
341
+ &:hover {
342
+ opacity: 0.7;
343
+ transform: scale(1.25);
344
+ cursor: pointer;
345
+ }
346
+ }
347
+ }
348
+ }
349
+
350
+ &__contributors-link {
351
+ display: block;
352
+ margin-top: 80px;
353
+ width: 800px;
354
+ }
355
+
356
+ &__contributors-image {
357
+ display: block;
358
+ width: 100%;
359
+ }
360
+
361
+ &__sponsors {
362
+ display: flex;
363
+ flex-direction: column;
364
+ align-items: center;
365
+ margin-top: 90px;
366
+ }
367
+
368
+ &__sponsors-title {
369
+ padding-top: 24px;
370
+ line-height: 32px;
371
+ font-size: 22px;
372
+ border-top: 2px solid var(--site-config-color-index-page-divider-color);
373
+ color: var(--site-config-color-index-page-second-text-color);
374
+ letter-spacing: 1px;
375
+ transition: all .2s;
376
+ }
377
+
378
+ &__sponsors-link {
379
+ display: block;
380
+ margin-top: 50px;
381
+ width: 1100px;
382
+ }
383
+
384
+ &__sponsors-image {
385
+ display: block;
386
+ width: 100%;
387
+ }
388
+
389
+ &__footer {
390
+ position: absolute;
391
+ bottom: 0;
392
+ display: flex;
393
+ flex-direction: column;
394
+ justify-content: center;
395
+ align-items: center;
396
+ width: 100%;
397
+ height: 100px;
398
+ border-top: thin solid var(--site-config-color-border);
399
+ color: var(--site-config-color-index-page-second-text-color);
400
+ font-size: 14px;
401
+ line-height: 26px;
402
+ transition: all .2s;
403
+ }
404
+ }
136
405
  </style>
package/site/types.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type IContext } from "@varlet/ui"
2
+
3
+ export interface SiteContext extends IContext {
4
+ showPlayground: boolean
5
+ playgroundURL: string
6
+ }
@@ -42,6 +42,7 @@
42
42
  "@varlet/icons": "workspace:*",
43
43
  "@varlet/touch-emulator": "workspace:*",
44
44
  "@varlet/shared": "workspace:*",
45
+ "@varlet/ui": "workspace:*",
45
46
  "@vue/test-utils": "2.4.1",
46
47
  "@vue/runtime-core": "3.3.4",
47
48
  "@vitest/coverage-istanbul": "0.34.3",
@@ -1,106 +0,0 @@
1
- <template>
2
- <button
3
- v-ripple="{ disabled: disabled || !ripple }"
4
- :class="
5
- classes(
6
- n(),
7
- 'var-site--box',
8
- n(`--${size}`),
9
- [block, `var-site--flex ${n('--block')}`, 'var-site--inline-flex'],
10
- [disabled, n('--disabled')],
11
- [text, `${n(`--text-${type}`)} ${n('--text')}`, `${n(`--${type}`)} var-site-elevation--2`],
12
- [text && disabled, n('--text-disabled')],
13
- [round, n('--round')],
14
- [outline, n('--outline')]
15
- )
16
- "
17
- :style="{
18
- color: textColor,
19
- background: color,
20
- }"
21
- :disabled="disabled"
22
- @click="handleClick"
23
- @touchstart="handleTouchstart"
24
- >
25
- <var-loading
26
- :class="n('loading')"
27
- var-site-button-cover
28
- :color="loadingColor"
29
- :type="loadingType"
30
- :size="loadingSize"
31
- :radius="loadingRadius"
32
- v-if="loading || pending"
33
- />
34
- <div :class="classes(n('content'), [loading || pending, n('--hidden')])">
35
- <slot />
36
- </div>
37
- </button>
38
- </template>
39
-
40
- <script lang="ts">
41
- import Ripple from '../ripple'
42
- import VarLoading from '../loading'
43
- import { defineComponent, ref } from 'vue'
44
- import { props } from './props'
45
- import { createNamespace } from '../utils/components'
46
- import type { Ref } from 'vue'
47
-
48
- const { n, classes } = createNamespace('button')
49
-
50
- export default defineComponent({
51
- name: 'VarButton',
52
- components: {
53
- VarLoading,
54
- },
55
- directives: { Ripple },
56
- props,
57
- setup(props) {
58
- const pending: Ref<boolean> = ref(false)
59
-
60
- const attemptAutoLoading = (result: any) => {
61
- if (props.autoLoading) {
62
- pending.value = true
63
- Promise.resolve(result).finally(() => {
64
- pending.value = false
65
- })
66
- }
67
- }
68
-
69
- const handleClick = (e: Event) => {
70
- const { loading, disabled, onClick } = props
71
-
72
- if (!onClick || loading || disabled || pending.value) {
73
- return
74
- }
75
-
76
- attemptAutoLoading(onClick(e))
77
- }
78
-
79
- const handleTouchstart = (e: Event) => {
80
- const { loading, disabled, onTouchstart } = props
81
-
82
- if (!onTouchstart || loading || disabled || pending.value) {
83
- return
84
- }
85
-
86
- attemptAutoLoading(onTouchstart(e))
87
- }
88
-
89
- return {
90
- n,
91
- classes,
92
- pending,
93
- handleClick,
94
- handleTouchstart,
95
- }
96
- },
97
- })
98
- </script>
99
-
100
- <style lang="less">
101
- @import '../styles/common';
102
- @import '../styles/elevation';
103
- @import '../ripple/ripple';
104
- @import '../loading/loading';
105
- @import './button';
106
- </style>