@pierre/diffs 1.3.0-beta.3 → 1.3.0-beta.4

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 (132) hide show
  1. package/dist/components/CodeView.d.ts.map +1 -1
  2. package/dist/components/File.d.ts +2 -2
  3. package/dist/components/File.d.ts.map +1 -1
  4. package/dist/components/File.js +11 -11
  5. package/dist/components/File.js.map +1 -1
  6. package/dist/components/FileDiff.d.ts +7 -4
  7. package/dist/components/FileDiff.d.ts.map +1 -1
  8. package/dist/components/FileDiff.js +56 -47
  9. package/dist/components/FileDiff.js.map +1 -1
  10. package/dist/components/UnresolvedFile.d.ts.map +1 -1
  11. package/dist/components/UnresolvedFile.js +1 -1
  12. package/dist/components/VirtualizedFile.d.ts +1 -1
  13. package/dist/components/VirtualizedFile.d.ts.map +1 -1
  14. package/dist/components/VirtualizedFile.js +7 -3
  15. package/dist/components/VirtualizedFile.js.map +1 -1
  16. package/dist/components/VirtualizedFileDiff.d.ts +2 -1
  17. package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
  18. package/dist/components/VirtualizedFileDiff.js +14 -0
  19. package/dist/components/VirtualizedFileDiff.js.map +1 -1
  20. package/dist/components/VirtulizerDevelopment.d.ts.map +1 -1
  21. package/dist/editor/editStack.d.ts +1 -1
  22. package/dist/editor/editor.d.ts +10 -8
  23. package/dist/editor/editor.d.ts.map +1 -1
  24. package/dist/editor/editor.js +386 -339
  25. package/dist/editor/editor.js.map +1 -1
  26. package/dist/editor/editor2.js +1 -1
  27. package/dist/editor/editor2.js.map +1 -1
  28. package/dist/editor/lineAnnotations.d.ts +2 -1
  29. package/dist/editor/lineAnnotations.d.ts.map +1 -1
  30. package/dist/editor/lineAnnotations.js +111 -1
  31. package/dist/editor/lineAnnotations.js.map +1 -1
  32. package/dist/editor/marker.d.ts +33 -0
  33. package/dist/editor/marker.d.ts.map +1 -0
  34. package/dist/editor/marker.js +185 -0
  35. package/dist/editor/marker.js.map +1 -0
  36. package/dist/editor/pieceTable.d.ts +2 -2
  37. package/dist/editor/pieceTable.d.ts.map +1 -1
  38. package/dist/editor/pieceTable.js +42 -11
  39. package/dist/editor/pieceTable.js.map +1 -1
  40. package/dist/editor/searchPanel.js +2 -2
  41. package/dist/editor/searchPanel.js.map +1 -1
  42. package/dist/editor/selection.d.ts +19 -3
  43. package/dist/editor/selection.d.ts.map +1 -1
  44. package/dist/editor/selection.js +188 -37
  45. package/dist/editor/selection.js.map +1 -1
  46. package/dist/editor/{quickEdit.d.ts → selectionAction.d.ts} +8 -8
  47. package/dist/editor/selectionAction.d.ts.map +1 -0
  48. package/dist/editor/{quickEdit.js → selectionAction.js} +18 -18
  49. package/dist/editor/selectionAction.js.map +1 -0
  50. package/dist/editor/sprite.d.ts +3 -2
  51. package/dist/editor/sprite.d.ts.map +1 -1
  52. package/dist/editor/sprite.js +9 -2
  53. package/dist/editor/sprite.js.map +1 -1
  54. package/dist/editor/textDocument.d.ts +4 -4
  55. package/dist/editor/textDocument.d.ts.map +1 -1
  56. package/dist/editor/textDocument.js +7 -7
  57. package/dist/editor/textDocument.js.map +1 -1
  58. package/dist/editor/tokenzier.js +11 -3
  59. package/dist/editor/tokenzier.js.map +1 -1
  60. package/dist/editor/utils.d.ts +3 -1
  61. package/dist/editor/utils.d.ts.map +1 -1
  62. package/dist/editor/utils.js +16 -1
  63. package/dist/editor/utils.js.map +1 -1
  64. package/dist/highlighter/shared_highlighter.js +3 -29
  65. package/dist/highlighter/shared_highlighter.js.map +1 -1
  66. package/dist/highlighter/themes/attachResolvedThemes.js +4 -3
  67. package/dist/highlighter/themes/attachResolvedThemes.js.map +1 -1
  68. package/dist/highlighter/themes/cleanUpResolvedThemes.js +3 -2
  69. package/dist/highlighter/themes/cleanUpResolvedThemes.js.map +1 -1
  70. package/dist/highlighter/themes/constants.d.ts +1 -7
  71. package/dist/highlighter/themes/constants.d.ts.map +1 -1
  72. package/dist/highlighter/themes/constants.js +1 -4
  73. package/dist/highlighter/themes/constants.js.map +1 -1
  74. package/dist/highlighter/themes/getResolvedOrResolveTheme.js +2 -2
  75. package/dist/highlighter/themes/getResolvedOrResolveTheme.js.map +1 -1
  76. package/dist/highlighter/themes/getResolvedThemes.js +2 -8
  77. package/dist/highlighter/themes/getResolvedThemes.js.map +1 -1
  78. package/dist/highlighter/themes/hasResolvedThemes.js +2 -3
  79. package/dist/highlighter/themes/hasResolvedThemes.js.map +1 -1
  80. package/dist/highlighter/themes/registerCustomCSSVariableTheme.js +1 -1
  81. package/dist/highlighter/themes/registerCustomTheme.d.ts +5 -3
  82. package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
  83. package/dist/highlighter/themes/registerCustomTheme.js +15 -5
  84. package/dist/highlighter/themes/registerCustomTheme.js.map +1 -1
  85. package/dist/highlighter/themes/resolveTheme.js +6 -27
  86. package/dist/highlighter/themes/resolveTheme.js.map +1 -1
  87. package/dist/highlighter/themes/resolveThemes.js +5 -12
  88. package/dist/highlighter/themes/resolveThemes.js.map +1 -1
  89. package/dist/highlighter/themes/themeResolution.d.ts +8 -0
  90. package/dist/highlighter/themes/themeResolution.d.ts.map +1 -0
  91. package/dist/highlighter/themes/themeResolution.js +22 -0
  92. package/dist/highlighter/themes/themeResolution.js.map +1 -0
  93. package/dist/highlighter/themes/themeResolver.d.ts +8 -0
  94. package/dist/highlighter/themes/themeResolver.d.ts.map +1 -0
  95. package/dist/highlighter/themes/themeResolver.js +8 -0
  96. package/dist/highlighter/themes/themeResolver.js.map +1 -0
  97. package/dist/index.d.ts +4 -4
  98. package/dist/index.js +3 -3
  99. package/dist/react/index.d.ts +2 -2
  100. package/dist/react/jsx.d.ts.map +1 -1
  101. package/dist/react/utils/useFileDiffInstance.js +1 -0
  102. package/dist/react/utils/useFileDiffInstance.js.map +1 -1
  103. package/dist/renderers/DiffHunksRenderer.d.ts +4 -1
  104. package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
  105. package/dist/renderers/DiffHunksRenderer.js +134 -10
  106. package/dist/renderers/DiffHunksRenderer.js.map +1 -1
  107. package/dist/renderers/FileRenderer.d.ts +2 -2
  108. package/dist/renderers/FileRenderer.d.ts.map +1 -1
  109. package/dist/renderers/FileRenderer.js +5 -5
  110. package/dist/renderers/FileRenderer.js.map +1 -1
  111. package/dist/ssr/index.d.ts +2 -2
  112. package/dist/types.d.ts +9 -7
  113. package/dist/types.d.ts.map +1 -1
  114. package/dist/utils/getHighlighterThemeStyles.js +16 -12
  115. package/dist/utils/getHighlighterThemeStyles.js.map +1 -1
  116. package/dist/utils/parsePatchFiles.js +93 -4
  117. package/dist/utils/parsePatchFiles.js.map +1 -1
  118. package/dist/utils/updateDiffHunks.d.ts +13 -0
  119. package/dist/utils/updateDiffHunks.d.ts.map +1 -0
  120. package/dist/utils/updateDiffHunks.js +171 -0
  121. package/dist/utils/updateDiffHunks.js.map +1 -0
  122. package/dist/utils/virtualDiffLayout.d.ts +2 -1
  123. package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
  124. package/dist/utils/virtualDiffLayout.js +9 -1
  125. package/dist/utils/virtualDiffLayout.js.map +1 -1
  126. package/dist/worker/worker-portable.js +727 -22
  127. package/dist/worker/worker-portable.js.map +1 -1
  128. package/dist/worker/worker.js +23 -15
  129. package/dist/worker/worker.js.map +1 -1
  130. package/package.json +2 -1
  131. package/dist/editor/quickEdit.d.ts.map +0 -1
  132. package/dist/editor/quickEdit.js.map +0 -1
@@ -1,33 +1,12 @@
1
- import { isWorkerContext } from "../../utils/isWorkerContext.js";
2
- import { RegisteredCustomThemes, ResolvedThemes, ResolvingThemes } from "./constants.js";
3
- import { bundledThemes, normalizeTheme } from "shiki";
1
+ import { themeResolver } from "./themeResolver.js";
2
+ import { prepareThemeResolution, validateResolvedThemeName } from "./themeResolution.js";
4
3
 
5
4
  //#region src/highlighter/themes/resolveTheme.ts
