@varlet/cli 1.25.0-alpha.1642582155449 → 1.25.1-alpha.1643124613252
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@varlet/cli",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.1-alpha.1643124613252",
|
|
4
4
|
"description": "cli of varlet",
|
|
5
5
|
"bin": {
|
|
6
6
|
"varlet-cli": "./lib/index.js"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"@babel/helper-plugin-utils": "^7.14.5",
|
|
34
34
|
"@babel/preset-env": "^7.14.8",
|
|
35
35
|
"@babel/preset-typescript": "^7.14.5",
|
|
36
|
-
"@varlet/icons": "1.25.
|
|
37
|
-
"@varlet/markdown-vite-plugin": "1.25.
|
|
38
|
-
"@varlet/touch-emulator": "1.25.
|
|
36
|
+
"@varlet/icons": "1.25.1-alpha.1643124613252",
|
|
37
|
+
"@varlet/markdown-vite-plugin": "1.25.1-alpha.1643124613252",
|
|
38
|
+
"@varlet/touch-emulator": "1.25.1-alpha.1643124613252",
|
|
39
39
|
"@vitejs/plugin-vue": "1.9.2",
|
|
40
40
|
"@vitejs/plugin-vue-jsx": "1.1.8",
|
|
41
41
|
"@vue/babel-plugin-jsx": "1.0.7",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"@types/semver": "^7.3.9"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@varlet/touch-emulator": "1.25.
|
|
77
|
+
"@varlet/touch-emulator": "1.25.1-alpha.1643124613252",
|
|
78
78
|
"@vue/test-utils": "^2.0.0-rc.6",
|
|
79
79
|
"clipboard": "^2.0.6",
|
|
80
80
|
"live-server": "^1.2.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="var-site-code-example">
|
|
3
3
|
<div class="var-site-code-example__toolbar">
|
|
4
|
-
<var-site-button text round @click="toggle" v-if="fold">
|
|
4
|
+
<var-site-button text round @click="toggle" v-if="fold && !disabledFold">
|
|
5
5
|
<var-site-icon name="xml" size="18" />
|
|
6
6
|
</var-site-button>
|
|
7
7
|
|
|
@@ -53,30 +53,21 @@ export default defineComponent({
|
|
|
53
53
|
const code: Ref<HTMLElement | null> = ref(null)
|
|
54
54
|
const cid: Ref<number> = ref(clipId++)
|
|
55
55
|
const fold: Ref = ref(get(config, 'pc.fold'))
|
|
56
|
+
const disabledFold: Ref<boolean> = ref(false)
|
|
56
57
|
const clipboard: Ref = ref(get(config, 'pc.clipboard', {}))
|
|
57
|
-
const height: Ref<number> = ref(
|
|
58
|
+
const height: Ref<number> = ref(-1)
|
|
59
|
+
|
|
60
|
+
let fullHeight = 0
|
|
58
61
|
|
|
59
62
|
const toggle = async () => {
|
|
60
63
|
const foldHeight = fold.value.foldHeight
|
|
61
64
|
|
|
62
65
|
if (height.value === foldHeight) {
|
|
63
|
-
height.value = -1
|
|
64
|
-
await nextTick()
|
|
65
|
-
const { offsetHeight } = code.value as HTMLElement
|
|
66
|
-
|
|
67
66
|
height.value = foldHeight
|
|
68
67
|
await doubleRaf()
|
|
69
|
-
|
|
70
|
-
if (offsetHeight - foldHeight < offset) {
|
|
71
|
-
Snackbar(get(config, `pc.fold.message.${getPCLocationInfo().language}`))
|
|
72
|
-
height.value = foldHeight
|
|
73
|
-
} else {
|
|
74
|
-
height.value = offsetHeight
|
|
75
|
-
}
|
|
68
|
+
height.value = fullHeight
|
|
76
69
|
} else {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
height.value = offsetHeight
|
|
70
|
+
height.value = fullHeight
|
|
80
71
|
await doubleRaf()
|
|
81
72
|
height.value = foldHeight
|
|
82
73
|
}
|
|
@@ -88,6 +79,11 @@ export default defineComponent({
|
|
|
88
79
|
trigger.on('success', () => {
|
|
89
80
|
Snackbar.success(clipboard.value[getPCLocationInfo().language])
|
|
90
81
|
})
|
|
82
|
+
|
|
83
|
+
const { offsetHeight } = code.value as HTMLElement
|
|
84
|
+
fullHeight = offsetHeight
|
|
85
|
+
disabledFold.value = fullHeight - fold.value.foldHeight < offset
|
|
86
|
+
height.value = fold.value?.defaultFold ? fold.value?.foldHeight : -1
|
|
91
87
|
})
|
|
92
88
|
|
|
93
89
|
return {
|
|
@@ -95,6 +91,7 @@ export default defineComponent({
|
|
|
95
91
|
height,
|
|
96
92
|
cid,
|
|
97
93
|
fold,
|
|
94
|
+
disabledFold,
|
|
98
95
|
clipboard,
|
|
99
96
|
toggle
|
|
100
97
|
}
|
|
@@ -16,9 +16,8 @@ export const isPlainObject = (val: unknown): val is Record<string, any> =>
|
|
|
16
16
|
Object.prototype.toString.call(val) === '[object Object]'
|
|
17
17
|
|
|
18
18
|
export function kebabCase(str: string): string {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
return str.replace(reg, '$1-$2').replace(reg, '$1-$2').toLowerCase()
|
|
19
|
+
const ret = str.replace(/([A-Z])/g, ' $1').trim()
|
|
20
|
+
return ret.split(' ').join('-').toLowerCase()
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export const isString = (val: unknown): val is string => typeof val === 'string'
|
package/varlet.default.config.js
CHANGED
|
@@ -37,10 +37,6 @@ module.exports = {
|
|
|
37
37
|
'en-US': 'The code has been copied to the clipboard',
|
|
38
38
|
},
|
|
39
39
|
fold: {
|
|
40
|
-
message: {
|
|
41
|
-
'zh-CN': '已显示完整代码',
|
|
42
|
-
'en-US': 'Complete code displayed',
|
|
43
|
-
},
|
|
44
40
|
defaultFold: true,
|
|
45
41
|
foldHeight: 60,
|
|
46
42
|
},
|
|
@@ -100,7 +96,7 @@ module.exports = {
|
|
|
100
96
|
'color-progress-track': '#202020',
|
|
101
97
|
'color-side-bar': '#4a7afe',
|
|
102
98
|
'color-side-bar-active-background': '#4a7afe1a',
|
|
103
|
-
'color-app-bar': '#
|
|
99
|
+
'color-app-bar': '#272727',
|
|
104
100
|
'color-nav-button-hover-background': 'rgba(255, 255, 255, 0.08)',
|
|
105
101
|
'color-mobile-cell-hover': '#4a7afe',
|
|
106
102
|
'color-pc-language-active': '#4a7afe',
|