@lvce-editor/about-view 1.1.0 → 1.3.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.
- package/dist/aboutWorkerMain.js +61 -4
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -18,6 +18,52 @@ const execute = (command, ...args) => {
|
|
18
18
|
return fn(...args);
|
19
19
|
};
|
20
20
|
|
21
|
+
const None = 0;
|
22
|
+
const Ok = 1;
|
23
|
+
const Copy = 2;
|
24
|
+
|
25
|
+
const getNextFocus = focusId => {
|
26
|
+
switch (focusId) {
|
27
|
+
case Ok:
|
28
|
+
return Copy;
|
29
|
+
case Copy:
|
30
|
+
return Ok;
|
31
|
+
default:
|
32
|
+
return None;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
|
36
|
+
const focusNext = state => {
|
37
|
+
const {
|
38
|
+
focusId
|
39
|
+
} = state;
|
40
|
+
return {
|
41
|
+
...state,
|
42
|
+
focusId: getNextFocus(focusId)
|
43
|
+
};
|
44
|
+
};
|
45
|
+
|
46
|
+
const getPreviousFocus = focusId => {
|
47
|
+
switch (focusId) {
|
48
|
+
case Ok:
|
49
|
+
return Copy;
|
50
|
+
case Copy:
|
51
|
+
return Ok;
|
52
|
+
default:
|
53
|
+
return None;
|
54
|
+
}
|
55
|
+
};
|
56
|
+
|
57
|
+
const focusPrevious = state => {
|
58
|
+
const {
|
59
|
+
focusId
|
60
|
+
} = state;
|
61
|
+
return {
|
62
|
+
...state,
|
63
|
+
focusId: getPreviousFocus(focusId)
|
64
|
+
};
|
65
|
+
};
|
66
|
+
|
21
67
|
const emptyObject = {};
|
22
68
|
const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
|
23
69
|
const i18nString = (key, placeholders = emptyObject) => {
|
@@ -334,6 +380,7 @@ const getV8Version = () => {
|
|
334
380
|
const getDate = () => {
|
335
381
|
return date;
|
336
382
|
};
|
383
|
+
const productNameLong = 'Lvce Editor - OSS';
|
337
384
|
|
338
385
|
const getDetailString = async () => {
|
339
386
|
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
@@ -490,8 +537,15 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
|
|
490
537
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
491
538
|
};
|
492
539
|
|
493
|
-
const
|
494
|
-
const
|
540
|
+
const loadContent = async state => {
|
541
|
+
const lines = await getDetailStringWeb();
|
542
|
+
return {
|
543
|
+
...state,
|
544
|
+
productName: productNameLong,
|
545
|
+
lines,
|
546
|
+
focusId: Ok
|
547
|
+
};
|
548
|
+
};
|
495
549
|
|
496
550
|
/**
|
497
551
|
* @enum {string}
|
@@ -564,9 +618,12 @@ const doRender = (oldState, newState) => {
|
|
564
618
|
};
|
565
619
|
|
566
620
|
const commandMap = {
|
567
|
-
'About.
|
568
|
-
'About.
|
621
|
+
'About.focusNext': focusNext,
|
622
|
+
'About.focusPrevious': focusPrevious,
|
569
623
|
'About.getDetailString': getDetailString,
|
624
|
+
'About.getDetailStringWeb': getDetailStringWeb,
|
625
|
+
'About.getVirtualDom': getAboutVirtualDom,
|
626
|
+
'About.loadContent': loadContent,
|
570
627
|
'About.render': doRender
|
571
628
|
};
|
572
629
|
|