@lvce-editor/extension-search-view 7.10.0 → 7.12.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.
@@ -794,7 +794,7 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
794
794
  const errorProperty = getErrorProperty(error, prettyError);
795
795
  return create$1$1(id, errorProperty);
796
796
  };
797
- const create$a = (message, result) => {
797
+ const create$b = (message, result) => {
798
798
  return {
799
799
  id: message.id,
800
800
  jsonrpc: Two$1,
@@ -803,7 +803,7 @@ const create$a = (message, result) => {
803
803
  };
804
804
  const getSuccessResponse = (message, result) => {
805
805
  const resultProperty = result ?? null;
806
- return create$a(message, resultProperty);
806
+ return create$b(message, resultProperty);
807
807
  };
808
808
  const getErrorResponseSimple = (id, error) => {
809
809
  return {
@@ -897,7 +897,7 @@ const handleJsonRpcMessage = async (...args) => {
897
897
 
898
898
  const Two = '2.0';
899
899
 
900
- const create$9 = (method, params) => {
900
+ const create$a = (method, params) => {
901
901
  return {
902
902
  jsonrpc: Two,
903
903
  method,
@@ -905,7 +905,7 @@ const create$9 = (method, params) => {
905
905
  };
906
906
  };
907
907
 
908
- const create$8 = (id, method, params) => {
908
+ const create$9 = (id, method, params) => {
909
909
  const message = {
910
910
  id,
911
911
  jsonrpc: Two,
@@ -916,12 +916,12 @@ const create$8 = (id, method, params) => {
916
916
  };
917
917
 
918
918
  let id$1 = 0;
919
- const create$7 = () => {
919
+ const create$8 = () => {
920
920
  return ++id$1;
921
921
  };
922
922
 
923
923
  const registerPromise = map => {
924
- const id = create$7();
924
+ const id = create$8();
925
925
  const {
926
926
  promise,
927
927
  resolve
@@ -938,7 +938,7 @@ const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer)
938
938
  id,
939
939
  promise
940
940
  } = registerPromise(callbacks);
941
- const message = create$8(id, method, params);
941
+ const message = create$9(id, method, params);
942
942
  if (useSendAndTransfer && ipc.sendAndTransfer) {
943
943
  ipc.sendAndTransfer(message);
944
944
  } else {
@@ -974,7 +974,7 @@ const createRpc = ipc => {
974
974
  * @deprecated
975
975
  */
976
976
  send(method, ...params) {
977
- const message = create$9(method, params);
977
+ const message = create$a(method, params);
978
978
  ipc.send(message);
979
979
  }
980
980
  };
@@ -1014,7 +1014,7 @@ const listen$1 = async (module, options) => {
1014
1014
  return ipc;
1015
1015
  };
1016
1016
 
1017
- const create$6 = async ({
1017
+ const create$7 = async ({
1018
1018
  commandMap,
1019
1019
  isMessagePortOpen = true,
1020
1020
  messagePort
@@ -1032,7 +1032,7 @@ const create$6 = async ({
1032
1032
  return rpc;
1033
1033
  };
1034
1034
 
1035
- const create$5 = async ({
1035
+ const create$6 = async ({
1036
1036
  commandMap,
1037
1037
  isMessagePortOpen,
1038
1038
  send
@@ -1042,13 +1042,55 @@ const create$5 = async ({
1042
1042
  port2
1043
1043
  } = new MessageChannel();
1044
1044
  await send(port1);
1045
- return create$6({
1045
+ return create$7({
1046
1046
  commandMap,
1047
1047
  isMessagePortOpen,
1048
1048
  messagePort: port2
1049
1049
  });
1050
1050
  };
1051
1051
 
1052
+ const createSharedLazyRpc = factory => {
1053
+ let rpcPromise;
1054
+ const getOrCreate = () => {
1055
+ if (!rpcPromise) {
1056
+ rpcPromise = factory();
1057
+ }
1058
+ return rpcPromise;
1059
+ };
1060
+ return {
1061
+ async dispose() {
1062
+ const rpc = await getOrCreate();
1063
+ await rpc.dispose();
1064
+ },
1065
+ async invoke(method, ...params) {
1066
+ const rpc = await getOrCreate();
1067
+ return rpc.invoke(method, ...params);
1068
+ },
1069
+ async invokeAndTransfer(method, ...params) {
1070
+ const rpc = await getOrCreate();
1071
+ return rpc.invokeAndTransfer(method, ...params);
1072
+ },
1073
+ async send(method, ...params) {
1074
+ const rpc = await getOrCreate();
1075
+ rpc.send(method, ...params);
1076
+ }
1077
+ };
1078
+ };
1079
+
1080
+ const create$5 = async ({
1081
+ commandMap,
1082
+ isMessagePortOpen,
1083
+ send
1084
+ }) => {
1085
+ return createSharedLazyRpc(() => {
1086
+ return create$6({
1087
+ commandMap,
1088
+ isMessagePortOpen,
1089
+ send
1090
+ });
1091
+ });
1092
+ };
1093
+
1052
1094
  const create$4 = async ({
1053
1095
  commandMap
1054
1096
  }) => {
@@ -1081,7 +1123,7 @@ const createMockRpc = ({
1081
1123
  };
1082
1124
 
1083
1125
  const rpcs = Object.create(null);
1084
- const set$5 = (id, rpc) => {
1126
+ const set$6 = (id, rpc) => {
1085
1127
  rpcs[id] = rpc;
1086
1128
  };
1087
1129
  const get$1 = id => {
@@ -1114,7 +1156,7 @@ const create$3 = rpcId => {
1114
1156
  const mockRpc = createMockRpc({
1115
1157
  commandMap
1116
1158
  });
1117
- set$5(rpcId, mockRpc);
1159
+ set$6(rpcId, mockRpc);
1118
1160
  // @ts-ignore
1119
1161
  mockRpc[Symbol.dispose] = () => {
1120
1162
  remove(rpcId);
@@ -1123,7 +1165,7 @@ const create$3 = rpcId => {
1123
1165
  return mockRpc;
1124
1166
  },
1125
1167
  set(rpc) {
1126
- set$5(rpcId, rpc);
1168
+ set$6(rpcId, rpc);
1127
1169
  }
1128
1170
  };
1129
1171
  };
@@ -1315,6 +1357,7 @@ const ExtensionSearchFilter = 95;
1315
1357
 
1316
1358
  const LeftClick = 0;
1317
1359
 
1360
+ const DialogWorker = 7014;
1318
1361
  const ExtensionHostWorker = 44;
1319
1362
  const ExtensionManagementWorker = 9006;
1320
1363
  const RendererWorker = 1;
@@ -1324,6 +1367,11 @@ const SetCss = 'Viewlet.setCss';
1324
1367
  const SetDom2 = 'Viewlet.setDom2';
1325
1368
  const SetPatches = 'Viewlet.setPatches';
1326
1369
 
1370
+ const {
1371
+ invoke: invoke$3,
1372
+ set: set$5
1373
+ } = create$3(DialogWorker);
1374
+
1327
1375
  const {
1328
1376
  invoke: invoke$2,
1329
1377
  set: set$4
@@ -1351,6 +1399,10 @@ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1351
1399
  number(y);
1352
1400
  await invoke$1('ContextMenu.show2', uid, menuId, x, y, args);
1353
1401
  };
1402
+ const sendMessagePortToDialogWorker = async port => {
1403
+ const command = 'HandleMessagePort.handleMessagePort';
1404
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToDialogWorker', port, command);
1405
+ };
1354
1406
  const disableExtension = async id => {
1355
1407
  return invoke$1('ExtensionManagement.disable', id);
1356
1408
  };
@@ -1361,10 +1413,6 @@ const sendMessagePortToExtensionHostWorker$1 = async (port, rpcId = 0) => {
1361
1413
  const command = 'HandleMessagePort.handleMessagePort2';
1362
1414
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1363
1415
  };
1364
- const confirm = async (message, options) => {
1365
- const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1366
- return result;
1367
- };
1368
1416
  const writeClipBoardText = async text => {
1369
1417
  await invoke$1('ClipBoard.writeText', /* text */text);
1370
1418
  };
@@ -2503,12 +2551,12 @@ const diff2 = uid => {
2503
2551
  };
2504
2552
 
2505
2553
  const disable$1 = async (state, _id) => {
2506
- await confirm('not implemented');
2554
+ await invoke$3('ConfirmPrompt.prompt', 'not implemented', undefined);
2507
2555
  return state;
2508
2556
  };
2509
2557
 
2510
2558
  const disableWorkspace = async (state, _id) => {
2511
- await confirm('not implemented');
2559
+ await invoke$3('ConfirmPrompt.prompt', 'not implemented', undefined);
2512
2560
  return state;
2513
2561
  };
2514
2562
 
@@ -2518,12 +2566,12 @@ const dispose = uid => {
2518
2566
  };
2519
2567
 
2520
2568
  const enable$1 = async (state, _id) => {
2521
- await confirm('not implemented');
2569
+ await invoke$3('ConfirmPrompt.prompt', 'not implemented', undefined);
2522
2570
  return state;
2523
2571
  };
2524
2572
 
2525
2573
  const enableWorkspace = async (state, _id) => {
2526
- await confirm('not implemented');
2574
+ await invoke$3('ConfirmPrompt.prompt', 'not implemented', undefined);
2527
2575
  return state;
2528
2576
  };
2529
2577
 
@@ -3699,7 +3747,7 @@ const sendMessagePortToExtensionHostWorker = async port => {
3699
3747
 
3700
3748
  const createExtensionHostWorkerRpc = async () => {
3701
3749
  try {
3702
- const rpc = await create$5({
3750
+ const rpc = await create$6({
3703
3751
  commandMap: {},
3704
3752
  send: sendMessagePortToExtensionHostWorker
3705
3753
  });
@@ -3721,7 +3769,7 @@ const initializeExtensionHostWorker = async () => {
3721
3769
 
3722
3770
  const createExtensionManagementWorkerRpc = async () => {
3723
3771
  try {
3724
- const rpc = await create$5({
3772
+ const rpc = await create$6({
3725
3773
  commandMap: {},
3726
3774
  send: port => sendMessagePortToExtensionManagementWorker(port, 0)
3727
3775
  });
@@ -3745,7 +3793,7 @@ const initialize = async () => {
3745
3793
  };
3746
3794
 
3747
3795
  const installAnotherVersion = async state => {
3748
- await confirm('not implemented');
3796
+ await invoke$3('ConfirmPrompt.prompt', 'not implemented', undefined);
3749
3797
  return state;
3750
3798
  };
3751
3799
 
@@ -4377,6 +4425,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
4377
4425
  return dom;
4378
4426
  };
4379
4427
 
4428
+ const getCompletionVirtualDom = (completionItems, completionFocusedIndex, suggestOpen) => {
4429
+ if (!suggestOpen) {
4430
+ return [];
4431
+ }
4432
+ return getCompletionWidgetVirtualDom(completionItems, completionFocusedIndex);
4433
+ };
4380
4434
  const getExtensionHeaderVirtualDom = (placeholder, actions, completionItems = [], completionFocusedIndex = 0, suggestOpen = false) => {
4381
4435
  const inputProperties = suggestOpen ? {
4382
4436
  ariaActivedescendant: `ExtensionSearchCompletion-${completionFocusedIndex}`,
@@ -4389,12 +4443,13 @@ const getExtensionHeaderVirtualDom = (placeholder, actions, completionItems = []
4389
4443
  ariaExpanded: false,
4390
4444
  role: ComboBox
4391
4445
  };
4446
+ const completionDom = getCompletionVirtualDom(completionItems, completionFocusedIndex, suggestOpen);
4392
4447
  return [{
4393
4448
  childCount: suggestOpen ? 2 : 1,
4394
4449
  className: ExtensionHeader,
4395
4450
  onContextMenu: HandleHeaderContextMenu,
4396
4451
  type: Div
4397
- }, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [], HandleInputFocus, HandleInputBlur, inputProperties), ...(suggestOpen ? getCompletionWidgetVirtualDom(completionItems, completionFocusedIndex) : [])];
4452
+ }, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [], HandleInputFocus, HandleInputBlur, inputProperties), ...completionDom];
4398
4453
  };
4399
4454
 
4400
4455
  const renderHeader = newState => {
@@ -4503,10 +4558,12 @@ const listItemDescription = {
4503
4558
  className: ExtensionListItemDescription,
4504
4559
  type: Div
4505
4560
  };
4506
- const listItemFooter = {
4507
- childCount: 3,
4508
- className: ExtensionListItemFooter,
4509
- type: Div
4561
+ const getListItemFooter = hasStatistics => {
4562
+ return {
4563
+ childCount: hasStatistics ? 3 : 2,
4564
+ className: ExtensionListItemFooter,
4565
+ type: Div
4566
+ };
4510
4567
  };
4511
4568
  const listItemAuthorName = {
4512
4569
  childCount: 1,
@@ -4522,6 +4579,12 @@ const getId = focused => {
4522
4579
  }
4523
4580
  return undefined;
4524
4581
  };
4582
+ const getStatisticsVirtualDom = (hasStatistics, downloadCount, rating) => {
4583
+ if (!hasStatistics) {
4584
+ return [];
4585
+ }
4586
+ return getExtensionStatisticsVirtualDom(downloadCount, rating);
4587
+ };
4525
4588
  const getExtensionListItemVirtualDom = extension => {
4526
4589
  const {
4527
4590
  builtin = false,
@@ -4539,6 +4602,7 @@ const getExtensionListItemVirtualDom = extension => {
4539
4602
  status
4540
4603
  } = extension;
4541
4604
  const actionsDom = getExtensionActionsVirtualDom(id, builtin, disabled, status);
4605
+ const hasStatistics = !builtin;
4542
4606
  const dom = [{
4543
4607
  ariaPosInSet: posInSet,
4544
4608
  ariaRoleDescription: Extension,
@@ -4554,7 +4618,7 @@ const getExtensionListItemVirtualDom = extension => {
4554
4618
  role: None,
4555
4619
  src: icon,
4556
4620
  type: Img
4557
- }, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), ...getExtensionStatisticsVirtualDom(downloadCount, rating), ...actionsDom];
4621
+ }, listItemDetail, listItemName, text(name), listItemDescription, text(description), getListItemFooter(hasStatistics), listItemAuthorName, text(publisher), ...getStatisticsVirtualDom(hasStatistics, downloadCount, rating), ...actionsDom];
4558
4622
  return dom;
4559
4623
  };
4560
4624
 
@@ -5140,6 +5204,11 @@ const listen = async () => {
5140
5204
  commandMap: commandMap
5141
5205
  });
5142
5206
  set$2(rpc);
5207
+ const dialogRpc = await create$5({
5208
+ commandMap: {},
5209
+ send: sendMessagePortToDialogWorker
5210
+ });
5211
+ set$5(dialogRpc);
5143
5212
  };
5144
5213
 
5145
5214
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "7.10.0",
3
+ "version": "7.12.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",