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