morghulis 2.0.57 → 2.0.59

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # button
1
+ # button2
2
2
 
3
3
  This template should help get you started developing with Vue 3 in Vite.
4
4
 
@@ -1 +1 @@
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
+ .m-btn[data-v-455b51a7]{border:none;cursor:pointer;padding:.5em 1.2em;font-size:1em;transition:background .2s,color .2s}.m-btn.primary[data-v-455b51a7]{background:#409eff;color:#fff}.m-btn.round[data-v-455b51a7]{border-radius:999px}.m-btn.small[data-v-455b51a7]{font-size:.8em;padding:.3em .8em}.m-btn.medium[data-v-455b51a7]{font-size:1em;padding:.5em 1.2em}.m-btn.large[data-v-455b51a7]{font-size:1.2em;padding:.7em 1.6em}
@@ -1,126 +1,43 @@
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
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: ""
1
+ import { defineComponent as c, createElementBlock as u, openBlock as i, normalizeClass as p, renderSlot as s } from "vue";
2
+ const d = /* @__PURE__ */ c({
3
+ __name: "MButton",
4
+ props: {
5
+ color: {
6
+ type: String,
7
+ default: "primary"
8
+ },
9
+ round: {
10
+ type: Boolean,
11
+ default: !1
12
+ },
13
+ size: {
14
+ type: String,
15
+ default: "medium",
16
+ validator: (t) => ["small", "medium", "large"].includes(t)
17
+ }
18
+ },
19
+ emits: ["popup"],
20
+ setup(t, { expose: r, emit: o }) {
21
+ const l = o;
22
+ function n(e) {
23
+ window.alert(e), l("popup", e);
24
+ }
25
+ function a(e) {
26
+ n("按钮被点击!");
27
+ }
28
+ return r({ popup: n }), (e, f) => (i(), u("button", {
29
+ class: p(["m-btn", t.size, t.color, { round: t.round }]),
30
+ onClick: a
31
+ }, [
32
+ s(e.$slots, "default", {}, void 0, !0)
33
+ ], 2));
67
34
  }
68
- }, a = /* @__PURE__ */ u({
69
- name: "MButton",
70
- props: s,
71
- emits: ["click"],
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);
84
- };
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", {
94
- class: "m-button__loading-icon",
95
- viewBox: "0 0 1024 1024",
96
- xmlns: "http://www.w3.org/2000/svg",
97
- width: "16",
98
- height: "16"
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
121
- };
35
+ }), m = (t, r) => {
36
+ const o = t.__vccOpts || t;
37
+ for (const [l, n] of r)
38
+ o[l] = n;
39
+ return o;
40
+ }, k = /* @__PURE__ */ m(d, [["__scopeId", "data-v-455b51a7"]]);
122
41
  export {
123
- a as MButton,
124
- g as default,
125
- b as install
42
+ k as MButton
126
43
  };
