@pierre/diffs 1.3.0-beta.3 → 1.3.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/components/CodeView.js +6 -6
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/File.d.ts +3 -2
- package/dist/components/File.d.ts.map +1 -1
- package/dist/components/File.js +35 -21
- package/dist/components/File.js.map +1 -1
- package/dist/components/FileDiff.d.ts +8 -4
- package/dist/components/FileDiff.d.ts.map +1 -1
- package/dist/components/FileDiff.js +66 -56
- package/dist/components/FileDiff.js.map +1 -1
- package/dist/components/FileStream.js +4 -2
- package/dist/components/FileStream.js.map +1 -1
- package/dist/components/UnresolvedFile.js +1 -1
- package/dist/components/VirtualizedFile.d.ts +6 -2
- package/dist/components/VirtualizedFile.d.ts.map +1 -1
- package/dist/components/VirtualizedFile.js +89 -24
- package/dist/components/VirtualizedFile.js.map +1 -1
- package/dist/components/VirtualizedFileDiff.d.ts +8 -2
- package/dist/components/VirtualizedFileDiff.d.ts.map +1 -1
- package/dist/components/VirtualizedFileDiff.js +91 -15
- package/dist/components/VirtualizedFileDiff.js.map +1 -1
- package/dist/editor/command.d.ts +1 -1
- package/dist/editor/command.d.ts.map +1 -1
- package/dist/editor/command.js +3 -3
- package/dist/editor/command.js.map +1 -1
- package/dist/editor/editStack.d.ts +1 -1
- package/dist/editor/editor.d.ts +37 -9
- package/dist/editor/editor.d.ts.map +1 -1
- package/dist/editor/editor.js +558 -449
- package/dist/editor/editor.js.map +1 -1
- package/dist/editor/editor2.js +1 -1
- package/dist/editor/editor2.js.map +1 -1
- package/dist/editor/index.d.ts +2 -2
- package/dist/editor/lineAnnotations.d.ts +2 -1
- package/dist/editor/lineAnnotations.d.ts.map +1 -1
- package/dist/editor/lineAnnotations.js +111 -1
- package/dist/editor/lineAnnotations.js.map +1 -1
- package/dist/editor/marker.d.ts +33 -0
- package/dist/editor/marker.d.ts.map +1 -0
- package/dist/editor/marker.js +185 -0
- package/dist/editor/marker.js.map +1 -0
- package/dist/editor/pieceTable.d.ts +8 -3
- package/dist/editor/pieceTable.d.ts.map +1 -1
- package/dist/editor/pieceTable.js +74 -12
- package/dist/editor/pieceTable.js.map +1 -1
- package/dist/editor/searchPanel.d.ts +12 -3
- package/dist/editor/searchPanel.d.ts.map +1 -1
- package/dist/editor/searchPanel.js +168 -54
- package/dist/editor/searchPanel.js.map +1 -1
- package/dist/editor/selection.d.ts +19 -3
- package/dist/editor/selection.d.ts.map +1 -1
- package/dist/editor/selection.js +188 -37
- package/dist/editor/selection.js.map +1 -1
- package/dist/editor/{quickEdit.d.ts → selectionAction.d.ts} +8 -8
- package/dist/editor/selectionAction.d.ts.map +1 -0
- package/dist/editor/{quickEdit.js → selectionAction.js} +18 -18
- package/dist/editor/selectionAction.js.map +1 -0
- package/dist/editor/sprite.d.ts +4 -3
- package/dist/editor/sprite.d.ts.map +1 -1
- package/dist/editor/sprite.js +19 -5
- package/dist/editor/sprite.js.map +1 -1
- package/dist/editor/textDocument.d.ts +4 -4
- package/dist/editor/textDocument.d.ts.map +1 -1
- package/dist/editor/textDocument.js +7 -7
- package/dist/editor/textDocument.js.map +1 -1
- package/dist/editor/textMeasure.d.ts +1 -0
- package/dist/editor/textMeasure.d.ts.map +1 -1
- package/dist/editor/textMeasure.js +6 -0
- package/dist/editor/textMeasure.js.map +1 -1
- package/dist/editor/tokenzier.js +20 -9
- package/dist/editor/tokenzier.js.map +1 -1
- package/dist/editor/utils.d.ts +3 -1
- package/dist/editor/utils.d.ts.map +1 -1
- package/dist/editor/utils.js +16 -1
- package/dist/editor/utils.js.map +1 -1
- package/dist/highlighter/shared_highlighter.js +3 -29
- package/dist/highlighter/shared_highlighter.js.map +1 -1
- package/dist/highlighter/themes/attachResolvedThemes.js +4 -3
- package/dist/highlighter/themes/attachResolvedThemes.js.map +1 -1
- package/dist/highlighter/themes/cleanUpResolvedThemes.js +3 -2
- package/dist/highlighter/themes/cleanUpResolvedThemes.js.map +1 -1
- package/dist/highlighter/themes/constants.d.ts +1 -7
- package/dist/highlighter/themes/constants.d.ts.map +1 -1
- package/dist/highlighter/themes/constants.js +1 -4
- package/dist/highlighter/themes/constants.js.map +1 -1
- package/dist/highlighter/themes/getResolvedOrResolveTheme.js +2 -2
- package/dist/highlighter/themes/getResolvedOrResolveTheme.js.map +1 -1
- package/dist/highlighter/themes/getResolvedThemes.js +2 -8
- package/dist/highlighter/themes/getResolvedThemes.js.map +1 -1
- package/dist/highlighter/themes/hasResolvedThemes.js +2 -3
- package/dist/highlighter/themes/hasResolvedThemes.js.map +1 -1
- package/dist/highlighter/themes/registerCustomCSSVariableTheme.js +1 -1
- package/dist/highlighter/themes/registerCustomTheme.d.ts +5 -3
- package/dist/highlighter/themes/registerCustomTheme.d.ts.map +1 -1
- package/dist/highlighter/themes/registerCustomTheme.js +15 -5
- package/dist/highlighter/themes/registerCustomTheme.js.map +1 -1
- package/dist/highlighter/themes/resolveTheme.js +6 -27
- package/dist/highlighter/themes/resolveTheme.js.map +1 -1
- package/dist/highlighter/themes/resolveThemes.js +5 -12
- package/dist/highlighter/themes/resolveThemes.js.map +1 -1
- package/dist/highlighter/themes/themeResolution.d.ts +8 -0
- package/dist/highlighter/themes/themeResolution.d.ts.map +1 -0
- package/dist/highlighter/themes/themeResolution.js +22 -0
- package/dist/highlighter/themes/themeResolution.js.map +1 -0
- package/dist/highlighter/themes/themeResolver.d.ts +8 -0
- package/dist/highlighter/themes/themeResolver.d.ts.map +1 -0
- package/dist/highlighter/themes/themeResolver.js +8 -0
- package/dist/highlighter/themes/themeResolver.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/managers/InteractionManager.js +1 -1
- package/dist/managers/InteractionManager.js.map +1 -1
- package/dist/managers/ResizeManager.js +1 -1
- package/dist/managers/ResizeManager.js.map +1 -1
- package/dist/react/CodeView.js +1 -1
- package/dist/react/index.d.ts +2 -2
- package/dist/react/utils/useFileDiffInstance.js +1 -0
- package/dist/react/utils/useFileDiffInstance.js.map +1 -1
- package/dist/renderers/DiffHunksRenderer.d.ts +6 -2
- package/dist/renderers/DiffHunksRenderer.d.ts.map +1 -1
- package/dist/renderers/DiffHunksRenderer.js +183 -12
- package/dist/renderers/DiffHunksRenderer.js.map +1 -1
- package/dist/renderers/FileRenderer.d.ts +2 -2
- package/dist/renderers/FileRenderer.d.ts.map +1 -1
- package/dist/renderers/FileRenderer.js +17 -5
- package/dist/renderers/FileRenderer.js.map +1 -1
- package/dist/ssr/FileDiffReact.js +1 -1
- package/dist/ssr/index.d.ts +2 -2
- package/dist/types.d.ts +25 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/getHighlighterThemeStyles.js +16 -12
- package/dist/utils/getHighlighterThemeStyles.js.map +1 -1
- package/dist/utils/includesFileAnnotations.d.ts +17 -0
- package/dist/utils/includesFileAnnotations.d.ts.map +1 -0
- package/dist/utils/includesFileAnnotations.js +19 -0
- package/dist/utils/includesFileAnnotations.js.map +1 -0
- package/dist/utils/parseMergeConflictDiffFromFile.js.map +1 -1
- package/dist/utils/parsePatchFiles.js +93 -4
- package/dist/utils/parsePatchFiles.js.map +1 -1
- package/dist/utils/renderDiffWithHighlighter.js +4 -2
- package/dist/utils/renderDiffWithHighlighter.js.map +1 -1
- package/dist/utils/renderFileWithHighlighter.js +4 -2
- package/dist/utils/renderFileWithHighlighter.js.map +1 -1
- package/dist/utils/updateDiffHunks.d.ts +13 -0
- package/dist/utils/updateDiffHunks.d.ts.map +1 -0
- package/dist/utils/updateDiffHunks.js +171 -0
- package/dist/utils/updateDiffHunks.js.map +1 -0
- package/dist/utils/virtualDiffLayout.d.ts +2 -1
- package/dist/utils/virtualDiffLayout.d.ts.map +1 -1
- package/dist/utils/virtualDiffLayout.js +9 -1
- package/dist/utils/virtualDiffLayout.js.map +1 -1
- package/dist/worker/{wasm-BaDzIkIn.js → wasm-qE0LgnY3.js} +2 -2
- package/dist/worker/{wasm-BaDzIkIn.js.map → wasm-qE0LgnY3.js.map} +1 -1
- package/dist/worker/worker-portable.js +1016 -275
- package/dist/worker/worker-portable.js.map +1 -1
- package/dist/worker/worker.js +31 -19
- package/dist/worker/worker.js.map +1 -1
- package/package.json +5 -10
- package/dist/editor/quickEdit.d.ts.map +0 -1
- package/dist/editor/quickEdit.js.map +0 -1
package/dist/worker/worker.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createHighlighterCore } from "shiki/core";
|
|
2
2
|
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
|
|
3
3
|
import { createOnigurumaEngine } from "shiki/engine/oniguruma";
|
|
4
|
+
import { createThemeResolver } from "@pierre/theming";
|
|
4
5
|
import { diffChars, diffWordsWithSpace } from "diff";
|
|
5
6
|
import { transformerStyleToClass } from "@shikijs/transformers";
|
|
7
|
+
import { normalizeThemeColors } from "@pierre/theming/color";
|
|
6
8
|
|
|
7
9
|
//#region src/constants.ts
|
|
8
10
|
const DIFFS_DEVELOPMENT_BUILD = (() => {
|
|
@@ -55,9 +57,12 @@ function attachResolvedLanguages(resolvedLanguages, highlighter$1) {
|
|
|
55
57
|
|
|
56
58
|
//#endregion
|
|
57
59
|
//#region src/highlighter/themes/constants.ts
|
|
58
|
-
const ResolvedThemes = /* @__PURE__ */ new Map();
|
|
59
60
|
const AttachedThemes = /* @__PURE__ */ new Set();
|
|
60
61
|
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region src/highlighter/themes/themeResolver.ts
|
|
64
|
+
const themeResolver = createThemeResolver();
|
|
65
|
+
|
|
61
66
|
//#endregion
|
|
62
67
|
//#region src/highlighter/themes/attachResolvedThemes.ts
|
|
63
68
|
function attachResolvedThemes(themes, highlighter$1) {
|
|
@@ -65,12 +70,12 @@ function attachResolvedThemes(themes, highlighter$1) {
|
|
|
65
70
|
for (let themeRef of themes) {
|
|
66
71
|
let resolvedTheme;
|
|
67
72
|
if (typeof themeRef === "string") {
|
|
68
|
-
resolvedTheme =
|
|
73
|
+
resolvedTheme = themeResolver.getResolvedTheme(themeRef);
|
|
69
74
|
if (resolvedTheme == null) throw new Error(`loadResolvedThemes: ${themeRef} is not resolved, you must resolve it before calling loadResolvedThemes`);
|
|
70
75
|
} else {
|
|
71
76
|
resolvedTheme = themeRef;
|
|
72
77
|
themeRef = themeRef.name;
|
|
73
|
-
if (
|
|
78
|
+
if (themeResolver.getResolvedTheme(themeRef) == null) themeResolver.seedResolvedTheme(themeRef, resolvedTheme);
|
|
74
79
|
}
|
|
75
80
|
if (AttachedThemes.has(themeRef)) continue;
|
|
76
81
|
AttachedThemes.add(themeRef);
|
|
@@ -681,24 +686,27 @@ function getHighlighterThemeStyles({ theme = DEFAULT_THEMES, highlighter: highli
|
|
|
681
686
|
let styles = "";
|
|
682
687
|
if (typeof theme === "string") {
|
|
683
688
|
const themeData = highlighter$1.getTheme(theme);
|
|
684
|
-
|
|
685
|
-
styles += `
|
|
686
|
-
styles +=
|
|
687
|
-
styles += `${formatCSSVariablePrefix("global")}
|
|
688
|
-
styles +=
|
|
689
|
+
const normalized = normalizeThemeColors(themeData);
|
|
690
|
+
styles += `color:${normalized.fg};`;
|
|
691
|
+
styles += `background-color:${normalized.bg};`;
|
|
692
|
+
styles += `${formatCSSVariablePrefix("global")}fg:${normalized.fg};`;
|
|
693
|
+
styles += `${formatCSSVariablePrefix("global")}bg:${normalized.bg};`;
|
|
694
|
+
styles += getGitVariables(themeData, prefix);
|
|
689
695
|
} else {
|
|
690
696
|
let themeData = highlighter$1.getTheme(theme.dark);
|
|
691
|
-
|
|
692
|
-
styles += `${formatCSSVariablePrefix("global")}dark
|
|
693
|
-
styles +=
|
|
697
|
+
let normalized = normalizeThemeColors(themeData);
|
|
698
|
+
styles += `${formatCSSVariablePrefix("global")}dark:${normalized.fg};`;
|
|
699
|
+
styles += `${formatCSSVariablePrefix("global")}dark-bg:${normalized.bg};`;
|
|
700
|
+
styles += getGitVariables(themeData, "dark");
|
|
694
701
|
themeData = highlighter$1.getTheme(theme.light);
|
|
695
|
-
|
|
696
|
-
styles += `${formatCSSVariablePrefix("global")}light
|
|
697
|
-
styles +=
|
|
702
|
+
normalized = normalizeThemeColors(themeData);
|
|
703
|
+
styles += `${formatCSSVariablePrefix("global")}light:${normalized.fg};`;
|
|
704
|
+
styles += `${formatCSSVariablePrefix("global")}light-bg:${normalized.bg};`;
|
|
705
|
+
styles += getGitVariables(themeData, "light");
|
|
698
706
|
}
|
|
699
707
|
return styles;
|
|
700
708
|
}
|
|
701
|
-
function
|
|
709
|
+
function getGitVariables(themeData, modePrefix) {
|
|
702
710
|
modePrefix = modePrefix != null ? `${modePrefix}-` : "";
|
|
703
711
|
let styles = "";
|
|
704
712
|
const additionGreen = themeData.colors?.["gitDecoration.addedResourceForeground"] ?? themeData.colors?.["terminal.ansiGreen"];
|
|
@@ -1523,7 +1531,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
1523
1531
|
transformers,
|
|
1524
1532
|
decorations: void 0,
|
|
1525
1533
|
defaultColor: false,
|
|
1526
|
-
cssVariablePrefix: formatCSSVariablePrefix("token")
|
|
1534
|
+
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
1535
|
+
tokenizeTimeLimit: 0
|
|
1527
1536
|
} : {
|
|
1528
1537
|
...options,
|
|
1529
1538
|
lang: "text",
|
|
@@ -1531,7 +1540,8 @@ function renderTwoFiles({ deletionFile, additionFile, deletionInfo, additionInfo
|
|
|
1531
1540
|
transformers,
|
|
1532
1541
|
decorations: void 0,
|
|
1533
1542
|
defaultColor: false,
|
|
1534
|
-
cssVariablePrefix: formatCSSVariablePrefix("token")
|
|
1543
|
+
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
1544
|
+
tokenizeTimeLimit: 0
|
|
1535
1545
|
};
|
|
1536
1546
|
})();
|
|
1537
1547
|
return {
|
|
@@ -1614,7 +1624,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
|
|
|
1614
1624
|
transformers,
|
|
1615
1625
|
defaultColor: false,
|
|
1616
1626
|
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
1617
|
-
tokenizeMaxLineLength
|
|
1627
|
+
tokenizeMaxLineLength,
|
|
1628
|
+
tokenizeTimeLimit: 0
|
|
1618
1629
|
};
|
|
1619
1630
|
return {
|
|
1620
1631
|
lang,
|
|
@@ -1622,7 +1633,8 @@ function renderFileWithHighlighter(file, highlighter$1, { theme = DEFAULT_THEMES
|
|
|
1622
1633
|
transformers,
|
|
1623
1634
|
defaultColor: false,
|
|
1624
1635
|
cssVariablePrefix: formatCSSVariablePrefix("token"),
|
|
1625
|
-
tokenizeMaxLineLength
|
|
1636
|
+
tokenizeMaxLineLength,
|
|
1637
|
+
tokenizeTimeLimit: 0
|
|
1626
1638
|
};
|
|
1627
1639
|
})();
|
|
1628
1640
|
const highlightedLines = getLineNodes(highlighter$1.codeToHast(isWindowedHighlight ? extractWindowedFileContent(lines ?? linesFromFileContents(file.contents), startingLine, totalLines) : file.contents, hastConfig));
|