@lvce-editor/status-bar-worker 2.2.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.
@@ -1306,78 +1306,6 @@ const handleContextMenu = async state => {
1306
1306
  return state;
1307
1307
  };
1308
1308
 
1309
- const handleExtensionsChanged = async state => {
1310
- // TODO requery status bar items
1311
- return state;
1312
- };
1313
-
1314
- const id = 7201;
1315
- const sendMessagePortToExtensionHostWorker = async port => {
1316
- await sendMessagePortToExtensionHostWorker$1(port, id);
1317
- };
1318
-
1319
- const createExtensionHostRpc = async () => {
1320
- try {
1321
- const rpc = await create$4({
1322
- commandMap: {},
1323
- send: sendMessagePortToExtensionHostWorker
1324
- });
1325
- return rpc;
1326
- } catch (error) {
1327
- throw new VError(error, `Failed to create extension host rpc`);
1328
- }
1329
- };
1330
-
1331
- const initialize = async () => {
1332
- const rpc = await createExtensionHostRpc();
1333
- set$2(rpc);
1334
- };
1335
-
1336
- const getIndex = (items, item) => {
1337
- for (let i = 0; i < items.length; i++) {
1338
- if (items[i].name === item.name) {
1339
- return i;
1340
- }
1341
- }
1342
- return -1;
1343
- };
1344
-
1345
- const updateArray = (items, newItem) => {
1346
- const index = getIndex(items, newItem);
1347
- const before = items.slice(0, index);
1348
- const after = items.slice(index + 1);
1349
- return [...before, newItem, ...after];
1350
- };
1351
-
1352
- const itemLeftUpdate = (state, newItem) => {
1353
- return {
1354
- ...state,
1355
- statusBarItemsLeft: updateArray([...state.statusBarItemsLeft], newItem)
1356
- };
1357
- };
1358
-
1359
- const itemRightCreate = (state, newItem) => {
1360
- const {
1361
- statusBarItemsRight
1362
- } = state;
1363
- const newStatusBarItemsRight = [...statusBarItemsRight, newItem];
1364
- return {
1365
- ...state,
1366
- statusBarItemsRight: newStatusBarItemsRight
1367
- };
1368
- };
1369
-
1370
- const itemRightUpdate = (state, newItem) => {
1371
- const {
1372
- statusBarItemsRight
1373
- } = state;
1374
- const newStatusBarItemsRight = updateArray([...statusBarItemsRight], newItem);
1375
- return {
1376
- ...state,
1377
- statusBarItemsRight: newStatusBarItemsRight
1378
- };
1379
- };
1380
-
1381
1309
  const OnStatusBarItem = 'onStatusBarItem';
1382
1310
 
1383
1311
  const GetStatusBarItems = 'ExtensionHost.getStatusBarItems2';
@@ -1565,6 +1493,96 @@ const getStatusBarItems = async ({
1565
1493
  return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1566
1494
  };
1567
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
+
1568
1586
  const get = async key => {
1569
1587
  return getPreference(key);
1570
1588
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",