@pierre/diffs 1.3.0 → 1.3.2

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.
Files changed (76) hide show
  1. package/dist/components/CodeView.d.ts +4 -1
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +60 -26
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts +1 -0
  6. package/dist/components/File.d.ts.map +1 -1
  7. package/dist/components/File.js +18 -9
  8. package/dist/components/File.js.map +1 -1
  9. package/dist/components/FileDiff.d.ts +4 -0
  10. package/dist/components/FileDiff.d.ts.map +1 -1
  11. package/dist/components/FileDiff.js +48 -21
  12. package/dist/components/FileDiff.js.map +1 -1
  13. package/dist/components/VirtualizedFile.d.ts +1 -0
  14. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  15. package/dist/components/VirtualizedFile.js +3 -0
  16. package/dist/components/VirtualizedFile.js.map +1 -1
  17. package/dist/components/VirtualizedFileDiff.d.ts +1 -0
  18. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  19. package/dist/components/VirtualizedFileDiff.js +3 -0
  20. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  21. package/dist/edit/index.d.ts +4 -3
  22. package/dist/editor/command.d.ts +10 -2
  23. package/dist/editor/command.d.ts.map +1 -1
  24. package/dist/editor/command.js +113 -39
  25. package/dist/editor/command.js.map +1 -1
  26. package/dist/editor/editStack.d.ts +2 -2
  27. package/dist/editor/editStack.d.ts.map +1 -1
  28. package/dist/editor/editStack.js.map +1 -1
  29. package/dist/editor/editor.d.ts +5 -2
  30. package/dist/editor/editor.d.ts.map +1 -1
  31. package/dist/editor/editor.js +49 -29
  32. package/dist/editor/editor.js.map +1 -1
  33. package/dist/editor/pieceTable.d.ts +1 -2
  34. package/dist/editor/pieceTable.d.ts.map +1 -1
  35. package/dist/editor/pieceTable.js.map +1 -1
  36. package/dist/editor/platform.d.ts +3 -11
  37. package/dist/editor/platform.d.ts.map +1 -1
  38. package/dist/editor/platform.js +2 -28
  39. package/dist/editor/platform.js.map +1 -1
  40. package/dist/editor/searchPanel.d.ts +2 -1
  41. package/dist/editor/searchPanel.d.ts.map +1 -1
  42. package/dist/editor/searchPanel.js.map +1 -1
  43. package/dist/editor/selection.d.ts +2 -2
  44. package/dist/editor/selection.d.ts.map +1 -1
  45. package/dist/editor/selection.js.map +1 -1
  46. package/dist/editor/selectionAction.d.ts +2 -1
  47. package/dist/editor/selectionAction.d.ts.map +1 -1
  48. package/dist/editor/selectionAction.js +3 -1
  49. package/dist/editor/selectionAction.js.map +1 -1
  50. package/dist/editor/textDocument.d.ts +4 -14
  51. package/dist/editor/textDocument.d.ts.map +1 -1
  52. package/dist/editor/textDocument.js +7 -0
  53. package/dist/editor/textDocument.js.map +1 -1
  54. package/dist/index.d.ts +2 -2
  55. package/dist/react/CodeView.d.ts +1 -0
  56. package/dist/react/CodeView.d.ts.map +1 -1
  57. package/dist/react/CodeView.js +9 -0
  58. package/dist/react/CodeView.js.map +1 -1
  59. package/dist/react/index.d.ts +2 -2
  60. package/dist/ssr/index.d.ts +2 -2
  61. package/dist/types.d.ts +22 -2
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/utils/areManagedSnapshotsEqual.js +1 -1
  64. package/dist/utils/areManagedSnapshotsEqual.js.map +1 -1
  65. package/dist/utils/guardWebKitScrollDuringRebuild.d.ts +20 -0
  66. package/dist/utils/guardWebKitScrollDuringRebuild.d.ts.map +1 -0
  67. package/dist/utils/guardWebKitScrollDuringRebuild.js +34 -0
  68. package/dist/utils/guardWebKitScrollDuringRebuild.js.map +1 -0
  69. package/dist/utils/platform.d.ts +14 -0
  70. package/dist/utils/platform.d.ts.map +1 -0
  71. package/dist/utils/platform.js +32 -0
  72. package/dist/utils/platform.js.map +1 -0
  73. package/dist/worker/wasm-B9ZqxnKj.js.map +1 -1
  74. package/dist/worker/worker-portable.js +13 -12
  75. package/dist/worker/worker-portable.js.map +1 -1
  76. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"selectionAction.js","names":["#root","#height","#resizeObserver"],"sources":["../../src/editor/selectionAction.ts"],"sourcesContent":["import type { EditorSelection, TextEdit } from '../types';\nimport {\n type PopoverViewportBounds,\n setPopoverPositionStyles,\n} from './popover';\nimport type { TextDocument } from './textDocument';\nimport { h } from './utils';\n\nexport interface SelectionActionContext<LAnnotation> {\n /** The current selection (live: reflects keyboard-driven changes). */\n selection: EditorSelection;\n /** The text document. */\n textDocument: TextDocument<LAnnotation>;\n /** Applies the edits to the text document. */\n applyEdits: (edits: TextEdit[]) => void;\n /** Gets the text of the current selection. */\n getSelectionText: () => string;\n /** Replaces the text of the current selection. */\n replaceSelectionText: (text: string) => void;\n /** Closes the selection action. */\n close: () => void;\n}\n\n/**\n * Selection action widget.\n */\nexport class SelectionActionWidget {\n #root: HTMLElement;\n // Cached border-box height, refreshed only when the popover's own size\n // actually changes (via #resizeObserver below)\n #height: number;\n #resizeObserver: ResizeObserver;\n\n constructor(\n selectionActionElement: HTMLElement,\n overlayElement: HTMLElement,\n onHeightChange: () => void\n ) {\n this.#root = h(\n 'div',\n {\n dataset: { editorWidget: '', selectionActionPopover: '' },\n contentEditable: 'false',\n children: [selectionActionElement],\n },\n overlayElement\n );\n this.#height = this.#root.offsetHeight;\n this.#resizeObserver = new ResizeObserver(() => {\n const height = this.#root.offsetHeight;\n if (height !== this.#height) {\n this.#height = height;\n onHeightChange();\n }\n });\n this.#resizeObserver.observe(this.#root);\n }\n\n /**\n * Repositions the selection action widget.\n * @param left - The left position of the selection action widget.\n * @param top - The top position of the selection action widget.\n * @param gutterWidth - The width of the gutter.\n * @param placeAbove - Whether the selection action widget should be placed above the anchor.\n */\n reposition(\n left: number,\n top: number,\n gutterWidth: number,\n placeAbove: boolean,\n viewport?: PopoverViewportBounds\n ): void {\n setPopoverPositionStyles(this.#root, {\n gutterWidth,\n placeAbove,\n viewport,\n x: left,\n y: top,\n });\n }\n\n /**\n * Gets the height of the selection action widget.\n * @returns The height of the selection action widget.\n */\n get height(): number {\n return this.#height;\n }\n\n /**\n * Cleans up the selection action widget.\n */\n cleanup(): void {\n this.#resizeObserver.disconnect();\n this.#root.remove();\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAa,wBAAb,MAAmC;CACjC;CAGA;CACA;CAEA,YACE,wBACA,gBACA,gBACA;EACA,KAAKA,QAAQ,EACX,OACA;GACE,SAAS;IAAE,cAAc;IAAI,wBAAwB;GAAG;GACxD,iBAAiB;GACjB,UAAU,CAAC,sBAAsB;EACnC,GACA,cACF;EACA,KAAKC,UAAU,KAAKD,MAAM;EAC1B,KAAKE,kBAAkB,IAAI,qBAAqB;GAC9C,MAAM,SAAS,KAAKF,MAAM;GAC1B,IAAI,WAAW,KAAKC,SAAS;IAC3B,KAAKA,UAAU;IACf,eAAe;GACjB;EACF,CAAC;EACD,KAAKC,gBAAgB,QAAQ,KAAKF,KAAK;CACzC;;;;;;;;CASA,WACE,MACA,KACA,aACA,YACA,UACM;EACN,yBAAyB,KAAKA,OAAO;GACnC;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL,CAAC;CACH;;;;;CAMA,IAAI,SAAiB;EACnB,OAAO,KAAKC;CACd;;;;CAKA,UAAgB;EACd,KAAKC,gBAAgB,WAAW;EAChC,KAAKF,MAAM,OAAO;CACpB;AACF"}
