morghulis 2.0.45 → 2.0.47

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.
Files changed (3) hide show
  1. package/global.d.ts +58 -0
  2. package/index.d.ts +61 -4
  3. package/package.json +4 -3
package/global.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ // 为全局组件扩展类型
2
+ declare module '@vue/runtime-core' {
3
+ export interface GlobalComponents {
4
+ MButton: {
5
+ /**
6
+ * 按钮类型
7
+ * @default 'default'
8
+ */
9
+ type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
10
+
11
+ /**
12
+ * 按钮尺寸
13
+ * @default 'default'
14
+ */
15
+ size?: 'large' | 'default' | 'small';
16
+
17
+ /**
18
+ * 是否为朴素按钮
19
+ * @default false
20
+ */
21
+ plain?: boolean;
22
+
23
+ /**
24
+ * 是否为圆角按钮
25
+ * @default false
26
+ */
27
+ round?: boolean;
28
+
29
+ /**
30
+ * 是否为圆形按钮
31
+ * @default false
32
+ */
33
+ circle?: boolean;
34
+
35
+ /**
36
+ * 是否禁用按钮
37
+ * @default false
38
+ */
39
+ disabled?: boolean;
40
+
41
+ /**
42
+ * 是否显示加载状态
43
+ * @default false
44
+ */
45
+ loading?: boolean;
46
+
47
+ /**
48
+ * 按钮图标类名
49
+ */
50
+ icon?: string;
51
+
52
+ /**
53
+ * 点击按钮时触发
54
+ */
55
+ onClick?: (event: MouseEvent) => void;
56
+ }
57
+ }
58
+ }
package/index.d.ts CHANGED
@@ -1,33 +1,89 @@
1
1
  import type { App, Component } from 'vue';
2
2
 
3
+ // 按钮类型
3
4
  export declare type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
5
+
6
+ // 按钮尺寸
4
7
  export declare type ButtonSize = 'large' | 'default' | 'small';
5
8
 
9
+ // 按钮属性
6
10
  export interface ButtonProps {
11
+ /**
12
+ * 按钮类型
13
+ * @default 'default'
14
+ */
7
15
  type?: ButtonType;
16
+
17
+ /**
18
+ * 按钮尺寸
19
+ * @default 'default'
20
+ */
8
21
  size?: ButtonSize;
22
+
23
+ /**
24
+ * 是否为朴素按钮
25
+ * @default false
26
+ */
9
27
  plain?: boolean;
28
+
29
+ /**
30
+ * 是否为圆角按钮
31
+ * @default false
32
+ */
10
33
  round?: boolean;
34
+
35
+ /**
36
+ * 是否为圆形按钮
37
+ * @default false
38
+ */
11
39
  circle?: boolean;
40
+
41
+ /**
42
+ * 是否禁用按钮
43
+ * @default false
44
+ */
12
45
  disabled?: boolean;
46
+
47
+ /**
48
+ * 是否显示加载状态
49
+ * @default false
50
+ */
13
51
  loading?: boolean;
52
+
53
+ /**
54
+ * 按钮图标类名
55
+ */
14
56
  icon?: string;
15
57
  }
16
58
 
17
- export interface ButtonInstance {
18
- $props: ButtonProps;
19
- }
20
-
59
+ // 按钮事件
21
60
  export interface ButtonEvents {
61
+ /**
62
+ * 点击按钮时触发
63
+ * @param event 鼠标事件对象
64
+ */
22
65
  click: (event: MouseEvent) => void;
23
66
  }
24
67
 
68
+ // 按钮实例
69
+ export interface ButtonInstance {
70
+ $props: ButtonProps;
71
+
72
+ /**
73
+ * 触发按钮点击事件
74
+ */
75
+ triggerClick: () => void;
76
+ }
77
+
78
+ // MButton组件
25
79
  export declare const MButton: Component & {
26
80
  install(app: App): void;
27
81
  };
28
82
 
83
+ // 全局安装函数
29
84
  export declare function install(app: App): void;
30
85
 
86
+ // 默认导出
31
87
  declare const _default: {
32
88
  install: typeof install;
33
89
  MButton: typeof MButton;
@@ -35,6 +91,7 @@ declare const _default: {
35
91
 
36
92
  export default _default;
37
93
 
94
+ // 为全局组件扩展类型
38
95
  declare module '@vue/runtime-core' {
39
96
  export interface GlobalComponents {
40
97
  MButton: typeof MButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.45",
3
+ "version": "2.0.47",
4
4
  "description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
5
5
  "type": "module",
6
6
  "main": "dist/morghulis.es.js",
@@ -8,7 +8,7 @@
8
8
  "types": "index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": "./index.d.ts",
11
+ "types": ["./index.d.ts", "./global.d.ts"],
12
12
  "import": "./dist/morghulis.es.js",
13
13
  "require": "./dist/morghulis.es.js"
14
14
  },
@@ -16,7 +16,8 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
- "index.d.ts"
19
+ "index.d.ts",
20
+ "global.d.ts"
20
21
  ],
21
22
  "scripts": {
22
23
  "dev": "vite",