@pierre/diffs 1.2.10 → 1.2.12

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 (545) hide show
  1. package/README.md +15 -15
  2. package/dist/components/CodeView.d.ts +10 -11
  3. package/dist/components/CodeView.d.ts.map +1 -1
  4. package/dist/components/CodeView.js +13 -14
  5. package/dist/components/CodeView.js.map +1 -1
  6. package/dist/components/File.d.ts +1 -4
  7. package/dist/components/File.d.ts.map +1 -1
  8. package/dist/components/File.js +19 -12
  9. package/dist/components/File.js.map +1 -1
  10. package/dist/components/FileDiff.d.ts +11 -14
  11. package/dist/components/FileDiff.d.ts.map +1 -1
  12. package/dist/components/FileDiff.js +16 -14
  13. package/dist/components/FileDiff.js.map +1 -1
  14. package/dist/components/FileStream.d.ts +0 -1
  15. package/dist/components/FileStream.d.ts.map +1 -1
  16. package/dist/components/FileStream.js +8 -6
  17. package/dist/components/FileStream.js.map +1 -1
  18. package/dist/components/UnresolvedFile.d.ts +2 -2
  19. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  20. package/dist/components/UnresolvedFile.js +7 -5
  21. package/dist/components/UnresolvedFile.js.map +1 -1
  22. package/dist/components/VirtualizedFile.d.ts +6 -3
  23. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  24. package/dist/components/VirtualizedFile.js +97 -35
  25. package/dist/components/VirtualizedFile.js.map +1 -1
  26. package/dist/components/VirtualizedFileDiff.d.ts +9 -5
  27. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  28. package/dist/components/VirtualizedFileDiff.js +91 -30
  29. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  30. package/dist/components/Virtualizer.d.ts +1 -1
  31. package/dist/components/Virtualizer.d.ts.map +1 -1
  32. package/dist/components/Virtualizer.js +23 -24
  33. package/dist/components/Virtualizer.js.map +1 -1
  34. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  35. package/dist/components/web-components.d.ts.map +1 -1
  36. package/dist/components/web-components.js +2 -3
  37. package/dist/components/web-components.js.map +1 -1
  38. package/dist/constants.d.ts +1 -1
  39. package/dist/constants.d.ts.map +1 -1
  40. package/dist/constants.js +1 -1
  41. package/dist/constants.js.map +1 -1
  42. package/dist/highlighter/languages/areLanguagesAttached.d.ts.map +1 -1
  43. package/dist/highlighter/languages/areLanguagesAttached.js +1 -2
  44. package/dist/highlighter/languages/areLanguagesAttached.js.map +1 -1
  45. package/dist/highlighter/languages/attachResolvedLanguages.d.ts +0 -2
  46. package/dist/highlighter/languages/attachResolvedLanguages.d.ts.map +1 -1
  47. package/dist/highlighter/languages/attachResolvedLanguages.js +1 -2
  48. package/dist/highlighter/languages/attachResolvedLanguages.js.map +1 -1
  49. package/dist/highlighter/languages/cleanUpResolvedLanguages.d.ts.map +1 -1
  50. package/dist/highlighter/languages/cleanUpResolvedLanguages.js +1 -2
  51. package/dist/highlighter/languages/cleanUpResolvedLanguages.js.map +1 -1
  52. package/dist/highlighter/languages/constants.d.ts +0 -1
  53. package/dist/highlighter/languages/constants.d.ts.map +1 -1
  54. package/dist/highlighter/languages/constants.js +1 -1
  55. package/dist/highlighter/languages/constants.js.map +1 -1
  56. package/dist/highlighter/languages/getResolvedLanguages.d.ts +0 -2
  57. package/dist/highlighter/languages/getResolvedLanguages.d.ts.map +1 -1
  58. package/dist/highlighter/languages/getResolvedLanguages.js +1 -2
  59. package/dist/highlighter/languages/getResolvedLanguages.js.map +1 -1
  60. package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts +0 -2
  61. package/dist/highlighter/languages/getResolvedOrResolveLanguage.d.ts.map +1 -1
  62. package/dist/highlighter/languages/getResolvedOrResolveLanguage.js +1 -2
  63. package/dist/highlighter/languages/getResolvedOrResolveLanguage.js.map +1 -1
  64. package/dist/highlighter/languages/hasResolvedLanguages.d.ts.map +1 -1
  65. package/dist/highlighter/languages/hasResolvedLanguages.js +1 -2
  66. package/dist/highlighter/languages/hasResolvedLanguages.js.map +1 -1
  67. package/dist/highlighter/languages/registerCustomLanguage.d.ts +0 -1
  68. package/dist/highlighter/languages/registerCustomLanguage.d.ts.map +1 -1
  69. package/dist/highlighter/languages/registerCustomLanguage.js +1 -2
  70. package/dist/highlighter/languages/registerCustomLanguage.js.map +1 -1
  71. package/dist/highlighter/languages/resolveLanguage.d.ts +0 -2
  72. package/dist/highlighter/languages/resolveLanguage.d.ts.map +1 -1
  73. package/dist/highlighter/languages/resolveLanguage.js +4 -5
  74. package/dist/highlighter/languages/resolveLanguage.js.map +1 -1
  75. package/dist/highlighter/languages/resolveLanguages.d.ts +0 -2
  76. package/dist/highlighter/languages/resolveLanguages.d.ts.map +1 -1
  77. package/dist/highlighter/languages/resolveLanguages.js +1 -2
  78. package/dist/highlighter/languages/resolveLanguages.js.map +1 -1
  79. package/dist/highlighter/shared_highlighter.d.ts.map +1 -1
  80. package/dist/highlighter/shared_highlighter.js +3 -4
  81. package/dist/highlighter/shared_highlighter.js.map +1 -1
  82. package/dist/highlighter/themes/areThemesAttached.d.ts.map +1 -1
  83. package/dist/highlighter/themes/areThemesAttached.js +1 -2
  84. package/dist/highlighter/themes/areThemesAttached.js.map +1 -1
  85. package/dist/highlighter/themes/attachResolvedThemes.d.ts.map +1 -1
  86. package/dist/highlighter/themes/attachResolvedThemes.js +1 -2
  87. package/dist/highlighter/themes/attachResolvedThemes.js.map +1 -1
  88. package/dist/highlighter/themes/cleanUpResolvedThemes.d.ts.map +1 -1
  89. package/dist/highlighter/themes/cleanUpResolvedThemes.js +1 -2
  90. package/dist/highlighter/themes/cleanUpResolvedThemes.js.map +1 -1
  91. package/dist/highlighter/themes/constants.d.ts.map +1 -1
  92. package/dist/highlighter/themes/constants.js +1 -1
  93. package/dist/highlighter/themes/constants.js.map +1 -1
  94. package/dist/highlighter/themes/getResolvedOrResolveTheme.d.ts.map +1 -1
  95. package/dist/highlighter/themes/getResolvedOrResolveTheme.js +1 -2
  96. package/dist/highlighter/themes/getResolvedOrResolveTheme.js.map +1 -1
  97. package/dist/highlighter/themes/getResolvedThemes.d.ts.map +1 -1
  98. package/dist/highlighter/themes/getResolvedThemes.js +1 -2
  99. package/dist/highlighter/themes/getResolvedThemes.js.map +1 -1
  100. package/dist/highlighter/themes/hasResolvedThemes.d.ts.map +1 -1
  101. package/dist/highlighter/themes/hasResolvedThemes.js +1 -2
  102. package/dist/highlighter/themes/hasResolvedThemes.js.map +1 -1
  103. package/dist/highlighter/themes/registerCustomCSSVariableTheme.d.ts.map +1 -1
  104. package/dist/highlighter/themes/registerCustomCSSVariableTheme.js +1 -2
  105. package/dist/highlighter/themes/registerCustomCSSVariableTheme.js.map +1 -1
  106. package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
  107. package/dist/highlighter/themes/registerCustomTheme.js +1 -2
  108. package/dist/highlighter/themes/registerCustomTheme.js.map +1 -1
  109. package/dist/highlighter/themes/resolveTheme.d.ts.map +1 -1
  110. package/dist/highlighter/themes/resolveTheme.js +1 -2
  111. package/dist/highlighter/themes/resolveTheme.js.map +1 -1
  112. package/dist/highlighter/themes/resolveThemes.d.ts.map +1 -1
  113. package/dist/highlighter/themes/resolveThemes.js +1 -2
  114. package/dist/highlighter/themes/resolveThemes.js.map +1 -1
  115. package/dist/highlighter/themes/themeResolution.d.ts.map +1 -1
  116. package/dist/highlighter/themes/themeResolution.js +1 -2
  117. package/dist/highlighter/themes/themeResolution.js.map +1 -1
  118. package/dist/highlighter/themes/themeResolver.d.ts +2 -2
  119. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -1
  120. package/dist/highlighter/themes/themeResolver.js +1 -2
  121. package/dist/highlighter/themes/themeResolver.js.map +1 -1
  122. package/dist/index.d.ts +9 -9
  123. package/dist/index.js +1 -2
  124. package/dist/managers/InteractionManager.d.ts.map +1 -1
  125. package/dist/managers/InteractionManager.js +4 -4
  126. package/dist/managers/InteractionManager.js.map +1 -1
  127. package/dist/managers/ResizeManager.d.ts.map +1 -1
  128. package/dist/managers/ResizeManager.js +2 -2
  129. package/dist/managers/ResizeManager.js.map +1 -1
  130. package/dist/managers/ScrollSyncManager.d.ts.map +1 -1
  131. package/dist/managers/ScrollSyncManager.js +1 -1
  132. package/dist/managers/ScrollSyncManager.js.map +1 -1
  133. package/dist/managers/UniversalRenderingManager.d.ts.map +1 -1
  134. package/dist/managers/UniversalRenderingManager.js +2 -2
  135. package/dist/managers/UniversalRenderingManager.js.map +1 -1
  136. package/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts +228 -0
  137. package/dist/node_modules/.pnpm/@types_hast@3.0.4/node_modules/@types/hast/index.d.ts.map +1 -0
  138. package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +84 -0
  139. package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts.map +1 -0
  140. package/dist/react/CodeView.d.ts +0 -1
  141. package/dist/react/CodeView.d.ts.map +1 -1
  142. package/dist/react/CodeView.js +9 -12
  143. package/dist/react/CodeView.js.map +1 -1
  144. package/dist/react/File.d.ts.map +1 -1
  145. package/dist/react/File.js +2 -5
  146. package/dist/react/File.js.map +1 -1
  147. package/dist/react/FileDiff.d.ts.map +1 -1
  148. package/dist/react/FileDiff.js +2 -5
  149. package/dist/react/FileDiff.js.map +1 -1
  150. package/dist/react/MultiFileDiff.d.ts.map +1 -1
  151. package/dist/react/MultiFileDiff.js +2 -5
  152. package/dist/react/MultiFileDiff.js.map +1 -1
  153. package/dist/react/PatchDiff.d.ts.map +1 -1
  154. package/dist/react/PatchDiff.js +2 -5
  155. package/dist/react/PatchDiff.js.map +1 -1
  156. package/dist/react/UnresolvedFile.d.ts +1 -1
  157. package/dist/react/UnresolvedFile.d.ts.map +1 -1
  158. package/dist/react/UnresolvedFile.js +2 -5
  159. package/dist/react/UnresolvedFile.js.map +1 -1
  160. package/dist/react/Virtualizer.d.ts.map +1 -1
  161. package/dist/react/Virtualizer.js +2 -5
  162. package/dist/react/Virtualizer.js.map +1 -1
  163. package/dist/react/WorkerPoolContext.d.ts +0 -1
  164. package/dist/react/WorkerPoolContext.d.ts.map +1 -1
  165. package/dist/react/WorkerPoolContext.js +2 -5
  166. package/dist/react/WorkerPoolContext.js.map +1 -1
  167. package/dist/react/constants.d.ts.map +1 -1
  168. package/dist/react/constants.js +1 -1
  169. package/dist/react/constants.js.map +1 -1
  170. package/dist/react/index.d.ts +1 -1
  171. package/dist/react/index.js +1 -2
  172. package/dist/react/jsx.d.ts +0 -2
  173. package/dist/react/jsx.d.ts.map +1 -1
  174. package/dist/react/types.d.ts.map +1 -1
  175. package/dist/react/utils/renderDiffChildren.d.ts.map +1 -1
  176. package/dist/react/utils/renderDiffChildren.js +4 -5
  177. package/dist/react/utils/renderDiffChildren.js.map +1 -1
  178. package/dist/react/utils/renderFileChildren.d.ts.map +1 -1
  179. package/dist/react/utils/renderFileChildren.js +4 -5
  180. package/dist/react/utils/renderFileChildren.js.map +1 -1
  181. package/dist/react/utils/templateRender.d.ts.map +1 -1
  182. package/dist/react/utils/templateRender.js +1 -2
  183. package/dist/react/utils/templateRender.js.map +1 -1
  184. package/dist/react/utils/useFileDiffInstance.d.ts.map +1 -1
  185. package/dist/react/utils/useFileDiffInstance.js +1 -2
  186. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  187. package/dist/react/utils/useFileInstance.d.ts.map +1 -1
  188. package/dist/react/utils/useFileInstance.js +1 -2
  189. package/dist/react/utils/useFileInstance.js.map +1 -1
  190. package/dist/react/utils/useStableCallback.d.ts.map +1 -1
  191. package/dist/react/utils/useStableCallback.js +1 -2
  192. package/dist/react/utils/useStableCallback.js.map +1 -1
  193. package/dist/react/utils/useUnresolvedFileInstance.d.ts.map +1 -1
  194. package/dist/react/utils/useUnresolvedFileInstance.js +10 -11
  195. package/dist/react/utils/useUnresolvedFileInstance.js.map +1 -1
  196. package/dist/renderers/DiffHunksRenderer.d.ts +4 -4
  197. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  198. package/dist/renderers/DiffHunksRenderer.js +66 -16
  199. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  200. package/dist/renderers/FileRenderer.d.ts +1 -3
  201. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  202. package/dist/renderers/FileRenderer.js +22 -8
  203. package/dist/renderers/FileRenderer.js.map +1 -1
  204. package/dist/renderers/UnresolvedFileHunksRenderer.d.ts +1 -2
  205. package/dist/renderers/UnresolvedFileHunksRenderer.d.ts.map +1 -1
  206. package/dist/renderers/UnresolvedFileHunksRenderer.js +1 -2
  207. package/dist/renderers/UnresolvedFileHunksRenderer.js.map +1 -1
  208. package/dist/shiki-stream/index.js +1 -2
  209. package/dist/shiki-stream/stream.d.ts +0 -1
  210. package/dist/shiki-stream/stream.d.ts.map +1 -1
  211. package/dist/shiki-stream/stream.js +1 -2
  212. package/dist/shiki-stream/stream.js.map +1 -1
  213. package/dist/shiki-stream/tokenizer.d.ts.map +1 -1
  214. package/dist/shiki-stream/tokenizer.js +1 -1
  215. package/dist/shiki-stream/tokenizer.js.map +1 -1
  216. package/dist/shiki-stream/types.d.ts +0 -1
  217. package/dist/shiki-stream/types.d.ts.map +1 -1
  218. package/dist/sprite.d.ts.map +1 -1
  219. package/dist/sprite.js +1 -1
  220. package/dist/ssr/FileDiffReact.d.ts.map +1 -1
  221. package/dist/ssr/FileDiffReact.js +4 -7
  222. package/dist/ssr/FileDiffReact.js.map +1 -1
  223. package/dist/ssr/index.d.ts +1 -1
  224. package/dist/ssr/index.js +1 -2
  225. package/dist/ssr/preloadDiffs.d.ts +1 -1
  226. package/dist/ssr/preloadDiffs.d.ts.map +1 -1
  227. package/dist/ssr/preloadDiffs.js +1 -2
  228. package/dist/ssr/preloadDiffs.js.map +1 -1
  229. package/dist/ssr/preloadFile.d.ts.map +1 -1
  230. package/dist/ssr/preloadFile.js +1 -2
  231. package/dist/ssr/preloadFile.js.map +1 -1
  232. package/dist/ssr/preloadPatchFile.d.ts.map +1 -1
  233. package/dist/ssr/preloadPatchFile.js +2 -3
  234. package/dist/ssr/preloadPatchFile.js.map +1 -1
  235. package/dist/ssr/renderHTML.d.ts +1 -1
  236. package/dist/ssr/renderHTML.d.ts.map +1 -1
  237. package/dist/ssr/renderHTML.js +1 -2
  238. package/dist/ssr/renderHTML.js.map +1 -1
  239. package/dist/string-import.d.ts +4 -0
  240. package/dist/string-import.d.ts.map +1 -1
  241. package/dist/style.js +3 -3
  242. package/dist/style.js.map +1 -1
  243. package/dist/types.d.ts +9 -1
  244. package/dist/types.d.ts.map +1 -1
  245. package/dist/utils/areDiffLineAnnotationsEqual.d.ts.map +1 -1
  246. package/dist/utils/areDiffLineAnnotationsEqual.js +1 -1
  247. package/dist/utils/areDiffLineAnnotationsEqual.js.map +1 -1
  248. package/dist/utils/areDiffRenderOptionsEqual.d.ts.map +1 -1
  249. package/dist/utils/areDiffRenderOptionsEqual.js +1 -2
  250. package/dist/utils/areDiffRenderOptionsEqual.js.map +1 -1
  251. package/dist/utils/areDiffTargetsEqual.d.ts.map +1 -1
  252. package/dist/utils/areDiffTargetsEqual.js +1 -1
  253. package/dist/utils/areDiffTargetsEqual.js.map +1 -1
  254. package/dist/utils/areFileRenderOptionsEqual.d.ts.map +1 -1
  255. package/dist/utils/areFileRenderOptionsEqual.js +1 -2
  256. package/dist/utils/areFileRenderOptionsEqual.js.map +1 -1
  257. package/dist/utils/areFilesEqual.d.ts.map +1 -1
  258. package/dist/utils/areFilesEqual.js +1 -1
  259. package/dist/utils/areFilesEqual.js.map +1 -1
  260. package/dist/utils/areHunkDataEqual.d.ts.map +1 -1
  261. package/dist/utils/areHunkDataEqual.js +1 -1
  262. package/dist/utils/areHunkDataEqual.js.map +1 -1
  263. package/dist/utils/areLineAnnotationsEqual.d.ts.map +1 -1
  264. package/dist/utils/areLineAnnotationsEqual.js +1 -1
  265. package/dist/utils/areLineAnnotationsEqual.js.map +1 -1
  266. package/dist/utils/areManagedSnapshotsEqual.d.ts.map +1 -1
  267. package/dist/utils/areManagedSnapshotsEqual.js +1 -1
  268. package/dist/utils/areManagedSnapshotsEqual.js.map +1 -1
  269. package/dist/utils/areMergeConflictActionsEqual.d.ts.map +1 -1
  270. package/dist/utils/areMergeConflictActionsEqual.js +1 -1
  271. package/dist/utils/areMergeConflictActionsEqual.js.map +1 -1
  272. package/dist/utils/areObjectsEqual.d.ts.map +1 -1
  273. package/dist/utils/areObjectsEqual.js +1 -1
  274. package/dist/utils/areObjectsEqual.js.map +1 -1
  275. package/dist/utils/areOptionsEqual.d.ts +0 -2
  276. package/dist/utils/areOptionsEqual.d.ts.map +1 -1
  277. package/dist/utils/areOptionsEqual.js +1 -2
  278. package/dist/utils/areOptionsEqual.js.map +1 -1
  279. package/dist/utils/arePrePropertiesEqual.d.ts.map +1 -1
  280. package/dist/utils/arePrePropertiesEqual.js +1 -1
  281. package/dist/utils/arePrePropertiesEqual.js.map +1 -1
  282. package/dist/utils/areRenderRangesEqual.d.ts.map +1 -1
  283. package/dist/utils/areRenderRangesEqual.js +1 -1
  284. package/dist/utils/areRenderRangesEqual.js.map +1 -1
  285. package/dist/utils/areSelectionPointsEqual.d.ts.map +1 -1
  286. package/dist/utils/areSelectionPointsEqual.js +1 -1
  287. package/dist/utils/areSelectionPointsEqual.js.map +1 -1
  288. package/dist/utils/areSelectionsEqual.d.ts.map +1 -1
  289. package/dist/utils/areSelectionsEqual.js +1 -1
  290. package/dist/utils/areSelectionsEqual.js.map +1 -1
  291. package/dist/utils/areThemesEqual.d.ts.map +1 -1
  292. package/dist/utils/areThemesEqual.js +1 -1
  293. package/dist/utils/areThemesEqual.js.map +1 -1
  294. package/dist/utils/areVirtualWindowSpecsEqual.d.ts.map +1 -1
  295. package/dist/utils/areVirtualWindowSpecsEqual.js +1 -1
  296. package/dist/utils/areVirtualWindowSpecsEqual.js.map +1 -1
  297. package/dist/utils/areWorkerStatsEqual.d.ts +0 -2
  298. package/dist/utils/areWorkerStatsEqual.d.ts.map +1 -1
  299. package/dist/utils/areWorkerStatsEqual.js +1 -1
  300. package/dist/utils/areWorkerStatsEqual.js.map +1 -1
  301. package/dist/utils/cleanLastNewline.d.ts.map +1 -1
  302. package/dist/utils/cleanLastNewline.js +1 -1
  303. package/dist/utils/cleanLastNewline.js.map +1 -1
  304. package/dist/utils/computeEstimatedDiffHeights.d.ts.map +1 -1
  305. package/dist/utils/computeEstimatedDiffHeights.js +1 -2
  306. package/dist/utils/computeEstimatedDiffHeights.js.map +1 -1
  307. package/dist/utils/computeVirtualFileMetrics.d.ts.map +1 -1
  308. package/dist/utils/computeVirtualFileMetrics.js +1 -2
  309. package/dist/utils/computeVirtualFileMetrics.js.map +1 -1
  310. package/dist/utils/createAnnotationElement.d.ts +1 -1
  311. package/dist/utils/createAnnotationElement.d.ts.map +1 -1
  312. package/dist/utils/createAnnotationElement.js +1 -2
  313. package/dist/utils/createAnnotationElement.js.map +1 -1
  314. package/dist/utils/createAnnotationWrapperNode.d.ts.map +1 -1
  315. package/dist/utils/createAnnotationWrapperNode.js +1 -1
  316. package/dist/utils/createAnnotationWrapperNode.js.map +1 -1
  317. package/dist/utils/createContentColumn.d.ts +1 -1
  318. package/dist/utils/createContentColumn.d.ts.map +1 -1
  319. package/dist/utils/createContentColumn.js +1 -2
  320. package/dist/utils/createContentColumn.js.map +1 -1
  321. package/dist/utils/createEmptyRowBuffer.d.ts +1 -1
  322. package/dist/utils/createEmptyRowBuffer.d.ts.map +1 -1
  323. package/dist/utils/createEmptyRowBuffer.js +1 -2
  324. package/dist/utils/createEmptyRowBuffer.js.map +1 -1
  325. package/dist/utils/createFileHeaderElement.d.ts +1 -1
  326. package/dist/utils/createFileHeaderElement.d.ts.map +1 -1
  327. package/dist/utils/createFileHeaderElement.js +1 -2
  328. package/dist/utils/createFileHeaderElement.js.map +1 -1
  329. package/dist/utils/createGutterUtilityContentNode.d.ts.map +1 -1
  330. package/dist/utils/createGutterUtilityContentNode.js +1 -1
  331. package/dist/utils/createGutterUtilityContentNode.js.map +1 -1
  332. package/dist/utils/createGutterUtilityElement.d.ts +1 -1
  333. package/dist/utils/createGutterUtilityElement.d.ts.map +1 -1
  334. package/dist/utils/createGutterUtilityElement.js +1 -2
  335. package/dist/utils/createGutterUtilityElement.js.map +1 -1
  336. package/dist/utils/createNoNewlineElement.d.ts +1 -1
  337. package/dist/utils/createNoNewlineElement.d.ts.map +1 -1
  338. package/dist/utils/createNoNewlineElement.js +1 -2
  339. package/dist/utils/createNoNewlineElement.js.map +1 -1
  340. package/dist/utils/createPreElement.d.ts +1 -1
  341. package/dist/utils/createPreElement.d.ts.map +1 -1
  342. package/dist/utils/createPreElement.js +1 -3
  343. package/dist/utils/createPreElement.js.map +1 -1
  344. package/dist/utils/createRowNodes.d.ts.map +1 -1
  345. package/dist/utils/createRowNodes.js +1 -1
  346. package/dist/utils/createRowNodes.js.map +1 -1
  347. package/dist/utils/createSeparator.d.ts +1 -1
  348. package/dist/utils/createSeparator.d.ts.map +1 -1
  349. package/dist/utils/createSeparator.js +1 -2
  350. package/dist/utils/createSeparator.js.map +1 -1
  351. package/dist/utils/createSpanNodeFromToken.d.ts.map +1 -1
  352. package/dist/utils/createSpanNodeFromToken.js +1 -2
  353. package/dist/utils/createSpanNodeFromToken.js.map +1 -1
  354. package/dist/utils/createStyleElement.d.ts +1 -1
  355. package/dist/utils/createStyleElement.d.ts.map +1 -1
  356. package/dist/utils/createStyleElement.js +1 -2
  357. package/dist/utils/createStyleElement.js.map +1 -1
  358. package/dist/utils/createTransformerWithState.d.ts.map +1 -1
  359. package/dist/utils/createTransformerWithState.js +1 -2
  360. package/dist/utils/createTransformerWithState.js.map +1 -1
  361. package/dist/utils/createUnsafeCSSStyleNode.d.ts.map +1 -1
  362. package/dist/utils/createUnsafeCSSStyleNode.js +1 -2
  363. package/dist/utils/createUnsafeCSSStyleNode.js.map +1 -1
  364. package/dist/utils/createWindowFromScrollPosition.d.ts.map +1 -1
  365. package/dist/utils/createWindowFromScrollPosition.js +5 -5
  366. package/dist/utils/createWindowFromScrollPosition.js.map +1 -1
  367. package/dist/utils/cssWrappers.d.ts.map +1 -1
  368. package/dist/utils/cssWrappers.js +2 -3
  369. package/dist/utils/cssWrappers.js.map +1 -1
  370. package/dist/utils/detachString.d.ts.map +1 -1
  371. package/dist/utils/detachString.js +1 -1
  372. package/dist/utils/detachString.js.map +1 -1
  373. package/dist/utils/diffAcceptRejectHunk.d.ts.map +1 -1
  374. package/dist/utils/diffAcceptRejectHunk.js +1 -2
  375. package/dist/utils/diffAcceptRejectHunk.js.map +1 -1
  376. package/dist/utils/formatCSSVariablePrefix.d.ts.map +1 -1
  377. package/dist/utils/formatCSSVariablePrefix.js +1 -1
  378. package/dist/utils/formatCSSVariablePrefix.js.map +1 -1
  379. package/dist/utils/getDiffHunksRendererOptions.d.ts.map +1 -1
  380. package/dist/utils/getDiffHunksRendererOptions.js +1 -1
  381. package/dist/utils/getDiffHunksRendererOptions.js.map +1 -1
  382. package/dist/utils/getFileRendererOptions.d.ts.map +1 -1
  383. package/dist/utils/getFileRendererOptions.js +1 -1
  384. package/dist/utils/getFileRendererOptions.js.map +1 -1
  385. package/dist/utils/getFiletypeFromFileName.d.ts.map +1 -1
  386. package/dist/utils/getFiletypeFromFileName.js +1 -1
  387. package/dist/utils/getFiletypeFromFileName.js.map +1 -1
  388. package/dist/utils/getHighlighterOptions.d.ts.map +1 -1
  389. package/dist/utils/getHighlighterOptions.js +1 -2
  390. package/dist/utils/getHighlighterOptions.js.map +1 -1
  391. package/dist/utils/getHighlighterThemeStyles.d.ts.map +1 -1
  392. package/dist/utils/getHighlighterThemeStyles.js +1 -2
  393. package/dist/utils/getHighlighterThemeStyles.js.map +1 -1
  394. package/dist/utils/getHunkSeparatorSlotName.d.ts.map +1 -1
  395. package/dist/utils/getHunkSeparatorSlotName.js +1 -1
  396. package/dist/utils/getHunkSeparatorSlotName.js.map +1 -1
  397. package/dist/utils/getIconForType.d.ts.map +1 -1
  398. package/dist/utils/getIconForType.js +1 -1
  399. package/dist/utils/getIconForType.js.map +1 -1
  400. package/dist/utils/getLineAnnotationName.d.ts.map +1 -1
  401. package/dist/utils/getLineAnnotationName.js +1 -1
  402. package/dist/utils/getLineAnnotationName.js.map +1 -1
  403. package/dist/utils/getLineEndingType.d.ts.map +1 -1
  404. package/dist/utils/getLineEndingType.js +1 -1
  405. package/dist/utils/getLineEndingType.js.map +1 -1
  406. package/dist/utils/getLineNodes.d.ts +1 -1
  407. package/dist/utils/getLineNodes.d.ts.map +1 -1
  408. package/dist/utils/getLineNodes.js +1 -1
  409. package/dist/utils/getLineNodes.js.map +1 -1
  410. package/dist/utils/getMergeConflictActionSlotName.d.ts.map +1 -1
  411. package/dist/utils/getMergeConflictActionSlotName.js +1 -1
  412. package/dist/utils/getMergeConflictActionSlotName.js.map +1 -1
  413. package/dist/utils/getMergeConflictLineTypes.d.ts.map +1 -1
  414. package/dist/utils/getMergeConflictLineTypes.js +1 -2
  415. package/dist/utils/getMergeConflictLineTypes.js.map +1 -1
  416. package/dist/utils/getOrCreateCodeNode.d.ts.map +1 -1
  417. package/dist/utils/getOrCreateCodeNode.js +1 -1
  418. package/dist/utils/getOrCreateCodeNode.js.map +1 -1
  419. package/dist/utils/getSingularPatch.d.ts.map +1 -1
  420. package/dist/utils/getSingularPatch.js +1 -2
  421. package/dist/utils/getSingularPatch.js.map +1 -1
  422. package/dist/utils/getThemes.d.ts.map +1 -1
  423. package/dist/utils/getThemes.js +1 -2
  424. package/dist/utils/getThemes.js.map +1 -1
  425. package/dist/utils/getTotalLineCountFromHunks.d.ts.map +1 -1
  426. package/dist/utils/getTotalLineCountFromHunks.js +1 -1
  427. package/dist/utils/getTotalLineCountFromHunks.js.map +1 -1
  428. package/dist/utils/hast_utils.d.ts +1 -1
  429. package/dist/utils/hast_utils.d.ts.map +1 -1
  430. package/dist/utils/hast_utils.js +1 -1
  431. package/dist/utils/hast_utils.js.map +1 -1
  432. package/dist/utils/hostTheme.d.ts.map +1 -1
  433. package/dist/utils/hostTheme.js +1 -2
  434. package/dist/utils/hostTheme.js.map +1 -1
  435. package/dist/utils/includesFileAnnotations.d.ts +17 -0
  436. package/dist/utils/includesFileAnnotations.d.ts.map +1 -0
  437. package/dist/utils/includesFileAnnotations.js +19 -0
  438. package/dist/utils/includesFileAnnotations.js.map +1 -0
  439. package/dist/utils/isDefaultRenderRange.d.ts.map +1 -1
  440. package/dist/utils/isDefaultRenderRange.js +1 -1
  441. package/dist/utils/isDefaultRenderRange.js.map +1 -1
  442. package/dist/utils/isDiffPlainText.d.ts.map +1 -1
  443. package/dist/utils/isDiffPlainText.js +1 -2
  444. package/dist/utils/isDiffPlainText.js.map +1 -1
  445. package/dist/utils/isFilePlainText.d.ts.map +1 -1
  446. package/dist/utils/isFilePlainText.js +1 -2
  447. package/dist/utils/isFilePlainText.js.map +1 -1
  448. package/dist/utils/isStyleNode.d.ts.map +1 -1
  449. package/dist/utils/isStyleNode.js +1 -1
  450. package/dist/utils/isStyleNode.js.map +1 -1
  451. package/dist/utils/isWorkerContext.d.ts.map +1 -1
  452. package/dist/utils/isWorkerContext.js +1 -1
  453. package/dist/utils/isWorkerContext.js.map +1 -1
  454. package/dist/utils/iterateOverDiff.d.ts.map +1 -1
  455. package/dist/utils/iterateOverDiff.js +44 -45
  456. package/dist/utils/iterateOverDiff.js.map +1 -1
  457. package/dist/utils/iterateOverFile.d.ts.map +1 -1
  458. package/dist/utils/iterateOverFile.js +1 -1
  459. package/dist/utils/iterateOverFile.js.map +1 -1
  460. package/dist/utils/normalizeDiffResolution.d.ts.map +1 -1
  461. package/dist/utils/normalizeDiffResolution.js +1 -1
  462. package/dist/utils/normalizeDiffResolution.js.map +1 -1
  463. package/dist/utils/parseDiffDecorations.d.ts.map +1 -1
  464. package/dist/utils/parseDiffDecorations.js +1 -2
  465. package/dist/utils/parseDiffDecorations.js.map +1 -1
  466. package/dist/utils/parseDiffFromFile.d.ts +0 -1
  467. package/dist/utils/parseDiffFromFile.d.ts.map +1 -1
  468. package/dist/utils/parseDiffFromFile.js +1 -2
  469. package/dist/utils/parseDiffFromFile.js.map +1 -1
  470. package/dist/utils/parseLineType.d.ts.map +1 -1
  471. package/dist/utils/parseLineType.js +1 -1
  472. package/dist/utils/parseLineType.js.map +1 -1
  473. package/dist/utils/parseMergeConflictDiffFromFile.d.ts.map +1 -1
  474. package/dist/utils/parseMergeConflictDiffFromFile.js +5 -5
  475. package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -1
  476. package/dist/utils/parsePatchFiles.d.ts.map +1 -1
  477. package/dist/utils/parsePatchFiles.js +6 -7
  478. package/dist/utils/parsePatchFiles.js.map +1 -1
  479. package/dist/utils/prefersReducedMotion.d.ts.map +1 -1
  480. package/dist/utils/prefersReducedMotion.js +1 -1
  481. package/dist/utils/prefersReducedMotion.js.map +1 -1
  482. package/dist/utils/prerenderHTMLIfNecessary.d.ts.map +1 -1
  483. package/dist/utils/prerenderHTMLIfNecessary.js +1 -1
  484. package/dist/utils/prerenderHTMLIfNecessary.js.map +1 -1
  485. package/dist/utils/processLine.d.ts +1 -1
  486. package/dist/utils/processLine.d.ts.map +1 -1
  487. package/dist/utils/processLine.js +1 -2
  488. package/dist/utils/processLine.js.map +1 -1
  489. package/dist/utils/renderDiffWithHighlighter.d.ts.map +1 -1
  490. package/dist/utils/renderDiffWithHighlighter.js +8 -7
  491. package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
  492. package/dist/utils/renderFileWithHighlighter.d.ts.map +1 -1
  493. package/dist/utils/renderFileWithHighlighter.js +5 -4
  494. package/dist/utils/renderFileWithHighlighter.js.map +1 -1
  495. package/dist/utils/resolveConflict.d.ts.map +1 -1
  496. package/dist/utils/resolveConflict.js +1 -2
  497. package/dist/utils/resolveConflict.js.map +1 -1
  498. package/dist/utils/resolveRegion.d.ts.map +1 -1
  499. package/dist/utils/resolveRegion.js +1 -1
  500. package/dist/utils/resolveRegion.js.map +1 -1
  501. package/dist/utils/roundToDevicePixel.d.ts.map +1 -1
  502. package/dist/utils/roundToDevicePixel.js +1 -1
  503. package/dist/utils/roundToDevicePixel.js.map +1 -1
  504. package/dist/utils/scrollbarGutter.d.ts.map +1 -1
  505. package/dist/utils/scrollbarGutter.js +1 -2
  506. package/dist/utils/scrollbarGutter.js.map +1 -1
  507. package/dist/utils/setLanguageOverride.d.ts.map +1 -1
  508. package/dist/utils/setLanguageOverride.js +1 -1
  509. package/dist/utils/setLanguageOverride.js.map +1 -1
  510. package/dist/utils/setWrapperNodeProps.d.ts.map +1 -1
  511. package/dist/utils/setWrapperNodeProps.js +1 -2
  512. package/dist/utils/setWrapperNodeProps.js.map +1 -1
  513. package/dist/utils/shouldUseTokenTransformer.d.ts.map +1 -1
  514. package/dist/utils/shouldUseTokenTransformer.js +1 -1
  515. package/dist/utils/shouldUseTokenTransformer.js.map +1 -1
  516. package/dist/utils/splitFileContents.d.ts.map +1 -1
  517. package/dist/utils/splitFileContents.js +1 -2
  518. package/dist/utils/splitFileContents.js.map +1 -1
  519. package/dist/utils/trimPatchContext.d.ts.map +1 -1
  520. package/dist/utils/trimPatchContext.js +1 -2
  521. package/dist/utils/trimPatchContext.js.map +1 -1
  522. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  523. package/dist/utils/virtualDiffLayout.js +1 -2
  524. package/dist/utils/virtualDiffLayout.js.map +1 -1
  525. package/dist/utils/wrapTokenFragments.d.ts +1 -1
  526. package/dist/utils/wrapTokenFragments.d.ts.map +1 -1
  527. package/dist/utils/wrapTokenFragments.js +1 -2
  528. package/dist/utils/wrapTokenFragments.js.map +1 -1
  529. package/dist/worker/WorkerPoolManager.d.ts.map +1 -1
  530. package/dist/worker/WorkerPoolManager.js +5 -5
  531. package/dist/worker/WorkerPoolManager.js.map +1 -1
  532. package/dist/worker/getOrCreateWorkerPoolSingleton.d.ts.map +1 -1
  533. package/dist/worker/getOrCreateWorkerPoolSingleton.js +1 -2
  534. package/dist/worker/getOrCreateWorkerPoolSingleton.js.map +1 -1
  535. package/dist/worker/index.js +1 -2
  536. package/dist/worker/types.d.ts.map +1 -1
  537. package/dist/worker/wasm-B9ZqxnKj.js +8 -0
  538. package/dist/worker/wasm-B9ZqxnKj.js.map +1 -0
  539. package/dist/worker/worker-portable.js +2769 -6370
  540. package/dist/worker/worker-portable.js.map +1 -1
  541. package/dist/worker/worker.js +97 -128
  542. package/dist/worker/worker.js.map +1 -1
  543. package/package.json +15 -19
  544. package/dist/worker/wasm-qE0LgnY3.js +0 -10
  545. package/dist/worker/wasm-qE0LgnY3.js.map +0 -1
