@lvce-editor/about-view 4.9.0 → 4.11.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.
@@ -831,6 +831,7 @@ const DiffFocus = {
831
831
  };
832
832
 
833
833
  const modules = [DiffAbout, DiffFocus];
834
+
834
835
  const diff = (oldState, newState) => {
835
836
  const diffResult = [];
836
837
  for (const module of modules) {
@@ -1273,7 +1274,7 @@ const DialogContentRight = 'DialogContentRight';
1273
1274
  const DialogHeading$1 = 'DialogHeading';
1274
1275
  const DialogMessage = 'DialogMessage';
1275
1276
  const DialogMessageRow = 'DialogMessageRow';
1276
- const About = 'About';
1277
+ const About$1 = 'About';
1277
1278
  const Viewlet = 'Viewlet';
1278
1279
  const DialogToolBarRow = 'DialogToolBarRow';
1279
1280
  const MaskIcon = 'MaskIcon';
@@ -1418,7 +1419,7 @@ const getAboutVirtualDom = (productName, lines, closeMessage, okMessage, copyMes
1418
1419
  const content = getAboutContentVirtualDom(lines);
1419
1420
  return [{
1420
1421
  type: Div,
1421
- className: mergeClassNames(Viewlet, About),
1422
+ className: mergeClassNames(Viewlet, About$1),
1422
1423
  onContextMenu: HandleContextMenu,
1423
1424
  childCount: 1
1424
1425
  }, ...getDialogVirtualDom(content, closeMessage, infoMessage, okMessage, copyMessage, productName)];
@@ -1508,6 +1509,31 @@ const closeDialog = () => {
1508
1509
  return i18nString(CloseDialog);
1509
1510
  };
1510
1511
 
1512
+ const createViewModel = state => {
1513
+ const okMessage = ok();
1514
+ const copyMessage = copy();
1515
+ const closeMessage = closeDialog();
1516
+ const infoMessage = info();
1517
+ const {
1518
+ productName,
1519
+ lines
1520
+ } = state;
1521
+ return {
1522
+ productName,
1523
+ lines,
1524
+ closeMessage,
1525
+ okMessage,
1526
+ copyMessage,
1527
+ infoMessage
1528
+ };
1529
+ };
1530
+
1531
+ const renderDialog = (oldState, newState) => {
1532
+ const viewModel = createViewModel(newState);
1533
+ const dom = getAboutVirtualDom(viewModel.productName, viewModel.lines, viewModel.closeMessage, viewModel.okMessage, viewModel.copyMessage, viewModel.infoMessage);
1534
+ return ['Viewlet.setDom2', dom];
1535
+ };
1536
+
1511
1537
  const getFocusSelector = focusId => {
1512
1538
  switch (focusId) {
1513
1539
  case Copy$2:
@@ -1519,18 +1545,11 @@ const getFocusSelector = focusId => {
1519
1545
  }
1520
1546
  };
1521
1547
 
1522
- const renderDialog = (oldState, newState) => {
1523
- const okMessage = ok();
1524
- const copyMessage = copy();
1525
- const closeMessage = closeDialog();
1526
- const infoMessage = info();
1527
- const dom = getAboutVirtualDom(newState.productName, newState.lines, closeMessage, okMessage, copyMessage, infoMessage);
1528
- return ['Viewlet.setDom2', dom];
1529
- };
1530
1548
  const renderFocus = (oldState, newState) => {
1531
1549
  const name = getFocusSelector(newState.focusId);
1532
1550
  return ['Viewlet.focusElementByName', name];
1533
1551
  };
1552
+
1534
1553
  const getRenderer = diffType => {
1535
1554
  switch (diffType) {
1536
1555
  case RenderAbout:
@@ -1576,6 +1595,14 @@ const renderEventListeners = () => {
1576
1595
  }];
1577
1596
  };
1578
1597
 
1598
+ const Electron = 2;
1599
+
1600
+ const About = 'About';
1601
+
1602
+ const showAboutDefault = async () => {
1603
+ await invoke('Viewlet.openWidget', About);
1604
+ };
1605
+
1579
1606
  const getWindowId = async () => {
1580
1607
  return invoke('GetWindowId.getWindowId');
1581
1608
  };
@@ -1617,6 +1644,20 @@ const showAboutElectron = async () => {
1617
1644
  }
1618
1645
  };
1619
1646
 
1647
+ const getAboutHandler = platform => {
1648
+ switch (platform) {
1649
+ case Electron:
1650
+ return showAboutElectron;
1651
+ default:
1652
+ return showAboutDefault;
1653
+ }
1654
+ };
1655
+
1656
+ const showAbout = async platform => {
1657
+ const fn = getAboutHandler(platform);
1658
+ await fn();
1659
+ };
1660
+
1620
1661
  const commandMap = {
1621
1662
  'About.diff': diff,
1622
1663
  'About.focusNext': focusNext,
@@ -1633,6 +1674,7 @@ const commandMap = {
1633
1674
  'About.loadContent': loadContent,
1634
1675
  'About.render': doRender,
1635
1676
  'About.renderEventListeners': renderEventListeners,
1677
+ 'About.showAbout': showAbout,
1636
1678
  'About.showAboutElectron': showAboutElectron
1637
1679
  };
1638
1680
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "4.9.0",
3
+ "version": "4.11.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"