@lvce-editor/extension-search-view 3.4.0 → 3.6.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.
@@ -430,7 +430,7 @@ const create$4 = (method, params) => {
430
430
  };
431
431
  };
432
432
  const callbacks = Object.create(null);
433
- const set$2 = (id, fn) => {
433
+ const set$4 = (id, fn) => {
434
434
  callbacks[id] = fn;
435
435
  };
436
436
  const get$2 = id => {
@@ -449,7 +449,7 @@ const registerPromise = () => {
449
449
  resolve,
450
450
  promise
451
451
  } = Promise.withResolvers();
452
- set$2(id, resolve);
452
+ set$4(id, resolve);
453
453
  return {
454
454
  id,
455
455
  promise
@@ -1168,6 +1168,20 @@ const create$1 = () => {
1168
1168
  };
1169
1169
  };
1170
1170
  return wrapped;
1171
+ },
1172
+ diff(uid, modules, numbers) {
1173
+ const {
1174
+ oldState,
1175
+ newState
1176
+ } = states[uid];
1177
+ const diffResult = [];
1178
+ for (let i = 0; i < modules.length; i++) {
1179
+ const fn = modules[i];
1180
+ if (!fn(oldState, newState)) {
1181
+ diffResult.push(numbers[i]);
1182
+ }
1183
+ }
1184
+ return diffResult;
1171
1185
  }
1172
1186
  };
1173
1187
  };
@@ -1349,6 +1363,9 @@ const last = items => {
1349
1363
  const next = (items, index) => {
1350
1364
  return (index + 1) % items.length;
1351
1365
  };
1366
+ const previous = (items, index) => {
1367
+ return index === 0 ? items.length - 1 : index - 1;
1368
+ };
1352
1369
  const focusFirst = state => {
1353
1370
  const firstIndex = first();
1354
1371
  return focusIndex(state, firstIndex);
@@ -1390,6 +1407,17 @@ const focusNextPage = state => {
1390
1407
  const indexNextPage = Math.min(maxLineY + (maxLineY - minLineY) - 2, lastIndex(items));
1391
1408
  return focusIndex(state, indexNextPage);
1392
1409
  };
1410
+ const focusPrevious = state => {
1411
+ const {
1412
+ focusedIndex,
1413
+ items
1414
+ } = state;
1415
+ if (focusedIndex === 0 || focusedIndex === -1) {
1416
+ return state;
1417
+ }
1418
+ const previousIndex = previous(items, focusedIndex);
1419
+ return focusIndex(state, previousIndex);
1420
+ };
1393
1421
  const focusPreviousPage = state => {
1394
1422
  const {
1395
1423
  focusedIndex,
@@ -1522,21 +1550,32 @@ const handleBlur = state => {
1522
1550
  return state;
1523
1551
  };
1524
1552
 
1525
- const RendererWorker = 1;
1526
-
1527
1553
  const rpcs = Object.create(null);
1528
- const set = (id, rpc) => {
1554
+ const set$3 = (id, rpc) => {
1529
1555
  rpcs[id] = rpc;
1530
1556
  };
1531
1557
  const get = id => {
1532
1558
  return rpcs[id];
1533
1559
  };
1534
-
1535
- const invoke = (method, ...params) => {
1536
- const rpc = get(RendererWorker);
1560
+ const RendererWorker$1 = 1;
1561
+ const invoke$2 = (method, ...params) => {
1562
+ const rpc = get(RendererWorker$1);
1537
1563
  // @ts-ignore
1538
1564
  return rpc.invoke(method, ...params);
1539
1565
  };
1566
+ const set$2 = rpc => {
1567
+ set$3(RendererWorker$1, rpc);
1568
+ };
1569
+ const RendererWorker = {
1570
+ __proto__: null,
1571
+ invoke: invoke$2,
1572
+ set: set$2
1573
+ };
1574
+
1575
+ const {
1576
+ invoke,
1577
+ set
1578
+ } = RendererWorker;
1540
1579
 
1541
1580
  const openUri = async uri => {
1542
1581
  return invoke('Main.openUri', uri);
@@ -1775,6 +1814,7 @@ const getAllExtensions$1 = async platform => {
1775
1814
  if (platform === Web) {
1776
1815
  return [];
1777
1816
  }
1817
+ // @ts-ignore todo
1778
1818
  return invoke('ExtensionManagement.getAllExtensions');
1779
1819
  };
1780
1820
 
@@ -2416,6 +2456,7 @@ const commandMap = {
2416
2456
  'SearchExtensions.focusNext': wrapCommand(focusNext),
2417
2457
  'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
2418
2458
  'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
2459
+ 'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
2419
2460
  'SearchExtensions.getActions': getActions,
2420
2461
  'SearchExtensions.getCommandIds': getCommandIds,
2421
2462
  'SearchExtensions.getKeyBindings': getKeyBindings,
@@ -2456,7 +2497,7 @@ const listen = async () => {
2456
2497
  const rpc = await WebWorkerRpcClient.create({
2457
2498
  commandMap: commandMap
2458
2499
  });
2459
- set(RendererWorker, rpc);
2500
+ set(rpc);
2460
2501
  };
2461
2502
 
2462
2503
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "3.4.0",
3
+ "version": "3.6.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",