@lvce-editor/quick-pick-worker 4.19.2 → 4.20.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.
@@ -1356,6 +1356,7 @@ const ExtensionManagementWorker = 9006;
1356
1356
  const RendererProcess = 1670;
1357
1357
  const RendererWorker = 1;
1358
1358
 
1359
+ const SetCss = 'Viewlet.setCss';
1359
1360
  const SetDom2 = 'Viewlet.setDom2';
1360
1361
  const SetFocusContext = 'Viewlet.setFocusContext';
1361
1362
  const SetPatches = 'Viewlet.setPatches';
@@ -1998,24 +1999,25 @@ const create = (uid, uri, listItemHeight, x, y, width, height, platform, args, _
1998
1999
  set$2(uid, state, state);
1999
2000
  };
2000
2001
 
2002
+ const isEqual$4 = (oldState, newState) => {
2003
+ return oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.headerHeight === newState.headerHeight && oldState.height === newState.height && oldState.itemHeight === newState.itemHeight && oldState.items.length === newState.items.length && oldState.minimumSliderSize === newState.minimumSliderSize;
2004
+ };
2005
+
2001
2006
  const RenderItems = 1;
2002
2007
  const RenderIncremental = 10;
2003
2008
  const RenderFocus = 2;
2004
2009
  const RenderValue = 3;
2010
+ const RenderCss = 4;
2005
2011
  const RenderCursorOffset = 7;
2006
2012
  const RenderFocusedIndex = 8;
2007
2013
  const Height = 9;
2008
2014
 
2009
- const isEqual$4 = (oldState, newState) => {
2010
- return oldState.focused === newState.focused;
2011
- };
2012
-
2013
2015
  const isEqual$3 = (oldState, newState) => {
2014
- return oldState.focusedIndex === newState.focusedIndex;
2016
+ return oldState.focused === newState.focused;
2015
2017
  };
2016
2018
 
2017
2019
  const isEqual$2 = (oldState, newState) => {
2018
- return oldState.items.length === newState.items.length;
2020
+ return oldState.focusedIndex === newState.focusedIndex;
2019
2021
  };
2020
2022
 
