@lvce-editor/status-bar-worker 1.10.0 → 1.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.
@@ -524,9 +524,9 @@ const get$3 = id => {
524
524
  const remove = id => {
525
525
  delete callbacks[id];
526
526
  };
527
- let id = 0;
527
+ let id$1 = 0;
528
528
  const create$3$1 = () => {
529
- return ++id;
529
+ return ++id$1;
530
530
  };
531
531
  const registerPromise = () => {
532
532
  const id = create$3$1();
@@ -1018,7 +1018,6 @@ const TargetName = 'event.target.name';
1018
1018
 
1019
1019
  const ExtensionHostWorker = 44;
1020
1020
  const RendererWorker = 1;
1021
- const SourceControlWorker = 66;
1022
1021
 
1023
1022
  const SetDom2 = 'Viewlet.setDom2';
1024
1023
 
@@ -1260,8 +1259,9 @@ const handleClick = async (state, name) => {
1260
1259
  return state;
1261
1260
  };
1262
1261
 
1262
+ const id = 7201;
1263
1263
  const sendMessagePortToExtensionHostWorker = async port => {
1264
- await sendMessagePortToExtensionHostWorker$1(port, SourceControlWorker);
1264
+ await sendMessagePortToExtensionHostWorker$1(port, id);
1265
1265
  };
1266
1266
 
1267
1267
  const createExtensionHostRpc = async () => {
@@ -1326,6 +1326,12 @@ const itemRightUpdate = (state, newItem) => {
1326
1326
  };
1327
1327
  };
1328
1328
 
1329
+ const ProblemsErrorIcon = 'ProblemsErrorIcon';
1330
+ const ProblemsWarningIcon = 'ProblemsWarningIcon';
1331
+ const StatusBarItem = 'StatusBarItem';
1332
+ const StatusBarItemsLeft = 'StatusBarItemsLeft';
1333
+ const StatusBarItemsRight = 'StatusBarItemsRight';
1334
+
1329
1335
  const OnStatusBarItem = 'onStatusBarItem';
1330
1336
 
1331
1337
  const GetStatusBarItems = 'ExtensionHost.getStatusBarItems2';
@@ -1362,6 +1368,34 @@ const getStatusBarItems$1 = () => {
1362
1368
  });
1363
1369
  };
1364
1370
 
1371
+ const toStatusBarItem = uiStatusBarItem => {
1372
+ const elements = [];
1373
+ if (uiStatusBarItem.icon) {
1374
+ elements.push({
1375
+ type: 'icon',
1376
+ value: uiStatusBarItem.icon
1377
+ });
1378
+ }
1379
+ if (uiStatusBarItem.text) {
1380
+ elements.push({
1381
+ type: 'text',
1382
+ value: uiStatusBarItem.text
1383
+ });
1384
+ }
1385
+ if (elements.length === 0) {
1386
+ elements.push({
1387
+ type: 'text',
1388
+ value: ''
1389
+ });
1390
+ }
1391
+ return {
1392
+ command: uiStatusBarItem.command || undefined,
1393
+ elements,
1394
+ name: uiStatusBarItem.name,
1395
+ tooltip: uiStatusBarItem.tooltip
1396
+ };
1397
+ };
1398
+
1365
1399
  const toUiStatusBarItem = extensionHostStatusBarItem => {
1366
1400
  return {
1367
1401
  command: extensionHostStatusBarItem.command || '',
@@ -1371,12 +1405,14 @@ const toUiStatusBarItem = extensionHostStatusBarItem => {
1371
1405
  tooltip: extensionHostStatusBarItem.tooltip || ''
1372
1406
  };
1373
1407
  };
1408
+
1374
1409
  const toUiStatusBarItems = statusBarItems => {
1375
1410
  if (!statusBarItems) {
1376
1411
  return [];
1377
1412
  }
1378
1413
  return statusBarItems.map(toUiStatusBarItem);
1379
1414
  };
1415
+
1380
1416
  const getStatusBarItems = async showItems => {
1381
1417
  if (!showItems) {
1382
1418
  return [];
@@ -1385,19 +1421,32 @@ const getStatusBarItems = async showItems => {
1385
1421
  const extensionStatusBarItems = await getStatusBarItems$1();
1386
1422
  const uiStatusBarItems = toUiStatusBarItems(extensionStatusBarItems);
1387
1423
  const extraItems = [{
1388
- command: '',
1389
- icon: '',
1424
+ command: undefined,
1425
+ elements: [{
1426
+ type: 'text',
1427
+ value: 'Notifications'
1428
+ }],
1390
1429
  name: Notifications,
1391
- text: 'Notifications',
1392
1430
  tooltip: ''
1393
1431
  }, {
1394
- command: '',
1395
- icon: '',
1432
+ command: undefined,
1433
+ elements: [{
1434
+ type: 'icon',
1435
+ value: ProblemsErrorIcon
1436
+ }, {
1437
+ type: 'text',
1438
+ value: '0'
1439
+ }, {
1440
+ type: 'icon',
1441
+ value: ProblemsWarningIcon
1442
+ }, {
1443
+ type: 'text',
1444
+ value: '0'
1445
+ }],
1396
1446
  name: Problems,
1397
- text: 'Problems',
1398
1447
  tooltip: ''
1399
1448
  }];
1400
- return [...uiStatusBarItems, ...extraItems];
1449
+ return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1401
1450
  };
1402
1451
 
1403
1452
  const get = async key => {
@@ -1427,26 +1476,37 @@ const text = data => {
1427
1476
  };
1428
1477
  };
1429
1478
 
1430
- const StatusBarItem = 'StatusBarItem';
1431
- const StatusBarItemsLeft = 'StatusBarItemsLeft';
1432
- const StatusBarItemsRight = 'StatusBarItemsRight';
1433
-
1434
1479
  const HandleClick = 11;
1435
1480
 
1481
+ const getElementVirtualDom = element => {
1482
+ if (element.type === 'text') {
1483
+ return [text(element.value)];
1484
+ }
1485
+ if (element.type === 'icon') {
1486
+ return [{
1487
+ childCount: 0,
1488
+ className: element.value,
1489
+ type: Div
1490
+ }];
1491
+ }
1492
+ return [];
1493
+ };
1436
1494
  const getStatusBarItemVirtualDom = statusBarItem => {
1437
1495
  const {
1496
+ elements,
1438
1497
  name,
1439
1498
  tooltip
1440
1499
  } = statusBarItem;
1500
+ const elementNodes = elements.flatMap(getElementVirtualDom);
1441
1501
  return [{
1442
- childCount: 1,
1502
+ childCount: elementNodes.length,
1443
1503
  className: StatusBarItem,
1444
1504
  name,
1445
1505
  role: Button$1,
1446
1506
  tabIndex: -1,
1447
1507
  title: tooltip,
1448
1508
  type: Button
1449
- }, text(statusBarItem.text)];
1509
+ }, ...elementNodes];
1450
1510
  };
1451
1511
 
1452
1512
  const getStatusBarItemsVirtualDom = (items, className) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/status-bar-worker",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",