@lvce-editor/about-view 4.6.0 → 4.7.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/aboutWorkerMain.js +54 -11
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -805,6 +805,42 @@ const WebWorkerRpcClient = {
|
|
805
805
|
create
|
806
806
|
};
|
807
807
|
|
808
|
+
const RenderFocus = 2;
|
809
|
+
const RenderAbout = 3;
|
810
|
+
|
811
|
+
const diffType$1 = RenderAbout;
|
812
|
+
const isEqual$1 = (oldState, newState) => {
|
813
|
+
return oldState.productName === newState.productName && oldState.lines === newState.lines;
|
814
|
+
};
|
815
|
+
|
816
|
+
const DiffAbout = {
|
817
|
+
__proto__: null,
|
818
|
+
diffType: diffType$1,
|
819
|
+
isEqual: isEqual$1
|
820
|
+
};
|
821
|
+
|
822
|
+
const diffType = RenderFocus;
|
823
|
+
const isEqual = (oldState, newState) => {
|
824
|
+
return oldState.focusId === newState.focusId;
|
825
|
+
};
|
826
|
+
|
827
|
+
const DiffFocus = {
|
828
|
+
__proto__: null,
|
829
|
+
diffType,
|
830
|
+
isEqual
|
831
|
+
};
|
832
|
+
|
833
|
+
const modules = [DiffAbout, DiffFocus];
|
834
|
+
const diff = (oldState, newState) => {
|
835
|
+
const diffResult = [];
|
836
|
+
for (const module of modules) {
|
837
|
+
if (!module.isEqual(oldState, newState)) {
|
838
|
+
diffResult.push(module.diffType);
|
839
|
+
}
|
840
|
+
}
|
841
|
+
return diffResult;
|
842
|
+
};
|
843
|
+
|
808
844
|
const None = 0;
|
809
845
|
const Ok$2 = 1;
|
810
846
|
const Copy$2 = 2;
|
@@ -1474,9 +1510,7 @@ const getFocusSelector = focusId => {
|
|
1474
1510
|
};
|
1475
1511
|
|
1476
1512
|
const renderDialog = {
|
1477
|
-
isEqual
|
1478
|
-
return oldState.productName === newState.productName && oldState.lines === newState.lines;
|
1479
|
-
},
|
1513
|
+
isEqual: isEqual$1,
|
1480
1514
|
apply(oldState, newState) {
|
1481
1515
|
const okMessage = ok();
|
1482
1516
|
const copyMessage = copy();
|
@@ -1487,21 +1521,29 @@ const renderDialog = {
|
|
1487
1521
|
}
|
1488
1522
|
};
|
1489
1523
|
const renderFocus = {
|
1490
|
-
isEqual
|
1491
|
-
return oldState.focusId === newState.focusId;
|
1492
|
-
},
|
1524
|
+
isEqual: isEqual,
|
1493
1525
|
apply(oldState, newState) {
|
1494
1526
|
const name = getFocusSelector(newState.focusId);
|
1495
1527
|
return ['Viewlet.focusElementByName', name];
|
1496
1528
|
}
|
1497
1529
|
};
|
1498
|
-
const
|
1530
|
+
const getRenderer = diffType => {
|
1531
|
+
switch (diffType) {
|
1532
|
+
case RenderAbout:
|
1533
|
+
return renderDialog;
|
1534
|
+
case RenderFocus:
|
1535
|
+
return renderFocus;
|
1536
|
+
default:
|
1537
|
+
throw new Error('unknown renderer');
|
1538
|
+
}
|
1539
|
+
};
|
1540
|
+
|
1499
1541
|
const doRender = (oldState, newState) => {
|
1542
|
+
const diffResult = diff(oldState, newState);
|
1500
1543
|
const commands = [];
|
1501
|
-
for (const
|
1502
|
-
|
1503
|
-
|
1504
|
-
}
|
1544
|
+
for (const item of diffResult) {
|
1545
|
+
const fn = getRenderer(item);
|
1546
|
+
commands.push(fn.apply(oldState, newState));
|
1505
1547
|
}
|
1506
1548
|
return commands;
|
1507
1549
|
};
|
@@ -1569,6 +1611,7 @@ const showAboutElectron = async () => {
|
|
1569
1611
|
|
1570
1612
|
const commandMap = {
|
1571
1613
|
'About.focusNext': focusNext,
|
1614
|
+
'About.diff': diff,
|
1572
1615
|
'About.focusPrevious': focusPrevious,
|
1573
1616
|
'About.getDetailString': getDetailString,
|
1574
1617
|
'About.getDetailStringWeb': getDetailStringWeb,
|