@lvce-editor/explorer-view 3.27.0 → 4.0.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 +39 -21
- package/package.json +1 -1
|
@@ -2730,9 +2730,9 @@ const text = data => {
|
|
|
2730
2730
|
};
|
|
2731
2731
|
};
|
|
2732
2732
|
|
|
2733
|
-
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons,
|
|
2733
|
+
const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, indent) => {
|
|
2734
2734
|
let className = TreeItem$1;
|
|
2735
|
-
className = mergeClassNames(className, `Indent-${
|
|
2735
|
+
className = mergeClassNames(className, `Indent-${indent}`);
|
|
2736
2736
|
if (isSelected || isFocused) {
|
|
2737
2737
|
className = mergeClassNames(className, TreeItemActive);
|
|
2738
2738
|
}
|
|
@@ -2742,9 +2742,9 @@ const getTreeItemClassName = (isSelected, isFocused, isDropping, useChevrons, de
|
|
|
2742
2742
|
return className;
|
|
2743
2743
|
};
|
|
2744
2744
|
|
|
2745
|
-
const defaultIndent$1 =
|
|
2745
|
+
const defaultIndent$1 = 12;
|
|
2746
2746
|
const getTreeItemIndent = depth => {
|
|
2747
|
-
return
|
|
2747
|
+
return depth * defaultIndent$1;
|
|
2748
2748
|
};
|
|
2749
2749
|
|
|
2750
2750
|
// TODO make all of these variable configurable
|
|
@@ -2756,7 +2756,7 @@ const chevronSize = 22;
|
|
|
2756
2756
|
const getTreeItemIndentWithChevron = (depth, chevron) => {
|
|
2757
2757
|
// TODO use numeric value here, convert to string value in renderer process
|
|
2758
2758
|
const extraSpace = chevron ? 0 : chevronSize;
|
|
2759
|
-
return
|
|
2759
|
+
return depth * defaultIndent + extraSpace + defaultPaddingLeft;
|
|
2760
2760
|
};
|
|
2761
2761
|
|
|
2762
2762
|
const ariaExpandedValues = [undefined, 'true', 'false'];
|
|
@@ -2783,7 +2783,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2783
2783
|
const isCut = cutItems.includes(item.path);
|
|
2784
2784
|
const isDropping = dropTargets.includes(i);
|
|
2785
2785
|
const isIgnored = sourceControlIgnoredUris.includes(item.path);
|
|
2786
|
-
const
|
|
2786
|
+
const indent = indentFn(item.depth, chevron);
|
|
2787
|
+
const className = getTreeItemClassName(isSelected, isFocused, isDropping, useChevrons, indent);
|
|
2787
2788
|
const expanded = getExpandedType(item.type);
|
|
2788
2789
|
const ariaExpanded = ariaExpandedValues[expanded];
|
|
2789
2790
|
const isEditing = i === editingIndex;
|
|
@@ -2792,7 +2793,6 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
2792
2793
|
icon = editingIcon;
|
|
2793
2794
|
chevron = getEditingChevron(item.type);
|
|
2794
2795
|
}
|
|
2795
|
-
const indent = indentFn(item.depth, chevron);
|
|
2796
2796
|
visible.push({
|
|
2797
2797
|
...item,
|
|
2798
2798
|
posInSet: item.posInSet ?? i + 1,
|
|
@@ -2986,7 +2986,10 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2986
2986
|
};
|
|
2987
2987
|
|
|
2988
2988
|
const isEqual$6 = (oldState, newState) => {
|
|
2989
|
-
|
|
2989
|
+
// TODO compute css more optimized
|
|
2990
|
+
// maybe only when items change, and even then not
|
|
2991
|
+
// always, but only when it affects the css
|
|
2992
|
+
return oldState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarActive === newState.scrollBarActive && oldState.maxIndent === newState.maxIndent && oldState.visibleExplorerItems === newState.visibleExplorerItems;
|
|
2990
2993
|
};
|
|
2991
2994
|
|
|
2992
2995
|
const isEqual$5 = (oldState, newState) => {
|
|
@@ -5417,22 +5420,39 @@ const renameDirent = async state => {
|
|
|
5417
5420
|
};
|
|
5418
5421
|
};
|
|
5419
5422
|
|
|
5420
|
-
const
|
|
5421
|
-
|
|
5422
|
-
scrollBarHeight,
|
|
5423
|
-
uid,
|
|
5424
|
-
maxIndent
|
|
5425
|
-
} = newState;
|
|
5423
|
+
const getCss = (scrollBarHeight, uniqueIndents) => {
|
|
5424
|
+
// TODO each visible item should have an indent property
|
|
5426
5425
|
const rules = [`.Explorer {
|
|
5427
5426
|
--ScrollBarThumbHeight: ${scrollBarHeight}px;
|
|
5428
|
-
`];
|
|
5429
|
-
for (
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
padding-left: ${indent};
|
|
5427
|
+
}`];
|
|
5428
|
+
for (const item of uniqueIndents) {
|
|
5429
|
+
rules.push(`.Indent-${item} {
|
|
5430
|
+
padding-left: ${item}px;
|
|
5433
5431
|
}`);
|
|
5434
5432
|
}
|
|
5435
5433
|
const css = rules.join('\n');
|
|
5434
|
+
return css;
|
|
5435
|
+
};
|
|
5436
|
+
|
|
5437
|
+
const getUnique = items => {
|
|
5438
|
+
const seens = [];
|
|
5439
|
+
for (const item of items) {
|
|
5440
|
+
if (!seens.includes(item)) {
|
|
5441
|
+
seens.push(item);
|
|
5442
|
+
}
|
|
5443
|
+
}
|
|
5444
|
+
return seens;
|
|
5445
|
+
};
|
|
5446
|
+
|
|
5447
|
+
const renderCss = (oldState, newState) => {
|
|
5448
|
+
const {
|
|
5449
|
+
scrollBarHeight,
|
|
5450
|
+
uid,
|
|
5451
|
+
visibleExplorerItems
|
|
5452
|
+
} = newState;
|
|
5453
|
+
const indents = visibleExplorerItems.map(item => item.indent);
|
|
5454
|
+
const uniqueIndents = getUnique(indents);
|
|
5455
|
+
const css = getCss(scrollBarHeight, uniqueIndents);
|
|
5436
5456
|
return [SetCss, uid, css];
|
|
5437
5457
|
};
|
|
5438
5458
|
|
|
@@ -5666,7 +5686,6 @@ const getExplorerItemVirtualDom = item => {
|
|
|
5666
5686
|
hasEditingError,
|
|
5667
5687
|
icon,
|
|
5668
5688
|
id,
|
|
5669
|
-
indent,
|
|
5670
5689
|
isEditing,
|
|
5671
5690
|
name,
|
|
5672
5691
|
path,
|
|
@@ -5687,7 +5706,6 @@ const getExplorerItemVirtualDom = item => {
|
|
|
5687
5706
|
ariaSetSize: setSize,
|
|
5688
5707
|
ariaLevel: depth,
|
|
5689
5708
|
childCount: 2 + chevronDom.length,
|
|
5690
|
-
paddingLeft: indent,
|
|
5691
5709
|
ariaLabel: name,
|
|
5692
5710
|
ariaExpanded,
|
|
5693
5711
|
ariaDescription: '',
|