@lvce-editor/extension-search-view 4.5.0 → 4.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.
@@ -1117,6 +1117,33 @@ const terminate = () => {
1117
1117
  globalThis.close();
1118
1118
  };
1119
1119
 
1120
+ const None$3 = 'none';
1121
+
1122
+ const Button$2 = 1;
1123
+ const Div = 4;
1124
+ const Input$1 = 6;
1125
+ const Text = 12;
1126
+ const Img = 17;
1127
+
1128
+ const Button$1 = 'event.button';
1129
+ const ClientX = 'event.clientX';
1130
+ const ClientY = 'event.clientY';
1131
+ const DeltaMode = 'event.deltaMode';
1132
+ const DeltaY = 'event.deltaY';
1133
+ const TargetValue = 'event.target.value';
1134
+
1135
+ const Script$1 = 2;
1136
+
1137
+ const LeftClick = 0;
1138
+
1139
+ const DebugWorker = 55;
1140
+ const ExtensionHostWorker = 44;
1141
+ const RendererWorker$1 = 1;
1142
+
1143
+ const None$2 = 0;
1144
+ const Input = 1;
1145
+ const List$2 = 2;
1146
+
1120
1147
  const handleError = async (error, notify = true, prefix = '') => {
1121
1148
  // @ts-ignore
1122
1149
  console.error(error);
@@ -1208,10 +1235,6 @@ const viewsAndMoreActions = () => {
1208
1235
  return i18nString(ViewsAndMoreActions);
1209
1236
  };
1210
1237
 
1211
- const None$3 = 0;
1212
- const Input$1 = 1;
1213
- const List$2 = 2;
1214
-
1215
1238
  const getFinalDeltaY = (height, itemHeight, itemsLength) => {
1216
1239
  const contentHeight = itemsLength * itemHeight;
1217
1240
  const finalDeltaY = Math.max(contentHeight - height, 0);
@@ -1387,7 +1410,7 @@ const handleInput = async (state, value, inputSource = User) => {
1387
1410
  allExtensions,
1388
1411
  deltaY: 0,
1389
1412
  finalDeltaY: 0,
1390
- focus: Input$1,
1413
+ focus: Input,
1391
1414
  items,
1392
1415
  maxLineY: 0,
1393
1416
  message: noExtensionsFound(),
@@ -1436,34 +1459,16 @@ const handleInput = async (state, value, inputSource = User) => {
1436
1459
  };
1437
1460
 
1438
1461
  const clearSearchResults = state => {
1439
- return handleInput(state, '');
1462
+ return handleInput({
1463
+ ...state,
1464
+ focus: Input
1465
+ }, '', Script$1);
1440
1466
  };
1441
1467
 
1442
1468
  const closeSuggest = state => {
1443
1469
  return state;
1444
1470
  };
1445
1471
 
1446
- const None$2 = 'none';
1447
-
1448
- const Button$2 = 1;
1449
- const Div = 4;
1450
- const Input = 6;
1451
- const Text = 12;
1452
- const Img = 17;
1453
-
1454
- const Button$1 = 'event.button';
1455
- const ClientX = 'event.clientX';
1456
- const ClientY = 'event.clientY';
1457
- const DeltaMode = 'event.deltaMode';
1458
- const DeltaY = 'event.deltaY';
1459
- const TargetValue = 'event.target.value';
1460
-
1461
- const LeftClick = 0;
1462
-
1463
- const DebugWorker = 55;
1464
- const ExtensionHostWorker = 44;
1465
- const RendererWorker$1 = 1;
1466
-
1467
1472
  const rpcs = Object.create(null);
1468
1473
  const set$5 = (id, rpc) => {
1469
1474
  rpcs[id] = rpc;
@@ -1889,15 +1894,23 @@ const RendererWorker = {
1889
1894
  writeClipBoardText
1890
1895
  };
1891
1896
 
1892
- const copyExtensionId = async state => {
1897
+ const getFocusedItem = state => {
1893
1898
  const {
1894
1899
  items,
1895
1900
  focusedIndex
1896
1901
  } = state;
1897
1902
  if (focusedIndex === -1) {
1898
- return state;
1903
+ return undefined;
1899
1904
  }
1900
1905
  const item = items[focusedIndex];
1906
+ return item;
1907
+ };
1908
+
1909
+ const copyExtensionId = async state => {
1910
+ const item = getFocusedItem(state);
1911
+ if (!item) {
1912
+ return state;
1913
+ }
1901
1914
  const {
1902
1915
  id
1903
1916
  } = item;
@@ -1946,14 +1959,10 @@ const getExtensionInfoText = extension => {
1946
1959
  };
1947
1960
 
1948
1961
  const copyExtensionInfo = async state => {
1949
- const {
1950
- items,
1951
- focusedIndex
1952
- } = state;
1953
- if (focusedIndex === -1) {
1962
+ const item = getFocusedItem(state);
1963
+ if (!item) {
1954
1964
  return state;
1955
1965
  }
1956
- const item = items[focusedIndex];
1957
1966
  const text = getExtensionInfoText(item);
1958
1967
  await writeClipBoardText(text);
1959
1968
  return state;
@@ -1966,7 +1975,8 @@ const {
1966
1975
  wrapCommand,
1967
1976
  getCommandIds,
1968
1977
  registerCommands,
1969
- wrapGetter
1978
+ wrapGetter,
1979
+ diff
1970
1980
  } = create$2();
1971
1981
 
1972
1982
  const create = (id, uri, x, y, width, height, platform, assetDir) => {
@@ -2032,18 +2042,7 @@ const modules = [isEqual$1, isEqual$2, isEqual, isEqual$2];
2032
2042
  const numbers = [RenderItems, RenderFocus, RenderSearchValue, RenderFocusContext];
2033
2043
 
2034
2044
  const diff2 = uid => {
2035
- const {
2036
- oldState,
2037
- newState
2038
- } = get(uid);
2039
- const diffResult = [];
2040
- for (let i = 0; i < modules.length; i++) {
2041
- const fn = modules[i];
2042
- if (!fn(oldState, newState)) {
2043
- diffResult.push(numbers[i]);
2044
- }
2045
- }
2046
- return diffResult;
2045
+ return diff(uid, modules, numbers);
2047
2046
  };
2048
2047
 
2049
2048
  const dispose = uid => {
@@ -2329,7 +2328,7 @@ const getMenuEntries = () => {
2329
2328
  const handleBlur = state => {
2330
2329
  return {
2331
2330
  ...state,
2332
- focus: None$3
2331
+ focus: None$2
2333
2332
  };
2334
2333
  };
2335
2334
 
@@ -2654,7 +2653,10 @@ const HandleTouchStart = 14;
2654
2653
  const HandleWheel = 15;
2655
2654
 
2656
2655
  const getInputActions = newState => {
2657
- const clearEnabled = newState.searchValue.length > 0;
2656
+ const {
2657
+ searchValue
2658
+ } = newState;
2659
+ const clearEnabled = searchValue.length > 0;
2658
2660
  const actions = [{
2659
2661
  onClick: HandleClearSearchResults,
2660
2662
  icon: `MaskIcon${ClearAll}`,
@@ -2826,7 +2828,7 @@ const loadContent = async (state, savedState) => {
2826
2828
  inputSource: Script,
2827
2829
  inputActions,
2828
2830
  deltaY
2829
- }, searchValue);
2831
+ }, searchValue, Script);
2830
2832
  return updatedState;
2831
2833
  };
2832
2834
 
@@ -2838,7 +2840,7 @@ const Extensions$1 = 'extensions';
2838
2840
 
2839
2841
  const getSelector = focus => {
2840
2842
  switch (focus) {
2841
- case Input$1:
2843
+ case Input:
2842
2844
  return `[name="${Extensions$1}"]`;
2843
2845
  case List$2:
2844
2846
  return '.ListItems';
@@ -2862,7 +2864,7 @@ const renderFocusContext = newState => {
2862
2864
  const {
2863
2865
  uid
2864
2866
  } = newState;
2865
- if (newState.focus === Input$1) {
2867
+ if (newState.focus === Input) {
2866
2868
  return ['Viewlet.setFocusContext', uid, FocusExtensionsInput];
2867
2869
  }
2868
2870
  if (newState.focus === List$2) {
@@ -2940,7 +2942,7 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
2940
2942
  role: None,
2941
2943
  childCount: 2
2942
2944
  }, {
2943
- type: Input,
2945
+ type: Input$1,
2944
2946
  inputType: 'search',
2945
2947
  className: MultilineInputBox,
2946
2948
  spellcheck: false,
@@ -3183,7 +3185,7 @@ const getExtensionsViewVirtualDom = state => {
3183
3185
  childCount: 2,
3184
3186
  ariaLive: 'polite',
3185
3187
  ariaBusy: false,
3186
- role: None$2
3188
+ role: None$3
3187
3189
  }, ...getExtensionHeaderVirtualDom(placeholder, inputActions), ...getContentVirtualDom(visibleExtensions, message, scrollBarHeight, scrollBarY)];
3188
3190
  };
3189
3191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",