@lvce-editor/renderer-process 30.53.1 → 30.54.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.
@@ -127,25 +127,25 @@ const confirm = message => {
127
127
  return window.confirm(message);
128
128
  };
129
129
 
130
- const state$f = {
130
+ const state$g = {
131
131
  styleSheets: Object.create(null),
132
132
  texts: Object.create(null)
133
133
  };
134
134
  const set$b = (id, sheet) => {
135
- state$f.styleSheets[id] = sheet;
135
+ state$g.styleSheets[id] = sheet;
136
136
  };
137
137
  const get$b = id => {
138
- return state$f.styleSheets[id];
138
+ return state$g.styleSheets[id];
139
139
  };
140
140
  const setText$2 = (id, text) => {
141
- state$f.texts[id] = text;
141
+ state$g.texts[id] = text;
142
142
  };
143
143
  const getText = id => {
144
- return state$f.texts[id];
144
+ return state$g.texts[id];
145
145
  };
146
146
  const remove$5 = id => {
147
- delete state$f.styleSheets[id];
148
- delete state$f.texts[id];
147
+ delete state$g.styleSheets[id];
148
+ delete state$g.texts[id];
149
149
  };
150
150
 
151
151
  const addCssStyleSheet = (id, text) => {
@@ -340,7 +340,7 @@ const createIdGenerator = () => {
340
340
  };
341
341
  const create$J = createIdGenerator();
342
342
 
343
- const state$e = Object.create(null);
343
+ const state$f = Object.create(null);
344
344
  const retainString = (item, index) => {
345
345
  const value = new Promise(resolve => {
346
346
  item.getAsString(resolve);
@@ -391,25 +391,25 @@ const retainItems = dataTransfer => {
391
391
  };
392
392
  const addItems = items => {
393
393
  const id = create$J();
394
- state$e[id] = items;
394
+ state$f[id] = items;
395
395
  return id;
396
396
  };
397
397
  const add$2 = dataTransfer => {
398
398
  return addItems(retainItems(dataTransfer));
399
399
  };
400
400
  const acquire$2 = id => {
401
- const items = state$e[id];
401
+ const items = state$f[id];
402
402
  if (!items) {
403
403
  throw new Error(`Drop data not found: ${id}`);
404
404
  }
405
- delete state$e[id];
405
+ delete state$f[id];
406
406
  return items;
407
407
  };
408
408
 
409
- const state$d = Object.create(null);
409
+ const state$e = Object.create(null);
410
410
  const acquire$1 = id => {
411
- const promise = state$d[id];
412
- delete state$d[id];
411
+ const promise = state$e[id];
412
+ delete state$e[id];
413
413
  return promise;
414
414
  };
415
415
  const getFileHandles = async ids => {
@@ -419,7 +419,7 @@ const getFileHandles = async ids => {
419
419
  };
420
420
  const add$1 = promise => {
421
421
  const id = create$J();
422
- state$d[id] = promise;
422
+ state$e[id] = promise;
423
423
  return id;
424
424
  };
425
425
  const addFileHandle$1 = fileHandle => {
@@ -610,14 +610,14 @@ const getEventListenerArgs = (params, event) => {
610
610
  return serialized;
611
611
  };
612
612
 
613
- const state$c = {
613
+ const state$d = {
614
614
  ipc: undefined
615
615
  };
616
616
  const getIpc = () => {
617
- return state$c.ipc;
617
+ return state$d.ipc;
618
618
  };
619
619
  const setIpc = value => {
620
- state$c.ipc = value;
620
+ state$d.ipc = value;
621
621
  };
622
622
 
623
623
  const nameAnonymousFunction$1 = (fn, name) => {
@@ -3349,26 +3349,26 @@ const launchDragAndDropWorker = async () => {
3349
3349
  }
3350
3350
  };
3351
3351
 
3352
- const state$b = {
3352
+ const state$c = {
3353
3353
  rpc: undefined
3354
3354
  };
3355
3355
  const hydrate$4 = async () => {
3356
3356
  const result = await launchDragAndDropWorker();
3357
3357
  if (isError(result)) {
3358
- state$b.rpc = undefined;
3358
+ state$c.rpc = undefined;
3359
3359
  return result;
3360
3360
  }
3361
- state$b.rpc = result.value;
3361
+ state$c.rpc = result.value;
3362
3362
  return success(undefined);
3363
3363
  };
3364
3364
  const handleMessagePort$1 = async port => {
3365
- if (!state$b.rpc) {
3365
+ if (!state$c.rpc) {
3366
3366
  const result = await hydrate$4();
3367
3367
  if (isError(result)) {
3368
3368
  throw result.error;
3369
3369
  }
3370
3370
  }
3371
- const rpc = state$b.rpc;
3371
+ const rpc = state$c.rpc;
3372
3372
  if (!rpc) {
3373
3373
  throw new Error('Drag And Drop Worker failed to initialize');
3374
3374
  }
@@ -3552,7 +3552,7 @@ const launchRendererWorker = async () => {
3552
3552
  };
3553
3553
 
3554
3554
  const selector = 'script.RendererWorkerTrace';
3555
- const state$a = {
3555
+ const state$b = {
3556
3556
  enabled: false,
3557
3557
  entries: []
3558
3558
  };
@@ -3602,22 +3602,22 @@ const isCommand = value => {
3602
3602
  };
3603
3603
  const initialize = search => {
3604
3604
  const searchParams = new URLSearchParams(search);
3605
- state$a.enabled = searchParams.has('traceRendererWorker');
3606
- state$a.entries = [];
3605
+ state$b.enabled = searchParams.has('traceRendererWorker');
3606
+ state$b.entries = [];
3607
3607
  };
3608
3608
  const record = (direction, method, params) => {
3609
- if (!state$a.enabled) {
3609
+ if (!state$b.enabled) {
3610
3610
  return;
3611
3611
  }
3612
- state$a.entries.push({
3612
+ state$b.entries.push({
3613
3613
  direction,
3614
3614
  method,
3615
3615
  params: serialize(params),
3616
3616
  timestamp: performance.now()
3617
3617
  });
3618
3618
  };
3619
- const listen = rpc => {
3620
- if (!state$a.enabled) {
3619
+ const listen$1 = rpc => {
3620
+ if (!state$b.enabled) {
3621
3621
  return;
3622
3622
  }
3623
3623
  const ipc = rpc.ipc;
@@ -3632,7 +3632,7 @@ const listen = rpc => {
3632
3632
  });
3633
3633
  };
3634
3634
  const exportToDom = () => {
3635
- if (!state$a.enabled) {
3635
+ if (!state$b.enabled) {
3636
3636
  return;
3637
3637
  }
3638
3638
  const existing = document.querySelector(selector);
@@ -3640,7 +3640,7 @@ const exportToDom = () => {
3640
3640
  script.className = 'RendererWorkerTrace';
3641
3641
  script.type = 'application/json';
3642
3642
  script.textContent = JSON.stringify({
3643
- entries: state$a.entries,
3643
+ entries: state$b.entries,
3644
3644
  version: 1
3645
3645
  });
3646
3646
  if (!existing) {
@@ -3648,39 +3648,39 @@ const exportToDom = () => {
3648
3648
  }
3649
3649
  };
3650
3650
  const scheduleExport = () => {
3651
- if (!state$a.enabled) {
3651
+ if (!state$b.enabled) {
3652
3652
  return;
3653
3653
  }
3654
3654
  queueMicrotask(exportToDom);
3655
3655
  };
3656
3656
 
3657
- const state$9 = {
3657
+ const state$a = {
3658
3658
  rpc: undefined
3659
3659
  };
3660
3660
  const hydrate$3 = async () => {
3661
3661
  const result = await launchRendererWorker();
3662
3662
  if (isError(result)) {
3663
- state$9.rpc = undefined;
3663
+ state$a.rpc = undefined;
3664
3664
  return result;
3665
3665
  }
3666
- state$9.rpc = result.value;
3667
- listen(result.value);
3666
+ state$a.rpc = result.value;
3667
+ listen$1(result.value);
3668
3668
  return success(undefined);
3669
3669
  };
3670
3670
  const send$1 = (method, ...params) => {
3671
3671
  record('sent', method, params);
3672
3672
  // @ts-ignore
3673
- state$9.rpc.send(method, ...params);
3673
+ state$a.rpc.send(method, ...params);
3674
3674
  };
3675
3675
  const invoke$1 = (method, ...params) => {
3676
3676
  record('sent', method, params);
3677
3677
  // @ts-ignore
3678
- return state$9.rpc.invoke(method, ...params);
3678
+ return state$a.rpc.invoke(method, ...params);
3679
3679
  };
3680
3680
  const invokeAndTransfer = (method, ...params) => {
3681
3681
  record('sent', method, params);
3682
3682
  // @ts-ignore
3683
- return state$9.rpc.invokeAndTransfer(method, ...params);
3683
+ return state$a.rpc.invokeAndTransfer(method, ...params);
3684
3684
  };
3685
3685
 
3686
3686
  const writeFile = (uri, content) => {
@@ -4241,7 +4241,7 @@ const create$Button = (label, icon) => {
4241
4241
  };
4242
4242
 
4243
4243
  // TODO this file is not needed when all elements are position fixed
4244
- const state$8 = {
4244
+ const state$9 = {
4245
4245
  $Widgets: undefined,
4246
4246
  widgetSet: new Set()
4247
4247
  };
@@ -4253,20 +4253,20 @@ const create$Widgets = () => {
4253
4253
  };
4254
4254
  const append$1 = $Element => {
4255
4255
  // TODO should not call append in the first place if it is already in DOM
4256
- if (state$8.widgetSet.has($Element)) {
4256
+ if (state$9.widgetSet.has($Element)) {
4257
4257
  return;
4258
4258
  }
4259
- state$8.widgetSet.add($Element);
4260
- if (state$8.$Widgets) {
4259
+ state$9.widgetSet.add($Element);
4260
+ if (state$9.$Widgets) {
4261
4261
  // @ts-expect-error
4262
- state$8.$Widgets.append($Element);
4262
+ state$9.$Widgets.append($Element);
4263
4263
  } else {
4264
4264
  // @ts-expect-error
4265
- state$8.$Widgets = create$Widgets();
4265
+ state$9.$Widgets = create$Widgets();
4266
4266
  // @ts-expect-error
4267
- state$8.$Widgets.append($Element);
4267
+ state$9.$Widgets.append($Element);
4268
4268
  // @ts-expect-error
4269
- document.body.append(state$8.$Widgets);
4269
+ document.body.append(state$9.$Widgets);
4270
4270
  }
4271
4271
  };
4272
4272
  const remove$1 = $Element => {
@@ -4274,13 +4274,13 @@ const remove$1 = $Element => {
4274
4274
  // TODO $Element should always be defined
4275
4275
  return;
4276
4276
  }
4277
- state$8.widgetSet.delete($Element);
4277
+ state$9.widgetSet.delete($Element);
4278
4278
  $Element.remove();
4279
4279
  // TODO state.$Widgets should always be defined at this point
4280
- if (state$8.widgetSet.size === 0 && state$8.$Widgets) {
4280
+ if (state$9.widgetSet.size === 0 && state$9.$Widgets) {
4281
4281
  // @ts-expect-error
4282
- state$8.$Widgets.remove();
4283
- state$8.$Widgets = undefined;
4282
+ state$9.$Widgets.remove();
4283
+ state$9.$Widgets = undefined;
4284
4284
  }
4285
4285
  };
4286
4286
 
@@ -4363,11 +4363,11 @@ const revokeObjectUrl = url => {
4363
4363
  URL.revokeObjectURL(url);
4364
4364
  };
4365
4365
 
4366
- const state$7 = {
4366
+ const state$8 = {
4367
4367
  canvasObjects: Object.create(null)
4368
4368
  };
4369
4369
  const set$5 = (canvasId, canvas) => {
4370
- state$7.canvasObjects[canvasId] = canvas;
4370
+ state$8.canvasObjects[canvasId] = canvas;
4371
4371
  };
4372
4372
 
4373
4373
  const create$r = async (canvasId, objectId) => {
@@ -4466,16 +4466,16 @@ const findIndex = ($Container, $Target) => {
4466
4466
  return -1;
4467
4467
  };
4468
4468
 
4469
- const state$6 = {
4469
+ const state$7 = {
4470
4470
  /**
4471
4471
  * @type {HTMLElement|undefined}
4472
4472
  */
4473
4473
  $PreviousFocusElement: undefined};
4474
4474
  const setElement = $Element => {
4475
- state$6.$PreviousFocusElement = $Element;
4475
+ state$7.$PreviousFocusElement = $Element;
4476
4476
  };
4477
4477
  const getElement = () => {
4478
- return state$6.$PreviousFocusElement;
4478
+ return state$7.$PreviousFocusElement;
4479
4479
  };
4480
4480
 
4481
4481
  const focus$e = $Element => {
@@ -4564,7 +4564,7 @@ const FocusOutput = 28;
4564
4564
 
4565
4565
  // TODO keyboard handling
4566
4566
 
4567
- const state$5 = {
4567
+ const state$6 = {
4568
4568
  $$Menus: [],
4569
4569
  $BackDrop: undefined,
4570
4570
  anchorTime: -1,
@@ -4575,7 +4575,7 @@ const state$5 = {
4575
4575
  };
4576
4576
  const getLevel = $Menu => {
4577
4577
  // @ts-expect-error
4578
- return state$5.$$Menus.indexOf($Menu);
4578
+ return state$6.$$Menus.indexOf($Menu);
4579
4579
  };
4580
4580
  const handleMouseDown$4 = event => {
4581
4581
  const $Target = event.target;
@@ -4641,10 +4641,10 @@ const handleMouseLeave = event => {
4641
4641
 
4642
4642
  // const handleBlur = (event) => {}
4643
4643
  const handleKeyDown$4 = event => {
4644
- state$5.handleKeyDown(event);
4644
+ state$6.handleKeyDown(event);
4645
4645
  };
4646
4646
  const handleFocusOut$1 = event => {
4647
- state$5.handleFocusOut(event);
4647
+ state$6.handleFocusOut(event);
4648
4648
  };
4649
4649
  const create$Menu$1 = () => {
4650
4650
  // TODO set aria label on menu (e.g. File, Edit, Selection)
@@ -4672,7 +4672,7 @@ const create$Menu$1 = () => {
4672
4672
  return $Menu;
4673
4673
  };
4674
4674
  const focusIndex = (level, oldFocusedIndex, newFocusedIndex) => {
4675
- const $Menu = state$5.$$Menus[level];
4675
+ const $Menu = state$6.$$Menus[level];
4676
4676
  if (oldFocusedIndex !== -1) {
4677
4677
  // @ts-expect-error
4678
4678
  $Menu.children[oldFocusedIndex].classList.remove('MenuItemFocused');
@@ -4694,21 +4694,21 @@ const handleBackDropMouseDown = event => {
4694
4694
  preventDefault(event);
4695
4695
  stopPropagation(event);
4696
4696
  send$1(/* Menu.hide */'Menu.hide');
4697
- if (state$5.$BackDrop) {
4698
- remove$1(state$5.$BackDrop);
4699
- state$5.$BackDrop = undefined;
4697
+ if (state$6.$BackDrop) {
4698
+ remove$1(state$6.$BackDrop);
4699
+ state$6.$BackDrop = undefined;
4700
4700
  }
4701
4701
  };
4702
4702
  const handleContextMenu$7 = event => {
4703
4703
  preventDefault(event);
4704
4704
  };
4705
4705
  const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [], mouseBlocking = false) => {
4706
- if (mouseBlocking && !state$5.$BackDrop) {
4706
+ if (mouseBlocking && !state$6.$BackDrop) {
4707
4707
  const $BackDrop = create$BackDrop();
4708
4708
  $BackDrop.onmousedown = handleBackDropMouseDown;
4709
4709
  $BackDrop.oncontextmenu = handleContextMenu$7;
4710
4710
  // @ts-expect-error
4711
- state$5.$BackDrop = $BackDrop;
4711
+ state$6.$BackDrop = $BackDrop;
4712
4712
  append$1($BackDrop);
4713
4713
  }
4714
4714
  const $Menu = create$Menu$1();
@@ -4716,7 +4716,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4716
4716
  setXAndY($Menu, x, y);
4717
4717
  $Menu.id = `Menu-${level}`;
4718
4718
  if (parentIndex !== -1) {
4719
- const $ParentMenu = state$5.$$Menus[level - 1];
4719
+ const $ParentMenu = state$6.$$Menus[level - 1];
4720
4720
  // @ts-expect-error
4721
4721
  const $ParentMenuItem = $ParentMenu.children[parentIndex];
4722
4722
  $ParentMenuItem.ariaExpanded = True;
@@ -4724,7 +4724,7 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4724
4724
  }
4725
4725
 
4726
4726
  // @ts-expect-error
4727
- state$5.$$Menus.push($Menu);
4727
+ state$6.$$Menus.push($Menu);
4728
4728
  append$1($Menu);
4729
4729
  if (level === 0) {
4730
4730
  focus$e($Menu);
@@ -4732,14 +4732,14 @@ const showMenu = (x, y, width, height, items, level, parentIndex = -1, dom = [],
4732
4732
  }
4733
4733
  };
4734
4734
  const hideSubmenu = level => {
4735
- const $$ChildMenus = state$5.$$Menus.slice(level);
4735
+ const $$ChildMenus = state$6.$$Menus.slice(level);
4736
4736
  for (const $ChildMenu of $$ChildMenus) {
4737
4737
  remove$1($ChildMenu);
4738
4738
  }
4739
- state$5.$$Menus = state$5.$$Menus.slice(0, level);
4740
- if (state$5.$$Menus.length === 0 && state$5.$BackDrop) {
4741
- remove$1(state$5.$BackDrop);
4742
- state$5.$BackDrop = undefined;
4739
+ state$6.$$Menus = state$6.$$Menus.slice(0, level);
4740
+ if (state$6.$$Menus.length === 0 && state$6.$BackDrop) {
4741
+ remove$1(state$6.$BackDrop);
4742
+ state$6.$BackDrop = undefined;
4743
4743
  }
4744
4744
  };
4745
4745
 
@@ -4778,7 +4778,7 @@ const showControlled = ({
4778
4778
  y
4779
4779
  }) => {
4780
4780
  showMenu(x, y, width, height, items, level);
4781
- const $Menu = state$5.$$Menus.at(-1);
4781
+ const $Menu = state$6.$$Menus.at(-1);
4782
4782
  if ($Parent && $Menu) {
4783
4783
  const uid = get$8($Parent);
4784
4784
  set$8($Menu, uid);
@@ -4786,9 +4786,9 @@ const showControlled = ({
4786
4786
  // TODO menu should not necessarily know about parent (titleBarMenuBar)
4787
4787
  // it should be the other way around
4788
4788
  // @ts-expect-error
4789
- state$5.$Parent = $Parent;
4790
- state$5.handleFocusOut = handleFocusOut;
4791
- state$5.handleKeyDown = handleKeyDown;
4789
+ state$6.$Parent = $Parent;
4790
+ state$6.handleFocusOut = handleFocusOut;
4791
+ state$6.handleKeyDown = handleKeyDown;
4792
4792
  if ($Parent) {
4793
4793
  // state.$Menu.ariaLabel=''
4794
4794
  // state.$Menu.ariaLabelledBy =$Parent.id
@@ -4800,13 +4800,13 @@ const showControlled = ({
4800
4800
  // TODO have function to show submenu
4801
4801
 
4802
4802
  const hide = (restoreFocus = true) => {
4803
- for (const $Menu of state$5.$$Menus) {
4803
+ for (const $Menu of state$6.$$Menus) {
4804
4804
  remove$1($Menu);
4805
4805
  }
4806
- state$5.$$Menus = [];
4807
- if (state$5.$BackDrop) {
4808
- remove$1(state$5.$BackDrop);
4809
- state$5.$BackDrop = undefined;
4806
+ state$6.$$Menus = [];
4807
+ if (state$6.$BackDrop) {
4808
+ remove$1(state$6.$BackDrop);
4809
+ state$6.$BackDrop = undefined;
4810
4810
  }
4811
4811
  // TODO focus previous item
4812
4812
  if (restoreFocus) {
@@ -5685,25 +5685,25 @@ const attachEvents$7 = ($Node, eventMap) => {
5685
5685
  }
5686
5686
  };
5687
5687
 
5688
- const state$4 = {
5688
+ const state$5 = {
5689
5689
  currentDragInfo: undefined
5690
5690
  };
5691
5691
  const set$2 = (id, data) => {
5692
- state$4.currentDragInfo = data;
5692
+ state$5.currentDragInfo = data;
5693
5693
  setDragInfo(id, data);
5694
5694
  };
5695
5695
  const getCurrent = () => {
5696
- return state$4.currentDragInfo;
5696
+ return state$5.currentDragInfo;
5697
5697
  };
5698
5698
 
5699
- const state$3 = {
5699
+ const state$4 = {
5700
5700
  identifiers: new Uint32Array()
5701
5701
  };
5702
5702
  const setIdentifiers$1 = identifiers => {
5703
- state$3.identifiers = identifiers;
5703
+ state$4.identifiers = identifiers;
5704
5704
  };
5705
5705
  const getIdentifiers = () => {
5706
- return state$3.identifiers;
5706
+ return state$4.identifiers;
5707
5707
  };
5708
5708
 
5709
5709
  // TODO store keybindings as JSON somewhere
@@ -5722,11 +5722,11 @@ const setIdentifiers = identifiers => {
5722
5722
  };
5723
5723
 
5724
5724
  const pendingBatches = new Map();
5725
- const state$2 = {
5725
+ const state$3 = {
5726
5726
  nextTransactionId: 1
5727
5727
  };
5728
5728
  const queue = (uid, commands) => {
5729
- const transactionId = state$2.nextTransactionId++;
5729
+ const transactionId = state$3.nextTransactionId++;
5730
5730
  pendingBatches.set(transactionId, {
5731
5731
  commands,
5732
5732
  committed: false,
@@ -5915,7 +5915,7 @@ const handleMouseDown$3 = event => {
5915
5915
  const handleBlur$7 = () => {
5916
5916
  return ['handleBlur'];
5917
5917
  };
5918
- const handleFocus$8 = () => {
5918
+ const handleFocus$9 = () => {
5919
5919
  return ['handleFocus'];
5920
5920
  };
5921
5921
 
@@ -5936,7 +5936,7 @@ const ViewletActivityBarEvents = {
5936
5936
  __proto__: null,
5937
5937
  handleBlur: handleBlur$7,
5938
5938
  handleContextMenu: handleContextMenu$6,
5939
- handleFocus: handleFocus$8,
5939
+ handleFocus: handleFocus$9,
5940
5940
  handleMouseDown: handleMouseDown$3,
5941
5941
  returnValue: returnValue$8
5942
5942
  };
@@ -6027,7 +6027,7 @@ forwardViewletCommand('handleClickSize');
6027
6027
  forwardViewletCommand('handleClickDisable');
6028
6028
  forwardViewletCommand('handleClickUninstall');
6029
6029
  forwardViewletCommand('handleFilterInput');
6030
- const handleFocus$7 = forwardViewletCommand('handleFocus');
6030
+ const handleFocus$8 = forwardViewletCommand('handleFocus');
6031
6031
  const handleFocusIn$4 = forwardViewletCommand('handleFocusIn');
6032
6032
  forwardViewletCommand('handleIconError');
6033
6033
  const handleImageError = forwardViewletCommand('handleImageError');
@@ -6267,14 +6267,14 @@ const handleInput$5 = event => {
6267
6267
  } = target;
6268
6268
  handleInput$6(uid, value);
6269
6269
  };
6270
- const handleFocus$6 = event => {
6270
+ const handleFocus$7 = event => {
6271
6271
  const uid = fromEvent(event);
6272
- handleFocus$7(uid);
6272
+ handleFocus$8(uid);
6273
6273
  };
6274
6274
 
6275
6275
  const ViewletDebugConsoleEvents = {
6276
6276
  __proto__: null,
6277
- handleFocus: handleFocus$6,
6277
+ handleFocus: handleFocus$7,
6278
6278
  handleInput: handleInput$5
6279
6279
  };
6280
6280
 
@@ -7187,9 +7187,9 @@ const handleError$4 = event => {
7187
7187
  const uid = fromEvent(event);
7188
7188
  handleImageError(uid);
7189
7189
  };
7190
- const handleFocus$5 = event => {
7190
+ const handleFocus$6 = event => {
7191
7191
  const uid = fromEvent(event);
7192
- handleFocus$7(uid);
7192
+ handleFocus$8(uid);
7193
7193
  };
7194
7194
 
7195
7195
  const create$i = () => {
@@ -7205,7 +7205,7 @@ const attachEvents$4 = state => {
7205
7205
  } = state;
7206
7206
  attachEvents$7($Viewlet, {
7207
7207
  [ContextMenu]: handleContextMenu$2,
7208
- [FocusIn]: handleFocus$5,
7208
+ [FocusIn]: handleFocus$6,
7209
7209
  [PointerDown]: handlePointerDown$1,
7210
7210
  [PointerUp]: handlePointerUp
7211
7211
  });
@@ -7512,7 +7512,7 @@ const handleReplaceInput = event => {
7512
7512
  const handleReplaceFocus = event => {
7513
7513
  return ['FindWidget.handleReplaceFocus'];
7514
7514
  };
7515
- const handleFocus$4 = event => {
7515
+ const handleFocus$5 = event => {
7516
7516
  return ['FindWidget.handleFocus'];
7517
7517
  };
7518
7518
  const handleToggleReplaceFocus = event => {
@@ -7540,7 +7540,7 @@ const ViewletFindWidgetEvents = {
7540
7540
  handleClickReplace,
7541
7541
  handleClickReplaceAll,
7542
7542
  handleClickToggleReplace,
7543
- handleFocus: handleFocus$4,
7543
+ handleFocus: handleFocus$5,
7544
7544
  handleFocusClose,
7545
7545
  handleFocusNext,
7546
7546
  handleFocusPrevious,
@@ -7885,7 +7885,7 @@ const handleSashDoubleClick$1 = id => {
7885
7885
  const handleResize$1 = (width, height) => {
7886
7886
  send$1('Layout.handleResize', width, height);
7887
7887
  };
7888
- const handleFocus$3 = () => {
7888
+ const handleFocus$4 = () => {
7889
7889
  send$1('Layout.handleFocus');
7890
7890
  };
7891
7891
  const handleBlur$3 = () => {
@@ -7934,8 +7934,8 @@ const handleResize = () => {
7934
7934
  } = window;
7935
7935
  handleResize$1(innerWidth, innerHeight);
7936
7936
  };
7937
- const handleFocus$2 = () => {
7938
- handleFocus$3();
7937
+ const handleFocus$3 = () => {
7938
+ handleFocus$4();
7939
7939
  };
7940
7940
  const handleBlur$2 = () => {
7941
7941
  handleBlur$3();
@@ -7979,7 +7979,7 @@ const attachEvents$3 = state => {
7979
7979
  });
7980
7980
  attachEvents$7(window, {
7981
7981
  [Blur]: handleBlur$2,
7982
- [Focus]: handleFocus$2,
7982
+ [Focus]: handleFocus$3,
7983
7983
  [KeyDown]: handleKeyDown,
7984
7984
  [KeyUp]: handleKeyUp,
7985
7985
  [Resize]: handleResize
@@ -8463,7 +8463,7 @@ const handleClickSuggestion = event => {
8463
8463
  }
8464
8464
  acceptSuggestion(value);
8465
8465
  };
8466
- const handleFocus$1 = event => {
8466
+ const handleFocus$2 = event => {
8467
8467
  const {
8468
8468
  target
8469
8469
  } = event;
@@ -8525,7 +8525,7 @@ const ViewletSimpleBrowserEvents = {
8525
8525
  handleClickOpenExternal,
8526
8526
  handleClickReload,
8527
8527
  handleClickSuggestion,
8528
- handleFocus: handleFocus$1,
8528
+ handleFocus: handleFocus$2,
8529
8529
  handleInput: handleInput$2
8530
8530
  };
8531
8531
 
@@ -8549,9 +8549,9 @@ const handleContextMenu$1 = event => {
8549
8549
  handleContextMenu$5(uid, button, clientX, clientY);
8550
8550
  };
8551
8551
 
8552
- const handleFocus = event => {
8552
+ const handleFocus$1 = event => {
8553
8553
  const uid = fromEvent(event);
8554
- handleFocus$7(uid);
8554
+ handleFocus$8(uid);
8555
8555
  };
8556
8556
  const getButtonIndex = $Node => {
8557
8557
  let index = -1;
@@ -8626,7 +8626,7 @@ const ViewletSourceControlEvents = {
8626
8626
  __proto__: null,
8627
8627
  handleClick: handleClick$3,
8628
8628
  handleContextMenu: handleContextMenu$1,
8629
- handleFocus,
8629
+ handleFocus: handleFocus$1,
8630
8630
  handleInput: handleInput$1,
8631
8631
  handleMouseOut,
8632
8632
  handleMouseOver,
@@ -8869,7 +8869,7 @@ const handleMenuClick = event => {
8869
8869
  };
8870
8870
  const handleFocusIn$1 = event => {
8871
8871
  const uid = fromEvent(event);
8872
- handleFocus$7(uid);
8872
+ handleFocus$8(uid);
8873
8873
  };
8874
8874
 
8875
8875
  const ViewletTitleBarMenuBarEvents = {
@@ -9005,8 +9005,8 @@ const openMenu = (state, unFocusIndex, index, level, menuItems, menuFocusedIndex
9005
9005
  $Viewlet.children[unFocusIndex].removeAttribute(AriaOwns);
9006
9006
  }
9007
9007
  $Viewlet.children[index].ariaExpanded = True;
9008
- const $$Menus = state$5.$$Menus;
9009
- state$5.$$Menus = [];
9008
+ const $$Menus = state$6.$$Menus;
9009
+ state$6.$$Menus = [];
9010
9010
  // @ts-expect-error
9011
9011
  showControlled({
9012
9012
  $Parent: $Viewlet.children[index],
@@ -9414,14 +9414,14 @@ const load$1 = moduleId => {
9414
9414
  return loadModule();
9415
9415
  };
9416
9416
 
9417
- const state$1 = {
9417
+ const state$2 = {
9418
9418
  currentPanelView: undefined,
9419
9419
  currentSidebarView: undefined,
9420
9420
  modules: Object.create(null)
9421
9421
  };
9422
9422
 
9423
9423
  const create$2 = (id, uid = id) => {
9424
- const module = state$1.modules[id];
9424
+ const module = state$2.modules[id];
9425
9425
  if (!module) {
9426
9426
  throw new Error(`module not found: ${id}`);
9427
9427
  }
@@ -9440,7 +9440,7 @@ const create$2 = (id, uid = id) => {
9440
9440
  });
9441
9441
  };
9442
9442
  const createFunctionalRoot = (id, uid = id, hasFunctionalEvents, directEventRpcId) => {
9443
- let module = state$1.modules[id];
9443
+ let module = state$2.modules[id];
9444
9444
  if (hasFunctionalEvents) {
9445
9445
  module ||= {};
9446
9446
  }
@@ -9472,7 +9472,7 @@ const removeKeyBindings = id => {
9472
9472
  const loadModule = async id => {
9473
9473
  try {
9474
9474
  const module = await load$1(id);
9475
- state$1.modules[id] = module;
9475
+ state$2.modules[id] = module;
9476
9476
  } catch (error) {
9477
9477
  throw new VError(error, `Failed to load ${id}`);
9478
9478
  }
@@ -9627,7 +9627,7 @@ const refresh = (viewletId, viewletContext) => {
9627
9627
  instance.factory.refresh(instance.state, viewletContext);
9628
9628
  } else {
9629
9629
  // @ts-expect-error
9630
- state$1.refreshContext[viewletId] = viewletContext;
9630
+ state$2.refreshContext[viewletId] = viewletContext;
9631
9631
  }
9632
9632
  };
9633
9633
  const specialIds = new Set(['TitleBar', 'SideBar', 'Main', 'ActivityBar', 'StatusBar', 'Panel']);
@@ -9879,7 +9879,7 @@ const move = async (uid, selector, target) => {
9879
9879
  const attachWindowEvents = () => {
9880
9880
  attachEvents$7(window, {
9881
9881
  [Blur]: handleBlur$2,
9882
- [Focus]: handleFocus$2,
9882
+ [Focus]: handleFocus$3,
9883
9883
  [KeyDown]: handleKeyDown,
9884
9884
  [KeyUp]: handleKeyUp,
9885
9885
  [Resize]: handleResize
@@ -10250,6 +10250,52 @@ const clear = storageType => {
10250
10250
  storage.clear();
10251
10251
  };
10252
10252
 
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
+
10253
10299
  const reload = () => {
10254
10300
  location.reload();
10255
10301
  };
@@ -10288,10 +10334,18 @@ const handlePointerLeave = () => {
10288
10334
  // https://stackoverflow.com/questions/20084348/what-happens-to-a-web-worker-if-i-close-the-page-that-created-this-web-worker/20105455#20105455
10289
10335
  // beforeunload event has the same problem, pointerleave event sometimes works
10290
10336
  const onVisibilityChange = () => {
10337
+ listen();
10291
10338
  window.addEventListener('beforeunload', handleBeforeUnload);
10292
10339
  document.addEventListener('fullscreenchange', handleDocumentFullScreenChange);
10293
10340
  document.addEventListener('pointerleave', handlePointerLeave);
10294
10341
  };
10342
+ const handleBrowserFullWidthGesture = () => {
10343
+ send$1('Layout.handleBrowserFullWidthGesture');
10344
+ };
10345
+ const captureBrowserAddress = captureBrowserAddress$1;
10346
+ const focusBrowserAddress = focusBrowserAddress$1;
10347
+ const restoreCodingFocus = restoreCodingFocus$1;
10348
+ const revealBrowserTab = revealBrowserTab$1;
10295
10349
 
10296
10350
  const set$1 = title => {
10297
10351
  document.title = title;
@@ -10754,13 +10808,18 @@ const commandMap = {
10754
10808
  'WebView.load': load,
10755
10809
  'WebView.loadOnly': loadOnly,
10756
10810
  'WebView.setPort': setPort,
10811
+ 'Window.captureBrowserAddress': captureBrowserAddress,
10757
10812
  'Window.close': close,
10813
+ 'Window.focusBrowserAddress': focusBrowserAddress,
10814
+ 'Window.handleBrowserFullWidthGesture': handleBrowserFullWidthGesture,
10758
10815
  'Window.handleFullScreenChange': handleFullScreenChange,
10759
10816
  'Window.maximize': maximize,
10760
10817
  'Window.minimize': minimize,
10761
10818
  'Window.onVisibilityChange': onVisibilityChange,
10762
10819
  'Window.prepareClose': prepareClose,
10763
10820
  'Window.reload': reload,
10821
+ 'Window.restoreCodingFocus': restoreCodingFocus,
10822
+ 'Window.revealBrowserTab': revealBrowserTab,
10764
10823
  'Window.toggleFullScreen': toggleFullScreen,
10765
10824
  'Window.unmaximize': unmaximize,
10766
10825
  'WindowTitle.set': set$1
@@ -11217,15 +11276,15 @@ const main = async () => {
11217
11276
  initialize(location.search);
11218
11277
  Object.assign(commandMapRef, commandMap);
11219
11278
  enable(window);
11220
- state$1.modules[ColorPicker] = ViewletColorPicker;
11221
- state$1.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
11222
- state$1.modules[EditorCompletion] = ViewletEditorCompletion;
11223
- state$1.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
11224
- state$1.modules[EditorHover] = ViewletEditorHover;
11225
- state$1.modules[EditorRename] = ViewletEditorRename;
11226
- state$1.modules[EditorSourceActions] = ViewletEditorSourceActions;
11227
- state$1.modules[FindWidget] = ViewletFindWidget;
11228
- state$1.modules[TitleBar] = ViewletTitleBar;
11279
+ state$2.modules[ColorPicker] = ViewletColorPicker;
11280
+ state$2.modules[EditorCodeGenerator] = ViewletEditorCodeGenerator;
11281
+ state$2.modules[EditorCompletion] = ViewletEditorCompletion;
11282
+ state$2.modules[EditorCompletionDetails] = ViewletEditorCompletionDetails;
11283
+ state$2.modules[EditorHover] = ViewletEditorHover;
11284
+ state$2.modules[EditorRename] = ViewletEditorRename;
11285
+ state$2.modules[EditorSourceActions] = ViewletEditorSourceActions;
11286
+ state$2.modules[FindWidget] = ViewletFindWidget;
11287
+ state$2.modules[TitleBar] = ViewletTitleBar;
11229
11288
  // TODO this is discovered very late
11230
11289
  const launchWorkersResult = await launchWorkers();
11231
11290
  if (isError(launchWorkersResult)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.53.1",
3
+ "version": "30.54.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"