@lvce-editor/completion-worker 1.10.0 → 1.12.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.
@@ -1906,8 +1906,13 @@ const renderContent = (oldState, newState) => {
1906
1906
  return [SetDom2, uid, dom];
1907
1907
  };
1908
1908
 
1909
- const getEventListeners = uid => {
1910
- return [];
1909
+ const HandleWheel = 'handleWheel';
1910
+
1911
+ const getEventListeners = () => {
1912
+ return [{
1913
+ name: HandleWheel,
1914
+ params: ['EditorCompletion.handleWheel', 'event.deltaMode', 'event.deltaY']
1915
+ }];
1911
1916
  };
1912
1917
 
1913
1918
  const renderEventListeners = state => {
@@ -1922,6 +1927,10 @@ const renderFocusContext = (oldState, newState) => {
1922
1927
  return [/* method */'Viewlet.setFocusContext', FocusEditorRename];
1923
1928
  };
1924
1929
 
1930
+ const None = 'none';
1931
+ const Option = 'option';
1932
+ const ListBox = 'listbox';
1933
+
1925
1934
  const ColoredMaskIcon = 'ColoredMaskIcon';
1926
1935
  const EditorCompletion = 'EditorCompletion';
1927
1936
  const EditorCompletionItem = 'EditorCompletionItem';
@@ -1931,9 +1940,29 @@ const EditorCompletionItemHighlight = 'EditorCompletionItemHighlight';
1931
1940
  const FileIcon = 'FileIcon';
1932
1941
  const Label = 'Label';
1933
1942
  const Viewlet = 'Viewlet';
1943
+ const ListItems = 'ListItems';
1934
1944
 
1935
- const None = 'none';
1936
- const Option = 'option';
1945
+ const emptyObject = {};
1946
+ const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
1947
+ const i18nString = (key, placeholders = emptyObject) => {
1948
+ if (placeholders === emptyObject) {
1949
+ return key;
1950
+ }
1951
+ const replacer = (match, rest) => {
1952
+ return placeholders[rest];
1953
+ };
1954
+ return key.replaceAll(RE_PLACEHOLDER, replacer);
1955
+ };
1956
+
1957
+ const NoSuggestions = 'No Suggestions';
1958
+ const Suggest = 'Suggest';
1959
+
1960
+ const noSuggestions = () => {
1961
+ return i18nString(NoSuggestions);
1962
+ };
1963
+ const suggest = () => {
1964
+ return i18nString(Suggest);
1965
+ };
1937
1966
 
1938
1967
  const Div = 4;
1939
1968
  const Span = 8;
@@ -2041,24 +2070,6 @@ const getCompletionItemVirtualDom = visibleItem => {
2041
2070
  }, getIconDom(fileIcon, symbolName), ...getHighlightedLabelDom(label, highlights)];
2042
2071
  };
2043
2072
 
2044
- const emptyObject = {};
2045
- const RE_PLACEHOLDER = /\{(PH\d+)\}/g;
2046
- const i18nString = (key, placeholders = emptyObject) => {
2047
- if (placeholders === emptyObject) {
2048
- return key;
2049
- }
2050
- const replacer = (match, rest) => {
2051
- return placeholders[rest];
2052
- };
2053
- return key.replaceAll(RE_PLACEHOLDER, replacer);
2054
- };
2055
-
2056
- const NoSuggestions = 'No Suggestions';
2057
-
2058
- const noSuggestions = () => {
2059
- return i18nString(NoSuggestions);
2060
- };
2061
-
2062
2073
  const parentNode = {
2063
2074
  type: Div,
2064
2075
  childCount: 1
@@ -2087,10 +2098,11 @@ const getCompletionVirtualDom = visibleItems => {
2087
2098
  childCount: 1
2088
2099
  }, {
2089
2100
  type: Div,
2090
- className: 'ListItems',
2091
- role: 'listbox',
2092
- ariaLabel: 'Suggest',
2093
- childCount: 1
2101
+ className: ListItems,
2102
+ role: ListBox,
2103
+ ariaLabel: suggest(),
2104
+ childCount: 1,
2105
+ onWheel: HandleWheel
2094
2106
  }, ...getCompletionItemsVirtualDom(visibleItems)
2095
2107
 
2096
2108
  // TODO render scrollbar
@@ -2158,6 +2170,7 @@ const getHighlights = item => {
2158
2170
  const getLabel = item => {
2159
2171
  return item.label;
2160
2172
  };
2173
+
2161
2174
  const getVisibleIem = (item, itemHeight, leadingWord, i, focusedIndex) => {
2162
2175
  return {
2163
2176
  label: getLabel(item),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/completion-worker",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "Web Worker for the find widget in Lvce Editor",
5
5
  "repository": {
6
6
  "type": "git",