@lvce-editor/source-control-worker 2.10.0 → 2.11.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.
@@ -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,
@@ -1988,12 +2081,17 @@ const handleClickAt = async (state, eventX, eventY, name) => {
1988
2081
  return selectIndex(state, index);
1989
2082
  };
1990
2083
 
1991
- const show = async (x, y, id, ...args) => {
1992
- return showContextMenu(x, y, id, ...args);
2084
+ const show2 = async (uid, menuId, x, y, args) => {
2085
+ await showContextMenu2(uid, menuId, x, y, args);
1993
2086
  };
1994
2087
 
1995
2088
  const handleContextMenu = async (state, button, x, y) => {
1996
- await show(x, y, SourceControl$1);
2089
+ const {
2090
+ id
2091
+ } = state;
2092
+ await show2(id, SourceControl$1, x, y, {
2093
+ menuId: SourceControl$1
2094
+ });
1997
2095
  return state;
1998
2096
  };
1999
2097
 
@@ -2212,7 +2310,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2212
2310
  return {
2213
2311
  type,
2214
2312
  className: `MaskIcon MaskIcon${icon}`,
2215
- role: None,
2313
+ role: None$1,
2216
2314
  childCount: 0
2217
2315
  };
2218
2316
  };
@@ -2296,7 +2394,7 @@ const getFileIconVirtualDom = icon => {
2296
2394
  type: Img,
2297
2395
  className: FileIcon,
2298
2396
  src: icon,
2299
- role: None,
2397
+ role: None$1,
2300
2398
  childCount: 0
2301
2399
  };
2302
2400
  };
@@ -2619,9 +2717,11 @@ const commandMap = {
2619
2717
  'SourceControl.create2': create2,
2620
2718
  'SourceControl.diff2': diff2,
2621
2719
  'SourceControl.getCommandIds': getCommandIds,
2720
+ 'SourceControl.getMenuIds': getMenuIds,
2622
2721
  'SourceControl.getEnabledProviderIds': getEnabledProviderIds,
2623
2722
  'SourceControl.getFileDecorations': getFileDecorations,
2624
2723
  'SourceControl.getInfo': getInfo,
2724
+ 'SourceControl.getMenuEntries2': wrapGetter(getMenuEntries2),
2625
2725
  'SourceControl.handleButtonClick': wrapCommand(handleButtonClick),
2626
2726
  'SourceControl.handleClickAt': wrapCommand(handleClickAt),
2627
2727
  '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.11.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"