@lvce-editor/editor-worker 5.15.0 → 5.17.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.
@@ -145,7 +145,7 @@ const InsertLineBreak = 'insertLineBreak';
145
145
  const LineComment = 'lineComment';
146
146
  const Rename$1 = 'rename';
147
147
  const ReplaceAll$2 = 'replaceAll';
148
- const ToggleBlockComment = 'toggleBlockComment';
148
+ const ToggleBlockComment$1 = 'toggleBlockComment';
149
149
 
150
150
  const map$1 = Object.create(null);
151
151
  const set$7 = (id, widget) => {
@@ -266,7 +266,7 @@ const setDeltaY$3 = (state, value) => {
266
266
 
267
267
  const splitLines$2 = lines => {
268
268
  if (!lines) {
269
- return [];
269
+ return [''];
270
270
  }
271
271
  return lines.split('\n');
272
272
  };
@@ -1672,7 +1672,7 @@ const create$a = async ({
1672
1672
  method,
1673
1673
  ...options
1674
1674
  }) => {
1675
- const module = await getModule$1(method);
1675
+ const module = getModule$1(method);
1676
1676
  // @ts-ignore
1677
1677
  const rawIpc = await module.create(options);
1678
1678
  // @ts-ignore
@@ -1752,19 +1752,13 @@ const execute = async ({
1752
1752
  return result;
1753
1753
  };
1754
1754
 
1755
- const combineResults$3 = results => {
1756
- return results[0];
1757
- };
1758
1755
  const executeDiagnosticProvider = editor => {
1759
1756
  return execute({
1760
1757
  editor,
1761
1758
  event: OnDiagnostic,
1762
1759
  method: 'ExtensionHost.executeDiagnosticProvider',
1763
1760
  args: [],
1764
- noProviderFoundMessage: 'no diagnostic provider found',
1765
- noProviderResult: [],
1766
- combineResults: combineResults$3
1767
- });
1761
+ noProviderFoundMessage: 'no diagnostic provider found'});
1768
1762
  };
1769
1763
 
1770
1764
  const getDiagnosticType = diagnostic => {
@@ -2212,7 +2206,6 @@ const at = (editor, eventX, eventY) => {
2212
2206
  letterSpacing,
2213
2207
  lines,
2214
2208
  tabSize,
2215
- differences,
2216
2209
  isMonospaceFont,
2217
2210
  charWidth
2218
2211
  } = editor;
@@ -2385,7 +2378,7 @@ const CompletionDetail = 4;
2385
2378
  const Find = 5;
2386
2379
  const Hover = 6;
2387
2380
  const Rename = 7;
2388
- const SourceAction = 8;
2381
+ const SourceAction$1 = 8;
2389
2382
 
2390
2383
  const isMatchingWidget$2 = widget => {
2391
2384
  return widget.id === CodeGenerator;
@@ -2464,7 +2457,7 @@ const closeRename = editor => {
2464
2457
  };
2465
2458
 
2466
2459
  const isMatchingWidget = widget => {
2467
- return widget.id === SourceAction;
2460
+ return widget.id === SourceAction$1;
2468
2461
  };
2469
2462
  const closeSourceAction = editor => {
2470
2463
  const {
@@ -2474,7 +2467,7 @@ const closeSourceAction = editor => {
2474
2467
  if (index === -1) {
2475
2468
  return editor;
2476
2469
  }
2477
- const newWidgets = removeEditorWidget(widgets, SourceAction);
2470
+ const newWidgets = removeEditorWidget(widgets, SourceAction$1);
2478
2471
  return {
2479
2472
  ...editor,
2480
2473
  widgets: newWidgets
@@ -3449,151 +3442,130 @@ const i18nString = (key, placeholders = emptyObject) => {
3449
3442
  return key.replaceAll(RE_PLACEHOLDER, replacer);
3450
3443
  };
3451
3444
 
3452
- const UiStrings$1 = {
3453
- Copy: 'Copy',
3454
- CopyLineDown: 'Copy Line Down',
3455
- CopyLineUp: 'Copy Line Up',
3456
- Cut: 'Cut',
3457
- DuplicateSelection: 'Duplicate Selection',
3458
- EditorCloseColorPicker: 'Editor: Close Color Picker',
3459
- EditorCopyLineDown: 'Editor: Copy Line Down',
3460
- EditorCopyLineUp: 'Editor: Copy Line Up',
3461
- EditorFormatDocumentForced: 'Editor: Format Document (forced)',
3462
- EditorGoToDefinition: 'Editor: Go To Definition',
3463
- EditorGoToTypeDefinition: 'Editor: Go To Type Definition',
3464
- EditorIndent: 'Editor: Indent',
3465
- EditorOpenColorPicker: 'Editor: Open Color Picker',
3466
- EditorSelectAllOccurrences: 'Editor: Select All Occurrences',
3467
- EditorSelectDown: 'Editor: Select Down',
3468
- EditorSelectInsideString: 'Editor: Select Inside String',
3469
- EditorSelectNextOccurrence: 'Editor: Select Next Occurrence',
3470
- EditorSelectUp: 'Editor: Select Up',
3471
- EditorShowHover: 'Show Hover',
3472
- EditorSortLinesAscending: 'Editor: Sort Lines Ascending',
3473
- EditorToggleBlockComment: 'Editor: Toggle Block Comment',
3474
- EditorToggleComment: 'Editor: Toggle Comment',
3475
- EditorUnindent: 'Editor: Unindent',
3476
- EnterCode: 'Enter Code',
3477
- EscapeToClose: 'Escape to close',
3478
- FindAllImplementations: 'Find All Implementations',
3479
- FindAllReferences: 'Find All References',
3480
- FormatDocument: 'Format Document',
3481
- GoToDefinition: 'Go to Definition',
3482
- GoToTypeDefinition: 'Go to Type Definition',
3483
- MoveLineDown: 'Move Line Down',
3484
- MoveLineUp: 'Move Line Up',
3485
- NoCodeActionsAvailable: 'No code actions available',
3486
- NoDefinitionFound: 'No definition found',
3487
- NoDefinitionFoundFor: "No definition found for '{PH1}'",
3488
- NoResults: 'No Results',
3489
- NoTypeDefinitionFound: 'No type definition found',
3490
- NoTypeDefinitionFoundFor: "No type definition found for '{PH1}'",
3491
- OrganizeImports: 'Organize Imports',
3492
- Paste: 'Paste',
3493
- Redo: 'Redo',
3494
- Replace: 'Replace',
3495
- SelectAll: 'Select All',
3496
- Separator: 'Separator',
3497
- SortImports: 'Sort Imports',
3498
- SourceAction: 'Source Action',
3499
- SourceActions: 'Source Actions',
3500
- ToggleBlockComment: 'Toggle Block Comment',
3501
- ToggleLineComment: 'Toggle Line Comment',
3502
- Undo: 'Undo'
3503
- };
3445
+ const EditorCloseColorPicker = 'Editor: Close Color Picker';
3446
+ const EditorCopyLineDown = 'Editor: Copy Line Down';
3447
+ const EditorCopyLineUp = 'Editor: Copy Line Up';
3448
+ const EditorFormatDocumentForced = 'Editor: Format Document (forced)';
3449
+ const EditorGoToDefinition = 'Editor: Go To Definition';
3450
+ const EditorGoToTypeDefinition = 'Editor: Go To Type Definition';
3451
+ const EditorIndent = 'Editor: Indent';
3452
+ const EditorOpenColorPicker = 'Editor: Open Color Picker';
3453
+ const EditorSelectAllOccurrences = 'Editor: Select All Occurrences';
3454
+ const EditorSelectDown = 'Editor: Select Down';
3455
+ const EditorSelectInsideString = 'Editor: Select Inside String';
3456
+ const EditorSelectNextOccurrence = 'Editor: Select Next Occurrence';
3457
+ const EditorSelectUp = 'Editor: Select Up';
3458
+ const EditorShowHover = 'Show Hover';
3459
+ const EditorSortLinesAscending = 'Editor: Sort Lines Ascending';
3460
+ const EditorToggleComment = 'Editor: Toggle Comment';
3461
+ const EditorUnindent = 'Editor: Unindent';
3462
+ const EnterCode = 'Enter Code';
3463
+ const EscapeToClose = 'Escape to close';
3464
+ const FormatDocument = 'Format Document';
3465
+ const MoveLineDown = 'Move Line Down';
3466
+ const MoveLineUp = 'Move Line Up';
3467
+ const NoCodeActionsAvailable = 'No code actions available';
3468
+ const NoDefinitionFound = 'No definition found';
3469
+ const NoDefinitionFoundFor = "No definition found for '{PH1}'";
3470
+ const NoResults = 'No Results';
3471
+ const NoTypeDefinitionFound = 'No type definition found';
3472
+ const NoTypeDefinitionFoundFor = "No type definition found for '{PH1}'";
3473
+ const SourceAction = 'Source Action';
3474
+ const ToggleBlockComment = 'Toggle Block Comment';
3475
+
3504
3476
  const noDefinitionFound = () => {
3505
- return i18nString(UiStrings$1.NoDefinitionFound);
3477
+ return i18nString(NoDefinitionFound);
3506
3478
  };
3507
3479
  const noDefinitionFoundFor = word => {
3508
- return i18nString(UiStrings$1.NoDefinitionFoundFor, {
3480
+ return i18nString(NoDefinitionFoundFor, {
3509
3481
  PH1: word
3510
3482
  });
3511
3483
  };
3512
3484
  const noTypeDefinitionFoundFor = word => {
3513
- return i18nString(UiStrings$1.NoTypeDefinitionFoundFor, {
3485
+ return i18nString(NoTypeDefinitionFoundFor, {
3514
3486
  PH1: word
3515
3487
  });
3516
3488
  };
3517
3489
  const noTypeDefinitionFound = () => {
3518
- return i18nString(UiStrings$1.NoTypeDefinitionFound);
3490
+ return i18nString(NoTypeDefinitionFound);
3519
3491
  };
3520
3492
  const noResults$1 = () => {
3521
- return i18nString(UiStrings$1.NoResults);
3493
+ return i18nString(NoResults);
3522
3494
  };
3523
3495
  const sourceAction = () => {
3524
- return i18nString(UiStrings$1.SourceAction);
3496
+ return i18nString(SourceAction);
3525
3497
  };
3526
3498
  const noCodeActionsAvailable = () => {
3527
- return i18nString(UiStrings$1.NoCodeActionsAvailable);
3499
+ return i18nString(NoCodeActionsAvailable);
3528
3500
  };
3529
3501
  const escapeToClose = () => {
3530
- return i18nString(UiStrings$1.EscapeToClose);
3502
+ return i18nString(EscapeToClose);
3531
3503
  };
3532
3504
  const enterCode = () => {
3533
- return i18nString(UiStrings$1.EnterCode);
3505
+ return i18nString(EnterCode);
3534
3506
  };
3535
3507
  const toggleBlockComment$1 = () => {
3536
- return i18nString(UiStrings$1.ToggleBlockComment);
3508
+ return i18nString(ToggleBlockComment);
3537
3509
  };
3538
3510
  const moveLineUp$1 = () => {
3539
- return i18nString(UiStrings$1.MoveLineUp);
3511
+ return i18nString(MoveLineUp);
3540
3512
  };
3541
3513
  const moveLineDown$1 = () => {
3542
- return i18nString(UiStrings$1.MoveLineDown);
3514
+ return i18nString(MoveLineDown);
3543
3515
  };
3544
3516
  const formatDocument = () => {
3545
- return i18nString(UiStrings$1.FormatDocument);
3517
+ return i18nString(FormatDocument);
3546
3518
  };
3547
3519
  const editorShowHover = () => {
3548
- return i18nString(UiStrings$1.EditorShowHover);
3520
+ return i18nString(EditorShowHover);
3549
3521
  };
3550
3522
  const editorFormatDocumentForced = () => {
3551
- return i18nString(UiStrings$1.EditorFormatDocumentForced);
3523
+ return i18nString(EditorFormatDocumentForced);
3552
3524
  };
3553
3525
  const editorSelectNextOccurrence = () => {
3554
- return i18nString(UiStrings$1.EditorSelectNextOccurrence);
3526
+ return i18nString(EditorSelectNextOccurrence);
3555
3527
  };
3556
3528
  const editorSelectAllOccurrences = () => {
3557
- return i18nString(UiStrings$1.EditorSelectAllOccurrences);
3529
+ return i18nString(EditorSelectAllOccurrences);
3558
3530
  };
3559
3531
  const editorGoToDefinition = () => {
3560
- return i18nString(UiStrings$1.EditorGoToDefinition);
3532
+ return i18nString(EditorGoToDefinition);
3561
3533
  };
3562
3534
  const editorGoToTypeDefinition = () => {
3563
- return i18nString(UiStrings$1.EditorGoToTypeDefinition);
3535
+ return i18nString(EditorGoToTypeDefinition);
3564
3536
  };
3565
3537
  const editorSelectInsideString = () => {
3566
- return i18nString(UiStrings$1.EditorSelectInsideString);
3538
+ return i18nString(EditorSelectInsideString);
3567
3539
  };
3568
3540
  const editorIndent = () => {
3569
- return i18nString(UiStrings$1.EditorIndent);
3541
+ return i18nString(EditorIndent);
3570
3542
  };
3571
3543
  const editorUnindent$1 = () => {
3572
- return i18nString(UiStrings$1.EditorUnindent);
3544
+ return i18nString(EditorUnindent);
3573
3545
  };
3574
3546
  const editorSortLinesAscending = () => {
3575
- return i18nString(UiStrings$1.EditorSortLinesAscending);
3547
+ return i18nString(EditorSortLinesAscending);
3576
3548
  };
3577
3549
  const editorToggleComment = () => {
3578
- return i18nString(UiStrings$1.EditorToggleComment);
3550
+ return i18nString(EditorToggleComment);
3579
3551
  };
3580
3552
  const editorSelectUp = () => {
3581
- return i18nString(UiStrings$1.EditorSelectUp);
3553
+ return i18nString(EditorSelectUp);
3582
3554
  };
3583
3555
  const editorSelectDown = () => {
3584
- return i18nString(UiStrings$1.EditorSelectDown);
3556
+ return i18nString(EditorSelectDown);
3585
3557
  };
3586
3558
  const editorOpenColorPicker = () => {
3587
- return i18nString(UiStrings$1.EditorOpenColorPicker);
3559
+ return i18nString(EditorOpenColorPicker);
3588
3560
  };
3589
3561
  const editorCloseColorPicker = () => {
3590
- return i18nString(UiStrings$1.EditorCloseColorPicker);
3562
+ return i18nString(EditorCloseColorPicker);
3591
3563
  };
3592
3564
  const editorCopyLineDown = () => {
3593
- return i18nString(UiStrings$1.EditorCopyLineDown);
3565
+ return i18nString(EditorCopyLineDown);
3594
3566
  };
3595
3567
  const editorCopyLineUp = () => {
3596
- return i18nString(UiStrings$1.EditorCopyLineUp);
3568
+ return i18nString(EditorCopyLineUp);
3597
3569
  };
3598
3570
 
3599
3571
  // @ts-ignore
@@ -4204,9 +4176,6 @@ const handleScrollBarHorizontalPointerDown = (state, eventX) => {
4204
4176
  x,
4205
4177
  deltaX,
4206
4178
  width,
4207
- finalDeltaY,
4208
- height,
4209
- scrollBarHeight,
4210
4179
  longestLineWidth
4211
4180
  } = state;
4212
4181
  const relativeX = eventX - x;
@@ -4359,9 +4328,7 @@ const setDelta = (editor, deltaMode, eventDeltaX, eventDeltaY) => {
4359
4328
  number(eventDeltaY);
4360
4329
  // @ts-ignore
4361
4330
  const {
4362
- deltaX,
4363
- deltaY
4364
- } = editor;
4331
+ deltaX} = editor;
4365
4332
  if (eventDeltaX === 0) {
4366
4333
  return setDeltaY$1(editor, eventDeltaY);
4367
4334
  }
@@ -4815,9 +4782,6 @@ const create$5 = () => {
4815
4782
  return completionWidget;
4816
4783
  };
4817
4784
 
4818
- const combineResults$2 = results => {
4819
- return results[0] ?? [];
4820
- };
4821
4785
  const executeCompletionProvider = async (editor, offset) => {
4822
4786
  return execute({
4823
4787
  editor,
@@ -4825,12 +4789,7 @@ const executeCompletionProvider = async (editor, offset) => {
4825
4789
  method: CompletionExecute,
4826
4790
  args: [offset],
4827
4791
  noProviderFoundMessage: 'no completion provider found',
4828
- noProviderFoundResult: [],
4829
- combineResults: combineResults$2
4830
- });
4831
- };
4832
- const combineResultsResolve = items => {
4833
- return items[0] ?? undefined;
4792
+ noProviderFoundResult: []});
4834
4793
  };
4835
4794
  const executeResolveCompletionItem = async (editor, offset, name, completionItem) => {
4836
4795
  return execute({
@@ -4839,9 +4798,7 @@ const executeResolveCompletionItem = async (editor, offset, name, completionItem
4839
4798
  method: CompletionResolveExecute,
4840
4799
  args: [offset, name, completionItem],
4841
4800
  noProviderFoundMessage: 'no completion provider found',
4842
- noProviderFoundResult: [],
4843
- combineResults: combineResultsResolve
4844
- });
4801
+ noProviderFoundResult: []});
4845
4802
  };
4846
4803
 
4847
4804
  const getOffsetAtCursor = editor => {
@@ -5132,6 +5089,7 @@ const getWordAtOffset = editor => {
5132
5089
  }
5133
5090
  return '';
5134
5091
  };
5092
+
5135
5093
  const handleEditorType$2 = (editorUid, state, text) => {
5136
5094
  const editor = getEditor(editorUid);
5137
5095
  const {
@@ -6529,14 +6487,7 @@ const TokenizePlainText = {
6529
6487
 
6530
6488
  const state$1 = {
6531
6489
  tokenizers: Object.create(null),
6532
- tokenizePaths: Object.create(null),
6533
- listeners: [],
6534
- pending: Object.create(null),
6535
- /**
6536
- * @type {number[]}
6537
- */
6538
- connectedEditors: []
6539
- };
6490
+ pending: Object.create(null)};
6540
6491
  const has = languageId => {
6541
6492
  return languageId in state$1.tokenizers;
6542
6493
  };
@@ -7002,7 +6953,7 @@ const loadSourceActions = async (editor, state) => {
7002
6953
  const create$1 = () => {
7003
6954
  const completionUid = create$8();
7004
6955
  const widget = {
7005
- id: SourceAction,
6956
+ id: SourceAction$1,
7006
6957
  oldState: {
7007
6958
  uid: completionUid,
7008
6959
  x: 0,
@@ -7031,7 +6982,7 @@ const showSourceActions = async editor => {
7031
6982
  const newStateGenerator = async state => {
7032
6983
  return loadSourceActions(editor, state);
7033
6984
  };
7034
- return addWidgetToEditor(SourceAction, SourceActions, editor, create$1, newStateGenerator);
6985
+ return addWidgetToEditor(SourceAction$1, SourceActions, editor, create$1, newStateGenerator);
7035
6986
  };
7036
6987
 
7037
6988
  const compareString = (a, b) => {
@@ -7093,9 +7044,6 @@ const sortLinesAscending = editor => {
7093
7044
  return scheduleDocumentAndCursorsSelections(editor, changes);
7094
7045
  };
7095
7046
 
7096
- const combineResults$1 = results => {
7097
- return results[0];
7098
- };
7099
7047
  const executeTabCompletionProvider = async (editor, offset) => {
7100
7048
  return execute({
7101
7049
  editor,
@@ -7103,7 +7051,6 @@ const executeTabCompletionProvider = async (editor, offset) => {
7103
7051
  method: TabCompletionExecuteTabCompletionProvider,
7104
7052
  args: [offset],
7105
7053
  noProviderFoundMessage: 'No tab completion provider found',
7106
- combineResults: combineResults$1,
7107
7054
  noProviderFoundResult: undefined
7108
7055
  });
7109
7056
  };
@@ -7284,7 +7231,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7284
7231
  },
7285
7232
  inserted: [],
7286
7233
  deleted: [blockCommentStart],
7287
- origin: ToggleBlockComment
7234
+ origin: ToggleBlockComment$1
7288
7235
  };
7289
7236
  const change2 = {
7290
7237
  start: {
@@ -7297,7 +7244,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7297
7244
  },
7298
7245
  inserted: [],
7299
7246
  deleted: [blockCommentEnd],
7300
- origin: ToggleBlockComment
7247
+ origin: ToggleBlockComment$1
7301
7248
  };
7302
7249
  changes.push(change1, change2);
7303
7250
  } else {
@@ -7312,7 +7259,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7312
7259
  },
7313
7260
  inserted: [],
7314
7261
  deleted: [blockCommentStart],
7315
- origin: ToggleBlockComment
7262
+ origin: ToggleBlockComment$1
7316
7263
  };
7317
7264
  const change2 = {
7318
7265
  start: {
@@ -7325,7 +7272,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7325
7272
  },
7326
7273
  inserted: [],
7327
7274
  deleted: [blockCommentEnd],
7328
- origin: ToggleBlockComment
7275
+ origin: ToggleBlockComment$1
7329
7276
  };
7330
7277
  changes.push(change1, change2);
7331
7278
 
@@ -7364,7 +7311,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7364
7311
  },
7365
7312
  inserted: [blockCommentStart],
7366
7313
  deleted: [],
7367
- origin: ToggleBlockComment
7314
+ origin: ToggleBlockComment$1
7368
7315
  };
7369
7316
  const change2 = {
7370
7317
  start: {
@@ -7377,7 +7324,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
7377
7324
  },
7378
7325
  inserted: [blockCommentEnd],
7379
7326
  deleted: [],
7380
- origin: ToggleBlockComment
7327
+ origin: ToggleBlockComment$1
7381
7328
  };
7382
7329
  changes.push(change1, change2);
7383
7330
  // TextDocument.setLine(
@@ -7893,14 +7840,14 @@ const setDeltaY = (state, value) => {
7893
7840
  };
7894
7841
  };
7895
7842
 
7896
- const handleWheel = (state, deltaMode, deltaY) => {
7843
+ const handleWheel$1 = (state, deltaMode, deltaY) => {
7897
7844
  number(deltaMode);
7898
7845
  number(deltaY);
7899
7846
  return setDeltaY(state, state.deltaY + deltaY);
7900
7847
  };
7901
7848
 
7902
- const handelWheel = (state, deltaMode, deltaY) => {
7903
- const newState = handleWheel(state, deltaMode, deltaY);
7849
+ const handleWheel = (state, deltaMode, deltaY) => {
7850
+ const newState = handleWheel$1(state, deltaMode, deltaY);
7904
7851
  return newState;
7905
7852
  };
7906
7853
 
@@ -7965,9 +7912,7 @@ const getEdits = async (editor, completionItem) => {
7965
7912
  const child = getCompletionState(editor);
7966
7913
  // @ts-ignore
7967
7914
  const {
7968
- leadingWord,
7969
- uid
7970
- } = child;
7915
+ leadingWord} = child;
7971
7916
  const word = completionItem.label;
7972
7917
  const resolvedItem = await resolveCompletion(editor, word, completionItem);
7973
7918
  const inserted = resolvedItem ? resolvedItem.snippet : word;
@@ -8073,9 +8018,7 @@ const handleSashPointerDown = (state, eventX, eventY) => {
8073
8018
  const handleSashPointerMove = (state, eventX, eventY) => {
8074
8019
  // @ts-ignore
8075
8020
  const {
8076
- x,
8077
- y
8078
- } = state;
8021
+ x} = state;
8079
8022
  const minWidth = 100;
8080
8023
  const newWidth = Math.max(eventX - x, minWidth);
8081
8024
  return {
@@ -8142,20 +8085,29 @@ const SourceActionItem = 'SourceActionItem';
8142
8085
  const SourceActionItemFocused = 'SourceActionItemFocused';
8143
8086
  const Viewlet = 'Viewlet';
8144
8087
 
8145
- const HandlePointerDown = 'handlePointerDown';
8146
- const HandleSashPointerDown = 'handleSashPointerDown';
8147
- const HandleClose = 'handleClose';
8148
- const HandleFocusIn = 'handleFocusIn';
8088
+ const HandleBeforeInput = 'handleBeforeInput';
8089
+ const HandleBlur = 'handleBlur';
8149
8090
  const HandleClick = 'handleClick';
8150
- const HandleInput = 'handleInput';
8151
- const HandleFocus = 'handleFocus';
8152
- const HandleClickPreviousMatch = 'handleClickPreviousMatch';
8153
- const HandleClickNextMatch = 'handleClickNextMatch';
8154
8091
  const HandleClickClose = 'handleClickClose';
8092
+ const HandleClickNextMatch = 'handleClickNextMatch';
8093
+ const HandleClickPreviousMatch = 'handleClickPreviousMatch';
8155
8094
  const HandleClickReplace = 'handleClickReplace';
8156
8095
  const HandleClickReplaceAll = 'handleClickReplaceAll';
8157
- const HandleReplaceInput = 'handleReplaceInput';
8096
+ const HandleClose = 'handleClose';
8097
+ const HandleCompositionEnd = 'handleCompositionEnd';
8098
+ const HandleCompositionStart = 'handleCompositionStart';
8099
+ const HandleCompositionUpdate = 'handleCompositionUpdate';
8100
+ const HandleContextMenu = 'handleContextMenu';
8101
+ const HandleCut = 'handleCut';
8102
+ const HandleFocus = 'handleFocus';
8103
+ const HandleFocusIn = 'handleFocusIn';
8104
+ const HandleInput = 'handleInput';
8105
+ const HandleMouseMove = 'handleMouseMove';
8106
+ const HandlePointerDown = 'handlePointerDown';
8158
8107
  const HandleReplaceFocus = 'handleReplaceFocus';
8108
+ const HandleReplaceInput = 'handleReplaceInput';
8109
+ const HandleSashPointerDown = 'handleSashPointerDown';
8110
+ const HandleWheel = 'handleWheel';
8159
8111
 
8160
8112
  const Button = 1;
8161
8113
  const Div = 4;
@@ -8293,9 +8245,6 @@ const renderHover = (oldState, newState) => {
8293
8245
  return commands;
8294
8246
  };
8295
8247
 
8296
- const combineResults = results => {
8297
- return results[0] ?? [];
8298
- };
8299
8248
  const executeRenameProvider = async (editor, offset, newName) => {
8300
8249
  return execute({
8301
8250
  editor,
@@ -8303,9 +8252,7 @@ const executeRenameProvider = async (editor, offset, newName) => {
8303
8252
  method: RenameExecuteRename,
8304
8253
  args: [offset, newName],
8305
8254
  noProviderFoundMessage: 'no rename provider found',
8306
- noProviderFoundResult: [],
8307
- combineResults
8308
- });
8255
+ noProviderFoundResult: []});
8309
8256
  };
8310
8257
 
8311
8258
  const getRenameState = editor => {
@@ -9544,10 +9491,6 @@ const getVisible = async (editor, syncIncremental) => {
9544
9491
  lines,
9545
9492
  width,
9546
9493
  deltaX,
9547
- fontWeight,
9548
- fontSize,
9549
- fontFamily,
9550
- letterSpacing,
9551
9494
  charWidth
9552
9495
  } = editor;
9553
9496
  const maxLineY = Math.min(minLineY + numberOfVisibleLines, lines.length);
@@ -9903,6 +9846,43 @@ const renderEditor = async id => {
9903
9846
  return commands;
9904
9847
  };
9905
9848
 
9849
+ const renderEventListeners = () => {
9850
+ return [{
9851
+ name: HandleFocus,
9852
+ params: ['handleFocus']
9853
+ }, {
9854
+ name: HandleMouseMove,
9855
+ params: ['handleInput', 'event.clientX', 'event.clientY', 'event.altKey']
9856
+ }, {
9857
+ name: HandleBlur,
9858
+ params: ['handleBlur']
9859
+ }, {
9860
+ name: HandleBeforeInput,
9861
+ params: ['handleBeforeInput', 'event.inputType', 'event.data']
9862
+ }, {
9863
+ name: HandleCompositionStart,
9864
+ params: ['compositionStart', 'event.data']
9865
+ }, {
9866
+ name: HandleCompositionUpdate,
9867
+ params: ['compositionUpdate', 'event.data']
9868
+ }, {
9869
+ name: HandleCompositionEnd,
9870
+ params: ['compositionUpdate', 'event.data']
9871
+ }, {
9872
+ name: HandleCut,
9873
+ params: ['cut'],
9874
+ preventDefault: true
9875
+ }, {
9876
+ name: HandleWheel,
9877
+ params: ['setDelta', 'event.deltaMode', 'event.deltaY'],
9878
+ preventDefault: true
9879
+ }, {
9880
+ name: HandleContextMenu,
9881
+ params: ['handleContextMenu', 'event.button', 'event.clientX', 'event.clientY'],
9882
+ preventDefault: true
9883
+ }];
9884
+ };
9885
+
9906
9886
  const editorDiagnosticEffect = {
9907
9887
  isActive(oldEditor, newEditor) {
9908
9888
  // TODO avoid slow comparison
@@ -10102,6 +10082,7 @@ const commandMap = {
10102
10082
  'Editor.paste': paste,
10103
10083
  'Editor.pasteText': pasteText,
10104
10084
  'Editor.render': renderEditor,
10085
+ 'Editor.renderEventListeners': renderEventListeners,
10105
10086
  'Editor.replaceRange': replaceRange,
10106
10087
  'Editor.rerender': rerender,
10107
10088
  'Editor.save': save,
@@ -10150,7 +10131,7 @@ const commandMap = {
10150
10131
  'EditorCompletion.handleEditorClick': handleEditorClick,
10151
10132
  'EditorCompletion.handleEditorDeleteLeft': handleEditorDeleteLeft$2,
10152
10133
  'EditorCompletion.handleEditorType': handleEditorType$2,
10153
- 'EditorCompletion.handleWheel': handelWheel,
10134
+ 'EditorCompletion.handleWheel': handleWheel,
10154
10135
  'EditorCompletion.loadContent': loadContent$2,
10155
10136
  'EditorCompletion.openDetails': openDetails,
10156
10137
  'EditorCompletion.selectCurrent': selectCurrent,
@@ -11323,7 +11304,6 @@ const EditorCompletionWidget = {
11323
11304
  * @enum {string}
11324
11305
  */
11325
11306
  const UiStrings = {
11326
- MatchesFoundFor: '{PH1} of {PH2} found for {PH3}',
11327
11307
  MatchOf: '{PH1} of {PH2}',
11328
11308
  NoResults: 'No Results',
11329
11309
  Close: 'Close',
@@ -11988,11 +11968,27 @@ const registerWidgets = () => {
11988
11968
  set$7(Find, EditorFindWidget);
11989
11969
  set$7(Hover, EditorHoverWidget);
11990
11970
  set$7(Rename, EditorRenameWidget);
11991
- set$7(SourceAction, EditorSourceActionWidget);
11971
+ set$7(SourceAction$1, EditorSourceActionWidget);
11992
11972
  set$7(CodeGenerator, EditorCodeGeneratorWidget);
11993
11973
  };
11994
11974
 
11975
+ const handleUnhandledRejection = event => {
11976
+ event.preventDefault();
11977
+ console.error(`[editor-worker] Unhandled Rejection: ${event.reason}`);
11978
+ };
11979
+ const handleUnhandledError = (message, filename, lineno, colno, error) => {
11980
+ console.error(`[editor-worker] Unhandled Error: ${error}`);
11981
+ return true;
11982
+ };
11983
+
11984
+ const setupUnhandledErrorHandling = global => {
11985
+ // @ts-ignore
11986
+ global.addEventListener('error', handleUnhandledError);
11987
+ global.addEventListener('unhandledrejection', handleUnhandledRejection);
11988
+ };
11989
+
11995
11990
  const main = async () => {
11991
+ setupUnhandledErrorHandling(globalThis);
11996
11992
  await listen();
11997
11993
  registerWidgets();
11998
11994
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "5.15.0",
3
+ "version": "5.17.0",
4
4
  "description": "",
5
5
  "main": "dist/editorWorkerMain.js",
6
6
  "type": "module",