@lvce-editor/status-bar-worker 1.9.0 → 1.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.
@@ -1008,8 +1008,9 @@ const WebWorkerRpcClient = {
1008
1008
  create: create$4
1009
1009
  };
1010
1010
 
1011
- const Button = 'button';
1011
+ const Button$1 = 'button';
1012
1012
 
1013
+ const Button = 1;
1013
1014
  const Div = 4;
1014
1015
  const Text = 12;
1015
1016
 
@@ -1325,6 +1326,12 @@ const itemRightUpdate = (state, newItem) => {
1325
1326
  };
1326
1327
  };
1327
1328
 
1329
+ const ProblemsErrorIcon = 'ProblemsErrorIcon';
1330
+ const ProblemsWarningIcon = 'ProblemsWarningIcon';
1331
+ const StatusBarItem = 'StatusBarItem';
1332
+ const StatusBarItemsLeft = 'StatusBarItemsLeft';
1333
+ const StatusBarItemsRight = 'StatusBarItemsRight';
1334
+
1328
1335
  const OnStatusBarItem = 'onStatusBarItem';
1329
1336
 
1330
1337
  const GetStatusBarItems = 'ExtensionHost.getStatusBarItems2';
@@ -1361,21 +1368,51 @@ const getStatusBarItems$1 = () => {
1361
1368
  });
1362
1369
  };
1363
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
+
1364
1399
  const toUiStatusBarItem = extensionHostStatusBarItem => {
1365
1400
  return {
1366
1401
  command: extensionHostStatusBarItem.command || '',
1367
1402
  icon: extensionHostStatusBarItem.icon || '',
1368
- name: extensionHostStatusBarItem.id || '',
1403
+ name: extensionHostStatusBarItem.id || extensionHostStatusBarItem.name || '',
1369
1404
  text: extensionHostStatusBarItem.text || '',
1370
1405
  tooltip: extensionHostStatusBarItem.tooltip || ''
1371
1406
  };
1372
1407
  };
1408
+
1373
1409
  const toUiStatusBarItems = statusBarItems => {
1374
1410
  if (!statusBarItems) {
1375
1411
  return [];
1376
1412
  }
1377
1413
  return statusBarItems.map(toUiStatusBarItem);
1378
1414
  };
1415
+
1379
1416
  const getStatusBarItems = async showItems => {
1380
1417
  if (!showItems) {
1381
1418
  return [];
@@ -1384,19 +1421,32 @@ const getStatusBarItems = async showItems => {
1384
1421
  const extensionStatusBarItems = await getStatusBarItems$1();
1385
1422
  const uiStatusBarItems = toUiStatusBarItems(extensionStatusBarItems);
1386
1423
  const extraItems = [{
1387
- command: '',
1388
- icon: '',
1424
+ command: undefined,
1425
+ elements: [{
1426
+ type: 'text',
1427
+ value: 'Notifications'
1428
+ }],
1389
1429
  name: Notifications,
1390
- text: 'Notifications',
1391
1430
  tooltip: ''
1392
1431
  }, {
1393
- command: '',
1394
- 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
+ }],
1395
1446
  name: Problems,
1396
- text: 'Problems',
1397
1447
  tooltip: ''
1398
1448
  }];
1399
- return [...uiStatusBarItems, ...extraItems];
1449
+ return [...uiStatusBarItems.map(toStatusBarItem), ...extraItems];
1400
1450
  };
1401
1451
 
1402
1452
  const get = async key => {
@@ -1426,26 +1476,37 @@ const text = data => {
1426
1476
  };
1427
1477
  };
1428
1478
 
1429
- const StatusBarItem = 'StatusBarItem';
1430
- const StatusBarItemsLeft = 'StatusBarItemsLeft';
1431
- const StatusBarItemsRight = 'StatusBarItemsRight';
1432
-
1433
1479
  const HandleClick = 11;
1434
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
+ };
1435
1494
  const getStatusBarItemVirtualDom = statusBarItem => {
1436
1495
  const {
1496
+ elements,
1437
1497
  name,
1438
1498
  tooltip
1439
1499
  } = statusBarItem;
1500
+ const elementNodes = elements.flatMap(getElementVirtualDom);
1440
1501
  return [{
1441
- childCount: 1,
1502
+ childCount: elementNodes.length,
1442
1503
  className: StatusBarItem,
1443
1504
  name,
1444
- role: Button,
1505
+ role: Button$1,
1445
1506
  tabIndex: -1,
1446
1507
  title: tooltip,
1447
- type: Div
1448
- }, text(statusBarItem.text)];
1508
+ type: Button
1509
+ }, ...elementNodes];
1449
1510
  };
1450
1511
 
1451
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.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "Status Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",