@varlet/cli 1.20.0 → 1.21.1-alpha.64
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 +8 -0
- package/README.en-US.md +11 -0
- package/README.md +11 -0
- package/generators/sfc/package.json +3 -2
- package/generators/sfc/varlet.config.js +5 -0
- package/generators/tsx/package.json +3 -2
- package/generators/tsx/varlet.config.js +5 -0
- package/lib/commands/build.js +19 -15
- package/lib/commands/dev.d.ts +3 -2
- package/lib/commands/dev.js +23 -34
- package/lib/commands/jest.d.ts +3 -3
- package/lib/commands/preview.d.ts +1 -0
- package/lib/commands/preview.js +65 -0
- package/lib/compiler/compileModule.js +7 -14
- package/lib/compiler/compileSFC.js +7 -2
- package/lib/compiler/compileSiteEntry.d.ts +1 -4
- package/lib/compiler/compileSiteEntry.js +10 -20
- package/lib/compiler/compileStyle.js +1 -60
- package/lib/config/babel.config.js +0 -9
- package/lib/config/jest.config.js +1 -1
- package/lib/config/jest.lib.mock.d.ts +0 -0
- package/lib/config/jest.lib.mock.js +2 -0
- package/lib/config/postcss.config.d.ts +4 -1
- package/lib/config/postcss.config.js +14 -38
- package/lib/config/varlet.config.d.ts +1 -1
- package/lib/config/vite.config.d.ts +4 -0
- package/lib/config/vite.config.js +128 -0
- package/lib/config/webpack.base.config.js +1 -1
- package/lib/index.js +7 -2
- package/lib/shared/constant.d.ts +2 -8
- package/lib/shared/constant.js +3 -9
- package/lib/site/components/app-bar/index.d.ts +3 -0
- package/lib/site/components/app-bar/index.js +12 -0
- package/lib/site/components/app-bar/props.d.ts +21 -0
- package/lib/site/components/app-bar/props.js +28 -0
- package/lib/site/components/button/index.d.ts +3 -0
- package/lib/site/components/button/index.js +12 -0
- package/lib/site/components/button/props.d.ts +62 -0
- package/lib/site/components/button/props.js +69 -0
- package/lib/site/components/cell/index.d.ts +3 -0
- package/lib/site/components/cell/index.js +12 -0
- package/lib/site/components/cell/props.d.ts +27 -0
- package/lib/site/components/cell/props.js +30 -0
- package/lib/site/components/context/index.d.ts +15 -0
- package/lib/site/components/context/index.js +11 -0
- package/lib/site/components/context/lock.d.ts +10 -0
- package/lib/site/components/context/lock.js +94 -0
- package/lib/site/components/context/zIndex.d.ts +4 -0
- package/lib/site/components/context/zIndex.js +19 -0
- package/lib/site/components/icon/index.d.ts +3 -0
- package/lib/site/components/icon/index.js +12 -0
- package/lib/site/components/icon/props.d.ts +23 -0
- package/lib/site/components/icon/props.js +25 -0
- package/lib/site/components/loading/index.d.ts +3 -0
- package/lib/site/components/loading/index.js +12 -0
- package/lib/site/components/loading/props.d.ts +26 -0
- package/lib/site/components/loading/props.js +34 -0
- package/lib/site/components/menu/index.d.ts +3 -0
- package/lib/site/components/menu/index.js +12 -0
- package/lib/site/components/menu/props.d.ts +40 -0
- package/lib/site/components/menu/props.js +43 -0
- package/lib/site/components/progress/index.d.ts +3 -0
- package/lib/site/components/progress/index.js +12 -0
- package/lib/site/components/progress/props.d.ts +43 -0
- package/lib/site/components/progress/props.js +57 -0
- package/lib/site/components/ripple/index.d.ts +8 -0
- package/lib/site/components/ripple/index.js +125 -0
- package/lib/site/components/utils/components.d.ts +53 -0
- package/lib/site/components/utils/components.js +279 -0
- package/lib/site/components/utils/elements.d.ts +30 -0
- package/lib/site/components/utils/elements.js +240 -0
- package/lib/site/components/utils/shared.d.ts +36 -0
- package/lib/site/components/utils/shared.js +181 -0
- package/lib/site/mobile/main.d.ts +3 -0
- package/lib/site/mobile/main.js +93 -0
- package/lib/site/pc/main.d.ts +3 -0
- package/lib/site/pc/main.js +69 -0
- package/lib/site/useProgress.d.ts +4 -0
- package/lib/site/useProgress.js +58 -0
- package/lib/site/utils.d.ts +24 -0
- package/lib/site/utils.js +133 -0
- package/package.json +16 -30
- package/site/.DS_Store +0 -0
- package/site/components/app-bar/AppBar.vue +45 -0
- package/site/components/app-bar/appBar.less +66 -0
- package/site/components/app-bar/index.ts +10 -0
- package/site/components/app-bar/props.ts +25 -0
- package/site/components/button/Button.vue +84 -0
- package/site/components/button/button.less +183 -0
- package/site/components/button/index.ts +10 -0
- package/site/components/button/props.ts +70 -0
- package/site/components/cell/Cell.vue +42 -0
- package/site/components/cell/cell.less +74 -0
- package/site/components/cell/index.ts +10 -0
- package/site/components/cell/props.ts +27 -0
- package/site/components/context/index.ts +17 -0
- package/site/components/context/lock.ts +103 -0
- package/site/components/context/zIndex.ts +20 -0
- package/site/components/icon/Icon.vue +68 -0
- package/site/components/icon/icon.less +25 -0
- package/site/components/icon/index.ts +10 -0
- package/site/components/icon/props.ts +24 -0
- package/site/components/loading/Loading.vue +55 -0
- package/site/components/loading/index.ts +10 -0
- package/site/components/loading/loading.less +420 -0
- package/site/components/loading/props.ts +37 -0
- package/site/components/menu/Menu.vue +113 -0
- package/site/components/menu/index.ts +10 -0
- package/site/components/menu/menu.less +27 -0
- package/site/components/menu/props.ts +43 -0
- package/site/components/progress/Progress.vue +108 -0
- package/site/components/progress/index.ts +10 -0
- package/site/components/progress/progress.less +98 -0
- package/site/components/progress/props.ts +55 -0
- package/site/components/ripple/index.ts +167 -0
- package/site/components/ripple/ripple.less +17 -0
- package/site/components/styles/common.less +64 -0
- package/site/components/styles/elevation.less +126 -0
- package/site/components/styles/var.less +27 -0
- package/site/components/utils/components.ts +53 -0
- package/site/components/utils/elements.ts +83 -0
- package/site/components/utils/shared.ts +27 -0
- package/site/{pc/index.html → index.html} +6 -4
- package/site/mobile/App.vue +20 -18
- package/site/mobile/components/AppHome.vue +6 -8
- package/site/mobile/main.ts +17 -2
- package/site/{mobile/mobile.html → mobile.html} +6 -5
- package/site/pc/App.vue +16 -11
- package/site/pc/components/AppHeader.vue +15 -13
- package/site/pc/components/AppMobile.vue +3 -3
- package/site/pc/components/AppSidebar.vue +17 -23
- package/site/pc/main.ts +10 -2
- package/site/useProgress.ts +11 -9
- package/site/utils.ts +14 -3
- package/varlet.default.config.js +3 -2
- package/generators/sfc/yarn.lock +0 -11231
- package/generators/tsx/yarn.lock +0 -11231
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useLock = exports.releaseLock = exports.addLock = exports.resolveLock = void 0;
|
|
7
|
+
var vue_1 = require("vue");
|
|
8
|
+
var _1 = __importDefault(require("."));
|
|
9
|
+
function resolveLock() {
|
|
10
|
+
var lockCounts = Object.keys(_1.default.locks).length;
|
|
11
|
+
lockCounts <= 0 ? document.body.classList.remove('var-site--lock') : document.body.classList.add('var-site--lock');
|
|
12
|
+
}
|
|
13
|
+
exports.resolveLock = resolveLock;
|
|
14
|
+
function addLock(uid) {
|
|
15
|
+
_1.default.locks[uid] = 1;
|
|
16
|
+
resolveLock();
|
|
17
|
+
}
|
|
18
|
+
exports.addLock = addLock;
|
|
19
|
+
function releaseLock(uid) {
|
|
20
|
+
delete _1.default.locks[uid];
|
|
21
|
+
resolveLock();
|
|
22
|
+
}
|
|
23
|
+
exports.releaseLock = releaseLock;
|
|
24
|
+
/**
|
|
25
|
+
* 组件锁操作
|
|
26
|
+
* @param props 组件props
|
|
27
|
+
* @param state 组件props中控制组件加锁的开关对应的key值
|
|
28
|
+
* @param use 组件props中控制组件加锁的开关是否可用对应的key值
|
|
29
|
+
*/
|
|
30
|
+
function useLock(props, state, use) {
|
|
31
|
+
var uid = vue_1.getCurrentInstance().uid;
|
|
32
|
+
if (use) {
|
|
33
|
+
vue_1.watch(function () { return props[use]; }, function (newValue) {
|
|
34
|
+
if (newValue === false) {
|
|
35
|
+
// 改变为禁用状态 组件解锁
|
|
36
|
+
releaseLock(uid);
|
|
37
|
+
}
|
|
38
|
+
else if (newValue === true && props[state] === true) {
|
|
39
|
+
// 改变为启用状态 并且popup处于开启状态 组件加锁
|
|
40
|
+
addLock(uid);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
vue_1.watch(function () { return props[state]; }, function (newValue) {
|
|
45
|
+
if (use && props[use] === false) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (newValue === true) {
|
|
49
|
+
// popup开启 组件加锁
|
|
50
|
+
addLock(uid);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// popup关闭 组件解锁
|
|
54
|
+
releaseLock(uid);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
vue_1.onBeforeMount(function () {
|
|
58
|
+
if (use && props[use] === false) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (props[state] === true) {
|
|
62
|
+
// popup处于开启状态 组件挂载 组件加锁
|
|
63
|
+
addLock(uid);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
vue_1.onUnmounted(function () {
|
|
67
|
+
if (use && props[use] === false) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (props[state] === true) {
|
|
71
|
+
// popup处于开启状态 组件卸载 组件解锁
|
|
72
|
+
releaseLock(uid);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
vue_1.onActivated(function () {
|
|
76
|
+
if (use && props[use] === false) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (props[state] === true) {
|
|
80
|
+
// popup处于开启状态 组件处于keepalive前台 组件加锁
|
|
81
|
+
addLock(uid);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
vue_1.onDeactivated(function () {
|
|
85
|
+
if (use && props[use] === false) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (props[state] === true) {
|
|
89
|
+
// popup处于开启状态 组件处于keepalive后台 组件解锁
|
|
90
|
+
releaseLock(uid);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
exports.useLock = useLock;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useZIndex = void 0;
|
|
7
|
+
var index_1 = __importDefault(require("./index"));
|
|
8
|
+
var vue_1 = require("vue");
|
|
9
|
+
function useZIndex(source, count) {
|
|
10
|
+
var zIndex = vue_1.ref(index_1.default.zIndex);
|
|
11
|
+
vue_1.watch(source, function (newValue) {
|
|
12
|
+
if (newValue) {
|
|
13
|
+
index_1.default.zIndex += count;
|
|
14
|
+
zIndex.value = index_1.default.zIndex;
|
|
15
|
+
}
|
|
16
|
+
}, { immediate: true });
|
|
17
|
+
return { zIndex: zIndex };
|
|
18
|
+
}
|
|
19
|
+
exports.useZIndex = useZIndex;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._IconComponent = void 0;
|
|
7
|
+
var Icon_vue_1 = __importDefault(require("./Icon.vue"));
|
|
8
|
+
Icon_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Icon_vue_1.default.name, Icon_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._IconComponent = Icon_vue_1.default;
|
|
12
|
+
exports.default = Icon_vue_1.default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
export declare const props: {
|
|
3
|
+
name: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
};
|
|
6
|
+
size: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
};
|
|
9
|
+
color: {
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
};
|
|
12
|
+
namespace: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
transition: {
|
|
17
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
18
|
+
default: number;
|
|
19
|
+
};
|
|
20
|
+
onClick: {
|
|
21
|
+
type: PropType<(event: Event) => void>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = void 0;
|
|
4
|
+
exports.props = {
|
|
5
|
+
name: {
|
|
6
|
+
type: String,
|
|
7
|
+
},
|
|
8
|
+
size: {
|
|
9
|
+
type: [Number, String],
|
|
10
|
+
},
|
|
11
|
+
color: {
|
|
12
|
+
type: String,
|
|
13
|
+
},
|
|
14
|
+
namespace: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'var-icon',
|
|
17
|
+
},
|
|
18
|
+
transition: {
|
|
19
|
+
type: [Number, String],
|
|
20
|
+
default: 0,
|
|
21
|
+
},
|
|
22
|
+
onClick: {
|
|
23
|
+
type: Function,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._LoadingComponent = void 0;
|
|
7
|
+
var Loading_vue_1 = __importDefault(require("./Loading.vue"));
|
|
8
|
+
Loading_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Loading_vue_1.default.name, Loading_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._LoadingComponent = Loading_vue_1.default;
|
|
12
|
+
exports.default = Loading_vue_1.default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare type LoadingType = 'circle' | 'wave' | 'cube' | 'rect' | 'disappear';
|
|
3
|
+
declare type LoadingSize = 'normal' | 'mini' | 'small' | 'large';
|
|
4
|
+
export declare function typeValidator(type: string): boolean;
|
|
5
|
+
export declare function sizeValidator(size: string): boolean;
|
|
6
|
+
export declare const props: {
|
|
7
|
+
type: {
|
|
8
|
+
type: PropType<LoadingType>;
|
|
9
|
+
default: string;
|
|
10
|
+
validator: typeof typeValidator;
|
|
11
|
+
};
|
|
12
|
+
radius: {
|
|
13
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
14
|
+
default: number;
|
|
15
|
+
};
|
|
16
|
+
size: {
|
|
17
|
+
type: PropType<LoadingSize>;
|
|
18
|
+
default: string;
|
|
19
|
+
validator: typeof sizeValidator;
|
|
20
|
+
};
|
|
21
|
+
color: {
|
|
22
|
+
type: StringConstructor;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = exports.sizeValidator = exports.typeValidator = void 0;
|
|
4
|
+
function typeValidator(type) {
|
|
5
|
+
return ['circle', 'wave', 'cube', 'rect', 'disappear'].includes(type);
|
|
6
|
+
}
|
|
7
|
+
exports.typeValidator = typeValidator;
|
|
8
|
+
function sizeValidator(size) {
|
|
9
|
+
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
10
|
+
}
|
|
11
|
+
exports.sizeValidator = sizeValidator;
|
|
12
|
+
exports.props = {
|
|
13
|
+
// loading类型
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: 'circle',
|
|
17
|
+
validator: typeValidator,
|
|
18
|
+
},
|
|
19
|
+
radius: {
|
|
20
|
+
type: [String, Number],
|
|
21
|
+
default: 15,
|
|
22
|
+
},
|
|
23
|
+
// loading尺寸
|
|
24
|
+
size: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'normal',
|
|
27
|
+
validator: sizeValidator,
|
|
28
|
+
},
|
|
29
|
+
// loading颜色
|
|
30
|
+
color: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'currentColor',
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._MenuComponent = void 0;
|
|
7
|
+
var Menu_vue_1 = __importDefault(require("./Menu.vue"));
|
|
8
|
+
Menu_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Menu_vue_1.default.name, Menu_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._MenuComponent = Menu_vue_1.default;
|
|
12
|
+
exports.default = Menu_vue_1.default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PropType } from 'vue';
|
|
2
|
+
declare function alignmentValidator(alignment: string): boolean;
|
|
3
|
+
export declare const props: {
|
|
4
|
+
show: {
|
|
5
|
+
type: BooleanConstructor;
|
|
6
|
+
default: boolean;
|
|
7
|
+
};
|
|
8
|
+
alignment: {
|
|
9
|
+
type: PropType<"top" | "bottom">;
|
|
10
|
+
default: string;
|
|
11
|
+
validator: typeof alignmentValidator;
|
|
12
|
+
};
|
|
13
|
+
offsetX: {
|
|
14
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
15
|
+
default: number;
|
|
16
|
+
};
|
|
17
|
+
offsetY: {
|
|
18
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
19
|
+
default: number;
|
|
20
|
+
};
|
|
21
|
+
teleport: {
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
onOpen: {
|
|
25
|
+
type: PropType<() => void>;
|
|
26
|
+
};
|
|
27
|
+
onOpened: {
|
|
28
|
+
type: PropType<() => void>;
|
|
29
|
+
};
|
|
30
|
+
onClose: {
|
|
31
|
+
type: PropType<() => void>;
|
|
32
|
+
};
|
|
33
|
+
onClosed: {
|
|
34
|
+
type: PropType<() => void>;
|
|
35
|
+
};
|
|
36
|
+
'onUpdate:show': {
|
|
37
|
+
type: PropType<(show: boolean) => void>;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = void 0;
|
|
4
|
+
function alignmentValidator(alignment) {
|
|
5
|
+
return ['top', 'bottom'].includes(alignment);
|
|
6
|
+
}
|
|
7
|
+
exports.props = {
|
|
8
|
+
show: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false,
|
|
11
|
+
},
|
|
12
|
+
alignment: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'top',
|
|
15
|
+
validator: alignmentValidator,
|
|
16
|
+
},
|
|
17
|
+
offsetX: {
|
|
18
|
+
type: [Number, String],
|
|
19
|
+
default: 0,
|
|
20
|
+
},
|
|
21
|
+
offsetY: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: 0,
|
|
24
|
+
},
|
|
25
|
+
teleport: {
|
|
26
|
+
default: 'body',
|
|
27
|
+
},
|
|
28
|
+
onOpen: {
|
|
29
|
+
type: Function,
|
|
30
|
+
},
|
|
31
|
+
onOpened: {
|
|
32
|
+
type: Function,
|
|
33
|
+
},
|
|
34
|
+
onClose: {
|
|
35
|
+
type: Function,
|
|
36
|
+
},
|
|
37
|
+
onClosed: {
|
|
38
|
+
type: Function,
|
|
39
|
+
},
|
|
40
|
+
'onUpdate:show': {
|
|
41
|
+
type: Function,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._ProgressComponent = void 0;
|
|
7
|
+
var Progress_vue_1 = __importDefault(require("./Progress.vue"));
|
|
8
|
+
Progress_vue_1.default.install = function (app) {
|
|
9
|
+
app.component(Progress_vue_1.default.name, Progress_vue_1.default);
|
|
10
|
+
};
|
|
11
|
+
exports._ProgressComponent = Progress_vue_1.default;
|
|
12
|
+
exports.default = Progress_vue_1.default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare function modeValidator(mode: string): boolean;
|
|
2
|
+
export declare const props: {
|
|
3
|
+
mode: {
|
|
4
|
+
type: StringConstructor;
|
|
5
|
+
default: string;
|
|
6
|
+
validator: typeof modeValidator;
|
|
7
|
+
};
|
|
8
|
+
lineWidth: {
|
|
9
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
10
|
+
default: number;
|
|
11
|
+
};
|
|
12
|
+
color: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
};
|
|
15
|
+
trackColor: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
};
|
|
18
|
+
ripple: {
|
|
19
|
+
type: BooleanConstructor;
|
|
20
|
+
default: boolean;
|
|
21
|
+
};
|
|
22
|
+
value: {
|
|
23
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
label: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
size: {
|
|
31
|
+
type: NumberConstructor;
|
|
32
|
+
default: number;
|
|
33
|
+
};
|
|
34
|
+
rotate: {
|
|
35
|
+
type: NumberConstructor;
|
|
36
|
+
default: number;
|
|
37
|
+
};
|
|
38
|
+
track: {
|
|
39
|
+
type: BooleanConstructor;
|
|
40
|
+
default: boolean;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.props = void 0;
|
|
4
|
+
function modeValidator(mode) {
|
|
5
|
+
return ['linear', 'circle'].includes(mode);
|
|
6
|
+
}
|
|
7
|
+
exports.props = {
|
|
8
|
+
// progress 模式
|
|
9
|
+
mode: {
|
|
10
|
+
type: String,
|
|
11
|
+
default: 'linear',
|
|
12
|
+
validator: modeValidator,
|
|
13
|
+
},
|
|
14
|
+
// progress 线宽
|
|
15
|
+
lineWidth: {
|
|
16
|
+
type: [Number, String],
|
|
17
|
+
default: 4,
|
|
18
|
+
},
|
|
19
|
+
// progress 颜色
|
|
20
|
+
color: {
|
|
21
|
+
type: String,
|
|
22
|
+
},
|
|
23
|
+
// progress 轨道颜色
|
|
24
|
+
trackColor: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
// 是否添加水波纹效果
|
|
28
|
+
ripple: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: false,
|
|
31
|
+
},
|
|
32
|
+
// progress 值
|
|
33
|
+
value: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: 0,
|
|
36
|
+
},
|
|
37
|
+
// 是否显示label
|
|
38
|
+
label: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false,
|
|
41
|
+
},
|
|
42
|
+
// circle 的尺寸
|
|
43
|
+
size: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 40,
|
|
46
|
+
},
|
|
47
|
+
// circle的原点
|
|
48
|
+
rotate: {
|
|
49
|
+
type: Number,
|
|
50
|
+
default: 0,
|
|
51
|
+
},
|
|
52
|
+
// 是否显示 circle 轨道
|
|
53
|
+
track: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import './ripple.less';
|
|
2
|
+
import '../styles/common.less';
|
|
3
|
+
import type { Directive, Plugin, App } from 'vue';
|
|
4
|
+
declare const Ripple: Directive & Plugin;
|
|
5
|
+
export declare const _RippleComponent: import("vue").ObjectDirective<any, any> & {
|
|
6
|
+
install: (app: App<any>, ...options: any[]) => any;
|
|
7
|
+
};
|
|
8
|
+
export default Ripple;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports._RippleComponent = void 0;
|
|
18
|
+
var context_1 = __importDefault(require("../context"));
|
|
19
|
+
require("./ripple.less");
|
|
20
|
+
require("../styles/common.less");
|
|
21
|
+
var ANIMATION_DURATION = 250;
|
|
22
|
+
function setStyles(element) {
|
|
23
|
+
var _a = window.getComputedStyle(element), zIndex = _a.zIndex, position = _a.position;
|
|
24
|
+
element.style.overflow = 'hidden';
|
|
25
|
+
element.style.overflowX = 'hidden';
|
|
26
|
+
element.style.overflowY = 'hidden';
|
|
27
|
+
position === 'static' && (element.style.position = 'relative');
|
|
28
|
+
zIndex === 'auto' && (element.style.zIndex = '1');
|
|
29
|
+
}
|
|
30
|
+
function computeRippleStyles(element, event) {
|
|
31
|
+
var _a = element.getBoundingClientRect(), top = _a.top, left = _a.left;
|
|
32
|
+
var clientWidth = element.clientWidth, clientHeight = element.clientHeight;
|
|
33
|
+
var radius = Math.sqrt(Math.pow(clientWidth, 2) + Math.pow(clientHeight, 2)) / 2;
|
|
34
|
+
var size = radius * 2;
|
|
35
|
+
var localX = event.touches[0].clientX - left;
|
|
36
|
+
var localY = event.touches[0].clientY - top;
|
|
37
|
+
var centerX = (clientWidth - radius * 2) / 2;
|
|
38
|
+
var centerY = (clientHeight - radius * 2) / 2;
|
|
39
|
+
var x = localX - radius;
|
|
40
|
+
var y = localY - radius;
|
|
41
|
+
return { x: x, y: y, centerX: centerX, centerY: centerY, size: size };
|
|
42
|
+
}
|
|
43
|
+
function createRipple(event) {
|
|
44
|
+
var _this = this;
|
|
45
|
+
var _ripple = this._ripple;
|
|
46
|
+
_ripple.removeRipple();
|
|
47
|
+
if (_ripple.disabled || _ripple.tasker) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
var task = function () {
|
|
51
|
+
var _a;
|
|
52
|
+
_ripple.tasker = null;
|
|
53
|
+
var _b = computeRippleStyles(_this, event), x = _b.x, y = _b.y, centerX = _b.centerX, centerY = _b.centerY, size = _b.size;
|
|
54
|
+
var ripple = document.createElement('div');
|
|
55
|
+
ripple.classList.add('var-site-ripple');
|
|
56
|
+
ripple.style.opacity = "0";
|
|
57
|
+
ripple.style.transform = "translate(" + x + "px, " + y + "px) scale3d(.3, .3, .3)";
|
|
58
|
+
ripple.style.width = size + "px";
|
|
59
|
+
ripple.style.height = size + "px";
|
|
60
|
+
ripple.style.backgroundColor = (_a = _ripple.color) !== null && _a !== void 0 ? _a : 'currentColor';
|
|
61
|
+
ripple.dataset.createdAt = String(performance.now());
|
|
62
|
+
setStyles(_this);
|
|
63
|
+
_this.appendChild(ripple);
|
|
64
|
+
window.setTimeout(function () {
|
|
65
|
+
ripple.style.transform = "translate(" + centerX + "px, " + centerY + "px) scale3d(1, 1, 1)";
|
|
66
|
+
ripple.style.opacity = ".25";
|
|
67
|
+
}, 20);
|
|
68
|
+
};
|
|
69
|
+
_ripple.tasker = window.setTimeout(task, 60);
|
|
70
|
+
}
|
|
71
|
+
function removeRipple() {
|
|
72
|
+
var _this = this;
|
|
73
|
+
var _ripple = this._ripple;
|
|
74
|
+
var task = function () {
|
|
75
|
+
var ripples = _this.querySelectorAll('.var-site-ripple');
|
|
76
|
+
if (!ripples.length) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var lastRipple = ripples[ripples.length - 1];
|
|
80
|
+
var delay = ANIMATION_DURATION - performance.now() + Number(lastRipple.dataset.createdAt);
|
|
81
|
+
setTimeout(function () {
|
|
82
|
+
lastRipple.style.opacity = "0";
|
|
83
|
+
setTimeout(function () { var _a; return (_a = lastRipple.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(lastRipple); }, ANIMATION_DURATION);
|
|
84
|
+
}, delay);
|
|
85
|
+
};
|
|
86
|
+
_ripple.tasker ? setTimeout(task, 60) : task();
|
|
87
|
+
}
|
|
88
|
+
function forbidRippleTask() {
|
|
89
|
+
var _ripple = this._ripple;
|
|
90
|
+
if (!_ripple.touchmoveForbid) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
_ripple.tasker && window.clearTimeout(_ripple.tasker);
|
|
94
|
+
_ripple.tasker = null;
|
|
95
|
+
}
|
|
96
|
+
function mounted(el, binding) {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
el._ripple = __assign(__assign({ tasker: null }, ((_a = binding.value) !== null && _a !== void 0 ? _a : {})), { touchmoveForbid: (_c = (_b = binding.value) === null || _b === void 0 ? void 0 : _b.touchmoveForbid) !== null && _c !== void 0 ? _c : context_1.default.touchmoveForbid, removeRipple: removeRipple.bind(el) });
|
|
99
|
+
el.addEventListener('touchstart', createRipple, { passive: true });
|
|
100
|
+
el.addEventListener('touchmove', forbidRippleTask, { passive: true });
|
|
101
|
+
el.addEventListener('dragstart', removeRipple, { passive: true });
|
|
102
|
+
document.addEventListener('touchend', el._ripple.removeRipple, { passive: true });
|
|
103
|
+
document.addEventListener('touchcancel', el._ripple.removeRipple, { passive: true });
|
|
104
|
+
}
|
|
105
|
+
function unmounted(el) {
|
|
106
|
+
el.removeEventListener('touchstart', createRipple);
|
|
107
|
+
el.removeEventListener('touchmove', forbidRippleTask);
|
|
108
|
+
el.removeEventListener('dragstart', removeRipple);
|
|
109
|
+
document.removeEventListener('touchend', el._ripple.removeRipple);
|
|
110
|
+
document.removeEventListener('touchcancel', el._ripple.removeRipple);
|
|
111
|
+
}
|
|
112
|
+
function updated(el, binding) {
|
|
113
|
+
var _a, _b, _c;
|
|
114
|
+
el._ripple = __assign(__assign(__assign({}, el._ripple), ((_a = binding.value) !== null && _a !== void 0 ? _a : {})), { touchmoveForbid: (_c = (_b = binding.value) === null || _b === void 0 ? void 0 : _b.touchmoveForbid) !== null && _c !== void 0 ? _c : context_1.default.touchmoveForbid, tasker: null });
|
|
115
|
+
}
|
|
116
|
+
var Ripple = {
|
|
117
|
+
mounted: mounted,
|
|
118
|
+
unmounted: unmounted,
|
|
119
|
+
updated: updated,
|
|
120
|
+
install: function (app) {
|
|
121
|
+
app.directive('ripple', this);
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
exports._RippleComponent = Ripple;
|
|
125
|
+
exports.default = Ripple;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Component, VNode, ComputedRef, ComponentInternalInstance, Ref } from 'vue';
|
|
2
|
+
export interface MountInstance {
|
|
3
|
+
instance: any;
|
|
4
|
+
unmount: () => void;
|
|
5
|
+
}
|
|
6
|
+
export interface ChildrenCounter {
|
|
7
|
+
collect(instance: ComponentInternalInstance): void;
|
|
8
|
+
clear(instance: ComponentInternalInstance): void;
|
|
9
|
+
instances: ComponentInternalInstance[];
|
|
10
|
+
}
|
|
11
|
+
export interface BaseParentProvider<C> {
|
|
12
|
+
collect(childProvider: C): void;
|
|
13
|
+
clear(childProvider: C): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function pickProps(props: any, propsKey: string): any;
|
|
16
|
+
export declare function pickProps(props: any, propsKey: string[]): any;
|
|
17
|
+
export declare function mount(component: Component): MountInstance;
|
|
18
|
+
export declare function mountInstance(component: any, props?: Record<string, any>, eventListener?: Record<string, any>): {
|
|
19
|
+
unmountInstance: () => void;
|
|
20
|
+
};
|
|
21
|
+
export declare function flatVNodes(subTree: any): VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>[];
|
|
24
|
+
export declare function useAtChildrenCounter(key: symbol): {
|
|
25
|
+
length: ComputedRef<number>;
|
|
26
|
+
};
|
|
27
|
+
export declare function useAtParentIndex(key: symbol): {
|
|
28
|
+
index: null;
|
|
29
|
+
} | {
|
|
30
|
+
index: ComputedRef<number>;
|
|
31
|
+
};
|
|
32
|
+
export declare function useChildren<P, C>(key: symbol): {
|
|
33
|
+
childProviders: C[];
|
|
34
|
+
bindChildren: (parentProvider: P) => void;
|
|
35
|
+
};
|
|
36
|
+
export declare function useParent<P, C>(key: symbol): {
|
|
37
|
+
parentProvider: null;
|
|
38
|
+
bindParent: null;
|
|
39
|
+
} | {
|
|
40
|
+
parentProvider: Omit<P & BaseParentProvider<C>, "collect" | "clear">;
|
|
41
|
+
bindParent: (childProvider: C) => void;
|
|
42
|
+
};
|
|
43
|
+
export declare function keyInProvides(key: symbol): boolean;
|
|
44
|
+
export declare function useValidation(): {
|
|
45
|
+
errorMessage: Ref<string>;
|
|
46
|
+
validate: (rules: any, value: any, apis?: any) => Promise<boolean>;
|
|
47
|
+
resetValidation: () => void;
|
|
48
|
+
validateWithTrigger: <T>(validateTrigger: T[], trigger: T, rules: any, value: any, apis?: any) => Promise<void>;
|
|
49
|
+
};
|
|
50
|
+
export declare function addRouteListener(cb: () => void): void;
|
|
51
|
+
export declare function useTeleport(): {
|
|
52
|
+
disabled: Ref<boolean>;
|
|
53
|
+
};
|