@lvce-editor/status-bar-worker 2.1.0 → 2.3.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
  };
@@ -1265,73 +1306,6 @@ const handleContextMenu = async state => {
1265
1306
  return state;
1266
1307
  };
1267
1308
 
1268
- const id = 7201;
1269
- const sendMessagePortToExtensionHostWorker = async port => {
1270
- await sendMessagePortToExtensionHostWorker$1(port, id);
1271
- };
1272
-
1273
- const createExtensionHostRpc = async () => {
1274
- try {
1275
- const rpc = await TransferMessagePortRpcParent.create({
1276
- commandMap: {},
1277
- send: sendMessagePortToExtensionHostWorker
1278
- });
1279
- return rpc;
1280
- } catch (error) {
1281
- throw new VError(error, `Failed to create extension host rpc`);
1282
- }
1283
- };
1284
-
1285
- const initialize = async () => {
1286
- const rpc = await createExtensionHostRpc();
1287
- set$2(rpc);
1288
- };
1289
-
1290
- const getIndex = (items, item) => {
1291
- for (let i = 0; i < items.length; i++) {
1292
- if (items[i].name === item.name) {
1293
- return i;
1294
- }
1295
- }
1296
- return -1;
1297
- };
1298
-
1299
- const updateArray = (items, newItem) => {
1300
- const index = getIndex(items, newItem);
1301
- const before = items.slice(0, index);
1302
- const after = items.slice(index + 1);
1303
- return [...before, newItem, ...after];
1304
- };
1305
-
1306
- const itemLeftUpdate = (state, newItem) => {
1307
- return {
1308
- ...state,
1309
- statusBarItemsLeft: updateArray([...state.statusBarItemsLeft], newItem)
1310
- };
1311
- };
1312
-
1313
- const itemRightCreate = (state, newItem) => {
1314
- const {
1315
- statusBarItemsRight
1316
- } = state;
1317
- const newStatusBarItemsRight = [...statusBarItemsRight, newItem];
1318
- return {
1319
- ...state,
1320
- statusBarItemsRight: newStatusBarItemsRight
1321
- };
1322
- };
1323
-
1324
- const itemRightUpdate = (state, newItem) => {
1325
- const {
1326
- statusBarItemsRight
1327
- } = state;
1328
- const newStatusBarItemsRight = updateArray([...statusBarItemsRight], newItem);
1329
- return {
1330
- ...state,
1331
- statusBarItemsRight: newStatusBarItemsRight
1332
- };
1333
- };
1334
-
1335
1309
  const OnStatusBarItem = 'onStatusBarItem';
1336
1310
 
1337
1311
  const GetStatusBarItems = 'ExtensionHost.getStatusBarItems2';
@@ -1373,6 +1347,23 @@ const getStatusBarItems$1 = (assetDir, platform) => {
1373
1347
  });
1374
1348
  };
1375
1349
 
1350
+ const getNotificationsStatusBarItem = enabled => {
1351
+ if (!enabled) {
1352
+ return [];
1353
+ }
1354
+ return [{
1355
+ ariaLabel: 'Notifications',
1356
+ command: '',
1357
+ // TODO should show notifications center
1358
+ elements: [{
1359
+ type: 'text',
1360
+ value: 'Notifications'
1361
+ }],
1362
+ name: Notifications,
1363
+ tooltip: 'Notifications'
1364
+ }];
1365
+ };
1366
+
1376
1367
  const ProblemsErrorIcon = 'ProblemsErrorIcon';
1377
1368
  const ProblemsWarningIcon = 'ProblemsWarningIcon';
1378
1369
  const StatusBarItem = 'StatusBarItem';
@@ -1392,18 +1383,12 @@ const getProblemsAriaLabel = (errorCount, warningCount) => {
1392
1383
  }
1393
1384
  return parts.join(', ');
1394
1385
  };
