@varlet/cli 1.23.11 → 1.24.2-alpha.1640861757955

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 (49) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/generators/base/package.json +2 -2
  3. package/lib/commands/changelog.d.ts +6 -0
  4. package/lib/commands/changelog.js +27 -0
  5. package/lib/commands/commitLint.d.ts +1 -0
  6. package/lib/commands/commitLint.js +21 -0
  7. package/lib/commands/compile.js +3 -3
  8. package/lib/commands/create.js +8 -8
  9. package/lib/commands/dev.js +2 -2
  10. package/lib/commands/gen.js +3 -3
  11. package/lib/commands/jest.js +1 -1
  12. package/lib/commands/release.d.ts +1 -0
  13. package/lib/commands/release.js +197 -0
  14. package/lib/compiler/compileSFC.js +5 -5
  15. package/lib/compiler/compileScript.js +19 -19
  16. package/lib/compiler/compileSiteEntry.js +7 -7
  17. package/lib/compiler/compileStyle.js +6 -6
  18. package/lib/compiler/compileTemplateHighlight.js +4 -4
  19. package/lib/compiler/compileTypes.js +5 -5
  20. package/lib/config/jest.config.js +3 -3
  21. package/lib/config/vite.config.js +5 -5
  22. package/lib/index.js +13 -2
  23. package/package.json +30 -37
  24. package/site/components/code-example/CodeExample.vue +107 -0
  25. package/site/components/code-example/codeExample.less +23 -0
  26. package/site/components/code-example/index.ts +10 -0
  27. package/site/components/icon/icon.less +1 -0
  28. package/site/components/loading/props.ts +2 -2
  29. package/site/components/snackbar/Snackbar.vue +38 -0
  30. package/site/components/snackbar/core.vue +117 -0
  31. package/site/components/snackbar/index.tsx +270 -0
  32. package/site/components/snackbar/props.ts +94 -0
  33. package/site/components/snackbar/snackbar.less +135 -0
  34. package/site/components/utils/elements.ts +8 -0
  35. package/site/components/utils/shared.ts +3 -0
  36. package/site/mobile/App.vue +6 -6
  37. package/site/module.d.ts +4 -0
  38. package/site/pc/App.vue +8 -10
  39. package/site/pc/components/AppHeader.vue +8 -9
  40. package/site/pc/components/AppSidebar.vue +6 -6
  41. package/site/pc/main.ts +8 -2
  42. package/site/tsconfig.json +1 -6
  43. package/site/useProgress.ts +6 -2
  44. package/site/utils.ts +4 -3
  45. package/tsconfig.json +0 -2
  46. package/varlet.default.config.js +13 -0
  47. package/generators/base/.gitignore +0 -14
  48. package/site/.DS_Store +0 -0
  49. package/site/components/.DS_Store +0 -0
@@ -27,12 +27,12 @@
27
27
  // @ts-ignore
28
28
  import config from '@config'
29
29
  import { MenuTypes } from '../../utils'
30
- import { reactive, ref } from 'vue'
30
+ import { reactive, ref, defineComponent } from 'vue'
31
31
  import type { PropType } from 'vue'
32
- import type { Menu } from '../App'
32
+ import type { Menu } from '../App.vue'
33
33
  import { get } from 'lodash-es'
34
34
 
