@lvce-editor/renderer-process 30.70.1 → 30.70.3

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.
@@ -1780,7 +1780,7 @@ const hydrate$4 = async () => {
1780
1780
  };
1781
1781
 
1782
1782
  // TODO needed?
1783
- const dispose$m = async () => {
1783
+ const dispose$n = async () => {
1784
1784
  const rpc = state$l.rpc;
1785
1785
  state$l.rpc = undefined;
1786
1786
  await rpc?.dispose();
@@ -1962,7 +1962,7 @@ const initializeLayout = async href => {
1962
1962
  }
1963
1963
  return true;
1964
1964
  };
1965
- const dispose$l = async () => {
1965
+ const dispose$m = async () => {
1966
1966
  state$k.stopObserving?.();
1967
1967
  state$k.stopObserving = undefined;
1968
1968
  const client = state$k.client;
@@ -4157,7 +4157,7 @@ const handleMessagePort$1 = async port => {
4157
4157
  }
4158
4158
  await rpc.invokeAndTransfer('DragAndDrop.handleMessagePort', port);
4159
4159
  };
4160
- const dispose$k = async () => {
4160
+ const dispose$l = async () => {
4161
4161
  const rpc = state$g.rpc;
4162
4162
  state$g.rpc = undefined;
4163
4163
  await rpc?.dispose();
@@ -4656,7 +4656,7 @@ const create$u = async ({
4656
4656
  // @ts-ignore
4657
4657
  return module.create(options);
4658
4658
  };
4659
- const dispose$j = id => {
4659
+ const dispose$k = id => {
4660
4660
  const worker = remove$3(id);
4661
4661
  if (worker) {
4662
4662
  remove$5(worker);
@@ -4710,6 +4710,7 @@ const launchSyntaxHighlightingWorker = async port => {
4710
4710
  await create$u({
4711
4711
  method: ModuleWorkerWithMessagePort,
4712
4712
  name: 'Syntax Highlighting Worker',
4713
+ parentName: 'Editor Worker',
4713
4714
  port,
4714
4715
  url: syntaxHighlightingWorkerUrl
4715
4716
  });
@@ -4774,7 +4775,7 @@ const applyPatch$1 = (element, patches, eventMap = {}, id = 0) => {
4774
4775
  }
4775
4776
  applyPatch$2(element, patches, eventMap, id);
4776
4777
  };
4777
- const dispose$i = root => {
4778
+ const dispose$j = root => {
4778
4779
  state$e.renderer?.dispose(root);
4779
4780
  };
4780
4781
 
@@ -4945,6 +4946,9 @@ const focusCommands = new Set(['Viewlet.focus', 'Viewlet.focusElementByName', 'V
4945
4946
  const take = (uid, transactionId, focusVersion = 0) => {
4946
4947
  const batch = pendingBatches.get(transactionId);
4947
4948
  if (!batch) {
4949
+ // An allocated transaction may have been discarded with its view. Late or
4950
+ // duplicate commits are harmless and must not affect a recreated root.
4951
+ if (transactionId > 0 && transactionId < state$a.nextTransactionId) return [];
4948
4952
  throw new Error(`pending viewlet command transaction not found: ${transactionId}`);
4949
4953
  }
4950
4954
  if (batch.uid !== uid) {
@@ -4968,6 +4972,11 @@ const take = (uid, transactionId, focusVersion = 0) => {
4968
4972
  }
4969
4973
  return commands;
4970
4974
  };
4975
+ const dispose$i = uid => {
4976
+ for (const [transactionId, batch] of pendingBatches) {
4977
+ if (batch.uid === uid) pendingBatches.delete(transactionId);
4978
+ }
4979
+ };
4971
4980
 
4972
4981
  const rememberFocus = rememberFocus$1;
4973
4982
 
@@ -9395,7 +9404,7 @@ const create$4 = (id, uid = id) => {
9395
9404
  if (!module) {
9396
9405
  throw new Error(`module not found: ${id}`);
9397
9406
  }
9398
- const existing = get$b(id);
9407
+ const existing = get$b(uid);
9399
9408
  if (existing?.state.$Viewlet.isConnected) {
9400
9409
  existing.state.$Viewlet.remove();
9401
9410
  }
@@ -9425,6 +9434,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcI
9425
9434
  $Viewlet: document.createElement('div')
9426
9435
  };
9427
9436
  set$a(instanceState.$Viewlet, uid);
9437
+ if (existing) dispose$i(uid);
9428
9438
  registerView(uid, directEventRpcId);
9429
9439
  set$c(uid, {
9430
9440
  factory: module,
@@ -9919,6 +9929,7 @@ const dispose$4 = id => {
9919
9929
  number(id);
9920
9930
  restoreComponentDom(id);
9921
9931
  unregisterView(id);
9932
+ dispose$i(id);
9922
9933
  const instance = get$b(id);
9923
9934
  if (!instance) {
9924
9935
  warn(`viewlet instance ${id} not found and cannot be disposed`);
@@ -9927,7 +9938,7 @@ const dispose$4 = id => {
9927
9938
  if (instance.factory.dispose) {
9928
9939
  instance.factory.dispose(instance.state);
9929
9940
  }
9930
- dispose$i(instance.state.$Viewlet);
9941
+ dispose$j(instance.state.$Viewlet);
9931
9942
  if (instance.state.$Viewlet?.isConnected) {
9932
9943
  instance.state.$Viewlet.remove();
9933
9944
  }
@@ -10262,9 +10273,9 @@ const restart = async () => {
10262
10273
  const snapshot = await invoke$1('Reload.prepareHotReload');
10263
10274
  set$9(snapshot);
10264
10275
  await invoke$1('Reload.retire');
10265
- await dispose$l();
10266
10276
  await dispose$m();
10267
- await dispose$k();
10277
+ await dispose$n();
10278
+ await dispose$l();
10268
10279
  terminateAll();
10269
10280
  clear$2();
10270
10281
  clear$4();
@@ -12301,7 +12312,7 @@ const commandMap = {
12301
12312
  'HotReload.request': request,
12302
12313
  'InitData.getInitData': getInitData,
12303
12314
  'IpcParent.create': create$u,
12304
- 'IpcParent.dispose': dispose$j,
12315
+ 'IpcParent.dispose': dispose$k,
12305
12316
  'KeyBindings.setIdentifiers': setIdentifiers,
12306
12317
  'Layout.getBounds': getBounds,
12307
12318
  'Location.getHref': getHref,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.70.1",
3
+ "version": "30.70.3",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"