@varlet/cli 1.27.8 → 1.27.9-alpha.1653036733481
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/generators/base/varlet.config.js +2 -0
- package/package.json +6 -5
- package/site/mobile/App.vue +32 -7
- package/site/mobile/components/AppHome.vue +17 -13
- package/site/{components → mobile/components}/app-bar/AppBar.vue +0 -0
- package/site/{components → mobile/components}/app-bar/appBar.less +0 -0
- package/site/{components → mobile/components}/app-bar/index.ts +0 -0
- package/site/{components → mobile/components}/app-bar/props.ts +0 -0
- package/site/mobile/components/styles/common.less +64 -0
- package/site/mobile/components/styles/elevation.less +126 -0
- package/site/mobile/components/styles/var.less +27 -0
- package/site/mobile/main.ts +1 -1
- package/site/pc/Layout.vue +1 -0
- package/site/pc/components/AnimationBox.vue +5 -1
- package/site/pc/components/AppHeader.vue +78 -14
- package/site/pc/components/LogoAnimation.vue +28 -19
- package/varlet.default.config.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.9-alpha.1653036733481",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"bin": {
|
|
6
6
|
"varlet-cli": "./lib/index.js"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@babel/helper-plugin-utils": "^7.14.5",
|
|
34
34
|
"@babel/preset-env": "^7.14.8",
|
|
35
35
|
"@babel/preset-typescript": "^7.14.5",
|
|
36
|
-
"@varlet/icons": "1.27.
|
|
37
|
-
"@varlet/markdown-vite-plugin": "1.27.
|
|
38
|
-
"@varlet/touch-emulator": "1.27.
|
|
36
|
+
"@varlet/icons": "1.27.9-alpha.1653036733481",
|
|
37
|
+
"@varlet/markdown-vite-plugin": "1.27.9-alpha.1653036733481",
|
|
38
|
+
"@varlet/touch-emulator": "1.27.9-alpha.1653036733481",
|
|
39
39
|
"@vitejs/plugin-vue": "2.2.0",
|
|
40
40
|
"@vitejs/plugin-vue-jsx": "1.3.5",
|
|
41
41
|
"@vue/babel-plugin-jsx": "1.1.1",
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@types/babel__core": "^7.1.12",
|
|
70
70
|
"@types/fs-extra": "^9.0.2",
|
|
71
|
+
"@types/glob": "^7.1.3",
|
|
71
72
|
"@types/hash-sum": "^1.0.0",
|
|
72
73
|
"@types/jest": "^26.0.15",
|
|
73
74
|
"@types/lodash": "^4.14.174",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
"@types/semver": "^7.3.9"
|
|
76
77
|
},
|
|
77
78
|
"peerDependencies": {
|
|
78
|
-
"@varlet/touch-emulator": "1.27.
|
|
79
|
+
"@varlet/touch-emulator": "1.27.9-alpha.1653036733481",
|
|
79
80
|
"@vue/test-utils": "^2.0.0-rc.6",
|
|
80
81
|
"clipboard": "^2.0.6",
|
|
81
82
|
"live-server": "^1.2.1",
|
package/site/mobile/App.vue
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<var-site-app-bar class="app-bar" title-position="left" :title="bigCamelizeComponentName">
|
|
5
5
|
<template #left>
|
|
6
6
|
<var-site-button v-if="showBackIcon" text round @click="back" color="transparent" text-color="#fff">
|
|
7
|
-
<var-site-icon name="chevron-left"
|
|
7
|
+
<var-site-icon name="chevron-left" class="arrow-left" style="margin-top: 1px" />
|
|
8
8
|
</var-site-button>
|
|
9
9
|
<var-site-button
|
|
10
10
|
v-if="!showBackIcon && github"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
color="transparent"
|
|
16
16
|
text-color="#fff"
|
|
17
17
|
>
|
|
18
|
-
<var-site-icon name="github"
|
|
18
|
+
<var-site-icon name="github" class="github" style="margin-top: 1px" />
|
|
19
19
|
</var-site-button>
|
|
20
20
|
</template>
|
|
21
21
|
<template #right>
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
@click="toggleTheme"
|
|
32
32
|
>
|
|
33
33
|
<var-site-icon
|
|
34
|
-
|
|
34
|
+
class="theme"
|
|
35
35
|
color="#fff"
|
|
36
36
|
:name="currentThemes === 'themes' ? 'white-balance-sunny' : 'weather-night'"
|
|
37
37
|
/>
|
|
38
38
|
</var-site-button>
|
|
39
39
|
<var-site-button
|
|
40
|
-
|
|
40
|
+
class="i18n-button"
|
|
41
41
|
text
|
|
42
42
|
color="transparent"
|
|
43
43
|
text-color="#fff"
|
|
44
44
|
@click.stop="showMenu = true"
|
|
45
45
|
v-if="languages"
|
|
46
46
|
>
|
|
47
|
-
<var-site-icon name="translate"
|
|
48
|
-
<var-site-icon name="chevron-down"
|
|
47
|
+
<var-site-icon name="translate" class="i18n" />
|
|
48
|
+
<var-site-icon name="chevron-down" class="arrow-down" />
|
|
49
49
|
</var-site-button>
|
|
50
50
|
</template>
|
|
51
51
|
</var-site-app-bar>
|
|
@@ -200,6 +200,7 @@ body {
|
|
|
200
200
|
margin: 0;
|
|
201
201
|
padding: 0;
|
|
202
202
|
min-height: 100%;
|
|
203
|
+
font-size: 16px;
|
|
203
204
|
font-family: 'Roboto', sans-serif;
|
|
204
205
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
205
206
|
background: var(--site-config-color-bar);
|
|
@@ -246,7 +247,7 @@ header {
|
|
|
246
247
|
}
|
|
247
248
|
|
|
248
249
|
.router-view__block {
|
|
249
|
-
padding:
|
|
250
|
+
padding: 55px 12px 15px;
|
|
250
251
|
}
|
|
251
252
|
|
|
252
253
|
* {
|
|
@@ -263,4 +264,28 @@ header {
|
|
|
263
264
|
background: var(--site-config-color-mobile-language-active-background);
|
|
264
265
|
}
|
|
265
266
|
}
|
|
267
|
+
|
|
268
|
+
.arrow-left {
|
|
269
|
+
font-size: 28px !important;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.github {
|
|
273
|
+
font-size: 28px !important;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.theme {
|
|
277
|
+
font-size: 24px !important;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.i18n {
|
|
281
|
+
font-size: 24px !important;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.arrow-down {
|
|
285
|
+
font-size: 22px !important;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.i18n-button {
|
|
289
|
+
padding-right: 6px !important;
|
|
290
|
+
}
|
|
266
291
|
</style>
|
|
@@ -6,19 +6,17 @@
|
|
|
6
6
|
</h1>
|
|
7
7
|
<h2 class="varlet-home__desc">{{ description[lang] }}</h2>
|
|
8
8
|
</div>
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
<div
|
|
11
|
+
class="varlet-home__cell"
|
|
10
12
|
v-for="component in components"
|
|
11
13
|
:key="component.text"
|
|
12
|
-
@click="toComponent(component)"
|
|
13
14
|
v-ripple
|
|
15
|
+
@click="toComponent(component)"
|
|
14
16
|
>
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<template #default>
|
|
19
|
-
{{ component.text[lang] }}
|
|
20
|
-
</template>
|
|
21
|
-
</var-site-cell>
|
|
17
|
+
<span>{{ component.text[lang] }}</span>
|
|
18
|
+
<var-site-icon name="chevron-right" size="14" />
|
|
19
|
+
</div>
|
|
22
20
|
</template>
|
|
23
21
|
|
|
24
22
|
<script lang='ts'>
|
|
@@ -85,7 +83,7 @@ export default {
|
|
|
85
83
|
|
|
86
84
|
.varlet-home__title {
|
|
87
85
|
margin: 0 0 16px;
|
|
88
|
-
font-size:
|
|
86
|
+
font-size: 34px;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
89
|
.varlet-home__title,
|
|
@@ -103,8 +101,8 @@ export default {
|
|
|
103
101
|
}
|
|
104
102
|
|
|
105
103
|
.varlet-home__image {
|
|
106
|
-
width:
|
|
107
|
-
height:
|
|
104
|
+
width: 36px;
|
|
105
|
+
height: 36px;
|
|
108
106
|
}
|
|
109
107
|
|
|
110
108
|
.varlet-home__image,
|
|
@@ -117,7 +115,13 @@ export default {
|
|
|
117
115
|
margin-left: 16px;
|
|
118
116
|
}
|
|
119
117
|
|
|
120
|
-
.
|
|
118
|
+
.varlet-home__cell {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
min-height: 40px;
|
|
123
|
+
padding: 10px 12px;
|
|
124
|
+
font-size: 15px;
|
|
121
125
|
cursor: pointer;
|
|
122
126
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
123
127
|
transition: all 0.3s;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@import './var';
|
|
2
|
+
|
|
3
|
+
.var-site {
|
|
4
|
+
&--box {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
|
|
7
|
+
* {
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&--relative {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&--absolute {
|
|
17
|
+
position: absolute;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--hidden {
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&--lock {
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&--block {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--inline-block {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&--flex {
|
|
37
|
+
display: flex;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--inline-flex {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:root {
|
|
46
|
+
--site-font-size-xs: @site-font-size-xs;
|
|
47
|
+
--site-font-size-sm: @site-font-size-sm;
|
|
48
|
+
--site-font-size-md: @site-font-size-md;
|
|
49
|
+
--site-font-size-lg: @site-font-size-lg;
|
|
50
|
+
--site-icon-size-xs: @site-icon-size-xs;
|
|
51
|
+
--site-icon-size-sm: @site-icon-size-sm;
|
|
52
|
+
--site-icon-size-md: @site-icon-size-md;
|
|
53
|
+
--site-icon-size-lg: @site-icon-size-lg;
|
|
54
|
+
--site-color-primary: @site-color-primary;
|
|
55
|
+
--site-color-info: @site-color-info;
|
|
56
|
+
--site-color-success: @site-color-success;
|
|
57
|
+
--site-color-warning: @site-color-warning;
|
|
58
|
+
--site-color-danger: @site-color-danger;
|
|
59
|
+
--site-color-disabled: @site-color-disabled;
|
|
60
|
+
--site-cubic-bezier: @site-cubic-bezier;
|
|
61
|
+
--site-shadow-key-umbra-opacity: @site-shadow-key-umbra-opacity;
|
|
62
|
+
--site-shadow-key-penumbra-opacity: @site-shadow-key-penumbra-opacity;
|
|
63
|
+
--site-shadow-key-ambient-opacity: @site-shadow-key-ambient-opacity;
|
|
64
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
.var-site-elevation {
|
|
2
|
+
&--0 {
|
|
3
|
+
box-shadow: 0 0 0 0 var(--site-shadow-key-umbra-opacity), 0 0 0 0 var(--site-shadow-key-penumbra-opacity),
|
|
4
|
+
0 0 0 0 var(--site-shadow-key-ambient-opacity);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
&--1 {
|
|
8
|
+
box-shadow: 0 2px 1px -1px var(--site-shadow-key-umbra-opacity), 0 1px 1px 0 var(--site-shadow-key-penumbra-opacity),
|
|
9
|
+
0 1px 3px 0 var(--site-shadow-key-ambient-opacity);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&--2 {
|
|
13
|
+
box-shadow: 0 3px 1px -2px var(--site-shadow-key-umbra-opacity), 0 2px 2px 0 var(--site-shadow-key-penumbra-opacity),
|
|
14
|
+
0 1px 5px 0 var(--site-shadow-key-ambient-opacity);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--3 {
|
|
18
|
+
box-shadow: 0 3px 3px -2px var(--site-shadow-key-umbra-opacity), 0 3px 4px 0 var(--site-shadow-key-penumbra-opacity),
|
|
19
|
+
0 1px 8px 0 var(--site-shadow-key-ambient-opacity);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--4 {
|
|
23
|
+
box-shadow: 0 2px 4px -1px var(--site-shadow-key-umbra-opacity), 0 4px 5px 0 var(--site-shadow-key-penumbra-opacity),
|
|
24
|
+
0 1px 10px 0 var(--site-shadow-key-ambient-opacity);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&--5 {
|
|
28
|
+
box-shadow: 0 3px 5px -1px var(--site-shadow-key-umbra-opacity), 0 5px 8px 0 var(--site-shadow-key-penumbra-opacity),
|
|
29
|
+
0 1px 14px 0 var(--site-shadow-key-ambient-opacity);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--6 {
|
|
33
|
+
box-shadow: 0 3px 5px -1px var(--site-shadow-key-umbra-opacity), 0 6px 10px 0 var(--site-shadow-key-penumbra-opacity),
|
|
34
|
+
0 1px 18px 0 var(--site-shadow-key-ambient-opacity);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--7 {
|
|
38
|
+
box-shadow: 0 4px 5px -2px var(--site-shadow-key-umbra-opacity), 0 7px 10px 1px var(--site-shadow-key-penumbra-opacity),
|
|
39
|
+
0 2px 16px 1px var(--site-shadow-key-ambient-opacity);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--8 {
|
|
43
|
+
box-shadow: 0 5px 5px -3px var(--site-shadow-key-umbra-opacity), 0 8px 10px 1px var(--site-shadow-key-penumbra-opacity),
|
|
44
|
+
0 3px 14px 2px var(--site-shadow-key-ambient-opacity);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&--9 {
|
|
48
|
+
box-shadow: 0 5px 6px -3px var(--site-shadow-key-umbra-opacity), 0 9px 12px 1px var(--site-shadow-key-penumbra-opacity),
|
|
49
|
+
0 3px 16px 2px var(--site-shadow-key-ambient-opacity);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&--10 {
|
|
53
|
+
box-shadow: 0 6px 6px -3px var(--site-shadow-key-umbra-opacity), 0 10px 14px 1px var(--site-shadow-key-penumbra-opacity),
|
|
54
|
+
0 4px 18px 3px var(--site-shadow-key-ambient-opacity);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&--11 {
|
|
58
|
+
box-shadow: 0 6px 7px -4px var(--site-shadow-key-umbra-opacity), 0 11px 15px 1px var(--site-shadow-key-penumbra-opacity),
|
|
59
|
+
0 4px 20px 3px var(--site-shadow-key-ambient-opacity);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&--12 {
|
|
63
|
+
box-shadow: 0 7px 8px -4px var(--site-shadow-key-umbra-opacity), 0 12px 17px 2px var(--site-shadow-key-penumbra-opacity),
|
|
64
|
+
0 5px 22px 4px var(--site-shadow-key-ambient-opacity);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&--13 {
|
|
68
|
+
box-shadow: 0 7px 8px -4px var(--site-shadow-key-umbra-opacity), 0 13px 19px 2px var(--site-shadow-key-penumbra-opacity),
|
|
69
|
+
0 5px 24px 4px var(--site-shadow-key-ambient-opacity);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&--14 {
|
|
73
|
+
box-shadow: 0 7px 9px -4px var(--site-shadow-key-umbra-opacity), 0 14px 21px 2px var(--site-shadow-key-penumbra-opacity),
|
|
74
|
+
0 5px 26px 4px var(--site-shadow-key-ambient-opacity);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&--15 {
|
|
78
|
+
box-shadow: 0 8px 9px -5px var(--site-shadow-key-umbra-opacity), 0 15px 22px 2px var(--site-shadow-key-penumbra-opacity),
|
|
79
|
+
0 6px 28px 5px var(--site-shadow-key-ambient-opacity);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&--16 {
|
|
83
|
+
box-shadow: 0 8px 10px -5px var(--site-shadow-key-umbra-opacity), 0 16px 24px 2px var(--site-shadow-key-penumbra-opacity),
|
|
84
|
+
0 6px 30px 5px var(--site-shadow-key-ambient-opacity);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&--17 {
|
|
88
|
+
box-shadow: 0 8px 11px -5px var(--site-shadow-key-umbra-opacity), 0 17px 26px 2px var(--site-shadow-key-penumbra-opacity),
|
|
89
|
+
0 6px 32px 5px var(--site-shadow-key-ambient-opacity);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&--18 {
|
|
93
|
+
box-shadow: 0 9px 11px -5px var(--site-shadow-key-umbra-opacity), 0 18px 28px 2px var(--site-shadow-key-penumbra-opacity),
|
|
94
|
+
0 7px 34px 6px var(--site-shadow-key-ambient-opacity);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&--19 {
|
|
98
|
+
box-shadow: 0 9px 12px -6px var(--site-shadow-key-umbra-opacity), 0 19px 29px 2px var(--site-shadow-key-penumbra-opacity),
|
|
99
|
+
0 7px 36px 6px var(--site-shadow-key-ambient-opacity);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&--20 {
|
|
103
|
+
box-shadow: 0 10px 13px -6px var(--site-shadow-key-umbra-opacity), 0 20px 31px 3px var(--site-shadow-key-penumbra-opacity),
|
|
104
|
+
0 8px 38px 7px var(--site-shadow-key-ambient-opacity);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&--21 {
|
|
108
|
+
box-shadow: 0 10px 13px -6px var(--site-shadow-key-umbra-opacity), 0 21px 33px 3px var(--site-shadow-key-penumbra-opacity),
|
|
109
|
+
0 8px 40px 7px var(--site-shadow-key-ambient-opacity);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&--22 {
|
|
113
|
+
box-shadow: 0 10px 14px -6px var(--site-shadow-key-umbra-opacity), 0 22px 35px 3px var(--site-shadow-key-penumbra-opacity),
|
|
114
|
+
0 8px 42px 7px var(--site-shadow-key-ambient-opacity);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&--23 {
|
|
118
|
+
box-shadow: 0 11px 14px -7px var(--site-shadow-key-umbra-opacity), 0 23px 36px 3px var(--site-shadow-key-penumbra-opacity),
|
|
119
|
+
0 9px 44px 8px var(--site-shadow-key-ambient-opacity);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&--24 {
|
|
123
|
+
box-shadow: 0 11px 15px -7px var(--site-shadow-key-umbra-opacity), 0 24px 38px 3px var(--site-shadow-key-penumbra-opacity),
|
|
124
|
+
0 9px 46px 8px var(--site-shadow-key-ambient-opacity);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// 文字
|
|
2
|
+
@site-font-size-xs: 10px;
|
|
3
|
+
@site-font-size-sm: 12px;
|
|
4
|
+
@site-font-size-md: 14px;
|
|
5
|
+
@site-font-size-lg: 16px;
|
|
6
|
+
|
|
7
|
+
// 图标
|
|
8
|
+
@site-icon-size-xs: 16px;
|
|
9
|
+
@site-icon-size-sm: 18px;
|
|
10
|
+
@site-icon-size-md: 20px;
|
|
11
|
+
@site-icon-size-lg: 22px;
|
|
12
|
+
|
|
13
|
+
//颜色
|
|
14
|
+
@site-color-primary: #3a7afe;
|
|
15
|
+
@site-color-info: #00afef;
|
|
16
|
+
@site-color-success: #00c48f;
|
|
17
|
+
@site-color-warning: #ff9f00;
|
|
18
|
+
@site-color-danger: #f44336;
|
|
19
|
+
@site-color-disabled: #e0e0e0;
|
|
20
|
+
|
|
21
|
+
// 动画函数
|
|
22
|
+
@site-cubic-bezier: cubic-bezier(0.25, 0.8, 0.5, 1);
|
|
23
|
+
|
|
24
|
+
// 阴影
|
|
25
|
+
@site-shadow-key-umbra-opacity: rgba(0, 0, 0, 0.2);
|
|
26
|
+
@site-shadow-key-penumbra-opacity: rgba(0, 0, 0, 0.14);
|
|
27
|
+
@site-shadow-key-ambient-opacity: rgba(0, 0, 0, 0.12);
|
package/site/mobile/main.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { createApp } from 'vue'
|
|
|
6
6
|
import { createRouter, createWebHashHistory } from 'vue-router'
|
|
7
7
|
|
|
8
8
|
import Icon from '../components/icon'
|
|
9
|
-
import AppBar from '
|
|
9
|
+
import AppBar from './components/app-bar'
|
|
10
10
|
import Button from '../components/button'
|
|
11
11
|
import Cell from '../components/cell'
|
|
12
12
|
import Ripple from '../components/ripple'
|
package/site/pc/Layout.vue
CHANGED
|
@@ -15,7 +15,11 @@ export default defineComponent({
|
|
|
15
15
|
mutationObserver.value = new MutationObserver(() => {
|
|
16
16
|
animationElClientRect.value = varletLogoAnimationRef?.value?.getBoundingClientRect();
|
|
17
17
|
});
|
|
18
|
-
mutationObserver.value.observe(document.body, {
|
|
18
|
+
mutationObserver.value.observe(varletLogoAnimationRef.value?.parentNode?.parentNode || document.body, {
|
|
19
|
+
attributes: true,
|
|
20
|
+
subtree: true,
|
|
21
|
+
childList:true
|
|
22
|
+
});
|
|
19
23
|
})
|
|
20
24
|
|
|
21
25
|
onBeforeUnmount(() => {
|
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="varlet-site-header">
|
|
3
|
-
<div class="varlet-site-header__lead"
|
|
4
|
-
<animation-box class="varlet-site-header__logo" />
|
|
5
|
-
<div class="varlet-site-header__title" v-if="title">{{ title }}</div>
|
|
3
|
+
<div class="varlet-site-header__lead">
|
|
4
|
+
<animation-box class="varlet-site-header__logo" @click="backRoot" />
|
|
5
|
+
<div class="varlet-site-header__title" v-if="title" @click="backRoot">{{ title }}</div>
|
|
6
|
+
<div
|
|
7
|
+
class="varlet-site-header__versions"
|
|
8
|
+
@mouseenter="isOpenVersionsMenu = true"
|
|
9
|
+
@mouseleave="isOpenVersionsMenu = false"
|
|
10
|
+
v-if="versions"
|
|
11
|
+
>
|
|
12
|
+
{{ nowVersion }}
|
|
13
|
+
<var-site-icon name="chevron-down" />
|
|
14
|
+
<transition name="fade">
|
|
15
|
+
<div
|
|
16
|
+
class="varlet-site-header__animation-list varlet-site-header__animation-versions var-site-elevation--5"
|
|
17
|
+
v-show="isOpenVersionsMenu"
|
|
18
|
+
:style="{ pointerEvents: isOpenVersionsMenu ? 'auto' : 'none' }"
|
|
19
|
+
>
|
|
20
|
+
<var-site-cell
|
|
21
|
+
v-for="(value, key) in nonEmptyVersions"
|
|
22
|
+
v-ripple
|
|
23
|
+
:key="key"
|
|
24
|
+
:class="{ 'varlet-site-header__animation-list--active': nowVersion === key }"
|
|
25
|
+
@click="open(value)"
|
|
26
|
+
>{{ key }}
|
|
27
|
+
</var-site-cell>
|
|
28
|
+
</div>
|
|
29
|
+
</transition>
|
|
30
|
+
</div>
|
|
6
31
|
</div>
|
|
7
32
|
|
|
8
33
|
<div class="varlet-site-header__tail">
|
|
@@ -24,29 +49,30 @@
|
|
|
24
49
|
</div>
|
|
25
50
|
<div
|
|
26
51
|
class="varlet-site-header__language"
|
|
27
|
-
@mouseenter="
|
|
28
|
-
@mouseleave="
|
|
52
|
+
@mouseenter="isOpenLanguageMenu = true"
|
|
53
|
+
@mouseleave="isOpenLanguageMenu = false"
|
|
29
54
|
v-if="languages"
|
|
30
55
|
>
|
|
31
56
|
<var-site-icon name="translate" size="26px" />
|
|
32
57
|
<var-site-icon name="chevron-down" />
|
|
33
58
|
<transition name="fade">
|
|
34
59
|
<div
|
|
35
|
-
class="varlet-site-
|
|
36
|
-
v-show="
|
|
37
|
-
:style="{ pointerEvents:
|
|
60
|
+
class="varlet-site-header__animation-list var-site-elevation--5"
|
|
61
|
+
v-show="isOpenLanguageMenu"
|
|
62
|
+
:style="{ pointerEvents: isOpenLanguageMenu ? 'auto' : 'none' }"
|
|
38
63
|
>
|
|
39
64
|
<var-site-cell
|
|
40
65
|
v-for="(value, key) in nonEmptyLanguages"
|
|
41
66
|
v-ripple
|
|
42
67
|
:key="key"
|
|
43
|
-
:class="{ 'varlet-site-
|
|
68
|
+
:class="{ 'varlet-site-header__animation-list--active': language === key }"
|
|
44
69
|
@click="handleLanguageChange(key)"
|
|
45
70
|
>{{ value }}
|
|
46
71
|
</var-site-cell>
|
|
47
72
|
</div>
|
|
48
73
|
</transition>
|
|
49
74
|
</div>
|
|
75
|
+
|
|
50
76
|
</div>
|
|
51
77
|
</div>
|
|
52
78
|
</template>
|
|
@@ -66,22 +92,26 @@ export default defineComponent({
|
|
|
66
92
|
props: {
|
|
67
93
|
language: {
|
|
68
94
|
type: String,
|
|
69
|
-
}
|
|
95
|
+
}
|
|
70
96
|
},
|
|
71
97
|
setup() {
|
|
72
98
|
const title: Ref<string> = ref(get(config, 'title'))
|
|
73
99
|
const logo: Ref<string> = ref(get(config, 'logo'))
|
|
74
100
|
const themesKey = get(config, 'themesKey')
|
|
75
101
|
const languages: Ref<Record<string, string>> = ref(get(config, 'pc.header.i18n'))
|
|
102
|
+
const nowVersion: Ref<string> = ref(get(config, 'pc.header.versions.default'))
|
|
103
|
+
const versions: Ref<Record<string, string>> = ref(get(config, 'pc.header.versions.item'))
|
|
76
104
|
const playground: Ref<string> = ref(get(config, 'pc.header.playground'))
|
|
77
105
|
const github: Ref<string> = ref(get(config, 'pc.header.github'))
|
|
78
106
|
const redirect = get(config, 'pc.redirect')
|
|
79
107
|
const darkMode: Ref<boolean> = ref(get(config, 'pc.header.darkMode'))
|
|
80
108
|
const currentThemes = ref(getBrowserThemes(themesKey))
|
|
81
109
|
|
|
82
|
-
const
|
|
110
|
+
const isOpenLanguageMenu: Ref<boolean> = ref(false)
|
|
111
|
+
const isOpenVersionsMenu: Ref<boolean> = ref(false)
|
|
83
112
|
const router = useRouter()
|
|
84
113
|
const nonEmptyLanguages: ComputedRef<Record<string, string>> = computed(() => removeEmpty(languages.value))
|
|
114
|
+
const nonEmptyVersions: ComputedRef<Record<string, string>> = computed(() => removeEmpty(versions.value))
|
|
85
115
|
|
|
86
116
|
const backRoot = () => {
|
|
87
117
|
const { language: lang } = getPCLocationInfo()
|
|
@@ -91,7 +121,7 @@ export default defineComponent({
|
|
|
91
121
|
const handleLanguageChange = (language: string) => {
|
|
92
122
|
const { menuName } = getPCLocationInfo()
|
|
93
123
|
router.replace(`/${language}/${menuName}`)
|
|
94
|
-
|
|
124
|
+
isOpenLanguageMenu.value = false
|
|
95
125
|
}
|
|
96
126
|
|
|
97
127
|
const setCurrentThemes = (themes: 'themes' | 'darkThemes') => {
|
|
@@ -108,6 +138,14 @@ export default defineComponent({
|
|
|
108
138
|
;(document.getElementById('mobile') as HTMLIFrameElement).contentWindow!.postMessage(getThemesMessage(), '*')
|
|
109
139
|
}
|
|
110
140
|
|
|
141
|
+
const open = (value: string) => {
|
|
142
|
+
if (value !== nowVersion.value) {
|
|
143
|
+
setTimeout(() => {
|
|
144
|
+
window.location.href = value
|
|
145
|
+
}, 350);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
111
149
|
watchThemes((themes, from) => {
|
|
112
150
|
from === 'mobile' && setCurrentThemes(themes)
|
|
113
151
|
})
|
|
@@ -118,13 +156,18 @@ export default defineComponent({
|
|
|
118
156
|
return {
|
|
119
157
|
logo,
|
|
120
158
|
title,
|
|
159
|
+
nowVersion,
|
|
121
160
|
languages,
|
|
161
|
+
versions,
|
|
122
162
|
nonEmptyLanguages,
|
|
163
|
+
nonEmptyVersions,
|
|
123
164
|
playground,
|
|
124
165
|
github,
|
|
125
|
-
|
|
166
|
+
isOpenLanguageMenu,
|
|
167
|
+
isOpenVersionsMenu,
|
|
126
168
|
darkMode,
|
|
127
169
|
currentThemes,
|
|
170
|
+
open,
|
|
128
171
|
backRoot,
|
|
129
172
|
handleLanguageChange,
|
|
130
173
|
toggleTheme,
|
|
@@ -198,6 +241,7 @@ export default defineComponent({
|
|
|
198
241
|
|
|
199
242
|
&__title {
|
|
200
243
|
font-size: 22px;
|
|
244
|
+
margin-right: 12px;
|
|
201
245
|
}
|
|
202
246
|
|
|
203
247
|
&__tail {
|
|
@@ -226,6 +270,22 @@ export default defineComponent({
|
|
|
226
270
|
}
|
|
227
271
|
}
|
|
228
272
|
|
|
273
|
+
&__versions {
|
|
274
|
+
border-radius: 3px;
|
|
275
|
+
height: 40px;
|
|
276
|
+
display: flex;
|
|
277
|
+
align-items: center;
|
|
278
|
+
padding-right: 10px;
|
|
279
|
+
padding-left: 18px;
|
|
280
|
+
position: relative;
|
|
281
|
+
cursor: pointer;
|
|
282
|
+
transition: background-color 0.25s;
|
|
283
|
+
|
|
284
|
+
&:hover {
|
|
285
|
+
background: var(--site-config-color-nav-button-hover-background);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
229
289
|
&__link {
|
|
230
290
|
border-radius: 50%;
|
|
231
291
|
width: 42px;
|
|
@@ -264,7 +324,7 @@ export default defineComponent({
|
|
|
264
324
|
}
|
|
265
325
|
}
|
|
266
326
|
|
|
267
|
-
&
|
|
327
|
+
&__animation-list {
|
|
268
328
|
background: var(--site-config-color-bar);
|
|
269
329
|
cursor: pointer;
|
|
270
330
|
color: var(--site-config-color-text);
|
|
@@ -287,5 +347,9 @@ export default defineComponent({
|
|
|
287
347
|
color: var(--site-config-color-pc-language-active);
|
|
288
348
|
}
|
|
289
349
|
}
|
|
350
|
+
|
|
351
|
+
&__animation-versions {
|
|
352
|
+
left: -7px;
|
|
353
|
+
}
|
|
290
354
|
}
|
|
291
355
|
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import config from '@config'
|
|
3
3
|
import { get } from 'lodash-es'
|
|
4
|
-
import { computed, defineComponent,
|
|
4
|
+
import { computed, defineComponent, onMounted, onBeforeUnmount, ref, watch, nextTick } from 'vue'
|
|
5
5
|
import { animationBoxData, animationEl, animationElClientRect } from '../floating'
|
|
6
6
|
import type { Ref, StyleValue } from 'vue'
|
|
7
7
|
import { useRouter } from 'vue-router'
|
|
@@ -27,38 +27,34 @@ export default defineComponent({
|
|
|
27
27
|
}))
|
|
28
28
|
|
|
29
29
|
const router = useRouter()
|
|
30
|
-
router.beforeEach(async () => {
|
|
31
|
-
if (!floatingState.value) {
|
|
30
|
+
router.beforeEach(async (to: any, from: any) => {
|
|
31
|
+
if (!floatingState.value && from.path !== '/') {
|
|
32
32
|
floatingState.value = true
|
|
33
33
|
}
|
|
34
|
-
await nextTick()
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
onBeforeMount(() => {
|
|
38
|
-
floatingState.value = false
|
|
34
|
+
await nextTick()
|
|
39
35
|
})
|
|
40
36
|
|
|
41
37
|
onMounted(() => {
|
|
42
|
-
window.addEventListener('resize', resetPosition, false)
|
|
38
|
+
window.addEventListener('resize', resetPosition, false)
|
|
43
39
|
})
|
|
44
40
|
|
|
45
41
|
onBeforeUnmount(() => {
|
|
46
42
|
resetTimer && clearTimeout(resetTimer)
|
|
47
|
-
window.removeEventListener('resize', resetPosition)
|
|
43
|
+
window.removeEventListener('resize', resetPosition)
|
|
48
44
|
})
|
|
49
45
|
|
|
50
46
|
const land = () => {
|
|
51
|
-
floatingState.value = false
|
|
47
|
+
floatingState.value = false
|
|
52
48
|
}
|
|
53
49
|
|
|
54
|
-
let resetTimer: number
|
|
50
|
+
let resetTimer: number
|
|
55
51
|
|
|
56
52
|
const resetPosition = async () => {
|
|
57
53
|
if (floatingState.value) {
|
|
58
54
|
floatingState.value = false
|
|
59
|
-
await nextTick()
|
|
55
|
+
await nextTick()
|
|
60
56
|
}
|
|
61
|
-
clearTimeout(resetTimer)
|
|
57
|
+
clearTimeout(resetTimer)
|
|
62
58
|
const newBRect = animationEl.value?.getBoundingClientRect()
|
|
63
59
|
if (newBRect) {
|
|
64
60
|
resetTimer = window.setTimeout(() => {
|
|
@@ -73,7 +69,7 @@ export default defineComponent({
|
|
|
73
69
|
styles,
|
|
74
70
|
animationEl,
|
|
75
71
|
floatingState,
|
|
76
|
-
land
|
|
72
|
+
land,
|
|
77
73
|
}
|
|
78
74
|
},
|
|
79
75
|
})
|
|
@@ -81,13 +77,26 @@ export default defineComponent({
|
|
|
81
77
|
|
|
82
78
|
<template>
|
|
83
79
|
<Teleport :to="animationEl" v-if="animationEl">
|
|
84
|
-
<img
|
|
85
|
-
v-
|
|
80
|
+
<img
|
|
81
|
+
v-show="!floatingState"
|
|
82
|
+
v-bind="animationBoxData.attrs"
|
|
83
|
+
:style="styles"
|
|
84
|
+
:src="logo"
|
|
85
|
+
alt="logo"
|
|
86
|
+
v-if="logo && animationEl"
|
|
87
|
+
class="varlet-cli-logo-animation"
|
|
88
|
+
/>
|
|
86
89
|
</Teleport>
|
|
87
90
|
<div v-show="floatingState">
|
|
88
|
-
<img
|
|
91
|
+
<img
|
|
92
|
+
@transitionend="land"
|
|
93
|
+
v-bind="animationBoxData.attrs"
|
|
94
|
+
:style="styles"
|
|
95
|
+
:src="logo"
|
|
96
|
+
alt="logo"
|
|
89
97
|
v-if="logo && animationEl"
|
|
90
|
-
class="varlet-cli-logo-animation varlet-cli-logo-position varlet-cli-logo-transition"
|
|
98
|
+
class="varlet-cli-logo-animation varlet-cli-logo-position varlet-cli-logo-transition"
|
|
99
|
+
/>
|
|
91
100
|
</div>
|
|
92
101
|
</template>
|
|
93
102
|
|