morghulis 2.0.56 → 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.56",
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,50 +0,0 @@
1
- // 直接声明类型,不使用任何模块语法
2
- // 这是最简单直接的方式,对IDE最友好
3
-
4
- declare namespace MorgulisButton {
5
- /**
6
- * 按钮类型
7
- */
8
- export type MButtonType = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
9
-
10
- /**
11
- * 按钮尺寸
12
- */
13
- export type MButtonSize = 'large' | 'default' | 'small';
14
-
15
- /**
16
- * 按钮组件
17
- */
18
- export interface MButtonProps {
19
- type?: MButtonType;
20
- size?: MButtonSize;
21
- plain?: boolean;
22
- round?: boolean;
23
- circle?: boolean;
24
- disabled?: boolean;
25
- loading?: boolean;
26
- icon?: string;
27
- text?: string;
28
- }
29
- }
30
-
31
- declare module 'morghulis' {
32
- import { App, Component } from 'vue';
33
-
34
- // 导出类型
35
- export type MButtonType = MorgulisButton.MButtonType;
36
- export type MButtonSize = MorgulisButton.MButtonSize;
37
- export type MButtonProps = MorgulisButton.MButtonProps;
38
-
39
- // 导出组件
40
- export const MButton: Component<MButtonProps>;
41
-
42
- // 安装函数
43
- export function install(app: App): void;
44
-
45
- // 默认导出
46
- export default {
47
- MButton,
48
- install
49
- };
50
- }
package/src/global.d.ts DELETED
@@ -1,56 +0,0 @@
1
- // 使用声明合并 (Declaration Merging) 技术提供全局类型
2
-
3
- // 从morghulis模块导入类型
4
- import { MButtonType, MButtonSize } from 'morghulis';
5
-
6
- // Vue全局组件
7
- declare module '@vue/runtime-core' {
8
- interface GlobalComponents {
9
- MButton: {
10
- // 属性
11
- type?: MButtonType;
12
- size?: MButtonSize;
13
- plain?: boolean;
14
- round?: boolean;
15
- circle?: boolean;
16
- disabled?: boolean;
17
- loading?: boolean;
18
- icon?: string;
19
- text?: string;
20
- }
21
- }
22
- }
23
-
24
- // HTML元素映射扩展
25
- interface HTMLElementTagNameMap {
26
- 'MButton': {
27
- // 属性
28
- type: MButtonType;
29
- size: MButtonSize;
30
- plain: boolean;
31
- round: boolean;
32
- circle: boolean;
33
- disabled: boolean;
34
- loading: boolean;
35
- icon: string;
36
- text: string;
37
- }
38
- }
39
-
40
- // JSX/TSX 支持
41
- declare namespace JSX {
42
- interface IntrinsicElements {
43
- MButton: {
44
- type?: MButtonType;
45
- size?: MButtonSize;
46
- plain?: boolean;
47
- round?: boolean;
48
- circle?: boolean;
49
- disabled?: boolean;
50
- loading?: boolean;
51
- icon?: string;
52
- text?: string;
53
- onClick?: (event: MouseEvent) => void;
54
- }
55
- }
56
- }
@@ -1,39 +0,0 @@
1
- declare module '*.vue' {
2
- import { Component } from 'vue';
3
- const component: Component;
4
- export default component;
5
- }
6
-
7
- import { MButtonType, MButtonSize } from 'morghulis';
8
-
9
- declare module 'vue' {
10
- interface GlobalComponents {
11
- MButton: {
12
- type?: MButtonType;
13
- size?: MButtonSize;
14
- plain?: boolean;
15
- round?: boolean;
16
- circle?: boolean;
17
- disabled?: boolean;
18
- loading?: boolean;
19
- icon?: string;
20
- text?: string;
21
- }
22
- }
23
- }
24
-
25
- declare module '@vue/runtime-core' {
26
- interface ComponentCustomProperties {
27
- $MButton: {
28
- type: MButtonType;
29
- size: MButtonSize;
30
- plain: boolean;
31
- round: boolean;
32
- circle: boolean;
33
- disabled: boolean;
34
- loading: boolean;
35
- icon: string;
36
- text: string;
37
- }
38
- }
39
- }