@lvce-editor/main-process 6.15.0 → 6.16.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.
@@ -3426,7 +3426,7 @@ const formatUtilityProcessName = name => {
3426
3426
  const state$6 = {
3427
3427
  all: Object.create(null)
3428
3428
  };
3429
- const add$1 = (pid, process, name) => {
3429
+ const add$2 = (pid, process, name) => {
3430
3430
  number(pid);
3431
3431
  object(process);
3432
3432
  string(name);
@@ -3461,7 +3461,7 @@ const trackUtilityProcess = (rawIpc, name) => {
3461
3461
  pid
3462
3462
  } = rawIpc;
3463
3463
  const formattedName = formatUtilityProcessName(name);
3464
- add$1(pid, rawIpc, formattedName);
3464
+ add$2(pid, rawIpc, formattedName);
3465
3465
  const cleanup = () => {
3466
3466
  remove$1(pid);
3467
3467
  rawIpc.off('exit', handleExit);
@@ -4067,6 +4067,7 @@ const DidNavigate = 'did-navigate';
4067
4067
  const PageTitleUpdated = 'page-title-updated';
4068
4068
  const Destroyed = 'destroyed';
4069
4069
  const BeforeInputEvent = 'before-input-event';
4070
+ const Login = 'login';
4070
4071
 
4071
4072
  const Deny = 'deny';
4072
4073
 
@@ -4087,7 +4088,7 @@ const state$3 = {
4087
4088
  fallThroughKeyBindings: [],
4088
4089
  views: Object.create(null)
4089
4090
  };
4090
- const add = (id, browserWindow, view) => {
4091
+ const add$1 = (id, browserWindow, view) => {
4091
4092
  // state
4092
4093
  state$3.views[id] = {
4093
4094
  browserWindow,
@@ -6155,14 +6156,14 @@ const getKeyBindingIdentifier = input => {
6155
6156
  return identifier;
6156
6157
  };
6157
6158
 
6158
- const key$6 = 'before-input';
6159
- const attach$6 = (webContents, listener) => {
6159
+ const key$7 = 'before-input';
6160
+ const attach$7 = (webContents, listener) => {
6160
6161
  webContents.on(BeforeInputEvent, listener);
6161
6162
  };
6162
- const detach$6 = (webContents, listener) => {
6163
+ const detach$7 = (webContents, listener) => {
6163
6164
  webContents.off(BeforeInputEvent, listener);
6164
6165
  };
6165
- const handler$6 = (event, input) => {
6166
+ const handler$7 = (event, input) => {
6166
6167
  if (input.type !== KeyDown) {
6167
6168
  return {
6168
6169
  messages: [],
@@ -6187,6 +6188,28 @@ const handler$6 = (event, input) => {
6187
6188
  };
6188
6189
 
6189
6190
  const ElectronBrowserViewEventListenerBeforeInput = {
6191
+ __proto__: null,
6192
+ attach: attach$7,
6193
+ detach: detach$7,
6194
+ handler: handler$7,
6195
+ key: key$7
6196
+ };
6197
+
6198
+ const key$6 = 'context-menu';
6199
+ const attach$6 = (webContents, listener) => {
6200
+ webContents.on(ContextMenu, listener);
6201
+ };
6202
+ const detach$6 = (webContents, listener) => {
6203
+ webContents.off(ContextMenu, listener);
6204
+ };
6205
+ const handler$6 = (event, params) => {
6206
+ return {
6207
+ messages: [['handleContextMenu', params]],
6208
+ result: undefined
6209
+ };
6210
+ };
6211
+
6212
+ const ElectronBrowserViewEventListenerContextMenu = {
6190
6213
  __proto__: null,
6191
6214
  attach: attach$6,
6192
6215
  detach: detach$6,
@@ -6194,21 +6217,21 @@ const ElectronBrowserViewEventListenerBeforeInput = {
6194
6217
  key: key$6
6195
6218
  };
6196
6219
 
6197
- const key$5 = 'context-menu';
6220
+ const key$5 = 'destroyed';
6198
6221
  const attach$5 = (webContents, listener) => {
6199
- webContents.on(ContextMenu, listener);
6222
+ webContents.on(Destroyed, listener);
6200
6223
  };
6201
6224
  const detach$5 = (webContents, listener) => {
6202
- webContents.off(ContextMenu, listener);
6225
+ webContents.off(Destroyed, listener);
6203
6226
  };
6204
- const handler$5 = (event, params) => {
6227
+ const handler$5 = () => {
6205
6228
  return {
6206
- messages: [['handleContextMenu', params]],
6229
+ messages: [['handleBrowserViewDestroyed']],
6207
6230
  result: undefined
6208
6231
  };
6209
6232
  };
6210
6233
 
6211
- const ElectronBrowserViewEventListenerContextMenu = {
6234
+ const ElectronBrowserViewEventListenerDestroyed = {
6212
6235
  __proto__: null,
6213
6236
  attach: attach$5,
6214
6237
  detach: detach$5,
@@ -6216,21 +6239,21 @@ const ElectronBrowserViewEventListenerContextMenu = {
6216
6239
  key: key$5
6217
6240
  };
6218
6241
 
6219
- const key$4 = 'destroyed';
6242
+ const key$4 = 'did-navigate';
6220
6243
  const attach$4 = (webContents, listener) => {
6221
- webContents.on(Destroyed, listener);
6244
+ webContents.on(DidNavigate, listener);
6222
6245
  };
6223
6246
  const detach$4 = (webContents, listener) => {
6224
- webContents.off(Destroyed, listener);
6247
+ webContents.off(DidNavigate, listener);
6225
6248
  };
6226
- const handler$4 = () => {
6249
+ const handler$4 = (event, url) => {
6227
6250
  return {
6228
- messages: [['handleBrowserViewDestroyed']],
6251
+ messages: [['handleDidNavigate', url]],
6229
6252
  result: undefined
6230
6253
  };
6231
6254
  };
6232
6255
 
6233
- const ElectronBrowserViewEventListenerDestroyed = {
6256
+ const ElectronBrowserViewEventListenerDidNavigate = {
6234
6257
  __proto__: null,
6235
6258
  attach: attach$4,
6236
6259
  detach: detach$4,
@@ -6238,21 +6261,64 @@ const ElectronBrowserViewEventListenerDestroyed = {
6238
6261
  key: key$4
6239
6262
  };
6240
6263
 
6241
- const key$3 = 'did-navigate';
6264
+ const pendingLogins = new Map();
6265
+ let nextRequestId = 1;
6266
+ const add = (webContentsId, callback) => {
6267
+ const requestId = `${webContentsId}:${nextRequestId++}`;
6268
+ pendingLogins.set(requestId, {
6269
+ callback,
6270
+ webContentsId
6271
+ });
6272
+ return requestId;
6273
+ };
6274
+ const take = requestId => {
6275
+ const pendingLogin = pendingLogins.get(requestId);
6276
+ pendingLogins.delete(requestId);
6277
+ return pendingLogin;
6278
+ };
6279
+ const accept = (requestId, username, password) => {
6280
+ const pendingLogin = take(requestId);
6281
+ pendingLogin?.callback(username, password);
6282
+ };
6283
+ const cancel = requestId => {
6284
+ const pendingLogin = take(requestId);
6285
+ pendingLogin?.callback();
6286
+ };
6287
+ const cancelForWebContents = webContentsId => {
6288
+ for (const [requestId, pendingLogin] of pendingLogins) {
6289
+ if (pendingLogin.webContentsId !== webContentsId) {
6290
+ continue;
6291
+ }
6292
+ pendingLogins.delete(requestId);
6293
+ pendingLogin.callback();
6294
+ }
6295
+ };
6296
+
6297
+ const key$3 = Login;
6242
6298
  const attach$3 = (webContents, listener) => {
6243
- webContents.on(DidNavigate, listener);
6299
+ webContents.on(Login, listener);
6244
6300
  };
6245
6301
  const detach$3 = (webContents, listener) => {
6246
- webContents.off(DidNavigate, listener);
6302
+ webContents.off(Login, listener);
6247
6303
  };
6248
- const handler$3 = (event, url) => {
6304
+ const handler$3 = (event, authenticationResponseDetails, authInfo, callback, webContentsId) => {
6305
+ event.preventDefault();
6306
+ const requestId = add(webContentsId, callback);
6249
6307
  return {
6250
- messages: [['handleDidNavigate', url]],
6308
+ messages: [['handleLogin', {
6309
+ host: authInfo.host,
6310
+ isProxy: authInfo.isProxy,
6311
+ port: authInfo.port,
6312
+ realm: authInfo.realm,
6313
+ requestId,
6314
+ scheme: authInfo.scheme,
6315
+ url: String(authenticationResponseDetails.url)
6316
+ }]],
6251
6317
  result: undefined
6252
6318
  };
6253
6319
  };
6254
6320
 
6255
- const ElectronBrowserViewEventListenerDidNavigate = {
6321
+ const ElectronBrowserViewEventListenerLogin = {
6256
6322
  __proto__: null,
6257
6323
  attach: attach$3,
6258
6324
  detach: detach$3,
@@ -6339,6 +6405,7 @@ const ElectronBrowserViewEventListeners = {
6339
6405
  contextMenu: ElectronBrowserViewEventListenerContextMenu,
6340
6406
  destroyed: ElectronBrowserViewEventListenerDestroyed,
6341
6407
  didNavigate: ElectronBrowserViewEventListenerDidNavigate,
6408
+ login: ElectronBrowserViewEventListenerLogin,
6342
6409
  pageTitleUpdated: ElectronBrowserViewEventListenerPageTitleUpdated,
6343
6410
  willNavigate: ElectronBrowserViewEventListenerWillNavigate,
6344
6411
  windowOpen: ElectronBrowserViewEventListenerWindowOpen
@@ -6367,7 +6434,7 @@ const createWebContentsView = async () => {
6367
6434
  const {
6368
6435
  id
6369
6436
  } = webContents;
6370
- add(id, browserWindow, view);
6437
+ add$1(id, browserWindow, view);
6371
6438
  return id;
6372
6439
  };
6373
6440
  const attachEventListeners = webContentsId => {
@@ -6383,7 +6450,7 @@ const attachEventListeners = webContentsId => {
6383
6450
  const {
6384
6451
  messages,
6385
6452
  result
6386
- } = value.handler(...args);
6453
+ } = value.handler(...args, webContentsId);
6387
6454
  for (const message of messages) {
6388
6455
  const [key, ...rest] = message;
6389
6456
  send(`ElectronWebContents.${key}`, webContentsId, ...rest);
@@ -6397,6 +6464,7 @@ const attachEventListeners = webContentsId => {
6397
6464
  };
6398
6465
  const disposeWebContentsView = browserViewId => {
6399
6466
  console.log('[main process] dispose browser view', browserViewId);
6467
+ cancelForWebContents(browserViewId);
6400
6468
  const instance = get$3(browserViewId);
6401
6469
  if (!instance) {
6402
6470
  return;
@@ -6972,7 +7040,9 @@ const commandMap = {
6972
7040
  'ElectronWebContents.callFunction': callFunction,
6973
7041
  'ElectronWebContents.dispose': dispose$1,
6974
7042
  'ElectronWebContents.getStats': getStats$1,
7043
+ 'ElectronWebContentsView.acceptLogin': accept,
6975
7044
  'ElectronWebContentsView.attachEventListeners': attachEventListeners,
7045
+ 'ElectronWebContentsView.cancelLogin': cancel,
6976
7046
  'ElectronWebContentsView.createWebContentsView': createWebContentsView,
6977
7047
  'ElectronWebContentsView.disposeWebContentsView': disposeWebContentsView,
6978
7048
  'ElectronWebContentsViewFunctions.addToWindow': addToWindow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.15.0",
3
+ "version": "6.16.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"