@lvce-editor/file-search-worker 5.12.0 → 5.14.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/fileSearchWorkerMain.js +83 -43
- package/package.json +1 -1
|
@@ -442,13 +442,13 @@ const create$4 = (method, params) => {
|
|
|
442
442
|
};
|
|
443
443
|
};
|
|
444
444
|
const callbacks = Object.create(null);
|
|
445
|
-
const set$
|
|
445
|
+
const set$4 = (id, fn) => {
|
|
446
446
|
callbacks[id] = fn;
|
|
447
447
|
};
|
|
448
448
|
const get$2 = id => {
|
|
449
449
|
return callbacks[id];
|
|
450
450
|
};
|
|
451
|
-
const remove
|
|
451
|
+
const remove = id => {
|
|
452
452
|
delete callbacks[id];
|
|
453
453
|
};
|
|
454
454
|
let id = 0;
|
|
@@ -461,7 +461,7 @@ const registerPromise = () => {
|
|
|
461
461
|
resolve,
|
|
462
462
|
promise
|
|
463
463
|
} = Promise.withResolvers();
|
|
464
|
-
set$
|
|
464
|
+
set$4(id, resolve);
|
|
465
465
|
return {
|
|
466
466
|
id,
|
|
467
467
|
promise
|
|
@@ -625,7 +625,7 @@ const resolve = (id, response) => {
|
|
|
625
625
|
return;
|
|
626
626
|
}
|
|
627
627
|
fn(response);
|
|
628
|
-
remove
|
|
628
|
+
remove(id);
|
|
629
629
|
};
|
|
630
630
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
631
631
|
const getErrorType = prettyError => {
|
|
@@ -772,7 +772,7 @@ const send = (transport, method, ...params) => {
|
|
|
772
772
|
const message = create$4(method, params);
|
|
773
773
|
transport.send(message);
|
|
774
774
|
};
|
|
775
|
-
const invoke$
|
|
775
|
+
const invoke$3 = (ipc, method, ...params) => {
|
|
776
776
|
return invokeHelper(ipc, method, params, false);
|
|
777
777
|
};
|
|
778
778
|
const invokeAndTransfer = (ipc, method, ...params) => {
|
|
@@ -805,7 +805,7 @@ const createRpc = ipc => {
|
|
|
805
805
|
send(ipc, method, ...params);
|
|
806
806
|
},
|
|
807
807
|
invoke(method, ...params) {
|
|
808
|
-
return invoke$
|
|
808
|
+
return invoke$3(ipc, method, ...params);
|
|
809
809
|
},
|
|
810
810
|
invokeAndTransfer(method, ...params) {
|
|
811
811
|
return invokeAndTransfer(ipc, method, ...params);
|
|
@@ -861,21 +861,31 @@ const WebWorkerRpcClient = {
|
|
|
861
861
|
create: create$3
|
|
862
862
|
};
|
|
863
863
|
|
|
864
|
-
const RendererWorker = 1;
|
|
865
|
-
|
|
866
864
|
const rpcs = Object.create(null);
|
|
867
|
-
const set$
|
|
865
|
+
const set$3 = (id, rpc) => {
|
|
868
866
|
rpcs[id] = rpc;
|
|
869
867
|
};
|
|
870
868
|
const get$1 = id => {
|
|
871
869
|
return rpcs[id];
|
|
872
870
|
};
|
|
873
|
-
|
|
874
|
-
const invoke$
|
|
875
|
-
const rpc = get$1(RendererWorker);
|
|
871
|
+
const RendererWorker$1 = 1;
|
|
872
|
+
const invoke$2 = (method, ...params) => {
|
|
873
|
+
const rpc = get$1(RendererWorker$1);
|
|
876
874
|
// @ts-ignore
|
|
877
875
|
return rpc.invoke(method, ...params);
|
|
878
876
|
};
|
|
877
|
+
const set$2 = rpc => {
|
|
878
|
+
set$3(RendererWorker$1, rpc);
|
|
879
|
+
};
|
|
880
|
+
const RendererWorker = {
|
|
881
|
+
__proto__: null,
|
|
882
|
+
invoke: invoke$2,
|
|
883
|
+
set: set$2
|
|
884
|
+
};
|
|
885
|
+
|
|
886
|
+
const {
|
|
887
|
+
invoke: invoke$1,
|
|
888
|
+
set: set$1} = RendererWorker;
|
|
879
889
|
|
|
880
890
|
const closeWidget = async id => {
|
|
881
891
|
await invoke$1('Viewlet.closeWidget', id);
|
|
@@ -906,8 +916,49 @@ const create$2 = () => {
|
|
|
906
916
|
newState
|
|
907
917
|
};
|
|
908
918
|
},
|
|
909
|
-
|
|
919
|
+
dispose(uid) {
|
|
910
920
|
delete states[uid];
|
|
921
|
+
},
|
|
922
|
+
getKeys() {
|
|
923
|
+
return Object.keys(states).map(key => {
|
|
924
|
+
return Number.parseInt(key);
|
|
925
|
+
});
|
|
926
|
+
},
|
|
927
|
+
clear() {
|
|
928
|
+
for (const key of Object.keys(states)) {
|
|
929
|
+
delete states[key];
|
|
930
|
+
}
|
|
931
|
+
},
|
|
932
|
+
wrapCommand(fn) {
|
|
933
|
+
const wrapped = async (uid, ...args) => {
|
|
934
|
+
const {
|
|
935
|
+
newState
|
|
936
|
+
} = states[uid];
|
|
937
|
+
const newerState = await fn(newState, ...args);
|
|
938
|
+
if (newState === newerState) {
|
|
939
|
+
return;
|
|
940
|
+
}
|
|
941
|
+
const latest = states[uid];
|
|
942
|
+
states[uid] = {
|
|
943
|
+
oldState: latest.oldState,
|
|
944
|
+
newState: newerState
|
|
945
|
+
};
|
|
946
|
+
};
|
|
947
|
+
return wrapped;
|
|
948
|
+
},
|
|
949
|
+
diff(uid, modules, numbers) {
|
|
950
|
+
const {
|
|
951
|
+
oldState,
|
|
952
|
+
newState
|
|
953
|
+
} = states[uid];
|
|
954
|
+
const diffResult = [];
|
|
955
|
+
for (let i = 0; i < modules.length; i++) {
|
|
956
|
+
const fn = modules[i];
|
|
957
|
+
if (!fn(oldState, newState)) {
|
|
958
|
+
diffResult.push(numbers[i]);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return diffResult;
|
|
911
962
|
}
|
|
912
963
|
};
|
|
913
964
|
};
|
|
@@ -915,7 +966,8 @@ const create$2 = () => {
|
|
|
915
966
|
const {
|
|
916
967
|
get,
|
|
917
968
|
set,
|
|
918
|
-
|
|
969
|
+
dispose: dispose$1,
|
|
970
|
+
wrapCommand
|
|
919
971
|
} = create$2();
|
|
920
972
|
|
|
921
973
|
const create$1 = ({
|
|
@@ -1071,7 +1123,7 @@ const diff2 = uid => {
|
|
|
1071
1123
|
};
|
|
1072
1124
|
|
|
1073
1125
|
const dispose = uid => {
|
|
1074
|
-
|
|
1126
|
+
dispose$1(uid);
|
|
1075
1127
|
};
|
|
1076
1128
|
|
|
1077
1129
|
const setColorTheme = id => {
|
|
@@ -2272,7 +2324,10 @@ const getPicks = (id, searchValue) => {
|
|
|
2272
2324
|
return fn(searchValue);
|
|
2273
2325
|
};
|
|
2274
2326
|
|
|
2275
|
-
const getQuickPickSubProviderId = prefix => {
|
|
2327
|
+
const getQuickPickSubProviderId = (id, prefix) => {
|
|
2328
|
+
if (id !== EveryThing$1) {
|
|
2329
|
+
return id;
|
|
2330
|
+
}
|
|
2276
2331
|
switch (prefix) {
|
|
2277
2332
|
case Command:
|
|
2278
2333
|
return Commands$1;
|
|
@@ -2306,7 +2361,7 @@ const setValue = async (state, newValue) => {
|
|
|
2306
2361
|
return state;
|
|
2307
2362
|
}
|
|
2308
2363
|
const prefix = getQuickPickPrefix(newValue);
|
|
2309
|
-
const subId = getQuickPickSubProviderId(prefix);
|
|
2364
|
+
const subId = getQuickPickSubProviderId(providerId, prefix);
|
|
2310
2365
|
const newPicks = await getPicks(subId, newValue);
|
|
2311
2366
|
const filterValue = getFilterValue(providerId, newValue);
|
|
2312
2367
|
const items = filterQuickPickItems(newPicks, filterValue);
|
|
@@ -2388,7 +2443,8 @@ const selectIndex = async (state, index, button = /* left */0) => {
|
|
|
2388
2443
|
const {
|
|
2389
2444
|
minLineY,
|
|
2390
2445
|
items,
|
|
2391
|
-
value
|
|
2446
|
+
value,
|
|
2447
|
+
providerId
|
|
2392
2448
|
} = state;
|
|
2393
2449
|
const actualIndex = index + minLineY;
|
|
2394
2450
|
const pick = getPick(items, actualIndex);
|
|
@@ -2396,7 +2452,7 @@ const selectIndex = async (state, index, button = /* left */0) => {
|
|
|
2396
2452
|
return state;
|
|
2397
2453
|
}
|
|
2398
2454
|
const prefix = getQuickPickPrefix(value);
|
|
2399
|
-
const subId = getQuickPickSubProviderId(prefix);
|
|
2455
|
+
const subId = getQuickPickSubProviderId(providerId, prefix);
|
|
2400
2456
|
const fn = getSelect(subId);
|
|
2401
2457
|
const selectPickResult = await fn(pick);
|
|
2402
2458
|
object(selectPickResult);
|
|
@@ -2510,7 +2566,7 @@ const loadContent = async state => {
|
|
|
2510
2566
|
const id = getQuickPickProviderId(uri);
|
|
2511
2567
|
const value = getDefaultValue(id);
|
|
2512
2568
|
const prefix = getQuickPickPrefix(value);
|
|
2513
|
-
const subId = getQuickPickSubProviderId(prefix);
|
|
2569
|
+
const subId = getQuickPickSubProviderId(id, prefix);
|
|
2514
2570
|
setArgs(subId, args);
|
|
2515
2571
|
const newPicks = await getPicks(subId, value);
|
|
2516
2572
|
array(newPicks);
|
|
@@ -2769,6 +2825,12 @@ const text = data => {
|
|
|
2769
2825
|
childCount: 0
|
|
2770
2826
|
};
|
|
2771
2827
|
};
|
|
2828
|
+
const px = value => {
|
|
2829
|
+
return `${value}px`;
|
|
2830
|
+
};
|
|
2831
|
+
const position = (x, y) => {
|
|
2832
|
+
return `${x}px ${y}px`;
|
|
2833
|
+
};
|
|
2772
2834
|
|
|
2773
2835
|
const quickPickHighlight = {
|
|
2774
2836
|
type: Span,
|
|
@@ -2870,13 +2932,6 @@ const getQuickPickItemsVirtualDom = visibleItems => {
|
|
|
2870
2932
|
return dom;
|
|
2871
2933
|
};
|
|
2872
2934
|
|
|
2873
|
-
const px = value => {
|
|
2874
|
-
return `${value}px`;
|
|
2875
|
-
};
|
|
2876
|
-
const position = (x, y) => {
|
|
2877
|
-
return `${x}px ${y}px`;
|
|
2878
|
-
};
|
|
2879
|
-
|
|
2880
2935
|
const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
|
|
2881
2936
|
const shouldShowScrollbar = scrollBarHeight > 0;
|
|
2882
2937
|
if (!shouldShowScrollbar) {
|
|
@@ -3025,21 +3080,6 @@ const selectItem = async (state, label) => {
|
|
|
3025
3080
|
return selectIndex(state, index);
|
|
3026
3081
|
};
|
|
3027
3082
|
|
|
3028
|
-
const wrapCommand = fn => {
|
|
3029
|
-
const wrapped = async (uid, ...args) => {
|
|
3030
|
-
const {
|
|
3031
|
-
newState
|
|
3032
|
-
} = get(uid);
|
|
3033
|
-
const newerState = await fn(newState, ...args);
|
|
3034
|
-
if (newState === newerState) {
|
|
3035
|
-
return;
|
|
3036
|
-
}
|
|
3037
|
-
const latest = get(uid);
|
|
3038
|
-
set(uid, latest.oldState, newerState);
|
|
3039
|
-
};
|
|
3040
|
-
return wrapped;
|
|
3041
|
-
};
|
|
3042
|
-
|
|
3043
3083
|
const commandMap = {
|
|
3044
3084
|
'QuickPick.addMenuEntries': add,
|
|
3045
3085
|
'QuickPick.close': close,
|
|
@@ -3133,7 +3173,7 @@ const listen = async () => {
|
|
|
3133
3173
|
const rpc = await WebWorkerRpcClient.create({
|
|
3134
3174
|
commandMap: commandMap
|
|
3135
3175
|
});
|
|
3136
|
-
set$1(
|
|
3176
|
+
set$1(rpc);
|
|
3137
3177
|
};
|
|
3138
3178
|
|
|
3139
3179
|
const main = async () => {
|