@git-diff-view/react 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.development.js +457 -266
- package/dist/cjs/index.development.js.map +1 -1
- package/dist/cjs/index.production.js +449 -259
- package/dist/cjs/index.production.js.map +1 -1
- package/dist/css/diff-view.css +1 -1
- package/dist/esm/index.mjs +459 -269
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/components/DiffContent.d.ts.map +1 -1
- package/dist/types/components/DiffSplitExtendLineNormal.d.ts.map +1 -1
- package/dist/types/components/DiffSplitExtendLineWrap.d.ts.map +1 -1
- package/dist/types/components/DiffSplitHunkLineNormal.d.ts.map +1 -1
- package/dist/types/components/DiffSplitHunkLineWrap.d.ts.map +1 -1
- package/dist/types/components/DiffSplitView.d.ts.map +1 -1
- package/dist/types/components/DiffSplitViewNormal.d.ts.map +1 -1
- package/dist/types/components/DiffSplitViewWrap.d.ts.map +1 -1
- package/dist/types/components/DiffSplitWidgetLineWrap.d.ts.map +1 -1
- package/dist/types/components/DiffUnifiedExtendLine.d.ts.map +1 -1
- package/dist/types/components/DiffView.d.ts +0 -1
- package/dist/types/components/DiffView.d.ts.map +1 -1
- package/dist/types/components/DiffViewContext.d.ts +10 -4
- package/dist/types/components/DiffViewContext.d.ts.map +1 -1
- package/dist/types/components/tools.d.ts +1 -0
- package/dist/types/components/tools.d.ts.map +1 -1
- package/dist/types/hooks/useSyncHeight.d.ts +1 -1
- package/dist/types/hooks/useSyncHeight.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +58 -59
|
@@ -107,34 +107,83 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
107
107
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
135
|
-
|
|
110
|
+
const processAST = (ast) => {
|
|
111
|
+
let lineNumber = 1;
|
|
112
|
+
const syntaxObj = {};
|
|
113
|
+
const loopAST = (nodes, wrapper) => {
|
|
114
|
+
nodes.forEach((node) => {
|
|
115
|
+
if (node.type === "text") {
|
|
116
|
+
if (node.value.indexOf("\n") === -1) {
|
|
117
|
+
const valueLength = node.value.length;
|
|
118
|
+
if (!syntaxObj[lineNumber]) {
|
|
119
|
+
node.startIndex = 0;
|
|
120
|
+
node.endIndex = valueLength - 1;
|
|
121
|
+
const item = {
|
|
122
|
+
value: node.value,
|
|
123
|
+
lineNumber,
|
|
124
|
+
valueLength,
|
|
125
|
+
nodeList: [{ node, wrapper }],
|
|
126
|
+
};
|
|
127
|
+
syntaxObj[lineNumber] = item;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
node.startIndex = syntaxObj[lineNumber].valueLength;
|
|
131
|
+
node.endIndex = node.startIndex + valueLength - 1;
|
|
132
|
+
syntaxObj[lineNumber].value += node.value;
|
|
133
|
+
syntaxObj[lineNumber].valueLength += valueLength;
|
|
134
|
+
syntaxObj[lineNumber].nodeList.push({ node, wrapper });
|
|
135
|
+
}
|
|
136
|
+
node.lineNumber = lineNumber;
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const lines = node.value.split("\n");
|
|
140
|
+
node.children = node.children || [];
|
|
141
|
+
for (let i = 0; i < lines.length; i++) {
|
|
142
|
+
const _value = i === lines.length - 1 ? lines[i] : lines[i] + "\n";
|
|
143
|
+
const _lineNumber = i === 0 ? lineNumber : ++lineNumber;
|
|
144
|
+
const _valueLength = _value.length;
|
|
145
|
+
const _node = {
|
|
146
|
+
type: "text",
|
|
147
|
+
value: _value,
|
|
148
|
+
startIndex: Infinity,
|
|
149
|
+
endIndex: Infinity,
|
|
150
|
+
lineNumber: _lineNumber,
|
|
151
|
+
};
|
|
152
|
+
if (!syntaxObj[_lineNumber]) {
|
|
153
|
+
_node.startIndex = 0;
|
|
154
|
+
_node.endIndex = _valueLength - 1;
|
|
155
|
+
const item = {
|
|
156
|
+
value: _value,
|
|
157
|
+
lineNumber: _lineNumber,
|
|
158
|
+
valueLength: _valueLength,
|
|
159
|
+
nodeList: [{ node: _node, wrapper }],
|
|
160
|
+
};
|
|
161
|
+
syntaxObj[_lineNumber] = item;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
_node.startIndex = syntaxObj[_lineNumber].valueLength;
|
|
165
|
+
_node.endIndex = _node.startIndex + _valueLength - 1;
|
|
166
|
+
syntaxObj[_lineNumber].value += _value;
|
|
167
|
+
syntaxObj[_lineNumber].valueLength += _valueLength;
|
|
168
|
+
syntaxObj[_lineNumber].nodeList.push({ node: _node, wrapper });
|
|
169
|
+
}
|
|
170
|
+
node.children.push(_node);
|
|
171
|
+
}
|
|
172
|
+
node.lineNumber = lineNumber;
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (node.children) {
|
|
176
|
+
loopAST(node.children, node);
|
|
177
|
+
node.lineNumber = lineNumber;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
loopAST(ast.children);
|
|
182
|
+
return { syntaxFileObject: syntaxObj, syntaxFileLineNumber: lineNumber };
|
|
183
|
+
};
|
|
136
184
|
|
|
137
185
|
const lowlight = lowlight$1.createLowlight(lowlight$1.all);
|
|
186
|
+
// !SEE https://github.com/highlightjs/highlightjs-vue
|
|
138
187
|
lowlight.register("vue", function hljsDefineVue(hljs) {
|
|
139
188
|
return {
|
|
140
189
|
subLanguage: "xml",
|
|
@@ -180,50 +229,95 @@ lowlight.register("vue", function hljsDefineVue(hljs) {
|
|
|
180
229
|
],
|
|
181
230
|
};
|
|
182
231
|
});
|
|
183
|
-
const
|
|
184
|
-
let _autoDetectLang = true;
|
|
232
|
+
const instance = { name: "lowlight" };
|
|
185
233
|
let _maxLineToIgnoreSyntax = 2000;
|
|
186
234
|
const _ignoreSyntaxHighlightList = [];
|
|
187
|
-
Object.defineProperty(
|
|
235
|
+
Object.defineProperty(instance, "maxLineToIgnoreSyntax", {
|
|
188
236
|
get: () => _maxLineToIgnoreSyntax,
|
|
189
237
|
});
|
|
190
|
-
Object.defineProperty(
|
|
238
|
+
Object.defineProperty(instance, "setMaxLineToIgnoreSyntax", {
|
|
191
239
|
value: (v) => {
|
|
192
240
|
_maxLineToIgnoreSyntax = v;
|
|
193
241
|
},
|
|
194
242
|
});
|
|
195
|
-
Object.defineProperty(
|
|
196
|
-
get: () => _autoDetectLang,
|
|
197
|
-
});
|
|
198
|
-
Object.defineProperty(highlighter, "setAutoDetectLang", {
|
|
199
|
-
value: (v) => {
|
|
200
|
-
_autoDetectLang = v;
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
Object.defineProperty(highlighter, "ignoreSyntaxHighlightList", {
|
|
243
|
+
Object.defineProperty(instance, "ignoreSyntaxHighlightList", {
|
|
204
244
|
get: () => _ignoreSyntaxHighlightList,
|
|
205
245
|
});
|
|
206
|
-
Object.defineProperty(
|
|
246
|
+
Object.defineProperty(instance, "setIgnoreSyntaxHighlightList", {
|
|
207
247
|
value: (v) => {
|
|
208
248
|
_ignoreSyntaxHighlightList.length = 0;
|
|
209
249
|
_ignoreSyntaxHighlightList.push(...v);
|
|
210
250
|
},
|
|
211
251
|
});
|
|
252
|
+
Object.defineProperty(instance, "getAST", {
|
|
253
|
+
value: (raw, fileName, lang) => {
|
|
254
|
+
let hasRegisteredLang = true;
|
|
255
|
+
if (!lowlight.registered(lang)) {
|
|
256
|
+
console.warn(`not support current lang: ${lang} yet`);
|
|
257
|
+
hasRegisteredLang = false;
|
|
258
|
+
}
|
|
259
|
+
if (fileName &&
|
|
260
|
+
highlighter.ignoreSyntaxHighlightList.some((item) => item instanceof RegExp ? item.test(fileName) : fileName === item)) {
|
|
261
|
+
console.warn(`ignore syntax for current file, because the fileName is in the ignoreSyntaxHighlightList: ${fileName}`);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (hasRegisteredLang) {
|
|
265
|
+
return lowlight.highlight(lang, raw);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
return lowlight.highlightAuto(raw);
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
Object.defineProperty(instance, "processAST", {
|
|
273
|
+
value: (ast) => {
|
|
274
|
+
return processAST(ast);
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
const highlighter = instance;
|
|
212
278
|
|
|
213
|
-
var
|
|
279
|
+
var _Cache_keyArray, _Cache_maxLength;
|
|
280
|
+
class Cache extends Map {
|
|
281
|
+
constructor() {
|
|
282
|
+
super(...arguments);
|
|
283
|
+
_Cache_keyArray.set(this, []);
|
|
284
|
+
_Cache_maxLength.set(this, 30);
|
|
285
|
+
}
|
|
286
|
+
setMaxLength(length) {
|
|
287
|
+
__classPrivateFieldSet(this, _Cache_maxLength, length, "f");
|
|
288
|
+
this._checkLength();
|
|
289
|
+
}
|
|
290
|
+
set(key, value) {
|
|
291
|
+
if (this.has(key))
|
|
292
|
+
return this;
|
|
293
|
+
__classPrivateFieldGet(this, _Cache_keyArray, "f").push(key);
|
|
294
|
+
this._checkLength();
|
|
295
|
+
return super.set(key, value);
|
|
296
|
+
}
|
|
297
|
+
_checkLength() {
|
|
298
|
+
while (__classPrivateFieldGet(this, _Cache_keyArray, "f").length > __classPrivateFieldGet(this, _Cache_maxLength, "f")) {
|
|
299
|
+
const key = __classPrivateFieldGet(this, _Cache_keyArray, "f").shift();
|
|
300
|
+
this.delete(key);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
_Cache_keyArray = new WeakMap(), _Cache_maxLength = new WeakMap();
|
|
305
|
+
|
|
306
|
+
var _File_instances, _File_doCheck;
|
|
214
307
|
const map = new Cache();
|
|
308
|
+
const devKey = "@git-diff-cache";
|
|
215
309
|
map.setMaxLength(50);
|
|
216
310
|
map.name = "@git-diff-view/core";
|
|
217
311
|
if (typeof globalThis !== "undefined") {
|
|
218
|
-
if (Array.isArray(globalThis
|
|
219
|
-
globalThis
|
|
220
|
-
if (globalThis.
|
|
312
|
+
if (Array.isArray(globalThis[devKey])) {
|
|
313
|
+
globalThis[devKey] = globalThis[devKey].filter((i) => i !== map);
|
|
314
|
+
if (globalThis[devKey].length > 0) {
|
|
221
315
|
console.warn("there are multiple instance of @git-diff-view/core in the one environment!");
|
|
222
316
|
}
|
|
223
|
-
globalThis.
|
|
317
|
+
globalThis[devKey].push(map);
|
|
224
318
|
}
|
|
225
319
|
else {
|
|
226
|
-
globalThis
|
|
320
|
+
globalThis[devKey] = [map];
|
|
227
321
|
}
|
|
228
322
|
}
|
|
229
323
|
class File {
|
|
@@ -239,38 +333,25 @@ class File {
|
|
|
239
333
|
this.maxLineNumber = 0;
|
|
240
334
|
Object.defineProperty(this, "__v_skip", { value: true });
|
|
241
335
|
}
|
|
242
|
-
doSyntax({
|
|
336
|
+
doSyntax({ registerHighlighter }) {
|
|
243
337
|
if (!this.raw || this.hasDoSyntax)
|
|
244
338
|
return;
|
|
245
|
-
let hasRegisteredLang = true;
|
|
246
339
|
const _highlighter = registerHighlighter || highlighter;
|
|
247
340
|
if (this.syntaxLength) {
|
|
248
341
|
console.error("current file already doSyntax before!");
|
|
249
342
|
return;
|
|
250
343
|
}
|
|
251
|
-
if (!_highlighter.registered(this.lang)) {
|
|
252
|
-
hasRegisteredLang = false;
|
|
253
|
-
if (!autoDetectLang) {
|
|
254
|
-
console.warn(`not support current lang: ${this.lang} yet`);
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
344
|
if (this.rawLength > _highlighter.maxLineToIgnoreSyntax) {
|
|
259
345
|
console.warn(`ignore syntax for current file, because the rawLength is too long: ${this.rawLength}`);
|
|
260
346
|
return;
|
|
261
347
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
console.warn(`ignore syntax for current file, because the fileName is in the ignoreSyntaxHighlightList: ${this.fileName}`);
|
|
348
|
+
this.ast = _highlighter.getAST(this.raw, this.fileName, this.lang);
|
|
349
|
+
if (!this.ast)
|
|
265
350
|
return;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
else {
|
|
271
|
-
this.ast = _highlighter.highlightAuto(this.raw);
|
|
272
|
-
}
|
|
273
|
-
__classPrivateFieldGet(this, _File_instances, "m", _File_doAST).call(this);
|
|
351
|
+
const { syntaxFileObject, syntaxFileLineNumber } = _highlighter.processAST(this.ast);
|
|
352
|
+
this.syntaxFile = syntaxFileObject;
|
|
353
|
+
this.syntaxLength = syntaxFileLineNumber;
|
|
354
|
+
this.highlighterName = _highlighter.name;
|
|
274
355
|
{
|
|
275
356
|
__classPrivateFieldGet(this, _File_instances, "m", _File_doCheck).call(this);
|
|
276
357
|
}
|
|
@@ -298,81 +379,7 @@ class File {
|
|
|
298
379
|
this.hasDoRaw = true;
|
|
299
380
|
}
|
|
300
381
|
}
|
|
301
|
-
_File_instances = new WeakSet(),
|
|
302
|
-
const ast = this.ast;
|
|
303
|
-
let lineNumber = 1;
|
|
304
|
-
const syntaxObj = this.syntaxFile;
|
|
305
|
-
const loopAST = (nodes, wrapper) => {
|
|
306
|
-
nodes.forEach((node) => {
|
|
307
|
-
if (node.type === "text") {
|
|
308
|
-
if (node.value.indexOf("\n") === -1) {
|
|
309
|
-
const valueLength = node.value.length;
|
|
310
|
-
if (!syntaxObj[lineNumber]) {
|
|
311
|
-
node.startIndex = 0;
|
|
312
|
-
node.endIndex = valueLength - 1;
|
|
313
|
-
const item = {
|
|
314
|
-
value: node.value,
|
|
315
|
-
lineNumber,
|
|
316
|
-
valueLength,
|
|
317
|
-
nodeList: [{ node, wrapper }],
|
|
318
|
-
};
|
|
319
|
-
syntaxObj[lineNumber] = item;
|
|
320
|
-
}
|
|
321
|
-
else {
|
|
322
|
-
node.startIndex = syntaxObj[lineNumber].valueLength;
|
|
323
|
-
node.endIndex = node.startIndex + valueLength - 1;
|
|
324
|
-
syntaxObj[lineNumber].value += node.value;
|
|
325
|
-
syntaxObj[lineNumber].valueLength += valueLength;
|
|
326
|
-
syntaxObj[lineNumber].nodeList.push({ node, wrapper });
|
|
327
|
-
}
|
|
328
|
-
node.lineNumber = lineNumber;
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
const lines = node.value.split("\n");
|
|
332
|
-
node.children = node.children || [];
|
|
333
|
-
for (let i = 0; i < lines.length; i++) {
|
|
334
|
-
const _value = i === lines.length - 1 ? lines[i] : lines[i] + "\n";
|
|
335
|
-
const _lineNumber = i === 0 ? lineNumber : ++lineNumber;
|
|
336
|
-
const _valueLength = _value.length;
|
|
337
|
-
const _node = {
|
|
338
|
-
type: "text",
|
|
339
|
-
value: _value,
|
|
340
|
-
startIndex: Infinity,
|
|
341
|
-
endIndex: Infinity,
|
|
342
|
-
lineNumber: _lineNumber,
|
|
343
|
-
};
|
|
344
|
-
if (!syntaxObj[_lineNumber]) {
|
|
345
|
-
_node.startIndex = 0;
|
|
346
|
-
_node.endIndex = _valueLength - 1;
|
|
347
|
-
const item = {
|
|
348
|
-
value: _value,
|
|
349
|
-
lineNumber: _lineNumber,
|
|
350
|
-
valueLength: _valueLength,
|
|
351
|
-
nodeList: [{ node: _node, wrapper }],
|
|
352
|
-
};
|
|
353
|
-
syntaxObj[_lineNumber] = item;
|
|
354
|
-
}
|
|
355
|
-
else {
|
|
356
|
-
_node.startIndex = syntaxObj[_lineNumber].valueLength;
|
|
357
|
-
_node.endIndex = _node.startIndex + _valueLength - 1;
|
|
358
|
-
syntaxObj[_lineNumber].value += _value;
|
|
359
|
-
syntaxObj[_lineNumber].valueLength += _valueLength;
|
|
360
|
-
syntaxObj[_lineNumber].nodeList.push({ node: _node, wrapper });
|
|
361
|
-
}
|
|
362
|
-
node.children.push(_node);
|
|
363
|
-
}
|
|
364
|
-
node.lineNumber = lineNumber;
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
if (node.children) {
|
|
368
|
-
loopAST(node.children, node);
|
|
369
|
-
node.lineNumber = lineNumber;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
};
|
|
373
|
-
loopAST(ast.children);
|
|
374
|
-
this.syntaxLength = lineNumber;
|
|
375
|
-
}, _File_doCheck = function _File_doCheck() {
|
|
382
|
+
_File_instances = new WeakSet(), _File_doCheck = function _File_doCheck() {
|
|
376
383
|
if (this.rawLength && this.syntaxLength) {
|
|
377
384
|
if (this.rawLength !== this.syntaxLength) {
|
|
378
385
|
console.warn("the rawLength not match for the syntaxLength");
|
|
@@ -385,7 +392,7 @@ _File_instances = new WeakSet(), _File_doAST = function _File_doAST() {
|
|
|
385
392
|
}
|
|
386
393
|
};
|
|
387
394
|
const getFile = (raw, lang, fileName) => {
|
|
388
|
-
const key = raw + "--" + "0.0.
|
|
395
|
+
const key = raw + "--" + "0.0.10" + "--" + lang;
|
|
389
396
|
if (map.has(key))
|
|
390
397
|
return map.get(key);
|
|
391
398
|
const file = new File(raw, lang, fileName);
|
|
@@ -394,6 +401,12 @@ const getFile = (raw, lang, fileName) => {
|
|
|
394
401
|
};
|
|
395
402
|
const _cacheMap = map;
|
|
396
403
|
|
|
404
|
+
exports.NewLineSymbol = void 0;
|
|
405
|
+
(function (NewLineSymbol) {
|
|
406
|
+
NewLineSymbol[NewLineSymbol["CRLF"] = 1] = "CRLF";
|
|
407
|
+
NewLineSymbol[NewLineSymbol["CR"] = 2] = "CR";
|
|
408
|
+
NewLineSymbol[NewLineSymbol["LF"] = 3] = "LF";
|
|
409
|
+
})(exports.NewLineSymbol || (exports.NewLineSymbol = {}));
|
|
397
410
|
const maxLength = 1000;
|
|
398
411
|
/** Get the maximum position in the range. */
|
|
399
412
|
function rangeMax(range) {
|
|
@@ -430,12 +443,12 @@ function relativeChanges(stringA, stringB) {
|
|
|
430
443
|
stringARange: {
|
|
431
444
|
location: _stringA.length,
|
|
432
445
|
length: stringA.length - _stringA.length,
|
|
433
|
-
|
|
446
|
+
newLineSymbol: aEndStr === "\r\n" ? exports.NewLineSymbol.CRLF : aEndStr.endsWith("\r") ? exports.NewLineSymbol.CR : exports.NewLineSymbol.LF,
|
|
434
447
|
},
|
|
435
448
|
stringBRange: {
|
|
436
449
|
location: _stringB.length,
|
|
437
450
|
length: stringB.length - _stringB.length,
|
|
438
|
-
|
|
451
|
+
newLineSymbol: bEndStr === "\r\n" ? exports.NewLineSymbol.CRLF : bEndStr.endsWith("\r") ? exports.NewLineSymbol.CR : exports.NewLineSymbol.LF,
|
|
439
452
|
},
|
|
440
453
|
};
|
|
441
454
|
}
|
|
@@ -683,7 +696,7 @@ const getDiffRange = (additions, deletions) => {
|
|
|
683
696
|
};
|
|
684
697
|
|
|
685
698
|
/* eslint-disable max-lines */
|
|
686
|
-
//
|
|
699
|
+
// !NOTE: ALL of the diff parse logic copy from desktop, SEE https://github.com/desktop/desktop
|
|
687
700
|
// https://en.wikipedia.org/wiki/Diff_utility
|
|
688
701
|
//
|
|
689
702
|
// @@ -l,s +l,s @@ optional section heading
|
|
@@ -1013,7 +1026,9 @@ class DiffParser {
|
|
|
1013
1026
|
}
|
|
1014
1027
|
const parseInstance = new DiffParser();
|
|
1015
1028
|
|
|
1016
|
-
|
|
1029
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
1030
|
+
/* eslint-disable max-lines */
|
|
1031
|
+
var _DiffFile_instances, _DiffFile_oldFileResult, _DiffFile_newFileResult, _DiffFile_diffListResults, _DiffFile_diffLines, _DiffFile_oldFileDiffLines, _DiffFile_newFileDiffLines, _DiffFile_oldFileLines, _DiffFile_newFileLines, _DiffFile_oldFileSyntaxLines, _DiffFile_newFileSyntaxLines, _DiffFile_oldFilePlaceholderLines, _DiffFile_newFilePlaceholderLines, _DiffFile_splitLeftLines, _DiffFile_splitRightLines, _DiffFile_splitHunksLines, _DiffFile_unifiedLines, _DiffFile_unifiedHunksLines, _DiffFile_listeners, _DiffFile_hasInitRaw, _DiffFile_hasInitSyntax, _DiffFile_hasBuildSplit, _DiffFile_hasBuildUnified, _DiffFile_updateCount, _DiffFile_composeByDiff, _DiffFile_highlighterName, _DiffFile_id, _DiffFile_clonedInstance, _DiffFile_doDiff, _DiffFile_doFile, _DiffFile_composeRaw, _DiffFile_composeFile, _DiffFile_composeDiff, _DiffFile_composeSyntax, _DiffFile_getOldDiffLine, _DiffFile_getNewDiffLine, _DiffFile_getOldRawLine, _DiffFile_getNewRawLine;
|
|
1017
1032
|
const composeLen = 40;
|
|
1018
1033
|
const idSet = new Set();
|
|
1019
1034
|
class DiffFile {
|
|
@@ -1054,7 +1069,8 @@ class DiffFile {
|
|
|
1054
1069
|
_DiffFile_hasBuildUnified.set(this, false);
|
|
1055
1070
|
_DiffFile_updateCount.set(this, 0);
|
|
1056
1071
|
_DiffFile_composeByDiff.set(this, false);
|
|
1057
|
-
this
|
|
1072
|
+
_DiffFile_highlighterName.set(this, void 0);
|
|
1073
|
+
this._version_ = "0.0.10";
|
|
1058
1074
|
this._oldFileContent = "";
|
|
1059
1075
|
this._oldFileLang = "";
|
|
1060
1076
|
this._newFileContent = "";
|
|
@@ -1314,6 +1330,7 @@ class DiffFile {
|
|
|
1314
1330
|
const splitLineLength = this.splitLineLength;
|
|
1315
1331
|
const unifiedLineLength = this.unifiedLineLength;
|
|
1316
1332
|
const composeByDiff = __classPrivateFieldGet(this, _DiffFile_composeByDiff, "f");
|
|
1333
|
+
const highlighterName = __classPrivateFieldGet(this, _DiffFile_highlighterName, "f");
|
|
1317
1334
|
const hasCollapsed = this.hasCollapsed;
|
|
1318
1335
|
// split
|
|
1319
1336
|
const splitLeftLines = __classPrivateFieldGet(this, _DiffFile_splitLeftLines, "f");
|
|
@@ -1343,6 +1360,7 @@ class DiffFile {
|
|
|
1343
1360
|
splitHunkLines,
|
|
1344
1361
|
unifiedLines,
|
|
1345
1362
|
unifiedHunkLines,
|
|
1363
|
+
highlighterName,
|
|
1346
1364
|
composeByDiff,
|
|
1347
1365
|
hasCollapsed,
|
|
1348
1366
|
version,
|
|
@@ -1354,6 +1372,7 @@ class DiffFile {
|
|
|
1354
1372
|
__classPrivateFieldSet(this, _DiffFile_hasBuildSplit, data.hasBuildSplit, "f");
|
|
1355
1373
|
__classPrivateFieldSet(this, _DiffFile_hasBuildUnified, data.hasBuildUnified, "f");
|
|
1356
1374
|
__classPrivateFieldSet(this, _DiffFile_composeByDiff, data.composeByDiff, "f");
|
|
1375
|
+
__classPrivateFieldSet(this, _DiffFile_highlighterName, data.highlighterName, "f");
|
|
1357
1376
|
__classPrivateFieldSet(this, _DiffFile_oldFileLines, data.oldFileLines, "f");
|
|
1358
1377
|
__classPrivateFieldSet(this, _DiffFile_oldFileDiffLines, data.oldFileDiffLines, "f");
|
|
1359
1378
|
__classPrivateFieldSet(this, _DiffFile_oldFileSyntaxLines, data.oldFileSyntaxLines, "f");
|
|
@@ -1375,6 +1394,7 @@ class DiffFile {
|
|
|
1375
1394
|
}
|
|
1376
1395
|
this.notifyAll();
|
|
1377
1396
|
};
|
|
1397
|
+
this._getHighlighterName = () => __classPrivateFieldGet(this, _DiffFile_highlighterName, "f");
|
|
1378
1398
|
this._getIsPureDiffRender = () => __classPrivateFieldGet(this, _DiffFile_composeByDiff, "f");
|
|
1379
1399
|
this._addClonedInstance = (instance) => {
|
|
1380
1400
|
const updateFunc = () => {
|
|
@@ -1483,10 +1503,12 @@ class DiffFile {
|
|
|
1483
1503
|
__classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_composeFile).call(this);
|
|
1484
1504
|
__classPrivateFieldSet(this, _DiffFile_hasInitRaw, true, "f");
|
|
1485
1505
|
}
|
|
1486
|
-
initSyntax({
|
|
1506
|
+
initSyntax({ registerHighlighter } = {}) {
|
|
1507
|
+
var _a, _b;
|
|
1487
1508
|
if (__classPrivateFieldGet(this, _DiffFile_hasInitSyntax, "f"))
|
|
1488
1509
|
return;
|
|
1489
|
-
__classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_composeSyntax).call(this, { registerHighlighter
|
|
1510
|
+
__classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_composeSyntax).call(this, { registerHighlighter });
|
|
1511
|
+
__classPrivateFieldSet(this, _DiffFile_highlighterName, ((_a = __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f")) === null || _a === void 0 ? void 0 : _a.highlighterName) || ((_b = __classPrivateFieldGet(this, _DiffFile_newFileResult, "f")) === null || _b === void 0 ? void 0 : _b.highlighterName) || __classPrivateFieldGet(this, _DiffFile_highlighterName, "f"), "f");
|
|
1490
1512
|
__classPrivateFieldSet(this, _DiffFile_hasInitSyntax, true, "f");
|
|
1491
1513
|
}
|
|
1492
1514
|
init() {
|
|
@@ -1764,7 +1786,7 @@ class DiffFile {
|
|
|
1764
1786
|
this.notifyAll();
|
|
1765
1787
|
}
|
|
1766
1788
|
}
|
|
1767
|
-
_DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap(), _DiffFile_diffListResults = new WeakMap(), _DiffFile_diffLines = new WeakMap(), _DiffFile_oldFileDiffLines = new WeakMap(), _DiffFile_newFileDiffLines = new WeakMap(), _DiffFile_oldFileLines = new WeakMap(), _DiffFile_newFileLines = new WeakMap(), _DiffFile_oldFileSyntaxLines = new WeakMap(), _DiffFile_newFileSyntaxLines = new WeakMap(), _DiffFile_oldFilePlaceholderLines = new WeakMap(), _DiffFile_newFilePlaceholderLines = new WeakMap(), _DiffFile_splitLeftLines = new WeakMap(), _DiffFile_splitRightLines = new WeakMap(), _DiffFile_splitHunksLines = new WeakMap(), _DiffFile_unifiedLines = new WeakMap(), _DiffFile_unifiedHunksLines = new WeakMap(), _DiffFile_listeners = new WeakMap(), _DiffFile_hasInitRaw = new WeakMap(), _DiffFile_hasInitSyntax = new WeakMap(), _DiffFile_hasBuildSplit = new WeakMap(), _DiffFile_hasBuildUnified = new WeakMap(), _DiffFile_updateCount = new WeakMap(), _DiffFile_composeByDiff = new WeakMap(), _DiffFile_id = new WeakMap(), _DiffFile_clonedInstance = new WeakMap(), _DiffFile_instances = new WeakSet(), _DiffFile_doDiff = function _DiffFile_doDiff() {
|
|
1789
|
+
_DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap(), _DiffFile_diffListResults = new WeakMap(), _DiffFile_diffLines = new WeakMap(), _DiffFile_oldFileDiffLines = new WeakMap(), _DiffFile_newFileDiffLines = new WeakMap(), _DiffFile_oldFileLines = new WeakMap(), _DiffFile_newFileLines = new WeakMap(), _DiffFile_oldFileSyntaxLines = new WeakMap(), _DiffFile_newFileSyntaxLines = new WeakMap(), _DiffFile_oldFilePlaceholderLines = new WeakMap(), _DiffFile_newFilePlaceholderLines = new WeakMap(), _DiffFile_splitLeftLines = new WeakMap(), _DiffFile_splitRightLines = new WeakMap(), _DiffFile_splitHunksLines = new WeakMap(), _DiffFile_unifiedLines = new WeakMap(), _DiffFile_unifiedHunksLines = new WeakMap(), _DiffFile_listeners = new WeakMap(), _DiffFile_hasInitRaw = new WeakMap(), _DiffFile_hasInitSyntax = new WeakMap(), _DiffFile_hasBuildSplit = new WeakMap(), _DiffFile_hasBuildUnified = new WeakMap(), _DiffFile_updateCount = new WeakMap(), _DiffFile_composeByDiff = new WeakMap(), _DiffFile_highlighterName = new WeakMap(), _DiffFile_id = new WeakMap(), _DiffFile_clonedInstance = new WeakMap(), _DiffFile_instances = new WeakSet(), _DiffFile_doDiff = function _DiffFile_doDiff() {
|
|
1768
1790
|
if (!this._diffList)
|
|
1769
1791
|
return;
|
|
1770
1792
|
__classPrivateFieldSet(this, _DiffFile_diffListResults, this._diffList.map((s) => parseInstance.parse(s)), "f");
|
|
@@ -1840,7 +1862,11 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1840
1862
|
oldLineNumber = newDiffLine.oldLineNumber ? newDiffLine.oldLineNumber + 1 : oldLineNumber;
|
|
1841
1863
|
}
|
|
1842
1864
|
else {
|
|
1843
|
-
|
|
1865
|
+
const oldDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldDiffLine).call(this, oldLineNumber);
|
|
1866
|
+
if (!oldDiffLine) {
|
|
1867
|
+
newFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getOldRawLine).call(this, oldLineNumber);
|
|
1868
|
+
}
|
|
1869
|
+
oldLineNumber++;
|
|
1844
1870
|
}
|
|
1845
1871
|
}
|
|
1846
1872
|
if (newFileContent === this._oldFileContent)
|
|
@@ -1859,7 +1885,11 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1859
1885
|
newLineNumber = oldDiffLine.newLineNumber ? oldDiffLine.newLineNumber + 1 : newLineNumber;
|
|
1860
1886
|
}
|
|
1861
1887
|
else {
|
|
1862
|
-
|
|
1888
|
+
const newDiffLine = __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewDiffLine).call(this, newLineNumber);
|
|
1889
|
+
if (!newDiffLine) {
|
|
1890
|
+
oldFileContent += __classPrivateFieldGet(this, _DiffFile_instances, "m", _DiffFile_getNewRawLine).call(this, newLineNumber);
|
|
1891
|
+
}
|
|
1892
|
+
newLineNumber++;
|
|
1863
1893
|
}
|
|
1864
1894
|
}
|
|
1865
1895
|
if (oldFileContent === this._newFileContent)
|
|
@@ -1959,11 +1989,11 @@ _DiffFile_oldFileResult = new WeakMap(), _DiffFile_newFileResult = new WeakMap()
|
|
|
1959
1989
|
__classPrivateFieldGet(this, _DiffFile_newFileDiffLines, "f")[item.newLineNumber] = item;
|
|
1960
1990
|
}
|
|
1961
1991
|
});
|
|
1962
|
-
}, _DiffFile_composeSyntax = function _DiffFile_composeSyntax({
|
|
1992
|
+
}, _DiffFile_composeSyntax = function _DiffFile_composeSyntax({ registerHighlighter }) {
|
|
1963
1993
|
var _a, _b, _c, _d;
|
|
1964
|
-
(_a = __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f")) === null || _a === void 0 ? void 0 : _a.doSyntax({
|
|
1994
|
+
(_a = __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f")) === null || _a === void 0 ? void 0 : _a.doSyntax({ registerHighlighter });
|
|
1965
1995
|
__classPrivateFieldSet(this, _DiffFile_oldFileSyntaxLines, (_b = __classPrivateFieldGet(this, _DiffFile_oldFileResult, "f")) === null || _b === void 0 ? void 0 : _b.syntaxFile, "f");
|
|
1966
|
-
(_c = __classPrivateFieldGet(this, _DiffFile_newFileResult, "f")) === null || _c === void 0 ? void 0 : _c.doSyntax({
|
|
1996
|
+
(_c = __classPrivateFieldGet(this, _DiffFile_newFileResult, "f")) === null || _c === void 0 ? void 0 : _c.doSyntax({ registerHighlighter });
|
|
1967
1997
|
__classPrivateFieldSet(this, _DiffFile_newFileSyntaxLines, (_d = __classPrivateFieldGet(this, _DiffFile_newFileResult, "f")) === null || _d === void 0 ? void 0 : _d.syntaxFile, "f");
|
|
1968
1998
|
}, _DiffFile_getOldDiffLine = function _DiffFile_getOldDiffLine(lineNumber) {
|
|
1969
1999
|
var _a;
|
|
@@ -2060,7 +2090,7 @@ const getUnifiedContentLine = (diffFile) => {
|
|
|
2060
2090
|
return lines.filter((line) => line.type === exports.DiffFileLineType.content);
|
|
2061
2091
|
};
|
|
2062
2092
|
|
|
2063
|
-
const versions = "0.0.
|
|
2093
|
+
const versions = "0.0.10";
|
|
2064
2094
|
|
|
2065
2095
|
const useUnmount = (cb, deps) => {
|
|
2066
2096
|
const ref = React.useRef(cb);
|
|
@@ -2158,14 +2188,18 @@ const useDomWidth = ({ selector, enable }) => {
|
|
|
2158
2188
|
|
|
2159
2189
|
exports.DiffModeEnum = void 0;
|
|
2160
2190
|
(function (DiffModeEnum) {
|
|
2161
|
-
|
|
2162
|
-
DiffModeEnum[DiffModeEnum["
|
|
2191
|
+
// github like
|
|
2192
|
+
DiffModeEnum[DiffModeEnum["SplitGitHub"] = 1] = "SplitGitHub";
|
|
2193
|
+
// gitlab like
|
|
2194
|
+
DiffModeEnum[DiffModeEnum["SplitGitLab"] = 2] = "SplitGitLab";
|
|
2195
|
+
DiffModeEnum[DiffModeEnum["Split"] = 3] = "Split";
|
|
2196
|
+
DiffModeEnum[DiffModeEnum["Unified"] = 4] = "Unified";
|
|
2163
2197
|
})(exports.DiffModeEnum || (exports.DiffModeEnum = {}));
|
|
2164
2198
|
const DiffViewContext = React.createContext(null);
|
|
2165
2199
|
DiffViewContext.displayName = "DiffViewContext";
|
|
2166
2200
|
const useDiffViewContext = () => React.useContext(DiffViewContext);
|
|
2167
2201
|
|
|
2168
|
-
const useSyncHeight = ({ selector, side, enable
|
|
2202
|
+
const useSyncHeight = ({ selector, side, enable }) => {
|
|
2169
2203
|
const { useDiffContext } = useDiffViewContext();
|
|
2170
2204
|
const id = useDiffContext(React.useCallback((s) => s.id, []));
|
|
2171
2205
|
useSafeLayout(() => {
|
|
@@ -2241,14 +2275,11 @@ const getLineNumberBG = (isAdded, isDelete, hasDiff) => {
|
|
|
2241
2275
|
: `var(${expandContentBGName})`;
|
|
2242
2276
|
};
|
|
2243
2277
|
|
|
2244
|
-
const _DiffSplitExtendLine$1 = ({ index, diffFile, side, lineNumber, }) => {
|
|
2245
|
-
var _a, _b;
|
|
2278
|
+
const _DiffSplitExtendLine$1 = ({ index, diffFile, oldLineExtend, newLineExtend, side, lineNumber, }) => {
|
|
2246
2279
|
const { useDiffContext } = useDiffViewContext();
|
|
2247
|
-
const { extendData, renderExtendLine } = useDiffContext(React__namespace.useCallback((s) => ({ extendData: s.extendData, renderExtendLine: s.renderExtendLine }), []));
|
|
2248
2280
|
const oldLine = diffFile.getSplitLeftLine(index);
|
|
2249
2281
|
const newLine = diffFile.getSplitRightLine(index);
|
|
2250
|
-
const
|
|
2251
|
-
const newLineExtend = (_b = extendData === null || extendData === void 0 ? void 0 : extendData.newFile) === null || _b === void 0 ? void 0 : _b[newLine === null || newLine === void 0 ? void 0 : newLine.lineNumber];
|
|
2282
|
+
const renderExtendLine = useDiffContext(React__namespace.useCallback((s) => s.renderExtendLine, []));
|
|
2252
2283
|
const currentExtend = side === exports.SplitSide.old ? oldLineExtend : newLineExtend;
|
|
2253
2284
|
const currentLineNumber = side === exports.SplitSide.old ? oldLine.lineNumber : newLine.lineNumber;
|
|
2254
2285
|
const otherSide = side === exports.SplitSide.old ? exports.SplitSide.new : exports.SplitSide.old;
|
|
@@ -2265,6 +2296,7 @@ const _DiffSplitExtendLine$1 = ({ index, diffFile, side, lineNumber, }) => {
|
|
|
2265
2296
|
return null;
|
|
2266
2297
|
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-extend`, "data-state": "extend", "data-side": exports.SplitSide[side], className: "diff-line diff-line-extend" }, currentExtend ? (React__namespace.createElement("td", { className: `diff-line-extend-${exports.SplitSide[side]}-content p-0`, colSpan: 2 },
|
|
2267
2298
|
React__namespace.createElement("div", { className: "diff-line-extend-wrapper sticky left-0", style: { width } }, width > 0 &&
|
|
2299
|
+
(currentExtend === null || currentExtend === void 0 ? void 0 : currentExtend.data) &&
|
|
2268
2300
|
(renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
|
|
2269
2301
|
diffFile,
|
|
2270
2302
|
side,
|
|
@@ -2278,14 +2310,21 @@ const DiffSplitExtendLine$1 = ({ index, diffFile, side, lineNumber, }) => {
|
|
|
2278
2310
|
const { useDiffContext } = useDiffViewContext();
|
|
2279
2311
|
const oldLine = diffFile.getSplitLeftLine(index);
|
|
2280
2312
|
const newLine = diffFile.getSplitRightLine(index);
|
|
2281
|
-
const
|
|
2313
|
+
const { oldLineExtend, newLineExtend } = useDiffContext(React__namespace.useCallback((s) => {
|
|
2314
|
+
var _a, _b, _c, _d;
|
|
2315
|
+
return ({
|
|
2316
|
+
oldLineExtend: (_b = (_a = s.extendData) === null || _a === void 0 ? void 0 : _a.oldFile) === null || _b === void 0 ? void 0 : _b[oldLine === null || oldLine === void 0 ? void 0 : oldLine.lineNumber],
|
|
2317
|
+
newLineExtend: (_d = (_c = s.extendData) === null || _c === void 0 ? void 0 : _c.newFile) === null || _d === void 0 ? void 0 : _d[newLine === null || newLine === void 0 ? void 0 : newLine.lineNumber],
|
|
2318
|
+
});
|
|
2319
|
+
}, [oldLine === null || oldLine === void 0 ? void 0 : oldLine.lineNumber, newLine === null || newLine === void 0 ? void 0 : newLine.lineNumber]));
|
|
2320
|
+
const hasExtend = (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) || (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data);
|
|
2282
2321
|
// if the expand action not enabled, the `isHidden` property will never change
|
|
2283
2322
|
const enableExpand = diffFile.getExpandEnabled();
|
|
2284
2323
|
const currentLine = side === exports.SplitSide.old ? oldLine : newLine;
|
|
2285
2324
|
const currentIsShow = hasExtend && (!currentLine.isHidden || !enableExpand);
|
|
2286
2325
|
if (!currentIsShow)
|
|
2287
2326
|
return null;
|
|
2288
|
-
return React__namespace.createElement(_DiffSplitExtendLine$1, { index: index, diffFile: diffFile,
|
|
2327
|
+
return (React__namespace.createElement(_DiffSplitExtendLine$1, { side: side, index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineExtend: oldLineExtend, newLineExtend: newLineExtend }));
|
|
2289
2328
|
};
|
|
2290
2329
|
|
|
2291
2330
|
const ExpandDown = ({ className }) => {
|
|
@@ -2331,9 +2370,21 @@ const syncScroll = (left, right) => {
|
|
|
2331
2370
|
right.onscroll = null;
|
|
2332
2371
|
};
|
|
2333
2372
|
};
|
|
2373
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
2374
|
+
const memoFunc = (func) => {
|
|
2375
|
+
const cache = {};
|
|
2376
|
+
return ((key) => {
|
|
2377
|
+
if (cache[key]) {
|
|
2378
|
+
return cache[key];
|
|
2379
|
+
}
|
|
2380
|
+
const result = func(key);
|
|
2381
|
+
cache[key] = result;
|
|
2382
|
+
return result;
|
|
2383
|
+
});
|
|
2384
|
+
};
|
|
2334
2385
|
const asideWidth = "--diff-aside-width--";
|
|
2335
2386
|
|
|
2336
|
-
const
|
|
2387
|
+
const _DiffSplitHunkLineGitHub = ({ index, diffFile, side, lineNumber, }) => {
|
|
2337
2388
|
var _a;
|
|
2338
2389
|
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2339
2390
|
const expandEnabled = diffFile.getExpandEnabled();
|
|
@@ -2372,6 +2423,50 @@ const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
|
|
|
2372
2423
|
} }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text)))) : (React__namespace.createElement("td", { className: "diff-line-hunk-placeholder select-none", colSpan: 2, style: { backgroundColor: `var(${hunkContentBGName})` } },
|
|
2373
2424
|
React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002")))));
|
|
2374
2425
|
};
|
|
2426
|
+
const _DiffSplitHunkLineGitLab = ({ index, diffFile, side, lineNumber, }) => {
|
|
2427
|
+
var _a;
|
|
2428
|
+
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2429
|
+
const expandEnabled = diffFile.getExpandEnabled();
|
|
2430
|
+
const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
|
|
2431
|
+
const isExpandAll = currentHunk &&
|
|
2432
|
+
currentHunk.splitInfo &&
|
|
2433
|
+
currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
|
|
2434
|
+
const isFirstLine = currentHunk && currentHunk.index === 0;
|
|
2435
|
+
const isLastLine = currentHunk && currentHunk.isLast;
|
|
2436
|
+
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", "data-side": exports.SplitSide[side], className: "diff-line diff-line-hunk" },
|
|
2437
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-action sticky left-0 p-[1px] w-[1%] min-w-[40px] select-none", style: {
|
|
2438
|
+
backgroundColor: `var(${hunkLineNumberBGName})`,
|
|
2439
|
+
color: `var(${plainLineNumberColorName})`,
|
|
2440
|
+
width: `var(${asideWidth})`,
|
|
2441
|
+
minWidth: `var(${asideWidth})`,
|
|
2442
|
+
maxWidth: `var(${asideWidth})`,
|
|
2443
|
+
} }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2444
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px] relative", title: "Expand Down", "data-title": "Expand Down", onClick: () => {
|
|
2445
|
+
diffFile.onSplitHunkExpand("down", index);
|
|
2446
|
+
} },
|
|
2447
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
|
|
2448
|
+
React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2449
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
|
|
2450
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" })),
|
|
2451
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2452
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
|
|
2453
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
|
|
2454
|
+
React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
|
|
2455
|
+
color: `var(${hunkContentColorName})`,
|
|
2456
|
+
} }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
|
|
2457
|
+
};
|
|
2458
|
+
const _DiffSplitHunkLine = ({ index, diffFile, side, lineNumber, }) => {
|
|
2459
|
+
const { useDiffContext } = useDiffViewContext();
|
|
2460
|
+
const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
|
|
2461
|
+
if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
|
|
2462
|
+
diffViewMode === exports.DiffModeEnum.Split ||
|
|
2463
|
+
diffViewMode === exports.DiffModeEnum.Unified) {
|
|
2464
|
+
return React__namespace.createElement(_DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
|
|
2465
|
+
}
|
|
2466
|
+
else {
|
|
2467
|
+
return React__namespace.createElement(_DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, side: side, lineNumber: lineNumber });
|
|
2468
|
+
}
|
|
2469
|
+
};
|
|
2375
2470
|
const DiffSplitHunkLine$1 = ({ index, diffFile, side, lineNumber, }) => {
|
|
2376
2471
|
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2377
2472
|
const currentIsShow = currentHunk &&
|
|
@@ -2388,7 +2483,7 @@ const DiffSplitAddWidget = ({ side, className, lineNumber, onWidgetClick, onOpen
|
|
|
2388
2483
|
width: "calc(var(--diff-font-size--) * 1.4)",
|
|
2389
2484
|
height: "calc(var(--diff-font-size--) * 1.4)",
|
|
2390
2485
|
} },
|
|
2391
|
-
React__namespace.createElement("button", { className: "diff-add-widget w-
|
|
2486
|
+
React__namespace.createElement("button", { className: "diff-add-widget w-full h-full invisible cursor-pointer rounded-md flex items-center justify-center transition-transform origin-center group-hover:visible hover:scale-110", style: {
|
|
2392
2487
|
color: `var(${addWidgetColorName})`,
|
|
2393
2488
|
zIndex: 1,
|
|
2394
2489
|
fontSize: `1.2em`,
|
|
@@ -2403,7 +2498,7 @@ const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget
|
|
|
2403
2498
|
width: "calc(var(--diff-font-size--) * 1.4)",
|
|
2404
2499
|
height: "calc(var(--diff-font-size--) * 1.4)",
|
|
2405
2500
|
} },
|
|
2406
|
-
React__namespace.createElement("button", { className: "diff-add-widget
|
|
2501
|
+
React__namespace.createElement("button", { className: "diff-add-widget w-full h-full invisible cursor-pointer rounded-md flex items-center justify-center transition-transform origin-center group-hover:visible hover:scale-110", style: {
|
|
2407
2502
|
color: `var(${addWidgetColorName})`,
|
|
2408
2503
|
zIndex: 1,
|
|
2409
2504
|
fontSize: `1.2em`,
|
|
@@ -2414,26 +2509,50 @@ const DiffUnifiedAddWidget = ({ lineNumber, side, onWidgetClick, onOpenAddWidget
|
|
|
2414
2509
|
} }, "+")));
|
|
2415
2510
|
};
|
|
2416
2511
|
|
|
2512
|
+
const temp = {};
|
|
2513
|
+
const formatStringToCamelCase = (str) => {
|
|
2514
|
+
const splitted = str.split("-");
|
|
2515
|
+
if (splitted.length === 1)
|
|
2516
|
+
return splitted[0];
|
|
2517
|
+
return (splitted[0] +
|
|
2518
|
+
splitted
|
|
2519
|
+
.slice(1)
|
|
2520
|
+
.map((word) => word[0].toUpperCase() + word.slice(1))
|
|
2521
|
+
.join(""));
|
|
2522
|
+
};
|
|
2523
|
+
const getStyleObjectFromString = memoFunc((str) => {
|
|
2524
|
+
if (!str)
|
|
2525
|
+
return temp;
|
|
2526
|
+
const style = {};
|
|
2527
|
+
str.split(";").forEach((el) => {
|
|
2528
|
+
const [property, value] = el.split(":");
|
|
2529
|
+
if (!property)
|
|
2530
|
+
return;
|
|
2531
|
+
const formattedProperty = formatStringToCamelCase(property.trim());
|
|
2532
|
+
style[formattedProperty] = value.trim();
|
|
2533
|
+
});
|
|
2534
|
+
return style;
|
|
2535
|
+
});
|
|
2417
2536
|
const DiffString = ({ rawLine, diffLine, operator, }) => {
|
|
2418
2537
|
const range = diffLine === null || diffLine === void 0 ? void 0 : diffLine.range;
|
|
2419
2538
|
if (range) {
|
|
2420
2539
|
const str1 = rawLine.slice(0, range.location);
|
|
2421
2540
|
const str2 = rawLine.slice(range.location, range.location + range.length);
|
|
2422
2541
|
const str3 = rawLine.slice(range.location + range.length);
|
|
2423
|
-
const
|
|
2542
|
+
const isLast = str2.includes("\n");
|
|
2543
|
+
const _str2 = isLast ? str2.replace("\n", "") : str2;
|
|
2544
|
+
const isNewLineSymbolChanged = range.newLineSymbol;
|
|
2424
2545
|
return (React__namespace.createElement("span", { className: "diff-line-content-raw" },
|
|
2425
2546
|
React__namespace.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length },
|
|
2426
2547
|
str1,
|
|
2427
2548
|
React__namespace.createElement("span", { "data-diff-highlight": true, className: "rounded-[0.2em]", style: {
|
|
2428
2549
|
backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
|
|
2429
|
-
} },
|
|
2430
|
-
?
|
|
2431
|
-
? "
|
|
2432
|
-
:
|
|
2433
|
-
? "
|
|
2434
|
-
:
|
|
2435
|
-
? "␍␊"
|
|
2436
|
-
: str2
|
|
2550
|
+
} }, isLast
|
|
2551
|
+
? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
|
|
2552
|
+
? "␊"
|
|
2553
|
+
: isNewLineSymbolChanged === exports.NewLineSymbol.CR
|
|
2554
|
+
? "␍"
|
|
2555
|
+
: "␍␊"}`
|
|
2437
2556
|
: str2),
|
|
2438
2557
|
str3)));
|
|
2439
2558
|
}
|
|
@@ -2448,9 +2567,9 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
|
|
|
2448
2567
|
if (range) {
|
|
2449
2568
|
return (React__namespace.createElement("span", { className: "diff-line-syntax-raw" },
|
|
2450
2569
|
React__namespace.createElement("span", { "data-range-start": range.location, "data-range-end": range.location + range.length }, (_a = syntaxLine.nodeList) === null || _a === void 0 ? void 0 : _a.map(({ node, wrapper }, index) => {
|
|
2451
|
-
var _a, _b, _c, _d;
|
|
2570
|
+
var _a, _b, _c, _d, _e, _f;
|
|
2452
2571
|
if (node.endIndex < range.location || range.location + range.length < node.startIndex) {
|
|
2453
|
-
return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" ") }, node.value));
|
|
2572
|
+
return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" "), style: getStyleObjectFromString(((_c = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _c === void 0 ? void 0 : _c.style) || "") }, node.value));
|
|
2454
2573
|
}
|
|
2455
2574
|
else {
|
|
2456
2575
|
const index1 = range.location - node.startIndex;
|
|
@@ -2460,31 +2579,31 @@ const DiffSyntax = ({ rawLine, diffLine, operator, syntaxLine, }) => {
|
|
|
2460
2579
|
const str3 = node.value.slice(index1 + range.length);
|
|
2461
2580
|
const isStart = str1.length || range.location === node.startIndex;
|
|
2462
2581
|
const isEnd = str3.length || node.endIndex === range.location + range.length - 1;
|
|
2463
|
-
const
|
|
2464
|
-
|
|
2582
|
+
const isLast = str2.includes("\n");
|
|
2583
|
+
const _str2 = isLast ? str2.replace("\n", "") : str2;
|
|
2584
|
+
const isNewLineSymbolChanged = range.newLineSymbol;
|
|
2585
|
+
return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_e = (_d = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _d === void 0 ? void 0 : _d.className) === null || _e === void 0 ? void 0 : _e.join(" "), style: getStyleObjectFromString(((_f = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _f === void 0 ? void 0 : _f.style) || "") },
|
|
2465
2586
|
str1,
|
|
2466
2587
|
React__namespace.createElement("span", { "data-diff-highlight": true, style: {
|
|
2467
2588
|
backgroundColor: operator === "add" ? `var(${addContentHighlightBGName})` : `var(${delContentHighlightBGName})`,
|
|
2468
2589
|
borderTopLeftRadius: isStart ? "0.2em" : undefined,
|
|
2469
2590
|
borderBottomLeftRadius: isStart ? "0.2em" : undefined,
|
|
2470
|
-
borderTopRightRadius: isEnd ? "0.2em" : undefined,
|
|
2471
|
-
borderBottomRightRadius: isEnd ? "0.2em" : undefined,
|
|
2472
|
-
} },
|
|
2473
|
-
?
|
|
2474
|
-
? "
|
|
2475
|
-
:
|
|
2476
|
-
? "
|
|
2477
|
-
:
|
|
2478
|
-
? "␍␊"
|
|
2479
|
-
: str2
|
|
2591
|
+
borderTopRightRadius: isEnd || isLast ? "0.2em" : undefined,
|
|
2592
|
+
borderBottomRightRadius: isEnd || isLast ? "0.2em" : undefined,
|
|
2593
|
+
} }, isLast
|
|
2594
|
+
? `${_str2}${isNewLineSymbolChanged === exports.NewLineSymbol.LF
|
|
2595
|
+
? "␊"
|
|
2596
|
+
: isNewLineSymbolChanged === exports.NewLineSymbol.CR
|
|
2597
|
+
? "␍"
|
|
2598
|
+
: "␍␊"}`
|
|
2480
2599
|
: str2),
|
|
2481
2600
|
str3));
|
|
2482
2601
|
}
|
|
2483
2602
|
}))));
|
|
2484
2603
|
}
|
|
2485
2604
|
return (React__namespace.createElement("span", { className: "diff-line-syntax-raw" }, (_b = syntaxLine === null || syntaxLine === void 0 ? void 0 : syntaxLine.nodeList) === null || _b === void 0 ? void 0 : _b.map(({ node, wrapper }, index) => {
|
|
2486
|
-
var _a, _b;
|
|
2487
|
-
return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" ") }, node.value));
|
|
2605
|
+
var _a, _b, _c;
|
|
2606
|
+
return (React__namespace.createElement("span", { key: index, "data-start": node.startIndex, "data-end": node.endIndex, className: (_b = (_a = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _a === void 0 ? void 0 : _a.className) === null || _b === void 0 ? void 0 : _b.join(" "), style: getStyleObjectFromString(((_c = wrapper === null || wrapper === void 0 ? void 0 : wrapper.properties) === null || _c === void 0 ? void 0 : _c.style) || "") }, node.value));
|
|
2488
2607
|
})));
|
|
2489
2608
|
};
|
|
2490
2609
|
const DiffContent = ({ diffLine, rawLine, syntaxLine, enableWrap, enableHighlight, }) => {
|
|
@@ -2522,7 +2641,7 @@ const _DiffSplitLine$1 = ({ index, diffFile, lineNumber, side, }) => {
|
|
|
2522
2641
|
onAddWidgetClick: s.onAddWidgetClick,
|
|
2523
2642
|
}), []));
|
|
2524
2643
|
const { useWidget } = useDiffWidgetContext();
|
|
2525
|
-
const
|
|
2644
|
+
const setWidget = useWidget.getReadonlyState().setWidget;
|
|
2526
2645
|
const contentBG = getContentBG(isAdded, isDelete, hasDiff);
|
|
2527
2646
|
const lineNumberBG = getLineNumberBG(isAdded, isDelete, hasDiff);
|
|
2528
2647
|
const syntaxLine = getCurrentSyntaxLine(currentLine.lineNumber);
|
|
@@ -2534,7 +2653,7 @@ const _DiffSplitLine$1 = ({ index, diffFile, lineNumber, side, }) => {
|
|
|
2534
2653
|
minWidth: `var(${asideWidth})`,
|
|
2535
2654
|
maxWidth: `var(${asideWidth})`,
|
|
2536
2655
|
} },
|
|
2537
|
-
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: currentLine.lineNumber, side: side, diffFile: diffFile, onWidgetClick: onAddWidgetClick, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2656
|
+
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: currentLine.lineNumber, side: side, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2538
2657
|
React__namespace.createElement("span", { "data-line-num": currentLine.lineNumber, style: { opacity: hasChange ? undefined : 0.5 } }, currentLine.lineNumber)),
|
|
2539
2658
|
React__namespace.createElement("td", { className: `diff-line-${exports.SplitSide[side]}-content pr-[10px] align-top`, style: { backgroundColor: contentBG } },
|
|
2540
2659
|
React__namespace.createElement(DiffContent, { enableWrap: false, diffFile: diffFile, rawLine: currentLine.value, diffLine: currentLine.diff, syntaxLine: syntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: `diff-line-${exports.SplitSide[side]}-placeholder select-none`, style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
@@ -2634,13 +2753,14 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
|
|
|
2634
2753
|
return;
|
|
2635
2754
|
return syncScroll(left, right);
|
|
2636
2755
|
}, []);
|
|
2756
|
+
const font = React__namespace.useMemo(() => ({ fontSize: fontSize + "px", fontFamily: "Menlo, Consolas, monospace" }), [fontSize]);
|
|
2637
2757
|
const _width = useTextWidth({
|
|
2638
2758
|
text: splitLineLength.toString(),
|
|
2639
|
-
font
|
|
2759
|
+
font,
|
|
2640
2760
|
});
|
|
2641
2761
|
const width = Math.max(40, _width + 25);
|
|
2642
2762
|
return (React__namespace.createElement("div", { className: "split-diff-view split-diff-view-wrap w-full flex basis-[50%]" },
|
|
2643
|
-
React__namespace.createElement("div", { className: "old-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", ref: ref1, style: {
|
|
2763
|
+
React__namespace.createElement("div", { className: "old-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", ref: ref1, style: {
|
|
2644
2764
|
// @ts-ignore
|
|
2645
2765
|
[asideWidth]: `${Math.round(width)}px`,
|
|
2646
2766
|
overscrollBehaviorX: "none",
|
|
@@ -2648,8 +2768,8 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
|
|
|
2648
2768
|
fontSize: "var(--diff-font-size--)",
|
|
2649
2769
|
} },
|
|
2650
2770
|
React__namespace.createElement(DiffSplitViewTable, { side: exports.SplitSide.old, diffFile: diffFile })),
|
|
2651
|
-
React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[
|
|
2652
|
-
React__namespace.createElement("div", { className: "new-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", ref: ref2, style: {
|
|
2771
|
+
React__namespace.createElement("div", { className: "diff-split-line w-[1.5px] bg-[rgb(222,222,222)]" }),
|
|
2772
|
+
React__namespace.createElement("div", { className: "new-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", ref: ref2, style: {
|
|
2653
2773
|
// @ts-ignore
|
|
2654
2774
|
[asideWidth]: `${Math.round(width)}px`,
|
|
2655
2775
|
overscrollBehaviorX: "none",
|
|
@@ -2660,51 +2780,57 @@ const DiffSplitViewNormal = React.memo(({ diffFile }) => {
|
|
|
2660
2780
|
});
|
|
2661
2781
|
DiffSplitViewNormal.displayName = "DiffSplitViewNormal";
|
|
2662
2782
|
|
|
2663
|
-
const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
|
|
2664
|
-
var _a, _b;
|
|
2783
|
+
const _DiffSplitExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newLineExtend, }) => {
|
|
2665
2784
|
const { useDiffContext } = useDiffViewContext();
|
|
2666
|
-
// 需要显示的时候才进行方法订阅,可以大幅度提高性能
|
|
2667
|
-
const { extendData, renderExtendLine } = useDiffContext(React__namespace.useCallback((s) => ({ extendData: s.extendData, renderExtendLine: s.renderExtendLine }), []));
|
|
2668
2785
|
const oldLine = diffFile.getSplitLeftLine(index);
|
|
2669
2786
|
const newLine = diffFile.getSplitRightLine(index);
|
|
2670
|
-
|
|
2671
|
-
const
|
|
2787
|
+
// 需要显示的时候才进行方法订阅,可以大幅度提高性能
|
|
2788
|
+
const renderExtendLine = useDiffContext(React__namespace.useCallback((s) => s.renderExtendLine, []));
|
|
2672
2789
|
if (!renderExtendLine)
|
|
2673
2790
|
return null;
|
|
2674
2791
|
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-extend`, "data-state": "extend", className: "diff-line diff-line-extend" },
|
|
2675
2792
|
oldLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-old-content p-0", colSpan: 2 },
|
|
2676
|
-
React__namespace.createElement("div", { className: "diff-line-extend-wrapper" },
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2793
|
+
React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) &&
|
|
2794
|
+
(renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
|
|
2795
|
+
diffFile,
|
|
2796
|
+
side: exports.SplitSide.old,
|
|
2797
|
+
lineNumber: oldLine.lineNumber,
|
|
2798
|
+
data: oldLineExtend.data,
|
|
2799
|
+
onUpdate: diffFile.notifyAll,
|
|
2800
|
+
}))))) : (React__namespace.createElement("td", { className: "diff-line-extend-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
2683
2801
|
React__namespace.createElement("span", null, "\u2002"))),
|
|
2684
|
-
newLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content p-0 border-l-[1px] border-l-[
|
|
2685
|
-
React__namespace.createElement("div", { className: "diff-line-extend-wrapper" },
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2802
|
+
newLineExtend ? (React__namespace.createElement("td", { className: "diff-line-extend-new-content p-0 border-l-[1px] border-l-[rgb(222,222,222)]", colSpan: 2 },
|
|
2803
|
+
React__namespace.createElement("div", { className: "diff-line-extend-wrapper" }, (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
|
|
2804
|
+
(renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
|
|
2805
|
+
diffFile,
|
|
2806
|
+
side: exports.SplitSide.new,
|
|
2807
|
+
lineNumber: newLine.lineNumber,
|
|
2808
|
+
data: newLineExtend.data,
|
|
2809
|
+
onUpdate: diffFile.notifyAll,
|
|
2810
|
+
}))))) : (React__namespace.createElement("td", { className: "diff-line-extend-new-placeholder p-0 border-l-[1px] border-l-[rgb(222,222,222)] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
2692
2811
|
React__namespace.createElement("span", null, "\u2002")))));
|
|
2693
2812
|
};
|
|
2694
2813
|
const DiffSplitExtendLine = ({ index, diffFile, lineNumber, }) => {
|
|
2695
2814
|
const { useDiffContext } = useDiffViewContext();
|
|
2696
2815
|
const oldLine = diffFile.getSplitLeftLine(index);
|
|
2697
2816
|
const newLine = diffFile.getSplitRightLine(index);
|
|
2698
|
-
const
|
|
2817
|
+
const { oldLineExtend, newLineExtend } = useDiffContext(React__namespace.useCallback((s) => {
|
|
2818
|
+
var _a, _b, _c, _d;
|
|
2819
|
+
return ({
|
|
2820
|
+
oldLineExtend: (_b = (_a = s.extendData) === null || _a === void 0 ? void 0 : _a.oldFile) === null || _b === void 0 ? void 0 : _b[oldLine === null || oldLine === void 0 ? void 0 : oldLine.lineNumber],
|
|
2821
|
+
newLineExtend: (_d = (_c = s.extendData) === null || _c === void 0 ? void 0 : _c.newFile) === null || _d === void 0 ? void 0 : _d[newLine === null || newLine === void 0 ? void 0 : newLine.lineNumber],
|
|
2822
|
+
});
|
|
2823
|
+
}, [oldLine === null || oldLine === void 0 ? void 0 : oldLine.lineNumber, newLine === null || newLine === void 0 ? void 0 : newLine.lineNumber]));
|
|
2824
|
+
const hasExtend = (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) || (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data);
|
|
2699
2825
|
// if the expand action not enabled, the `isHidden` property will never change
|
|
2700
2826
|
const enableExpand = diffFile.getExpandEnabled();
|
|
2701
2827
|
const currentIsShow = hasExtend && ((!(oldLine === null || oldLine === void 0 ? void 0 : oldLine.isHidden) && !(newLine === null || newLine === void 0 ? void 0 : newLine.isHidden)) || !enableExpand);
|
|
2702
2828
|
if (!currentIsShow)
|
|
2703
2829
|
return null;
|
|
2704
|
-
return React__namespace.createElement(_DiffSplitExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
2830
|
+
return (React__namespace.createElement(_DiffSplitExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineExtend: oldLineExtend, newLineExtend: newLineExtend }));
|
|
2705
2831
|
};
|
|
2706
2832
|
|
|
2707
|
-
const
|
|
2833
|
+
const DiffSplitHunkLineGitHub = ({ index, diffFile, lineNumber, }) => {
|
|
2708
2834
|
var _a;
|
|
2709
2835
|
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2710
2836
|
const expandEnabled = diffFile.getExpandEnabled();
|
|
@@ -2721,7 +2847,7 @@ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2721
2847
|
if (!currentIsShow && !currentIsPureHunk)
|
|
2722
2848
|
return null;
|
|
2723
2849
|
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", className: "diff-line diff-line-hunk" },
|
|
2724
|
-
React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none", style: {
|
|
2850
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative", style: {
|
|
2725
2851
|
backgroundColor: `var(${hunkLineNumberBGName})`,
|
|
2726
2852
|
color: `var(${plainLineNumberColorName})`,
|
|
2727
2853
|
} }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
@@ -2737,6 +2863,66 @@ const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2737
2863
|
color: `var(${hunkContentColorName})`,
|
|
2738
2864
|
} }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text))));
|
|
2739
2865
|
};
|
|
2866
|
+
const DiffSplitHunkLineGitLab = ({ index, diffFile, lineNumber, }) => {
|
|
2867
|
+
var _a, _b;
|
|
2868
|
+
const currentHunk = diffFile.getSplitHunkLine(index);
|
|
2869
|
+
const expandEnabled = diffFile.getExpandEnabled();
|
|
2870
|
+
const couldExpand = expandEnabled && currentHunk && currentHunk.splitInfo;
|
|
2871
|
+
const isExpandAll = currentHunk &&
|
|
2872
|
+
currentHunk.splitInfo &&
|
|
2873
|
+
currentHunk.splitInfo.endHiddenIndex - currentHunk.splitInfo.startHiddenIndex < composeLen;
|
|
2874
|
+
const currentIsShow = currentHunk &&
|
|
2875
|
+
currentHunk.splitInfo &&
|
|
2876
|
+
currentHunk.splitInfo.startHiddenIndex < currentHunk.splitInfo.endHiddenIndex;
|
|
2877
|
+
const currentIsPureHunk = currentHunk && diffFile._getIsPureDiffRender() && !currentHunk.splitInfo;
|
|
2878
|
+
const isFirstLine = currentHunk && currentHunk.index === 0;
|
|
2879
|
+
const isLastLine = currentHunk && currentHunk.isLast;
|
|
2880
|
+
if (!currentIsShow && !currentIsPureHunk)
|
|
2881
|
+
return null;
|
|
2882
|
+
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-hunk`, "data-state": "hunk", className: "diff-line diff-line-hunk" },
|
|
2883
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative", style: {
|
|
2884
|
+
backgroundColor: `var(${hunkLineNumberBGName})`,
|
|
2885
|
+
color: `var(${plainLineNumberColorName})`,
|
|
2886
|
+
} }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2887
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
|
|
2888
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
|
|
2889
|
+
React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2890
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
|
|
2891
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" })),
|
|
2892
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2893
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
|
|
2894
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
|
|
2895
|
+
React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
|
|
2896
|
+
color: `var(${hunkContentColorName})`,
|
|
2897
|
+
} }, ((_a = currentHunk.splitInfo) === null || _a === void 0 ? void 0 : _a.plainText) || currentHunk.text)),
|
|
2898
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-action p-[1px] w-[1%] min-w-[40px] select-none relative border-l-[1px] border-l-[rgb(222,222,222)]", style: {
|
|
2899
|
+
backgroundColor: `var(${hunkLineNumberBGName})`,
|
|
2900
|
+
color: `var(${plainLineNumberColorName})`,
|
|
2901
|
+
} }, couldExpand ? (isFirstLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2902
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))) : isLastLine ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
|
|
2903
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" }))) : isExpandAll ? (React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[6px] cursor-pointer rounded-[2px]", title: "Expand All", "data-title": "Expand All", onClick: () => diffFile.onSplitHunkExpand("all", index) },
|
|
2904
|
+
React__namespace.createElement(ExpandAll, { className: "fill-current" }))) : (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2905
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Down", "data-title": "Expand Down", onClick: () => diffFile.onSplitHunkExpand("down", index) },
|
|
2906
|
+
React__namespace.createElement(ExpandDown, { className: "fill-current" })),
|
|
2907
|
+
React__namespace.createElement("button", { className: "w-full diff-widget-tooltip hover:bg-blue-300 flex justify-center items-center py-[2px] cursor-pointer rounded-[2px]", title: "Expand Up", "data-title": "Expand Up", onClick: () => diffFile.onSplitHunkExpand("up", index) },
|
|
2908
|
+
React__namespace.createElement(ExpandUp, { className: "fill-current" }))))) : (React__namespace.createElement("div", { className: "min-h-[28px]" }, "\u2002"))),
|
|
2909
|
+
React__namespace.createElement("td", { className: "diff-line-hunk-content pr-[10px] align-middle", style: { backgroundColor: `var(${hunkContentBGName})` } },
|
|
2910
|
+
React__namespace.createElement("div", { className: "pl-[1.5em]", style: {
|
|
2911
|
+
color: `var(${hunkContentColorName})`,
|
|
2912
|
+
} }, ((_b = currentHunk.splitInfo) === null || _b === void 0 ? void 0 : _b.plainText) || currentHunk.text))));
|
|
2913
|
+
};
|
|
2914
|
+
const DiffSplitHunkLine = ({ index, diffFile, lineNumber, }) => {
|
|
2915
|
+
const { useDiffContext } = useDiffViewContext();
|
|
2916
|
+
const diffViewMode = useDiffContext(React__namespace.useCallback((s) => s.mode, []));
|
|
2917
|
+
if (diffViewMode === exports.DiffModeEnum.SplitGitHub ||
|
|
2918
|
+
diffViewMode === exports.DiffModeEnum.Split ||
|
|
2919
|
+
diffViewMode === exports.DiffModeEnum.Unified) {
|
|
2920
|
+
return React__namespace.createElement(DiffSplitHunkLineGitHub, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
2921
|
+
}
|
|
2922
|
+
else {
|
|
2923
|
+
return React__namespace.createElement(DiffSplitHunkLineGitLab, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
2924
|
+
}
|
|
2925
|
+
};
|
|
2740
2926
|
|
|
2741
2927
|
const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
|
|
2742
2928
|
var _a, _b;
|
|
@@ -2755,7 +2941,7 @@ const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
|
|
|
2755
2941
|
onAddWidgetClick: s.onAddWidgetClick,
|
|
2756
2942
|
}), []));
|
|
2757
2943
|
const { useWidget } = useDiffWidgetContext();
|
|
2758
|
-
const
|
|
2944
|
+
const setWidget = useWidget.getReadonlyState().setWidget;
|
|
2759
2945
|
const hasOldLine = !!oldLine.lineNumber;
|
|
2760
2946
|
const hasNewLine = !!newLine.lineNumber;
|
|
2761
2947
|
const oldLineContentBG = getContentBG(false, oldLineIsDelete, hasDiff);
|
|
@@ -2765,19 +2951,19 @@ const _DiffSplitLine = ({ index, diffFile, lineNumber }) => {
|
|
|
2765
2951
|
return (React__namespace.createElement("tr", { "data-line": lineNumber, "data-state": hasDiff ? "diff" : "plain", className: "diff-line" },
|
|
2766
2952
|
hasOldLine ? (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2767
2953
|
React__namespace.createElement("td", { className: "diff-line-old-num group relative pl-[10px] pr-[10px] text-right align-top select-none w-[1%] min-w-[40px]", "data-side": exports.SplitSide[exports.SplitSide.old], style: { backgroundColor: oldLineNumberBG, color: `var(${plainLineNumberColorName})` } },
|
|
2768
|
-
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: oldLine.lineNumber, side: exports.SplitSide.old, diffFile: diffFile, onWidgetClick: onAddWidgetClick, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2954
|
+
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: oldLine.lineNumber, side: exports.SplitSide.old, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2769
2955
|
React__namespace.createElement("span", { "data-line-num": oldLine.lineNumber, style: { opacity: hasChange ? undefined : 0.5 } }, oldLine.lineNumber)),
|
|
2770
2956
|
React__namespace.createElement("td", { className: "diff-line-old-content group relative pr-[10px] align-top", "data-side": exports.SplitSide[exports.SplitSide.old], style: { backgroundColor: oldLineContentBG } },
|
|
2771
|
-
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: oldLine.lineNumber, side: exports.SplitSide.old, diffFile: diffFile, onWidgetClick: onAddWidgetClick, className: "absolute right-[100%] translate-x-[50%] z-[1] select-none", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2957
|
+
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: oldLine.lineNumber, side: exports.SplitSide.old, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute right-[100%] translate-x-[50%] z-[1] select-none", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2772
2958
|
React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: oldLine.value, diffLine: oldLine.diff, syntaxLine: oldSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-old-placeholder select-none", "data-side": exports.SplitSide[exports.SplitSide.old], style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
2773
2959
|
React__namespace.createElement("span", null, "\u2002"))),
|
|
2774
2960
|
hasNewLine ? (React__namespace.createElement(React__namespace.Fragment, null,
|
|
2775
|
-
React__namespace.createElement("td", { className: "diff-line-new-num group relative pl-[10px] pr-[10px] text-right align-top select-none w-[1%] min-w-[40px] border-l-[1px] border-l-[
|
|
2776
|
-
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: onAddWidgetClick, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2961
|
+
React__namespace.createElement("td", { className: "diff-line-new-num group relative pl-[10px] pr-[10px] text-right align-top select-none w-[1%] min-w-[40px] border-l-[1px] border-l-[rgb(222,222,222)]", "data-side": exports.SplitSide[exports.SplitSide.new], style: { backgroundColor: newLineNumberBG, color: `var(${plainLineNumberColorName})` } },
|
|
2962
|
+
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute left-[100%] translate-x-[-50%] z-[1]", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2777
2963
|
React__namespace.createElement("span", { "data-line-num": newLine.lineNumber, style: { opacity: hasChange ? undefined : 0.5 } }, newLine.lineNumber)),
|
|
2778
2964
|
React__namespace.createElement("td", { className: "diff-line-new-content group relative pr-[10px] align-top", "data-side": exports.SplitSide[exports.SplitSide.new], style: { backgroundColor: newLineContentBG } },
|
|
2779
|
-
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: onAddWidgetClick, className: "absolute right-[100%] translate-x-[50%] z-[1] select-none", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2780
|
-
React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: newLine.value || "", diffLine: newLine.diff, syntaxLine: newSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-new-placeholder select-none border-l-[1px] border-l-[
|
|
2965
|
+
hasDiff && enableAddWidget && (React__namespace.createElement(DiffSplitAddWidget, { index: index, lineNumber: newLine.lineNumber, side: exports.SplitSide.new, diffFile: diffFile, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, className: "absolute right-[100%] translate-x-[50%] z-[1] select-none", onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber: lineNumber, side: side }) })),
|
|
2966
|
+
React__namespace.createElement(DiffContent, { enableWrap: true, diffFile: diffFile, rawLine: newLine.value || "", diffLine: newLine.diff, syntaxLine: newSyntaxLine, enableHighlight: enableHighlight })))) : (React__namespace.createElement("td", { className: "diff-line-new-placeholder select-none border-l-[1px] border-l-[rgb(222,222,222)]", style: { backgroundColor: `var(${emptyBGName})` }, "data-side": exports.SplitSide[exports.SplitSide.new], colSpan: 2 },
|
|
2781
2967
|
React__namespace.createElement("span", null, "\u2002")))));
|
|
2782
2968
|
};
|
|
2783
2969
|
const DiffSplitLine = ({ index, diffFile, lineNumber, }) => {
|
|
@@ -2788,15 +2974,13 @@ const DiffSplitLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2788
2974
|
return React__namespace.createElement(_DiffSplitLine, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
2789
2975
|
};
|
|
2790
2976
|
|
|
2791
|
-
const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
|
|
2977
|
+
const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, oldLineWidget, newLineWidget, }) => {
|
|
2792
2978
|
const { useWidget } = useDiffWidgetContext();
|
|
2793
|
-
const
|
|
2979
|
+
const setWidget = useWidget.getReadonlyState().setWidget;
|
|
2794
2980
|
const { useDiffContext } = useDiffViewContext();
|
|
2795
2981
|
const renderWidgetLine = useDiffContext(React__namespace.useCallback((s) => s.renderWidgetLine, []));
|
|
2796
2982
|
const oldLine = diffFile.getSplitLeftLine(index);
|
|
2797
2983
|
const newLine = diffFile.getSplitRightLine(index);
|
|
2798
|
-
const oldLineWidget = oldLine.lineNumber && widgetSide === exports.SplitSide.old && widgetLineNumber === oldLine.lineNumber;
|
|
2799
|
-
const newLineWidget = newLine.lineNumber && widgetSide === exports.SplitSide.new && widgetLineNumber === newLine.lineNumber;
|
|
2800
2984
|
if (!renderWidgetLine)
|
|
2801
2985
|
return null;
|
|
2802
2986
|
return (React__namespace.createElement("tr", { "data-line": `${lineNumber}-widget`, "data-state": "widget", className: "diff-line diff-line-widget" },
|
|
@@ -2808,13 +2992,13 @@ const _DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2808
2992
|
onClose: () => setWidget({}),
|
|
2809
2993
|
})))) : (React__namespace.createElement("td", { className: "diff-line-widget-old-placeholder p-0 select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
2810
2994
|
React__namespace.createElement("span", null, "\u2002"))),
|
|
2811
|
-
newLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content p-0 border-l-[1px] border-l-[
|
|
2995
|
+
newLineWidget ? (React__namespace.createElement("td", { className: "diff-line-widget-new-content p-0 border-l-[1px] border-l-[rgb(222,222,222)]", colSpan: 2 },
|
|
2812
2996
|
React__namespace.createElement("div", { className: "diff-line-widget-wrapper" }, renderWidgetLine === null || renderWidgetLine === void 0 ? void 0 : renderWidgetLine({
|
|
2813
2997
|
diffFile,
|
|
2814
2998
|
side: exports.SplitSide.new,
|
|
2815
2999
|
lineNumber: newLine.lineNumber,
|
|
2816
3000
|
onClose: () => setWidget({}),
|
|
2817
|
-
})))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder p-0 border-l-[1px] border-l-[
|
|
3001
|
+
})))) : (React__namespace.createElement("td", { className: "diff-line-widget-new-placeholder p-0 border-l-[1px] border-l-[rgb(222,222,222)] select-none", style: { backgroundColor: `var(${emptyBGName})` }, colSpan: 2 },
|
|
2818
3002
|
React__namespace.createElement("span", null, "\u2002")))));
|
|
2819
3003
|
};
|
|
2820
3004
|
const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
|
|
@@ -2827,12 +3011,12 @@ const DiffSplitWidgetLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2827
3011
|
const currentIsShow = oldLineWidget || newLineWidget;
|
|
2828
3012
|
if (!currentIsShow)
|
|
2829
3013
|
return null;
|
|
2830
|
-
return React__namespace.createElement(_DiffSplitWidgetLine, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
3014
|
+
return (React__namespace.createElement(_DiffSplitWidgetLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineWidget: oldLineWidget, newLineWidget: newLineWidget }));
|
|
2831
3015
|
};
|
|
2832
3016
|
|
|
2833
3017
|
const Style = ({ useSelector, id, }) => {
|
|
2834
3018
|
const splitRef = useSelector((s) => s.splitRef);
|
|
2835
|
-
return (React__namespace.createElement("style",
|
|
3019
|
+
return (React__namespace.createElement("style", { "data-select-style": true }, splitRef === exports.SplitSide.old
|
|
2836
3020
|
? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.new]}"] {user-select: none}`
|
|
2837
3021
|
: splitRef === exports.SplitSide.new
|
|
2838
3022
|
? `#${id} td[data-side="${exports.SplitSide[exports.SplitSide.old]}"] {user-select: none}`
|
|
@@ -2871,9 +3055,10 @@ const DiffSplitViewWrap = React.memo(({ diffFile }) => {
|
|
|
2871
3055
|
}
|
|
2872
3056
|
}
|
|
2873
3057
|
}, [setSelectSide]);
|
|
3058
|
+
const font = React.useMemo(() => ({ fontSize: fontSize + "px", fontFamily: "Menlo, Consolas, monospace" }), [fontSize]);
|
|
2874
3059
|
const _width = useTextWidth({
|
|
2875
3060
|
text: splitLineLength.toString(),
|
|
2876
|
-
font
|
|
3061
|
+
font,
|
|
2877
3062
|
});
|
|
2878
3063
|
const width = Math.max(40, _width + 25);
|
|
2879
3064
|
const lines = getSplitContentLines(diffFile);
|
|
@@ -2922,7 +3107,6 @@ const DiffSplitView = React.memo(({ diffFile }) => {
|
|
|
2922
3107
|
return { widgetSide, widgetLineNumber, setWidget };
|
|
2923
3108
|
}), [useDiffContext]);
|
|
2924
3109
|
const contextValue = React.useMemo(() => ({ useWidget }), [useWidget]);
|
|
2925
|
-
shim.useSyncExternalStore(diffFile.subscribe, diffFile.getUpdateCount);
|
|
2926
3110
|
React.useEffect(() => {
|
|
2927
3111
|
const { setWidget } = useWidget.getReadonlyState();
|
|
2928
3112
|
setWidget({});
|
|
@@ -2931,12 +3115,10 @@ const DiffSplitView = React.memo(({ diffFile }) => {
|
|
|
2931
3115
|
});
|
|
2932
3116
|
DiffSplitView.displayName = "DiffSplitView";
|
|
2933
3117
|
|
|
2934
|
-
const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, }) => {
|
|
3118
|
+
const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, oldLineExtend, newLineExtend, }) => {
|
|
2935
3119
|
const { useDiffContext } = useDiffViewContext();
|
|
2936
3120
|
const renderExtendLine = useDiffContext(React.useCallback((s) => s.renderExtendLine, []));
|
|
2937
3121
|
const unifiedItem = diffFile.getUnifiedLine(index);
|
|
2938
|
-
const oldExtend = useDiffContext(React.useCallback((s) => { var _a, _b; return (_b = (_a = s.extendData) === null || _a === void 0 ? void 0 : _a.oldFile) === null || _b === void 0 ? void 0 : _b[unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.oldLineNumber]; }, [unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.oldLineNumber]));
|
|
2939
|
-
const newExtend = useDiffContext(React.useCallback((s) => { var _a, _b; return (_b = (_a = s.extendData) === null || _a === void 0 ? void 0 : _a.newFile) === null || _b === void 0 ? void 0 : _b[unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.newLineNumber]; }, [unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.newLineNumber]));
|
|
2940
3122
|
const width = useDomWidth({
|
|
2941
3123
|
selector: ".unified-diff-table-wrapper",
|
|
2942
3124
|
enable: typeof renderExtendLine === "function",
|
|
@@ -2947,31 +3129,38 @@ const _DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, }) => {
|
|
|
2947
3129
|
React__namespace.createElement("td", { className: "diff-line-extend-content align-top p-0", colSpan: 2 },
|
|
2948
3130
|
React__namespace.createElement("div", { className: "diff-line-extend-wrapper sticky left-0", style: { width } },
|
|
2949
3131
|
width > 0 &&
|
|
2950
|
-
|
|
3132
|
+
(oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) &&
|
|
2951
3133
|
(renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
|
|
2952
3134
|
diffFile,
|
|
2953
3135
|
side: exports.SplitSide.old,
|
|
2954
3136
|
lineNumber: unifiedItem.oldLineNumber,
|
|
2955
|
-
data:
|
|
3137
|
+
data: oldLineExtend.data,
|
|
2956
3138
|
onUpdate: diffFile.notifyAll,
|
|
2957
3139
|
})),
|
|
2958
3140
|
width > 0 &&
|
|
2959
|
-
|
|
3141
|
+
(newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data) &&
|
|
2960
3142
|
(renderExtendLine === null || renderExtendLine === void 0 ? void 0 : renderExtendLine({
|
|
2961
3143
|
diffFile,
|
|
2962
3144
|
side: exports.SplitSide.new,
|
|
2963
3145
|
lineNumber: unifiedItem.newLineNumber,
|
|
2964
|
-
data:
|
|
3146
|
+
data: newLineExtend.data,
|
|
2965
3147
|
onUpdate: diffFile.notifyAll,
|
|
2966
3148
|
}))))));
|
|
2967
3149
|
};
|
|
2968
3150
|
const DiffUnifiedExtendLine = ({ index, diffFile, lineNumber, }) => {
|
|
2969
3151
|
const { useDiffContext } = useDiffViewContext();
|
|
2970
3152
|
const unifiedItem = diffFile.getUnifiedLine(index);
|
|
2971
|
-
const
|
|
3153
|
+
const { oldLineExtend, newLineExtend } = useDiffContext(React.useCallback((s) => {
|
|
3154
|
+
var _a, _b, _c, _d;
|
|
3155
|
+
return ({
|
|
3156
|
+
oldLineExtend: (_b = (_a = s.extendData) === null || _a === void 0 ? void 0 : _a.oldFile) === null || _b === void 0 ? void 0 : _b[unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.oldLineNumber],
|
|
3157
|
+
newLineExtend: (_d = (_c = s.extendData) === null || _c === void 0 ? void 0 : _c.newFile) === null || _d === void 0 ? void 0 : _d[unifiedItem === null || unifiedItem === void 0 ? void 0 : unifiedItem.newLineNumber],
|
|
3158
|
+
});
|
|
3159
|
+
}, [unifiedItem.oldLineNumber, unifiedItem.newLineNumber]));
|
|
3160
|
+
const hasExtend = (oldLineExtend === null || oldLineExtend === void 0 ? void 0 : oldLineExtend.data) || (newLineExtend === null || newLineExtend === void 0 ? void 0 : newLineExtend.data);
|
|
2972
3161
|
if (!hasExtend || !unifiedItem || unifiedItem.isHidden || !unifiedItem.diff)
|
|
2973
3162
|
return null;
|
|
2974
|
-
return React__namespace.createElement(_DiffUnifiedExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber });
|
|
3163
|
+
return (React__namespace.createElement(_DiffUnifiedExtendLine, { index: index, diffFile: diffFile, lineNumber: lineNumber, oldLineExtend: oldLineExtend, newLineExtend: newLineExtend }));
|
|
2975
3164
|
};
|
|
2976
3165
|
|
|
2977
3166
|
const _DiffUnifiedHunkLine = ({ index, diffFile, lineNumber, }) => {
|
|
@@ -3063,7 +3252,7 @@ const _DiffUnifiedLine = React.memo(({ index, diffFile, lineNumber }) => {
|
|
|
3063
3252
|
onAddWidgetClick: s.onAddWidgetClick,
|
|
3064
3253
|
}), []));
|
|
3065
3254
|
const { useWidget } = useDiffWidgetContext();
|
|
3066
|
-
const
|
|
3255
|
+
const setWidget = useWidget.getReadonlyState().setWidget;
|
|
3067
3256
|
const hasDiff = unifiedLine.diff;
|
|
3068
3257
|
const hasChange = checkDiffLineIncludeChange(unifiedLine.diff);
|
|
3069
3258
|
const rawLine = unifiedLine.value || "";
|
|
@@ -3077,10 +3266,10 @@ const _DiffUnifiedLine = React.memo(({ index, diffFile, lineNumber }) => {
|
|
|
3077
3266
|
: undefined;
|
|
3078
3267
|
if (hasChange) {
|
|
3079
3268
|
if (unifiedLine.oldLineNumber) {
|
|
3080
|
-
return (React__namespace.createElement(DiffUnifiedOldLine, { index: lineNumber, enableWrap: enableWrap, diffFile: diffFile, rawLine: rawLine, diffLine: diffLine, setWidget: setWidget, syntaxLine: syntaxLine, enableHighlight: enableHighlight, enableAddWidget: enableAddWidget, onAddWidgetClick: onAddWidgetClick
|
|
3269
|
+
return (React__namespace.createElement(DiffUnifiedOldLine, { index: lineNumber, enableWrap: enableWrap, diffFile: diffFile, rawLine: rawLine, diffLine: diffLine, setWidget: setWidget, syntaxLine: syntaxLine, enableHighlight: enableHighlight, enableAddWidget: enableAddWidget, lineNumber: unifiedLine.oldLineNumber, onAddWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); } }));
|
|
3081
3270
|
}
|
|
3082
3271
|
else {
|
|
3083
|
-
return (React__namespace.createElement(DiffUnifiedNewLine, { index: lineNumber, enableWrap: enableWrap, rawLine: rawLine, diffLine: diffLine, diffFile: diffFile, setWidget: setWidget, syntaxLine: syntaxLine, enableHighlight: enableHighlight, enableAddWidget: enableAddWidget, onAddWidgetClick: onAddWidgetClick
|
|
3272
|
+
return (React__namespace.createElement(DiffUnifiedNewLine, { index: lineNumber, enableWrap: enableWrap, rawLine: rawLine, diffLine: diffLine, diffFile: diffFile, setWidget: setWidget, syntaxLine: syntaxLine, enableHighlight: enableHighlight, enableAddWidget: enableAddWidget, lineNumber: unifiedLine.newLineNumber, onAddWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); } }));
|
|
3084
3273
|
}
|
|
3085
3274
|
}
|
|
3086
3275
|
else {
|
|
@@ -3092,7 +3281,7 @@ const _DiffUnifiedLine = React.memo(({ index, diffFile, lineNumber }) => {
|
|
|
3092
3281
|
minWidth: `calc(calc(var(${asideWidth}) + 5px) * 2)`,
|
|
3093
3282
|
backgroundColor: hasDiff ? `var(${plainLineNumberBGName})` : `var(${expandContentBGName})`,
|
|
3094
3283
|
} },
|
|
3095
|
-
enableAddWidget && hasDiff && (React__namespace.createElement(DiffUnifiedAddWidget, { index: index, diffFile: diffFile, lineNumber: unifiedLine.newLineNumber, side: exports.SplitSide.new, onWidgetClick: onAddWidgetClick, onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber, side }) })),
|
|
3284
|
+
enableAddWidget && hasDiff && (React__namespace.createElement(DiffUnifiedAddWidget, { index: index, diffFile: diffFile, lineNumber: unifiedLine.newLineNumber, side: exports.SplitSide.new, onWidgetClick: (...props) => { var _a; return (_a = onAddWidgetClick.current) === null || _a === void 0 ? void 0 : _a.call(onAddWidgetClick, ...props); }, onOpenAddWidget: (lineNumber, side) => setWidget({ lineNumber, side }) })),
|
|
3096
3285
|
React__namespace.createElement("div", { className: "flex opacity-[0.5]" },
|
|
3097
3286
|
React__namespace.createElement("span", { "data-line-old-num": unifiedLine.oldLineNumber, className: "inline-block w-[50%]" }, unifiedLine.oldLineNumber),
|
|
3098
3287
|
React__namespace.createElement("span", { className: "w-[10px] shrink-0" }),
|
|
@@ -3185,7 +3374,7 @@ const DiffUnifiedView = React.memo(({ diffFile }) => {
|
|
|
3185
3374
|
const lines = getUnifiedContentLine(diffFile);
|
|
3186
3375
|
return (React__namespace.createElement(DiffWidgetContext.Provider, { value: contextValue },
|
|
3187
3376
|
React__namespace.createElement("div", { className: "unified-diff-view w-full" },
|
|
3188
|
-
React__namespace.createElement("div", { className: "unified-diff-table-wrapper overflow-auto w-full scrollbar-hide scrollbar-disable", style: {
|
|
3377
|
+
React__namespace.createElement("div", { className: "unified-diff-table-wrapper overflow-x-auto overflow-y-hidden w-full scrollbar-hide scrollbar-disable", style: {
|
|
3189
3378
|
// @ts-ignore
|
|
3190
3379
|
[asideWidth]: `${Math.round(width)}px`,
|
|
3191
3380
|
fontFamily: "Menlo, Consolas, monospace",
|
|
@@ -3264,8 +3453,9 @@ const _InternalDiffView = (props) => {
|
|
|
3264
3453
|
const setRenderWidgetLine = (_renderWidgetLine) => (renderWidgetLine.value = _renderWidgetLine);
|
|
3265
3454
|
const renderExtendLine = reactivityStore.ref(props.renderExtendLine);
|
|
3266
3455
|
const setRenderExtendLine = (_renderExtendLine) => (renderExtendLine.value = _renderExtendLine);
|
|
3267
|
-
|
|
3268
|
-
const
|
|
3456
|
+
// 避免无意义的订阅
|
|
3457
|
+
const onAddWidgetClick = reactivityStore.ref(reactivityStore.markRaw({ current: props.onAddWidgetClick }));
|
|
3458
|
+
const setOnAddWidgetClick = (_onAddWidgetClick) => (onAddWidgetClick.value.current = _onAddWidgetClick.current);
|
|
3269
3459
|
return {
|
|
3270
3460
|
id,
|
|
3271
3461
|
setId,
|
|
@@ -3300,7 +3490,7 @@ const _InternalDiffView = (props) => {
|
|
|
3300
3490
|
diffViewWrap !== enableWrap && setEnableWrap(diffViewWrap);
|
|
3301
3491
|
extendData && setExtendData(extendData);
|
|
3302
3492
|
diffViewFontSize && diffViewFontSize !== fontSize && setFontSize(diffViewFontSize);
|
|
3303
|
-
onAddWidgetClick !== _onAddWidgetClick && setOnAddWidgetClick(onAddWidgetClick);
|
|
3493
|
+
onAddWidgetClick !== _onAddWidgetClick.current && setOnAddWidgetClick({ current: onAddWidgetClick });
|
|
3304
3494
|
renderExtendLine !== _renderExtendLine && setRenderExtendLine(renderExtendLine);
|
|
3305
3495
|
renderWidgetLine !== _renderWidgetLine && setRenderWidgetLine(renderWidgetLine);
|
|
3306
3496
|
}, [
|
|
@@ -3318,16 +3508,16 @@ const _InternalDiffView = (props) => {
|
|
|
3318
3508
|
]);
|
|
3319
3509
|
const value = React.useMemo(() => ({ useDiffContext }), [useDiffContext]);
|
|
3320
3510
|
return (React__namespace.createElement(DiffViewContext.Provider, { value: value },
|
|
3321
|
-
React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.
|
|
3511
|
+
React__namespace.createElement("div", { className: "diff-tailwindcss-wrapper", "data-component": "git-diff-view", "data-version": `${"0.0.10"}`, "data-highlighter": diffFile._getHighlighterName() },
|
|
3322
3512
|
React__namespace.createElement("div", { className: "diff-style-root", style: {
|
|
3323
3513
|
// @ts-ignore
|
|
3324
3514
|
[diffFontSizeName]: diffViewFontSize + "px",
|
|
3325
3515
|
} },
|
|
3326
|
-
React__namespace.createElement("div", { id: `diff-root${diffFileId}`, className: "diff-view-wrapper" + (className ? ` ${className}` : ""), style: style }, diffViewMode
|
|
3516
|
+
React__namespace.createElement("div", { id: `diff-root${diffFileId}`, className: "diff-view-wrapper" + (className ? ` ${className}` : ""), style: style }, diffViewMode & exports.DiffModeEnum.Split ? (React__namespace.createElement(DiffSplitView, { diffFile: diffFile })) : (React__namespace.createElement(DiffUnifiedView, { diffFile: diffFile })))))));
|
|
3327
3517
|
};
|
|
3328
3518
|
const InternalDiffView = React.memo(_InternalDiffView);
|
|
3329
3519
|
const DiffViewWithRef = (props, ref) => {
|
|
3330
|
-
const { registerHighlighter,
|
|
3520
|
+
const { registerHighlighter, data, diffFile: _diffFile } = props, restProps = __rest(props, ["registerHighlighter", "data", "diffFile"]);
|
|
3331
3521
|
const diffFile = React.useMemo(() => {
|
|
3332
3522
|
var _a, _b, _c, _d, _e, _f;
|
|
3333
3523
|
if (_diffFile) {
|
|
@@ -3351,10 +3541,10 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
3351
3541
|
if (!diffFile)
|
|
3352
3542
|
return;
|
|
3353
3543
|
if (props.diffViewHighlight) {
|
|
3354
|
-
diffFile.initSyntax({
|
|
3544
|
+
diffFile.initSyntax({ registerHighlighter });
|
|
3355
3545
|
diffFile.notifyAll();
|
|
3356
3546
|
}
|
|
3357
|
-
}, [diffFile, props.diffViewHighlight,
|
|
3547
|
+
}, [diffFile, props.diffViewHighlight, registerHighlighter]);
|
|
3358
3548
|
React.useEffect(() => {
|
|
3359
3549
|
if (_diffFile && diffFile) {
|
|
3360
3550
|
_diffFile._addClonedInstance(diffFile);
|
|
@@ -3367,11 +3557,11 @@ const DiffViewWithRef = (props, ref) => {
|
|
|
3367
3557
|
React.useImperativeHandle(ref, () => ({ getDiffFileInstance: () => diffFile }), [diffFile]);
|
|
3368
3558
|
if (!diffFile)
|
|
3369
3559
|
return null;
|
|
3370
|
-
return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewFontSize: restProps.diffViewFontSize || 14 })));
|
|
3560
|
+
return (React__namespace.createElement(InternalDiffView, Object.assign({ key: diffFile.getId() }, restProps, { diffFile: diffFile, diffViewMode: restProps.diffViewMode || exports.DiffModeEnum.SplitGitHub, diffViewFontSize: restProps.diffViewFontSize || 14 })));
|
|
3371
3561
|
};
|
|
3372
3562
|
const DiffView = React.forwardRef(DiffViewWithRef);
|
|
3373
3563
|
DiffView.displayName = "DiffView";
|
|
3374
|
-
const version = "0.0.
|
|
3564
|
+
const version = "0.0.10";
|
|
3375
3565
|
|
|
3376
3566
|
exports.DefaultDiffExpansionStep = DefaultDiffExpansionStep;
|
|
3377
3567
|
exports.DiffFile = DiffFile;
|
|
@@ -3395,6 +3585,7 @@ exports.getUnifiedLines = getUnifiedLines;
|
|
|
3395
3585
|
exports.hasRelativeChange = hasRelativeChange;
|
|
3396
3586
|
exports.highlighter = highlighter;
|
|
3397
3587
|
exports.numIterator = numIterator;
|
|
3588
|
+
exports.processAST = processAST;
|
|
3398
3589
|
exports.relativeChanges = relativeChanges;
|
|
3399
3590
|
exports.useDiffViewContext = useDiffViewContext;
|
|
3400
3591
|
exports.version = version;
|