@lvce-editor/editor-worker 19.59.2 → 19.60.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.
@@ -4987,7 +4987,8 @@ const updateDerivedState = async (oldState, newState) => {
4987
4987
  if (oldState.lines !== nextState.lines) {
4988
4988
  finalState = {
4989
4989
  ...finalState,
4990
- lightBulbRowIndex: -1
4990
+ lightBulbRowIndex: -1,
4991
+ problemsHighlightedRow: -1
4991
4992
  };
4992
4993
  } else if (shouldUpdateLightBulb(oldState, nextState)) {
4993
4994
  finalState = {
@@ -5187,6 +5188,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir, _langua
5187
5188
  outerWidth: width,
5188
5189
  platform,
5189
5190
  primarySelectionIndex: 0,
5191
+ problemsHighlightedRow: -1,
5190
5192
  redoStack: [],
5191
5193
  rowHeight: 0,
5192
5194
  savedSelections: [],
@@ -5267,6 +5269,7 @@ const emptyEditor = {
5267
5269
  minLineY: 0,
5268
5270
  outerHeight: 0,
5269
5271
  outerWidth: 0,
5272
+ problemsHighlightedRow: -1,
5270
5273
  redoStack: [],
5271
5274
  scrollBarHeight: 0,
5272
5275
  selectionAnchorPosition: {
@@ -5666,7 +5669,7 @@ const isEqual$3 = (oldState, newState) => {
5666
5669
  };
5667
5670
 
5668
5671
  const isEqual$2 = (oldState, newState) => {
5669
- return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5672
+ return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
5670
5673
  };
5671
5674
 
5672
5675
  const isEqual$1 = (oldState, newState) => {
@@ -8825,14 +8828,15 @@ const handleDoubleClick = async (editor, modifier, x, y) => {
8825
8828
  };
8826
8829
 
8827
8830
  const handleFocus$1 = editor => {
8828
- if (editor.focused && editor.focus === FocusEditorText$1) {
8831
+ if (editor.focused && editor.focus === FocusEditorText$1 && editor.problemsHighlightedRow === -1) {
8829
8832
  return editor;
8830
8833
  }
8831
8834
  return {
8832
8835
  ...editor,
8833
8836
  additionalFocus: 0,
8834
8837
  focus: FocusEditorText$1,
8835
- focused: true
8838
+ focused: true,
8839
+ problemsHighlightedRow: -1
8836
8840
  };
8837
8841
  };
8838
8842
 
@@ -14910,6 +14914,11 @@ ${editorSelector} .MergeConflictAction:focus-visible {
14910
14914
  outline: none;
14911
14915
  text-decoration: underline;
14912
14916
  }
14917
+ ${editorSelector} .EditorProblemsHighlightedRow {
14918
+ background: var(--EditorRangeHighlightBackground, rgba(128, 128, 128, 0.18));
14919
+ outline: 1px solid var(--EditorRangeHighlightBorder, rgba(128, 128, 128, 0.35));
14920
+ outline-offset: -1px;
14921
+ }
14913
14922
  ${editorSelector} .EditorLineDecoration {
14914
14923
  color: var(--EditorInlineBlameForeground, rgba(255, 255, 255, 0.5));
14915
14924
  font-style: italic;
@@ -15240,7 +15249,7 @@ const addMergeConflictActions = (dom, rowIndex) => {
15240
15249
  }, text(label));
15241
15250
  }
15242
15251
  };
15243
- const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
15252
+ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1) => {
15244
15253
  const dom = [];
15245
15254
  const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
15246
15255
  length: textInfos.length
@@ -15259,6 +15268,9 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
15259
15268
  if (rowIndex === highlightedLine) {
15260
15269
  className = mergeClassNames(className, EditorRowHighlighted);
15261
15270
  }
15271
+ if (rowIndex === problemsHighlightedRow) {
15272
+ className = mergeClassNames(className, 'EditorProblemsHighlightedRow');
15273
+ }
15262
15274
  dom.push({
15263
15275
  childCount: textInfo.length / 2 + rowDecorations.length,
15264
15276
  className,
@@ -15282,8 +15294,8 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
15282
15294
  return dom;
15283
15295
  };
15284
15296
 
15285
- const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = []) => {
15286
- const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
15297
+ const getEditorRowsVirtualDom = (textInfos, differences, lineNumbers = true, highlightedLine = -1, visibleLineIndices = [], endOfLineDecorations = [], visibleViewLineIndices = [], problemsHighlightedRow = -1) => {
15298
+ const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow);
15287
15299
  return [{
15288
15300
  childCount: visibleViewLineIndices.length || textInfos.length,
15289
15301
  className: 'EditorRows',
@@ -15328,8 +15340,8 @@ const editorLayersNode = {
15328
15340
  className: 'EditorLayers',
15329
15341
  type: Div
15330
15342
  };
15331
- const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = []) => {
15332
- return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
15343
+ const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, lineNumbers = true, highlightedLine = -1, cursorInfos = [], diagnostics = [], visibleLineIndices = [], endOfLineDecorations = [], bracketMatchInfos = [], focused = true, visibleViewLineIndices = [], problemsHighlightedRow = -1) => {
15344
+ return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused), ...getEditorRowsVirtualDom(textInfos, differences, lineNumbers, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, problemsHighlightedRow), ...getEditorCursorsVirtualDom(cursorInfos), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos)];
15333
15345
  };
15334
15346
 
15335
15347
  const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
@@ -15394,13 +15406,14 @@ const getEditorContentVirtualDom = ({
15394
15406
  focused = true,
15395
15407
  highlightedLine = -1,
15396
15408
  lineNumbers = true,
15409
+ problemsHighlightedRow = -1,
15397
15410
  scrollBarDiagnostics = [],
15398
15411
  selectionInfos = [],
15399
15412
  textInfos,
15400
15413
  visibleLineIndices = [],
15401
15414
  visibleViewLineIndices = []
15402
15415
  }) => {
15403
- return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
15416
+ return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
15404
15417
  };
15405
15418
 
15406
15419
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -15554,6 +15567,7 @@ const getEditorVirtualDom = ({
15554
15567
  minimapLines = [],
15555
15568
  minLineY = 0,
15556
15569
  primarySelectionIndex = 0,
15570
+ problemsHighlightedRow = -1,
15557
15571
  scrollBarDiagnostics = [],
15558
15572
  selectionInfos = [],
15559
15573
  selections = new Uint32Array(),
@@ -15605,6 +15619,7 @@ const getEditorVirtualDom = ({
15605
15619
  focused,
15606
15620
  highlightedLine,
15607
15621
  lineNumbers,
15622
+ problemsHighlightedRow,
15608
15623
  scrollBarDiagnostics,
15609
15624
  selectionInfos,
15610
15625
  textInfos,
@@ -15810,10 +15825,10 @@ const renderLines = {
15810
15825
  visibleLineIndices,
15811
15826
  visibleViewLineIndices
15812
15827
  } = newState;
15813
- const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices);
15828
+ const dom = getEditorRowsVirtualDom$1(textInfos, differences, true, highlightedLine, visibleLineIndices, endOfLineDecorations, visibleViewLineIndices, newState.problemsHighlightedRow);
15814
15829
  return [/* method */'setText', dom];
15815
15830
  },
15816
- isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.debugEnabled === newState.debugEnabled
15831
+ isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
15817
15832
  };
15818
15833
  const renderSelections = {
15819
15834
  apply: (oldState, newState) => {
@@ -16004,6 +16019,21 @@ const renderEventListeners = () => {
16004
16019
  }];
16005
16020
  };
16006
16021
 
16022
+ const revealProblem = (editor, rowIndex, columnIndex) => {
16023
+ if (!Number.isSafeInteger(rowIndex) || !Number.isSafeInteger(columnIndex)) {
16024
+ return editor;
16025
+ }
16026
+ const row = Math.max(0, Math.min(rowIndex, editor.lines.length - 1));
16027
+ const column = Math.max(0, Math.min(columnIndex, editor.lines[row]?.length ?? 0));
16028
+ const foldingRanges = editor.foldingRanges.filter(range => row <= range.start || row > range.end);
16029
+ const unfolded = foldingRanges.length === editor.foldingRanges.length ? editor : updateLayout(editor, foldingRanges);
16030
+ return {
16031
+ ...cursorSet(unfolded, row, column),
16032
+ focused: false,
16033
+ problemsHighlightedRow: row
16034
+ };
16035
+ };
16036
+
16007
16037
  const saveState = (state, savedState) => {
16008
16038
  const {
16009
16039
  lines,
@@ -16577,6 +16607,7 @@ const commandMap = {
16577
16607
  'Editor.replaceRange': wrapCommand(replaceRange),
16578
16608
  'Editor.rerender': wrapCommand(rerender),
16579
16609
  'Editor.resize': wrapCommand(resize),
16610
+ 'Editor.revealProblem': wrapCommand(revealProblem),
16580
16611
  'Editor.save': wrapCommand(save),
16581
16612
  'Editor.saveState': wrapGetter(saveState),
16582
16613
  'Editor.scrollByLines': wrapCommand(scrollByLines),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.59.2",
3
+ "version": "19.60.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"