@zhongguo168a/yxeditor-common 0.0.133 → 0.0.141

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { HorizontalTextAlignment, VerticalTextAlignment, director, macro, Scheduler, math, instantiate, _decorator, Component, SpriteAtlas, Size, Vec2, Rect, SpriteFrame, path, assetManager, Texture2D, ImageAsset, JsonAsset, TextAsset, Asset, find, Canvas, Node, Vec3, Vec4, resources, UITransform, Widget } from 'cc';
1
+ import { HorizontalTextAlignment, VerticalTextAlignment, director, macro, Scheduler, math, instantiate, _decorator, Component, assetManager, SpriteAtlas, Size, Vec2, Rect, SpriteFrame, path, Texture2D, ImageAsset, JsonAsset, TextAsset, Asset, find, Canvas, Node, Vec3, Vec4, resources, UITransform, Widget } from 'cc';
2
2
 
3
3
  class NetUtil {
4
4
  // 获取URL的参数对象
@@ -55,9 +55,6 @@ const netutil = new NetUtil();
55
55
  * err1 <argA=val&argB=val>
56
56
  */
57
57
  class LinkError {
58
- next;
59
- ident;
60
- args;
61
58
  /**
62
59
  * 判断当前错误是否 cancel 错误
63
60
  */
@@ -148,15 +145,6 @@ const errorutil = new ErrorUtil();
148
145
  * 单例的UI对象
149
146
  */
150
147
  class UISingleConfig {
151
- /**
152
- * 创建函数
153
- */
154
- creator;
155
- /**
156
- * 指定键值
157
- * 可通过键值获得 ui对象
158
- */
159
- name;
160
148
  constructor({ name, creator, }) {
161
149
  this.name = name;
162
150
  this.creator = creator;
@@ -166,21 +154,11 @@ class UISingleConfig {
166
154
  * 单例的UI对象
167
155
  */
168
156
  class UIPoolConfig {
169
- /**
170
- * 创建函数
171
- * 对象需要实现recycle方法
172
- */
173
- creator;
174
- /**
175
- * 指定键值
176
- * 可通过键值获得 ui对象
177
- */
178
- name;
179
- /**
180
- * 过期帧数,默认为永不过期(0)
181
- */
182
- expired = 0;
183
157
  constructor({ name, creator, expired = 0, }) {
158
+ /**
159
+ * 过期帧数,默认为永不过期(0)
160
+ */
161
+ this.expired = 0;
184
162
  this.name = name;
185
163
  this.creator = creator;
186
164
  this.expired = expired;
@@ -196,17 +174,17 @@ class UIPoolConfig {
196
174
  * 需要注册
197
175
  */
198
176
  class UIManager {
199
- /**
200
- * ui单例对象缓存数量的最大值
201
- */
202
- singleObjectMax = 0;
203
- singleObjs = {};
204
- singleList = [];
205
- singleCounts = {};
206
- singleConfigs = {};
207
- pools = {};
208
- poolConfig = {};
209
177
  constructor() {
178
+ /**
179
+ * ui单例对象缓存数量的最大值
180
+ */
181
+ this.singleObjectMax = 0;
182
+ this.singleObjs = {};
183
+ this.singleList = [];
184
+ this.singleCounts = {};
185
+ this.singleConfigs = {};
186
+ this.pools = {};
187
+ this.poolConfig = {};
210
188
  }
211
189
  /**
212
190
  * 注册一个ui对象配置
@@ -381,7 +359,6 @@ class Timer {
381
359
  get scheduler() {
382
360
  return this._scheduler;
383
361
  }
384
- _scheduler;
385
362
  constructor() {
386
363
  this._scheduler = director.getScheduler();
387
364
  }
@@ -453,6 +430,22 @@ class Timer {
453
430
  const timer = new Timer();
454
431
 
455
432
  class EventItem {
433
+ constructor() {
434
+ /**
435
+ * 事件类型
436
+ */
437
+ this.type = "";
438
+ /**
439
+ * 子事件
440
+ * 如果sub == "" 或者 sub == "*", 则不需要检查sub值
441
+ */
442
+ this.sub = "";
443
+ /**
444
+ * 子事件2
445
+ * 如果sub == "" 或者 sub == "*", 则不需要检查sub值
446
+ */
447
+ this.sub2 = "";
448
+ }
456
449
  recycle() {
457
450
  this.listener = null;
458
451
  this.type = "";
@@ -467,54 +460,12 @@ class EventItem {
467
460
  dispatch(event) {
468
461
  this.listener.call(this.caller, event, event.dispatchParams);
469
462
  }
470
- listener;
471
- caller;
472
- /**
473
- * 事件类型
474
- */
475
- type = "";
476
- /**
477
- * 子事件
478
- * 如果sub == "" 或者 sub == "*", 则不需要检查sub值
479
- */
480
- sub = "";
481
- /**
482
- * 子事件2
483
- * 如果sub == "" 或者 sub == "*", 则不需要检查sub值
484
- */
485
- sub2 = "";
486
- args;
487
- once;
488
463
  }
489
464
 
490
465
  /**
491
466
  * 事件
492
467
  */
493
468
  class XEvent {
494
- /**
495
- *
496
- */
497
- dispatcher;
498
- /**
499
- * 子事件
500
- */
501
- sub;
502
- /**
503
- * 子事件
504
- */
505
- sub2;
506
- /**
507
- * 事件
508
- */
509
- type;
510
- /**
511
- * 监听时传递的参数
512
- */
513
- onParams;
514
- /**
515
- * 触发时传递的参数
516
- */
517
- dispatchParams;
518
469
  toString() {
519
470
  return `Event[${this.type} + "." + ${this.sub}]`;
520
471
  }
@@ -549,11 +500,11 @@ var LogLevel;
549
500
  LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
550
501
  })(LogLevel || (LogLevel = {}));
551
502
  class Logger {
552
- name;
553
- level;
554
- ignoreRegexp = [];
555
- ignoreString = [];
556
- _enable = true;
503
+ constructor() {
504
+ this.ignoreRegexp = [];
505
+ this.ignoreString = [];
506
+ this._enable = true;
507
+ }
557
508
  disable() {
558
509
  this._enable = false;
559
510
  }
@@ -628,6 +579,15 @@ class Logger {
628
579
 
629
580
  const LOGGER_EVENT = "Event";
630
581
  class LogManager {
582
+ constructor() {
583
+ this._loggers = {};
584
+ /**
585
+ * 是否开启日志
586
+ */
587
+ this.enable = true;
588
+ // 忽视输出的日志
589
+ this.ignores = [];
590
+ }
631
591
  /**
632
592
  * 获取事件的日志管理
633
593
  * 日志的group为事件类型
@@ -648,13 +608,6 @@ class LogManager {
648
608
  }
649
609
  return l;
650
610
  }
651
- _loggers = {};
652
- /**
653
- * 是否开启日志
654
- */
655
- enable = true;
656
- // 忽视输出的日志
657
- ignores = [];
658
611
  /**
659
612
  * 忽视包含指定字符串的日志
660
613
  * @param val
@@ -707,12 +660,8 @@ const logmgr = new LogManager();
707
660
  * 对象池
708
661
  */
709
662
  class Pool {
710
- creatorFunction;
711
- recycleFunction;
712
- disposeFunction;
713
- name = "";
714
- list;
715
663
  constructor(config) {
664
+ this.name = "";
716
665
  if (!config) {
717
666
  throw new Error("需要设置config");
718
667
  }
@@ -771,7 +720,6 @@ class Pool {
771
720
  * 对象池
772
721
  */
773
722
  class SamplePool {
774
- list;
775
723
  constructor() {
776
724
  this.list = [];
777
725
  }
@@ -799,6 +747,9 @@ class SamplePool {
799
747
  * 对象池
800
748
  */
801
749
  class SamplePoolSet {
750
+ constructor() {
751
+ this.pools = {};
752
+ }
802
753
  get(name) {
803
754
  let pool = this.pools[name];
804
755
  if (!pool) {
@@ -815,7 +766,6 @@ class SamplePoolSet {
815
766
  }
816
767
  pool.put(item);
817
768
  }
818
- pools = {};
819
769
  }
820
770
 
821
771
  const log = logmgr.getEventLogger();
@@ -824,6 +774,9 @@ const log = logmgr.getEventLogger();
824
774
  */
825
775
  class EventDispatcher {
826
776
  constructor() {
777
+ this._isPause = false;
778
+ this._onEventItems = {};
779
+ this.isDispose = false;
827
780
  Scheduler.enableForTarget(this);
828
781
  }
829
782
  dispose() {
@@ -839,7 +792,6 @@ class EventDispatcher {
839
792
  resume() {
840
793
  this._isPause = false;
841
794
  }
842
- _isPause = false;
843
795
  has(type, caller, listener) {
844
796
  return !!this.getItem(type, caller, listener);
845
797
  }
@@ -1049,11 +1001,6 @@ class EventDispatcher {
1049
1001
  }
1050
1002
  return items;
1051
1003
  }
1052
- id;
1053
- uuid;
1054
- name;
1055
- _onEventItems = {};
1056
- isDispose = false;
1057
1004
  }
1058
1005
  /**
1059
1006
  * 全局的事件派发器
@@ -1734,24 +1681,26 @@ class MapUtil {
1734
1681
  const maputil = new MapUtil();
1735
1682
 
1736
1683
  class ScaleUtil {
1737
- tenToAny = [
1738
- "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", // 1-10
1739
- "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", // 11-20
1740
- "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", // 21-30
1741
- "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", // 31-40
1742
- "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", // 41-50
1743
- "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", // 51-60
1744
- "y", "z", ":", ";", "<", "=", ">", "?", "@", "{", // 61-80
1745
- "]", "^", "_", "{", "|", "}", // 71-75
1746
- ];
1747
- allstr = "0123456789" +
1748
- "ABCDEFGHIJ" +
1749
- "KLMNOPQRST" +
1750
- "UVWXYZabcd" +
1751
- "efghijklmn" +
1752
- "opqrstuvwx" +
1753
- "yz:;<=>?@[]" +
1754
- "^_{|}";
1684
+ constructor() {
1685
+ this.tenToAny = [
1686
+ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", // 1-10
1687
+ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", // 11-20
1688
+ "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", // 21-30
1689
+ "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", // 31-40
1690
+ "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", // 41-50
1691
+ "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", // 51-60
1692
+ "y", "z", ":", ";", "<", "=", ">", "?", "@", "{", // 61-80
1693
+ "]", "^", "_", "{", "|", "}", // 71-75
1694
+ ];
1695
+ this.allstr = "0123456789" +
1696
+ "ABCDEFGHIJ" +
1697
+ "KLMNOPQRST" +
1698
+ "UVWXYZabcd" +
1699
+ "efghijklmn" +
1700
+ "opqrstuvwx" +
1701
+ "yz:;<=>?@[]" +
1702
+ "^_{|}";
1703
+ }
1755
1704
  // RandString 生成随机字符串
1756
1705
  randString(size, n) {
1757
1706
  var s = "";
@@ -1818,6 +1767,13 @@ class ScaleUtil {
1818
1767
  const scaleutil = new ScaleUtil();
1819
1768
 
1820
1769
  class IdentUtil {
1770
+ constructor() {
1771
+ this._baseline = 0;
1772
+ this._precision = "s";
1773
+ this._randLength = 3;
1774
+ this._count = 0;
1775
+ this._lastTime = 0;
1776
+ }
1821
1777
  /**
1822
1778
  * 设置时间的基线,通过减去已经过去的时间,可缩短id长度
1823
1779
  * 注:同一个项目必须拥有同样的基线,否则有几率出现相同的id!
@@ -1827,7 +1783,6 @@ class IdentUtil {
1827
1783
  setTimeBaseline(time) {
1828
1784
  this._baseline = time;
1829
1785
  }
1830
- _baseline = 0;
1831
1786
  /**
1832
1787
  * 设置时间的精度
1833
1788
  * @param precision
@@ -1835,7 +1790,6 @@ class IdentUtil {
1835
1790
  setTimePrecision(precision) {
1836
1791
  this._precision = precision;
1837
1792
  }
1838
- _precision = "s";
1839
1793
  /**
1840
1794
  * 设置随机数的长度
1841
1795
  * @param value
@@ -1843,7 +1797,6 @@ class IdentUtil {
1843
1797
  setRandLength(value = 3) {
1844
1798
  this._randLength = value;
1845
1799
  }
1846
- _randLength = 3;
1847
1800
  genOne() {
1848
1801
  let time = Date.now();
1849
1802
  switch (this._precision) {
@@ -1863,8 +1816,6 @@ class IdentUtil {
1863
1816
  let countstr = scaleutil.decimalTo(this._count, 62);
1864
1817
  return timestr + scaleutil.decimalTo(countstr.length, 62) + countstr;
1865
1818
  }
1866
- _count = 0;
1867
- _lastTime = 0;
1868
1819
  }
1869
1820
  const identutil = new IdentUtil();
1870
1821
 
@@ -1875,7 +1826,6 @@ class TreeIterator {
1875
1826
  isBreak() {
1876
1827
  return this._isBreak;
1877
1828
  }
1878
- _isBreak;
1879
1829
  }
1880
1830
  function fixPath(path) {
1881
1831
  if (path == 0) {
@@ -1895,45 +1845,12 @@ class TreeNode {
1895
1845
  get root() {
1896
1846
  return this._root;
1897
1847
  }
1898
- /**
1899
- * 根节点
1900
- */
1901
- _root;
1902
- /**
1903
- * 编号
1904
- */
1905
- uuid;
1906
- /**
1907
- * 编号
1908
- */
1909
- id;
1910
- /**
1911
- * 自定义数据
1912
- */
1913
- data;
1914
- /**
1915
- * 是否树叶
1916
- */
1917
- isLeaf = true;
1918
- /**
1919
- * 功能性标签,用于开发组件时,记录组件的状态。例如title, icon, 显示树的组件,需要 expanded,selected标签
1920
- */
1921
- tags;
1922
1848
  /**
1923
1849
  * 深度
1924
1850
  */
1925
1851
  get depth() {
1926
1852
  return this._depth;
1927
1853
  }
1928
- _depth = 0;
1929
- /**
1930
- * 父节点
1931
- */
1932
- parent;
1933
- /**
1934
- * 子节点
1935
- */
1936
- children;
1937
1854
  /**
1938
1855
  * 设置根
1939
1856
  * @param val
@@ -1959,6 +1876,11 @@ class TreeNode {
1959
1876
  this.getTags()[name] = value;
1960
1877
  }
1961
1878
  constructor(id, isLeaf) {
1879
+ /**
1880
+ * 是否树叶
1881
+ */
1882
+ this.isLeaf = true;
1883
+ this._depth = 0;
1962
1884
  this.uuid = identutil.genOne();
1963
1885
  this.id = id;
1964
1886
  if (isLeaf == undefined) {
@@ -2128,6 +2050,7 @@ class TreeNode {
2128
2050
  * @param inChild - 决定是否将子节点加入队列:若提供,调用 inChild(node),返回 true 才加入其子节点
2129
2051
  */
2130
2052
  walkBFS(f, inChild) {
2053
+ var _a;
2131
2054
  const queue = [this]; // 初始化队列
2132
2055
  while (queue.length > 0) {
2133
2056
  const node = queue.shift(); // 取出队首节点
@@ -2147,7 +2070,7 @@ class TreeNode {
2147
2070
  continue;
2148
2071
  }
2149
2072
  // 3. 将子节点加入队列(从左到右)
2150
- if (node.children?.length) {
2073
+ if ((_a = node.children) === null || _a === void 0 ? void 0 : _a.length) {
2151
2074
  for (const child of node.children) {
2152
2075
  queue.push(child);
2153
2076
  }
@@ -2426,36 +2349,6 @@ class TreeNode {
2426
2349
  }
2427
2350
  }
2428
2351
  class TreeRoot extends EventDispatcher {
2429
- /**
2430
- * 添加数据节点
2431
- * dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
2432
- */
2433
- static EVENT_ADD = "add";
2434
- /**
2435
- * 移除数据节点
2436
- * dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
2437
- */
2438
- static EVENT_REMOVE = "remove";
2439
- /**
2440
- * 插入数据节点
2441
- * dispatchParams = {node:TreeNode, before:TreeNode}
2442
- */
2443
- static EVENT_INSERT = "insert";
2444
- /**
2445
- * 刷新数据节点
2446
- * dispatchParams = {node:TreeNode}
2447
- */
2448
- static EVENT_REFRESH = "refresh";
2449
- /**
2450
- * 设置数据时触发
2451
- * dispatchParams = {node:TreeNode}
2452
- */
2453
- static EVENT_DATA_SET = "data_set";
2454
- /**
2455
- * 设置数据时触发
2456
- * dispatchParams = {node:TreeNode, tag:string, value:any}
2457
- */
2458
- static EVENT_TAGS_SET = "tags_set";
2459
2352
  static create() {
2460
2353
  return new TreeRoot();
2461
2354
  }
@@ -2659,14 +2552,41 @@ class TreeRoot extends EventDispatcher {
2659
2552
  }
2660
2553
  return this.origin.children[0];
2661
2554
  }
2662
- origin;
2663
2555
  }
2556
+ /**
2557
+ * 添加数据节点
2558
+ * dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
2559
+ */
2560
+ TreeRoot.EVENT_ADD = "add";
2561
+ /**
2562
+ * 移除数据节点
2563
+ * dispatchParams = {node:TreeNode, parent:TreeNode|TreeRoot}
2564
+ */
2565
+ TreeRoot.EVENT_REMOVE = "remove";
2566
+ /**
2567
+ * 插入数据节点
2568
+ * dispatchParams = {node:TreeNode, before:TreeNode}
2569
+ */
2570
+ TreeRoot.EVENT_INSERT = "insert";
2571
+ /**
2572
+ * 刷新数据节点
2573
+ * dispatchParams = {node:TreeNode}
2574
+ */
2575
+ TreeRoot.EVENT_REFRESH = "refresh";
2576
+ /**
2577
+ * 设置数据时触发
2578
+ * dispatchParams = {node:TreeNode}
2579
+ */
2580
+ TreeRoot.EVENT_DATA_SET = "data_set";
2581
+ /**
2582
+ * 设置数据时触发
2583
+ * dispatchParams = {node:TreeNode, tag:string, value:any}
2584
+ */
2585
+ TreeRoot.EVENT_TAGS_SET = "tags_set";
2664
2586
  ///////////////////////////
2665
2587
  class TreeRootPlugin {
2666
- root;
2667
2588
  }
2668
2589
  class TreeNodePlugin {
2669
- node;
2670
2590
  }
2671
2591
 
2672
2592
  class ListNode {
@@ -2677,13 +2597,9 @@ class ListNode {
2677
2597
  return node;
2678
2598
  }
2679
2599
  constructor() {
2600
+ this.tags = {};
2680
2601
  this.uuid = identutil.genOne();
2681
2602
  }
2682
- root;
2683
- uuid;
2684
- id;
2685
- data;
2686
- tags = {};
2687
2603
  getTags() {
2688
2604
  if (!this.tags) {
2689
2605
  this.tags = {};
@@ -2704,6 +2620,10 @@ class ListNode {
2704
2620
  }
2705
2621
  }
2706
2622
  class ListSource extends EventDispatcher {
2623
+ constructor() {
2624
+ super(...arguments);
2625
+ this._data = [];
2626
+ }
2707
2627
  /**
2708
2628
  * 通过数组创建 ListSource。ListSource的id自动生成。如果需要指定编号,可设置 idCreator
2709
2629
  * @param arr
@@ -2740,41 +2660,6 @@ class ListSource extends EventDispatcher {
2740
2660
  }
2741
2661
  return target;
2742
2662
  }
2743
- /**
2744
- * 设置数据时触发
2745
- * dispatchParams = {node:ListNode}
2746
- */
2747
- static EVENT_ADD = "add";
2748
- /**
2749
- * 设置数据时触发
2750
- * dispatchParams = {node:ListNode, index:number}
2751
- */
2752
- static EVENT_REMOVE = "remove";
2753
- /**
2754
- * 设置数据时触发
2755
- */
2756
- static EVENT_REMOVE_ALL = "remove_all";
2757
- /**
2758
- * 刷新数据节点
2759
- * dispatchParams = {node:ListNode}
2760
- */
2761
- static EVENT_REFRESH = "refresh";
2762
- /**
2763
- * 设置数据时触发
2764
- * dispatchParams = nodes: [ListNode], indexs: [number]
2765
- */
2766
- static EVENT_SWAP = "swap";
2767
- /**
2768
- * 设置数据时触发
2769
- * dispatchParams = {node:ListNode, data:any}
2770
- */
2771
- static EVENT_DATA_SET = "data_set";
2772
- /**
2773
- * 设置数据时触发
2774
- * dispatchParams = {node:ListNode, tag:string, value:any}
2775
- */
2776
- static EVENT_TAGS_SET = "tags_set";
2777
- _identFunc;
2778
2663
  at(index) {
2779
2664
  return this._data[index];
2780
2665
  }
@@ -2903,20 +2788,57 @@ class ListSource extends EventDispatcher {
2903
2788
  get data() {
2904
2789
  return this._data;
2905
2790
  }
2906
- _data = [];
2907
2791
  }
2792
+ /**
2793
+ * 设置数据时触发
2794
+ * dispatchParams = {node:ListNode}
2795
+ */
2796
+ ListSource.EVENT_ADD = "add";
2797
+ /**
2798
+ * 设置数据时触发
2799
+ * dispatchParams = {node:ListNode, index:number}
2800
+ */
2801
+ ListSource.EVENT_REMOVE = "remove";
2802
+ /**
2803
+ * 设置数据时触发
2804
+ */
2805
+ ListSource.EVENT_REMOVE_ALL = "remove_all";
2806
+ /**
2807
+ * 刷新数据节点
2808
+ * dispatchParams = {node:ListNode}
2809
+ */
2810
+ ListSource.EVENT_REFRESH = "refresh";
2811
+ /**
2812
+ * 设置数据时触发
2813
+ * dispatchParams = nodes: [ListNode], indexs: [number]
2814
+ */
2815
+ ListSource.EVENT_SWAP = "swap";
2816
+ /**
2817
+ * 设置数据时触发
2818
+ * dispatchParams = {node:ListNode, data:any}
2819
+ */
2820
+ ListSource.EVENT_DATA_SET = "data_set";
2821
+ /**
2822
+ * 设置数据时触发
2823
+ * dispatchParams = {node:ListNode, tag:string, value:any}
2824
+ */
2825
+ ListSource.EVENT_TAGS_SET = "tags_set";
2908
2826
 
2909
2827
  class DictIterator {
2910
- break() {
2828
+ break(reason) {
2911
2829
  this._isBreak = true;
2830
+ this._reason = reason;
2912
2831
  }
2913
2832
  isBreak() {
2914
2833
  return this._isBreak;
2915
2834
  }
2916
- _isBreak;
2835
+ getReason() {
2836
+ return this._reason;
2837
+ }
2917
2838
  }
2918
2839
  class Dictionary {
2919
2840
  constructor(data) {
2841
+ this.size = 0;
2920
2842
  if (data) {
2921
2843
  this._data = data;
2922
2844
  }
@@ -3225,12 +3147,6 @@ class Dictionary {
3225
3147
  }
3226
3148
  return newdata;
3227
3149
  }
3228
- size = 0;
3229
- _data;
3230
- _onSet;
3231
- _onDelete;
3232
- _onSetCaller;
3233
- _onDeleteCaller;
3234
3150
  }
3235
3151
 
3236
3152
  class DictNode {
@@ -3241,12 +3157,9 @@ class DictNode {
3241
3157
  return node;
3242
3158
  }
3243
3159
  constructor() {
3160
+ this.tags = {};
3244
3161
  this.uuid = identutil.genOne();
3245
3162
  }
3246
- uuid;
3247
- id;
3248
- data;
3249
- tags = {};
3250
3163
  getTags() {
3251
3164
  if (!this.tags) {
3252
3165
  this.tags = {};
@@ -3268,16 +3181,10 @@ class DictNode {
3268
3181
  }
3269
3182
  }
3270
3183
  class DictSource extends Dictionary {
3271
- /**
3272
- * 刷新数据节点
3273
- * dispatchParams = {node:ListNode}
3274
- */
3275
- static EVENT_REFRESH = "refresh";
3276
- /**
3277
- * 设置数据时触发
3278
- * dispatchParams = {node:ListNode, tag:string, value:any}
3279
- */
3280
- static EVENT_TAGS_SET = "tags_set";
3184
+ constructor() {
3185
+ super(...arguments);
3186
+ this._dispatcher = new EventDispatcher();
3187
+ }
3281
3188
  setNodeTags(node, tag, value) {
3282
3189
  let tags = node.getTags();
3283
3190
  if (tags[tag] === value) {
@@ -3292,8 +3199,17 @@ class DictSource extends Dictionary {
3292
3199
  get dispatcher() {
3293
3200
  return this._dispatcher;
3294
3201
  }
3295
- _dispatcher = new EventDispatcher();
3296
3202
  }
3203
+ /**
3204
+ * 刷新数据节点
3205
+ * dispatchParams = {node:ListNode}
3206
+ */
3207
+ DictSource.EVENT_REFRESH = "refresh";
3208
+ /**
3209
+ * 设置数据时触发
3210
+ * dispatchParams = {node:ListNode, tag:string, value:any}
3211
+ */
3212
+ DictSource.EVENT_TAGS_SET = "tags_set";
3297
3213
 
3298
3214
  class ListIterator {
3299
3215
  break(reason) {
@@ -3306,11 +3222,10 @@ class ListIterator {
3306
3222
  getReason() {
3307
3223
  return this._reason;
3308
3224
  }
3309
- _reason;
3310
- _isBreak;
3311
3225
  }
3312
3226
  class List {
3313
3227
  constructor() {
3228
+ this._data = [];
3314
3229
  this._onSet = null;
3315
3230
  this._onDelete = null;
3316
3231
  }
@@ -3600,15 +3515,11 @@ class List {
3600
3515
  this._onDelete.call(this._onDeleteCaller, value);
3601
3516
  }
3602
3517
  }
3603
- _data = [];
3604
- _onSet;
3605
- _onDelete;
3606
- _onSetCaller;
3607
- _onDeleteCaller;
3608
3518
  }
3609
3519
 
3610
3520
  class Controller {
3611
3521
  constructor(name) {
3522
+ this._enabled = false;
3612
3523
  this._name = name;
3613
3524
  }
3614
3525
  enable() {
@@ -3633,8 +3544,6 @@ class Controller {
3633
3544
  get isEnable() {
3634
3545
  return this._enabled;
3635
3546
  }
3636
- _name;
3637
- _enabled = false;
3638
3547
  }
3639
3548
  class ControllerDict extends Dictionary {
3640
3549
  constructor() {
@@ -3697,7 +3606,6 @@ class SimpleModel {
3697
3606
  get core() {
3698
3607
  return this._mod;
3699
3608
  }
3700
- _mod;
3701
3609
  }
3702
3610
  class Model extends EventDispatcher {
3703
3611
  constructor(core) {
@@ -3707,12 +3615,13 @@ class Model extends EventDispatcher {
3707
3615
  get module() {
3708
3616
  return this._module;
3709
3617
  }
3710
- _module;
3711
3618
  }
3712
3619
 
3713
3620
  class Factory {
3714
- _controllers = {};
3715
- _extends = {};
3621
+ constructor() {
3622
+ this._controllers = {};
3623
+ this._extends = {};
3624
+ }
3716
3625
  registerController(name, creator) {
3717
3626
  this._controllers[name] = creator;
3718
3627
  }
@@ -3743,6 +3652,11 @@ class Factory {
3743
3652
  */
3744
3653
  class Route {
3745
3654
  constructor(route) {
3655
+ this._path = "";
3656
+ this._parentPath = undefined;
3657
+ this._search = "";
3658
+ this._name = "";
3659
+ this._route = "";
3746
3660
  this._route = route;
3747
3661
  route = route.replace("#/", "");
3748
3662
  let arr = route.split("?");
@@ -3772,8 +3686,6 @@ class Route {
3772
3686
  }
3773
3687
  return link;
3774
3688
  }
3775
- // 打开界面缓存的route对象
3776
- static data = {};
3777
3689
  static getData(route) {
3778
3690
  let r = Route.data[route];
3779
3691
  if (!r) {
@@ -3855,19 +3767,16 @@ class Route {
3855
3767
  get key() {
3856
3768
  return this.path + this.search;
3857
3769
  }
3858
- _path = "";
3859
- _parentPath = undefined;
3860
- _search = "";
3861
- _name = "";
3862
- _params;
3863
- _route = "";
3864
3770
  }
3771
+ // 打开界面缓存的route对象
3772
+ Route.data = {};
3865
3773
  class RouteList extends List {
3866
3774
  }
3867
3775
 
3868
3776
  class RouteController extends Controller {
3869
3777
  constructor(routePath) {
3870
3778
  super(routePath);
3779
+ this._tags = {};
3871
3780
  this._route = new Route(routePath);
3872
3781
  }
3873
3782
  open(...args) {
@@ -3923,9 +3832,6 @@ class RouteController extends Controller {
3923
3832
  get route() {
3924
3833
  return this._route;
3925
3834
  }
3926
- _route;
3927
- _lastView;
3928
- _tags = {};
3929
3835
  }
3930
3836
 
3931
3837
  class UIObjectRepo extends Dictionary {
@@ -4020,6 +3926,15 @@ var ViewEvent;
4020
3926
  class RouteView extends EventDispatcher {
4021
3927
  constructor(controller, route) {
4022
3928
  super();
3929
+ this._waitOpenComplete = false;
3930
+ this._waitCloseComplete = false;
3931
+ this.datas = new MapObject({});
3932
+ this.tags = new MapObject({});
3933
+ this.enableHistory = false;
3934
+ this.state = 0;
3935
+ this._onStop = (ctx) => {
3936
+ ctx.close();
3937
+ };
4023
3938
  this._controller = controller;
4024
3939
  this._route = route;
4025
3940
  }
@@ -4180,8 +4095,6 @@ class RouteView extends EventDispatcher {
4180
4095
  // let com = node.addComponent(RouteComponent);
4181
4096
  // com.viewModel = this;
4182
4097
  }
4183
- _waitOpenComplete = false;
4184
- _waitCloseComplete = false;
4185
4098
  get controller() {
4186
4099
  return this._controller;
4187
4100
  }
@@ -4220,23 +4133,6 @@ class RouteView extends EventDispatcher {
4220
4133
  get reason() {
4221
4134
  return this._reason;
4222
4135
  }
4223
- node;
4224
- datas = new MapObject({});
4225
- tags = new MapObject({});
4226
- enableHistory = false;
4227
- layer;
4228
- state = 0;
4229
- _controller;
4230
- _route;
4231
- _reason;
4232
- _onOpen;
4233
- _onOpened;
4234
- _onClose;
4235
- _onClosed;
4236
- _onRefresh;
4237
- _onStop = (ctx) => {
4238
- ctx.close();
4239
- };
4240
4136
  }
4241
4137
 
4242
4138
  class ViewList extends List {
@@ -4370,6 +4266,16 @@ function __decorate(decorators, target, key, desc) {
4370
4266
  return c > 3 && r && Object.defineProperty(target, key, r), r;
4371
4267
  }
4372
4268
 
4269
+ function __awaiter(thisArg, _arguments, P, generator) {
4270
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4271
+ return new (P || (P = Promise))(function (resolve, reject) {
4272
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4273
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4274
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4275
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4276
+ });
4277
+ }
4278
+
4373
4279
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
4374
4280
  var e = new Error(message);
4375
4281
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
@@ -4411,9 +4317,6 @@ let ViewModelComponent = ViewModelComponent_1 = class ViewModelComponent extends
4411
4317
  this._onDisable = value;
4412
4318
  return this;
4413
4319
  }
4414
- viewModel;
4415
- _onEnable;
4416
- _onDisable;
4417
4320
  };
4418
4321
  ViewModelComponent = ViewModelComponent_1 = __decorate([
4419
4322
  ccclass('ViewModelComponent')
@@ -4426,6 +4329,12 @@ class ViewModel extends EventDispatcher {
4426
4329
  */
4427
4330
  constructor(name) {
4428
4331
  super();
4332
+ this._waitOpenComplete = false;
4333
+ this._waitCloseComplete = false;
4334
+ this.datas = new MapObject({});
4335
+ this.tags = new MapObject({});
4336
+ this.enableHistory = false;
4337
+ this.state = 0;
4429
4338
  this.name = name;
4430
4339
  }
4431
4340
  /**
@@ -4576,17 +4485,19 @@ class ViewModel extends EventDispatcher {
4576
4485
  /**
4577
4486
  * 等待打开完成指令
4578
4487
  */
4579
- async waitOpenComplete(...params) {
4580
- this._waitOpenComplete = true;
4581
- for (const element of params) {
4582
- await element();
4583
- if (this.state == ViewState.Closed || this.state == ViewState.Closeing) {
4584
- return;
4488
+ waitOpenComplete(...params) {
4489
+ return __awaiter(this, void 0, void 0, function* () {
4490
+ this._waitOpenComplete = true;
4491
+ for (const element of params) {
4492
+ yield element();
4493
+ if (this.state == ViewState.Closed || this.state == ViewState.Closeing) {
4494
+ return;
4495
+ }
4585
4496
  }
4586
- }
4587
- if (params.length > 0) {
4588
- this.openComplete();
4589
- }
4497
+ if (params.length > 0) {
4498
+ this.openComplete();
4499
+ }
4500
+ });
4590
4501
  }
4591
4502
  openComplete() {
4592
4503
  if (this.state == ViewState.Opened) {
@@ -4612,8 +4523,6 @@ class ViewModel extends EventDispatcher {
4612
4523
  this.dispatch(ViewEvent.Closed);
4613
4524
  this.onClosed();
4614
4525
  }
4615
- _waitOpenComplete = false;
4616
- _waitCloseComplete = false;
4617
4526
  get controller() {
4618
4527
  return this._controller;
4619
4528
  }
@@ -4623,16 +4532,6 @@ class ViewModel extends EventDispatcher {
4623
4532
  get reason() {
4624
4533
  return this._reason;
4625
4534
  }
4626
- node;
4627
- datas = new MapObject({});
4628
- tags = new MapObject({});
4629
- enableHistory = false;
4630
- layer;
4631
- state = 0;
4632
- _controller;
4633
- _route;
4634
- _reason;
4635
- _viewModelComponent;
4636
4535
  onOpen() {
4637
4536
  }
4638
4537
  onOpened() {
@@ -4657,6 +4556,7 @@ class Listener {
4657
4556
  return new Listener(ident);
4658
4557
  }
4659
4558
  constructor(ident) {
4559
+ this._isOn = true;
4660
4560
  this.ident = ident;
4661
4561
  }
4662
4562
  getCaller() {
@@ -4724,15 +4624,6 @@ class Listener {
4724
4624
  getParams() {
4725
4625
  return this.params;
4726
4626
  }
4727
- onParams;
4728
- params;
4729
- ident;
4730
- _subIdent;
4731
- source;
4732
- _handler;
4733
- _condition;
4734
- caller;
4735
- _isOn = true;
4736
4627
  }
4737
4628
 
4738
4629
  /**
@@ -4743,6 +4634,8 @@ class Listener {
4743
4634
  */
4744
4635
  class CallbackList {
4745
4636
  constructor() {
4637
+ this._data = new List();
4638
+ this._indexIdent = {};
4746
4639
  }
4747
4640
  addListener(listener) {
4748
4641
  let ident = listener.getIdent();
@@ -4818,8 +4711,6 @@ class CallbackList {
4818
4711
  }
4819
4712
  }
4820
4713
  }
4821
- _data = new List();
4822
- _indexIdent = {};
4823
4714
  }
4824
4715
 
4825
4716
  /**
@@ -4830,6 +4721,8 @@ class CallbackList {
4830
4721
  */
4831
4722
  class Dispatcher {
4832
4723
  constructor(name) {
4724
+ this.isDispose = false;
4725
+ this.typeToList = new Dictionary();
4833
4726
  Scheduler.enableForTarget(this);
4834
4727
  this.name = name;
4835
4728
  }
@@ -4869,20 +4762,13 @@ class Dispatcher {
4869
4762
  }
4870
4763
  return list;
4871
4764
  }
4872
- id;
4873
- uuid;
4874
- name;
4875
- isDispose = false;
4876
- typeToList = new Dictionary();
4877
4765
  }
4878
4766
 
4879
4767
  class CallbackItem {
4880
- listener;
4881
- caller;
4882
- once;
4883
4768
  }
4884
4769
  class SampleCallbackList {
4885
4770
  constructor() {
4771
+ this._callbackItems = [];
4886
4772
  }
4887
4773
  dispose() {
4888
4774
  this._callbackItems = null;
@@ -4980,9 +4866,77 @@ class SampleCallbackList {
4980
4866
  on.listener.call(on.caller, this, params);
4981
4867
  }
4982
4868
  }
4983
- _callbackItems = [];
4984
4869
  }
4985
4870
 
4871
+ class AssetURI {
4872
+ /**
4873
+ *
4874
+ */
4875
+ constructor(name) {
4876
+ this.name = name;
4877
+ // 0-bundle+path 1-uuid 2-remote
4878
+ this.loadType = 0;
4879
+ let arr = name.split("://");
4880
+ if (arr.length == 2) {
4881
+ let head = arr[0];
4882
+ if (head == "uuid") {
4883
+ this.loadType = 1;
4884
+ this.uuid = arr[1];
4885
+ }
4886
+ else if (head == "http" || head == "https") {
4887
+ this.loadType = 2;
4888
+ }
4889
+ else {
4890
+ this.bundle = head;
4891
+ this.path = arr[1];
4892
+ }
4893
+ }
4894
+ else {
4895
+ this.bundle = "resources";
4896
+ this.path = name;
4897
+ }
4898
+ }
4899
+ }
4900
+ class XAssetManager {
4901
+ getAsset(uri) {
4902
+ let obj = new AssetURI(uri);
4903
+ switch (obj.loadType) {
4904
+ case 1:
4905
+ return assetManager.assets.get(obj.uuid);
4906
+ case 2:
4907
+ return assetManager.assets.get(obj.name);
4908
+ default:
4909
+ let bundle = assetManager.getBundle(obj.bundle);
4910
+ if (!bundle) {
4911
+ return null;
4912
+ }
4913
+ return bundle.get(obj.path);
4914
+ }
4915
+ }
4916
+ removeAsset(uri) {
4917
+ let obj = new AssetURI(uri);
4918
+ switch (obj.loadType) {
4919
+ case 1:
4920
+ return assetManager.assets.remove(obj.uuid);
4921
+ case 2:
4922
+ return assetManager.assets.remove(obj.name);
4923
+ default:
4924
+ let bundle = assetManager.getBundle(obj.bundle);
4925
+ if (!bundle) {
4926
+ return null;
4927
+ }
4928
+ return bundle.release(obj.path);
4929
+ }
4930
+ }
4931
+ getAssetByUUID(uuid) {
4932
+ return assetManager.assets.get(uuid);
4933
+ }
4934
+ getRoot() {
4935
+ return assetManager;
4936
+ }
4937
+ }
4938
+ let assetx = new XAssetManager();
4939
+
4986
4940
  /**
4987
4941
  * 自动生成等距图集的frame描述表。
4988
4942
  * 用于减少创建atlas文件的过程。
@@ -4996,7 +4950,7 @@ class SampleCallbackList {
4996
4950
  function create等距图集(atlasSize, gridSize, keyFormat = "%d.png", maxCount) {
4997
4951
  const cols = Math.floor(atlasSize.x / gridSize.x);
4998
4952
  const rows = Math.floor(atlasSize.y / gridSize.y);
4999
- const total = maxCount ?? cols * rows;
4953
+ const total = maxCount !== null && maxCount !== void 0 ? maxCount : cols * rows;
5000
4954
  const frames = {};
5001
4955
  let index = 0;
5002
4956
  for (let y = 0; y < rows; y++) {
@@ -5083,81 +5037,10 @@ function parseAtlas(plist, texture) {
5083
5037
  return atlas;
5084
5038
  }
5085
5039
 
5086
- class AssetURI {
5087
- name;
5088
- /**
5089
- *
5090
- */
5091
- constructor(name) {
5092
- this.name = name;
5093
- let arr = name.split("://");
5094
- if (arr.length == 2) {
5095
- let head = arr[0];
5096
- if (head == "uuid") {
5097
- this.loadType = 1;
5098
- this.uuid = arr[1];
5099
- }
5100
- else if (head == "http" || head == "https") {
5101
- this.loadType = 2;
5102
- }
5103
- else {
5104
- this.bundle = head;
5105
- this.path = arr[1];
5106
- }
5107
- }
5108
- else {
5109
- this.bundle = "resources";
5110
- this.path = name;
5111
- }
5112
- }
5113
- // 0-bundle+path 1-uuid 2-remote
5114
- loadType = 0;
5115
- uuid;
5116
- path;
5117
- bundle;
5118
- }
5119
- class XAssetManager {
5120
- getAsset(uri) {
5121
- let obj = new AssetURI(uri);
5122
- switch (obj.loadType) {
5123
- case 1:
5124
- return assetManager.assets.get(obj.uuid);
5125
- case 2:
5126
- return assetManager.assets.get(obj.name);
5127
- default:
5128
- let bundle = assetManager.getBundle(obj.bundle);
5129
- if (!bundle) {
5130
- return null;
5131
- }
5132
- return bundle.get(obj.path);
5133
- }
5134
- }
5135
- removeAsset(uri) {
5136
- let obj = new AssetURI(uri);
5137
- switch (obj.loadType) {
5138
- case 1:
5139
- return assetManager.assets.remove(obj.uuid);
5140
- case 2:
5141
- return assetManager.assets.remove(obj.name);
5142
- default:
5143
- let bundle = assetManager.getBundle(obj.bundle);
5144
- if (!bundle) {
5145
- return null;
5146
- }
5147
- return bundle.release(obj.path);
5148
- }
5149
- }
5150
- getAssetByUUID(uuid) {
5151
- return assetManager.assets.get(uuid);
5152
- }
5153
- getRoot() {
5154
- return assetManager;
5155
- }
5156
- }
5157
- let assetx = new XAssetManager();
5158
-
5159
5040
  class LoaderItem {
5160
- onComplete;
5041
+ constructor() {
5042
+ this.preload = false;
5043
+ }
5161
5044
  callHandler(err, asset) {
5162
5045
  if (this.onComplete) {
5163
5046
  this.onComplete(err, asset);
@@ -5171,17 +5054,18 @@ class LoaderItem {
5171
5054
  }
5172
5055
  return bundle;
5173
5056
  }
5174
- type;
5175
- bundle;
5176
- uri;
5177
- preload = false;
5178
- // 记录错误
5179
- error;
5180
5057
  }
5181
5058
  /**
5182
5059
  * uri格式:path, uuid://uuid, https://url
5183
5060
  */
5184
5061
  class AssetLoader extends Dispatcher {
5062
+ constructor() {
5063
+ super(...arguments);
5064
+ this._stop = false;
5065
+ this._loaded = 0;
5066
+ this._loaderList = new List();
5067
+ this._failList = new List();
5068
+ }
5185
5069
  /**
5186
5070
  *
5187
5071
  * @param bundleName
@@ -5627,12 +5511,6 @@ class AssetLoader extends Dispatcher {
5627
5511
  stop() {
5628
5512
  this._stop = true;
5629
5513
  }
5630
- _stop = false;
5631
- _onCompleteHandler;
5632
- _onProgressHandler;
5633
- _loaded = 0;
5634
- _loaderList = new List();
5635
- _failList = new List();
5636
5514
  }
5637
5515
 
5638
5516
  class ArrayUtil {
@@ -5848,7 +5726,6 @@ class CanvasUtil {
5848
5726
  director.getScene().off(Node.EventType.NODE_DESTROYED, this.onSceneDestroyed);
5849
5727
  this._canvas = undefined;
5850
5728
  }
5851
- _canvas;
5852
5729
  }
5853
5730
  let canvasutil = new CanvasUtil();
5854
5731
 
@@ -5914,7 +5791,9 @@ class EventUtil {
5914
5791
  const eventutil = new EventUtil();
5915
5792
 
5916
5793
  class FloatUtil {
5917
- epsilon = 0.00001;
5794
+ constructor() {
5795
+ this.epsilon = 0.00001;
5796
+ }
5918
5797
  neq(a, b, threshold = this.epsilon) {
5919
5798
  return !this.eq(a, b, threshold);
5920
5799
  }
@@ -6184,10 +6063,12 @@ class GeometryUtil {
6184
6063
  let geoutil = new GeometryUtil();
6185
6064
 
6186
6065
  class MathUtil {
6187
- version = 0;
6188
- TempVec2 = new Vec2();
6189
- TempVec3 = new Vec3();
6190
- TempVec4 = new Vec4();
6066
+ constructor() {
6067
+ this.version = 0;
6068
+ this.TempVec2 = new Vec2();
6069
+ this.TempVec3 = new Vec3();
6070
+ this.TempVec4 = new Vec4();
6071
+ }
6191
6072
  convertVec2to3(vec2, useTemp = false) {
6192
6073
  let vec3;
6193
6074
  if (useTemp) {
@@ -6988,12 +6869,6 @@ const hitTestVec3 = new Vec3();
6988
6869
  const uiutil = new UIUtil();
6989
6870
 
6990
6871
  class WidgetAlign {
6991
- node;
6992
- targetNode;
6993
- nodeWidget;
6994
- parentTransform;
6995
- targetTransform;
6996
- uipos;
6997
6872
  constructor(node, targetNode) {
6998
6873
  this.node = node;
6999
6874
  this.targetNode = targetNode;