morghulis 2.0.44 → 2.0.46

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent as m, computed as b, createElementBlock as a, openBlock as s, normalizeClass as c, createCommentVNode as d, createElementVNode as i, renderSlot as g, createTextVNode as p, toDisplayString as k } from "vue";
1
+ import { defineComponent as m, computed as b, createElementBlock as a, openBlock as s, normalizeClass as r, createCommentVNode as u, createElementVNode as i, renderSlot as g, createTextVNode as p, toDisplayString as k } from "vue";
2
2
  const y = m({
3
3
  name: "MButton",
4
4
  props: {
@@ -73,8 +73,8 @@ const y = m({
73
73
  "m-button--disabled": t.disabled,
74
74
  "m-button--loading": t.loading
75
75
  }
76
- ]), l = (u) => {
77
- t.disabled || t.loading || e("click", u);
76
+ ]), l = (c) => {
77
+ t.disabled || t.loading || e("click", c);
78
78
  };
79
79
  return n({
80
80
  /**
@@ -93,23 +93,23 @@ const y = m({
93
93
  for (const [o, l] of e)
94
94
  n[o] = l;
95
95
  return n;
96
- }, C = ["disabled"], h = {
96
+ }, B = ["disabled"], C = {
97
97
  key: 0,
98
98
  class: "m-button__loading"
99
- }, B = {
99
+ }, h = {
100
100
  key: 1,
101
101
  class: "m-button__icon"
102
102
  }, v = {
103
103
  key: 2,
104
104
  class: "m-button__text"
105
105
  };
106
- function $(t, e, n, o, l, u) {
106
+ function $(t, e, n, o, l, c) {
107
107
  return s(), a("button", {
108
- class: c(t.buttonClass),
108
+ class: r(t.buttonClass),
109
109
  disabled: t.disabled,
110
110
  onClick: e[0] || (e[0] = (...f) => t.handleClick && t.handleClick(...f))
111
111
  }, [
112
- t.loading ? (s(), a("span", h, e[1] || (e[1] = [
112
+ t.loading ? (s(), a("span", C, e[1] || (e[1] = [
113
113
  i("svg", {
114
114
  class: "m-button__loading-icon",
115
115
  viewBox: "0 0 1024 1024",
@@ -126,29 +126,33 @@ function $(t, e, n, o, l, u) {
126
126
  fill: "currentColor"
127
127
  })
128
128
  ], -1)
129
- ]))) : d("", !0),
130
- t.icon && !t.loading ? (s(), a("span", B, [
129
+ ]))) : u("", !0),
130
+ t.icon && !t.loading ? (s(), a("span", h, [
131
131
  i("i", {
132
- class: c(t.icon)
132
+ class: r(t.icon)
133
133
  }, null, 2)
134
- ])) : d("", !0),
134
+ ])) : u("", !0),
135
135
  t.$slots.default || t.text ? (s(), a("span", v, [
136
136
  g(t.$slots, "default", {}, () => [
137
137
  p(k(t.text), 1)
138
138
  ], !0)
139
- ])) : d("", !0)
140
- ], 10, C);
139
+ ])) : u("", !0)
140
+ ], 10, B);
141
141
  }
142
- const r = /* @__PURE__ */ _(y, [["render", $], ["__scopeId", "data-v-1d04af69"]]), w = (t) => {
143
- t.component("MButton", r);
144
- }, z = (t) => {
142
+ const d = /* @__PURE__ */ _(y, [["render", $], ["__scopeId", "data-v-1d04af69"]]), w = (t) => {
143
+ t.component("MButton", d);
144
+ };
145
+ d.install = (t) => {
146
+ t.component("MButton", d);
147
+ };
148
+ const M = (t) => {
145
149
  w(t);
146
150
  }, S = {
147
- install: z,
148
- MButton: r
151
+ install: M,
152
+ MButton: d
149
153
  };
150
154
  export {
151
- r as MButton,
155
+ d as MButton,
152
156
  S as default,
153
- z as install
157
+ M as install
154
158
  };
package/index.d.ts CHANGED
@@ -1,39 +1,113 @@
1
- import type { App } from 'vue';
1
+ import type { App, DefineComponent, ComponentOptionsMixin } 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
 
25
- export declare const MButton: {
26
- new (): {
27
- $props: ButtonProps;
28
- };
68
+ // 按钮实例
69
+ export interface ButtonInstance {
70
+ $props: ButtonProps;
71
+
72
+ /**
73
+ * 触发按钮点击事件
74
+ */
75
+ triggerClick: () => void;
76
+ }
77
+
78
+ // MButton组件
79
+ export declare const MButton: DefineComponent<
80
+ ButtonProps,
81
+ {},
82
+ {},
83
+ {},
84
+ {},
85
+ ComponentOptionsMixin,
86
+ ComponentOptionsMixin,
87
+ {
88
+ click: (event: MouseEvent) => void
89
+ },
90
+ string,
91
+ ButtonProps,
92
+ {}
93
+ > & {
29
94
  install(app: App): void;
30
95
  };
31
96
 
97
+ // 全局安装函数
32
98
  export declare function install(app: App): void;
33
99
 
100
+ // 默认导出
34
101
  declare const _default: {
35
102
  install: typeof install;
36
103
  MButton: typeof MButton;
37
104
  };
38
105
 
39
- export default _default;
106
+ export default _default;
107
+
108
+ // 为全局组件扩展类型
109
+ declare module '@vue/runtime-core' {
110
+ export interface GlobalComponents {
111
+ MButton: typeof MButton;
112
+ }
113
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.44",
3
+ "version": "2.0.46",
4
4
  "description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
5
5
  "type": "module",
6
6
  "main": "dist/morghulis.es.js",
@@ -11,7 +11,8 @@
11
11
  "types": "./index.d.ts",
12
12
  "import": "./dist/morghulis.es.js",
13
13
  "require": "./dist/morghulis.es.js"
14
- }
14
+ },
15
+ "./dist/morghulis.css": "./dist/morghulis.css"
15
16
  },
16
17
  "files": [
17
18
  "dist",