@widget-js/core 24.1.1-beta.2 → 24.1.1-beta.21

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 CHANGED
@@ -1,18 +1,21 @@
1
- "use strict";
1
+ 'use strict';
2
+
3
+ var cssTree = require('css-tree');
4
+ var localforage = require('localforage');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var localforage__default = /*#__PURE__*/_interopDefault(localforage);
9
+
2
10
  var __create = Object.create;
3
11
  var __defProp = Object.defineProperty;
4
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
14
  var __getProtoOf = Object.getPrototypeOf;
7
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
16
  var __commonJS = (cb, mod) => function __require() {
10
17
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
18
  };
12
- var __export = (target, all) => {
13
- for (var name in all)
14
- __defProp(target, name, { get: all[name], enumerable: true });
15
- };
16
19
  var __copyProps = (to, from, except, desc) => {
17
20
  if (from && typeof from === "object" || typeof from === "function") {
18
21
  for (let key of __getOwnPropNames(from))
@@ -29,15 +32,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
32
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
33
  mod
31
34
  ));
32
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
33
- var __publicField = (obj, key, value) => {
34
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
35
- return value;
36
- };
37
35
 
38
36
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js
39
37
  var require_arrayReduce = __commonJS({
40
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js"(exports, module2) {
38
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayReduce.js"(exports, module) {
41
39
  function arrayReduce(array, iteratee, accumulator, initAccum) {
42
40
  var index = -1, length = array == null ? 0 : array.length;
43
41
  if (initAccum && length) {
@@ -48,25 +46,25 @@ var require_arrayReduce = __commonJS({
48
46
  }
49
47
  return accumulator;
50
48
  }
51
- module2.exports = arrayReduce;
49
+ module.exports = arrayReduce;
52
50
  }
53
51
  });
54
52
 
55
53
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js
56
54
  var require_basePropertyOf = __commonJS({
57
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js"(exports, module2) {
55
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_basePropertyOf.js"(exports, module) {
58
56
  function basePropertyOf(object) {
59
57
  return function(key) {
60
58
  return object == null ? void 0 : object[key];
61
59
  };
62
60
  }
63
- module2.exports = basePropertyOf;
61
+ module.exports = basePropertyOf;
64
62
  }
65
63
  });
66
64
 
67
65
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js
68
66
  var require_deburrLetter = __commonJS({
69
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js"(exports, module2) {
67
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_deburrLetter.js"(exports, module) {
70
68
  var basePropertyOf = require_basePropertyOf();
71
69
  var deburredLetters = {
72
70
  // Latin-1 Supplement block.
@@ -263,40 +261,40 @@ var require_deburrLetter = __commonJS({
263
261
  "\u017F": "s"
264
262
  };
265
263
  var deburrLetter = basePropertyOf(deburredLetters);
266
- module2.exports = deburrLetter;
264
+ module.exports = deburrLetter;
267
265
  }
268
266
  });
269
267
 
270
268
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js
271
269
  var require_freeGlobal = __commonJS({
272
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js"(exports, module2) {
270
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_freeGlobal.js"(exports, module) {
273
271
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
274
- module2.exports = freeGlobal;
272
+ module.exports = freeGlobal;
275
273
  }
276
274
  });
277
275
 
278
276
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js
279
277
  var require_root = __commonJS({
280
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js"(exports, module2) {
278
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_root.js"(exports, module) {
281
279
  var freeGlobal = require_freeGlobal();
282
280
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
283
281
  var root = freeGlobal || freeSelf || Function("return this")();
284
- module2.exports = root;
282
+ module.exports = root;
285
283
  }
286
284
  });
287
285
 
288
286
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js
289
287
  var require_Symbol = __commonJS({
290
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"(exports, module2) {
288
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_Symbol.js"(exports, module) {
291
289
  var root = require_root();
292
290
  var Symbol2 = root.Symbol;
293
- module2.exports = Symbol2;
291
+ module.exports = Symbol2;
294
292
  }
295
293
  });
296
294
 
297
295
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js
298
296
  var require_arrayMap = __commonJS({
299
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"(exports, module2) {
297
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_arrayMap.js"(exports, module) {
300
298
  function arrayMap(array, iteratee) {
301
299
  var index = -1, length = array == null ? 0 : array.length, result = Array(length);
302
300
  while (++index < length) {
@@ -304,21 +302,21 @@ var require_arrayMap = __commonJS({
304
302
  }
305
303
  return result;
306
304
  }
307
- module2.exports = arrayMap;
305
+ module.exports = arrayMap;
308
306
  }
309
307
  });
310
308
 
311
309
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js
312
310
  var require_isArray = __commonJS({
313
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"(exports, module2) {
311
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isArray.js"(exports, module) {
314
312
  var isArray2 = Array.isArray;
315
- module2.exports = isArray2;
313
+ module.exports = isArray2;
316
314
  }
317
315
  });
318
316
 
319
317
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js
320
318
  var require_getRawTag = __commonJS({
321
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js"(exports, module2) {
319
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_getRawTag.js"(exports, module) {
322
320
  var Symbol2 = require_Symbol();
323
321
  var objectProto = Object.prototype;
324
322
  var hasOwnProperty = objectProto.hasOwnProperty;
@@ -341,25 +339,25 @@ var require_getRawTag = __commonJS({
341
339
  }
342
340
  return result;
343
341
  }
344
- module2.exports = getRawTag;
342
+ module.exports = getRawTag;
345
343
  }
346
344
  });
347
345
 
348
346
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js
349
347
  var require_objectToString = __commonJS({
350
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js"(exports, module2) {
348
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_objectToString.js"(exports, module) {
351
349
  var objectProto = Object.prototype;
352
350
  var nativeObjectToString = objectProto.toString;
353
351
  function objectToString(value) {
354
352
  return nativeObjectToString.call(value);
355
353
  }
356
- module2.exports = objectToString;
354
+ module.exports = objectToString;
357
355
  }
358
356
  });
359
357
 
360
358
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js
361
359
  var require_baseGetTag = __commonJS({
362
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js"(exports, module2) {
360
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseGetTag.js"(exports, module) {
363
361
  var Symbol2 = require_Symbol();
364
362
  var getRawTag = require_getRawTag();
365
363
  var objectToString = require_objectToString();
@@ -372,36 +370,36 @@ var require_baseGetTag = __commonJS({
372
370
  }
373
371
  return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
374
372
  }
375
- module2.exports = baseGetTag;
373
+ module.exports = baseGetTag;
376
374
  }
377
375
  });
378
376
 
379
377
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js
380
378
  var require_isObjectLike = __commonJS({
381
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js"(exports, module2) {
379
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isObjectLike.js"(exports, module) {
382
380
  function isObjectLike(value) {
383
381
  return value != null && typeof value == "object";
384
382
  }
385
- module2.exports = isObjectLike;
383
+ module.exports = isObjectLike;
386
384
  }
387
385
  });
388
386
 
389
387
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js
390
388
  var require_isSymbol = __commonJS({
391
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js"(exports, module2) {
389
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/isSymbol.js"(exports, module) {
392
390
  var baseGetTag = require_baseGetTag();
393
391
  var isObjectLike = require_isObjectLike();
394
392
  var symbolTag = "[object Symbol]";
395
393
  function isSymbol(value) {
396
394
  return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
397
395
  }
398
- module2.exports = isSymbol;
396
+ module.exports = isSymbol;
399
397
  }
400
398
  });
401
399
 
402
400
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js
403
401
  var require_baseToString = __commonJS({
404
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js"(exports, module2) {
402
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseToString.js"(exports, module) {
405
403
  var Symbol2 = require_Symbol();
406
404
  var arrayMap = require_arrayMap();
407
405
  var isArray2 = require_isArray();
@@ -422,24 +420,24 @@ var require_baseToString = __commonJS({
422
420
  var result = value + "";
423
421
  return result == "0" && 1 / value == -INFINITY ? "-0" : result;
424
422
  }
425
- module2.exports = baseToString;
423
+ module.exports = baseToString;
426
424
  }
427
425
  });
428
426
 
429
427
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js
430
428
  var require_toString = __commonJS({
431
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js"(exports, module2) {
429
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/toString.js"(exports, module) {
432
430
  var baseToString = require_baseToString();
433
431
  function toString(value) {
434
432
  return value == null ? "" : baseToString(value);
435
433
  }
436
- module2.exports = toString;
434
+ module.exports = toString;
437
435
  }
438
436
  });
439
437
 
440
438
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js
441
439
  var require_deburr = __commonJS({
442
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js"(exports, module2) {
440
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/deburr.js"(exports, module) {
443
441
  var deburrLetter = require_deburrLetter();
444
442
  var toString = require_toString();
445
443
  var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
@@ -453,35 +451,35 @@ var require_deburr = __commonJS({
453
451
  string = toString(string);
454
452
  return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
455
453
  }
456
- module2.exports = deburr;
454
+ module.exports = deburr;
457
455
  }
458
456
  });
459
457
 
460
458
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js
461
459
  var require_asciiWords = __commonJS({
462
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js"(exports, module2) {
460
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiWords.js"(exports, module) {
463
461
  var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
464
462
  function asciiWords(string) {
465
463
  return string.match(reAsciiWord) || [];
466
464
  }
467
- module2.exports = asciiWords;
465
+ module.exports = asciiWords;
468
466
  }
469
467
  });
