@pierre/diffs 1.2.12 → 1.3.0-beta.10

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 (288) hide show
  1. package/dist/components/CodeView.d.ts +91 -6
  2. package/dist/components/CodeView.d.ts.map +1 -1
  3. package/dist/components/CodeView.js +300 -38
  4. package/dist/components/CodeView.js.map +1 -1
  5. package/dist/components/File.d.ts +14 -3
  6. package/dist/components/File.d.ts.map +1 -1
  7. package/dist/components/File.js +98 -12
  8. package/dist/components/File.js.map +1 -1
  9. package/dist/components/FileDiff.d.ts +68 -19
  10. package/dist/components/FileDiff.d.ts.map +1 -1
  11. package/dist/components/FileDiff.js +363 -25
  12. package/dist/components/FileDiff.js.map +1 -1
  13. package/dist/components/FileStream.d.ts.map +1 -1
  14. package/dist/components/FileStream.js +2 -1
  15. package/dist/components/FileStream.js.map +1 -1
  16. package/dist/components/UnresolvedFile.d.ts +2 -2
  17. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  18. package/dist/components/UnresolvedFile.js +2 -2
  19. package/dist/components/UnresolvedFile.js.map +1 -1
  20. package/dist/components/VirtualizedFile.d.ts +4 -2
  21. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  22. package/dist/components/VirtualizedFile.js +59 -47
  23. package/dist/components/VirtualizedFile.js.map +1 -1
  24. package/dist/components/VirtualizedFileDiff.d.ts +27 -5
  25. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  26. package/dist/components/VirtualizedFileDiff.js +262 -56
  27. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  28. package/dist/components/Virtualizer.d.ts +4 -1
  29. package/dist/components/Virtualizer.d.ts.map +1 -1
  30. package/dist/components/Virtualizer.js +21 -4
  31. package/dist/components/Virtualizer.js.map +1 -1
  32. package/dist/constants.d.ts +4 -1
  33. package/dist/constants.d.ts.map +1 -1
  34. package/dist/constants.js +4 -1
  35. package/dist/constants.js.map +1 -1
  36. package/dist/editor/command.d.ts +7 -0
  37. package/dist/editor/command.d.ts.map +1 -0
  38. package/dist/editor/command.js +54 -0
  39. package/dist/editor/command.js.map +1 -0
  40. package/dist/editor/editStack.d.ts +71 -0
  41. package/dist/editor/editStack.d.ts.map +1 -0
  42. package/dist/editor/editStack.js +218 -0
  43. package/dist/editor/editStack.js.map +1 -0
  44. package/dist/editor/editor.d.ts +105 -0
  45. package/dist/editor/editor.d.ts.map +1 -0
  46. package/dist/editor/editor.js +2545 -0
  47. package/dist/editor/editor.js.map +1 -0
  48. package/dist/editor/editor2.js +6 -0
  49. package/dist/editor/editor2.js.map +1 -0
  50. package/dist/editor/index.d.ts +5 -0
  51. package/dist/editor/index.js +3 -0
  52. package/dist/editor/languages.d.ts +26 -0
  53. package/dist/editor/languages.d.ts.map +1 -0
  54. package/dist/editor/languages.js +363 -0
  55. package/dist/editor/languages.js.map +1 -0
  56. package/dist/editor/lineAnnotations.d.ts +9 -0
  57. package/dist/editor/lineAnnotations.d.ts.map +1 -0
  58. package/dist/editor/lineAnnotations.js +212 -0
  59. package/dist/editor/lineAnnotations.js.map +1 -0
  60. package/dist/editor/marker.d.ts +38 -0
  61. package/dist/editor/marker.d.ts.map +1 -0
  62. package/dist/editor/marker.js +245 -0
  63. package/dist/editor/marker.js.map +1 -0
  64. package/dist/editor/matchBrackets.d.ts +9 -0
  65. package/dist/editor/matchBrackets.d.ts.map +1 -0
  66. package/dist/editor/matchBrackets.js +138 -0
  67. package/dist/editor/matchBrackets.js.map +1 -0
  68. package/dist/editor/pieceTable.d.ts +41 -0
  69. package/dist/editor/pieceTable.d.ts.map +1 -0
  70. package/dist/editor/pieceTable.js +671 -0
  71. package/dist/editor/pieceTable.js.map +1 -0
  72. package/dist/editor/platform.d.ts +19 -0
  73. package/dist/editor/platform.d.ts.map +1 -0
  74. package/dist/editor/platform.js +57 -0
  75. package/dist/editor/platform.js.map +1 -0
  76. package/dist/editor/popover.d.ts +65 -0
  77. package/dist/editor/popover.d.ts.map +1 -0
  78. package/dist/editor/popover.js +187 -0
  79. package/dist/editor/popover.js.map +1 -0
  80. package/dist/editor/searchPanel.d.ts +40 -0
  81. package/dist/editor/searchPanel.d.ts.map +1 -0
  82. package/dist/editor/searchPanel.js +318 -0
  83. package/dist/editor/searchPanel.js.map +1 -0
  84. package/dist/editor/selection.d.ts +211 -0
  85. package/dist/editor/selection.d.ts.map +1 -0
  86. package/dist/editor/selection.js +1626 -0
  87. package/dist/editor/selection.js.map +1 -0
  88. package/dist/editor/selectionAction.d.ts +46 -0
  89. package/dist/editor/selectionAction.d.ts.map +1 -0
  90. package/dist/editor/selectionAction.js +64 -0
  91. package/dist/editor/selectionAction.js.map +1 -0
  92. package/dist/editor/sprite.d.ts +8 -0
  93. package/dist/editor/sprite.d.ts.map +1 -0
  94. package/dist/editor/sprite.js +45 -0
  95. package/dist/editor/sprite.js.map +1 -0
  96. package/dist/editor/stateStorage.d.ts +15 -0
  97. package/dist/editor/stateStorage.d.ts.map +1 -0
  98. package/dist/editor/stateStorage.js +65 -0
  99. package/dist/editor/stateStorage.js.map +1 -0
  100. package/dist/editor/textDocument.d.ts +77 -0
  101. package/dist/editor/textDocument.d.ts.map +1 -0
  102. package/dist/editor/textDocument.js +271 -0
  103. package/dist/editor/textDocument.js.map +1 -0
  104. package/dist/editor/textMeasure.d.ts +61 -0
  105. package/dist/editor/textMeasure.d.ts.map +1 -0
  106. package/dist/editor/textMeasure.js +209 -0
  107. package/dist/editor/textMeasure.js.map +1 -0
  108. package/dist/editor/tokenizer.d.ts +41 -0
  109. package/dist/editor/tokenizer.d.ts.map +1 -0
  110. package/dist/editor/tokenizer.js +513 -0
  111. package/dist/editor/tokenizer.js.map +1 -0
  112. package/dist/editor/utils.d.ts +21 -0
  113. package/dist/editor/utils.d.ts.map +1 -0
  114. package/dist/editor/utils.js +68 -0
  115. package/dist/editor/utils.js.map +1 -0
  116. package/dist/index.d.ts +10 -8
  117. package/dist/index.js +12 -10
  118. package/dist/managers/InteractionManager.d.ts +7 -0
  119. package/dist/managers/InteractionManager.d.ts.map +1 -1
  120. package/dist/managers/InteractionManager.js +22 -1
  121. package/dist/managers/InteractionManager.js.map +1 -1
  122. package/dist/managers/ResizeManager.d.ts +10 -2
  123. package/dist/managers/ResizeManager.d.ts.map +1 -1
  124. package/dist/managers/ResizeManager.js +33 -13
  125. package/dist/managers/ResizeManager.js.map +1 -1
  126. package/dist/managers/UniversalRenderingManager.d.ts +2 -1
  127. package/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
  128. package/dist/managers/UniversalRenderingManager.js +6 -1
  129. package/dist/managers/UniversalRenderingManager.js.map +1 -1
  130. package/dist/react/CodeView.d.ts +26 -1
  131. package/dist/react/CodeView.d.ts.map +1 -1
  132. package/dist/react/CodeView.js +82 -19
  133. package/dist/react/CodeView.js.map +1 -1
  134. package/dist/react/EditContext.d.ts +15 -0
  135. package/dist/react/EditContext.d.ts.map +1 -0
  136. package/dist/react/EditContext.js +23 -0
  137. package/dist/react/EditContext.js.map +1 -0
  138. package/dist/react/File.d.ts +3 -1
  139. package/dist/react/File.d.ts.map +1 -1
  140. package/dist/react/File.js +4 -2
  141. package/dist/react/File.js.map +1 -1
  142. package/dist/react/FileDiff.d.ts +4 -1
  143. package/dist/react/FileDiff.d.ts.map +1 -1
  144. package/dist/react/FileDiff.js +4 -2
  145. package/dist/react/FileDiff.js.map +1 -1
  146. package/dist/react/MultiFileDiff.d.ts +7 -5
  147. package/dist/react/MultiFileDiff.d.ts.map +1 -1
  148. package/dist/react/MultiFileDiff.js +4 -2
  149. package/dist/react/MultiFileDiff.js.map +1 -1
  150. package/dist/react/PatchDiff.d.ts +4 -1
  151. package/dist/react/PatchDiff.d.ts.map +1 -1
  152. package/dist/react/PatchDiff.js +4 -2
  153. package/dist/react/PatchDiff.js.map +1 -1
  154. package/dist/react/UnresolvedFile.d.ts +1 -0
  155. package/dist/react/UnresolvedFile.d.ts.map +1 -1
  156. package/dist/react/UnresolvedFile.js +2 -1
  157. package/dist/react/UnresolvedFile.js.map +1 -1
  158. package/dist/react/index.d.ts +3 -2
  159. package/dist/react/index.js +2 -1
  160. package/dist/react/types.d.ts +3 -0
  161. package/dist/react/types.d.ts.map +1 -1
  162. package/dist/react/utils/renderDiffChildren.d.ts +2 -0
  163. package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
  164. package/dist/react/utils/renderDiffChildren.js +16 -8
  165. package/dist/react/utils/renderDiffChildren.js.map +1 -1
  166. package/dist/react/utils/renderFileChildren.d.ts +2 -0
  167. package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
  168. package/dist/react/utils/renderFileChildren.js +16 -8
  169. package/dist/react/utils/renderFileChildren.js.map +1 -1
  170. package/dist/react/utils/useFileDiffInstance.d.ts +3 -1
  171. package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
  172. package/dist/react/utils/useFileDiffInstance.js +30 -6
  173. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  174. package/dist/react/utils/useFileInstance.d.ts +4 -1
  175. package/dist/react/utils/useFileInstance.d.ts.map +1 -1
  176. package/dist/react/utils/useFileInstance.js +30 -5
  177. package/dist/react/utils/useFileInstance.js.map +1 -1
  178. package/dist/renderers/DiffHunksRenderer.d.ts +28 -2
  179. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  180. package/dist/renderers/DiffHunksRenderer.js +244 -22
  181. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  182. package/dist/renderers/FileRenderer.d.ts +8 -1
  183. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  184. package/dist/renderers/FileRenderer.js +155 -45
  185. package/dist/renderers/FileRenderer.js.map +1 -1
  186. package/dist/ssr/index.d.ts +2 -2
  187. package/dist/ssr/preloadDiffs.d.ts +11 -10
  188. package/dist/ssr/preloadDiffs.d.ts.map +1 -1
  189. package/dist/ssr/preloadDiffs.js +15 -7
  190. package/dist/ssr/preloadDiffs.js.map +1 -1
  191. package/dist/style.js +1 -1
  192. package/dist/types.d.ts +282 -5
  193. package/dist/types.d.ts.map +1 -1
  194. package/dist/utils/applyLineTextWithNewline.d.ts +5 -0
  195. package/dist/utils/applyLineTextWithNewline.d.ts.map +1 -0
  196. package/dist/utils/applyLineTextWithNewline.js +11 -0
  197. package/dist/utils/applyLineTextWithNewline.js.map +1 -0
  198. package/dist/utils/areHunkDataEqual.js +1 -1
  199. package/dist/utils/areHunkDataEqual.js.map +1 -1
  200. package/dist/utils/areManagedSnapshotsEqual.d.ts +2 -2
  201. package/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -1
  202. package/dist/utils/areManagedSnapshotsEqual.js +5 -0
  203. package/dist/utils/areManagedSnapshotsEqual.js.map +1 -1
  204. package/dist/utils/awaitWithTimeout.d.ts +5 -0
  205. package/dist/utils/awaitWithTimeout.d.ts.map +1 -0
  206. package/dist/utils/awaitWithTimeout.js +15 -0
  207. package/dist/utils/awaitWithTimeout.js.map +1 -0
  208. package/dist/utils/cleanLastNewline.js +6 -1
  209. package/dist/utils/cleanLastNewline.js.map +1 -1
  210. package/dist/utils/cloneFileDiffMetadata.d.ts +7 -0
  211. package/dist/utils/cloneFileDiffMetadata.d.ts.map +1 -0
  212. package/dist/utils/cloneFileDiffMetadata.js +16 -0
  213. package/dist/utils/cloneFileDiffMetadata.js.map +1 -0
  214. package/dist/utils/computeEstimatedDiffHeights.d.ts +3 -1
  215. package/dist/utils/computeEstimatedDiffHeights.d.ts.map +1 -1
  216. package/dist/utils/computeEstimatedDiffHeights.js +8 -1
  217. package/dist/utils/computeEstimatedDiffHeights.js.map +1 -1
  218. package/dist/utils/computeFileOffsets.d.ts +21 -0
  219. package/dist/utils/computeFileOffsets.d.ts.map +1 -0
  220. package/dist/utils/computeFileOffsets.js +51 -0
  221. package/dist/utils/computeFileOffsets.js.map +1 -0
  222. package/dist/utils/createCodeViewHeaderFooterHostElement.d.ts +5 -0
  223. package/dist/utils/createCodeViewHeaderFooterHostElement.d.ts.map +1 -0
  224. package/dist/utils/createCodeViewHeaderFooterHostElement.js +19 -0
  225. package/dist/utils/createCodeViewHeaderFooterHostElement.js.map +1 -0
  226. package/dist/utils/createFileHeaderElement.d.ts.map +1 -1
  227. package/dist/utils/createFileHeaderElement.js +5 -1
  228. package/dist/utils/createFileHeaderElement.js.map +1 -1
  229. package/dist/utils/createTransformerWithState.js +9 -0
  230. package/dist/utils/createTransformerWithState.js.map +1 -1
  231. package/dist/utils/editSessionHunks.d.ts +84 -0
  232. package/dist/utils/editSessionHunks.d.ts.map +1 -0
  233. package/dist/utils/editSessionHunks.js +366 -0
  234. package/dist/utils/editSessionHunks.js.map +1 -0
  235. package/dist/utils/getDiffFileInput.d.ts +14 -0
  236. package/dist/utils/getDiffFileInput.d.ts.map +1 -0
  237. package/dist/utils/getDiffFileInput.js +24 -0
  238. package/dist/utils/getDiffFileInput.js.map +1 -0
  239. package/dist/utils/getDiffHunksRendererOptions.js +1 -0
  240. package/dist/utils/getDiffHunksRendererOptions.js.map +1 -1
  241. package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
  242. package/dist/utils/getFiletypeFromFileName.js +2 -0
  243. package/dist/utils/getFiletypeFromFileName.js.map +1 -1
  244. package/dist/utils/hydratePartialDiff.d.ts +10 -0
  245. package/dist/utils/hydratePartialDiff.d.ts.map +1 -0
  246. package/dist/utils/hydratePartialDiff.js +140 -0
  247. package/dist/utils/hydratePartialDiff.js.map +1 -0
  248. package/dist/utils/iterateOverDiff.js +3 -3
  249. package/dist/utils/iterateOverDiff.js.map +1 -1
  250. package/dist/utils/parseDiffFromFile.d.ts +1 -1
  251. package/dist/utils/parseDiffFromFile.d.ts.map +1 -1
  252. package/dist/utils/parseDiffFromFile.js +26 -5
  253. package/dist/utils/parseDiffFromFile.js.map +1 -1
  254. package/dist/utils/parsePatchFiles.d.ts.map +1 -1
  255. package/dist/utils/parsePatchFiles.js +2 -0
  256. package/dist/utils/parsePatchFiles.js.map +1 -1
  257. package/dist/utils/realignChangeContent.d.ts +28 -0
  258. package/dist/utils/realignChangeContent.d.ts.map +1 -0
  259. package/dist/utils/realignChangeContent.js +142 -0
  260. package/dist/utils/realignChangeContent.js.map +1 -0
  261. package/dist/utils/renderDiffWithHighlighter.js +1 -1
  262. package/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
  263. package/dist/utils/renderFileWithHighlighter.js +5 -14
  264. package/dist/utils/renderFileWithHighlighter.js.map +1 -1
  265. package/dist/utils/updateDiffHunks.d.ts +24 -0
  266. package/dist/utils/updateDiffHunks.d.ts.map +1 -0
  267. package/dist/utils/updateDiffHunks.js +235 -0
  268. package/dist/utils/updateDiffHunks.js.map +1 -0
  269. package/dist/utils/virtualDiffLayout.d.ts +40 -1
  270. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  271. package/dist/utils/virtualDiffLayout.js +96 -1
  272. package/dist/utils/virtualDiffLayout.js.map +1 -1
  273. package/dist/worker/WorkerPoolManager.d.ts +7 -2
  274. package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
  275. package/dist/worker/WorkerPoolManager.js +83 -18
  276. package/dist/worker/WorkerPoolManager.js.map +1 -1
  277. package/dist/worker/index.d.ts +2 -2
  278. package/dist/worker/types.d.ts +11 -1
  279. package/dist/worker/types.d.ts.map +1 -1
  280. package/dist/worker/worker-portable.js +46 -66
  281. package/dist/worker/worker-portable.js.map +1 -1
  282. package/dist/worker/worker.js +46 -66
  283. package/dist/worker/worker.js.map +1 -1
  284. package/package.json +12 -5
  285. package/dist/utils/iterateOverFile.d.ts +0 -50
  286. package/dist/utils/iterateOverFile.d.ts.map +0 -1
  287. package/dist/utils/iterateOverFile.js +0 -49
  288. package/dist/utils/iterateOverFile.js.map +0 -1
