@lvce-editor/renderer-process 6.4.0 → 6.5.0

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.
@@ -3178,6 +3178,7 @@ const CompositionStart = 'compositionstart';
3178
3178
  const CompositionUpdate = 'compositionupdate';
3179
3179
  const ContextMenu = 'contextmenu';
3180
3180
  const Cut = 'cut';
3181
+ const Load = 'load';
3181
3182
  const DoubleClick = 'dblclick';
3182
3183
  const DragEnd = 'dragend';
3183
3184
  const DragLeave = 'dragleave';
@@ -4141,6 +4142,11 @@ const objects = Object.create(null);
4141
4142
  const transfer = (objectId, transferable) => {
4142
4143
  objects[objectId] = transferable;
4143
4144
  };
4145
+ const acquire = objectId => {
4146
+ const value = objects[objectId];
4147
+ delete objects[objectId];
4148
+ return value;
4149
+ };
4144
4150
 
4145
4151
  const name$8 = 'Transferrable';
4146
4152
  const Commands$9 = {
@@ -5775,11 +5781,11 @@ const ViewletActivityBarEvents = {
5775
5781
  returnValue: returnValue$7
5776
5782
  };
5777
5783
 
5778
- const Events$a = ViewletActivityBarEvents;
5784
+ const Events$b = ViewletActivityBarEvents;
5779
5785
 
5780
5786
  const ViewletActivityBar = {
5781
5787
  __proto__: null,
5782
- Events: Events$a
5788
+ Events: Events$b
5783
5789
  };
5784
5790
 
5785
5791
  const executeViewletCommand = (uid, command, ...args) => {
@@ -5918,11 +5924,11 @@ const ViewletAudioEvents = {
5918
5924
  handleAudioError
5919
5925
  };
5920
5926
 
5921
- const Events$9 = ViewletAudioEvents;
5927
+ const Events$a = ViewletAudioEvents;
5922
5928
 
5923
5929
  const ViewletAudio = {
5924
5930
  __proto__: null,
5925
- Events: Events$9
5931
+ Events: Events$a
5926
5932
  };
5927
5933
 
5928
5934
  const create$x = () => {
@@ -7667,7 +7673,7 @@ const create$i = () => {
7667
7673
  $Viewlet
7668
7674
  };
7669
7675
  };
7670
- const Events$8 = ViewletExplorerEvents;
7676
+ const Events$9 = ViewletExplorerEvents;
7671
7677
  const handleError$3 = (state, message) => {
7672
7678
  object(state);
7673
7679
  string(message);
@@ -7714,7 +7720,7 @@ const setDom$4 = (state, dom) => {
7714
7720
 
7715
7721
  const ViewletExplorer = {
7716
7722
  __proto__: null,
7717
- Events: Events$8,
7723
+ Events: Events$9,
7718
7724
  create: create$i,
7719
7725
  dispose: dispose$9,
7720
7726
  focusInput,
@@ -7758,11 +7764,11 @@ const ViewletExtensionDetailEvents = {
7758
7764
  handleReadmeContextMenu
7759
7765
  };
7760
7766
 
7761
- const Events$7 = ViewletExtensionDetailEvents;
7767
+ const Events$8 = ViewletExtensionDetailEvents;
7762
7768
 
7763
7769
  const ViewletExtensionDetail = {
7764
7770
  __proto__: null,
7765
- Events: Events$7,
7771
+ Events: Events$8,
7766
7772
  setSize
7767
7773
  };
7768
7774
 
@@ -8151,7 +8157,7 @@ const ViewletLocationsEvents = {
8151
8157
  handleLocationsMouseDown
8152
8158
  };
8153
8159
 
8154
- const Events$6 = ViewletLocationsEvents;
8160
+ const Events$7 = ViewletLocationsEvents;
8155
8161
  const setFocusedIndex$3 = (state, oldFocusedIndex, newFocusedIndex) => {
8156
8162
  const {
8157
8163
  $Viewlet
@@ -8186,7 +8192,7 @@ const focus$b = state => {
8186
8192
 
8187
8193
  const ViewletImplementations = {
8188
8194
  __proto__: null,
8189
- Events: Events$6,
8195
+ Events: Events$7,
8190
8196
  focus: focus$b,
8191
8197
  handleError: handleError$1,
8192
8198
  setFocusedIndex: setFocusedIndex$3
@@ -8297,11 +8303,11 @@ const setColumnWidths = (state, columnWidth1, columnWidth2, columnWidth3) => {
8297
8303
  $Resizer1.style.left = `${paddingLeft + columnWidth1}px`;
8298
8304
  $Resizer2.style.left = `${paddingLeft + columnWidth1 + columnWidth2}px`;
8299
8305
  };
8300
- const Events$5 = ViewletkeyBindingsEvents;
8306
+ const Events$6 = ViewletkeyBindingsEvents;
8301
8307
 
8302
8308
  const ViewletKeyBindings = {
8303
8309
  __proto__: null,
8304
- Events: Events$5,
8310
+ Events: Events$6,
8305
8311
  setColumnWidths,
8306
8312
  setScrollBar: setScrollBar$2,
8307
8313
  setSize,
@@ -9621,7 +9627,7 @@ const ViewletQuickPick = {
9621
9627
 
9622
9628
  const ViewletReferences = {
9623
9629
  __proto__: null,
9624
- Events: Events$6,
9630
+ Events: Events$7,
9625
9631
  focus: focus$b,
9626
9632
  handleError: handleError$1,
9627
9633
  setFocusedIndex: setFocusedIndex$3
@@ -9961,11 +9967,11 @@ const setFocus = (state, selector) => {
9961
9967
  }
9962
9968
  };
9963
9969
  const dispose$3 = () => {};
9964
- const Events$4 = ViewletSearchEvents;
9970
+ const Events$5 = ViewletSearchEvents;
9965
9971
 
9966
9972
  const ViewletSearch = {
9967
9973
  __proto__: null,
9968
- Events: Events$4,
9974
+ Events: Events$5,
9969
9975
  dispose: dispose$3,
9970
9976
  focus: focus$5,
9971
9977
  setFocus,
@@ -10626,18 +10632,18 @@ const ViewletTitleBarButtonEvents = {
10626
10632
  returnValue: returnValue$2
10627
10633
  };
10628
10634
 
10629
- const Events$3 = ViewletTitleBarButtonEvents;
10635
+ const Events$4 = ViewletTitleBarButtonEvents;
10630
10636
 
10631
10637
  const ViewletTitleBarButtons = {
10632
10638
  __proto__: null,
10633
- Events: Events$3
10639
+ Events: Events$4
10634
10640
  };
10635
10641
 
10636
- const Events$2 = {};
10642
+ const Events$3 = {};
10637
10643
 
10638
10644
  const ViewletTitleBarIcon = {
10639
10645
  __proto__: null,
10640
- Events: Events$2
10646
+ Events: Events$3
10641
10647
  };
10642
10648
 
10643
10649
  const isInsideTitleBarMenu = $Element => {
@@ -10969,11 +10975,11 @@ const setMenus = (state, changes, uid) => {
10969
10975
  }
10970
10976
  }
10971
10977
  };
10972
- const Events$1 = ViewletTitleBarMenuBarEvents;
10978
+ const Events$2 = ViewletTitleBarMenuBarEvents;
10973
10979
 
10974
10980
  const ViewletTitleBarMenuBar = {
10975
10981
  __proto__: null,
10976
- Events: Events$1,
10982
+ Events: Events$2,
10977
10983
  closeMenu,
10978
10984
  dispose,
10979
10985
  focus,
@@ -11005,11 +11011,11 @@ const ViewletVideoEvents = {
11005
11011
  handleVideoError
11006
11012
  };
11007
11013
 
11008
- const Events = ViewletVideoEvents;
11014
+ const Events$1 = ViewletVideoEvents;
11009
11015
 
11010
11016
  const ViewletVideo = {
11011
11017
  __proto__: null,
11012
- Events
11018
+ Events: Events$1
11013
11019
  };
11014
11020
 
11015
11021
  const create$1 = () => {
@@ -11140,29 +11146,66 @@ const handleClickAt = event => {
11140
11146
  } = event;
11141
11147
  return ['handleClickAt', clientX, clientY];
11142
11148
  };
11149
+ const handleLoad = event => {
11150
+ return ['handleLoad'];
11151
+ };
11143
11152
  const returnValue = true;
11144
11153
 
11145
- const ViewletE2eTestsEvents = {
11154
+ const Events = {
11146
11155
  __proto__: null,
11147
11156
  handleClickAt,
11157
+ handleLoad,
11148
11158
  returnValue
11149
11159
  };
11150
11160
 
11151
- const setIframe = (state, src) => {
11161
+ const sendToIframe = (contentWindow, message, origin, transfer) => {
11162
+ try {
11163
+ contentWindow.postMessage(message, origin, transfer);
11164
+ } catch (error) {
11165
+ throw new VError$1(error, `Failed to send message to iframe`);
11166
+ }
11167
+ };
11168
+
11169
+ const setIframe = (state, src, sandbox = []) => {
11152
11170
  const $ExistingIframe = document.querySelector('.E2eTestsIframe');
11153
11171
  if ($ExistingIframe) {
11154
11172
  $ExistingIframe.remove();
11155
11173
  }
11156
11174
  const $Iframe = document.createElement('iframe');
11175
+ attachEventsFunctional($Iframe, {
11176
+ [Load]: handleLoad
11177
+ });
11178
+ for (const element of sandbox) {
11179
+ $Iframe.sandbox.add(element);
11180
+ }
11157
11181
  $Iframe.className = 'E2eTestsIframe';
11158
11182
  $Iframe.src = src;
11159
11183
  document.body.append($Iframe);
11160
11184
  };
11185
+ const setPort = (state, portId, origin) => {
11186
+ const $ExistingIframe = document.querySelector('.E2eTestsIframe');
11187
+ if (!$ExistingIframe) {
11188
+ throw new Error('no iframe found');
11189
+ }
11190
+ const port = acquire(portId);
11191
+ // @ts-ignore
11192
+ const {
11193
+ contentWindow
11194
+ } = $ExistingIframe;
11195
+ const message = {
11196
+ jsonrpc: '2.0',
11197
+ method: 'handleIpc',
11198
+ params: [port]
11199
+ };
11200
+ const transfer = [port];
11201
+ sendToIframe(contentWindow, message, origin, transfer);
11202
+ };
11161
11203
 
11162
11204
  const ViewletE2eTests = {
11163
11205
  __proto__: null,
11164
- Events: ViewletE2eTestsEvents,
11165
- setIframe
11206
+ Events,
11207
+ setIframe,
11208
+ setPort
11166
11209
  };
11167
11210
 
11168
11211
  const getWorkerDisplayName = name => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "6.4.0",
3
+ "version": "6.5.0",
4
4
  "description": "",
5
5
  "main": "dist/diffWorkerMain.js",
6
6
  "type": "module",