morghulis 2.0.62 → 2.0.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.
@@ -1,4 +1,47 @@
1
- import { DefineComponent } from 'vue';
1
+ import { DefineComponent, ComponentOptionsMixin, ComponentPropsOptions, EmitsOptions } from 'vue';
2
2
  import { ButtonProps, ButtonEmits, ButtonExpose } from './MButton';
3
- declare const MButton: DefineComponent<ButtonProps, {}, {}, {}, {}, {}, {}, ButtonEmits, string, Readonly<ButtonProps>, Partial<ButtonExpose>>;
3
+
4
+ declare type Props = {
5
+ /**
6
+ * 按钮颜色
7
+ */
8
+ color?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
9
+ /**
10
+ * 是否为圆角按钮
11
+ */
12
+ round?: boolean;
13
+ /**
14
+ * 按钮尺寸
15
+ */
16
+ size?: 'small' | 'medium' | 'large';
17
+ /**
18
+ * 是否禁用
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * 自定义弹窗消息
23
+ */
24
+ popupMessage?: string;
25
+ };
26
+
27
+ declare type Emits = {
28
+ /**
29
+ * 点击事件
30
+ */
31
+ (e: 'click', event: MouseEvent): void;
32
+ /**
33
+ * 弹窗显示事件
34
+ */
35
+ (e: 'popup', message: string): void;
36
+ };
37
+
38
+ declare type Expose = {
39
+ /**
40
+ * 显示弹窗
41
+ * @param message 弹窗消息
42
+ */
43
+ popup?: (message: string) => string;
44
+ };
45
+
46
+ declare const MButton: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Emits, string, ButtonProps, Expose>;
4
47
  export default MButton;
@@ -0,0 +1,47 @@
1
+ import { DefineComponent, ComponentOptionsMixin, ComponentPropsOptions, EmitsOptions } from 'vue';
2
+ import { ButtonProps, ButtonEmits, ButtonExpose } from './MButton';
3
+
4
+ declare type Props = {
5
+ /**
6
+ * 按钮颜色
7
+ */
8
+ color?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
9
+ /**
10
+ * 是否为圆角按钮
11
+ */
12
+ round?: boolean;
13
+ /**
14
+ * 按钮尺寸
15
+ */
16
+ size?: 'small' | 'medium' | 'large';
17
+ /**
18
+ * 是否禁用
19
+ */
20
+ disabled?: boolean;
21
+ /**
22
+ * 自定义弹窗消息
23
+ */
24
+ popupMessage?: string;
25
+ };
26
+
27
+ declare type Emits = {
28
+ /**
29
+ * 点击事件
30
+ */
31
+ (e: 'click', event: MouseEvent): void;
32
+ /**
33
+ * 弹窗显示事件
34
+ */
35
+ (e: 'popup', message: string): void;
36
+ };
37
+
38
+ declare type Expose = {
39
+ /**
40
+ * 显示弹窗
41
+ * @param message 弹窗消息
42
+ */
43
+ popup?: (message: string) => string;
44
+ };
45
+
46
+ declare const MButton: DefineComponent<Props, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, Emits, string, ButtonProps, Expose>;
47
+ export default MButton;
@@ -3,3 +3,4 @@ import { default as MButton } from './MButton.vue';
3
3
  export type { ButtonColor, ButtonSize, ButtonProps, ButtonEmits, ButtonExpose } from './MButton.d.ts';
4
4
  export { MButton };
5
5
  export default MButton;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,eAAe,CAAA;AACnC,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,CAAA;AAClB,eAAe,OAAO,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,46 @@
1
1
  export { MButton } from './components/index';
2
2
  export type { ButtonColor, ButtonSize, ButtonProps, ButtonEmits, ButtonExpose } from './components/index';
