@lvce-editor/editor-worker 6.2.0 → 6.3.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.
- package/dist/editorWorkerMain.js +299 -966
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -365,16 +365,16 @@ const send = (transport, method, ...params) => {
|
|
|
365
365
|
const message = create$4$1(method, params);
|
|
366
366
|
transport.send(message);
|
|
367
367
|
};
|
|
368
|
-
const invoke$
|
|
368
|
+
const invoke$9 = (ipc, method, ...params) => {
|
|
369
369
|
return invokeHelper(ipc, method, params, false);
|
|
370
370
|
};
|
|
371
371
|
const invokeAndTransfer$2 = (ipc, method, ...params) => {
|
|
372
372
|
return invokeHelper(ipc, method, params, true);
|
|
373
373
|
};
|
|
374
374
|
|
|
375
|
-
const invoke$
|
|
375
|
+
const invoke$8 = async (method, ...params) => {
|
|
376
376
|
const ipc = get$7();
|
|
377
|
-
return invoke$
|
|
377
|
+
return invoke$9(ipc, method, ...params);
|
|
378
378
|
};
|
|
379
379
|
const invokeAndTransfer$1 = async (method, ...params) => {
|
|
380
380
|
const ipc = get$7();
|
|
@@ -384,8 +384,8 @@ const listen$5 = ipc => {
|
|
|
384
384
|
set$7(ipc);
|
|
385
385
|
};
|
|
386
386
|
|
|
387
|
-
const invoke$
|
|
388
|
-
return invoke$
|
|
387
|
+
const invoke$7 = async (method, ...params) => {
|
|
388
|
+
return invoke$8(method, ...params);
|
|
389
389
|
};
|
|
390
390
|
const invokeAndTransfer = async (method, ...params) => {
|
|
391
391
|
return invokeAndTransfer$1(method, ...params);
|
|
@@ -393,7 +393,7 @@ const invokeAndTransfer = async (method, ...params) => {
|
|
|
393
393
|
|
|
394
394
|
// TODO add tests for this
|
|
395
395
|
const activateByEvent = async event => {
|
|
396
|
-
await invoke$
|
|
396
|
+
await invoke$7('ExtensionHostManagement.activateByEvent', event);
|
|
397
397
|
};
|
|
398
398
|
|
|
399
399
|
const codeGeneratorAccept = state => {
|
|
@@ -981,7 +981,7 @@ const createRpc$1 = ipc => {
|
|
|
981
981
|
send(ipc, method, ...params);
|
|
982
982
|
},
|
|
983
983
|
invoke(method, ...params) {
|
|
984
|
-
return invoke$
|
|
984
|
+
return invoke$9(ipc, method, ...params);
|
|
985
985
|
},
|
|
986
986
|
invokeAndTransfer(method, ...params) {
|
|
987
987
|
return invokeAndTransfer$2(ipc, method, ...params);
|
|
@@ -1070,15 +1070,15 @@ const launchColorPickerWorker = async () => {
|
|
|
1070
1070
|
return rpc;
|
|
1071
1071
|
};
|
|
1072
1072
|
|
|
1073
|
-
let workerPromise$
|
|
1074
|
-
const getOrCreate$
|
|
1075
|
-
if (!workerPromise$
|
|
1076
|
-
workerPromise$
|
|
1073
|
+
let workerPromise$3;
|
|
1074
|
+
const getOrCreate$4 = () => {
|
|
1075
|
+
if (!workerPromise$3) {
|
|
1076
|
+
workerPromise$3 = launchColorPickerWorker();
|
|
1077
1077
|
}
|
|
1078
|
-
return workerPromise$
|
|
1078
|
+
return workerPromise$3;
|
|
1079
1079
|
};
|
|
1080
|
-
const invoke$
|
|
1081
|
-
const worker = await getOrCreate$
|
|
1080
|
+
const invoke$6 = async (method, ...params) => {
|
|
1081
|
+
const worker = await getOrCreate$4();
|
|
1082
1082
|
return await worker.invoke(method, ...params);
|
|
1083
1083
|
};
|
|
1084
1084
|
|
|
@@ -1090,10 +1090,10 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
1090
1090
|
width,
|
|
1091
1091
|
height
|
|
1092
1092
|
} = state;
|
|
1093
|
-
await invoke$
|
|
1094
|
-
await invoke$
|
|
1095
|
-
const diff = await invoke$
|
|
1096
|
-
const commands = await invoke$
|
|
1093
|
+
await invoke$6('ColorPicker.create', uid, x, y, width, height, parentUid);
|
|
1094
|
+
await invoke$6('ColorPicker.loadContent', uid);
|
|
1095
|
+
const diff = await invoke$6('ColorPicker.diff2', uid);
|
|
1096
|
+
const commands = await invoke$6('ColorPicker.render2', uid, diff);
|
|
1097
1097
|
return {
|
|
1098
1098
|
...state,
|
|
1099
1099
|
commands
|
|
@@ -1115,7 +1115,6 @@ const IndentLess = 'indentLess';
|
|
|
1115
1115
|
const IndentMore = 'indentMore';
|
|
1116
1116
|
const InsertLineBreak = 'insertLineBreak';
|
|
1117
1117
|
const LineComment = 'lineComment';
|
|
1118
|
-
const ReplaceAll$2 = 'replaceAll';
|
|
1119
1118
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1120
1119
|
|
|
1121
1120
|
const map$1 = Object.create(null);
|
|
@@ -1489,7 +1488,7 @@ const createMeasureContext = () => {
|
|
|
1489
1488
|
const state$8 = {
|
|
1490
1489
|
ctx: undefined
|
|
1491
1490
|
};
|
|
1492
|
-
const getOrCreate$
|
|
1491
|
+
const getOrCreate$3 = createCtx => {
|
|
1493
1492
|
if (state$8.ctx) {
|
|
1494
1493
|
return state$8.ctx;
|
|
1495
1494
|
}
|
|
@@ -1498,7 +1497,7 @@ const getOrCreate$1 = createCtx => {
|
|
|
1498
1497
|
};
|
|
1499
1498
|
|
|
1500
1499
|
const getContext = () => {
|
|
1501
|
-
const ctx = getOrCreate$
|
|
1500
|
+
const ctx = getOrCreate$3(createMeasureContext);
|
|
1502
1501
|
return ctx;
|
|
1503
1502
|
};
|
|
1504
1503
|
|
|
@@ -2305,7 +2304,7 @@ const createRpc = method => {
|
|
|
2305
2304
|
_ipc = ipc;
|
|
2306
2305
|
};
|
|
2307
2306
|
const invoke = async (method, ...params) => {
|
|
2308
|
-
return invoke$
|
|
2307
|
+
return invoke$9(_ipc, method, ...params);
|
|
2309
2308
|
};
|
|
2310
2309
|
const invokeAndTransfer = async (method, ...params) => {
|
|
2311
2310
|
return invokeAndTransfer$2(_ipc, method, ...params);
|
|
@@ -2319,7 +2318,7 @@ const createRpc = method => {
|
|
|
2319
2318
|
|
|
2320
2319
|
const {
|
|
2321
2320
|
listen: listen$4,
|
|
2322
|
-
invoke: invoke$
|
|
2321
|
+
invoke: invoke$5} = createRpc(ExtensionHostWorker);
|
|
2323
2322
|
|
|
2324
2323
|
const ColorPicker$1 = 41;
|
|
2325
2324
|
const CompletionDetail$1 = 999;
|
|
@@ -2328,13 +2327,6 @@ const Empty = 0;
|
|
|
2328
2327
|
const FindWidget = 16;
|
|
2329
2328
|
const FocusEditorHover = 51;
|
|
2330
2329
|
const FocusEditorRename$1 = 11;
|
|
2331
|
-
const FocusFindWidgetCloseButton$1 = 48;
|
|
2332
|
-
const FocusFindWidgetNextMatchButton$1 = 49;
|
|
2333
|
-
const FocusFindWidgetPreviousMatchButton$1 = 50;
|
|
2334
|
-
const FocusFindWidgetReplace$1 = 43;
|
|
2335
|
-
const FocusFindWidgetReplaceAllButton$1 = 47;
|
|
2336
|
-
const FocusFindWidgetReplaceButton$1 = 46;
|
|
2337
|
-
const FocusFindWidgetToggleReplace = 42;
|
|
2338
2330
|
const SourceActions = 38;
|
|
2339
2331
|
const FocusCodeGenerator = 52;
|
|
2340
2332
|
|
|
@@ -2357,7 +2349,7 @@ const execute = async ({
|
|
|
2357
2349
|
}) => {
|
|
2358
2350
|
const fullEvent = `${event}:${editor.languageId}`;
|
|
2359
2351
|
await activateByEvent(fullEvent);
|
|
2360
|
-
const result = await invoke$
|
|
2352
|
+
const result = await invoke$5(method, editor.uid, ...args);
|
|
2361
2353
|
return result;
|
|
2362
2354
|
};
|
|
2363
2355
|
|
|
@@ -2424,7 +2416,7 @@ const updateDiagnostics = async newState => {
|
|
|
2424
2416
|
|
|
2425
2417
|
// TODO don't really need text document sync response
|
|
2426
2418
|
// could perhaps save a lot of messages by using send instead of invoke
|
|
2427
|
-
await invoke$
|
|
2419
|
+
await invoke$5(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
2428
2420
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
2429
2421
|
const latest = get$4(newState.id);
|
|
2430
2422
|
if (!latest) {
|
|
@@ -2437,7 +2429,7 @@ const updateDiagnostics = async newState => {
|
|
|
2437
2429
|
decorations
|
|
2438
2430
|
};
|
|
2439
2431
|
set$4(newState.id, latest.oldState, newEditor);
|
|
2440
|
-
await invoke$
|
|
2432
|
+
await invoke$7('Editor.rerender', newState.id);
|
|
2441
2433
|
return newEditor;
|
|
2442
2434
|
} catch (error) {
|
|
2443
2435
|
// @ts-ignore
|
|
@@ -2571,7 +2563,7 @@ const createEditor = async ({
|
|
|
2571
2563
|
focused: true
|
|
2572
2564
|
};
|
|
2573
2565
|
set$4(id, emptyEditor, newEditor4);
|
|
2574
|
-
await invoke$
|
|
2566
|
+
await invoke$5(TextDocumentSyncFull, uri, id, languageId, content);
|
|
2575
2567
|
if (diagnosticsEnabled) {
|
|
2576
2568
|
updateDiagnostics(newEditor4);
|
|
2577
2569
|
}
|
|
@@ -2640,7 +2632,7 @@ const applyEdit = async (editor, changes) => {
|
|
|
2640
2632
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2641
2633
|
};
|
|
2642
2634
|
|
|
2643
|
-
const handleBlur
|
|
2635
|
+
const handleBlur = editor => {
|
|
2644
2636
|
if (editor.focusKey !== Empty) {
|
|
2645
2637
|
return editor;
|
|
2646
2638
|
}
|
|
@@ -2882,7 +2874,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
2882
2874
|
const x$1 = x(editor, rowIndex, columnIndex);
|
|
2883
2875
|
const y$1 = y(editor, rowIndex);
|
|
2884
2876
|
const displayErrorMessage = message;
|
|
2885
|
-
await invoke$
|
|
2877
|
+
await invoke$7('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
2886
2878
|
if (!isError) {
|
|
2887
2879
|
const handleTimeout = () => {
|
|
2888
2880
|
editorHideMessage(editor);
|
|
@@ -2938,7 +2930,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
2938
2930
|
try {
|
|
2939
2931
|
// @ts-ignore
|
|
2940
2932
|
const offset = offsetAt(editor, editor.cursor);
|
|
2941
|
-
const result = await invoke$
|
|
2933
|
+
const result = await invoke$7('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
2942
2934
|
if (result) {
|
|
2943
2935
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
2944
2936
|
const insertText = text + closingBrace;
|
|
@@ -3095,14 +3087,14 @@ const hasWidget = (widgets, id) => {
|
|
|
3095
3087
|
};
|
|
3096
3088
|
|
|
3097
3089
|
const setAdditionalFocus = async focusKey => {
|
|
3098
|
-
await invoke$
|
|
3090
|
+
await invoke$7('Focus.setAdditionalFocus', focusKey);
|
|
3099
3091
|
};
|
|
3100
3092
|
|
|
3101
3093
|
const setFocus = async focusKey => {
|
|
3102
3094
|
if (!focusKey) {
|
|
3103
3095
|
return;
|
|
3104
3096
|
}
|
|
3105
|
-
await invoke$
|
|
3097
|
+
await invoke$7('Focus.setFocus', focusKey);
|
|
3106
3098
|
};
|
|
3107
3099
|
|
|
3108
3100
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
@@ -3163,11 +3155,11 @@ const create$7 = () => {
|
|
|
3163
3155
|
return widget;
|
|
3164
3156
|
};
|
|
3165
3157
|
|
|
3166
|
-
const newStateGenerator$
|
|
3158
|
+
const newStateGenerator$4 = (state, parentUid) => {
|
|
3167
3159
|
return loadContent$3(state, parentUid);
|
|
3168
3160
|
};
|
|
3169
3161
|
const openColorPicker = async editor => {
|
|
3170
|
-
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$7, newStateGenerator$
|
|
3162
|
+
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$7, newStateGenerator$4);
|
|
3171
3163
|
};
|
|
3172
3164
|
|
|
3173
3165
|
const state$6 = {
|
|
@@ -3223,7 +3215,7 @@ const compositionEnd = (editor, data) => {
|
|
|
3223
3215
|
const writeText = async text => {
|
|
3224
3216
|
try {
|
|
3225
3217
|
string(text);
|
|
3226
|
-
await invoke$
|
|
3218
|
+
await invoke$7('ClipBoard.writeText', /* text */text);
|
|
3227
3219
|
} catch (error) {
|
|
3228
3220
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
3229
3221
|
}
|
|
@@ -3857,7 +3849,7 @@ const deleteWordRight = editor => {
|
|
|
3857
3849
|
};
|
|
3858
3850
|
|
|
3859
3851
|
const findAllReferences = async editor => {
|
|
3860
|
-
await invoke$
|
|
3852
|
+
await invoke$7('SideBar.show', 'References', /* focus */true);
|
|
3861
3853
|
return editor;
|
|
3862
3854
|
};
|
|
3863
3855
|
|
|
@@ -3987,7 +3979,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
3987
3979
|
|
|
3988
3980
|
// @ts-ignore
|
|
3989
3981
|
const getDefinition = async (editor, offset) => {
|
|
3990
|
-
const definition = await invoke$
|
|
3982
|
+
const definition = await invoke$7('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
3991
3983
|
return definition;
|
|
3992
3984
|
};
|
|
3993
3985
|
|
|
@@ -4050,7 +4042,7 @@ const noTypeDefinitionFoundFor = word => {
|
|
|
4050
4042
|
const noTypeDefinitionFound = () => {
|
|
4051
4043
|
return i18nString(NoTypeDefinitionFound);
|
|
4052
4044
|
};
|
|
4053
|
-
const noResults
|
|
4045
|
+
const noResults = () => {
|
|
4054
4046
|
return i18nString(NoResults);
|
|
4055
4047
|
};
|
|
4056
4048
|
const sourceAction = () => {
|
|
@@ -4174,7 +4166,7 @@ const goTo = async ({
|
|
|
4174
4166
|
endRowIndex: definition.endRowIndex,
|
|
4175
4167
|
endColumnIndex: definition.endColumnIndex
|
|
4176
4168
|
};
|
|
4177
|
-
await invoke$
|
|
4169
|
+
await invoke$7(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
4178
4170
|
return editor;
|
|
4179
4171
|
} catch (error) {
|
|
4180
4172
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -4251,7 +4243,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
4251
4243
|
};
|
|
4252
4244
|
|
|
4253
4245
|
const getTypeDefinition = async (editor, offset) => {
|
|
4254
|
-
const definition = await invoke$
|
|
4246
|
+
const definition = await invoke$7('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
4255
4247
|
return definition;
|
|
4256
4248
|
};
|
|
4257
4249
|
|
|
@@ -4291,7 +4283,7 @@ const goToTypeDefinition = async (editor, explicit = true) => {
|
|
|
4291
4283
|
const Editor = 3;
|
|
4292
4284
|
|
|
4293
4285
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
4294
|
-
await invoke$
|
|
4286
|
+
await invoke$7(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
|
|
4295
4287
|
return editor;
|
|
4296
4288
|
};
|
|
4297
4289
|
|
|
@@ -4329,7 +4321,7 @@ const WhenExpressionEditorText = 12;
|
|
|
4329
4321
|
const handleFocus = editor => {
|
|
4330
4322
|
// TODO make change events functional,
|
|
4331
4323
|
// when rendering, send focus changes to renderer worker
|
|
4332
|
-
invoke$
|
|
4324
|
+
invoke$7('Focus.setFocus', WhenExpressionEditorText);
|
|
4333
4325
|
return editor;
|
|
4334
4326
|
};
|
|
4335
4327
|
|
|
@@ -4990,7 +4982,7 @@ const indentMore = editor => {
|
|
|
4990
4982
|
};
|
|
4991
4983
|
|
|
4992
4984
|
const getLanguageConfiguration = async editor => {
|
|
4993
|
-
return invoke$
|
|
4985
|
+
return invoke$7('Languages.getLanguageConfiguration', {
|
|
4994
4986
|
uri: editor.uri,
|
|
4995
4987
|
languageId: editor.languageId
|
|
4996
4988
|
});
|
|
@@ -5262,7 +5254,6 @@ const moveSelectionPx = (editor, x, y) => {
|
|
|
5262
5254
|
return editorMoveSelection(editor, position);
|
|
5263
5255
|
};
|
|
5264
5256
|
|
|
5265
|
-
const User = 1;
|
|
5266
5257
|
const Script = 2;
|
|
5267
5258
|
const Unknown$1 = 0;
|
|
5268
5259
|
|
|
@@ -5294,7 +5285,7 @@ const create$6 = () => {
|
|
|
5294
5285
|
return widget;
|
|
5295
5286
|
};
|
|
5296
5287
|
|
|
5297
|
-
const newStateGenerator$
|
|
5288
|
+
const newStateGenerator$3 = async state => {
|
|
5298
5289
|
const latestState = {
|
|
5299
5290
|
...state,
|
|
5300
5291
|
x: 100,
|
|
@@ -5306,7 +5297,7 @@ const newStateGenerator$2 = async state => {
|
|
|
5306
5297
|
};
|
|
5307
5298
|
const openCodeGenerator = async editor => {
|
|
5308
5299
|
const fullFocus = true;
|
|
5309
|
-
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$6, newStateGenerator$
|
|
5300
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$6, newStateGenerator$3, fullFocus);
|
|
5310
5301
|
};
|
|
5311
5302
|
|
|
5312
5303
|
const create$5 = () => {
|
|
@@ -5822,337 +5813,82 @@ const create$4 = () => {
|
|
|
5822
5813
|
const widget = {
|
|
5823
5814
|
id: Find,
|
|
5824
5815
|
oldState: {
|
|
5825
|
-
value: '',
|
|
5826
|
-
ariaAnnouncement: '',
|
|
5827
|
-
matches: new Uint32Array(),
|
|
5828
|
-
matchIndex: -1,
|
|
5829
|
-
matchCount: 0,
|
|
5830
5816
|
uid,
|
|
5831
|
-
replaceExpanded: false,
|
|
5832
|
-
useRegularExpression: false,
|
|
5833
|
-
matchCase: false,
|
|
5834
|
-
matchWholeWord: false,
|
|
5835
|
-
replacement: '',
|
|
5836
|
-
editorUid: 0,
|
|
5837
5817
|
x: 0,
|
|
5838
5818
|
y: 0,
|
|
5839
5819
|
width: 0,
|
|
5840
5820
|
height: 0,
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
focus: 0
|
|
5821
|
+
commands: [],
|
|
5822
|
+
editorUid: 0
|
|
5844
5823
|
},
|
|
5845
5824
|
newState: {
|
|
5846
|
-
value: '',
|
|
5847
|
-
ariaAnnouncement: '',
|
|
5848
|
-
matches: new Uint32Array(),
|
|
5849
|
-
matchIndex: -1,
|
|
5850
|
-
matchCount: 0,
|
|
5851
5825
|
uid,
|
|
5852
|
-
replaceExpanded: false,
|
|
5853
|
-
useRegularExpression: false,
|
|
5854
|
-
matchCase: false,
|
|
5855
|
-
matchWholeWord: false,
|
|
5856
|
-
replacement: '',
|
|
5857
|
-
editorUid: 0,
|
|
5858
5826
|
x: 0,
|
|
5859
5827
|
y: 0,
|
|
5860
5828
|
width: 0,
|
|
5861
5829
|
height: 0,
|
|
5862
|
-
|
|
5863
|
-
|
|
5864
|
-
focus: 0
|
|
5830
|
+
commands: [],
|
|
5831
|
+
editorUid: 0
|
|
5865
5832
|
}
|
|
5866
5833
|
};
|
|
5867
5834
|
return widget;
|
|
5868
5835
|
};
|
|
5869
5836
|
|
|
5870
|
-
const
|
|
5871
|
-
|
|
5872
|
-
throw new Error('regex must be global');
|
|
5873
|
-
}
|
|
5837
|
+
const launchFindWidgetWorker = async () => {
|
|
5838
|
+
const name = 'Find Widget Worker';
|
|
5874
5839
|
const {
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5879
|
-
|
|
5880
|
-
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
|
|
5891
|
-
|
|
5892
|
-
// copied from https://github.com/microsoft/vscode/tree/main/src/vs/base/common/strings.ts by Microsoft (License MIT)
|
|
5893
|
-
|
|
5894
|
-
const RE_ESCAPE = /[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g;
|
|
5895
|
-
const escapeRegExpCharacters = value => {
|
|
5896
|
-
return value.replaceAll(RE_ESCAPE, String.raw`\$&`);
|
|
5897
|
-
};
|
|
5898
|
-
|
|
5899
|
-
const regexFlags = 'gi';
|
|
5900
|
-
const getSearchRegex = searchString => {
|
|
5901
|
-
const escaped = escapeRegExpCharacters(searchString);
|
|
5902
|
-
return new RegExp(escaped, regexFlags);
|
|
5903
|
-
};
|
|
5904
|
-
|
|
5905
|
-
const findMatchesCaseInsensitive = (lines, searchString) => {
|
|
5906
|
-
if (searchString.length === 0) {
|
|
5907
|
-
return new Uint32Array([]);
|
|
5908
|
-
}
|
|
5909
|
-
const regex = getSearchRegex(searchString);
|
|
5910
|
-
return findRegexMatches(lines, regex);
|
|
5911
|
-
};
|
|
5912
|
-
|
|
5913
|
-
const getMatchCount = matches => {
|
|
5914
|
-
return matches.length / 2;
|
|
5915
|
-
};
|
|
5916
|
-
|
|
5917
|
-
const setFindWidgetFocus = (state, focusKey) => {
|
|
5918
|
-
if (state.focus === focusKey) {
|
|
5919
|
-
return state;
|
|
5920
|
-
}
|
|
5921
|
-
return {
|
|
5922
|
-
...state,
|
|
5923
|
-
focus: focusKey,
|
|
5924
|
-
focusSource: Script
|
|
5925
|
-
};
|
|
5926
|
-
};
|
|
5927
|
-
|
|
5928
|
-
const focusCloseButton = state => {
|
|
5929
|
-
return setFindWidgetFocus(state, FocusFindWidgetCloseButton$1);
|
|
5930
|
-
};
|
|
5931
|
-
|
|
5932
|
-
const focusFind = state => {
|
|
5933
|
-
return setFindWidgetFocus(state, FindWidget);
|
|
5934
|
-
};
|
|
5935
|
-
|
|
5936
|
-
const getWidgetState = (editor, id) => {
|
|
5937
|
-
const {
|
|
5938
|
-
widgets
|
|
5939
|
-
} = editor;
|
|
5940
|
-
for (const widget of widgets) {
|
|
5941
|
-
if (widget.id === id) {
|
|
5942
|
-
return widget.newState;
|
|
5943
|
-
}
|
|
5944
|
-
}
|
|
5945
|
-
return undefined;
|
|
5946
|
-
};
|
|
5947
|
-
|
|
5948
|
-
const getFindState = editor => {
|
|
5949
|
-
return getWidgetState(editor, Find);
|
|
5950
|
-
};
|
|
5951
|
-
|
|
5952
|
-
const isFind = widget => {
|
|
5953
|
-
return widget.id === Find;
|
|
5840
|
+
port1,
|
|
5841
|
+
port2
|
|
5842
|
+
} = getPortTuple();
|
|
5843
|
+
await invokeAndTransfer('IpcParent.create', {
|
|
5844
|
+
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
5845
|
+
url: 'findWidgetWorkerMain.js',
|
|
5846
|
+
name: name,
|
|
5847
|
+
raw: true,
|
|
5848
|
+
port: port1
|
|
5849
|
+
});
|
|
5850
|
+
const rpc = await MessagePortRpcParent.create({
|
|
5851
|
+
commandMap: {},
|
|
5852
|
+
messagePort: port2,
|
|
5853
|
+
isMessagePortOpen: true
|
|
5854
|
+
});
|
|
5855
|
+
port2.start();
|
|
5856
|
+
return rpc;
|
|
5954
5857
|
};
|
|
5955
|
-
// TODO don't call renderer worker, set editor state
|
|
5956
|
-
// TODO this function should be synchronous
|
|
5957
|
-
const focusIndex$2 = (editor, index) => {
|
|
5958
|
-
const findState = getFindState(editor);
|
|
5959
|
-
if (!findState) {
|
|
5960
|
-
return editor;
|
|
5961
|
-
}
|
|
5962
|
-
const {
|
|
5963
|
-
value,
|
|
5964
|
-
matches,
|
|
5965
|
-
matchIndex
|
|
5966
|
-
} = findState;
|
|
5967
|
-
if (index === matchIndex) {
|
|
5968
|
-
return editor;
|
|
5969
|
-
}
|
|
5970
|
-
const {
|
|
5971
|
-
widgets
|
|
5972
|
-
} = editor;
|
|
5973
|
-
const childIndex = widgets.findIndex(isFind);
|
|
5974
|
-
const childWidget = widgets[childIndex];
|
|
5975
5858
|
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
const newState = {
|
|
5981
|
-
...findState,
|
|
5982
|
-
matchIndex: index
|
|
5983
|
-
};
|
|
5984
|
-
const newWidget = {
|
|
5985
|
-
...childWidget,
|
|
5986
|
-
newState
|
|
5987
|
-
};
|
|
5988
|
-
const newWidgets = [...widgets.slice(0, childIndex), newWidget, ...widgets.slice(childIndex + 1)];
|
|
5989
|
-
return {
|
|
5990
|
-
...editor,
|
|
5991
|
-
selections: newSelections,
|
|
5992
|
-
widgets: newWidgets
|
|
5993
|
-
};
|
|
5994
|
-
};
|
|
5995
|
-
const focusFirst$1 = editor => {
|
|
5996
|
-
const findState = getFindState(editor);
|
|
5997
|
-
if (!findState) {
|
|
5998
|
-
return editor;
|
|
5999
|
-
}
|
|
6000
|
-
return focusIndex$2(editor, 0);
|
|
6001
|
-
};
|
|
6002
|
-
const focusLast = editor => {
|
|
6003
|
-
const findState = getFindState(editor);
|
|
6004
|
-
if (!findState) {
|
|
6005
|
-
return editor;
|
|
6006
|
-
}
|
|
6007
|
-
const {
|
|
6008
|
-
matchCount
|
|
6009
|
-
} = findState;
|
|
6010
|
-
return focusIndex$2(editor, matchCount - 1);
|
|
6011
|
-
};
|
|
6012
|
-
const focusNext$2 = editor => {
|
|
6013
|
-
const findState = getFindState(editor);
|
|
6014
|
-
if (!findState) {
|
|
6015
|
-
return editor;
|
|
6016
|
-
}
|
|
6017
|
-
const {
|
|
6018
|
-
matchIndex,
|
|
6019
|
-
matchCount
|
|
6020
|
-
} = findState;
|
|
6021
|
-
if (matchIndex === matchCount - 1) {
|
|
6022
|
-
return focusFirst$1(editor);
|
|
6023
|
-
}
|
|
6024
|
-
return focusIndex$2(editor, matchIndex + 1);
|
|
6025
|
-
};
|
|
6026
|
-
const focusPrevious$1 = editor => {
|
|
6027
|
-
const findState = getFindState(editor);
|
|
6028
|
-
if (!findState) {
|
|
6029
|
-
return editor;
|
|
6030
|
-
}
|
|
6031
|
-
const {
|
|
6032
|
-
matchIndex
|
|
6033
|
-
} = findState;
|
|
6034
|
-
if (matchIndex === 0) {
|
|
6035
|
-
return focusLast(editor);
|
|
5859
|
+
let workerPromise$2;
|
|
5860
|
+
const getOrCreate$2 = () => {
|
|
5861
|
+
if (!workerPromise$2) {
|
|
5862
|
+
workerPromise$2 = launchFindWidgetWorker();
|
|
6036
5863
|
}
|
|
6037
|
-
return
|
|
6038
|
-
};
|
|
6039
|
-
|
|
6040
|
-
const focusNextMatchButton = state => {
|
|
6041
|
-
return setFindWidgetFocus(state, FocusFindWidgetNextMatchButton$1);
|
|
5864
|
+
return workerPromise$2;
|
|
6042
5865
|
};
|
|
6043
|
-
|
|
6044
|
-
const
|
|
6045
|
-
return
|
|
6046
|
-
};
|
|
6047
|
-
|
|
6048
|
-
const focusReplace = state => {
|
|
6049
|
-
return setFindWidgetFocus(state, FocusFindWidgetReplace$1);
|
|
6050
|
-
};
|
|
6051
|
-
|
|
6052
|
-
const focusReplaceAllButton = state => {
|
|
6053
|
-
return setFindWidgetFocus(state, FocusFindWidgetReplaceAllButton$1);
|
|
6054
|
-
};
|
|
6055
|
-
|
|
6056
|
-
const focusReplaceButton = state => {
|
|
6057
|
-
return setFindWidgetFocus(state, FocusFindWidgetReplaceButton$1);
|
|
6058
|
-
};
|
|
6059
|
-
|
|
6060
|
-
const focusToggleReplaceButton = state => {
|
|
6061
|
-
return setFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
6062
|
-
};
|
|
6063
|
-
|
|
6064
|
-
const handleBlur = async state => {
|
|
6065
|
-
await setFocus(Empty);
|
|
6066
|
-
return state;
|
|
6067
|
-
};
|
|
6068
|
-
|
|
6069
|
-
const refresh$1 = (editor, state, value) => {
|
|
6070
|
-
const {
|
|
6071
|
-
lines
|
|
6072
|
-
} = editor;
|
|
6073
|
-
const matches = findMatchesCaseInsensitive(lines, value);
|
|
6074
|
-
const matchCount = getMatchCount(matches);
|
|
6075
|
-
return {
|
|
6076
|
-
...state,
|
|
6077
|
-
matches,
|
|
6078
|
-
matchIndex: 0,
|
|
6079
|
-
matchCount,
|
|
6080
|
-
value
|
|
6081
|
-
};
|
|
5866
|
+
const invoke$4 = async (method, ...params) => {
|
|
5867
|
+
const worker = await getOrCreate$2();
|
|
5868
|
+
return await worker.invoke(method, ...params);
|
|
6082
5869
|
};
|
|
6083
5870
|
|
|
6084
|
-
const
|
|
6085
|
-
// TODO get focused editor
|
|
5871
|
+
const loadContent$1 = async (state, parentUid) => {
|
|
6086
5872
|
const {
|
|
6087
|
-
|
|
5873
|
+
uid
|
|
6088
5874
|
} = state;
|
|
6089
|
-
|
|
6090
|
-
const editor = getEditor(editorUid);
|
|
6091
|
-
return refresh$1(editor, state, value);
|
|
6092
|
-
};
|
|
6093
|
-
|
|
6094
|
-
const handleInput = (state, value) => {
|
|
6095
|
-
return refresh(state, value);
|
|
6096
|
-
};
|
|
6097
|
-
|
|
6098
|
-
const handleFindWidgetFocus = (state, focusKey) => {
|
|
6099
|
-
if (state.focus === focusKey) {
|
|
6100
|
-
return state;
|
|
6101
|
-
}
|
|
6102
|
-
return {
|
|
6103
|
-
...state,
|
|
6104
|
-
focus: focusKey,
|
|
6105
|
-
focusSource: User
|
|
6106
|
-
};
|
|
6107
|
-
};
|
|
6108
|
-
|
|
6109
|
-
const handleReplaceAllFocus = state => {
|
|
6110
|
-
return handleFindWidgetFocus(state, FocusFindWidgetReplaceAllButton$1);
|
|
6111
|
-
};
|
|
6112
|
-
|
|
6113
|
-
const handleReplaceFocus = state => {
|
|
6114
|
-
return handleFindWidgetFocus(state, FocusFindWidgetReplace$1);
|
|
6115
|
-
};
|
|
6116
|
-
|
|
6117
|
-
const getFindWidgetHeight = replaceExpanded => {
|
|
6118
|
-
const collapsedHeight = 30;
|
|
6119
|
-
const expandedHeight = 60;
|
|
6120
|
-
const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
|
|
6121
|
-
return newHeight;
|
|
6122
|
-
};
|
|
6123
|
-
|
|
6124
|
-
const toggleReplace = state => {
|
|
6125
|
-
const newExpanded = !state.replaceExpanded;
|
|
6126
|
-
const newHeight = getFindWidgetHeight(newExpanded);
|
|
6127
|
-
return {
|
|
6128
|
-
...state,
|
|
6129
|
-
replaceExpanded: !state.replaceExpanded,
|
|
6130
|
-
height: newHeight
|
|
6131
|
-
};
|
|
6132
|
-
};
|
|
6133
|
-
|
|
6134
|
-
const loadContent$1 = editorId => {
|
|
6135
|
-
const editor = getEditor(editorId);
|
|
5875
|
+
const editor = getEditor(parentUid);
|
|
6136
5876
|
const {
|
|
6137
|
-
|
|
6138
|
-
|
|
5877
|
+
x,
|
|
5878
|
+
y,
|
|
5879
|
+
width,
|
|
5880
|
+
height
|
|
6139
5881
|
} = editor;
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
const
|
|
6143
|
-
const
|
|
6144
|
-
const value = line.slice(startColumnIndex, endColumnIndex);
|
|
6145
|
-
const matches = findMatchesCaseInsensitive(lines, value);
|
|
6146
|
-
const matchCount = getMatchCount(matches);
|
|
5882
|
+
await invoke$4('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
5883
|
+
await invoke$4('FindWidget.loadContent', uid);
|
|
5884
|
+
const diff = await invoke$4('FindWidget.diff2', uid);
|
|
5885
|
+
const commands = await invoke$4('FindWidget.render2', uid, diff);
|
|
6147
5886
|
return {
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
matchIndex: 0,
|
|
6151
|
-
matchCount,
|
|
6152
|
-
editorUid: editor.uid
|
|
5887
|
+
...state,
|
|
5888
|
+
commands
|
|
6153
5889
|
};
|
|
6154
5890
|
};
|
|
6155
|
-
const close
|
|
5891
|
+
const close = async state => {
|
|
6156
5892
|
// TODO
|
|
6157
5893
|
// await Viewlet.closeWidget(uid)
|
|
6158
5894
|
return {
|
|
@@ -6160,70 +5896,13 @@ const close$1 = async state => {
|
|
|
6160
5896
|
disposed: true
|
|
6161
5897
|
};
|
|
6162
5898
|
};
|
|
6163
|
-
const handleToggleReplaceFocus = async state => {
|
|
6164
|
-
if (state.focus === FocusFindWidgetToggleReplace) {
|
|
6165
|
-
return state;
|
|
6166
|
-
}
|
|
6167
|
-
await setFocus(FocusFindWidgetToggleReplace);
|
|
6168
|
-
return {
|
|
6169
|
-
...state,
|
|
6170
|
-
focus: FocusFindWidgetToggleReplace
|
|
6171
|
-
};
|
|
6172
|
-
};
|
|
6173
|
-
const handleReplaceInput = (state, value) => {
|
|
6174
|
-
return {
|
|
6175
|
-
...state,
|
|
6176
|
-
replacement: value
|
|
6177
|
-
};
|
|
6178
|
-
};
|
|
6179
5899
|
|
|
6180
|
-
const
|
|
6181
|
-
|
|
6182
|
-
const height = 30;
|
|
6183
|
-
const paddingTop = 10;
|
|
6184
|
-
const paddingRight = 20;
|
|
6185
|
-
const x = editor.x + editor.width - width - paddingRight;
|
|
6186
|
-
const y = editor.y + paddingTop;
|
|
6187
|
-
return {
|
|
6188
|
-
y,
|
|
6189
|
-
x,
|
|
6190
|
-
width,
|
|
6191
|
-
height
|
|
6192
|
-
};
|
|
5900
|
+
const newStateGenerator$2 = (state, parentUid) => {
|
|
5901
|
+
return loadContent$1(state, parentUid);
|
|
6193
5902
|
};
|
|
6194
|
-
|
|
6195
5903
|
const openFind2 = async editor => {
|
|
6196
|
-
const newStateGenerator = async state => {
|
|
6197
|
-
const {
|
|
6198
|
-
value,
|
|
6199
|
-
matches,
|
|
6200
|
-
matchCount,
|
|
6201
|
-
matchIndex
|
|
6202
|
-
} = await loadContent$1(editor.uid);
|
|
6203
|
-
const {
|
|
6204
|
-
x,
|
|
6205
|
-
y,
|
|
6206
|
-
width,
|
|
6207
|
-
height
|
|
6208
|
-
} = getFindWidgetPosition(editor);
|
|
6209
|
-
const latestState = {
|
|
6210
|
-
...state,
|
|
6211
|
-
value,
|
|
6212
|
-
matches,
|
|
6213
|
-
matchCount,
|
|
6214
|
-
matchIndex,
|
|
6215
|
-
x,
|
|
6216
|
-
y,
|
|
6217
|
-
width,
|
|
6218
|
-
height,
|
|
6219
|
-
editorUid: editor.uid || editor.id,
|
|
6220
|
-
focusSource: Script,
|
|
6221
|
-
focus: FindWidget
|
|
6222
|
-
};
|
|
6223
|
-
return latestState;
|
|
6224
|
-
};
|
|
6225
5904
|
const fullFocus = true;
|
|
6226
|
-
return addWidgetToEditor(
|
|
5905
|
+
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$4, newStateGenerator$2, fullFocus);
|
|
6227
5906
|
};
|
|
6228
5907
|
|
|
6229
5908
|
const openFind = async state => {
|
|
@@ -6276,15 +5955,15 @@ const launchRenameWorker = async () => {
|
|
|
6276
5955
|
return rpc;
|
|
6277
5956
|
};
|
|
6278
5957
|
|
|
6279
|
-
let workerPromise;
|
|
6280
|
-
const getOrCreate = () => {
|
|
6281
|
-
if (!workerPromise) {
|
|
6282
|
-
workerPromise = launchRenameWorker();
|
|
5958
|
+
let workerPromise$1;
|
|
5959
|
+
const getOrCreate$1 = () => {
|
|
5960
|
+
if (!workerPromise$1) {
|
|
5961
|
+
workerPromise$1 = launchRenameWorker();
|
|
6283
5962
|
}
|
|
6284
|
-
return workerPromise;
|
|
5963
|
+
return workerPromise$1;
|
|
6285
5964
|
};
|
|
6286
|
-
const invoke$
|
|
6287
|
-
const worker = await getOrCreate();
|
|
5965
|
+
const invoke$3 = async (method, ...params) => {
|
|
5966
|
+
const worker = await getOrCreate$1();
|
|
6288
5967
|
return await worker.invoke(method, ...params);
|
|
6289
5968
|
};
|
|
6290
5969
|
|
|
@@ -6297,10 +5976,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
6297
5976
|
width,
|
|
6298
5977
|
height
|
|
6299
5978
|
} = state;
|
|
6300
|
-
await invoke$
|
|
6301
|
-
await invoke$
|
|
6302
|
-
const diff = await invoke$
|
|
6303
|
-
const commands = await invoke$
|
|
5979
|
+
await invoke$3('Rename.create', uid, x, y, width, height, parentUid);
|
|
5980
|
+
await invoke$3('Rename.loadContent', uid);
|
|
5981
|
+
const diff = await invoke$3('Rename.diff2', uid);
|
|
5982
|
+
const commands = await invoke$3('Rename.render2', uid, diff);
|
|
6304
5983
|
return {
|
|
6305
5984
|
...state,
|
|
6306
5985
|
commands
|
|
@@ -6346,7 +6025,7 @@ const pasteText = (editor, text) => {
|
|
|
6346
6025
|
};
|
|
6347
6026
|
|
|
6348
6027
|
const paste = async editor => {
|
|
6349
|
-
const text = await invoke$
|
|
6028
|
+
const text = await invoke$7('ClipBoard.readText');
|
|
6350
6029
|
string(text);
|
|
6351
6030
|
return pasteText(editor, text);
|
|
6352
6031
|
};
|
|
@@ -6488,7 +6167,7 @@ const save = async editor => {
|
|
|
6488
6167
|
} = editor;
|
|
6489
6168
|
const newEditor = await getNewEditor(editor);
|
|
6490
6169
|
const content = getText$1(newEditor);
|
|
6491
|
-
await invoke$
|
|
6170
|
+
await invoke$7('FileSystem.writeFile', uri, content);
|
|
6492
6171
|
return newEditor;
|
|
6493
6172
|
} catch (error) {
|
|
6494
6173
|
// @ts-ignore
|
|
@@ -6794,7 +6473,7 @@ const selectInsideString = editor => {
|
|
|
6794
6473
|
// import * as ExtensionHostSelection from '../ExtensionHost/ExtensionHostSelection.ts'
|
|
6795
6474
|
|
|
6796
6475
|
const getNewSelections = async (editor, selections) => {
|
|
6797
|
-
const newSelections = await invoke$
|
|
6476
|
+
const newSelections = await invoke$7('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6798
6477
|
if (newSelections.length === 0) {
|
|
6799
6478
|
return selections;
|
|
6800
6479
|
}
|
|
@@ -7048,7 +6727,7 @@ const getEnabled$1 = () => {
|
|
|
7048
6727
|
|
|
7049
6728
|
const {
|
|
7050
6729
|
listen: listen$3,
|
|
7051
|
-
invoke: invoke$
|
|
6730
|
+
invoke: invoke$2
|
|
7052
6731
|
} = createRpc(SyntaxHighlightingWorker);
|
|
7053
6732
|
|
|
7054
6733
|
/**
|
|
@@ -7118,7 +6797,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
7118
6797
|
return;
|
|
7119
6798
|
}
|
|
7120
6799
|
if (getEnabled$1()) {
|
|
7121
|
-
const tokenMap = await invoke$
|
|
6800
|
+
const tokenMap = await invoke$2('Tokenizer.load', languageId, tokenizePath);
|
|
7122
6801
|
set$1(languageId, tokenMap);
|
|
7123
6802
|
return;
|
|
7124
6803
|
}
|
|
@@ -7283,12 +6962,12 @@ const listen$2 = async () => {
|
|
|
7283
6962
|
handleIpc(ipc);
|
|
7284
6963
|
_ipc = ipc;
|
|
7285
6964
|
};
|
|
7286
|
-
const invoke = async (method, ...args) => {
|
|
7287
|
-
return invoke$
|
|
6965
|
+
const invoke$1 = async (method, ...args) => {
|
|
6966
|
+
return invoke$9(_ipc, method, ...args);
|
|
7288
6967
|
};
|
|
7289
6968
|
|
|
7290
6969
|
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
7291
|
-
return invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width);
|
|
6970
|
+
return invoke$1('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width);
|
|
7292
6971
|
};
|
|
7293
6972
|
|
|
7294
6973
|
const deepCopy = value => {
|
|
@@ -7499,13 +7178,13 @@ const showHover2 = async editor => {
|
|
|
7499
7178
|
|
|
7500
7179
|
const EditorHover = 'EditorHover';
|
|
7501
7180
|
const showHover = async state => {
|
|
7502
|
-
await invoke$
|
|
7181
|
+
await invoke$7('Viewlet.openWidget', EditorHover);
|
|
7503
7182
|
return state;
|
|
7504
7183
|
};
|
|
7505
7184
|
|
|
7506
7185
|
// TODO ask extension host worker instead
|
|
7507
7186
|
const getEditorSourceActions = async () => {
|
|
7508
|
-
const sourceActions = await invoke$
|
|
7187
|
+
const sourceActions = await invoke$7('GetEditorSourceActions.getEditorSourceActions');
|
|
7509
7188
|
return sourceActions;
|
|
7510
7189
|
};
|
|
7511
7190
|
|
|
@@ -8155,7 +7834,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
8155
7834
|
|
|
8156
7835
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
8157
7836
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
8158
|
-
const result = await invoke$
|
|
7837
|
+
const result = await invoke$7('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
8159
7838
|
if (!result) {
|
|
8160
7839
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8161
7840
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -8493,6 +8172,18 @@ const getCompletionDetailBounds = (completionBounds, borderSize) => {
|
|
|
8493
8172
|
};
|
|
8494
8173
|
};
|
|
8495
8174
|
|
|
8175
|
+
const getWidgetState = (editor, id) => {
|
|
8176
|
+
const {
|
|
8177
|
+
widgets
|
|
8178
|
+
} = editor;
|
|
8179
|
+
for (const widget of widgets) {
|
|
8180
|
+
if (widget.id === id) {
|
|
8181
|
+
return widget.newState;
|
|
8182
|
+
}
|
|
8183
|
+
}
|
|
8184
|
+
return undefined;
|
|
8185
|
+
};
|
|
8186
|
+
|
|
8496
8187
|
const getCompletionState = editor => {
|
|
8497
8188
|
return getWidgetState(editor, Completion);
|
|
8498
8189
|
};
|
|
@@ -8656,29 +8347,17 @@ const EditorSelection = 'EditorSelection';
|
|
|
8656
8347
|
const EditorSourceActions = 'EditorSourceActions';
|
|
8657
8348
|
const EditorSourceActionsList = 'EditorSourceActionsList';
|
|
8658
8349
|
const FileIcon = 'FileIcon';
|
|
8659
|
-
const FindWidgetFind = 'FindWidgetFind';
|
|
8660
|
-
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
8661
|
-
const FindWidgetMatchCountEmpty = 'FindWidgetMatchCountEmpty';
|
|
8662
|
-
const FindWidgetReplace = 'FindWidgetReplace';
|
|
8663
|
-
const FindWidgetRight = 'FindWidgetRight';
|
|
8664
8350
|
const HoverDisplayString = 'HoverDisplayString';
|
|
8665
8351
|
const HoverDocumentation = 'HoverDocumentation';
|
|
8666
8352
|
const HoverEditorRow = 'HoverEditorRow';
|
|
8667
8353
|
const HoverProblem = 'HoverProblem';
|
|
8668
8354
|
const HoverProblemDetail = 'HoverProblemDetail';
|
|
8669
8355
|
const HoverProblemMessage = 'HoverProblemMessage';
|
|
8670
|
-
const IconButton = 'IconButton';
|
|
8671
|
-
const IconButtonDisabled = 'IconButtonDisabled';
|
|
8672
8356
|
const IconClose = 'IconClose';
|
|
8673
8357
|
const InputBox = 'InputBox';
|
|
8674
8358
|
const Label = 'Label';
|
|
8675
8359
|
const MaskIcon = 'MaskIcon';
|
|
8676
8360
|
const MaskIconSymbolFile = 'MaskIconSymbolFile';
|
|
8677
|
-
const MultilineInputBox = 'MultilineInputBox';
|
|
8678
|
-
const SearchField = 'SearchField';
|
|
8679
|
-
const SearchFieldButton = 'SearchFieldButton';
|
|
8680
|
-
const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
|
|
8681
|
-
const SearchFieldButtons = 'SearchFieldButtons';
|
|
8682
8361
|
const SourceActionHeading = 'SourceActionHeading';
|
|
8683
8362
|
const SourceActionIcon = 'SourceActionIcon';
|
|
8684
8363
|
const SourceActionItem = 'SourceActionItem';
|
|
@@ -8688,11 +8367,6 @@ const Viewlet = 'Viewlet';
|
|
|
8688
8367
|
const HandleBeforeInput = 'handleBeforeInput';
|
|
8689
8368
|
const HandleBlur = 'handleBlur';
|
|
8690
8369
|
const HandleClick = 'handleClick';
|
|
8691
|
-
const HandleClickClose = 'handleClickClose';
|
|
8692
|
-
const HandleClickNextMatch = 'handleClickNextMatch';
|
|
8693
|
-
const HandleClickPreviousMatch = 'handleClickPreviousMatch';
|
|
8694
|
-
const HandleClickReplace = 'handleClickReplace';
|
|
8695
|
-
const HandleClickReplaceAll = 'handleClickReplaceAll';
|
|
8696
8370
|
const HandleClose = 'handleClose';
|
|
8697
8371
|
const HandleCompositionEnd = 'handleCompositionEnd';
|
|
8698
8372
|
const HandleCompositionStart = 'handleCompositionStart';
|
|
@@ -8701,20 +8375,15 @@ const HandleContextMenu = 'handleContextMenu';
|
|
|
8701
8375
|
const HandleCut = 'handleCut';
|
|
8702
8376
|
const HandleFocus = 'handleFocus';
|
|
8703
8377
|
const HandleFocusIn = 'handleFocusIn';
|
|
8704
|
-
const HandleInput = 'handleInput';
|
|
8705
8378
|
const HandleMouseMove = 'handleMouseMove';
|
|
8706
|
-
const HandleReplaceFocus = 'handleReplaceFocus';
|
|
8707
|
-
const HandleReplaceInput = 'handleReplaceInput';
|
|
8708
8379
|
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
8709
8380
|
const HandleWheel = 'handleWheel';
|
|
8710
8381
|
|
|
8711
|
-
const Button = 1;
|
|
8712
8382
|
const Div = 4;
|
|
8713
8383
|
const Input = 6;
|
|
8714
8384
|
const Span = 8;
|
|
8715
8385
|
const Text = 12;
|
|
8716
8386
|
const Img = 17;
|
|
8717
|
-
const TextArea = 62;
|
|
8718
8387
|
|
|
8719
8388
|
const text = data => {
|
|
8720
8389
|
return {
|
|
@@ -8813,7 +8482,6 @@ const SetCss = 'Viewlet.setCss';
|
|
|
8813
8482
|
const SetDom2 = 'Viewlet.setDom2';
|
|
8814
8483
|
const SetNegativeMargin = 'setNegativeMargin';
|
|
8815
8484
|
const SetScrollBar = 'setScrollBar';
|
|
8816
|
-
const SetValue = 'setValue';
|
|
8817
8485
|
const SetUid = 'Viewlet.setUid';
|
|
8818
8486
|
|
|
8819
8487
|
const renderHoverDom = {
|
|
@@ -8825,7 +8493,7 @@ const renderHoverDom = {
|
|
|
8825
8493
|
return [/* method */SetDom2, dom];
|
|
8826
8494
|
}
|
|
8827
8495
|
};
|
|
8828
|
-
const renderBounds$
|
|
8496
|
+
const renderBounds$4 = {
|
|
8829
8497
|
isEqual(oldState, newState) {
|
|
8830
8498
|
return oldState.x === newState.x && oldState.y === newState.y;
|
|
8831
8499
|
},
|
|
@@ -8839,10 +8507,10 @@ const renderBounds$5 = {
|
|
|
8839
8507
|
return [SetBounds, x, y, width, height];
|
|
8840
8508
|
}
|
|
8841
8509
|
};
|
|
8842
|
-
const render$
|
|
8510
|
+
const render$d = [renderHoverDom, renderBounds$4];
|
|
8843
8511
|
const renderHover = (oldState, newState) => {
|
|
8844
8512
|
const commands = [];
|
|
8845
|
-
for (const item of render$
|
|
8513
|
+
for (const item of render$d) {
|
|
8846
8514
|
if (!item.isEqual(oldState, newState)) {
|
|
8847
8515
|
commands.push(item.apply(oldState, newState));
|
|
8848
8516
|
}
|
|
@@ -8868,6 +8536,41 @@ const focusNext = state => {
|
|
|
8868
8536
|
return focusIndex(state, nextIndex);
|
|
8869
8537
|
};
|
|
8870
8538
|
|
|
8539
|
+
const launchCompletionWorker = async () => {
|
|
8540
|
+
const name = 'Completion Worker';
|
|
8541
|
+
const {
|
|
8542
|
+
port1,
|
|
8543
|
+
port2
|
|
8544
|
+
} = getPortTuple();
|
|
8545
|
+
await invokeAndTransfer('IpcParent.create', {
|
|
8546
|
+
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
8547
|
+
url: 'completionWorkerMain.js',
|
|
8548
|
+
name: name,
|
|
8549
|
+
raw: true,
|
|
8550
|
+
port: port1
|
|
8551
|
+
});
|
|
8552
|
+
const rpc = await MessagePortRpcParent.create({
|
|
8553
|
+
commandMap: {},
|
|
8554
|
+
messagePort: port2,
|
|
8555
|
+
isMessagePortOpen: true
|
|
8556
|
+
});
|
|
8557
|
+
port2.start();
|
|
8558
|
+
await rpc.invoke('Completions.initialize');
|
|
8559
|
+
return rpc;
|
|
8560
|
+
};
|
|
8561
|
+
|
|
8562
|
+
let workerPromise;
|
|
8563
|
+
const getOrCreate = () => {
|
|
8564
|
+
if (!workerPromise) {
|
|
8565
|
+
workerPromise = launchCompletionWorker();
|
|
8566
|
+
}
|
|
8567
|
+
return workerPromise;
|
|
8568
|
+
};
|
|
8569
|
+
const invoke = async (method, ...params) => {
|
|
8570
|
+
const worker = await getOrCreate();
|
|
8571
|
+
return await worker.invoke(method, ...params);
|
|
8572
|
+
};
|
|
8573
|
+
|
|
8871
8574
|
const updateWidget = (editor, widgetId, newState) => {
|
|
8872
8575
|
// TODO avoid closure
|
|
8873
8576
|
const isWidget = widget => {
|
|
@@ -8888,22 +8591,47 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
8888
8591
|
};
|
|
8889
8592
|
};
|
|
8890
8593
|
|
|
8891
|
-
const getInvoke =
|
|
8892
|
-
|
|
8594
|
+
const getInvoke = widgetId => {
|
|
8595
|
+
switch (widgetId) {
|
|
8596
|
+
case ColorPicker:
|
|
8597
|
+
return invoke$6;
|
|
8598
|
+
case Completion:
|
|
8599
|
+
return invoke;
|
|
8600
|
+
case Find:
|
|
8601
|
+
return invoke$4;
|
|
8602
|
+
default:
|
|
8603
|
+
return undefined;
|
|
8604
|
+
}
|
|
8893
8605
|
};
|
|
8894
|
-
const executeWidgetCommand = async (editor, name, method,
|
|
8895
|
-
const invoke = getInvoke();
|
|
8606
|
+
const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
|
|
8607
|
+
const invoke = getInvoke(widgetId);
|
|
8896
8608
|
const actualMethod = method.slice(name.length + 1);
|
|
8609
|
+
const widget = editor.widgets.find(widget => widget.id === widgetId);
|
|
8610
|
+
if (!widget) {
|
|
8611
|
+
return editor;
|
|
8612
|
+
}
|
|
8613
|
+
const {
|
|
8614
|
+
uid
|
|
8615
|
+
} = widget.newState;
|
|
8616
|
+
number(uid);
|
|
8897
8617
|
await invoke(`${name}.${actualMethod}`, uid, ...params);
|
|
8898
|
-
const diff = await invoke(`${name}.diff2`, uid);
|
|
8899
|
-
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8900
8618
|
const isWidget = widget => {
|
|
8901
8619
|
return widget.id === widgetId;
|
|
8902
8620
|
};
|
|
8903
|
-
const
|
|
8904
|
-
const
|
|
8621
|
+
const latestEditor = getEditor(editor.uid);
|
|
8622
|
+
const childIndex1 = latestEditor.widgets.findIndex(isWidget);
|
|
8623
|
+
if (childIndex1 === -1) {
|
|
8624
|
+
return latestEditor;
|
|
8625
|
+
}
|
|
8626
|
+
const diff = await invoke(`${name}.diff2`, uid);
|
|
8627
|
+
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8628
|
+
const childIndex = latestEditor.widgets.findIndex(isWidget);
|
|
8629
|
+
if (childIndex === -1) {
|
|
8630
|
+
return latestEditor;
|
|
8631
|
+
}
|
|
8632
|
+
const childWidget = latestEditor.widgets[childIndex];
|
|
8905
8633
|
const newState = {
|
|
8906
|
-
...childWidget.
|
|
8634
|
+
...childWidget.newState,
|
|
8907
8635
|
commands
|
|
8908
8636
|
};
|
|
8909
8637
|
const newEditor = updateWidget(editor, widgetId, newState);
|
|
@@ -8921,35 +8649,53 @@ const getWordAt = (editorUid, rowIndex, columnIndex) => {
|
|
|
8921
8649
|
} = getWordAt$1(editor, rowIndex, columnIndex);
|
|
8922
8650
|
return word;
|
|
8923
8651
|
};
|
|
8924
|
-
|
|
8925
|
-
const
|
|
8926
|
-
const
|
|
8927
|
-
|
|
8928
|
-
for (let i = 0; i < matches.length; i += 2) {
|
|
8929
|
-
const startRowIndex = matches[i];
|
|
8930
|
-
const startColumnIndex = matches[i + 1];
|
|
8931
|
-
const endRowIndex = matches[i];
|
|
8932
|
-
const endColumnIndex = matches[i] + oldValueLength;
|
|
8933
|
-
ranges.push(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex);
|
|
8934
|
-
}
|
|
8935
|
-
return replaceRange(editor, ranges, [newValue], ReplaceAll$2);
|
|
8652
|
+
const getWordAtOffset2 = editorUid => {
|
|
8653
|
+
const editor = getEditor(editorUid);
|
|
8654
|
+
const word = getWordAtOffset(editor);
|
|
8655
|
+
return word;
|
|
8936
8656
|
};
|
|
8937
|
-
|
|
8938
|
-
const
|
|
8939
|
-
const
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8657
|
+
const getWordBefore2 = (editorUid, rowIndex, columnIndex) => {
|
|
8658
|
+
const editor = getEditor(editorUid);
|
|
8659
|
+
const word = getWordBefore(editor, rowIndex, columnIndex);
|
|
8660
|
+
return word;
|
|
8661
|
+
};
|
|
8662
|
+
const getLines2 = editorUid => {
|
|
8663
|
+
const editor = getEditor(editorUid);
|
|
8943
8664
|
const {
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
const
|
|
8950
|
-
const
|
|
8951
|
-
|
|
8952
|
-
|
|
8665
|
+
lines
|
|
8666
|
+
} = editor;
|
|
8667
|
+
return lines;
|
|
8668
|
+
};
|
|
8669
|
+
const getSelections2 = editorUid => {
|
|
8670
|
+
const editor = getEditor(editorUid);
|
|
8671
|
+
const {
|
|
8672
|
+
selections
|
|
8673
|
+
} = editor;
|
|
8674
|
+
return selections;
|
|
8675
|
+
};
|
|
8676
|
+
const closeFind2 = async editorUid => {
|
|
8677
|
+
// console.log('close find')
|
|
8678
|
+
const editor = getEditor(editorUid);
|
|
8679
|
+
const {
|
|
8680
|
+
widgets
|
|
8681
|
+
} = editor;
|
|
8682
|
+
const index = widgets.findIndex(widget => widget.id === Find);
|
|
8683
|
+
if (index === -1) {
|
|
8684
|
+
return;
|
|
8685
|
+
}
|
|
8686
|
+
const findWidget = widgets[index];
|
|
8687
|
+
await invoke$4('FindWidget.dispose', findWidget.newState.uid);
|
|
8688
|
+
const newWidgets = [...widgets.slice(0, index), ...widgets.slice(index + 1)];
|
|
8689
|
+
// TODO transfer focus to editor
|
|
8690
|
+
const newEditor = {
|
|
8691
|
+
...editor,
|
|
8692
|
+
widgets: newWidgets,
|
|
8693
|
+
focused: true
|
|
8694
|
+
};
|
|
8695
|
+
set$4(editorUid, editor, newEditor);
|
|
8696
|
+
// console.log('before rerender')
|
|
8697
|
+
// await RendererWorker.invoke('Editor.rerender', editorUid)
|
|
8698
|
+
// console.log('after rerender')
|
|
8953
8699
|
};
|
|
8954
8700
|
|
|
8955
8701
|
const pending = Object.create(null);
|
|
@@ -9830,10 +9576,10 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
9830
9576
|
languageId,
|
|
9831
9577
|
invalidStartIndex
|
|
9832
9578
|
};
|
|
9833
|
-
return invoke$
|
|
9579
|
+
return invoke$2('GetTokensViewport.getTokensViewport', slimEditor, startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
9834
9580
|
}
|
|
9835
9581
|
// TODO only send needed lines of text
|
|
9836
|
-
return invoke$
|
|
9582
|
+
return invoke$2('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
9837
9583
|
}
|
|
9838
9584
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
9839
9585
|
};
|
|
@@ -10190,7 +9936,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
10190
9936
|
} = newState;
|
|
10191
9937
|
const oldLine = oldState.lines[rowIndex];
|
|
10192
9938
|
const newLine = lines[rowIndex];
|
|
10193
|
-
const incrementalEdits = await invoke$
|
|
9939
|
+
const incrementalEdits = await invoke$2('TokenizeIncremental.tokenizeIncremental', newState.uid, newState.languageId, oldLine, newLine, rowIndex, newState.minLineY);
|
|
10194
9940
|
if (incrementalEdits && incrementalEdits.length === 1) {
|
|
10195
9941
|
return incrementalEdits;
|
|
10196
9942
|
}
|
|
@@ -10294,7 +10040,7 @@ const renderScrollBarX = {
|
|
|
10294
10040
|
return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
|
|
10295
10041
|
}
|
|
10296
10042
|
};
|
|
10297
|
-
const renderFocus$
|
|
10043
|
+
const renderFocus$1 = {
|
|
10298
10044
|
isEqual(oldState, newState) {
|
|
10299
10045
|
return oldState.focused === newState.focused;
|
|
10300
10046
|
},
|
|
@@ -10302,7 +10048,7 @@ const renderFocus$2 = {
|
|
|
10302
10048
|
// TODO avoid side effect
|
|
10303
10049
|
if (newState.focused) {
|
|
10304
10050
|
const FocusEditorText = 12;
|
|
10305
|
-
invoke$
|
|
10051
|
+
invoke$7('Focus.setFocus', FocusEditorText);
|
|
10306
10052
|
}
|
|
10307
10053
|
return [/* method */'setFocused', newState.focused];
|
|
10308
10054
|
}
|
|
@@ -10392,7 +10138,7 @@ const renderWidgets = {
|
|
|
10392
10138
|
},
|
|
10393
10139
|
multiple: true
|
|
10394
10140
|
};
|
|
10395
|
-
const render$
|
|
10141
|
+
const render$c = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
10396
10142
|
const renderEditor = async id => {
|
|
10397
10143
|
const instance = get$4(id);
|
|
10398
10144
|
if (!instance) {
|
|
@@ -10404,7 +10150,7 @@ const renderEditor = async id => {
|
|
|
10404
10150
|
} = instance;
|
|
10405
10151
|
const commands = [];
|
|
10406
10152
|
set$4(id, newState, newState);
|
|
10407
|
-
for (const item of render$
|
|
10153
|
+
for (const item of render$c) {
|
|
10408
10154
|
if (!item.isEqual(oldState, newState)) {
|
|
10409
10155
|
const result = await item.apply(oldState, newState);
|
|
10410
10156
|
// @ts-ignore
|
|
@@ -10470,7 +10216,7 @@ const keep = [
|
|
|
10470
10216
|
// 'ColorPicker.handleSliderPointerDown',
|
|
10471
10217
|
// 'ColorPicker.handleSliderPointerMove',
|
|
10472
10218
|
// 'ColorPicker.loadContent',
|
|
10473
|
-
'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', 'Editor.getKeyBindings', 'Editor.getPositionAtCursor', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getQuickPickMenuEntries',
|
|
10219
|
+
'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', 'Editor.getKeyBindings', 'Editor.getPositionAtCursor', 'Editor.getWordAt2', 'Editor.getWordAtOffset2', 'Editor.getLines2', 'Editor.closeFind2', 'Editor.getSelections2', 'Editor.getQuickPickMenuEntries',
|
|
10474
10220
|
// 'ColorPicker.render',
|
|
10475
10221
|
'Editor.getText', 'Editor.getSelections', 'Font.ensure', 'SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker', 'Hover.getHoverInfo', 'Hover.handleSashPointerDown', 'Hover.handleSashPointerMove', 'Hover.handleSashPointerUp', 'Hover.loadContent', 'Hover.render', 'Initialize.initialize', 'ActivateByEvent.activateByEvent'];
|
|
10476
10222
|
|
|
@@ -10608,13 +10354,17 @@ const commandMap = {
|
|
|
10608
10354
|
'Editor.getText': getText,
|
|
10609
10355
|
'Editor.getWordAt': getWordAt$1,
|
|
10610
10356
|
'Editor.getWordAt2': getWordAt,
|
|
10611
|
-
'Editor.getWordAtOffset2':
|
|
10357
|
+
'Editor.getWordAtOffset2': getWordAtOffset2,
|
|
10358
|
+
'Editor.getWordBefore2': getWordBefore2,
|
|
10612
10359
|
'Editor.getWordBefore': getWordBefore,
|
|
10360
|
+
'Editor.getLines2': getLines2,
|
|
10361
|
+
'Editor.getSelections2': getSelections2,
|
|
10362
|
+
'Editor.closeFind2': closeFind2,
|
|
10613
10363
|
'Editor.goToDefinition': goToDefinition,
|
|
10614
10364
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
10615
10365
|
'Editor.handleBeforeInput': handleBeforeInput,
|
|
10616
10366
|
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditable,
|
|
10617
|
-
'Editor.handleBlur': handleBlur
|
|
10367
|
+
'Editor.handleBlur': handleBlur,
|
|
10618
10368
|
'Editor.handleContextMenu': handleContextMenu,
|
|
10619
10369
|
'Editor.handleDoubleClick': handleDoubleClick,
|
|
10620
10370
|
'Editor.handleFocus': handleFocus,
|
|
@@ -10713,30 +10463,8 @@ const commandMap = {
|
|
|
10713
10463
|
'EditorCompletion.selectIndex': selectIndex,
|
|
10714
10464
|
'EditorCompletion.toggleDetails': toggleDetails,
|
|
10715
10465
|
'EditorSourceActions.focusNext': focusNext,
|
|
10716
|
-
'FindWidget.close': close
|
|
10717
|
-
'FindWidget.focusCloseButton': focusCloseButton,
|
|
10718
|
-
'FindWidget.focusFind': focusFind,
|
|
10719
|
-
'FindWidget.focusFirst': focusFirst$1,
|
|
10720
|
-
'FindWidget.focusIndex': focusIndex$2,
|
|
10721
|
-
'FindWidget.focusLast': focusLast,
|
|
10722
|
-
'FindWidget.focusNext': focusNext$2,
|
|
10723
|
-
'FindWidget.focusNextMatchButton': focusNextMatchButton,
|
|
10724
|
-
'FindWidget.focusPrevious': focusPrevious$1,
|
|
10725
|
-
'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
|
|
10726
|
-
'FindWidget.focusReplace': focusReplace,
|
|
10727
|
-
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
10728
|
-
'FindWidget.focusReplaceButton': focusReplaceButton,
|
|
10729
|
-
'FindWidget.focusToggleReplace': focusToggleReplaceButton,
|
|
10730
|
-
'FindWidget.handleBlur': handleBlur,
|
|
10731
|
-
'FindWidget.handleFocus': handleFindWidgetFocus,
|
|
10732
|
-
'FindWidget.handleInput': handleInput,
|
|
10733
|
-
'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
|
|
10734
|
-
'FindWidget.handleReplaceFocus': handleReplaceFocus,
|
|
10735
|
-
'FindWidget.handleReplaceInput': handleReplaceInput,
|
|
10736
|
-
'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
|
|
10466
|
+
'FindWidget.close': close,
|
|
10737
10467
|
'FindWidget.loadContent': loadContent$1,
|
|
10738
|
-
'FindWidget.replaceAll': replaceAll$1,
|
|
10739
|
-
'FindWidget.toggleReplace': toggleReplace,
|
|
10740
10468
|
'Font.ensure': ensure,
|
|
10741
10469
|
'Hover.getHoverInfo': getEditorHoverInfo,
|
|
10742
10470
|
'Hover.handleSashPointerDown': handleSashPointerDown,
|
|
@@ -10808,7 +10536,7 @@ const isFunctional = widgetId => {
|
|
|
10808
10536
|
switch (widgetId) {
|
|
10809
10537
|
case ColorPicker:
|
|
10810
10538
|
case Rename:
|
|
10811
|
-
|
|
10539
|
+
case Find:
|
|
10812
10540
|
return true;
|
|
10813
10541
|
default:
|
|
10814
10542
|
return false;
|
|
@@ -10852,7 +10580,6 @@ const removeWidget = widget => {
|
|
|
10852
10580
|
};
|
|
10853
10581
|
|
|
10854
10582
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
10855
|
-
const ToggleReplace$1 = 'ToggleReplace';
|
|
10856
10583
|
|
|
10857
10584
|
const getCodeGeneratorVirtualDom = state => {
|
|
10858
10585
|
const escapeToClose$1 = escapeToClose();
|
|
@@ -10883,7 +10610,7 @@ const renderContent$1 = {
|
|
|
10883
10610
|
return [SetDom2, newState.uid, dom];
|
|
10884
10611
|
}
|
|
10885
10612
|
};
|
|
10886
|
-
const renderBounds$
|
|
10613
|
+
const renderBounds$3 = {
|
|
10887
10614
|
isEqual(oldState, newState) {
|
|
10888
10615
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10889
10616
|
},
|
|
@@ -10897,7 +10624,7 @@ const renderBounds$4 = {
|
|
|
10897
10624
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10898
10625
|
}
|
|
10899
10626
|
};
|
|
10900
|
-
const renderFocus
|
|
10627
|
+
const renderFocus = {
|
|
10901
10628
|
isEqual(oldState, newState) {
|
|
10902
10629
|
return oldState.focused === newState.focused && oldState.focusSource === newState.focusSource;
|
|
10903
10630
|
},
|
|
@@ -10905,10 +10632,10 @@ const renderFocus$1 = {
|
|
|
10905
10632
|
return [Focus, '.CodeGeneratorInput', newState.focusSource];
|
|
10906
10633
|
}
|
|
10907
10634
|
};
|
|
10908
|
-
const render$
|
|
10909
|
-
const renderFull$
|
|
10635
|
+
const render$b = [renderContent$1, renderBounds$3, renderFocus];
|
|
10636
|
+
const renderFull$4 = (oldState, newState) => {
|
|
10910
10637
|
const commands = [];
|
|
10911
|
-
for (const item of render$
|
|
10638
|
+
for (const item of render$b) {
|
|
10912
10639
|
if (!item.isEqual(oldState, newState)) {
|
|
10913
10640
|
commands.push(item.apply(oldState, newState));
|
|
10914
10641
|
}
|
|
@@ -10916,8 +10643,8 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
10916
10643
|
return commands;
|
|
10917
10644
|
};
|
|
10918
10645
|
|
|
10919
|
-
const render$
|
|
10920
|
-
const commands = renderFull$
|
|
10646
|
+
const render$a = widget => {
|
|
10647
|
+
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
10921
10648
|
const wrappedCommands = [];
|
|
10922
10649
|
const {
|
|
10923
10650
|
uid
|
|
@@ -10933,7 +10660,7 @@ const render$b = widget => {
|
|
|
10933
10660
|
return wrappedCommands;
|
|
10934
10661
|
};
|
|
10935
10662
|
const add$7 = widget => {
|
|
10936
|
-
return addWidget(widget, 'EditorCodeGenerator', render$
|
|
10663
|
+
return addWidget(widget, 'EditorCodeGenerator', render$a);
|
|
10937
10664
|
};
|
|
10938
10665
|
const remove$7 = removeWidget;
|
|
10939
10666
|
|
|
@@ -10941,18 +10668,18 @@ const EditorCodeGeneratorWidget = {
|
|
|
10941
10668
|
__proto__: null,
|
|
10942
10669
|
add: add$7,
|
|
10943
10670
|
remove: remove$7,
|
|
10944
|
-
render: render$
|
|
10671
|
+
render: render$a
|
|
10945
10672
|
};
|
|
10946
10673
|
|
|
10947
|
-
const renderFull$
|
|
10674
|
+
const renderFull$3 = (oldState, newState) => {
|
|
10948
10675
|
const commands = [...newState.commands];
|
|
10949
10676
|
// @ts-ignore
|
|
10950
10677
|
newState.commands = [];
|
|
10951
10678
|
return commands;
|
|
10952
10679
|
};
|
|
10953
10680
|
|
|
10954
|
-
const render$
|
|
10955
|
-
const commands = renderFull$
|
|
10681
|
+
const render$9 = widget => {
|
|
10682
|
+
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
10956
10683
|
const wrappedCommands = [];
|
|
10957
10684
|
const {
|
|
10958
10685
|
uid
|
|
@@ -10967,7 +10694,7 @@ const render$a = widget => {
|
|
|
10967
10694
|
return wrappedCommands;
|
|
10968
10695
|
};
|
|
10969
10696
|
const add$6 = widget => {
|
|
10970
|
-
return addWidget(widget, 'ColorPicker', render$
|
|
10697
|
+
return addWidget(widget, 'ColorPicker', render$9);
|
|
10971
10698
|
};
|
|
10972
10699
|
const remove$6 = removeWidget;
|
|
10973
10700
|
const Commands$1 = {};
|
|
@@ -10977,7 +10704,7 @@ const EditorColorPickerWidget = {
|
|
|
10977
10704
|
Commands: Commands$1,
|
|
10978
10705
|
add: add$6,
|
|
10979
10706
|
remove: remove$6,
|
|
10980
|
-
render: render$
|
|
10707
|
+
render: render$9
|
|
10981
10708
|
};
|
|
10982
10709
|
|
|
10983
10710
|
const getCompletionDetailVirtualDom = content => {
|
|
@@ -11021,7 +10748,7 @@ const renderContent = {
|
|
|
11021
10748
|
return [SetDom2, newState.uid, dom];
|
|
11022
10749
|
}
|
|
11023
10750
|
};
|
|
11024
|
-
const renderBounds$
|
|
10751
|
+
const renderBounds$2 = {
|
|
11025
10752
|
isEqual(oldState, newState) {
|
|
11026
10753
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
11027
10754
|
},
|
|
@@ -11035,13 +10762,13 @@ const renderBounds$3 = {
|
|
|
11035
10762
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
11036
10763
|
}
|
|
11037
10764
|
};
|
|
11038
|
-
const render$
|
|
11039
|
-
const renderFull$
|
|
11040
|
-
return renderParts(render$
|
|
10765
|
+
const render$8 = [renderContent, renderBounds$2];
|
|
10766
|
+
const renderFull$2 = (oldState, newState) => {
|
|
10767
|
+
return renderParts(render$8, oldState, newState);
|
|
11041
10768
|
};
|
|
11042
10769
|
|
|
11043
|
-
const render$
|
|
11044
|
-
const commands = renderFull$
|
|
10770
|
+
const render$7 = widget => {
|
|
10771
|
+
const commands = renderFull$2(widget.oldState, widget.newState);
|
|
11045
10772
|
const wrappedCommands = [];
|
|
11046
10773
|
const {
|
|
11047
10774
|
uid
|
|
@@ -11056,7 +10783,7 @@ const render$8 = widget => {
|
|
|
11056
10783
|
return wrappedCommands;
|
|
11057
10784
|
};
|
|
11058
10785
|
const add$5 = widget => {
|
|
11059
|
-
return addWidget(widget, 'EditorCompletionDetails', render$
|
|
10786
|
+
return addWidget(widget, 'EditorCompletionDetails', render$7);
|
|
11060
10787
|
};
|
|
11061
10788
|
const remove$5 = removeWidget;
|
|
11062
10789
|
const handleEditorType$1 = (editor, state) => {
|
|
@@ -11094,11 +10821,9 @@ const EditorCompletionDetailWidget = {
|
|
|
11094
10821
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
11095
10822
|
handleEditorType: handleEditorType$1,
|
|
11096
10823
|
remove: remove$5,
|
|
11097
|
-
render: render$
|
|
10824
|
+
render: render$7
|
|
11098
10825
|
};
|
|
11099
10826
|
|
|
11100
|
-
const CheckBox = 'checkbox';
|
|
11101
|
-
const Group = 'group';
|
|
11102
10827
|
const None = 'none';
|
|
11103
10828
|
const Option = 'option';
|
|
11104
10829
|
|
|
@@ -11197,7 +10922,7 @@ const getCompletionItemsVirtualDom = visibleItems => {
|
|
|
11197
10922
|
return [{
|
|
11198
10923
|
type: Div,
|
|
11199
10924
|
childCount: 1
|
|
11200
|
-
}, text(noResults
|
|
10925
|
+
}, text(noResults())];
|
|
11201
10926
|
}
|
|
11202
10927
|
const root = {
|
|
11203
10928
|
type: Div,
|
|
@@ -11299,7 +11024,7 @@ const renderItems = {
|
|
|
11299
11024
|
return ['setDom', dom];
|
|
11300
11025
|
}
|
|
11301
11026
|
};
|
|
11302
|
-
const renderBounds$
|
|
11027
|
+
const renderBounds$1 = {
|
|
11303
11028
|
isEqual(oldState, newState) {
|
|
11304
11029
|
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.x === newState.x && oldState.y === newState.y;
|
|
11305
11030
|
},
|
|
@@ -11345,10 +11070,10 @@ const renderScrollBar = {
|
|
|
11345
11070
|
return [/* method */SetScrollBar, /* scrollBarY */scrollBarY, /* scrollBarHeight */scrollBarHeight];
|
|
11346
11071
|
}
|
|
11347
11072
|
};
|
|
11348
|
-
const render$
|
|
11073
|
+
const render$6 = [renderItems, renderBounds$1, renderHeight, renderNegativeMargin, renderScrollBar];
|
|
11349
11074
|
const renderCompletion = (oldState, newState) => {
|
|
11350
11075
|
const commands = [];
|
|
11351
|
-
for (const item of render$
|
|
11076
|
+
for (const item of render$6) {
|
|
11352
11077
|
if (!item.isEqual(oldState, newState)) {
|
|
11353
11078
|
commands.push(item.apply(oldState, newState));
|
|
11354
11079
|
}
|
|
@@ -11356,7 +11081,7 @@ const renderCompletion = (oldState, newState) => {
|
|
|
11356
11081
|
return commands;
|
|
11357
11082
|
};
|
|
11358
11083
|
|
|
11359
|
-
const render$
|
|
11084
|
+
const render$5 = widget => {
|
|
11360
11085
|
const commands = renderCompletion(widget.oldState, widget.newState);
|
|
11361
11086
|
const wrappedCommands = [];
|
|
11362
11087
|
const {
|
|
@@ -11368,7 +11093,7 @@ const render$6 = widget => {
|
|
|
11368
11093
|
return wrappedCommands;
|
|
11369
11094
|
};
|
|
11370
11095
|
const add$4 = widget => {
|
|
11371
|
-
const commands = render$
|
|
11096
|
+
const commands = render$5(widget);
|
|
11372
11097
|
const id = 'EditorCompletion';
|
|
11373
11098
|
// TODO how to generate a unique integer id
|
|
11374
11099
|
// that doesn't collide with ids created in renderer worker?
|
|
@@ -11447,407 +11172,25 @@ const EditorCompletionWidget = {
|
|
|
11447
11172
|
handleEditorDeleteLeft,
|
|
11448
11173
|
handleEditorType,
|
|
11449
11174
|
remove: remove$4,
|
|
11450
|
-
render: render$
|
|
11451
|
-
};
|
|
11452
|
-
|
|
11453
|
-
/**
|
|
11454
|
-
* @enum {string}
|
|
11455
|
-
*/
|
|
11456
|
-
const UiStrings = {
|
|
11457
|
-
MatchOf: '{PH1} of {PH2}',
|
|
11458
|
-
NoResults: 'No Results',
|
|
11459
|
-
Close: 'Close',
|
|
11460
|
-
PreviousMatch: 'Previous Match',
|
|
11461
|
-
NextMatch: 'Next Match',
|
|
11462
|
-
Find: 'Find',
|
|
11463
|
-
Replace: 'Replace',
|
|
11464
|
-
ReplaceAll: 'Replace All'
|
|
11465
|
-
};
|
|
11466
|
-
const noResults = () => {
|
|
11467
|
-
return i18nString(UiStrings.NoResults);
|
|
11468
|
-
};
|
|
11469
|
-
const matchOf = (matchIndex, matchCount) => {
|
|
11470
|
-
return i18nString(UiStrings.MatchOf, {
|
|
11471
|
-
PH1: matchIndex,
|
|
11472
|
-
PH2: matchCount
|
|
11473
|
-
});
|
|
11474
|
-
};
|
|
11475
|
-
const previousMatch = () => {
|
|
11476
|
-
return i18nString(UiStrings.PreviousMatch);
|
|
11477
|
-
};
|
|
11478
|
-
const nextMatch = () => {
|
|
11479
|
-
return i18nString(UiStrings.NextMatch);
|
|
11480
|
-
};
|
|
11481
|
-
const close = () => {
|
|
11482
|
-
return i18nString(UiStrings.Close);
|
|
11483
|
-
};
|
|
11484
|
-
const find = () => {
|
|
11485
|
-
return i18nString(UiStrings.Find);
|
|
11486
|
-
};
|
|
11487
|
-
const replace = () => {
|
|
11488
|
-
return i18nString(UiStrings.Replace);
|
|
11489
|
-
};
|
|
11490
|
-
const replaceAll = () => {
|
|
11491
|
-
return i18nString(UiStrings.ReplaceAll);
|
|
11492
|
-
};
|
|
11493
|
-
|
|
11494
|
-
const ArrowDown = 'ArrowDown';
|
|
11495
|
-
const ArrowUp = 'ArrowUp';
|
|
11496
|
-
const Close$1 = 'Close';
|
|
11497
|
-
const Replace$1 = 'Replace';
|
|
11498
|
-
const ReplaceAll$1 = 'ReplaceAll';
|
|
11499
|
-
|
|
11500
|
-
const SearchValue = 'search-value';
|
|
11501
|
-
const ReplaceValue = 'replace-value';
|
|
11502
|
-
const ReplaceAll = 'ReplaceAll';
|
|
11503
|
-
const Close = 'Close';
|
|
11504
|
-
const ToggleReplace = 'ToggleReplace';
|
|
11505
|
-
const FocusNext = 'FocusNext';
|
|
11506
|
-
const FocusPrevious = 'FocusPrevious';
|
|
11507
|
-
const Replace = 'Replace';
|
|
11508
|
-
|
|
11509
|
-
const getFindWidgetButtons = (findButtonsEnabled, replaceButtonsEnabled) => {
|
|
11510
|
-
const findButtons = [{
|
|
11511
|
-
label: previousMatch(),
|
|
11512
|
-
icon: ArrowUp,
|
|
11513
|
-
disabled: !findButtonsEnabled,
|
|
11514
|
-
onClick: HandleClickPreviousMatch,
|
|
11515
|
-
name: FocusPrevious
|
|
11516
|
-
}, {
|
|
11517
|
-
label: nextMatch(),
|
|
11518
|
-
icon: ArrowDown,
|
|
11519
|
-
disabled: !findButtonsEnabled,
|
|
11520
|
-
onClick: HandleClickNextMatch,
|
|
11521
|
-
name: FocusNext
|
|
11522
|
-
}, {
|
|
11523
|
-
label: close(),
|
|
11524
|
-
icon: Close$1,
|
|
11525
|
-
disabled: false,
|
|
11526
|
-
onClick: HandleClickClose,
|
|
11527
|
-
name: Close
|
|
11528
|
-
}];
|
|
11529
|
-
const replaceButtons = [{
|
|
11530
|
-
label: replace(),
|
|
11531
|
-
icon: Replace$1,
|
|
11532
|
-
disabled: !replaceButtonsEnabled,
|
|
11533
|
-
onClick: HandleClickReplace,
|
|
11534
|
-
name: Replace
|
|
11535
|
-
}, {
|
|
11536
|
-
label: replaceAll(),
|
|
11537
|
-
icon: ReplaceAll$1,
|
|
11538
|
-
disabled: !replaceButtonsEnabled,
|
|
11539
|
-
onClick: HandleClickReplaceAll,
|
|
11540
|
-
name: ReplaceAll
|
|
11541
|
-
}];
|
|
11542
|
-
return {
|
|
11543
|
-
findButtons,
|
|
11544
|
-
replaceButtons
|
|
11545
|
-
};
|
|
11546
|
-
};
|
|
11547
|
-
|
|
11548
|
-
const getFindWidgetButtonsEnabled = (matchCount, value) => {
|
|
11549
|
-
const findButtonsEnabled = matchCount > 0;
|
|
11550
|
-
const replaceButtonsEnabled = value.length > 0;
|
|
11551
|
-
return {
|
|
11552
|
-
findButtonsEnabled,
|
|
11553
|
-
replaceButtonsEnabled
|
|
11554
|
-
};
|
|
11555
|
-
};
|
|
11556
|
-
|
|
11557
|
-
// TODO always focus element by name
|
|
11558
|
-
const getFindWidgetFocusSelector = focus => {
|
|
11559
|
-
switch (focus) {
|
|
11560
|
-
case FindWidget:
|
|
11561
|
-
{
|
|
11562
|
-
return `[name="${SearchValue}"]`;
|
|
11563
|
-
}
|
|
11564
|
-
case FocusFindWidgetReplace$1:
|
|
11565
|
-
{
|
|
11566
|
-
return `[name="${ReplaceValue}"]`;
|
|
11567
|
-
}
|
|
11568
|
-
case FocusFindWidgetReplaceAllButton$1:
|
|
11569
|
-
{
|
|
11570
|
-
return `[name="${ReplaceAll}"]`;
|
|
11571
|
-
}
|
|
11572
|
-
case FocusFindWidgetCloseButton$1:
|
|
11573
|
-
{
|
|
11574
|
-
return `[name="${Close}"]`;
|
|
11575
|
-
}
|
|
11576
|
-
case FocusFindWidgetToggleReplace:
|
|
11577
|
-
{
|
|
11578
|
-
return `[name="${ToggleReplace}"]`;
|
|
11579
|
-
}
|
|
11580
|
-
case FocusFindWidgetNextMatchButton$1:
|
|
11581
|
-
{
|
|
11582
|
-
return `[name="${FocusNext}"]`;
|
|
11583
|
-
}
|
|
11584
|
-
case FocusFindWidgetPreviousMatchButton$1:
|
|
11585
|
-
{
|
|
11586
|
-
return `[name="${FocusPrevious}"]`;
|
|
11587
|
-
}
|
|
11588
|
-
case FocusFindWidgetReplaceButton$1:
|
|
11589
|
-
{
|
|
11590
|
-
return `[name="${Replace}"]`;
|
|
11591
|
-
}
|
|
11592
|
-
default:
|
|
11593
|
-
{
|
|
11594
|
-
return '';
|
|
11595
|
-
}
|
|
11596
|
-
}
|
|
11597
|
-
};
|
|
11598
|
-
|
|
11599
|
-
const getFindMatchCountClassName = (matchCount, value) => {
|
|
11600
|
-
if (value && matchCount === 0) {
|
|
11601
|
-
return mergeClassNames(FindWidgetMatchCount, FindWidgetMatchCountEmpty);
|
|
11602
|
-
}
|
|
11603
|
-
return FindWidgetMatchCount;
|
|
11604
|
-
};
|
|
11605
|
-
|
|
11606
|
-
const getIconVirtualDom = (icon, type = Div) => {
|
|
11607
|
-
return {
|
|
11608
|
-
type,
|
|
11609
|
-
className: `MaskIcon MaskIcon${icon}`,
|
|
11610
|
-
role: None,
|
|
11611
|
-
childCount: 0
|
|
11612
|
-
};
|
|
11613
|
-
};
|
|
11614
|
-
|
|
11615
|
-
const getIconButtonVirtualDom = iconButton => {
|
|
11616
|
-
const {
|
|
11617
|
-
label,
|
|
11618
|
-
icon,
|
|
11619
|
-
disabled,
|
|
11620
|
-
name,
|
|
11621
|
-
onClick
|
|
11622
|
-
} = iconButton;
|
|
11623
|
-
let className = IconButton;
|
|
11624
|
-
if (disabled) {
|
|
11625
|
-
className += ' ' + IconButtonDisabled;
|
|
11626
|
-
}
|
|
11627
|
-
return [{
|
|
11628
|
-
type: Button,
|
|
11629
|
-
className,
|
|
11630
|
-
title: label,
|
|
11631
|
-
ariaLabel: label,
|
|
11632
|
-
childCount: 1,
|
|
11633
|
-
disabled: disabled ? true : undefined,
|
|
11634
|
-
onClick: onClick,
|
|
11635
|
-
name: name
|
|
11636
|
-
}, getIconVirtualDom(icon)];
|
|
11637
|
-
};
|
|
11638
|
-
|
|
11639
|
-
const getSearchFieldButtonVirtualDom = button => {
|
|
11640
|
-
const {
|
|
11641
|
-
icon,
|
|
11642
|
-
checked,
|
|
11643
|
-
title
|
|
11644
|
-
} = button;
|
|
11645
|
-
return [{
|
|
11646
|
-
type: Div,
|
|
11647
|
-
className: mergeClassNames(SearchFieldButton, checked ? SearchFieldButtonChecked : ''),
|
|
11648
|
-
title,
|
|
11649
|
-
role: CheckBox,
|
|
11650
|
-
ariaChecked: checked,
|
|
11651
|
-
tabIndex: 0,
|
|
11652
|
-
childCount: 1
|
|
11653
|
-
}, {
|
|
11654
|
-
type: Div,
|
|
11655
|
-
className: mergeClassNames(MaskIcon, icon),
|
|
11656
|
-
childCount: 0
|
|
11657
|
-
}];
|
|
11175
|
+
render: render$5
|
|
11658
11176
|
};
|
|
11659
11177
|
|
|
11660
|
-
const
|
|
11661
|
-
const
|
|
11662
|
-
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
childCount: 2
|
|
11666
|
-
}, {
|
|
11667
|
-
type: TextArea,
|
|
11668
|
-
className: MultilineInputBox,
|
|
11669
|
-
spellcheck: false,
|
|
11670
|
-
autocapitalize: 'off',
|
|
11671
|
-
autocorrect: 'off',
|
|
11672
|
-
placeholder,
|
|
11673
|
-
name,
|
|
11674
|
-
onInput,
|
|
11675
|
-
onFocus,
|
|
11676
|
-
childCount: 0
|
|
11677
|
-
}, {
|
|
11678
|
-
type: Div,
|
|
11679
|
-
className: SearchFieldButtons,
|
|
11680
|
-
childCount: insideButtons.length
|
|
11681
|
-
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
|
|
11682
|
-
if (outsideButtons.length > 0) {
|
|
11683
|
-
throw new Error('outsideButtons are deprecated');
|
|
11684
|
-
}
|
|
11685
|
-
return dom;
|
|
11686
|
-
};
|
|
11687
|
-
|
|
11688
|
-
const getFindWidgetFindVirtualDom = (matchCountText, buttons, matchCount, value) => {
|
|
11689
|
-
const dom = [];
|
|
11690
|
-
dom.push({
|
|
11691
|
-
type: Div,
|
|
11692
|
-
className: FindWidgetFind,
|
|
11693
|
-
childCount: 5
|
|
11694
|
-
});
|
|
11695
|
-
dom.push(...getSearchFieldVirtualDom('search-value', find(), HandleInput, [], [], HandleFocus));
|
|
11696
|
-
const findClassName = getFindMatchCountClassName(matchCount, value);
|
|
11697
|
-
dom.push({
|
|
11698
|
-
type: Div,
|
|
11699
|
-
className: findClassName,
|
|
11700
|
-
childCount: 1
|
|
11701
|
-
}, text(matchCountText), ...buttons.flatMap(getIconButtonVirtualDom));
|
|
11702
|
-
return dom;
|
|
11703
|
-
};
|
|
11704
|
-
|
|
11705
|
-
const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
|
|
11706
|
-
const dom = [];
|
|
11707
|
-
if (replaceExpanded) {
|
|
11708
|
-
dom.push({
|
|
11709
|
-
type: Div,
|
|
11710
|
-
className: FindWidgetReplace,
|
|
11711
|
-
childCount: 1 + replaceButtons.length
|
|
11712
|
-
}, ...getSearchFieldVirtualDom('replace-value', replace(), HandleReplaceInput, [], [], HandleReplaceFocus), ...replaceButtons.flatMap(getIconButtonVirtualDom));
|
|
11713
|
-
}
|
|
11714
|
-
return dom;
|
|
11715
|
-
};
|
|
11716
|
-
|
|
11717
|
-
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
11718
|
-
return [{
|
|
11719
|
-
type: Button,
|
|
11720
|
-
className: `IconButton SearchToggleButton ${replaceExpanded ? 'SearchToggleButtonExpanded' : ''}`,
|
|
11721
|
-
title: 'Toggle Replace',
|
|
11722
|
-
ariaLabel: 'Toggle Replace',
|
|
11723
|
-
ariaExpanded: replaceExpanded,
|
|
11724
|
-
name: ToggleReplace$1,
|
|
11725
|
-
childCount: 1,
|
|
11726
|
-
'data-command': 'toggleReplace',
|
|
11727
|
-
onClick,
|
|
11728
|
-
onFocus: 'handleToggleReplaceFocus'
|
|
11729
|
-
}, {
|
|
11730
|
-
type: Div,
|
|
11731
|
-
className: `MaskIcon ${replaceExpanded ? 'MaskIconChevronDown' : 'MaskIconChevronRight'}`,
|
|
11732
|
-
childCount: 0
|
|
11733
|
-
}];
|
|
11734
|
-
};
|
|
11735
|
-
|
|
11736
|
-
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression, matchCount, value) => {
|
|
11737
|
-
const dom = [];
|
|
11738
|
-
dom.push({
|
|
11739
|
-
type: Div,
|
|
11740
|
-
className: 'Viewlet ViewletFind ViewletFindWidget FindWidget',
|
|
11741
|
-
childCount: 2,
|
|
11742
|
-
role: Group
|
|
11743
|
-
});
|
|
11744
|
-
dom.push(...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'));
|
|
11745
|
-
dom.push({
|
|
11746
|
-
type: Div,
|
|
11747
|
-
className: FindWidgetRight,
|
|
11748
|
-
childCount: replaceExpanded ? 2 : 1
|
|
11749
|
-
});
|
|
11750
|
-
dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons, matchCount, value));
|
|
11751
|
-
if (replaceExpanded) {
|
|
11752
|
-
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons));
|
|
11753
|
-
}
|
|
11754
|
-
return dom;
|
|
11755
|
-
};
|
|
11756
|
-
|
|
11757
|
-
const getMatchCountText = (matchIndex, matchCount) => {
|
|
11758
|
-
if (matchCount === 0) {
|
|
11759
|
-
return noResults();
|
|
11760
|
-
}
|
|
11761
|
-
return matchOf(matchIndex + 1, matchCount);
|
|
11762
|
-
};
|
|
11763
|
-
|
|
11764
|
-
const renderValue = {
|
|
11765
|
-
isEqual(oldState, newState) {
|
|
11766
|
-
return oldState.value === newState.value;
|
|
11767
|
-
},
|
|
11768
|
-
apply(oldState, newState) {
|
|
11769
|
-
return [SetValue, /* value */newState.value];
|
|
11770
|
-
}
|
|
11771
|
-
};
|
|
11772
|
-
const renderDetails = {
|
|
11773
|
-
isEqual(oldState, newState) {
|
|
11774
|
-
return oldState.matchIndex === newState.matchIndex && oldState.matchCount === newState.matchCount && oldState.replaceExpanded === newState.replaceExpanded && oldState.value === newState.value;
|
|
11775
|
-
},
|
|
11776
|
-
apply(oldState, newState) {
|
|
11777
|
-
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
11778
|
-
const {
|
|
11779
|
-
findButtonsEnabled,
|
|
11780
|
-
replaceButtonsEnabled
|
|
11781
|
-
} = getFindWidgetButtonsEnabled(newState.matchCount, newState.value);
|
|
11782
|
-
const {
|
|
11783
|
-
findButtons,
|
|
11784
|
-
replaceButtons
|
|
11785
|
-
} = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled);
|
|
11786
|
-
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons, newState.matchCase, newState.matchWholeWord, newState.useRegularExpression, newState.matchCount, newState.value);
|
|
11787
|
-
return [SetDom2, dom];
|
|
11788
|
-
}
|
|
11789
|
-
};
|
|
11790
|
-
const renderBounds$1 = {
|
|
11791
|
-
isEqual(oldState, newState) {
|
|
11792
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
11793
|
-
},
|
|
11794
|
-
apply(oldState, newState) {
|
|
11795
|
-
const {
|
|
11796
|
-
x,
|
|
11797
|
-
y,
|
|
11798
|
-
width,
|
|
11799
|
-
height
|
|
11800
|
-
} = newState;
|
|
11801
|
-
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
11802
|
-
}
|
|
11803
|
-
};
|
|
11804
|
-
const renderFocus = {
|
|
11805
|
-
isEqual(oldState, newState) {
|
|
11806
|
-
return oldState.focused === newState.focused && oldState.focus === newState.focus && oldState.focusSource === newState.focusSource;
|
|
11807
|
-
},
|
|
11808
|
-
apply(oldState, newState) {
|
|
11809
|
-
const key = getFindWidgetFocusSelector(newState.focus);
|
|
11810
|
-
return [Focus, key, newState.focusSource];
|
|
11811
|
-
}
|
|
11812
|
-
};
|
|
11813
|
-
// const getAriaLabel = (state: FindWidgetState) => {
|
|
11814
|
-
// const { matchIndex, matchCount, value } = state
|
|
11815
|
-
// return FindStrings.matchesFoundFor(matchIndex, matchCount, value)
|
|
11816
|
-
// }
|
|
11817
|
-
|
|
11818
|
-
// const renderAriaAnnouncement = {
|
|
11819
|
-
// isEqual(oldState: FindWidgetState, newState: FindWidgetState) {
|
|
11820
|
-
// return (
|
|
11821
|
-
// oldState.ariaAnnouncement === newState.ariaAnnouncement &&
|
|
11822
|
-
// oldState.matchIndex === newState.matchIndex &&
|
|
11823
|
-
// oldState.matchCount === newState.matchCount &&
|
|
11824
|
-
// oldState.value === newState.value
|
|
11825
|
-
// )
|
|
11826
|
-
// },
|
|
11827
|
-
// apply(oldState: FindWidgetState, newState: FindWidgetState) {
|
|
11828
|
-
// const ariaLabel = getAriaLabel(newState)
|
|
11829
|
-
// return [/* Viewlet.invoke */ 'Viewlet.ariaAnnounce', /* text */ ariaLabel]
|
|
11830
|
-
// },
|
|
11831
|
-
// }
|
|
11832
|
-
|
|
11833
|
-
const render$5 = [renderDetails, renderBounds$1, renderValue, renderFocus];
|
|
11834
|
-
const apply = (oldState, newState) => {
|
|
11835
|
-
// TODO avoid side effect
|
|
11836
|
-
if (oldState.focus !== newState.focus) {
|
|
11837
|
-
setFocus(newState.focus);
|
|
11838
|
-
}
|
|
11839
|
-
return renderParts(render$5, oldState, newState);
|
|
11178
|
+
const renderFull$1 = (oldState, newState) => {
|
|
11179
|
+
const commands = [...newState.commands];
|
|
11180
|
+
// @ts-ignore
|
|
11181
|
+
newState.commands = [];
|
|
11182
|
+
return commands;
|
|
11840
11183
|
};
|
|
11841
11184
|
|
|
11842
11185
|
const render$4 = widget => {
|
|
11843
|
-
const commands =
|
|
11186
|
+
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
11844
11187
|
const wrappedCommands = [];
|
|
11845
11188
|
const {
|
|
11846
11189
|
uid
|
|
11847
11190
|
} = widget.newState;
|
|
11848
11191
|
for (const command of commands) {
|
|
11849
|
-
if (command[0] === SetDom2) {
|
|
11850
|
-
wrappedCommands.push(
|
|
11192
|
+
if (command[0] === SetDom2 || command[0] === SetCss || command[0] === AppendToBody || command[0] === SetBounds2 || command[0] === RegisterEventListeners || command[0] === SetSelectionByName || command[0] === SetValueByName || command[0] === SetFocusContext || command[0] === SetUid || command[0] === 'Viewlet.focusSelector') {
|
|
11193
|
+
wrappedCommands.push(command);
|
|
11851
11194
|
} else {
|
|
11852
11195
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
11853
11196
|
}
|
|
@@ -11857,17 +11200,10 @@ const render$4 = widget => {
|
|
|
11857
11200
|
const add$3 = widget => {
|
|
11858
11201
|
return addWidget(widget, 'FindWidget', render$4);
|
|
11859
11202
|
};
|
|
11860
|
-
const remove$3 =
|
|
11861
|
-
|
|
11862
|
-
'FindWidget.close': close$1,
|
|
11863
|
-
'FindWidget.focusNext': focusNext$2,
|
|
11864
|
-
'FindWidget.focusPrevious': focusPrevious$1,
|
|
11865
|
-
'FindWidget.focusIndex': focusIndex$2,
|
|
11866
|
-
'FindWidget.focusLast': focusLast,
|
|
11867
|
-
'FindWidget.toggleReplace': toggleReplace,
|
|
11868
|
-
'FindWidget.handleFocus': focusFind,
|
|
11869
|
-
'FindWidget.handleBlur': handleBlur
|
|
11203
|
+
const remove$3 = widget => {
|
|
11204
|
+
return [['Viewlet.dispose', widget.newState.uid]];
|
|
11870
11205
|
};
|
|
11206
|
+
const Commands = {};
|
|
11871
11207
|
|
|
11872
11208
|
const EditorFindWidget = {
|
|
11873
11209
|
__proto__: null,
|
|
@@ -11908,9 +11244,6 @@ const renderFull = (oldState, newState) => {
|
|
|
11908
11244
|
const commands = [...newState.commands];
|
|
11909
11245
|
// @ts-ignore
|
|
11910
11246
|
newState.commands = [];
|
|
11911
|
-
console.log({
|
|
11912
|
-
commands
|
|
11913
|
-
});
|
|
11914
11247
|
return commands;
|
|
11915
11248
|
};
|
|
11916
11249
|
|