@lvce-editor/explorer-view 2.57.0 → 2.59.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 +168 -99
- package/package.json +1 -1
|
@@ -60,49 +60,57 @@ class AssertionError extends Error {
|
|
|
60
60
|
this.name = 'AssertionError';
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
const Object$1 = 1;
|
|
64
|
+
const Number$1 = 2;
|
|
65
|
+
const Array$1 = 3;
|
|
66
|
+
const String = 4;
|
|
67
|
+
const Boolean$1 = 5;
|
|
68
|
+
const Function = 6;
|
|
69
|
+
const Null = 7;
|
|
70
|
+
const Unknown$1 = 8;
|
|
63
71
|
const getType = value => {
|
|
64
72
|
switch (typeof value) {
|
|
65
73
|
case 'number':
|
|
66
|
-
return
|
|
74
|
+
return Number$1;
|
|
67
75
|
case 'function':
|
|
68
|
-
return
|
|
76
|
+
return Function;
|
|
69
77
|
case 'string':
|
|
70
|
-
return
|
|
78
|
+
return String;
|
|
71
79
|
case 'object':
|
|
72
80
|
if (value === null) {
|
|
73
|
-
return
|
|
81
|
+
return Null;
|
|
74
82
|
}
|
|
75
83
|
if (Array.isArray(value)) {
|
|
76
|
-
return
|
|
84
|
+
return Array$1;
|
|
77
85
|
}
|
|
78
|
-
return
|
|
86
|
+
return Object$1;
|
|
79
87
|
case 'boolean':
|
|
80
|
-
return
|
|
88
|
+
return Boolean$1;
|
|
81
89
|
default:
|
|
82
|
-
return
|
|
90
|
+
return Unknown$1;
|
|
83
91
|
}
|
|
84
92
|
};
|
|
85
93
|
const object = value => {
|
|
86
94
|
const type = getType(value);
|
|
87
|
-
if (type !==
|
|
95
|
+
if (type !== Object$1) {
|
|
88
96
|
throw new AssertionError('expected value to be of type object');
|
|
89
97
|
}
|
|
90
98
|
};
|
|
91
99
|
const number = value => {
|
|
92
100
|
const type = getType(value);
|
|
93
|
-
if (type !==
|
|
101
|
+
if (type !== Number$1) {
|
|
94
102
|
throw new AssertionError('expected value to be of type number');
|
|
95
103
|
}
|
|
96
104
|
};
|
|
97
105
|
const array = value => {
|
|
98
106
|
const type = getType(value);
|
|
99
|
-
if (type !==
|
|
107
|
+
if (type !== Array$1) {
|
|
100
108
|
throw new AssertionError('expected value to be of type array');
|
|
101
109
|
}
|
|
102
110
|
};
|
|
103
111
|
const string = value => {
|
|
104
112
|
const type = getType(value);
|
|
105
|
-
if (type !==
|
|
113
|
+
if (type !== String) {
|
|
106
114
|
throw new AssertionError('expected value to be of type string');
|
|
107
115
|
}
|
|
108
116
|
};
|
|
@@ -923,11 +931,11 @@ const create$2 = rpcId => {
|
|
|
923
931
|
};
|
|
924
932
|
const RendererWorker$1 = 1;
|
|
925
933
|
const {
|
|
926
|
-
invoke: invoke$
|
|
934
|
+
invoke: invoke$4,
|
|
927
935
|
set: set$3} = create$2(RendererWorker$1);
|
|
928
936
|
const RendererWorker = {
|
|
929
937
|
__proto__: null,
|
|
930
|
-
invoke: invoke$
|
|
938
|
+
invoke: invoke$4,
|
|
931
939
|
set: set$3
|
|
932
940
|
};
|
|
933
941
|
|
|
@@ -1995,7 +2003,8 @@ const create2 = (uid, uri, x, y, width, height, args, parentUid, platform = 0) =
|
|
|
1995
2003
|
scrollBarActive: false,
|
|
1996
2004
|
scrollBarHeight: 0,
|
|
1997
2005
|
confirmPaste: false,
|
|
1998
|
-
pasteShouldMove: false
|
|
2006
|
+
pasteShouldMove: false,
|
|
2007
|
+
cutItems: []
|
|
1999
2008
|
};
|
|
2000
2009
|
set(uid, state, state);
|
|
2001
2010
|
};
|
|
@@ -2043,7 +2052,8 @@ const create = (id, uri, x, y, width, height, args, parentUid, platform = 0) =>
|
|
|
2043
2052
|
scrollBarActive: false,
|
|
2044
2053
|
scrollBarHeight: 0,
|
|
2045
2054
|
confirmPaste: false,
|
|
2046
|
-
pasteShouldMove: false
|
|
2055
|
+
pasteShouldMove: false,
|
|
2056
|
+
cutItems: []
|
|
2047
2057
|
};
|
|
2048
2058
|
set(state.uid, state, state);
|
|
2049
2059
|
return state;
|
|
@@ -2062,7 +2072,7 @@ const isEqual$4 = (oldState, newState) => {
|
|
|
2062
2072
|
|
|
2063
2073
|
const diffType$2 = RenderItems;
|
|
2064
2074
|
const isEqual$3 = (oldState, newState) => {
|
|
2065
|
-
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.width === newState.width && oldState.focused === newState.focused && oldState.dropTargets === newState.dropTargets && oldState.icons === newState.icons;
|
|
2075
|
+
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.focusedIndex === newState.focusedIndex && oldState.editingIndex === newState.editingIndex && oldState.editingType === newState.editingType && oldState.editingValue === newState.editingValue && oldState.editingErrorMessage === newState.editingErrorMessage && oldState.width === newState.width && oldState.focused === newState.focused && oldState.dropTargets === newState.dropTargets && oldState.icons === newState.icons && oldState.cutItems === newState.cutItems;
|
|
2066
2076
|
};
|
|
2067
2077
|
|
|
2068
2078
|
const diffType$1 = RenderSelection;
|
|
@@ -2381,7 +2391,7 @@ const focusPrevious = state => {
|
|
|
2381
2391
|
}
|
|
2382
2392
|
};
|
|
2383
2393
|
|
|
2384
|
-
const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'handleCut', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleInputKeyDown', 'handleKeyDown', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'updateEditingValue', 'updateIcons'];
|
|
2394
|
+
const commandIds = ['acceptEdit', 'cancelEdit', 'cancelTypeAhead', 'collapseAll', 'copyPath', 'copyRelativePath', 'dispose', 'expandAll', 'expandRecursively', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'handleCut', 'selectIndices', 'focusNext', 'focusNone', 'focusPrevious', 'getFocusedDirent', 'getMenuEntries2', 'getMouseActions', 'handleArrowLeft', 'handleArrowLeft', 'handleArrowRight', 'handleArrowRight', 'handleBlur', 'handleClick', 'handleClickAt', 'handleClickCurrent', 'handleClickCurrentButKeepFocus', 'handleClickOpenFolder', 'handleContextMenu', 'handleContextMenuKeyboard', 'handleCopy', 'handleDragLeave', 'handleDragOver', 'handleDrop', 'handleFocus', 'handleIconThemeChange', 'handleInputBlur', 'handleInputClick', 'handleInputKeyDown', 'handleKeyDown', 'handleLanguagesChanged', 'handleMouseEnter', 'handleMouseLeave', 'handlePaste', 'handlePointerDown', 'handleUpload', 'handleWheel', 'handleWorkspaceChange', 'hotReload', 'newFile', 'newFolder', 'openContainingFolder', 'refresh', 'removeDirent', 'rename', 'renameDirent', 'renderEventListeners', 'revealItem', 'revealItem', 'scrollDown', 'scrollUp', 'selectAll', 'selectDown', 'selectUp', 'setDeltaY', 'setSelectedIndices', 'updateEditingValue', 'updateIcons'];
|
|
2385
2395
|
|
|
2386
2396
|
const getCommandIds = () => {
|
|
2387
2397
|
return commandIds;
|
|
@@ -2400,8 +2410,45 @@ const Delete = 18;
|
|
|
2400
2410
|
const KeyA = 29;
|
|
2401
2411
|
const KeyC = 31;
|
|
2402
2412
|
const KeyV = 50;
|
|
2413
|
+
const KeyX = 52;
|
|
2403
2414
|
const F2 = 58;
|
|
2404
2415
|
const Star = 131;
|
|
2416
|
+
const KeyCode = {
|
|
2417
|
+
__proto__: null,
|
|
2418
|
+
Delete,
|
|
2419
|
+
DownArrow,
|
|
2420
|
+
End,
|
|
2421
|
+
Enter,
|
|
2422
|
+
Escape,
|
|
2423
|
+
F2,
|
|
2424
|
+
Home,
|
|
2425
|
+
KeyA,
|
|
2426
|
+
KeyC,
|
|
2427
|
+
KeyV,
|
|
2428
|
+
KeyX,
|
|
2429
|
+
LeftArrow,
|
|
2430
|
+
RightArrow,
|
|
2431
|
+
Space,
|
|
2432
|
+
Star,
|
|
2433
|
+
UpArrow
|
|
2434
|
+
};
|
|
2435
|
+
const mergeClassNames = (...classNames) => {
|
|
2436
|
+
return classNames.filter(Boolean).join(' ');
|
|
2437
|
+
};
|
|
2438
|
+
const px = value => {
|
|
2439
|
+
return `${value}px`;
|
|
2440
|
+
};
|
|
2441
|
+
const position = (x, y) => {
|
|
2442
|
+
return `${x}px ${y}px`;
|
|
2443
|
+
};
|
|
2444
|
+
const Text = 12;
|
|
2445
|
+
const text = data => {
|
|
2446
|
+
return {
|
|
2447
|
+
type: Text,
|
|
2448
|
+
text: data,
|
|
2449
|
+
childCount: 0
|
|
2450
|
+
};
|
|
2451
|
+
};
|
|
2405
2452
|
|
|
2406
2453
|
const CtrlCmd = 1 << 11 >>> 0;
|
|
2407
2454
|
const Shift = 1 << 10 >>> 0;
|
|
@@ -2412,87 +2459,91 @@ const FocusExplorerEditBox = 14;
|
|
|
2412
2459
|
|
|
2413
2460
|
const getKeyBindings = () => {
|
|
2414
2461
|
return [{
|
|
2415
|
-
key: Shift | UpArrow,
|
|
2462
|
+
key: Shift | KeyCode.UpArrow,
|
|
2416
2463
|
command: 'Explorer.selectUp',
|
|
2417
2464
|
when: FocusExplorer
|
|
2418
2465
|
}, {
|
|
2419
|
-
key: Shift | DownArrow,
|
|
2466
|
+
key: Shift | KeyCode.DownArrow,
|
|
2420
2467
|
command: 'Explorer.selectDown',
|
|
2421
2468
|
when: FocusExplorer
|
|
2422
2469
|
}, {
|
|
2423
|
-
key: RightArrow,
|
|
2470
|
+
key: KeyCode.RightArrow,
|
|
2424
2471
|
command: 'Explorer.handleArrowRight',
|
|
2425
2472
|
when: FocusExplorer
|
|
2426
2473
|
}, {
|
|
2427
|
-
key: LeftArrow,
|
|
2474
|
+
key: KeyCode.LeftArrow,
|
|
2428
2475
|
command: 'Explorer.handleArrowLeft',
|
|
2429
2476
|
when: FocusExplorer
|
|
2430
2477
|
}, {
|
|
2431
|
-
key: Home,
|
|
2478
|
+
key: KeyCode.Home,
|
|
2432
2479
|
command: 'Explorer.focusFirst',
|
|
2433
2480
|
when: FocusExplorer
|
|
2434
2481
|
}, {
|
|
2435
|
-
key: End,
|
|
2482
|
+
key: KeyCode.End,
|
|
2436
2483
|
command: 'Explorer.focusLast',
|
|
2437
2484
|
when: FocusExplorer
|
|
2438
2485
|
}, {
|
|
2439
|
-
key: UpArrow,
|
|
2486
|
+
key: KeyCode.UpArrow,
|
|
2440
2487
|
command: 'Explorer.focusPrevious',
|
|
2441
2488
|
when: FocusExplorer
|
|
2442
2489
|
}, {
|
|
2443
|
-
key: DownArrow,
|
|
2490
|
+
key: KeyCode.DownArrow,
|
|
2444
2491
|
command: 'Explorer.focusNext',
|
|
2445
2492
|
when: FocusExplorer
|
|
2446
2493
|
}, {
|
|
2447
|
-
key: CtrlCmd | Star,
|
|
2494
|
+
key: CtrlCmd | KeyCode.Star,
|
|
2448
2495
|
command: 'Explorer.expandAll',
|
|
2449
2496
|
when: FocusExplorer
|
|
2450
2497
|
}, {
|
|
2451
|
-
key: Alt | RightArrow,
|
|
2498
|
+
key: Alt | KeyCode.RightArrow,
|
|
2452
2499
|
command: 'Explorer.expandRecursively',
|
|
2453
2500
|
when: FocusExplorer
|
|
2454
2501
|
}, {
|
|
2455
|
-
key: CtrlCmd | LeftArrow,
|
|
2502
|
+
key: CtrlCmd | KeyCode.LeftArrow,
|
|
2456
2503
|
command: 'Explorer.collapseAll',
|
|
2457
2504
|
when: FocusExplorer
|
|
2458
2505
|
}, {
|
|
2459
|
-
key: CtrlCmd | KeyV,
|
|
2506
|
+
key: CtrlCmd | KeyCode.KeyV,
|
|
2460
2507
|
command: 'Explorer.handlePaste',
|
|
2461
2508
|
when: FocusExplorer
|
|
2462
2509
|
}, {
|
|
2463
|
-
key: CtrlCmd | KeyC,
|
|
2510
|
+
key: CtrlCmd | KeyCode.KeyC,
|
|
2464
2511
|
command: 'Explorer.handleCopy',
|
|
2465
2512
|
when: FocusExplorer
|
|
2466
2513
|
}, {
|
|
2467
|
-
key:
|
|
2514
|
+
key: CtrlCmd | KeyCode.KeyX,
|
|
2515
|
+
command: 'Explorer.handleCut',
|
|
2516
|
+
when: FocusExplorer
|
|
2517
|
+
}, {
|
|
2518
|
+
key: KeyCode.F2,
|
|
2468
2519
|
command: 'Explorer.renameDirent',
|
|
2469
2520
|
when: FocusExplorer
|
|
2470
2521
|
}, {
|
|
2471
|
-
key: Escape,
|
|
2522
|
+
key: KeyCode.Escape,
|
|
2472
2523
|
command: 'Explorer.cancelEdit',
|
|
2473
2524
|
when: FocusExplorerEditBox
|
|
2474
2525
|
}, {
|
|
2475
|
-
key: Enter,
|
|
2526
|
+
key: KeyCode.Enter,
|
|
2476
2527
|
command: 'Explorer.acceptEdit',
|
|
2477
2528
|
when: FocusExplorerEditBox
|
|
2478
2529
|
}, {
|
|
2479
|
-
key: Delete,
|
|
2530
|
+
key: KeyCode.Delete,
|
|
2480
2531
|
command: 'Explorer.removeDirent',
|
|
2481
2532
|
when: FocusExplorer
|
|
2482
2533
|
}, {
|
|
2483
|
-
key: Escape,
|
|
2534
|
+
key: KeyCode.Escape,
|
|
2484
2535
|
command: 'Explorer.focusNone',
|
|
2485
2536
|
when: FocusExplorer
|
|
2486
2537
|
}, {
|
|
2487
|
-
key: Space,
|
|
2538
|
+
key: KeyCode.Space,
|
|
2488
2539
|
command: 'Explorer.handleClickCurrentButKeepFocus',
|
|
2489
2540
|
when: FocusExplorer
|
|
2490
2541
|
}, {
|
|
2491
|
-
key: Enter,
|
|
2542
|
+
key: KeyCode.Enter,
|
|
2492
2543
|
command: 'Explorer.handleClickCurrent',
|
|
2493
2544
|
when: FocusExplorer
|
|
2494
2545
|
}, {
|
|
2495
|
-
key: CtrlCmd | KeyA,
|
|
2546
|
+
key: CtrlCmd | KeyCode.KeyA,
|
|
2496
2547
|
command: 'Explorer.selectAll',
|
|
2497
2548
|
when: FocusExplorer
|
|
2498
2549
|
}];
|
|
@@ -3134,21 +3185,29 @@ const handleCopy = async state => {
|
|
|
3134
3185
|
};
|
|
3135
3186
|
};
|
|
3136
3187
|
|
|
3188
|
+
const getSelectedItems = (items, focusedIndex) => {
|
|
3189
|
+
const dirent = items[focusedIndex];
|
|
3190
|
+
const selectedItems = items.filter(item => item.selected || item === dirent);
|
|
3191
|
+
return selectedItems;
|
|
3192
|
+
};
|
|
3193
|
+
|
|
3137
3194
|
const handleCut = async state => {
|
|
3138
3195
|
// TODO handle multiple files
|
|
3139
3196
|
// TODO if not file is selected, what happens?
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
|
|
3197
|
+
const {
|
|
3198
|
+
items,
|
|
3199
|
+
focusedIndex
|
|
3200
|
+
} = state;
|
|
3201
|
+
const dirents = getSelectedItems(items, focusedIndex);
|
|
3202
|
+
if (dirents.length === 0) {
|
|
3143
3203
|
return state;
|
|
3144
3204
|
}
|
|
3145
|
-
const
|
|
3146
|
-
// TODO handle cut error gracefully
|
|
3147
|
-
const files = [absolutePath];
|
|
3205
|
+
const files = dirents.map(dirent => dirent.path);
|
|
3148
3206
|
await writeNativeFiles('cut', files);
|
|
3149
3207
|
return {
|
|
3150
3208
|
...state,
|
|
3151
|
-
pasteShouldMove: true
|
|
3209
|
+
pasteShouldMove: true,
|
|
3210
|
+
cutItems: files
|
|
3152
3211
|
};
|
|
3153
3212
|
};
|
|
3154
3213
|
|
|
@@ -3916,13 +3975,15 @@ const handlePasteCut = async (state, nativeFiles) => {
|
|
|
3916
3975
|
const adjustedState = adjustScrollAfterPaste(latestState, pastedFileIndex);
|
|
3917
3976
|
return {
|
|
3918
3977
|
...adjustedState,
|
|
3919
|
-
pasteShouldMove: false
|
|
3978
|
+
pasteShouldMove: false,
|
|
3979
|
+
cutItems: []
|
|
3920
3980
|
};
|
|
3921
3981
|
}
|
|
3922
3982
|
}
|
|
3923
3983
|
return {
|
|
3924
3984
|
...latestState,
|
|
3925
|
-
pasteShouldMove: false
|
|
3985
|
+
pasteShouldMove: false,
|
|
3986
|
+
cutItems: []
|
|
3926
3987
|
};
|
|
3927
3988
|
};
|
|
3928
3989
|
|
|
@@ -4395,12 +4456,6 @@ const confirmDelete = async paths => {
|
|
|
4395
4456
|
return result === true;
|
|
4396
4457
|
};
|
|
4397
4458
|
|
|
4398
|
-
const getSelectedItems = (items, focusedIndex) => {
|
|
4399
|
-
const dirent = items[focusedIndex];
|
|
4400
|
-
const selectedItems = items.filter(item => item.selected || item === dirent);
|
|
4401
|
-
return selectedItems;
|
|
4402
|
-
};
|
|
4403
|
-
|
|
4404
4459
|
const removePaths = async paths => {
|
|
4405
4460
|
for (const item of paths) {
|
|
4406
4461
|
try {
|
|
@@ -4556,22 +4611,34 @@ const ToolBar = 'toolbar';
|
|
|
4556
4611
|
const Tree = 'tree';
|
|
4557
4612
|
const TreeItem$1 = 'treeitem';
|
|
4558
4613
|
|
|
4614
|
+
// 0 = 'Button'
|
|
4615
|
+
// 1 = 'IconButton'
|
|
4616
|
+
// 2 = 'Button IconButton'
|
|
4617
|
+
// it could make dom diffing faster, since for classname,
|
|
4618
|
+
// once at start, send all classnames to renderer process
|
|
4619
|
+
// only numbers are compared. it could also make rendering faster,
|
|
4620
|
+
// representing the concatenated strings for example
|
|
4621
|
+
// since less data is transferred to renderer process
|
|
4622
|
+
// then, components uses numeric classname
|
|
4623
|
+
// TODO add option to make classnames numeric
|
|
4624
|
+
// when a component uses multiple classnames, it is a new number
|
|
4559
4625
|
const Actions = 'Actions';
|
|
4560
4626
|
const Button$2 = 'Button';
|
|
4561
4627
|
const ButtonNarrow = 'ButtonNarrow';
|
|
4562
4628
|
const ButtonPrimary = 'ButtonPrimary';
|
|
4563
4629
|
const ButtonWide = 'ButtonWide';
|
|
4564
4630
|
const Chevron = 'Chevron';
|
|
4565
|
-
const ExplorerErrorMessage = 'ExplorerErrorMessage';
|
|
4566
4631
|
const Empty = '';
|
|
4567
4632
|
const Explorer = 'Explorer';
|
|
4568
4633
|
const ExplorerDropTarget = 'DropTarget';
|
|
4634
|
+
const ExplorerErrorMessage = 'ExplorerErrorMessage';
|
|
4569
4635
|
const ExplorerInputBox = 'ExplorerInputBox';
|
|
4570
4636
|
const FileIcon = 'FileIcon';
|
|
4571
4637
|
const FocusOutline = 'FocusOutline';
|
|
4572
4638
|
const IconButton = 'IconButton';
|
|
4573
4639
|
const InputValidationError = 'InputValidationError';
|
|
4574
4640
|
const Label = 'Label';
|
|
4641
|
+
const LabelCut = 'LabelCut';
|
|
4575
4642
|
const ListItems = 'ListItems';
|
|
4576
4643
|
const MaskIconChevronDown = 'MaskIconChevronDown';
|
|
4577
4644
|
const MaskIconChevronRight = 'MaskIconChevronRight';
|
|
@@ -4584,36 +4651,6 @@ const Viewlet = 'Viewlet';
|
|
|
4584
4651
|
const Welcome = 'Welcome';
|
|
4585
4652
|
const WelcomeMessage = 'WelcomeMessage';
|
|
4586
4653
|
|
|
4587
|
-
// TODO add option to make classnames numeric
|
|
4588
|
-
// once at start, send all classnames to renderer process
|
|
4589
|
-
// then, components uses numeric classname
|
|
4590
|
-
// when a component uses multiple classnames, it is a new number
|
|
4591
|
-
// representing the concatenated strings for example
|
|
4592
|
-
// 0 = 'Button'
|
|
4593
|
-
// 1 = 'IconButton'
|
|
4594
|
-
// 2 = 'Button IconButton'
|
|
4595
|
-
// it could make dom diffing faster, since for classname,
|
|
4596
|
-
// only numbers are compared. it could also make rendering faster,
|
|
4597
|
-
// since less data is transferred to renderer process
|
|
4598
|
-
|
|
4599
|
-
const mergeClassNames = (...classNames) => {
|
|
4600
|
-
return classNames.filter(Boolean).join(' ');
|
|
4601
|
-
};
|
|
4602
|
-
const px = value => {
|
|
4603
|
-
return `${value}px`;
|
|
4604
|
-
};
|
|
4605
|
-
const position = (x, y) => {
|
|
4606
|
-
return `${x}px ${y}px`;
|
|
4607
|
-
};
|
|
4608
|
-
const Text = 12;
|
|
4609
|
-
const text = data => {
|
|
4610
|
-
return {
|
|
4611
|
-
type: Text,
|
|
4612
|
-
text: data,
|
|
4613
|
-
childCount: 0
|
|
4614
|
-
};
|
|
4615
|
-
};
|
|
4616
|
-
|
|
4617
4654
|
const Button$1 = 1;
|
|
4618
4655
|
const Div = 4;
|
|
4619
4656
|
const Input = 6;
|
|
@@ -4726,15 +4763,22 @@ const label = {
|
|
|
4726
4763
|
className: Label,
|
|
4727
4764
|
childCount: 1
|
|
4728
4765
|
};
|
|
4729
|
-
const getLabelDom = name => {
|
|
4766
|
+
const getLabelDom = (name, isCut) => {
|
|
4767
|
+
if (isCut) {
|
|
4768
|
+
return [{
|
|
4769
|
+
type: Div,
|
|
4770
|
+
className: mergeClassNames(Label, LabelCut),
|
|
4771
|
+
childCount: 1
|
|
4772
|
+
}, text(name)];
|
|
4773
|
+
}
|
|
4730
4774
|
return [label, text(name)];
|
|
4731
4775
|
};
|
|
4732
4776
|
|
|
4733
|
-
const getInputOrLabelDom = (isEditing, hasEditingError, name) => {
|
|
4777
|
+
const getInputOrLabelDom = (isEditing, hasEditingError, name, isCut) => {
|
|
4734
4778
|
if (isEditing) {
|
|
4735
4779
|
return getInputDom(hasEditingError);
|
|
4736
4780
|
}
|
|
4737
|
-
return getLabelDom(name);
|
|
4781
|
+
return getLabelDom(name, isCut);
|
|
4738
4782
|
};
|
|
4739
4783
|
|
|
4740
4784
|
const getExplorerItemVirtualDom = item => {
|
|
@@ -4751,7 +4795,8 @@ const getExplorerItemVirtualDom = item => {
|
|
|
4751
4795
|
name,
|
|
4752
4796
|
path,
|
|
4753
4797
|
setSize,
|
|
4754
|
-
posInSet
|
|
4798
|
+
posInSet,
|
|
4799
|
+
isCut
|
|
4755
4800
|
} = item;
|
|
4756
4801
|
const chevronDom = getChevronVirtualDom(chevron);
|
|
4757
4802
|
return [{
|
|
@@ -4769,7 +4814,7 @@ const getExplorerItemVirtualDom = item => {
|
|
|
4769
4814
|
ariaExpanded,
|
|
4770
4815
|
ariaDescription: '',
|
|
4771
4816
|
id
|
|
4772
|
-
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputOrLabelDom(isEditing, hasEditingError, name)];
|
|
4817
|
+
}, ...chevronDom, getFileIconVirtualDom(icon), ...getInputOrLabelDom(isEditing, hasEditingError, name, isCut)];
|
|
4773
4818
|
};
|
|
4774
4819
|
|
|
4775
4820
|
const getActiveDescendant = focusedIndex => {
|
|
@@ -4943,7 +4988,7 @@ const getEditingChevron = direntType => {
|
|
|
4943
4988
|
return None$1;
|
|
4944
4989
|
}
|
|
4945
4990
|
};
|
|
4946
|
-
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon) => {
|
|
4991
|
+
const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems) => {
|
|
4947
4992
|
const visible = [];
|
|
4948
4993
|
const indentFn = useChevrons ? getTreeItemIndentWithChevron : getTreeItemIndent;
|
|
4949
4994
|
let iconIndex = 0;
|
|
@@ -4953,7 +4998,8 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
4953
4998
|
const isFocused = i === focusedIndex;
|
|
4954
4999
|
const id = isFocused ? 'TreeItemActive' : undefined;
|
|
4955
5000
|
const isSelected = item.selected;
|
|
4956
|
-
const
|
|
5001
|
+
const isCut = cutItems.includes(item.path);
|
|
5002
|
+
const className = getTreeItemClassName(isSelected, isFocused); // TODO compute classname in dom function
|
|
4957
5003
|
const expanded = getExpandedType(item.type);
|
|
4958
5004
|
const ariaExpanded = ariaExpandedValues[expanded];
|
|
4959
5005
|
const isEditing = i === editingIndex;
|
|
@@ -4974,17 +5020,39 @@ const getVisibleExplorerItems = (items, minLineY, maxLineY, focusedIndex, editin
|
|
|
4974
5020
|
ariaExpanded,
|
|
4975
5021
|
chevron,
|
|
4976
5022
|
id,
|
|
4977
|
-
className
|
|
5023
|
+
className,
|
|
5024
|
+
isCut
|
|
4978
5025
|
});
|
|
4979
5026
|
}
|
|
4980
5027
|
return visible;
|
|
4981
5028
|
};
|
|
4982
5029
|
|
|
4983
5030
|
const renderItems = (oldState, newState) => {
|
|
4984
|
-
const
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
5031
|
+
const {
|
|
5032
|
+
items,
|
|
5033
|
+
minLineY,
|
|
5034
|
+
maxLineY,
|
|
5035
|
+
focusedIndex,
|
|
5036
|
+
editingIndex,
|
|
5037
|
+
editingType,
|
|
5038
|
+
editingValue,
|
|
5039
|
+
editingErrorMessage,
|
|
5040
|
+
icons,
|
|
5041
|
+
useChevrons,
|
|
5042
|
+
dropTargets,
|
|
5043
|
+
editingIcon,
|
|
5044
|
+
itemHeight,
|
|
5045
|
+
width,
|
|
5046
|
+
root,
|
|
5047
|
+
deltaY,
|
|
5048
|
+
focused,
|
|
5049
|
+
height,
|
|
5050
|
+
cutItems
|
|
5051
|
+
} = newState;
|
|
5052
|
+
const visibleDirents = getVisibleExplorerItems(items, minLineY, maxLineY, focusedIndex, editingIndex, editingType, editingValue, editingErrorMessage, icons, useChevrons, dropTargets, editingIcon, cutItems);
|
|
5053
|
+
const isWide = width > 450;
|
|
5054
|
+
const contentHeight = items.length * itemHeight;
|
|
5055
|
+
const depth = items[focusedIndex]?.depth || 0;
|
|
4988
5056
|
const indent = 8;
|
|
4989
5057
|
const padding = 10;
|
|
4990
5058
|
const fileIconWidth = 16;
|
|
@@ -4993,8 +5061,8 @@ const renderItems = (oldState, newState) => {
|
|
|
4993
5061
|
const {
|
|
4994
5062
|
top,
|
|
4995
5063
|
left
|
|
4996
|
-
} = getErrorMessagePosition(
|
|
4997
|
-
const dom = getExplorerVirtualDom(visibleDirents,
|
|
5064
|
+
} = getErrorMessagePosition(itemHeight, focusedIndex, minLineY, depth, indent, fileIconWidth, padding + defaultPaddingLeft + chevronSpace);
|
|
5065
|
+
const dom = getExplorerVirtualDom(visibleDirents, focusedIndex, root, isWide, focused, dropTargets, height, contentHeight, deltaY, editingErrorMessage, top, left);
|
|
4998
5066
|
return ['Viewlet.setDom2', dom];
|
|
4999
5067
|
};
|
|
5000
5068
|
|
|
@@ -5533,6 +5601,7 @@ const commandMap = {
|
|
|
5533
5601
|
'Explorer.selectUp': wrapCommand(selectUp),
|
|
5534
5602
|
'Explorer.setDeltaY': wrapCommand(setDeltaY),
|
|
5535
5603
|
'Explorer.setSelectedIndices': wrapCommand(setSelectedIndices),
|
|
5604
|
+
'Explorer.selectIndices': wrapCommand(setSelectedIndices),
|
|
5536
5605
|
'Explorer.updateEditingValue': wrapCommand(updateEditingValue),
|
|
5537
5606
|
'Explorer.updateIcons': wrapCommand(updateIcons),
|
|
5538
5607
|
// not wrapped
|