470
468
 
471
469
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js
472
470
  var require_hasUnicodeWord = __commonJS({
473
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js"(exports, module2) {
471
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicodeWord.js"(exports, module) {
474
472
  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 ]/;
475
473
  function hasUnicodeWord(string) {
476
474
  return reHasUnicodeWord.test(string);
477
475
  }
478
- module2.exports = hasUnicodeWord;
476
+ module.exports = hasUnicodeWord;
479
477
  }
480
478
  });
481
479
 
482
480
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js
483
481
  var require_unicodeWords = __commonJS({
484
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js"(exports, module2) {
482
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeWords.js"(exports, module) {
485
483
  var rsAstralRange = "\\ud800-\\udfff";
486
484
  var rsComboMarksRange = "\\u0300-\\u036f";
487
485
  var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
@@ -534,13 +532,13 @@ var require_unicodeWords = __commonJS({
534
532
  function unicodeWords(string) {
535
533
  return string.match(reUnicodeWord) || [];
536
534
  }
537
- module2.exports = unicodeWords;
535
+ module.exports = unicodeWords;
538
536
  }
539
537
  });
540
538
 
541
539
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js
542
540
  var require_words = __commonJS({
543
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js"(exports, module2) {
541
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/words.js"(exports, module) {
544
542
  var asciiWords = require_asciiWords();
545
543
  var hasUnicodeWord = require_hasUnicodeWord();
546
544
  var toString = require_toString();
@@ -553,13 +551,13 @@ var require_words = __commonJS({
553
551
  }
554
552
  return string.match(pattern) || [];
555
553
  }
556
- module2.exports = words;
554
+ module.exports = words;
557
555
  }
558
556
  });
559
557
 
560
558
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js
561
559
  var require_createCompounder = __commonJS({
562
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js"(exports, module2) {
560
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCompounder.js"(exports, module) {
563
561
  var arrayReduce = require_arrayReduce();
564
562
  var deburr = require_deburr();
565
563
  var words = require_words();
@@ -570,91 +568,194 @@ var require_createCompounder = __commonJS({
570
568
  return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
571
569
  };
572
570
  }
573
- module2.exports = createCompounder;
571
+ module.exports = createCompounder;
574
572
  }
575
573
  });
576
574
 
577
575
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js
578
576
  var require_kebabCase = __commonJS({
579
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js"(exports, module2) {
577
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/kebabCase.js"(exports, module) {
580
578
  var createCompounder = require_createCompounder();
581
- var kebabCase2 = createCompounder(function(result, word, index) {
579
+ var kebabCase3 = createCompounder(function(result, word, index) {
582
580
  return result + (index ? "-" : "") + word.toLowerCase();
583
581
  });
584
- module2.exports = kebabCase2;
582
+ module.exports = kebabCase3;
583
+ }
584
+ });
585
+
586
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js
587
+ var require_baseSlice = __commonJS({
588
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_baseSlice.js"(exports, module) {
589
+ function baseSlice(array, start, end) {
590
+ var index = -1, length = array.length;
591
+ if (start < 0) {
592
+ start = -start > length ? 0 : length + start;
593
+ }
594
+ end = end > length ? length : end;
595
+ if (end < 0) {
596
+ end += length;
597
+ }
598
+ length = start > end ? 0 : end - start >>> 0;
599
+ start >>>= 0;
600
+ var result = Array(length);
601
+ while (++index < length) {
602
+ result[index] = array[index + start];
603
+ }
604
+ return result;
605
+ }
606
+ module.exports = baseSlice;
607
+ }
608
+ });
609
+
610
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castSlice.js
611
+ var require_castSlice = __commonJS({
612
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_castSlice.js"(exports, module) {
613
+ var baseSlice = require_baseSlice();
614
+ function castSlice(array, start, end) {
615
+ var length = array.length;
616
+ end = end === void 0 ? length : end;
617
+ return !start && end >= length ? array : baseSlice(array, start, end);
618
+ }
619
+ module.exports = castSlice;
620
+ }
621
+ });
622
+
623
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicode.js
624
+ var require_hasUnicode = __commonJS({
625
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_hasUnicode.js"(exports, module) {
626
+ var rsAstralRange = "\\ud800-\\udfff";
627
+ var rsComboMarksRange = "\\u0300-\\u036f";
628
+ var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
629
+ var rsComboSymbolsRange = "\\u20d0-\\u20ff";
630
+ var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
631
+ var rsVarRange = "\\ufe0e\\ufe0f";
632
+ var rsZWJ = "\\u200d";
633
+ var reHasUnicode = RegExp("[" + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + "]");
634
+ function hasUnicode(string) {
635
+ return reHasUnicode.test(string);
636
+ }
637
+ module.exports = hasUnicode;
638
+ }
639
+ });
640
+
641
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiToArray.js
642
+ var require_asciiToArray = __commonJS({
643
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_asciiToArray.js"(exports, module) {
644
+ function asciiToArray(string) {
645
+ return string.split("");
646
+ }
647
+ module.exports = asciiToArray;
648
+ }
649
+ });
650
+
651
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeToArray.js
652
+ var require_unicodeToArray = __commonJS({
653
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_unicodeToArray.js"(exports, module) {
654
+ var rsAstralRange = "\\ud800-\\udfff";
655
+ var rsComboMarksRange = "\\u0300-\\u036f";
656
+ var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
657
+ var rsComboSymbolsRange = "\\u20d0-\\u20ff";
658
+ var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
659
+ var rsVarRange = "\\ufe0e\\ufe0f";
660
+ var rsAstral = "[" + rsAstralRange + "]";
661
+ var rsCombo = "[" + rsComboRange + "]";
662
+ var rsFitz = "\\ud83c[\\udffb-\\udfff]";
663
+ var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
664
+ var rsNonAstral = "[^" + rsAstralRange + "]";
665
+ var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
666
+ var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
667
+ var rsZWJ = "\\u200d";
668
+ var reOptMod = rsModifier + "?";
669
+ var rsOptVar = "[" + rsVarRange + "]?";
670
+ var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
671
+ var rsSeq = rsOptVar + reOptMod + rsOptJoin;
672
+ var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
673
+ var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
674
+ function unicodeToArray(string) {
675
+ return string.match(reUnicode) || [];
676
+ }
677
+ module.exports = unicodeToArray;
678
+ }
679
+ });
680
+
681
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToArray.js
682
+ var require_stringToArray = __commonJS({
683
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_stringToArray.js"(exports, module) {
684
+ var asciiToArray = require_asciiToArray();
685
+ var hasUnicode = require_hasUnicode();
686
+ var unicodeToArray = require_unicodeToArray();
687
+ function stringToArray(string) {
688
+ return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
689
+ }
690
+ module.exports = stringToArray;
691
+ }
692
+ });
693
+
694
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCaseFirst.js
695
+ var require_createCaseFirst = __commonJS({
696
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/_createCaseFirst.js"(exports, module) {
697
+ var castSlice = require_castSlice();
698
+ var hasUnicode = require_hasUnicode();
699
+ var stringToArray = require_stringToArray();
700
+ var toString = require_toString();
701
+ function createCaseFirst(methodName) {
702
+ return function(string) {
703
+ string = toString(string);
704
+ var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
705
+ var chr = strSymbols ? strSymbols[0] : string.charAt(0);
706
+ var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
707
+ return chr[methodName]() + trailing;
708
+ };
709
+ }
710
+ module.exports = createCaseFirst;
711
+ }
712
+ });
713
+
714
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/upperFirst.js
715
+ var require_upperFirst = __commonJS({
716
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/upperFirst.js"(exports, module) {
717
+ var createCaseFirst = require_createCaseFirst();
718
+ var upperFirst = createCaseFirst("toUpperCase");
719
+ module.exports = upperFirst;
720
+ }
721
+ });
722
+
723
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/capitalize.js
724
+ var require_capitalize = __commonJS({
725
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/capitalize.js"(exports, module) {
726
+ var toString = require_toString();
727
+ var upperFirst = require_upperFirst();
728
+ function capitalize(string) {
729
+ return upperFirst(toString(string).toLowerCase());
730
+ }
731
+ module.exports = capitalize;
732
+ }
733
+ });
734
+
735
+ // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js
736
+ var require_camelCase = __commonJS({
737
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/camelCase.js"(exports, module) {
738
+ var capitalize = require_capitalize();
739
+ var createCompounder = require_createCompounder();
740
+ var camelCase2 = createCompounder(function(result, word, index) {
741
+ word = word.toLowerCase();
742
+ return result + (index ? capitalize(word) : word);
743
+ });
744
+ module.exports = camelCase2;
585
745
  }
586
746
  });
587
747
 
588
748
  // ../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js
