@lvce-editor/renderer-process 30.55.0 → 30.55.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.
@@ -8420,6 +8420,81 @@ const ViewletSidebar = {
8420
8420
  setTitle
8421
8421
  };
8422
8422
 
8423
+ const pendingSelections = new WeakMap();
8424
+ const state$2 = {};
8425
+ const handleFocus$2 = event => {
8426
+ const target = event.target;
8427
+ if (target instanceof HTMLElement && !target.closest('.SimpleBrowser') && target.closest('.Main, .Panel, .Editor, .Terminal')) {
8428
+ state$2.codingFocus = new WeakRef(target);
8429
+ }
8430
+ };
8431
+ const listen = () => {
8432
+ document.addEventListener('focusin', handleFocus$2);
8433
+ };
8434
+ const restoreCodingFocus$1 = () => {
8435
+ const target = state$2.codingFocus?.deref();
8436
+ if (!target?.isConnected) {
8437
+ return false;
8438
+ }
8439
+ target.focus({
8440
+ preventScroll: true
8441
+ });
8442
+ return document.activeElement === target;
8443
+ };
8444
+ const getAddress = uid => {
8445
+ return get$a(uid)?.state.$Viewlet.querySelector('[name="simple-browser-address"]');
8446
+ };
8447
+ const captureBrowserAddress$1 = uid => {
8448
+ const address = getAddress(uid);
8449
+ return address && document.activeElement === address ? {
8450
+ end: address.selectionEnd,
8451
+ start: address.selectionStart
8452
+ } : undefined;
8453
+ };
8454
+ const queueBrowserAddressSelection = address => {
8455
+ clearTimeout(pendingSelections.get(address));
8456
+ const timer = setTimeout(() => {
8457
+ pendingSelections.delete(address);
8458
+ if (!address.isConnected) return;
8459
+ const suggestions = address.closest('.SimpleBrowser')?.querySelector('.SimpleBrowserSuggestions');
8460
+ if (suggestions) address.setSelectionRange(address.value.length, address.value.length);else address.select();
8461
+ });
8462
+ pendingSelections.set(address, timer);
8463
+ };
8464
+ const focusBrowserAddress$1 = (uid, selection) => {
8465
+ const address = getAddress(uid);
8466
+ if (!address) return;
8467
+ address.focus({
8468
+ preventScroll: true
8469
+ });
8470
+ clearTimeout(pendingSelections.get(address));
8471
+ pendingSelections.delete(address);
8472
+ if (selection) address.setSelectionRange(selection.start, selection.end);else address.select();
8473
+ };
8474
+ const revealBrowserTab$1 = uid => {
8475
+ const root = get$a(uid)?.state.$Viewlet;
8476
+ root?.querySelector('.SimpleBrowserTabSelected')?.scrollIntoView({
8477
+ block: 'nearest',
8478
+ inline: 'nearest'
8479
+ });
8480
+ };
8481
+ const browserParents = new Map();
8482
+ const rememberBrowserParent$1 = uid => {
8483
+ if (browserParents.has(uid)) return;
8484
+ const browser = get$a(uid)?.state.$Viewlet;
8485
+ if (!browser?.parentNode) return;
8486
+ const marker = document.createComment('browser workspace position');
8487
+ browser.before(marker);
8488
+ browserParents.set(uid, marker);
8489
+ };
8490
+ const restoreBrowserParent$1 = uid => {
8491
+ const marker = browserParents.get(uid);
8492
+ browserParents.delete(uid);
8493
+ if (!marker) return;
8494
+ const browser = get$a(uid)?.state.$Viewlet;
8495
+ if (browser && marker.isConnected) marker.replaceWith(browser);else marker.remove();
8496
+ };
8497
+
8423
8498
  const handleInput$3 = value => {
8424
8499
  send$1('SimpleBrowser.handleInput', value);
8425
8500
  };
@@ -8463,19 +8538,12 @@ const handleClickSuggestion = event => {
8463
8538
  }
8464
8539
  acceptSuggestion(value);
8465
8540
  };
