@lvce-editor/extension-search-view 4.11.0 → 4.13.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.
|
@@ -1138,7 +1138,7 @@ const LeftClick = 0;
|
|
|
1138
1138
|
|
|
1139
1139
|
const DebugWorker = 55;
|
|
1140
1140
|
const ExtensionHostWorker = 44;
|
|
1141
|
-
const RendererWorker$
|
|
1141
|
+
const RendererWorker$2 = 1;
|
|
1142
1142
|
|
|
1143
1143
|
const None$2 = 0;
|
|
1144
1144
|
const Input = 1;
|
|
@@ -1241,6 +1241,46 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
1241
1241
|
return finalDeltaY;
|
|
1242
1242
|
};
|
|
1243
1243
|
|
|
1244
|
+
const Button = 1;
|
|
1245
|
+
|
|
1246
|
+
const HandleClearSearchResults = 1;
|
|
1247
|
+
const HandleClickFilter = 2;
|
|
1248
|
+
const HandleContextMenu = 3;
|
|
1249
|
+
const HandleExtensionsInput = 4;
|
|
1250
|
+
const HandleFocus = 5;
|
|
1251
|
+
const HandlePointerDown = 7;
|
|
1252
|
+
const HandleScrollBarMove = 9;
|
|
1253
|
+
const HandleScrollBarPointerCaptureLost = 10;
|
|
1254
|
+
const HandleScrollBarPointerDown = 11;
|
|
1255
|
+
const HandleTouchEnd = 12;
|
|
1256
|
+
const HandleTouchMove = 13;
|
|
1257
|
+
const HandleTouchStart = 14;
|
|
1258
|
+
const HandleWheel = 15;
|
|
1259
|
+
const HandleHeaderContextMenu = 16;
|
|
1260
|
+
|
|
1261
|
+
const ClearAll = 'ClearAll';
|
|
1262
|
+
const Filter = 'Filter';
|
|
1263
|
+
const Refresh = 'Refresh';
|
|
1264
|
+
const Ellipsis = 'Ellipsis';
|
|
1265
|
+
|
|
1266
|
+
const getInputActions = hasValue => {
|
|
1267
|
+
const clearEnabled = hasValue;
|
|
1268
|
+
const actions = [{
|
|
1269
|
+
onClick: HandleClearSearchResults,
|
|
1270
|
+
icon: `MaskIcon${ClearAll}`,
|
|
1271
|
+
title: clearExtensionSearchResults(),
|
|
1272
|
+
type: Button,
|
|
1273
|
+
enabled: clearEnabled
|
|
1274
|
+
}, {
|
|
1275
|
+
icon: `MaskIcon${Filter}`,
|
|
1276
|
+
title: filter(),
|
|
1277
|
+
type: Button,
|
|
1278
|
+
onClick: HandleClickFilter,
|
|
1279
|
+
enabled: true
|
|
1280
|
+
}];
|
|
1281
|
+
return actions;
|
|
1282
|
+
};
|
|
1283
|
+
|
|
1244
1284
|
const getListHeight = (itemsLength, itemHeight, maxHeight) => {
|
|
1245
1285
|
number(itemsLength);
|
|
1246
1286
|
number(itemHeight);
|
|
@@ -1266,9 +1306,6 @@ const getScrollBarSize = (size, contentSize, minimumSliderSize) => {
|
|
|
1266
1306
|
return Math.max(Math.round(size ** 2 / contentSize), minimumSliderSize);
|
|
1267
1307
|
};
|
|
1268
1308
|
|
|
1269
|
-
const User = 1;
|
|
1270
|
-
const Script = 2;
|
|
1271
|
-
|
|
1272
1309
|
const getScrollBarY$1 = (delta, finalDelta, size, scrollBarSize) => {
|
|
1273
1310
|
if (finalDelta === 0) {
|
|
1274
1311
|
return 0;
|
|
@@ -1419,8 +1456,18 @@ const searchExtensions = async (extensions, value, platform, assetDir) => {
|
|
|
1419
1456
|
};
|
|
1420
1457
|
|
|
1421
1458
|
// TODO debounce
|
|
1422
|
-
const
|
|
1459
|
+
const handleChange = async (state, update) => {
|
|
1460
|
+
const fullNewState = {
|
|
1461
|
+
...state,
|
|
1462
|
+
...update
|
|
1463
|
+
};
|
|
1423
1464
|
try {
|
|
1465
|
+
const value = fullNewState.searchValue;
|
|
1466
|
+
const {
|
|
1467
|
+
inputSource
|
|
1468
|
+
} = fullNewState;
|
|
1469
|
+
const hasValue = value.length > 0;
|
|
1470
|
+
const inputActions = getInputActions(hasValue);
|
|
1424
1471
|
const {
|
|
1425
1472
|
allExtensions,
|
|
1426
1473
|
itemHeight,
|
|
@@ -1447,7 +1494,8 @@ const handleInput = async (state, value, inputSource = User) => {
|
|
|
1447
1494
|
placeholder: searchExtensionsInMarketPlace(),
|
|
1448
1495
|
scrollBarHeight: 0,
|
|
1449
1496
|
searchValue: value,
|
|
1450
|
-
inputSource
|
|
1497
|
+
inputSource,
|
|
1498
|
+
inputActions
|
|
1451
1499
|
};
|
|
1452
1500
|
}
|
|
1453
1501
|
const total = items.length;
|
|
@@ -1471,7 +1519,8 @@ const handleInput = async (state, value, inputSource = User) => {
|
|
|
1471
1519
|
scrollBarHeight,
|
|
1472
1520
|
scrollBarY,
|
|
1473
1521
|
searchValue: value,
|
|
1474
|
-
inputSource
|
|
1522
|
+
inputSource,
|
|
1523
|
+
inputActions
|
|
1475
1524
|
};
|
|
1476
1525
|
|
|
1477
1526
|
// TODO handle out of order responses (a bit complicated)
|
|
@@ -1480,18 +1529,19 @@ const handleInput = async (state, value, inputSource = User) => {
|
|
|
1480
1529
|
// TODO send error to error worker
|
|
1481
1530
|
await handleError(error);
|
|
1482
1531
|
return {
|
|
1483
|
-
...
|
|
1484
|
-
searchValue: value,
|
|
1532
|
+
...fullNewState,
|
|
1485
1533
|
message: `${error}`
|
|
1486
1534
|
};
|
|
1487
1535
|
}
|
|
1488
1536
|
};
|
|
1489
1537
|
|
|
1490
1538
|
const clearSearchResults = state => {
|
|
1491
|
-
return
|
|
1539
|
+
return handleChange(state, {
|
|
1492
1540
|
...state,
|
|
1493
|
-
focus: Input
|
|
1494
|
-
|
|
1541
|
+
focus: Input,
|
|
1542
|
+
searchValue: '',
|
|
1543
|
+
inputSource: Script$1
|
|
1544
|
+
});
|
|
1495
1545
|
};
|
|
1496
1546
|
|
|
1497
1547
|
const closeSuggest = state => {
|
|
@@ -1573,7 +1623,7 @@ const {
|
|
|
1573
1623
|
invokeAndTransfer,
|
|
1574
1624
|
set: set$3,
|
|
1575
1625
|
dispose: dispose$2
|
|
1576
|
-
} = create$1(RendererWorker$
|
|
1626
|
+
} = create$1(RendererWorker$2);
|
|
1577
1627
|
const searchFileHtml = async uri => {
|
|
1578
1628
|
return invoke$2('ExtensionHost.searchFileWithHtml', uri);
|
|
1579
1629
|
};
|
|
@@ -1583,6 +1633,10 @@ const getFilePathElectron = async file => {
|
|
|
1583
1633
|
const showContextMenu$1 = async (x, y, id, ...args) => {
|
|
1584
1634
|
return invoke$2('ContextMenu.show', x, y, id, ...args);
|
|
1585
1635
|
};
|
|
1636
|
+
const showContextMenu2 = async (uid, menuId, x, y, args) => {
|
|
1637
|
+
// @ts-ignore
|
|
1638
|
+
await RendererWorker.invoke('ContextMenu.show2', uid, menuId, x, y, args);
|
|
1639
|
+
};
|
|
1586
1640
|
const getElectronVersion = async () => {
|
|
1587
1641
|
return invoke$2('Process.getElectronVersion');
|
|
1588
1642
|
};
|
|
@@ -1812,7 +1866,7 @@ const openExtensionSearch = async () => {
|
|
|
1812
1866
|
};
|
|
1813
1867
|
const setExtensionsSearchValue = async searchValue => {
|
|
1814
1868
|
// @ts-ignore
|
|
1815
|
-
return invoke$2('Extensions.handleInput', searchValue);
|
|
1869
|
+
return invoke$2('Extensions.handleInput', searchValue, Script$1);
|
|
1816
1870
|
};
|
|
1817
1871
|
const openExternal = async uri => {
|
|
1818
1872
|
// @ts-ignore
|
|
@@ -1842,7 +1896,7 @@ const registerMockRpc = commandMap => {
|
|
|
1842
1896
|
return mockRpc;
|
|
1843
1897
|
};
|
|
1844
1898
|
|
|
1845
|
-
const RendererWorker = {
|
|
1899
|
+
const RendererWorker$1 = {
|
|
1846
1900
|
__proto__: null,
|
|
1847
1901
|
activateByEvent,
|
|
1848
1902
|
applyBulkReplacement,
|
|
@@ -1914,6 +1968,7 @@ const RendererWorker = {
|
|
|
1914
1968
|
setWebViewPort,
|
|
1915
1969
|
setWorkspacePath,
|
|
1916
1970
|
showContextMenu: showContextMenu$1,
|
|
1971
|
+
showContextMenu2,
|
|
1917
1972
|
showErrorDialog,
|
|
1918
1973
|
showMessageBox,
|
|
1919
1974
|
showSaveFilePicker,
|
|
@@ -2048,13 +2103,16 @@ const isEqual$2 = (oldState, newState) => {
|
|
|
2048
2103
|
if (!newState.focus) {
|
|
2049
2104
|
return true;
|
|
2050
2105
|
}
|
|
2051
|
-
return oldState.focus === newState.focus;
|
|
2106
|
+
return oldState.focus === newState.focus && oldState.inputSource === newState.inputSource;
|
|
2052
2107
|
};
|
|
2053
2108
|
|
|
2054
2109
|
const isEqual$1 = (oldState, newState) => {
|
|
2055
2110
|
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
2111
|
};
|
|
2057
2112
|
|
|
2113
|
+
const User = 1;
|
|
2114
|
+
const Script = 2;
|
|
2115
|
+
|
|
2058
2116
|
const isEqual = (oldState, newState) => {
|
|
2059
2117
|
return newState.inputSource === User || oldState.searchValue === newState.searchValue;
|
|
2060
2118
|
};
|
|
@@ -2104,6 +2162,7 @@ const focusIndexScrollDown = (state, index, listHeight, itemHeight, itemsLength)
|
|
|
2104
2162
|
return {
|
|
2105
2163
|
...state,
|
|
2106
2164
|
focusedIndex: index,
|
|
2165
|
+
listFocusedIndex: index,
|
|
2107
2166
|
minLineY: newMinLineY,
|
|
2108
2167
|
maxLineY: newMaxLineY,
|
|
2109
2168
|
focused: true,
|
|
@@ -2126,6 +2185,7 @@ const focusIndexScrollUp = (state, index, listHeight, itemHeight, itemsLength) =
|
|
|
2126
2185
|
return {
|
|
2127
2186
|
...state,
|
|
2128
2187
|
focusedIndex: index,
|
|
2188
|
+
listFocusedIndex: index,
|
|
2129
2189
|
minLineY: newMinLineY,
|
|
2130
2190
|
maxLineY: newMaxLineY,
|
|
2131
2191
|
focused: true,
|
|
@@ -2151,6 +2211,7 @@ const focusIndex = (state, index) => {
|
|
|
2151
2211
|
return {
|
|
2152
2212
|
...state,
|
|
2153
2213
|
focusedIndex: -1,
|
|
2214
|
+
listFocusedIndex: -1,
|
|
2154
2215
|
focused: true
|
|
2155
2216
|
};
|
|
2156
2217
|
}
|
|
@@ -2164,6 +2225,7 @@ const focusIndex = (state, index) => {
|
|
|
2164
2225
|
return {
|
|
2165
2226
|
...state,
|
|
2166
2227
|
focusedIndex: index,
|
|
2228
|
+
listFocusedIndex: index,
|
|
2167
2229
|
focused: true
|
|
2168
2230
|
};
|
|
2169
2231
|
};
|
|
@@ -2244,13 +2306,6 @@ const focusPreviousPage = state => {
|
|
|
2244
2306
|
return focusIndex(state, indexPreviousPage);
|
|
2245
2307
|
};
|
|
2246
2308
|
|
|
2247
|
-
const Button = 1;
|
|
2248
|
-
|
|
2249
|
-
const ClearAll = 'ClearAll';
|
|
2250
|
-
const Filter = 'Filter';
|
|
2251
|
-
const Refresh = 'Refresh';
|
|
2252
|
-
const Ellipsis = 'Ellipsis';
|
|
2253
|
-
|
|
2254
2309
|
const getActions = () => {
|
|
2255
2310
|
return [{
|
|
2256
2311
|
type: Button,
|
|
@@ -2371,7 +2426,7 @@ const {
|
|
|
2371
2426
|
showContextMenu,
|
|
2372
2427
|
openUri: openUri$1,
|
|
2373
2428
|
sendMessagePortToExtensionHostWorker: sendMessagePortToExtensionHostWorker$1
|
|
2374
|
-
} = RendererWorker;
|
|
2429
|
+
} = RendererWorker$1;
|
|
2375
2430
|
|
|
2376
2431
|
const openUri = async uri => {
|
|
2377
2432
|
return openUri$1(uri);
|
|
@@ -2477,6 +2532,13 @@ const handleHeaderContextMenu = async state => {
|
|
|
2477
2532
|
return state;
|
|
2478
2533
|
};
|
|
2479
2534
|
|
|
2535
|
+
const handleInput = async (state, value, inputSource = User) => {
|
|
2536
|
+
return handleChange(state, {
|
|
2537
|
+
searchValue: value,
|
|
2538
|
+
inputSource
|
|
2539
|
+
});
|
|
2540
|
+
};
|
|
2541
|
+
|
|
2480
2542
|
// TODO show error / warning when installment fails / times out
|
|
2481
2543
|
const handleInstall = async (state, id) => {
|
|
2482
2544
|
return state;
|
|
@@ -2671,42 +2733,6 @@ const getAllExtensions = platform => {
|
|
|
2671
2733
|
return getAllExtensions$1(platform);
|
|
2672
2734
|
};
|
|
2673
2735
|
|
|
2674
|
-
const HandleClearSearchResults = 1;
|
|
2675
|
-
const HandleClickFilter = 2;
|
|
2676
|
-
const HandleContextMenu = 3;
|
|
2677
|
-
const HandleExtensionsInput = 4;
|
|
2678
|
-
const HandleFocus = 5;
|
|
2679
|
-
const HandlePointerDown = 7;
|
|
2680
|
-
const HandleScrollBarMove = 9;
|
|
2681
|
-
const HandleScrollBarPointerCaptureLost = 10;
|
|
2682
|
-
const HandleScrollBarPointerDown = 11;
|
|
2683
|
-
const HandleTouchEnd = 12;
|
|
2684
|
-
const HandleTouchMove = 13;
|
|
2685
|
-
const HandleTouchStart = 14;
|
|
2686
|
-
const HandleWheel = 15;
|
|
2687
|
-
const HandleHeaderContextMenu = 16;
|
|
2688
|
-
|
|
2689
|
-
const getInputActions = newState => {
|
|
2690
|
-
const {
|
|
2691
|
-
searchValue
|
|
2692
|
-
} = newState;
|
|
2693
|
-
const clearEnabled = searchValue.length > 0;
|
|
2694
|
-
const actions = [{
|
|
2695
|
-
onClick: HandleClearSearchResults,
|
|
2696
|
-
icon: `MaskIcon${ClearAll}`,
|
|
2697
|
-
title: clearExtensionSearchResults(),
|
|
2698
|
-
type: Button,
|
|
2699
|
-
enabled: clearEnabled
|
|
2700
|
-
}, {
|
|
2701
|
-
icon: `MaskIcon${Filter}`,
|
|
2702
|
-
title: filter(),
|
|
2703
|
-
type: Button,
|
|
2704
|
-
onClick: HandleClickFilter,
|
|
2705
|
-
enabled: true
|
|
2706
|
-
}];
|
|
2707
|
-
return actions;
|
|
2708
|
-
};
|
|
2709
|
-
|
|
2710
2736
|
const Small = 1;
|
|
2711
2737
|
const Normal = 2;
|
|
2712
2738
|
const Large = 3;
|
|
@@ -2871,13 +2897,11 @@ const loadContent = async (state, savedState) => {
|
|
|
2871
2897
|
const allExtensions = await getAllExtensions(platform);
|
|
2872
2898
|
const size = getViewletSize(width);
|
|
2873
2899
|
const normalized = normalizeExtension(allExtensions, platform, assetDir);
|
|
2874
|
-
const inputActions = getInputActions(state);
|
|
2875
2900
|
const updatedState = await handleInput({
|
|
2876
2901
|
...state,
|
|
2877
2902
|
allExtensions: normalized,
|
|
2878
2903
|
size,
|
|
2879
2904
|
inputSource: Script,
|
|
2880
|
-
inputActions,
|
|
2881
2905
|
deltaY
|
|
2882
2906
|
}, searchValue, Script);
|
|
2883
2907
|
return updatedState;
|
|
@@ -3033,7 +3057,7 @@ const getExtensionHeaderVirtualDom = (placeholder, actions) => {
|
|
|
3033
3057
|
};
|
|
3034
3058
|
|
|
3035
3059
|
const renderHeader = newState => {
|
|
3036
|
-
const actions = getInputActions(newState);
|
|
3060
|
+
const actions = getInputActions(newState.searchValue.length > 0);
|
|
3037
3061
|
const dom = getExtensionHeaderVirtualDom(newState.placeholder, actions);
|
|
3038
3062
|
return ['setHeaderDom', dom];
|
|
3039
3063
|
};
|