@lvce-editor/extension-search-view 4.9.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.
|
@@ -1269,11 +1269,13 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
|
1269
1269
|
const User = 1;
|
|
1270
1270
|
const Script = 2;
|
|
1271
1271
|
|
|
1272
|
-
const
|
|
1272
|
+
const getScrollBarY$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
1273
|
+
if (finalDelta === 0) {
|
|
1274
|
+
return 0;
|
|
1275
|
+
}
|
|
1273
1276
|
const scrollBarOffset = delta / finalDelta * (size - scrollBarSize);
|
|
1274
1277
|
return scrollBarOffset;
|
|
1275
1278
|
};
|
|
1276
|
-
const getScrollBarY$1 = getScrollBarOffset$1;
|
|
1277
1279
|
|
|
1278
1280
|
const Installed = '@installed';
|
|
1279
1281
|
const Enabled = '@enabled';
|
|
@@ -2050,7 +2052,7 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
2050
2052
|
};
|
|
2051
2053
|
|
|
2052
2054
|
const isEqual$1 = (oldState, newState) => {
|
|
2053
|
-
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;
|
|
2054
2056
|
};
|
|
2055
2057
|
|
|
2056
2058
|
const isEqual = (oldState, newState) => {
|
|
@@ -2343,12 +2345,12 @@ const getMenuEntries = () => {
|
|
|
2343
2345
|
id: 'copy',
|
|
2344
2346
|
label: copy(),
|
|
2345
2347
|
flags: None$1,
|
|
2346
|
-
command: '
|
|
2348
|
+
command: 'Extensions.copyExtensionInfo'
|
|
2347
2349
|
}, {
|
|
2348
2350
|
id: 'copyExtensionId',
|
|
2349
2351
|
label: copyExtensionId$1(),
|
|
2350
2352
|
flags: None$1,
|
|
2351
|
-
command: '
|
|
2353
|
+
command: 'Extensions.copyExtensionId'
|
|
2352
2354
|
}];
|
|
2353
2355
|
};
|
|
2354
2356
|
|
|
@@ -2471,6 +2473,10 @@ const handleFocus = async state => {
|
|
|
2471
2473
|
};
|
|
2472
2474
|
};
|
|
2473
2475
|
|
|
2476
|
+
const handleHeaderContextMenu = async state => {
|
|
2477
|
+
return state;
|
|
2478
|
+
};
|
|
2479
|
+
|
|
2474
2480
|
// TODO show error / warning when installment fails / times out
|
|
2475
2481
|
const handleInstall = async (state, id) => {
|
|
2476
2482
|
return state;
|
|
@@ -2533,8 +2539,8 @@ const setDeltaY = (state, value) => {
|
|
|
2533
2539
|
}
|
|
2534
2540
|
// TODO when it only moves by one px, extensions don't need to be rerendered, only negative margin
|
|
2535
2541
|
const minLineY = Math.floor(newDeltaY / itemHeight);
|
|
2536
|
-
const maxLineY = minLineY + getNumberOfVisibleItems$1(listHeight, itemHeight);
|
|
2537
2542
|
const total = items.length;
|
|
2543
|
+
const maxLineY = Math.min(minLineY + getNumberOfVisibleItems$1(listHeight, itemHeight), total);
|
|
2538
2544
|
const contentHeight = total * itemHeight;
|
|
2539
2545
|
const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, minimumSliderSize);
|
|
2540
2546
|
const scrollBarY = getScrollBarY$1(newDeltaY, finalDeltaY, height - headerHeight, scrollBarHeight);
|
|
@@ -2678,6 +2684,7 @@ const HandleTouchEnd = 12;
|
|
|
2678
2684
|
const HandleTouchMove = 13;
|
|
2679
2685
|
const HandleTouchStart = 14;
|
|
2680
2686
|
const HandleWheel = 15;
|
|
2687
|
+
const HandleHeaderContextMenu = 16;
|
|
2681
2688
|
|
|
2682
2689
|
const getInputActions = newState => {
|
|
2683
2690
|
const {
|
|
@@ -2721,6 +2728,9 @@ const getRemoteUrl = (extension, platform, assetDir) => {
|
|
|
2721
2728
|
}
|
|
2722
2729
|
return `/remote/${extension.path}/${extension.icon}`; // TODO support windows paths
|
|
2723
2730
|
}
|
|
2731
|
+
if (platform === Web) {
|
|
2732
|
+
return `${extension.path}/${extension.icon}`;
|
|
2733
|
+
}
|
|
2724
2734
|
return '';
|
|
2725
2735
|
};
|
|
2726
2736
|
|
|
@@ -2740,7 +2750,7 @@ const isLanguageBasicsExtension = extension => {
|
|
|
2740
2750
|
const isThemeExtension = extension => {
|
|
2741
2751
|
return extension.name && extension.name.endsWith(' Theme');
|
|
2742
2752
|
};
|
|
2743
|
-
const
|
|
2753
|
+
const getExtensionIcon = (extension, platform, assetDir) => {
|
|
2744
2754
|
if (!extension) {
|
|
2745
2755
|
return getExtensionDefaultIcon(assetDir);
|
|
2746
2756
|
}
|
|
@@ -2755,6 +2765,10 @@ const getIcon = (extension, platform, assetDir) => {
|
|
|
2755
2765
|
}
|
|
2756
2766
|
return getRemoteUrl(extension, platform, assetDir);
|
|
2757
2767
|
};
|
|
2768
|
+
|
|
2769
|
+
const getIcon = (extension, platform, assetDir) => {
|
|
2770
|
+
return getExtensionIcon(extension, platform, assetDir);
|
|
2771
|
+
};
|
|
2758
2772
|
const getName = extension => {
|
|
2759
2773
|
if (extension && extension.name) {
|
|
2760
2774
|
return extension.name;
|
|
@@ -2935,7 +2949,7 @@ const SearchField = 'SearchField';
|
|
|
2935
2949
|
const SearchFieldButton = 'SearchFieldButton';
|
|
2936
2950
|
const SearchFieldButtons = 'SearchFieldButtons';
|
|
2937
2951
|
const SearchFieldContainer = 'SearchFieldContainer';
|
|
2938
|
-
const
|
|
2952
|
+
const SearchFieldButtonDisabled = 'SearchFieldButtonDisabled';
|
|
2939
2953
|
const Viewlet = 'Viewlet';
|
|
2940
2954
|
|
|
2941
2955
|
const List = 'list';
|
|
@@ -2943,7 +2957,7 @@ const ListItem = 'listitem';
|
|
|
2943
2957
|
const None = 'none';
|
|
2944
2958
|
const ToolBar = 'toolbar';
|
|
2945
2959
|
|
|
2946
|
-
const disabledClassName = mergeClassNames(SearchFieldButton,
|
|
2960
|
+
const disabledClassName = mergeClassNames(SearchFieldButton, SearchFieldButtonDisabled);
|
|
2947
2961
|
const getClassName$1 = enabled => {
|
|
2948
2962
|
if (enabled) {
|
|
2949
2963
|
return SearchFieldButton;
|
|
@@ -3011,10 +3025,11 @@ const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, out
|
|
|
3011
3025
|
const parentNode = {
|
|
3012
3026
|
type: Div,
|
|
3013
3027
|
className: ExtensionHeader,
|
|
3014
|
-
childCount: 1
|
|
3028
|
+
childCount: 1,
|
|
3029
|
+
onContextMenu: HandleHeaderContextMenu
|
|
3015
3030
|
};
|
|
3016
3031
|
const getExtensionHeaderVirtualDom = (placeholder, actions) => {
|
|
3017
|
-
return [parentNode, ...getSearchFieldVirtualDom(
|
|
3032
|
+
return [parentNode, ...getSearchFieldVirtualDom(Extensions$1, placeholder, HandleExtensionsInput, actions, [])];
|
|
3018
3033
|
};
|
|
3019
3034
|
|
|
3020
3035
|
const renderHeader = newState => {
|
|
@@ -3356,6 +3371,10 @@ const renderEventListeners = () => {
|
|
|
3356
3371
|
name: HandleContextMenu,
|
|
3357
3372
|
params: ['handleContextMenu', Button$1, ClientX, ClientY],
|
|
3358
3373
|
preventDefault: true
|
|
3374
|
+
}, {
|
|
3375
|
+
name: HandleHeaderContextMenu,
|
|
3376
|
+
params: ['handleHeaderContextMenu'],
|
|
3377
|
+
preventDefault: true
|
|
3359
3378
|
}, {
|
|
3360
3379
|
name: HandlePointerDown,
|
|
3361
3380
|
params: ['handleClickAt', Button$1, ClientX, ClientY],
|
|
@@ -3390,6 +3409,40 @@ const renderEventListeners = () => {
|
|
|
3390
3409
|
}];
|
|
3391
3410
|
};
|
|
3392
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
|
+
|
|
3393
3446
|
const saveState = state => {
|
|
3394
3447
|
const {
|
|
3395
3448
|
searchValue,
|
|
@@ -3433,6 +3486,7 @@ const commandMap = {
|
|
|
3433
3486
|
'SearchExtensions.focusIndex': wrapCommand(focusIndex),
|
|
3434
3487
|
'SearchExtensions.focusLast': wrapCommand(focusLast),
|
|
3435
3488
|
'SearchExtensions.focusNext': wrapCommand(focusNext),
|
|
3489
|
+
'SearchExtensions.handleHeaderContextMenu': wrapCommand(handleHeaderContextMenu),
|
|
3436
3490
|
'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
|
|
3437
3491
|
'SearchExtensions.focusPrevious': wrapCommand(focusPrevious),
|
|
3438
3492
|
'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
|
|
@@ -3470,7 +3524,8 @@ const commandMap = {
|
|
|
3470
3524
|
'SearchExtensions.selectIndex': wrapCommand(selectIndex),
|
|
3471
3525
|
'SearchExtensions.setDeltaY': wrapCommand(setDeltaY),
|
|
3472
3526
|
'SearchExtensions.terminate': terminate,
|
|
3473
|
-
'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest)
|
|
3527
|
+
'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest),
|
|
3528
|
+
'SearchExtensions.resize': wrapCommand(resize)
|
|
3474
3529
|
};
|
|
3475
3530
|
|
|
3476
3531
|
const listen = async () => {
|