@varlet/cli 2.15.1 → 2.16.0-alpha.1693852004525
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/lib/node/config/varlet.config.js +2 -1
- package/lib/node/config/varlet.default.config.js +264 -7
- package/package.json +8 -7
- package/site/mobile/App.vue +25 -22
- package/site/mobile/{components/AppHome.vue → AppHome.vue} +6 -6
- package/site/mobile/main.ts +6 -21
- package/site/pc/App.vue +0 -5
- package/site/pc/Layout.vue +24 -28
- package/site/pc/components/AppHeader.vue +123 -122
- package/site/pc/components/AppMobile.vue +9 -2
- package/site/pc/components/AppSidebar.vue +18 -17
- package/site/{components → pc/components}/code-example/CodeExample.vue +8 -15
- package/site/pc/main.ts +6 -23
- package/site/pc/pages/index/index.vue +316 -47
- package/site/types.ts +6 -0
- package/template/generators/base/package.json +1 -0
- package/site/components/button/Button.vue +0 -106
- package/site/components/button/button.less +0 -183
- package/site/components/button/index.ts +0 -10
- package/site/components/button/props.ts +0 -78
- package/site/components/cell/Cell.vue +0 -54
- package/site/components/cell/cell.less +0 -78
- package/site/components/cell/index.ts +0 -10
- package/site/components/cell/props.ts +0 -27
- package/site/components/context/index.ts +0 -21
- package/site/components/context/lock.ts +0 -92
- package/site/components/context/zIndex.ts +0 -20
- package/site/components/icon/Icon.vue +0 -75
- package/site/components/icon/icon.less +0 -38
- package/site/components/icon/index.ts +0 -10
- package/site/components/icon/props.ts +0 -24
- package/site/components/loading/Loading.vue +0 -84
- package/site/components/loading/index.ts +0 -10
- package/site/components/loading/loading.less +0 -505
- package/site/components/loading/props.ts +0 -42
- package/site/components/popup/Popup.tsx +0 -102
- package/site/components/popup/index.ts +0 -10
- package/site/components/popup/popup.less +0 -125
- package/site/components/popup/props.ts +0 -63
- package/site/components/ripple/index.ts +0 -188
- package/site/components/ripple/ripple.less +0 -20
- package/site/components/snackbar/Snackbar.vue +0 -41
- package/site/components/snackbar/core.vue +0 -132
- package/site/components/snackbar/index.tsx +0 -270
- package/site/components/snackbar/props.ts +0 -97
- package/site/components/snackbar/snackbar.less +0 -135
- package/site/components/styles/common.less +0 -64
- package/site/components/styles/elevation.less +0 -126
- package/site/components/styles/var.less +0 -27
- package/site/components/utils/components.ts +0 -114
- package/site/components/utils/elements.ts +0 -104
- package/site/mobile/components/app-bar/AppBar.vue +0 -65
- package/site/mobile/components/app-bar/appBar.less +0 -57
- package/site/mobile/components/app-bar/index.ts +0 -10
- package/site/mobile/components/app-bar/props.ts +0 -25
- package/site/pc/components/AnimationBox.vue +0 -62
- package/site/pc/components/LogoAnimation.vue +0 -119
- package/site/pc/pages/index/index.less +0 -204
- /package/site/{components → pc/components}/code-example/codeExample.less +0 -0
- /package/site/{components → pc/components}/code-example/index.ts +0 -0
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
@site-button-default-color: #f5f5f5;
|
|
2
|
-
@site-button-primary-color: var(--site-color-primary);
|
|
3
|
-
@site-button-danger-color: var(--site-color-danger);
|
|
4
|
-
@site-button-success-color: var(--site-color-success);
|
|
5
|
-
@site-button-warning-color: var(--site-color-warning);
|
|
6
|
-
@site-button-info-color: var(--site-color-info);
|
|
7
|
-
@site-button-disabled-color: var(--site-color-disabled);
|
|
8
|
-
@site-button-disabled-text-color: var(--site-color-text-disabled);
|
|
9
|
-
@site-button-border-radius: 4px;
|
|
10
|
-
@site-button-mini-padding: 0 9px;
|
|
11
|
-
@site-button-small-padding: 0 11px;
|
|
12
|
-
@site-button-normal-padding: 0 15px;
|
|
13
|
-
@site-button-large-padding: 0 22px;
|
|
14
|
-
@site-button-round-padding: 6px;
|
|
15
|
-
@site-button-mini-height: 20px;
|
|
16
|
-
@site-button-small-height: 28px;
|
|
17
|
-
@site-button-normal-height: 36px;
|
|
18
|
-
@site-button-large-height: 44px;
|
|
19
|
-
|
|
20
|
-
:root {
|
|
21
|
-
--site-button-default-color: @site-button-default-color;
|
|
22
|
-
--site-button-primary-color: @site-button-primary-color;
|
|
23
|
-
--site-button-danger-color: @site-button-danger-color;
|
|
24
|
-
--site-button-success-color: @site-button-success-color;
|
|
25
|
-
--site-button-warning-color: @site-button-warning-color;
|
|
26
|
-
--site-button-info-color: @site-button-info-color;
|
|
27
|
-
--site-button-disabled-color: @site-button-disabled-color;
|
|
28
|
-
--site-button-disabled-text-color: @site-button-disabled-text-color;
|
|
29
|
-
--site-button-border-radius: @site-button-border-radius;
|
|
30
|
-
--site-button-mini-padding: @site-button-mini-padding;
|
|
31
|
-
--site-button-small-padding: @site-button-small-padding;
|
|
32
|
-
--site-button-normal-padding: @site-button-normal-padding;
|
|
33
|
-
--site-button-large-padding: @site-button-large-padding;
|
|
34
|
-
--site-button-round-padding: @site-button-round-padding;
|
|
35
|
-
--site-button-mini-height: @site-button-mini-height;
|
|
36
|
-
--site-button-small-height: @site-button-small-height;
|
|
37
|
-
--site-button-normal-height: @site-button-normal-height;
|
|
38
|
-
--site-button-large-height: @site-button-large-height;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.var-site-button {
|
|
42
|
-
position: relative;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
align-items: center;
|
|
45
|
-
outline: none;
|
|
46
|
-
border: none;
|
|
47
|
-
border-radius: var(--site-button-border-radius);
|
|
48
|
-
user-select: none;
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
font-family: inherit;
|
|
51
|
-
transition: box-shadow 0.2s, background-color 0.25s;
|
|
52
|
-
will-change: box-shadow;
|
|
53
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
54
|
-
white-space: nowrap;
|
|
55
|
-
line-height: 1;
|
|
56
|
-
|
|
57
|
-
&:active {
|
|
58
|
-
box-shadow: 0 3px 5px -1px var(--shadow-key-umbra-opacity), 0 5px 8px 0 var(--shadow-key-penumbra-opacity),
|
|
59
|
-
0 1px 14px 0 var(--shadow-key-ambient-opacity);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
&__loading[var-site-button-cover] {
|
|
63
|
-
position: absolute;
|
|
64
|
-
top: 50%;
|
|
65
|
-
left: 50%;
|
|
66
|
-
transform: translate(-50%, -50%);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&--default {
|
|
70
|
-
color: inherit;
|
|
71
|
-
background-color: var(--site-button-default-color);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&--primary {
|
|
75
|
-
color: #fff;
|
|
76
|
-
background-color: var(--site-button-primary-color);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
&--info {
|
|
80
|
-
color: #fff;
|
|
81
|
-
background-color: var(--site-button-info-color);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&--success {
|
|
85
|
-
color: #fff;
|
|
86
|
-
background-color: var(--site-button-success-color);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
&--warning {
|
|
90
|
-
color: #fff;
|
|
91
|
-
background-color: var(--site-button-warning-color);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&--danger {
|
|
95
|
-
color: #fff;
|
|
96
|
-
background-color: var(--site-button-danger-color);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
&--disabled {
|
|
100
|
-
background-color: var(--site-button-disabled-color);
|
|
101
|
-
color: var(--site-button-disabled-text-color);
|
|
102
|
-
cursor: not-allowed;
|
|
103
|
-
box-shadow: none !important;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&--block {
|
|
107
|
-
width: 100%;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
&--text {
|
|
111
|
-
background-color: transparent;
|
|
112
|
-
|
|
113
|
-
&:active {
|
|
114
|
-
box-shadow: none;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&--text-default {
|
|
119
|
-
color: inherit;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&--text-primary {
|
|
123
|
-
color: var(--site-button-primary-color);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
&--text-info {
|
|
127
|
-
color: var(--site-button-info-color);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
&--text-success {
|
|
131
|
-
color: var(--site-button-success-color);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
&--text-warning {
|
|
135
|
-
color: var(--site-button-warning-color);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
&--text-danger {
|
|
139
|
-
color: var(--site-button-danger-color);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
&--text-disabled {
|
|
143
|
-
color: var(--site-button-disabled-text-color);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&--normal {
|
|
147
|
-
height: var(--site-button-normal-height);
|
|
148
|
-
padding: var(--site-button-normal-padding);
|
|
149
|
-
font-size: var(--site-font-size-md);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
&--large {
|
|
153
|
-
height: var(--site-button-large-height);
|
|
154
|
-
padding: var(--site-button-large-padding);
|
|
155
|
-
font-size: var(--site-font-size-lg);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
&--small {
|
|
159
|
-
height: var(--site-button-small-height);
|
|
160
|
-
padding: var(--site-button-small-padding);
|
|
161
|
-
font-size: var(--site-font-size-sm);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
&--mini {
|
|
165
|
-
height: var(--site-button-mini-height);
|
|
166
|
-
padding: var(--site-button-mini-padding);
|
|
167
|
-
font-size: var(--site-font-size-xs);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
&--round {
|
|
171
|
-
padding: var(--site-button-round-padding);
|
|
172
|
-
border-radius: 50%;
|
|
173
|
-
height: auto;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
&--outline {
|
|
177
|
-
border: thin solid currentColor;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&--hidden {
|
|
181
|
-
opacity: 0;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { props as loadingProps } from '../loading/props'
|
|
2
|
-
import { pickProps } from '../utils/components'
|
|
3
|
-
import type { PropType } from 'vue'
|
|
4
|
-
|
|
5
|
-
function typeValidator(type: string): boolean {
|
|
6
|
-
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type)
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
function sizeValidator(size: string): boolean {
|
|
10
|
-
return ['normal', 'mini', 'small', 'large'].includes(size)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const props = {
|
|
14
|
-
type: {
|
|
15
|
-
type: String as PropType<'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger'>,
|
|
16
|
-
default: 'default',
|
|
17
|
-
validator: typeValidator,
|
|
18
|
-
},
|
|
19
|
-
size: {
|
|
20
|
-
type: String as PropType<'normal' | 'mini' | 'small' | 'large'>,
|
|
21
|
-
default: 'normal',
|
|
22
|
-
validator: sizeValidator,
|
|
23
|
-
},
|
|
24
|
-
loading: {
|
|
25
|
-
type: Boolean,
|
|
26
|
-
default: false,
|
|
27
|
-
},
|
|
28
|
-
round: {
|
|
29
|
-
type: Boolean,
|
|
30
|
-
default: false,
|
|
31
|
-
},
|
|
32
|
-
block: {
|
|
33
|
-
type: Boolean,
|
|
34
|
-
default: false,
|
|
35
|
-
},
|
|
36
|
-
text: {
|
|
37
|
-
type: Boolean,
|
|
38
|
-
default: false,
|
|
39
|
-
},
|
|
40
|
-
outline: {
|
|
41
|
-
type: Boolean,
|
|
42
|
-
default: false,
|
|
43
|
-
},
|
|
44
|
-
disabled: {
|
|
45
|
-
type: Boolean,
|
|
46
|
-
default: false,
|
|
47
|
-
},
|
|
48
|
-
ripple: {
|
|
49
|
-
type: Boolean,
|
|
50
|
-
default: true,
|
|
51
|
-
},
|
|
52
|
-
color: {
|
|
53
|
-
type: String,
|
|
54
|
-
},
|
|
55
|
-
textColor: {
|
|
56
|
-
type: String,
|
|
57
|
-
},
|
|
58
|
-
autoLoading: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
loadingRadius: {
|
|
63
|
-
type: [Number, String],
|
|
64
|
-
default: 12,
|
|
65
|
-
},
|
|
66
|
-
loadingType: pickProps(loadingProps, 'type'),
|
|
67
|
-
loadingSize: pickProps(loadingProps, 'size'),
|
|
68
|
-
loadingColor: {
|
|
69
|
-
...pickProps(loadingProps, 'color'),
|
|
70
|
-
default: 'currentColor',
|
|
71
|
-
},
|
|
72
|
-
onClick: {
|
|
73
|
-
type: Function as PropType<(e: Event) => void | Promise<any>>,
|
|
74
|
-
},
|
|
75
|
-
onTouchstart: {
|
|
76
|
-
type: Function as PropType<(e: Event) => void | Promise<any>>,
|
|
77
|
-
},
|
|
78
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div :class="classes(n(), [border, n('--border')])">
|
|
3
|
-
<div :class="classes(n('icon'), [iconClass, iconClass])" v-if="$slots.icon || icon">
|
|
4
|
-
<slot name="icon">
|
|
5
|
-
<var-icon class="var--flex" :name="icon" />
|
|
6
|
-
</slot>
|
|
7
|
-
</div>
|
|
8
|
-
<div :class="n('content')">
|
|
9
|
-
<div :class="classes(n('title'), [titleClass, titleClass])">
|
|
10
|
-
<slot>{{ title }}</slot>
|
|
11
|
-
</div>
|
|
12
|
-
<div
|
|
13
|
-
:class="classes(n('description'), [descriptionClass, descriptionClass])"
|
|
14
|
-
v-if="$slots.description || description"
|
|
15
|
-
>
|
|
16
|
-
<slot name="description">
|
|
17
|
-
{{ description }}
|
|
18
|
-
</slot>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div :class="classes(n('extra'), [extraClass, extraClass])" v-if="$slots.extra">
|
|
22
|
-
<slot name="extra" />
|
|
23
|
-
</div>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
|
|
27
|
-
<script lang="ts">
|
|
28
|
-
import VarIcon from '../icon'
|
|
29
|
-
import { defineComponent } from 'vue'
|
|
30
|
-
import { props } from './props'
|
|
31
|
-
import { createNamespace } from '../utils/components'
|
|
32
|
-
|
|
33
|
-
const { n, classes } = createNamespace('cell')
|
|
34
|
-
|
|
35
|
-
export default defineComponent({
|
|
36
|
-
name: 'VarCell',
|
|
37
|
-
components: {
|
|
38
|
-
VarIcon,
|
|
39
|
-
},
|
|
40
|
-
props,
|
|
41
|
-
setup() {
|
|
42
|
-
return {
|
|
43
|
-
n,
|
|
44
|
-
classes,
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
})
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<style lang="less">
|
|
51
|
-
@import '../styles/common';
|
|
52
|
-
@import '../icon/icon';
|
|
53
|
-
@import './cell';
|
|
54
|
-
</style>
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
@site-cell-color: var(--site-color-text);
|
|
2
|
-
@site-cell-font-size: var(--site-font-size-md);
|
|
3
|
-
@site-cell-description-font-size: var(--site-font-size-sm);
|
|
4
|
-
@site-cell-description-color: rgba(0, 0, 0, 0.6);
|
|
5
|
-
@site-cell-padding: 10px 12px;
|
|
6
|
-
@site-cell-min-height: 40px;
|
|
7
|
-
@site-cell-border-color: #bcc2cb;
|
|
8
|
-
@site-cell-border-left: 12px;
|
|
9
|
-
@site-cell-border-right: 12px;
|
|
10
|
-
@site-cell-icon-right: 8px;
|
|
11
|
-
@site-cell-extra-left: 8px;
|
|
12
|
-
|
|
13
|
-
:root {
|
|
14
|
-
--site-cell-color: @site-cell-color;
|
|
15
|
-
--site-cell-font-size: @site-cell-font-size;
|
|
16
|
-
--site-cell-description-font-size: @site-cell-description-font-size;
|
|
17
|
-
--site-cell-description-color: @site-cell-description-color;
|
|
18
|
-
--site-cell-padding: @site-cell-padding;
|
|
19
|
-
--site-cell-min-height: @site-cell-min-height;
|
|
20
|
-
--site-cell-border-color: @site-cell-border-color;
|
|
21
|
-
--site-cell-border-left: @site-cell-border-left;
|
|
22
|
-
--site-cell-border-right: @site-cell-border-right;
|
|
23
|
-
--site-cell-icon-right: @site-cell-icon-right;
|
|
24
|
-
--site-cell-extra-left: @site-cell-extra-left;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.var-site-cell {
|
|
28
|
-
align-items: center;
|
|
29
|
-
display: flex;
|
|
30
|
-
min-height: var(--site-cell-min-height);
|
|
31
|
-
outline: none;
|
|
32
|
-
width: 100%;
|
|
33
|
-
padding: var(--site-cell-padding);
|
|
34
|
-
position: relative;
|
|
35
|
-
box-sizing: border-box;
|
|
36
|
-
font-size: var(--site-cell-font-size);
|
|
37
|
-
color: var(--site-cell-color);
|
|
38
|
-
|
|
39
|
-
&--border {
|
|
40
|
-
&::after {
|
|
41
|
-
position: absolute;
|
|
42
|
-
box-sizing: border-box;
|
|
43
|
-
content: ' ';
|
|
44
|
-
pointer-events: none;
|
|
45
|
-
right: var(--site-cell-border-right);
|
|
46
|
-
bottom: 0;
|
|
47
|
-
left: var(--site-cell-border-left);
|
|
48
|
-
border-bottom: 1px solid var(--site-cell-border-color);
|
|
49
|
-
transform: scaleY(0.5);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
&__icon {
|
|
54
|
-
margin-right: var(--site-cell-icon-right);
|
|
55
|
-
flex: 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&__content {
|
|
59
|
-
flex: 1;
|
|
60
|
-
overflow: hidden;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&__title {
|
|
64
|
-
overflow: hidden;
|
|
65
|
-
text-overflow: ellipsis;
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
&__description {
|
|
70
|
-
font-size: var(--site-cell-description-font-size);
|
|
71
|
-
color: var(--site-cell-description-color);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&__extra {
|
|
75
|
-
flex: 0;
|
|
76
|
-
margin-left: var(--site-cell-extra-left);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export const props = {
|
|
2
|
-
title: {
|
|
3
|
-
type: [Number, String],
|
|
4
|
-
},
|
|
5
|
-
icon: {
|
|
6
|
-
type: String,
|
|
7
|
-
},
|
|
8
|
-
description: {
|
|
9
|
-
type: String,
|
|
10
|
-
},
|
|
11
|
-
border: {
|
|
12
|
-
type: Boolean,
|
|
13
|
-
default: false,
|
|
14
|
-
},
|
|
15
|
-
iconClass: {
|
|
16
|
-
type: String,
|
|
17
|
-
},
|
|
18
|
-
titleClass: {
|
|
19
|
-
type: String,
|
|
20
|
-
},
|
|
21
|
-
descriptionClass: {
|
|
22
|
-
type: String,
|
|
23
|
-
},
|
|
24
|
-
extraClass: {
|
|
25
|
-
type: String,
|
|
26
|
-
},
|
|
27
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { reactive } from 'vue'
|
|
2
|
-
|
|
3
|
-
interface Context {
|
|
4
|
-
locks: Record<any, number>
|
|
5
|
-
zIndex: number
|
|
6
|
-
touchmoveForbid: boolean
|
|
7
|
-
showPlayground: boolean,
|
|
8
|
-
playgroundURL: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const context: Context = {
|
|
12
|
-
locks: {},
|
|
13
|
-
zIndex: 2000,
|
|
14
|
-
touchmoveForbid: true,
|
|
15
|
-
showPlayground: false,
|
|
16
|
-
playgroundURL: ''
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const _ContextComponent = reactive<Context>(context)
|
|
20
|
-
|
|
21
|
-
export default reactive<Context>(context)
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { watch, onBeforeMount, onUnmounted, onDeactivated, onActivated, getCurrentInstance } from 'vue'
|
|
2
|
-
import type { ComponentInternalInstance } from 'vue'
|
|
3
|
-
import context from '.'
|
|
4
|
-
|
|
5
|
-
export function resolveLock() {
|
|
6
|
-
const lockCounts: number = Object.keys(context.locks).length
|
|
7
|
-
lockCounts <= 0 ? document.body.classList.remove('var-site--lock') : document.body.classList.add('var-site--lock')
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function addLock(uid: number) {
|
|
11
|
-
context.locks[uid] = 1
|
|
12
|
-
resolveLock()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function releaseLock(uid: number) {
|
|
16
|
-
delete context.locks[uid]
|
|
17
|
-
resolveLock()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function useLock(source: any, useSource?: any) {
|
|
21
|
-
const { uid } = getCurrentInstance() as ComponentInternalInstance
|
|
22
|
-
|
|
23
|
-
if (useSource) {
|
|
24
|
-
watch(useSource, (newValue: boolean) => {
|
|
25
|
-
if (newValue === false) {
|
|
26
|
-
// 改变为禁用状态 组件解锁
|
|
27
|
-
releaseLock(uid)
|
|
28
|
-
} else if (newValue === true && source() === true) {
|
|
29
|
-
// 改变为启用状态 并且popup处于开启状态 组件加锁
|
|
30
|
-
addLock(uid)
|
|
31
|
-
}
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
watch(source, (newValue: boolean) => {
|
|
36
|
-
if (useSource && useSource() === false) {
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (newValue === true) {
|
|
41
|
-
// popup开启 组件加锁
|
|
42
|
-
addLock(uid)
|
|
43
|
-
} else {
|
|
44
|
-
// popup关闭 组件解锁
|
|
45
|
-
releaseLock(uid)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
onBeforeMount(() => {
|
|
50
|
-
if (useSource && useSource() === false) {
|
|
51
|
-
return
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (source() === true) {
|
|
55
|
-
// popup处于开启状态 组件挂载 组件加锁
|
|
56
|
-
addLock(uid)
|
|
57
|
-
}
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
onUnmounted(() => {
|
|
61
|
-
if (useSource && useSource() === false) {
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (source() === true) {
|
|
66
|
-
// popup处于开启状态 组件卸载 组件解锁
|
|
67
|
-
releaseLock(uid)
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
onActivated(() => {
|
|
72
|
-
if (useSource && useSource() === false) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (source() === true) {
|
|
77
|
-
// popup处于开启状态 组件处于keepalive前台 组件加锁
|
|
78
|
-
addLock(uid)
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
onDeactivated(() => {
|
|
83
|
-
if (useSource && useSource() === false) {
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (source() === true) {
|
|
88
|
-
// popup处于开启状态 组件处于keepalive后台 组件解锁
|
|
89
|
-
releaseLock(uid)
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import context from './index'
|
|
2
|
-
import { watch, ref } from 'vue'
|
|
3
|
-
import type { Ref } from 'vue'
|
|
4
|
-
|
|
5
|
-
export function useZIndex(source: any, count: number) {
|
|
6
|
-
const zIndex: Ref<number> = ref(context.zIndex)
|
|
7
|
-
|
|
8
|
-
watch(
|
|
9
|
-
source,
|
|
10
|
-
(newValue) => {
|
|
11
|
-
if (newValue) {
|
|
12
|
-
context.zIndex += count
|
|
13
|
-
zIndex.value = context.zIndex
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{ immediate: true }
|
|
17
|
-
)
|
|
18
|
-
|
|
19
|
-
return { zIndex }
|
|
20
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<component
|
|
3
|
-
:is="isURL(name) ? 'img' : 'i'"
|
|
4
|
-
:class="
|
|
5
|
-
classes(
|
|
6
|
-
n(),
|
|
7
|
-
`${namespace}--set`,
|
|
8
|
-
[isURL(name), n('image'), `${namespace}-${nextName}`],
|
|
9
|
-
[shrinking, n('--shrinking')]
|
|
10
|
-
)
|
|
11
|
-
"
|
|
12
|
-
:style="{
|
|
13
|
-
color,
|
|
14
|
-
transition: `transform ${toNumber(transition)}ms`,
|
|
15
|
-
width: isURL(name) ? toSizeUnit(size) : null,
|
|
16
|
-
height: isURL(name) ? toSizeUnit(size) : null,
|
|
17
|
-
fontSize: toSizeUnit(size),
|
|
18
|
-
}"
|
|
19
|
-
:src="isURL(name) ? nextName : null"
|
|
20
|
-
@click="onClick"
|
|
21
|
-
/>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
import { defineComponent, watch, ref, nextTick } from 'vue'
|
|
26
|
-
import { isURL, toNumber } from '@varlet/shared'
|
|
27
|
-
import { props } from './props'
|
|
28
|
-
import { toSizeUnit } from '../utils/elements'
|
|
29
|
-
import type { Ref } from 'vue'
|
|
30
|
-
import { createNamespace } from '../utils/components'
|
|
31
|
-
|
|
32
|
-
const { n, classes } = createNamespace('icon')
|
|
33
|
-
|
|
34
|
-
export default defineComponent({
|
|
35
|
-
name: 'VarIcon',
|
|
36
|
-
props,
|
|
37
|
-
setup(props) {
|
|
38
|
-
const nextName: Ref<string | undefined> = ref('')
|
|
39
|
-
const shrinking: Ref<boolean> = ref(false)
|
|
40
|
-
|
|
41
|
-
const handleNameChange = async (newName: string | undefined, oldName: string | undefined) => {
|
|
42
|
-
const { transition } = props
|
|
43
|
-
|
|
44
|
-
if (oldName == null || toNumber(transition) === 0) {
|
|
45
|
-
nextName.value = newName
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
shrinking.value = true
|
|
50
|
-
await nextTick()
|
|
51
|
-
setTimeout(() => {
|
|
52
|
-
oldName != null && (nextName.value = newName)
|
|
53
|
-
shrinking.value = false
|
|
54
|
-
}, toNumber(transition))
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
watch(() => props.name, handleNameChange, { immediate: true })
|
|
58
|
-
|
|
59
|
-
return {
|
|
60
|
-
n,
|
|
61
|
-
classes,
|
|
62
|
-
nextName,
|
|
63
|
-
shrinking,
|
|
64
|
-
isURL,
|
|
65
|
-
toNumber,
|
|
66
|
-
toSizeUnit,
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
})
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<style lang="less">
|
|
73
|
-
@import '../styles/common';
|
|
74
|
-
@import './icon';
|
|
75
|
-
</style>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
@import '@varlet/icons/dist/css/varlet-icons.less';
|
|
2
|
-
|
|
3
|
-
@site-icon-size: 20px;
|
|
4
|
-
|
|
5
|
-
:root {
|
|
6
|
-
--site-icon-size: @site-icon-size;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.var-site-icon {
|
|
10
|
-
position: relative;
|
|
11
|
-
display: inline-flex;
|
|
12
|
-
justify-content: center;
|
|
13
|
-
align-items: center;
|
|
14
|
-
font-size: var(--site-icon-size);
|
|
15
|
-
color: inherit;
|
|
16
|
-
vertical-align: bottom;
|
|
17
|
-
|
|
18
|
-
&::before {
|
|
19
|
-
position: relative;
|
|
20
|
-
display: inline-block;
|
|
21
|
-
font-size: inherit;
|
|
22
|
-
text-rendering: auto;
|
|
23
|
-
-webkit-font-smoothing: antialiased;
|
|
24
|
-
font-weight: normal;
|
|
25
|
-
font-style: normal;
|
|
26
|
-
line-height: 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
&--shrinking {
|
|
30
|
-
transform: scale(0);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&__image {
|
|
34
|
-
width: var(--site-icon-size);
|
|
35
|
-
height: var(--site-icon-size);
|
|
36
|
-
object-fit: cover;
|
|
37
|
-
}
|
|
38
|
-
}
|