@lvce-editor/extension-search-view 2.3.0 → 2.5.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.
|
@@ -898,7 +898,7 @@ const getFinalDeltaY = (height, itemHeight, itemsLength) => {
|
|
|
898
898
|
return finalDeltaY;
|
|
899
899
|
};
|
|
900
900
|
|
|
901
|
-
const getListHeight
|
|
901
|
+
const getListHeight = (itemsLength, itemHeight, maxHeight) => {
|
|
902
902
|
number(itemsLength);
|
|
903
903
|
number(itemHeight);
|
|
904
904
|
number(maxHeight);
|
|
@@ -1139,8 +1139,7 @@ const handleInput = async (state, value) => {
|
|
|
1139
1139
|
placeholder: searchExtensionsInMarketPlace()
|
|
1140
1140
|
};
|
|
1141
1141
|
}
|
|
1142
|
-
|
|
1143
|
-
const listHeight = getListHeight$1(state);
|
|
1142
|
+
const listHeight = getListHeight(state.items.length, state.itemHeight, state.height);
|
|
1144
1143
|
const total = items.length;
|
|
1145
1144
|
const contentHeight = total * itemHeight;
|
|
1146
1145
|
const scrollBarHeight = getScrollBarSize(height, contentHeight, minimumSliderSize);
|
|
@@ -1197,7 +1196,7 @@ const create = (id, uri, x, y, width, height, platform) => {
|
|
|
1197
1196
|
searchValue: '',
|
|
1198
1197
|
minLineY: 0,
|
|
1199
1198
|
maxLineY: 0,
|
|
1200
|
-
itemHeight:
|
|
1199
|
+
itemHeight: 72,
|
|
1201
1200
|
items: [],
|
|
1202
1201
|
height,
|
|
1203
1202
|
message: '',
|
|
@@ -1208,7 +1207,6 @@ const create = (id, uri, x, y, width, height, platform) => {
|
|
|
1208
1207
|
focusedIndex: 0,
|
|
1209
1208
|
minimumSliderSize: 0,
|
|
1210
1209
|
deltaY: 0,
|
|
1211
|
-
headerHeight: 0,
|
|
1212
1210
|
scrollBarHeight: 0,
|
|
1213
1211
|
width,
|
|
1214
1212
|
size: 0,
|
|
@@ -1217,7 +1215,8 @@ const create = (id, uri, x, y, width, height, platform) => {
|
|
|
1217
1215
|
x,
|
|
1218
1216
|
y,
|
|
1219
1217
|
handleOffset: 0,
|
|
1220
|
-
assetDir: ''
|
|
1218
|
+
assetDir: '',
|
|
1219
|
+
headerHeight: 41
|
|
1221
1220
|
};
|
|
1222
1221
|
set$1(id, state, state);
|
|
1223
1222
|
};
|
|
@@ -1411,6 +1410,12 @@ const getActions = () => {
|
|
|
1411
1410
|
}];
|
|
1412
1411
|
};
|
|
1413
1412
|
|
|
1413
|
+
const commandIds = ['clearSearchResults', 'closeSuggest', 'closeSuggest', 'focusFirst', 'focusLast', 'focusNext', 'focusNextPage', 'focusPrevious', 'focusPreviousPage', 'handleBlur', 'handleBlur', 'handleBlur', 'handleContextMenu', 'handleDisable', 'handleFocus', 'handleFocus', 'handleInput', 'handleInstall', 'handleScrollBarCaptureLost', 'handleScrollBarClick', 'handleScrollBarMove', 'handleUninstall', 'handleWheel', 'openSuggest', 'openSuggest', 'render', 'saveState', 'scrollDown', 'selectIndex', 'setDeltaY', 'toggleSuggest', 'toggleSuggest'];
|
|
1414
|
+
|
|
1415
|
+
const getCommandIds = () => {
|
|
1416
|
+
return commandIds;
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1414
1419
|
const Enter = 3;
|
|
1415
1420
|
const Space = 9;
|
|
1416
1421
|
const PageUp = 10;
|
|
@@ -1694,7 +1699,7 @@ const getAllExtensions = async platform => {
|
|
|
1694
1699
|
if (platform === Web) {
|
|
1695
1700
|
return [];
|
|
1696
1701
|
}
|
|
1697
|
-
return
|
|
1702
|
+
return invoke('ExtensionManagement.getAllExtensions');
|
|
1698
1703
|
};
|
|
1699
1704
|
|
|
1700
1705
|
const Small = 1;
|
|
@@ -2139,8 +2144,7 @@ const position = (x, y) => {
|
|
|
2139
2144
|
};
|
|
2140
2145
|
|
|
2141
2146
|
const renderScrollBar$1 = newState => {
|
|
2142
|
-
|
|
2143
|
-
const listHeight = getListHeight(newState);
|
|
2147
|
+
const listHeight = getListHeight(newState.items.length, newState.itemHeight, newState.height);
|
|
2144
2148
|
const total = newState.items.length;
|
|
2145
2149
|
const contentHeight = total * newState.itemHeight;
|
|
2146
2150
|
const scrollBarHeight = getScrollBarSize(listHeight, contentHeight, newState.minimumSliderSize);
|
|
@@ -2198,6 +2202,14 @@ const doRender = (oldState, newState) => {
|
|
|
2198
2202
|
return commands;
|
|
2199
2203
|
};
|
|
2200
2204
|
|
|
2205
|
+
const render2 = uid => {
|
|
2206
|
+
const {
|
|
2207
|
+
oldState,
|
|
2208
|
+
newState
|
|
2209
|
+
} = get$1(uid);
|
|
2210
|
+
return doRender(oldState, newState);
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2201
2213
|
const getIconVirtualDom = (icon, type = Div$1) => {
|
|
2202
2214
|
return {
|
|
2203
2215
|
type,
|
|
@@ -2294,44 +2306,58 @@ const toggleSuggest = () => {
|
|
|
2294
2306
|
// TODO
|
|
2295
2307
|
};
|
|
2296
2308
|
|
|
2309
|
+
const wrapCommand = fn => {
|
|
2310
|
+
const wrapped = async (uid, ...args) => {
|
|
2311
|
+
const {
|
|
2312
|
+
newState
|
|
2313
|
+
} = get$1(uid);
|
|
2314
|
+
const newerState = await fn(newState, ...args);
|
|
2315
|
+
set$1(uid, newState, newerState);
|
|
2316
|
+
};
|
|
2317
|
+
return wrapped;
|
|
2318
|
+
};
|
|
2319
|
+
|
|
2297
2320
|
const commandMap = {
|
|
2298
|
-
'SearchExtensions.clearSearchResults': clearSearchResults,
|
|
2299
|
-
'SearchExtensions.closeSuggest': closeSuggest,
|
|
2321
|
+
'SearchExtensions.clearSearchResults': wrapCommand(clearSearchResults),
|
|
2322
|
+
'SearchExtensions.closeSuggest': wrapCommand(closeSuggest),
|
|
2300
2323
|
'SearchExtensions.create': create,
|
|
2301
2324
|
'SearchExtensions.diff': diff,
|
|
2302
|
-
'SearchExtensions.focusFirst': focusFirst,
|
|
2303
|
-
'SearchExtensions.focusIndex': focusIndex,
|
|
2304
|
-
'SearchExtensions.focusLast': focusLast,
|
|
2305
|
-
'SearchExtensions.focusNext': focusNext,
|
|
2306
|
-
'SearchExtensions.focusNextPage': focusNextPage,
|
|
2307
|
-
'SearchExtensions.focusPreviousPage': focusPreviousPage,
|
|
2325
|
+
'SearchExtensions.focusFirst': wrapCommand(focusFirst),
|
|
2326
|
+
'SearchExtensions.focusIndex': wrapCommand(focusIndex),
|
|
2327
|
+
'SearchExtensions.focusLast': wrapCommand(focusLast),
|
|
2328
|
+
'SearchExtensions.focusNext': wrapCommand(focusNext),
|
|
2329
|
+
'SearchExtensions.focusNextPage': wrapCommand(focusNextPage),
|
|
2330
|
+
'SearchExtensions.focusPreviousPage': wrapCommand(focusPreviousPage),
|
|
2308
2331
|
'SearchExtensions.getActions': getActions,
|
|
2309
2332
|
'SearchExtensions.getKeyBindings': getKeyBindings,
|
|
2310
|
-
'SearchExtensions.handleBlur': handleBlur,
|
|
2311
|
-
'SearchExtensions.
|
|
2312
|
-
'SearchExtensions.handleClick': handleClick,
|
|
2313
|
-
'SearchExtensions.handleClickCurrent': handleClickCurrent,
|
|
2314
|
-
'SearchExtensions.handleClickCurrentButKeepFocus': handleClickCurrentButKeepFocus,
|
|
2315
|
-
'SearchExtensions.
|
|
2316
|
-
'SearchExtensions.
|
|
2317
|
-
'SearchExtensions.
|
|
2318
|
-
'SearchExtensions.
|
|
2319
|
-
'SearchExtensions.
|
|
2320
|
-
'SearchExtensions.
|
|
2321
|
-
'SearchExtensions.
|
|
2322
|
-
'SearchExtensions.
|
|
2323
|
-
'SearchExtensions.
|
|
2324
|
-
'SearchExtensions.
|
|
2325
|
-
'SearchExtensions.handleWheel': handleWheel,
|
|
2333
|
+
'SearchExtensions.handleBlur': wrapCommand(handleBlur),
|
|
2334
|
+
'SearchExtensions.handleInput': wrapCommand(handleInput),
|
|
2335
|
+
'SearchExtensions.handleClick': wrapCommand(handleClick),
|
|
2336
|
+
'SearchExtensions.handleClickCurrent': wrapCommand(handleClickCurrent),
|
|
2337
|
+
'SearchExtensions.handleClickCurrentButKeepFocus': wrapCommand(handleClickCurrentButKeepFocus),
|
|
2338
|
+
'SearchExtensions.handleContextMenu': wrapCommand(handleContextMenu),
|
|
2339
|
+
'SearchExtensions.handleDisable': wrapCommand(handleDisable),
|
|
2340
|
+
'SearchExtensions.handleEnable': wrapCommand(handleEnable),
|
|
2341
|
+
'SearchExtensions.handleFocus': wrapCommand(handleFocus),
|
|
2342
|
+
'SearchExtensions.handleInstall': wrapCommand(handleInstall),
|
|
2343
|
+
'SearchExtensions.handleScrollBarCaptureLost': wrapCommand(handleScrollBarCaptureLost),
|
|
2344
|
+
'SearchExtensions.handleScrollBarClick': wrapCommand(handleScrollBarClick),
|
|
2345
|
+
'SearchExtensions.handleScrollBarMove': wrapCommand(handleScrollBarMove),
|
|
2346
|
+
'SearchExtensions.handleUninstall': wrapCommand(handleUninstall),
|
|
2347
|
+
'SearchExtensions.handleWheel': wrapCommand(handleWheel),
|
|
2326
2348
|
'SearchExtensions.loadContent': loadContent,
|
|
2327
|
-
'SearchExtensions.
|
|
2349
|
+
'SearchExtensions.getCommandIds': getCommandIds,
|
|
2350
|
+
'SearchExtensions.openSuggest': wrapCommand(openSuggest),
|
|
2328
2351
|
'SearchExtensions.render': doRender,
|
|
2352
|
+
'SearchExtensions.render2': render2,
|
|
2353
|
+
'SearchExtensions.renderActions': renderActions,
|
|
2354
|
+
'SearchExtensions.renderEventListeners': renderEventListeners,
|
|
2329
2355
|
'SearchExtensions.saveState': saveState,
|
|
2330
|
-
'SearchExtensions.scrollDown': scrollDown,
|
|
2356
|
+
'SearchExtensions.scrollDown': wrapCommand(scrollDown),
|
|
2331
2357
|
'SearchExtensions.searchExtensions': searchExtensions,
|
|
2332
|
-
'SearchExtensions.selectIndex': selectIndex,
|
|
2333
|
-
'SearchExtensions.setDeltaY': setDeltaY,
|
|
2334
|
-
'SearchExtensions.toggleSuggest': toggleSuggest
|
|
2358
|
+
'SearchExtensions.selectIndex': wrapCommand(selectIndex),
|
|
2359
|
+
'SearchExtensions.setDeltaY': wrapCommand(setDeltaY),
|
|
2360
|
+
'SearchExtensions.toggleSuggest': wrapCommand(toggleSuggest)
|
|
2335
2361
|
};
|
|
2336
2362
|
|
|
2337
2363
|
const listen = async () => {
|