@@ -0,0 +1 @@
1
+ (function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.Morghulis={},o.Vue))})(this,function(o,e){"use strict";const l=((t,r)=>{const i=t.__vccOpts||t;for(const[s,u]of r)i[s]=u;return i})(e.defineComponent({__name:"MButton",props:{color:{type:String,default:"primary"},round:{type:Boolean,default:!1},size:{type:String,default:"medium",validator:t=>["small","medium","large"].includes(t)}},emits:["popup"],setup(t,{expose:r,emit:i}){const s=i;function u(n){window.alert(n),s("popup",n)}function c(n){u("按钮被点击!")}return r({popup:u}),(n,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["m-btn",t.size,t.color,{round:t.round}]),onClick:c},[e.renderSlot(n.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-455b51a7"]]);o.MButton=l,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,68 +1,35 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.57",
4
- "description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
3
+ "version": "2.0.59",
4
+ "private": false,
5
5
  "type": "module",
6
- "main": "dist/morghulis.es.js",
6
+ "main": "dist/morghulis.umd.js",
7
7
  "module": "dist/morghulis.es.js",
8
- "types": "pycharm.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": [
12
- "./pycharm.d.ts",
13
- "./vue-shim.d.ts",
14
- "./index.d.ts"
15
- ],
16
- "import": "./dist/morghulis.es.js",
17
- "require": "./dist/morghulis.es.js"
18
- },
19
- "./dist/morghulis.css": "./dist/morghulis.css"
20
- },
8
+ "types": "dist/index.d.ts",
9
+ "style": "dist/morghulis.css",
21
10
  "files": [
22
- "dist",
23
- "index.d.ts",
24
- "pycharm.d.ts",
25
- "vue-shim.d.ts"
11
+ "dist"
26
12
  ],
27
13
  "scripts": {
28
14
  "dev": "vite",
29
- "build": "npm run build-only",
15
+ "build": "run-p type-check \"build-only {@}\" --",
30
16
  "preview": "vite preview",
31
17
  "build-only": "vite build",
32
- "type-check": "vue-tsc --build",
33
- "generate-types": "vue-tsc --project tsconfig.app.json --declaration --emitDeclarationOnly --outDir dist/types",
34
- "prepublishOnly": "npm run build"
18
+ "build-lib": "vite build --config vite.lib.config.ts",
19
+ "type-check": "vue-tsc --build"
35
20
  },
36
- "keywords": [
37
- "vue",
38
- "vue3",
39
- "component",
40
- "button",
41
- "typescript",
42
- "ui"
43
- ],
44
- "author": "",
45
- "license": "MIT",
46
21
  "dependencies": {
47
- "vue": "^3.0.0"
22
+ "vue": "^3.5.13"
48
23
  },
49
24
  "devDependencies": {
50
25
  "@tsconfig/node22": "^22.0.1",
51
26
  "@types/node": "^22.14.0",
52
- "@types/vue": "^1.0.31",
53
27
  "@vitejs/plugin-vue": "^5.2.3",
54
- "@vitejs/plugin-vue-jsx": "^4.1.2",
55
28
  "@vue/tsconfig": "^0.7.0",
56
29
  "npm-run-all2": "^7.0.2",
57
30
  "typescript": "~5.8.0",
58
31
  "vite": "^6.2.4",
59
32
  "vite-plugin-vue-devtools": "^7.7.2",
60
33
  "vue-tsc": "^2.2.8"
61
- },
62
- "peerDependencies": {
63
- "vue": "^3.0.0"
64
- },
65
- "publishConfig": {
66
- "access": "public"
67
34
  }
68
35
  }
package/index.d.ts DELETED
@@ -1,58 +0,0 @@
1
- // 按钮类型
2
- export type MButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
3
-
4
- // 按钮尺寸
5
- export type MButtonSize = 'large' | 'default' | 'small';
6
-
7
- // 按钮属性
8
- export interface MButtonProps {
9
- type?: MButtonType;
10
- size?: MButtonSize;
11
- plain?: boolean;
12
- round?: boolean;
13
- circle?: boolean;
14
- disabled?: boolean;
15
- loading?: boolean;
16
- icon?: string;
17
- text?: string;
18
- }
19
-
20
- // 按钮组件
21
- export const MButton: any;
22
-
23
- // 安装函数
24
- export function install(app: any): void;
25
-
26
- // 默认导出
27
- export default {
28
- MButton,
29
- install
30
- };
31
-
32
- // 全局组件声明
33
- declare module '@vue/runtime-core' {
34
- export interface GlobalComponents {
35
- MButton: MButton
36
- }
37
- }
38
-
39
- // 直接声明方式
40
- declare module 'morghulis' {
41
- export const MButton: MButton
42
- }
43
-
44
- // 直接扩展Vue
45
- declare module 'vue/types/vue' {
46
- interface Vue {
47
- $MButton: typeof MButton
48
- }
49
- }
50
-
51
- // JSX支持
52
- declare global {
53
- namespace JSX {
54
- interface IntrinsicElements {
55
- 'MButton': MButton
56
- }
57
- }
58
- }
package/pycharm.d.ts DELETED
@@ -1,70 +0,0 @@
1
- /**
2
- * PyCharm专用类型定义文件
3
- * 这个文件的设计目的是专门适配PyCharm的类型识别系统
4
- */
5
-
6
- // 定义按钮类型的字面量类型
7
- declare const DEFAULT: 'default';
8
- declare const PRIMARY: 'primary';
9
- declare const SUCCESS: 'success';
10
- declare const WARNING: 'warning';
11
- declare const DANGER: 'danger';
12
- declare const INFO: 'info';
13
- declare const TEXT: 'text';
14
-
15
- // 定义按钮尺寸的字面量类型
16
- declare const LARGE: 'large';
17
- declare const SMALL: 'small';
18
-
19
- // 定义全局MButton对象
20
- declare const MButton: {
21
- /**
22
- * 按钮类型
23
- * 可选值: default, primary, success, warning, danger, info, text
24
- */
25
- type: typeof DEFAULT | typeof PRIMARY | typeof SUCCESS | typeof WARNING | typeof DANGER | typeof INFO | typeof TEXT;
26
-
27
- /**
28
- * 按钮尺寸
29
- * 可选值: large, default, small
30
- */
31
- size: typeof LARGE | 'default' | typeof SMALL;
32
-
33
- /**
34
- * 是否为朴素按钮
35
- */
36
- plain: boolean;
37
-
38
- /**
39
- * 是否为圆角按钮
40
- */
41
- round: boolean;
42
-
43
- /**
44
- * 是否为圆形按钮
45
- */
46
- circle: boolean;
47
-
48
- /**
49
- * 是否禁用按钮
50
- */
51
- disabled: boolean;
52
-
53
- /**
54
- * 是否显示加载状态
55
- */
56
- loading: boolean;
57
-
58
- /**
59
- * 按钮图标类名
60
- */
61
- icon: string;
62
-
63
- /**
64
- * 按钮文本
65
- */
66
- text: string;
67
- };
68
-
69
- // 导出按钮组件
70
- export { MButton };
package/vue-shim.d.ts DELETED
@@ -1,54 +0,0 @@
1
- import { ComponentOptions } from 'vue'
2
-
3
- // Vue扩展
4
- declare module 'vue/types/options' {
5
- interface ComponentOptions {
6
- MButton?: {
7
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
8
- size?: 'large' | 'default' | 'small';
9
- plain?: boolean;
10
- round?: boolean;
11
- circle?: boolean;
12
- disabled?: boolean;
13
- loading?: boolean;
14
- icon?: string;
15
- text?: string;
16
- }
17
- }
18
- }
19
-
20
- // 组件声明
21
- declare module '@vue/runtime-core' {
22
- interface GlobalComponents {
23
- MButton: {
24
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
25
- size?: 'large' | 'default' | 'small';
26
- plain?: boolean;
27
- round?: boolean;
28
- circle?: boolean;
29
- disabled?: boolean;
30
- loading?: boolean;
31
- icon?: string;
32
- text?: string;
33
- }
34
- }
35
- }
36
-
37
- // 为Vue添加类型定义
38
- declare module '@vue/runtime-core' {
39
- interface ComponentCustomProperties {
40
- $morghulis: {
41
- MButton: {
42
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
43
- size?: 'large' | 'default' | 'small';
44
- plain?: boolean;
45
- round?: boolean;
46
- circle?: boolean;
47
- disabled?: boolean;
48
- loading?: boolean;
49
- icon?: string;
50
- text?: string;
51
- }
52
- }
53
- }
54
- }