1
+ {"version":3,"file":"selectionAction.js","names":["#root","#height","#resizeObserver"],"sources":["../../src/editor/selectionAction.ts"],"sourcesContent":["import type { EditorSelection, TextEdit } from '../types';\nimport {\n type PopoverViewportBounds,\n setPopoverPositionStyles,\n} from './popover';\nimport type { TextDocument } from './textDocument';\nimport { h } from './utils';\n\nexport interface SelectionActionContext<LAnnotation> {\n /** The current selection (live: reflects keyboard-driven changes). */\n selection: EditorSelection;\n /** The text document. */\n textDocument: TextDocument<LAnnotation>;\n /** Applies the edits to the text document. */\n applyEdits: (edits: TextEdit[]) => void;\n /** Gets the text of the current selection. */\n getSelectionText: () => string;\n /** Replaces the text of the current selection. */\n replaceSelectionText: (text: string) => void;\n /** Closes the selection action. */\n close: () => void;\n}\n\n/**\n * Selection action widget.\n */\nexport class SelectionActionWidget {\n #root: HTMLElement;\n // Cached border-box height, refreshed only when the popover's own size\n // actually changes (via #resizeObserver below)\n #height: number;\n #resizeObserver: ResizeObserver;\n\n constructor(\n selectionActionElement: HTMLElement,\n overlayElement: HTMLElement,\n onHeightChange: () => void\n ) {\n this.#root = h(\n 'div',\n {\n dataset: { editorWidget: '', selectionActionPopover: '' },\n contentEditable: 'false',\n children: [selectionActionElement],\n },\n overlayElement\n );\n this.#height = this.#root.offsetHeight;\n this.#resizeObserver = new ResizeObserver(() => {\n const height = this.#root.offsetHeight;\n if (height !== this.#height) {\n this.#height = height;\n onHeightChange();\n }\n });\n this.#resizeObserver.observe(this.#root);\n }\n\n /**\n * Repositions the selection action widget.\n * @param left - The left position of the selection action widget.\n * @param top - The top position of the selection action widget.\n * @param gutterWidth - The width of the gutter.\n * @param placeAbove - Whether the selection action widget should be placed above the anchor.\n * @param visible - Whether the selection intersects the viewport.\n */\n reposition(\n left: number,\n top: number,\n gutterWidth: number,\n placeAbove: boolean,\n visible: boolean,\n viewport?: PopoverViewportBounds\n ): void {\n this.#root.style.visibility = visible ? '' : 'hidden';\n setPopoverPositionStyles(this.#root, {\n gutterWidth,\n placeAbove,\n viewport,\n x: left,\n y: top,\n });\n }\n\n /**\n * Gets the height of the selection action widget.\n * @returns The height of the selection action widget.\n */\n get height(): number {\n return this.#height;\n }\n\n /**\n * Cleans up the selection action widget.\n */\n cleanup(): void {\n this.#resizeObserver.disconnect();\n this.#root.remove();\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAa,wBAAb,MAAmC;CACjC;CAGA;CACA;CAEA,YACE,wBACA,gBACA,gBACA;EACA,KAAKA,QAAQ,EACX,OACA;GACE,SAAS;IAAE,cAAc;IAAI,wBAAwB;GAAG;GACxD,iBAAiB;GACjB,UAAU,CAAC,sBAAsB;EACnC,GACA,cACF;EACA,KAAKC,UAAU,KAAKD,MAAM;EAC1B,KAAKE,kBAAkB,IAAI,qBAAqB;GAC9C,MAAM,SAAS,KAAKF,MAAM;GAC1B,IAAI,WAAW,KAAKC,SAAS;IAC3B,KAAKA,UAAU;IACf,eAAe;GACjB;EACF,CAAC;EACD,KAAKC,gBAAgB,QAAQ,KAAKF,KAAK;CACzC;;;;;;;;;CAUA,WACE,MACA,KACA,aACA,YACA,SACA,UACM;EACN,KAAKA,MAAM,MAAM,aAAa,UAAU,KAAK;EAC7C,yBAAyB,KAAKA,OAAO;GACnC;GACA;GACA;GACA,GAAG;GACH,GAAG;EACL,CAAC;CACH;;;;;CAMA,IAAI,SAAiB;EACnB,OAAO,KAAKC;CACd;;;;CAKA,UAAgB;EACd,KAAKC,gBAAgB,WAAW;EAChC,KAAKF,MAAM,OAAO;CACpB;AACF"}
@@ -1,21 +1,11 @@
1
- import { DiffLineAnnotation, EditorSelection, Position, Range, TextEdit } from "../types.js";
1
+ import { DiffLineAnnotation, EditorChange, EditorSelection, Position, Range, ResolvedTextEdit, TextEdit } from "../types.js";
2
2
  import { EditStack } from "./editStack.js";
3
3
  import { SearchParams } from "./searchPanel.js";
4
4
 
5
5
  //#region src/editor/textDocument.d.ts
6
- /** Different with `TextEdit`, the range has been resolved to offsets. */
7
- interface ResolvedTextEdit {
8
- /** The start offset of the text change. */
9
- readonly start: number;
10
- /** The end offset of the text change. */
11
- readonly end: number;
12
- /**
13
- * The string to be inserted. For delete operations use an
14
- * empty string.
15
- */
16
- readonly text: string;
17
- }
18
6
  interface TextDocumentChange {
7
+ /** The edits that were applied to the text document. */
8
+ readonly changes: EditorChange[];
19
9
  /** First line whose rendered content or tokenizer state may have changed. */
20
10
  readonly startLine: number;
21
11
  /** Character on the first changed line where the edit began. */
@@ -73,5 +63,5 @@ declare class TextDocument<LAnnotation> {
73
63
  normalizePosition(position: Position): Position;
74
64
  }
75
65
  //#endregion
76
- export { type Position, type Range, ResolvedTextEdit, TextDocument, TextDocumentChange, type TextEdit };
66
+ export { type Position, type Range, TextDocument, TextDocumentChange, type TextEdit };
77
67
  //# sourceMappingURL=textDocument.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"textDocument.d.ts","names":[],"sources":["../../src/editor/textDocument.ts"],"mappings":";;;;;;UAoBiB,gBAAA;EAAgB;EAAA,SAEtB,KAAA;EAFsB;EAAA,SAItB,GAAA;EAAA;;;AAKI;EALJ,SAKA,IAAA;AAAA;AAAA,UAGM,kBAAA;EAAkB;EAAA,SAExB,SAAA;EAEA;EAAA,SAAA,cAAA;EAIA;EAAA,SAFA,YAAA;EAMA;EAAA,SAJA,OAAA;EAQA;EAAA,SANA,kBAAA;EAQ6B;EAAA,SAN7B,iBAAA;EAQA;EAAA,SANA,SAAA;EAQP;EAAA,SANO,SAAA;EAQP;EAAA,SANO,iBAAA,YAA6B,SAAA,UAAmB,OAAA;EAQvD;EAAA,SANO,kBAAA,aACP,SAAA,UACA,OAAA,UACA,SAAA,UACA,cAAA,WACA,YAAA,WACA,kBAAA;AAAA;AAAA,KAMC,yBAAA,iBACH,MAAA,EAAQ,kBAAA,EACR,UAAA,GAAa,eAAA,IACb,eAAA,GAAkB,kBAAA,CAAmB,WAAA,KACrC,cAAA,GAAiB,gBAAA;;;;cAMN,YAAA;EAAA;EAQX,WAAA,CACE,GAAA,UACA,IAAA,UACA,UAAA,WACA,OAAA,WACA,SAAA,GAAW,SAAA,CAAU,WAAA;EAAA,IAsBnB,GAAA;EAAA,IAIA,UAAA;EAAA,IAIA,OAAA;EAAA,IAIA,SAAA;EAAA,IAIA,GAAA;EAAA,IAIA,OAAA;EAAA,IAIA,OAAA;EAIJ,UAAA,CAAW,MAAA,WAAiB,QAAA;EAI5B,WAAA,CAAY,OAAA,sBAA6B,QAAA;EAQzC,QAAA,CAAS,QAAA,EAAU,QAAA;EAInB,OAAA,CAAQ,KAAA,GAAQ,KAAA;EAgBhB,WAAA,CAAY,IAAA,UAAc,gBAAA;E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BAAA;EA2DH,0BAAA,CAA2B,UAAA,EAAY,eAAA;EAIvC,0BAAA,CACE,qBAAA,EAAuB,kBAAA,CAAmB,WAAA,KAC1C,oBAAA,EAAsB,kBAAA,CAAmB,WAAA;EAQ3C,IAAA,IAAQ,yBAAA,CAA0B,WAAA;EAqBlC,IAAA,IAAQ,yBAAA,CAA0B,WAAA;EAqBlC,iBAAA,CAAkB,QAAA,EAAU,QAAA,GAAW,QAAA;AAAA"}
@@ -199,6 +199,13 @@ var TextDocument = class TextDocument {
199
199
  this.#pieceTable.applyEdits(edits);
200
200
  const lineCount = this.#pieceTable.lineCount;
201
201
  return {
202
+ changes: edits.map((edit, index) => ({
203
+ ...edit,
204
+ range: {
205
+ start: editPositions[index * 2],
206
+ end: editPositions[index * 2 + 1]
207
+ }
208
+ })),
202
209
  startLine: changedLineRange.startLine,
203
210
  startCharacter: startPosition.character,
204
211
  endCharacter: endPosition.character,
@@ -1 +1 @@
1
- {"version":3,"file":"textDocument.js","names":["#uri","#languageId","#version","#pieceTable","#editStack","#eol","#applyResolvedEdits","#sortAndValidateResolvedEdits","#resolveEdit","#normalizeResolvedEdit","#applyResolvedEditsToBuffer","#clampIndex","#isInsideSurrogatePair","#computeChangedLineRange"],"sources":["../../src/editor/textDocument.ts"],"sourcesContent":["import type {\n DiffLineAnnotation,\n EditorSelection,\n Position,\n Range,\n TextEdit,\n} from '../types';\nimport { countLineBreaks } from '../utils/computeFileOffsets';\nimport {\n coalesceEditStackEntries,\n createEditStackEntry,\n EditStack,\n shouldCoalesceEditStackEntry,\n} from './editStack';\nimport { PieceTable } from './pieceTable';\nimport type { SearchParams } from './searchPanel';\n\nexport type { Position, Range, TextEdit } from '../types';\n\n/** Different with `TextEdit`, the range has been resolved to offsets. */\nexport interface ResolvedTextEdit {\n /** The start offset of the text change. */\n readonly start: number;\n /** The end offset of the text change. */\n readonly end: number;\n /**\n * The string to be inserted. For delete operations use an\n * empty string.\n */\n readonly text: string;\n}\n\nexport interface TextDocumentChange {\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Character on the original last changed line where the edit ended. */\n readonly endCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Whether the original edit range ended at the previous document EOF. */\n readonly endedAtDocumentEnd: boolean;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges: readonly [startLine: number, endLine: number][];\n /** Per-edit rendered line ranges before adjacent ranges are coalesced. */\n readonly changedLineChanges?: readonly [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter?: number,\n endCharacter?: number,\n endedAtDocumentEnd?: boolean,\n ][];\n}\n\n// Metadata-less replay results include the resolved edits so Editor can remap\n// its live selections without storing a snapshot on the history entry.\ntype TextDocumentHistoryResult<LAnnotation> = [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n selectionEdits?: ResolvedTextEdit[],\n];\n\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport class TextDocument<LAnnotation> {\n #uri: string;\n #languageId: string;\n #version: number;\n #pieceTable: PieceTable;\n #editStack: EditStack<LAnnotation>;\n #eol: string;\n\n constructor(\n uri: string,\n text: string,\n languageId = 'text',\n version = 0,\n editStack: EditStack<LAnnotation> = new EditStack()\n ) {\n this.#uri = new URL(uri, 'file://').toString();\n this.#languageId = languageId;\n this.#version = version;\n this.#pieceTable = new PieceTable(text);\n this.#editStack = editStack;\n\n // The line ending the document uses, detected once from its first line. Lets\n // inserted or pasted text match the rest of the file instead of leaving\n // mixed endings behind and keeps that convention stable as the file is\n // edited. Defaults to Unix `\\n` when the initial text has no line break.\n const firstLineBreak = this.#pieceTable.getLineText(0, true);\n if (firstLineBreak.endsWith('\\r\\n')) {\n this.#eol = '\\r\\n';\n } else if (firstLineBreak.endsWith('\\r')) {\n this.#eol = '\\r';\n } else {\n this.#eol = '\\n';\n }\n }\n\n get uri(): string {\n return this.#uri;\n }\n\n get languageId(): string {\n return this.#languageId;\n }\n\n get version(): number {\n return this.#version;\n }\n\n get lineCount(): number {\n return this.#pieceTable.lineCount;\n }\n\n get eol(): string {\n return this.#eol;\n }\n\n get canUndo(): boolean {\n return this.#editStack.canUndo;\n }\n\n get canRedo(): boolean {\n return this.#editStack.canRedo;\n }\n\n positionAt(offset: number): Position {\n return this.normalizePosition(this.#pieceTable.positionAt(offset));\n }\n\n positionsAt(offsets: readonly number[]): Position[] {\n const positions = this.#pieceTable.positionsAt(offsets);\n for (let i = 0; i < positions.length; i++) {\n positions[i] = this.normalizePosition(positions[i]);\n }\n return positions;\n }\n\n offsetAt(position: Position): number {\n return this.#pieceTable.offsetAt(this.normalizePosition(position));\n }\n\n getText(range?: Range): string {\n if (range === undefined) {\n return this.#pieceTable.getText();\n }\n // Clamp the range to visible line content before extracting text. A\n // preserved vertical-move \"goal column\" can leave a selection focus whose\n // character overshoots a shorter line; without this, the piece table clamps\n // to the line's offset span (which includes the trailing line break) and\n // copy/cut would pull in that newline. Mirrors `offsetAt`, which normalizes\n // positions the same way.\n return this.#pieceTable.getText({\n start: this.normalizePosition(range.start),\n end: this.normalizePosition(range.end),\n });\n }\n\n getLineText(line: number, includeLineBreak?: boolean): string {\n return this.#pieceTable.getLineText(line, includeLineBreak);\n }\n\n // Rewrites every line break in `text` to the document's EOL. Clipboard text\n // can carry Windows (`\\r\\n`) or classic-Mac (`\\r`) breaks; inserting it\n // verbatim would leave mixed line endings in a file that uses one style.\n normalizeEol(text: string): string {\n return text.replace(/\\r\\n|\\r|\\n/g, this.eol);\n }\n\n getLineLength(line: number, includeLineBreak?: boolean): number {\n return this.#pieceTable.getLineLength(line, includeLineBreak);\n }\n\n charAt(offset: number): string;\n charAt(position: Position): string;\n charAt(positionOrOffset: Position | number): string {\n if (typeof positionOrOffset === 'number') {\n return this.#pieceTable.charAt(positionOrOffset);\n }\n return this.#pieceTable.charAt(this.offsetAt(positionOrOffset));\n }\n\n getTextSlice(start: number, end: number): string {\n return this.#pieceTable.getTextSlice(start, end);\n }\n\n findNextNonOverlappingSubstring(\n needle: string,\n occupied: readonly [start: number, end: number][]\n ): number | undefined {\n return this.#pieceTable.findNextNonOverlappingSubstring(needle, occupied);\n }\n\n search(searchParams: SearchParams): [start: number, end: number][] {\n return this.#pieceTable.search(searchParams);\n }\n\n applyEdits(\n edits: TextEdit[],\n updateHistory = true,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[],\n undoBoundary = false\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return;\n }\n return this.#applyResolvedEdits(\n this.#sortAndValidateResolvedEdits(this.resolveEdits(edits)),\n updateHistory,\n selectionsBefore,\n selectionsAfter,\n undoBoundary\n );\n }\n\n // Converts line/character ranges to the exact UTF-16 offsets applyEdits\n // uses, including widening invalid boundaries so they cannot split a valid\n // surrogate pair. Editor caret remapping uses the same resolved geometry.\n resolveEdits(edits: readonly TextEdit[]): ResolvedTextEdit[] {\n return edits.map((edit) => this.#resolveEdit(edit));\n }\n\n applyResolvedEdits(\n edits: ResolvedTextEdit[],\n updateHistory = true,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[],\n undoBoundary = false\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return undefined;\n }\n return this.#applyResolvedEdits(\n this.#sortAndValidateResolvedEdits(\n edits.map((edit) => this.#normalizeResolvedEdit(edit))\n ),\n updateHistory,\n selectionsBefore,\n selectionsAfter,\n undoBoundary\n );\n }\n\n // Every edit joins the undo timeline: an edit applied with\n // `updateHistory=false` affects the edit stack exactly as the identical\n // call with `updateHistory=true` and no selections or undo boundary would.\n // The flag only controls whether the caller's interaction metadata is\n // recorded on the entry; the entry itself is always pushed (clearing any\n // pending redo) and coalesces by the normal geometry rules. This keeps a\n // mixed tracked/untracked sequence equivalent to the all-tracked sequence —\n // undo-to-exhaustion restores the original text, redo-to-exhaustion the\n // final text — instead of leaving frozen entries whose offsets go stale.\n // Only history replay (undo/redo) writes to the buffer without recording.\n #applyResolvedEdits(\n resolvedEdits: ResolvedTextEdit[],\n updateHistory: boolean,\n selectionsBefore: EditorSelection[] | undefined,\n selectionsAfter: EditorSelection[] | undefined,\n undoBoundary: boolean\n ): TextDocumentChange {\n const entry = createEditStackEntry(\n this,\n resolvedEdits,\n this.#version,\n this.#version + 1,\n updateHistory ? selectionsBefore : undefined,\n updateHistory ? selectionsAfter : undefined\n );\n if (updateHistory && undoBoundary) {\n entry.undoBoundary = true;\n }\n const previousEntry = this.#editStack.peekUndoForCoalescing();\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n if (\n change.lineDelta === 0 &&\n shouldCoalesceEditStackEntry(previousEntry, entry)\n ) {\n this.#editStack.replaceLastUndo(\n coalesceEditStackEntries(previousEntry!, entry)\n );\n } else {\n this.#editStack.push(entry);\n }\n return change;\n }\n\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void {\n this.#editStack.setLastUndoSelectionsAfter(selections);\n }\n\n setLastUndoLineAnnotations(\n lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[],\n lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]\n ): void {\n this.#editStack.setLastUndoLineAnnotations(\n lineAnnotationsBefore,\n lineAnnotationsAfter\n );\n }\n\n undo(): TextDocumentHistoryResult<LAnnotation> | undefined {\n const entry = this.#editStack.popUndoToRedo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.inverseEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionBefore;\n const selections = entry.selectionsBefore?.slice();\n return [\n change,\n selections,\n entry.lineAnnotationsBefore?.slice(),\n selections === undefined\n ? entry.inverseEdits.map((edit) => ({ ...edit }))\n : undefined,\n ];\n }\n\n redo(): TextDocumentHistoryResult<LAnnotation> | undefined {\n const entry = this.#editStack.popRedoToUndo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.forwardEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionAfter;\n const selections = entry.selectionsAfter?.slice();\n return [\n change,\n selections,\n entry.lineAnnotationsAfter?.slice(),\n selections === undefined\n ? entry.forwardEdits.map((edit) => ({ ...edit }))\n : undefined,\n ];\n }\n\n normalizePosition(position: Position): Position {\n const line = TextDocument.#clampIndex(position.line, this.lineCount - 1);\n return {\n line,\n character: TextDocument.#clampIndex(\n position.character,\n this.getLineLength(line)\n ),\n };\n }\n\n // Math.min/max pass NaN through, and a fractional index breaks the\n // integer-keyed line-offset lookup — either way the resolved offset becomes\n // NaN and a degenerate edit range can swallow the whole document. Malformed\n // components clamp like any other out-of-range value: NaN and -Infinity act\n // as 0, fractions floor, +Infinity clamps to the max.\n static #clampIndex(value: number, max: number): number {\n if (Number.isNaN(value)) {\n return 0;\n }\n return Math.max(0, Math.min(Math.floor(value), max));\n }\n\n #resolveEdit(edit: TextEdit): ResolvedTextEdit {\n let start = this.offsetAt(edit.range.start);\n let end = this.offsetAt(edit.range.end);\n if (start > end) {\n const t = start;\n start = end;\n end = t;\n }\n return this.#normalizeResolvedEdit({\n start,\n end,\n text: edit.newText,\n });\n }\n\n // Snaps an insertion before a pair and widens replacement boundaries\n // outward, so every edit addresses whole UTF-16 surrogate pairs.\n #normalizeResolvedEdit(edit: ResolvedTextEdit): ResolvedTextEdit {\n let { start, end } = edit;\n const isInsertion = start === end;\n if (this.#isInsideSurrogatePair(start)) {\n start--;\n }\n if (isInsertion) {\n end = start;\n } else if (this.#isInsideSurrogatePair(end)) {\n end++;\n }\n return { start, end, text: edit.text };\n }\n\n // A UTF-16 offset is invalid when it sits between the high and low units of\n // one well-formed surrogate pair. Lone surrogate units remain addressable.\n #isInsideSurrogatePair(offset: number): boolean {\n const previous = this.#pieceTable.charAt(offset - 1).charCodeAt(0);\n const next = this.#pieceTable.charAt(offset).charCodeAt(0);\n return (\n previous >= 0xd800 &&\n previous <= 0xdbff &&\n next >= 0xdc00 &&\n next <= 0xdfff\n );\n }\n\n #sortAndValidateResolvedEdits(edits: ResolvedTextEdit[]): ResolvedTextEdit[] {\n // Put zero-width edits before ranges at the same start so validation and\n // application do not depend on the caller's batch order.\n const sortedEdits = [...edits].sort((a, b) => {\n const startDelta = a.start - b.start;\n return startDelta === 0 ? a.end - b.end : startDelta;\n });\n for (let i = 0; i < sortedEdits.length - 1; i++) {\n if (sortedEdits[i].end > sortedEdits[i + 1].start) {\n throw new Error('Overlapping text edits are not supported');\n }\n }\n return sortedEdits;\n }\n\n #applyResolvedEditsToBuffer(edits: ResolvedTextEdit[]): TextDocumentChange {\n const previousLineCount = this.#pieceTable.lineCount;\n const editPositions = this.positionsAt(\n edits.flatMap((edit) => [edit.start, edit.end])\n );\n const changedLineRange = this.#computeChangedLineRange(\n edits,\n editPositions\n );\n const startPosition = editPositions[0];\n const endPosition = editPositions[editPositions.length - 1];\n const endedAtDocumentEnd =\n endPosition.line === previousLineCount - 1 &&\n endPosition.character ===\n this.#pieceTable.getLineLength(endPosition.line);\n this.#pieceTable.applyEdits(edits);\n const lineCount = this.#pieceTable.lineCount;\n const change: TextDocumentChange = {\n startLine: changedLineRange.startLine,\n startCharacter: startPosition.character,\n endCharacter: endPosition.character,\n endLine: Math.min(changedLineRange.endLine, Math.max(0, lineCount - 1)),\n endedAtDocumentEnd,\n previousLineCount,\n lineCount,\n lineDelta: lineCount - previousLineCount,\n changedLineRanges: changedLineRange.ranges,\n changedLineChanges: changedLineRange.changes,\n };\n return change;\n }\n\n #computeChangedLineRange(\n edits: ResolvedTextEdit[],\n editPositions: Position[]\n ): {\n startLine: number;\n endLine: number;\n ranges: [number, number][];\n changes: [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter: number,\n endCharacter: number,\n endedAtDocumentEnd: boolean,\n ][];\n } {\n let startLine = Infinity;\n let endLine = 0;\n let lineDeltaBeforeEdit = 0;\n const ranges: [number, number][] = [];\n const changes: [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter: number,\n endCharacter: number,\n endedAtDocumentEnd: boolean,\n ][] = [];\n const previousLastLine = this.#pieceTable.lineCount - 1;\n const previousLastLineLength =\n this.#pieceTable.getLineLength(previousLastLine);\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n const editStart = editPositions[i * 2];\n const editEnd = editPositions[i * 2 + 1];\n const editStartLine = editStart.line;\n const editEndLine = editEnd.line;\n const insertedLineSpan = countLineBreaks(edit.text);\n const changedStartLine = editStartLine + lineDeltaBeforeEdit;\n const changedEndLine = changedStartLine + insertedLineSpan;\n const lineDelta = insertedLineSpan - (editEndLine - editStartLine);\n startLine = Math.min(startLine, editStartLine);\n endLine = Math.max(endLine, changedEndLine);\n const lastRange = ranges[ranges.length - 1];\n if (lastRange !== undefined && changedStartLine <= lastRange[1] + 1) {\n ranges[ranges.length - 1] = [\n lastRange[0],\n Math.max(lastRange[1], changedEndLine),\n ];\n } else {\n ranges.push([changedStartLine, changedEndLine]);\n }\n changes.push([\n changedStartLine,\n changedEndLine,\n lineDelta,\n editStart.character,\n editEnd.character,\n editEndLine === previousLastLine &&\n editEnd.character === previousLastLineLength,\n ]);\n lineDeltaBeforeEdit += lineDelta;\n }\n if (startLine === Infinity) {\n return {\n startLine: 0,\n endLine: 0,\n ranges: [[0, 0]],\n changes: [[0, 0, 0, 0, 0, false]],\n };\n }\n return { startLine, endLine, ranges, changes };\n }\n}\n"],"mappings":";;;;;;;AA0EA,IAAa,eAAb,MAAa,aAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,MACA,aAAa,QACb,UAAU,GACV,YAAoC,IAAI,UAAU,GAClD;EACA,KAAKA,OAAO,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,SAAS;EAC7C,KAAKC,cAAc;EACnB,KAAKC,WAAW;EA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YAAY,OAAO,OAAO,SAAS;GACzC,IAAI,cAAc,KAAA,KAAa,oBAAoB,UAAU,KAAK,GAChE,OAAO,OAAO,SAAS,KAAK,CAC1B,UAAU,IACV,KAAK,IAAI,UAAU,IAAI,cAAc,CACvC;QAEA,OAAO,KAAK,CAAC,kBAAkB,cAAc,CAAC;GAEhD,QAAQ,KAAK;IACX;IACA;IACA;IACA,UAAU;IACV,QAAQ;IACR,gBAAgB,oBACd,QAAQ,cAAc;GAC1B,CAAC;GACD,uBAAuB;EACzB;EACA,IAAI,cAAc,UAChB,OAAO;GACL,WAAW;GACX,SAAS;GACT,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;GACf,SAAS,CAAC;IAAC;IAAG;IAAG;IAAG;IAAG;IAAG;GAAK,CAAC;EAClC;EAEF,OAAO;GAAE;GAAW;GAAS;GAAQ;EAAQ;CAC/C;AACF"}
1
+ {"version":3,"file":"textDocument.js","names":["#uri","#languageId","#version","#pieceTable","#editStack","#eol","#applyResolvedEdits","#sortAndValidateResolvedEdits","#resolveEdit","#normalizeResolvedEdit","#applyResolvedEditsToBuffer","#clampIndex","#isInsideSurrogatePair","#computeChangedLineRange"],"sources":["../../src/editor/textDocument.ts"],"sourcesContent":["import type {\n DiffLineAnnotation,\n EditorChange,\n EditorSelection,\n Position,\n Range,\n ResolvedTextEdit,\n TextEdit,\n} from '../types';\nimport { countLineBreaks } from '../utils/computeFileOffsets';\nimport {\n coalesceEditStackEntries,\n createEditStackEntry,\n EditStack,\n shouldCoalesceEditStackEntry,\n} from './editStack';\nimport { PieceTable } from './pieceTable';\nimport type { SearchParams } from './searchPanel';\n\nexport type { Position, Range, TextEdit } from '../types';\n\nexport interface TextDocumentChange {\n /** The edits that were applied to the text document. */\n readonly changes: EditorChange[];\n /** First line whose rendered content or tokenizer state may have changed. */\n readonly startLine: number;\n /** Character on the first changed line where the edit began. */\n readonly startCharacter: number;\n /** Character on the original last changed line where the edit ended. */\n readonly endCharacter: number;\n /** Last line whose rendered content may have changed after the edit. */\n readonly endLine: number;\n /** Whether the original edit range ended at the previous document EOF. */\n readonly endedAtDocumentEnd: boolean;\n /** Line count before the edit was applied. */\n readonly previousLineCount: number;\n /** Line count after the edit was applied. */\n readonly lineCount: number;\n /** Difference between the old and new line counts. */\n readonly lineDelta: number;\n /** Exact rendered line ranges touched by each edit after the edit was applied. */\n readonly changedLineRanges: readonly [startLine: number, endLine: number][];\n /** Per-edit rendered line ranges before adjacent ranges are coalesced. */\n readonly changedLineChanges?: readonly [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter?: number,\n endCharacter?: number,\n endedAtDocumentEnd?: boolean,\n ][];\n}\n\n// Metadata-less replay results include the resolved edits so Editor can remap\n// its live selections without storing a snapshot on the history entry.\ntype TextDocumentHistoryResult<LAnnotation> = [\n change: TextDocumentChange,\n selections?: EditorSelection[],\n lineAnnotations?: DiffLineAnnotation<LAnnotation>[],\n selectionEdits?: ResolvedTextEdit[],\n];\n\n/**\n * A vscode-languageserver-textdocument compatible text document.\n */\nexport class TextDocument<LAnnotation> {\n #uri: string;\n #languageId: string;\n #version: number;\n #pieceTable: PieceTable;\n #editStack: EditStack<LAnnotation>;\n #eol: string;\n\n constructor(\n uri: string,\n text: string,\n languageId = 'text',\n version = 0,\n editStack: EditStack<LAnnotation> = new EditStack()\n ) {\n this.#uri = new URL(uri, 'file://').toString();\n this.#languageId = languageId;\n this.#version = version;\n this.#pieceTable = new PieceTable(text);\n this.#editStack = editStack;\n\n // The line ending the document uses, detected once from its first line. Lets\n // inserted or pasted text match the rest of the file instead of leaving\n // mixed endings behind and keeps that convention stable as the file is\n // edited. Defaults to Unix `\\n` when the initial text has no line break.\n const firstLineBreak = this.#pieceTable.getLineText(0, true);\n if (firstLineBreak.endsWith('\\r\\n')) {\n this.#eol = '\\r\\n';\n } else if (firstLineBreak.endsWith('\\r')) {\n this.#eol = '\\r';\n } else {\n this.#eol = '\\n';\n }\n }\n\n get uri(): string {\n return this.#uri;\n }\n\n get languageId(): string {\n return this.#languageId;\n }\n\n get version(): number {\n return this.#version;\n }\n\n get lineCount(): number {\n return this.#pieceTable.lineCount;\n }\n\n get eol(): string {\n return this.#eol;\n }\n\n get canUndo(): boolean {\n return this.#editStack.canUndo;\n }\n\n get canRedo(): boolean {\n return this.#editStack.canRedo;\n }\n\n positionAt(offset: number): Position {\n return this.normalizePosition(this.#pieceTable.positionAt(offset));\n }\n\n positionsAt(offsets: readonly number[]): Position[] {\n const positions = this.#pieceTable.positionsAt(offsets);\n for (let i = 0; i < positions.length; i++) {\n positions[i] = this.normalizePosition(positions[i]);\n }\n return positions;\n }\n\n offsetAt(position: Position): number {\n return this.#pieceTable.offsetAt(this.normalizePosition(position));\n }\n\n getText(range?: Range): string {\n if (range === undefined) {\n return this.#pieceTable.getText();\n }\n // Clamp the range to visible line content before extracting text. A\n // preserved vertical-move \"goal column\" can leave a selection focus whose\n // character overshoots a shorter line; without this, the piece table clamps\n // to the line's offset span (which includes the trailing line break) and\n // copy/cut would pull in that newline. Mirrors `offsetAt`, which normalizes\n // positions the same way.\n return this.#pieceTable.getText({\n start: this.normalizePosition(range.start),\n end: this.normalizePosition(range.end),\n });\n }\n\n getLineText(line: number, includeLineBreak?: boolean): string {\n return this.#pieceTable.getLineText(line, includeLineBreak);\n }\n\n // Rewrites every line break in `text` to the document's EOL. Clipboard text\n // can carry Windows (`\\r\\n`) or classic-Mac (`\\r`) breaks; inserting it\n // verbatim would leave mixed line endings in a file that uses one style.\n normalizeEol(text: string): string {\n return text.replace(/\\r\\n|\\r|\\n/g, this.eol);\n }\n\n getLineLength(line: number, includeLineBreak?: boolean): number {\n return this.#pieceTable.getLineLength(line, includeLineBreak);\n }\n\n charAt(offset: number): string;\n charAt(position: Position): string;\n charAt(positionOrOffset: Position | number): string {\n if (typeof positionOrOffset === 'number') {\n return this.#pieceTable.charAt(positionOrOffset);\n }\n return this.#pieceTable.charAt(this.offsetAt(positionOrOffset));\n }\n\n getTextSlice(start: number, end: number): string {\n return this.#pieceTable.getTextSlice(start, end);\n }\n\n findNextNonOverlappingSubstring(\n needle: string,\n occupied: readonly [start: number, end: number][]\n ): number | undefined {\n return this.#pieceTable.findNextNonOverlappingSubstring(needle, occupied);\n }\n\n search(searchParams: SearchParams): [start: number, end: number][] {\n return this.#pieceTable.search(searchParams);\n }\n\n applyEdits(\n edits: TextEdit[],\n updateHistory = true,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[],\n undoBoundary = false\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return;\n }\n return this.#applyResolvedEdits(\n this.#sortAndValidateResolvedEdits(this.resolveEdits(edits)),\n updateHistory,\n selectionsBefore,\n selectionsAfter,\n undoBoundary\n );\n }\n\n // Converts line/character ranges to the exact UTF-16 offsets applyEdits\n // uses, including widening invalid boundaries so they cannot split a valid\n // surrogate pair. Editor caret remapping uses the same resolved geometry.\n resolveEdits(edits: readonly TextEdit[]): ResolvedTextEdit[] {\n return edits.map((edit) => this.#resolveEdit(edit));\n }\n\n applyResolvedEdits(\n edits: ResolvedTextEdit[],\n updateHistory = true,\n selectionsBefore?: EditorSelection[],\n selectionsAfter?: EditorSelection[],\n undoBoundary = false\n ): TextDocumentChange | undefined {\n if (edits.length === 0) {\n return undefined;\n }\n return this.#applyResolvedEdits(\n this.#sortAndValidateResolvedEdits(\n edits.map((edit) => this.#normalizeResolvedEdit(edit))\n ),\n updateHistory,\n selectionsBefore,\n selectionsAfter,\n undoBoundary\n );\n }\n\n // Every edit joins the undo timeline: an edit applied with\n // `updateHistory=false` affects the edit stack exactly as the identical\n // call with `updateHistory=true` and no selections or undo boundary would.\n // The flag only controls whether the caller's interaction metadata is\n // recorded on the entry; the entry itself is always pushed (clearing any\n // pending redo) and coalesces by the normal geometry rules. This keeps a\n // mixed tracked/untracked sequence equivalent to the all-tracked sequence —\n // undo-to-exhaustion restores the original text, redo-to-exhaustion the\n // final text — instead of leaving frozen entries whose offsets go stale.\n // Only history replay (undo/redo) writes to the buffer without recording.\n #applyResolvedEdits(\n resolvedEdits: ResolvedTextEdit[],\n updateHistory: boolean,\n selectionsBefore: EditorSelection[] | undefined,\n selectionsAfter: EditorSelection[] | undefined,\n undoBoundary: boolean\n ): TextDocumentChange {\n const entry = createEditStackEntry(\n this,\n resolvedEdits,\n this.#version,\n this.#version + 1,\n updateHistory ? selectionsBefore : undefined,\n updateHistory ? selectionsAfter : undefined\n );\n if (updateHistory && undoBoundary) {\n entry.undoBoundary = true;\n }\n const previousEntry = this.#editStack.peekUndoForCoalescing();\n const change = this.#applyResolvedEditsToBuffer(resolvedEdits);\n this.#version++;\n if (\n change.lineDelta === 0 &&\n shouldCoalesceEditStackEntry(previousEntry, entry)\n ) {\n this.#editStack.replaceLastUndo(\n coalesceEditStackEntries(previousEntry!, entry)\n );\n } else {\n this.#editStack.push(entry);\n }\n return change;\n }\n\n setLastUndoSelectionsAfter(selections: EditorSelection[]): void {\n this.#editStack.setLastUndoSelectionsAfter(selections);\n }\n\n setLastUndoLineAnnotations(\n lineAnnotationsBefore: DiffLineAnnotation<LAnnotation>[],\n lineAnnotationsAfter: DiffLineAnnotation<LAnnotation>[]\n ): void {\n this.#editStack.setLastUndoLineAnnotations(\n lineAnnotationsBefore,\n lineAnnotationsAfter\n );\n }\n\n undo(): TextDocumentHistoryResult<LAnnotation> | undefined {\n const entry = this.#editStack.popUndoToRedo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.inverseEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionBefore;\n const selections = entry.selectionsBefore?.slice();\n return [\n change,\n selections,\n entry.lineAnnotationsBefore?.slice(),\n selections === undefined\n ? entry.inverseEdits.map((edit) => ({ ...edit }))\n : undefined,\n ];\n }\n\n redo(): TextDocumentHistoryResult<LAnnotation> | undefined {\n const entry = this.#editStack.popRedoToUndo();\n if (entry === undefined) {\n return undefined;\n }\n const change = this.#applyResolvedEditsToBuffer(entry.forwardEdits);\n if (change === undefined) {\n return undefined;\n }\n this.#version = entry.versionAfter;\n const selections = entry.selectionsAfter?.slice();\n return [\n change,\n selections,\n entry.lineAnnotationsAfter?.slice(),\n selections === undefined\n ? entry.forwardEdits.map((edit) => ({ ...edit }))\n : undefined,\n ];\n }\n\n normalizePosition(position: Position): Position {\n const line = TextDocument.#clampIndex(position.line, this.lineCount - 1);\n return {\n line,\n character: TextDocument.#clampIndex(\n position.character,\n this.getLineLength(line)\n ),\n };\n }\n\n // Math.min/max pass NaN through, and a fractional index breaks the\n // integer-keyed line-offset lookup — either way the resolved offset becomes\n // NaN and a degenerate edit range can swallow the whole document. Malformed\n // components clamp like any other out-of-range value: NaN and -Infinity act\n // as 0, fractions floor, +Infinity clamps to the max.\n static #clampIndex(value: number, max: number): number {\n if (Number.isNaN(value)) {\n return 0;\n }\n return Math.max(0, Math.min(Math.floor(value), max));\n }\n\n #resolveEdit(edit: TextEdit): ResolvedTextEdit {\n let start = this.offsetAt(edit.range.start);\n let end = this.offsetAt(edit.range.end);\n if (start > end) {\n const t = start;\n start = end;\n end = t;\n }\n return this.#normalizeResolvedEdit({\n start,\n end,\n text: edit.newText,\n });\n }\n\n // Snaps an insertion before a pair and widens replacement boundaries\n // outward, so every edit addresses whole UTF-16 surrogate pairs.\n #normalizeResolvedEdit(edit: ResolvedTextEdit): ResolvedTextEdit {\n let { start, end } = edit;\n const isInsertion = start === end;\n if (this.#isInsideSurrogatePair(start)) {\n start--;\n }\n if (isInsertion) {\n end = start;\n } else if (this.#isInsideSurrogatePair(end)) {\n end++;\n }\n return { start, end, text: edit.text };\n }\n\n // A UTF-16 offset is invalid when it sits between the high and low units of\n // one well-formed surrogate pair. Lone surrogate units remain addressable.\n #isInsideSurrogatePair(offset: number): boolean {\n const previous = this.#pieceTable.charAt(offset - 1).charCodeAt(0);\n const next = this.#pieceTable.charAt(offset).charCodeAt(0);\n return (\n previous >= 0xd800 &&\n previous <= 0xdbff &&\n next >= 0xdc00 &&\n next <= 0xdfff\n );\n }\n\n #sortAndValidateResolvedEdits(edits: ResolvedTextEdit[]): ResolvedTextEdit[] {\n // Put zero-width edits before ranges at the same start so validation and\n // application do not depend on the caller's batch order.\n const sortedEdits = [...edits].sort((a, b) => {\n const startDelta = a.start - b.start;\n return startDelta === 0 ? a.end - b.end : startDelta;\n });\n for (let i = 0; i < sortedEdits.length - 1; i++) {\n if (sortedEdits[i].end > sortedEdits[i + 1].start) {\n throw new Error('Overlapping text edits are not supported');\n }\n }\n return sortedEdits;\n }\n\n #applyResolvedEditsToBuffer(edits: ResolvedTextEdit[]): TextDocumentChange {\n const previousLineCount = this.#pieceTable.lineCount;\n const editPositions = this.positionsAt(\n edits.flatMap((edit) => [edit.start, edit.end])\n );\n const changedLineRange = this.#computeChangedLineRange(\n edits,\n editPositions\n );\n const startPosition = editPositions[0];\n const endPosition = editPositions[editPositions.length - 1];\n const endedAtDocumentEnd =\n endPosition.line === previousLineCount - 1 &&\n endPosition.character ===\n this.#pieceTable.getLineLength(endPosition.line);\n this.#pieceTable.applyEdits(edits);\n const lineCount = this.#pieceTable.lineCount;\n const change: TextDocumentChange = {\n changes: edits.map((edit, index) => ({\n ...edit,\n range: {\n start: editPositions[index * 2],\n end: editPositions[index * 2 + 1],\n },\n })),\n startLine: changedLineRange.startLine,\n startCharacter: startPosition.character,\n endCharacter: endPosition.character,\n endLine: Math.min(changedLineRange.endLine, Math.max(0, lineCount - 1)),\n endedAtDocumentEnd,\n previousLineCount,\n lineCount,\n lineDelta: lineCount - previousLineCount,\n changedLineRanges: changedLineRange.ranges,\n changedLineChanges: changedLineRange.changes,\n };\n return change;\n }\n\n #computeChangedLineRange(\n edits: ResolvedTextEdit[],\n editPositions: Position[]\n ): {\n startLine: number;\n endLine: number;\n ranges: [number, number][];\n changes: [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter: number,\n endCharacter: number,\n endedAtDocumentEnd: boolean,\n ][];\n } {\n let startLine = Infinity;\n let endLine = 0;\n let lineDeltaBeforeEdit = 0;\n const ranges: [number, number][] = [];\n const changes: [\n startLine: number,\n endLine: number,\n lineDelta: number,\n startCharacter: number,\n endCharacter: number,\n endedAtDocumentEnd: boolean,\n ][] = [];\n const previousLastLine = this.#pieceTable.lineCount - 1;\n const previousLastLineLength =\n this.#pieceTable.getLineLength(previousLastLine);\n for (let i = 0; i < edits.length; i++) {\n const edit = edits[i];\n const editStart = editPositions[i * 2];\n const editEnd = editPositions[i * 2 + 1];\n const editStartLine = editStart.line;\n const editEndLine = editEnd.line;\n const insertedLineSpan = countLineBreaks(edit.text);\n const changedStartLine = editStartLine + lineDeltaBeforeEdit;\n const changedEndLine = changedStartLine + insertedLineSpan;\n const lineDelta = insertedLineSpan - (editEndLine - editStartLine);\n startLine = Math.min(startLine, editStartLine);\n endLine = Math.max(endLine, changedEndLine);\n const lastRange = ranges[ranges.length - 1];\n if (lastRange !== undefined && changedStartLine <= lastRange[1] + 1) {\n ranges[ranges.length - 1] = [\n lastRange[0],\n Math.max(lastRange[1], changedEndLine),\n ];\n } else {\n ranges.push([changedStartLine, changedEndLine]);\n }\n changes.push([\n changedStartLine,\n changedEndLine,\n lineDelta,\n editStart.character,\n editEnd.character,\n editEndLine === previousLastLine &&\n editEnd.character === previousLastLineLength,\n ]);\n lineDeltaBeforeEdit += lineDelta;\n }\n if (startLine === Infinity) {\n return {\n startLine: 0,\n endLine: 0,\n ranges: [[0, 0]],\n changes: [[0, 0, 0, 0, 0, false]],\n };\n }\n return { startLine, endLine, ranges, changes };\n }\n}\n"],"mappings":";;;;;;;AAiEA,IAAa,eAAb,MAAa,aAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CAEA,YACE,KACA,MACA,aAAa,QACb,UAAU,GACV,YAAoC,IAAI,UAAU,GAClD;EACA,KAAKA,OAAO,IAAI,IAAI,KAAK,SAAS,CAAC,CAAC,SAAS;EAC7C,KAAKC,cAAc;EACnB,KAAKC,WAAW;EAChB,KAAKC,cAAc,IAAI,WAAW,IAAI;EACtC,KAAKC,aAAa;EA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AY,KAAK,IAAI,WAAW,aAAa;GAC7C,UAAU,KAAK,IAAI,SAAS,cAAc;GAC1C,MAAM,YAAY,OAAO,OAAO,SAAS;GACzC,IAAI,cAAc,KAAA,KAAa,oBAAoB,UAAU,KAAK,GAChE,OAAO,OAAO,SAAS,KAAK,CAC1B,UAAU,IACV,KAAK,IAAI,UAAU,IAAI,cAAc,CACvC;QAEA,OAAO,KAAK,CAAC,kBAAkB,cAAc,CAAC;GAEhD,QAAQ,KAAK;IACX;IACA;IACA;IACA,UAAU;IACV,QAAQ;IACR,gBAAgB,oBACd,QAAQ,cAAc;GAC1B,CAAC;GACD,uBAAuB;EACzB;EACA,IAAI,cAAc,UAChB,OAAO;GACL,WAAW;GACX,SAAS;GACT,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;GACf,SAAS,CAAC;IAAC;IAAG;IAAG;IAAG;IAAG;IAAG;GAAK,CAAC;EAClC;EAEF,OAAO;GAAE;GAAW;GAAS;GAAQ;EAAQ;CAC/C;AACF"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "./types.js";
1
+ import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorChange, EditorChangeEvent, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, ResolvedTextEdit, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "./types.js";
2
2
  import { GetHoveredLineResult, GetLineIndexUtility, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, LogTypes, MergeConflictActionTarget, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, SelectionWriteOptions, pluckInteractionOptions } from "./managers/InteractionManager.js";
3
3
  import { ResizeManager, ResizeManagerColumnVariableMode, ResizeManagerSetupOptions } from "./managers/ResizeManager.js";
4
4
  import { FileRenderResult, FileRenderer, FileRendererOptions } from "./renderers/FileRenderer.js";
@@ -108,4 +108,4 @@ import { setLanguageOverride } from "./utils/setLanguageOverride.js";
108
108
  import { setPreNodeProperties } from "./utils/setWrapperNodeProps.js";
109
109
  import { trimPatchContext } from "./utils/trimPatchContext.js";
110
110
  import { codeToHtml, createCssVariablesTheme as createCSSVariablesTheme } from "shiki";
111
- export { ALTERNATE_FILE_NAMES_GIT, type AnnotationLineMap, type AnnotationSide, type AnnotationSpan, type AppliedThemeStyleCache, AttachedLanguages, AttachedThemes, type BaseCodeOptions, type BaseDiffOptions, type BaseDiffOptionsWithDefaults, type BundledLanguage, CODE_VIEW_DIFF_OPTION_KEYS, CODE_VIEW_FILE_OPTION_KEYS, CODE_VIEW_FOOTER_ATTRIBUTE, CODE_VIEW_HEADER_ATTRIBUTE, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, type ChangeContent, type ChangeTypes, type CodeColumnType, type CodeToHastOptions, CodeToTokenTransformStream, CodeToTokenTransformStreamOptions, CodeView, CodeViewCoordinator, type CodeViewCreateEditorOptions, type CodeViewDiffItem, type CodeViewFileItem, type CodeViewItem, type CodeViewItemScrollTarget, type CodeViewLayout, type CodeViewLineScrollTarget, CodeViewLineSelection, CodeViewOptions, type CodeViewPositionScrollTarget, type CodeViewRangeScrollTarget, CodeViewRenderedDiffItem, CodeViewRenderedFileItem, CodeViewRenderedItem, type CodeViewScrollBehavior, CodeViewScrollListener, type CodeViewScrollTarget, CodeViewSlotSnapshot, type ConflictResolverTypes, type ContextContent, CreateFileHeaderElementProps, type CreatePatchOptionsNonabortable, type CustomPreProperties, CustomThemeLoader, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, type DecorationItem, type DiffAcceptRejectHunkConfig, type DiffAcceptRejectHunkType, type DiffFileInput, DiffHunksRenderer, DiffHunksRendererOptions, DiffHunksRendererOptionsWithDefaults, type DiffIndicators, type DiffLineAnnotation, type DiffLineEventBaseProps, type DiffTokenEventBaseProps, type DiffsBaseComponent, type DiffsComponentOptions, type DiffsEditableComponent, type DiffsEditor, type DiffsHighlighter, type DiffsTextDocument, type DiffsThemeNames, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, type EditableInstance, type EditorActiveLineOptions, type EditorSelection, type EditorState, type EditorViewState, type ExpansionDirections, type ExtensionFormatMap, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, type FileContents, FileDiff, type FileDiffContentsLoader, FileDiffHydrationProps, type FileDiffLoadedChangedFiles, type FileDiffLoadedFiles, type FileDiffLoadedPureRenamedFile, type FileDiffMetadata, FileDiffOptions, FileDiffRenderBaseProps, FileDiffRenderProps, FileDiffType, type FileHeaderRenderMode, FileHydrateProps, FileOptions, FileRenderProps, FileRenderResult, FileRenderer, FileRendererOptions, FileStream, FileStreamOptions, type ForceDiffPlainTextOptions, type ForceFilePlainTextOptions, GIT_DIFF_FILE_BREAK_REGEX, type GapSpan, GetHoveredLineResult, GetLineIndexUtility, HEADER_FILENAME_SUFFIX_SLOT_ID, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, type HighlightedToken, type HighlighterTypes, type Hunk, type HunkData, type HunkExpansionRegion, type HunkLineType, type HunkSeparators, HunksRenderResult, INDEX_LINE_METADATA, InjectedRow, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, type LanguageRegistration, type LineAnnotation, LineDecoration, type LineDiffTypes, type LineEventBaseProps, type LineInfo, type LineSpans, type LineTypes, LogTypes, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, type MaybeDiffFileInput, type MergeConflictActionPayload, MergeConflictActionTarget, MergeConflictActionsTypeOption, type MergeConflictMarkerRow, type MergeConflictMarkerRowType, type MergeConflictRegion, type MergeConflictResolution, type NumericScrollLineAnchor, type ObservedAnnotationNodes, type ObservedGridNodes, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, ParsedLine, type ParsedPatch, type PendingCodeViewLayoutReset, type Position, type PostRenderPhase, type PrePropertiesConfig, type ProcessFileConflictData, type Range, RecallToken, RegisteredCustomLanguages, type RenderDiffFilesResult, type RenderDiffOptions, type RenderDiffResult, type RenderFileMetadata, type RenderFileOptions, type RenderFileResult, type RenderHeaderFilenameSuffixCallback, type RenderHeaderMetadataCallback, type RenderHeaderPrefixCallback, RenderMergeConflictActions, type RenderRange, type RenderWindow, type RenderedDiffASTCache, type RenderedFileASTCache, RenderedLineContext, ResizeManager, ResizeManagerColumnVariableMode, ResizeManagerSetupOptions, ResolvedLanguages, ResolvingLanguages, SPLIT_WITH_NEWLINES, SVGSpriteNames, SVGSpriteSheet, ScrollSyncManager, type SelectedLineRange, type SelectionDirection, type SelectionPoint, type SelectionSide, SelectionWriteOptions, type SharedRenderState, ShikiStreamTokenizer, ShikiStreamTokenizerEnqueueResult, ShikiStreamTokenizerOptions, type ShikiTransformer, type SmoothScrollSettings, SplitInjectedRow, SplitInjectedRowPlacement, SplitLineDecorationProps, type StickySpecs, type SupportedLanguages, THEME_CSS_ATTRIBUTE, type TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, type ThemeTypes, type ThemedDiffResult, type ThemedFileResult, type ThemedToken, type ThemesType, type TokenEventBase, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnifiedInjectedRowPlacement, UnifiedLineDecorationProps, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps, VIRTUALIZED_FILE_DIFF_LAYOUT_CHECKPOINT_INTERVAL, type VirtualFileMetrics, type VirtualWindowSpecs, VirtualizedFile, VirtualizedFileDiff, Virtualizer, VirtualizerConfig, VirtualizerScrollOptions, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, clearRenderQueue, cloneFileDiffMetadata, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, hydratePartialDiff, isDefaultRenderRange, isDiffAnnotation, isDiffAnnotationCollection, isFileAnnotation, isFileAnnotationCollection, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
111
+ export { ALTERNATE_FILE_NAMES_GIT, type AnnotationLineMap, type AnnotationSide, type AnnotationSpan, type AppliedThemeStyleCache, AttachedLanguages, AttachedThemes, type BaseCodeOptions, type BaseDiffOptions, type BaseDiffOptionsWithDefaults, type BundledLanguage, CODE_VIEW_DIFF_OPTION_KEYS, CODE_VIEW_FILE_OPTION_KEYS, CODE_VIEW_FOOTER_ATTRIBUTE, CODE_VIEW_HEADER_ATTRIBUTE, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, type ChangeContent, type ChangeTypes, type CodeColumnType, type CodeToHastOptions, CodeToTokenTransformStream, CodeToTokenTransformStreamOptions, CodeView, CodeViewCoordinator, type CodeViewCreateEditorOptions, type CodeViewDiffItem, type CodeViewFileItem, type CodeViewItem, type CodeViewItemScrollTarget, type CodeViewLayout, type CodeViewLineScrollTarget, CodeViewLineSelection, CodeViewOptions, type CodeViewPositionScrollTarget, type CodeViewRangeScrollTarget, CodeViewRenderedDiffItem, CodeViewRenderedFileItem, CodeViewRenderedItem, type CodeViewScrollBehavior, CodeViewScrollListener, type CodeViewScrollTarget, CodeViewSlotSnapshot, type ConflictResolverTypes, type ContextContent, CreateFileHeaderElementProps, type CreatePatchOptionsNonabortable, type CustomPreProperties, CustomThemeLoader, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, type DecorationItem, type DiffAcceptRejectHunkConfig, type DiffAcceptRejectHunkType, type DiffFileInput, DiffHunksRenderer, DiffHunksRendererOptions, DiffHunksRendererOptionsWithDefaults, type DiffIndicators, type DiffLineAnnotation, type DiffLineEventBaseProps, type DiffTokenEventBaseProps, type DiffsBaseComponent, type DiffsComponentOptions, type DiffsEditableComponent, type DiffsEditor, type DiffsHighlighter, type DiffsTextDocument, type DiffsThemeNames, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, type EditableInstance, type EditorActiveLineOptions, type EditorChange, type EditorChangeEvent, type EditorSelection, type EditorState, type EditorViewState, type ExpansionDirections, type ExtensionFormatMap, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, type FileContents, FileDiff, type FileDiffContentsLoader, FileDiffHydrationProps, type FileDiffLoadedChangedFiles, type FileDiffLoadedFiles, type FileDiffLoadedPureRenamedFile, type FileDiffMetadata, FileDiffOptions, FileDiffRenderBaseProps, FileDiffRenderProps, FileDiffType, type FileHeaderRenderMode, FileHydrateProps, FileOptions, FileRenderProps, FileRenderResult, FileRenderer, FileRendererOptions, FileStream, FileStreamOptions, type ForceDiffPlainTextOptions, type ForceFilePlainTextOptions, GIT_DIFF_FILE_BREAK_REGEX, type GapSpan, GetHoveredLineResult, GetLineIndexUtility, HEADER_FILENAME_SUFFIX_SLOT_ID, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, type HighlightedToken, type HighlighterTypes, type Hunk, type HunkData, type HunkExpansionRegion, type HunkLineType, type HunkSeparators, HunksRenderResult, INDEX_LINE_METADATA, InjectedRow, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, type LanguageRegistration, type LineAnnotation, LineDecoration, type LineDiffTypes, type LineEventBaseProps, type LineInfo, type LineSpans, type LineTypes, LogTypes, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, type MaybeDiffFileInput, type MergeConflictActionPayload, MergeConflictActionTarget, MergeConflictActionsTypeOption, type MergeConflictMarkerRow, type MergeConflictMarkerRowType, type MergeConflictRegion, type MergeConflictResolution, type NumericScrollLineAnchor, type ObservedAnnotationNodes, type ObservedGridNodes, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, ParsedLine, type ParsedPatch, type PendingCodeViewLayoutReset, type Position, type PostRenderPhase, type PrePropertiesConfig, type ProcessFileConflictData, type Range, RecallToken, RegisteredCustomLanguages, type RenderDiffFilesResult, type RenderDiffOptions, type RenderDiffResult, type RenderFileMetadata, type RenderFileOptions, type RenderFileResult, type RenderHeaderFilenameSuffixCallback, type RenderHeaderMetadataCallback, type RenderHeaderPrefixCallback, RenderMergeConflictActions, type RenderRange, type RenderWindow, type RenderedDiffASTCache, type RenderedFileASTCache, RenderedLineContext, ResizeManager, ResizeManagerColumnVariableMode, ResizeManagerSetupOptions, ResolvedLanguages, type ResolvedTextEdit, ResolvingLanguages, SPLIT_WITH_NEWLINES, SVGSpriteNames, SVGSpriteSheet, ScrollSyncManager, type SelectedLineRange, type SelectionDirection, type SelectionPoint, type SelectionSide, SelectionWriteOptions, type SharedRenderState, ShikiStreamTokenizer, ShikiStreamTokenizerEnqueueResult, ShikiStreamTokenizerOptions, type ShikiTransformer, type SmoothScrollSettings, SplitInjectedRow, SplitInjectedRowPlacement, SplitLineDecorationProps, type StickySpecs, type SupportedLanguages, THEME_CSS_ATTRIBUTE, type TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, type ThemeTypes, type ThemedDiffResult, type ThemedFileResult, type ThemedToken, type ThemesType, type TokenEventBase, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnifiedInjectedRowPlacement, UnifiedLineDecorationProps, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps, VIRTUALIZED_FILE_DIFF_LAYOUT_CHECKPOINT_INTERVAL, type VirtualFileMetrics, type VirtualWindowSpecs, VirtualizedFile, VirtualizedFileDiff, Virtualizer, VirtualizerConfig, VirtualizerScrollOptions, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, clearRenderQueue, cloneFileDiffMetadata, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, hydratePartialDiff, isDefaultRenderRange, isDiffAnnotation, isDiffAnnotationCollection, isFileAnnotation, isFileAnnotationCollection, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
@@ -56,6 +56,7 @@ type CodeViewProps<LAnnotation = undefined> = ControlledCodeViewProps<LAnnotatio
56
56
  interface CodeViewHandle<LAnnotation> {
57
57
  addItems(items: readonly CodeViewItem<LAnnotation>[]): void;
58
58
  getItem(id: string): CodeViewItem<LAnnotation> | undefined;
59
+ removeItem(id: string): boolean;
59
60
  updateItem(item: CodeViewItem<LAnnotation>): boolean;
60
61
  updateItemId(oldId: string, newId: string): boolean;
61
62
  scrollTo(target: CodeViewScrollTarget): void;
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.d.ts","names":[],"sources":["../../src/react/CodeView.tsx"],"mappings":";;;;;;;KA+CK,2BAAA,UACM,oBAAA,+BACA,oBAAoB;AAAA,KAEnB,oBAAA,4BAAgD,IAAA,CAC1D,eAAA,CAAgB,WAAA;AAAA,UAIR,iBAAA;EACR,OAAA,GAAU,oBAAA,CAAqB,WAAA;;;AArBf;;EA0BhB,aAAA,GAAgB,IAAA,CAAK,aAAA,CAAc,WAAA;EACnC,SAAA;EACA,KAAA,GAAQ,aAAA;EACR,YAAA,GAAe,GAAA,CAAI,cAAA;EACnB,iBAAA;EACA,aAAA,GAAgB,qBAAA;EAChB,qBAAA,EAAuB,SAAA,EAAW,qBAAA;EAClC,QAAA,EAAU,SAAA,UAAmB,MAAA,EAAQ,UAAA,CAAc,WAAA;EAlBO;;EAqB1D,oBAAA,KAAyB,SAAA;EArBM;;EAwB/B,oBAAA,KAAyB,SAAA;EAvBT;EAyBhB,gBAAA,EACE,IAAA,EAAM,YAAA,CAAa,WAAA,GACnB,IAAA,EAAM,YAAA,EACN,eAAA,GACI,cAAA,CAAe,WAAA,MACf,kBAAA,CAAmB,WAAA;EA9BE;AAE3B;;;;;;EAqCA,kBAAA,EACE,IAAA,EAAM,YAAA,CAAa,WAAA,GACnB,IAAA,EAAM,YAAA,EACN,eAAA,GACI,cAAA,CAAe,WAAA,MACf,kBAAA,CAAmB,WAAA;EAEzB,kBA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SAAA;EACxD,gBAAA,EACE,UAAA,EAAY,cAAA,CAAe,WAAA,IAAe,kBAAA,CAAmB,WAAA,GAC7D,IAAA,EAAM,YAAA,CAAa,WAAA,IAClB,SAAA;EACH,mBAAA,EACE,cAAA,EAAgB,2BAAA,EAChB,IAAA,EAAM,YAAA,CAAa,WAAA,IAClB,SAAA;AAAA;AAAA,UAGY,uBAAA,sBAEP,iBAAA,CAAkB,WAAA;EAC1B,KAAA,WAAgB,YAAA,CAAa,WAAA;EAC7B,YAAA;AAAA;AAAA,UAGe,yBAAA,sBAEP,iBAAA,CAAkB,WAAA;EAG1B,YAAA,YAAwB,YAAA,CAAa,WAAA;EACrC,KAAA;AAAA;AAAA,KAGU,aAAA,4BACR,uBAAA,CAAwB,WAAA,IACxB,yBAAA,CAA0B,WAAA;AAAA,UAEb,cAAA;EACf,QAAA,CAAS,KAAA,WAAgB,YAAA,CAAa,WAAA;EACtC,OAAA,CAAQ,EAAA,WAAa,YAAA,CAAa,WAAA;EAClC,UAAA,CAAW,EAAA;EACX,UAAA,CAAW,IAAA,EAAM,YAAA,CAAa,WAAA;EAC9B,YAAA,CAAa,KAAA,UAAe,KAAA;EAC5B,QAAA,CAAS,MAAA,EAAQ,oBAAA;EACjB,gBAAA,CAAiB,SAAA,EAAW,qBAAA;EAC5B,gBAAA,IAAoB,qBAAA;EACpB,kBAAA;EACA,SAAA,CAAU,EAAA,WAAa,WAAA,CAAY,WAAA;EACnC,WAAA,IAAe,UAAA,CAAc,WAAA;AAAA;AAAA,KAG1B,iBAAA,6BACH,KAAA,EAAO,aAAA,CAAc,WAAA;EACnB,GAAA,GAAM,KAAA,CAAM,GAAA,CAAI,cAAA,CAAe,WAAA;AAAA,MAE9B,KAAA,CAAM,GAAA,CAAI,OAAA;AAAA,cAueF,QAAA,EAAwC,iBAAiB"}
@@ -182,6 +182,15 @@ function CodeViewInner(props, ref) {
182
182
  return;
183
183
  } else return instance.getItem(id);
184
184
  },
185
+ removeItem(id) {
186
+ const { controlled, instance } = cachedDataRef.current;
187
+ assertUncontrolledCodeViewAction(controlled, "removeItem");
188
+ if (instance == null) {
189
+ console.error("CodeView.removeItem: no valid instance to remove item from", id);
190
+ return false;
191
+ }
192
+ return instance.removeItem(id);
193
+ },
185
194
  updateItem(item) {
186
195
  const { controlled, instance } = cachedDataRef.current;
187
196
  assertUncontrolledCodeViewAction(controlled, "updateItem");
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.js","names":["CodeViewClass"],"sources":["../../src/react/CodeView.tsx"],"sourcesContent":["'use client';\n\nimport {\n type CSSProperties,\n forwardRef,\n memo,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal, flushSync } from 'react-dom';\n\nimport type { EditorOptions } from '../edit';\nimport {\n areOptionsEqual,\n CodeView as CodeViewClass,\n type CodeViewCoordinator,\n type CodeViewCreateEditorOptions,\n type CodeViewItem,\n type CodeViewLineSelection,\n type CodeViewOptions,\n type CodeViewRenderedItem,\n type CodeViewScrollTarget,\n type CodeViewSlotSnapshot,\n type DiffLineAnnotation,\n type DiffsEditor,\n type FileContents,\n type GetHoveredLineResult,\n type LineAnnotation,\n} from '../index';\nimport { areManagedSnapshotsEqual } from '../utils/areManagedSnapshotsEqual';\nimport { useCreateEditor } from './EditContext';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { renderFileChildren } from './utils/renderFileChildren';\nimport { useStableCallback } from './utils/useStableCallback';\nimport { WorkerPoolContext } from './WorkerPoolContext';\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ntype CodeViewGutterUtilityGetter =\n | (() => GetHoveredLineResult<'file'> | undefined)\n | (() => GetHoveredLineResult<'diff'> | undefined);\n\nexport type CodeViewReactOptions<LAnnotation = undefined> = Omit<\n CodeViewOptions<LAnnotation>,\n 'controlledSelection' | 'createEditor' | 'onSelectedLinesChange'\n>;\n\ninterface CodeViewBaseProps<LAnnotation> {\n options?: CodeViewReactOptions<LAnnotation>;\n /**\n * Creation-time options passed to the nearest EditProvider factory.\n * CodeView supplies its item-specific change callback.\n */\n editorOptions?: Omit<EditorOptions<LAnnotation>, 'onChange'>;\n className?: string;\n style?: CSSProperties;\n containerRef?: Ref<HTMLDivElement>;\n disableWorkerPool?: boolean;\n selectedLines?: CodeViewLineSelection | null;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n onScroll?(scrollTop: number, viewer: CodeViewClass<LAnnotation>): void;\n /** Render a non-virtualized node at the very start of the scroll content,\n * before the first item. Always rendered; scrolls with the content. */\n renderCodeViewHeader?(): ReactNode;\n /** Render a non-virtualized node at the very end of the scroll content, after\n * the last item. Always rendered; scrolls with the content. */\n renderCodeViewFooter?(): ReactNode;\n /** Called with the owning item on every edited-document change. */\n onItemEditChange?(\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ): void;\n /**\n * Called once with the final contents when an item's edit session ends\n * (edit turned off, item removed or collapsed). Not called for sessions\n * that produced no changes. Committing is user-space: make one combined\n * item write carrying the new file/fileDiff (with a fresh `cacheKey`,\n * since the contents changed) along with `edit: false`.\n */\n onItemEditComplete?(\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ): void;\n renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderPrefix?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderFilenameSuffix?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderMetadata?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderAnnotation?(\n annotation: LineAnnotation<LAnnotation> | DiffLineAnnotation<LAnnotation>,\n item: CodeViewItem<LAnnotation>\n ): ReactNode;\n renderGutterUtility?(\n getHoveredLine: CodeViewGutterUtilityGetter,\n item: CodeViewItem<LAnnotation>\n ): ReactNode;\n}\n\nexport interface ControlledCodeViewProps<\n LAnnotation,\n> extends CodeViewBaseProps<LAnnotation> {\n items: readonly CodeViewItem<LAnnotation>[];\n initialItems?: never;\n}\n\nexport interface UncontrolledCodeViewProps<\n LAnnotation,\n> extends CodeViewBaseProps<LAnnotation> {\n // Seeds the imperative CodeView instance once. Later item changes should go\n // through the ref API instead of being reconciled from React props.\n initialItems?: readonly CodeViewItem<LAnnotation>[];\n items?: never;\n}\n\nexport type CodeViewProps<LAnnotation = undefined> =\n | ControlledCodeViewProps<LAnnotation>\n | UncontrolledCodeViewProps<LAnnotation>;\n\nexport interface CodeViewHandle<LAnnotation> {\n addItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n getItem(id: string): CodeViewItem<LAnnotation> | undefined;\n updateItem(item: CodeViewItem<LAnnotation>): boolean;\n updateItemId(oldId: string, newId: string): boolean;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(): void;\n getEditor(id: string): DiffsEditor<LAnnotation> | undefined;\n getInstance(): CodeViewClass<LAnnotation> | undefined;\n}\n\ntype CodeViewComponent = <LAnnotation = undefined>(\n props: CodeViewProps<LAnnotation> & {\n ref?: React.Ref<CodeViewHandle<LAnnotation>>;\n }\n) => React.JSX.Element;\n\ntype SlotPortalsComponent = <LAnnotation = undefined>(\n props: SlotPortalsProps<LAnnotation>\n) => React.JSX.Element;\n\ninterface ManagedContentStore<LAnnotation> {\n getSnapshot(): CodeViewSlotSnapshot<LAnnotation> | undefined;\n publish(snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined): void;\n subscribe(listener: () => void): () => void;\n}\n\ninterface CachedDataRef<LAnnotation> {\n instance: CodeViewClass<LAnnotation> | undefined;\n items: readonly CodeViewItem<LAnnotation>[] | undefined;\n controlled: boolean;\n managedOptions: CodeViewOptions<LAnnotation> | undefined;\n disableFlushSync: boolean;\n slotCoordinator: CodeViewCoordinator<LAnnotation> | undefined;\n}\n\nfunction createDefaultCache<LAnnotation>(\n controlled: boolean\n): CachedDataRef<LAnnotation> {\n return {\n instance: undefined,\n items: undefined,\n controlled,\n managedOptions: undefined,\n disableFlushSync: false,\n slotCoordinator: undefined,\n };\n}\n\nfunction CodeViewInner<LAnnotation = undefined>(\n props: CodeViewProps<LAnnotation>,\n ref: React.ForwardedRef<CodeViewHandle<LAnnotation>>\n): React.JSX.Element {\n const {\n className,\n containerRef,\n disableWorkerPool = false,\n editorOptions,\n initialItems,\n items: controlledItems,\n onItemEditChange,\n onItemEditComplete,\n onScroll,\n onSelectedLinesChange,\n options,\n renderAnnotation,\n renderCodeViewFooter,\n renderCodeViewHeader,\n renderCustomHeader,\n renderGutterUtility,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderHeaderPrefix,\n selectedLines,\n style,\n } = props;\n const controlled = controlledItems !== undefined;\n const contextCreateEditor = useCreateEditor<LAnnotation>();\n const poolManager = useContext(WorkerPoolContext);\n const cachedDataRef = useRef<CachedDataRef<LAnnotation>>(\n createDefaultCache<LAnnotation>(controlled)\n );\n const hasCustomHeader = renderCustomHeader != null;\n const hasAnnotationRenderer = renderAnnotation != null;\n const hasGutterRenderer = renderGutterUtility != null;\n const hasHeaderRenderers =\n hasCustomHeader ||\n renderHeaderPrefix != null ||\n renderHeaderFilenameSuffix != null ||\n renderHeaderMetadata != null;\n const hasRenderers =\n hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n const hasCodeViewHeader = renderCodeViewHeader != null;\n const hasCodeViewFooter = renderCodeViewFooter != null;\n const emitSelectedLinesChange = useStableCallback(\n (selection: CodeViewLineSelection | null) => {\n onSelectedLinesChange?.(selection);\n }\n );\n const controlledSelection = selectedLines !== undefined;\n\n // Keep the adapter stable so provider and editor-option changes affect the\n // next item edit session without forcing CodeView to reconcile active editors.\n const createEditor = useStableCallback(\n (\n options: CodeViewCreateEditorOptions<LAnnotation>\n ): DiffsEditor<LAnnotation> => {\n if (contextCreateEditor == null) {\n throw new Error('CodeView: EditContext is not attached');\n }\n\n const editor = contextCreateEditor({\n ...editorOptions,\n ...options,\n });\n if (editor == null) {\n throw new Error(\n 'CodeView: EditProvider.createEditor must return an editor instance'\n );\n }\n return editor;\n }\n );\n const emitItemEditChange = useStableCallback(\n (\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ) => {\n onItemEditChange?.(item, file, lineAnnotations);\n }\n );\n const emitItemEditComplete = useStableCallback(\n (\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ) => {\n onItemEditComplete?.(item, file, lineAnnotations);\n }\n );\n\n const managedOptions = useMemo(\n () =>\n createManagedCodeViewOptions({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n hasCodeViewHeader,\n hasCodeViewFooter,\n onSelectedLinesChange:\n onSelectedLinesChange != null ? emitSelectedLinesChange : undefined,\n controlledSelection,\n createEditor: contextCreateEditor != null ? createEditor : undefined,\n onItemEditChange:\n onItemEditChange != null ? emitItemEditChange : undefined,\n onItemEditComplete:\n onItemEditComplete != null ? emitItemEditComplete : undefined,\n }),\n [\n contextCreateEditor,\n controlledSelection,\n createEditor,\n emitItemEditChange,\n emitItemEditComplete,\n emitSelectedLinesChange,\n hasCodeViewFooter,\n hasCodeViewHeader,\n hasCustomHeader,\n hasGutterRenderer,\n onItemEditChange,\n onItemEditComplete,\n onSelectedLinesChange,\n options,\n ]\n );\n\n const [slotContentStore] = useState<ManagedContentStore<LAnnotation>>(() =>\n createSlotContentStore()\n );\n const [, forceUpdate] = useState<unknown>({});\n\n const nodeRef = useStableCallback((node: HTMLDivElement | null) => {\n // If we have a pre-existing instance and there's no node or the node being\n // passed in is NOT the same as before, then we need to clean up and\n // garbage collect the old instance\n if (\n cachedDataRef.current.instance != null &&\n (node == null ||\n node !== cachedDataRef.current.instance.getContainerElement())\n ) {\n cachedDataRef.current.instance.cleanUp();\n slotContentStore.publish(undefined);\n cachedDataRef.current = createDefaultCache<LAnnotation>(controlled);\n }\n\n // If our node matches the existing node then we should not attempt to\n // setup. This is a case that should never be possible to hit, but just in\n // case, lets make sure we don't re-setup an instance that is already setup\n // properly\n if (\n node != null &&\n node !== cachedDataRef.current.instance?.getContainerElement()\n ) {\n cachedDataRef.current.instance = new CodeViewClass<LAnnotation>(\n managedOptions,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n cachedDataRef.current.instance.setup(node);\n }\n\n if (typeof containerRef === 'function') {\n containerRef(node);\n } else if (containerRef != null) {\n containerRef.current = node;\n }\n });\n\n const onSnapshotChange = useStableCallback(\n (snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined) => {\n if (cachedDataRef.current.disableFlushSync) {\n slotContentStore.publish(snapshot);\n } else {\n flushSync(() => {\n slotContentStore.publish(snapshot);\n });\n }\n }\n );\n\n const slotCoordinator: CodeViewCoordinator<LAnnotation> | undefined =\n useMemo(() => {\n // A coordinator is needed whenever React portals anything — per-item\n // slots and codeview header and footer\n if (\n !hasHeaderRenderers &&\n !hasAnnotationRenderer &&\n !hasGutterRenderer &&\n !hasCodeViewHeader &&\n !hasCodeViewFooter\n ) {\n return undefined;\n } else {\n return {\n hasHeaderRenderers,\n hasAnnotationRenderer,\n hasGutterRenderer,\n onSnapshotChange,\n };\n }\n }, [\n onSnapshotChange,\n hasAnnotationRenderer,\n hasGutterRenderer,\n hasHeaderRenderers,\n hasCodeViewHeader,\n hasCodeViewFooter,\n ]);\n\n useIsomorphicLayoutEffect(() => {\n return onScroll != null\n ? cachedDataRef.current.instance?.subscribeToScroll(onScroll)\n : undefined;\n });\n\n useIsomorphicLayoutEffect(() => {\n const {\n instance,\n controlled: prevControlled,\n items: prevItems,\n managedOptions: prevManagedOptions,\n slotCoordinator: prevSlotCoordinator,\n } = cachedDataRef.current;\n if (instance == null) {\n return;\n }\n\n try {\n cachedDataRef.current.disableFlushSync = true;\n let shouldRender = false;\n\n if (!areOptionsEqual(managedOptions, prevManagedOptions)) {\n cachedDataRef.current.managedOptions = managedOptions;\n instance.setOptions(managedOptions);\n shouldRender = true;\n }\n\n if (prevControlled !== controlled) {\n console.error(\n 'CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.'\n );\n return;\n }\n\n if (controlled) {\n if (controlledItems !== prevItems) {\n if (areItemListsEqual(prevItems, controlledItems)) {\n cachedDataRef.current.items = controlledItems;\n } else if (isAppendOnlyItemUpdate(prevItems, controlledItems)) {\n cachedDataRef.current.items = controlledItems;\n instance.addItems(controlledItems.slice(prevItems.length));\n } else {\n cachedDataRef.current.items = controlledItems;\n instance.setItems(controlledItems);\n shouldRender = true;\n }\n }\n }\n // If uncontrolled, we should only ever set items once, and just depend\n // on imperative instance changes going forward\n else if (prevItems == null) {\n const seedItems = initialItems ?? [];\n cachedDataRef.current.items = seedItems;\n if (seedItems.length > 0) {\n instance.setItems(seedItems);\n shouldRender = true;\n }\n }\n\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines, { notify: false });\n }\n\n const slotPublish = instance.setSlotCoordinator(slotCoordinator);\n let forceInlinePublish = false;\n if (slotCoordinator !== prevSlotCoordinator) {\n if (slotCoordinator == null || prevSlotCoordinator == null) {\n forceInlinePublish = true;\n }\n cachedDataRef.current.slotCoordinator = slotCoordinator;\n }\n\n if (shouldRender || slotPublish) {\n instance.render(true);\n }\n\n // FIXME(amadeus): This feels kinda bad and flakey with regards to how\n // other things are working... it makes me think that we should\n // re-architect the slotCoordinator a bit, and maybe DON'T make it an\n // undefineable thing...\n if (slotPublish && slotCoordinator == null) {\n slotContentStore.publish(undefined);\n }\n\n if (forceInlinePublish) {\n forceUpdate({});\n }\n } finally {\n cachedDataRef.current.disableFlushSync = false;\n }\n });\n\n // Setup the ref handler\n useImperativeHandle(\n ref,\n (): CodeViewHandle<LAnnotation> => ({\n addItems(items) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'addItems');\n if (instance == null) {\n console.error(\n 'CodeView.addItems: no valid instance to append items with',\n items\n );\n } else {\n instance.addItems(items);\n }\n },\n getItem(id) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getItem: no valid instance exists', id);\n return undefined;\n } else {\n return instance.getItem(id);\n }\n },\n updateItem(item) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'updateItem');\n if (instance == null) {\n console.error(\n 'CodeView.updateItem: no valid instance to update item with',\n item\n );\n return false;\n }\n\n return instance.updateItem(item);\n },\n updateItemId(oldId, newId) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'updateItemId');\n if (instance == null) {\n console.error(\n 'CodeView.updateItemId: no valid instance to update item id with',\n oldId,\n newId\n );\n return false;\n }\n\n return instance.updateItemId(oldId, newId);\n },\n scrollTo(target) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.scrollTo: no valid instance to scroll with',\n target\n );\n } else {\n instance.scrollTo(target);\n }\n },\n setSelectedLines(selection) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.setSelectedLines: no valid instance to update selection with',\n selection\n );\n } else {\n instance.setSelectedLines(selection, { notify: false });\n emitSelectedLinesChange(selection);\n }\n },\n getSelectedLines() {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getSelectedLines: no valid instance exists');\n return null;\n } else {\n return instance.getSelectedLines();\n }\n },\n clearSelectedLines() {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.clearSelectedLines: no valid instance to update selection with'\n );\n } else {\n instance.clearSelectedLines({ notify: false });\n emitSelectedLinesChange(null);\n }\n },\n getEditor(id) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getEditor: no valid instance exists', id);\n return undefined;\n }\n\n return instance.getEditor(id);\n },\n getInstance() {\n return cachedDataRef.current.instance;\n },\n }),\n [emitSelectedLinesChange]\n );\n\n return (\n <>\n <div ref={nodeRef} className={className} style={style} />\n {(hasRenderers || hasCodeViewHeader || hasCodeViewFooter) && (\n <SlotPortals<LAnnotation>\n managedContentStore={slotContentStore}\n renderCustomHeader={renderCustomHeader}\n renderHeaderPrefix={renderHeaderPrefix}\n renderHeaderFilenameSuffix={renderHeaderFilenameSuffix}\n renderHeaderMetadata={renderHeaderMetadata}\n renderAnnotation={renderAnnotation}\n renderGutterUtility={renderGutterUtility}\n renderCodeViewHeader={renderCodeViewHeader}\n renderCodeViewFooter={renderCodeViewFooter}\n />\n )}\n </>\n );\n}\n\n// React was a mistake\nexport const CodeView = forwardRef(CodeViewInner) as CodeViewComponent;\n\nfunction isAppendOnlyItemUpdate<LAnnotation>(\n previousItems: readonly CodeViewItem<LAnnotation>[] | undefined,\n nextItems: readonly CodeViewItem<LAnnotation>[]\n): previousItems is readonly CodeViewItem<LAnnotation>[] {\n if (previousItems == null || nextItems.length <= previousItems.length) {\n return false;\n }\n\n if (previousItems.length === 0) {\n return true;\n }\n\n for (let index = 0; index < previousItems.length; index++) {\n if (nextItems[index] !== previousItems[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areItemListsEqual<LAnnotation>(\n previousItems: readonly CodeViewItem<LAnnotation>[] | undefined,\n nextItems: readonly CodeViewItem<LAnnotation>[]\n): boolean {\n if (previousItems == null || previousItems.length !== nextItems.length) {\n return false;\n }\n\n for (let index = 0; index < previousItems.length; index++) {\n if (previousItems[index] !== nextItems[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction assertUncontrolledCodeViewAction(\n controlled: boolean,\n action: string\n): void {\n if (!controlled) {\n return;\n }\n\n throw new Error(\n `CodeView.${action} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`\n );\n}\n\nfunction createSlotContentStore<\n LAnnotation,\n>(): ManagedContentStore<LAnnotation> {\n let snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined;\n const listeners = new Set<() => void>();\n\n return {\n getSnapshot() {\n return snapshot;\n },\n publish(nextSnapshot) {\n if (areManagedSnapshotsEqual(snapshot, nextSnapshot)) {\n return;\n }\n\n snapshot = nextSnapshot;\n for (const listener of listeners) {\n listener();\n }\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\ninterface CreateManagedCodeViewOptionsProps<LAnnotation> {\n options: CodeViewReactOptions<LAnnotation> | undefined;\n hasCustomHeader: boolean;\n hasGutterRenderer: boolean;\n hasCodeViewHeader: boolean;\n hasCodeViewFooter: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n controlledSelection: boolean;\n createEditor: CodeViewOptions<LAnnotation>['createEditor'];\n onItemEditChange: CodeViewOptions<LAnnotation>['onItemEditChange'];\n onItemEditComplete: CodeViewOptions<LAnnotation>['onItemEditComplete'];\n}\n\nfunction createManagedCodeViewOptions<LAnnotation>({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n hasCodeViewHeader,\n hasCodeViewFooter,\n onSelectedLinesChange,\n controlledSelection,\n createEditor,\n onItemEditChange,\n onItemEditComplete,\n}: CreateManagedCodeViewOptionsProps<LAnnotation>): CodeViewOptions<LAnnotation> {\n const managedOptions: CodeViewOptions<LAnnotation> = {\n ...options,\n controlledSelection,\n onSelectedLinesChange,\n createEditor,\n };\n\n // Prop-level editor callbacks win over their options-object counterparts,\n // but an absent prop must not clobber a value provided via `options`.\n if (onItemEditChange != null) {\n managedOptions.onItemEditChange = onItemEditChange;\n }\n if (onItemEditComplete != null) {\n managedOptions.onItemEditComplete = onItemEditComplete;\n }\n\n // The imperative CodeView adapters use this callback's presence to\n // switch file and diff headers into custom-slot mode. React portals\n // provide the actual header content, so this placeholder\n // intentionally returns nothing.\n if (hasCustomHeader) {\n managedOptions.renderCustomHeader = noopRender;\n }\n\n // The imperative CodeView adapters use this callback's presence to\n // create the custom gutter utility slot. React portals provide the\n // actual content, so this placeholder intentionally returns nothing.\n if (hasGutterRenderer) {\n managedOptions.renderGutterUtility = noopRender;\n }\n\n // The imperative CodeView adapters use these callbacks' presence to create the\n // header/footer host elements. React portals the actual content into them (via\n // the slot snapshot), so these placeholders intentionally return nothing.\n if (hasCodeViewHeader) {\n managedOptions.renderCodeViewHeader = noopRender;\n }\n if (hasCodeViewFooter) {\n managedOptions.renderCodeViewFooter = noopRender;\n }\n\n return managedOptions;\n}\n\ninterface RenderCodeViewItemChildrenProps<LAnnotation> {\n renderedItem: CodeViewRenderedItem<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderFilenameSuffix: CodeViewBaseProps<LAnnotation>['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n}\n\ninterface SlotPortalsProps<LAnnotation> {\n managedContentStore: ManagedContentStore<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderFilenameSuffix: CodeViewBaseProps<LAnnotation>['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n renderCodeViewHeader: CodeViewBaseProps<LAnnotation>['renderCodeViewHeader'];\n renderCodeViewFooter: CodeViewBaseProps<LAnnotation>['renderCodeViewFooter'];\n}\n\nconst SlotPortals = memo(function SlotPortals<LAnnotation>({\n managedContentStore,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n renderCodeViewHeader,\n renderCodeViewFooter,\n}: SlotPortalsProps<LAnnotation>) {\n 'use no memo';\n const subscribe = useStableCallback((listener: () => void) =>\n managedContentStore.subscribe(listener)\n );\n const getSnapshot = useStableCallback(() =>\n managedContentStore.getSnapshot()\n );\n const snapshot = useSyncExternalStore<\n CodeViewSlotSnapshot<LAnnotation> | undefined\n >(subscribe, getSnapshot, getSnapshot);\n let itemKeys = '';\n for (const item of snapshot?.items ?? []) {\n itemKeys += `${item.id}:${item.version}:${item.type}`;\n }\n // NOTE(amadeus): And just like that, the react compiler do be failing us\n // lol... we need to pre-render everything for items, headers and footers to\n // not trigger needless renders while scrolling\n const renderedItems = useMemo(\n () => {\n return snapshot?.items?.map((renderedItem) =>\n createPortal(\n renderCodeViewItemChildren({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n }),\n renderedItem.element,\n renderedItem.id\n )\n );\n },\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n [\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n itemKeys,\n ]\n );\n const renderedHeader = useMemo(() => {\n return renderCodeViewHeader != null && snapshot?.header != null\n ? createPortal(renderCodeViewHeader(), snapshot.header)\n : null;\n }, [renderCodeViewHeader, snapshot?.header]);\n const renderedFooter = useMemo(() => {\n return renderCodeViewFooter != null && snapshot?.footer != null\n ? createPortal(renderCodeViewFooter(), snapshot.footer)\n : null;\n }, [renderCodeViewFooter, snapshot?.footer]);\n return (\n <>\n {renderedItems}\n {renderedHeader}\n {renderedFooter}\n </>\n );\n}) as SlotPortalsComponent;\n\nfunction renderCodeViewItemChildren<LAnnotation>({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n}: RenderCodeViewItemChildrenProps<LAnnotation>): ReactNode {\n if (renderedItem.type === 'diff') {\n const { item, instance } = renderedItem;\n return renderDiffChildren({\n fileDiff: item.fileDiff,\n renderCustomHeader:\n renderCustomHeader != null ? () => renderCustomHeader(item) : undefined,\n renderHeaderPrefix:\n renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : undefined,\n renderHeaderFilenameSuffix:\n renderHeaderFilenameSuffix != null\n ? () => renderHeaderFilenameSuffix(item)\n : undefined,\n renderHeaderMetadata:\n renderHeaderMetadata != null\n ? () => renderHeaderMetadata(item)\n : undefined,\n renderAnnotation:\n renderAnnotation != null\n ? (annotation) => renderAnnotation(annotation, item)\n : undefined,\n lineAnnotations: item.annotations,\n renderGutterUtility:\n renderGutterUtility != null\n ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item)\n : undefined,\n getHoveredLine: instance.getHoveredLine,\n });\n } else {\n const { item, instance } = renderedItem;\n return renderFileChildren({\n file: item.file,\n renderCustomHeader:\n renderCustomHeader != null ? () => renderCustomHeader(item) : undefined,\n renderHeaderPrefix:\n renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : undefined,\n renderHeaderFilenameSuffix:\n renderHeaderFilenameSuffix != null\n ? () => renderHeaderFilenameSuffix(item)\n : undefined,\n renderHeaderMetadata:\n renderHeaderMetadata != null\n ? () => renderHeaderMetadata(item)\n : undefined,\n renderAnnotation:\n renderAnnotation != null\n ? (annotation) => renderAnnotation(annotation, item)\n : undefined,\n lineAnnotations: item.annotations,\n renderGutterUtility:\n renderGutterUtility != null\n ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item)\n : undefined,\n getHoveredLine: instance.getHoveredLine,\n });\n }\n}\n\nfunction noopRender() {\n return undefined;\n}\n"],"mappings":";;;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B,IAAI,IACrC,KAAA;GACN,sBACE,wBAAwB,aACd,qBAAqB,IAAI,IAC/B,KAAA;GACN,kBACE,oBAAoB,QACf,eAAe,iBAAiB,YAAY,IAAI,IACjD,KAAA;GACN,iBAAiB,KAAK;GACtB,qBACE,uBAAuB,QAClB,mBAAmB,oBAAoB,gBAAgB,IAAI,IAC5D,KAAA;GACN,gBAAgB,SAAS;EAC3B,CAAC;CACH;AACF;AAEA,SAAS,aAAa,CAEtB"}
1
+ {"version":3,"file":"CodeView.js","names":["CodeViewClass"],"sources":["../../src/react/CodeView.tsx"],"sourcesContent":["'use client';\n\nimport {\n type CSSProperties,\n forwardRef,\n memo,\n type ReactNode,\n type Ref,\n useContext,\n useEffect,\n useImperativeHandle,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal, flushSync } from 'react-dom';\n\nimport type { EditorOptions } from '../edit';\nimport {\n areOptionsEqual,\n CodeView as CodeViewClass,\n type CodeViewCoordinator,\n type CodeViewCreateEditorOptions,\n type CodeViewItem,\n type CodeViewLineSelection,\n type CodeViewOptions,\n type CodeViewRenderedItem,\n type CodeViewScrollTarget,\n type CodeViewSlotSnapshot,\n type DiffLineAnnotation,\n type DiffsEditor,\n type FileContents,\n type GetHoveredLineResult,\n type LineAnnotation,\n} from '../index';\nimport { areManagedSnapshotsEqual } from '../utils/areManagedSnapshotsEqual';\nimport { useCreateEditor } from './EditContext';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { renderFileChildren } from './utils/renderFileChildren';\nimport { useStableCallback } from './utils/useStableCallback';\nimport { WorkerPoolContext } from './WorkerPoolContext';\n\nconst useIsomorphicLayoutEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ntype CodeViewGutterUtilityGetter =\n | (() => GetHoveredLineResult<'file'> | undefined)\n | (() => GetHoveredLineResult<'diff'> | undefined);\n\nexport type CodeViewReactOptions<LAnnotation = undefined> = Omit<\n CodeViewOptions<LAnnotation>,\n 'controlledSelection' | 'createEditor' | 'onSelectedLinesChange'\n>;\n\ninterface CodeViewBaseProps<LAnnotation> {\n options?: CodeViewReactOptions<LAnnotation>;\n /**\n * Creation-time options passed to the nearest EditProvider factory.\n * CodeView supplies its item-specific change callback.\n */\n editorOptions?: Omit<EditorOptions<LAnnotation>, 'onChange'>;\n className?: string;\n style?: CSSProperties;\n containerRef?: Ref<HTMLDivElement>;\n disableWorkerPool?: boolean;\n selectedLines?: CodeViewLineSelection | null;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n onScroll?(scrollTop: number, viewer: CodeViewClass<LAnnotation>): void;\n /** Render a non-virtualized node at the very start of the scroll content,\n * before the first item. Always rendered; scrolls with the content. */\n renderCodeViewHeader?(): ReactNode;\n /** Render a non-virtualized node at the very end of the scroll content, after\n * the last item. Always rendered; scrolls with the content. */\n renderCodeViewFooter?(): ReactNode;\n /** Called with the owning item on every edited-document change. */\n onItemEditChange?(\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ): void;\n /**\n * Called once with the final contents when an item's edit session ends\n * (edit turned off, item removed or collapsed). Not called for sessions\n * that produced no changes. Committing is user-space: make one combined\n * item write carrying the new file/fileDiff (with a fresh `cacheKey`,\n * since the contents changed) along with `edit: false`.\n */\n onItemEditComplete?(\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ): void;\n renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderPrefix?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderFilenameSuffix?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderMetadata?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderAnnotation?(\n annotation: LineAnnotation<LAnnotation> | DiffLineAnnotation<LAnnotation>,\n item: CodeViewItem<LAnnotation>\n ): ReactNode;\n renderGutterUtility?(\n getHoveredLine: CodeViewGutterUtilityGetter,\n item: CodeViewItem<LAnnotation>\n ): ReactNode;\n}\n\nexport interface ControlledCodeViewProps<\n LAnnotation,\n> extends CodeViewBaseProps<LAnnotation> {\n items: readonly CodeViewItem<LAnnotation>[];\n initialItems?: never;\n}\n\nexport interface UncontrolledCodeViewProps<\n LAnnotation,\n> extends CodeViewBaseProps<LAnnotation> {\n // Seeds the imperative CodeView instance once. Later item changes should go\n // through the ref API instead of being reconciled from React props.\n initialItems?: readonly CodeViewItem<LAnnotation>[];\n items?: never;\n}\n\nexport type CodeViewProps<LAnnotation = undefined> =\n | ControlledCodeViewProps<LAnnotation>\n | UncontrolledCodeViewProps<LAnnotation>;\n\nexport interface CodeViewHandle<LAnnotation> {\n addItems(items: readonly CodeViewItem<LAnnotation>[]): void;\n getItem(id: string): CodeViewItem<LAnnotation> | undefined;\n removeItem(id: string): boolean;\n updateItem(item: CodeViewItem<LAnnotation>): boolean;\n updateItemId(oldId: string, newId: string): boolean;\n scrollTo(target: CodeViewScrollTarget): void;\n setSelectedLines(selection: CodeViewLineSelection | null): void;\n getSelectedLines(): CodeViewLineSelection | null;\n clearSelectedLines(): void;\n getEditor(id: string): DiffsEditor<LAnnotation> | undefined;\n getInstance(): CodeViewClass<LAnnotation> | undefined;\n}\n\ntype CodeViewComponent = <LAnnotation = undefined>(\n props: CodeViewProps<LAnnotation> & {\n ref?: React.Ref<CodeViewHandle<LAnnotation>>;\n }\n) => React.JSX.Element;\n\ntype SlotPortalsComponent = <LAnnotation = undefined>(\n props: SlotPortalsProps<LAnnotation>\n) => React.JSX.Element;\n\ninterface ManagedContentStore<LAnnotation> {\n getSnapshot(): CodeViewSlotSnapshot<LAnnotation> | undefined;\n publish(snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined): void;\n subscribe(listener: () => void): () => void;\n}\n\ninterface CachedDataRef<LAnnotation> {\n instance: CodeViewClass<LAnnotation> | undefined;\n items: readonly CodeViewItem<LAnnotation>[] | undefined;\n controlled: boolean;\n managedOptions: CodeViewOptions<LAnnotation> | undefined;\n disableFlushSync: boolean;\n slotCoordinator: CodeViewCoordinator<LAnnotation> | undefined;\n}\n\nfunction createDefaultCache<LAnnotation>(\n controlled: boolean\n): CachedDataRef<LAnnotation> {\n return {\n instance: undefined,\n items: undefined,\n controlled,\n managedOptions: undefined,\n disableFlushSync: false,\n slotCoordinator: undefined,\n };\n}\n\nfunction CodeViewInner<LAnnotation = undefined>(\n props: CodeViewProps<LAnnotation>,\n ref: React.ForwardedRef<CodeViewHandle<LAnnotation>>\n): React.JSX.Element {\n const {\n className,\n containerRef,\n disableWorkerPool = false,\n editorOptions,\n initialItems,\n items: controlledItems,\n onItemEditChange,\n onItemEditComplete,\n onScroll,\n onSelectedLinesChange,\n options,\n renderAnnotation,\n renderCodeViewFooter,\n renderCodeViewHeader,\n renderCustomHeader,\n renderGutterUtility,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderHeaderPrefix,\n selectedLines,\n style,\n } = props;\n const controlled = controlledItems !== undefined;\n const contextCreateEditor = useCreateEditor<LAnnotation>();\n const poolManager = useContext(WorkerPoolContext);\n const cachedDataRef = useRef<CachedDataRef<LAnnotation>>(\n createDefaultCache<LAnnotation>(controlled)\n );\n const hasCustomHeader = renderCustomHeader != null;\n const hasAnnotationRenderer = renderAnnotation != null;\n const hasGutterRenderer = renderGutterUtility != null;\n const hasHeaderRenderers =\n hasCustomHeader ||\n renderHeaderPrefix != null ||\n renderHeaderFilenameSuffix != null ||\n renderHeaderMetadata != null;\n const hasRenderers =\n hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n const hasCodeViewHeader = renderCodeViewHeader != null;\n const hasCodeViewFooter = renderCodeViewFooter != null;\n const emitSelectedLinesChange = useStableCallback(\n (selection: CodeViewLineSelection | null) => {\n onSelectedLinesChange?.(selection);\n }\n );\n const controlledSelection = selectedLines !== undefined;\n\n // Keep the adapter stable so provider and editor-option changes affect the\n // next item edit session without forcing CodeView to reconcile active editors.\n const createEditor = useStableCallback(\n (\n options: CodeViewCreateEditorOptions<LAnnotation>\n ): DiffsEditor<LAnnotation> => {\n if (contextCreateEditor == null) {\n throw new Error('CodeView: EditContext is not attached');\n }\n\n const editor = contextCreateEditor({\n ...editorOptions,\n ...options,\n });\n if (editor == null) {\n throw new Error(\n 'CodeView: EditProvider.createEditor must return an editor instance'\n );\n }\n return editor;\n }\n );\n const emitItemEditChange = useStableCallback(\n (\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ) => {\n onItemEditChange?.(item, file, lineAnnotations);\n }\n );\n const emitItemEditComplete = useStableCallback(\n (\n item: CodeViewItem<LAnnotation>,\n file: FileContents,\n lineAnnotations?:\n | LineAnnotation<LAnnotation>[]\n | DiffLineAnnotation<LAnnotation>[]\n ) => {\n onItemEditComplete?.(item, file, lineAnnotations);\n }\n );\n\n const managedOptions = useMemo(\n () =>\n createManagedCodeViewOptions({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n hasCodeViewHeader,\n hasCodeViewFooter,\n onSelectedLinesChange:\n onSelectedLinesChange != null ? emitSelectedLinesChange : undefined,\n controlledSelection,\n createEditor: contextCreateEditor != null ? createEditor : undefined,\n onItemEditChange:\n onItemEditChange != null ? emitItemEditChange : undefined,\n onItemEditComplete:\n onItemEditComplete != null ? emitItemEditComplete : undefined,\n }),\n [\n contextCreateEditor,\n controlledSelection,\n createEditor,\n emitItemEditChange,\n emitItemEditComplete,\n emitSelectedLinesChange,\n hasCodeViewFooter,\n hasCodeViewHeader,\n hasCustomHeader,\n hasGutterRenderer,\n onItemEditChange,\n onItemEditComplete,\n onSelectedLinesChange,\n options,\n ]\n );\n\n const [slotContentStore] = useState<ManagedContentStore<LAnnotation>>(() =>\n createSlotContentStore()\n );\n const [, forceUpdate] = useState<unknown>({});\n\n const nodeRef = useStableCallback((node: HTMLDivElement | null) => {\n // If we have a pre-existing instance and there's no node or the node being\n // passed in is NOT the same as before, then we need to clean up and\n // garbage collect the old instance\n if (\n cachedDataRef.current.instance != null &&\n (node == null ||\n node !== cachedDataRef.current.instance.getContainerElement())\n ) {\n cachedDataRef.current.instance.cleanUp();\n slotContentStore.publish(undefined);\n cachedDataRef.current = createDefaultCache<LAnnotation>(controlled);\n }\n\n // If our node matches the existing node then we should not attempt to\n // setup. This is a case that should never be possible to hit, but just in\n // case, lets make sure we don't re-setup an instance that is already setup\n // properly\n if (\n node != null &&\n node !== cachedDataRef.current.instance?.getContainerElement()\n ) {\n cachedDataRef.current.instance = new CodeViewClass<LAnnotation>(\n managedOptions,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n cachedDataRef.current.instance.setup(node);\n }\n\n if (typeof containerRef === 'function') {\n containerRef(node);\n } else if (containerRef != null) {\n containerRef.current = node;\n }\n });\n\n const onSnapshotChange = useStableCallback(\n (snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined) => {\n if (cachedDataRef.current.disableFlushSync) {\n slotContentStore.publish(snapshot);\n } else {\n flushSync(() => {\n slotContentStore.publish(snapshot);\n });\n }\n }\n );\n\n const slotCoordinator: CodeViewCoordinator<LAnnotation> | undefined =\n useMemo(() => {\n // A coordinator is needed whenever React portals anything — per-item\n // slots and codeview header and footer\n if (\n !hasHeaderRenderers &&\n !hasAnnotationRenderer &&\n !hasGutterRenderer &&\n !hasCodeViewHeader &&\n !hasCodeViewFooter\n ) {\n return undefined;\n } else {\n return {\n hasHeaderRenderers,\n hasAnnotationRenderer,\n hasGutterRenderer,\n onSnapshotChange,\n };\n }\n }, [\n onSnapshotChange,\n hasAnnotationRenderer,\n hasGutterRenderer,\n hasHeaderRenderers,\n hasCodeViewHeader,\n hasCodeViewFooter,\n ]);\n\n useIsomorphicLayoutEffect(() => {\n return onScroll != null\n ? cachedDataRef.current.instance?.subscribeToScroll(onScroll)\n : undefined;\n });\n\n useIsomorphicLayoutEffect(() => {\n const {\n instance,\n controlled: prevControlled,\n items: prevItems,\n managedOptions: prevManagedOptions,\n slotCoordinator: prevSlotCoordinator,\n } = cachedDataRef.current;\n if (instance == null) {\n return;\n }\n\n try {\n cachedDataRef.current.disableFlushSync = true;\n let shouldRender = false;\n\n if (!areOptionsEqual(managedOptions, prevManagedOptions)) {\n cachedDataRef.current.managedOptions = managedOptions;\n instance.setOptions(managedOptions);\n shouldRender = true;\n }\n\n if (prevControlled !== controlled) {\n console.error(\n 'CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.'\n );\n return;\n }\n\n if (controlled) {\n if (controlledItems !== prevItems) {\n if (areItemListsEqual(prevItems, controlledItems)) {\n cachedDataRef.current.items = controlledItems;\n } else if (isAppendOnlyItemUpdate(prevItems, controlledItems)) {\n cachedDataRef.current.items = controlledItems;\n instance.addItems(controlledItems.slice(prevItems.length));\n } else {\n cachedDataRef.current.items = controlledItems;\n instance.setItems(controlledItems);\n shouldRender = true;\n }\n }\n }\n // If uncontrolled, we should only ever set items once, and just depend\n // on imperative instance changes going forward\n else if (prevItems == null) {\n const seedItems = initialItems ?? [];\n cachedDataRef.current.items = seedItems;\n if (seedItems.length > 0) {\n instance.setItems(seedItems);\n shouldRender = true;\n }\n }\n\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines, { notify: false });\n }\n\n const slotPublish = instance.setSlotCoordinator(slotCoordinator);\n let forceInlinePublish = false;\n if (slotCoordinator !== prevSlotCoordinator) {\n if (slotCoordinator == null || prevSlotCoordinator == null) {\n forceInlinePublish = true;\n }\n cachedDataRef.current.slotCoordinator = slotCoordinator;\n }\n\n if (shouldRender || slotPublish) {\n instance.render(true);\n }\n\n // FIXME(amadeus): This feels kinda bad and flakey with regards to how\n // other things are working... it makes me think that we should\n // re-architect the slotCoordinator a bit, and maybe DON'T make it an\n // undefineable thing...\n if (slotPublish && slotCoordinator == null) {\n slotContentStore.publish(undefined);\n }\n\n if (forceInlinePublish) {\n forceUpdate({});\n }\n } finally {\n cachedDataRef.current.disableFlushSync = false;\n }\n });\n\n // Setup the ref handler\n useImperativeHandle(\n ref,\n (): CodeViewHandle<LAnnotation> => ({\n addItems(items) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'addItems');\n if (instance == null) {\n console.error(\n 'CodeView.addItems: no valid instance to append items with',\n items\n );\n } else {\n instance.addItems(items);\n }\n },\n getItem(id) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getItem: no valid instance exists', id);\n return undefined;\n } else {\n return instance.getItem(id);\n }\n },\n removeItem(id) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'removeItem');\n if (instance == null) {\n console.error(\n 'CodeView.removeItem: no valid instance to remove item from',\n id\n );\n return false;\n }\n\n return instance.removeItem(id);\n },\n updateItem(item) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'updateItem');\n if (instance == null) {\n console.error(\n 'CodeView.updateItem: no valid instance to update item with',\n item\n );\n return false;\n }\n\n return instance.updateItem(item);\n },\n updateItemId(oldId, newId) {\n const { controlled, instance } = cachedDataRef.current;\n assertUncontrolledCodeViewAction(controlled, 'updateItemId');\n if (instance == null) {\n console.error(\n 'CodeView.updateItemId: no valid instance to update item id with',\n oldId,\n newId\n );\n return false;\n }\n\n return instance.updateItemId(oldId, newId);\n },\n scrollTo(target) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.scrollTo: no valid instance to scroll with',\n target\n );\n } else {\n instance.scrollTo(target);\n }\n },\n setSelectedLines(selection) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.setSelectedLines: no valid instance to update selection with',\n selection\n );\n } else {\n instance.setSelectedLines(selection, { notify: false });\n emitSelectedLinesChange(selection);\n }\n },\n getSelectedLines() {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getSelectedLines: no valid instance exists');\n return null;\n } else {\n return instance.getSelectedLines();\n }\n },\n clearSelectedLines() {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error(\n 'CodeView.clearSelectedLines: no valid instance to update selection with'\n );\n } else {\n instance.clearSelectedLines({ notify: false });\n emitSelectedLinesChange(null);\n }\n },\n getEditor(id) {\n const { instance } = cachedDataRef.current;\n if (instance == null) {\n console.error('CodeView.getEditor: no valid instance exists', id);\n return undefined;\n }\n\n return instance.getEditor(id);\n },\n getInstance() {\n return cachedDataRef.current.instance;\n },\n }),\n [emitSelectedLinesChange]\n );\n\n return (\n <>\n <div ref={nodeRef} className={className} style={style} />\n {(hasRenderers || hasCodeViewHeader || hasCodeViewFooter) && (\n <SlotPortals<LAnnotation>\n managedContentStore={slotContentStore}\n renderCustomHeader={renderCustomHeader}\n renderHeaderPrefix={renderHeaderPrefix}\n renderHeaderFilenameSuffix={renderHeaderFilenameSuffix}\n renderHeaderMetadata={renderHeaderMetadata}\n renderAnnotation={renderAnnotation}\n renderGutterUtility={renderGutterUtility}\n renderCodeViewHeader={renderCodeViewHeader}\n renderCodeViewFooter={renderCodeViewFooter}\n />\n )}\n </>\n );\n}\n\n// React was a mistake\nexport const CodeView = forwardRef(CodeViewInner) as CodeViewComponent;\n\nfunction isAppendOnlyItemUpdate<LAnnotation>(\n previousItems: readonly CodeViewItem<LAnnotation>[] | undefined,\n nextItems: readonly CodeViewItem<LAnnotation>[]\n): previousItems is readonly CodeViewItem<LAnnotation>[] {\n if (previousItems == null || nextItems.length <= previousItems.length) {\n return false;\n }\n\n if (previousItems.length === 0) {\n return true;\n }\n\n for (let index = 0; index < previousItems.length; index++) {\n if (nextItems[index] !== previousItems[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction areItemListsEqual<LAnnotation>(\n previousItems: readonly CodeViewItem<LAnnotation>[] | undefined,\n nextItems: readonly CodeViewItem<LAnnotation>[]\n): boolean {\n if (previousItems == null || previousItems.length !== nextItems.length) {\n return false;\n }\n\n for (let index = 0; index < previousItems.length; index++) {\n if (previousItems[index] !== nextItems[index]) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction assertUncontrolledCodeViewAction(\n controlled: boolean,\n action: string\n): void {\n if (!controlled) {\n return;\n }\n\n throw new Error(\n `CodeView.${action} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`\n );\n}\n\nfunction createSlotContentStore<\n LAnnotation,\n>(): ManagedContentStore<LAnnotation> {\n let snapshot: CodeViewSlotSnapshot<LAnnotation> | undefined;\n const listeners = new Set<() => void>();\n\n return {\n getSnapshot() {\n return snapshot;\n },\n publish(nextSnapshot) {\n if (areManagedSnapshotsEqual(snapshot, nextSnapshot)) {\n return;\n }\n\n snapshot = nextSnapshot;\n for (const listener of listeners) {\n listener();\n }\n },\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\ninterface CreateManagedCodeViewOptionsProps<LAnnotation> {\n options: CodeViewReactOptions<LAnnotation> | undefined;\n hasCustomHeader: boolean;\n hasGutterRenderer: boolean;\n hasCodeViewHeader: boolean;\n hasCodeViewFooter: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n controlledSelection: boolean;\n createEditor: CodeViewOptions<LAnnotation>['createEditor'];\n onItemEditChange: CodeViewOptions<LAnnotation>['onItemEditChange'];\n onItemEditComplete: CodeViewOptions<LAnnotation>['onItemEditComplete'];\n}\n\nfunction createManagedCodeViewOptions<LAnnotation>({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n hasCodeViewHeader,\n hasCodeViewFooter,\n onSelectedLinesChange,\n controlledSelection,\n createEditor,\n onItemEditChange,\n onItemEditComplete,\n}: CreateManagedCodeViewOptionsProps<LAnnotation>): CodeViewOptions<LAnnotation> {\n const managedOptions: CodeViewOptions<LAnnotation> = {\n ...options,\n controlledSelection,\n onSelectedLinesChange,\n createEditor,\n };\n\n // Prop-level editor callbacks win over their options-object counterparts,\n // but an absent prop must not clobber a value provided via `options`.\n if (onItemEditChange != null) {\n managedOptions.onItemEditChange = onItemEditChange;\n }\n if (onItemEditComplete != null) {\n managedOptions.onItemEditComplete = onItemEditComplete;\n }\n\n // The imperative CodeView adapters use this callback's presence to\n // switch file and diff headers into custom-slot mode. React portals\n // provide the actual header content, so this placeholder\n // intentionally returns nothing.\n if (hasCustomHeader) {\n managedOptions.renderCustomHeader = noopRender;\n }\n\n // The imperative CodeView adapters use this callback's presence to\n // create the custom gutter utility slot. React portals provide the\n // actual content, so this placeholder intentionally returns nothing.\n if (hasGutterRenderer) {\n managedOptions.renderGutterUtility = noopRender;\n }\n\n // The imperative CodeView adapters use these callbacks' presence to create the\n // header/footer host elements. React portals the actual content into them (via\n // the slot snapshot), so these placeholders intentionally return nothing.\n if (hasCodeViewHeader) {\n managedOptions.renderCodeViewHeader = noopRender;\n }\n if (hasCodeViewFooter) {\n managedOptions.renderCodeViewFooter = noopRender;\n }\n\n return managedOptions;\n}\n\ninterface RenderCodeViewItemChildrenProps<LAnnotation> {\n renderedItem: CodeViewRenderedItem<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderFilenameSuffix: CodeViewBaseProps<LAnnotation>['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n}\n\ninterface SlotPortalsProps<LAnnotation> {\n managedContentStore: ManagedContentStore<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderFilenameSuffix: CodeViewBaseProps<LAnnotation>['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n renderCodeViewHeader: CodeViewBaseProps<LAnnotation>['renderCodeViewHeader'];\n renderCodeViewFooter: CodeViewBaseProps<LAnnotation>['renderCodeViewFooter'];\n}\n\nconst SlotPortals = memo(function SlotPortals<LAnnotation>({\n managedContentStore,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n renderCodeViewHeader,\n renderCodeViewFooter,\n}: SlotPortalsProps<LAnnotation>) {\n 'use no memo';\n const subscribe = useStableCallback((listener: () => void) =>\n managedContentStore.subscribe(listener)\n );\n const getSnapshot = useStableCallback(() =>\n managedContentStore.getSnapshot()\n );\n const snapshot = useSyncExternalStore<\n CodeViewSlotSnapshot<LAnnotation> | undefined\n >(subscribe, getSnapshot, getSnapshot);\n let itemKeys = '';\n for (const item of snapshot?.items ?? []) {\n itemKeys += `${item.id}:${item.version}:${item.type}`;\n }\n // NOTE(amadeus): And just like that, the react compiler do be failing us\n // lol... we need to pre-render everything for items, headers and footers to\n // not trigger needless renders while scrolling\n const renderedItems = useMemo(\n () => {\n return snapshot?.items?.map((renderedItem) =>\n createPortal(\n renderCodeViewItemChildren({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n }),\n renderedItem.element,\n renderedItem.id\n )\n );\n },\n // oxlint-disable-next-line react-hooks/exhaustive-deps\n [\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n itemKeys,\n ]\n );\n const renderedHeader = useMemo(() => {\n return renderCodeViewHeader != null && snapshot?.header != null\n ? createPortal(renderCodeViewHeader(), snapshot.header)\n : null;\n }, [renderCodeViewHeader, snapshot?.header]);\n const renderedFooter = useMemo(() => {\n return renderCodeViewFooter != null && snapshot?.footer != null\n ? createPortal(renderCodeViewFooter(), snapshot.footer)\n : null;\n }, [renderCodeViewFooter, snapshot?.footer]);\n return (\n <>\n {renderedItems}\n {renderedHeader}\n {renderedFooter}\n </>\n );\n}) as SlotPortalsComponent;\n\nfunction renderCodeViewItemChildren<LAnnotation>({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n}: RenderCodeViewItemChildrenProps<LAnnotation>): ReactNode {\n if (renderedItem.type === 'diff') {\n const { item, instance } = renderedItem;\n return renderDiffChildren({\n fileDiff: item.fileDiff,\n renderCustomHeader:\n renderCustomHeader != null ? () => renderCustomHeader(item) : undefined,\n renderHeaderPrefix:\n renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : undefined,\n renderHeaderFilenameSuffix:\n renderHeaderFilenameSuffix != null\n ? () => renderHeaderFilenameSuffix(item)\n : undefined,\n renderHeaderMetadata:\n renderHeaderMetadata != null\n ? () => renderHeaderMetadata(item)\n : undefined,\n renderAnnotation:\n renderAnnotation != null\n ? (annotation) => renderAnnotation(annotation, item)\n : undefined,\n lineAnnotations: item.annotations,\n renderGutterUtility:\n renderGutterUtility != null\n ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item)\n : undefined,\n getHoveredLine: instance.getHoveredLine,\n });\n } else {\n const { item, instance } = renderedItem;\n return renderFileChildren({\n file: item.file,\n renderCustomHeader:\n renderCustomHeader != null ? () => renderCustomHeader(item) : undefined,\n renderHeaderPrefix:\n renderHeaderPrefix != null ? () => renderHeaderPrefix(item) : undefined,\n renderHeaderFilenameSuffix:\n renderHeaderFilenameSuffix != null\n ? () => renderHeaderFilenameSuffix(item)\n : undefined,\n renderHeaderMetadata:\n renderHeaderMetadata != null\n ? () => renderHeaderMetadata(item)\n : undefined,\n renderAnnotation:\n renderAnnotation != null\n ? (annotation) => renderAnnotation(annotation, item)\n : undefined,\n lineAnnotations: item.annotations,\n renderGutterUtility:\n renderGutterUtility != null\n ? (getHoveredLine) => renderGutterUtility(getHoveredLine, item)\n : undefined,\n getHoveredLine: instance.getHoveredLine,\n });\n }\n}\n\nfunction noopRender() {\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;AA4CA,MAAM,4BACJ,OAAO,WAAW,cAAc,YAAY;AA8H9C,SAAS,mBACP,YAC4B;CAC5B,OAAO;EACL,UAAU,KAAA;EACV,OAAO,KAAA;EACP;EACA,gBAAgB,KAAA;EAChB,kBAAkB;EAClB,iBAAiB,KAAA;CACnB;AACF;AAEA,SAAS,cACP,OACA,KACmB;CACnB,MAAM,EACJ,WACA,cACA,oBAAoB,OACpB,eACA,cACA,OAAO,iBACP,kBACA,oBACA,UACA,uBACA,SACA,kBACA,sBACA,sBACA,oBACA,qBACA,4BACA,sBACA,oBACA,eACA,UACE;CACJ,MAAM,aAAa,oBAAoB,KAAA;CACvC,MAAM,sBAAsB,gBAA6B;CACzD,MAAM,cAAc,WAAW,iBAAiB;CAChD,MAAM,gBAAgB,OACpB,mBAAgC,UAAU,CAC5C;CACA,MAAM,kBAAkB,sBAAsB;CAC9C,MAAM,wBAAwB,oBAAoB;CAClD,MAAM,oBAAoB,uBAAuB;CACjD,MAAM,qBACJ,mBACA,sBAAsB,QACtB,8BAA8B,QAC9B,wBAAwB;CAC1B,MAAM,eACJ,sBAAsB,yBAAyB;CACjD,MAAM,oBAAoB,wBAAwB;CAClD,MAAM,oBAAoB,wBAAwB;CAClD,MAAM,0BAA0B,mBAC7B,cAA4C;EAC3C,wBAAwB,SAAS;CACnC,CACF;CACA,MAAM,sBAAsB,kBAAkB,KAAA;CAI9C,MAAM,eAAe,mBAEjB,YAC6B;EAC7B,IAAI,uBAAuB,MACzB,MAAM,IAAI,MAAM,uCAAuC;EAGzD,MAAM,SAAS,oBAAoB;GACjC,GAAG;GACH,GAAG;EACL,CAAC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GACN,kBACE,oBAAoB,QACf,eAAe,iBAAiB,YAAY,IAAI,IACjD,KAAA;GACN,iBAAiB,KAAK;GACtB,qBACE,uBAAuB,QAClB,mBAAmB,oBAAoB,gBAAgB,IAAI,IAC5D,KAAA;GACN,gBAAgB,SAAS;EAC3B,CAAC;CACH,OAAO;EACL,MAAM,EAAE,MAAM,aAAa;EAC3B,OAAO,mBAAmB;GACxB,MAAM,KAAK;GACX,oBACE,sBAAsB,aAAa,mBAAmB,IAAI,IAAI,KAAA;GAChE,oBACE,sBAAsB,aAAa,mBAAmB,IAAI,IAAI,KAAA;GAChE,4BACE,8BAA8B,aACpB,2BAA2B,IAAI,IACrC,KAAA;GACN,sBACE,wBAAwB,aACd,qBAAqB,IAAI,IAC/B,KAAA;GACN,kBACE,oBAAoB,QACf,eAAe,iBAAiB,YAAY,IAAI,IACjD,KAAA;GACN,iBAAiB,KAAK;GACtB,qBACE,uBAAuB,QAClB,mBAAmB,oBAAoB,gBAAgB,IAAI,IAC5D,KAAA;GACN,gBAAgB,SAAS;EAC3B,CAAC;CACH;AACF;AAEA,SAAS,aAAa,CAEtB"}
@@ -1,4 +1,4 @@
1
- import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
1
+ import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorChange, EditorChangeEvent, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, ResolvedTextEdit, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
2
2
  import { WorkerInitializationRenderOptions, WorkerPoolOptions } from "../worker/types.js";
3
3
  import { FileOptions } from "../components/File.js";
4
4
  import { CodeView, CodeViewHandle, CodeViewProps, CodeViewReactOptions, ControlledCodeViewProps, UncontrolledCodeViewProps } from "./CodeView.js";
@@ -18,4 +18,4 @@ import { templateRender } from "./utils/templateRender.js";
18
18
  import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
19
19
  import { useFileInstance } from "./utils/useFileInstance.js";
20
20
  import { useStableCallback } from "./utils/useStableCallback.js";
21
- export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeView, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewHandle, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewProps, CodeViewRangeScrollTarget, CodeViewReactOptions, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, ControlledCodeViewProps, CreateEditor, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffBasePropsReact, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditContext, EditProvider, EditProviderProps, EditableInstance, EditorActiveLineOptions, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileDiffProps, FileHeaderRenderMode, type FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, UncontrolledCodeViewProps, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, type WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, type WorkerPoolOptions, noopRender, renderDiffChildren, renderFileChildren, templateRender, useCreateEditor, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
21
+ export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeView, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewHandle, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewProps, CodeViewRangeScrollTarget, CodeViewReactOptions, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, ControlledCodeViewProps, CreateEditor, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffBasePropsReact, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditContext, EditProvider, EditProviderProps, EditableInstance, EditorActiveLineOptions, EditorChange, EditorChangeEvent, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileDiffProps, FileHeaderRenderMode, type FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, ResolvedTextEdit, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, UncontrolledCodeViewProps, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, type WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, type WorkerPoolOptions, noopRender, renderDiffChildren, renderFileChildren, templateRender, useCreateEditor, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
@@ -1,6 +1,6 @@
1
- import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
1
+ import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorChange, EditorChangeEvent, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, ResolvedTextEdit, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
2
2
  import { PreloadDiffOptions, PreloadFileDiffOptions, PreloadFileDiffResult, PreloadMultiFileDiffOptions, PreloadMultiFileDiffResult, PreloadPatchDiffOptions, PreloadPatchDiffResult, PreloadUnresolvedFileOptions, PreloadUnresolvedFileResult, preloadDiffHTML, preloadFileDiff, preloadMultiFileDiff, preloadPatchDiff, preloadUnresolvedFile, preloadUnresolvedFileHTML } from "./preloadDiffs.js";
3
3
  import { PreloadFileOptions, PreloadedFileResult, preloadFile } from "./preloadFile.js";
4
4
  import { PreloadPatchFileOptions, preloadPatchFile } from "./preloadPatchFile.js";
5
5
  import { renderHTML } from "./renderHTML.js";
6
- export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, PreloadDiffOptions, PreloadFileDiffOptions, PreloadFileDiffResult, PreloadFileOptions, PreloadMultiFileDiffOptions, PreloadMultiFileDiffResult, PreloadPatchDiffOptions, PreloadPatchDiffResult, PreloadPatchFileOptions, PreloadUnresolvedFileOptions, PreloadUnresolvedFileResult, PreloadedFileResult, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs, preloadDiffHTML, preloadFile, preloadFileDiff, preloadMultiFileDiff, preloadPatchDiff, preloadPatchFile, preloadUnresolvedFile, preloadUnresolvedFileHTML, renderHTML };
6
+ export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, type BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, type CodeToHastOptions, CodeViewCreateEditorOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, type CreatePatchOptionsNonabortable, CustomPreProperties, type DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffFileInput, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditableInstance, EditorActiveLineOptions, EditorChange, EditorChangeEvent, EditorSelection, EditorState, EditorViewState, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffContentsLoader, FileDiffLoadedChangedFiles, FileDiffLoadedFiles, FileDiffLoadedPureRenamedFile, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, type LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MaybeDiffFileInput, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, Position, PostRenderPhase, PrePropertiesConfig, PreloadDiffOptions, PreloadFileDiffOptions, PreloadFileDiffResult, PreloadFileOptions, PreloadMultiFileDiffOptions, PreloadMultiFileDiffResult, PreloadPatchDiffOptions, PreloadPatchDiffResult, PreloadPatchFileOptions, PreloadUnresolvedFileOptions, PreloadUnresolvedFileResult, PreloadedFileResult, ProcessFileConflictData, Range, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderFilenameSuffixCallback, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, ResolvedTextEdit, SelectedLineRange, SelectionDirection, SelectionPoint, SelectionSide, SharedRenderState, type ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, TextEdit, type ThemeRegistration, type ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, type ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs, preloadDiffHTML, preloadFile, preloadFileDiff, preloadMultiFileDiff, preloadPatchDiff, preloadPatchFile, preloadUnresolvedFile, preloadUnresolvedFileHTML, renderHTML };