@varlet/cli 1.23.0-alpha.24 → 1.23.4-alpha.0
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/CHANGELOG.md +34 -0
- package/README.en-US.md +4 -0
- package/README.md +4 -0
- package/generators/sfc/.gitignore +1 -0
- package/generators/sfc/README.md +3 -1
- package/generators/sfc/docs/home.zh-CN.md +4 -2
- package/generators/sfc/package.json +5 -1
- package/generators/sfc/varlet.config.js +33 -0
- package/generators/tsx/.gitignore +1 -0
- package/generators/tsx/README.md +3 -1
- package/generators/tsx/docs/home.zh-CN.md +4 -2
- package/generators/tsx/package.json +5 -1
- package/generators/tsx/varlet.config.js +33 -0
- package/lib/commands/compile.d.ts +1 -1
- package/lib/commands/compile.js +12 -10
- package/lib/commands/create.js +1 -1
- package/lib/commands/jest.d.ts +5 -2
- package/lib/commands/jest.js +1 -0
- package/lib/compiler/compileModule.d.ts +1 -1
- package/lib/compiler/compileModule.js +16 -13
- package/lib/compiler/compileScript.d.ts +2 -1
- package/lib/compiler/compileScript.js +43 -6
- package/lib/compiler/compileStyle.d.ts +2 -0
- package/lib/compiler/compileStyle.js +12 -5
- package/lib/config/babel.config.js +2 -2
- package/lib/index.js +2 -1
- package/lib/shared/constant.d.ts +1 -0
- package/lib/shared/constant.js +2 -1
- package/package.json +3 -3
- package/site/mobile/App.vue +8 -4
- package/site/pc/App.vue +2 -3
- package/site/utils.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,40 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.23.3](https://github.com/haoziqaq/varlet/compare/v1.23.2...v1.23.3) (2021-11-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cli/jest:** add watchAll mode ([84ebb4e](https://github.com/haoziqaq/varlet/commit/84ebb4efe823cb9d7f22995d429b82d8fc3e05c8))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [1.23.0](https://github.com/haoziqaq/varlet/compare/v1.22.10...v1.23.0) (2021-11-19)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **ui,cli:** move dark theme import to example ([579e461](https://github.com/haoziqaq/varlet/commit/579e461a620c2a7e416193b43368b885ec02b862))
|
|
23
|
+
* add assert for example lang ([7ce8bae](https://github.com/haoziqaq/varlet/commit/7ce8baefeaaf0f10d2638cb4927ccbf570b28006))
|
|
24
|
+
* **cli:** bump typescript and commander version ([af893e9](https://github.com/haoziqaq/varlet/commit/af893e970b71ddc46365187c94ecba244513ef5a))
|
|
25
|
+
* **doc:** progress bar should not use unmount function ([0587103](https://github.com/haoziqaq/varlet/commit/05871038e42a50f38fdc2a201107d786431691cd))
|
|
26
|
+
* **site:** modify the width of nav ([af0bfbe](https://github.com/haoziqaq/varlet/commit/af0bfbe8557182fa23083b8a4060625b18132c92))
|
|
27
|
+
* **site:** support bg-color for dark mode of nav button ([b8417fe](https://github.com/haoziqaq/varlet/commit/b8417fe0873b8ecea4bcef21068aa0328ec32f88))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Features
|
|
31
|
+
|
|
32
|
+
* **all:** support dark mode ([94d9899](https://github.com/haoziqaq/varlet/commit/94d9899cd54ebe1ac864712484d2c6f6f958150a))
|
|
33
|
+
* **cli/generators:** support dark mode ([4795af8](https://github.com/haoziqaq/varlet/commit/4795af8c25cc155eb1fe7cd8d8a6b23b45379989))
|
|
34
|
+
* **menu:** add dark-mode ([e2807f6](https://github.com/haoziqaq/varlet/commit/e2807f6f45ee3331acdd3b9ba4180b16096f0114))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
6
40
|
## [1.22.10](https://github.com/haoziqaq/varlet/compare/v1.22.9...v1.22.10) (2021-11-03)
|
|
7
41
|
|
|
8
42
|
|
package/README.en-US.md
CHANGED
|
@@ -116,6 +116,7 @@ module.exports = {
|
|
|
116
116
|
'en-US': 'A components library',
|
|
117
117
|
},
|
|
118
118
|
header: {
|
|
119
|
+
darkMode: null,
|
|
119
120
|
i18n: null,
|
|
120
121
|
github: 'https://github.com/haoziqaq/varlet',
|
|
121
122
|
},
|
|
@@ -157,6 +158,7 @@ module.exports = {
|
|
|
157
158
|
'en-US': 'A components library',
|
|
158
159
|
},
|
|
159
160
|
header: {
|
|
161
|
+
darkMode: null,
|
|
160
162
|
i18n: null,
|
|
161
163
|
github: 'https://github.com/haoziqaq/varlet',
|
|
162
164
|
},
|
|
@@ -200,6 +202,8 @@ varlet-cli test
|
|
|
200
202
|
|
|
201
203
|
```shell
|
|
202
204
|
varlet-cli test -w
|
|
205
|
+
or
|
|
206
|
+
varlet-cli test -wa
|
|
203
207
|
```
|
|
204
208
|
|
|
205
209
|
#### Lint code
|
package/README.md
CHANGED
|
@@ -111,6 +111,7 @@ module.exports = {
|
|
|
111
111
|
'zh-CN': '一个组件库',
|
|
112
112
|
},
|
|
113
113
|
header: {
|
|
114
|
+
darkMode: null,
|
|
114
115
|
i18n: null,
|
|
115
116
|
github: 'https://github.com/haoziqaq/varlet',
|
|
116
117
|
},
|
|
@@ -152,6 +153,7 @@ module.exports = {
|
|
|
152
153
|
'zh-CN': '一个组件库',
|
|
153
154
|
},
|
|
154
155
|
header: {
|
|
156
|
+
darkMode: null,
|
|
155
157
|
i18n: null,
|
|
156
158
|
github: 'https://github.com/haoziqaq/varlet',
|
|
157
159
|
},
|
|
@@ -195,6 +197,8 @@ varlet-cli test
|
|
|
195
197
|
|
|
196
198
|
```shell
|
|
197
199
|
varlet-cli test -w
|
|
200
|
+
or
|
|
201
|
+
varlet-cli test -wa
|
|
198
202
|
```
|
|
199
203
|
|
|
200
204
|
#### 检查代码
|
package/generators/sfc/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<div class="varlet-introduce">
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<div class="varlet-introduce__row">
|
|
3
|
+
<img class="varlet-introduce__image" src="../public/logo.svg" />
|
|
4
|
+
<div class="varlet-introduce__name">Basic UI</div>
|
|
5
|
+
</div>
|
|
4
6
|
<div class="varlet-introduce__des">一个组件库</div>
|
|
5
7
|
</div>
|
|
6
8
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "basic-ui",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "A basic components library",
|
|
5
|
+
"main": "lib/index.js",
|
|
5
6
|
"module": "es/index.js",
|
|
6
7
|
"typings": "types/index.d.ts",
|
|
7
8
|
"vetur": {
|
|
@@ -27,7 +28,8 @@
|
|
|
27
28
|
"genAllLog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
28
29
|
"release": "yarn compile && release-it",
|
|
29
30
|
"test": "varlet-cli jest",
|
|
30
|
-
"test:watch": "varlet-cli jest -w"
|
|
31
|
+
"test:watch": "varlet-cli jest -w",
|
|
32
|
+
"test:watchAll": "varlet-cli jest -wa"
|
|
31
33
|
},
|
|
32
34
|
"peerDependencies": {
|
|
33
35
|
"vue": "^3.2.0"
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
"eslintConfig": {
|
|
64
66
|
"root": true,
|
|
65
67
|
"ignorePatterns": [
|
|
68
|
+
"lib/**",
|
|
66
69
|
"es/**",
|
|
67
70
|
"umd/**",
|
|
68
71
|
"site/**",
|
|
@@ -79,6 +82,7 @@
|
|
|
79
82
|
"@varlet/stylelint-config"
|
|
80
83
|
],
|
|
81
84
|
"ignoreFiles": [
|
|
85
|
+
"lib/**",
|
|
82
86
|
"es/**",
|
|
83
87
|
"umd/**",
|
|
84
88
|
"site/**",
|
|
@@ -5,6 +5,14 @@ module.exports = {
|
|
|
5
5
|
logo: './logo.svg',
|
|
6
6
|
useMobile: true,
|
|
7
7
|
themes: {
|
|
8
|
+
'color-body': '#fff',
|
|
9
|
+
'color-bar': '#fff',
|
|
10
|
+
'color-sub-bar': '#f5f5f5',
|
|
11
|
+
'color-text': '#555',
|
|
12
|
+
'color-sub-text': '#888',
|
|
13
|
+
'color-border': 'rgba(0, 0, 0, 0.12)',
|
|
14
|
+
'color-shadow': '#eee',
|
|
15
|
+
'color-introduce-border': '#009688',
|
|
8
16
|
'color-primary': '#009688',
|
|
9
17
|
'color-link': '#009688',
|
|
10
18
|
'color-type': '#009688',
|
|
@@ -13,12 +21,37 @@ module.exports = {
|
|
|
13
21
|
'color-side-bar': '#009688',
|
|
14
22
|
'color-side-bar-active-background': '#00968821',
|
|
15
23
|
'color-app-bar': '#009688',
|
|
24
|
+
'color-nav-button-hover-background': 'rgba(0, 0, 0, 0.08)',
|
|
16
25
|
'color-pc-language-active': '#009688',
|
|
17
26
|
'color-pc-language-active-background': '#00968821',
|
|
18
27
|
'color-mobile-language-active': '#009688',
|
|
19
28
|
'color-mobile-language-active-background': '#00968821',
|
|
20
29
|
'color-mobile-cell-hover': '#009688'
|
|
21
30
|
},
|
|
31
|
+
darkThemes: {
|
|
32
|
+
'color-body': '#121212',
|
|
33
|
+
'color-bar': '#1e1e1e',
|
|
34
|
+
'color-sub-bar': '#272727',
|
|
35
|
+
'color-text': '#fff',
|
|
36
|
+
'color-sub-text': '#aaa',
|
|
37
|
+
'color-border': '#333',
|
|
38
|
+
'color-shadow': '#121212',
|
|
39
|
+
'color-introduce-border': '#555',
|
|
40
|
+
'color-primary': '#009688',
|
|
41
|
+
'color-link': '#009688',
|
|
42
|
+
'color-type': '#009688',
|
|
43
|
+
'color-progress': '#009688',
|
|
44
|
+
'color-progress-track': '#202020',
|
|
45
|
+
'color-side-bar': '#009688',
|
|
46
|
+
'color-side-bar-active-background': '#00968821',
|
|
47
|
+
'color-app-bar': '#009688',
|
|
48
|
+
'color-nav-button-hover-background': 'rgba(255, 255, 255, 0.08)',
|
|
49
|
+
'color-pc-language-active': '#009688',
|
|
50
|
+
'color-pc-language-active-background': '#00968821',
|
|
51
|
+
'color-mobile-language-active': '#009688',
|
|
52
|
+
'color-mobile-language-active-background': '#00968821',
|
|
53
|
+
'color-mobile-cell-hover': '#009688',
|
|
54
|
+
},
|
|
22
55
|
highlight: {
|
|
23
56
|
style: './highlight.css',
|
|
24
57
|
},
|
package/generators/tsx/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
<div class="varlet-introduce">
|
|
2
|
-
<
|
|
3
|
-
|
|
2
|
+
<div class="varlet-introduce__row">
|
|
3
|
+
<img class="varlet-introduce__image" src="../public/logo.svg" />
|
|
4
|
+
<div class="varlet-introduce__name">Basic UI</div>
|
|
5
|
+
</div>
|
|
4
6
|
<div class="varlet-introduce__des">一个组件库</div>
|
|
5
7
|
</div>
|
|
6
8
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"name": "basic-ui",
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"description": "A basic components library",
|
|
5
|
+
"main": "lib/index.js",
|
|
5
6
|
"module": "es/index.js",
|
|
6
7
|
"typings": "types/index.d.ts",
|
|
7
8
|
"vetur": {
|
|
@@ -27,7 +28,8 @@
|
|
|
27
28
|
"genAllLog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
28
29
|
"release": "yarn compile && release-it",
|
|
29
30
|
"test": "varlet-cli jest",
|
|
30
|
-
"test:watch": "varlet-cli jest -w"
|
|
31
|
+
"test:watch": "varlet-cli jest -w",
|
|
32
|
+
"test:watchAll": "varlet-cli jest -wa"
|
|
31
33
|
},
|
|
32
34
|
"peerDependencies": {
|
|
33
35
|
"vue": "^3.2.0"
|
|
@@ -63,6 +65,7 @@
|
|
|
63
65
|
"eslintConfig": {
|
|
64
66
|
"root": true,
|
|
65
67
|
"ignorePatterns": [
|
|
68
|
+
"lib/**",
|
|
66
69
|
"es/**",
|
|
67
70
|
"umd/**",
|
|
68
71
|
"site/**",
|
|
@@ -79,6 +82,7 @@
|
|
|
79
82
|
"@varlet/stylelint-config"
|
|
80
83
|
],
|
|
81
84
|
"ignoreFiles": [
|
|
85
|
+
"lib/**",
|
|
82
86
|
"es/**",
|
|
83
87
|
"umd/**",
|
|
84
88
|
"site/**",
|
|
@@ -5,6 +5,14 @@ module.exports = {
|
|
|
5
5
|
logo: './logo.svg',
|
|
6
6
|
useMobile: true,
|
|
7
7
|
themes: {
|
|
8
|
+
'color-body': '#fff',
|
|
9
|
+
'color-bar': '#fff',
|
|
10
|
+
'color-sub-bar': '#f5f5f5',
|
|
11
|
+
'color-text': '#555',
|
|
12
|
+
'color-sub-text': '#888',
|
|
13
|
+
'color-border': 'rgba(0, 0, 0, 0.12)',
|
|
14
|
+
'color-shadow': '#eee',
|
|
15
|
+
'color-introduce-border': '#009688',
|
|
8
16
|
'color-primary': '#009688',
|
|
9
17
|
'color-link': '#009688',
|
|
10
18
|
'color-type': '#009688',
|
|
@@ -13,12 +21,37 @@ module.exports = {
|
|
|
13
21
|
'color-side-bar': '#009688',
|
|
14
22
|
'color-side-bar-active-background': '#00968821',
|
|
15
23
|
'color-app-bar': '#009688',
|
|
24
|
+
'color-nav-button-hover-background': 'rgba(0, 0, 0, 0.08)',
|
|
16
25
|
'color-pc-language-active': '#009688',
|
|
17
26
|
'color-pc-language-active-background': '#00968821',
|
|
18
27
|
'color-mobile-language-active': '#009688',
|
|
19
28
|
'color-mobile-language-active-background': '#00968821',
|
|
20
29
|
'color-mobile-cell-hover': '#009688'
|
|
21
30
|
},
|
|
31
|
+
darkThemes: {
|
|
32
|
+
'color-body': '#121212',
|
|
33
|
+
'color-bar': '#1e1e1e',
|
|
34
|
+
'color-sub-bar': '#272727',
|
|
35
|
+
'color-text': '#fff',
|
|
36
|
+
'color-sub-text': '#aaa',
|
|
37
|
+
'color-border': '#333',
|
|
38
|
+
'color-shadow': '#121212',
|
|
39
|
+
'color-introduce-border': '#555',
|
|
40
|
+
'color-primary': '#009688',
|
|
41
|
+
'color-link': '#009688',
|
|
42
|
+
'color-type': '#009688',
|
|
43
|
+
'color-progress': '#009688',
|
|
44
|
+
'color-progress-track': '#202020',
|
|
45
|
+
'color-side-bar': '#009688',
|
|
46
|
+
'color-side-bar-active-background': '#00968821',
|
|
47
|
+
'color-app-bar': '#009688',
|
|
48
|
+
'color-nav-button-hover-background': 'rgba(255, 255, 255, 0.08)',
|
|
49
|
+
'color-pc-language-active': '#009688',
|
|
50
|
+
'color-pc-language-active-background': '#00968821',
|
|
51
|
+
'color-mobile-language-active': '#009688',
|
|
52
|
+
'color-mobile-language-active-background': '#00968821',
|
|
53
|
+
'color-mobile-cell-hover': '#009688',
|
|
54
|
+
},
|
|
22
55
|
highlight: {
|
|
23
56
|
style: './highlight.css',
|
|
24
57
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function removeDir(): Promise<[void, void, void]>;
|
|
1
|
+
export declare function removeDir(): Promise<[void, void, void, void]>;
|
|
2
2
|
export declare function runTask(taskName: string, task: () => any): Promise<void>;
|
|
3
3
|
export declare function compile(cmd: {
|
|
4
4
|
noUmd: boolean;
|
package/lib/commands/compile.js
CHANGED
|
@@ -48,7 +48,7 @@ var compileModule_1 = require("../compiler/compileModule");
|
|
|
48
48
|
var compileTemplateHighlight_1 = require("../compiler/compileTemplateHighlight");
|
|
49
49
|
var compileTypes_1 = require("../compiler/compileTypes");
|
|
50
50
|
function removeDir() {
|
|
51
|
-
return Promise.all([(0, fs_extra_1.remove)(constant_1.ES_DIR), (0, fs_extra_1.remove)(constant_1.HL_DIR), (0, fs_extra_1.remove)(constant_1.UMD_DIR)]);
|
|
51
|
+
return Promise.all([(0, fs_extra_1.remove)(constant_1.ES_DIR), (0, fs_extra_1.remove)(constant_1.LIB_DIR), (0, fs_extra_1.remove)(constant_1.HL_DIR), (0, fs_extra_1.remove)(constant_1.UMD_DIR)]);
|
|
52
52
|
}
|
|
53
53
|
exports.removeDir = removeDir;
|
|
54
54
|
function runTask(taskName, task) {
|
|
@@ -87,20 +87,22 @@ function compile(cmd) {
|
|
|
87
87
|
return [4 /*yield*/, removeDir()];
|
|
88
88
|
case 1:
|
|
89
89
|
_b.sent();
|
|
90
|
-
return [4 /*yield*/, Promise.all([
|
|
91
|
-
runTask('types', compileTypes_1.compileTypes),
|
|
92
|
-
runTask('template highlight', compileTemplateHighlight_1.compileTemplateHighlight),
|
|
93
|
-
runTask('module', compileModule_1.compileModule),
|
|
94
|
-
])];
|
|
90
|
+
return [4 /*yield*/, Promise.all([runTask('types', compileTypes_1.compileTypes), runTask('template highlight', compileTemplateHighlight_1.compileTemplateHighlight)])];
|
|
95
91
|
case 2:
|
|
92
|
+
_b.sent();
|
|
93
|
+
return [4 /*yield*/, runTask('module', compileModule_1.compileModule)];
|
|
94
|
+
case 3:
|
|
95
|
+
_b.sent();
|
|
96
|
+
return [4 /*yield*/, runTask('commonjs', function () { return (0, compileModule_1.compileModule)('commonjs'); })];
|
|
97
|
+
case 4:
|
|
96
98
|
_b.sent();
|
|
97
99
|
_a = !cmd.noUmd;
|
|
98
|
-
if (!_a) return [3 /*break*/,
|
|
100
|
+
if (!_a) return [3 /*break*/, 6];
|
|
99
101
|
return [4 /*yield*/, runTask('umd', function () { return (0, compileModule_1.compileModule)('umd'); })];
|
|
100
|
-
case
|
|
102
|
+
case 5:
|
|
101
103
|
_a = (_b.sent());
|
|
102
|
-
_b.label =
|
|
103
|
-
case
|
|
104
|
+
_b.label = 6;
|
|
105
|
+
case 6:
|
|
104
106
|
_a;
|
|
105
107
|
return [2 /*return*/];
|
|
106
108
|
}
|
package/lib/commands/create.js
CHANGED
|
@@ -60,7 +60,7 @@ function create(name) {
|
|
|
60
60
|
indexTemplate = "import " + bigCamelizeName + " from './" + bigCamelizeName + ".vue'\nimport type { App } from 'vue'\n\n" + bigCamelizeName + ".install = function(app: App) {\n app.component(" + bigCamelizeName + ".name, " + bigCamelizeName + ")\n}\n\nexport const _" + bigCamelizeName + "Component = " + bigCamelizeName + "\n\nexport default " + bigCamelizeName + "\n";
|
|
61
61
|
testsTemplate = "import example from '../example'\nimport " + bigCamelizeName + " from '..'\nimport { createApp } from 'vue'\nimport { mount } from '@vue/test-utils'\n\ntest('test " + name + " example', () => {\n const wrapper = mount(example)\n expect(wrapper.html()).toMatchSnapshot()\n})\n\ntest('test " + name + " plugin', () => {\n const app = createApp({}).use(" + bigCamelizeName + ")\n expect(app.component(" + bigCamelizeName + ".name)).toBeTruthy()\n})\n";
|
|
62
62
|
exampleTemplate = "<template>\n <app-type></app-type>\n <" + namespace + "-" + name + "/>\n</template>\n\n<script>\nimport " + bigCamelizeName + " from '..'\nimport AppType from '@varlet/cli/site/mobile/components/AppType'\nimport { watchLang } from '@varlet/cli/site/utils'\nimport { use, pack } from './locale'\n\nexport default {\n name: '" + bigCamelizeName + "Example',\n components: {\n [" + bigCamelizeName + ".name]: " + bigCamelizeName + ",\n AppType\n },\n setup() {\n\n watchLang(use)\n\n return {\n pack\n }\n }\n}\n</script>\n";
|
|
63
|
-
localeIndexTemplate = "// lib\nimport _zhCN from '../../../locale/zh-CN'\nimport _enCN from '../../../locale/en-US'\n// mobile example doc\nimport zhCN from './zh-CN'\nimport enUS from './en-US'\nimport { useLocale, add as _add, use as _use } from '../../../locale'\n\nconst { add, use: exampleUse, pack, packs, merge } = useLocale()\n\nconst use = (lang: string) => {\n _use(lang)\n exampleUse(lang)\n}\n\nexport { add, pack, packs, merge, use }\n\n// lib\n_add('zh-CN', _zhCN)\n_add('en-US', _enCN)\n// mobile example doc\nadd('zh-CN', zhCN)\nadd('en-US', enUS)\n";
|
|
63
|
+
localeIndexTemplate = "// lib\nimport _zhCN from '../../../locale/zh-CN'\nimport _enCN from '../../../locale/en-US'\n// mobile example doc\nimport zhCN from './zh-CN'\nimport enUS from './en-US'\nimport { useLocale, add as _add, use as _use } from '../../../locale'\n\nconst { add, use: exampleUse, pack, packs, merge } = useLocale()\n\nconst use = (lang: string) => {\n _use(lang)\n exampleUse(lang)\n}\n\nexport { add, pack, packs, merge, use }\n\n// lib\n_add('zh-CN', _zhCN)\n_add('en-US', _enCN)\n// mobile example doc\nadd('zh-CN', zhCN as any)\nadd('en-US', enUS as any)\n";
|
|
64
64
|
localTemplate = "export default {\n\n}\n";
|
|
65
65
|
componentDir = (0, path_1.resolve)(constant_1.SRC_DIR, name);
|
|
66
66
|
testsDir = (0, path_1.resolve)(constant_1.SRC_DIR, name, constant_1.TESTS_DIR_NAME);
|
package/lib/commands/jest.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
interface JestCommandOptions {
|
|
2
2
|
watch?: boolean;
|
|
3
|
+
watchAll?: boolean;
|
|
3
4
|
component?: string;
|
|
4
5
|
clearCache?: boolean;
|
|
5
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare function jest(cmd: JestCommandOptions): Promise<void>;
|
|
8
|
+
export {};
|
package/lib/commands/jest.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare function compileUMD(): Promise<void>;
|
|
2
2
|
export declare function compileDir(dir: string): Promise<void>;
|
|
3
3
|
export declare function compileFile(file: string): Promise<void>;
|
|
4
|
-
export declare function compileModule(modules?:
|
|
4
|
+
export declare function compileModule(modules?: 'umd' | 'commonjs' | boolean): Promise<void>;
|
|
@@ -127,23 +127,26 @@ exports.compileFile = compileFile;
|
|
|
127
127
|
function compileModule(modules) {
|
|
128
128
|
if (modules === void 0) { modules = false; }
|
|
129
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
var
|
|
131
|
-
return __generator(this, function (
|
|
132
|
-
switch (
|
|
130
|
+
var dest, moduleDir, publicDirs;
|
|
131
|
+
return __generator(this, function (_a) {
|
|
132
|
+
switch (_a.label) {
|
|
133
133
|
case 0:
|
|
134
134
|
if (!(modules === 'umd')) return [3 /*break*/, 2];
|
|
135
135
|
return [4 /*yield*/, compileUMD()];
|
|
136
136
|
case 1:
|
|
137
|
-
|
|
137
|
+
_a.sent();
|
|
138
138
|
return [2 /*return*/];
|
|
139
|
-
case 2:
|
|
139
|
+
case 2:
|
|
140
|
+
process.env.BABEL_MODULE = modules === 'commonjs' ? 'commonjs' : 'module';
|
|
141
|
+
dest = modules === 'commonjs' ? constant_1.LIB_DIR : constant_1.ES_DIR;
|
|
142
|
+
return [4 /*yield*/, (0, fs_extra_1.copy)(constant_1.SRC_DIR, dest)];
|
|
140
143
|
case 3:
|
|
141
|
-
|
|
144
|
+
_a.sent();
|
|
142
145
|
return [4 /*yield*/, (0, fs_extra_1.readdir)(constant_1.ES_DIR)];
|
|
143
146
|
case 4:
|
|
144
|
-
moduleDir =
|
|
147
|
+
moduleDir = _a.sent();
|
|
145
148
|
return [4 /*yield*/, Promise.all(moduleDir.map(function (filename) {
|
|
146
|
-
var file = (0, path_1.resolve)(
|
|
149
|
+
var file = (0, path_1.resolve)(dest, filename);
|
|
147
150
|
if ((0, fsUtils_1.isDir)(file)) {
|
|
148
151
|
(0, fs_extra_1.ensureFileSync)((0, path_1.resolve)(file, './style/index.js'));
|
|
149
152
|
(0, fs_extra_1.ensureFileSync)((0, path_1.resolve)(file, './style/less.js'));
|
|
@@ -151,13 +154,13 @@ function compileModule(modules) {
|
|
|
151
154
|
return (0, fsUtils_1.isDir)(file) ? compileDir(file) : null;
|
|
152
155
|
}))];
|
|
153
156
|
case 5:
|
|
154
|
-
|
|
155
|
-
_a = compileScript_1.compileLibraryEntry;
|
|
156
|
-
_b = [constant_1.ES_DIR];
|
|
157
|
+
_a.sent();
|
|
157
158
|
return [4 /*yield*/, (0, fsUtils_1.getPublicDirs)()];
|
|
158
|
-
case 6:
|
|
159
|
+
case 6:
|
|
160
|
+
publicDirs = _a.sent();
|
|
161
|
+
return [4 /*yield*/, (modules === 'commonjs' ? (0, compileScript_1.compileCommonJSEntry)(dest, publicDirs) : (0, compileScript_1.compileESEntry)(dest, publicDirs))];
|
|
159
162
|
case 7:
|
|
160
|
-
|
|
163
|
+
_a.sent();
|
|
161
164
|
return [2 /*return*/];
|
|
162
165
|
}
|
|
163
166
|
});
|
|
@@ -8,4 +8,5 @@ export declare const replaceJSXExt: (script: string) => string;
|
|
|
8
8
|
export declare const replaceTSXExt: (script: string) => string;
|
|
9
9
|
export declare function compileScript(script: string, file: string): Promise<void>;
|
|
10
10
|
export declare function compileScriptFile(file: string): Promise<void>;
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function compileESEntry(dir: string, publicDirs: string[]): Promise<void>;
|
|
12
|
+
export declare function compileCommonJSEntry(dir: string, publicDirs: string[]): Promise<void>;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.compileCommonJSEntry = exports.compileESEntry = exports.compileScriptFile = exports.compileScript = exports.replaceTSXExt = exports.replaceJSXExt = exports.replaceTSExt = exports.replaceVueExt = exports.IMPORT_TSX_PATH_RE = exports.IMPORT_JSX_PATH_RE = exports.IMPORT_TS_PATH_RE = exports.IMPORT_VUE_PATH_RE = void 0;
|
|
40
40
|
var core_1 = require("@babel/core");
|
|
41
41
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
42
42
|
var fs_extra_1 = require("fs-extra");
|
|
@@ -57,7 +57,7 @@ var replaceTSXExt = function (script) { return script.replace(exports.IMPORT_TSX
|
|
|
57
57
|
exports.replaceTSXExt = replaceTSXExt;
|
|
58
58
|
function compileScript(script, file) {
|
|
59
59
|
return __awaiter(this, void 0, void 0, function () {
|
|
60
|
-
var code;
|
|
60
|
+
var code, modules;
|
|
61
61
|
return __generator(this, function (_a) {
|
|
62
62
|
switch (_a.label) {
|
|
63
63
|
case 0: return [4 /*yield*/, (0, core_1.transformAsync)(script, {
|
|
@@ -65,8 +65,9 @@ function compileScript(script, file) {
|
|
|
65
65
|
})];
|
|
66
66
|
case 1:
|
|
67
67
|
code = (_a.sent()).code;
|
|
68
|
-
|
|
69
|
-
code = (0, compileStyle_1.extractStyleDependencies)(file, code, compileStyle_1.
|
|
68
|
+
modules = process.env.BABEL_MODULE;
|
|
69
|
+
code = (0, compileStyle_1.extractStyleDependencies)(file, code, modules === 'commonjs' ? compileStyle_1.REQUIRE_CSS_RE : compileStyle_1.IMPORT_CSS_RE, 'css', false);
|
|
70
|
+
code = (0, compileStyle_1.extractStyleDependencies)(file, code, modules === 'commonjs' ? compileStyle_1.REQUIRE_LESS_RE : compileStyle_1.IMPORT_LESS_RE, 'less', false);
|
|
70
71
|
code = (0, exports.replaceVueExt)(code);
|
|
71
72
|
code = (0, exports.replaceTSXExt)(code);
|
|
72
73
|
code = (0, exports.replaceJSXExt)(code);
|
|
@@ -95,7 +96,7 @@ function compileScriptFile(file) {
|
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
exports.compileScriptFile = compileScriptFile;
|
|
98
|
-
function
|
|
99
|
+
function compileESEntry(dir, publicDirs) {
|
|
99
100
|
return __awaiter(this, void 0, void 0, function () {
|
|
100
101
|
var imports, plugins, constInternalComponents, cssImports, lessImports, publicComponents, install, indexTemplate, styleTemplate, umdTemplate, lessTemplate;
|
|
101
102
|
return __generator(this, function (_a) {
|
|
@@ -134,4 +135,40 @@ function compileLibraryEntry(dir, publicDirs) {
|
|
|
134
135
|
});
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
|
-
exports.
|
|
138
|
+
exports.compileESEntry = compileESEntry;
|
|
139
|
+
function compileCommonJSEntry(dir, publicDirs) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var requires, plugins, cssRequires, lessRequires, publicComponents, install, indexTemplate, styleTemplate, lessTemplate;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0:
|
|
145
|
+
requires = [];
|
|
146
|
+
plugins = [];
|
|
147
|
+
cssRequires = [];
|
|
148
|
+
lessRequires = [];
|
|
149
|
+
publicComponents = [];
|
|
150
|
+
publicDirs.forEach(function (dirname) {
|
|
151
|
+
var publicComponent = (0, fsUtils_1.bigCamelize)(dirname);
|
|
152
|
+
publicComponents.push(publicComponent);
|
|
153
|
+
requires.push("const " + publicComponent + " = require('./" + dirname + "')");
|
|
154
|
+
plugins.push(publicComponent + ".install && app.use(" + publicComponent + ")");
|
|
155
|
+
cssRequires.push("require('./" + dirname + "/style')");
|
|
156
|
+
lessRequires.push("require('./" + dirname + "/style/less')");
|
|
157
|
+
});
|
|
158
|
+
install = "\nfunction install(app) {\n " + plugins.join('\n ') + "\n}\n";
|
|
159
|
+
indexTemplate = requires.join('\n') + "\n\n" + install + "\n\nmodule.exports = {\n install,\n " + publicComponents.join(',\n ') + "\n}\n";
|
|
160
|
+
styleTemplate = cssRequires.join('\n') + "\n";
|
|
161
|
+
lessTemplate = lessRequires.join('\n') + "\n";
|
|
162
|
+
return [4 /*yield*/, Promise.all([
|
|
163
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'index.js'), indexTemplate, 'utf-8'),
|
|
164
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'style.js'), styleTemplate, 'utf-8'),
|
|
165
|
+
(0, fs_extra_1.writeFile)((0, path_1.resolve)(dir, 'less.js'), lessTemplate, 'utf-8'),
|
|
166
|
+
])];
|
|
167
|
+
case 1:
|
|
168
|
+
_a.sent();
|
|
169
|
+
return [2 /*return*/];
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
exports.compileCommonJSEntry = compileCommonJSEntry;
|
|
@@ -2,6 +2,8 @@ export declare const EMPTY_SPACE_RE: RegExp;
|
|
|
2
2
|
export declare const EMPTY_LINE_RE: RegExp;
|
|
3
3
|
export declare const IMPORT_CSS_RE: RegExp;
|
|
4
4
|
export declare const IMPORT_LESS_RE: RegExp;
|
|
5
|
+
export declare const REQUIRE_CSS_RE: RegExp;
|
|
6
|
+
export declare const REQUIRE_LESS_RE: RegExp;
|
|
5
7
|
export declare const STYLE_IMPORT_RE: RegExp;
|
|
6
8
|
export declare const clearEmptyLine: (s: string) => string;
|
|
7
9
|
export declare function normalizeStyleDependency(styleImport: string, reg: RegExp): string;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.compileLess = exports.extractStyleDependencies = exports.normalizeStyleDependency = exports.clearEmptyLine = exports.STYLE_IMPORT_RE = exports.IMPORT_LESS_RE = exports.IMPORT_CSS_RE = exports.EMPTY_LINE_RE = exports.EMPTY_SPACE_RE = void 0;
|
|
39
|
+
exports.compileLess = exports.extractStyleDependencies = exports.normalizeStyleDependency = exports.clearEmptyLine = exports.STYLE_IMPORT_RE = exports.REQUIRE_LESS_RE = exports.REQUIRE_CSS_RE = exports.IMPORT_LESS_RE = exports.IMPORT_CSS_RE = exports.EMPTY_LINE_RE = exports.EMPTY_SPACE_RE = void 0;
|
|
40
40
|
var fs_extra_1 = require("fs-extra");
|
|
41
41
|
var less_1 = require("less");
|
|
42
42
|
var fsUtils_1 = require("../shared/fsUtils");
|
|
@@ -45,6 +45,8 @@ exports.EMPTY_SPACE_RE = /[\s]+/g;
|
|
|
45
45
|
exports.EMPTY_LINE_RE = /[\n\r]*/g;
|
|
46
46
|
exports.IMPORT_CSS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.css)['"]\s*;?(?!\s*['"`])/g;
|
|
47
47
|
exports.IMPORT_LESS_RE = /(?<!['"`])import\s+['"](\.{1,2}\/.+\.less)['"]\s*;?(?!\s*['"`])/g;
|
|
48
|
+
exports.REQUIRE_CSS_RE = /(?<!['"`])require\(\s*['"](\.{1,2}\/.+\.css)['"]\s*\);?(?!\s*['"`])/g;
|
|
49
|
+
exports.REQUIRE_LESS_RE = /(?<!['"`])require\(\s*['"](\.{1,2}\/.+\.less)['"]\s*\);?(?!\s*['"`])/g;
|
|
48
50
|
exports.STYLE_IMPORT_RE = /@import\s+['"](.+)['"]\s*;/g;
|
|
49
51
|
var clearEmptyLine = function (s) { return s.replace(exports.EMPTY_LINE_RE, '').replace(exports.EMPTY_SPACE_RE, ' '); };
|
|
50
52
|
exports.clearEmptyLine = clearEmptyLine;
|
|
@@ -63,14 +65,19 @@ function extractStyleDependencies(file, code, reg, expect, self) {
|
|
|
63
65
|
var styleImports = (_a = code.match(reg)) !== null && _a !== void 0 ? _a : [];
|
|
64
66
|
var cssFile = (0, path_1.resolve)(dir, './style/index.js');
|
|
65
67
|
var lessFile = (0, path_1.resolve)(dir, './style/less.js');
|
|
68
|
+
var modules = process.env.BABEL_MODULE;
|
|
66
69
|
styleImports.forEach(function (styleImport) {
|
|
67
70
|
var normalizedPath = normalizeStyleDependency(styleImport, reg);
|
|
68
|
-
(0, fsUtils_1.smartAppendFileSync)(cssFile, "import '" + normalizedPath + ".css'\n");
|
|
69
|
-
(0, fsUtils_1.smartAppendFileSync)(lessFile, "import '" + normalizedPath + "." + expect + "'\n");
|
|
71
|
+
(0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs' ? "require('" + normalizedPath + ".css')\n" : "import '" + normalizedPath + ".css'\n");
|
|
72
|
+
(0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs' ? "require('" + normalizedPath + "." + expect + "')\n" : "import '" + normalizedPath + "." + expect + "'\n");
|
|
70
73
|
});
|
|
71
74
|
if (self) {
|
|
72
|
-
(0, fsUtils_1.smartAppendFileSync)(cssFile,
|
|
73
|
-
|
|
75
|
+
(0, fsUtils_1.smartAppendFileSync)(cssFile, modules === 'commonjs'
|
|
76
|
+
? "require('" + normalizeStyleDependency(base, reg) + ".css')\n"
|
|
77
|
+
: "import '" + normalizeStyleDependency(base, reg) + ".css'\n");
|
|
78
|
+
(0, fsUtils_1.smartAppendFileSync)(lessFile, modules === 'commonjs'
|
|
79
|
+
? "require('" + normalizeStyleDependency(base, reg) + "." + expect + "')\n"
|
|
80
|
+
: "import '" + normalizeStyleDependency(base, reg) + "." + expect + "'\n");
|
|
74
81
|
}
|
|
75
82
|
return code.replace(reg, '');
|
|
76
83
|
}
|
|
@@ -5,13 +5,13 @@ module.exports = function (api, options) {
|
|
|
5
5
|
if (api) {
|
|
6
6
|
api.cache.never();
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var isCommonJS = process.env.NODE_ENV === 'test' || process.env.BABEL_MODULE === 'commonjs';
|
|
9
9
|
return {
|
|
10
10
|
presets: [
|
|
11
11
|
[
|
|
12
12
|
require.resolve('@babel/preset-env'),
|
|
13
13
|
{
|
|
14
|
-
modules:
|
|
14
|
+
modules: isCommonJS ? 'commonjs' : false,
|
|
15
15
|
loose: options.loose,
|
|
16
16
|
},
|
|
17
17
|
],
|
package/lib/index.js
CHANGED
|
@@ -49,7 +49,8 @@ program.command('create <name>').description('Create a component directory').act
|
|
|
49
49
|
program
|
|
50
50
|
.command('jest')
|
|
51
51
|
.description('Run Jest in work directory')
|
|
52
|
-
.option('-w, --watch', 'Watch files
|
|
52
|
+
.option('-w, --watch', 'Watch files for changes and rerun tests related to changed files')
|
|
53
|
+
.option('-wa, --watchAll', 'Watch files for changes and rerun all tests when something changes')
|
|
53
54
|
.option('-c, --component <componentName>', 'Test a specific component')
|
|
54
55
|
.option('-cc --clearCache', 'Clear test cache')
|
|
55
56
|
.action(jest_1.jest);
|
package/lib/shared/constant.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const CWD: string;
|
|
|
2
2
|
export declare const VARLET_CONFIG: string;
|
|
3
3
|
export declare const SRC_DIR: string;
|
|
4
4
|
export declare const ES_DIR: string;
|
|
5
|
+
export declare const LIB_DIR: string;
|
|
5
6
|
export declare const UMD_DIR: string;
|
|
6
7
|
export declare const TYPES_DIR: string;
|
|
7
8
|
export declare const ROOT_DOCS_DIR: string;
|
package/lib/shared/constant.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.VITE_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
3
|
+
exports.JEST_STYLE_MOCK = exports.JEST_MEDIA_MOCK = exports.JEST_CONFIG = exports.HL_WEB_TYPES_JSON = exports.HL_ATTRIBUTES_JSON = exports.HL_TAGS_JSON = exports.HL_DIR = exports.HL_MD = exports.HL_TITLE_SLOTS_RE = exports.HL_TITLE_EVENTS_RE = exports.HL_TITLE_ATTRIBUTES_RE = exports.HL_API_RE = exports.HL_COMPONENT_NAME_RE = exports.SITE_CONFIG = exports.SITE_MOBILE_ROUTES = exports.SITE_PC_ROUTES = exports.SITE_DIR = exports.SITE_PUBLIC_PATH = exports.SITE_OUTPUT_PATH = exports.SITE = exports.CLI_PACKAGE_JSON = exports.UI_PACKAGE_JSON = exports.GENERATORS_DIR = exports.TESTS_DIR_NAME = exports.EXAMPLE_DIR_INDEX = exports.DOCS_DIR_NAME = exports.EXAMPLE_LOCALE_DIR_NAME = exports.EXAMPLE_DIR_NAME = exports.STYLE_DIR_NAME = exports.PUBLIC_DIR_INDEXES = exports.SCRIPTS_EXTENSIONS = exports.VITE_RESOLVE_EXTENSIONS = exports.ESLINT_EXTENSIONS = exports.ROOT_DOCS_DIR = exports.TYPES_DIR = exports.UMD_DIR = exports.LIB_DIR = exports.ES_DIR = exports.SRC_DIR = exports.VARLET_CONFIG = exports.CWD = void 0;
|
|
4
4
|
var path_1 = require("path");
|
|
5
5
|
exports.CWD = process.cwd();
|
|
6
6
|
exports.VARLET_CONFIG = (0, path_1.resolve)(exports.CWD, 'varlet.config.js');
|
|
7
7
|
exports.SRC_DIR = (0, path_1.resolve)(exports.CWD, 'src');
|
|
8
8
|
exports.ES_DIR = (0, path_1.resolve)(exports.CWD, 'es');
|
|
9
|
+
exports.LIB_DIR = (0, path_1.resolve)(exports.CWD, 'lib');
|
|
9
10
|
exports.UMD_DIR = (0, path_1.resolve)(exports.CWD, 'umd');
|
|
10
11
|
exports.TYPES_DIR = (0, path_1.resolve)(exports.CWD, 'types');
|
|
11
12
|
exports.ROOT_DOCS_DIR = (0, path_1.resolve)(exports.CWD, 'docs');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.23.
|
|
3
|
+
"version": "1.23.4-alpha.0+4a424d4c",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"bin": {
|
|
6
6
|
"varlet-cli": "./lib/index.js"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dev": "tsc --watch",
|
|
32
32
|
"build": "tsc"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "4a424d4c066f7de69cbf561a5bc9279862739637",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/core": "^7.14.8",
|
|
37
37
|
"@babel/preset-env": "^7.14.8",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@commitlint/config-conventional": "^11.0.0",
|
|
41
41
|
"@release-it/conventional-changelog": "^3.3.0",
|
|
42
42
|
"@varlet/eslint-config": "^1.13.0",
|
|
43
|
-
"@varlet/icons": "^1.
|
|
43
|
+
"@varlet/icons": "^1.23.0",
|
|
44
44
|
"@varlet/markdown-vite-plugin": "^1.22.0",
|
|
45
45
|
"@varlet/stylelint-config": "^1.9.0",
|
|
46
46
|
"@varlet/touch-emulator": "^1.0.1",
|
package/site/mobile/App.vue
CHANGED
|
@@ -31,11 +31,13 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
<template #right>
|
|
33
33
|
<var-site-button
|
|
34
|
-
style="transform: translateX(2px)"
|
|
35
34
|
text
|
|
36
35
|
round
|
|
37
36
|
color="transparent"
|
|
38
37
|
text-color="#fff"
|
|
38
|
+
:style="{
|
|
39
|
+
transform: languages ? 'translateX(2px)' : 'translateX(-4px)'
|
|
40
|
+
}"
|
|
39
41
|
v-if="darkMode"
|
|
40
42
|
@click="toggleTheme"
|
|
41
43
|
>
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
color="transparent"
|
|
52
54
|
text-color="#fff"
|
|
53
55
|
@click.stop="showMenu = true"
|
|
54
|
-
v-if="languages
|
|
56
|
+
v-if="languages"
|
|
55
57
|
>
|
|
56
58
|
<var-site-icon name="translate" :size="24" />
|
|
57
59
|
<var-site-icon name="chevron-down" :size="22" />
|
|
@@ -101,7 +103,7 @@ import {
|
|
|
101
103
|
import { get } from 'lodash-es'
|
|
102
104
|
|
|
103
105
|
export default defineComponent({
|
|
104
|
-
setup() {
|
|
106
|
+
setup: function() {
|
|
105
107
|
const bigCamelizeComponentName: Ref<string> = ref('')
|
|
106
108
|
const route = useRoute()
|
|
107
109
|
const showBackIcon: Ref<boolean> = ref(false)
|
|
@@ -171,6 +173,8 @@ export default defineComponent({
|
|
|
171
173
|
}
|
|
172
174
|
}
|
|
173
175
|
|
|
176
|
+
(window as any).toggleTheme = toggleTheme
|
|
177
|
+
|
|
174
178
|
setThemes(config, currentThemes.value)
|
|
175
179
|
window.postMessage(getThemesMessage(), '*')
|
|
176
180
|
|
|
@@ -197,7 +201,7 @@ export default defineComponent({
|
|
|
197
201
|
changeLanguage,
|
|
198
202
|
toggleTheme
|
|
199
203
|
}
|
|
200
|
-
}
|
|
204
|
+
}
|
|
201
205
|
})
|
|
202
206
|
</script>
|
|
203
207
|
|
package/site/pc/App.vue
CHANGED
|
@@ -154,7 +154,7 @@ export default defineComponent({
|
|
|
154
154
|
body {
|
|
155
155
|
min-width: 1200px;
|
|
156
156
|
margin: 0;
|
|
157
|
-
padding: 0;
|
|
157
|
+
padding: 60px 0 0;
|
|
158
158
|
font-family: 'Roboto', sans-serif;
|
|
159
159
|
background: var(--site-config-color-body);
|
|
160
160
|
color: var(--site-config-color-text);
|
|
@@ -213,13 +213,12 @@ iframe {
|
|
|
213
213
|
&-content {
|
|
214
214
|
display: flex;
|
|
215
215
|
background: var(--site-config-color-body);
|
|
216
|
-
margin-top: 60px;
|
|
217
216
|
margin-left: 240px;
|
|
217
|
+
min-height: calc(100vh - 60px);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
&-doc-container {
|
|
221
221
|
flex: 1 0 0;
|
|
222
|
-
overflow-y: auto;
|
|
223
222
|
min-width: 500px;
|
|
224
223
|
padding: 0 25px;
|
|
225
224
|
overflow-x: hidden;
|
package/site/utils.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { onMounted, onUnmounted } from 'vue'
|
|
2
2
|
import { get } from 'lodash-es'
|
|
3
3
|
import { formatStyleVars } from './components/utils/elements'
|
|
4
|
-
import dark from '@varlet/ui/src/themes/dark'
|
|
5
4
|
|
|
6
5
|
export * from './components/utils/components'
|
|
7
6
|
export * from './components/utils/elements'
|
|
@@ -150,7 +149,7 @@ export function getBrowserThemes(): 'darkThemes' | 'themes' {
|
|
|
150
149
|
return currentThemes
|
|
151
150
|
}
|
|
152
151
|
|
|
153
|
-
export function watchDarkMode(cb?: (themes: 'darkThemes' | 'themes') => void) {
|
|
152
|
+
export function watchDarkMode(dark: StyleVars, cb?: (themes: 'darkThemes' | 'themes') => void) {
|
|
154
153
|
watchThemes((themes) => {
|
|
155
154
|
StyleProvider(themes === 'darkThemes' ? dark : null)
|
|
156
155
|
|