@lvce-editor/extension-search-view 4.0.0 → 4.3.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.
@@ -427,7 +427,7 @@ const create$4 = (method, params) => {
427
427
  };
428
428
  };
429
429
  const callbacks = Object.create(null);
430
- const set$2 = (id, fn) => {
430
+ const set$4 = (id, fn) => {
431
431
  callbacks[id] = fn;
432
432
  };
433
433
  const get$2 = id => {
@@ -446,7 +446,7 @@ const registerPromise = () => {
446
446
  resolve,
447
447
  promise
448
448
  } = Promise.withResolvers();
449
- set$2(id, resolve);
449
+ set$4(id, resolve);
450
450
  return {
451
451
  id,
452
452
  promise
@@ -526,7 +526,8 @@ const splitLines = lines => {
526
526
  return lines.split(NewLine);
527
527
  };
528
528
  const getCurrentStack = () => {
529
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
529
+ const stackLinesToSkip = 3;
530
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
530
531
  return currentStack;
531
532
  };
532
533
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -790,13 +791,19 @@ const send = (transport, method, ...params) => {
790
791
  const message = create$4(method, params);
791
792
  transport.send(message);
792
793
  };
793
- const invoke$1 = (ipc, method, ...params) => {
794
+ const invoke$2 = (ipc, method, ...params) => {
794
795
  return invokeHelper(ipc, method, params, false);
795
796
  };
796
- const invokeAndTransfer = (ipc, method, ...params) => {
797
+ const invokeAndTransfer$1 = (ipc, method, ...params) => {
797
798
  return invokeHelper(ipc, method, params, true);
798
799
  };
799
800
 
801
+ class CommandNotFoundError extends Error {
802
+ constructor(command) {
803
+ super(`Command not found ${command}`);
804
+ this.name = 'CommandNotFoundError';
805
+ }
806
+ }
800
807
  const commands = Object.create(null);
801
808
  const register = commandMap => {
802
809
  Object.assign(commands, commandMap);
@@ -807,7 +814,7 @@ const getCommand = key => {
807
814
  const execute = (command, ...args) => {
808
815
  const fn = getCommand(command);
809
816
  if (!fn) {
810
- throw new Error(`command not found ${command}`);
817
+ throw new CommandNotFoundError(command);
811
818
  }
812
819
  return fn(...args);
813
820
  };
@@ -823,10 +830,10 @@ const createRpc = ipc => {
823
830
  send(ipc, method, ...params);
824
831
  },
825
832
  invoke(method, ...params) {
826
- return invoke$1(ipc, method, ...params);
833
+ return invoke$2(ipc, method, ...params);
827
834
  },
828
835
  invokeAndTransfer(method, ...params) {
829
- return invokeAndTransfer(ipc, method, ...params);
836
+ return invokeAndTransfer$1(ipc, method, ...params);
830
837
  },
831
838
  async dispose() {
832
839
  await ipc?.dispose();
@@ -878,9 +885,33 @@ const WebWorkerRpcClient = {
878
885
  __proto__: null,
879
886
  create: create$3
880
887
  };
888
+ const createMockRpc = ({
889
+ commandMap
890
+ }) => {
891
+ const invocations = [];
892
+ const invoke = (method, ...params) => {
893
+ invocations.push([method, ...params]);
894
+ const command = commandMap[method];
895
+ if (!command) {
896
+ throw new Error(`command ${method} not found`);
897
+ }
898
+ return command(...params);
899
+ };
900
+ const mockRpc = {
901
+ invoke,
902
+ invokeAndTransfer: invoke,
903
+ invocations
904
+ };
905
+ return mockRpc;
906
+ };
881
907
 
908
+ const toCommandId$1 = key => {
909
+ const dotIndex = key.indexOf('.');
910
+ return key.slice(dotIndex + 1);
911
+ };
882
912
  const create$2 = () => {
883
913
  const states = Object.create(null);
914
+ const commandMapRef = {};
884
915
  return {
885
916
  get(uid) {
886
917
  return states[uid];
@@ -921,6 +952,15 @@ const create$2 = () => {
921
952
  };
922
953
  return wrapped;
923
954
  },
955
+ wrapGetter(fn) {
956
+ const wrapped = (uid, ...args) => {
957
+ const {
958
+ newState
959
+ } = states[uid];
960
+ return fn(newState, ...args);
961
+ };
962
+ return wrapped;
963
+ },
924
964
  diff(uid, modules, numbers) {
925
965
  const {
926
966
  oldState,
@@ -934,6 +974,14 @@ const create$2 = () => {
934
974
  }
935
975
  }
936
976
  return diffResult;
977
+ },
978
+ getCommandIds() {
979
+ const keys = Object.keys(commandMapRef);
980
+ const ids = keys.map(toCommandId$1);
981
+ return ids;
982
+ },
983
+ registerCommands(commandMap) {
984
+ Object.assign(commandMapRef, commandMap);
937
985
  }
938
986
  };
939
987
  };
@@ -1009,7 +1057,7 @@ const viewsAndMoreActions = () => {
1009
1057
  };
1010
1058
 
1011
1059
  const None$3 = 0;
1012
- const Input = 1;
1060
+ const Input$1 = 1;
1013
1061
  const List$2 = 2;
1014
1062
 
1015
1063
  const getFinalDeltaY = (height, itemHeight, itemsLength) => {
@@ -1043,6 +1091,9 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1043
1091
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1044
1092
  };
1045
1093
 
1094
+ const User = 1;
1095
+ const Script = 2;
1096
+
1046
1097
  const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
1047
1098
  const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
1048
1099
  return scrollBarOffset;
@@ -1128,7 +1179,7 @@ const matchesParsedValue = (extension, parsedValue) => {
1128
1179
  };
1129
1180
 
1130
1181
  const toSorted = (array, compare) => {
1131
- return [...array].sort(compare);
1182
+ return array.toSorted(compare);
1132
1183
  };
1133
1184
 
1134
1185
  const compareExtension = (extensionA, extensionB) => {
@@ -1161,7 +1212,7 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
1161
1212
  };
1162
1213
 
1163
1214
  // TODO debounce
1164
- const handleInput = async (state, value) => {
1215
+ const handleInput = async (state, value, inputSource = User) => {
1165
1216
  try {
1166
1217
  const {
1167
1218
  allExtensions,
@@ -1181,14 +1232,15 @@ const handleInput = async (state, value) => {
1181
1232
  allExtensions,
1182
1233
  deltaY: 0,
1183
1234
  finalDeltaY: 0,
1184
- focus: Input,
1235
+ focus: Input$1,
1185
1236
  items,
1186
1237
  maxLineY: 0,
1187
1238
  message: noExtensionsFound(),
1188
1239
  minLineY: 0,
1189
1240
  placeholder: searchExtensionsInMarketPlace(),
1190
1241
  scrollBarHeight: 0,
1191
- searchValue: value
1242
+ searchValue: value,
1243
+ inputSource
1192
1244
  };
1193
1245
  }
1194
1246
  const total = items.length;
@@ -1211,7 +1263,8 @@ const handleInput = async (state, value) => {
1211
1263
  placeholder: searchExtensionsInMarketPlace(),
1212
1264
  scrollBarHeight,
1213
1265
  scrollBarY,
1214
- searchValue: value
1266
+ searchValue: value,
1267
+ inputSource
1215
1268
  };
1216
1269
 
1217
1270
  // TODO handle out of order responses (a bit complicated)
@@ -1237,9 +1290,10 @@ const closeSuggest = state => {
1237
1290
 
1238
1291
  const {
1239
1292
  get: get$1,
1240
- set: set$1,
1241
- dispose: dispose$1,
1242
- wrapCommand
1293
+ set: set$3,
1294
+ dispose: dispose$2,
1295
+ wrapCommand,
1296
+ wrapGetter
1243
1297
  } = create$2();
1244
1298
 
1245
1299
  const create$1 = (id, uri, x, y, width, height, platform, assetDir) => {
@@ -1275,7 +1329,7 @@ const create$1 = (id, uri, x, y, width, height, platform, assetDir) => {
1275
1329
  x,
1276
1330
  y
1277
1331
  };
1278
- set$1(id, state, state);
1332
+ set$3(id, state, state);
1279
1333
  };
1280
1334
 
1281
1335
  const isEqual$2 = (oldState, newState) => {
@@ -1289,9 +1343,6 @@ const isEqual$1 = (oldState, newState) => {
1289
1343
  return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.deltaY === newState.deltaY && oldState.focusedIndex === newState.focusedIndex && oldState.message === newState.message && oldState.inputActions === newState.inputActions && oldState.placeholder === newState.placeholder;
1290
1344
  };
1291
1345
 
1292
- const User = 1;
1293
- const Script = 2;
1294
-
1295
1346
  const isEqual = (oldState, newState) => {
1296
1347
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1297
1348
  };
@@ -1322,8 +1373,8 @@ const diff2 = uid => {
1322
1373
  return diffResult;
1323
1374
  };
1324
1375
 
1325
- const dispose = uid => {
1326
- dispose$1(uid);
1376
+ const dispose$1 = uid => {
1377
+ dispose$2(uid);
1327
1378
  };
1328
1379
 
1329
1380
  // TODO optimize this function to return the minimum number
@@ -1539,7 +1590,7 @@ const CtrlCmd = 1 << 11 >>> 0;
1539
1590
  const FocusExtensions = 15;
1540
1591
  const FocusExtensionsInput = 7000;
1541
1592
 
1542
- const getKeyBindings = () => {
1593
+ const getKeyBindings$1 = () => {
1543
1594
  return [{
1544
1595
  key: Home,
1545
1596
  command: 'Extensions.focusFirst',
@@ -1625,16 +1676,25 @@ const getExtensionDetailUri = extensionId => {
1625
1676
  return `extension-detail://${extensionId}`;
1626
1677
  };
1627
1678
 
1679
+ const None$1 = 'none';
1680
+
1681
+ const Button = 1;
1682
+ const Div = 4;
1683
+ const Input = 6;
1684
+ const Text = 12;
1685
+ const Img = 17;
1686
+
1687
+ const DebugWorker = 55;
1688
+ const RendererWorker$1 = 1;
1689
+
1628
1690
  const rpcs = Object.create(null);
1629
- const set$g = (id, rpc) => {
1691
+ const set$2 = (id, rpc) => {
1630
1692
  rpcs[id] = rpc;
1631
1693
  };
1632
1694
  const get = id => {
1633
1695
  return rpcs[id];
1634
1696
  };
1635
1697
 
1636
- /* eslint-disable @typescript-eslint/explicit-function-return-type */
1637
-
1638
1698
  const create = rpcId => {
1639
1699
  return {
1640
1700
  // @ts-ignore
@@ -1650,7 +1710,7 @@ const create = rpcId => {
1650
1710
  return rpc.invokeAndTransfer(method, ...params);
1651
1711
  },
1652
1712
  set(rpc) {
1653
- set$g(rpcId, rpc);
1713
+ set$2(rpcId, rpc);
1654
1714
  },
1655
1715
  async dispose() {
1656
1716
  const rpc = get(rpcId);
@@ -1658,22 +1718,361 @@ const create = rpcId => {
1658
1718
  }
1659
1719
  };
1660
1720
  };
1661
- const RendererWorker$1 = 1;
1721
+
1662
1722
  const {
1663
- invoke: invoke$3,
1664
- set: set$3} = create(RendererWorker$1);
1723
+ invoke: invoke$1,
1724
+ invokeAndTransfer,
1725
+ set: set$1,
1726
+ dispose
1727
+ } = create(RendererWorker$1);
1728
+ const searchFileHtml = async uri => {
1729
+ return invoke$1('ExtensionHost.searchFileWithHtml', uri);
1730
+ };
1731
+ const getFilePathElectron = async file => {
1732
+ return invoke$1('FileSystemHandle.getFilePathElectron', file);
1733
+ };
1665
1734
  const showContextMenu$1 = async (x, y, id, ...args) => {
1666
- return invoke$3('ContextMenu.show', x, y, id, ...args);
1735
+ return invoke$1('ContextMenu.show', x, y, id, ...args);
1736
+ };
1737
+ const getElectronVersion = async () => {
1738
+ return invoke$1('Process.getElectronVersion');
1739
+ };
1740
+ const applyBulkReplacement = async bulkEdits => {
1741
+ await invoke$1('BulkReplacement.applyBulkReplacement', bulkEdits);
1742
+ };
1743
+ const setColorTheme = async id => {
1744
+ // @ts-ignore
1745
+ return invoke$1(/* ColorTheme.setColorTheme */'ColorTheme.setColorTheme', /* colorThemeId */id);
1746
+ };
1747
+ const getNodeVersion = async () => {
1748
+ return invoke$1('Process.getNodeVersion');
1749
+ };
1750
+ const getChromeVersion = async () => {
1751
+ return invoke$1('Process.getChromeVersion');
1752
+ };
1753
+ const getV8Version = async () => {
1754
+ return invoke$1('Process.getV8Version');
1755
+ };
1756
+ const getFileHandles = async fileIds => {
1757
+ const files = await invoke$1('FileSystemHandle.getFileHandles', fileIds);
1758
+ return files;
1759
+ };
1760
+ const setWorkspacePath = async path => {
1761
+ await invoke$1('Workspace.setPath', path);
1762
+ };
1763
+ const registerWebViewInterceptor = async (id, port) => {
1764
+ await invokeAndTransfer('WebView.registerInterceptor', id, port);
1765
+ };
1766
+ const unregisterWebViewInterceptor = async id => {
1767
+ await invoke$1('WebView.unregisterInterceptor', id);
1768
+ };
1769
+ const sendMessagePortToEditorWorker = async (port, rpcId) => {
1770
+ const command = 'HandleMessagePort.handleMessagePort';
1771
+ // @ts-ignore
1772
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToEditorWorker', port, command, rpcId);
1773
+ };
1774
+ const sendMessagePortToErrorWorker = async (port, rpcId) => {
1775
+ const command = 'Errors.handleMessagePort';
1776
+ // @ts-ignore
1777
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
1778
+ };
1779
+ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1780
+ const command = 'Markdown.handleMessagePort';
1781
+ // @ts-ignore
1782
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1783
+ };
1784
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1785
+ const command = 'IconTheme.handleMessagePort';
1786
+ // @ts-ignore
1787
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1788
+ };
1789
+ const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1790
+ const command = 'FileSystem.handleMessagePort';
1791
+ // @ts-ignore
1792
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToFileSystemWorker', port, command, rpcId);
1793
+ };
1794
+ const readFile = async uri => {
1795
+ return invoke$1('FileSystem.readFile', uri);
1796
+ };
1797
+ const getWebViewSecret = async key => {
1798
+ // @ts-ignore
1799
+ return invoke$1('WebView.getSecret', key);
1800
+ };
1801
+ const setWebViewPort = async (uid, port, origin, portType) => {
1802
+ return invokeAndTransfer('WebView.setPort', uid, port, origin, portType);
1803
+ };
1804
+ const setFocus = key => {
1805
+ return invoke$1('Focus.setFocus', key);
1806
+ };
1807
+ const getFileIcon = async options => {
1808
+ return invoke$1('IconTheme.getFileIcon', options);
1809
+ };
1810
+ const getColorThemeNames = async () => {
1811
+ return invoke$1('ColorTheme.getColorThemeNames');
1812
+ };
1813
+ const disableExtension = async id => {
1814
+ // @ts-ignore
1815
+ return invoke$1('ExtensionManagement.disable', id);
1816
+ };
1817
+ const enableExtension = async id => {
1818
+ // @ts-ignore
1819
+ return invoke$1('ExtensionManagement.enable', id);
1820
+ };
1821
+ const handleDebugChange = async params => {
1822
+ // @ts-ignore
1823
+ return invoke$1('Run And Debug.handleChange', params);
1824
+ };
1825
+ const getFolderIcon = async options => {
1826
+ return invoke$1('IconTheme.getFolderIcon', options);
1827
+ };
1828
+ const closeWidget = async widgetId => {
1829
+ return invoke$1('Viewlet.closeWidget', widgetId);
1830
+ };
1831
+ const sendMessagePortToExtensionHostWorker = async (port, rpcId = 0) => {
1832
+ const command = 'HandleMessagePort.handleMessagePort2';
1833
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', port, command, rpcId);
1834
+ };
1835
+ const sendMessagePortToSearchProcess = async port => {
1836
+ await invokeAndTransfer('SendMessagePortToElectron.sendMessagePortToElectron', port, 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess');
1837
+ };
1838
+ const confirm = async (message, options) => {
1839
+ // @ts-ignore
1840
+ const result = await invoke$1('ConfirmPrompt.prompt', message, options);
1841
+ return result;
1842
+ };
1843
+ const getRecentlyOpened = async () => {
1844
+ return invoke$1(/* RecentlyOpened.getRecentlyOpened */'RecentlyOpened.getRecentlyOpened');
1845
+ };
1846
+ const getKeyBindings = async () => {
1847
+ return invoke$1('KeyBindingsInitial.getKeyBindings');
1848
+ };
1849
+ const writeClipBoardText = async text => {
1850
+ await invoke$1('ClipBoard.writeText', /* text */text);
1851
+ };
1852
+ const writeClipBoardImage = async blob => {
1853
+ // @ts-ignore
1854
+ await invoke$1('ClipBoard.writeImage', /* text */blob);
1855
+ };
1856
+ const searchFileMemory = async uri => {
1857
+ // @ts-ignore
1858
+ return invoke$1('ExtensionHost.searchFileWithMemory', uri);
1859
+ };
1860
+ const searchFileFetch = async uri => {
1861
+ return invoke$1('ExtensionHost.searchFileWithFetch', uri);
1862
+ };
1863
+ const showMessageBox = async options => {
1864
+ return invoke$1('ElectronDialog.showMessageBox', options);
1865
+ };
1866
+ const handleDebugResumed = async params => {
1867
+ await invoke$1('Run And Debug.handleResumed', params);
1868
+ };
1869
+ const openWidget = async name => {
1870
+ await invoke$1('Viewlet.openWidget', name);
1871
+ };
1872
+ const getIcons = async requests => {
1873
+ const icons = await invoke$1('IconTheme.getIcons', requests);
1874
+ return icons;
1875
+ };
1876
+ const activateByEvent = event => {
1877
+ return invoke$1('ExtensionHostManagement.activateByEvent', event);
1878
+ };
1879
+ const setAdditionalFocus = focusKey => {
1880
+ // @ts-ignore
1881
+ return invoke$1('Focus.setAdditionalFocus', focusKey);
1882
+ };
1883
+ const getActiveEditorId = () => {
1884
+ // @ts-ignore
1885
+ return invoke$1('GetActiveEditor.getActiveEditorId');
1886
+ };
1887
+ const getWorkspacePath = () => {
1888
+ return invoke$1('Workspace.getPath');
1889
+ };
1890
+ const sendMessagePortToRendererProcess = async port => {
1891
+ const command = 'HandleMessagePort.handleMessagePort';
1892
+ // @ts-ignore
1893
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToRendererProcess', port, command, DebugWorker);
1894
+ };
1895
+ const getPreference = async key => {
1896
+ return await invoke$1('Preferences.get', key);
1897
+ };
1898
+ const getAllExtensions$2 = async () => {
1899
+ return invoke$1('ExtensionManagement.getAllExtensions');
1900
+ };
1901
+ const rerenderEditor = async key => {
1902
+ // @ts-ignore
1903
+ return invoke$1('Editor.rerender', key);
1904
+ };
1905
+ const handleDebugPaused = async params => {
1906
+ await invoke$1('Run And Debug.handlePaused', params);
1667
1907
  };
1668
1908
  const openUri$2 = async (uri, focus, options) => {
1669
- await invoke$3('Main.openUri', uri, focus, options);
1909
+ await invoke$1('Main.openUri', uri, focus, options);
1910
+ };
1911
+ const sendMessagePortToSyntaxHighlightingWorker = async port => {
1912
+ await invokeAndTransfer(
1913
+ // @ts-ignore
1914
+ 'SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
1915
+ };
1916
+ const handleDebugScriptParsed = async script => {
1917
+ await invoke$1('Run And Debug.handleScriptParsed', script);
1918
+ };
1919
+ const getWindowId = async () => {
1920
+ return invoke$1('GetWindowId.getWindowId');
1921
+ };
1922
+ const getBlob = async uri => {
1923
+ // @ts-ignore
1924
+ return invoke$1('FileSystem.getBlob', uri);
1925
+ };
1926
+ const getExtensionCommands = async () => {
1927
+ return invoke$1('ExtensionHost.getCommands');
1928
+ };
1929
+ const showErrorDialog = async errorInfo => {
1930
+ // @ts-ignore
1931
+ await invoke$1('ErrorHandling.showErrorDialog', errorInfo);
1932
+ };
1933
+ const getFolderSize = async uri => {
1934
+ // @ts-ignore
1935
+ return await invoke$1('FileSystem.getFolderSize', uri);
1936
+ };
1937
+ const getExtension = async id => {
1938
+ // @ts-ignore
1939
+ return invoke$1('ExtensionManagement.getExtension', id);
1940
+ };
1941
+ const getMarkdownDom = async html => {
1942
+ // @ts-ignore
1943
+ return invoke$1('Markdown.getVirtualDom', html);
1670
1944
  };
1945
+ const renderMarkdown = async (markdown, options) => {
1946
+ // @ts-ignore
1947
+ return invoke$1('Markdown.renderMarkdown', markdown, options);
1948
+ };
1949
+ const openNativeFolder = async uri => {
1950
+ // @ts-ignore
1951
+ await invoke$1('OpenNativeFolder.openNativeFolder', uri);
1952
+ };
1953
+ const uninstallExtension = async id => {
1954
+ return invoke$1('ExtensionManagement.uninstall', id);
1955
+ };
1956
+ const installExtension = async id => {
1957
+ // @ts-ignore
1958
+ return invoke$1('ExtensionManagement.install', id);
1959
+ };
1960
+ const openExtensionSearch = async () => {
1961
+ // @ts-ignore
1962
+ return invoke$1('SideBar.openViewlet', 'Extensions');
1963
+ };
1964
+ const setExtensionsSearchValue = async searchValue => {
1965
+ // @ts-ignore
1966
+ return invoke$1('Extensions.handleInput', searchValue);
1967
+ };
1968
+ const openExternal = async uri => {
1969
+ // @ts-ignore
1970
+ await invoke$1('Open.openExternal', uri);
1971
+ };
1972
+ const openUrl = async uri => {
1973
+ // @ts-ignore
1974
+ await invoke$1('Open.openUrl', uri);
1975
+ };
1976
+ const getAllPreferences = async () => {
1977
+ // @ts-ignore
1978
+ return invoke$1('Preferences.getAll');
1979
+ };
1980
+ const showSaveFilePicker = async () => {
1981
+ // @ts-ignore
1982
+ return invoke$1('FilePicker.showSaveFilePicker');
1983
+ };
1984
+ const getLogsDir = async () => {
1985
+ // @ts-ignore
1986
+ return invoke$1('PlatformPaths.getLogsDir');
1987
+ };
1988
+ const registerMockRpc = commandMap => {
1989
+ const mockRpc = createMockRpc({
1990
+ commandMap
1991
+ });
1992
+ set$1(mockRpc);
1993
+ return mockRpc;
1994
+ };
1995
+
1671
1996
  const RendererWorker = {
1672
1997
  __proto__: null,
1673
- invoke: invoke$3,
1998
+ activateByEvent,
1999
+ applyBulkReplacement,
2000
+ closeWidget,
2001
+ confirm,
2002
+ disableExtension,
2003
+ dispose,
2004
+ enableExtension,
2005
+ getActiveEditorId,
2006
+ getAllExtensions: getAllExtensions$2,
2007
+ getAllPreferences,
2008
+ getBlob,
2009
+ getChromeVersion,
2010
+ getColorThemeNames,
2011
+ getElectronVersion,
2012
+ getExtension,
2013
+ getExtensionCommands,
2014
+ getFileHandles,
2015
+ getFileIcon,
2016
+ getFilePathElectron,
2017
+ getFolderIcon,
2018
+ getFolderSize,
2019
+ getIcons,
2020
+ getKeyBindings,
2021
+ getLogsDir,
2022
+ getMarkdownDom,
2023
+ getNodeVersion,
2024
+ getPreference,
2025
+ getRecentlyOpened,
2026
+ getV8Version,
2027
+ getWebViewSecret,
2028
+ getWindowId,
2029
+ getWorkspacePath,
2030
+ handleDebugChange,
2031
+ handleDebugPaused,
2032
+ handleDebugResumed,
2033
+ handleDebugScriptParsed,
2034
+ installExtension,
2035
+ invoke: invoke$1,
2036
+ invokeAndTransfer,
2037
+ openExtensionSearch,
2038
+ openExternal,
2039
+ openNativeFolder,
1674
2040
  openUri: openUri$2,
1675
- set: set$3,
1676
- showContextMenu: showContextMenu$1};
2041
+ openUrl,
2042
+ openWidget,
2043
+ readFile,
2044
+ registerMockRpc,
2045
+ registerWebViewInterceptor,
2046
+ renderMarkdown,
2047
+ rerenderEditor,
2048
+ searchFileFetch,
2049
+ searchFileHtml,
2050
+ searchFileMemory,
2051
+ sendMessagePortToEditorWorker,
2052
+ sendMessagePortToErrorWorker,
2053
+ sendMessagePortToExtensionHostWorker,
2054
+ sendMessagePortToFileSystemWorker,
2055
+ sendMessagePortToIconThemeWorker,
2056
+ sendMessagePortToMarkdownWorker,
2057
+ sendMessagePortToRendererProcess,
2058
+ sendMessagePortToSearchProcess,
2059
+ sendMessagePortToSyntaxHighlightingWorker,
2060
+ set: set$1,
2061
+ setAdditionalFocus,
2062
+ setColorTheme,
2063
+ setExtensionsSearchValue,
2064
+ setFocus,
2065
+ setWebViewPort,
2066
+ setWorkspacePath,
2067
+ showContextMenu: showContextMenu$1,
2068
+ showErrorDialog,
2069
+ showMessageBox,
2070
+ showSaveFilePicker,
2071
+ uninstallExtension,
2072
+ unregisterWebViewInterceptor,
2073
+ writeClipBoardImage,
2074
+ writeClipBoardText
2075
+ };
1677
2076
 
1678
2077
  const {
1679
2078
  invoke,
@@ -2126,7 +2525,7 @@ const Extensions$1 = 'extensions';
2126
2525
 
2127
2526
  const getSelector = focus => {
2128
2527
  switch (focus) {
2129
- case Input:
2528
+ case Input$1:
2130
2529
  return `[name="${Extensions$1}"]`;
2131
2530
  case List$2:
2132
2531
  return '.ListItems';
@@ -2147,15 +2546,30 @@ const renderFocus = newState => {
2147
2546
  };
2148
2547
 
2149
2548
  const renderFocusContext = newState => {
2150
- if (newState.focus === Input) {
2151
- return ['Viewlet.setFocusContext', FocusExtensionsInput];
2549
+ const {
2550
+ uid
2551
+ } = newState;
2552
+ if (newState.focus === Input$1) {
2553
+ return ['Viewlet.setFocusContext', uid, FocusExtensionsInput];
2152
2554
  }
2153
2555
  if (newState.focus === List$2) {
2154
- return ['Viewlet.setFocusContext', FocusExtensions];
2556
+ return ['Viewlet.setFocusContext', uid, FocusExtensions];
2155
2557
  }
2156
2558
  return [];
2157
2559
  };
2158
2560
 
2561
+ const mergeClassNames = (...classNames) => {
2562
+ return classNames.filter(Boolean).join(' ');
2563
+ };
2564
+
2565
+ const text = data => {
2566
+ return {
2567
+ type: Text,
2568
+ text: data,
2569
+ childCount: 0
2570
+ };
2571
+ };
2572
+
2159
2573
  const Actions = 'Actions';
2160
2574
  const ExtensionActions = 'ExtensionActions';
2161
2575
  const ExtensionActive = 'ExtensionActive';
@@ -2186,39 +2600,15 @@ const Viewlet = 'Viewlet';
2186
2600
 
2187
2601
  const List = 'list';
2188
2602
  const ListItem = 'listitem';
2189
- const None$1 = 'none';
2190
- const ToolBar = 'toolbar';
2191
-
2192
2603
  const None = 'none';
2193
- const AriaRoles = {
2194
- __proto__: null,
2195
- None};
2196
- const mergeClassNames = (...classNames) => {
2197
- return classNames.filter(Boolean).join(' ');
2198
- };
2199
- const Div$1 = 4;
2200
- const Text = 12;
2201
- const VirtualDomElements = {
2202
- __proto__: null,
2203
- Div: Div$1};
2204
- const text = data => {
2205
- return {
2206
- type: Text,
2207
- text: data,
2208
- childCount: 0
2209
- };
2210
- };
2211
-
2212
- const Div = 4;
2213
- const Img = 17;
2214
- const TextArea = 62;
2215
- const Button = 1;
2604
+ const ToolBar = 'toolbar';
2216
2605
 
2606
+ const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2217
2607
  const getClassName$1 = enabled => {
2218
2608
  if (enabled) {
2219
2609
  return SearchFieldButton;
2220
2610
  }
2221
- return mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2611
+ return disabledClassName;
2222
2612
  };
2223
2613
  const getSearchFieldButtonVirtualDom = button => {
2224
2614
  const {
@@ -2228,7 +2618,7 @@ const getSearchFieldButtonVirtualDom = button => {
2228
2618
  onClick
2229
2619
  } = button;
2230
2620
  return [{
2231
- type: Div,
2621
+ type: Button,
2232
2622
  className: getClassName$1(enabled),
2233
2623
  title,
2234
2624
  tabIndex: 0,
@@ -2246,10 +2636,11 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2246
2636
  const dom = [{
2247
2637
  type: Div,
2248
2638
  className: SearchField,
2249
- role: None$1,
2639
+ role: None,
2250
2640
  childCount: 2
2251
2641
  }, {
2252
- type: TextArea,
2642
+ type: Input,
2643
+ inputType: 'search',
2253
2644
  className: MultilineInputBox,
2254
2645
  spellcheck: false,
2255
2646
  autocapitalize: 'off',
@@ -2268,7 +2659,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2268
2659
  dom.unshift({
2269
2660
  type: Div,
2270
2661
  className: SearchFieldContainer,
2271
- role: None$1,
2662
+ role: None,
2272
2663
  childCount: 1 + outsideButtons.length
2273
2664
  });
2274
2665
  dom.push(...outsideButtons.flatMap(getSearchFieldButtonVirtualDom));
@@ -2355,7 +2746,7 @@ const getExtensionListItemVirtualDom = extension => {
2355
2746
  type: Img,
2356
2747
  src: icon,
2357
2748
  className: ExtensionListItemIcon,
2358
- role: None$1,
2749
+ role: None,
2359
2750
  childCount: 0
2360
2751
  }, listItemDetail, listItemName, text(name), listItemDescription, text(description), listItemFooter, listItemAuthorName, text(publisher), {
2361
2752
  type: Div,
@@ -2465,12 +2856,12 @@ const getVisible = state => {
2465
2856
  const getContentVirtualDom = (visibleExtensions, message, scrollBarHeight, scrollBarY) => {
2466
2857
  if (message) {
2467
2858
  return [{
2468
- type: VirtualDomElements.Div,
2859
+ type: Div,
2469
2860
  childCount: 1
2470
2861
  }, text(message)];
2471
2862
  }
2472
2863
  return [{
2473
- type: VirtualDomElements.Div,
2864
+ type: Div,
2474
2865
  className: mergeClassNames(Viewlet, List$1),
2475
2866
  childCount: 2
2476
2867
  }, ...getExtensionsVirtualDom(visibleExtensions), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarY)];
@@ -2485,12 +2876,12 @@ const getExtensionsViewVirtualDom = state => {
2485
2876
  scrollBarY
2486
2877
  } = state;
2487
2878
  return [{
2488
- type: VirtualDomElements.Div,
2879
+ type: Div,
2489
2880
  className: mergeClassNames(Viewlet, Extensions),
2490
2881
  childCount: 2,
2491
2882
  ariaLive: 'polite',
2492
2883
  ariaBusy: false,
2493
- role: AriaRoles.None
2884
+ role: None$1
2494
2885
  }, ...getExtensionHeaderVirtualDom(placeholder, inputActions), ...getContentVirtualDom(visibleExtensions, message, scrollBarHeight, scrollBarY)];
2495
2886
  };
2496
2887
 
@@ -2561,7 +2952,7 @@ const render3 = (uid, diffResult) => {
2561
2952
  oldState,
2562
2953
  newState
2563
2954
  } = get$1(uid);
2564
- set$1(uid, newState, newState);
2955
+ set$3(uid, newState, newState);
2565
2956
  const commands = applyRender(oldState, newState, diffResult);
2566
2957
  return commands;
2567
2958
  };
@@ -2570,7 +2961,7 @@ const getIconVirtualDom = (icon, type = Div) => {
2570
2961
  return {
2571
2962
  type,
2572
2963
  className: mergeClassNames(MaskIcon, `MaskIcon${icon}`),
2573
- role: None$1,
2964
+ role: None,
2574
2965
  childCount: 0
2575
2966
  };
2576
2967
  };
@@ -2578,14 +2969,12 @@ const getIconVirtualDom = (icon, type = Div) => {
2578
2969
  const getActionButtonVirtualDom = action => {
2579
2970
  const {
2580
2971
  id,
2581
- icon,
2582
- command
2972
+ icon
2583
2973
  } = action;
2584
2974
  return [{
2585
2975
  type: Button,
2586
2976
  className: IconButton,
2587
2977
  title: id,
2588
- 'data-command': command,
2589
2978
  childCount: 1
2590
2979
  }, getIconVirtualDom(icon)];
2591
2980
  };
@@ -2660,14 +3049,11 @@ const renderEventListeners = () => {
2660
3049
  }];
2661
3050
  };
2662
3051
 
2663
- const saveState = uid => {
2664
- const {
2665
- newState
2666
- } = get$1(uid);
3052
+ const saveState = state => {
2667
3053
  const {
2668
3054
  searchValue,
2669
3055
  deltaY
2670
- } = newState;
3056
+ } = state;
2671
3057
  return {
2672
3058
  searchValue,
2673
3059
  deltaY
@@ -2699,7 +3085,7 @@ const commandMap = {
2699
3085
  'SearchExtensions.closeSuggest': wrapCommand(closeSuggest),
2700
3086
  'SearchExtensions.create': create$1,
2701
3087
  'SearchExtensions.diff2': diff2,
2702
- 'SearchExtensions.dispose': dispose,
3088
+ 'SearchExtensions.dispose': dispose$1,
2703
3089
  'SearchExtensions.focusFirst': wrapCommand(focusFirst),
2704
3090
  'SearchExtensions.focusIndex': wrapCommand(focusIndex),
2705
3091
  'SearchExtensions.focusLast': wrapCommand(focusLast),
@@ -2709,7 +3095,7 @@ const commandMap = {
2709
3095
  'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
2710
3096
  'SearchExtensions.getActions': getActions,
2711
3097
  'SearchExtensions.getCommandIds': getCommandIds,
2712
- 'SearchExtensions.getKeyBindings': getKeyBindings,
3098
+ 'SearchExtensions.getKeyBindings': getKeyBindings$1,
2713
3099
  'SearchExtensions.getMenuEntries': getMenuEntries,
2714
3100
  'SearchExtensions.handleBlur': wrapCommand(handleBlur),
2715
3101
  'SearchExtensions.handleClick': wrapCommand(handleClick),
@@ -2734,7 +3120,7 @@ const commandMap = {
2734
3120
  'SearchExtensions.renderActions': renderActions,
2735
3121
  'SearchExtensions.renderEventListeners': renderEventListeners,
2736
3122
  'SearchExtensions.restoreState': restoreState,
2737
- 'SearchExtensions.saveState': saveState,
3123
+ 'SearchExtensions.saveState': wrapGetter(saveState),
2738
3124
  'SearchExtensions.scrollDown': wrapCommand(scrollDown),
2739
3125
  'SearchExtensions.searchExtensions': searchExtensions,
2740
3126
  'SearchExtensions.selectIndex': wrapCommand(selectIndex),
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.0.0",
3
+ "version": "4.3.0",
4
4
  "description": "Extension Search View Worker",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/lvce-editor/extension-search-view.git"
8
+ },
5
9
  "license": "MIT",
6
10
  "author": "Lvce Editor",
7
11
  "type": "module",