@netless/appliance-plugin 1.1.43-beta.1 → 1.1.43-beta.2

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,7 +1,7 @@
1
1
  var ye = Object.defineProperty;
2
2
  var we = (M, e, t) => e in M ? ye(M, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : M[e] = t;
3
3
  var u = (M, e, t) => we(M, typeof e != "symbol" ? e + "" : e, t);
4
- import { D as K, e as b, c as m, r as $, b as R, g as Z, t as V, a as h, f as de, M as ve, h as D, i as j, j as ke, C as H, k as z, l as Se, m as te, n as Ie, o as se, p as ge, q as Te, s as re, u as ie, v as Y, w as _, E as N, x as ee, y as Q, z as We, A as Re, B as Ee, F as be, G as Le, H as pe, I as ue, T as oe, J as ae, K as Ce, L as Ne, N as fe, P as me, Q as ne, R as Oe, S as ce, U as q, W as Be, V as he, X as De } from "./index-B44o9ggV.mjs";
4
+ import { D as K, e as b, c as m, r as $, b as R, g as Z, t as V, a as h, f as de, M as ve, h as D, i as j, j as ke, C as H, k as z, l as Se, m as te, n as Ie, o as se, p as ge, q as Te, s as re, u as ie, v as Y, w as _, E as N, x as ee, y as Q, z as We, A as Re, B as Ee, F as be, G as Le, H as pe, I as ue, T as oe, J as ae, K as Ce, L as Ne, N as fe, P as me, Q as ne, R as Be, S as ce, U as q, W as Oe, V as he, X as De } from "./index-DkMJ7xR-.mjs";
5
5
  import { cloneDeep as J, xor as Me, isNumber as G, isEqual as le } from "lodash";
6
6
  import "clipper-lib";
7
7
  import "lineclip";
@@ -700,6 +700,18 @@ class Ae {
700
700
  const t = this.workShapes.get(e);
701
701
  (t == null ? void 0 : t.toolsType) === m.BitMapEraser && (t.clearTmpPoints(), this.workShapes.delete(e), this.combineDrawActiveId === e && (this.combineDrawActiveId = void 0), this.drawWorkActiveId === e && (this.drawWorkActiveId = void 0), this.bitmapEraserRenderQueue = Promise.resolve());
702
702
  }
703
+ publishBitmapEraserBeforeImages(e, t) {
704
+ t.size && this.thread.post({
705
+ sp: [
706
+ {
707
+ type: h.None,
708
+ viewId: this.thread.viewId,
709
+ eraseTxnId: e,
710
+ eraseTxnBeforeImages: new Map(t)
711
+ }
712
+ ]
713
+ });
714
+ }
703
715
  async drawBitMapEraserFull(e, t, s, r) {
704
716
  const {
705
717
  willUpdateNodes: i,
@@ -1272,9 +1284,9 @@ class Fe {
1272
1284
  (r = k.node) == null || r.consumeService({
1273
1285
  isFullWork: !0,
1274
1286
  replaceId: E
1275
- }), this.selectorWorkShapes.forEach((O, B) => {
1287
+ }), this.selectorWorkShapes.forEach((B, O) => {
1276
1288
  var P;
1277
- (P = O.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(B), this.runEffect());
1289
+ (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1278
1290
  }), this.workShapes.delete(E);
1279
1291
  break;
1280
1292
  }
@@ -1282,9 +1294,9 @@ class Fe {
1282
1294
  await ((i = k.node) == null ? void 0 : i.consumeServiceAsync({
1283
1295
  isFullWork: !0,
1284
1296
  worker: this
1285
- })), this.selectorWorkShapes.forEach((O, B) => {
1297
+ })), this.selectorWorkShapes.forEach((B, O) => {
1286
1298
  var P;
1287
- (P = O.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(B), this.runEffect());
1299
+ (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1288
1300
  }), this.workShapes.delete(E);
1289
1301
  break;
1290
1302
  }
@@ -1293,9 +1305,9 @@ class Fe {
1293
1305
  isFullWork: !0,
1294
1306
  replaceId: E,
1295
1307
  boxRect: this.thread.getSceneRect()
1296
- })), this.selectorWorkShapes.forEach((O, B) => {
1308
+ })), this.selectorWorkShapes.forEach((B, O) => {
1297
1309
  var P;
1298
- (P = O.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(B), this.runEffect());
1310
+ (P = B.selectIds) != null && P.includes(E) && (this.willRunEffectSelectorIds.add(O), this.runEffect());
1299
1311
  }), k.refreshTextRender && k.requestId && s.push({
1300
1312
  type: h.RefreshTextRender,
1301
1313
  requestId: k.requestId,
@@ -1311,20 +1323,20 @@ class Fe {
1311
1323
  case m.Star:
1312
1324
  case m.Polygon:
1313
1325
  case m.SpeechBalloon: {
1314
- const O = !!k.ops;
1326
+ const B = !!k.ops;
1315
1327
  if ((n = k.animationWorkData) != null && n.length) {
1316
- const B = k.oldRect;
1328
+ const O = k.oldRect;
1317
1329
  (c = k.node) == null || c.consumeService({
1318
1330
  op: k.animationWorkData,
1319
- isFullWork: O
1320
- }), O && (this.selectorWorkShapes.forEach((P, F) => {
1331
+ isFullWork: B
1332
+ }), B && (this.selectorWorkShapes.forEach((P, F) => {
1321
1333
  var U;
1322
1334
  (U = P.selectIds) != null && U.includes(E) && (this.willRunEffectSelectorIds.add(F), this.runEffect());
1323
1335
  }), (d = k.node) == null || d.clearTmpPoints(), this.workShapes.delete(E)), k.isEnableCursor ? t.set(E, {
1324
1336
  cursorTool: _(k.toolsType),
1325
- workState: B ? k.ops ? b.Done : b.Doing : b.Start,
1337
+ workState: O ? k.ops ? b.Done : b.Doing : b.Start,
1326
1338
  op: k.animationWorkData.slice(-3, -1)
1327
- }) : O && !k.useAnimation && ((l = k.updateNodeOpt) != null && l.useAnimation) && t.set(E, {
1339
+ }) : B && !k.useAnimation && ((l = k.updateNodeOpt) != null && l.useAnimation) && t.set(E, {
1328
1340
  cursorTool: _(k.toolsType),
1329
1341
  workState: b.Done,
1330
1342
  op: k.animationWorkData.slice(-3, -1),
@@ -1340,22 +1352,22 @@ class Fe {
1340
1352
  (y = k.node) == null || y.clearTmpPoints(), this.workShapes.delete(E);
1341
1353
  break;
1342
1354
  }
1343
- const O = 3, B = this.computNextAnimationIndex(
1355
+ const B = 3, O = this.computNextAnimationIndex(
1344
1356
  k,
1345
- O
1346
- ), P = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - O), F = (k.animationWorkData || []).slice(
1347
- P,
1348
1357
  B
1358
+ ), P = k.isDiff ? 0 : Math.max(0, (k.animationIndex || 0) - B), F = (k.animationWorkData || []).slice(
1359
+ P,
1360
+ O
1349
1361
  ), U = (T = (v = k.node) == null ? void 0 : v.getWorkId()) == null ? void 0 : T.toString();
1350
- if ((k.animationIndex || 0) < B || k.isDiff) {
1362
+ if ((k.animationIndex || 0) < O || k.isDiff) {
1351
1363
  if ((C = k.node) == null || C.consumeService({
1352
1364
  op: F,
1353
1365
  isFullWork: !1
1354
- }), k.animationIndex = B, k.isDiff && (k.isDiff = !1), F.length && k.isEnableCursor) {
1366
+ }), k.animationIndex = O, k.isDiff && (k.isDiff = !1), F.length && k.isEnableCursor) {
1355
1367
  const X = F.slice(-3, -1);
1356
1368
  t.set(E, {
1357
1369
  cursorTool: _(k.toolsType),
1358
- workState: P === 0 ? b.Start : B === ((L = k.animationWorkData) == null ? void 0 : L.length) ? b.Done : b.Doing,
1370
+ workState: P === 0 ? b.Start : O === ((L = k.animationWorkData) == null ? void 0 : L.length) ? b.Done : b.Doing,
1359
1371
  op: X
1360
1372
  });
1361
1373
  }
@@ -1372,24 +1384,24 @@ class Fe {
1372
1384
  break;
1373
1385
  }
1374
1386
  } else {
1375
- const O = !!k.ops;
1387
+ const B = !!k.ops;
1376
1388
  if ((f = k.node) == null || f.consumeService({
1377
1389
  op: k.animationWorkData || [],
1378
- isFullWork: O,
1390
+ isFullWork: B,
1379
1391
  replaceId: E
1380
- }), (w = k.node) == null || w.updataOptService(k.updateNodeOpt), O) {
1392
+ }), (w = k.node) == null || w.updataOptService(k.updateNodeOpt), B) {
1381
1393
  if (!k.isEnableCursor && ((S = k.updateNodeOpt) != null && S.useAnimation) && ((I = k.animationWorkData) != null && I.length)) {
1382
- const B = k.animationWorkData.slice(-3, -1);
1394
+ const O = k.animationWorkData.slice(-3, -1);
1383
1395
  t.set(E, {
1384
1396
  cursorTool: _(k.toolsType),
1385
1397
  workState: b.Done,
1386
- op: B,
1398
+ op: O,
1387
1399
  uid: (W = k.updateNodeOpt) == null ? void 0 : W.uid
1388
1400
  });
1389
1401
  }
1390
- this.selectorWorkShapes.forEach((B, P) => {
1402
+ this.selectorWorkShapes.forEach((O, P) => {
1391
1403
  var F;
1392
- (F = B.selectIds) != null && F.includes(E) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1404
+ (F = O.selectIds) != null && F.includes(E) && (this.willRunEffectSelectorIds.add(P), this.runEffect());
1393
1405
  }), (g = k.node) == null || g.clearTmpPoints(), this.workShapes.delete(E);
1394
1406
  }
1395
1407
  }
@@ -2979,9 +2991,9 @@ class je {
2979
2991
  for (const [T, C] of f.entries()) {
2980
2992
  const L = this.vNodes.get(T);
2981
2993
  if (L) {
2982
- const A = C, E = L.rect, k = this.getSceneRect(), O = ae(A, k), B = ae(E, k);
2994
+ const A = C, E = L.rect, k = this.getSceneRect(), B = ae(A, k), O = ae(E, k);
2983
2995
  let P = c;
2984
- (O !== B || A.w !== E.w || A.h !== E.h || B === Ce.intersect) && (P = !0);
2996
+ (B !== O || A.w !== E.w || A.h !== E.h || O === Ce.intersect) && (P = !0);
2985
2997
  const { toolsType: F, opt: U } = L, X = U.eraserlines && U.eraserlines.length > 0 || !!U.eraserFaces;
2986
2998
  (P || p && X) && (F === m.Text || X) && this.debounceUpdateCache.add(T);
2987
2999
  }
@@ -3009,17 +3021,17 @@ class je {
3009
3021
  if (!v()) return;
3010
3022
  const C = [];
3011
3023
  for (const E of this.debounceUpdateCache.values()) {
3012
- const k = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(E)[0], O = this.vNodes.get(E);
3013
- if (O) {
3014
- const { toolsType: B, opt: P } = O;
3015
- if (k || B !== m.Text) {
3024
+ const k = (T = this.fullLayer) == null ? void 0 : T.getElementsByName(E)[0], B = this.vNodes.get(E);
3025
+ if (B) {
3026
+ const { toolsType: O, opt: P } = B;
3027
+ if (k || O !== m.Text) {
3016
3028
  const F = this.localWork.setFullWork({
3017
- toolsType: B,
3029
+ toolsType: O,
3018
3030
  opt: P,
3019
3031
  workId: E
3020
3032
  });
3021
3033
  if (F) {
3022
- if (B === m.Text)
3034
+ if (O === m.Text)
3023
3035
  C.push(
3024
3036
  F.consumeServiceAsync({
3025
3037
  isFullWork: !0,
@@ -3030,7 +3042,7 @@ class je {
3030
3042
  );
3031
3043
  else if (P.eraserlines && P.eraserlines.length > 0 || P.eraserFaces) {
3032
3044
  const U = F.consumeService({
3033
- op: O.op,
3045
+ op: B.op,
3034
3046
  isFullWork: !0,
3035
3047
  replaceId: E,
3036
3048
  workState: b.Done
@@ -3604,7 +3616,7 @@ class Je {
3604
3616
  for (const r of s.sp) {
3605
3617
  let i = !1;
3606
3618
  for (const o of e)
3607
- if (Oe(r, o)) {
3619
+ if (Be(r, o)) {
3608
3620
  i = !0;
3609
3621
  break;
3610
3622
  }
@@ -3757,7 +3769,7 @@ class lt {
3757
3769
  consumeWorkId: p
3758
3770
  } = e;
3759
3771
  if (c && q(i)) {
3760
- const f = Be(
3772
+ const f = Oe(
3761
3773
  o,
3762
3774
  a,
3763
3775
  "mainThread"
@@ -3912,7 +3924,7 @@ class lt {
3912
3924
  if (o === h.Init) {
3913
3925
  const g = i.viewGeneration ?? (this.viewGenerationById.get(a) || 0) + 1;
3914
3926
  await this.enqueueViewTask(a, async () => {
3915
- var E, k, O;
3927
+ var E, k, B;
3916
3928
  const y = this.viewGenerationById.get(a);
3917
3929
  if (y !== void 0 && g < y)
3918
3930
  return;
@@ -3933,11 +3945,11 @@ class lt {
3933
3945
  canvasOpt: p,
3934
3946
  viewOwner: v,
3935
3947
  viewGeneration: g,
3936
- mainThreadRenderMode: ((O = (k = this.master.control) == null ? void 0 : k.renderingCompatibilityDecision) == null ? void 0 : O.mainThreadRenderMode) ?? "normal",
3937
- post: (B) => this.post({
3938
- ...B,
3939
- viewId: B.viewId || a,
3940
- viewGeneration: B.viewGeneration ?? g,
3948
+ mainThreadRenderMode: ((B = (k = this.master.control) == null ? void 0 : k.renderingCompatibilityDecision) == null ? void 0 : B.mainThreadRenderMode) ?? "normal",
3949
+ post: (O) => this.post({
3950
+ ...O,
3951
+ viewId: O.viewId || a,
3952
+ viewGeneration: O.viewGeneration ?? g,
3941
3953
  viewOwner: v
3942
3954
  })
3943
3955
  });
@@ -3984,9 +3996,9 @@ class lt {
3984
3996
  surface: L
3985
3997
  }), k.on(i).then(() => {
3986
3998
  this.disposeSnapshotThread(T, k);
3987
- }).catch((O) => {
3999
+ }).catch((B) => {
3988
4000
  this.master.Logger.error(
3989
- `[Appliance]: snapshot render failed; viewId=${a}; error=${O instanceof Error ? O.message : String(O)}`
4001
+ `[Appliance]: snapshot render failed; viewId=${a}; error=${B instanceof Error ? B.message : String(B)}`
3990
4002
  ), this.disposeSnapshotThread(T, k);
3991
4003
  });
3992
4004
  continue;