@lvce-editor/extension-search-view 4.1.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.
@@ -892,6 +892,9 @@ const createMockRpc = ({
892
892
  const invoke = (method, ...params) => {
893
893
  invocations.push([method, ...params]);
894
894
  const command = commandMap[method];
895
+ if (!command) {
896
+ throw new Error(`command ${method} not found`);
897
+ }
895
898
  return command(...params);
896
899
  };
897
900
  const mockRpc = {
@@ -1088,6 +1091,9 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
1088
1091
  return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
1089
1092
  };
1090
1093
 
1094
+ const User = 1;
1095
+ const Script = 2;
1096
+
1091
1097
  const getScrollBarOffset$1 = (delta, finalDelta, size, scrollBarSize) => {
1092
1098
  const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
1093
1099
  return scrollBarOffset;
@@ -1206,7 +1212,7 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
1206
1212
  };
1207
1213
 
1208
1214
  // TODO debounce
1209
- const handleInput = async (state, value) => {
1215
+ const handleInput = async (state, value, inputSource = User) => {
1210
1216
  try {
1211
1217
  const {
1212
1218
  allExtensions,
@@ -1233,7 +1239,8 @@ const handleInput = async (state, value) => {
1233
1239
  minLineY: 0,
1234
1240
  placeholder: searchExtensionsInMarketPlace(),
1235
1241
  scrollBarHeight: 0,
1236
- searchValue: value
1242
+ searchValue: value,
1243
+ inputSource
1237
1244
  };
1238
1245
  }
1239
1246
  const total = items.length;
@@ -1256,7 +1263,8 @@ const handleInput = async (state, value) => {
1256
1263
  placeholder: searchExtensionsInMarketPlace(),
1257
1264
  scrollBarHeight,
1258
1265
  scrollBarY,
1259
- searchValue: value
1266
+ searchValue: value,
1267
+ inputSource
1260
1268
  };
1261
1269
 
1262
1270
  // TODO handle out of order responses (a bit complicated)
@@ -1335,9 +1343,6 @@ const isEqual$1 = (oldState, newState) => {
1335
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;
1336
1344
  };
1337
1345
 
1338
- const User = 1;
1339
- const Script = 2;
1340
-
1341
1346
  const isEqual = (oldState, newState) => {
1342
1347
  return newState.inputSource === User || oldState.searchValue === newState.searchValue;
1343
1348
  };
@@ -1776,6 +1781,11 @@ const sendMessagePortToMarkdownWorker = async (port, rpcId) => {
1776
1781
  // @ts-ignore
1777
1782
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToMarkdownWorker', port, command, rpcId);
1778
1783
  };
1784
+ const sendMessagePortToIconThemeWorker = async (port, rpcId) => {
1785
+ const command = 'IconTheme.handleMessagePort';
1786
+ // @ts-ignore
1787
+ await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToIconThemeWorker', port, command, rpcId);
1788
+ };
1779
1789
  const sendMessagePortToFileSystemWorker = async (port, rpcId) => {
1780
1790
  const command = 'FileSystem.handleMessagePort';
1781
1791
  // @ts-ignore
@@ -2042,6 +2052,7 @@ const RendererWorker = {
2042
2052
  sendMessagePortToErrorWorker,
2043
2053
  sendMessagePortToExtensionHostWorker,
2044
2054
  sendMessagePortToFileSystemWorker,
2055
+ sendMessagePortToIconThemeWorker,
2045
2056
  sendMessagePortToMarkdownWorker,
2046
2057
  sendMessagePortToRendererProcess,
2047
2058
  sendMessagePortToSearchProcess,
@@ -2592,11 +2603,12 @@ const ListItem = 'listitem';
2592
2603
  const None = 'none';
2593
2604
  const ToolBar = 'toolbar';
2594
2605
 
2606
+ const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2595
2607
  const getClassName$1 = enabled => {
2596
2608
  if (enabled) {
2597
2609
  return SearchFieldButton;
2598
2610
  }
2599
- return mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2611
+ return disabledClassName;
2600
2612
  };
2601
2613
  const getSearchFieldButtonVirtualDom = button => {
2602
2614
  const {
@@ -2606,7 +2618,7 @@ const getSearchFieldButtonVirtualDom = button => {
2606
2618
  onClick
2607
2619
  } = button;
2608
2620
  return [{
2609
- type: Div,
2621
+ type: Button,
2610
2622
  className: getClassName$1(enabled),
2611
2623
  title,
2612
2624
  tabIndex: 0,
@@ -2628,6 +2640,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2628
2640
  childCount: 2
2629
2641
  }, {
2630
2642
  type: Input,
2643
+ inputType: 'search',
2631
2644
  className: MultilineInputBox,
2632
2645
  spellcheck: false,
2633
2646
  autocapitalize: 'off',
@@ -2956,14 +2969,12 @@ const getIconVirtualDom = (icon, type = Div) => {
2956
2969
  const getActionButtonVirtualDom = action => {
2957
2970
  const {
2958
2971
  id,
2959
- icon,
2960
- command
2972
+ icon
2961
2973
  } = action;
2962
2974
  return [{
2963
2975
  type: Button,
2964
2976
  className: IconButton,
2965
2977
  title: id,
2966
- 'data-command': command,
2967
2978
  childCount: 1
2968
2979
  }, getIconVirtualDom(icon)];
2969
2980
  };
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.1.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",