2021
2023
  const isEqual$1 = (oldState, newState) => {
@@ -2027,8 +2029,8 @@ const isEqual = (oldState, newState) => {
2027
2029
  return newState.inputSource === User || oldState.value === newState.value;
2028
2030
  };
2029
2031
 
2030
- const modules = [isEqual$2, isEqual$1, isEqual, isEqual$3, isEqual$4];
2031
- const numbers = [Height, RenderIncremental, diffType, RenderFocusedIndex, RenderFocus];
2032
+ const modules = [isEqual$4, isEqual$1, isEqual, isEqual$2, isEqual$3];
2033
+ const numbers = [RenderCss, RenderIncremental, diffType, RenderFocusedIndex, RenderFocus];
2032
2034
 
2033
2035
  const diff = (oldState, newState) => {
2034
2036
  const diffResult = [];
@@ -2172,7 +2174,7 @@ const focusIndex = async (state, index) => {
2172
2174
  await focusPick(providerId, items[index]);
2173
2175
  if (index < minLineY + 1) {
2174
2176
  const minLineY = index;
2175
- const maxLineY = Math.min(index + maxVisibleItems, items.length - 1);
2177
+ const maxLineY = Math.min(index + maxVisibleItems, items.length);
2176
2178
  const sliced = items.slice(minLineY, maxLineY);
2177
2179
  const {
2178
2180
  icons,
@@ -2692,6 +2694,9 @@ const getFilterValue = (id, subId, value) => {
2692
2694
  if (subId === GoToLine$2) {
2693
2695
  return getValueGoToLine();
2694
2696
  }
2697
+ if (id === File$1 && subId === Commands$1) {
2698
+ return getFilterValueEverything(value);
2699
+ }
2695
2700
  const fn = getFn(id);
2696
2701
  const filterValue = fn(value);
2697
2702
  return filterValue;
@@ -3690,6 +3695,9 @@ const getPicks = (id, searchValue, args, {
3690
3695
  };
3691
3696
 
3692
3697
  const getQuickPickSubProviderId = (id, prefix) => {
3698
+ if (id === File$1) {
3699
+ return prefix === Command ? Commands$1 : File$1;
3700
+ }
3693
3701
  if (id !== EveryThing$1) {
3694
3702
  return id;
3695
3703
  }
@@ -4241,6 +4249,47 @@ const initialize = async () => {
4241
4249
  // not needed anymore
4242
4250
  };
4243
4251
 
4252
+ const getCss = (scrollBarHeight, scrollBarTop, quickPickItemsHeight) => {
4253
+ return `.QuickPick {
4254
+ --QuickPickItemsHeight: ${quickPickItemsHeight}px;
4255
+ --ScrollBarThumbHeight: ${scrollBarHeight}px;
4256
+ --ScrollBarThumbTop: ${scrollBarTop}px;
4257
+ }
4258
+ .QuickPick .QuickPickItems {
4259
+ height: var(--QuickPickItemsHeight);
4260
+ }
4261
+ .QuickPick .ScrollBarThumb {
4262
+ height: var(--ScrollBarThumbHeight);
4263
+ translate: 0px var(--ScrollBarThumbTop);
4264
+ }`;
4265
+ };
4266
+
4267
+ const getQuickPickItemsHeight = height => {
4268
+ if (height === 0) {
4269
+ return 20;
4270
+ }
4271
+ return height;
4272
+ };
4273
+ const renderCss = (_oldState, newState) => {
4274
+ const {
4275
+ deltaY,
4276
+ finalDeltaY,
4277
+ headerHeight,
4278
+ height,
4279
+ itemHeight,
4280
+ items,
4281
+ minimumSliderSize,
4282
+ uid
4283
+ } = newState;
4284
+ const quickPickItemsHeight = getQuickPickItemsHeight(height);
4285
+ const listHeight = getListHeight$1(items.length, itemHeight, quickPickItemsHeight);
4286
+ const contentHeight = items.length * itemHeight;
4287
+ const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
4288
+ const scrollBarTop = Math.round(getScrollBarY(deltaY, finalDeltaY, quickPickItemsHeight - headerHeight, scrollBarHeight));
4289
+ const css = getCss(scrollBarHeight, scrollBarTop, quickPickItemsHeight);
4290
+ return [SetCss, uid, css];
4291
+ };
4292
+
4244
4293
  const SetCursorOffset = 'setCursorOffset';
4245
4294
  const SetFocusedIndex = 'setFocusedIndex';
4246
4295
  const SetItemsHeight = 'setItemsHeight';
@@ -4276,13 +4325,6 @@ const mergeClassNames = (...classNames) => {
4276
4325
  return classNames.filter(Boolean).join(' ');
4277
4326
  };
4278
4327
 
4279
- const px = value => {
4280
- return `${value}px`;
4281
- };
4282
- const position = (x, y) => {
4283
- return `${x}px ${y}px`;
4284
- };
4285
-
4286
4328
  const text = data => {
4287
4329
  return {
4288
4330
  childCount: 0,
@@ -4706,6 +4748,7 @@ const QuickPickItem = 'QuickPickItem';
4706
4748
  const QuickPickItemActive$1 = 'QuickPickItemActive';
4707
4749
  const QuickPickItemDescription = 'QuickPickItemDescription';
4708
4750
  const QuickPickItemLabel = 'QuickPickItemLabel';
4751
+ const QuickPickItems$1 = 'QuickPickItems';
4709
4752
  const QuickPickInputWrapper = 'QuickPickInputWrapper';
4710
4753
  const QuickPickMaskIcon = 'QuickPickMaskIcon';
4711
4754
  const QuickPickStatus = 'QuickPickStatus';
@@ -4873,8 +4916,6 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
4873
4916
  if (!shouldShowScrollbar) {
4874
4917
  return [];
4875
4918
  }
4876
- const heightString = px(scrollBarHeight);
4877
- const translateString = position(0, scrollBarTop);
4878
4919
  return [{
4879
4920
  childCount: 1,
4880
4921
  className: mergeClassNames(ScrollBar, ScrollBarSmall),
@@ -4883,8 +4924,6 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarTop) => {
4883
4924
  }, {
4884
4925
  childCount: 0,
4885
4926
  className: ScrollBarThumb,
4886
- height: heightString,
4887
- translate: translateString,
4888
4927
  type: Div
4889
4928
  }];
4890
4929
  };
@@ -4920,7 +4959,7 @@ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, pla
4920
4959
  }, ...getQuickPickHeaderVirtualDom(placeholder, inputAriaLabel), {
4921
4960
  ariaActivedescendant: QuickPickItemActive,
4922
4961
  childCount: shouldShowScrollbar ? 2 : 1,
4923
- className: mergeClassNames(List, ContainContent),
4962
+ className: mergeClassNames(List, ContainContent, QuickPickItems$1),
4924
4963
  id: QuickPickItems,
4925
4964
  onPointerDown: HandlePointerDown,
4926
4965
  onWheel: HandleWheel,
@@ -4930,7 +4969,7 @@ const getQuickPickVirtualDom = (visibleItems, scrollBarHeight, scrollBarTop, pla
4930
4969
  childCount: listItemsChildCount,
4931
4970
  className: mergeClassNames(ListItems, ContainContent),
4932
4971
  type: Div
4933
- }, ...quickPickItemsDom, ...getScrollBarVirtualDom(scrollBarHeight, scrollBarTop)];
4972
+ }, ...quickPickItemsDom, ...getScrollBarVirtualDom(scrollBarHeight)];
4934
4973
  };
4935
4974
 
4936
4975
  const renderItemsDom = state => {
@@ -4966,6 +5005,8 @@ const getRenderer = diffType => {
4966
5005
  switch (diffType) {
4967
5006
  case Height:
4968
5007
  return renderHeight;
5008
+ case RenderCss:
5009
+ return renderCss;
4969
5010
  case RenderCursorOffset:
4970
5011
  return renderCursorOffset;
4971
5012
  case RenderFocus:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/quick-pick-worker",
3
- "version": "4.19.2",
3
+ "version": "4.20.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/lvce-editor/quick-pick-worker.git"