@lvce-editor/main-area-worker 9.33.0 → 9.33.2

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.
@@ -1493,6 +1493,7 @@ const VirtualDomElements = {
1493
1493
  const Button$1 = 'event.button';
1494
1494
  const ClientX = 'event.clientX';
1495
1495
  const ClientY = 'event.clientY';
1496
+ const DataTransferFiles2 = 'event.dataTransfer.files2';
1496
1497
  const EventTargetClassName = 'event.target.className';
1497
1498
  const TargetName = 'event.target.name';
1498
1499
 
@@ -1553,6 +1554,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1553
1554
  number(y);
1554
1555
  await invoke('ContextMenu.show2', uid, menuId, x, y, args);
1555
1556
  };
1557
+ const getFileHandles = async fileIds => {
1558
+ const files = await invoke('FileSystemHandle.getFileHandles', fileIds);
1559
+ return files;
1560
+ };
1556
1561
  const sendMessagePortToClipBoardWorker$1 = async (port, rpcId) => {
1557
1562
  const command = 'ClipBoard.handleMessagePort';
1558
1563
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToClipBoardWorker', port, command, rpcId);
@@ -2321,7 +2326,10 @@ const findTabInState = (state, groupId, tabId) => {
2321
2326
  const {
2322
2327
  layout
2323
2328
  } = state;
2324
- const group = layout.groups.find(g => g.id === groupId);
2329
+ const {
2330
+ groups
2331
+ } = layout;
2332
+ const group = groups.find(g => g.id === groupId);
2325
2333
  return group?.tabs.find(t => t.id === tabId);
2326
2334
  };
2327
2335
 
@@ -2329,6 +2337,9 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2329
2337
  const {
2330
2338
  layout
2331
2339
  } = state;
2340
+ const {
2341
+ groups
2342
+ } = layout;
2332
2343
  const tab = findTabInState(state, groupId, tabId);
2333
2344
  const commands = [];
2334
2345
  if (tab && tab.editorUid !== -1) {
@@ -2338,7 +2349,7 @@ const closeTabWithViewlet = async (state, groupId, tabId) => {
2338
2349
  commands.push(...disposeCommands);
2339
2350
  }
2340
2351
  const newState = closeTab(state, groupId, tabId);
2341
- const group = layout.groups.find(g => g.id === groupId);
2352
+ const group = groups.find(g => g.id === groupId);
2342
2353
  const wasActiveTab = group?.activeTabId === tabId;
2343
2354
  const newGroup = wasActiveTab ? newState.layout.groups.find(candidate => candidate.id === groupId) : undefined;
2344
2355
  const newActiveTabId = newGroup?.activeTabId;
@@ -2462,9 +2473,12 @@ const closeAll$1 = async state => {
2462
2473
  const {
2463
2474
  layout
2464
2475
  } = state;
2465
- const editorUids = layout.groups.flatMap(group => group.tabs.map(tab => tab.editorUid)).filter(editorUid => editorUid !== -1);
2476
+ const {
2477
+ groups
2478
+ } = layout;
2479
+ const editorUids = groups.flatMap(group => group.tabs.map(tab => tab.editorUid)).filter(editorUid => editorUid !== -1);
2466
2480
  await disposeEditors(editorUids);
2467
- const entries = layout.groups.flatMap((group, groupIndex) => {
2481
+ const entries = groups.flatMap((group, groupIndex) => {
2468
2482
  return group.tabs.map((tab, tabIndex) => ({
2469
2483
  group,
2470
2484
  groupIndex,
@@ -2630,7 +2644,10 @@ const closeFirstTabByUri = (state, uri) => {
2630
2644
  const {
2631
2645
  layout
2632
2646
  } = state;
2633
- const matchingGroup = layout.groups.find(group => {
2647
+ const {
2648
+ groups
2649
+ } = layout;
2650
+ const matchingGroup = groups.find(group => {
2634
2651
  return group.tabs.some(tab => tab.uri === uri);
2635
2652
  });
2636
2653
  const matchingTab = matchingGroup?.tabs.find(tab => tab.uri === uri);
@@ -2655,7 +2672,10 @@ const getGroupById = (state, groupId) => {
2655
2672
  const {
2656
2673
  layout
2657
2674
  } = state;
2658
- return layout.groups.find(group => group.id === groupId);
2675
+ const {
2676
+ groups
2677
+ } = layout;
2678
+ return groups.find(group => group.id === groupId);
2659
2679
  };
2660
2680
 
2661
2681
  const closeTabsRight = (state, groupId) => {
@@ -3040,7 +3060,10 @@ const getSelectedTabData = (state, groupIndex, index) => {
3040
3060
  const {
3041
3061
  layout
3042
3062
  } = state;
3043
- const group = layout.groups[groupIndex];
3063
+ const {
3064
+ groups
3065
+ } = layout;
3066
+ const group = groups[groupIndex];
3044
3067
  if (!group || index < 0 || index >= group.tabs.length) {
3045
3068
  return undefined;
3046
3069
  }
@@ -3221,6 +3244,7 @@ const selectTab = async (state, groupIndex, index) => {
3221
3244
  uid
3222
3245
  } = state;
3223
3246
  const {
3247
+ activeGroupId,
3224
3248
  groups
3225
3249
  } = layout;
3226
3250
  if (groupIndex < 0 || groupIndex >= groups.length) {
@@ -3237,7 +3261,7 @@ const selectTab = async (state, groupIndex, index) => {
3237
3261
  tabId
3238
3262
  } = selectedTabData;
3239
3263
  const normalizedTab = normalizeTabEditorInput(tab);
3240
- const isAlreadyActive = layout.activeGroupId === groupId && group.activeTabId === tabId;
3264
+ const isAlreadyActive = activeGroupId === groupId && group.activeTabId === tabId;
3241
3265
  if (isAlreadyActive && !shouldLoadContentForTab(normalizedTab)) {
3242
3266
  return state;
3243
3267
  }
@@ -3453,6 +3477,9 @@ const restoreExistingUri = (state, entry) => {
3453
3477
  const {
3454
3478
  layout
3455
3479
  } = state;
3480
+ const {
3481
+ groups: layoutGroups
3482
+ } = layout;
3456
3483
  if (!entry.tab.uri) {
3457
3484
  return undefined;
3458
3485
  }
@@ -3460,11 +3487,11 @@ const restoreExistingUri = (state, entry) => {
3460
3487
  if (!existing) {
3461
3488
  return undefined;
3462
3489
  }
3463
- const groupIndex = layout.groups.findIndex(group => group.id === existing.groupId);
3490
+ const groupIndex = layoutGroups.findIndex(group => group.id === existing.groupId);
3464
3491
  if (groupIndex === -1) {
3465
3492
  return undefined;
3466
3493
  }
3467
- const tabIndex = layout.groups[groupIndex].tabs.findIndex(tab => tab.id === existing.tab.id);
3494
+ const tabIndex = layoutGroups[groupIndex].tabs.findIndex(tab => tab.id === existing.tab.id);
3468
3495
  if (tabIndex === -1) {
3469
3496
  return undefined;
3470
3497
  }
@@ -3632,7 +3659,10 @@ const getTabCount = state => {
3632
3659
  const {
3633
3660
  layout
3634
3661
  } = state;
3635
- return layout.groups.reduce((sum, group) => sum + group.tabs.length, 0);
3662
+ const {
3663
+ groups
3664
+ } = layout;
3665
+ return groups.reduce((sum, group) => sum + group.tabs.length, 0);
3636
3666
  };
3637
3667
 
3638
3668
  const getCurrentState = state => {
@@ -3749,12 +3779,15 @@ const updateTabUriTitles = state => {
3749
3779
  homeDirUri: rawHomeDirUri,
3750
3780
  layout
3751
3781
  } = state;
3782
+ const {
3783
+ groups
3784
+ } = layout;
3752
3785
  const homeDirUri = rawHomeDirUri || '';
3753
3786
  return {
3754
3787
  ...state,
3755
3788
  layout: {
3756
3789
  ...layout,
3757
- groups: layout.groups.map(group => ({
3790
+ groups: groups.map(group => ({
3758
3791
  ...group,
3759
3792
  tabs: group.tabs.map(tab => updateTabUriTitle(tab, homeDirUri))
3760
3793
  }))
@@ -4081,11 +4114,14 @@ const updateIconCache = (iconCache, missingRequests, newIcons) => {
4081
4114
  return newFileIconCache;
4082
4115
  };
4083
4116
 
4117
+ const getUri = tab => {
4118
+ return tab.uri || '';
4119
+ };
4084
4120
  const getFileIconsForTabs = async (tabs, fileIconCache) => {
4085
4121
  const missingRequests = getMissingIconRequestsForTabs(tabs, fileIconCache);
4086
4122
  const newIcons = await requestFileIcons(missingRequests);
4087
4123
  const newFileIconCache = updateIconCache(fileIconCache, missingRequests, newIcons);
4088
- const tabUris = tabs.map(tab => tab.uri || '');
4124
+ const tabUris = tabs.map(getUri);
4089
4125
  const icons = getIconsCached(tabUris, newFileIconCache);
4090
4126
  return {
4091
4127
  icons,
@@ -4135,7 +4171,11 @@ const getActivePreviewEditorUid = state => {
4135
4171
  const {
4136
4172
  layout
4137
4173
  } = state;
4138
- const activeGroup = layout.activeGroupId === undefined ? layout.groups.find(group => group.focused) : layout.groups.find(group => group.id === layout.activeGroupId);
4174
+ const {
4175
+ activeGroupId,
4176
+ groups
4177
+ } = layout;
4178
+ const activeGroup = activeGroupId === undefined ? groups.find(group => group.focused) : groups.find(group => group.id === activeGroupId);
4139
4179
  const activeTab = activeGroup?.tabs.find(tab => tab.id === activeGroup.activeTabId);
4140
4180
  return activeTab?.isPreview ? activeTab.editorUid : -1;
4141
4181
  };
@@ -4351,11 +4391,14 @@ const createNextState = (state, activeGroupId, groups) => {
4351
4391
  const {
4352
4392
  layout
4353
4393
  } = state;
4394
+ const {
4395
+ direction
4396
+ } = layout;
4354
4397
  return {
4355
4398
  ...state,
4356
4399
  layout: {
4357
4400
  activeGroupId,
4358
- direction: layout.direction,
4401
+ direction,
4359
4402
  groups
4360
4403
  }
4361
4404
  };
@@ -4458,6 +4501,7 @@ const splitEditorGroup$1 = (state, groupId, direction) => {
4458
4501
  layout
4459
4502
  } = state;
4460
4503
  const {
4504
+ direction: layoutDirection,
4461
4505
  groups
4462
4506
  } = layout;
4463
4507
  const sourceGroup = groups.find(group => group.id === groupId);
@@ -4480,12 +4524,12 @@ const splitEditorGroup$1 = (state, groupId, direction) => {
4480
4524
  if (sourceGroup.direction === splitLayoutDirection) {
4481
4525
  return splitWithinMatchingNestedDirection(state, groups, sourceGroup, groupId, newGroupId, direction, splitLayoutDirection, baseNewGroup);
4482
4526
  }
4483
- if (splitLayoutDirection !== layout.direction && sourceGroup.direction === undefined) {
4527
+ if (splitLayoutDirection !== layoutDirection && sourceGroup.direction === undefined) {
4484
4528
  return splitStandaloneSourceIntoNestedDirection(state, groups, sourceGroup, groupId, newGroupId, direction, splitLayoutDirection, baseNewGroup);
4485
4529
  }
4486
- const segments = getGroupSegments(groups, layout.direction);
4530
+ const segments = getGroupSegments(groups, layoutDirection);
4487
4531
  const hasNestedSegments = segments.some(segment => segment.direction !== undefined);
4488
- if (splitLayoutDirection === layout.direction && !hasNestedSegments) {
4532
+ if (splitLayoutDirection === layoutDirection && !hasNestedSegments) {
4489
4533
  return splitAtRootLevel(state, groups, groupId, newGroupId, direction, baseNewGroup);
4490
4534
  }
4491
4535
  return createNextState(state, newGroupId, groups);
@@ -4600,12 +4644,15 @@ const handleDoubleClick = (state, groupIndexRaw, indexRaw) => {
4600
4644
  const {
4601
4645
  layout
4602
4646
  } = state;
4647
+ const {
4648
+ groups
4649
+ } = layout;
4603
4650
  if (!groupIndexRaw || !indexRaw) {
4604
4651
  return state;
4605
4652
  }
4606
4653
  const groupIndex = Number.parseInt(groupIndexRaw);
4607
4654
  const tabIndex = Number.parseInt(indexRaw);
4608
- const tab = layout.groups[groupIndex]?.tabs[tabIndex];
4655
+ const tab = groups[groupIndex]?.tabs[tabIndex];
4609
4656
  if (!tab?.isPreview) {
4610
4657
  return state;
4611
4658
  }
@@ -4633,23 +4680,6 @@ const Down = 2;
4633
4680
  const Left = 3;
4634
4681
  const Right = 4;
4635
4682
 
4636
- const getSplitDirection = (x, y, width, height) => {
4637
- const percentX = x / width;
4638
- if (percentX < 0.25) {
4639
- return Left;
4640
- }
4641
- if (percentX > 0.75) {
4642
- return Right;
4643
- }
4644
- const percentY = y / height;
4645
- if (percentY < 0.25) {
4646
- return Up;
4647
- }
4648
- if (percentY > 0.75) {
4649
- return Down;
4650
- }
4651
- return None;
4652
- };
4653
4683
  const getOverlay = (x, y, width, height, splitDirection) => {
4654
4684
  const halfHeight = height / 2;
4655
4685
  const halfWidth = width / 2;
@@ -4691,6 +4721,25 @@ const getOverlay = (x, y, width, height, splitDirection) => {
4691
4721
  };
4692
4722
  }
4693
4723
  };
4724
+
4725
+ const getSplitDirection = (x, y, width, height) => {
4726
+ const percentX = x / width;
4727
+ if (percentX < 0.25) {
4728
+ return Left;
4729
+ }
4730
+ if (percentX > 0.75) {
4731
+ return Right;
4732
+ }
4733
+ const percentY = y / height;
4734
+ if (percentY < 0.25) {
4735
+ return Up;
4736
+ }
4737
+ if (percentY > 0.75) {
4738
+ return Down;
4739
+ }
4740
+ return None;
4741
+ };
4742
+
4694
4743
  const getDragOverlay = (state, eventX, eventY) => {
4695
4744
  const {
4696
4745
  height,
@@ -4700,7 +4749,10 @@ const getDragOverlay = (state, eventX, eventY) => {
4700
4749
  x,
4701
4750
  y
4702
4751
  } = state;
4703
- const hasOpenEditor = layout.groups.some(group => !group.isEmpty);
4752
+ const {
4753
+ groups
4754
+ } = layout;
4755
+ const hasOpenEditor = groups.some(group => !group.isEmpty);
4704
4756
  const contentY = hasOpenEditor ? tabHeight : 0;
4705
4757
  const contentHeight = Math.max(0, height - contentY);
4706
4758
  const relativeX = eventX - x;
@@ -4726,6 +4778,37 @@ const handleDragOver = (state, eventX, eventY) => {
4726
4778
  };
4727
4779
  };
4728
4780
 
4781
+ const lineSeparatorRegex = /\r?\n/;
4782
+ const isUriList = item => {
4783
+ if (!item || typeof item !== 'object') {
4784
+ return false;
4785
+ }
4786
+ const candidate = item;
4787
+ return candidate.kind === 'string' && candidate.type === 'text/uri-list' && typeof candidate.value === 'string';
4788
+ };
4789
+ const parseUriList = value => {
4790
+ return value.split(lineSeparatorRegex).map(uri => uri.trim()).filter(uri => uri && !uri.startsWith('#'));
4791
+ };
4792
+ const getDroppedUris = async itemIds => {
4793
+ if (itemIds.length === 0) {
4794
+ return [];
4795
+ }
4796
+ const items = await getFileHandles(itemIds);
4797
+ return items.filter(isUriList).flatMap(item => parseUriList(item.value));
4798
+ };
4799
+
4800
+ const openUrisWithContext = async (context, uris) => {
4801
+ for (const uri of uris) {
4802
+ await openUriWithContext(context, uri);
4803
+ }
4804
+ };
4805
+
4806
+ const handleDrop = async (context, itemIds) => {
4807
+ await context.updateState(handleDragLeave);
4808
+ const uris = await getDroppedUris(itemIds);
4809
+ await openUrisWithContext(context, uris);
4810
+ };
4811
+
4729
4812
  const EditorGroupHeader = 'EditorGroupHeader';
4730
4813
  const EmptyGroupHeader = 'EmptyGroupHeader';
4731
4814
  const EmptyGroupCloseButton = 'EmptyGroupCloseButton';
@@ -4879,8 +4962,11 @@ const handleHeaderDoubleClick = async (state, className, groupIndexRaw) => {
4879
4962
  };
4880
4963
 
4881
4964
  const getAllTabs = layout => {
4965
+ const {
4966
+ groups
4967
+ } = layout;
4882
4968
  const allTabs = [];
4883
- for (const group of layout.groups) {
4969
+ for (const group of groups) {
4884
4970
  allTabs.push(...group.tabs);
4885
4971
  }
4886
4972
  return allTabs;
@@ -4891,6 +4977,9 @@ const loadFileIcons = async state => {
4891
4977
  fileIconCache,
4892
4978
  layout
4893
4979
  } = state;
4980
+ const {
4981
+ groups
4982
+ } = layout;
4894
4983
  try {
4895
4984
  const allTabs = getAllTabs(layout);
4896
4985
  const {
@@ -4900,7 +4989,7 @@ const loadFileIcons = async state => {
4900
4989
  // Update tabs with their icons
4901
4990
  const updatedLayout = {
4902
4991
  ...layout,
4903
- groups: layout.groups.map(group => ({
4992
+ groups: groups.map(group => ({
4904
4993
  ...group,
4905
4994
  tabs: group.tabs.map(tab => ({
4906
4995
  ...tab,
@@ -5013,7 +5102,11 @@ const offsetsMatch = (first, second) => {
5013
5102
  return Math.abs(first - second) < 1e-6;
5014
5103
  };
5015
5104
  const getSashCorner = layout => {
5016
- const segments = getGroupSegments(layout.groups, layout.direction);
5105
+ const {
5106
+ direction,
5107
+ groups
5108
+ } = layout;
5109
+ const segments = getGroupSegments(groups, direction);
5017
5110
  if (segments.length !== 2) {
5018
5111
  return undefined;
5019
5112
  }
@@ -5033,7 +5126,7 @@ const getSashCorner = layout => {
5033
5126
  return undefined;
5034
5127
  }
5035
5128
  const rootOffset = firstSegmentSize / totalSize * 100;
5036
- if (layout.direction === Horizontal) {
5129
+ if (direction === Horizontal) {
5037
5130
  return {
5038
5131
  leftOffset: rootOffset,
5039
5132
  topOffset: firstNestedOffset,
@@ -5057,6 +5150,9 @@ const handleSashCornerPointerDown = async (state, clientX, clientY) => {
5057
5150
  const {
5058
5151
  layout
5059
5152
  } = state;
5153
+ const {
5154
+ groups
5155
+ } = layout;
5060
5156
  if (!Number.isFinite(clientX) || !Number.isFinite(clientY)) {
5061
5157
  return state;
5062
5158
  }
@@ -5067,7 +5163,7 @@ const handleSashCornerPointerDown = async (state, clientX, clientY) => {
5067
5163
  return {
5068
5164
  ...state,
5069
5165
  sashCornerDrag: {
5070
- groupSizes: layout.groups.map(group => ({
5166
+ groupSizes: groups.map(group => ({
5071
5167
  id: group.id,
5072
5168
  size: group.size
5073
5169
  })),
@@ -5116,6 +5212,9 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
5116
5212
  sashCornerDrag,
5117
5213
  width
5118
5214
  } = state;
5215
+ const {
5216
+ groups
5217
+ } = layout;
5119
5218
  if (!sashCornerDrag || !width || !height || !Number.isFinite(clientX) || !Number.isFinite(clientY)) {
5120
5219
  return state;
5121
5220
  }
@@ -5142,7 +5241,7 @@ const handleSashCornerPointerMove = async (state, clientX, clientY) => {
5142
5241
  ...state,
5143
5242
  layout: {
5144
5243
  ...layout,
5145
- groups: layout.groups.map(group => {
5244
+ groups: groups.map(group => {
5146
5245
  const xSize = xBeforeGroupIdSet.has(group.id) ? xBeforeSize : xAfterSize;
5147
5246
  const ySize = yBeforeGroupIdSet.has(group.id) ? yBeforeSize : yAfterSize;
5148
5247
  return {
@@ -5472,9 +5571,12 @@ const tryRestoreLayout = savedState => {
5472
5571
  };
5473
5572
 
5474
5573
  const createViewlets = async (layout, viewletModuleIds, bounds) => {
5574
+ const {
5575
+ groups
5576
+ } = layout;
5475
5577
  const editorUids = {};
5476
5578
  const titles = {};
5477
- for (const group of layout.groups) {
5579
+ for (const group of groups) {
5478
5580
  const activeTab = group.tabs.find(tab => tab.id === group.activeTabId);
5479
5581
  if (activeTab && viewletModuleIds[activeTab.id]) {
5480
5582
  const editorUid = activeTab.editorUid === -1 ? create$2() : activeTab.editorUid;
@@ -5492,8 +5594,11 @@ const createViewlets = async (layout, viewletModuleIds, bounds) => {
5492
5594
  };
5493
5595
 
5494
5596
  const getViewletModuleIds = async layout => {
5597
+ const {
5598
+ groups
5599
+ } = layout;
5495
5600
  const viewletModuleIds = {};
5496
- for (const group of layout.groups) {
5601
+ for (const group of groups) {
5497
5602
  const {
5498
5603
  tabs
5499
5604
  } = group;
@@ -6063,12 +6168,6 @@ const newWindow = async state => {
6063
6168
  return state;
6064
6169
  };
6065
6170
 
6066
- const openUrisWithContext = async (context, uris) => {
6067
- for (const uri of uris) {
6068
- await openUriWithContext(context, uri);
6069
- }
6070
- };
6071
-
6072
6171
  const refresh = state => {
6073
6172
  return {
6074
6173
  ...state
@@ -6094,8 +6193,12 @@ const getDragOverlayCss = dragOverlay => {
6094
6193
  };
6095
6194
 
6096
6195
  const getEditorGroupCss = layout => {
6097
- const groupSizeVariable = layout.direction === Vertical ? '--EditorGroupHeight' : '--EditorGroupWidth';
6098
- return layout.groups.map(group => {
6196
+ const {
6197
+ direction,
6198
+ groups
6199
+ } = layout;
6200
+ const groupSizeVariable = direction === Vertical ? '--EditorGroupHeight' : '--EditorGroupWidth';
6201
+ return groups.map(group => {
6099
6202
  return `.EditorGroup[data-groupId="${group.id}"] {
6100
6203
  ${groupSizeVariable}: ${group.size}%;
6101
6204
  }`;
@@ -6138,7 +6241,11 @@ const renderSashCss = ({
6138
6241
  }`;
6139
6242
  };
6140
6243
  const getProtoSashCss = (layout, width) => {
6141
- const segments = getGroupSegments(layout.groups, layout.direction);
6244
+ const {
6245
+ direction,
6246
+ groups
6247
+ } = layout;
6248
+ const segments = getGroupSegments(groups, direction);
6142
6249
  const hasNestedSegments = segments.some(segment => segment.direction !== undefined);
6143
6250
  const rules = [];
6144
6251
  let segmentOffset = 0;
@@ -6147,9 +6254,9 @@ const getProtoSashCss = (layout, width) => {
6147
6254
  const beforeGroupId = segments[i - 1].groups.at(-1)?.id || 0;
6148
6255
  const afterGroupId = segments[i].groups[0].id;
6149
6256
  const sashId = create(beforeGroupId, afterGroupId);
6150
- const value = hasNestedSegments || layout.direction !== Horizontal || !width ? `${segmentOffset}%` : getSashOffset(layout, i, width);
6257
+ const value = hasNestedSegments || direction !== Horizontal || !width ? `${segmentOffset}%` : getSashOffset(layout, i, width);
6151
6258
  rules.push({
6152
- property: toSashProperty(layout.direction),
6259
+ property: toSashProperty(direction),
6153
6260
  sashId,
6154
6261
  value
6155
6262
  });
@@ -6176,58 +6283,17 @@ const getProtoSashCss = (layout, width) => {
6176
6283
  return rules;
6177
6284
  };
6178
6285
  const getSashCss = (layout, width = 0) => {
6179
- if (layout.groups.length <= 1) {
6286
+ const {
6287
+ groups
6288
+ } = layout;
6289
+ if (groups.length <= 1) {
6180
6290
  return [];
6181
6291
  }
6182
6292
  return getProtoSashCss(layout, width).map(renderSashCss);
6183
6293
  };
6184
6294
 
6185
6295
  const getCss = (layout, width = 0, dragOverlay) => {
6186
- const rules = [`.Main {
6187
- position: relative;
6188
- }`, `.editor-groups-container {
6189
- overflow: auto;
6190
- }`, `.DragOverlay {
6191
- position: absolute;
6192
- z-index: 1;
6193
- contain: strict;
6194
- pointer-events: none;
6195
- background: rgba(83, 89, 93, 0.5);
6196
- transition: all 100ms;
6197
- }`, `.SashBorder {
6198
- background: var(--SashBorder, gray);
6199
- }`, `.SashBorderHorizontal {
6200
- width: 100%;
6201
- height: 1px;
6202
- }`, `.SashBorderVertical {
6203
- width: 1px;
6204
- height: 100%;
6205
- }`, `.SashCorner {
6206
- position: absolute;
6207
- z-index: 2;
6208
- display: flex;
6209
- align-items: center;
6210
- justify-content: center;
6211
- width: 12px;
6212
- height: 12px;
6213
- padding: 0;
6214
- border: 0;
6215
- background: transparent;
6216
- cursor: all-scroll;
6217
- transform: translate(-50%, -50%);
6218
- }`, `.SashCorner::after {
6219
- content: '';
6220
- width: 4px;
6221
- height: 4px;
6222
- background: var(--SashBorder, gray);
6223
- }`, `.SashCorner:hover::after,
6224
- .SashCorner:active::after {
6225
- background: var(--SashHoverBorder, #3d5252);
6226
- }`, `.EditorGroup {
6227
- min-width: 250px;
6228
- width: var(--EditorGroupWidth, auto);
6229
- /*height: var(--EditorGroupHeight, auto);*/
6230
- }`];
6296
+ const rules = [];
6231
6297
  if (layout) {
6232
6298
  rules.push(...getEditorGroupCss(layout), ...getDragOverlayCss(dragOverlay), ...getSashCss(layout, width));
6233
6299
  const sashCorner = getSashCorner(layout);
@@ -6931,7 +6997,10 @@ const mainNode$1 = {
6931
6997
  type: Div
6932
6998
  };
6933
6999
  const renderSingleEditorGroup = (layout, splitButtonEnabled, sizeProperty = 'width') => {
6934
- return [mainNode$1, ...renderEditorGroup(layout.groups[0], 0, splitButtonEnabled, sizeProperty, false)];
7000
+ const {
7001
+ groups
7002
+ } = layout;
7003
+ return [mainNode$1, ...renderEditorGroup(groups[0], 0, splitButtonEnabled, sizeProperty, false)];
6935
7004
  };
6936
7005
 
6937
7006
  const getDirectionClassName = (direction, isSplit) => {
@@ -7182,7 +7251,7 @@ const renderEventListeners = () => {
7182
7251
  params: ['handleDragLeave']
7183
7252
  }, {
7184
7253
  name: HandleDrop,
7185
- params: ['handleDragLeave'],
7254
+ params: ['handleDrop', DataTransferFiles2],
7186
7255
  preventDefault: true
7187
7256
  }];
7188
7257
  };
@@ -7381,7 +7450,10 @@ const saveState = state => {
7381
7450
  const {
7382
7451
  layout
7383
7452
  } = state;
7384
- const filteredGroups = getFilteredGroups(layout.groups);
7453
+ const {
7454
+ groups
7455
+ } = layout;
7456
+ const filteredGroups = getFilteredGroups(groups);
7385
7457
 
7386
7458
  // Update activeGroupId if it points to a removed group
7387
7459
  const {
@@ -7459,9 +7531,13 @@ const setEditorLayout = (state, direction, slots) => {
7459
7531
  const {
7460
7532
  layout
7461
7533
  } = state;
7462
- const groups = getGroupsForSlotCount(layout.groups, slots.length, layout.activeGroupId);
7463
- const originalActiveIndex = layout.groups.findIndex(group => group.id === layout.activeGroupId);
7464
- const activeIndex = originalActiveIndex >= slots.length ? slots.length - 1 : getActiveGroupIndex(groups, layout.activeGroupId);
7534
+ const {
7535
+ activeGroupId,
7536
+ groups: currentGroups
7537
+ } = layout;
7538
+ const groups = getGroupsForSlotCount(currentGroups, slots.length, activeGroupId);
7539
+ const originalActiveIndex = currentGroups.findIndex(group => group.id === activeGroupId);
7540
+ const activeIndex = originalActiveIndex >= slots.length ? slots.length - 1 : getActiveGroupIndex(groups, activeGroupId);
7465
7541
  const nextGroups = groups.map((group, index) => {
7466
7542
  const slot = slots[index];
7467
7543
  const focused = index === activeIndex;
@@ -7486,12 +7562,16 @@ const flipLayout = state => {
7486
7562
  const {
7487
7563
  layout
7488
7564
  } = state;
7565
+ const {
7566
+ direction,
7567
+ groups
7568
+ } = layout;
7489
7569
  return {
7490
7570
  ...state,
7491
7571
  layout: {
7492
7572
  ...layout,
7493
- direction: flipDirection(layout.direction),
7494
- groups: layout.groups.map(group => ({
7573
+ direction: flipDirection(direction),
7574
+ groups: groups.map(group => ({
7495
7575
  ...group,
7496
7576
  direction: group.direction === undefined ? undefined : flipDirection(group.direction)
7497
7577
  }))
@@ -7590,6 +7670,7 @@ const splitDown = (state, groupId) => {
7590
7670
  layout
7591
7671
  } = state;
7592
7672
  const {
7673
+ activeGroupId,
7593
7674
  groups
7594
7675
  } = layout;
7595
7676
 
@@ -7614,7 +7695,7 @@ const splitDown = (state, groupId) => {
7614
7695
  };
7615
7696
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'down');
7616
7697
  }
7617
- const resolvedGroupId = groupId ?? layout.activeGroupId;
7698
+ const resolvedGroupId = groupId ?? activeGroupId;
7618
7699
  if (!resolvedGroupId) {
7619
7700
  return state;
7620
7701
  }
@@ -7692,6 +7773,7 @@ const splitUp = (state, groupId) => {
7692
7773
  layout
7693
7774
  } = state;
7694
7775
  const {
7776
+ activeGroupId,
7695
7777
  groups
7696
7778
  } = layout;
7697
7779
  if (groups.length === 0) {
@@ -7714,7 +7796,7 @@ const splitUp = (state, groupId) => {
7714
7796
  };
7715
7797
  return splitEditorGroup$1(stateWithInitialGroup, initialGroupId, 'up');
7716
7798
  }
7717
- const resolvedGroupId = groupId ?? layout.activeGroupId;
7799
+ const resolvedGroupId = groupId ?? activeGroupId;
7718
7800
  if (!resolvedGroupId) {
7719
7801
  return state;
7720
7802
  }
@@ -7803,6 +7885,7 @@ const commandMap = {
7803
7885
  'MainArea.handleDoubleClick': wrapSerialCommand(handleDoubleClick),
7804
7886
  'MainArea.handleDragLeave': wrapSerialCommand(handleDragLeave),
7805
7887
  'MainArea.handleDragOver': wrapSerialCommand(handleDragOver),
7888
+ 'MainArea.handleDrop': wrapSerialAsyncCommand(handleDrop),
7806
7889
  'MainArea.handleHeaderDoubleClick': wrapSerialCommand(handleHeaderDoubleClick),
7807
7890
  'MainArea.handleIconThemeChange': wrapSerialCommand(handleIconThemeChange),
7808
7891
  '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.33.0",
3
+ "version": "9.33.2",
4
4
  "description": "Main Area Worker",
5
5
  "repository": {
6
6
  "type": "git",