morghulis 2.0.52 → 2.0.53
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/index.d.ts +37 -75
- package/package.json +3 -2
- package/typings/components.d.ts +5 -63
- package/typings/direct.d.ts +77 -0
- package/typings/jetbrains.d.ts +23 -62
- package/typings/volar.d.ts +2 -2
package/index.d.ts
CHANGED
@@ -1,95 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
// 定义常量类型
|
1
|
+
// 定义按钮类型
|
4
2
|
export type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
|
5
3
|
export type ButtonSize = 'large' | 'default' | 'small';
|
6
4
|
|
7
|
-
//
|
8
|
-
export
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
/**
|
24
|
-
* 是否为朴素按钮
|
25
|
-
* @default false
|
26
|
-
*/
|
27
|
-
plain?: boolean;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* 是否为圆角按钮
|
31
|
-
* @default false
|
32
|
-
*/
|
33
|
-
round?: boolean;
|
34
|
-
|
35
|
-
/**
|
36
|
-
* 是否为圆形按钮
|
37
|
-
* @default false
|
38
|
-
*/
|
39
|
-
circle?: boolean;
|
40
|
-
|
41
|
-
/**
|
42
|
-
* 是否禁用按钮
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
disabled?: boolean;
|
46
|
-
|
47
|
-
/**
|
48
|
-
* 是否显示加载状态
|
49
|
-
* @default false
|
50
|
-
*/
|
51
|
-
loading?: boolean;
|
52
|
-
|
53
|
-
/**
|
54
|
-
* 按钮图标类名
|
55
|
-
*/
|
56
|
-
icon?: string;
|
57
|
-
|
58
|
-
/**
|
59
|
-
* 按钮文本
|
60
|
-
*/
|
61
|
-
text?: string;
|
5
|
+
// 按钮组件属性和事件
|
6
|
+
export type MButton = {
|
7
|
+
// 属性
|
8
|
+
type?: ButtonType
|
9
|
+
size?: ButtonSize
|
10
|
+
plain?: boolean
|
11
|
+
round?: boolean
|
12
|
+
circle?: boolean
|
13
|
+
disabled?: boolean
|
14
|
+
loading?: boolean
|
15
|
+
icon?: string
|
16
|
+
text?: string
|
17
|
+
|
18
|
+
// 事件
|
19
|
+
onClick?: (event: MouseEvent) => void
|
62
20
|
}
|
63
21
|
|
64
|
-
//
|
65
|
-
export
|
66
|
-
click: (event: MouseEvent) => void
|
67
|
-
}>;
|
68
|
-
|
69
|
-
// 导出插件方法
|
70
|
-
export function install(app: App): void;
|
22
|
+
// 安装方法
|
23
|
+
export function install(app: any): void;
|
71
24
|
|
72
25
|
// 默认导出
|
73
|
-
|
74
|
-
|
75
|
-
|
26
|
+
export default {
|
27
|
+
MButton,
|
28
|
+
install
|
76
29
|
};
|
77
|
-
export default _default;
|
78
30
|
|
79
|
-
//
|
31
|
+
// 全局组件声明
|
80
32
|
declare module '@vue/runtime-core' {
|
81
33
|
export interface GlobalComponents {
|
82
|
-
MButton:
|
34
|
+
MButton: MButton
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// 直接声明方式
|
39
|
+
declare module 'morghulis' {
|
40
|
+
export const MButton: MButton
|
41
|
+
}
|
42
|
+
|
43
|
+
// 直接扩展Vue
|
44
|
+
declare module 'vue/types/vue' {
|
45
|
+
interface Vue {
|
46
|
+
$MButton: typeof MButton
|
83
47
|
}
|
84
48
|
}
|
85
49
|
|
86
|
-
// 支持
|
50
|
+
// JSX支持
|
87
51
|
declare global {
|
88
52
|
namespace JSX {
|
89
53
|
interface IntrinsicElements {
|
90
|
-
'MButton':
|
91
|
-
onClick?: (event: MouseEvent) => void
|
92
|
-
};
|
54
|
+
'MButton': MButton
|
93
55
|
}
|
94
56
|
}
|
95
57
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "morghulis",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.53",
|
4
4
|
"description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/morghulis.es.js",
|
@@ -12,7 +12,8 @@
|
|
12
12
|
"./index.d.ts",
|
13
13
|
"./typings/components.d.ts",
|
14
14
|
"./typings/volar.d.ts",
|
15
|
-
"./typings/jetbrains.d.ts"
|
15
|
+
"./typings/jetbrains.d.ts",
|
16
|
+
"./typings/direct.d.ts"
|
16
17
|
],
|
17
18
|
"import": "./dist/morghulis.es.js",
|
18
19
|
"require": "./dist/morghulis.es.js"
|
package/typings/components.d.ts
CHANGED
@@ -1,66 +1,8 @@
|
|
1
|
-
//
|
2
|
-
|
1
|
+
// 全局组件类型定义
|
2
|
+
import type { MButton as MButtonType } from '../index';
|
3
|
+
|
4
|
+
declare module '@vue/runtime-core' {
|
3
5
|
export interface GlobalComponents {
|
4
|
-
MButton:
|
5
|
-
/**
|
6
|
-
* 按钮类型
|
7
|
-
* @default 'default'
|
8
|
-
* @values default, primary, success, warning, danger, info, text
|
9
|
-
*/
|
10
|
-
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text'
|
11
|
-
|
12
|
-
/**
|
13
|
-
* 按钮尺寸
|
14
|
-
* @default 'default'
|
15
|
-
* @values large, default, small
|
16
|
-
*/
|
17
|
-
size?: 'large' | 'default' | 'small'
|
18
|
-
|
19
|
-
/**
|
20
|
-
* 是否为朴素按钮
|
21
|
-
* @default false
|
22
|
-
*/
|
23
|
-
plain?: boolean
|
24
|
-
|
25
|
-
/**
|
26
|
-
* 是否为圆角按钮
|
27
|
-
* @default false
|
28
|
-
*/
|
29
|
-
round?: boolean
|
30
|
-
|
31
|
-
/**
|
32
|
-
* 是否为圆形按钮
|
33
|
-
* @default false
|
34
|
-
*/
|
35
|
-
circle?: boolean
|
36
|
-
|
37
|
-
/**
|
38
|
-
* 是否禁用按钮
|
39
|
-
* @default false
|
40
|
-
*/
|
41
|
-
disabled?: boolean
|
42
|
-
|
43
|
-
/**
|
44
|
-
* 是否显示加载状态
|
45
|
-
* @default false
|
46
|
-
*/
|
47
|
-
loading?: boolean
|
48
|
-
|
49
|
-
/**
|
50
|
-
* 按钮图标类名
|
51
|
-
*/
|
52
|
-
icon?: string
|
53
|
-
|
54
|
-
/**
|
55
|
-
* 按钮文本
|
56
|
-
*/
|
57
|
-
text?: string
|
58
|
-
|
59
|
-
/**
|
60
|
-
* 点击事件
|
61
|
-
* @param event 鼠标事件
|
62
|
-
*/
|
63
|
-
onClick?: (event: MouseEvent) => void
|
64
|
-
}
|
6
|
+
MButton: MButtonType
|
65
7
|
}
|
66
8
|
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
// 直接声明每个组件的类型,不通过模块
|
2
|
+
|
3
|
+
/**
|
4
|
+
* 按钮组件
|
5
|
+
*
|
6
|
+
* @component MButton
|
7
|
+
* @example
|
8
|
+
* <MButton type="primary" size="large" plain round>按钮文本</MButton>
|
9
|
+
*/
|
10
|
+
interface MButton {
|
11
|
+
/**
|
12
|
+
* 按钮类型
|
13
|
+
* @default default
|
14
|
+
*/
|
15
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
|
16
|
+
|
17
|
+
/**
|
18
|
+
* 按钮尺寸
|
19
|
+
* @default default
|
20
|
+
*/
|
21
|
+
size?: 'large' | 'default' | 'small';
|
22
|
+
|
23
|
+
/**
|
24
|
+
* 是否为朴素按钮
|
25
|
+
* @default false
|
26
|
+
*/
|
27
|
+
plain?: boolean;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 是否为圆角按钮
|
31
|
+
* @default false
|
32
|
+
*/
|
33
|
+
round?: boolean;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* 是否为圆形按钮
|
37
|
+
* @default false
|
38
|
+
*/
|
39
|
+
circle?: boolean;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 是否禁用按钮
|
43
|
+
* @default false
|
44
|
+
*/
|
45
|
+
disabled?: boolean;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* 是否显示加载状态
|
49
|
+
* @default false
|
50
|
+
*/
|
51
|
+
loading?: boolean;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* 按钮图标类名
|
55
|
+
*/
|
56
|
+
icon?: string;
|
57
|
+
|
58
|
+
/**
|
59
|
+
* 按钮文本
|
60
|
+
*/
|
61
|
+
text?: string;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* 点击事件
|
65
|
+
*/
|
66
|
+
onClick?: (event: MouseEvent) => void;
|
67
|
+
}
|
68
|
+
|
69
|
+
// 将类型加入全局命名空间
|
70
|
+
declare global {
|
71
|
+
interface HTMLElementTagNameMap {
|
72
|
+
'MButton': MButton;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
// 导出类型以便在其他地方使用
|
77
|
+
export { MButton };
|
package/typings/jetbrains.d.ts
CHANGED
@@ -1,68 +1,29 @@
|
|
1
|
-
// JetBrains IDE
|
1
|
+
// 为JetBrains IDE提供的类型定义
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
export
|
7
|
-
|
8
|
-
|
9
|
-
export interface MButtonProps {
|
10
|
-
/**
|
11
|
-
* 按钮类型
|
12
|
-
* @values default, primary, success, warning, danger, info, text
|
13
|
-
* @default default
|
14
|
-
*/
|
15
|
-
type?: ButtonType;
|
16
|
-
|
17
|
-
/**
|
18
|
-
* 按钮尺寸
|
19
|
-
* @values large, default, small
|
20
|
-
* @default default
|
21
|
-
*/
|
22
|
-
size?: ButtonSize;
|
23
|
-
|
24
|
-
/**
|
25
|
-
* 是否为朴素按钮
|
26
|
-
* @default false
|
27
|
-
*/
|
28
|
-
plain?: boolean;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* 是否为圆角按钮
|
32
|
-
* @default false
|
33
|
-
*/
|
34
|
-
round?: boolean;
|
35
|
-
|
36
|
-
/**
|
37
|
-
* 是否为圆形按钮
|
38
|
-
* @default false
|
39
|
-
*/
|
40
|
-
circle?: boolean;
|
41
|
-
|
42
|
-
/**
|
43
|
-
* 是否禁用按钮
|
44
|
-
* @default false
|
45
|
-
*/
|
46
|
-
disabled?: boolean;
|
47
|
-
|
48
|
-
/**
|
49
|
-
* 是否显示加载状态
|
50
|
-
* @default false
|
51
|
-
*/
|
52
|
-
loading?: boolean;
|
53
|
-
|
54
|
-
/**
|
55
|
-
* 按钮图标类名
|
56
|
-
*/
|
57
|
-
icon?: string;
|
58
|
-
|
59
|
-
/**
|
60
|
-
* 按钮文本
|
61
|
-
*/
|
62
|
-
text?: string;
|
3
|
+
import type { MButton as MButtonType } from '../index';
|
4
|
+
|
5
|
+
declare module '@vue/runtime-core' {
|
6
|
+
export interface GlobalComponents {
|
7
|
+
MButton: MButtonType
|
63
8
|
}
|
9
|
+
}
|
64
10
|
|
65
|
-
|
11
|
+
// 直接类型声明,可能更符合PyCharm的识别方式
|
12
|
+
declare module 'vue' {
|
13
|
+
interface GlobalComponents {
|
14
|
+
MButton: {
|
15
|
+
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text',
|
16
|
+
size?: 'large' | 'default' | 'small',
|
17
|
+
plain?: boolean,
|
18
|
+
round?: boolean,
|
19
|
+
circle?: boolean,
|
20
|
+
disabled?: boolean,
|
21
|
+
loading?: boolean,
|
22
|
+
icon?: string,
|
23
|
+
text?: string,
|
24
|
+
onClick?: (event: MouseEvent) => void
|
25
|
+
}
|
26
|
+
}
|
66
27
|
}
|
67
28
|
|
68
29
|
/**
|
package/typings/volar.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
// Volar专用类型定义 - 用于TypeScript服务器识别
|
2
2
|
|
3
|
-
import type {
|
3
|
+
import type { MButton } from '../index';
|
4
4
|
|
5
5
|
declare module 'vue' {
|
6
6
|
export interface GlobalComponents {
|
7
7
|
/**
|
8
8
|
* 按钮组件
|
9
9
|
*/
|
10
|
-
MButton:
|
10
|
+
MButton: MButton
|
11
11
|
}
|
12
12
|
}
|