3
+ export interface MButtonProps {
4
+ /**
5
+ * 按钮颜色
6
+ */
7
+ color?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
8
+ /**
9
+ * 是否为圆角按钮
10
+ */
11
+ round?: boolean;
12
+ /**
13
+ * 按钮尺寸
14
+ */
15
+ size?: 'small' | 'medium' | 'large';
16
+ /**
17
+ * 是否禁用
18
+ */
19
+ disabled?: boolean;
20
+ /**
21
+ * 自定义弹窗消息
22
+ */
23
+ popupMessage?: string;
24
+ }
25
+ export interface MButtonEvents {
26
+ /**
27
+ * 点击事件
28
+ */
29
+ onClick?: (event: MouseEvent) => void;
30
+ /**
31
+ * 弹窗显示事件
32
+ */
33
+ onPopup?: (message: string) => void;
34
+ }
35
+ export interface MButtonExpose {
36
+ /**
37
+ * 显示弹窗
38
+ * @param message 弹窗消息
39
+ */
40
+ popup: (message: string) => string;
41
+ }
3
42
  declare const _default: {
4
43
  MButton: any;
5
44
  };
6
45
  export default _default;
46
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAG5C,YAAY,EACV,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACb,MAAM,oBAAoB,CAAA;AAG3B,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC7D;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAA;CACnC;;;;AAID,wBAA2C"}
@@ -1 +1 @@
1
- .m-btn[data-v-658f9125]{border:none;cursor:pointer;padding:.5em 1.2em;font-size:1em;transition:all .3s;display:inline-block;line-height:1;white-space:nowrap;background:#fff;border:1px solid #dcdfe6;color:#606266;-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:none;margin:0;font-weight:500}.m-btn.round[data-v-658f9125]{border-radius:20px}.m-btn.primary[data-v-658f9125]{background-color:#409eff;border-color:#409eff;color:#fff}.m-btn.success[data-v-658f9125]{background-color:#67c23a;border-color:#67c23a;color:#fff}.m-btn.warning[data-v-658f9125]{background-color:#e6a23c;border-color:#e6a23c;color:#fff}.m-btn.danger[data-v-658f9125]{background-color:#f56c6c;border-color:#f56c6c;color:#fff}.m-btn.info[data-v-658f9125]{background-color:#909399;border-color:#909399;color:#fff}.m-btn.small[data-v-658f9125]{font-size:.8em;padding:.3em .8em}.m-btn.medium[data-v-658f9125]{font-size:1em;padding:.5em 1.2em}.m-btn.large[data-v-658f9125]{font-size:1.2em;padding:.7em 1.6em}.m-btn.disabled[data-v-658f9125]{opacity:.6;cursor:not-allowed;pointer-events:none}.m-btn[data-v-658f9125]:hover:not(.disabled){opacity:.8}
1
+ .m-btn[data-v-51bacf79]{border:none;cursor:pointer;padding:.5em 1.2em;font-size:1em;transition:all .3s;display:inline-block;line-height:1;white-space:nowrap;background:#fff;border:1px solid #dcdfe6;color:#606266;-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:none;margin:0;font-weight:500}.m-btn.round[data-v-51bacf79]{border-radius:20px}.m-btn.primary[data-v-51bacf79]{background-color:#409eff;border-color:#409eff;color:#fff}.m-btn.success[data-v-51bacf79]{background-color:#67c23a;border-color:#67c23a;color:#fff}.m-btn.warning[data-v-51bacf79]{background-color:#e6a23c;border-color:#e6a23c;color:#fff}.m-btn.danger[data-v-51bacf79]{background-color:#f56c6c;border-color:#f56c6c;color:#fff}.m-btn.info[data-v-51bacf79]{background-color:#909399;border-color:#909399;color:#fff}.m-btn.small[data-v-51bacf79]{font-size:.8em;padding:.3em .8em}.m-btn.medium[data-v-51bacf79]{font-size:1em;padding:.5em 1.2em}.m-btn.large[data-v-51bacf79]{font-size:1.2em;padding:.7em 1.6em}.m-btn.disabled[data-v-51bacf79]{opacity:.6;cursor:not-allowed;pointer-events:none}.m-btn[data-v-51bacf79]:hover:not(.disabled){opacity:.8}
@@ -41,27 +41,27 @@ const c = r({
41
41
  }
42
42
  },
43
43
  emits: ["click", "popup"],
44
- setup(e, { emit: n, expose: l }) {
44
+ setup(e, { emit: n, expose: a }) {
45
45
  function o(t) {
46
46
  return window.alert(t), n("popup", t), t;
47
47
  }
48
- function a(t) {
48
+ function l(t) {
49
49
  e.disabled || (n("click", t), o(e.popupMessage));
50
50
  }
51
- return l({
51
+ return a({
52
52
  popup: o
53
53
  }), {
54
54
  popup: o,
55
- handleClick: a
55
+ handleClick: l
56
56
  };
57
57
  }
58
58
  }), f = (e, n) => {
59
- const l = e.__vccOpts || e;
60
- for (const [o, a] of n)
61
- l[o] = a;
62
- return l;
59
+ const a = e.__vccOpts || e;
60
+ for (const [o, l] of n)
61
+ a[o] = l;
62
+ return a;
63
63
  }, m = ["disabled"];
64
- function b(e, n, l, o, a, t) {
64
+ function b(e, n, a, o, l, t) {
65
65
  return i(), s("button", {
66
66
  class: u([
67
67
  "m-btn",
@@ -78,7 +78,7 @@ function b(e, n, l, o, a, t) {
78
78
  p(e.$slots, "default", {}, void 0, !0)
79
79
  ], 10, m);
80
80
  }
81
- const k = /* @__PURE__ */ f(c, [["render", b], ["__scopeId", "data-v-658f9125"]]), B = { MButton: k };
81
+ const k = /* @__PURE__ */ f(c, [["render", b], ["__scopeId", "data-v-51bacf79"]]), B = { MButton: k };
82
82
  export {
83
83
  k as MButton,
84
84
  B as default
@@ -1 +1 @@
1
- (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.Morghulis={},t.Vue))})(this,function(t,n){"use strict";const r=n.defineComponent({name:"MButton",props:{color:{type:String,default:"primary",validator:e=>["primary","success","warning","danger","info"].includes(e)},round:{type:Boolean,default:!1},size:{type:String,default:"medium",validator:e=>["small","medium","large"].includes(e)},disabled:{type:Boolean,default:!1},popupMessage:{type:String,default:"按钮被点击!"}},emits:["click","popup"],setup(e,{emit:o,expose:l}){function d(i){return window.alert(i),o("popup",i),i}function s(i){e.disabled||(o("click",i),d(e.popupMessage))}return l({popup:d}),{popup:d,handleClick:s}}}),a=(e,o)=>{const l=e.__vccOpts||e;for(const[d,s]of o)l[d]=s;return l},p=["disabled"];function f(e,o,l,d,s,i){return n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(["m-btn",e.size,e.color,{round:e.round,disabled:e.disabled}]),disabled:e.disabled,onClick:o[0]||(o[0]=(...m)=>e.handleClick&&e.handleClick(...m))},[n.renderSlot(e.$slots,"default",{},void 0,!0)],10,p)}const u=a(r,[["render",f],["__scopeId","data-v-658f9125"]]),c={MButton:u};t.MButton=u,t.default=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.Morghulis={},t.Vue))})(this,function(t,n){"use strict";const r=n.defineComponent({name:"MButton",props:{color:{type:String,default:"primary",validator:e=>["primary","success","warning","danger","info"].includes(e)},round:{type:Boolean,default:!1},size:{type:String,default:"medium",validator:e=>["small","medium","large"].includes(e)},disabled:{type:Boolean,default:!1},popupMessage:{type:String,default:"按钮被点击!"}},emits:["click","popup"],setup(e,{emit:o,expose:l}){function d(i){return window.alert(i),o("popup",i),i}function s(i){e.disabled||(o("click",i),d(e.popupMessage))}return l({popup:d}),{popup:d,handleClick:s}}}),a=(e,o)=>{const l=e.__vccOpts||e;for(const[d,s]of o)l[d]=s;return l},p=["disabled"];function f(e,o,l,d,s,i){return n.openBlock(),n.createElementBlock("button",{class:n.normalizeClass(["m-btn",e.size,e.color,{round:e.round,disabled:e.disabled}]),disabled:e.disabled,onClick:o[0]||(o[0]=(...m)=>e.handleClick&&e.handleClick(...m))},[n.renderSlot(e.$slots,"default",{},void 0,!0)],10,p)}const u=a(r,[["render",f],["__scopeId","data-v-51bacf79"]]),c={MButton:u};t.MButton=u,t.default=c,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,125 @@
1
+ {
2
+ "version": 1,
3
+ "components": [
4
+ {
5
+ "name": "MButton",
6
+ "type": "component",
7
+ "description": "一个简单的按钮组件,具有多种颜色主题、尺寸选项和弹窗功能",
8
+ "props": [
9
+ {
10
+ "name": "color",
11
+ "type": "string",
12
+ "description": "按钮颜色",
13
+ "defaultValue": "primary",
14
+ "values": [
15
+ {
16
+ "name": "primary",
17
+ "description": "主要按钮"
18
+ },
19
+ {
20
+ "name": "success",
21
+ "description": "成功按钮"
22
+ },
23
+ {
24
+ "name": "warning",
25
+ "description": "警告按钮"
26
+ },
27
+ {
28
+ "name": "danger",
29
+ "description": "危险按钮"
30
+ },
31
+ {
32
+ "name": "info",
33
+ "description": "信息按钮"
34
+ }
35
+ ]
36
+ },
37
+ {
38
+ "name": "round",
39
+ "type": "boolean",
40
+ "description": "是否为圆角按钮",
41
+ "defaultValue": false
42
+ },
43
+ {
44
+ "name": "size",
45
+ "type": "string",
46
+ "description": "按钮尺寸",
47
+ "defaultValue": "medium",
48
+ "values": [
49
+ {
50
+ "name": "small",
51
+ "description": "小型按钮"
52
+ },
53
+ {
54
+ "name": "medium",
55
+ "description": "中型按钮"
56
+ },
57
+ {
58
+ "name": "large",
59
+ "description": "大型按钮"
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "name": "disabled",
65
+ "type": "boolean",
66
+ "description": "是否禁用",
67
+ "defaultValue": false
68
+ },
69
+ {
70
+ "name": "popupMessage",
71
+ "type": "string",
72
+ "description": "自定义弹窗消息",
73
+ "defaultValue": "按钮被点击!"
74
+ }
75
+ ],
76
+ "events": [
77
+ {
78
+ "name": "click",
79
+ "description": "按钮点击事件",
80
+ "arguments": [
81
+ {
82
+ "name": "event",
83
+ "type": "MouseEvent",
84
+ "description": "鼠标事件对象"
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "name": "popup",
90
+ "description": "弹窗显示事件",
91
+ "arguments": [
92
+ {
93
+ "name": "message",
94
+ "type": "string",
95
+ "description": "弹窗消息"
96
+ }
97
+ ]
98
+ }
99
+ ],
100
+ "slots": [
101
+ {
102
+ "name": "default",
103
+ "description": "按钮内容"
104
+ }
105
+ ],
106
+ "methods": [
107
+ {
108
+ "name": "popup",
109
+ "description": "显示弹窗",
110
+ "arguments": [
111
+ {
112
+ "name": "message",
113
+ "type": "string",
114
+ "description": "弹窗消息"
115
+ }
116
+ ],
117
+ "returns": {
118
+ "type": "string",
119
+ "description": "弹窗消息"
120
+ }
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
package/morghulis.d.ts ADDED
@@ -0,0 +1,132 @@
1
+ import { DefineComponent } from 'vue'
2
+
3
+ // 导出类型定义
4
+ declare module 'morghulis' {
5
+ export type ButtonColor = 'primary' | 'success' | 'warning' | 'danger' | 'info';
6
+ export type ButtonSize = 'small' | 'medium' | 'large';
7
+
8
+ // 按钮属性
9
+ export interface ButtonProps {
10
+ /**
11
+ * 按钮颜色
12
+ * @values 'primary', 'success', 'warning', 'danger', 'info'
13
+ */
14
+ color?: ButtonColor;
15
+
16
+ /**
17
+ * 是否为圆角按钮
18
+ */
19
+ round?: boolean;
20
+
21
+ /**
22
+ * 按钮尺寸
23
+ * @values 'small', 'medium', 'large'
24
+ */
25
+ size?: ButtonSize;
26
+
27
+ /**
28
+ * 是否禁用
29
+ */
30
+ disabled?: boolean;
31
+
32
+ /**
33
+ * 自定义弹窗消息
34
+ */
35
+ popupMessage?: string;
36
+ }
37
+
38
+ // 组件事件
39
+ export interface ButtonEmits {
40
+ /**
41
+ * 点击事件
42
+ * @param event - 鼠标事件对象
43
+ */
44
+ (e: 'click', event: MouseEvent): void;
45
+
46
+ /**
47
+ * 弹窗显示事件
48
+ * @param message - 弹窗消息
49
+ */
50
+ (e: 'popup', message: string): void;
51
+ }
52
+
53
+ // 组件暴露的方法
54
+ export interface ButtonExpose {
55
+ /**
56
+ * 显示弹窗
57
+ * @param message - 弹窗消息
58
+ * @returns 弹窗消息
59
+ */
60
+ popup?: (message: string) => string;
61
+ }
62
+
63
+ // 组件定义
64
+ /**
65
+ * 按钮组件
66
+ *
67
+ * @description 一个简单的按钮组件,具有多种颜色主题、尺寸选项和弹窗功能
68
+ * @example
69
+ * <MButton>默认按钮</MButton>
70
+ * <MButton color="success" round>成功按钮</MButton>
71
+ * <MButton color="warning" size="large">警告按钮</MButton>
72
+ * <MButton color="danger" disabled>危险按钮</MButton>
73
+ * <MButton popup-message="自定义消息">弹窗按钮</MButton>
74
+ */
75
+ export const MButton: DefineComponent<ButtonProps>;
76
+ }
77
+
78
+ // 增强全局类型定义,用于支持JSX
79
+ declare global {
80
+ namespace JSX {
81
+ interface IntrinsicElements {
82
+ /**
83
+ * 按钮组件
84
+ */
85
+ MButton: {
86
+ /**
87
+ * 按钮颜色
88
+ * @values 'primary', 'success', 'warning', 'danger', 'info'
89
+ */
90
+ color?: 'primary' | 'success' | 'warning' | 'danger' | 'info';
91
+
92
+ /**
93
+ * 是否为圆角按钮
94
+ */
95
+ round?: boolean;
96
+
97
+ /**
98
+ * 按钮尺寸
99
+ * @values 'small', 'medium', 'large'
100
+ */
101
+ size?: 'small' | 'medium' | 'large';
102
+
103
+ /**
104
+ * 是否禁用
105
+ */
106
+ disabled?: boolean;
107
+
108
+ /**
109
+ * 自定义弹窗消息
110
+ */
111
+ popupMessage?: string;
112
+
113
+ /**
114
+ * 点击事件
115
+ */
116
+ onClick?: (event: MouseEvent) => void;
117
+
118
+ /**
119
+ * 弹窗事件
120
+ */
121
+ onPopup?: (message: string) => void;
122
+
123
+ /**
124
+ * 子元素/插槽内容
125
+ */
126
+ children?: any;
127
+ }
128
+ }
129
+ }
130
+ }
131
+
132
+ export {};
package/package.json CHANGED
@@ -1,14 +1,26 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.62",
3
+ "version": "2.0.64",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/morghulis.umd.js",
7
7
  "module": "dist/morghulis.es.js",
8
- "types": "dist/index.d.ts",
8
+ "types": "types/index.d.ts",
9
9
  "style": "dist/morghulis.css",
10
+ "typings": "types/index.d.ts",
11
+ "web-types": "web-types.json",
12
+ "vetur": {
13
+ "tags": "vetur/tags.json",
14
+ "attributes": "vetur/attributes.json"
15
+ },
16
+ "intellisense": "intellisense.json",
10
17
  "files": [
11
- "dist"
18
+ "dist",
19
+ "web-types.json",
20
+ "vetur",
21
+ "morghulis.d.ts",
22
+ "intellisense.json",
23
+ "types"
12
24
  ],
13
25
  "scripts": {
14
26
  "dev": "vite",
@@ -0,0 +1,114 @@
1
+ import { DefineComponent, VNode, AllowedComponentProps, ComponentCustomProps } from 'vue'
2
+
3
+ /**
4
+ * 按钮颜色类型
5
+ * @public
6
+ */
7
+ export type ButtonColor =
8
+ /** 主要按钮 */
9
+ 'primary' |
10
+ /** 成功按钮 */
11
+ 'success' |
12
+ /** 警告按钮 */
13
+ 'warning' |
14
+ /** 危险按钮 */
15
+ 'danger' |
16
+ /** 信息按钮 */
17
+ 'info';
18
+
19
+ /**
20
+ * 按钮尺寸类型
21
+ * @public
22
+ */
23
+ export type ButtonSize =
24
+ /** 小型按钮 */
25
+ 'small' |
26
+ /** 中型按钮 */
27
+ 'medium' |
28
+ /** 大型按钮 */
29
+ 'large';
30
+
31
+ /**
32
+ * 按钮属性
33
+ * @public
34
+ */
35
+ export interface ButtonProps {
36
+ /**
37
+ * 按钮颜色
38
+ * @default 'primary'
39
+ */
40
+ color?: ButtonColor;
41
+
42
+ /**
43
+ * 是否为圆角按钮
44
+ * @default false
45
+ */
46
+ round?: boolean;
47
+
48
+ /**
49
+ * 按钮尺寸
50
+ * @default 'medium'
51
+ */
52
+ size?: ButtonSize;
53
+
54
+ /**
55
+ * 是否禁用
56
+ * @default false
57
+ */
58
+ disabled?: boolean;
59
+
60
+ /**
61
+ * 自定义弹窗消息
62
+ * @default '按钮被点击!'
63
+ */
64
+ popupMessage?: string;
65
+ }
66
+
67
+ /**
68
+ * 按钮暴露的方法
69
+ * @public
70
+ */
71
+ export interface ButtonExpose {
72
+ /**
73
+ * 显示弹窗
74
+ * @param message - 弹窗消息
75
+ * @returns 弹窗消息
76
+ */
77
+ popup(message: string): string;
78
+ }
79
+
80
+ /**
81
+ * 按钮事件
82
+ * @public
83
+ */
84
+ export interface ButtonEvents {
85
+ /**
86
+ * 点击事件
87
+ * @param e - 鼠标事件对象
88
+ */
89
+ onClick?: (e: MouseEvent) => void;
90
+
91
+ /**
92
+ * 弹窗事件
93
+ * @param message - 弹窗消息
94
+ */
95
+ onPopup?: (message: string) => void;
96
+ }
97
+
98
+ /**
99
+ * 按钮组件
100
+ *
101
+ * @description 一个简单的按钮组件,具有多种颜色主题、尺寸选项和弹窗功能
102
+ * @example
103
+ * ```vue
104
+ * <MButton>默认按钮</MButton>
105
+ * <MButton color="success" round>成功按钮</MButton>
106
+ * <MButton color="warning" size="large">警告按钮</MButton>
107
+ * <MButton color="danger" disabled>危险按钮</MButton>
108
+ * <MButton popup-message="自定义消息">弹窗按钮</MButton>
109
+ * ```
110
+ *
111
+ * @see [文档](https://github.com/morghulis/morghulis)
112
+ * @public
113
+ */
114
+ export declare const MButton: DefineComponent<ButtonProps>;
@@ -0,0 +1,5 @@
1
+ export * from './MButton';
2
+
3
+ // 导出组件集合
4
+ import { MButton } from './MButton';
5
+ export { MButton };
@@ -0,0 +1,36 @@
1
+ {
2
+ "m-button/color": {
3
+ "type": "string",
4
+ "description": "按钮颜色,可选值为 'primary', 'success', 'warning', 'danger', 'info'",
5
+ "options": ["primary", "success", "warning", "danger", "info"],
6
+ "optionDescriptions": {
7
+ "primary": "主要按钮",
8
+ "success": "成功按钮",
9
+ "warning": "警告按钮",
10
+ "danger": "危险按钮",
11
+ "info": "信息按钮"
12
+ }
13
+ },
14
+ "m-button/round": {
15
+ "type": "boolean",
16
+ "description": "是否为圆角按钮"
17
+ },
18
+ "m-button/size": {
19
+ "type": "string",
20
+ "description": "按钮尺寸,可选值为 'small', 'medium', 'large'",
21
+ "options": ["small", "medium", "large"],
22
+ "optionDescriptions": {
23
+ "small": "小型按钮",
24
+ "medium": "中型按钮",
25
+ "large": "大型按钮"
26
+ }
27
+ },
28
+ "m-button/disabled": {
29
+ "type": "boolean",
30
+ "description": "是否禁用"
31
+ },
32
+ "m-button/popup-message": {
33
+ "type": "string",
34
+ "description": "自定义弹窗消息"
35
+ }
36
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "m-button": {
3
+ "attributes": ["color", "round", "size", "disabled", "popup-message"],
4
+ "description": "一个简单的按钮组件,具有多种颜色主题、尺寸选项和弹窗功能"
5
+ }
6
+ }
package/web-types.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/web-types",
3
+ "framework": "vue",
4
+ "version": "2.0.0",
5
+ "name": "morghulis",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "MButton",
11
+ "description": "一个简单的按钮组件,具有多种颜色主题、尺寸选项和弹窗功能",
12
+ "doc-url": "https://github.com/morghulis/morghulis",
13
+ "attributes": [
14
+ {
15
+ "name": "color",
16
+ "description": "按钮颜色",
17
+ "value": {
18
+ "kind": "expression",
19
+ "type": "string"
20
+ },
21
+ "default": "primary",
22
+ "values": [
23
+ {
24
+ "name": "primary",
25
+ "description": "主要按钮"
26
+ },
27
+ {
28
+ "name": "success",
29
+ "description": "成功按钮"
30
+ },
31
+ {
32
+ "name": "warning",
33
+ "description": "警告按钮"
34
+ },
35
+ {
36
+ "name": "danger",
37
+ "description": "危险按钮"
38
+ },
39
+ {
40
+ "name": "info",
41
+ "description": "信息按钮"
42
+ }
43
+ ]
44
+ },
45
+ {
46
+ "name": "round",
47
+ "description": "是否为圆角按钮",
48
+ "value": {
49
+ "kind": "expression",
50
+ "type": "boolean"
51
+ },
52
+ "default": "false"
53
+ },
54
+ {
55
+ "name": "size",
56
+ "description": "按钮尺寸",
57
+ "value": {
58
+ "kind": "expression",
59
+ "type": "string"
60
+ },
61
+ "default": "medium",
62
+ "values": [
63
+ {
64
+ "name": "small",
65
+ "description": "小型按钮"
66
+ },
67
+ {
68
+ "name": "medium",
69
+ "description": "中型按钮"
70
+ },
71
+ {
72
+ "name": "large",
73
+ "description": "大型按钮"
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "name": "disabled",
79
+ "description": "是否禁用",
80
+ "value": {
81
+ "kind": "expression",
82
+ "type": "boolean"
83
+ },
84
+ "default": "false"
85
+ },
86
+ {
87
+ "name": "popup-message",
88
+ "description": "自定义弹窗消息",
89
+ "value": {
90
+ "kind": "expression",
91
+ "type": "string"
92
+ },
93
+ "default": "按钮被点击!"
94
+ }
95
+ ],
96
+ "events": [
97
+ {
98
+ "name": "click",
99
+ "description": "按钮点击事件"
100
+ },
101
+ {
102
+ "name": "popup",
103
+ "description": "弹窗显示事件,参数为弹窗消息"
104
+ }
105
+ ],
106
+ "slots": [
107
+ {
108
+ "name": "default",
109
+ "description": "按钮内容"
110
+ }
111
+ ],
112
+ "js": {
113
+ "properties": [
114
+ {
115
+ "name": "popup",
116
+ "description": "显示弹窗,参数为弹窗消息"
117
+ }
118
+ ]
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ }