@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.
Files changed (143) hide show
  1. package/README.en-US.md +2 -2
  2. package/README.md +2 -2
  3. package/cjs/babel.config.cjs +29 -0
  4. package/cjs/babel.sfc.transform.cjs +18 -0
  5. package/cjs/jest.config.cjs +33 -0
  6. package/cjs/jest.media.mock.cjs +1 -0
  7. package/cjs/jest.style.mock.cjs +1 -0
  8. package/client.d.ts +1 -0
  9. package/client.js +1 -0
  10. package/lib/client/appType.d.ts +4 -0
  11. package/lib/client/appType.js +7 -0
  12. package/lib/client/index.d.ts +17 -0
  13. package/lib/client/index.js +106 -0
  14. package/lib/{bin.d.ts → node/bin.d.ts} +2 -2
  15. package/lib/node/bin.js +122 -0
  16. package/lib/{commands → node/commands}/build.d.ts +1 -1
  17. package/lib/node/commands/build.js +15 -0
  18. package/lib/{commands → node/commands}/changelog.d.ts +6 -6
  19. package/lib/node/commands/changelog.js +20 -0
  20. package/lib/{commands → node/commands}/commitLint.d.ts +1 -1
  21. package/lib/node/commands/commitLint.js +45 -0
  22. package/lib/{commands → node/commands}/compile.d.ts +7 -7
  23. package/lib/node/commands/compile.js +35 -0
  24. package/lib/{commands → node/commands}/create.d.ts +8 -8
  25. package/lib/node/commands/create.js +91 -0
  26. package/lib/{commands → node/commands}/dev.d.ts +5 -5
  27. package/lib/node/commands/dev.js +38 -0
  28. package/lib/{commands → node/commands}/gen.d.ts +8 -8
  29. package/lib/node/commands/gen.js +75 -0
  30. package/lib/{commands → node/commands}/jest.d.ts +8 -8
  31. package/lib/node/commands/jest.js +27 -0
  32. package/lib/{commands → node/commands}/lint.d.ts +1 -1
  33. package/lib/node/commands/lint.js +41 -0
  34. package/lib/{commands → node/commands}/preview.d.ts +1 -1
  35. package/lib/node/commands/preview.js +18 -0
  36. package/lib/{commands → node/commands}/release.d.ts +5 -5
  37. package/lib/node/commands/release.js +146 -0
  38. package/lib/{commands → node/commands}/vite.d.ts +3 -3
  39. package/lib/node/commands/vite.js +13 -0
  40. package/lib/{compiler → node/compiler}/compileModule.d.ts +5 -5
  41. package/lib/node/compiler/compileModule.js +74 -0
  42. package/lib/{compiler → node/compiler}/compileSFC.d.ts +2 -2
  43. package/lib/node/compiler/compileSFC.js +79 -0
  44. package/lib/{compiler → node/compiler}/compileScript.d.ts +17 -17
  45. package/lib/node/compiler/compileScript.js +141 -0
  46. package/lib/{compiler → node/compiler}/compileSiteEntry.d.ts +13 -13
  47. package/lib/node/compiler/compileSiteEntry.js +128 -0
  48. package/lib/{compiler → node/compiler}/compileStyle.d.ts +11 -11
  49. package/lib/node/compiler/compileStyle.js +39 -0
  50. package/lib/{compiler → node/compiler}/compileTemplateHighlight.d.ts +10 -10
  51. package/lib/node/compiler/compileTemplateHighlight.js +133 -0
  52. package/lib/{compiler → node/compiler}/compileTypes.d.ts +2 -2
  53. package/lib/node/compiler/compileTypes.js +45 -0
  54. package/lib/{config → node/config}/varlet.config.d.ts +45 -44
  55. package/lib/node/config/varlet.config.js +27 -0
  56. package/lib/node/config/varlet.default.config.d.ts +2 -0
  57. package/lib/node/config/varlet.default.config.js +264 -0
  58. package/lib/node/config/vite.config.d.ts +6 -0
  59. package/lib/node/config/vite.config.js +144 -0
  60. package/lib/node/index.d.ts +1 -0
  61. package/lib/node/index.js +1 -0
  62. package/lib/{shared → node/shared}/constant.d.ts +42 -43
  63. package/lib/node/shared/constant.js +47 -0
  64. package/lib/{shared → node/shared}/fsUtils.d.ts +13 -12
  65. package/lib/node/shared/fsUtils.js +48 -0
  66. package/lib/{shared → node/shared}/logger.d.ts +8 -8
  67. package/lib/node/shared/logger.js +18 -0
  68. package/package.json +22 -19
  69. package/{preset.js → preset.cjs} +1 -1
  70. package/site/components/button/index.ts +10 -10
  71. package/site/components/cell/index.ts +10 -10
  72. package/site/components/code-example/CodeExample.vue +2 -1
  73. package/site/components/code-example/codeExample.less +41 -41
  74. package/site/components/code-example/index.ts +10 -10
  75. package/site/components/context/zIndex.ts +20 -20
  76. package/site/components/icon/icon.less +26 -26
  77. package/site/components/icon/index.ts +10 -10
  78. package/site/components/icon/props.ts +24 -24
  79. package/site/components/loading/index.ts +10 -10
  80. package/site/components/progress/index.ts +10 -10
  81. package/site/components/snackbar/snackbar.less +135 -135
  82. package/site/components/styles/common.less +64 -64
  83. package/site/components/styles/elevation.less +126 -126
  84. package/site/components/styles/var.less +27 -27
  85. package/site/components/utils/components.ts +1 -4
  86. package/site/components/utils/elements.ts +1 -1
  87. package/site/index.html +49 -49
  88. package/site/mobile/App.vue +27 -26
  89. package/site/mobile/components/AppHome.vue +2 -1
  90. package/site/mobile/components/app-bar/index.ts +10 -10
  91. package/site/mobile/components/app-bar/props.ts +25 -25
  92. package/site/mobile.html +41 -41
  93. package/site/module.d.ts +5 -5
  94. package/site/pc/App.vue +2 -1
  95. package/site/pc/Layout.vue +2 -1
  96. package/site/pc/components/AppHeader.vue +4 -2
  97. package/site/pc/pages/index/index.vue +8 -4
  98. package/site/tsconfig.json +11 -11
  99. package/site/useProgress.ts +2 -1
  100. package/site/utils.ts +6 -137
  101. package/template/generators/config/default/base/{varlet.config.js → varlet.config.mjs} +2 -2
  102. package/template/generators/config/i18n/base/{varlet.config.js → varlet.config.mjs} +2 -2
  103. package/tsconfig.json +2 -9
  104. package/lib/bin.js +0 -102
  105. package/lib/commands/build.js +0 -67
  106. package/lib/commands/changelog.js +0 -27
  107. package/lib/commands/commitLint.js +0 -21
  108. package/lib/commands/compile.js +0 -119
  109. package/lib/commands/create.js +0 -166
  110. package/lib/commands/dev.js +0 -123
  111. package/lib/commands/gen.js +0 -138
  112. package/lib/commands/jest.js +0 -85
  113. package/lib/commands/lint.js +0 -123
  114. package/lib/commands/preview.js +0 -74
  115. package/lib/commands/release.js +0 -305
  116. package/lib/commands/vite.js +0 -69
  117. package/lib/compiler/compileModule.js +0 -190
  118. package/lib/compiler/compileSFC.js +0 -135
  119. package/lib/compiler/compileScript.js +0 -194
  120. package/lib/compiler/compileSiteEntry.js +0 -237
  121. package/lib/compiler/compileStyle.js +0 -91
  122. package/lib/compiler/compileTemplateHighlight.js +0 -193
  123. package/lib/compiler/compileTypes.js +0 -85
  124. package/lib/config/babel.config.d.ts +0 -2
  125. package/lib/config/babel.config.js +0 -31
  126. package/lib/config/babel.sfc.transform.d.ts +0 -1
  127. package/lib/config/babel.sfc.transform.js +0 -18
  128. package/lib/config/jest.config.d.ts +0 -1
  129. package/lib/config/jest.config.js +0 -37
  130. package/lib/config/jest.media.mock.d.ts +0 -0
  131. package/lib/config/jest.media.mock.js +0 -2
  132. package/lib/config/jest.style.mock.d.ts +0 -0
  133. package/lib/config/jest.style.mock.js +0 -2
  134. package/lib/config/varlet.config.js +0 -35
  135. package/lib/config/vite.config.d.ts +0 -5
  136. package/lib/config/vite.config.js +0 -162
  137. package/lib/index.d.ts +0 -1
  138. package/lib/index.js +0 -5
  139. package/lib/shared/constant.js +0 -50
  140. package/lib/shared/fsUtils.js +0 -108
  141. package/lib/shared/logger.js +0 -23
  142. package/site/mobile/components/AppType.vue +0 -22
  143. package/varlet.default.config.js +0 -267
@@ -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
- inIframe,
81
- isPhone,
82
- removeEmpty,
83
- setTheme,
84
- Theme,
80
+ type Theme,
85
81
  watchLang,
86
82
  watchTheme
87
- } from '../utils'
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
- setCurrentTheme(currentTheme.value === 'darkTheme' ? 'lightTheme' : 'darkTheme')
155
- window.postMessage(getThemeMessage(), '*')
151
+ setCurrentTheme(currentTheme.value === 'darkTheme' ? 'lightTheme' : 'darkTheme')
152
+ window.postMessage(getThemeMessage(), '*')
156
153
 
157
- if (!isPhone() && inIframe()) {
158
- ;(window.top as any).postMessage(getThemeMessage(), '*')
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 { inIframe, isPhone, watchLang, watchPlatform } from '../../utils'
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
+ }