@lvce-editor/main-area-worker 9.32.4 → 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.
@@ -935,7 +935,10 @@ const constructError = (message, type, name) => {
935
935
  if (ErrorConstructor === Error) {
936
936
  const error = new Error(message);
937
937
  if (name && name !== 'VError') {
938
- error.name = name;
938
+ Object.defineProperty(error, 'name', {
939
+ configurable: true,
940
+ value: name
941
+ });
939
942
  }
940
943
  return error;
941
944
  }
@@ -966,31 +969,45 @@ const getParentStack = error => {
966
969
  };
967
970
  const MethodNotFound = -32601;
968
971
  const Custom = -32001;
972
+ const setStack = (error, stack) => {
973
+ const descriptor = Object.getOwnPropertyDescriptor(error, 'stack');
974
+ if (descriptor) {
975
+ if (!descriptor.configurable && !descriptor.writable) {
976
+ return;
977
+ }
978
+ if (!descriptor.configurable && descriptor.writable) {
979
+ error.stack = stack;
980
+ return;
981
+ }
982
+ }
983
+ Object.defineProperty(error, 'stack', {
984
+ configurable: true,
985
+ value: stack,
986
+ writable: true
987
+ });
988
+ };
969
989
  const restoreExistingError = (error, currentStack) => {
970
990
  if (typeof error.stack === 'string') {
971
- error.stack = error.stack + NewLine + currentStack;
991
+ setStack(error, `${error.stack}${NewLine}${currentStack}`);
972
992
  }
973
993
  return error;
974
994
  };
975
995
  const restoreMethodNotFoundError = (error, currentStack) => {
976
996
  const restoredError = new JsonRpcError(error.message);
977
997
  const parentStack = getParentStack(error);
978
- restoredError.stack = parentStack + NewLine + currentStack;
998
+ setStack(restoredError, `${parentStack}${NewLine}${currentStack}`);
979
999
  return restoredError;
980
1000
  };
981
1001
  const restoreStackFromData = (restoredError, error, currentStack) => {
982
1002
  if (error.data.stack && error.data.type && error.message) {
983
- restoredError.stack = error.data.type + ': ' + error.message + NewLine + error.data.stack + NewLine + currentStack;
1003
+ setStack(restoredError, `${error.data.type}: ${error.message}${NewLine}${error.data.stack}${NewLine}${currentStack}`);
984
1004
  return;
985
1005
  }
986
1006
  if (error.data.stack) {
987
- restoredError.stack = error.data.stack;
1007
+ setStack(restoredError, error.data.stack);
988
1008
  }
989
1009
  };
990
1010
  const applyDataProperties = (restoredError, error) => {
991
- if (!error.data) {
992
- return;
993
- }
994
1011
  restoreStackFromData(restoredError, error, getCurrentStack());
995
1012
  if (error.data.codeFrame) {
996
1013
  // @ts-ignore
@@ -1011,7 +1028,7 @@ const applyDirectProperties = (restoredError, error) => {
1011
1028
  const indexNewLine = getNewLineIndex(lowerStack);
1012
1029
  const parentStack = getParentStack(error);
1013
1030
  // @ts-ignore
1014
- restoredError.stack = parentStack + lowerStack.slice(indexNewLine);
1031
+ setStack(restoredError, `${parentStack}${lowerStack.slice(indexNewLine)}`);
1015
1032
  }
1016
1033
  if (error.codeFrame) {
1017
1034
  // @ts-ignore
@@ -1545,7 +1562,7 @@ const create$3 = rpcId => {
1545
1562
  };
1546
1563
  };
1547
1564
 
1548
- const None$1 = 'none';
1565
+ const None$2 = 'none';
1549
1566
  const Tab$1 = 'tab';
1550
1567
  const TabList = 'tablist';
1551
1568
  const ToolBar = 'toolbar';
@@ -1729,7 +1746,7 @@ const Tab = 13;
1729
1746
  const Main$1 = 24;
1730
1747
 
1731
1748
  const Separator = 1;
1732
- const None = 0;
1749
+ const None$1 = 0;
1733
1750
 
1734
1751
  const Electron = 2;
1735
1752
 
@@ -1800,12 +1817,15 @@ const writeClipBoardText = async text => {
1800
1817
  };
1801
1818
 
1802
1819
  const addClosedTabs = (state, entries) => {
1820
+ const {
1821
+ closedTabs
1822
+ } = state;
1803
1823
  if (entries.length === 0) {
1804
1824
  return state;
1805
1825
  }
1806
1826
  return {
1807
1827
  ...state,
1808
- closedTabs: [...state.closedTabs, ...entries].slice(-20)
1828
+ closedTabs: [...closedTabs, ...entries].slice(-20)
1809
1829
  };
1810
1830
  };
1811
1831
 
@@ -1827,10 +1847,13 @@ const redistributeSizesWithRounding = groups => {
1827
1847
  };
1828
1848
 
1829
1849
  const withGroupsAndActiveGroup = (state, groups, activeGroupId) => {
1850
+ const {
1851
+ layout
1852
+ } = state;
1830
1853
  return {
1831
1854
  ...state,
1832
1855
  layout: {
1833
- ...state.layout,
1856
+ ...layout,
1834
1857
  activeGroupId,
1835
1858
  groups
1836
1859
  }
@@ -1842,20 +1865,26 @@ const withEmptyGroups = state => {
1842
1865
  };
1843
1866
 
1844
1867
  const withGroups = (state, groups) => {
1868
+ const {
1869
+ layout
1870
+ } = state;
1845
1871
  return {
1846
1872
  ...state,
1847
1873
  layout: {
1848
- ...state.layout,
1874
+ ...layout,
1849
1875
  groups
1850
1876
  }
1851
1877
  };
1852
1878
  };
1853
1879
 
1854
1880
  const closeTab = (state, groupId, tabId) => {
1881
+ const {
1882
+ layout
1883
+ } = state;
1855
1884
  const {
1856
1885
  activeGroupId,
1857
1886
  groups
1858
- } = state.layout;
1887
+ } = layout;
1859
1888
 
1860
1889
  // Find the group to close the tab from
1861
1890
  const groupIndex = getGroupIndexById(state, groupId);
@@ -1934,10 +1963,13 @@ const createViewlet = async (viewletModuleId, editorUid, tabId, bounds, uri) =>
1934
1963
  };
1935
1964
 
1936
1965
  const getActiveFileUri = state => {
1966
+ const {
1967
+ layout
1968
+ } = state;
1937
1969
  const {
1938
1970
  activeGroupId,
1939
1971
  groups
1940
- } = state.layout;
1972
+ } = layout;
1941
1973
  const activeGroup = groups.find(group => group.id === activeGroupId);
1942
1974
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
1943
1975
  if (!activeTab) {
@@ -2284,6 +2316,9 @@ const findTabInState = (state, groupId, tabId) => {
2284
2316
  };
2285
2317
 
2286
2318
  const closeTabWithViewlet = async (state, groupId, tabId) => {
2319
+ const {
2320
+ layout
2321
+ } = state;
2287
2322
  const tab = findTabInState(state, groupId, tabId);
2288
2323
  const commands = [];
2289
2324
  if (tab && tab.editorUid !== -1) {
@@ -2293,7 +2328,7 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2293
2328
  commands.push(...disposeCommands);
2294
2329
  }
2295
2330
  const newState = closeTab(state, groupId, tabId);
2296
- const group = state.layout.groups.find(g => g.id === groupId);
2331
+ const group = layout.groups.find(g => g.id === groupId);
2297
2332
  const wasActiveTab = group?.activeTabId === tabId;
2298
2333
  const newGroup = wasActiveTab ? newState.layout.groups.find(candidate => candidate.id === groupId) : undefined;
2299
2334
  const newActiveTabId = newGroup?.activeTabId;
@@ -2403,9 +2438,12 @@ const disposeEditors = async editorUids => {
2403
2438
  };
2404
2439
 
2405
2440
  const closeAll$1 = async state => {
2406
- 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);
2407
2445
  await disposeEditors(editorUids);
2408
- const entries = state.layout.groups.flatMap((group, groupIndex) => {
2446
+ const entries = layout.groups.flatMap((group, groupIndex) => {
2409
2447
  return group.tabs.map((tab, tabIndex) => ({
2410
2448
  group,
2411
2449
  groupIndex,
@@ -2549,9 +2587,12 @@ const closeSavedInGroup = group => {
2549
2587
  };
2550
2588
  };
2551
2589
  const closeSaved$1 = state => {
2590
+ const {
2591
+ layout
2592
+ } = state;
2552
2593
  const {
2553
2594
  groups
2554
- } = state.layout;
2595
+ } = layout;
2555
2596
  const closedTabs = groups.flatMap((group, groupIndex) => {
2556
2597
  return group.tabs.map((tab, tabIndex) => ({
2557
2598
  group,
@@ -2565,7 +2606,10 @@ const closeSaved$1 = state => {
2565
2606
  };
2566
2607
 
2567
2608
  const closeFirstTabByUri = (state, uri) => {
2568
- const matchingGroup = state.layout.groups.find(group => {
2609
+ const {
2610
+ layout
2611
+ } = state;
2612
+ const matchingGroup = layout.groups.find(group => {
2569
2613
  return group.tabs.some(tab => tab.uri === uri);
2570
2614
  });
2571
2615
  const matchingTab = matchingGroup?.tabs.find(tab => tab.uri === uri);
@@ -2587,7 +2631,10 @@ const closeTabsByUris = (state, uris) => {
2587
2631
  };
2588
2632
 
2589
2633
  const getGroupById = (state, groupId) => {
2590
- return state.layout.groups.find(group => group.id === groupId);
2634
+ const {
2635
+ layout
2636
+ } = state;
2637
+ return layout.groups.find(group => group.id === groupId);
2591
2638
  };
2592
2639
 
2593
2640
  const closeTabsRight = (state, groupId) => {
@@ -2647,9 +2694,12 @@ const findGroupById = (state, groupId) => {
2647
2694
  };
2648
2695
 
2649
2696
  const copyIntoNewWindow$1 = async state => {
2697
+ const {
2698
+ layout
2699
+ } = state;
2650
2700
  const {
2651
2701
  activeGroupId
2652
- } = state.layout;
2702
+ } = layout;
2653
2703
  const group = findGroupById(state, activeGroupId ?? 0);
2654
2704
  if (!group) {
2655
2705
  return state;
@@ -2730,12 +2780,12 @@ const create$1 = (uid, uri, x, y, width, height, platform, assetDir, tabHeight =
2730
2780
  set(uid, state, state);
2731
2781
  };
2732
2782
 
2733
- const isEqual$1 = (oldState, newState) => {
2783
+ const isEqual$2 = (oldState, newState) => {
2734
2784
  return false;
2735
2785
  };
2736
2786
 
2737
- const isEqual = (oldState, newState) => {
2738
- return oldState.layout === newState.layout;
2787
+ const isEqual$1 = (oldState, newState) => {
2788
+ return oldState.dragOverlay === newState.dragOverlay && oldState.layout === newState.layout;
2739
2789
  };
2740
2790
 
2741
2791
  const RenderItems = 4;
@@ -2746,7 +2796,7 @@ const RenderPendingViewletUpdate = 12;
2746
2796
  const isPendingViewletUpdateEqual = (oldState, newState) => {
2747
2797
  return newState.pendingViewletUpdate === undefined;
2748
2798
  };
2749
- const modules = [isEqual, isEqual$1, isPendingViewletUpdateEqual];
2799
+ const modules = [isEqual$1, isEqual$2, isPendingViewletUpdateEqual];
2750
2800
  const numbers = [RenderIncremental, RenderCss, RenderPendingViewletUpdate];
2751
2801
 
2752
2802
  const diff = (oldState, newState) => {
@@ -2966,7 +3016,10 @@ const getActiveTabId$1 = state => {
2966
3016
  };
2967
3017
 
2968
3018
  const getSelectedTabData = (state, groupIndex, index) => {
2969
- const group = state.layout.groups[groupIndex];
3019
+ const {
3020
+ layout
3021
+ } = state;
3022
+ const group = layout.groups[groupIndex];
2970
3023
  if (!group || index < 0 || index >= group.tabs.length) {
2971
3024
  return undefined;
2972
3025
  }
@@ -3026,11 +3079,18 @@ const findTabById = (state, tabId) => {
3026
3079
  };
3027
3080
 
3028
3081
  const getSelectedTabBounds = state => {
3082
+ const {
3083
+ height,
3084
+ tabHeight,
3085
+ width,
3086
+ x,
3087
+ y
3088
+ } = state;
3029
3089
  return {
3030
- height: state.height - state.tabHeight,
3031
- width: state.width,
3032
- x: state.x,
3033
- y: state.y + state.tabHeight
3090
+ height: height - tabHeight,
3091
+ width,
3092
+ x,
3093
+ y: y + tabHeight
3034
3094
  };
3035
3095
  };
3036
3096
 
@@ -3078,11 +3138,14 @@ const getViewletModuleId = async tab => {
3078
3138
  };
3079
3139
 
3080
3140
  const startContentLoading = async (oldState, state, tabId, path, requestId) => {
3141
+ const {
3142
+ uid
3143
+ } = state;
3081
3144
  try {
3082
3145
  const getLatestState = () => {
3083
- return get(state.uid).newState;
3146
+ return get(uid).newState;
3084
3147
  };
3085
- set(state.uid, oldState, state);
3148
+ set(uid, oldState, state);
3086
3149
  const newState = await loadTabContentAsync(tabId, path, requestId, getLatestState);
3087
3150
  return newState;
3088
3151
  } catch {
@@ -3264,8 +3327,8 @@ const getActiveGroup = (groups, activeGroupId) => {
3264
3327
  return groups.find(g => g.id === activeGroupId);
3265
3328
  };
3266
3329
 
3267
- const Left = 'left';
3268
- const Right = 'right';
3330
+ const Left$1 = 'left';
3331
+ const Right$1 = 'right';
3269
3332
 
3270
3333
  const getActiveTab = state => {
3271
3334
  const {
@@ -3357,12 +3420,18 @@ const getRestoredTab = tab => {
3357
3420
  };
3358
3421
  };
3359
3422
  const getStateWithoutLastClosedTab = state => {
3423
+ const {
3424
+ closedTabs
3425
+ } = state;
3360
3426
  return {
3361
3427
  ...state,
3362
- closedTabs: state.closedTabs.slice(0, -1)
3428
+ closedTabs: closedTabs.slice(0, -1)
3363
3429
  };
3364
3430
  };
3365
3431
  const restoreExistingUri = (state, entry) => {
3432
+ const {
3433
+ layout
3434
+ } = state;
3366
3435
  if (!entry.tab.uri) {
3367
3436
  return undefined;
3368
3437
  }
@@ -3370,11 +3439,11 @@ const restoreExistingUri = (state, entry) => {
3370
3439
  if (!existing) {
3371
3440
  return undefined;
3372
3441
  }
3373
- const groupIndex = state.layout.groups.findIndex(group => group.id === existing.groupId);
3442
+ const groupIndex = layout.groups.findIndex(group => group.id === existing.groupId);
3374
3443
  if (groupIndex === -1) {
3375
3444
  return undefined;
3376
3445
  }
3377
- 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);
3378
3447
  if (tabIndex === -1) {
3379
3448
  return undefined;
3380
3449
  }
@@ -3394,9 +3463,12 @@ const restoreExistingUri = (state, entry) => {
3394
3463
  };
3395
3464
  };
3396
3465
  const restoreIntoExistingGroup = (state, entry) => {
3466
+ const {
3467
+ layout
3468
+ } = state;
3397
3469
  const {
3398
3470
  groups
3399
- } = state.layout;
3471
+ } = layout;
3400
3472
  const groupIndex = groups.findIndex(group => group.id === entry.group.id);
3401
3473
  if (groupIndex === -1) {
3402
3474
  return undefined;
@@ -3484,7 +3556,10 @@ const restoreIntoRecreatedGroup = (state, entry) => {
3484
3556
  };
3485
3557
  };
3486
3558
  const restoreClosedTabState = state => {
3487
- const entry = state.closedTabs.at(-1);
3559
+ const {
3560
+ closedTabs
3561
+ } = state;
3562
+ const entry = closedTabs.at(-1);
3488
3563
  if (!entry) {
3489
3564
  return undefined;
3490
3565
  }
@@ -3533,7 +3608,10 @@ const getActiveTabId = state => {
3533
3608
  };
3534
3609
 
3535
3610
  const getTabCount = state => {
3536
- 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);
3537
3615
  };
3538
3616
 
3539
3617
  const getCurrentState = state => {
@@ -3647,9 +3725,10 @@ const updateTabUriTitle = (tab, homeDirUri) => {
3647
3725
  };
3648
3726
  const updateTabUriTitles = state => {
3649
3727
  const {
3728
+ homeDirUri: rawHomeDirUri,
3650
3729
  layout
3651
3730
  } = state;
3652
- const homeDirUri = state.homeDirUri || '';
3731
+ const homeDirUri = rawHomeDirUri || '';
3653
3732
  return {
3654
3733
  ...state,
3655
3734
  layout: {
@@ -3664,6 +3743,7 @@ const updateTabUriTitles = state => {
3664
3743
 
3665
3744
  const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
3666
3745
  const {
3746
+ homeDirUri,
3667
3747
  layout
3668
3748
  } = state;
3669
3749
  const {
@@ -3685,7 +3765,7 @@ const createEmptyGroup$1 = (state, uri, requestId, preview = false, title = getL
3685
3765
  loadingState: 'loading',
3686
3766
  title,
3687
3767
  uri,
3688
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3768
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3689
3769
  };
3690
3770
  const newGroup = {
3691
3771
  activeTabId: newTab.id,
@@ -3744,6 +3824,7 @@ const openTab = (state, groupId, tab) => {
3744
3824
  const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), editorType = 'text', editorInput) => {
3745
3825
  // Find the active group (by activeGroupId or focused flag)
3746
3826
  const {
3827
+ homeDirUri,
3747
3828
  layout
3748
3829
  } = state;
3749
3830
  const {
@@ -3781,7 +3862,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
3781
3862
  loadingState: 'loading',
3782
3863
  title,
3783
3864
  uri,
3784
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3865
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3785
3866
  };
3786
3867
  });
3787
3868
  return {
@@ -3815,7 +3896,7 @@ const ensureActiveGroup = (state, uri, preview = false, title = getLabel(uri), e
3815
3896
  loadingState: 'loading',
3816
3897
  title,
3817
3898
  uri: uri,
3818
- uriTitle: getUriTitle(uri, state.homeDirUri || '')
3899
+ uriTitle: getUriTitle(uri, homeDirUri || '')
3819
3900
  };
3820
3901
  newState = openTab(state, activeGroup.id, newTab);
3821
3902
  } else {
@@ -4030,7 +4111,10 @@ const getExistingTabState = (state, existingTab, preview) => {
4030
4111
  return switchTab(pinnedState, existingTab.groupId, existingTab.tab.id);
4031
4112
  };
4032
4113
  const getActivePreviewEditorUid = state => {
4033
- 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);
4034
4118
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
4035
4119
  return activeTab?.isPreview ? activeTab.editorUid : -1;
4036
4120
  };
@@ -4237,17 +4321,20 @@ const rebalanceGroupSizes = groups => {
4237
4321
  }));
4238
4322
  };
4239
4323
  const isTrailingSplit = direction => {
4240
- return direction === Right || direction === 'down';
4324
+ return direction === Right$1 || direction === 'down';
4241
4325
  };
4242
4326
  const getSplitLayoutDirection = direction => {
4243
- return direction === Left || direction === Right ? Horizontal : Vertical;
4327
+ return direction === Left$1 || direction === Right$1 ? Horizontal : Vertical;
4244
4328
  };
4245
4329
  const createNextState = (state, activeGroupId, groups) => {
4330
+ const {
4331
+ layout
4332
+ } = state;
4246
4333
  return {
4247
4334
  ...state,
4248
4335
  layout: {
4249
4336
  activeGroupId,
4250
- direction: state.layout.direction,
4337
+ direction: layout.direction,
4251
4338
  groups
4252
4339
  }
4253
4340
  };
@@ -4416,7 +4503,7 @@ const handleClickAction = async (state, action, rawGroupId) => {
4416
4503
  case RetryOpen:
4417
4504
  return retryOpen(state);
4418
4505
  case SplitRight$1:
4419
- return splitEditorGroup$1(state, activeGroup.id, Right);
4506
+ return splitEditorGroup$1(state, activeGroup.id, Right$1);
4420
4507
  case TogglePreview$1:
4421
4508
  return handleClickTogglePreview(state);
4422
4509
  default:
@@ -4469,6 +4556,9 @@ const show2 = async (uid, menuId, x, y, args) => {
4469
4556
 
4470
4557
  const NoGroupId = -1;
4471
4558
  const handleContextMenu = async (state, rawGroupId, x, y) => {
4559
+ const {
4560
+ uid
4561
+ } = state;
4472
4562
  number(x);
4473
4563
  number(y);
4474
4564
  if (rawGroupId === undefined) {
@@ -4478,7 +4568,7 @@ const handleContextMenu = async (state, rawGroupId, x, y) => {
4478
4568
  if (Number.isNaN(groupId)) {
4479
4569
  return state;
4480
4570
  }
4481
- await show2(state.uid, Main$1, x, y, {
4571
+ await show2(uid, Main$1, x, y, {
4482
4572
  groupId,
4483
4573
  menuId: Main$1
4484
4574
  });
@@ -4486,12 +4576,15 @@ const handleContextMenu = async (state, rawGroupId, x, y) => {
4486
4576
  };
4487
4577
 
4488
4578
  const handleDoubleClick = (state, groupIndexRaw, indexRaw) => {
4579
+ const {
4580
+ layout
4581
+ } = state;
4489
4582
  if (!groupIndexRaw || !indexRaw) {
4490
4583
  return state;
4491
4584
  }
4492
4585
  const groupIndex = Number.parseInt(groupIndexRaw);
4493
4586
  const tabIndex = Number.parseInt(indexRaw);
4494
- const tab = state.layout.groups[groupIndex]?.tabs[tabIndex];
4587
+ const tab = layout.groups[groupIndex]?.tabs[tabIndex];
4495
4588
  if (!tab?.isPreview) {
4496
4589
  return state;
4497
4590
  }
@@ -4500,10 +4593,123 @@ const handleDoubleClick = (state, groupIndexRaw, indexRaw) => {
4500
4593
  });
4501
4594
  };
4502
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
+
4503
4708
  const EditorGroupHeader = 'EditorGroupHeader';
4504
4709
  const EmptyGroupHeader = 'EmptyGroupHeader';
4505
4710
  const EmptyGroupCloseButton = 'EmptyGroupCloseButton';
4506
4711
  const EditorGroup = 'EditorGroup';
4712
+ const EditorGroupEmpty = 'EditorGroup EditorGroupEmpty';
4507
4713
  const EditorGroupsHorizontal = 'EditorGroupsHorizontal';
4508
4714
  const EditorGroupsVertical = 'EditorGroupsVertical';
4509
4715
  const EditorContainer = 'EditorContainer';
@@ -4521,6 +4727,7 @@ const TextEditorLoading = 'TextEditor TextEditor--loading';
4521
4727
  const EditorContentLoading = 'EditorContent EditorContent--loading';
4522
4728
  const TextEditorError = 'TextEditor TextEditorError';
4523
4729
  const EditorContentError = 'EditorContent EditorContentError';
4730
+ const DragOverlay = 'DragOverlay';
4524
4731
  const Main = 'Main';
4525
4732
  const EDITOR_GROUPS_CONTAINER = 'editor-groups-container';
4526
4733
  const TabIcon = 'TabIcon';
@@ -4659,16 +4866,20 @@ const getAllTabs = layout => {
4659
4866
  };
4660
4867
 
4661
4868
  const loadFileIcons = async state => {
4869
+ const {
4870
+ fileIconCache,
4871
+ layout
4872
+ } = state;
4662
4873
  try {
4663
- const allTabs = getAllTabs(state.layout);
4874
+ const allTabs = getAllTabs(layout);
4664
4875
  const {
4665
4876
  newFileIconCache
4666
- } = await getFileIconsForTabs(allTabs, state.fileIconCache);
4877
+ } = await getFileIconsForTabs(allTabs, fileIconCache);
4667
4878
 
4668
4879
  // Update tabs with their icons
4669
4880
  const updatedLayout = {
4670
- ...state.layout,
4671
- groups: state.layout.groups.map(group => ({
4881
+ ...layout,
4882
+ groups: layout.groups.map(group => ({
4672
4883
  ...group,
4673
4884
  tabs: group.tabs.map(tab => ({
4674
4885
  ...tab,
@@ -4683,8 +4894,8 @@ const loadFileIcons = async state => {
4683
4894
  } catch {
4684
4895
  // If icon request fails, continue without icons
4685
4896
  return {
4686
- fileIconCache: state.fileIconCache,
4687
- updatedLayout: state.layout
4897
+ fileIconCache,
4898
+ updatedLayout: layout
4688
4899
  };
4689
4900
  }
4690
4901
  };
@@ -4822,17 +5033,20 @@ const getSashCorner = layout => {
4822
5033
  };
4823
5034
 
4824
5035
  const handleSashCornerPointerDown = async (state, clientX, clientY) => {
5036
+ const {
5037
+ layout
5038
+ } = state;
4825
5039
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
4826
5040
  return state;
4827
5041
  }
4828
- const sashCorner = getSashCorner(state.layout);
5042
+ const sashCorner = getSashCorner(layout);
4829
5043
  if (!sashCorner) {
4830
5044
  return state;
4831
5045
  }
4832
5046
  return {
4833
5047
  ...state,
4834
5048
  sashCornerDrag: {
4835
- groupSizes: state.layout.groups.map(group => ({
5049
+ groupSizes: layout.groups.map(group => ({
4836
5050
  id: group.id,
4837
5051
  size: group.size
4838
5052
  })),
@@ -4875,6 +5089,9 @@ const getBeforeSize = (startSize, deltaPx, axisSize, minSizePx, totalSize) => {
4875
5089
  const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4876
5090
  const {
4877
5091
  height,
5092
+ layout,
5093
+ minGroupHeightPx,
5094
+ minGroupWidthPx,
4878
5095
  sashCornerDrag,
4879
5096
  width
4880
5097
  } = state;
@@ -4894,8 +5111,8 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4894
5111
  }
4895
5112
  const xBeforeStartSize = sumGroupSizes(groupSizes, xBeforeGroupIds);
4896
5113
  const yBeforeStartSize = sumGroupSizes(groupSizes, yBeforeGroupIds);
4897
- const xBeforeSize = getBeforeSize(xBeforeStartSize, clientX - startClientX, width, state.minGroupWidthPx, totalSize);
4898
- 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);
4899
5116
  const xAfterSize = totalSize - xBeforeSize;
4900
5117
  const yAfterSize = totalSize - yBeforeSize;
4901
5118
  const xBeforeGroupIdSet = new Set(xBeforeGroupIds);
@@ -4903,8 +5120,8 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4903
5120
  return {
4904
5121
  ...state,
4905
5122
  layout: {
4906
- ...state.layout,
4907
- groups: state.layout.groups.map(group => {
5123
+ ...layout,
5124
+ groups: layout.groups.map(group => {
4908
5125
  const xSize = xBeforeGroupIdSet.has(group.id) ? xBeforeSize : xAfterSize;
4909
5126
  const ySize = yBeforeGroupIdSet.has(group.id) ? yBeforeSize : yAfterSize;
4910
5127
  return {
@@ -4917,7 +5134,10 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
4917
5134
  };
4918
5135
 
4919
5136
  const handleSashCornerPointerUp = async state => {
4920
- if (!state.sashCornerDrag) {
5137
+ const {
5138
+ sashCornerDrag
5139
+ } = state;
5140
+ if (!sashCornerDrag) {
4921
5141
  return state;
4922
5142
  }
4923
5143
  return {
@@ -4985,6 +5205,8 @@ const handleSashPointerMove = async (state, clientX, clientY) => {
4985
5205
  const {
4986
5206
  height,
4987
5207
  layout,
5208
+ minGroupHeightPx,
5209
+ minGroupWidthPx,
4988
5210
  sashDrag,
4989
5211
  width
4990
5212
  } = state;
@@ -5005,7 +5227,7 @@ const handleSashPointerMove = async (state, clientX, clientY) => {
5005
5227
  const deltaPx = direction === Horizontal ? clientX - sashDrag.startClientX : clientY - sashDrag.startClientY;
5006
5228
  const deltaPercent = deltaPx / axisSize * 100;
5007
5229
  const totalResizableSize = sashDrag.beforeSize + sashDrag.afterSize;
5008
- const minGroupSizePx = direction === Horizontal ? state.minGroupWidthPx : state.minGroupHeightPx;
5230
+ const minGroupSizePx = direction === Horizontal ? minGroupWidthPx : minGroupHeightPx;
5009
5231
  let minGroupSize = getMinGroupSizePercent(axisSize, minGroupSizePx);
5010
5232
 
5011
5233
  // If the minimum size makes it impossible to fit two groups, relax the constraint
@@ -5065,6 +5287,7 @@ const handleTabContextMenu = async (state, button, x, y) => {
5065
5287
 
5066
5288
  const handleUriChange = async (state, oldUri, newUri) => {
5067
5289
  const {
5290
+ homeDirUri,
5068
5291
  layout
5069
5292
  } = state;
5070
5293
  const {
@@ -5095,7 +5318,7 @@ const handleUriChange = async (state, oldUri, newUri) => {
5095
5318
  editorInput,
5096
5319
  title: getLabel(renamedUri),
5097
5320
  uri: renamedUri,
5098
- uriTitle: getUriTitle(renamedUri, state.homeDirUri || '')
5321
+ uriTitle: getUriTitle(renamedUri, homeDirUri || '')
5099
5322
  };
5100
5323
  }
5101
5324
  return tab;
@@ -5306,15 +5529,18 @@ const updateTabs = (state, editorUids) => {
5306
5529
  };
5307
5530
 
5308
5531
  const restoreAndCreateEditors = async (state, restoredLayout) => {
5532
+ const {
5533
+ tabHeight
5534
+ } = state;
5309
5535
  let newState = {
5310
5536
  ...state,
5311
5537
  layout: restoredLayout
5312
5538
  };
5313
5539
  const bounds = {
5314
- height: newState.height - state.tabHeight,
5540
+ height: newState.height - tabHeight,
5315
5541
  width: newState.width,
5316
5542
  x: newState.x,
5317
- y: newState.y + state.tabHeight
5543
+ y: newState.y + tabHeight
5318
5544
  };
5319
5545
 
5320
5546
  // Get viewlet module IDs for all active tabs
@@ -5341,7 +5567,7 @@ const restoreAndCreateEditors = async (state, restoredLayout) => {
5341
5567
  return newState;
5342
5568
  };
5343
5569
 
5344
- const loadContent = async (state, savedState) => {
5570
+ const loadContent$1 = async (state, savedState) => {
5345
5571
  const homeDirUri = await loadHomeDirUri();
5346
5572
  const stateWithHomeDir = {
5347
5573
  ...state,
@@ -5379,7 +5605,7 @@ const loadContent = async (state, savedState) => {
5379
5605
  };
5380
5606
 
5381
5607
  const handleWorkspaceChange = async (state, _workspacePath, savedState) => {
5382
- return loadContent(state, savedState);
5608
+ return loadContent$1(state, savedState);
5383
5609
  };
5384
5610
 
5385
5611
  const handleWorkspaceRefresh = async (state, refresh = {}) => {
@@ -5586,12 +5812,15 @@ const menuEntrySeparator = {
5586
5812
  };
5587
5813
 
5588
5814
  const getNewWindowMenuEntries = state => {
5589
- if (state.platform !== Electron) {
5815
+ const {
5816
+ platform
5817
+ } = state;
5818
+ if (platform !== Electron) {
5590
5819
  return [];
5591
5820
  }
5592
5821
  return [menuEntrySeparator, {
5593
5822
  command: 'MainArea.newWindow',
5594
- flags: None,
5823
+ flags: None$1,
5595
5824
  id: 'newWindow',
5596
5825
  label: newWindow$1()
5597
5826
  }];
@@ -5601,37 +5830,37 @@ const getMenuEntries$2 = (state, groupId) => {
5601
5830
  const groupArgs = getMenuEntryArgs(groupId);
5602
5831
  const entries = [{
5603
5832
  command: 'MainArea.newFile',
5604
- flags: None,
5833
+ flags: None$1,
5605
5834
  id: 'newTextFile',
5606
5835
  label: newTextFile()
5607
5836
  }, {
5608
5837
  args: [QuickPick, 'file'],
5609
5838
  command: 'Viewlet.openWidget',
5610
- flags: None,
5839
+ flags: None$1,
5611
5840
  id: 'openFile',
5612
5841
  label: openFile()
5613
5842
  }, menuEntrySeparator, {
5614
5843
  args: groupArgs,
5615
5844
  command: 'MainArea.splitUp',
5616
- flags: None,
5845
+ flags: None$1,
5617
5846
  id: 'splitUp',
5618
5847
  label: splitUp$1()
5619
5848
  }, {
5620
5849
  args: groupArgs,
5621
5850
  command: 'MainArea.splitDown',
5622
- flags: None,
5851
+ flags: None$1,
5623
5852
  id: 'splitDown',
5624
5853
  label: splitDown$1()
5625
5854
  }, {
5626
5855
  args: groupArgs,
5627
5856
  command: 'MainArea.splitLeft',
5628
- flags: None,
5857
+ flags: None$1,
5629
5858
  id: 'splitLeft',
5630
5859
  label: splitLeft$1()
5631
5860
  }, {
5632
5861
  args: groupArgs,
5633
5862
  command: 'MainArea.splitRight',
5634
- flags: None,
5863
+ flags: None$1,
5635
5864
  id: 'splitRight',
5636
5865
  label: splitRight$1()
5637
5866
  }, ...getNewWindowMenuEntries(state)];
@@ -5641,7 +5870,7 @@ const getMenuEntries$2 = (state, groupId) => {
5641
5870
  return [...entries, menuEntrySeparator, {
5642
5871
  args: [groupId],
5643
5872
  command: 'MainArea.closeEditorGroup',
5644
- flags: None,
5873
+ flags: None$1,
5645
5874
  id: 'closeGroup',
5646
5875
  label: closeEditorGroup()
5647
5876
  }];
@@ -5672,101 +5901,101 @@ const getMenuEntries$1 = state => {
5672
5901
  } = tab;
5673
5902
  return [{
5674
5903
  command: 'Main.closeFocusedTab',
5675
- flags: None,
5904
+ flags: None$1,
5676
5905
  id: 'tabClose',
5677
5906
  label: close()
5678
5907
  }, {
5679
5908
  command: 'Main.closeOthers',
5680
- flags: None,
5909
+ flags: None$1,
5681
5910
  id: 'tabCloseOthers',
5682
5911
  label: closeOthers()
5683
5912
  }, {
5684
5913
  command: 'Main.closeTabsRight',
5685
- flags: None,
5914
+ flags: None$1,
5686
5915
  id: 'tabCloseToTheRight',
5687
5916
  label: closeToTheRight()
5688
5917
  }, {
5689
5918
  command: 'Main.closeSaved',
5690
- flags: None,
5919
+ flags: None$1,
5691
5920
  id: 'tabCloseSaved',
5692
5921
  label: closeSaved()
5693
5922
  }, {
5694
5923
  command: 'Main.closeAll',
5695
- flags: None,
5924
+ flags: None$1,
5696
5925
  id: 'tabCloseAll',
5697
5926
  label: closeAll()
5698
5927
  }, menuEntrySeparator, {
5699
5928
  args: [path],
5700
5929
  command: 'Main.copyPath',
5701
- flags: None,
5930
+ flags: None$1,
5702
5931
  id: 'copyPath',
5703
5932
  label: copyPath()
5704
5933
  }, {
5705
5934
  args: [path],
5706
5935
  command: 'Main.copyRelativePath',
5707
- flags: None,
5936
+ flags: None$1,
5708
5937
  id: 'copyRelativePath',
5709
5938
  label: copyRelativePath()
5710
5939
  }, menuEntrySeparator, {
5711
5940
  command: 'Main.reopenEditorWith',
5712
- flags: None,
5941
+ flags: None$1,
5713
5942
  id: 'reopenEditorWith',
5714
5943
  label: reopenEditorWith$1()
5715
5944
  }, menuEntrySeparator, {
5716
5945
  command: '',
5717
- flags: None,
5946
+ flags: None$1,
5718
5947
  id: 'share',
5719
5948
  label: share()
5720
5949
  }, menuEntrySeparator, {
5721
5950
  command: '',
5722
- flags: None,
5951
+ flags: None$1,
5723
5952
  id: 'addFileToChat',
5724
5953
  label: addFileToChat()
5725
5954
  }, menuEntrySeparator, {
5726
5955
  command: '',
5727
- flags: None,
5956
+ flags: None$1,
5728
5957
  id: 'openContainingFolder',
5729
5958
  label: openContainingFolder()
5730
5959
  }, {
5731
5960
  args: [path],
5732
5961
  command: 'Explorer.revealItem',
5733
- flags: None,
5962
+ flags: None$1,
5734
5963
  id: 'revealInExplorerView',
5735
5964
  label: revealInExplorerView()
5736
5965
  }, menuEntrySeparator, {
5737
5966
  command: '',
5738
- flags: None,
5967
+ flags: None$1,
5739
5968
  id: 'keepOpen',
5740
5969
  label: keepOpen()
5741
5970
  }, {
5742
5971
  command: '',
5743
- flags: None,
5972
+ flags: None$1,
5744
5973
  id: 'pin',
5745
5974
  label: pin()
5746
5975
  }, menuEntrySeparator, {
5747
5976
  command: 'Main.splitRight',
5748
- flags: None,
5977
+ flags: None$1,
5749
5978
  id: 'splitRight',
5750
5979
  label: splitRight$1()
5751
5980
  }, {
5752
5981
  command: '',
5753
- flags: None,
5982
+ flags: None$1,
5754
5983
  id: 'splitAndMove',
5755
5984
  label: splitAndMove()
5756
5985
  }, {
5757
5986
  command: 'MainArea.moveIntoNewWindow',
5758
- flags: None,
5987
+ flags: None$1,
5759
5988
  id: 'moveIntoNewWindow',
5760
5989
  label: moveIntoNewWindow$1()
5761
5990
  }, {
5762
5991
  command: 'MainArea.copyIntoNewWindow',
5763
- flags: None,
5992
+ flags: None$1,
5764
5993
  id: 'copyIntoNewWindow',
5765
5994
  label: copyIntoNewWindow()
5766
5995
  }, menuEntrySeparator, {
5767
5996
  args: [/* id */'References', /* focus */true, path],
5768
5997
  command: 'SideBar.show',
5769
- flags: None,
5998
+ flags: None$1,
5770
5999
  id: 'findFileReferences',
5771
6000
  label: findFileReferences()
5772
6001
  }];
@@ -5784,9 +6013,12 @@ const getMenuEntries = async (state, props) => {
5784
6013
  };
5785
6014
 
5786
6015
  const moveIntoNewWindow = async state => {
6016
+ const {
6017
+ layout
6018
+ } = state;
5787
6019
  const {
5788
6020
  activeGroupId
5789
- } = state.layout;
6021
+ } = layout;
5790
6022
  const group = findGroupById(state, activeGroupId ?? 0);
5791
6023
  if (!group) {
5792
6024
  return state;
@@ -5838,6 +6070,24 @@ const refresh = state => {
5838
6070
  };
5839
6071
  };
5840
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
+
5841
6091
  const getEditorGroupCss = layout => {
5842
6092
  const groupSizeVariable = layout.direction === Vertical ? '--EditorGroupHeight' : '--EditorGroupWidth';
5843
6093
  return layout.groups.map(group => {
@@ -5927,10 +6177,18 @@ const getSashCss = (layout, width = 0) => {
5927
6177
  return getProtoSashCss(layout, width).map(renderSashCss);
5928
6178
  };
5929
6179
 
5930
- const getCss = (layout, width = 0) => {
5931
- const rules = [`.MainArea {
6180
+ const getCss = (layout, width = 0, dragOverlay) => {
6181
+ const rules = [`.Main {
6182
+ position: relative;
5932
6183
  }`, `.editor-groups-container {
5933
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;
5934
6192
  }`, `.SashBorder {
5935
6193
  background: var(--SashBorder, gray);
5936
6194
  }`, `.SashBorderHorizontal {
@@ -5966,7 +6224,7 @@ const getCss = (layout, width = 0) => {
5966
6224
  /*height: var(--EditorGroupHeight, auto);*/
5967
6225
  }`];
5968
6226
  if (layout) {
5969
- rules.push(...getEditorGroupCss(layout), ...getSashCss(layout, width));
6227
+ rules.push(...getEditorGroupCss(layout), ...getDragOverlayCss(dragOverlay), ...getSashCss(layout, width));
5970
6228
  const sashCorner = getSashCorner(layout);
5971
6229
  if (sashCorner) {
5972
6230
  rules.push(`.SashCorner {
@@ -5980,7 +6238,7 @@ const getCss = (layout, width = 0) => {
5980
6238
  };
5981
6239
 
5982
6240
  const renderCss = (oldState, newState) => {
5983
- const css = getCss(newState.layout, newState.width);
6241
+ const css = getCss(newState.layout, newState.width, newState.dragOverlay);
5984
6242
  return [SetCss, newState.uid, css];
5985
6243
  };
5986
6244
 
@@ -6273,32 +6531,49 @@ const HandleDoubleClick = 19;
6273
6531
  const HandleSashCornerPointerDown = 20;
6274
6532
  const HandleSashCornerPointerMove = 21;
6275
6533
  const HandleSashCornerPointerUp = 22;
6534
+ const HandleDragOver = 23;
6535
+ const HandleDragLeave = 24;
6536
+ const HandleDrop = 25;
6276
6537
 
6538
+ const dragOverlayVirtualDom = {
6539
+ childCount: 0,
6540
+ className: DragOverlay,
6541
+ type: Div
6542
+ };
6543
+ const getDragOverlayVirtualDom = () => {
6544
+ return dragOverlayVirtualDom;
6545
+ };
6546
+
6547
+ const textEditorNode = {
6548
+ childCount: 1,
6549
+ className: TextEditor,
6550
+ type: Div
6551
+ };
6552
+ const editorContentNode = {
6553
+ childCount: 1,
6554
+ className: EditorContent,
6555
+ type: Pre
6556
+ };
6277
6557
  const renderContent = content => {
6278
- return [{
6279
- childCount: 1,
6280
- className: TextEditor,
6281
- type: Div
6282
- }, {
6283
- childCount: 1,
6284
- className: EditorContent,
6285
- type: Pre
6286
- }, text(content)];
6558
+ return [textEditorNode, editorContentNode, text(content)];
6287
6559
  };
6288
6560
 
6561
+ const textEditorErrorNode = {
6562
+ childCount: 1,
6563
+ className: TextEditorError,
6564
+ type: Div
6565
+ };
6566
+ const editorContentErrorNode = {
6567
+ childCount: 2,
6568
+ className: EditorContentError,
6569
+ type: Div
6570
+ };
6571
+ const paragraphNode = {
6572
+ childCount: 1,
6573
+ type: P
6574
+ };
6289
6575
  const renderError = errorMessage => {
6290
- return [{
6291
- childCount: 1,
6292
- className: TextEditorError,
6293
- type: Div
6294
- }, {
6295
- childCount: 2,
6296
- className: EditorContentError,
6297
- type: Div
6298
- }, {
6299
- childCount: 1,
6300
- type: P
6301
- }, text(`Error: ${errorMessage}`), {
6576
+ return [textEditorErrorNode, editorContentErrorNode, paragraphNode, text(`Error: ${errorMessage}`), {
6302
6577
  childCount: 1,
6303
6578
  className: mergeClassNames(Button, ButtonSecondary),
6304
6579
  'data-action': RetryOpen,
@@ -6308,16 +6583,18 @@ const renderError = errorMessage => {
6308
6583
  }, text(retry())];
6309
6584
  };
6310
6585
 
6586
+ const textEditorLoadingNode = {
6587
+ childCount: 1,
6588
+ className: TextEditorLoading,
6589
+ type: Div
6590
+ };
6591
+ const editorContentLoadingNode = {
6592
+ childCount: 1,
6593
+ className: EditorContentLoading,
6594
+ type: Div
6595
+ };
6311
6596
  const renderLoading = () => {
6312
- return [{
6313
- childCount: 1,
6314
- className: TextEditorLoading,
6315
- type: Div
6316
- }, {
6317
- childCount: 1,
6318
- className: EditorContentLoading,
6319
- type: Div
6320
- }, text('Loading...')];
6597
+ return [textEditorLoadingNode, editorContentLoadingNode, text('Loading...')];
6321
6598
  };
6322
6599
 
6323
6600
  const renderViewletReference = tab => {
@@ -6356,6 +6633,16 @@ const renderEditor = tab => {
6356
6633
  return renderContent('');
6357
6634
  };
6358
6635
 
6636
+ const dirtyIconNode = {
6637
+ childCount: 0,
6638
+ className: MaskIconCircleFilled,
6639
+ type: Div
6640
+ };
6641
+ const closeIconNode$1 = {
6642
+ childCount: 0,
6643
+ className: MaskIconClose,
6644
+ type: Div
6645
+ };
6359
6646
  const renderTabActions = (isDirty, tabIndex, groupIndex) => {
6360
6647
  if (isDirty) {
6361
6648
  return [{
@@ -6366,11 +6653,7 @@ const renderTabActions = (isDirty, tabIndex, groupIndex) => {
6366
6653
  'data-index': tabIndex,
6367
6654
  onClick: HandleClickClose,
6368
6655
  type: Button$2
6369
- }, {
6370
- childCount: 0,
6371
- className: MaskIconCircleFilled,
6372
- type: Div
6373
- }];
6656
+ }, dirtyIconNode];
6374
6657
  }
6375
6658
  return [{
6376
6659
  'aria-label': 'Close',
@@ -6380,24 +6663,26 @@ const renderTabActions = (isDirty, tabIndex, groupIndex) => {
6380
6663
  'data-index': tabIndex,
6381
6664
  onClick: HandleClickClose,
6382
6665
  type: Button$2
6383
- }, {
6384
- childCount: 0,
6385
- className: MaskIconClose,
6386
- type: Div
6387
- }];
6666
+ }, closeIconNode$1];
6388
6667
  };
6389
6668
 
6390
6669
  const ExtensionDetailScheme = 'extension-detail://';
6391
6670
  const KeyBindingsUri = 'app://keybindings';
6392
6671
  const RunningExtensionsScheme = 'running-extensions://';
6393
6672
  const SearchEditorScheme = 'search-editor://';
6673
+ const tabIconNode = {
6674
+ childCount: 1,
6675
+ className: TabIcon,
6676
+ role: None$2,
6677
+ type: Div
6678
+ };
6679
+ const tabTitleNode = {
6680
+ childCount: 1,
6681
+ className: TabTitle,
6682
+ type: Span
6683
+ };
6394
6684
  const renderMaskIcon = className => {
6395
- return [{
6396
- childCount: 1,
6397
- className: TabIcon,
6398
- role: None$1,
6399
- type: Div
6400
- }, {
6685
+ return [tabIconNode, {
6401
6686
  childCount: 0,
6402
6687
  className,
6403
6688
  type: Div
@@ -6419,7 +6704,7 @@ const renderTabIcon = tab => {
6419
6704
  return [{
6420
6705
  childCount: 0,
6421
6706
  className: TabIcon,
6422
- role: None$1,
6707
+ role: None$2,
6423
6708
  src: tab.icon,
6424
6709
  type: Img
6425
6710
  }];
@@ -6428,13 +6713,13 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
6428
6713
  const closeButtonNodes = renderTabActions(tab.isDirty, tabIndex, groupIndex);
6429
6714
  let className = MainTab;
6430
6715
  if (isActive) {
6431
- className += ' ' + MainTabSelected;
6716
+ className = mergeClassNames(className, MainTabSelected);
6432
6717
  }
6433
6718
  if (tab.isDirty) {
6434
- className += ' ' + MainTabModified;
6719
+ className = mergeClassNames(className, MainTabModified);
6435
6720
  }
6436
6721
  if (tab.isPreview) {
6437
- className += ' ' + MainTabPreview;
6722
+ className = mergeClassNames(className, MainTabPreview);
6438
6723
  }
6439
6724
  return [{
6440
6725
  'aria-selected': isActive,
@@ -6448,11 +6733,7 @@ const renderTab = (tab, isActive, tabIndex, groupIndex) => {
6448
6733
  role: Tab$1,
6449
6734
  title: tab.uriTitle || tab.uri || tab.title,
6450
6735
  type: Div
6451
- }, ...renderTabIcon(tab), {
6452
- childCount: 1,
6453
- className: TabTitle,
6454
- type: Span
6455
- }, text(tab.title), ...closeButtonNodes];
6736
+ }, ...renderTabIcon(tab), tabTitleNode, text(tab.title), ...closeButtonNodes];
6456
6737
  };
6457
6738
 
6458
6739
  const getTabsVirtualDom = (group, groupIndex, tabsChildCount) => {
@@ -6471,6 +6752,11 @@ const isHtmlFile = tab => {
6471
6752
  return tab.uri.endsWith('.html');
6472
6753
  };
6473
6754
 
6755
+ const previewIconNode = {
6756
+ childCount: 0,
6757
+ className: MaskIconPreview,
6758
+ type: Div
6759
+ };
6474
6760
  const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
6475
6761
  const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
6476
6762
  const showTogglePreview = isHtmlFile(activeTab);
@@ -6489,11 +6775,7 @@ const renderEditorGroupActions = (group, groupIndex, splitButtonEnabled) => {
6489
6775
  onClick: HandleClickAction,
6490
6776
  title: togglePreview(),
6491
6777
  type: Button$2
6492
- }, {
6493
- childCount: 0,
6494
- className: MaskIconPreview,
6495
- type: Div
6496
- });
6778
+ }, previewIconNode);
6497
6779
  }
6498
6780
  if (splitButtonEnabled) {
6499
6781
  buttons.push({
@@ -6524,7 +6806,7 @@ const renderEditorGroupHeader = (group, groupIndex, splitButtonEnabled) => {
6524
6806
  childCount: hasActions ? 2 : 1,
6525
6807
  className: EditorGroupHeader,
6526
6808
  onDblClick: HandleHeaderDoubleClick,
6527
- role: None$1,
6809
+ role: None$2,
6528
6810
  type: Div
6529
6811
  }, ...getTabsVirtualDom(group, groupIndex, tabsChildCount), ...actions];
6530
6812
  };
@@ -6534,6 +6816,11 @@ const emptyHeader = {
6534
6816
  className: EmptyGroupHeader,
6535
6817
  type: Div
6536
6818
  };
6819
+ const closeIconNode = {
6820
+ childCount: 0,
6821
+ className: MaskIconClose,
6822
+ type: Div
6823
+ };
6537
6824
  const renderEmptyGroupCloseButton = (group, groupIndex) => {
6538
6825
  return [emptyHeader, {
6539
6826
  childCount: 1,
@@ -6543,11 +6830,7 @@ const renderEmptyGroupCloseButton = (group, groupIndex) => {
6543
6830
  onClick: HandleClickAction,
6544
6831
  title: closeEditorGroup(),
6545
6832
  type: Button$2
6546
- }, {
6547
- childCount: 0,
6548
- className: MaskIconClose,
6549
- type: Div
6550
- }];
6833
+ }, closeIconNode];
6551
6834
  };
6552
6835
 
6553
6836
  const renderWaterMark = groupId => {
@@ -6570,7 +6853,7 @@ const renderEmptyEditorGroup = (group, groupIndex, style, closeButtonEnabled = t
6570
6853
  const closeButtonDom = closeButtonEnabled ? renderEmptyGroupCloseButton(group) : [];
6571
6854
  return [{
6572
6855
  childCount: closeButtonEnabled ? 2 : 1,
6573
- className: EditorGroup,
6856
+ className: EditorGroupEmpty,
6574
6857
  'data-groupId': String(group.id),
6575
6858
  onContextMenu: HandleContextMenu,
6576
6859
  style,
@@ -6579,6 +6862,11 @@ const renderEmptyEditorGroup = (group, groupIndex, style, closeButtonEnabled = t
6579
6862
  }, ...closeButtonDom, ...renderWaterMark(group.id)];
6580
6863
  };
6581
6864
 
6865
+ const editorContainerNode = {
6866
+ childCount: 1,
6867
+ className: EditorContainer,
6868
+ type: Div
6869
+ };
6582
6870
  const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, sizeProperty = 'width', closeButtonEnabled = true) => {
6583
6871
  const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
6584
6872
  const style = `${sizeProperty}:${group.size}%;`;
@@ -6593,11 +6881,7 @@ const renderEditorGroup = (group, groupIndex, splitButtonEnabled = false, sizePr
6593
6881
  'data-groupId': String(group.id),
6594
6882
  style,
6595
6883
  type: Div
6596
- }, ...renderEditorGroupHeader(group, groupIndex, splitButtonEnabled), {
6597
- childCount: 1,
6598
- className: EditorContainer,
6599
- type: Div
6600
- }, ...renderEditor(activeTab)];
6884
+ }, ...renderEditorGroupHeader(group, groupIndex, splitButtonEnabled), editorContainerNode, ...renderEditor(activeTab)];
6601
6885
  };
6602
6886
 
6603
6887
  const getSashClassName = direction => {
@@ -6613,7 +6897,7 @@ const renderSash = (direction, sashId) => {
6613
6897
  className: getSashClassName(direction),
6614
6898
  'data-sashId': sashId,
6615
6899
  onPointerDown: HandleSashPointerDown,
6616
- role: None$1,
6900
+ role: None$2,
6617
6901
  type: Button$2
6618
6902
  }, {
6619
6903
  childCount: 0,
@@ -6622,22 +6906,27 @@ const renderSash = (direction, sashId) => {
6622
6906
  }];
6623
6907
  };
6624
6908
 
6909
+ const sashCornerNode = {
6910
+ childCount: 0,
6911
+ className: 'SashCorner',
6912
+ onPointerDown: HandleSashCornerPointerDown,
6913
+ role: None$2,
6914
+ type: Button$2
6915
+ };
6625
6916
  const renderSashCorner = () => {
6626
- return {
6627
- childCount: 0,
6628
- className: 'SashCorner',
6629
- onPointerDown: HandleSashCornerPointerDown,
6630
- role: None$1,
6631
- type: Button$2
6632
- };
6917
+ return sashCornerNode;
6633
6918
  };
6634
6919
 
6920
+ const mainNode$1 = {
6921
+ childCount: 1,
6922
+ className: Main,
6923
+ onDragLeave: HandleDragLeave,
6924
+ onDragOver: HandleDragOver,
6925
+ onDrop: HandleDrop,
6926
+ type: Div
6927
+ };
6635
6928
  const renderSingleEditorGroup = (layout, splitButtonEnabled, sizeProperty = 'width') => {
6636
- return [{
6637
- childCount: 1,
6638
- className: Main,
6639
- type: Div
6640
- }, ...renderEditorGroup(layout.groups[0], 0, splitButtonEnabled, sizeProperty, false)];
6929
+ return [mainNode$1, ...renderEditorGroup(layout.groups[0], 0, splitButtonEnabled, sizeProperty, false)];
6641
6930
  };
6642
6931
 
6643
6932
  const getDirectionClassName = (direction, isSplit) => {
@@ -6648,7 +6937,24 @@ const getDirectionClassName = (direction, isSplit) => {
6648
6937
  };
6649
6938
  const getContainerClassName = (direction, childCount) => {
6650
6939
  const directionClassName = getDirectionClassName(direction, childCount > 1);
6651
- return directionClassName ? `${EDITOR_GROUPS_CONTAINER} ${directionClassName}` : EDITOR_GROUPS_CONTAINER;
6940
+ return directionClassName ? mergeClassNames(EDITOR_GROUPS_CONTAINER, directionClassName) : EDITOR_GROUPS_CONTAINER;
6941
+ };
6942
+ const mainNode = {
6943
+ childCount: 1,
6944
+ className: Main,
6945
+ onDragLeave: HandleDragLeave,
6946
+ onDragOver: HandleDragOver,
6947
+ onDrop: HandleDrop,
6948
+ type: Div
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()];
6652
6958
  };
6653
6959
  const getSizeProperty = direction => {
6654
6960
  return direction === Vertical ? 'height' : 'width';
@@ -6698,7 +7004,7 @@ const renderSegmentChildren = (direction, groups, splitButtonEnabled) => {
6698
7004
  children.push({
6699
7005
  childCount: nestedChildCount,
6700
7006
  className: getContainerClassName(nestedDirection, segment.groups.length),
6701
- role: None$1,
7007
+ role: None$2,
6702
7008
  style: `${sizeProperty}:${segmentSize}%;`,
6703
7009
  type: Div
6704
7010
  });
@@ -6711,29 +7017,25 @@ const renderSegmentChildren = (direction, groups, splitButtonEnabled) => {
6711
7017
  children
6712
7018
  };
6713
7019
  };
6714
- const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
7020
+ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false, dragOverlay) => {
6715
7021
  const {
6716
7022
  direction,
6717
7023
  groups
6718
7024
  } = layout;
6719
7025
  const sizeProperty = getSizeProperty(direction);
6720
7026
  if (groups.length === 1) {
6721
- return renderSingleEditorGroup(layout, splitButtonEnabled, sizeProperty);
7027
+ return addDragOverlay(renderSingleEditorGroup(layout, splitButtonEnabled, sizeProperty), dragOverlay);
6722
7028
  }
6723
7029
  const editorGroupsContainerClassName = getContainerClassName(direction, groups.length);
6724
7030
  if (groups.length === 0) {
6725
- return [{
6726
- childCount: 1,
6727
- className: Main,
6728
- type: Div
6729
- }, {
7031
+ return addDragOverlay([mainNode, {
6730
7032
  childCount: 0,
6731
7033
  className: editorGroupsContainerClassName,
6732
7034
  'data-groupId': '',
6733
7035
  onContextMenu: HandleContextMenu,
6734
- role: None$1,
7036
+ role: None$2,
6735
7037
  type: Div
6736
- }];
7038
+ }], dragOverlay);
6737
7039
  }
6738
7040
  const {
6739
7041
  childCount,
@@ -6741,20 +7043,17 @@ const getMainAreaVirtualDom = (layout, splitButtonEnabled = false) => {
6741
7043
  } = renderSegmentChildren(direction, groups, splitButtonEnabled);
6742
7044
  const sashCorner = getSashCorner(layout);
6743
7045
  const sashCornerChildren = sashCorner ? [renderSashCorner()] : [];
6744
- return [{
6745
- childCount: 1,
6746
- className: Main,
6747
- type: Div
6748
- }, {
7046
+ return addDragOverlay([mainNode, {
6749
7047
  childCount: childCount + sashCornerChildren.length,
6750
7048
  className: editorGroupsContainerClassName,
6751
- role: None$1,
7049
+ role: None$2,
6752
7050
  type: Div
6753
- }, ...children, ...sashCornerChildren];
7051
+ }, ...children, ...sashCornerChildren], dragOverlay);
6754
7052
  };
6755
7053
 
6756
7054
  const renderItems = (oldState, newState) => {
6757
7055
  const {
7056
+ dragOverlay,
6758
7057
  initial,
6759
7058
  layout,
6760
7059
  splitButtonEnabled,
@@ -6763,7 +7062,7 @@ const renderItems = (oldState, newState) => {
6763
7062
  if (initial) {
6764
7063
  return [SetDom2, uid, []];
6765
7064
  }
6766
- const dom = getMainAreaVirtualDom(layout, splitButtonEnabled);
7065
+ const dom = getMainAreaVirtualDom(layout, splitButtonEnabled, dragOverlay);
6767
7066
  return [SetDom2, uid, dom];
6768
7067
  };
6769
7068
 
@@ -6869,6 +7168,17 @@ const renderEventListeners = () => {
6869
7168
  }, {
6870
7169
  name: HandleSashCornerPointerUp,
6871
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
6872
7182
  }];
6873
7183
  };
6874
7184
 
@@ -6967,6 +7277,13 @@ const reopenEditorWith = async context => {
6967
7277
  }
6968
7278
  };
6969
7279
 
7280
+ const resize$1 = (state, dimensions) => {
7281
+ return {
7282
+ ...state,
7283
+ ...dimensions
7284
+ };
7285
+ };
7286
+
6970
7287
  const settingsUri = 'app://settings.json';
6971
7288
  const saveEditorAndHandleSettingsChange = async tab => {
6972
7289
  const editorState = await saveEditor(tab.editorUid);
@@ -6997,8 +7314,11 @@ const getLatestStoredState = (uid, fallbackState, referenceTabId, referenceTabUr
6997
7314
  return fallbackState;
6998
7315
  };
6999
7316
  const save = async state => {
7317
+ const {
7318
+ uid
7319
+ } = state;
7000
7320
  const requestedActiveTabData = getActiveTab(state);
7001
- 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);
7002
7322
  const activeTabData = getActiveTab(currentState);
7003
7323
  if (!activeTabData) {
7004
7324
  return currentState;
@@ -7011,17 +7331,17 @@ const save = async state => {
7011
7331
  }
7012
7332
  if (!tab.isDirty) {
7013
7333
  await saveEditorAndHandleSettingsChange(tab);
7014
- return getLatestStoredState(state.uid, currentState, tab.id, tab.uri);
7334
+ return getLatestStoredState(uid, currentState, tab.id, tab.uri);
7015
7335
  }
7016
7336
  const editorState = await saveEditorAndHandleSettingsChange(tab);
7017
- const latestState = getLatestStoredState(state.uid, currentState, tab.id, tab.uri);
7337
+ const latestState = getLatestStoredState(uid, currentState, tab.id, tab.uri);
7018
7338
  if (editorState?.modified) {
7019
7339
  return latestState;
7020
7340
  }
7021
7341
  if (tab.uri) {
7022
7342
  await handleModifiedStatusChange$1(tab.uri, false);
7023
7343
  }
7024
- const stateAfterModifiedStatusChange = getLatestStoredState(state.uid, latestState, tab.id, tab.uri);
7344
+ const stateAfterModifiedStatusChange = getLatestStoredState(uid, latestState, tab.id, tab.uri);
7025
7345
  return updateTab(stateAfterModifiedStatusChange, tab.id, {
7026
7346
  isDirty: false
7027
7347
  });
@@ -7158,12 +7478,15 @@ const setEditorLayout = (state, direction, slots) => {
7158
7478
  };
7159
7479
  };
7160
7480
  const flipLayout = state => {
7481
+ const {
7482
+ layout
7483
+ } = state;
7161
7484
  return {
7162
7485
  ...state,
7163
7486
  layout: {
7164
- ...state.layout,
7165
- direction: flipDirection(state.layout.direction),
7166
- groups: state.layout.groups.map(group => ({
7487
+ ...layout,
7488
+ direction: flipDirection(layout.direction),
7489
+ groups: layout.groups.map(group => ({
7167
7490
  ...group,
7168
7491
  direction: group.direction === undefined ? undefined : flipDirection(group.direction)
7169
7492
  }))
@@ -7286,7 +7609,7 @@ const splitDown = (state, groupId) => {
7286
7609
  };
7287
7610
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
7288
7611
  }
7289
- const resolvedGroupId = groupId ?? state.layout.activeGroupId;
7612
+ const resolvedGroupId = groupId ?? layout.activeGroupId;
7290
7613
  if (!resolvedGroupId) {
7291
7614
  return state;
7292
7615
  }
@@ -7319,10 +7642,10 @@ const splitLeft = (state, groupId) => {
7319
7642
  groups: [initialGroup]
7320
7643
  }
7321
7644
  };
7322
- return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left);
7645
+ return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Left$1);
7323
7646
  }
7324
7647
  const targetGroupId = groupId ?? activeGroupId ?? groups[0]?.id ?? 0;
7325
- return splitEditorGroup$1(state, targetGroupId, Left);
7648
+ return splitEditorGroup$1(state, targetGroupId, Left$1);
7326
7649
  };
7327
7650
 
7328
7651
  const splitRight = (state, groupId) => {
@@ -7353,10 +7676,10 @@ const splitRight = (state, groupId) => {
7353
7676
  groups: [initialGroup]
7354
7677
  }
7355
7678
  };
7356
- return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right);
7679
+ return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, Right$1);
7357
7680
  }
7358
7681
  const targetGroupId = groupId ?? activeGroupId ?? groups[0]?.id ?? 0;
7359
- return splitEditorGroup$1(state, targetGroupId, Right);
7682
+ return splitEditorGroup$1(state, targetGroupId, Right$1);
7360
7683
  };
7361
7684
 
7362
7685
  const splitUp = (state, groupId) => {
@@ -7386,13 +7709,39 @@ const splitUp = (state, groupId) => {
7386
7709
  };
7387
7710
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
7388
7711
  }
7389
- const resolvedGroupId = groupId ?? state.layout.activeGroupId;
7712
+ const resolvedGroupId = groupId ?? layout.activeGroupId;
7390
7713
  if (!resolvedGroupId) {
7391
7714
  return state;
7392
7715
  }
7393
7716
  return splitEditorGroup$1(state, resolvedGroupId, 'up');
7394
7717
  };
7395
7718
 
7719
+ const pendingLoads = new Map();
7720
+ const loadContent = wrapSerialCommand(loadContent$1);
7721
+ const loadContentTracked = async (uid, ...args) => {
7722
+ const loading = loadContent(uid, ...args);
7723
+ pendingLoads.set(uid, loading);
7724
+ try {
7725
+ await loading;
7726
+ } finally {
7727
+ if (pendingLoads.get(uid) === loading) {
7728
+ pendingLoads.delete(uid);
7729
+ }
7730
+ }
7731
+ };
7732
+ const resize = async (uid, dimensions) => {
7733
+ const loading = pendingLoads.get(uid);
7734
+ if (loading) {
7735
+ await loading;
7736
+ }
7737
+ const instance = get(uid);
7738
+ if (!instance) {
7739
+ return [];
7740
+ }
7741
+ const resizedState = resize$1(instance.newState, dimensions);
7742
+ set(uid, instance.oldState, resizedState);
7743
+ return handleResize(resizedState, dimensions);
7744
+ };
7396
7745
  const commandMap = {
7397
7746
  'Main.closeActiveEditor': wrapSerialCommand(closeActiveEditor),
7398
7747
  'Main.closeAll': wrapSerialCommand(closeAll$1),
@@ -7447,11 +7796,12 @@ const commandMap = {
7447
7796
  'MainArea.handleClickTogglePreview': wrapSerialCommand(handleClickTogglePreview),
7448
7797
  'MainArea.handleContextMenu': wrapSerialCommand(handleContextMenu),
7449
7798
  'MainArea.handleDoubleClick': wrapSerialCommand(handleDoubleClick),
7799
+ 'MainArea.handleDragLeave': wrapSerialCommand(handleDragLeave),
7800
+ 'MainArea.handleDragOver': wrapSerialCommand(handleDragOver),
7450
7801
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
7451
7802
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
7452
7803
  'MainArea.handleModifiedStatusChange': wrapAsyncCommand(handleModifiedStatusChangeWithContext),
7453
- 'MainArea.handleResize': wrapGetter(handleResize),
7454
- // TODO would need to have a function that returns newstate as well as commands
7804
+ 'MainArea.handleResize': resize,
7455
7805
  'MainArea.handleSashCornerPointerDown': wrapSerialCommand(handleSashCornerPointerDown),
7456
7806
  'MainArea.handleSashCornerPointerMove': wrapSerialCommand(handleSashCornerPointerMove),
7457
7807
  'MainArea.handleSashCornerPointerUp': wrapSerialCommand(handleSashCornerPointerUp),
@@ -7464,7 +7814,7 @@ const commandMap = {
7464
7814
  'MainArea.handleWorkspaceRefresh': wrapAsyncCommand(handleWorkspaceRefreshWithContext),
7465
7815
  'MainArea.hasActiveTextEditor': wrapGetter(hasActiveTextEditor),
7466
7816
  'MainArea.initialize': initialize,
7467
- 'MainArea.loadContent': wrapSerialCommand(loadContent),
7817
+ 'MainArea.loadContent': loadContentTracked,
7468
7818
  'MainArea.moveIntoNewWindow': wrapSerialCommand(moveIntoNewWindow),
7469
7819
  'MainArea.newFile': wrapSerialCommand(newFile),
7470
7820
  'MainArea.newWindow': wrapSerialCommand(newWindow),
@@ -7475,7 +7825,7 @@ const commandMap = {
7475
7825
  'MainArea.render2': render2,
7476
7826
  'MainArea.renderEventListeners': renderEventListeners,
7477
7827
  'MainArea.reopenEditorWith': wrapSerialAsyncCommand(reopenEditorWith),
7478
- 'MainArea.resize': wrapGetter(handleResize),
7828
+ 'MainArea.resize': resize,
7479
7829
  'MainArea.restoreClosedTab': wrapSerialCommand(restoreClosedTab),
7480
7830
  'MainArea.save': wrapSerialCommand(save),
7481
7831
  'MainArea.saveState': wrapGetter(saveState),