@lvce-editor/panel-worker 2.9.0 → 2.10.1
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.
- package/dist/panelWorkerMain.js +20 -4
- package/package.json +1 -1
package/dist/panelWorkerMain.js
CHANGED
|
@@ -1589,8 +1589,13 @@ const isEqual$1 = (oldState, newState) => {
|
|
|
1589
1589
|
return oldState.childUid === newState.childUid;
|
|
1590
1590
|
};
|
|
1591
1591
|
|
|
1592
|
+
const areBadgeCountsEqual = (oldBadgeCounts, newBadgeCounts) => {
|
|
1593
|
+
const oldKeys = Object.keys(oldBadgeCounts);
|
|
1594
|
+
const newKeys = Object.keys(newBadgeCounts);
|
|
1595
|
+
return oldKeys.length === newKeys.length && oldKeys.every(key => oldBadgeCounts[key] === newBadgeCounts[key]);
|
|
1596
|
+
};
|
|
1592
1597
|
const isEqual = (oldState, newState) => {
|
|
1593
|
-
return oldState.assetDir === newState.assetDir && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId && oldState.maximized === newState.maximized && oldState.selectedIndex === newState.selectedIndex && oldState.views === newState.views && oldState.childUid === newState.childUid && oldState.actionsUid === newState.actionsUid;
|
|
1598
|
+
return oldState.assetDir === newState.assetDir && areBadgeCountsEqual(oldState.badgeCounts, newState.badgeCounts) && oldState.initial === newState.initial && oldState.currentViewletId === newState.currentViewletId && oldState.maximized === newState.maximized && oldState.selectedIndex === newState.selectedIndex && oldState.views === newState.views && oldState.childUid === newState.childUid && oldState.actionsUid === newState.actionsUid;
|
|
1594
1599
|
};
|
|
1595
1600
|
|
|
1596
1601
|
const RenderItems = 4;
|
|
@@ -1636,9 +1641,19 @@ const set = rpc => {
|
|
|
1636
1641
|
state.connected = true;
|
|
1637
1642
|
};
|
|
1638
1643
|
|
|
1639
|
-
const handleMessagePort = async port => {
|
|
1644
|
+
const handleMessagePort = async (port, viewletCommandMap) => {
|
|
1645
|
+
const executeViewletCommand = async (uid, command, ...args) => {
|
|
1646
|
+
const fn = viewletCommandMap[`Panel.${command}`];
|
|
1647
|
+
if (typeof fn !== 'function') {
|
|
1648
|
+
throw new TypeError(`Viewlet command not found: ${command}`);
|
|
1649
|
+
}
|
|
1650
|
+
await fn(uid, ...args);
|
|
1651
|
+
await invoke$1('Viewlet.requestRender', uid);
|
|
1652
|
+
};
|
|
1640
1653
|
const rpc = await create$4({
|
|
1641
|
-
commandMap: {
|
|
1654
|
+
commandMap: {
|
|
1655
|
+
'Viewlet.executeViewletCommand': executeViewletCommand
|
|
1656
|
+
},
|
|
1642
1657
|
messagePort: port
|
|
1643
1658
|
});
|
|
1644
1659
|
set(rpc);
|
|
@@ -2418,6 +2433,7 @@ const selectName = async (state, name) => {
|
|
|
2418
2433
|
return selectIndex(state, index);
|
|
2419
2434
|
};
|
|
2420
2435
|
|
|
2436
|
+
const handleDirectMessagePort = port => handleMessagePort(port, commandMap);
|
|
2421
2437
|
const commandMap = {
|
|
2422
2438
|
'Panel.create': create,
|
|
2423
2439
|
'Panel.diff2': diff2,
|
|
@@ -2427,7 +2443,7 @@ const commandMap = {
|
|
|
2427
2443
|
'Panel.handleClickMaximize': wrapCommand(handleClickMaximize),
|
|
2428
2444
|
'Panel.handleClickUnmaximize': wrapCommand(handleClickUnmaximize),
|
|
2429
2445
|
'Panel.handleFilterInput': wrapCommand(handleFilterInput),
|
|
2430
|
-
'Panel.handleMessagePort':
|
|
2446
|
+
'Panel.handleMessagePort': handleDirectMessagePort,
|
|
2431
2447
|
'Panel.handlePanelLayoutChanged': wrapCommand(handlePanelLayoutChanged),
|
|
2432
2448
|
'Panel.handleProblemsSummaryChange': wrapCommand(handleProblemsSummaryChange),
|
|
2433
2449
|
'Panel.loadContent': wrapCommand(loadContent),
|