@lvce-editor/extension-search-view 4.10.0 → 4.11.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.
@@ -2052,7 +2052,7 @@ const isEqual$2 = (oldState, newState) => {
2052
2052
  };
2053
2053
 
2054
2054
  const isEqual$1 = (oldState, newState) => {
2055
- 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;
2055
+ 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 && oldState.scrollBarHeight === newState.scrollBarHeight;
2056
2056
  };
2057
2057
 
2058
2058
  const isEqual = (oldState, newState) => {
@@ -2345,12 +2345,12 @@ const getMenuEntries = () => {
2345
2345
  id: 'copy',
2346
2346
  label: copy(),
2347
2347
  flags: None$1,
2348
- command: 'SearchExtensions.copy'
2348
+ command: 'Extensions.copyExtensionInfo'
2349
2349
  }, {
2350
2350
  id: 'copyExtensionId',
2351
2351
  label: copyExtensionId$1(),
2352
2352
  flags: None$1,
2353
- command: 'SearchExtensions.copyExtensionId'
2353
+ command: 'Extensions.copyExtensionId'
2354
2354
  }];
2355
2355
  };
2356
2356
 
@@ -2473,6 +2473,10 @@ const handleFocus = async state => {
2473
2473
  };
2474
2474
  };
2475
2475
 
2476
+ const handleHeaderContextMenu = async state => {
2477
+ return state;
2478
+ };
2479
+
2476
2480
  // TODO show error / warning when installment fails / times out
2477
2481
  const handleInstall = async (state, id) => {
2478
2482
  return state;
@@ -2535,8 +2539,8 @@ const setDeltaY = (state, value) => {
2535
2539
  }
2536
2540
  // TODO when it only moves by one px, extensions don't need to be rerendered, only negative margin
2537
2541
  const minLineY = Math.floor(newDeltaY / itemHeight);
2538
- const maxLineY = minLineY + getNumberOfVisibleItems$1(listHeight, itemHeight);
2539
2542
  const total = items.length;
2543
+ const maxLineY = Math.min(minLineY + getNumberOfVisibleItems$1(listHeight, itemHeight), total);
2540
2544
  const contentHeight = total * itemHeight;
2541
2545
  const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
2542
2546
  const scrollBarY = getScrollBarY$1(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
@@ -2680,6 +2684,7 @@ const HandleTouchEnd = 12;
2680
2684
  const HandleTouchMove = 13;
2681
2685
  const HandleTouchStart = 14;
2682
2686
  const HandleWheel = 15;
2687
+ const HandleHeaderContextMenu = 16;
2683
2688
 
2684
2689
  const getInputActions = newState => {
2685
2690
  const {
@@ -2944,7 +2949,7 @@ const SearchField = 'SearchField';
2944
2949
  const SearchFieldButton = 'SearchFieldButton';
2945
2950
  const SearchFieldButtons = 'SearchFieldButtons';
2946
2951
  const SearchFieldContainer = 'SearchFieldContainer';
2947
- const SearchFieldDisabled = 'SearchFieldDisabled';
2952
+ const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
2948
2953
  const Viewlet = 'Viewlet';
2949
2954
 
2950
2955
  const List = 'list';
@@ -2952,7 +2957,7 @@ const ListItem = 'listitem';
2952
2957
  const None = 'none';
2953
2958
  const ToolBar = 'toolbar';
2954
2959
 
2955
- const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldDisabled);
2960
+ const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldButtonDisabled);
2956
2961
  const getClassName$1 = enabled => {
2957
2962
  if (enabled) {
2958
2963
  return SearchFieldButton;
@@ -3020,10 +3025,11 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
3020
3025
  const parentNode = {
3021
3026
  type: Div,
3022
3027
  className: ExtensionHeader,
3023
- childCount: 1
3028
+ childCount: 1,
3029
+ onContextMenu: HandleHeaderContextMenu
3024
3030
  };
3025
3031
  const getExtensionHeaderVirtualDom = (placeholder, actions) => {
3026
- return [parentNode, ...getSearchFieldVirtualDom('extensions', placeholder, HandleExtensionsInput, actions, [])];
3032
+ return [parentNode, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [])];
3027
3033
  };
3028
3034
 
3029
3035
  const renderHeader = newState => {
@@ -3365,6 +3371,10 @@ const renderEventListeners = () => {
3365
3371
  name: HandleContextMenu,
3366
3372
  params: ['handleContextMenu', Button$1, ClientX, ClientY],
3367
3373
  preventDefault: true
3374
+ }, {
3375
+ name: HandleHeaderContextMenu,
3376
+ params: ['handleHeaderContextMenu'],
3377
+ preventDefault: true
3368
3378
  }, {
3369
3379
  name: HandlePointerDown,
3370
3380
  params: ['handleClickAt', Button$1, ClientX, ClientY],
@@ -3399,6 +3409,40 @@ const renderEventListeners = () => {
3399
3409
  }];
3400
3410
  };
3401
3411
 
3412
+ const resize = async (state, dimensions) => {
3413
+ const {
3414
+ items,
3415
+ itemHeight,
3416
+ headerHeight,
3417
+ minimumSliderSize
3418
+ } = state;
3419
+ const {
3420
+ x,
3421
+ y,
3422
+ width,
3423
+ height
3424
+ } = dimensions;
3425
+ const total = items.length;
3426
+ const listHeight = getListHeight(total, itemHeight, height);
3427
+ const contentHeight = total * itemHeight;
3428
+ const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
3429
+ const numberOfVisible = getNumberOfVisibleItems$1(listHeight, itemHeight);
3430
+ const maxLineY = Math.min(numberOfVisible, total);
3431
+ const finalDeltaY = getFinalDeltaY(listHeight, itemHeight, total);
3432
+ const scrollBarY = getScrollBarY$1(0, finalDeltaY, height - headerHeight, scrollBarHeight);
3433
+ return {
3434
+ ...state,
3435
+ finalDeltaY,
3436
+ height,
3437
+ maxLineY,
3438
+ scrollBarHeight,
3439
+ scrollBarY,
3440
+ width,
3441
+ x,
3442
+ y
3443
+ };
3444
+ };
3445
+
3402
3446
  const saveState = state => {
3403
3447
  const {
3404
3448
  searchValue,
@@ -3442,6 +3486,7 @@ const commandMap = {
3442
3486
  'SearchExtensions.focusIndex': wrapCommand(focusIndex),
3443
3487
  'SearchExtensions.focusLast': wrapCommand(focusLast),
3444
3488
  'SearchExtensions.focusNext': wrapCommand(focusNext),
3489
+ 'SearchExtensions.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
3445
3490
  'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
3446
3491
  'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
3447
3492
  'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
@@ -3479,7 +3524,8 @@ const commandMap = {
3479
3524
  'SearchExtensions.selectIndex': wrapCommand(selectIndex),
3480
3525
  'SearchExtensions.setDeltaY': wrapCommand(setDeltaY),
3481
3526
  'SearchExtensions.terminate': terminate,
3482
- 'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest)
3527
+ 'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest),
3528
+ 'SearchExtensions.resize': wrapCommand(resize)
3483
3529
  };
3484
3530
 
3485
3531
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/extension-search-view",
3
- "version": "4.10.0",
3
+ "version": "4.11.0",
4
4
  "description": "Extension Search View Worker",
5
5
  "repository": {
6
6
  "type": "git",