hortimagic 1.0.0

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.
@@ -0,0 +1,1239 @@
1
+
2
+ /// <reference path="../types/vite-env.d.ts" />
3
+ /// <reference path="../types/global.d.ts" />
4
+ /// <reference path="../src/components/type.d.ts"/>
5
+ import { CSSResult } from 'lit';
6
+ import { LitElement } from 'lit';
7
+ import { TemplateResult } from 'lit-html';
8
+ import { TinyEmitter } from 'tiny-emitter';
9
+
10
+ /**
11
+ * 向列表加入一个脚本,具有唯一性,名字或链接一样的话就覆盖
12
+ * @param script 要添加的脚本对象
13
+ * @returns 是否添加成功
14
+ */
15
+ declare function addScriptToList(script: Script): boolean;
16
+
17
+ /**
18
+ * 向页面添加一个样式元素
19
+ * @param css css字符串
20
+ */
21
+ declare function addStyle(css: string): void;
22
+
23
+ declare function afterOnmessage(message: string): Promise<string>;
24
+
25
+ declare function afterSend(message: string): string;
26
+
27
+ declare namespace apps {
28
+ export {
29
+ main_app,
30
+ example_app
31
+ }
32
+ }
33
+ export { apps }
34
+
35
+ declare function beforeOnmessage(message: string): Promise<string | null>;
36
+
37
+ declare function beforeSend(message: string): Promise<string | null>;
38
+
39
+ /**
40
+ * 切换房间
41
+ * @param {string} roomId 房间ID
42
+ */
43
+ declare function changeRoom(roomId: string): void;
44
+
45
+ declare namespace components {
46
+ export {
47
+ hm_move_panel,
48
+ hm_icon,
49
+ hm_menu,
50
+ hm_notification,
51
+ hm_button,
52
+ hm_cell,
53
+ hm_swipe_cell,
54
+ hm_switch,
55
+ hm_accordion,
56
+ hm_input,
57
+ hm_dialog
58
+ }
59
+ }
60
+ export { components }
61
+
62
+ /**
63
+ * 去除css字符串中的多余空白字符、注释
64
+ * @param css 要压缩的css字符串
65
+ * @returns 去除空白字符的字符串
66
+ */
67
+ declare function compressCSS(css: string): string;
68
+
69
+ /**
70
+ * 去除html字符串中的多余空白字符、注释
71
+ * @param html 要压缩的html字符串
72
+ * @returns 去除空白字符的字符串
73
+ */
74
+ declare function compressHTML(html: string): string;
75
+
76
+ declare namespace core {
77
+ export {
78
+ tools,
79
+ iirose_socket,
80
+ eventEmitter,
81
+ Message,
82
+ encoder,
83
+ decoder,
84
+ elements_hooks,
85
+ script_tools
86
+ }
87
+ }
88
+ export { core }
89
+
90
+ declare class Danmu {
91
+ /** */
92
+ username: string;
93
+ /** */
94
+ avatar: string;
95
+ /** */
96
+ message: string;
97
+ /** */
98
+ color: string;
99
+ /** */
100
+ gender: string;
101
+ /** */
102
+ timeStamp: string;
103
+ /** */
104
+ uid: string;
105
+ /** 消息类型 */
106
+ readonly messageClass = "danmu";
107
+ }
108
+
109
+ /**
110
+ * 生成弹幕消息
111
+ * @param message 消息
112
+ * @param color 颜色
113
+ * @param v v,默认是0
114
+ * @returns 返回格式化好的弹幕消息
115
+ */
116
+ declare function danmu(message: string, color: string, v?: string): string;
117
+
118
+ declare function decodeMessage(message: string): void;
119
+
120
+ declare namespace decoder {
121
+ export {
122
+ messageObjList,
123
+ decodeMessage
124
+ }
125
+ }
126
+
127
+ export declare namespace dialog {
128
+ export {
129
+ initDialogHolder,
130
+ dialogHolder
131
+ }
132
+ }
133
+
134
+ /** 移动面板容器 */
135
+ declare let dialogHolder: HTMLDivElement;
136
+
137
+ /** 原来界面的元素 */
138
+ declare let elements: {
139
+ /** 移动窗口父元素,移动窗口容器 */
140
+ movePanelHolder: Element | null;
141
+ /** 侧边菜单按钮 */
142
+ functionHolder: Element | null;
143
+ /** 侧边菜单按钮列表 */
144
+ functionButtonGroupList: Element[];
145
+ /** 主消息列表的父元素 */
146
+ msgholderBox: Element | null;
147
+ /** home界面的消息列表父元素 */
148
+ homeHolderMsgBox: Element | null;
149
+ /** 最近会话列表 */
150
+ sessionHolderPmTaskBoxItems: Element[];
151
+ /** 主输入元素盒子 */
152
+ moveinputDisplay: Element | null;
153
+ /** 主输入元素 */
154
+ moveinput: HTMLElement | null;
155
+ /** 可以打开home界面 */
156
+ moveinputSendBtnFunc: Element | null;
157
+ /** 发送按钮 */
158
+ moveinputSendBtnSend: Element | null;
159
+ };
160
+
161
+ declare namespace elements_hooks {
162
+ export {
163
+ elements,
164
+ refreshAll,
165
+ Hooks,
166
+ initHooks
167
+ }
168
+ }
169
+
170
+ /**
171
+ * 事件触发器
172
+ */
173
+ declare let emitter: TinyEmitter;
174
+
175
+ declare namespace encoder {
176
+ export {
177
+ publicChat,
178
+ privateChat,
179
+ hidden,
180
+ musicCard,
181
+ videoCard,
182
+ like,
183
+ danmu,
184
+ withdrawn,
185
+ stockRequest
186
+ }
187
+ }
188
+
189
+ declare namespace eventEmitter {
190
+ export {
191
+ TinyEmitter,
192
+ emitter
193
+ }
194
+ }
195
+
196
+ export declare namespace example_app {
197
+ export {
198
+ initExampleApp
199
+ }
200
+ }
201
+
202
+ /**
203
+ * 创造一个新的私聊气泡,搭配静默发送私聊消息才能和“正常一样使用。
204
+ * @param {string} targetUid 目标UID
205
+ * @param {string} content 正文
206
+ * @param {string} messageId 消息气泡的ID
207
+ */
208
+ declare function generatePrivateMessageBubble(targetUid: string, content: string, messageId: string): void;
209
+
210
+ /**
211
+ * 获取所有在线用户的信息
212
+ * @returns 用户消息列表
213
+ */
214
+ declare function getAllOnlineUserInfo(): {
215
+ name: any;
216
+ uid: any;
217
+ color: any;
218
+ avatar: any;
219
+ roomId: any;
220
+ personalizedSignature: any;
221
+ }[] | null;
222
+
223
+ declare function getIcon(name: string): string;
224
+
225
+ /**
226
+ * 通过uid获取在线用户的信息
227
+ * @param {string} uid
228
+ * @returns 用户消息
229
+ */
230
+ declare function getOnlineUserInfoById(uid: string): {
231
+ name: string;
232
+ uid: string;
233
+ color: string;
234
+ avatar: string;
235
+ roomId: string;
236
+ personalizedSignature: string;
237
+ } | null;
238
+
239
+ /**
240
+ * 获取当前房间ID
241
+ * @returns 返回当前用户的UID,没找到返回null
242
+ */
243
+ declare function getRoomId(): string | null;
244
+
245
+ /**
246
+ * 通过房间id返回房间消息
247
+ * @param roomId 房间的id
248
+ * @returns 返回返回消息
249
+ */
250
+ declare function getRoomInfoById(roomId: string): {
251
+ name: string;
252
+ roomPath: Array<string>;
253
+ color: string;
254
+ description: string;
255
+ roomImage: string;
256
+ currentUserNum: number | "hidden";
257
+ ownerName: string;
258
+ member: Array<{
259
+ name: string;
260
+ auth: "member" | "admin" | "unknow";
261
+ }>;
262
+ } | null;
263
+
264
+ /**
265
+ * 获取用户蔷薇输入颜色
266
+ * @returns 获取不到返回null
267
+ */
268
+ declare function getUserInputColor(): string | null;
269
+
270
+ /**
271
+ * 获取当前用户的名字
272
+ * @returns 返回当前用户的名字,没找到返回null
273
+ */
274
+ declare function getUserName(): string | null;
275
+
276
+ /**
277
+ * 获取用户蔷薇头像url
278
+ * @returns {string}
279
+ */
280
+ declare function getUserProfilePictureUrl(): string | null;
281
+
282
+ /**
283
+ * 获取当前用户的UID
284
+ * @returns 返回当前用户的UID,没找到返回null
285
+ */
286
+ declare function getUserUid(): string | null;
287
+
288
+ declare class Hidden {
289
+ /** */
290
+ messageName: string;
291
+ /** */
292
+ uid: string;
293
+ /** */
294
+ data: string;
295
+ /** 消息类型 */
296
+ readonly messageClass = "hidden";
297
+ }
298
+
299
+ /**
300
+ * 生成隐藏的消息
301
+ * @param messageNmae 消息的标题或者名字
302
+ * @param uid 要发送的对象
303
+ * @param data 消息数据
304
+ * @returns 返回生成的数据
305
+ */
306
+ declare function hidden(messageNmae: string, uid: string, data: string): string;
307
+
308
+ export declare namespace hm_accordion {
309
+ export {
310
+ HmAccordion
311
+ }
312
+ }
313
+
314
+ export declare namespace hm_button {
315
+ export {
316
+ HmButton
317
+ }
318
+ }
319
+
320
+ export declare namespace hm_cell {
321
+ export {
322
+ HmCell
323
+ }
324
+ }
325
+
326
+ export declare namespace hm_dialog {
327
+ export {
328
+ HmDialog
329
+ }
330
+ }
331
+
332
+ export declare namespace hm_icon {
333
+ export {
334
+ registerIcon,
335
+ getIcon,
336
+ HmIcon
337
+ }
338
+ }
339
+
340
+ export declare namespace hm_input {
341
+ export {
342
+ HmInput
343
+ }
344
+ }
345
+
346
+ export declare namespace hm_menu {
347
+ export {
348
+ HmMenu
349
+ }
350
+ }
351
+
352
+ export declare namespace hm_move_panel {
353
+ export {
354
+ movePanelItemList,
355
+ movePanelItemMaxZindex,
356
+ HmMovePanel
357
+ }
358
+ }
359
+
360
+ export declare namespace hm_notification {
361
+ export {
362
+ HmNotification
363
+ }
364
+ }
365
+
366
+ export declare namespace hm_swipe_cell {
367
+ export {
368
+ HmSwipeCell
369
+ }
370
+ }
371
+
372
+ export declare namespace hm_switch {
373
+ export {
374
+ HmSwitch
375
+ }
376
+ }
377
+
378
+ /**
379
+ * @example
380
+ * <hm-accordion>
381
+ <span slot="header">我的折叠面板</span>
382
+ <div>内容项 1</div>
383
+ <div>内容项 2</div>
384
+ </hm-accordion>
385
+ */
386
+ declare class HmAccordion extends LitElement {
387
+ maxHeight: string;
388
+ items: any[];
389
+ /** 是否展开 */
390
+ expanded: boolean;
391
+ static styles: CSSResult;
392
+ /** 开关容器 */
393
+ togglePanel(): void;
394
+ render(): TemplateResult<1>;
395
+ }
396
+
397
+ /**
398
+ * 按钮组件
399
+ *
400
+ * @example
401
+ * ```html
402
+ * <!-- 基础用法 -->
403
+ * <hm-button content="普通按钮"></hm-button>
404
+ *
405
+ * <!-- 带图标按钮 -->
406
+ * <hm-button icon="plus" content="添加"></hm-button>
407
+ *
408
+ * <!-- 自定义颜色 -->
409
+ * <hm-button
410
+ * content="自定义样式"
411
+ * color="#ffffff"
412
+ * background="#4caf50">
413
+ * </hm-button>
414
+ *
415
+ * <!-- 禁用状态 -->
416
+ * <hm-button content="禁用按钮" .enable="${false}"></hm-button>
417
+ *
418
+ * <!-- 加载状态 -->
419
+ * <hm-button content="加载中" .loading="${true}"></hm-button>
420
+ *
421
+ * <!-- 自定义尺寸 -->
422
+ * <hm-button content="大按钮" width="200px" height="50px"></hm-button>
423
+ * <hm-button content="小按钮" width="60px" height="30px" fontSize="8px"></hm-button>
424
+ * ```
425
+ */
426
+ declare class HmButton extends LitElement {
427
+ /** 按钮图标 */
428
+ icon: string;
429
+ /** 按钮文字内容 */
430
+ content: string;
431
+ /** 字体大小 */
432
+ fontSize: string;
433
+ /** 字体颜色 */
434
+ color: string;
435
+ /** 背景颜色 */
436
+ background: string;
437
+ width: string;
438
+ height: string;
439
+ /** 是否启用 */
440
+ enable: boolean;
441
+ /** 是否加载中 */
442
+ loading: boolean;
443
+ static styles: CSSResult;
444
+ render(): TemplateResult<1>;
445
+ private _handleClick;
446
+ }
447
+
448
+ /**
449
+ * 单元格组件
450
+ * 用于展示列表内容或选项,采用左右分栏布局
451
+ *
452
+ * @slot title - 标题内容(左侧)
453
+ * @slot description - 描述信息(左侧)
454
+ * @slot content - 主要内容(右侧)
455
+ *
456
+ * @cssprop --hm-cell-padding - 内边距
457
+ * @cssprop --hm-cell-border - 边框样式
458
+ * @cssprop --hm-cell-background - 背景颜色
459
+ *
460
+ * @example
461
+ * ```html
462
+ * <!-- 基础用法 -->
463
+ * <hm-cell
464
+ * titleName="单元格标题"
465
+ * descripthion="这是描述信息"
466
+ * content="内容区域">
467
+ * </hm-cell>
468
+ *
469
+ * <!-- 使用插槽自定义内容 -->
470
+ * <hm-cell>
471
+ * <div slot="title">自定义标题</div>
472
+ * <div slot="description">自定义描述</div>
473
+ * <div slot="content">自定义内容</div>
474
+ * </hm-cell>
475
+ *
476
+ * <!-- 带点击事件 -->
477
+ * <hm-cell
478
+ * titleName="可点击标题"
479
+ * content="点击查看详情"
480
+ * .titleClickCallback="${() => console.log('标题被点击')}"
481
+ * .contentClickCallback="${() => console.log('内容被点击')}">
482
+ * </hm-cell>
483
+ *
484
+ * <!-- 自定义样式 -->
485
+ * <hm-cell
486
+ * titleName="自定义样式"
487
+ * content="特殊样式"
488
+ * style="--hm-cell-background: #f0f8ff; --hm-cell-title-color: #1890ff;">
489
+ * </hm-cell>
490
+ * ```
491
+ */
492
+ declare class HmCell extends LitElement {
493
+ /** 标题,使用slot后失效 */
494
+ titleName: string;
495
+ /** 标题下方描述,使用slot后失效 */
496
+ descripthion: string;
497
+ /** 右侧正文,使用slot后失效 */
498
+ content: string;
499
+ /** 标题点击回调函数 */
500
+ titleClickCallback: () => void;
501
+ /** 正文点击回调函数 */
502
+ contentClickCallback: () => void;
503
+ render(): TemplateResult<1>;
504
+ static styles: CSSResult;
505
+ }
506
+
507
+ /**
508
+ * @example
509
+ * <hm-dialog isopen>
510
+ * <h2>对话框标题</h2>
511
+ * <p>这是对话框内容</p>
512
+ * </hm-dialog>
513
+ *
514
+ * @example
515
+ * <hm-dialog>
516
+ * <h2>带自定义按钮的对话框</h2>
517
+ * <p>这是对话框内容</p>
518
+ * <div slot="footer">
519
+ * <hm-button @click="handleCancel">取消</hm-button>
520
+ * <hm-button @click="handleConfirm">确定</hm-button>
521
+ * </div>
522
+ * </hm-dialog>
523
+ */
524
+ declare class HmDialog extends LitElement {
525
+ static styles: CSSResult;
526
+ isOpen: boolean;
527
+ dialog: this;
528
+ open(): void;
529
+ close(): void;
530
+ /** 确认,触发 dialog-close dialog-confirm事件*/
531
+ confirm(): void;
532
+ /** 取消,触发 dialog-close dialog-cancel事件*/
533
+ cancel(): void;
534
+ updated(changedProperties: Map<string, unknown>): void;
535
+ render(): TemplateResult<1>;
536
+ }
537
+
538
+ declare class HmIcon extends LitElement {
539
+ icon: string;
540
+ size: string;
541
+ /** 触发点击事件 */
542
+ handelClick(): void;
543
+ static styles: CSSResult;
544
+ render(): TemplateResult<1>;
545
+ }
546
+
547
+ /**
548
+ * @example <caption>基本使用</caption>
549
+ * <hm-input label="用户名" placeholder="请输入用户名"></hm-input>
550
+ *
551
+ * @example <caption>带图标的输入框</caption>
552
+ * <hm-input label="密码" icon="password" placeholder="请输入密码"></hm-input>
553
+ *
554
+ * @example <caption>禁用状态</caption>
555
+ * <hm-input label="禁用输入框" value="已禁用" enable="false"></hm-input>
556
+ *
557
+ * @example <caption>只读状态</caption>
558
+ * <hm-input label="只读输入框" value="只读内容" readonly="true"></hm-input>
559
+ */
560
+ declare class HmInput extends LitElement {
561
+ type: string;
562
+ /** 按钮图标 */
563
+ icon: string;
564
+ /** 输入框标签 */
565
+ label: string;
566
+ /** 占位符文本 */
567
+ placeholder: string;
568
+ /** 是否启用 */
569
+ enable: boolean;
570
+ readonly: boolean;
571
+ value: string;
572
+ static styles: CSSResult;
573
+ private _handleKeyDown;
574
+ private _handleInput;
575
+ render(): TemplateResult<1>;
576
+ }
577
+
578
+ declare class HmMenu extends LitElement {
579
+ icon: string;
580
+ content: string;
581
+ flag: boolean;
582
+ isMenuItem: boolean;
583
+ static styles: CSSResult;
584
+ /** 触发点击事件 */
585
+ handleClick(): void;
586
+ render(): TemplateResult<1>;
587
+ }
588
+
589
+ /** 移动面板组件 */
590
+ declare class HmMovePanel extends LitElement {
591
+ /** 主内容区宽 */
592
+ width: number;
593
+ /** 主内容区高 */
594
+ height: number;
595
+ headerBackgroundColor: string;
596
+ headerColor: string;
597
+ bodyBackgroundColor: string;
598
+ bodyColor: string;
599
+ footerBackgroundColor: string;
600
+ buttonBackgroundColor: string;
601
+ buttonColor: string;
602
+ /** 标题 */
603
+ titleContent: string;
604
+ leftButtonText: string;
605
+ rightButtonText: string;
606
+ /** 显示状态,不建议直接修改,请使用show()和hide()方法,否则无法触发对应事件 */
607
+ isDisplay: boolean;
608
+ zIndex: number;
609
+ /** 左上角图标 */
610
+ icon: string;
611
+ left: number;
612
+ top: number;
613
+ handleLeftClick(): void;
614
+ handleRightClick(): void;
615
+ /**
616
+ * 组件内部的body元素
617
+ */
618
+ body: Promise<HTMLDivElement>;
619
+ static styles: CSSResult;
620
+ constructor();
621
+ /** 关闭移动窗口 */
622
+ hideMovePanel(): void;
623
+ /** 显示移动窗口 */
624
+ showMovePanel(): void;
625
+ /** 显示状态翻转 */
626
+ toogleDisplay(): void;
627
+ dragging: boolean;
628
+ mouseDragging(e: MouseEvent): void;
629
+ touchDragging(e: TouchEvent): void;
630
+ putTop(): boolean;
631
+ /**
632
+ * 切换元素的置顶状态和显示状态
633
+ *
634
+ * 当元素的zIndex不等于最大移动面板层级时,将元素置于顶层并显示移动面板;
635
+ * 当元素的zIndex等于最大移动面板层级时,切换元素的显示状态
636
+ */
637
+ putTopToggel(): void;
638
+ render(): TemplateResult<1>;
639
+ _handleClose(): void;
640
+ _handleLeftButtonClick(): void;
641
+ _handleRightButtonClick(): void;
642
+ }
643
+
644
+ /** 通知消息组件
645
+ * @example
646
+ * ```html
647
+ * <!-- 基础用法 -->
648
+ <hm-notification
649
+ title="提示"
650
+ content="这是一条通知信息">
651
+ </hm-notification>
652
+
653
+ <!-- 自定义颜色 -->
654
+ <hm-notification
655
+ title="成功"
656
+ content="操作成功"
657
+ text-color="#ffffff"
658
+ background-color="#4caf50">
659
+ </hm-notification>
660
+
661
+ <!-- 自定义显示时间(3秒) -->
662
+ <hm-notification
663
+ title="提示"
664
+ content="这条信息显示3秒"
665
+ display-time="3000">
666
+ </hm-notification>
667
+ ```
668
+ */
669
+ declare class HmNotification extends LitElement {
670
+ /** 左边图标 */
671
+ leftIcon: string;
672
+ /** 标题 */
673
+ title: string;
674
+ /** 正文 */
675
+ content: string;
676
+ /** 右边图标*/
677
+ rightIcon: string;
678
+ /** 显示时间,单位毫秒 */
679
+ displayTime: number;
680
+ color: string;
681
+ backgroundColor: string;
682
+ static styles: CSSResult;
683
+ firstUpdated(): void;
684
+ private startLeaveAnimation;
685
+ render(): TemplateResult<1>;
686
+ }
687
+
688
+ /**
689
+ * 滑动单元格组件
690
+ * 实现左右滑动显示操作按钮的交互效果
691
+ *
692
+ * @slot content - 主内容区域
693
+ * @slot left-actions - 左侧操作按钮组
694
+ * @slot right-actions - 右侧操作按钮组
695
+ *
696
+ * @example
697
+ * <hm-swipe-cell>
698
+ * <!-- 主内容 -->
699
+ * <div slot="content">...</div>
700
+ * <!-- 左侧操作按钮 -->
701
+ * <div slot="left-actions">...</div>
702
+ * <!-- 右侧操作按钮 -->
703
+ * <div slot="right-actions">...</div>
704
+ * </hm-swipe-cell>
705
+ */
706
+ declare class HmSwipeCell extends LitElement {
707
+ _isDragging: boolean;
708
+ _startX: number;
709
+ _currentTranslate: number;
710
+ _prevTranslate: number;
711
+ _animationId: number;
712
+ _velocity: number;
713
+ _lastX: number;
714
+ _lastTime: number;
715
+ _isOpen: boolean;
716
+ rightButtonName: string;
717
+ /**
718
+ * 右边按钮点击回调函数
719
+ */
720
+ rightButtonCallback: () => void;
721
+ sliderElement: HTMLElement;
722
+ contentElement: HTMLElement;
723
+ leftActions: HTMLElement;
724
+ rightActions: HTMLElement;
725
+ leftActionsWidth: number;
726
+ rightActionsWidth: number;
727
+ static styles: CSSResult;
728
+ firstUpdated(): void;
729
+ disconnectedCallback(): void;
730
+ calculateActionWidths(): void;
731
+ addEventListeners(): void;
732
+ removeEventListeners(): void;
733
+ onDragStart: (e: MouseEvent) => void;
734
+ onTouchStart: (e: TouchEvent) => void;
735
+ startDrag: (clientX: number) => void;
736
+ onDragMove: (e: MouseEvent) => void;
737
+ onTouchMove: (e: TouchEvent) => void;
738
+ handleMove(currentX: number): void;
739
+ easeOut(overshoot: number, maxResistance: number): number;
740
+ onDragEnd: () => void;
741
+ onTouchEnd: () => void;
742
+ finishDrag(): void;
743
+ updateSliderPosition(): void;
744
+ render(): TemplateResult<1>;
745
+ }
746
+
747
+ /**
748
+ * 滑动开关组件
749
+ *
750
+ * @example
751
+ * ```html
752
+ * <!-- 基础用法 -->
753
+ * <hm-switch></hm-switch>
754
+ *
755
+ * <!-- 默认开启 -->
756
+ * <hm-switch checked></hm-switch>
757
+ *
758
+ * <!-- 禁用状态 -->
759
+ * <hm-switch disabled></hm-switch>
760
+ *
761
+ * <!-- 加载状态 -->
762
+ * <hm-switch loading></hm-switch>
763
+ *
764
+ * <!-- 自定义颜色 -->
765
+ * <hm-switch color="#ff4757"></hm-switch>
766
+ *
767
+ * <!-- 带图标 -->
768
+ * <hm-switch openIcon="check" closeIcon="close"></hm-switch>
769
+ *
770
+ * <!-- 监听状态变化 -->
771
+ * <hm-switch @hm-switch-change="${(e) => console.log('开关状态:', e.detail.checked)}"></hm-switch>
772
+ * ```
773
+ */
774
+ declare class HmSwitch extends LitElement {
775
+ /** 开关状态 */
776
+ checked: boolean;
777
+ /** 是否禁用 */
778
+ disabled: boolean;
779
+ /** 加载状态 */
780
+ loading: boolean;
781
+ /** 开关打开时的颜色 */
782
+ color: string;
783
+ /** 自定义开启状态内容 */
784
+ openContent: string;
785
+ /** 自定义关闭状态内容 */
786
+ closeContent: string;
787
+ /** 自定义开启状态图标 */
788
+ openIcon: string;
789
+ /** 自定义关闭状态图标 */
790
+ closeIcon: string;
791
+ change(): void;
792
+ render(): TemplateResult<1>;
793
+ static styles: CSSResult;
794
+ }
795
+
796
+ declare namespace holders {
797
+ export {
798
+ move_panel,
799
+ menu,
800
+ notification,
801
+ dialog
802
+ }
803
+ }
804
+ export { holders }
805
+
806
+ /** 钩子函数 */
807
+ declare let Hooks: {
808
+ elementHooks: {
809
+ moveinput: {
810
+ oninputBefore: () => boolean;
811
+ oninputAfter: () => boolean;
812
+ onblurBefore: () => boolean;
813
+ onblurAfter: () => boolean;
814
+ onfocusBefore: () => boolean;
815
+ onfocusAfter: () => boolean;
816
+ };
817
+ };
818
+ functionHooks: {
819
+ processer: {
820
+ onBefore: (e: any, s: any, t: any, r: any) => boolean;
821
+ onAfter: (e: any, s: any, t: any, r: any) => boolean;
822
+ };
823
+ };
824
+ replaceMoveinput: () => void;
825
+ replaceButtonProcesser: () => void;
826
+ };
827
+
828
+ /**
829
+ * html特殊符号反转义
830
+ * @param {string} e
831
+ * @returns {string}
832
+ */
833
+ declare function htmlSpecialCharsDecode(e: string): string;
834
+
835
+ /**
836
+ * html特殊符号转义
837
+ * @param {string} e
838
+ * @returns {string}
839
+ */
840
+ declare function htmlSpecialCharsEscape(e: string): string;
841
+
842
+ declare namespace iirose_socket {
843
+ export {
844
+ sockets,
845
+ initSocket
846
+ }
847
+ }
848
+
849
+ /** package配置信息 */
850
+ export declare const information: {
851
+ /** 项目名称 */
852
+ name: string;
853
+ /** 项目版本 */
854
+ version: string;
855
+ /** 项目描述 */
856
+ description: string;
857
+ /** 项目作者 */
858
+ author: string;
859
+ /** 项目许可证 */
860
+ license: string;
861
+ /** 项目仓库 */
862
+ repository: {
863
+ type: string;
864
+ url: string;
865
+ };
866
+ /** 项目构建时间 */
867
+ buildTime: string;
868
+ };
869
+
870
+ /**
871
+ * 读取本地脚本列表并注入
872
+ */
873
+ declare function ingectlocalScript(): void;
874
+
875
+ declare function init(): Promise<void>;
876
+
877
+ /** 初始化移动面板容器 */
878
+ declare function initDialogHolder(): void;
879
+
880
+ declare function initExampleApp(): Promise<HmMenu>;
881
+
882
+ /**
883
+ * 注入钩子函数
884
+ */
885
+ declare function initHooks(): void;
886
+
887
+ declare function initMenuHolder(): void;
888
+
889
+ /** 初始化移动面板容器 */
890
+ declare function initMovePanelHolder(): void;
891
+
892
+ /** 初始化通知容器 */
893
+ declare function initNotificationHolder(): void;
894
+
895
+ declare function initSocket(): Promise<void>;
896
+
897
+ /**
898
+ * 注入一个JS脚本
899
+ * @param script 要注入的脚本对象
900
+ */
901
+ declare function injectScript(script: Script): boolean;
902
+
903
+ /**
904
+ * 注入一组JS脚本
905
+ * @param list 脚本列表
906
+ */
907
+ declare function injectScriptList(list: Script[]): void;
908
+
909
+ /**
910
+ * 编码点赞消息
911
+ * @param targetUid 目标id
912
+ * @param content 正文
913
+ * @returns 格式化好的消息
914
+ */
915
+ declare function like(targetUid: string, content?: string): string;
916
+
917
+ export declare namespace main_app {
918
+ export {
919
+ init
920
+ }
921
+ }
922
+
923
+ export declare namespace menu {
924
+ export {
925
+ initMenuHolder,
926
+ menuHolder
927
+ }
928
+ }
929
+
930
+ declare let menuHolder: HTMLDivElement;
931
+
932
+ declare namespace Message {
933
+ export {
934
+ Public,
935
+ Private,
936
+ Hidden,
937
+ Danmu,
938
+ Withdrawn,
939
+ System,
940
+ Stock,
941
+ Unkonw
942
+ }
943
+ }
944
+
945
+ /** 解析好后的消息列表 */
946
+ declare let messageObjList: (Public | Private | Hidden | Danmu | Withdrawn | System | Stock | Unkonw)[];
947
+
948
+ export declare namespace move_panel {
949
+ export {
950
+ initMovePanelHolder,
951
+ movePanelHolder
952
+ }
953
+ }
954
+
955
+ /** 移动面板容器 */
956
+ declare let movePanelHolder: HTMLDivElement;
957
+
958
+ /** 创建的窗口列表 */
959
+ declare let movePanelItemList: HmMovePanel[];
960
+
961
+ /** 窗口基础的层级,每新建一个加一,从99999开始加 */
962
+ declare let movePanelItemMaxZindex: number;
963
+
964
+ /**
965
+ * 生成一个音乐卡片消息
966
+ * @param typeId 音乐平台从0开始
967
+ * @param title 音乐名字
968
+ * @param singerName 歌手名字
969
+ * @param coverUrl 封面图片链接
970
+ * @param color 颜色
971
+ * @param resolutionRatio 音乐的压缩率
972
+ */
973
+ declare function musicCard(typeId: string, title: string, singerName: string, coverUrl: string, color: string, resolutionRatio: string): string;
974
+
975
+ declare let notice: {
976
+ success(title: string, content: string, displayTime?: number): void;
977
+ warning(title: string, content: string, displayTime?: number): void;
978
+ error(title: string, content: string, displayTime?: number): void;
979
+ normal(title: string, content: string, displayTime?: number): void;
980
+ };
981
+
982
+ export declare namespace notification {
983
+ export {
984
+ initNotificationHolder,
985
+ notificationHolder,
986
+ notice
987
+ }
988
+ }
989
+
990
+ /** 渲染的容器元素 */
991
+ declare let notificationHolder: HTMLDivElement;
992
+
993
+ declare function onmessage_2(message: string): Promise<void>;
994
+
995
+ declare function originalOnmessage(message: string): string;
996
+
997
+ declare function originalSend(message: string): string;
998
+
999
+ declare class Private {
1000
+ /** 时间戳 */
1001
+ timeStamp: string;
1002
+ /** 头像链接 */
1003
+ headPortrait: string;
1004
+ /** 名字 */
1005
+ name: string;
1006
+ /** 消息 */
1007
+ message: string;
1008
+ /** 消息颜色 */
1009
+ color: string;
1010
+ /** 性别 */
1011
+ gender: string;
1012
+ /** 唯一标识UID */
1013
+ uid: string;
1014
+ /** 消息唯一标识 */
1015
+ messageUid: string;
1016
+ /** 消息类型 */
1017
+ readonly messageClass = "private";
1018
+ }
1019
+
1020
+ /**
1021
+ * 生成隐藏发送的私聊消息,自己看不到
1022
+ * @param uid 对方的UID
1023
+ * @param message 消息
1024
+ * @param color 消息颜色
1025
+ * @returns 返回格式化好的消息
1026
+ */
1027
+ declare function privateChat(uid: string, message: string, color: string): string;
1028
+
1029
+ declare class Public {
1030
+ /** 时间戳 */
1031
+ timeStamp: string;
1032
+ /** 头像链接 */
1033
+ headPortrait: string;
1034
+ /** 名字 */
1035
+ name: string;
1036
+ /** 消息 */
1037
+ message: string;
1038
+ /** 消息气泡背景颜色 */
1039
+ color: string;
1040
+ /** 性别 */
1041
+ gender: string;
1042
+ /** 唯一标识 */
1043
+ uid: string;
1044
+ /** 称号 */
1045
+ designation: string;
1046
+ /** 消息UID */
1047
+ messageUid: string;
1048
+ /** 消息类别 */
1049
+ readonly messageClass = "public";
1050
+ }
1051
+
1052
+ /**
1053
+ * 生成公屏消息
1054
+ * @param message 消息
1055
+ * @param color 消息颜色
1056
+ * @returns 返回格式化好的消息
1057
+ */
1058
+ declare function publicChat(message: string, color: string): string;
1059
+
1060
+ /**
1061
+ * 读取本地存储的脚本列表
1062
+ */
1063
+ declare function readScriptList(): void;
1064
+
1065
+ /**
1066
+ * 更新一些element
1067
+ */
1068
+ declare function refreshAll(): void;
1069
+
1070
+ declare function registerIcon(name: string, svgContent: string): void;
1071
+
1072
+ /** 从列表中移除一个脚本
1073
+ * @param script 要移除的脚本对象
1074
+ */
1075
+ declare function removeScriptFromList(script: Script): void;
1076
+
1077
+ /**
1078
+ * 保存脚本列表到本地存储
1079
+ */
1080
+ declare function saveScriptList(): void;
1081
+
1082
+ /**
1083
+ * 脚本类
1084
+ */
1085
+ declare class Script {
1086
+ /** 名字 */
1087
+ name: string;
1088
+ /** 唯一链接 */
1089
+ url: string;
1090
+ /** 是否启用,默认启用 */
1091
+ enable: boolean;
1092
+ /** 是否已经注入,手动修改 */
1093
+ ingected: boolean;
1094
+ constructor(name: string, url: string, enable?: boolean, ingected?: boolean);
1095
+ }
1096
+
1097
+ declare namespace script_tools {
1098
+ export {
1099
+ Script,
1100
+ scriptList,
1101
+ addScriptToList,
1102
+ removeScriptFromList,
1103
+ injectScript,
1104
+ injectScriptList,
1105
+ readScriptList,
1106
+ saveScriptList,
1107
+ ingectlocalScript
1108
+ }
1109
+ }
1110
+
1111
+ /** 脚本列表 */
1112
+ declare let scriptList: Script[];
1113
+
1114
+ declare function send(message: string): Promise<void>;
1115
+
1116
+ /**
1117
+ * 异步延时函数
1118
+ * @param ms
1119
+ */
1120
+ declare function sleep(ms: number): Promise<unknown>;
1121
+
1122
+ declare const sockets: {
1123
+ beforeSend: typeof beforeSend;
1124
+ originalSend: typeof originalSend;
1125
+ afterSend: typeof afterSend;
1126
+ send: typeof send;
1127
+ beforeOnmessage: typeof beforeOnmessage;
1128
+ originalOnmessage: typeof originalOnmessage;
1129
+ afterOnmessage: typeof afterOnmessage;
1130
+ onmessage: typeof onmessage_2;
1131
+ initSocket: typeof initSocket;
1132
+ };
1133
+
1134
+ declare class Stock {
1135
+ /**
1136
+ * '*' 表示股价过低无法买股票
1137
+ * '>' 表示卖出的股票超出数量
1138
+ * '<' 表示余额不够
1139
+ * 数字表示正常
1140
+ */
1141
+ result: string;
1142
+ /** 股价 */
1143
+ stockPrice: number;
1144
+ /** 总股数 */
1145
+ totalStock: number;
1146
+ /** 持股数 */
1147
+ holdingAmount: number;
1148
+ /** 总金 */
1149
+ totalEquity: number;
1150
+ /** 账户余额 */
1151
+ balance: number;
1152
+ /** 消息类型 */
1153
+ readonly messageClass = "stock";
1154
+ }
1155
+
1156
+ /**
1157
+ * 生成股票请求消息
1158
+ * @param count 股票数量,不填或等于0时返回正常查看
1159
+ * @returns
1160
+ */
1161
+ declare function stockRequest(count: number | undefined): string;
1162
+
1163
+ /**
1164
+ * 切换房间
1165
+ * @param {string} roomId
1166
+ */
1167
+ declare function switchRoom(roomId: string): void;
1168
+
1169
+ declare class System {
1170
+ /** 消息列表 */
1171
+ userMessageList: string[];
1172
+ /** 消息类型 */
1173
+ readonly messageClass = "system";
1174
+ }
1175
+
1176
+ declare namespace tools {
1177
+ export {
1178
+ sleep,
1179
+ compressHTML,
1180
+ compressCSS,
1181
+ addStyle,
1182
+ htmlSpecialCharsEscape,
1183
+ htmlSpecialCharsDecode,
1184
+ getUserName,
1185
+ getUserUid,
1186
+ getRoomId,
1187
+ getRoomInfoById,
1188
+ getOnlineUserInfoById,
1189
+ getAllOnlineUserInfo,
1190
+ changeRoom,
1191
+ getUserProfilePictureUrl,
1192
+ getUserInputColor,
1193
+ generatePrivateMessageBubble,
1194
+ switchRoom
1195
+ }
1196
+ }
1197
+
1198
+ declare class Unkonw {
1199
+ /** 未知消息的原型 */
1200
+ message: string;
1201
+ /** 消息类型 */
1202
+ readonly messageClass = "unkonw";
1203
+ }
1204
+
1205
+ /**
1206
+ * 生成一个视频卡片消息
1207
+ * @param typeId 视频平台从0开始
1208
+ * @param title 视频名字
1209
+ * @param singerName 制作者名字
1210
+ * @param coverUrl 封面图片链接
1211
+ * @param color 颜色
1212
+ * @param resolutionRatio 分辨率,64会被识别成1080p
1213
+ */
1214
+ declare function videoCard(typeId: string, title: string, singerName: string, coverUrl: string, color: string, resolutionRatio: string, time: string): string;
1215
+
1216
+ declare class Withdrawn {
1217
+ /** 可选的,撤回私聊对象窗口的UID */
1218
+ privateUID: string;
1219
+ /** 需要要撤回的气泡用户uid */
1220
+ uid: string;
1221
+ /** 消息唯一标识,一串随机数 */
1222
+ messageUid: string;
1223
+ /** 数据唯一标识,上面两个组合在一起 */
1224
+ dataUid: string;
1225
+ /** 消息类型 */
1226
+ readonly messageClass = "withdrawn";
1227
+ }
1228
+
1229
+ /**
1230
+ * 生成撤回的消息
1231
+ * @param randomNumber 指定消息的随机数如:491855401763
1232
+ * @param privateUID 私聊对象的UID
1233
+ * @returns
1234
+ */
1235
+ declare function withdrawn(randomNumber: string, privateUID?: string): string;
1236
+
1237
+ export { }
1238
+
1239
+