morghulis 2.0.48 → 2.0.49

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 +1 @@
1
- .m-button[data-v-1d04af69]{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:#606266;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;-webkit-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:#fff;border:1px solid #dcdfe6;padding:8px 15px;font-size:14px;border-radius:4px}.m-button[data-v-1d04af69]:hover{color:#409eff;border-color:#c6e2ff;background-color:#ecf5ff}.m-button[data-v-1d04af69]:active{color:#3a8ee6;border-color:#3a8ee6;outline:none}.m-button--primary[data-v-1d04af69]{color:#fff;background-color:#409eff;border-color:#409eff}.m-button--primary[data-v-1d04af69]:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}.m-button--primary[data-v-1d04af69]:active{background:#3a8ee6;border-color:#3a8ee6;color:#fff}.m-button--success[data-v-1d04af69]{color:#fff;background-color:#67c23a;border-color:#67c23a}.m-button--success[data-v-1d04af69]:hover{background:#85ce61;border-color:#85ce61;color:#fff}.m-button--success[data-v-1d04af69]:active{background:#5daf34;border-color:#5daf34;color:#fff}.m-button--warning[data-v-1d04af69]{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.m-button--warning[data-v-1d04af69]:hover{background:#ebb563;border-color:#ebb563;color:#fff}.m-button--warning[data-v-1d04af69]:active{background:#cf9236;border-color:#cf9236;color:#fff}.m-button--danger[data-v-1d04af69]{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.m-button--danger[data-v-1d04af69]:hover{background:#f78989;border-color:#f78989;color:#fff}.m-button--danger[data-v-1d04af69]:active{background:#dd6161;border-color:#dd6161;color:#fff}.m-button--info[data-v-1d04af69]{color:#fff;background-color:#909399;border-color:#909399}.m-button--info[data-v-1d04af69]:hover{background:#a6a9ad;border-color:#a6a9ad;color:#fff}.m-button--info[data-v-1d04af69]:active{background:#82848a;border-color:#82848a;color:#fff}.m-button--small[data-v-1d04af69]{height:24px;padding:5px 11px;font-size:12px;border-radius:3px}.m-button--large[data-v-1d04af69]{height:40px;padding:12px 19px;font-size:16px;border-radius:4px}.m-button--round[data-v-1d04af69]{border-radius:20px}.m-button--plain[data-v-1d04af69]{background:transparent}.m-button--plain.m-button--primary[data-v-1d04af69]{color:#409eff}.m-button--plain.m-button--success[data-v-1d04af69]{color:#67c23a}.m-button--plain.m-button--warning[data-v-1d04af69]{color:#e6a23c}.m-button--plain.m-button--danger[data-v-1d04af69]{color:#f56c6c}.m-button--plain.m-button--info[data-v-1d04af69]{color:#909399}.m-button--disabled[data-v-1d04af69],.m-button--disabled[data-v-1d04af69]:hover,.m-button--disabled[data-v-1d04af69]:focus,.m-button--disabled[data-v-1d04af69]:active{color:#c0c4cc;cursor:not-allowed;background-image:none;background-color:#fff;border-color:#ebeef5}.m-button--disabled.m-button--primary[data-v-1d04af69],.m-button--disabled.m-button--success[data-v-1d04af69],.m-button--disabled.m-button--warning[data-v-1d04af69],.m-button--disabled.m-button--danger[data-v-1d04af69],.m-button--disabled.m-button--info[data-v-1d04af69]{color:#fff;background-color:#a0cfff;border-color:#a0cfff;opacity:.6}.m-button__loading[data-v-1d04af69]{display:inline-flex;align-items:center;margin-right:5px}.m-button__loading-icon[data-v-1d04af69]{animation:rotating-1d04af69 2s linear infinite}.m-button__icon[data-v-1d04af69]{margin-right:5px}.m-button__icon+.m-button__text[data-v-1d04af69]{margin-left:5px}@keyframes rotating-1d04af69{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
1
+ .m-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:#606266;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;-webkit-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:#fff;border:1px solid #dcdfe6;padding:8px 15px;font-size:14px;border-radius:4px}.m-button:hover{color:#409eff;border-color:#c6e2ff;background-color:#ecf5ff}.m-button:active{color:#3a8ee6;border-color:#3a8ee6;outline:none}.m-button--primary{color:#fff;background-color:#409eff;border-color:#409eff}.m-button--primary:hover{background:#66b1ff;border-color:#66b1ff;color:#fff}.m-button--primary:active{background:#3a8ee6;border-color:#3a8ee6;color:#fff}.m-button--success{color:#fff;background-color:#67c23a;border-color:#67c23a}.m-button--success:hover{background:#85ce61;border-color:#85ce61;color:#fff}.m-button--success:active{background:#5daf34;border-color:#5daf34;color:#fff}.m-button--warning{color:#fff;background-color:#e6a23c;border-color:#e6a23c}.m-button--warning:hover{background:#ebb563;border-color:#ebb563;color:#fff}.m-button--warning:active{background:#cf9236;border-color:#cf9236;color:#fff}.m-button--danger{color:#fff;background-color:#f56c6c;border-color:#f56c6c}.m-button--danger:hover{background:#f78989;border-color:#f78989;color:#fff}.m-button--danger:active{background:#dd6161;border-color:#dd6161;color:#fff}.m-button--info{color:#fff;background-color:#909399;border-color:#909399}.m-button--info:hover{background:#a6a9ad;border-color:#a6a9ad;color:#fff}.m-button--info:active{background:#82848a;border-color:#82848a;color:#fff}.m-button--small{height:24px;padding:5px 11px;font-size:12px;border-radius:3px}.m-button--large{height:40px;padding:12px 19px;font-size:16px;border-radius:4px}.m-button--round{border-radius:20px}.m-button--circle{border-radius:50%;padding:8px}.m-button--plain{background:transparent}.m-button--plain.m-button--primary{color:#409eff}.m-button--plain.m-button--success{color:#67c23a}.m-button--plain.m-button--warning{color:#e6a23c}.m-button--plain.m-button--danger{color:#f56c6c}.m-button--plain.m-button--info{color:#909399}.m-button--disabled,.m-button--disabled:hover,.m-button--disabled:focus,.m-button--disabled:active{color:#c0c4cc;cursor:not-allowed;background-image:none;background-color:#fff;border-color:#ebeef5}.m-button--disabled.m-button--primary,.m-button--disabled.m-button--success,.m-button--disabled.m-button--warning,.m-button--disabled.m-button--danger,.m-button--disabled.m-button--info{color:#fff;background-color:#a0cfff;border-color:#a0cfff;opacity:.6}.m-button__loading{display:inline-flex;align-items:center;margin-right:5px}.m-button__loading-icon{animation:rotating 2s linear infinite}.m-button__icon{margin-right:5px}.m-button__icon+.m-button__text{margin-left:5px}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
@@ -1,158 +1,126 @@
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
- const y = m({
3
- name: "MButton",
4
- props: {
5
- /**
6
- * 按钮类型
7
- * @values default, primary, success, warning, danger, info
8
- */
9
- type: {
10
- type: String,
11
- default: "default"
12
- },
13
- /**
14
- * 按钮尺寸
15
- * @values small, medium, large
16
- */
17
- size: {
18
- type: String,
19
- default: "medium"
20
- },
21
- /**
22
- * 是否为圆角按钮
23
- */
24
- round: {
25
- type: Boolean,
26
- default: !1
27
- },
28
- /**
29
- * 是否为朴素按钮
30
- */
31
- plain: {
32
- type: Boolean,
33
- default: !1
34
- },
35
- /**
36
- * 是否禁用按钮
37
- */
38
- disabled: {
39
- type: Boolean,
40
- default: !1
41
- },
42
- /**
43
- * 按钮文本
44
- */
45
- text: {
46
- type: String,
47
- default: void 0
48
- },
49
- /**
50
- * 是否显示加载状态
51
- */
52
- loading: {
53
- type: Boolean,
54
- default: !1
55
- },
56
- /**
57
- * 按钮图标类名
58
- */
59
- icon: {
60
- type: String,
61
- default: void 0
62
- }
1
+ import { defineComponent as u, computed as c, createVNode as n } from "vue";
2
+ const s = {
3
+ /**
4
+ * 按钮类型
5
+ * @values default, primary, success, warning, danger, info, text
6
+ */
7
+ type: {
8
+ type: String,
9
+ default: "default"
10
+ },
11
+ /**
12
+ * 按钮尺寸
13
+ * @values large, default, small
14
+ */
15
+ size: {
16
+ type: String,
17
+ default: "default"
18
+ },
19
+ /**
20
+ * 是否为朴素按钮
21
+ */
22
+ plain: {
23
+ type: Boolean,
24
+ default: !1
25
+ },
26
+ /**
27
+ * 是否为圆角按钮
28
+ */
29
+ round: {
30
+ type: Boolean,
31
+ default: !1
32
+ },
33
+ /**
34
+ * 是否为圆形按钮
35
+ */
36
+ circle: {
37
+ type: Boolean,
38
+ default: !1
63
39
  },
40
+ /**
41
+ * 是否禁用按钮
42
+ */
43
+ disabled: {
44
+ type: Boolean,
45
+ default: !1
46
+ },
47
+ /**
48
+ * 是否显示加载状态
49
+ */
50
+ loading: {
51
+ type: Boolean,
52
+ default: !1
53
+ },
54
+ /**
55
+ * 按钮图标类名
56
+ */
57
+ icon: {
58
+ type: String,
59
+ default: ""
60
+ },
61
+ /**
62
+ * 按钮文本
63
+ */
64
+ text: {
65
+ type: String,
66
+ default: ""
67
+ }
68
+ }, a = /* @__PURE__ */ u({
69
+ name: "MButton",
70
+ props: s,
64
71
  emits: ["click"],
65
- setup(t, { emit: e, expose: n }) {
66
- const o = b(() => [
67
- "m-button",
68
- `m-button--${t.type}`,
69
- `m-button--${t.size}`,
70
- {
71
- "m-button--round": t.round,
72
- "m-button--plain": t.plain,
73
- "m-button--disabled": t.disabled,
74
- "m-button--loading": t.loading
75
- }
76
- ]), l = (c) => {
77
- t.disabled || t.loading || e("click", c);
78
- };
79
- return n({
80
- /**
81
- * 触发按钮点击事件
82
- */
83
- triggerClick: () => {
84
- !t.disabled && !t.loading && e("click", new MouseEvent("click"));
85
- }
86
- }), {
87
- buttonClass: o,
88
- handleClick: l
72
+ setup(t, {
73
+ slots: l,
74
+ emit: o
75
+ }) {
76
+ const i = c(() => ["m-button", `m-button--${t.type}`, `m-button--${t.size}`, {
77
+ "m-button--round": t.round,
78
+ "m-button--plain": t.plain,
79
+ "m-button--circle": t.circle,
80
+ "m-button--disabled": t.disabled,
81
+ "m-button--loading": t.loading
82
+ }]), d = (e) => {
83
+ t.disabled || t.loading || o("click", e);
89
84
  };
90
- }
91
- }), _ = (t, e) => {
92
- const n = t.__vccOpts || t;
93
- for (const [o, l] of e)
94
- n[o] = l;
95
- return n;
96
- }, B = ["disabled"], C = {
97
- key: 0,
98
- class: "m-button__loading"
99
- }, h = {
100
- key: 1,
101
- class: "m-button__icon"
102
- }, v = {
103
- key: 2,
104
- class: "m-button__text"
105
- };
106
- function $(t, e, n, o, l, c) {
107
- return s(), a("button", {
108
- class: r(t.buttonClass),
109
- disabled: t.disabled,
110
- onClick: e[0] || (e[0] = (...f) => t.handleClick && t.handleClick(...f))
111
- }, [
112
- t.loading ? (s(), a("span", C, e[1] || (e[1] = [
113
- i("svg", {
85
+ return () => {
86
+ var e;
87
+ return n("button", {
88
+ class: i.value,
89
+ disabled: t.disabled,
90
+ onClick: d
91
+ }, [t.loading && n("span", {
92
+ class: "m-button__loading"
93
+ }, [n("svg", {
114
94
  class: "m-button__loading-icon",
115
95
  viewBox: "0 0 1024 1024",
116
96
  xmlns: "http://www.w3.org/2000/svg",
117
97
  width: "16",
118
98
  height: "16"
119
- }, [
120
- i("path", {
121
- d: "M512 64c-247.42 0-448 200.58-448 448s200.58 448 448 448 448-200.58 448-448-200.58-448-448-448zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z",
122
- fill: "#e6e6e6"
123
- }),
124
- i("path", {
125
- d: "M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372V140z",
126
- fill: "currentColor"
127
- })
128
- ], -1)
129
- ]))) : u("", !0),
130
- t.icon && !t.loading ? (s(), a("span", h, [
131
- i("i", {
132
- class: r(t.icon)
133
- }, null, 2)
134
- ])) : u("", !0),
135
- t.$slots.default || t.text ? (s(), a("span", v, [
136
- g(t.$slots, "default", {}, () => [
137
- p(k(t.text), 1)
138
- ], !0)
139
- ])) : u("", !0)
140
- ], 10, B);
141
- }
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) => {
149
- w(t);
150
- }, S = {
151
- install: M,
152
- MButton: d
99
+ }, [n("path", {
100
+ d: "M512 64c-247.42 0-448 200.58-448 448s200.58 448 448 448 448-200.58 448-448-200.58-448-448-448zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z",
101
+ fill: "#e6e6e6"
102
+ }, null), n("path", {
103
+ d: "M512 140c-205.4 0-372 166.6-372 372s166.6 372 372 372V140z",
104
+ fill: "currentColor"
105
+ }, null)])]), t.icon && !t.loading && n("span", {
106
+ class: "m-button__icon"
107
+ }, [n("i", {
108
+ class: t.icon
109
+ }, null)]), n("span", {
110
+ class: "m-button__text"
111
+ }, [((e = l.default) == null ? void 0 : e.call(l)) || t.text])]);
112
+ };
113
+ }
114
+ }), f = (t) => {
115
+ t.component("MButton", a);
116
+ }, b = (t) => {
117
+ f(t);
118
+ }, g = {
119
+ install: b,
120
+ MButton: a
153
121
  };
154
122
  export {
155
- d as MButton,
156
- S as default,
157
- M as install
123
+ a as MButton,
124
+ g as default,
125
+ b as install
158
126
  };
package/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import type { App, Component } from 'vue';
1
+ import type { DefineComponent, PropType } from 'vue';
2
2
 
3
3
  // 按钮类型
4
- export declare type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
4
+ export type ButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
5
5
 
6
6
  // 按钮尺寸
7
- export declare type ButtonSize = 'large' | 'default' | 'small';
7
+ export type ButtonSize = 'large' | 'default' | 'small';
8
8
 
9
- // 按钮属性
10
- export interface ButtonProps {
9
+ // 按钮属性类型
10
+ export interface MButtonProps {
11
11
  /**
12
12
  * 按钮类型
13
13
  * @default 'default'
@@ -54,34 +54,18 @@ export interface ButtonProps {
54
54
  * 按钮图标类名
55
55
  */
56
56
  icon?: string;
57
- }
58
-
59
- // 按钮事件
60
- export interface ButtonEvents {
61
- /**
62
- * 点击按钮时触发
63
- * @param event 鼠标事件对象
64
- */
65
- click: (event: MouseEvent) => void;
66
- }
67
-
68
- // 按钮实例
69
- export interface ButtonInstance {
70
- $props: ButtonProps;
71
57
 
72
58
  /**
73
- * 触发按钮点击事件
59
+ * 按钮文本
74
60
  */
75
- triggerClick: () => void;
61
+ text?: string;
76
62
  }
77
63
 
78
- // MButton组件
79
- export declare const MButton: Component & {
80
- install(app: App): void;
81
- };
64
+ // 按钮组件
65
+ export declare const MButton: DefineComponent<MButtonProps>;
82
66
 
83
- // 全局安装函数
84
- export declare function install(app: App): void;
67
+ // 安装函数
68
+ export declare function install(app: any): void;
85
69
 
86
70
  // 默认导出
87
71
  declare const _default: {
@@ -91,9 +75,9 @@ declare const _default: {
91
75
 
92
76
  export default _default;
93
77
 
94
- // 为全局组件扩展类型
95
- declare module '@vue/runtime-core' {
96
- export interface GlobalComponents {
78
+ // 自定义Vue类型扩展
79
+ declare module 'vue' {
80
+ interface GlobalComponents {
97
81
  MButton: typeof MButton;
98
82
  }
99
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.48",
3
+ "version": "2.0.49",
4
4
  "description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
5
5
  "type": "module",
6
6
  "main": "dist/morghulis.es.js",
@@ -8,7 +8,12 @@
8
8
  "types": "index.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
- "types": ["./index.d.ts", "./global.d.ts", "./volar.d.ts", "./components.d.ts"],
11
+ "types": [
12
+ "./index.d.ts",
13
+ "./global.d.ts",
14
+ "./volar.d.ts",
15
+ "./components.d.ts"
16
+ ],
12
17
  "import": "./dist/morghulis.es.js",
13
18
  "require": "./dist/morghulis.es.js"
14
19
  },
@@ -41,12 +46,13 @@
41
46
  "author": "",
42
47
  "license": "MIT",
43
48
  "dependencies": {
44
- "vue": "^3.5.13"
49
+ "vue": "^3.0.0"
45
50
  },
46
51
  "devDependencies": {
47
52
  "@tsconfig/node22": "^22.0.1",
48
53
  "@types/node": "^22.14.0",
49
54
  "@vitejs/plugin-vue": "^5.2.3",
55
+ "@vitejs/plugin-vue-jsx": "^4.1.2",
50
56
  "@vue/tsconfig": "^0.7.0",
51
57
  "npm-run-all2": "^7.0.2",
52
58
  "typescript": "~5.8.0",