@lvce-editor/hover-worker 2.5.0 → 2.7.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.
@@ -64,7 +64,7 @@ const Object$1 = 1;
64
64
  const Number$1 = 2;
65
65
  const Array$1 = 3;
66
66
  const String = 4;
67
- const Boolean = 5;
67
+ const Boolean$1 = 5;
68
68
  const Function = 6;
69
69
  const Null = 7;
70
70
  const Unknown = 8;
@@ -85,7 +85,7 @@ const getType = value => {
85
85
  }
86
86
  return Object$1;
87
87
  case 'boolean':
88
- return Boolean;
88
+ return Boolean$1;
89
89
  default:
90
90
  return Unknown;
91
91
  }
@@ -1008,25 +1008,6 @@ const WebWorkerRpcClient = {
1008
1008
  __proto__: null,
1009
1009
  create: create$1$1
1010
1010
  };
1011
- const createMockRpc = ({
1012
- commandMap
1013
- }) => {
1014
- const invocations = [];
1015
- const invoke = (method, ...params) => {
1016
- invocations.push([method, ...params]);
1017
- const command = commandMap[method];
1018
- if (!command) {
1019
- throw new Error(`command ${method} not found`);
1020
- }
1021
- return command(...params);
1022
- };
1023
- const mockRpc = {
1024
- invocations,
1025
- invoke,
1026
- invokeAndTransfer: invoke
1027
- };
1028
- return mockRpc;
1029
- };
1030
1011
 
1031
1012
  const toCommandId = key => {
1032
1013
  const dotIndex = key.indexOf('.');
@@ -1113,12 +1094,28 @@ const terminate = () => {
1113
1094
  globalThis.close();
1114
1095
  };
1115
1096
 
1116
- const Text = 12;
1117
-
1118
1097
  const EditorWorker$1 = 99;
1119
1098
  const ExtensionHostWorker = 44;
1120
1099
 
1121
- const SetFocusContext = 'Viewlet.setFocusContext';
1100
+ const createMockRpc = ({
1101
+ commandMap
1102
+ }) => {
1103
+ const invocations = [];
1104
+ const invoke = (method, ...params) => {
1105
+ invocations.push([method, ...params]);
1106
+ const command = commandMap[method];
1107
+ if (!command) {
1108
+ throw new Error(`command ${method} not found`);
1109
+ }
1110
+ return command(...params);
1111
+ };
1112
+ const mockRpc = {
1113
+ invocations,
1114
+ invoke,
1115
+ invokeAndTransfer: invoke
1116
+ };
1117
+ return mockRpc;
1118
+ };
1122
1119
 
1123
1120
  const rpcs = Object.create(null);
1124
1121
  const set$5 = (id, rpc) => {
@@ -1781,20 +1778,30 @@ const renderEventListeners = state => {
1781
1778
  return [SetEventListeners, uid, eventListeners];
1782
1779
  };
1783
1780
 
1781
+ const Text = 12;
1782
+
1783
+ const SetFocusContext = 'Viewlet.setFocusContext';
1784
+
1784
1785
  const renderFocusContext = (oldState, newState) => {
1785
1786
  return [SetFocusContext, FocusEditorRename];
1786
1787
  };
1787
1788
 
1789
+ const EditorHover = 'EditorHover';
1788
1790
  const HoverDisplayString = 'HoverDisplayString';
1789
1791
  const HoverDocumentation = 'HoverDocumentation';
1790
1792
  const HoverEditorRow = 'HoverEditorRow';
1791
1793
  const HoverProblem = 'HoverProblem';
1792
1794
  const HoverProblemDetail = 'HoverProblemDetail';
1793
1795
  const HoverProblemMessage = 'HoverProblemMessage';
1796
+ const Viewlet = 'Viewlet';
1794
1797
 
1795
1798
  const Div = 4;
1796
1799
  const Span = 8;
1797
1800
 
1801
+ const mergeClassNames = (...classNames) => {
1802
+ return classNames.filter(Boolean).join(' ');
1803
+ };
1804
+
1798
1805
  const text = data => {
1799
1806
  return {
1800
1807
  childCount: 0,
@@ -1837,6 +1844,11 @@ const hoverProblemDetail = {
1837
1844
  className: HoverProblemDetail,
1838
1845
  type: Span
1839
1846
  };
1847
+ const hoverDocumentation = {
1848
+ childCount: 1,
1849
+ className: HoverDocumentation,
1850
+ type: Div
1851
+ };
1840
1852
  const getChildCount = (lineInfos, documentation, diagnostics) => {
1841
1853
  const diagnosticsCount = diagnostics && diagnostics.length > 0 ? 1 : 0;
1842
1854
  return lineInfos.length + documentation ? 1 : 0 + diagnosticsCount;
@@ -1845,13 +1857,13 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
1845
1857
  const dom = [];
1846
1858
  dom.push({
1847
1859
  childCount: getChildCount(lineInfos, documentation, diagnostics) + 1,
1848
- className: 'Viewlet EditorHover',
1860
+ className: mergeClassNames(Viewlet, EditorHover),
1849
1861
  type: Div
1850
1862
  });
1851
1863
  if (diagnostics && diagnostics.length > 0) {
1852
1864
  dom.push({
1853
1865
  childCount: diagnostics.length * 2,
1854
- className: `${HoverDisplayString} ${HoverProblem}`,
1866
+ className: mergeClassNames(HoverDisplayString, HoverProblem),
1855
1867
  type: Div
1856
1868
  });
1857
1869
  for (const diagnostic of diagnostics) {
@@ -1867,15 +1879,11 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
1867
1879
  }, ...lineInfosDom);
1868
1880
  }
1869
1881
  if (documentation) {
1870
- dom.push({
1871
- childCount: 1,
1872
- className: HoverDocumentation,
1873
- type: Div
1874
- }, text(documentation));
1882
+ dom.push(hoverDocumentation, text(documentation));
1875
1883
  }
1876
1884
  dom.push({
1877
1885
  childCount: 0,
1878
- className: 'Sash SashVertical SashResize',
1886
+ className: mergeClassNames('Sash', 'SashVertical', 'SashResize'),
1879
1887
  onPointerDown: HandleSashPointerDown,
1880
1888
  type: Div
1881
1889
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/hover-worker",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",