@@ -3,21 +3,29 @@ import { getLineAnnotationName } from "../../utils/getLineAnnotationName.js";
3
3
  import { GutterUtilitySlotStyles } from "../constants.js";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/react/utils/renderFileChildren.tsx
6
- function renderFileChildren({ file, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, lineAnnotations, renderGutterUtility, getHoveredLine }) {
6
+ function renderFileChildren({ file, renderCustomHeader, renderHeaderPrefix, renderHeaderFilenameSuffix, renderHeaderMetadata, renderAnnotation, lineAnnotations, renderGutterUtility, getHoveredLine }) {
7
7
  const customHeader = renderCustomHeader?.(file);
8
8
  const prefix = renderHeaderPrefix?.(file);
9
+ const suffix = renderHeaderFilenameSuffix?.(file);
9
10
  const metadata = renderHeaderMetadata?.(file);
10
11
  return /* @__PURE__ */ jsxs(Fragment, { children: [
11
12
  customHeader != null ? /* @__PURE__ */ jsx("div", {
12
13
  slot: CUSTOM_HEADER_SLOT_ID,
13
14
  children: customHeader
14
- }) : /* @__PURE__ */ jsxs(Fragment, { children: [prefix != null && /* @__PURE__ */ jsx("div", {
15
- slot: "header-prefix",
16
- children: prefix
17
- }), metadata != null && /* @__PURE__ */ jsx("div", {
18
- slot: "header-metadata",
19
- children: metadata
20
- })] }),
15
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
16
+ prefix != null && /* @__PURE__ */ jsx("div", {
17
+ slot: "header-prefix",
18
+ children: prefix
19
+ }),
20
+ suffix != null && /* @__PURE__ */ jsx("div", {
21
+ slot: "header-filename-suffix",
22
+ children: suffix
23
+ }),
24
+ metadata != null && /* @__PURE__ */ jsx("div", {
25
+ slot: "header-metadata",
26
+ children: metadata
27
+ })
28
+ ] }),
21
29
  renderAnnotation != null && lineAnnotations?.map((annotation, index) => /* @__PURE__ */ jsx("div", {
22
30
  slot: getLineAnnotationName(annotation),
23
31
  children: renderAnnotation(annotation)
@@ -1 +1 @@
1
- {"version":3,"file":"renderFileChildren.js","names":[],"sources":["../../../src/react/utils/renderFileChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { GutterUtilitySlotStyles } from '../constants';\nimport type { FileProps } from '../types';\n\ninterface RenderFileChildrenProps<LAnnotation> {\n file: FileContents;\n renderCustomHeader: FileProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];\n lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];\n renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function renderFileChildren<LAnnotation>({\n file,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n lineAnnotations,\n renderGutterUtility,\n getHoveredLine,\n}: RenderFileChildrenProps<LAnnotation>): ReactNode {\n const customHeader = renderCustomHeader?.(file);\n const prefix = renderHeaderPrefix?.(file);\n const metadata = renderHeaderMetadata?.(file);\n return (\n <>\n {customHeader != null ? (\n <div slot={CUSTOM_HEADER_SLOT_ID}>{customHeader}</div>\n ) : (\n <>\n {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n {metadata != null && (\n <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>\n )}\n </>\n )}\n {renderAnnotation != null &&\n lineAnnotations?.map((annotation, index) => (\n <div key={index} slot={getLineAnnotationName(annotation)}>\n {renderAnnotation(annotation)}\n </div>\n ))}\n {renderGutterUtility != null && (\n <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n {renderGutterUtility(getHoveredLine)}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;AAwBA,SAAgB,mBAAgC,EAC9C,MACA,oBACA,oBACA,sBACA,kBACA,iBACA,qBACA,kBACkD;CAClD,MAAM,eAAe,qBAAqB,IAAI;CAC9C,MAAM,SAAS,qBAAqB,IAAI;CACxC,MAAM,WAAW,uBAAuB,IAAI;CAC5C,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,gBAAgB,OACf,oBAAC,OAAD;GAAK,MAAM;aAAwB;EAAkB,CAAA,IAErD,qBAAA,UAAA,EAAA,UAAA,CACG,UAAU,QAAQ,oBAAC,OAAD;GAAK,MAAA;aAA8B;EAAY,CAAA,GACjE,YAAY,QACX,oBAAC,OAAD;GAAK,MAAA;aAAgC;EAAc,CAAA,CAErD,EAAA,CAAA;EAEH,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC,OAAD;GAAiB,MAAM,sBAAsB,UAAU;aACpD,iBAAiB,UAAU;EACzB,GAFK,KAEL,CACN;EACF,uBAAuB,QACtB,oBAAC,OAAD;GAAK,MAAK;GAAsB,OAAO;aACpC,oBAAoB,cAAc;EAChC,CAAA;CAEP,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"renderFileChildren.js","names":[],"sources":["../../../src/react/utils/renderFileChildren.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport {\n CUSTOM_HEADER_SLOT_ID,\n HEADER_FILENAME_SUFFIX_SLOT_ID,\n HEADER_METADATA_SLOT_ID,\n HEADER_PREFIX_SLOT_ID,\n} from '../../constants';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type { FileContents } from '../../types';\nimport { getLineAnnotationName } from '../../utils/getLineAnnotationName';\nimport { GutterUtilitySlotStyles } from '../constants';\nimport type { FileProps } from '../types';\n\ninterface RenderFileChildrenProps<LAnnotation> {\n file: FileContents;\n renderCustomHeader: FileProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: FileProps<LAnnotation>['renderHeaderPrefix'];\n renderHeaderFilenameSuffix?: FileProps<LAnnotation>['renderHeaderFilenameSuffix'];\n renderHeaderMetadata: FileProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: FileProps<LAnnotation>['renderAnnotation'];\n lineAnnotations: FileProps<LAnnotation>['lineAnnotations'];\n renderGutterUtility: FileProps<LAnnotation>['renderGutterUtility'];\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function renderFileChildren<LAnnotation>({\n file,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderFilenameSuffix,\n renderHeaderMetadata,\n renderAnnotation,\n lineAnnotations,\n renderGutterUtility,\n getHoveredLine,\n}: RenderFileChildrenProps<LAnnotation>): ReactNode {\n const customHeader = renderCustomHeader?.(file);\n const prefix = renderHeaderPrefix?.(file);\n const suffix = renderHeaderFilenameSuffix?.(file);\n const metadata = renderHeaderMetadata?.(file);\n return (\n <>\n {customHeader != null ? (\n <div slot={CUSTOM_HEADER_SLOT_ID}>{customHeader}</div>\n ) : (\n <>\n {prefix != null && <div slot={HEADER_PREFIX_SLOT_ID}>{prefix}</div>}\n {suffix != null && (\n <div slot={HEADER_FILENAME_SUFFIX_SLOT_ID}>{suffix}</div>\n )}\n {metadata != null && (\n <div slot={HEADER_METADATA_SLOT_ID}>{metadata}</div>\n )}\n </>\n )}\n {renderAnnotation != null &&\n lineAnnotations?.map((annotation, index) => (\n <div key={index} slot={getLineAnnotationName(annotation)}>\n {renderAnnotation(annotation)}\n </div>\n ))}\n {renderGutterUtility != null && (\n <div slot=\"gutter-utility-slot\" style={GutterUtilitySlotStyles}>\n {renderGutterUtility(getHoveredLine)}\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;AA0BA,SAAgB,mBAAgC,EAC9C,MACA,oBACA,oBACA,4BACA,sBACA,kBACA,iBACA,qBACA,kBACkD;CAClD,MAAM,eAAe,qBAAqB,IAAI;CAC9C,MAAM,SAAS,qBAAqB,IAAI;CACxC,MAAM,SAAS,6BAA6B,IAAI;CAChD,MAAM,WAAW,uBAAuB,IAAI;CAC5C,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,gBAAgB,OACf,oBAAC,OAAD;GAAK,MAAM;aAAwB;EAAkB,CAAA,IAErD,qBAAA,UAAA,EAAA,UAAA;GACG,UAAU,QAAQ,oBAAC,OAAD;IAAK,MAAA;cAA8B;GAAY,CAAA;GACjE,UAAU,QACT,oBAAC,OAAD;IAAK,MAAA;cAAuC;GAAY,CAAA;GAEzD,YAAY,QACX,oBAAC,OAAD;IAAK,MAAA;cAAgC;GAAc,CAAA;EAErD,EAAA,CAAA;EAEH,oBAAoB,QACnB,iBAAiB,KAAK,YAAY,UAChC,oBAAC,OAAD;GAAiB,MAAM,sBAAsB,UAAU;aACpD,iBAAiB,UAAU;EACzB,GAFK,KAEL,CACN;EACF,uBAAuB,QACtB,oBAAC,OAAD;GAAK,MAAK;GAAsB,OAAO;aACpC,oBAAoB,cAAc;EAChC,CAAA;CAEP,EAAA,CAAA;AAEN"}
@@ -13,6 +13,7 @@ interface UseFileDiffInstanceProps<LAnnotation> {
13
13
  hasGutterRenderUtility: boolean;
14
14
  hasCustomHeader: boolean;
15
15
  disableWorkerPool: boolean;
16
+ contentEditable: boolean;
16
17
  }
17
18
  interface UseFileDiffInstanceReturn {
18
19
  ref(node: HTMLElement | null): void;
@@ -27,7 +28,8 @@ declare function useFileDiffInstance<LAnnotation>({
27
28
  metrics,
28
29
  hasGutterRenderUtility,
29
30
  hasCustomHeader,
30
- disableWorkerPool
31
+ disableWorkerPool,
32
+ contentEditable
31
33
  }: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn;
32
34
  //#endregion
33
35
  export { useFileDiffInstance };
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDiffInstance.d.ts","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"mappings":";;;;;UA0BU,wBAAA;EACR,QAAA,EAAU,gBAAA;EACV,OAAA,EAAS,eAAA,CAAgB,WAAA;EACzB,eAAA,EAAiB,kBAAA,CAAmB,WAAA;EACpC,aAAA,EAAe,iBAAA;EACf,eAAA;EACA,OAAA,GAAU,kBAAA;EACV,sBAAA;EACA,eAAA;EACA,iBAAA;AAAA;AAAA,UAGQ,yBAAA;EACR,GAAA,CAAI,IAAA,EAAM,WAAA;EACV,cAAA,IAAkB,oBAAoB;AAAA;AAAA,iBAGxB,mBAAA;EACd,QAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,eAAA;EACA,OAAA;EACA,sBAAA;EACA,eAAA;EACA;AAAA,GACC,wBAAA,CAAyB,WAAA,IAAe,yBAAA"}
1
+ {"version":3,"file":"useFileDiffInstance.d.ts","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"mappings":";;;;;UA2BU,wBAAA;EACR,QAAA,EAAU,gBAAA;EACV,OAAA,EAAS,eAAA,CAAgB,WAAA;EACzB,eAAA,EAAiB,kBAAA,CAAmB,WAAA;EACpC,aAAA,EAAe,iBAAA;EACf,eAAA;EACA,OAAA,GAAU,kBAAA;EACV,sBAAA;EACA,eAAA;EACA,iBAAA;EACA,eAAA;AAAA;AAAA,UAGQ,yBAAA;EACR,GAAA,CAAI,IAAA,EAAM,WAAA;EACV,cAAA,IAAkB,oBAAoB;AAAA;AAAA,iBAGxB,mBAAA;EACd,QAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,eAAA;EACA,OAAA;EACA,sBAAA;EACA,eAAA;EACA,iBAAA;EACA;AAAA,GACC,wBAAA,CAAyB,WAAA,IAAe,yBAAA"}
@@ -4,27 +4,33 @@ import { VirtualizedFileDiff } from "../../components/VirtualizedFileDiff.js";
4
4
  import { noopRender } from "../constants.js";
5
5
  import { useStableCallback } from "./useStableCallback.js";
6
6
  import { WorkerPoolContext } from "../WorkerPoolContext.js";
7
+ import { useEditor } from "../EditContext.js";
7
8
  import { useVirtualizer } from "../Virtualizer.js";
8
9
  import { useCallback, useContext, useEffect, useLayoutEffect, useRef } from "react";
9
10
  //#region src/react/utils/useFileDiffInstance.ts
10
11
  const useIsometricEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
11
- function useFileDiffInstance({ fileDiff, options, lineAnnotations, selectedLines, prerenderedHTML, metrics, hasGutterRenderUtility, hasCustomHeader, disableWorkerPool }) {
12
+ function useFileDiffInstance({ fileDiff, options, lineAnnotations, selectedLines, prerenderedHTML, metrics, hasGutterRenderUtility, hasCustomHeader, disableWorkerPool, contentEditable }) {
12
13
  const simpleVirtualizer = useVirtualizer();
13
14
  const controlledSelection = selectedLines !== void 0;
14
15
  const poolManager = useContext(WorkerPoolContext);
16
+ const editor = useEditor();
15
17
  const instanceRef = useRef(null);
16
18
  const ref = useStableCallback((fileContainer) => {
17
19
  if (fileContainer != null) {
18
20
  if (instanceRef.current != null) throw new Error("useFileDiffInstance: An instance should not already exist when a node is created");
19
21
  if (simpleVirtualizer != null) instanceRef.current = new VirtualizedFileDiff(mergeFileDiffOptions({
20
22
  controlledSelection,
23
+ contentEditable,
21
24
  hasCustomHeader,
25
+ hasEditor: editor !== void 0,
22
26
  hasGutterRenderUtility,
23
27
  options
24
28
  }), simpleVirtualizer, metrics, !disableWorkerPool ? poolManager : void 0, true);
25
29
  else instanceRef.current = new FileDiff(mergeFileDiffOptions({
26
30
  controlledSelection,
31
+ contentEditable,
27
32
  hasCustomHeader,
33
+ hasEditor: editor !== void 0,
28
34
  hasGutterRenderUtility,
29
35
  options
30
36
  }), !disableWorkerPool ? poolManager : void 0, true);
@@ -45,7 +51,9 @@ function useFileDiffInstance({ fileDiff, options, lineAnnotations, selectedLines
45
51
  if (instance == null) return;
46
52
  const newOptions = mergeFileDiffOptions({
47
53
  controlledSelection,
54
+ contentEditable,
48
55
  hasCustomHeader,
56
+ hasEditor: editor !== void 0,
49
57
  hasGutterRenderUtility,
50
58
  options
51
59
  });
@@ -58,6 +66,12 @@ function useFileDiffInstance({ fileDiff, options, lineAnnotations, selectedLines
58
66
  });
59
67
  if (selectedLines !== void 0) instance.setSelectedLines(selectedLines);
60
68
  });
69
+ useIsometricEffect(() => {
70
+ if (contentEditable && instanceRef.current != null) {
71
+ if (editor === void 0) throw new Error("FileDiff: Editor is not attached");
72
+ return editor.edit(instanceRef.current);
73
+ }
74
+ }, [contentEditable, editor]);
61
75
  return {
62
76
  ref,
63
77
  getHoveredLine: useCallback(() => {
@@ -65,13 +79,23 @@ function useFileDiffInstance({ fileDiff, options, lineAnnotations, selectedLines
65
79
  }, [])
66
80
  };
67
81
  }
68
- function mergeFileDiffOptions({ options, controlledSelection, hasCustomHeader, hasGutterRenderUtility }) {
69
- if (!controlledSelection && !hasGutterRenderUtility && !hasCustomHeader) return options;
82
+ function mergeFileDiffOptions({ options, controlledSelection, contentEditable, hasCustomHeader, hasEditor, hasGutterRenderUtility }) {
83
+ const needsEditorOptions = contentEditable && hasEditor;
84
+ const needsReactOverrides = controlledSelection || hasGutterRenderUtility || hasCustomHeader;
85
+ if (!needsReactOverrides && !needsEditorOptions) return options;
70
86
  return {
71
87
  ...options,
72
- controlledSelection,
73
- renderCustomHeader: hasCustomHeader ? noopRender : options?.renderCustomHeader,
74
- renderGutterUtility: hasGutterRenderUtility ? noopRender : options?.renderGutterUtility
88
+ ...needsReactOverrides ? {
89
+ controlledSelection,
90
+ renderCustomHeader: hasCustomHeader ? noopRender : options?.renderCustomHeader,
91
+ renderGutterUtility: hasGutterRenderUtility ? noopRender : options?.renderGutterUtility
92
+ } : null,
93
+ ...needsEditorOptions ? {
94
+ useTokenTransformer: true,
95
+ enableGutterUtility: false,
96
+ enableLineSelection: false,
97
+ lineHoverHighlight: "disabled"
98
+ } : null
75
99
  };
76
100
  }
77
101
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDiffInstance.js","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileDiffInstanceProps<LAnnotation> {\n fileDiff: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n}\n\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\n\nexport function useFileDiffInstance<LAnnotation>({\n fileDiff,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n}: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const instanceRef = useRef<\n FileDiff<LAnnotation> | VirtualizedFileDiff<LAnnotation> | null\n >(null);\n const ref = useStableCallback((fileContainer: HTMLElement | null) => {\n if (fileContainer != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'useFileDiffInstance: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new FileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n fileDiff,\n fileContainer,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error(\n 'useFileDiffInstance: A FileDiff instance should exist when unmounting'\n );\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n const { current: instance } = instanceRef;\n if (instance == null) return;\n const newOptions = mergeFileDiffOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(instance.options, newOptions);\n instance.setOptions(newOptions);\n void instance.render({\n forceRender,\n fileDiff,\n lineAnnotations,\n });\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines);\n }\n });\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'diff'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n\n return { ref, getHoveredLine };\n}\n\ninterface MergeFileDiffOptionsProps<LAnnotation> {\n controlledSelection: boolean;\n hasCustomHeader: boolean;\n hasGutterRenderUtility: boolean;\n options: FileDiffOptions<LAnnotation> | undefined;\n}\n\nfunction mergeFileDiffOptions<LAnnotation>({\n options,\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n}: MergeFileDiffOptionsProps<LAnnotation>):\n | FileDiffOptions<LAnnotation>\n | undefined {\n if (!controlledSelection && !hasGutterRenderUtility && !hasCustomHeader) {\n return options;\n }\n return {\n ...options,\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n };\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAmB9C,SAAgB,oBAAiC,EAC/C,UACA,SACA,iBACA,eACA,iBACA,SACA,wBACA,iBACA,qBACmE;CACnE,MAAM,oBAAoB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,aACA,SAAS;EACb,qBAAqB,yBACjB,aACA,SAAS;CACf;AACF"}
1
+ {"version":3,"file":"useFileDiffInstance.js","names":[],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useEditor } from '../EditContext';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileDiffInstanceProps<LAnnotation> {\n fileDiff: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n contentEditable: boolean;\n}\n\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\n\nexport function useFileDiffInstance<LAnnotation>({\n fileDiff,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n contentEditable,\n}: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const editor = useEditor<LAnnotation>();\n const instanceRef = useRef<\n FileDiff<LAnnotation> | VirtualizedFileDiff<LAnnotation> | null\n >(null);\n const ref = useStableCallback((fileContainer: HTMLElement | null) => {\n if (fileContainer != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'useFileDiffInstance: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new FileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n fileDiff,\n fileContainer,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error(\n 'useFileDiffInstance: A FileDiff instance should exist when unmounting'\n );\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n const { current: instance } = instanceRef;\n if (instance == null) return;\n const newOptions = mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(instance.options, newOptions);\n instance.setOptions(newOptions);\n void instance.render({\n forceRender,\n fileDiff,\n lineAnnotations,\n });\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines);\n }\n });\n\n useIsometricEffect(() => {\n if (contentEditable && instanceRef.current != null) {\n if (editor === undefined) {\n throw new Error('FileDiff: Editor is not attached');\n }\n return editor.edit(instanceRef.current);\n }\n return undefined;\n }, [contentEditable, editor]);\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'diff'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n\n return {\n ref,\n getHoveredLine,\n };\n}\n\ninterface MergeFileDiffOptionsProps<LAnnotation> {\n controlledSelection: boolean;\n contentEditable: boolean;\n hasEditor: boolean;\n hasCustomHeader: boolean;\n hasGutterRenderUtility: boolean;\n options: FileDiffOptions<LAnnotation> | undefined;\n}\n\nfunction mergeFileDiffOptions<LAnnotation>({\n options,\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor,\n hasGutterRenderUtility,\n}: MergeFileDiffOptionsProps<LAnnotation>):\n | FileDiffOptions<LAnnotation>\n | undefined {\n const needsEditorOptions = contentEditable && hasEditor;\n const needsReactOverrides =\n controlledSelection || hasGutterRenderUtility || hasCustomHeader;\n\n if (!needsReactOverrides && !needsEditorOptions) {\n return options;\n }\n\n return {\n ...options,\n ...(needsReactOverrides\n ? {\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n }\n : null),\n ...(needsEditorOptions\n ? {\n useTokenTransformer: true,\n enableGutterUtility: false,\n enableLineSelection: false,\n lineHoverHighlight: 'disabled',\n }\n : null),\n };\n}\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAoB9C,SAAgB,oBAAiC,EAC/C,UACA,SACA,iBACA,eACA,iBACA,SACA,wBACA,iBACA,mBACA,mBACmE;CACnE,MAAM,oBAAoB,eAAe;CACzC,MAAM,sBAAsB,kBAAkB,KAAA;CAC9C,MAAM,cAAc,WAAW,iBAAiB;CAChD,MAAM,SAAS,UAAuB;CACtC,MAAM,cAAc,OAElB,IAAI;CACN,MAAM,MAAM,mBAAmB,kBAAsC;EACnE,IAAI,iBAAiB,MAAM;GACzB,IAAI,YAAY,WAAW,MACzB,MAAM,IAAI,MACR,kFACF;GAEF,IAAI,qBAAqB,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A0B;CAEnD,IAAI,CAAC,uBAAuB,CAAC,oBAC3B,OAAO;CAGT,OAAO;EACL,GAAG;EACH,GAAI,sBACA;GACE;GACA,oBAAoB,kBAChB,aACA,SAAS;GACb,qBAAqB,yBACjB,aACA,SAAS;EACf,IACA;EACJ,GAAI,qBACA;GACE,qBAAqB;GACrB,qBAAqB;GACrB,qBAAqB;GACrB,oBAAoB;EACtB,IACA;CACN;AACF"}
@@ -13,6 +13,8 @@ interface UseFileInstanceProps<LAnnotation> {
13
13
  hasGutterRenderUtility: boolean;
14
14
  hasCustomHeader: boolean;
15
15
  disableWorkerPool: boolean;
16
+ contentEditable: boolean;
17
+ onChange?: (file: FileContents, lineAnnotations?: LineAnnotation<LAnnotation>[]) => void;
16
18
  }
17
19
  interface UseFileInstanceReturn {
18
20
  ref(node: HTMLElement | null): void;
@@ -27,7 +29,8 @@ declare function useFileInstance<LAnnotation>({
27
29
  metrics,
28
30
  hasGutterRenderUtility,
29
31
  hasCustomHeader,
30
- disableWorkerPool
32
+ disableWorkerPool,
33
+ contentEditable
31
34
  }: UseFileInstanceProps<LAnnotation>): UseFileInstanceReturn;
32
35
  //#endregion
33
36
  export { useFileInstance };
@@ -1 +1 @@
1
- {"version":3,"file":"useFileInstance.d.ts","names":[],"sources":["../../../src/react/utils/useFileInstance.ts"],"mappings":";;;;;UA0BU,oBAAA;EACR,IAAA,EAAM,YAAA;EACN,OAAA,EAAS,WAAA,CAAY,WAAA;EACrB,eAAA,EAAiB,cAAA,CAAe,WAAA;EAChC,aAAA,EAAe,iBAAA;EACf,eAAA;EACA,OAAA,GAAU,kBAAA;EACV,sBAAA;EACA,eAAA;EACA,iBAAA;AAAA;AAAA,UAGQ,qBAAA;EACR,GAAA,CAAI,IAAA,EAAM,WAAA;EACV,cAAA,IAAkB,oBAAoB;AAAA;AAAA,iBAGxB,eAAA;EACd,IAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,eAAA;EACA,OAAA;EACA,sBAAA;EACA,eAAA;EACA;AAAA,GACC,oBAAA,CAAqB,WAAA,IAAe,qBAAA"}
1
+ {"version":3,"file":"useFileInstance.d.ts","names":[],"sources":["../../../src/react/utils/useFileInstance.ts"],"mappings":";;;;;UA2BU,oBAAA;EACR,IAAA,EAAM,YAAA;EACN,OAAA,EAAS,WAAA,CAAY,WAAA;EACrB,eAAA,EAAiB,cAAA,CAAe,WAAA;EAChC,aAAA,EAAe,iBAAA;EACf,eAAA;EACA,OAAA,GAAU,kBAAA;EACV,sBAAA;EACA,eAAA;EACA,iBAAA;EACA,eAAA;EACA,QAAA,IACE,IAAA,EAAM,YAAA,EACN,eAAA,GAAkB,cAAA,CAAe,WAAA;AAAA;AAAA,UAI3B,qBAAA;EACR,GAAA,CAAI,IAAA,EAAM,WAAA;EACV,cAAA,IAAkB,oBAAoB;AAAA;AAAA,iBAGxB,eAAA;EACd,IAAA;EACA,OAAA;EACA,eAAA;EACA,aAAA;EACA,eAAA;EACA,OAAA;EACA,sBAAA;EACA,eAAA;EACA,iBAAA;EACA;AAAA,GACC,oBAAA,CAAqB,WAAA,IAAe,qBAAA"}
@@ -4,27 +4,33 @@ import { VirtualizedFile } from "../../components/VirtualizedFile.js";
4
4
  import { noopRender } from "../constants.js";
5
5
  import { useStableCallback } from "./useStableCallback.js";
6
6
  import { WorkerPoolContext } from "../WorkerPoolContext.js";
7
+ import { useEditor } from "../EditContext.js";
7
8
  import { useVirtualizer } from "../Virtualizer.js";
8
9
  import { useCallback, useContext, useEffect, useLayoutEffect, useRef } from "react";
9
10
  //#region src/react/utils/useFileInstance.ts
10
11
  const useIsometricEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
11
- function useFileInstance({ file, options, lineAnnotations, selectedLines, prerenderedHTML, metrics, hasGutterRenderUtility, hasCustomHeader, disableWorkerPool }) {
12
+ function useFileInstance({ file, options, lineAnnotations, selectedLines, prerenderedHTML, metrics, hasGutterRenderUtility, hasCustomHeader, disableWorkerPool, contentEditable }) {
12
13
  const simpleVirtualizer = useVirtualizer();
13
14
  const controlledSelection = selectedLines !== void 0;
14
15
  const poolManager = useContext(WorkerPoolContext);
16
+ const editor = useEditor();
15
17
  const instanceRef = useRef(null);
16
18
  const ref = useStableCallback((node) => {
17
19
  if (node != null) {
18
20
  if (instanceRef.current != null) throw new Error("File: An instance should not already exist when a node is created");
19
21
  if (simpleVirtualizer != null) instanceRef.current = new VirtualizedFile(mergeFileOptions({
20
22
  controlledSelection,
23
+ contentEditable,
21
24
  hasCustomHeader,
25
+ hasEditor: editor !== void 0,
22
26
  hasGutterRenderUtility,
23
27
  options
24
28
  }), simpleVirtualizer, metrics, !disableWorkerPool ? poolManager : void 0, true);
25
29
  else instanceRef.current = new File(mergeFileOptions({
26
30
  controlledSelection,
31
+ contentEditable,
27
32
  hasCustomHeader,
33
+ hasEditor: editor !== void 0,
28
34
  hasGutterRenderUtility,
29
35
  options
30
36
  }), !disableWorkerPool ? poolManager : void 0, true);
@@ -44,7 +50,9 @@ function useFileInstance({ file, options, lineAnnotations, selectedLines, preren
44
50
  if (instanceRef.current == null) return;
45
51
  const newOptions = mergeFileOptions({
46
52
  controlledSelection,
53
+ contentEditable,
47
54
  hasCustomHeader,
55
+ hasEditor: editor !== void 0,
48
56
  hasGutterRenderUtility,
49
57
  options
50
58
  });
@@ -57,6 +65,12 @@ function useFileInstance({ file, options, lineAnnotations, selectedLines, preren
57
65
  });
58
66
  if (selectedLines !== void 0) instanceRef.current.setSelectedLines(selectedLines);
59
67
  });
68
+ useIsometricEffect(() => {
69
+ if (contentEditable && instanceRef.current != null) {
70
+ if (editor === void 0) throw new Error("File: Editor is not attached");
71
+ return editor.edit(instanceRef.current);
72
+ }
73
+ }, [contentEditable, editor]);
60
74
  return {
61
75
  ref,
62
76
  getHoveredLine: useCallback(() => {
@@ -64,14 +78,25 @@ function useFileInstance({ file, options, lineAnnotations, selectedLines, preren
64
78
  }, [])
65
79
  };
66
80
  }
67
- function mergeFileOptions({ options, controlledSelection, hasCustomHeader, hasGutterRenderUtility }) {
68
- if (!controlledSelection && !hasGutterRenderUtility && !hasCustomHeader) return options;
69
- return {
70
- ...options,
81
+ function mergeFileOptions({ options, controlledSelection, contentEditable, hasCustomHeader, hasEditor, hasGutterRenderUtility }) {
82
+ const needsEditorOptions = contentEditable && hasEditor;
83
+ const needsReactOverrides = controlledSelection || hasGutterRenderUtility || hasCustomHeader;
84
+ if (!needsReactOverrides && !needsEditorOptions) return options;
85
+ let merged = { ...options };
86
+ if (needsReactOverrides) merged = {
87
+ ...merged,
71
88
  controlledSelection,
72
89
  renderCustomHeader: hasCustomHeader ? noopRender : options?.renderCustomHeader,
73
90
  renderGutterUtility: hasGutterRenderUtility ? noopRender : options?.renderGutterUtility
74
91
  };
92
+ if (needsEditorOptions) merged = {
93
+ ...merged,
94
+ useTokenTransformer: true,
95
+ enableGutterUtility: false,
96
+ enableLineSelection: false,
97
+ lineHoverHighlight: "disabled"
98
+ };
99
+ return merged;
75
100
  }
76
101
  //#endregion
77
102
  export { useFileInstance };
@@ -1 +1 @@
1
- {"version":3,"file":"useFileInstance.js","names":[],"sources":["../../../src/react/utils/useFileInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { File, type FileOptions } from '../../components/File';\nimport { VirtualizedFile } from '../../components/VirtualizedFile';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n FileContents,\n LineAnnotation,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileInstanceProps<LAnnotation> {\n file: FileContents;\n options: FileOptions<LAnnotation> | undefined;\n lineAnnotations: LineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n}\n\ninterface UseFileInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function useFileInstance<LAnnotation>({\n file,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n}: UseFileInstanceProps<LAnnotation>): UseFileInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const instanceRef = useRef<\n File<LAnnotation> | VirtualizedFile<LAnnotation> | null\n >(null);\n const ref = useStableCallback((node: HTMLElement | null) => {\n if (node != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'File: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFile(\n mergeFileOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new File(\n mergeFileOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n file,\n fileContainer: node,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error('File: A File instance should exist when unmounting');\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n if (instanceRef.current == null) return;\n const newOptions = mergeFileOptions({\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(\n instanceRef.current.options,\n newOptions\n );\n instanceRef.current.setOptions(newOptions);\n void instanceRef.current.render({ file, lineAnnotations, forceRender });\n if (selectedLines !== undefined) {\n instanceRef.current.setSelectedLines(selectedLines);\n }\n });\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'file'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n return { ref, getHoveredLine };\n}\n\ninterface MergeFileOptionsProps<LAnnotation> {\n options: FileOptions<LAnnotation> | undefined;\n controlledSelection: boolean;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n}\n\nfunction mergeFileOptions<LAnnotation>({\n options,\n controlledSelection,\n hasCustomHeader,\n hasGutterRenderUtility,\n}: MergeFileOptionsProps<LAnnotation>): FileOptions<LAnnotation> | undefined {\n if (!controlledSelection && !hasGutterRenderUtility && !hasCustomHeader) {\n return options;\n }\n return {\n ...options,\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n };\n}\n"],"mappings":";;;;;;;;;AAuBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAmB9C,SAAgB,gBAA6B,EAC3C,MACA,SACA,iBACA,eACA,iBACA,SACA,wBACA,iBACA,qBAC2D;CAC3D,MAAM,oBAAoB,eAAe;CACzC,MAAM,sBAAsB,kBAAkB,KAAA;CAC9C,MAAM,cAAc,WAAW,iBAAiB;CAChD,MAAM,cAAc,OAElB,IAAI;CACN,MAAM,MAAM,mBAAmB,SAA6B;EAC1D,IAAI,QAAQ,MAAM;GAChB,IAAI,YAAY,WAAW,MACzB,MAAM,IAAI,MACR,mEACF;GAEF,IAAI,qBAAqB,MACvB,YAAY,UAAU,IAAI,gBACxB,iBAAiB;IACf;IACA;IACA;IACA;GACF,CAAC,GACD,mBACA,SACA,CAAC,oBAAoB,cAAc,KAAA,GACnC,IACF;QAEA,YAAY,UAAU,IAAI,KACxB,iBAAiB;IACf;IACA;IACA;IACA;GACF,CAAC,GACD,CAAC,oBAAoB,cAAc,KAAA,GACnC,IACF;GAEF,YAAiB,QAAQ,QAAQ;IAC/B;IACA,eAAe;IACf;IACA;GACF,CAAC;EACH,OAAO;GACL,IAAI,YAAY,WAAW,MACzB,MAAM,IAAI,MAAM,oDAAoD;GAEtE,YAAY,QAAQ,QAAQ;GAC5B,YAAY,UAAU;EACxB;CACF,CAAC;CAED,yBAAyB;EACvB,IAAI,YAAY,WAAW,MAAM;EACjC,MAAM,aAAa,iBAAiB;GAClC;GACA;GACA;GACA;EACF,CAAC;EACD,MAAM,cAAc,CAAC,gBACnB,YAAY,QAAQ,SACpB,UACF;EACA,YAAY,QAAQ,WAAW,UAAU;EACzC,YAAiB,QAAQ,OAAO;GAAE;GAAM;GAAiB;EAAY,CAAC;EACtE,IAAI,kBAAkB,KAAA,GACpB,YAAY,QAAQ,iBAAiB,aAAa;CAEtD,CAAC;CAOD,OAAO;EAAE;EAAK,gBALS,kBAEN;GACf,OAAO,YAAY,SAAS,eAAe;EAC7C,GAAG,CAAC,CACuB;CAAE;AAC/B;AASA,SAAS,iBAA8B,EACrC,SACA,qBACA,iBACA,0BAC2E;CAC3E,IAAI,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,iBACtD,OAAO;CAET,OAAO;EACL,GAAG;EACH;EACA,oBAAoB,kBAChB,aACA,SAAS;EACb,qBAAqB,yBACjB,aACA,SAAS;CACf;AACF"}
1
+ {"version":3,"file":"useFileInstance.js","names":[],"sources":["../../../src/react/utils/useFileInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { File, type FileOptions } from '../../components/File';\nimport { VirtualizedFile } from '../../components/VirtualizedFile';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n FileContents,\n LineAnnotation,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useEditor } from '../EditContext';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileInstanceProps<LAnnotation> {\n file: FileContents;\n options: FileOptions<LAnnotation> | undefined;\n lineAnnotations: LineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n contentEditable: boolean;\n onChange?: (\n file: FileContents,\n lineAnnotations?: LineAnnotation<LAnnotation>[]\n ) => void;\n}\n\ninterface UseFileInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'file'> | undefined;\n}\n\nexport function useFileInstance<LAnnotation>({\n file,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n contentEditable,\n}: UseFileInstanceProps<LAnnotation>): UseFileInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const editor = useEditor<LAnnotation>();\n const instanceRef = useRef<\n File<LAnnotation> | VirtualizedFile<LAnnotation> | null\n >(null);\n const ref = useStableCallback((node: HTMLElement | null) => {\n if (node != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'File: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFile(\n mergeFileOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new File(\n mergeFileOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n file,\n fileContainer: node,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error('File: A File instance should exist when unmounting');\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n if (instanceRef.current == null) return;\n const newOptions = mergeFileOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(\n instanceRef.current.options,\n newOptions\n );\n instanceRef.current.setOptions(newOptions);\n void instanceRef.current.render({ file, lineAnnotations, forceRender });\n if (selectedLines !== undefined) {\n instanceRef.current.setSelectedLines(selectedLines);\n }\n });\n\n useIsometricEffect(() => {\n if (contentEditable && instanceRef.current != null) {\n if (editor === undefined) {\n throw new Error('File: Editor is not attached');\n }\n return editor.edit(instanceRef.current);\n }\n return undefined;\n }, [contentEditable, editor]);\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'file'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n return { ref, getHoveredLine };\n}\n\ninterface MergeFileOptionsProps<LAnnotation> {\n options: FileOptions<LAnnotation> | undefined;\n controlledSelection: boolean;\n contentEditable: boolean;\n hasEditor: boolean;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n}\n\nfunction mergeFileOptions<LAnnotation>({\n options,\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor,\n hasGutterRenderUtility,\n}: MergeFileOptionsProps<LAnnotation>): FileOptions<LAnnotation> | undefined {\n const needsEditorOptions = contentEditable && hasEditor;\n const needsReactOverrides =\n controlledSelection || hasGutterRenderUtility || hasCustomHeader;\n\n if (!needsReactOverrides && !needsEditorOptions) {\n return options;\n }\n\n let merged: FileOptions<LAnnotation> = { ...options };\n\n if (needsReactOverrides) {\n merged = {\n ...merged,\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n };\n }\n\n if (needsEditorOptions) {\n merged = {\n ...merged,\n useTokenTransformer: true,\n enableGutterUtility: false,\n enableLineSelection: false,\n lineHoverHighlight: 'disabled',\n };\n }\n\n return merged;\n}\n"],"mappings":";;;;;;;;;;AAwBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAwB9C,SAAgB,gBAA6B,EAC3C,MACA,SACA,iBACA,eACA,iBACA,SACA,wBACA,iBACA,mBACA,mBAC2D;CAC3D,MAAM,oBAAoB,eAAe;CACzC,MAAM,sBAAsB,kBAAkB,KAAA;CAC9C,MAAM,cAAc,WAAW,iBAAiB;CAChD,MAAM,SAAS,UAAuB;CACtC,MAAM,cAAc,OAElB,IAAI;CACN,MAAM,MAAM,mBAAmB,SAA6B;EAC1D,IAAI,QAAQ,MAAM;GAChB,IAAI,YAAY,WAAW,MACzB,MAAM,IAAI,MACR,mEACF;GAEF,IAAI,qBAAqB,MACvB,YAAY,UAAU,IAAI,gBACxB,iBAAiB;IACf;IACA;IACA;IACA,WAAW,WAAW,KAAA;IACtB;IACA;GACF,CAAC,GACD,mBACA,SACA,CAAC,oBAAoB,cAAc,KAAA,GACnC,IACF;QAEA,YAAY,UAAU,IAAI,KACxB,iBAAiB;IACf;IACA;IACA;IACA,WAAW,WAAW,KAAA;IACtB;IACA;GACF,CAAC,GACD,CAAC,oBAAoB,cAAc,KAAA,GACnC,IACF;GAEF,YAAiB,QAAQ,QAAQ;IAC/B;IACA,eAAe;IACf;IACA;GACF,CAAC;EACH,OAAO;GACL,IAAI,YAAY,WAAW,MACzB,MAAM,IAAI,MAAM,oDAAoD;GAEtE,YAAY,QAAQ,QAAQ;GAC5B,YAAY,UAAU;EACxB;CACF,CAAC;CAED,yBAAyB;EACvB,IAAI,YAAY,WAAW,MAAM;EACjC,MAAM,aAAa,iBAAiB;GAClC;GACA;GACA;GACA,WAAW,WAAW,KAAA;GACtB;GACA;EACF,CAAC;EACD,MAAM,cAAc,CAAC,gBACnB,YAAY,QAAQ,SACpB,UACF;EACA,YAAY,QAAQ,WAAW,UAAU;EACzC,YAAiB,QAAQ,OAAO;GAAE;GAAM;GAAiB;EAAY,CAAC;EACtE,IAAI,kBAAkB,KAAA,GACpB,YAAY,QAAQ,iBAAiB,aAAa;CAEtD,CAAC;CAED,yBAAyB;EACvB,IAAI,mBAAmB,YAAY,WAAW,MAAM;GAClD,IAAI,WAAW,KAAA,GACb,MAAM,IAAI,MAAM,8BAA8B;GAEhD,OAAO,OAAO,KAAK,YAAY,OAAO;EACxC;CAEF,GAAG,CAAC,iBAAiB,MAAM,CAAC;CAO5B,OAAO;EAAE;EAAK,gBALS,kBAEN;GACf,OAAO,YAAY,SAAS,eAAe;EAC7C,GAAG,CAAC,CACuB;CAAE;AAC/B;AAWA,SAAS,iBAA8B,EACrC,SACA,qBACA,iBACA,iBACA,WACA,0BAC2E;CAC3E,MAAM,qBAAqB,mBAAmB;CAC9C,MAAM,sBACJ,uBAAuB,0BAA0B;CAEnD,IAAI,CAAC,uBAAuB,CAAC,oBAC3B,OAAO;CAGT,IAAI,SAAmC,EAAE,GAAG,QAAQ;CAEpD,IAAI,qBACF,SAAS;EACP,GAAG;EACH;EACA,oBAAoB,kBAChB,aACA,SAAS;EACb,qBAAqB,yBACjB,aACA,SAAS;CACf;CAGF,IAAI,oBACF,SAAS;EACP,GAAG;EACH,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EACrB,oBAAoB;CACtB;CAGF,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { Element, ElementContent, Properties } from "../node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.js";
2
- import { BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from "../types.js";
2
+ import { BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, DiffsHighlighter, DiffsTextDocument, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HighlightedToken, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from "../types.js";
3
3
  import { WorkerPoolManager } from "../worker/WorkerPoolManager.js";
4
4
  import { DiffLineMetadata } from "../utils/iterateOverDiff.js";
5
5
 
@@ -81,16 +81,42 @@ declare class DiffHunksRenderer<LAnnotation = undefined> {
81
81
  private additionAnnotations;
82
82
  private computedLang;
83
83
  private renderCache;
84
+ private editSessionActive;
85
+ private editSessionLines;
84
86
  constructor(options?: DiffHunksRendererOptions, onRenderUpdate?: (() => unknown) | undefined, workerManager?: WorkerPoolManager | undefined);
85
87
  cleanUp(): void;
86
88
  recycle(): void;
89
+ /**
90
+ * Enter edit-session mode: hunk updates preserve the current region
91
+ * skeleton instead of recomputing hunks. Called on every editor attach,
92
+ * including a re-attach after recycle, which losslessly re-seeds the pass
93
+ * snapshot because both hunk-update paths keep `diff.additionLines`
94
+ * current.
95
+ */
96
+ beginEditSession(diff: FileDiffMetadata | undefined): void;
97
+ /** Leave edit-session mode. The exit recompute is the host's concern. */
98
+ endEditSession(): void;
99
+ get diffCache(): FileDiffMetadata | undefined;
87
100
  clearRenderCache(): void;
88
101
  setOptions(options: DiffHunksRendererOptions): void;
89
102
  mergeOptions(options: Partial<DiffHunksRendererOptions>): void;
90
103
  expandHunk(index: number, direction: ExpansionDirections, expansionLineCount?: number): void;
91
104
  getExpandedHunk(hunkIndex: number): HunkExpansionRegion;
92
105
  getExpandedHunksMap(): Map<number, HunkExpansionRegion>;
106
+ /** Replace the whole expansion map (session-exit expansion remapping). */
107
+ setExpandedHunksMap(expandedHunks: Map<number, HunkExpansionRegion>): void;
93
108
  setLineAnnotations(lineAnnotations: DiffLineAnnotation<LAnnotation>[]): void;
109
+ /**
110
+ * Returns true when a session-mode pass changed the region skeleton itself
111
+ * (a gap edit synthesized or merged regions), which changes the rendered
112
+ * row set without a line-count change — the host must escalate to a full
113
+ * re-render instead of its cheap refresh path.
114
+ */
115
+ updateRenderCache(dirtyLines: Map<number, Array<HighlightedToken>>, themeType: 'dark' | 'light', lineCountChangeInFlight?: boolean): boolean;
116
+ private applyExpansionRemaps;
117
+ applyDocumentChange(textDocument: DiffsTextDocument): void;
118
+ private applySessionDocumentChange;
119
+ private markEditSessionPass;
94
120
  protected getUnifiedLineDecoration({
95
121
  lineType
96
122
  }: UnifiedLineDecorationProps): LineDecoration;
@@ -102,7 +128,7 @@ declare class DiffHunksRenderer<LAnnotation = undefined> {
102
128
  protected getUnifiedInjectedRowsForLine?: (ctx: RenderedLineContext) => UnifiedInjectedRowPlacement | undefined;
103
129
  protected getSplitInjectedRowsForLine?: (ctx: RenderedLineContext) => SplitInjectedRowPlacement | undefined;
104
130
  protected getOptionsWithDefaults(): DiffHunksRendererOptionsWithDefaults;
105
- private initializeHighlighter;
131
+ initializeHighlighter(): Promise<DiffsHighlighter>;
106
132
  hydrate(diff: FileDiffMetadata | undefined): void;
107
133
  private getRenderOptions;
108
134
  renderDiff(diff?: FileDiffMetadata | undefined, renderRange?: RenderRange): HunksRenderResult | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"DiffHunksRenderer.d.ts","names":[],"sources":["../../src/renderers/DiffHunksRenderer.ts"],"mappings":";;;;;;UAwHiB,wBAAA,SAAiC,eAAe;EAC/D,gBAAA,GAAmB,oBAAA;AAAA;AAAA,UAGJ,oCAAA,SAA6C,IAAA,CAC5D,2BAAA;EAGA,gBAAA,EAAkB,oBAAA;AAAA;AAAA,UAGH,0BAAA;EACf,IAAA;EACA,QAAA,EAAU,SAAS;EACnB,iBAAA;EACA,iBAAA;AAAA;AAAA,U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