@lvce-editor/source-control-worker 2.10.0 → 2.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.
package/README.md CHANGED
@@ -10,7 +10,3 @@ cd source-control-worker &&
10
10
  npm ci &&
11
11
  npm test
12
12
  ```
13
-
14
- ## Gitpod
15
-
16
- [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/source-control-worker)
@@ -1018,7 +1018,7 @@ const WebWorkerRpcClient = {
1018
1018
  create: create$2
1019
1019
  };
1020
1020
 
1021
- const None = 'none';
1021
+ const None$1 = 'none';
1022
1022
  const ToolBar = 'toolbar';
1023
1023
  const Tree$1 = 'tree';
1024
1024
  const TreeItem$1 = 'treeitem';
@@ -1049,6 +1049,8 @@ const User = 1;
1049
1049
 
1050
1050
  const SourceControl$1 = 22;
1051
1051
 
1052
+ const None = 0;
1053
+
1052
1054
  const ExtensionHostWorker = 44;
1053
1055
  const RendererWorker = 1;
1054
1056
  const SourceControlWorker = 66;
@@ -1100,8 +1102,13 @@ const {
1100
1102
  invoke,
1101
1103
  invokeAndTransfer,
1102
1104
  set: set$1} = create$1(RendererWorker);
1103
- const showContextMenu = async (x, y, id, ...args) => {
1104
- return invoke('ContextMenu.show', x, y, id, ...args);
1105
+ const showContextMenu2 = async (uid, menuId, x, y, args) => {
1106
+ number(uid);
1107
+ number(menuId);
1108
+ number(x);
1109
+ number(y);
1110
+ // @ts-ignore
1111
+ await invoke('ContextMenu.show2', uid, menuId, x, y, args);
1105
1112
  };
1106
1113
  const readFile$1 = async uri => {
1107
1114
  return invoke('FileSystem.readFile', uri);
@@ -1313,6 +1320,112 @@ const getInfo = uid => {
1313
1320
  return newState.allGroups;
1314
1321
  };
1315
1322
 
1323
+ const emptyObject = {};
1324
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1325
+ const i18nString = (key, placeholders = emptyObject) => {
1326
+ if (placeholders === emptyObject) {
1327
+ return key;
1328
+ }
1329
+ const replacer = (match, rest) => {
1330
+ return placeholders[rest];
1331
+ };
1332
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1333
+ };
1334
+
1335
+ const OpenChanges = 'Open Changes';
1336
+ const OpenFile = 'Open File';
1337
+ const OpenFileHead = 'Open File (HEAD)';
1338
+ const DiscardChanges = 'Discard Changes';
1339
+ const StageChanges = 'Stage Changes';
1340
+ const AddToGitignore = 'Add to gitignore';
1341
+ const RevealInExplorerView = 'Reveal in Explorer View';
1342
+ const OpenContainingFolder = 'Open Containing Folder';
1343
+ const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
1344
+ const SourceControlInput$1 = 'Source Control Input';
1345
+
1346
+ const openChanges = () => {
1347
+ return i18nString(OpenChanges);
1348
+ };
1349
+ const openFile = () => {
1350
+ return i18nString(OpenFile);
1351
+ };
1352
+ const openFileHead = () => {
1353
+ return i18nString(OpenFileHead);
1354
+ };
1355
+ const discardChanges = () => {
1356
+ return i18nString(DiscardChanges);
1357
+ };
1358
+ const stageChanges = () => {
1359
+ return i18nString(StageChanges);
1360
+ };
1361
+ const addToGitignore = () => {
1362
+ return i18nString(AddToGitignore);
1363
+ };
1364
+ const revealInExplorerView = () => {
1365
+ return i18nString(RevealInExplorerView);
1366
+ };
1367
+ const openContainingFolder = () => {
1368
+ return i18nString(OpenContainingFolder);
1369
+ };
1370
+ const messageEnterToCommitOnMaster = () => {
1371
+ return i18nString(MessageEnterToCommitOnMaster);
1372
+ };
1373
+ const sourceControlInput = () => {
1374
+ return i18nString(SourceControlInput$1);
1375
+ };
1376
+
1377
+ const getMenuEntries = () => {
1378
+ return [{
1379
+ label: openChanges(),
1380
+ flags: None,
1381
+ command: /* TODO */'-1',
1382
+ id: ''
1383
+ }, {
1384
+ label: openFile(),
1385
+ flags: None,
1386
+ command: /* TODO */'-1',
1387
+ id: ''
1388
+ }, {
1389
+ label: openFileHead(),
1390
+ flags: None,
1391
+ command: /* TODO */'-1',
1392
+ id: ''
1393
+ }, {
1394
+ label: discardChanges(),
1395
+ flags: None,
1396
+ command: /* TODO */'-1',
1397
+ id: ''
1398
+ }, {
1399
+ label: stageChanges(),
1400
+ flags: None,
1401
+ command: /* TODO */'-1',
1402
+ id: ''
1403
+ }, {
1404
+ label: addToGitignore(),
1405
+ flags: None,
1406
+ command: /* TODO */'-1',
1407
+ id: ''
1408
+ }, {
1409
+ label: revealInExplorerView(),
1410
+ flags: None,
1411
+ command: /* TODO */'-1',
1412
+ id: ''
1413
+ }, {
1414
+ label: openContainingFolder(),
1415
+ flags: None,
1416
+ command: /* TODO */'-1',
1417
+ id: ''
1418
+ }];
1419
+ };
1420
+
1421
+ const getMenuEntries2 = state => {
1422
+ return getMenuEntries();
1423
+ };
1424
+
1425
+ const getMenuIds = () => {
1426
+ return [SourceControl$1];
1427
+ };
1428
+
1316
1429
  const activateByEvent = event => {
1317
1430
  return activateByEvent$1(event);
1318
1431
  };
@@ -1374,7 +1487,9 @@ const getDisplayItemsGroup = (group, expandedGroups, iconDefinitions) => {
1374
1487
  if (!items) {
1375
1488
  throw new Error('Source control group is missing an items property');
1376
1489
  }
1377
- const length = items.length;
1490
+ const {
1491
+ length
1492
+ } = items;
1378
1493
  const isExpanded = expandedGroups[id] || false;
1379
1494
  const type = isExpanded ? DirectoryExpanded : Directory;
1380
1495
  const icon = isExpanded ? 'ChevronDown' : 'ChevronRight';
@@ -1697,28 +1812,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1697
1812
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1698
1813
  };
1699
1814
 
1700
- const emptyObject = {};
1701
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1702
- const i18nString = (key, placeholders = emptyObject) => {
1703
- if (placeholders === emptyObject) {
1704
- return key;
1705
- }
1706
- const replacer = (match, rest) => {
1707
- return placeholders[rest];
1708
- };
1709
- return key.replaceAll(RE_PLACEHOLDER, replacer);
1710
- };
1711
-
1712
- const MessageEnterToCommitOnMaster = `Message (Enter) to commit on 'master'`;
1713
- const SourceControlInput$1 = 'Source Control Input';
1714
-
1715
- const messageEnterToCommitOnMaster = () => {
1716
- return i18nString(MessageEnterToCommitOnMaster);
1717
- };
1718
- const sourceControlInput = () => {
1719
- return i18nString(SourceControlInput$1);
1720
- };
1721
-
1722
1815
  const loadContent = async (state, savedState) => {
1723
1816
  const {
1724
1817
  itemHeight,
@@ -1838,20 +1931,22 @@ const refresh = async state => {
1838
1931
  const numberOfVisible = getNumberOfVisibleItems(listHeight, itemHeight);
1839
1932
  const minLineY = 0;
1840
1933
  const maxLineY = Math.min(numberOfVisible, total);
1841
- const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, fileIconCache);
1934
+ const newFileIconCache = await getFileIcons(displayItems, fileIconCache);
1935
+ const visibleItems = getVisibleSourceControlItems(displayItems, minLineY, maxLineY, actionsCache, newFileIconCache);
1842
1936
  const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
1843
1937
  return {
1844
1938
  ...state,
1939
+ actionsCache,
1845
1940
  allGroups,
1941
+ enabledProviderIds,
1942
+ fileIconCache: newFileIconCache,
1943
+ finalDeltaY,
1846
1944
  gitRoot,
1847
1945
  items: displayItems,
1848
- visibleItems,
1849
- enabledProviderIds,
1850
- splitButtonEnabled,
1851
1946
  maxLineY,
1852
1947
  scrollBarHeight,
1853
- finalDeltaY,
1854
- actionsCache
1948
+ splitButtonEnabled,
1949
+ visibleItems
1855
1950
  };
1856
1951
  };
1857
1952
 
@@ -1988,12 +2083,17 @@ const handleClickAt = async (state, eventX, eventY, name) => {
1988
2083
  return selectIndex(state, index);
1989
2084
  };
1990
2085
 
1991
- const show = async (x, y, id, ...args) => {
1992
- return showContextMenu(x, y, id, ...args);
2086
+ const show2 = async (uid, menuId, x, y, args) => {
2087
+ await showContextMenu2(uid, menuId, x, y, args);
1993
2088
  };
1994
2089
 
1995
2090
  const handleContextMenu = async (state, button, x, y) => {
1996
- await show(x, y, SourceControl$1);
2091
+ const {
2092
+ id
2093
+ } = state;
2094
+ await show2(id, SourceControl$1, x, y, {
2095
+ menuId: SourceControl$1
2096
+ });
1997
2097
  return state;
1998
2098
  };
1999
2099
 
@@ -2090,6 +2190,10 @@ const handleWheel = async (state, deltaMode, deltaY) => {
2090
2190
  return setDeltaY(state, state.deltaY + deltaY);
2091
2191
  };
2092
2192
 
2193
+ const handleWorkspaceRefresh = async state => {
2194
+ return refresh(state);
2195
+ };
2196
+
2093
2197
  const sendMessagePortToExtensionHostWorker = async port => {
2094
2198
  await sendMessagePortToExtensionHostWorker$1(port, SourceControlWorker);
2095
2199
  };
@@ -2212,7 +2316,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2212
2316
  return {
2213
2317
  type,
2214
2318
  className: `MaskIcon MaskIcon${icon}`,
2215
- role: None,
2319
+ role: None$1,
2216
2320
  childCount: 0
2217
2321
  };
2218
2322
  };
@@ -2296,7 +2400,7 @@ const getFileIconVirtualDom = icon => {
2296
2400
  type: Img,
2297
2401
  className: FileIcon,
2298
2402
  src: icon,
2299
- role: None,
2403
+ role: None$1,
2300
2404
  childCount: 0
2301
2405
  };
2302
2406
  };
@@ -2619,9 +2723,12 @@ const commandMap = {
2619
2723
  'SourceControl.create2': create2,
2620
2724
  'SourceControl.diff2': diff2,
2621
2725
  'SourceControl.getCommandIds': getCommandIds,
2726
+ 'SourceControl.handleWorkspaceRefresh': wrapCommand(handleWorkspaceRefresh),
2727
+ 'SourceControl.getMenuIds': getMenuIds,
2622
2728
  'SourceControl.getEnabledProviderIds': getEnabledProviderIds,
2623
2729
  'SourceControl.getFileDecorations': getFileDecorations,
2624
2730
  'SourceControl.getInfo': getInfo,
2731
+ 'SourceControl.getMenuEntries2': wrapGetter(getMenuEntries2),
2625
2732
  'SourceControl.handleButtonClick': wrapCommand(handleButtonClick),
2626
2733
  'SourceControl.handleClickAt': wrapCommand(handleClickAt),
2627
2734
  'SourceControl.handleClickSourceControlButtons': wrapCommand(handleClickSourceControlButtons),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "2.10.0",
3
+ "version": "2.12.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"