1395
- const getBuiltinStatusBarItems = async (errorCount, warningCount) => {
1396
- const extraItems = [{
1397
- ariaLabel: 'Notifications',
1398
- command: '',
1399
- // TODO should show notifications center
1400
- elements: [{
1401
- type: 'text',
1402
- value: 'Notifications'
1403
- }],
1404
- name: Notifications,
1405
- tooltip: 'Notifications'
1406
- }, {
1386
+
1387
+ const getProblemsStatusBarItem = (errorCount, warningCount, enabled) => {
1388
+ if (!enabled) {
1389
+ return [];
1390
+ }
1391
+ return [{
1407
1392
  ariaLabel: getProblemsAriaLabel(errorCount, warningCount),
1408
1393
  command: '',
1409
1394
  // TODO should show problems view
@@ -1423,7 +1408,13 @@ const getBuiltinStatusBarItems = async (errorCount, warningCount) => {
1423
1408
  name: Problems,
1424
1409
  tooltip: 'Problems'
1425
1410
  }];
1426
- return extraItems;
1411
+ };
1412
+
1413
+ const getBuiltinStatusBarItems = async (errorCount, warningCount, {
1414
+ notificationsEnabled = true,
1415
+ problemsEnabled = true
1416
+ } = {}) => {
1417
+ return [...getNotificationsStatusBarItem(notificationsEnabled), ...getProblemsStatusBarItem(errorCount, warningCount, problemsEnabled)];
1427
1418
  };
1428
1419
 
1429
1420
  const toStatusBarItem = uiStatusBarItem => {
@@ -1479,24 +1470,134 @@ const toUiStatusBarItems = statusBarItems => {
1479
1470
  return statusBarItems.map(toUiStatusBarItem);
1480
1471
  };
1481
1472
 
1482
- const getStatusBarItems = async (showItems, assetDir, platform, errorCount, warningCount) => {
1473
+ const getStatusBarItems = async ({
1474
+ assetDir,
1475
+ builtinNotificationsEnabled = true,
1476
+ builtinProblemsEnabled = true,
1477
+ errorCount,
1478
+ platform,
1479
+ showItems,
1480
+ warningCount
1481
+ }) => {
1483
1482
  if (!showItems) {
1484
1483
  return [];
1485
1484
  }
1485
+ await activateByEvent('onStatusBarItem', assetDir, platform);
1486
1486
  await activateByEvent('onSourceControl', assetDir, platform);
1487
1487
  const extensionStatusBarItems = await getStatusBarItems$1(assetDir, platform);
1488
1488
  const uiStatusBarItems = toUiStatusBarItems(extensionStatusBarItems);
1489
- const extraItems = await getBuiltinStatusBarItems(errorCount, warningCount);
1489
+ const extraItems = await getBuiltinStatusBarItems(errorCount, warningCount, {
1490
+ notificationsEnabled: builtinNotificationsEnabled,
1491
+ problemsEnabled: builtinProblemsEnabled
1492
+ });
1490
1493
  return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1491
1494
  };
1492
1495
 
1496
+ const handleExtensionsChanged = async state => {
1497
+ const {
1498
+ assetDir,
1499
+ errorCount,
1500
+ platform,
1501
+ warningCount
1502
+ } = state;
1503
+ // TODO requery status bar items
1504
+ const statusBarItems = await getStatusBarItems({
1505
+ assetDir,
1506
+ builtinNotificationsEnabled: false,
1507
+ builtinProblemsEnabled: false,
1508
+ errorCount,
1509
+ platform,
1510
+ showItems: true,
1511
+ warningCount
1512
+ });
1513
+ return {
1514
+ ...state,
1515
+ statusBarItemsLeft: [...statusBarItems]
1516
+ };
1517
+ };
1518
+
1519
+ const id = 7201;
1520
+ const sendMessagePortToExtensionHostWorker = async port => {
1521
+ await sendMessagePortToExtensionHostWorker$1(port, id);
1522
+ };
1523
+
1524
+ const createExtensionHostRpc = async () => {
1525
+ try {
1526
+ const rpc = await create$4({
1527
+ commandMap: {},
1528
+ send: sendMessagePortToExtensionHostWorker
1529
+ });
1530
+ return rpc;
1531
+ } catch (error) {
1532
+ throw new VError(error, `Failed to create extension host rpc`);
1533
+ }
1534
+ };
1535
+
1536
+ const initialize = async () => {
1537
+ const rpc = await createExtensionHostRpc();
1538
+ set$2(rpc);
1539
+ };
1540
+
1541
+ const getIndex = (items, item) => {
1542
+ for (let i = 0; i < items.length; i++) {
1543
+ if (items[i].name === item.name) {
1544
+ return i;
1545
+ }
1546
+ }
1547
+ return -1;
1548
+ };
1549
+
1550
+ const updateArray = (items, newItem) => {
1551
+ const index = getIndex(items, newItem);
1552
+ const before = items.slice(0, index);
1553
+ const after = items.slice(index + 1);
1554
+ return [...before, newItem, ...after];
1555
+ };
1556
+
1557
+ const itemLeftUpdate = (state, newItem) => {
1558
+ return {
1559
+ ...state,
1560
+ statusBarItemsLeft: updateArray([...state.statusBarItemsLeft], newItem)
1561
+ };
1562
+ };
1563
+
1564
+ const itemRightCreate = (state, newItem) => {
1565
+ const {
1566
+ statusBarItemsRight
1567
+ } = state;
1568
+ const newStatusBarItemsRight = [...statusBarItemsRight, newItem];
1569
+ return {
1570
+ ...state,
1571
+ statusBarItemsRight: newStatusBarItemsRight
1572
+ };
1573
+ };
1574
+
1575
+ const itemRightUpdate = (state, newItem) => {
1576
+ const {
1577
+ statusBarItemsRight
1578
+ } = state;
1579
+ const newStatusBarItemsRight = updateArray([...statusBarItemsRight], newItem);
1580
+ return {
1581
+ ...state,
1582
+ statusBarItemsRight: newStatusBarItemsRight
1583
+ };
1584
+ };
1585
+
1493
1586
  const get = async key => {
1494
1587
  return getPreference(key);
1495
1588
  };
1496
1589
 
1497
- const itemsVisible = async () => {
1498
- const statusBarItemsPreference = (await get('statusBar.itemsVisible')) ?? true;
1499
- return statusBarItemsPreference;
1590
+ const getBooleanPreference = async key => {
1591
+ const value = await get(key);
1592
+ return value ?? true;
1593
+ };
1594
+ const loadStatusBarPreferences = async () => {
1595
+ const [itemsVisible, builtinNotificationsEnabled, builtinProblemsEnabled] = await Promise.all([getBooleanPreference('statusBar.itemsVisible'), getBooleanPreference('statusBar.builtinNotificationsEnabled'), getBooleanPreference('statusBar.builtinProblemsEnabled')]);
1596
+ return {
1597
+ builtinNotificationsEnabled,
1598
+ builtinProblemsEnabled,
1599
+ itemsVisible
1600
+ };
1500
1601
  };
1501
1602
 
1502
1603
  const loadContent = async state => {
@@ -1506,8 +1607,16 @@ const loadContent = async state => {
1506
1607
  platform,
1507
1608
  warningCount
1508
1609
  } = state;
1509
- const statusBarItemsPreference = await itemsVisible();
1510
- const statusBarItems = await getStatusBarItems(statusBarItemsPreference, assetDir, platform, errorCount, warningCount);
1610
+ const statusBarPreferences = await loadStatusBarPreferences();
1611
+ const statusBarItems = await getStatusBarItems({
1612
+ assetDir,
1613
+ builtinNotificationsEnabled: statusBarPreferences.builtinNotificationsEnabled,
1614
+ builtinProblemsEnabled: statusBarPreferences.builtinProblemsEnabled,
1615
+ errorCount,
1616
+ platform,
1617
+ showItems: statusBarPreferences.itemsVisible,
1618
+ warningCount
1619
+ });
1511
1620
  return {
1512
1621
  ...state,
1513
1622
  errorCount: 0,
@@ -1518,16 +1627,6 @@ const loadContent = async state => {
1518
1627
  };
1519
1628
  };
1520
1629
 
1521
- const Button$1 = 'button';
1522
- const Status = 'status';
1523
-
1524
- const MaskIcon = 'MaskIcon';
1525
-
1526
- const Button = 1;
1527
- const Div = 4;
1528
- const Span = 8;
1529
- const Text = 12;
1530
-
1531
1630
  const mergeClassNames = (...classNames) => {
1532
1631
  return classNames.filter(Boolean).join(' ');
1533
1632
  };
@@ -1549,6 +1648,7 @@ const NavigateChild = 7;
1549
1648
  const NavigateParent = 8;
1550
1649
  const RemoveChild = 9;
1551
1650
  const NavigateSibling = 10;
1651
+ const SetReferenceNodeUid = 11;
1552
1652
 
1553
1653
  const isKey = key => {
1554
1654
  return key !== 'type' && key !== 'childCount';
@@ -1616,6 +1716,16 @@ const compareNodes = (oldNode, newNode) => {
1616
1716
  if (oldNode.type !== newNode.type) {
1617
1717
  return null;
1618
1718
  }
1719
+ // Handle reference nodes - special handling for uid changes
1720
+ if (oldNode.type === Reference) {
1721
+ if (oldNode.uid !== newNode.uid) {
1722
+ patches.push({
1723
+ type: SetReferenceNodeUid,
1724
+ uid: newNode.uid
1725
+ });
1726
+ }
1727
+ return patches;
1728
+ }
1619
1729
  // Handle text nodes
1620
1730
  if (oldNode.type === Text && newNode.type === Text) {
1621
1731
  if (oldNode.text !== newNode.text) {
@@ -1751,7 +1861,6 @@ const diffChildren = (oldChildren, newChildren, patches) => {
1751
1861
  patches.push({
1752
1862
  type: NavigateParent
1753
1863
  });
1754
- currentChildIndex = -1;
1755
1864
  }
1756
1865
  // Add remove patches in reverse order (highest index first)
1757
1866
  // This ensures indices remain valid as we remove
@@ -1995,6 +2104,7 @@ const commandMap = {
1995
2104
  'StatusBar.getCommandIds': getCommandIds,
1996
2105
  'StatusBar.handleClick': wrapCommand(handleClick),
1997
2106
  'StatusBar.handleContextMenu': wrapCommand(handleContextMenu),
2107
+ 'StatusBar.handleExtensionsChanged': wrapCommand(handleExtensionsChanged),
1998
2108
  'StatusBar.initialize': initialize,
1999
2109
  'StatusBar.itemLeftUpdate': wrapCommand(itemLeftUpdate),
2000
2110
  'StatusBar.itemRightCreate': wrapCommand(itemRightCreate),
@@ -2009,7 +2119,7 @@ const commandMap = {
2009
2119
 
2010
2120
  const listen = async () => {
2011
2121
  registerCommands(commandMap);
2012
- const rpc = await WebWorkerRpcClient.create({
2122
+ const rpc = await create$3({
2013
2123
  commandMap: commandMap
2014
2124
  });
2015
2125
  set$1(rpc);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",