@lvce-editor/extension-search-view 7.23.0 → 7.24.1
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.
|
@@ -2221,6 +2221,7 @@ const requestVersionGenerator = {
|
|
|
2221
2221
|
const getSearchResult = async state => {
|
|
2222
2222
|
const {
|
|
2223
2223
|
allExtensions,
|
|
2224
|
+
focus,
|
|
2224
2225
|
headerHeight,
|
|
2225
2226
|
height,
|
|
2226
2227
|
itemHeight,
|
|
@@ -2253,7 +2254,7 @@ const getSearchResult = async state => {
|
|
|
2253
2254
|
return {
|
|
2254
2255
|
deltaY: 0,
|
|
2255
2256
|
finalDeltaY,
|
|
2256
|
-
focus
|
|
2257
|
+
focus,
|
|
2257
2258
|
inputActions,
|
|
2258
2259
|
items,
|
|
2259
2260
|
maxLineY,
|
|
@@ -2281,7 +2282,10 @@ const handleChangeWithContext = async (context, update, waitForExtensions = true
|
|
|
2281
2282
|
try {
|
|
2282
2283
|
const result = await getSearchResult(requestState);
|
|
2283
2284
|
await context.updateState(state => {
|
|
2284
|
-
|
|
2285
|
+
const {
|
|
2286
|
+
uid
|
|
2287
|
+
} = state;
|
|
2288
|
+
if (requestVersions.get(uid) !== requestVersion) {
|
|
2285
2289
|
return state;
|
|
2286
2290
|
}
|
|
2287
2291
|
return {
|
|
@@ -2294,7 +2298,10 @@ const handleChangeWithContext = async (context, update, waitForExtensions = true
|
|
|
2294
2298
|
} catch (error) {
|
|
2295
2299
|
await handleError(error);
|
|
2296
2300
|
await context.updateState(state => {
|
|
2297
|
-
|
|
2301
|
+
const {
|
|
2302
|
+
uid
|
|
2303
|
+
} = state;
|
|
2304
|
+
if (requestVersions.get(uid) !== requestVersion) {
|
|
2298
2305
|
return state;
|
|
2299
2306
|
}
|
|
2300
2307
|
return {
|
|
@@ -2342,45 +2349,56 @@ const getCompletionText = (searchValue, completion, rangeEnd) => {
|
|
|
2342
2349
|
return completion.endsWith(':') || hasTrailingWhitespace ? completion : `${completion} `;
|
|
2343
2350
|
};
|
|
2344
2351
|
const acceptCompletionWithContext = async (context, label) => {
|
|
2345
|
-
const
|
|
2346
|
-
|
|
2352
|
+
const {
|
|
2353
|
+
completionFocusedIndex,
|
|
2354
|
+
completionItems,
|
|
2355
|
+
cursorOffset,
|
|
2356
|
+
searchValue
|
|
2357
|
+
} = context.getState();
|
|
2358
|
+
const completion = label || completionItems[completionFocusedIndex]?.label;
|
|
2347
2359
|
if (!completion) {
|
|
2348
2360
|
return;
|
|
2349
2361
|
}
|
|
2350
|
-
const range = getCompletionRange(
|
|
2362
|
+
const range = getCompletionRange(searchValue, cursorOffset);
|
|
2351
2363
|
if (!range) {
|
|
2352
2364
|
return;
|
|
2353
2365
|
}
|
|
2354
|
-
const completionText = getCompletionText(
|
|
2355
|
-
const
|
|
2366
|
+
const completionText = getCompletionText(searchValue, completion, range.end);
|
|
2367
|
+
const newSearchValue = `${searchValue.slice(0, range.start)}${completionText}${searchValue.slice(range.end)}`;
|
|
2356
2368
|
await handleChangeWithContext(context, {
|
|
2357
2369
|
completionFocusedIndex: 0,
|
|
2358
2370
|
completionItems: [],
|
|
2359
2371
|
cursorOffset: range.start + completionText.length,
|
|
2360
2372
|
focus: Input,
|
|
2361
2373
|
inputSource: Script,
|
|
2362
|
-
searchValue,
|
|
2374
|
+
searchValue: newSearchValue,
|
|
2363
2375
|
suggestOpen: false
|
|
2364
2376
|
});
|
|
2365
2377
|
};
|
|
2366
2378
|
const acceptCompletion = async (state, label) => {
|
|
2367
|
-
const
|
|
2379
|
+
const {
|
|
2380
|
+
completionFocusedIndex,
|
|
2381
|
+
completionItems,
|
|
2382
|
+
cursorOffset,
|
|
2383
|
+
searchValue
|
|
2384
|
+
} = state;
|
|
2385
|
+
const completion = label || completionItems[completionFocusedIndex]?.label;
|
|
2368
2386
|
if (!completion) {
|
|
2369
2387
|
return state;
|
|
2370
2388
|
}
|
|
2371
|
-
const range = getCompletionRange(
|
|
2389
|
+
const range = getCompletionRange(searchValue, cursorOffset);
|
|
2372
2390
|
if (!range) {
|
|
2373
2391
|
return state;
|
|
2374
2392
|
}
|
|
2375
|
-
const completionText = getCompletionText(
|
|
2376
|
-
const
|
|
2393
|
+
const completionText = getCompletionText(searchValue, completion, range.end);
|
|
2394
|
+
const newSearchValue = `${searchValue.slice(0, range.start)}${completionText}${searchValue.slice(range.end)}`;
|
|
2377
2395
|
return handleChange(state, {
|
|
2378
2396
|
completionFocusedIndex: 0,
|
|
2379
2397
|
completionItems: [],
|
|
2380
2398
|
cursorOffset: range.start + completionText.length,
|
|
2381
2399
|
focus: Input,
|
|
2382
2400
|
inputSource: Script,
|
|
2383
|
-
searchValue,
|
|
2401
|
+
searchValue: newSearchValue,
|
|
2384
2402
|
suggestOpen: false
|
|
2385
2403
|
});
|
|
2386
2404
|
};
|
|
@@ -2398,7 +2416,10 @@ const clearSearchResultsWithContext = async context => {
|
|
|
2398
2416
|
};
|
|
2399
2417
|
|
|
2400
2418
|
const closeSuggest = state => {
|
|
2401
|
-
|
|
2419
|
+
const {
|
|
2420
|
+
suggestOpen
|
|
2421
|
+
} = state;
|
|
2422
|
+
if (!suggestOpen) {
|
|
2402
2423
|
return state;
|
|
2403
2424
|
}
|
|
2404
2425
|
return {
|
|
@@ -2590,13 +2611,17 @@ const updateStatus = (extension, id, status, builtin) => {
|
|
|
2590
2611
|
};
|
|
2591
2612
|
};
|
|
2592
2613
|
const setExtensionStatus = (state, id, status, builtin) => {
|
|
2614
|
+
const {
|
|
2615
|
+
allExtensions,
|
|
2616
|
+
items
|
|
2617
|
+
} = state;
|
|
2593
2618
|
if (!isExtensionStatus(status)) {
|
|
2594
2619
|
throw new TypeError(`Invalid extension status: ${status}`);
|
|
2595
2620
|
}
|
|
2596
2621
|
return {
|
|
2597
2622
|
...state,
|
|
2598
|
-
allExtensions:
|
|
2599
|
-
items:
|
|
2623
|
+
allExtensions: allExtensions.map(extension => updateStatus(extension, id, status, builtin)),
|
|
2624
|
+
items: items.map(extension => updateStatus(extension, id, status, builtin))
|
|
2600
2625
|
};
|
|
2601
2626
|
};
|
|
2602
2627
|
|
|
@@ -4031,7 +4056,7 @@ const handleBlur = state => {
|
|
|
4031
4056
|
};
|
|
4032
4057
|
|
|
4033
4058
|
const getExtensionDetailUri = extensionId => {
|
|
4034
|
-
return `extension-detail
|
|
4059
|
+
return `extension-detail:///${encodeURIComponent(extensionId)}`;
|
|
4035
4060
|
};
|
|
4036
4061
|
|
|
4037
4062
|
const openUri = async uri => {
|
|
@@ -4077,7 +4102,10 @@ const getListIndex = (eventX, eventY, x, y, deltaY, itemHeight, headerHeight) =>
|
|
|
4077
4102
|
};
|
|
4078
4103
|
|
|
4079
4104
|
const handleCompletionPointerDown = (state, label) => {
|
|
4080
|
-
|
|
4105
|
+
const {
|
|
4106
|
+
completionItems
|
|
4107
|
+
} = state;
|
|
4108
|
+
if (completionItems.every(item => item.label !== label)) {
|
|
4081
4109
|
return Promise.resolve(state);
|
|
4082
4110
|
}
|
|
4083
4111
|
return acceptCompletion(state, label);
|
|
@@ -4653,9 +4681,13 @@ const handleUninstall = async (state, id) => {
|
|
|
4653
4681
|
};
|
|
4654
4682
|
|
|
4655
4683
|
const handleWheel = (state, deltaMode, deltaY) => {
|
|
4684
|
+
const {
|
|
4685
|
+
deltaY: currentDeltaY,
|
|
4686
|
+
scrollSensitivity
|
|
4687
|
+
} = state;
|
|
4656
4688
|
number(deltaMode);
|
|
4657
4689
|
number(deltaY);
|
|
4658
|
-
return setDeltaY(state,
|
|
4690
|
+
return setDeltaY(state, currentDeltaY + deltaY * scrollSensitivity);
|
|
4659
4691
|
};
|
|
4660
4692
|
|
|
4661
4693
|
const createExtensionManagementWorkerRpc = async () => {
|
|
@@ -4748,7 +4780,10 @@ const loadContentWithContext = async (context, savedState) => {
|
|
|
4748
4780
|
const size = getViewletSize(width);
|
|
4749
4781
|
const scrollSensitivity = getIsFirefox() ? 2.5 : 1;
|
|
4750
4782
|
await context.updateState(state => {
|
|
4751
|
-
|
|
4783
|
+
const {
|
|
4784
|
+
initial
|
|
4785
|
+
} = state;
|
|
4786
|
+
if (!initial) {
|
|
4752
4787
|
return state;
|
|
4753
4788
|
}
|
|
4754
4789
|
return {
|
|
@@ -4774,7 +4809,11 @@ const loadContentWithContext = async (context, savedState) => {
|
|
|
4774
4809
|
};
|
|
4775
4810
|
|
|
4776
4811
|
const openSuggest = state => {
|
|
4777
|
-
const
|
|
4812
|
+
const {
|
|
4813
|
+
cursorOffset,
|
|
4814
|
+
searchValue
|
|
4815
|
+
} = state;
|
|
4816
|
+
const completionItems = getCompletionItems(searchValue, cursorOffset);
|
|
4778
4817
|
if (completionItems.length === 0) {
|
|
4779
4818
|
return state;
|
|
4780
4819
|
}
|
|
@@ -5057,7 +5096,10 @@ const getTitleSuffix = searchValue => {
|
|
|
5057
5096
|
return marketplace();
|
|
5058
5097
|
};
|
|
5059
5098
|
const renderTitle = state => {
|
|
5060
|
-
|
|
5099
|
+
const {
|
|
5100
|
+
searchValue
|
|
5101
|
+
} = state;
|
|
5102
|
+
return `${extensions()}: ${getTitleSuffix(searchValue)}`;
|
|
5061
5103
|
};
|
|
5062
5104
|
|
|
5063
5105
|
const renderTitleCommand = newState => {
|
|
@@ -5297,22 +5339,32 @@ const scrollDown = state => {
|
|
|
5297
5339
|
};
|
|
5298
5340
|
|
|
5299
5341
|
const selectNextCompletion = state => {
|
|
5300
|
-
|
|
5342
|
+
const {
|
|
5343
|
+
completionFocusedIndex,
|
|
5344
|
+
completionItems,
|
|
5345
|
+
suggestOpen
|
|
5346
|
+
} = state;
|
|
5347
|
+
if (!suggestOpen || completionItems.length === 0) {
|
|
5301
5348
|
return state;
|
|
5302
5349
|
}
|
|
5303
5350
|
return {
|
|
5304
5351
|
...state,
|
|
5305
|
-
completionFocusedIndex: (
|
|
5352
|
+
completionFocusedIndex: (completionFocusedIndex + 1) % completionItems.length
|
|
5306
5353
|
};
|
|
5307
5354
|
};
|
|
5308
5355
|
|
|
5309
5356
|
const selectPreviousCompletion = state => {
|
|
5310
|
-
|
|
5357
|
+
const {
|
|
5358
|
+
completionFocusedIndex,
|
|
5359
|
+
completionItems,
|
|
5360
|
+
suggestOpen
|
|
5361
|
+
} = state;
|
|
5362
|
+
if (!suggestOpen || completionItems.length === 0) {
|
|
5311
5363
|
return state;
|
|
5312
5364
|
}
|
|
5313
5365
|
return {
|
|
5314
5366
|
...state,
|
|
5315
|
-
completionFocusedIndex: (
|
|
5367
|
+
completionFocusedIndex: (completionFocusedIndex - 1 + completionItems.length) % completionItems.length
|
|
5316
5368
|
};
|
|
5317
5369
|
};
|
|
5318
5370
|
|
|
@@ -5334,7 +5386,10 @@ const applyComponentState = (currentState, state) => {
|
|
|
5334
5386
|
const setComponentState = wrapCommand(applyComponentState);
|
|
5335
5387
|
|
|
5336
5388
|
const toggleSuggest = state => {
|
|
5337
|
-
|
|
5389
|
+
const {
|
|
5390
|
+
suggestOpen
|
|
5391
|
+
} = state;
|
|
5392
|
+
return suggestOpen ? closeSuggest(state) : openSuggest(state);
|
|
5338
5393
|
};
|
|
5339
5394
|
|
|
5340
5395
|
const handleDirectMessagePort = (port, setAsRendererProcess = true) => handleMessagePort(port, commandMap, setAsRendererProcess);
|