8466
- const handleFocus$2 = event => {
8541
+ const handleFocus$1 = event => {
8467
8542
  const {
8468
8543
  target
8469
8544
  } = event;
8470
8545
  send$1('Focus.setFocus', FocusSimpleBrowserInput);
8471
- setTimeout(() => {
8472
- const suggestions = target.closest('.SimpleBrowser')?.querySelector('.SimpleBrowserSuggestions');
8473
- if (suggestions) {
8474
- target.setSelectionRange(target.value.length, target.value.length);
8475
- return;
8476
- }
8477
- target.select();
8478
- });
8546
+ queueBrowserAddressSelection(target);
8479
8547
  };
8480
8548
  const handleBlur$1 = event => {
8481
8549
  const {
@@ -8525,7 +8593,7 @@ const ViewletSimpleBrowserEvents = {
8525
8593
  handleClickOpenExternal,
8526
8594
  handleClickReload,
8527
8595
  handleClickSuggestion,
8528
- handleFocus: handleFocus$2,
8596
+ handleFocus: handleFocus$1,
8529
8597
  handleInput: handleInput$2
8530
8598
  };
8531
8599
 
@@ -8549,7 +8617,7 @@ const handleContextMenu$1 = event => {
8549
8617
  handleContextMenu$5(uid, button, clientX, clientY);
8550
8618
  };
8551
8619
 
8552
- const handleFocus$1 = event => {
8620
+ const handleFocus = event => {
8553
8621
  const uid = fromEvent(event);
8554
8622
  handleFocus$8(uid);
8555
8623
  };
@@ -8626,7 +8694,7 @@ const ViewletSourceControlEvents = {
8626
8694
  __proto__: null,
8627
8695
  handleClick: handleClick$3,
8628
8696
  handleContextMenu: handleContextMenu$1,
8629
- handleFocus: handleFocus$1,
8697
+ handleFocus,
8630
8698
  handleInput: handleInput$1,
8631
8699
  handleMouseOut,
8632
8700
  handleMouseOver,
@@ -9414,14 +9482,14 @@ const load$1 = moduleId => {
9414
9482
  return loadModule();
9415
9483
  };
9416
9484
 
9417
- const state$2 = {
9485
+ const state$1 = {
9418
9486
  currentPanelView: undefined,
9419
9487
  currentSidebarView: undefined,
9420
9488
  modules: Object.create(null)
9421
9489
  };
9422
9490
 
9423
9491
  const create$2 = (id, uid = id) => {
9424
- const module = state$2.modules[id];
9492
+ const module = state$1.modules[id];
9425
9493
  if (!module) {
9426
9494
  throw new Error(`module not found: ${id}`);
9427
9495
  }
@@ -9440,7 +9508,7 @@ const create$2 = (id, uid = id) => {
9440
9508
  });
9441
9509
  };
9442
9510
  const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId) => {
9443
- let module = state$2.modules[id];
9511
+ let module = state$1.modules[id];
9444
9512
  if (hasFunctionalEvents) {
9445
9513
  module ||= {};
9446
9514
  }
@@ -9472,7 +9540,7 @@ const removeKeyBindings = id => {
9472
9540
  const loadModule = async id => {
9473
9541
  try {
9474
9542
  const module = await load$1(id);
9475
- state$2.modules[id] = module;
9543
+ state$1.modules[id] = module;
9476
9544
  } catch (error) {
9477
9545
  throw new VError(error, `Failed to load ${id}`);
9478
9546
  }
@@ -9627,7 +9695,7 @@ const refresh = (viewletId, viewletContext) => {
9627
9695
  instance.factory.refresh(instance.state, viewletContext);
9628
9696
  } else {
9629
9697
  // @ts-expect-error
9630
- state$2.refreshContext[viewletId] = viewletContext;
9698
+ state$1.refreshContext[viewletId] = viewletContext;
9631
9699
  }
9632
9700
  };
9633
9701
  const specialIds = new Set(['TitleBar', 'SideBar', 'Main', 'ActivityBar', 'StatusBar', 'Panel']);
@@ -10250,68 +10318,6 @@ const clear = storageType => {
10250
10318
  storage.clear();
10251
10319
  };
10252
10320
 
10253
- const state$1 = {};
10254
- const handleFocus = event => {
10255
- const target = event.target;
10256
- if (target instanceof HTMLElement && !target.closest('.SimpleBrowser') && target.closest('.Main, .Panel, .Editor, .Terminal')) {
10257
- state$1.codingFocus = new WeakRef(target);
10258
- }
10259
- };
10260
- const listen = () => {
10261
- document.addEventListener('focusin', handleFocus);
10262
- };
10263
- const restoreCodingFocus$1 = () => {
10264
- const target = state$1.codingFocus?.deref();
10265
- if (!target?.isConnected) {
10266
- return false;
10267
- }
10268
- target.focus({
10269
- preventScroll: true
10270
- });
10271
- return document.activeElement === target;
10272
- };
10273
- const getAddress = uid => {
10274
- return get$a(uid)?.state.$Viewlet.querySelector('[name="simple-browser-address"]');
10275
- };
10276
- const captureBrowserAddress$1 = uid => {
10277
- const address = getAddress(uid);
10278
- return address && document.activeElement === address ? {
10279
- end: address.selectionEnd,
10280
- start: address.selectionStart
10281
- } : undefined;
10282
- };
10283
- const focusBrowserAddress$1 = (uid, selection) => {
10284
- const address = getAddress(uid);
10285
- if (!address) return;
10286
- address.focus({
10287
- preventScroll: true
10288
- });
10289
- if (selection) address.setSelectionRange(selection.start, selection.end);else address.select();
10290
- };
10291
- const revealBrowserTab$1 = uid => {
10292
- const root = get$a(uid)?.state.$Viewlet;
10293
- root?.querySelector('.SimpleBrowserTabSelected')?.scrollIntoView({
10294
- block: 'nearest',
10295
- inline: 'nearest'
10296
- });
10297
- };
10298
- const browserParents = new Map();
10299
- const rememberBrowserParent$1 = uid => {
10300
- if (browserParents.has(uid)) return;
10301
- const browser = get$a(uid)?.state.$Viewlet;
10302
- if (!browser?.parentNode) return;
10303
- const marker = document.createComment('browser workspace position');
10304
- browser.before(marker);
10305
- browserParents.set(uid, marker);
10306
- };
10307
- const restoreBrowserParent$1 = uid => {
10308
- const marker = browserParents.get(uid);
10309
- browserParents.delete(uid);
10310
- if (!marker) return;
10311
- const browser = get$a(uid)?.state.$Viewlet;
10312
- if (browser && marker.isConnected) marker.replaceWith(browser);else marker.remove();
10313
- };
10314
-
10315
10321
  const reload = () => {
10316
10322
  location.reload();
10317
10323
  };
@@ -11296,15 +11302,15 @@ const main = async () => {
11296
11302
  initialize(location.search);
11297
11303
  Object.assign(commandMapRef, commandMap);
11298
11304
  enable(window);
11299
- state$2.modules[ColorPicker] = ViewletColorPicker;
11300
- state$2.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
11301
- state$2.modules[EditorCompletion] = ViewletEditorCompletion;
11302
- state$2.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
11303
- state$2.modules[EditorHover] = ViewletEditorHover;
11304
- state$2.modules[EditorRename] = ViewletEditorRename;
11305
- state$2.modules[EditorSourceActions] = ViewletEditorSourceActions;
11306
- state$2.modules[FindWidget] = ViewletFindWidget;
11307
- state$2.modules[TitleBar] = ViewletTitleBar;
11305
+ state$1.modules[ColorPicker] = ViewletColorPicker;
11306
+ state$1.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
11307
+ state$1.modules[EditorCompletion] = ViewletEditorCompletion;
11308
+ state$1.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
11309
+ state$1.modules[EditorHover] = ViewletEditorHover;
11310
+ state$1.modules[EditorRename] = ViewletEditorRename;
11311
+ state$1.modules[EditorSourceActions] = ViewletEditorSourceActions;
11312
+ state$1.modules[FindWidget] = ViewletFindWidget;
11313
+ state$1.modules[TitleBar] = ViewletTitleBar;
11308
11314
  // TODO this is discovered very late
11309
11315
  const launchWorkersResult = await launchWorkers();
11310
11316
  if (isError(launchWorkersResult)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.55.0",
3
+ "version": "30.55.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"