@lvce-editor/editor-worker 19.78.14 → 19.78.15

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/diff-sdk.js CHANGED
@@ -2823,6 +2823,14 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
2823
2823
  };
2824
2824
  };
2825
2825
 
2826
+ const isDefaultPlainText = editor => {
2827
+ const tokenizePath = getTokenizePath$1(editor.languageId);
2828
+ // The bundled plaintext extension has the same state-free Text token as the
2829
+ // fallback. Only its exact application asset URI may bypass the worker.
2830
+ const builtinPath = editor.assetDir ? `${editor.assetDir}/extensions/builtin.language-basics-plaintext/src/tokenizePlaintext.js` : undefined;
2831
+ return editor.languageId === 'plaintext' && (!tokenizePath || tokenizePath === builtinPath) && get$6(editor.tokenizerId) === TokenizePlainText;
2832
+ };
2833
+
2826
2834
  const normalizeLine = line => {
2827
2835
  if (line.startsWith('Error: ')) {
2828
2836
  return line.slice('Error: '.length);
@@ -10854,6 +10862,20 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
10854
10862
  tokens: []
10855
10863
  };
10856
10864
  }
10865
+ if (isDefaultPlainText(editor)) {
10866
+ // Plain text has no continuation state. If a contributed tokenizer is loaded
10867
+ // later, it must receive all lines and rebuild its own state from the start.
10868
+ editor.invalidStartIndex = 0;
10869
+ editor.lineCache = [];
10870
+ if (editor.lifecycle) {
10871
+ delete editor.lifecycle.sentLines;
10872
+ }
10873
+ return {
10874
+ embeddedResults: [],
10875
+ tokenizersToLoad: [],
10876
+ tokens: editor.lines.slice(start, end).map(line => tokenizeLine(line, initialLineState))
10877
+ };
10878
+ }
10857
10879
  // Preserve the original request/disposal ordering when caching is disabled.
