@lvce-editor/main-process 6.40.0 → 6.41.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.
@@ -4791,7 +4791,7 @@ const windows = new Map();
4791
4791
  const setEnabled = (windowId, enabled) => {
4792
4792
  windows.get(windowId)?.setEnabled(enabled);
4793
4793
  };
4794
- const attach$d = (window, contents) => {
4794
+ const attach$e = (window, contents) => {
4795
4795
  windows.get(window.id)?.attach(contents);
4796
4796
  };
4797
4797
  const listen$2 = (window, rpc) => {
@@ -6442,7 +6442,7 @@ const handleWebContentsViewZoomKeyBinding = (webContentsId, input) => {
6442
6442
  };
6443
6443
 
6444
6444
  const key$a = 'before-input';
6445
- const attach$c = (webContents, listener) => {
6445
+ const attach$d = (webContents, listener) => {
6446
6446
  webContents.on(BeforeInputEvent, listener);
6447
6447
  };
6448
6448
  const detach$a = (webContents, listener) => {
@@ -6482,14 +6482,14 @@ const handler$a = (event, input, webContentsId) => {
6482
6482
 
6483
6483
  const ElectronBrowserViewEventListenerBeforeInput = {
6484
6484
  __proto__: null,
6485
- attach: attach$c,
6485
+ attach: attach$d,
6486
6486
  detach: detach$a,
6487
6487
  handler: handler$a,
6488
6488
  key: key$a
6489
6489
  };
6490
6490
 
6491
6491
  const key$9 = AudioStateChanged;
6492
- const attach$b = (webContents, listener) => {
6492
+ const attach$c = (webContents, listener) => {
6493
6493
  webContents.on(AudioStateChanged, listener);
6494
6494
  };
6495
6495
  const detach$9 = (webContents, listener) => {
@@ -6504,29 +6504,32 @@ const handler$9 = event => {
6504
6504
 
6505
6505
  const ElectronBrowserViewEventListenerAudioStateChanged = {
6506
6506
  __proto__: null,
6507
- attach: attach$b,
6507
+ attach: attach$c,
6508
6508
  detach: detach$9,
6509
6509
  handler: handler$9,
6510
6510
  key: key$9
6511
6511
  };
6512
6512
 
6513
6513
  const key$8 = 'context-menu';
6514
- const attach$a = (webContents, listener) => {
6514
+ const attach$b = (webContents, listener) => {
6515
6515
  webContents.on(ContextMenu, listener);
6516
6516
  };
6517
6517
  const detach$8 = (webContents, listener) => {
6518
6518
  webContents.off(ContextMenu, listener);
6519
6519
  };
6520
- const handler$8 = (event, params) => {
6520
+ const handler$8 = (event, params, browserViewId) => {
6521
6521
  return {
6522
- messages: [['handleContextMenu', params]],
6522
+ messages: [['handleContextMenu', {
6523
+ ...params,
6524
+ browserViewId
6525
+ }]],
6523
6526
  result: undefined
6524
6527
  };
6525
6528
  };
6526
6529
 
6527
6530
  const ElectronBrowserViewEventListenerContextMenu = {
6528
6531
  __proto__: null,
6529
- attach: attach$a,
6532
+ attach: attach$b,
6530
6533
  detach: detach$8,
6531
6534
  handler: handler$8,
6532
6535
  key: key$8
@@ -6566,7 +6569,7 @@ const cancelForWebContents = webContentsId => {
6566
6569
  };
6567
6570
 
6568
6571
  const key$7 = 'destroyed';
6569
- const attach$9 = (webContents, listener) => {
6572
+ const attach$a = (webContents, listener) => {
6570
6573
  webContents.on(Destroyed, listener);
6571
6574
  };
6572
6575
  const detach$7 = (webContents, listener) => {
@@ -6594,7 +6597,7 @@ const handler$7 = (_event, webContentsId) => {
6594
6597
 
6595
6598
  const ElectronBrowserViewEventListenerDestroyed = {
6596
6599
  __proto__: null,
6597
- attach: attach$9,
6600
+ attach: attach$a,
6598
6601
  detach: detach$7,
6599
6602
  handler: handler$7,
6600
6603
  key: key$7
@@ -6611,7 +6614,7 @@ const has = (webContents, url) => {
6611
6614
  const maxFaviconBytes = 1024 * 1024;
6612
6615
  const faviconFetchTimeout = 2000;
6613
6616
  const key$6 = PageFaviconUpdated;
6614
- const attach$8 = (webContents, listener) => {
6617
+ const attach$9 = (webContents, listener) => {
6615
6618
  webContents.on(PageFaviconUpdated, listener);
6616
6619
  };
6617
6620
  const detach$6 = (webContents, listener) => {
@@ -6701,7 +6704,7 @@ const handler$6 = async (_event, favicons, _webContentsId, webContents) => {
6701
6704
 
6702
6705
  const ElectronBrowserViewEventListenerPageFaviconUpdated = {
6703
6706
  __proto__: null,
6704
- attach: attach$8,
6707
+ attach: attach$9,
6705
6708
  detach: detach$6,
6706
6709
  handler: handler$6,
6707
6710
  key: key$6,
@@ -6709,7 +6712,7 @@ const ElectronBrowserViewEventListenerPageFaviconUpdated = {
6709
6712
  };
6710
6713
 
6711
6714
  const key$5 = 'did-navigate';
6712
- const attach$7 = (webContents, listener) => {
6715
+ const attach$8 = (webContents, listener) => {
6713
6716
  webContents.on(DidNavigate, listener);
6714
6717
  };
6715
6718
  const detach$5 = (webContents, listener) => {
@@ -6746,14 +6749,14 @@ const handler$5 = async (_event, url, _httpResponseCode, _httpStatusText, _webCo
6746
6749
 
6747
6750
  const ElectronBrowserViewEventListenerDidNavigate = {
6748
6751
  __proto__: null,
6749
- attach: attach$7,
6752
+ attach: attach$8,
6750
6753
  detach: detach$5,
6751
6754
  handler: handler$5,
6752
6755
  key: key$5
6753
6756
  };
6754
6757
 
6755
6758
  const key$4 = DidNavigateInPage;
6756
- const attach$6 = (webContents, listener) => {
6759
+ const attach$7 = (webContents, listener) => {
6757
6760
  webContents.on(DidNavigateInPage, listener);
6758
6761
  };
6759
6762
  const detach$4 = (webContents, listener) => {
@@ -6769,14 +6772,14 @@ const handler$4 = (_event, url, isMainFrame) => {
6769
6772
 
6770
6773
  const ElectronBrowserViewEventListenerDidNavigateInPage = {
6771
6774
  __proto__: null,
6772
- attach: attach$6,
6775
+ attach: attach$7,
6773
6776
  detach: detach$4,
6774
6777
  handler: handler$4,
6775
6778
  key: key$4
6776
6779
  };
6777
6780
 
6778
6781
  const key$3 = Login;
6779
- const attach$5 = (webContents, listener) => {
6782
+ const attach$6 = (webContents, listener) => {
6780
6783
  webContents.on(Login, listener);
6781
6784
  };
6782
6785
  const detach$3 = (webContents, listener) => {
@@ -6801,14 +6804,14 @@ const handler$3 = (event, authenticationResponseDetails, authInfo, callback, web
6801
6804
 
6802
6805
  const ElectronBrowserViewEventListenerLogin = {
6803
6806
  __proto__: null,
6804
- attach: attach$5,
6807
+ attach: attach$6,
6805
6808
  detach: detach$3,
6806
6809
  handler: handler$3,
6807
6810
  key: key$3
6808
6811
  };
6809
6812
 
6810
6813
  const key$2 = 'page-title-updated';
6811
- const attach$4 = (webContents, listener) => {
6814
+ const attach$5 = (webContents, listener) => {
6812
6815
  webContents.on(PageTitleUpdated, listener);
6813
6816
  };
6814
6817
  const detach$2 = (webContents, listener) => {
@@ -6823,14 +6826,14 @@ const handler$2 = (event, title) => {
6823
6826
 
6824
6827
  const ElectronBrowserViewEventListenerPageTitleUpdated = {
6825
6828
  __proto__: null,
6826
- attach: attach$4,
6829
+ attach: attach$5,
6827
6830
  detach: detach$2,
6828
6831
  handler: handler$2,
6829
6832
  key: key$2
6830
6833
  };
6831
6834
 
6832
6835
  const key$1 = 'will-navigate';
6833
- const attach$3 = (webContents, listener) => {
6836
+ const attach$4 = (webContents, listener) => {
6834
6837
  webContents.on(WillNavigate, listener);
6835
6838
  };
6836
6839
  const detach$1 = (webContents, listener) => {
@@ -6845,14 +6848,14 @@ const handler$1 = (event, url) => {
6845
6848
 
6846
6849
  const ElectronBrowserViewEventListenerWillNavigate = {
6847
6850
  __proto__: null,
6848
- attach: attach$3,
6851
+ attach: attach$4,
6849
6852
  detach: detach$1,
6850
6853
  handler: handler$1,
6851
6854
  key: key$1
6852
6855
  };
6853
6856
 
6854
6857
  const key = 'window-open';
6855
- const attach$2 = (webContents, listener) => {
6858
+ const attach$3 = (webContents, listener) => {
6856
6859
  webContents.setWindowOpenHandler(listener);
6857
6860
  };
6858
6861
  const detach = (webContents, listener) => {
@@ -6882,7 +6885,7 @@ const handler = ({
6882
6885
 
6883
6886
  const ElectronBrowserViewEventListenerWindowOpen = {
6884
6887
  __proto__: null,
6885
- attach: attach$2,
6888
+ attach: attach$3,
6886
6889
  detach,
6887
6890
  handler,
6888
6891
  key
@@ -7052,7 +7055,7 @@ const getSession = () => {
7052
7055
  return state.session;
7053
7056
  };
7054
7057
 
7055
- const attach$1 = (webContents, parentWebContents) => {
7058
+ const attach$2 = (webContents, parentWebContents) => {
7056
7059
  let shouldRestoreParentFocus = false;
7057
7060
  const cancel = () => {
7058
7061
  shouldRestoreParentFocus = false;
@@ -7106,7 +7109,7 @@ const isSoundCloudUrl = url => {
7106
7109
  return false;
7107
7110
  }
7108
7111
  };
7109
- const attach = webContents => {
7112
+ const attach$1 = webContents => {
7110
7113
  webContents.on(DidNavigate, (_event, url) => {
7111
7114
  if (!isSoundCloudUrl(url)) {
7112
7115
  return;
@@ -7123,14 +7126,23 @@ const send = (method, ...params) => {
7123
7126
  return rpc.send(method, ...params);
7124
7127
  };
7125
7128
 
7129
+ const focusTimes = new WeakMap();
7130
+ const attach = contents => {
7131
+ if (focusTimes.has(contents)) return;
7132
+ focusTimes.set(contents, 0);
7133
+ contents.on('focus', () => focusTimes.set(contents, Date.now()));
7134
+ };
7135
+ const getLastFocusedAt = contents => focusTimes.get(contents) || 0;
7136
+
7126
7137
  const webContentsWithEventListeners = new WeakSet();
7127
7138
  const attachEventListenersToWebContents = (webContentsId, webContents, browserWindow) => {
7128
7139
  if (webContentsWithEventListeners.has(webContents)) {
7129
7140
  return;
7130
7141
  }
7131
- attach$d(browserWindow, webContents);
7132
- attach$1(webContents, browserWindow.webContents);
7133
7142
  attach(webContents);
7143
+ attach$e(browserWindow, webContents);
7144
+ attach$2(webContents, browserWindow.webContents);
7145
+ attach$1(webContents);
7134
7146
  const values = Object.values(ElectronBrowserViewEventListeners);
7135
7147
  for (const value of values) {
7136
7148
  const handleResult = ({
@@ -7526,6 +7538,8 @@ const getStats = (view, includeMemory = false) => {
7526
7538
  canGoBack,
7527
7539
  canGoForward,
7528
7540
  isAudioMuted,
7541
+ isFocused: webContents.isFocused(),
7542
+ lastFocusedAt: getLastFocusedAt(webContents),
7529
7543
  title,
7530
7544
  url
7531
7545
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.40.0",
3
+ "version": "6.41.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"