@@ -56,7 +56,7 @@ var ScrollSyncManager = class {
56
56
  this.codeDeletions?.scrollTo({ left: this.codeAdditions?.scrollLeft });
57
57
  };
58
58
  };
59
-
60
59
  //#endregion
61
60
  export { ScrollSyncManager };
61
+
62
62
  //# sourceMappingURL=ScrollSyncManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollSyncManager.js","names":[],"sources":["../../src/managers/ScrollSyncManager.ts"],"sourcesContent":["export class ScrollSyncManager {\n isDeletionsScrolling: boolean = false;\n isAdditionsScrolling: boolean = false;\n timeoutId: NodeJS.Timeout = -1 as unknown as NodeJS.Timeout;\n codeDeletions: HTMLElement | undefined;\n codeAdditions: HTMLElement | undefined;\n private enabled = false;\n\n cleanUp(): void {\n if (!this.enabled) {\n return;\n }\n this.codeDeletions?.removeEventListener(\n 'scroll',\n this.handleDeletionsScroll\n );\n this.codeAdditions?.removeEventListener(\n 'scroll',\n this.handleAdditionsScroll\n );\n clearTimeout(this.timeoutId);\n this.codeDeletions = undefined;\n this.codeAdditions = undefined;\n this.enabled = false;\n }\n\n setup(\n pre: HTMLPreElement,\n codeDeletions?: HTMLElement,\n codeAdditions?: HTMLElement\n ): void {\n // If no code elements were provided, lets try to find them in\n // the pre element\n if (codeDeletions == null || codeAdditions == null) {\n for (const element of pre.children ?? []) {\n if (!(element instanceof HTMLElement)) {\n continue;\n }\n if ('deletions' in element.dataset) {\n codeDeletions = element;\n } else if ('additions' in element.dataset) {\n codeAdditions = element;\n }\n }\n }\n if (codeAdditions == null || codeDeletions == null) {\n this.cleanUp();\n return;\n }\n\n if (this.codeDeletions !== codeDeletions) {\n this.codeDeletions?.removeEventListener(\n 'scroll',\n this.handleDeletionsScroll\n );\n this.codeDeletions = codeDeletions;\n codeDeletions.addEventListener('scroll', this.handleDeletionsScroll, {\n passive: true,\n });\n }\n if (this.codeAdditions !== codeAdditions) {\n this.codeAdditions?.removeEventListener(\n 'scroll',\n this.handleAdditionsScroll\n );\n this.codeAdditions = codeAdditions;\n codeAdditions.addEventListener('scroll', this.handleAdditionsScroll, {\n passive: true,\n });\n }\n this.enabled = true;\n }\n\n private handleDeletionsScroll = () => {\n if (this.isAdditionsScrolling) {\n return;\n }\n this.isDeletionsScrolling = true;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n this.isDeletionsScrolling = false;\n }, 300);\n this.codeAdditions?.scrollTo({\n left: this.codeDeletions?.scrollLeft,\n });\n };\n\n private handleAdditionsScroll = () => {\n if (this.isDeletionsScrolling) {\n return;\n }\n this.isAdditionsScrolling = true;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n this.isAdditionsScrolling = false;\n }, 300);\n this.codeDeletions?.scrollTo({\n left: this.codeAdditions?.scrollLeft,\n });\n };\n}\n"],"mappings":";AAAA,IAAa,oBAAb,MAA+B;CAC7B,uBAAgC;CAChC,uBAAgC;CAChC,YAA4B;CAC5B;CACA;CACA,AAAQ,UAAU;CAElB,UAAgB;AACd,MAAI,CAAC,KAAK,QACR;AAEF,OAAK,eAAe,oBAClB,UACA,KAAK,sBACN;AACD,OAAK,eAAe,oBAClB,UACA,KAAK,sBACN;AACD,eAAa,KAAK,UAAU;AAC5B,OAAK,gBAAgB;AACrB,OAAK,gBAAgB;AACrB,OAAK,UAAU;;CAGjB,MACE,KACA,eACA,eACM;AAGN,MAAI,iBAAiB,QAAQ,iBAAiB,KAC5C,MAAK,MAAM,WAAW,IAAI,YAAY,EAAE,EAAE;AACxC,OAAI,EAAE,mBAAmB,aACvB;AAEF,OAAI,eAAe,QAAQ,QACzB,iBAAgB;YACP,eAAe,QAAQ,QAChC,iBAAgB;;AAItB,MAAI,iBAAiB,QAAQ,iBAAiB,MAAM;AAClD,QAAK,SAAS;AACd;;AAGF,MAAI,KAAK,kBAAkB,eAAe;AACxC,QAAK,eAAe,oBAClB,UACA,KAAK,sBACN;AACD,QAAK,gBAAgB;AACrB,iBAAc,iBAAiB,UAAU,KAAK,uBAAuB,EACnE,SAAS,MACV,CAAC;;AAEJ,MAAI,KAAK,kBAAkB,eAAe;AACxC,QAAK,eAAe,oBAClB,UACA,KAAK,sBACN;AACD,QAAK,gBAAgB;AACrB,iBAAc,iBAAiB,UAAU,KAAK,uBAAuB,EACnE,SAAS,MACV,CAAC;;AAEJ,OAAK,UAAU;;CAGjB,AAAQ,8BAA8B;AACpC,MAAI,KAAK,qBACP;AAEF,OAAK,uBAAuB;AAC5B,eAAa,KAAK,UAAU;AAC5B,OAAK,YAAY,iBAAiB;AAChC,QAAK,uBAAuB;KAC3B,IAAI;AACP,OAAK,eAAe,SAAS,EAC3B,MAAM,KAAK,eAAe,YAC3B,CAAC;;CAGJ,AAAQ,8BAA8B;AACpC,MAAI,KAAK,qBACP;AAEF,OAAK,uBAAuB;AAC5B,eAAa,KAAK,UAAU;AAC5B,OAAK,YAAY,iBAAiB;AAChC,QAAK,uBAAuB;KAC3B,IAAI;AACP,OAAK,eAAe,SAAS,EAC3B,MAAM,KAAK,eAAe,YAC3B,CAAC"}