35
- export default {
35
+ export default defineComponent({
36
36
  name: 'AppSidebar',
37
37
  props: {
38
38
  menu: {
@@ -50,7 +50,7 @@ export default {
50
50
  const menuTypes = reactive(MenuTypes)
51
51
  const themes = ref(get(config, 'themes'))
52
52
 
53
- const changeRoute = (item) => {
53
+ const changeRoute = (item: Menu) => {
54
54
  if (item.type === MenuTypes.TITLE || props.menuName === item.doc) {
55
55
  return
56
56
  }
@@ -64,7 +64,7 @@ export default {
64
64
  changeRoute
65
65
  }
66
66
  }
67
- }
67
+ })
68
68
  </script>
69
69
 
70
70
  <style scoped lang="less">
@@ -75,7 +75,7 @@ export default {
75
75
  top: 60px;
76
76
  bottom: 0;
77
77
  left: 0;
78
- z-index: 1;
78
+ z-index: 99;
79
79
  overflow-y: scroll;
80
80
  box-shadow: 0 8px 12px var(--site-config-color-shadow);
81
81
  background: var(--site-config-color-bar);
package/site/pc/main.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import App from './App.vue'
2
2
  import '@varlet/touch-emulator'
3
- // @ts-ignore
4
3
  import routes from '@pc-routes'
5
- // @ts-ignore
6
4
  import config from '@config'
7
5
 
8
6
  import Icon from '../components/icon'
9
7
  import Cell from '../components/cell'
10
8
  import Ripple from '../components/ripple'
9
+ import CodeExample from '../components/code-example'
10
+ import Snackbar from '../components/snackbar'
11
+
11
12
  import '../components/styles/common.less'
12
13
  import '../components/styles/elevation.less'
13
14
 
@@ -20,6 +21,8 @@ const defaultLanguage = get(config, 'defaultLanguage')
20
21
  const redirect = get(config, 'pc.redirect')
21
22
  const mobileRedirect = get(config, 'mobile.redirect')
22
23
 
24
+ Snackbar.allowMultiple(true)
25
+
23
26
  redirect &&
24
27
  routes.push({
25
28
  path: '/:pathMatch(.*)*',
@@ -85,4 +88,7 @@ createApp(App)
85
88
  .use(Ripple)
86
89
  // @ts-ignore
87
90
  .use(Icon)
91
+ // @ts-ignore
92
+ .use(CodeExample)
93
+ .use(Snackbar)
88
94
  .mount('#app')
@@ -1,16 +1,11 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "outDir": "./lib",
4
3
  "target": "es5",
5
- "module": "commonjs",
6
- "sourceMap": false,
7
4
  "strict": true,
8
5
  "downlevelIteration": true,
9
- "declaration": true,
10
6
  "skipLibCheck": true,
11
7
  "esModuleInterop": true,
12
8
  "jsx": "preserve",
13
9
  "lib": ["esnext", "dom"]
14
- },
15
- "include": ["*"]
10
+ }
16
11
  }
@@ -7,11 +7,15 @@ import { getBrowserThemes, mountInstance, watchThemes } from './utils'
7
7
  import { get } from 'lodash-es'
8
8
 
9
9
  function getColor(themes?: 'themes' | 'darkThemes') {
10
- return get(config, `${themes ?? getBrowserThemes()}.color-progress`)
10
+ const themesKey = get(config, 'themesKey')
11
+
12
+ return get(config, `${themes ?? getBrowserThemes(themesKey)}.color-progress`)
11
13
  }
12
14
 
13
15
  function getTrackColor(themes?: 'themes' | 'darkThemes') {
14
- return get(config, `${themes ?? getBrowserThemes()}.color-progress-track`)
16
+ const themesKey = get(config, 'themesKey')
17
+
18
+ return get(config, `${themes ?? getBrowserThemes(themesKey)}.color-progress-track`)
15
19
  }
16
20
 
17
21
  export function useProgress() {
package/site/utils.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { onMounted, onUnmounted } from 'vue'
2
2
  import { get } from 'lodash-es'
3
3
  import { formatStyleVars } from './components/utils/elements'
4
+ import config from '@config'
4
5
 
5
6
  export * from './components/utils/components'
6
7
  export * from './components/utils/elements'
@@ -138,12 +139,12 @@ export function setThemes(config: Record<string, any>, name: 'themes' | 'darkThe
138
139
  StyleProvider(styleVars)
139
140
  }
140
141
 
141
- export function getBrowserThemes(): 'darkThemes' | 'themes' {
142
- let currentThemes = window.localStorage.getItem('currentThemes') as 'darkThemes' | 'themes'
142
+ export function getBrowserThemes(themes = 'VARLET_THEMES'): 'darkThemes' | 'themes' {
143
+ let currentThemes = window.localStorage.getItem(themes) as 'darkThemes' | 'themes'
143
144
 
144
145
  if (!currentThemes) {
145
146
  currentThemes = window.matchMedia?.('(prefers-color-scheme: dark)').matches ? 'darkThemes' : 'themes'
146
- window.localStorage.setItem('currentThemes', currentThemes)
147
+ window.localStorage.setItem(themes, currentThemes)
147
148
  }
148
149
 
149
150
  return currentThemes
package/tsconfig.json CHANGED
@@ -2,8 +2,6 @@
2
2
  "compilerOptions": {
3
3
  "outDir": "./lib",
4
4
  "target": "es5",
5
- "module": "commonjs",
6
- "sourceMap": false,
7
5
  "strict": true,
8
6
  "downlevelIteration": true,
9
7
  "declaration": true,
@@ -4,6 +4,7 @@ module.exports = {
4
4
  host: 'localhost',
5
5
  port: 8080,
6
6
  title: 'VARLET',
7
+ themesKey: 'VARLET_THEMES',
7
8
  logo: 'https://varlet.gitee.io/varlet-ui/varlet_icon.png',
8
9
  defaultLanguage: 'zh-CN',
9
10
  highlight: {
@@ -31,6 +32,18 @@ module.exports = {
31
32
  github: 'https://github.com/haoziqaq/varlet',
32
33
  darkMode: true,
33
34
  },
35
+ clipboard: {
36
+ 'zh-CN': '代码已复制到剪切板',
37
+ 'en-US': 'The code has been copied to the clipboard',
38
+ },
39
+ fold: {
40
+ message: {
41
+ 'zh-CN': '已显示完整代码',
42
+ 'en-US': 'Complete code displayed',
43
+ },
44
+ defaultFold: true,
45
+ foldHeight: 60,
46
+ },
34
47
  },
35
48
  mobile: {
36
49
  redirect: '/home',
@@ -1,14 +0,0 @@
1
- node_modules
2
-
3
- .varlet
4
- .idea
5
- .vscode
6
- *.log
7
- .DS_Store
8
-
9
- site
10
- lib
11
- es
12
- umd
13
- coverage
14
- highlight
package/site/.DS_Store DELETED
Binary file
Binary file