@cnc_cbz/usefultools-plugin-official 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/base-converter.mjs +333 -0
- package/dist/case-converter.mjs +142 -0
- package/dist/chmod-calculator.mjs +286 -0
- package/dist/color-converter.mjs +211 -0
- package/dist/cron-expression.mjs +487 -0
- package/dist/cyber-chef.mjs +24885 -0
- package/dist/hash-generator.mjs +239 -0
- package/dist/html-entity.mjs +187 -0
- package/dist/image-compressor.mjs +337 -0
- package/dist/ip-subnet.mjs +222 -0
- package/dist/js-runner.mjs +39973 -0
- package/dist/json-diff.mjs +704 -0
- package/dist/json-formatter.mjs +1138 -0
- package/dist/json-yaml.mjs +256 -0
- package/dist/jwt-parser.mjs +405 -0
- package/dist/lorem-ipsum.mjs +246 -0
- package/dist/markdown-preview.mjs +184 -0
- package/dist/password-generator.mjs +254 -0
- package/dist/qr-generator.mjs +238 -0
- package/dist/regex-tester.mjs +424 -0
- package/dist/sql-formatter.mjs +242 -0
- package/dist/text-diff.mjs +940 -0
- package/dist/text-stats.mjs +205 -0
- package/dist/timestamp-converter.mjs +339 -0
- package/dist/translator.mjs +667 -0
- package/dist/url-codec.mjs +179 -0
- package/dist/uuid-generator.mjs +165 -0
- package/package.json +56 -0
- package/plugin.json +31 -0
|
@@ -0,0 +1,940 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createElementBlock, createCommentVNode, createElementVNode, createTextVNode, toDisplayString, normalizeClass, withDirectives, vModelText, Fragment, renderList } from "vue";
|
|
2
|
+
class Diff {
|
|
3
|
+
diff(oldStr, newStr, options = {}) {
|
|
4
|
+
let callback;
|
|
5
|
+
if (typeof options === "function") {
|
|
6
|
+
callback = options;
|
|
7
|
+
options = {};
|
|
8
|
+
} else if ("callback" in options) {
|
|
9
|
+
callback = options.callback;
|
|
10
|
+
}
|
|
11
|
+
const oldString = this.castInput(oldStr, options);
|
|
12
|
+
const newString = this.castInput(newStr, options);
|
|
13
|
+
const oldTokens = this.removeEmpty(this.tokenize(oldString, options));
|
|
14
|
+
const newTokens = this.removeEmpty(this.tokenize(newString, options));
|
|
15
|
+
return this.diffWithOptionsObj(oldTokens, newTokens, options, callback);
|
|
16
|
+
}
|
|
17
|
+
diffWithOptionsObj(oldTokens, newTokens, options, callback) {
|
|
18
|
+
var _a;
|
|
19
|
+
const done = (value) => {
|
|
20
|
+
value = this.postProcess(value, options);
|
|
21
|
+
if (callback) {
|
|
22
|
+
setTimeout(function() {
|
|
23
|
+
callback(value);
|
|
24
|
+
}, 0);
|
|
25
|
+
return void 0;
|
|
26
|
+
} else {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
31
|
+
let editLength = 1;
|
|
32
|
+
let maxEditLength = newLen + oldLen;
|
|
33
|
+
if (options.maxEditLength != null) {
|
|
34
|
+
maxEditLength = Math.min(maxEditLength, options.maxEditLength);
|
|
35
|
+
}
|
|
36
|
+
const maxExecutionTime = (_a = options.timeout) !== null && _a !== void 0 ? _a : Infinity;
|
|
37
|
+
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
38
|
+
const bestPath = [{ oldPos: -1, lastComponent: void 0 }];
|
|
39
|
+
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options);
|
|
40
|
+
if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
41
|
+
return done(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
|
|
42
|
+
}
|
|
43
|
+
let minDiagonalToConsider = -Infinity, maxDiagonalToConsider = Infinity;
|
|
44
|
+
const execEditLength = () => {
|
|
45
|
+
for (let diagonalPath = Math.max(minDiagonalToConsider, -editLength); diagonalPath <= Math.min(maxDiagonalToConsider, editLength); diagonalPath += 2) {
|
|
46
|
+
let basePath;
|
|
47
|
+
const removePath = bestPath[diagonalPath - 1], addPath = bestPath[diagonalPath + 1];
|
|
48
|
+
if (removePath) {
|
|
49
|
+
bestPath[diagonalPath - 1] = void 0;
|
|
50
|
+
}
|
|
51
|
+
let canAdd = false;
|
|
52
|
+
if (addPath) {
|
|
53
|
+
const addPathNewPos = addPath.oldPos - diagonalPath;
|
|
54
|
+
canAdd = addPath && 0 <= addPathNewPos && addPathNewPos < newLen;
|
|
55
|
+
}
|
|
56
|
+
const canRemove = removePath && removePath.oldPos + 1 < oldLen;
|
|
57
|
+
if (!canAdd && !canRemove) {
|
|
58
|
+
bestPath[diagonalPath] = void 0;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
|
|
62
|
+
basePath = this.addToPath(addPath, true, false, 0, options);
|
|
63
|
+
} else {
|
|
64
|
+
basePath = this.addToPath(removePath, false, true, 1, options);
|
|
65
|
+
}
|
|
66
|
+
newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options);
|
|
67
|
+
if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
|
|
68
|
+
return done(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
|
|
69
|
+
} else {
|
|
70
|
+
bestPath[diagonalPath] = basePath;
|
|
71
|
+
if (basePath.oldPos + 1 >= oldLen) {
|
|
72
|
+
maxDiagonalToConsider = Math.min(maxDiagonalToConsider, diagonalPath - 1);
|
|
73
|
+
}
|
|
74
|
+
if (newPos + 1 >= newLen) {
|
|
75
|
+
minDiagonalToConsider = Math.max(minDiagonalToConsider, diagonalPath + 1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
editLength++;
|
|
80
|
+
};
|
|
81
|
+
if (callback) {
|
|
82
|
+
(function exec() {
|
|
83
|
+
setTimeout(function() {
|
|
84
|
+
if (editLength > maxEditLength || Date.now() > abortAfterTimestamp) {
|
|
85
|
+
return callback(void 0);
|
|
86
|
+
}
|
|
87
|
+
if (!execEditLength()) {
|
|
88
|
+
exec();
|
|
89
|
+
}
|
|
90
|
+
}, 0);
|
|
91
|
+
})();
|
|
92
|
+
} else {
|
|
93
|
+
while (editLength <= maxEditLength && Date.now() <= abortAfterTimestamp) {
|
|
94
|
+
const ret = execEditLength();
|
|
95
|
+
if (ret) {
|
|
96
|
+
return ret;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
addToPath(path, added, removed, oldPosInc, options) {
|
|
102
|
+
const last = path.lastComponent;
|
|
103
|
+
if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
104
|
+
return {
|
|
105
|
+
oldPos: path.oldPos + oldPosInc,
|
|
106
|
+
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
return {
|
|
110
|
+
oldPos: path.oldPos + oldPosInc,
|
|
111
|
+
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
extractCommon(basePath, newTokens, oldTokens, diagonalPath, options) {
|
|
116
|
+
const newLen = newTokens.length, oldLen = oldTokens.length;
|
|
117
|
+
let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
|
|
118
|
+
while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options)) {
|
|
119
|
+
newPos++;
|
|
120
|
+
oldPos++;
|
|
121
|
+
commonCount++;
|
|
122
|
+
if (options.oneChangePerToken) {
|
|
123
|
+
basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
if (commonCount && !options.oneChangePerToken) {
|
|
127
|
+
basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
|
|
128
|
+
}
|
|
129
|
+
basePath.oldPos = oldPos;
|
|
130
|
+
return newPos;
|
|
131
|
+
}
|
|
132
|
+
equals(left, right, options) {
|
|
133
|
+
if (options.comparator) {
|
|
134
|
+
return options.comparator(left, right);
|
|
135
|
+
} else {
|
|
136
|
+
return left === right || !!options.ignoreCase && left.toLowerCase() === right.toLowerCase();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
removeEmpty(array) {
|
|
140
|
+
const ret = [];
|
|
141
|
+
for (let i = 0; i < array.length; i++) {
|
|
142
|
+
if (array[i]) {
|
|
143
|
+
ret.push(array[i]);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return ret;
|
|
147
|
+
}
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
149
|
+
castInput(value, options) {
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153
|
+
tokenize(value, options) {
|
|
154
|
+
return Array.from(value);
|
|
155
|
+
}
|
|
156
|
+
join(chars) {
|
|
157
|
+
return chars.join("");
|
|
158
|
+
}
|
|
159
|
+
postProcess(changeObjects, options) {
|
|
160
|
+
return changeObjects;
|
|
161
|
+
}
|
|
162
|
+
get useLongestToken() {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
buildValues(lastComponent, newTokens, oldTokens) {
|
|
166
|
+
const components = [];
|
|
167
|
+
let nextComponent;
|
|
168
|
+
while (lastComponent) {
|
|
169
|
+
components.push(lastComponent);
|
|
170
|
+
nextComponent = lastComponent.previousComponent;
|
|
171
|
+
delete lastComponent.previousComponent;
|
|
172
|
+
lastComponent = nextComponent;
|
|
173
|
+
}
|
|
174
|
+
components.reverse();
|
|
175
|
+
const componentLen = components.length;
|
|
176
|
+
let componentPos = 0, newPos = 0, oldPos = 0;
|
|
177
|
+
for (; componentPos < componentLen; componentPos++) {
|
|
178
|
+
const component = components[componentPos];
|
|
179
|
+
if (!component.removed) {
|
|
180
|
+
if (!component.added && this.useLongestToken) {
|
|
181
|
+
let value = newTokens.slice(newPos, newPos + component.count);
|
|
182
|
+
value = value.map(function(value2, i) {
|
|
183
|
+
const oldValue = oldTokens[oldPos + i];
|
|
184
|
+
return oldValue.length > value2.length ? oldValue : value2;
|
|
185
|
+
});
|
|
186
|
+
component.value = this.join(value);
|
|
187
|
+
} else {
|
|
188
|
+
component.value = this.join(newTokens.slice(newPos, newPos + component.count));
|
|
189
|
+
}
|
|
190
|
+
newPos += component.count;
|
|
191
|
+
if (!component.added) {
|
|
192
|
+
oldPos += component.count;
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
component.value = this.join(oldTokens.slice(oldPos, oldPos + component.count));
|
|
196
|
+
oldPos += component.count;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return components;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
class LineDiff extends Diff {
|
|
203
|
+
constructor() {
|
|
204
|
+
super(...arguments);
|
|
205
|
+
this.tokenize = tokenize;
|
|
206
|
+
}
|
|
207
|
+
equals(left, right, options) {
|
|
208
|
+
if (options.ignoreWhitespace) {
|
|
209
|
+
if (!options.newlineIsToken || !left.includes("\n")) {
|
|
210
|
+
left = left.trim();
|
|
211
|
+
}
|
|
212
|
+
if (!options.newlineIsToken || !right.includes("\n")) {
|
|
213
|
+
right = right.trim();
|
|
214
|
+
}
|
|
215
|
+
} else if (options.ignoreNewlineAtEof && !options.newlineIsToken) {
|
|
216
|
+
if (left.endsWith("\n")) {
|
|
217
|
+
left = left.slice(0, -1);
|
|
218
|
+
}
|
|
219
|
+
if (right.endsWith("\n")) {
|
|
220
|
+
right = right.slice(0, -1);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return super.equals(left, right, options);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const lineDiff = new LineDiff();
|
|
227
|
+
function diffLines(oldStr, newStr, options) {
|
|
228
|
+
return lineDiff.diff(oldStr, newStr, options);
|
|
229
|
+
}
|
|
230
|
+
function tokenize(value, options) {
|
|
231
|
+
if (options.stripTrailingCr) {
|
|
232
|
+
value = value.replace(/\r\n/g, "\n");
|
|
233
|
+
}
|
|
234
|
+
const retLines = [], linesAndNewlines = value.split(/(\n|\r\n)/);
|
|
235
|
+
if (!linesAndNewlines[linesAndNewlines.length - 1]) {
|
|
236
|
+
linesAndNewlines.pop();
|
|
237
|
+
}
|
|
238
|
+
for (let i = 0; i < linesAndNewlines.length; i++) {
|
|
239
|
+
const line = linesAndNewlines[i];
|
|
240
|
+
if (i % 2 && !options.newlineIsToken) {
|
|
241
|
+
retLines[retLines.length - 1] += line;
|
|
242
|
+
} else {
|
|
243
|
+
retLines.push(line);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return retLines;
|
|
247
|
+
}
|
|
248
|
+
const _hoisted_1 = { class: "flex flex-col h-full gap-3" };
|
|
249
|
+
const _hoisted_2 = { class: "flex flex-wrap items-center gap-3" };
|
|
250
|
+
const _hoisted_3 = { class: "ml-auto flex items-center gap-3" };
|
|
251
|
+
const _hoisted_4 = {
|
|
252
|
+
key: 0,
|
|
253
|
+
class: "flex items-center gap-3 text-sm font-bold"
|
|
254
|
+
};
|
|
255
|
+
const _hoisted_5 = { class: "text-neon-green" };
|
|
256
|
+
const _hoisted_6 = { class: "text-coral-red" };
|
|
257
|
+
const _hoisted_7 = {
|
|
258
|
+
key: 1,
|
|
259
|
+
class: "flex border-2 border-white/20 rounded overflow-hidden"
|
|
260
|
+
};
|
|
261
|
+
const _hoisted_8 = {
|
|
262
|
+
key: 0,
|
|
263
|
+
class: "flex-1 grid grid-cols-2 gap-3 min-h-0"
|
|
264
|
+
};
|
|
265
|
+
const _hoisted_9 = { class: "flex flex-col min-h-0" };
|
|
266
|
+
const _hoisted_10 = { class: "flex items-center gap-2 mb-1.5" };
|
|
267
|
+
const _hoisted_11 = { class: "flex flex-col min-h-0" };
|
|
268
|
+
const _hoisted_12 = { class: "flex items-center gap-2 mb-1.5" };
|
|
269
|
+
const _hoisted_13 = {
|
|
270
|
+
key: 1,
|
|
271
|
+
class: "flex-1 flex flex-col min-h-0"
|
|
272
|
+
};
|
|
273
|
+
const _hoisted_14 = { class: "flex-1 bg-deep-charcoal border-4 border-black rounded-xl overflow-auto shadow-hard" };
|
|
274
|
+
const _hoisted_15 = { class: "w-full font-mono text-sm border-collapse" };
|
|
275
|
+
const _hoisted_16 = {
|
|
276
|
+
key: 2,
|
|
277
|
+
class: "flex-1 grid grid-cols-2 gap-3 min-h-0"
|
|
278
|
+
};
|
|
279
|
+
const _hoisted_17 = { class: "w-full font-mono text-sm border-collapse" };
|
|
280
|
+
const _hoisted_18 = { class: "w-full font-mono text-sm border-collapse" };
|
|
281
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
282
|
+
__name: "index",
|
|
283
|
+
setup(__props) {
|
|
284
|
+
const oldText = ref("");
|
|
285
|
+
const newText = ref("");
|
|
286
|
+
const hasCompared = ref(false);
|
|
287
|
+
const viewMode = ref("unified");
|
|
288
|
+
const unifiedLines = ref([]);
|
|
289
|
+
const leftLines = ref([]);
|
|
290
|
+
const rightLines = ref([]);
|
|
291
|
+
const leftPanel = ref(null);
|
|
292
|
+
const rightPanel = ref(null);
|
|
293
|
+
let syncing = false;
|
|
294
|
+
function splitText(str) {
|
|
295
|
+
const lines = str.split("\n");
|
|
296
|
+
if (lines[lines.length - 1] === "") lines.pop();
|
|
297
|
+
return lines;
|
|
298
|
+
}
|
|
299
|
+
function alignChunk(oldArr, newArr) {
|
|
300
|
+
const m = oldArr.length, n = newArr.length;
|
|
301
|
+
const dp = Array.from({ length: m + 1 }, () => new Array(n + 1).fill(0));
|
|
302
|
+
for (let i2 = 1; i2 <= m; i2++)
|
|
303
|
+
for (let j2 = 1; j2 <= n; j2++)
|
|
304
|
+
dp[i2][j2] = oldArr[i2 - 1] === newArr[j2 - 1] ? dp[i2 - 1][j2 - 1] + 1 : Math.max(dp[i2 - 1][j2], dp[i2][j2 - 1]);
|
|
305
|
+
const ops = [];
|
|
306
|
+
let i = m, j = n;
|
|
307
|
+
while (i > 0 || j > 0) {
|
|
308
|
+
if (i > 0 && j > 0 && oldArr[i - 1] === newArr[j - 1]) {
|
|
309
|
+
ops.push({ type: "equal", oldText: oldArr[i - 1], newText: newArr[j - 1] });
|
|
310
|
+
i--;
|
|
311
|
+
j--;
|
|
312
|
+
} else if (i > 0 && j > 0 && dp[i - 1][j] === dp[i][j - 1]) {
|
|
313
|
+
ops.push({ type: "replace", oldText: oldArr[i - 1], newText: newArr[j - 1] });
|
|
314
|
+
i--;
|
|
315
|
+
j--;
|
|
316
|
+
} else if (j > 0 && (i === 0 || dp[i][j - 1] >= dp[i - 1][j])) {
|
|
317
|
+
ops.push({ type: "insert", newText: newArr[j - 1] });
|
|
318
|
+
j--;
|
|
319
|
+
} else {
|
|
320
|
+
ops.push({ type: "delete", oldText: oldArr[i - 1] });
|
|
321
|
+
i--;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return ops.reverse();
|
|
325
|
+
}
|
|
326
|
+
function handleCompare() {
|
|
327
|
+
var _a;
|
|
328
|
+
const changes = diffLines(oldText.value, newText.value);
|
|
329
|
+
const unified = [];
|
|
330
|
+
const left = [];
|
|
331
|
+
const right = [];
|
|
332
|
+
let oldNum = 0, newNum = 0;
|
|
333
|
+
for (let ci = 0; ci < changes.length; ci++) {
|
|
334
|
+
const c = changes[ci];
|
|
335
|
+
if (!c.added && !c.removed) {
|
|
336
|
+
for (const line of splitText(c.value)) {
|
|
337
|
+
oldNum++;
|
|
338
|
+
newNum++;
|
|
339
|
+
unified.push({ oldNum, newNum, text: line, type: "equal" });
|
|
340
|
+
left.push({ num: oldNum, text: line, type: "equal" });
|
|
341
|
+
right.push({ num: newNum, text: line, type: "equal" });
|
|
342
|
+
}
|
|
343
|
+
} else if (c.removed && ((_a = changes[ci + 1]) == null ? void 0 : _a.added)) {
|
|
344
|
+
const removedArr = splitText(c.value);
|
|
345
|
+
const addedArr = splitText(changes[ci + 1].value);
|
|
346
|
+
const subOps = alignChunk(removedArr, addedArr);
|
|
347
|
+
for (const op of subOps) {
|
|
348
|
+
if (op.type === "equal") {
|
|
349
|
+
oldNum++;
|
|
350
|
+
newNum++;
|
|
351
|
+
unified.push({ oldNum, newNum, text: op.oldText, type: "equal" });
|
|
352
|
+
left.push({ num: oldNum, text: op.oldText, type: "equal" });
|
|
353
|
+
right.push({ num: newNum, text: op.newText, type: "equal" });
|
|
354
|
+
} else if (op.type === "replace") {
|
|
355
|
+
oldNum++;
|
|
356
|
+
newNum++;
|
|
357
|
+
unified.push({ oldNum, newNum: null, text: op.oldText, type: "removed" });
|
|
358
|
+
unified.push({ oldNum: null, newNum, text: op.newText, type: "added" });
|
|
359
|
+
left.push({ num: oldNum, text: op.oldText, type: "removed" });
|
|
360
|
+
right.push({ num: newNum, text: op.newText, type: "added" });
|
|
361
|
+
} else if (op.type === "delete") {
|
|
362
|
+
oldNum++;
|
|
363
|
+
unified.push({ oldNum, newNum: null, text: op.oldText, type: "removed" });
|
|
364
|
+
left.push({ num: oldNum, text: op.oldText, type: "removed" });
|
|
365
|
+
right.push({ num: null, text: "", type: "placeholder" });
|
|
366
|
+
} else if (op.type === "insert") {
|
|
367
|
+
newNum++;
|
|
368
|
+
unified.push({ oldNum: null, newNum, text: op.newText, type: "added" });
|
|
369
|
+
left.push({ num: null, text: "", type: "placeholder" });
|
|
370
|
+
right.push({ num: newNum, text: op.newText, type: "added" });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
ci++;
|
|
374
|
+
} else if (c.removed) {
|
|
375
|
+
for (const line of splitText(c.value)) {
|
|
376
|
+
oldNum++;
|
|
377
|
+
unified.push({ oldNum, newNum: null, text: line, type: "removed" });
|
|
378
|
+
left.push({ num: oldNum, text: line, type: "removed" });
|
|
379
|
+
right.push({ num: null, text: "", type: "placeholder" });
|
|
380
|
+
}
|
|
381
|
+
} else if (c.added) {
|
|
382
|
+
for (const line of splitText(c.value)) {
|
|
383
|
+
newNum++;
|
|
384
|
+
unified.push({ oldNum: null, newNum, text: line, type: "added" });
|
|
385
|
+
left.push({ num: null, text: "", type: "placeholder" });
|
|
386
|
+
right.push({ num: newNum, text: line, type: "added" });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
unifiedLines.value = unified;
|
|
391
|
+
leftLines.value = left;
|
|
392
|
+
rightLines.value = right;
|
|
393
|
+
hasCompared.value = true;
|
|
394
|
+
}
|
|
395
|
+
function handleClear() {
|
|
396
|
+
oldText.value = "";
|
|
397
|
+
newText.value = "";
|
|
398
|
+
unifiedLines.value = [];
|
|
399
|
+
leftLines.value = [];
|
|
400
|
+
rightLines.value = [];
|
|
401
|
+
hasCompared.value = false;
|
|
402
|
+
}
|
|
403
|
+
function handleSwap() {
|
|
404
|
+
const tmp = oldText.value;
|
|
405
|
+
oldText.value = newText.value;
|
|
406
|
+
newText.value = tmp;
|
|
407
|
+
if (hasCompared.value) handleCompare();
|
|
408
|
+
}
|
|
409
|
+
function handleEdit() {
|
|
410
|
+
hasCompared.value = false;
|
|
411
|
+
unifiedLines.value = [];
|
|
412
|
+
leftLines.value = [];
|
|
413
|
+
rightLines.value = [];
|
|
414
|
+
}
|
|
415
|
+
function handlePaste(target) {
|
|
416
|
+
navigator.clipboard.readText().then((text) => {
|
|
417
|
+
if (target === "old") oldText.value = text;
|
|
418
|
+
else newText.value = text;
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
function loadSample() {
|
|
422
|
+
oldText.value = `html,
|
|
423
|
+
body {
|
|
424
|
+
width: 100%;
|
|
425
|
+
height: 100%;
|
|
426
|
+
padding: 0;
|
|
427
|
+
overflow: hidden;
|
|
428
|
+
font-family: 'Fira Mono', monospace;
|
|
429
|
+
font-weight: normal;
|
|
430
|
+
font-size: 62.5%;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
#app-container {
|
|
434
|
+
width: 100%;
|
|
435
|
+
height: 100%;
|
|
436
|
+
cursor: pointer;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
.loading {
|
|
440
|
+
position: absolute;
|
|
441
|
+
width: 100%;
|
|
442
|
+
height: 100%;
|
|
443
|
+
background-color: #000000;
|
|
444
|
+
opacity: 1;
|
|
445
|
+
}`;
|
|
446
|
+
newText.value = `html,
|
|
447
|
+
body {
|
|
448
|
+
width: 100%;
|
|
449
|
+
height: 100%;
|
|
450
|
+
padding: 0;
|
|
451
|
+
overflow: visible;
|
|
452
|
+
font-family: 'Fira Mono', helvetica, arial, sans-serif;
|
|
453
|
+
font-weight: normal;
|
|
454
|
+
font-size: 62.5%;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
#app-container {
|
|
458
|
+
width: 100%;
|
|
459
|
+
height: 100%;
|
|
460
|
+
cursor: pointer;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.loading {
|
|
464
|
+
position: absolute;
|
|
465
|
+
width: 100%;
|
|
466
|
+
height: 100%;
|
|
467
|
+
background-color: #031607;
|
|
468
|
+
opacity: 1;
|
|
469
|
+
}`;
|
|
470
|
+
handleCompare();
|
|
471
|
+
}
|
|
472
|
+
const stats = computed(() => {
|
|
473
|
+
let added = 0, removed = 0;
|
|
474
|
+
for (const l of unifiedLines.value) {
|
|
475
|
+
if (l.type === "added") added++;
|
|
476
|
+
else if (l.type === "removed") removed++;
|
|
477
|
+
}
|
|
478
|
+
return { added, removed };
|
|
479
|
+
});
|
|
480
|
+
function syncScroll(source) {
|
|
481
|
+
if (syncing) return;
|
|
482
|
+
syncing = true;
|
|
483
|
+
const from = source === "left" ? leftPanel.value : rightPanel.value;
|
|
484
|
+
const to = source === "left" ? rightPanel.value : leftPanel.value;
|
|
485
|
+
if (from && to) {
|
|
486
|
+
to.scrollTop = from.scrollTop;
|
|
487
|
+
to.scrollLeft = from.scrollLeft;
|
|
488
|
+
}
|
|
489
|
+
requestAnimationFrame(() => {
|
|
490
|
+
syncing = false;
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
return (_ctx, _cache) => {
|
|
494
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
495
|
+
createCommentVNode(" Toolbar "),
|
|
496
|
+
createElementVNode("div", _hoisted_2, [
|
|
497
|
+
!hasCompared.value ? (openBlock(), createElementBlock("button", {
|
|
498
|
+
key: 0,
|
|
499
|
+
class: "h-9 px-4 bg-primary text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all flex items-center gap-1.5 text-sm",
|
|
500
|
+
onClick: handleCompare
|
|
501
|
+
}, [..._cache[8] || (_cache[8] = [
|
|
502
|
+
createElementVNode(
|
|
503
|
+
"span",
|
|
504
|
+
{ class: "material-icons text-lg" },
|
|
505
|
+
"compare_arrows",
|
|
506
|
+
-1
|
|
507
|
+
/* CACHED */
|
|
508
|
+
),
|
|
509
|
+
createTextVNode(
|
|
510
|
+
"对比 ",
|
|
511
|
+
-1
|
|
512
|
+
/* CACHED */
|
|
513
|
+
)
|
|
514
|
+
])])) : createCommentVNode("v-if", true),
|
|
515
|
+
hasCompared.value ? (openBlock(), createElementBlock("button", {
|
|
516
|
+
key: 1,
|
|
517
|
+
class: "h-9 px-4 bg-primary text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all flex items-center gap-1.5 text-sm",
|
|
518
|
+
onClick: handleEdit
|
|
519
|
+
}, [..._cache[9] || (_cache[9] = [
|
|
520
|
+
createElementVNode(
|
|
521
|
+
"span",
|
|
522
|
+
{ class: "material-icons text-lg" },
|
|
523
|
+
"edit",
|
|
524
|
+
-1
|
|
525
|
+
/* CACHED */
|
|
526
|
+
),
|
|
527
|
+
createTextVNode(
|
|
528
|
+
"编辑 ",
|
|
529
|
+
-1
|
|
530
|
+
/* CACHED */
|
|
531
|
+
)
|
|
532
|
+
])])) : createCommentVNode("v-if", true),
|
|
533
|
+
createElementVNode("button", {
|
|
534
|
+
class: "h-9 px-4 bg-white text-black font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all flex items-center gap-1.5 text-sm",
|
|
535
|
+
onClick: handleSwap
|
|
536
|
+
}, [..._cache[10] || (_cache[10] = [
|
|
537
|
+
createElementVNode(
|
|
538
|
+
"span",
|
|
539
|
+
{ class: "material-icons text-lg" },
|
|
540
|
+
"swap_horiz",
|
|
541
|
+
-1
|
|
542
|
+
/* CACHED */
|
|
543
|
+
),
|
|
544
|
+
createTextVNode(
|
|
545
|
+
"交换 ",
|
|
546
|
+
-1
|
|
547
|
+
/* CACHED */
|
|
548
|
+
)
|
|
549
|
+
])]),
|
|
550
|
+
createElementVNode("button", {
|
|
551
|
+
class: "h-9 px-4 bg-coral-red text-white font-bold border-2 border-black rounded shadow-hard-sm hover:shadow-none hover:translate-x-0.5 hover:translate-y-0.5 transition-all flex items-center gap-1.5 text-sm",
|
|
552
|
+
onClick: handleClear
|
|
553
|
+
}, [..._cache[11] || (_cache[11] = [
|
|
554
|
+
createElementVNode(
|
|
555
|
+
"span",
|
|
556
|
+
{ class: "material-icons text-lg" },
|
|
557
|
+
"delete_outline",
|
|
558
|
+
-1
|
|
559
|
+
/* CACHED */
|
|
560
|
+
),
|
|
561
|
+
createTextVNode(
|
|
562
|
+
"清空 ",
|
|
563
|
+
-1
|
|
564
|
+
/* CACHED */
|
|
565
|
+
)
|
|
566
|
+
])]),
|
|
567
|
+
createElementVNode("div", _hoisted_3, [
|
|
568
|
+
hasCompared.value ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
569
|
+
createElementVNode(
|
|
570
|
+
"span",
|
|
571
|
+
_hoisted_5,
|
|
572
|
+
"+" + toDisplayString(stats.value.added),
|
|
573
|
+
1
|
|
574
|
+
/* TEXT */
|
|
575
|
+
),
|
|
576
|
+
createElementVNode(
|
|
577
|
+
"span",
|
|
578
|
+
_hoisted_6,
|
|
579
|
+
"-" + toDisplayString(stats.value.removed),
|
|
580
|
+
1
|
|
581
|
+
/* TEXT */
|
|
582
|
+
)
|
|
583
|
+
])) : createCommentVNode("v-if", true),
|
|
584
|
+
createCommentVNode(" 视图切换 "),
|
|
585
|
+
hasCompared.value ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
586
|
+
createElementVNode(
|
|
587
|
+
"button",
|
|
588
|
+
{
|
|
589
|
+
class: normalizeClass(["h-7 px-2.5 text-xs font-bold flex items-center gap-1 transition-all", viewMode.value === "unified" ? "bg-primary text-black" : "bg-deep-charcoal text-gray-400 hover:text-white"]),
|
|
590
|
+
onClick: _cache[0] || (_cache[0] = ($event) => viewMode.value = "unified")
|
|
591
|
+
},
|
|
592
|
+
[..._cache[12] || (_cache[12] = [
|
|
593
|
+
createElementVNode(
|
|
594
|
+
"span",
|
|
595
|
+
{ class: "material-icons text-sm" },
|
|
596
|
+
"view_agenda",
|
|
597
|
+
-1
|
|
598
|
+
/* CACHED */
|
|
599
|
+
),
|
|
600
|
+
createTextVNode(
|
|
601
|
+
"统一 ",
|
|
602
|
+
-1
|
|
603
|
+
/* CACHED */
|
|
604
|
+
)
|
|
605
|
+
])],
|
|
606
|
+
2
|
|
607
|
+
/* CLASS */
|
|
608
|
+
),
|
|
609
|
+
createElementVNode(
|
|
610
|
+
"button",
|
|
611
|
+
{
|
|
612
|
+
class: normalizeClass(["h-7 px-2.5 text-xs font-bold flex items-center gap-1 transition-all border-l border-white/20", viewMode.value === "split" ? "bg-primary text-black" : "bg-deep-charcoal text-gray-400 hover:text-white"]),
|
|
613
|
+
onClick: _cache[1] || (_cache[1] = ($event) => viewMode.value = "split")
|
|
614
|
+
},
|
|
615
|
+
[..._cache[13] || (_cache[13] = [
|
|
616
|
+
createElementVNode(
|
|
617
|
+
"span",
|
|
618
|
+
{ class: "material-icons text-sm" },
|
|
619
|
+
"view_column",
|
|
620
|
+
-1
|
|
621
|
+
/* CACHED */
|
|
622
|
+
),
|
|
623
|
+
createTextVNode(
|
|
624
|
+
"并排 ",
|
|
625
|
+
-1
|
|
626
|
+
/* CACHED */
|
|
627
|
+
)
|
|
628
|
+
])],
|
|
629
|
+
2
|
|
630
|
+
/* CLASS */
|
|
631
|
+
)
|
|
632
|
+
])) : createCommentVNode("v-if", true),
|
|
633
|
+
createElementVNode("button", {
|
|
634
|
+
class: "h-9 px-3 bg-deep-charcoal text-gray-300 font-bold border-2 border-white/20 rounded hover:border-primary hover:text-primary transition-all text-sm flex items-center gap-1.5",
|
|
635
|
+
onClick: loadSample
|
|
636
|
+
}, [..._cache[14] || (_cache[14] = [
|
|
637
|
+
createElementVNode(
|
|
638
|
+
"span",
|
|
639
|
+
{ class: "material-icons text-lg" },
|
|
640
|
+
"science",
|
|
641
|
+
-1
|
|
642
|
+
/* CACHED */
|
|
643
|
+
),
|
|
644
|
+
createTextVNode(
|
|
645
|
+
"示例 ",
|
|
646
|
+
-1
|
|
647
|
+
/* CACHED */
|
|
648
|
+
)
|
|
649
|
+
])])
|
|
650
|
+
])
|
|
651
|
+
]),
|
|
652
|
+
createCommentVNode(" 编辑模式:并排输入 "),
|
|
653
|
+
!hasCompared.value ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
654
|
+
createElementVNode("div", _hoisted_9, [
|
|
655
|
+
createElementVNode("div", _hoisted_10, [
|
|
656
|
+
_cache[16] || (_cache[16] = createElementVNode(
|
|
657
|
+
"span",
|
|
658
|
+
{ class: "text-sm font-bold text-gray-400 tracking-wider" },
|
|
659
|
+
"A 原始文本",
|
|
660
|
+
-1
|
|
661
|
+
/* CACHED */
|
|
662
|
+
)),
|
|
663
|
+
createElementVNode("button", {
|
|
664
|
+
class: "ml-auto text-xs text-gray-500 hover:text-primary transition-colors flex items-center gap-1",
|
|
665
|
+
onClick: _cache[2] || (_cache[2] = ($event) => handlePaste("old"))
|
|
666
|
+
}, [..._cache[15] || (_cache[15] = [
|
|
667
|
+
createElementVNode(
|
|
668
|
+
"span",
|
|
669
|
+
{ class: "material-icons text-sm" },
|
|
670
|
+
"content_paste",
|
|
671
|
+
-1
|
|
672
|
+
/* CACHED */
|
|
673
|
+
),
|
|
674
|
+
createTextVNode(
|
|
675
|
+
"粘贴 ",
|
|
676
|
+
-1
|
|
677
|
+
/* CACHED */
|
|
678
|
+
)
|
|
679
|
+
])])
|
|
680
|
+
]),
|
|
681
|
+
withDirectives(createElementVNode(
|
|
682
|
+
"textarea",
|
|
683
|
+
{
|
|
684
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => oldText.value = $event),
|
|
685
|
+
placeholder: "在此输入原始文本...",
|
|
686
|
+
spellcheck: "false",
|
|
687
|
+
class: "flex-1 w-full bg-deep-charcoal text-gray-100 border-4 border-black rounded-xl p-4 font-mono text-sm leading-relaxed resize-none shadow-hard focus:border-primary focus:shadow-none focus:translate-x-1 focus:translate-y-1 transition-all outline-none placeholder-gray-600"
|
|
688
|
+
},
|
|
689
|
+
null,
|
|
690
|
+
512
|
|
691
|
+
/* NEED_PATCH */
|
|
692
|
+
), [
|
|
693
|
+
[vModelText, oldText.value]
|
|
694
|
+
])
|
|
695
|
+
]),
|
|
696
|
+
createElementVNode("div", _hoisted_11, [
|
|
697
|
+
createElementVNode("div", _hoisted_12, [
|
|
698
|
+
_cache[18] || (_cache[18] = createElementVNode(
|
|
699
|
+
"span",
|
|
700
|
+
{ class: "text-sm font-bold text-gray-400 tracking-wider" },
|
|
701
|
+
"B 新文本",
|
|
702
|
+
-1
|
|
703
|
+
/* CACHED */
|
|
704
|
+
)),
|
|
705
|
+
createElementVNode("button", {
|
|
706
|
+
class: "ml-auto text-xs text-gray-500 hover:text-primary transition-colors flex items-center gap-1",
|
|
707
|
+
onClick: _cache[4] || (_cache[4] = ($event) => handlePaste("new"))
|
|
708
|
+
}, [..._cache[17] || (_cache[17] = [
|
|
709
|
+
createElementVNode(
|
|
710
|
+
"span",
|
|
711
|
+
{ class: "material-icons text-sm" },
|
|
712
|
+
"content_paste",
|
|
713
|
+
-1
|
|
714
|
+
/* CACHED */
|
|
715
|
+
),
|
|
716
|
+
createTextVNode(
|
|
717
|
+
"粘贴 ",
|
|
718
|
+
-1
|
|
719
|
+
/* CACHED */
|
|
720
|
+
)
|
|
721
|
+
])])
|
|
722
|
+
]),
|
|
723
|
+
withDirectives(createElementVNode(
|
|
724
|
+
"textarea",
|
|
725
|
+
{
|
|
726
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => newText.value = $event),
|
|
727
|
+
placeholder: "在此输入新文本...",
|
|
728
|
+
spellcheck: "false",
|
|
729
|
+
class: "flex-1 w-full bg-deep-charcoal text-gray-100 border-4 border-black rounded-xl p-4 font-mono text-sm leading-relaxed resize-none shadow-hard focus:border-primary focus:shadow-none focus:translate-x-1 focus:translate-y-1 transition-all outline-none placeholder-gray-600"
|
|
730
|
+
},
|
|
731
|
+
null,
|
|
732
|
+
512
|
|
733
|
+
/* NEED_PATCH */
|
|
734
|
+
), [
|
|
735
|
+
[vModelText, newText.value]
|
|
736
|
+
])
|
|
737
|
+
])
|
|
738
|
+
])) : createCommentVNode("v-if", true),
|
|
739
|
+
createCommentVNode(" 对比结果:统一视图 "),
|
|
740
|
+
hasCompared.value && viewMode.value === "unified" ? (openBlock(), createElementBlock("div", _hoisted_13, [
|
|
741
|
+
createElementVNode("div", _hoisted_14, [
|
|
742
|
+
createElementVNode("table", _hoisted_15, [
|
|
743
|
+
(openBlock(true), createElementBlock(
|
|
744
|
+
Fragment,
|
|
745
|
+
null,
|
|
746
|
+
renderList(unifiedLines.value, (line, idx) => {
|
|
747
|
+
return openBlock(), createElementBlock(
|
|
748
|
+
"tr",
|
|
749
|
+
{
|
|
750
|
+
key: idx,
|
|
751
|
+
class: normalizeClass({
|
|
752
|
+
"bg-coral-red/12": line.type === "removed",
|
|
753
|
+
"bg-neon-green/12": line.type === "added"
|
|
754
|
+
})
|
|
755
|
+
},
|
|
756
|
+
[
|
|
757
|
+
createElementVNode(
|
|
758
|
+
"td",
|
|
759
|
+
{
|
|
760
|
+
class: normalizeClass(["diff-num select-none text-right pr-1.5 pl-2 border-r border-white/10", line.type === "removed" ? "text-coral-red/40" : line.type === "added" ? "text-neon-green/40" : "text-gray-600"])
|
|
761
|
+
},
|
|
762
|
+
toDisplayString(line.oldNum ?? ""),
|
|
763
|
+
3
|
|
764
|
+
/* TEXT, CLASS */
|
|
765
|
+
),
|
|
766
|
+
createElementVNode(
|
|
767
|
+
"td",
|
|
768
|
+
{
|
|
769
|
+
class: normalizeClass(["diff-num select-none text-right pr-1.5 pl-1.5 border-r border-white/10", line.type === "removed" ? "text-coral-red/40" : line.type === "added" ? "text-neon-green/40" : "text-gray-600"])
|
|
770
|
+
},
|
|
771
|
+
toDisplayString(line.newNum ?? ""),
|
|
772
|
+
3
|
|
773
|
+
/* TEXT, CLASS */
|
|
774
|
+
),
|
|
775
|
+
createElementVNode(
|
|
776
|
+
"td",
|
|
777
|
+
{
|
|
778
|
+
class: normalizeClass(["select-none w-5 text-center font-bold", line.type === "removed" ? "text-coral-red" : line.type === "added" ? "text-neon-green" : "text-gray-700"])
|
|
779
|
+
},
|
|
780
|
+
toDisplayString(line.type === "removed" ? "-" : line.type === "added" ? "+" : " "),
|
|
781
|
+
3
|
|
782
|
+
/* TEXT, CLASS */
|
|
783
|
+
),
|
|
784
|
+
createElementVNode(
|
|
785
|
+
"td",
|
|
786
|
+
{
|
|
787
|
+
class: normalizeClass(["pr-4 whitespace-pre", line.type === "removed" ? "text-coral-red/90" : line.type === "added" ? "text-neon-green/90" : "text-gray-300"])
|
|
788
|
+
},
|
|
789
|
+
toDisplayString(line.text),
|
|
790
|
+
3
|
|
791
|
+
/* TEXT, CLASS */
|
|
792
|
+
)
|
|
793
|
+
],
|
|
794
|
+
2
|
|
795
|
+
/* CLASS */
|
|
796
|
+
);
|
|
797
|
+
}),
|
|
798
|
+
128
|
|
799
|
+
/* KEYED_FRAGMENT */
|
|
800
|
+
))
|
|
801
|
+
])
|
|
802
|
+
])
|
|
803
|
+
])) : createCommentVNode("v-if", true),
|
|
804
|
+
createCommentVNode(" 对比结果:并排视图 "),
|
|
805
|
+
hasCompared.value && viewMode.value === "split" ? (openBlock(), createElementBlock("div", _hoisted_16, [
|
|
806
|
+
createElementVNode(
|
|
807
|
+
"div",
|
|
808
|
+
{
|
|
809
|
+
ref_key: "leftPanel",
|
|
810
|
+
ref: leftPanel,
|
|
811
|
+
onScroll: _cache[6] || (_cache[6] = ($event) => syncScroll("left")),
|
|
812
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl overflow-auto shadow-hard"
|
|
813
|
+
},
|
|
814
|
+
[
|
|
815
|
+
createElementVNode("table", _hoisted_17, [
|
|
816
|
+
(openBlock(true), createElementBlock(
|
|
817
|
+
Fragment,
|
|
818
|
+
null,
|
|
819
|
+
renderList(leftLines.value, (line, idx) => {
|
|
820
|
+
return openBlock(), createElementBlock(
|
|
821
|
+
"tr",
|
|
822
|
+
{
|
|
823
|
+
key: idx,
|
|
824
|
+
class: normalizeClass({
|
|
825
|
+
"bg-coral-red/12": line.type === "removed",
|
|
826
|
+
"bg-white/[0.03]": line.type === "placeholder"
|
|
827
|
+
})
|
|
828
|
+
},
|
|
829
|
+
[
|
|
830
|
+
createElementVNode(
|
|
831
|
+
"td",
|
|
832
|
+
{
|
|
833
|
+
class: normalizeClass(["diff-num select-none text-right pr-2 pl-2 border-r border-white/10", line.type === "removed" ? "text-coral-red/40" : line.type === "placeholder" ? "text-transparent" : "text-gray-600"])
|
|
834
|
+
},
|
|
835
|
+
toDisplayString(line.num ?? ""),
|
|
836
|
+
3
|
|
837
|
+
/* TEXT, CLASS */
|
|
838
|
+
),
|
|
839
|
+
createElementVNode(
|
|
840
|
+
"td",
|
|
841
|
+
{
|
|
842
|
+
class: normalizeClass(["px-3 whitespace-pre", line.type === "removed" ? "text-coral-red/90" : line.type === "placeholder" ? "" : "text-gray-300"])
|
|
843
|
+
},
|
|
844
|
+
toDisplayString(line.text),
|
|
845
|
+
3
|
|
846
|
+
/* TEXT, CLASS */
|
|
847
|
+
)
|
|
848
|
+
],
|
|
849
|
+
2
|
|
850
|
+
/* CLASS */
|
|
851
|
+
);
|
|
852
|
+
}),
|
|
853
|
+
128
|
|
854
|
+
/* KEYED_FRAGMENT */
|
|
855
|
+
))
|
|
856
|
+
])
|
|
857
|
+
],
|
|
858
|
+
544
|
|
859
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
860
|
+
),
|
|
861
|
+
createElementVNode(
|
|
862
|
+
"div",
|
|
863
|
+
{
|
|
864
|
+
ref_key: "rightPanel",
|
|
865
|
+
ref: rightPanel,
|
|
866
|
+
onScroll: _cache[7] || (_cache[7] = ($event) => syncScroll("right")),
|
|
867
|
+
class: "bg-deep-charcoal border-4 border-black rounded-xl overflow-auto shadow-hard"
|
|
868
|
+
},
|
|
869
|
+
[
|
|
870
|
+
createElementVNode("table", _hoisted_18, [
|
|
871
|
+
(openBlock(true), createElementBlock(
|
|
872
|
+
Fragment,
|
|
873
|
+
null,
|
|
874
|
+
renderList(rightLines.value, (line, idx) => {
|
|
875
|
+
return openBlock(), createElementBlock(
|
|
876
|
+
"tr",
|
|
877
|
+
{
|
|
878
|
+
key: idx,
|
|
879
|
+
class: normalizeClass({
|
|
880
|
+
"bg-neon-green/12": line.type === "added",
|
|
881
|
+
"bg-white/[0.03]": line.type === "placeholder"
|
|
882
|
+
})
|
|
883
|
+
},
|
|
884
|
+
[
|
|
885
|
+
createElementVNode(
|
|
886
|
+
"td",
|
|
887
|
+
{
|
|
888
|
+
class: normalizeClass(["diff-num select-none text-right pr-2 pl-2 border-r border-white/10", line.type === "added" ? "text-neon-green/40" : line.type === "placeholder" ? "text-transparent" : "text-gray-600"])
|
|
889
|
+
},
|
|
890
|
+
toDisplayString(line.num ?? ""),
|
|
891
|
+
3
|
|
892
|
+
/* TEXT, CLASS */
|
|
893
|
+
),
|
|
894
|
+
createElementVNode(
|
|
895
|
+
"td",
|
|
896
|
+
{
|
|
897
|
+
class: normalizeClass(["px-3 whitespace-pre", line.type === "added" ? "text-neon-green/90" : line.type === "placeholder" ? "" : "text-gray-300"])
|
|
898
|
+
},
|
|
899
|
+
toDisplayString(line.text),
|
|
900
|
+
3
|
|
901
|
+
/* TEXT, CLASS */
|
|
902
|
+
)
|
|
903
|
+
],
|
|
904
|
+
2
|
|
905
|
+
/* CLASS */
|
|
906
|
+
);
|
|
907
|
+
}),
|
|
908
|
+
128
|
|
909
|
+
/* KEYED_FRAGMENT */
|
|
910
|
+
))
|
|
911
|
+
])
|
|
912
|
+
],
|
|
913
|
+
544
|
|
914
|
+
/* NEED_HYDRATION, NEED_PATCH */
|
|
915
|
+
)
|
|
916
|
+
])) : createCommentVNode("v-if", true)
|
|
917
|
+
]);
|
|
918
|
+
};
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
const _export_sfc = (sfc, props) => {
|
|
922
|
+
const target = sfc.__vccOpts || sfc;
|
|
923
|
+
for (const [key, val] of props) {
|
|
924
|
+
target[key] = val;
|
|
925
|
+
}
|
|
926
|
+
return target;
|
|
927
|
+
};
|
|
928
|
+
const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-90752a2e"]]);
|
|
929
|
+
export {
|
|
930
|
+
index as default
|
|
931
|
+
};
|
|
932
|
+
|
|
933
|
+
;(function(){var s=document.createElement("style");s.textContent=`
|
|
934
|
+
table tr td[data-v-90752a2e] {
|
|
935
|
+
line-height: 1.75;
|
|
936
|
+
}
|
|
937
|
+
.diff-num[data-v-90752a2e] {
|
|
938
|
+
min-width: 3ch;
|
|
939
|
+
}
|
|
940
|
+
`;document.head.appendChild(s)})();
|