@lvce-editor/explorer-view 3.16.0 → 3.17.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 +111 -100
- package/package.json +1 -1
|
@@ -1045,6 +1045,90 @@ const createMockRpc = ({
|
|
|
1045
1045
|
return mockRpc;
|
|
1046
1046
|
};
|
|
1047
1047
|
|
|
1048
|
+
const toCommandId = key => {
|
|
1049
|
+
const dotIndex = key.indexOf('.');
|
|
1050
|
+
return key.slice(dotIndex + 1);
|
|
1051
|
+
};
|
|
1052
|
+
const create$2 = () => {
|
|
1053
|
+
const states = Object.create(null);
|
|
1054
|
+
const commandMapRef = {};
|
|
1055
|
+
return {
|
|
1056
|
+
get(uid) {
|
|
1057
|
+
return states[uid];
|
|
1058
|
+
},
|
|
1059
|
+
set(uid, oldState, newState) {
|
|
1060
|
+
states[uid] = {
|
|
1061
|
+
oldState,
|
|
1062
|
+
newState
|
|
1063
|
+
};
|
|
1064
|
+
},
|
|
1065
|
+
dispose(uid) {
|
|
1066
|
+
delete states[uid];
|
|
1067
|
+
},
|
|
1068
|
+
getKeys() {
|
|
1069
|
+
return Object.keys(states).map(key => {
|
|
1070
|
+
return Number.parseInt(key);
|
|
1071
|
+
});
|
|
1072
|
+
},
|
|
1073
|
+
clear() {
|
|
1074
|
+
for (const key of Object.keys(states)) {
|
|
1075
|
+
delete states[key];
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
wrapCommand(fn) {
|
|
1079
|
+
const wrapped = async (uid, ...args) => {
|
|
1080
|
+
const {
|
|
1081
|
+
newState
|
|
1082
|
+
} = states[uid];
|
|
1083
|
+
const newerState = await fn(newState, ...args);
|
|
1084
|
+
if (newState === newerState) {
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
const latest = states[uid];
|
|
1088
|
+
states[uid] = {
|
|
1089
|
+
oldState: latest.oldState,
|
|
1090
|
+
newState: newerState
|
|
1091
|
+
};
|
|
1092
|
+
};
|
|
1093
|
+
return wrapped;
|
|
1094
|
+
},
|
|
1095
|
+
wrapGetter(fn) {
|
|
1096
|
+
const wrapped = (uid, ...args) => {
|
|
1097
|
+
const {
|
|
1098
|
+
newState
|
|
1099
|
+
} = states[uid];
|
|
1100
|
+
return fn(newState, ...args);
|
|
1101
|
+
};
|
|
1102
|
+
return wrapped;
|
|
1103
|
+
},
|
|
1104
|
+
diff(uid, modules, numbers) {
|
|
1105
|
+
const {
|
|
1106
|
+
oldState,
|
|
1107
|
+
newState
|
|
1108
|
+
} = states[uid];
|
|
1109
|
+
const diffResult = [];
|
|
1110
|
+
for (let i = 0; i < modules.length; i++) {
|
|
1111
|
+
const fn = modules[i];
|
|
1112
|
+
if (!fn(oldState, newState)) {
|
|
1113
|
+
diffResult.push(numbers[i]);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
return diffResult;
|
|
1117
|
+
},
|
|
1118
|
+
getCommandIds() {
|
|
1119
|
+
const keys = Object.keys(commandMapRef);
|
|
1120
|
+
const ids = keys.map(toCommandId);
|
|
1121
|
+
return ids;
|
|
1122
|
+
},
|
|
1123
|
+
registerCommands(commandMap) {
|
|
1124
|
+
Object.assign(commandMapRef, commandMap);
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
};
|
|
1128
|
+
const terminate = () => {
|
|
1129
|
+
globalThis.close();
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1048
1132
|
const CreateFolder$1 = 1;
|
|
1049
1133
|
const CreateFile$1 = 2;
|
|
1050
1134
|
const Copy$1 = 3;
|
|
@@ -1053,6 +1137,14 @@ const Remove = 5;
|
|
|
1053
1137
|
|
|
1054
1138
|
const Text = 12;
|
|
1055
1139
|
|
|
1140
|
+
const TargetValue = 'event.target.value';
|
|
1141
|
+
const ClientX = 'event.clientX';
|
|
1142
|
+
const ClientY = 'event.clientY';
|
|
1143
|
+
const Button$3 = 'event.button';
|
|
1144
|
+
const DeltaMode = 'event.deltaMode';
|
|
1145
|
+
const DeltaY = 'event.deltaY';
|
|
1146
|
+
const CtrlKey = 'event.ctrlKey';
|
|
1147
|
+
|
|
1056
1148
|
const Enter = 3;
|
|
1057
1149
|
const Escape = 8;
|
|
1058
1150
|
const Space = 9;
|
|
@@ -1078,6 +1170,10 @@ const DebugWorker = 55;
|
|
|
1078
1170
|
const FileSystemWorker$1 = 209;
|
|
1079
1171
|
const RendererWorker$1 = 1;
|
|
1080
1172
|
|
|
1173
|
+
const FocusElementByName = 'Viewlet.focusElementByName';
|
|
1174
|
+
const FocusSelector = 'Viewlet.focusSelector';
|
|
1175
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
1176
|
+
|
|
1081
1177
|
const FocusExplorer = 13;
|
|
1082
1178
|
const FocusExplorerEditBox = 14;
|
|
1083
1179
|
|
|
@@ -1089,7 +1185,7 @@ const get$1 = id => {
|
|
|
1089
1185
|
return rpcs[id];
|
|
1090
1186
|
};
|
|
1091
1187
|
|
|
1092
|
-
const create$
|
|
1188
|
+
const create$1 = rpcId => {
|
|
1093
1189
|
return {
|
|
1094
1190
|
// @ts-ignore
|
|
1095
1191
|
invoke(method, ...params) {
|
|
@@ -1118,7 +1214,7 @@ const {
|
|
|
1118
1214
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1119
1215
|
set: set$4,
|
|
1120
1216
|
dispose: dispose$1
|
|
1121
|
-
} = create$
|
|
1217
|
+
} = create$1(FileSystemWorker$1);
|
|
1122
1218
|
const remove$1 = async dirent => {
|
|
1123
1219
|
return invoke$3('FileSystem.remove', dirent);
|
|
1124
1220
|
};
|
|
@@ -1198,7 +1294,7 @@ const {
|
|
|
1198
1294
|
invokeAndTransfer,
|
|
1199
1295
|
set: set$3,
|
|
1200
1296
|
dispose
|
|
1201
|
-
} = create$
|
|
1297
|
+
} = create$1(RendererWorker$1);
|
|
1202
1298
|
const searchFileHtml = async uri => {
|
|
1203
1299
|
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1204
1300
|
};
|
|
@@ -2544,87 +2640,6 @@ const copyRelativePath = async state => {
|
|
|
2544
2640
|
return state;
|
|
2545
2641
|
};
|
|
2546
2642
|
|
|
2547
|
-
const toCommandId = key => {
|
|
2548
|
-
const dotIndex = key.indexOf('.');
|
|
2549
|
-
return key.slice(dotIndex + 1);
|
|
2550
|
-
};
|
|
2551
|
-
const create$1 = () => {
|
|
2552
|
-
const states = Object.create(null);
|
|
2553
|
-
const commandMapRef = {};
|
|
2554
|
-
return {
|
|
2555
|
-
get(uid) {
|
|
2556
|
-
return states[uid];
|
|
2557
|
-
},
|
|
2558
|
-
set(uid, oldState, newState) {
|
|
2559
|
-
states[uid] = {
|
|
2560
|
-
oldState,
|
|
2561
|
-
newState
|
|
2562
|
-
};
|
|
2563
|
-
},
|
|
2564
|
-
dispose(uid) {
|
|
2565
|
-
delete states[uid];
|
|
2566
|
-
},
|
|
2567
|
-
getKeys() {
|
|
2568
|
-
return Object.keys(states).map(key => {
|
|
2569
|
-
return Number.parseInt(key);
|
|
2570
|
-
});
|
|
2571
|
-
},
|
|
2572
|
-
clear() {
|
|
2573
|
-
for (const key of Object.keys(states)) {
|
|
2574
|
-
delete states[key];
|
|
2575
|
-
}
|
|
2576
|
-
},
|
|
2577
|
-
wrapCommand(fn) {
|
|
2578
|
-
const wrapped = async (uid, ...args) => {
|
|
2579
|
-
const {
|
|
2580
|
-
newState
|
|
2581
|
-
} = states[uid];
|
|
2582
|
-
const newerState = await fn(newState, ...args);
|
|
2583
|
-
if (newState === newerState) {
|
|
2584
|
-
return;
|
|
2585
|
-
}
|
|
2586
|
-
const latest = states[uid];
|
|
2587
|
-
states[uid] = {
|
|
2588
|
-
oldState: latest.oldState,
|
|
2589
|
-
newState: newerState
|
|
2590
|
-
};
|
|
2591
|
-
};
|
|
2592
|
-
return wrapped;
|
|
2593
|
-
},
|
|
2594
|
-
wrapGetter(fn) {
|
|
2595
|
-
const wrapped = (uid, ...args) => {
|
|
2596
|
-
const {
|
|
2597
|
-
newState
|
|
2598
|
-
} = states[uid];
|
|
2599
|
-
return fn(newState, ...args);
|
|
2600
|
-
};
|
|
2601
|
-
return wrapped;
|
|
2602
|
-
},
|
|
2603
|
-
diff(uid, modules, numbers) {
|
|
2604
|
-
const {
|
|
2605
|
-
oldState,
|
|
2606
|
-
newState
|
|
2607
|
-
} = states[uid];
|
|
2608
|
-
const diffResult = [];
|
|
2609
|
-
for (let i = 0; i < modules.length; i++) {
|
|
2610
|
-
const fn = modules[i];
|
|
2611
|
-
if (!fn(oldState, newState)) {
|
|
2612
|
-
diffResult.push(numbers[i]);
|
|
2613
|
-
}
|
|
2614
|
-
}
|
|
2615
|
-
return diffResult;
|
|
2616
|
-
},
|
|
2617
|
-
getCommandIds() {
|
|
2618
|
-
const keys = Object.keys(commandMapRef);
|
|
2619
|
-
const ids = keys.map(toCommandId);
|
|
2620
|
-
return ids;
|
|
2621
|
-
},
|
|
2622
|
-
registerCommands(commandMap) {
|
|
2623
|
-
Object.assign(commandMapRef, commandMap);
|
|
2624
|
-
}
|
|
2625
|
-
};
|
|
2626
|
-
};
|
|
2627
|
-
|
|
2628
2643
|
const {
|
|
2629
2644
|
get,
|
|
2630
2645
|
set,
|
|
@@ -2632,7 +2647,7 @@ const {
|
|
|
2632
2647
|
registerCommands,
|
|
2633
2648
|
getCommandIds,
|
|
2634
2649
|
wrapGetter
|
|
2635
|
-
} = create$
|
|
2650
|
+
} = create$2();
|
|
2636
2651
|
|
|
2637
2652
|
const ListItem = 22;
|
|
2638
2653
|
|
|
@@ -5347,10 +5362,10 @@ const renderFocus = (oldState, newState) => {
|
|
|
5347
5362
|
return [];
|
|
5348
5363
|
}
|
|
5349
5364
|
if (newState.focus === Input$1) {
|
|
5350
|
-
return [
|
|
5365
|
+
return [FocusElementByName, ExplorerInput];
|
|
5351
5366
|
}
|
|
5352
5367
|
if (newState.focus === List) {
|
|
5353
|
-
return [
|
|
5368
|
+
return [FocusSelector, '.ListItems'];
|
|
5354
5369
|
}
|
|
5355
5370
|
// TODO
|
|
5356
5371
|
// 1. when focused, focus the outer list element
|
|
@@ -5360,10 +5375,10 @@ const renderFocus = (oldState, newState) => {
|
|
|
5360
5375
|
|
|
5361
5376
|
const renderFocusContext = (oldState, newState) => {
|
|
5362
5377
|
if (newState.focus === Input$1) {
|
|
5363
|
-
return [
|
|
5378
|
+
return [SetFocusContext, newState.uid, FocusExplorerEditBox];
|
|
5364
5379
|
}
|
|
5365
5380
|
if (newState.focus === List) {
|
|
5366
|
-
return [
|
|
5381
|
+
return [SetFocusContext, newState.uid, FocusExplorer];
|
|
5367
5382
|
}
|
|
5368
5383
|
return [];
|
|
5369
5384
|
};
|
|
@@ -6006,7 +6021,7 @@ const renderEventListeners = () => {
|
|
|
6006
6021
|
params: ['handleBlur']
|
|
6007
6022
|
}, {
|
|
6008
6023
|
name: HandleClick,
|
|
6009
|
-
params: ['handleClickAt', 'event.defaultPrevented',
|
|
6024
|
+
params: ['handleClickAt', 'event.defaultPrevented', Button$3, CtrlKey, 'event.shiftKey', ClientX, ClientY],
|
|
6010
6025
|
preventDefault: true
|
|
6011
6026
|
}, {
|
|
6012
6027
|
name: HandleInputClick,
|
|
@@ -6018,26 +6033,26 @@ const renderEventListeners = () => {
|
|
|
6018
6033
|
preventDefault: true
|
|
6019
6034
|
}, {
|
|
6020
6035
|
name: HandlePointerDown,
|
|
6021
|
-
params: ['handlePointerDown',
|
|
6036
|
+
params: ['handlePointerDown', Button$3, ClientX, ClientY]
|
|
6022
6037
|
// preventDefault: true,
|
|
6023
6038
|
}, {
|
|
6024
6039
|
name: HandleEditingInput,
|
|
6025
|
-
params: ['updateEditingValue',
|
|
6040
|
+
params: ['updateEditingValue', TargetValue]
|
|
6026
6041
|
}, {
|
|
6027
6042
|
name: HandleContextMenu,
|
|
6028
|
-
params: ['handleContextMenu',
|
|
6043
|
+
params: ['handleContextMenu', Button$3, ClientX, ClientY],
|
|
6029
6044
|
preventDefault: true
|
|
6030
6045
|
}, {
|
|
6031
6046
|
name: HandleWheel,
|
|
6032
|
-
params: ['handleWheel',
|
|
6047
|
+
params: ['handleWheel', DeltaMode, DeltaY],
|
|
6033
6048
|
passive: true
|
|
6034
6049
|
}, {
|
|
6035
6050
|
name: HandleDragOver,
|
|
6036
|
-
params: ['handleDragOver',
|
|
6051
|
+
params: ['handleDragOver', ClientX, ClientY],
|
|
6037
6052
|
preventDefault: true
|
|
6038
6053
|
}, {
|
|
6039
6054
|
name: HandleDrop,
|
|
6040
|
-
params: ['handleDrop',
|
|
6055
|
+
params: ['handleDrop', ClientX, ClientY, 'event.dataTransfer.files2', 'event.dataTransfer.files'],
|
|
6041
6056
|
preventDefault: true
|
|
6042
6057
|
}, {
|
|
6043
6058
|
name: HandleDragLeave,
|
|
@@ -6279,10 +6294,6 @@ const selectUp = state => {
|
|
|
6279
6294
|
};
|
|
6280
6295
|
};
|
|
6281
6296
|
|
|
6282
|
-
const terminate = () => {
|
|
6283
|
-
globalThis.close();
|
|
6284
|
-
};
|
|
6285
|
-
|
|
6286
6297
|
const getEditingIcon = async (editingType, value, direntType) => {
|
|
6287
6298
|
if (editingType === CreateFile) {
|
|
6288
6299
|
return invoke$1('IconTheme.getFileIcon', {
|