@netless/appliance-plugin 1.1.34-beta.0 → 1.1.34-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.
@@ -1142,7 +1142,7 @@ function hg(r) {
1142
1142
  return cg(r, lg | ug);
1143
1143
  }
1144
1144
  var dg = hg;
1145
- const un = /* @__PURE__ */ Pn(dg), vr = "1.1.34-beta.0", gg = "@netless/appliance-plugin", ji = typeof OffscreenCanvas == "function" ? "worker" : "mainThread";
1145
+ const un = /* @__PURE__ */ Pn(dg), vr = "1.1.34-beta.2", gg = "@netless/appliance-plugin", ji = typeof OffscreenCanvas == "function" ? "worker" : "mainThread";
1146
1146
  if (typeof window < "u") {
1147
1147
  let r = window.__netlessUA || "";
1148
1148
  r += ` ${gg}@${vr}`, window.__netlessUA = r;
@@ -2285,11 +2285,11 @@ const Re = class Re extends RM {
2285
2285
  "onObjectsLimit",
2286
2286
  (p) => p(o, y)
2287
2287
  )), !y) {
2288
- this.control.logger.error(
2288
+ this.Logger.error(
2289
2289
  `[Appliance]: exceeds the limit of ${o} components, current: ${i}`
2290
2290
  ), (M = this.control.room) == null || M.disconnect().then(() => {
2291
2291
  var p, f, N, S, C;
2292
- (N = (f = (p = this.control.room) == null ? void 0 : p.callbacks) == null ? void 0 : f.listeners) != null && N.map.onKickedWithReason && (this.control.logger.info(
2292
+ (N = (f = (p = this.control.room) == null ? void 0 : p.callbacks) == null ? void 0 : f.listeners) != null && N.map.onKickedWithReason && (this.Logger.info(
2293
2293
  "[Appliance]: onKickedWithReason callback is called"
2294
2294
  ), (C = (S = this.control.room) == null ? void 0 : S.callbacks) == null || C.dispatch(
2295
2295
  "onKickedWithReason",
@@ -2317,6 +2317,9 @@ const Re = class Re extends RM {
2317
2317
  });
2318
2318
  this.syncInterval = i, this.namespace = Re.namespace, this.authSpace = Re.authSpace, this.globalUndoRedoStackSpace = Re.globalUndoRedoStackSpace, this.serviceStorage = this.getNamespaceData(), this.storage = se(this.serviceStorage), this.authStorage = this.getAuthSpaceData(), this.globalUndoRedoStackStorage = {}, this.getLimitNums();
2319
2319
  }
2320
+ get Logger() {
2321
+ return this.control.logger;
2322
+ }
2320
2323
  hasId(e, t, i) {
2321
2324
  const o = this.getLocalId(i) ? this.transformKey(i) : i;
2322
2325
  return !!(this.storage[e] && this.storage[e][t] && this.storage[e][t][o]);
@@ -2727,7 +2730,7 @@ const Re = class Re extends RM {
2727
2730
  }
2728
2731
  runSyncService(e) {
2729
2732
  if (!this.control.renderControl.isWritable) {
2730
- this.control.logger.error(
2733
+ this.Logger.error(
2731
2734
  "[Appliance]: The current state is not writable and synchronization cannot be synchronized"
2732
2735
  );
2733
2736
  return;
@@ -4966,6 +4969,9 @@ class ep extends _M {
4966
4969
  get isBezier() {
4967
4970
  return this.control.pluginOptions.extras.bezier.enable;
4968
4971
  }
4972
+ get Logger() {
4973
+ return this.control.logger;
4974
+ }
4969
4975
  destroy() {
4970
4976
  var e, t, i;
4971
4977
  (e = this.methodBuilder) == null || e.destroy(), this.unWritable(), this.taskBatchData.clear(), this.tasksqueue.clear(), this.tmpImageConfigMap.clear(), this.localPointsBatchData.clear(), this.isActive = !1, this.clearAllResolveMap.clear(), this.snapshotMap.clear(), this.boundingRectMap.clear(), (t = this.fullWorker) == null || t.terminate(), (i = this.subWorker) == null || i.terminate();
@@ -5033,16 +5039,14 @@ class ep extends _M {
5033
5039
  }
5034
5040
  async useBackgroundThread() {
5035
5041
  console.info("use background thread");
5036
- const { BackgroundThreadManagerImpl: e } = await import("./index-p4HeEgIq.mjs");
5042
+ const { BackgroundThreadManagerImpl: e } = await import("./index-Djm-u9a7.mjs");
5037
5043
  this.backgroundThreadManager = new e(this);
5038
5044
  }
5039
5045
  async useMainThread() {
5040
5046
  console.info("no OffscreenCanvas"), this.control.hasExtendFontFaces && await document.fonts.ready.then(() => {
5041
- this.control.logger.info(
5042
- "[Appliance]: set font faces in main thread success"
5043
- );
5047
+ this.Logger.info("[Appliance]: set font faces in main thread success");
5044
5048
  });
5045
- const { MainThreadManagerImpl: e } = await import("./index-D5lBaSz6.mjs");
5049
+ const { MainThreadManagerImpl: e } = await import("./index-DD4uosmt.mjs");
5046
5050
  this.mainThread = new e(this);
5047
5051
  }
5048
5052
  async on() {
@@ -5111,11 +5115,11 @@ class ep extends _M {
5111
5115
  }
5112
5116
  }), this.control.hasExtendFontFaces) {
5113
5117
  const e = this.control.extendFontFaces, t = [], i = [];
5114
- this.control.room && this.control.logger.info(
5118
+ this.control.room && this.Logger.info(
5115
5119
  `[Appliance]: load before font faces ${JSON.stringify(e)}`
5116
5120
  ), await new Promise(async (o) => {
5117
5121
  this.setFontFacesResolve.resolve = o, this.setFontFacesResolve.timer = setTimeout(() => {
5118
- this.setFontFacesResolve.resolve && (this.control.logger.warn("[Appliance]: set font faces timeout"), this.setFontFacesResolve.resolve(!1));
5122
+ this.setFontFacesResolve.resolve && (this.Logger.warn("[Appliance]: set font faces timeout"), this.setFontFacesResolve.resolve(!1));
5119
5123
  }, this.control.loadFontFacesTimeout);
5120
5124
  try {
5121
5125
  for (const s of e) {
@@ -5126,16 +5130,16 @@ class ep extends _M {
5126
5130
  s.fontFamily,
5127
5131
  s.src,
5128
5132
  a
5129
- ) || this.control.logger.warn(
5133
+ ) || this.Logger.warn(
5130
5134
  `[Appliance]: Failed to save font ${s.fontFamily} to IndexedDB, but continuing with font loading`
5131
5135
  ))), a && a.byteLength > 0 ? (i.push({
5132
5136
  fontFamily: s.fontFamily,
5133
5137
  buffer: a
5134
- }), t.push(a)) : this.control.logger.warn(
5138
+ }), t.push(a)) : this.Logger.warn(
5135
5139
  `[Appliance]: Font ${s.fontFamily} could not be loaded from any source`
5136
5140
  );
5137
5141
  }
5138
- this.control.logger.info("[Appliance]: load end font faces"), i.length ? this.fullWorker.postMessage(
5142
+ this.Logger.info("[Appliance]: load end font faces"), i.length ? this.fullWorker.postMessage(
5139
5143
  /* @__PURE__ */ new Set([
5140
5144
  {
5141
5145
  type: R.SetFontFace,
@@ -5145,16 +5149,10 @@ class ep extends _M {
5145
5149
  t
5146
5150
  ) : this.setFontFacesResolve.resolve(!0);
5147
5151
  } catch (s) {
5148
- this.setFontFacesResolve.timer && (clearTimeout(this.setFontFacesResolve.timer), this.setFontFacesResolve.timer = void 0), this.setFontFacesResolve.resolve && (this.setFontFacesResolve.resolve(!1), this.control.logger.error(
5149
- `[Appliance]: set font faces error: ${s}`
5150
- ));
5152
+ this.setFontFacesResolve.timer && (clearTimeout(this.setFontFacesResolve.timer), this.setFontFacesResolve.timer = void 0), this.setFontFacesResolve.resolve && (this.setFontFacesResolve.resolve(!1), this.Logger.error(`[Appliance]: set font faces error: ${s}`));
5151
5153
  }
5152
5154
  }).then((o) => {
5153
- this.setFontFacesResolve.resolve = void 0, this.setFontFacesResolve.timer = void 0, o ? this.control.logger.info(
5154
- "[Appliance]: set font faces in web worker success"
5155
- ) : this.control.logger.error(
5156
- "[Appliance]: set font faces in web worker error"
5157
- );
5155
+ this.setFontFacesResolve.resolve = void 0, this.setFontFacesResolve.timer = void 0, o ? this.Logger.info("[Appliance]: set font faces in web worker success") : this.Logger.error("[Appliance]: set font faces in web worker error");
5158
5156
  });
5159
5157
  }
5160
5158
  }
@@ -5183,7 +5181,7 @@ class ep extends _M {
5183
5181
  throw new Error("Invalid font data format: not a valid font file");
5184
5182
  return i;
5185
5183
  } catch (t) {
5186
- this.control.logger.error(
5184
+ this.Logger.error(
5187
5185
  `[Appliance]: Failed to load font from ${e}: ${t instanceof Error ? t.message : String(t)}`
5188
5186
  );
5189
5187
  return;
@@ -5286,7 +5284,7 @@ class ep extends _M {
5286
5284
  imageElement: Ee
5287
5285
  } = c;
5288
5286
  if (l === R.SetFontFace) {
5289
- ht && this.setFontFacesResolve.resolve && (ot && ot.length > 0 && this.control.logger.info(
5287
+ ht && this.setFontFacesResolve.resolve && (ot && ot.length > 0 && this.Logger.info(
5290
5288
  "[Appliance]: set font face has failed fonts: " + ot.join(", ")
5291
5289
  ), this.setFontFacesResolve.resolve(ht));
5292
5290
  return;
@@ -5421,9 +5419,9 @@ class ep extends _M {
5421
5419
  break;
5422
5420
  case R.ReportError:
5423
5421
  case R.ReportLog:
5424
- st && (l === R.ReportError ? this.control.logger.error(
5422
+ st && (l === R.ReportError ? this.Logger.error(
5425
5423
  `[Appliance]: [MasterControlForWorker] reportError ${st}`
5426
- ) : this.control.logger.info(
5424
+ ) : this.Logger.info(
5427
5425
  `[Appliance]: [MasterControlForWorker] reportLog ${st}`
5428
5426
  ));
5429
5427
  break;
@@ -5594,7 +5592,7 @@ class ep extends _M {
5594
5592
  }), this.willSelectorWorkId = u.toString();
5595
5593
  }
5596
5594
  } catch (h) {
5597
- this.control.logger.error(
5595
+ this.Logger.error(
5598
5596
  `[Appliance]: [MasterControlForWorker] onLocalEventEnd error: ${h instanceof Error ? h.message : String(h)}`
5599
5597
  );
5600
5598
  }