10858
10880
  if (editor.syntaxHighlightingCacheEnabled !== true) {
10859
10881
  return getFreshTokensViewport(editor, start, end, syncIncremental);
@@ -11708,6 +11730,15 @@ const getIncrementalEdits = async (oldState, newState) => {
11708
11730
  if (newState.deltaX !== 0 || oldLine.length > threshold || newLine.length > threshold) {
11709
11731
  return emptyIncrementalEdits;
11710
11732
  }
11733
+ if (isDefaultPlainText(newState)) {
11734
+ // Match the worker's single Text-token edit, keeping visible-text work
11735
+ // in the same phase as syntax-worker incremental responses.
11736
+ return oldLine.length === newLine.length ? emptyIncrementalEdits : [{
11737
+ columnIndex: 0,
11738
+ rowIndex: rowIndex - newState.minLineY,
11739
+ text: newLine
11740
+ }];
11741
+ }
11711
11742
  // @ts-ignore
11712
11743
  const incrementalEdits = await invoke$c(
11713
11744
  // @ts-ignore
@@ -15046,7 +15077,7 @@ const isEqual$5 = (oldState, newState) => {
15046
15077
  };
15047
15078
 
15048
15079
  const isEqual$4 = (oldState, newState) => {
15049
- return oldState.rowHeight === newState.rowHeight && oldState.textDecorations === newState.textDecorations && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
15080
+ return oldState.rowHeight === newState.rowHeight && oldState.textDecorations === newState.textDecorations && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.gutterWidth === newState.gutterWidth && oldState.scrollBarHeight === newState.scrollBarHeight;
15050
15081
  };
15051
15082
 
15052
15083
  const isEqual$3 = (oldState, newState) => {
@@ -15063,7 +15094,7 @@ const isEqual$3 = (oldState, newState) => {
15063
15094
  };
15064
15095
 
15065
15096
  const isEqual$2 = (oldState, newState) => {
15066
- return oldState.textDecorationDom === newState.textDecorationDom && oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && 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.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
15097
+ return oldState.textDecorationDom === newState.textDecorationDom && oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && 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.scrollBarHeight === newState.scrollBarHeight && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
15067
15098
  };
15068
15099
 
15069
15100
  const isEqual$1 = (oldState, newState) => {
@@ -24670,28 +24701,31 @@ ${editorSelector} .ScrollBarThumbHorizontal {
24670
24701
  `;
24671
24702
  };
24672
24703
 
24673
- const renderCss$1 = (oldState, newState) => {
24704
+ const renderCss$1 = (oldState, newState, horizontalThumbInDom = true) => {
24674
24705
  const {
24675
- deltaX,
24676
24706
  deltaY,
24677
24707
  finalDeltaY,
24678
24708
  gutterWidth,
24679
24709
  height,
24680
- longestLineWidth,
24681
- minimumSliderSize,
24682
24710
  rowHeight,
24683
24711
  scrollBarHeight,
24684
24712
  uid
24685
24713
  } = newState;
24686
- const {
24687
- width
24688
- } = getHorizontalScrollDimensions(newState);
24689
24714
  const scrollBarTop = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
24690
- const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
24691
- const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
24715
+ let scrollBarWidth = 0;
24716
+ let scrollBarLeft = 0;
24717
+ if (!horizontalThumbInDom) {
24718
+ const {
24719
+ width
24720
+ } = getHorizontalScrollDimensions(newState);
24721
+ scrollBarWidth = getScrollBarSize(width, newState.longestLineWidth, newState.minimumSliderSize);
24722
+ scrollBarLeft = getScrollBarOffset(newState.deltaX, Math.max(0, newState.longestLineWidth - width), width, scrollBarWidth);
24723
+ }
24692
24724
  const decorationCss = (newState.textDecorations || []).map(({
24693
24725
  color
24694
24726
  }, index) => `.Editor[data-uid="${uid}"] .EditorTextDecoration${index} { background-color: ${color}; }`).join('\n');
24727
+ // Horizontal thumb geometry is patched on the thumb itself. Keep the
24728
+ // editor stylesheet stable while typing into an overflowing line.
24695
24729
  const css = decorationCss + getCss(uid, rowHeight, scrollBarHeight, scrollBarTop, scrollBarWidth, scrollBarLeft, deltaY);
24696
24730
  return [SetCss$1, uid, gutterWidth ? `${css}\n.Editor[data-uid="${uid}"] .Gutter { width: ${gutterWidth}px; }\n` : css];
24697
24731
  };
@@ -25365,7 +25399,7 @@ const horizontalScrollBarThumbNode = {
25365
25399
  className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbHorizontal'),
25366
25400
  type: Div
25367
25401
  };
25368
- const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth) => {
25402
+ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth, scrollBarLeft = 0) => {
25369
25403
  const hasVerticalThumb = scrollBarHeight > 0;
25370
25404
  const hasHorizontalThumb = scrollBarWidth > 0;
25371
25405
  return [{
@@ -25374,7 +25408,10 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth) => {
25374
25408
  }, ...(hasVerticalThumb ? [verticalScrollBarThumbNode] : []), {
25375
25409
  ...horizontalScrollBarNode,
25376
25410
  childCount: hasHorizontalThumb ? 1 : 0
25377
- }, ...(hasHorizontalThumb ? [horizontalScrollBarThumbNode] : [])];
25411
+ }, ...(hasHorizontalThumb ? [{
25412
+ ...horizontalScrollBarThumbNode,
25413
+ style: `width:${scrollBarWidth}px;translate:${scrollBarLeft}px 0px`
25414
+ }] : [])];
25378
25415
  };
25379
25416
 
25380
25417
  const editorContentNode = {
@@ -25402,6 +25439,7 @@ const getEditorContentVirtualDom = ({
25402
25439
  rtl = false,
25403
25440
  scrollBarDiagnostics = [],
25404
25441
  scrollBarHeight = 0,
25442
+ scrollBarLeft = 0,
25405
25443
  scrollBarWidth = 0,
25406
25444
  selectionInfos = [],
25407
25445
  tabSize = 2,
@@ -25414,7 +25452,7 @@ const getEditorContentVirtualDom = ({
25414
25452
  return [{
25415
25453
  ...editorContentNode,
25416
25454
  className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
25417
- }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth)];
25455
+ }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
25418
25456
  };
25419
25457
 
25420
25458
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -25598,6 +25636,7 @@ const getEditorVirtualDom = ({
25598
25636
  }, {
25599
25637
  diagnostics = fallbackDiagnostics,
25600
25638
  scrollBarDiagnostics = fallbackScrollBarDiagnostics,
25639
+ scrollBarLeft = 0,
25601
25640
  scrollBarWidth = fallbackScrollBarWidth,
25602
25641
  unnecessaryDiagnostics = fallbackUnnecessaryDiagnostics
25603
25642
  } = {}) => {
@@ -25653,6 +25692,7 @@ const getEditorVirtualDom = ({
25653
25692
  rtl,
25654
25693
  scrollBarDiagnostics,
25655
25694
  scrollBarHeight,
25695
+ scrollBarLeft,
25656
25696
  scrollBarWidth,
25657
25697
  selectionInfos,
25658
25698
  tabSize,
@@ -25764,7 +25804,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
25764
25804
  if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
25765
25805
  return false;
25766
25806
  }
25767
- if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(oldState.width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(newState.width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
25807
+ if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
25768
25808
  return false;
25769
25809
  }
25770
25810
  return true;
@@ -25822,6 +25862,7 @@ const updateTextAppendDom = (oldDom, state, paths) => {
25822
25862
 
25823
25863
  const getDom = state => {
25824
25864
  const {
25865
+ deltaX = 0,
25825
25866
  diagnostics = [],
25826
25867
  initial,
25827
25868
  longestLineWidth,
@@ -25835,10 +25876,13 @@ const getDom = state => {
25835
25876
  const {
25836
25877
  width
25837
25878
  } = getHorizontalScrollDimensions(state);
25879
+ const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
25880
+ const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
25838
25881
  return getEditorVirtualDom(state, {
25839
25882
  diagnostics: visualDecorations,
25840
25883
  scrollBarDiagnostics: getScrollBarDiagnostics(state, diagnostics),
25841
- scrollBarWidth: getScrollBarSize(width, longestLineWidth, minimumSliderSize),
25884
+ scrollBarLeft,
25885
+ scrollBarWidth,
25842
25886
  unnecessaryDiagnostics: diagnostics
25843
25887
  });
25844
25888
  };
@@ -28029,8 +28073,8 @@ const renderSelections = {
28029
28073
  isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos && oldState.focused === newState.focused && oldState.roundedSelection === newState.roundedSelection
28030
28074
  };
28031
28075
  const renderCss = {
28032
- apply: renderCss$1,
28033
- isEqual: isEqual$4
28076
+ apply: (oldState, newState) => renderCss$1(oldState, newState, false),
28077
+ isEqual: (oldState, newState) => isEqual$4(oldState, newState) && oldState.deltaX === newState.deltaX && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width
28034
28078
  };
28035
28079
  const renderFocus$1 = {
28036
28080
  apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
@@ -4224,6 +4224,14 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
4224
4224
  };
4225
4225
  };
4226
4226
 
4227
+ const isDefaultPlainText = editor => {
4228
+ const tokenizePath = getTokenizePath$1(editor.languageId);
4229
+ // The bundled plaintext extension has the same state-free Text token as the
4230
+ // fallback. Only its exact application asset URI may bypass the worker.
4231
+ const builtinPath = editor.assetDir ? `${editor.assetDir}/extensions/builtin.language-basics-plaintext/src/tokenizePlaintext.js` : undefined;
4232
+ return editor.languageId === 'plaintext' && (!tokenizePath || tokenizePath === builtinPath) && get$5(editor.tokenizerId) === TokenizePlainText;
4233
+ };
4234
+
4227
4235
  const state$c = {};
4228
4236
  const create$a = () => create$g({
4229
4237
  commandMap: {},
@@ -11314,6 +11322,20 @@ const getTokensViewport2 = async (editor, start, end, syncIncremental) => {
11314
11322
  tokens: []
11315
11323
  };
11316
11324
  }
11325
+ if (isDefaultPlainText(editor)) {
11326
+ // Plain text has no continuation state. If a contributed tokenizer is loaded
11327
+ // later, it must receive all lines and rebuild its own state from the start.
11328
+ editor.invalidStartIndex = 0;
11329
+ editor.lineCache = [];
11330
+ if (editor.lifecycle) {
11331
+ delete editor.lifecycle.sentLines;
11332
+ }
11333
+ return {
11334
+ embeddedResults: [],
11335
+ tokenizersToLoad: [],
11336
+ tokens: editor.lines.slice(start, end).map(line => tokenizeLine(line, initialLineState))
11337
+ };
11338
+ }
11317
11339
  // Preserve the original request/disposal ordering when caching is disabled.
11318
11340
  if (editor.syntaxHighlightingCacheEnabled !== true) {
11319
11341
  return getFreshTokensViewport(editor, start, end, syncIncremental);
@@ -12168,6 +12190,15 @@ const getIncrementalEdits = async (oldState, newState) => {
12168
12190
  if (newState.deltaX !== 0 || oldLine.length > threshold || newLine.length > threshold) {
12169
12191
  return emptyIncrementalEdits;
12170
12192
  }
12193
+ if (isDefaultPlainText(newState)) {
12194
+ // Match the worker's single Text-token edit, keeping visible-text work
12195
+ // in the same phase as syntax-worker incremental responses.
12196
+ return oldLine.length === newLine.length ? emptyIncrementalEdits : [{
12197
+ columnIndex: 0,
12198
+ rowIndex: rowIndex - newState.minLineY,
12199
+ text: newLine
12200
+ }];
12201
+ }
12171
12202
  // @ts-ignore
12172
12203
  const incrementalEdits = await invoke$c(
12173
12204
  // @ts-ignore
@@ -15506,7 +15537,7 @@ const isEqual$5 = (oldState, newState) => {
15506
15537
  };
15507
15538
 
15508
15539
  const isEqual$4 = (oldState, newState) => {
15509
- return oldState.rowHeight === newState.rowHeight && oldState.textDecorations === newState.textDecorations && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
15540
+ return oldState.rowHeight === newState.rowHeight && oldState.textDecorations === newState.textDecorations && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.gutterWidth === newState.gutterWidth && oldState.scrollBarHeight === newState.scrollBarHeight;
15510
15541
  };
15511
15542
 
15512
15543
  const isEqual$3 = (oldState, newState) => {
@@ -15523,7 +15554,7 @@ const isEqual$3 = (oldState, newState) => {
15523
15554
  };
15524
15555
 
15525
15556
  const isEqual$2 = (oldState, newState) => {
15526
- return oldState.textDecorationDom === newState.textDecorationDom && oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && 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.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
15557
+ return oldState.textDecorationDom === newState.textDecorationDom && oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && 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.scrollBarHeight === newState.scrollBarHeight && oldState.deltaX === newState.deltaX && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
15527
15558
  };
15528
15559
 
15529
15560
  const isEqual$1 = (oldState, newState) => {
@@ -25121,28 +25152,31 @@ ${editorSelector} .ScrollBarThumbHorizontal {
25121
25152
  `;
25122
25153
  };
25123
25154
 
25124
- const renderCss$1 = (oldState, newState) => {
25155
+ const renderCss$1 = (oldState, newState, horizontalThumbInDom = true) => {
25125
25156
  const {
25126
- deltaX,
25127
25157
  deltaY,
25128
25158
  finalDeltaY,
25129
25159
  gutterWidth,
25130
25160
  height,
25131
- longestLineWidth,
25132
- minimumSliderSize,
25133
25161
  rowHeight,
25134
25162
  scrollBarHeight,
25135
25163
  uid
25136
25164
  } = newState;
25137
- const {
25138
- width
25139
- } = getHorizontalScrollDimensions(newState);
25140
25165
  const scrollBarTop = getScrollBarY(deltaY, finalDeltaY, height, scrollBarHeight);
25141
- const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
25142
- const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
25166
+ let scrollBarWidth = 0;
25167
+ let scrollBarLeft = 0;
25168
+ if (!horizontalThumbInDom) {
25169
+ const {
25170
+ width
25171
+ } = getHorizontalScrollDimensions(newState);
25172
+ scrollBarWidth = getScrollBarSize(width, newState.longestLineWidth, newState.minimumSliderSize);
25173
+ scrollBarLeft = getScrollBarOffset(newState.deltaX, Math.max(0, newState.longestLineWidth - width), width, scrollBarWidth);
25174
+ }
25143
25175
  const decorationCss = (newState.textDecorations || []).map(({
25144
25176
  color
25145
25177
  }, index) => `.Editor[data-uid="${uid}"] .EditorTextDecoration${index} { background-color: ${color}; }`).join('\n');
25178
+ // Horizontal thumb geometry is patched on the thumb itself. Keep the
25179
+ // editor stylesheet stable while typing into an overflowing line.
25146
25180
  const css = decorationCss + getCss(uid, rowHeight, scrollBarHeight, scrollBarTop, scrollBarWidth, scrollBarLeft, deltaY);
25147
25181
  return [SetCss$1, uid, gutterWidth ? `${css}\n.Editor[data-uid="${uid}"] .Gutter { width: ${gutterWidth}px; }\n` : css];
25148
25182
  };
@@ -25816,7 +25850,7 @@ const horizontalScrollBarThumbNode = {
25816
25850
  className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbHorizontal'),
25817
25851
  type: Div
25818
25852
  };
25819
- const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth) => {
25853
+ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth, scrollBarLeft = 0) => {
25820
25854
  const hasVerticalThumb = scrollBarHeight > 0;
25821
25855
  const hasHorizontalThumb = scrollBarWidth > 0;
25822
25856
  return [{
@@ -25825,7 +25859,10 @@ const getScrollBarVirtualDom = (scrollBarHeight, scrollBarWidth) => {
25825
25859
  }, ...(hasVerticalThumb ? [verticalScrollBarThumbNode] : []), {
25826
25860
  ...horizontalScrollBarNode,
25827
25861
  childCount: hasHorizontalThumb ? 1 : 0
25828
- }, ...(hasHorizontalThumb ? [horizontalScrollBarThumbNode] : [])];
25862
+ }, ...(hasHorizontalThumb ? [{
25863
+ ...horizontalScrollBarThumbNode,
25864
+ style: `width:${scrollBarWidth}px;translate:${scrollBarLeft}px 0px`
25865
+ }] : [])];
25829
25866
  };
25830
25867
 
25831
25868
  const editorContentNode = {
@@ -25853,6 +25890,7 @@ const getEditorContentVirtualDom = ({
25853
25890
  rtl = false,
25854
25891
  scrollBarDiagnostics = [],
25855
25892
  scrollBarHeight = 0,
25893
+ scrollBarLeft = 0,
25856
25894
  scrollBarWidth = 0,
25857
25895
  selectionInfos = [],
25858
25896
  tabSize = 2,
@@ -25865,7 +25903,7 @@ const getEditorContentVirtualDom = ({
25865
25903
  return [{
25866
25904
  ...editorContentNode,
25867
25905
  className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
25868
- }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth)];
25906
+ }, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, lineNumbers, highlightedLine, cursorInfos, diagnostics, visibleLineIndices, endOfLineDecorations, bracketMatchInfos, focused, visibleViewLineIndices, problemsHighlightedRow, roundedSelection, unnecessaryDiagnostics, horizontalVisibleRanges, lines, tabSize, textDecorationDom, rtl), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
25869
25907
  };
25870
25908
 
25871
25909
  const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
@@ -26049,6 +26087,7 @@ const getEditorVirtualDom = ({
26049
26087
  }, {
26050
26088
  diagnostics = fallbackDiagnostics,
26051
26089
  scrollBarDiagnostics = fallbackScrollBarDiagnostics,
26090
+ scrollBarLeft = 0,
26052
26091
  scrollBarWidth = fallbackScrollBarWidth,
26053
26092
  unnecessaryDiagnostics = fallbackUnnecessaryDiagnostics
26054
26093
  } = {}) => {
@@ -26104,6 +26143,7 @@ const getEditorVirtualDom = ({
26104
26143
  rtl,
26105
26144
  scrollBarDiagnostics,
26106
26145
  scrollBarHeight,
26146
+ scrollBarLeft,
26107
26147
  scrollBarWidth,
26108
26148
  selectionInfos,
26109
26149
  tabSize,
@@ -26215,7 +26255,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
26215
26255
  if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
26216
26256
  return false;
26217
26257
  }
26218
- if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(oldState.width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(newState.width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
26258
+ if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
26219
26259
  return false;
26220
26260
  }
26221
26261
  return true;
@@ -26273,6 +26313,7 @@ const updateTextAppendDom = (oldDom, state, paths) => {
26273
26313
 
26274
26314
  const getDom = state => {
26275
26315
  const {
26316
+ deltaX = 0,
26276
26317
  diagnostics = [],
26277
26318
  initial,
26278
26319
  longestLineWidth,
@@ -26286,10 +26327,13 @@ const getDom = state => {
26286
26327
  const {
26287
26328
  width
26288
26329
  } = getHorizontalScrollDimensions(state);
26330
+ const scrollBarWidth = getScrollBarSize(width, longestLineWidth, minimumSliderSize);
26331
+ const scrollBarLeft = getScrollBarOffset(deltaX, Math.max(0, longestLineWidth - width), width, scrollBarWidth);
26289
26332
  return getEditorVirtualDom(state, {
26290
26333
  diagnostics: visualDecorations,
26291
26334
  scrollBarDiagnostics: getScrollBarDiagnostics(state, diagnostics),
26292
- scrollBarWidth: getScrollBarSize(width, longestLineWidth, minimumSliderSize),
26335
+ scrollBarLeft,
26336
+ scrollBarWidth,
26293
26337
  unnecessaryDiagnostics: diagnostics
26294
26338
  });
26295
26339
  };
@@ -28480,8 +28524,8 @@ const renderSelections = {
28480
28524
  isEqual: (oldState, newState) => oldState.cursorInfos === newState.cursorInfos && oldState.selectionInfos === newState.selectionInfos && oldState.focused === newState.focused && oldState.roundedSelection === newState.roundedSelection
28481
28525
  };
28482
28526
  const renderCss = {
28483
- apply: renderCss$1,
28484
- isEqual: isEqual$4
28527
+ apply: (oldState, newState) => renderCss$1(oldState, newState, false),
28528
+ isEqual: (oldState, newState) => isEqual$4(oldState, newState) && oldState.deltaX === newState.deltaX && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width
28485
28529
  };
28486
28530
  const renderFocus$1 = {
28487
28531
  apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.78.14",
3
+ "version": "19.78.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"