@netless/appliance-plugin 1.1.20 → 1.1.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.
@@ -1,16 +1,16 @@
1
1
  var ne = Object.defineProperty;
2
2
  var ce = (b, t, e) => t in b ? ne(b, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : b[t] = e;
3
3
  var d = (b, t, e) => ce(b, typeof t != "symbol" ? t + "" : t, e);
4
- import { D as B, E as g, a as k, r as U, b as I, g as H, t as P, c as p, S as te, d as L, e as $, i as le, C as x, f as A, h as he, j as X, k as T, M as F, V as pe, l as se, T as Y, m as q, n as Q, o as G, p as de, q as V, s as J, u as ue } from "./index-welmCq09.mjs";
4
+ import { D as B, E as g, a as k, r as U, b as I, g as H, t as P, c as p, S as te, d as L, e as $, i as le, C as x, f as A, h as he, j as pe, k as X, l as T, M as F, V as de, m as se, T as Y, n as q, o as Q, p as G, q as ue, s as V, u as J, v as fe } from "./index-CPGlDbvm.mjs";
5
5
  import { Scene as oe, Group as re } from "spritejs";
6
- import { cloneDeep as ie, xor as fe, isNumber as _, isEqual as ee } from "lodash";
6
+ import { cloneDeep as ie, xor as me, isNumber as _, isEqual as ee } from "lodash";
7
7
  import "clipper-lib";
8
8
  import "lineclip";
9
9
  import "white-web-sdk";
10
10
  import "react-dom";
11
11
  import "react";
12
12
  import "eventemitter2";
13
- class me {
13
+ class ke {
14
14
  constructor(t) {
15
15
  d(this, "vNodes");
16
16
  d(this, "thread");
@@ -222,7 +222,7 @@ class me {
222
222
  this.runAnimation();
223
223
  }
224
224
  }
225
- class ke {
225
+ class Se {
226
226
  constructor(t) {
227
227
  d(this, "vNodes");
228
228
  d(this, "thread");
@@ -278,7 +278,7 @@ class ke {
278
278
  worker: this
279
279
  })), a = /* @__PURE__ */ new Map();
280
280
  let h;
281
- n != null && n.selectIds && (h = fe(e.selectIds, n.selectIds), n.selectIds.forEach((u) => {
281
+ n != null && n.selectIds && (h = me(e.selectIds, n.selectIds), n.selectIds.forEach((u) => {
282
282
  const S = this.vNodes.get(u);
283
283
  if (S) {
284
284
  const { toolsType: y, op: v, opt: W } = S;
@@ -740,11 +740,12 @@ class ke {
740
740
  consumeCount: this.consumeCount,
741
741
  fullWorkerDrawCount: this.fullWorkerDrawCount
742
742
  }), this.combineTimerId || new Promise((l) => {
743
- this.combineDrawActiveId = n, this.combineDrawResolve = l, this.combineTimerId = requestIdleCallback(
743
+ this.combineDrawActiveId = n, this.combineDrawResolve = l, this.combineTimerId = he(
744
744
  () => {
745
745
  this.combineTimerId = void 0, this.combineDrawResolve && this.combineDrawResolve(!0);
746
746
  },
747
- { timeout: this.thread.master.maxCombineEraserTime }
747
+ this.thread.master.maxCombineEraserTime,
748
+ this.thread.master.control.hasPolyfillMethod("requestIdleCallback")
748
749
  );
749
750
  }).then((l) => {
750
751
  l && this.drawEraserCombine(n), this.combineDrawResolve = void 0;
@@ -794,7 +795,7 @@ class ke {
794
795
  sp: []
795
796
  };
796
797
  if (e != null && e.rect) {
797
- const h = he(e.rect);
798
+ const h = pe(e.rect);
798
799
  (o = a.render) == null || o.push(
799
800
  {
800
801
  rect: h,
@@ -919,7 +920,7 @@ class ke {
919
920
  );
920
921
  }
921
922
  }
922
- class Se {
923
+ class ye {
923
924
  constructor(t) {
924
925
  d(this, "vNodes");
925
926
  d(this, "thread");
@@ -1014,9 +1015,9 @@ class Se {
1014
1015
  await ((s = w.node) == null ? void 0 : s.consumeServiceAsync({
1015
1016
  isFullWork: !0,
1016
1017
  worker: this
1017
- })), this.selectorWorkShapes.forEach((D, C) => {
1018
+ })), this.selectorWorkShapes.forEach((C, D) => {
1018
1019
  var E;
1019
- (E = D.selectIds) != null && E.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
1020
+ (E = C.selectIds) != null && E.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
1020
1021
  }), this.workShapes.delete(N);
1021
1022
  break;
1022
1023
  }
@@ -1024,9 +1025,9 @@ class Se {
1024
1025
  w.node && (await ((o = w.node) == null ? void 0 : o.consumeServiceAsync({
1025
1026
  isFullWork: !0,
1026
1027
  replaceId: N
1027
- })), this.selectorWorkShapes.forEach((D, C) => {
1028
+ })), this.selectorWorkShapes.forEach((C, D) => {
1028
1029
  var E;
1029
- (E = D.selectIds) != null && E.includes(N) && (this.willRunEffectSelectorIds.add(C), this.runEffect());
1030
+ (E = C.selectIds) != null && E.includes(N) && (this.willRunEffectSelectorIds.add(D), this.runEffect());
1030
1031
  }), (r = w.node) == null || r.clearTmpPoints(), this.workShapes.delete(N));
1031
1032
  break;
1032
1033
  }
@@ -1037,19 +1038,19 @@ class Se {
1037
1038
  case k.Star:
1038
1039
  case k.Polygon:
1039
1040
  case k.SpeechBalloon: {
1040
- const D = !!w.ops;
1041
+ const C = !!w.ops;
1041
1042
  if ((i = w.animationWorkData) != null && i.length) {
1042
- const C = w.oldRect;
1043
+ const D = w.oldRect;
1043
1044
  (c = w.node) == null || c.consumeService({
1044
1045
  op: w.animationWorkData,
1045
- isFullWork: D
1046
- }), D && (this.selectorWorkShapes.forEach((E, M) => {
1046
+ isFullWork: C
1047
+ }), C && (this.selectorWorkShapes.forEach((E, M) => {
1047
1048
  var z;
1048
1049
  (z = E.selectIds) != null && z.includes(N) && (this.willRunEffectSelectorIds.add(M), this.runEffect());
1049
1050
  }), (n = w.node) == null || n.clearTmpPoints(), this.workShapes.delete(N)), w.isEnableCursor ? e.set(N, {
1050
- workState: C ? w.ops ? g.Done : g.Doing : g.Start,
1051
+ workState: D ? w.ops ? g.Done : g.Doing : g.Start,
1051
1052
  op: w.animationWorkData.slice(-3, -1)
1052
- }) : D && !w.useAnimation && ((a = w.updateNodeOpt) != null && a.useAnimation) && e.set(N, {
1053
+ }) : C && !w.useAnimation && ((a = w.updateNodeOpt) != null && a.useAnimation) && e.set(N, {
1053
1054
  workState: g.Done,
1054
1055
  op: w.animationWorkData.slice(-3, -1),
1055
1056
  uid: (h = w.updateNodeOpt) == null ? void 0 : h.uid
@@ -1064,21 +1065,21 @@ class Se {
1064
1065
  (v = w.node) == null || v.clearTmpPoints(), this.workShapes.delete(N);
1065
1066
  break;
1066
1067
  }
1067
- const D = 3, C = this.computNextAnimationIndex(
1068
+ const C = 3, D = this.computNextAnimationIndex(
1068
1069
  w,
1069
- D
1070
- ), E = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - D), M = (w.animationWorkData || []).slice(
1071
- E,
1072
1070
  C
1071
+ ), E = w.isDiff ? 0 : Math.max(0, (w.animationIndex || 0) - C), M = (w.animationWorkData || []).slice(
1072
+ E,
1073
+ D
1073
1074
  ), z = (O = (W = w.node) == null ? void 0 : W.getWorkId()) == null ? void 0 : O.toString();
1074
- if ((w.animationIndex || 0) < C || w.isDiff) {
1075
+ if ((w.animationIndex || 0) < D || w.isDiff) {
1075
1076
  if ((K = w.node) == null || K.consumeService({
1076
1077
  op: M,
1077
1078
  isFullWork: !1
1078
- }), w.animationIndex = C, w.isDiff && (w.isDiff = !1), M.length && w.isEnableCursor) {
1079
+ }), w.animationIndex = D, w.isDiff && (w.isDiff = !1), M.length && w.isEnableCursor) {
1079
1080
  const ae = M.slice(-3, -1);
1080
1081
  e.set(N, {
1081
- workState: E === 0 ? g.Start : C === ((Z = w.animationWorkData) == null ? void 0 : Z.length) ? g.Done : g.Doing,
1082
+ workState: E === 0 ? g.Start : D === ((Z = w.animationWorkData) == null ? void 0 : Z.length) ? g.Done : g.Doing,
1082
1083
  op: ae
1083
1084
  });
1084
1085
  }
@@ -1094,23 +1095,23 @@ class Se {
1094
1095
  break;
1095
1096
  }
1096
1097
  } else {
1097
- const D = !!w.ops;
1098
+ const C = !!w.ops;
1098
1099
  if ((l = w.node) == null || l.consumeService({
1099
1100
  op: w.animationWorkData || [],
1100
- isFullWork: D,
1101
+ isFullWork: C,
1101
1102
  replaceId: N
1102
- }), (f = w.node) == null || f.updataOptService(w.updateNodeOpt), D) {
1103
+ }), (f = w.node) == null || f.updataOptService(w.updateNodeOpt), C) {
1103
1104
  if (!w.isEnableCursor && ((m = w.updateNodeOpt) != null && m.useAnimation) && ((u = w.animationWorkData) != null && u.length)) {
1104
- const C = w.animationWorkData.slice(-3, -1);
1105
+ const D = w.animationWorkData.slice(-3, -1);
1105
1106
  e.set(N, {
1106
1107
  workState: g.Done,
1107
- op: C,
1108
+ op: D,
1108
1109
  uid: (S = w.updateNodeOpt) == null ? void 0 : S.uid
1109
1110
  });
1110
1111
  }
1111
- this.selectorWorkShapes.forEach((C, E) => {
1112
+ this.selectorWorkShapes.forEach((D, E) => {
1112
1113
  var M;
1113
- (M = C.selectIds) != null && M.includes(N) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
1114
+ (M = D.selectIds) != null && M.includes(N) && (this.willRunEffectSelectorIds.add(E), this.runEffect());
1114
1115
  }), (y = w.node) == null || y.clearTmpPoints(), this.workShapes.delete(N);
1115
1116
  }
1116
1117
  }
@@ -1119,10 +1120,10 @@ class Se {
1119
1120
  }
1120
1121
  if (t && this.runAnimation(), e.size) {
1121
1122
  const N = [];
1122
- e.forEach((w, D) => {
1123
+ e.forEach((w, C) => {
1123
1124
  N.push({
1124
1125
  type: p.Cursor,
1125
- uid: w.uid || D.split(te)[0],
1126
+ uid: w.uid || C.split(te)[0],
1126
1127
  op: w.op,
1127
1128
  workState: w.workState,
1128
1129
  viewId: this.thread.viewId
@@ -1246,7 +1247,7 @@ class R {
1246
1247
  return this.threadEngine = t, this.localWork = t.localWork, this.serviceWork = t.serviceWork, this;
1247
1248
  }
1248
1249
  }
1249
- class ye extends R {
1250
+ class we extends R {
1250
1251
  constructor() {
1251
1252
  super(...arguments);
1252
1253
  d(this, "emitEventType", T.CopyNode);
@@ -1262,7 +1263,7 @@ class ye extends R {
1262
1263
  s && await ((o = this.localWork) == null ? void 0 : o.consumeFull(e));
1263
1264
  }
1264
1265
  }
1265
- class we extends R {
1266
+ class ve extends R {
1266
1267
  constructor() {
1267
1268
  super(...arguments);
1268
1269
  d(this, "emitEventType", T.SetColorNode);
@@ -1315,7 +1316,7 @@ class we extends R {
1315
1316
  };
1316
1317
  }
1317
1318
  }
1318
- class ve extends R {
1319
+ class Ie extends R {
1319
1320
  constructor() {
1320
1321
  super(...arguments);
1321
1322
  d(this, "emitEventType", T.ZIndexNode);
@@ -1360,7 +1361,7 @@ class ve extends R {
1360
1361
  };
1361
1362
  }
1362
1363
  }
1363
- class Ie extends R {
1364
+ class ge extends R {
1364
1365
  constructor() {
1365
1366
  super(...arguments);
1366
1367
  d(this, "emitEventType", T.TranslateNode);
@@ -1437,7 +1438,7 @@ class Ie extends R {
1437
1438
  };
1438
1439
  }
1439
1440
  }
1440
- class ge extends R {
1441
+ class Te extends R {
1441
1442
  constructor() {
1442
1443
  super(...arguments);
1443
1444
  d(this, "emitEventType", T.DeleteNode);
@@ -1446,7 +1447,7 @@ class ge extends R {
1446
1447
  return !1;
1447
1448
  }
1448
1449
  }
1449
- class Te extends R {
1450
+ class We extends R {
1450
1451
  constructor() {
1451
1452
  super(...arguments);
1452
1453
  d(this, "emitEventType", T.ScaleNode);
@@ -1516,7 +1517,7 @@ class Te extends R {
1516
1517
  };
1517
1518
  }
1518
1519
  }
1519
- class We extends R {
1520
+ class Le extends R {
1520
1521
  constructor() {
1521
1522
  super(...arguments);
1522
1523
  d(this, "emitEventType", T.RotateNode);
@@ -1577,7 +1578,7 @@ class We extends R {
1577
1578
  };
1578
1579
  }
1579
1580
  }
1580
- class Le extends R {
1581
+ class be extends R {
1581
1582
  constructor() {
1582
1583
  super(...arguments);
1583
1584
  d(this, "emitEventType", T.SetFontStyle);
@@ -1639,7 +1640,7 @@ class Le extends R {
1639
1640
  };
1640
1641
  }
1641
1642
  }
1642
- class be extends R {
1643
+ class Ne extends R {
1643
1644
  constructor() {
1644
1645
  super(...arguments);
1645
1646
  d(this, "emitEventType", T.SetPoint);
@@ -1697,7 +1698,7 @@ class be extends R {
1697
1698
  };
1698
1699
  }
1699
1700
  }
1700
- class Ne extends R {
1701
+ class Ce extends R {
1701
1702
  constructor() {
1702
1703
  super(...arguments);
1703
1704
  d(this, "emitEventType", T.SetLock);
@@ -1799,7 +1800,7 @@ class De extends R {
1799
1800
  };
1800
1801
  }
1801
1802
  }
1802
- class Ce {
1803
+ class Oe {
1803
1804
  constructor(t) {
1804
1805
  d(this, "builders", /* @__PURE__ */ new Map());
1805
1806
  this.builders = new Map(t.map((e) => [e, this.build(e)]));
@@ -1807,25 +1808,25 @@ class Ce {
1807
1808
  build(t) {
1808
1809
  switch (t) {
1809
1810
  case T.TranslateNode:
1810
- return new Ie();
1811
+ return new ge();
1811
1812
  case T.ZIndexNode:
1812
- return new ve();
1813
+ return new Ie();
1813
1814
  case T.CopyNode:
1814
- return new ye();
1815
- case T.SetColorNode:
1816
1815
  return new we();
1816
+ case T.SetColorNode:
1817
+ return new ve();
1817
1818
  case T.DeleteNode:
1818
- return new ge();
1819
- case T.ScaleNode:
1820
1819
  return new Te();
1821
- case T.RotateNode:
1820
+ case T.ScaleNode:
1822
1821
  return new We();
1823
- case T.SetFontStyle:
1822
+ case T.RotateNode:
1824
1823
  return new Le();
1825
- case T.SetPoint:
1824
+ case T.SetFontStyle:
1826
1825
  return new be();
1827
- case T.SetLock:
1826
+ case T.SetPoint:
1828
1827
  return new Ne();
1828
+ case T.SetLock:
1829
+ return new Ce();
1829
1830
  case T.SetShapeOpt:
1830
1831
  return new De();
1831
1832
  }
@@ -1842,7 +1843,7 @@ class Ce {
1842
1843
  return !1;
1843
1844
  }
1844
1845
  }
1845
- class Oe {
1846
+ class Ee {
1846
1847
  constructor(t, e) {
1847
1848
  d(this, "viewId");
1848
1849
  d(this, "fullLayer");
@@ -1886,12 +1887,12 @@ class Oe {
1886
1887
  ...e.layerOpt,
1887
1888
  bufferSize: (this.viewId === F, o),
1888
1889
  contextType: "2d"
1889
- }), this.vNodes = new pe(t, this.scene);
1890
+ }), this.vNodes = new de(t, this.scene);
1890
1891
  const r = {
1891
1892
  thread: this,
1892
1893
  vNodes: this.vNodes
1893
1894
  };
1894
- this.localWork = new ke(r), this.serviceWork = new Se(r), this.topWork = new me(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Ce([
1895
+ this.localWork = new Se(r), this.serviceWork = new ye(r), this.topWork = new ke(r), this.vNodes.init(this.fullLayer), this.methodBuilder = new Oe([
1895
1896
  T.CopyNode,
1896
1897
  T.SetColorNode,
1897
1898
  T.DeleteNode,
@@ -2345,7 +2346,7 @@ class Oe {
2345
2346
  this.clearCacheImages(), this.clearImageResolveMap(), this.vNodes.clear(), this.fullLayer.remove(), A(this.fullLayer, this.fullLayer.parent), this.topLayer.remove(), A(this.topLayer, this.topLayer.parent), this.localLayer.remove(), A(this.localLayer, this.localLayer.parent), this.serviceLayer.remove(), A(this.serviceLayer, this.serviceLayer.parent), this.scene.remove(), this.localWork.destroy(), this.serviceWork.destroy(), this.topWork.destroy();
2346
2347
  }
2347
2348
  }
2348
- class Ee {
2349
+ class Re {
2349
2350
  constructor(t, e) {
2350
2351
  d(this, "viewId");
2351
2352
  d(this, "fullLayer");
@@ -2621,7 +2622,7 @@ class Ee {
2621
2622
  for (const o of s.sp) {
2622
2623
  let r = !1;
2623
2624
  for (const i of t)
2624
- if (de(o, i)) {
2625
+ if (ue(o, i)) {
2625
2626
  r = !0;
2626
2627
  break;
2627
2628
  }
@@ -2671,7 +2672,7 @@ class Ee {
2671
2672
  this.clearCacheImages(), this.clearImageResolveMap(), this.fullLayer.remove(), A(this.fullLayer, this.fullLayer.parent), this.scene.remove();
2672
2673
  }
2673
2674
  }
2674
- class He {
2675
+ class $e {
2675
2676
  constructor(t) {
2676
2677
  d(this, "mainThreadMap", /* @__PURE__ */ new Map());
2677
2678
  d(this, "snapshotThread");
@@ -2686,10 +2687,10 @@ class He {
2686
2687
  this.mainThreadMap.clear();
2687
2688
  }
2688
2689
  createMainThread(t, e) {
2689
- return new Oe(t, e);
2690
+ return new Ee(t, e);
2690
2691
  }
2691
2692
  createSnapshotThread(t, e) {
2692
- return new Ee(t, e);
2693
+ return new Re(t, e);
2693
2694
  }
2694
2695
  async consume(t) {
2695
2696
  var e, s, o, r;
@@ -2761,7 +2762,7 @@ class He {
2761
2762
  }
2762
2763
  continue;
2763
2764
  }
2764
- if (n === ue) {
2765
+ if (n === fe) {
2765
2766
  for (const y of this.mainThreadMap.values())
2766
2767
  y.on(i), c === p.Destroy && this.mainThreadMap.delete(n);
2767
2768
  continue;
@@ -2772,5 +2773,5 @@ class He {
2772
2773
  }
2773
2774
  }
2774
2775
  export {
2775
- He as MainThreadManagerImpl
2776
+ $e as MainThreadManagerImpl
2776
2777
  };