morghulis 2.0.54 → 2.0.56
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/mbutton.d.ts +50 -0
- package/package.json +8 -6
- package/src/global.d.ts +56 -0
- package/src/shims-vue.d.ts +39 -0
- package/src/morghulis-types.d.ts +0 -40
- package/typings/components.d.ts +0 -8
- package/typings/direct.d.ts +0 -77
- package/typings/jetbrains.d.ts +0 -95
- package/typings/volar.d.ts +0 -12
package/mbutton.d.ts
ADDED
@@ -0,0 +1,50 @@
|
|
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/package.json
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "morghulis",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.56",
|
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": "
|
8
|
+
"types": "mbutton.d.ts",
|
9
9
|
"exports": {
|
10
10
|
".": {
|
11
11
|
"types": [
|
12
|
-
"./
|
13
|
-
"./src/
|
12
|
+
"./mbutton.d.ts",
|
13
|
+
"./src/global.d.ts",
|
14
|
+
"./src/shims-vue.d.ts"
|
14
15
|
],
|
15
16
|
"import": "./dist/morghulis.es.js",
|
16
17
|
"require": "./dist/morghulis.es.js"
|
@@ -20,8 +21,9 @@
|
|
20
21
|
"files": [
|
21
22
|
"dist",
|
22
23
|
"index.d.ts",
|
23
|
-
"
|
24
|
-
"
|
24
|
+
"mbutton.d.ts",
|
25
|
+
"src/global.d.ts",
|
26
|
+
"src/shims-vue.d.ts"
|
25
27
|
],
|
26
28
|
"scripts": {
|
27
29
|
"dev": "vite",
|
package/src/global.d.ts
ADDED
@@ -0,0 +1,56 @@
|
|
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
|
+
}
|
@@ -0,0 +1,39 @@
|
|
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
|
+
}
|
package/src/morghulis-types.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
// MButton组件的类型定义
|
2
|
-
|
3
|
-
// 按钮类型
|
4
|
-
export type MButtonType = "default" | "primary" | "success" | "warning" | "danger" | "info" | "text"
|
5
|
-
|
6
|
-
// 按钮尺寸
|
7
|
-
export type MButtonSize = "large" | "default" | "small"
|
8
|
-
|
9
|
-
// 按钮属性
|
10
|
-
export type MButton = {
|
11
|
-
// 属性
|
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
|
-
onClick?: (event: MouseEvent) => void
|
24
|
-
}
|
25
|
-
|
26
|
-
// 安装方法
|
27
|
-
export function install(app: any): void
|
28
|
-
|
29
|
-
// 默认导出
|
30
|
-
export default {
|
31
|
-
MButton,
|
32
|
-
install
|
33
|
-
}
|
34
|
-
|
35
|
-
// 添加到Vue全局组件
|
36
|
-
declare module '@vue/runtime-core' {
|
37
|
-
export interface GlobalComponents {
|
38
|
-
MButton: MButton
|
39
|
-
}
|
40
|
-
}
|
package/typings/components.d.ts
DELETED
package/typings/direct.d.ts
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
// 直接声明每个组件的类型,不通过模块
|
2
|
-
|
3
|
-
/**
|
4
|
-
* 按钮组件
|
5
|
-
*
|
6
|
-
* @component MButton
|
7
|
-
* @example
|
8
|
-
* <MButton type="primary" size="large" plain round>按钮文本</MButton>
|
9
|
-
*/
|
10
|
-
interface MButton {
|
11
|
-
/**
|
12
|
-
* 按钮类型
|
13
|
-
* @default default
|
14
|
-
*/
|
15
|
-
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
|
16
|
-
|
17
|
-
/**
|
18
|
-
* 按钮尺寸
|
19
|
-
* @default default
|
20
|
-
*/
|
21
|
-
size?: 'large' | 'default' | 'small';
|
22
|
-
|
23
|
-
/**
|
24
|
-
* 是否为朴素按钮
|
25
|
-
* @default false
|
26
|
-
*/
|
27
|
-
plain?: boolean;
|
28
|
-
|
29
|
-
/**
|
30
|
-
* 是否为圆角按钮
|
31
|
-
* @default false
|
32
|
-
*/
|
33
|
-
round?: boolean;
|
34
|
-
|
35
|
-
/**
|
36
|
-
* 是否为圆形按钮
|
37
|
-
* @default false
|
38
|
-
*/
|
39
|
-
circle?: boolean;
|
40
|
-
|
41
|
-
/**
|
42
|
-
* 是否禁用按钮
|
43
|
-
* @default false
|
44
|
-
*/
|
45
|
-
disabled?: boolean;
|
46
|
-
|
47
|
-
/**
|
48
|
-
* 是否显示加载状态
|
49
|
-
* @default false
|
50
|
-
*/
|
51
|
-
loading?: boolean;
|
52
|
-
|
53
|
-
/**
|
54
|
-
* 按钮图标类名
|
55
|
-
*/
|
56
|
-
icon?: string;
|
57
|
-
|
58
|
-
/**
|
59
|
-
* 按钮文本
|
60
|
-
*/
|
61
|
-
text?: string;
|
62
|
-
|
63
|
-
/**
|
64
|
-
* 点击事件
|
65
|
-
*/
|
66
|
-
onClick?: (event: MouseEvent) => void;
|
67
|
-
}
|
68
|
-
|
69
|
-
// 将类型加入全局命名空间
|
70
|
-
declare global {
|
71
|
-
interface HTMLElementTagNameMap {
|
72
|
-
'MButton': MButton;
|
73
|
-
}
|
74
|
-
}
|
75
|
-
|
76
|
-
// 导出类型以便在其他地方使用
|
77
|
-
export { MButton };
|
package/typings/jetbrains.d.ts
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
// 为JetBrains IDE提供的类型定义
|
2
|
-
|
3
|
-
import type { MButton as MButtonType } from '../index';
|
4
|
-
|
5
|
-
declare module '@vue/runtime-core' {
|
6
|
-
export interface GlobalComponents {
|
7
|
-
MButton: MButtonType
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
// 直接类型声明,可能更符合PyCharm的识别方式
|
12
|
-
declare module 'vue' {
|
13
|
-
interface GlobalComponents {
|
14
|
-
MButton: {
|
15
|
-
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text',
|
16
|
-
size?: 'large' | 'default' | 'small',
|
17
|
-
plain?: boolean,
|
18
|
-
round?: boolean,
|
19
|
-
circle?: boolean,
|
20
|
-
disabled?: boolean,
|
21
|
-
loading?: boolean,
|
22
|
-
icon?: string,
|
23
|
-
text?: string,
|
24
|
-
onClick?: (event: MouseEvent) => void
|
25
|
-
}
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
/**
|
30
|
-
* 扩展Vue JSX类型
|
31
|
-
*/
|
32
|
-
declare namespace JSX {
|
33
|
-
interface IntrinsicElements {
|
34
|
-
MButton: {
|
35
|
-
/**
|
36
|
-
* 按钮类型
|
37
|
-
* @values default, primary, success, warning, danger, info, text
|
38
|
-
* @default default
|
39
|
-
*/
|
40
|
-
type?: 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'text';
|
41
|
-
|
42
|
-
/**
|
43
|
-
* 按钮尺寸
|
44
|
-
* @values large, default, small
|
45
|
-
* @default default
|
46
|
-
*/
|
47
|
-
size?: 'large' | 'default' | 'small';
|
48
|
-
|
49
|
-
/**
|
50
|
-
* 是否为朴素按钮
|
51
|
-
* @default false
|
52
|
-
*/
|
53
|
-
plain?: boolean;
|
54
|
-
|
55
|
-
/**
|
56
|
-
* 是否为圆角按钮
|
57
|
-
* @default false
|
58
|
-
*/
|
59
|
-
round?: boolean;
|
60
|
-
|
61
|
-
/**
|
62
|
-
* 是否为圆形按钮
|
63
|
-
* @default false
|
64
|
-
*/
|
65
|
-
circle?: boolean;
|
66
|
-
|
67
|
-
/**
|
68
|
-
* 是否禁用按钮
|
69
|
-
* @default false
|
70
|
-
*/
|
71
|
-
disabled?: boolean;
|
72
|
-
|
73
|
-
/**
|
74
|
-
* 是否显示加载状态
|
75
|
-
* @default false
|
76
|
-
*/
|
77
|
-
loading?: boolean;
|
78
|
-
|
79
|
-
/**
|
80
|
-
* 按钮图标类名
|
81
|
-
*/
|
82
|
-
icon?: string;
|
83
|
-
|
84
|
-
/**
|
85
|
-
* 按钮文本
|
86
|
-
*/
|
87
|
-
text?: string;
|
88
|
-
|
89
|
-
/**
|
90
|
-
* 点击事件
|
91
|
-
*/
|
92
|
-
onClick?: (event: MouseEvent) => void;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
}
|