@widget-js/core 24.1.1-beta.85 → 24.1.1-beta.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2127 -1907
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3153 -2529
- package/dist/index.d.ts +3153 -2529
- package/dist/index.js +2123 -1907
- package/dist/index.js.map +1 -1
- package/package.json +75 -74
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parse, find } from 'css-tree';
|
|
2
|
+
import merge from 'lodash/merge';
|
|
2
3
|
import localforage from 'localforage';
|
|
3
4
|
|
|
4
5
|
var __create = Object.create;
|
|
@@ -27,238 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
28
|
mod
|
|
28
29
|
));
|
|
29
30
|
|
|
30
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js
|
|
31
|
-
var require_arrayReduce = __commonJS({
|
|
32
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js"(exports$1, module) {
|
|
33
|
-
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
34
|
-
var index = -1, length = array == null ? 0 : array.length;
|
|
35
|
-
if (initAccum && length) {
|
|
36
|
-
accumulator = array[++index];
|
|
37
|
-
}
|
|
38
|
-
while (++index < length) {
|
|
39
|
-
accumulator = iteratee(accumulator, array[index], index, array);
|
|
40
|
-
}
|
|
41
|
-
return accumulator;
|
|
42
|
-
}
|
|
43
|
-
module.exports = arrayReduce;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js
|
|
48
|
-
var require_basePropertyOf = __commonJS({
|
|
49
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js"(exports$1, module) {
|
|
50
|
-
function basePropertyOf(object) {
|
|
51
|
-
return function(key) {
|
|
52
|
-
return object == null ? void 0 : object[key];
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
module.exports = basePropertyOf;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js
|
|
60
|
-
var require_deburrLetter = __commonJS({
|
|
61
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js"(exports$1, module) {
|
|
62
|
-
var basePropertyOf = require_basePropertyOf();
|
|
63
|
-
var deburredLetters = {
|
|
64
|
-
// Latin-1 Supplement block.
|
|
65
|
-
"\xC0": "A",
|
|
66
|
-
"\xC1": "A",
|
|
67
|
-
"\xC2": "A",
|
|
68
|
-
"\xC3": "A",
|
|
69
|
-
"\xC4": "A",
|
|
70
|
-
"\xC5": "A",
|
|
71
|
-
"\xE0": "a",
|
|
72
|
-
"\xE1": "a",
|
|
73
|
-
"\xE2": "a",
|
|
74
|
-
"\xE3": "a",
|
|
75
|
-
"\xE4": "a",
|
|
76
|
-
"\xE5": "a",
|
|
77
|
-
"\xC7": "C",
|
|
78
|
-
"\xE7": "c",
|
|
79
|
-
"\xD0": "D",
|
|
80
|
-
"\xF0": "d",
|
|
81
|
-
"\xC8": "E",
|
|
82
|
-
"\xC9": "E",
|
|
83
|
-
"\xCA": "E",
|
|
84
|
-
"\xCB": "E",
|
|
85
|
-
"\xE8": "e",
|
|
86
|
-
"\xE9": "e",
|
|
87
|
-
"\xEA": "e",
|
|
88
|
-
"\xEB": "e",
|
|
89
|
-
"\xCC": "I",
|
|
90
|
-
"\xCD": "I",
|
|
91
|
-
"\xCE": "I",
|
|
92
|
-
"\xCF": "I",
|
|
93
|
-
"\xEC": "i",
|
|
94
|
-
"\xED": "i",
|
|
95
|
-
"\xEE": "i",
|
|
96
|
-
"\xEF": "i",
|
|
97
|
-
"\xD1": "N",
|
|
98
|
-
"\xF1": "n",
|
|
99
|
-
"\xD2": "O",
|
|
100
|
-
"\xD3": "O",
|
|
101
|
-
"\xD4": "O",
|
|
102
|
-
"\xD5": "O",
|
|
103
|
-
"\xD6": "O",
|
|
104
|
-
"\xD8": "O",
|
|
105
|
-
"\xF2": "o",
|
|
106
|
-
"\xF3": "o",
|
|
107
|
-
"\xF4": "o",
|
|
108
|
-
"\xF5": "o",
|
|
109
|
-
"\xF6": "o",
|
|
110
|
-
"\xF8": "o",
|
|
111
|
-
"\xD9": "U",
|
|
112
|
-
"\xDA": "U",
|
|
113
|
-
"\xDB": "U",
|
|
114
|
-
"\xDC": "U",
|
|
115
|
-
"\xF9": "u",
|
|
116
|
-
"\xFA": "u",
|
|
117
|
-
"\xFB": "u",
|
|
118
|
-
"\xFC": "u",
|
|
119
|
-
"\xDD": "Y",
|
|
120
|
-
"\xFD": "y",
|
|
121
|
-
"\xFF": "y",
|
|
122
|
-
"\xC6": "Ae",
|
|
123
|
-
"\xE6": "ae",
|
|
124
|
-
"\xDE": "Th",
|
|
125
|
-
"\xFE": "th",
|
|
126
|
-
"\xDF": "ss",
|
|
127
|
-
// Latin Extended-A block.
|
|
128
|
-
"\u0100": "A",
|
|
129
|
-
"\u0102": "A",
|
|
130
|
-
"\u0104": "A",
|
|
131
|
-
"\u0101": "a",
|
|
132
|
-
"\u0103": "a",
|
|
133
|
-
"\u0105": "a",
|
|
134
|
-
"\u0106": "C",
|
|
135
|
-
"\u0108": "C",
|
|
136
|
-
"\u010A": "C",
|
|
137
|
-
"\u010C": "C",
|
|
138
|
-
"\u0107": "c",
|
|
139
|
-
"\u0109": "c",
|
|
140
|
-
"\u010B": "c",
|
|
141
|
-
"\u010D": "c",
|
|
142
|
-
"\u010E": "D",
|
|
143
|
-
"\u0110": "D",
|
|
144
|
-
"\u010F": "d",
|
|
145
|
-
"\u0111": "d",
|
|
146
|
-
"\u0112": "E",
|
|
147
|
-
"\u0114": "E",
|
|
148
|
-
"\u0116": "E",
|
|
149
|
-
"\u0118": "E",
|
|
150
|
-
"\u011A": "E",
|
|
151
|
-
"\u0113": "e",
|
|
152
|
-
"\u0115": "e",
|
|
153
|
-
"\u0117": "e",
|
|
154
|
-
"\u0119": "e",
|
|
155
|
-
"\u011B": "e",
|
|
156
|
-
"\u011C": "G",
|
|
157
|
-
"\u011E": "G",
|
|
158
|
-
"\u0120": "G",
|
|
159
|
-
"\u0122": "G",
|
|
160
|
-
"\u011D": "g",
|
|
161
|
-
"\u011F": "g",
|
|
162
|
-
"\u0121": "g",
|
|
163
|
-
"\u0123": "g",
|
|
164
|
-
"\u0124": "H",
|
|
165
|
-
"\u0126": "H",
|
|
166
|
-
"\u0125": "h",
|
|
167
|
-
"\u0127": "h",
|
|
168
|
-
"\u0128": "I",
|
|
169
|
-
"\u012A": "I",
|
|
170
|
-
"\u012C": "I",
|
|
171
|
-
"\u012E": "I",
|
|
172
|
-
"\u0130": "I",
|
|
173
|
-
"\u0129": "i",
|
|
174
|
-
"\u012B": "i",
|
|
175
|
-
"\u012D": "i",
|
|
176
|
-
"\u012F": "i",
|
|
177
|
-
"\u0131": "i",
|
|
178
|
-
"\u0134": "J",
|
|
179
|
-
"\u0135": "j",
|
|
180
|
-
"\u0136": "K",
|
|
181
|
-
"\u0137": "k",
|
|
182
|
-
"\u0138": "k",
|
|
183
|
-
"\u0139": "L",
|
|
184
|
-
"\u013B": "L",
|
|
185
|
-
"\u013D": "L",
|
|
186
|
-
"\u013F": "L",
|
|
187
|
-
"\u0141": "L",
|
|
188
|
-
"\u013A": "l",
|
|
189
|
-
"\u013C": "l",
|
|
190
|
-
"\u013E": "l",
|
|
191
|
-
"\u0140": "l",
|
|
192
|
-
"\u0142": "l",
|
|
193
|
-
"\u0143": "N",
|
|
194
|
-
"\u0145": "N",
|
|
195
|
-
"\u0147": "N",
|
|
196
|
-
"\u014A": "N",
|
|
197
|
-
"\u0144": "n",
|
|
198
|
-
"\u0146": "n",
|
|
199
|
-
"\u0148": "n",
|
|
200
|
-
"\u014B": "n",
|
|
201
|
-
"\u014C": "O",
|
|
202
|
-
"\u014E": "O",
|
|
203
|
-
"\u0150": "O",
|
|
204
|
-
"\u014D": "o",
|
|
205
|
-
"\u014F": "o",
|
|
206
|
-
"\u0151": "o",
|
|
207
|
-
"\u0154": "R",
|
|
208
|
-
"\u0156": "R",
|
|
209
|
-
"\u0158": "R",
|
|
210
|
-
"\u0155": "r",
|
|
211
|
-
"\u0157": "r",
|
|
212
|
-
"\u0159": "r",
|
|
213
|
-
"\u015A": "S",
|
|
214
|
-
"\u015C": "S",
|
|
215
|
-
"\u015E": "S",
|
|
216
|
-
"\u0160": "S",
|
|
217
|
-
"\u015B": "s",
|
|
218
|
-
"\u015D": "s",
|
|
219
|
-
"\u015F": "s",
|
|
220
|
-
"\u0161": "s",
|
|
221
|
-
"\u0162": "T",
|
|
222
|
-
"\u0164": "T",
|
|
223
|
-
"\u0166": "T",
|
|
224
|
-
"\u0163": "t",
|
|
225
|
-
"\u0165": "t",
|
|
226
|
-
"\u0167": "t",
|
|
227
|
-
"\u0168": "U",
|
|
228
|
-
"\u016A": "U",
|
|
229
|
-
"\u016C": "U",
|
|
230
|
-
"\u016E": "U",
|
|
231
|
-
"\u0170": "U",
|
|
232
|
-
"\u0172": "U",
|
|
233
|
-
"\u0169": "u",
|
|
234
|
-
"\u016B": "u",
|
|
235
|
-
"\u016D": "u",
|
|
236
|
-
"\u016F": "u",
|
|
237
|
-
"\u0171": "u",
|
|
238
|
-
"\u0173": "u",
|
|
239
|
-
"\u0174": "W",
|
|
240
|
-
"\u0175": "w",
|
|
241
|
-
"\u0176": "Y",
|
|
242
|
-
"\u0177": "y",
|
|
243
|
-
"\u0178": "Y",
|
|
244
|
-
"\u0179": "Z",
|
|
245
|
-
"\u017B": "Z",
|
|
246
|
-
"\u017D": "Z",
|
|
247
|
-
"\u017A": "z",
|
|
248
|
-
"\u017C": "z",
|
|
249
|
-
"\u017E": "z",
|
|
250
|
-
"\u0132": "IJ",
|
|
251
|
-
"\u0133": "ij",
|
|
252
|
-
"\u0152": "Oe",
|
|
253
|
-
"\u0153": "oe",
|
|
254
|
-
"\u0149": "'n",
|
|
255
|
-
"\u017F": "s"
|
|
256
|
-
};
|
|
257
|
-
var deburrLetter = basePropertyOf(deburredLetters);
|
|
258
|
-
module.exports = deburrLetter;
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
|
|
262
31
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js
|
|
263
32
|
var require_freeGlobal = __commonJS({
|
|
264
33
|
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js"(exports$1, module) {
|
|
@@ -428,154 +197,6 @@ var require_toString = __commonJS({
|
|
|
428
197
|
}
|
|
429
198
|
});
|
|
430
199
|
|
|
431
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js
|
|
432
|
-
var require_deburr = __commonJS({
|
|
433
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js"(exports$1, module) {
|
|
434
|
-
var deburrLetter = require_deburrLetter();
|
|
435
|
-
var toString = require_toString();
|
|
436
|
-
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
437
|
-
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
438
|
-
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
|
|
439
|
-
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
|
|
440
|
-
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
441
|
-
var rsCombo = "[" + rsComboRange + "]";
|
|
442
|
-
var reComboMark = RegExp(rsCombo, "g");
|
|
443
|
-
function deburr(string) {
|
|
444
|
-
string = toString(string);
|
|
445
|
-
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
|
|
446
|
-
}
|
|
447
|
-
module.exports = deburr;
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js
|
|
452
|
-
var require_asciiWords = __commonJS({
|
|
453
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js"(exports$1, module) {
|
|
454
|
-
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
455
|
-
function asciiWords(string) {
|
|
456
|
-
return string.match(reAsciiWord) || [];
|
|
457
|
-
}
|
|
458
|
-
module.exports = asciiWords;
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js
|
|
463
|
-
var require_hasUnicodeWord = __commonJS({
|
|
464
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js"(exports$1, module) {
|
|
465
|
-
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
466
|
-
function hasUnicodeWord(string) {
|
|
467
|
-
return reHasUnicodeWord.test(string);
|
|
468
|
-
}
|
|
469
|
-
module.exports = hasUnicodeWord;
|
|
470
|
-
}
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js
|
|
474
|
-
var require_unicodeWords = __commonJS({
|
|
475
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js"(exports$1, module) {
|
|
476
|
-
var rsAstralRange = "\\ud800-\\udfff";
|
|
477
|
-
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
478
|
-
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
|
|
479
|
-
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
|
|
480
|
-
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
481
|
-
var rsDingbatRange = "\\u2700-\\u27bf";
|
|
482
|
-
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
|
|
483
|
-
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
|
|
484
|
-
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
|
|
485
|
-
var rsPunctuationRange = "\\u2000-\\u206f";
|
|
486
|
-
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
|
|
487
|
-
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
|
|
488
|
-
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
489
|
-
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
490
|
-
var rsApos = "['\u2019]";
|
|
491
|
-
var rsBreak = "[" + rsBreakRange + "]";
|
|
492
|
-
var rsCombo = "[" + rsComboRange + "]";
|
|
493
|
-
var rsDigits = "\\d+";
|
|
494
|
-
var rsDingbat = "[" + rsDingbatRange + "]";
|
|
495
|
-
var rsLower = "[" + rsLowerRange + "]";
|
|
496
|
-
var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
|
|
497
|
-
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
|
|
498
|
-
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
|
|
499
|
-
var rsNonAstral = "[^" + rsAstralRange + "]";
|
|
500
|
-
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
501
|
-
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
502
|
-
var rsUpper = "[" + rsUpperRange + "]";
|
|
503
|
-
var rsZWJ = "\\u200d";
|
|
504
|
-
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
|
|
505
|
-
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
|
|
506
|
-
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
|
|
507
|
-
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
|
|
508
|
-
var reOptMod = rsModifier + "?";
|
|
509
|
-
var rsOptVar = "[" + rsVarRange + "]?";
|
|
510
|
-
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
|
|
511
|
-
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
|
|
512
|
-
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
|
|
513
|
-
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
514
|
-
var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
|
|
515
|
-
var reUnicodeWord = RegExp([
|
|
516
|
-
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
|
|
517
|
-
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
|
|
518
|
-
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
|
|
519
|
-
rsUpper + "+" + rsOptContrUpper,
|
|
520
|
-
rsOrdUpper,
|
|
521
|
-
rsOrdLower,
|
|
522
|
-
rsDigits,
|
|
523
|
-
rsEmoji
|
|
524
|
-
].join("|"), "g");
|
|
525
|
-
function unicodeWords(string) {
|
|
526
|
-
return string.match(reUnicodeWord) || [];
|
|
527
|
-
}
|
|
528
|
-
module.exports = unicodeWords;
|
|
529
|
-
}
|
|
530
|
-
});
|
|
531
|
-
|
|
532
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js
|
|
533
|
-
var require_words = __commonJS({
|
|
534
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js"(exports$1, module) {
|
|
535
|
-
var asciiWords = require_asciiWords();
|
|
536
|
-
var hasUnicodeWord = require_hasUnicodeWord();
|
|
537
|
-
var toString = require_toString();
|
|
538
|
-
var unicodeWords = require_unicodeWords();
|
|
539
|
-
function words(string, pattern, guard) {
|
|
540
|
-
string = toString(string);
|
|
541
|
-
pattern = guard ? void 0 : pattern;
|
|
542
|
-
if (pattern === void 0) {
|
|
543
|
-
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
544
|
-
}
|
|
545
|
-
return string.match(pattern) || [];
|
|
546
|
-
}
|
|
547
|
-
module.exports = words;
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js
|
|
552
|
-
var require_createCompounder = __commonJS({
|
|
553
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js"(exports$1, module) {
|
|
554
|
-
var arrayReduce = require_arrayReduce();
|
|
555
|
-
var deburr = require_deburr();
|
|
556
|
-
var words = require_words();
|
|
557
|
-
var rsApos = "['\u2019]";
|
|
558
|
-
var reApos = RegExp(rsApos, "g");
|
|
559
|
-
function createCompounder(callback) {
|
|
560
|
-
return function(string) {
|
|
561
|
-
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
module.exports = createCompounder;
|
|
565
|
-
}
|
|
566
|
-
});
|
|
567
|
-
|
|
568
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js
|
|
569
|
-
var require_kebabCase = __commonJS({
|
|
570
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js"(exports$1, module) {
|
|
571
|
-
var createCompounder = require_createCompounder();
|
|
572
|
-
var kebabCase3 = createCompounder(function(result, word, index) {
|
|
573
|
-
return result + (index ? "-" : "") + word.toLowerCase();
|
|
574
|
-
});
|
|
575
|
-
module.exports = kebabCase3;
|
|
576
|
-
}
|
|
577
|
-
});
|
|
578
|
-
|
|
579
200
|
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js
|
|
580
201
|
var require_baseSlice = __commonJS({
|
|
581
202
|
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js"(exports$1, module) {
|
|
@@ -725,135 +346,875 @@ var require_capitalize = __commonJS({
|
|
|
725
346
|
}
|
|
726
347
|
});
|
|
727
348
|
|
|
728
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
729
|
-
var
|
|
730
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
return result + (index ? capitalize(word) : word);
|
|
736
|
-
});
|
|
737
|
-
module.exports = camelCase2;
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js
|
|
742
|
-
var require_snakeCase = __commonJS({
|
|
743
|
-
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js"(exports$1, module) {
|
|
744
|
-
var createCompounder = require_createCompounder();
|
|
745
|
-
var snakeCase2 = createCompounder(function(result, word, index) {
|
|
746
|
-
return result + (index ? "_" : "") + word.toLowerCase();
|
|
747
|
-
});
|
|
748
|
-
module.exports = snakeCase2;
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
|
|
752
|
-
// src/model/DeployMode.ts
|
|
753
|
-
var HostedMode = /* @__PURE__ */ ((HostedMode2) => {
|
|
754
|
-
HostedMode2[HostedMode2["NORMAL"] = 1] = "NORMAL";
|
|
755
|
-
HostedMode2[HostedMode2["OVERLAP"] = 16] = "OVERLAP";
|
|
756
|
-
HostedMode2[HostedMode2["WALLPAPER"] = 256] = "WALLPAPER";
|
|
757
|
-
HostedMode2[HostedMode2["SCREEN"] = 4096] = "SCREEN";
|
|
758
|
-
HostedMode2[HostedMode2["BACKGROUND"] = 65536] = "BACKGROUND";
|
|
759
|
-
HostedMode2[HostedMode2["PAGE"] = 1048576] = "PAGE";
|
|
760
|
-
HostedMode2[HostedMode2["ALL"] = 1118481] = "ALL";
|
|
761
|
-
return HostedMode2;
|
|
762
|
-
})(HostedMode || {});
|
|
763
|
-
var DeployMode = /* @__PURE__ */ ((DeployMode2) => {
|
|
764
|
-
DeployMode2[DeployMode2["NORMAL"] = 1] = "NORMAL";
|
|
765
|
-
DeployMode2[DeployMode2["OVERLAP"] = 16] = "OVERLAP";
|
|
766
|
-
DeployMode2[DeployMode2["BACKGROUND"] = 65536] = "BACKGROUND";
|
|
767
|
-
DeployMode2[DeployMode2["TRAY"] = 256] = "TRAY";
|
|
768
|
-
DeployMode2[DeployMode2["ALL"] = 1118481] = "ALL";
|
|
769
|
-
return DeployMode2;
|
|
770
|
-
})(DeployMode || {});
|
|
771
|
-
|
|
772
|
-
// src/utils/ElectronUtils.ts
|
|
773
|
-
var ElectronUtils = class {
|
|
774
|
-
static hasElectronApi() {
|
|
775
|
-
return this.getAPI() != null;
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* 获取ElectronAPI
|
|
779
|
-
* windows api
|
|
780
|
-
*/
|
|
781
|
-
static getAPI() {
|
|
782
|
-
if (Reflect.has(window, "electronAPI")) {
|
|
783
|
-
return window.electronAPI;
|
|
784
|
-
} else if (Reflect.has(window.parent, "electronAPI")) {
|
|
785
|
-
return window.parent.electronAPI;
|
|
786
|
-
}
|
|
787
|
-
return null;
|
|
788
|
-
}
|
|
789
|
-
static async invokeMethod(channel, method, ...args) {
|
|
790
|
-
return this.getAPI()?.invoke(channel, method, ...args);
|
|
791
|
-
}
|
|
792
|
-
static async invoke(channel, ...args) {
|
|
793
|
-
return this.getAPI()?.invoke(channel, ...args);
|
|
794
|
-
}
|
|
795
|
-
};
|
|
796
|
-
|
|
797
|
-
// src/utils/LanguageUtils.ts
|
|
798
|
-
var LanguageUtils = class {
|
|
799
|
-
static findText(langMap, localeCode) {
|
|
800
|
-
const locales = Object.keys(langMap).map((key) => new Intl.Locale(key));
|
|
801
|
-
const targetLocale = new Intl.Locale(localeCode);
|
|
802
|
-
let find2 = locales.find((locale) => locale.baseName == targetLocale.baseName);
|
|
803
|
-
if (!find2) {
|
|
804
|
-
find2 = locales.find((locale) => locale.language == targetLocale.language);
|
|
805
|
-
}
|
|
806
|
-
return find2;
|
|
807
|
-
}
|
|
808
|
-
/**
|
|
809
|
-
* Get text from `LanguageTextMap` by Unicode locale identifier.
|
|
810
|
-
* `localeCode` > `localeCode` without region > browser default language > English > first language
|
|
811
|
-
* @param langMap 对象
|
|
812
|
-
* @param {LanguageCode} localeCode `zh-CN`、`en-US`、 `zh`、`en`
|
|
813
|
-
* @param fallbackToBrowser
|
|
814
|
-
*/
|
|
815
|
-
static getTextByLocate(langMap, localeCode, fallbackToBrowser = true) {
|
|
816
|
-
let result;
|
|
817
|
-
if (localeCode) {
|
|
818
|
-
if (localeCode in langMap) {
|
|
819
|
-
return langMap[localeCode];
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
if (localeCode) {
|
|
823
|
-
const find2 = this.findText(langMap, localeCode);
|
|
824
|
-
if (find2) {
|
|
825
|
-
return langMap[find2.baseName];
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
if (result == void 0 && fallbackToBrowser) {
|
|
829
|
-
if (typeof navigator != "undefined" && navigator.languages) {
|
|
830
|
-
const langCode = navigator.language;
|
|
831
|
-
result = this.getTextByLocate(langMap, langCode, false);
|
|
832
|
-
if (result != void 0) {
|
|
833
|
-
return result;
|
|
834
|
-
}
|
|
349
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js
|
|
350
|
+
var require_arrayReduce = __commonJS({
|
|
351
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js"(exports$1, module) {
|
|
352
|
+
function arrayReduce(array, iteratee, accumulator, initAccum) {
|
|
353
|
+
var index = -1, length = array == null ? 0 : array.length;
|
|
354
|
+
if (initAccum && length) {
|
|
355
|
+
accumulator = array[++index];
|
|
835
356
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
const find2 = this.findText(langMap, "en");
|
|
839
|
-
if (find2) {
|
|
840
|
-
return langMap[find2.baseName];
|
|
357
|
+
while (++index < length) {
|
|
358
|
+
accumulator = iteratee(accumulator, array[index], index, array);
|
|
841
359
|
}
|
|
360
|
+
return accumulator;
|
|
842
361
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
362
|
+
module.exports = arrayReduce;
|
|
363
|
+
}
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js
|
|
367
|
+
var require_basePropertyOf = __commonJS({
|
|
368
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js"(exports$1, module) {
|
|
369
|
+
function basePropertyOf(object) {
|
|
370
|
+
return function(key) {
|
|
371
|
+
return object == null ? void 0 : object[key];
|
|
372
|
+
};
|
|
848
373
|
}
|
|
849
|
-
|
|
374
|
+
module.exports = basePropertyOf;
|
|
850
375
|
}
|
|
851
|
-
};
|
|
376
|
+
});
|
|
852
377
|
|
|
853
|
-
//
|
|
854
|
-
var
|
|
855
|
-
|
|
856
|
-
|
|
378
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js
|
|
379
|
+
var require_deburrLetter = __commonJS({
|
|
380
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js"(exports$1, module) {
|
|
381
|
+
var basePropertyOf = require_basePropertyOf();
|
|
382
|
+
var deburredLetters = {
|
|
383
|
+
// Latin-1 Supplement block.
|
|
384
|
+
"\xC0": "A",
|
|
385
|
+
"\xC1": "A",
|
|
386
|
+
"\xC2": "A",
|
|
387
|
+
"\xC3": "A",
|
|
388
|
+
"\xC4": "A",
|
|
389
|
+
"\xC5": "A",
|
|
390
|
+
"\xE0": "a",
|
|
391
|
+
"\xE1": "a",
|
|
392
|
+
"\xE2": "a",
|
|
393
|
+
"\xE3": "a",
|
|
394
|
+
"\xE4": "a",
|
|
395
|
+
"\xE5": "a",
|
|
396
|
+
"\xC7": "C",
|
|
397
|
+
"\xE7": "c",
|
|
398
|
+
"\xD0": "D",
|
|
399
|
+
"\xF0": "d",
|
|
400
|
+
"\xC8": "E",
|
|
401
|
+
"\xC9": "E",
|
|
402
|
+
"\xCA": "E",
|
|
403
|
+
"\xCB": "E",
|
|
404
|
+
"\xE8": "e",
|
|
405
|
+
"\xE9": "e",
|
|
406
|
+
"\xEA": "e",
|
|
407
|
+
"\xEB": "e",
|
|
408
|
+
"\xCC": "I",
|
|
409
|
+
"\xCD": "I",
|
|
410
|
+
"\xCE": "I",
|
|
411
|
+
"\xCF": "I",
|
|
412
|
+
"\xEC": "i",
|
|
413
|
+
"\xED": "i",
|
|
414
|
+
"\xEE": "i",
|
|
415
|
+
"\xEF": "i",
|
|
416
|
+
"\xD1": "N",
|
|
417
|
+
"\xF1": "n",
|
|
418
|
+
"\xD2": "O",
|
|
419
|
+
"\xD3": "O",
|
|
420
|
+
"\xD4": "O",
|
|
421
|
+
"\xD5": "O",
|
|
422
|
+
"\xD6": "O",
|
|
423
|
+
"\xD8": "O",
|
|
424
|
+
"\xF2": "o",
|
|
425
|
+
"\xF3": "o",
|
|
426
|
+
"\xF4": "o",
|
|
427
|
+
"\xF5": "o",
|
|
428
|
+
"\xF6": "o",
|
|
429
|
+
"\xF8": "o",
|
|
430
|
+
"\xD9": "U",
|
|
431
|
+
"\xDA": "U",
|
|
432
|
+
"\xDB": "U",
|
|
433
|
+
"\xDC": "U",
|
|
434
|
+
"\xF9": "u",
|
|
435
|
+
"\xFA": "u",
|
|
436
|
+
"\xFB": "u",
|
|
437
|
+
"\xFC": "u",
|
|
438
|
+
"\xDD": "Y",
|
|
439
|
+
"\xFD": "y",
|
|
440
|
+
"\xFF": "y",
|
|
441
|
+
"\xC6": "Ae",
|
|
442
|
+
"\xE6": "ae",
|
|
443
|
+
"\xDE": "Th",
|
|
444
|
+
"\xFE": "th",
|
|
445
|
+
"\xDF": "ss",
|
|
446
|
+
// Latin Extended-A block.
|
|
447
|
+
"\u0100": "A",
|
|
448
|
+
"\u0102": "A",
|
|
449
|
+
"\u0104": "A",
|
|
450
|
+
"\u0101": "a",
|
|
451
|
+
"\u0103": "a",
|
|
452
|
+
"\u0105": "a",
|
|
453
|
+
"\u0106": "C",
|
|
454
|
+
"\u0108": "C",
|
|
455
|
+
"\u010A": "C",
|
|
456
|
+
"\u010C": "C",
|
|
457
|
+
"\u0107": "c",
|
|
458
|
+
"\u0109": "c",
|
|
459
|
+
"\u010B": "c",
|
|
460
|
+
"\u010D": "c",
|
|
461
|
+
"\u010E": "D",
|
|
462
|
+
"\u0110": "D",
|
|
463
|
+
"\u010F": "d",
|
|
464
|
+
"\u0111": "d",
|
|
465
|
+
"\u0112": "E",
|
|
466
|
+
"\u0114": "E",
|
|
467
|
+
"\u0116": "E",
|
|
468
|
+
"\u0118": "E",
|
|
469
|
+
"\u011A": "E",
|
|
470
|
+
"\u0113": "e",
|
|
471
|
+
"\u0115": "e",
|
|
472
|
+
"\u0117": "e",
|
|
473
|
+
"\u0119": "e",
|
|
474
|
+
"\u011B": "e",
|
|
475
|
+
"\u011C": "G",
|
|
476
|
+
"\u011E": "G",
|
|
477
|
+
"\u0120": "G",
|
|
478
|
+
"\u0122": "G",
|
|
479
|
+
"\u011D": "g",
|
|
480
|
+
"\u011F": "g",
|
|
481
|
+
"\u0121": "g",
|
|
482
|
+
"\u0123": "g",
|
|
483
|
+
"\u0124": "H",
|
|
484
|
+
"\u0126": "H",
|
|
485
|
+
"\u0125": "h",
|
|
486
|
+
"\u0127": "h",
|
|
487
|
+
"\u0128": "I",
|
|
488
|
+
"\u012A": "I",
|
|
489
|
+
"\u012C": "I",
|
|
490
|
+
"\u012E": "I",
|
|
491
|
+
"\u0130": "I",
|
|
492
|
+
"\u0129": "i",
|
|
493
|
+
"\u012B": "i",
|
|
494
|
+
"\u012D": "i",
|
|
495
|
+
"\u012F": "i",
|
|
496
|
+
"\u0131": "i",
|
|
497
|
+
"\u0134": "J",
|
|
498
|
+
"\u0135": "j",
|
|
499
|
+
"\u0136": "K",
|
|
500
|
+
"\u0137": "k",
|
|
501
|
+
"\u0138": "k",
|
|
502
|
+
"\u0139": "L",
|
|
503
|
+
"\u013B": "L",
|
|
504
|
+
"\u013D": "L",
|
|
505
|
+
"\u013F": "L",
|
|
506
|
+
"\u0141": "L",
|
|
507
|
+
"\u013A": "l",
|
|
508
|
+
"\u013C": "l",
|
|
509
|
+
"\u013E": "l",
|
|
510
|
+
"\u0140": "l",
|
|
511
|
+
"\u0142": "l",
|
|
512
|
+
"\u0143": "N",
|
|
513
|
+
"\u0145": "N",
|
|
514
|
+
"\u0147": "N",
|
|
515
|
+
"\u014A": "N",
|
|
516
|
+
"\u0144": "n",
|
|
517
|
+
"\u0146": "n",
|
|
518
|
+
"\u0148": "n",
|
|
519
|
+
"\u014B": "n",
|
|
520
|
+
"\u014C": "O",
|
|
521
|
+
"\u014E": "O",
|
|
522
|
+
"\u0150": "O",
|
|
523
|
+
"\u014D": "o",
|
|
524
|
+
"\u014F": "o",
|
|
525
|
+
"\u0151": "o",
|
|
526
|
+
"\u0154": "R",
|
|
527
|
+
"\u0156": "R",
|
|
528
|
+
"\u0158": "R",
|
|
529
|
+
"\u0155": "r",
|
|
530
|
+
"\u0157": "r",
|
|
531
|
+
"\u0159": "r",
|
|
532
|
+
"\u015A": "S",
|
|
533
|
+
"\u015C": "S",
|
|
534
|
+
"\u015E": "S",
|
|
535
|
+
"\u0160": "S",
|
|
536
|
+
"\u015B": "s",
|
|
537
|
+
"\u015D": "s",
|
|
538
|
+
"\u015F": "s",
|
|
539
|
+
"\u0161": "s",
|
|
540
|
+
"\u0162": "T",
|
|
541
|
+
"\u0164": "T",
|
|
542
|
+
"\u0166": "T",
|
|
543
|
+
"\u0163": "t",
|
|
544
|
+
"\u0165": "t",
|
|
545
|
+
"\u0167": "t",
|
|
546
|
+
"\u0168": "U",
|
|
547
|
+
"\u016A": "U",
|
|
548
|
+
"\u016C": "U",
|
|
549
|
+
"\u016E": "U",
|
|
550
|
+
"\u0170": "U",
|
|
551
|
+
"\u0172": "U",
|
|
552
|
+
"\u0169": "u",
|
|
553
|
+
"\u016B": "u",
|
|
554
|
+
"\u016D": "u",
|
|
555
|
+
"\u016F": "u",
|
|
556
|
+
"\u0171": "u",
|
|
557
|
+
"\u0173": "u",
|
|
558
|
+
"\u0174": "W",
|
|
559
|
+
"\u0175": "w",
|
|
560
|
+
"\u0176": "Y",
|
|
561
|
+
"\u0177": "y",
|
|
562
|
+
"\u0178": "Y",
|
|
563
|
+
"\u0179": "Z",
|
|
564
|
+
"\u017B": "Z",
|
|
565
|
+
"\u017D": "Z",
|
|
566
|
+
"\u017A": "z",
|
|
567
|
+
"\u017C": "z",
|
|
568
|
+
"\u017E": "z",
|
|
569
|
+
"\u0132": "IJ",
|
|
570
|
+
"\u0133": "ij",
|
|
571
|
+
"\u0152": "Oe",
|
|
572
|
+
"\u0153": "oe",
|
|
573
|
+
"\u0149": "'n",
|
|
574
|
+
"\u017F": "s"
|
|
575
|
+
};
|
|
576
|
+
var deburrLetter = basePropertyOf(deburredLetters);
|
|
577
|
+
module.exports = deburrLetter;
|
|
578
|
+
}
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js
|
|
582
|
+
var require_deburr = __commonJS({
|
|
583
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js"(exports$1, module) {
|
|
584
|
+
var deburrLetter = require_deburrLetter();
|
|
585
|
+
var toString = require_toString();
|
|
586
|
+
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
587
|
+
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
588
|
+
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
|
|
589
|
+
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
|
|
590
|
+
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
591
|
+
var rsCombo = "[" + rsComboRange + "]";
|
|
592
|
+
var reComboMark = RegExp(rsCombo, "g");
|
|
593
|
+
function deburr(string) {
|
|
594
|
+
string = toString(string);
|
|
595
|
+
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
|
|
596
|
+
}
|
|
597
|
+
module.exports = deburr;
|
|
598
|
+
}
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js
|
|
602
|
+
var require_asciiWords = __commonJS({
|
|
603
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js"(exports$1, module) {
|
|
604
|
+
var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
605
|
+
function asciiWords(string) {
|
|
606
|
+
return string.match(reAsciiWord) || [];
|
|
607
|
+
}
|
|
608
|
+
module.exports = asciiWords;
|
|
609
|
+
}
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js
|
|
613
|
+
var require_hasUnicodeWord = __commonJS({
|
|
614
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js"(exports$1, module) {
|
|
615
|
+
var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;
|
|
616
|
+
function hasUnicodeWord(string) {
|
|
617
|
+
return reHasUnicodeWord.test(string);
|
|
618
|
+
}
|
|
619
|
+
module.exports = hasUnicodeWord;
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
|
|
623
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js
|
|
624
|
+
var require_unicodeWords = __commonJS({
|
|
625
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js"(exports$1, module) {
|
|
626
|
+
var rsAstralRange = "\\ud800-\\udfff";
|
|
627
|
+
var rsComboMarksRange = "\\u0300-\\u036f";
|
|
628
|
+
var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
|
|
629
|
+
var rsComboSymbolsRange = "\\u20d0-\\u20ff";
|
|
630
|
+
var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
631
|
+
var rsDingbatRange = "\\u2700-\\u27bf";
|
|
632
|
+
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
|
|
633
|
+
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
|
|
634
|
+
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
|
|
635
|
+
var rsPunctuationRange = "\\u2000-\\u206f";
|
|
636
|
+
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
|
|
637
|
+
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
|
|
638
|
+
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
639
|
+
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
640
|
+
var rsApos = "['\u2019]";
|
|
641
|
+
var rsBreak = "[" + rsBreakRange + "]";
|
|
642
|
+
var rsCombo = "[" + rsComboRange + "]";
|
|
643
|
+
var rsDigits = "\\d+";
|
|
644
|
+
var rsDingbat = "[" + rsDingbatRange + "]";
|
|
645
|
+
var rsLower = "[" + rsLowerRange + "]";
|
|
646
|
+
var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
|
|
647
|
+
var rsFitz = "\\ud83c[\\udffb-\\udfff]";
|
|
648
|
+
var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
|
|
649
|
+
var rsNonAstral = "[^" + rsAstralRange + "]";
|
|
650
|
+
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
651
|
+
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
652
|
+
var rsUpper = "[" + rsUpperRange + "]";
|
|
653
|
+
var rsZWJ = "\\u200d";
|
|
654
|
+
var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
|
|
655
|
+
var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
|
|
656
|
+
var rsOptContrLower = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
|
|
657
|
+
var rsOptContrUpper = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
|
|
658
|
+
var reOptMod = rsModifier + "?";
|
|
659
|
+
var rsOptVar = "[" + rsVarRange + "]?";
|
|
660
|
+
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
|
|
661
|
+
var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
|
|
662
|
+
var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
|
|
663
|
+
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
664
|
+
var rsEmoji = "(?:" + [rsDingbat, rsRegional, rsSurrPair].join("|") + ")" + rsSeq;
|
|
665
|
+
var reUnicodeWord = RegExp([
|
|
666
|
+
rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
|
|
667
|
+
rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
|
|
668
|
+
rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
|
|
669
|
+
rsUpper + "+" + rsOptContrUpper,
|
|
670
|
+
rsOrdUpper,
|
|
671
|
+
rsOrdLower,
|
|
672
|
+
rsDigits,
|
|
673
|
+
rsEmoji
|
|
674
|
+
].join("|"), "g");
|
|
675
|
+
function unicodeWords(string) {
|
|
676
|
+
return string.match(reUnicodeWord) || [];
|
|
677
|
+
}
|
|
678
|
+
module.exports = unicodeWords;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js
|
|
683
|
+
var require_words = __commonJS({
|
|
684
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js"(exports$1, module) {
|
|
685
|
+
var asciiWords = require_asciiWords();
|
|
686
|
+
var hasUnicodeWord = require_hasUnicodeWord();
|
|
687
|
+
var toString = require_toString();
|
|
688
|
+
var unicodeWords = require_unicodeWords();
|
|
689
|
+
function words(string, pattern, guard) {
|
|
690
|
+
string = toString(string);
|
|
691
|
+
pattern = guard ? void 0 : pattern;
|
|
692
|
+
if (pattern === void 0) {
|
|
693
|
+
return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
|
|
694
|
+
}
|
|
695
|
+
return string.match(pattern) || [];
|
|
696
|
+
}
|
|
697
|
+
module.exports = words;
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js
|
|
702
|
+
var require_createCompounder = __commonJS({
|
|
703
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js"(exports$1, module) {
|
|
704
|
+
var arrayReduce = require_arrayReduce();
|
|
705
|
+
var deburr = require_deburr();
|
|
706
|
+
var words = require_words();
|
|
707
|
+
var rsApos = "['\u2019]";
|
|
708
|
+
var reApos = RegExp(rsApos, "g");
|
|
709
|
+
function createCompounder(callback) {
|
|
710
|
+
return function(string) {
|
|
711
|
+
return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
module.exports = createCompounder;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js
|
|
719
|
+
var require_camelCase = __commonJS({
|
|
720
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js"(exports$1, module) {
|
|
721
|
+
var capitalize = require_capitalize();
|
|
722
|
+
var createCompounder = require_createCompounder();
|
|
723
|
+
var camelCase3 = createCompounder(function(result, word, index) {
|
|
724
|
+
word = word.toLowerCase();
|
|
725
|
+
return result + (index ? capitalize(word) : word);
|
|
726
|
+
});
|
|
727
|
+
module.exports = camelCase3;
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js
|
|
732
|
+
var require_kebabCase = __commonJS({
|
|
733
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js"(exports$1, module) {
|
|
734
|
+
var createCompounder = require_createCompounder();
|
|
735
|
+
var kebabCase4 = createCompounder(function(result, word, index) {
|
|
736
|
+
return result + (index ? "-" : "") + word.toLowerCase();
|
|
737
|
+
});
|
|
738
|
+
module.exports = kebabCase4;
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
// ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js
|
|
743
|
+
var require_snakeCase = __commonJS({
|
|
744
|
+
"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js"(exports$1, module) {
|
|
745
|
+
var createCompounder = require_createCompounder();
|
|
746
|
+
var snakeCase2 = createCompounder(function(result, word, index) {
|
|
747
|
+
return result + (index ? "_" : "") + word.toLowerCase();
|
|
748
|
+
});
|
|
749
|
+
module.exports = snakeCase2;
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
// src/model/AppNotification.ts
|
|
754
|
+
var NotificationSize = /* @__PURE__ */ ((NotificationSize2) => {
|
|
755
|
+
NotificationSize2["SMALL"] = "small";
|
|
756
|
+
NotificationSize2["NORMAL"] = "normal";
|
|
757
|
+
NotificationSize2["LARGE"] = "large";
|
|
758
|
+
return NotificationSize2;
|
|
759
|
+
})(NotificationSize || {});
|
|
760
|
+
var AppNotification = class {
|
|
761
|
+
type = "info";
|
|
762
|
+
message;
|
|
763
|
+
title;
|
|
764
|
+
targetTime;
|
|
765
|
+
/**
|
|
766
|
+
* 持续时间,单位毫秒
|
|
767
|
+
*/
|
|
768
|
+
duration;
|
|
769
|
+
/**
|
|
770
|
+
* IconPark图标
|
|
771
|
+
* @example close-one
|
|
772
|
+
* @see [IconPark](https://iconpark.oceanengine.com/official)
|
|
773
|
+
*/
|
|
774
|
+
icon;
|
|
775
|
+
color;
|
|
776
|
+
backgroundColor;
|
|
777
|
+
confirmButtonText;
|
|
778
|
+
cancelButtonText;
|
|
779
|
+
cancelBroadcast;
|
|
780
|
+
confirmBroadcast;
|
|
781
|
+
size;
|
|
782
|
+
url;
|
|
783
|
+
avatar;
|
|
784
|
+
audio;
|
|
785
|
+
lyric;
|
|
786
|
+
createdAt;
|
|
787
|
+
constructor(option) {
|
|
788
|
+
this.createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
789
|
+
this.type = option.type ?? "info";
|
|
790
|
+
this.title = option.title;
|
|
791
|
+
this.message = option.message;
|
|
792
|
+
this.targetTime = option.targetTime;
|
|
793
|
+
this.duration = option.duration ?? 5e3;
|
|
794
|
+
this.icon = option.icon;
|
|
795
|
+
this.color = option.color ?? "#5D8AC8";
|
|
796
|
+
this.confirmButtonText = option.confirmButtonText;
|
|
797
|
+
this.cancelButtonText = option.cancelButtonText;
|
|
798
|
+
this.cancelBroadcast = option.cancelBroadcast;
|
|
799
|
+
this.confirmBroadcast = option.confirmBroadcast;
|
|
800
|
+
this.size = option.size ?? "normal" /* NORMAL */;
|
|
801
|
+
this.audio = option.audio;
|
|
802
|
+
this.avatar = option.avatar;
|
|
803
|
+
this.lyric = option.lyric;
|
|
804
|
+
this.backgroundColor = option.backgroundColor ?? "#000000";
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
var AppReminderNotification = class extends AppNotification {
|
|
808
|
+
constructor(option) {
|
|
809
|
+
super(option);
|
|
810
|
+
this.type = "reminder";
|
|
811
|
+
this.size = "large" /* LARGE */;
|
|
812
|
+
}
|
|
813
|
+
};
|
|
814
|
+
|
|
815
|
+
// src/model/AppTheme.ts
|
|
816
|
+
var import_camelCase = __toESM(require_camelCase());
|
|
817
|
+
var import_kebabCase = __toESM(require_kebabCase());
|
|
818
|
+
var DefaultThemeDark = {
|
|
819
|
+
useGlobalTheme: true,
|
|
820
|
+
mode: "dark",
|
|
821
|
+
colors: {
|
|
822
|
+
background: "hsl(0 0% 10%)",
|
|
823
|
+
foreground: "hsl(0 0% 98%)",
|
|
824
|
+
card: "hsl(0 0% 12%)",
|
|
825
|
+
cardForeground: "hsl(0 0% 98%)",
|
|
826
|
+
popover: "hsl(0 0% 12%)",
|
|
827
|
+
popoverForeground: "hsl(0 0% 98%)",
|
|
828
|
+
primary: "hsl(210 100% 56%)",
|
|
829
|
+
primaryForeground: "#fff",
|
|
830
|
+
secondary: "hsl(0 0% 20%)",
|
|
831
|
+
secondaryForeground: "#fff",
|
|
832
|
+
muted: "hsl(0 0% 30%)",
|
|
833
|
+
mutedForeground: "hsl(0 0% 70%)",
|
|
834
|
+
accent: "hsl(210 100% 60%)",
|
|
835
|
+
accentForeground: "#fff",
|
|
836
|
+
destructive: "hsl(0 84% 60%)",
|
|
837
|
+
destructiveForeground: "#fff",
|
|
838
|
+
border: "hsl(0 0% 30%)",
|
|
839
|
+
input: "hsl(0 0% 25%)",
|
|
840
|
+
ring: "hsl(210 100% 60%)"
|
|
841
|
+
},
|
|
842
|
+
radius: {
|
|
843
|
+
sm: "6px",
|
|
844
|
+
md: "10px",
|
|
845
|
+
lg: "16px",
|
|
846
|
+
full: "9999px"
|
|
847
|
+
},
|
|
848
|
+
typography: {
|
|
849
|
+
fontFamily: "system-ui, sans-serif",
|
|
850
|
+
fontSize: "14px"
|
|
851
|
+
},
|
|
852
|
+
shadow: {
|
|
853
|
+
sm: "0 1px 2px rgba(0,0,0,0.2)",
|
|
854
|
+
md: "0 4px 6px rgba(0,0,0,0.3)",
|
|
855
|
+
lg: "0 10px 20px rgba(0,0,0,0.4)"
|
|
856
|
+
},
|
|
857
|
+
spacing: "0.5rem"
|
|
858
|
+
};
|
|
859
|
+
var DefaultThemeLight = {
|
|
860
|
+
...DefaultThemeDark,
|
|
861
|
+
mode: "light",
|
|
862
|
+
colors: {
|
|
863
|
+
background: "#ffffff",
|
|
864
|
+
foreground: "hsl(0 0% 10%)",
|
|
865
|
+
card: "#ffffff",
|
|
866
|
+
cardForeground: "hsl(0 0% 10%)",
|
|
867
|
+
popover: "#ffffff",
|
|
868
|
+
popoverForeground: "hsl(0 0% 10%)",
|
|
869
|
+
primary: "hsl(210 100% 56%)",
|
|
870
|
+
primaryForeground: "#fff",
|
|
871
|
+
secondary: "hsl(0 0% 90%)",
|
|
872
|
+
secondaryForeground: "hsl(0 0% 10%)",
|
|
873
|
+
muted: "hsl(0 0% 95%)",
|
|
874
|
+
mutedForeground: "hsl(0 0% 40%)",
|
|
875
|
+
accent: "hsl(210 100% 90%)",
|
|
876
|
+
accentForeground: "hsl(210 100% 40%)",
|
|
877
|
+
destructive: "hsl(0 84% 60%)",
|
|
878
|
+
destructiveForeground: "#fff",
|
|
879
|
+
border: "hsl(0 0% 90%)",
|
|
880
|
+
input: "hsl(0 0% 85%)",
|
|
881
|
+
ring: "hsl(210 100% 56%)"
|
|
882
|
+
},
|
|
883
|
+
shadow: {
|
|
884
|
+
sm: "0 1px 2px rgba(0,0,0,0.05)",
|
|
885
|
+
md: "0 4px 6px rgba(0,0,0,0.1)",
|
|
886
|
+
lg: "0 10px 20px rgba(0,0,0,0.15)"
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
var DefaultTheme = DefaultThemeDark;
|
|
890
|
+
var AppTheme = class _AppTheme {
|
|
891
|
+
useGlobalTheme;
|
|
892
|
+
mode;
|
|
893
|
+
colors;
|
|
894
|
+
radius;
|
|
895
|
+
typography;
|
|
896
|
+
shadow;
|
|
897
|
+
spacing;
|
|
898
|
+
constructor(options) {
|
|
899
|
+
let parsedOptions = {};
|
|
900
|
+
if (typeof options === "string") {
|
|
901
|
+
try {
|
|
902
|
+
parsedOptions = JSON.parse(options);
|
|
903
|
+
} catch (e) {
|
|
904
|
+
console.error("Failed to parse AppTheme options", e);
|
|
905
|
+
}
|
|
906
|
+
} else if (options) {
|
|
907
|
+
parsedOptions = options;
|
|
908
|
+
}
|
|
909
|
+
const baseTheme = parsedOptions.mode === "light" ? DefaultThemeLight : DefaultThemeDark;
|
|
910
|
+
merge(this, structuredClone(baseTheme), parsedOptions);
|
|
911
|
+
if (this.useGlobalTheme === void 0) {
|
|
912
|
+
this.useGlobalTheme = true;
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
static fromJSON(json) {
|
|
916
|
+
return new _AppTheme(json);
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* 兼容 V1 版本的 CSS 变量
|
|
920
|
+
*/
|
|
921
|
+
toLegacyCSSVariables(prefix = "--widget") {
|
|
922
|
+
const result = {};
|
|
923
|
+
if (this.colors) {
|
|
924
|
+
if (this.colors.background) {
|
|
925
|
+
result[`${prefix}-background-color`] = this.colors.background;
|
|
926
|
+
}
|
|
927
|
+
if (this.colors.foreground) {
|
|
928
|
+
result[`${prefix}-color`] = this.colors.foreground;
|
|
929
|
+
}
|
|
930
|
+
if (this.colors.primary) {
|
|
931
|
+
result[`${prefix}-primary-color`] = this.colors.primary;
|
|
932
|
+
}
|
|
933
|
+
if (this.colors.border) {
|
|
934
|
+
result[`${prefix}-border-color`] = this.colors.border;
|
|
935
|
+
result[`${prefix}-divider-color`] = this.colors.border;
|
|
936
|
+
result[`${prefix}-background-border-color`] = this.colors.border;
|
|
937
|
+
}
|
|
938
|
+
if (this.colors.ring) {
|
|
939
|
+
result[`${prefix}-shadow-color`] = this.colors.ring;
|
|
940
|
+
result[`${prefix}-background-box-shadow-color`] = this.colors.ring;
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
if (this.typography) {
|
|
944
|
+
if (this.typography.fontSize) {
|
|
945
|
+
result[`${prefix}-font-size`] = this.typography.fontSize;
|
|
946
|
+
}
|
|
947
|
+
if (this.typography.fontFamily) {
|
|
948
|
+
result[`${prefix}-font-family`] = this.typography.fontFamily;
|
|
949
|
+
}
|
|
950
|
+
}
|
|
951
|
+
if (this.radius) {
|
|
952
|
+
if (this.radius.lg) {
|
|
953
|
+
result[`${prefix}-border-radius`] = this.radius.lg;
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
if (this.spacing) {
|
|
957
|
+
result[`${prefix}-padding`] = this.spacing;
|
|
958
|
+
}
|
|
959
|
+
return result;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* flatten tokens → CSS variables
|
|
963
|
+
*/
|
|
964
|
+
toCSSVariables(prefix = "--widget") {
|
|
965
|
+
const result = {};
|
|
966
|
+
const tokensToWalk = {
|
|
967
|
+
colors: this.colors,
|
|
968
|
+
radius: this.radius,
|
|
969
|
+
typography: this.typography,
|
|
970
|
+
shadow: this.shadow,
|
|
971
|
+
spacing: this.spacing
|
|
972
|
+
};
|
|
973
|
+
const walk = (obj, path = []) => {
|
|
974
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
975
|
+
if (value === void 0 || value === null) {
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
const newPath = [...path, key];
|
|
979
|
+
if (typeof value === "object") {
|
|
980
|
+
walk(value, newPath);
|
|
981
|
+
} else {
|
|
982
|
+
const varName = `${prefix}-${newPath.map(import_kebabCase.default).join("-")}`;
|
|
983
|
+
result[varName] = String(value);
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
};
|
|
987
|
+
walk(tokensToWalk);
|
|
988
|
+
Object.assign(result, this.toLegacyCSSVariables(prefix));
|
|
989
|
+
return result;
|
|
990
|
+
}
|
|
991
|
+
toCSS(selector = ":root") {
|
|
992
|
+
const vars = this.toCSSVariables();
|
|
993
|
+
const body = Object.entries(vars).map(([k, v]) => ` ${k}: ${v};`).join("\n");
|
|
994
|
+
return `${selector} {
|
|
995
|
+
${body}
|
|
996
|
+
}`;
|
|
997
|
+
}
|
|
998
|
+
injectCSS(el = document.documentElement) {
|
|
999
|
+
const vars = this.toCSSVariables();
|
|
1000
|
+
Object.entries(vars).forEach(([k, v]) => {
|
|
1001
|
+
el.style.setProperty(k, v);
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
removeCSS(el = document.documentElement) {
|
|
1005
|
+
const vars = this.toCSSVariables();
|
|
1006
|
+
Object.keys(vars).forEach((k) => el.style.removeProperty(k));
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* 支持主题切换(light/dark)
|
|
1010
|
+
*/
|
|
1011
|
+
setMode(mode) {
|
|
1012
|
+
if (this.mode === mode) {
|
|
1013
|
+
return;
|
|
1014
|
+
}
|
|
1015
|
+
this.mode = mode;
|
|
1016
|
+
const baseTheme = mode === "light" ? DefaultThemeLight : DefaultThemeDark;
|
|
1017
|
+
this.colors = structuredClone(baseTheme.colors);
|
|
1018
|
+
this.shadow = structuredClone(baseTheme.shadow);
|
|
1019
|
+
}
|
|
1020
|
+
copy(partial) {
|
|
1021
|
+
return new _AppTheme(merge({}, structuredClone(this), partial));
|
|
1022
|
+
}
|
|
1023
|
+
static fromCSS(css) {
|
|
1024
|
+
const ast = parse(css);
|
|
1025
|
+
const rootRule = find(ast, (node, _item, _list) => {
|
|
1026
|
+
if (node.type == "Rule") {
|
|
1027
|
+
const prelude = node.prelude;
|
|
1028
|
+
if (prelude.type == "SelectorList") {
|
|
1029
|
+
const isRoot = prelude.children.some((it) => {
|
|
1030
|
+
return it.type == "Selector" && it.children.some((child) => child.type == "PseudoClassSelector" && child.name == "root");
|
|
1031
|
+
});
|
|
1032
|
+
if (isRoot) {
|
|
1033
|
+
return true;
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return false;
|
|
1038
|
+
});
|
|
1039
|
+
if (rootRule == null) {
|
|
1040
|
+
return new _AppTheme();
|
|
1041
|
+
}
|
|
1042
|
+
const widgetVariables = rootRule.block.children.filter((it) => it.type == "Declaration" && it.property.startsWith("--widget-"));
|
|
1043
|
+
const themeOptions = {};
|
|
1044
|
+
for (const cssNode of widgetVariables) {
|
|
1045
|
+
const propStr = cssNode.property.replace("--widget-", "");
|
|
1046
|
+
const firstDashIndex = propStr.indexOf("-");
|
|
1047
|
+
const value = cssNode.value.value?.trim() || "";
|
|
1048
|
+
if (firstDashIndex !== -1) {
|
|
1049
|
+
const category = propStr.substring(0, firstDashIndex);
|
|
1050
|
+
const property = (0, import_camelCase.default)(propStr.substring(firstDashIndex + 1));
|
|
1051
|
+
if (!themeOptions[category]) {
|
|
1052
|
+
themeOptions[category] = {};
|
|
1053
|
+
}
|
|
1054
|
+
themeOptions[category][property] = value;
|
|
1055
|
+
} else {
|
|
1056
|
+
const category = (0, import_camelCase.default)(propStr);
|
|
1057
|
+
themeOptions[category] = value;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
return new _AppTheme(themeOptions);
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
// src/model/DeployedPage.ts
|
|
1065
|
+
var DeployedPage = class {
|
|
1066
|
+
name;
|
|
1067
|
+
packageName;
|
|
1068
|
+
x = 0;
|
|
1069
|
+
y = 0;
|
|
1070
|
+
height = 600;
|
|
1071
|
+
width = 800;
|
|
1072
|
+
proxy;
|
|
1073
|
+
id;
|
|
1074
|
+
isIgnoreMouseEvents;
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1077
|
+
// src/model/DeployMode.ts
|
|
1078
|
+
var HostedMode = /* @__PURE__ */ ((HostedMode2) => {
|
|
1079
|
+
HostedMode2[HostedMode2["NORMAL"] = 1] = "NORMAL";
|
|
1080
|
+
HostedMode2[HostedMode2["OVERLAP"] = 16] = "OVERLAP";
|
|
1081
|
+
HostedMode2[HostedMode2["WALLPAPER"] = 256] = "WALLPAPER";
|
|
1082
|
+
HostedMode2[HostedMode2["SCREEN"] = 4096] = "SCREEN";
|
|
1083
|
+
HostedMode2[HostedMode2["BACKGROUND"] = 65536] = "BACKGROUND";
|
|
1084
|
+
HostedMode2[HostedMode2["PAGE"] = 1048576] = "PAGE";
|
|
1085
|
+
HostedMode2[HostedMode2["ALL"] = 1118481] = "ALL";
|
|
1086
|
+
return HostedMode2;
|
|
1087
|
+
})(HostedMode || {});
|
|
1088
|
+
var DeployMode = /* @__PURE__ */ ((DeployMode2) => {
|
|
1089
|
+
DeployMode2[DeployMode2["NORMAL"] = 1] = "NORMAL";
|
|
1090
|
+
DeployMode2[DeployMode2["OVERLAP"] = 16] = "OVERLAP";
|
|
1091
|
+
DeployMode2[DeployMode2["BACKGROUND"] = 65536] = "BACKGROUND";
|
|
1092
|
+
DeployMode2[DeployMode2["TRAY"] = 256] = "TRAY";
|
|
1093
|
+
DeployMode2[DeployMode2["ALL"] = 1118481] = "ALL";
|
|
1094
|
+
return DeployMode2;
|
|
1095
|
+
})(DeployMode || {});
|
|
1096
|
+
|
|
1097
|
+
// src/model/DeployedWidget.ts
|
|
1098
|
+
var DeployedWidget = class extends DeployedPage {
|
|
1099
|
+
shortcut;
|
|
1100
|
+
deployMode;
|
|
1101
|
+
isOverlap() {
|
|
1102
|
+
return (this.deployMode & 16 /* OVERLAP */) > 0;
|
|
1103
|
+
}
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
// src/model/event/BroadcastEvent.ts
|
|
1107
|
+
var BroadcastEvent = class {
|
|
1108
|
+
event;
|
|
1109
|
+
sender;
|
|
1110
|
+
payload;
|
|
1111
|
+
constructor(options) {
|
|
1112
|
+
this.event = options.event;
|
|
1113
|
+
this.sender = options.sender;
|
|
1114
|
+
this.payload = options.payload;
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1118
|
+
// src/model/event/WebSocketEvent.ts
|
|
1119
|
+
var WebSocketEventType = /* @__PURE__ */ ((WebSocketEventType2) => {
|
|
1120
|
+
WebSocketEventType2["RESISTER_PACKAGE"] = "ws::cn.widgetjs.core.resister_package";
|
|
1121
|
+
return WebSocketEventType2;
|
|
1122
|
+
})(WebSocketEventType || {});
|
|
1123
|
+
var WebSocketEvent = class {
|
|
1124
|
+
// 类型
|
|
1125
|
+
type;
|
|
1126
|
+
payload;
|
|
1127
|
+
constructor(type, payload) {
|
|
1128
|
+
this.type = type;
|
|
1129
|
+
this.payload = payload;
|
|
1130
|
+
}
|
|
1131
|
+
};
|
|
1132
|
+
|
|
1133
|
+
// src/utils/ElectronUtils.ts
|
|
1134
|
+
var ElectronUtils = class {
|
|
1135
|
+
static hasElectronApi() {
|
|
1136
|
+
return this.getAPI() != null;
|
|
1137
|
+
}
|
|
1138
|
+
/**
|
|
1139
|
+
* 获取ElectronAPI
|
|
1140
|
+
* windows api
|
|
1141
|
+
*/
|
|
1142
|
+
static getAPI() {
|
|
1143
|
+
if (Reflect.has(window, "electronAPI")) {
|
|
1144
|
+
return window.electronAPI;
|
|
1145
|
+
} else if (Reflect.has(window.parent, "electronAPI")) {
|
|
1146
|
+
return window.parent.electronAPI;
|
|
1147
|
+
}
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
static async invokeMethod(channel, method, ...args) {
|
|
1151
|
+
return this.getAPI()?.invoke(channel, method, ...args);
|
|
1152
|
+
}
|
|
1153
|
+
static async invoke(channel, ...args) {
|
|
1154
|
+
return this.getAPI()?.invoke(channel, ...args);
|
|
1155
|
+
}
|
|
1156
|
+
};
|
|
1157
|
+
|
|
1158
|
+
// src/utils/LanguageUtils.ts
|
|
1159
|
+
var LanguageUtils = class {
|
|
1160
|
+
static findText(langMap, localeCode) {
|
|
1161
|
+
const locales = Object.keys(langMap).map((key) => new Intl.Locale(key));
|
|
1162
|
+
const targetLocale = new Intl.Locale(localeCode);
|
|
1163
|
+
let find3 = locales.find((locale) => locale.baseName == targetLocale.baseName);
|
|
1164
|
+
if (!find3) {
|
|
1165
|
+
find3 = locales.find((locale) => locale.language == targetLocale.language);
|
|
1166
|
+
}
|
|
1167
|
+
return find3;
|
|
1168
|
+
}
|
|
1169
|
+
/**
|
|
1170
|
+
* Get text from `LanguageTextMap` by Unicode locale identifier.
|
|
1171
|
+
* `localeCode` > `localeCode` without region > browser default language > English > first language
|
|
1172
|
+
* @param langMap 对象
|
|
1173
|
+
* @param {LanguageCode} localeCode `zh-CN`、`en-US`、 `zh`、`en`
|
|
1174
|
+
* @param fallbackToBrowser
|
|
1175
|
+
*/
|
|
1176
|
+
static getTextByLocate(langMap, localeCode, fallbackToBrowser = true) {
|
|
1177
|
+
let result;
|
|
1178
|
+
if (localeCode) {
|
|
1179
|
+
if (localeCode in langMap) {
|
|
1180
|
+
return langMap[localeCode];
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
if (localeCode) {
|
|
1184
|
+
const find3 = this.findText(langMap, localeCode);
|
|
1185
|
+
if (find3) {
|
|
1186
|
+
return langMap[find3.baseName];
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
if (result == void 0 && fallbackToBrowser) {
|
|
1190
|
+
if (typeof navigator != "undefined" && navigator.languages) {
|
|
1191
|
+
const langCode = navigator.language;
|
|
1192
|
+
result = this.getTextByLocate(langMap, langCode, false);
|
|
1193
|
+
if (result != void 0) {
|
|
1194
|
+
return result;
|
|
1195
|
+
}
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
if (result == void 0) {
|
|
1199
|
+
const find3 = this.findText(langMap, "en");
|
|
1200
|
+
if (find3) {
|
|
1201
|
+
return langMap[find3.baseName];
|
|
1202
|
+
}
|
|
1203
|
+
}
|
|
1204
|
+
if (result == void 0) {
|
|
1205
|
+
const langCode = Object.keys(langMap);
|
|
1206
|
+
if (langCode.length > 0) {
|
|
1207
|
+
return langMap[langCode[0]];
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return void 0;
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
// src/utils/WidgetUtils.ts
|
|
1215
|
+
var WidgetUtils = class {
|
|
1216
|
+
/**
|
|
1217
|
+
* 是否支持悬浮窗
|
|
857
1218
|
*/
|
|
858
1219
|
static isSupportOverlap(supportDeployMode) {
|
|
859
1220
|
return (supportDeployMode & 16 /* OVERLAP */) > 0;
|
|
@@ -1022,67 +1383,7 @@ var Page = class _Page {
|
|
|
1022
1383
|
return this.parseObject(object);
|
|
1023
1384
|
}
|
|
1024
1385
|
static parseObject(obj) {
|
|
1025
|
-
const widget = new _Page({
|
|
1026
|
-
path: "",
|
|
1027
|
-
description: {},
|
|
1028
|
-
height: 0,
|
|
1029
|
-
keywords: [],
|
|
1030
|
-
lang: "zh-CN",
|
|
1031
|
-
name: "",
|
|
1032
|
-
previewImage: "",
|
|
1033
|
-
title: {},
|
|
1034
|
-
width: 0
|
|
1035
|
-
});
|
|
1036
|
-
Object.assign(widget, obj);
|
|
1037
|
-
return widget;
|
|
1038
|
-
}
|
|
1039
|
-
isResizable() {
|
|
1040
|
-
return this.resizable || !(this.minWidth == this.width && this.maxWidth == this.width && this.minHeight == this.height && this.maxHeight == this.height);
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
|
|
1044
|
-
// src/model/Widget.ts
|
|
1045
|
-
var Widget = class _Widget extends Page {
|
|
1046
|
-
categories;
|
|
1047
|
-
supportDeployMode;
|
|
1048
|
-
trayOptions;
|
|
1049
|
-
/**
|
|
1050
|
-
* 组件包所需的App版本
|
|
1051
|
-
*/
|
|
1052
|
-
requiredAppVersion;
|
|
1053
|
-
/**
|
|
1054
|
-
* 如果为true,组件将不会添加到组件包中
|
|
1055
|
-
*/
|
|
1056
|
-
disabled;
|
|
1057
|
-
synchronizable;
|
|
1058
|
-
/**
|
|
1059
|
-
* 配置页面路径,没有则不能修改
|
|
1060
|
-
*/
|
|
1061
|
-
configPagePath;
|
|
1062
|
-
/**
|
|
1063
|
-
* @deprecated
|
|
1064
|
-
*/
|
|
1065
|
-
routes;
|
|
1066
|
-
browserWindowOptions;
|
|
1067
|
-
socialLinks;
|
|
1068
|
-
constructor(options) {
|
|
1069
|
-
super(options);
|
|
1070
|
-
this.configPagePath = options.configPagePath;
|
|
1071
|
-
this.categories = options.categories;
|
|
1072
|
-
this.supportDeployMode = options.supportDeployMode ?? 1 /* NORMAL */ | 16 /* OVERLAP */;
|
|
1073
|
-
this.socialLinks = options.socialLinks;
|
|
1074
|
-
this.disabled = options.disabled;
|
|
1075
|
-
this.trayOptions = options.trayOptions;
|
|
1076
|
-
this.synchronizable = options.synchronizable;
|
|
1077
|
-
this.requiredAppVersion = options.requiredAppVersion;
|
|
1078
|
-
this.routes = options.routes ?? [];
|
|
1079
|
-
}
|
|
1080
|
-
static parseJSON(json) {
|
|
1081
|
-
const object = JSON.parse(json);
|
|
1082
|
-
return this.parseObject(object);
|
|
1083
|
-
}
|
|
1084
|
-
static parseObject(obj) {
|
|
1085
|
-
const widget = new _Widget({
|
|
1386
|
+
const widget = new _Page({
|
|
1086
1387
|
path: "",
|
|
1087
1388
|
description: {},
|
|
1088
1389
|
height: 0,
|
|
@@ -1096,591 +1397,328 @@ var Widget = class _Widget extends Page {
|
|
|
1096
1397
|
Object.assign(widget, obj);
|
|
1097
1398
|
return widget;
|
|
1098
1399
|
}
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
*/
|
|
1102
|
-
isSupportOverlap() {
|
|
1103
|
-
return (this.supportDeployMode & 16 /* OVERLAP */) > 0;
|
|
1104
|
-
}
|
|
1105
|
-
isSupportBackground() {
|
|
1106
|
-
return (this.supportDeployMode & 65536 /* BACKGROUND */) > 0;
|
|
1107
|
-
}
|
|
1108
|
-
isSupportTray() {
|
|
1109
|
-
return (this.supportDeployMode & 256 /* TRAY */) > 0;
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
* 是否支持普通模式
|
|
1113
|
-
*/
|
|
1114
|
-
isSupportNormal() {
|
|
1115
|
-
return (this.supportDeployMode & 1 /* NORMAL */) > 0;
|
|
1116
|
-
}
|
|
1117
|
-
isConfigurable() {
|
|
1118
|
-
return this.configPagePath != null && this.configPagePath != "";
|
|
1119
|
-
}
|
|
1120
|
-
};
|
|
1121
|
-
var BackgroundWidget = class extends Widget {
|
|
1122
|
-
constructor(options) {
|
|
1123
|
-
options.supportDeployMode = 65536 /* BACKGROUND */;
|
|
1124
|
-
options.backgroundThrottling = false;
|
|
1125
|
-
options.width = 1;
|
|
1126
|
-
options.height = 1;
|
|
1127
|
-
super(options);
|
|
1128
|
-
this.browserWindowOptions = options.browserWindowOptions;
|
|
1129
|
-
}
|
|
1130
|
-
};
|
|
1131
|
-
var WidgetKeyword = /* @__PURE__ */ ((WidgetKeyword2) => {
|
|
1132
|
-
WidgetKeyword2["RECOMMEND"] = "recommend";
|
|
1133
|
-
WidgetKeyword2["TOOLS"] = "tools";
|
|
1134
|
-
WidgetKeyword2["EFFICIENCY"] = "efficiency";
|
|
1135
|
-
WidgetKeyword2["PICTURE"] = "picture";
|
|
1136
|
-
WidgetKeyword2["LIFE"] = "life";
|
|
1137
|
-
WidgetKeyword2["SHORTCUT"] = "shortcut";
|
|
1138
|
-
WidgetKeyword2["COUNTDOWN"] = "countdown";
|
|
1139
|
-
WidgetKeyword2["TIMER"] = "timer";
|
|
1140
|
-
WidgetKeyword2["INFO"] = "info";
|
|
1141
|
-
WidgetKeyword2["DASHBOARD"] = "dashboard";
|
|
1142
|
-
return WidgetKeyword2;
|
|
1143
|
-
})(WidgetKeyword || {});
|
|
1144
|
-
|
|
1145
|
-
// src/model/event/BroadcastEvent.ts
|
|
1146
|
-
var BroadcastEvent = class {
|
|
1147
|
-
event;
|
|
1148
|
-
sender;
|
|
1149
|
-
payload;
|
|
1150
|
-
constructor(options) {
|
|
1151
|
-
this.event = options.event;
|
|
1152
|
-
this.sender = options.sender;
|
|
1153
|
-
this.payload = options.payload;
|
|
1154
|
-
}
|
|
1155
|
-
};
|
|
1156
|
-
|
|
1157
|
-
// src/model/event/WebSocketEvent.ts
|
|
1158
|
-
var WebSocketEventType = /* @__PURE__ */ ((WebSocketEventType2) => {
|
|
1159
|
-
WebSocketEventType2["RESISTER_PACKAGE"] = "ws::cn.widgetjs.core.resister_package";
|
|
1160
|
-
return WebSocketEventType2;
|
|
1161
|
-
})(WebSocketEventType || {});
|
|
1162
|
-
var WebSocketEvent = class {
|
|
1163
|
-
// 类型
|
|
1164
|
-
type;
|
|
1165
|
-
payload;
|
|
1166
|
-
constructor(type, payload) {
|
|
1167
|
-
this.type = type;
|
|
1168
|
-
this.payload = payload;
|
|
1400
|
+
isResizable() {
|
|
1401
|
+
return this.resizable || !(this.minWidth == this.width && this.maxWidth == this.width && this.minHeight == this.height && this.maxHeight == this.height);
|
|
1169
1402
|
}
|
|
1170
1403
|
};
|
|
1171
1404
|
|
|
1172
|
-
// src/model/
|
|
1173
|
-
var
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
borderRadius;
|
|
1180
|
-
backgroundColor;
|
|
1181
|
-
fontSize;
|
|
1182
|
-
dividerColor;
|
|
1183
|
-
/**
|
|
1184
|
-
* 主色调
|
|
1185
|
-
*/
|
|
1186
|
-
primaryColor;
|
|
1187
|
-
backgroundBorderColor;
|
|
1188
|
-
backgroundBoxShadowColor;
|
|
1189
|
-
/**
|
|
1190
|
-
* 文字颜色
|
|
1191
|
-
*/
|
|
1192
|
-
color;
|
|
1193
|
-
fontFamily;
|
|
1194
|
-
shadowColor;
|
|
1195
|
-
padding;
|
|
1196
|
-
borderColor;
|
|
1197
|
-
useGlobalTheme;
|
|
1198
|
-
constructor(options) {
|
|
1199
|
-
Object.assign(this, options ?? DefaultWidgetTheme);
|
|
1200
|
-
if (this.useGlobalTheme == void 0) {
|
|
1201
|
-
this.useGlobalTheme = true;
|
|
1202
|
-
}
|
|
1203
|
-
}
|
|
1204
|
-
static fromJSON(json) {
|
|
1205
|
-
return new _WidgetTheme(JSON.parse(json));
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Injects the style properties as css variable.
|
|
1209
|
-
* @param selector default is 'body'
|
|
1210
|
-
*/
|
|
1211
|
-
toCSS(selector = ":root") {
|
|
1212
|
-
const variables = this.toCSSVariable();
|
|
1213
|
-
const cssVariables = Object.keys(variables).map((key) => {
|
|
1214
|
-
return `${key}: ${variables[key]};`;
|
|
1215
|
-
}).join("\n");
|
|
1216
|
-
return `${selector} {
|
|
1217
|
-
${cssVariables}
|
|
1218
|
-
}`;
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* Injects the style properties as css variable.
|
|
1222
|
-
* @param rootElement The rootElement to inject the css.
|
|
1223
|
-
* @remarks Only works in a browser environment.
|
|
1224
|
-
*/
|
|
1225
|
-
injectCSS(rootElement) {
|
|
1226
|
-
const element = rootElement ?? document.documentElement;
|
|
1227
|
-
const cssVariables = this.toCSSVariable();
|
|
1228
|
-
Object.keys(cssVariables).forEach((key) => {
|
|
1229
|
-
element.style.setProperty(key, cssVariables[key].toString());
|
|
1230
|
-
});
|
|
1231
|
-
}
|
|
1232
|
-
removeCSS(rootElement) {
|
|
1233
|
-
const element = rootElement ?? document.documentElement;
|
|
1234
|
-
const cssVariables = this.toCSSVariable();
|
|
1235
|
-
Object.keys(cssVariables).forEach((key) => {
|
|
1236
|
-
element.style.removeProperty(key);
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
copy(options) {
|
|
1240
|
-
return new _WidgetTheme({ ...this, ...options });
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Gets the style properties from the widget's style object.
|
|
1244
|
-
* @returns A record representing CSS custom variable and their values.
|
|
1245
|
-
*/
|
|
1246
|
-
toCSSVariable() {
|
|
1247
|
-
const variables = {};
|
|
1248
|
-
const prefix = "--widget-";
|
|
1249
|
-
const keys = Object.keys(this);
|
|
1250
|
-
keys.filter((key) => this[key] != void 0).forEach((key) => {
|
|
1251
|
-
variables[`${prefix}${(0, import_kebabCase.default)(key)}`] = `${this[key]}`;
|
|
1252
|
-
});
|
|
1253
|
-
return variables;
|
|
1254
|
-
}
|
|
1255
|
-
toCSSProperties() {
|
|
1256
|
-
const properties = {};
|
|
1257
|
-
const keys = Object.keys(this);
|
|
1258
|
-
keys.filter((key) => this[key] != void 0).forEach((key) => {
|
|
1259
|
-
properties[`${(0, import_kebabCase.default)(key)}`] = `${this[key]}`;
|
|
1260
|
-
});
|
|
1261
|
-
return properties;
|
|
1262
|
-
}
|
|
1263
|
-
static fromCSS(css) {
|
|
1264
|
-
const ast = parse(css);
|
|
1265
|
-
const rootRule = find(ast, (node, _item, _list) => {
|
|
1266
|
-
if (node.type == "Rule") {
|
|
1267
|
-
const prelude = node.prelude;
|
|
1268
|
-
if (prelude.type == "SelectorList") {
|
|
1269
|
-
const isRoot = prelude.children.some((it) => {
|
|
1270
|
-
return it.type == "Selector" && it.children.some((child) => child.type == "PseudoClassSelector" && child.name == "root");
|
|
1271
|
-
});
|
|
1272
|
-
if (isRoot) {
|
|
1273
|
-
return true;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
return false;
|
|
1278
|
-
});
|
|
1279
|
-
if (rootRule == null) {
|
|
1280
|
-
return DefaultWidgetTheme.copy();
|
|
1281
|
-
}
|
|
1282
|
-
const widgetVariables = rootRule.block.children.filter((it) => it.type == "Declaration" && it.property.startsWith("--widget-"));
|
|
1283
|
-
const themeOptions = {};
|
|
1284
|
-
for (const cssNode of widgetVariables) {
|
|
1285
|
-
const prop = (0, import_camelCase.default)(cssNode.property.replace("--widget-", ""));
|
|
1286
|
-
themeOptions[prop] = cssNode.value.value.trim();
|
|
1287
|
-
}
|
|
1288
|
-
return new _WidgetTheme(themeOptions);
|
|
1405
|
+
// src/model/SocialInfo.ts
|
|
1406
|
+
var SocialInfo = class {
|
|
1407
|
+
content;
|
|
1408
|
+
name;
|
|
1409
|
+
constructor(name, content) {
|
|
1410
|
+
this.name = name;
|
|
1411
|
+
this.content = content;
|
|
1289
1412
|
}
|
|
1290
1413
|
};
|
|
1291
|
-
var DefaultWidgetTheme = new WidgetTheme(
|
|
1292
|
-
{
|
|
1293
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
1294
|
-
color: "#fff",
|
|
1295
|
-
fontSize: "14px",
|
|
1296
|
-
borderColor: "rgba(255,255,255,0.4)",
|
|
1297
|
-
dividerColor: "rgba(255,255,255,0.4)",
|
|
1298
|
-
primaryColor: "rgb(0, 149, 255)",
|
|
1299
|
-
borderRadius: "22px",
|
|
1300
|
-
backgroundBorderColor: "hsla(0,0%,100%,.06)",
|
|
1301
|
-
backgroundBoxShadowColor: "hsla(0, 0%, 100%, 0.1)"
|
|
1302
|
-
}
|
|
1303
|
-
);
|
|
1304
|
-
Object.freeze(DefaultWidgetTheme);
|
|
1305
1414
|
|
|
1306
|
-
// src/model/
|
|
1307
|
-
var
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
id;
|
|
1312
|
-
/**
|
|
1313
|
-
* 组件名
|
|
1314
|
-
*/
|
|
1315
|
-
name;
|
|
1316
|
-
/**
|
|
1317
|
-
* 背景颜色
|
|
1318
|
-
* @deprecated
|
|
1319
|
-
*/
|
|
1320
|
-
backgroundColor;
|
|
1321
|
-
/**
|
|
1322
|
-
* 文字颜色
|
|
1323
|
-
* @deprecated
|
|
1324
|
-
*/
|
|
1325
|
-
color;
|
|
1415
|
+
// src/model/Widget.ts
|
|
1416
|
+
var Widget = class _Widget extends Page {
|
|
1417
|
+
categories;
|
|
1418
|
+
supportDeployMode;
|
|
1419
|
+
trayOptions;
|
|
1326
1420
|
/**
|
|
1327
|
-
*
|
|
1328
|
-
* @deprecated
|
|
1421
|
+
* 组件包所需的App版本
|
|
1329
1422
|
*/
|
|
1330
|
-
|
|
1423
|
+
requiredAppVersion;
|
|
1331
1424
|
/**
|
|
1332
|
-
*
|
|
1333
|
-
* @deprecated
|
|
1425
|
+
* 如果为true,组件将不会添加到组件包中
|
|
1334
1426
|
*/
|
|
1335
|
-
|
|
1427
|
+
disabled;
|
|
1428
|
+
synchronizable;
|
|
1336
1429
|
/**
|
|
1337
|
-
*
|
|
1338
|
-
* @deprecated
|
|
1430
|
+
* 配置页面路径,没有则不能修改
|
|
1339
1431
|
*/
|
|
1340
|
-
|
|
1432
|
+
configPagePath;
|
|
1341
1433
|
/**
|
|
1342
|
-
* 组件样式
|
|
1343
1434
|
* @deprecated
|
|
1344
1435
|
*/
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1436
|
+
routes;
|
|
1437
|
+
browserWindowOptions;
|
|
1438
|
+
socialLinks;
|
|
1439
|
+
constructor(options) {
|
|
1440
|
+
super(options);
|
|
1441
|
+
this.configPagePath = options.configPagePath;
|
|
1442
|
+
this.categories = options.categories;
|
|
1443
|
+
this.supportDeployMode = options.supportDeployMode ?? 1 /* NORMAL */ | 16 /* OVERLAP */;
|
|
1444
|
+
this.socialLinks = options.socialLinks;
|
|
1445
|
+
this.disabled = options.disabled;
|
|
1446
|
+
this.trayOptions = options.trayOptions;
|
|
1447
|
+
this.synchronizable = options.synchronizable;
|
|
1448
|
+
this.requiredAppVersion = options.requiredAppVersion;
|
|
1449
|
+
this.routes = options.routes ?? [];
|
|
1350
1450
|
}
|
|
1351
|
-
parseJSON(json) {
|
|
1352
|
-
|
|
1451
|
+
static parseJSON(json) {
|
|
1452
|
+
const object = JSON.parse(json);
|
|
1453
|
+
return this.parseObject(object);
|
|
1454
|
+
}
|
|
1455
|
+
static parseObject(obj) {
|
|
1456
|
+
const widget = new _Widget({
|
|
1457
|
+
path: "",
|
|
1458
|
+
description: {},
|
|
1459
|
+
height: 0,
|
|
1460
|
+
keywords: [],
|
|
1461
|
+
lang: "zh-CN",
|
|
1462
|
+
name: "",
|
|
1463
|
+
previewImage: "",
|
|
1464
|
+
title: {},
|
|
1465
|
+
width: 0
|
|
1466
|
+
});
|
|
1467
|
+
Object.assign(widget, obj);
|
|
1468
|
+
return widget;
|
|
1353
1469
|
}
|
|
1354
1470
|
/**
|
|
1355
|
-
*
|
|
1356
|
-
* @returns A record representing CSS custom properties and their values.
|
|
1471
|
+
* 是否支持悬浮窗
|
|
1357
1472
|
*/
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
}
|
|
1367
|
-
return properties;
|
|
1473
|
+
isSupportOverlap() {
|
|
1474
|
+
return (this.supportDeployMode & 16 /* OVERLAP */) > 0;
|
|
1475
|
+
}
|
|
1476
|
+
isSupportBackground() {
|
|
1477
|
+
return (this.supportDeployMode & 65536 /* BACKGROUND */) > 0;
|
|
1478
|
+
}
|
|
1479
|
+
isSupportTray() {
|
|
1480
|
+
return (this.supportDeployMode & 256 /* TRAY */) > 0;
|
|
1368
1481
|
}
|
|
1369
1482
|
/**
|
|
1370
|
-
*
|
|
1371
|
-
* @remarks Only works in a browser environment.
|
|
1483
|
+
* 是否支持普通模式
|
|
1372
1484
|
*/
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1485
|
+
isSupportNormal() {
|
|
1486
|
+
return (this.supportDeployMode & 1 /* NORMAL */) > 0;
|
|
1487
|
+
}
|
|
1488
|
+
isConfigurable() {
|
|
1489
|
+
return this.configPagePath != null && this.configPagePath != "";
|
|
1378
1490
|
}
|
|
1379
1491
|
};
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
var PLUS_RE = /\+/g;
|
|
1389
|
-
var ENC_BRACKET_OPEN_RE = /%5B/g;
|
|
1390
|
-
var ENC_BRACKET_CLOSE_RE = /%5D/g;
|
|
1391
|
-
var ENC_CARET_RE = /%5E/g;
|
|
1392
|
-
var ENC_BACKTICK_RE = /%60/g;
|
|
1393
|
-
var ENC_CURLY_OPEN_RE = /%7B/g;
|
|
1394
|
-
var ENC_PIPE_RE = /%7C/g;
|
|
1395
|
-
var ENC_CURLY_CLOSE_RE = /%7D/g;
|
|
1396
|
-
var ENC_SPACE_RE = /%20/g;
|
|
1397
|
-
function commonEncode(text) {
|
|
1398
|
-
return encodeURI(`${text}`).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
|
|
1399
|
-
}
|
|
1400
|
-
function encodeQueryValue(text) {
|
|
1401
|
-
return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
1402
|
-
}
|
|
1403
|
-
function encodeQueryKey(text) {
|
|
1404
|
-
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
1405
|
-
}
|
|
1406
|
-
function decode(text) {
|
|
1407
|
-
try {
|
|
1408
|
-
return decodeURIComponent(`${text}`);
|
|
1409
|
-
} catch (err) {
|
|
1492
|
+
var BackgroundWidget = class extends Widget {
|
|
1493
|
+
constructor(options) {
|
|
1494
|
+
options.supportDeployMode = 65536 /* BACKGROUND */;
|
|
1495
|
+
options.backgroundThrottling = false;
|
|
1496
|
+
options.width = 1;
|
|
1497
|
+
options.height = 1;
|
|
1498
|
+
super(options);
|
|
1499
|
+
this.browserWindowOptions = options.browserWindowOptions;
|
|
1410
1500
|
}
|
|
1411
|
-
|
|
1412
|
-
|
|
1501
|
+
};
|
|
1502
|
+
var WidgetKeyword = /* @__PURE__ */ ((WidgetKeyword2) => {
|
|
1503
|
+
WidgetKeyword2["RECOMMEND"] = "recommend";
|
|
1504
|
+
WidgetKeyword2["TOOLS"] = "tools";
|
|
1505
|
+
WidgetKeyword2["EFFICIENCY"] = "efficiency";
|
|
1506
|
+
WidgetKeyword2["PICTURE"] = "picture";
|
|
1507
|
+
WidgetKeyword2["LIFE"] = "life";
|
|
1508
|
+
WidgetKeyword2["SHORTCUT"] = "shortcut";
|
|
1509
|
+
WidgetKeyword2["COUNTDOWN"] = "countdown";
|
|
1510
|
+
WidgetKeyword2["TIMER"] = "timer";
|
|
1511
|
+
WidgetKeyword2["INFO"] = "info";
|
|
1512
|
+
WidgetKeyword2["DASHBOARD"] = "dashboard";
|
|
1513
|
+
return WidgetKeyword2;
|
|
1514
|
+
})(WidgetKeyword || {});
|
|
1413
1515
|
|
|
1414
|
-
// src/
|
|
1415
|
-
var
|
|
1416
|
-
function parseQuery(search) {
|
|
1417
|
-
const query = {};
|
|
1418
|
-
if (search === "" || search === "?") {
|
|
1419
|
-
return query;
|
|
1420
|
-
}
|
|
1421
|
-
const hasLeadingIM = search[0] === "?";
|
|
1422
|
-
const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&");
|
|
1423
|
-
for (let i = 0; i < searchParams.length; ++i) {
|
|
1424
|
-
const searchParam = searchParams[i].replace(PLUS_RE, " ");
|
|
1425
|
-
const eqPos = searchParam.indexOf("=");
|
|
1426
|
-
const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
|
|
1427
|
-
const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
|
|
1428
|
-
if (key in query) {
|
|
1429
|
-
let currentValue = query[key];
|
|
1430
|
-
if (!isArray(currentValue)) {
|
|
1431
|
-
currentValue = query[key] = [currentValue];
|
|
1432
|
-
}
|
|
1433
|
-
currentValue.push(value);
|
|
1434
|
-
} else {
|
|
1435
|
-
query[key] = value;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
return query;
|
|
1439
|
-
}
|
|
1440
|
-
function stringifyQuery(query) {
|
|
1441
|
-
let search = "";
|
|
1442
|
-
for (let key in query) {
|
|
1443
|
-
const value = query[key];
|
|
1444
|
-
key = encodeQueryKey(key);
|
|
1445
|
-
if (value == null) {
|
|
1446
|
-
if (value !== void 0) {
|
|
1447
|
-
search += (search.length ? "&" : "") + key;
|
|
1448
|
-
}
|
|
1449
|
-
continue;
|
|
1450
|
-
}
|
|
1451
|
-
const values = isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)];
|
|
1452
|
-
values.forEach((value2) => {
|
|
1453
|
-
if (value2 !== void 0) {
|
|
1454
|
-
search += (search.length ? "&" : "") + key;
|
|
1455
|
-
if (value2 != null) {
|
|
1456
|
-
search += `=${value2}`;
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
});
|
|
1460
|
-
}
|
|
1461
|
-
return search;
|
|
1462
|
-
}
|
|
1516
|
+
// src/model/WidgetData.ts
|
|
1517
|
+
var import_kebabCase3 = __toESM(require_kebabCase());
|
|
1463
1518
|
|
|
1464
|
-
// src/model/
|
|
1465
|
-
var
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
static PARAM_TITLE = "title";
|
|
1473
|
-
static PARAM_PREVIEW = "preview";
|
|
1474
|
-
static PARAMS = [
|
|
1475
|
-
_WidgetParams.PARAM_ID,
|
|
1476
|
-
_WidgetParams.PARAM_LANG,
|
|
1477
|
-
_WidgetParams.PARAM_THEME,
|
|
1478
|
-
_WidgetParams.PARAM_MODE,
|
|
1479
|
-
_WidgetParams.PARAM_NAME,
|
|
1480
|
-
_WidgetParams.PARAM_TITLE,
|
|
1481
|
-
_WidgetParams.PARAM_PREVIEW
|
|
1482
|
-
];
|
|
1483
|
-
// 组件id
|
|
1484
|
-
id;
|
|
1485
|
-
// 网格宽度,1就代表宽度占用1格
|
|
1486
|
-
width;
|
|
1487
|
-
// 宽度,单位px
|
|
1488
|
-
widthPx;
|
|
1489
|
-
// 宽度,单位px
|
|
1490
|
-
heightPx;
|
|
1491
|
-
// 网格高度,2就代表高度占用2格
|
|
1492
|
-
height;
|
|
1493
|
-
x;
|
|
1494
|
-
y;
|
|
1495
|
-
// 是否是预览模式,添加组件时,预览状态
|
|
1496
|
-
preview;
|
|
1497
|
-
// 语言环境:zh,en,jp...
|
|
1498
|
-
lang;
|
|
1499
|
-
// 主题:浅色,深色
|
|
1500
|
-
theme;
|
|
1501
|
-
//
|
|
1502
|
-
mode;
|
|
1503
|
-
// 系统设置的组件圆角半径
|
|
1504
|
-
radius;
|
|
1505
|
-
// 组件名
|
|
1506
|
-
name;
|
|
1507
|
-
title;
|
|
1519
|
+
// src/model/WidgetTheme.ts
|
|
1520
|
+
var import_camelCase2 = __toESM(require_camelCase());
|
|
1521
|
+
var import_kebabCase2 = __toESM(require_kebabCase());
|
|
1522
|
+
var WidgetTheme = class _WidgetTheme {
|
|
1523
|
+
borderRadius;
|
|
1524
|
+
backgroundColor;
|
|
1525
|
+
fontSize;
|
|
1526
|
+
dividerColor;
|
|
1508
1527
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
* @param object
|
|
1511
|
-
* @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
|
|
1528
|
+
* 主色调
|
|
1512
1529
|
*/
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1530
|
+
primaryColor;
|
|
1531
|
+
backgroundBorderColor;
|
|
1532
|
+
backgroundBoxShadowColor;
|
|
1533
|
+
/**
|
|
1534
|
+
* 文字颜色
|
|
1535
|
+
*/
|
|
1536
|
+
color;
|
|
1537
|
+
fontFamily;
|
|
1538
|
+
shadowColor;
|
|
1539
|
+
padding;
|
|
1540
|
+
borderColor;
|
|
1541
|
+
useGlobalTheme;
|
|
1542
|
+
constructor(options) {
|
|
1543
|
+
Object.assign(this, options ?? DefaultWidgetTheme);
|
|
1544
|
+
if (this.useGlobalTheme == void 0) {
|
|
1545
|
+
this.useGlobalTheme = true;
|
|
1522
1546
|
}
|
|
1523
|
-
return urlParams;
|
|
1524
1547
|
}
|
|
1525
|
-
|
|
1526
|
-
return
|
|
1548
|
+
static fromJSON(json) {
|
|
1549
|
+
return new _WidgetTheme(JSON.parse(json));
|
|
1527
1550
|
}
|
|
1528
1551
|
/**
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
* =>
|
|
1532
|
-
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
1552
|
+
* Injects the style properties as css variable.
|
|
1553
|
+
* @param selector default is 'body'
|
|
1533
1554
|
*/
|
|
1534
|
-
|
|
1535
|
-
const
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1555
|
+
toCSS(selector = ":root") {
|
|
1556
|
+
const variables = this.toCSSVariable();
|
|
1557
|
+
const cssVariables = Object.keys(variables).map((key) => {
|
|
1558
|
+
return `${key}: ${variables[key]};`;
|
|
1559
|
+
}).join("\n");
|
|
1560
|
+
return `${selector} {
|
|
1561
|
+
${cssVariables}
|
|
1562
|
+
}`;
|
|
1542
1563
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1564
|
+
/**
|
|
1565
|
+
* Injects the style properties as css variable.
|
|
1566
|
+
* @param rootElement The rootElement to inject the css.
|
|
1567
|
+
* @remarks Only works in a browser environment.
|
|
1568
|
+
*/
|
|
1569
|
+
injectCSS(rootElement) {
|
|
1570
|
+
const element = rootElement ?? document.documentElement;
|
|
1571
|
+
const cssVariables = this.toCSSVariable();
|
|
1572
|
+
Object.keys(cssVariables).forEach((key) => {
|
|
1573
|
+
element.style.setProperty(key, cssVariables[key].toString());
|
|
1574
|
+
});
|
|
1550
1575
|
}
|
|
1551
|
-
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
widgetEnv.mode = Number.parseInt(value);
|
|
1561
|
-
} else if (keyWithoutPrefix == _WidgetParams.PARAM_NAME) {
|
|
1562
|
-
widgetEnv.name = value;
|
|
1563
|
-
} else if (keyWithoutPrefix == _WidgetParams.PARAM_TITLE) {
|
|
1564
|
-
widgetEnv.title = value;
|
|
1565
|
-
} else if (keyWithoutPrefix == _WidgetParams.PARAM_PREVIEW) {
|
|
1566
|
-
widgetEnv.preview = value === "true";
|
|
1567
|
-
}
|
|
1576
|
+
removeCSS(rootElement) {
|
|
1577
|
+
const element = rootElement ?? document.documentElement;
|
|
1578
|
+
const cssVariables = this.toCSSVariable();
|
|
1579
|
+
Object.keys(cssVariables).forEach((key) => {
|
|
1580
|
+
element.style.removeProperty(key);
|
|
1581
|
+
});
|
|
1582
|
+
}
|
|
1583
|
+
copy(options) {
|
|
1584
|
+
return new _WidgetTheme({ ...this, ...options });
|
|
1568
1585
|
}
|
|
1569
1586
|
/**
|
|
1570
|
-
*
|
|
1571
|
-
*
|
|
1572
|
-
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
1573
|
-
* @param object
|
|
1587
|
+
* Gets the style properties from the widget's style object.
|
|
1588
|
+
* @returns A record representing CSS custom variable and their values.
|
|
1574
1589
|
*/
|
|
1575
|
-
|
|
1576
|
-
const
|
|
1577
|
-
const
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1590
|
+
toCSSVariable() {
|
|
1591
|
+
const variables = {};
|
|
1592
|
+
const prefix = "--widget-";
|
|
1593
|
+
const keys = Object.keys(this);
|
|
1594
|
+
keys.filter((key) => this[key] != void 0).forEach((key) => {
|
|
1595
|
+
variables[`${prefix}${(0, import_kebabCase2.default)(key)}`] = `${this[key]}`;
|
|
1596
|
+
});
|
|
1597
|
+
return variables;
|
|
1598
|
+
}
|
|
1599
|
+
toCSSProperties() {
|
|
1600
|
+
const properties = {};
|
|
1601
|
+
const keys = Object.keys(this);
|
|
1602
|
+
keys.filter((key) => this[key] != void 0).forEach((key) => {
|
|
1603
|
+
properties[`${(0, import_kebabCase2.default)(key)}`] = `${this[key]}`;
|
|
1604
|
+
});
|
|
1605
|
+
return properties;
|
|
1606
|
+
}
|
|
1607
|
+
static fromCSS(css) {
|
|
1608
|
+
const ast = parse(css);
|
|
1609
|
+
const rootRule = find(ast, (node, _item, _list) => {
|
|
1610
|
+
if (node.type == "Rule") {
|
|
1611
|
+
const prelude = node.prelude;
|
|
1612
|
+
if (prelude.type == "SelectorList") {
|
|
1613
|
+
const isRoot = prelude.children.some((it) => {
|
|
1614
|
+
return it.type == "Selector" && it.children.some((child) => child.type == "PseudoClassSelector" && child.name == "root");
|
|
1615
|
+
});
|
|
1616
|
+
if (isRoot) {
|
|
1617
|
+
return true;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return false;
|
|
1622
|
+
});
|
|
1623
|
+
if (rootRule == null) {
|
|
1624
|
+
return DefaultWidgetTheme.copy();
|
|
1582
1625
|
}
|
|
1583
|
-
|
|
1626
|
+
const widgetVariables = rootRule.block.children.filter((it) => it.type == "Declaration" && it.property.startsWith("--widget-"));
|
|
1627
|
+
const themeOptions = {};
|
|
1628
|
+
for (const cssNode of widgetVariables) {
|
|
1629
|
+
const prop = (0, import_camelCase2.default)(cssNode.property.replace("--widget-", ""));
|
|
1630
|
+
themeOptions[prop] = cssNode.value.value.trim();
|
|
1631
|
+
}
|
|
1632
|
+
return new _WidgetTheme(themeOptions);
|
|
1584
1633
|
}
|
|
1585
1634
|
};
|
|
1586
|
-
var
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1635
|
+
var DefaultWidgetTheme = new WidgetTheme(
|
|
1636
|
+
{
|
|
1637
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
1638
|
+
color: "#fff",
|
|
1639
|
+
fontSize: "14px",
|
|
1640
|
+
borderColor: "rgba(255,255,255,0.4)",
|
|
1641
|
+
dividerColor: "rgba(255,255,255,0.4)",
|
|
1642
|
+
primaryColor: "rgb(0, 149, 255)",
|
|
1643
|
+
borderRadius: "22px",
|
|
1644
|
+
backgroundBorderColor: "hsla(0,0%,100%,.06)",
|
|
1645
|
+
backgroundBoxShadowColor: "hsla(0, 0%, 100%, 0.1)"
|
|
1646
|
+
}
|
|
1647
|
+
);
|
|
1648
|
+
Object.freeze(DefaultWidgetTheme);
|
|
1592
1649
|
|
|
1593
|
-
// src/model/
|
|
1594
|
-
var
|
|
1595
|
-
NotificationSize2["SMALL"] = "small";
|
|
1596
|
-
NotificationSize2["NORMAL"] = "normal";
|
|
1597
|
-
NotificationSize2["LARGE"] = "large";
|
|
1598
|
-
return NotificationSize2;
|
|
1599
|
-
})(NotificationSize || {});
|
|
1600
|
-
var AppNotification = class {
|
|
1601
|
-
type = "info";
|
|
1602
|
-
message;
|
|
1603
|
-
title;
|
|
1604
|
-
targetTime;
|
|
1650
|
+
// src/model/WidgetData.ts
|
|
1651
|
+
var WidgetData = class {
|
|
1605
1652
|
/**
|
|
1606
|
-
*
|
|
1653
|
+
* 组件id
|
|
1607
1654
|
*/
|
|
1608
|
-
|
|
1655
|
+
id;
|
|
1609
1656
|
/**
|
|
1610
|
-
*
|
|
1611
|
-
* @example close-one
|
|
1612
|
-
* @see [IconPark](https://iconpark.oceanengine.com/official)
|
|
1657
|
+
* 组件名
|
|
1613
1658
|
*/
|
|
1614
|
-
icon;
|
|
1615
|
-
color;
|
|
1616
|
-
backgroundColor;
|
|
1617
|
-
confirmButtonText;
|
|
1618
|
-
cancelButtonText;
|
|
1619
|
-
cancelBroadcast;
|
|
1620
|
-
confirmBroadcast;
|
|
1621
|
-
size;
|
|
1622
|
-
url;
|
|
1623
|
-
avatar;
|
|
1624
|
-
audio;
|
|
1625
|
-
lyric;
|
|
1626
|
-
createdAt;
|
|
1627
|
-
constructor(option) {
|
|
1628
|
-
this.createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1629
|
-
this.type = option.type ?? "info";
|
|
1630
|
-
this.title = option.title;
|
|
1631
|
-
this.message = option.message;
|
|
1632
|
-
this.targetTime = option.targetTime;
|
|
1633
|
-
this.duration = option.duration ?? 5e3;
|
|
1634
|
-
this.icon = option.icon;
|
|
1635
|
-
this.color = option.color ?? "#5D8AC8";
|
|
1636
|
-
this.confirmButtonText = option.confirmButtonText;
|
|
1637
|
-
this.cancelButtonText = option.cancelButtonText;
|
|
1638
|
-
this.cancelBroadcast = option.cancelBroadcast;
|
|
1639
|
-
this.confirmBroadcast = option.confirmBroadcast;
|
|
1640
|
-
this.size = option.size ?? "normal" /* NORMAL */;
|
|
1641
|
-
this.audio = option.audio;
|
|
1642
|
-
this.avatar = option.avatar;
|
|
1643
|
-
this.lyric = option.lyric;
|
|
1644
|
-
this.backgroundColor = option.backgroundColor ?? "#000000";
|
|
1645
|
-
}
|
|
1646
|
-
};
|
|
1647
|
-
var AppReminderNotification = class extends AppNotification {
|
|
1648
|
-
constructor(option) {
|
|
1649
|
-
super(option);
|
|
1650
|
-
this.type = "reminder";
|
|
1651
|
-
this.size = "large" /* LARGE */;
|
|
1652
|
-
}
|
|
1653
|
-
};
|
|
1654
|
-
|
|
1655
|
-
// src/model/DeployedPage.ts
|
|
1656
|
-
var DeployedPage = class {
|
|
1657
|
-
name;
|
|
1658
|
-
packageName;
|
|
1659
|
-
x = 0;
|
|
1660
|
-
y = 0;
|
|
1661
|
-
height = 600;
|
|
1662
|
-
width = 800;
|
|
1663
|
-
proxy;
|
|
1664
|
-
id;
|
|
1665
|
-
isIgnoreMouseEvents;
|
|
1666
|
-
};
|
|
1667
|
-
|
|
1668
|
-
// src/model/SocialInfo.ts
|
|
1669
|
-
var SocialInfo = class {
|
|
1670
|
-
content;
|
|
1671
1659
|
name;
|
|
1672
|
-
|
|
1660
|
+
/**
|
|
1661
|
+
* 背景颜色
|
|
1662
|
+
* @deprecated
|
|
1663
|
+
*/
|
|
1664
|
+
backgroundColor;
|
|
1665
|
+
/**
|
|
1666
|
+
* 文字颜色
|
|
1667
|
+
* @deprecated
|
|
1668
|
+
*/
|
|
1669
|
+
color;
|
|
1670
|
+
/**
|
|
1671
|
+
* 字体大小
|
|
1672
|
+
* @deprecated
|
|
1673
|
+
*/
|
|
1674
|
+
fontSize;
|
|
1675
|
+
/**
|
|
1676
|
+
* 字体
|
|
1677
|
+
* @deprecated
|
|
1678
|
+
*/
|
|
1679
|
+
fontFamily;
|
|
1680
|
+
/**
|
|
1681
|
+
* 圆角半径
|
|
1682
|
+
* @deprecated
|
|
1683
|
+
*/
|
|
1684
|
+
borderRadius;
|
|
1685
|
+
/**
|
|
1686
|
+
* 组件样式
|
|
1687
|
+
* @deprecated
|
|
1688
|
+
*/
|
|
1689
|
+
theme;
|
|
1690
|
+
constructor(name, id) {
|
|
1691
|
+
this.id = id;
|
|
1673
1692
|
this.name = name;
|
|
1674
|
-
this.
|
|
1693
|
+
this.theme = JSON.parse(JSON.stringify(DefaultWidgetTheme));
|
|
1694
|
+
}
|
|
1695
|
+
parseJSON(json) {
|
|
1696
|
+
Object.assign(this, json);
|
|
1675
1697
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1698
|
+
/**
|
|
1699
|
+
* Gets the style properties from the widget's style object.
|
|
1700
|
+
* @returns A record representing CSS custom properties and their values.
|
|
1701
|
+
*/
|
|
1702
|
+
getThemeProperties() {
|
|
1703
|
+
const properties = {};
|
|
1704
|
+
if (this.theme) {
|
|
1705
|
+
const prefix = "--widget-";
|
|
1706
|
+
const keys = Object.keys(this.theme);
|
|
1707
|
+
keys.filter((key) => this.theme[key] != void 0).forEach((key) => {
|
|
1708
|
+
properties[`${prefix}${(0, import_kebabCase3.default)(key)}`] = `${this.theme[key]}`;
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
return properties;
|
|
1712
|
+
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Injects the style properties as css variable.
|
|
1715
|
+
* @remarks Only works in a browser environment.
|
|
1716
|
+
*/
|
|
1717
|
+
injectThemeProperties() {
|
|
1718
|
+
const properties = this.getThemeProperties();
|
|
1719
|
+
Object.keys(properties).forEach((key) => {
|
|
1720
|
+
document.body.style.setProperty(key, properties[key].toString());
|
|
1721
|
+
});
|
|
1684
1722
|
}
|
|
1685
1723
|
};
|
|
1686
1724
|
|
|
@@ -1837,6 +1875,218 @@ var WidgetPackage = class _WidgetPackage {
|
|
|
1837
1875
|
}
|
|
1838
1876
|
};
|
|
1839
1877
|
|
|
1878
|
+
// src/model/WidgetParams.ts
|
|
1879
|
+
var import_snakeCase = __toESM(require_snakeCase());
|
|
1880
|
+
|
|
1881
|
+
// src/router/encoding.ts
|
|
1882
|
+
var HASH_RE = /#/g;
|
|
1883
|
+
var AMPERSAND_RE = /&/g;
|
|
1884
|
+
var EQUAL_RE = /=/g;
|
|
1885
|
+
var PLUS_RE = /\+/g;
|
|
1886
|
+
var ENC_BRACKET_OPEN_RE = /%5B/g;
|
|
1887
|
+
var ENC_BRACKET_CLOSE_RE = /%5D/g;
|
|
1888
|
+
var ENC_CARET_RE = /%5E/g;
|
|
1889
|
+
var ENC_BACKTICK_RE = /%60/g;
|
|
1890
|
+
var ENC_CURLY_OPEN_RE = /%7B/g;
|
|
1891
|
+
var ENC_PIPE_RE = /%7C/g;
|
|
1892
|
+
var ENC_CURLY_CLOSE_RE = /%7D/g;
|
|
1893
|
+
var ENC_SPACE_RE = /%20/g;
|
|
1894
|
+
function commonEncode(text) {
|
|
1895
|
+
return encodeURI(`${text}`).replace(ENC_PIPE_RE, "|").replace(ENC_BRACKET_OPEN_RE, "[").replace(ENC_BRACKET_CLOSE_RE, "]");
|
|
1896
|
+
}
|
|
1897
|
+
function encodeQueryValue(text) {
|
|
1898
|
+
return commonEncode(text).replace(PLUS_RE, "%2B").replace(ENC_SPACE_RE, "+").replace(HASH_RE, "%23").replace(AMPERSAND_RE, "%26").replace(ENC_BACKTICK_RE, "`").replace(ENC_CURLY_OPEN_RE, "{").replace(ENC_CURLY_CLOSE_RE, "}").replace(ENC_CARET_RE, "^");
|
|
1899
|
+
}
|
|
1900
|
+
function encodeQueryKey(text) {
|
|
1901
|
+
return encodeQueryValue(text).replace(EQUAL_RE, "%3D");
|
|
1902
|
+
}
|
|
1903
|
+
function decode(text) {
|
|
1904
|
+
try {
|
|
1905
|
+
return decodeURIComponent(`${text}`);
|
|
1906
|
+
} catch (err) {
|
|
1907
|
+
}
|
|
1908
|
+
return `${text}`;
|
|
1909
|
+
}
|
|
1910
|
+
|
|
1911
|
+
// src/router/query.ts
|
|
1912
|
+
var isArray = Array.isArray;
|
|
1913
|
+
function parseQuery(search) {
|
|
1914
|
+
const query = {};
|
|
1915
|
+
if (search === "" || search === "?") {
|
|
1916
|
+
return query;
|
|
1917
|
+
}
|
|
1918
|
+
const hasLeadingIM = search[0] === "?";
|
|
1919
|
+
const searchParams = (hasLeadingIM ? search.slice(1) : search).split("&");
|
|
1920
|
+
for (let i = 0; i < searchParams.length; ++i) {
|
|
1921
|
+
const searchParam = searchParams[i].replace(PLUS_RE, " ");
|
|
1922
|
+
const eqPos = searchParam.indexOf("=");
|
|
1923
|
+
const key = decode(eqPos < 0 ? searchParam : searchParam.slice(0, eqPos));
|
|
1924
|
+
const value = eqPos < 0 ? null : decode(searchParam.slice(eqPos + 1));
|
|
1925
|
+
if (key in query) {
|
|
1926
|
+
let currentValue = query[key];
|
|
1927
|
+
if (!isArray(currentValue)) {
|
|
1928
|
+
currentValue = query[key] = [currentValue];
|
|
1929
|
+
}
|
|
1930
|
+
currentValue.push(value);
|
|
1931
|
+
} else {
|
|
1932
|
+
query[key] = value;
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
return query;
|
|
1936
|
+
}
|
|
1937
|
+
function stringifyQuery(query) {
|
|
1938
|
+
let search = "";
|
|
1939
|
+
for (let key in query) {
|
|
1940
|
+
const value = query[key];
|
|
1941
|
+
key = encodeQueryKey(key);
|
|
1942
|
+
if (value == null) {
|
|
1943
|
+
if (value !== void 0) {
|
|
1944
|
+
search += (search.length ? "&" : "") + key;
|
|
1945
|
+
}
|
|
1946
|
+
continue;
|
|
1947
|
+
}
|
|
1948
|
+
const values = isArray(value) ? value.map((v) => v && encodeQueryValue(v)) : [value && encodeQueryValue(value)];
|
|
1949
|
+
values.forEach((value2) => {
|
|
1950
|
+
if (value2 !== void 0) {
|
|
1951
|
+
search += (search.length ? "&" : "") + key;
|
|
1952
|
+
if (value2 != null) {
|
|
1953
|
+
search += `=${value2}`;
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
return search;
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
// src/model/WidgetParams.ts
|
|
1962
|
+
var WidgetParams = class _WidgetParams {
|
|
1963
|
+
static PARAM_PREFIX = "w_";
|
|
1964
|
+
static PARAM_ID = "id";
|
|
1965
|
+
static PARAM_LANG = "lang";
|
|
1966
|
+
static PARAM_THEME = "theme";
|
|
1967
|
+
static PARAM_MODE = "mode";
|
|
1968
|
+
static PARAM_NAME = "name";
|
|
1969
|
+
static PARAM_TITLE = "title";
|
|
1970
|
+
static PARAM_PREVIEW = "preview";
|
|
1971
|
+
static PARAMS = [
|
|
1972
|
+
_WidgetParams.PARAM_ID,
|
|
1973
|
+
_WidgetParams.PARAM_LANG,
|
|
1974
|
+
_WidgetParams.PARAM_THEME,
|
|
1975
|
+
_WidgetParams.PARAM_MODE,
|
|
1976
|
+
_WidgetParams.PARAM_NAME,
|
|
1977
|
+
_WidgetParams.PARAM_TITLE,
|
|
1978
|
+
_WidgetParams.PARAM_PREVIEW
|
|
1979
|
+
];
|
|
1980
|
+
// 组件id
|
|
1981
|
+
id;
|
|
1982
|
+
// 网格宽度,1就代表宽度占用1格
|
|
1983
|
+
width;
|
|
1984
|
+
// 宽度,单位px
|
|
1985
|
+
widthPx;
|
|
1986
|
+
// 宽度,单位px
|
|
1987
|
+
heightPx;
|
|
1988
|
+
// 网格高度,2就代表高度占用2格
|
|
1989
|
+
height;
|
|
1990
|
+
x;
|
|
1991
|
+
y;
|
|
1992
|
+
// 是否是预览模式,添加组件时,预览状态
|
|
1993
|
+
preview;
|
|
1994
|
+
// 语言环境:zh,en,jp...
|
|
1995
|
+
lang;
|
|
1996
|
+
// 主题:浅色,深色
|
|
1997
|
+
theme;
|
|
1998
|
+
//
|
|
1999
|
+
mode;
|
|
2000
|
+
// 系统设置的组件圆角半径
|
|
2001
|
+
radius;
|
|
2002
|
+
// 组件名
|
|
2003
|
+
name;
|
|
2004
|
+
title;
|
|
2005
|
+
/**
|
|
2006
|
+
* 将组件参数转为url参数
|
|
2007
|
+
* @param object
|
|
2008
|
+
* @return URLSearchParams w_w=2&w_h=2&w_id=21&w_width=156&w_height=156
|
|
2009
|
+
*/
|
|
2010
|
+
toUrlParams() {
|
|
2011
|
+
const urlParams = new URLSearchParams();
|
|
2012
|
+
const ownPropertyNames = Object.getOwnPropertyNames(this);
|
|
2013
|
+
for (const ownPropertyName of ownPropertyNames) {
|
|
2014
|
+
const key = ownPropertyName;
|
|
2015
|
+
const value = this[key];
|
|
2016
|
+
if (value) {
|
|
2017
|
+
urlParams.append(_WidgetParams.PARAM_PREFIX + (0, import_snakeCase.default)(ownPropertyName), value.toString());
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
return urlParams;
|
|
2021
|
+
}
|
|
2022
|
+
getPersistKey() {
|
|
2023
|
+
return `${this.name}-${this.id}`;
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* 从当前地址解析组件参数:
|
|
2027
|
+
* http://localhost:8080/#/widget/config/labor_progress?w_w=2&w_h=2&w_width=156&w_height=156
|
|
2028
|
+
* =>
|
|
2029
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
2030
|
+
*/
|
|
2031
|
+
static fromCurrentLocation() {
|
|
2032
|
+
const href = window.location.href;
|
|
2033
|
+
const strings = href.split("?");
|
|
2034
|
+
if (strings.length > 1) {
|
|
2035
|
+
const queryString = strings[1];
|
|
2036
|
+
return this.fromObject(parseQuery(queryString));
|
|
2037
|
+
}
|
|
2038
|
+
return new _WidgetParams();
|
|
2039
|
+
}
|
|
2040
|
+
static fromLocation(url) {
|
|
2041
|
+
const strings = url.split("?");
|
|
2042
|
+
if (strings.length > 1) {
|
|
2043
|
+
const queryString = strings[1];
|
|
2044
|
+
return this.fromObject(parseQuery(queryString));
|
|
2045
|
+
}
|
|
2046
|
+
return new _WidgetParams();
|
|
2047
|
+
}
|
|
2048
|
+
static setValue(widgetEnv, key, value) {
|
|
2049
|
+
const keyWithoutPrefix = key.replace(this.PARAM_PREFIX, "");
|
|
2050
|
+
if (keyWithoutPrefix == _WidgetParams.PARAM_ID) {
|
|
2051
|
+
widgetEnv.id = value;
|
|
2052
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_LANG) {
|
|
2053
|
+
widgetEnv.lang = value;
|
|
2054
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_THEME) {
|
|
2055
|
+
widgetEnv.theme = value;
|
|
2056
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_MODE) {
|
|
2057
|
+
widgetEnv.mode = Number.parseInt(value);
|
|
2058
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_NAME) {
|
|
2059
|
+
widgetEnv.name = value;
|
|
2060
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_TITLE) {
|
|
2061
|
+
widgetEnv.title = value;
|
|
2062
|
+
} else if (keyWithoutPrefix == _WidgetParams.PARAM_PREVIEW) {
|
|
2063
|
+
widgetEnv.preview = value === "true";
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* 从对象键值对中初始化组件参数
|
|
2068
|
+
* {w_width:2,w_height:2,w_id:21,w_width_px:156,w_height_px:156}=>
|
|
2069
|
+
* {width:2,height:2,id:21,width_px:156,height_px:156}
|
|
2070
|
+
* @param object
|
|
2071
|
+
*/
|
|
2072
|
+
static fromObject(object) {
|
|
2073
|
+
const widgetEnv = new _WidgetParams();
|
|
2074
|
+
const ownPropertyNames = Object.getOwnPropertyNames(object);
|
|
2075
|
+
for (const ownPropertyName of ownPropertyNames) {
|
|
2076
|
+
const key = ownPropertyName;
|
|
2077
|
+
const value = object[key];
|
|
2078
|
+
this.setValue(widgetEnv, key, value);
|
|
2079
|
+
}
|
|
2080
|
+
return widgetEnv;
|
|
2081
|
+
}
|
|
2082
|
+
};
|
|
2083
|
+
var ThemeMode = /* @__PURE__ */ ((ThemeMode2) => {
|
|
2084
|
+
ThemeMode2["AUTO"] = "auto";
|
|
2085
|
+
ThemeMode2["LIGHT"] = "LIGHT";
|
|
2086
|
+
ThemeMode2["DARK"] = "DARK";
|
|
2087
|
+
return ThemeMode2;
|
|
2088
|
+
})(ThemeMode || {});
|
|
2089
|
+
|
|
1840
2090
|
// src/lang/LanguageCode.ts
|
|
1841
2091
|
var LanguageMap = class {
|
|
1842
2092
|
"ar-SA" = { baseName: "ar-SA", language: "ar", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629" };
|
|
@@ -2236,13 +2486,29 @@ var GridSystem = class extends GridRect {
|
|
|
2236
2486
|
}
|
|
2237
2487
|
};
|
|
2238
2488
|
|
|
2239
|
-
// src/api/
|
|
2240
|
-
var
|
|
2241
|
-
static
|
|
2242
|
-
|
|
2489
|
+
// src/api/ApiConstants.ts
|
|
2490
|
+
var ApiConstants = class {
|
|
2491
|
+
static CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
2492
|
+
static CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
|
|
2493
|
+
static CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
|
|
2494
|
+
static CONFIG_GRID_CELL_SIZE = "cn.widgetjs.config.grid.size";
|
|
2495
|
+
static SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
|
|
2496
|
+
};
|
|
2497
|
+
var AppEvent = class {
|
|
2498
|
+
static LANGUAGE_CHANGED = "event::cn.widgetjs.core.app.language.changed";
|
|
2499
|
+
};
|
|
2500
|
+
var AppConfig = class {
|
|
2501
|
+
static LANGUAGE = "cn.widgetjs.config.app.language";
|
|
2502
|
+
static LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
2503
|
+
};
|
|
2504
|
+
|
|
2505
|
+
// src/api/BaseApi.ts
|
|
2506
|
+
var BaseApi = class {
|
|
2507
|
+
async invokeMethod(method, ...args) {
|
|
2508
|
+
return await ElectronUtils.invokeMethod(this.getChannel(), method, ...args);
|
|
2243
2509
|
}
|
|
2244
|
-
|
|
2245
|
-
await ElectronUtils.
|
|
2510
|
+
async invoke(...args) {
|
|
2511
|
+
return await ElectronUtils.invoke(this.getChannel(), ...args);
|
|
2246
2512
|
}
|
|
2247
2513
|
};
|
|
2248
2514
|
|
|
@@ -2276,211 +2542,121 @@ var Channel = /* @__PURE__ */ ((Channel2) => {
|
|
|
2276
2542
|
return Channel2;
|
|
2277
2543
|
})(Channel || {});
|
|
2278
2544
|
|
|
2279
|
-
// src/api/
|
|
2280
|
-
var
|
|
2281
|
-
|
|
2282
|
-
return
|
|
2283
|
-
}
|
|
2284
|
-
async invoke(...args) {
|
|
2285
|
-
return await ElectronUtils.invoke(this.getChannel(), ...args);
|
|
2545
|
+
// src/api/AppApi.ts
|
|
2546
|
+
var AppApiImpl = class extends BaseApi {
|
|
2547
|
+
showAppWindow(route, options) {
|
|
2548
|
+
return this.invokeMethod("showAppWindow", route, options);
|
|
2286
2549
|
}
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
// src/api/BroadcastApi.ts
|
|
2290
|
-
var BroadcastApiImpl = class extends BaseApi {
|
|
2291
|
-
async send(event) {
|
|
2292
|
-
await this.invokeMethod("send", event);
|
|
2550
|
+
openWidgetPackageManagerWindow() {
|
|
2551
|
+
return this.invokeMethod("openWidgetPackageManagerWindow");
|
|
2293
2552
|
}
|
|
2294
|
-
|
|
2295
|
-
|
|
2553
|
+
getRuntimeInfo() {
|
|
2554
|
+
return this.invokeMethod("getRuntimeInfo");
|
|
2296
2555
|
}
|
|
2297
|
-
|
|
2298
|
-
|
|
2556
|
+
setProxy(config) {
|
|
2557
|
+
return this.invokeMethod("setProxy", config);
|
|
2299
2558
|
}
|
|
2300
|
-
|
|
2301
|
-
return
|
|
2559
|
+
getProxy() {
|
|
2560
|
+
return this.invokeMethod("getProxy");
|
|
2302
2561
|
}
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
// src/api/WidgetApi.ts
|
|
2307
|
-
var WidgetApiEvent = /* @__PURE__ */ ((WidgetApiEvent2) => {
|
|
2308
|
-
WidgetApiEvent2["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data-changed";
|
|
2309
|
-
WidgetApiEvent2["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
|
|
2310
|
-
WidgetApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
2311
|
-
WidgetApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
2312
|
-
return WidgetApiEvent2;
|
|
2313
|
-
})(WidgetApiEvent || {});
|
|
2314
|
-
var WidgetApiImpl = class extends BaseApi {
|
|
2315
|
-
getSyncInfo(widgetName) {
|
|
2316
|
-
return this.invokeMethod("getSyncInfo", widgetName);
|
|
2562
|
+
isWindowsStore() {
|
|
2563
|
+
return this.invokeMethod("isWindowsStore");
|
|
2317
2564
|
}
|
|
2318
|
-
|
|
2319
|
-
return this.invokeMethod("
|
|
2565
|
+
getAppPath() {
|
|
2566
|
+
return this.invokeMethod("getAppPath");
|
|
2320
2567
|
}
|
|
2321
|
-
|
|
2322
|
-
return this.invokeMethod("
|
|
2568
|
+
async getIconFile() {
|
|
2569
|
+
return this.invokeMethod("getIconFile");
|
|
2323
2570
|
}
|
|
2324
2571
|
getChannel() {
|
|
2325
|
-
return "channel::cn.widgetjs.core.
|
|
2326
|
-
}
|
|
2327
|
-
async registerWidgets(widgets) {
|
|
2328
|
-
return this.invokeMethod("registerWidgets", JSON.stringify(widgets));
|
|
2572
|
+
return "channel::cn.widgetjs.core.app" /* APP */;
|
|
2329
2573
|
}
|
|
2330
|
-
async
|
|
2331
|
-
return this.invokeMethod("
|
|
2574
|
+
async setConfig(key, value) {
|
|
2575
|
+
return await this.invokeMethod("setConfig", key, value);
|
|
2332
2576
|
}
|
|
2333
|
-
async
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
for (const item of data) {
|
|
2338
|
-
widgets.push(Widget.parseObject(item));
|
|
2339
|
-
}
|
|
2577
|
+
async getConfig(key, defaultValue) {
|
|
2578
|
+
const value = await this.invokeMethod("getConfig", key);
|
|
2579
|
+
if (value === null || value === void 0) {
|
|
2580
|
+
return defaultValue;
|
|
2340
2581
|
}
|
|
2341
|
-
|
|
2582
|
+
if (typeof defaultValue == "boolean") {
|
|
2583
|
+
return value === "true";
|
|
2584
|
+
}
|
|
2585
|
+
if (typeof defaultValue == "number") {
|
|
2586
|
+
return Number(value);
|
|
2587
|
+
}
|
|
2588
|
+
return value;
|
|
2342
2589
|
}
|
|
2343
|
-
async
|
|
2344
|
-
return this.invokeMethod("
|
|
2590
|
+
async openAddWidgetWindow() {
|
|
2591
|
+
return this.invokeMethod("openAddWidgetWindow");
|
|
2345
2592
|
}
|
|
2346
|
-
async
|
|
2347
|
-
return this.invokeMethod("
|
|
2593
|
+
async getVersion(type) {
|
|
2594
|
+
return this.invokeMethod("getVersion", type);
|
|
2348
2595
|
}
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
*/
|
|
2352
|
-
async getWidgetPackages() {
|
|
2353
|
-
return await this.invokeMethod("getWidgetPackages");
|
|
2596
|
+
async getPreloadPath() {
|
|
2597
|
+
return this.invokeMethod("getPreloadPath");
|
|
2354
2598
|
}
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
* @param name package name
|
|
2358
|
-
*/
|
|
2359
|
-
async getWidget(name) {
|
|
2360
|
-
return Widget.parseObject(await this.invokeMethod("getWidget", name));
|
|
2599
|
+
async openSettingWindow() {
|
|
2600
|
+
return this.invokeMethod("openSettingWindow");
|
|
2361
2601
|
}
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
* @deprecated
|
|
2365
|
-
*/
|
|
2366
|
-
async getWidgetPackage(name) {
|
|
2367
|
-
const result = await this.invokeMethod("getWidgetPackage", name);
|
|
2368
|
-
if (result) {
|
|
2369
|
-
return WidgetPackage.parseObject(result);
|
|
2370
|
-
}
|
|
2371
|
-
return void 0;
|
|
2602
|
+
getThemeCSS() {
|
|
2603
|
+
return this.invokeMethod("getThemeCSS");
|
|
2372
2604
|
}
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
if (!widgetPackage) {
|
|
2376
|
-
return null;
|
|
2377
|
-
}
|
|
2378
|
-
return widgetPackage.url;
|
|
2605
|
+
setThemeCSS(css) {
|
|
2606
|
+
return this.invokeMethod("setThemeCSS", css);
|
|
2379
2607
|
}
|
|
2380
|
-
|
|
2381
|
-
return
|
|
2608
|
+
getDevMode() {
|
|
2609
|
+
return this.invokeMethod("getDevMode");
|
|
2382
2610
|
}
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
* @param draggable
|
|
2386
|
-
*/
|
|
2387
|
-
setMouseDraggable(draggable) {
|
|
2388
|
-
return this.invokeMethod("setMouseDraggable", draggable);
|
|
2611
|
+
setDevMode(enable) {
|
|
2612
|
+
return this.invokeMethod("setDevMode", enable);
|
|
2389
2613
|
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2614
|
+
getLanguageCode() {
|
|
2615
|
+
if (ElectronUtils.hasElectronApi()) {
|
|
2616
|
+
return this.invokeMethod("getLanguageCode");
|
|
2617
|
+
}
|
|
2618
|
+
return Promise.resolve(navigator.language);
|
|
2392
2619
|
}
|
|
2393
|
-
|
|
2394
|
-
|
|
2620
|
+
async setLanguageCode(code) {
|
|
2621
|
+
await this.invokeMethod("setLanguageCode", code);
|
|
2395
2622
|
}
|
|
2396
|
-
|
|
2397
|
-
return this.invokeMethod("
|
|
2623
|
+
getGridCellSize() {
|
|
2624
|
+
return this.invokeMethod("getGridCellSize");
|
|
2398
2625
|
}
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
// src/api/WidgetDataApi.ts
|
|
2403
|
-
var WidgetDataApiImpl = class {
|
|
2404
|
-
stores = /* @__PURE__ */ new Map();
|
|
2405
|
-
/**
|
|
2406
|
-
* 保存组件数据
|
|
2407
|
-
* @param data
|
|
2408
|
-
* @param options
|
|
2409
|
-
*/
|
|
2410
|
-
async save(data, options = { sendBroadcast: true }) {
|
|
2411
|
-
const store = this.getStore(data.name, options.storeName);
|
|
2412
|
-
const json = JSON.stringify(data);
|
|
2413
|
-
const result = await store.setItem(this.getKey(data.name, data.id), json);
|
|
2414
|
-
if (options.sendBroadcast) {
|
|
2415
|
-
const broadcastEvent = new BroadcastEvent({
|
|
2416
|
-
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
2417
|
-
payload: { name: data.name, json }
|
|
2418
|
-
});
|
|
2419
|
-
await BroadcastApi.send(broadcastEvent);
|
|
2420
|
-
}
|
|
2421
|
-
return result;
|
|
2626
|
+
setGridCellSize(size) {
|
|
2627
|
+
return this.invokeMethod("setGridCellSize", size);
|
|
2422
2628
|
}
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
return this.stores.get(widgetName);
|
|
2426
|
-
}
|
|
2427
|
-
const store = localforage.createInstance({ name: widgetName, storeName });
|
|
2428
|
-
this.stores.set(widgetName, store);
|
|
2429
|
-
return store;
|
|
2629
|
+
exit() {
|
|
2630
|
+
return this.invokeMethod("exit");
|
|
2430
2631
|
}
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
* @param data
|
|
2434
|
-
* @param options
|
|
2435
|
-
*/
|
|
2436
|
-
async saveByName(data, options = { sendBroadcast: true }) {
|
|
2437
|
-
const store = this.getStore(data.name);
|
|
2438
|
-
const json = JSON.stringify(data);
|
|
2439
|
-
const result = await store.setItem(data.name, json);
|
|
2440
|
-
if (options?.sendBroadcast) {
|
|
2441
|
-
const broadcastEvent = new BroadcastEvent({
|
|
2442
|
-
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
2443
|
-
payload: { name: data.name, json }
|
|
2444
|
-
});
|
|
2445
|
-
await BroadcastApi.send(broadcastEvent);
|
|
2446
|
-
}
|
|
2447
|
-
return result;
|
|
2632
|
+
openCheckUpdateWindow() {
|
|
2633
|
+
return this.invokeMethod(`openCheckUpdateWindow`);
|
|
2448
2634
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
let dbStr = "";
|
|
2452
|
-
let data;
|
|
2453
|
-
if (args.length === 2) {
|
|
2454
|
-
name = args[0];
|
|
2455
|
-
const Type = args[1];
|
|
2456
|
-
data = new Type(name);
|
|
2457
|
-
} else {
|
|
2458
|
-
data = args[0];
|
|
2459
|
-
name = data.name;
|
|
2460
|
-
}
|
|
2461
|
-
const store = this.getStore(name);
|
|
2462
|
-
dbStr = await store.getItem(name);
|
|
2463
|
-
if (dbStr) {
|
|
2464
|
-
data.parseJSON(JSON.parse(dbStr));
|
|
2465
|
-
return data;
|
|
2466
|
-
}
|
|
2467
|
-
return void 0;
|
|
2635
|
+
openWidgetManagerWindow() {
|
|
2636
|
+
return this.invokeMethod(`openWidgetManagerWindow`);
|
|
2468
2637
|
}
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2638
|
+
openRuntimeInfoWindow() {
|
|
2639
|
+
return this.invokeMethod(`openRuntimeInfoWindow`);
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2642
|
+
var AppApi = new AppApiImpl();
|
|
2643
|
+
|
|
2644
|
+
// src/api/BroadcastApi.ts
|
|
2645
|
+
var BroadcastApiImpl = class extends BaseApi {
|
|
2646
|
+
async send(event) {
|
|
2647
|
+
await this.invokeMethod("send", event);
|
|
2478
2648
|
}
|
|
2479
|
-
|
|
2480
|
-
|
|
2649
|
+
async register(...event) {
|
|
2650
|
+
await this.invokeMethod("register", event);
|
|
2651
|
+
}
|
|
2652
|
+
async unregister(...event) {
|
|
2653
|
+
await this.invokeMethod("unregister", event);
|
|
2654
|
+
}
|
|
2655
|
+
getChannel() {
|
|
2656
|
+
return "channel::cn.widgetjs.core.broadcast" /* BROADCAST */;
|
|
2481
2657
|
}
|
|
2482
2658
|
};
|
|
2483
|
-
var
|
|
2659
|
+
var BroadcastApi = new BroadcastApiImpl();
|
|
2484
2660
|
|
|
2485
2661
|
// src/api/BrowserWindowApi.ts
|
|
2486
2662
|
var BrowserWindowApiEvent = /* @__PURE__ */ ((BrowserWindowApiEvent2) => {
|
|
@@ -2686,106 +2862,26 @@ var BrowserWindowApiImpl = class extends BaseApi {
|
|
|
2686
2862
|
};
|
|
2687
2863
|
var BrowserWindowApi = new BrowserWindowApiImpl();
|
|
2688
2864
|
|
|
2689
|
-
// src/api/
|
|
2690
|
-
var
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
// static async url(url: string, duration: number = -1) {
|
|
2698
|
-
// this.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
2699
|
-
// url, message: "",
|
|
2700
|
-
// duration,
|
|
2701
|
-
// type: "url",
|
|
2702
|
-
// }));
|
|
2703
|
-
// }
|
|
2704
|
-
/**
|
|
2705
|
-
* 来电
|
|
2706
|
-
* @param avatar 头像地址
|
|
2707
|
-
* @param audio 音频地址
|
|
2708
|
-
* @param title 标题文件
|
|
2709
|
-
* @param message 初始消息
|
|
2710
|
-
* @param lyric 歌词字符串
|
|
2711
|
-
*/
|
|
2712
|
-
async call(avatar, audio, title, message, lyric) {
|
|
2713
|
-
await this.invoke(new AppNotification({
|
|
2714
|
-
avatar,
|
|
2715
|
-
audio,
|
|
2716
|
-
message,
|
|
2717
|
-
title,
|
|
2718
|
-
duration: -1,
|
|
2719
|
-
lyric,
|
|
2720
|
-
type: "call"
|
|
2721
|
-
}));
|
|
2722
|
-
}
|
|
2723
|
-
async send(notification) {
|
|
2724
|
-
return this.invokeMethod("send", notification);
|
|
2725
|
-
}
|
|
2726
|
-
async reminder(option) {
|
|
2727
|
-
return await this.send(new AppReminderNotification(option));
|
|
2728
|
-
}
|
|
2729
|
-
async advanceCountdown(message, targetTime, title) {
|
|
2730
|
-
return await this.send(new AppNotification({
|
|
2731
|
-
title,
|
|
2732
|
-
message,
|
|
2733
|
-
targetTime,
|
|
2734
|
-
type: "advance-countdown"
|
|
2735
|
-
}));
|
|
2736
|
-
}
|
|
2737
|
-
async countdown(message, targetTime) {
|
|
2738
|
-
await this.send(new AppNotification({
|
|
2739
|
-
message,
|
|
2740
|
-
targetTime,
|
|
2741
|
-
backgroundColor: "rgba(0,0,0,0.5)",
|
|
2742
|
-
duration: -1,
|
|
2743
|
-
type: "countdown"
|
|
2744
|
-
}));
|
|
2745
|
-
}
|
|
2746
|
-
async success(message, duration = 5e3) {
|
|
2747
|
-
await this.send(new AppNotification({
|
|
2748
|
-
message,
|
|
2749
|
-
type: "success",
|
|
2750
|
-
icon: "check-one",
|
|
2751
|
-
duration
|
|
2752
|
-
}));
|
|
2753
|
-
}
|
|
2754
|
-
async error(message, duration = 5e3) {
|
|
2755
|
-
await this.send(new AppNotification({
|
|
2756
|
-
message,
|
|
2757
|
-
type: "error",
|
|
2758
|
-
icon: "close-one",
|
|
2759
|
-
duration
|
|
2760
|
-
}));
|
|
2761
|
-
}
|
|
2762
|
-
async warning(message, duration = 5e3) {
|
|
2763
|
-
await this.send(new AppNotification({
|
|
2764
|
-
message,
|
|
2765
|
-
type: "warning",
|
|
2766
|
-
icon: "attention",
|
|
2767
|
-
duration
|
|
2768
|
-
}));
|
|
2865
|
+
// src/api/ClipboardApi.ts
|
|
2866
|
+
var ClipboardApiEvent = /* @__PURE__ */ ((ClipboardApiEvent2) => {
|
|
2867
|
+
ClipboardApiEvent2["CHANGED"] = "clipboard-changed";
|
|
2868
|
+
return ClipboardApiEvent2;
|
|
2869
|
+
})(ClipboardApiEvent || {});
|
|
2870
|
+
var ClipboardApiImpl = class extends BaseApi {
|
|
2871
|
+
writeText(text) {
|
|
2872
|
+
return this.invokeMethod("writeText", text);
|
|
2769
2873
|
}
|
|
2770
|
-
async
|
|
2771
|
-
|
|
2772
|
-
message,
|
|
2773
|
-
type: "info",
|
|
2774
|
-
icon: "info",
|
|
2775
|
-
duration
|
|
2776
|
-
}));
|
|
2874
|
+
async getSelectedText() {
|
|
2875
|
+
return this.invokeMethod("getSelectedText");
|
|
2777
2876
|
}
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
*/
|
|
2781
|
-
async hide() {
|
|
2782
|
-
await this.invokeMethod("hide");
|
|
2877
|
+
async getText() {
|
|
2878
|
+
return this.invokeMethod("getText");
|
|
2783
2879
|
}
|
|
2784
2880
|
getChannel() {
|
|
2785
|
-
return "channel::cn.widgetjs.core.
|
|
2881
|
+
return "channel::cn.widgetjs.core.clipboard" /* CLIPBOARD */;
|
|
2786
2882
|
}
|
|
2787
2883
|
};
|
|
2788
|
-
var
|
|
2884
|
+
var ClipboardApi = new ClipboardApiImpl();
|
|
2789
2885
|
|
|
2790
2886
|
// src/utils/AppProtocolUtils.ts
|
|
2791
2887
|
var AppProtocolUtils = class {
|
|
@@ -2838,313 +2934,226 @@ var DeployedWidgetApiImpl = class extends BaseApi {
|
|
|
2838
2934
|
return this.invokeMethod("removeDeployedWidgetByName", name);
|
|
2839
2935
|
}
|
|
2840
2936
|
/**
|
|
2841
|
-
* 获取已添加的组件
|
|
2842
|
-
* @param name 组件名,可以不传
|
|
2843
|
-
*/
|
|
2844
|
-
async getDeployedWidgets(name) {
|
|
2845
|
-
return this.invokeMethod("getDeployedWidgets", name);
|
|
2846
|
-
}
|
|
2847
|
-
async getDeployedWidget(id) {
|
|
2848
|
-
return this.invokeMethod("getDeployedWidget", id);
|
|
2849
|
-
}
|
|
2850
|
-
/**
|
|
2851
|
-
* Opens the dev tools for a widget with the specified ID.
|
|
2852
|
-
*
|
|
2853
|
-
* @param {string} widgetId - The ID of the widget to open the dev tools for.
|
|
2854
|
-
* @return {Promise} A Promise that resolves when the dev tools are opened.
|
|
2855
|
-
*/
|
|
2856
|
-
async openDevTools(widgetId) {
|
|
2857
|
-
return this.invokeMethod("openDevTools", widgetId);
|
|
2858
|
-
}
|
|
2859
|
-
async openConfigPage(widgetId, params) {
|
|
2860
|
-
return this.invokeMethod("openConfigPage", widgetId, params);
|
|
2861
|
-
}
|
|
2862
|
-
/**
|
|
2863
|
-
* 注册激活、呼出、置顶组件快捷键
|
|
2864
|
-
* @param widgetId 组件id
|
|
2865
|
-
* @param shortcut 如果传空或者不传,则会取消快捷键。更多快捷键配置,请查看Accelerator用法
|
|
2866
|
-
* https://www.electronjs.org/docs/latest/api/accelerator
|
|
2867
|
-
*/
|
|
2868
|
-
async registerActiveShortcut(widgetId, shortcut) {
|
|
2869
|
-
return this.invokeMethod("registerActiveShortcut", widgetId, shortcut);
|
|
2870
|
-
}
|
|
2871
|
-
async setProxy(widgetId, proxy) {
|
|
2872
|
-
return this.invokeMethod("setProxy", widgetId, proxy);
|
|
2873
|
-
}
|
|
2874
|
-
};
|
|
2875
|
-
var DeployedWidgetApi = new DeployedWidgetApiImpl();
|
|
2876
|
-
|
|
2877
|
-
// src/api/DeviceApi.ts
|
|
2878
|
-
var DeviceApiImpl = class extends BaseApi {
|
|
2879
|
-
getDisplayNearestPoint(point) {
|
|
2880
|
-
return this.invokeMethod("getDisplayNearestPoint", point);
|
|
2881
|
-
}
|
|
2882
|
-
getAllDisplays() {
|
|
2883
|
-
return this.invokeMethod("getAllDisplays");
|
|
2884
|
-
}
|
|
2885
|
-
getPrimaryDisplay() {
|
|
2886
|
-
return this.invokeMethod("getPrimaryDisplay");
|
|
2887
|
-
}
|
|
2888
|
-
/**
|
|
2889
|
-
* 获取当前鼠标位置
|
|
2890
|
-
*/
|
|
2891
|
-
async getCursorScreenPoint() {
|
|
2892
|
-
return this.invokeMethod("getCursorScreenPoint");
|
|
2893
|
-
}
|
|
2894
|
-
async sendCtrlV() {
|
|
2895
|
-
return this.invokeMethod("sendCtrlV");
|
|
2896
|
-
}
|
|
2897
|
-
/**
|
|
2898
|
-
* 判断是否所有按键都已经释放
|
|
2899
|
-
*/
|
|
2900
|
-
async isAllKeyReleased() {
|
|
2901
|
-
return this.invokeMethod("isAllKeyReleased");
|
|
2902
|
-
}
|
|
2903
|
-
getChannel() {
|
|
2904
|
-
return "channel::cn.widgetjs.core.device" /* DEVICE */;
|
|
2905
|
-
}
|
|
2906
|
-
isCapsLockOn() {
|
|
2907
|
-
return this.invokeMethod("isCapsLockOn");
|
|
2908
|
-
}
|
|
2909
|
-
};
|
|
2910
|
-
var DeviceApi = new DeviceApiImpl();
|
|
2911
|
-
|
|
2912
|
-
// src/api/ClipboardApi.ts
|
|
2913
|
-
var ClipboardApiEvent = /* @__PURE__ */ ((ClipboardApiEvent2) => {
|
|
2914
|
-
ClipboardApiEvent2["CHANGED"] = "clipboard-changed";
|
|
2915
|
-
return ClipboardApiEvent2;
|
|
2916
|
-
})(ClipboardApiEvent || {});
|
|
2917
|
-
var ClipboardApiImpl = class extends BaseApi {
|
|
2918
|
-
writeText(text) {
|
|
2919
|
-
return this.invokeMethod("writeText", text);
|
|
2920
|
-
}
|
|
2921
|
-
async getSelectedText() {
|
|
2922
|
-
return this.invokeMethod("getSelectedText");
|
|
2923
|
-
}
|
|
2924
|
-
async getText() {
|
|
2925
|
-
return this.invokeMethod("getText");
|
|
2926
|
-
}
|
|
2927
|
-
getChannel() {
|
|
2928
|
-
return "channel::cn.widgetjs.core.clipboard" /* CLIPBOARD */;
|
|
2929
|
-
}
|
|
2930
|
-
};
|
|
2931
|
-
var ClipboardApi = new ClipboardApiImpl();
|
|
2932
|
-
|
|
2933
|
-
// src/api/ApiConstants.ts
|
|
2934
|
-
var ApiConstants = class {
|
|
2935
|
-
static CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
2936
|
-
static CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
|
|
2937
|
-
static CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
|
|
2938
|
-
static CONFIG_GRID_CELL_SIZE = "cn.widgetjs.config.grid.size";
|
|
2939
|
-
static SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
|
|
2940
|
-
};
|
|
2941
|
-
var AppEvent = class {
|
|
2942
|
-
static LANGUAGE_CHANGED = "event::cn.widgetjs.core.app.language.changed";
|
|
2943
|
-
};
|
|
2944
|
-
var AppConfig = class {
|
|
2945
|
-
static LANGUAGE = "cn.widgetjs.config.app.language";
|
|
2946
|
-
static LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
|
|
2947
|
-
};
|
|
2948
|
-
|
|
2949
|
-
// src/api/interface/IShortcutApi.ts
|
|
2950
|
-
var ShortcutApiEvent = /* @__PURE__ */ ((ShortcutApiEvent2) => {
|
|
2951
|
-
ShortcutApiEvent2["TRIGGERED"] = "channel::cn.widgetjs.core.shortcut.triggered";
|
|
2952
|
-
return ShortcutApiEvent2;
|
|
2953
|
-
})(ShortcutApiEvent || {});
|
|
2954
|
-
|
|
2955
|
-
// src/api/ShortcutApi.ts
|
|
2956
|
-
var ShortcutApiImpl = class extends BaseApi {
|
|
2957
|
-
getChannel() {
|
|
2958
|
-
return "channel::cn.widgetjs.core.shortcut" /* SHORTCUT */;
|
|
2959
|
-
}
|
|
2960
|
-
async register(shortcut) {
|
|
2961
|
-
return await this.invokeMethod("register", shortcut);
|
|
2962
|
-
}
|
|
2963
|
-
async unregister(shortcut) {
|
|
2964
|
-
return await this.invokeMethod("unregister", shortcut);
|
|
2965
|
-
}
|
|
2966
|
-
};
|
|
2967
|
-
var ShortcutApi = new ShortcutApiImpl();
|
|
2968
|
-
|
|
2969
|
-
// src/api/ProcessApi.ts
|
|
2970
|
-
var ProcessApiImpl = class extends BaseApi {
|
|
2971
|
-
getChannel() {
|
|
2972
|
-
return "channel::cn.widgetjs.core.process" /* PROCESS */;
|
|
2937
|
+
* 获取已添加的组件
|
|
2938
|
+
* @param name 组件名,可以不传
|
|
2939
|
+
*/
|
|
2940
|
+
async getDeployedWidgets(name) {
|
|
2941
|
+
return this.invokeMethod("getDeployedWidgets", name);
|
|
2973
2942
|
}
|
|
2974
|
-
|
|
2975
|
-
return this.invokeMethod("
|
|
2943
|
+
async getDeployedWidget(id) {
|
|
2944
|
+
return this.invokeMethod("getDeployedWidget", id);
|
|
2976
2945
|
}
|
|
2977
|
-
|
|
2978
|
-
|
|
2946
|
+
/**
|
|
2947
|
+
* Opens the dev tools for a widget with the specified ID.
|
|
2948
|
+
*
|
|
2949
|
+
* @param {string} widgetId - The ID of the widget to open the dev tools for.
|
|
2950
|
+
* @return {Promise} A Promise that resolves when the dev tools are opened.
|
|
2951
|
+
*/
|
|
2952
|
+
async openDevTools(widgetId) {
|
|
2953
|
+
return this.invokeMethod("openDevTools", widgetId);
|
|
2979
2954
|
}
|
|
2980
|
-
|
|
2981
|
-
return this.invokeMethod("
|
|
2955
|
+
async openConfigPage(widgetId, params) {
|
|
2956
|
+
return this.invokeMethod("openConfigPage", widgetId, params);
|
|
2982
2957
|
}
|
|
2983
|
-
|
|
2984
|
-
|
|
2958
|
+
/**
|
|
2959
|
+
* 注册激活、呼出、置顶组件快捷键
|
|
2960
|
+
* @param widgetId 组件id
|
|
2961
|
+
* @param shortcut 如果传空或者不传,则会取消快捷键。更多快捷键配置,请查看Accelerator用法
|
|
2962
|
+
* https://www.electronjs.org/docs/latest/api/accelerator
|
|
2963
|
+
*/
|
|
2964
|
+
async registerActiveShortcut(widgetId, shortcut) {
|
|
2965
|
+
return this.invokeMethod("registerActiveShortcut", widgetId, shortcut);
|
|
2966
|
+
}
|
|
2967
|
+
async setProxy(widgetId, proxy) {
|
|
2968
|
+
return this.invokeMethod("setProxy", widgetId, proxy);
|
|
2985
2969
|
}
|
|
2986
2970
|
};
|
|
2987
|
-
var
|
|
2971
|
+
var DeployedWidgetApi = new DeployedWidgetApiImpl();
|
|
2988
2972
|
|
|
2989
|
-
// src/api/
|
|
2990
|
-
var
|
|
2991
|
-
|
|
2992
|
-
return this.invokeMethod("
|
|
2973
|
+
// src/api/DeviceApi.ts
|
|
2974
|
+
var DeviceApiImpl = class extends BaseApi {
|
|
2975
|
+
getDisplayNearestPoint(point) {
|
|
2976
|
+
return this.invokeMethod("getDisplayNearestPoint", point);
|
|
2993
2977
|
}
|
|
2994
|
-
|
|
2995
|
-
return this.invokeMethod("
|
|
2978
|
+
getAllDisplays() {
|
|
2979
|
+
return this.invokeMethod("getAllDisplays");
|
|
2996
2980
|
}
|
|
2997
|
-
|
|
2998
|
-
return this.invokeMethod("
|
|
2981
|
+
getPrimaryDisplay() {
|
|
2982
|
+
return this.invokeMethod("getPrimaryDisplay");
|
|
2999
2983
|
}
|
|
3000
|
-
|
|
3001
|
-
|
|
2984
|
+
/**
|
|
2985
|
+
* 获取当前鼠标位置
|
|
2986
|
+
*/
|
|
2987
|
+
async getCursorScreenPoint() {
|
|
2988
|
+
return this.invokeMethod("getCursorScreenPoint");
|
|
3002
2989
|
}
|
|
3003
|
-
|
|
3004
|
-
return this.invokeMethod("
|
|
2990
|
+
async sendCtrlV() {
|
|
2991
|
+
return this.invokeMethod("sendCtrlV");
|
|
3005
2992
|
}
|
|
3006
|
-
|
|
3007
|
-
|
|
2993
|
+
/**
|
|
2994
|
+
* 判断是否所有按键都已经释放
|
|
2995
|
+
*/
|
|
2996
|
+
async isAllKeyReleased() {
|
|
2997
|
+
return this.invokeMethod("isAllKeyReleased");
|
|
3008
2998
|
}
|
|
3009
|
-
|
|
3010
|
-
return
|
|
2999
|
+
getChannel() {
|
|
3000
|
+
return "channel::cn.widgetjs.core.device" /* DEVICE */;
|
|
3011
3001
|
}
|
|
3012
|
-
|
|
3013
|
-
return this.invokeMethod("
|
|
3002
|
+
isCapsLockOn() {
|
|
3003
|
+
return this.invokeMethod("isCapsLockOn");
|
|
3014
3004
|
}
|
|
3005
|
+
};
|
|
3006
|
+
var DeviceApi = new DeviceApiImpl();
|
|
3007
|
+
|
|
3008
|
+
// src/api/DialogApi.ts
|
|
3009
|
+
var DialogApiImpl = class extends BaseApi {
|
|
3015
3010
|
getChannel() {
|
|
3016
|
-
return "channel::cn.widgetjs.core.
|
|
3011
|
+
return "channel::cn.widgetjs.core.dialog" /* DIALOG */;
|
|
3017
3012
|
}
|
|
3018
|
-
|
|
3019
|
-
return
|
|
3013
|
+
pickFile(extensions) {
|
|
3014
|
+
return this.invokeMethod("pickFile", extensions);
|
|
3020
3015
|
}
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
if (value === null || value === void 0) {
|
|
3024
|
-
return defaultValue;
|
|
3025
|
-
}
|
|
3026
|
-
if (typeof defaultValue == "boolean") {
|
|
3027
|
-
return value === "true";
|
|
3028
|
-
}
|
|
3029
|
-
if (typeof defaultValue == "number") {
|
|
3030
|
-
return Number(value);
|
|
3031
|
-
}
|
|
3032
|
-
return value;
|
|
3016
|
+
pickFolder() {
|
|
3017
|
+
return this.invokeMethod("pickFolder");
|
|
3033
3018
|
}
|
|
3034
|
-
|
|
3035
|
-
|
|
3019
|
+
};
|
|
3020
|
+
var DialogApi = new DialogApiImpl();
|
|
3021
|
+
|
|
3022
|
+
// src/api/ElectronApi.ts
|
|
3023
|
+
var ElectronApi = class {
|
|
3024
|
+
static async addIpcListener(key, f) {
|
|
3025
|
+
await ElectronUtils.getAPI()?.addIpcListener(key, f);
|
|
3036
3026
|
}
|
|
3037
|
-
async
|
|
3038
|
-
|
|
3027
|
+
static async removeIpcListener(key) {
|
|
3028
|
+
await ElectronUtils.getAPI()?.removeIpcListener(key);
|
|
3039
3029
|
}
|
|
3040
|
-
|
|
3041
|
-
|
|
3030
|
+
};
|
|
3031
|
+
|
|
3032
|
+
// src/api/FileApi.ts
|
|
3033
|
+
var FileApiImpl = class extends BaseApi {
|
|
3034
|
+
async readShortcutLink(shortcutPath) {
|
|
3035
|
+
return this.invokeMethod("readShortcutLink", shortcutPath);
|
|
3042
3036
|
}
|
|
3043
|
-
async
|
|
3044
|
-
return this.invokeMethod("
|
|
3037
|
+
async extractIcon(path, size) {
|
|
3038
|
+
return this.invokeMethod("extractIcon", path, size);
|
|
3045
3039
|
}
|
|
3046
|
-
|
|
3047
|
-
return this.invokeMethod("
|
|
3040
|
+
async delete(filePath) {
|
|
3041
|
+
return this.invokeMethod("delete", filePath);
|
|
3048
3042
|
}
|
|
3049
|
-
|
|
3050
|
-
return this.invokeMethod("
|
|
3043
|
+
async getPictureMetadata(filePath) {
|
|
3044
|
+
return this.invokeMethod("getPictureMetadata", filePath);
|
|
3051
3045
|
}
|
|
3052
|
-
|
|
3053
|
-
return this.invokeMethod("
|
|
3046
|
+
async move(form, to) {
|
|
3047
|
+
return this.invokeMethod("move", form, to);
|
|
3054
3048
|
}
|
|
3055
|
-
|
|
3056
|
-
return this.invokeMethod("
|
|
3049
|
+
async isDirectory(filePath) {
|
|
3050
|
+
return this.invokeMethod("isDirectory", filePath);
|
|
3057
3051
|
}
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
return this.invokeMethod("getLanguageCode");
|
|
3061
|
-
}
|
|
3062
|
-
return Promise.resolve(navigator.language);
|
|
3052
|
+
getChannel() {
|
|
3053
|
+
return "channel::cn.widgetjs.core.file" /* FILE */;
|
|
3063
3054
|
}
|
|
3064
|
-
async
|
|
3065
|
-
|
|
3055
|
+
async readDirectory(path, options) {
|
|
3056
|
+
return this.invokeMethod("readDirectory", path, options);
|
|
3066
3057
|
}
|
|
3067
|
-
|
|
3068
|
-
return this.invokeMethod("
|
|
3058
|
+
async downloadUrl(options) {
|
|
3059
|
+
return this.invokeMethod("downloadUrl", options);
|
|
3069
3060
|
}
|
|
3070
|
-
|
|
3071
|
-
return this.invokeMethod("
|
|
3061
|
+
async exists(filePath) {
|
|
3062
|
+
return this.invokeMethod("exists", filePath);
|
|
3072
3063
|
}
|
|
3073
|
-
|
|
3074
|
-
return this.invokeMethod("
|
|
3064
|
+
async readFile(filePath) {
|
|
3065
|
+
return this.invokeMethod("readFile", filePath);
|
|
3075
3066
|
}
|
|
3076
|
-
|
|
3077
|
-
return this.invokeMethod(
|
|
3067
|
+
async getDocumentFolder(filePath) {
|
|
3068
|
+
return this.invokeMethod("getDocumentFolder", filePath);
|
|
3078
3069
|
}
|
|
3079
|
-
|
|
3080
|
-
return this.invokeMethod(
|
|
3070
|
+
async getMimeType(absoluteFilePath) {
|
|
3071
|
+
return this.invokeMethod("getMimeType", absoluteFilePath);
|
|
3081
3072
|
}
|
|
3082
|
-
|
|
3083
|
-
return this.invokeMethod(
|
|
3073
|
+
async getFileInfo(absoluteFilePath) {
|
|
3074
|
+
return this.invokeMethod("getFileInfo", absoluteFilePath);
|
|
3075
|
+
}
|
|
3076
|
+
async showItemInFolder(fullPath) {
|
|
3077
|
+
return this.invokeMethod("showItemInFolder", fullPath);
|
|
3078
|
+
}
|
|
3079
|
+
async openPath(path) {
|
|
3080
|
+
return this.invokeMethod("openPath", path);
|
|
3081
|
+
}
|
|
3082
|
+
async trashItem(path) {
|
|
3083
|
+
return this.invokeMethod("trashItem", path);
|
|
3084
3084
|
}
|
|
3085
3085
|
};
|
|
3086
|
-
var
|
|
3086
|
+
var FileApi = new FileApiImpl();
|
|
3087
3087
|
|
|
3088
|
-
// src/api/
|
|
3089
|
-
var
|
|
3088
|
+
// src/api/HttpApi.ts
|
|
3089
|
+
var HttpApiImpl = class extends BaseApi {
|
|
3090
3090
|
getChannel() {
|
|
3091
|
-
return "channel::cn.widgetjs.core.
|
|
3091
|
+
return "channel::cn.widgetjs.core.http" /* HTTP */;
|
|
3092
3092
|
}
|
|
3093
|
-
|
|
3094
|
-
return this.invokeMethod("
|
|
3093
|
+
get(url, params) {
|
|
3094
|
+
return this.invokeMethod("get", url, params);
|
|
3095
3095
|
}
|
|
3096
|
-
|
|
3097
|
-
return this.invokeMethod("
|
|
3096
|
+
post(url, data) {
|
|
3097
|
+
return this.invokeMethod("post", url, data);
|
|
3098
3098
|
}
|
|
3099
3099
|
};
|
|
3100
|
-
var
|
|
3100
|
+
var HttpApi = new HttpApiImpl();
|
|
3101
|
+
|
|
3102
|
+
// src/api/interface/IAppApi.ts
|
|
3103
|
+
var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
|
|
3104
|
+
AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
|
|
3105
|
+
AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
|
|
3106
|
+
AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
|
|
3107
|
+
AppApiEvent2["PROXY_CHANGED"] = "event::cn.widgetjs.core.app.proxy.changed";
|
|
3108
|
+
AppApiEvent2["LANGUAGE_CHANGED"] = "event::cn.widgetjs.core.app.language.changed";
|
|
3109
|
+
return AppApiEvent2;
|
|
3110
|
+
})(AppApiEvent || {});
|
|
3111
|
+
var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
|
|
3112
|
+
AppApiConstants2["CONFIG_GRID_CELL_SIZE"] = "cn.widgetjs.config.grid.size";
|
|
3113
|
+
AppApiConstants2["CONFIG_WIDGET_THEME_CSS"] = "cn.widgetjs.config.widget.theme.css";
|
|
3114
|
+
AppApiConstants2["CONFIG_PROXY"] = "cn.widgetjs.config.app.proxy";
|
|
3115
|
+
AppApiConstants2["CONFIG_DEV_MODE"] = "cn.widgetjs.config.app.dev.mode";
|
|
3116
|
+
AppApiConstants2["CONFIG_LANGUAGE"] = "cn.widgetjs.config.app.language";
|
|
3117
|
+
return AppApiConstants2;
|
|
3118
|
+
})(AppApiConstants || {});
|
|
3119
|
+
|
|
3120
|
+
// src/api/interface/IWidgetPackageApi.ts
|
|
3121
|
+
var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
|
|
3122
|
+
WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
3123
|
+
WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
3124
|
+
return WidgetPackageApiEvent2;
|
|
3125
|
+
})(WidgetPackageApiEvent || {});
|
|
3126
|
+
|
|
3127
|
+
// src/api/interface/IMouseApi.ts
|
|
3128
|
+
var MouseApiEvent = /* @__PURE__ */ ((MouseApiEvent2) => {
|
|
3129
|
+
MouseApiEvent2["HOTSPOT_ACTIVE"] = "event::cn.widgetjs.core.mouse.hotspot.active";
|
|
3130
|
+
return MouseApiEvent2;
|
|
3131
|
+
})(MouseApiEvent || {});
|
|
3132
|
+
|
|
3133
|
+
// src/api/interface/ITrayApi.ts
|
|
3134
|
+
var TrayApiEvent = /* @__PURE__ */ ((TrayApiEvent2) => {
|
|
3135
|
+
TrayApiEvent2["CLICK"] = "channel::cn.widgetjs.core.tray.click";
|
|
3136
|
+
TrayApiEvent2["RIGHT_CLICK"] = "channel::cn.widgetjs.core.tray.right-click";
|
|
3137
|
+
TrayApiEvent2["MIDDLE_CLICK"] = "channel::cn.widgetjs.core.tray.middle-click";
|
|
3138
|
+
TrayApiEvent2["MOUSE_ENTER"] = "channel::cn.widgetjs.core.tray.mouse-enter";
|
|
3139
|
+
TrayApiEvent2["MOUSE_LEAVE"] = "channel::cn.widgetjs.core.tray.mouse-leave";
|
|
3140
|
+
return TrayApiEvent2;
|
|
3141
|
+
})(TrayApiEvent || {});
|
|
3142
|
+
|
|
3143
|
+
// src/api/interface/IUserApi.ts
|
|
3144
|
+
var UserApiEvent = /* @__PURE__ */ ((UserApiEvent2) => {
|
|
3145
|
+
UserApiEvent2["USER_UPDATED"] = `channel::cn.widgetjs.core.user.updated`;
|
|
3146
|
+
UserApiEvent2["SIGNED_OUT"] = `channel::cn.widgetjs.core.user.signed.out`;
|
|
3147
|
+
UserApiEvent2["SIGNED_IN"] = `channel::cn.widgetjs.core.user.signed.in`;
|
|
3148
|
+
UserApiEvent2["TOKEN_REFRESHED"] = `channel::cn.widgetjs.core.user.token.refreshed`;
|
|
3149
|
+
return UserApiEvent2;
|
|
3150
|
+
})(UserApiEvent || {});
|
|
3101
3151
|
|
|
3102
|
-
// src/api/
|
|
3103
|
-
var
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
async delete(key) {
|
|
3108
|
-
return this.invokeMethod("delete", key);
|
|
3109
|
-
}
|
|
3110
|
-
async get(key, defaultValue) {
|
|
3111
|
-
const result = await this.invokeMethod("get", key);
|
|
3112
|
-
if (result == null && defaultValue != void 0) {
|
|
3113
|
-
return defaultValue;
|
|
3114
|
-
}
|
|
3115
|
-
return result;
|
|
3116
|
-
}
|
|
3117
|
-
async getObject(key, defaultValue) {
|
|
3118
|
-
const result = await this.invokeMethod("get", key);
|
|
3119
|
-
if (result) {
|
|
3120
|
-
return JSON.parse(result);
|
|
3121
|
-
}
|
|
3122
|
-
if (defaultValue != void 0) {
|
|
3123
|
-
return defaultValue;
|
|
3124
|
-
}
|
|
3125
|
-
return void 0;
|
|
3126
|
-
}
|
|
3127
|
-
async set(key, value) {
|
|
3128
|
-
if (typeof value == "object") {
|
|
3129
|
-
return this.invokeMethod("set", key, JSON.stringify(value));
|
|
3130
|
-
}
|
|
3131
|
-
return this.invokeMethod("set", key, value);
|
|
3132
|
-
}
|
|
3133
|
-
decryptString(value) {
|
|
3134
|
-
return this.invokeMethod("decryptString", value);
|
|
3135
|
-
}
|
|
3136
|
-
decryptGet(key, defaultValue) {
|
|
3137
|
-
return this.invokeMethod("decryptGet", key, defaultValue);
|
|
3138
|
-
}
|
|
3139
|
-
encryptSet(key, value) {
|
|
3140
|
-
return this.invokeMethod("encryptSet", key, value);
|
|
3141
|
-
}
|
|
3142
|
-
encryptString(value) {
|
|
3143
|
-
return this.invokeMethod("encryptString", value);
|
|
3144
|
-
}
|
|
3145
|
-
};
|
|
3146
|
-
var StorageApi = new StorageApiImpl();
|
|
3147
|
-
var StoreApi = new StorageApiImpl();
|
|
3152
|
+
// src/api/interface/IAiApi.ts
|
|
3153
|
+
var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
|
|
3154
|
+
AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
|
|
3155
|
+
return AiApiEvent2;
|
|
3156
|
+
})(AiApiEvent || {});
|
|
3148
3157
|
|
|
3149
3158
|
// src/api/LogApi.ts
|
|
3150
3159
|
var LogApiImpl = class extends BaseApi {
|
|
@@ -3174,61 +3183,254 @@ var LogApiImpl = class extends BaseApi {
|
|
|
3174
3183
|
};
|
|
3175
3184
|
var LogApi = new LogApiImpl();
|
|
3176
3185
|
|
|
3177
|
-
// src/api/
|
|
3178
|
-
var
|
|
3179
|
-
|
|
3180
|
-
|
|
3186
|
+
// src/api/MenuApi.ts
|
|
3187
|
+
var MenuApiEvent = /* @__PURE__ */ ((MenuApiEvent2) => {
|
|
3188
|
+
MenuApiEvent2["ITEM_CLICK"] = "event::cn.widgetjs.core.menu.item.click";
|
|
3189
|
+
return MenuApiEvent2;
|
|
3190
|
+
})(MenuApiEvent || {});
|
|
3191
|
+
var MenuApiImpl = class extends BaseApi {
|
|
3192
|
+
getChannel() {
|
|
3193
|
+
return "channel::cn.widgetjs.core.menu" /* MENU */;
|
|
3181
3194
|
}
|
|
3182
|
-
|
|
3183
|
-
|
|
3195
|
+
/**
|
|
3196
|
+
* Add items to the context menu
|
|
3197
|
+
* @param menuItems The menu items to add
|
|
3198
|
+
*/
|
|
3199
|
+
addContextMenuItem(menuItems) {
|
|
3200
|
+
return this.invokeMethod("addContextMenuItem", menuItems);
|
|
3184
3201
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3202
|
+
/**
|
|
3203
|
+
* Add items to the application menu
|
|
3204
|
+
* @param menuItems The menu items to add
|
|
3205
|
+
*/
|
|
3206
|
+
addMenuItem(menuItems) {
|
|
3207
|
+
return this.invokeMethod("addMenuItem", menuItems);
|
|
3187
3208
|
}
|
|
3188
|
-
|
|
3189
|
-
|
|
3209
|
+
/**
|
|
3210
|
+
* Show a menu programmatically
|
|
3211
|
+
* @param options The options for showing the menu
|
|
3212
|
+
*/
|
|
3213
|
+
showMenu(options) {
|
|
3214
|
+
return this.invokeMethod("showMenu", options);
|
|
3190
3215
|
}
|
|
3191
|
-
|
|
3192
|
-
|
|
3216
|
+
/**
|
|
3217
|
+
* Remove items from the application menu
|
|
3218
|
+
* @param menuItemIds The IDs of the menu items to remove
|
|
3219
|
+
*/
|
|
3220
|
+
removeMenuItem(menuItemIds) {
|
|
3221
|
+
return this.invokeMethod("removeMenuItem", menuItemIds);
|
|
3193
3222
|
}
|
|
3194
|
-
|
|
3195
|
-
|
|
3223
|
+
/**
|
|
3224
|
+
* Remove items from the context menu
|
|
3225
|
+
* @param menuItemIds The IDs of the menu items to remove
|
|
3226
|
+
*/
|
|
3227
|
+
removeContextMenuItem(menuItemIds) {
|
|
3228
|
+
return this.invokeMethod("removeContextMenuItem", menuItemIds);
|
|
3196
3229
|
}
|
|
3230
|
+
};
|
|
3231
|
+
var MenuApi = new MenuApiImpl();
|
|
3232
|
+
|
|
3233
|
+
// src/api/MouseApi.ts
|
|
3234
|
+
var MouseApiImpl = class extends BaseApi {
|
|
3197
3235
|
getChannel() {
|
|
3198
|
-
return "channel::cn.widgetjs.core.
|
|
3236
|
+
return "channel::cn.widgetjs.core.mouse" /* MOUSE */;
|
|
3237
|
+
}
|
|
3238
|
+
removeHotspot() {
|
|
3239
|
+
return this.invokeMethod("removeHotspot");
|
|
3240
|
+
}
|
|
3241
|
+
createHotspot(rect) {
|
|
3242
|
+
return this.invokeMethod("createHotspot", rect);
|
|
3243
|
+
}
|
|
3244
|
+
};
|
|
3245
|
+
var MouseApi = new MouseApiImpl();
|
|
3246
|
+
|
|
3247
|
+
// src/api/NotificationApi.ts
|
|
3248
|
+
var NotificationApiEvent = /* @__PURE__ */ ((NotificationApiEvent2) => {
|
|
3249
|
+
NotificationApiEvent2["CONFIRM"] = "event::cn.widgetjs.core.notification.confirm";
|
|
3250
|
+
NotificationApiEvent2["CANCEL"] = "event::cn.widgetjs.core.notification.cancel";
|
|
3251
|
+
NotificationApiEvent2["HIDE"] = "event::cn.widgetjs.core.notification.hide";
|
|
3252
|
+
return NotificationApiEvent2;
|
|
3253
|
+
})(NotificationApiEvent || {});
|
|
3254
|
+
var NotificationApiImpl = class extends BaseApi {
|
|
3255
|
+
// static async url(url: string, duration: number = -1) {
|
|
3256
|
+
// this.invoke(Channel.NOTIFICATION, new AppNotification({
|
|
3257
|
+
// url, message: "",
|
|
3258
|
+
// duration,
|
|
3259
|
+
// type: "url",
|
|
3260
|
+
// }));
|
|
3261
|
+
// }
|
|
3262
|
+
/**
|
|
3263
|
+
* 来电
|
|
3264
|
+
* @param avatar 头像地址
|
|
3265
|
+
* @param audio 音频地址
|
|
3266
|
+
* @param title 标题文件
|
|
3267
|
+
* @param message 初始消息
|
|
3268
|
+
* @param lyric 歌词字符串
|
|
3269
|
+
*/
|
|
3270
|
+
async call(avatar, audio, title, message, lyric) {
|
|
3271
|
+
await this.invoke(new AppNotification({
|
|
3272
|
+
avatar,
|
|
3273
|
+
audio,
|
|
3274
|
+
message,
|
|
3275
|
+
title,
|
|
3276
|
+
duration: -1,
|
|
3277
|
+
lyric,
|
|
3278
|
+
type: "call"
|
|
3279
|
+
}));
|
|
3280
|
+
}
|
|
3281
|
+
async send(notification) {
|
|
3282
|
+
return this.invokeMethod("send", notification);
|
|
3283
|
+
}
|
|
3284
|
+
async reminder(option) {
|
|
3285
|
+
return await this.send(new AppReminderNotification(option));
|
|
3286
|
+
}
|
|
3287
|
+
async advanceCountdown(message, targetTime, title) {
|
|
3288
|
+
return await this.send(new AppNotification({
|
|
3289
|
+
title,
|
|
3290
|
+
message,
|
|
3291
|
+
targetTime,
|
|
3292
|
+
type: "advance-countdown"
|
|
3293
|
+
}));
|
|
3294
|
+
}
|
|
3295
|
+
async countdown(message, targetTime) {
|
|
3296
|
+
await this.send(new AppNotification({
|
|
3297
|
+
message,
|
|
3298
|
+
targetTime,
|
|
3299
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
3300
|
+
duration: -1,
|
|
3301
|
+
type: "countdown"
|
|
3302
|
+
}));
|
|
3303
|
+
}
|
|
3304
|
+
async success(message, duration = 5e3) {
|
|
3305
|
+
await this.send(new AppNotification({
|
|
3306
|
+
message,
|
|
3307
|
+
type: "success",
|
|
3308
|
+
icon: "check-one",
|
|
3309
|
+
duration
|
|
3310
|
+
}));
|
|
3311
|
+
}
|
|
3312
|
+
async error(message, duration = 5e3) {
|
|
3313
|
+
await this.send(new AppNotification({
|
|
3314
|
+
message,
|
|
3315
|
+
type: "error",
|
|
3316
|
+
icon: "close-one",
|
|
3317
|
+
duration
|
|
3318
|
+
}));
|
|
3319
|
+
}
|
|
3320
|
+
async warning(message, duration = 5e3) {
|
|
3321
|
+
await this.send(new AppNotification({
|
|
3322
|
+
message,
|
|
3323
|
+
type: "warning",
|
|
3324
|
+
icon: "attention",
|
|
3325
|
+
duration
|
|
3326
|
+
}));
|
|
3327
|
+
}
|
|
3328
|
+
async info(message, duration = 5e3) {
|
|
3329
|
+
await this.send(new AppNotification({
|
|
3330
|
+
message,
|
|
3331
|
+
type: "info",
|
|
3332
|
+
icon: "info",
|
|
3333
|
+
duration
|
|
3334
|
+
}));
|
|
3335
|
+
}
|
|
3336
|
+
/**
|
|
3337
|
+
* 隐藏通知
|
|
3338
|
+
*/
|
|
3339
|
+
async hide() {
|
|
3340
|
+
await this.invokeMethod("hide");
|
|
3341
|
+
}
|
|
3342
|
+
getChannel() {
|
|
3343
|
+
return "channel::cn.widgetjs.core.notification" /* NOTIFICATION */;
|
|
3344
|
+
}
|
|
3345
|
+
};
|
|
3346
|
+
var NotificationApi = new NotificationApiImpl();
|
|
3347
|
+
|
|
3348
|
+
// src/api/ProcessApi.ts
|
|
3349
|
+
var ProcessApiImpl = class extends BaseApi {
|
|
3350
|
+
getChannel() {
|
|
3351
|
+
return "channel::cn.widgetjs.core.process" /* PROCESS */;
|
|
3352
|
+
}
|
|
3353
|
+
getBlinkMemoryInfo() {
|
|
3354
|
+
return this.invokeMethod("getBlinkMemoryInfo");
|
|
3355
|
+
}
|
|
3356
|
+
getHeapStatistics() {
|
|
3357
|
+
return this.invokeMethod("getHeapStatistics");
|
|
3358
|
+
}
|
|
3359
|
+
getProcessMemoryInfo() {
|
|
3360
|
+
return this.invokeMethod("getProcessMemoryInfo");
|
|
3361
|
+
}
|
|
3362
|
+
getSystemVersion() {
|
|
3363
|
+
return this.invokeMethod("getSystemVersion");
|
|
3364
|
+
}
|
|
3365
|
+
};
|
|
3366
|
+
var ProcessApi = new ProcessApiImpl();
|
|
3367
|
+
|
|
3368
|
+
// src/api/interface/IShortcutApi.ts
|
|
3369
|
+
var ShortcutApiEvent = /* @__PURE__ */ ((ShortcutApiEvent2) => {
|
|
3370
|
+
ShortcutApiEvent2["TRIGGERED"] = "channel::cn.widgetjs.core.shortcut.triggered";
|
|
3371
|
+
return ShortcutApiEvent2;
|
|
3372
|
+
})(ShortcutApiEvent || {});
|
|
3373
|
+
|
|
3374
|
+
// src/api/ShortcutApi.ts
|
|
3375
|
+
var ShortcutApiImpl = class extends BaseApi {
|
|
3376
|
+
getChannel() {
|
|
3377
|
+
return "channel::cn.widgetjs.core.shortcut" /* SHORTCUT */;
|
|
3378
|
+
}
|
|
3379
|
+
async register(shortcut) {
|
|
3380
|
+
return await this.invokeMethod("register", shortcut);
|
|
3199
3381
|
}
|
|
3200
|
-
async
|
|
3201
|
-
return this.invokeMethod("
|
|
3382
|
+
async unregister(shortcut) {
|
|
3383
|
+
return await this.invokeMethod("unregister", shortcut);
|
|
3202
3384
|
}
|
|
3203
|
-
|
|
3204
|
-
|
|
3385
|
+
};
|
|
3386
|
+
var ShortcutApi = new ShortcutApiImpl();
|
|
3387
|
+
|
|
3388
|
+
// src/api/StorageApi.ts
|
|
3389
|
+
var StorageApiImpl = class extends BaseApi {
|
|
3390
|
+
getChannel() {
|
|
3391
|
+
return "channel::cn.widgetjs.core.store" /* STORE */;
|
|
3205
3392
|
}
|
|
3206
|
-
async
|
|
3207
|
-
return this.invokeMethod("
|
|
3393
|
+
async delete(key) {
|
|
3394
|
+
return this.invokeMethod("delete", key);
|
|
3208
3395
|
}
|
|
3209
|
-
async
|
|
3210
|
-
|
|
3396
|
+
async get(key, defaultValue) {
|
|
3397
|
+
const result = await this.invokeMethod("get", key);
|
|
3398
|
+
if (result == null && defaultValue != void 0) {
|
|
3399
|
+
return defaultValue;
|
|
3400
|
+
}
|
|
3401
|
+
return result;
|
|
3211
3402
|
}
|
|
3212
|
-
async
|
|
3213
|
-
|
|
3403
|
+
async getObject(key, defaultValue) {
|
|
3404
|
+
const result = await this.invokeMethod("get", key);
|
|
3405
|
+
if (result) {
|
|
3406
|
+
return JSON.parse(result);
|
|
3407
|
+
}
|
|
3408
|
+
if (defaultValue != void 0) {
|
|
3409
|
+
return defaultValue;
|
|
3410
|
+
}
|
|
3411
|
+
return void 0;
|
|
3214
3412
|
}
|
|
3215
|
-
async
|
|
3216
|
-
|
|
3413
|
+
async set(key, value) {
|
|
3414
|
+
if (typeof value == "object") {
|
|
3415
|
+
return this.invokeMethod("set", key, JSON.stringify(value));
|
|
3416
|
+
}
|
|
3417
|
+
return this.invokeMethod("set", key, value);
|
|
3217
3418
|
}
|
|
3218
|
-
|
|
3219
|
-
return this.invokeMethod("
|
|
3419
|
+
decryptString(value) {
|
|
3420
|
+
return this.invokeMethod("decryptString", value);
|
|
3220
3421
|
}
|
|
3221
|
-
|
|
3222
|
-
return this.invokeMethod("
|
|
3422
|
+
decryptGet(key, defaultValue) {
|
|
3423
|
+
return this.invokeMethod("decryptGet", key, defaultValue);
|
|
3223
3424
|
}
|
|
3224
|
-
|
|
3225
|
-
return this.invokeMethod("
|
|
3425
|
+
encryptSet(key, value) {
|
|
3426
|
+
return this.invokeMethod("encryptSet", key, value);
|
|
3226
3427
|
}
|
|
3227
|
-
|
|
3228
|
-
return this.invokeMethod("
|
|
3428
|
+
encryptString(value) {
|
|
3429
|
+
return this.invokeMethod("encryptString", value);
|
|
3229
3430
|
}
|
|
3230
3431
|
};
|
|
3231
|
-
var
|
|
3432
|
+
var StorageApi = new StorageApiImpl();
|
|
3433
|
+
var StoreApi = new StorageApiImpl();
|
|
3232
3434
|
|
|
3233
3435
|
// src/api/structures/Gravity.ts
|
|
3234
3436
|
var Gravity = /* @__PURE__ */ ((Gravity2) => {
|
|
@@ -3259,76 +3461,255 @@ var SystemApiImpl = class extends BaseApi {
|
|
|
3259
3461
|
getWallpaper() {
|
|
3260
3462
|
return this.invokeMethod("getWallpaper");
|
|
3261
3463
|
}
|
|
3262
|
-
|
|
3263
|
-
return this.invokeMethod("
|
|
3464
|
+
getInfo(valuesObject) {
|
|
3465
|
+
return this.invokeMethod("getInfo", valuesObject);
|
|
3466
|
+
}
|
|
3467
|
+
getUptime() {
|
|
3468
|
+
return this.invokeMethod("getUptime");
|
|
3469
|
+
}
|
|
3470
|
+
};
|
|
3471
|
+
var SystemApi = new SystemApiImpl();
|
|
3472
|
+
|
|
3473
|
+
// src/api/TrayApi.ts
|
|
3474
|
+
var TrayApiImpl = class extends BaseApi {
|
|
3475
|
+
getChannel() {
|
|
3476
|
+
return "channel::cn.widgetjs.core.tray" /* TRAY */;
|
|
3477
|
+
}
|
|
3478
|
+
setTray(options) {
|
|
3479
|
+
return this.invokeMethod("setTray", options);
|
|
3480
|
+
}
|
|
3481
|
+
removeTray() {
|
|
3482
|
+
return this.invokeMethod("removeTray");
|
|
3483
|
+
}
|
|
3484
|
+
displayBalloon(options) {
|
|
3485
|
+
return this.invokeMethod("displayBalloon", options);
|
|
3486
|
+
}
|
|
3487
|
+
removeBalloon() {
|
|
3488
|
+
return this.invokeMethod("removeBalloon");
|
|
3489
|
+
}
|
|
3490
|
+
setContextMenu(menus) {
|
|
3491
|
+
return this.invokeMethod("setContextMenu", menus);
|
|
3492
|
+
}
|
|
3493
|
+
closeContextMenu() {
|
|
3494
|
+
return this.invokeMethod("closeContextMenu");
|
|
3495
|
+
}
|
|
3496
|
+
popUpContextMenu(menus, position) {
|
|
3497
|
+
return this.invokeMethod("popUpContextMenu", menus, position);
|
|
3498
|
+
}
|
|
3499
|
+
isDestroyed() {
|
|
3500
|
+
return this.invokeMethod("isDestroyed");
|
|
3501
|
+
}
|
|
3502
|
+
getBounds() {
|
|
3503
|
+
return this.invokeMethod("getBounds");
|
|
3504
|
+
}
|
|
3505
|
+
focus() {
|
|
3506
|
+
return this.invokeMethod("focus");
|
|
3507
|
+
}
|
|
3508
|
+
};
|
|
3509
|
+
var TrayApi = new TrayApiImpl();
|
|
3510
|
+
|
|
3511
|
+
// src/api/UserApi.ts
|
|
3512
|
+
var UserApiImpl = class extends BaseApi {
|
|
3513
|
+
async getSession() {
|
|
3514
|
+
return await this.invokeMethod("getSession");
|
|
3515
|
+
}
|
|
3516
|
+
async updateSession(session) {
|
|
3517
|
+
await this.invokeMethod("updateSession", session);
|
|
3518
|
+
}
|
|
3519
|
+
async updateUser(user) {
|
|
3520
|
+
await this.invokeMethod("updateUser", user);
|
|
3521
|
+
}
|
|
3522
|
+
async login(session) {
|
|
3523
|
+
await this.invokeMethod("login", session);
|
|
3524
|
+
}
|
|
3525
|
+
async logout() {
|
|
3526
|
+
await this.invokeMethod("logout");
|
|
3527
|
+
}
|
|
3528
|
+
async getUser() {
|
|
3529
|
+
return await this.invokeMethod("getUser");
|
|
3530
|
+
}
|
|
3531
|
+
getChannel() {
|
|
3532
|
+
return "channel::cn.widgetjs.core.user" /* USER */;
|
|
3533
|
+
}
|
|
3534
|
+
};
|
|
3535
|
+
var UserApi = new UserApiImpl();
|
|
3536
|
+
|
|
3537
|
+
// src/api/WidgetApi.ts
|
|
3538
|
+
var WidgetApiEvent = /* @__PURE__ */ ((WidgetApiEvent2) => {
|
|
3539
|
+
WidgetApiEvent2["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data-changed";
|
|
3540
|
+
WidgetApiEvent2["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
|
|
3541
|
+
WidgetApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
3542
|
+
WidgetApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
3543
|
+
return WidgetApiEvent2;
|
|
3544
|
+
})(WidgetApiEvent || {});
|
|
3545
|
+
var WidgetApiImpl = class extends BaseApi {
|
|
3546
|
+
getSyncInfo(widgetName) {
|
|
3547
|
+
return this.invokeMethod("getSyncInfo", widgetName);
|
|
3548
|
+
}
|
|
3549
|
+
updateSyncInfo() {
|
|
3550
|
+
return this.invokeMethod("updateSyncInfo");
|
|
3551
|
+
}
|
|
3552
|
+
reload(id) {
|
|
3553
|
+
return this.invokeMethod("reload", id);
|
|
3554
|
+
}
|
|
3555
|
+
getChannel() {
|
|
3556
|
+
return "channel::cn.widgetjs.core.widget" /* WIDGET */;
|
|
3557
|
+
}
|
|
3558
|
+
async registerWidgets(widgets) {
|
|
3559
|
+
return this.invokeMethod("registerWidgets", JSON.stringify(widgets));
|
|
3560
|
+
}
|
|
3561
|
+
async registerWidgetPackage(widgetPackage) {
|
|
3562
|
+
return this.invokeMethod("registerWidgetPackage", JSON.stringify(widgetPackage));
|
|
3563
|
+
}
|
|
3564
|
+
async getWidgets() {
|
|
3565
|
+
const data = await this.invokeMethod("getWidgets");
|
|
3566
|
+
const widgets = [];
|
|
3567
|
+
if (data) {
|
|
3568
|
+
for (const item of data) {
|
|
3569
|
+
widgets.push(Widget.parseObject(item));
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
return widgets;
|
|
3573
|
+
}
|
|
3574
|
+
async openConfigPage(widgetId) {
|
|
3575
|
+
return this.invokeMethod("openConfigPage", widgetId);
|
|
3576
|
+
}
|
|
3577
|
+
async openConfigPageByName(widgetName) {
|
|
3578
|
+
return this.invokeMethod("openConfigPageByName", widgetName);
|
|
3579
|
+
}
|
|
3580
|
+
/**
|
|
3581
|
+
* @deprecated
|
|
3582
|
+
*/
|
|
3583
|
+
async getWidgetPackages() {
|
|
3584
|
+
return await this.invokeMethod("getWidgetPackages");
|
|
3585
|
+
}
|
|
3586
|
+
/**
|
|
3587
|
+
*
|
|
3588
|
+
* @param name package name
|
|
3589
|
+
*/
|
|
3590
|
+
async getWidget(name) {
|
|
3591
|
+
return Widget.parseObject(await this.invokeMethod("getWidget", name));
|
|
3592
|
+
}
|
|
3593
|
+
/**
|
|
3594
|
+
* @param name package name
|
|
3595
|
+
* @deprecated
|
|
3596
|
+
*/
|
|
3597
|
+
async getWidgetPackage(name) {
|
|
3598
|
+
const result = await this.invokeMethod("getWidgetPackage", name);
|
|
3599
|
+
if (result) {
|
|
3600
|
+
return WidgetPackage.parseObject(result);
|
|
3601
|
+
}
|
|
3602
|
+
return void 0;
|
|
3603
|
+
}
|
|
3604
|
+
async getWidgetPackageUrl(packageName) {
|
|
3605
|
+
const widgetPackage = await this.getWidgetPackage(packageName);
|
|
3606
|
+
if (!widgetPackage) {
|
|
3607
|
+
return null;
|
|
3608
|
+
}
|
|
3609
|
+
return widgetPackage.url;
|
|
3610
|
+
}
|
|
3611
|
+
async upgradePackage(packageName) {
|
|
3612
|
+
return await this.invokeMethod("upgradePackage", packageName);
|
|
3613
|
+
}
|
|
3614
|
+
/**
|
|
3615
|
+
* 阻止拖动窗口,只能用于悬浮窗口 DeployMode.OVERLAP
|
|
3616
|
+
* @param draggable
|
|
3617
|
+
*/
|
|
3618
|
+
setMouseDraggable(draggable) {
|
|
3619
|
+
return this.invokeMethod("setMouseDraggable", draggable);
|
|
3620
|
+
}
|
|
3621
|
+
isIgnoreMouseEvents(widgetId) {
|
|
3622
|
+
return this.invokeMethod("isIgnoreMouseEvents", widgetId);
|
|
3623
|
+
}
|
|
3624
|
+
setIgnoreMouseEvents(widgetId, ignore) {
|
|
3625
|
+
return this.invokeMethod("setIgnoreMouseEvents", widgetId, ignore);
|
|
3626
|
+
}
|
|
3627
|
+
restartWidgets(mode) {
|
|
3628
|
+
return this.invokeMethod("restartWidgets", mode);
|
|
3629
|
+
}
|
|
3630
|
+
};
|
|
3631
|
+
var WidgetApi = new WidgetApiImpl();
|
|
3632
|
+
var WidgetDataApiImpl = class {
|
|
3633
|
+
stores = /* @__PURE__ */ new Map();
|
|
3634
|
+
/**
|
|
3635
|
+
* 保存组件数据
|
|
3636
|
+
* @param data
|
|
3637
|
+
* @param options
|
|
3638
|
+
*/
|
|
3639
|
+
async save(data, options = { sendBroadcast: true }) {
|
|
3640
|
+
const store = this.getStore(data.name, options.storeName);
|
|
3641
|
+
const json = JSON.stringify(data);
|
|
3642
|
+
const result = await store.setItem(this.getKey(data.name, data.id), json);
|
|
3643
|
+
if (options.sendBroadcast) {
|
|
3644
|
+
const broadcastEvent = new BroadcastEvent({
|
|
3645
|
+
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
3646
|
+
payload: { name: data.name, json }
|
|
3647
|
+
});
|
|
3648
|
+
await BroadcastApi.send(broadcastEvent);
|
|
3649
|
+
}
|
|
3650
|
+
return result;
|
|
3651
|
+
}
|
|
3652
|
+
getStore(widgetName, storeName) {
|
|
3653
|
+
if (this.stores.has(widgetName)) {
|
|
3654
|
+
return this.stores.get(widgetName);
|
|
3655
|
+
}
|
|
3656
|
+
const store = localforage.createInstance({ name: widgetName, storeName });
|
|
3657
|
+
this.stores.set(widgetName, store);
|
|
3658
|
+
return store;
|
|
3659
|
+
}
|
|
3660
|
+
/**
|
|
3661
|
+
* 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
|
|
3662
|
+
* @param data
|
|
3663
|
+
* @param options
|
|
3664
|
+
*/
|
|
3665
|
+
async saveByName(data, options = { sendBroadcast: true }) {
|
|
3666
|
+
const store = this.getStore(data.name);
|
|
3667
|
+
const json = JSON.stringify(data);
|
|
3668
|
+
const result = await store.setItem(data.name, json);
|
|
3669
|
+
if (options?.sendBroadcast) {
|
|
3670
|
+
const broadcastEvent = new BroadcastEvent({
|
|
3671
|
+
event: "event::cn.widgetjs.core.widget.data-changed" /* DATA_CHANGED */,
|
|
3672
|
+
payload: { name: data.name, json }
|
|
3673
|
+
});
|
|
3674
|
+
await BroadcastApi.send(broadcastEvent);
|
|
3675
|
+
}
|
|
3676
|
+
return result;
|
|
3264
3677
|
}
|
|
3265
|
-
|
|
3266
|
-
|
|
3678
|
+
async findByName(...args) {
|
|
3679
|
+
let name = "";
|
|
3680
|
+
let dbStr = "";
|
|
3681
|
+
let data;
|
|
3682
|
+
if (args.length === 2) {
|
|
3683
|
+
name = args[0];
|
|
3684
|
+
const Type = args[1];
|
|
3685
|
+
data = new Type(name);
|
|
3686
|
+
} else {
|
|
3687
|
+
data = args[0];
|
|
3688
|
+
name = data.name;
|
|
3689
|
+
}
|
|
3690
|
+
const store = this.getStore(name);
|
|
3691
|
+
dbStr = await store.getItem(name);
|
|
3692
|
+
if (dbStr) {
|
|
3693
|
+
data.parseJSON(JSON.parse(dbStr));
|
|
3694
|
+
return data;
|
|
3695
|
+
}
|
|
3696
|
+
return void 0;
|
|
3267
3697
|
}
|
|
3268
|
-
|
|
3269
|
-
|
|
3698
|
+
async find(name, id, Type) {
|
|
3699
|
+
const store = this.getStore(name);
|
|
3700
|
+
const result = await store.getItem(this.getKey(name, id));
|
|
3701
|
+
if (result) {
|
|
3702
|
+
const widgetData = new Type(name, id);
|
|
3703
|
+
widgetData.parseJSON(JSON.parse(result));
|
|
3704
|
+
return widgetData;
|
|
3705
|
+
}
|
|
3706
|
+
return void 0;
|
|
3270
3707
|
}
|
|
3271
|
-
|
|
3272
|
-
return
|
|
3708
|
+
getKey(name, id) {
|
|
3709
|
+
return `${name}@${id}`;
|
|
3273
3710
|
}
|
|
3274
3711
|
};
|
|
3275
|
-
var
|
|
3276
|
-
|
|
3277
|
-
// src/api/interface/IAppApi.ts
|
|
3278
|
-
var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
|
|
3279
|
-
AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
|
|
3280
|
-
AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
|
|
3281
|
-
AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
|
|
3282
|
-
AppApiEvent2["PROXY_CHANGED"] = "event::cn.widgetjs.core.app.proxy.changed";
|
|
3283
|
-
AppApiEvent2["LANGUAGE_CHANGED"] = "event::cn.widgetjs.core.app.language.changed";
|
|
3284
|
-
return AppApiEvent2;
|
|
3285
|
-
})(AppApiEvent || {});
|
|
3286
|
-
var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
|
|
3287
|
-
AppApiConstants2["CONFIG_GRID_CELL_SIZE"] = "cn.widgetjs.config.grid.size";
|
|
3288
|
-
AppApiConstants2["CONFIG_WIDGET_THEME_CSS"] = "cn.widgetjs.config.widget.theme.css";
|
|
3289
|
-
AppApiConstants2["CONFIG_PROXY"] = "cn.widgetjs.config.app.proxy";
|
|
3290
|
-
AppApiConstants2["CONFIG_DEV_MODE"] = "cn.widgetjs.config.app.dev.mode";
|
|
3291
|
-
AppApiConstants2["CONFIG_LANGUAGE"] = "cn.widgetjs.config.app.language";
|
|
3292
|
-
return AppApiConstants2;
|
|
3293
|
-
})(AppApiConstants || {});
|
|
3294
|
-
|
|
3295
|
-
// src/api/interface/IWidgetPackageApi.ts
|
|
3296
|
-
var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
|
|
3297
|
-
WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
|
|
3298
|
-
WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
|
|
3299
|
-
return WidgetPackageApiEvent2;
|
|
3300
|
-
})(WidgetPackageApiEvent || {});
|
|
3301
|
-
|
|
3302
|
-
// src/api/interface/IMouseApi.ts
|
|
3303
|
-
var MouseApiEvent = /* @__PURE__ */ ((MouseApiEvent2) => {
|
|
3304
|
-
MouseApiEvent2["HOTSPOT_ACTIVE"] = "event::cn.widgetjs.core.mouse.hotspot.active";
|
|
3305
|
-
return MouseApiEvent2;
|
|
3306
|
-
})(MouseApiEvent || {});
|
|
3307
|
-
|
|
3308
|
-
// src/api/interface/ITrayApi.ts
|
|
3309
|
-
var TrayApiEvent = /* @__PURE__ */ ((TrayApiEvent2) => {
|
|
3310
|
-
TrayApiEvent2["CLICK"] = "channel::cn.widgetjs.core.tray.click";
|
|
3311
|
-
TrayApiEvent2["RIGHT_CLICK"] = "channel::cn.widgetjs.core.tray.right-click";
|
|
3312
|
-
TrayApiEvent2["MIDDLE_CLICK"] = "channel::cn.widgetjs.core.tray.middle-click";
|
|
3313
|
-
TrayApiEvent2["MOUSE_ENTER"] = "channel::cn.widgetjs.core.tray.mouse-enter";
|
|
3314
|
-
TrayApiEvent2["MOUSE_LEAVE"] = "channel::cn.widgetjs.core.tray.mouse-leave";
|
|
3315
|
-
return TrayApiEvent2;
|
|
3316
|
-
})(TrayApiEvent || {});
|
|
3317
|
-
|
|
3318
|
-
// src/api/interface/IUserApi.ts
|
|
3319
|
-
var UserApiEvent = /* @__PURE__ */ ((UserApiEvent2) => {
|
|
3320
|
-
UserApiEvent2["USER_UPDATED"] = `channel::cn.widgetjs.core.user.updated`;
|
|
3321
|
-
UserApiEvent2["SIGNED_OUT"] = `channel::cn.widgetjs.core.user.signed.out`;
|
|
3322
|
-
UserApiEvent2["SIGNED_IN"] = `channel::cn.widgetjs.core.user.signed.in`;
|
|
3323
|
-
UserApiEvent2["TOKEN_REFRESHED"] = `channel::cn.widgetjs.core.user.token.refreshed`;
|
|
3324
|
-
return UserApiEvent2;
|
|
3325
|
-
})(UserApiEvent || {});
|
|
3326
|
-
|
|
3327
|
-
// src/api/interface/IAiApi.ts
|
|
3328
|
-
var AiApiEvent = /* @__PURE__ */ ((AiApiEvent2) => {
|
|
3329
|
-
AiApiEvent2["CONFIG_UPDATED"] = `channel::cn.widgetjs.core.ai.config.updated`;
|
|
3330
|
-
return AiApiEvent2;
|
|
3331
|
-
})(AiApiEvent || {});
|
|
3712
|
+
var WidgetDataApi = new WidgetDataApiImpl();
|
|
3332
3713
|
|
|
3333
3714
|
// src/api/WidgetPackageApi.ts
|
|
3334
3715
|
var WidgetPackageApiImpl = class extends BaseApi {
|
|
@@ -3341,11 +3722,11 @@ var WidgetPackageApiImpl = class extends BaseApi {
|
|
|
3341
3722
|
}
|
|
3342
3723
|
return this.invokeMethod("install", JSON.stringify(widgetPackage));
|
|
3343
3724
|
}
|
|
3344
|
-
async uninstall(widgetPackage) {
|
|
3725
|
+
async uninstall(widgetPackage, clearData) {
|
|
3345
3726
|
if (typeof widgetPackage == "string") {
|
|
3346
|
-
return this.invokeMethod("uninstall", widgetPackage);
|
|
3727
|
+
return this.invokeMethod("uninstall", widgetPackage, clearData);
|
|
3347
3728
|
}
|
|
3348
|
-
return this.invokeMethod("uninstall", widgetPackage.name);
|
|
3729
|
+
return this.invokeMethod("uninstall", widgetPackage.name, clearData);
|
|
3349
3730
|
}
|
|
3350
3731
|
upgrade(packageName, remoteUrlInfo) {
|
|
3351
3732
|
return this.invokeMethod("upgrade", packageName, remoteUrlInfo);
|
|
@@ -3389,171 +3770,6 @@ var WidgetPackageApiImpl = class extends BaseApi {
|
|
|
3389
3770
|
};
|
|
3390
3771
|
var WidgetPackageApi = new WidgetPackageApiImpl();
|
|
3391
3772
|
|
|
3392
|
-
|
|
3393
|
-
var MenuApiEvent = /* @__PURE__ */ ((MenuApiEvent2) => {
|
|
3394
|
-
MenuApiEvent2["ITEM_CLICK"] = "event::cn.widgetjs.core.menu.item.click";
|
|
3395
|
-
return MenuApiEvent2;
|
|
3396
|
-
})(MenuApiEvent || {});
|
|
3397
|
-
var MenuApiImpl = class extends BaseApi {
|
|
3398
|
-
getChannel() {
|
|
3399
|
-
return "channel::cn.widgetjs.core.menu" /* MENU */;
|
|
3400
|
-
}
|
|
3401
|
-
/**
|
|
3402
|
-
* Add items to the context menu
|
|
3403
|
-
* @param menuItems The menu items to add
|
|
3404
|
-
*/
|
|
3405
|
-
addContextMenuItem(menuItems) {
|
|
3406
|
-
return this.invokeMethod("addContextMenuItem", menuItems);
|
|
3407
|
-
}
|
|
3408
|
-
/**
|
|
3409
|
-
* Add items to the application menu
|
|
3410
|
-
* @param menuItems The menu items to add
|
|
3411
|
-
*/
|
|
3412
|
-
addMenuItem(menuItems) {
|
|
3413
|
-
return this.invokeMethod("addMenuItem", menuItems);
|
|
3414
|
-
}
|
|
3415
|
-
/**
|
|
3416
|
-
* Show a menu programmatically
|
|
3417
|
-
* @param options The options for showing the menu
|
|
3418
|
-
*/
|
|
3419
|
-
showMenu(options) {
|
|
3420
|
-
return this.invokeMethod("showMenu", options);
|
|
3421
|
-
}
|
|
3422
|
-
/**
|
|
3423
|
-
* Remove items from the application menu
|
|
3424
|
-
* @param menuItemIds The IDs of the menu items to remove
|
|
3425
|
-
*/
|
|
3426
|
-
removeMenuItem(menuItemIds) {
|
|
3427
|
-
return this.invokeMethod("removeMenuItem", menuItemIds);
|
|
3428
|
-
}
|
|
3429
|
-
/**
|
|
3430
|
-
* Remove items from the context menu
|
|
3431
|
-
* @param menuItemIds The IDs of the menu items to remove
|
|
3432
|
-
*/
|
|
3433
|
-
removeContextMenuItem(menuItemIds) {
|
|
3434
|
-
return this.invokeMethod("removeContextMenuItem", menuItemIds);
|
|
3435
|
-
}
|
|
3436
|
-
};
|
|
3437
|
-
var MenuApi = new MenuApiImpl();
|
|
3438
|
-
|
|
3439
|
-
// src/api/MouseApi.ts
|
|
3440
|
-
var MouseApiImpl = class extends BaseApi {
|
|
3441
|
-
getChannel() {
|
|
3442
|
-
return "channel::cn.widgetjs.core.mouse" /* MOUSE */;
|
|
3443
|
-
}
|
|
3444
|
-
removeHotspot() {
|
|
3445
|
-
return this.invokeMethod("removeHotspot");
|
|
3446
|
-
}
|
|
3447
|
-
createHotspot(rect) {
|
|
3448
|
-
return this.invokeMethod("createHotspot", rect);
|
|
3449
|
-
}
|
|
3450
|
-
};
|
|
3451
|
-
var MouseApi = new MouseApiImpl();
|
|
3452
|
-
|
|
3453
|
-
// src/api/HttpApi.ts
|
|
3454
|
-
var HttpApiImpl = class extends BaseApi {
|
|
3455
|
-
getChannel() {
|
|
3456
|
-
return "channel::cn.widgetjs.core.http" /* HTTP */;
|
|
3457
|
-
}
|
|
3458
|
-
get(url, params) {
|
|
3459
|
-
return this.invokeMethod("get", url, params);
|
|
3460
|
-
}
|
|
3461
|
-
post(url, data) {
|
|
3462
|
-
return this.invokeMethod("post", url, data);
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
var HttpApi = new HttpApiImpl();
|
|
3466
|
-
|
|
3467
|
-
// src/api/UserApi.ts
|
|
3468
|
-
var UserApiImpl = class extends BaseApi {
|
|
3469
|
-
async getSession() {
|
|
3470
|
-
return await this.invokeMethod("getSession");
|
|
3471
|
-
}
|
|
3472
|
-
async updateSession(session) {
|
|
3473
|
-
await this.invokeMethod("updateSession", session);
|
|
3474
|
-
}
|
|
3475
|
-
async updateUser(user) {
|
|
3476
|
-
await this.invokeMethod("updateUser", user);
|
|
3477
|
-
}
|
|
3478
|
-
async login(session) {
|
|
3479
|
-
await this.invokeMethod("login", session);
|
|
3480
|
-
}
|
|
3481
|
-
async logout() {
|
|
3482
|
-
await this.invokeMethod("logout");
|
|
3483
|
-
}
|
|
3484
|
-
async getUser() {
|
|
3485
|
-
return await this.invokeMethod("getUser");
|
|
3486
|
-
}
|
|
3487
|
-
getChannel() {
|
|
3488
|
-
return "channel::cn.widgetjs.core.user" /* USER */;
|
|
3489
|
-
}
|
|
3490
|
-
};
|
|
3491
|
-
var UserApi = new UserApiImpl();
|
|
3492
|
-
|
|
3493
|
-
// src/api/TrayApi.ts
|
|
3494
|
-
var TrayApiImpl = class extends BaseApi {
|
|
3495
|
-
getChannel() {
|
|
3496
|
-
return "channel::cn.widgetjs.core.tray" /* TRAY */;
|
|
3497
|
-
}
|
|
3498
|
-
setTray(options) {
|
|
3499
|
-
return this.invokeMethod("setTray", options);
|
|
3500
|
-
}
|
|
3501
|
-
removeTray() {
|
|
3502
|
-
return this.invokeMethod("removeTray");
|
|
3503
|
-
}
|
|
3504
|
-
displayBalloon(options) {
|
|
3505
|
-
return this.invokeMethod("displayBalloon", options);
|
|
3506
|
-
}
|
|
3507
|
-
removeBalloon() {
|
|
3508
|
-
return this.invokeMethod("removeBalloon");
|
|
3509
|
-
}
|
|
3510
|
-
setContextMenu(menus) {
|
|
3511
|
-
return this.invokeMethod("setContextMenu", menus);
|
|
3512
|
-
}
|
|
3513
|
-
closeContextMenu() {
|
|
3514
|
-
return this.invokeMethod("closeContextMenu");
|
|
3515
|
-
}
|
|
3516
|
-
popUpContextMenu(menus, position) {
|
|
3517
|
-
return this.invokeMethod("popUpContextMenu", menus, position);
|
|
3518
|
-
}
|
|
3519
|
-
isDestroyed() {
|
|
3520
|
-
return this.invokeMethod("isDestroyed");
|
|
3521
|
-
}
|
|
3522
|
-
getBounds() {
|
|
3523
|
-
return this.invokeMethod("getBounds");
|
|
3524
|
-
}
|
|
3525
|
-
focus() {
|
|
3526
|
-
return this.invokeMethod("focus");
|
|
3527
|
-
}
|
|
3528
|
-
};
|
|
3529
|
-
var TrayApi = new TrayApiImpl();
|
|
3530
|
-
|
|
3531
|
-
// src/api/AiApi.ts
|
|
3532
|
-
var AiApiImpl = class extends BaseApi {
|
|
3533
|
-
addConfig(config) {
|
|
3534
|
-
return this.invokeMethod("addConfig", config);
|
|
3535
|
-
}
|
|
3536
|
-
deleteConfig(id) {
|
|
3537
|
-
return this.invokeMethod("deleteConfig", id);
|
|
3538
|
-
}
|
|
3539
|
-
updateConfig(config) {
|
|
3540
|
-
return this.invokeMethod("updateConfig", config);
|
|
3541
|
-
}
|
|
3542
|
-
getConfigList() {
|
|
3543
|
-
return this.invokeMethod("getConfigList");
|
|
3544
|
-
}
|
|
3545
|
-
setConfigList(configs) {
|
|
3546
|
-
return this.invokeMethod("setConfigList", configs);
|
|
3547
|
-
}
|
|
3548
|
-
getConfig(id) {
|
|
3549
|
-
return this.invokeMethod("getConfig", id);
|
|
3550
|
-
}
|
|
3551
|
-
getChannel() {
|
|
3552
|
-
return "channel::cn.widgetjs.core.ai" /* AI */;
|
|
3553
|
-
}
|
|
3554
|
-
};
|
|
3555
|
-
var AiApi = new AiApiImpl();
|
|
3556
|
-
|
|
3557
|
-
export { AiApi, AiApiEvent, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppConfig, AppEvent, AppNotification, AppReminderNotification, BackgroundWidget, BaseApi, BroadcastApi, BroadcastEvent, BrowserWindowApi, BrowserWindowApiEvent, Channel, ClipboardApi, ClipboardApiEvent, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeviceApi, DialogApi, ElectronApi, ElectronUtils, FileApi, Gravity, GridRect, GridSystem, HostedMode, HttpApi, LanguageMap, LanguageUtils, LogApi, MenuApi, MenuApiEvent, MouseApi, MouseApiEvent, NotificationApi, NotificationApiEvent, NotificationSize, Page, ProcessApi, ShortcutApi, ShortcutApiEvent, SocialInfo, StorageApi, StoreApi, SystemApi, SystemApiEvent, ThemeMode, TrayApi, TrayApiEvent, UserApi, UserApiEvent, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetData, WidgetDataApi, WidgetKeyword, WidgetPackage, WidgetPackageApi, WidgetPackageApiEvent, WidgetPackageUtils, WidgetParams, WidgetTheme, WidgetUtils, delay, normalizeUrl, parseQuery, stringifyQuery };
|
|
3773
|
+
export { AiApiEvent, ApiConstants, AppApi, AppApiConstants, AppApiEvent, AppConfig, AppEvent, AppNotification, AppReminderNotification, AppTheme, BackgroundWidget, BaseApi, BroadcastApi, BroadcastEvent, BrowserWindowApi, BrowserWindowApiEvent, Channel, ClipboardApi, ClipboardApiEvent, DefaultTheme, DefaultThemeDark, DefaultThemeLight, DefaultWidgetTheme, DeployMode, DeployedPage, DeployedWidget, DeployedWidgetApi, DeviceApi, DialogApi, ElectronApi, ElectronUtils, FileApi, Gravity, GridRect, GridSystem, HostedMode, HttpApi, LanguageMap, LanguageUtils, LogApi, MenuApi, MenuApiEvent, MouseApi, MouseApiEvent, NotificationApi, NotificationApiEvent, NotificationSize, Page, ProcessApi, ShortcutApi, ShortcutApiEvent, SocialInfo, StorageApi, StoreApi, SystemApi, SystemApiEvent, ThemeMode, TrayApi, TrayApiEvent, UserApi, UserApiEvent, WebSocketEvent, WebSocketEventType, Widget, WidgetApi, WidgetApiEvent, WidgetData, WidgetDataApi, WidgetKeyword, WidgetPackage, WidgetPackageApi, WidgetPackageApiEvent, WidgetPackageUtils, WidgetParams, WidgetTheme, WidgetUtils, delay, normalizeUrl, parseQuery, stringifyQuery };
|
|
3558
3774
|
//# sourceMappingURL=index.js.map
|
|
3559
3775
|
//# sourceMappingURL=index.js.map
|