codex-lens 0.1.18 → 0.1.19
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/dist/public/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Codex Lens</title>
|
|
7
|
-
<script type="module" crossorigin src="./assets/main-
|
|
7
|
+
<script type="module" crossorigin src="./assets/main-CEqXetbU.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="./assets/main-7-y-Utze.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
package/package.json
CHANGED
|
@@ -67,6 +67,14 @@ const removedLineDecoration = Decoration.line({
|
|
|
67
67
|
attributes: { 'data-diff-type': 'removed' }
|
|
68
68
|
});
|
|
69
69
|
|
|
70
|
+
const addedMarkDecoration = Decoration.mark({
|
|
71
|
+
class: 'cm-diff-added-mark'
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const removedMarkDecoration = Decoration.mark({
|
|
75
|
+
class: 'cm-diff-removed-mark'
|
|
76
|
+
});
|
|
77
|
+
|
|
70
78
|
function createDiffHighlightPlugin(diffData) {
|
|
71
79
|
return ViewPlugin.fromClass(class {
|
|
72
80
|
decorations;
|
|
@@ -96,8 +104,14 @@ function createDiffHighlightPlugin(diffData) {
|
|
|
96
104
|
if (diffLine) {
|
|
97
105
|
if (diffLine.added) {
|
|
98
106
|
builder.add(line.from, line.from, addedLineDecoration);
|
|
107
|
+
if (line.length > 0) {
|
|
108
|
+
builder.add(line.from, line.from + 1, addedMarkDecoration);
|
|
109
|
+
}
|
|
99
110
|
} else if (diffLine.removed) {
|
|
100
111
|
builder.add(line.from, line.from, removedLineDecoration);
|
|
112
|
+
if (line.length > 0) {
|
|
113
|
+
builder.add(line.from, line.from + 1, removedMarkDecoration);
|
|
114
|
+
}
|
|
101
115
|
}
|
|
102
116
|
}
|
|
103
117
|
}
|
|
@@ -167,17 +181,17 @@ const darkTheme = EditorView.theme({
|
|
|
167
181
|
},
|
|
168
182
|
'.cm-diff-added-line': {
|
|
169
183
|
backgroundColor: 'rgba(34, 197, 94, 0.15)',
|
|
170
|
-
borderLeft: '3px solid #22c55e',
|
|
171
184
|
},
|
|
172
|
-
'.cm-diff-added-
|
|
185
|
+
'.cm-diff-added-mark': {
|
|
173
186
|
color: '#4ade80',
|
|
187
|
+
fontWeight: 'bold',
|
|
174
188
|
},
|
|
175
189
|
'.cm-diff-removed-line': {
|
|
176
190
|
backgroundColor: 'rgba(239, 68, 68, 0.15)',
|
|
177
|
-
borderLeft: '3px solid #ef4444',
|
|
178
191
|
},
|
|
179
|
-
'.cm-diff-removed-
|
|
192
|
+
'.cm-diff-removed-mark': {
|
|
180
193
|
color: '#f87171',
|
|
194
|
+
fontWeight: 'bold',
|
|
181
195
|
},
|
|
182
196
|
}, { dark: true });
|
|
183
197
|
|
|
@@ -228,7 +242,14 @@ export function CodeViewer({ content, diff, isDiff, filePath }) {
|
|
|
228
242
|
|
|
229
243
|
const code = useMemo(() => {
|
|
230
244
|
if (isDiff && diff) {
|
|
231
|
-
return diff.map(line =>
|
|
245
|
+
return diff.map(line => {
|
|
246
|
+
if (line.added) {
|
|
247
|
+
return '+' + line.content;
|
|
248
|
+
} else if (line.removed) {
|
|
249
|
+
return '-' + line.content;
|
|
250
|
+
}
|
|
251
|
+
return ' ' + line.content;
|
|
252
|
+
}).join('\n');
|
|
232
253
|
}
|
|
233
254
|
return content || '';
|
|
234
255
|
}, [content, diff, isDiff]);
|