@lvce-editor/renderer-process 30.33.5 → 30.34.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.
@@ -125,7 +125,7 @@ const state$d = {
125
125
  const set$b = (id, sheet) => {
126
126
  state$d.styleSheets[id] = sheet;
127
127
  };
128
- const get$9 = id => {
128
+ const get$a = id => {
129
129
  return state$d.styleSheets[id];
130
130
  };
131
131
  const setText$2 = (id, text) => {
@@ -140,7 +140,7 @@ const remove$5 = id => {
140
140
  };
141
141
 
142
142
  const addCssStyleSheet = (id, text) => {
143
- const existing = get$9(id);
143
+ const existing = get$a(id);
144
144
  if (existing) {
145
145
  existing.replaceSync(text);
146
146
  setText$2(id, text);
@@ -153,7 +153,7 @@ const addCssStyleSheet = (id, text) => {
153
153
  document.adoptedStyleSheets.push(sheet);
154
154
  };
155
155
  const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
156
- const sheet = get$9(id);
156
+ const sheet = get$a(id);
157
157
  const text = getText(id);
158
158
  if (!sheet || typeof text !== 'string') {
159
159
  throw new Error(`stylesheet ${id} must be initialized before it can be patched`);
@@ -172,7 +172,7 @@ const patchCssStyleSheet = (id, start, deleteCount, replacement) => {
172
172
  setText$2(id, newText);
173
173
  };
174
174
  const removeCssStyleSheet = id => {
175
- const sheet = get$9(id);
175
+ const sheet = get$a(id);
176
176
  if (!sheet) {
177
177
  return;
178
178
  }
@@ -1277,7 +1277,7 @@ const {
1277
1277
  } = ElementTagMap;
1278
1278
 
1279
1279
  const instances = Object.create(null);
1280
- const get$8 = viewletId => {
1280
+ const get$9 = viewletId => {
1281
1281
  return instances[viewletId];
1282
1282
  };
1283
1283
  const set$a = (viewletId, instance) => {
@@ -1312,7 +1312,7 @@ const has$1 = listener => {
1312
1312
  const set$9 = (listener, value) => {
1313
1313
  cache.set(listener, value);
1314
1314
  };
1315
- const get$7 = listener => {
1315
+ const get$8 = listener => {
1316
1316
  return cache.get(listener);
1317
1317
  };
1318
1318
 
@@ -1334,7 +1334,7 @@ const getWrappedListener = (listener, returnValue) => {
1334
1334
  nameAnonymousFunction$1(wrapped, listener.name);
1335
1335
  set$9(listener, wrapped);
1336
1336
  }
1337
- return get$7(listener);
1337
+ return get$8(listener);
1338
1338
  };
1339
1339
 
1340
1340
  const attachedListeners = new WeakMap();
@@ -1568,7 +1568,7 @@ const renderDomElement = (element, eventMap, newEventMap) => {
1568
1568
  return $Element;
1569
1569
  };
1570
1570
  const renderReferenceNode = (element, eventMap, newEventMap) => {
1571
- const instance = get$8(element.uid);
1571
+ const instance = get$9(element.uid);
1572
1572
  if (!instance || !instance.state) {
1573
1573
  return document.createTextNode('Reference node not found');
1574
1574
  }
@@ -1714,7 +1714,7 @@ const handleNavigateSibling = (state, patch, $Element, patchIndex) => {
1714
1714
  return true;
1715
1715
  };
1716
1716
  const handleSetReferenceNodeUid = (state, patch) => {
1717
- const instance = get$8(patch.uid);
1717
+ const instance = get$9(patch.uid);
1718
1718
  if (!instance || !instance.state) {
1719
1719
  console.error('Cannot set reference node uid: instance not found', {
1720
1720
  uid: patch.uid
@@ -1930,7 +1930,7 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
1930
1930
  }
1931
1931
  };
1932
1932
 
1933
- const get$6 = ids => {
1933
+ const get$7 = ids => {
1934
1934
  return getFileHandles$1(ids);
1935
1935
  };
1936
1936
 
@@ -2857,7 +2857,7 @@ const execute = (command, ...args) => {
2857
2857
 
2858
2858
  const Two$1 = '2.0';
2859
2859
  const callbacks = Object.create(null);
2860
- const get$5 = id => {
2860
+ const get$6 = id => {
2861
2861
  return callbacks[id];
2862
2862
  };
2863
2863
  const remove$4 = id => {
@@ -3047,7 +3047,7 @@ const warn = (...args) => {
3047
3047
  console.warn(...args);
3048
3048
  };
3049
3049
  const resolve = (id, response) => {
3050
- const fn = get$5(id);
3050
+ const fn = get$6(id);
3051
3051
  if (!fn) {
3052
3052
  console.log(response);
3053
3053
  warn(`callback ${id} may already be disposed`);
@@ -3523,7 +3523,7 @@ const ipcs = Object.create(null);
3523
3523
  const set$7 = (name, ipc) => {
3524
3524
  ipcs[name] = ipc;
3525
3525
  };
3526
- const get$4 = name => {
3526
+ const get$5 = name => {
3527
3527
  return ipcs[name];
3528
3528
  };
3529
3529
  const remove$2 = name => {
@@ -3736,47 +3736,17 @@ const hydrate$2 = async () => {
3736
3736
  listen(result.value);
3737
3737
  return success(undefined);
3738
3738
  };
3739
-
3740
- // TODO needed?
3741
- const dispose$j = () => {
3742
- if (state$9.rpc) {
3743
- state$9.rpc.dispose();
3744
- }
3745
- };
3746
- const send = (method, ...params) => {
3739
+ const send$1 = (method, ...params) => {
3747
3740
  record('sent', method, params);
3748
3741
  // @ts-ignore
3749
3742
  state$9.rpc.send(method, ...params);
3750
3743
  };
3751
- const invoke$1 = (method, ...params) => {
3752
- record('sent', method, params);
3753
- // @ts-ignore
3754
- return state$9.rpc.invoke(method, ...params);
3755
- };
3756
- const sendAndTransfer = message => {
3757
- if (Array.isArray(message) && typeof message[0] === 'string') {
3758
- record('sent', message[0], message.slice(1));
3759
- }
3760
- // @ts-expect-error
3761
- state$9.rpc.sendAndTransfer(message);
3762
- };
3763
3744
  const invokeAndTransfer = (method, ...params) => {
3764
3745
  record('sent', method, params);
3765
3746
  // @ts-ignore
3766
3747
  return state$9.rpc.invokeAndTransfer(method, ...params);
3767
3748
  };
3768
3749
 
3769
- const RendererWorker = {
3770
- __proto__: null,
3771
- dispose: dispose$j,
3772
- hydrate: hydrate$2,
3773
- invoke: invoke$1,
3774
- invokeAndTransfer,
3775
- send,
3776
- sendAndTransfer,
3777
- state: state$9
3778
- };
3779
-
3780
3750
  const create$u = async ({
3781
3751
  method,
3782
3752
  ...options
@@ -3787,7 +3757,7 @@ const create$u = async ({
3787
3757
  }
3788
3758
  // TODO rename method
3789
3759
  // TODO avoid cyclic dependency
3790
- const port = get$4(options.name);
3760
+ const port = get$5(options.name);
3791
3761
  remove$2(options.name);
3792
3762
  await invokeAndTransfer('Transferrable.transfer', options.id, port);
3793
3763
  return;
@@ -3980,7 +3950,7 @@ const handleNotificationClick = event => {
3980
3950
  switch ($Target.className) {
3981
3951
  case 'NotificationOption':
3982
3952
  const index = findIndex$1($Target);
3983
- send(/* Notification.handleClick */'Notification.handleClick', /* index */index);
3953
+ send$1(/* Notification.handleClick */'Notification.handleClick', /* index */index);
3984
3954
  break;
3985
3955
  }
3986
3956
  };
@@ -4051,7 +4021,7 @@ const create$BackDrop = () => {
4051
4021
  };
4052
4022
 
4053
4023
  const set$5 = setComponentUid;
4054
- const get$3 = getComponentUid;
4024
+ const get$4 = getComponentUid;
4055
4025
  const fromEvent = getComponentUidFromEvent;
4056
4026
 
4057
4027
  const AriaOwns = 'aria-owns';
@@ -4236,7 +4206,7 @@ const handleMouseDown$4 = event => {
4236
4206
  }
4237
4207
  preventDefault(event);
4238
4208
  const level = getLevel($Menu);
4239
- send(/* Menu.handleClick */'Menu.selectIndex', /* level */level, /* index */index);
4209
+ send$1(/* Menu.handleClick */'Menu.selectIndex', /* level */level, /* index */index);
4240
4210
  };
4241
4211
 
4242
4212
  // const handleKeyDown = (event) => {
@@ -4281,7 +4251,7 @@ const handleMouseEnter = event => {
4281
4251
  return;
4282
4252
  }
4283
4253
  const level = getLevel($Menu);
4284
- send(/* Menu.handleMouseEnter */'Menu.handleMouseEnter', /* level */level, /* index */index, /* x */clientX, /* y */clientY, /* timeStamp */timeStamp);
4254
+ send$1(/* Menu.handleMouseEnter */'Menu.handleMouseEnter', /* level */level, /* index */index, /* x */clientX, /* y */clientY, /* timeStamp */timeStamp);
4285
4255
  };
4286
4256
  const handleMouseLeave = event => {
4287
4257
  const $RelatedTarget = event.relatedTarget;
@@ -4343,7 +4313,7 @@ const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
4343
4313
  const handleBackDropMouseDown = event => {
4344
4314
  preventDefault(event);
4345
4315
  stopPropagation(event);
4346
- send(/* Menu.hide */'Menu.hide');
4316
+ send$1(/* Menu.hide */'Menu.hide');
4347
4317
  if (state$5.$BackDrop) {
4348
4318
  remove$1(state$5.$BackDrop);
4349
4319
  state$5.$BackDrop = undefined;
@@ -4378,7 +4348,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4378
4348
  append$1($Menu);
4379
4349
  if (level === 0) {
4380
4350
  focus$e($Menu);
4381
- send('Focus.setFocus', FocusMenu);
4351
+ send$1('Focus.setFocus', FocusMenu);
4382
4352
  }
4383
4353
  };
4384
4354
  const hideSubmenu = level => {
@@ -4430,7 +4400,7 @@ const showControlled = ({
4430
4400
  showMenu(x, y, width, height, items, level);
4431
4401
  const $Menu = state$5.$$Menus.at(-1);
4432
4402
  if ($Parent && $Menu) {
4433
- const uid = get$3($Parent);
4403
+ const uid = get$4($Parent);
4434
4404
  set$5($Menu, uid);
4435
4405
  }
4436
4406
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
@@ -4517,7 +4487,7 @@ const prompt = (message, defaultValue) => {
4517
4487
  };
4518
4488
 
4519
4489
  const screenCaptures = Object.create(null);
4520
- const get$2 = id => {
4490
+ const get$3 = id => {
4521
4491
  return screenCaptures[id];
4522
4492
  };
4523
4493
  const set$4 = (id, captureStream) => {
@@ -4583,9 +4553,9 @@ class VError extends Error {
4583
4553
  }
4584
4554
  }
4585
4555
 
4586
- const get$1 = id => {
4556
+ const get$2 = id => {
4587
4557
  number(id);
4588
- return get$2(id);
4558
+ return get$3(id);
4589
4559
  };
4590
4560
  const start = async (id, options) => {
4591
4561
  try {
@@ -5160,7 +5130,7 @@ const createAction = action => {
5160
5130
  $action.style.border = 'none';
5161
5131
  $action.style.borderRadius = '5px';
5162
5132
  $action.addEventListener('click', () => {
5163
- send(action.command);
5133
+ send$1(action.command);
5164
5134
  });
5165
5135
  return $action;
5166
5136
  };
@@ -5242,7 +5212,7 @@ const webViews = Object.create(null);
5242
5212
  const set$3 = (id, webView) => {
5243
5213
  webViews[id] = webView;
5244
5214
  };
5245
- const get = id => {
5215
+ const get$1 = id => {
5246
5216
  return webViews[id];
5247
5217
  };
5248
5218
  const remove = id => {
@@ -5262,7 +5232,7 @@ const acquire = objectId => {
5262
5232
  // TODO transfer port directly instead of storing
5263
5233
  // it for a short time in state
5264
5234
  const transferToWebView = objectId => {
5265
- const $Iframe = get(1);
5235
+ const $Iframe = get$1(1);
5266
5236
  if (!$Iframe) {
5267
5237
  throw new Error(`webview not found`);
5268
5238
  }
@@ -5291,6 +5261,30 @@ const attachEvents$7 = ($Node, eventMap) => {
5291
5261
  }
5292
5262
  };
5293
5263
 
5264
+ const rpcs = new Map();
5265
+ const viewRpcIds = new Map();
5266
+ const get = uid => {
5267
+ const rpcId = viewRpcIds.get(uid);
5268
+ return rpcId === undefined ? undefined : rpcs.get(rpcId);
5269
+ };
5270
+ const registerRpc = (rpcId, rpc) => {
5271
+ const previous = rpcs.get(rpcId);
5272
+ if (previous && previous !== rpc) {
5273
+ previous.dispose();
5274
+ }
5275
+ rpcs.set(rpcId, rpc);
5276
+ };
5277
+ const registerView = (uid, rpcId) => {
5278
+ if (rpcId === undefined) {
5279
+ viewRpcIds.delete(uid);
5280
+ return;
5281
+ }
5282
+ viewRpcIds.set(uid, rpcId);
5283
+ };
5284
+ const unregisterView = uid => {
5285
+ viewRpcIds.delete(uid);
5286
+ };
5287
+
5294
5288
  const state$4 = {
5295
5289
  currentDragInfo: undefined
5296
5290
  };
@@ -5486,6 +5480,23 @@ const ViewletActivityBar = {
5486
5480
  Events: Events$6
5487
5481
  };
5488
5482
 
5483
+ const executeViewletCommand$1 = 'Viewlet.executeViewletCommand';
5484
+ const send = (method, uid, ...args) => {
5485
+ if (method === executeViewletCommand$1) {
5486
+ const rpc = get(uid);
5487
+ if (rpc) {
5488
+ rpc.send(method, uid, ...args);
5489
+ return;
5490
+ }
5491
+ }
5492
+ send$1(method, uid, ...args);
5493
+ };
5494
+
5495
+ const ViewletEventRouter = {
5496
+ __proto__: null,
5497
+ send
5498
+ };
5499
+
5489
5500
  const executeViewletCommand = (uid, command, ...args) => {
5490
5501
  number(uid);
5491
5502
  send('Viewlet.executeViewletCommand', uid, command, ...args);
@@ -5667,7 +5678,7 @@ const applyUidWorkaround = element => {
5667
5678
  if (!editor) {
5668
5679
  throw new Error('no editor found');
5669
5680
  }
5670
- const editorUid = get$3(editor);
5681
+ const editorUid = get$4(editor);
5671
5682
  set$5(element, editorUid);
5672
5683
  };
5673
5684
 
@@ -5690,7 +5701,7 @@ const create$o = (pointerDown, pointerMove, pointerUp) => {
5690
5701
  return;
5691
5702
  }
5692
5703
  const uid = fromEvent(event);
5693
- send('Viewlet.executeViewletCommand', uid, ...message);
5704
+ send$1('Viewlet.executeViewletCommand', uid, ...message);
5694
5705
  };
5695
5706
  const handlePointerMove = event => {
5696
5707
  shared(pointerMove, event);
@@ -5867,7 +5878,7 @@ const ViewletDefineKeyBinding = {
5867
5878
  };
5868
5879
 
5869
5880
  const handleClick$5 = index => {
5870
- send(/* Dialog.handleClick */'Dialog.handleClick', /* index */index);
5881
+ send$1(/* Dialog.handleClick */'Dialog.handleClick', /* index */index);
5871
5882
  };
5872
5883
 
5873
5884
  const handleClick$4 = event => {
@@ -6142,7 +6153,7 @@ const sendToIframe = (contentWindow, message, origin, transfer) => {
6142
6153
  const handleLoad$1 = event => {
6143
6154
  // eslint-disable-next-line no-console
6144
6155
  console.log(event.target.src);
6145
- send('E2eTests.handleLoad');
6156
+ send$1('E2eTests.handleLoad');
6146
6157
  };
6147
6158
  const setIframe$2 = (state, src, sandbox = []) => {
6148
6159
  if (!src) {
@@ -7151,9 +7162,9 @@ const handleLocationsMouseDown = event => {
7151
7162
  const $Target = event.target;
7152
7163
  if ($Target.classList.contains('TreeItem')) {
7153
7164
  const index = getNodeIndex($Target);
7154
- send(/* ViewletLocations.selectIndex */'Locations.selectIndex', /* index */index);
7165
+ send$1(/* ViewletLocations.selectIndex */'Locations.selectIndex', /* index */index);
7155
7166
  } else if ($Target.classList.contains('LocationList')) {
7156
- send(/* ViewletLocations.focusIndex */'Locations.focusIndex', /* index */-1);
7167
+ send$1(/* ViewletLocations.focusIndex */'Locations.focusIndex', /* index */-1);
7157
7168
  }
7158
7169
  };
7159
7170
 
@@ -7191,7 +7202,7 @@ const focus$8 = state => {
7191
7202
  } = state;
7192
7203
  $Locations.classList.add('FocusOutline');
7193
7204
  $Locations.focus();
7194
- send('Focus.setFocus', FocusLocationList);
7205
+ send$1('Focus.setFocus', FocusLocationList);
7195
7206
  };
7196
7207
 
7197
7208
  const ViewletImplementations = {
@@ -7344,7 +7355,7 @@ const isMatchingKeyBinding = (identifiers, identifier) => {
7344
7355
  };
7345
7356
 
7346
7357
  const handleMatchingKeyBinding = identifier => {
7347
- send(/* KeyBindings.handleKeyBinding */'KeyBindings.handleKeyBinding', /* keyBinding */identifier);
7358
+ send$1(/* KeyBindings.handleKeyBinding */'KeyBindings.handleKeyBinding', /* keyBinding */identifier);
7348
7359
  };
7349
7360
  const isNativeButtonActivation = event => {
7350
7361
  const {
@@ -7376,27 +7387,27 @@ const handleKeyDown$1 = event => {
7376
7387
  const handleKeyUp$1 = event => {};
7377
7388
 
7378
7389
  const handleSashPointerMove$1 = (x, y) => {
7379
- send('Layout.handleSashPointerMove', x, y);
7390
+ send$1('Layout.handleSashPointerMove', x, y);
7380
7391
  };
7381
7392
  const handleSashPointerDown$1 = id => {
7382
- send('Layout.handleSashPointerDown', id);
7393
+ send$1('Layout.handleSashPointerDown', id);
7383
7394
  };
7384
7395
 
7385
7396
  // TODO send component uid
7386
7397
  const handleSashPointerUp = id => {
7387
- send('Layout.handleSashPointerUp', id);
7398
+ send$1('Layout.handleSashPointerUp', id);
7388
7399
  };
7389
7400
  const handleSashDoubleClick$1 = id => {
7390
- send('Layout.handleSashDoubleClick', id);
7401
+ send$1('Layout.handleSashDoubleClick', id);
7391
7402
  };
7392
7403
  const handleResize$1 = (width, height) => {
7393
- send('Layout.handleResize', width, height);
7404
+ send$1('Layout.handleResize', width, height);
7394
7405
  };
7395
7406
  const handleFocus$3 = () => {
7396
- send('Layout.handleFocus');
7407
+ send$1('Layout.handleFocus');
7397
7408
  };
7398
7409
  const handleBlur$3 = () => {
7399
- send('Layout.handleBlur');
7410
+ send$1('Layout.handleBlur');
7400
7411
  };
7401
7412
 
7402
7413
  const handleSashPointerMove = event => {
@@ -7593,7 +7604,7 @@ const handleError$2 = (state, error) => {
7593
7604
  const focus$7 = state => {
7594
7605
  object(state);
7595
7606
  focus$e(state.$ViewletOutputContent);
7596
- send('Focus.setFocus', FocusOutput);
7607
+ send$1('Focus.setFocus', FocusOutput);
7597
7608
  };
7598
7609
 
7599
7610
  // TODO handle case when output is opened -> find widget is opened -> output is disposed before find widget is ready
@@ -7641,7 +7652,7 @@ const handleClickAction$1 = target => {
7641
7652
  console.info('[panel] action command not found');
7642
7653
  return;
7643
7654
  }
7644
- const childUid = get$3(target);
7655
+ const childUid = get$4(target);
7645
7656
  handleClickAction$2(childUid, index, command);
7646
7657
  };
7647
7658
  const handleHeaderClick$1 = event => {
@@ -7767,7 +7778,7 @@ const setActionsDom$1 = (state, actions, childUid) => {
7767
7778
  const {
7768
7779
  $PanelActions
7769
7780
  } = state;
7770
- const instance = get$8(childUid);
7781
+ const instance = get$9(childUid);
7771
7782
  if (!instance) {
7772
7783
  throw new Error(`child instance not found`);
7773
7784
  }
@@ -7820,7 +7831,7 @@ const setScreenCapture = (state, id) => {
7820
7831
  $Viewlet
7821
7832
  } = state;
7822
7833
  const $Video = document.createElement('video');
7823
- const screenCapture = get$1(id);
7834
+ const screenCapture = get$2(id);
7824
7835
  $Video.srcObject = screenCapture;
7825
7836
  $Video.onloadedmetadata = handleLoadedMetadata;
7826
7837
  $Viewlet.append($Video);
@@ -7924,22 +7935,22 @@ const ViewletSidebar = {
7924
7935
  };
7925
7936
 
7926
7937
  const handleInput$3 = value => {
7927
- send('SimpleBrowser.handleInput', value);
7938
+ send$1('SimpleBrowser.handleInput', value);
7928
7939
  };
7929
7940
  const forward = () => {
7930
- send('SimpleBrowser.forward');
7941
+ send$1('SimpleBrowser.forward');
7931
7942
  };
7932
7943
  const backward = () => {
7933
- send('SimpleBrowser.backward');
7944
+ send$1('SimpleBrowser.backward');
7934
7945
  };
7935
7946
  const reload$1 = () => {
7936
- send('SimpleBrowser.reload');
7947
+ send$1('SimpleBrowser.reload');
7937
7948
  };
7938
7949
  const cancelNavigation = () => {
7939
- send('SimpleBrowser.cancelNavigation');
7950
+ send$1('SimpleBrowser.cancelNavigation');
7940
7951
  };
7941
7952
  const openExternal = () => {
7942
- send('SimpleBrowser.openExternal');
7953
+ send$1('SimpleBrowser.openExternal');
7943
7954
  };
7944
7955
 
7945
7956
  const handleInput$2 = event => {
@@ -7955,7 +7966,7 @@ const handleFocus$1 = event => {
7955
7966
  const {
7956
7967
  target
7957
7968
  } = event;
7958
- send('Focus.setFocus', FocusSimpleBrowserInput);
7969
+ send$1('Focus.setFocus', FocusSimpleBrowserInput);
7959
7970
  setTimeout(() => {
7960
7971
  target.select();
7961
7972
  });
@@ -8199,7 +8210,7 @@ const handleMouseDown$1 = event => {
8199
8210
  if (!terminal) {
8200
8211
  return;
8201
8212
  }
8202
- const terminalUid = get$3(terminal);
8213
+ const terminalUid = get$4(terminal);
8203
8214
  if (!terminalUid) {
8204
8215
  return;
8205
8216
  }
@@ -8662,7 +8673,7 @@ const ViewletTitleBarTitle = {
8662
8673
  };
8663
8674
 
8664
8675
  const handleVideoError$1 = (code, message) => {
8665
- send('Video.handleVideoError', code, message);
8676
+ send$1('Video.handleVideoError', code, message);
8666
8677
  };
8667
8678
 
8668
8679
  const handleVideoError = event => {
@@ -8763,7 +8774,7 @@ const setPort$1 = (state, portId, origin) => {
8763
8774
  });
8764
8775
  };
8765
8776
  const setPosition = (state, id, x, y, width, height) => {
8766
- const $Iframe = get(id);
8777
+ const $Iframe = get$1(id);
8767
8778
  if (!$Iframe) {
8768
8779
  return;
8769
8780
  }
@@ -8848,7 +8859,7 @@ const create$2 = (id, uid = id) => {
8848
8859
  if (!module) {
8849
8860
  throw new Error(`module not found: ${id}`);
8850
8861
  }
8851
- const existing = get$8(id);
8862
+ const existing = get$9(id);
8852
8863
  if (existing?.state.$Viewlet.isConnected) {
8853
8864
  existing.state.$Viewlet.remove();
8854
8865
  }
@@ -8862,7 +8873,7 @@ const create$2 = (id, uid = id) => {
8862
8873
  state: instanceState
8863
8874
  });
8864
8875
  };
8865
- const createFunctionalRoot = (id, uid = id, hasFunctionalEvents) => {
8876
+ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId) => {
8866
8877
  let module = state$1.modules[id];
8867
8878
  if (hasFunctionalEvents) {
8868
8879
  module ||= {};
@@ -8870,7 +8881,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents) => {
8870
8881
  if (!module) {
8871
8882
  throw new Error(`module not found: ${id}`);
8872
8883
  }
8873
- const existing = get$8(id);
8884
+ const existing = get$9(id);
8874
8885
  if (existing?.state.$Viewlet.isConnected) {
8875
8886
  existing.state.$Viewlet.remove();
8876
8887
  }
@@ -8878,6 +8889,7 @@ const createFunctionalRoot = (id, uid = id, hasFunctionalEvents) => {
8878
8889
  $Viewlet: document.createElement('div')
8879
8890
  };
8880
8891
  set$5(instanceState.$Viewlet, uid);
8892
+ registerView(uid, directEventRpcId);
8881
8893
  set$a(uid, {
8882
8894
  factory: module,
8883
8895
  state: instanceState
@@ -8901,7 +8913,7 @@ const loadModule = async id => {
8901
8913
  };
8902
8914
  const invoke = (viewletId, method, ...args) => {
8903
8915
  string(method);
8904
- const instance = get$8(viewletId);
8916
+ const instance = get$9(viewletId);
8905
8917
  if (!instance?.factory) {
8906
8918
  if (viewletId && method !== 'setActionsDom') {
8907
8919
  warn$1(`cannot execute ${method} viewlet instance ${viewletId} not found`);
@@ -8919,7 +8931,7 @@ const focus$1 = viewletId => {
8919
8931
  // eslint-disable-next-line no-console
8920
8932
  console.trace(`focus ${viewletId}`);
8921
8933
  }
8922
- const instance = get$8(viewletId);
8934
+ const instance = get$9(viewletId);
8923
8935
  if (instance.factory?.setFocused) {
8924
8936
  instance.factory.setFocused(instance.state, true);
8925
8937
  } else if (instance?.factory?.focus) {
@@ -8935,7 +8947,7 @@ const focusElementByName = (viewletId, name) => {
8935
8947
  // eslint-disable-next-line no-console
8936
8948
  console.trace(`focusByName ${viewletId} ${name}`);
8937
8949
  }
8938
- const instance = get$8(viewletId);
8950
+ const instance = get$9(viewletId);
8939
8951
  if (!instance) {
8940
8952
  return;
8941
8953
  }
@@ -8950,7 +8962,7 @@ const focusElementByName = (viewletId, name) => {
8950
8962
  };
8951
8963
  const setElementProperty = (viewletId, name, key, value) => {
8952
8964
  const selector = `[name="${name}"]`;
8953
- const instance = get$8(viewletId);
8965
+ const instance = get$9(viewletId);
8954
8966
  if (!instance) {
8955
8967
  return;
8956
8968
  }
@@ -8979,7 +8991,7 @@ const setCheckboxValue = (viewletId, name, value) => {
8979
8991
  };
8980
8992
  const setSelectionByName = (viewletId, name, start, end) => {
8981
8993
  const selector = `[name="${name}"]`;
8982
- const instance = get$8(viewletId);
8994
+ const instance = get$9(viewletId);
8983
8995
  if (!instance) {
8984
8996
  return;
8985
8997
  }
@@ -8994,7 +9006,7 @@ const setSelectionByName = (viewletId, name, start, end) => {
8994
9006
  $Element.selectionEnd = end;
8995
9007
  };
8996
9008
  const setUid = (viewletId, uid) => {
8997
- const instance = get$8(viewletId);
9009
+ const instance = get$9(viewletId);
8998
9010
  if (!instance) {
8999
9011
  return;
9000
9012
  }
@@ -9012,7 +9024,7 @@ const resetFocusCallback = () => {
9012
9024
  focusCallback.selector = '';
9013
9025
  };
9014
9026
  const focusSelector = (viewletId, selector) => {
9015
- const instance = get$8(viewletId);
9027
+ const instance = get$9(viewletId);
9016
9028
  if (!instance) {
9017
9029
  return;
9018
9030
  }
@@ -9044,7 +9056,7 @@ const focusSelectorAfterRender = (viewletId, selector) => {
9044
9056
  * @deprecated
9045
9057
  */
9046
9058
  const refresh = (viewletId, viewletContext) => {
9047
- const instance = get$8(viewletId);
9059
+ const instance = get$9(viewletId);
9048
9060
  if (instance) {
9049
9061
  instance.factory.refresh(instance.state, viewletContext);
9050
9062
  } else {
@@ -9063,7 +9075,7 @@ const createPlaceholder = (viewletId, parentId, top, left, width, height) => {
9063
9075
  if (isSpecial(viewletId)) {
9064
9076
  $Placeholder.id = viewletId;
9065
9077
  }
9066
- const parentInstance = get$8(parentId);
9078
+ const parentInstance = get$9(parentId);
9067
9079
  const $Parent = parentInstance.state.$Viewlet;
9068
9080
  $Parent.append($Placeholder);
9069
9081
  set$a(viewletId, {
@@ -9079,7 +9091,7 @@ const getDragData = () => {
9079
9091
  return getCurrent();
9080
9092
  };
9081
9093
  const setDom = (viewletId, dom) => {
9082
- const instance = get$8(viewletId);
9094
+ const instance = get$9(viewletId);
9083
9095
  if (!instance) {
9084
9096
  return;
9085
9097
  }
@@ -9092,7 +9104,7 @@ const setDom = (viewletId, dom) => {
9092
9104
  renderInto($Viewlet, dom, Events);
9093
9105
  };
9094
9106
  const setDom2 = (viewletId, dom) => {
9095
- const instance = get$8(viewletId);
9107
+ const instance = get$9(viewletId);
9096
9108
  if (!instance) {
9097
9109
  return;
9098
9110
  }
@@ -9105,7 +9117,7 @@ const setDom2 = (viewletId, dom) => {
9105
9117
  let uid;
9106
9118
  if ($Viewlet) {
9107
9119
  try {
9108
- uid = get$3($Viewlet);
9120
+ uid = get$4($Viewlet);
9109
9121
  } catch {}
9110
9122
  }
9111
9123
  // TODO optimize rendering with virtual DOM diffing
@@ -9123,7 +9135,7 @@ const setDom2 = (viewletId, dom) => {
9123
9135
  });
9124
9136
  };
9125
9137
  const setPatches = (uid, patches) => {
9126
- const instance = get$8(uid);
9138
+ const instance = get$9(uid);
9127
9139
  if (!instance) {
9128
9140
  return;
9129
9141
  }
@@ -9194,7 +9206,8 @@ const commitPending = (uid, transactionId) => {
9194
9206
  const dispose$3 = id => {
9195
9207
  try {
9196
9208
  number(id);
9197
- const instance = get$8(id);
9209
+ unregisterView(id);
9210
+ const instance = get$9(id);
9198
9211
  if (!instance) {
9199
9212
  warn$1(`viewlet instance ${id} not found and cannot be disposed`);
9200
9213
  return;
@@ -9213,7 +9226,7 @@ const dispose$3 = id => {
9213
9226
  };
9214
9227
  const handleError$1 = (id, parentId, message) => {
9215
9228
  info(`[viewlet-error] ${id}: ${message}`);
9216
- const instance = get$8(id);
9229
+ const instance = get$9(id);
9217
9230
  if (instance?.state.$Viewlet.isConnected) {
9218
9231
  instance.state.$Viewlet.remove();
9219
9232
  }
@@ -9225,7 +9238,7 @@ const handleError$1 = (id, parentId, message) => {
9225
9238
  instance.state.$Viewlet.textContent = String(message);
9226
9239
  }
9227
9240
  // TODO error should bubble up to until highest possible component
9228
- const parentInstance = get$8(parentId);
9241
+ const parentInstance = get$9(parentId);
9229
9242
  if (parentInstance?.factory?.handleError) {
9230
9243
  parentInstance.factory.handleError(instance.state, message);
9231
9244
  }
@@ -9239,9 +9252,9 @@ const appendViewlet = (parentId, childId, focus) => {
9239
9252
  // TODO
9240
9253
  return;
9241
9254
  }
9242
- const parentInstanceState = get$8(parentId); // TODO must ensure that parent is already created
9255
+ const parentInstanceState = get$9(parentId); // TODO must ensure that parent is already created
9243
9256
  const parentModule = parentInstanceState.factory;
9244
- const childInstance = get$8(childId);
9257
+ const childInstance = get$9(childId);
9245
9258
  if (!childInstance) {
9246
9259
  throw new Error(`child instance ${childId} must be defined to be appended to parent ${parentId}`);
9247
9260
  }
@@ -9265,7 +9278,7 @@ const prependChild = ($Parent, $Child) => {
9265
9278
  const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
9266
9279
  for (let i = childIndex - 1; i >= 0; i--) {
9267
9280
  const beforeId = referenceNodes[i];
9268
- const beforeInstance = get$8(beforeId);
9281
+ const beforeInstance = get$9(beforeId);
9269
9282
  if (beforeInstance) {
9270
9283
  const $ReferenceNode = beforeInstance.state.$Viewlet;
9271
9284
  $ReferenceNode.after($Child);
@@ -9277,7 +9290,7 @@ const appendAfterPreviousReference = (referenceNodes, childIndex, $Child) => {
9277
9290
  const appendBeforeNextReference = (referenceNodes, childIndex, $Child) => {
9278
9291
  for (let i = childIndex + 1; i < referenceNodes.length; i++) {
9279
9292
  const afterId = referenceNodes[i];
9280
- const afterInstance = get$8(afterId);
9293
+ const afterInstance = get$9(afterId);
9281
9294
  if (afterInstance) {
9282
9295
  const $ReferenceNode = afterInstance.state.$Viewlet;
9283
9296
  $ReferenceNode.before($Child);
@@ -9307,12 +9320,12 @@ const appendWithReferenceNodes = ($Parent, $Child, childId, referenceNodes) => {
9307
9320
  const append = (parentId, childId, referenceNodes) => {
9308
9321
  number(parentId);
9309
9322
  number(childId);
9310
- const parentInstance = get$8(parentId);
9323
+ const parentInstance = get$9(parentId);
9311
9324
  if (!parentInstance) {
9312
9325
  throw new Error(`cannot append child: instance ${parentId} not found`);
9313
9326
  }
9314
9327
  const $Parent = parentInstance.state.$Viewlet;
9315
- const childInstance = get$8(childId);
9328
+ const childInstance = get$9(childId);
9316
9329
  if (!childInstance) {
9317
9330
  throw new Error(`cannot append child: child instance not found ${childId}`);
9318
9331
  }
@@ -9331,11 +9344,11 @@ const append = (parentId, childId, referenceNodes) => {
9331
9344
  applyLateFocusMaybe();
9332
9345
  };
9333
9346
  const replaceChildren = (parentId, childIds) => {
9334
- const parentInstance = get$8(parentId);
9347
+ const parentInstance = get$9(parentId);
9335
9348
  const $Parent = parentInstance.state.$Viewlet;
9336
9349
  const $Fragment = document.createDocumentFragment();
9337
9350
  for (const childId of childIds) {
9338
- const childInstance = get$8(childId);
9351
+ const childInstance = get$9(childId);
9339
9352
  const $Child = childInstance.state.$Viewlet;
9340
9353
  $Fragment.append($Child);
9341
9354
  }
@@ -9350,7 +9363,7 @@ const applyLateFocusMaybe = () => {
9350
9363
  selector
9351
9364
  } = focusCallback;
9352
9365
  resetFocusCallback();
9353
- const instance = get$8(id);
9366
+ const instance = get$9(id);
9354
9367
  if (instance) {
9355
9368
  const {
9356
9369
  $Viewlet
@@ -9363,7 +9376,7 @@ const applyLateFocusMaybe = () => {
9363
9376
  };
9364
9377
  const appendToBody = childId => {
9365
9378
  const $Parent = document.body;
9366
- const childInstance = get$8(childId);
9379
+ const childInstance = get$9(childId);
9367
9380
  const $Child = childInstance.state.$Viewlet;
9368
9381
  $Parent.append($Child);
9369
9382
  applyLateFocusMaybe();
@@ -9376,7 +9389,7 @@ const executeCommands = commands => {
9376
9389
  }
9377
9390
  };
9378
9391
  const show = id => {
9379
- const instance = get$8(id);
9392
+ const instance = get$9(id);
9380
9393
  const $Viewlet = instance.state.$Viewlet;
9381
9394
  const $Workbench = document.getElementById('Workbench');
9382
9395
  // @ts-expect-error
@@ -9386,7 +9399,7 @@ const show = id => {
9386
9399
  }
9387
9400
  };
9388
9401
  const setBounds$1 = (id, left, top, width, height) => {
9389
- const instance = get$8(id);
9402
+ const instance = get$9(id);
9390
9403
  if (!instance) {
9391
9404
  return;
9392
9405
  }
@@ -9394,7 +9407,7 @@ const setBounds$1 = (id, left, top, width, height) => {
9394
9407
  setBounds$a($Viewlet, left, top, width, height);
9395
9408
  };
9396
9409
  const setProperty = (id, selector, property, value) => {
9397
- const instance = get$8(id);
9410
+ const instance = get$9(id);
9398
9411
  if (!instance) {
9399
9412
  return;
9400
9413
  }
@@ -9502,13 +9515,13 @@ const toggleFullScreen = () => {
9502
9515
  return document.documentElement.requestFullscreen();
9503
9516
  };
9504
9517
  const handleFullScreenChange = isFullScreen => {
9505
- send('Layout.handleFullScreenChange', isFullScreen);
9518
+ send$1('Layout.handleFullScreenChange', isFullScreen);
9506
9519
  };
9507
9520
  const handleDocumentFullScreenChange = () => {
9508
9521
  handleFullScreenChange(Boolean(document.fullscreenElement));
9509
9522
  };
9510
9523
  const sendVisibilityChangeHint = () => {
9511
- send(/* SaveState.handleVisibilityChange */'SaveState.handleVisibilityChange', /* visibilityState */'hidden');
9524
+ send$1(/* SaveState.handleVisibilityChange */'SaveState.handleVisibilityChange', /* visibilityState */'hidden');
9512
9525
  };
9513
9526
  const handleBeforeUnload = () => {
9514
9527
  sendVisibilityChangeHint();
@@ -9559,13 +9572,16 @@ const getFilePathElectron = async file => {
9559
9572
  return filePath;
9560
9573
  };
9561
9574
 
9562
- const handleMessagePort = async port => {
9563
- await create$x({
9575
+ const handleMessagePort = async (port, rpcId) => {
9576
+ const rpc = await create$x({
9564
9577
  commandMap: {
9565
9578
  'Viewlet.queueCommands': queueCommands
9566
9579
  },
9567
9580
  messagePort: port
9568
9581
  });
9582
+ if (rpcId !== undefined) {
9583
+ registerRpc(rpcId, rpc);
9584
+ }
9569
9585
  };
9570
9586
 
9571
9587
  const set = ($Iframe, permissionPolicy) => {
@@ -9603,12 +9619,12 @@ const create$1 = async (uid, src, sandbox, csp, credentialless, permissionPolicy
9603
9619
  // TODO make make waitForFrameToLoad a separate command
9604
9620
  };
9605
9621
  const loadOnly = async uid => {
9606
- const $Iframe = get(uid);
9622
+ const $Iframe = get$1(uid);
9607
9623
  const promise = waitForFrameToLoad($Iframe);
9608
9624
  await promise;
9609
9625
  };
9610
9626
  const appendOnly = async uid => {
9611
- const $Iframe = get(uid);
9627
+ const $Iframe = get$1(uid);
9612
9628
  const parent = document.getElementById('Workbench');
9613
9629
  parent.append($Iframe);
9614
9630
  };
@@ -9617,7 +9633,7 @@ const appendOnly = async uid => {
9617
9633
  * @deprecated use loadOnly and appendOnly instead
9618
9634
  */
9619
9635
  const load = async uid => {
9620
- const $Iframe = get(uid);
9636
+ const $Iframe = get$1(uid);
9621
9637
  const promise = waitForFrameToLoad($Iframe);
9622
9638
  const parent = document.getElementById('Workbench');
9623
9639
  parent.append($Iframe);
@@ -9626,7 +9642,7 @@ const load = async uid => {
9626
9642
 
9627
9643
  // TODO rename to sendMessage
9628
9644
  const setPort = (uid, port, origin, portType) => {
9629
- const $Iframe = get(uid);
9645
+ const $Iframe = get$1(uid);
9630
9646
  // TODO use jsonrpc invoke
9631
9647
  const {
9632
9648
  contentWindow
@@ -9641,7 +9657,7 @@ const setPort = (uid, port, origin, portType) => {
9641
9657
  }, origin, [port]);
9642
9658
  };
9643
9659
  const dispose$2 = uid => {
9644
- const $Iframe = get(uid);
9660
+ const $Iframe = get$1(uid);
9645
9661
  $Iframe.remove();
9646
9662
  remove(uid);
9647
9663
  };
@@ -9659,7 +9675,7 @@ const queryAudio = (uid, elementLocator) => {
9659
9675
  // @ts-ignore
9660
9676
  return remoteAudio;
9661
9677
  }
9662
- const $Viewlet = get$8(uid);
9678
+ const $Viewlet = get$9(uid);
9663
9679
  const remoteAudio = $Viewlet.querySelector(elementLocator);
9664
9680
  if (!remoteAudio) {
9665
9681
  console.error('[webrtc] audio element not found');
@@ -9834,7 +9850,7 @@ const commandMap = {
9834
9850
  'Css.getSelectionText': getSelectionText,
9835
9851
  'Developer.showState': showState,
9836
9852
  'Download.downloadFile': downloadFile,
9837
- 'FileHandles.get': get$6,
9853
+ 'FileHandles.get': get$7,
9838
9854
  'FilePicker.showDirectoryPicker': showDirectoryPicker,
9839
9855
  'FilePicker.showFilePicker': showFilePicker,
9840
9856
  'FilePicker.showSaveFilePicker': showSaveFilePicker,
@@ -10394,7 +10410,7 @@ const main = async () => {
10394
10410
  await handleError(launchWorkersResult.error, true);
10395
10411
  return;
10396
10412
  }
10397
- setIpc(RendererWorker);
10413
+ setIpc(ViewletEventRouter);
10398
10414
  };
10399
10415
 
10400
10416
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.33.5",
3
+ "version": "30.34.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"