@lvce-editor/explorer-view 5.1.0 → 5.2.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.
- package/dist/explorerViewWorkerMain.js +36 -20
- package/package.json +1 -1
|
@@ -2340,6 +2340,25 @@ const None$4 = 0;
|
|
|
2340
2340
|
const Right = 1;
|
|
2341
2341
|
const Down = 2;
|
|
2342
2342
|
|
|
2343
|
+
const ensureUri = item => {
|
|
2344
|
+
if (item.startsWith('/')) {
|
|
2345
|
+
return `file://` + item;
|
|
2346
|
+
}
|
|
2347
|
+
return item;
|
|
2348
|
+
};
|
|
2349
|
+
const ensureUris = maybeUris => {
|
|
2350
|
+
return maybeUris.map(ensureUri);
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
const createDecorationMap = decorations => {
|
|
2354
|
+
const map = Object.create(null);
|
|
2355
|
+
for (const decoration of decorations) {
|
|
2356
|
+
const uri = ensureUri(decoration.uri);
|
|
2357
|
+
map[uri] = decoration.decoration;
|
|
2358
|
+
}
|
|
2359
|
+
return map;
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2343
2362
|
const getChevronType = (type, useChevrons) => {
|
|
2344
2363
|
if (!useChevrons) {
|
|
2345
2364
|
return None$4;
|
|
@@ -2430,7 +2449,7 @@ const text = data => {
|
|
|
2430
2449
|
};
|
|
2431
2450
|
};
|
|
2432
2451
|
|
|
2433
|
-
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, indent) => {
|
|
2452
|
+
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, indent, decoration) => {
|
|
2434
2453
|
let className = TreeItem$1;
|
|
2435
2454
|
className = mergeClassNames(className, `Indent-${indent}`);
|
|
2436
2455
|
if (isSelected || isFocused) {
|
|
@@ -2439,6 +2458,9 @@ const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, in
|
|
|
2439
2458
|
if (isDropping) {
|
|
2440
2459
|
className = mergeClassNames(className, 'DropTarget');
|
|
2441
2460
|
}
|
|
2461
|
+
if (decoration) {
|
|
2462
|
+
className = mergeClassNames(className, `decoration-${decoration}`);
|
|
2463
|
+
}
|
|
2442
2464
|
return className;
|
|
2443
2465
|
};
|
|
2444
2466
|
|
|
@@ -2470,7 +2492,8 @@ const getEditingChevron = direntType => {
|
|
|
2470
2492
|
return None$4;
|
|
2471
2493
|
}
|
|
2472
2494
|
};
|
|
2473
|
-
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = []) => {
|
|
2495
|
+
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris = [], decorations) => {
|
|
2496
|
+
const decorationMap = createDecorationMap(decorations);
|
|
2474
2497
|
const visible = [];
|
|
2475
2498
|
const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
|
|
2476
2499
|
let iconIndex = 0;
|
|
@@ -2484,7 +2507,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2484
2507
|
const isDropping = dropTargets.includes(i);
|
|
2485
2508
|
const isIgnored = sourceControlIgnoredUris.includes(item.path);
|
|
2486
2509
|
const indent = indentFn(item.depth, chevron);
|
|
2487
|
-
const
|
|
2510
|
+
const decoration = decorationMap[item.path] || '';
|
|
2511
|
+
const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, indent, decoration);
|
|
2488
2512
|
const expanded = getExpandedType(item.type);
|
|
2489
2513
|
const ariaExpanded = ariaExpandedValues[expanded];
|
|
2490
2514
|
const isEditing = i === editingIndex;
|
|
@@ -2507,7 +2531,9 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2507
2531
|
className,
|
|
2508
2532
|
isCut,
|
|
2509
2533
|
isIgnored,
|
|
2510
|
-
index: i
|
|
2534
|
+
index: i,
|
|
2535
|
+
// @ts-ignore
|
|
2536
|
+
decoration
|
|
2511
2537
|
});
|
|
2512
2538
|
}
|
|
2513
2539
|
return visible;
|
|
@@ -2539,12 +2565,13 @@ const wrapListItemCommand = fn => {
|
|
|
2539
2565
|
sourceControlIgnoredUris,
|
|
2540
2566
|
height,
|
|
2541
2567
|
itemHeight,
|
|
2542
|
-
fileIconCache
|
|
2568
|
+
fileIconCache,
|
|
2569
|
+
decorations
|
|
2543
2570
|
} = updatedState;
|
|
2544
2571
|
const intermediate = get(id);
|
|
2545
2572
|
set(id, intermediate.oldState, updatedState);
|
|
2546
2573
|
const maxLineY = getExplorerMaxLineY(minLineY, height, itemHeight, items.length);
|
|
2547
|
-
if (items === intermediate.newState.items && minLineY === intermediate.newState.minLineY && editingIcon === intermediate.newState.editingIcon && cutItems === intermediate.newState.cutItems && editingErrorMessage === intermediate.newState.editingErrorMessage && dropTargets === intermediate.newState.dropTargets && fileIconCache === intermediate.newState.fileIconCache) {
|
|
2574
|
+
if (items === intermediate.newState.items && minLineY === intermediate.newState.minLineY && editingIcon === intermediate.newState.editingIcon && cutItems === intermediate.newState.cutItems && editingErrorMessage === intermediate.newState.editingErrorMessage && dropTargets === intermediate.newState.dropTargets && fileIconCache === intermediate.newState.fileIconCache && decorations === intermediate.newState.decorations) {
|
|
2548
2575
|
return;
|
|
2549
2576
|
}
|
|
2550
2577
|
const visible = items.slice(minLineY, maxLineY);
|
|
@@ -2552,7 +2579,7 @@ const wrapListItemCommand = fn => {
|
|
|
2552
2579
|
icons,
|
|
2553
2580
|
newFileIconCache
|
|
2554
2581
|
} = await getFileIcons(visible, fileIconCache);
|
|
2555
|
-
const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris);
|
|
2582
|
+
const visibleExplorerItems = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems, sourceControlIgnoredUris, decorations);
|
|
2556
2583
|
const finalState = {
|
|
2557
2584
|
...updatedState,
|
|
2558
2585
|
visibleExplorerItems,
|
|
@@ -2622,7 +2649,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2622
2649
|
errorMessageLeft: 0,
|
|
2623
2650
|
errorMessageTop: 0,
|
|
2624
2651
|
visibleExplorerItems: [],
|
|
2625
|
-
errorMessageWidth: 0
|
|
2652
|
+
errorMessageWidth: 0,
|
|
2653
|
+
decorations: []
|
|
2626
2654
|
};
|
|
2627
2655
|
set(state.uid, state, state);
|
|
2628
2656
|
return state;
|
|
@@ -4609,17 +4637,6 @@ const getWorkspacePath = () => {
|
|
|
4609
4637
|
|
|
4610
4638
|
const DecorationsEnabled = false;
|
|
4611
4639
|
|
|
4612
|
-
const ensureUris = maybeUris => {
|
|
4613
|
-
const uris = [];
|
|
4614
|
-
for (const item of maybeUris) {
|
|
4615
|
-
if (item.startsWith('/')) {
|
|
4616
|
-
uris.push(`file://` + item);
|
|
4617
|
-
} else {
|
|
4618
|
-
uris.push(item);
|
|
4619
|
-
}
|
|
4620
|
-
}
|
|
4621
|
-
return uris;
|
|
4622
|
-
};
|
|
4623
4640
|
const getFileDecorations = async (scheme, root, maybeUris) => {
|
|
4624
4641
|
try {
|
|
4625
4642
|
if (!DecorationsEnabled) {
|
|
@@ -4630,7 +4647,6 @@ const getFileDecorations = async (scheme, root, maybeUris) => {
|
|
|
4630
4647
|
return [];
|
|
4631
4648
|
}
|
|
4632
4649
|
const providerId = providerIds[0];
|
|
4633
|
-
// @ts-ignore
|
|
4634
4650
|
const uris = ensureUris(maybeUris);
|
|
4635
4651
|
const decorations = await invoke$1('SourceControl.getFileDecorations', providerId, uris);
|
|
4636
4652
|
return decorations;
|