hortimagic 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4 -0
- package/README.md +9 -0
- package/dist/hortimagic.es.js +4024 -0
- package/dist/hortimagic.iife.js +1153 -0
- package/dist/hortimagic.js +1165 -0
- package/dist/hortimagic.txt +1165 -0
- package/dist/hortimagic.user.js +1165 -0
- package/dist/index.d.ts +1239 -0
- package/package.json +43 -0
- package/src/components/hm-accordion.ts +141 -0
- package/src/components/hm-button.ts +161 -0
- package/src/components/hm-cell.ts +181 -0
- package/src/components/hm-dialog.ts +125 -0
- package/src/components/hm-icon.ts +70 -0
- package/src/components/hm-input.ts +116 -0
- package/src/components/hm-menu.ts +94 -0
- package/src/components/hm-move-panel.ts +358 -0
- package/src/components/hm-notification.ts +177 -0
- package/src/components/hm-swipe-cell.ts +378 -0
- package/src/components/hm-switch.ts +167 -0
- package/src/components/index.ts +11 -0
- package/src/components/type.d.ts +48 -0
- package/types/global.d.ts +351 -0
- package/types/vite-env.d.ts +2 -0
|
@@ -0,0 +1,4024 @@
|
|
|
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(`&`, "&");
|
|
26
|
+
e2 = e2.replace(`<`, "<");
|
|
27
|
+
e2 = e2.replace(`>`, ">");
|
|
28
|
+
e2 = e2.replace(`"`, """);
|
|
29
|
+
e2 = e2.replace(`'`, "'");
|
|
30
|
+
e2 = e2.replace(`\\`, "\");
|
|
31
|
+
return e2;
|
|
32
|
+
}
|
|
33
|
+
function htmlSpecialCharsDecode(e2) {
|
|
34
|
+
e2 = e2.replace("<", `<`);
|
|
35
|
+
e2 = e2.replace(">", `>`);
|
|
36
|
+
e2 = e2.replace(""", `"`);
|
|
37
|
+
e2 = e2.replace("'", `'`);
|
|
38
|
+
e2 = e2.replace("\", `\\`);
|
|
39
|
+
e2 = e2.replace("&", `&`);
|
|
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
|
+
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$b = Object.defineProperty;
|
|
1476
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
1477
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
1478
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(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$b(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$b([
|
|
1773
|
+
n2({ type: Number })
|
|
1774
|
+
], HmMovePanel.prototype, "width", 2);
|
|
1775
|
+
__decorateClass$b([
|
|
1776
|
+
n2({ type: Number })
|
|
1777
|
+
], HmMovePanel.prototype, "height", 2);
|
|
1778
|
+
__decorateClass$b([
|
|
1779
|
+
n2({ type: String, attribute: "header-background-color" })
|
|
1780
|
+
], HmMovePanel.prototype, "headerBackgroundColor", 2);
|
|
1781
|
+
__decorateClass$b([
|
|
1782
|
+
n2({ type: String, attribute: "header-color" })
|
|
1783
|
+
], HmMovePanel.prototype, "headerColor", 2);
|
|
1784
|
+
__decorateClass$b([
|
|
1785
|
+
n2({ type: String, attribute: "body-background-color" })
|
|
1786
|
+
], HmMovePanel.prototype, "bodyBackgroundColor", 2);
|
|
1787
|
+
__decorateClass$b([
|
|
1788
|
+
n2({ type: String, attribute: "body-color" })
|
|
1789
|
+
], HmMovePanel.prototype, "bodyColor", 2);
|
|
1790
|
+
__decorateClass$b([
|
|
1791
|
+
n2({ type: String, attribute: "footer-background-color" })
|
|
1792
|
+
], HmMovePanel.prototype, "footerBackgroundColor", 2);
|
|
1793
|
+
__decorateClass$b([
|
|
1794
|
+
n2({ type: String, attribute: "button-background-color" })
|
|
1795
|
+
], HmMovePanel.prototype, "buttonBackgroundColor", 2);
|
|
1796
|
+
__decorateClass$b([
|
|
1797
|
+
n2({ type: String, attribute: "button-color" })
|
|
1798
|
+
], HmMovePanel.prototype, "buttonColor", 2);
|
|
1799
|
+
__decorateClass$b([
|
|
1800
|
+
n2({ type: String })
|
|
1801
|
+
], HmMovePanel.prototype, "titleContent", 2);
|
|
1802
|
+
__decorateClass$b([
|
|
1803
|
+
n2({ type: String, attribute: "left-button-text" })
|
|
1804
|
+
], HmMovePanel.prototype, "leftButtonText", 2);
|
|
1805
|
+
__decorateClass$b([
|
|
1806
|
+
n2({ type: String, attribute: "right-button-text" })
|
|
1807
|
+
], HmMovePanel.prototype, "rightButtonText", 2);
|
|
1808
|
+
__decorateClass$b([
|
|
1809
|
+
n2({ type: Boolean, attribute: "is-display" })
|
|
1810
|
+
], HmMovePanel.prototype, "isDisplay", 2);
|
|
1811
|
+
__decorateClass$b([
|
|
1812
|
+
n2({ type: Number })
|
|
1813
|
+
], HmMovePanel.prototype, "zIndex", 2);
|
|
1814
|
+
__decorateClass$b([
|
|
1815
|
+
n2({ type: String })
|
|
1816
|
+
], HmMovePanel.prototype, "icon", 2);
|
|
1817
|
+
__decorateClass$b([
|
|
1818
|
+
n2({ type: Number })
|
|
1819
|
+
], HmMovePanel.prototype, "left", 2);
|
|
1820
|
+
__decorateClass$b([
|
|
1821
|
+
n2({ type: Number })
|
|
1822
|
+
], HmMovePanel.prototype, "top", 2);
|
|
1823
|
+
__decorateClass$b([
|
|
1824
|
+
r(".body")
|
|
1825
|
+
], HmMovePanel.prototype, "body", 2);
|
|
1826
|
+
HmMovePanel = __decorateClass$b([
|
|
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$a = Object.defineProperty;
|
|
1891
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
1892
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
1893
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(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$a(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
|
+
]);
|
|
1911
|
+
function registerIcon(name2, svgContent) {
|
|
1912
|
+
iconMap.set(name2, svgContent);
|
|
1913
|
+
}
|
|
1914
|
+
function getIcon(name2) {
|
|
1915
|
+
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>';
|
|
1916
|
+
}
|
|
1917
|
+
let HmIcon = class extends i$1 {
|
|
1918
|
+
constructor() {
|
|
1919
|
+
super(...arguments);
|
|
1920
|
+
this.icon = "magic-wand";
|
|
1921
|
+
this.size = "16px";
|
|
1922
|
+
}
|
|
1923
|
+
/** 触发点击事件 */
|
|
1924
|
+
handelClick() {
|
|
1925
|
+
this.dispatchEvent(new CustomEvent("hm-icon-click"));
|
|
1926
|
+
}
|
|
1927
|
+
render() {
|
|
1928
|
+
return x`
|
|
1929
|
+
<div class="icon"
|
|
1930
|
+
style="width:${this.size}; height:${this.size};"
|
|
1931
|
+
@click="${this.handelClick}"
|
|
1932
|
+
>
|
|
1933
|
+
${o(getIcon(this.icon))}
|
|
1934
|
+
</div>
|
|
1935
|
+
`;
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
HmIcon.styles = i$4`
|
|
1939
|
+
:host {
|
|
1940
|
+
display: inline-block;
|
|
1941
|
+
}
|
|
1942
|
+
.icon {
|
|
1943
|
+
display: flex;
|
|
1944
|
+
align-items: center;
|
|
1945
|
+
justify-content: center;
|
|
1946
|
+
width: 100%;
|
|
1947
|
+
height: 100%;
|
|
1948
|
+
}
|
|
1949
|
+
|
|
1950
|
+
.icon svg {
|
|
1951
|
+
width: 100%;
|
|
1952
|
+
height: 100%;
|
|
1953
|
+
}
|
|
1954
|
+
`;
|
|
1955
|
+
__decorateClass$a([
|
|
1956
|
+
n2({ type: String })
|
|
1957
|
+
], HmIcon.prototype, "icon", 2);
|
|
1958
|
+
__decorateClass$a([
|
|
1959
|
+
n2({ type: String })
|
|
1960
|
+
], HmIcon.prototype, "size", 2);
|
|
1961
|
+
HmIcon = __decorateClass$a([
|
|
1962
|
+
t$2("hm-icon")
|
|
1963
|
+
], HmIcon);
|
|
1964
|
+
const hmIcon = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1965
|
+
__proto__: null,
|
|
1966
|
+
get HmIcon() {
|
|
1967
|
+
return HmIcon;
|
|
1968
|
+
},
|
|
1969
|
+
getIcon,
|
|
1970
|
+
registerIcon
|
|
1971
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
1972
|
+
var __defProp$9 = Object.defineProperty;
|
|
1973
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
1974
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
1975
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
1976
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
1977
|
+
if (decorator = decorators[i3])
|
|
1978
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
1979
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
1980
|
+
return result;
|
|
1981
|
+
};
|
|
1982
|
+
let HmMenu = class extends i$1 {
|
|
1983
|
+
constructor() {
|
|
1984
|
+
super(...arguments);
|
|
1985
|
+
this.icon = "magic-wand";
|
|
1986
|
+
this.content = "HortiMagic";
|
|
1987
|
+
this.flag = false;
|
|
1988
|
+
this.isMenuItem = false;
|
|
1989
|
+
}
|
|
1990
|
+
/** 触发点击事件 */
|
|
1991
|
+
handleClick() {
|
|
1992
|
+
if (!this.isMenuItem)
|
|
1993
|
+
this.flag = !this.flag;
|
|
1994
|
+
this.dispatchEvent(new CustomEvent("hm-menu-click"));
|
|
1995
|
+
}
|
|
1996
|
+
render() {
|
|
1997
|
+
return x`
|
|
1998
|
+
<div
|
|
1999
|
+
class="menu ${this.isMenuItem ? "is-menu-item" : "not-menu-item"}"
|
|
2000
|
+
style="display:${this.isMenuItem && !this.flag ? "none" : "flex"}"
|
|
2001
|
+
@click="${this.handleClick}"
|
|
2002
|
+
>
|
|
2003
|
+
<hm-icon class="left icon" icon="${this.icon}" size="24px"></hm-icon>
|
|
2004
|
+
<div class="content">
|
|
2005
|
+
<slot name="content"> ${this.content} </slot>
|
|
2006
|
+
</div>
|
|
2007
|
+
<div class="right">
|
|
2008
|
+
<slot name="right">
|
|
2009
|
+
${this.isMenuItem ? "" : x`<hm-icon
|
|
2010
|
+
class="icon right"
|
|
2011
|
+
icon="${this.flag ? "arrow-up" : "arrow-down"}"
|
|
2012
|
+
></hm-icon
|
|
2013
|
+
>`}
|
|
2014
|
+
</slot>
|
|
2015
|
+
</div>
|
|
2016
|
+
</div>
|
|
2017
|
+
|
|
2018
|
+
|
|
2019
|
+
|
|
2020
|
+
|
|
2021
|
+
`;
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
HmMenu.styles = i$4`
|
|
2025
|
+
:host {
|
|
2026
|
+
color: rgb(33,33,33);
|
|
2027
|
+
height: 56px;
|
|
2028
|
+
}
|
|
2029
|
+
.menu:hover {
|
|
2030
|
+
color: rgba(255, 255, 0, 1);
|
|
2031
|
+
}
|
|
2032
|
+
.menu {
|
|
2033
|
+
height: 56px;
|
|
2034
|
+
align-items: center;
|
|
2035
|
+
}
|
|
2036
|
+
.icon {
|
|
2037
|
+
display: flex;
|
|
2038
|
+
justify-content: center;
|
|
2039
|
+
align-items: center;
|
|
2040
|
+
height: 56px;
|
|
2041
|
+
width: 56px;
|
|
2042
|
+
}
|
|
2043
|
+
.left {
|
|
2044
|
+
margin-right: 16px;
|
|
2045
|
+
color: rgb(117,117,117);
|
|
2046
|
+
}
|
|
2047
|
+
.right {
|
|
2048
|
+
position: absolute;
|
|
2049
|
+
right: 2px;
|
|
2050
|
+
display: flex;
|
|
2051
|
+
justify-content: center;
|
|
2052
|
+
align-items: center;
|
|
2053
|
+
}
|
|
2054
|
+
.content {
|
|
2055
|
+
font-size: 16px;
|
|
2056
|
+
font-weight:bold;
|
|
2057
|
+
margin-right:auto;
|
|
2058
|
+
}
|
|
2059
|
+
.is-menu-item {
|
|
2060
|
+
background:rgb(240,240,240);
|
|
2061
|
+
}
|
|
2062
|
+
.not-menu-item {
|
|
2063
|
+
background:rgb(255,255,255);
|
|
2064
|
+
}
|
|
2065
|
+
`;
|
|
2066
|
+
__decorateClass$9([
|
|
2067
|
+
n2({ type: String })
|
|
2068
|
+
], HmMenu.prototype, "icon", 2);
|
|
2069
|
+
__decorateClass$9([
|
|
2070
|
+
n2({ type: String })
|
|
2071
|
+
], HmMenu.prototype, "content", 2);
|
|
2072
|
+
__decorateClass$9([
|
|
2073
|
+
n2({ type: Boolean })
|
|
2074
|
+
], HmMenu.prototype, "flag", 2);
|
|
2075
|
+
__decorateClass$9([
|
|
2076
|
+
n2({ type: Boolean })
|
|
2077
|
+
], HmMenu.prototype, "isMenuItem", 2);
|
|
2078
|
+
HmMenu = __decorateClass$9([
|
|
2079
|
+
t$2("hm-menu")
|
|
2080
|
+
], HmMenu);
|
|
2081
|
+
const hmMenu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2082
|
+
__proto__: null,
|
|
2083
|
+
get HmMenu() {
|
|
2084
|
+
return HmMenu;
|
|
2085
|
+
}
|
|
2086
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2087
|
+
var __defProp$8 = Object.defineProperty;
|
|
2088
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
2089
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
2090
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
2091
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2092
|
+
if (decorator = decorators[i3])
|
|
2093
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2094
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
2095
|
+
return result;
|
|
2096
|
+
};
|
|
2097
|
+
let HmNotification = class extends i$1 {
|
|
2098
|
+
constructor() {
|
|
2099
|
+
super(...arguments);
|
|
2100
|
+
this.leftIcon = "magic-wand";
|
|
2101
|
+
this.title = "HortiMagic";
|
|
2102
|
+
this.content = "Hello iirose!";
|
|
2103
|
+
this.rightIcon = "";
|
|
2104
|
+
this.displayTime = 999999;
|
|
2105
|
+
this.color = "rgb(33,33,33)";
|
|
2106
|
+
this.backgroundColor = "rgba(255,255,255,0.9)";
|
|
2107
|
+
}
|
|
2108
|
+
// 组件挂载后启动定时器
|
|
2109
|
+
firstUpdated() {
|
|
2110
|
+
if (this.displayTime > 0) {
|
|
2111
|
+
setTimeout(() => {
|
|
2112
|
+
this.startLeaveAnimation();
|
|
2113
|
+
}, this.displayTime);
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
startLeaveAnimation() {
|
|
2117
|
+
this.setAttribute("leaving", "");
|
|
2118
|
+
setTimeout(() => {
|
|
2119
|
+
this.remove();
|
|
2120
|
+
}, 300);
|
|
2121
|
+
}
|
|
2122
|
+
render() {
|
|
2123
|
+
return x`
|
|
2124
|
+
<div
|
|
2125
|
+
class="hm-notification"
|
|
2126
|
+
style="${this.color ? `border-color: ${this.color};` : ""}
|
|
2127
|
+
${this.color ? `color: ${this.color};` : ""}
|
|
2128
|
+
${this.backgroundColor ? `background-color: ${this.backgroundColor};` : ""}"
|
|
2129
|
+
>
|
|
2130
|
+
${this.leftIcon ? x`
|
|
2131
|
+
<div class="icondiv">
|
|
2132
|
+
<hm-icon icon="${this.leftIcon}" size="24px"></hm-icon>
|
|
2133
|
+
</div>
|
|
2134
|
+
` : ""}
|
|
2135
|
+
|
|
2136
|
+
<div class="hm-notification-main">
|
|
2137
|
+
<div class="hm-notification-title">${this.title}</div>
|
|
2138
|
+
<div class="hm-notification-content">${this.content}</div>
|
|
2139
|
+
</div>
|
|
2140
|
+
${this.rightIcon ? x`
|
|
2141
|
+
<div class="icondiv">
|
|
2142
|
+
<hm-icon icon="${this.rightIcon}" size="24px"></hm-icon>
|
|
2143
|
+
</div>
|
|
2144
|
+
` : ""}
|
|
2145
|
+
</div>
|
|
2146
|
+
`;
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
HmNotification.styles = i$4`
|
|
2150
|
+
:host{
|
|
2151
|
+
display: block;
|
|
2152
|
+
width: auto;
|
|
2153
|
+
z-index: 9999999;
|
|
2154
|
+
margin: 2px;
|
|
2155
|
+
animation: slideInRight 0.3s ease-out forwards;
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
:host([leaving]) {
|
|
2159
|
+
animation: slideOutRight 0.3s ease-in forwards;
|
|
2160
|
+
}
|
|
2161
|
+
|
|
2162
|
+
@keyframes slideInRight {
|
|
2163
|
+
from {
|
|
2164
|
+
opacity: 0;
|
|
2165
|
+
transform: translate3d(100%, 0, 0);
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
to {
|
|
2169
|
+
opacity: 1;
|
|
2170
|
+
transform: translate3d(0, 0, 0);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
@keyframes slideOutRight {
|
|
2175
|
+
from {
|
|
2176
|
+
opacity: 1;
|
|
2177
|
+
transform: translate3d(0, 0, 0);
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
to {
|
|
2181
|
+
opacity: 0;
|
|
2182
|
+
transform: translate3d(100%, 0, 0);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
.hm-notification{
|
|
2187
|
+
display: flex;
|
|
2188
|
+
align-items: center;
|
|
2189
|
+
width:fit-content;
|
|
2190
|
+
max-width: 320px;
|
|
2191
|
+
border-radius: 10px;
|
|
2192
|
+
|
|
2193
|
+
}
|
|
2194
|
+
.hm-notification-main{
|
|
2195
|
+
margin-right: 8px;
|
|
2196
|
+
padding: 8px;
|
|
2197
|
+
}
|
|
2198
|
+
.hm-notification-title{
|
|
2199
|
+
font-size: 16px;
|
|
2200
|
+
font-weight: bold;
|
|
2201
|
+
}
|
|
2202
|
+
.hm-notification-content{
|
|
2203
|
+
font-size: 14px;
|
|
2204
|
+
}
|
|
2205
|
+
.icondiv{
|
|
2206
|
+
display: flex;
|
|
2207
|
+
align-items: center;
|
|
2208
|
+
justify-content: center;
|
|
2209
|
+
width: 44px;
|
|
2210
|
+
height: 44px;
|
|
2211
|
+
}
|
|
2212
|
+
`;
|
|
2213
|
+
__decorateClass$8([
|
|
2214
|
+
n2()
|
|
2215
|
+
], HmNotification.prototype, "leftIcon", 2);
|
|
2216
|
+
__decorateClass$8([
|
|
2217
|
+
n2()
|
|
2218
|
+
], HmNotification.prototype, "title", 2);
|
|
2219
|
+
__decorateClass$8([
|
|
2220
|
+
n2()
|
|
2221
|
+
], HmNotification.prototype, "content", 2);
|
|
2222
|
+
__decorateClass$8([
|
|
2223
|
+
n2()
|
|
2224
|
+
], HmNotification.prototype, "rightIcon", 2);
|
|
2225
|
+
__decorateClass$8([
|
|
2226
|
+
n2()
|
|
2227
|
+
], HmNotification.prototype, "displayTime", 2);
|
|
2228
|
+
__decorateClass$8([
|
|
2229
|
+
n2()
|
|
2230
|
+
], HmNotification.prototype, "color", 2);
|
|
2231
|
+
__decorateClass$8([
|
|
2232
|
+
n2()
|
|
2233
|
+
], HmNotification.prototype, "backgroundColor", 2);
|
|
2234
|
+
HmNotification = __decorateClass$8([
|
|
2235
|
+
t$2("hm-notification")
|
|
2236
|
+
], HmNotification);
|
|
2237
|
+
const hmNotification = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2238
|
+
__proto__: null,
|
|
2239
|
+
get HmNotification() {
|
|
2240
|
+
return HmNotification;
|
|
2241
|
+
}
|
|
2242
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2243
|
+
var __defProp$7 = Object.defineProperty;
|
|
2244
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
2245
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
2246
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
2247
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2248
|
+
if (decorator = decorators[i3])
|
|
2249
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2250
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
2251
|
+
return result;
|
|
2252
|
+
};
|
|
2253
|
+
let HmButton = class extends i$1 {
|
|
2254
|
+
constructor() {
|
|
2255
|
+
super(...arguments);
|
|
2256
|
+
this.icon = "";
|
|
2257
|
+
this.content = "";
|
|
2258
|
+
this.fontSize = "14px";
|
|
2259
|
+
this.color = "";
|
|
2260
|
+
this.background = "";
|
|
2261
|
+
this.width = "";
|
|
2262
|
+
this.height = "";
|
|
2263
|
+
this.enable = true;
|
|
2264
|
+
this.loading = false;
|
|
2265
|
+
}
|
|
2266
|
+
render() {
|
|
2267
|
+
const buttonStyle = `
|
|
2268
|
+
${this.color ? `color: ${this.color};` : ""}
|
|
2269
|
+
${this.background ? `background-color: ${this.background};` : ""}
|
|
2270
|
+
${this.width ? `width: ${this.width};` : ""}
|
|
2271
|
+
${this.height ? `height: ${this.height};` : ""}
|
|
2272
|
+
${this.fontSize ? `font-size: ${this.fontSize};` : "14px"}
|
|
2273
|
+
`;
|
|
2274
|
+
return x`
|
|
2275
|
+
<button
|
|
2276
|
+
class="button"
|
|
2277
|
+
style="${buttonStyle}"
|
|
2278
|
+
?disabled="${!this.enable || this.loading}"
|
|
2279
|
+
@click="${this._handleClick}">
|
|
2280
|
+
|
|
2281
|
+
${this.loading ? x`
|
|
2282
|
+
<div class="loading-spinner"></div>
|
|
2283
|
+
` : this.icon ? x`
|
|
2284
|
+
<slot name="icon">
|
|
2285
|
+
<hm-icon icon="${this.icon}" style="margin-right: 8px;"></hm-icon>
|
|
2286
|
+
</slot>
|
|
2287
|
+
` : ""}
|
|
2288
|
+
|
|
2289
|
+
<span class="button-content">
|
|
2290
|
+
<slot>${this.content}</slot>
|
|
2291
|
+
</span>
|
|
2292
|
+
</button>
|
|
2293
|
+
`;
|
|
2294
|
+
}
|
|
2295
|
+
_handleClick(e2) {
|
|
2296
|
+
if (!this.enable || this.loading) {
|
|
2297
|
+
e2.stopPropagation();
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
this.dispatchEvent(new CustomEvent("hm-button-click"));
|
|
2301
|
+
}
|
|
2302
|
+
};
|
|
2303
|
+
HmButton.styles = i$4`
|
|
2304
|
+
:host {
|
|
2305
|
+
display: inline-block;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
.button {
|
|
2309
|
+
display: inline-flex;
|
|
2310
|
+
align-items: center;
|
|
2311
|
+
justify-content: center;
|
|
2312
|
+
border: none;
|
|
2313
|
+
border-radius: 4px;
|
|
2314
|
+
padding: 8px 16px;
|
|
2315
|
+
cursor: pointer;
|
|
2316
|
+
transition: all 0.3s;
|
|
2317
|
+
opacity: 1;
|
|
2318
|
+
// 添加鼠标悬停动画
|
|
2319
|
+
&:hover:not(:disabled) {
|
|
2320
|
+
transform: translateY(-2px);
|
|
2321
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
.button:disabled {
|
|
2326
|
+
cursor: not-allowed;
|
|
2327
|
+
opacity: 0.6;
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
.button.loading {
|
|
2331
|
+
cursor: not-allowed;
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
.loading-spinner {
|
|
2335
|
+
width: 14px;
|
|
2336
|
+
height: 14px;
|
|
2337
|
+
border: 2px solid transparent;
|
|
2338
|
+
border-top-color: currentColor;
|
|
2339
|
+
border-radius: 50%;
|
|
2340
|
+
animation: rotate 1s linear infinite;
|
|
2341
|
+
margin-right: 8px;
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
@keyframes rotate {
|
|
2345
|
+
from {
|
|
2346
|
+
transform: rotate(0deg);
|
|
2347
|
+
}
|
|
2348
|
+
to {
|
|
2349
|
+
transform: rotate(360deg);
|
|
2350
|
+
}
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
.button-content {
|
|
2354
|
+
display: flex;
|
|
2355
|
+
align-items: center;
|
|
2356
|
+
}
|
|
2357
|
+
`;
|
|
2358
|
+
__decorateClass$7([
|
|
2359
|
+
n2({ type: String })
|
|
2360
|
+
], HmButton.prototype, "icon", 2);
|
|
2361
|
+
__decorateClass$7([
|
|
2362
|
+
n2({ type: String })
|
|
2363
|
+
], HmButton.prototype, "content", 2);
|
|
2364
|
+
__decorateClass$7([
|
|
2365
|
+
n2({ type: String })
|
|
2366
|
+
], HmButton.prototype, "fontSize", 2);
|
|
2367
|
+
__decorateClass$7([
|
|
2368
|
+
n2({ type: String })
|
|
2369
|
+
], HmButton.prototype, "color", 2);
|
|
2370
|
+
__decorateClass$7([
|
|
2371
|
+
n2({ type: String })
|
|
2372
|
+
], HmButton.prototype, "background", 2);
|
|
2373
|
+
__decorateClass$7([
|
|
2374
|
+
n2({ type: String })
|
|
2375
|
+
], HmButton.prototype, "width", 2);
|
|
2376
|
+
__decorateClass$7([
|
|
2377
|
+
n2({ type: String })
|
|
2378
|
+
], HmButton.prototype, "height", 2);
|
|
2379
|
+
__decorateClass$7([
|
|
2380
|
+
n2({ type: Boolean })
|
|
2381
|
+
], HmButton.prototype, "enable", 2);
|
|
2382
|
+
__decorateClass$7([
|
|
2383
|
+
n2({ type: Boolean })
|
|
2384
|
+
], HmButton.prototype, "loading", 2);
|
|
2385
|
+
HmButton = __decorateClass$7([
|
|
2386
|
+
t$2("hm-button")
|
|
2387
|
+
], HmButton);
|
|
2388
|
+
const hmButton = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2389
|
+
__proto__: null,
|
|
2390
|
+
get HmButton() {
|
|
2391
|
+
return HmButton;
|
|
2392
|
+
}
|
|
2393
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2394
|
+
var __defProp$6 = Object.defineProperty;
|
|
2395
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
2396
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
2397
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
2398
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2399
|
+
if (decorator = decorators[i3])
|
|
2400
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2401
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
2402
|
+
return result;
|
|
2403
|
+
};
|
|
2404
|
+
let HmCell = class extends i$1 {
|
|
2405
|
+
constructor() {
|
|
2406
|
+
super(...arguments);
|
|
2407
|
+
this.titleName = "单元格";
|
|
2408
|
+
this.descripthion = "描述信息";
|
|
2409
|
+
this.content = "内容";
|
|
2410
|
+
this.titleClickCallback = () => {
|
|
2411
|
+
};
|
|
2412
|
+
this.contentClickCallback = () => {
|
|
2413
|
+
};
|
|
2414
|
+
}
|
|
2415
|
+
render() {
|
|
2416
|
+
return x`
|
|
2417
|
+
<div class="cell" part="cell">
|
|
2418
|
+
<div
|
|
2419
|
+
class="left-section"
|
|
2420
|
+
part="left-section"
|
|
2421
|
+
@click="${this.titleClickCallback}"
|
|
2422
|
+
>
|
|
2423
|
+
<div class="title" part="title">
|
|
2424
|
+
<slot name="title">${this.titleName}</slot>
|
|
2425
|
+
</div>
|
|
2426
|
+
<div class="description" part="description">
|
|
2427
|
+
<slot name="description">${this.descripthion}</slot>
|
|
2428
|
+
</div>
|
|
2429
|
+
</div>
|
|
2430
|
+
<div
|
|
2431
|
+
class="right-section"
|
|
2432
|
+
part="right-section"
|
|
2433
|
+
@click="${this.contentClickCallback}"
|
|
2434
|
+
>
|
|
2435
|
+
<div class="content" part="content">
|
|
2436
|
+
<slot name="content">${this.content}</slot>
|
|
2437
|
+
</div>
|
|
2438
|
+
</div>
|
|
2439
|
+
</div>
|
|
2440
|
+
|
|
2441
|
+
`;
|
|
2442
|
+
}
|
|
2443
|
+
};
|
|
2444
|
+
HmCell.styles = i$4`
|
|
2445
|
+
:host {
|
|
2446
|
+
display: block;
|
|
2447
|
+
width: 100%;
|
|
2448
|
+
}
|
|
2449
|
+
.cell {
|
|
2450
|
+
display: flex;
|
|
2451
|
+
align-items: center;
|
|
2452
|
+
justify-content: space-between;
|
|
2453
|
+
width: 100%;
|
|
2454
|
+
min-height: 60px;
|
|
2455
|
+
padding: var(--hm-cell-padding, 12px 16px);
|
|
2456
|
+
background: var(--hm-cell-background, #ffffff);
|
|
2457
|
+
border: var(--hm-cell-border, 1px dashed #e0e0e0);
|
|
2458
|
+
box-sizing: border-box;
|
|
2459
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
.left-section {
|
|
2463
|
+
display: flex;
|
|
2464
|
+
flex-direction: column;
|
|
2465
|
+
justify-content: center;
|
|
2466
|
+
flex: 1;
|
|
2467
|
+
min-width: 0; /* 允许文本截断 */
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
.title {
|
|
2471
|
+
font-size: var(--hm-cell-title-font-size, 18px);
|
|
2472
|
+
font-weight: var(--hm-cell-title-font-weight, 600);
|
|
2473
|
+
color: var(--hm-cell-title-color, #000000);
|
|
2474
|
+
line-height: 1.4;
|
|
2475
|
+
margin-bottom: 2px;
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
.description {
|
|
2479
|
+
font-size: var(--hm-cell-description-font-size, 14px);
|
|
2480
|
+
color: var(--hm-cell-description-color, #666666);
|
|
2481
|
+
line-height: 1.4;
|
|
2482
|
+
}
|
|
2483
|
+
|
|
2484
|
+
.right-section {
|
|
2485
|
+
display: flex;
|
|
2486
|
+
align-items: center;
|
|
2487
|
+
justify-content: flex-end;
|
|
2488
|
+
margin-left: auto;
|
|
2489
|
+
padding-left: 16px;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
.content {
|
|
2493
|
+
font-size: var(--hm-cell-content-font-size, 16px);
|
|
2494
|
+
color: var(--hm-cell-content-color, #333333);
|
|
2495
|
+
text-align: right;
|
|
2496
|
+
padding-right: var(--hm-cell-content-padding-right, 30px);
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
/* 响应式设计 */
|
|
2500
|
+
@media (max-width: 480px) {
|
|
2501
|
+
.cell {
|
|
2502
|
+
padding: var(--hm-cell-mobile-padding, 10px 12px);
|
|
2503
|
+
min-height: 50px;
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
.title {
|
|
2507
|
+
font-size: var(--hm-cell-mobile-title-font-size, 16px);
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
.description {
|
|
2511
|
+
font-size: var(--hm-cell-mobile-description-font-size, 12px);
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
.content {
|
|
2515
|
+
font-size: var(--hm-cell-mobile-content-font-size, 14px);
|
|
2516
|
+
padding-right: var(--hm-cell-mobile-content-padding-right, 16px);
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
/* 当鼠标或触摸悬停在整个单元格上时,改变内部文本的样式 */
|
|
2520
|
+
.cell:hover .title,
|
|
2521
|
+
.cell:hover .description,
|
|
2522
|
+
.cell:hover .content {
|
|
2523
|
+
/* 使用CSS变量允许自定义,并提供默认高亮颜色 */
|
|
2524
|
+
color: var(--hm-cell-hover-font-color, #1890ff);
|
|
2525
|
+
/* 可选:增加字体粗细使其更突出 */
|
|
2526
|
+
font-weight: var(--hm-cell-hover-font-weight, 600);
|
|
2527
|
+
/* 可选:添加文字阴影增强视觉效果 */
|
|
2528
|
+
text-shadow: var(--hm-cell-hover-text-shadow, 0 0 5px rgba(24, 144, 255, 0.2));
|
|
2529
|
+
}
|
|
2530
|
+
`;
|
|
2531
|
+
__decorateClass$6([
|
|
2532
|
+
n2()
|
|
2533
|
+
], HmCell.prototype, "titleName", 2);
|
|
2534
|
+
__decorateClass$6([
|
|
2535
|
+
n2()
|
|
2536
|
+
], HmCell.prototype, "descripthion", 2);
|
|
2537
|
+
__decorateClass$6([
|
|
2538
|
+
n2()
|
|
2539
|
+
], HmCell.prototype, "content", 2);
|
|
2540
|
+
__decorateClass$6([
|
|
2541
|
+
n2()
|
|
2542
|
+
], HmCell.prototype, "titleClickCallback", 2);
|
|
2543
|
+
__decorateClass$6([
|
|
2544
|
+
n2()
|
|
2545
|
+
], HmCell.prototype, "contentClickCallback", 2);
|
|
2546
|
+
HmCell = __decorateClass$6([
|
|
2547
|
+
t$2("hm-cell")
|
|
2548
|
+
], HmCell);
|
|
2549
|
+
const hmCell = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2550
|
+
__proto__: null,
|
|
2551
|
+
get HmCell() {
|
|
2552
|
+
return HmCell;
|
|
2553
|
+
}
|
|
2554
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2555
|
+
var __defProp$5 = Object.defineProperty;
|
|
2556
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
2557
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
2558
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
2559
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2560
|
+
if (decorator = decorators[i3])
|
|
2561
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2562
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
2563
|
+
return result;
|
|
2564
|
+
};
|
|
2565
|
+
let HmSwipeCell = class extends i$1 {
|
|
2566
|
+
constructor() {
|
|
2567
|
+
super(...arguments);
|
|
2568
|
+
this._isDragging = false;
|
|
2569
|
+
this._startX = 0;
|
|
2570
|
+
this._currentTranslate = 0;
|
|
2571
|
+
this._prevTranslate = 0;
|
|
2572
|
+
this._animationId = 0;
|
|
2573
|
+
this._velocity = 0;
|
|
2574
|
+
this._lastX = 0;
|
|
2575
|
+
this._lastTime = 0;
|
|
2576
|
+
this._isOpen = false;
|
|
2577
|
+
this.rightButtonName = "右侧按钮";
|
|
2578
|
+
this.rightButtonCallback = function() {
|
|
2579
|
+
console.debug("点击了一下");
|
|
2580
|
+
};
|
|
2581
|
+
this.leftActionsWidth = 0;
|
|
2582
|
+
this.rightActionsWidth = 0;
|
|
2583
|
+
this.onDragStart = (e2) => {
|
|
2584
|
+
e2.preventDefault();
|
|
2585
|
+
this.startDrag(e2.clientX);
|
|
2586
|
+
this.sliderElement.style.cursor = "grabbing";
|
|
2587
|
+
this.sliderElement.style.transition = "none";
|
|
2588
|
+
};
|
|
2589
|
+
this.onTouchStart = (e2) => {
|
|
2590
|
+
e2.preventDefault();
|
|
2591
|
+
this.startDrag(e2.touches[0].clientX);
|
|
2592
|
+
this.sliderElement.style.transition = "none";
|
|
2593
|
+
};
|
|
2594
|
+
this.startDrag = (clientX) => {
|
|
2595
|
+
this._isDragging = true;
|
|
2596
|
+
this._startX = clientX;
|
|
2597
|
+
this._lastX = clientX;
|
|
2598
|
+
this._lastTime = Date.now();
|
|
2599
|
+
this._isOpen = Math.abs(this._prevTranslate) > 10;
|
|
2600
|
+
this.calculateActionWidths();
|
|
2601
|
+
};
|
|
2602
|
+
this.onDragMove = (e2) => {
|
|
2603
|
+
if (!this._isDragging) return;
|
|
2604
|
+
e2.preventDefault();
|
|
2605
|
+
this.handleMove(e2.clientX);
|
|
2606
|
+
};
|
|
2607
|
+
this.onTouchMove = (e2) => {
|
|
2608
|
+
if (!this._isDragging) return;
|
|
2609
|
+
e2.preventDefault();
|
|
2610
|
+
this.handleMove(e2.touches[0].clientX);
|
|
2611
|
+
};
|
|
2612
|
+
this.onDragEnd = () => {
|
|
2613
|
+
this.finishDrag();
|
|
2614
|
+
this.sliderElement.style.cursor = "grab";
|
|
2615
|
+
};
|
|
2616
|
+
this.onTouchEnd = () => {
|
|
2617
|
+
this.finishDrag();
|
|
2618
|
+
};
|
|
2619
|
+
}
|
|
2620
|
+
firstUpdated() {
|
|
2621
|
+
this.calculateActionWidths();
|
|
2622
|
+
this.addEventListeners();
|
|
2623
|
+
}
|
|
2624
|
+
disconnectedCallback() {
|
|
2625
|
+
super.disconnectedCallback();
|
|
2626
|
+
this.removeEventListeners();
|
|
2627
|
+
}
|
|
2628
|
+
calculateActionWidths() {
|
|
2629
|
+
this.leftActionsWidth = this.leftActions ? this.leftActions.offsetWidth : 0;
|
|
2630
|
+
this.rightActionsWidth = this.rightActions ? this.rightActions.offsetWidth : 0;
|
|
2631
|
+
}
|
|
2632
|
+
addEventListeners() {
|
|
2633
|
+
this.sliderElement.addEventListener("mousedown", this.onDragStart);
|
|
2634
|
+
this.sliderElement.addEventListener("touchstart", this.onTouchStart, { passive: false });
|
|
2635
|
+
document.addEventListener("mousemove", this.onDragMove);
|
|
2636
|
+
document.addEventListener("touchmove", this.onTouchMove, { passive: false });
|
|
2637
|
+
document.addEventListener("mouseup", this.onDragEnd);
|
|
2638
|
+
document.addEventListener("touchend", this.onTouchEnd);
|
|
2639
|
+
}
|
|
2640
|
+
removeEventListeners() {
|
|
2641
|
+
this.sliderElement.removeEventListener("mousedown", this.onDragStart);
|
|
2642
|
+
this.sliderElement.removeEventListener("touchstart", this.onTouchStart);
|
|
2643
|
+
document.removeEventListener("mousemove", this.onDragMove);
|
|
2644
|
+
document.removeEventListener("touchmove", this.onTouchMove);
|
|
2645
|
+
document.removeEventListener("mouseup", this.onDragEnd);
|
|
2646
|
+
document.removeEventListener("touchend", this.onTouchEnd);
|
|
2647
|
+
}
|
|
2648
|
+
handleMove(currentX) {
|
|
2649
|
+
const currentTime = Date.now();
|
|
2650
|
+
const timeDiff = currentTime - this._lastTime;
|
|
2651
|
+
if (timeDiff > 0) {
|
|
2652
|
+
this._velocity = (currentX - this._lastX) / timeDiff;
|
|
2653
|
+
this._lastX = currentX;
|
|
2654
|
+
this._lastTime = currentTime;
|
|
2655
|
+
}
|
|
2656
|
+
const diff = currentX - this._startX;
|
|
2657
|
+
let newTranslate = this._prevTranslate + diff;
|
|
2658
|
+
if (newTranslate > this.leftActionsWidth) {
|
|
2659
|
+
const overshoot = newTranslate - this.leftActionsWidth;
|
|
2660
|
+
newTranslate = this.leftActionsWidth + this.easeOut(overshoot, 30);
|
|
2661
|
+
} else if (newTranslate < -this.rightActionsWidth) {
|
|
2662
|
+
const overshoot = newTranslate + this.rightActionsWidth;
|
|
2663
|
+
newTranslate = -this.rightActionsWidth + this.easeOut(overshoot, 30);
|
|
2664
|
+
}
|
|
2665
|
+
this._currentTranslate = newTranslate;
|
|
2666
|
+
this.updateSliderPosition();
|
|
2667
|
+
}
|
|
2668
|
+
// 弹性效果函数,使超出边界时有缓冲效果
|
|
2669
|
+
easeOut(overshoot, maxResistance) {
|
|
2670
|
+
return overshoot * 0.2;
|
|
2671
|
+
}
|
|
2672
|
+
finishDrag() {
|
|
2673
|
+
this._isDragging = false;
|
|
2674
|
+
this.sliderElement.style.transition = "transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94)";
|
|
2675
|
+
const threshold = 5;
|
|
2676
|
+
const velocityThreshold = 0.1;
|
|
2677
|
+
let targetTranslate = 0;
|
|
2678
|
+
if (this._currentTranslate > threshold || this._currentTranslate > 0 && this._velocity > velocityThreshold) {
|
|
2679
|
+
targetTranslate = this.leftActionsWidth;
|
|
2680
|
+
} else if (this._currentTranslate < -threshold || this._currentTranslate < 0 && this._velocity < -velocityThreshold) {
|
|
2681
|
+
targetTranslate = -this.rightActionsWidth;
|
|
2682
|
+
} else {
|
|
2683
|
+
targetTranslate = 0;
|
|
2684
|
+
}
|
|
2685
|
+
if (this._isOpen) {
|
|
2686
|
+
const closeThreshold = 5;
|
|
2687
|
+
if (this._prevTranslate > 0 && this._currentTranslate < this._prevTranslate - closeThreshold || this._prevTranslate < 0 && this._currentTranslate > this._prevTranslate + closeThreshold) {
|
|
2688
|
+
targetTranslate = 0;
|
|
2689
|
+
} else {
|
|
2690
|
+
targetTranslate = this._prevTranslate;
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
this._currentTranslate = targetTranslate;
|
|
2694
|
+
this._prevTranslate = targetTranslate;
|
|
2695
|
+
this.updateSliderPosition();
|
|
2696
|
+
this._velocity = 0;
|
|
2697
|
+
}
|
|
2698
|
+
updateSliderPosition() {
|
|
2699
|
+
if (this._animationId) {
|
|
2700
|
+
cancelAnimationFrame(this._animationId);
|
|
2701
|
+
}
|
|
2702
|
+
this._animationId = requestAnimationFrame(() => {
|
|
2703
|
+
this.sliderElement.style.transform = `translateX(${this._currentTranslate}px)`;
|
|
2704
|
+
if (this._currentTranslate > 0) {
|
|
2705
|
+
const leftProgress = Math.min(this._currentTranslate / this.leftActionsWidth, 1);
|
|
2706
|
+
this.leftActions.style.transform = `translateX(${-100 + leftProgress * 100}%)`;
|
|
2707
|
+
this.rightActions.style.transform = "translateX(100%)";
|
|
2708
|
+
} else if (this._currentTranslate < 0) {
|
|
2709
|
+
const rightProgress = Math.min(-this._currentTranslate / this.rightActionsWidth, 1);
|
|
2710
|
+
this.rightActions.style.transform = `translateX(${100 - rightProgress * 100}%)`;
|
|
2711
|
+
this.leftActions.style.transform = "translateX(-100%)";
|
|
2712
|
+
} else {
|
|
2713
|
+
this.leftActions.style.transform = "translateX(-100%)";
|
|
2714
|
+
this.rightActions.style.transform = "translateX(100%)";
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
}
|
|
2718
|
+
render() {
|
|
2719
|
+
return x`
|
|
2720
|
+
<div class="swipe-container">
|
|
2721
|
+
<div class="actions left-actions">
|
|
2722
|
+
<slot name="left-actions"> </slot>
|
|
2723
|
+
</div>
|
|
2724
|
+
<div class="slider">
|
|
2725
|
+
<slot name="content" class="content">
|
|
2726
|
+
<hm-cell></hm-cell>
|
|
2727
|
+
</slot>
|
|
2728
|
+
</div>
|
|
2729
|
+
<div class="actions right-actions">
|
|
2730
|
+
<slot name="right-actions">
|
|
2731
|
+
<hm-button type="primary" @hm-button-click="${this.rightButtonCallback}"
|
|
2732
|
+
>${this.rightButtonName}</hm-button
|
|
2733
|
+
>
|
|
2734
|
+
</slot>
|
|
2735
|
+
</div>
|
|
2736
|
+
</div>
|
|
2737
|
+
`;
|
|
2738
|
+
}
|
|
2739
|
+
};
|
|
2740
|
+
HmSwipeCell.styles = i$4`
|
|
2741
|
+
:host {
|
|
2742
|
+
display: block;
|
|
2743
|
+
overflow: hidden;
|
|
2744
|
+
position: relative;
|
|
2745
|
+
user-select: none;
|
|
2746
|
+
touch-action: pan-y;
|
|
2747
|
+
height: 60px;
|
|
2748
|
+
background: #f9f9f9;
|
|
2749
|
+
border-radius: 8px;
|
|
2750
|
+
margin: 10px 0;
|
|
2751
|
+
}
|
|
2752
|
+
.swipe-container {
|
|
2753
|
+
position: relative;
|
|
2754
|
+
width: 100%;
|
|
2755
|
+
height: 100%;
|
|
2756
|
+
background: white;
|
|
2757
|
+
border-radius: 8px;
|
|
2758
|
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
|
2759
|
+
overflow: hidden;
|
|
2760
|
+
}
|
|
2761
|
+
|
|
2762
|
+
.slider {
|
|
2763
|
+
position: relative;
|
|
2764
|
+
width: 100%;
|
|
2765
|
+
height: 100%;
|
|
2766
|
+
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
2767
|
+
will-change: transform;
|
|
2768
|
+
z-index: 2;
|
|
2769
|
+
background: white;
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
.content {
|
|
2773
|
+
display: flex;
|
|
2774
|
+
align-items: center;
|
|
2775
|
+
justify-content: space-between;
|
|
2776
|
+
padding: 0 15px;
|
|
2777
|
+
height: 100%;
|
|
2778
|
+
width: 100%;
|
|
2779
|
+
position: relative; // 改为相对定位
|
|
2780
|
+
top: 0;
|
|
2781
|
+
left: 0;
|
|
2782
|
+
background: white;
|
|
2783
|
+
box-sizing: border-box;
|
|
2784
|
+
border-radius: 8px;
|
|
2785
|
+
}
|
|
2786
|
+
|
|
2787
|
+
.actions {
|
|
2788
|
+
position: absolute;
|
|
2789
|
+
top: 0;
|
|
2790
|
+
bottom: 0;
|
|
2791
|
+
display: flex;
|
|
2792
|
+
align-items: center;
|
|
2793
|
+
z-index: 1;
|
|
2794
|
+
transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
.left-actions {
|
|
2798
|
+
left: 0;
|
|
2799
|
+
padding-left: 10px;
|
|
2800
|
+
transform: translateX(-100%);
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
.right-actions {
|
|
2804
|
+
right: 0;
|
|
2805
|
+
padding-right: 10px;
|
|
2806
|
+
transform: translateX(100%);
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
.action-btn {
|
|
2810
|
+
height: 44px;
|
|
2811
|
+
border: none;
|
|
2812
|
+
color: white;
|
|
2813
|
+
padding: 0 20px;
|
|
2814
|
+
cursor: pointer;
|
|
2815
|
+
font-size: 14px;
|
|
2816
|
+
display: flex;
|
|
2817
|
+
align-items: center;
|
|
2818
|
+
justify-content: center;
|
|
2819
|
+
transition: all 0.2s ease;
|
|
2820
|
+
border-radius: 6px;
|
|
2821
|
+
margin: 0 4px;
|
|
2822
|
+
min-width: 80px;
|
|
2823
|
+
font-weight: 500;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
.action-btn:hover {
|
|
2827
|
+
transform: scale(1.05);
|
|
2828
|
+
filter: brightness(1.1);
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
.action-btn:active {
|
|
2832
|
+
transform: scale(0.95);
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
.action-btn.favorite {
|
|
2836
|
+
background: linear-gradient(135deg, #2196F3, #1976D2);
|
|
2837
|
+
}
|
|
2838
|
+
|
|
2839
|
+
.action-btn.delete {
|
|
2840
|
+
background: linear-gradient(135deg, #f44336, #d32f2f);
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
.action-btn.mark {
|
|
2844
|
+
background: linear-gradient(135deg, #FF9800, #F57C00);
|
|
2845
|
+
}
|
|
2846
|
+
|
|
2847
|
+
.action-btn.archive {
|
|
2848
|
+
background: linear-gradient(135deg, #9C27B0, #7B1FA2);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
.action-btn.share {
|
|
2852
|
+
background: linear-gradient(135deg, #4CAF50, #388E3C);
|
|
2853
|
+
}
|
|
2854
|
+
|
|
2855
|
+
.action-btn.edit {
|
|
2856
|
+
background: linear-gradient(135deg, #607D8B, #455A64);
|
|
2857
|
+
}
|
|
2858
|
+
.contentslot{
|
|
2859
|
+
width: 100%;
|
|
2860
|
+
}
|
|
2861
|
+
`;
|
|
2862
|
+
__decorateClass$5([
|
|
2863
|
+
n2()
|
|
2864
|
+
], HmSwipeCell.prototype, "_isDragging", 2);
|
|
2865
|
+
__decorateClass$5([
|
|
2866
|
+
n2()
|
|
2867
|
+
], HmSwipeCell.prototype, "_startX", 2);
|
|
2868
|
+
__decorateClass$5([
|
|
2869
|
+
n2()
|
|
2870
|
+
], HmSwipeCell.prototype, "_currentTranslate", 2);
|
|
2871
|
+
__decorateClass$5([
|
|
2872
|
+
n2()
|
|
2873
|
+
], HmSwipeCell.prototype, "_prevTranslate", 2);
|
|
2874
|
+
__decorateClass$5([
|
|
2875
|
+
n2()
|
|
2876
|
+
], HmSwipeCell.prototype, "_animationId", 2);
|
|
2877
|
+
__decorateClass$5([
|
|
2878
|
+
n2()
|
|
2879
|
+
], HmSwipeCell.prototype, "_velocity", 2);
|
|
2880
|
+
__decorateClass$5([
|
|
2881
|
+
n2()
|
|
2882
|
+
], HmSwipeCell.prototype, "_lastX", 2);
|
|
2883
|
+
__decorateClass$5([
|
|
2884
|
+
n2()
|
|
2885
|
+
], HmSwipeCell.prototype, "_lastTime", 2);
|
|
2886
|
+
__decorateClass$5([
|
|
2887
|
+
n2()
|
|
2888
|
+
], HmSwipeCell.prototype, "_isOpen", 2);
|
|
2889
|
+
__decorateClass$5([
|
|
2890
|
+
n2()
|
|
2891
|
+
], HmSwipeCell.prototype, "rightButtonName", 2);
|
|
2892
|
+
__decorateClass$5([
|
|
2893
|
+
n2()
|
|
2894
|
+
], HmSwipeCell.prototype, "rightButtonCallback", 2);
|
|
2895
|
+
__decorateClass$5([
|
|
2896
|
+
e$2(".slider")
|
|
2897
|
+
], HmSwipeCell.prototype, "sliderElement", 2);
|
|
2898
|
+
__decorateClass$5([
|
|
2899
|
+
e$2(".content")
|
|
2900
|
+
], HmSwipeCell.prototype, "contentElement", 2);
|
|
2901
|
+
__decorateClass$5([
|
|
2902
|
+
e$2(".left-actions")
|
|
2903
|
+
], HmSwipeCell.prototype, "leftActions", 2);
|
|
2904
|
+
__decorateClass$5([
|
|
2905
|
+
e$2(".right-actions")
|
|
2906
|
+
], HmSwipeCell.prototype, "rightActions", 2);
|
|
2907
|
+
HmSwipeCell = __decorateClass$5([
|
|
2908
|
+
t$2("hm-swipe-cell")
|
|
2909
|
+
], HmSwipeCell);
|
|
2910
|
+
const hmSwipeCell = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2911
|
+
__proto__: null,
|
|
2912
|
+
get HmSwipeCell() {
|
|
2913
|
+
return HmSwipeCell;
|
|
2914
|
+
}
|
|
2915
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
2916
|
+
var __defProp$4 = Object.defineProperty;
|
|
2917
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
2918
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
2919
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
2920
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
2921
|
+
if (decorator = decorators[i3])
|
|
2922
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
2923
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
2924
|
+
return result;
|
|
2925
|
+
};
|
|
2926
|
+
let HmSwitch = class extends i$1 {
|
|
2927
|
+
constructor() {
|
|
2928
|
+
super(...arguments);
|
|
2929
|
+
this.checked = false;
|
|
2930
|
+
this.disabled = false;
|
|
2931
|
+
this.loading = false;
|
|
2932
|
+
this.color = "#1890ff";
|
|
2933
|
+
this.openContent = "";
|
|
2934
|
+
this.closeContent = "";
|
|
2935
|
+
this.openIcon = "";
|
|
2936
|
+
this.closeIcon = "";
|
|
2937
|
+
}
|
|
2938
|
+
change() {
|
|
2939
|
+
if (this.disabled || this.loading) return;
|
|
2940
|
+
this.checked = !this.checked;
|
|
2941
|
+
this.dispatchEvent(new CustomEvent("hm-switch-change", {
|
|
2942
|
+
detail: { checked: this.checked },
|
|
2943
|
+
bubbles: true,
|
|
2944
|
+
composed: true
|
|
2945
|
+
}));
|
|
2946
|
+
}
|
|
2947
|
+
render() {
|
|
2948
|
+
return x`
|
|
2949
|
+
<div
|
|
2950
|
+
class="switch ${this.disabled ? "disabled" : ""} ${this.loading ? "loading" : ""} ${this.checked ? "checked" : ""}"
|
|
2951
|
+
@click="${this.change}"
|
|
2952
|
+
@touchstart="${this.change}"
|
|
2953
|
+
style="--switch-color: ${this.color}"
|
|
2954
|
+
>
|
|
2955
|
+
<div class="switch-inner">
|
|
2956
|
+
${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>` : ""}
|
|
2957
|
+
</div>
|
|
2958
|
+
</div>
|
|
2959
|
+
`;
|
|
2960
|
+
}
|
|
2961
|
+
};
|
|
2962
|
+
HmSwitch.styles = i$4`
|
|
2963
|
+
.switch {
|
|
2964
|
+
position: relative;
|
|
2965
|
+
display: inline-block;
|
|
2966
|
+
width: 44px;
|
|
2967
|
+
height: 22px;
|
|
2968
|
+
vertical-align: middle;
|
|
2969
|
+
border: 1px solid #ccc;
|
|
2970
|
+
border-radius: 20px;
|
|
2971
|
+
background-color: #ccc;
|
|
2972
|
+
cursor: pointer;
|
|
2973
|
+
transition: all 0.3s;
|
|
2974
|
+
user-select: none;
|
|
2975
|
+
}
|
|
2976
|
+
|
|
2977
|
+
.switch.checked {
|
|
2978
|
+
background-color: var(--switch-color, #1890ff);
|
|
2979
|
+
border-color: var(--switch-color, #1890ff);
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2982
|
+
.switch.disabled {
|
|
2983
|
+
cursor: not-allowed;
|
|
2984
|
+
opacity: 0.6;
|
|
2985
|
+
}
|
|
2986
|
+
|
|
2987
|
+
.switch.loading {
|
|
2988
|
+
cursor: wait;
|
|
2989
|
+
opacity: 0.6;
|
|
2990
|
+
}
|
|
2991
|
+
|
|
2992
|
+
.switch-inner {
|
|
2993
|
+
position: absolute;
|
|
2994
|
+
top: 2px;
|
|
2995
|
+
left: 2px;
|
|
2996
|
+
width: 18px;
|
|
2997
|
+
height: 18px;
|
|
2998
|
+
background-color: #fff;
|
|
2999
|
+
border-radius: 50%;
|
|
3000
|
+
transition: all 0.3s;
|
|
3001
|
+
display: flex;
|
|
3002
|
+
align-items: center;
|
|
3003
|
+
justify-content: center;
|
|
3004
|
+
font-size: 12px;
|
|
3005
|
+
}
|
|
3006
|
+
|
|
3007
|
+
.switch.checked .switch-inner {
|
|
3008
|
+
left: calc(100% - 20px);
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
.switch.loading::after {
|
|
3012
|
+
content: '';
|
|
3013
|
+
position: absolute;
|
|
3014
|
+
top: 50%;
|
|
3015
|
+
left: 50%;
|
|
3016
|
+
width: 12px;
|
|
3017
|
+
height: 12px;
|
|
3018
|
+
margin-top: -6px;
|
|
3019
|
+
margin-left: -6px;
|
|
3020
|
+
border: 2px solid transparent;
|
|
3021
|
+
border-top-color: currentColor;
|
|
3022
|
+
border-radius: 50%;
|
|
3023
|
+
animation: rotate 1s linear infinite;
|
|
3024
|
+
}
|
|
3025
|
+
|
|
3026
|
+
@keyframes rotate {
|
|
3027
|
+
from {
|
|
3028
|
+
transform: rotate(0deg);
|
|
3029
|
+
}
|
|
3030
|
+
to {
|
|
3031
|
+
transform: rotate(360deg);
|
|
3032
|
+
}
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
hm-icon {
|
|
3036
|
+
font-size: 12px;
|
|
3037
|
+
width: 12px;
|
|
3038
|
+
height: 12px;
|
|
3039
|
+
display: flex;
|
|
3040
|
+
align-items: center;
|
|
3041
|
+
justify-content: center;
|
|
3042
|
+
}
|
|
3043
|
+
`;
|
|
3044
|
+
__decorateClass$4([
|
|
3045
|
+
n2({ type: Boolean })
|
|
3046
|
+
], HmSwitch.prototype, "checked", 2);
|
|
3047
|
+
__decorateClass$4([
|
|
3048
|
+
n2({ type: Boolean })
|
|
3049
|
+
], HmSwitch.prototype, "disabled", 2);
|
|
3050
|
+
__decorateClass$4([
|
|
3051
|
+
n2({ type: Boolean })
|
|
3052
|
+
], HmSwitch.prototype, "loading", 2);
|
|
3053
|
+
__decorateClass$4([
|
|
3054
|
+
n2({ type: String })
|
|
3055
|
+
], HmSwitch.prototype, "color", 2);
|
|
3056
|
+
__decorateClass$4([
|
|
3057
|
+
n2({ type: String })
|
|
3058
|
+
], HmSwitch.prototype, "openContent", 2);
|
|
3059
|
+
__decorateClass$4([
|
|
3060
|
+
n2({ type: String })
|
|
3061
|
+
], HmSwitch.prototype, "closeContent", 2);
|
|
3062
|
+
__decorateClass$4([
|
|
3063
|
+
n2({ type: String })
|
|
3064
|
+
], HmSwitch.prototype, "openIcon", 2);
|
|
3065
|
+
__decorateClass$4([
|
|
3066
|
+
n2({ type: String })
|
|
3067
|
+
], HmSwitch.prototype, "closeIcon", 2);
|
|
3068
|
+
HmSwitch = __decorateClass$4([
|
|
3069
|
+
t$2("hm-switch")
|
|
3070
|
+
], HmSwitch);
|
|
3071
|
+
const hmSwitch = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3072
|
+
__proto__: null,
|
|
3073
|
+
get HmSwitch() {
|
|
3074
|
+
return HmSwitch;
|
|
3075
|
+
}
|
|
3076
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3077
|
+
var __defProp$3 = Object.defineProperty;
|
|
3078
|
+
var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
|
|
3079
|
+
var __decorateClass$3 = (decorators, target, key, kind) => {
|
|
3080
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
|
|
3081
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
3082
|
+
if (decorator = decorators[i3])
|
|
3083
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3084
|
+
if (kind && result) __defProp$3(target, key, result);
|
|
3085
|
+
return result;
|
|
3086
|
+
};
|
|
3087
|
+
let HmAccordion = class extends i$1 {
|
|
3088
|
+
constructor() {
|
|
3089
|
+
super(...arguments);
|
|
3090
|
+
this.maxHeight = "500px";
|
|
3091
|
+
this.items = [];
|
|
3092
|
+
this.expanded = false;
|
|
3093
|
+
}
|
|
3094
|
+
/** 开关容器 */
|
|
3095
|
+
togglePanel() {
|
|
3096
|
+
this.expanded = !this.expanded;
|
|
3097
|
+
}
|
|
3098
|
+
render() {
|
|
3099
|
+
return x`
|
|
3100
|
+
<div class="accordion-container" style="max-height: ${this.maxHeight}">
|
|
3101
|
+
<div class="accordion-header" @click=${this.togglePanel}>
|
|
3102
|
+
<slot name="header">面板标题</slot>
|
|
3103
|
+
<div class="accordion-toggle">
|
|
3104
|
+
${!this.expanded ? x`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
|
|
3105
|
+
<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"/>
|
|
3106
|
+
</svg>` : 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 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"/>
|
|
3108
|
+
</svg>`}
|
|
3109
|
+
</div>
|
|
3110
|
+
</div>
|
|
3111
|
+
|
|
3112
|
+
<div class="accordion-content" ?hidden=${!this.expanded}>
|
|
3113
|
+
${this.items.length > 0 ? this.items.map(
|
|
3114
|
+
(item) => x`<div class="accordion-item">${item}</div>`
|
|
3115
|
+
) : x`<slot></slot>`}
|
|
3116
|
+
</div>
|
|
3117
|
+
|
|
3118
|
+
<div class="accordion-footer" ?hidden=${!this.expanded}>
|
|
3119
|
+
<slot name="footer">
|
|
3120
|
+
<hm-button @hm-button-click="${() => {
|
|
3121
|
+
this.expanded = false;
|
|
3122
|
+
}}">关闭</hm-button>
|
|
3123
|
+
</slot>
|
|
3124
|
+
</div>
|
|
3125
|
+
</div>
|
|
3126
|
+
`;
|
|
3127
|
+
}
|
|
3128
|
+
};
|
|
3129
|
+
HmAccordion.styles = i$4`
|
|
3130
|
+
:host {
|
|
3131
|
+
display: block;
|
|
3132
|
+
width: 100%;
|
|
3133
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
3134
|
+
}
|
|
3135
|
+
|
|
3136
|
+
.accordion-container {
|
|
3137
|
+
display: flex;
|
|
3138
|
+
flex-direction: column;
|
|
3139
|
+
border-radius: 8px;
|
|
3140
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
3141
|
+
background-color: white;
|
|
3142
|
+
overflow: hidden;
|
|
3143
|
+
transition: all 0.3s ease;
|
|
3144
|
+
}
|
|
3145
|
+
|
|
3146
|
+
.accordion-header {
|
|
3147
|
+
padding: 16px 20px;
|
|
3148
|
+
background-color: #f8f9fa;
|
|
3149
|
+
border-bottom: 1px solid #e9ecef;
|
|
3150
|
+
font-size: 1.25rem;
|
|
3151
|
+
font-weight: 600;
|
|
3152
|
+
color: #212529;
|
|
3153
|
+
display: flex;
|
|
3154
|
+
justify-content: space-between;
|
|
3155
|
+
align-items: center;
|
|
3156
|
+
cursor: pointer;
|
|
3157
|
+
transition: background-color 0.2s;
|
|
3158
|
+
}
|
|
3159
|
+
|
|
3160
|
+
.accordion-header:hover {
|
|
3161
|
+
background-color: #e9ecef;
|
|
3162
|
+
}
|
|
3163
|
+
|
|
3164
|
+
.accordion-toggle {
|
|
3165
|
+
transition: transform 0.3s ease;
|
|
3166
|
+
width: 24px;
|
|
3167
|
+
height: 24px;
|
|
3168
|
+
display: flex;
|
|
3169
|
+
align-items: center;
|
|
3170
|
+
justify-content: center;
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
.accordion-content {
|
|
3174
|
+
flex: 1;
|
|
3175
|
+
overflow-y: auto;
|
|
3176
|
+
padding: 0;
|
|
3177
|
+
background-color: #ffffff;
|
|
3178
|
+
transition: max-height 0.3s ease, opacity 0.3s ease;
|
|
3179
|
+
}
|
|
3180
|
+
|
|
3181
|
+
.accordion-footer {
|
|
3182
|
+
padding: 12px 20px;
|
|
3183
|
+
background-color: #f8f9fa;
|
|
3184
|
+
border-top: 1px solid #e9ecef;
|
|
3185
|
+
display: flex;
|
|
3186
|
+
justify-content: flex-end;
|
|
3187
|
+
gap: 10px;
|
|
3188
|
+
}
|
|
3189
|
+
|
|
3190
|
+
.accordion-item {
|
|
3191
|
+
padding: 12px 20px;
|
|
3192
|
+
border-bottom: 1px solid #e9ecef;
|
|
3193
|
+
transition: background-color 0.2s;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
.accordion-item:last-child {
|
|
3197
|
+
border-bottom: none;
|
|
3198
|
+
}
|
|
3199
|
+
|
|
3200
|
+
.accordion-item:hover {
|
|
3201
|
+
background-color: #f8f9fa;
|
|
3202
|
+
}
|
|
3203
|
+
`;
|
|
3204
|
+
__decorateClass$3([
|
|
3205
|
+
n2({ type: String, attribute: "max-height" })
|
|
3206
|
+
], HmAccordion.prototype, "maxHeight", 2);
|
|
3207
|
+
__decorateClass$3([
|
|
3208
|
+
n2({ type: Array })
|
|
3209
|
+
], HmAccordion.prototype, "items", 2);
|
|
3210
|
+
__decorateClass$3([
|
|
3211
|
+
n2({ type: Boolean })
|
|
3212
|
+
], HmAccordion.prototype, "expanded", 2);
|
|
3213
|
+
HmAccordion = __decorateClass$3([
|
|
3214
|
+
t$2("hm-accordion")
|
|
3215
|
+
], HmAccordion);
|
|
3216
|
+
const hmAccordion = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3217
|
+
__proto__: null,
|
|
3218
|
+
get HmAccordion() {
|
|
3219
|
+
return HmAccordion;
|
|
3220
|
+
}
|
|
3221
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3222
|
+
var __defProp$2 = Object.defineProperty;
|
|
3223
|
+
var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
|
|
3224
|
+
var __decorateClass$2 = (decorators, target, key, kind) => {
|
|
3225
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
|
|
3226
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
3227
|
+
if (decorator = decorators[i3])
|
|
3228
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3229
|
+
if (kind && result) __defProp$2(target, key, result);
|
|
3230
|
+
return result;
|
|
3231
|
+
};
|
|
3232
|
+
let HmInput = class extends i$1 {
|
|
3233
|
+
constructor() {
|
|
3234
|
+
super(...arguments);
|
|
3235
|
+
this.type = "text";
|
|
3236
|
+
this.icon = "";
|
|
3237
|
+
this.label = "输入框";
|
|
3238
|
+
this.placeholder = "";
|
|
3239
|
+
this.enable = true;
|
|
3240
|
+
this.readonly = false;
|
|
3241
|
+
this.value = "";
|
|
3242
|
+
}
|
|
3243
|
+
// 添加键盘事件处理方法,阻止事件冒泡
|
|
3244
|
+
_handleKeyDown(e2) {
|
|
3245
|
+
e2.stopPropagation();
|
|
3246
|
+
}
|
|
3247
|
+
// 添加输入事件处理方法,触发自定义事件
|
|
3248
|
+
_handleInput(e2) {
|
|
3249
|
+
const target = e2.target;
|
|
3250
|
+
this.value = target.value;
|
|
3251
|
+
this.dispatchEvent(new CustomEvent("hm-input-change", {
|
|
3252
|
+
detail: { value: this.value },
|
|
3253
|
+
bubbles: true,
|
|
3254
|
+
composed: true
|
|
3255
|
+
}));
|
|
3256
|
+
}
|
|
3257
|
+
render() {
|
|
3258
|
+
return x`
|
|
3259
|
+
<div class="input-container">
|
|
3260
|
+
<span class="label">${this.label}</span>
|
|
3261
|
+
${this.icon ? x`<hm-icon icon="${this.icon}" class="icon"></hm-icon>` : ""}
|
|
3262
|
+
<input
|
|
3263
|
+
type="${this.type}"
|
|
3264
|
+
value="${this.value}"
|
|
3265
|
+
?disabled="${!this.enable}"
|
|
3266
|
+
?readonly="${this.readonly}"
|
|
3267
|
+
placeholder="${this.placeholder}"
|
|
3268
|
+
style="padding-left: ${this.icon ? "24px" : "8px"};"
|
|
3269
|
+
@keydown="${this._handleKeyDown}"
|
|
3270
|
+
@input="${this._handleInput}"
|
|
3271
|
+
/>
|
|
3272
|
+
<slot name="right">
|
|
3273
|
+
</slot>
|
|
3274
|
+
</div>
|
|
3275
|
+
`;
|
|
3276
|
+
}
|
|
3277
|
+
};
|
|
3278
|
+
HmInput.styles = i$4`
|
|
3279
|
+
:host {
|
|
3280
|
+
display: block;
|
|
3281
|
+
}
|
|
3282
|
+
.input-container {
|
|
3283
|
+
display: flex;
|
|
3284
|
+
align-items: center;
|
|
3285
|
+
}
|
|
3286
|
+
.label {
|
|
3287
|
+
margin-right: 8px;
|
|
3288
|
+
}
|
|
3289
|
+
input {
|
|
3290
|
+
flex: 1;
|
|
3291
|
+
padding: 8px 12px;
|
|
3292
|
+
border: 1px solid #d9d9d9;
|
|
3293
|
+
border-radius: 4px;
|
|
3294
|
+
font-size: 14px;
|
|
3295
|
+
outline: none;
|
|
3296
|
+
transition: all 0.2s ease;
|
|
3297
|
+
}
|
|
3298
|
+
input:disabled {
|
|
3299
|
+
background-color: #f5f5f5;
|
|
3300
|
+
color: #999;
|
|
3301
|
+
border-color: #ddd;
|
|
3302
|
+
cursor: not-allowed;
|
|
3303
|
+
}
|
|
3304
|
+
input[readonly] {
|
|
3305
|
+
background-color: #f5f5f5;
|
|
3306
|
+
cursor: default;
|
|
3307
|
+
}
|
|
3308
|
+
.icon {
|
|
3309
|
+
margin-right: 8px;
|
|
3310
|
+
width: 16px;
|
|
3311
|
+
height: 16px;
|
|
3312
|
+
}
|
|
3313
|
+
`;
|
|
3314
|
+
__decorateClass$2([
|
|
3315
|
+
n2({ type: String })
|
|
3316
|
+
], HmInput.prototype, "type", 2);
|
|
3317
|
+
__decorateClass$2([
|
|
3318
|
+
n2({ type: String })
|
|
3319
|
+
], HmInput.prototype, "icon", 2);
|
|
3320
|
+
__decorateClass$2([
|
|
3321
|
+
n2({ type: String })
|
|
3322
|
+
], HmInput.prototype, "label", 2);
|
|
3323
|
+
__decorateClass$2([
|
|
3324
|
+
n2({ type: String })
|
|
3325
|
+
], HmInput.prototype, "placeholder", 2);
|
|
3326
|
+
__decorateClass$2([
|
|
3327
|
+
n2({ type: Boolean })
|
|
3328
|
+
], HmInput.prototype, "enable", 2);
|
|
3329
|
+
__decorateClass$2([
|
|
3330
|
+
n2({ type: Boolean })
|
|
3331
|
+
], HmInput.prototype, "readonly", 2);
|
|
3332
|
+
__decorateClass$2([
|
|
3333
|
+
n2()
|
|
3334
|
+
], HmInput.prototype, "value", 2);
|
|
3335
|
+
HmInput = __decorateClass$2([
|
|
3336
|
+
t$2("hm-input")
|
|
3337
|
+
], HmInput);
|
|
3338
|
+
const hmInput = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3339
|
+
__proto__: null,
|
|
3340
|
+
get HmInput() {
|
|
3341
|
+
return HmInput;
|
|
3342
|
+
}
|
|
3343
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3344
|
+
var __defProp$1 = Object.defineProperty;
|
|
3345
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
3346
|
+
var __decorateClass$1 = (decorators, target, key, kind) => {
|
|
3347
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
|
|
3348
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
3349
|
+
if (decorator = decorators[i3])
|
|
3350
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3351
|
+
if (kind && result) __defProp$1(target, key, result);
|
|
3352
|
+
return result;
|
|
3353
|
+
};
|
|
3354
|
+
let HmDialog = class extends i$1 {
|
|
3355
|
+
constructor() {
|
|
3356
|
+
super(...arguments);
|
|
3357
|
+
this.isOpen = false;
|
|
3358
|
+
this.dialog = this;
|
|
3359
|
+
}
|
|
3360
|
+
open() {
|
|
3361
|
+
this.isOpen = true;
|
|
3362
|
+
this.dispatchEvent(new CustomEvent("hm-dialog-open"));
|
|
3363
|
+
}
|
|
3364
|
+
close() {
|
|
3365
|
+
this.isOpen = false;
|
|
3366
|
+
this.dispatchEvent(new CustomEvent("hm-dialog-close"));
|
|
3367
|
+
}
|
|
3368
|
+
/** 确认,触发 dialog-close dialog-confirm事件*/
|
|
3369
|
+
confirm() {
|
|
3370
|
+
this.close();
|
|
3371
|
+
this.dispatchEvent(new CustomEvent("hm-dialog-confirm"));
|
|
3372
|
+
}
|
|
3373
|
+
/** 取消,触发 dialog-close dialog-cancel事件*/
|
|
3374
|
+
cancel() {
|
|
3375
|
+
this.close();
|
|
3376
|
+
this.dispatchEvent(new CustomEvent("hm-dialog-cancel"));
|
|
3377
|
+
}
|
|
3378
|
+
updated(changedProperties) {
|
|
3379
|
+
if (changedProperties.has("isOpen")) {
|
|
3380
|
+
if (this.isOpen) {
|
|
3381
|
+
this.style.display = "block";
|
|
3382
|
+
} else {
|
|
3383
|
+
this.style.display = "none";
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
}
|
|
3387
|
+
render() {
|
|
3388
|
+
return x`
|
|
3389
|
+
<div class="overlay"
|
|
3390
|
+
@click="${this.close}"
|
|
3391
|
+
></div>
|
|
3392
|
+
<div class="content">
|
|
3393
|
+
<slot></slot>
|
|
3394
|
+
<div class="footer">
|
|
3395
|
+
<slot name="footer">
|
|
3396
|
+
<hm-button @click="${() => {
|
|
3397
|
+
this.cancel();
|
|
3398
|
+
console.debug("取消");
|
|
3399
|
+
}}">取消</hm-button>
|
|
3400
|
+
<hm-button @click="${() => {
|
|
3401
|
+
this.confirm();
|
|
3402
|
+
console.debug("确定");
|
|
3403
|
+
}}">确定</hm-button>
|
|
3404
|
+
</slot>
|
|
3405
|
+
</div>
|
|
3406
|
+
</div>
|
|
3407
|
+
`;
|
|
3408
|
+
}
|
|
3409
|
+
};
|
|
3410
|
+
HmDialog.styles = i$4`
|
|
3411
|
+
:host {
|
|
3412
|
+
display: none;
|
|
3413
|
+
position: fixed;
|
|
3414
|
+
top: 0;
|
|
3415
|
+
left: 0;
|
|
3416
|
+
width: 100%;
|
|
3417
|
+
height: 100%;
|
|
3418
|
+
z-index: 1000;
|
|
3419
|
+
}
|
|
3420
|
+
:host([isopen]) {
|
|
3421
|
+
display: block;
|
|
3422
|
+
}
|
|
3423
|
+
.overlay {
|
|
3424
|
+
position: fixed;
|
|
3425
|
+
top: 0;
|
|
3426
|
+
left: 0;
|
|
3427
|
+
width: 100%;
|
|
3428
|
+
height: 100%;
|
|
3429
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3432
|
+
.content {
|
|
3433
|
+
position: absolute;
|
|
3434
|
+
top: 50%;
|
|
3435
|
+
left: 50%;
|
|
3436
|
+
transform: translate(-50%, -50%);
|
|
3437
|
+
background: white;
|
|
3438
|
+
border-radius: 4px;
|
|
3439
|
+
min-width: 300px;
|
|
3440
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
3441
|
+
padding: 20px;
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
.footer {
|
|
3445
|
+
display: flex;
|
|
3446
|
+
justify-content: flex-end;
|
|
3447
|
+
gap: 10px;
|
|
3448
|
+
margin-top: 20px;
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
hm-button {
|
|
3452
|
+
min-width: 80px;
|
|
3453
|
+
}
|
|
3454
|
+
`;
|
|
3455
|
+
__decorateClass$1([
|
|
3456
|
+
n2({ type: Boolean, attribute: "isopen" })
|
|
3457
|
+
], HmDialog.prototype, "isOpen", 2);
|
|
3458
|
+
HmDialog = __decorateClass$1([
|
|
3459
|
+
t$2("hm-dialog")
|
|
3460
|
+
], HmDialog);
|
|
3461
|
+
const hmDialog = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3462
|
+
__proto__: null,
|
|
3463
|
+
get HmDialog() {
|
|
3464
|
+
return HmDialog;
|
|
3465
|
+
}
|
|
3466
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3467
|
+
const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3468
|
+
__proto__: null,
|
|
3469
|
+
hm_accordion: hmAccordion,
|
|
3470
|
+
hm_button: hmButton,
|
|
3471
|
+
hm_cell: hmCell,
|
|
3472
|
+
hm_dialog: hmDialog,
|
|
3473
|
+
hm_icon: hmIcon,
|
|
3474
|
+
hm_input: hmInput,
|
|
3475
|
+
hm_menu: hmMenu,
|
|
3476
|
+
hm_move_panel: hmMovePanel,
|
|
3477
|
+
hm_notification: hmNotification,
|
|
3478
|
+
hm_swipe_cell: hmSwipeCell,
|
|
3479
|
+
hm_switch: hmSwitch
|
|
3480
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3481
|
+
let menuHolder = document.createElement("div");
|
|
3482
|
+
function initMenuHolder() {
|
|
3483
|
+
menuHolder.id = "hmMenuHolder";
|
|
3484
|
+
let img = document.querySelector("#functionHolderImg");
|
|
3485
|
+
console.debug(img);
|
|
3486
|
+
console.debug(menuHolder);
|
|
3487
|
+
if (img !== null) {
|
|
3488
|
+
img.parentElement.insertAdjacentElement("afterend", menuHolder);
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
const menu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3492
|
+
__proto__: null,
|
|
3493
|
+
initMenuHolder,
|
|
3494
|
+
menuHolder
|
|
3495
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3496
|
+
let movePanelHolder = document.createElement("div");
|
|
3497
|
+
function initMovePanelHolder() {
|
|
3498
|
+
movePanelHolder.id = "hmMovePanelHolder";
|
|
3499
|
+
document.body.append(movePanelHolder);
|
|
3500
|
+
}
|
|
3501
|
+
const movePanel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3502
|
+
__proto__: null,
|
|
3503
|
+
initMovePanelHolder,
|
|
3504
|
+
movePanelHolder
|
|
3505
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3506
|
+
let notificationHolder = document.createElement("div");
|
|
3507
|
+
function initNotificationHolder() {
|
|
3508
|
+
notificationHolder.id = "hmNotificationHolder";
|
|
3509
|
+
document.body.append(notificationHolder);
|
|
3510
|
+
}
|
|
3511
|
+
let notice = {
|
|
3512
|
+
success(title, content, displayTime = 2e3) {
|
|
3513
|
+
let notice2 = document.createElement("hm-notification");
|
|
3514
|
+
notice2.title = title;
|
|
3515
|
+
notice2.content = content;
|
|
3516
|
+
notice2.displayTime = displayTime;
|
|
3517
|
+
notice2.backgroundColor = "rgba(57, 231, 34, 0.7)";
|
|
3518
|
+
notice2.color = "rgb(255,255,255)";
|
|
3519
|
+
notificationHolder.append(notice2);
|
|
3520
|
+
},
|
|
3521
|
+
warning(title, content, displayTime = 2e3) {
|
|
3522
|
+
let notice2 = document.createElement("hm-notification");
|
|
3523
|
+
notice2.title = title;
|
|
3524
|
+
notice2.content = content;
|
|
3525
|
+
notice2.displayTime = displayTime;
|
|
3526
|
+
notice2.backgroundColor = "rgba(255,193,7,0.7)";
|
|
3527
|
+
notice2.color = "rgb(255,255,255)";
|
|
3528
|
+
notificationHolder.append(notice2);
|
|
3529
|
+
},
|
|
3530
|
+
error(title, content, displayTime = 2e3) {
|
|
3531
|
+
let notice2 = document.createElement("hm-notification");
|
|
3532
|
+
notice2.title = title;
|
|
3533
|
+
notice2.content = content;
|
|
3534
|
+
notice2.displayTime = displayTime;
|
|
3535
|
+
notice2.backgroundColor = "rgba(255,0,0,0.7)";
|
|
3536
|
+
notice2.color = "rgb(255,255,255)";
|
|
3537
|
+
notificationHolder.append(notice2);
|
|
3538
|
+
},
|
|
3539
|
+
normal(title, content, displayTime = 2e3) {
|
|
3540
|
+
let notice2 = document.createElement("hm-notification");
|
|
3541
|
+
notice2.title = title;
|
|
3542
|
+
notice2.content = content;
|
|
3543
|
+
notice2.displayTime = displayTime;
|
|
3544
|
+
notice2.backgroundColor = "rgba(33,33,33,0.7)";
|
|
3545
|
+
notice2.color = "rgb(255,255,255)";
|
|
3546
|
+
notificationHolder.append(notice2);
|
|
3547
|
+
}
|
|
3548
|
+
};
|
|
3549
|
+
const notification = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3550
|
+
__proto__: null,
|
|
3551
|
+
initNotificationHolder,
|
|
3552
|
+
notice,
|
|
3553
|
+
notificationHolder
|
|
3554
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3555
|
+
let dialogHolder = document.createElement("div");
|
|
3556
|
+
function initDialogHolder() {
|
|
3557
|
+
dialogHolder.id = "hmDialogHolder";
|
|
3558
|
+
document.body.append(dialogHolder);
|
|
3559
|
+
}
|
|
3560
|
+
const dialog = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3561
|
+
__proto__: null,
|
|
3562
|
+
dialogHolder,
|
|
3563
|
+
initDialogHolder
|
|
3564
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3565
|
+
async function initExampleApp() {
|
|
3566
|
+
let panel = document.createElement("hm-move-panel");
|
|
3567
|
+
panel.titleContent = "组件模板";
|
|
3568
|
+
panel.icon = "template";
|
|
3569
|
+
movePanelHolder.appendChild(panel);
|
|
3570
|
+
let template = x`
|
|
3571
|
+
|
|
3572
|
+
<h3>输入框</h3>
|
|
3573
|
+
基本使用
|
|
3574
|
+
<hm-input label="用户名" placeholder="请输入用户名"></hm-input>
|
|
3575
|
+
带图标的输入框
|
|
3576
|
+
<hm-input label="密码" icon="password" placeholder="请输入密码"></hm-input>
|
|
3577
|
+
禁用状态
|
|
3578
|
+
<hm-input label="禁用输入框" value="已禁用" enable="false"></hm-input>
|
|
3579
|
+
只读状态
|
|
3580
|
+
<hm-input label="只读输入框" value="只读内容" readonly="true"></hm-input>
|
|
3581
|
+
<h3>折叠面板</h3>
|
|
3582
|
+
<hm-accordion>
|
|
3583
|
+
<span slot="header">我的折叠面板</span>
|
|
3584
|
+
<div>内容项 1</div>
|
|
3585
|
+
<div>内容项 2</div>
|
|
3586
|
+
</hm-accordion>
|
|
3587
|
+
<h3>滑动开关</h3>
|
|
3588
|
+
<!-- 基础用法 -->
|
|
3589
|
+
<hm-switch></hm-switch>
|
|
3590
|
+
|
|
3591
|
+
<!-- 默认开启 -->
|
|
3592
|
+
<hm-switch checked></hm-switch>
|
|
3593
|
+
|
|
3594
|
+
<!-- 禁用状态 -->
|
|
3595
|
+
<hm-switch disabled></hm-switch>
|
|
3596
|
+
|
|
3597
|
+
<!-- 加载状态 -->
|
|
3598
|
+
<hm-switch loading></hm-switch>
|
|
3599
|
+
|
|
3600
|
+
<!-- 自定义颜色 -->
|
|
3601
|
+
<hm-switch color="#ff4757"></hm-switch>
|
|
3602
|
+
hc-s
|
|
3603
|
+
<!-- 带图标 -->
|
|
3604
|
+
<hm-switch openIcon="check" closeIcon="close"></hm-switch>
|
|
3605
|
+
|
|
3606
|
+
<!-- 监听状态变化 -->
|
|
3607
|
+
<hm-switch
|
|
3608
|
+
|
|
3609
|
+
@hm-switch-change
|
|
3610
|
+
="${(e2) => console.log("开关状态:", e2.detail.checked)}"></hm-switch>
|
|
3611
|
+
<h3>滑动单元格</h3>
|
|
3612
|
+
<hm-swipe-cell>
|
|
3613
|
+
<!-- 主内容 -->
|
|
3614
|
+
<div slot="content">主内容</div>
|
|
3615
|
+
<!-- 左侧操作按钮 -->
|
|
3616
|
+
<div slot="left-actions">左侧操作</div>
|
|
3617
|
+
<!-- 右侧操作按钮 -->
|
|
3618
|
+
<div slot="right-actions">右侧操作</div>
|
|
3619
|
+
</hm-swipe-cell>
|
|
3620
|
+
<hm-swipe-cell>
|
|
3621
|
+
<!-- 主内容 -->
|
|
3622
|
+
<hm-cell
|
|
3623
|
+
slot="content"
|
|
3624
|
+
titleName="单元格标题"
|
|
3625
|
+
descripthion="这是描述信息"
|
|
3626
|
+
content="内容区域"
|
|
3627
|
+
>
|
|
3628
|
+
</hm-cell>
|
|
3629
|
+
<!-- 左侧操作按钮 -->
|
|
3630
|
+
<div slot="left-actions"><hm-button>删除</hm-button></div>
|
|
3631
|
+
<!-- 右侧操作按钮 -->
|
|
3632
|
+
<div slot="right-actions">
|
|
3633
|
+
<hm-button>修改</hm-button>
|
|
3634
|
+
<hm-button>运行</hm-button>
|
|
3635
|
+
</div>
|
|
3636
|
+
</hm-swipe-cell>
|
|
3637
|
+
|
|
3638
|
+
<h3>单元格</h3>
|
|
3639
|
+
<hm-cell>
|
|
3640
|
+
<hm-switch slot="content"></hm-switch>
|
|
3641
|
+
</hm-cell>
|
|
3642
|
+
<hm-cell titleName="单元格标题" descripthion="这是描述信息" content="内容区域">
|
|
3643
|
+
</hm-cell>
|
|
3644
|
+
<!-- 使用插槽自定义内容 -->
|
|
3645
|
+
<hm-cell>
|
|
3646
|
+
<div slot="title">自定义标题</div>
|
|
3647
|
+
<div slot="description">自定义描述</div>
|
|
3648
|
+
<div slot="content">自定义内容</div>
|
|
3649
|
+
</hm-cell>
|
|
3650
|
+
|
|
3651
|
+
<!-- 带点击事件 -->
|
|
3652
|
+
<hm-cell
|
|
3653
|
+
titleName="可点击标题"
|
|
3654
|
+
content="点击查看详情"
|
|
3655
|
+
.titleClickCallback="${() => console.log("标题被点击")}"
|
|
3656
|
+
.contentClickCallback="${() => console.log("内容被点击")}"
|
|
3657
|
+
>
|
|
3658
|
+
</hm-cell>
|
|
3659
|
+
|
|
3660
|
+
<!-- 自定义样式 -->
|
|
3661
|
+
<hm-cell
|
|
3662
|
+
titleName="自定义样式"
|
|
3663
|
+
content="特殊样式"
|
|
3664
|
+
style="--hm-cell-background: #f0f8ff; --hm-cell-title-color: #1890ff"
|
|
3665
|
+
>
|
|
3666
|
+
</hm-cell>
|
|
3667
|
+
<h3>通知</h3>
|
|
3668
|
+
<hm-button
|
|
3669
|
+
content="成功通知"
|
|
3670
|
+
@click="${() => notice.success("成功", "这是成功提示", 2e3)}"
|
|
3671
|
+
></hm-button>
|
|
3672
|
+
<hm-button
|
|
3673
|
+
content="普通通知"
|
|
3674
|
+
@click="${() => notice.normal("普通", "这是普通提示", 3e3)}"
|
|
3675
|
+
></hm-button>
|
|
3676
|
+
<hm-button
|
|
3677
|
+
content="警告通知"
|
|
3678
|
+
@click="${() => notice.warning("警告", "这是警告提示", 4e3)}"
|
|
3679
|
+
></hm-button>
|
|
3680
|
+
<hm-button
|
|
3681
|
+
content="错误通知"
|
|
3682
|
+
@click="${() => notice.error("错误", "这是错误提示", 5e3)}"
|
|
3683
|
+
></hm-button>
|
|
3684
|
+
<h3>按钮</h3>
|
|
3685
|
+
|
|
3686
|
+
<!-- 基础用法 -->
|
|
3687
|
+
<hm-button content="普通按钮"></hm-button>
|
|
3688
|
+
|
|
3689
|
+
<!-- 带图标按钮 -->
|
|
3690
|
+
<hm-button icon="plus" content="添加"></hm-button>
|
|
3691
|
+
|
|
3692
|
+
<!-- 自定义颜色 -->
|
|
3693
|
+
<hm-button content="自定义样式" color="#ffffff" background="#4caf50"></hm-button>
|
|
3694
|
+
</hm-button>
|
|
3695
|
+
|
|
3696
|
+
<!-- 禁用状态 -->
|
|
3697
|
+
<hm-button content="禁用按钮" .enable="${false}"></hm-button>
|
|
3698
|
+
|
|
3699
|
+
<!-- 加载状态 -->
|
|
3700
|
+
<hm-button content="加载中" .loading="${true}"></hm-button>
|
|
3701
|
+
|
|
3702
|
+
<!-- 自定义尺寸 -->
|
|
3703
|
+
<hm-button content="大按钮" width="200px" height="50px"></hm-button>
|
|
3704
|
+
<hm-button content="小按钮" width="60px" height="30px" fontSize="8px"></hm-button>
|
|
3705
|
+
<h3>图标</h3>
|
|
3706
|
+
<hm-icon></hm-icon>
|
|
3707
|
+
`;
|
|
3708
|
+
B(template, await panel.body);
|
|
3709
|
+
let menuItem = document.createElement("hm-menu");
|
|
3710
|
+
menuItem.content = "组件模板";
|
|
3711
|
+
menuItem.isMenuItem = true;
|
|
3712
|
+
menuItem.icon = "template";
|
|
3713
|
+
menuItem.addEventListener("hm-menu-click", function() {
|
|
3714
|
+
panel.putTopToggel();
|
|
3715
|
+
});
|
|
3716
|
+
return menuItem;
|
|
3717
|
+
}
|
|
3718
|
+
const exampleApp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3719
|
+
__proto__: null,
|
|
3720
|
+
initExampleApp
|
|
3721
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3722
|
+
var __defProp = Object.defineProperty;
|
|
3723
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3724
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
3725
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
3726
|
+
for (var i3 = decorators.length - 1, decorator; i3 >= 0; i3--)
|
|
3727
|
+
if (decorator = decorators[i3])
|
|
3728
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
3729
|
+
if (kind && result) __defProp(target, key, result);
|
|
3730
|
+
return result;
|
|
3731
|
+
};
|
|
3732
|
+
let HmScriptApp = class extends i$1 {
|
|
3733
|
+
constructor() {
|
|
3734
|
+
super(...arguments);
|
|
3735
|
+
this.scriptName = "";
|
|
3736
|
+
this.scriptUrl = "";
|
|
3737
|
+
this.scriptEnable = true;
|
|
3738
|
+
this.scriptIngected = false;
|
|
3739
|
+
this.dialogOpen = false;
|
|
3740
|
+
this.scriptList = scriptList;
|
|
3741
|
+
}
|
|
3742
|
+
render() {
|
|
3743
|
+
return x`
|
|
3744
|
+
<hm-dialog
|
|
3745
|
+
?isopen="${this.dialogOpen}"
|
|
3746
|
+
@hm-dialog-close="${() => {
|
|
3747
|
+
this.dialogOpen = false;
|
|
3748
|
+
}}"
|
|
3749
|
+
@hm-dialog-confirm="${() => {
|
|
3750
|
+
if (this.scriptName.trim() == "" || this.scriptUrl.trim() == "") {
|
|
3751
|
+
notice.error("脚本管理", "请填写完整的脚本信息");
|
|
3752
|
+
return;
|
|
3753
|
+
}
|
|
3754
|
+
this.scriptEnable = true;
|
|
3755
|
+
this.scriptIngected = false;
|
|
3756
|
+
let script = new Script(
|
|
3757
|
+
this.scriptName,
|
|
3758
|
+
this.scriptUrl,
|
|
3759
|
+
this.scriptEnable,
|
|
3760
|
+
this.scriptIngected
|
|
3761
|
+
);
|
|
3762
|
+
addScriptToList(script);
|
|
3763
|
+
saveScriptList();
|
|
3764
|
+
this.scriptList = scriptList;
|
|
3765
|
+
}}"
|
|
3766
|
+
>
|
|
3767
|
+
<h2>修改或添加脚本</h2>
|
|
3768
|
+
<hm-input
|
|
3769
|
+
label="脚本名称"
|
|
3770
|
+
placeholder="请输入脚本名称"
|
|
3771
|
+
value="${this.scriptName}"
|
|
3772
|
+
@hm-input-change="${(e2) => {
|
|
3773
|
+
this.scriptName = e2.detail.value;
|
|
3774
|
+
console.debug(this.scriptName);
|
|
3775
|
+
}}"
|
|
3776
|
+
></hm-input>
|
|
3777
|
+
<hm-input
|
|
3778
|
+
label="脚本链接"
|
|
3779
|
+
placeholder="请输入https的脚本链接"
|
|
3780
|
+
value="${this.scriptUrl}"
|
|
3781
|
+
@hm-input-change="${(e2) => {
|
|
3782
|
+
this.scriptUrl = e2.detail.value;
|
|
3783
|
+
console.debug(this.scriptUrl);
|
|
3784
|
+
}}"
|
|
3785
|
+
></hm-input>
|
|
3786
|
+
</hm-dialog>
|
|
3787
|
+
|
|
3788
|
+
<hm-accordion>
|
|
3789
|
+
<span slot="header">脚本列表</span>
|
|
3790
|
+
${this.scriptList.map((script) => {
|
|
3791
|
+
return x`
|
|
3792
|
+
<hm-swipe-cell>
|
|
3793
|
+
<div slot="left-actions">
|
|
3794
|
+
<hm-button
|
|
3795
|
+
@hm-button-click="${() => {
|
|
3796
|
+
removeScriptFromList(script);
|
|
3797
|
+
saveScriptList();
|
|
3798
|
+
this.scriptList = scriptList;
|
|
3799
|
+
}}"
|
|
3800
|
+
>删除</hm-button
|
|
3801
|
+
>
|
|
3802
|
+
</div>
|
|
3803
|
+
<hm-cell
|
|
3804
|
+
slot="content"
|
|
3805
|
+
titleName="${script.name}"
|
|
3806
|
+
descripthion="${script.url}"
|
|
3807
|
+
>
|
|
3808
|
+
<hm-switch
|
|
3809
|
+
slot="content"
|
|
3810
|
+
?checked="${script.enable}"
|
|
3811
|
+
@hm-switch-change="${(e2) => {
|
|
3812
|
+
script.enable = e2.detail.checked;
|
|
3813
|
+
addScriptToList(script);
|
|
3814
|
+
saveScriptList();
|
|
3815
|
+
this.scriptList = scriptList;
|
|
3816
|
+
}}"
|
|
3817
|
+
></hm-switch>
|
|
3818
|
+
</hm-cell>
|
|
3819
|
+
|
|
3820
|
+
<div slot="right-actions">
|
|
3821
|
+
<hm-button
|
|
3822
|
+
@hm-button-click="${() => {
|
|
3823
|
+
this.scriptName = script.name;
|
|
3824
|
+
this.scriptUrl = script.url;
|
|
3825
|
+
this.dialogOpen = true;
|
|
3826
|
+
}}"
|
|
3827
|
+
>修改</hm-button
|
|
3828
|
+
>
|
|
3829
|
+
<hm-button
|
|
3830
|
+
?enable="${!script.ingected}"
|
|
3831
|
+
@hm-button-click="${() => {
|
|
3832
|
+
script.ingected = injectScript(script);
|
|
3833
|
+
addScriptToList(script);
|
|
3834
|
+
this.scriptList = scriptList;
|
|
3835
|
+
}}"
|
|
3836
|
+
>运行</hm-button
|
|
3837
|
+
>
|
|
3838
|
+
</div>
|
|
3839
|
+
</hm-swipe-cell>
|
|
3840
|
+
|
|
3841
|
+
`;
|
|
3842
|
+
})}
|
|
3843
|
+
<div slot="footer">
|
|
3844
|
+
<hm-button
|
|
3845
|
+
@click="${() => {
|
|
3846
|
+
readScriptList();
|
|
3847
|
+
this.scriptList = scriptList;
|
|
3848
|
+
}}"
|
|
3849
|
+
>刷新</hm-button
|
|
3850
|
+
>
|
|
3851
|
+
<hm-button
|
|
3852
|
+
@click="${() => {
|
|
3853
|
+
this.scriptName = "";
|
|
3854
|
+
this.scriptUrl = "";
|
|
3855
|
+
this.scriptEnable = true;
|
|
3856
|
+
this.scriptIngected = false;
|
|
3857
|
+
this.dialogOpen = true;
|
|
3858
|
+
}}"
|
|
3859
|
+
>添加</hm-button
|
|
3860
|
+
>
|
|
3861
|
+
<hm-button @click="${() => {
|
|
3862
|
+
saveScriptList();
|
|
3863
|
+
}}"
|
|
3864
|
+
>保存</hm-button
|
|
3865
|
+
>
|
|
3866
|
+
</div>
|
|
3867
|
+
</hm-accordion>
|
|
3868
|
+
|
|
3869
|
+
`;
|
|
3870
|
+
}
|
|
3871
|
+
};
|
|
3872
|
+
HmScriptApp.styles = i$4`
|
|
3873
|
+
:host {
|
|
3874
|
+
display:block;
|
|
3875
|
+
width: 100%;
|
|
3876
|
+
}
|
|
3877
|
+
`;
|
|
3878
|
+
__decorateClass([
|
|
3879
|
+
n2({ type: String })
|
|
3880
|
+
], HmScriptApp.prototype, "scriptName", 2);
|
|
3881
|
+
__decorateClass([
|
|
3882
|
+
n2({ type: String })
|
|
3883
|
+
], HmScriptApp.prototype, "scriptUrl", 2);
|
|
3884
|
+
__decorateClass([
|
|
3885
|
+
n2({ type: Boolean })
|
|
3886
|
+
], HmScriptApp.prototype, "scriptEnable", 2);
|
|
3887
|
+
__decorateClass([
|
|
3888
|
+
n2({ type: Boolean })
|
|
3889
|
+
], HmScriptApp.prototype, "scriptIngected", 2);
|
|
3890
|
+
__decorateClass([
|
|
3891
|
+
n2({ type: Boolean })
|
|
3892
|
+
], HmScriptApp.prototype, "dialogOpen", 2);
|
|
3893
|
+
__decorateClass([
|
|
3894
|
+
n2({ type: Array })
|
|
3895
|
+
], HmScriptApp.prototype, "scriptList", 2);
|
|
3896
|
+
HmScriptApp = __decorateClass([
|
|
3897
|
+
t$2("hm-script-app")
|
|
3898
|
+
], HmScriptApp);
|
|
3899
|
+
async function initScriptApp() {
|
|
3900
|
+
let panel = document.createElement("hm-move-panel");
|
|
3901
|
+
panel.titleContent = "脚本管理";
|
|
3902
|
+
panel.icon = "js";
|
|
3903
|
+
movePanelHolder.appendChild(panel);
|
|
3904
|
+
let template = x`
|
|
3905
|
+
<hm-script-app></hm-script-app>
|
|
3906
|
+
`;
|
|
3907
|
+
B(template, await panel.body);
|
|
3908
|
+
let menuItem = document.createElement("hm-menu");
|
|
3909
|
+
menuItem.content = "脚本管理";
|
|
3910
|
+
menuItem.isMenuItem = true;
|
|
3911
|
+
menuItem.icon = "js";
|
|
3912
|
+
menuItem.addEventListener("hm-menu-click", function() {
|
|
3913
|
+
panel.putTopToggel();
|
|
3914
|
+
});
|
|
3915
|
+
return menuItem;
|
|
3916
|
+
}
|
|
3917
|
+
const name = "hortimagic";
|
|
3918
|
+
const version = "1.0.0";
|
|
3919
|
+
const author = "Narlen";
|
|
3920
|
+
const description = "园艺魔法,花园插件";
|
|
3921
|
+
const keywords = ["iirose", "plugins", "hortimagic"];
|
|
3922
|
+
const repository = { "type": "git", "url": "https://github.com/NarlenHua/hortimagic.git" };
|
|
3923
|
+
const license = "MIT";
|
|
3924
|
+
const type = "module";
|
|
3925
|
+
const scripts = { "dev": "vite", "build": "tsc && vite build", "preview": "vite preview" };
|
|
3926
|
+
const dependencies = { "lit": "^3.3.1", "terser": "^5.44.0", "tiny-emitter": "^2.1.0", "vite-plugin-dts": "^4.5.4" };
|
|
3927
|
+
const devDependencies = { "@types/node": "^24.9.1", "typescript": "~5.9.3", "vite": "^7.1.7" };
|
|
3928
|
+
const main$1 = "dist/Horticraft.life.js";
|
|
3929
|
+
const module = "dist/HortiCraft.es.js";
|
|
3930
|
+
const typings = "dist/index.d.ts";
|
|
3931
|
+
const types = "dist/index.d.ts";
|
|
3932
|
+
const files = ["dist", "src/components", "types"];
|
|
3933
|
+
const pkg = {
|
|
3934
|
+
name,
|
|
3935
|
+
"private": false,
|
|
3936
|
+
version,
|
|
3937
|
+
author,
|
|
3938
|
+
description,
|
|
3939
|
+
keywords,
|
|
3940
|
+
repository,
|
|
3941
|
+
license,
|
|
3942
|
+
type,
|
|
3943
|
+
scripts,
|
|
3944
|
+
dependencies,
|
|
3945
|
+
devDependencies,
|
|
3946
|
+
main: main$1,
|
|
3947
|
+
module,
|
|
3948
|
+
typings,
|
|
3949
|
+
types,
|
|
3950
|
+
files
|
|
3951
|
+
};
|
|
3952
|
+
async function init() {
|
|
3953
|
+
try {
|
|
3954
|
+
initNotificationHolder();
|
|
3955
|
+
initMenuHolder();
|
|
3956
|
+
initMovePanelHolder();
|
|
3957
|
+
initDialogHolder();
|
|
3958
|
+
notice.normal(pkg.name, "注入网络钩子函数");
|
|
3959
|
+
await initSocket();
|
|
3960
|
+
notice.normal(pkg.name, "注入钩子函数");
|
|
3961
|
+
refreshAll();
|
|
3962
|
+
initHooks();
|
|
3963
|
+
notice.normal(pkg.name, "注入脚本");
|
|
3964
|
+
ingectlocalScript();
|
|
3965
|
+
notice.normal(pkg.name, "生成菜单");
|
|
3966
|
+
let menu2 = document.createElement("hm-menu");
|
|
3967
|
+
menu2.content = "HortiMagic";
|
|
3968
|
+
menu2.isMenuItem = false;
|
|
3969
|
+
menuHolder.appendChild(menu2);
|
|
3970
|
+
let exampleMenu = await initExampleApp();
|
|
3971
|
+
let scriptMenu = await initScriptApp();
|
|
3972
|
+
menu2.addEventListener("hm-menu-click", function() {
|
|
3973
|
+
exampleMenu.flag = menu2.flag;
|
|
3974
|
+
scriptMenu.flag = menu2.flag;
|
|
3975
|
+
});
|
|
3976
|
+
menuHolder.append(menu2, exampleMenu, scriptMenu);
|
|
3977
|
+
notice.success(pkg.name, `${pkg.version} 已加载`, 3e3);
|
|
3978
|
+
} catch (error) {
|
|
3979
|
+
console.error(error);
|
|
3980
|
+
}
|
|
3981
|
+
}
|
|
3982
|
+
const mainApp = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3983
|
+
__proto__: null,
|
|
3984
|
+
init
|
|
3985
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3986
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3987
|
+
__proto__: null,
|
|
3988
|
+
example_app: exampleApp,
|
|
3989
|
+
main_app: mainApp
|
|
3990
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3991
|
+
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3992
|
+
__proto__: null,
|
|
3993
|
+
dialog,
|
|
3994
|
+
menu,
|
|
3995
|
+
move_panel: movePanel,
|
|
3996
|
+
notification
|
|
3997
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
3998
|
+
const information = {
|
|
3999
|
+
/** 项目名称 */
|
|
4000
|
+
name: pkg.name,
|
|
4001
|
+
/** 项目版本 */
|
|
4002
|
+
version: pkg.version,
|
|
4003
|
+
/** 项目描述 */
|
|
4004
|
+
description: pkg.description,
|
|
4005
|
+
/** 项目作者 */
|
|
4006
|
+
author: pkg.author,
|
|
4007
|
+
/** 项目许可证 */
|
|
4008
|
+
license: pkg.license,
|
|
4009
|
+
/** 项目仓库 */
|
|
4010
|
+
repository: pkg.repository,
|
|
4011
|
+
/** 项目构建时间 */
|
|
4012
|
+
buildTime: (/* @__PURE__ */ new Date()).toISOString()
|
|
4013
|
+
};
|
|
4014
|
+
async function main() {
|
|
4015
|
+
init();
|
|
4016
|
+
}
|
|
4017
|
+
main();
|
|
4018
|
+
export {
|
|
4019
|
+
index$1 as apps,
|
|
4020
|
+
index$2 as components,
|
|
4021
|
+
index$3 as core,
|
|
4022
|
+
index as holders,
|
|
4023
|
+
information
|
|
4024
|
+
};
|