@varlet/cli 1.27.20 → 2.0.0-alpha.1663499244572
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/LICENCE +21 -21
- package/README.en-US.md +401 -401
- package/README.md +396 -396
- package/lib/commands/build.d.ts +1 -1
- package/lib/commands/build.js +18 -67
- package/lib/commands/changelog.d.ts +6 -6
- package/lib/commands/changelog.js +26 -27
- package/lib/commands/commitLint.d.ts +1 -1
- package/lib/commands/commitLint.js +50 -21
- package/lib/commands/compile.d.ts +7 -5
- package/lib/commands/compile.js +43 -119
- package/lib/commands/create.d.ts +8 -3
- package/lib/commands/create.js +90 -132
- package/lib/commands/dev.d.ts +5 -3
- package/lib/commands/dev.js +44 -123
- package/lib/commands/gen.d.ts +8 -1
- package/lib/commands/gen.js +85 -112
- package/lib/commands/lint.d.ts +1 -1
- package/lib/commands/lint.js +48 -123
- package/lib/commands/preview.d.ts +1 -1
- package/lib/commands/preview.js +23 -74
- package/lib/commands/release.d.ts +5 -3
- package/lib/commands/release.js +132 -270
- package/lib/commands/test.d.ts +7 -0
- package/lib/commands/test.js +26 -0
- package/lib/commands/vite.d.ts +3 -0
- package/lib/commands/vite.js +20 -0
- package/lib/compiler/compileModule.d.ts +5 -5
- package/lib/compiler/compileModule.js +79 -186
- package/lib/compiler/compileSFC.d.ts +2 -2
- package/lib/compiler/compileSFC.js +86 -132
- package/lib/compiler/compileScript.d.ts +17 -17
- package/lib/compiler/compileScript.js +152 -202
- package/lib/compiler/compileSiteEntry.d.ts +13 -13
- package/lib/compiler/compileSiteEntry.js +140 -237
- package/lib/compiler/compileStyle.d.ts +11 -11
- package/lib/compiler/compileStyle.js +43 -101
- package/lib/compiler/compileTemplateHighlight.d.ts +10 -10
- package/lib/compiler/compileTemplateHighlight.js +145 -193
- package/lib/compiler/compileTypes.d.ts +2 -2
- package/lib/compiler/compileTypes.js +49 -88
- package/lib/config/babel.config.d.ts +2 -2
- package/lib/config/babel.config.js +30 -31
- package/lib/config/babel.sfc.transform.d.ts +1 -1
- package/lib/config/babel.sfc.transform.js +18 -18
- package/lib/config/varlet.config.d.ts +1 -1
- package/lib/config/varlet.config.js +23 -24
- package/lib/config/vite.config.d.ts +5 -5
- package/lib/config/vite.config.js +157 -162
- package/lib/config/vitest.config.d.ts +2 -0
- package/lib/config/vitest.config.js +28 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +84 -83
- package/lib/shared/constant.d.ts +44 -43
- package/lib/shared/constant.js +51 -50
- package/lib/shared/fsUtils.d.ts +12 -12
- package/lib/shared/fsUtils.js +61 -108
- package/lib/shared/logger.d.ts +8 -7
- package/lib/shared/logger.js +23 -20
- package/package.json +20 -17
- package/preset.js +3 -3
- package/site/components/button/Button.vue +106 -84
- package/site/components/button/button.less +183 -183
- package/site/components/button/index.ts +10 -10
- package/site/components/button/props.ts +78 -70
- package/site/components/cell/Cell.vue +54 -42
- package/site/components/cell/cell.less +78 -74
- package/site/components/cell/index.ts +10 -10
- package/site/components/cell/props.ts +27 -27
- package/site/components/code-example/CodeExample.vue +137 -143
- package/site/components/code-example/codeExample.less +41 -41
- package/site/components/code-example/index.ts +10 -10
- package/site/components/context/index.ts +21 -17
- package/site/components/context/lock.ts +92 -103
- package/site/components/context/zIndex.ts +20 -20
- package/site/components/icon/Icon.vue +75 -68
- 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/Loading.vue +84 -55
- package/site/components/loading/index.ts +10 -10
- package/site/components/loading/loading.less +505 -420
- package/site/components/loading/props.ts +42 -37
- package/site/components/popup/Popup.tsx +102 -0
- package/site/components/popup/index.ts +10 -0
- package/site/components/popup/popup.less +125 -0
- package/site/components/popup/props.ts +63 -0
- package/site/components/progress/Progress.vue +112 -108
- package/site/components/progress/index.ts +10 -10
- package/site/components/progress/progress.less +101 -98
- package/site/components/progress/props.ts +55 -55
- package/site/components/ripple/index.ts +188 -167
- package/site/components/ripple/ripple.less +20 -17
- package/site/components/snackbar/Snackbar.vue +41 -38
- package/site/components/snackbar/core.vue +132 -117
- package/site/components/snackbar/index.tsx +270 -270
- package/site/components/snackbar/props.ts +97 -94
- 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 +117 -69
- package/site/components/utils/elements.ts +102 -85
- package/site/index.html +49 -49
- package/site/mobile/App.vue +291 -291
- package/site/mobile/components/AppHome.vue +134 -134
- package/site/mobile/components/AppType.vue +22 -22
- package/site/mobile/components/app-bar/AppBar.vue +65 -69
- package/site/mobile/components/app-bar/appBar.less +57 -56
- package/site/mobile/components/app-bar/index.ts +10 -10
- package/site/mobile/components/app-bar/props.ts +25 -25
- package/site/mobile/main.ts +78 -74
- package/site/mobile.html +41 -41
- package/site/module.d.ts +5 -5
- package/site/pc/App.vue +43 -43
- package/site/pc/Layout.vue +423 -397
- package/site/pc/components/AnimationBox.vue +33 -45
- package/site/pc/components/AppHeader.vue +368 -355
- package/site/pc/components/AppMobile.vue +60 -54
- package/site/pc/components/AppSidebar.vue +143 -134
- package/site/pc/components/LogoAnimation.vue +117 -119
- package/site/pc/floating.ts +9 -9
- package/site/pc/main.ts +100 -94
- package/site/pc/pages/index/index.less +176 -231
- package/site/pc/pages/index/index.vue +130 -145
- package/site/pc/pages/index/locale/en-US.ts +1 -5
- package/site/pc/pages/index/locale/zh-CN.ts +1 -5
- package/site/tsconfig.json +11 -11
- package/site/useProgress.ts +72 -75
- package/site/utils.ts +167 -153
- package/template/create/__tests__/index.spec.ejs +8 -0
- package/{lib/config/jest.media.mock.d.ts → template/create/docs/en-US.md} +0 -0
- package/{lib/config/jest.style.mock.d.ts → template/create/docs/zh-CN.md} +0 -0
- package/template/create/example/index.ejs +15 -0
- package/template/create/example/locale/en-US.ts +3 -0
- package/{generators/config/i18n/tsx/src/button → template/create}/example/locale/index.ts +23 -23
- package/template/create/example/locale/zh-CN.ts +3 -0
- package/template/create/index.ejs +12 -0
- package/template/create/less.ejs +3 -0
- package/template/create/props.ts +1 -0
- package/template/create/tsx.ejs +13 -0
- package/template/create/vue.ejs +17 -0
- package/{generators → template/generators}/base/.prettierignore +9 -9
- package/{generators → template/generators}/base/.prettierrc +5 -5
- package/{generators → template/generators}/base/README.md +82 -82
- package/{generators → template/generators}/base/babel.config.js +10 -10
- package/{generators → template/generators}/base/public/highlight.css +1 -1
- package/{generators → template/generators}/base/public/logo.svg +1 -1
- package/{generators → template/generators}/base/shims/shims-md.d.ts +4 -4
- package/{generators → template/generators}/base/shims/shims-vue.d.ts +6 -6
- package/{generators → template/generators}/base/tsconfig.json +13 -13
- package/{generators → template/generators}/config/default/base/docs/home.zh-CN.md +10 -10
- package/{generators → template/generators}/config/default/base/package.json +105 -105
- package/{generators/config/i18n → template/generators/config/default}/base/types/basicComponent.d.ts +7 -7
- package/{generators/config/i18n → template/generators/config/default}/base/types/button.d.ts +12 -12
- package/{generators → template/generators}/config/default/base/types/index.d.ts +6 -6
- package/{generators → template/generators}/config/default/base/varlet.config.js +110 -110
- package/{generators → template/generators}/config/default/sfc/src/button/Button.vue +30 -30
- package/{generators/config/default/tsx → template/generators/config/default/sfc}/src/button/__tests__/index.spec.js +7 -7
- package/{generators/config/default/tsx → template/generators/config/default/sfc}/src/button/button.less +14 -14
- package/{generators/config/default/tsx → template/generators/config/default/sfc}/src/button/docs/zh-CN.md +47 -47
- package/{generators → template/generators}/config/default/sfc/src/button/example/BasicUse.vue +7 -7
- package/{generators → template/generators}/config/default/sfc/src/button/example/ModifyColor.vue +7 -7
- package/{generators/config/default/tsx → template/generators/config/default/sfc}/src/button/example/index.vue +13 -13
- package/{generators → template/generators}/config/default/sfc/src/button/index.ts +10 -10
- package/{generators → template/generators}/config/default/tsx/src/button/Button.tsx +29 -31
- package/{generators/config/default/sfc → template/generators/config/default/tsx}/src/button/__tests__/index.spec.js +7 -7
- package/{generators/config/i18n → template/generators/config/default}/tsx/src/button/button.less +14 -14
- package/{generators/config/default/sfc → template/generators/config/default/tsx}/src/button/docs/zh-CN.md +47 -47
- package/{generators → template/generators}/config/default/tsx/src/button/example/BasicUse.vue +7 -7
- package/{generators → template/generators}/config/default/tsx/src/button/example/ModifyColor.vue +7 -7
- package/{generators/config/default/sfc → template/generators/config/default/tsx}/src/button/example/index.vue +13 -13
- package/{generators → template/generators}/config/default/tsx/src/button/index.ts +10 -10
- package/{generators → template/generators}/config/i18n/base/docs/home.en-US.md +11 -11
- package/{generators → template/generators}/config/i18n/base/docs/home.zh-CN.md +10 -10
- package/{generators → template/generators}/config/i18n/base/package.json +105 -105
- package/{generators/config/default → template/generators/config/i18n}/base/types/basicComponent.d.ts +7 -7
- package/{generators/config/default → template/generators/config/i18n}/base/types/button.d.ts +12 -12
- package/{generators → template/generators}/config/i18n/base/types/index.d.ts +7 -7
- package/{generators → template/generators}/config/i18n/base/types/locale.d.ts +24 -24
- package/{generators → template/generators}/config/i18n/base/varlet.config.js +122 -122
- package/{generators → template/generators}/config/i18n/sfc/src/button/Button.vue +36 -36
- package/{generators → template/generators}/config/i18n/sfc/src/button/__tests__/index.spec.js +7 -7
- package/{generators → template/generators}/config/i18n/sfc/src/button/button.less +14 -14
- package/{generators → template/generators}/config/i18n/sfc/src/button/docs/en-US.md +34 -34
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/docs/zh-CN.md +34 -34
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/BasicUse.vue +11 -11
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/ModifyColor.vue +11 -11
- package/{generators → template/generators}/config/i18n/sfc/src/button/example/index.vue +13 -13
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/locale/en-US.ts +5 -5
- package/{generators → template/generators}/config/i18n/sfc/src/button/example/locale/index.ts +23 -23
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/button/example/locale/zh-CN.ts +5 -5
- package/{generators → template/generators}/config/i18n/sfc/src/button/index.ts +10 -10
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/__tests__/index.spec.js +51 -51
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/docs/en-US.md +26 -26
- package/{generators → template/generators}/config/i18n/sfc/src/locale/docs/zh-CN.md +25 -25
- package/{generators → template/generators}/config/i18n/sfc/src/locale/en-US.d.ts +5 -5
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/en-US.ts +7 -7
- package/{generators → template/generators}/config/i18n/sfc/src/locale/index.ts +67 -67
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/zh-CN.d.ts +5 -5
- package/{generators/config/i18n/tsx → template/generators/config/i18n/sfc}/src/locale/zh-CN.ts +7 -7
- package/{generators → template/generators}/config/i18n/tsx/src/button/Button.tsx +33 -35
- package/{generators → template/generators}/config/i18n/tsx/src/button/__tests__/index.spec.js +7 -7
- package/{generators/config/default/sfc → template/generators/config/i18n/tsx}/src/button/button.less +14 -14
- package/{generators → template/generators}/config/i18n/tsx/src/button/docs/en-US.md +34 -34
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/docs/zh-CN.md +34 -34
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/BasicUse.vue +11 -11
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/ModifyColor.vue +11 -11
- package/{generators → template/generators}/config/i18n/tsx/src/button/example/index.vue +13 -13
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/locale/en-US.ts +5 -5
- package/template/generators/config/i18n/tsx/src/button/example/locale/index.ts +23 -0
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/button/example/locale/zh-CN.ts +5 -5
- package/{generators → template/generators}/config/i18n/tsx/src/button/index.ts +10 -10
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/__tests__/index.spec.js +51 -51
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/docs/en-US.md +26 -26
- package/{generators → template/generators}/config/i18n/tsx/src/locale/docs/zh-CN.md +25 -25
- package/{generators → template/generators}/config/i18n/tsx/src/locale/en-US.d.ts +5 -5
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/en-US.ts +7 -7
- package/{generators → template/generators}/config/i18n/tsx/src/locale/index.ts +67 -67
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/zh-CN.d.ts +5 -5
- package/{generators/config/i18n/sfc → template/generators/config/i18n/tsx}/src/locale/zh-CN.ts +7 -7
- package/tsconfig.json +15 -14
- package/varlet.default.config.js +137 -15
- package/lib/commands/jest.d.ts +0 -8
- package/lib/commands/jest.js +0 -81
- package/lib/config/jest.config.d.ts +0 -1
- package/lib/config/jest.config.js +0 -36
- package/lib/config/jest.media.mock.js +0 -2
- package/lib/config/jest.style.mock.js +0 -2
- package/site/mobile/components/styles/common.less +0 -64
- package/site/mobile/components/styles/elevation.less +0 -126
- package/site/mobile/components/styles/var.less +0 -27
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import type { PropType } from 'vue'
|
|
2
|
-
|
|
3
|
-
export type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear'
|
|
4
|
-
|
|
5
|
-
export type LoadingSize = 'normal' | 'mini' | 'small' | 'large'
|
|
6
|
-
|
|
7
|
-
export function typeValidator(type: string): boolean {
|
|
8
|
-
return ['circle', 'wave', 'cube', 'rect', 'disappear'].includes(type)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function sizeValidator(size: string): boolean {
|
|
12
|
-
return ['normal', 'mini', 'small', 'large'].includes(size)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const props = {
|
|
16
|
-
// loading类型
|
|
17
|
-
type: {
|
|
18
|
-
type: String as PropType<LoadingType>,
|
|
19
|
-
default: 'circle',
|
|
20
|
-
validator: typeValidator,
|
|
21
|
-
},
|
|
22
|
-
radius: {
|
|
23
|
-
type: [String, Number],
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
export type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear'
|
|
4
|
+
|
|
5
|
+
export type LoadingSize = 'normal' | 'mini' | 'small' | 'large'
|
|
6
|
+
|
|
7
|
+
export function typeValidator(type: string): boolean {
|
|
8
|
+
return ['circle', 'wave', 'cube', 'rect', 'disappear'].includes(type)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function sizeValidator(size: string): boolean {
|
|
12
|
+
return ['normal', 'mini', 'small', 'large'].includes(size)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const props = {
|
|
16
|
+
// loading类型
|
|
17
|
+
type: {
|
|
18
|
+
type: String as PropType<LoadingType>,
|
|
19
|
+
default: 'circle',
|
|
20
|
+
validator: typeValidator,
|
|
21
|
+
},
|
|
22
|
+
radius: {
|
|
23
|
+
type: [String, Number],
|
|
24
|
+
},
|
|
25
|
+
// loading尺寸
|
|
26
|
+
size: {
|
|
27
|
+
type: String as PropType<LoadingSize>,
|
|
28
|
+
default: 'normal',
|
|
29
|
+
validator: sizeValidator,
|
|
30
|
+
},
|
|
31
|
+
// loading颜色
|
|
32
|
+
color: {
|
|
33
|
+
type: String,
|
|
34
|
+
},
|
|
35
|
+
description: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
loading: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { defineComponent, watch, Transition, Teleport } from 'vue'
|
|
2
|
+
import { props } from './props'
|
|
3
|
+
import { useLock } from '../context/lock'
|
|
4
|
+
import { useZIndex } from '../context/zIndex'
|
|
5
|
+
import { useRouteListener, useTeleport, createNamespace } from '../utils/components'
|
|
6
|
+
|
|
7
|
+
import '../styles/common.less'
|
|
8
|
+
import './popup.less'
|
|
9
|
+
|
|
10
|
+
const { n, classes } = createNamespace('popup')
|
|
11
|
+
|
|
12
|
+
export default defineComponent({
|
|
13
|
+
name: 'VarPopup',
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
props,
|
|
16
|
+
setup(props, { slots, attrs }) {
|
|
17
|
+
const { zIndex } = useZIndex(() => props.show, 3)
|
|
18
|
+
const { disabled } = useTeleport()
|
|
19
|
+
|
|
20
|
+
const hidePopup = () => {
|
|
21
|
+
const { closeOnClickOverlay, onClickOverlay } = props
|
|
22
|
+
|
|
23
|
+
onClickOverlay?.()
|
|
24
|
+
|
|
25
|
+
if (!closeOnClickOverlay) {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
props['onUpdate:show']?.(false)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
useLock(
|
|
33
|
+
() => props.show,
|
|
34
|
+
() => props.lockScroll
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
watch(
|
|
38
|
+
() => props.show,
|
|
39
|
+
(newValue: boolean) => {
|
|
40
|
+
const { onOpen, onClose } = props
|
|
41
|
+
newValue ? onOpen?.() : onClose?.()
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
// internal for Dialog
|
|
46
|
+
useRouteListener(() => props.onRouteChange?.())
|
|
47
|
+
|
|
48
|
+
const renderOverlay = () => {
|
|
49
|
+
const { overlayClass = '', overlayStyle } = props
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
class={classes(n('overlay'), overlayClass)}
|
|
54
|
+
style={{
|
|
55
|
+
zIndex: zIndex.value - 1,
|
|
56
|
+
...overlayStyle,
|
|
57
|
+
}}
|
|
58
|
+
onClick={hidePopup}
|
|
59
|
+
/>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const renderContent = () => {
|
|
64
|
+
return (
|
|
65
|
+
<div
|
|
66
|
+
class={classes(n('content'), 'var-site-elevation--3', n(`--${props.position}`))}
|
|
67
|
+
style={{ zIndex: zIndex.value }}
|
|
68
|
+
{...attrs}
|
|
69
|
+
>
|
|
70
|
+
{slots.default?.()}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const renderPopup = () => {
|
|
76
|
+
const { onOpened, onClosed, show, overlay, transition, position } = props
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<Transition name="var-site-fade" onAfterEnter={onOpened} onAfterLeave={onClosed}>
|
|
80
|
+
<div class={classes('var-site--box', n())} style={{ zIndex: zIndex.value - 2 }} v-show={show}>
|
|
81
|
+
{overlay && renderOverlay()}
|
|
82
|
+
<Transition name={transition || `var-site-pop-${position}`}>{show && renderContent()}</Transition>
|
|
83
|
+
</div>
|
|
84
|
+
</Transition>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return () => {
|
|
89
|
+
const { teleport } = props
|
|
90
|
+
|
|
91
|
+
if (teleport) {
|
|
92
|
+
return (
|
|
93
|
+
<Teleport to={teleport} disabled={disabled.value}>
|
|
94
|
+
{renderPopup()}
|
|
95
|
+
</Teleport>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return renderPopup()
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
})
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@site-popup-overlay-background-color: rgba(0, 0, 0, 0.6);
|
|
2
|
+
@site-popup-content-background-color: #fff;
|
|
3
|
+
|
|
4
|
+
:root {
|
|
5
|
+
--site-popup-overlay-background-color: @site-popup-overlay-background-color;
|
|
6
|
+
--site-popup-content-background-color: @site-popup-content-background-color;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.var-site {
|
|
10
|
+
&-fade-enter-from,
|
|
11
|
+
&-fade-leave-to {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
}
|
|
14
|
+
&-fade-enter-active,
|
|
15
|
+
&-fade-leave-active {
|
|
16
|
+
transition: opacity 0.25s;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-pop-center-enter-from,
|
|
20
|
+
&-pop-center-leave-to {
|
|
21
|
+
transform: scale(0.3);
|
|
22
|
+
}
|
|
23
|
+
&-pop-center-enter-active,
|
|
24
|
+
&-pop-center-leave-active {
|
|
25
|
+
transition: all 0.25s;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&-pop-bottom-enter-from,
|
|
29
|
+
&-pop-bottom-leave-to {
|
|
30
|
+
transform: translateY(100%);
|
|
31
|
+
}
|
|
32
|
+
&-pop-bottom-enter-active,
|
|
33
|
+
&-pop-bottom-leave-active {
|
|
34
|
+
transition: all 0.25s;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-pop-top-enter-from,
|
|
38
|
+
&-pop-top-leave-to {
|
|
39
|
+
transform: translateY(-100%);
|
|
40
|
+
}
|
|
41
|
+
&-pop-top-enter-active,
|
|
42
|
+
&-pop-top-leave-active {
|
|
43
|
+
transition: all 0.25s;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&-pop-left-enter-from,
|
|
47
|
+
&-pop-left-leave-to {
|
|
48
|
+
transform: translateX(-100%);
|
|
49
|
+
}
|
|
50
|
+
&-pop-left-enter-active,
|
|
51
|
+
&-pop-left-leave-active {
|
|
52
|
+
transition: all 0.25s;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-pop-right-enter-from,
|
|
56
|
+
&-pop-right-leave-to {
|
|
57
|
+
transform: translateX(100%);
|
|
58
|
+
}
|
|
59
|
+
&-pop-right-enter-active,
|
|
60
|
+
&-pop-right-leave-active {
|
|
61
|
+
transition: all 0.25s;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.var-site-popup {
|
|
66
|
+
display: flex;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
position: fixed;
|
|
70
|
+
top: 0;
|
|
71
|
+
right: 0;
|
|
72
|
+
bottom: 0;
|
|
73
|
+
left: 0;
|
|
74
|
+
|
|
75
|
+
&__overlay {
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
position: fixed;
|
|
80
|
+
top: 0;
|
|
81
|
+
right: 0;
|
|
82
|
+
bottom: 0;
|
|
83
|
+
left: 0;
|
|
84
|
+
background-color: var(--site-popup-overlay-background-color);
|
|
85
|
+
transition: all 0.25s;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&__content {
|
|
89
|
+
overflow: auto;
|
|
90
|
+
background-color: var(--site-popup-content-background-color);
|
|
91
|
+
transition: all 0.25s;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&--center {
|
|
95
|
+
position: relative;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
&--bottom {
|
|
99
|
+
min-width: 100%;
|
|
100
|
+
position: absolute;
|
|
101
|
+
left: 0;
|
|
102
|
+
bottom: 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&--top {
|
|
106
|
+
min-width: 100%;
|
|
107
|
+
position: absolute;
|
|
108
|
+
left: 0;
|
|
109
|
+
top: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&--left {
|
|
113
|
+
min-height: 100%;
|
|
114
|
+
position: absolute;
|
|
115
|
+
left: 0;
|
|
116
|
+
top: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
&--right {
|
|
120
|
+
min-height: 100%;
|
|
121
|
+
position: absolute;
|
|
122
|
+
right: 0;
|
|
123
|
+
top: 0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { PropType, TeleportProps } from 'vue'
|
|
2
|
+
|
|
3
|
+
function positionValidator(position: string): boolean {
|
|
4
|
+
return ['top', 'bottom', 'right', 'left', 'center'].includes(position)
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const props = {
|
|
8
|
+
show: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
position: {
|
|
13
|
+
type: String as PropType<'top' | 'bottom' | 'right' | 'left' | 'center'>,
|
|
14
|
+
default: 'center',
|
|
15
|
+
validator: positionValidator,
|
|
16
|
+
},
|
|
17
|
+
transition: {
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
overlay: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true,
|
|
23
|
+
},
|
|
24
|
+
overlayClass: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
overlayStyle: {
|
|
28
|
+
type: Object,
|
|
29
|
+
},
|
|
30
|
+
lockScroll: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true,
|
|
33
|
+
},
|
|
34
|
+
closeOnClickOverlay: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: true,
|
|
37
|
+
},
|
|
38
|
+
teleport: {
|
|
39
|
+
type: String as PropType<TeleportProps['to']>,
|
|
40
|
+
},
|
|
41
|
+
onOpen: {
|
|
42
|
+
type: Function as PropType<() => void>,
|
|
43
|
+
},
|
|
44
|
+
onOpened: {
|
|
45
|
+
type: Function as PropType<() => void>,
|
|
46
|
+
},
|
|
47
|
+
onClose: {
|
|
48
|
+
type: Function as PropType<() => void>,
|
|
49
|
+
},
|
|
50
|
+
onClosed: {
|
|
51
|
+
type: Function as PropType<() => void>,
|
|
52
|
+
},
|
|
53
|
+
onClickOverlay: {
|
|
54
|
+
type: Function as PropType<() => void>,
|
|
55
|
+
},
|
|
56
|
+
// internal for Dialog
|
|
57
|
+
onRouteChange: {
|
|
58
|
+
type: Function as PropType<() => void>,
|
|
59
|
+
},
|
|
60
|
+
'onUpdate:show': {
|
|
61
|
+
type: Function as PropType<(show: boolean) => void>,
|
|
62
|
+
},
|
|
63
|
+
}
|
|
@@ -1,108 +1,112 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="
|
|
3
|
-
<div class="
|
|
4
|
-
<div class="
|
|
5
|
-
<div class="
|
|
6
|
-
<div
|
|
7
|
-
:class="
|
|
8
|
-
:style="{ background: color, width: linearProps.width }"
|
|
9
|
-
></div>
|
|
10
|
-
</div>
|
|
11
|
-
<div class="
|
|
12
|
-
<slot>
|
|
13
|
-
{{ linearProps.roundValue }}
|
|
14
|
-
</slot>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="
|
|
19
|
-
<svg
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
import {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export default defineComponent({
|
|
66
|
-
name: '
|
|
67
|
-
inheritAttrs: false,
|
|
68
|
-
props,
|
|
69
|
-
setup(props) {
|
|
70
|
-
const linearProps = computed(() => {
|
|
71
|
-
const value = toNumber(props.value)
|
|
72
|
-
const width = value > 100 ? 100 : value
|
|
73
|
-
const roundValue = value > 100 ? 100 : Math.round(value)
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
width: `${width}%`,
|
|
77
|
-
roundValue: `${roundValue}%`,
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
const circleProps = computed(() => {
|
|
82
|
-
const { size, lineWidth, value } = props
|
|
83
|
-
const viewBox = `0 0 ${size} ${size}`
|
|
84
|
-
const roundValue = toNumber(value) > 100 ? 100 : Math.round(toNumber(value))
|
|
85
|
-
const radius = (size -
|
|
86
|
-
const perimeter = 2 * Math.PI * radius
|
|
87
|
-
const strokeDasharray = `${(roundValue / 100) * perimeter}, ${perimeter}`
|
|
88
|
-
|
|
89
|
-
return {
|
|
90
|
-
viewBox,
|
|
91
|
-
radius,
|
|
92
|
-
strokeDasharray,
|
|
93
|
-
perimeter,
|
|
94
|
-
roundValue: `${roundValue}%`,
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
return {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="n()">
|
|
3
|
+
<div :class="n('linear')" v-if="mode === 'linear'">
|
|
4
|
+
<div :class="n('linear-block')" :style="{ height: toSizeUnit(lineWidth) }" v-bind="$attrs">
|
|
5
|
+
<div :class="n('linear-background')" v-if="track" :style="{ background: trackColor }"></div>
|
|
6
|
+
<div
|
|
7
|
+
:class="classes(n('linear-certain'), [ripple, n('linear-ripple')])"
|
|
8
|
+
:style="{ background: color, width: linearProps.width }"
|
|
9
|
+
></div>
|
|
10
|
+
</div>
|
|
11
|
+
<div :class="n('linear-label')" v-bind="$attrs" v-if="label">
|
|
12
|
+
<slot>
|
|
13
|
+
{{ linearProps.roundValue }}
|
|
14
|
+
</slot>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div :class="n('circle')" v-if="mode === 'circle'" :style="{ width: toSizeUnit(size), height: toSizeUnit(size) }">
|
|
19
|
+
<svg :class="n('circle-svg')" :style="{ transform: `rotate(${rotate - 90}deg)` }" :viewBox="circleProps.viewBox">
|
|
20
|
+
<circle
|
|
21
|
+
v-if="track"
|
|
22
|
+
:class="n('circle-background')"
|
|
23
|
+
:cx="multiplySizeUnit(size, 0.5)"
|
|
24
|
+
:cy="multiplySizeUnit(size, 0.5)"
|
|
25
|
+
:r="circleProps.radius"
|
|
26
|
+
fill="transparent"
|
|
27
|
+
:stroke-width="toSizeUnit(lineWidth)"
|
|
28
|
+
:style="{
|
|
29
|
+
strokeDasharray: circleProps.perimeter,
|
|
30
|
+
stroke: trackColor,
|
|
31
|
+
}"
|
|
32
|
+
></circle>
|
|
33
|
+
<circle
|
|
34
|
+
:class="n('circle-certain')"
|
|
35
|
+
:cx="multiplySizeUnit(size, 0.5)"
|
|
36
|
+
:cy="multiplySizeUnit(size, 0.5)"
|
|
37
|
+
:r="circleProps.radius"
|
|
38
|
+
fill="transparent"
|
|
39
|
+
:stroke-width="toSizeUnit(lineWidth)"
|
|
40
|
+
:style="{
|
|
41
|
+
strokeDasharray: circleProps.strokeDasharray,
|
|
42
|
+
stroke: color,
|
|
43
|
+
}"
|
|
44
|
+
></circle>
|
|
45
|
+
</svg>
|
|
46
|
+
|
|
47
|
+
<div :class="n('circle-label')" v-if="label" v-bind="$attrs">
|
|
48
|
+
<slot>
|
|
49
|
+
{{ circleProps.roundValue }}
|
|
50
|
+
</slot>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script lang="ts">
|
|
57
|
+
import { defineComponent, computed } from 'vue'
|
|
58
|
+
import { props } from './props'
|
|
59
|
+
import { toNumber } from '@varlet/shared'
|
|
60
|
+
import { toSizeUnit, multiplySizeUnit, toPxNum } from '../utils/elements'
|
|
61
|
+
import { createNamespace } from '../utils/components'
|
|
62
|
+
|
|
63
|
+
const { n, classes } = createNamespace('progress')
|
|
64
|
+
|
|
65
|
+
export default defineComponent({
|
|
66
|
+
name: 'VarProgress',
|
|
67
|
+
inheritAttrs: false,
|
|
68
|
+
props,
|
|
69
|
+
setup(props) {
|
|
70
|
+
const linearProps = computed(() => {
|
|
71
|
+
const value = toNumber(props.value)
|
|
72
|
+
const width = value > 100 ? 100 : value
|
|
73
|
+
const roundValue = value > 100 ? 100 : Math.round(value)
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
width: `${width}%`,
|
|
77
|
+
roundValue: `${roundValue}%`,
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const circleProps = computed(() => {
|
|
82
|
+
const { size, lineWidth, value } = props
|
|
83
|
+
const viewBox = `0 0 ${toPxNum(size)} ${toPxNum(size)}`
|
|
84
|
+
const roundValue = toNumber(value) > 100 ? 100 : Math.round(toNumber(value))
|
|
85
|
+
const radius = (toPxNum(size) - toPxNum(lineWidth)) / 2
|
|
86
|
+
const perimeter = 2 * Math.PI * radius
|
|
87
|
+
const strokeDasharray = `${(roundValue / 100) * perimeter}, ${perimeter}`
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
viewBox,
|
|
91
|
+
radius,
|
|
92
|
+
strokeDasharray,
|
|
93
|
+
perimeter,
|
|
94
|
+
roundValue: `${roundValue}%`,
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
return {
|
|
98
|
+
n,
|
|
99
|
+
classes,
|
|
100
|
+
toSizeUnit,
|
|
101
|
+
multiplySizeUnit,
|
|
102
|
+
linearProps,
|
|
103
|
+
circleProps,
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<style lang="less">
|
|
110
|
+
@import '../styles/common';
|
|
111
|
+
@import './progress';
|
|
112
|
+
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { App } from 'vue'
|
|
2
|
-
import Progress from './Progress.vue'
|
|
3
|
-
|
|
4
|
-
Progress.install = function (app: App) {
|
|
5
|
-
app.component(Progress.name, Progress)
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export const _ProgressComponent = Progress
|
|
9
|
-
|
|
10
|
-
export default Progress
|
|
1
|
+
import type { App } from 'vue'
|
|
2
|
+
import Progress from './Progress.vue'
|
|
3
|
+
|
|
4
|
+
Progress.install = function (app: App) {
|
|
5
|
+
app.component(Progress.name, Progress)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const _ProgressComponent = Progress
|
|
9
|
+
|
|
10
|
+
export default Progress
|