@lvce-editor/status-bar-worker 2.0.0 → 2.2.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.
@@ -463,6 +463,27 @@ const IpcParentWithMessagePort$1 = {
463
463
  wrap: wrap$5
464
464
  };
465
465
 
466
+ class CommandNotFoundError extends Error {
467
+ constructor(command) {
468
+ super(`Command not found ${command}`);
469
+ this.name = 'CommandNotFoundError';
470
+ }
471
+ }
472
+ const commands = Object.create(null);
473
+ const register = commandMap => {
474
+ Object.assign(commands, commandMap);
475
+ };
476
+ const getCommand = key => {
477
+ return commands[key];
478
+ };
479
+ const execute = (command, ...args) => {
480
+ const fn = getCommand(command);
481
+ if (!fn) {
482
+ throw new CommandNotFoundError(command);
483
+ }
484
+ return fn(...args);
485
+ };
486
+
466
487
  const Two$1 = '2.0';
467
488
  const callbacks = Object.create(null);
468
489
  const get$3 = id => {
@@ -487,12 +508,12 @@ const getErrorConstructor = (message, type) => {
487
508
  switch (type) {
488
509
  case DomException:
489
510
  return DOMException;
490
- case TypeError$1:
491
- return TypeError;
492
- case SyntaxError$1:
493
- return SyntaxError;
494
511
  case ReferenceError$1:
495
512
  return ReferenceError;
513
+ case SyntaxError$1:
514
+ return SyntaxError;
515
+ case TypeError$1:
516
+ return TypeError;
496
517
  default:
497
518
  return Error;
498
519
  }
@@ -648,27 +669,27 @@ const getErrorProperty = (error, prettyError) => {
648
669
  if (error && error.code === E_COMMAND_NOT_FOUND) {
649
670
  return {
650
671
  code: MethodNotFound,
651
- message: error.message,
652
- data: error.stack
672
+ data: error.stack,
673
+ message: error.message
653
674
  };
654
675
  }
655
676
  return {
656
677
  code: Custom,
657
- message: prettyError.message,
658
678
  data: {
659
- stack: getStack(prettyError),
660
- codeFrame: prettyError.codeFrame,
661
- type: getErrorType(prettyError),
662
679
  code: prettyError.code,
663
- name: prettyError.name
664
- }
680
+ codeFrame: prettyError.codeFrame,
681
+ name: prettyError.name,
682
+ stack: getStack(prettyError),
683
+ type: getErrorType(prettyError)
684
+ },
685
+ message: prettyError.message
665
686
  };
666
687
  };
667
688
  const create$1$1 = (id, error) => {
668
689
  return {
669
- jsonrpc: Two$1,
690
+ error,
670
691
  id,
671
- error
692
+ jsonrpc: Two$1
672
693
  };
673
694
  };
674
695
  const getErrorResponse = (id, error, preparePrettyError, logError) => {
@@ -677,27 +698,27 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
677
698
  const errorProperty = getErrorProperty(error, prettyError);
678
699
  return create$1$1(id, errorProperty);
679
700
  };
680
- const create$4 = (message, result) => {
701
+ const create$9 = (message, result) => {
681
702
  return {
682
- jsonrpc: Two$1,
683
703
  id: message.id,
704
+ jsonrpc: Two$1,
684
705
  result: result ?? null
685
706
  };
686
707
  };
687
708
  const getSuccessResponse = (message, result) => {
688
709
  const resultProperty = result ?? null;
689
- return create$4(message, resultProperty);
710
+ return create$9(message, resultProperty);
690
711
  };
691
712
  const getErrorResponseSimple = (id, error) => {
692
713
  return {
693
- jsonrpc: Two$1,
694
- id,
695
714
  error: {
696
715
  code: Custom,
716
+ data: error,
697
717
  // @ts-ignore
698
- message: error.message,
699
- data: error
700
- }
718
+ message: error.message
719
+ },
720
+ id,
721
+ jsonrpc: Two$1
701
722
  };
702
723
  };
703
724
  const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
@@ -727,35 +748,35 @@ const normalizeParams = args => {
727
748
  if (args.length === 1) {
728
749
  const options = args[0];
729
750
  return {
751
+ execute: options.execute,
730
752
  ipc: options.ipc,
753
+ logError: options.logError || defaultLogError,
731
754
  message: options.message,
732
- execute: options.execute,
733
- resolve: options.resolve || defaultResolve,
734
755
  preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
735
- logError: options.logError || defaultLogError,
736
- requiresSocket: options.requiresSocket || defaultRequiresSocket
756
+ requiresSocket: options.requiresSocket || defaultRequiresSocket,
757
+ resolve: options.resolve || defaultResolve
737
758
  };
738
759
  }
739
760
  return {
761
+ execute: args[2],
740
762
  ipc: args[0],
763
+ logError: args[5],
741
764
  message: args[1],
742
- execute: args[2],
743
- resolve: args[3],
744
765
  preparePrettyError: args[4],
745
- logError: args[5],
746
- requiresSocket: args[6]
766
+ requiresSocket: args[6],
767
+ resolve: args[3]
747
768
  };
748
769
  };
749
770
  const handleJsonRpcMessage = async (...args) => {
750
771
  const options = normalizeParams(args);
751
772
  const {
752
- message,
753
- ipc,
754
773
  execute,
755
- resolve,
756
- preparePrettyError,
774
+ ipc,
757
775
  logError,
758
- requiresSocket
776
+ message,
777
+ preparePrettyError,
778
+ requiresSocket,
779
+ resolve
759
780
  } = options;
760
781
  if ('id' in message) {
761
782
  if ('method' in message) {
@@ -778,36 +799,17 @@ const handleJsonRpcMessage = async (...args) => {
778
799
  throw new JsonRpcError('unexpected message');
779
800
  };
780
801
 
781
- class CommandNotFoundError extends Error {
782
- constructor(command) {
783
- super(`Command not found ${command}`);
784
- this.name = 'CommandNotFoundError';
785
- }
786
- }
787
- const commands = Object.create(null);
788
- const register = commandMap => {
789
- Object.assign(commands, commandMap);
790
- };
791
- const getCommand = key => {
792
- return commands[key];
793
- };
794
- const execute = (command, ...args) => {
795
- const fn = getCommand(command);
796
- if (!fn) {
797
- throw new CommandNotFoundError(command);
798
- }
799
- return fn(...args);
800
- };
801
-
802
802
  const Two = '2.0';
803
- const create$t = (method, params) => {
803
+
804
+ const create$8 = (method, params) => {
804
805
  return {
805
806
  jsonrpc: Two,
806
807
  method,
807
808
  params
808
809
  };
809
810
  };
810
- const create$s = (id, method, params) => {
811
+
812
+ const create$7 = (id, method, params) => {
811
813
  const message = {
812
814
  id,
813
815
  jsonrpc: Two,
@@ -816,15 +818,14 @@ const create$s = (id, method, params) => {
816
818
  };
817
819
  return message;
818
820
  };
821
+
819
822
  let id$1 = 0;
820
- const create$r = () => {
823
+ const create$6 = () => {
821
824
  return ++id$1;
822
825
  };
823
826
 
824
- /* eslint-disable n/no-unsupported-features/es-syntax */
825
-
826
827
  const registerPromise = map => {
827
- const id = create$r();
828
+ const id = create$6();
828
829
  const {
829
830
  promise,
830
831
  resolve
@@ -836,13 +837,12 @@ const registerPromise = map => {
836
837
  };
837
838
  };
838
839
 
839
- // @ts-ignore
840
840
  const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
841
841
  const {
842
842
  id,
843
843
  promise
844
844
  } = registerPromise(callbacks);
845
- const message = create$s(id, method, params);
845
+ const message = create$7(id, method, params);
846
846
  if (useSendAndTransfer && ipc.sendAndTransfer) {
847
847
  ipc.sendAndTransfer(message);
848
848
  } else {
@@ -878,12 +878,13 @@ const createRpc = ipc => {
878
878
  * @deprecated
879
879
  */
880
880
  send(method, ...params) {
881
- const message = create$t(method, params);
881
+ const message = create$8(method, params);
882
882
  ipc.send(message);
883
883
  }
884
884
  };
885
885
  return rpc;
886
886
  };
887
+
887
888
  const requiresSocket = () => {
888
889
  return false;
889
890
  };
@@ -898,6 +899,7 @@ const handleMessage = event => {
898
899
  const actualExecute = event?.target?.execute || execute;
899
900
  return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError, actualRequiresSocket);
900
901
  };
902
+
901
903
  const handleIpc = ipc => {
902
904
  if ('addEventListener' in ipc) {
903
905
  ipc.addEventListener('message', handleMessage);
@@ -906,6 +908,7 @@ const handleIpc = ipc => {
906
908
  ipc.on('message', handleMessage);
907
909
  }
908
910
  };
911
+
909
912
  const listen$1 = async (module, options) => {
910
913
  const rawIpc = await module.listen(options);
911
914
  if (module.signal) {
@@ -914,6 +917,7 @@ const listen$1 = async (module, options) => {
914
917
  const ipc = module.wrap(rawIpc);
915
918
  return ipc;
916
919
  };
920
+
917
921
  const create$5 = async ({
918
922
  commandMap,
919
923
  isMessagePortOpen = true,
@@ -931,7 +935,8 @@ const create$5 = async ({
931
935
  messagePort.start();
932
936
  return rpc;
933
937
  };
934
- const create$3 = async ({
938
+
939
+ const create$4 = async ({
935
940
  commandMap,
936
941
  isMessagePortOpen,
937
942
  send
@@ -947,11 +952,8 @@ const create$3 = async ({
947
952
  messagePort: port2
948
953
  });
949
954
  };
950
- const TransferMessagePortRpcParent = {
951
- __proto__: null,
952
- create: create$3
953
- };
954
- const create$2$1 = async ({
955
+
956
+ const create$3 = async ({
955
957
  commandMap
956
958
  }) => {
957
959
  // TODO create a commandMap per rpc instance
@@ -961,10 +963,7 @@ const create$2$1 = async ({
961
963
  const rpc = createRpc(ipc);
962
964
  return rpc;
963
965
  };
964
- const WebWorkerRpcClient = {
965
- __proto__: null,
966
- create: create$2$1
967
- };
966
+
968
967
  const createMockRpc = ({
969
968
  commandMap
970
969
  }) => {
@@ -985,14 +984,6 @@ const createMockRpc = ({
985
984
  return mockRpc;
986
985
  };
987
986
 
988
- const TargetName = 'event.target.name';
989
-
990
- const ExtensionHostWorker = 44;
991
- const RendererWorker = 1;
992
-
993
- const SetDom2 = 'Viewlet.setDom2';
994
- const SetPatches = 'Viewlet.setPatches';
995
-
996
987
  const rpcs = Object.create(null);
997
988
  const set$3 = (id, rpc) => {
998
989
  rpcs[id] = rpc;
@@ -1041,6 +1032,25 @@ const create$2 = rpcId => {
1041
1032
  };
1042
1033
  };
1043
1034
 
1035
+ const Button$1 = 'button';
1036
+ const Status = 'status';
1037
+
1038
+ const MaskIcon = 'MaskIcon';
1039
+
1040
+ const Button = 1;
1041
+ const Div = 4;
1042
+ const Span = 8;
1043
+ const Text = 12;
1044
+ const Reference = 100;
1045
+
1046
+ const TargetName = 'event.target.name';
1047
+
1048
+ const ExtensionHostWorker = 44;
1049
+ const RendererWorker = 1;
1050
+
1051
+ const SetDom2 = 'Viewlet.setDom2';
1052
+ const SetPatches = 'Viewlet.setPatches';
1053
+
1044
1054
  const {
1045
1055
  invoke: invoke$1,
1046
1056
  set: set$2
@@ -1102,7 +1112,7 @@ const create$1 = () => {
1102
1112
  },
1103
1113
  getKeys() {
1104
1114
  return Object.keys(states).map(key => {
1105
- return Number.parseInt(key);
1115
+ return Number.parseFloat(key);
1106
1116
  });
1107
1117
  },
1108
1118
  registerCommands(commandMap) {
@@ -1144,6 +1154,37 @@ const create$1 = () => {
1144
1154
  return fn(newState, ...args);
1145
1155
  };
1146
1156
  return wrapped;
1157
+ },
1158
+ wrapLoadContent(fn) {
1159
+ const wrapped = async (uid, ...args) => {
1160
+ const {
1161
+ newState,
1162
+ oldState
1163
+ } = states[uid];
1164
+ const result = await fn(newState, ...args);
1165
+ const {
1166
+ error,
1167
+ state
1168
+ } = result;
1169
+ if (oldState === state || newState === state) {
1170
+ return {
1171
+ error
1172
+ };
1173
+ }
1174
+ const latestOld = states[uid];
1175
+ const latestNew = {
1176
+ ...latestOld.newState,
1177
+ ...state
1178
+ };
1179
+ states[uid] = {
1180
+ newState: latestNew,
1181
+ oldState: latestOld.oldState
1182
+ };
1183
+ return {
1184
+ error
1185
+ };
1186
+ };
1187
+ return wrapped;
1147
1188
  }
1148
1189
  };
1149
1190
  };
@@ -1261,6 +1302,15 @@ const handleClick = async (state, name) => {
1261
1302
  return state;
1262
1303
  };
1263
1304
 
1305
+ const handleContextMenu = async state => {
1306
+ return state;
1307
+ };
1308
+
1309
+ const handleExtensionsChanged = async state => {
1310
+ // TODO requery status bar items
1311
+ return state;
1312
+ };
1313
+
1264
1314
  const id = 7201;
1265
1315
  const sendMessagePortToExtensionHostWorker = async port => {
1266
1316
  await sendMessagePortToExtensionHostWorker$1(port, id);
@@ -1268,7 +1318,7 @@ const sendMessagePortToExtensionHostWorker = async port => {
1268
1318
 
1269
1319
  const createExtensionHostRpc = async () => {
1270
1320
  try {
1271
- const rpc = await TransferMessagePortRpcParent.create({
1321
+ const rpc = await create$4({
1272
1322
  commandMap: {},
1273
1323
  send: sendMessagePortToExtensionHostWorker
1274
1324
  });
@@ -1369,6 +1419,23 @@ const getStatusBarItems$1 = (assetDir, platform) => {
1369
1419
  });
1370
1420
  };
1371
1421
 
1422
+ const getNotificationsStatusBarItem = enabled => {
1423
+ if (!enabled) {
1424
+ return [];
1425
+ }
1426
+ return [{
1427
+ ariaLabel: 'Notifications',
1428
+ command: '',
1429
+ // TODO should show notifications center
1430
+ elements: [{
1431
+ type: 'text',
1432
+ value: 'Notifications'
1433
+ }],
1434
+ name: Notifications,
1435
+ tooltip: 'Notifications'
1436
+ }];
1437
+ };
1438
+
1372
1439
  const ProblemsErrorIcon = 'ProblemsErrorIcon';
1373
1440
  const ProblemsWarningIcon = 'ProblemsWarningIcon';
1374
1441
  const StatusBarItem = 'StatusBarItem';
@@ -1388,18 +1455,12 @@ const getProblemsAriaLabel = (errorCount, warningCount) => {
1388
1455
  }
1389
1456
  return parts.join(', ');
1390
1457
  };
1391
- const getBuiltinStatusBarItems = async (errorCount, warningCount) => {
1392
- const extraItems = [{
1393
- ariaLabel: 'Notifications',
1394
- command: '',
1395
- // TODO should show notifications center
1396
- elements: [{
1397
- type: 'text',
1398
- value: 'Notifications'
1399
- }],
1400
- name: Notifications,
1401
- tooltip: 'Notifications'
1402
- }, {
1458
+
1459
+ const getProblemsStatusBarItem = (errorCount, warningCount, enabled) => {
1460
+ if (!enabled) {
1461
+ return [];
1462
+ }
1463
+ return [{
1403
1464
  ariaLabel: getProblemsAriaLabel(errorCount, warningCount),
1404
1465
  command: '',
1405
1466
  // TODO should show problems view
@@ -1419,7 +1480,13 @@ const getBuiltinStatusBarItems = async (errorCount, warningCount) => {
1419
1480
  name: Problems,
1420
1481
  tooltip: 'Problems'
1421
1482
  }];
1422
- return extraItems;
1483
+ };
1484
+
1485
+ const getBuiltinStatusBarItems = async (errorCount, warningCount, {
1486
+ notificationsEnabled = true,
1487
+ problemsEnabled = true
1488
+ } = {}) => {
1489
+ return [...getNotificationsStatusBarItem(notificationsEnabled), ...getProblemsStatusBarItem(errorCount, warningCount, problemsEnabled)];
1423
1490
  };
1424
1491
 
1425
1492
  const toStatusBarItem = uiStatusBarItem => {
@@ -1475,14 +1542,26 @@ const toUiStatusBarItems = statusBarItems => {
1475
1542
  return statusBarItems.map(toUiStatusBarItem);
1476
1543
  };
1477
1544
 
1478
- const getStatusBarItems = async (showItems, assetDir, platform, errorCount, warningCount) => {
1545
+ const getStatusBarItems = async ({
1546
+ assetDir,
1547
+ builtinNotificationsEnabled = true,
1548
+ builtinProblemsEnabled = true,
1549
+ errorCount,
1550
+ platform,
1551
+ showItems,
1552
+ warningCount
1553
+ }) => {
1479
1554
  if (!showItems) {
1480
1555
  return [];
1481
1556
  }
1557
+ await activateByEvent('onStatusBarItem', assetDir, platform);
1482
1558
  await activateByEvent('onSourceControl', assetDir, platform);
1483
1559
  const extensionStatusBarItems = await getStatusBarItems$1(assetDir, platform);
1484
1560
  const uiStatusBarItems = toUiStatusBarItems(extensionStatusBarItems);
1485
- const extraItems = await getBuiltinStatusBarItems(errorCount, warningCount);
1561
+ const extraItems = await getBuiltinStatusBarItems(errorCount, warningCount, {
1562
+ notificationsEnabled: builtinNotificationsEnabled,
1563
+ problemsEnabled: builtinProblemsEnabled
1564
+ });
1486
1565
  return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1487
1566
  };
1488
1567
 
@@ -1490,9 +1569,17 @@ const get = async key => {
1490
1569
  return getPreference(key);
1491
1570
  };
1492
1571
 
1493
- const itemsVisible = async () => {
1494
- const statusBarItemsPreference = (await get('statusBar.itemsVisible')) ?? true;
1495
- return statusBarItemsPreference;
1572
+ const getBooleanPreference = async key => {
1573
+ const value = await get(key);
1574
+ return value ?? true;
1575
+ };
1576
+ const loadStatusBarPreferences = async () => {
1577
+ const [itemsVisible, builtinNotificationsEnabled, builtinProblemsEnabled] = await Promise.all([getBooleanPreference('statusBar.itemsVisible'), getBooleanPreference('statusBar.builtinNotificationsEnabled'), getBooleanPreference('statusBar.builtinProblemsEnabled')]);
1578
+ return {
1579
+ builtinNotificationsEnabled,
1580
+ builtinProblemsEnabled,
1581
+ itemsVisible
1582
+ };
1496
1583
  };
1497
1584
 
1498
1585
  const loadContent = async state => {
@@ -1502,8 +1589,16 @@ const loadContent = async state => {
1502
1589
  platform,
1503
1590
  warningCount
1504
1591
  } = state;
1505
- const statusBarItemsPreference = await itemsVisible();
1506
- const statusBarItems = await getStatusBarItems(statusBarItemsPreference, assetDir, platform, errorCount, warningCount);
1592
+ const statusBarPreferences = await loadStatusBarPreferences();
1593
+ const statusBarItems = await getStatusBarItems({
1594
+ assetDir,
1595
+ builtinNotificationsEnabled: statusBarPreferences.builtinNotificationsEnabled,
1596
+ builtinProblemsEnabled: statusBarPreferences.builtinProblemsEnabled,
1597
+ errorCount,
1598
+ platform,
1599
+ showItems: statusBarPreferences.itemsVisible,
1600
+ warningCount
1601
+ });
1507
1602
  return {
1508
1603
  ...state,
1509
1604
  errorCount: 0,
@@ -1514,16 +1609,6 @@ const loadContent = async state => {
1514
1609
  };
1515
1610
  };
1516
1611
 
1517
- const Button$1 = 'button';
1518
- const Status = 'status';
1519
-
1520
- const MaskIcon = 'MaskIcon';
1521
-
1522
- const Button = 1;
1523
- const Div = 4;
1524
- const Span = 8;
1525
- const Text = 12;
1526
-
1527
1612
  const mergeClassNames = (...classNames) => {
1528
1613
  return classNames.filter(Boolean).join(' ');
1529
1614
  };
@@ -1545,6 +1630,7 @@ const NavigateChild = 7;
1545
1630
  const NavigateParent = 8;
1546
1631
  const RemoveChild = 9;
1547
1632
  const NavigateSibling = 10;
1633
+ const SetReferenceNodeUid = 11;
1548
1634
 
1549
1635
  const isKey = key => {
1550
1636
  return key !== 'type' && key !== 'childCount';
@@ -1612,6 +1698,16 @@ const compareNodes = (oldNode, newNode) => {
1612
1698
  if (oldNode.type !== newNode.type) {
1613
1699
  return null;
1614
1700
  }
1701
+ // Handle reference nodes - special handling for uid changes
1702
+ if (oldNode.type === Reference) {
1703
+ if (oldNode.uid !== newNode.uid) {
1704
+ patches.push({
1705
+ type: SetReferenceNodeUid,
1706
+ uid: newNode.uid
1707
+ });
1708
+ }
1709
+ return patches;
1710
+ }
1615
1711
  // Handle text nodes
1616
1712
  if (oldNode.type === Text && newNode.type === Text) {
1617
1713
  if (oldNode.text !== newNode.text) {
@@ -1747,7 +1843,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
1747
1843
  patches.push({
1748
1844
  type: NavigateParent
1749
1845
  });
1750
- currentChildIndex = -1;
1751
1846
  }
1752
1847
  // Add remove patches in reverse order (highest index first)
1753
1848
  // This ensures indices remain valid as we remove
@@ -1813,6 +1908,7 @@ const diffTree = (oldNodes, newNodes) => {
1813
1908
  return removeTrailingNavigationPatches(patches);
1814
1909
  };
1815
1910
 
1911
+ const HandleContextMenu = 2;
1816
1912
  const HandleClick = 11;
1817
1913
 
1818
1914
  const getTextVirtualDom = element => {
@@ -1871,6 +1967,14 @@ const getStatusBarItemsVirtualDom = (items, className) => {
1871
1967
  }, ...items.flatMap(getStatusBarItemVirtualDom)];
1872
1968
  };
1873
1969
 
1970
+ const getStatusBarItemsLeftDom = statusBarItemsLeft => {
1971
+ return getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft);
1972
+ };
1973
+
1974
+ const getStatusBarItemsRightDom = statusBarItemsRight => {
1975
+ return getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight);
1976
+ };
1977
+
1874
1978
  const getChildCount = (leftCount, rightCount) => {
1875
1979
  let count = 0;
1876
1980
  if (leftCount > 0) {
@@ -1886,9 +1990,10 @@ const getStatusBarVirtualDom = (statusBarItemsLeft, statusBarItemsRight) => {
1886
1990
  childCount: getChildCount(statusBarItemsLeft.length, statusBarItemsRight.length),
1887
1991
  className: 'StatusBar',
1888
1992
  onClick: HandleClick,
1993
+ onContextMenu: HandleContextMenu,
1889
1994
  role: Status,
1890
1995
  type: Div
1891
- }, ...getStatusBarItemsVirtualDom(statusBarItemsLeft, StatusBarItemsLeft), ...getStatusBarItemsVirtualDom(statusBarItemsRight, StatusBarItemsRight)];
1996
+ }, ...getStatusBarItemsLeftDom(statusBarItemsLeft), ...getStatusBarItemsRightDom(statusBarItemsRight)];
1892
1997
  return dom;
1893
1998
  };
1894
1999
 
@@ -1906,7 +2011,7 @@ const renderItems = (oldState, newState) => {
1906
2011
  return [SetDom2, uid, dom];
1907
2012
  };
1908
2013
 
1909
- const renderIcremental = (oldState, newState) => {
2014
+ const renderIncremental = (oldState, newState) => {
1910
2015
  const oldDom = renderItems(oldState, oldState)[2];
1911
2016
  const newDom = renderItems(newState, newState)[2];
1912
2017
  const patches = diffTree(oldDom, newDom);
@@ -1916,7 +2021,7 @@ const renderIcremental = (oldState, newState) => {
1916
2021
  const getRenderer = diffType => {
1917
2022
  switch (diffType) {
1918
2023
  case RenderIncremental:
1919
- return renderIcremental;
2024
+ return renderIncremental;
1920
2025
  case RenderItems:
1921
2026
  return renderItems;
1922
2027
  default:
@@ -1948,6 +2053,10 @@ const render2 = (uid, diffResult) => {
1948
2053
 
1949
2054
  const renderEventListeners = () => {
1950
2055
  return [{
2056
+ name: HandleContextMenu,
2057
+ params: ['handleContextMenu'],
2058
+ preventDefault: true
2059
+ }, {
1951
2060
  name: HandleClick,
1952
2061
  params: ['handleClick', TargetName]
1953
2062
  }];
@@ -1976,6 +2085,8 @@ const commandMap = {
1976
2085
  'StatusBar.diff2': diff2,
1977
2086
  'StatusBar.getCommandIds': getCommandIds,
1978
2087
  'StatusBar.handleClick': wrapCommand(handleClick),
2088
+ 'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2089
+ 'StatusBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
1979
2090
  'StatusBar.initialize': initialize,
1980
2091
  'StatusBar.itemLeftUpdate': wrapCommand(itemLeftUpdate),
1981
2092
  'StatusBar.itemRightCreate': wrapCommand(itemRightCreate),
@@ -1990,7 +2101,7 @@ const commandMap = {
1990
2101
 
1991
2102
  const listen = async () => {
1992
2103
  registerCommands(commandMap);
1993
- const rpc = await WebWorkerRpcClient.create({
2104
+ const rpc = await create$3({
1994
2105
  commandMap: commandMap
1995
2106
  });
1996
2107
  set$1(rpc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,8 +9,5 @@
9
9
  "license": "MIT",
10
10
  "author": "Lvce Editor",
11
11
  "type": "module",
12
- "main": "dist/statusBarWorkerMain.js",
13
- "dependencies": {
14
- "@lvce-editor/virtual-dom-worker": "^6.8.0"
15
- }
12
+ "main": "dist/statusBarWorkerMain.js"
16
13
  }