@lvce-editor/extension-search-view 4.1.0 → 4.4.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.
@@ -436,9 +436,9 @@ const get$2 = id => {
436
436
  const remove = id => {
437
437
  delete callbacks[id];
438
438
  };
439
- let id = 0;
439
+ let id$1 = 0;
440
440
  const create$3$1 = () => {
441
- return ++id;
441
+ return ++id$1;
442
442
  };
443
443
  const registerPromise = () => {
444
444
  const id = create$3$1();
@@ -892,6 +892,9 @@ const createMockRpc = ({
892
892
  const invoke = (method, ...params) => {
893
893
  invocations.push([method, ...params]);
894
894
  const command = commandMap[method];
895
+ if (!command) {
896
+ throw new Error(`command ${method} not found`);
897
+ }
895
898
  return command(...params);
896
899
  };
897
900
  const mockRpc = {
@@ -1015,10 +1018,34 @@ const ViewsAndMoreActions = 'Views and more Actions...';
1015
1018
  const Extensions$2 = 'Extensions';
1016
1019
  const Copy = 'Copy';
1017
1020
  const CopyExtensionId = 'CopyExtensionId';
1021
+ const Name = 'Name';
1022
+ const Id$1 = 'Id';
1023
+ const Description = 'Description';
1024
+ const Version = 'Version';
1025
+ const Publisher = 'Publisher';
1026
+ const MarketplaceLink = 'Marketplace Link';
1018
1027
 
1019
1028
  const noExtensionsFound = () => {
1020
1029
  return i18nString(NoExtensionsFound);
1021
1030
  };
1031
+ const name = () => {
1032
+ return i18nString(Name);
1033
+ };
1034
+ const id = () => {
1035
+ return i18nString(Id$1);
1036
+ };
1037
+ const version = () => {
1038
+ return i18nString(Version);
1039
+ };
1040
+ const description = () => {
1041
+ return i18nString(Description);
1042
+ };
1043
+ const publisher = () => {
1044
+ return i18nString(Publisher);
1045
+ };
1046
+ const marketplaceLink = () => {
1047
+ return i18nString(MarketplaceLink);
1048
+ };
1022
1049
  const filter = () => {
1023
1050
  return i18nString(Filter$1);
1024
1051
  };
@@ -1043,7 +1070,7 @@ const installAnotherVersion = () => {
1043
1070
  const copy = () => {
1044
1071
  return i18nString(Copy);
1045
1072
  };
1046
- const copyExtensionId = () => {
1073
+ const copyExtensionId$1 = () => {
1047
1074
  return i18nString(CopyExtensionId);
1048
1075
  };
1049
1076
  const searchExtensionsInMarketPlace = () => {
@@ -1088,6 +1115,9 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1088
1115
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1089
1116
  };
1090
1117
 
1118
+ const User = 1;
1119
+ const Script = 2;
1120
+
1091
1121
  const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
1092
1122
  const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
1093
1123
  return scrollBarOffset;
@@ -1128,12 +1158,12 @@ const parseValue = value => {
1128
1158
  builtin = true;
1129
1159
  }
1130
1160
  if (match.startsWith(Sort)) {
1131
- // TODO
1161
+ // TODO correcly parse sort order
1132
1162
  sort = 'installs';
1133
1163
  }
1134
1164
  if (match.startsWith(Id)) {
1135
- // TODO
1136
- id = 'abc';
1165
+ // TODO improve parsing
1166
+ id = value.replace('@id:', '');
1137
1167
  }
1138
1168
  if (match.startsWith(Outdated)) {
1139
1169
  outdated = true;
@@ -1163,6 +1193,9 @@ const matchesId = (extension, query) => {
1163
1193
  return extensionIdLower.includes(query);
1164
1194
  };
1165
1195
  const matchesParsedValue = (extension, parsedValue) => {
1196
+ if (parsedValue.id && extension.id) {
1197
+ return parsedValue.id === extension.id;
1198
+ }
1166
1199
  if (extension.name) {
1167
1200
  return matchesName(extension, parsedValue.query);
1168
1201
  }
@@ -1206,7 +1239,7 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
1206
1239
  };
1207
1240
 
1208
1241
  // TODO debounce
1209
- const handleInput = async (state, value) => {
1242
+ const handleInput = async (state, value, inputSource = User) => {
1210
1243
  try {
1211
1244
  const {
1212
1245
  allExtensions,
@@ -1233,7 +1266,8 @@ const handleInput = async (state, value) => {
1233
1266
  minLineY: 0,
1234
1267
  placeholder: searchExtensionsInMarketPlace(),
1235
1268
  scrollBarHeight: 0,
1236
- searchValue: value
1269
+ searchValue: value,
1270
+ inputSource
1237
1271
  };
1238
1272
  }
1239
1273
  const total = items.length;
@@ -1256,7 +1290,8 @@ const handleInput = async (state, value) => {
1256
1290
  placeholder: searchExtensionsInMarketPlace(),
1257
1291
  scrollBarHeight,
1258
1292
  scrollBarY,
1259
- searchValue: value
1293
+ searchValue: value,
1294
+ inputSource
1260
1295
  };
1261
1296
 
1262
1297
  // TODO handle out of order responses (a bit complicated)
@@ -1280,486 +1315,104 @@ const closeSuggest = state => {
1280
1315
  return state;
1281
1316
  };
1282
1317
 
1283
- const {
1284
- get: get$1,
1285
- set: set$3,
1286
- dispose: dispose$2,
1287
- wrapCommand,
1288
- wrapGetter
1289
- } = create$2();
1318
+ const None$2 = 'none';
1290
1319
 
1291
- const create$1 = (id, uri, x, y, width, height, platform, assetDir) => {
1292
- const state = {
1293
- allExtensions: [],
1294
- assetDir,
1295
- deltaY: 0,
1296
- finalDeltaY: 0,
1297
- focus: 0,
1298
- focused: false,
1299
- focusedIndex: 0,
1300
- handleOffset: 0,
1301
- headerHeight: 41,
1302
- height,
1303
- inputActions: [],
1304
- inputSource: 0,
1305
- itemHeight: 72,
1306
- items: [],
1307
- maxLineY: 0,
1308
- message: '',
1309
- minimumSliderSize: 0,
1310
- minLineY: 0,
1311
- negativeMargin: 0,
1312
- placeholder: '',
1313
- platform,
1314
- scrollBarActive: false,
1315
- scrollBarHeight: 0,
1316
- scrollBarY: 0,
1317
- searchValue: '',
1318
- size: 0,
1319
- uid: id,
1320
- width,
1321
- x,
1322
- y
1323
- };
1324
- set$3(id, state, state);
1325
- };
1320
+ const Button$2 = 1;
1321
+ const Div = 4;
1322
+ const Input = 6;
1323
+ const Text = 12;
1324
+ const Img = 17;
1326
1325
 
1327
- const isEqual$2 = (oldState, newState) => {
1328
- if (!newState.focus) {
1329
- return true;
1330
- }
1331
- return oldState.focus === newState.focus;
1332
- };
1326
+ const Button$1 = 'event.button';
1327
+ const ClientX = 'event.clientX';
1328
+ const ClientY = 'event.clientY';
1329
+ const DeltaMode = 'event.deltaMode';
1330
+ const DeltaY = 'event.deltaY';
1331
+ const TargetValue = 'event.target.value';
1333
1332
 
1334
- const isEqual$1 = (oldState, newState) => {
1335
- return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder;
1336
- };
1333
+ const LeftClick = 0;
1337
1334
 
1338
- const User = 1;
1339
- const Script = 2;
1335
+ const DebugWorker = 55;
1336
+ const RendererWorker$1 = 1;
1340
1337
 
1341
- const isEqual = (oldState, newState) => {
1342
- return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1338
+ const rpcs = Object.create(null);
1339
+ const set$3 = (id, rpc) => {
1340
+ rpcs[id] = rpc;
1341
+ };
1342
+ const get$1 = id => {
1343
+ return rpcs[id];
1343
1344
  };
1344
1345
 
1345
- const RenderHeader = 1;
1346
- const RenderFocus = 2;
1347
- const RenderItems = 4;
1348
- const RenderScrollBar = 5;
1349
- const RenderMessage = 6;
1350
- const RenderSearchValue = 7;
1351
- const RenderFocusContext = 8;
1352
-
1353
- const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2];
1354
- const numbers = [RenderItems, RenderFocus, RenderSearchValue, RenderFocusContext];
1355
-
1356
- const diff2 = uid => {
1357
- const {
1358
- oldState,
1359
- newState
1360
- } = get$1(uid);
1361
- const diffResult = [];
1362
- for (let i = 0; i < modules.length; i++) {
1363
- const fn = modules[i];
1364
- if (!fn(oldState, newState)) {
1365
- diffResult.push(numbers[i]);
1346
+ const create$1 = rpcId => {
1347
+ return {
1348
+ // @ts-ignore
1349
+ invoke(method, ...params) {
1350
+ const rpc = get$1(rpcId);
1351
+ // @ts-ignore
1352
+ return rpc.invoke(method, ...params);
1353
+ },
1354
+ // @ts-ignore
1355
+ invokeAndTransfer(method, ...params) {
1356
+ const rpc = get$1(rpcId);
1357
+ // @ts-ignore
1358
+ return rpc.invokeAndTransfer(method, ...params);
1359
+ },
1360
+ set(rpc) {
1361
+ set$3(rpcId, rpc);
1362
+ },
1363
+ async dispose() {
1364
+ const rpc = get$1(rpcId);
1365
+ await rpc.dispose();
1366
1366
  }
1367
- }
1368
- return diffResult;
1367
+ };
1369
1368
  };
1370
1369
 
1371
- const dispose$1 = uid => {
1372
- dispose$2(uid);
1370
+ const {
1371
+ invoke: invoke$1,
1372
+ invokeAndTransfer,
1373
+ set: set$2,
1374
+ dispose: dispose$2
1375
+ } = create$1(RendererWorker$1);
1376
+ const searchFileHtml = async uri => {
1377
+ return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1373
1378
  };
1374
-
1375
- // TODO optimize this function to return the minimum number
1376
- // of visible items needed, e.g. when not scrolled 5 items with
1377
- // 20px fill 100px but when scrolled 6 items are needed
1378
- const getNumberOfVisibleItems = (listHeight, itemHeight) => {
1379
- return Math.ceil(listHeight / itemHeight) + 1;
1379
+ const getFilePathElectron = async file => {
1380
+ return invoke$1('FileSystemHandle.getFilePathElectron', file);
1380
1381
  };
1381
- const getScrollBarOffset = (delta, finalDelta, size, scrollBarSize) => {
1382
- const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
1383
- return scrollBarOffset;
1382
+ const showContextMenu$1 = async (x, y, id, ...args) => {
1383
+ return invoke$1('ContextMenu.show', x, y, id, ...args);
1384
1384
  };
1385
- const getScrollBarY = getScrollBarOffset;
1386
- const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength) => {
1387
- const {
1388
- finalDeltaY,
1389
- height,
1390
- headerHeight,
1391
- scrollBarHeight
1392
- } = state;
1393
- const newMaxLineY = Math.min(index + 1, itemsLength);
1394
- const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
1395
- const newMinLineY = Math.max(newMaxLineY - fittingItems, 0);
1396
- const newDeltaY = itemsLength < fittingItems ? 0 : newMinLineY * itemHeight - listHeight % itemHeight + itemHeight;
1397
- const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
1398
- return {
1399
- ...state,
1400
- focusedIndex: index,
1401
- minLineY: newMinLineY,
1402
- maxLineY: newMaxLineY,
1403
- focused: true,
1404
- deltaY: newDeltaY,
1405
- scrollBarY
1406
- };
1385
+ const getElectronVersion = async () => {
1386
+ return invoke$1('Process.getElectronVersion');
1407
1387
  };
1408
- const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) => {
1409
- const {
1410
- finalDeltaY,
1411
- height,
1412
- headerHeight,
1413
- scrollBarHeight
1414
- } = state;
1415
- const newMinLineY = index;
1416
- const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
1417
- const newMaxLineY = Math.min(newMinLineY + fittingItems, itemsLength);
1418
- const newDeltaY = newMinLineY * itemHeight;
1419
- const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
1420
- return {
1421
- ...state,
1422
- focusedIndex: index,
1423
- minLineY: newMinLineY,
1424
- maxLineY: newMaxLineY,
1425
- focused: true,
1426
- deltaY: newDeltaY,
1427
- scrollBarY
1428
- };
1388
+ const applyBulkReplacement = async bulkEdits => {
1389
+ await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1429
1390
  };
1430
- const focusIndex = (state, index) => {
1431
- const {
1432
- itemHeight,
1433
- minLineY,
1434
- maxLineY,
1435
- headerHeight,
1436
- height,
1437
- items
1438
- } = state;
1439
- const itemsLength = items.length;
1440
- if (itemsLength === 0) {
1441
- return state;
1442
- }
1443
- number(itemHeight);
1444
- if (index === -1) {
1445
- return {
1446
- ...state,
1447
- focusedIndex: -1,
1448
- focused: true
1449
- };
1450
- }
1451
- const listHeight = height - headerHeight;
1452
- if (index < minLineY + 1) {
1453
- return focusIndexScrollUp(state, index, listHeight, itemHeight, itemsLength);
1454
- }
1455
- if (index >= maxLineY - 1) {
1456
- return focusIndexScrollDown(state, index, listHeight, itemHeight, itemsLength);
1457
- }
1458
- return {
1459
- ...state,
1460
- focusedIndex: index,
1461
- focused: true
1462
- };
1391
+ const setColorTheme = async id => {
1392
+ // @ts-ignore
1393
+ return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1463
1394
  };
1464
- const first = () => {
1465
- return 0;
1395
+ const getNodeVersion = async () => {
1396
+ return invoke$1('Process.getNodeVersion');
1466
1397
  };
1467
- const last = items => {
1468
- return items.length - 1;
1398
+ const getChromeVersion = async () => {
1399
+ return invoke$1('Process.getChromeVersion');
1469
1400
  };
1470
- const next = (items, index) => {
1471
- return (index + 1) % items.length;
1401
+ const getV8Version = async () => {
1402
+ return invoke$1('Process.getV8Version');
1472
1403
  };
1473
- const previous = (items, index) => {
1474
- return index === 0 ? items.length - 1 : index - 1;
1404
+ const getFileHandles = async fileIds => {
1405
+ const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1406
+ return files;
1475
1407
  };
1476
- const focusFirst = state => {
1477
- const firstIndex = first();
1478
- return focusIndex(state, firstIndex);
1408
+ const setWorkspacePath = async path => {
1409
+ await invoke$1('Workspace.setPath', path);
1479
1410
  };
1480
- const focusLast = state => {
1481
- const {
1482
- items
1483
- } = state;
1484
- const lastIndex = last(items);
1485
- return focusIndex(state, lastIndex);
1411
+ const registerWebViewInterceptor = async (id, port) => {
1412
+ await invokeAndTransfer('WebView.registerInterceptor', id, port);
1486
1413
  };
1487
- const focusNext = state => {
1488
- const {
1489
- focusedIndex,
1490
- items
1491
- } = state;
1492
- const nextIndex = next(items, focusedIndex);
1493
- return focusIndex(state, nextIndex);
1494
- };
1495
-
1496
- // based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
1497
-
1498
- const isLastIndex = (array, index) => {
1499
- return index === array.length - 1;
1500
- };
1501
- const lastIndex = array => {
1502
- return array.length - 1;
1503
- };
1504
- const focusNextPage = state => {
1505
- const {
1506
- focusedIndex,
1507
- items,
1508
- maxLineY,
1509
- minLineY
1510
- } = state;
1511
- if (isLastIndex(items, focusedIndex)) {
1512
- return state;
1513
- }
1514
- const indexNextPage = Math.min(maxLineY + (maxLineY - minLineY) - 2, lastIndex(items));
1515
- return focusIndex(state, indexNextPage);
1516
- };
1517
- const focusPrevious = state => {
1518
- const {
1519
- focusedIndex,
1520
- items
1521
- } = state;
1522
- if (focusedIndex === 0 || focusedIndex === -1) {
1523
- return state;
1524
- }
1525
- const previousIndex = previous(items, focusedIndex);
1526
- return focusIndex(state, previousIndex);
1527
- };
1528
- const focusPreviousPage = state => {
1529
- const {
1530
- focusedIndex,
1531
- minLineY,
1532
- maxLineY
1533
- } = state;
1534
- if (focusedIndex === 0 || focusedIndex === -1) {
1535
- return state;
1536
- }
1537
- const indexPreviousPage = Math.max(minLineY - (maxLineY - minLineY) + 1, 0);
1538
- return focusIndex(state, indexPreviousPage);
1539
- };
1540
-
1541
- const Button$1 = 1;
1542
-
1543
- const ClearAll = 'ClearAll';
1544
- const Filter = 'Filter';
1545
- const Refresh = 'Refresh';
1546
- const Ellipsis = 'Ellipsis';
1547
-
1548
- const getActions = () => {
1549
- return [{
1550
- type: Button$1,
1551
- id: refresh(),
1552
- icon: Refresh,
1553
- command: ''
1554
- }, {
1555
- type: Button$1,
1556
- id: viewsAndMoreActions(),
1557
- icon: Ellipsis,
1558
- command: ''
1559
- }];
1560
- };
1561
-
1562
- const commandMapRef = {};
1563
-
1564
- const toCommandId = key => {
1565
- const dotIndex = key.indexOf('.');
1566
- return key.slice(dotIndex + 1);
1567
- };
1568
- const getCommandIds = () => {
1569
- const keys = Object.keys(commandMapRef);
1570
- const ids = keys.map(toCommandId);
1571
- return ids;
1572
- };
1573
-
1574
- const Enter = 3;
1575
- const Space = 9;
1576
- const PageUp = 10;
1577
- const PageDown = 11;
1578
- const End = 255;
1579
- const Home = 12;
1580
- const UpArrow = 14;
1581
- const DownArrow = 16;
1582
-
1583
- const CtrlCmd = 1 << 11 >>> 0;
1584
-
1585
- const FocusExtensions = 15;
1586
- const FocusExtensionsInput = 7000;
1587
-
1588
- const getKeyBindings$1 = () => {
1589
- return [{
1590
- key: Home,
1591
- command: 'Extensions.focusFirst',
1592
- when: FocusExtensions
1593
- }, {
1594
- key: End,
1595
- command: 'Extensions.focusLast',
1596
- when: FocusExtensions
1597
- }, {
1598
- key: PageUp,
1599
- command: 'Extensions.focusPreviousPage',
1600
- when: FocusExtensions
1601
- }, {
1602
- key: PageDown,
1603
- command: 'Extensions.focusNextPage',
1604
- when: FocusExtensions
1605
- }, {
1606
- key: UpArrow,
1607
- command: 'Extensions.focusPrevious',
1608
- when: FocusExtensions
1609
- }, {
1610
- key: DownArrow,
1611
- command: 'Extensions.focusNext',
1612
- when: FocusExtensions
1613
- }, {
1614
- key: Space,
1615
- command: 'Extensions.handleClickCurrentButKeepFocus',
1616
- when: FocusExtensions
1617
- }, {
1618
- key: Enter,
1619
- command: 'Extensions.handleClickCurrent',
1620
- when: FocusExtensions
1621
- }, {
1622
- key: CtrlCmd | Space,
1623
- command: 'Extensions.toggleSuggest',
1624
- when: FocusExtensions
1625
- }, {
1626
- key: CtrlCmd | DownArrow,
1627
- command: 'Extensions.scrollDown',
1628
- when: FocusExtensions
1629
- }];
1630
- };
1631
-
1632
- const None$2 = 0;
1633
-
1634
- const getMenuEntries = () => {
1635
- return [{
1636
- id: 'enable',
1637
- label: enable(),
1638
- flags: None$2,
1639
- command: 'SearchExtensions.enable'
1640
- }, {
1641
- id: 'disable',
1642
- label: disable(),
1643
- flags: None$2,
1644
- command: 'SearchExtensions.disable'
1645
- }, {
1646
- id: 'installAnotherVersion',
1647
- label: installAnotherVersion(),
1648
- flags: None$2,
1649
- command: 'SearchExtensions.installAnotherVersion'
1650
- }, {
1651
- id: 'copy',
1652
- label: copy(),
1653
- flags: None$2,
1654
- command: 'SearchExtensions.copy'
1655
- }, {
1656
- id: 'copyExtensionId',
1657
- label: copyExtensionId(),
1658
- flags: None$2,
1659
- command: 'SearchExtensions.copyExtensionId'
1660
- }];
1661
- };
1662
-
1663
- const handleBlur = state => {
1664
- return {
1665
- ...state,
1666
- focus: None$3
1667
- };
1668
- };
1669
-
1670
- const getExtensionDetailUri = extensionId => {
1671
- return `extension-detail://${extensionId}`;
1672
- };
1673
-
1674
- const None$1 = 'none';
1675
-
1676
- const Button = 1;
1677
- const Div = 4;
1678
- const Input = 6;
1679
- const Text = 12;
1680
- const Img = 17;
1681
-
1682
- const DebugWorker = 55;
1683
- const RendererWorker$1 = 1;
1684
-
1685
- const rpcs = Object.create(null);
1686
- const set$2 = (id, rpc) => {
1687
- rpcs[id] = rpc;
1688
- };
1689
- const get = id => {
1690
- return rpcs[id];
1691
- };
1692
-
1693
- const create = rpcId => {
1694
- return {
1695
- // @ts-ignore
1696
- invoke(method, ...params) {
1697
- const rpc = get(rpcId);
1698
- // @ts-ignore
1699
- return rpc.invoke(method, ...params);
1700
- },
1701
- // @ts-ignore
1702
- invokeAndTransfer(method, ...params) {
1703
- const rpc = get(rpcId);
1704
- // @ts-ignore
1705
- return rpc.invokeAndTransfer(method, ...params);
1706
- },
1707
- set(rpc) {
1708
- set$2(rpcId, rpc);
1709
- },
1710
- async dispose() {
1711
- const rpc = get(rpcId);
1712
- await rpc.dispose();
1713
- }
1714
- };
1715
- };
1716
-
1717
- const {
1718
- invoke: invoke$1,
1719
- invokeAndTransfer,
1720
- set: set$1,
1721
- dispose
1722
- } = create(RendererWorker$1);
1723
- const searchFileHtml = async uri => {
1724
- return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1725
- };
1726
- const getFilePathElectron = async file => {
1727
- return invoke$1('FileSystemHandle.getFilePathElectron', file);
1728
- };
1729
- const showContextMenu$1 = async (x, y, id, ...args) => {
1730
- return invoke$1('ContextMenu.show', x, y, id, ...args);
1731
- };
1732
- const getElectronVersion = async () => {
1733
- return invoke$1('Process.getElectronVersion');
1734
- };
1735
- const applyBulkReplacement = async bulkEdits => {
1736
- await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1737
- };
1738
- const setColorTheme = async id => {
1739
- // @ts-ignore
1740
- return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1741
- };
1742
- const getNodeVersion = async () => {
1743
- return invoke$1('Process.getNodeVersion');
1744
- };
1745
- const getChromeVersion = async () => {
1746
- return invoke$1('Process.getChromeVersion');
1747
- };
1748
- const getV8Version = async () => {
1749
- return invoke$1('Process.getV8Version');
1750
- };
1751
- const getFileHandles = async fileIds => {
1752
- const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1753
- return files;
1754
- };
1755
- const setWorkspacePath = async path => {
1756
- await invoke$1('Workspace.setPath', path);
1757
- };
1758
- const registerWebViewInterceptor = async (id, port) => {
1759
- await invokeAndTransfer('WebView.registerInterceptor', id, port);
1760
- };
1761
- const unregisterWebViewInterceptor = async id => {
1762
- await invoke$1('WebView.unregisterInterceptor', id);
1414
+ const unregisterWebViewInterceptor = async id => {
1415
+ await invoke$1('WebView.unregisterInterceptor', id);
1763
1416
  };
1764
1417
  const sendMessagePortToEditorWorker = async (port, rpcId) => {
1765
1418
  const command = 'HandleMessagePort.handleMessagePort';
@@ -1776,6 +1429,11 @@ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1776
1429
  // @ts-ignore
1777
1430
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1778
1431
  };
1432
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1433
+ const command = 'IconTheme.handleMessagePort';
1434
+ // @ts-ignore
1435
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1436
+ };
1779
1437
  const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1780
1438
  const command = 'FileSystem.handleMessagePort';
1781
1439
  // @ts-ignore
@@ -1833,7 +1491,7 @@ const confirm = async (message, options) => {
1833
1491
  const getRecentlyOpened = async () => {
1834
1492
  return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1835
1493
  };
1836
- const getKeyBindings = async () => {
1494
+ const getKeyBindings$1 = async () => {
1837
1495
  return invoke$1('KeyBindingsInitial.getKeyBindings');
1838
1496
  };
1839
1497
  const writeClipBoardText = async text => {
@@ -1955,112 +1613,571 @@ const setExtensionsSearchValue = async searchValue => {
1955
1613
  // @ts-ignore
1956
1614
  return invoke$1('Extensions.handleInput', searchValue);
1957
1615
  };
1958
- const openExternal = async uri => {
1959
- // @ts-ignore
1960
- await invoke$1('Open.openExternal', uri);
1616
+ const openExternal = async uri => {
1617
+ // @ts-ignore
1618
+ await invoke$1('Open.openExternal', uri);
1619
+ };
1620
+ const openUrl = async uri => {
1621
+ // @ts-ignore
1622
+ await invoke$1('Open.openUrl', uri);
1623
+ };
1624
+ const getAllPreferences = async () => {
1625
+ // @ts-ignore
1626
+ return invoke$1('Preferences.getAll');
1627
+ };
1628
+ const showSaveFilePicker = async () => {
1629
+ // @ts-ignore
1630
+ return invoke$1('FilePicker.showSaveFilePicker');
1631
+ };
1632
+ const getLogsDir = async () => {
1633
+ // @ts-ignore
1634
+ return invoke$1('PlatformPaths.getLogsDir');
1635
+ };
1636
+ const registerMockRpc = commandMap => {
1637
+ const mockRpc = createMockRpc({
1638
+ commandMap
1639
+ });
1640
+ set$2(mockRpc);
1641
+ return mockRpc;
1642
+ };
1643
+
1644
+ const RendererWorker = {
1645
+ __proto__: null,
1646
+ activateByEvent,
1647
+ applyBulkReplacement,
1648
+ closeWidget,
1649
+ confirm,
1650
+ disableExtension,
1651
+ dispose: dispose$2,
1652
+ enableExtension,
1653
+ getActiveEditorId,
1654
+ getAllExtensions: getAllExtensions$2,
1655
+ getAllPreferences,
1656
+ getBlob,
1657
+ getChromeVersion,
1658
+ getColorThemeNames,
1659
+ getElectronVersion,
1660
+ getExtension,
1661
+ getExtensionCommands,
1662
+ getFileHandles,
1663
+ getFileIcon,
1664
+ getFilePathElectron,
1665
+ getFolderIcon,
1666
+ getFolderSize,
1667
+ getIcons,
1668
+ getKeyBindings: getKeyBindings$1,
1669
+ getLogsDir,
1670
+ getMarkdownDom,
1671
+ getNodeVersion,
1672
+ getPreference,
1673
+ getRecentlyOpened,
1674
+ getV8Version,
1675
+ getWebViewSecret,
1676
+ getWindowId,
1677
+ getWorkspacePath,
1678
+ handleDebugChange,
1679
+ handleDebugPaused,
1680
+ handleDebugResumed,
1681
+ handleDebugScriptParsed,
1682
+ installExtension,
1683
+ invoke: invoke$1,
1684
+ invokeAndTransfer,
1685
+ openExtensionSearch,
1686
+ openExternal,
1687
+ openNativeFolder,
1688
+ openUri: openUri$2,
1689
+ openUrl,
1690
+ openWidget,
1691
+ readFile,
1692
+ registerMockRpc,
1693
+ registerWebViewInterceptor,
1694
+ renderMarkdown,
1695
+ rerenderEditor,
1696
+ searchFileFetch,
1697
+ searchFileHtml,
1698
+ searchFileMemory,
1699
+ sendMessagePortToEditorWorker,
1700
+ sendMessagePortToErrorWorker,
1701
+ sendMessagePortToExtensionHostWorker,
1702
+ sendMessagePortToFileSystemWorker,
1703
+ sendMessagePortToIconThemeWorker,
1704
+ sendMessagePortToMarkdownWorker,
1705
+ sendMessagePortToRendererProcess,
1706
+ sendMessagePortToSearchProcess,
1707
+ sendMessagePortToSyntaxHighlightingWorker,
1708
+ set: set$2,
1709
+ setAdditionalFocus,
1710
+ setColorTheme,
1711
+ setExtensionsSearchValue,
1712
+ setFocus,
1713
+ setWebViewPort,
1714
+ setWorkspacePath,
1715
+ showContextMenu: showContextMenu$1,
1716
+ showErrorDialog,
1717
+ showMessageBox,
1718
+ showSaveFilePicker,
1719
+ uninstallExtension,
1720
+ unregisterWebViewInterceptor,
1721
+ writeClipBoardImage,
1722
+ writeClipBoardText
1723
+ };
1724
+
1725
+ const copyExtensionId = async state => {
1726
+ const {
1727
+ items,
1728
+ focusedIndex
1729
+ } = state;
1730
+ if (focusedIndex === -1) {
1731
+ return state;
1732
+ }
1733
+ const item = items[focusedIndex];
1734
+ const {
1735
+ id
1736
+ } = item;
1737
+ await writeClipBoardText(id);
1738
+ return state;
1739
+ };
1740
+
1741
+ const stringifyRow = row => {
1742
+ const {
1743
+ key,
1744
+ value
1745
+ } = row;
1746
+ return `${key}: ${value}`.trim();
1747
+ };
1748
+ const getExtensionInfoText = extension => {
1749
+ const {
1750
+ name: name$1,
1751
+ id: id$1,
1752
+ publisher: publisher$1,
1753
+ description: description$1
1754
+ } = extension;
1755
+ const version$1 = ''; // TODO
1756
+ const marketplaceLink$1 = ''; // TODO
1757
+ const rows = [{
1758
+ key: name(),
1759
+ value: name$1
1760
+ }, {
1761
+ key: id(),
1762
+ value: id$1
1763
+ }, {
1764
+ key: description(),
1765
+ value: description$1
1766
+ }, {
1767
+ key: version(),
1768
+ value: version$1
1769
+ }, {
1770
+ key: publisher(),
1771
+ value: publisher$1
1772
+ }, {
1773
+ key: marketplaceLink(),
1774
+ value: marketplaceLink$1
1775
+ }];
1776
+ const infoRows = rows.map(stringifyRow);
1777
+ const infoText = infoRows.join('\n');
1778
+ return infoText;
1779
+ };
1780
+
1781
+ const copyExtensionInfo = async state => {
1782
+ const {
1783
+ items,
1784
+ focusedIndex
1785
+ } = state;
1786
+ if (focusedIndex === -1) {
1787
+ return state;
1788
+ }
1789
+ const item = items[focusedIndex];
1790
+ const text = getExtensionInfoText(item);
1791
+ await writeClipBoardText(text);
1792
+ return state;
1793
+ };
1794
+
1795
+ const {
1796
+ get,
1797
+ set: set$1,
1798
+ dispose: dispose$1,
1799
+ wrapCommand,
1800
+ wrapGetter
1801
+ } = create$2();
1802
+
1803
+ const create = (id, uri, x, y, width, height, platform, assetDir) => {
1804
+ const state = {
1805
+ allExtensions: [],
1806
+ assetDir,
1807
+ deltaY: 0,
1808
+ finalDeltaY: 0,
1809
+ focus: 0,
1810
+ focused: false,
1811
+ focusedIndex: 0,
1812
+ handleOffset: 0,
1813
+ headerHeight: 41,
1814
+ height,
1815
+ inputActions: [],
1816
+ inputSource: 0,
1817
+ itemHeight: 72,
1818
+ items: [],
1819
+ maxLineY: 0,
1820
+ message: '',
1821
+ minimumSliderSize: 0,
1822
+ minLineY: 0,
1823
+ negativeMargin: 0,
1824
+ placeholder: '',
1825
+ platform,
1826
+ scrollBarActive: false,
1827
+ scrollBarHeight: 0,
1828
+ scrollBarY: 0,
1829
+ searchValue: '',
1830
+ size: 0,
1831
+ uid: id,
1832
+ width,
1833
+ x,
1834
+ y
1835
+ };
1836
+ set$1(id, state, state);
1837
+ };
1838
+
1839
+ const isEqual$2 = (oldState, newState) => {
1840
+ if (!newState.focus) {
1841
+ return true;
1842
+ }
1843
+ return oldState.focus === newState.focus;
1844
+ };
1845
+
1846
+ const isEqual$1 = (oldState, newState) => {
1847
+ return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder;
1848
+ };
1849
+
1850
+ const isEqual = (oldState, newState) => {
1851
+ return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1852
+ };
1853
+
1854
+ const RenderHeader = 1;
1855
+ const RenderFocus = 2;
1856
+ const RenderItems = 4;
1857
+ const RenderScrollBar = 5;
1858
+ const RenderMessage = 6;
1859
+ const RenderSearchValue = 7;
1860
+ const RenderFocusContext = 8;
1861
+
1862
+ const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2];
1863
+ const numbers = [RenderItems, RenderFocus, RenderSearchValue, RenderFocusContext];
1864
+
1865
+ const diff2 = uid => {
1866
+ const {
1867
+ oldState,
1868
+ newState
1869
+ } = get(uid);
1870
+ const diffResult = [];
1871
+ for (let i = 0; i < modules.length; i++) {
1872
+ const fn = modules[i];
1873
+ if (!fn(oldState, newState)) {
1874
+ diffResult.push(numbers[i]);
1875
+ }
1876
+ }
1877
+ return diffResult;
1878
+ };
1879
+
1880
+ const dispose = uid => {
1881
+ dispose$1(uid);
1882
+ };
1883
+
1884
+ // TODO optimize this function to return the minimum number
1885
+ // of visible items needed, e.g. when not scrolled 5 items with
1886
+ // 20px fill 100px but when scrolled 6 items are needed
1887
+ const getNumberOfVisibleItems = (listHeight, itemHeight) => {
1888
+ return Math.ceil(listHeight / itemHeight) + 1;
1889
+ };
1890
+ const getScrollBarOffset = (delta, finalDelta, size, scrollBarSize) => {
1891
+ const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
1892
+ return scrollBarOffset;
1893
+ };
1894
+ const getScrollBarY = getScrollBarOffset;
1895
+ const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength) => {
1896
+ const {
1897
+ finalDeltaY,
1898
+ height,
1899
+ headerHeight,
1900
+ scrollBarHeight
1901
+ } = state;
1902
+ const newMaxLineY = Math.min(index + 1, itemsLength);
1903
+ const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
1904
+ const newMinLineY = Math.max(newMaxLineY - fittingItems, 0);
1905
+ const newDeltaY = itemsLength < fittingItems ? 0 : newMinLineY * itemHeight - listHeight % itemHeight + itemHeight;
1906
+ const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
1907
+ return {
1908
+ ...state,
1909
+ focusedIndex: index,
1910
+ minLineY: newMinLineY,
1911
+ maxLineY: newMaxLineY,
1912
+ focused: true,
1913
+ deltaY: newDeltaY,
1914
+ scrollBarY
1915
+ };
1916
+ };
1917
+ const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) => {
1918
+ const {
1919
+ finalDeltaY,
1920
+ height,
1921
+ headerHeight,
1922
+ scrollBarHeight
1923
+ } = state;
1924
+ const newMinLineY = index;
1925
+ const fittingItems = getNumberOfVisibleItems(listHeight, itemHeight);
1926
+ const newMaxLineY = Math.min(newMinLineY + fittingItems, itemsLength);
1927
+ const newDeltaY = newMinLineY * itemHeight;
1928
+ const scrollBarY = getScrollBarY(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
1929
+ return {
1930
+ ...state,
1931
+ focusedIndex: index,
1932
+ minLineY: newMinLineY,
1933
+ maxLineY: newMaxLineY,
1934
+ focused: true,
1935
+ deltaY: newDeltaY,
1936
+ scrollBarY
1937
+ };
1938
+ };
1939
+ const focusIndex = (state, index) => {
1940
+ const {
1941
+ itemHeight,
1942
+ minLineY,
1943
+ maxLineY,
1944
+ headerHeight,
1945
+ height,
1946
+ items
1947
+ } = state;
1948
+ const itemsLength = items.length;
1949
+ if (itemsLength === 0) {
1950
+ return state;
1951
+ }
1952
+ number(itemHeight);
1953
+ if (index === -1) {
1954
+ return {
1955
+ ...state,
1956
+ focusedIndex: -1,
1957
+ focused: true
1958
+ };
1959
+ }
1960
+ const listHeight = height - headerHeight;
1961
+ if (index < minLineY + 1) {
1962
+ return focusIndexScrollUp(state, index, listHeight, itemHeight, itemsLength);
1963
+ }
1964
+ if (index >= maxLineY - 1) {
1965
+ return focusIndexScrollDown(state, index, listHeight, itemHeight, itemsLength);
1966
+ }
1967
+ return {
1968
+ ...state,
1969
+ focusedIndex: index,
1970
+ focused: true
1971
+ };
1972
+ };
1973
+ const first = () => {
1974
+ return 0;
1975
+ };
1976
+ const last = items => {
1977
+ return items.length - 1;
1978
+ };
1979
+ const next = (items, index) => {
1980
+ return (index + 1) % items.length;
1981
+ };
1982
+ const previous = (items, index) => {
1983
+ return index === 0 ? items.length - 1 : index - 1;
1984
+ };
1985
+ const focusFirst = state => {
1986
+ const firstIndex = first();
1987
+ return focusIndex(state, firstIndex);
1988
+ };
1989
+ const focusLast = state => {
1990
+ const {
1991
+ items
1992
+ } = state;
1993
+ const lastIndex = last(items);
1994
+ return focusIndex(state, lastIndex);
1995
+ };
1996
+ const focusNext = state => {
1997
+ const {
1998
+ focusedIndex,
1999
+ items
2000
+ } = state;
2001
+ const nextIndex = next(items, focusedIndex);
2002
+ return focusIndex(state, nextIndex);
2003
+ };
2004
+
2005
+ // based on https://github.com/microsoft/vscode/blob/c0769274fa136b45799edeccc0d0a2f645b75caf/src/vs/base/common/arrays.ts#L625 (License MIT)
2006
+
2007
+ const isLastIndex = (array, index) => {
2008
+ return index === array.length - 1;
2009
+ };
2010
+ const lastIndex = array => {
2011
+ return array.length - 1;
2012
+ };
2013
+ const focusNextPage = state => {
2014
+ const {
2015
+ focusedIndex,
2016
+ items,
2017
+ maxLineY,
2018
+ minLineY
2019
+ } = state;
2020
+ if (isLastIndex(items, focusedIndex)) {
2021
+ return state;
2022
+ }
2023
+ const indexNextPage = Math.min(maxLineY + (maxLineY - minLineY) - 2, lastIndex(items));
2024
+ return focusIndex(state, indexNextPage);
2025
+ };
2026
+ const focusPrevious = state => {
2027
+ const {
2028
+ focusedIndex,
2029
+ items
2030
+ } = state;
2031
+ if (focusedIndex === 0 || focusedIndex === -1) {
2032
+ return state;
2033
+ }
2034
+ const previousIndex = previous(items, focusedIndex);
2035
+ return focusIndex(state, previousIndex);
2036
+ };
2037
+ const focusPreviousPage = state => {
2038
+ const {
2039
+ focusedIndex,
2040
+ minLineY,
2041
+ maxLineY
2042
+ } = state;
2043
+ if (focusedIndex === 0 || focusedIndex === -1) {
2044
+ return state;
2045
+ }
2046
+ const indexPreviousPage = Math.max(minLineY - (maxLineY - minLineY) + 1, 0);
2047
+ return focusIndex(state, indexPreviousPage);
1961
2048
  };
1962
- const openUrl = async uri => {
1963
- // @ts-ignore
1964
- await invoke$1('Open.openUrl', uri);
2049
+
2050
+ const Button = 1;
2051
+
2052
+ const ClearAll = 'ClearAll';
2053
+ const Filter = 'Filter';
2054
+ const Refresh = 'Refresh';
2055
+ const Ellipsis = 'Ellipsis';
2056
+
2057
+ const getActions = () => {
2058
+ return [{
2059
+ type: Button,
2060
+ id: refresh(),
2061
+ icon: Refresh,
2062
+ command: ''
2063
+ }, {
2064
+ type: Button,
2065
+ id: viewsAndMoreActions(),
2066
+ icon: Ellipsis,
2067
+ command: ''
2068
+ }];
1965
2069
  };
1966
- const getAllPreferences = async () => {
1967
- // @ts-ignore
1968
- return invoke$1('Preferences.getAll');
2070
+
2071
+ const commandMapRef = {};
2072
+
2073
+ const toCommandId = key => {
2074
+ const dotIndex = key.indexOf('.');
2075
+ return key.slice(dotIndex + 1);
1969
2076
  };
1970
- const showSaveFilePicker = async () => {
1971
- // @ts-ignore
1972
- return invoke$1('FilePicker.showSaveFilePicker');
2077
+ const getCommandIds = () => {
2078
+ const keys = Object.keys(commandMapRef);
2079
+ const ids = keys.map(toCommandId);
2080
+ return ids;
1973
2081
  };
1974
- const getLogsDir = async () => {
1975
- // @ts-ignore
1976
- return invoke$1('PlatformPaths.getLogsDir');
2082
+
2083
+ const Enter = 3;
2084
+ const Space = 9;
2085
+ const PageUp = 10;
2086
+ const PageDown = 11;
2087
+ const End = 255;
2088
+ const Home = 12;
2089
+ const UpArrow = 14;
2090
+ const DownArrow = 16;
2091
+
2092
+ const CtrlCmd = 1 << 11 >>> 0;
2093
+
2094
+ const FocusExtensions = 15;
2095
+ const FocusExtensionsInput = 7000;
2096
+
2097
+ const getKeyBindings = () => {
2098
+ return [{
2099
+ key: Home,
2100
+ command: 'Extensions.focusFirst',
2101
+ when: FocusExtensions
2102
+ }, {
2103
+ key: End,
2104
+ command: 'Extensions.focusLast',
2105
+ when: FocusExtensions
2106
+ }, {
2107
+ key: PageUp,
2108
+ command: 'Extensions.focusPreviousPage',
2109
+ when: FocusExtensions
2110
+ }, {
2111
+ key: PageDown,
2112
+ command: 'Extensions.focusNextPage',
2113
+ when: FocusExtensions
2114
+ }, {
2115
+ key: UpArrow,
2116
+ command: 'Extensions.focusPrevious',
2117
+ when: FocusExtensions
2118
+ }, {
2119
+ key: DownArrow,
2120
+ command: 'Extensions.focusNext',
2121
+ when: FocusExtensions
2122
+ }, {
2123
+ key: Space,
2124
+ command: 'Extensions.handleClickCurrentButKeepFocus',
2125
+ when: FocusExtensions
2126
+ }, {
2127
+ key: Enter,
2128
+ command: 'Extensions.handleClickCurrent',
2129
+ when: FocusExtensions
2130
+ }, {
2131
+ key: CtrlCmd | Space,
2132
+ command: 'Extensions.toggleSuggest',
2133
+ when: FocusExtensions
2134
+ }, {
2135
+ key: CtrlCmd | DownArrow,
2136
+ command: 'Extensions.scrollDown',
2137
+ when: FocusExtensions
2138
+ }];
1977
2139
  };
1978
- const registerMockRpc = commandMap => {
1979
- const mockRpc = createMockRpc({
1980
- commandMap
1981
- });
1982
- set$1(mockRpc);
1983
- return mockRpc;
2140
+
2141
+ const None$1 = 0;
2142
+
2143
+ const getMenuEntries = () => {
2144
+ return [{
2145
+ id: 'enable',
2146
+ label: enable(),
2147
+ flags: None$1,
2148
+ command: 'SearchExtensions.enable'
2149
+ }, {
2150
+ id: 'disable',
2151
+ label: disable(),
2152
+ flags: None$1,
2153
+ command: 'SearchExtensions.disable'
2154
+ }, {
2155
+ id: 'installAnotherVersion',
2156
+ label: installAnotherVersion(),
2157
+ flags: None$1,
2158
+ command: 'SearchExtensions.installAnotherVersion'
2159
+ }, {
2160
+ id: 'copy',
2161
+ label: copy(),
2162
+ flags: None$1,
2163
+ command: 'SearchExtensions.copy'
2164
+ }, {
2165
+ id: 'copyExtensionId',
2166
+ label: copyExtensionId$1(),
2167
+ flags: None$1,
2168
+ command: 'SearchExtensions.copyExtensionId'
2169
+ }];
1984
2170
  };
1985
2171
 
1986
- const RendererWorker = {
1987
- __proto__: null,
1988
- activateByEvent,
1989
- applyBulkReplacement,
1990
- closeWidget,
1991
- confirm,
1992
- disableExtension,
1993
- dispose,
1994
- enableExtension,
1995
- getActiveEditorId,
1996
- getAllExtensions: getAllExtensions$2,
1997
- getAllPreferences,
1998
- getBlob,
1999
- getChromeVersion,
2000
- getColorThemeNames,
2001
- getElectronVersion,
2002
- getExtension,
2003
- getExtensionCommands,
2004
- getFileHandles,
2005
- getFileIcon,
2006
- getFilePathElectron,
2007
- getFolderIcon,
2008
- getFolderSize,
2009
- getIcons,
2010
- getKeyBindings,
2011
- getLogsDir,
2012
- getMarkdownDom,
2013
- getNodeVersion,
2014
- getPreference,
2015
- getRecentlyOpened,
2016
- getV8Version,
2017
- getWebViewSecret,
2018
- getWindowId,
2019
- getWorkspacePath,
2020
- handleDebugChange,
2021
- handleDebugPaused,
2022
- handleDebugResumed,
2023
- handleDebugScriptParsed,
2024
- installExtension,
2025
- invoke: invoke$1,
2026
- invokeAndTransfer,
2027
- openExtensionSearch,
2028
- openExternal,
2029
- openNativeFolder,
2030
- openUri: openUri$2,
2031
- openUrl,
2032
- openWidget,
2033
- readFile,
2034
- registerMockRpc,
2035
- registerWebViewInterceptor,
2036
- renderMarkdown,
2037
- rerenderEditor,
2038
- searchFileFetch,
2039
- searchFileHtml,
2040
- searchFileMemory,
2041
- sendMessagePortToEditorWorker,
2042
- sendMessagePortToErrorWorker,
2043
- sendMessagePortToExtensionHostWorker,
2044
- sendMessagePortToFileSystemWorker,
2045
- sendMessagePortToMarkdownWorker,
2046
- sendMessagePortToRendererProcess,
2047
- sendMessagePortToSearchProcess,
2048
- sendMessagePortToSyntaxHighlightingWorker,
2049
- set: set$1,
2050
- setAdditionalFocus,
2051
- setColorTheme,
2052
- setExtensionsSearchValue,
2053
- setFocus,
2054
- setWebViewPort,
2055
- setWorkspacePath,
2056
- showContextMenu: showContextMenu$1,
2057
- showErrorDialog,
2058
- showMessageBox,
2059
- showSaveFilePicker,
2060
- uninstallExtension,
2061
- unregisterWebViewInterceptor,
2062
- writeClipBoardImage,
2063
- writeClipBoardText
2172
+ const handleBlur = state => {
2173
+ return {
2174
+ ...state,
2175
+ focus: None$3
2176
+ };
2177
+ };
2178
+
2179
+ const getExtensionDetailUri = extensionId => {
2180
+ return `extension-detail://${extensionId}`;
2064
2181
  };
2065
2182
 
2066
2183
  const {
@@ -2091,6 +2208,18 @@ const handleClick = async (state, index) => {
2091
2208
  return newState;
2092
2209
  };
2093
2210
 
2211
+ const mergeClassNames = (...classNames) => {
2212
+ return classNames.filter(Boolean).join(' ');
2213
+ };
2214
+
2215
+ const text = data => {
2216
+ return {
2217
+ type: Text,
2218
+ text: data,
2219
+ childCount: 0
2220
+ };
2221
+ };
2222
+
2094
2223
  const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight, headerHeight) => {
2095
2224
  const relativeDeltaY = deltaY % itemHeight;
2096
2225
  const relativeY = eventY - y - headerHeight + relativeDeltaY;
@@ -2098,7 +2227,10 @@ const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight, headerHeight) =>
2098
2227
  return index;
2099
2228
  };
2100
2229
 
2101
- const handleClickAt = async (state, eventX, eventY) => {
2230
+ const handleClickAt = async (state, button, eventX, eventY) => {
2231
+ if (button !== LeftClick) {
2232
+ return state;
2233
+ }
2102
2234
  const {
2103
2235
  x,
2104
2236
  y,
@@ -2315,19 +2447,19 @@ const getAllExtensions = platform => {
2315
2447
  return getAllExtensions$1(platform);
2316
2448
  };
2317
2449
 
2318
- const HandleClearSearchResults = 'handleClearSearchResults';
2319
- const HandleClickFilter = 'handleClickFilter';
2320
- const HandleContextMenu = 'handleContextMenu';
2321
- const HandleExtensionsInput = 'handleExtensionsInput';
2322
- const HandleFocus = 'handleFocus';
2323
- const HandlePointerDown = 'handlePointerDown';
2324
- const HandleScrollBarMove = 'handleScrollBarMove';
2325
- const HandleScrollBarPointerCaptureLost = 'handleScrollBarPointerCaptureLost';
2326
- const HandleScrollBarPointerDown = 'handleScrollBarPointerDown';
2327
- const HandleTouchEnd = 'handleTouchEnd';
2328
- const HandleTouchMove = 'handleTouchMove';
2329
- const HandleTouchStart = 'handleTouchStart';
2330
- const HandleWheel = 'handleWheel';
2450
+ const HandleClearSearchResults = 1;
2451
+ const HandleClickFilter = 2;
2452
+ const HandleContextMenu = 3;
2453
+ const HandleExtensionsInput = 4;
2454
+ const HandleFocus = 5;
2455
+ const HandlePointerDown = 7;
2456
+ const HandleScrollBarMove = 9;
2457
+ const HandleScrollBarPointerCaptureLost = 10;
2458
+ const HandleScrollBarPointerDown = 11;
2459
+ const HandleTouchEnd = 12;
2460
+ const HandleTouchMove = 13;
2461
+ const HandleTouchStart = 14;
2462
+ const HandleWheel = 15;
2331
2463
 
2332
2464
  const getInputActions = newState => {
2333
2465
  const clearEnabled = newState.searchValue.length > 0;
@@ -2335,12 +2467,12 @@ const getInputActions = newState => {
2335
2467
  onClick: HandleClearSearchResults,
2336
2468
  icon: `MaskIcon${ClearAll}`,
2337
2469
  title: clearExtensionSearchResults(),
2338
- type: Button$1,
2470
+ type: Button,
2339
2471
  enabled: clearEnabled
2340
2472
  }, {
2341
2473
  icon: `MaskIcon${Filter}`,
2342
2474
  title: filter(),
2343
- type: Button$1,
2475
+ type: Button,
2344
2476
  onClick: HandleClickFilter,
2345
2477
  enabled: true
2346
2478
  }];
@@ -2547,18 +2679,6 @@ const renderFocusContext = newState => {
2547
2679
  return [];
2548
2680
  };
2549
2681
 
2550
- const mergeClassNames = (...classNames) => {
2551
- return classNames.filter(Boolean).join(' ');
2552
- };
2553
-
2554
- const text = data => {
2555
- return {
2556
- type: Text,
2557
- text: data,
2558
- childCount: 0
2559
- };
2560
- };
2561
-
2562
2682
  const Actions = 'Actions';
2563
2683
  const ExtensionActions = 'ExtensionActions';
2564
2684
  const ExtensionActive = 'ExtensionActive';
@@ -2592,11 +2712,12 @@ const ListItem = 'listitem';
2592
2712
  const None = 'none';
2593
2713
  const ToolBar = 'toolbar';
2594
2714
 
2715
+ const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2595
2716
  const getClassName$1 = enabled => {
2596
2717
  if (enabled) {
2597
2718
  return SearchFieldButton;
2598
2719
  }
2599
- return mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2720
+ return disabledClassName;
2600
2721
  };
2601
2722
  const getSearchFieldButtonVirtualDom = button => {
2602
2723
  const {
@@ -2606,7 +2727,7 @@ const getSearchFieldButtonVirtualDom = button => {
2606
2727
  onClick
2607
2728
  } = button;
2608
2729
  return [{
2609
- type: Div,
2730
+ type: Button$2,
2610
2731
  className: getClassName$1(enabled),
2611
2732
  title,
2612
2733
  tabIndex: 0,
@@ -2628,10 +2749,12 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2628
2749
  childCount: 2
2629
2750
  }, {
2630
2751
  type: Input,
2752
+ inputType: 'search',
2631
2753
  className: MultilineInputBox,
2632
2754
  spellcheck: false,
2633
2755
  autocapitalize: 'off',
2634
2756
  autocorrect: 'off',
2757
+ autocomplete: 'off',
2635
2758
  placeholder,
2636
2759
  name,
2637
2760
  onInput,
@@ -2868,7 +2991,7 @@ const getExtensionsViewVirtualDom = state => {
2868
2991
  childCount: 2,
2869
2992
  ariaLive: 'polite',
2870
2993
  ariaBusy: false,
2871
- role: None$1
2994
+ role: None$2
2872
2995
  }, ...getExtensionHeaderVirtualDom(placeholder, inputActions), ...getContentVirtualDom(visibleExtensions, message, scrollBarHeight, scrollBarY)];
2873
2996
  };
2874
2997
 
@@ -2938,8 +3061,8 @@ const render3 = (uid, diffResult) => {
2938
3061
  const {
2939
3062
  oldState,
2940
3063
  newState
2941
- } = get$1(uid);
2942
- set$3(uid, newState, newState);
3064
+ } = get(uid);
3065
+ set$1(uid, newState, newState);
2943
3066
  const commands = applyRender(oldState, newState, diffResult);
2944
3067
  return commands;
2945
3068
  };
@@ -2956,21 +3079,19 @@ const getIconVirtualDom = (icon, type = Div) => {
2956
3079
  const getActionButtonVirtualDom = action => {
2957
3080
  const {
2958
3081
  id,
2959
- icon,
2960
- command
3082
+ icon
2961
3083
  } = action;
2962
3084
  return [{
2963
- type: Button,
3085
+ type: Button$2,
2964
3086
  className: IconButton,
2965
3087
  title: id,
2966
- 'data-command': command,
2967
3088
  childCount: 1
2968
3089
  }, getIconVirtualDom(icon)];
2969
3090
  };
2970
3091
 
2971
3092
  const getActionVirtualDom = action => {
2972
3093
  switch (action.type) {
2973
- case Button$1:
3094
+ case Button:
2974
3095
  return getActionButtonVirtualDom(action);
2975
3096
  default:
2976
3097
  return [];
@@ -2990,7 +3111,7 @@ const renderActions = uid => {
2990
3111
  const {
2991
3112
  oldState,
2992
3113
  newState
2993
- } = get$1(uid);
3114
+ } = get(uid);
2994
3115
  if (oldState === newState) {
2995
3116
  return [];
2996
3117
  }
@@ -3002,30 +3123,30 @@ const renderActions = uid => {
3002
3123
  const renderEventListeners = () => {
3003
3124
  return [{
3004
3125
  name: HandleContextMenu,
3005
- params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
3126
+ params: ['handleContextMenu', Button$1, ClientX, ClientY],
3006
3127
  preventDefault: true
3007
3128
  }, {
3008
3129
  name: HandlePointerDown,
3009
- params: ['handleClickAt', 'event.clientX', 'event.clientY'],
3130
+ params: ['handleClickAt', Button$1, ClientX, ClientY],
3010
3131
  preventDefault: true
3011
3132
  }, {
3012
3133
  name: HandleScrollBarPointerDown,
3013
- params: ['handleScrollBarClick', 'event.clientY'],
3134
+ params: ['handleScrollBarClick', ClientY],
3014
3135
  preventDefault: true,
3015
3136
  trackPointerEvents: [HandleScrollBarMove, HandleScrollBarPointerCaptureLost]
3016
3137
  }, {
3017
3138
  name: HandleScrollBarMove,
3018
- params: ['handleScrollBarMove', 'event.clientY']
3139
+ params: ['handleScrollBarMove', ClientY]
3019
3140
  }, {
3020
3141
  name: HandleScrollBarPointerCaptureLost,
3021
3142
  params: ['handleScrollBarCaptureLost']
3022
3143
  }, {
3023
3144
  name: HandleWheel,
3024
- params: ['handleWheel', 'event.deltaMode', 'event.deltaY'],
3145
+ params: ['handleWheel', DeltaMode, DeltaY],
3025
3146
  passive: true
3026
3147
  }, {
3027
3148
  name: HandleExtensionsInput,
3028
- params: ['handleInput', 'event.target.value', User]
3149
+ params: ['handleInput', TargetValue, User]
3029
3150
  }, {
3030
3151
  name: HandleClearSearchResults,
3031
3152
  params: ['clearSearchResults']
@@ -3072,9 +3193,9 @@ const toggleSuggest = state => {
3072
3193
  const commandMap = {
3073
3194
  'SearchExtensions.clearSearchResults': wrapCommand(clearSearchResults),
3074
3195
  'SearchExtensions.closeSuggest': wrapCommand(closeSuggest),
3075
- 'SearchExtensions.create': create$1,
3196
+ 'SearchExtensions.create': create,
3076
3197
  'SearchExtensions.diff2': diff2,
3077
- 'SearchExtensions.dispose': dispose$1,
3198
+ 'SearchExtensions.dispose': dispose,
3078
3199
  'SearchExtensions.focusFirst': wrapCommand(focusFirst),
3079
3200
  'SearchExtensions.focusIndex': wrapCommand(focusIndex),
3080
3201
  'SearchExtensions.focusLast': wrapCommand(focusLast),
@@ -3084,9 +3205,10 @@ const commandMap = {
3084
3205
  'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
3085
3206
  'SearchExtensions.getActions': getActions,
3086
3207
  'SearchExtensions.getCommandIds': getCommandIds,
3087
- 'SearchExtensions.getKeyBindings': getKeyBindings$1,
3208
+ 'SearchExtensions.getKeyBindings': getKeyBindings,
3088
3209
  'SearchExtensions.getMenuEntries': getMenuEntries,
3089
3210
  'SearchExtensions.handleBlur': wrapCommand(handleBlur),
3211
+ 'SearchExtensions.copyExtensionInfo': wrapCommand(copyExtensionInfo),
3090
3212
  'SearchExtensions.handleClick': wrapCommand(handleClick),
3091
3213
  'SearchExtensions.handleClickAt': wrapCommand(handleClickAt),
3092
3214
  'SearchExtensions.handleClickCurrent': wrapCommand(handleClickCurrent),
@@ -3105,6 +3227,7 @@ const commandMap = {
3105
3227
  'SearchExtensions.handleWheel': wrapCommand(handleWheel),
3106
3228
  'SearchExtensions.loadContent': wrapCommand(loadContent),
3107
3229
  'SearchExtensions.openSuggest': wrapCommand(openSuggest),
3230
+ 'SearchExtensions.copyExtensionId': wrapCommand(copyExtensionId),
3108
3231
  'SearchExtensions.render3': render3,
3109
3232
  'SearchExtensions.renderActions': renderActions,
3110
3233
  'SearchExtensions.renderEventListeners': renderEventListeners,