@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.
- package/CHANGELOG.md +26 -0
- package/generators/base/package.json +2 -2
- package/lib/commands/changelog.d.ts +6 -0
- package/lib/commands/changelog.js +27 -0
- package/lib/commands/commitLint.d.ts +1 -0
- package/lib/commands/commitLint.js +21 -0
- package/lib/commands/compile.js +3 -3
- package/lib/commands/create.js +8 -8
- package/lib/commands/dev.js +2 -2
- package/lib/commands/gen.js +3 -3
- package/lib/commands/jest.js +1 -1
- package/lib/commands/release.d.ts +1 -0
- package/lib/commands/release.js +197 -0
- package/lib/compiler/compileSFC.js +5 -5
- package/lib/compiler/compileScript.js +19 -19
- package/lib/compiler/compileSiteEntry.js +7 -7
- package/lib/compiler/compileStyle.js +6 -6
- package/lib/compiler/compileTemplateHighlight.js +4 -4
- package/lib/compiler/compileTypes.js +5 -5
- package/lib/config/jest.config.js +3 -3
- package/lib/config/vite.config.js +5 -5
- package/lib/index.js +13 -2
- package/package.json +30 -37
- package/site/components/code-example/CodeExample.vue +107 -0
- package/site/components/code-example/codeExample.less +23 -0
- package/site/components/code-example/index.ts +10 -0
- package/site/components/icon/icon.less +1 -0
- package/site/components/loading/props.ts +2 -2
- package/site/components/snackbar/Snackbar.vue +38 -0
- package/site/components/snackbar/core.vue +117 -0
- package/site/components/snackbar/index.tsx +270 -0
- package/site/components/snackbar/props.ts +94 -0
- package/site/components/snackbar/snackbar.less +135 -0
- package/site/components/utils/elements.ts +8 -0
- package/site/components/utils/shared.ts +3 -0
- package/site/mobile/App.vue +6 -6
- package/site/module.d.ts +4 -0
- package/site/pc/App.vue +8 -10
- package/site/pc/components/AppHeader.vue +8 -9
- package/site/pc/components/AppSidebar.vue +6 -6
- package/site/pc/main.ts +8 -2
- package/site/tsconfig.json +1 -6
- package/site/useProgress.ts +6 -2
- package/site/utils.ts +4 -3
- package/tsconfig.json +0 -2
- package/varlet.default.config.js +13 -0
- package/generators/base/.gitignore +0 -14
- package/site/.DS_Store +0 -0
- 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:
|
|
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')
|
package/site/tsconfig.json
CHANGED
|
@@ -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
|
}
|
package/site/useProgress.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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(
|
|
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(
|
|
147
|
+
window.localStorage.setItem(themes, currentThemes)
|
|
147
148
|
}
|
|
148
149
|
|
|
149
150
|
return currentThemes
|
package/tsconfig.json
CHANGED
package/varlet.default.config.js
CHANGED
|
@@ -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',
|
package/site/.DS_Store
DELETED
|
Binary file
|
|
Binary file
|