@varlet/cli 2.0.6 → 2.1.0-alpha.1666877950844
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.en-US.md +2 -2
- package/README.md +2 -2
- package/cjs/babel.config.cjs +29 -0
- package/cjs/babel.sfc.transform.cjs +18 -0
- package/cjs/jest.config.cjs +33 -0
- package/cjs/jest.media.mock.cjs +1 -0
- package/cjs/jest.style.mock.cjs +1 -0
- package/client.d.ts +1 -0
- package/client.js +1 -0
- package/lib/client/appType.d.ts +4 -0
- package/lib/client/appType.js +7 -0
- package/lib/client/index.d.ts +17 -0
- package/lib/client/index.js +106 -0
- package/lib/{bin.d.ts → node/bin.d.ts} +2 -2
- package/lib/node/bin.js +122 -0
- package/lib/{commands → node/commands}/build.d.ts +1 -1
- package/lib/node/commands/build.js +15 -0
- package/lib/{commands → node/commands}/changelog.d.ts +6 -6
- package/lib/node/commands/changelog.js +20 -0
- package/lib/{commands → node/commands}/commitLint.d.ts +1 -1
- package/lib/node/commands/commitLint.js +45 -0
- package/lib/{commands → node/commands}/compile.d.ts +7 -7
- package/lib/node/commands/compile.js +35 -0
- package/lib/{commands → node/commands}/create.d.ts +8 -8
- package/lib/node/commands/create.js +91 -0
- package/lib/{commands → node/commands}/dev.d.ts +5 -5
- package/lib/node/commands/dev.js +38 -0
- package/lib/{commands → node/commands}/gen.d.ts +8 -8
- package/lib/node/commands/gen.js +75 -0
- package/lib/{commands → node/commands}/jest.d.ts +8 -8
- package/lib/node/commands/jest.js +27 -0
- package/lib/{commands → node/commands}/lint.d.ts +1 -1
- package/lib/node/commands/lint.js +41 -0
- package/lib/{commands → node/commands}/preview.d.ts +1 -1
- package/lib/node/commands/preview.js +18 -0
- package/lib/{commands → node/commands}/release.d.ts +5 -5
- package/lib/node/commands/release.js +146 -0
- package/lib/{commands → node/commands}/vite.d.ts +3 -3
- package/lib/node/commands/vite.js +13 -0
- package/lib/{compiler → node/compiler}/compileModule.d.ts +5 -5
- package/lib/node/compiler/compileModule.js +74 -0
- package/lib/{compiler → node/compiler}/compileSFC.d.ts +2 -2
- package/lib/node/compiler/compileSFC.js +79 -0
- package/lib/{compiler → node/compiler}/compileScript.d.ts +17 -17
- package/lib/node/compiler/compileScript.js +141 -0
- package/lib/{compiler → node/compiler}/compileSiteEntry.d.ts +13 -13
- package/lib/node/compiler/compileSiteEntry.js +128 -0
- package/lib/{compiler → node/compiler}/compileStyle.d.ts +11 -11
- package/lib/node/compiler/compileStyle.js +39 -0
- package/lib/{compiler → node/compiler}/compileTemplateHighlight.d.ts +10 -10
- package/lib/node/compiler/compileTemplateHighlight.js +133 -0
- package/lib/{compiler → node/compiler}/compileTypes.d.ts +2 -2
- package/lib/node/compiler/compileTypes.js +45 -0
- package/lib/{config → node/config}/varlet.config.d.ts +45 -44
- package/lib/node/config/varlet.config.js +27 -0
- package/lib/node/config/varlet.default.config.d.ts +2 -0
- package/lib/node/config/varlet.default.config.js +264 -0
- package/lib/node/config/vite.config.d.ts +6 -0
- package/lib/node/config/vite.config.js +144 -0
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.js +1 -0
- package/lib/{shared → node/shared}/constant.d.ts +42 -43
- package/lib/node/shared/constant.js +47 -0
- package/lib/{shared → node/shared}/fsUtils.d.ts +13 -12
- package/lib/node/shared/fsUtils.js +48 -0
- package/lib/{shared → node/shared}/logger.d.ts +8 -8
- package/lib/node/shared/logger.js +18 -0
- package/package.json +22 -19
- package/{preset.js → preset.cjs} +1 -1
- package/site/components/button/index.ts +10 -10
- package/site/components/cell/index.ts +10 -10
- package/site/components/code-example/CodeExample.vue +2 -1
- package/site/components/code-example/codeExample.less +41 -41
- package/site/components/code-example/index.ts +10 -10
- package/site/components/context/zIndex.ts +20 -20
- package/site/components/icon/icon.less +26 -26
- package/site/components/icon/index.ts +10 -10
- package/site/components/icon/props.ts +24 -24
- package/site/components/loading/index.ts +10 -10
- package/site/components/progress/index.ts +10 -10
- package/site/components/snackbar/snackbar.less +135 -135
- package/site/components/styles/common.less +64 -64
- package/site/components/styles/elevation.less +126 -126
- package/site/components/styles/var.less +27 -27
- package/site/components/utils/components.ts +1 -4
- package/site/components/utils/elements.ts +1 -1
- package/site/index.html +49 -49
- package/site/mobile/App.vue +27 -26
- package/site/mobile/components/AppHome.vue +2 -1
- package/site/mobile/components/app-bar/index.ts +10 -10
- package/site/mobile/components/app-bar/props.ts +25 -25
- package/site/mobile.html +41 -41
- package/site/module.d.ts +5 -5
- package/site/pc/App.vue +2 -1
- package/site/pc/Layout.vue +2 -1
- package/site/pc/components/AppHeader.vue +4 -2
- package/site/pc/pages/index/index.vue +8 -4
- package/site/tsconfig.json +11 -11
- package/site/useProgress.ts +2 -1
- package/site/utils.ts +6 -137
- package/template/generators/config/default/base/{varlet.config.js → varlet.config.mjs} +2 -2
- package/template/generators/config/i18n/base/{varlet.config.js → varlet.config.mjs} +2 -2
- package/tsconfig.json +2 -9
- package/lib/bin.js +0 -102
- package/lib/commands/build.js +0 -67
- package/lib/commands/changelog.js +0 -27
- package/lib/commands/commitLint.js +0 -21
- package/lib/commands/compile.js +0 -119
- package/lib/commands/create.js +0 -166
- package/lib/commands/dev.js +0 -123
- package/lib/commands/gen.js +0 -138
- package/lib/commands/jest.js +0 -85
- package/lib/commands/lint.js +0 -123
- package/lib/commands/preview.js +0 -74
- package/lib/commands/release.js +0 -305
- package/lib/commands/vite.js +0 -69
- package/lib/compiler/compileModule.js +0 -190
- package/lib/compiler/compileSFC.js +0 -135
- package/lib/compiler/compileScript.js +0 -194
- package/lib/compiler/compileSiteEntry.js +0 -237
- package/lib/compiler/compileStyle.js +0 -91
- package/lib/compiler/compileTemplateHighlight.js +0 -193
- package/lib/compiler/compileTypes.js +0 -85
- package/lib/config/babel.config.d.ts +0 -2
- package/lib/config/babel.config.js +0 -31
- package/lib/config/babel.sfc.transform.d.ts +0 -1
- package/lib/config/babel.sfc.transform.js +0 -18
- package/lib/config/jest.config.d.ts +0 -1
- package/lib/config/jest.config.js +0 -37
- package/lib/config/jest.media.mock.d.ts +0 -0
- package/lib/config/jest.media.mock.js +0 -2
- package/lib/config/jest.style.mock.d.ts +0 -0
- package/lib/config/jest.style.mock.js +0 -2
- package/lib/config/varlet.config.js +0 -35
- package/lib/config/vite.config.d.ts +0 -5
- package/lib/config/vite.config.js +0 -162
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -5
- package/lib/shared/constant.js +0 -50
- package/lib/shared/fsUtils.js +0 -108
- package/lib/shared/logger.js +0 -23
- package/site/mobile/components/AppType.vue +0 -22
- package/varlet.default.config.js +0 -267
package/site/mobile/App.vue
CHANGED
|
@@ -77,14 +77,11 @@ import { computed, ComputedRef, defineComponent, ref, Ref, watch } from 'vue'
|
|
|
77
77
|
import { useRoute } from 'vue-router'
|
|
78
78
|
import {
|
|
79
79
|
getBrowserTheme,
|
|
80
|
-
|
|
81
|
-
isPhone,
|
|
82
|
-
removeEmpty,
|
|
83
|
-
setTheme,
|
|
84
|
-
Theme,
|
|
80
|
+
type Theme,
|
|
85
81
|
watchLang,
|
|
86
82
|
watchTheme
|
|
87
|
-
} from '
|
|
83
|
+
} from '@varlet/cli/client'
|
|
84
|
+
import { removeEmpty, setTheme, inIframe, isPhone } from '../utils'
|
|
88
85
|
import { bigCamelize } from '@varlet/shared'
|
|
89
86
|
import { get } from 'lodash-es'
|
|
90
87
|
|
|
@@ -151,13 +148,13 @@ export default defineComponent({
|
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
const toggleTheme = () => {
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
setCurrentTheme(currentTheme.value === 'darkTheme' ? 'lightTheme' : 'darkTheme')
|
|
152
|
+
window.postMessage(getThemeMessage(), '*')
|
|
156
153
|
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
if (!isPhone() && inIframe()) {
|
|
155
|
+
;(window.top as any).postMessage(getThemeMessage(), '*')
|
|
156
|
+
}
|
|
159
157
|
}
|
|
160
|
-
}
|
|
161
158
|
|
|
162
159
|
;(window as any).toggleTheme = toggleTheme
|
|
163
160
|
|
|
@@ -194,6 +191,7 @@ export default defineComponent({
|
|
|
194
191
|
<style lang="less">
|
|
195
192
|
* {
|
|
196
193
|
-webkit-font-smoothing: antialiased;
|
|
194
|
+
box-sizing: border-box;
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
body {
|
|
@@ -208,6 +206,13 @@ body {
|
|
|
208
206
|
transition: background-color 0.25s, color 0.25s;
|
|
209
207
|
}
|
|
210
208
|
|
|
209
|
+
header {
|
|
210
|
+
position: fixed;
|
|
211
|
+
z-index: 99;
|
|
212
|
+
width: 100%;
|
|
213
|
+
font-weight: bold;
|
|
214
|
+
}
|
|
215
|
+
|
|
211
216
|
::-webkit-scrollbar {
|
|
212
217
|
display: none;
|
|
213
218
|
width: 0;
|
|
@@ -228,17 +233,6 @@ body {
|
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
235
|
|
|
231
|
-
header {
|
|
232
|
-
position: fixed;
|
|
233
|
-
z-index: 99;
|
|
234
|
-
width: 100%;
|
|
235
|
-
font-weight: bold;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.app-bar {
|
|
239
|
-
background: var(--site-config-color-app-bar) !important;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
236
|
.settings {
|
|
243
237
|
position: fixed;
|
|
244
238
|
z-index: 200;
|
|
@@ -251,10 +245,6 @@ header {
|
|
|
251
245
|
padding: 55px 15px 15px;
|
|
252
246
|
}
|
|
253
247
|
|
|
254
|
-
* {
|
|
255
|
-
box-sizing: border-box;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
248
|
.mobile-language-cell {
|
|
259
249
|
color: var(--site-config-color-text) !important;
|
|
260
250
|
background: var(--site-config-color-bar) !important;
|
|
@@ -289,4 +279,15 @@ header {
|
|
|
289
279
|
.i18n-button {
|
|
290
280
|
padding-right: 6px !important;
|
|
291
281
|
}
|
|
282
|
+
|
|
283
|
+
.app-type {
|
|
284
|
+
width: 100%;
|
|
285
|
+
padding: 15px 0;
|
|
286
|
+
color: var(--site-config-color-sub-text);
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.app-bar {
|
|
291
|
+
background: var(--site-config-color-app-bar) !important;
|
|
292
|
+
}
|
|
292
293
|
</style>
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
import config from '@config'
|
|
24
24
|
import { useRouter } from 'vue-router'
|
|
25
25
|
import { reactive, ref } from 'vue'
|
|
26
|
-
import {
|
|
26
|
+
import { watchLang, watchPlatform } from '@varlet/cli/client'
|
|
27
|
+
import { inIframe, isPhone } from '../../utils'
|
|
27
28
|
|
|
28
29
|
export default {
|
|
29
30
|
name: 'AppHome',
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
|
-
import AppBar from './AppBar.vue'
|
|
3
|
-
|
|
4
|
-
AppBar.install = function (app: App) {
|
|
5
|
-
app.component(AppBar.name, AppBar)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const _AppBarComponent = AppBar
|
|
9
|
-
|
|
10
|
-
export default AppBar
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import AppBar from './AppBar.vue'
|
|
3
|
+
|
|
4
|
+
AppBar.install = function (app: App) {
|
|
5
|
+
app.component(AppBar.name, AppBar)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const _AppBarComponent = AppBar
|
|
9
|
+
|
|
10
|
+
export default AppBar
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
export function positionValidator(position: string): boolean {
|
|
2
|
-
const validPositions = ['left', 'center', 'right']
|
|
3
|
-
return validPositions.includes(position)
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export const props = {
|
|
7
|
-
color: {
|
|
8
|
-
type: String,
|
|
9
|
-
},
|
|
10
|
-
textColor: {
|
|
11
|
-
type: String,
|
|
12
|
-
},
|
|
13
|
-
title: {
|
|
14
|
-
type: String,
|
|
15
|
-
},
|
|
16
|
-
titlePosition: {
|
|
17
|
-
type: String,
|
|
18
|
-
default: 'left',
|
|
19
|
-
validator: positionValidator,
|
|
20
|
-
},
|
|
21
|
-
elevation: {
|
|
22
|
-
type: Boolean,
|
|
23
|
-
default: true,
|
|
24
|
-
},
|
|
25
|
-
}
|
|
1
|
+
export function positionValidator(position: string): boolean {
|
|
2
|
+
const validPositions = ['left', 'center', 'right']
|
|
3
|
+
return validPositions.includes(position)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const props = {
|
|
7
|
+
color: {
|
|
8
|
+
type: String,
|
|
9
|
+
},
|
|
10
|
+
textColor: {
|
|
11
|
+
type: String,
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
titlePosition: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'left',
|
|
19
|
+
validator: positionValidator,
|
|
20
|
+
},
|
|
21
|
+
elevation: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: true,
|
|
24
|
+
},
|
|
25
|
+
}
|