morghulis 2.0.55 → 2.0.57

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/index.d.ts CHANGED
@@ -1,27 +1,26 @@
1
1
  // 按钮类型
2
- export type ButtonType = "default" | "primary" | "success" | "warning" | "danger" | "info" | "text"
2
+ export type MButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
3
3
 
4
4
  // 按钮尺寸
5
- export type ButtonSize = "large" | "default" | "small"
6
-
7
- // 组件定义
8
- export type MButton = {
9
- // 属性
10
- type?: ButtonType
11
- size?: ButtonSize
12
- plain?: boolean
13
- round?: boolean
14
- circle?: boolean
15
- disabled?: boolean
16
- loading?: boolean
17
- icon?: string
18
- text?: string
19
-
20
- // 事件
21
- onClick?: (event: MouseEvent) => void
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;
22
18
  }
23
19
 
24
- // 安装方法
20
+ // 按钮组件
21
+ export const MButton: any;
22
+
23
+ // 安装函数
25
24
  export function install(app: any): void;
26
25
 
27
26
  // 默认导出
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "2.0.55",
3
+ "version": "2.0.57",
4
4
  "description": "一个Vue 3按钮组件库,支持TypeScript和IDE自动补全",
5
5
  "type": "module",
6
6
  "main": "dist/morghulis.es.js",
7
7
  "module": "dist/morghulis.es.js",
8
- "types": "mbutton.d.ts",
8
+ "types": "pycharm.d.ts",
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": [
12
- "./mbutton.d.ts",
13
- "./src/global.d.ts",
14
- "./src/shims-vue.d.ts"
12
+ "./pycharm.d.ts",
13
+ "./vue-shim.d.ts",
14
+ "./index.d.ts"
15
15
  ],
16
16
  "import": "./dist/morghulis.es.js",
17
17
  "require": "./dist/morghulis.es.js"
@@ -21,9 +21,8 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "index.d.ts",
24
- "mbutton.d.ts",
25
- "src/global.d.ts",
26
- "src/shims-vue.d.ts"
24
+ "pycharm.d.ts",
25
+ "vue-shim.d.ts"
27
26
  ],
28
27
  "scripts": {
29
28
  "dev": "vite",
package/pycharm.d.ts ADDED
@@ -0,0 +1,70 @@
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 ADDED
@@ -0,0 +1,54 @@
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
+ }
package/mbutton.d.ts DELETED
@@ -1,27 +0,0 @@
1
- // 直接声明类型,不使用任何模块语法
2
- // 这是最简单直接的方式,对IDE最友好
3
-
4
- /**
5
- * 按钮类型
6
- */
7
- type MButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
8
-
9
- /**
10
- * 按钮尺寸
11
- */
12
- type MButtonSize = 'large' | 'default' | 'small';
13
-
14
- /**
15
- * 按钮组件
16
- */
17
- type MButton = {
18
- type?: MButtonType;
19
- size?: MButtonSize;
20
- plain?: boolean;
21
- round?: boolean;
22
- circle?: boolean;
23
- disabled?: boolean;
24
- loading?: boolean;
25
- icon?: string;
26
- text?: string;
27
- };
package/src/global.d.ts DELETED
@@ -1,38 +0,0 @@
1
- // 使用全局 HTML 元素扩展方式声明组件
2
- // 这种方式对 PyCharm 更友好
3
-
4
- interface HTMLElementTagNameMap {
5
- 'MButton': {
6
- // 属性
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
- onclick: (event: MouseEvent) => void;
19
- }
20
- }
21
-
22
- // JSX/TSX 支持
23
- declare namespace JSX {
24
- interface IntrinsicElements {
25
- MButton: {
26
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
27
- size?: 'large' | 'default' | 'small';
28
- plain?: boolean;
29
- round?: boolean;
30
- circle?: boolean;
31
- disabled?: boolean;
32
- loading?: boolean;
33
- icon?: string;
34
- text?: string;
35
- onClick?: (event: MouseEvent) => void;
36
- }
37
- }
38
- }
@@ -1,37 +0,0 @@
1
- declare module '*.vue' {
2
- import { ComponentOptions } from 'vue';
3
- const component: ComponentOptions;
4
- export default component;
5
- }
6
-
7
- declare module 'vue' {
8
- interface GlobalComponents {
9
- MButton: {
10
- type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
11
- size?: 'large' | 'default' | 'small';
12
- plain?: boolean;
13
- round?: boolean;
14
- circle?: boolean;
15
- disabled?: boolean;
16
- loading?: boolean;
17
- icon?: string;
18
- text?: string;
19
- }
20
- }
21
- }
22
-
23
- declare module '@vue/runtime-core' {
24
- interface ComponentCustomProperties {
25
- $MButton: {
26
- type: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
27
- size: 'large' | 'default' | 'small';
28
- plain: boolean;
29
- round: boolean;
30
- circle: boolean;
31
- disabled: boolean;
32
- loading: boolean;
33
- icon: string;
34
- text: string;
35
- }
36
- }
37
- }