@lvce-editor/renderer-process 6.13.0 → 7.0.1

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.
@@ -165,6 +165,7 @@ const getModuleId = commandId => {
165
165
  case 'TestFrameWork.showOverlay':
166
166
  return TestFrameWork;
167
167
  case 'Transferrable.transfer':
168
+ case 'Transferrable.transferToWebView':
168
169
  return Transferrable;
169
170
  case 'Viewlet.appendViewlet':
170
171
  case 'Viewlet.dispose':
@@ -538,10 +539,10 @@ const number$1 = value => {
538
539
  const state$1$1 = {
539
540
  callbacks: Object.create(null)
540
541
  };
541
- const set$5 = (id, fn) => {
542
+ const set$6 = (id, fn) => {
542
543
  state$1$1.callbacks[id] = fn;
543
544
  };
544
- const get$6 = id => {
545
+ const get$7 = id => {
545
546
  return state$1$1.callbacks[id];
546
547
  };
547
548
  const remove$2 = id => {
@@ -575,7 +576,7 @@ const registerPromise = () => {
575
576
  resolve,
576
577
  promise
577
578
  } = withResolvers$2();
578
- set$5(id, resolve);
579
+ set$6(id, resolve);
579
580
  return {
580
581
  id,
581
582
  promise
@@ -583,7 +584,7 @@ const registerPromise = () => {
583
584
  };
584
585
  const resolve = (id, args) => {
585
586
  number$1(id);
586
- const fn = get$6(id);
587
+ const fn = get$7(id);
587
588
  if (!fn) {
588
589
  console.log(args);
589
590
  warn$1(`callback ${id} may already be disposed`);
@@ -623,7 +624,6 @@ const getErrorConstructor = (message, type) => {
623
624
  if (type) {
624
625
  switch (type) {
625
626
  case DomException:
626
- // @ts-ignore
627
627
  return DOMException;
628
628
  case TypeError$1:
629
629
  return TypeError;
@@ -648,7 +648,6 @@ const getErrorConstructor = (message, type) => {
648
648
  };
649
649
  const constructError = (message, type, name) => {
650
650
  const ErrorConstructor = getErrorConstructor(message, type);
651
- // @ts-ignore
652
651
  if (ErrorConstructor === DOMException && name) {
653
652
  return new ErrorConstructor(message, name);
654
653
  }
@@ -664,6 +663,13 @@ const constructError = (message, type, name) => {
664
663
  const getNewLineIndex$2 = (string, startIndex = undefined) => {
665
664
  return string.indexOf(NewLine$3, startIndex);
666
665
  };
666
+ const getParentStack = error => {
667
+ let parentStack = error.stack || error.data || error.message || '';
668
+ if (parentStack.startsWith(' at')) {
669
+ parentStack = error.message + NewLine$3 + parentStack;
670
+ }
671
+ return parentStack;
672
+ };
667
673
  const joinLines$2 = lines => {
668
674
  return lines.join(NewLine$3);
669
675
  };
@@ -672,18 +678,11 @@ const Custom = -32001;
672
678
  const splitLines$2 = lines => {
673
679
  return lines.split(NewLine$3);
674
680
  };
675
- const getParentStack = error => {
676
- let parentStack = error.stack || error.data || error.message || '';
677
- if (parentStack.startsWith(' at')) {
678
- parentStack = error.message + NewLine$3 + parentStack;
679
- }
680
- return parentStack;
681
- };
682
681
  const restoreJsonRpcError = error => {
683
682
  if (error && error instanceof Error) {
684
683
  return error;
685
684
  }
686
- const currentStack = joinLines$2(splitLines$2(new Error().stack).slice(1));
685
+ const currentStack = joinLines$2(splitLines$2(new Error().stack || '').slice(1));
687
686
  if (error && error.code && error.code === MethodNotFound) {
688
687
  const restoredError = new JsonRpcError(error.message);
689
688
  const parentStack = getParentStack(error);
@@ -712,7 +711,6 @@ const restoreJsonRpcError = error => {
712
711
  }
713
712
  } else {
714
713
  if (error.stack) {
715
- // TODO accessing stack might be slow
716
714
  const lowerStack = restoredError.stack || '';
717
715
  // @ts-ignore
718
716
  const indexNewLine = getNewLineIndex$2(lowerStack);
@@ -742,6 +740,67 @@ const unwrapJsonRpcResult = responseMessage => {
742
740
  }
743
741
  throw new JsonRpcError('unexpected response message');
744
742
  };
743
+ const isMessagePort$1 = value => {
744
+ return typeof MessagePort !== 'undefined' && value instanceof MessagePort;
745
+ };
746
+ const isInstanceOf = (value, constructorName) => {
747
+ return value?.constructor?.name === constructorName;
748
+ };
749
+ const isMessagePortMain = value => {
750
+ return isInstanceOf(value, 'MessagePortMain');
751
+ };
752
+ const isOffscreenCanvas = value => {
753
+ return typeof OffscreenCanvas !== 'undefined' && value instanceof OffscreenCanvas;
754
+ };
755
+ const isSocket = value => {
756
+ return isInstanceOf(value, 'Socket');
757
+ };
758
+ const transferrables = [isMessagePort$1, isMessagePortMain, isOffscreenCanvas, isSocket];
759
+ const isTransferrable$1 = value => {
760
+ for (const fn of transferrables) {
761
+ if (fn(value)) {
762
+ return true;
763
+ }
764
+ }
765
+ return false;
766
+ };
767
+ const walkValue$1 = (value, transferrables) => {
768
+ if (!value) {
769
+ return;
770
+ }
771
+ if (isTransferrable$1(value)) {
772
+ transferrables.push(value);
773
+ }
774
+ if (Array.isArray(value)) {
775
+ for (const item of value) {
776
+ walkValue$1(item, transferrables);
777
+ }
778
+ return;
779
+ }
780
+ if (typeof value === 'object') {
781
+ for (const property of Object.values(value)) {
782
+ walkValue$1(property, transferrables);
783
+ }
784
+ }
785
+ };
786
+ const getTransferrables = value => {
787
+ const transferrables = [];
788
+ walkValue$1(value, transferrables);
789
+ return transferrables;
790
+ };
791
+ const isSingleTransferrable = value => {
792
+ return isSocket(value);
793
+ };
794
+ const getTransferrableParams = value => {
795
+ const transferrables = getTransferrables(value);
796
+ if (transferrables.length === 0) {
797
+ return undefined;
798
+ }
799
+ if (isSingleTransferrable(transferrables[0])) {
800
+ return transferrables[0];
801
+ }
802
+ return transferrables;
803
+ };
745
804
  const create$1$1 = (message, error) => {
746
805
  return {
747
806
  jsonrpc: Two,
@@ -794,7 +853,42 @@ const getResponse = async (message, ipc, execute, preparePrettyError, logError,
794
853
  return getErrorResponse(message, error, preparePrettyError, logError);
795
854
  }
796
855
  };
797
- const handleJsonRpcMessage = async (ipc, message, execute, resolve, preparePrettyError, logError, requiresSocket) => {
856
+ const defaultPreparePrettyError = error => {
857
+ return error;
858
+ };
859
+ const defaultLogError = () => {
860
+ // ignore
861
+ };
862
+ const defaultRequiresSocket = () => {
863
+ return false;
864
+ };
865
+ const defaultResolve = resolve;
866
+ const handleJsonRpcMessage = async (...args) => {
867
+ let message;
868
+ let ipc;
869
+ let execute;
870
+ let preparePrettyError;
871
+ let logError;
872
+ let resolve;
873
+ let requiresSocket;
874
+ if (args.length === 1) {
875
+ const arg = args[0];
876
+ message = arg.message;
877
+ ipc = arg.ipc;
878
+ execute = arg.execute;
879
+ preparePrettyError = arg.preparePrettyError || defaultPreparePrettyError;
880
+ logError = arg.logError || defaultLogError;
881
+ requiresSocket = arg.requiresSocket || defaultRequiresSocket;
882
+ resolve = arg.resolve || defaultResolve;
883
+ } else {
884
+ ipc = args[0];
885
+ message = args[1];
886
+ execute = args[2];
887
+ resolve = args[3];
888
+ preparePrettyError = args[4];
889
+ logError = args[5];
890
+ requiresSocket = args[6];
891
+ }
798
892
  if ('id' in message) {
799
893
  if ('method' in message) {
800
894
  const response = await getResponse(message, ipc, execute, preparePrettyError, logError, requiresSocket);
@@ -829,12 +923,21 @@ const invoke$2 = async (ipc, method, ...params) => {
829
923
  const result = unwrapJsonRpcResult(responseMessage);
830
924
  return result;
831
925
  };
926
+
927
+ // TODO deprecated old typings,
928
+ // always use automatic transferrable detection
832
929
  const invokeAndTransfer$1 = async (ipc, handle, method, ...params) => {
930
+ let transfer = handle;
931
+ if (typeof handle === 'string') {
932
+ params = [method, ...params];
933
+ method = handle;
934
+ transfer = getTransferrableParams(params);
935
+ }
833
936
  const {
834
937
  message,
835
938
  promise
836
939
  } = create$2$1(method, params);
837
- ipc.sendAndTransfer(message, handle);
940
+ ipc.sendAndTransfer(message, transfer);
838
941
  const responseMessage = await promise;
839
942
  const result = unwrapJsonRpcResult(responseMessage);
840
943
  return result;
@@ -1010,8 +1113,8 @@ const sendAndTransfer = (message, transfer) => {
1010
1113
  // @ts-expect-error
1011
1114
  state$9.ipc.sendAndTransfer(message, transfer);
1012
1115
  };
1013
- const invokeAndTransfer = (method, transfer, ...params) => {
1014
- return invokeAndTransfer$1(state$9.ipc, transfer, method, ...params);
1116
+ const invokeAndTransfer = (method, ...params) => {
1117
+ return invokeAndTransfer$1(state$9.ipc, method, ...params);
1015
1118
  };
1016
1119
 
1017
1120
  const RendererWorker = {
@@ -2415,8 +2518,8 @@ const remove$1 = $Element => {
2415
2518
  }
2416
2519
  };
2417
2520
 
2418
- const set$4 = setComponentUid;
2419
- const get$5 = getComponentUid;
2521
+ const set$5 = setComponentUid;
2522
+ const get$6 = getComponentUid;
2420
2523
  const fromEvent = getComponentUidFromEvent;
2421
2524
 
2422
2525
  const startTracking$1 = ($Target, pointerId, handlePointerMove, handlePointerUp) => {
@@ -2902,21 +3005,21 @@ const ConfirmPrompt_ipc = {
2902
3005
  const state$5 = {
2903
3006
  styleSheets: Object.create(null)
2904
3007
  };
2905
- const set$3 = (id, sheet) => {
3008
+ const set$4 = (id, sheet) => {
2906
3009
  state$5.styleSheets[id] = sheet;
2907
3010
  };
2908
- const get$4 = id => {
3011
+ const get$5 = id => {
2909
3012
  return state$5.styleSheets[id];
2910
3013
  };
2911
3014
 
2912
3015
  const addCssStyleSheet = async (id, text) => {
2913
- const existing = get$4(id);
3016
+ const existing = get$5(id);
2914
3017
  if (existing) {
2915
3018
  await existing.replace(text);
2916
3019
  return;
2917
3020
  }
2918
3021
  const sheet = new CSSStyleSheet({});
2919
- set$3(id, sheet);
3022
+ set$4(id, sheet);
2920
3023
  await sheet.replace(text);
2921
3024
  document.adoptedStyleSheets.push(sheet);
2922
3025
  };
@@ -3565,25 +3668,21 @@ const Notification_ipc = {
3565
3668
  const state$2 = {
3566
3669
  canvasObjects: Object.create(null)
3567
3670
  };
3568
- const get$3 = id => {
3671
+ const get$4 = id => {
3569
3672
  return state$2.canvasObjects[id];
3570
3673
  };
3571
- const set$2 = (canvasId, canvas) => {
3674
+ const set$3 = (canvasId, canvas) => {
3572
3675
  state$2.canvasObjects[canvasId] = canvas;
3573
3676
  };
3574
3677
 
3575
- const get$2 = id => {
3576
- return get$3(id);
3678
+ const get$3 = id => {
3679
+ return get$4(id);
3577
3680
  };
3578
- const create$D = (canvasId, callbackId) => {
3681
+ const create$D = async (canvasId, objectId) => {
3579
3682
  const canvas = document.createElement('canvas');
3580
3683
  const offscreenCanvas = canvas.transferControlToOffscreen();
3581
- set$2(canvasId, canvas);
3582
- sendAndTransfer({
3583
- jsonrpc: '2.0',
3584
- id: callbackId,
3585
- params: [offscreenCanvas]
3586
- }, [offscreenCanvas]);
3684
+ set$3(canvasId, canvas);
3685
+ await invokeAndTransfer('Transferrable.transfer', objectId, offscreenCanvas);
3587
3686
  };
3588
3687
 
3589
3688
  const name$f = 'OffscreenCanvas';
@@ -3986,26 +4085,26 @@ const Prompt_ipc = {
3986
4085
  };
3987
4086
 
3988
4087
  const screenCaptures = Object.create(null);
3989
- const get$1 = id => {
4088
+ const get$2 = id => {
3990
4089
  return screenCaptures[id];
3991
4090
  };
3992
- const set$1 = (id, captureStream) => {
4091
+ const set$2 = (id, captureStream) => {
3993
4092
  screenCaptures[id] = captureStream;
3994
4093
  };
3995
4094
  const remove = id => {
3996
4095
  delete screenCaptures[id];
3997
4096
  };
3998
4097
 
3999
- const get = id => {
4098
+ const get$1 = id => {
4000
4099
  number(id);
4001
- return get$1(id);
4100
+ return get$2(id);
4002
4101
  };
4003
4102
  const start = async (id, options) => {
4004
4103
  try {
4005
4104
  number(id);
4006
4105
  object(options);
4007
4106
  const captureStream = await navigator.mediaDevices.getUserMedia(options);
4008
- set$1(id, captureStream);
4107
+ set$2(id, captureStream);
4009
4108
  } catch (error) {
4010
4109
  throw new VError$1(error, `Failed to start screen capture`);
4011
4110
  }
@@ -4013,7 +4112,7 @@ const start = async (id, options) => {
4013
4112
  const dispose$e = async (id, options) => {
4014
4113
  try {
4015
4114
  number(id);
4016
- const captureStream = get$1(id);
4115
+ const captureStream = get$2(id);
4017
4116
  for (const track of captureStream.getTracks()) {
4018
4117
  track.stop();
4019
4118
  }
@@ -4555,6 +4654,14 @@ const TestFrameWork_ipc = {
4555
4654
  name: name$9
4556
4655
  };
4557
4656
 
4657
+ const webViews = Object.create(null);
4658
+ const set$1 = (id, webView) => {
4659
+ webViews[id] = webView;
4660
+ };
4661
+ const get = id => {
4662
+ return webViews[id];
4663
+ };
4664
+
4558
4665
  const objects = Object.create(null);
4559
4666
  const transfer = (objectId, transferable) => {
4560
4667
  objects[objectId] = transferable;
@@ -4565,9 +4672,34 @@ const acquire = objectId => {
4565
4672
  return value;
4566
4673
  };
4567
4674
 
4675
+ // TODO transfer port directly instead of storing
4676
+ // it for a short time in state
4677
+ const transferToWebView = objectId => {
4678
+ const $Iframe = get(1);
4679
+ if (!$Iframe) {
4680
+ throw new Error(`webview not found`);
4681
+ }
4682
+ const {
4683
+ contentWindow
4684
+ } = $Iframe;
4685
+ if (!contentWindow) {
4686
+ throw new Error(`missing content window`);
4687
+ }
4688
+ // TODO use jsonrpc invoke
4689
+ // TODO allow specifying transfer origin from renderer worker
4690
+ // TODO allow specifing method from renderer worker
4691
+ const port = acquire(objectId);
4692
+ contentWindow.postMessage({
4693
+ jsonrpc: '2.0',
4694
+ method: 'handlePort',
4695
+ params: [port]
4696
+ }, '*', [port]);
4697
+ };
4698
+
4568
4699
  const name$8 = 'Transferrable';
4569
4700
  const Commands$9 = {
4570
- transfer: transfer
4701
+ transfer: transfer,
4702
+ transferToWebView: transferToWebView
4571
4703
  };
4572
4704
 
4573
4705
  const Transferrable_ipc = {
@@ -4731,7 +4863,7 @@ const create$C = (id, uid = id) => {
4731
4863
  state$6.instances[id].state.$Viewlet.remove();
4732
4864
  }
4733
4865
  const instanceState = module.create();
4734
- set$4(instanceState.$Viewlet, uid);
4866
+ set$5(instanceState.$Viewlet, uid);
4735
4867
  if (module.attachEvents) {
4736
4868
  module.attachEvents(instanceState);
4737
4869
  }
@@ -5371,14 +5503,14 @@ class Ipc extends EventTarget {
5371
5503
  }
5372
5504
  }
5373
5505
  const readyMessage = 'ready';
5374
- const listen$3 = () => {
5506
+ const listen$4 = () => {
5375
5507
  // @ts-ignore
5376
5508
  if (typeof WorkerGlobalScope === 'undefined') {
5377
5509
  throw new TypeError('module is not in web worker scope');
5378
5510
  }
5379
5511
  return globalThis;
5380
5512
  };
5381
- const signal$2 = global => {
5513
+ const signal$3 = global => {
5382
5514
  global.postMessage(readyMessage);
5383
5515
  };
5384
5516
  class IpcChildWithModuleWorker extends Ipc {
@@ -5403,14 +5535,14 @@ class IpcChildWithModuleWorker extends Ipc {
5403
5535
  this._rawIpc.addEventListener('message', callback);
5404
5536
  }
5405
5537
  }
5406
- const wrap$5 = global => {
5538
+ const wrap$6 = global => {
5407
5539
  return new IpcChildWithModuleWorker(global);
5408
5540
  };
5409
5541
  const IpcChildWithModuleWorker$1 = {
5410
5542
  __proto__: null,
5411
- listen: listen$3,
5412
- signal: signal$2,
5413
- wrap: wrap$5
5543
+ listen: listen$4,
5544
+ signal: signal$3,
5545
+ wrap: wrap$6
5414
5546
  };
5415
5547
  const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
5416
5548
  const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
@@ -5628,10 +5760,10 @@ const waitForFirstMessage = async port => {
5628
5760
  // @ts-ignore
5629
5761
  return event.data;
5630
5762
  };
5631
- const listen$2 = async () => {
5632
- const parentIpcRaw = listen$3();
5633
- signal$2(parentIpcRaw);
5634
- const parentIpc = wrap$5(parentIpcRaw);
5763
+ const listen$3 = async () => {
5764
+ const parentIpcRaw = listen$4();
5765
+ signal$3(parentIpcRaw);
5766
+ const parentIpc = wrap$6(parentIpcRaw);
5635
5767
  const firstMessage = await waitForFirstMessage(parentIpc);
5636
5768
  if (firstMessage.method !== 'initialize') {
5637
5769
  throw new IpcError$1('unexpected first message');
@@ -5670,13 +5802,54 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
5670
5802
  this._rawIpc.start();
5671
5803
  }
5672
5804
  }
5673
- const wrap$4 = port => {
5805
+ const wrap$5 = port => {
5674
5806
  return new IpcChildWithModuleWorkerAndMessagePort(port);
5675
5807
  };
5676
5808
  const IpcChildWithModuleWorkerAndMessagePort$1 = {
5677
5809
  __proto__: null,
5678
- listen: listen$2,
5679
- wrap: wrap$4
5810
+ listen: listen$3,
5811
+ wrap: wrap$5
5812
+ };
5813
+ const isTransferrable = value => {
5814
+ return value instanceof MessagePort;
5815
+ };
5816
+ const walkValue = (value, transferrables) => {
5817
+ if (!value) {
5818
+ return value;
5819
+ }
5820
+ if (isTransferrable(value)) {
5821
+ transferrables.push(value);
5822
+ return undefined;
5823
+ }
5824
+ if (Array.isArray(value)) {
5825
+ const newItems = [];
5826
+ for (const item of value) {
5827
+ const newItem = walkValue(item, transferrables);
5828
+ newItems.push(newItem);
5829
+ }
5830
+ return newItems;
5831
+ }
5832
+ if (typeof value === 'object') {
5833
+ const newObject = Object.create(null);
5834
+ for (const [key, property] of Object.entries(value)) {
5835
+ const newValue = walkValue(property, transferrables);
5836
+ newObject[key] = newValue;
5837
+ }
5838
+ return newObject;
5839
+ }
5840
+ return value;
5841
+ };
5842
+
5843
+ // workaround for electron not supporting transferrable objects
5844
+ // as parameters. If the transferrable object is a parameter, in electron
5845
+ // only an empty objected is received in the main process
5846
+ const fixElectronParameters = value => {
5847
+ const transfer = [];
5848
+ const newValue = walkValue(value, transfer);
5849
+ return {
5850
+ newValue,
5851
+ transfer
5852
+ };
5680
5853
  };
5681
5854
  const listen$1 = () => {
5682
5855
  return window;
@@ -5691,8 +5864,12 @@ class IpcChildWithWindow extends Ipc {
5691
5864
  send(message) {
5692
5865
  this._rawIpc.postMessage(message);
5693
5866
  }
5694
- sendAndTransfer(message, transfer) {
5695
- this._rawIpc.postMessage(message, location.origin, transfer);
5867
+ sendAndTransfer(message, _transfer) {
5868
+ const {
5869
+ newValue,
5870
+ transfer
5871
+ } = fixElectronParameters(message);
5872
+ this._rawIpc.postMessage(newValue, location.origin, transfer);
5696
5873
  }
5697
5874
  dispose() {
5698
5875
  // ignore
@@ -5717,13 +5894,13 @@ class IpcChildWithWindow extends Ipc {
5717
5894
  const wrap$3 = window => {
5718
5895
  return new IpcChildWithWindow(window);
5719
5896
  };
5720
- const IpcChildWithWindow$1 = {
5897
+ const IpcChildWithElectronWindow = {
5721
5898
  __proto__: null,
5722
5899
  listen: listen$1,
5723
5900
  signal: signal$1,
5724
5901
  wrap: wrap$3
5725
5902
  };
5726
- const listen$4 = ({
5903
+ const listen$2 = ({
5727
5904
  port
5728
5905
  }) => {
5729
5906
  return port;
@@ -5760,7 +5937,7 @@ const wrap$2 = port => {
5760
5937
  };
5761
5938
  const IpcChildWithMessagePort$1 = {
5762
5939
  __proto__: null,
5763
- listen: listen$4,
5940
+ listen: listen$2,
5764
5941
  signal,
5765
5942
  wrap: wrap$2
5766
5943
  };
@@ -6063,9 +6240,9 @@ const create$x = async ({
6063
6240
  if (!isElectron) {
6064
6241
  throw new Error('Electron api was requested but is not available');
6065
6242
  }
6066
- const windowIpc = IpcChildWithWindow$1.wrap(window);
6243
+ const windowIpc = IpcChildWithElectronWindow.wrap(window);
6067
6244
  handleIpcOnce(windowIpc);
6068
- const webContentsIds = await invokeAndTransfer$1(windowIpc, [port], 'CreateMessagePort.createMessagePort', ipcId);
6245
+ const webContentsIds = await invokeAndTransfer$1(windowIpc, 'CreateMessagePort.createMessagePort', ipcId, port);
6069
6246
  return webContentsIds;
6070
6247
  };
6071
6248
 
@@ -9014,7 +9191,7 @@ const getUid = () => {
9014
9191
  if (!$Main) {
9015
9192
  return 0;
9016
9193
  }
9017
- return get$5($Main);
9194
+ return get$6($Main);
9018
9195
  };
9019
9196
  const handleTabsWheel = event => {
9020
9197
  const uid = getUid();
@@ -9816,7 +9993,7 @@ const setScreenCapture = (state, id) => {
9816
9993
  $Viewlet
9817
9994
  } = state;
9818
9995
  const $Video = document.createElement('video');
9819
- const screenCapture = get(id);
9996
+ const screenCapture = get$1(id);
9820
9997
  $Video.srcObject = screenCapture;
9821
9998
  $Video.onloadedmetadata = handleLoadedMetaData;
9822
9999
  $Viewlet.append($Video);
@@ -10456,8 +10633,8 @@ const create$4 = () => {
10456
10633
  };
10457
10634
  };
10458
10635
  const setTerminal = (state, canvasCursorId, canvasTextId) => {
10459
- const canvasText = get$2(canvasTextId);
10460
- const canvasCursor = get$2(canvasCursorId);
10636
+ const canvasText = get$3(canvasTextId);
10637
+ const canvasCursor = get$3(canvasCursorId);
10461
10638
  const {
10462
10639
  $Viewlet
10463
10640
  } = state;
@@ -10933,7 +11110,7 @@ const setMenus = (state, changes, uid) => {
10933
11110
  const menu = change[1];
10934
11111
  const dom = change[2];
10935
11112
  const $Menu = create$Menu();
10936
- set$4($Menu, uid);
11113
+ set$5($Menu, uid);
10937
11114
  $Menu.onmouseover = handleMenuMouseOver;
10938
11115
  $Menu.onclick = handleMenuClick;
10939
11116
  const {
@@ -11393,12 +11570,16 @@ const setIframe = (state, src, sandbox = []) => {
11393
11570
  $Iframe.src = src;
11394
11571
  $Parent.append($Iframe);
11395
11572
  state.frame = $Iframe;
11573
+ set$1(1, $Iframe);
11396
11574
  };
11397
11575
  const setPort = (state, portId, origin) => {
11398
11576
  const port = acquire(portId);
11399
11577
  const {
11400
11578
  frame
11401
11579
  } = state;
11580
+ // TODO wait for load in renderer worker
11581
+ // TODO avoid closure
11582
+ // TODO use jsonrpc invoke
11402
11583
  frame.addEventListener('load', () => {
11403
11584
  const {
11404
11585
  contentWindow
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "6.13.0",
3
+ "version": "7.0.1",
4
4
  "description": "",
5
5
  "main": "dist/diffWorkerMain.js",
6
6
  "type": "module",