@lvce-editor/about-view 2.4.0 → 3.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 +72 -13
- package/package.json +1 -1
    
        package/dist/aboutWorkerMain.js
    CHANGED
    
    | @@ -6,17 +6,17 @@ const create$4 = (method, params) => { | |
| 6 6 | 
             
                params
         | 
| 7 7 | 
             
              };
         | 
| 8 8 | 
             
            };
         | 
| 9 | 
            -
            const state = {
         | 
| 9 | 
            +
            const state$1 = {
         | 
| 10 10 | 
             
              callbacks: Object.create(null)
         | 
| 11 11 | 
             
            };
         | 
| 12 12 | 
             
            const set = (id, fn) => {
         | 
| 13 | 
            -
              state.callbacks[id] = fn;
         | 
| 13 | 
            +
              state$1.callbacks[id] = fn;
         | 
| 14 14 | 
             
            };
         | 
| 15 15 | 
             
            const get = id => {
         | 
| 16 | 
            -
              return state.callbacks[id];
         | 
| 16 | 
            +
              return state$1.callbacks[id];
         | 
| 17 17 | 
             
            };
         | 
| 18 18 | 
             
            const remove = id => {
         | 
| 19 | 
            -
              delete state.callbacks[id];
         | 
| 19 | 
            +
              delete state$1.callbacks[id];
         | 
| 20 20 | 
             
            };
         | 
| 21 21 | 
             
            let id = 0;
         | 
| 22 22 | 
             
            const create$3 = () => {
         | 
| @@ -339,7 +339,7 @@ const send = (transport, method, ...params) => { | |
| 339 339 | 
             
              const message = create$4(method, params);
         | 
| 340 340 | 
             
              transport.send(message);
         | 
| 341 341 | 
             
            };
         | 
| 342 | 
            -
            const invoke = (ipc, method, ...params) => {
         | 
| 342 | 
            +
            const invoke$1 = (ipc, method, ...params) => {
         | 
| 343 343 | 
             
              return invokeHelper(ipc, method, params, false);
         | 
| 344 344 | 
             
            };
         | 
| 345 345 | 
             
            const invokeAndTransfer = (ipc, method, ...params) => {
         | 
| @@ -753,7 +753,7 @@ const createRpc = ipc => { | |
| 753 753 | 
             
                  send(ipc, method, ...params);
         | 
| 754 754 | 
             
                },
         | 
| 755 755 | 
             
                invoke(method, ...params) {
         | 
| 756 | 
            -
                  return invoke(ipc, method, ...params);
         | 
| 756 | 
            +
                  return invoke$1(ipc, method, ...params);
         | 
| 757 757 | 
             
                },
         | 
| 758 758 | 
             
                invokeAndTransfer(method, ...params) {
         | 
| 759 759 | 
             
                  return invokeAndTransfer(ipc, method, ...params);
         | 
| @@ -1140,17 +1140,29 @@ const joinLines = lines => { | |
| 1140 1140 | 
             
              return lines.join(NewLine);
         | 
| 1141 1141 | 
             
            };
         | 
| 1142 1142 |  | 
| 1143 | 
            +
            const state = {
         | 
| 1144 | 
            +
              rpc: undefined
         | 
| 1145 | 
            +
            };
         | 
| 1146 | 
            +
            const invoke = (method, ...params) => {
         | 
| 1147 | 
            +
              const rpc = state.rpc;
         | 
| 1148 | 
            +
              // @ts-ignore
         | 
| 1149 | 
            +
              return rpc.invoke(method, ...params);
         | 
| 1150 | 
            +
            };
         | 
| 1151 | 
            +
            const setRpc = rpc => {
         | 
| 1152 | 
            +
              state.rpc = rpc;
         | 
| 1153 | 
            +
            };
         | 
| 1154 | 
            +
             | 
| 1143 1155 | 
             
            const version = '0.0.0-dev';
         | 
| 1144 1156 | 
             
            const commit = 'unknown commit';
         | 
| 1145 1157 | 
             
            const date = '';
         | 
| 1146 1158 | 
             
            const getElectronVersion = () => {
         | 
| 1147 | 
            -
              return '';
         | 
| 1159 | 
            +
              return invoke('Process.getElectronVersion');
         | 
| 1148 1160 | 
             
            };
         | 
| 1149 1161 | 
             
            const getNodeVersion = () => {
         | 
| 1150 | 
            -
              return '';
         | 
| 1162 | 
            +
              return invoke('Process.getNodeVersion');
         | 
| 1151 1163 | 
             
            };
         | 
| 1152 1164 | 
             
            const getChromeVersion = () => {
         | 
| 1153 | 
            -
              return '';
         | 
| 1165 | 
            +
              return invoke('Process.getChromeVersion');
         | 
| 1154 1166 | 
             
            };
         | 
| 1155 1167 | 
             
            const getVersion = () => {
         | 
| 1156 1168 | 
             
              return version;
         | 
| @@ -1164,7 +1176,7 @@ const getV8Version = () => { | |
| 1164 1176 | 
             
            const getDate = () => {
         | 
| 1165 1177 | 
             
              return date;
         | 
| 1166 1178 | 
             
            };
         | 
| 1167 | 
            -
            const productNameLong = 'Lvce Editor - OSS';
         | 
| 1179 | 
            +
            const productNameLong$1 = 'Lvce Editor - OSS';
         | 
| 1168 1180 |  | 
| 1169 1181 | 
             
            const getDetailString = async () => {
         | 
| 1170 1182 | 
             
              const [electronVersion, nodeVersion, chromeVersion, version, commit, v8Version, date] = await Promise.all([getElectronVersion(), getNodeVersion(), getChromeVersion(), getVersion(), getCommit(), getV8Version(), getDate()]);
         | 
| @@ -1375,7 +1387,7 @@ const loadContent = state => { | |
| 1375 1387 | 
             
              const lines = getDetailStringWeb();
         | 
| 1376 1388 | 
             
              return {
         | 
| 1377 1389 | 
             
                ...state,
         | 
| 1378 | 
            -
                productName: productNameLong,
         | 
| 1390 | 
            +
                productName: productNameLong$1,
         | 
| 1379 1391 | 
             
                lines,
         | 
| 1380 1392 | 
             
                focusId: Ok$1
         | 
| 1381 1393 | 
             
              };
         | 
| @@ -1472,6 +1484,51 @@ const renderEventListers = () => { | |
| 1472 1484 | 
             
              }];
         | 
| 1473 1485 | 
             
            };
         | 
| 1474 1486 |  | 
| 1487 | 
            +
            const writeText = async text => {
         | 
| 1488 | 
            +
              await invoke('ClipBoard.writeText', /* text */text);
         | 
| 1489 | 
            +
            };
         | 
| 1490 | 
            +
             | 
| 1491 | 
            +
            const getWindowId = async () => {
         | 
| 1492 | 
            +
              return invoke('GetWindowId.getWindowId');
         | 
| 1493 | 
            +
            };
         | 
| 1494 | 
            +
             | 
| 1495 | 
            +
            const productNameLong = 'Lvce Editor - OSS';
         | 
| 1496 | 
            +
            const getProductNameLong = () => {
         | 
| 1497 | 
            +
              return productNameLong;
         | 
| 1498 | 
            +
            };
         | 
| 1499 | 
            +
             | 
| 1500 | 
            +
            const showMessageBox = async options => {
         | 
| 1501 | 
            +
              const productName = getProductNameLong();
         | 
| 1502 | 
            +
              const windowId = await getWindowId();
         | 
| 1503 | 
            +
              const finalOptions = {
         | 
| 1504 | 
            +
                ...options,
         | 
| 1505 | 
            +
                productName,
         | 
| 1506 | 
            +
                windowId
         | 
| 1507 | 
            +
              };
         | 
| 1508 | 
            +
              return invoke('ElectronDialog.showMessageBox', finalOptions);
         | 
| 1509 | 
            +
            };
         | 
| 1510 | 
            +
             | 
| 1511 | 
            +
            const Info = 'info';
         | 
| 1512 | 
            +
             | 
| 1513 | 
            +
            const showAboutElectron = async () => {
         | 
| 1514 | 
            +
              const windowId = await getWindowId();
         | 
| 1515 | 
            +
              const detail = await getDetailString();
         | 
| 1516 | 
            +
              const productNameLong = getProductNameLong();
         | 
| 1517 | 
            +
              const options = {
         | 
| 1518 | 
            +
                windowId,
         | 
| 1519 | 
            +
                message: productNameLong,
         | 
| 1520 | 
            +
                buttons: [copy(), ok()],
         | 
| 1521 | 
            +
                type: Info,
         | 
| 1522 | 
            +
                detail
         | 
| 1523 | 
            +
              };
         | 
| 1524 | 
            +
              const index = await showMessageBox(options);
         | 
| 1525 | 
            +
              switch (index) {
         | 
| 1526 | 
            +
                case 0:
         | 
| 1527 | 
            +
                  await writeText(detail);
         | 
| 1528 | 
            +
                  break;
         | 
| 1529 | 
            +
              }
         | 
| 1530 | 
            +
            };
         | 
| 1531 | 
            +
             | 
| 1475 1532 | 
             
            const commandMap = {
         | 
| 1476 1533 | 
             
              'About.focusNext': focusNext,
         | 
| 1477 1534 | 
             
              'About.focusPrevious': focusPrevious,
         | 
| @@ -1481,13 +1538,15 @@ const commandMap = { | |
| 1481 1538 | 
             
              'About.getVirtualDom': getAboutVirtualDom,
         | 
| 1482 1539 | 
             
              'About.loadContent': loadContent,
         | 
| 1483 1540 | 
             
              'About.render': doRender,
         | 
| 1484 | 
            -
              'About.renderEventListeners': renderEventListers
         | 
| 1541 | 
            +
              'About.renderEventListeners': renderEventListers,
         | 
| 1542 | 
            +
              'About.showAboutElectron': showAboutElectron
         | 
| 1485 1543 | 
             
            };
         | 
| 1486 1544 |  | 
| 1487 1545 | 
             
            const listen = async () => {
         | 
| 1488 | 
            -
              await WebWorkerRpcClient.create({
         | 
| 1546 | 
            +
              const rpc = await WebWorkerRpcClient.create({
         | 
| 1489 1547 | 
             
                commandMap: commandMap
         | 
| 1490 1548 | 
             
              });
         | 
| 1549 | 
            +
              setRpc(rpc);
         | 
| 1491 1550 | 
             
            };
         | 
| 1492 1551 |  | 
| 1493 1552 | 
             
            const main = async () => {
         |