6
5
  async function resolveTheme(themeName) {
7
- if (isWorkerContext()) throw new Error(`resolveTheme("${themeName}") cannot be called from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
8
- const resolver = ResolvingThemes.get(themeName);
9
- if (resolver != null) return resolver;
10
- try {
11
- const loader = RegisteredCustomThemes.get(themeName) ?? bundledThemes[themeName];
12
- if (loader == null) throw new Error(`resolveTheme: No valid loader for ${themeName}`);
13
- const resolver$1 = loader().then((result) => {
14
- return normalizeAndCacheResolvedTheme(themeName, "default" in result ? result.default : result);
15
- });
16
- ResolvingThemes.set(themeName, resolver$1);
17
- const theme = await resolver$1;
18
- if (theme.name !== themeName) throw new Error(`resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`);
19
- ResolvedThemes.set(theme.name, theme);
20
- return theme;
21
- } finally {
22
- ResolvingThemes.delete(themeName);
23
- }
24
- }
25
- function normalizeAndCacheResolvedTheme(themeName, themeData) {
26
- const resolvedTheme = ResolvedThemes.get(themeName);
27
- if (resolvedTheme != null) return resolvedTheme;
28
- themeData = normalizeTheme(themeData);
29
- ResolvedThemes.set(themeName, themeData);
30
- return themeData;
6
+ prepareThemeResolution(themeName);
7
+ const theme = await themeResolver.resolveTheme(themeName);
8
+ validateResolvedThemeName(themeName, theme);
9
+ return theme;
31
10
  }
32
11
 
33
12
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"resolveTheme.js","names":["resolver"],"sources":["../../../src/highlighter/themes/resolveTheme.ts"],"sourcesContent":["import { bundledThemes, normalizeTheme } from 'shiki';\n\nimport type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { isWorkerContext } from '../../utils/isWorkerContext';\nimport {\n RegisteredCustomThemes,\n ResolvedThemes,\n ResolvingThemes,\n} from './constants';\n\nexport async function resolveTheme(\n themeName: DiffsThemeNames\n): Promise<ThemeRegistrationResolved> {\n if (isWorkerContext()) {\n throw new Error(\n `resolveTheme(\"${themeName}\") cannot be called from a worker context. ` +\n 'Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.'\n );\n }\n\n const resolver = ResolvingThemes.get(themeName);\n if (resolver != null) {\n return resolver;\n }\n\n try {\n const loader =\n RegisteredCustomThemes.get(themeName) ??\n bundledThemes[themeName as keyof typeof bundledThemes];\n\n if (loader == null) {\n throw new Error(`resolveTheme: No valid loader for ${themeName}`);\n }\n\n const resolver = loader().then((result) => {\n return normalizeAndCacheResolvedTheme(\n themeName,\n ('default' in result\n ? result.default\n : result) as ThemeRegistrationResolved\n );\n });\n\n ResolvingThemes.set(themeName, resolver);\n const theme = await resolver;\n if (theme.name !== themeName) {\n throw new Error(\n `resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`\n );\n }\n ResolvedThemes.set(theme.name, theme);\n return theme;\n } finally {\n ResolvingThemes.delete(themeName);\n }\n}\n\nfunction normalizeAndCacheResolvedTheme(\n themeName: string,\n themeData: ThemeRegistrationResolved\n): ThemeRegistrationResolved {\n const resolvedTheme = ResolvedThemes.get(themeName);\n if (resolvedTheme != null) {\n return resolvedTheme;\n }\n themeData = normalizeTheme(themeData);\n ResolvedThemes.set(themeName, themeData);\n return themeData;\n}\n"],"mappings":";;;;;AAUA,eAAsB,aACpB,WACoC;AACpC,KAAI,iBAAiB,CACnB,OAAM,IAAI,MACR,iBAAiB,UAAU,yJAE5B;CAGH,MAAM,WAAW,gBAAgB,IAAI,UAAU;AAC/C,KAAI,YAAY,KACd,QAAO;AAGT,KAAI;EACF,MAAM,SACJ,uBAAuB,IAAI,UAAU,IACrC,cAAc;AAEhB,MAAI,UAAU,KACZ,OAAM,IAAI,MAAM,qCAAqC,YAAY;EAGnE,MAAMA,aAAW,QAAQ,CAAC,MAAM,WAAW;AACzC,UAAO,+BACL,WACC,aAAa,SACV,OAAO,UACP,OACL;IACD;AAEF,kBAAgB,IAAI,WAAWA,WAAS;EACxC,MAAM,QAAQ,MAAMA;AACpB,MAAI,MAAM,SAAS,UACjB,OAAM,IAAI,MACR,6BAA6B,UAAU,8BAA8B,MAAM,OAC5E;AAEH,iBAAe,IAAI,MAAM,MAAM,MAAM;AACrC,SAAO;WACC;AACR,kBAAgB,OAAO,UAAU;;;AAIrC,SAAS,+BACP,WACA,WAC2B;CAC3B,MAAM,gBAAgB,eAAe,IAAI,UAAU;AACnD,KAAI,iBAAiB,KACnB,QAAO;AAET,aAAY,eAAe,UAAU;AACrC,gBAAe,IAAI,WAAW,UAAU;AACxC,QAAO"}
1
+ {"version":3,"file":"resolveTheme.js","names":[],"sources":["../../../src/highlighter/themes/resolveTheme.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport {\n prepareThemeResolution,\n validateResolvedThemeName,\n} from './themeResolution';\nimport { themeResolver } from './themeResolver';\n\n// Resolves a theme by name to a normalized Shiki theme, delegating the cache,\n// concurrent-load dedupe, normalization, and registry to the shared\n// @pierre/theming resolver. The diffs-specific behavior layered on top:\n// 1. Worker-context guard — themes must be pre-resolved on the main thread\n// and handed to the worker, which seeds them via attachResolvedThemes.\n// 2. Bundled-theme fallback a name with no registered loader that matches a\n// Shiki bundled theme is registered on demand (per-name dynamic import),\n// so callers never have to pre-register the full Shiki theme set.\n// 3. theme.name validation the resolved theme's own name must match the\n// requested name, catching mismatched registrations early.\nexport async function resolveTheme(\n themeName: DiffsThemeNames\n): Promise<ThemeRegistrationResolved> {\n prepareThemeResolution(themeName);\n\n const theme = await themeResolver.resolveTheme(themeName);\n\n validateResolvedThemeName(themeName, theme);\n\n return theme;\n}\n"],"mappings":";;;;AAiBA,eAAsB,aACpB,WACoC;AACpC,wBAAuB,UAAU;CAEjC,MAAM,QAAQ,MAAM,cAAc,aAAa,UAAU;AAEzD,2BAA0B,WAAW,MAAM;AAE3C,QAAO"}
@@ -1,18 +1,11 @@
1
- import { resolveTheme } from "./resolveTheme.js";
2
- import { getResolvedOrResolveTheme } from "./getResolvedOrResolveTheme.js";
1
+ import { themeResolver } from "./themeResolver.js";
2
+ import { prepareThemeResolution, validateResolvedThemeName } from "./themeResolution.js";
3
3
 
4
4
  //#region src/highlighter/themes/resolveThemes.ts
5
5
  async function resolveThemes(themes) {
6
- const resolvedThemes = [];
7
- const themesToResolve = [];
8
- for (const themeName of themes) {
9
- const themeData = getResolvedOrResolveTheme(themeName) ?? resolveTheme(themeName);
10
- if ("then" in themeData) themesToResolve.push(themeData);
11
- else resolvedThemes.push(themeData);
12
- }
13
- if (themesToResolve.length > 0) await Promise.all(themesToResolve).then((resolved) => {
14
- for (const theme of resolved) if (theme != null) resolvedThemes.push(theme);
15
- });
6
+ for (const themeName of themes) prepareThemeResolution(themeName);
7
+ const resolvedThemes = await themeResolver.resolveThemes(themes);
8
+ for (let i = 0; i < themes.length; i++) validateResolvedThemeName(themes[i], resolvedThemes[i]);
16
9
  return resolvedThemes;
17
10
  }
18
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"resolveThemes.js","names":["resolvedThemes: ThemeRegistrationResolved[]","themesToResolve: Promise<ThemeRegistrationResolved | undefined>[]"],"sources":["../../../src/highlighter/themes/resolveThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { getResolvedOrResolveTheme } from './getResolvedOrResolveTheme';\nimport { resolveTheme } from './resolveTheme';\n\nexport async function resolveThemes(\n themes: DiffsThemeNames[]\n): Promise<ThemeRegistrationResolved[]> {\n const resolvedThemes: ThemeRegistrationResolved[] = [];\n const themesToResolve: Promise<ThemeRegistrationResolved | undefined>[] = [];\n for (const themeName of themes) {\n const themeData =\n getResolvedOrResolveTheme(themeName) ?? resolveTheme(themeName);\n if ('then' in themeData) {\n themesToResolve.push(themeData);\n } else {\n resolvedThemes.push(themeData);\n }\n }\n\n if (themesToResolve.length > 0) {\n await Promise.all(themesToResolve).then((resolved) => {\n for (const theme of resolved) {\n if (theme != null) {\n resolvedThemes.push(theme);\n }\n }\n });\n }\n\n return resolvedThemes;\n}\n"],"mappings":";;;;AAIA,eAAsB,cACpB,QACsC;CACtC,MAAMA,iBAA8C,EAAE;CACtD,MAAMC,kBAAoE,EAAE;AAC5E,MAAK,MAAM,aAAa,QAAQ;EAC9B,MAAM,YACJ,0BAA0B,UAAU,IAAI,aAAa,UAAU;AACjE,MAAI,UAAU,UACZ,iBAAgB,KAAK,UAAU;MAE/B,gBAAe,KAAK,UAAU;;AAIlC,KAAI,gBAAgB,SAAS,EAC3B,OAAM,QAAQ,IAAI,gBAAgB,CAAC,MAAM,aAAa;AACpD,OAAK,MAAM,SAAS,SAClB,KAAI,SAAS,KACX,gBAAe,KAAK,MAAM;GAG9B;AAGJ,QAAO"}
1
+ {"version":3,"file":"resolveThemes.js","names":[],"sources":["../../../src/highlighter/themes/resolveThemes.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport {\n prepareThemeResolution,\n validateResolvedThemeName,\n} from './themeResolution';\nimport { themeResolver } from './themeResolver';\n\nexport async function resolveThemes(\n themes: DiffsThemeNames[]\n): Promise<ThemeRegistrationResolved[]> {\n for (const themeName of themes) {\n prepareThemeResolution(themeName);\n }\n\n const resolvedThemes = await themeResolver.resolveThemes(themes);\n for (let i = 0; i < themes.length; i++) {\n validateResolvedThemeName(themes[i], resolvedThemes[i]);\n }\n\n return resolvedThemes;\n}\n"],"mappings":";;;;AAOA,eAAsB,cACpB,QACsC;AACtC,MAAK,MAAM,aAAa,OACtB,wBAAuB,UAAU;CAGnC,MAAM,iBAAiB,MAAM,cAAc,cAAc,OAAO;AAChE,MAAK,IAAI,IAAI,GAAG,IAAI,OAAO,QAAQ,IACjC,2BAA0B,OAAO,IAAI,eAAe,GAAG;AAGzD,QAAO"}
@@ -0,0 +1,8 @@
1
+ import { DiffsThemeNames, ThemeRegistrationResolved } from "../../types.js";
2
+
3
+ //#region src/highlighter/themes/themeResolution.d.ts
4
+ declare function prepareThemeResolution(themeName: DiffsThemeNames): void;
5
+ declare function validateResolvedThemeName(themeName: DiffsThemeNames, theme: ThemeRegistrationResolved): void;
6
+ //#endregion
7
+ export { prepareThemeResolution, validateResolvedThemeName };
8
+ //# sourceMappingURL=themeResolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeResolution.d.ts","names":["DiffsThemeNames","ThemeRegistrationResolved","prepareThemeResolution","validateResolvedThemeName"],"sources":["../../../src/highlighter/themes/themeResolution.d.ts"],"sourcesContent":["import type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nexport declare function prepareThemeResolution(themeName: DiffsThemeNames): void;\nexport declare function validateResolvedThemeName(themeName: DiffsThemeNames, theme: ThemeRegistrationResolved): void;\n//# sourceMappingURL=themeResolution.d.ts.map"],"mappings":";;;iBACwBE,sBAAAA,YAAkCF;iBAClCG,yBAAAA,YAAqCH,wBAAwBC"}
@@ -0,0 +1,22 @@
1
+ import { isWorkerContext } from "../../utils/isWorkerContext.js";
2
+ import { themeResolver } from "./themeResolver.js";
3
+ import { shikiThemes } from "@pierre/theming/themes";
4
+
5
+ //#region src/highlighter/themes/themeResolution.ts
6
+ function prepareThemeResolution(themeName) {
7
+ if (isWorkerContext()) throw new Error(`Theme "${themeName}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);
8
+ if (themeResolver.hasRegisteredTheme(themeName)) return;
9
+ const descriptor = shikiThemes.getTheme(themeName);
10
+ if (descriptor != null) {
11
+ themeResolver.registerThemeIfAbsent(descriptor.name, descriptor.load);
12
+ return;
13
+ }
14
+ throw new Error(`No valid theme loader registered for "${themeName}"`);
15
+ }
16
+ function validateResolvedThemeName(themeName, theme) {
17
+ if (theme.name !== themeName) throw new Error(`resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`);
18
+ }
19
+
20
+ //#endregion
21
+ export { prepareThemeResolution, validateResolvedThemeName };
22
+ //# sourceMappingURL=themeResolution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeResolution.js","names":[],"sources":["../../../src/highlighter/themes/themeResolution.ts"],"sourcesContent":["import type { ThemeLoader } from '@pierre/theming';\nimport { shikiThemes } from '@pierre/theming/themes';\n\nimport type { DiffsThemeNames, ThemeRegistrationResolved } from '../../types';\nimport { isWorkerContext } from '../../utils/isWorkerContext';\nimport { themeResolver } from './themeResolver';\n\n// Shared diffs-specific checks for resolving themes. The generic theming\n// resolver owns cache/registry mechanics; diffs still owns worker restrictions,\n// Shiki fallback registration, and validating theme.name against the requested\n// registry key.\nexport function prepareThemeResolution(themeName: DiffsThemeNames): void {\n if (isWorkerContext()) {\n throw new Error(\n `Theme \"${themeName}\" cannot be resolved from a worker context. ` +\n 'Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.'\n );\n }\n\n if (themeResolver.hasRegisteredTheme(themeName)) {\n return;\n }\n const descriptor = shikiThemes.getTheme(themeName);\n if (descriptor != null) {\n themeResolver.registerThemeIfAbsent(\n descriptor.name,\n descriptor.load as ThemeLoader<ThemeRegistrationResolved>\n );\n return;\n }\n throw new Error(`No valid theme loader registered for \"${themeName}\"`);\n}\n\nexport function validateResolvedThemeName(\n themeName: DiffsThemeNames,\n theme: ThemeRegistrationResolved\n): void {\n if (theme.name !== themeName) {\n throw new Error(\n `resolvedTheme: themeName: ${themeName} does not match theme.name: ${theme.name}`\n );\n }\n}\n"],"mappings":";;;;;AAWA,SAAgB,uBAAuB,WAAkC;AACvE,KAAI,iBAAiB,CACnB,OAAM,IAAI,MACR,UAAU,UAAU,0JAErB;AAGH,KAAI,cAAc,mBAAmB,UAAU,CAC7C;CAEF,MAAM,aAAa,YAAY,SAAS,UAAU;AAClD,KAAI,cAAc,MAAM;AACtB,gBAAc,sBACZ,WAAW,MACX,WAAW,KACZ;AACD;;AAEF,OAAM,IAAI,MAAM,yCAAyC,UAAU,GAAG;;AAGxE,SAAgB,0BACd,WACA,OACM;AACN,KAAI,MAAM,SAAS,UACjB,OAAM,IAAI,MACR,6BAA6B,UAAU,8BAA8B,MAAM,OAC5E"}
@@ -0,0 +1,8 @@
1
+ import { ThemeRegistrationResolved } from "../../types.js";
2
+ import * as _pierre_theming0 from "@pierre/theming";
3
+
4
+ //#region src/highlighter/themes/themeResolver.d.ts
5
+ declare const themeResolver: _pierre_theming0.ThemeResolver<ThemeRegistrationResolved>;
6
+ //#endregion
7
+ export { themeResolver };
8
+ //# sourceMappingURL=themeResolver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeResolver.d.ts","names":["ThemeRegistrationResolved","themeResolver","_pierre_theming0","ThemeResolver"],"sources":["../../../src/highlighter/themes/themeResolver.d.ts"],"sourcesContent":["import type { ThemeRegistrationResolved } from '../../types';\nexport declare const themeResolver: import(\"@pierre/theming\").ThemeResolver<ThemeRegistrationResolved>;\n//# sourceMappingURL=themeResolver.d.ts.map"],"mappings":";;;;cACqBC,eAAgFC,gBAAAA,CAAvCC,cAAcH"}
@@ -0,0 +1,8 @@
1
+ import { createThemeResolver } from "@pierre/theming";
2
+
3
+ //#region src/highlighter/themes/themeResolver.ts
4
+ const themeResolver = createThemeResolver();
5
+
6
+ //#endregion
7
+ export { themeResolver };
8
+ //# sourceMappingURL=themeResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themeResolver.js","names":[],"sources":["../../../src/highlighter/themes/themeResolver.ts"],"sourcesContent":["import { createThemeResolver } from '@pierre/theming';\n\nimport type { ThemeRegistrationResolved } from '../../types';\n\n// The single diffs-owned theme resolver. It replaces the former hand-rolled\n// ResolvedThemes (sync cache) + ResolvingThemes (in-flight dedupe) +\n// RegisteredCustomThemes (loader registry) trio with one shared\n// @pierre/theming resolver: the resolver owns the cache, the concurrent-load\n// dedupe, and the name→loader registry internally.\n//\n// This module is intentionally NOT re-exported from the package index — the\n// resolver and the registered-name set are diffs internals. Public callers go\n// through the wrapper functions (resolveTheme, getResolvedThemes, etc.) that\n// add the diffs-specific behavior the generic resolver knows nothing about:\n// the worker-context guard, Shiki normalization, the bundled-theme fallback,\n// and the theme.name validation.\nexport const themeResolver = createThemeResolver<ThemeRegistrationResolved>();\n"],"mappings":";;;AAgBA,MAAa,gBAAgB,qBAAgD"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "./types.js";
1
+ import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "./types.js";
2
2
  import { GetHoveredLineResult, GetLineIndexUtility, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, LogTypes, MergeConflictActionTarget, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, SelectionWriteOptions, pluckInteractionOptions } from "./managers/InteractionManager.js";
