@lvce-editor/panel-worker 2.6.2 → 2.8.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.
@@ -1503,6 +1503,36 @@ const diff2 = uid => {
1503
1503
  return result;
1504
1504
  };
1505
1505
 
1506
+ const setBadgeCount = (state, id, count) => {
1507
+ const {
1508
+ badgeCounts
1509
+ } = state;
1510
+ return {
1511
+ ...state,
1512
+ badgeCounts: {
1513
+ ...badgeCounts,
1514
+ [id]: count
1515
+ }
1516
+ };
1517
+ };
1518
+
1519
+ const DebugConsole = 'Debug Console';
1520
+ const Output = 'Output';
1521
+ const Ports = 'Ports';
1522
+ const Problems = 'Problems';
1523
+ const Terminals = 'Terminals';
1524
+
1525
+ const handleProblemsSummaryChange = (state, summary) => {
1526
+ const {
1527
+ badgeCounts
1528
+ } = state;
1529
+ const count = summary.hasEditor ? summary.problemCount : 0;
1530
+ if (badgeCounts[Problems] === count) {
1531
+ return state;
1532
+ }
1533
+ return setBadgeCount(state, Problems, count);
1534
+ };
1535
+
1506
1536
  const handleClickClose = async state => {
1507
1537
  await invoke('Layout.hidePanel');
1508
1538
  return state;
@@ -1548,12 +1578,6 @@ const handleFilterInput = async (state, value) => {
1548
1578
  return state;
1549
1579
  };
1550
1580
 
1551
- const DebugConsole = 'Debug Console';
1552
- const Output = 'Output';
1553
- const Ports = 'Ports';
1554
- const Problems = 'Problems';
1555
- const Terminals = 'Terminals';
1556
-
1557
1581
  const getPanelViews = () => {
1558
1582
  const views = [Problems, Output, DebugConsole, Terminals, Ports];
1559
1583
  return views;
@@ -1649,19 +1673,6 @@ const selectRaw = async (state, rawIndex) => {
1649
1673
  return selectIndex(state, Number(rawIndex));
1650
1674
  };
1651
1675
 
1652
- const setBadgeCount = (state, id, count) => {
1653
- const {
1654
- badgeCounts
1655
- } = state;
1656
- return {
1657
- ...state,
1658
- badgeCounts: {
1659
- ...badgeCounts,
1660
- [id]: count
1661
- }
1662
- };
1663
- };
1664
-
1665
1676
  const toggleView = async (state, name, uri = '') => {
1666
1677
  const {
1667
1678
  currentViewletId,
@@ -2271,6 +2282,7 @@ const commandMap = {
2271
2282
  'Panel.handleClickUnmaximize': wrapCommand(handleClickUnmaximize),
2272
2283
  'Panel.handleFilterInput': wrapCommand(handleFilterInput),
2273
2284
  'Panel.handlePanelLayoutChanged': wrapCommand(handlePanelLayoutChanged),
2285
+ 'Panel.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
2274
2286
  'Panel.loadContent': wrapCommand(loadContent),
2275
2287
  'Panel.openViewlet': wrapCommand(openViewlet),
2276
2288
  'Panel.render2': render2,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/panel-worker",
3
- "version": "2.6.2",
3
+ "version": "2.8.0",
4
4
  "description": "Panel Worker",
5
5
  "repository": {
6
6
  "type": "git",