@lvce-editor/editor-worker 19.44.0 → 19.45.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 +23 -9
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -14809,11 +14809,17 @@ const getEditorContentVirtualDom = ({
|
|
|
14809
14809
|
return [editorContentNode, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom()];
|
|
14810
14810
|
};
|
|
14811
14811
|
|
|
14812
|
-
const getGutterInfoVirtualDom = gutterInfo => {
|
|
14812
|
+
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
14813
14813
|
const isBreakpoint = typeof gutterInfo === 'object' && gutterInfo.isBreakpoint;
|
|
14814
14814
|
const isLightBulb = typeof gutterInfo === 'object' && gutterInfo.isLightBulb;
|
|
14815
14815
|
const lineNumber = typeof gutterInfo === 'object' ? gutterInfo.lineNumber : gutterInfo;
|
|
14816
14816
|
const label = isLightBulb ? `Show Code Actions on line ${lineNumber}` : `Breakpoint on line ${lineNumber}`;
|
|
14817
|
+
let className = lineNumber === activeLineNumber ? 'LineNumber LineNumberActive' : 'LineNumber';
|
|
14818
|
+
if (isLightBulb) {
|
|
14819
|
+
className += ' LineNumberLightBulb MaskIconLightBulb';
|
|
14820
|
+
} else if (isBreakpoint) {
|
|
14821
|
+
className += ' LineNumberBreakpoint';
|
|
14822
|
+
}
|
|
14817
14823
|
return [{
|
|
14818
14824
|
...((isBreakpoint || isLightBulb) && {
|
|
14819
14825
|
ariaLabel: label,
|
|
@@ -14823,7 +14829,7 @@ const getGutterInfoVirtualDom = gutterInfo => {
|
|
|
14823
14829
|
style: 'color:var(--DebugIconBreakpointForeground,#e51400)'
|
|
14824
14830
|
}),
|
|
14825
14831
|
childCount: 1,
|
|
14826
|
-
className
|
|
14832
|
+
className,
|
|
14827
14833
|
...(isLightBulb && {
|
|
14828
14834
|
onClick: HandleLightBulbClick,
|
|
14829
14835
|
role: Button
|
|
@@ -14831,13 +14837,13 @@ const getGutterInfoVirtualDom = gutterInfo => {
|
|
|
14831
14837
|
type: Span
|
|
14832
14838
|
}, text(isLightBulb ? '' : isBreakpoint ? '●' : lineNumber)];
|
|
14833
14839
|
};
|
|
14834
|
-
const getEditorGutterVirtualDom$1 = gutterInfos => {
|
|
14835
|
-
const dom = gutterInfos.flatMap(getGutterInfoVirtualDom);
|
|
14840
|
+
const getEditorGutterVirtualDom$1 = (gutterInfos, activeLineNumber = -1) => {
|
|
14841
|
+
const dom = gutterInfos.flatMap(gutterInfo => getGutterInfoVirtualDom(gutterInfo, activeLineNumber));
|
|
14836
14842
|
return dom;
|
|
14837
14843
|
};
|
|
14838
14844
|
|
|
14839
|
-
const getEditorGutterVirtualDom = gutterInfos => {
|
|
14840
|
-
const gutterDom = getEditorGutterVirtualDom$1([...gutterInfos]);
|
|
14845
|
+
const getEditorGutterVirtualDom = (gutterInfos, activeLineNumber = -1) => {
|
|
14846
|
+
const gutterDom = getEditorGutterVirtualDom$1([...gutterInfos], activeLineNumber);
|
|
14841
14847
|
return [{
|
|
14842
14848
|
childCount: gutterInfos.length,
|
|
14843
14849
|
className: 'Gutter',
|
|
@@ -14872,6 +14878,10 @@ const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true,
|
|
|
14872
14878
|
return gutterInfos;
|
|
14873
14879
|
};
|
|
14874
14880
|
|
|
14881
|
+
const getPrimaryCursorRowIndex = (selections, primarySelectionIndex = 0) => {
|
|
14882
|
+
return selections?.[primarySelectionIndex + 2] ?? -1;
|
|
14883
|
+
};
|
|
14884
|
+
|
|
14875
14885
|
const textEditorErrorIconNode = {
|
|
14876
14886
|
childCount: 0,
|
|
14877
14887
|
className: mergeClassNames('EditorTextIcon', 'EditorTextIconError', 'MaskIcon', 'MaskIconError'),
|
|
@@ -14935,7 +14945,8 @@ const getEditorVirtualDom = ({
|
|
|
14935
14945
|
}
|
|
14936
14946
|
const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex) : gutterInfos;
|
|
14937
14947
|
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0;
|
|
14938
|
-
const
|
|
14948
|
+
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
14949
|
+
const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos, primaryCursorRowIndex + 1) : [];
|
|
14939
14950
|
const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY);
|
|
14940
14951
|
const breadcrumbsDom = breadcrumbsEnabled ? getEditorBreadcrumbsVirtualDom({
|
|
14941
14952
|
breadcrumbsEnabled,
|
|
@@ -15203,16 +15214,19 @@ const renderGutterInfo = {
|
|
|
15203
15214
|
lineNumbers,
|
|
15204
15215
|
maxLineY,
|
|
15205
15216
|
minLineY,
|
|
15217
|
+
primarySelectionIndex,
|
|
15218
|
+
selections,
|
|
15206
15219
|
visibleLineIndices
|
|
15207
15220
|
} = newState;
|
|
15208
15221
|
if (!lineNumbers && breakPoints.length === 0 && lightBulbRowIndex === -1) {
|
|
15209
15222
|
return ['renderGutter', []];
|
|
15210
15223
|
}
|
|
15211
15224
|
const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex);
|
|
15212
|
-
const
|
|
15225
|
+
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
15226
|
+
const dom = getEditorGutterVirtualDom$1(gutterInfos, primaryCursorRowIndex + 1);
|
|
15213
15227
|
return ['renderGutter', dom];
|
|
15214
15228
|
},
|
|
15215
|
-
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
15229
|
+
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY && getPrimaryCursorRowIndex(oldState.selections, oldState.primarySelectionIndex) === getPrimaryCursorRowIndex(newState.selections, newState.primarySelectionIndex)
|
|
15216
15230
|
};
|
|
15217
15231
|
const renderWidgets = {
|
|
15218
15232
|
apply: renderWidgets$1,
|