589
749
  var require_snakeCase = __commonJS({
590
- "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js"(exports, module2) {
750
+ "../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/snakeCase.js"(exports, module) {
591
751
  var createCompounder = require_createCompounder();
592
752
  var snakeCase2 = createCompounder(function(result, word, index) {
593
753
  return result + (index ? "_" : "") + word.toLowerCase();
594
754
  });
595
- module2.exports = snakeCase2;
755
+ module.exports = snakeCase2;
596
756
  }
597
757
  });
598
758
 
599
- // src/index.ts
600
- var src_exports = {};
601
- __export(src_exports, {
602
- ApiConstants: () => ApiConstants,
603
- AppApi: () => AppApi,
604
- AppApiConstants: () => AppApiConstants,
605
- AppApiEvent: () => AppApiEvent,
606
- AppNotification: () => AppNotification,
607
- BackgroundWidget: () => BackgroundWidget,
608
- BaseApi: () => BaseApi,
609
- BroadcastApi: () => BroadcastApi,
610
- BroadcastEvent: () => BroadcastEvent,
611
- BrowserWindowApi: () => BrowserWindowApi,
612
- BrowserWindowApiEvent: () => BrowserWindowApiEvent,
613
- Channel: () => Channel,
614
- ClipboardApi: () => ClipboardApi,
615
- ClipboardApiEvent: () => ClipboardApiEvent,
616
- DefaultWidgetTheme: () => DefaultWidgetTheme,
617
- DeployMode: () => DeployMode,
618
- DeployedPage: () => DeployedPage,
619
- DeployedWidget: () => DeployedWidget,
620
- DeployedWidgetApi: () => DeployedWidgetApi,
621
- DeviceApi: () => DeviceApi,
622
- DialogApi: () => DialogApi,
623
- ElectronApi: () => ElectronApi,
624
- ElectronUtils: () => ElectronUtils,
625
- FileApi: () => FileApi,
626
- Gravity: () => Gravity,
627
- GridRect: () => GridRect,
628
- GridSystem: () => GridSystem,
629
- HostedMode: () => HostedMode,
630
- LogApi: () => LogApi,
631
- NotificationApi: () => NotificationApi,
632
- NotificationApiEvent: () => NotificationApiEvent,
633
- NotificationSize: () => NotificationSize,
634
- Page: () => Page,
635
- ProcessApi: () => ProcessApi,
636
- ShortcutApi: () => ShortcutApi,
637
- ShortcutApiEvent: () => ShortcutApiEvent,
638
- StoreApi: () => StoreApi,
639
- SystemApiEvent: () => SystemApiEvent,
640
- ThemeMode: () => ThemeMode,
641
- WebSocketEvent: () => WebSocketEvent,
642
- WebSocketEventType: () => WebSocketEventType,
643
- Widget: () => Widget,
644
- WidgetApi: () => WidgetApi,
645
- WidgetApiEvent: () => WidgetApiEvent,
646
- WidgetData: () => WidgetData,
647
- WidgetDataApi: () => WidgetDataApi,
648
- WidgetKeyword: () => WidgetKeyword,
649
- WidgetPackage: () => WidgetPackage,
650
- WidgetParams: () => WidgetParams,
651
- getTextByLanguageCode: () => getTextByLanguageCode,
652
- normalizeUrl: () => normalizeUrl,
653
- parseQuery: () => parseQuery,
654
- stringifyQuery: () => stringifyQuery
655
- });
656
- module.exports = __toCommonJS(src_exports);
657
-
658
759
  // src/model/DeployMode.ts
659
760
  var HostedMode = /* @__PURE__ */ ((HostedMode2) => {
660
761
  HostedMode2[HostedMode2["NORMAL"] = 1] = "NORMAL";
@@ -674,6 +775,31 @@ var DeployMode = /* @__PURE__ */ ((DeployMode2) => {
674
775
  return DeployMode2;
675
776
  })(DeployMode || {});
676
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
+
677
803
  // src/utils/LanguageUtils.ts
678
804
  function getTextByLanguageCode(langMap, langCode, fallbackToBrowser = true) {
679
805
  let result;
@@ -700,13 +826,71 @@ function getTextByLanguageCode(langMap, langCode, fallbackToBrowser = true) {
700
826
  return void 0;
701
827
  }
702
828
 
829
+ // src/utils/WidgetUtils.ts
830
+ var WidgetUtils = class {
831
+ /**
832
+ * 是否支持悬浮窗
833
+ */
834
+ static isSupportOverlap(supportDeployMode) {
835
+ return (supportDeployMode & 16 /* OVERLAP */) > 0;
836
+ }
837
+ static isSupportBackground(supportDeployMode) {
838
+ return (supportDeployMode & 65536 /* BACKGROUND */) > 0;
839
+ }
840
+ /**
841
+ * 是否支持普通模式
842
+ */
843
+ static isSupportNormal(supportDeployMode) {
844
+ return (supportDeployMode & 1 /* NORMAL */) > 0;
845
+ }
846
+ static isConfigurable(configPagePath) {
847
+ return configPagePath != null && configPagePath != "";
848
+ }
849
+ };
850
+
851
+ // src/utils/TimeUtils.ts
852
+ function delay(ms) {
853
+ return new Promise((resolve) => setTimeout(resolve, ms));
854
+ }
855
+
856
+ // src/utils/WidgetPackageUtils.ts
857
+ var WidgetPackageUtils = class {
858
+ static getRemotePackageJsonUrl(remoteInfo) {
859
+ const remoteEntry = this.getRemoteEntryUrl(remoteInfo);
860
+ if (!remoteEntry) {
861
+ return void 0;
862
+ }
863
+ const arr = [];
864
+ arr.push(remoteEntry);
865
+ arr.push("/widget.json");
866
+ return arr.join("");
867
+ }
868
+ static getRemoteEntryUrl(remoteInfo) {
869
+ if (!remoteInfo.hostname) {
870
+ return void 0;
871
+ }
872
+ const arr = [];
873
+ arr.push("https://");
874
+ arr.push(remoteInfo.hostname);
875
+ if (remoteInfo.base) {
876
+ arr.push(remoteInfo.base);
877
+ }
878
+ return arr.join("");
879
+ }
880
+ };
881
+
703
882
  // src/model/Page.ts
704
- var Page = class {
705
- // 窗口名称,名称与包名类似,e.g. com.example.countdown
883
+ var Page = class _Page {
884
+ /**
885
+ * 页面名称,名称必须以包名开头,如果以.开头,会自动加上包名<br>
886
+ * 假设包名为`example.com`,以下两种写法等价
887
+ * @example example.com.countdown
888
+ * @example .countdown
889
+ */
706
890
  name;
707
891
  /**
708
892
  * 窗口标题,显示在界面上的,
709
- * https://zh.m.wikipedia.org/zh-hans/ISO_639-1
893
+ * @see https://zh.m.wikipedia.org/zh-hans/ISO_639-1
710
894
  */
711
895
  title;
712
896
  /**
@@ -784,7 +968,7 @@ var Page = class {
784
968
  return this.parseObject(object);
785
969
  }
786
970
  static parseObject(obj) {
787
- const widget = new Page({
971
+ const widget = new _Page({
788
972
  path: "",
789
973
  description: {},
790
974
  height: 0,
@@ -804,8 +988,17 @@ var Page = class {
804
988
  };
805
989
 
806
990
  // src/model/Widget.ts
807
- var Widget = class extends Page {
991
+ var Widget = class _Widget extends Page {
992
+ categories;
808
993
  supportDeployMode;
994
+ /**
995
+ * 组件包所需的App版本
996
+ */
997
+ requiredAppVersion;
998
+ /**
999
+ * 如果为true,组件将不会添加到组件包中
1000
+ */
1001
+ disabled;
809
1002
  /**
810
1003
  * 配置页面路径,没有则不能修改
811
1004
  */
@@ -814,12 +1007,16 @@ var Widget = class extends Page {
814
1007
  * @deprecated
815
1008
  */
816
1009
  routes;
1010
+ browserWindowOptions;
817
1011
  socialLinks;
818
1012
  constructor(options) {
819
1013
  super(options);
820
1014
  this.configPagePath = options.configPagePath;
1015
+ this.categories = options.categories;
821
1016
  this.supportDeployMode = options.supportDeployMode ?? 1 /* NORMAL */ | 16 /* OVERLAP */;
822
1017
  this.socialLinks = options.socialLinks;
1018
+ this.disabled = options.disabled;
1019
+ this.requiredAppVersion = options.requiredAppVersion;
823
1020
  this.routes = options.routes ?? [];
824
1021
  }
825
1022
  static parseJSON(json) {
@@ -827,7 +1024,7 @@ var Widget = class extends Page {
827
1024
  return this.parseObject(object);
828
1025
  }
829
1026
  static parseObject(obj) {
830
- const widget = new Widget({
1027
+ const widget = new _Widget({
831
1028
  path: "",
832
1029
  description: {},
833
1030
  height: 0,
@@ -867,6 +1064,7 @@ var BackgroundWidget = class extends Widget {
867
1064
  options.width = 1;
868
1065
  options.height = 1;
869
1066
  super(options);
1067
+ this.browserWindowOptions = options.browserWindowOptions;
870
1068
  }
871
1069
  };
872
1070
  var WidgetKeyword = /* @__PURE__ */ ((WidgetKeyword2) => {
@@ -911,18 +1109,135 @@ var WebSocketEvent = class {
911
1109
  };
912
1110
 
913
1111
  // src/model/WidgetData.ts
914
- var import_kebabCase = __toESM(require_kebabCase(), 1);
1112
+ var import_kebabCase2 = __toESM(require_kebabCase(), 1);
915
1113
 
916
1114
  // src/model/WidgetTheme.ts
917
- var DefaultWidgetTheme = {
918
- backgroundColor: "rgba(0,0,0,0.2)",
919
- color: "#fff",
920
- fontSize: "14px",
921
- borderColor: "rgba(255,255,255,0.4)",
922
- dividerColor: "rgba(255,255,255,0.4)",
923
- primaryColor: "rgb(0, 149, 255)",
924
- borderRadius: "22px"
1115
+ var import_kebabCase = __toESM(require_kebabCase(), 1);
1116
+ var import_camelCase = __toESM(require_camelCase(), 1);
1117
+ var WidgetTheme = class _WidgetTheme {
1118
+ borderRadius;
1119
+ backgroundColor;
1120
+ fontSize;
1121
+ dividerColor;
1122
+ /**
1123
+ * 主色调
1124
+ */
1125
+ primaryColor;
1126
+ backgroundBorderColor;
1127
+ backgroundBoxShadowColor;
1128
+ /**
1129
+ * 文字颜色
1130
+ */
1131
+ color;
1132
+ fontFamily;
1133
+ shadowColor;
1134
+ padding;
1135
+ borderColor;
1136
+ useGlobalTheme;
1137
+ constructor(options) {
1138
+ Object.assign(this, options ?? DefaultWidgetTheme);
1139
+ if (this.useGlobalTheme == void 0) {
1140
+ this.useGlobalTheme = true;
1141
+ }
1142
+ }
1143
+ static fromJSON(json) {
1144
+ return new _WidgetTheme(JSON.parse(json));
1145
+ }
1146
+ /**
1147
+ * Injects the style properties as css variable.
1148
+ * @param selector default is 'body'
1149
+ */
1150
+ toCSS(selector = ":root") {
1151
+ const variables = this.toCSSVariable();
1152
+ const cssVariables = Object.keys(variables).map((key) => {
1153
+ return `${key}: ${variables[key]};`;
1154
+ }).join("\n");
1155
+ return `${selector} {
1156
+ ${cssVariables}
1157
+ }`;
1158
+ }
1159
+ /**
1160
+ * Injects the style properties as css variable.
1161
+ * @param rootElement The rootElement to inject the css.
1162
+ * @remarks Only works in a browser environment.
1163
+ */
1164
+ injectCSS(rootElement) {
1165
+ const element = rootElement ?? document.documentElement;
1166
+ const cssVariables = this.toCSSVariable();
1167
+ Object.keys(cssVariables).forEach((key) => {
1168
+ element.style.setProperty(key, cssVariables[key].toString());
1169
+ });
1170
+ }
1171
+ removeCSS(rootElement) {
1172
+ const element = rootElement ?? document.documentElement;
1173
+ const cssVariables = this.toCSSVariable();
1174
+ Object.keys(cssVariables).forEach((key) => {
1175
+ element.style.removeProperty(key);
1176
+ });
1177
+ }
1178
+ copy(options) {
1179
+ return new _WidgetTheme({ ...this, ...options });
1180
+ }
1181
+ /**
1182
+ * Gets the style properties from the widget's style object.
1183
+ * @returns A record representing CSS custom variable and their values.
1184
+ */
1185
+ toCSSVariable() {
1186
+ const variables = {};
1187
+ const prefix = "--widget-";
1188
+ const keys = Object.keys(this);
1189
+ keys.filter((key) => this[key] != void 0).forEach((key) => {
1190
+ variables[`${prefix}${(0, import_kebabCase.default)(key)}`] = `${this[key]}`;
1191
+ });
1192
+ return variables;
1193
+ }
1194
+ toCSSProperties() {
1195
+ const properties = {};
1196
+ const keys = Object.keys(this);
1197
+ keys.filter((key) => this[key] != void 0).forEach((key) => {
1198
+ properties[`${(0, import_kebabCase.default)(key)}`] = `${this[key]}`;
1199
+ });
1200
+ return properties;
1201
+ }
1202
+ static fromCSS(css) {
1203
+ const ast = cssTree.parse(css);
1204
+ const rootRule = cssTree.find(ast, (node, _item, _list) => {
1205
+ if (node.type == "Rule") {
1206
+ const prelude = node.prelude;
1207
+ if (prelude.type == "SelectorList") {
1208
+ const isRoot = prelude.children.some((it) => {
1209
+ return it.type == "Selector" && it.children.some((child) => child.type == "PseudoClassSelector" && child.name == "root");
1210
+ });
1211
+ if (isRoot) {
1212
+ return true;
1213
+ }
1214
+ }
1215
+ }
1216
+ return false;
1217
+ });
1218
+ if (rootRule == null) {
1219
+ return DefaultWidgetTheme.copy();
1220
+ }
1221
+ const widgetVariables = rootRule.block.children.filter((it) => it.type == "Declaration" && it.property.startsWith("--widget-"));
1222
+ const themeOptions = {};
1223
+ for (const cssNode of widgetVariables) {
1224
+ const prop = (0, import_camelCase.default)(cssNode.property.replace("--widget-", ""));
1225
+ themeOptions[prop] = cssNode.value.value.trim();
1226
+ }
1227
+ return new _WidgetTheme(themeOptions);
1228
+ }
925
1229
  };
1230
+ var DefaultWidgetTheme = new WidgetTheme(
1231
+ {
1232
+ backgroundColor: "rgba(0,0,0,0.2)",
1233
+ color: "#fff",
1234
+ fontSize: "14px",
1235
+ borderColor: "rgba(255,255,255,0.4)",
1236
+ dividerColor: "rgba(255,255,255,0.4)",
1237
+ primaryColor: "rgb(0, 149, 255)",
1238
+ borderRadius: "22px"
1239
+ }
1240
+ );
926
1241
  Object.freeze(DefaultWidgetTheme);
927
1242
 
928
1243
  // src/model/WidgetData.ts
@@ -962,6 +1277,7 @@ var WidgetData = class {
962
1277
  borderRadius;
963
1278
  /**
964
1279
  * 组件样式
1280
+ * @deprecated
965
1281
  */
966
1282
  theme;
967
1283
  constructor(name, id) {
@@ -981,8 +1297,8 @@ var WidgetData = class {
981
1297
  if (this.theme) {
982
1298
  const prefix = "--widget-";
983
1299
  const keys = Object.keys(this.theme);
984
- keys.filter((key) => this.theme[key] != void 0).map((key) => {
985
- properties[`${prefix}${(0, import_kebabCase.default)(key)}`] = `${this.theme[key]}`;
1300
+ keys.filter((key) => this.theme[key] != void 0).forEach((key) => {
1301
+ properties[`${prefix}${(0, import_kebabCase2.default)(key)}`] = `${this.theme[key]}`;
986
1302
  });
987
1303
  }
988
1304
  return properties;
@@ -994,7 +1310,7 @@ var WidgetData = class {
994
1310
  injectThemeProperties() {
995
1311
  const properties = this.getThemeProperties();
996
1312
  Object.keys(properties).forEach((key) => {
997
- document.documentElement.style.setProperty(key, properties[key].toString());
1313
+ document.body.style.setProperty(key, properties[key].toString());
998
1314
  });
999
1315
  }
1000
1316
  };
@@ -1051,7 +1367,6 @@ function parseQuery(search) {
1051
1367
  if (!isArray(currentValue)) {
1052
1368
  currentValue = query[key] = [currentValue];
1053
1369
  }
1054
- ;
1055
1370
  currentValue.push(value);
1056
1371
  } else {
1057
1372
  query[key] = value;
@@ -1084,7 +1399,37 @@ function stringifyQuery(query) {
1084
1399
  }
1085
1400
 
1086
1401
  // src/model/WidgetParams.ts
1087
- var _WidgetParams = class {
1402
+ var WidgetParams = class _WidgetParams {
1403
+ static PARAM_PREFIX = "w_";
1404
+ static PARAM_ID = "id";
1405
+ static PARAM_WIDTH = "width";
1406
+ static PARAM_HEIGHT = "height";
1407
+ static PARAM_WIDTH_PX = "width_px";
1408
+ static PARAM_HEIGHT_PX = "height_px";
1409
+ static PARAM_X = "x";
1410
+ static PARAM_Y = "y";
1411
+ static PARAM_LANG = "lang";
1412
+ static PARAM_THEME = "theme";
1413
+ static PARAM_MODE = "mode";
1414
+ static PARAM_RADIUS = "radius";
1415
+ static PARAM_NAME = "name";
1416
+ static PARAM_TITLE = "title";
1417
+ static PARAM_PREVIEW = "preview";
1418
+ static PARAMS = [
1419
+ _WidgetParams.PARAM_ID,
1420
+ _WidgetParams.PARAM_WIDTH,
1421
+ _WidgetParams.PARAM_HEIGHT,
1422
+ _WidgetParams.PARAM_X,
1423
+ _WidgetParams.PARAM_Y,
1424
+ _WidgetParams.PARAM_LANG,
1425
+ _WidgetParams.PARAM_THEME,
1426
+ _WidgetParams.PARAM_MODE,
1427
+ _WidgetParams.PARAM_WIDTH_PX,
1428
+ _WidgetParams.PARAM_HEIGHT_PX,
1429
+ _WidgetParams.PARAM_NAME,
1430
+ _WidgetParams.PARAM_TITLE,
1431
+ _WidgetParams.PARAM_PREVIEW
1432
+ ];
1088
1433
  // 组件id
1089
1434
  id;
1090
1435
  // 网格宽度,1就代表宽度占用1格
@@ -1202,37 +1547,6 @@ var _WidgetParams = class {
1202
1547
  return widgetEnv;
1203
1548
  }
1204
1549
  };
1205
- var WidgetParams = _WidgetParams;
1206
- __publicField(WidgetParams, "PARAM_PREFIX", "w_");
1207
- __publicField(WidgetParams, "PARAM_ID", "id");
1208
- __publicField(WidgetParams, "PARAM_WIDTH", "width");
1209
- __publicField(WidgetParams, "PARAM_HEIGHT", "height");
1210
- __publicField(WidgetParams, "PARAM_WIDTH_PX", "width_px");
1211
- __publicField(WidgetParams, "PARAM_HEIGHT_PX", "height_px");
1212
- __publicField(WidgetParams, "PARAM_X", "x");
1213
- __publicField(WidgetParams, "PARAM_Y", "y");
1214
- __publicField(WidgetParams, "PARAM_LANG", "lang");
1215
- __publicField(WidgetParams, "PARAM_THEME", "theme");
1216
- __publicField(WidgetParams, "PARAM_MODE", "mode");
1217
- __publicField(WidgetParams, "PARAM_RADIUS", "radius");
1218
- __publicField(WidgetParams, "PARAM_NAME", "name");
1219
- __publicField(WidgetParams, "PARAM_TITLE", "title");
1220
- __publicField(WidgetParams, "PARAM_PREVIEW", "preview");
1221
- __publicField(WidgetParams, "PARAMS", [
1222
- _WidgetParams.PARAM_ID,
1223
- _WidgetParams.PARAM_WIDTH,
1224
- _WidgetParams.PARAM_HEIGHT,
1225
- _WidgetParams.PARAM_X,
1226
- _WidgetParams.PARAM_Y,
1227
- _WidgetParams.PARAM_LANG,
1228
- _WidgetParams.PARAM_THEME,
1229
- _WidgetParams.PARAM_MODE,
1230
- _WidgetParams.PARAM_WIDTH_PX,
1231
- _WidgetParams.PARAM_HEIGHT_PX,
1232
- _WidgetParams.PARAM_NAME,
1233
- _WidgetParams.PARAM_TITLE,
1234
- _WidgetParams.PARAM_PREVIEW
1235
- ]);
1236
1550
  var ThemeMode = /* @__PURE__ */ ((ThemeMode2) => {
1237
1551
  ThemeMode2["AUTO"] = "auto";
1238
1552
  ThemeMode2["LIGHT"] = "LIGHT";
@@ -1252,7 +1566,15 @@ var AppNotification = class {
1252
1566
  message;
1253
1567
  title;
1254
1568
  targetTime;
1569
+ /**
1570
+ * 持续时间,单位毫秒
1571
+ */
1255
1572
  duration;
1573
+ /**
1574
+ * IconPark图标
1575
+ * @example close-one
1576
+ * @see [IconPark](https://iconpark.oceanengine.com/official)
1577
+ */
1256
1578
  icon;
1257
1579
  color;
1258
1580
  backgroundColor;
@@ -1286,6 +1608,13 @@ var AppNotification = class {
1286
1608
  this.backgroundColor = option.backgroundColor ?? "#000000";
1287
1609
  }
1288
1610
  };
1611
+ var AppReminderNotification = class extends AppNotification {
1612
+ constructor(option) {
1613
+ super(option);
1614
+ this.type = "reminder";
1615
+ this.size = "large" /* LARGE */;
1616
+ }
1617
+ };
1289
1618
 
1290
1619
  // src/model/DeployedPage.ts
1291
1620
  var DeployedPage = class {
@@ -1308,17 +1637,8 @@ var DeployedWidget = class extends DeployedPage {
1308
1637
  }
1309
1638
  };
1310
1639
 
1311
- // src/model/msic/graphics.ts
1312
- var Gravity = /* @__PURE__ */ ((Gravity2) => {
1313
- Gravity2["TOP"] = "TOP";
1314
- Gravity2["LEFT"] = "LEFT";
1315
- Gravity2["RIGHT"] = "RIGHT";
1316
- Gravity2["BOTTOM"] = "BOTTOM";
1317
- return Gravity2;
1318
- })(Gravity || {});
1319
-
1320
1640
  // src/model/WidgetPackage.ts
1321
- var WidgetPackage = class {
1641
+ var WidgetPackage = class _WidgetPackage {
1322
1642
  /**
1323
1643
  * 组件包名,一般为域名倒写,e.g. com.example
1324
1644
  */
@@ -1355,10 +1675,12 @@ var WidgetPackage = class {
1355
1675
  entry;
1356
1676
  /**
1357
1677
  * 远程组件包入口文件
1678
+ * @deprecated
1358
1679
  */
1359
1680
  remoteEntry;
1360
1681
  /**
1361
1682
  * 组件包json文件路径
1683
+ * @deprecated
1362
1684
  * @example https://rtugeek.gitee.io/hotspot/widget.json
1363
1685
  */
1364
1686
  remotePackage;
@@ -1394,7 +1716,7 @@ var WidgetPackage = class {
1394
1716
  this.remoteEntry = options.remoteEntry;
1395
1717
  this.requiredAppVersion = options.requiredAppVersion;
1396
1718
  this.remotePackage = options.remotePackage;
1397
- this.hash = options.hash;
1719
+ this.hash = options.hash ?? false;
1398
1720
  this.url = "";
1399
1721
  this.icon = options.icon;
1400
1722
  this.devOptions = options.devOptions;
@@ -1410,7 +1732,7 @@ var WidgetPackage = class {
1410
1732
  return this.parseObject(object);
1411
1733
  }
1412
1734
  static parseObject(obj) {
1413
- const widgetPackage = new WidgetPackage({
1735
+ const widgetPackage = new _WidgetPackage({
1414
1736
  author: "",
1415
1737
  description: {
1416
1738
  "zh-CN": ""
@@ -1463,31 +1785,6 @@ var WidgetPackage = class {
1463
1785
  }
1464
1786
  };
1465
1787
 
1466
- // src/utils/ElectronUtils.ts
1467
- var ElectronUtils = class {
1468
- static hasElectronApi() {
1469
- return this.getAPI() != null;
1470
- }
1471
- /**
1472
- * 获取ElectronAPI
1473
- * windows api
1474
- */
1475
- static getAPI() {
1476
- if (Reflect.has(window, "electronAPI")) {
1477
- return window.electronAPI;
1478
- } else if (Reflect.has(window.parent, "electronAPI")) {
1479
- return window.parent.electronAPI;
1480
- }
1481
- return null;
1482
- }
1483
- static async invokeMethod(channel, method, ...args) {
1484
- return this.getAPI()?.invoke(channel, method, ...args);
1485
- }
1486
- static async invoke(channel, ...args) {
1487
- return this.getAPI()?.invoke(channel, ...args);
1488
- }
1489
- };
1490
-
1491
1788
  // src/utils/normalizeUrl.ts
1492
1789
  var DATA_URL_DEFAULT_MIME_TYPE = "text/plain";
1493
1790
  var DATA_URL_DEFAULT_CHARSET = "us-ascii";
@@ -1865,27 +2162,28 @@ var ElectronApi = class {
1865
2162
  }
1866
2163
  };
1867
2164
 
1868
- // src/api/WidgetDataApi.ts
1869
- var import_localforage = __toESM(require("localforage"), 1);
1870
-
1871
2165
  // src/api/Channel.ts
1872
2166
  var Channel = /* @__PURE__ */ ((Channel2) => {
1873
2167
  Channel2["NOTIFICATION"] = "channel::cn.widgetjs.core.notification";
1874
2168
  Channel2["BROWSER_WINDOW"] = "channel::cn.widgetjs.core.browser_window";
1875
2169
  Channel2["BROADCAST"] = "channel::cn.widgetjs.core.broadcast";
1876
2170
  Channel2["WIDGET"] = "channel::cn.widgetjs.core.widget";
2171
+ Channel2["WIDGET_PACKAGE"] = "channel::cn.widgetjs.core.widget.package";
1877
2172
  Channel2["DEPLOYED_WIDGET"] = "channel::cn.widgetjs.core.deployed_widget";
1878
2173
  Channel2["APP"] = "channel::cn.widgetjs.core.app";
2174
+ Channel2["SYSTEM"] = "channel::cn.widgetjs.core.system";
1879
2175
  Channel2["DIALOG"] = "channel::cn.widgetjs.core.dialog";
1880
2176
  Channel2["CLIPBOARD"] = "channel::cn.widgetjs.core.clipboard";
1881
2177
  Channel2["FILE"] = "channel::cn.widgetjs.core.file";
1882
2178
  Channel2["SCREEN"] = "channel::cn.widgetjs.core.screen";
2179
+ Channel2["MENU"] = "channel::cn.widgetjs.core.menu";
1883
2180
  Channel2["SHORTCUT"] = "channel::cn.widgetjs.core.shortcut";
1884
2181
  Channel2["LOG"] = "channel::cn.widgetjs.core.log";
1885
2182
  Channel2["DEVICE"] = "channel::cn.widgetjs.core.device";
1886
2183
  Channel2["MOUSE"] = "channel::cn.widgetjs.core.mouse";
1887
2184
  Channel2["KEYBOARD"] = "channel::cn.widgetjs.core.keyboard";
1888
2185
  Channel2["STORE"] = "channel::cn.widgetjs.core.store";
2186
+ Channel2["STORAGE"] = "channel::cn.widgetjs.core.storage";
1889
2187
  Channel2["PROCESS"] = "channel::cn.widgetjs.core.process";
1890
2188
  return Channel2;
1891
2189
  })(Channel || {});
@@ -1921,6 +2219,8 @@ var BroadcastApi = new BroadcastApiImpl();
1921
2219
  var WidgetApiEvent = /* @__PURE__ */ ((WidgetApiEvent2) => {
1922
2220
  WidgetApiEvent2["DATA_CHANGED"] = "event::cn.widgetjs.core.widget.data-changed";
1923
2221
  WidgetApiEvent2["EDIT_DESKTOP_WIDGETS"] = "event::cn.widgetjs.core.widget.desktop.edit";
2222
+ WidgetApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
2223
+ WidgetApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
1924
2224
  return WidgetApiEvent2;
1925
2225
  })(WidgetApiEvent || {});
1926
2226
  var WidgetApiImpl = class extends BaseApi {
@@ -1952,6 +2252,9 @@ var WidgetApiImpl = class extends BaseApi {
1952
2252
  async openConfigPageByName(widgetName) {
1953
2253
  return this.invokeMethod("openConfigPageByName", widgetName);
1954
2254
  }
2255
+ /**
2256
+ * @deprecated
2257
+ */
1955
2258
  async getWidgetPackages() {
1956
2259
  return await this.invokeMethod("getWidgetPackages");
1957
2260
  }
@@ -1963,11 +2266,15 @@ var WidgetApiImpl = class extends BaseApi {
1963
2266
  return Widget.parseObject(await this.invokeMethod("getWidget", name));
1964
2267
  }
1965
2268
  /**
1966
- *
1967
2269
  * @param name package name
2270
+ * @deprecated
1968
2271
  */
1969
2272
  async getWidgetPackage(name) {
1970
- return WidgetPackage.parseObject(await this.invokeMethod("getWidgetPackage", name));
2273
+ const result = await this.invokeMethod("getWidgetPackage", name);
2274
+ if (result) {
2275
+ return WidgetPackage.parseObject(result);
2276
+ }
2277
+ return void 0;
1971
2278
  }
1972
2279
  async getWidgetPackageUrl(packageName) {
1973
2280
  const widgetPackage = await this.getWidgetPackage(packageName);
@@ -1976,6 +2283,12 @@ var WidgetApiImpl = class extends BaseApi {
1976
2283
  }
1977
2284
  return widgetPackage.url;
1978
2285
  }
2286
+ async upgradePackage(packageName) {
2287
+ return await this.invokeMethod("upgradePackage", packageName);
2288
+ }
2289
+ setMouseDraggable(draggable) {
2290
+ return this.invokeMethod("setMouseDraggable", draggable);
2291
+ }
1979
2292
  // /**
1980
2293
  // * 通过组件名保存组件信息,通常用于存储可以在同类组件中共用的数据
1981
2294
  // * @param data
@@ -2041,7 +2354,7 @@ var WidgetDataApiImpl = class {
2041
2354
  if (this.stores.has(widgetName)) {
2042
2355
  return this.stores.get(widgetName);
2043
2356
  }
2044
- const store = import_localforage.default.createInstance({ name: widgetName, storeName });
2357
+ const store = localforage__default.default.createInstance({ name: widgetName, storeName });
2045
2358
  this.stores.set(widgetName, store);
2046
2359
  return store;
2047
2360
  }
@@ -2069,8 +2382,8 @@ var WidgetDataApiImpl = class {
2069
2382
  let data;
2070
2383
  if (args.length === 2) {
2071
2384
  name = args[0];
2072
- const type = args[1];
2073
- data = new type(name);
2385
+ const Type = args[1];
2386
+ data = new Type(name);
2074
2387
  } else {
2075
2388
  data = args[0];
2076
2389
  name = data.name;
@@ -2083,11 +2396,11 @@ var WidgetDataApiImpl = class {
2083
2396
  }
2084
2397
  return void 0;
2085
2398
  }
2086
- async find(name, id, type) {
2399
+ async find(name, id, Type) {
2087
2400
  const store = this.getStore(name);
2088
2401
  const result = await store.getItem(this.getKey(name, id));
2089
2402
  if (result) {
2090
- const widgetData = new type(name, id);
2403
+ const widgetData = new Type(name, id);
2091
2404
  widgetData.parseJSON(JSON.parse(result));
2092
2405
  return widgetData;
2093
2406
  }
@@ -2110,6 +2423,15 @@ var BrowserWindowApiEvent = /* @__PURE__ */ ((BrowserWindowApiEvent2) => {
2110
2423
  return BrowserWindowApiEvent2;
2111
2424
  })(BrowserWindowApiEvent || {});
2112
2425
  var BrowserWindowApiImpl = class extends BaseApi {
2426
+ isResizable() {
2427
+ return this.invokeMethod("isResizable");
2428
+ }
2429
+ setHasShadow(hasShadow) {
2430
+ return this.invokeMethod("setHasShadow", hasShadow);
2431
+ }
2432
+ isDraggingWindow() {
2433
+ return this.invokeMethod("isDraggingWindow");
2434
+ }
2113
2435
  setNoActivate() {
2114
2436
  return this.invokeMethod("setNoActivate");
2115
2437
  }
@@ -2263,10 +2585,16 @@ var BrowserWindowApiImpl = class extends BaseApi {
2263
2585
  if (options.center) {
2264
2586
  await this.center();
2265
2587
  }
2588
+ if (options.x != void 0 || options.y != void 0) {
2589
+ await this.setPosition({ x: options.x, y: options.y });
2590
+ }
2266
2591
  }
2267
2592
  async setProxy(config) {
2268
2593
  return await this.invokeMethod("setProxy", config);
2269
2594
  }
2595
+ getSize() {
2596
+ return this.invokeMethod("getSize");
2597
+ }
2270
2598
  };
2271
2599
  var BrowserWindowApi = new BrowserWindowApiImpl();
2272
2600
 
@@ -2307,18 +2635,8 @@ var NotificationApiImpl = class extends BaseApi {
2307
2635
  async send(notification) {
2308
2636
  return this.invokeMethod("send", notification);
2309
2637
  }
2310
- async reminder(title, message, icon, cancelButtonText, confirmButtonText, cancelBroadcast, confirmBroadcast, duration = 5e3) {
2311
- return await this.send(new AppNotification({
2312
- icon,
2313
- message,
2314
- title,
2315
- duration,
2316
- cancelButtonText,
2317
- confirmButtonText,
2318
- cancelBroadcast,
2319
- confirmBroadcast,
2320
- type: "reminder"
2321
- }));
2638
+ async reminder(option) {
2639
+ return await this.send(new AppReminderNotification(option));
2322
2640
  }
2323
2641
  async advanceCountdown(message, targetTime, title) {
2324
2642
  return await this.send(new AppNotification({
@@ -2393,8 +2711,8 @@ var DeployedWidgetApiImpl = class extends BaseApi {
2393
2711
  async removeDeployedWidget(id) {
2394
2712
  return this.invokeMethod("removeDeployedWidget", id);
2395
2713
  }
2396
- addWidget(widgetName, hostMode) {
2397
- return this.invokeMethod("addWidget", widgetName, hostMode);
2714
+ addWidget(options) {
2715
+ return this.invokeMethod("addWidget", options);
2398
2716
  }
2399
2717
  /**
2400
2718
  * 通过组件名移除已添加的组件
@@ -2442,6 +2760,15 @@ var DeployedWidgetApi = new DeployedWidgetApiImpl();
2442
2760
 
2443
2761
  // src/api/DeviceApi.ts
2444
2762
  var DeviceApiImpl = class extends BaseApi {
2763
+ getDisplayNearestPoint(point) {
2764
+ return this.invokeMethod("getDisplayNearestPoint", point);
2765
+ }
2766
+ getAllDisplays() {
2767
+ return this.invokeMethod("getAllDisplays");
2768
+ }
2769
+ getPrimaryDisplay() {
2770
+ return this.invokeMethod("getPrimaryDisplay");
2771
+ }
2445
2772
  /**
2446
2773
  * 获取当前鼠标位置
2447
2774
  */
@@ -2486,18 +2813,20 @@ var ClipboardApi = new ClipboardApiImpl();
2486
2813
 
2487
2814
  // src/api/ApiConstants.ts
2488
2815
  var ApiConstants = class {
2816
+ static CONFIG_LAUNCH_AT_STARTUP = "CONFIG_LAUNCH_AT_STARTUP";
2817
+ static CONFIG_WIDGET_TITLE_COLOR = "CONFIG_WIDGET_TITLE_COLOR";
2818
+ static CONFIG_DEBUG_MODE = "cn.widgetjs.config.debug";
2819
+ static CONFIG_GRID_CELL_SIZE = "cn.widgetjs.config.grid.size";
2820
+ static SHORTCUT_PIN_DESKTOP_WIDGETS = "cn.widgetjs.config.shortcut.pin_desktop_widgets";
2489
2821
  };
2490
- __publicField(ApiConstants, "CONFIG_LAUNCH_AT_STARTUP", "CONFIG_LAUNCH_AT_STARTUP");
2491
- __publicField(ApiConstants, "CONFIG_WIDGET_TITLE_COLOR", "CONFIG_WIDGET_TITLE_COLOR");
2492
- __publicField(ApiConstants, "CONFIG_DEBUG_MODE", "cn.widgetjs.config.debug");
2493
- __publicField(ApiConstants, "CONFIG_GRID_CELL_SIZE", "cn.widgetjs.config.grid.size");
2494
- __publicField(ApiConstants, "SHORTCUT_PIN_DESKTOP_WIDGETS", "cn.widgetjs.config.shortcut.pin_desktop_widgets");
2495
2822
 
2496
- // src/api/ShortcutApi.ts
2823
+ // src/api/interface/IShortcutApi.ts
2497
2824
  var ShortcutApiEvent = /* @__PURE__ */ ((ShortcutApiEvent2) => {
2498
2825
  ShortcutApiEvent2["TRIGGERED"] = "channel::cn.widgetjs.core.shortcut.triggered";
2499
2826
  return ShortcutApiEvent2;
2500
2827
  })(ShortcutApiEvent || {});
2828
+
2829
+ // src/api/ShortcutApi.ts
2501
2830
  var ShortcutApiImpl = class extends BaseApi {
2502
2831
  getChannel() {
2503
2832
  return "channel::cn.widgetjs.core.shortcut" /* SHORTCUT */;
@@ -2541,17 +2870,13 @@ var ProcessApiImpl = class extends BaseApi {
2541
2870
  var ProcessApi = new ProcessApiImpl();
2542
2871
 
2543
2872
  // src/api/AppApi.ts
2544
- var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
2545
- AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
2546
- AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
2547
- AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
2548
- return AppApiEvent2;
2549
- })(AppApiEvent || {});
2550
- var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
2551
- AppApiConstants2["CONFIG_GRID_CELL_SIZE"] = "cn.widgetjs.config.grid.size";
2552
- return AppApiConstants2;
2553
- })(AppApiConstants || {});
2554
2873
  var AppApiImpl = class extends BaseApi {
2874
+ setProxy(config) {
2875
+ return this.invokeMethod("setProxy", config);
2876
+ }
2877
+ getProxy() {
2878
+ return this.invokeMethod("getProxy");
2879
+ }
2555
2880
  isWindowsStore() {
2556
2881
  return this.invokeMethod("isWindowsStore");
2557
2882
  }
@@ -2583,9 +2908,6 @@ var AppApiImpl = class extends BaseApi {
2583
2908
  async openAddWidgetWindow() {
2584
2909
  return this.invokeMethod("openAddWidgetWindow");
2585
2910
  }
2586
- /**
2587
- * 获取应用版本号,格式为 x.y.z
2588
- */
2589
2911
  async getVersion(type) {
2590
2912
  return this.invokeMethod("getVersion", type);
2591
2913
  }
@@ -2595,6 +2917,18 @@ var AppApiImpl = class extends BaseApi {
2595
2917
  async openSettingWindow() {
2596
2918
  return this.invokeMethod("openSettingWindow");
2597
2919
  }
2920
+ getThemeCSS() {
2921
+ return this.invokeMethod("getThemeCSS");
2922
+ }
2923
+ setThemeCSS(css) {
2924
+ return this.invokeMethod("setThemeCSS", css);
2925
+ }
2926
+ getDevMode() {
2927
+ return this.invokeMethod("getDevMode");
2928
+ }
2929
+ setDevMode(enable) {
2930
+ return this.invokeMethod("setDevMode", enable);
2931
+ }
2598
2932
  };
2599
2933
  var AppApi = new AppApiImpl();
2600
2934
 
@@ -2603,10 +2937,6 @@ var DialogApiImpl = class extends BaseApi {
2603
2937
  getChannel() {
2604
2938
  return "channel::cn.widgetjs.core.dialog" /* DIALOG */;
2605
2939
  }
2606
- /**
2607
- * 选取单个文件
2608
- * @param extensions 允许的文件后缀格式,如:["txt","docx","gif"]
2609
- */
2610
2940
  pickFile(extensions) {
2611
2941
  return this.invokeMethod("pickFile", extensions);
2612
2942
  }
@@ -2616,8 +2946,8 @@ var DialogApiImpl = class extends BaseApi {
2616
2946
  };
2617
2947
  var DialogApi = new DialogApiImpl();
2618
2948
 
2619
- // src/api/StoreApi.ts
2620
- var StoreApiImpl = class extends BaseApi {
2949
+ // src/api/StorageApi.ts
2950
+ var StorageApiImpl = class extends BaseApi {
2621
2951
  getChannel() {
2622
2952
  return "channel::cn.widgetjs.core.store" /* STORE */;
2623
2953
  }
@@ -2647,8 +2977,21 @@ var StoreApiImpl = class extends BaseApi {
2647
2977
  }
2648
2978
  return this.invokeMethod("set", key, value);
2649
2979
  }
2980
+ decryptString(value) {
2981
+ return this.invokeMethod("decryptString", value);
2982
+ }
2983
+ decryptGet(key, defaultValue) {
2984
+ return this.invokeMethod("decryptGet", key, defaultValue);
2985
+ }
2986
+ encryptSet(key, value) {
2987
+ return this.invokeMethod("encryptSet", key, value);
2988
+ }
2989
+ encryptString(value) {
2990
+ return this.invokeMethod("encryptString", value);
2991
+ }
2650
2992
  };
2651
- var StoreApi = new StoreApiImpl();
2993
+ var StorageApi = new StorageApiImpl();
2994
+ var StoreApi = new StorageApiImpl();
2652
2995
 
2653
2996
  // src/api/LogApi.ts
2654
2997
  var LogApiImpl = class extends BaseApi {
@@ -2656,7 +2999,7 @@ var LogApiImpl = class extends BaseApi {
2656
2999
  return "channel::cn.widgetjs.core.log" /* LOG */;
2657
3000
  }
2658
3001
  info(...data) {
2659
- console.info(...data);
3002
+ console.log(...data);
2660
3003
  this.invokeMethod("info", ...data);
2661
3004
  }
2662
3005
  error(...data) {
@@ -2725,65 +3068,195 @@ var FileApiImpl = class extends BaseApi {
2725
3068
  };
2726
3069
  var FileApi = new FileApiImpl();
2727
3070
 
2728
- // src/api/SystemApi.ts
3071
+ // src/api/structures/Gravity.ts
3072
+ var Gravity = /* @__PURE__ */ ((Gravity2) => {
3073
+ Gravity2["TOP"] = "TOP";
3074
+ Gravity2["LEFT"] = "LEFT";
3075
+ Gravity2["RIGHT"] = "RIGHT";
3076
+ Gravity2["BOTTOM"] = "BOTTOM";
3077
+ return Gravity2;
3078
+ })(Gravity || {});
3079
+
3080
+ // src/api/interface/ISystemApi.ts
2729
3081
  var SystemApiEvent = /* @__PURE__ */ ((SystemApiEvent2) => {
2730
3082
  SystemApiEvent2["DATE_CHANGED"] = "event::cn.widgetjs.core.sys.date.changed";
2731
3083
  return SystemApiEvent2;
2732
3084
  })(SystemApiEvent || {});
2733
- // Annotate the CommonJS export names for ESM import in node:
2734
- 0 && (module.exports = {
2735
- ApiConstants,
2736
- AppApi,
2737
- AppApiConstants,
2738
- AppApiEvent,
2739
- AppNotification,
2740
- BackgroundWidget,
2741
- BaseApi,
2742
- BroadcastApi,
2743
- BroadcastEvent,
2744
- BrowserWindowApi,
2745
- BrowserWindowApiEvent,
2746
- Channel,
2747
- ClipboardApi,
2748
- ClipboardApiEvent,
2749
- DefaultWidgetTheme,
2750
- DeployMode,
2751
- DeployedPage,
2752
- DeployedWidget,
2753
- DeployedWidgetApi,
2754
- DeviceApi,
2755
- DialogApi,
2756
- ElectronApi,
2757
- ElectronUtils,
2758
- FileApi,
2759
- Gravity,
2760
- GridRect,
2761
- GridSystem,
2762
- HostedMode,
2763
- LogApi,
2764
- NotificationApi,
2765
- NotificationApiEvent,
2766
- NotificationSize,
2767
- Page,
2768
- ProcessApi,
2769
- ShortcutApi,
2770
- ShortcutApiEvent,
2771
- StoreApi,
2772
- SystemApiEvent,
2773
- ThemeMode,
2774
- WebSocketEvent,
2775
- WebSocketEventType,
2776
- Widget,
2777
- WidgetApi,
2778
- WidgetApiEvent,
2779
- WidgetData,
2780
- WidgetDataApi,
2781
- WidgetKeyword,
2782
- WidgetPackage,
2783
- WidgetParams,
2784
- getTextByLanguageCode,
2785
- normalizeUrl,
2786
- parseQuery,
2787
- stringifyQuery
2788
- });
3085
+
3086
+ // src/api/SystemApi.ts
3087
+ var SystemApiImpl = class extends BaseApi {
3088
+ getChannel() {
3089
+ return "channel::cn.widgetjs.core.system" /* SYSTEM */;
3090
+ }
3091
+ getWallpaper() {
3092
+ return this.invokeMethod("getWallpaper");
3093
+ }
3094
+ };
3095
+ var SystemApi = new SystemApiImpl();
3096
+
3097
+ // src/api/interface/IAppApi.ts
3098
+ var AppApiEvent = /* @__PURE__ */ ((AppApiEvent2) => {
3099
+ AppApiEvent2["CONFIG_CHANGED"] = "event::cn.widgetjs.core.app.config.changed";
3100
+ AppApiEvent2["MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window";
3101
+ AppApiEvent2["STOP_MOVING_GRID_WINDOW"] = "event::cn.widgetjs.core.app.moving.grid.window.stop";
3102
+ AppApiEvent2["PROXY_CHANGED"] = "event::cn.widgetjs.core.app.proxy.changed";
3103
+ return AppApiEvent2;
3104
+ })(AppApiEvent || {});
3105
+ var AppApiConstants = /* @__PURE__ */ ((AppApiConstants2) => {
3106
+ AppApiConstants2["CONFIG_GRID_CELL_SIZE"] = "cn.widgetjs.config.grid.size";
3107
+ AppApiConstants2["CONFIG_WIDGET_THEME_CSS"] = "cn.widgetjs.config.widget.theme.css";
3108
+ AppApiConstants2["CONFIG_PROXY"] = "cn.widgetjs.config.app.proxy";
3109
+ AppApiConstants2["CONFIG_DEV_MODE"] = "cn.widgetjs.config.app.dev.mode";
3110
+ return AppApiConstants2;
3111
+ })(AppApiConstants || {});
3112
+
3113
+ // src/api/interface/IWidgetPackageApi.ts
3114
+ var WidgetPackageApiEvent = /* @__PURE__ */ ((WidgetPackageApiEvent2) => {
3115
+ WidgetPackageApiEvent2["PACKAGE_UPGRADE"] = "event::cn.widgetjs.core.widget.package.upgraded";
3116
+ WidgetPackageApiEvent2["PACKAGE_INSTALLED"] = "event::cn.widgetjs.core.widget.package.installed";
3117
+ return WidgetPackageApiEvent2;
3118
+ })(WidgetPackageApiEvent || {});
3119
+
3120
+ // src/api/WidgetPackageApi.ts
3121
+ var WidgetPackageApiImpl = class extends BaseApi {
3122
+ getChannel() {
3123
+ return "channel::cn.widgetjs.core.widget.package" /* WIDGET_PACKAGE */;
3124
+ }
3125
+ async install(widgetPackage) {
3126
+ return this.invokeMethod("install", JSON.stringify(widgetPackage));
3127
+ }
3128
+ upgrade(packageName, remoteUrlInfo) {
3129
+ return this.invokeMethod("upgrade", packageName, remoteUrlInfo);
3130
+ }
3131
+ /**
3132
+ *
3133
+ * @param name package name
3134
+ */
3135
+ async getPackage(name) {
3136
+ const result = await this.invokeMethod("getPackage", name);
3137
+ if (result) {
3138
+ return WidgetPackage.parseObject(result);
3139
+ }
3140
+ return void 0;
3141
+ }
3142
+ async getIndexUrl(packageName) {
3143
+ const widgetPackage = await this.getPackage(packageName);
3144
+ if (!widgetPackage) {
3145
+ return null;
3146
+ }
3147
+ return widgetPackage.url;
3148
+ }
3149
+ async getEntryUrl(packageName) {
3150
+ const widgetPackage = await this.getPackage(packageName);
3151
+ if (!widgetPackage) {
3152
+ return null;
3153
+ }
3154
+ const arr = [];
3155
+ arr.push(widgetPackage.url);
3156
+ if (widgetPackage.entry) {
3157
+ if (!widgetPackage.entry.startsWith("/")) {
3158
+ arr.push("/");
3159
+ }
3160
+ arr.push(widgetPackage.entry);
3161
+ }
3162
+ return arr.join("");
3163
+ }
3164
+ async getPackages() {
3165
+ return await this.invokeMethod("getPackages");
3166
+ }
3167
+ };
3168
+ var WidgetPackageApi = new WidgetPackageApiImpl();
3169
+
3170
+ // src/api/MenuApi.ts
3171
+ var MenuApiEvent = /* @__PURE__ */ ((MenuApiEvent2) => {
3172
+ MenuApiEvent2["ITEM_CLICK"] = "event::cn.widgetjs.core.menu.item.click";
3173
+ return MenuApiEvent2;
3174
+ })(MenuApiEvent || {});
3175
+ var MenuApiImpl = class extends BaseApi {
3176
+ getChannel() {
3177
+ return "channel::cn.widgetjs.core.menu" /* MENU */;
3178
+ }
3179
+ addContextMenuItem(menuItems) {
3180
+ return this.invokeMethod("addContextMenuItem", menuItems);
3181
+ }
3182
+ addMenuItem(menuItems) {
3183
+ return this.invokeMethod("addMenuItem", menuItems);
3184
+ }
3185
+ showMenu(options) {
3186
+ return this.invokeMethod("showMenu", options);
3187
+ }
3188
+ removeMenuItem(menuItemIds) {
3189
+ return this.invokeMethod("removeMenuItem", menuItemIds);
3190
+ }
3191
+ removeContextMenuItem(menuItemIds) {
3192
+ return this.invokeMethod("removeContextMenuItem", menuItemIds);
3193
+ }
3194
+ };
3195
+ var MenuApi = new MenuApiImpl();
3196
+
3197
+ exports.ApiConstants = ApiConstants;
3198
+ exports.AppApi = AppApi;
3199
+ exports.AppApiConstants = AppApiConstants;
3200
+ exports.AppApiEvent = AppApiEvent;
3201
+ exports.AppNotification = AppNotification;
3202
+ exports.AppReminderNotification = AppReminderNotification;
3203
+ exports.BackgroundWidget = BackgroundWidget;
3204
+ exports.BaseApi = BaseApi;
3205
+ exports.BroadcastApi = BroadcastApi;
3206
+ exports.BroadcastEvent = BroadcastEvent;
3207
+ exports.BrowserWindowApi = BrowserWindowApi;
3208
+ exports.BrowserWindowApiEvent = BrowserWindowApiEvent;
3209
+ exports.Channel = Channel;
3210
+ exports.ClipboardApi = ClipboardApi;
3211
+ exports.ClipboardApiEvent = ClipboardApiEvent;
3212
+ exports.DefaultWidgetTheme = DefaultWidgetTheme;
3213
+ exports.DeployMode = DeployMode;
3214
+ exports.DeployedPage = DeployedPage;
3215
+ exports.DeployedWidget = DeployedWidget;
3216
+ exports.DeployedWidgetApi = DeployedWidgetApi;
3217
+ exports.DeviceApi = DeviceApi;
3218
+ exports.DialogApi = DialogApi;
3219
+ exports.ElectronApi = ElectronApi;
3220
+ exports.ElectronUtils = ElectronUtils;
3221
+ exports.FileApi = FileApi;
3222
+ exports.Gravity = Gravity;
3223
+ exports.GridRect = GridRect;
3224
+ exports.GridSystem = GridSystem;
3225
+ exports.HostedMode = HostedMode;
3226
+ exports.LogApi = LogApi;
3227
+ exports.MenuApi = MenuApi;
3228
+ exports.MenuApiEvent = MenuApiEvent;
3229
+ exports.NotificationApi = NotificationApi;
3230
+ exports.NotificationApiEvent = NotificationApiEvent;
3231
+ exports.NotificationSize = NotificationSize;
3232
+ exports.Page = Page;
3233
+ exports.ProcessApi = ProcessApi;
3234
+ exports.ShortcutApi = ShortcutApi;
3235
+ exports.ShortcutApiEvent = ShortcutApiEvent;
3236
+ exports.StorageApi = StorageApi;
3237
+ exports.StoreApi = StoreApi;
3238
+ exports.SystemApi = SystemApi;
3239
+ exports.SystemApiEvent = SystemApiEvent;
3240
+ exports.ThemeMode = ThemeMode;
3241
+ exports.WebSocketEvent = WebSocketEvent;
3242
+ exports.WebSocketEventType = WebSocketEventType;
3243
+ exports.Widget = Widget;
3244
+ exports.WidgetApi = WidgetApi;
3245
+ exports.WidgetApiEvent = WidgetApiEvent;
3246
+ exports.WidgetData = WidgetData;
3247
+ exports.WidgetDataApi = WidgetDataApi;
3248
+ exports.WidgetKeyword = WidgetKeyword;
3249
+ exports.WidgetPackage = WidgetPackage;
3250
+ exports.WidgetPackageApi = WidgetPackageApi;
3251
+ exports.WidgetPackageApiEvent = WidgetPackageApiEvent;
3252
+ exports.WidgetPackageUtils = WidgetPackageUtils;
3253
+ exports.WidgetParams = WidgetParams;
3254
+ exports.WidgetTheme = WidgetTheme;
3255
+ exports.WidgetUtils = WidgetUtils;
3256
+ exports.delay = delay;
3257
+ exports.getTextByLanguageCode = getTextByLanguageCode;
3258
+ exports.normalizeUrl = normalizeUrl;
3259
+ exports.parseQuery = parseQuery;
3260
+ exports.stringifyQuery = stringifyQuery;
3261
+ //# sourceMappingURL=out.js.map
2789
3262
  //# sourceMappingURL=index.cjs.map