@lvce-editor/extension-search-view 6.4.0 → 7.1.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/extensionSearchViewWorkerMain.js +512 -161
- package/package.json +1 -1
|
@@ -456,7 +456,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
456
456
|
return promise;
|
|
457
457
|
};
|
|
458
458
|
const Message$1 = 3;
|
|
459
|
-
const create$5
|
|
459
|
+
const create$5 = async ({
|
|
460
460
|
isMessagePortOpen,
|
|
461
461
|
messagePort
|
|
462
462
|
}) => {
|
|
@@ -507,61 +507,19 @@ const wrap$5 = messagePort => {
|
|
|
507
507
|
};
|
|
508
508
|
const IpcParentWithMessagePort$1 = {
|
|
509
509
|
__proto__: null,
|
|
510
|
-
create: create$5
|
|
510
|
+
create: create$5,
|
|
511
511
|
signal: signal$1,
|
|
512
512
|
wrap: wrap$5
|
|
513
513
|
};
|
|
514
514
|
|
|
515
|
-
const Two = '2.0';
|
|
516
|
-
const create$4$1 = (method, params) => {
|
|
517
|
-
return {
|
|
518
|
-
jsonrpc: Two,
|
|
519
|
-
method,
|
|
520
|
-
params
|
|
521
|
-
};
|
|
522
|
-
};
|
|
515
|
+
const Two$1 = '2.0';
|
|
523
516
|
const callbacks = Object.create(null);
|
|
524
|
-
const set$6 = (id, fn) => {
|
|
525
|
-
callbacks[id] = fn;
|
|
526
|
-
};
|
|
527
517
|
const get$2 = id => {
|
|
528
518
|
return callbacks[id];
|
|
529
519
|
};
|
|
530
|
-
const remove = id => {
|
|
520
|
+
const remove$1 = id => {
|
|
531
521
|
delete callbacks[id];
|
|
532
522
|
};
|
|
533
|
-
let id$1 = 0;
|
|
534
|
-
const create$3$1 = () => {
|
|
535
|
-
return ++id$1;
|
|
536
|
-
};
|
|
537
|
-
const registerPromise = () => {
|
|
538
|
-
const id = create$3$1();
|
|
539
|
-
const {
|
|
540
|
-
resolve,
|
|
541
|
-
promise
|
|
542
|
-
} = Promise.withResolvers();
|
|
543
|
-
set$6(id, resolve);
|
|
544
|
-
return {
|
|
545
|
-
id,
|
|
546
|
-
promise
|
|
547
|
-
};
|
|
548
|
-
};
|
|
549
|
-
const create$2$1 = (method, params) => {
|
|
550
|
-
const {
|
|
551
|
-
id,
|
|
552
|
-
promise
|
|
553
|
-
} = registerPromise();
|
|
554
|
-
const message = {
|
|
555
|
-
jsonrpc: Two,
|
|
556
|
-
method,
|
|
557
|
-
params,
|
|
558
|
-
id
|
|
559
|
-
};
|
|
560
|
-
return {
|
|
561
|
-
message,
|
|
562
|
-
promise
|
|
563
|
-
};
|
|
564
|
-
};
|
|
565
523
|
class JsonRpcError extends Error {
|
|
566
524
|
constructor(message) {
|
|
567
525
|
super(message);
|
|
@@ -712,7 +670,7 @@ const resolve = (id, response) => {
|
|
|
712
670
|
return;
|
|
713
671
|
}
|
|
714
672
|
fn(response);
|
|
715
|
-
remove(id);
|
|
673
|
+
remove$1(id);
|
|
716
674
|
};
|
|
717
675
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
|
718
676
|
const getErrorType = prettyError => {
|
|
@@ -755,9 +713,9 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
755
713
|
}
|
|
756
714
|
};
|
|
757
715
|
};
|
|
758
|
-
const create$1$
|
|
716
|
+
const create$1$2 = (id, error) => {
|
|
759
717
|
return {
|
|
760
|
-
jsonrpc: Two,
|
|
718
|
+
jsonrpc: Two$1,
|
|
761
719
|
id,
|
|
762
720
|
error
|
|
763
721
|
};
|
|
@@ -766,22 +724,22 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
766
724
|
const prettyError = preparePrettyError(error);
|
|
767
725
|
logError(error, prettyError);
|
|
768
726
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
769
|
-
return create$1$
|
|
727
|
+
return create$1$2(id, errorProperty);
|
|
770
728
|
};
|
|
771
|
-
const create$
|
|
729
|
+
const create$3 = (message, result) => {
|
|
772
730
|
return {
|
|
773
|
-
jsonrpc: Two,
|
|
731
|
+
jsonrpc: Two$1,
|
|
774
732
|
id: message.id,
|
|
775
733
|
result: result ?? null
|
|
776
734
|
};
|
|
777
735
|
};
|
|
778
736
|
const getSuccessResponse = (message, result) => {
|
|
779
737
|
const resultProperty = result ?? null;
|
|
780
|
-
return create$
|
|
738
|
+
return create$3(message, resultProperty);
|
|
781
739
|
};
|
|
782
740
|
const getErrorResponseSimple = (id, error) => {
|
|
783
741
|
return {
|
|
784
|
-
jsonrpc: Two,
|
|
742
|
+
jsonrpc: Two$1,
|
|
785
743
|
id,
|
|
786
744
|
error: {
|
|
787
745
|
code: Custom,
|
|
@@ -868,29 +826,6 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
868
826
|
}
|
|
869
827
|
throw new JsonRpcError('unexpected message');
|
|
870
828
|
};
|
|
871
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
872
|
-
const {
|
|
873
|
-
message,
|
|
874
|
-
promise
|
|
875
|
-
} = create$2$1(method, params);
|
|
876
|
-
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
877
|
-
ipc.sendAndTransfer(message);
|
|
878
|
-
} else {
|
|
879
|
-
ipc.send(message);
|
|
880
|
-
}
|
|
881
|
-
const responseMessage = await promise;
|
|
882
|
-
return unwrapJsonRpcResult(responseMessage);
|
|
883
|
-
};
|
|
884
|
-
const send = (transport, method, ...params) => {
|
|
885
|
-
const message = create$4$1(method, params);
|
|
886
|
-
transport.send(message);
|
|
887
|
-
};
|
|
888
|
-
const invoke$3 = (ipc, method, ...params) => {
|
|
889
|
-
return invokeHelper(ipc, method, params, false);
|
|
890
|
-
};
|
|
891
|
-
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
892
|
-
return invokeHelper(ipc, method, params, true);
|
|
893
|
-
};
|
|
894
829
|
|
|
895
830
|
class CommandNotFoundError extends Error {
|
|
896
831
|
constructor(command) {
|
|
@@ -913,24 +848,87 @@ const execute = (command, ...args) => {
|
|
|
913
848
|
return fn(...args);
|
|
914
849
|
};
|
|
915
850
|
|
|
851
|
+
const Two = '2.0';
|
|
852
|
+
const create$s = (method, params) => {
|
|
853
|
+
return {
|
|
854
|
+
jsonrpc: Two,
|
|
855
|
+
method,
|
|
856
|
+
params
|
|
857
|
+
};
|
|
858
|
+
};
|
|
859
|
+
const create$r = (id, method, params) => {
|
|
860
|
+
const message = {
|
|
861
|
+
id,
|
|
862
|
+
jsonrpc: Two,
|
|
863
|
+
method,
|
|
864
|
+
params
|
|
865
|
+
};
|
|
866
|
+
return message;
|
|
867
|
+
};
|
|
868
|
+
let id$1 = 0;
|
|
869
|
+
const create$q = () => {
|
|
870
|
+
return ++id$1;
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
874
|
+
|
|
875
|
+
const registerPromise = map => {
|
|
876
|
+
const id = create$q();
|
|
877
|
+
const {
|
|
878
|
+
promise,
|
|
879
|
+
resolve
|
|
880
|
+
} = Promise.withResolvers();
|
|
881
|
+
map[id] = resolve;
|
|
882
|
+
return {
|
|
883
|
+
id,
|
|
884
|
+
promise
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
|
|
888
|
+
// @ts-ignore
|
|
889
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
890
|
+
const {
|
|
891
|
+
id,
|
|
892
|
+
promise
|
|
893
|
+
} = registerPromise(callbacks);
|
|
894
|
+
const message = create$r(id, method, params);
|
|
895
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
896
|
+
ipc.sendAndTransfer(message);
|
|
897
|
+
} else {
|
|
898
|
+
ipc.send(message);
|
|
899
|
+
}
|
|
900
|
+
const responseMessage = await promise;
|
|
901
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
902
|
+
};
|
|
916
903
|
const createRpc = ipc => {
|
|
904
|
+
const callbacks = Object.create(null);
|
|
905
|
+
ipc._resolve = (id, response) => {
|
|
906
|
+
const fn = callbacks[id];
|
|
907
|
+
if (!fn) {
|
|
908
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
fn(response);
|
|
912
|
+
delete callbacks[id];
|
|
913
|
+
};
|
|
917
914
|
const rpc = {
|
|
915
|
+
async dispose() {
|
|
916
|
+
await ipc?.dispose();
|
|
917
|
+
},
|
|
918
|
+
invoke(method, ...params) {
|
|
919
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
920
|
+
},
|
|
921
|
+
invokeAndTransfer(method, ...params) {
|
|
922
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
923
|
+
},
|
|
918
924
|
// @ts-ignore
|
|
919
925
|
ipc,
|
|
920
926
|
/**
|
|
921
927
|
* @deprecated
|
|
922
928
|
*/
|
|
923
929
|
send(method, ...params) {
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
invoke(method, ...params) {
|
|
927
|
-
return invoke$3(ipc, method, ...params);
|
|
928
|
-
},
|
|
929
|
-
invokeAndTransfer(method, ...params) {
|
|
930
|
-
return invokeAndTransfer$2(ipc, method, ...params);
|
|
931
|
-
},
|
|
932
|
-
async dispose() {
|
|
933
|
-
await ipc?.dispose();
|
|
930
|
+
const message = create$s(method, params);
|
|
931
|
+
ipc.send(message);
|
|
934
932
|
}
|
|
935
933
|
};
|
|
936
934
|
return rpc;
|
|
@@ -947,7 +945,7 @@ const logError = () => {
|
|
|
947
945
|
const handleMessage = event => {
|
|
948
946
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket;
|
|
949
947
|
const actualExecute = event?.target?.execute || execute;
|
|
950
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
948
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
|
|
951
949
|
};
|
|
952
950
|
const handleIpc = ipc => {
|
|
953
951
|
if ('addEventListener' in ipc) {
|
|
@@ -965,15 +963,16 @@ const listen$1 = async (module, options) => {
|
|
|
965
963
|
const ipc = module.wrap(rawIpc);
|
|
966
964
|
return ipc;
|
|
967
965
|
};
|
|
968
|
-
const create$
|
|
966
|
+
const create$4 = async ({
|
|
969
967
|
commandMap,
|
|
968
|
+
isMessagePortOpen = true,
|
|
970
969
|
messagePort
|
|
971
970
|
}) => {
|
|
972
971
|
// TODO create a commandMap per rpc instance
|
|
973
972
|
register(commandMap);
|
|
974
973
|
const rawIpc = await IpcParentWithMessagePort$1.create({
|
|
975
|
-
|
|
976
|
-
|
|
974
|
+
isMessagePortOpen,
|
|
975
|
+
messagePort
|
|
977
976
|
});
|
|
978
977
|
const ipc = IpcParentWithMessagePort$1.wrap(rawIpc);
|
|
979
978
|
handleIpc(ipc);
|
|
@@ -981,8 +980,9 @@ const create$5 = async ({
|
|
|
981
980
|
messagePort.start();
|
|
982
981
|
return rpc;
|
|
983
982
|
};
|
|
984
|
-
const create$
|
|
983
|
+
const create$2$1 = async ({
|
|
985
984
|
commandMap,
|
|
985
|
+
isMessagePortOpen,
|
|
986
986
|
send
|
|
987
987
|
}) => {
|
|
988
988
|
const {
|
|
@@ -990,16 +990,17 @@ const create$3 = async ({
|
|
|
990
990
|
port2
|
|
991
991
|
} = new MessageChannel();
|
|
992
992
|
await send(port1);
|
|
993
|
-
return create$
|
|
993
|
+
return create$4({
|
|
994
994
|
commandMap,
|
|
995
|
+
isMessagePortOpen,
|
|
995
996
|
messagePort: port2
|
|
996
997
|
});
|
|
997
998
|
};
|
|
998
999
|
const TransferMessagePortRpcParent = {
|
|
999
1000
|
__proto__: null,
|
|
1000
|
-
create: create$
|
|
1001
|
+
create: create$2$1
|
|
1001
1002
|
};
|
|
1002
|
-
const create$
|
|
1003
|
+
const create$1$1 = async ({
|
|
1003
1004
|
commandMap
|
|
1004
1005
|
}) => {
|
|
1005
1006
|
// TODO create a commandMap per rpc instance
|
|
@@ -1011,7 +1012,7 @@ const create$4 = async ({
|
|
|
1011
1012
|
};
|
|
1012
1013
|
const WebWorkerRpcClient = {
|
|
1013
1014
|
__proto__: null,
|
|
1014
|
-
create: create$
|
|
1015
|
+
create: create$1$1
|
|
1015
1016
|
};
|
|
1016
1017
|
const createMockRpc = ({
|
|
1017
1018
|
commandMap
|
|
@@ -1026,14 +1027,22 @@ const createMockRpc = ({
|
|
|
1026
1027
|
return command(...params);
|
|
1027
1028
|
};
|
|
1028
1029
|
const mockRpc = {
|
|
1030
|
+
invocations,
|
|
1029
1031
|
invoke,
|
|
1030
|
-
invokeAndTransfer: invoke
|
|
1031
|
-
invocations
|
|
1032
|
+
invokeAndTransfer: invoke
|
|
1032
1033
|
};
|
|
1033
1034
|
return mockRpc;
|
|
1034
1035
|
};
|
|
1035
1036
|
|
|
1036
|
-
const
|
|
1037
|
+
const None$3 = 'none';
|
|
1038
|
+
|
|
1039
|
+
const Button$2 = 1;
|
|
1040
|
+
const Div = 4;
|
|
1041
|
+
const Input$1 = 6;
|
|
1042
|
+
const Text = 12;
|
|
1043
|
+
const Img = 17;
|
|
1044
|
+
|
|
1045
|
+
const Button$1 = 'event.button';
|
|
1037
1046
|
const ClientX = 'event.clientX';
|
|
1038
1047
|
const ClientY = 'event.clientY';
|
|
1039
1048
|
const DeltaMode = 'event.deltaMode';
|
|
@@ -1045,11 +1054,16 @@ const Script$1 = 2;
|
|
|
1045
1054
|
const ManageExtension = 8;
|
|
1046
1055
|
const ExtensionSearchFilter = 95;
|
|
1047
1056
|
|
|
1057
|
+
const LeftClick = 0;
|
|
1058
|
+
|
|
1048
1059
|
const ExtensionHostWorker = 44;
|
|
1049
1060
|
const ExtensionManagementWorker = 9006;
|
|
1050
1061
|
const RendererWorker = 1;
|
|
1051
1062
|
|
|
1052
1063
|
const FocusSelector = 'Viewlet.focusSelector';
|
|
1064
|
+
const SetCss = 'Viewlet.setCss';
|
|
1065
|
+
const SetDom2 = 'Viewlet.setDom2';
|
|
1066
|
+
const SetPatches = 'Viewlet.setPatches';
|
|
1053
1067
|
|
|
1054
1068
|
const rpcs = Object.create(null);
|
|
1055
1069
|
const set$5 = (id, rpc) => {
|
|
@@ -1058,7 +1072,11 @@ const set$5 = (id, rpc) => {
|
|
|
1058
1072
|
const get$1 = id => {
|
|
1059
1073
|
return rpcs[id];
|
|
1060
1074
|
};
|
|
1075
|
+
const remove = id => {
|
|
1076
|
+
delete rpcs[id];
|
|
1077
|
+
};
|
|
1061
1078
|
|
|
1079
|
+
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
1062
1080
|
const create$2 = rpcId => {
|
|
1063
1081
|
return {
|
|
1064
1082
|
async dispose() {
|
|
@@ -1077,6 +1095,18 @@ const create$2 = rpcId => {
|
|
|
1077
1095
|
// @ts-ignore
|
|
1078
1096
|
return rpc.invokeAndTransfer(method, ...params);
|
|
1079
1097
|
},
|
|
1098
|
+
registerMockRpc(commandMap) {
|
|
1099
|
+
const mockRpc = createMockRpc({
|
|
1100
|
+
commandMap
|
|
1101
|
+
});
|
|
1102
|
+
set$5(rpcId, mockRpc);
|
|
1103
|
+
// @ts-ignore
|
|
1104
|
+
mockRpc[Symbol.dispose] = () => {
|
|
1105
|
+
remove(rpcId);
|
|
1106
|
+
};
|
|
1107
|
+
// @ts-ignore
|
|
1108
|
+
return mockRpc;
|
|
1109
|
+
},
|
|
1080
1110
|
set(rpc) {
|
|
1081
1111
|
set$5(rpcId, rpc);
|
|
1082
1112
|
}
|
|
@@ -1087,6 +1117,7 @@ const {
|
|
|
1087
1117
|
dispose: dispose$2,
|
|
1088
1118
|
invoke: invoke$2,
|
|
1089
1119
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
1120
|
+
registerMockRpc,
|
|
1090
1121
|
set: set$4
|
|
1091
1122
|
} = create$2(ExtensionHostWorker);
|
|
1092
1123
|
const executeReferenceProvider = async (id, offset) => {
|
|
@@ -1101,12 +1132,9 @@ const getRuntimeStatus = async extensionId => {
|
|
|
1101
1132
|
// @ts-ignore
|
|
1102
1133
|
return invoke$2('ExtensionHost.getRuntimeStatus', extensionId);
|
|
1103
1134
|
};
|
|
1104
|
-
const
|
|
1105
|
-
const
|
|
1106
|
-
|
|
1107
|
-
});
|
|
1108
|
-
set$4(mockRpc);
|
|
1109
|
-
return mockRpc;
|
|
1135
|
+
const getEnabledOutputProviderIds = async () => {
|
|
1136
|
+
const channels = await invoke$2('Output.getEnabledProviders');
|
|
1137
|
+
return channels;
|
|
1110
1138
|
};
|
|
1111
1139
|
|
|
1112
1140
|
const ExtensionHost = {
|
|
@@ -1114,6 +1142,7 @@ const ExtensionHost = {
|
|
|
1114
1142
|
dispose: dispose$2,
|
|
1115
1143
|
executeFileReferenceProvider,
|
|
1116
1144
|
executeReferenceProvider,
|
|
1145
|
+
getEnabledOutputProviderIds,
|
|
1117
1146
|
getRuntimeStatus,
|
|
1118
1147
|
invoke: invoke$2,
|
|
1119
1148
|
invokeAndTransfer: invokeAndTransfer$1,
|
|
@@ -1238,8 +1267,8 @@ const terminate = () => {
|
|
|
1238
1267
|
globalThis.close();
|
|
1239
1268
|
};
|
|
1240
1269
|
|
|
1241
|
-
const None$
|
|
1242
|
-
const Input
|
|
1270
|
+
const None$2 = 0;
|
|
1271
|
+
const Input = 1;
|
|
1243
1272
|
const List$2 = 2;
|
|
1244
1273
|
|
|
1245
1274
|
const handleError = async (error, notify = true, prefix = '') => {
|
|
@@ -1399,7 +1428,7 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
1399
1428
|
return finalDeltaY;
|
|
1400
1429
|
};
|
|
1401
1430
|
|
|
1402
|
-
const Button
|
|
1431
|
+
const Button = 1;
|
|
1403
1432
|
|
|
1404
1433
|
const HandleClearSearchResults = 1;
|
|
1405
1434
|
const HandleClickFilter = 2;
|
|
@@ -1429,13 +1458,13 @@ const getInputActions = hasValue => {
|
|
|
1429
1458
|
icon: `MaskIcon${ClearAll}`,
|
|
1430
1459
|
onClick: HandleClearSearchResults,
|
|
1431
1460
|
title: clearExtensionSearchResults(),
|
|
1432
|
-
type: Button
|
|
1461
|
+
type: Button
|
|
1433
1462
|
}, {
|
|
1434
1463
|
enabled: true,
|
|
1435
1464
|
icon: `MaskIcon${Filter}`,
|
|
1436
1465
|
onClick: HandleClickFilter,
|
|
1437
1466
|
title: filter(),
|
|
1438
|
-
type: Button
|
|
1467
|
+
type: Button
|
|
1439
1468
|
}];
|
|
1440
1469
|
return actions;
|
|
1441
1470
|
};
|
|
@@ -1641,7 +1670,7 @@ const handleChange = async (state, update) => {
|
|
|
1641
1670
|
allExtensions,
|
|
1642
1671
|
deltaY: 0,
|
|
1643
1672
|
finalDeltaY: 0,
|
|
1644
|
-
focus: Input
|
|
1673
|
+
focus: Input,
|
|
1645
1674
|
inputActions,
|
|
1646
1675
|
inputSource,
|
|
1647
1676
|
items,
|
|
@@ -1693,7 +1722,7 @@ const handleChange = async (state, update) => {
|
|
|
1693
1722
|
const clearSearchResults = state => {
|
|
1694
1723
|
return handleChange(state, {
|
|
1695
1724
|
...state,
|
|
1696
|
-
focus: Input
|
|
1725
|
+
focus: Input,
|
|
1697
1726
|
inputSource: Script$1,
|
|
1698
1727
|
searchValue: ''
|
|
1699
1728
|
});
|
|
@@ -1800,6 +1829,7 @@ const create = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1800
1829
|
handleOffset: 0,
|
|
1801
1830
|
headerHeight: 41,
|
|
1802
1831
|
height,
|
|
1832
|
+
initial: true,
|
|
1803
1833
|
inputActions: [],
|
|
1804
1834
|
inputSource: 0,
|
|
1805
1835
|
itemHeight: 72,
|
|
@@ -1825,6 +1855,10 @@ const create = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
1825
1855
|
set$1(id, state, state);
|
|
1826
1856
|
};
|
|
1827
1857
|
|
|
1858
|
+
const isEqual$3 = (oldState, newState) => {
|
|
1859
|
+
return newState.scrollBarHeight === newState.scrollBarHeight && oldState.scrollBarY === newState.scrollBarY && oldState.initial === newState.initial && oldState.deltaY === newState.deltaY;
|
|
1860
|
+
};
|
|
1861
|
+
|
|
1828
1862
|
const isEqual$2 = (oldState, newState) => {
|
|
1829
1863
|
if (!newState.focus) {
|
|
1830
1864
|
return true;
|
|
@@ -1850,9 +1884,11 @@ const RenderScrollBar = 5;
|
|
|
1850
1884
|
const RenderMessage = 6;
|
|
1851
1885
|
const RenderSearchValue = 7;
|
|
1852
1886
|
const RenderFocusContext = 8;
|
|
1887
|
+
const RenderIncremental = 9;
|
|
1888
|
+
const RenderCss = 10;
|
|
1853
1889
|
|
|
1854
|
-
const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2];
|
|
1855
|
-
const numbers = [
|
|
1890
|
+
const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2, isEqual$3];
|
|
1891
|
+
const numbers = [RenderIncremental, RenderFocus, RenderSearchValue, RenderFocusContext, RenderCss];
|
|
1856
1892
|
|
|
1857
1893
|
const diff2 = uid => {
|
|
1858
1894
|
return diff(uid, modules, numbers);
|
|
@@ -2037,12 +2073,12 @@ const getActions = () => {
|
|
|
2037
2073
|
command: '',
|
|
2038
2074
|
icon: Refresh,
|
|
2039
2075
|
id: refresh(),
|
|
2040
|
-
type: Button
|
|
2076
|
+
type: Button
|
|
2041
2077
|
}, {
|
|
2042
2078
|
command: '',
|
|
2043
2079
|
icon: Ellipsis,
|
|
2044
2080
|
id: viewsAndMoreActions(),
|
|
2045
|
-
type: Button
|
|
2081
|
+
type: Button
|
|
2046
2082
|
}];
|
|
2047
2083
|
};
|
|
2048
2084
|
|
|
@@ -2105,18 +2141,18 @@ const getKeyBindings = () => {
|
|
|
2105
2141
|
};
|
|
2106
2142
|
|
|
2107
2143
|
const Separator = 1;
|
|
2108
|
-
const None$
|
|
2144
|
+
const None$1 = 0;
|
|
2109
2145
|
const SubMenu = 4;
|
|
2110
2146
|
|
|
2111
2147
|
const getMenuEntries = () => {
|
|
2112
2148
|
return [{
|
|
2113
2149
|
command: 'SearchExtensions.enable',
|
|
2114
|
-
flags: None$
|
|
2150
|
+
flags: None$1,
|
|
2115
2151
|
id: 'enable',
|
|
2116
2152
|
label: enable()
|
|
2117
2153
|
}, {
|
|
2118
2154
|
command: 'SearchExtensions.enableWorkspace',
|
|
2119
|
-
flags: None$
|
|
2155
|
+
flags: None$1,
|
|
2120
2156
|
id: 'enableWorkspace',
|
|
2121
2157
|
label: enableWorkspace()
|
|
2122
2158
|
}, {
|
|
@@ -2126,12 +2162,12 @@ const getMenuEntries = () => {
|
|
|
2126
2162
|
label: ''
|
|
2127
2163
|
}, {
|
|
2128
2164
|
command: 'SearchExtensions.disable',
|
|
2129
|
-
flags: None$
|
|
2165
|
+
flags: None$1,
|
|
2130
2166
|
id: 'disable',
|
|
2131
2167
|
label: disable()
|
|
2132
2168
|
}, {
|
|
2133
2169
|
command: 'SearchExtensions.disableWorkspace',
|
|
2134
|
-
flags: None$
|
|
2170
|
+
flags: None$1,
|
|
2135
2171
|
id: 'disableWorkspace',
|
|
2136
2172
|
label: disableWorkspace()
|
|
2137
2173
|
}, {
|
|
@@ -2141,17 +2177,17 @@ const getMenuEntries = () => {
|
|
|
2141
2177
|
label: ''
|
|
2142
2178
|
}, {
|
|
2143
2179
|
command: 'SearchExtensions.installAnotherVersion',
|
|
2144
|
-
flags: None$
|
|
2180
|
+
flags: None$1,
|
|
2145
2181
|
id: 'installAnotherVersion',
|
|
2146
2182
|
label: installAnotherVersion()
|
|
2147
2183
|
}, {
|
|
2148
2184
|
command: 'Extensions.copyExtensionInfo',
|
|
2149
|
-
flags: None$
|
|
2185
|
+
flags: None$1,
|
|
2150
2186
|
id: 'copy',
|
|
2151
2187
|
label: copy()
|
|
2152
2188
|
}, {
|
|
2153
2189
|
command: 'Extensions.copyExtensionId',
|
|
2154
|
-
flags: None$
|
|
2190
|
+
flags: None$1,
|
|
2155
2191
|
id: 'copyExtensionId',
|
|
2156
2192
|
label: copyExtensionId$1()
|
|
2157
2193
|
}];
|
|
@@ -2160,27 +2196,27 @@ const getMenuEntries = () => {
|
|
|
2160
2196
|
const getMenuEntriesFilter = () => {
|
|
2161
2197
|
return [{
|
|
2162
2198
|
command: 'SearchExtensions.filterByFeatured',
|
|
2163
|
-
flags: None$
|
|
2199
|
+
flags: None$1,
|
|
2164
2200
|
id: 'filterByFeatured',
|
|
2165
2201
|
label: featured()
|
|
2166
2202
|
}, {
|
|
2167
2203
|
command: 'SearchExtensions.filterByMcpServers',
|
|
2168
|
-
flags: None$
|
|
2204
|
+
flags: None$1,
|
|
2169
2205
|
id: 'filterByMcpServers',
|
|
2170
2206
|
label: mcpServers()
|
|
2171
2207
|
}, {
|
|
2172
2208
|
command: 'SearchExtensions.filterByMostPopular',
|
|
2173
|
-
flags: None$
|
|
2209
|
+
flags: None$1,
|
|
2174
2210
|
id: 'filterByMostPopular',
|
|
2175
2211
|
label: mostPopular()
|
|
2176
2212
|
}, {
|
|
2177
2213
|
command: 'SearchExtensions.filterByRecentlyPublished',
|
|
2178
|
-
flags: None$
|
|
2214
|
+
flags: None$1,
|
|
2179
2215
|
id: 'filterByRecentlyPublished',
|
|
2180
2216
|
label: recentlyPublished()
|
|
2181
2217
|
}, {
|
|
2182
2218
|
command: 'SearchExtensions.filterByRecommended',
|
|
2183
|
-
flags: None$
|
|
2219
|
+
flags: None$1,
|
|
2184
2220
|
id: 'filterByRecommended',
|
|
2185
2221
|
label: recommended()
|
|
2186
2222
|
}, {
|
|
@@ -2195,32 +2231,32 @@ const getMenuEntriesFilter = () => {
|
|
|
2195
2231
|
label: category()
|
|
2196
2232
|
}, {
|
|
2197
2233
|
command: 'SearchExtensions.filterByInstalled',
|
|
2198
|
-
flags: None$
|
|
2234
|
+
flags: None$1,
|
|
2199
2235
|
id: 'filterByInstalled',
|
|
2200
2236
|
label: installed()
|
|
2201
2237
|
}, {
|
|
2202
2238
|
command: 'SearchExtensions.filterByUpdates',
|
|
2203
|
-
flags: None$
|
|
2239
|
+
flags: None$1,
|
|
2204
2240
|
id: 'filterByUpdates',
|
|
2205
2241
|
label: updates()
|
|
2206
2242
|
}, {
|
|
2207
2243
|
command: 'SearchExtensions.filterByBuiltin',
|
|
2208
|
-
flags: None$
|
|
2244
|
+
flags: None$1,
|
|
2209
2245
|
id: 'filterByBuiltin',
|
|
2210
2246
|
label: builtIn()
|
|
2211
2247
|
}, {
|
|
2212
2248
|
command: 'SearchExtensions.filterByEnabled',
|
|
2213
|
-
flags: None$
|
|
2249
|
+
flags: None$1,
|
|
2214
2250
|
id: 'filterByEnabled',
|
|
2215
2251
|
label: enabled()
|
|
2216
2252
|
}, {
|
|
2217
2253
|
command: 'SearchExtensions.filterByDisabled',
|
|
2218
|
-
flags: None$
|
|
2254
|
+
flags: None$1,
|
|
2219
2255
|
id: 'filterByDisabled',
|
|
2220
2256
|
label: disabled()
|
|
2221
2257
|
}, {
|
|
2222
2258
|
command: 'SearchExtensions.filterByWorkspaceUnsupported',
|
|
2223
|
-
flags: None$
|
|
2259
|
+
flags: None$1,
|
|
2224
2260
|
id: 'filterByWorkspaceUnsupported',
|
|
2225
2261
|
label: workspaceUnsupported()
|
|
2226
2262
|
}, {
|
|
@@ -2255,7 +2291,7 @@ const getMenuIds = () => {
|
|
|
2255
2291
|
const handleBlur = state => {
|
|
2256
2292
|
return {
|
|
2257
2293
|
...state,
|
|
2258
|
-
focus: None$
|
|
2294
|
+
focus: None$2
|
|
2259
2295
|
};
|
|
2260
2296
|
};
|
|
2261
2297
|
|
|
@@ -2291,28 +2327,295 @@ const handleClick = async (state, index) => {
|
|
|
2291
2327
|
return newState;
|
|
2292
2328
|
};
|
|
2293
2329
|
|
|
2294
|
-
const None$1 = 'none';
|
|
2295
|
-
|
|
2296
|
-
const Button = 1;
|
|
2297
|
-
const Div = 4;
|
|
2298
|
-
const Input = 6;
|
|
2299
|
-
const Text = 12;
|
|
2300
|
-
const Img = 17;
|
|
2301
|
-
|
|
2302
|
-
const LeftClick = 0;
|
|
2303
|
-
|
|
2304
2330
|
const mergeClassNames = (...classNames) => {
|
|
2305
2331
|
return classNames.filter(Boolean).join(' ');
|
|
2306
2332
|
};
|
|
2307
2333
|
|
|
2308
2334
|
const text = data => {
|
|
2309
2335
|
return {
|
|
2310
|
-
|
|
2336
|
+
childCount: 0,
|
|
2311
2337
|
text: data,
|
|
2312
|
-
|
|
2338
|
+
type: Text
|
|
2339
|
+
};
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
const SetText = 1;
|
|
2343
|
+
const Replace = 2;
|
|
2344
|
+
const SetAttribute = 3;
|
|
2345
|
+
const RemoveAttribute = 4;
|
|
2346
|
+
const Add = 6;
|
|
2347
|
+
const NavigateChild = 7;
|
|
2348
|
+
const NavigateParent = 8;
|
|
2349
|
+
const RemoveChild = 9;
|
|
2350
|
+
const NavigateSibling = 10;
|
|
2351
|
+
|
|
2352
|
+
const isKey = key => {
|
|
2353
|
+
return key !== 'type' && key !== 'childCount';
|
|
2354
|
+
};
|
|
2355
|
+
|
|
2356
|
+
const getKeys = node => {
|
|
2357
|
+
const keys = Object.keys(node).filter(isKey);
|
|
2358
|
+
return keys;
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
const arrayToTree = nodes => {
|
|
2362
|
+
const result = [];
|
|
2363
|
+
let i = 0;
|
|
2364
|
+
while (i < nodes.length) {
|
|
2365
|
+
const node = nodes[i];
|
|
2366
|
+
const {
|
|
2367
|
+
children,
|
|
2368
|
+
nodesConsumed
|
|
2369
|
+
} = getChildrenWithCount(nodes, i + 1, node.childCount || 0);
|
|
2370
|
+
result.push({
|
|
2371
|
+
node,
|
|
2372
|
+
children
|
|
2373
|
+
});
|
|
2374
|
+
i += 1 + nodesConsumed;
|
|
2375
|
+
}
|
|
2376
|
+
return result;
|
|
2377
|
+
};
|
|
2378
|
+
const getChildrenWithCount = (nodes, startIndex, childCount) => {
|
|
2379
|
+
if (childCount === 0) {
|
|
2380
|
+
return {
|
|
2381
|
+
children: [],
|
|
2382
|
+
nodesConsumed: 0
|
|
2383
|
+
};
|
|
2384
|
+
}
|
|
2385
|
+
const children = [];
|
|
2386
|
+
let i = startIndex;
|
|
2387
|
+
let remaining = childCount;
|
|
2388
|
+
let totalConsumed = 0;
|
|
2389
|
+
while (remaining > 0 && i < nodes.length) {
|
|
2390
|
+
const node = nodes[i];
|
|
2391
|
+
const nodeChildCount = node.childCount || 0;
|
|
2392
|
+
const {
|
|
2393
|
+
children: nodeChildren,
|
|
2394
|
+
nodesConsumed
|
|
2395
|
+
} = getChildrenWithCount(nodes, i + 1, nodeChildCount);
|
|
2396
|
+
children.push({
|
|
2397
|
+
node,
|
|
2398
|
+
children: nodeChildren
|
|
2399
|
+
});
|
|
2400
|
+
const nodeSize = 1 + nodesConsumed;
|
|
2401
|
+
i += nodeSize;
|
|
2402
|
+
totalConsumed += nodeSize;
|
|
2403
|
+
remaining--;
|
|
2404
|
+
}
|
|
2405
|
+
return {
|
|
2406
|
+
children,
|
|
2407
|
+
nodesConsumed: totalConsumed
|
|
2313
2408
|
};
|
|
2314
2409
|
};
|
|
2315
2410
|
|
|
2411
|
+
const compareNodes = (oldNode, newNode) => {
|
|
2412
|
+
const patches = [];
|
|
2413
|
+
// Check if node type changed - return null to signal incompatible nodes
|
|
2414
|
+
// (caller should handle this with a Replace operation)
|
|
2415
|
+
if (oldNode.type !== newNode.type) {
|
|
2416
|
+
return null;
|
|
2417
|
+
}
|
|
2418
|
+
// Handle text nodes
|
|
2419
|
+
if (oldNode.type === Text && newNode.type === Text) {
|
|
2420
|
+
if (oldNode.text !== newNode.text) {
|
|
2421
|
+
patches.push({
|
|
2422
|
+
type: SetText,
|
|
2423
|
+
value: newNode.text
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
return patches;
|
|
2427
|
+
}
|
|
2428
|
+
// Compare attributes
|
|
2429
|
+
const oldKeys = getKeys(oldNode);
|
|
2430
|
+
const newKeys = getKeys(newNode);
|
|
2431
|
+
// Check for attribute changes
|
|
2432
|
+
for (const key of newKeys) {
|
|
2433
|
+
if (oldNode[key] !== newNode[key]) {
|
|
2434
|
+
patches.push({
|
|
2435
|
+
type: SetAttribute,
|
|
2436
|
+
key,
|
|
2437
|
+
value: newNode[key]
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
// Check for removed attributes
|
|
2442
|
+
for (const key of oldKeys) {
|
|
2443
|
+
if (!(key in newNode)) {
|
|
2444
|
+
patches.push({
|
|
2445
|
+
type: RemoveAttribute,
|
|
2446
|
+
key
|
|
2447
|
+
});
|
|
2448
|
+
}
|
|
2449
|
+
}
|
|
2450
|
+
return patches;
|
|
2451
|
+
};
|
|
2452
|
+
|
|
2453
|
+
const treeToArray = node => {
|
|
2454
|
+
const result = [node.node];
|
|
2455
|
+
for (const child of node.children) {
|
|
2456
|
+
result.push(...treeToArray(child));
|
|
2457
|
+
}
|
|
2458
|
+
return result;
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2461
|
+
const diffChildren = (oldChildren, newChildren, patches) => {
|
|
2462
|
+
const maxLength = Math.max(oldChildren.length, newChildren.length);
|
|
2463
|
+
// Track where we are: -1 means at parent, >= 0 means at child index
|
|
2464
|
+
let currentChildIndex = -1;
|
|
2465
|
+
// Collect indices of children to remove (we'll add these patches at the end in reverse order)
|
|
2466
|
+
const indicesToRemove = [];
|
|
2467
|
+
for (let i = 0; i < maxLength; i++) {
|
|
2468
|
+
const oldNode = oldChildren[i];
|
|
2469
|
+
const newNode = newChildren[i];
|
|
2470
|
+
if (!oldNode && !newNode) {
|
|
2471
|
+
continue;
|
|
2472
|
+
}
|
|
2473
|
+
if (!oldNode) {
|
|
2474
|
+
// Add new node - we should be at the parent
|
|
2475
|
+
if (currentChildIndex >= 0) {
|
|
2476
|
+
// Navigate back to parent
|
|
2477
|
+
patches.push({
|
|
2478
|
+
type: NavigateParent
|
|
2479
|
+
});
|
|
2480
|
+
currentChildIndex = -1;
|
|
2481
|
+
}
|
|
2482
|
+
// Flatten the entire subtree so renderInternal can handle it
|
|
2483
|
+
const flatNodes = treeToArray(newNode);
|
|
2484
|
+
patches.push({
|
|
2485
|
+
type: Add,
|
|
2486
|
+
nodes: flatNodes
|
|
2487
|
+
});
|
|
2488
|
+
} else if (newNode) {
|
|
2489
|
+
// Compare nodes to see if we need any patches
|
|
2490
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
2491
|
+
// If nodePatches is null, the node types are incompatible - need to replace
|
|
2492
|
+
if (nodePatches === null) {
|
|
2493
|
+
// Navigate to this child
|
|
2494
|
+
if (currentChildIndex === -1) {
|
|
2495
|
+
patches.push({
|
|
2496
|
+
type: NavigateChild,
|
|
2497
|
+
index: i
|
|
2498
|
+
});
|
|
2499
|
+
currentChildIndex = i;
|
|
2500
|
+
} else if (currentChildIndex !== i) {
|
|
2501
|
+
patches.push({
|
|
2502
|
+
type: NavigateSibling,
|
|
2503
|
+
index: i
|
|
2504
|
+
});
|
|
2505
|
+
currentChildIndex = i;
|
|
2506
|
+
}
|
|
2507
|
+
// Replace the entire subtree
|
|
2508
|
+
const flatNodes = treeToArray(newNode);
|
|
2509
|
+
patches.push({
|
|
2510
|
+
type: Replace,
|
|
2511
|
+
nodes: flatNodes
|
|
2512
|
+
});
|
|
2513
|
+
// After replace, we're at the new element (same position)
|
|
2514
|
+
continue;
|
|
2515
|
+
}
|
|
2516
|
+
// Check if we need to recurse into children
|
|
2517
|
+
const hasChildrenToCompare = oldNode.children.length > 0 || newNode.children.length > 0;
|
|
2518
|
+
// Only navigate to this element if we need to do something
|
|
2519
|
+
if (nodePatches.length > 0 || hasChildrenToCompare) {
|
|
2520
|
+
// Navigate to this child if not already there
|
|
2521
|
+
if (currentChildIndex === -1) {
|
|
2522
|
+
patches.push({
|
|
2523
|
+
type: NavigateChild,
|
|
2524
|
+
index: i
|
|
2525
|
+
});
|
|
2526
|
+
currentChildIndex = i;
|
|
2527
|
+
} else if (currentChildIndex !== i) {
|
|
2528
|
+
patches.push({
|
|
2529
|
+
type: NavigateSibling,
|
|
2530
|
+
index: i
|
|
2531
|
+
});
|
|
2532
|
+
currentChildIndex = i;
|
|
2533
|
+
}
|
|
2534
|
+
// Apply node patches (these apply to the current element, not children)
|
|
2535
|
+
if (nodePatches.length > 0) {
|
|
2536
|
+
patches.push(...nodePatches);
|
|
2537
|
+
}
|
|
2538
|
+
// Compare children recursively
|
|
2539
|
+
if (hasChildrenToCompare) {
|
|
2540
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
2541
|
+
}
|
|
2542
|
+
}
|
|
2543
|
+
} else {
|
|
2544
|
+
// Remove old node - collect the index for later removal
|
|
2545
|
+
indicesToRemove.push(i);
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
// Navigate back to parent if we ended at a child
|
|
2549
|
+
if (currentChildIndex >= 0) {
|
|
2550
|
+
patches.push({
|
|
2551
|
+
type: NavigateParent
|
|
2552
|
+
});
|
|
2553
|
+
currentChildIndex = -1;
|
|
2554
|
+
}
|
|
2555
|
+
// Add remove patches in reverse order (highest index first)
|
|
2556
|
+
// This ensures indices remain valid as we remove
|
|
2557
|
+
for (let j = indicesToRemove.length - 1; j >= 0; j--) {
|
|
2558
|
+
patches.push({
|
|
2559
|
+
type: RemoveChild,
|
|
2560
|
+
index: indicesToRemove[j]
|
|
2561
|
+
});
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
const diffTrees = (oldTree, newTree, patches, path) => {
|
|
2565
|
+
// At the root level (path.length === 0), we're already AT the element
|
|
2566
|
+
// So we compare the root node directly, then compare its children
|
|
2567
|
+
if (path.length === 0 && oldTree.length === 1 && newTree.length === 1) {
|
|
2568
|
+
const oldNode = oldTree[0];
|
|
2569
|
+
const newNode = newTree[0];
|
|
2570
|
+
// Compare root nodes
|
|
2571
|
+
const nodePatches = compareNodes(oldNode.node, newNode.node);
|
|
2572
|
+
// If nodePatches is null, the root node types are incompatible - need to replace
|
|
2573
|
+
if (nodePatches === null) {
|
|
2574
|
+
const flatNodes = treeToArray(newNode);
|
|
2575
|
+
patches.push({
|
|
2576
|
+
type: Replace,
|
|
2577
|
+
nodes: flatNodes
|
|
2578
|
+
});
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
if (nodePatches.length > 0) {
|
|
2582
|
+
patches.push(...nodePatches);
|
|
2583
|
+
}
|
|
2584
|
+
// Compare children
|
|
2585
|
+
if (oldNode.children.length > 0 || newNode.children.length > 0) {
|
|
2586
|
+
diffChildren(oldNode.children, newNode.children, patches);
|
|
2587
|
+
}
|
|
2588
|
+
} else {
|
|
2589
|
+
// Non-root level or multiple root elements - use the regular comparison
|
|
2590
|
+
diffChildren(oldTree, newTree, patches);
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
|
|
2594
|
+
const removeTrailingNavigationPatches = patches => {
|
|
2595
|
+
// Find the last non-navigation patch
|
|
2596
|
+
let lastNonNavigationIndex = -1;
|
|
2597
|
+
for (let i = patches.length - 1; i >= 0; i--) {
|
|
2598
|
+
const patch = patches[i];
|
|
2599
|
+
if (patch.type !== NavigateChild && patch.type !== NavigateParent && patch.type !== NavigateSibling) {
|
|
2600
|
+
lastNonNavigationIndex = i;
|
|
2601
|
+
break;
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
// Return patches up to and including the last non-navigation patch
|
|
2605
|
+
return lastNonNavigationIndex === -1 ? [] : patches.slice(0, lastNonNavigationIndex + 1);
|
|
2606
|
+
};
|
|
2607
|
+
|
|
2608
|
+
const diffTree = (oldNodes, newNodes) => {
|
|
2609
|
+
// Step 1: Convert flat arrays to tree structures
|
|
2610
|
+
const oldTree = arrayToTree(oldNodes);
|
|
2611
|
+
const newTree = arrayToTree(newNodes);
|
|
2612
|
+
// Step 3: Compare the trees
|
|
2613
|
+
const patches = [];
|
|
2614
|
+
diffTrees(oldTree, newTree, patches, []);
|
|
2615
|
+
// Remove trailing navigation patches since they serve no purpose
|
|
2616
|
+
return removeTrailingNavigationPatches(patches);
|
|
2617
|
+
};
|
|
2618
|
+
|
|
2316
2619
|
const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight, headerHeight) => {
|
|
2317
2620
|
const relativeDeltaY = deltaY % itemHeight;
|
|
2318
2621
|
const relativeY = eventY - y - headerHeight + relativeDeltaY;
|
|
@@ -2809,6 +3112,7 @@ const loadContent = async (state, savedState) => {
|
|
|
2809
3112
|
...state,
|
|
2810
3113
|
allExtensions: normalized,
|
|
2811
3114
|
deltaY,
|
|
3115
|
+
initial: false,
|
|
2812
3116
|
inputSource: Script,
|
|
2813
3117
|
size
|
|
2814
3118
|
}, searchValue, Script);
|
|
@@ -2819,11 +3123,41 @@ const openSuggest = state => {
|
|
|
2819
3123
|
return state;
|
|
2820
3124
|
};
|
|
2821
3125
|
|
|
3126
|
+
const getCss = state => {
|
|
3127
|
+
const {
|
|
3128
|
+
deltaY,
|
|
3129
|
+
itemHeight,
|
|
3130
|
+
scrollBarHeight,
|
|
3131
|
+
scrollBarY
|
|
3132
|
+
} = state;
|
|
3133
|
+
const relative = deltaY % itemHeight;
|
|
3134
|
+
return `.Extensions .ScrollBarThumb {
|
|
3135
|
+
height: ${scrollBarHeight}px;
|
|
3136
|
+
top: ${scrollBarY}px;
|
|
3137
|
+
}
|
|
3138
|
+
|
|
3139
|
+
.Extensions .ListItems {
|
|
3140
|
+
top: -${relative}px;
|
|
3141
|
+
|
|
3142
|
+
.ExtensionListItem {
|
|
3143
|
+
position: relative !important;
|
|
3144
|
+
}
|
|
3145
|
+
`;
|
|
3146
|
+
};
|
|
3147
|
+
|
|
3148
|
+
const renderCss = newState => {
|
|
3149
|
+
const {
|
|
3150
|
+
uid
|
|
3151
|
+
} = newState;
|
|
3152
|
+
const css = getCss(newState);
|
|
3153
|
+
return [SetCss, uid, css];
|
|
3154
|
+
};
|
|
3155
|
+
|
|
2822
3156
|
const Extensions$1 = 'extensions';
|
|
2823
3157
|
|
|
2824
3158
|
const getSelector = focus => {
|
|
2825
3159
|
switch (focus) {
|
|
2826
|
-
case Input
|
|
3160
|
+
case Input:
|
|
2827
3161
|
return `[name="${Extensions$1}"]`;
|
|
2828
3162
|
case List$2:
|
|
2829
3163
|
return '.ListItems';
|
|
@@ -2847,7 +3181,7 @@ const renderFocusContext = newState => {
|
|
|
2847
3181
|
const {
|
|
2848
3182
|
uid
|
|
2849
3183
|
} = newState;
|
|
2850
|
-
if (newState.focus === Input
|
|
3184
|
+
if (newState.focus === Input) {
|
|
2851
3185
|
return ['Viewlet.setFocusContext', uid, FocusExtensionsInput];
|
|
2852
3186
|
}
|
|
2853
3187
|
if (newState.focus === List$2) {
|
|
@@ -2911,7 +3245,7 @@ const getSearchFieldButtonVirtualDom = button => {
|
|
|
2911
3245
|
onClick,
|
|
2912
3246
|
tabIndex: 0,
|
|
2913
3247
|
title,
|
|
2914
|
-
type: Button
|
|
3248
|
+
type: Button$2
|
|
2915
3249
|
}, {
|
|
2916
3250
|
childCount: 0,
|
|
2917
3251
|
className: mergeClassNames(MaskIcon, icon),
|
|
@@ -2938,7 +3272,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
2938
3272
|
onInput,
|
|
2939
3273
|
placeholder,
|
|
2940
3274
|
spellcheck: false,
|
|
2941
|
-
type: Input
|
|
3275
|
+
type: Input$1
|
|
2942
3276
|
}, {
|
|
2943
3277
|
childCount: insideButtons.length,
|
|
2944
3278
|
className: SearchFieldButtons,
|
|
@@ -3019,8 +3353,7 @@ const getExtensionListItemVirtualDom = extension => {
|
|
|
3019
3353
|
name,
|
|
3020
3354
|
posInSet,
|
|
3021
3355
|
publisher,
|
|
3022
|
-
setSize
|
|
3023
|
-
top
|
|
3356
|
+
setSize
|
|
3024
3357
|
} = extension;
|
|
3025
3358
|
const dom = [{
|
|
3026
3359
|
ariaPosInSet: posInSet,
|
|
@@ -3030,7 +3363,6 @@ const getExtensionListItemVirtualDom = extension => {
|
|
|
3030
3363
|
className: getClassName(focused),
|
|
3031
3364
|
id: getId(focused),
|
|
3032
3365
|
role: ListItem,
|
|
3033
|
-
top,
|
|
3034
3366
|
type: Div
|
|
3035
3367
|
}, {
|
|
3036
3368
|
childCount: 0,
|
|
@@ -3179,14 +3511,29 @@ const getExtensionsViewVirtualDom = state => {
|
|
|
3179
3511
|
ariaLive: 'polite',
|
|
3180
3512
|
childCount: 2,
|
|
3181
3513
|
className: mergeClassNames(Viewlet, Extensions),
|
|
3182
|
-
role: None$
|
|
3514
|
+
role: None$3,
|
|
3183
3515
|
type: Div
|
|
3184
3516
|
}, ...getExtensionHeaderVirtualDom(placeholder, inputActions), ...getContentVirtualDom(visibleExtensions, message, scrollBarHeight, scrollBarY, focusOutline)];
|
|
3185
3517
|
};
|
|
3186
3518
|
|
|
3187
3519
|
const renderItems2 = newState => {
|
|
3520
|
+
const {
|
|
3521
|
+
initial,
|
|
3522
|
+
uid
|
|
3523
|
+
} = newState;
|
|
3524
|
+
if (initial) {
|
|
3525
|
+
return [SetDom2, uid, []];
|
|
3526
|
+
}
|
|
3188
3527
|
const dom = getExtensionsViewVirtualDom(newState);
|
|
3189
|
-
return [
|
|
3528
|
+
return [SetDom2, uid, dom];
|
|
3529
|
+
};
|
|
3530
|
+
|
|
3531
|
+
// TODO cache rendered dom so that it can be used for dom diffing
|
|
3532
|
+
const renderIncremental = (newState, oldState) => {
|
|
3533
|
+
const oldDom = renderItems2(oldState)[2];
|
|
3534
|
+
const newDom = renderItems2(newState)[2];
|
|
3535
|
+
const patches = diffTree(oldDom, newDom);
|
|
3536
|
+
return [SetPatches, newState.uid, patches];
|
|
3190
3537
|
};
|
|
3191
3538
|
|
|
3192
3539
|
const SetMessage = 'setMessage';
|
|
@@ -3218,12 +3565,16 @@ const renderSearchValue = newState => {
|
|
|
3218
3565
|
|
|
3219
3566
|
const getRenderer = diffType => {
|
|
3220
3567
|
switch (diffType) {
|
|
3568
|
+
case RenderCss:
|
|
3569
|
+
return renderCss;
|
|
3221
3570
|
case RenderFocus:
|
|
3222
3571
|
return renderFocus;
|
|
3223
3572
|
case RenderFocusContext:
|
|
3224
3573
|
return renderFocusContext;
|
|
3225
3574
|
case RenderHeader:
|
|
3226
3575
|
return renderHeader;
|
|
3576
|
+
case RenderIncremental:
|
|
3577
|
+
return renderIncremental;
|
|
3227
3578
|
case RenderItems:
|
|
3228
3579
|
return renderItems2;
|
|
3229
3580
|
case RenderMessage:
|
|
@@ -3274,13 +3625,13 @@ const getActionButtonVirtualDom = action => {
|
|
|
3274
3625
|
childCount: 1,
|
|
3275
3626
|
className: IconButton,
|
|
3276
3627
|
title: id,
|
|
3277
|
-
type: Button
|
|
3628
|
+
type: Button$2
|
|
3278
3629
|
}, getIconVirtualDom(icon)];
|
|
3279
3630
|
};
|
|
3280
3631
|
|
|
3281
3632
|
const getActionVirtualDom = action => {
|
|
3282
3633
|
switch (action.type) {
|
|
3283
|
-
case Button
|
|
3634
|
+
case Button:
|
|
3284
3635
|
return getActionButtonVirtualDom(action);
|
|
3285
3636
|
default:
|
|
3286
3637
|
return [];
|
|
@@ -3312,7 +3663,7 @@ const renderActions = uid => {
|
|
|
3312
3663
|
const renderEventListeners = () => {
|
|
3313
3664
|
return [{
|
|
3314
3665
|
name: HandleContextMenu,
|
|
3315
|
-
params: ['handleContextMenu', Button$
|
|
3666
|
+
params: ['handleContextMenu', Button$1, ClientX, ClientY],
|
|
3316
3667
|
preventDefault: true
|
|
3317
3668
|
}, {
|
|
3318
3669
|
name: HandleHeaderContextMenu,
|
|
@@ -3320,7 +3671,7 @@ const renderEventListeners = () => {
|
|
|
3320
3671
|
preventDefault: true
|
|
3321
3672
|
}, {
|
|
3322
3673
|
name: HandlePointerDown,
|
|
3323
|
-
params: ['handleClickAt', Button$
|
|
3674
|
+
params: ['handleClickAt', Button$1, ClientX, ClientY],
|
|
3324
3675
|
preventDefault: true
|
|
3325
3676
|
}, {
|
|
3326
3677
|
name: HandleScrollBarPointerDown,
|