@lvce-editor/main-area-worker 9.32.5 → 9.32.7

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.
@@ -1562,7 +1562,7 @@ const create$3 = rpcId => {
1562
1562
  };
1563
1563
  };
1564
1564
 
1565
- const None$1 = 'none';
1565
+ const None$2 = 'none';
1566
1566
  const Tab$1 = 'tab';
1567
1567
  const TabList = 'tablist';
1568
1568
  const ToolBar = 'toolbar';
@@ -1746,7 +1746,7 @@ const Tab = 13;
1746
1746
  const Main$1 = 24;
1747
1747
 
1748
1748
  const Separator = 1;
1749
- const None = 0;
1749
+ const None$1 = 0;
1750
1750
 
1751
1751
  const Electron = 2;
1752
1752
 
@@ -1817,12 +1817,15 @@ const writeClipBoardText = async text => {
1817
1817
  };
1818
1818
 
1819
1819
  const addClosedTabs = (state, entries) => {
1820
+ const {
1821
+ closedTabs
1822
+ } = state;
1820
1823
  if (entries.length === 0) {
1821
1824
  return state;
1822
1825
  }
1823
1826
  return {
1824
1827
  ...state,
1825
- closedTabs: [...state.closedTabs, ...entries].slice(-20)
1828
+ closedTabs: [...closedTabs, ...entries].slice(-20)
1826
1829
  };
1827
1830
  };
1828
1831
 
@@ -1844,10 +1847,13 @@ const redistributeSizesWithRounding = groups => {
1844
1847
  };
1845
1848
 
1846
1849
  const withGroupsAndActiveGroup = (state, groups, activeGroupId) => {
1850
+ const {
1851
+ layout
1852
+ } = state;
1847
1853
  return {
1848
1854
  ...state,
1849
1855
  layout: {
1850
- ...state.layout,
1856
+ ...layout,
1851
1857
  activeGroupId,
1852
1858
  groups
1853
1859
  }
@@ -1859,20 +1865,26 @@ const withEmptyGroups = state => {
1859
1865
  };
1860
1866
 
1861
1867
  const withGroups = (state, groups) => {
1868
+ const {
1869
+ layout
1870
+ } = state;
1862
1871
  return {
1863
1872
  ...state,
1864
1873
  layout: {
1865
- ...state.layout,
1874
+ ...layout,
1866
1875
  groups
1867
1876
  }
1868
1877
  };
1869
1878
  };
1870
1879
 
1871
1880
  const closeTab = (state, groupId, tabId) => {
1881
+ const {
1882
+ layout
1883
+ } = state;
1872
1884
  const {
1873
1885
  activeGroupId,
1874
1886
  groups
1875
- } = state.layout;
1887
+ } = layout;
1876
1888
 
1877
1889
  // Find the group to close the tab from
1878
1890
  const groupIndex = getGroupIndexById(state, groupId);
@@ -1951,10 +1963,13 @@ const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) =>
1951
1963
  };
1952
1964
 
1953
1965
  const getActiveFileUri = state => {
1966
+ const {
1967
+ layout
1968
+ } = state;
1954
1969
  const {
1955
1970
  activeGroupId,
1956
1971
  groups
1957
- } = state.layout;
1972
+ } = layout;
1958
1973
  const activeGroup = groups.find(group => group.id === activeGroupId);
