@lvce-editor/renderer-process 9.5.0 → 9.7.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.
@@ -720,14 +720,16 @@ const unwrapJsonRpcResult = responseMessage => {
720
720
  }
721
721
  throw new JsonRpcError('unexpected response message');
722
722
  };
723
- const create$1$1 = (message, error) => {
724
- return {
725
- jsonrpc: Two,
726
- id: message.id,
727
- error
728
- };
729
- };
730
723
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
724
+ const getType$2 = prettyError => {
725
+ if (prettyError && prettyError.type) {
726
+ return prettyError.type;
727
+ }
728
+ if (prettyError && prettyError.constructor && prettyError.constructor.name) {
729
+ return prettyError.constructor.name;
730
+ }
731
+ return undefined;
732
+ };
731
733
  const getErrorProperty = (error, prettyError) => {
732
734
  if (error && error.code === E_COMMAND_NOT_FOUND) {
733
735
  return {
@@ -742,11 +744,19 @@ const getErrorProperty = (error, prettyError) => {
742
744
  data: {
743
745
  stack: prettyError.stack,
744
746
  codeFrame: prettyError.codeFrame,
745
- type: prettyError.type,
746
- code: prettyError.code
747
+ type: getType$2(prettyError),
748
+ code: prettyError.code,
749
+ name: prettyError.name
747
750
  }
748
751
  };
749
752
  };
753
+ const create$1$1 = (message, error) => {
754
+ return {
755
+ jsonrpc: Two,
756
+ id: message.id,
757
+ error
758
+ };
759
+ };
750
760
  const getErrorResponse = (message, error, preparePrettyError, logError) => {
751
761
  const prettyError = preparePrettyError(error);
752
762
  logError(error, prettyError);
@@ -5754,9 +5764,7 @@ const setIframeCsp = ($Iframe, csp) => {
5754
5764
  };
5755
5765
 
5756
5766
  const setIframeSandBox = ($Iframe, sandbox) => {
5757
- for (const element of sandbox) {
5758
- $Iframe.sandbox.add(element);
5759
- }
5767
+ $Iframe.sandbox.add(...sandbox);
5760
5768
  };
5761
5769
 
5762
5770
  const setIframeSrc = ($Iframe, src, srcDoc = '') => {
@@ -5812,26 +5820,25 @@ const create$C = async (uid, src, sandbox, csp, credentialless) => {
5812
5820
  const load = async uid => {
5813
5821
  const $Iframe = get(uid);
5814
5822
  const promise = waitForFrameToLoad($Iframe);
5815
- document.body.append($Iframe);
5823
+ const parent = document.getElementById('Workbench');
5824
+ parent.append($Iframe);
5816
5825
  await promise;
5817
5826
  };
5818
5827
 
5819
5828
  // TODO rename to sendMessage
5820
- const setPort$2 = (state, portId, origin) => {
5821
- const port = acquire(portId);
5822
- const {
5823
- frame
5824
- } = state;
5825
- // TODO wait for load in renderer worker
5826
- // TODO avoid closure
5829
+ const setPort$2 = (uid, port, origin, portType) => {
5830
+ const $Iframe = get(uid);
5827
5831
  // TODO use jsonrpc invoke
5828
5832
  const {
5829
5833
  contentWindow
5830
- } = frame;
5834
+ } = $Iframe;
5835
+ if (!contentWindow) {
5836
+ throw new Error(`content window not found`);
5837
+ }
5831
5838
  contentWindow.postMessage({
5832
5839
  jsonrpc: '2.0',
5833
5840
  method: 'setPort',
5834
- params: [port]
5841
+ params: [port, portType]
5835
5842
  }, origin, [port]);
5836
5843
  };
5837
5844
 
@@ -7146,7 +7153,7 @@ const setDecorationsDom$2 = (state, decorations) => {
7146
7153
  renderInto($LayerDiagnostics, decorations);
7147
7154
  };
7148
7155
 
7149
- const setPosition = (state, scrollBarY, scrollBarHeight) => {
7156
+ const setPosition$1 = (state, scrollBarY, scrollBarHeight) => {
7150
7157
  const {
7151
7158
  $ScrollBarThumbVertical
7152
7159
  } = state;
@@ -7319,7 +7326,7 @@ const setIncrementalEdits$1 = (state, incrementalEdits) => {
7319
7326
  }
7320
7327
  };
7321
7328
  const setScrollBar$1 = (state, scrollBarY, scrollBarHeight) => {
7322
- setPosition(state, scrollBarY, scrollBarHeight);
7329
+ setPosition$1(state, scrollBarY, scrollBarHeight);
7323
7330
  };
7324
7331
  const setScrollBarHorizontal$1 = setScrollBarHorizontal$2;
7325
7332
  const renderGutter$1 = (state, dom) => {
@@ -11434,10 +11441,15 @@ const setPort = (state, portId, origin) => {
11434
11441
  once: true
11435
11442
  });
11436
11443
  };
11444
+ const setPosition = (state, id, x, y, width, height) => {
11445
+ const $Iframe = get(id);
11446
+ setBounds$6($Iframe, x, y, width, height);
11447
+ };
11437
11448
 
11438
11449
  const ViewletWebView = {
11439
11450
  __proto__: null,
11440
11451
  Events: ViewletWebViewEvents,
11441
11452
  setIframe,
11442
- setPort
11453
+ setPort,
11454
+ setPosition
11443
11455
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "9.5.0",
3
+ "version": "9.7.0",
4
4
  "description": "",
5
5
  "main": "dist/diffWorkerMain.js",
6
6
  "type": "module",