@lvce-editor/about-view 4.17.0 → 5.0.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 +158 -172
- package/package.json +1 -1
package/dist/aboutWorkerMain.js
CHANGED
@@ -395,7 +395,7 @@ const set$2 = (id, fn) => {
|
|
395
395
|
const get$2 = id => {
|
396
396
|
return callbacks[id];
|
397
397
|
};
|
398
|
-
const remove = id => {
|
398
|
+
const remove$1 = id => {
|
399
399
|
delete callbacks[id];
|
400
400
|
};
|
401
401
|
let id = 0;
|
@@ -572,7 +572,7 @@ const resolve = (id, response) => {
|
|
572
572
|
return;
|
573
573
|
}
|
574
574
|
fn(response);
|
575
|
-
remove(id);
|
575
|
+
remove$1(id);
|
576
576
|
};
|
577
577
|
const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
|
578
578
|
const getErrorType = prettyError => {
|
@@ -809,6 +809,9 @@ const states = Object.create(null);
|
|
809
809
|
const get$1 = uid => {
|
810
810
|
return states[uid];
|
811
811
|
};
|
812
|
+
const remove = uid => {
|
813
|
+
delete states[uid];
|
814
|
+
};
|
812
815
|
const set$1 = (uid, oldState, newState) => {
|
813
816
|
states[uid] = {
|
814
817
|
oldState,
|
@@ -862,6 +865,10 @@ const diff2 = uid => {
|
|
862
865
|
return diffResult;
|
863
866
|
};
|
864
867
|
|
868
|
+
const dispose = uid => {
|
869
|
+
remove(uid);
|
870
|
+
};
|
871
|
+
|
865
872
|
const None = 0;
|
866
873
|
const Ok$2 = 1;
|
867
874
|
const Copy$2 = 2;
|
@@ -908,6 +915,84 @@ const focusPrevious = state => {
|
|
908
915
|
};
|
909
916
|
};
|
910
917
|
|
918
|
+
const commandIds = ['handleClickClose', 'handleClickOk', 'handleClickCopy', 'handleFocusIn', 'focusNext', 'focusPrevious'];
|
919
|
+
const getCommandIds = () => {
|
920
|
+
return commandIds;
|
921
|
+
};
|
922
|
+
|
923
|
+
const Tab = 2;
|
924
|
+
const Escape = 8;
|
925
|
+
|
926
|
+
const Shift = 1 << 10 >>> 0;
|
927
|
+
|
928
|
+
const FocusAbout = 4;
|
929
|
+
|
930
|
+
const getKeyBindings = () => {
|
931
|
+
return [{
|
932
|
+
key: Escape,
|
933
|
+
command: 'About.handleClickClose',
|
934
|
+
when: FocusAbout
|
935
|
+
}, {
|
936
|
+
key: Tab,
|
937
|
+
command: 'About.focusNext',
|
938
|
+
when: FocusAbout
|
939
|
+
}, {
|
940
|
+
key: Tab | Shift,
|
941
|
+
command: 'About.focusPrevious',
|
942
|
+
when: FocusAbout
|
943
|
+
}];
|
944
|
+
};
|
945
|
+
|
946
|
+
const RendererWorker = 1;
|
947
|
+
|
948
|
+
const rpcs = Object.create(null);
|
949
|
+
const set = (id, rpc) => {
|
950
|
+
rpcs[id] = rpc;
|
951
|
+
};
|
952
|
+
const get = id => {
|
953
|
+
return rpcs[id];
|
954
|
+
};
|
955
|
+
|
956
|
+
const invoke = (method, ...params) => {
|
957
|
+
const rpc = get(RendererWorker);
|
958
|
+
// @ts-ignore
|
959
|
+
return rpc.invoke(method, ...params);
|
960
|
+
};
|
961
|
+
|
962
|
+
const handleClickClose = async state => {
|
963
|
+
await invoke('Viewlet.closeWidget', 'About');
|
964
|
+
return state;
|
965
|
+
};
|
966
|
+
|
967
|
+
const writeText = async text => {
|
968
|
+
await invoke('ClipBoard.writeText', /* text */text);
|
969
|
+
};
|
970
|
+
|
971
|
+
const NewLine = '\n';
|
972
|
+
|
973
|
+
const joinLines = lines => {
|
974
|
+
return lines.join(NewLine);
|
975
|
+
};
|
976
|
+
|
977
|
+
const handleClickCopy = async state => {
|
978
|
+
const {
|
979
|
+
lines
|
980
|
+
} = state;
|
981
|
+
const message = joinLines(lines);
|
982
|
+
await writeText(message);
|
983
|
+
return state;
|
984
|
+
};
|
985
|
+
|
986
|
+
const handleClickOk = async state => {
|
987
|
+
await invoke('Viewlet.closeWidget', 'About');
|
988
|
+
return state;
|
989
|
+
};
|
990
|
+
|
991
|
+
const handleFocusIn = async state => {
|
992
|
+
await invoke('Focus.setFocus', FocusAbout);
|
993
|
+
return state;
|
994
|
+
};
|
995
|
+
|
911
996
|
const OneSecondAgo = '1 second ago';
|
912
997
|
const SomeSecondsAgo = '{PH1} seconds ago';
|
913
998
|
const OneMinuteAgo = '1 minute ago';
|
@@ -1192,26 +1277,8 @@ const formatAboutDate = (isoDate, now) => {
|
|
1192
1277
|
return `${isoDate} (${ago})`;
|
1193
1278
|
};
|
1194
1279
|
|
1195
|
-
const
|
1196
|
-
|
1197
|
-
const joinLines = lines => {
|
1198
|
-
return lines.join(NewLine);
|
1199
|
-
};
|
1200
|
-
|
1201
|
-
const RendererWorker = 1;
|
1202
|
-
|
1203
|
-
const rpcs = Object.create(null);
|
1204
|
-
const set = (id, rpc) => {
|
1205
|
-
rpcs[id] = rpc;
|
1206
|
-
};
|
1207
|
-
const get = id => {
|
1208
|
-
return rpcs[id];
|
1209
|
-
};
|
1210
|
-
|
1211
|
-
const invoke = (method, ...params) => {
|
1212
|
-
const rpc = get(RendererWorker);
|
1213
|
-
// @ts-ignore
|
1214
|
-
return rpc.invoke(method, ...params);
|
1280
|
+
const getBrowser = () => {
|
1281
|
+
return `${navigator.userAgent}`;
|
1215
1282
|
};
|
1216
1283
|
|
1217
1284
|
const version = '0.0.0-dev';
|
@@ -1255,18 +1322,6 @@ const Process = {
|
|
1255
1322
|
version
|
1256
1323
|
};
|
1257
1324
|
|
1258
|
-
const getDetailString = async () => {
|
1259
|
-
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
1260
|
-
const now = Date.now();
|
1261
|
-
const formattedDate = formatAboutDate(date, now);
|
1262
|
-
const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Electron: ${electronVersion}`, `Chromium: ${chromeVersion}`, `Node: ${nodeVersion}`, `V8: ${v8Version}`];
|
1263
|
-
return joinLines(lines);
|
1264
|
-
};
|
1265
|
-
|
1266
|
-
const getBrowser = () => {
|
1267
|
-
return `${navigator.userAgent}`;
|
1268
|
-
};
|
1269
|
-
|
1270
1325
|
const getDetailStringWeb = () => {
|
1271
1326
|
const {
|
1272
1327
|
date,
|
@@ -1280,6 +1335,57 @@ const getDetailStringWeb = () => {
|
|
1280
1335
|
return lines;
|
1281
1336
|
};
|
1282
1337
|
|
1338
|
+
const loadContent2 = uid => {
|
1339
|
+
const lines = getDetailStringWeb();
|
1340
|
+
const {
|
1341
|
+
oldState
|
1342
|
+
} = get$1(uid);
|
1343
|
+
const newState = {
|
1344
|
+
...oldState,
|
1345
|
+
productName: productNameLong$1,
|
1346
|
+
lines,
|
1347
|
+
focusId: Ok$2
|
1348
|
+
};
|
1349
|
+
set$1(uid, oldState, newState);
|
1350
|
+
};
|
1351
|
+
|
1352
|
+
const Ok$1 = 'Ok';
|
1353
|
+
const Copy$1 = 'Copy';
|
1354
|
+
const Info$1 = 'Info';
|
1355
|
+
const CloseDialog = 'Close Dialog';
|
1356
|
+
|
1357
|
+
const ok = () => {
|
1358
|
+
return i18nString(Ok$1);
|
1359
|
+
};
|
1360
|
+
const copy = () => {
|
1361
|
+
return i18nString(Copy$1);
|
1362
|
+
};
|
1363
|
+
const info = () => {
|
1364
|
+
return i18nString(Info$1);
|
1365
|
+
};
|
1366
|
+
const closeDialog = () => {
|
1367
|
+
return i18nString(CloseDialog);
|
1368
|
+
};
|
1369
|
+
|
1370
|
+
const createViewModel = state => {
|
1371
|
+
const okMessage = ok();
|
1372
|
+
const copyMessage = copy();
|
1373
|
+
const closeMessage = closeDialog();
|
1374
|
+
const infoMessage = info();
|
1375
|
+
const {
|
1376
|
+
productName,
|
1377
|
+
lines
|
1378
|
+
} = state;
|
1379
|
+
return {
|
1380
|
+
productName,
|
1381
|
+
lines,
|
1382
|
+
closeMessage,
|
1383
|
+
okMessage,
|
1384
|
+
copyMessage,
|
1385
|
+
infoMessage
|
1386
|
+
};
|
1387
|
+
};
|
1388
|
+
|
1283
1389
|
const Button$2 = 'Button';
|
1284
1390
|
const ButtonPrimary = 'ButtonPrimary';
|
1285
1391
|
const ButtonSecondary = 'ButtonSecondary';
|
@@ -1374,8 +1480,8 @@ const getSecondaryButtonVirtualDom = (message, onClick, name) => {
|
|
1374
1480
|
const DialogIcon = 'DialogIcon';
|
1375
1481
|
const DialogHeading = 'DialogHeading';
|
1376
1482
|
|
1377
|
-
const Ok
|
1378
|
-
const Copy
|
1483
|
+
const Ok = 'Ok';
|
1484
|
+
const Copy = 'Copy';
|
1379
1485
|
|
1380
1486
|
const Focusable = -1;
|
1381
1487
|
|
@@ -1427,7 +1533,7 @@ const getDialogVirtualDom = (content, closeMessage, infoMessage, okMessage, copy
|
|
1427
1533
|
type: Div,
|
1428
1534
|
className: DialogButtonsRow,
|
1429
1535
|
childCount: 2
|
1430
|
-
}, ...getSecondaryButtonVirtualDom(okMessage, HandleClickOk, Ok
|
1536
|
+
}, ...getSecondaryButtonVirtualDom(okMessage, HandleClickOk, Ok), ...getPrimaryButtonVirtualDom(copyMessage, HandleClickCopy, Copy)];
|
1431
1537
|
return dom;
|
1432
1538
|
};
|
1433
1539
|
|
@@ -1441,123 +1547,6 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
|
|
1441
1547
|
}, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
|
1442
1548
|
};
|
1443
1549
|
|
1444
|
-
const commandIds = ['handleClickClose', 'handleClickOk', 'handleClickCopy', 'handleFocusIn', 'focusNext', 'focusPrevious'];
|
1445
|
-
const getCommandIds = () => {
|
1446
|
-
return commandIds;
|
1447
|
-
};
|
1448
|
-
|
1449
|
-
const Tab = 2;
|
1450
|
-
const Escape = 8;
|
1451
|
-
|
1452
|
-
const Shift = 1 << 10 >>> 0;
|
1453
|
-
|
1454
|
-
const FocusAbout = 4;
|
1455
|
-
|
1456
|
-
const getKeyBindings = () => {
|
1457
|
-
return [{
|
1458
|
-
key: Escape,
|
1459
|
-
command: 'About.handleClickClose',
|
1460
|
-
when: FocusAbout
|
1461
|
-
}, {
|
1462
|
-
key: Tab,
|
1463
|
-
command: 'About.focusNext',
|
1464
|
-
when: FocusAbout
|
1465
|
-
}, {
|
1466
|
-
key: Tab | Shift,
|
1467
|
-
command: 'About.focusPrevious',
|
1468
|
-
when: FocusAbout
|
1469
|
-
}];
|
1470
|
-
};
|
1471
|
-
|
1472
|
-
const handleClickClose = async state => {
|
1473
|
-
await invoke('Viewlet.closeWidget', 'About');
|
1474
|
-
return state;
|
1475
|
-
};
|
1476
|
-
|
1477
|
-
const writeText = async text => {
|
1478
|
-
await invoke('ClipBoard.writeText', /* text */text);
|
1479
|
-
};
|
1480
|
-
|
1481
|
-
const handleClickCopy = async state => {
|
1482
|
-
const {
|
1483
|
-
lines
|
1484
|
-
} = state;
|
1485
|
-
const message = joinLines(lines);
|
1486
|
-
await writeText(message);
|
1487
|
-
return state;
|
1488
|
-
};
|
1489
|
-
|
1490
|
-
const handleClickOk = async state => {
|
1491
|
-
await invoke('Viewlet.closeWidget', 'About');
|
1492
|
-
return state;
|
1493
|
-
};
|
1494
|
-
|
1495
|
-
const handleFocusIn = async state => {
|
1496
|
-
await invoke('Focus.setFocus', FocusAbout);
|
1497
|
-
return state;
|
1498
|
-
};
|
1499
|
-
|
1500
|
-
const loadContent2 = uid => {
|
1501
|
-
const lines = getDetailStringWeb();
|
1502
|
-
const {
|
1503
|
-
oldState
|
1504
|
-
} = get$1(uid);
|
1505
|
-
const newState = {
|
1506
|
-
...oldState,
|
1507
|
-
productName: productNameLong$1,
|
1508
|
-
lines,
|
1509
|
-
focusId: Ok$2
|
1510
|
-
};
|
1511
|
-
set$1(uid, oldState, newState);
|
1512
|
-
};
|
1513
|
-
|
1514
|
-
const loadContent = state => {
|
1515
|
-
const lines = getDetailStringWeb();
|
1516
|
-
return {
|
1517
|
-
...state,
|
1518
|
-
productName: productNameLong$1,
|
1519
|
-
lines,
|
1520
|
-
focusId: Ok$2
|
1521
|
-
};
|
1522
|
-
};
|
1523
|
-
|
1524
|
-
const Ok = 'Ok';
|
1525
|
-
const Copy = 'Copy';
|
1526
|
-
const Info$1 = 'Info';
|
1527
|
-
const CloseDialog = 'Close Dialog';
|
1528
|
-
|
1529
|
-
const ok = () => {
|
1530
|
-
return i18nString(Ok);
|
1531
|
-
};
|
1532
|
-
const copy = () => {
|
1533
|
-
return i18nString(Copy);
|
1534
|
-
};
|
1535
|
-
const info = () => {
|
1536
|
-
return i18nString(Info$1);
|
1537
|
-
};
|
1538
|
-
const closeDialog = () => {
|
1539
|
-
return i18nString(CloseDialog);
|
1540
|
-
};
|
1541
|
-
|
1542
|
-
const createViewModel = state => {
|
1543
|
-
const okMessage = ok();
|
1544
|
-
const copyMessage = copy();
|
1545
|
-
const closeMessage = closeDialog();
|
1546
|
-
const infoMessage = info();
|
1547
|
-
const {
|
1548
|
-
productName,
|
1549
|
-
lines
|
1550
|
-
} = state;
|
1551
|
-
return {
|
1552
|
-
productName,
|
1553
|
-
lines,
|
1554
|
-
closeMessage,
|
1555
|
-
okMessage,
|
1556
|
-
copyMessage,
|
1557
|
-
infoMessage
|
1558
|
-
};
|
1559
|
-
};
|
1560
|
-
|
1561
1550
|
const renderDialog = (oldState, newState) => {
|
1562
1551
|
const viewModel = createViewModel(newState);
|
1563
1552
|
const dom = getAboutVirtualDom(viewModel.productName, viewModel.lines, viewModel.closeMessage, viewModel.okMessage, viewModel.copyMessage, viewModel.infoMessage);
|
@@ -1567,9 +1556,9 @@ const renderDialog = (oldState, newState) => {
|
|
1567
1556
|
const getFocusSelector = focusId => {
|
1568
1557
|
switch (focusId) {
|
1569
1558
|
case Copy$2:
|
1570
|
-
return Copy
|
1559
|
+
return Copy;
|
1571
1560
|
case Ok$2:
|
1572
|
-
return Ok
|
1561
|
+
return Ok;
|
1573
1562
|
default:
|
1574
1563
|
return '';
|
1575
1564
|
}
|
@@ -1600,7 +1589,7 @@ const applyRender = (oldState, newState, diffResult) => {
|
|
1600
1589
|
return commands;
|
1601
1590
|
};
|
1602
1591
|
|
1603
|
-
const doRender
|
1592
|
+
const doRender = (uid, diffResult) => {
|
1604
1593
|
const {
|
1605
1594
|
oldState,
|
1606
1595
|
newState
|
@@ -1610,11 +1599,6 @@ const doRender$1 = (uid, diffResult) => {
|
|
1610
1599
|
return commands;
|
1611
1600
|
};
|
1612
1601
|
|
1613
|
-
const doRender = (oldState, newState) => {
|
1614
|
-
const diffResult = diff(oldState, newState);
|
1615
|
-
return applyRender(oldState, newState, diffResult);
|
1616
|
-
};
|
1617
|
-
|
1618
1602
|
const renderEventListeners = () => {
|
1619
1603
|
return [{
|
1620
1604
|
name: HandleClickOk,
|
@@ -1665,6 +1649,14 @@ const showMessageBox = async options => {
|
|
1665
1649
|
|
1666
1650
|
const Info = 'info';
|
1667
1651
|
|
1652
|
+
const getDetailString = async () => {
|
1653
|
+
const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
|
1654
|
+
const now = Date.now();
|
1655
|
+
const formattedDate = formatAboutDate(date, now);
|
1656
|
+
const lines = [`Version: ${version}`, `Commit: ${commit}`, `Date: ${formattedDate}`, `Electron: ${electronVersion}`, `Chromium: ${chromeVersion}`, `Node: ${nodeVersion}`, `V8: ${v8Version}`];
|
1657
|
+
return joinLines(lines);
|
1658
|
+
};
|
1659
|
+
|
1668
1660
|
const showAboutElectron = async () => {
|
1669
1661
|
const windowId = await getWindowId();
|
1670
1662
|
const detail = await getDetailString();
|
@@ -1701,26 +1693,20 @@ const showAbout = async platform => {
|
|
1701
1693
|
const commandMap = {
|
1702
1694
|
'About.create': create,
|
1703
1695
|
'About.diff2': diff2,
|
1696
|
+
'About.dispose': dispose,
|
1704
1697
|
'About.focusNext': focusNext,
|
1705
1698
|
'About.focusPrevious': focusPrevious,
|
1706
1699
|
'About.getCommandIds': getCommandIds,
|
1707
1700
|
'About.getKeyBindings': getKeyBindings,
|
1708
1701
|
'About.handleClickClose': handleClickClose,
|
1709
1702
|
'About.handleClickCopy': handleClickCopy,
|
1710
|
-
'About.loadContent2': loadContent2,
|
1711
1703
|
'About.handleClickOk': handleClickOk,
|
1712
1704
|
'About.handleFocusIn': handleFocusIn,
|
1713
|
-
'About.
|
1705
|
+
'About.loadContent2': loadContent2,
|
1706
|
+
'About.render2': doRender,
|
1714
1707
|
'About.renderEventListeners': renderEventListeners,
|
1715
1708
|
'About.showAbout': showAbout,
|
1716
|
-
'About.showAboutElectron': showAboutElectron
|
1717
|
-
// deprecated
|
1718
|
-
'About.loadContent': loadContent,
|
1719
|
-
'About.diff': diff,
|
1720
|
-
'About.render': doRender,
|
1721
|
-
'About.getVirtualDom': getAboutVirtualDom,
|
1722
|
-
'About.getDetailString': getDetailString,
|
1723
|
-
'About.getDetailStringWeb': getDetailStringWeb
|
1709
|
+
'About.showAboutElectron': showAboutElectron
|
1724
1710
|
};
|
1725
1711
|
|
1726
1712
|
const listen = async () => {
|