@lvce-editor/about-view 4.15.0 → 4.17.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.
@@ -389,10 +389,10 @@ const create$4 = (method, params) => {
389
389
  };
390
390
  };
391
391
  const callbacks = Object.create(null);
392
- const set$1 = (id, fn) => {
392
+ const set$2 = (id, fn) => {
393
393
  callbacks[id] = fn;
394
394
  };
395
- const get$1 = id => {
395
+ const get$2 = id => {
396
396
  return callbacks[id];
397
397
  };
398
398
  const remove = id => {
@@ -408,7 +408,7 @@ const registerPromise = () => {
408
408
  resolve,
409
409
  promise
410
410
  } = Promise.withResolvers();
411
- set$1(id, resolve);
411
+ set$2(id, resolve);
412
412
  return {
413
413
  id,
414
414
  promise
@@ -565,7 +565,7 @@ const warn = (...args) => {
565
565
  console.warn(...args);
566
566
  };
567
567
  const resolve = (id, response) => {
568
- const fn = get$1(id);
568
+ const fn = get$2(id);
569
569
  if (!fn) {
570
570
  console.log(response);
571
571
  warn(`callback ${id} may already be disposed`);
@@ -604,7 +604,7 @@ const getErrorProperty = (error, prettyError) => {
604
604
  }
605
605
  };
606
606
  };
607
- const create$1 = (message, error) => {
607
+ const create$1$1 = (message, error) => {
608
608
  return {
609
609
  jsonrpc: Two,
610
610
  id: message.id,
@@ -615,7 +615,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
615
615
  const prettyError = preparePrettyError(error);
616
616
  logError(error, prettyError);
617
617
  const errorProperty = getErrorProperty(error, prettyError);
618
- return create$1(message, errorProperty);
618
+ return create$1$1(message, errorProperty);
619
619
  };
620
620
  const create$5 = (message, result) => {
621
621
  return {
@@ -790,7 +790,7 @@ const listen$1 = async (module, options) => {
790
790
  const ipc = module.wrap(rawIpc);
791
791
  return ipc;
792
792
  };
793
- const create = async ({
793
+ const create$1 = async ({
794
794
  commandMap
795
795
  }) => {
796
796
  // TODO create a commandMap per rpc instance
@@ -802,7 +802,28 @@ const create = async ({
802
802
  };
803
803
  const WebWorkerRpcClient = {
804
804
  __proto__: null,
805
- create
805
+ create: create$1
806
+ };
807
+
808
+ const states = Object.create(null);
809
+ const get$1 = uid => {
810
+ return states[uid];
811
+ };
812
+ const set$1 = (uid, oldState, newState) => {
813
+ states[uid] = {
814
+ oldState,
815
+ newState
816
+ };
817
+ };
818
+
819
+ const create = uid => {
820
+ const state = {
821
+ uid,
822
+ focusId: 0,
823
+ lines: [],
824
+ productName: ''
825
+ };
826
+ set$1(uid, state, state);
806
827
  };
807
828
 
808
829
  const RenderFocus = 2;
@@ -832,6 +853,15 @@ const diff = (oldState, newState) => {
832
853
  return diffResult;
833
854
  };
834
855
 
856
+ const diff2 = uid => {
857
+ const {
858
+ oldState,
859
+ newState
860
+ } = get$1(uid);
861
+ const diffResult = diff(oldState, newState);
862
+ return diffResult;
863
+ };
864
+
835
865
  const None = 0;
836
866
  const Ok$2 = 1;
837
867
  const Copy$2 = 2;
@@ -1467,6 +1497,20 @@ const handleFocusIn = async state => {
1467
1497
  return state;
1468
1498
  };
1469
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
+
1470
1514
  const loadContent = state => {
1471
1515
  const lines = getDetailStringWeb();
1472
1516
  return {
@@ -1556,6 +1600,16 @@ const applyRender = (oldState, newState, diffResult) => {
1556
1600
  return commands;
1557
1601
  };
1558
1602
 
1603
+ const doRender$1 = (uid, diffResult) => {
1604
+ const {
1605
+ oldState,
1606
+ newState
1607
+ } = get$1(uid);
1608
+ const commands = applyRender(oldState, newState, diffResult);
1609
+ set$1(uid, newState, newState);
1610
+ return commands;
1611
+ };
1612
+
1559
1613
  const doRender = (oldState, newState) => {
1560
1614
  const diffResult = diff(oldState, newState);
1561
1615
  return applyRender(oldState, newState, diffResult);
@@ -1645,23 +1699,28 @@ const showAbout = async platform => {
1645
1699
  };
1646
1700
 
1647
1701
  const commandMap = {
1648
- 'About.diff': diff,
1702
+ 'About.create': create,
1703
+ 'About.diff2': diff2,
1649
1704
  'About.focusNext': focusNext,
1650
1705
  'About.focusPrevious': focusPrevious,
1651
1706
  'About.getCommandIds': getCommandIds,
1652
- 'About.getDetailString': getDetailString,
1653
- 'About.getDetailStringWeb': getDetailStringWeb,
1654
1707
  'About.getKeyBindings': getKeyBindings,
1655
- 'About.getVirtualDom': getAboutVirtualDom,
1656
1708
  'About.handleClickClose': handleClickClose,
1657
1709
  'About.handleClickCopy': handleClickCopy,
1710
+ 'About.loadContent2': loadContent2,
1658
1711
  'About.handleClickOk': handleClickOk,
1659
1712
  'About.handleFocusIn': handleFocusIn,
1660
- 'About.loadContent': loadContent,
1661
- 'About.render': doRender,
1713
+ 'About.render2': doRender$1,
1662
1714
  'About.renderEventListeners': renderEventListeners,
1663
1715
  'About.showAbout': showAbout,
1664
- 'About.showAboutElectron': showAboutElectron
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
1665
1724
  };
1666
1725
 
1667
1726
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/about-view",
3
- "version": "4.15.0",
3
+ "version": "4.17.0",
4
4
  "description": "About View Worker",
5
5
  "keywords": [
6
6
  "about-view"