@lvce-editor/editor-worker 4.11.0 → 4.12.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 +148 -61
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1085,7 +1085,7 @@ const set$5 = (id, fn) => {
|
|
|
1085
1085
|
const get$5 = id => {
|
|
1086
1086
|
return state$1$1.callbacks[id];
|
|
1087
1087
|
};
|
|
1088
|
-
const remove$
|
|
1088
|
+
const remove$8 = id => {
|
|
1089
1089
|
delete state$1$1.callbacks[id];
|
|
1090
1090
|
};
|
|
1091
1091
|
const state$9 = {
|
|
@@ -1118,7 +1118,7 @@ const resolve = (id, args) => {
|
|
|
1118
1118
|
return;
|
|
1119
1119
|
}
|
|
1120
1120
|
fn(args);
|
|
1121
|
-
remove$
|
|
1121
|
+
remove$8(id);
|
|
1122
1122
|
};
|
|
1123
1123
|
const create$2$1 = (method, params) => {
|
|
1124
1124
|
const {
|
|
@@ -1310,7 +1310,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
1310
1310
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
1311
1311
|
return create$1$1(message, errorProperty);
|
|
1312
1312
|
};
|
|
1313
|
-
const create$
|
|
1313
|
+
const create$e = (message, result) => {
|
|
1314
1314
|
return {
|
|
1315
1315
|
jsonrpc: Two,
|
|
1316
1316
|
id: message.id,
|
|
@@ -1319,7 +1319,7 @@ const create$d = (message, result) => {
|
|
|
1319
1319
|
};
|
|
1320
1320
|
const getSuccessResponse = (message, result) => {
|
|
1321
1321
|
const resultProperty = result ?? null;
|
|
1322
|
-
return create$
|
|
1322
|
+
return create$e(message, resultProperty);
|
|
1323
1323
|
};
|
|
1324
1324
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
1325
1325
|
try {
|
|
@@ -1519,7 +1519,7 @@ const waitForFirstMessage$1 = async port => {
|
|
|
1519
1519
|
return event;
|
|
1520
1520
|
};
|
|
1521
1521
|
|
|
1522
|
-
const create$
|
|
1522
|
+
const create$d = async () => {
|
|
1523
1523
|
const {
|
|
1524
1524
|
port1,
|
|
1525
1525
|
port2
|
|
@@ -1564,7 +1564,7 @@ const wrap$3 = port => {
|
|
|
1564
1564
|
|
|
1565
1565
|
const IpcParentWithExtensionHostWorker = {
|
|
1566
1566
|
__proto__: null,
|
|
1567
|
-
create: create$
|
|
1567
|
+
create: create$d,
|
|
1568
1568
|
wrap: wrap$3
|
|
1569
1569
|
};
|
|
1570
1570
|
|
|
@@ -1572,7 +1572,7 @@ const sendMessagePortToSyntaxHighlightingWorker = async port => {
|
|
|
1572
1572
|
await invokeAndTransfer('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort');
|
|
1573
1573
|
};
|
|
1574
1574
|
|
|
1575
|
-
const create$
|
|
1575
|
+
const create$c = async () => {
|
|
1576
1576
|
const {
|
|
1577
1577
|
port1,
|
|
1578
1578
|
port2
|
|
@@ -1617,7 +1617,7 @@ const wrap$1 = port => {
|
|
|
1617
1617
|
|
|
1618
1618
|
const IpcParentWithSyntaxHighlightingWorker = {
|
|
1619
1619
|
__proto__: null,
|
|
1620
|
-
create: create$
|
|
1620
|
+
create: create$c,
|
|
1621
1621
|
wrap: wrap$1
|
|
1622
1622
|
};
|
|
1623
1623
|
|
|
@@ -1625,7 +1625,7 @@ const sendMessagePortToRendererProcess = async port => {
|
|
|
1625
1625
|
await invokeAndTransfer('SendMessagePortToRendererProcess.sendMessagePortToRendererProcess', port, 'HandleMessagePort.handleMessagePort');
|
|
1626
1626
|
};
|
|
1627
1627
|
|
|
1628
|
-
const create$
|
|
1628
|
+
const create$b = async () => {
|
|
1629
1629
|
const {
|
|
1630
1630
|
port1,
|
|
1631
1631
|
port2
|
|
@@ -1670,7 +1670,7 @@ const wrap = port => {
|
|
|
1670
1670
|
|
|
1671
1671
|
const IpcParentWithRendererProcess = {
|
|
1672
1672
|
__proto__: null,
|
|
1673
|
-
create: create$
|
|
1673
|
+
create: create$b,
|
|
1674
1674
|
wrap
|
|
1675
1675
|
};
|
|
1676
1676
|
|
|
@@ -1687,7 +1687,7 @@ const getModule$1 = method => {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
};
|
|
1689
1689
|
|
|
1690
|
-
const create$
|
|
1690
|
+
const create$a = async ({
|
|
1691
1691
|
method,
|
|
1692
1692
|
...options
|
|
1693
1693
|
}) => {
|
|
@@ -1705,7 +1705,7 @@ const create$9 = async ({
|
|
|
1705
1705
|
const createRpc = method => {
|
|
1706
1706
|
let _ipc;
|
|
1707
1707
|
const listen = async () => {
|
|
1708
|
-
const ipc = await create$
|
|
1708
|
+
const ipc = await create$a({
|
|
1709
1709
|
method
|
|
1710
1710
|
});
|
|
1711
1711
|
handleIpc(ipc);
|
|
@@ -1747,6 +1747,7 @@ const FocusFindWidgetReplaceAllButton = 47;
|
|
|
1747
1747
|
const FocusFindWidgetReplaceButton = 46;
|
|
1748
1748
|
const FocusFindWidgetToggleReplace = 42;
|
|
1749
1749
|
const SourceActions = 38;
|
|
1750
|
+
const FocusCodeGenerator = 52;
|
|
1750
1751
|
|
|
1751
1752
|
const measureCharacterWidth = (fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
1752
1753
|
return measureTextWidth('a', fontWeight, fontSize, fontFamily, letterSpacing, false, 0);
|
|
@@ -1999,7 +2000,7 @@ const getAccurateColumnIndexAscii = (line, guess, averageCharWidth, eventX, font
|
|
|
1999
2000
|
const supported = () => {
|
|
2000
2001
|
return 'Segmenter' in Intl;
|
|
2001
2002
|
};
|
|
2002
|
-
const create$
|
|
2003
|
+
const create$9 = () => {
|
|
2003
2004
|
// @ts-ignore
|
|
2004
2005
|
const segmenter = new Intl.Segmenter();
|
|
2005
2006
|
return {
|
|
@@ -2037,7 +2038,7 @@ const create$8 = () => {
|
|
|
2037
2038
|
|
|
2038
2039
|
// @ts-ignore
|
|
2039
2040
|
const getAccurateColumnIndexUnicode = (line, guess, averageCharWidth, eventX, fontWeight, fontSize, fontFamily, letterSpacing) => {
|
|
2040
|
-
const segmenter = create$
|
|
2041
|
+
const segmenter = create$9();
|
|
2041
2042
|
const segments = segmenter.getSegments(line);
|
|
2042
2043
|
const isMonospaceFont = false;
|
|
2043
2044
|
const charWidth = 0;
|
|
@@ -2282,13 +2283,14 @@ const removeEditorWidget = (widgets, id) => {
|
|
|
2282
2283
|
};
|
|
2283
2284
|
|
|
2284
2285
|
// TODO use numeric widget id
|
|
2285
|
-
const
|
|
2286
|
-
const
|
|
2287
|
-
const
|
|
2288
|
-
const
|
|
2289
|
-
const
|
|
2290
|
-
const
|
|
2291
|
-
const
|
|
2286
|
+
const CodeGenerator = 1;
|
|
2287
|
+
const ColorPicker$1 = 2;
|
|
2288
|
+
const Completion = 3;
|
|
2289
|
+
const CompletionDetail = 4;
|
|
2290
|
+
const Find = 5;
|
|
2291
|
+
const Hover = 6;
|
|
2292
|
+
const Rename = 7;
|
|
2293
|
+
const SourceAction = 8;
|
|
2292
2294
|
|
|
2293
2295
|
const isCompletionWidget = widget => {
|
|
2294
2296
|
return widget.id === Completion;
|
|
@@ -2308,14 +2310,14 @@ const closeCompletion = editor => {
|
|
|
2308
2310
|
};
|
|
2309
2311
|
};
|
|
2310
2312
|
|
|
2311
|
-
const isMatchingWidget$
|
|
2313
|
+
const isMatchingWidget$2 = widget => {
|
|
2312
2314
|
return widget.id === Find;
|
|
2313
2315
|
};
|
|
2314
2316
|
const closeFind = editor => {
|
|
2315
2317
|
const {
|
|
2316
2318
|
widgets
|
|
2317
2319
|
} = editor;
|
|
2318
|
-
const index = widgets.findIndex(isMatchingWidget$
|
|
2320
|
+
const index = widgets.findIndex(isMatchingWidget$2);
|
|
2319
2321
|
if (index === -1) {
|
|
2320
2322
|
return editor;
|
|
2321
2323
|
}
|
|
@@ -2346,14 +2348,14 @@ const closeRename = editor => {
|
|
|
2346
2348
|
};
|
|
2347
2349
|
};
|
|
2348
2350
|
|
|
2349
|
-
const isMatchingWidget = widget => {
|
|
2351
|
+
const isMatchingWidget$1 = widget => {
|
|
2350
2352
|
return widget.id === SourceAction;
|
|
2351
2353
|
};
|
|
2352
2354
|
const closeSourceAction = editor => {
|
|
2353
2355
|
const {
|
|
2354
2356
|
widgets
|
|
2355
2357
|
} = editor;
|
|
2356
|
-
const index = widgets.findIndex(isMatchingWidget);
|
|
2358
|
+
const index = widgets.findIndex(isMatchingWidget$1);
|
|
2357
2359
|
if (index === -1) {
|
|
2358
2360
|
return editor;
|
|
2359
2361
|
}
|
|
@@ -2418,12 +2420,12 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
2418
2420
|
return newEditor;
|
|
2419
2421
|
};
|
|
2420
2422
|
|
|
2421
|
-
const create$
|
|
2423
|
+
const create$8 = () => {
|
|
2422
2424
|
return Math.random();
|
|
2423
2425
|
};
|
|
2424
2426
|
|
|
2425
|
-
const create$
|
|
2426
|
-
const completionUid = create$
|
|
2427
|
+
const create$7 = () => {
|
|
2428
|
+
const completionUid = create$8();
|
|
2427
2429
|
const widget = {
|
|
2428
2430
|
id: ColorPicker$1,
|
|
2429
2431
|
oldState: {
|
|
@@ -2452,11 +2454,11 @@ const create$6 = () => {
|
|
|
2452
2454
|
return widget;
|
|
2453
2455
|
};
|
|
2454
2456
|
|
|
2455
|
-
const newStateGenerator$
|
|
2457
|
+
const newStateGenerator$2 = state => {
|
|
2456
2458
|
return loadContent$3(state);
|
|
2457
2459
|
};
|
|
2458
2460
|
const openColorPicker = async editor => {
|
|
2459
|
-
return addWidgetToEditor(ColorPicker$1, ColorPicker$2, editor, create$
|
|
2461
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker$2, editor, create$7, newStateGenerator$2);
|
|
2460
2462
|
};
|
|
2461
2463
|
|
|
2462
2464
|
const state$6 = {
|
|
@@ -2753,7 +2755,7 @@ const characterLeft = (line, columnIndex) => {
|
|
|
2753
2755
|
if (!supported()) {
|
|
2754
2756
|
return 1;
|
|
2755
2757
|
}
|
|
2756
|
-
const segmenter = create$
|
|
2758
|
+
const segmenter = create$9();
|
|
2757
2759
|
const last = segmenter.at(line, columnIndex - 1);
|
|
2758
2760
|
return columnIndex - last.index;
|
|
2759
2761
|
};
|
|
@@ -2764,7 +2766,7 @@ const characterRight = (line, columnIndex) => {
|
|
|
2764
2766
|
if (!supported()) {
|
|
2765
2767
|
return 1;
|
|
2766
2768
|
}
|
|
2767
|
-
const segmenter = create$
|
|
2769
|
+
const segmenter = create$9();
|
|
2768
2770
|
const next = segmenter.at(line, columnIndex);
|
|
2769
2771
|
return next.segment.length;
|
|
2770
2772
|
};
|
|
@@ -4515,8 +4517,8 @@ const moveSelectionPx = (editor, x, y) => {
|
|
|
4515
4517
|
return editorMoveSelection(editor, position);
|
|
4516
4518
|
};
|
|
4517
4519
|
|
|
4518
|
-
const create$
|
|
4519
|
-
const completionUid = create$
|
|
4520
|
+
const create$6 = () => {
|
|
4521
|
+
const completionUid = create$8();
|
|
4520
4522
|
const completionWidget = {
|
|
4521
4523
|
id: Completion,
|
|
4522
4524
|
oldState: {
|
|
@@ -5031,7 +5033,7 @@ const openCompletion = async editor => {
|
|
|
5031
5033
|
if (hasWidget(widgets, Completion)) {
|
|
5032
5034
|
return editor;
|
|
5033
5035
|
}
|
|
5034
|
-
const completionWidget = create$
|
|
5036
|
+
const completionWidget = create$6();
|
|
5035
5037
|
const newWidgets = [...widgets, completionWidget];
|
|
5036
5038
|
const newEditor = {
|
|
5037
5039
|
...editor,
|
|
@@ -5060,8 +5062,8 @@ const User = 1;
|
|
|
5060
5062
|
const Script = 2;
|
|
5061
5063
|
const Unknown$1 = 0;
|
|
5062
5064
|
|
|
5063
|
-
const create$
|
|
5064
|
-
const uid = create$
|
|
5065
|
+
const create$5 = () => {
|
|
5066
|
+
const uid = create$8();
|
|
5065
5067
|
const widget = {
|
|
5066
5068
|
id: Find,
|
|
5067
5069
|
oldState: {
|
|
@@ -5466,7 +5468,7 @@ const openFind2 = async editor => {
|
|
|
5466
5468
|
return latestState;
|
|
5467
5469
|
};
|
|
5468
5470
|
const fullFocus = true;
|
|
5469
|
-
return addWidgetToEditor(Find, FindWidget, editor, create$
|
|
5471
|
+
return addWidgetToEditor(Find, FindWidget, editor, create$5, newStateGenerator, fullFocus);
|
|
5470
5472
|
};
|
|
5471
5473
|
|
|
5472
5474
|
const openFind = async state => {
|
|
@@ -5488,8 +5490,8 @@ const getRenamePosition = editor => {
|
|
|
5488
5490
|
};
|
|
5489
5491
|
};
|
|
5490
5492
|
|
|
5491
|
-
const create$
|
|
5492
|
-
const completionUid = create$
|
|
5493
|
+
const create$4 = () => {
|
|
5494
|
+
const completionUid = create$8();
|
|
5493
5495
|
const renameWidget = {
|
|
5494
5496
|
id: Rename,
|
|
5495
5497
|
oldState: {
|
|
@@ -5549,7 +5551,7 @@ const openRename = async editor => {
|
|
|
5549
5551
|
return latestState;
|
|
5550
5552
|
};
|
|
5551
5553
|
const fullFocus = true;
|
|
5552
|
-
return addWidgetToEditor(Rename, FocusEditorRename, editor, create$
|
|
5554
|
+
return addWidgetToEditor(Rename, FocusEditorRename, editor, create$4, newStateGenerator, fullFocus);
|
|
5553
5555
|
};
|
|
5554
5556
|
|
|
5555
5557
|
const organizeImports = async editor => {
|
|
@@ -6437,8 +6439,8 @@ const showHover = async state => {
|
|
|
6437
6439
|
return state;
|
|
6438
6440
|
};
|
|
6439
6441
|
|
|
6440
|
-
const create$
|
|
6441
|
-
const uid = create$
|
|
6442
|
+
const create$3 = () => {
|
|
6443
|
+
const uid = create$8();
|
|
6442
6444
|
const widget = {
|
|
6443
6445
|
id: Hover,
|
|
6444
6446
|
oldState: {
|
|
@@ -6491,7 +6493,7 @@ const getHover = async (editor, offset) => {
|
|
|
6491
6493
|
|
|
6492
6494
|
let _ipc;
|
|
6493
6495
|
const listen$5 = async () => {
|
|
6494
|
-
const ipc = await create$
|
|
6496
|
+
const ipc = await create$a({
|
|
6495
6497
|
method: RendererProcess
|
|
6496
6498
|
});
|
|
6497
6499
|
handleIpc(ipc);
|
|
@@ -6703,11 +6705,11 @@ const loadHoverContent = async state => {
|
|
|
6703
6705
|
};
|
|
6704
6706
|
};
|
|
6705
6707
|
|
|
6706
|
-
const newStateGenerator = state => {
|
|
6708
|
+
const newStateGenerator$1 = state => {
|
|
6707
6709
|
return loadHoverContent(state);
|
|
6708
6710
|
};
|
|
6709
6711
|
const showHover2 = async editor => {
|
|
6710
|
-
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$
|
|
6712
|
+
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$3, newStateGenerator$1);
|
|
6711
6713
|
};
|
|
6712
6714
|
|
|
6713
6715
|
// TODO ask extension host worker instead
|
|
@@ -6760,8 +6762,8 @@ const loadSourceActions = async (editor, state) => {
|
|
|
6760
6762
|
};
|
|
6761
6763
|
};
|
|
6762
6764
|
|
|
6763
|
-
const create$
|
|
6764
|
-
const completionUid = create$
|
|
6765
|
+
const create$2 = () => {
|
|
6766
|
+
const completionUid = create$8();
|
|
6765
6767
|
const widget = {
|
|
6766
6768
|
id: SourceAction,
|
|
6767
6769
|
oldState: {
|
|
@@ -6792,7 +6794,7 @@ const showSourceActions = async editor => {
|
|
|
6792
6794
|
const newStateGenerator = state => {
|
|
6793
6795
|
return loadSourceActions(editor, state);
|
|
6794
6796
|
};
|
|
6795
|
-
return addWidgetToEditor(SourceAction, SourceActions, editor, create$
|
|
6797
|
+
return addWidgetToEditor(SourceAction, SourceActions, editor, create$2, newStateGenerator);
|
|
6796
6798
|
};
|
|
6797
6799
|
|
|
6798
6800
|
const compareString = (a, b) => {
|
|
@@ -7669,8 +7671,8 @@ const handelWheel = (state, deltaMode, deltaY) => {
|
|
|
7669
7671
|
return newState;
|
|
7670
7672
|
};
|
|
7671
7673
|
|
|
7672
|
-
const create = () => {
|
|
7673
|
-
const completionUid = create$
|
|
7674
|
+
const create$1 = () => {
|
|
7675
|
+
const completionUid = create$8();
|
|
7674
7676
|
const completionWidget = {
|
|
7675
7677
|
id: CompletionDetail,
|
|
7676
7678
|
oldState: {
|
|
@@ -7723,7 +7725,7 @@ const openDetails = editor => {
|
|
|
7723
7725
|
};
|
|
7724
7726
|
return newestState;
|
|
7725
7727
|
};
|
|
7726
|
-
return addWidgetToEditor(CompletionDetail, CompletionDetail$1, editor, create, newStateGenerator);
|
|
7728
|
+
return addWidgetToEditor(CompletionDetail, CompletionDetail$1, editor, create$1, newStateGenerator);
|
|
7727
7729
|
};
|
|
7728
7730
|
|
|
7729
7731
|
const getEdits = async (editor, completionItem) => {
|
|
@@ -8036,10 +8038,10 @@ const renderBounds$6 = {
|
|
|
8036
8038
|
return [SetBounds, x, y, renderWidth, height];
|
|
8037
8039
|
}
|
|
8038
8040
|
};
|
|
8039
|
-
const render$
|
|
8041
|
+
const render$f = [renderHoverDom, renderBounds$6];
|
|
8040
8042
|
const renderHover = (oldState, newState) => {
|
|
8041
8043
|
const commands = [];
|
|
8042
|
-
for (const item of render$
|
|
8044
|
+
for (const item of render$f) {
|
|
8043
8045
|
if (!item.isEqual(oldState, newState)) {
|
|
8044
8046
|
commands.push(item.apply(oldState, newState));
|
|
8045
8047
|
}
|
|
@@ -8333,6 +8335,33 @@ const moveLineDown = editor => {
|
|
|
8333
8335
|
undefined(editor, documentEdits, cursorEdits);
|
|
8334
8336
|
};
|
|
8335
8337
|
|
|
8338
|
+
const create = () => {
|
|
8339
|
+
const completionUid = create$8();
|
|
8340
|
+
const widget = {
|
|
8341
|
+
id: CodeGenerator,
|
|
8342
|
+
oldState: {
|
|
8343
|
+
uid: completionUid,
|
|
8344
|
+
questions: []
|
|
8345
|
+
},
|
|
8346
|
+
newState: {
|
|
8347
|
+
uid: completionUid,
|
|
8348
|
+
questions: []
|
|
8349
|
+
}
|
|
8350
|
+
};
|
|
8351
|
+
return widget;
|
|
8352
|
+
};
|
|
8353
|
+
|
|
8354
|
+
const newStateGenerator = async state => {
|
|
8355
|
+
const latestState = {
|
|
8356
|
+
...state
|
|
8357
|
+
};
|
|
8358
|
+
return latestState;
|
|
8359
|
+
};
|
|
8360
|
+
const openCodeGenerator = async editor => {
|
|
8361
|
+
const fullFocus = true;
|
|
8362
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create, newStateGenerator, fullFocus);
|
|
8363
|
+
};
|
|
8364
|
+
|
|
8336
8365
|
// TODO handle multiple cursors
|
|
8337
8366
|
const moveLineUp = editor => {
|
|
8338
8367
|
const rowIndex = editor.cursor.rowIndex;
|
|
@@ -9143,7 +9172,7 @@ const renderWidgets = {
|
|
|
9143
9172
|
},
|
|
9144
9173
|
multiple: true
|
|
9145
9174
|
};
|
|
9146
|
-
const render$
|
|
9175
|
+
const render$e = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$2, renderDecorations, renderGutterInfo, renderWidgets];
|
|
9147
9176
|
const renderEditor = async id => {
|
|
9148
9177
|
const instance = get$6(id);
|
|
9149
9178
|
if (!instance) {
|
|
@@ -9155,7 +9184,7 @@ const renderEditor = async id => {
|
|
|
9155
9184
|
} = instance;
|
|
9156
9185
|
const commands = [];
|
|
9157
9186
|
set$6(id, newState, newState);
|
|
9158
|
-
for (const item of render$
|
|
9187
|
+
for (const item of render$e) {
|
|
9159
9188
|
if (!item.isEqual(oldState, newState)) {
|
|
9160
9189
|
const result = await item.apply(oldState, newState);
|
|
9161
9190
|
// @ts-ignore
|
|
@@ -9169,6 +9198,24 @@ const renderEditor = async id => {
|
|
|
9169
9198
|
return commands;
|
|
9170
9199
|
};
|
|
9171
9200
|
|
|
9201
|
+
const isMatchingWidget = widget => {
|
|
9202
|
+
return widget.id === CodeGenerator;
|
|
9203
|
+
};
|
|
9204
|
+
const closeCodeGenerator = editor => {
|
|
9205
|
+
const {
|
|
9206
|
+
widgets
|
|
9207
|
+
} = editor;
|
|
9208
|
+
const index = widgets.findIndex(isMatchingWidget);
|
|
9209
|
+
if (index === -1) {
|
|
9210
|
+
return editor;
|
|
9211
|
+
}
|
|
9212
|
+
const newWidgets = removeEditorWidget(widgets, CodeGenerator);
|
|
9213
|
+
return {
|
|
9214
|
+
...editor,
|
|
9215
|
+
widgets: newWidgets
|
|
9216
|
+
};
|
|
9217
|
+
};
|
|
9218
|
+
|
|
9172
9219
|
const keep = [
|
|
9173
9220
|
// 'ColorPicker.handleSliderPointerDown',
|
|
9174
9221
|
// 'ColorPicker.handleSliderPointerMove',
|
|
@@ -9256,6 +9303,7 @@ const commandMap = {
|
|
|
9256
9303
|
'Editor.applyEdit': applyEdit,
|
|
9257
9304
|
'Editor.braceCompletion': braceCompletion,
|
|
9258
9305
|
'Editor.cancelSelection': cancelSelection,
|
|
9306
|
+
'Editor.closeCodeGenerator': closeCodeGenerator,
|
|
9259
9307
|
'Editor.closeCompletion': closeCompletion,
|
|
9260
9308
|
'Editor.closeFind': closeFind,
|
|
9261
9309
|
'Editor.closeRename': closeRename,
|
|
@@ -9336,6 +9384,7 @@ const commandMap = {
|
|
|
9336
9384
|
'Editor.moveSelection': editorMoveSelection,
|
|
9337
9385
|
'Editor.moveSelectionPx': moveSelectionPx,
|
|
9338
9386
|
'Editor.offsetAt': offsetAt,
|
|
9387
|
+
'Editor.openCodeGenerator': openCodeGenerator,
|
|
9339
9388
|
'Editor.openColorPicker': openColorPicker,
|
|
9340
9389
|
'Editor.openCompletion': openCompletion,
|
|
9341
9390
|
'Editor.openFind': openFind,
|
|
@@ -9945,6 +9994,48 @@ const addWidget = (widget, id, render) => {
|
|
|
9945
9994
|
return allCommands;
|
|
9946
9995
|
};
|
|
9947
9996
|
|
|
9997
|
+
const removeWidget = widget => {
|
|
9998
|
+
// @ts-ignore
|
|
9999
|
+
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
10000
|
+
};
|
|
10001
|
+
|
|
10002
|
+
const getCodeGeneratorVirtualDom = state => {
|
|
10003
|
+
return [{
|
|
10004
|
+
type: Div,
|
|
10005
|
+
className: 'Viewlet CodeGeneratorWidget',
|
|
10006
|
+
childCount: 0
|
|
10007
|
+
}];
|
|
10008
|
+
};
|
|
10009
|
+
const renderCodeGeneratorWidget = (oldState, newState) => {
|
|
10010
|
+
const dom = getCodeGeneratorVirtualDom();
|
|
10011
|
+
return dom;
|
|
10012
|
+
};
|
|
10013
|
+
|
|
10014
|
+
const render$d = widget => {
|
|
10015
|
+
const commands = renderCodeGeneratorWidget();
|
|
10016
|
+
const wrappedCommands = [];
|
|
10017
|
+
const uid = widget.newState.uid;
|
|
10018
|
+
for (const command of commands) {
|
|
10019
|
+
if (command[0] === 'Viewlet.setDom2') {
|
|
10020
|
+
wrappedCommands.push(command);
|
|
10021
|
+
} else {
|
|
10022
|
+
wrappedCommands.push(['Viewlet.send', uid, ...command]);
|
|
10023
|
+
}
|
|
10024
|
+
}
|
|
10025
|
+
return wrappedCommands;
|
|
10026
|
+
};
|
|
10027
|
+
const add$7 = widget => {
|
|
10028
|
+
return addWidget(widget, 'EditorCodeGenerator', render$d);
|
|
10029
|
+
};
|
|
10030
|
+
const remove$7 = removeWidget;
|
|
10031
|
+
|
|
10032
|
+
const EditorCodeGeneratorWidget = {
|
|
10033
|
+
__proto__: null,
|
|
10034
|
+
add: add$7,
|
|
10035
|
+
remove: remove$7,
|
|
10036
|
+
render: render$d
|
|
10037
|
+
};
|
|
10038
|
+
|
|
9948
10039
|
const mergeClassNames = (...classNames) => {
|
|
9949
10040
|
return classNames.filter(Boolean).join(' ');
|
|
9950
10041
|
};
|
|
@@ -10032,11 +10123,6 @@ const renderFull$2 = (oldState, newState) => {
|
|
|
10032
10123
|
return commands;
|
|
10033
10124
|
};
|
|
10034
10125
|
|
|
10035
|
-
const removeWidget = widget => {
|
|
10036
|
-
// @ts-ignore
|
|
10037
|
-
return [['Viewlet.send', widget.newState.uid, 'dispose']];
|
|
10038
|
-
};
|
|
10039
|
-
|
|
10040
10126
|
const render$b = widget => {
|
|
10041
10127
|
const commands = renderFull$2(widget.oldState, widget.newState);
|
|
10042
10128
|
const wrappedCommands = [];
|
|
@@ -11183,6 +11269,7 @@ const registerWidgets = () => {
|
|
|
11183
11269
|
set$7(Hover, EditorHoverWidget);
|
|
11184
11270
|
set$7(Rename, EditorRenameWidget);
|
|
11185
11271
|
set$7(SourceAction, EditorSourceActionWidget);
|
|
11272
|
+
set$7(CodeGenerator, EditorCodeGeneratorWidget);
|
|
11186
11273
|
};
|
|
11187
11274
|
|
|
11188
11275
|
const main = async () => {
|