@ibiz-template-plugin/ai-chat 0.0.1
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/LICENSE +21 -0
- package/README.en.md +36 -0
- package/README.md +37 -0
- package/dist/assets/svg/AIChat.svg +1 -0
- package/dist/index.es.js +1655 -0
- package/dist/index.legacy.js +1 -0
- package/dist/polyfills.legacy.js +1 -0
- package/dist/style.css +1 -0
- package/dist/types/app.d.ts +1 -0
- package/dist/types/components/chat-container/chat-container.d.ts +59 -0
- package/dist/types/components/chat-input/chat-input.d.ts +12 -0
- package/dist/types/components/chat-message-item/chat-message-item.d.ts +23 -0
- package/dist/types/components/chat-message-item/error-message/error-message.d.ts +13 -0
- package/dist/types/components/chat-message-item/markdown-message/markdown-message.d.ts +22 -0
- package/dist/types/components/chat-message-item/unknown-message/unknown-message.d.ts +13 -0
- package/dist/types/components/chat-message-item/user-message/user-message.d.ts +13 -0
- package/dist/types/components/chat-messages/chat-messages.d.ts +12 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/controller/ai-chat/ai-chat.controller.d.ts +78 -0
- package/dist/types/controller/chat/chat.controller.d.ts +51 -0
- package/dist/types/controller/index.d.ts +2 -0
- package/dist/types/entity/chat-message/chat-message.d.ts +28 -0
- package/dist/types/entity/index.d.ts +1 -0
- package/dist/types/global.d.ts +2 -0
- package/dist/types/icons/close-svg.d.ts +1 -0
- package/dist/types/icons/fill-svg.d.ts +1 -0
- package/dist/types/icons/index.d.ts +3 -0
- package/dist/types/icons/send-svg.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/interface/i-chat-container/i-chat-container.d.ts +58 -0
- package/dist/types/interface/i-chat-message/i-chat-message.d.ts +83 -0
- package/dist/types/interface/i-chat-options/i-chat-options.d.ts +46 -0
- package/dist/types/interface/i-message-item-provider/i-message-item-provider.d.ts +18 -0
- package/dist/types/interface/i-portal-async-action/i-portal-async-action.d.ts +90 -0
- package/dist/types/interface/index.d.ts +4 -0
- package/dist/types/main.d.ts +1 -0
- package/dist/types/utils/index.d.ts +3 -0
- package/dist/types/utils/namespace/namespace.d.ts +147 -0
- package/dist/types/utils/plugin-static-resource/plugin-static-resource.d.ts +63 -0
- package/dist/types/utils/util/util.d.ts +9 -0
- package/package.json +81 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AiChatController } from '..';
|
|
2
|
+
import { IChatOptions } from '../../interface';
|
|
3
|
+
/**
|
|
4
|
+
* 聊天器控制器
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-10-13 17:10:47
|
|
8
|
+
* @export
|
|
9
|
+
* @class ChatController
|
|
10
|
+
*/
|
|
11
|
+
export declare class ChatController {
|
|
12
|
+
/**
|
|
13
|
+
* 聊天框容器
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2023-10-13 17:10:03
|
|
17
|
+
* @protected
|
|
18
|
+
* @type {HTMLDivElement}
|
|
19
|
+
*/
|
|
20
|
+
protected container?: HTMLDivElement;
|
|
21
|
+
/**
|
|
22
|
+
* 创建聊天窗口(会同时显示出来)
|
|
23
|
+
*
|
|
24
|
+
* @author chitanda
|
|
25
|
+
* @date 2023-10-13 17:10:22
|
|
26
|
+
*/
|
|
27
|
+
create(opts: IChatOptions): AiChatController;
|
|
28
|
+
/**
|
|
29
|
+
* 隐藏聊天窗口(必须先创建)
|
|
30
|
+
*
|
|
31
|
+
* @author chitanda
|
|
32
|
+
* @date 2023-10-13 17:10:55
|
|
33
|
+
*/
|
|
34
|
+
hidden(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 显示聊天窗窗口(必须先创建)
|
|
37
|
+
*
|
|
38
|
+
* @author chitanda
|
|
39
|
+
* @date 2023-10-13 17:10:29
|
|
40
|
+
*/
|
|
41
|
+
show(): void;
|
|
42
|
+
/**
|
|
43
|
+
* 关闭聊天窗口
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2023-10-13 17:10:10
|
|
47
|
+
*/
|
|
48
|
+
close(): void;
|
|
49
|
+
}
|
|
50
|
+
declare const chat: ChatController;
|
|
51
|
+
export { chat };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IChatMessage } from '../../interface';
|
|
2
|
+
/**
|
|
3
|
+
* 消息实体
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2023-10-09 16:10:45
|
|
7
|
+
* @export
|
|
8
|
+
* @class ChatMessage
|
|
9
|
+
* @implements {IMessage}
|
|
10
|
+
*/
|
|
11
|
+
export declare class ChatMessage implements IChatMessage {
|
|
12
|
+
protected msg: IChatMessage;
|
|
13
|
+
get messageid(): IChatMessage['messageid'];
|
|
14
|
+
get state(): IChatMessage['state'];
|
|
15
|
+
get role(): IChatMessage['role'];
|
|
16
|
+
get type(): IChatMessage['type'];
|
|
17
|
+
get content(): IChatMessage['content'];
|
|
18
|
+
get _origin(): IChatMessage;
|
|
19
|
+
constructor(msg: IChatMessage);
|
|
20
|
+
/**
|
|
21
|
+
* 更新消息
|
|
22
|
+
*
|
|
23
|
+
* @author chitanda
|
|
24
|
+
* @date 2023-10-10 17:10:07
|
|
25
|
+
* @param {IChatMessage} msg
|
|
26
|
+
*/
|
|
27
|
+
update(msg: IChatMessage): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChatMessage } from './chat-message/chat-message';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CloseSgv: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FillSvg: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SendSvg: () => import("preact").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 聊天窗口呈现配置
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2023-10-15 19:10:04
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IChatContainerOptions
|
|
8
|
+
*/
|
|
9
|
+
export interface IChatContainerOptions {
|
|
10
|
+
/**
|
|
11
|
+
* 窗口 x 坐标
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2023-10-13 14:10:42
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
x?: number;
|
|
18
|
+
/**
|
|
19
|
+
* 窗口 y 坐标
|
|
20
|
+
*
|
|
21
|
+
* @author chitanda
|
|
22
|
+
* @date 2023-10-13 14:10:52
|
|
23
|
+
* @type {number}
|
|
24
|
+
*/
|
|
25
|
+
y?: number;
|
|
26
|
+
/**
|
|
27
|
+
* 窗口宽度
|
|
28
|
+
*
|
|
29
|
+
* @author chitanda
|
|
30
|
+
* @date 2023-10-13 14:10:56
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
width?: number;
|
|
34
|
+
/**
|
|
35
|
+
* 窗口高度
|
|
36
|
+
*
|
|
37
|
+
* @author chitanda
|
|
38
|
+
* @date 2023-10-13 14:10:02
|
|
39
|
+
* @type {number}
|
|
40
|
+
*/
|
|
41
|
+
height?: number;
|
|
42
|
+
/**
|
|
43
|
+
* 窗口最小宽度
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2023-10-13 14:10:11
|
|
47
|
+
* @type {number}
|
|
48
|
+
*/
|
|
49
|
+
minWidth?: number;
|
|
50
|
+
/**
|
|
51
|
+
* 窗口最小高度
|
|
52
|
+
*
|
|
53
|
+
* @author chitanda
|
|
54
|
+
* @date 2023-10-13 14:10:15
|
|
55
|
+
* @type {number}
|
|
56
|
+
*/
|
|
57
|
+
minHeight?: number;
|
|
58
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { IPortalAsyncAction } from '../i-portal-async-action/i-portal-async-action';
|
|
2
|
+
/**
|
|
3
|
+
* AI聊天消息
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2023-10-10 16:10:29
|
|
7
|
+
* @export
|
|
8
|
+
* @interface IChatMessage
|
|
9
|
+
*/
|
|
10
|
+
export interface IChatMessage {
|
|
11
|
+
/**
|
|
12
|
+
* 消息标识
|
|
13
|
+
*
|
|
14
|
+
* @author chitanda
|
|
15
|
+
* @date 2023-09-05 15:09:43
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
messageid: string;
|
|
19
|
+
/**
|
|
20
|
+
* 消息名称
|
|
21
|
+
*
|
|
22
|
+
* @author chitanda
|
|
23
|
+
* @date 2023-09-05 15:09:49
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
messagename?: string;
|
|
27
|
+
/**
|
|
28
|
+
* 作业状态
|
|
29
|
+
*
|
|
30
|
+
* @author chitanda
|
|
31
|
+
* @date 2023-10-10 15:10:59
|
|
32
|
+
* @type {(10 | 20 | 30 | 40)} 未开始 | 执行中 | 已执行 | 执行失败
|
|
33
|
+
*/
|
|
34
|
+
state: 10 | 20 | 30 | 40;
|
|
35
|
+
/**
|
|
36
|
+
* 消息类型
|
|
37
|
+
*
|
|
38
|
+
* @author chitanda
|
|
39
|
+
* @date 2023-10-10 16:10:21
|
|
40
|
+
* @type {string}
|
|
41
|
+
*/
|
|
42
|
+
type: string | 'DEFAULT' | 'ERROR';
|
|
43
|
+
/**
|
|
44
|
+
* 消息子类型
|
|
45
|
+
*
|
|
46
|
+
* @author chitanda
|
|
47
|
+
* @date 2023-10-10 16:10:00
|
|
48
|
+
* @type {string}
|
|
49
|
+
*/
|
|
50
|
+
subtype?: string;
|
|
51
|
+
/**
|
|
52
|
+
* 消息角色
|
|
53
|
+
*
|
|
54
|
+
* @author chitanda
|
|
55
|
+
* @date 2023-10-10 16:10:32
|
|
56
|
+
* @type {('ASSISTANT' | 'USER' | 'SYSTEM')} 助手 | 用户 | 系统
|
|
57
|
+
*/
|
|
58
|
+
role: 'ASSISTANT' | 'USER' | 'SYSTEM';
|
|
59
|
+
/**
|
|
60
|
+
* 内容摘要
|
|
61
|
+
*
|
|
62
|
+
* @author chitanda
|
|
63
|
+
* @date 2023-09-05 15:09:23
|
|
64
|
+
* @type {string}
|
|
65
|
+
*/
|
|
66
|
+
content: string;
|
|
67
|
+
/**
|
|
68
|
+
* 消息数据
|
|
69
|
+
*
|
|
70
|
+
* @author chitanda
|
|
71
|
+
* @date 2023-09-05 15:09:55
|
|
72
|
+
* @type {(IPortalAsyncAction | unknown)}
|
|
73
|
+
*/
|
|
74
|
+
data?: IPortalAsyncAction | unknown;
|
|
75
|
+
/**
|
|
76
|
+
* 消息路径
|
|
77
|
+
*
|
|
78
|
+
* @author chitanda
|
|
79
|
+
* @date 2023-09-05 15:09:25
|
|
80
|
+
* @type {string}
|
|
81
|
+
*/
|
|
82
|
+
url?: string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { IChatMessage } from '..';
|
|
2
|
+
import { IChatContainerOptions } from '../i-chat-container/i-chat-container';
|
|
3
|
+
/**
|
|
4
|
+
* 聊天窗口配置参数
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-10-13 17:10:57
|
|
8
|
+
* @export
|
|
9
|
+
* @interface IChatOptions
|
|
10
|
+
*/
|
|
11
|
+
export interface IChatOptions {
|
|
12
|
+
/**
|
|
13
|
+
* 聊天窗触发提问回调
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2023-10-16 14:10:06
|
|
17
|
+
* @param {IChatMessage[]} question 提问历史内容(包含当前提问)
|
|
18
|
+
* @return {*} {Promise<boolean>} 等待回答,用于显示 loading 并获取最终成功与否
|
|
19
|
+
*/
|
|
20
|
+
question(question: IChatMessage[]): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* 窗口关闭后回调
|
|
23
|
+
*
|
|
24
|
+
* @author chitanda
|
|
25
|
+
* @date 2023-10-15 19:10:25
|
|
26
|
+
*/
|
|
27
|
+
closed?(): void;
|
|
28
|
+
/**
|
|
29
|
+
* 聊天窗任意位置点击操作
|
|
30
|
+
*
|
|
31
|
+
* @author chitanda
|
|
32
|
+
* @date 2023-10-13 18:10:56
|
|
33
|
+
* @param {string} action 操作的行为标识
|
|
34
|
+
* @param {T} [params] 传递的参数
|
|
35
|
+
* @return {*} {Promise<boolean>} 等待操作,用于显示 loading 并获取最终成功与否
|
|
36
|
+
*/
|
|
37
|
+
action?<T = unknown>(action: string, params?: T): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* 聊天窗口呈现
|
|
40
|
+
*
|
|
41
|
+
* @author chitanda
|
|
42
|
+
* @date 2023-10-15 19:10:44
|
|
43
|
+
* @type {IChatContainerOptions}
|
|
44
|
+
*/
|
|
45
|
+
containerOptions?: IChatContainerOptions;
|
|
46
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 项消息绘制适配器
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2023-10-09 16:10:11
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IMessageItemProvider
|
|
8
|
+
*/
|
|
9
|
+
export interface IMessageItemProvider {
|
|
10
|
+
/**
|
|
11
|
+
* 绘制的组件
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2023-10-09 16:10:38
|
|
15
|
+
* @type {*}
|
|
16
|
+
*/
|
|
17
|
+
component: any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步作业信息
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2023-09-05 15:09:59
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IPortalAsyncAction
|
|
8
|
+
*/
|
|
9
|
+
export interface IPortalAsyncAction {
|
|
10
|
+
/**
|
|
11
|
+
* 会话标识
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2023-09-05 15:09:57
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
fulltopictag: string;
|
|
18
|
+
/**
|
|
19
|
+
* 异步作业类型
|
|
20
|
+
*
|
|
21
|
+
* @author chitanda
|
|
22
|
+
* @date 2023-09-05 15:09:09
|
|
23
|
+
* @type {string}
|
|
24
|
+
*/
|
|
25
|
+
actiontype: string;
|
|
26
|
+
/**
|
|
27
|
+
* 作业状态
|
|
28
|
+
*
|
|
29
|
+
* @author chitanda
|
|
30
|
+
* @date 2023-10-10 15:10:59
|
|
31
|
+
* @type {(10 | 20 | 30 | 40)} 未开始 | 执行中 | 已执行 | 执行失败
|
|
32
|
+
*/
|
|
33
|
+
actionstate: 10 | 20 | 30 | 40;
|
|
34
|
+
/**
|
|
35
|
+
* 异步作业执行结果
|
|
36
|
+
*
|
|
37
|
+
* @author chitanda
|
|
38
|
+
* @date 2023-09-05 15:09:33
|
|
39
|
+
* @type {unknown}
|
|
40
|
+
*/
|
|
41
|
+
actionresult?: unknown;
|
|
42
|
+
/**
|
|
43
|
+
* 步骤信息
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2023-09-05 15:09:55
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
stepinfo?: string;
|
|
50
|
+
/**
|
|
51
|
+
* 异步结果下载路径,目前是留给导出数据使用
|
|
52
|
+
*
|
|
53
|
+
* @author chitanda
|
|
54
|
+
* @date 2023-09-05 15:09:03
|
|
55
|
+
* @type {string}
|
|
56
|
+
*/
|
|
57
|
+
asyncresultdownloadurl?: string;
|
|
58
|
+
/**
|
|
59
|
+
* 预留参数
|
|
60
|
+
*
|
|
61
|
+
* @author chitanda
|
|
62
|
+
* @date 2023-09-05 15:09:32
|
|
63
|
+
* @type {unknown}
|
|
64
|
+
*/
|
|
65
|
+
actionparam?: unknown;
|
|
66
|
+
/**
|
|
67
|
+
*预留参数2
|
|
68
|
+
*
|
|
69
|
+
* @author chitanda
|
|
70
|
+
* @date 2023-09-05 15:09:41
|
|
71
|
+
* @type {unknown}
|
|
72
|
+
*/
|
|
73
|
+
actionparam2?: unknown;
|
|
74
|
+
/**
|
|
75
|
+
*预留参数3
|
|
76
|
+
*
|
|
77
|
+
* @author chitanda
|
|
78
|
+
* @date 2023-09-05 15:09:43
|
|
79
|
+
* @type {unknown}
|
|
80
|
+
*/
|
|
81
|
+
actionparam3?: unknown;
|
|
82
|
+
/**
|
|
83
|
+
*预留参数4
|
|
84
|
+
*
|
|
85
|
+
* @author chitanda
|
|
86
|
+
* @date 2023-09-05 15:09:45
|
|
87
|
+
* @type {unknown}
|
|
88
|
+
*/
|
|
89
|
+
actionparam4?: unknown;
|
|
90
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { IChatMessage } from './i-chat-message/i-chat-message';
|
|
2
|
+
export type { IChatOptions } from './i-chat-options/i-chat-options';
|
|
3
|
+
export type { IMessageItemProvider } from './i-message-item-provider/i-message-item-provider';
|
|
4
|
+
export type { IPortalAsyncAction } from './i-portal-async-action/i-portal-async-action';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
export declare const defaultNamespace = "ibiz";
|
|
2
|
+
/**
|
|
3
|
+
* 全局样式处理命名空间
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2022-09-06 11:09:50
|
|
7
|
+
* @export
|
|
8
|
+
* @class Namespace
|
|
9
|
+
*/
|
|
10
|
+
export declare class Namespace {
|
|
11
|
+
protected block: string;
|
|
12
|
+
/**
|
|
13
|
+
* 命名空间
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2022-09-06 12:09:01
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
namespace: string;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of Namespace.
|
|
22
|
+
*
|
|
23
|
+
* @author chitanda
|
|
24
|
+
* @date 2022-09-06 12:09:12
|
|
25
|
+
* @param {string} block 当前命名空间的根模块,例如组件的名称
|
|
26
|
+
* @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
|
|
27
|
+
*/
|
|
28
|
+
constructor(block: string, namespace?: string);
|
|
29
|
+
/**
|
|
30
|
+
* namespace-block
|
|
31
|
+
* namespace-block-blockSuffix
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2022-09-06 12:09:08
|
|
35
|
+
* @param {string} [blockSuffix='']
|
|
36
|
+
* @return {*} {string}
|
|
37
|
+
*/
|
|
38
|
+
b(blockSuffix?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* namespace-block__element
|
|
41
|
+
*
|
|
42
|
+
* @author chitanda
|
|
43
|
+
* @date 2022-09-06 12:09:48
|
|
44
|
+
* @param {string} [element]
|
|
45
|
+
* @return {*} {string}
|
|
46
|
+
*/
|
|
47
|
+
e(element?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* namespace-block--modifier
|
|
50
|
+
*
|
|
51
|
+
* @author chitanda
|
|
52
|
+
* @date 2022-09-06 12:09:37
|
|
53
|
+
* @param {string} [modifier]
|
|
54
|
+
* @return {*} {string}
|
|
55
|
+
*/
|
|
56
|
+
m(modifier?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* namespace-block-blockSuffix__element
|
|
59
|
+
*
|
|
60
|
+
* @author chitanda
|
|
61
|
+
* @date 2022-09-06 12:09:52
|
|
62
|
+
* @param {string} [blockSuffix]
|
|
63
|
+
* @param {string} [element]
|
|
64
|
+
* @return {*} {string}
|
|
65
|
+
*/
|
|
66
|
+
be(blockSuffix?: string, element?: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* namespace-block__element--modifier
|
|
69
|
+
*
|
|
70
|
+
* @author chitanda
|
|
71
|
+
* @date 2022-09-06 12:09:19
|
|
72
|
+
* @param {string} [element]
|
|
73
|
+
* @param {string} [modifier]
|
|
74
|
+
* @return {*} {string}
|
|
75
|
+
*/
|
|
76
|
+
em(element?: string, modifier?: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* namespace-block-blockSuffix--modifier
|
|
79
|
+
*
|
|
80
|
+
* @author chitanda
|
|
81
|
+
* @date 2022-09-06 12:09:59
|
|
82
|
+
* @param {string} [blockSuffix]
|
|
83
|
+
* @param {string} [modifier]
|
|
84
|
+
* @return {*} {string}
|
|
85
|
+
*/
|
|
86
|
+
bm(blockSuffix?: string, modifier?: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* namespace-block-blockSuffix__element--modifier
|
|
89
|
+
*
|
|
90
|
+
* @author chitanda
|
|
91
|
+
* @date 2022-09-06 12:09:37
|
|
92
|
+
* @param {string} [blockSuffix]
|
|
93
|
+
* @param {string} [element]
|
|
94
|
+
* @param {string} [modifier]
|
|
95
|
+
* @return {*} {string}
|
|
96
|
+
*/
|
|
97
|
+
bem(blockSuffix?: string, element?: string, modifier?: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* 返回状态 class
|
|
100
|
+
*
|
|
101
|
+
* is('loading', false) => '';
|
|
102
|
+
* is('loading', true) => 'is-loading';
|
|
103
|
+
*
|
|
104
|
+
* @author chitanda
|
|
105
|
+
* @date 2022-09-06 12:09:57
|
|
106
|
+
* @param {string} name
|
|
107
|
+
* @param {boolean} [state]
|
|
108
|
+
* @return {*} {string}
|
|
109
|
+
*/
|
|
110
|
+
is(name: string, state?: boolean): string;
|
|
111
|
+
/**
|
|
112
|
+
* 生成使用到的 css 变量 style 对象
|
|
113
|
+
*
|
|
114
|
+
* @author chitanda
|
|
115
|
+
* @date 2022-09-06 15:09:41
|
|
116
|
+
* @param {Record<string, string>} object
|
|
117
|
+
* @return {*} {Record<string, string>}
|
|
118
|
+
*/
|
|
119
|
+
cssVar(object: Record<string, string>): Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* 生成使用到的 css block 变量 style 对象
|
|
122
|
+
*
|
|
123
|
+
* @author chitanda
|
|
124
|
+
* @date 2022-09-06 15:09:03
|
|
125
|
+
* @param {Record<string, string>} object
|
|
126
|
+
* @return {*} {Record<string, string>}
|
|
127
|
+
*/
|
|
128
|
+
cssVarBlock(object: Record<string, string>): Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* 生成 css var 变量名称
|
|
131
|
+
*
|
|
132
|
+
* @author chitanda
|
|
133
|
+
* @date 2022-09-06 15:09:21
|
|
134
|
+
* @param {string} name
|
|
135
|
+
* @return {*} {string}
|
|
136
|
+
*/
|
|
137
|
+
cssVarName(name: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* 生成块 css var 变量名称
|
|
140
|
+
*
|
|
141
|
+
* @author chitanda
|
|
142
|
+
* @date 2022-09-06 15:09:35
|
|
143
|
+
* @param {string} name
|
|
144
|
+
* @return {*} {string}
|
|
145
|
+
*/
|
|
146
|
+
cssVarBlockName(name: string): string;
|
|
147
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 插件静态资源工具类
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2022-11-03 10:11:08
|
|
6
|
+
* @export
|
|
7
|
+
* @class PluginStaticResource
|
|
8
|
+
*/
|
|
9
|
+
export declare class PluginStaticResource {
|
|
10
|
+
/**
|
|
11
|
+
* 计算出的静态资源跟路径
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2022-11-03 10:11:08
|
|
15
|
+
* @protected
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
protected baseDir: string;
|
|
19
|
+
/**
|
|
20
|
+
* 已经输出过路径的 style 标签
|
|
21
|
+
*
|
|
22
|
+
* @author chitanda
|
|
23
|
+
* @date 2023-03-23 10:03:38
|
|
24
|
+
* @protected
|
|
25
|
+
* @type {Map<string, null>}
|
|
26
|
+
*/
|
|
27
|
+
protected styleElementMap: Map<string, null>;
|
|
28
|
+
/**
|
|
29
|
+
* mete 路径解析对象
|
|
30
|
+
*
|
|
31
|
+
* @author chitanda
|
|
32
|
+
* @date 2023-07-06 20:07:36
|
|
33
|
+
* @protected
|
|
34
|
+
* @type {URL}
|
|
35
|
+
*/
|
|
36
|
+
protected url: URL;
|
|
37
|
+
/**
|
|
38
|
+
* 插件静态资源工具类.
|
|
39
|
+
*
|
|
40
|
+
* @author chitanda
|
|
41
|
+
* @date 2022-11-03 10:11:41
|
|
42
|
+
* @param {string} mateUrl import.mate.url
|
|
43
|
+
*/
|
|
44
|
+
constructor(mateUrl: string);
|
|
45
|
+
/**
|
|
46
|
+
* 合并输出静态资源目录
|
|
47
|
+
*
|
|
48
|
+
* @author chitanda
|
|
49
|
+
* @date 2022-11-03 10:11:39
|
|
50
|
+
* @param {string} pathStr
|
|
51
|
+
* @return {*} {string}
|
|
52
|
+
*/
|
|
53
|
+
dir(pathStr: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* 加载样式静态资源
|
|
56
|
+
*
|
|
57
|
+
* @author chitanda
|
|
58
|
+
* @date 2023-03-23 10:03:49
|
|
59
|
+
* @param {string[]} urls
|
|
60
|
+
* @return {*} {Promise<void>}
|
|
61
|
+
*/
|
|
62
|
+
loadStyle(urls: string[]): Promise<void>;
|
|
63
|
+
}
|