1
+ {"version":3,"file":"ScrollSyncManager.js","names":[],"sources":["../../src/managers/ScrollSyncManager.ts"],"sourcesContent":["export class ScrollSyncManager {\n isDeletionsScrolling: boolean = false;\n isAdditionsScrolling: boolean = false;\n timeoutId: NodeJS.Timeout = -1 as unknown as NodeJS.Timeout;\n codeDeletions: HTMLElement | undefined;\n codeAdditions: HTMLElement | undefined;\n private enabled = false;\n\n cleanUp(): void {\n if (!this.enabled) {\n return;\n }\n this.codeDeletions?.removeEventListener(\n 'scroll',\n this.handleDeletionsScroll\n );\n this.codeAdditions?.removeEventListener(\n 'scroll',\n this.handleAdditionsScroll\n );\n clearTimeout(this.timeoutId);\n this.codeDeletions = undefined;\n this.codeAdditions = undefined;\n this.enabled = false;\n }\n\n setup(\n pre: HTMLPreElement,\n codeDeletions?: HTMLElement,\n codeAdditions?: HTMLElement\n ): void {\n // If no code elements were provided, lets try to find them in\n // the pre element\n if (codeDeletions == null || codeAdditions == null) {\n for (const element of pre.children ?? []) {\n if (!(element instanceof HTMLElement)) {\n continue;\n }\n if ('deletions' in element.dataset) {\n codeDeletions = element;\n } else if ('additions' in element.dataset) {\n codeAdditions = element;\n }\n }\n }\n if (codeAdditions == null || codeDeletions == null) {\n this.cleanUp();\n return;\n }\n\n if (this.codeDeletions !== codeDeletions) {\n this.codeDeletions?.removeEventListener(\n 'scroll',\n this.handleDeletionsScroll\n );\n this.codeDeletions = codeDeletions;\n codeDeletions.addEventListener('scroll', this.handleDeletionsScroll, {\n passive: true,\n });\n }\n if (this.codeAdditions !== codeAdditions) {\n this.codeAdditions?.removeEventListener(\n 'scroll',\n this.handleAdditionsScroll\n );\n this.codeAdditions = codeAdditions;\n codeAdditions.addEventListener('scroll', this.handleAdditionsScroll, {\n passive: true,\n });\n }\n this.enabled = true;\n }\n\n private handleDeletionsScroll = () => {\n if (this.isAdditionsScrolling) {\n return;\n }\n this.isDeletionsScrolling = true;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n this.isDeletionsScrolling = false;\n }, 300);\n this.codeAdditions?.scrollTo({\n left: this.codeDeletions?.scrollLeft,\n });\n };\n\n private handleAdditionsScroll = () => {\n if (this.isDeletionsScrolling) {\n return;\n }\n this.isAdditionsScrolling = true;\n clearTimeout(this.timeoutId);\n this.timeoutId = setTimeout(() => {\n this.isAdditionsScrolling = false;\n }, 300);\n this.codeDeletions?.scrollTo({\n left: this.codeAdditions?.scrollLeft,\n });\n };\n}\n"],"mappings":";AAAA,IAAa,oBAAb,MAA+B;CAC7B,uBAAgC;CAChC,uB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AY,iBAAiB;GAChC,KAAK,uBAAuB;EAC9B,GAAG,GAAG;EACN,KAAK,eAAe,SAAS,EAC3B,MAAM,KAAK,eAAe,WAC5B,CAAC;CACH;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"UniversalRenderingManager.d.ts","names":["Callback","queueRender","dequeueRender"],"sources":["../../src/managers/UniversalRenderingManager.d.ts"],"sourcesContent":["type Callback = (time: number) => unknown;\nexport declare function queueRender(callback: Callback): void;\nexport declare function dequeueRender(callback: Callback): void;\nexport {};\n//# sourceMappingURL=UniversalRenderingManager.d.ts.map"],"mappings":";KAAKA,QAAAA;AAAAA,iBACmBC,WAAAA,CADX,QAAA,EACiCD,QADjC,CAAA,EAAA,IAAA;AACWC,iBACAC,aAAAA,CADsBF,QAAQ,EACNA,QADM,CAAA,EAAA,IAAA"}
1
+ {"version":3,"file":"UniversalRenderingManager.d.ts","names":[],"sources":["../../src/managers/UniversalRenderingManager.ts"],"mappings":";KAAK,QAAA,IAAY,IAAY;AAAA,iBAMb,WAAA,CAAY,QAAkB,EAAR,QAAQ;AAAA,iBAK9B,aAAA,CAAc,QAAkB,EAAR,QAAQ"}
@@ -1,5 +1,5 @@
1
1
  //#region src/managers/UniversalRenderingManager.ts
2
- let callbacks = /* @__PURE__ */ new Set();
2
+ const callbacks = /* @__PURE__ */ new Set();
3
3
  let frameId = null;
4
4
  function queueRender(callback) {
5
5
  callbacks.add(callback);
@@ -23,7 +23,7 @@ function render(time) {
23
23
  if (callbacks.size > 0) frameId = requestAnimationFrame(render);
24
24
  else frameId = null;
25
25
  }
26
-
27
26
  //#endregion
28
27
  export { dequeueRender, queueRender };
28
+
29
29
  //# sourceMappingURL=UniversalRenderingManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UniversalRenderingManager.js","names":["frameId: null | number"],"sources":["../../src/managers/UniversalRenderingManager.ts"],"sourcesContent":["type Callback = (time: number) => unknown;\n\nlet callbacks = new Set<Callback>();\nlet frameId: null | number = null;\n\n// TODO(amadeus): Figure out a proper name for this module...\nexport function queueRender(callback: Callback): void {\n callbacks.add(callback);\n frameId ??= requestAnimationFrame(render);\n}\n\nexport function dequeueRender(callback: Callback): void {\n callbacks.delete(callback);\n if (callbacks.size === 0 && frameId != null) {\n cancelAnimationFrame(frameId);\n frameId = null;\n }\n}\n\nfunction render(time: number): void {\n const toIterate = new Set(callbacks);\n callbacks.clear();\n for (const callback of toIterate) {\n try {\n callback(time);\n } catch (error) {\n console.error(error);\n }\n }\n // If render picked up any new callbacks, lets trigger a new\n // requestAnimationFrame\n if (callbacks.size > 0) {\n frameId = requestAnimationFrame(render);\n } else {\n frameId = null;\n }\n}\n"],"mappings":";AAEA,IAAI,4BAAY,IAAI,KAAe;AACnC,IAAIA,UAAyB;AAG7B,SAAgB,YAAY,UAA0B;AACpD,WAAU,IAAI,SAAS;AACvB,aAAY,sBAAsB,OAAO;;AAG3C,SAAgB,cAAc,UAA0B;AACtD,WAAU,OAAO,SAAS;AAC1B,KAAI,UAAU,SAAS,KAAK,WAAW,MAAM;AAC3C,uBAAqB,QAAQ;AAC7B,YAAU;;;AAId,SAAS,OAAO,MAAoB;CAClC,MAAM,YAAY,IAAI,IAAI,UAAU;AACpC,WAAU,OAAO;AACjB,MAAK,MAAM,YAAY,UACrB,KAAI;AACF,WAAS,KAAK;UACP,OAAO;AACd,UAAQ,MAAM,MAAM;;AAKxB,KAAI,UAAU,OAAO,EACnB,WAAU,sBAAsB,OAAO;KAEvC,WAAU"}
1
+ {"version":3,"file":"UniversalRenderingManager.js","names":[],"sources":["../../src/managers/UniversalRenderingManager.ts"],"sourcesContent":["type Callback = (time: number) => unknown;\n\nconst callbacks = new Set<Callback>();\nlet frameId: null | number = null;\n\n// TODO(amadeus): Figure out a proper name for this module...\nexport function queueRender(callback: Callback): void {\n callbacks.add(callback);\n frameId ??= requestAnimationFrame(render);\n}\n\nexport function dequeueRender(callback: Callback): void {\n callbacks.delete(callback);\n if (callbacks.size === 0 && frameId != null) {\n cancelAnimationFrame(frameId);\n frameId = null;\n }\n}\n\nfunction render(time: number): void {\n const toIterate = new Set(callbacks);\n callbacks.clear();\n for (const callback of toIterate) {\n try {\n callback(time);\n } catch (error) {\n console.error(error);\n }\n }\n // If render picked up any new callbacks, lets trigger a new\n // requestAnimationFrame\n if (callbacks.size > 0) {\n frameId = requestAnimationFrame(render);\n } else {\n frameId = null;\n }\n}\n"],"mappings":";AAEA,MAAM,4BAAY,IAAI,IAAc;AACpC,IAAI,UAAyB;AAG7B,SAAgB,YAAY,UAA0B;CACpD,UAAU,IAAI,QAAQ;CACtB,YAAY,sBAAsB,MAAM;AAC1C;AAEA,SAAgB,cAAc,UAA0B;CACtD,UAAU,OAAO,QAAQ;CACzB,IAAI,UAAU,SAAS,KAAK,WAAW,MAAM;EAC3C,qBAAqB,OAAO;EAC5B,UAAU;CACZ;AACF;AAEA,SAAS,OAAO,MAAoB;CAClC,MAAM,YAAY,IAAI,IAAI,SAAS;CACnC,UAAU,MAAM;CAChB,KAAK,MAAM,YAAY,WACrB,IAAI;EACF,SAAS,IAAI;CACf,SAAS,OAAO;EACd,QAAQ,MAAM,KAAK;CACrB;CAIF,IAAI,UAAU,OAAO,GACnB,UAAU,sBAAsB,MAAM;MAEtC,UAAU;AAEd"}
@@ -0,0 +1,228 @@
1
+ import { Data as Data$1, Node as Node$1 } from "../../../../@types_unist@3.0.3/node_modules/@types/unist/index.js";
2
+
3
+ //#region ../../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts
4
+ // ## Interfaces
5
+ /**
6
+ * Info associated with hast nodes by the ecosystem.
7
+ *
8
+ * This space is guaranteed to never be specified by unist or hast.
9
+ * But you can use it in utilities and plugins to store data.
10
+ *
11
+ * This type can be augmented to register custom data.
12
+ * For example:
13
+ *
14
+ * ```ts
15
+ * declare module 'hast' {
16
+ * interface Data {
17
+ * // `someNode.data.myId` is typed as `number | undefined`
18
+ * myId?: number | undefined
19
+ * }
20
+ * }
21
+ * ```
22
+ */
23
+ interface Data extends Data$1 {}
24
+ /**
25
+ * Info associated with an element.
26
+ */
27
+ interface Properties {
28
+ [PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
29
+ }
30
+ // ## Content maps
31
+ /**
32
+ * Union of registered hast nodes that can occur in {@link Element}.
33
+ *
34
+ * To register mote custom hast nodes, add them to {@link ElementContentMap}.
35
+ * They will be automatically added here.
36
+ */
37
+ type ElementContent = ElementContentMap[keyof ElementContentMap];
38
+ /**
39
+ * Registry of all hast nodes that can occur as children of {@link Element}.
40
+ *
41
+ * For a union of all {@link Element} children, see {@link ElementContent}.
42
+ */
43
+ interface ElementContentMap {
44
+ comment: Comment;
45
+ element: Element;
46
+ text: Text;
47
+ }
48
+ /**
49
+ * Union of registered hast nodes that can occur in {@link Root}.
50
+ *
51
+ * To register custom hast nodes, add them to {@link RootContentMap}.
52
+ * They will be automatically added here.
53
+ */
54
+ type RootContent = RootContentMap[keyof RootContentMap];
55
+ /**
56
+ * Registry of all hast nodes that can occur as children of {@link Root}.
57
+ *
58
+ * > 👉 **Note**: {@link Root} does not need to be an entire document.
59
+ * > it can also be a fragment.
60
+ *
61
+ * For a union of all {@link Root} children, see {@link RootContent}.
62
+ */
63
+ interface RootContentMap {
64
+ comment: Comment;
65
+ doctype: Doctype;
66
+ element: Element;
67
+ text: Text;
68
+ }
69
+ // ## Abstract nodes
70
+ /**
71
+ * Abstract hast node.
72
+ *
73
+ * This interface is supposed to be extended.
74
+ * If you can use {@link Literal} or {@link Parent}, you should.
75
+ * But for example in HTML, a `Doctype` is neither literal nor parent, but
76
+ * still a node.
77
+ *
78
+ * To register custom hast nodes, add them to {@link RootContentMap} and other
79
+ * places where relevant (such as {@link ElementContentMap}).
80
+ *
81
+ * For a union of all registered hast nodes, see {@link Nodes}.
82
+ */
83
+ interface Node extends Node$1 {
84
+ /**
85
+ * Info from the ecosystem.
86
+ */
87
+ data?: Data | undefined;
88
+ }
89
+ /**
90
+ * Abstract hast node that contains the smallest possible value.
91
+ *
92
+ * This interface is supposed to be extended if you make custom hast nodes.
93
+ *
94
+ * For a union of all registered hast literals, see {@link Literals}.
95
+ */
96
+ interface Literal extends Node {
97
+ /**
98
+ * Plain-text value.
99
+ */
100
+ value: string;
101
+ }
102
+ /**
103
+ * Abstract hast node that contains other hast nodes (*children*).
104
+ *
105
+ * This interface is supposed to be extended if you make custom hast nodes.
106
+ *
107
+ * For a union of all registered hast parents, see {@link Parents}.
108
+ */
109
+ interface Parent extends Node {
110
+ /**
111
+ * List of children.
112
+ */
113
+ children: RootContent[];
114
+ }
115
+ // ## Concrete nodes
116
+ /**
117
+ * HTML comment.
118
+ */
119
+ interface Comment extends Literal {
120
+ /**
121
+ * Node type of HTML comments in hast.
122
+ */
123
+ type: "comment";
124
+ /**
125
+ * Data associated with the comment.
126
+ */
127
+ data?: CommentData | undefined;
128
+ }
129
+ /**
130
+ * Info associated with hast comments by the ecosystem.
131
+ */
132
+ interface CommentData extends Data {}
133
+ /**
134
+ * HTML document type.
135
+ */
136
+ interface Doctype extends Node$1 {
137
+ /**
138
+ * Node type of HTML document types in hast.
139
+ */
140
+ type: "doctype";
141
+ /**
142
+ * Data associated with the doctype.
143
+ */
144
+ data?: DoctypeData | undefined;
145
+ }
146
+ /**
147
+ * Info associated with hast doctypes by the ecosystem.
148
+ */
149
+ interface DoctypeData extends Data {}
150
+ /**
151
+ * HTML element.
152
+ */
153
+ interface Element extends Parent {
154
+ /**
155
+ * Node type of elements.
156
+ */
157
+ type: "element";
158
+ /**
159
+ * Tag name (such as `'body'`) of the element.
160
+ */
161
+ tagName: string;
162
+ /**
163
+ * Info associated with the element.
164
+ */
165
+ properties: Properties;
166
+ /**
167
+ * Children of element.
168
+ */
169
+ children: ElementContent[];
170
+ /**
171
+ * When the `tagName` field is `'template'`, a `content` field can be
172
+ * present.
173
+ */
174
+ content?: Root | undefined;
175
+ /**
176
+ * Data associated with the element.
177
+ */
178
+ data?: ElementData | undefined;
179
+ }
180
+ /**
181
+ * Info associated with hast elements by the ecosystem.
182
+ */
183
+ interface ElementData extends Data {}
184
+ /**
185
+ * Document fragment or a whole document.
186
+ *
187
+ * Should be used as the root of a tree and must not be used as a child.
188
+ *
189
+ * Can also be used as the value for the content field on a `'template'` element.
190
+ */
191
+ interface Root extends Parent {
192
+ /**
193
+ * Node type of hast root.
194
+ */
195
+ type: "root";
196
+ /**
197
+ * Children of root.
198
+ */
199
+ children: RootContent[];
200
+ /**
201
+ * Data associated with the hast root.
202
+ */
203
+ data?: RootData | undefined;
204
+ }
205
+ /**
206
+ * Info associated with hast root nodes by the ecosystem.
207
+ */
208
+ interface RootData extends Data {}
209
+ /**
210
+ * HTML character data (plain text).
211
+ */
212
+ interface Text extends Literal {
213
+ /**
214
+ * Node type of HTML character data (plain text) in hast.
215
+ */
216
+ type: "text";
217
+ /**
218
+ * Data associated with the text.
219
+ */
220
+ data?: TextData | undefined;
221
+ }
222
+ /**
223
+ * Info associated with hast texts by the ecosystem.
224
+ */
225
+ interface TextData extends Data {}
226
+ //#endregion
227
+ export { Comment, CommentData, Data, Doctype, DoctypeData, Element, ElementContent, ElementContentMap, ElementData, Literal, Node, Parent, Properties, Root, RootContent, RootContentMap, RootData, Text, TextData };
228
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["UnistData","PropertyName","Array","ElementContentMap","comment","Comment","element","Element","text","Text","RootContentMap","doctype","Doctype","RootContent","Extract","Nodes","UnistLiteral","Root","UnistParent","UnistNode","data","Data","Node","value","children","Literal","type","CommentData","DoctypeData","Parent","tagName","properties","Properties","ElementContent","content","ElementData","RootData","TextData"],"sources":["../../../../../../../../../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;;;;AAsBuC;AAKvC;;;;AACgF;AAWhF;;;;AAAsE;AAOtE;;;;UAxBiB,IAAA,SAAa,MAAS;;;;UAKtB,UAAA;EAAA,CACZC,YAAAA,0DAAsE,KAA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,QAAA;AAAA;;;;UAMM,QAAA,SAAiB,IAAI;;;;UAKrB,IAAA,SAAa,OAAO;;;;EAIjCM,IAAAA;;;;EAIAN,IAAAA,GAAO,QAAA;AAAA;;;;UAMM,QAAA,SAAiB,IAAI"}
@@ -0,0 +1,84 @@
1
+ //#region ../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
2
+ // ## Interfaces
3
+ /**
4
+ * Info associated with nodes by the ecosystem.
5
+ *
6
+ * This space is guaranteed to never be specified by unist or specifications
7
+ * implementing unist.
8
+ * But you can use it in utilities and plugins to store data.
9
+ *
10
+ * This type can be augmented to register custom data.
11
+ * For example:
12
+ *
13
+ * ```ts
14
+ * declare module 'unist' {
15
+ * interface Data {
16
+ * // `someNode.data.myId` is typed as `number | undefined`
17
+ * myId?: number | undefined
18
+ * }
19
+ * }
20
+ * ```
21
+ */
22
+ interface Data {}
23
+ /**
24
+ * One place in a source file.
25
+ */
26
+ interface Point {
27
+ /**
28
+ * Line in a source file (1-indexed integer).
29
+ */
30
+ line: number;
31
+ /**
32
+ * Column in a source file (1-indexed integer).
33
+ */
34
+ column: number;
35
+ /**
36
+ * Character in a source file (0-indexed integer).
37
+ */
38
+ offset?: number | undefined;
39
+ }
40
+ /**
41
+ * Position of a node in a source document.
42
+ *
43
+ * A position is a range between two points.
44
+ */
45
+ interface Position {
46
+ /**
47
+ * Place of the first character of the parsed source region.
48
+ */
49
+ start: Point;
50
+ /**
51
+ * Place of the first character after the parsed source region.
52
+ */
53
+ end: Point;
54
+ }
55
+ /**
56
+ * Abstract unist node.
57
+ *
58
+ * The syntactic unit in unist syntax trees are called nodes.
59
+ *
60
+ * This interface is supposed to be extended.
61
+ * If you can use {@link Literal} or {@link Parent}, you should.
62
+ * But for example in markdown, a `thematicBreak` (`***`), is neither literal
63
+ * nor parent, but still a node.
64
+ */
65
+ interface Node {
66
+ /**
67
+ * Node type.
68
+ */
69
+ type: string;
70
+ /**
71
+ * Info from the ecosystem.
72
+ */
73
+ data?: Data | undefined;
74
+ /**
75
+ * Position of a node in a source document.
76
+ *
77
+ * Nodes that are generated (not in the original source document) must not
78
+ * have a position.
79
+ */
80
+ position?: Position | undefined;
81
+ }
82
+ //#endregion
83
+ export { Data, Node, Point, Position };
84
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":["line","column","offset","start","Point","end","Node","value","type","data","Data","position","Position","children"],"sources":["../../../../../../../../../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts"],"x_google_ignoreList":[0],"mappings":";;;;;AAqBqB;AAKrB;;;;;;;;AAaU;AAQV;;;;;;UA1BiB,IAAA;;AAmCH;AA6Bd;UA3DiB,KAAA;;;;EAIbA,IAAAA;EAwEAW;;;EAnEAV,MAAAA;;;;EAIAC,MAAAA;AAAAA;;;;;;UAQa,QAAA;;;;EAIbC,KAAAA,EAAO,KAAA;;;;EAKPE,GAAAA,EAAK,KAAK;AAAA;;;;;;;;;;;UA6BG,IAAA;;;;EAIbG,IAAAA;;;;EAKAC,IAAAA,GAAO,IAAA;;;;;;;EAQPE,QAAAA,GAAW,QAAQ;AAAA"}
@@ -1,6 +1,5 @@
1
1
  import { CodeViewItem, CodeViewScrollTarget, DiffLineAnnotation, LineAnnotation } from "../types.js";
2
2
  import { GetHoveredLineResult } from "../managers/InteractionManager.js";
3
- import "../index.js";
4
3
  import { CodeView as CodeView$1, CodeViewLineSelection, CodeViewOptions } from "../components/CodeView.js";
5
4
  import { CSSProperties, ReactNode, Ref } from "react";
6
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.d.ts","names":["CSSProperties","ReactNode","Ref","CodeView","CodeViewClass","CodeViewItem","CodeViewLineSelection","CodeViewOptions","CodeViewScrollTarget","DiffLineAnnotation","GetHoveredLineResult","LineAnnotation","CodeViewGutterUtilityGetter","CodeViewBaseProps","LAnnotation","HTMLDivElement","ControlledCodeViewProps","UncontrolledCodeViewProps","CodeViewProps","CodeViewHandle","CodeViewComponent","React","JSX","Element"],"sources":["../../src/react/CodeView.d.ts"],"sourcesContent":["import { type CSSProperties, type ReactNode, type Ref } from 'react';\nimport { CodeView as CodeViewClass, type CodeViewItem, type CodeViewLineSelection, type CodeViewOptions, type CodeViewScrollTarget, type DiffLineAnnotation, type GetHoveredLineResult, type LineAnnotation } from '../index';\ntype CodeViewGutterUtilityGetter = (() => GetHoveredLineResult<'file'> | undefined) | (() => GetHoveredLineResult<'diff'> | undefined);\ninterface CodeViewBaseProps<LAnnotation> {\n options?: CodeViewOptions<LAnnotation>;\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 renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderPrefix?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderMetadata?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderAnnotation?(annotation: LineAnnotation<LAnnotation> | DiffLineAnnotation<LAnnotation>, item: CodeViewItem<LAnnotation>): ReactNode;\n renderGutterUtility?(getHoveredLine: CodeViewGutterUtilityGetter, item: CodeViewItem<LAnnotation>): ReactNode;\n}\nexport interface ControlledCodeViewProps<LAnnotation> extends CodeViewBaseProps<LAnnotation> {\n items: readonly CodeViewItem<LAnnotation>[];\n initialItems?: never;\n}\nexport interface UncontrolledCodeViewProps<LAnnotation> extends CodeViewBaseProps<LAnnotation> {\n initialItems?: readonly CodeViewItem<LAnnotation>[];\n items?: never;\n}\nexport type CodeViewProps<LAnnotation = undefined> = ControlledCodeViewProps<LAnnotation> | UncontrolledCodeViewProps<LAnnotation>;\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 getInstance(): CodeViewClass<LAnnotation> | undefined;\n}\ntype CodeViewComponent = <LAnnotation = undefined>(props: CodeViewProps<LAnnotation> & {\n ref?: React.Ref<CodeViewHandle<LAnnotation>>;\n}) => React.JSX.Element;\nexport declare const CodeView: CodeViewComponent;\nexport {};\n//# sourceMappingURL=CodeView.d.ts.map"],"mappings":";;;;;;;KAEKY,2BAAAA,UAAqCF,mDAAmDA;UACnFG;YACIN,gBAAgBO;;UAElBd;EAJPY,YAAAA,CAAAA,EAKcV,GALdU,CAKkBG,cALS,CAAA;EACtBF,iBAAAA,CAAAA,EAAiB,OAAAC;EACGA,aAAAA,CAAAA,EAKVR,qBALUQ,GAAAA,IAAAA;EAAhBP,qBAAAA,EAAAA,SAAAA,EAMwBD,qBANxBC,GAAAA,IAAAA,CAAAA,EAAAA,IAAAA;EAEFP,QAAAA,EAAAA,SAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAK6BI,UAL7BJ,CAK2Cc,WAL3Cd,CAAAA,CAAAA,EAAAA,IAAAA;EACWe,kBAAAA,EAAAA,IAAAA,EAKOV,YALPU,CAKoBD,WALpBC,CAAAA,CAAAA,EAKmCd,SALnCc;EAAJb,kBAAAA,EAAAA,IAAAA,EAMWG,YANXH,CAMwBY,WANxBZ,CAAAA,CAAAA,EAMuCD,SANvCC;EAECI,oBAAAA,EAAAA,IAAAA,EAKYD,YALZC,CAKyBQ,WALzBR,CAAAA,CAAAA,EAKwCL,SALxCK;EACkBA,gBAAAA,EAAAA,UAAAA,EAKJK,cALIL,CAKWQ,WALXR,CAAAA,GAK0BG,kBAL1BH,CAK6CQ,WAL7CR,CAAAA,EAAAA,IAAAA,EAKiED,YALjEC,CAK8EQ,WAL9ER,CAA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,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,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,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,cA8XF,QAAA,EAAwC,iBAAiB"}
@@ -1,6 +1,4 @@
1
- 'use client';
2
-
3
-
1
+ "use client";
4
2
  import { areOptionsEqual } from "../utils/areOptionsEqual.js";
5
3
  import { CodeView as CodeView$1 } from "../components/CodeView.js";
6
4
  import { areManagedSnapshotsEqual } from "../utils/areManagedSnapshotsEqual.js";
@@ -11,7 +9,6 @@ import { WorkerPoolContext } from "./WorkerPoolContext.js";
11
9
  import { forwardRef, memo, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
12
10
  import { createPortal, flushSync } from "react-dom";
13
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
-
15
12
  //#region src/react/CodeView.tsx
16
13
  const useIsometricEffect = typeof window === "undefined" ? useEffect : useLayoutEffect;
17
14
  function createDefaultCache(controlled) {
@@ -139,8 +136,8 @@ function CodeViewInner(props, ref) {
139
136
  });
140
137
  useImperativeHandle(ref, () => ({
141
138
  addItems(items) {
142
- const { controlled: controlled$1, instance } = cachedDataRef.current;
143
- assertUncontrolledCodeViewAction(controlled$1, "addItems");
139
+ const { controlled, instance } = cachedDataRef.current;
140
+ assertUncontrolledCodeViewAction(controlled, "addItems");
144
141
  if (instance == null) console.error("CodeView.addItems: no valid instance to append items with", items);
145
142
  else instance.addItems(items);
146
143
  },
@@ -152,8 +149,8 @@ function CodeViewInner(props, ref) {
152
149
  } else return instance.getItem(id);
153
150
  },
154
151
  updateItem(item) {
155
- const { controlled: controlled$1, instance } = cachedDataRef.current;
156
- assertUncontrolledCodeViewAction(controlled$1, "updateItem");
152
+ const { controlled, instance } = cachedDataRef.current;
153
+ assertUncontrolledCodeViewAction(controlled, "updateItem");
157
154
  if (instance == null) {
158
155
  console.error("CodeView.updateItem: no valid instance to update item with", item);
159
156
  return false;
@@ -161,8 +158,8 @@ function CodeViewInner(props, ref) {
161
158
  return instance.updateItem(item);
162
159
  },
163
160
  updateItemId(oldId, newId) {
164
- const { controlled: controlled$1, instance } = cachedDataRef.current;
165
- assertUncontrolledCodeViewAction(controlled$1, "updateItemId");
161
+ const { controlled, instance } = cachedDataRef.current;
162
+ assertUncontrolledCodeViewAction(controlled, "updateItemId");
166
163
  if (instance == null) {
167
164
  console.error("CodeView.updateItemId: no valid instance to update item id with", oldId, newId);
168
165
  return false;
@@ -261,7 +258,7 @@ function createManagedCodeViewOptions({ options, hasCustomHeader, hasGutterRende
261
258
  if (hasGutterRenderer) options.renderGutterUtility = noopRender;
262
259
  return options;
263
260
  }
264
- const SlotPortals = memo(function SlotPortals$1({ managedContentStore, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {
261
+ const SlotPortals = memo(function SlotPortals({ managedContentStore, renderCustomHeader, renderHeaderPrefix, renderHeaderMetadata, renderAnnotation, renderGutterUtility }) {
265
262
  const subscribe = useStableCallback((listener) => managedContentStore.subscribe(listener));
266
263
  const getSnapshot = useStableCallback(() => managedContentStore.getSnapshot());
267
264
  return useSyncExternalStore(subscribe, getSnapshot, getSnapshot)?.map((renderedItem) => {
@@ -303,7 +300,7 @@ function renderCodeViewItemChildren({ renderedItem, renderCustomHeader, renderHe
303
300
  }
304
301
  }
305
302
  function noopRender() {}
306
-
307
303
  //#endregion
308
304
  export { CodeView };
305
+
309
306
  //# sourceMappingURL=CodeView.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeView.js","names":["CodeViewClass","slotCoordinator: CodeViewCoordinator<LAnnotation> | undefined","controlled","snapshot: CodeViewRenderedItem<LAnnotation>[] | undefined","SlotPortals"],"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 {\n areOptionsEqual,\n CodeView as CodeViewClass,\n type CodeViewCoordinator,\n type CodeViewItem,\n type CodeViewLineSelection,\n type CodeViewOptions,\n type CodeViewRenderedItem,\n type CodeViewScrollTarget,\n type DiffLineAnnotation,\n type GetHoveredLineResult,\n type LineAnnotation,\n} from '../index';\nimport { areManagedSnapshotsEqual } from '../utils/areManagedSnapshotsEqual';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { renderFileChildren } from './utils/renderFileChildren';\nimport { useStableCallback } from './utils/useStableCallback';\nimport { WorkerPoolContext } from './WorkerPoolContext';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ntype CodeViewGutterUtilityGetter =\n | (() => GetHoveredLineResult<'file'> | undefined)\n | (() => GetHoveredLineResult<'diff'> | undefined);\n\ninterface CodeViewBaseProps<LAnnotation> {\n options?: CodeViewOptions<LAnnotation>;\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 renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderPrefix?(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 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(): CodeViewRenderedItem<LAnnotation>[] | undefined;\n publish(snapshot: CodeViewRenderedItem<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 initialItems,\n items: controlledItems,\n onScroll,\n onSelectedLinesChange,\n options,\n renderAnnotation,\n renderCustomHeader,\n renderGutterUtility,\n renderHeaderMetadata,\n renderHeaderPrefix,\n selectedLines,\n style,\n } = props;\n const controlled = controlledItems !== undefined;\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 renderHeaderMetadata != null;\n const hasRenderers =\n hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n const emitSelectedLinesChange = useStableCallback(\n (selection: CodeViewLineSelection | null) => {\n onSelectedLinesChange?.(selection);\n }\n );\n const controlledSelection = selectedLines !== undefined;\n\n const managedOptions = useMemo(\n () =>\n createManagedCodeViewOptions({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange:\n onSelectedLinesChange != null ? emitSelectedLinesChange : undefined,\n controlledSelection,\n }),\n [\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange,\n emitSelectedLinesChange,\n controlledSelection,\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: CodeViewRenderedItem<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 if (!hasHeaderRenderers && !hasAnnotationRenderer && !hasGutterRenderer) {\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 ]);\n\n useIsometricEffect(() => {\n return onScroll != null\n ? cachedDataRef.current.instance?.subscribeToScroll(onScroll)\n : undefined;\n });\n\n useIsometricEffect(() => {\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 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 && (\n <SlotPortals<LAnnotation>\n managedContentStore={slotContentStore}\n renderCustomHeader={renderCustomHeader}\n renderHeaderPrefix={renderHeaderPrefix}\n renderHeaderMetadata={renderHeaderMetadata}\n renderAnnotation={renderAnnotation}\n renderGutterUtility={renderGutterUtility}\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: CodeViewRenderedItem<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: CodeViewOptions<LAnnotation> | undefined;\n hasCustomHeader: boolean;\n hasGutterRenderer: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n controlledSelection: boolean;\n}\n\nfunction createManagedCodeViewOptions<LAnnotation>({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange,\n controlledSelection,\n}: CreateManagedCodeViewOptionsProps<LAnnotation>):\n | CodeViewOptions<LAnnotation>\n | undefined {\n if (\n !hasCustomHeader &&\n !hasGutterRenderer &&\n onSelectedLinesChange == null &&\n !controlledSelection\n ) {\n return options;\n }\n options = { ...options, controlledSelection, onSelectedLinesChange };\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 options.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 options.renderGutterUtility = noopRender;\n }\n\n return options;\n}\n\ninterface RenderCodeViewItemChildrenProps<LAnnotation> {\n renderedItem: CodeViewRenderedItem<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\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 renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n}\n\nconst SlotPortals = memo(function SlotPortals<LAnnotation>({\n managedContentStore,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n}: SlotPortalsProps<LAnnotation>) {\n const subscribe = useStableCallback((listener: () => void) =>\n managedContentStore.subscribe(listener)\n );\n const getSnapshot = useStableCallback(() =>\n managedContentStore.getSnapshot()\n );\n const renderedItems = useSyncExternalStore<\n CodeViewRenderedItem<LAnnotation>[] | undefined\n >(subscribe, getSnapshot, getSnapshot);\n return renderedItems?.map((renderedItem) => {\n return createPortal(\n renderCodeViewItemChildren({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n }),\n renderedItem.element,\n renderedItem.id\n );\n });\n}) as SlotPortalsComponent;\n\nfunction renderCodeViewItemChildren<LAnnotation>({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\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 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 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":";;;;;;;;;;;;;;;AAsCA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAqF9C,SAAS,mBACP,YAC4B;AAC5B,QAAO;EACL,UAAU;E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AAe,iBAAiB,YAAY,KAAK,GAClD;GACN,iBAAiB,KAAK;GACtB,qBACE,uBAAuB,QAClB,mBAAmB,oBAAoB,gBAAgB,KAAK,GAC7D;GACN,gBAAgB,SAAS;GAC1B,CAAC;QACG;EACL,MAAM,EAAE,MAAM,aAAa;AAC3B,SAAO,mBAAmB;GACxB,MAAM,KAAK;GACX,oBACE,sBAAsB,aAAa,mBAAmB,KAAK,GAAG;GAChE,oBACE,sBAAsB,aAAa,mBAAmB,KAAK,GAAG;GAChE,sBACE,wBAAwB,aACd,qBAAqB,KAAK,GAChC;GACN,kBACE,oBAAoB,QACf,eAAe,iBAAiB,YAAY,KAAK,GAClD;GACN,iBAAiB,KAAK;GACtB,qBACE,uBAAuB,QAClB,mBAAmB,oBAAoB,gBAAgB,KAAK,GAC7D;GACN,gBAAgB,SAAS;GAC1B,CAAC;;;AAIN,SAAS,aAAa"}
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 {\n areOptionsEqual,\n CodeView as CodeViewClass,\n type CodeViewCoordinator,\n type CodeViewItem,\n type CodeViewLineSelection,\n type CodeViewOptions,\n type CodeViewRenderedItem,\n type CodeViewScrollTarget,\n type DiffLineAnnotation,\n type GetHoveredLineResult,\n type LineAnnotation,\n} from '../index';\nimport { areManagedSnapshotsEqual } from '../utils/areManagedSnapshotsEqual';\nimport { renderDiffChildren } from './utils/renderDiffChildren';\nimport { renderFileChildren } from './utils/renderFileChildren';\nimport { useStableCallback } from './utils/useStableCallback';\nimport { WorkerPoolContext } from './WorkerPoolContext';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ntype CodeViewGutterUtilityGetter =\n | (() => GetHoveredLineResult<'file'> | undefined)\n | (() => GetHoveredLineResult<'diff'> | undefined);\n\ninterface CodeViewBaseProps<LAnnotation> {\n options?: CodeViewOptions<LAnnotation>;\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 renderCustomHeader?(item: CodeViewItem<LAnnotation>): ReactNode;\n renderHeaderPrefix?(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 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(): CodeViewRenderedItem<LAnnotation>[] | undefined;\n publish(snapshot: CodeViewRenderedItem<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 initialItems,\n items: controlledItems,\n onScroll,\n onSelectedLinesChange,\n options,\n renderAnnotation,\n renderCustomHeader,\n renderGutterUtility,\n renderHeaderMetadata,\n renderHeaderPrefix,\n selectedLines,\n style,\n } = props;\n const controlled = controlledItems !== undefined;\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 renderHeaderMetadata != null;\n const hasRenderers =\n hasHeaderRenderers || hasAnnotationRenderer || hasGutterRenderer;\n const emitSelectedLinesChange = useStableCallback(\n (selection: CodeViewLineSelection | null) => {\n onSelectedLinesChange?.(selection);\n }\n );\n const controlledSelection = selectedLines !== undefined;\n\n const managedOptions = useMemo(\n () =>\n createManagedCodeViewOptions({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange:\n onSelectedLinesChange != null ? emitSelectedLinesChange : undefined,\n controlledSelection,\n }),\n [\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange,\n emitSelectedLinesChange,\n controlledSelection,\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: CodeViewRenderedItem<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 if (!hasHeaderRenderers && !hasAnnotationRenderer && !hasGutterRenderer) {\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 ]);\n\n useIsometricEffect(() => {\n return onScroll != null\n ? cachedDataRef.current.instance?.subscribeToScroll(onScroll)\n : undefined;\n });\n\n useIsometricEffect(() => {\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 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 && (\n <SlotPortals<LAnnotation>\n managedContentStore={slotContentStore}\n renderCustomHeader={renderCustomHeader}\n renderHeaderPrefix={renderHeaderPrefix}\n renderHeaderMetadata={renderHeaderMetadata}\n renderAnnotation={renderAnnotation}\n renderGutterUtility={renderGutterUtility}\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: CodeViewRenderedItem<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: CodeViewOptions<LAnnotation> | undefined;\n hasCustomHeader: boolean;\n hasGutterRenderer: boolean;\n onSelectedLinesChange?(selection: CodeViewLineSelection | null): void;\n controlledSelection: boolean;\n}\n\nfunction createManagedCodeViewOptions<LAnnotation>({\n options,\n hasCustomHeader,\n hasGutterRenderer,\n onSelectedLinesChange,\n controlledSelection,\n}: CreateManagedCodeViewOptionsProps<LAnnotation>):\n | CodeViewOptions<LAnnotation>\n | undefined {\n if (\n !hasCustomHeader &&\n !hasGutterRenderer &&\n onSelectedLinesChange == null &&\n !controlledSelection\n ) {\n return options;\n }\n options = { ...options, controlledSelection, onSelectedLinesChange };\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 options.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 options.renderGutterUtility = noopRender;\n }\n\n return options;\n}\n\ninterface RenderCodeViewItemChildrenProps<LAnnotation> {\n renderedItem: CodeViewRenderedItem<LAnnotation>;\n renderCustomHeader: CodeViewBaseProps<LAnnotation>['renderCustomHeader'];\n renderHeaderPrefix: CodeViewBaseProps<LAnnotation>['renderHeaderPrefix'];\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 renderHeaderMetadata: CodeViewBaseProps<LAnnotation>['renderHeaderMetadata'];\n renderAnnotation: CodeViewBaseProps<LAnnotation>['renderAnnotation'];\n renderGutterUtility: CodeViewBaseProps<LAnnotation>['renderGutterUtility'];\n}\n\nconst SlotPortals = memo(function SlotPortals<LAnnotation>({\n managedContentStore,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n}: SlotPortalsProps<LAnnotation>) {\n const subscribe = useStableCallback((listener: () => void) =>\n managedContentStore.subscribe(listener)\n );\n const getSnapshot = useStableCallback(() =>\n managedContentStore.getSnapshot()\n );\n const renderedItems = useSyncExternalStore<\n CodeViewRenderedItem<LAnnotation>[] | undefined\n >(subscribe, getSnapshot, getSnapshot);\n return renderedItems?.map((renderedItem) => {\n return createPortal(\n renderCodeViewItemChildren({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\n renderHeaderMetadata,\n renderAnnotation,\n renderGutterUtility,\n }),\n renderedItem.element,\n renderedItem.id\n );\n });\n}) as SlotPortalsComponent;\n\nfunction renderCodeViewItemChildren<LAnnotation>({\n renderedItem,\n renderCustomHeader,\n renderHeaderPrefix,\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 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 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":";;;;;;;;;;;;AAsCA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAqF9C,SAAS,mBACP,YAC4B;CAC5B,OAAO;EACL,UAAU,KAAA;EACV,OAAO,KAAA;EACP;EACA,gBAAgB,KAAA;EAChB,kBAAkB;EAClB,iBAAiB,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