@lvce-editor/editor-worker 6.1.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 +370 -1142
- 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 = launchColorPickerWorker();
|
|
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,8 +1115,6 @@ const IndentLess = 'indentLess';
|
|
|
1115
1115
|
const IndentMore = 'indentMore';
|
|
1116
1116
|
const InsertLineBreak = 'insertLineBreak';
|
|
1117
1117
|
const LineComment = 'lineComment';
|
|
1118
|
-
const Rename$1 = 'rename';
|
|
1119
|
-
const ReplaceAll$2 = 'replaceAll';
|
|
1120
1118
|
const ToggleBlockComment$1 = 'toggleBlockComment';
|
|
1121
1119
|
|
|
1122
1120
|
const map$1 = Object.create(null);
|
|
@@ -1490,7 +1488,7 @@ const createMeasureContext = () => {
|
|
|
1490
1488
|
const state$8 = {
|
|
1491
1489
|
ctx: undefined
|
|
1492
1490
|
};
|
|
1493
|
-
const getOrCreate = createCtx => {
|
|
1491
|
+
const getOrCreate$3 = createCtx => {
|
|
1494
1492
|
if (state$8.ctx) {
|
|
1495
1493
|
return state$8.ctx;
|
|
1496
1494
|
}
|
|
@@ -1499,7 +1497,7 @@ const getOrCreate = createCtx => {
|
|
|
1499
1497
|
};
|
|
1500
1498
|
|
|
1501
1499
|
const getContext = () => {
|
|
1502
|
-
const ctx = getOrCreate(createMeasureContext);
|
|
1500
|
+
const ctx = getOrCreate$3(createMeasureContext);
|
|
1503
1501
|
return ctx;
|
|
1504
1502
|
};
|
|
1505
1503
|
|
|
@@ -2037,7 +2035,6 @@ const set$4 = (id, oldEditor, newEditor) => {
|
|
|
2037
2035
|
const CompletionExecute = 'ExtensionHostCompletion.execute';
|
|
2038
2036
|
const CompletionResolveExecute = 'ExtensionHostCompletion.executeResolve';
|
|
2039
2037
|
const HoverExecute = 'ExtensionHostHover.execute';
|
|
2040
|
-
const RenameExecuteRename = 'ExtensionHostRename.executeRenameProvider';
|
|
2041
2038
|
const TabCompletionExecuteTabCompletionProvider = 'ExtensionHost.executeTabCompletionProvider';
|
|
2042
2039
|
const TextDocumentSyncFull = 'ExtensionHostTextDocument.syncFull';
|
|
2043
2040
|
|
|
@@ -2307,7 +2304,7 @@ const createRpc = method => {
|
|
|
2307
2304
|
_ipc = ipc;
|
|
2308
2305
|
};
|
|
2309
2306
|
const invoke = async (method, ...params) => {
|
|
2310
|
-
return invoke$
|
|
2307
|
+
return invoke$9(_ipc, method, ...params);
|
|
2311
2308
|
};
|
|
2312
2309
|
const invokeAndTransfer = async (method, ...params) => {
|
|
2313
2310
|
return invokeAndTransfer$2(_ipc, method, ...params);
|
|
@@ -2321,7 +2318,7 @@ const createRpc = method => {
|
|
|
2321
2318
|
|
|
2322
2319
|
const {
|
|
2323
2320
|
listen: listen$4,
|
|
2324
|
-
invoke: invoke$
|
|
2321
|
+
invoke: invoke$5} = createRpc(ExtensionHostWorker);
|
|
2325
2322
|
|
|
2326
2323
|
const ColorPicker$1 = 41;
|
|
2327
2324
|
const CompletionDetail$1 = 999;
|
|
@@ -2330,13 +2327,6 @@ const Empty = 0;
|
|
|
2330
2327
|
const FindWidget = 16;
|
|
2331
2328
|
const FocusEditorHover = 51;
|
|
2332
2329
|
const FocusEditorRename$1 = 11;
|
|
2333
|
-
const FocusFindWidgetCloseButton$1 = 48;
|
|
2334
|
-
const FocusFindWidgetNextMatchButton$1 = 49;
|
|
2335
|
-
const FocusFindWidgetPreviousMatchButton$1 = 50;
|
|
2336
|
-
const FocusFindWidgetReplace$1 = 43;
|
|
2337
|
-
const FocusFindWidgetReplaceAllButton$1 = 47;
|
|
2338
|
-
const FocusFindWidgetReplaceButton$1 = 46;
|
|
2339
|
-
const FocusFindWidgetToggleReplace = 42;
|
|
2340
2330
|
const SourceActions = 38;
|
|
2341
2331
|
const FocusCodeGenerator = 52;
|
|
2342
2332
|
|
|
@@ -2344,7 +2334,6 @@ const measureCharacterWidth = (fontWeight, fontSize, fontFamily, letterSpacing)
|
|
|
2344
2334
|
return measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
2345
2335
|
};
|
|
2346
2336
|
|
|
2347
|
-
const OnRename = 'onRename';
|
|
2348
2337
|
const OnCompletion = 'onCompletion';
|
|
2349
2338
|
const OnDiagnostic = 'onDiagnostic';
|
|
2350
2339
|
const OnHover = 'onHover';
|
|
@@ -2360,7 +2349,7 @@ const execute = async ({
|
|
|
2360
2349
|
}) => {
|
|
2361
2350
|
const fullEvent = `${event}:${editor.languageId}`;
|
|
2362
2351
|
await activateByEvent(fullEvent);
|
|
2363
|
-
const result = await invoke$
|
|
2352
|
+
const result = await invoke$5(method, editor.uid, ...args);
|
|
2364
2353
|
return result;
|
|
2365
2354
|
};
|
|
2366
2355
|
|
|
@@ -2427,7 +2416,7 @@ const updateDiagnostics = async newState => {
|
|
|
2427
2416
|
|
|
2428
2417
|
// TODO don't really need text document sync response
|
|
2429
2418
|
// could perhaps save a lot of messages by using send instead of invoke
|
|
2430
|
-
await invoke$
|
|
2419
|
+
await invoke$5(TextDocumentSyncFull, newState.uri, newState.id, newState.languageId, content);
|
|
2431
2420
|
const diagnostics = await executeDiagnosticProvider(newState);
|
|
2432
2421
|
const latest = get$4(newState.id);
|
|
2433
2422
|
if (!latest) {
|
|
@@ -2440,7 +2429,7 @@ const updateDiagnostics = async newState => {
|
|
|
2440
2429
|
decorations
|
|
2441
2430
|
};
|
|
2442
2431
|
set$4(newState.id, latest.oldState, newEditor);
|
|
2443
|
-
await invoke$
|
|
2432
|
+
await invoke$7('Editor.rerender', newState.id);
|
|
2444
2433
|
return newEditor;
|
|
2445
2434
|
} catch (error) {
|
|
2446
2435
|
// @ts-ignore
|
|
@@ -2574,7 +2563,7 @@ const createEditor = async ({
|
|
|
2574
2563
|
focused: true
|
|
2575
2564
|
};
|
|
2576
2565
|
set$4(id, emptyEditor, newEditor4);
|
|
2577
|
-
await invoke$
|
|
2566
|
+
await invoke$5(TextDocumentSyncFull, uri, id, languageId, content);
|
|
2578
2567
|
if (diagnosticsEnabled) {
|
|
2579
2568
|
updateDiagnostics(newEditor4);
|
|
2580
2569
|
}
|
|
@@ -2643,7 +2632,7 @@ const applyEdit = async (editor, changes) => {
|
|
|
2643
2632
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
2644
2633
|
};
|
|
2645
2634
|
|
|
2646
|
-
const handleBlur
|
|
2635
|
+
const handleBlur = editor => {
|
|
2647
2636
|
if (editor.focusKey !== Empty) {
|
|
2648
2637
|
return editor;
|
|
2649
2638
|
}
|
|
@@ -2885,7 +2874,7 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, isError
|
|
|
2885
2874
|
const x$1 = x(editor, rowIndex, columnIndex);
|
|
2886
2875
|
const y$1 = y(editor, rowIndex);
|
|
2887
2876
|
const displayErrorMessage = message;
|
|
2888
|
-
await invoke$
|
|
2877
|
+
await invoke$7('Editor.showOverlayMessage', editor, 'Viewlet.send', editor.uid, 'showOverlayMessage', x$1, y$1, displayErrorMessage);
|
|
2889
2878
|
if (!isError) {
|
|
2890
2879
|
const handleTimeout = () => {
|
|
2891
2880
|
editorHideMessage(editor);
|
|
@@ -2941,7 +2930,7 @@ const braceCompletion = async (editor, text) => {
|
|
|
2941
2930
|
try {
|
|
2942
2931
|
// @ts-ignore
|
|
2943
2932
|
const offset = offsetAt(editor, editor.cursor);
|
|
2944
|
-
const result = await invoke$
|
|
2933
|
+
const result = await invoke$7('ExtensionHostBraceCompletion.executeBraceCompletionProvider', editor, offset, text);
|
|
2945
2934
|
if (result) {
|
|
2946
2935
|
const closingBrace = getMatchingClosingBrace$1(text);
|
|
2947
2936
|
const insertText = text + closingBrace;
|
|
@@ -3098,14 +3087,14 @@ const hasWidget = (widgets, id) => {
|
|
|
3098
3087
|
};
|
|
3099
3088
|
|
|
3100
3089
|
const setAdditionalFocus = async focusKey => {
|
|
3101
|
-
await invoke$
|
|
3090
|
+
await invoke$7('Focus.setAdditionalFocus', focusKey);
|
|
3102
3091
|
};
|
|
3103
3092
|
|
|
3104
3093
|
const setFocus = async focusKey => {
|
|
3105
3094
|
if (!focusKey) {
|
|
3106
3095
|
return;
|
|
3107
3096
|
}
|
|
3108
|
-
await invoke$
|
|
3097
|
+
await invoke$7('Focus.setFocus', focusKey);
|
|
3109
3098
|
};
|
|
3110
3099
|
|
|
3111
3100
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
@@ -3166,11 +3155,11 @@ const create$7 = () => {
|
|
|
3166
3155
|
return widget;
|
|
3167
3156
|
};
|
|
3168
3157
|
|
|
3169
|
-
const newStateGenerator$
|
|
3158
|
+
const newStateGenerator$4 = (state, parentUid) => {
|
|
3170
3159
|
return loadContent$3(state, parentUid);
|
|
3171
3160
|
};
|
|
3172
3161
|
const openColorPicker = async editor => {
|
|
3173
|
-
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$7, newStateGenerator$
|
|
3162
|
+
return addWidgetToEditor(ColorPicker, ColorPicker$1, editor, create$7, newStateGenerator$4);
|
|
3174
3163
|
};
|
|
3175
3164
|
|
|
3176
3165
|
const state$6 = {
|
|
@@ -3226,7 +3215,7 @@ const compositionEnd = (editor, data) => {
|
|
|
3226
3215
|
const writeText = async text => {
|
|
3227
3216
|
try {
|
|
3228
3217
|
string(text);
|
|
3229
|
-
await invoke$
|
|
3218
|
+
await invoke$7('ClipBoard.writeText', /* text */text);
|
|
3230
3219
|
} catch (error) {
|
|
3231
3220
|
throw new VError(error, 'Failed to write text to clipboard');
|
|
3232
3221
|
}
|
|
@@ -3860,7 +3849,7 @@ const deleteWordRight = editor => {
|
|
|
3860
3849
|
};
|
|
3861
3850
|
|
|
3862
3851
|
const findAllReferences = async editor => {
|
|
3863
|
-
await invoke$
|
|
3852
|
+
await invoke$7('SideBar.show', 'References', /* focus */true);
|
|
3864
3853
|
return editor;
|
|
3865
3854
|
};
|
|
3866
3855
|
|
|
@@ -3990,7 +3979,7 @@ const getWordBefore = (editor, rowIndex, columnIndex) => {
|
|
|
3990
3979
|
|
|
3991
3980
|
// @ts-ignore
|
|
3992
3981
|
const getDefinition = async (editor, offset) => {
|
|
3993
|
-
const definition = await invoke$
|
|
3982
|
+
const definition = await invoke$7('ExtensionHostDefinition.executeDefinitionProvider', editor, offset);
|
|
3994
3983
|
return definition;
|
|
3995
3984
|
};
|
|
3996
3985
|
|
|
@@ -4053,7 +4042,7 @@ const noTypeDefinitionFoundFor = word => {
|
|
|
4053
4042
|
const noTypeDefinitionFound = () => {
|
|
4054
4043
|
return i18nString(NoTypeDefinitionFound);
|
|
4055
4044
|
};
|
|
4056
|
-
const noResults
|
|
4045
|
+
const noResults = () => {
|
|
4057
4046
|
return i18nString(NoResults);
|
|
4058
4047
|
};
|
|
4059
4048
|
const sourceAction = () => {
|
|
@@ -4177,7 +4166,7 @@ const goTo = async ({
|
|
|
4177
4166
|
endRowIndex: definition.endRowIndex,
|
|
4178
4167
|
endColumnIndex: definition.endColumnIndex
|
|
4179
4168
|
};
|
|
4180
|
-
await invoke$
|
|
4169
|
+
await invoke$7(/* Main.openUri */'Main.openUri', /* uri */uri, /* focus */true, context);
|
|
4181
4170
|
return editor;
|
|
4182
4171
|
} catch (error) {
|
|
4183
4172
|
// TODO if editor is already disposed at this point, do nothing
|
|
@@ -4254,7 +4243,7 @@ const getNoLocationFoundMessage = info => {
|
|
|
4254
4243
|
};
|
|
4255
4244
|
|
|
4256
4245
|
const getTypeDefinition = async (editor, offset) => {
|
|
4257
|
-
const definition = await invoke$
|
|
4246
|
+
const definition = await invoke$7('ExtensionHostTypeDefinition.executeTypeDefinitionProvider', editor, offset);
|
|
4258
4247
|
return definition;
|
|
4259
4248
|
};
|
|
4260
4249
|
|
|
@@ -4294,7 +4283,7 @@ const goToTypeDefinition = async (editor, explicit = true) => {
|
|
|
4294
4283
|
const Editor = 3;
|
|
4295
4284
|
|
|
4296
4285
|
const handleContextMenu = async (editor, button, x, y) => {
|
|
4297
|
-
await invoke$
|
|
4286
|
+
await invoke$7(/* ContextMenu.show */'ContextMenu.show', /* x */x, /* y */y, /* id */Editor);
|
|
4298
4287
|
return editor;
|
|
4299
4288
|
};
|
|
4300
4289
|
|
|
@@ -4332,7 +4321,7 @@ const WhenExpressionEditorText = 12;
|
|
|
4332
4321
|
const handleFocus = editor => {
|
|
4333
4322
|
// TODO make change events functional,
|
|
4334
4323
|
// when rendering, send focus changes to renderer worker
|
|
4335
|
-
invoke$
|
|
4324
|
+
invoke$7('Focus.setFocus', WhenExpressionEditorText);
|
|
4336
4325
|
return editor;
|
|
4337
4326
|
};
|
|
4338
4327
|
|
|
@@ -4993,7 +4982,7 @@ const indentMore = editor => {
|
|
|
4993
4982
|
};
|
|
4994
4983
|
|
|
4995
4984
|
const getLanguageConfiguration = async editor => {
|
|
4996
|
-
return invoke$
|
|
4985
|
+
return invoke$7('Languages.getLanguageConfiguration', {
|
|
4997
4986
|
uri: editor.uri,
|
|
4998
4987
|
languageId: editor.languageId
|
|
4999
4988
|
});
|
|
@@ -5265,7 +5254,6 @@ const moveSelectionPx = (editor, x, y) => {
|
|
|
5265
5254
|
return editorMoveSelection(editor, position);
|
|
5266
5255
|
};
|
|
5267
5256
|
|
|
5268
|
-
const User = 1;
|
|
5269
5257
|
const Script = 2;
|
|
5270
5258
|
const Unknown$1 = 0;
|
|
5271
5259
|
|
|
@@ -5297,7 +5285,7 @@ const create$6 = () => {
|
|
|
5297
5285
|
return widget;
|
|
5298
5286
|
};
|
|
5299
5287
|
|
|
5300
|
-
const newStateGenerator$
|
|
5288
|
+
const newStateGenerator$3 = async state => {
|
|
5301
5289
|
const latestState = {
|
|
5302
5290
|
...state,
|
|
5303
5291
|
x: 100,
|
|
@@ -5309,7 +5297,7 @@ const newStateGenerator$1 = async state => {
|
|
|
5309
5297
|
};
|
|
5310
5298
|
const openCodeGenerator = async editor => {
|
|
5311
5299
|
const fullFocus = true;
|
|
5312
|
-
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$6, newStateGenerator$
|
|
5300
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$6, newStateGenerator$3, fullFocus);
|
|
5313
5301
|
};
|
|
5314
5302
|
|
|
5315
5303
|
const create$5 = () => {
|
|
@@ -5825,337 +5813,82 @@ const create$4 = () => {
|
|
|
5825
5813
|
const widget = {
|
|
5826
5814
|
id: Find,
|
|
5827
5815
|
oldState: {
|
|
5828
|
-
value: '',
|
|
5829
|
-
ariaAnnouncement: '',
|
|
5830
|
-
matches: new Uint32Array(),
|
|
5831
|
-
matchIndex: -1,
|
|
5832
|
-
matchCount: 0,
|
|
5833
5816
|
uid,
|
|
5834
|
-
replaceExpanded: false,
|
|
5835
|
-
useRegularExpression: false,
|
|
5836
|
-
matchCase: false,
|
|
5837
|
-
matchWholeWord: false,
|
|
5838
|
-
replacement: '',
|
|
5839
|
-
editorUid: 0,
|
|
5840
5817
|
x: 0,
|
|
5841
5818
|
y: 0,
|
|
5842
5819
|
width: 0,
|
|
5843
5820
|
height: 0,
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
focus: 0
|
|
5821
|
+
commands: [],
|
|
5822
|
+
editorUid: 0
|
|
5847
5823
|
},
|
|
5848
5824
|
newState: {
|
|
5849
|
-
value: '',
|
|
5850
|
-
ariaAnnouncement: '',
|
|
5851
|
-
matches: new Uint32Array(),
|
|
5852
|
-
matchIndex: -1,
|
|
5853
|
-
matchCount: 0,
|
|
5854
5825
|
uid,
|
|
5855
|
-
replaceExpanded: false,
|
|
5856
|
-
useRegularExpression: false,
|
|
5857
|
-
matchCase: false,
|
|
5858
|
-
matchWholeWord: false,
|
|
5859
|
-
replacement: '',
|
|
5860
|
-
editorUid: 0,
|
|
5861
5826
|
x: 0,
|
|
5862
5827
|
y: 0,
|
|
5863
5828
|
width: 0,
|
|
5864
5829
|
height: 0,
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
focus: 0
|
|
5830
|
+
commands: [],
|
|
5831
|
+
editorUid: 0
|
|
5868
5832
|
}
|
|
5869
5833
|
};
|
|
5870
5834
|
return widget;
|
|
5871
5835
|
};
|
|
5872
5836
|
|
|
5873
|
-
const
|
|
5874
|
-
|
|
5875
|
-
throw new Error('regex must be global');
|
|
5876
|
-
}
|
|
5877
|
-
const {
|
|
5878
|
-
length
|
|
5879
|
-
} = lines;
|
|
5880
|
-
const matches = [];
|
|
5881
|
-
for (let i = 0; i < length; i++) {
|
|
5882
|
-
const line = lines[i];
|
|
5883
|
-
let lastMatch;
|
|
5884
|
-
do {
|
|
5885
|
-
lastMatch = regex.exec(line);
|
|
5886
|
-
if (!lastMatch) {
|
|
5887
|
-
break;
|
|
5888
|
-
}
|
|
5889
|
-
matches.push(i, lastMatch.index);
|
|
5890
|
-
} while (true);
|
|
5891
|
-
}
|
|
5892
|
-
return new Uint32Array(matches);
|
|
5893
|
-
};
|
|
5894
|
-
|
|
5895
|
-
// copied from https://github.com/microsoft/vscode/tree/main/src/vs/base/common/strings.ts by Microsoft (License MIT)
|
|
5896
|
-
|
|
5897
|
-
const RE_ESCAPE = /[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g;
|
|
5898
|
-
const escapeRegExpCharacters = value => {
|
|
5899
|
-
return value.replaceAll(RE_ESCAPE, String.raw`\$&`);
|
|
5900
|
-
};
|
|
5901
|
-
|
|
5902
|
-
const regexFlags = 'gi';
|
|
5903
|
-
const getSearchRegex = searchString => {
|
|
5904
|
-
const escaped = escapeRegExpCharacters(searchString);
|
|
5905
|
-
return new RegExp(escaped, regexFlags);
|
|
5906
|
-
};
|
|
5907
|
-
|
|
5908
|
-
const findMatchesCaseInsensitive = (lines, searchString) => {
|
|
5909
|
-
if (searchString.length === 0) {
|
|
5910
|
-
return new Uint32Array([]);
|
|
5911
|
-
}
|
|
5912
|
-
const regex = getSearchRegex(searchString);
|
|
5913
|
-
return findRegexMatches(lines, regex);
|
|
5914
|
-
};
|
|
5915
|
-
|
|
5916
|
-
const getMatchCount = matches => {
|
|
5917
|
-
return matches.length / 2;
|
|
5918
|
-
};
|
|
5919
|
-
|
|
5920
|
-
const setFindWidgetFocus = (state, focusKey) => {
|
|
5921
|
-
if (state.focus === focusKey) {
|
|
5922
|
-
return state;
|
|
5923
|
-
}
|
|
5924
|
-
return {
|
|
5925
|
-
...state,
|
|
5926
|
-
focus: focusKey,
|
|
5927
|
-
focusSource: Script
|
|
5928
|
-
};
|
|
5929
|
-
};
|
|
5930
|
-
|
|
5931
|
-
const focusCloseButton = state => {
|
|
5932
|
-
return setFindWidgetFocus(state, FocusFindWidgetCloseButton$1);
|
|
5933
|
-
};
|
|
5934
|
-
|
|
5935
|
-
const focusFind = state => {
|
|
5936
|
-
return setFindWidgetFocus(state, FindWidget);
|
|
5937
|
-
};
|
|
5938
|
-
|
|
5939
|
-
const getWidgetState = (editor, id) => {
|
|
5837
|
+
const launchFindWidgetWorker = async () => {
|
|
5838
|
+
const name = 'Find Widget Worker';
|
|
5940
5839
|
const {
|
|
5941
|
-
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
const
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
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;
|
|
5957
5857
|
};
|
|
5958
|
-
// TODO don't call renderer worker, set editor state
|
|
5959
|
-
// TODO this function should be synchronous
|
|
5960
|
-
const focusIndex$2 = (editor, index) => {
|
|
5961
|
-
const findState = getFindState(editor);
|
|
5962
|
-
if (!findState) {
|
|
5963
|
-
return editor;
|
|
5964
|
-
}
|
|
5965
|
-
const {
|
|
5966
|
-
value,
|
|
5967
|
-
matches,
|
|
5968
|
-
matchIndex
|
|
5969
|
-
} = findState;
|
|
5970
|
-
if (index === matchIndex) {
|
|
5971
|
-
return editor;
|
|
5972
|
-
}
|
|
5973
|
-
const {
|
|
5974
|
-
widgets
|
|
5975
|
-
} = editor;
|
|
5976
|
-
const childIndex = widgets.findIndex(isFind);
|
|
5977
|
-
const childWidget = widgets[childIndex];
|
|
5978
5858
|
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
const newState = {
|
|
5984
|
-
...findState,
|
|
5985
|
-
matchIndex: index
|
|
5986
|
-
};
|
|
5987
|
-
const newWidget = {
|
|
5988
|
-
...childWidget,
|
|
5989
|
-
newState
|
|
5990
|
-
};
|
|
5991
|
-
const newWidgets = [...widgets.slice(0, childIndex), newWidget, ...widgets.slice(childIndex + 1)];
|
|
5992
|
-
return {
|
|
5993
|
-
...editor,
|
|
5994
|
-
selections: newSelections,
|
|
5995
|
-
widgets: newWidgets
|
|
5996
|
-
};
|
|
5997
|
-
};
|
|
5998
|
-
const focusFirst$1 = editor => {
|
|
5999
|
-
const findState = getFindState(editor);
|
|
6000
|
-
if (!findState) {
|
|
6001
|
-
return editor;
|
|
6002
|
-
}
|
|
6003
|
-
return focusIndex$2(editor, 0);
|
|
6004
|
-
};
|
|
6005
|
-
const focusLast = editor => {
|
|
6006
|
-
const findState = getFindState(editor);
|
|
6007
|
-
if (!findState) {
|
|
6008
|
-
return editor;
|
|
6009
|
-
}
|
|
6010
|
-
const {
|
|
6011
|
-
matchCount
|
|
6012
|
-
} = findState;
|
|
6013
|
-
return focusIndex$2(editor, matchCount - 1);
|
|
6014
|
-
};
|
|
6015
|
-
const focusNext$2 = editor => {
|
|
6016
|
-
const findState = getFindState(editor);
|
|
6017
|
-
if (!findState) {
|
|
6018
|
-
return editor;
|
|
6019
|
-
}
|
|
6020
|
-
const {
|
|
6021
|
-
matchIndex,
|
|
6022
|
-
matchCount
|
|
6023
|
-
} = findState;
|
|
6024
|
-
if (matchIndex === matchCount - 1) {
|
|
6025
|
-
return focusFirst$1(editor);
|
|
6026
|
-
}
|
|
6027
|
-
return focusIndex$2(editor, matchIndex + 1);
|
|
6028
|
-
};
|
|
6029
|
-
const focusPrevious$1 = editor => {
|
|
6030
|
-
const findState = getFindState(editor);
|
|
6031
|
-
if (!findState) {
|
|
6032
|
-
return editor;
|
|
6033
|
-
}
|
|
6034
|
-
const {
|
|
6035
|
-
matchIndex
|
|
6036
|
-
} = findState;
|
|
6037
|
-
if (matchIndex === 0) {
|
|
6038
|
-
return focusLast(editor);
|
|
5859
|
+
let workerPromise$2;
|
|
5860
|
+
const getOrCreate$2 = () => {
|
|
5861
|
+
if (!workerPromise$2) {
|
|
5862
|
+
workerPromise$2 = launchFindWidgetWorker();
|
|
6039
5863
|
}
|
|
6040
|
-
return
|
|
6041
|
-
};
|
|
6042
|
-
|
|
6043
|
-
const focusNextMatchButton = state => {
|
|
6044
|
-
return setFindWidgetFocus(state, FocusFindWidgetNextMatchButton$1);
|
|
6045
|
-
};
|
|
6046
|
-
|
|
6047
|
-
const focusPreviousMatchButton = state => {
|
|
6048
|
-
return setFindWidgetFocus(state, FocusFindWidgetPreviousMatchButton$1);
|
|
5864
|
+
return workerPromise$2;
|
|
6049
5865
|
};
|
|
6050
|
-
|
|
6051
|
-
const
|
|
6052
|
-
return
|
|
6053
|
-
};
|
|
6054
|
-
|
|
6055
|
-
const focusReplaceAllButton = state => {
|
|
6056
|
-
return setFindWidgetFocus(state, FocusFindWidgetReplaceAllButton$1);
|
|
6057
|
-
};
|
|
6058
|
-
|
|
6059
|
-
const focusReplaceButton = state => {
|
|
6060
|
-
return setFindWidgetFocus(state, FocusFindWidgetReplaceButton$1);
|
|
6061
|
-
};
|
|
6062
|
-
|
|
6063
|
-
const focusToggleReplaceButton = state => {
|
|
6064
|
-
return setFindWidgetFocus(state, FocusFindWidgetToggleReplace);
|
|
6065
|
-
};
|
|
6066
|
-
|
|
6067
|
-
const handleBlur$1 = async state => {
|
|
6068
|
-
await setFocus(Empty);
|
|
6069
|
-
return state;
|
|
6070
|
-
};
|
|
6071
|
-
|
|
6072
|
-
const refresh$1 = (editor, state, value) => {
|
|
6073
|
-
const {
|
|
6074
|
-
lines
|
|
6075
|
-
} = editor;
|
|
6076
|
-
const matches = findMatchesCaseInsensitive(lines, value);
|
|
6077
|
-
const matchCount = getMatchCount(matches);
|
|
6078
|
-
return {
|
|
6079
|
-
...state,
|
|
6080
|
-
matches,
|
|
6081
|
-
matchIndex: 0,
|
|
6082
|
-
matchCount,
|
|
6083
|
-
value
|
|
6084
|
-
};
|
|
5866
|
+
const invoke$4 = async (method, ...params) => {
|
|
5867
|
+
const worker = await getOrCreate$2();
|
|
5868
|
+
return await worker.invoke(method, ...params);
|
|
6085
5869
|
};
|
|
6086
5870
|
|
|
6087
|
-
const
|
|
6088
|
-
// TODO get focused editor
|
|
5871
|
+
const loadContent$1 = async (state, parentUid) => {
|
|
6089
5872
|
const {
|
|
6090
|
-
|
|
5873
|
+
uid
|
|
6091
5874
|
} = state;
|
|
6092
|
-
|
|
6093
|
-
const editor = getEditor(editorUid);
|
|
6094
|
-
return refresh$1(editor, state, value);
|
|
6095
|
-
};
|
|
6096
|
-
|
|
6097
|
-
const handleInput = (state, value) => {
|
|
6098
|
-
return refresh(state, value);
|
|
6099
|
-
};
|
|
6100
|
-
|
|
6101
|
-
const handleFindWidgetFocus = (state, focusKey) => {
|
|
6102
|
-
if (state.focus === focusKey) {
|
|
6103
|
-
return state;
|
|
6104
|
-
}
|
|
6105
|
-
return {
|
|
6106
|
-
...state,
|
|
6107
|
-
focus: focusKey,
|
|
6108
|
-
focusSource: User
|
|
6109
|
-
};
|
|
6110
|
-
};
|
|
6111
|
-
|
|
6112
|
-
const handleReplaceAllFocus = state => {
|
|
6113
|
-
return handleFindWidgetFocus(state, FocusFindWidgetReplaceAllButton$1);
|
|
6114
|
-
};
|
|
6115
|
-
|
|
6116
|
-
const handleReplaceFocus = state => {
|
|
6117
|
-
return handleFindWidgetFocus(state, FocusFindWidgetReplace$1);
|
|
6118
|
-
};
|
|
6119
|
-
|
|
6120
|
-
const getFindWidgetHeight = replaceExpanded => {
|
|
6121
|
-
const collapsedHeight = 30;
|
|
6122
|
-
const expandedHeight = 60;
|
|
6123
|
-
const newHeight = replaceExpanded ? expandedHeight : collapsedHeight;
|
|
6124
|
-
return newHeight;
|
|
6125
|
-
};
|
|
6126
|
-
|
|
6127
|
-
const toggleReplace = state => {
|
|
6128
|
-
const newExpanded = !state.replaceExpanded;
|
|
6129
|
-
const newHeight = getFindWidgetHeight(newExpanded);
|
|
6130
|
-
return {
|
|
6131
|
-
...state,
|
|
6132
|
-
replaceExpanded: !state.replaceExpanded,
|
|
6133
|
-
height: newHeight
|
|
6134
|
-
};
|
|
6135
|
-
};
|
|
6136
|
-
|
|
6137
|
-
const loadContent$1 = editorId => {
|
|
6138
|
-
const editor = getEditor(editorId);
|
|
5875
|
+
const editor = getEditor(parentUid);
|
|
6139
5876
|
const {
|
|
6140
|
-
|
|
6141
|
-
|
|
5877
|
+
x,
|
|
5878
|
+
y,
|
|
5879
|
+
width,
|
|
5880
|
+
height
|
|
6142
5881
|
} = editor;
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
const
|
|
6146
|
-
const
|
|
6147
|
-
const value = line.slice(startColumnIndex, endColumnIndex);
|
|
6148
|
-
const matches = findMatchesCaseInsensitive(lines, value);
|
|
6149
|
-
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);
|
|
6150
5886
|
return {
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
matchIndex: 0,
|
|
6154
|
-
matchCount,
|
|
6155
|
-
editorUid: editor.uid
|
|
5887
|
+
...state,
|
|
5888
|
+
commands
|
|
6156
5889
|
};
|
|
6157
5890
|
};
|
|
6158
|
-
const close
|
|
5891
|
+
const close = async state => {
|
|
6159
5892
|
// TODO
|
|
6160
5893
|
// await Viewlet.closeWidget(uid)
|
|
6161
5894
|
return {
|
|
@@ -6163,155 +5896,108 @@ const close$1 = async state => {
|
|
|
6163
5896
|
disposed: true
|
|
6164
5897
|
};
|
|
6165
5898
|
};
|
|
6166
|
-
const handleToggleReplaceFocus = async state => {
|
|
6167
|
-
if (state.focus === FocusFindWidgetToggleReplace) {
|
|
6168
|
-
return state;
|
|
6169
|
-
}
|
|
6170
|
-
await setFocus(FocusFindWidgetToggleReplace);
|
|
6171
|
-
return {
|
|
6172
|
-
...state,
|
|
6173
|
-
focus: FocusFindWidgetToggleReplace
|
|
6174
|
-
};
|
|
6175
|
-
};
|
|
6176
|
-
const handleReplaceInput = (state, value) => {
|
|
6177
|
-
return {
|
|
6178
|
-
...state,
|
|
6179
|
-
replacement: value
|
|
6180
|
-
};
|
|
6181
|
-
};
|
|
6182
5899
|
|
|
6183
|
-
const
|
|
6184
|
-
|
|
6185
|
-
const height = 30;
|
|
6186
|
-
const paddingTop = 10;
|
|
6187
|
-
const paddingRight = 20;
|
|
6188
|
-
const x = editor.x + editor.width - width - paddingRight;
|
|
6189
|
-
const y = editor.y + paddingTop;
|
|
6190
|
-
return {
|
|
6191
|
-
y,
|
|
6192
|
-
x,
|
|
6193
|
-
width,
|
|
6194
|
-
height
|
|
6195
|
-
};
|
|
5900
|
+
const newStateGenerator$2 = (state, parentUid) => {
|
|
5901
|
+
return loadContent$1(state, parentUid);
|
|
6196
5902
|
};
|
|
6197
|
-
|
|
6198
5903
|
const openFind2 = async editor => {
|
|
6199
|
-
const newStateGenerator = async state => {
|
|
6200
|
-
const {
|
|
6201
|
-
value,
|
|
6202
|
-
matches,
|
|
6203
|
-
matchCount,
|
|
6204
|
-
matchIndex
|
|
6205
|
-
} = await loadContent$1(editor.uid);
|
|
6206
|
-
const {
|
|
6207
|
-
x,
|
|
6208
|
-
y,
|
|
6209
|
-
width,
|
|
6210
|
-
height
|
|
6211
|
-
} = getFindWidgetPosition(editor);
|
|
6212
|
-
const latestState = {
|
|
6213
|
-
...state,
|
|
6214
|
-
value,
|
|
6215
|
-
matches,
|
|
6216
|
-
matchCount,
|
|
6217
|
-
matchIndex,
|
|
6218
|
-
x,
|
|
6219
|
-
y,
|
|
6220
|
-
width,
|
|
6221
|
-
height,
|
|
6222
|
-
editorUid: editor.uid || editor.id,
|
|
6223
|
-
focusSource: Script,
|
|
6224
|
-
focus: FindWidget
|
|
6225
|
-
};
|
|
6226
|
-
return latestState;
|
|
6227
|
-
};
|
|
6228
5904
|
const fullFocus = true;
|
|
6229
|
-
return addWidgetToEditor(
|
|
5905
|
+
return addWidgetToEditor(ColorPicker, FindWidget, editor, create$4, newStateGenerator$2, fullFocus);
|
|
6230
5906
|
};
|
|
6231
5907
|
|
|
6232
5908
|
const openFind = async state => {
|
|
6233
5909
|
return openFind2(state);
|
|
6234
5910
|
};
|
|
6235
5911
|
|
|
6236
|
-
const getRenamePosition = editor => {
|
|
6237
|
-
const width = 300;
|
|
6238
|
-
const height = 30;
|
|
6239
|
-
const paddingTop = 10;
|
|
6240
|
-
const cursor = getPositionAtCursor$1(editor);
|
|
6241
|
-
const {
|
|
6242
|
-
x
|
|
6243
|
-
} = cursor;
|
|
6244
|
-
const y = cursor.y + paddingTop;
|
|
6245
|
-
return {
|
|
6246
|
-
y,
|
|
6247
|
-
x,
|
|
6248
|
-
width,
|
|
6249
|
-
height
|
|
6250
|
-
};
|
|
6251
|
-
};
|
|
6252
|
-
|
|
6253
5912
|
const create$3 = () => {
|
|
6254
5913
|
const completionUid = create$8();
|
|
6255
5914
|
const renameWidget = {
|
|
6256
5915
|
id: Rename,
|
|
6257
5916
|
oldState: {
|
|
6258
5917
|
uid: completionUid,
|
|
6259
|
-
focusedIndex: -1,
|
|
6260
|
-
oldValue: '',
|
|
6261
|
-
newValue: '',
|
|
6262
|
-
focused: false,
|
|
6263
5918
|
x: 0,
|
|
6264
5919
|
y: 0,
|
|
6265
5920
|
width: 0,
|
|
6266
|
-
height: 0
|
|
5921
|
+
height: 0,
|
|
5922
|
+
commands: []
|
|
6267
5923
|
},
|
|
6268
5924
|
newState: {
|
|
6269
5925
|
uid: completionUid,
|
|
6270
|
-
focusedIndex: -1,
|
|
6271
|
-
oldValue: '',
|
|
6272
|
-
newValue: '',
|
|
6273
|
-
focused: true,
|
|
6274
5926
|
x: 0,
|
|
6275
5927
|
y: 0,
|
|
6276
5928
|
width: 0,
|
|
6277
|
-
height: 0
|
|
5929
|
+
height: 0,
|
|
5930
|
+
commands: []
|
|
6278
5931
|
}
|
|
6279
5932
|
};
|
|
6280
5933
|
return renameWidget;
|
|
6281
5934
|
};
|
|
6282
5935
|
|
|
6283
|
-
const
|
|
6284
|
-
const
|
|
6285
|
-
rowIndex,
|
|
6286
|
-
columnIndex
|
|
6287
|
-
} = getPositionAtCursor$1(editor);
|
|
5936
|
+
const launchRenameWorker = async () => {
|
|
5937
|
+
const name = 'Rename Worker';
|
|
6288
5938
|
const {
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
5939
|
+
port1,
|
|
5940
|
+
port2
|
|
5941
|
+
} = getPortTuple();
|
|
5942
|
+
await invokeAndTransfer('IpcParent.create', {
|
|
5943
|
+
method: ModuleWorkerAndWorkaroundForChromeDevtoolsBug,
|
|
5944
|
+
url: 'renameWorkerMain.js',
|
|
5945
|
+
name: name,
|
|
5946
|
+
raw: true,
|
|
5947
|
+
port: port1
|
|
5948
|
+
});
|
|
5949
|
+
const rpc = await MessagePortRpcParent.create({
|
|
5950
|
+
commandMap: {},
|
|
5951
|
+
messagePort: port2,
|
|
5952
|
+
isMessagePortOpen: true
|
|
5953
|
+
});
|
|
5954
|
+
port2.start();
|
|
5955
|
+
return rpc;
|
|
5956
|
+
};
|
|
5957
|
+
|
|
5958
|
+
let workerPromise$1;
|
|
5959
|
+
const getOrCreate$1 = () => {
|
|
5960
|
+
if (!workerPromise$1) {
|
|
5961
|
+
workerPromise$1 = launchRenameWorker();
|
|
6293
5962
|
}
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
5963
|
+
return workerPromise$1;
|
|
5964
|
+
};
|
|
5965
|
+
const invoke$3 = async (method, ...params) => {
|
|
5966
|
+
const worker = await getOrCreate$1();
|
|
5967
|
+
return await worker.invoke(method, ...params);
|
|
5968
|
+
};
|
|
5969
|
+
|
|
5970
|
+
const newStateGenerator$1 = async (state, parentUid) => {
|
|
5971
|
+
// const editor: any = {}
|
|
5972
|
+
const {
|
|
5973
|
+
uid,
|
|
5974
|
+
x,
|
|
5975
|
+
y,
|
|
5976
|
+
width,
|
|
5977
|
+
height
|
|
5978
|
+
} = state;
|
|
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);
|
|
5983
|
+
return {
|
|
5984
|
+
...state,
|
|
5985
|
+
commands
|
|
6312
5986
|
};
|
|
5987
|
+
};
|
|
5988
|
+
const openRename = async editor => {
|
|
5989
|
+
const {
|
|
5990
|
+
rowIndex,
|
|
5991
|
+
columnIndex
|
|
5992
|
+
} = getPositionAtCursor$1(editor);
|
|
5993
|
+
const {
|
|
5994
|
+
word
|
|
5995
|
+
} = getWordAt$1(editor, rowIndex, columnIndex);
|
|
5996
|
+
if (!word) {
|
|
5997
|
+
return editor;
|
|
5998
|
+
}
|
|
6313
5999
|
const fullFocus = true;
|
|
6314
|
-
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$3, newStateGenerator, fullFocus);
|
|
6000
|
+
return addWidgetToEditor(Rename, FocusEditorRename$1, editor, create$3, newStateGenerator$1, fullFocus);
|
|
6315
6001
|
};
|
|
6316
6002
|
|
|
6317
6003
|
const getOrganizeImportEdits = async editor => {
|
|
@@ -6339,7 +6025,7 @@ const pasteText = (editor, text) => {
|
|
|
6339
6025
|
};
|
|
6340
6026
|
|
|
6341
6027
|
const paste = async editor => {
|
|
6342
|
-
const text = await invoke$
|
|
6028
|
+
const text = await invoke$7('ClipBoard.readText');
|
|
6343
6029
|
string(text);
|
|
6344
6030
|
return pasteText(editor, text);
|
|
6345
6031
|
};
|
|
@@ -6481,7 +6167,7 @@ const save = async editor => {
|
|
|
6481
6167
|
} = editor;
|
|
6482
6168
|
const newEditor = await getNewEditor(editor);
|
|
6483
6169
|
const content = getText$1(newEditor);
|
|
6484
|
-
await invoke$
|
|
6170
|
+
await invoke$7('FileSystem.writeFile', uri, content);
|
|
6485
6171
|
return newEditor;
|
|
6486
6172
|
} catch (error) {
|
|
6487
6173
|
// @ts-ignore
|
|
@@ -6787,7 +6473,7 @@ const selectInsideString = editor => {
|
|
|
6787
6473
|
// import * as ExtensionHostSelection from '../ExtensionHost/ExtensionHostSelection.ts'
|
|
6788
6474
|
|
|
6789
6475
|
const getNewSelections = async (editor, selections) => {
|
|
6790
|
-
const newSelections = await invoke$
|
|
6476
|
+
const newSelections = await invoke$7('ExtensionHostSelection.executeGrowSelection', editor, selections);
|
|
6791
6477
|
if (newSelections.length === 0) {
|
|
6792
6478
|
return selections;
|
|
6793
6479
|
}
|
|
@@ -7041,7 +6727,7 @@ const getEnabled$1 = () => {
|
|
|
7041
6727
|
|
|
7042
6728
|
const {
|
|
7043
6729
|
listen: listen$3,
|
|
7044
|
-
invoke: invoke$
|
|
6730
|
+
invoke: invoke$2
|
|
7045
6731
|
} = createRpc(SyntaxHighlightingWorker);
|
|
7046
6732
|
|
|
7047
6733
|
/**
|
|
@@ -7111,7 +6797,7 @@ const loadTokenizer = async (languageId, tokenizePath) => {
|
|
|
7111
6797
|
return;
|
|
7112
6798
|
}
|
|
7113
6799
|
if (getEnabled$1()) {
|
|
7114
|
-
const tokenMap = await invoke$
|
|
6800
|
+
const tokenMap = await invoke$2('Tokenizer.load', languageId, tokenizePath);
|
|
7115
6801
|
set$1(languageId, tokenMap);
|
|
7116
6802
|
return;
|
|
7117
6803
|
}
|
|
@@ -7276,12 +6962,12 @@ const listen$2 = async () => {
|
|
|
7276
6962
|
handleIpc(ipc);
|
|
7277
6963
|
_ipc = ipc;
|
|
7278
6964
|
};
|
|
7279
|
-
const invoke = async (method, ...args) => {
|
|
7280
|
-
return invoke$
|
|
6965
|
+
const invoke$1 = async (method, ...args) => {
|
|
6966
|
+
return invoke$9(_ipc, method, ...args);
|
|
7281
6967
|
};
|
|
7282
6968
|
|
|
7283
6969
|
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
7284
|
-
return invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width);
|
|
6970
|
+
return invoke$1('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width);
|
|
7285
6971
|
};
|
|
7286
6972
|
|
|
7287
6973
|
const deepCopy = value => {
|
|
@@ -7492,13 +7178,13 @@ const showHover2 = async editor => {
|
|
|
7492
7178
|
|
|
7493
7179
|
const EditorHover = 'EditorHover';
|
|
7494
7180
|
const showHover = async state => {
|
|
7495
|
-
await invoke$
|
|
7181
|
+
await invoke$7('Viewlet.openWidget', EditorHover);
|
|
7496
7182
|
return state;
|
|
7497
7183
|
};
|
|
7498
7184
|
|
|
7499
7185
|
// TODO ask extension host worker instead
|
|
7500
7186
|
const getEditorSourceActions = async () => {
|
|
7501
|
-
const sourceActions = await invoke$
|
|
7187
|
+
const sourceActions = await invoke$7('GetEditorSourceActions.getEditorSourceActions');
|
|
7502
7188
|
return sourceActions;
|
|
7503
7189
|
};
|
|
7504
7190
|
|
|
@@ -8148,7 +7834,7 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
8148
7834
|
|
|
8149
7835
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
8150
7836
|
const offset = offsetAt(editor, editor.selections[0], editor.selections[1]);
|
|
8151
|
-
const result = await invoke$
|
|
7837
|
+
const result = await invoke$7('ExtensionHostClosingTagCompletion.executeClosingTagProvider', editor, offset, text);
|
|
8152
7838
|
if (!result) {
|
|
8153
7839
|
const changes = editorReplaceSelections(editor, [text], EditorType);
|
|
8154
7840
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
@@ -8486,6 +8172,18 @@ const getCompletionDetailBounds = (completionBounds, borderSize) => {
|
|
|
8486
8172
|
};
|
|
8487
8173
|
};
|
|
8488
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
|
+
|
|
8489
8187
|
const getCompletionState = editor => {
|
|
8490
8188
|
return getWidgetState(editor, Completion);
|
|
8491
8189
|
};
|
|
@@ -8649,29 +8347,17 @@ const EditorSelection = 'EditorSelection';
|
|
|
8649
8347
|
const EditorSourceActions = 'EditorSourceActions';
|
|
8650
8348
|
const EditorSourceActionsList = 'EditorSourceActionsList';
|
|
8651
8349
|
const FileIcon = 'FileIcon';
|
|
8652
|
-
const FindWidgetFind = 'FindWidgetFind';
|
|
8653
|
-
const FindWidgetMatchCount = 'FindWidgetMatchCount';
|
|
8654
|
-
const FindWidgetMatchCountEmpty = 'FindWidgetMatchCountEmpty';
|
|
8655
|
-
const FindWidgetReplace = 'FindWidgetReplace';
|
|
8656
|
-
const FindWidgetRight = 'FindWidgetRight';
|
|
8657
8350
|
const HoverDisplayString = 'HoverDisplayString';
|
|
8658
8351
|
const HoverDocumentation = 'HoverDocumentation';
|
|
8659
8352
|
const HoverEditorRow = 'HoverEditorRow';
|
|
8660
8353
|
const HoverProblem = 'HoverProblem';
|
|
8661
8354
|
const HoverProblemDetail = 'HoverProblemDetail';
|
|
8662
8355
|
const HoverProblemMessage = 'HoverProblemMessage';
|
|
8663
|
-
const IconButton = 'IconButton';
|
|
8664
|
-
const IconButtonDisabled = 'IconButtonDisabled';
|
|
8665
8356
|
const IconClose = 'IconClose';
|
|
8666
8357
|
const InputBox = 'InputBox';
|
|
8667
8358
|
const Label = 'Label';
|
|
8668
8359
|
const MaskIcon = 'MaskIcon';
|
|
8669
8360
|
const MaskIconSymbolFile = 'MaskIconSymbolFile';
|
|
8670
|
-
const MultilineInputBox = 'MultilineInputBox';
|
|
8671
|
-
const SearchField = 'SearchField';
|
|
8672
|
-
const SearchFieldButton = 'SearchFieldButton';
|
|
8673
|
-
const SearchFieldButtonChecked = 'SearchFieldButtonChecked';
|
|
8674
|
-
const SearchFieldButtons = 'SearchFieldButtons';
|
|
8675
8361
|
const SourceActionHeading = 'SourceActionHeading';
|
|
8676
8362
|
const SourceActionIcon = 'SourceActionIcon';
|
|
8677
8363
|
const SourceActionItem = 'SourceActionItem';
|
|
@@ -8681,11 +8367,6 @@ const Viewlet = 'Viewlet';
|
|
|
8681
8367
|
const HandleBeforeInput = 'handleBeforeInput';
|
|
8682
8368
|
const HandleBlur = 'handleBlur';
|
|
8683
8369
|
const HandleClick = 'handleClick';
|
|
8684
|
-
const HandleClickClose = 'handleClickClose';
|
|
8685
|
-
const HandleClickNextMatch = 'handleClickNextMatch';
|
|
8686
|
-
const HandleClickPreviousMatch = 'handleClickPreviousMatch';
|
|
8687
|
-
const HandleClickReplace = 'handleClickReplace';
|
|
8688
|
-
const HandleClickReplaceAll = 'handleClickReplaceAll';
|
|
8689
8370
|
const HandleClose = 'handleClose';
|
|
8690
8371
|
const HandleCompositionEnd = 'handleCompositionEnd';
|
|
8691
8372
|
const HandleCompositionStart = 'handleCompositionStart';
|
|
@@ -8694,20 +8375,15 @@ const HandleContextMenu = 'handleContextMenu';
|
|
|
8694
8375
|
const HandleCut = 'handleCut';
|
|
8695
8376
|
const HandleFocus = 'handleFocus';
|
|
8696
8377
|
const HandleFocusIn = 'handleFocusIn';
|
|
8697
|
-
const HandleInput = 'handleInput';
|
|
8698
8378
|
const HandleMouseMove = 'handleMouseMove';
|
|
8699
|
-
const HandleReplaceFocus = 'handleReplaceFocus';
|
|
8700
|
-
const HandleReplaceInput = 'handleReplaceInput';
|
|
8701
8379
|
const HandleSashPointerDown = 'handleSashPointerDown';
|
|
8702
8380
|
const HandleWheel = 'handleWheel';
|
|
8703
8381
|
|
|
8704
|
-
const Button = 1;
|
|
8705
8382
|
const Div = 4;
|
|
8706
8383
|
const Input = 6;
|
|
8707
8384
|
const Span = 8;
|
|
8708
8385
|
const Text = 12;
|
|
8709
8386
|
const Img = 17;
|
|
8710
|
-
const TextArea = 62;
|
|
8711
8387
|
|
|
8712
8388
|
const text = data => {
|
|
8713
8389
|
return {
|
|
@@ -8796,6 +8472,9 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
8796
8472
|
const AppendToBody = 'Viewlet.appendToBody';
|
|
8797
8473
|
const Focus = 'focus';
|
|
8798
8474
|
const RegisterEventListeners = 'Viewlet.registerEventListeners';
|
|
8475
|
+
const SetSelectionByName = 'Viewlet.setSelectionByName';
|
|
8476
|
+
const SetValueByName = 'Viewlet.setValueByName';
|
|
8477
|
+
const SetFocusContext = 'Viewlet.setFocusContext';
|
|
8799
8478
|
const SetBounds = 'setBounds';
|
|
8800
8479
|
const SetBounds2 = 'Viewlet.setBounds';
|
|
8801
8480
|
const SetContentHeight = 'setContentHeight';
|
|
@@ -8803,7 +8482,6 @@ const SetCss = 'Viewlet.setCss';
|
|
|
8803
8482
|
const SetDom2 = 'Viewlet.setDom2';
|
|
8804
8483
|
const SetNegativeMargin = 'setNegativeMargin';
|
|
8805
8484
|
const SetScrollBar = 'setScrollBar';
|
|
8806
|
-
const SetValue = 'setValue';
|
|
8807
8485
|
const SetUid = 'Viewlet.setUid';
|
|
8808
8486
|
|
|
8809
8487
|
const renderHoverDom = {
|
|
@@ -8815,7 +8493,7 @@ const renderHoverDom = {
|
|
|
8815
8493
|
return [/* method */SetDom2, dom];
|
|
8816
8494
|
}
|
|
8817
8495
|
};
|
|
8818
|
-
const renderBounds$
|
|
8496
|
+
const renderBounds$4 = {
|
|
8819
8497
|
isEqual(oldState, newState) {
|
|
8820
8498
|
return oldState.x === newState.x && oldState.y === newState.y;
|
|
8821
8499
|
},
|
|
@@ -8829,10 +8507,10 @@ const renderBounds$6 = {
|
|
|
8829
8507
|
return [SetBounds, x, y, width, height];
|
|
8830
8508
|
}
|
|
8831
8509
|
};
|
|
8832
|
-
const render$
|
|
8510
|
+
const render$d = [renderHoverDom, renderBounds$4];
|
|
8833
8511
|
const renderHover = (oldState, newState) => {
|
|
8834
8512
|
const commands = [];
|
|
8835
|
-
for (const item of render$
|
|
8513
|
+
for (const item of render$d) {
|
|
8836
8514
|
if (!item.isEqual(oldState, newState)) {
|
|
8837
8515
|
commands.push(item.apply(oldState, newState));
|
|
8838
8516
|
}
|
|
@@ -8840,79 +8518,6 @@ const renderHover = (oldState, newState) => {
|
|
|
8840
8518
|
return commands;
|
|
8841
8519
|
};
|
|
8842
8520
|
|
|
8843
|
-
const executeRenameProvider = async (editor, offset, newName) => {
|
|
8844
|
-
return execute({
|
|
8845
|
-
editor,
|
|
8846
|
-
event: OnRename,
|
|
8847
|
-
method: RenameExecuteRename,
|
|
8848
|
-
args: [offset, newName],
|
|
8849
|
-
noProviderFoundMessage: 'no rename provider found',
|
|
8850
|
-
noProviderFoundResult: []});
|
|
8851
|
-
};
|
|
8852
|
-
|
|
8853
|
-
const getRenameState = editor => {
|
|
8854
|
-
return getWidgetState(editor, Rename);
|
|
8855
|
-
};
|
|
8856
|
-
|
|
8857
|
-
const getRenameChanges = (editor, result) => {
|
|
8858
|
-
if (!result?.edits) {
|
|
8859
|
-
return [];
|
|
8860
|
-
}
|
|
8861
|
-
const changes = [];
|
|
8862
|
-
console.log({
|
|
8863
|
-
result
|
|
8864
|
-
});
|
|
8865
|
-
for (const edit of result.edits) {
|
|
8866
|
-
const position = positionAt(editor, edit.offset);
|
|
8867
|
-
const start = position;
|
|
8868
|
-
const end = {
|
|
8869
|
-
...position,
|
|
8870
|
-
columnIndex: start.columnIndex + edit.deleted
|
|
8871
|
-
};
|
|
8872
|
-
const selection = {
|
|
8873
|
-
start,
|
|
8874
|
-
end
|
|
8875
|
-
};
|
|
8876
|
-
changes.push({
|
|
8877
|
-
start,
|
|
8878
|
-
end,
|
|
8879
|
-
inserted: [result.inserted],
|
|
8880
|
-
deleted: getSelectionText(editor, selection),
|
|
8881
|
-
origin: Rename$1
|
|
8882
|
-
});
|
|
8883
|
-
}
|
|
8884
|
-
return changes;
|
|
8885
|
-
};
|
|
8886
|
-
const accept = async editor => {
|
|
8887
|
-
const child = getRenameState(editor);
|
|
8888
|
-
if (!child) {
|
|
8889
|
-
return editor;
|
|
8890
|
-
}
|
|
8891
|
-
const {
|
|
8892
|
-
widgets
|
|
8893
|
-
} = editor;
|
|
8894
|
-
const newWidgets = removeEditorWidget(widgets, Rename);
|
|
8895
|
-
// TODO
|
|
8896
|
-
const offset = getOffsetAtCursor(editor);
|
|
8897
|
-
const result = await executeRenameProvider(editor, offset, child.newValue);
|
|
8898
|
-
const changes = getRenameChanges(editor, result);
|
|
8899
|
-
console.log({
|
|
8900
|
-
changes
|
|
8901
|
-
});
|
|
8902
|
-
// 1. ask extension host for rename edits
|
|
8903
|
-
// 2. apply rename edit across editor (and whole workspace)
|
|
8904
|
-
// 3. close rename widget
|
|
8905
|
-
return {
|
|
8906
|
-
...editor,
|
|
8907
|
-
focused: true,
|
|
8908
|
-
widgets: newWidgets
|
|
8909
|
-
};
|
|
8910
|
-
};
|
|
8911
|
-
|
|
8912
|
-
const handleBlur = editor => {
|
|
8913
|
-
return closeRename(editor);
|
|
8914
|
-
};
|
|
8915
|
-
|
|
8916
8521
|
const rerender = editor => {
|
|
8917
8522
|
// TODO avoid slow clone
|
|
8918
8523
|
return structuredClone(editor);
|
|
@@ -8931,6 +8536,41 @@ const focusNext = state => {
|
|
|
8931
8536
|
return focusIndex(state, nextIndex);
|
|
8932
8537
|
};
|
|
8933
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
|
+
|
|
8934
8574
|
const updateWidget = (editor, widgetId, newState) => {
|
|
8935
8575
|
// TODO avoid closure
|
|
8936
8576
|
const isWidget = widget => {
|
|
@@ -8951,22 +8591,47 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
8951
8591
|
};
|
|
8952
8592
|
};
|
|
8953
8593
|
|
|
8954
|
-
const getInvoke =
|
|
8955
|
-
|
|
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
|
+
}
|
|
8956
8605
|
};
|
|
8957
|
-
const executeWidgetCommand = async (editor, name, method,
|
|
8958
|
-
const invoke = getInvoke();
|
|
8606
|
+
const executeWidgetCommand = async (editor, name, method, _uid, widgetId, ...params) => {
|
|
8607
|
+
const invoke = getInvoke(widgetId);
|
|
8959
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);
|
|
8960
8617
|
await invoke(`${name}.${actualMethod}`, uid, ...params);
|
|
8961
|
-
const diff = await invoke(`${name}.diff2`, uid);
|
|
8962
|
-
const commands = await invoke(`${name}.render2`, uid, diff);
|
|
8963
8618
|
const isWidget = widget => {
|
|
8964
8619
|
return widget.id === widgetId;
|
|
8965
8620
|
};
|
|
8966
|
-
const
|
|
8967
|
-
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];
|
|
8968
8633
|
const newState = {
|
|
8969
|
-
...childWidget.
|
|
8634
|
+
...childWidget.newState,
|
|
8970
8635
|
commands
|
|
8971
8636
|
};
|
|
8972
8637
|
const newEditor = updateWidget(editor, widgetId, newState);
|
|
@@ -8984,35 +8649,53 @@ const getWordAt = (editorUid, rowIndex, columnIndex) => {
|
|
|
8984
8649
|
} = getWordAt$1(editor, rowIndex, columnIndex);
|
|
8985
8650
|
return word;
|
|
8986
8651
|
};
|
|
8987
|
-
|
|
8988
|
-
const
|
|
8989
|
-
const
|
|
8990
|
-
|
|
8991
|
-
for (let i = 0; i < matches.length; i += 2) {
|
|
8992
|
-
const startRowIndex = matches[i];
|
|
8993
|
-
const startColumnIndex = matches[i + 1];
|
|
8994
|
-
const endRowIndex = matches[i];
|
|
8995
|
-
const endColumnIndex = matches[i] + oldValueLength;
|
|
8996
|
-
ranges.push(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex);
|
|
8997
|
-
}
|
|
8998
|
-
return replaceRange(editor, ranges, [newValue], ReplaceAll$2);
|
|
8652
|
+
const getWordAtOffset2 = editorUid => {
|
|
8653
|
+
const editor = getEditor(editorUid);
|
|
8654
|
+
const word = getWordAtOffset(editor);
|
|
8655
|
+
return word;
|
|
8999
8656
|
};
|
|
9000
|
-
|
|
9001
|
-
const
|
|
9002
|
-
const
|
|
9003
|
-
|
|
9004
|
-
|
|
9005
|
-
|
|
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);
|
|
9006
8664
|
const {
|
|
9007
|
-
|
|
9008
|
-
|
|
9009
|
-
|
|
9010
|
-
|
|
9011
|
-
|
|
9012
|
-
const
|
|
9013
|
-
const
|
|
9014
|
-
|
|
9015
|
-
|
|
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')
|
|
9016
8699
|
};
|
|
9017
8700
|
|
|
9018
8701
|
const pending = Object.create(null);
|
|
@@ -9893,10 +9576,10 @@ const getTokensViewport2 = async (editor, startLineIndex, endLineIndex, syncIncr
|
|
|
9893
9576
|
languageId,
|
|
9894
9577
|
invalidStartIndex
|
|
9895
9578
|
};
|
|
9896
|
-
return invoke$
|
|
9579
|
+
return invoke$2('GetTokensViewport.getTokensViewport', slimEditor, startLineIndex, endLineIndex, hasLinesToSend, id, linesToSend);
|
|
9897
9580
|
}
|
|
9898
9581
|
// TODO only send needed lines of text
|
|
9899
|
-
return invoke$
|
|
9582
|
+
return invoke$2('GetTokensViewport.getTokensViewport', editor, startLineIndex, endLineIndex, true, editor.id, editor.lines);
|
|
9900
9583
|
}
|
|
9901
9584
|
return getTokensViewport(editor, startLineIndex, endLineIndex);
|
|
9902
9585
|
};
|
|
@@ -10253,7 +9936,7 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
10253
9936
|
} = newState;
|
|
10254
9937
|
const oldLine = oldState.lines[rowIndex];
|
|
10255
9938
|
const newLine = lines[rowIndex];
|
|
10256
|
-
const incrementalEdits = await invoke$
|
|
9939
|
+
const incrementalEdits = await invoke$2('TokenizeIncremental.tokenizeIncremental', newState.uid, newState.languageId, oldLine, newLine, rowIndex, newState.minLineY);
|
|
10257
9940
|
if (incrementalEdits && incrementalEdits.length === 1) {
|
|
10258
9941
|
return incrementalEdits;
|
|
10259
9942
|
}
|
|
@@ -10357,7 +10040,7 @@ const renderScrollBarX = {
|
|
|
10357
10040
|
return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
|
|
10358
10041
|
}
|
|
10359
10042
|
};
|
|
10360
|
-
const renderFocus$
|
|
10043
|
+
const renderFocus$1 = {
|
|
10361
10044
|
isEqual(oldState, newState) {
|
|
10362
10045
|
return oldState.focused === newState.focused;
|
|
10363
10046
|
},
|
|
@@ -10365,7 +10048,7 @@ const renderFocus$3 = {
|
|
|
10365
10048
|
// TODO avoid side effect
|
|
10366
10049
|
if (newState.focused) {
|
|
10367
10050
|
const FocusEditorText = 12;
|
|
10368
|
-
invoke$
|
|
10051
|
+
invoke$7('Focus.setFocus', FocusEditorText);
|
|
10369
10052
|
}
|
|
10370
10053
|
return [/* method */'setFocused', newState.focused];
|
|
10371
10054
|
}
|
|
@@ -10455,7 +10138,7 @@ const renderWidgets = {
|
|
|
10455
10138
|
},
|
|
10456
10139
|
multiple: true
|
|
10457
10140
|
};
|
|
10458
|
-
const render$
|
|
10141
|
+
const render$c = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
|
|
10459
10142
|
const renderEditor = async id => {
|
|
10460
10143
|
const instance = get$4(id);
|
|
10461
10144
|
if (!instance) {
|
|
@@ -10467,7 +10150,7 @@ const renderEditor = async id => {
|
|
|
10467
10150
|
} = instance;
|
|
10468
10151
|
const commands = [];
|
|
10469
10152
|
set$4(id, newState, newState);
|
|
10470
|
-
for (const item of render$
|
|
10153
|
+
for (const item of render$c) {
|
|
10471
10154
|
if (!item.isEqual(oldState, newState)) {
|
|
10472
10155
|
const result = await item.apply(oldState, newState);
|
|
10473
10156
|
// @ts-ignore
|
|
@@ -10533,7 +10216,7 @@ const keep = [
|
|
|
10533
10216
|
// 'ColorPicker.handleSliderPointerDown',
|
|
10534
10217
|
// 'ColorPicker.handleSliderPointerMove',
|
|
10535
10218
|
// 'ColorPicker.loadContent',
|
|
10536
|
-
'Editor.create', 'Editor.getWordAt', 'Editor.getWordBefore', 'Editor.offsetAt', 'Editor.render', 'Editor.getKeyBindings', 'Editor.getPositionAtCursor', 'Editor.getWordAt2', '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',
|
|
10537
10220
|
// 'ColorPicker.render',
|
|
10538
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'];
|
|
10539
10222
|
|
|
@@ -10671,12 +10354,17 @@ const commandMap = {
|
|
|
10671
10354
|
'Editor.getText': getText,
|
|
10672
10355
|
'Editor.getWordAt': getWordAt$1,
|
|
10673
10356
|
'Editor.getWordAt2': getWordAt,
|
|
10357
|
+
'Editor.getWordAtOffset2': getWordAtOffset2,
|
|
10358
|
+
'Editor.getWordBefore2': getWordBefore2,
|
|
10674
10359
|
'Editor.getWordBefore': getWordBefore,
|
|
10360
|
+
'Editor.getLines2': getLines2,
|
|
10361
|
+
'Editor.getSelections2': getSelections2,
|
|
10362
|
+
'Editor.closeFind2': closeFind2,
|
|
10675
10363
|
'Editor.goToDefinition': goToDefinition,
|
|
10676
10364
|
'Editor.goToTypeDefinition': goToTypeDefinition,
|
|
10677
10365
|
'Editor.handleBeforeInput': handleBeforeInput,
|
|
10678
10366
|
'Editor.handleBeforeInputFromContentEditable': handleBeforeInputFromContentEditable,
|
|
10679
|
-
'Editor.handleBlur': handleBlur
|
|
10367
|
+
'Editor.handleBlur': handleBlur,
|
|
10680
10368
|
'Editor.handleContextMenu': handleContextMenu,
|
|
10681
10369
|
'Editor.handleDoubleClick': handleDoubleClick,
|
|
10682
10370
|
'Editor.handleFocus': handleFocus,
|
|
@@ -10774,33 +10462,9 @@ const commandMap = {
|
|
|
10774
10462
|
'EditorCompletion.selectCurrent': selectCurrent,
|
|
10775
10463
|
'EditorCompletion.selectIndex': selectIndex,
|
|
10776
10464
|
'EditorCompletion.toggleDetails': toggleDetails,
|
|
10777
|
-
'EditorRename.accept': accept,
|
|
10778
|
-
'EditorRename.handleBlur': handleBlur,
|
|
10779
10465
|
'EditorSourceActions.focusNext': focusNext,
|
|
10780
|
-
'FindWidget.close': close
|
|
10781
|
-
'FindWidget.focusCloseButton': focusCloseButton,
|
|
10782
|
-
'FindWidget.focusFind': focusFind,
|
|
10783
|
-
'FindWidget.focusFirst': focusFirst$1,
|
|
10784
|
-
'FindWidget.focusIndex': focusIndex$2,
|
|
10785
|
-
'FindWidget.focusLast': focusLast,
|
|
10786
|
-
'FindWidget.focusNext': focusNext$2,
|
|
10787
|
-
'FindWidget.focusNextMatchButton': focusNextMatchButton,
|
|
10788
|
-
'FindWidget.focusPrevious': focusPrevious$1,
|
|
10789
|
-
'FindWidget.focusPreviousMatchButton': focusPreviousMatchButton,
|
|
10790
|
-
'FindWidget.focusReplace': focusReplace,
|
|
10791
|
-
'FindWidget.focusReplaceAllButton': focusReplaceAllButton,
|
|
10792
|
-
'FindWidget.focusReplaceButton': focusReplaceButton,
|
|
10793
|
-
'FindWidget.focusToggleReplace': focusToggleReplaceButton,
|
|
10794
|
-
'FindWidget.handleBlur': handleBlur$1,
|
|
10795
|
-
'FindWidget.handleFocus': handleFindWidgetFocus,
|
|
10796
|
-
'FindWidget.handleInput': handleInput,
|
|
10797
|
-
'FindWidget.handleReplaceAllFocus': handleReplaceAllFocus,
|
|
10798
|
-
'FindWidget.handleReplaceFocus': handleReplaceFocus,
|
|
10799
|
-
'FindWidget.handleReplaceInput': handleReplaceInput,
|
|
10800
|
-
'FindWidget.handleToggleReplaceFocus': handleToggleReplaceFocus,
|
|
10466
|
+
'FindWidget.close': close,
|
|
10801
10467
|
'FindWidget.loadContent': loadContent$1,
|
|
10802
|
-
'FindWidget.replaceAll': replaceAll$1,
|
|
10803
|
-
'FindWidget.toggleReplace': toggleReplace,
|
|
10804
10468
|
'Font.ensure': ensure,
|
|
10805
10469
|
'Hover.getHoverInfo': getEditorHoverInfo,
|
|
10806
10470
|
'Hover.handleSashPointerDown': handleSashPointerDown,
|
|
@@ -10871,7 +10535,8 @@ const listen = async () => {
|
|
|
10871
10535
|
const isFunctional = widgetId => {
|
|
10872
10536
|
switch (widgetId) {
|
|
10873
10537
|
case ColorPicker:
|
|
10874
|
-
|
|
10538
|
+
case Rename:
|
|
10539
|
+
case Find:
|
|
10875
10540
|
return true;
|
|
10876
10541
|
default:
|
|
10877
10542
|
return false;
|
|
@@ -10915,7 +10580,6 @@ const removeWidget = widget => {
|
|
|
10915
10580
|
};
|
|
10916
10581
|
|
|
10917
10582
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
10918
|
-
const ToggleReplace$1 = 'ToggleReplace';
|
|
10919
10583
|
|
|
10920
10584
|
const getCodeGeneratorVirtualDom = state => {
|
|
10921
10585
|
const escapeToClose$1 = escapeToClose();
|
|
@@ -10937,7 +10601,7 @@ const getCodeGeneratorVirtualDom = state => {
|
|
|
10937
10601
|
}, text(escapeToClose$1)];
|
|
10938
10602
|
};
|
|
10939
10603
|
|
|
10940
|
-
const renderContent$
|
|
10604
|
+
const renderContent$1 = {
|
|
10941
10605
|
isEqual(oldState, newState) {
|
|
10942
10606
|
return oldState.questions === newState.questions;
|
|
10943
10607
|
},
|
|
@@ -10946,7 +10610,7 @@ const renderContent$2 = {
|
|
|
10946
10610
|
return [SetDom2, newState.uid, dom];
|
|
10947
10611
|
}
|
|
10948
10612
|
};
|
|
10949
|
-
const renderBounds$
|
|
10613
|
+
const renderBounds$3 = {
|
|
10950
10614
|
isEqual(oldState, newState) {
|
|
10951
10615
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
10952
10616
|
},
|
|
@@ -10960,7 +10624,7 @@ const renderBounds$5 = {
|
|
|
10960
10624
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
10961
10625
|
}
|
|
10962
10626
|
};
|
|
10963
|
-
const renderFocus
|
|
10627
|
+
const renderFocus = {
|
|
10964
10628
|
isEqual(oldState, newState) {
|
|
10965
10629
|
return oldState.focused === newState.focused && oldState.focusSource === newState.focusSource;
|
|
10966
10630
|
},
|
|
@@ -10968,10 +10632,10 @@ const renderFocus$2 = {
|
|
|
10968
10632
|
return [Focus, '.CodeGeneratorInput', newState.focusSource];
|
|
10969
10633
|
}
|
|
10970
10634
|
};
|
|
10971
|
-
const render$
|
|
10972
|
-
const renderFull$
|
|
10635
|
+
const render$b = [renderContent$1, renderBounds$3, renderFocus];
|
|
10636
|
+
const renderFull$4 = (oldState, newState) => {
|
|
10973
10637
|
const commands = [];
|
|
10974
|
-
for (const item of render$
|
|
10638
|
+
for (const item of render$b) {
|
|
10975
10639
|
if (!item.isEqual(oldState, newState)) {
|
|
10976
10640
|
commands.push(item.apply(oldState, newState));
|
|
10977
10641
|
}
|
|
@@ -10979,8 +10643,8 @@ const renderFull$3 = (oldState, newState) => {
|
|
|
10979
10643
|
return commands;
|
|
10980
10644
|
};
|
|
10981
10645
|
|
|
10982
|
-
const render$
|
|
10983
|
-
const commands = renderFull$
|
|
10646
|
+
const render$a = widget => {
|
|
10647
|
+
const commands = renderFull$4(widget.oldState, widget.newState);
|
|
10984
10648
|
const wrappedCommands = [];
|
|
10985
10649
|
const {
|
|
10986
10650
|
uid
|
|
@@ -10996,7 +10660,7 @@ const render$c = widget => {
|
|
|
10996
10660
|
return wrappedCommands;
|
|
10997
10661
|
};
|
|
10998
10662
|
const add$7 = widget => {
|
|
10999
|
-
return addWidget(widget, 'EditorCodeGenerator', render$
|
|
10663
|
+
return addWidget(widget, 'EditorCodeGenerator', render$a);
|
|
11000
10664
|
};
|
|
11001
10665
|
const remove$7 = removeWidget;
|
|
11002
10666
|
|
|
@@ -11004,18 +10668,18 @@ const EditorCodeGeneratorWidget = {
|
|
|
11004
10668
|
__proto__: null,
|
|
11005
10669
|
add: add$7,
|
|
11006
10670
|
remove: remove$7,
|
|
11007
|
-
render: render$
|
|
10671
|
+
render: render$a
|
|
11008
10672
|
};
|
|
11009
10673
|
|
|
11010
|
-
const renderFull$
|
|
10674
|
+
const renderFull$3 = (oldState, newState) => {
|
|
11011
10675
|
const commands = [...newState.commands];
|
|
11012
10676
|
// @ts-ignore
|
|
11013
10677
|
newState.commands = [];
|
|
11014
10678
|
return commands;
|
|
11015
10679
|
};
|
|
11016
10680
|
|
|
11017
|
-
const render$
|
|
11018
|
-
const commands = renderFull$
|
|
10681
|
+
const render$9 = widget => {
|
|
10682
|
+
const commands = renderFull$3(widget.oldState, widget.newState);
|
|
11019
10683
|
const wrappedCommands = [];
|
|
11020
10684
|
const {
|
|
11021
10685
|
uid
|
|
@@ -11030,7 +10694,7 @@ const render$b = widget => {
|
|
|
11030
10694
|
return wrappedCommands;
|
|
11031
10695
|
};
|
|
11032
10696
|
const add$6 = widget => {
|
|
11033
|
-
return addWidget(widget, 'ColorPicker', render$
|
|
10697
|
+
return addWidget(widget, 'ColorPicker', render$9);
|
|
11034
10698
|
};
|
|
11035
10699
|
const remove$6 = removeWidget;
|
|
11036
10700
|
const Commands$1 = {};
|
|
@@ -11040,7 +10704,7 @@ const EditorColorPickerWidget = {
|
|
|
11040
10704
|
Commands: Commands$1,
|
|
11041
10705
|
add: add$6,
|
|
11042
10706
|
remove: remove$6,
|
|
11043
|
-
render: render$
|
|
10707
|
+
render: render$9
|
|
11044
10708
|
};
|
|
11045
10709
|
|
|
11046
10710
|
const getCompletionDetailVirtualDom = content => {
|
|
@@ -11075,7 +10739,7 @@ const renderParts = (render, oldState, newState) => {
|
|
|
11075
10739
|
return commands;
|
|
11076
10740
|
};
|
|
11077
10741
|
|
|
11078
|
-
const renderContent
|
|
10742
|
+
const renderContent = {
|
|
11079
10743
|
isEqual(oldState, newState) {
|
|
11080
10744
|
return oldState.content === newState.content;
|
|
11081
10745
|
},
|
|
@@ -11084,7 +10748,7 @@ const renderContent$1 = {
|
|
|
11084
10748
|
return [SetDom2, newState.uid, dom];
|
|
11085
10749
|
}
|
|
11086
10750
|
};
|
|
11087
|
-
const renderBounds$
|
|
10751
|
+
const renderBounds$2 = {
|
|
11088
10752
|
isEqual(oldState, newState) {
|
|
11089
10753
|
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
11090
10754
|
},
|
|
@@ -11098,13 +10762,13 @@ const renderBounds$4 = {
|
|
|
11098
10762
|
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
11099
10763
|
}
|
|
11100
10764
|
};
|
|
11101
|
-
const render$
|
|
11102
|
-
const renderFull$
|
|
11103
|
-
return renderParts(render$
|
|
10765
|
+
const render$8 = [renderContent, renderBounds$2];
|
|
10766
|
+
const renderFull$2 = (oldState, newState) => {
|
|
10767
|
+
return renderParts(render$8, oldState, newState);
|
|
11104
10768
|
};
|
|
11105
10769
|
|
|
11106
|
-
const render$
|
|
11107
|
-
const commands = renderFull$
|
|
10770
|
+
const render$7 = widget => {
|
|
10771
|
+
const commands = renderFull$2(widget.oldState, widget.newState);
|
|
11108
10772
|
const wrappedCommands = [];
|
|
11109
10773
|
const {
|
|
11110
10774
|
uid
|
|
@@ -11119,7 +10783,7 @@ const render$9 = widget => {
|
|
|
11119
10783
|
return wrappedCommands;
|
|
11120
10784
|
};
|
|
11121
10785
|
const add$5 = widget => {
|
|
11122
|
-
return addWidget(widget, 'EditorCompletionDetails', render$
|
|
10786
|
+
return addWidget(widget, 'EditorCompletionDetails', render$7);
|
|
11123
10787
|
};
|
|
11124
10788
|
const remove$5 = removeWidget;
|
|
11125
10789
|
const handleEditorType$1 = (editor, state) => {
|
|
@@ -11157,11 +10821,9 @@ const EditorCompletionDetailWidget = {
|
|
|
11157
10821
|
handleEditorDeleteLeft: handleEditorDeleteLeft$1,
|
|
11158
10822
|
handleEditorType: handleEditorType$1,
|
|
11159
10823
|
remove: remove$5,
|
|
11160
|
-
render: render$
|
|
10824
|
+
render: render$7
|
|
11161
10825
|
};
|
|
11162
10826
|
|
|
11163
|
-
const CheckBox = 'checkbox';
|
|
11164
|
-
const Group = 'group';
|
|
11165
10827
|
const None = 'none';
|
|
11166
10828
|
const Option = 'option';
|
|
11167
10829
|
|
|
@@ -11260,7 +10922,7 @@ const getCompletionItemsVirtualDom = visibleItems => {
|
|
|
11260
10922
|
return [{
|
|
11261
10923
|
type: Div,
|
|
11262
10924
|
childCount: 1
|
|
11263
|
-
}, text(noResults
|
|
10925
|
+
}, text(noResults())];
|
|
11264
10926
|
}
|
|
11265
10927
|
const root = {
|
|
11266
10928
|
type: Div,
|
|
@@ -11362,7 +11024,7 @@ const renderItems = {
|
|
|
11362
11024
|
return ['setDom', dom];
|
|
11363
11025
|
}
|
|
11364
11026
|
};
|
|
11365
|
-
const renderBounds$
|
|
11027
|
+
const renderBounds$1 = {
|
|
11366
11028
|
isEqual(oldState, newState) {
|
|
11367
11029
|
return oldState.items === newState.items && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && oldState.x === newState.x && oldState.y === newState.y;
|
|
11368
11030
|
},
|
|
@@ -11408,10 +11070,10 @@ const renderScrollBar = {
|
|
|
11408
11070
|
return [/* method */SetScrollBar, /* scrollBarY */scrollBarY, /* scrollBarHeight */scrollBarHeight];
|
|
11409
11071
|
}
|
|
11410
11072
|
};
|
|
11411
|
-
const render$
|
|
11073
|
+
const render$6 = [renderItems, renderBounds$1, renderHeight, renderNegativeMargin, renderScrollBar];
|
|
11412
11074
|
const renderCompletion = (oldState, newState) => {
|
|
11413
11075
|
const commands = [];
|
|
11414
|
-
for (const item of render$
|
|
11076
|
+
for (const item of render$6) {
|
|
11415
11077
|
if (!item.isEqual(oldState, newState)) {
|
|
11416
11078
|
commands.push(item.apply(oldState, newState));
|
|
11417
11079
|
}
|
|
@@ -11419,7 +11081,7 @@ const renderCompletion = (oldState, newState) => {
|
|
|
11419
11081
|
return commands;
|
|
11420
11082
|
};
|
|
11421
11083
|
|
|
11422
|
-
const render$
|
|
11084
|
+
const render$5 = widget => {
|
|
11423
11085
|
const commands = renderCompletion(widget.oldState, widget.newState);
|
|
11424
11086
|
const wrappedCommands = [];
|
|
11425
11087
|
const {
|
|
@@ -11431,7 +11093,7 @@ const render$7 = widget => {
|
|
|
11431
11093
|
return wrappedCommands;
|
|
11432
11094
|
};
|
|
11433
11095
|
const add$4 = widget => {
|
|
11434
|
-
const commands = render$
|
|
11096
|
+
const commands = render$5(widget);
|
|
11435
11097
|
const id = 'EditorCompletion';
|
|
11436
11098
|
// TODO how to generate a unique integer id
|
|
11437
11099
|
// that doesn't collide with ids created in renderer worker?
|
|
@@ -11510,407 +11172,25 @@ const EditorCompletionWidget = {
|
|
|
11510
11172
|
handleEditorDeleteLeft,
|
|
11511
11173
|
handleEditorType,
|
|
11512
11174
|
remove: remove$4,
|
|
11513
|
-
render: render$
|
|
11514
|
-
};
|
|
11515
|
-
|
|
11516
|
-
/**
|
|
11517
|
-
* @enum {string}
|
|
11518
|
-
*/
|
|
11519
|
-
const UiStrings = {
|
|
11520
|
-
MatchOf: '{PH1} of {PH2}',
|
|
11521
|
-
NoResults: 'No Results',
|
|
11522
|
-
Close: 'Close',
|
|
11523
|
-
PreviousMatch: 'Previous Match',
|
|
11524
|
-
NextMatch: 'Next Match',
|
|
11525
|
-
Find: 'Find',
|
|
11526
|
-
Replace: 'Replace',
|
|
11527
|
-
ReplaceAll: 'Replace All'
|
|
11528
|
-
};
|
|
11529
|
-
const noResults = () => {
|
|
11530
|
-
return i18nString(UiStrings.NoResults);
|
|
11531
|
-
};
|
|
11532
|
-
const matchOf = (matchIndex, matchCount) => {
|
|
11533
|
-
return i18nString(UiStrings.MatchOf, {
|
|
11534
|
-
PH1: matchIndex,
|
|
11535
|
-
PH2: matchCount
|
|
11536
|
-
});
|
|
11537
|
-
};
|
|
11538
|
-
const previousMatch = () => {
|
|
11539
|
-
return i18nString(UiStrings.PreviousMatch);
|
|
11540
|
-
};
|
|
11541
|
-
const nextMatch = () => {
|
|
11542
|
-
return i18nString(UiStrings.NextMatch);
|
|
11543
|
-
};
|
|
11544
|
-
const close = () => {
|
|
11545
|
-
return i18nString(UiStrings.Close);
|
|
11546
|
-
};
|
|
11547
|
-
const find = () => {
|
|
11548
|
-
return i18nString(UiStrings.Find);
|
|
11549
|
-
};
|
|
11550
|
-
const replace = () => {
|
|
11551
|
-
return i18nString(UiStrings.Replace);
|
|
11552
|
-
};
|
|
11553
|
-
const replaceAll = () => {
|
|
11554
|
-
return i18nString(UiStrings.ReplaceAll);
|
|
11555
|
-
};
|
|
11556
|
-
|
|
11557
|
-
const ArrowDown = 'ArrowDown';
|
|
11558
|
-
const ArrowUp = 'ArrowUp';
|
|
11559
|
-
const Close$1 = 'Close';
|
|
11560
|
-
const Replace$1 = 'Replace';
|
|
11561
|
-
const ReplaceAll$1 = 'ReplaceAll';
|
|
11562
|
-
|
|
11563
|
-
const SearchValue = 'search-value';
|
|
11564
|
-
const ReplaceValue = 'replace-value';
|
|
11565
|
-
const ReplaceAll = 'ReplaceAll';
|
|
11566
|
-
const Close = 'Close';
|
|
11567
|
-
const ToggleReplace = 'ToggleReplace';
|
|
11568
|
-
const FocusNext = 'FocusNext';
|
|
11569
|
-
const FocusPrevious = 'FocusPrevious';
|
|
11570
|
-
const Replace = 'Replace';
|
|
11571
|
-
|
|
11572
|
-
const getFindWidgetButtons = (findButtonsEnabled, replaceButtonsEnabled) => {
|
|
11573
|
-
const findButtons = [{
|
|
11574
|
-
label: previousMatch(),
|
|
11575
|
-
icon: ArrowUp,
|
|
11576
|
-
disabled: !findButtonsEnabled,
|
|
11577
|
-
onClick: HandleClickPreviousMatch,
|
|
11578
|
-
name: FocusPrevious
|
|
11579
|
-
}, {
|
|
11580
|
-
label: nextMatch(),
|
|
11581
|
-
icon: ArrowDown,
|
|
11582
|
-
disabled: !findButtonsEnabled,
|
|
11583
|
-
onClick: HandleClickNextMatch,
|
|
11584
|
-
name: FocusNext
|
|
11585
|
-
}, {
|
|
11586
|
-
label: close(),
|
|
11587
|
-
icon: Close$1,
|
|
11588
|
-
disabled: false,
|
|
11589
|
-
onClick: HandleClickClose,
|
|
11590
|
-
name: Close
|
|
11591
|
-
}];
|
|
11592
|
-
const replaceButtons = [{
|
|
11593
|
-
label: replace(),
|
|
11594
|
-
icon: Replace$1,
|
|
11595
|
-
disabled: !replaceButtonsEnabled,
|
|
11596
|
-
onClick: HandleClickReplace,
|
|
11597
|
-
name: Replace
|
|
11598
|
-
}, {
|
|
11599
|
-
label: replaceAll(),
|
|
11600
|
-
icon: ReplaceAll$1,
|
|
11601
|
-
disabled: !replaceButtonsEnabled,
|
|
11602
|
-
onClick: HandleClickReplaceAll,
|
|
11603
|
-
name: ReplaceAll
|
|
11604
|
-
}];
|
|
11605
|
-
return {
|
|
11606
|
-
findButtons,
|
|
11607
|
-
replaceButtons
|
|
11608
|
-
};
|
|
11609
|
-
};
|
|
11610
|
-
|
|
11611
|
-
const getFindWidgetButtonsEnabled = (matchCount, value) => {
|
|
11612
|
-
const findButtonsEnabled = matchCount > 0;
|
|
11613
|
-
const replaceButtonsEnabled = value.length > 0;
|
|
11614
|
-
return {
|
|
11615
|
-
findButtonsEnabled,
|
|
11616
|
-
replaceButtonsEnabled
|
|
11617
|
-
};
|
|
11618
|
-
};
|
|
11619
|
-
|
|
11620
|
-
// TODO always focus element by name
|
|
11621
|
-
const getFindWidgetFocusSelector = focus => {
|
|
11622
|
-
switch (focus) {
|
|
11623
|
-
case FindWidget:
|
|
11624
|
-
{
|
|
11625
|
-
return `[name="${SearchValue}"]`;
|
|
11626
|
-
}
|
|
11627
|
-
case FocusFindWidgetReplace$1:
|
|
11628
|
-
{
|
|
11629
|
-
return `[name="${ReplaceValue}"]`;
|
|
11630
|
-
}
|
|
11631
|
-
case FocusFindWidgetReplaceAllButton$1:
|
|
11632
|
-
{
|
|
11633
|
-
return `[name="${ReplaceAll}"]`;
|
|
11634
|
-
}
|
|
11635
|
-
case FocusFindWidgetCloseButton$1:
|
|
11636
|
-
{
|
|
11637
|
-
return `[name="${Close}"]`;
|
|
11638
|
-
}
|
|
11639
|
-
case FocusFindWidgetToggleReplace:
|
|
11640
|
-
{
|
|
11641
|
-
return `[name="${ToggleReplace}"]`;
|
|
11642
|
-
}
|
|
11643
|
-
case FocusFindWidgetNextMatchButton$1:
|
|
11644
|
-
{
|
|
11645
|
-
return `[name="${FocusNext}"]`;
|
|
11646
|
-
}
|
|
11647
|
-
case FocusFindWidgetPreviousMatchButton$1:
|
|
11648
|
-
{
|
|
11649
|
-
return `[name="${FocusPrevious}"]`;
|
|
11650
|
-
}
|
|
11651
|
-
case FocusFindWidgetReplaceButton$1:
|
|
11652
|
-
{
|
|
11653
|
-
return `[name="${Replace}"]`;
|
|
11654
|
-
}
|
|
11655
|
-
default:
|
|
11656
|
-
{
|
|
11657
|
-
return '';
|
|
11658
|
-
}
|
|
11659
|
-
}
|
|
11660
|
-
};
|
|
11661
|
-
|
|
11662
|
-
const getFindMatchCountClassName = (matchCount, value) => {
|
|
11663
|
-
if (value && matchCount === 0) {
|
|
11664
|
-
return mergeClassNames(FindWidgetMatchCount, FindWidgetMatchCountEmpty);
|
|
11665
|
-
}
|
|
11666
|
-
return FindWidgetMatchCount;
|
|
11667
|
-
};
|
|
11668
|
-
|
|
11669
|
-
const getIconVirtualDom = (icon, type = Div) => {
|
|
11670
|
-
return {
|
|
11671
|
-
type,
|
|
11672
|
-
className: `MaskIcon MaskIcon${icon}`,
|
|
11673
|
-
role: None,
|
|
11674
|
-
childCount: 0
|
|
11675
|
-
};
|
|
11676
|
-
};
|
|
11677
|
-
|
|
11678
|
-
const getIconButtonVirtualDom = iconButton => {
|
|
11679
|
-
const {
|
|
11680
|
-
label,
|
|
11681
|
-
icon,
|
|
11682
|
-
disabled,
|
|
11683
|
-
name,
|
|
11684
|
-
onClick
|
|
11685
|
-
} = iconButton;
|
|
11686
|
-
let className = IconButton;
|
|
11687
|
-
if (disabled) {
|
|
11688
|
-
className += ' ' + IconButtonDisabled;
|
|
11689
|
-
}
|
|
11690
|
-
return [{
|
|
11691
|
-
type: Button,
|
|
11692
|
-
className,
|
|
11693
|
-
title: label,
|
|
11694
|
-
ariaLabel: label,
|
|
11695
|
-
childCount: 1,
|
|
11696
|
-
disabled: disabled ? true : undefined,
|
|
11697
|
-
onClick: onClick,
|
|
11698
|
-
name: name
|
|
11699
|
-
}, getIconVirtualDom(icon)];
|
|
11700
|
-
};
|
|
11701
|
-
|
|
11702
|
-
const getSearchFieldButtonVirtualDom = button => {
|
|
11703
|
-
const {
|
|
11704
|
-
icon,
|
|
11705
|
-
checked,
|
|
11706
|
-
title
|
|
11707
|
-
} = button;
|
|
11708
|
-
return [{
|
|
11709
|
-
type: Div,
|
|
11710
|
-
className: mergeClassNames(SearchFieldButton, checked ? SearchFieldButtonChecked : ''),
|
|
11711
|
-
title,
|
|
11712
|
-
role: CheckBox,
|
|
11713
|
-
ariaChecked: checked,
|
|
11714
|
-
tabIndex: 0,
|
|
11715
|
-
childCount: 1
|
|
11716
|
-
}, {
|
|
11717
|
-
type: Div,
|
|
11718
|
-
className: mergeClassNames(MaskIcon, icon),
|
|
11719
|
-
childCount: 0
|
|
11720
|
-
}];
|
|
11721
|
-
};
|
|
11722
|
-
|
|
11723
|
-
const getSearchFieldVirtualDom = (name, placeholder, onInput, insideButtons, outsideButtons, onFocus = '') => {
|
|
11724
|
-
const dom = [{
|
|
11725
|
-
type: Div,
|
|
11726
|
-
className: SearchField,
|
|
11727
|
-
role: None,
|
|
11728
|
-
childCount: 2
|
|
11729
|
-
}, {
|
|
11730
|
-
type: TextArea,
|
|
11731
|
-
className: MultilineInputBox,
|
|
11732
|
-
spellcheck: false,
|
|
11733
|
-
autocapitalize: 'off',
|
|
11734
|
-
autocorrect: 'off',
|
|
11735
|
-
placeholder,
|
|
11736
|
-
name,
|
|
11737
|
-
onInput,
|
|
11738
|
-
onFocus,
|
|
11739
|
-
childCount: 0
|
|
11740
|
-
}, {
|
|
11741
|
-
type: Div,
|
|
11742
|
-
className: SearchFieldButtons,
|
|
11743
|
-
childCount: insideButtons.length
|
|
11744
|
-
}, ...insideButtons.flatMap(getSearchFieldButtonVirtualDom)];
|
|
11745
|
-
if (outsideButtons.length > 0) {
|
|
11746
|
-
throw new Error('outsideButtons are deprecated');
|
|
11747
|
-
}
|
|
11748
|
-
return dom;
|
|
11749
|
-
};
|
|
11750
|
-
|
|
11751
|
-
const getFindWidgetFindVirtualDom = (matchCountText, buttons, matchCount, value) => {
|
|
11752
|
-
const dom = [];
|
|
11753
|
-
dom.push({
|
|
11754
|
-
type: Div,
|
|
11755
|
-
className: FindWidgetFind,
|
|
11756
|
-
childCount: 5
|
|
11757
|
-
});
|
|
11758
|
-
dom.push(...getSearchFieldVirtualDom('search-value', find(), HandleInput, [], [], HandleFocus));
|
|
11759
|
-
const findClassName = getFindMatchCountClassName(matchCount, value);
|
|
11760
|
-
dom.push({
|
|
11761
|
-
type: Div,
|
|
11762
|
-
className: findClassName,
|
|
11763
|
-
childCount: 1
|
|
11764
|
-
}, text(matchCountText), ...buttons.flatMap(getIconButtonVirtualDom));
|
|
11765
|
-
return dom;
|
|
11766
|
-
};
|
|
11767
|
-
|
|
11768
|
-
const getFindWidgetReplaceVirtualDom = (replaceExpanded, replaceButtons) => {
|
|
11769
|
-
const dom = [];
|
|
11770
|
-
if (replaceExpanded) {
|
|
11771
|
-
dom.push({
|
|
11772
|
-
type: Div,
|
|
11773
|
-
className: FindWidgetReplace,
|
|
11774
|
-
childCount: 1 + replaceButtons.length
|
|
11775
|
-
}, ...getSearchFieldVirtualDom('replace-value', replace(), HandleReplaceInput, [], [], HandleReplaceFocus), ...replaceButtons.flatMap(getIconButtonVirtualDom));
|
|
11776
|
-
}
|
|
11777
|
-
return dom;
|
|
11778
|
-
};
|
|
11779
|
-
|
|
11780
|
-
const getSearchToggleButtonVirtualDom = (replaceExpanded, onClick = '') => {
|
|
11781
|
-
return [{
|
|
11782
|
-
type: Button,
|
|
11783
|
-
className: `IconButton SearchToggleButton ${replaceExpanded ? 'SearchToggleButtonExpanded' : ''}`,
|
|
11784
|
-
title: 'Toggle Replace',
|
|
11785
|
-
ariaLabel: 'Toggle Replace',
|
|
11786
|
-
ariaExpanded: replaceExpanded,
|
|
11787
|
-
name: ToggleReplace$1,
|
|
11788
|
-
childCount: 1,
|
|
11789
|
-
'data-command': 'toggleReplace',
|
|
11790
|
-
onClick,
|
|
11791
|
-
onFocus: 'handleToggleReplaceFocus'
|
|
11792
|
-
}, {
|
|
11793
|
-
type: Div,
|
|
11794
|
-
className: `MaskIcon ${replaceExpanded ? 'MaskIconChevronDown' : 'MaskIconChevronRight'}`,
|
|
11795
|
-
childCount: 0
|
|
11796
|
-
}];
|
|
11797
|
-
};
|
|
11798
|
-
|
|
11799
|
-
const getFindWidgetVirtualDom = (matchCountText, replaceExpanded, findButtons, replaceButtons, matchCase, matchWholeWord, useRegularExpression, matchCount, value) => {
|
|
11800
|
-
const dom = [];
|
|
11801
|
-
dom.push({
|
|
11802
|
-
type: Div,
|
|
11803
|
-
className: 'Viewlet ViewletFind ViewletFindWidget FindWidget',
|
|
11804
|
-
childCount: 2,
|
|
11805
|
-
role: Group
|
|
11806
|
-
});
|
|
11807
|
-
dom.push(...getSearchToggleButtonVirtualDom(replaceExpanded, 'handleClickToggleReplace'));
|
|
11808
|
-
dom.push({
|
|
11809
|
-
type: Div,
|
|
11810
|
-
className: FindWidgetRight,
|
|
11811
|
-
childCount: replaceExpanded ? 2 : 1
|
|
11812
|
-
});
|
|
11813
|
-
dom.push(...getFindWidgetFindVirtualDom(matchCountText, findButtons, matchCount, value));
|
|
11814
|
-
if (replaceExpanded) {
|
|
11815
|
-
dom.push(...getFindWidgetReplaceVirtualDom(replaceExpanded, replaceButtons));
|
|
11816
|
-
}
|
|
11817
|
-
return dom;
|
|
11818
|
-
};
|
|
11819
|
-
|
|
11820
|
-
const getMatchCountText = (matchIndex, matchCount) => {
|
|
11821
|
-
if (matchCount === 0) {
|
|
11822
|
-
return noResults();
|
|
11823
|
-
}
|
|
11824
|
-
return matchOf(matchIndex + 1, matchCount);
|
|
11825
|
-
};
|
|
11826
|
-
|
|
11827
|
-
const renderValue = {
|
|
11828
|
-
isEqual(oldState, newState) {
|
|
11829
|
-
return oldState.value === newState.value;
|
|
11830
|
-
},
|
|
11831
|
-
apply(oldState, newState) {
|
|
11832
|
-
return [SetValue, /* value */newState.value];
|
|
11833
|
-
}
|
|
11834
|
-
};
|
|
11835
|
-
const renderDetails = {
|
|
11836
|
-
isEqual(oldState, newState) {
|
|
11837
|
-
return oldState.matchIndex === newState.matchIndex && oldState.matchCount === newState.matchCount && oldState.replaceExpanded === newState.replaceExpanded && oldState.value === newState.value;
|
|
11838
|
-
},
|
|
11839
|
-
apply(oldState, newState) {
|
|
11840
|
-
const matchCountText = getMatchCountText(newState.matchIndex, newState.matchCount);
|
|
11841
|
-
const {
|
|
11842
|
-
findButtonsEnabled,
|
|
11843
|
-
replaceButtonsEnabled
|
|
11844
|
-
} = getFindWidgetButtonsEnabled(newState.matchCount, newState.value);
|
|
11845
|
-
const {
|
|
11846
|
-
findButtons,
|
|
11847
|
-
replaceButtons
|
|
11848
|
-
} = getFindWidgetButtons(findButtonsEnabled, replaceButtonsEnabled);
|
|
11849
|
-
const dom = getFindWidgetVirtualDom(matchCountText, newState.replaceExpanded, findButtons, replaceButtons, newState.matchCase, newState.matchWholeWord, newState.useRegularExpression, newState.matchCount, newState.value);
|
|
11850
|
-
return [SetDom2, dom];
|
|
11851
|
-
}
|
|
11852
|
-
};
|
|
11853
|
-
const renderBounds$2 = {
|
|
11854
|
-
isEqual(oldState, newState) {
|
|
11855
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
11856
|
-
},
|
|
11857
|
-
apply(oldState, newState) {
|
|
11858
|
-
const {
|
|
11859
|
-
x,
|
|
11860
|
-
y,
|
|
11861
|
-
width,
|
|
11862
|
-
height
|
|
11863
|
-
} = newState;
|
|
11864
|
-
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
11865
|
-
}
|
|
11866
|
-
};
|
|
11867
|
-
const renderFocus$1 = {
|
|
11868
|
-
isEqual(oldState, newState) {
|
|
11869
|
-
return oldState.focused === newState.focused && oldState.focus === newState.focus && oldState.focusSource === newState.focusSource;
|
|
11870
|
-
},
|
|
11871
|
-
apply(oldState, newState) {
|
|
11872
|
-
const key = getFindWidgetFocusSelector(newState.focus);
|
|
11873
|
-
return [Focus, key, newState.focusSource];
|
|
11874
|
-
}
|
|
11175
|
+
render: render$5
|
|
11875
11176
|
};
|
|
11876
|
-
// const getAriaLabel = (state: FindWidgetState) => {
|
|
11877
|
-
// const { matchIndex, matchCount, value } = state
|
|
11878
|
-
// return FindStrings.matchesFoundFor(matchIndex, matchCount, value)
|
|
11879
|
-
// }
|
|
11880
11177
|
|
|
11881
|
-
|
|
11882
|
-
|
|
11883
|
-
//
|
|
11884
|
-
|
|
11885
|
-
|
|
11886
|
-
// oldState.matchCount === newState.matchCount &&
|
|
11887
|
-
// oldState.value === newState.value
|
|
11888
|
-
// )
|
|
11889
|
-
// },
|
|
11890
|
-
// apply(oldState: FindWidgetState, newState: FindWidgetState) {
|
|
11891
|
-
// const ariaLabel = getAriaLabel(newState)
|
|
11892
|
-
// return [/* Viewlet.invoke */ 'Viewlet.ariaAnnounce', /* text */ ariaLabel]
|
|
11893
|
-
// },
|
|
11894
|
-
// }
|
|
11895
|
-
|
|
11896
|
-
const render$6 = [renderDetails, renderBounds$2, renderValue, renderFocus$1];
|
|
11897
|
-
const apply = (oldState, newState) => {
|
|
11898
|
-
// TODO avoid side effect
|
|
11899
|
-
if (oldState.focus !== newState.focus) {
|
|
11900
|
-
setFocus(newState.focus);
|
|
11901
|
-
}
|
|
11902
|
-
return renderParts(render$6, oldState, newState);
|
|
11178
|
+
const renderFull$1 = (oldState, newState) => {
|
|
11179
|
+
const commands = [...newState.commands];
|
|
11180
|
+
// @ts-ignore
|
|
11181
|
+
newState.commands = [];
|
|
11182
|
+
return commands;
|
|
11903
11183
|
};
|
|
11904
11184
|
|
|
11905
|
-
const render$
|
|
11906
|
-
const commands =
|
|
11185
|
+
const render$4 = widget => {
|
|
11186
|
+
const commands = renderFull$1(widget.oldState, widget.newState);
|
|
11907
11187
|
const wrappedCommands = [];
|
|
11908
11188
|
const {
|
|
11909
11189
|
uid
|
|
11910
11190
|
} = widget.newState;
|
|
11911
11191
|
for (const command of commands) {
|
|
11912
|
-
if (command[0] === SetDom2) {
|
|
11913
|
-
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);
|
|
11914
11194
|
} else {
|
|
11915
11195
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
11916
11196
|
}
|
|
@@ -11918,29 +11198,22 @@ const render$5 = widget => {
|
|
|
11918
11198
|
return wrappedCommands;
|
|
11919
11199
|
};
|
|
11920
11200
|
const add$3 = widget => {
|
|
11921
|
-
return addWidget(widget, 'FindWidget', render$
|
|
11201
|
+
return addWidget(widget, 'FindWidget', render$4);
|
|
11922
11202
|
};
|
|
11923
|
-
const remove$3 =
|
|
11924
|
-
|
|
11925
|
-
'FindWidget.close': close$1,
|
|
11926
|
-
'FindWidget.focusNext': focusNext$2,
|
|
11927
|
-
'FindWidget.focusPrevious': focusPrevious$1,
|
|
11928
|
-
'FindWidget.focusIndex': focusIndex$2,
|
|
11929
|
-
'FindWidget.focusLast': focusLast,
|
|
11930
|
-
'FindWidget.toggleReplace': toggleReplace,
|
|
11931
|
-
'FindWidget.handleFocus': focusFind,
|
|
11932
|
-
'FindWidget.handleBlur': handleBlur$1
|
|
11203
|
+
const remove$3 = widget => {
|
|
11204
|
+
return [['Viewlet.dispose', widget.newState.uid]];
|
|
11933
11205
|
};
|
|
11206
|
+
const Commands = {};
|
|
11934
11207
|
|
|
11935
11208
|
const EditorFindWidget = {
|
|
11936
11209
|
__proto__: null,
|
|
11937
11210
|
Commands,
|
|
11938
11211
|
add: add$3,
|
|
11939
11212
|
remove: remove$3,
|
|
11940
|
-
render: render$
|
|
11213
|
+
render: render$4
|
|
11941
11214
|
};
|
|
11942
11215
|
|
|
11943
|
-
const render$
|
|
11216
|
+
const render$3 = widget => {
|
|
11944
11217
|
const commands = renderHover(widget.oldState, widget.newState);
|
|
11945
11218
|
const wrappedCommands = [];
|
|
11946
11219
|
const {
|
|
@@ -11956,7 +11229,7 @@ const render$4 = widget => {
|
|
|
11956
11229
|
return wrappedCommands;
|
|
11957
11230
|
};
|
|
11958
11231
|
const add$2 = widget => {
|
|
11959
|
-
return addWidget(widget, 'EditorHover', render$
|
|
11232
|
+
return addWidget(widget, 'EditorHover', render$3);
|
|
11960
11233
|
};
|
|
11961
11234
|
const remove$2 = removeWidget;
|
|
11962
11235
|
|
|
@@ -11964,57 +11237,14 @@ const EditorHoverWidget = {
|
|
|
11964
11237
|
__proto__: null,
|
|
11965
11238
|
add: add$2,
|
|
11966
11239
|
remove: remove$2,
|
|
11967
|
-
render: render$
|
|
11968
|
-
};
|
|
11969
|
-
|
|
11970
|
-
const getRenameVirtualDom = state => {
|
|
11971
|
-
return [{
|
|
11972
|
-
type: Div,
|
|
11973
|
-
className: 'Viewlet EditorRename',
|
|
11974
|
-
childCount: 1
|
|
11975
|
-
}, {
|
|
11976
|
-
type: Input,
|
|
11977
|
-
className: 'InputBox RenameInputBox',
|
|
11978
|
-
value: state.newValue,
|
|
11979
|
-
childCount: 0,
|
|
11980
|
-
onBlur: 'handleBlur'
|
|
11981
|
-
}];
|
|
11240
|
+
render: render$3
|
|
11982
11241
|
};
|
|
11983
11242
|
|
|
11984
|
-
const renderContent = {
|
|
11985
|
-
isEqual(oldState, newState) {
|
|
11986
|
-
return false;
|
|
11987
|
-
},
|
|
11988
|
-
apply(oldState, newState) {
|
|
11989
|
-
const dom = getRenameVirtualDom(newState);
|
|
11990
|
-
return [SetDom2, newState.uid, dom];
|
|
11991
|
-
}
|
|
11992
|
-
};
|
|
11993
|
-
const renderBounds$1 = {
|
|
11994
|
-
isEqual(oldState, newState) {
|
|
11995
|
-
return oldState.x === newState.x && oldState.y === newState.y && oldState.width === newState.width && oldState.height === newState.height;
|
|
11996
|
-
},
|
|
11997
|
-
apply(oldState, newState) {
|
|
11998
|
-
const {
|
|
11999
|
-
x,
|
|
12000
|
-
y,
|
|
12001
|
-
width,
|
|
12002
|
-
height
|
|
12003
|
-
} = newState;
|
|
12004
|
-
return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
|
|
12005
|
-
}
|
|
12006
|
-
};
|
|
12007
|
-
const renderFocus = {
|
|
12008
|
-
isEqual(oldState, newState) {
|
|
12009
|
-
return oldState.focused === newState.focused;
|
|
12010
|
-
},
|
|
12011
|
-
apply(oldState, newState) {
|
|
12012
|
-
return [/* method */'Viewlet.focusSelector', newState.uid, '.RenameInputBox'];
|
|
12013
|
-
}
|
|
12014
|
-
};
|
|
12015
|
-
const render$3 = [renderContent, renderBounds$1, renderFocus];
|
|
12016
11243
|
const renderFull = (oldState, newState) => {
|
|
12017
|
-
|
|
11244
|
+
const commands = [...newState.commands];
|
|
11245
|
+
// @ts-ignore
|
|
11246
|
+
newState.commands = [];
|
|
11247
|
+
return commands;
|
|
12018
11248
|
};
|
|
12019
11249
|
|
|
12020
11250
|
const render$2 = widget => {
|
|
@@ -12024,9 +11254,7 @@ const render$2 = widget => {
|
|
|
12024
11254
|
uid
|
|
12025
11255
|
} = widget.newState;
|
|
12026
11256
|
for (const command of commands) {
|
|
12027
|
-
if (command[0] === SetDom2) {
|
|
12028
|
-
wrappedCommands.push(command);
|
|
12029
|
-
} else if (command[0] === 'Viewlet.focusSelector') {
|
|
11257
|
+
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') {
|
|
12030
11258
|
wrappedCommands.push(command);
|
|
12031
11259
|
} else {
|
|
12032
11260
|
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|