@lvce-editor/explorer-view 7.23.2 → 7.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3030,7 +3030,7 @@ const getFileIcons = async (dirents, fileIconCache) => {
3030
3030
  };
3031
3031
  };
3032
3032
 
3033
- const directoryTypes$2 = new Set([DirectoryExpanded, DirectoryExpanding, EditingDirectoryExpanded]);
3033
+ const directoryTypes$3 = new Set([DirectoryExpanded, DirectoryExpanding, EditingDirectoryExpanded]);
3034
3034
  const getParentPath = (path, pathSeparator) => {
3035
3035
  const index = path.lastIndexOf(pathSeparator);
3036
3036
  if (index === -1) {
@@ -3041,7 +3041,7 @@ const getParentPath = (path, pathSeparator) => {
3041
3041
  const getGitIgnoreCandidateDirs = (root, items, pathSeparator) => {
3042
3042
  const dirs = new Set([root]);
3043
3043
  for (const item of items) {
3044
- if (directoryTypes$2.has(item.type)) {
3044
+ if (directoryTypes$3.has(item.type)) {
3045
3045
  dirs.add(item.path);
3046
3046
  }
3047
3047
  const parent = getParentPath(item.path, pathSeparator);
@@ -6098,9 +6098,9 @@ const handleDrop$1 = async (state, fileHandles, files, paths) => {
6098
6098
  };
6099
6099
  };
6100
6100
 
6101
- const directoryTypes$1 = [Directory, DirectoryExpanded, DirectoryExpanding];
6101
+ const directoryTypes$2 = [Directory, DirectoryExpanded, DirectoryExpanding];
6102
6102
  const isDirectory = item => {
6103
- return directoryTypes$1.includes(item.type);
6103
+ return directoryTypes$2.includes(item.type);
6104
6104
  };
6105
6105
  const isDescendant = (path, parentPath, pathSeparator) => {
6106
6106
  const prefix = parentPath.endsWith(pathSeparator) ? parentPath : `${parentPath}${pathSeparator}`;
@@ -6326,11 +6326,20 @@ const getDroppedItems = async (itemIds, isElectron) => {
6326
6326
  };
6327
6327
  };
6328
6328
 
6329
+ const directoryTypes$1 = new Set([Directory, DirectoryExpanded, DirectoryExpanding, EditingDirectoryExpanded, EditingFolder, SymLinkFolder]);
6330
+ const getDragUri = item => {
6331
+ const uri = ensureUri(item.path);
6332
+ if (directoryTypes$1.has(item.type) && !uri.endsWith('/')) {
6333
+ return `${uri}/`;
6334
+ }
6335
+ return uri;
6336
+ };
6337
+
6329
6338
  const getInternalDragPaths = (items, uris) => {
6330
6339
  if (uris.length === 0) {
6331
6340
  return [];
6332
6341
  }
6333
- const pathByUri = new Map(items.map(item => [ensureUri(item.path), item.path]));
6342
+ const pathByUri = new Map(items.map(item => [getDragUri(item), item.path]));
6334
6343
  const paths = [];
6335
6344
  for (const uri of uris) {
6336
6345
  const path = pathByUri.get(uri);
@@ -6514,9 +6523,19 @@ const set = rpc => {
6514
6523
  state.connected = true;
6515
6524
  };
6516
6525
 
6517
- const handleMessagePort = async port => {
6526
+ const handleMessagePort = async (port, viewletCommandMap) => {
6527
+ const executeViewletCommand = async (uid, command, ...args) => {
6528
+ const fn = viewletCommandMap[`Explorer.${command}`];
6529
+ if (typeof fn !== 'function') {
6530
+ throw new TypeError(`Viewlet command not found: ${command}`);
6531
+ }
6532
+ await fn(uid, ...args);
6533
+ await invoke$3('Viewlet.requestRender', uid);
6534
+ };
6518
6535
  const rpc = await create$6({
6519
- commandMap: {},
6536
+ commandMap: {
6537
+ 'Viewlet.executeViewletCommand': executeViewletCommand
6538
+ },
6520
6539
  messagePort: port
6521
6540
  });
6522
6541
  set(rpc);
@@ -7302,8 +7321,8 @@ const getDragLabel = urls => {
7302
7321
  return String(urls.length);
7303
7322
  };
7304
7323
 
7305
- const getDragData = urls => {
7306
- const data = urls.map(ensureUri).join('\n');
7324
+ const getDragData = items => {
7325
+ const data = items.map(getDragUri).join('\n');
7307
7326
  const dragData = [{
7308
7327
  data,
7309
7328
  type: 'text/uri-list'
@@ -7313,7 +7332,7 @@ const getDragData = urls => {
7313
7332
  }];
7314
7333
  return {
7315
7334
  items: dragData,
7316
- label: getDragLabel(urls)
7335
+ label: getDragLabel(items.map(item => item.path))
7317
7336
  };
7318
7337
  };
7319
7338
 
@@ -7337,7 +7356,7 @@ const renderDragData = (oldState, newState) => {
7337
7356
  } else {
7338
7357
  draggedItems = [];
7339
7358
  }
7340
- const dragData = getDragData(draggedItems.map(item => item.path));
7359
+ const dragData = getDragData(draggedItems);
7341
7360
  return ['Viewlet.setDragData', uid, dragData];
7342
7361
  };
7343
7362
 
@@ -8311,6 +8330,7 @@ const updateEditingValue = async (state, value, inputSource = User) => {
8311
8330
  };
8312
8331
  };
8313
8332
 
8333
+ const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
8314
8334
  const commandMap = {
8315
8335
  'Explorer.acceptEdit': wrapListItemCommand(acceptEdit),
8316
8336
  'Explorer.cancelEdit': wrapListItemCommand(cancelEdit),
@@ -8367,7 +8387,7 @@ const commandMap = {
8367
8387
  'Explorer.handleInputClick': wrapListItemCommand(handleInputClick),
8368
8388
  'Explorer.handleInputKeyDown': wrapListItemCommand(handleInputKeyDown),
8369
8389
  'Explorer.handleKeyDown': wrapListItemCommand(handleKeyDown),
8370
- 'Explorer.handleMessagePort': handleMessagePort,
8390
+ 'Explorer.handleMessagePort': handleDirectMessagePort,
8371
8391
  'Explorer.handleNativePaste': wrapListItemCommand(handleNativePaste),
8372
8392
  'Explorer.handlePaste': wrapListItemCommand(handlePaste),
8373
8393
  'Explorer.handlePointerDown': wrapListItemCommand(handlePointerDown),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/explorer-view",
3
- "version": "7.23.2",
3
+ "version": "7.24.0",
4
4
  "description": "Explorer Worker",
5
5
  "repository": {
6
6
  "type": "git",