@kevisual/kv-login 0.1.0 → 0.1.2
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/dist/app.d.ts +112 -0
- package/dist/app.js +5567 -0
- package/package.json +8 -6
- package/readme.md +2 -19
- package/src/main.ts +4 -1
- package/src/modules/login-handle.ts +26 -1
- package/src/pages/kv-login.ts +2 -1
- package/.cnb.yml +0 -12
- package/bun.config.ts +0 -15
- package/index.html +0 -84
- package/vite.config.ts +0 -15
- package/web.html +0 -93
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
interface EventData<T = any> {
|
|
2
|
+
type: string;
|
|
3
|
+
data: T;
|
|
4
|
+
}
|
|
5
|
+
type EventHandler<T = any> = (event: EventData<T>) => void;
|
|
6
|
+
declare class EventEmitter {
|
|
7
|
+
private events;
|
|
8
|
+
/**
|
|
9
|
+
* 监听事件
|
|
10
|
+
* @param type 事件类型
|
|
11
|
+
* @param handler 事件处理函数
|
|
12
|
+
*/
|
|
13
|
+
on<T = any>(type: string, handler: EventHandler<T>): void;
|
|
14
|
+
/**
|
|
15
|
+
* 移除事件监听器
|
|
16
|
+
* @param type 事件类型
|
|
17
|
+
* @param handler 事件处理函数 (可选,如果不提供则移除该类型的所有监听器)
|
|
18
|
+
*/
|
|
19
|
+
off<T = any>(type: string, handler?: EventHandler<T>): void;
|
|
20
|
+
/**
|
|
21
|
+
* 触发事件
|
|
22
|
+
* @param event 事件对象,包含 type 和 data
|
|
23
|
+
*/
|
|
24
|
+
emit<T = any>(event: EventData<T>): void;
|
|
25
|
+
/**
|
|
26
|
+
* 触发事件(简化版本,直接传递type和data)
|
|
27
|
+
* @param type 事件类型
|
|
28
|
+
* @param data 事件数据
|
|
29
|
+
*/
|
|
30
|
+
emitSimple<T = any>(type: string, data: T): void;
|
|
31
|
+
/**
|
|
32
|
+
* 清空所有事件监听器
|
|
33
|
+
*/
|
|
34
|
+
clear(): void;
|
|
35
|
+
/**
|
|
36
|
+
* 获取指定类型的监听器数量
|
|
37
|
+
* @param type 事件类型
|
|
38
|
+
* @returns 监听器数量
|
|
39
|
+
*/
|
|
40
|
+
listenerCount(type: string): number;
|
|
41
|
+
/**
|
|
42
|
+
* 获取所有事件类型
|
|
43
|
+
* @returns 事件类型数组
|
|
44
|
+
*/
|
|
45
|
+
eventNames(): string[];
|
|
46
|
+
/**
|
|
47
|
+
* 检查是否有指定类型的监听器
|
|
48
|
+
* @param type 事件类型
|
|
49
|
+
* @returns 是否有监听器
|
|
50
|
+
*/
|
|
51
|
+
hasListeners(type: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 只监听一次事件
|
|
54
|
+
* @param type 事件类型
|
|
55
|
+
* @param handler 事件处理函数
|
|
56
|
+
*/
|
|
57
|
+
once<T = any>(type: string, handler: EventHandler<T>): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
declare const loginEmitter: EventEmitter;
|
|
61
|
+
|
|
62
|
+
interface KvMessageOptions {
|
|
63
|
+
type?: 'success' | 'error' | 'loading';
|
|
64
|
+
message: string;
|
|
65
|
+
duration?: number;
|
|
66
|
+
closable?: boolean;
|
|
67
|
+
position?: 'center' | 'right';
|
|
68
|
+
}
|
|
69
|
+
declare class KvMessage extends HTMLElement {
|
|
70
|
+
private options;
|
|
71
|
+
private timer;
|
|
72
|
+
constructor();
|
|
73
|
+
connectedCallback(): void;
|
|
74
|
+
setOptions(options: KvMessageOptions): void;
|
|
75
|
+
private render;
|
|
76
|
+
private setTimer;
|
|
77
|
+
remove(): void;
|
|
78
|
+
disconnectedCallback(): void;
|
|
79
|
+
}
|
|
80
|
+
declare class KvMessageManager {
|
|
81
|
+
private static instance;
|
|
82
|
+
private container;
|
|
83
|
+
private defaultPosition;
|
|
84
|
+
static getInstance(): KvMessageManager;
|
|
85
|
+
setDefaultPosition(position: 'center' | 'right'): void;
|
|
86
|
+
private getContainer;
|
|
87
|
+
show(options: KvMessageOptions): KvMessage;
|
|
88
|
+
success(message: string, options?: {
|
|
89
|
+
duration?: number;
|
|
90
|
+
position?: 'center' | 'right';
|
|
91
|
+
closable?: boolean;
|
|
92
|
+
}): KvMessage;
|
|
93
|
+
error(message: string, options?: {
|
|
94
|
+
duration?: number;
|
|
95
|
+
position?: 'center' | 'right';
|
|
96
|
+
closable?: boolean;
|
|
97
|
+
}): KvMessage;
|
|
98
|
+
loading(message: string, options?: {
|
|
99
|
+
position?: 'center' | 'right';
|
|
100
|
+
closable?: boolean;
|
|
101
|
+
}): KvMessage;
|
|
102
|
+
remove(message: KvMessage): void;
|
|
103
|
+
clear(): void;
|
|
104
|
+
}
|
|
105
|
+
declare const createMessage: () => KvMessageManager;
|
|
106
|
+
declare global {
|
|
107
|
+
interface Window {
|
|
108
|
+
createMessage: typeof createMessage;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export { loginEmitter };
|