hortimagic 1.0.3 → 1.0.5

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.
@@ -1,4143 +0,0 @@
1
- async function sleep(ms) {
2
- return new Promise((resolve) => setTimeout(resolve, ms));
3
- }
4
- function compressHTML(html) {
5
- html = html.replace(/>\s+</g, "><");
6
- html = html.replace(/\s{2,}/g, " ");
7
- html = html.replace(/<!--[\s\S]*?-->/g, "");
8
- html = html.trim();
9
- return html;
10
- }
11
- function compressCSS(css) {
12
- css = css.replace(/\s{2,}/g, " ");
13
- css = css.replace(/\/\*[\s\S]*?\*\//g, "");
14
- css = css.replace(/\s*([{};:,])\s*/g, "$1");
15
- css = css.replace(/;\s*}/g, "}");
16
- css = css.trim();
17
- return css;
18
- }
19
- function addStyle(css) {
20
- let s2 = document.createElement("style");
21
- s2.innerText = css;
22
- document.body.append(s2);
23
- }
24
- function htmlSpecialCharsEscape(e2) {
25
- e2 = e2.replace(`&`, "&amp;");
26
- e2 = e2.replace(`<`, "&lt;");
27
- e2 = e2.replace(`>`, "&gt;");
28
- e2 = e2.replace(`"`, "&quot;");
29
- e2 = e2.replace(`'`, "&#039;");
30
- e2 = e2.replace(`\\`, "&#092;");
31
- return e2;
32
- }
33
- function htmlSpecialCharsDecode(e2) {
34
- e2 = e2.replace("&lt;", `<`);
35
- e2 = e2.replace("&gt;", `>`);
36
- e2 = e2.replace("&quot;", `"`);
37
- e2 = e2.replace("&#039;", `'`);
38
- e2 = e2.replace("&#092;", `\\`);
39
- e2 = e2.replace("&amp;", `&`);
40
- return e2;
41
- }
42
- function getUserName() {
43
- if (window["myself"]) return window["myself"];
44
- else return null;
45
- }
46
- function getUserUid() {
47
- if (window["uid"]) return window["uid"];
48
- else return null;
49
- }
50
- function getRoomId() {
51
- if (window["roomn"]) return window["roomn"];
52
- else return null;
53
- }
54
- function getRoomInfoById(roomId) {
55
- let roomInfoArray = window.Objs.mapHolder?.Assets?.roomJson?.[roomId];
56
- if (roomInfoArray) {
57
- let roomInfoPart = roomInfoArray[5].split("&&").map((o2) => o2.split(" & "));
58
- let imageAndDescription = htmlSpecialCharsDecode(roomInfoPart[0][0]);
59
- let firstSpaceIndex = imageAndDescription.indexOf(" ");
60
- return {
61
- name: roomInfoArray[1],
62
- color: roomInfoArray[2],
63
- roomPath: roomInfoArray[0].split("_"),
64
- description: imageAndDescription.slice(firstSpaceIndex + 1),
65
- roomImage: imageAndDescription.slice(0, firstSpaceIndex),
66
- currentUserNum: typeof roomInfoArray[7] == "number" ? roomInfoArray[7] : "hidden",
67
- ownerName: roomInfoPart[1][0],
68
- member: roomInfoPart[4].map((o2) => ({
69
- name: htmlSpecialCharsDecode(o2.slice(1)),
70
- auth: o2[0] == "0" ? "member" : o2[0] == "1" ? "admin" : "unknow"
71
- }))
72
- };
73
- } else return null;
74
- }
75
- function getOnlineUserInfoById(uid) {
76
- uid = String(uid);
77
- let userInfoArray = window.Objs.mapHolder?.function?.findUserByUid?.(uid);
78
- if (userInfoArray) {
79
- return {
80
- name: userInfoArray[2],
81
- uid,
82
- color: userInfoArray[3],
83
- avatar: userInfoArray[0],
84
- roomId: userInfoArray[4],
85
- personalizedSignature: userInfoArray[6]
86
- };
87
- } else return null;
88
- }
89
- function getAllOnlineUserInfo() {
90
- let userInfoMapObj = window.Objs.mapHolder.Assets.userJson;
91
- if (userInfoMapObj) {
92
- return Object.keys(userInfoMapObj).map((key) => {
93
- let o2 = userInfoMapObj[key];
94
- return {
95
- name: o2[2],
96
- uid: o2[8],
97
- color: o2[3],
98
- avatar: o2[0],
99
- roomId: o2[4],
100
- personalizedSignature: o2[6]
101
- };
102
- });
103
- } else return null;
104
- }
105
- function changeRoom(roomId) {
106
- roomId = String(roomId);
107
- if (roomId)
108
- window.Objs.mapHolder?.function?.roomchanger(roomId);
109
- }
110
- function getUserProfilePictureUrl() {
111
- if (window.avatar2 && window.avatarconv)
112
- return window.avatarconv(window.avatar2);
113
- return null;
114
- }
115
- function getUserInputColor() {
116
- if (window.inputcolorhex) return window.inputcolorhex;
117
- return null;
118
- }
119
- function generatePrivateMessageBubble(targetUid, content, messageId) {
120
- if (window.privatechatfunc)
121
- window.privatechatfunc(
122
- [
123
- Math.floor(Date.now() / 1e3).toString(10),
124
- // 0
125
- getUserUid(),
126
- // 1
127
- htmlSpecialCharsEscape(getUserName()),
128
- // 2
129
- htmlSpecialCharsEscape(getUserProfilePictureUrl()),
130
- // 3
131
- htmlSpecialCharsEscape(content),
132
- // 4
133
- htmlSpecialCharsEscape(getUserInputColor()),
134
- // 5
135
- "",
136
- // 6
137
- htmlSpecialCharsEscape(getUserInputColor()),
138
- // 7
139
- "",
140
- // 8
141
- "",
142
- // 9
143
- messageId,
144
- // 10
145
- targetUid,
146
- // 11
147
- "",
148
- // 12
149
- "",
150
- // 13
151
- "",
152
- // 14
153
- "",
154
- // 15
155
- ""
156
- // 16
157
- ].join(">")
158
- );
159
- }
160
- function switchRoom(roomId) {
161
- if (window.Objs.mapHolder?.function?.roomchanger)
162
- window.Objs.mapHolder.function.roomchanger(roomId);
163
- }
164
- const tools = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
165
- __proto__: null,
166
- addStyle,
167
- changeRoom,
168
- compressCSS,
169
- compressHTML,
170
- generatePrivateMessageBubble,
171
- getAllOnlineUserInfo,
172
- getOnlineUserInfoById,
173
- getRoomId,
174
- getRoomInfoById,
175
- getUserInputColor,
176
- getUserName,
177
- getUserProfilePictureUrl,
178
- getUserUid,
179
- htmlSpecialCharsDecode,
180
- htmlSpecialCharsEscape,
181
- sleep,
182
- switchRoom
183
- }, Symbol.toStringTag, { value: "Module" }));
184
- class Public {
185
- constructor() {
186
- this.timeStamp = "";
187
- this.headPortrait = "";
188
- this.name = "";
189
- this.message = "";
190
- this.color = "";
191
- this.gender = "";
192
- this.uid = "";
193
- this.designation = "";
194
- this.messageUid = "";
195
- this.messageClass = "public";
196
- }
197
- }
198
- class Private {
199
- constructor() {
200
- this.timeStamp = "";
201
- this.headPortrait = "";
202
- this.name = "";
203
- this.message = "";
204
- this.color = "";
205
- this.gender = "";
206
- this.uid = "";
207
- this.messageUid = "";
208
- this.messageClass = "private";
209
- }
210
- }
211
- class Hidden {
212
- constructor() {
213
- this.messageName = "";
214
- this.uid = "";
215
- this.data = "";
216
- this.messageClass = "hidden";
217
- }
218
- }
219
- class Danmu {
220
- constructor() {
221
- this.username = "";
222
- this.avatar = "";
223
- this.message = "";
224
- this.color = "";
225
- this.gender = "";
226
- this.timeStamp = "";
227
- this.uid = "";
228
- this.messageClass = "danmu";
229
- }
230
- }
231
- class Withdrawn {
232
- constructor() {
233
- this.privateUID = "";
234
- this.uid = "";
235
- this.messageUid = "";
236
- this.dataUid = "";
237
- this.messageClass = "withdrawn";
238
- }
239
- }
240
- class System {
241
- constructor() {
242
- this.userMessageList = [];
243
- this.messageClass = "system";
244
- }
245
- }
246
- class Stock {
247
- constructor() {
248
- this.result = "";
249
- this.stockPrice = NaN;
250
- this.totalStock = NaN;
251
- this.holdingAmount = NaN;
252
- this.totalEquity = NaN;
253
- this.balance = NaN;
254
- this.messageClass = "stock";
255
- }
256
- }
257
- class Unkonw {
258
- constructor() {
259
- this.message = "";
260
- this.messageClass = "unkonw";
261
- }
262
- }
263
- const Message = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
264
- __proto__: null,
265
- Danmu,
266
- Hidden,
267
- Private,
268
- Public,
269
- Stock,
270
- System,
271
- Unkonw,
272
- Withdrawn
273
- }, Symbol.toStringTag, { value: "Module" }));
274
- let messageObjList = [];
275
- function publicChat$1(message) {
276
- let messageObj = new Public();
277
- let message_list = message.split(">");
278
- messageObj.timeStamp = message_list[0];
279
- messageObj.headPortrait = message_list[1];
280
- messageObj.name = message_list[2];
281
- messageObj.message = message_list[3];
282
- messageObj.color = message_list[5];
283
- messageObj.gender = message_list[6];
284
- messageObj.uid = message_list[8];
285
- messageObj.designation = message_list[9];
286
- messageObj.messageUid = message_list[10];
287
- return messageObj;
288
- }
289
- function privateChat$1(message) {
290
- let messageObj = new Private();
291
- let message_list = message.split(">");
292
- messageObj.timeStamp = message_list[0].slice(1);
293
- messageObj.uid = message_list[1];
294
- messageObj.name = message_list[2];
295
- messageObj.headPortrait = message_list[3];
296
- messageObj.message = message_list[4];
297
- messageObj.color = message_list[5];
298
- messageObj.gender = message_list[8];
299
- messageObj.messageUid = message_list[10];
300
- return messageObj;
301
- }
302
- function danmu$1(message) {
303
- let messageObj = new Danmu();
304
- let message_list = message.split(">");
305
- messageObj.username = message_list[0];
306
- messageObj.message = message_list[1];
307
- messageObj.color = message_list[2];
308
- messageObj.gender = message_list[4];
309
- messageObj.avatar = message_list[5];
310
- messageObj.timeStamp = message_list[6];
311
- messageObj.uid = message_list[7];
312
- return messageObj;
313
- }
314
- function hidden$1(message) {
315
- let messageObj = new Hidden();
316
- let temp;
317
- temp = message.match(/(?<=^[/]<).*(?=>[0-9|a-z]{13}:.*)/gs);
318
- messageObj.messageName = temp == null ? "" : temp[0];
319
- temp = message.match(/(?<=^[/]<.*>)[0-9|a-z]{13}(?=:.*)/gs);
320
- messageObj.uid = temp == null ? "" : temp[0];
321
- temp = message.match(/(?<=^[/]<.*>[0-9|a-z]{13}:).*/gs);
322
- messageObj.data = temp == null ? "" : temp[0];
323
- return messageObj;
324
- }
325
- function withdrawn$1(message) {
326
- let messageObj = new Withdrawn();
327
- if (message[2] == "#") {
328
- messageObj.privateUID = "";
329
- messageObj.uid = message.slice(3, 16);
330
- messageObj.messageUid = message.slice(17, 29);
331
- messageObj.dataUid = message.slice(3, 29);
332
- } else {
333
- messageObj.privateUID = message.slice(3, 16);
334
- messageObj.uid = message.slice(17, 30);
335
- messageObj.messageUid = message.slice(31);
336
- messageObj.dataUid = message.slice(17);
337
- }
338
- return messageObj;
339
- }
340
- function system(message) {
341
- let messageObj = new System();
342
- messageObj.userMessageList = message.split("<");
343
- return messageObj;
344
- }
345
- function stock(message) {
346
- let messageObj = new Stock();
347
- messageObj.result = message[2];
348
- if (messageObj.result == "*") {
349
- return messageObj;
350
- } else if (messageObj.result == ">") {
351
- messageObj.holdingAmount = parseInt(message.slice(2));
352
- return messageObj;
353
- } else if (messageObj.result == "<") {
354
- messageObj.balance = parseInt(message.slice(2));
355
- return messageObj;
356
- } else {
357
- let L2 = message.split('"');
358
- if (L2.length == 5) {
359
- messageObj.stockPrice = parseFloat(L2[2]);
360
- messageObj.totalStock = parseInt(L2[0].slice(1));
361
- messageObj.holdingAmount = parseInt(L2[3]);
362
- messageObj.totalEquity = parseFloat(L2[1]);
363
- messageObj.balance = parseFloat(L2[4]);
364
- return messageObj;
365
- } else if (L2.length == 4) {
366
- messageObj.stockPrice = parseFloat(L2[1]) / parseInt(L2[0].slice(1));
367
- messageObj.totalStock = parseInt(L2[0].slice(1));
368
- messageObj.holdingAmount = parseInt(L2[2]);
369
- messageObj.totalEquity = parseFloat(L2[1]);
370
- messageObj.balance = parseFloat(L2[3]);
371
- return messageObj;
372
- }
373
- }
374
- return messageObj;
375
- }
376
- function unkonw(message) {
377
- let messageObj = new Unkonw();
378
- messageObj.message = message;
379
- return messageObj;
380
- }
381
- function decodeMessage(message) {
382
- messageObjList = [];
383
- if (/^"[^"].*/gs.test(message)) {
384
- let temp_list = message.slice(1).split("<");
385
- for (let i3 = temp_list.length - 1; i3 >= 0; i3--)
386
- messageObjList.push(publicChat$1(temp_list[i3]));
387
- } else if (/^"".*/gs.test(message)) {
388
- let temp_list = message.slice(1).split("<");
389
- for (let i3 = temp_list.length - 1; i3 >= 0; i3--) {
390
- messageObjList.push(privateChat$1(temp_list[i3]));
391
- }
392
- } else if (/^=.*/gs.test(message)) {
393
- let temp_list = message.slice(1).split("<");
394
- for (let i3 = temp_list.length - 1; i3 >= 0; i3--) {
395
- messageObjList.push(danmu$1(temp_list[i3]));
396
- }
397
- } else if (/^[/]<.*>[0-9|a-z]{13}:.*/gs.test(message)) {
398
- messageObjList.push(hidden$1(message));
399
- } else if (/^v0.*/gs.test(message)) {
400
- messageObjList.push(withdrawn$1(message));
401
- } else if (/^%\*".*/gs.test(message)) {
402
- messageObjList.push(system(message));
403
- } else if (/^>.*/gs.test(message)) {
404
- messageObjList.push(stock(message));
405
- } else {
406
- messageObjList.push(unkonw(message));
407
- }
408
- }
409
- const decoder = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
410
- __proto__: null,
411
- decodeMessage,
412
- get messageObjList() {
413
- return messageObjList;
414
- }
415
- }, Symbol.toStringTag, { value: "Module" }));
416
- var tinyEmitter = { exports: {} };
417
- var hasRequiredTinyEmitter;
418
- function requireTinyEmitter() {
419
- if (hasRequiredTinyEmitter) return tinyEmitter.exports;
420
- hasRequiredTinyEmitter = 1;
421
- function E2() {
422
- }
423
- E2.prototype = {
424
- on: function(name2, callback, ctx) {
425
- var e2 = this.e || (this.e = {});
426
- (e2[name2] || (e2[name2] = [])).push({
427
- fn: callback,
428
- ctx
429
- });
430
- return this;
431
- },
432
- once: function(name2, callback, ctx) {
433
- var self = this;
434
- function listener() {
435
- self.off(name2, listener);
436
- callback.apply(ctx, arguments);
437
- }
438
- listener._ = callback;
439
- return this.on(name2, listener, ctx);
440
- },
441
- emit: function(name2) {
442
- var data = [].slice.call(arguments, 1);
443
- var evtArr = ((this.e || (this.e = {}))[name2] || []).slice();
444
- var i3 = 0;
445
- var len = evtArr.length;
446
- for (i3; i3 < len; i3++) {
447
- evtArr[i3].fn.apply(evtArr[i3].ctx, data);
448
- }
449
- return this;
450
- },
451
- off: function(name2, callback) {
452
- var e2 = this.e || (this.e = {});
453
- var evts = e2[name2];
454
- var liveEvents = [];
455
- if (evts && callback) {
456
- for (var i3 = 0, len = evts.length; i3 < len; i3++) {
457
- if (evts[i3].fn !== callback && evts[i3].fn._ !== callback)
458
- liveEvents.push(evts[i3]);
459
- }
460
- }
461
- liveEvents.length ? e2[name2] = liveEvents : delete e2[name2];
462
- return this;
463
- }
464
- };
465
- tinyEmitter.exports = E2;
466
- tinyEmitter.exports.TinyEmitter = E2;
467
- return tinyEmitter.exports;
468
- }
469
- var tinyEmitterExports = requireTinyEmitter();
470
- let emitter = new tinyEmitterExports.TinyEmitter();
471
- const eventEmitter = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
472
- __proto__: null,
473
- TinyEmitter: tinyEmitterExports.TinyEmitter,
474
- emitter
475
- }, Symbol.toStringTag, { value: "Module" }));
476
- async function beforeSend(message) {
477
- return message;
478
- }
479
- function originalSend(message) {
480
- return message;
481
- }
482
- function afterSend(message) {
483
- return message;
484
- }
485
- async function send(message) {
486
- console.log("发送", { message });
487
- let temp = await sockets.beforeSend(message);
488
- try {
489
- if (temp != null) {
490
- sockets.originalSend(temp);
491
- sockets.afterSend(temp);
492
- }
493
- } catch (error) {
494
- console.error("捕获到错误", error);
495
- }
496
- }
497
- async function beforeOnmessage(message) {
498
- decodeMessage(message);
499
- return message;
500
- }
501
- function originalOnmessage(message) {
502
- return message;
503
- }
504
- async function afterOnmessage(message) {
505
- for (let messageObj of messageObjList) {
506
- console.log(`触发${messageObj.messageClass}事件`, {
507
- message,
508
- messageObj
509
- });
510
- emitter.emit(messageObj.messageClass, messageObj);
511
- }
512
- return message;
513
- }
514
- async function onmessage(message) {
515
- let temp = await sockets.beforeOnmessage(message);
516
- try {
517
- if (temp != null) {
518
- sockets.originalOnmessage(temp);
519
- sockets.afterOnmessage(temp);
520
- }
521
- } catch (error) {
522
- console.error("捕获到错误", error);
523
- }
524
- }
525
- async function initSocket() {
526
- console.debug("代理网络");
527
- for (let index2 = 0; index2 < 30; index2++) {
528
- try {
529
- console.debug("等待网络连接", index2);
530
- if (window["socket"].__onmessage == void 0 && window["socket"]._onmessage != void 0 && window["socket"].send != void 0) {
531
- console.debug("网络连接成功");
532
- break;
533
- } else {
534
- await sleep(500);
535
- continue;
536
- }
537
- } catch (error) {
538
- console.error(error);
539
- }
540
- }
541
- if (window["socket"].__onmessage == void 0 && window["socket"]._onmessage != void 0 && window["socket"].send != void 0) ;
542
- else {
543
- console.error("连接失败");
544
- return;
545
- }
546
- sockets.originalSend = window["socket"].send;
547
- window["socket"].send = sockets.send;
548
- sockets.originalOnmessage = window["socket"]._onmessage;
549
- window["socket"]._onmessage = sockets.onmessage;
550
- }
551
- const sockets = {
552
- beforeSend,
553
- originalSend,
554
- afterSend,
555
- send,
556
- beforeOnmessage,
557
- originalOnmessage,
558
- afterOnmessage,
559
- onmessage,
560
- initSocket
561
- };
562
- const iiroseSocket = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
563
- __proto__: null,
564
- initSocket,
565
- sockets
566
- }, Symbol.toStringTag, { value: "Module" }));
567
- function publicChat(message, color) {
568
- if (message === "cut") {
569
- return `{0${JSON.stringify({
570
- m: message,
571
- mc: color,
572
- i: Math.random().toString().slice(2, 12)
573
- })}`;
574
- }
575
- return JSON.stringify({
576
- m: message,
577
- mc: color,
578
- i: Math.random().toString().slice(2, 12)
579
- });
580
- }
581
- function privateChat(uid, message, color) {
582
- return JSON.stringify({
583
- g: uid,
584
- m: message,
585
- mc: color,
586
- i: Math.random().toString().slice(2, 12)
587
- });
588
- }
589
- function hidden(messageNmae, uid, data) {
590
- return `/<${messageNmae}>${uid}:${data}`;
591
- }
592
- function musicCard(typeId, title, singerName, coverUrl, color, resolutionRatio) {
593
- let mediaCardContent = `m__4=${typeId}>${title}>${singerName}>${coverUrl}>${color}>${resolutionRatio}`;
594
- return publicChat(mediaCardContent, color);
595
- }
596
- function videoCard(typeId, title, singerName, coverUrl, color, resolutionRatio, time) {
597
- let mediaCardContent = `m__4*${typeId}>${title}>${singerName}>${coverUrl}>${color}>${resolutionRatio}>${time}`;
598
- return publicChat(mediaCardContent, color);
599
- }
600
- function like(targetUid, content = "") {
601
- return `+*${targetUid}${content}`;
602
- }
603
- function danmu(message, color, v2 = "0") {
604
- return `~{"t":"${message}","c":"${color}","v":${v2}}`;
605
- }
606
- function withdrawn(randomNumber, privateUID = "") {
607
- if (privateUID == "")
608
- return `v0#${randomNumber}`;
609
- else
610
- return `v0*${privateUID}#${randomNumber}`;
611
- }
612
- function stockRequest(count) {
613
- if (count == void 0)
614
- return ">#";
615
- else if (count > 0)
616
- return `>$${Math.round(Math.abs(count))}`;
617
- else if (count < 0)
618
- return `>@${Math.round(Math.abs(count))}`;
619
- else return ">#";
620
- }
621
- const encoder = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
622
- __proto__: null,
623
- danmu,
624
- hidden,
625
- like,
626
- musicCard,
627
- privateChat,
628
- publicChat,
629
- stockRequest,
630
- videoCard,
631
- withdrawn
632
- }, Symbol.toStringTag, { value: "Module" }));
633
- let elements = {
634
- /** 移动窗口父元素,移动窗口容器 */
635
- movePanelHolder: document.querySelector("#movePanelHolder"),
636
- /** 侧边菜单按钮 */
637
- functionHolder: document.querySelector("#functionHolder"),
638
- /** 侧边菜单按钮列表 */
639
- functionButtonGroupList: [
640
- ...document.querySelectorAll(".functionButton.functionButtonGroup")
641
- ],
642
- /** 主消息列表的父元素 */
643
- msgholderBox: document.querySelector("#msgholder .fullBox.msgholderBox"),
644
- /** home界面的消息列表父元素 */
645
- homeHolderMsgBox: document.querySelector(
646
- `#homeHolder .homeHolderMsgContentBox .homeHolderMsgBox.fullBox`
647
- ),
648
- /** 最近会话列表 */
649
- sessionHolderPmTaskBoxItems: [
650
- ...document.querySelectorAll(`.sessionHolderPmTaskBoxItem.whoisTouch2`)
651
- ],
652
- /** 主输入元素盒子 */
653
- moveinputDisplay: document.querySelector("#moveinputDisplay"),
654
- /** 主输入元素 */
655
- moveinput: document.getElementById("moveinput"),
656
- /** 可以打开home界面 */
657
- moveinputSendBtnFunc: document.querySelector(
658
- "#moveinputDisplay #moveinputSendBtnFunc"
659
- ),
660
- /** 发送按钮 */
661
- moveinputSendBtnSend: document.querySelector(
662
- "#moveinputDisplay #moveinputSendBtnSend"
663
- )
664
- };
665
- function refreshAll() {
666
- elements.movePanelHolder = document.querySelector("#movePanelHolder");
667
- elements.functionHolder = document.querySelector("#functionHolder");
668
- elements.functionButtonGroupList = [
669
- ...document.querySelectorAll(".functionButton.functionButtonGroup")
670
- ];
671
- elements.msgholderBox = document.querySelector(
672
- `#msgholder .fullBox .fullBox.msgholderBox`
673
- );
674
- elements.homeHolderMsgBox = document.querySelector(
675
- `#homeHolder .homeHolderMsgContentBox .homeHolderMsgBox.fullBox`
676
- );
677
- elements.sessionHolderPmTaskBoxItems = [
678
- ...document.querySelectorAll(`.sessionHolderPmTaskBoxItem.whoisTouch2`)
679
- ];
680
- elements.moveinputDisplay = document.querySelector("#moveinputDisplay");
681
- elements.moveinput = document.getElementById("moveinput");
682
- elements.moveinputSendBtnFunc = document.querySelector(
683
- "#moveinputDisplay #moveinputSendBtnFunc"
684
- );
685
- elements.moveinputSendBtnSend = document.querySelector(
686
- "#moveinputDisplay #moveinputSendBtnSend"
687
- );
688
- }
689
- let Hooks = {
690
- elementHooks: {
691
- moveinput: {
692
- oninputBefore: () => {
693
- return true;
694
- },
695
- oninputAfter: () => {
696
- return true;
697
- },
698
- onblurBefore: () => {
699
- return true;
700
- },
701
- onblurAfter: () => {
702
- return true;
703
- },
704
- onfocusBefore: () => {
705
- return true;
706
- },
707
- onfocusAfter: () => {
708
- return true;
709
- }
710
- }
711
- },
712
- functionHooks: {
713
- processer: {
714
- // @ts-ignore
715
- onBefore: (e2, s2, t2, r2) => {
716
- return true;
717
- },
718
- // @ts-ignore
719
- onAfter: (e2, s2, t2, r2) => {
720
- return true;
721
- }
722
- }
723
- },
724
- replaceMoveinput: () => {
725
- try {
726
- let temp = elements.moveinput.oninput;
727
- elements.moveinput.oninput = function() {
728
- if (Hooks.elementHooks.moveinput.oninputBefore() == true) {
729
- temp?.call(elements.moveinput);
730
- Hooks.elementHooks.moveinput.oninputAfter();
731
- }
732
- };
733
- } catch (error) {
734
- console.error("替换错误", error);
735
- }
736
- try {
737
- let temp = elements.moveinput.oninput;
738
- elements.moveinput.onblur = function() {
739
- if (Hooks.elementHooks.moveinput.onblurBefore() == true) {
740
- temp?.call(elements.moveinput);
741
- Hooks.elementHooks.moveinput.onblurAfter();
742
- }
743
- };
744
- } catch (error) {
745
- console.error("替换错误", error);
746
- }
747
- try {
748
- let temp = elements.moveinput.oninput;
749
- elements.moveinput.onfocus = function() {
750
- if (Hooks.elementHooks.moveinput.onfocusBefore() == true) {
751
- temp?.call(elements.moveinput);
752
- Hooks.elementHooks.moveinput.onfocusAfter();
753
- }
754
- };
755
- } catch (error) {
756
- console.error("替换错误", error);
757
- }
758
- },
759
- replaceButtonProcesser: () => {
760
- try {
761
- let temp = buttonProcesser;
762
- buttonProcesser = (e2, s2, t2, r2) => {
763
- if (Hooks.functionHooks.processer.onBefore(e2, s2, t2, r2) == true) {
764
- temp(e2, s2, t2, r2);
765
- Hooks.functionHooks.processer.onAfter(e2, s2, t2, r2);
766
- }
767
- };
768
- } catch (error) {
769
- console.error("替换错误", error);
770
- }
771
- }
772
- };
773
- function initHooks() {
774
- console.log("增加钩子函数");
775
- Hooks.replaceMoveinput();
776
- Hooks.replaceButtonProcesser();
777
- }
778
- const elementsHooks = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
779
- __proto__: null,
780
- Hooks,
781
- elements,
782
- initHooks,
783
- refreshAll
784
- }, Symbol.toStringTag, { value: "Module" }));
785
- class Script {
786
- constructor(name2, url, enable = true, ingected = false) {
787
- this.name = name2;
788
- this.url = url;
789
- this.enable = enable;
790
- this.ingected = ingected;
791
- }
792
- }
793
- let scriptList = [];
794
- function addScriptToList(script) {
795
- if (script.name == "" || script.url == "") {
796
- _alert("脚本名字或链接不能为空");
797
- return false;
798
- }
799
- for (let s2 of scriptList) {
800
- if (s2.name === script.name) {
801
- s2.url = script.url;
802
- s2.enable = script.enable;
803
- s2.ingected = script.ingected;
804
- return false;
805
- }
806
- if (s2.url === script.url) {
807
- s2.name = script.name;
808
- s2.enable = script.enable;
809
- s2.ingected = script.ingected;
810
- return false;
811
- }
812
- }
813
- scriptList.push(script);
814
- return true;
815
- }
816
- function removeScriptFromList(script) {
817
- scriptList = scriptList.filter((s2) => s2.name !== script.name && s2.url !== script.url);
818
- }
819
- function injectScript(script) {
820
- if (script.ingected) {
821
- _alert(`脚本 ${script.name} 已经注入`);
822
- return script.ingected;
823
- }
824
- const scriptElement = document.createElement("script");
825
- scriptElement.src = script.url;
826
- scriptElement.onload = () => {
827
- _alert(`脚本 ${script.name} 注入成功`);
828
- script.ingected = true;
829
- };
830
- scriptElement.onerror = () => {
831
- _alert(`脚本 ${script.name} 注入失败`);
832
- script.enable = false;
833
- };
834
- document.head.appendChild(scriptElement);
835
- return script.ingected;
836
- }
837
- function injectScriptList(list) {
838
- for (let script of list) {
839
- if (script.enable && !script.ingected) {
840
- injectScript(script);
841
- }
842
- }
843
- }
844
- function readScriptList() {
845
- let temp = localStorage.getItem("hortiMagicScriptList");
846
- scriptList = temp == null ? [] : JSON.parse(temp);
847
- for (let script of scriptList) {
848
- script.ingected = false;
849
- }
850
- }
851
- function saveScriptList() {
852
- localStorage.setItem("hortiMagicScriptList", JSON.stringify(scriptList));
853
- _alert("脚本列表已保存");
854
- }
855
- function ingectlocalScript() {
856
- readScriptList();
857
- injectScriptList(scriptList);
858
- }
859
- const scriptTools = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
860
- __proto__: null,
861
- Script,
862
- addScriptToList,
863
- ingectlocalScript,
864
- injectScript,
865
- injectScriptList,
866
- readScriptList,
867
- removeScriptFromList,
868
- saveScriptList,
869
- get scriptList() {
870
- return scriptList;
871
- }
872
- }, Symbol.toStringTag, { value: "Module" }));
873
- const index$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
874
- __proto__: null,
875
- Message,
876
- decoder,
877
- elements_hooks: elementsHooks,
878
- encoder,
879
- event_emitter: eventEmitter,
880
- iirose_socket: iiroseSocket,
881
- script_tools: scriptTools,
882
- tools
883
- }, Symbol.toStringTag, { value: "Module" }));
884
- /**
885
- * @license
886
- * Copyright 2019 Google LLC
887
- * SPDX-License-Identifier: BSD-3-Clause
888
- */
889
- const t$4 = globalThis, e$6 = t$4.ShadowRoot && (void 0 === t$4.ShadyCSS || t$4.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, s$2 = Symbol(), o$5 = /* @__PURE__ */ new WeakMap();
890
- let n$3 = class n {
891
- constructor(t2, e2, o2) {
892
- if (this._$cssResult$ = true, o2 !== s$2) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
893
- this.cssText = t2, this.t = e2;
894
- }
895
- get styleSheet() {
896
- let t2 = this.o;
897
- const s2 = this.t;
898
- if (e$6 && void 0 === t2) {
899
- const e2 = void 0 !== s2 && 1 === s2.length;
900
- e2 && (t2 = o$5.get(s2)), void 0 === t2 && ((this.o = t2 = new CSSStyleSheet()).replaceSync(this.cssText), e2 && o$5.set(s2, t2));
901
- }
902
- return t2;
903
- }
904
- toString() {
905
- return this.cssText;
906
- }
907
- };
908
- const r$4 = (t2) => new n$3("string" == typeof t2 ? t2 : t2 + "", void 0, s$2), i$4 = (t2, ...e2) => {
909
- const o2 = 1 === t2.length ? t2[0] : e2.reduce(((e3, s2, o3) => e3 + ((t3) => {
910
- if (true === t3._$cssResult$) return t3.cssText;
911
- if ("number" == typeof t3) return t3;
912
- throw Error("Value passed to 'css' function must be a 'css' function result: " + t3 + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
913
- })(s2) + t2[o3 + 1]), t2[0]);
914
- return new n$3(o2, t2, s$2);
915
- }, S$1 = (s2, o2) => {
916
- if (e$6) s2.adoptedStyleSheets = o2.map(((t2) => t2 instanceof CSSStyleSheet ? t2 : t2.styleSheet));
917
- else for (const e2 of o2) {
918
- const o3 = document.createElement("style"), n3 = t$4.litNonce;
919
- void 0 !== n3 && o3.setAttribute("nonce", n3), o3.textContent = e2.cssText, s2.appendChild(o3);
920
- }
921
- }, c$2 = e$6 ? (t2) => t2 : (t2) => t2 instanceof CSSStyleSheet ? ((t3) => {
922
- let e2 = "";
923
- for (const s2 of t3.cssRules) e2 += s2.cssText;
924
- return r$4(e2);
925
- })(t2) : t2;
926
- /**
927
- * @license
928
- * Copyright 2017 Google LLC
929
- * SPDX-License-Identifier: BSD-3-Clause
930
- */
931
- const { is: i$3, defineProperty: e$5, getOwnPropertyDescriptor: h$1, getOwnPropertyNames: r$3, getOwnPropertySymbols: o$4, getPrototypeOf: n$2 } = Object, a$1 = globalThis, c$1 = a$1.trustedTypes, l$1 = c$1 ? c$1.emptyScript : "", p$1 = a$1.reactiveElementPolyfillSupport, d$1 = (t2, s2) => t2, u$1 = { toAttribute(t2, s2) {
932
- switch (s2) {
933
- case Boolean:
934
- t2 = t2 ? l$1 : null;
935
- break;
936
- case Object:
937
- case Array:
938
- t2 = null == t2 ? t2 : JSON.stringify(t2);
939
- }
940
- return t2;
941
- }, fromAttribute(t2, s2) {
942
- let i3 = t2;
943
- switch (s2) {
944
- case Boolean:
945
- i3 = null !== t2;
946
- break;
947
- case Number:
948
- i3 = null === t2 ? null : Number(t2);
949
- break;
950
- case Object:
951
- case Array:
952
- try {
953
- i3 = JSON.parse(t2);
954
- } catch (t3) {
955
- i3 = null;
956
- }
957
- }
958
- return i3;
959
- } }, f$1 = (t2, s2) => !i$3(t2, s2), b = { attribute: true, type: String, converter: u$1, reflect: false, useDefault: false, hasChanged: f$1 };
960
- Symbol.metadata ??= Symbol("metadata"), a$1.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
961
- let y$1 = class y extends HTMLElement {
962
- static addInitializer(t2) {
963
- this._$Ei(), (this.l ??= []).push(t2);
964
- }
965
- static get observedAttributes() {
966
- return this.finalize(), this._$Eh && [...this._$Eh.keys()];
967
- }
968
- static createProperty(t2, s2 = b) {
969
- if (s2.state && (s2.attribute = false), this._$Ei(), this.prototype.hasOwnProperty(t2) && ((s2 = Object.create(s2)).wrapped = true), this.elementProperties.set(t2, s2), !s2.noAccessor) {
970
- const i3 = Symbol(), h2 = this.getPropertyDescriptor(t2, i3, s2);
971
- void 0 !== h2 && e$5(this.prototype, t2, h2);
972
- }
973
- }
974
- static getPropertyDescriptor(t2, s2, i3) {
975
- const { get: e2, set: r2 } = h$1(this.prototype, t2) ?? { get() {
976
- return this[s2];
977
- }, set(t3) {
978
- this[s2] = t3;
979
- } };
980
- return { get: e2, set(s3) {
981
- const h2 = e2?.call(this);
982
- r2?.call(this, s3), this.requestUpdate(t2, h2, i3);
983
- }, configurable: true, enumerable: true };
984
- }
985
- static getPropertyOptions(t2) {
986
- return this.elementProperties.get(t2) ?? b;
987
- }
988
- static _$Ei() {
989
- if (this.hasOwnProperty(d$1("elementProperties"))) return;
990
- const t2 = n$2(this);
991
- t2.finalize(), void 0 !== t2.l && (this.l = [...t2.l]), this.elementProperties = new Map(t2.elementProperties);
992
- }
993
- static finalize() {
994
- if (this.hasOwnProperty(d$1("finalized"))) return;
995
- if (this.finalized = true, this._$Ei(), this.hasOwnProperty(d$1("properties"))) {
996
- const t3 = this.properties, s2 = [...r$3(t3), ...o$4(t3)];
997
- for (const i3 of s2) this.createProperty(i3, t3[i3]);
998
- }
999
- const t2 = this[Symbol.metadata];
1000
- if (null !== t2) {
1001
- const s2 = litPropertyMetadata.get(t2);
1002
- if (void 0 !== s2) for (const [t3, i3] of s2) this.elementProperties.set(t3, i3);
1003
- }
1004
- this._$Eh = /* @__PURE__ */ new Map();
1005
- for (const [t3, s2] of this.elementProperties) {
1006
- const i3 = this._$Eu(t3, s2);
1007
- void 0 !== i3 && this._$Eh.set(i3, t3);
1008
- }
1009
- this.elementStyles = this.finalizeStyles(this.styles);
1010
- }
1011
- static finalizeStyles(s2) {
1012
- const i3 = [];
1013
- if (Array.isArray(s2)) {
1014
- const e2 = new Set(s2.flat(1 / 0).reverse());
1015
- for (const s3 of e2) i3.unshift(c$2(s3));
1016
- } else void 0 !== s2 && i3.push(c$2(s2));
1017
- return i3;
1018
- }
1019
- static _$Eu(t2, s2) {
1020
- const i3 = s2.attribute;
1021
- return false === i3 ? void 0 : "string" == typeof i3 ? i3 : "string" == typeof t2 ? t2.toLowerCase() : void 0;
1022
- }
1023
- constructor() {
1024
- super(), this._$Ep = void 0, this.isUpdatePending = false, this.hasUpdated = false, this._$Em = null, this._$Ev();
1025
- }
1026
- _$Ev() {
1027
- this._$ES = new Promise(((t2) => this.enableUpdating = t2)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((t2) => t2(this)));
1028
- }
1029
- addController(t2) {
1030
- (this._$EO ??= /* @__PURE__ */ new Set()).add(t2), void 0 !== this.renderRoot && this.isConnected && t2.hostConnected?.();
1031
- }
1032
- removeController(t2) {
1033
- this._$EO?.delete(t2);
1034
- }
1035
- _$E_() {
1036
- const t2 = /* @__PURE__ */ new Map(), s2 = this.constructor.elementProperties;
1037
- for (const i3 of s2.keys()) this.hasOwnProperty(i3) && (t2.set(i3, this[i3]), delete this[i3]);
1038
- t2.size > 0 && (this._$Ep = t2);
1039
- }
1040
- createRenderRoot() {
1041
- const t2 = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
1042
- return S$1(t2, this.constructor.elementStyles), t2;
1043
- }
1044
- connectedCallback() {
1045
- this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(true), this._$EO?.forEach(((t2) => t2.hostConnected?.()));
1046
- }
1047
- enableUpdating(t2) {
1048
- }
1049
- disconnectedCallback() {
1050
- this._$EO?.forEach(((t2) => t2.hostDisconnected?.()));
1051
- }
1052
- attributeChangedCallback(t2, s2, i3) {
1053
- this._$AK(t2, i3);
1054
- }
1055
- _$ET(t2, s2) {
1056
- const i3 = this.constructor.elementProperties.get(t2), e2 = this.constructor._$Eu(t2, i3);
1057
- if (void 0 !== e2 && true === i3.reflect) {
1058
- const h2 = (void 0 !== i3.converter?.toAttribute ? i3.converter : u$1).toAttribute(s2, i3.type);
1059
- this._$Em = t2, null == h2 ? this.removeAttribute(e2) : this.setAttribute(e2, h2), this._$Em = null;
1060
- }
1061
- }
1062
- _$AK(t2, s2) {
1063
- const i3 = this.constructor, e2 = i3._$Eh.get(t2);
1064
- if (void 0 !== e2 && this._$Em !== e2) {
1065
- const t3 = i3.getPropertyOptions(e2), h2 = "function" == typeof t3.converter ? { fromAttribute: t3.converter } : void 0 !== t3.converter?.fromAttribute ? t3.converter : u$1;
1066
- this._$Em = e2;
1067
- const r2 = h2.fromAttribute(s2, t3.type);
1068
- this[e2] = r2 ?? this._$Ej?.get(e2) ?? r2, this._$Em = null;
1069
- }
1070
- }
1071
- requestUpdate(t2, s2, i3) {
1072
- if (void 0 !== t2) {
1073
- const e2 = this.constructor, h2 = this[t2];
1074
- if (i3 ??= e2.getPropertyOptions(t2), !((i3.hasChanged ?? f$1)(h2, s2) || i3.useDefault && i3.reflect && h2 === this._$Ej?.get(t2) && !this.hasAttribute(e2._$Eu(t2, i3)))) return;
1075
- this.C(t2, s2, i3);
1076
- }
1077
- false === this.isUpdatePending && (this._$ES = this._$EP());
1078
- }
1079
- C(t2, s2, { useDefault: i3, reflect: e2, wrapped: h2 }, r2) {
1080
- i3 && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(t2) && (this._$Ej.set(t2, r2 ?? s2 ?? this[t2]), true !== h2 || void 0 !== r2) || (this._$AL.has(t2) || (this.hasUpdated || i3 || (s2 = void 0), this._$AL.set(t2, s2)), true === e2 && this._$Em !== t2 && (this._$Eq ??= /* @__PURE__ */ new Set()).add(t2));
1081
- }
1082
- async _$EP() {
1083
- this.isUpdatePending = true;
1084
- try {
1085
- await this._$ES;
1086
- } catch (t3) {
1087
- Promise.reject(t3);
1088
- }
1089
- const t2 = this.scheduleUpdate();
1090
- return null != t2 && await t2, !this.isUpdatePending;
1091
- }
1092
- scheduleUpdate() {
1093
- return this.performUpdate();
1094
- }
1095
- performUpdate() {
1096
- if (!this.isUpdatePending) return;
1097
- if (!this.hasUpdated) {
1098
- if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
1099
- for (const [t4, s3] of this._$Ep) this[t4] = s3;
1100
- this._$Ep = void 0;
1101
- }
1102
- const t3 = this.constructor.elementProperties;
1103
- if (t3.size > 0) for (const [s3, i3] of t3) {
1104
- const { wrapped: t4 } = i3, e2 = this[s3];
1105
- true !== t4 || this._$AL.has(s3) || void 0 === e2 || this.C(s3, void 0, i3, e2);
1106
- }
1107
- }
1108
- let t2 = false;
1109
- const s2 = this._$AL;
1110
- try {
1111
- t2 = this.shouldUpdate(s2), t2 ? (this.willUpdate(s2), this._$EO?.forEach(((t3) => t3.hostUpdate?.())), this.update(s2)) : this._$EM();
1112
- } catch (s3) {
1113
- throw t2 = false, this._$EM(), s3;
1114
- }
1115
- t2 && this._$AE(s2);
1116
- }
1117
- willUpdate(t2) {
1118
- }
1119
- _$AE(t2) {
1120
- this._$EO?.forEach(((t3) => t3.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = true, this.firstUpdated(t2)), this.updated(t2);
1121
- }
1122
- _$EM() {
1123
- this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = false;
1124
- }
1125
- get updateComplete() {
1126
- return this.getUpdateComplete();
1127
- }
1128
- getUpdateComplete() {
1129
- return this._$ES;
1130
- }
1131
- shouldUpdate(t2) {
1132
- return true;
1133
- }
1134
- update(t2) {
1135
- this._$Eq &&= this._$Eq.forEach(((t3) => this._$ET(t3, this[t3]))), this._$EM();
1136
- }
1137
- updated(t2) {
1138
- }
1139
- firstUpdated(t2) {
1140
- }
1141
- };
1142
- y$1.elementStyles = [], y$1.shadowRootOptions = { mode: "open" }, y$1[d$1("elementProperties")] = /* @__PURE__ */ new Map(), y$1[d$1("finalized")] = /* @__PURE__ */ new Map(), p$1?.({ ReactiveElement: y$1 }), (a$1.reactiveElementVersions ??= []).push("2.1.1");
1143
- /**
1144
- * @license
1145
- * Copyright 2017 Google LLC
1146
- * SPDX-License-Identifier: BSD-3-Clause
1147
- */
1148
- const t$3 = globalThis, i$2 = t$3.trustedTypes, s$1 = i$2 ? i$2.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, e$4 = "$lit$", h = `lit$${Math.random().toFixed(9).slice(2)}$`, o$3 = "?" + h, n$1 = `<${o$3}>`, r$2 = document, l = () => r$2.createComment(""), c = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, a = Array.isArray, u = (t2) => a(t2) || "function" == typeof t2?.[Symbol.iterator], d = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, v = /-->/g, _ = />/g, m = RegExp(`>|${d}(?:([^\\s"'>=/]+)(${d}*=${d}*(?:[^
1149
- \f\r"'\`<>=]|("|')|))|$)`, "g"), p = /'/g, g = /"/g, $ = /^(?:script|style|textarea|title)$/i, y2 = (t2) => (i3, ...s2) => ({ _$litType$: t2, strings: i3, values: s2 }), x = y2(1), T = Symbol.for("lit-noChange"), E = Symbol.for("lit-nothing"), A = /* @__PURE__ */ new WeakMap(), C = r$2.createTreeWalker(r$2, 129);
1150
- function P(t2, i3) {
1151
- if (!a(t2) || !t2.hasOwnProperty("raw")) throw Error("invalid template strings array");
1152
- return void 0 !== s$1 ? s$1.createHTML(i3) : i3;
1153
- }
1154
- const V = (t2, i3) => {
1155
- const s2 = t2.length - 1, o2 = [];
1156
- let r2, l2 = 2 === i3 ? "<svg>" : 3 === i3 ? "<math>" : "", c2 = f;
1157
- for (let i4 = 0; i4 < s2; i4++) {
1158
- const s3 = t2[i4];
1159
- let a2, u2, d2 = -1, y3 = 0;
1160
- for (; y3 < s3.length && (c2.lastIndex = y3, u2 = c2.exec(s3), null !== u2); ) y3 = c2.lastIndex, c2 === f ? "!--" === u2[1] ? c2 = v : void 0 !== u2[1] ? c2 = _ : void 0 !== u2[2] ? ($.test(u2[2]) && (r2 = RegExp("</" + u2[2], "g")), c2 = m) : void 0 !== u2[3] && (c2 = m) : c2 === m ? ">" === u2[0] ? (c2 = r2 ?? f, d2 = -1) : void 0 === u2[1] ? d2 = -2 : (d2 = c2.lastIndex - u2[2].length, a2 = u2[1], c2 = void 0 === u2[3] ? m : '"' === u2[3] ? g : p) : c2 === g || c2 === p ? c2 = m : c2 === v || c2 === _ ? c2 = f : (c2 = m, r2 = void 0);
1161
- const x2 = c2 === m && t2[i4 + 1].startsWith("/>") ? " " : "";
1162
- l2 += c2 === f ? s3 + n$1 : d2 >= 0 ? (o2.push(a2), s3.slice(0, d2) + e$4 + s3.slice(d2) + h + x2) : s3 + h + (-2 === d2 ? i4 : x2);
1163
- }
1164
- return [P(t2, l2 + (t2[s2] || "<?>") + (2 === i3 ? "</svg>" : 3 === i3 ? "</math>" : "")), o2];
1165
- };
1166
- class N {
1167
- constructor({ strings: t2, _$litType$: s2 }, n3) {
1168
- let r2;
1169
- this.parts = [];
1170
- let c2 = 0, a2 = 0;
1171
- const u2 = t2.length - 1, d2 = this.parts, [f2, v2] = V(t2, s2);
1172
- if (this.el = N.createElement(f2, n3), C.currentNode = this.el.content, 2 === s2 || 3 === s2) {
1173
- const t3 = this.el.content.firstChild;
1174
- t3.replaceWith(...t3.childNodes);
1175
- }
1176
- for (; null !== (r2 = C.nextNode()) && d2.length < u2; ) {
1177
- if (1 === r2.nodeType) {
1178
- if (r2.hasAttributes()) for (const t3 of r2.getAttributeNames()) if (t3.endsWith(e$4)) {
1179
- const i3 = v2[a2++], s3 = r2.getAttribute(t3).split(h), e2 = /([.?@])?(.*)/.exec(i3);
1180
- d2.push({ type: 1, index: c2, name: e2[2], strings: s3, ctor: "." === e2[1] ? H : "?" === e2[1] ? I : "@" === e2[1] ? L : k }), r2.removeAttribute(t3);
1181
- } else t3.startsWith(h) && (d2.push({ type: 6, index: c2 }), r2.removeAttribute(t3));
1182
- if ($.test(r2.tagName)) {
1183
- const t3 = r2.textContent.split(h), s3 = t3.length - 1;
1184
- if (s3 > 0) {
1185
- r2.textContent = i$2 ? i$2.emptyScript : "";
1186
- for (let i3 = 0; i3 < s3; i3++) r2.append(t3[i3], l()), C.nextNode(), d2.push({ type: 2, index: ++c2 });
1187
- r2.append(t3[s3], l());
1188
- }
1189
- }
1190
- } else if (8 === r2.nodeType) if (r2.data === o$3) d2.push({ type: 2, index: c2 });
1191
- else {
1192
- let t3 = -1;
1193
- for (; -1 !== (t3 = r2.data.indexOf(h, t3 + 1)); ) d2.push({ type: 7, index: c2 }), t3 += h.length - 1;
1194
- }
1195
- c2++;
1196
- }
1197
- }
1198
- static createElement(t2, i3) {
1199
- const s2 = r$2.createElement("template");
1200
- return s2.innerHTML = t2, s2;
1201
- }
1202
- }
1203
- function S(t2, i3, s2 = t2, e2) {
1204
- if (i3 === T) return i3;
1205
- let h2 = void 0 !== e2 ? s2._$Co?.[e2] : s2._$Cl;
1206
- const o2 = c(i3) ? void 0 : i3._$litDirective$;
1207
- return h2?.constructor !== o2 && (h2?._$AO?.(false), void 0 === o2 ? h2 = void 0 : (h2 = new o2(t2), h2._$AT(t2, s2, e2)), void 0 !== e2 ? (s2._$Co ??= [])[e2] = h2 : s2._$Cl = h2), void 0 !== h2 && (i3 = S(t2, h2._$AS(t2, i3.values), h2, e2)), i3;
1208
- }
1209
- class M {
1210
- constructor(t2, i3) {
1211
- this._$AV = [], this._$AN = void 0, this._$AD = t2, this._$AM = i3;
1212
- }
1213
- get parentNode() {
1214
- return this._$AM.parentNode;
1215
- }
1216
- get _$AU() {
1217
- return this._$AM._$AU;
1218
- }
1219
- u(t2) {
1220
- const { el: { content: i3 }, parts: s2 } = this._$AD, e2 = (t2?.creationScope ?? r$2).importNode(i3, true);
1221
- C.currentNode = e2;
1222
- let h2 = C.nextNode(), o2 = 0, n3 = 0, l2 = s2[0];
1223
- for (; void 0 !== l2; ) {
1224
- if (o2 === l2.index) {
1225
- let i4;
1226
- 2 === l2.type ? i4 = new R(h2, h2.nextSibling, this, t2) : 1 === l2.type ? i4 = new l2.ctor(h2, l2.name, l2.strings, this, t2) : 6 === l2.type && (i4 = new z(h2, this, t2)), this._$AV.push(i4), l2 = s2[++n3];
1227
- }
1228
- o2 !== l2?.index && (h2 = C.nextNode(), o2++);
1229
- }
1230
- return C.currentNode = r$2, e2;
1231
- }
1232
- p(t2) {
1233
- let i3 = 0;
1234
- for (const s2 of this._$AV) void 0 !== s2 && (void 0 !== s2.strings ? (s2._$AI(t2, s2, i3), i3 += s2.strings.length - 2) : s2._$AI(t2[i3])), i3++;
1235
- }
1236
- }
1237
- class R {
1238
- get _$AU() {
1239
- return this._$AM?._$AU ?? this._$Cv;
1240
- }
1241
- constructor(t2, i3, s2, e2) {
1242
- this.type = 2, this._$AH = E, this._$AN = void 0, this._$AA = t2, this._$AB = i3, this._$AM = s2, this.options = e2, this._$Cv = e2?.isConnected ?? true;
1243
- }
1244
- get parentNode() {
1245
- let t2 = this._$AA.parentNode;
1246
- const i3 = this._$AM;
1247
- return void 0 !== i3 && 11 === t2?.nodeType && (t2 = i3.parentNode), t2;
1248
- }
1249
- get startNode() {
1250
- return this._$AA;
1251
- }
1252
- get endNode() {
1253
- return this._$AB;
1254
- }
1255
- _$AI(t2, i3 = this) {
1256
- t2 = S(this, t2, i3), c(t2) ? t2 === E || null == t2 || "" === t2 ? (this._$AH !== E && this._$AR(), this._$AH = E) : t2 !== this._$AH && t2 !== T && this._(t2) : void 0 !== t2._$litType$ ? this.$(t2) : void 0 !== t2.nodeType ? this.T(t2) : u(t2) ? this.k(t2) : this._(t2);
1257
- }
1258
- O(t2) {
1259
- return this._$AA.parentNode.insertBefore(t2, this._$AB);
1260
- }
1261
- T(t2) {
1262
- this._$AH !== t2 && (this._$AR(), this._$AH = this.O(t2));
1263
- }
1264
- _(t2) {
1265
- this._$AH !== E && c(this._$AH) ? this._$AA.nextSibling.data = t2 : this.T(r$2.createTextNode(t2)), this._$AH = t2;
1266
- }
1267
- $(t2) {
1268
- const { values: i3, _$litType$: s2 } = t2, e2 = "number" == typeof s2 ? this._$AC(t2) : (void 0 === s2.el && (s2.el = N.createElement(P(s2.h, s2.h[0]), this.options)), s2);
1269
- if (this._$AH?._$AD === e2) this._$AH.p(i3);
1270
- else {
1271
- const t3 = new M(e2, this), s3 = t3.u(this.options);
1272
- t3.p(i3), this.T(s3), this._$AH = t3;
1273
- }
1274
- }
1275
- _$AC(t2) {
1276
- let i3 = A.get(t2.strings);
1277
- return void 0 === i3 && A.set(t2.strings, i3 = new N(t2)), i3;
1278
- }
1279
- k(t2) {
1280
- a(this._$AH) || (this._$AH = [], this._$AR());
1281
- const i3 = this._$AH;
1282
- let s2, e2 = 0;
1283
- for (const h2 of t2) e2 === i3.length ? i3.push(s2 = new R(this.O(l()), this.O(l()), this, this.options)) : s2 = i3[e2], s2._$AI(h2), e2++;
1284
- e2 < i3.length && (this._$AR(s2 && s2._$AB.nextSibling, e2), i3.length = e2);
1285
- }
1286
- _$AR(t2 = this._$AA.nextSibling, i3) {
1287
- for (this._$AP?.(false, true, i3); t2 !== this._$AB; ) {
1288
- const i4 = t2.nextSibling;
1289
- t2.remove(), t2 = i4;
1290
- }
1291
- }
1292
- setConnected(t2) {
1293
- void 0 === this._$AM && (this._$Cv = t2, this._$AP?.(t2));
1294
- }
1295
- }
1296
- class k {
1297
- get tagName() {
1298
- return this.element.tagName;
1299
- }
1300
- get _$AU() {
1301
- return this._$AM._$AU;
1302
- }
1303
- constructor(t2, i3, s2, e2, h2) {
1304
- this.type = 1, this._$AH = E, this._$AN = void 0, this.element = t2, this.name = i3, this._$AM = e2, this.options = h2, s2.length > 2 || "" !== s2[0] || "" !== s2[1] ? (this._$AH = Array(s2.length - 1).fill(new String()), this.strings = s2) : this._$AH = E;
1305
- }
1306
- _$AI(t2, i3 = this, s2, e2) {
1307
- const h2 = this.strings;
1308
- let o2 = false;
1309
- if (void 0 === h2) t2 = S(this, t2, i3, 0), o2 = !c(t2) || t2 !== this._$AH && t2 !== T, o2 && (this._$AH = t2);
1310
- else {
1311
- const e3 = t2;
1312
- let n3, r2;
1313
- for (t2 = h2[0], n3 = 0; n3 < h2.length - 1; n3++) r2 = S(this, e3[s2 + n3], i3, n3), r2 === T && (r2 = this._$AH[n3]), o2 ||= !c(r2) || r2 !== this._$AH[n3], r2 === E ? t2 = E : t2 !== E && (t2 += (r2 ?? "") + h2[n3 + 1]), this._$AH[n3] = r2;
1314
- }
1315
- o2 && !e2 && this.j(t2);
1316
- }
1317
- j(t2) {
1318
- t2 === E ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t2 ?? "");
1319
- }
1320
- }
1321
- class H extends k {
1322
- constructor() {
1323
- super(...arguments), this.type = 3;
1324
- }
1325
- j(t2) {
1326
- this.element[this.name] = t2 === E ? void 0 : t2;
1327
- }
1328
- }
1329
- class I extends k {
1330
- constructor() {
1331
- super(...arguments), this.type = 4;
1332
- }
1333
- j(t2) {
1334
- this.element.toggleAttribute(this.name, !!t2 && t2 !== E);
1335
- }
1336
- }
1337
- class L extends k {
1338
- constructor(t2, i3, s2, e2, h2) {
1339
- super(t2, i3, s2, e2, h2), this.type = 5;
1340
- }
1341
- _$AI(t2, i3 = this) {
1342
- if ((t2 = S(this, t2, i3, 0) ?? E) === T) return;
1343
- const s2 = this._$AH, e2 = t2 === E && s2 !== E || t2.capture !== s2.capture || t2.once !== s2.once || t2.passive !== s2.passive, h2 = t2 !== E && (s2 === E || e2);
1344
- e2 && this.element.removeEventListener(this.name, this, s2), h2 && this.element.addEventListener(this.name, this, t2), this._$AH = t2;
1345
- }
1346
- handleEvent(t2) {
1347
- "function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t2) : this._$AH.handleEvent(t2);
1348
- }
1349
- }
1350
- class z {
1351
- constructor(t2, i3, s2) {
1352
- this.element = t2, this.type = 6, this._$AN = void 0, this._$AM = i3, this.options = s2;
1353
- }
1354
- get _$AU() {
1355
- return this._$AM._$AU;
1356
- }
1357
- _$AI(t2) {
1358
- S(this, t2);
1359
- }
1360
- }
1361
- const j = t$3.litHtmlPolyfillSupport;
1362
- j?.(N, R), (t$3.litHtmlVersions ??= []).push("3.3.1");
1363
- const B = (t2, i3, s2) => {
1364
- const e2 = s2?.renderBefore ?? i3;
1365
- let h2 = e2._$litPart$;
1366
- if (void 0 === h2) {
1367
- const t3 = s2?.renderBefore ?? null;
1368
- e2._$litPart$ = h2 = new R(i3.insertBefore(l(), t3), t3, void 0, s2 ?? {});
1369
- }
1370
- return h2._$AI(t2), h2;
1371
- };
1372
- /**
1373
- * @license
1374
- * Copyright 2017 Google LLC
1375
- * SPDX-License-Identifier: BSD-3-Clause
1376
- */
1377
- const s = globalThis;
1378
- let i$1 = class i extends y$1 {
1379
- constructor() {
1380
- super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
1381
- }
1382
- createRenderRoot() {
1383
- const t2 = super.createRenderRoot();
1384
- return this.renderOptions.renderBefore ??= t2.firstChild, t2;
1385
- }
1386
- update(t2) {
1387
- const r2 = this.render();
1388
- this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t2), this._$Do = B(r2, this.renderRoot, this.renderOptions);
1389
- }
1390
- connectedCallback() {
1391
- super.connectedCallback(), this._$Do?.setConnected(true);
1392
- }
1393
- disconnectedCallback() {
1394
- super.disconnectedCallback(), this._$Do?.setConnected(false);
1395
- }
1396
- render() {
1397
- return T;
1398
- }
1399
- };
1400
- i$1._$litElement$ = true, i$1["finalized"] = true, s.litElementHydrateSupport?.({ LitElement: i$1 });
1401
- const o$2 = s.litElementPolyfillSupport;
1402
- o$2?.({ LitElement: i$1 });
1403
- (s.litElementVersions ??= []).push("4.2.1");
1404
- /**
1405
- * @license
1406
- * Copyright 2017 Google LLC
1407
- * SPDX-License-Identifier: BSD-3-Clause
1408
- */
1409
- const t$2 = (t2) => (e2, o2) => {
1410
- void 0 !== o2 ? o2.addInitializer((() => {
1411
- customElements.define(t2, e2);
1412
- })) : customElements.define(t2, e2);
1413
- };
1414
- /**
1415
- * @license
1416
- * Copyright 2017 Google LLC
1417
- * SPDX-License-Identifier: BSD-3-Clause
1418
- */
1419
- const o$1 = { attribute: true, type: String, converter: u$1, reflect: false, hasChanged: f$1 }, r$1 = (t2 = o$1, e2, r2) => {
1420
- const { kind: n3, metadata: i3 } = r2;
1421
- let s2 = globalThis.litPropertyMetadata.get(i3);
1422
- if (void 0 === s2 && globalThis.litPropertyMetadata.set(i3, s2 = /* @__PURE__ */ new Map()), "setter" === n3 && ((t2 = Object.create(t2)).wrapped = true), s2.set(r2.name, t2), "accessor" === n3) {
1423
- const { name: o2 } = r2;
1424
- return { set(r3) {
1425
- const n4 = e2.get.call(this);
1426
- e2.set.call(this, r3), this.requestUpdate(o2, n4, t2);
1427
- }, init(e3) {
1428
- return void 0 !== e3 && this.C(o2, void 0, t2, e3), e3;
1429
- } };
1430
- }
1431
- if ("setter" === n3) {
1432
- const { name: o2 } = r2;
1433
- return function(r3) {
1434
- const n4 = this[o2];
1435
- e2.call(this, r3), this.requestUpdate(o2, n4, t2);
1436
- };
1437
- }
1438
- throw Error("Unsupported decorator location: " + n3);
1439
- };
1440
- function n2(t2) {
1441
- return (e2, o2) => "object" == typeof o2 ? r$1(t2, e2, o2) : ((t3, e3, o3) => {
1442
- const r2 = e3.hasOwnProperty(o3);
1443
- return e3.constructor.createProperty(o3, t3), r2 ? Object.getOwnPropertyDescriptor(e3, o3) : void 0;
1444
- })(t2, e2, o2);
1445
- }
1446
- /**
1447
- * @license
1448
- * Copyright 2017 Google LLC
1449
- * SPDX-License-Identifier: BSD-3-Clause
1450
- */
1451
- const e$3 = (e2, t2, c2) => (c2.configurable = true, c2.enumerable = true, Reflect.decorate && "object" != typeof t2 && Object.defineProperty(e2, t2, c2), c2);
1452
- /**
1453
- * @license
1454
- * Copyright 2017 Google LLC
1455
- * SPDX-License-Identifier: BSD-3-Clause
1456
- */
1457
- function e$2(e2, r2) {
1458
- return (n3, s2, i3) => {
1459
- const o2 = (t2) => t2.renderRoot?.querySelector(e2) ?? null;
1460
- return e$3(n3, s2, { get() {
1461
- return o2(this);
1462
- } });
1463
- };
1464
- }
1465
- /**
1466
- * @license
1467
- * Copyright 2017 Google LLC
1468
- * SPDX-License-Identifier: BSD-3-Clause
1469
- */
1470
- function r(r2) {
1471
- return (n3, e2) => e$3(n3, e2, { async get() {
1472
- return await this.updateComplete, this.renderRoot?.querySelector(r2) ?? null;
1473
- } });
1474
- }
1475
- var __defProp$c = Object.defineProperty;
1476
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
1477
- var __decorateClass$c = (decorators, target, key, kind) => {
1478
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
1479
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1480
- if (decorator = decorators[i3])
1481
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1482
- if (kind && result) __defProp$c(target, key, result);
1483
- return result;
1484
- };
1485
- let movePanelItemList = [];
1486
- let movePanelItemMaxZindex = 99999;
1487
- let HmMovePanel = class extends i$1 {
1488
- constructor() {
1489
- super();
1490
- this.width = 320;
1491
- this.height = 490;
1492
- this.headerBackgroundColor = "rgba(66,134,182,0.9)";
1493
- this.headerColor = "rgb(255,255,255)";
1494
- this.bodyBackgroundColor = "rgba(255,255,255,0.7)";
1495
- this.bodyColor = "rgba(23, 23, 23, 0.9)";
1496
- this.footerBackgroundColor = "rgba(255,255,255,0.7)";
1497
- this.buttonBackgroundColor = "rgba(255,255,255,0.9)";
1498
- this.buttonColor = "rgba(66,134,182,0.9)";
1499
- this.titleContent = "面板";
1500
- this.leftButtonText = "按钮1";
1501
- this.rightButtonText = "按钮2";
1502
- this.isDisplay = false;
1503
- this.zIndex = movePanelItemMaxZindex;
1504
- this.icon = "magic-wand";
1505
- this.left = (window.innerWidth - this.width) / 2;
1506
- this.top = (window.innerHeight - (this.height + 80)) / 2;
1507
- this.dragging = false;
1508
- movePanelItemList.push(this);
1509
- this.zIndex = ++movePanelItemMaxZindex;
1510
- }
1511
- handleLeftClick() {
1512
- this.hideMovePanel();
1513
- }
1514
- handleRightClick() {
1515
- this.hideMovePanel();
1516
- }
1517
- /** 关闭移动窗口 */
1518
- hideMovePanel() {
1519
- this.isDisplay = false;
1520
- console.debug("关闭事件");
1521
- this.dispatchEvent(new CustomEvent("close", {
1522
- detail: { isDisplay: this.isDisplay, message: "关闭事件" },
1523
- bubbles: true,
1524
- composed: true
1525
- }));
1526
- }
1527
- /** 显示移动窗口 */
1528
- showMovePanel() {
1529
- this.isDisplay = true;
1530
- console.debug("显示事件");
1531
- this.dispatchEvent(new CustomEvent("show", {
1532
- detail: { isDisplay: this.isDisplay },
1533
- bubbles: true,
1534
- composed: true
1535
- }));
1536
- }
1537
- /** 显示状态翻转 */
1538
- toogleDisplay() {
1539
- if (this.isDisplay) {
1540
- this.hideMovePanel();
1541
- } else {
1542
- this.showMovePanel();
1543
- }
1544
- }
1545
- mouseDragging(e2) {
1546
- let templeft = this.left;
1547
- let temptop = this.top;
1548
- let offsetX = e2.clientX - templeft;
1549
- let offsetY = e2.clientY - temptop;
1550
- this.dragging == false && (this.dragging = true);
1551
- document.onmousemove = (e22) => {
1552
- if (this.dragging) {
1553
- this.left = e22.clientX - offsetX;
1554
- this.top = e22.clientY - offsetY;
1555
- }
1556
- };
1557
- document.onmouseup = () => {
1558
- this.dragging && (this.dragging = false);
1559
- document.onmousemove = null;
1560
- };
1561
- }
1562
- // 适配移动端
1563
- touchDragging(e2) {
1564
- let templeft = this.left;
1565
- let temptop = this.top;
1566
- let offsetX = e2.touches[0].clientX - templeft;
1567
- let offsetY = e2.touches[0].clientY - temptop;
1568
- this.dragging == false && (this.dragging = true);
1569
- document.ontouchmove = (e22) => {
1570
- if (this.dragging) {
1571
- this.left = e22.touches[0].clientX - offsetX;
1572
- this.top = e22.touches[0].clientY - offsetY;
1573
- }
1574
- };
1575
- document.ontouchend = () => {
1576
- this.dragging && (this.dragging = false);
1577
- document.onmousemove = null;
1578
- };
1579
- }
1580
- // 置顶窗口
1581
- putTop() {
1582
- let res = false;
1583
- if (movePanelItemList.includes(this)) {
1584
- for (let i3 = 0; i3 < movePanelItemList.length; i3++) {
1585
- if (movePanelItemList[i3].zIndex > this.zIndex)
1586
- movePanelItemList[i3].zIndex = movePanelItemList[i3].zIndex - 1;
1587
- }
1588
- this.zIndex = movePanelItemMaxZindex;
1589
- res = true;
1590
- } else {
1591
- res = false;
1592
- }
1593
- return res;
1594
- }
1595
- /**
1596
- * 切换元素的置顶状态和显示状态
1597
- *
1598
- * 当元素的zIndex不等于最大移动面板层级时,将元素置于顶层并显示移动面板;
1599
- * 当元素的zIndex等于最大移动面板层级时,切换元素的显示状态
1600
- */
1601
- putTopToggel() {
1602
- if (this.zIndex != movePanelItemMaxZindex) {
1603
- this.putTop();
1604
- this.showMovePanel();
1605
- } else {
1606
- this.toogleDisplay();
1607
- }
1608
- }
1609
- render() {
1610
- return x`
1611
- <div
1612
- class="panel"
1613
- style="
1614
- width: ${this.width}px;
1615
- height: ${this.height + 80}px;
1616
- left: ${this.left}px;
1617
- top: ${this.top}px;
1618
- display: ${this.isDisplay ? "block" : "none"};
1619
- z-index: ${this.zIndex};
1620
- "
1621
- @mousedown="${this.putTop}"
1622
- @touchstart="${this.putTop}"
1623
- >
1624
- <div
1625
- class="header"
1626
- style="background-color: ${this.headerBackgroundColor}; color: ${this.headerColor};"
1627
- @mousedown="${this.mouseDragging}"
1628
- @touchstart="${this.touchDragging}"
1629
- >
1630
- <div class="header-left">
1631
- <div class="header-icon">
1632
- <slot name="left-icon" class="left-icon">
1633
- <hm-icon icon="${this.icon}" size="24px"></hm-icon>
1634
- </slot>
1635
- </div>
1636
- <div class="header-title">${this.titleContent}</div>
1637
- </div>
1638
- <div class="header-close" @click="${this._handleClose}">
1639
- <slot name="right-icon" class="right-icon">
1640
- <hm-icon icon="close" size="18px"></hm-icon>
1641
- </slot>
1642
- </div>
1643
- </div>
1644
- <div
1645
- class="body"
1646
- style="background-color: ${this.bodyBackgroundColor}; color: ${this.bodyColor}; height:${this.height}px;width:${this.width}px;"
1647
- >
1648
- <slot></slot>
1649
- </div>
1650
- <div class="footer" style="background-color: ${this.footerBackgroundColor};width:${this.width}px;">
1651
- <hm-button
1652
- class="footer-button footer-button-left"
1653
- icon="magic-wand"
1654
- width="100%"
1655
- backgroundColor="${this.buttonBackgroundColor}"
1656
- color="${this.buttonColor}"
1657
- @click="${this._handleLeftButtonClick}"
1658
- >
1659
- ${this.leftButtonText}
1660
- </hm-button>
1661
- <hm-button
1662
- class="footer-button footer-button-right"
1663
- icon="magic-wand"
1664
- width="100%"
1665
- backgroundColor="${this.buttonColor}"
1666
- color="${this.buttonBackgroundColor}"
1667
- @click="${this._handleRightButtonClick}"
1668
- >
1669
- ${this.rightButtonText}
1670
- </hm-button>
1671
- </div>
1672
- </div>
1673
-
1674
- `;
1675
- }
1676
- _handleClose() {
1677
- this.hideMovePanel();
1678
- }
1679
- _handleLeftButtonClick() {
1680
- this.dispatchEvent(new CustomEvent("left-button-click", {
1681
- detail: { message: "左侧按钮被点击" },
1682
- bubbles: true,
1683
- composed: true
1684
- }));
1685
- }
1686
- _handleRightButtonClick() {
1687
- this.dispatchEvent(new CustomEvent("right-button-click", {
1688
- detail: { message: "右侧按钮被点击" },
1689
- bubbles: true,
1690
- composed: true
1691
- }));
1692
- }
1693
- };
1694
- HmMovePanel.styles = i$4`
1695
- .panel {
1696
- position: absolute;
1697
- display: block;
1698
- }
1699
-
1700
- .header {
1701
- display: flex;
1702
- align-items: center;
1703
- justify-content: space-between;
1704
- height: 40px;
1705
- }
1706
- .header-left {
1707
- display: flex;
1708
- align-items: center;
1709
- }
1710
-
1711
- .header-icon {
1712
- display: flex;
1713
- align-items: center;
1714
- margin-left: 24px;
1715
- margin-right: 24px;
1716
- }
1717
- .left-icon {
1718
- display: flex;
1719
- align-items: center;
1720
- }
1721
- .header-title {
1722
- margin-right: auto;
1723
- font-size: 16px !important;
1724
- opacity: 0.7;
1725
- font-weight: bold;
1726
- height: 100%;
1727
- line-height: 40px;
1728
- }
1729
-
1730
-
1731
- .header-close {
1732
- cursor: pointer;
1733
- display: flex;
1734
- align-items: center;
1735
- justify-content: center;
1736
- width: 40px;
1737
- higth: 40px;
1738
- }
1739
-
1740
- .body {
1741
- display: block;
1742
- position: absolute;
1743
- top: 40px;
1744
- overflow: auto;
1745
- scrollbar-width: none; /* Firefox */
1746
- }
1747
- .body::-webkit-scrollbar {
1748
- display: none; /* Chrome/Safari/Webkit */
1749
- }
1750
-
1751
- .footer {
1752
- display: flex;
1753
- position: absolute;
1754
- height: 40px;
1755
- bottom: 0px;
1756
- width: 100%; /* 添加宽度占满父容器 */
1757
- box-sizing: border-box; /* 确保padding不会增加元素总宽度 */
1758
- }
1759
-
1760
- .footer-button {
1761
- flex: 1;
1762
- border: none;
1763
- border-radius: 4px;
1764
- cursor: pointer;
1765
- transition: all 0.2s;
1766
- }
1767
-
1768
- .footer-button:active {
1769
- transform: scale(0.98);
1770
- }
1771
- `;
1772
- __decorateClass$c([
1773
- n2({ type: Number })
1774
- ], HmMovePanel.prototype, "width", 2);
1775
- __decorateClass$c([
1776
- n2({ type: Number })
1777
- ], HmMovePanel.prototype, "height", 2);
1778
- __decorateClass$c([
1779
- n2({ type: String, attribute: "header-background-color" })
1780
- ], HmMovePanel.prototype, "headerBackgroundColor", 2);
1781
- __decorateClass$c([
1782
- n2({ type: String, attribute: "header-color" })
1783
- ], HmMovePanel.prototype, "headerColor", 2);
1784
- __decorateClass$c([
1785
- n2({ type: String, attribute: "body-background-color" })
1786
- ], HmMovePanel.prototype, "bodyBackgroundColor", 2);
1787
- __decorateClass$c([
1788
- n2({ type: String, attribute: "body-color" })
1789
- ], HmMovePanel.prototype, "bodyColor", 2);
1790
- __decorateClass$c([
1791
- n2({ type: String, attribute: "footer-background-color" })
1792
- ], HmMovePanel.prototype, "footerBackgroundColor", 2);
1793
- __decorateClass$c([
1794
- n2({ type: String, attribute: "button-background-color" })
1795
- ], HmMovePanel.prototype, "buttonBackgroundColor", 2);
1796
- __decorateClass$c([
1797
- n2({ type: String, attribute: "button-color" })
1798
- ], HmMovePanel.prototype, "buttonColor", 2);
1799
- __decorateClass$c([
1800
- n2({ type: String })
1801
- ], HmMovePanel.prototype, "titleContent", 2);
1802
- __decorateClass$c([
1803
- n2({ type: String, attribute: "left-button-text" })
1804
- ], HmMovePanel.prototype, "leftButtonText", 2);
1805
- __decorateClass$c([
1806
- n2({ type: String, attribute: "right-button-text" })
1807
- ], HmMovePanel.prototype, "rightButtonText", 2);
1808
- __decorateClass$c([
1809
- n2({ type: Boolean, attribute: "is-display" })
1810
- ], HmMovePanel.prototype, "isDisplay", 2);
1811
- __decorateClass$c([
1812
- n2({ type: Number })
1813
- ], HmMovePanel.prototype, "zIndex", 2);
1814
- __decorateClass$c([
1815
- n2({ type: String })
1816
- ], HmMovePanel.prototype, "icon", 2);
1817
- __decorateClass$c([
1818
- n2({ type: Number })
1819
- ], HmMovePanel.prototype, "left", 2);
1820
- __decorateClass$c([
1821
- n2({ type: Number })
1822
- ], HmMovePanel.prototype, "top", 2);
1823
- __decorateClass$c([
1824
- r(".body")
1825
- ], HmMovePanel.prototype, "body", 2);
1826
- HmMovePanel = __decorateClass$c([
1827
- t$2("hm-move-panel")
1828
- ], HmMovePanel);
1829
- const hmMovePanel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1830
- __proto__: null,
1831
- get HmMovePanel() {
1832
- return HmMovePanel;
1833
- },
1834
- movePanelItemList,
1835
- get movePanelItemMaxZindex() {
1836
- return movePanelItemMaxZindex;
1837
- }
1838
- }, Symbol.toStringTag, { value: "Module" }));
1839
- /**
1840
- * @license
1841
- * Copyright 2017 Google LLC
1842
- * SPDX-License-Identifier: BSD-3-Clause
1843
- */
1844
- const t$1 = { CHILD: 2 }, e$1 = (t2) => (...e2) => ({ _$litDirective$: t2, values: e2 });
1845
- class i2 {
1846
- constructor(t2) {
1847
- }
1848
- get _$AU() {
1849
- return this._$AM._$AU;
1850
- }
1851
- _$AT(t2, e2, i3) {
1852
- this._$Ct = t2, this._$AM = e2, this._$Ci = i3;
1853
- }
1854
- _$AS(t2, e2) {
1855
- return this.update(t2, e2);
1856
- }
1857
- update(t2, e2) {
1858
- return this.render(...e2);
1859
- }
1860
- }
1861
- /**
1862
- * @license
1863
- * Copyright 2017 Google LLC
1864
- * SPDX-License-Identifier: BSD-3-Clause
1865
- */
1866
- class e extends i2 {
1867
- constructor(i3) {
1868
- if (super(i3), this.it = E, i3.type !== t$1.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
1869
- }
1870
- render(r2) {
1871
- if (r2 === E || null == r2) return this._t = void 0, this.it = r2;
1872
- if (r2 === T) return r2;
1873
- if ("string" != typeof r2) throw Error(this.constructor.directiveName + "() called with a non-string value");
1874
- if (r2 === this.it) return this._t;
1875
- this.it = r2;
1876
- const s2 = [r2];
1877
- return s2.raw = s2, this._t = { _$litType$: this.constructor.resultType, strings: s2, values: [] };
1878
- }
1879
- }
1880
- e.directiveName = "unsafeHTML", e.resultType = 1;
1881
- /**
1882
- * @license
1883
- * Copyright 2017 Google LLC
1884
- * SPDX-License-Identifier: BSD-3-Clause
1885
- */
1886
- class t extends e {
1887
- }
1888
- t.directiveName = "unsafeSVG", t.resultType = 2;
1889
- const o = e$1(t);
1890
- var __defProp$b = Object.defineProperty;
1891
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
1892
- var __decorateClass$b = (decorators, target, key, kind) => {
1893
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
1894
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1895
- if (decorator = decorators[i3])
1896
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1897
- if (kind && result) __defProp$b(target, key, result);
1898
- return result;
1899
- };
1900
- const iconMap = /* @__PURE__ */ new Map([
1901
- ["magic-wand", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m12.64 1.87l-.84 2.48a.41.41 0 0 0 0 .37l1.57 2.1a.4.4 0 0 1-.33.64h-2.62a.43.43 0 0 0-.33.17l-1.46 2.1a.4.4 0 0 1-.71-.11l-.78-2.5a.38.38 0 0 0-.26-.26l-2.5-.78a.4.4 0 0 1-.11-.71l2.14-1.51a.43.43 0 0 0 .17-.33V.91a.4.4 0 0 1 .6-.33l2.1 1.57a.41.41 0 0 0 .37.05l2.48-.84a.4.4 0 0 1 .51.51m-5.6 5.09L.5 13.5" stroke-width="1"/></svg>'],
1902
- ["close", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z"/></svg>'],
1903
- ["open", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M4 21q-.425 0-.712-.288T3 20v-6q0-.425.288-.712T4 13t.713.288T5 14v3.6L17.6 5H14q-.425 0-.712-.288T13 4t.288-.712T14 3h6q.425 0 .713.288T21 4v6q0 .425-.288.713T20 11t-.712-.288T19 10V6.4L6.4 19H10q.425 0 .713.288T11 20t-.288.713T10 21z"/></svg>'],
1904
- ["arrow-up", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M16.21 16H7.79a1.76 1.76 0 0 1-1.59-1a2.1 2.1 0 0 1 .26-2.21l4.21-5.1a1.76 1.76 0 0 1 2.66 0l4.21 5.1A2.1 2.1 0 0 1 17.8 15a1.76 1.76 0 0 1-1.59 1"/></svg>'],
1905
- ["arrow-down", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M12 17a1.72 1.72 0 0 1-1.33-.64l-4.21-5.1a2.1 2.1 0 0 1-.26-2.21A1.76 1.76 0 0 1 7.79 8h8.42a1.76 1.76 0 0 1 1.59 1.05a2.1 2.1 0 0 1-.26 2.21l-4.21 5.1A1.72 1.72 0 0 1 12 17"/></svg>'],
1906
- ["template", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><defs><mask id="SVGZZ153dkC"><path fill="#4d4d4d" stroke="#fff" stroke-linejoin="round" stroke-width="4" d="M23 4H4v22h19zm21 30H4v9h40zm0-30H31v8h13zm0 14H31v8h13z"/></mask></defs><path fill="currentColor" d="M0 0h48v48H0z" mask="url(#SVGZZ153dkC)"/></svg>'],
1907
- ["js", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="currentColor" d="M10.77 7.3h.002c1.045.393 2.479.93 2.479 2.45a2.5 2.5 0 0 1-.224 1.02a2.5 2.5 0 0 1-1.515 1.364a2.5 2.5 0 0 1-1.035.115a2 2 0 0 1-.214.012a2.5 2.5 0 0 1-1.673-.65a2.52 2.52 0 0 1-.838-1.859c0-.202.078-.39.22-.532a.77.77 0 0 1 1.06 0a.74.74 0 0 1 .221.53c0 .952 1.041 1 1.25 1s1.25-.048 1.25-1c0-.413-.447-.648-1.514-1.048h-.003C9.19 8.307 7.753 7.77 7.753 6.25q.005-.537.224-1.02a2.5 2.5 0 0 1 .614-.842a2.5 2.5 0 0 1 .9-.52a3.5 3.5 0 0 1 2.023 0a2.52 2.52 0 0 1 1.738 2.381c0 .201-.078.39-.22.531a.77.77 0 0 1-1.061 0a.74.74 0 0 1-.22-.53c0-.952-1.041-1-1.25-1s-1.25.048-1.25 1c0 .413.447.648 1.514 1.048zM5.751 4.5c0-.2.078-.388.22-.53a.77.77 0 0 1 1.06 0c.142.141.22.33.22.53v5a2.75 2.75 0 0 1-4.695 1.945A2.73 2.73 0 0 1 1.75 9.5V9c0-.2.078-.388.22-.53a.77.77 0 0 1 1.061 0c.142.141.22.33.22.53v.5c0 .33.134.652.366.884c.465.465 1.303.465 1.768 0c.232-.233.366-.555.366-.884z"/></svg>'],
1908
- ["filter", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3 4c2.01 2.59 7 9 7 9v7h4v-7s4.98-6.41 7-9z"/></svg>'],
1909
- ["filter-off", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M3.004 1.59L3 1.586L1.586 3l4.928 4.928L10 12.818V21h4v-5.585l7 7l1.41-1.41L3 1.595zm12.266 9.446L21 3H7.234z"/></svg>'],
1910
- ["eye", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M16 11v2h-1v1h-1v1h-1v1h-2v-1h-1v-1H9v-1H8v-2h2v-1h1V8h2v1h1v1h1v1z"/><path fill="currentColor" d="M22 11V9h-1V8h-1V7h-1V6h-2V5H7v1H5v1H4v1H3v1H2v2H1v2h1v2h1v1h1v1h1v1h2v1h10v-1h2v-1h1v-1h1v-1h1v-2h1v-2zm-4 2h-1v2h-1v1h-1v1h-2v1h-2v-1H9v-1H8v-1H7v-2H6v-2h1V9h1V8h1V7h2V6h2v1h2v1h1v1h1v2h1z"/></svg>'],
1911
- ["eye-off", '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M2 13H1v-2h1V9h1V8h1V7h1V6h2V5h8v1h-1v1h-1V6h-2v1H9v1H8v1H7v2H6v2h1v1H6v1H5v1H3v-1H2z"/><path fill="currentColor" d="M8 11h1v1H8zm3-3h1v1h-1zm-2 9H8v1H7v1H6v1H5v1H4v1H3v-1H2v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1v-1h1V9h1V8h1V7h1V6h1V5h1V4h1V3h1V2h1v1h1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1h-1v1H9zm3-2h1v1h-1zm1-1h1v1h-1zm2-2h1v1h-1zm-1 1h1v1h-1z"/><path fill="currentColor" d="M23 11v2h-1v2h-1v1h-1v1h-1v1h-2v1H9v-1h1v-1h1v1h2v-1h2v-1h1v-1h1v-2h1v-2h-1v-1h1V9h1V8h2v1h1v2z"/></svg>']
1912
- ]);
1913
- function registerIcon(name2, svgContent) {
1914
- iconMap.set(name2, svgContent);
1915
- }
1916
- function getIcon(name2) {
1917
- return iconMap.get(name2) || '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14"><path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" d="m12.64 1.87l-.84 2.48a.41.41 0 0 0 0 .37l1.57 2.1a.4.4 0 0 1-.33.64h-2.62a.43.43 0 0 0-.33.17l-1.46 2.1a.4.4 0 0 1-.71-.11l-.78-2.5a.38.38 0 0 0-.26-.26l-2.5-.78a.4.4 0 0 1-.11-.71l2.14-1.51a.43.43 0 0 0 .17-.33V.91a.4.4 0 0 1 .6-.33l2.1 1.57a.41.41 0 0 0 .37.05l2.48-.84a.4.4 0 0 1 .51.51m-5.6 5.09L.5 13.5" stroke-width="1"/></svg>';
1918
- }
1919
- let HmIcon = class extends i$1 {
1920
- constructor() {
1921
- super(...arguments);
1922
- this.icon = "magic-wand";
1923
- this.size = "16px";
1924
- }
1925
- /** 触发点击事件 */
1926
- handelClick() {
1927
- this.dispatchEvent(new CustomEvent("hm-icon-click"));
1928
- }
1929
- render() {
1930
- return x`
1931
- <div class="icon"
1932
- style="width:${this.size}; height:${this.size};"
1933
- @click="${this.handelClick}"
1934
- >
1935
- ${o(getIcon(this.icon))}
1936
- </div>
1937
- `;
1938
- }
1939
- };
1940
- HmIcon.styles = i$4`
1941
- :host {
1942
- display: inline-block;
1943
- }
1944
- .icon {
1945
- display: flex;
1946
- align-items: center;
1947
- justify-content: center;
1948
- width: 100%;
1949
- height: 100%;
1950
- }
1951
-
1952
- .icon svg {
1953
- width: 100%;
1954
- height: 100%;
1955
- }
1956
- `;
1957
- __decorateClass$b([
1958
- n2({ type: String })
1959
- ], HmIcon.prototype, "icon", 2);
1960
- __decorateClass$b([
1961
- n2({ type: String })
1962
- ], HmIcon.prototype, "size", 2);
1963
- HmIcon = __decorateClass$b([
1964
- t$2("hm-icon")
1965
- ], HmIcon);
1966
- const hmIcon = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1967
- __proto__: null,
1968
- get HmIcon() {
1969
- return HmIcon;
1970
- },
1971
- getIcon,
1972
- registerIcon
1973
- }, Symbol.toStringTag, { value: "Module" }));
1974
- var __defProp$a = Object.defineProperty;
1975
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
1976
- var __decorateClass$a = (decorators, target, key, kind) => {
1977
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
1978
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
1979
- if (decorator = decorators[i3])
1980
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
1981
- if (kind && result) __defProp$a(target, key, result);
1982
- return result;
1983
- };
1984
- let HmMenu = class extends i$1 {
1985
- constructor() {
1986
- super(...arguments);
1987
- this.icon = "magic-wand";
1988
- this.content = "HortiMagic";
1989
- this.flag = false;
1990
- this.isMenuItem = false;
1991
- }
1992
- /** 触发点击事件 */
1993
- handleClick() {
1994
- if (!this.isMenuItem)
1995
- this.flag = !this.flag;
1996
- this.dispatchEvent(new CustomEvent("hm-menu-click"));
1997
- }
1998
- render() {
1999
- return x`
2000
- <div
2001
- class="menu ${this.isMenuItem ? "is-menu-item" : "not-menu-item"}"
2002
- style="display:${this.isMenuItem && !this.flag ? "none" : "flex"}"
2003
- @click="${this.handleClick}"
2004
- >
2005
- <hm-icon class="left icon" icon="${this.icon}" size="24px"></hm-icon>
2006
- <div class="content">
2007
- <slot name="content"> ${this.content} </slot>
2008
- </div>
2009
- <div class="right">
2010
- <slot name="right">
2011
- ${this.isMenuItem ? "" : x`<hm-icon
2012
- class="icon right"
2013
- icon="${this.flag ? "arrow-up" : "arrow-down"}"
2014
- ></hm-icon
2015
- >`}
2016
- </slot>
2017
- </div>
2018
- </div>
2019
-
2020
-
2021
-
2022
-
2023
- `;
2024
- }
2025
- };
2026
- HmMenu.styles = i$4`
2027
- :host {
2028
- color: rgb(33,33,33);
2029
- height: 56px;
2030
- }
2031
- .menu:hover {
2032
- color: rgba(255, 255, 0, 1);
2033
- }
2034
- .menu {
2035
- height: 56px;
2036
- align-items: center;
2037
- }
2038
- .icon {
2039
- display: flex;
2040
- justify-content: center;
2041
- align-items: center;
2042
- height: 56px;
2043
- width: 56px;
2044
- }
2045
- .left {
2046
- margin-right: 16px;
2047
- color: rgb(117,117,117);
2048
- }
2049
- .right {
2050
- position: absolute;
2051
- right: 2px;
2052
- display: flex;
2053
- justify-content: center;
2054
- align-items: center;
2055
- }
2056
- .content {
2057
- font-size: 16px;
2058
- font-weight:bold;
2059
- margin-right:auto;
2060
- }
2061
- .is-menu-item {
2062
- background:rgb(240,240,240);
2063
- }
2064
- .not-menu-item {
2065
- background:rgb(255,255,255);
2066
- }
2067
- `;
2068
- __decorateClass$a([
2069
- n2({ type: String })
2070
- ], HmMenu.prototype, "icon", 2);
2071
- __decorateClass$a([
2072
- n2({ type: String })
2073
- ], HmMenu.prototype, "content", 2);
2074
- __decorateClass$a([
2075
- n2({ type: Boolean })
2076
- ], HmMenu.prototype, "flag", 2);
2077
- __decorateClass$a([
2078
- n2({ type: Boolean })
2079
- ], HmMenu.prototype, "isMenuItem", 2);
2080
- HmMenu = __decorateClass$a([
2081
- t$2("hm-menu")
2082
- ], HmMenu);
2083
- const hmMenu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2084
- __proto__: null,
2085
- get HmMenu() {
2086
- return HmMenu;
2087
- }
2088
- }, Symbol.toStringTag, { value: "Module" }));
2089
- var __defProp$9 = Object.defineProperty;
2090
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
2091
- var __decorateClass$9 = (decorators, target, key, kind) => {
2092
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
2093
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2094
- if (decorator = decorators[i3])
2095
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2096
- if (kind && result) __defProp$9(target, key, result);
2097
- return result;
2098
- };
2099
- let HmNotification = class extends i$1 {
2100
- constructor() {
2101
- super(...arguments);
2102
- this.leftIcon = "magic-wand";
2103
- this.title = "HortiMagic";
2104
- this.content = "Hello iirose!";
2105
- this.rightIcon = "";
2106
- this.displayTime = 999999;
2107
- this.color = "rgb(33,33,33)";
2108
- this.backgroundColor = "rgba(255,255,255,0.9)";
2109
- }
2110
- // 组件挂载后启动定时器
2111
- firstUpdated() {
2112
- if (this.displayTime > 0) {
2113
- setTimeout(() => {
2114
- this.startLeaveAnimation();
2115
- }, this.displayTime);
2116
- }
2117
- }
2118
- startLeaveAnimation() {
2119
- this.setAttribute("leaving", "");
2120
- setTimeout(() => {
2121
- this.remove();
2122
- }, 300);
2123
- }
2124
- render() {
2125
- return x`
2126
- <div
2127
- class="hm-notification"
2128
- style="${this.color ? `border-color: ${this.color};` : ""}
2129
- ${this.color ? `color: ${this.color};` : ""}
2130
- ${this.backgroundColor ? `background-color: ${this.backgroundColor};` : ""}"
2131
- >
2132
- ${this.leftIcon ? x`
2133
- <div class="icondiv">
2134
- <hm-icon icon="${this.leftIcon}" size="24px"></hm-icon>
2135
- </div>
2136
- ` : ""}
2137
-
2138
- <div class="hm-notification-main">
2139
- <div class="hm-notification-title">${this.title}</div>
2140
- <div class="hm-notification-content">${this.content}</div>
2141
- </div>
2142
- ${this.rightIcon ? x`
2143
- <div class="icondiv">
2144
- <hm-icon icon="${this.rightIcon}" size="24px"></hm-icon>
2145
- </div>
2146
- ` : ""}
2147
- </div>
2148
- `;
2149
- }
2150
- };
2151
- HmNotification.styles = i$4`
2152
- :host{
2153
- display: block;
2154
- width: auto;
2155
- margin: 2px;
2156
- animation: slideInRight 0.3s ease-out forwards;
2157
- position: relative;
2158
- z-index: 999999;
2159
- }
2160
-
2161
- :host([leaving]) {
2162
- animation: slideOutRight 0.3s ease-in forwards;
2163
- }
2164
-
2165
- @keyframes slideInRight {
2166
- from {
2167
- opacity: 0;
2168
- transform: translate3d(100%, 0, 0);
2169
- }
2170
-
2171
- to {
2172
- opacity: 1;
2173
- transform: translate3d(0, 0, 0);
2174
- }
2175
- }
2176
-
2177
- @keyframes slideOutRight {
2178
- from {
2179
- opacity: 1;
2180
- transform: translate3d(0, 0, 0);
2181
- }
2182
-
2183
- to {
2184
- opacity: 0;
2185
- transform: translate3d(100%, 0, 0);
2186
- }
2187
- }
2188
-
2189
- .hm-notification{
2190
- display: flex;
2191
- align-items: center;
2192
- width:fit-content;
2193
- max-width: 320px;
2194
- border-radius: 10px;
2195
- }
2196
- .hm-notification-main{
2197
- margin-right: 8px;
2198
- padding: 8px;
2199
- }
2200
- .hm-notification-title{
2201
- font-size: 16px;
2202
- font-weight: bold;
2203
- }
2204
- .hm-notification-content{
2205
- font-size: 14px;
2206
- }
2207
- .icondiv{
2208
- display: flex;
2209
- align-items: center;
2210
- justify-content: center;
2211
- width: 44px;
2212
- height: 44px;
2213
- }
2214
- `;
2215
- __decorateClass$9([
2216
- n2()
2217
- ], HmNotification.prototype, "leftIcon", 2);
2218
- __decorateClass$9([
2219
- n2()
2220
- ], HmNotification.prototype, "title", 2);
2221
- __decorateClass$9([
2222
- n2()
2223
- ], HmNotification.prototype, "content", 2);
2224
- __decorateClass$9([
2225
- n2()
2226
- ], HmNotification.prototype, "rightIcon", 2);
2227
- __decorateClass$9([
2228
- n2()
2229
- ], HmNotification.prototype, "displayTime", 2);
2230
- __decorateClass$9([
2231
- n2()
2232
- ], HmNotification.prototype, "color", 2);
2233
- __decorateClass$9([
2234
- n2()
2235
- ], HmNotification.prototype, "backgroundColor", 2);
2236
- HmNotification = __decorateClass$9([
2237
- t$2("hm-notification")
2238
- ], HmNotification);
2239
- const hmNotification = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2240
- __proto__: null,
2241
- get HmNotification() {
2242
- return HmNotification;
2243
- }
2244
- }, Symbol.toStringTag, { value: "Module" }));
2245
- var __defProp$8 = Object.defineProperty;
2246
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
2247
- var __decorateClass$8 = (decorators, target, key, kind) => {
2248
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
2249
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2250
- if (decorator = decorators[i3])
2251
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2252
- if (kind && result) __defProp$8(target, key, result);
2253
- return result;
2254
- };
2255
- let HmButton = class extends i$1 {
2256
- constructor() {
2257
- super(...arguments);
2258
- this.icon = "";
2259
- this.content = "";
2260
- this.fontSize = "14px";
2261
- this.color = "";
2262
- this.background = "";
2263
- this.width = "";
2264
- this.height = "";
2265
- this.enable = true;
2266
- this.loading = false;
2267
- }
2268
- render() {
2269
- const buttonStyle = `
2270
- ${this.color ? `color: ${this.color};` : ""}
2271
- ${this.background ? `background-color: ${this.background};` : ""}
2272
- ${this.width ? `width: ${this.width};` : ""}
2273
- ${this.height ? `height: ${this.height};` : ""}
2274
- ${this.fontSize ? `font-size: ${this.fontSize};` : "14px"}
2275
- `;
2276
- return x`
2277
- <button
2278
- class="button"
2279
- style="${buttonStyle}"
2280
- ?disabled="${!this.enable || this.loading}"
2281
- @click="${this._handleClick}">
2282
-
2283
- ${this.loading ? x`
2284
- <div class="loading-spinner"></div>
2285
- ` : this.icon ? x`
2286
- <slot name="icon">
2287
- <hm-icon icon="${this.icon}" style="margin-right: 8px;"></hm-icon>
2288
- </slot>
2289
- ` : ""}
2290
-
2291
- <span class="button-content">
2292
- <slot>${this.content}</slot>
2293
- </span>
2294
- </button>
2295
- `;
2296
- }
2297
- _handleClick(e2) {
2298
- if (!this.enable || this.loading) {
2299
- e2.stopPropagation();
2300
- return;
2301
- }
2302
- this.dispatchEvent(new CustomEvent("hm-button-click"));
2303
- }
2304
- };
2305
- HmButton.styles = i$4`
2306
- :host {
2307
- display: inline-block;
2308
- }
2309
-
2310
- .button {
2311
- display: inline-flex;
2312
- align-items: center;
2313
- justify-content: center;
2314
- border: none;
2315
- border-radius: 4px;
2316
- padding: 8px 16px;
2317
- cursor: pointer;
2318
- transition: all 0.3s;
2319
- opacity: 1;
2320
- // 添加鼠标悬停动画
2321
- &:hover:not(:disabled) {
2322
- transform: translateY(-2px);
2323
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
2324
- }
2325
- }
2326
-
2327
- .button:disabled {
2328
- cursor: not-allowed;
2329
- opacity: 0.6;
2330
- }
2331
-
2332
- .button.loading {
2333
- cursor: not-allowed;
2334
- }
2335
-
2336
- .loading-spinner {
2337
- width: 14px;
2338
- height: 14px;
2339
- border: 2px solid transparent;
2340
- border-top-color: currentColor;
2341
- border-radius: 50%;
2342
- animation: rotate 1s linear infinite;
2343
- margin-right: 8px;
2344
- }
2345
-
2346
- @keyframes rotate {
2347
- from {
2348
- transform: rotate(0deg);
2349
- }
2350
- to {
2351
- transform: rotate(360deg);
2352
- }
2353
- }
2354
-
2355
- .button-content {
2356
- display: flex;
2357
- align-items: center;
2358
- }
2359
- `;
2360
- __decorateClass$8([
2361
- n2({ type: String })
2362
- ], HmButton.prototype, "icon", 2);
2363
- __decorateClass$8([
2364
- n2({ type: String })
2365
- ], HmButton.prototype, "content", 2);
2366
- __decorateClass$8([
2367
- n2({ type: String })
2368
- ], HmButton.prototype, "fontSize", 2);
2369
- __decorateClass$8([
2370
- n2({ type: String })
2371
- ], HmButton.prototype, "color", 2);
2372
- __decorateClass$8([
2373
- n2({ type: String })
2374
- ], HmButton.prototype, "background", 2);
2375
- __decorateClass$8([
2376
- n2({ type: String })
2377
- ], HmButton.prototype, "width", 2);
2378
- __decorateClass$8([
2379
- n2({ type: String })
2380
- ], HmButton.prototype, "height", 2);
2381
- __decorateClass$8([
2382
- n2({ type: Boolean })
2383
- ], HmButton.prototype, "enable", 2);
2384
- __decorateClass$8([
2385
- n2({ type: Boolean })
2386
- ], HmButton.prototype, "loading", 2);
2387
- HmButton = __decorateClass$8([
2388
- t$2("hm-button")
2389
- ], HmButton);
2390
- const hmButton = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2391
- __proto__: null,
2392
- get HmButton() {
2393
- return HmButton;
2394
- }
2395
- }, Symbol.toStringTag, { value: "Module" }));
2396
- var __defProp$7 = Object.defineProperty;
2397
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
2398
- var __decorateClass$7 = (decorators, target, key, kind) => {
2399
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
2400
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2401
- if (decorator = decorators[i3])
2402
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2403
- if (kind && result) __defProp$7(target, key, result);
2404
- return result;
2405
- };
2406
- let HmCell = class extends i$1 {
2407
- constructor() {
2408
- super(...arguments);
2409
- this.titleName = "单元格";
2410
- this.descripthion = "描述信息";
2411
- this.content = "内容";
2412
- this.titleClickCallback = () => {
2413
- };
2414
- this.contentClickCallback = () => {
2415
- };
2416
- }
2417
- render() {
2418
- return x`
2419
- <div class="cell" part="cell">
2420
- <div
2421
- class="left-section"
2422
- part="left-section"
2423
- @click="${this.titleClickCallback}"
2424
- >
2425
- <div class="title" part="title">
2426
- <slot name="title">${this.titleName}</slot>
2427
- </div>
2428
- <div class="description" part="description">
2429
- <slot name="description">${this.descripthion}</slot>
2430
- </div>
2431
- </div>
2432
- <div
2433
- class="right-section"
2434
- part="right-section"
2435
- @click="${this.contentClickCallback}"
2436
- >
2437
- <div class="content" part="content">
2438
- <slot name="content">${this.content}</slot>
2439
- </div>
2440
- </div>
2441
- </div>
2442
-
2443
- `;
2444
- }
2445
- };
2446
- HmCell.styles = i$4`
2447
- :host {
2448
- display: block;
2449
- width: 100%;
2450
- }
2451
- .cell {
2452
- display: flex;
2453
- align-items: center;
2454
- justify-content: space-between;
2455
- width: 100%;
2456
- min-height: 60px;
2457
- padding: var(--hm-cell-padding, 12px 16px);
2458
- background: var(--hm-cell-background, #ffffff);
2459
- border: var(--hm-cell-border, 1px dashed #e0e0e0);
2460
- box-sizing: border-box;
2461
- font-family: system-ui, -apple-system, sans-serif;
2462
- }
2463
-
2464
- .left-section {
2465
- display: flex;
2466
- flex-direction: column;
2467
- justify-content: center;
2468
- flex: 1;
2469
- min-width: 0; /* 允许文本截断 */
2470
- }
2471
-
2472
- .title {
2473
- font-size: var(--hm-cell-title-font-size, 18px);
2474
- font-weight: var(--hm-cell-title-font-weight, 600);
2475
- color: var(--hm-cell-title-color, #000000);
2476
- line-height: 1.4;
2477
- margin-bottom: 2px;
2478
- }
2479
-
2480
- .description {
2481
- font-size: var(--hm-cell-description-font-size, 14px);
2482
- color: var(--hm-cell-description-color, #666666);
2483
- line-height: 1.4;
2484
- }
2485
-
2486
- .right-section {
2487
- display: flex;
2488
- align-items: center;
2489
- justify-content: flex-end;
2490
- margin-left: auto;
2491
- padding-left: 16px;
2492
- }
2493
-
2494
- .content {
2495
- font-size: var(--hm-cell-content-font-size, 16px);
2496
- color: var(--hm-cell-content-color, #333333);
2497
- text-align: right;
2498
- padding-right: var(--hm-cell-content-padding-right, 30px);
2499
- }
2500
-
2501
- /* 响应式设计 */
2502
- @media (max-width: 480px) {
2503
- .cell {
2504
- padding: var(--hm-cell-mobile-padding, 10px 12px);
2505
- min-height: 50px;
2506
- }
2507
-
2508
- .title {
2509
- font-size: var(--hm-cell-mobile-title-font-size, 16px);
2510
- }
2511
-
2512
- .description {
2513
- font-size: var(--hm-cell-mobile-description-font-size, 12px);
2514
- }
2515
-
2516
- .content {
2517
- font-size: var(--hm-cell-mobile-content-font-size, 14px);
2518
- padding-right: var(--hm-cell-mobile-content-padding-right, 16px);
2519
- }
2520
- }
2521
- /* 当鼠标或触摸悬停在整个单元格上时,改变内部文本的样式 */
2522
- .cell:hover .title,
2523
- .cell:hover .description,
2524
- .cell:hover .content {
2525
- /* 使用CSS变量允许自定义,并提供默认高亮颜色 */
2526
- color: var(--hm-cell-hover-font-color, #1890ff);
2527
- /* 可选:增加字体粗细使其更突出 */
2528
- font-weight: var(--hm-cell-hover-font-weight, 600);
2529
- /* 可选:添加文字阴影增强视觉效果 */
2530
- text-shadow: var(--hm-cell-hover-text-shadow, 0 0 5px rgba(24, 144, 255, 0.2));
2531
- }
2532
- `;
2533
- __decorateClass$7([
2534
- n2()
2535
- ], HmCell.prototype, "titleName", 2);
2536
- __decorateClass$7([
2537
- n2()
2538
- ], HmCell.prototype, "descripthion", 2);
2539
- __decorateClass$7([
2540
- n2()
2541
- ], HmCell.prototype, "content", 2);
2542
- __decorateClass$7([
2543
- n2()
2544
- ], HmCell.prototype, "titleClickCallback", 2);
2545
- __decorateClass$7([
2546
- n2()
2547
- ], HmCell.prototype, "contentClickCallback", 2);
2548
- HmCell = __decorateClass$7([
2549
- t$2("hm-cell")
2550
- ], HmCell);
2551
- const hmCell = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2552
- __proto__: null,
2553
- get HmCell() {
2554
- return HmCell;
2555
- }
2556
- }, Symbol.toStringTag, { value: "Module" }));
2557
- var __defProp$6 = Object.defineProperty;
2558
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
2559
- var __decorateClass$6 = (decorators, target, key, kind) => {
2560
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
2561
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2562
- if (decorator = decorators[i3])
2563
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2564
- if (kind && result) __defProp$6(target, key, result);
2565
- return result;
2566
- };
2567
- let HmSwipeCell = class extends i$1 {
2568
- constructor() {
2569
- super(...arguments);
2570
- this._isDragging = false;
2571
- this._startX = 0;
2572
- this._currentTranslate = 0;
2573
- this._prevTranslate = 0;
2574
- this._animationId = 0;
2575
- this._velocity = 0;
2576
- this._lastX = 0;
2577
- this._lastTime = 0;
2578
- this._isOpen = false;
2579
- this.rightButtonName = "右侧按钮";
2580
- this.rightButtonCallback = function() {
2581
- console.debug("点击了一下");
2582
- };
2583
- this.leftActionsWidth = 0;
2584
- this.rightActionsWidth = 0;
2585
- this.onDragStart = (e2) => {
2586
- e2.preventDefault();
2587
- this.startDrag(e2.clientX);
2588
- this.sliderElement.style.cursor = "grabbing";
2589
- this.sliderElement.style.transition = "none";
2590
- };
2591
- this.onTouchStart = (e2) => {
2592
- e2.preventDefault();
2593
- this.startDrag(e2.touches[0].clientX);
2594
- this.sliderElement.style.transition = "none";
2595
- };
2596
- this.startDrag = (clientX) => {
2597
- this._isDragging = true;
2598
- this._startX = clientX;
2599
- this._lastX = clientX;
2600
- this._lastTime = Date.now();
2601
- this._isOpen = Math.abs(this._prevTranslate) > 10;
2602
- this.calculateActionWidths();
2603
- };
2604
- this.onDragMove = (e2) => {
2605
- if (!this._isDragging) return;
2606
- e2.preventDefault();
2607
- this.handleMove(e2.clientX);
2608
- };
2609
- this.onTouchMove = (e2) => {
2610
- if (!this._isDragging) return;
2611
- e2.preventDefault();
2612
- this.handleMove(e2.touches[0].clientX);
2613
- };
2614
- this.onDragEnd = () => {
2615
- this.finishDrag();
2616
- this.sliderElement.style.cursor = "grab";
2617
- };
2618
- this.onTouchEnd = () => {
2619
- this.finishDrag();
2620
- };
2621
- }
2622
- firstUpdated() {
2623
- this.calculateActionWidths();
2624
- this.addEventListeners();
2625
- }
2626
- disconnectedCallback() {
2627
- super.disconnectedCallback();
2628
- this.removeEventListeners();
2629
- }
2630
- calculateActionWidths() {
2631
- this.leftActionsWidth = this.leftActions ? this.leftActions.offsetWidth : 0;
2632
- this.rightActionsWidth = this.rightActions ? this.rightActions.offsetWidth : 0;
2633
- }
2634
- addEventListeners() {
2635
- this.sliderElement.addEventListener("mousedown", this.onDragStart);
2636
- this.sliderElement.addEventListener("touchstart", this.onTouchStart, { passive: false });
2637
- document.addEventListener("mousemove", this.onDragMove);
2638
- document.addEventListener("touchmove", this.onTouchMove, { passive: false });
2639
- document.addEventListener("mouseup", this.onDragEnd);
2640
- document.addEventListener("touchend", this.onTouchEnd);
2641
- }
2642
- removeEventListeners() {
2643
- this.sliderElement.removeEventListener("mousedown", this.onDragStart);
2644
- this.sliderElement.removeEventListener("touchstart", this.onTouchStart);
2645
- document.removeEventListener("mousemove", this.onDragMove);
2646
- document.removeEventListener("touchmove", this.onTouchMove);
2647
- document.removeEventListener("mouseup", this.onDragEnd);
2648
- document.removeEventListener("touchend", this.onTouchEnd);
2649
- }
2650
- handleMove(currentX) {
2651
- const currentTime = Date.now();
2652
- const timeDiff = currentTime - this._lastTime;
2653
- if (timeDiff > 0) {
2654
- this._velocity = (currentX - this._lastX) / timeDiff;
2655
- this._lastX = currentX;
2656
- this._lastTime = currentTime;
2657
- }
2658
- const diff = currentX - this._startX;
2659
- let newTranslate = this._prevTranslate + diff;
2660
- if (newTranslate > this.leftActionsWidth) {
2661
- const overshoot = newTranslate - this.leftActionsWidth;
2662
- newTranslate = this.leftActionsWidth + this.easeOut(overshoot, 30);
2663
- } else if (newTranslate < -this.rightActionsWidth) {
2664
- const overshoot = newTranslate + this.rightActionsWidth;
2665
- newTranslate = -this.rightActionsWidth + this.easeOut(overshoot, 30);
2666
- }
2667
- this._currentTranslate = newTranslate;
2668
- this.updateSliderPosition();
2669
- }
2670
- // 弹性效果函数,使超出边界时有缓冲效果
2671
- easeOut(overshoot, maxResistance) {
2672
- return overshoot * 0.2;
2673
- }
2674
- finishDrag() {
2675
- this._isDragging = false;
2676
- this.sliderElement.style.transition = "transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)";
2677
- const threshold = 5;
2678
- const velocityThreshold = 0.1;
2679
- let targetTranslate = 0;
2680
- if (this._currentTranslate > threshold || this._currentTranslate > 0 && this._velocity > velocityThreshold) {
2681
- targetTranslate = this.leftActionsWidth;
2682
- } else if (this._currentTranslate < -threshold || this._currentTranslate < 0 && this._velocity < -velocityThreshold) {
2683
- targetTranslate = -this.rightActionsWidth;
2684
- } else {
2685
- targetTranslate = 0;
2686
- }
2687
- if (this._isOpen) {
2688
- const closeThreshold = 5;
2689
- if (this._prevTranslate > 0 && this._currentTranslate < this._prevTranslate - closeThreshold || this._prevTranslate < 0 && this._currentTranslate > this._prevTranslate + closeThreshold) {
2690
- targetTranslate = 0;
2691
- } else {
2692
- targetTranslate = this._prevTranslate;
2693
- }
2694
- }
2695
- this._currentTranslate = targetTranslate;
2696
- this._prevTranslate = targetTranslate;
2697
- this.updateSliderPosition();
2698
- this._velocity = 0;
2699
- }
2700
- updateSliderPosition() {
2701
- if (this._animationId) {
2702
- cancelAnimationFrame(this._animationId);
2703
- }
2704
- this._animationId = requestAnimationFrame(() => {
2705
- this.sliderElement.style.transform = `translateX(${this._currentTranslate}px)`;
2706
- if (this._currentTranslate > 0) {
2707
- const leftProgress = Math.min(this._currentTranslate / this.leftActionsWidth, 1);
2708
- this.leftActions.style.transform = `translateX(${-100 + leftProgress * 100}%)`;
2709
- this.rightActions.style.transform = "translateX(100%)";
2710
- } else if (this._currentTranslate < 0) {
2711
- const rightProgress = Math.min(-this._currentTranslate / this.rightActionsWidth, 1);
2712
- this.rightActions.style.transform = `translateX(${100 - rightProgress * 100}%)`;
2713
- this.leftActions.style.transform = "translateX(-100%)";
2714
- } else {
2715
- this.leftActions.style.transform = "translateX(-100%)";
2716
- this.rightActions.style.transform = "translateX(100%)";
2717
- }
2718
- });
2719
- }
2720
- render() {
2721
- return x`
2722
- <div class="swipe-container">
2723
- <div class="actions left-actions">
2724
- <slot name="left-actions"> </slot>
2725
- </div>
2726
- <div class="slider">
2727
- <slot name="content" class="content">
2728
- <hm-cell></hm-cell>
2729
- </slot>
2730
- </div>
2731
- <div class="actions right-actions">
2732
- <slot name="right-actions">
2733
- <hm-button type="primary" @hm-button-click="${this.rightButtonCallback}"
2734
- >${this.rightButtonName}</hm-button
2735
- >
2736
- </slot>
2737
- </div>
2738
- </div>
2739
- `;
2740
- }
2741
- };
2742
- HmSwipeCell.styles = i$4`
2743
- :host {
2744
- display: block;
2745
- overflow: hidden;
2746
- position: relative;
2747
- user-select: none;
2748
- touch-action: pan-y;
2749
- height: 60px;
2750
- background: #f9f9f9;
2751
- border-radius: 8px;
2752
- margin: 10px 0;
2753
- }
2754
- .swipe-container {
2755
- position: relative;
2756
- width: 100%;
2757
- height: 100%;
2758
- background: white;
2759
- border-radius: 8px;
2760
- box-shadow: 0 1px 3px rgba(0,0,0,0.1);
2761
- overflow: hidden;
2762
- }
2763
-
2764
- .slider {
2765
- position: relative;
2766
- width: 100%;
2767
- height: 100%;
2768
- transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
2769
- will-change: transform;
2770
- z-index: 2;
2771
- background: white;
2772
- }
2773
-
2774
- .content {
2775
- display: flex;
2776
- align-items: center;
2777
- justify-content: space-between;
2778
- padding: 0 15px;
2779
- height: 100%;
2780
- width: 100%;
2781
- position: relative; // 改为相对定位
2782
- top: 0;
2783
- left: 0;
2784
- background: white;
2785
- box-sizing: border-box;
2786
- border-radius: 8px;
2787
- }
2788
-
2789
- .actions {
2790
- position: absolute;
2791
- top: 0;
2792
- bottom: 0;
2793
- display: flex;
2794
- align-items: center;
2795
- z-index: 1;
2796
- transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
2797
- }
2798
-
2799
- .left-actions {
2800
- left: 0;
2801
- padding-left: 10px;
2802
- transform: translateX(-100%);
2803
- }
2804
-
2805
- .right-actions {
2806
- right: 0;
2807
- padding-right: 10px;
2808
- transform: translateX(100%);
2809
- }
2810
-
2811
- .action-btn {
2812
- height: 44px;
2813
- border: none;
2814
- color: white;
2815
- padding: 0 20px;
2816
- cursor: pointer;
2817
- font-size: 14px;
2818
- display: flex;
2819
- align-items: center;
2820
- justify-content: center;
2821
- transition: all 0.2s ease;
2822
- border-radius: 6px;
2823
- margin: 0 4px;
2824
- min-width: 80px;
2825
- font-weight: 500;
2826
- }
2827
-
2828
- .action-btn:hover {
2829
- transform: scale(1.05);
2830
- filter: brightness(1.1);
2831
- }
2832
-
2833
- .action-btn:active {
2834
- transform: scale(0.95);
2835
- }
2836
-
2837
- .action-btn.favorite {
2838
- background: linear-gradient(135deg, #2196F3, #1976D2);
2839
- }
2840
-
2841
- .action-btn.delete {
2842
- background: linear-gradient(135deg, #f44336, #d32f2f);
2843
- }
2844
-
2845
- .action-btn.mark {
2846
- background: linear-gradient(135deg, #FF9800, #F57C00);
2847
- }
2848
-
2849
- .action-btn.archive {
2850
- background: linear-gradient(135deg, #9C27B0, #7B1FA2);
2851
- }
2852
-
2853
- .action-btn.share {
2854
- background: linear-gradient(135deg, #4CAF50, #388E3C);
2855
- }
2856
-
2857
- .action-btn.edit {
2858
- background: linear-gradient(135deg, #607D8B, #455A64);
2859
- }
2860
- .contentslot{
2861
- width: 100%;
2862
- }
2863
- `;
2864
- __decorateClass$6([
2865
- n2()
2866
- ], HmSwipeCell.prototype, "_isDragging", 2);
2867
- __decorateClass$6([
2868
- n2()
2869
- ], HmSwipeCell.prototype, "_startX", 2);
2870
- __decorateClass$6([
2871
- n2()
2872
- ], HmSwipeCell.prototype, "_currentTranslate", 2);
2873
- __decorateClass$6([
2874
- n2()
2875
- ], HmSwipeCell.prototype, "_prevTranslate", 2);
2876
- __decorateClass$6([
2877
- n2()
2878
- ], HmSwipeCell.prototype, "_animationId", 2);
2879
- __decorateClass$6([
2880
- n2()
2881
- ], HmSwipeCell.prototype, "_velocity", 2);
2882
- __decorateClass$6([
2883
- n2()
2884
- ], HmSwipeCell.prototype, "_lastX", 2);
2885
- __decorateClass$6([
2886
- n2()
2887
- ], HmSwipeCell.prototype, "_lastTime", 2);
2888
- __decorateClass$6([
2889
- n2()
2890
- ], HmSwipeCell.prototype, "_isOpen", 2);
2891
- __decorateClass$6([
2892
- n2()
2893
- ], HmSwipeCell.prototype, "rightButtonName", 2);
2894
- __decorateClass$6([
2895
- n2()
2896
- ], HmSwipeCell.prototype, "rightButtonCallback", 2);
2897
- __decorateClass$6([
2898
- e$2(".slider")
2899
- ], HmSwipeCell.prototype, "sliderElement", 2);
2900
- __decorateClass$6([
2901
- e$2(".content")
2902
- ], HmSwipeCell.prototype, "contentElement", 2);
2903
- __decorateClass$6([
2904
- e$2(".left-actions")
2905
- ], HmSwipeCell.prototype, "leftActions", 2);
2906
- __decorateClass$6([
2907
- e$2(".right-actions")
2908
- ], HmSwipeCell.prototype, "rightActions", 2);
2909
- HmSwipeCell = __decorateClass$6([
2910
- t$2("hm-swipe-cell")
2911
- ], HmSwipeCell);
2912
- const hmSwipeCell = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
2913
- __proto__: null,
2914
- get HmSwipeCell() {
2915
- return HmSwipeCell;
2916
- }
2917
- }, Symbol.toStringTag, { value: "Module" }));
2918
- var __defProp$5 = Object.defineProperty;
2919
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
2920
- var __decorateClass$5 = (decorators, target, key, kind) => {
2921
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
2922
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
2923
- if (decorator = decorators[i3])
2924
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
2925
- if (kind && result) __defProp$5(target, key, result);
2926
- return result;
2927
- };
2928
- let HmSwitch = class extends i$1 {
2929
- constructor() {
2930
- super(...arguments);
2931
- this.checked = false;
2932
- this.disabled = false;
2933
- this.loading = false;
2934
- this.color = "#1890ff";
2935
- this.openContent = "";
2936
- this.closeContent = "";
2937
- this.openIcon = "";
2938
- this.closeIcon = "";
2939
- }
2940
- change() {
2941
- if (this.disabled || this.loading) return;
2942
- this.checked = !this.checked;
2943
- this.dispatchEvent(new CustomEvent("hm-switch-change", {
2944
- detail: { checked: this.checked },
2945
- bubbles: true,
2946
- composed: true
2947
- }));
2948
- }
2949
- render() {
2950
- return x`
2951
- <div
2952
- class="switch ${this.disabled ? "disabled" : ""} ${this.loading ? "loading" : ""} ${this.checked ? "checked" : ""}"
2953
- @click="${this.change}"
2954
- @touchstart="${this.change}"
2955
- style="--switch-color: ${this.color}"
2956
- >
2957
- <div class="switch-inner">
2958
- ${this.checked ? this.openIcon ? x`<hm-icon icon="${this.openIcon}" size="14px"></hm-icon>` : this.openContent ? x`<span>${this.openContent}</span>` : "" : this.closeIcon ? x`<hm-icon icon="${this.closeIcon}" size="14px"></hm-icon>` : this.closeContent ? x`<span>${this.closeContent}</span>` : ""}
2959
- </div>
2960
- </div>
2961
- `;
2962
- }
2963
- };
2964
- HmSwitch.styles = i$4`
2965
- .switch {
2966
- position: relative;
2967
- display: inline-block;
2968
- width: 44px;
2969
- height: 22px;
2970
- vertical-align: middle;
2971
- border: 1px solid #ccc;
2972
- border-radius: 20px;
2973
- background-color: #ccc;
2974
- cursor: pointer;
2975
- transition: all 0.3s;
2976
- user-select: none;
2977
- }
2978
-
2979
- .switch.checked {
2980
- background-color: var(--switch-color, #1890ff);
2981
- border-color: var(--switch-color, #1890ff);
2982
- }
2983
-
2984
- .switch.disabled {
2985
- cursor: not-allowed;
2986
- opacity: 0.6;
2987
- }
2988
-
2989
- .switch.loading {
2990
- cursor: wait;
2991
- opacity: 0.6;
2992
- }
2993
-
2994
- .switch-inner {
2995
- position: absolute;
2996
- top: 2px;
2997
- left: 2px;
2998
- width: 18px;
2999
- height: 18px;
3000
- background-color: #fff;
3001
- border-radius: 50%;
3002
- transition: all 0.3s;
3003
- display: flex;
3004
- align-items: center;
3005
- justify-content: center;
3006
- font-size: 12px;
3007
- }
3008
-
3009
- .switch.checked .switch-inner {
3010
- left: calc(100% - 20px);
3011
- }
3012
-
3013
- .switch.loading::after {
3014
- content: '';
3015
- position: absolute;
3016
- top: 50%;
3017
- left: 50%;
3018
- width: 12px;
3019
- height: 12px;
3020
- margin-top: -6px;
3021
- margin-left: -6px;
3022
- border: 2px solid transparent;
3023
- border-top-color: currentColor;
3024
- border-radius: 50%;
3025
- animation: rotate 1s linear infinite;
3026
- }
3027
-
3028
- @keyframes rotate {
3029
- from {
3030
- transform: rotate(0deg);
3031
- }
3032
- to {
3033
- transform: rotate(360deg);
3034
- }
3035
- }
3036
-
3037
- hm-icon {
3038
- font-size: 12px;
3039
- width: 12px;
3040
- height: 12px;
3041
- display: flex;
3042
- align-items: center;
3043
- justify-content: center;
3044
- }
3045
- `;
3046
- __decorateClass$5([
3047
- n2({ type: Boolean })
3048
- ], HmSwitch.prototype, "checked", 2);
3049
- __decorateClass$5([
3050
- n2({ type: Boolean })
3051
- ], HmSwitch.prototype, "disabled", 2);
3052
- __decorateClass$5([
3053
- n2({ type: Boolean })
3054
- ], HmSwitch.prototype, "loading", 2);
3055
- __decorateClass$5([
3056
- n2({ type: String })
3057
- ], HmSwitch.prototype, "color", 2);
3058
- __decorateClass$5([
3059
- n2({ type: String })
3060
- ], HmSwitch.prototype, "openContent", 2);
3061
- __decorateClass$5([
3062
- n2({ type: String })
3063
- ], HmSwitch.prototype, "closeContent", 2);
3064
- __decorateClass$5([
3065
- n2({ type: String })
3066
- ], HmSwitch.prototype, "openIcon", 2);
3067
- __decorateClass$5([
3068
- n2({ type: String })
3069
- ], HmSwitch.prototype, "closeIcon", 2);
3070
- HmSwitch = __decorateClass$5([
3071
- t$2("hm-switch")
3072
- ], HmSwitch);
3073
- const hmSwitch = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3074
- __proto__: null,
3075
- get HmSwitch() {
3076
- return HmSwitch;
3077
- }
3078
- }, Symbol.toStringTag, { value: "Module" }));
3079
- var __defProp$4 = Object.defineProperty;
3080
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
3081
- var __decorateClass$4 = (decorators, target, key, kind) => {
3082
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
3083
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
3084
- if (decorator = decorators[i3])
3085
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3086
- if (kind && result) __defProp$4(target, key, result);
3087
- return result;
3088
- };
3089
- let HmAccordion = class extends i$1 {
3090
- constructor() {
3091
- super(...arguments);
3092
- this.maxHeight = "500px";
3093
- this.items = [];
3094
- this.expanded = false;
3095
- }
3096
- /** 开关容器 */
3097
- togglePanel() {
3098
- this.expanded = !this.expanded;
3099
- }
3100
- render() {
3101
- return x`
3102
- <div class="accordion-container" style="max-height: ${this.maxHeight}">
3103
- <div class="accordion-header" @click=${this.togglePanel}>
3104
- <slot name="header">面板标题</slot>
3105
- <div class="accordion-toggle">
3106
- ${!this.expanded ? x`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
3107
- <path d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/>
3108
- </svg>` : x`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
3109
- <path d="M7.247 4.86l-4.796 5.481c-.566.647-.106 1.659.753 1.659h9.592a1 1 0 0 0 .753-1.659l-4.796-5.48a1 1 0 0 0-1.506 0z"/>
3110
- </svg>`}
3111
- </div>
3112
- </div>
3113
-
3114
- <div class="accordion-content" ?hidden=${!this.expanded}>
3115
- ${this.items.length > 0 ? this.items.map(
3116
- (item) => x`<div class="accordion-item">${item}</div>`
3117
- ) : x`<slot></slot>`}
3118
- </div>
3119
-
3120
- <div class="accordion-footer" ?hidden=${!this.expanded}>
3121
- <slot name="footer">
3122
- <hm-button @hm-button-click="${() => {
3123
- this.expanded = false;
3124
- }}">关闭</hm-button>
3125
- </slot>
3126
- </div>
3127
- </div>
3128
- `;
3129
- }
3130
- };
3131
- HmAccordion.styles = i$4`
3132
- :host {
3133
- display: block;
3134
- width: 100%;
3135
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
3136
- }
3137
-
3138
- .accordion-container {
3139
- display: flex;
3140
- flex-direction: column;
3141
- border-radius: 8px;
3142
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
3143
- background-color: white;
3144
- overflow: hidden;
3145
- transition: all 0.3s ease;
3146
- }
3147
-
3148
- .accordion-header {
3149
- padding: 16px 20px;
3150
- background-color: #f8f9fa;
3151
- border-bottom: 1px solid #e9ecef;
3152
- font-size: 1.25rem;
3153
- font-weight: 600;
3154
- color: #212529;
3155
- display: flex;
3156
- justify-content: space-between;
3157
- align-items: center;
3158
- cursor: pointer;
3159
- transition: background-color 0.2s;
3160
- }
3161
-
3162
- .accordion-header:hover {
3163
- background-color: #e9ecef;
3164
- }
3165
-
3166
- .accordion-toggle {
3167
- transition: transform 0.3s ease;
3168
- width: 24px;
3169
- height: 24px;
3170
- display: flex;
3171
- align-items: center;
3172
- justify-content: center;
3173
- }
3174
-
3175
- .accordion-content {
3176
- flex: 1;
3177
- overflow-y: auto;
3178
- padding: 0;
3179
- background-color: #ffffff;
3180
- transition: max-height 0.3s ease, opacity 0.3s ease;
3181
- }
3182
-
3183
- .accordion-footer {
3184
- padding: 12px 20px;
3185
- background-color: #f8f9fa;
3186
- border-top: 1px solid #e9ecef;
3187
- display: flex;
3188
- justify-content: flex-end;
3189
- gap: 10px;
3190
- }
3191
-
3192
- .accordion-item {
3193
- padding: 12px 20px;
3194
- border-bottom: 1px solid #e9ecef;
3195
- transition: background-color 0.2s;
3196
- }
3197
-
3198
- .accordion-item:last-child {
3199
- border-bottom: none;
3200
- }
3201
-
3202
- .accordion-item:hover {
3203
- background-color: #f8f9fa;
3204
- }
3205
- `;
3206
- __decorateClass$4([
3207
- n2({ type: String, attribute: "max-height" })
3208
- ], HmAccordion.prototype, "maxHeight", 2);
3209
- __decorateClass$4([
3210
- n2({ type: Array })
3211
- ], HmAccordion.prototype, "items", 2);
3212
- __decorateClass$4([
3213
- n2({ type: Boolean })
3214
- ], HmAccordion.prototype, "expanded", 2);
3215
- HmAccordion = __decorateClass$4([
3216
- t$2("hm-accordion")
3217
- ], HmAccordion);
3218
- const hmAccordion = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3219
- __proto__: null,
3220
- get HmAccordion() {
3221
- return HmAccordion;
3222
- }
3223
- }, Symbol.toStringTag, { value: "Module" }));
3224
- var __defProp$3 = Object.defineProperty;
3225
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
3226
- var __decorateClass$3 = (decorators, target, key, kind) => {
3227
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
3228
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
3229
- if (decorator = decorators[i3])
3230
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3231
- if (kind && result) __defProp$3(target, key, result);
3232
- return result;
3233
- };
3234
- let HmInput = class extends i$1 {
3235
- constructor() {
3236
- super(...arguments);
3237
- this.type = "text";
3238
- this.icon = "";
3239
- this.label = "输入框";
3240
- this.placeholder = "";
3241
- this.enable = true;
3242
- this.readonly = false;
3243
- this.value = "";
3244
- }
3245
- // 添加键盘事件处理方法,阻止事件冒泡
3246
- _handleKeyDown(e2) {
3247
- e2.stopPropagation();
3248
- }
3249
- // 添加输入事件处理方法,触发自定义事件
3250
- _handleInput(e2) {
3251
- const target = e2.target;
3252
- this.value = target.value;
3253
- this.dispatchEvent(new CustomEvent("hm-input-change", {
3254
- detail: { value: this.value },
3255
- bubbles: true,
3256
- composed: true
3257
- }));
3258
- }
3259
- render() {
3260
- return x`
3261
- <div class="input-container">
3262
- <span class="label">${this.label}</span>
3263
- ${this.icon ? x`<hm-icon icon="${this.icon}" class="icon"></hm-icon>` : ""}
3264
- <input
3265
- type="${this.type}"
3266
- value="${this.value}"
3267
- ?disabled="${!this.enable}"
3268
- ?readonly="${this.readonly}"
3269
- placeholder="${this.placeholder}"
3270
- style="padding-left: ${this.icon ? "24px" : "8px"};"
3271
- @keydown="${this._handleKeyDown}"
3272
- @input="${this._handleInput}"
3273
- />
3274
- <slot name="right">
3275
- </slot>
3276
- </div>
3277
- `;
3278
- }
3279
- };
3280
- HmInput.styles = i$4`
3281
- :host {
3282
- display: block;
3283
- }
3284
- .input-container {
3285
- display: flex;
3286
- align-items: center;
3287
- }
3288
- .label {
3289
- margin-right: 8px;
3290
- }
3291
- input {
3292
- flex: 1;
3293
- padding: 8px 12px;
3294
- border: 1px solid #d9d9d9;
3295
- border-radius: 4px;
3296
- font-size: 14px;
3297
- outline: none;
3298
- transition: all 0.2s ease;
3299
- }
3300
- input:disabled {
3301
- background-color: #f5f5f5;
3302
- color: #999;
3303
- border-color: #ddd;
3304
- cursor: not-allowed;
3305
- }
3306
- input[readonly] {
3307
- background-color: #f5f5f5;
3308
- cursor: default;
3309
- }
3310
- .icon {
3311
- margin-right: 8px;
3312
- width: 16px;
3313
- height: 16px;
3314
- }
3315
- `;
3316
- __decorateClass$3([
3317
- n2({ type: String })
3318
- ], HmInput.prototype, "type", 2);
3319
- __decorateClass$3([
3320
- n2({ type: String })
3321
- ], HmInput.prototype, "icon", 2);
3322
- __decorateClass$3([
3323
- n2({ type: String })
3324
- ], HmInput.prototype, "label", 2);
3325
- __decorateClass$3([
3326
- n2({ type: String })
3327
- ], HmInput.prototype, "placeholder", 2);
3328
- __decorateClass$3([
3329
- n2({ type: Boolean })
3330
- ], HmInput.prototype, "enable", 2);
3331
- __decorateClass$3([
3332
- n2({ type: Boolean })
3333
- ], HmInput.prototype, "readonly", 2);
3334
- __decorateClass$3([
3335
- n2()
3336
- ], HmInput.prototype, "value", 2);
3337
- HmInput = __decorateClass$3([
3338
- t$2("hm-input")
3339
- ], HmInput);
3340
- const hmInput = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3341
- __proto__: null,
3342
- get HmInput() {
3343
- return HmInput;
3344
- }
3345
- }, Symbol.toStringTag, { value: "Module" }));
3346
- var __defProp$2 = Object.defineProperty;
3347
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3348
- var __decorateClass$2 = (decorators, target, key, kind) => {
3349
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
3350
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
3351
- if (decorator = decorators[i3])
3352
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
3353
- if (kind && result) __defProp$2(target, key, result);
3354
- return result;
3355
- };
3356
- let HmDialog = class extends i$1 {
3357
- constructor() {
3358
- super(...arguments);
3359
- this.isOpen = false;
3360
- this.dialog = this;
3361
- }
3362
- open() {
3363
- this.isOpen = true;
3364
- this.dispatchEvent(new CustomEvent("hm-dialog-open"));
3365
- }
3366
- close() {
3367
- this.isOpen = false;
3368
- this.dispatchEvent(new CustomEvent("hm-dialog-close"));
3369
- }
3370
- /** 确认,触发 dialog-close dialog-confirm事件*/
3371
- confirm() {
3372
- this.close();
3373
- this.dispatchEvent(new CustomEvent("hm-dialog-confirm"));
3374
- }
3375
- /** 取消,触发 dialog-close dialog-cancel事件*/
3376
- cancel() {
3377
- this.close();
3378
- this.dispatchEvent(new CustomEvent("hm-dialog-cancel"));
3379
- }
3380
- updated(changedProperties) {
3381
- if (changedProperties.has("isOpen")) {
3382
- if (this.isOpen) {
3383
- this.style.display = "block";
3384
- } else {
3385
- this.style.display = "none";
3386
- }
3387
- }
3388
- }
3389
- render() {
3390
- return x`
3391
- <div class="overlay"
3392
- @click="${this.close}"
3393
- ></div>
3394
- <div class="content">
3395
- <slot></slot>
3396
- <div class="footer">
3397
- <slot name="footer">
3398
- <hm-button @click="${() => {
3399
- this.cancel();
3400
- console.debug("取消");
3401
- }}">取消</hm-button>
3402
- <hm-button @click="${() => {
3403
- this.confirm();
3404
- console.debug("确定");
3405
- }}">确定</hm-button>
3406
- </slot>
3407
- </div>
3408
- </div>
3409
- `;
3410
- }
3411
- };
3412
- HmDialog.styles = i$4`
3413
- :host {
3414
- display: none;
3415
- position: fixed;
3416
- top: 0;
3417
- left: 0;
3418
- width: 100%;
3419
- height: 100%;
3420
- z-index: 999999;
3421
- }
3422
- :host([isopen]) {
3423
- display: block;
3424
- }
3425
- .overlay {
3426
- position: fixed;
3427
- top: 0;
3428
- left: 0;
3429
- width: 100%;
3430
- height: 100%;
3431
- background-color: rgba(0, 0, 0, 0.5);
3432
- }
3433
-
3434
- .content {
3435
- position: absolute;
3436
- top: 50%;
3437
- left: 50%;
3438
- transform: translate(-50%, -50%);
3439
- background: white;
3440
- border-radius: 4px;
3441
- min-width: 300px;
3442
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
3443
- padding: 20px;
3444
- color:rgb(0,0,0)
3445
- }
3446
-
3447
- .footer {
3448
- display: flex;
3449
- justify-content: flex-end;
3450
- gap: 10px;
3451
- margin-top: 20px;
3452
- }
3453
-
3454
- hm-button {
3455
- min-width: 80px;
3456
- }
3457
- `;
3458
- __decorateClass$2([
3459
- n2({ type: Boolean, attribute: "isopen" })
3460
- ], HmDialog.prototype, "isOpen", 2);
3461
- HmDialog = __decorateClass$2([
3462
- t$2("hm-dialog")
3463
- ], HmDialog);
3464
- const hmDialog = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3465
- __proto__: null,
3466
- get HmDialog() {
3467
- return HmDialog;
3468
- }
3469
- }, Symbol.toStringTag, { value: "Module" }));
3470
- const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3471
- __proto__: null,
3472
- hm_accordion: hmAccordion,
3473
- hm_button: hmButton,
3474
- hm_cell: hmCell,
3475
- hm_dialog: hmDialog,
3476
- hm_icon: hmIcon,
3477
- hm_input: hmInput,
3478
- hm_menu: hmMenu,
3479
- hm_move_panel: hmMovePanel,
3480
- hm_notification: hmNotification,
3481
- hm_swipe_cell: hmSwipeCell,
3482
- hm_switch: hmSwitch
3483
- }, Symbol.toStringTag, { value: "Module" }));
3484
- let menuHolder = document.createElement("div");
3485
- function initMenuHolder() {
3486
- menuHolder.id = "hmMenuHolder";
3487
- let img = document.querySelector("#functionHolderImg");
3488
- console.debug(img);
3489
- console.debug(menuHolder);
3490
- if (img !== null) {
3491
- img.parentElement.insertAdjacentElement("afterend", menuHolder);
3492
- }
3493
- }
3494
- const menu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3495
- __proto__: null,
3496
- initMenuHolder,
3497
- menuHolder
3498
- }, Symbol.toStringTag, { value: "Module" }));
3499
- let movePanelHolder = document.createElement("div");
3500
- function initMovePanelHolder() {
3501
- movePanelHolder.id = "hmMovePanelHolder";
3502
- movePanelHolder.style.zIndex = "999999";
3503
- document.body.append(movePanelHolder);
3504
- }
3505
- const movePanel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3506
- __proto__: null,
3507
- initMovePanelHolder,
3508
- movePanelHolder
3509
- }, Symbol.toStringTag, { value: "Module" }));
3510
- let notificationHolder = document.createElement("div");
3511
- function initNotificationHolder() {
3512
- notificationHolder.id = "hmNotificationHolder";
3513
- notificationHolder.style.zIndex = "999999";
3514
- document.body.append(notificationHolder);
3515
- }
3516
- const notification = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3517
- __proto__: null,
3518
- initNotificationHolder,
3519
- notificationHolder
3520
- }, Symbol.toStringTag, { value: "Module" }));
3521
- let dialogHolder = document.createElement("div");
3522
- function initDialogHolder() {
3523
- dialogHolder.id = "hmDialogHolder";
3524
- dialogHolder.style.zIndex = "999999";
3525
- document.body.append(dialogHolder);
3526
- }
3527
- const dialog = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3528
- __proto__: null,
3529
- dialogHolder,
3530
- initDialogHolder
3531
- }, Symbol.toStringTag, { value: "Module" }));
3532
- var __defProp$1 = Object.defineProperty;
3533
- var __decorateClass$1 = (decorators, target, key, kind) => {
3534
- var result = void 0;
3535
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
3536
- if (decorator = decorators[i3])
3537
- result = decorator(target, key, result) || result;
3538
- if (result) __defProp$1(target, key, result);
3539
- return result;
3540
- };
3541
- class HmDialogApp extends i$1 {
3542
- constructor() {
3543
- super(...arguments);
3544
- this.dialogOpen = false;
3545
- this.message = "请做出选择";
3546
- this.closeCallback = null;
3547
- this.cancelCallback = null;
3548
- this.confirmCallback = null;
3549
- }
3550
- /** 触发点击事件 */
3551
- handelClick() {
3552
- this.dispatchEvent(new CustomEvent("hmclick"));
3553
- }
3554
- static {
3555
- this.styles = i$4`
3556
- `;
3557
- }
3558
- render() {
3559
- return x`
3560
- <hm-dialog
3561
- ?isopen="${this.dialogOpen}"
3562
- @hm-dialog-close="${() => {
3563
- this.dialogOpen = false;
3564
- }}"
3565
- @hm-dialog-cancel="${() => {
3566
- if (this.cancelCallback) this.cancelCallback();
3567
- }}"
3568
- @hm-dialog-confirm="${() => {
3569
- if (this.confirmCallback) this.confirmCallback();
3570
- }}"
3571
- >
3572
- <p>${this.message}</p>
3573
- </hm-dialog>
3574
- `;
3575
- }
3576
- }
3577
- __decorateClass$1([
3578
- n2({ type: Boolean })
3579
- ], HmDialogApp.prototype, "dialogOpen");
3580
- __decorateClass$1([
3581
- n2({ type: String })
3582
- ], HmDialogApp.prototype, "message");
3583
- __decorateClass$1([
3584
- n2({ type: Function })
3585
- ], HmDialogApp.prototype, "closeCallback");
3586
- __decorateClass$1([
3587
- n2({ type: Function })
3588
- ], HmDialogApp.prototype, "cancelCallback");
3589
- __decorateClass$1([
3590
- n2({ type: Function })
3591
- ], HmDialogApp.prototype, "confirmCallback");
3592
- let dialogApp;
3593
- async function initDialogApp() {
3594
- customElements.define("hm-dialog-app", HmDialogApp);
3595
- dialogApp = document.createElement("hm-dialog-app");
3596
- dialogApp.dialogOpen = false;
3597
- dialogApp.message = "请做出选择";
3598
- dialogApp.closeCallback = null;
3599
- dialogApp.cancelCallback = null;
3600
- dialogApp.confirmCallback = null;
3601
- dialogHolder.append(dialogApp);
3602
- }
3603
- const dialogApp$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3604
- __proto__: null,
3605
- get dialogApp() {
3606
- return dialogApp;
3607
- },
3608
- initDialogApp
3609
- }, Symbol.toStringTag, { value: "Module" }));
3610
- let notice = {
3611
- success(title, content, displayTime = 2e3) {
3612
- let notice2 = document.createElement("hm-notification");
3613
- notice2.title = title;
3614
- notice2.content = content;
3615
- notice2.displayTime = displayTime;
3616
- notice2.backgroundColor = "rgba(57, 231, 34, 0.7)";
3617
- notice2.color = "rgb(255,255,255)";
3618
- notificationHolder.append(notice2);
3619
- },
3620
- warning(title, content, displayTime = 2e3) {
3621
- let notice2 = document.createElement("hm-notification");
3622
- notice2.title = title;
3623
- notice2.content = content;
3624
- notice2.displayTime = displayTime;
3625
- notice2.backgroundColor = "rgba(255,193,7,0.7)";
3626
- notice2.color = "rgb(255,255,255)";
3627
- notificationHolder.append(notice2);
3628
- },
3629
- error(title, content, displayTime = 2e3) {
3630
- let notice2 = document.createElement("hm-notification");
3631
- notice2.title = title;
3632
- notice2.content = content;
3633
- notice2.displayTime = displayTime;
3634
- notice2.backgroundColor = "rgba(255,0,0,0.7)";
3635
- notice2.color = "rgb(255,255,255)";
3636
- notificationHolder.append(notice2);
3637
- },
3638
- normal(title, content, displayTime = 2e3) {
3639
- let notice2 = document.createElement("hm-notification");
3640
- notice2.title = title;
3641
- notice2.content = content;
3642
- notice2.displayTime = displayTime;
3643
- notice2.backgroundColor = "rgba(33,33,33,0.7)";
3644
- notice2.color = "rgb(255,255,255)";
3645
- notificationHolder.append(notice2);
3646
- }
3647
- };
3648
- function confirm(message, confirmCallback, cancelCallback, closeCallback) {
3649
- dialogApp.message = message;
3650
- if (confirmCallback)
3651
- dialogApp.confirmCallback = confirmCallback;
3652
- else
3653
- dialogApp.confirmCallback = null;
3654
- if (cancelCallback)
3655
- dialogApp.cancelCallback = cancelCallback;
3656
- else
3657
- dialogApp.cancelCallback = null;
3658
- if (closeCallback)
3659
- dialogApp.closeCallback = closeCallback;
3660
- else
3661
- dialogApp.closeCallback = null;
3662
- dialogApp.dialogOpen = true;
3663
- console.debug("弹窗已打开", dialogApp);
3664
- }
3665
- const appTools = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3666
- __proto__: null,
3667
- confirm,
3668
- notice
3669
- }, Symbol.toStringTag, { value: "Module" }));
3670
- async function initExampleApp() {
3671
- let panel = document.createElement("hm-move-panel");
3672
- panel.titleContent = "组件模板";
3673
- panel.icon = "template";
3674
- movePanelHolder.appendChild(panel);
3675
- let template = x`
3676
-
3677
- <h3>输入框</h3>
3678
- 基本使用
3679
- <hm-input label="用户名" placeholder="请输入用户名"></hm-input>
3680
- 带图标的输入框
3681
- <hm-input label="密码" icon="password" placeholder="请输入密码"></hm-input>
3682
- 禁用状态
3683
- <hm-input label="禁用输入框" value="已禁用" enable="false"></hm-input>
3684
- 只读状态
3685
- <hm-input label="只读输入框" value="只读内容" readonly="true"></hm-input>
3686
- <h3>折叠面板</h3>
3687
- <hm-accordion>
3688
- <span slot="header">我的折叠面板</span>
3689
- <div>内容项 1</div>
3690
- <div>内容项 2</div>
3691
- </hm-accordion>
3692
- <h3>滑动开关</h3>
3693
- <!-- 基础用法 -->
3694
- <hm-switch></hm-switch>
3695
-
3696
- <!-- 默认开启 -->
3697
- <hm-switch checked></hm-switch>
3698
-
3699
- <!-- 禁用状态 -->
3700
- <hm-switch disabled></hm-switch>
3701
-
3702
- <!-- 加载状态 -->
3703
- <hm-switch loading></hm-switch>
3704
-
3705
- <!-- 自定义颜色 -->
3706
- <hm-switch color="#ff4757"></hm-switch>
3707
- hc-s
3708
- <!-- 带图标 -->
3709
- <hm-switch openIcon="check" closeIcon="close"></hm-switch>
3710
-
3711
- <!-- 监听状态变化 -->
3712
- <hm-switch
3713
-
3714
- @hm-switch-change
3715
- ="${(e2) => console.log("开关状态:", e2.detail.checked)}"></hm-switch>
3716
- <h3>滑动单元格</h3>
3717
- <hm-swipe-cell>
3718
- <!-- 主内容 -->
3719
- <div slot="content">主内容</div>
3720
- <!-- 左侧操作按钮 -->
3721
- <div slot="left-actions">左侧操作</div>
3722
- <!-- 右侧操作按钮 -->
3723
- <div slot="right-actions">右侧操作</div>
3724
- </hm-swipe-cell>
3725
- <hm-swipe-cell>
3726
- <!-- 主内容 -->
3727
- <hm-cell
3728
- slot="content"
3729
- titleName="单元格标题"
3730
- descripthion="这是描述信息"
3731
- content="内容区域"
3732
- >
3733
- </hm-cell>
3734
- <!-- 左侧操作按钮 -->
3735
- <div slot="left-actions"><hm-button>删除</hm-button></div>
3736
- <!-- 右侧操作按钮 -->
3737
- <div slot="right-actions">
3738
- <hm-button>修改</hm-button>
3739
- <hm-button>运行</hm-button>
3740
- </div>
3741
- </hm-swipe-cell>
3742
-
3743
- <h3>单元格</h3>
3744
- <hm-cell>
3745
- <hm-switch slot="content"></hm-switch>
3746
- </hm-cell>
3747
- <hm-cell titleName="单元格标题" descripthion="这是描述信息" content="内容区域">
3748
- </hm-cell>
3749
- <!-- 使用插槽自定义内容 -->
3750
- <hm-cell>
3751
- <div slot="title">自定义标题</div>
3752
- <div slot="description">自定义描述</div>
3753
- <div slot="content">自定义内容</div>
3754
- </hm-cell>
3755
-
3756
- <!-- 带点击事件 -->
3757
- <hm-cell
3758
- titleName="可点击标题"
3759
- content="点击查看详情"
3760
- .titleClickCallback="${() => console.log("标题被点击")}"
3761
- .contentClickCallback="${() => console.log("内容被点击")}"
3762
- >
3763
- </hm-cell>
3764
-
3765
- <!-- 自定义样式 -->
3766
- <hm-cell
3767
- titleName="自定义样式"
3768
- content="特殊样式"
3769
- style="--hm-cell-background: #f0f8ff; --hm-cell-title-color: #1890ff"
3770
- >
3771
- </hm-cell>
3772
- <h3>通知</h3>
3773
- <hm-button
3774
- content="成功通知"
3775
- @click="${() => notice.success("成功", "这是成功提示", 2e3)}"
3776
- ></hm-button>
3777
- <hm-button
3778
- content="普通通知"
3779
- @click="${() => notice.normal("普通", "这是普通提示", 3e3)}"
3780
- ></hm-button>
3781
- <hm-button
3782
- content="警告通知"
3783
- @click="${() => notice.warning("警告", "这是警告提示", 4e3)}"
3784
- ></hm-button>
3785
- <hm-button
3786
- content="错误通知"
3787
- @click="${() => notice.error("错误", "这是错误提示", 5e3)}"
3788
- ></hm-button>
3789
- <h3>按钮</h3>
3790
-
3791
- <!-- 基础用法 -->
3792
- <hm-button content="普通按钮"></hm-button>
3793
-
3794
- <!-- 带图标按钮 -->
3795
- <hm-button icon="plus" content="添加"></hm-button>
3796
-
3797
- <!-- 自定义颜色 -->
3798
- <hm-button content="自定义样式" color="#ffffff" background="#4caf50"></hm-button>
3799
- </hm-button>
3800
-
3801
- <!-- 禁用状态 -->
3802
- <hm-button content="禁用按钮" .enable="${false}"></hm-button>
3803
-
3804
- <!-- 加载状态 -->
3805
- <hm-button content="加载中" .loading="${true}"></hm-button>
3806
-
3807
- <!-- 自定义尺寸 -->
3808
- <hm-button content="大按钮" width="200px" height="50px"></hm-button>
3809
- <hm-button content="小按钮" width="60px" height="30px" fontSize="8px"></hm-button>
3810
- <h3>图标</h3>
3811
- <hm-icon></hm-icon>
3812
- `;
3813
- B(template, await panel.body);
3814
- let menuItem = document.createElement("hm-menu");
3815
- menuItem.content = "组件模板";
3816
- menuItem.isMenuItem = true;
3817
- menuItem.icon = "template";
3818
- menuItem.addEventListener("hm-menu-click", function() {
3819
- panel.putTopToggel();
3820
- });
3821
- return menuItem;
3822
- }
3823
- const exampleApp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
3824
- __proto__: null,
3825
- initExampleApp
3826
- }, Symbol.toStringTag, { value: "Module" }));
3827
- var __defProp = Object.defineProperty;
3828
- var __decorateClass = (decorators, target, key, kind) => {
3829
- var result = void 0;
3830
- for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
3831
- if (decorator = decorators[i3])
3832
- result = decorator(target, key, result) || result;
3833
- if (result) __defProp(target, key, result);
3834
- return result;
3835
- };
3836
- class HmScriptApp extends i$1 {
3837
- constructor() {
3838
- super(...arguments);
3839
- this.scriptName = "";
3840
- this.scriptUrl = "";
3841
- this.scriptEnable = true;
3842
- this.scriptIngected = false;
3843
- this.dialogOpen = false;
3844
- this.scriptList = scriptList;
3845
- }
3846
- static {
3847
- this.styles = i$4`
3848
- :host {
3849
- display:block;
3850
- width: 100%;
3851
- }
3852
- `;
3853
- }
3854
- render() {
3855
- return x`
3856
- <hm-dialog
3857
- ?isopen="${this.dialogOpen}"
3858
- @hm-dialog-close="${() => {
3859
- this.dialogOpen = false;
3860
- }}"
3861
- @hm-dialog-confirm="${() => {
3862
- if (this.scriptName.trim() == "" || this.scriptUrl.trim() == "") {
3863
- notice.error("脚本管理", "请填写完整的脚本信息");
3864
- return;
3865
- }
3866
- this.scriptEnable = true;
3867
- this.scriptIngected = false;
3868
- let script = new Script(
3869
- this.scriptName,
3870
- this.scriptUrl,
3871
- this.scriptEnable,
3872
- this.scriptIngected
3873
- );
3874
- addScriptToList(script);
3875
- saveScriptList();
3876
- this.scriptList = scriptList;
3877
- }}"
3878
- >
3879
- <h2>修改或添加脚本</h2>
3880
- <hm-input
3881
- label="脚本名称"
3882
- placeholder="请输入脚本名称"
3883
- value="${this.scriptName}"
3884
- @hm-input-change="${(e2) => {
3885
- this.scriptName = e2.detail.value;
3886
- console.debug(this.scriptName);
3887
- }}"
3888
- ></hm-input>
3889
- <hm-input
3890
- label="脚本链接"
3891
- placeholder="请输入https的脚本链接"
3892
- value="${this.scriptUrl}"
3893
- @hm-input-change="${(e2) => {
3894
- this.scriptUrl = e2.detail.value;
3895
- console.debug(this.scriptUrl);
3896
- }}"
3897
- ></hm-input>
3898
- </hm-dialog>
3899
-
3900
- <hm-accordion>
3901
- <span slot="header">脚本列表</span>
3902
- ${this.scriptList.map((script) => {
3903
- return x`
3904
- <hm-swipe-cell>
3905
- <div slot="left-actions">
3906
- <hm-button
3907
- @hm-button-click="${() => {
3908
- removeScriptFromList(script);
3909
- saveScriptList();
3910
- this.scriptList = scriptList;
3911
- }}"
3912
- >删除</hm-button
3913
- >
3914
- </div>
3915
- <hm-cell
3916
- slot="content"
3917
- titleName="${script.name}"
3918
- descripthion="${script.url}"
3919
- >
3920
- <hm-switch
3921
- slot="content"
3922
- ?checked="${script.enable}"
3923
- @hm-switch-change="${(e2) => {
3924
- script.enable = e2.detail.checked;
3925
- addScriptToList(script);
3926
- saveScriptList();
3927
- this.scriptList = scriptList;
3928
- }}"
3929
- ></hm-switch>
3930
- </hm-cell>
3931
-
3932
- <div slot="right-actions">
3933
- <hm-button
3934
- @hm-button-click="${() => {
3935
- this.scriptName = script.name;
3936
- this.scriptUrl = script.url;
3937
- this.dialogOpen = true;
3938
- }}"
3939
- >修改</hm-button
3940
- >
3941
- <hm-button
3942
- ?enable="${!script.ingected}"
3943
- @hm-button-click="${() => {
3944
- script.ingected = injectScript(script);
3945
- addScriptToList(script);
3946
- this.scriptList = scriptList;
3947
- }}"
3948
- >运行</hm-button
3949
- >
3950
- </div>
3951
- </hm-swipe-cell>
3952
-
3953
- `;
3954
- })}
3955
- <div slot="footer">
3956
- <hm-button
3957
- @click="${() => {
3958
- readScriptList();
3959
- this.scriptList = scriptList;
3960
- }}"
3961
- >刷新</hm-button
3962
- >
3963
- <hm-button
3964
- @click="${() => {
3965
- this.scriptName = "";
3966
- this.scriptUrl = "";
3967
- this.scriptEnable = true;
3968
- this.scriptIngected = false;
3969
- this.dialogOpen = true;
3970
- }}"
3971
- >添加</hm-button
3972
- >
3973
- <hm-button @click="${() => {
3974
- saveScriptList();
3975
- }}"
3976
- >保存</hm-button
3977
- >
3978
- </div>
3979
- </hm-accordion>
3980
-
3981
- `;
3982
- }
3983
- }
3984
- __decorateClass([
3985
- n2({ type: String })
3986
- ], HmScriptApp.prototype, "scriptName");
3987
- __decorateClass([
3988
- n2({ type: String })
3989
- ], HmScriptApp.prototype, "scriptUrl");
3990
- __decorateClass([
3991
- n2({ type: Boolean })
3992
- ], HmScriptApp.prototype, "scriptEnable");
3993
- __decorateClass([
3994
- n2({ type: Boolean })
3995
- ], HmScriptApp.prototype, "scriptIngected");
3996
- __decorateClass([
3997
- n2({ type: Boolean })
3998
- ], HmScriptApp.prototype, "dialogOpen");
3999
- __decorateClass([
4000
- n2({ type: Array })
4001
- ], HmScriptApp.prototype, "scriptList");
4002
- async function initScriptApp() {
4003
- customElements.define("hm-script-app", HmScriptApp);
4004
- let panel = document.createElement("hm-move-panel");
4005
- panel.titleContent = "脚本管理";
4006
- panel.icon = "js";
4007
- movePanelHolder.appendChild(panel);
4008
- let template = x`
4009
- <hm-script-app></hm-script-app>
4010
- `;
4011
- B(template, await panel.body);
4012
- let menuItem = document.createElement("hm-menu");
4013
- menuItem.content = "脚本管理";
4014
- menuItem.isMenuItem = true;
4015
- menuItem.icon = "js";
4016
- menuItem.addEventListener("hm-menu-click", function() {
4017
- panel.putTopToggel();
4018
- });
4019
- return menuItem;
4020
- }
4021
- const scriptApp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4022
- __proto__: null,
4023
- initScriptApp
4024
- }, Symbol.toStringTag, { value: "Module" }));
4025
- const name = "hortimagic";
4026
- const version = "1.0.3";
4027
- const changelog = "修复了对话框注册较晚的bug,增加了初始化完成的标志";
4028
- const author = "Narlen";
4029
- const description = "园艺魔法,花园插件";
4030
- const keywords = ["iirose", "plugins", "hortimagic"];
4031
- const repository = { "type": "git", "url": "https://github.com/NarlenHua/hortimagic.git" };
4032
- const license = "MIT";
4033
- const type = "module";
4034
- const scripts = { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview" };
4035
- const dependencies = { "lit": "^3.3.1", "terser": "^5.44.0", "tiny-emitter": "^2.1.0", "vite-plugin-dts": "^4.5.4" };
4036
- const devDependencies = { "@types/node": "^24.9.1", "typescript": "~5.9.3", "vite": "^7.1.7" };
4037
- const main$1 = "dist/Horticraft.life.js";
4038
- const module = "dist/HortiCraft.es.js";
4039
- const typings = "dist/index.d.ts";
4040
- const types = "dist/index.d.ts";
4041
- const files = ["dist", "src/components", "types"];
4042
- const pkg = {
4043
- name,
4044
- "private": false,
4045
- version,
4046
- changelog,
4047
- author,
4048
- description,
4049
- keywords,
4050
- repository,
4051
- license,
4052
- type,
4053
- scripts,
4054
- dependencies,
4055
- devDependencies,
4056
- main: main$1,
4057
- module,
4058
- typings,
4059
- types,
4060
- files
4061
- };
4062
- async function init() {
4063
- try {
4064
- initNotificationHolder();
4065
- initDialogHolder();
4066
- await initDialogApp();
4067
- initMenuHolder();
4068
- initMovePanelHolder();
4069
- notice.normal(pkg.name, "注入网络钩子函数");
4070
- await initSocket();
4071
- notice.normal(pkg.name, "注入钩子函数");
4072
- refreshAll();
4073
- initHooks();
4074
- notice.normal(pkg.name, "注入脚本");
4075
- ingectlocalScript();
4076
- notice.normal(pkg.name, "生成菜单");
4077
- let menu2 = document.createElement("hm-menu");
4078
- menu2.content = "HortiMagic";
4079
- menu2.isMenuItem = false;
4080
- menuHolder.appendChild(menu2);
4081
- let exampleMenu = await initExampleApp();
4082
- let scriptMenu = await initScriptApp();
4083
- menu2.addEventListener("hm-menu-click", function() {
4084
- exampleMenu.flag = menu2.flag;
4085
- scriptMenu.flag = menu2.flag;
4086
- });
4087
- menuHolder.append(menu2, exampleMenu, scriptMenu);
4088
- notice.success(pkg.name, `${pkg.version} 已加载`);
4089
- } catch (error) {
4090
- console.error(error);
4091
- }
4092
- }
4093
- const mainApp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4094
- __proto__: null,
4095
- init
4096
- }, Symbol.toStringTag, { value: "Module" }));
4097
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4098
- __proto__: null,
4099
- app_tools: appTools,
4100
- dialog_app: dialogApp$1,
4101
- example_app: exampleApp,
4102
- main_app: mainApp,
4103
- script_app: scriptApp
4104
- }, Symbol.toStringTag, { value: "Module" }));
4105
- const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4106
- __proto__: null,
4107
- dialog,
4108
- menu,
4109
- move_panel: movePanel,
4110
- notification
4111
- }, Symbol.toStringTag, { value: "Module" }));
4112
- const information = {
4113
- /** 项目名称 */
4114
- name: pkg.name,
4115
- /** 项目版本 */
4116
- version: pkg.version,
4117
- /** 项目更新日志 */
4118
- changelog: pkg.changelog,
4119
- /** 项目描述 */
4120
- description: pkg.description,
4121
- /** 项目作者 */
4122
- author: pkg.author,
4123
- /** 项目许可证 */
4124
- license: pkg.license,
4125
- /** 项目仓库 */
4126
- repository: pkg.repository,
4127
- /** 项目构建时间 */
4128
- buildTime: (/* @__PURE__ */ new Date()).toISOString(),
4129
- /** 项目是否注入完成 */
4130
- ingected: false
4131
- };
4132
- async function main() {
4133
- await init();
4134
- information.ingected = true;
4135
- }
4136
- main();
4137
- export {
4138
- index$1 as apps,
4139
- index$2 as components,
4140
- index$3 as core,
4141
- index as holders,
4142
- information
4143
- };