3
3
  import { ResizeManager } from "./managers/ResizeManager.js";
4
4
  import { FileRenderResult, FileRenderer, FileRendererOptions } from "./renderers/FileRenderer.js";
@@ -27,12 +27,12 @@ import { disposeHighlighter, getHighlighterIfLoaded, getSharedHighlighter, isHig
27
27
  import { areThemesAttached } from "./highlighter/themes/areThemesAttached.js";
28
28
  import { attachResolvedThemes } from "./highlighter/themes/attachResolvedThemes.js";
29
29
  import { cleanUpResolvedThemes } from "./highlighter/themes/cleanUpResolvedThemes.js";
30
- import { AttachedThemes, RegisteredCustomThemes, ResolvedThemes, ResolvingThemes } from "./highlighter/themes/constants.js";
30
+ import { AttachedThemes } from "./highlighter/themes/constants.js";
31
31
  import { getResolvedOrResolveTheme } from "./highlighter/themes/getResolvedOrResolveTheme.js";
32
32
  import { getResolvedThemes } from "./highlighter/themes/getResolvedThemes.js";
33
33
  import { hasResolvedThemes } from "./highlighter/themes/hasResolvedThemes.js";
34
34
  import { registerCustomCSSVariableTheme } from "./highlighter/themes/registerCustomCSSVariableTheme.js";
35
- import { registerCustomTheme } from "./highlighter/themes/registerCustomTheme.js";
35
+ import { CustomThemeLoader, registerCustomTheme } from "./highlighter/themes/registerCustomTheme.js";
36
36
  import { resolveTheme } from "./highlighter/themes/resolveTheme.js";
37
37
  import { resolveThemes } from "./highlighter/themes/resolveThemes.js";
38
38
  import { ScrollSyncManager } from "./managers/ScrollSyncManager.js";
@@ -105,4 +105,4 @@ import { trimPatchContext } from "./utils/trimPatchContext.js";
105
105
  import { FileDiff, FileDiffHydrationProps, FileDiffOptions, FileDiffRenderProps, FileDiffType } from "./components/FileDiff.js";
106
106
  import { CodeView, CodeViewCoordinator, CodeViewLineSelection, CodeViewOptions, CodeViewRenderedDiffItem, CodeViewRenderedFileItem, CodeViewRenderedItem, CodeViewScrollListener } from "./components/CodeView.js";
107
107
  import { codeToHtml, createCssVariablesTheme as createCSSVariablesTheme } from "shiki";
108
- export { ALTERNATE_FILE_NAMES_GIT, AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, AttachedLanguages, AttachedThemes, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeToTokenTransformStream, CodeToTokenTransformStreamOptions, CodeView, CodeViewCoordinator, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewLineSelection, CodeViewOptions, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewRenderedDiffItem, CodeViewRenderedFileItem, CodeViewRenderedItem, CodeViewScrollBehavior, CodeViewScrollListener, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreateFileHeaderElementProps, CreatePatchOptionsNonabortable, CustomPreProperties, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffHunksRenderer, DiffHunksRendererOptions, DiffHunksRendererOptionsWithDefaults, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, ExpansionDirections, ExtensionFormatMap, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, FileContents, FileDiff, FileDiffHydrationProps, FileDiffMetadata, FileDiffOptions, FileDiffRenderProps, FileDiffType, FileHeaderRenderMode, FileHydrateProps, FileOptions, FileRenderProps, FileRenderResult, FileRenderer, FileRendererOptions, FileStream, FileStreamOptions, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GIT_DIFF_FILE_BREAK_REGEX, GapSpan, GetHoveredLineResult, GetLineIndexUtility, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, HunksRenderResult, INDEX_LINE_METADATA, InjectedRow, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, LanguageRegistration, LineAnnotation, LineDecoration, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, LogTypes, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, MergeConflictActionPayload, MergeConflictActionTarget, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, ParsedLine, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RecallToken, RegisteredCustomLanguages, RegisteredCustomThemes, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, RenderedLineContext, ResizeManager, ResolvedLanguages, ResolvedThemes, ResolvingLanguages, ResolvingThemes, SPLIT_WITH_NEWLINES, SVGSpriteNames, SVGSpriteSheet, ScrollSyncManager, SelectedLineRange, SelectionPoint, SelectionSide, SelectionWriteOptions, SharedRenderState, ShikiStreamTokenizer, ShikiStreamTokenizerEnqueueResult, ShikiStreamTokenizerOptions, ShikiTransformer, SmoothScrollSettings, SplitInjectedRow, SplitInjectedRowPlacement, SplitLineDecorationProps, StickySpecs, SupportedLanguages, THEME_CSS_ATTRIBUTE, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnifiedInjectedRowPlacement, UnifiedLineDecorationProps, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps, VirtualFileMetrics, VirtualWindowSpecs, VirtualizedFile, VirtualizedFileDiff, Virtualizer, VirtualizerConfig, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, isDefaultRenderRange, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
108
+ export { ALTERNATE_FILE_NAMES_GIT, AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, AttachedLanguages, AttachedThemes, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeToTokenTransformStream, CodeToTokenTransformStreamOptions, CodeView, CodeViewCoordinator, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewLineSelection, CodeViewOptions, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewRenderedDiffItem, CodeViewRenderedFileItem, CodeViewRenderedItem, CodeViewScrollBehavior, CodeViewScrollListener, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreateFileHeaderElementProps, CreatePatchOptionsNonabortable, CustomPreProperties, CustomThemeLoader, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffHunksRenderer, DiffHunksRendererOptions, DiffHunksRendererOptionsWithDefaults, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, ExpansionDirections, ExtensionFormatMap, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, FileContents, FileDiff, FileDiffHydrationProps, FileDiffMetadata, FileDiffOptions, FileDiffRenderProps, FileDiffType, FileHeaderRenderMode, FileHydrateProps, FileOptions, FileRenderProps, FileRenderResult, FileRenderer, FileRendererOptions, FileStream, FileStreamOptions, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GIT_DIFF_FILE_BREAK_REGEX, GapSpan, GetHoveredLineResult, GetLineIndexUtility, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, HunksRenderResult, INDEX_LINE_METADATA, InjectedRow, InteractionManager, InteractionManagerBaseOptions, InteractionManagerMode, InteractionManagerOptions, LanguageRegistration, LineAnnotation, LineDecoration, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, LogTypes, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, MergeConflictActionPayload, MergeConflictActionTarget, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, OnDiffLineClickProps, OnDiffLineEnterLeaveProps, OnLineClickProps, OnLineEnterLeaveProps, OnTokenEventProps, ParsedLine, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RecallToken, RegisteredCustomLanguages, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, RenderedLineContext, ResizeManager, ResolvedLanguages, ResolvingLanguages, SPLIT_WITH_NEWLINES, SVGSpriteNames, SVGSpriteSheet, ScrollSyncManager, SelectedLineRange, SelectionPoint, SelectionSide, SelectionWriteOptions, SharedRenderState, ShikiStreamTokenizer, ShikiStreamTokenizerEnqueueResult, ShikiStreamTokenizerOptions, ShikiTransformer, SmoothScrollSettings, SplitInjectedRow, SplitInjectedRowPlacement, SplitLineDecorationProps, StickySpecs, SupportedLanguages, THEME_CSS_ATTRIBUTE, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnifiedInjectedRowPlacement, UnifiedLineDecorationProps, UnresolvedFile, UnresolvedFileHydrationProps, UnresolvedFileOptions, UnresolvedFileRenderProps, VirtualFileMetrics, VirtualWindowSpecs, VirtualizedFile, VirtualizedFileDiff, Virtualizer, VirtualizerConfig, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, isDefaultRenderRange, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
package/dist/index.js CHANGED
@@ -18,12 +18,11 @@ import { cleanUpResolvedLanguages } from "./highlighter/languages/cleanUpResolve
18
18
  import { isWorkerContext } from "./utils/isWorkerContext.js";
19
19
  import { resolveLanguage } from "./highlighter/languages/resolveLanguage.js";
20
20
  import { getResolvedOrResolveLanguage } from "./highlighter/languages/getResolvedOrResolveLanguage.js";
21
- import { AttachedThemes, RegisteredCustomThemes, ResolvedThemes, ResolvingThemes } from "./highlighter/themes/constants.js";
21
+ import { AttachedThemes } from "./highlighter/themes/constants.js";
22
22
  import { attachResolvedThemes } from "./highlighter/themes/attachResolvedThemes.js";
23
23
  import { cleanUpResolvedThemes } from "./highlighter/themes/cleanUpResolvedThemes.js";
24
24
  import { resolveTheme } from "./highlighter/themes/resolveTheme.js";
25
25
  import { getResolvedOrResolveTheme } from "./highlighter/themes/getResolvedOrResolveTheme.js";
26
- import { registerCustomTheme } from "./highlighter/themes/registerCustomTheme.js";
27
26
  import { disposeHighlighter, getHighlighterIfLoaded, getSharedHighlighter, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, preloadHighlighter } from "./highlighter/shared_highlighter.js";
28
27
  import { getThemes } from "./utils/getThemes.js";
29
28
  import { areThemesAttached } from "./highlighter/themes/areThemesAttached.js";
@@ -91,6 +90,7 @@ import { hasResolvedLanguages } from "./highlighter/languages/hasResolvedLanguag
91
90
  import { registerCustomLanguage } from "./highlighter/languages/registerCustomLanguage.js";
92
91
  import { resolveLanguages } from "./highlighter/languages/resolveLanguages.js";
93
92
  import { getResolvedThemes } from "./highlighter/themes/getResolvedThemes.js";
93
+ import { registerCustomTheme } from "./highlighter/themes/registerCustomTheme.js";
94
94
  import { registerCustomCSSVariableTheme } from "./highlighter/themes/registerCustomCSSVariableTheme.js";
95
95
  import { resolveThemes } from "./highlighter/themes/resolveThemes.js";
96
96
  import { areWorkerStatsEqual } from "./utils/areWorkerStatsEqual.js";
@@ -104,4 +104,4 @@ import { setLanguageOverride } from "./utils/setLanguageOverride.js";
104
104
  import { trimPatchContext } from "./utils/trimPatchContext.js";
105
105
  import { codeToHtml, createCssVariablesTheme as createCSSVariablesTheme } from "shiki";
106
106
 
107
- export { ALTERNATE_FILE_NAMES_GIT, AttachedLanguages, AttachedThemes, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, CodeToTokenTransformStream, CodeView, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, DiffHunksRenderer, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, FileDiff, FileRenderer, FileStream, GIT_DIFF_FILE_BREAK_REGEX, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, INDEX_LINE_METADATA, InteractionManager, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, RegisteredCustomLanguages, RegisteredCustomThemes, ResizeManager, ResolvedLanguages, ResolvedThemes, ResolvingLanguages, ResolvingThemes, SPLIT_WITH_NEWLINES, SVGSpriteSheet, ScrollSyncManager, ShikiStreamTokenizer, THEME_CSS_ATTRIBUTE, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnresolvedFile, VirtualizedFile, VirtualizedFileDiff, Virtualizer, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, isDefaultRenderRange, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
107
+ export { ALTERNATE_FILE_NAMES_GIT, AttachedLanguages, AttachedThemes, COMMIT_METADATA_SPLIT, CORE_CSS_ATTRIBUTE, CUSTOM_HEADER_SLOT_ID, CodeToTokenTransformStream, CodeView, DEFAULT_CODE_VIEW_FILE_METRICS, DEFAULT_CODE_VIEW_LAYOUT, DEFAULT_COLLAPSED_CONTEXT_THRESHOLD, DEFAULT_EXPANDED_REGION, DEFAULT_RENDER_RANGE, DEFAULT_SMOOTH_SCROLL_SETTINGS, DEFAULT_THEMES, DEFAULT_TOKENIZE_MAX_LENGTH, DEFAULT_VIRTUAL_FILE_METRICS, DIFFS_DEVELOPMENT_BUILD, DIFFS_SCROLLBAR_GUTTER_MEASURED_PROPERTY, DIFFS_SCROLLBAR_MEASURE_ATTRIBUTE, DIFFS_TAG_NAME, DiffHunksRenderer, EMPTY_RENDER_RANGE, EXTENSION_TO_FILE_FORMAT, FILENAME_HEADER_REGEX, FILENAME_HEADER_REGEX_GIT, FILE_CONTEXT_BLOB, File, FileDiff, FileRenderer, FileStream, GIT_DIFF_FILE_BREAK_REGEX, HEADER_METADATA_SLOT_ID, HEADER_PREFIX_SLOT_ID, HUNK_HEADER, INDEX_LINE_METADATA, InteractionManager, MERGE_CONFLICT_BASE_MARKER_REGEX, MERGE_CONFLICT_END_MARKER_REGEX, MERGE_CONFLICT_SEPARATOR_MARKER_REGEX, MERGE_CONFLICT_START_MARKER_REGEX, RegisteredCustomLanguages, ResizeManager, ResolvedLanguages, ResolvingLanguages, SPLIT_WITH_NEWLINES, SVGSpriteSheet, ScrollSyncManager, ShikiStreamTokenizer, THEME_CSS_ATTRIBUTE, UNIFIED_DIFF_FILE_BREAK_REGEX, UNSAFE_CSS_ATTRIBUTE, UnresolvedFile, VirtualizedFile, VirtualizedFileDiff, Virtualizer, areDiffLineAnnotationsEqual, areDiffRenderOptionsEqual, areDiffTargetsEqual, areFileRenderOptionsEqual, areFilesEqual, areHunkDataEqual, areLanguagesAttached, areLineAnnotationsEqual, areObjectsEqual, areOptionsEqual, arePrePropertiesEqual, areRenderRangesEqual, areSelectionsEqual, areThemesAttached, areThemesEqual, areVirtualWindowSpecsEqual, areWorkerStatsEqual, attachResolvedLanguages, attachResolvedThemes, cleanLastNewline, cleanUpResolvedLanguages, cleanUpResolvedThemes, codeToHtml, createAnnotationElement, createAnnotationWrapperNode, createCSSVariablesTheme, createDiffSpanDecoration, createEmptyRowBuffer, createFileHeaderElement, createGutterGap, createGutterItem, createGutterUtilityContentNode, createGutterUtilityElement, createGutterWrapper, createHastElement, createIconElement, createNoNewlineElement, createPreElement, createPreWrapperProperties, createRowNodes, createSeparator, createSpanFromToken, createStyleElement, createTextNodeElement, createThemeStyleElement, createTransformerWithState, createUnsafeCSSStyleNode, createWindowFromScrollPosition, dequeueRender, detachString, diffAcceptRejectHunk, disposeHighlighter, findCodeElement, formatCSSVariablePrefix, getCustomExtensionsMap, getCustomExtensionsVersion, getFiletypeFromFileName, getHighlighterIfLoaded, getHighlighterOptions, getHighlighterThemeStyles, getHunkSeparatorSlotName, getIconForType, getLineAnnotationName, getLineEndingType, getLineNodes, getOrCreateCodeNode, getResolvedLanguages, getResolvedOrResolveLanguage, getResolvedOrResolveTheme, getResolvedThemes, getSharedHighlighter, getSingularPatch, getThemes, getTotalLineCountFromHunks, getUnresolvedDiffHunksRendererOptions, hasResolvedLanguages, hasResolvedThemes, isDefaultRenderRange, isHighlighterLoaded, isHighlighterLoading, isHighlighterNull, isWorkerContext, parseDiffFromFile, parseLineType, parsePatchFiles, patchScrollbarGutterSize, pluckInteractionOptions, prefersReducedMotion, preloadHighlighter, prerenderHTMLIfNecessary, processFile, processLine, processPatch, pushOrJoinSpan, queueRender, registerCustomCSSVariableTheme, registerCustomLanguage, registerCustomTheme, releaseStringDetachBuffer, renderDiffWithHighlighter, renderFileWithHighlighter, replaceCustomExtensions, resolveConflict, resolveLanguage, resolveLanguages, resolveRegion, resolveTheme, resolveThemes, setCustomExtension, setLanguageOverride, setPreNodeProperties, trimPatchContext, wrapCoreCSS, wrapThemeCSS, wrapUnsafeCSS };
@@ -1,4 +1,4 @@
1
- import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
1
+ import { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeViewDiffItem, CodeViewFileItem, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, ExpansionDirections, ExtensionFormatMap, FileContents, FileDiffMetadata, FileHeaderRenderMode, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, VirtualFileMetrics, VirtualWindowSpecs } from "../types.js";
2
2
  import { WorkerInitializationRenderOptions, WorkerPoolOptions } from "../worker/types.js";
3
3
  import { FileOptions } from "../components/File.js";
4
4
  import { CodeView, CodeViewHandle, CodeViewProps, ControlledCodeViewProps, UncontrolledCodeViewProps } from "./CodeView.js";
@@ -18,4 +18,4 @@ import { templateRender } from "./utils/templateRender.js";
18
18
  import { useFileDiffInstance } from "./utils/useFileDiffInstance.js";
19
19
  import { useFileInstance } from "./utils/useFileInstance.js";
20
20
  import { useStableCallback } from "./utils/useStableCallback.js";
21
- export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeView, CodeViewDiffItem, CodeViewFileItem, CodeViewHandle, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewProps, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, ControlledCodeViewProps, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffBasePropsReact, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditorContext, EditorProvider, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffMetadata, FileDiffProps, FileHeaderRenderMode, FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, UncontrolledCodeViewProps, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, WorkerPoolOptions, noopRender, renderDiffChildren, renderFileChildren, templateRender, useEditor, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
21
+ export { AnnotationLineMap, AnnotationSide, AnnotationSpan, AppliedThemeStyleCache, BaseCodeOptions, BaseDiffOptions, BaseDiffOptionsWithDefaults, BundledLanguage, ChangeContent, ChangeTypes, CodeColumnType, CodeToHastOptions, CodeView, CodeViewDiffItem, CodeViewFileItem, CodeViewHandle, CodeViewItem, CodeViewItemScrollTarget, CodeViewLayout, CodeViewLineScrollTarget, CodeViewPositionScrollTarget, CodeViewProps, CodeViewRangeScrollTarget, CodeViewScrollBehavior, CodeViewScrollTarget, ConflictResolverTypes, ContextContent, ControlledCodeViewProps, CreatePatchOptionsNonabortable, CustomPreProperties, DecorationItem, DiffAcceptRejectHunkConfig, DiffAcceptRejectHunkType, DiffBasePropsReact, DiffIndicators, DiffLineAnnotation, DiffLineEventBaseProps, DiffTokenEventBaseProps, DiffsBaseComponent, DiffsComponentOptions, DiffsEditableComponent, DiffsEditor, DiffsEditorSelection, DiffsHighlighter, DiffsTextDocument, DiffsThemeNames, EditorContext, EditorProvider, ExpansionDirections, ExtensionFormatMap, File, FileContents, FileDiff, FileDiffMetadata, FileDiffProps, FileHeaderRenderMode, FileOptions, FileProps, ForceDiffPlainTextOptions, ForceFilePlainTextOptions, GapSpan, GutterUtilitySlotStyles, HighlightedToken, HighlighterTypes, Hunk, HunkData, HunkExpansionRegion, HunkLineType, HunkSeparators, LanguageRegistration, LineAnnotation, LineDiffTypes, LineEventBaseProps, LineInfo, LineSpans, LineTypes, MergeConflictActionPayload, MergeConflictActionsTypeOption, MergeConflictMarkerRow, MergeConflictMarkerRowType, MergeConflictRegion, MergeConflictResolution, MergeConflictSlotStyles, MultiFileDiff, MultiFileDiffProps, NumericScrollLineAnchor, ObservedAnnotationNodes, ObservedGridNodes, ParsedPatch, PatchDiff, PatchDiffProps, PendingCodeViewLayoutReset, PostRenderPhase, PrePropertiesConfig, ProcessFileConflictData, RenderDiffFilesResult, RenderDiffOptions, RenderDiffResult, RenderFileMetadata, RenderFileOptions, RenderFileResult, RenderHeaderMetadataCallback, RenderHeaderPrefixCallback, RenderMergeConflictActionContext, RenderMergeConflictActions, RenderRange, RenderWindow, RenderedDiffASTCache, RenderedFileASTCache, SelectedLineRange, SelectionPoint, SelectionSide, SharedRenderState, ShikiTransformer, SmoothScrollSettings, StickySpecs, SupportedLanguages, ThemeRegistration, ThemeRegistrationResolved, ThemeTypes, ThemedDiffResult, ThemedFileResult, ThemedToken, ThemesType, TokenEventBase, UncontrolledCodeViewProps, UnresolvedFile, UnresolvedFileProps, UnresolvedFileReactOptions, VirtualFileMetrics, VirtualWindowSpecs, Virtualizer, VirtualizerContext, WorkerInitializationRenderOptions, WorkerPoolContext, WorkerPoolContextProvider, WorkerPoolOptions, noopRender, renderDiffChildren, renderFileChildren, templateRender, useEditor, useFileDiffInstance, useFileInstance, useStableCallback, useVirtualizer, useWorkerPool };
@@ -1 +1 @@
1
- {"version":3,"file":"jsx.d.ts","names":["DIFFS_TAG_NAME","_1","HTMLElement","React","HTMLAttributes","DetailedHTMLProps","sideEffect"],"sources":["../../src/react/jsx.d.ts"],"sourcesContent":["import 'react';\nimport type { DIFFS_TAG_NAME } from '../constants';\n\ndeclare module 'react' {\n namespace JSX {\n interface IntrinsicElements {\n [DIFFS_TAG_NAME]: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement>,\n HTMLElement\n >;\n }\n }\n}\n"],"mappings":";;;;;EACmD,UAAA,GAAA,CAAA;IAAA,UAAA,iBAAA,CAAA;OAK5CA,cAAAA,CAL4C,EAK3BG,KAAAA,CAAME,iBALqB,CAM3CF,KAAAA,CAAMC,cAAeF,CAAAA,WAAAA,CAAAA,EACrBA,WADME,CACNF;IAFgBC;EAAjBH"}
1
+ {"version":3,"file":"jsx.d.ts","names":["DIFFS_TAG_NAME","_0","HTMLElement","React","HTMLAttributes","DetailedHTMLProps","sideEffect"],"sources":["../../src/react/jsx.d.ts"],"sourcesContent":["import 'react';\nimport type { DIFFS_TAG_NAME } from '../constants';\n\ndeclare module 'react' {\n namespace JSX {\n interface IntrinsicElements {\n [DIFFS_TAG_NAME]: React.DetailedHTMLProps<\n React.HTMLAttributes<HTMLElement>,\n HTMLElement\n >;\n }\n }\n}\n"],"mappings":";;;;;EACmD,UAAA,GAAA,CAAA;IAAA,UAAA,iBAAA,CAAA;OAK5CA,cAAAA,CAL4C,EAK3BG,KAAAA,CAAME,iBALqB,CAM3CF,KAAAA,CAAMC,cAAeF,CAAAA,WAAAA,CAAAA,EACrBA,WADME,CACNF;IAFgBC;EAAjBH"}
@@ -97,6 +97,7 @@ function mergeFileDiffOptions({ options, controlledSelection, contentEditable, h
97
97
  enableGutterUtility: false,
98
98
  enableLineSelection: false,
99
99
  expandUnchanged: true,
100
+ diffStyle: "split",
100
101
  lineHoverHighlight: "disabled"
101
102
  };
102
103
  return merged;
@@ -1 +1 @@
1
- {"version":3,"file":"useFileDiffInstance.js","names":["merged: FileDiffOptions<LAnnotation>"],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useEditor } from '../EditorContext';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileDiffInstanceProps<LAnnotation> {\n fileDiff: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n contentEditable: boolean;\n}\n\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\n\nexport function useFileDiffInstance<LAnnotation>({\n fileDiff,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n contentEditable,\n}: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const editor = useEditor<LAnnotation>();\n const instanceRef = useRef<\n FileDiff<LAnnotation> | VirtualizedFileDiff<LAnnotation> | null\n >(null);\n const ref = useStableCallback((fileContainer: HTMLElement | null) => {\n if (fileContainer != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'useFileDiffInstance: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new FileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n fileDiff,\n fileContainer,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error(\n 'useFileDiffInstance: A FileDiff instance should exist when unmounting'\n );\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n const { current: instance } = instanceRef;\n if (instance == null) return;\n const newOptions = mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(instance.options, newOptions);\n instance.setOptions(newOptions);\n void instance.render({\n forceRender,\n fileDiff,\n lineAnnotations,\n });\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines);\n }\n });\n\n useIsometricEffect(() => {\n if (contentEditable && instanceRef.current != null) {\n if (editor === undefined) {\n throw new Error('FileDiff: Editor is not attached');\n }\n return editor.edit(instanceRef.current);\n }\n return undefined;\n }, [contentEditable, editor]);\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'diff'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n\n return { ref, getHoveredLine };\n}\n\ninterface MergeFileDiffOptionsProps<LAnnotation> {\n controlledSelection: boolean;\n contentEditable: boolean;\n hasEditor: boolean;\n hasCustomHeader: boolean;\n hasGutterRenderUtility: boolean;\n options: FileDiffOptions<LAnnotation> | undefined;\n}\n\nfunction mergeFileDiffOptions<LAnnotation>({\n options,\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor,\n hasGutterRenderUtility,\n}: MergeFileDiffOptionsProps<LAnnotation>):\n | FileDiffOptions<LAnnotation>\n | undefined {\n const needsEditorOptions = contentEditable && hasEditor;\n const needsReactOverrides =\n controlledSelection || hasGutterRenderUtility || hasCustomHeader;\n\n if (!needsReactOverrides && !needsEditorOptions) {\n return options;\n }\n\n let merged: FileDiffOptions<LAnnotation> = { ...options };\n\n if (needsReactOverrides) {\n merged = {\n ...merged,\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n };\n }\n\n if (needsEditorOptions) {\n merged = {\n ...merged,\n useTokenTransformer: true,\n enableGutterUtility: false,\n enableLineSelection: false,\n expandUnchanged: true,\n lineHoverHighlight: 'disabled',\n };\n }\n\n return merged;\n}\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,qBACJ,OAAO,WAAW,cAAc,YAAY;AAoB9C,SAAgB,oBAAiC,EAC/C,UACA,SACA,iBACA,eACA,iBACA,SACA,wBACA,iBACA,mBACA,mBACmE;CACnE,MAAM,oBAAoB,gBAAgB;CAC1C,MAAM,sBAAsB,kBAAkB;CAC9C,MAAM,cAAc,WAAW,kBAAkB;CACjD,MAAM,SAAS,WAAwB;CACvC,MAAM,cAAc,OAElB,KAAK;CACP,MAAM,MAAM,mBAAmB,kBAAsC;AACnE,MAAI,iBAAiB,M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,uBAAuB,0BAA0B;AAEnD,KAAI,CAAC,uBAAuB,CAAC,mBAC3B,QAAO;CAGT,IAAIA,SAAuC,EAAE,GAAG,SAAS;AAEzD,KAAI,oBACF,UAAS;EACP,GAAG;EACH;EACA,oBAAoB,kBAChB,aACA,SAAS;EACb,qBAAqB,yBACjB,aACA,SAAS;EACd;AAGH,KAAI,mBACF,UAAS;EACP,GAAG;EACH,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EACrB,iBAAiB;EACjB,oBAAoB;EACrB;AAGH,QAAO"}
1
+ {"version":3,"file":"useFileDiffInstance.js","names":["merged: FileDiffOptions<LAnnotation>"],"sources":["../../../src/react/utils/useFileDiffInstance.ts"],"sourcesContent":["import {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n} from 'react';\n\nimport { FileDiff, type FileDiffOptions } from '../../components/FileDiff';\nimport { VirtualizedFileDiff } from '../../components/VirtualizedFileDiff';\nimport type { GetHoveredLineResult } from '../../managers/InteractionManager';\nimport type {\n DiffLineAnnotation,\n FileDiffMetadata,\n SelectedLineRange,\n VirtualFileMetrics,\n} from '../../types';\nimport { areOptionsEqual } from '../../utils/areOptionsEqual';\nimport { noopRender } from '../constants';\nimport { useEditor } from '../EditorContext';\nimport { useVirtualizer } from '../Virtualizer';\nimport { WorkerPoolContext } from '../WorkerPoolContext';\nimport { useStableCallback } from './useStableCallback';\n\nconst useIsometricEffect =\n typeof window === 'undefined' ? useEffect : useLayoutEffect;\n\ninterface UseFileDiffInstanceProps<LAnnotation> {\n fileDiff: FileDiffMetadata;\n options: FileDiffOptions<LAnnotation> | undefined;\n lineAnnotations: DiffLineAnnotation<LAnnotation>[] | undefined;\n selectedLines: SelectedLineRange | null | undefined;\n prerenderedHTML: string | undefined;\n metrics?: VirtualFileMetrics;\n hasGutterRenderUtility: boolean;\n hasCustomHeader: boolean;\n disableWorkerPool: boolean;\n contentEditable: boolean;\n}\n\ninterface UseFileDiffInstanceReturn {\n ref(node: HTMLElement | null): void;\n getHoveredLine(): GetHoveredLineResult<'diff'> | undefined;\n}\n\nexport function useFileDiffInstance<LAnnotation>({\n fileDiff,\n options,\n lineAnnotations,\n selectedLines,\n prerenderedHTML,\n metrics,\n hasGutterRenderUtility,\n hasCustomHeader,\n disableWorkerPool,\n contentEditable,\n}: UseFileDiffInstanceProps<LAnnotation>): UseFileDiffInstanceReturn {\n const simpleVirtualizer = useVirtualizer();\n const controlledSelection = selectedLines !== undefined;\n const poolManager = useContext(WorkerPoolContext);\n const editor = useEditor<LAnnotation>();\n const instanceRef = useRef<\n FileDiff<LAnnotation> | VirtualizedFileDiff<LAnnotation> | null\n >(null);\n const ref = useStableCallback((fileContainer: HTMLElement | null) => {\n if (fileContainer != null) {\n if (instanceRef.current != null) {\n throw new Error(\n 'useFileDiffInstance: An instance should not already exist when a node is created'\n );\n }\n if (simpleVirtualizer != null) {\n instanceRef.current = new VirtualizedFileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n simpleVirtualizer,\n metrics,\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n } else {\n instanceRef.current = new FileDiff(\n mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n }),\n !disableWorkerPool ? poolManager : undefined,\n true\n );\n }\n void instanceRef.current.hydrate({\n fileDiff,\n fileContainer,\n lineAnnotations,\n prerenderedHTML,\n });\n } else {\n if (instanceRef.current == null) {\n throw new Error(\n 'useFileDiffInstance: A FileDiff instance should exist when unmounting'\n );\n }\n instanceRef.current.cleanUp();\n instanceRef.current = null;\n }\n });\n\n useIsometricEffect(() => {\n const { current: instance } = instanceRef;\n if (instance == null) return;\n const newOptions = mergeFileDiffOptions({\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor: editor !== undefined,\n hasGutterRenderUtility,\n options,\n });\n const forceRender = !areOptionsEqual(instance.options, newOptions);\n instance.setOptions(newOptions);\n void instance.render({\n forceRender,\n fileDiff,\n lineAnnotations,\n });\n if (selectedLines !== undefined) {\n instance.setSelectedLines(selectedLines);\n }\n });\n\n useIsometricEffect(() => {\n if (contentEditable && instanceRef.current != null) {\n if (editor === undefined) {\n throw new Error('FileDiff: Editor is not attached');\n }\n return editor.edit(instanceRef.current);\n }\n return undefined;\n }, [contentEditable, editor]);\n\n const getHoveredLine = useCallback(():\n | GetHoveredLineResult<'diff'>\n | undefined => {\n return instanceRef.current?.getHoveredLine();\n }, []);\n\n return { ref, getHoveredLine };\n}\n\ninterface MergeFileDiffOptionsProps<LAnnotation> {\n controlledSelection: boolean;\n contentEditable: boolean;\n hasEditor: boolean;\n hasCustomHeader: boolean;\n hasGutterRenderUtility: boolean;\n options: FileDiffOptions<LAnnotation> | undefined;\n}\n\nfunction mergeFileDiffOptions<LAnnotation>({\n options,\n controlledSelection,\n contentEditable,\n hasCustomHeader,\n hasEditor,\n hasGutterRenderUtility,\n}: MergeFileDiffOptionsProps<LAnnotation>):\n | FileDiffOptions<LAnnotation>\n | undefined {\n const needsEditorOptions = contentEditable && hasEditor;\n const needsReactOverrides =\n controlledSelection || hasGutterRenderUtility || hasCustomHeader;\n\n if (!needsReactOverrides && !needsEditorOptions) {\n return options;\n }\n\n let merged: FileDiffOptions<LAnnotation> = { ...options };\n\n if (needsReactOverrides) {\n merged = {\n ...merged,\n controlledSelection,\n renderCustomHeader: hasCustomHeader\n ? noopRender\n : options?.renderCustomHeader,\n renderGutterUtility: hasGutterRenderUtility\n ? noopRender\n : options?.renderGutterUtility,\n };\n }\n\n if (needsEditorOptions) {\n merged = {\n ...merged,\n useTokenTransformer: true,\n enableGutterUtility: false,\n enableLineSelection: false,\n expandUnchanged: true,\n diffStyle: 'split',\n lineHoverHighlight: 'disabled',\n };\n }\n\n return merged;\n}\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,qBACJ,OAAO,WAAW,cAA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AI,MAAM,mCAAmC;AAErD,UAAO,OAAO,KAAK,YAAY,QAAQ;;IAGxC,CAAC,iBAAiB,OAAO,CAAC;AAQ7B,QAAO;EAAE;EAAK,gBANS,kBAEN;AACf,UAAO,YAAY,SAAS,gBAAgB;KAC3C,EAAE,CAAC;EAEwB;;AAYhC,SAAS,qBAAkC,EACzC,SACA,qBACA,iBACA,iBACA,WACA,0BAGY;CACZ,MAAM,qBAAqB,mBAAmB;CAC9C,MAAM,sBACJ,uBAAuB,0BAA0B;AAEnD,KAAI,CAAC,uBAAuB,CAAC,mBAC3B,QAAO;CAGT,IAAIA,SAAuC,EAAE,GAAG,SAAS;AAEzD,KAAI,oBACF,UAAS;EACP,GAAG;EACH;EACA,oBAAoB,kBAChB,aACA,SAAS;EACb,qBAAqB,yBACjB,aACA,SAAS;EACd;AAGH,KAAI,mBACF,UAAS;EACP,GAAG;EACH,qBAAqB;EACrB,qBAAqB;EACrB,qBAAqB;EACrB,iBAAiB;EACjB,WAAW;EACX,oBAAoB;EACrB;AAGH,QAAO"}
@@ -1,4 +1,4 @@
1
- import { AnnotationSpan, BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, DiffsHighlighter, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from "../types.js";
1
+ import { AnnotationSpan, BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, DiffsHighlighter, DiffsTextDocument, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HighlightedToken, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from "../types.js";
2
2
  import { WorkerPoolManager } from "../worker/WorkerPoolManager.js";
3
3
  import "../worker/index.js";
4
4
  import { DiffLineMetadata } from "../utils/iterateOverDiff.js";
@@ -85,6 +85,7 @@ declare class DiffHunksRenderer<LAnnotation = undefined> {
85
85
  constructor(options?: DiffHunksRendererOptions, onRenderUpdate?: (() => unknown) | undefined, workerManager?: WorkerPoolManager | undefined);
86
86
  cleanUp(): void;
87
87
  recycle(): void;
88
+ getRenderDiff(): FileDiffMetadata | undefined;
88
89
  clearRenderCache(): void;
89
90
  setOptions(options: DiffHunksRendererOptions): void;
90
91
  mergeOptions(options: Partial<DiffHunksRendererOptions>): void;
@@ -92,6 +93,8 @@ declare class DiffHunksRenderer<LAnnotation = undefined> {
92
93
  getExpandedHunk(hunkIndex: number): HunkExpansionRegion;
93
94
  getExpandedHunksMap(): Map<number, HunkExpansionRegion>;
94
95
  setLineAnnotations(lineAnnotations: DiffLineAnnotation<LAnnotation>[]): void;
96
+ updateRenderCache(dirtyLines: Map<number, Array<HighlightedToken>>, themeType: 'dark' | 'light'): void;
97
+ applyDocumentChange(textDocument: DiffsTextDocument): void;
95
98
  protected getUnifiedLineDecoration({
96
99
  lineType
97
100
  }: UnifiedLineDecorationProps): LineDecoration;
@@ -1 +1 @@
1
- {"version":3,"file":"DiffHunksRenderer.d.ts","names":["ElementContent","Element","HASTElement","Properties","AnnotationSpan","BaseDiffOptions","BaseDiffOptionsWithDefaults","CustomPreProperties","DiffLineAnnotation","DiffsHighlighter","ExpansionDirections","FileDiffMetadata","FileHeaderRenderMode","HunkData","HunkExpansionRegion","LineTypes","RenderDiffOptions","RenderRange","ThemedDiffResult","DiffLineMetadata","WorkerPoolManager","DiffHunksRendererOptions","DiffHunksRendererOptionsWithDefaults","Omit","UnifiedLineDecorationProps","SplitLineDecorationProps","LineDecoration","RenderedLineContext","InjectedRow","SplitInjectedRow","UnifiedInjectedRowPlacement","SplitInjectedRowPlacement","HunksRenderResult","DiffHunksRenderer","LAnnotation","Partial","Map","lineType","side","type","Promise"],"sources":["../../src/renderers/DiffHunksRenderer.d.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement, Properties } from 'hast';\nimport type { AnnotationSpan, BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, DiffsHighlighter, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from '../types';\nimport type { DiffLineMetadata } from '../utils/iterateOverDiff';\nimport type { WorkerPoolManager } from '../worker';\nexport interface DiffHunksRendererOptions extends BaseDiffOptions {\n headerRenderMode?: FileHeaderRenderMode;\n}\nexport interface DiffHunksRendererOptionsWithDefaults extends Omit<BaseDiffOptionsWithDefaults, 'themeType'> {\n headerRenderMode: FileHeaderRenderMode;\n}\nexport interface UnifiedLineDecorationProps {\n type: 'context' | 'context-expanded' | 'change';\n lineType: LineTypes;\n additionLineIndex: number | undefined;\n deletionLineIndex: number | undefined;\n}\nexport interface SplitLineDecorationProps {\n side: 'deletions' | 'additions';\n type: 'context' | 'context-expanded' | 'change';\n lineIndex: number | undefined;\n}\nexport interface LineDecoration {\n gutterLineType: LineTypes;\n gutterProperties?: Properties;\n contentProperties?: Properties;\n}\nexport interface RenderedLineContext {\n type: 'context' | 'context-expanded' | 'change';\n hunkIndex: number;\n lineIndex: number;\n unifiedLineIndex: number;\n splitLineIndex: number;\n deletionLine?: DiffLineMetadata;\n additionLine?: DiffLineMetadata;\n}\nexport interface InjectedRow {\n content: HASTElement;\n gutter: HASTElement;\n}\nexport interface SplitInjectedRow {\n deletion: InjectedRow | undefined;\n addition: InjectedRow | undefined;\n}\nexport interface UnifiedInjectedRowPlacement {\n before?: InjectedRow[];\n after?: InjectedRow[];\n}\nexport interface SplitInjectedRowPlacement {\n before?: SplitInjectedRow[];\n after?: SplitInjectedRow[];\n}\nexport interface HunksRenderResult {\n unifiedGutterAST: ElementContent[] | undefined;\n unifiedContentAST: ElementContent[] | undefined;\n deletionsGutterAST: ElementContent[] | undefined;\n deletionsContentAST: ElementContent[] | undefined;\n additionsGutterAST: ElementContent[] | undefined;\n additionsContentAST: ElementContent[] | undefined;\n hunkData: HunkData[];\n css: string;\n preNode: HASTElement;\n headerElement: HASTElement | undefined;\n totalLines: number;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n rowCount: number;\n bufferBefore: number;\n bufferAfter: number;\n}\nexport declare class DiffHunksRenderer<LAnnotation = undefined> {\n options: DiffHunksRendererOptions;\n private onRenderUpdate?;\n private workerManager?;\n readonly __id: string;\n private highlighter;\n private diff;\n private expandedHunks;\n private deletionAnnotations;\n private additionAnnotations;\n private computedLang;\n private renderCache;\n constructor(options?: DiffHunksRendererOptions, onRenderUpdate?: (() => unknown) | undefined, workerManager?: WorkerPoolManager | undefined);\n cleanUp(): void;\n recycle(): void;\n clearRenderCache(): void;\n setOptions(options: DiffHunksRendererOptions): void;\n mergeOptions(options: Partial<DiffHunksRendererOptions>): void;\n expandHunk(index: number, direction: ExpansionDirections, expansionLineCount?: number): void;\n getExpandedHunk(hunkIndex: number): HunkExpansionRegion;\n getExpandedHunksMap(): Map<number, HunkExpansionRegion>;\n setLineAnnotations(lineAnnotations: DiffLineAnnotation<LAnnotation>[]): void;\n protected getUnifiedLineDecoration({ lineType }: UnifiedLineDecorationProps): LineDecoration;\n protected getSplitLineDecoration({ side, type }: SplitLineDecorationProps): LineDecoration;\n protected createAnnotationElement(span: AnnotationSpan): HASTElement;\n protected getUnifiedInjectedRowsForLine?: (ctx: RenderedLineContext) => UnifiedInjectedRowPlacement | undefined;\n protected getSplitInjectedRowsForLine?: (ctx: RenderedLineContext) => SplitInjectedRowPlacement | undefined;\n protected getOptionsWithDefaults(): DiffHunksRendererOptionsWithDefaults;\n initializeHighlighter(): Promise<DiffsHighlighter>;\n hydrate(diff: FileDiffMetadata | undefined): void;\n private getRenderOptions;\n renderDiff(diff?: FileDiffMetadata | undefined, renderRange?: RenderRange): HunksRenderResult | undefined;\n asyncRender(diff: FileDiffMetadata, renderRange?: RenderRange): Promise<HunksRenderResult>;\n protected createPreElement(split: boolean, totalLines: number, customProperties?: CustomPreProperties): HASTElement;\n private asyncHighlight;\n private renderDiffWithHighlighter;\n onHighlightSuccess(diff: FileDiffMetadata, result: ThemedDiffResult, options: RenderDiffOptions, highlighted?: boolean): void;\n private getMatchingWorkerResultCache;\n private hasHighlightedRenderCache;\n onHighlightError(error: unknown): void;\n private getTokenizeMaxLength;\n private processDiffResult;\n renderCodeAST(type: 'unified' | 'deletions' | 'additions', result: HunksRenderResult): ElementContent[] | undefined;\n renderFullAST(result: HunksRenderResult, children?: ElementContent[]): HASTElement;\n renderFullHTML(result: HunksRenderResult, tempChildren?: ElementContent[]): string;\n renderPartialHTML(children: ElementContent[], columnType?: 'unified' | 'deletions' | 'additions'): string;\n private getAnnotations;\n private renderHeader;\n}\n//# sourceMappingURL=DiffHunksRenderer.d.ts.map"],"mappings":";;;;;;;UAIiBqB,wBAAAA,SAAiChB;qBAC3BO;;AADNS,UAGAC,oCAAAA,SAA6CC,IAHZlB,CAGiBC,2BAHF,EAAA,WAAA,CAAA,CAAA;EAGhDgB,gBAAAA,EACKV,oBADLU;;AACKV,UAELY,0BAAAA,CAFKZ;EADwCW,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EAAI,QAAA,EAKpDR,SALoD;EAGjDS,iBAAAA,EAAAA,MAAAA,GAAAA,SAA0B;EAM1BC,iBAAAA,EAAAA,MAAAA,GAAwB,SAAA;AAKzC;AACoBV,UANHU,wBAAAA,CAMGV;EACGZ,IAAAA,EAAAA,WAAAA,GAAAA,WAAAA;EACCA,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EAAU,SAAA,EAAA,MAAA,GAAA,SAAA;AAElC;AASiByB,UAdAF,cAAAA,CAeJxB;EAGI2B,cAAAA,EAjBGd,SAiBa;EAIhBe,gBAAAA,CAAAA,EApBM3B,UAoBN2B;EAIAC,iBAAAA,CAAAA,EAvBO5B,UAuBkB;AAI1C;AACsBH,UA1BL2B,mBAAAA,CA0BK3B;EACCA,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EACCA,SA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BE;;oBAEIA,4CAA4CM,cAAce;oBAC1DrB,gCAAgCM,cAAcuB,QAAQR;oFACUzB,sBAAsBL;;;2BAG/ES,0BAA0BO,2BAA2BF;;;;;;qEAMXgB,oBAAoBhC;wBACjEgC,8BAA8BhC,mBAAmBE;yBAChD8B,kCAAkChC;8BAC7BA"}
1
+ {"version":3,"file":"DiffHunksRenderer.d.ts","names":["ElementContent","Element","HASTElement","Properties","AnnotationSpan","BaseDiffOptions","BaseDiffOptionsWithDefaults","CustomPreProperties","DiffLineAnnotation","DiffsHighlighter","DiffsTextDocument","ExpansionDirections","FileDiffMetadata","FileHeaderRenderMode","HighlightedToken","HunkData","HunkExpansionRegion","LineTypes","RenderDiffOptions","RenderRange","ThemedDiffResult","DiffLineMetadata","WorkerPoolManager","DiffHunksRendererOptions","DiffHunksRendererOptionsWithDefaults","Omit","UnifiedLineDecorationProps","SplitLineDecorationProps","LineDecoration","RenderedLineContext","InjectedRow","SplitInjectedRow","UnifiedInjectedRowPlacement","SplitInjectedRowPlacement","HunksRenderResult","DiffHunksRenderer","LAnnotation","Partial","Map","Array","lineType","side","type","Promise"],"sources":["../../src/renderers/DiffHunksRenderer.d.ts"],"sourcesContent":["import type { ElementContent, Element as HASTElement, Properties } from 'hast';\nimport type { AnnotationSpan, BaseDiffOptions, BaseDiffOptionsWithDefaults, CustomPreProperties, DiffLineAnnotation, DiffsHighlighter, DiffsTextDocument, ExpansionDirections, FileDiffMetadata, FileHeaderRenderMode, HighlightedToken, HunkData, HunkExpansionRegion, LineTypes, RenderDiffOptions, RenderRange, ThemedDiffResult } from '../types';\nimport type { DiffLineMetadata } from '../utils/iterateOverDiff';\nimport type { WorkerPoolManager } from '../worker';\nexport interface DiffHunksRendererOptions extends BaseDiffOptions {\n headerRenderMode?: FileHeaderRenderMode;\n}\nexport interface DiffHunksRendererOptionsWithDefaults extends Omit<BaseDiffOptionsWithDefaults, 'themeType'> {\n headerRenderMode: FileHeaderRenderMode;\n}\nexport interface UnifiedLineDecorationProps {\n type: 'context' | 'context-expanded' | 'change';\n lineType: LineTypes;\n additionLineIndex: number | undefined;\n deletionLineIndex: number | undefined;\n}\nexport interface SplitLineDecorationProps {\n side: 'deletions' | 'additions';\n type: 'context' | 'context-expanded' | 'change';\n lineIndex: number | undefined;\n}\nexport interface LineDecoration {\n gutterLineType: LineTypes;\n gutterProperties?: Properties;\n contentProperties?: Properties;\n}\nexport interface RenderedLineContext {\n type: 'context' | 'context-expanded' | 'change';\n hunkIndex: number;\n lineIndex: number;\n unifiedLineIndex: number;\n splitLineIndex: number;\n deletionLine?: DiffLineMetadata;\n additionLine?: DiffLineMetadata;\n}\nexport interface InjectedRow {\n content: HASTElement;\n gutter: HASTElement;\n}\nexport interface SplitInjectedRow {\n deletion: InjectedRow | undefined;\n addition: InjectedRow | undefined;\n}\nexport interface UnifiedInjectedRowPlacement {\n before?: InjectedRow[];\n after?: InjectedRow[];\n}\nexport interface SplitInjectedRowPlacement {\n before?: SplitInjectedRow[];\n after?: SplitInjectedRow[];\n}\nexport interface HunksRenderResult {\n unifiedGutterAST: ElementContent[] | undefined;\n unifiedContentAST: ElementContent[] | undefined;\n deletionsGutterAST: ElementContent[] | undefined;\n deletionsContentAST: ElementContent[] | undefined;\n additionsGutterAST: ElementContent[] | undefined;\n additionsContentAST: ElementContent[] | undefined;\n hunkData: HunkData[];\n css: string;\n preNode: HASTElement;\n headerElement: HASTElement | undefined;\n totalLines: number;\n themeStyles: string;\n baseThemeType: 'light' | 'dark' | undefined;\n rowCount: number;\n bufferBefore: number;\n bufferAfter: number;\n}\nexport declare class DiffHunksRenderer<LAnnotation = undefined> {\n options: DiffHunksRendererOptions;\n private onRenderUpdate?;\n private workerManager?;\n readonly __id: string;\n private highlighter;\n private diff;\n private expandedHunks;\n private deletionAnnotations;\n private additionAnnotations;\n private computedLang;\n private renderCache;\n constructor(options?: DiffHunksRendererOptions, onRenderUpdate?: (() => unknown) | undefined, workerManager?: WorkerPoolManager | undefined);\n cleanUp(): void;\n recycle(): void;\n getRenderDiff(): FileDiffMetadata | undefined;\n clearRenderCache(): void;\n setOptions(options: DiffHunksRendererOptions): void;\n mergeOptions(options: Partial<DiffHunksRendererOptions>): void;\n expandHunk(index: number, direction: ExpansionDirections, expansionLineCount?: number): void;\n getExpandedHunk(hunkIndex: number): HunkExpansionRegion;\n getExpandedHunksMap(): Map<number, HunkExpansionRegion>;\n setLineAnnotations(lineAnnotations: DiffLineAnnotation<LAnnotation>[]): void;\n updateRenderCache(dirtyLines: Map<number, Array<HighlightedToken>>, themeType: 'dark' | 'light'): void;\n applyDocumentChange(textDocument: DiffsTextDocument): void;\n protected getUnifiedLineDecoration({ lineType }: UnifiedLineDecorationProps): LineDecoration;\n protected getSplitLineDecoration({ side, type }: SplitLineDecorationProps): LineDecoration;\n protected createAnnotationElement(span: AnnotationSpan): HASTElement;\n protected getUnifiedInjectedRowsForLine?: (ctx: RenderedLineContext) => UnifiedInjectedRowPlacement | undefined;\n protected getSplitInjectedRowsForLine?: (ctx: RenderedLineContext) => SplitInjectedRowPlacement | undefined;\n protected getOptionsWithDefaults(): DiffHunksRendererOptionsWithDefaults;\n initializeHighlighter(): Promise<DiffsHighlighter>;\n hydrate(diff: FileDiffMetadata | undefined): void;\n private getRenderOptions;\n renderDiff(diff?: FileDiffMetadata | undefined, renderRange?: RenderRange): HunksRenderResult | undefined;\n asyncRender(diff: FileDiffMetadata, renderRange?: RenderRange): Promise<HunksRenderResult>;\n protected createPreElement(split: boolean, totalLines: number, customProperties?: CustomPreProperties): HASTElement;\n private asyncHighlight;\n private renderDiffWithHighlighter;\n onHighlightSuccess(diff: FileDiffMetadata, result: ThemedDiffResult, options: RenderDiffOptions, highlighted?: boolean): void;\n private getMatchingWorkerResultCache;\n private hasHighlightedRenderCache;\n onHighlightError(error: unknown): void;\n private getTokenizeMaxLength;\n private processDiffResult;\n renderCodeAST(type: 'unified' | 'deletions' | 'additions', result: HunksRenderResult): ElementContent[] | undefined;\n renderFullAST(result: HunksRenderResult, children?: ElementContent[]): HASTElement;\n renderFullHTML(result: HunksRenderResult, tempChildren?: ElementContent[]): string;\n renderPartialHTML(children: ElementContent[], columnType?: 'unified' | 'deletions' | 'additions'): string;\n private getAnnotations;\n private renderHeader;\n}\n//# sourceMappingURL=DiffHunksRenderer.d.ts.map"],"mappings":";;;;;;;UAIiBuB,wBAAAA,SAAiClB;qBAC3BQ;;AADNU,UAGAC,oCAAAA,SAA6CC,IAHZpB,CAGiBC,2BAHF,EAAA,WAAA,CAAA,CAAA;EAGhDkB,gBAAAA,EACKX,oBADLW;;AACKX,UAELa,0BAAAA,CAFKb;EADwCY,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EAAI,QAAA,EAKpDR,SALoD;EAGjDS,iBAAAA,EAAAA,MAAAA,GAAAA,SAA0B;EAM1BC,iBAAAA,EAAAA,MAAAA,GAAwB,SAAA;AAKzC;AACoBV,UANHU,wBAAAA,CAMGV;EACGd,IAAAA,EAAAA,WAAAA,GAAAA,WAAAA;EACCA,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EAAU,SAAA,EAAA,MAAA,GAAA,SAAA;AAElC;AASiB2B,UAdAF,cAAAA,CAeJ1B;EAGI6B,cAAAA,EAjBGd,SAiBa;EAIhBe,gBAAAA,CAAAA,EApBM7B,UAoBN6B;EAIAC,iBAAAA,CAAAA,EAvBO9B,UAuBkB;AAI1C;AACsBH,UA1BL6B,mBAAAA,CA0BK7B;EACCA,IAAAA,EAAAA,SAAAA,GAAAA,kBAAAA,GAAAA,QAAAA;EACCA,SAAAA,EAAAA,MAAAA;EACCA,SAAAA,EAAAA,MAAAA;EACDA,gBAAAA,EAAAA,MAAAA;EACCA,cAAAA,EAAAA,MAAAA;EACXe,YAAAA,CAAAA,EA1BKM,gBA0BLN;EAEDb,YAAAA,CAAAA,EA3BMmB,gBA2BNnB;;AACiB,UA1Bb4B,WAAAA,CA0Ba;EAQTK,OAAAA,EAjCRjC,OA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