1959
1974
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
1960
1975
  if (!activeTab) {
@@ -2301,6 +2316,9 @@ const findTabInState = (state, groupId, tabId) => {
2301
2316
  };
2302
2317
 
2303
2318
  const closeTabWithViewlet = async (state, groupId, tabId) => {
2319
+ const {
2320
+ layout
2321
+ } = state;
2304
2322
  const tab = findTabInState(state, groupId, tabId);
2305
2323
  const commands = [];
2306
2324
  if (tab && tab.editorUid !== -1) {
@@ -2310,7 +2328,7 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2310
2328
  commands.push(...disposeCommands);
2311
2329
  }
2312
2330
  const newState = closeTab(state, groupId, tabId);
2313
- const group = state.layout.groups.find(g => g.id === groupId);
2331
+ const group = layout.groups.find(g => g.id === groupId);
2314
2332
  const wasActiveTab = group?.activeTabId === tabId;
2315
2333
  const newGroup = wasActiveTab ? newState.layout.groups.find(candidate => candidate.id === groupId) : undefined;
2316
2334
  const newActiveTabId = newGroup?.activeTabId;
@@ -2420,9 +2438,12 @@ const disposeEditors = async editorUids => {
2420
2438
  };
2421
2439
 
2422
2440
  const closeAll$1 = async state => {
2423
- const editorUids = state.layout.groups.flatMap(group => group.tabs.map(tab => tab.editorUid)).filter(editorUid => editorUid !== -1);
2441
+ const {
2442
+ layout
2443
+ } = state;
2444
+ const editorUids = layout.groups.flatMap(group => group.tabs.map(tab => tab.editorUid)).filter(editorUid => editorUid !== -1);
2424
2445
  await disposeEditors(editorUids);
2425
- const entries = state.layout.groups.flatMap((group, groupIndex) => {
2446
+ const entries = layout.groups.flatMap((group, groupIndex) => {
2426
2447
  return group.tabs.map((tab, tabIndex) => ({
2427
2448
  group,
2428
2449
  groupIndex,
@@ -2566,9 +2587,12 @@ const closeSavedInGroup = group => {
2566
2587
  };
2567
2588
  };
2568
2589
  const closeSaved$1 = state => {
2590
+ const {
2591
+ layout
2592
+ } = state;
2569
2593
  const {
2570
2594
  groups
2571
- } = state.layout;
2595
+ } = layout;
2572
2596
  const closedTabs = groups.flatMap((group, groupIndex) => {
2573
2597
  return group.tabs.map((tab, tabIndex) => ({
2574
2598
  group,
@@ -2582,7 +2606,10 @@ const closeSaved$1 = state => {
2582
2606
  };
2583
2607
 
2584
2608
  const closeFirstTabByUri = (state, uri) => {
2585
- const matchingGroup = state.layout.groups.find(group => {
2609
+ const {
2610
+ layout
2611
+ } = state;
2612
+ const matchingGroup = layout.groups.find(group => {
2586
2613
  return group.tabs.some(tab => tab.uri === uri);
2587
2614
  });
2588
2615
  const matchingTab = matchingGroup?.tabs.find(tab => tab.uri === uri);
@@ -2604,7 +2631,10 @@ const closeTabsByUris = (state, uris) => {
2604
2631
  };
2605
2632
 
2606
2633
  const getGroupById = (state, groupId) => {
2607
- return state.layout.groups.find(group => group.id === groupId);
2634
+ const {
2635
+ layout
2636
+ } = state;
2637
+ return layout.groups.find(group => group.id === groupId);
2608
2638
  };
2609
2639
 
2610
2640
  const closeTabsRight = (state, groupId) => {
@@ -2664,9 +2694,12 @@ const findGroupById = (state, groupId) => {
2664
2694
  };
2665
2695
 
2666
2696
  const copyIntoNewWindow$1 = async state => {
2697
+ const {
2698
+ layout
2699
+ } = state;
2667
2700
  const {
2668
2701
  activeGroupId
2669
- } = state.layout;
2702
+ } = layout;
2670
2703
  const group = findGroupById(state, activeGroupId ?? 0);
2671
2704
  if (!group) {
2672
2705
  return state;
@@ -2747,12 +2780,12 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
2747
2780
  set(uid, state, state);
2748
2781
  };
2749
2782
 
2750
- const isEqual$1 = (oldState, newState) => {
2783
+ const isEqual$2 = (oldState, newState) => {
2751
2784
  return false;
2752
2785
  };
2753
2786
 
2754
- const isEqual = (oldState, newState) => {
2755
- return oldState.layout === newState.layout;
2787
+ const isEqual$1 = (oldState, newState) => {
2788
+ return oldState.dragOverlay === newState.dragOverlay && oldState.layout === newState.layout;
2756
2789
  };
2757
2790
 
2758
2791
  const RenderItems = 4;
@@ -2763,7 +2796,7 @@ const RenderPendingViewletUpdate = 12;
2763
2796
  const isPendingViewletUpdateEqual = (oldState, newState) => {
2764
2797
  return newState.pendingViewletUpdate === undefined;
2765
2798
  };
2766
- const modules = [isEqual, isEqual$1, isPendingViewletUpdateEqual];
2799
+ const modules = [isEqual$1, isEqual$2, isPendingViewletUpdateEqual];
2767
2800
  const numbers = [RenderIncremental, RenderCss, RenderPendingViewletUpdate];
2768
2801
 
2769
2802
  const diff = (oldState, newState) => {
@@ -2983,7 +3016,10 @@ const getActiveTabId$1 = state => {
2983
3016
  };
2984
3017
 
2985
3018
  const getSelectedTabData = (state, groupIndex, index) => {
2986
- const group = state.layout.groups[groupIndex];
3019
+ const {
3020
+ layout
3021
+ } = state;
3022
+ const group = layout.groups[groupIndex];
2987
3023
  if (!group || index < 0 || index >= group.tabs.length) {
2988
3024
  return undefined;
2989
3025
  }
@@ -3043,11 +3079,18 @@ const findTabById = (state, tabId) => {
3043
3079
  };
3044
3080
 
3045
3081
  const getSelectedTabBounds = state => {
3082
+ const {
3083
+ height,
3084
+ tabHeight,
3085
+ width,
3086
+ x,
3087
+ y
3088
+ } = state;
3046
3089
  return {
3047
- height: state.height - state.tabHeight,
3048
- width: state.width,
3049
- x: state.x,
3050
- y: state.y + state.tabHeight
3090
+ height: height - tabHeight,
3091
+ width,
3092
+ x,
3093
+ y: y + tabHeight
3051
3094
  };
3052
3095
  };
3053
3096
 
@@ -3095,11 +3138,14 @@ const getViewletModuleId = async tab => {
3095
3138
  };
3096
3139
 
3097
3140
  const startContentLoading = async (oldState, state, tabId, path, requestId) => {
3141
+ const {
3142
+ uid
3143
+ } = state;
3098
3144
  try {
3099
3145
  const getLatestState = () => {
3100
- return get(state.uid).newState;
3146
+ return get(uid).newState;
3101
3147
  };
3102
- set(state.uid, oldState, state);
3148
+ set(uid, oldState, state);
3103
3149
  const newState = await loadTabContentAsync(tabId, path, requestId, getLatestState);
3104
3150
  return newState;
3105
3151
  } catch {
@@ -3281,8 +3327,8 @@ const getActiveGroup = (groups, activeGroupId) => {
3281
3327
  return groups.find(g => g.id === activeGroupId);
3282
3328
  };
3283
3329
 
3284
- const Left = 'left';
3285
- const Right = 'right';
3330
+ const Left$1 = 'left';
3331
+ const Right$1 = 'right';
3286
3332
 
3287
3333
  const getActiveTab = state => {
3288
3334
  const {
@@ -3374,12 +3420,18 @@ const getRestoredTab = tab => {
3374
3420
  };
3375
3421
  };
3376
3422
  const getStateWithoutLastClosedTab = state => {
3423
+ const {
3424
+ closedTabs
3425
+ } = state;
3377
3426
  return {
3378
3427
  ...state,
3379
- closedTabs: state.closedTabs.slice(0, -1)
3428
+ closedTabs: closedTabs.slice(0, -1)
3380
3429
  };
3381
3430
  };
3382
3431
  const restoreExistingUri = (state, entry) => {
3432
+ const {
3433
+ layout
3434
+ } = state;
3383
3435
  if (!entry.tab.uri) {
3384
3436
  return undefined;
3385
3437
  }
@@ -3387,11 +3439,11 @@ const restoreExistingUri = (state, entry) => {
3387
3439
  if (!existing) {
3388
3440
  return undefined;
3389
3441
  }
3390
- const groupIndex = state.layout.groups.findIndex(group => group.id === existing.groupId);
3442
+ const groupIndex = layout.groups.findIndex(group => group.id === existing.groupId);
3391
3443
  if (groupIndex === -1) {
3392
3444
  return undefined;
3393
3445
  }
3394
- const tabIndex = state.layout.groups[groupIndex].tabs.findIndex(tab => tab.id === existing.tab.id);
3446
+ const tabIndex = layout.groups[groupIndex].tabs.findIndex(tab => tab.id === existing.tab.id);
3395
3447
  if (tabIndex === -1) {
3396
3448
  return undefined;
3397
3449
  }
@@ -3411,9 +3463,12 @@ const restoreExistingUri = (state, entry) => {
3411
3463
  };
3412
3464
  };
3413
3465
  const restoreIntoExistingGroup = (state, entry) => {
3466
+ const {
3467
+ layout
3468
+ } = state;
3414
3469
  const {
3415
3470
  groups
3416
- } = state.layout;
3471
+ } = layout;
3417
3472
  const groupIndex = groups.findIndex(group => group.id === entry.group.id);
3418
3473
  if (groupIndex === -1) {
3419
3474
  return undefined;
@@ -3501,7 +3556,10 @@ const restoreIntoRecreatedGroup = (state, entry) => {
3501
3556
  };
3502
3557
  };
3503
3558
  const restoreClosedTabState = state => {
3504
- const entry = state.closedTabs.at(-1);
3559
+ const {
3560
+ closedTabs
3561
+ } = state;
3562
+ const entry = closedTabs.at(-1);
3505
3563
  if (!entry) {
3506
3564
  return undefined;
3507
3565
  }
@@ -3550,7 +3608,10 @@ const getActiveTabId = state => {
3550
3608
  };
3551
3609
 
3552
3610
  const getTabCount = state => {
3553
- return state.layout.groups.reduce((sum, group) => sum + group.tabs.length, 0);
3611
+ const {
3612
+ layout
3613
+ } = state;
3614
+ return layout.groups.reduce((sum, group) => sum + group.tabs.length, 0);
3554
3615
  };
3555
3616
 
3556
3617
  const getCurrentState = state => {
@@ -3664,9 +3725,10 @@ const updateTabUriTitle = (tab, homeDirUri) => {
3664
3725
  };
3665
3726
  const updateTabUriTitles = state => {
3666
3727
  const {
3728
+ homeDirUri: rawHomeDirUri,
3667
3729
  layout
3668
3730
  } = state;
3669
- const homeDirUri = state.homeDirUri || '';
3731
+ const homeDirUri = rawHomeDirUri || '';
3670
3732
  return {
3671
3733
  ...state,
3672
3734
  layout: {
@@ -3681,6 +3743,7 @@ const updateTabUriTitles = state => {
3681
3743
 
3682
3744
  const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
3683
3745
  const {
3746
+ homeDirUri,
3684
3747
  layout
3685
3748
  } = state;
3686
3749
  const {
@@ -3702,7 +3765,7 @@ const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getL
3702
3765
  loadingState: 'loading',
3703
3766
  title,
3704
3767
  uri,
3705
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3768
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3706
3769
  };
3707
3770
  const newGroup = {
3708
3771
  activeTabId: newTab.id,
@@ -3761,6 +3824,7 @@ const openTab = (state, groupId, tab) => {
3761
3824
  const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
3762
3825
  // Find the active group (by activeGroupId or focused flag)
3763
3826
  const {
3827
+ homeDirUri,
3764
3828
  layout
3765
3829
  } = state;
3766
3830
  const {
@@ -3798,7 +3862,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
3798
3862
  loadingState: 'loading',
3799
3863
  title,
3800
3864
  uri,
3801
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3865
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3802
3866
  };
3803
3867
  });
3804
3868
  return {
@@ -3832,7 +3896,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
3832
3896
  loadingState: 'loading',
3833
3897
  title,
3834
3898
  uri: uri,
3835
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3899
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3836
3900
  };
3837
3901
  newState = openTab(state, activeGroup.id, newTab);
3838
3902
  } else {
@@ -4047,7 +4111,10 @@ const getExistingTabState = (state, existingTab, preview) => {
4047
4111
  return switchTab(pinnedState, existingTab.groupId, existingTab.tab.id);
4048
4112
  };
4049
4113
  const getActivePreviewEditorUid = state => {
4050
- const activeGroup = state.layout.activeGroupId === undefined ? state.layout.groups.find(group => group.focused) : state.layout.groups.find(group => group.id === state.layout.activeGroupId);
4114
+ const {
4115
+ layout
4116
+ } = state;
4117
+ const activeGroup = layout.activeGroupId === undefined ? layout.groups.find(group => group.focused) : layout.groups.find(group => group.id === layout.activeGroupId);
4051
4118
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
4052
4119
  return activeTab?.isPreview ? activeTab.editorUid : -1;
4053
4120
  };
@@ -4254,17 +4321,20 @@ const rebalanceGroupSizes = groups => {
4254
4321
  }));
4255
4322
  };
4256
4323
  const isTrailingSplit = direction => {
4257
- return direction === Right || direction === 'down';
4324
+ return direction === Right$1 || direction === 'down';
4258
4325
  };
4259
4326
  const getSplitLayoutDirection = direction => {
4260
- return direction === Left || direction === Right ? Horizontal : Vertical;
4327
+ return direction === Left$1 || direction === Right$1 ? Horizontal : Vertical;
4261
4328
  };
4262
4329
  const createNextState = (state, activeGroupId, groups) => {
4330
+ const {
4331
+ layout
4332
+ } = state;
4263
4333
  return {
4264
4334
  ...state,
4265
4335
  layout: {
4266
4336
  activeGroupId,
4267
- direction: state.layout.direction,
4337
+ direction: layout.direction,
4268
4338
  groups
4269
4339
  }
4270
4340
  };
@@ -4433,7 +4503,7 @@ const handleClickAction = async (state, action, rawGroupId) => {
4433
4503
  case RetryOpen:
4434
4504
  return retryOpen(state);
4435
4505
  case SplitRight$1:
4436
- return splitEditorGroup$1(state, activeGroup.id, Right);
4506
+ return splitEditorGroup$1(state, activeGroup.id, Right$1);
4437
4507
  case TogglePreview$1:
4438
4508
  return handleClickTogglePreview(state);
4439
4509
  default:
@@ -4486,6 +4556,9 @@ const show2 = async (uid, menuId, x, y, args) => {
4486
4556
 
4487
4557
  const NoGroupId = -1;
4488
4558
  const handleContextMenu = async (state, rawGroupId, x, y) => {
4559
+ const {
4560
+ uid
4561
+ } = state;
4489
4562
  number(x);
4490
4563
  number(y);
4491
4564
  if (rawGroupId === undefined) {
@@ -4495,7 +4568,7 @@ const handleContextMenu = async (state, rawGroupId, x, y) => {
4495
4568
  if (Number.isNaN(groupId)) {
4496
4569
  return state;
4497
4570
  }
4498
- await show2(state.uid, Main$1, x, y, {
4571
+ await show2(uid, Main$1, x, y, {
4499
4572
  groupId,
4500
4573
  menuId: Main$1
4501
4574
  });
@@ -4503,12 +4576,15 @@ const handleContextMenu = async (state, rawGroupId, x, y) => {
4503
4576
  };
4504
4577
 
4505
4578
  const handleDoubleClick = (state, groupIndexRaw, indexRaw) => {
4579
+ const {
4580
+ layout
4581
+ } = state;
4506
4582
  if (!groupIndexRaw || !indexRaw) {
4507
4583
  return state;
4508
4584
  }
4509
4585
  const groupIndex = Number.parseInt(groupIndexRaw);
4510
4586
  const tabIndex = Number.parseInt(indexRaw);
4511
- const tab = state.layout.groups[groupIndex]?.tabs[tabIndex];
4587
+ const tab = layout.groups[groupIndex]?.tabs[tabIndex];
4512
4588
  if (!tab?.isPreview) {
4513
4589
  return state;
4514
4590
  }
@@ -4517,6 +4593,118 @@ const handleDoubleClick = (state, groupIndexRaw, indexRaw) => {
4517
4593
  });
4518
4594
  };
4519
4595
 
4596
+ const handleDragLeave = state => {
4597
+ const {
4598
+ dragOverlay
4599
+ } = state;
4600
+ if (!dragOverlay) {
4601
+ return state;
4602
+ }
4603
+ return {
4604
+ ...state,
4605
+ dragOverlay: undefined
4606
+ };
4607
+ };
4608
+
4609
+ const None = 0;
4610
+ const Up = 1;
4611
+ const Down = 2;
4612
+ const Left = 3;
4613
+ const Right = 4;
4614
+
4615
+ const getSplitDirection = (x, y, width, height) => {
4616
+ const percentX = x / width;
4617
+ if (percentX < 0.25) {
4618
+ return Left;
4619
+ }
4620
+ if (percentX > 0.75) {
4621
+ return Right;
4622
+ }
4623
+ const percentY = y / height;
4624
+ if (percentY < 0.25) {
4625
+ return Up;
4626
+ }
4627
+ if (percentY > 0.75) {
4628
+ return Down;
4629
+ }
4630
+ return None;
4631
+ };
4632
+ const getOverlay = (x, y, width, height, splitDirection) => {
4633
+ const halfHeight = height / 2;
4634
+ const halfWidth = width / 2;
4635
+ switch (splitDirection) {
4636
+ case Down:
4637
+ return {
4638
+ height: halfHeight,
4639
+ width,
4640
+ x,
4641
+ y: y + halfHeight
4642
+ };
4643
+ case Left:
4644
+ return {
4645
+ height,
4646
+ width: halfWidth,
4647
+ x,
4648
+ y
4649
+ };
4650
+ case Right:
4651
+ return {
4652
+ height,
4653
+ width: halfWidth,
4654
+ x: x + halfWidth,
4655
+ y
4656
+ };
4657
+ case Up:
4658
+ return {
4659
+ height: halfHeight,
4660
+ width,
4661
+ x,
4662
+ y
4663
+ };
4664
+ default:
4665
+ return {
4666
+ height,
4667
+ width,
4668
+ x,
4669
+ y
4670
+ };
4671
+ }
4672
+ };
4673
+ const getDragOverlay = (state, eventX, eventY) => {
4674
+ const {
4675
+ height,
4676
+ layout,
4677
+ tabHeight,
4678
+ width,
4679
+ x,
4680
+ y
4681
+ } = state;
4682
+ const hasOpenEditor = layout.groups.some(group => !group.isEmpty);
4683
+ const contentY = hasOpenEditor ? tabHeight : 0;
4684
+ const contentHeight = Math.max(0, height - contentY);
4685
+ const relativeX = eventX - x;
4686
+ const relativeY = eventY - y - contentY;
4687
+ const splitDirection = getSplitDirection(relativeX, relativeY, width, contentHeight);
4688
+ return getOverlay(0, contentY, width, contentHeight, splitDirection);
4689
+ };
4690
+
4691
+ const isEqual = (oldOverlay, newOverlay) => {
4692
+ return oldOverlay?.x === newOverlay?.x && oldOverlay?.y === newOverlay?.y && oldOverlay?.width === newOverlay?.width && oldOverlay?.height === newOverlay?.height;
4693
+ };
4694
+ const handleDragOver = (state, eventX, eventY) => {
4695
+ const {
4696
+ dragOverlay: oldDragOverlay
4697
+ } = state;
4698
+ const dragOverlay = getDragOverlay(state, eventX, eventY);
4699
+ if (isEqual(oldDragOverlay, dragOverlay)) {
4700
+ return state;
4701
+ }
4702
+ return {
4703
+ ...state,
4704
+ dragOverlay
4705
+ };
4706
+ };
4707
+
4520
4708
  const EditorGroupHeader = 'EditorGroupHeader';
4521
4709
  const EmptyGroupHeader = 'EmptyGroupHeader';
4522
4710
  const EmptyGroupCloseButton = 'EmptyGroupCloseButton';
@@ -4539,6 +4727,7 @@ const TextEditorLoading = 'TextEditor TextEditor--loading';
4539
4727
  const EditorContentLoading = 'EditorContent EditorContent--loading';
4540
4728
  const TextEditorError = 'TextEditor TextEditorError';
4541
4729
  const EditorContentError = 'EditorContent EditorContentError';
4730
+ const DragOverlay = 'DragOverlay';
4542
4731
  const Main = 'Main';
4543
4732
  const EDITOR_GROUPS_CONTAINER = 'editor-groups-container';
4544
4733
  const TabIcon = 'TabIcon';
@@ -4677,16 +4866,20 @@ const getAllTabs = layout => {
4677
4866
  };
4678
4867
 
4679
4868
  const loadFileIcons = async state => {
4869
+ const {
4870
+ fileIconCache,
4871
+ layout
4872
+ } = state;
4680
4873
  try {
4681
- const allTabs = getAllTabs(state.layout);
4874
+ const allTabs = getAllTabs(layout);
4682
4875
  const {
4683
4876
  newFileIconCache
4684
- } = await getFileIconsForTabs(allTabs, state.fileIconCache);
4877
+ } = await getFileIconsForTabs(allTabs, fileIconCache);
4685
4878
 
4686
4879
  // Update tabs with their icons
4687
4880
  const updatedLayout = {
4688
- ...state.layout,
4689
- groups: state.layout.groups.map(group => ({
4881
+ ...layout,
4882
+ groups: layout.groups.map(group => ({
4690
4883
  ...group,
4691
4884
  tabs: group.tabs.map(tab => ({
4692
4885
  ...tab,
@@ -4701,8 +4894,8 @@ const loadFileIcons = async state => {
4701
4894
  } catch {
4702
4895
  // If icon request fails, continue without icons
4703
4896
  return {
4704
- fileIconCache: state.fileIconCache,
4705
- updatedLayout: state.layout
4897
+ fileIconCache,
4898
+ updatedLayout: layout
4706
4899
  };
4707
4900
  }
4708
4901
  };
@@ -4840,17 +5033,20 @@ const getSashCorner = layout => {
4840
5033
  };
4841
5034
 
4842
5035
  const handleSashCornerPointerDown = async (state, clientX, clientY) => {
5036
+ const {
5037
+ layout
5038
+ } = state;
4843
5039
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
4844
5040
  return state;
4845
5041
  }
4846
- const sashCorner = getSashCorner(state.layout);
5042
+ const sashCorner = getSashCorner(layout);
4847
5043
  if (!sashCorner) {
4848
5044
  return state;
4849
5045
  }
4850
5046
  return {
4851
5047
  ...state,
4852
5048
  sashCornerDrag: {
4853
- groupSizes: state.layout.groups.map(group => ({
5049
+ groupSizes: layout.groups.map(group => ({
4854
5050
  id: group.id,
4855
5051
  size: group.size
4856
5052
  })),
@@ -4893,6 +5089,9 @@ const getBeforeSize = (startSize, deltaPx, axisSize, minSizePx, totalSize) => {
4893
5089
  const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4894
5090
  const {
4895
5091
  height,
5092
+ layout,
5093
+ minGroupHeightPx,
5094
+ minGroupWidthPx,
4896
5095
  sashCornerDrag,
4897
5096
  width
4898
5097
  } = state;
@@ -4912,8 +5111,8 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4912
5111
  }
4913
5112
  const xBeforeStartSize = sumGroupSizes(groupSizes, xBeforeGroupIds);
4914
5113
  const yBeforeStartSize = sumGroupSizes(groupSizes, yBeforeGroupIds);
4915
- const xBeforeSize = getBeforeSize(xBeforeStartSize, clientX - startClientX, width, state.minGroupWidthPx, totalSize);
4916
- const yBeforeSize = getBeforeSize(yBeforeStartSize, clientY - startClientY, height, state.minGroupHeightPx, totalSize);
5114
+ const xBeforeSize = getBeforeSize(xBeforeStartSize, clientX - startClientX, width, minGroupWidthPx, totalSize);
5115
+ const yBeforeSize = getBeforeSize(yBeforeStartSize, clientY - startClientY, height, minGroupHeightPx, totalSize);
4917
5116
  const xAfterSize = totalSize - xBeforeSize;
4918
5117
  const yAfterSize = totalSize - yBeforeSize;
4919
5118
  const xBeforeGroupIdSet = new Set(xBeforeGroupIds);
@@ -4921,8 +5120,8 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4921
5120
  return {
4922
5121
  ...state,
4923
5122
  layout: {
4924
- ...state.layout,
4925
- groups: state.layout.groups.map(group => {
5123
+ ...layout,
5124
+ groups: layout.groups.map(group => {
4926
5125
  const xSize = xBeforeGroupIdSet.has(group.id) ? xBeforeSize : xAfterSize;
4927
5126
  const ySize = yBeforeGroupIdSet.has(group.id) ? yBeforeSize : yAfterSize;
4928
5127
  return {
@@ -4935,7 +5134,10 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4935
5134
  };
4936
5135
 
4937
5136
  const handleSashCornerPointerUp = async state => {
4938
- if (!state.sashCornerDrag) {
5137
+ const {
5138
+ sashCornerDrag
5139
+ } = state;
5140
+ if (!sashCornerDrag) {
4939
5141
  return state;
4940
5142
  }
4941
5143
  return {
@@ -5003,6 +5205,8 @@ const handleSashPointerMove = async (state, clientX, clientY) => {
5003
5205
  const {
5004
5206
  height,
5005
5207
  layout,
5208
+ minGroupHeightPx,
5209
+ minGroupWidthPx,
5006
5210
  sashDrag,
5007
5211
  width
5008
5212
  } = state;
@@ -5023,7 +5227,7 @@ const handleSashPointerMove = async (state, clientX, clientY) => {
5023
5227
  const deltaPx = direction === Horizontal ? clientX - sashDrag.startClientX : clientY - sashDrag.startClientY;
5024
5228
  const deltaPercent = deltaPx / axisSize * 100;
5025
5229
  const totalResizableSize = sashDrag.beforeSize + sashDrag.afterSize;
5026
- const minGroupSizePx = direction === Horizontal ? state.minGroupWidthPx : state.minGroupHeightPx;
5230
+ const minGroupSizePx = direction === Horizontal ? minGroupWidthPx : minGroupHeightPx;
5027
5231
  let minGroupSize = getMinGroupSizePercent(axisSize, minGroupSizePx);
5028
5232
 
5029
5233
  // If the minimum size makes it impossible to fit two groups, relax the constraint
@@ -5083,6 +5287,7 @@ const handleTabContextMenu = async (state, button, x, y) => {
5083
5287
 
5084
5288
  const handleUriChange = async (state, oldUri, newUri) => {
5085
5289
  const {
5290
+ homeDirUri,
5086
5291
  layout
5087
5292
  } = state;
5088
5293
  const {
@@ -5113,7 +5318,7 @@ const handleUriChange = async (state, oldUri, newUri) => {
5113
5318
  editorInput,
5114
5319
  title: getLabel(renamedUri),
5115
5320
  uri: renamedUri,
5116
- uriTitle: getUriTitle(renamedUri, state.homeDirUri || '')
5321
+ uriTitle: getUriTitle(renamedUri, homeDirUri || '')
5117
5322
  };
5118
5323
  }
5119
5324
  return tab;
@@ -5324,15 +5529,18 @@ const updateTabs = (state, editorUids) => {
5324
5529
  };
5325
5530
 
5326
5531
  const restoreAndCreateEditors = async (state, restoredLayout) => {
5532
+ const {
5533
+ tabHeight
5534
+ } = state;
5327
5535
  let newState = {
5328
5536
  ...state,
5329
5537
  layout: restoredLayout
5330
5538
  };
5331
5539
  const bounds = {
5332
- height: newState.height - state.tabHeight,
5540
+ height: newState.height - tabHeight,
5333
5541
  width: newState.width,
5334
5542
  x: newState.x,
5335
- y: newState.y + state.tabHeight
5543
+ y: newState.y + tabHeight
5336
5544
  };
5337
5545
 
5338
5546
  // Get viewlet module IDs for all active tabs
@@ -5604,12 +5812,15 @@ const menuEntrySeparator = {
5604
5812
  };
5605
5813
 
5606
5814
  const getNewWindowMenuEntries = state => {
5607
- if (state.platform !== Electron) {
5815
+ const {
5816
+ platform
5817
+ } = state;
5818
+ if (platform !== Electron) {
5608
5819
  return [];
5609
5820
  }
5610
5821
  return [menuEntrySeparator, {
5611
5822
  command: 'MainArea.newWindow',
5612
- flags: None,
5823
+ flags: None$1,
5613
5824
  id: 'newWindow',
5614
5825
  label: newWindow$1()
5615
5826
  }];
@@ -5619,37 +5830,37 @@ const getMenuEntries$2 = (state, groupId) => {
5619
5830
  const groupArgs = getMenuEntryArgs(groupId);
5620
5831
  const entries = [{
5621
5832
  command: 'MainArea.newFile',
5622
- flags: None,
5833
+ flags: None$1,
5623
5834
  id: 'newTextFile',
5624
5835
  label: newTextFile()
5625
5836
  }, {
5626
5837
  args: [QuickPick, 'file'],
5627
5838
  command: 'Viewlet.openWidget',
5628
- flags: None,
5839
+ flags: None$1,
5629
5840
  id: 'openFile',
5630
5841
  label: openFile()
5631
5842
  }, menuEntrySeparator, {
5632
5843
  args: groupArgs,
5633
5844
  command: 'MainArea.splitUp',
5634
- flags: None,
5845
+ flags: None$1,
5635
5846
  id: 'splitUp',
5636
5847
  label: splitUp$1()
5637
5848
  }, {
5638
5849
  args: groupArgs,
5639
5850
  command: 'MainArea.splitDown',
5640
- flags: None,
5851
+ flags: None$1,
5641
5852
  id: 'splitDown',
5642
5853
  label: splitDown$1()
5643
5854
  }, {
5644
5855
  args: groupArgs,
5645
5856
  command: 'MainArea.splitLeft',
5646
- flags: None,
5857
+ flags: None$1,
5647
5858
  id: 'splitLeft',
5648
5859
  label: splitLeft$1()
5649
5860
  }, {
5650
5861
  args: groupArgs,
5651
5862
  command: 'MainArea.splitRight',
5652
- flags: None,
5863
+ flags: None$1,
5653
5864
  id: 'splitRight',
5654
5865
  label: splitRight$1()
5655
5866
  }, ...getNewWindowMenuEntries(state)];
@@ -5659,7 +5870,7 @@ const getMenuEntries$2 = (state, groupId) => {
5659
5870
  return [...entries, menuEntrySeparator, {
5660
5871
  args: [groupId],
5661
5872
  command: 'MainArea.closeEditorGroup',
5662
- flags: None,
5873
+ flags: None$1,
5663
5874
  id: 'closeGroup',
5664
5875
  label: closeEditorGroup()
5665
5876
  }];
@@ -5690,101 +5901,101 @@ const getMenuEntries$1 = state => {
5690
5901
  } = tab;
5691
5902
  return [{
5692
5903
  command: 'Main.closeFocusedTab',
5693
- flags: None,
5904
+ flags: None$1,
5694
5905
  id: 'tabClose',
5695
5906
  label: close()
5696
5907
  }, {
5697
5908
  command: 'Main.closeOthers',
5698
- flags: None,
5909
+ flags: None$1,
5699
5910
  id: 'tabCloseOthers',
5700
5911
  label: closeOthers()
5701
5912
  }, {
5702
5913
  command: 'Main.closeTabsRight',
5703
- flags: None,
5914
+ flags: None$1,
5704
5915
  id: 'tabCloseToTheRight',
5705
5916
  label: closeToTheRight()
5706
5917
  }, {
5707
5918
  command: 'Main.closeSaved',
5708
- flags: None,
5919
+ flags: None$1,
5709
5920
  id: 'tabCloseSaved',
5710
5921
  label: closeSaved()
5711
5922
  }, {
5712
5923
  command: 'Main.closeAll',
5713
- flags: None,
5924
+ flags: None$1,
5714
5925
  id: 'tabCloseAll',
5715
5926
  label: closeAll()
5716
5927
  }, menuEntrySeparator, {
5717
5928
  args: [path],
5718
5929
  command: 'Main.copyPath',
5719
- flags: None,
5930
+ flags: None$1,
5720
5931
  id: 'copyPath',
5721
5932
  label: copyPath()
5722
5933
  }, {
5723
5934
  args: [path],
5724
5935
  command: 'Main.copyRelativePath',
5725
- flags: None,
5936
+ flags: None$1,
5726
5937
  id: 'copyRelativePath',
5727
5938
  label: copyRelativePath()
5728
5939
  }, menuEntrySeparator, {
5729
5940
  command: 'Main.reopenEditorWith',
5730
- flags: None,
5941
+ flags: None$1,
5731
5942
  id: 'reopenEditorWith',
5732
5943
  label: reopenEditorWith$1()
5733
5944
  }, menuEntrySeparator, {
5734
5945
  command: '',
5735
- flags: None,
5946
+ flags: None$1,
5736
5947
  id: 'share',
5737
5948
  label: share()
5738
5949
  }, menuEntrySeparator, {
5739
5950
  command: '',
5740
- flags: None,
5951
+ flags: None$1,
5741
5952
  id: 'addFileToChat',
5742
5953
  label: addFileToChat()
5743
5954
  }, menuEntrySeparator, {
5744
5955
  command: '',
5745
- flags: None,
5956
+ flags: None$1,
5746
5957
  id: 'openContainingFolder',
5747
5958
  label: openContainingFolder()
5748
5959
  }, {
5749
5960
  args: [path],
5750
5961
  command: 'Explorer.revealItem',
5751
- flags: None,
5962
+ flags: None$1,
5752
5963
  id: 'revealInExplorerView',
5753
5964
  label: revealInExplorerView()
5754
5965
  }, menuEntrySeparator, {
5755
5966
  command: '',
5756
- flags: None,
5967
+ flags: None$1,
5757
5968
  id: 'keepOpen',
5758
5969
  label: keepOpen()
5759
5970
  }, {
5760
5971
  command: '',
5761
- flags: None,
5972
+ flags: None$1,
5762
5973
  id: 'pin',
5763
5974
  label: pin()
5764
5975
  }, menuEntrySeparator, {
5765
5976
  command: 'Main.splitRight',
5766
- flags: None,
5977
+ flags: None$1,
5767
5978
  id: 'splitRight',
5768
5979
  label: splitRight$1()
5769
5980
  }, {
5770
5981
  command: '',
5771
- flags: None,
5982
+ flags: None$1,
5772
5983
  id: 'splitAndMove',
5773
5984
  label: splitAndMove()
5774
5985
  }, {
5775
5986
  command: 'MainArea.moveIntoNewWindow',
5776
- flags: None,
5987
+ flags: None$1,
5777
5988
  id: 'moveIntoNewWindow',
5778
5989
  label: moveIntoNewWindow$1()
5779
5990
  }, {
5780
5991
  command: 'MainArea.copyIntoNewWindow',
5781
- flags: None,
5992
+ flags: None$1,
5782
5993
  id: 'copyIntoNewWindow',
5783
5994
  label: copyIntoNewWindow()
5784
5995
  }, menuEntrySeparator, {
5785
5996
  args: [/* id */'References', /* focus */true, path],
5786
5997
  command: 'SideBar.show',
5787
- flags: None,
5998
+ flags: None$1,
5788
5999
  id: 'findFileReferences',
5789
6000
  label: findFileReferences()
5790
6001
  }];
@@ -5802,9 +6013,12 @@ const getMenuEntries = async (state, props) => {
5802
6013
  };
5803
6014
 
5804
6015
  const moveIntoNewWindow = async state => {
6016
+ const {
6017
+ layout
6018
+ } = state;
5805
6019
  const {
5806
6020
  activeGroupId
5807
- } = state.layout;
6021
+ } = layout;
5808
6022
  const group = findGroupById(state, activeGroupId ?? 0);
5809
6023
  if (!group) {
5810
6024
  return state;
@@ -5856,6 +6070,24 @@ const refresh = state => {
5856
6070
  };
5857
6071
  };
5858
6072
 
6073
+ const getDragOverlayCss = dragOverlay => {
6074
+ if (!dragOverlay) {
6075
+ return [];
6076
+ }
6077
+ const {
6078
+ height,
6079
+ width,
6080
+ x,
6081
+ y
6082
+ } = dragOverlay;
6083
+ return [`.DragOverlay {
6084
+ left: ${x}px;
6085
+ top: ${y}px;
6086
+ width: ${width}px;
6087
+ height: ${height}px;
6088
+ }`];
6089
+ };
6090
+
5859
6091
  const getEditorGroupCss = layout => {
5860
6092
  const groupSizeVariable = layout.direction === Vertical ? '--EditorGroupHeight' : '--EditorGroupWidth';
5861
6093
  return layout.groups.map(group => {
@@ -5945,10 +6177,18 @@ const getSashCss = (layout, width = 0) => {
5945
6177
  return getProtoSashCss(layout, width).map(renderSashCss);
5946
6178
  };
5947
6179
 
5948
- const getCss = (layout, width = 0) => {
5949
- const rules = [`.MainArea {
6180
+ const getCss = (layout, width = 0, dragOverlay) => {
6181
+ const rules = [`.Main {
6182
+ position: relative;
5950
6183
  }`, `.editor-groups-container {
5951
6184
  overflow: auto;
6185
+ }`, `.DragOverlay {
6186
+ position: absolute;
6187
+ z-index: 1;
6188
+ contain: strict;
6189
+ pointer-events: none;
6190
+ background: rgba(83, 89, 93, 0.5);
6191
+ transition: all 100ms;
5952
6192
  }`, `.SashBorder {
5953
6193
  background: var(--SashBorder, gray);
5954
6194
  }`, `.SashBorderHorizontal {
@@ -5984,7 +6224,7 @@ const getCss = (layout, width = 0) => {
5984
6224
  /*height: var(--EditorGroupHeight, auto);*/
5985
6225
  }`];
5986
6226
  if (layout) {
5987
- rules.push(...getEditorGroupCss(layout), ...getSashCss(layout, width));
6227
+ rules.push(...getEditorGroupCss(layout), ...getDragOverlayCss(dragOverlay), ...getSashCss(layout, width));
5988
6228
  const sashCorner = getSashCorner(layout);
5989
6229
  if (sashCorner) {
5990
6230
  rules.push(`.SashCorner {
@@ -5998,7 +6238,7 @@ const getCss = (layout, width = 0) => {
5998
6238
  };
5999
6239
 
6000
6240
  const renderCss = (oldState, newState) => {
6001
- const css = getCss(newState.layout, newState.width);
6241
+ const css = getCss(newState.layout, newState.width, newState.dragOverlay);
6002
6242
  return [SetCss, newState.uid, css];
6003
6243
  };
6004
6244
 
@@ -6291,6 +6531,18 @@ const HandleDoubleClick = 19;
6291
6531
  const HandleSashCornerPointerDown = 20;
6292
6532
  const HandleSashCornerPointerMove = 21;
6293
6533
  const HandleSashCornerPointerUp = 22;
6534
+ const HandleDragOver = 23;
6535
+ const HandleDragLeave = 24;
6536
+ const HandleDrop = 25;
6537
+
6538
+ const dragOverlayVirtualDom = {
6539
+ childCount: 0,
6540
+ className: DragOverlay,
6541
+ type: Div
6542
+ };
6543
+ const getDragOverlayVirtualDom = () => {
6544
+ return dragOverlayVirtualDom;
6545
+ };
6294
6546
 
6295
6547
  const textEditorNode = {
6296
6548
  childCount: 1,
@@ -6421,7 +6673,7 @@ const SearchEditorScheme = 'search-editor://';
6421
6673
  const tabIconNode = {
6422
6674
  childCount: 1,
6423
6675
  className: TabIcon,
6424
- role: None$1,
6676
+ role: None$2,
6425
6677
  type: Div
6426
6678
  };
6427
6679
  const tabTitleNode = {
@@ -6452,7 +6704,7 @@ const renderTabIcon = tab => {
6452
6704
  return [{
6453
6705
  childCount: 0,
6454
6706
  className: TabIcon,
6455
- role: None$1,
6707
+ role: None$2,
6456
6708
  src: tab.icon,
6457
6709
  type: Img
6458
6710
  }];
@@ -6554,7 +6806,7 @@ const renderEditorGroupHeader = (group, groupIndex, splitButtonEnabled) => {
6554
6806
  childCount: hasActions ? 2 : 1,
6555
6807
  className: EditorGroupHeader,
6556
6808
  onDblClick: HandleHeaderDoubleClick,
6557
- role: None$1,
6809
+ role: None$2,
6558
6810
  type: Div
6559
6811
  }, ...getTabsVirtualDom(group, groupIndex, tabsChildCount), ...actions];
6560
6812
  };
@@ -6645,7 +6897,7 @@ const renderSash = (direction, sashId) => {
6645
6897
  className: getSashClassName(direction),
6646
6898
  'data-sashId': sashId,
6647
6899
  onPointerDown: HandleSashPointerDown,
6648
- role: None$1,
6900
+ role: None$2,
6649
6901
  type: Button$2
6650
6902
  }, {
6651
6903
  childCount: 0,
@@ -6658,7 +6910,7 @@ const sashCornerNode = {
6658
6910
  childCount: 0,
6659
6911
  className: 'SashCorner',
6660
6912
  onPointerDown: HandleSashCornerPointerDown,
6661
- role: None$1,
6913
+ role: None$2,
6662
6914
  type: Button$2
6663
6915
  };
6664
6916
  const renderSashCorner = () => {
@@ -6668,6 +6920,9 @@ const renderSashCorner = () => {
6668
6920
  const mainNode$1 = {
6669
6921
  childCount: 1,
6670
6922
  className: Main,
6923
+ onDragLeave: HandleDragLeave,
6924
+ onDragOver: HandleDragOver,
6925
+ onDrop: HandleDrop,
6671
6926
  type: Div
6672
6927
  };
6673
6928
  const renderSingleEditorGroup = (layout, splitButtonEnabled, sizeProperty = 'width') => {
@@ -6687,8 +6942,20 @@ const getContainerClassName = (direction, childCount) => {
6687
6942
  const mainNode = {
6688
6943
  childCount: 1,
6689
6944
  className: Main,
6945
+ onDragLeave: HandleDragLeave,
6946
+ onDragOver: HandleDragOver,
6947
+ onDrop: HandleDrop,
6690
6948
  type: Div
6691
6949
  };
6950
+ const addDragOverlay = (dom, dragOverlay) => {
6951
+ if (!dragOverlay) {
6952
+ return dom;
6953
+ }
6954
+ return [dom[0], {
6955
+ ...dom[1],
6956
+ childCount: dom[1].childCount + 1
6957
+ }, ...dom.slice(2), getDragOverlayVirtualDom()];
6958
+ };
6692
6959
  const getSizeProperty = direction => {
6693
6960
  return direction === Vertical ? 'height' : 'width';
6694
6961
  };
@@ -6737,7 +7004,7 @@ const renderSegmentChildren = (direction, groups, splitButtonEnabled) => {
6737
7004
  children.push({
6738
7005
  childCount: nestedChildCount,
6739
7006
  className: getContainerClassName(nestedDirection, segment.groups.length),
6740
- role: None$1,
7007
+ role: None$2,
6741
7008
  style: `${sizeProperty}:${segmentSize}%;`,
6742
7009
  type: Div
6743
7010
  });
@@ -6750,25 +7017,25 @@ const renderSegmentChildren = (direction, groups, splitButtonEnabled) => {
6750
7017
  children
6751
7018
  };
6752
7019
  };
6753
- const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
7020
+ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false, dragOverlay) => {
6754
7021
  const {
6755
7022
  direction,
6756
7023
  groups
6757
7024
  } = layout;
6758
7025
  const sizeProperty = getSizeProperty(direction);
6759
7026
  if (groups.length === 1) {
6760
- return renderSingleEditorGroup(layout, splitButtonEnabled, sizeProperty);
7027
+ return addDragOverlay(renderSingleEditorGroup(layout, splitButtonEnabled, sizeProperty), dragOverlay);
6761
7028
  }
6762
7029
  const editorGroupsContainerClassName = getContainerClassName(direction, groups.length);
6763
7030
  if (groups.length === 0) {
6764
- return [mainNode, {
7031
+ return addDragOverlay([mainNode, {
6765
7032
  childCount: 0,
6766
7033
  className: editorGroupsContainerClassName,
6767
7034
  'data-groupId': '',
6768
7035
  onContextMenu: HandleContextMenu,
6769
- role: None$1,
7036
+ role: None$2,
6770
7037
  type: Div
6771
- }];
7038
+ }], dragOverlay);
6772
7039
  }
6773
7040
  const {
6774
7041
  childCount,
@@ -6776,16 +7043,17 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
6776
7043
  } = renderSegmentChildren(direction, groups, splitButtonEnabled);
6777
7044
  const sashCorner = getSashCorner(layout);
6778
7045
  const sashCornerChildren = sashCorner ? [renderSashCorner()] : [];
6779
- return [mainNode, {
7046
+ return addDragOverlay([mainNode, {
6780
7047
  childCount: childCount + sashCornerChildren.length,
6781
7048
  className: editorGroupsContainerClassName,
6782
- role: None$1,
7049
+ role: None$2,
6783
7050
  type: Div
6784
- }, ...children, ...sashCornerChildren];
7051
+ }, ...children, ...sashCornerChildren], dragOverlay);
6785
7052
  };
6786
7053
 
6787
7054
  const renderItems = (oldState, newState) => {
6788
7055
  const {
7056
+ dragOverlay,
6789
7057
  initial,
6790
7058
  layout,
6791
7059
  splitButtonEnabled,
@@ -6794,7 +7062,7 @@ const renderItems = (oldState, newState) => {
6794
7062
  if (initial) {
6795
7063
  return [SetDom2, uid, []];
6796
7064
  }
6797
- const dom = getMainAreaVirtualDom(layout, splitButtonEnabled);
7065
+ const dom = getMainAreaVirtualDom(layout, splitButtonEnabled, dragOverlay);
6798
7066
  return [SetDom2, uid, dom];
6799
7067
  };
6800
7068
 
@@ -6900,6 +7168,17 @@ const renderEventListeners = () => {
6900
7168
  }, {
6901
7169
  name: HandleSashCornerPointerUp,
6902
7170
  params: ['handleSashCornerPointerUp', ClientX, ClientY]
7171
+ }, {
7172
+ name: HandleDragOver,
7173
+ params: ['handleDragOver', ClientX, ClientY],
7174
+ preventDefault: true
7175
+ }, {
7176
+ name: HandleDragLeave,
7177
+ params: ['handleDragLeave']
7178
+ }, {
7179
+ name: HandleDrop,
7180
+ params: ['handleDragLeave'],
7181
+ preventDefault: true
6903
7182
  }];
6904
7183
  };
6905
7184
 
@@ -7035,8 +7314,11 @@ const getLatestStoredState = (uid, fallbackState, referenceTabId, referenceTabUr
7035
7314
  return fallbackState;
7036
7315
  };
7037
7316
  const save = async state => {
7317
+ const {
7318
+ uid
7319
+ } = state;
7038
7320
  const requestedActiveTabData = getActiveTab(state);
7039
- const currentState = getLatestStoredState(state.uid, state, requestedActiveTabData?.tab.id, requestedActiveTabData?.tab.uri, !requestedActiveTabData);
7321
+ const currentState = getLatestStoredState(uid, state, requestedActiveTabData?.tab.id, requestedActiveTabData?.tab.uri, !requestedActiveTabData);
7040
7322
  const activeTabData = getActiveTab(currentState);
7041
7323
  if (!activeTabData) {
7042
7324
  return currentState;
@@ -7049,17 +7331,17 @@ const save = async state => {
7049
7331
  }
7050
7332
  if (!tab.isDirty) {
7051
7333
  await saveEditorAndHandleSettingsChange(tab);
7052
- return getLatestStoredState(state.uid, currentState, tab.id, tab.uri);
7334
+ return getLatestStoredState(uid, currentState, tab.id, tab.uri);
7053
7335
  }
7054
7336
  const editorState = await saveEditorAndHandleSettingsChange(tab);
7055
- const latestState = getLatestStoredState(state.uid, currentState, tab.id, tab.uri);
7337
+ const latestState = getLatestStoredState(uid, currentState, tab.id, tab.uri);
7056
7338
  if (editorState?.modified) {
7057
7339
  return latestState;
7058
7340
  }
7059
7341
  if (tab.uri) {
7060
7342
  await handleModifiedStatusChange$1(tab.uri, false);
7061
7343
  }
7062
- const stateAfterModifiedStatusChange = getLatestStoredState(state.uid, latestState, tab.id, tab.uri);
7344
+ const stateAfterModifiedStatusChange = getLatestStoredState(uid, latestState, tab.id, tab.uri);
7063
7345
  return updateTab(stateAfterModifiedStatusChange, tab.id, {
7064
7346
  isDirty: false
7065
7347
  });
@@ -7196,12 +7478,15 @@ const setEditorLayout = (state, direction, slots) => {
7196
7478
  };
7197
7479
  };
7198
7480
  const flipLayout = state => {
7481
+ const {
7482
+ layout
7483
+ } = state;
7199
7484
  return {
7200
7485
  ...state,
7201
7486
  layout: {
7202
- ...state.layout,
7203
- direction: flipDirection(state.layout.direction),
7204
- groups: state.layout.groups.map(group => ({
7487
+ ...layout,
7488
+ direction: flipDirection(layout.direction),
7489
+ groups: layout.groups.map(group => ({
7205
7490
  ...group,
7206
7491
  direction: group.direction === undefined ? undefined : flipDirection(group.direction)
7207
7492
  }))
@@ -7324,7 +7609,7 @@ const splitDown = (state, groupId) => {
7324
7609
  };
7325
7610
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
7326
7611
  }
7327
- const resolvedGroupId = groupId ?? state.layout.activeGroupId;
7612
+ const resolvedGroupId = groupId ?? layout.activeGroupId;
7328
7613
  if (!resolvedGroupId) {
7329
7614
  return state;
7330
7615
  }
@@ -7357,10 +7642,10 @@ const splitLeft = (state, groupId) => {
7357
7642
  groups: [initialGroup]
7358
7643
  }
7359
7644
  };
7360
- return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left);
7645
+ return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
7361
7646
  }
7362
7647
  const targetGroupId = groupId ?? activeGroupId ?? groups[0]?.id ?? 0;
7363
- return splitEditorGroup$1(state, targetGroupId, Left);
7648
+ return splitEditorGroup$1(state, targetGroupId, Left$1);
7364
7649
  };
7365
7650
 
7366
7651
  const splitRight = (state, groupId) => {
@@ -7391,10 +7676,10 @@ const splitRight = (state, groupId) => {
7391
7676
  groups: [initialGroup]
7392
7677
  }
7393
7678
  };
7394
- return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right);
7679
+ return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
7395
7680
  }
7396
7681
  const targetGroupId = groupId ?? activeGroupId ?? groups[0]?.id ?? 0;
7397
- return splitEditorGroup$1(state, targetGroupId, Right);
7682
+ return splitEditorGroup$1(state, targetGroupId, Right$1);
7398
7683
  };
7399
7684
 
7400
7685
  const splitUp = (state, groupId) => {
@@ -7424,7 +7709,7 @@ const splitUp = (state, groupId) => {
7424
7709
  };
7425
7710
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
7426
7711
  }
7427
- const resolvedGroupId = groupId ?? state.layout.activeGroupId;
7712
+ const resolvedGroupId = groupId ?? layout.activeGroupId;
7428
7713
  if (!resolvedGroupId) {
7429
7714
  return state;
7430
7715
  }
@@ -7511,6 +7796,8 @@ const commandMap = {
7511
7796
  'MainArea.handleClickTogglePreview': wrapSerialCommand(handleClickTogglePreview),
7512
7797
  'MainArea.handleContextMenu': wrapSerialCommand(handleContextMenu),
7513
7798
  'MainArea.handleDoubleClick': wrapSerialCommand(handleDoubleClick),
7799
+ 'MainArea.handleDragLeave': wrapSerialCommand(handleDragLeave),
7800
+ 'MainArea.handleDragOver': wrapSerialCommand(handleDragOver),
7514
7801
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
7515
7802
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
7516
7803
  'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-area-worker",
3
- "version": "9.32.5",
3
+ "version": "9.32.7",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",