bkui-vue 0.0.3-beta.2 → 0.0.3-beta.2-2
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/index.cjs.js +48 -48
- package/dist/index.esm.js +10567 -10537
- package/dist/index.umd.js +48 -48
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/affix/index.d.ts +57 -111
- package/lib/affix/index.js +19 -19
- package/lib/alert/alert.d.ts +1 -1
- package/lib/alert/index.d.ts +82 -132
- package/lib/alert/index.js +20 -20
- package/lib/animate-number/index.d.ts +33 -96
- package/lib/backtop/index.d.ts +69 -117
- package/lib/badge/badge.d.ts +1 -1
- package/lib/badge/index.d.ts +120 -153
- package/lib/badge/index.js +19 -19
- package/lib/breadcrumb/index.d.ts +67 -119
- package/lib/breadcrumb/index.js +17 -17
- package/lib/button/button.d.ts +2 -2
- package/lib/button/index.d.ts +119 -155
- package/lib/button/index.js +19 -20
- package/lib/card/card.d.ts +1 -1
- package/lib/card/index.d.ts +129 -158
- package/lib/card/index.js +20 -22
- package/lib/cascader/cascader.d.ts +3 -3
- package/lib/cascader/index.d.ts +393 -354
- package/lib/cascader/index.js +233 -234
- package/lib/checkbox/checkbox.d.ts +1 -1
- package/lib/checkbox/index.d.ts +119 -161
- package/lib/checkbox/index.js +39 -41
- package/lib/code-diff/index.d.ts +65 -82
- package/lib/code-diff/index.js +380 -437
- package/lib/collapse/index.d.ts +144 -168
- package/lib/collapse/index.js +21 -21
- package/lib/collapse-transition/index.d.ts +19 -94
- package/lib/color-picker/color-picker.d.ts +1 -1
- package/lib/color-picker/index.d.ts +128 -154
- package/lib/color-picker/index.js +25 -28
- package/lib/config-provider/index.d.ts +156 -223
- package/lib/config-provider/index.js +19 -19
- package/lib/container/container.d.ts +1 -1
- package/lib/container/index.d.ts +74 -85
- package/lib/container/index.js +19 -19
- package/lib/date-picker/base/picker-dropdown.d.ts +1 -1
- package/lib/date-picker/base/time-spinner.d.ts +3 -3
- package/lib/date-picker/date-picker.d.ts +3 -3
- package/lib/date-picker/index.d.ts +384 -351
- package/lib/date-picker/index.js +92 -104
- package/lib/date-picker/panel/date-range.d.ts +1 -1
- package/lib/date-picker/panel/date.d.ts +1 -1
- package/lib/date-picker/panel/time-range.d.ts +2 -2
- package/lib/date-picker/panel/time.d.ts +1 -1
- package/lib/date-picker/time-picker.d.ts +3 -3
- package/lib/dialog/index.d.ts +345 -302
- package/lib/dialog/index.js +227 -228
- package/lib/directives/index.js +27 -27
- package/lib/divider/index.d.ts +57 -111
- package/lib/dropdown/dropdown.d.ts +1 -1
- package/lib/dropdown/index.d.ts +94 -136
- package/lib/dropdown/index.js +17 -17
- package/lib/exception/index.d.ts +41 -102
- package/lib/exception/index.js +18 -19
- package/lib/fixed-navbar/index.d.ts +59 -113
- package/lib/form/form.d.ts +1 -1
- package/lib/form/index.d.ts +80 -132
- package/lib/form/index.js +25 -26
- package/lib/icon/angle-double-down-line.js +21 -21
- package/lib/icon/angle-double-left-line.js +21 -21
- package/lib/icon/angle-double-left.js +21 -21
- package/lib/icon/angle-double-right-line.js +21 -21
- package/lib/icon/angle-double-right.js +21 -21
- package/lib/icon/angle-double-up-line.js +21 -21
- package/lib/icon/angle-down-fill.js +21 -21
- package/lib/icon/angle-down-line.js +21 -21
- package/lib/icon/angle-down.js +21 -21
- package/lib/icon/angle-left.js +21 -21
- package/lib/icon/angle-right.js +21 -21
- package/lib/icon/angle-up-fill.js +21 -21
- package/lib/icon/angle-up.js +21 -21
- package/lib/icon/archive-fill.js +21 -21
- package/lib/icon/arrows-left.js +21 -21
- package/lib/icon/arrows-right.js +21 -21
- package/lib/icon/assistant.js +21 -21
- package/lib/icon/audio-fill.js +21 -21
- package/lib/icon/bk.js +21 -21
- package/lib/icon/circle.js +21 -21
- package/lib/icon/close-line.js +21 -21
- package/lib/icon/close.js +21 -21
- package/lib/icon/code.js +21 -21
- package/lib/icon/cog-shape.js +21 -21
- package/lib/icon/collapse-left.js +21 -21
- package/lib/icon/copy-shape.js +21 -21
- package/lib/icon/copy.js +21 -21
- package/lib/icon/data-shape.js +21 -21
- package/lib/icon/del.js +21 -21
- package/lib/icon/doc-fill.js +21 -21
- package/lib/icon/done.js +21 -21
- package/lib/icon/down-shape.js +21 -21
- package/lib/icon/down-small.js +21 -21
- package/lib/icon/edit-line.js +21 -21
- package/lib/icon/ellipsis.js +21 -21
- package/lib/icon/enlarge-line.js +21 -21
- package/lib/icon/error.js +21 -21
- package/lib/icon/excel-fill.js +21 -21
- package/lib/icon/exclamation-circle-shape.js +21 -21
- package/lib/icon/eye.js +21 -21
- package/lib/icon/filliscreen-line.js +21 -21
- package/lib/icon/fix-line.js +21 -21
- package/lib/icon/fix-shape.js +21 -21
- package/lib/icon/folder-open.js +21 -21
- package/lib/icon/folder-shape-open.js +21 -21
- package/lib/icon/folder-shape.js +21 -21
- package/lib/icon/folder.js +21 -21
- package/lib/icon/funnel.js +21 -21
- package/lib/icon/grag-fill.js +21 -21
- package/lib/icon/help-document-fill.js +21 -21
- package/lib/icon/help-fill.js +21 -21
- package/lib/icon/help.js +21 -21
- package/lib/icon/image-fill.js +22 -22
- package/lib/icon/img-error.js +22 -22
- package/lib/icon/img-placehoulder.js +22 -22
- package/lib/icon/index.js +192 -192
- package/lib/icon/info-line.js +22 -22
- package/lib/icon/info.js +22 -22
- package/lib/icon/left-shape.js +22 -22
- package/lib/icon/left-turn-line.js +22 -22
- package/lib/icon/loading.js +22 -22
- package/lib/icon/narrow-line.js +22 -22
- package/lib/icon/original.js +22 -22
- package/lib/icon/pdf-fill.js +22 -22
- package/lib/icon/play-shape.js +22 -22
- package/lib/icon/plus.js +22 -22
- package/lib/icon/ppt-fill.js +22 -22
- package/lib/icon/qq.js +22 -22
- package/lib/icon/right-shape.js +22 -22
- package/lib/icon/right-turn-line.js +22 -22
- package/lib/icon/search.js +22 -22
- package/lib/icon/share.js +22 -22
- package/lib/icon/spinner.js +22 -22
- package/lib/icon/success.js +22 -22
- package/lib/icon/switcher-loading.js +22 -22
- package/lib/icon/text-file.js +22 -22
- package/lib/icon/text-fill.js +22 -22
- package/lib/icon/transfer.js +22 -22
- package/lib/icon/tree-application-shape.js +22 -22
- package/lib/icon/unfull-screen.js +22 -22
- package/lib/icon/unvisible.js +22 -22
- package/lib/icon/up-shape.js +22 -22
- package/lib/icon/upload.js +22 -22
- package/lib/icon/video-fill.js +22 -22
- package/lib/icon/warn.js +22 -22
- package/lib/icon/weixin-pro.js +22 -22
- package/lib/icon/weixin.js +22 -22
- package/lib/image/index.d.ts +113 -149
- package/lib/image/index.js +19 -19
- package/lib/info-box/index.js +229 -230
- package/lib/input/index.d.ts +326 -293
- package/lib/input/index.js +256 -258
- package/lib/link/index.d.ts +73 -122
- package/lib/loading/index.d.ts +130 -156
- package/lib/loading/index.js +23 -25
- package/lib/loading/loading.d.ts +1 -1
- package/lib/locale/index.js +0 -4
- package/lib/menu/index.d.ts +51 -112
- package/lib/menu/index.js +25 -25
- package/lib/message/index.js +28 -30
- package/lib/message/messageConstructor.d.ts +5 -5
- package/lib/modal/index.d.ts +251 -246
- package/lib/modal/index.js +24 -24
- package/lib/navigation/index.d.ts +152 -188
- package/lib/notify/index.js +22 -24
- package/lib/notify/notifyConstructor.d.ts +1 -1
- package/lib/overflow-title/index.d.ts +314 -242
- package/lib/overflow-title/index.js +1 -1
- package/lib/pagination/index.d.ts +194 -205
- package/lib/pagination/index.js +49 -56
- package/lib/plugin-popover/index.js +192 -98
- package/lib/pop-confirm/index.d.ts +126 -159
- package/lib/pop-confirm/index.js +0 -1
- package/lib/pop-confirm/pop-confirm.d.ts +1 -1
- package/lib/popover/content.d.ts +1 -1
- package/lib/popover/index.d.ts +374 -330
- package/lib/popover/index.js +192 -98
- package/lib/popover2/index.d.ts +8 -83
- package/lib/process/index.d.ts +93 -137
- package/lib/process/index.js +225 -226
- package/lib/progress/index.d.ts +178 -187
- package/lib/progress/index.js +19 -19
- package/lib/progress/progress.d.ts +2 -2
- package/lib/radio/index.d.ts +83 -135
- package/lib/radio/index.js +41 -43
- package/lib/rate/index.d.ts +55 -112
- package/lib/rate/index.js +19 -20
- package/lib/resize-layout/index.d.ts +156 -185
- package/lib/resize-layout/index.js +20 -21
- package/lib/resize-layout/resize-layout.d.ts +2 -2
- package/lib/search-select/index.d.ts +292 -327
- package/lib/search-select/index.js +239 -240
- package/lib/search-select/input.d.ts +2 -2
- package/lib/search-select/search-select.d.ts +3 -3
- package/lib/search-select/selected.d.ts +2 -2
- package/lib/select/index.d.ts +1234 -1135
- package/lib/select/index.js +259 -262
- package/lib/select/select.d.ts +121 -161
- package/lib/select/selectTagInput.d.ts +2 -2
- package/lib/shared/index.js +62 -64
- package/lib/sideslider/index.d.ts +237 -226
- package/lib/sideslider/index.js +227 -227
- package/lib/slider/index.d.ts +204 -204
- package/lib/slider/index.js +208 -209
- package/lib/steps/index.d.ts +114 -150
- package/lib/steps/index.js +227 -228
- package/lib/swiper/index.d.ts +81 -127
- package/lib/swiper/index.js +18 -18
- package/lib/switcher/index.d.ts +152 -174
- package/lib/switcher/index.js +20 -22
- package/lib/tab/index.d.ts +199 -211
- package/lib/tab/index.js +23 -25
- package/lib/table/components/table-column.d.ts +2 -2
- package/lib/table/index.d.ts +605 -593
- package/lib/table/index.js +161 -132
- package/lib/table/plugins/use-pagination.d.ts +3 -2
- package/lib/table/table.css +12 -5
- package/lib/table/table.d.ts +1 -1
- package/lib/table/table.less +15 -5
- package/lib/table/table.variable.css +12 -5
- package/lib/table/use-attributes.d.ts +40 -1
- package/lib/table/use-common.d.ts +68 -34
- package/lib/table-column/index.d.ts +206 -242
- package/lib/table-column/index.js +18 -19
- package/lib/tag/index.d.ts +95 -142
- package/lib/tag/index.js +19 -19
- package/lib/tag-input/index.d.ts +690 -498
- package/lib/tag-input/index.js +54 -62
- package/lib/tag-input/tag-input.d.ts +5 -5
- package/lib/time-picker/index.d.ts +442 -385
- package/lib/timeline/index.d.ts +50 -109
- package/lib/timeline/index.js +6 -6
- package/lib/transfer/index.d.ts +191 -206
- package/lib/tree/index.d.ts +334 -293
- package/lib/tree/index.js +36 -39
- package/lib/tree/tree.d.ts +1 -1
- package/lib/tree/use-tree-init.d.ts +1 -1
- package/lib/upload/index.d.ts +281 -254
- package/lib/upload/index.js +254 -257
- package/lib/upload/upload.d.ts +2 -2
- package/lib/virtual-render/index.d.ts +337 -242
- package/lib/virtual-render/index.js +30 -30
- package/lib/virtual-render/virtual-render.d.ts +1 -1
- package/package.json +1 -1
package/lib/code-diff/index.js
CHANGED
@@ -873,31 +873,31 @@ function _arrayWithHoles(arr) {
|
|
873
873
|
if (Array.isArray(arr)) return arr;
|
874
874
|
}
|
875
875
|
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
|
876
|
-
function _iterableToArrayLimit(
|
877
|
-
var
|
878
|
-
if (null !=
|
879
|
-
var
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
876
|
+
function _iterableToArrayLimit(r, l) {
|
877
|
+
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
878
|
+
if (null != t) {
|
879
|
+
var e,
|
880
|
+
n,
|
881
|
+
i,
|
882
|
+
u,
|
883
|
+
a = [],
|
884
|
+
f = !0,
|
885
|
+
o = !1;
|
886
886
|
try {
|
887
|
-
if (
|
888
|
-
if (Object(
|
889
|
-
|
890
|
-
} else for (; !(
|
891
|
-
} catch (
|
892
|
-
|
887
|
+
if (i = (t = t.call(r)).next, 0 === l) {
|
888
|
+
if (Object(t) !== t) return;
|
889
|
+
f = !1;
|
890
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
891
|
+
} catch (r) {
|
892
|
+
o = !0, n = r;
|
893
893
|
} finally {
|
894
894
|
try {
|
895
|
-
if (!
|
895
|
+
if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
|
896
896
|
} finally {
|
897
|
-
if (
|
897
|
+
if (o) throw n;
|
898
898
|
}
|
899
899
|
}
|
900
|
-
return
|
900
|
+
return a;
|
901
901
|
}
|
902
902
|
}
|
903
903
|
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
|
@@ -2494,22 +2494,28 @@ var LineType;
|
|
2494
2494
|
LineType["DELETE"] = "delete";
|
2495
2495
|
LineType["CONTEXT"] = "context";
|
2496
2496
|
})(LineType || (LineType = {}));
|
2497
|
-
|
2497
|
+
const OutputFormatType = {
|
2498
2498
|
LINE_BY_LINE: 'line-by-line',
|
2499
2499
|
SIDE_BY_SIDE: 'side-by-side',
|
2500
2500
|
};
|
2501
|
-
|
2501
|
+
const LineMatchingType = {
|
2502
2502
|
LINES: 'lines',
|
2503
2503
|
WORDS: 'words',
|
2504
2504
|
NONE: 'none',
|
2505
2505
|
};
|
2506
|
-
|
2506
|
+
const DiffStyleType = {
|
2507
2507
|
WORD: 'word',
|
2508
2508
|
CHAR: 'char',
|
2509
2509
|
};
|
2510
|
+
var ColorSchemeType;
|
2511
|
+
(function (ColorSchemeType) {
|
2512
|
+
ColorSchemeType["AUTO"] = "auto";
|
2513
|
+
ColorSchemeType["DARK"] = "dark";
|
2514
|
+
ColorSchemeType["LIGHT"] = "light";
|
2515
|
+
})(ColorSchemeType || (ColorSchemeType = {}));
|
2510
2516
|
//# sourceMappingURL=types.js.map
|
2511
2517
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/utils.js
|
2512
|
-
|
2518
|
+
const specials = [
|
2513
2519
|
'-',
|
2514
2520
|
'[',
|
2515
2521
|
']',
|
@@ -2527,7 +2533,7 @@ var specials = [
|
|
2527
2533
|
'$',
|
2528
2534
|
'|',
|
2529
2535
|
];
|
2530
|
-
|
2536
|
+
const regex = RegExp('[' + specials.join('\\') + ']', 'g');
|
2531
2537
|
function escapeForRegExp(str) {
|
2532
2538
|
return str.replace(regex, '\\$&');
|
2533
2539
|
}
|
@@ -2535,8 +2541,8 @@ function unifyPath(path) {
|
|
2535
2541
|
return path ? path.replace(/\\/g, '/') : path;
|
2536
2542
|
}
|
2537
2543
|
function hashCode(text) {
|
2538
|
-
|
2539
|
-
|
2544
|
+
let i, chr, len;
|
2545
|
+
let hash = 0;
|
2540
2546
|
for (i = 0, len = text.length; i < len; i++) {
|
2541
2547
|
chr = text.charCodeAt(i);
|
2542
2548
|
hash = (hash << 5) - hash + chr;
|
@@ -2546,33 +2552,24 @@ function hashCode(text) {
|
|
2546
2552
|
}
|
2547
2553
|
//# sourceMappingURL=utils.js.map
|
2548
2554
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/diff-parser.js
|
2549
|
-
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
|
2550
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
2551
|
-
if (ar || !(i in from)) {
|
2552
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
2553
|
-
ar[i] = from[i];
|
2554
|
-
}
|
2555
|
-
}
|
2556
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
2557
|
-
};
|
2558
2555
|
|
2559
2556
|
|
2560
2557
|
function getExtension(filename, language) {
|
2561
|
-
|
2558
|
+
const filenameParts = filename.split('.');
|
2562
2559
|
return filenameParts.length > 1 ? filenameParts[filenameParts.length - 1] : language;
|
2563
2560
|
}
|
2564
2561
|
function startsWithAny(str, prefixes) {
|
2565
|
-
return prefixes.reduce(
|
2562
|
+
return prefixes.reduce((startsWith, prefix) => startsWith || str.startsWith(prefix), false);
|
2566
2563
|
}
|
2567
|
-
|
2564
|
+
const baseDiffFilenamePrefixes = ['a/', 'b/', 'i/', 'w/', 'c/', 'o/'];
|
2568
2565
|
function getFilename(line, linePrefix, extraPrefix) {
|
2569
|
-
|
2570
|
-
|
2571
|
-
? new RegExp(
|
2566
|
+
const prefixes = extraPrefix !== undefined ? [...baseDiffFilenamePrefixes, extraPrefix] : baseDiffFilenamePrefixes;
|
2567
|
+
const FilenameRegExp = linePrefix
|
2568
|
+
? new RegExp(`^${escapeForRegExp(linePrefix)} "?(.+?)"?$`)
|
2572
2569
|
: new RegExp('^"?(.+?)"?$');
|
2573
|
-
|
2574
|
-
|
2575
|
-
|
2570
|
+
const [, filename = ''] = FilenameRegExp.exec(line) || [];
|
2571
|
+
const matchingPrefix = prefixes.find(p => filename.indexOf(p) === 0);
|
2572
|
+
const fnameWithoutPrefix = matchingPrefix ? filename.slice(matchingPrefix.length) : filename;
|
2576
2573
|
return fnameWithoutPrefix.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/, '');
|
2577
2574
|
}
|
2578
2575
|
function getSrcFilename(line, srcPrefix) {
|
@@ -2581,37 +2578,36 @@ function getSrcFilename(line, srcPrefix) {
|
|
2581
2578
|
function getDstFilename(line, dstPrefix) {
|
2582
2579
|
return getFilename(line, '+++', dstPrefix);
|
2583
2580
|
}
|
2584
|
-
function parse(diffInput, config) {
|
2585
|
-
|
2586
|
-
|
2587
|
-
|
2588
|
-
|
2589
|
-
|
2590
|
-
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
|
2602
|
-
|
2603
|
-
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
var diffLines = diffInput
|
2581
|
+
function parse(diffInput, config = {}) {
|
2582
|
+
const files = [];
|
2583
|
+
let currentFile = null;
|
2584
|
+
let currentBlock = null;
|
2585
|
+
let oldLine = null;
|
2586
|
+
let oldLine2 = null;
|
2587
|
+
let newLine = null;
|
2588
|
+
let possibleOldName = null;
|
2589
|
+
let possibleNewName = null;
|
2590
|
+
const oldFileNameHeader = '--- ';
|
2591
|
+
const newFileNameHeader = '+++ ';
|
2592
|
+
const hunkHeaderPrefix = '@@';
|
2593
|
+
const oldMode = /^old mode (\d{6})/;
|
2594
|
+
const newMode = /^new mode (\d{6})/;
|
2595
|
+
const deletedFileMode = /^deleted file mode (\d{6})/;
|
2596
|
+
const newFileMode = /^new file mode (\d{6})/;
|
2597
|
+
const copyFrom = /^copy from "?(.+)"?/;
|
2598
|
+
const copyTo = /^copy to "?(.+)"?/;
|
2599
|
+
const renameFrom = /^rename from "?(.+)"?/;
|
2600
|
+
const renameTo = /^rename to "?(.+)"?/;
|
2601
|
+
const similarityIndex = /^similarity index (\d+)%/;
|
2602
|
+
const dissimilarityIndex = /^dissimilarity index (\d+)%/;
|
2603
|
+
const index = /^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/;
|
2604
|
+
const binaryFiles = /^Binary files (.*) and (.*) differ/;
|
2605
|
+
const binaryDiff = /^GIT binary patch/;
|
2606
|
+
const combinedIndex = /^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/;
|
2607
|
+
const combinedMode = /^mode (\d{6}),(\d{6})\.\.(\d{6})/;
|
2608
|
+
const combinedNewFile = /^new file mode (\d{6})/;
|
2609
|
+
const combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/;
|
2610
|
+
const diffLines = diffInput
|
2615
2611
|
.replace(/\/g, '')
|
2616
2612
|
.replace(/\r\n?/g, '\n')
|
2617
2613
|
.split('\n');
|
@@ -2648,7 +2644,7 @@ function parse(diffInput, config) {
|
|
2648
2644
|
}
|
2649
2645
|
function startBlock(line) {
|
2650
2646
|
saveBlock();
|
2651
|
-
|
2647
|
+
let values;
|
2652
2648
|
if (currentFile !== null) {
|
2653
2649
|
if ((values = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))) {
|
2654
2650
|
currentFile.isCombined = false;
|
@@ -2681,11 +2677,11 @@ function parse(diffInput, config) {
|
|
2681
2677
|
function createLine(line) {
|
2682
2678
|
if (currentFile === null || currentBlock === null || oldLine === null || newLine === null)
|
2683
2679
|
return;
|
2684
|
-
|
2680
|
+
const currentLine = {
|
2685
2681
|
content: line,
|
2686
2682
|
};
|
2687
|
-
|
2688
|
-
|
2683
|
+
const addedPrefixes = currentFile.isCombined ? ['+ ', ' +', '++'] : ['+'];
|
2684
|
+
const deletedPrefixes = currentFile.isCombined ? ['- ', ' -', '--'] : ['-'];
|
2689
2685
|
if (startsWithAny(line, addedPrefixes)) {
|
2690
2686
|
currentFile.addedLines++;
|
2691
2687
|
currentLine.type = LineType.INSERT;
|
@@ -2706,7 +2702,7 @@ function parse(diffInput, config) {
|
|
2706
2702
|
currentBlock.lines.push(currentLine);
|
2707
2703
|
}
|
2708
2704
|
function existHunkHeader(line, lineIdx) {
|
2709
|
-
|
2705
|
+
let idx = lineIdx;
|
2710
2706
|
while (idx < diffLines.length - 3) {
|
2711
2707
|
if (line.startsWith('diff')) {
|
2712
2708
|
return false;
|
@@ -2720,17 +2716,17 @@ function parse(diffInput, config) {
|
|
2720
2716
|
}
|
2721
2717
|
return false;
|
2722
2718
|
}
|
2723
|
-
diffLines.forEach(
|
2719
|
+
diffLines.forEach((line, lineIndex) => {
|
2724
2720
|
if (!line || line.startsWith('*')) {
|
2725
2721
|
return;
|
2726
2722
|
}
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2723
|
+
let values;
|
2724
|
+
const prevLine = diffLines[lineIndex - 1];
|
2725
|
+
const nxtLine = diffLines[lineIndex + 1];
|
2726
|
+
const afterNxtLine = diffLines[lineIndex + 2];
|
2731
2727
|
if (line.startsWith('diff --git') || line.startsWith('diff --combined')) {
|
2732
2728
|
startFile();
|
2733
|
-
|
2729
|
+
const gitDiffStart = /^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/;
|
2734
2730
|
if ((values = gitDiffStart.exec(line))) {
|
2735
2731
|
possibleOldName = getFilename(values[1], undefined, config.dstPrefix);
|
2736
2732
|
possibleNewName = getFilename(values[2], undefined, config.srcPrefix);
|
@@ -2743,7 +2739,7 @@ function parse(diffInput, config) {
|
|
2743
2739
|
}
|
2744
2740
|
if (line.startsWith('Binary files') && !(currentFile === null || currentFile === void 0 ? void 0 : currentFile.isGitDiff)) {
|
2745
2741
|
startFile();
|
2746
|
-
|
2742
|
+
const unixDiffBinaryStart = /^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/;
|
2747
2743
|
if ((values = unixDiffBinaryStart.exec(line))) {
|
2748
2744
|
possibleOldName = getFilename(values[1], undefined, config.dstPrefix);
|
2749
2745
|
possibleNewName = getFilename(values[2], undefined, config.srcPrefix);
|
@@ -2774,7 +2770,7 @@ function parse(diffInput, config) {
|
|
2774
2770
|
currentFile.deletedLines = 0;
|
2775
2771
|
currentFile.blocks = [];
|
2776
2772
|
currentBlock = null;
|
2777
|
-
|
2773
|
+
const message = typeof config.diffTooBigMessage === 'function'
|
2778
2774
|
? config.diffTooBigMessage(files.length)
|
2779
2775
|
: 'Diff too big to be displayed';
|
2780
2776
|
startBlock(message);
|
@@ -2809,7 +2805,7 @@ function parse(diffInput, config) {
|
|
2809
2805
|
createLine(line);
|
2810
2806
|
return;
|
2811
2807
|
}
|
2812
|
-
|
2808
|
+
const doesNotExistHunkHeader = !existHunkHeader(line, lineIndex);
|
2813
2809
|
if (currentFile === null) {
|
2814
2810
|
throw new Error('Where is my file !!!');
|
2815
2811
|
}
|
@@ -4465,12 +4461,12 @@ function levenshtein(a, b) {
|
|
4465
4461
|
if (b.length === 0) {
|
4466
4462
|
return a.length;
|
4467
4463
|
}
|
4468
|
-
|
4469
|
-
|
4464
|
+
const matrix = [];
|
4465
|
+
let i;
|
4470
4466
|
for (i = 0; i <= b.length; i++) {
|
4471
4467
|
matrix[i] = [i];
|
4472
4468
|
}
|
4473
|
-
|
4469
|
+
let j;
|
4474
4470
|
for (j = 0; j <= a.length; j++) {
|
4475
4471
|
matrix[0][j] = j;
|
4476
4472
|
}
|
@@ -4487,22 +4483,21 @@ function levenshtein(a, b) {
|
|
4487
4483
|
return matrix[b.length][a.length];
|
4488
4484
|
}
|
4489
4485
|
function newDistanceFn(str) {
|
4490
|
-
return
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4486
|
+
return (x, y) => {
|
4487
|
+
const xValue = str(x).trim();
|
4488
|
+
const yValue = str(y).trim();
|
4489
|
+
const lev = levenshtein(xValue, yValue);
|
4494
4490
|
return lev / (xValue.length + yValue.length);
|
4495
4491
|
};
|
4496
4492
|
}
|
4497
4493
|
function newMatcherFn(distance) {
|
4498
|
-
function findBestMatch(a, b, cache) {
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
var md = void 0;
|
4494
|
+
function findBestMatch(a, b, cache = new Map()) {
|
4495
|
+
let bestMatchDist = Infinity;
|
4496
|
+
let bestMatch;
|
4497
|
+
for (let i = 0; i < a.length; ++i) {
|
4498
|
+
for (let j = 0; j < b.length; ++j) {
|
4499
|
+
const cacheKey = JSON.stringify([a[i], b[j]]);
|
4500
|
+
let md;
|
4506
4501
|
if (!(cache.has(cacheKey) && (md = cache.get(cacheKey)))) {
|
4507
4502
|
md = distance(a[i], b[j]);
|
4508
4503
|
cache.set(cacheKey, md);
|
@@ -4515,25 +4510,23 @@ function newMatcherFn(distance) {
|
|
4515
4510
|
}
|
4516
4511
|
return bestMatch;
|
4517
4512
|
}
|
4518
|
-
function group(a, b, level, cache) {
|
4519
|
-
|
4520
|
-
if (cache === void 0) { cache = new Map(); }
|
4521
|
-
var bm = findBestMatch(a, b, cache);
|
4513
|
+
function group(a, b, level = 0, cache = new Map()) {
|
4514
|
+
const bm = findBestMatch(a, b, cache);
|
4522
4515
|
if (!bm || a.length + b.length < 3) {
|
4523
4516
|
return [[a, b]];
|
4524
4517
|
}
|
4525
|
-
|
4526
|
-
|
4527
|
-
|
4528
|
-
|
4529
|
-
|
4530
|
-
|
4531
|
-
|
4532
|
-
|
4533
|
-
|
4534
|
-
|
4535
|
-
|
4536
|
-
|
4518
|
+
const a1 = a.slice(0, bm.indexA);
|
4519
|
+
const b1 = b.slice(0, bm.indexB);
|
4520
|
+
const aMatch = [a[bm.indexA]];
|
4521
|
+
const bMatch = [b[bm.indexB]];
|
4522
|
+
const tailA = bm.indexA + 1;
|
4523
|
+
const tailB = bm.indexB + 1;
|
4524
|
+
const a2 = a.slice(tailA);
|
4525
|
+
const b2 = b.slice(tailB);
|
4526
|
+
const group1 = group(a1, b1, level + 1, cache);
|
4527
|
+
const groupMatch = group(aMatch, bMatch, level + 1, cache);
|
4528
|
+
const group2 = group(a2, b2, level + 1, cache);
|
4529
|
+
let result = groupMatch;
|
4537
4530
|
if (bm.indexA > 0 || bm.indexB > 0) {
|
4538
4531
|
result = group1.concat(result);
|
4539
4532
|
}
|
@@ -4546,22 +4539,11 @@ function newMatcherFn(distance) {
|
|
4546
4539
|
}
|
4547
4540
|
//# sourceMappingURL=rematch.js.map
|
4548
4541
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/render-utils.js
|
4549
|
-
var __assign = (undefined && undefined.__assign) || function () {
|
4550
|
-
__assign = Object.assign || function(t) {
|
4551
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4552
|
-
s = arguments[i];
|
4553
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
4554
|
-
t[p] = s[p];
|
4555
|
-
}
|
4556
|
-
return t;
|
4557
|
-
};
|
4558
|
-
return __assign.apply(this, arguments);
|
4559
|
-
};
|
4560
4542
|
|
4561
4543
|
|
4562
4544
|
|
4563
4545
|
|
4564
|
-
|
4546
|
+
const CSSLineClass = {
|
4565
4547
|
INSERTS: 'd2h-ins',
|
4566
4548
|
DELETES: 'd2h-del',
|
4567
4549
|
CONTEXT: 'd2h-cntx',
|
@@ -4569,15 +4551,16 @@ var CSSLineClass = {
|
|
4569
4551
|
INSERT_CHANGES: 'd2h-ins d2h-change',
|
4570
4552
|
DELETE_CHANGES: 'd2h-del d2h-change',
|
4571
4553
|
};
|
4572
|
-
|
4554
|
+
const defaultRenderConfig = {
|
4573
4555
|
matching: LineMatchingType.NONE,
|
4574
4556
|
matchWordsThreshold: 0.25,
|
4575
4557
|
maxLineLengthHighlight: 10000,
|
4576
4558
|
diffStyle: DiffStyleType.WORD,
|
4559
|
+
colorScheme: ColorSchemeType.LIGHT,
|
4577
4560
|
};
|
4578
|
-
|
4579
|
-
|
4580
|
-
|
4561
|
+
const separator = '/';
|
4562
|
+
const distance = newDistanceFn((change) => change.value);
|
4563
|
+
const matcher = newMatcherFn(distance);
|
4581
4564
|
function isDevNullName(name) {
|
4582
4565
|
return name.indexOf('dev/null') !== -1;
|
4583
4566
|
}
|
@@ -4597,6 +4580,17 @@ function toCSSClass(lineType) {
|
|
4597
4580
|
return CSSLineClass.DELETES;
|
4598
4581
|
}
|
4599
4582
|
}
|
4583
|
+
function colorSchemeToCss(colorScheme) {
|
4584
|
+
switch (colorScheme) {
|
4585
|
+
case ColorSchemeType.DARK:
|
4586
|
+
return 'd2h-dark-color-scheme';
|
4587
|
+
case ColorSchemeType.AUTO:
|
4588
|
+
return 'd2h-auto-color-scheme';
|
4589
|
+
case ColorSchemeType.LIGHT:
|
4590
|
+
default:
|
4591
|
+
return 'd2h-light-color-scheme';
|
4592
|
+
}
|
4593
|
+
}
|
4600
4594
|
function prefixLength(isCombined) {
|
4601
4595
|
return isCombined ? 2 : 1;
|
4602
4596
|
}
|
@@ -4610,27 +4604,26 @@ function escapeForHtml(str) {
|
|
4610
4604
|
.replace(/'/g, ''')
|
4611
4605
|
.replace(/\//g, '/');
|
4612
4606
|
}
|
4613
|
-
function deconstructLine(line, isCombined, escape) {
|
4614
|
-
|
4615
|
-
var indexToSplit = prefixLength(isCombined);
|
4607
|
+
function deconstructLine(line, isCombined, escape = true) {
|
4608
|
+
const indexToSplit = prefixLength(isCombined);
|
4616
4609
|
return {
|
4617
4610
|
prefix: line.substring(0, indexToSplit),
|
4618
4611
|
content: escape ? escapeForHtml(line.substring(indexToSplit)) : line.substring(indexToSplit),
|
4619
4612
|
};
|
4620
4613
|
}
|
4621
4614
|
function filenameDiff(file) {
|
4622
|
-
|
4623
|
-
|
4615
|
+
const oldFilename = unifyPath(file.oldName);
|
4616
|
+
const newFilename = unifyPath(file.newName);
|
4624
4617
|
if (oldFilename !== newFilename && !isDevNullName(oldFilename) && !isDevNullName(newFilename)) {
|
4625
|
-
|
4626
|
-
|
4627
|
-
|
4628
|
-
|
4629
|
-
|
4630
|
-
|
4631
|
-
|
4632
|
-
|
4633
|
-
|
4618
|
+
const prefixPaths = [];
|
4619
|
+
const suffixPaths = [];
|
4620
|
+
const oldFilenameParts = oldFilename.split(separator);
|
4621
|
+
const newFilenameParts = newFilename.split(separator);
|
4622
|
+
const oldFilenamePartsSize = oldFilenameParts.length;
|
4623
|
+
const newFilenamePartsSize = newFilenameParts.length;
|
4624
|
+
let i = 0;
|
4625
|
+
let j = oldFilenamePartsSize - 1;
|
4626
|
+
let k = newFilenamePartsSize - 1;
|
4634
4627
|
while (i < j && i < k) {
|
4635
4628
|
if (oldFilenameParts[i] === newFilenameParts[i]) {
|
4636
4629
|
prefixPaths.push(newFilenameParts[i]);
|
@@ -4650,10 +4643,10 @@ function filenameDiff(file) {
|
|
4650
4643
|
break;
|
4651
4644
|
}
|
4652
4645
|
}
|
4653
|
-
|
4654
|
-
|
4655
|
-
|
4656
|
-
|
4646
|
+
const finalPrefix = prefixPaths.join(separator);
|
4647
|
+
const finalSuffix = suffixPaths.join(separator);
|
4648
|
+
const oldRemainingPath = oldFilenameParts.slice(i, j + 1).join(separator);
|
4649
|
+
const newRemainingPath = newFilenameParts.slice(i, k + 1).join(separator);
|
4657
4650
|
if (finalPrefix.length && finalSuffix.length) {
|
4658
4651
|
return (finalPrefix + separator + '{' + oldRemainingPath + ' → ' + newRemainingPath + '}' + separator + finalSuffix);
|
4659
4652
|
}
|
@@ -4673,10 +4666,10 @@ function filenameDiff(file) {
|
|
4673
4666
|
}
|
4674
4667
|
}
|
4675
4668
|
function getHtmlId(file) {
|
4676
|
-
return
|
4669
|
+
return `d2h-${hashCode(filenameDiff(file)).toString().slice(-6)}`;
|
4677
4670
|
}
|
4678
4671
|
function getFileIcon(file) {
|
4679
|
-
|
4672
|
+
let templateName = 'file-changed';
|
4680
4673
|
if (file.isRename) {
|
4681
4674
|
templateName = 'file-renamed';
|
4682
4675
|
}
|
@@ -4694,11 +4687,10 @@ function getFileIcon(file) {
|
|
4694
4687
|
}
|
4695
4688
|
return templateName;
|
4696
4689
|
}
|
4697
|
-
function diffHighlight(diffLine1, diffLine2, isCombined, config) {
|
4698
|
-
|
4699
|
-
|
4700
|
-
|
4701
|
-
var line2 = deconstructLine(diffLine2, isCombined, false);
|
4690
|
+
function diffHighlight(diffLine1, diffLine2, isCombined, config = {}) {
|
4691
|
+
const { matching, maxLineLengthHighlight, matchWordsThreshold, diffStyle } = Object.assign(Object.assign({}, defaultRenderConfig), config);
|
4692
|
+
const line1 = deconstructLine(diffLine1, isCombined, false);
|
4693
|
+
const line2 = deconstructLine(diffLine2, isCombined, false);
|
4702
4694
|
if (line1.content.length > maxLineLengthHighlight || line2.content.length > maxLineLengthHighlight) {
|
4703
4695
|
return {
|
4704
4696
|
oldLine: {
|
@@ -4711,17 +4703,17 @@ function diffHighlight(diffLine1, diffLine2, isCombined, config) {
|
|
4711
4703
|
},
|
4712
4704
|
};
|
4713
4705
|
}
|
4714
|
-
|
4706
|
+
const diff = diffStyle === 'char'
|
4715
4707
|
? lib_diffChars(line1.content, line2.content)
|
4716
4708
|
: lib_diffWordsWithSpace(line1.content, line2.content);
|
4717
|
-
|
4709
|
+
const changedWords = [];
|
4718
4710
|
if (diffStyle === 'word' && matching === 'words') {
|
4719
|
-
|
4720
|
-
|
4721
|
-
|
4722
|
-
chunks.forEach(
|
4711
|
+
const removed = diff.filter(element => element.removed);
|
4712
|
+
const added = diff.filter(element => element.added);
|
4713
|
+
const chunks = matcher(added, removed);
|
4714
|
+
chunks.forEach(chunk => {
|
4723
4715
|
if (chunk[0].length === 1 && chunk[1].length === 1) {
|
4724
|
-
|
4716
|
+
const dist = distance(chunk[0][0], chunk[1][0]);
|
4725
4717
|
if (dist < matchWordsThreshold) {
|
4726
4718
|
changedWords.push(chunk[0][0]);
|
4727
4719
|
changedWords.push(chunk[1][0]);
|
@@ -4729,13 +4721,13 @@ function diffHighlight(diffLine1, diffLine2, isCombined, config) {
|
|
4729
4721
|
}
|
4730
4722
|
});
|
4731
4723
|
}
|
4732
|
-
|
4733
|
-
|
4734
|
-
|
4735
|
-
|
4724
|
+
const highlightedLine = diff.reduce((highlightedLine, part) => {
|
4725
|
+
const elemType = part.added ? 'ins' : part.removed ? 'del' : null;
|
4726
|
+
const addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : '';
|
4727
|
+
const escapedValue = escapeForHtml(part.value);
|
4736
4728
|
return elemType !== null
|
4737
|
-
?
|
4738
|
-
:
|
4729
|
+
? `${highlightedLine}<${elemType}${addClass}>${escapedValue}</${elemType}>`
|
4730
|
+
: `${highlightedLine}${escapedValue}`;
|
4739
4731
|
}, '');
|
4740
4732
|
return {
|
4741
4733
|
oldLine: {
|
@@ -4751,12 +4743,19 @@ function diffHighlight(diffLine1, diffLine2, isCombined, config) {
|
|
4751
4743
|
//# sourceMappingURL=render-utils.js.map
|
4752
4744
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/file-list-renderer.js
|
4753
4745
|
|
4754
|
-
|
4755
|
-
|
4756
|
-
|
4757
|
-
|
4758
|
-
|
4759
|
-
|
4746
|
+
const baseTemplatesPath = 'file-summary';
|
4747
|
+
const iconsBaseTemplatesPath = 'icon';
|
4748
|
+
const defaultFileListRendererConfig = {
|
4749
|
+
colorScheme: defaultRenderConfig.colorScheme,
|
4750
|
+
};
|
4751
|
+
class FileListRenderer {
|
4752
|
+
constructor(hoganUtils, config = {}) {
|
4753
|
+
this.hoganUtils = hoganUtils;
|
4754
|
+
this.config = Object.assign(Object.assign({}, defaultFileListRendererConfig), config);
|
4755
|
+
}
|
4756
|
+
render(diffFiles) {
|
4757
|
+
const files = diffFiles
|
4758
|
+
.map(file => this.hoganUtils.render(baseTemplatesPath, 'line', {
|
4760
4759
|
fileHtmlId: getHtmlId(file),
|
4761
4760
|
oldName: file.oldName,
|
4762
4761
|
newName: file.newName,
|
@@ -4764,65 +4763,56 @@ function render(diffFiles, hoganUtils) {
|
|
4764
4763
|
deletedLines: '-' + file.deletedLines,
|
4765
4764
|
addedLines: '+' + file.addedLines,
|
4766
4765
|
}, {
|
4767
|
-
fileIcon: hoganUtils.template(iconsBaseTemplatesPath, getFileIcon(file)),
|
4766
|
+
fileIcon: this.hoganUtils.template(iconsBaseTemplatesPath, getFileIcon(file)),
|
4767
|
+
}))
|
4768
|
+
.join('\n');
|
4769
|
+
return this.hoganUtils.render(baseTemplatesPath, 'wrapper', {
|
4770
|
+
colorScheme: colorSchemeToCss(this.config.colorScheme),
|
4771
|
+
filesNumber: diffFiles.length,
|
4772
|
+
files: files,
|
4768
4773
|
});
|
4769
|
-
}
|
4770
|
-
.join('\n');
|
4771
|
-
return hoganUtils.render(baseTemplatesPath, 'wrapper', {
|
4772
|
-
filesNumber: diffFiles.length,
|
4773
|
-
files: files,
|
4774
|
-
});
|
4774
|
+
}
|
4775
4775
|
}
|
4776
4776
|
//# sourceMappingURL=file-list-renderer.js.map
|
4777
4777
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/line-by-line-renderer.js
|
4778
|
-
var line_by_line_renderer_assign = (undefined && undefined.__assign) || function () {
|
4779
|
-
line_by_line_renderer_assign = Object.assign || function(t) {
|
4780
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4781
|
-
s = arguments[i];
|
4782
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
4783
|
-
t[p] = s[p];
|
4784
|
-
}
|
4785
|
-
return t;
|
4786
|
-
};
|
4787
|
-
return line_by_line_renderer_assign.apply(this, arguments);
|
4788
|
-
};
|
4789
4778
|
|
4790
4779
|
|
4791
4780
|
|
4792
|
-
|
4793
|
-
|
4794
|
-
|
4795
|
-
|
4796
|
-
|
4797
|
-
|
4798
|
-
|
4799
|
-
if (config === void 0) { config = {}; }
|
4781
|
+
const defaultLineByLineRendererConfig = Object.assign(Object.assign({}, defaultRenderConfig), { renderNothingWhenEmpty: false, matchingMaxComparisons: 2500, maxLineSizeInBlockForComparison: 200 });
|
4782
|
+
const genericTemplatesPath = 'generic';
|
4783
|
+
const line_by_line_renderer_baseTemplatesPath = 'line-by-line';
|
4784
|
+
const line_by_line_renderer_iconsBaseTemplatesPath = 'icon';
|
4785
|
+
const tagsBaseTemplatesPath = 'tag';
|
4786
|
+
class LineByLineRenderer {
|
4787
|
+
constructor(hoganUtils, config = {}) {
|
4800
4788
|
this.hoganUtils = hoganUtils;
|
4801
|
-
this.config =
|
4789
|
+
this.config = Object.assign(Object.assign({}, defaultLineByLineRendererConfig), config);
|
4802
4790
|
}
|
4803
|
-
|
4804
|
-
|
4805
|
-
|
4806
|
-
|
4807
|
-
var diffs;
|
4791
|
+
render(diffFiles) {
|
4792
|
+
const diffsHtml = diffFiles
|
4793
|
+
.map(file => {
|
4794
|
+
let diffs;
|
4808
4795
|
if (file.blocks.length) {
|
4809
|
-
diffs =
|
4796
|
+
diffs = this.generateFileHtml(file);
|
4810
4797
|
}
|
4811
4798
|
else {
|
4812
|
-
diffs =
|
4799
|
+
diffs = this.generateEmptyDiff();
|
4813
4800
|
}
|
4814
|
-
return
|
4801
|
+
return this.makeFileDiffHtml(file, diffs);
|
4815
4802
|
})
|
4816
4803
|
.join('\n');
|
4817
|
-
return this.hoganUtils.render(genericTemplatesPath, 'wrapper', {
|
4818
|
-
|
4819
|
-
|
4804
|
+
return this.hoganUtils.render(genericTemplatesPath, 'wrapper', {
|
4805
|
+
colorScheme: colorSchemeToCss(this.config.colorScheme),
|
4806
|
+
content: diffsHtml,
|
4807
|
+
});
|
4808
|
+
}
|
4809
|
+
makeFileDiffHtml(file, diffs) {
|
4820
4810
|
if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0)
|
4821
4811
|
return '';
|
4822
|
-
|
4823
|
-
|
4824
|
-
|
4825
|
-
|
4812
|
+
const fileDiffTemplate = this.hoganUtils.template(line_by_line_renderer_baseTemplatesPath, 'file-diff');
|
4813
|
+
const filePathTemplate = this.hoganUtils.template(genericTemplatesPath, 'file-path');
|
4814
|
+
const fileIconTemplate = this.hoganUtils.template(line_by_line_renderer_iconsBaseTemplatesPath, 'file');
|
4815
|
+
const fileTagTemplate = this.hoganUtils.template(tagsBaseTemplatesPath, getFileIcon(file));
|
4826
4816
|
return fileDiffTemplate.render({
|
4827
4817
|
file: file,
|
4828
4818
|
fileHtmlId: getHtmlId(file),
|
@@ -4834,38 +4824,35 @@ var LineByLineRenderer = (function () {
|
|
4834
4824
|
fileTag: fileTagTemplate,
|
4835
4825
|
}),
|
4836
4826
|
});
|
4837
|
-
}
|
4838
|
-
|
4827
|
+
}
|
4828
|
+
generateEmptyDiff() {
|
4839
4829
|
return this.hoganUtils.render(genericTemplatesPath, 'empty-diff', {
|
4840
4830
|
contentClass: 'd2h-code-line',
|
4841
4831
|
CSSLineClass: CSSLineClass,
|
4842
4832
|
});
|
4843
|
-
}
|
4844
|
-
|
4845
|
-
|
4846
|
-
var matcher = newMatcherFn(newDistanceFn(function (e) { return deconstructLine(e.content, file.isCombined).content; }));
|
4833
|
+
}
|
4834
|
+
generateFileHtml(file) {
|
4835
|
+
const matcher = newMatcherFn(newDistanceFn((e) => deconstructLine(e.content, file.isCombined).content));
|
4847
4836
|
return file.blocks
|
4848
|
-
.map(
|
4849
|
-
|
4837
|
+
.map(block => {
|
4838
|
+
let lines = this.hoganUtils.render(genericTemplatesPath, 'block-header', {
|
4850
4839
|
CSSLineClass: CSSLineClass,
|
4851
4840
|
blockHeader: file.isTooBig ? block.header : escapeForHtml(block.header),
|
4852
4841
|
lineClass: 'd2h-code-linenumber',
|
4853
4842
|
contentClass: 'd2h-code-line',
|
4854
4843
|
});
|
4855
|
-
|
4856
|
-
var contextLines = _a[0], oldLines = _a[1], newLines = _a[2];
|
4844
|
+
this.applyLineGroupping(block).forEach(([contextLines, oldLines, newLines]) => {
|
4857
4845
|
if (oldLines.length && newLines.length && !contextLines.length) {
|
4858
|
-
|
4859
|
-
|
4860
|
-
var _b = _this.processChangedLines(file, file.isCombined, oldLines, newLines), left = _b.left, right = _b.right;
|
4846
|
+
this.applyRematchMatching(oldLines, newLines, matcher).map(([oldLines, newLines]) => {
|
4847
|
+
const { left, right } = this.processChangedLines(file, file.isCombined, oldLines, newLines);
|
4861
4848
|
lines += left;
|
4862
4849
|
lines += right;
|
4863
4850
|
});
|
4864
4851
|
}
|
4865
4852
|
else if (contextLines.length) {
|
4866
|
-
contextLines.forEach(
|
4867
|
-
|
4868
|
-
lines +=
|
4853
|
+
contextLines.forEach(line => {
|
4854
|
+
const { prefix, content } = deconstructLine(line.content, file.isCombined);
|
4855
|
+
lines += this.generateSingleLineHtml(file, {
|
4869
4856
|
type: CSSLineClass.CONTEXT,
|
4870
4857
|
prefix: prefix,
|
4871
4858
|
content: content,
|
@@ -4875,7 +4862,7 @@ var LineByLineRenderer = (function () {
|
|
4875
4862
|
});
|
4876
4863
|
}
|
4877
4864
|
else if (oldLines.length || newLines.length) {
|
4878
|
-
|
4865
|
+
const { left, right } = this.processChangedLines(file, file.isCombined, oldLines, newLines);
|
4879
4866
|
lines += left;
|
4880
4867
|
lines += right;
|
4881
4868
|
}
|
@@ -4886,13 +4873,13 @@ var LineByLineRenderer = (function () {
|
|
4886
4873
|
return lines;
|
4887
4874
|
})
|
4888
4875
|
.join('\n');
|
4889
|
-
}
|
4890
|
-
|
4891
|
-
|
4892
|
-
|
4893
|
-
|
4894
|
-
for (
|
4895
|
-
|
4876
|
+
}
|
4877
|
+
applyLineGroupping(block) {
|
4878
|
+
const blockLinesGroups = [];
|
4879
|
+
let oldLines = [];
|
4880
|
+
let newLines = [];
|
4881
|
+
for (let i = 0; i < block.lines.length; i++) {
|
4882
|
+
const diffLine = block.lines[i];
|
4896
4883
|
if ((diffLine.type !== LineType.INSERT && newLines.length) ||
|
4897
4884
|
(diffLine.type === LineType.CONTEXT && oldLines.length > 0)) {
|
4898
4885
|
blockLinesGroups.push([[], oldLines, newLines]);
|
@@ -4918,59 +4905,59 @@ var LineByLineRenderer = (function () {
|
|
4918
4905
|
newLines = [];
|
4919
4906
|
}
|
4920
4907
|
return blockLinesGroups;
|
4921
|
-
}
|
4922
|
-
|
4923
|
-
|
4924
|
-
|
4925
|
-
|
4908
|
+
}
|
4909
|
+
applyRematchMatching(oldLines, newLines, matcher) {
|
4910
|
+
const comparisons = oldLines.length * newLines.length;
|
4911
|
+
const maxLineSizeInBlock = Math.max.apply(null, [0].concat(oldLines.concat(newLines).map(elem => elem.content.length)));
|
4912
|
+
const doMatching = comparisons < this.config.matchingMaxComparisons &&
|
4926
4913
|
maxLineSizeInBlock < this.config.maxLineSizeInBlockForComparison &&
|
4927
4914
|
(this.config.matching === 'lines' || this.config.matching === 'words');
|
4928
4915
|
return doMatching ? matcher(oldLines, newLines) : [[oldLines, newLines]];
|
4929
|
-
}
|
4930
|
-
|
4931
|
-
|
4916
|
+
}
|
4917
|
+
processChangedLines(file, isCombined, oldLines, newLines) {
|
4918
|
+
const fileHtml = {
|
4932
4919
|
right: '',
|
4933
4920
|
left: '',
|
4934
4921
|
};
|
4935
|
-
|
4936
|
-
for (
|
4937
|
-
|
4938
|
-
|
4939
|
-
|
4922
|
+
const maxLinesNumber = Math.max(oldLines.length, newLines.length);
|
4923
|
+
for (let i = 0; i < maxLinesNumber; i++) {
|
4924
|
+
const oldLine = oldLines[i];
|
4925
|
+
const newLine = newLines[i];
|
4926
|
+
const diff = oldLine !== undefined && newLine !== undefined
|
4940
4927
|
? diffHighlight(oldLine.content, newLine.content, isCombined, this.config)
|
4941
4928
|
: undefined;
|
4942
|
-
|
4943
|
-
?
|
4929
|
+
const preparedOldLine = oldLine !== undefined && oldLine.oldNumber !== undefined
|
4930
|
+
? Object.assign(Object.assign({}, (diff !== undefined
|
4944
4931
|
? {
|
4945
4932
|
prefix: diff.oldLine.prefix,
|
4946
4933
|
content: diff.oldLine.content,
|
4947
4934
|
type: CSSLineClass.DELETE_CHANGES,
|
4948
4935
|
}
|
4949
|
-
:
|
4950
|
-
|
4951
|
-
?
|
4936
|
+
: Object.assign(Object.assign({}, deconstructLine(oldLine.content, isCombined)), { type: toCSSClass(oldLine.type) }))), { oldNumber: oldLine.oldNumber, newNumber: oldLine.newNumber }) : undefined;
|
4937
|
+
const preparedNewLine = newLine !== undefined && newLine.newNumber !== undefined
|
4938
|
+
? Object.assign(Object.assign({}, (diff !== undefined
|
4952
4939
|
? {
|
4953
4940
|
prefix: diff.newLine.prefix,
|
4954
4941
|
content: diff.newLine.content,
|
4955
4942
|
type: CSSLineClass.INSERT_CHANGES,
|
4956
4943
|
}
|
4957
|
-
:
|
4958
|
-
|
4944
|
+
: Object.assign(Object.assign({}, deconstructLine(newLine.content, isCombined)), { type: toCSSClass(newLine.type) }))), { oldNumber: newLine.oldNumber, newNumber: newLine.newNumber }) : undefined;
|
4945
|
+
const { left, right } = this.generateLineHtml(file, preparedOldLine, preparedNewLine);
|
4959
4946
|
fileHtml.left += left;
|
4960
4947
|
fileHtml.right += right;
|
4961
4948
|
}
|
4962
4949
|
return fileHtml;
|
4963
|
-
}
|
4964
|
-
|
4950
|
+
}
|
4951
|
+
generateLineHtml(file, oldLine, newLine) {
|
4965
4952
|
return {
|
4966
4953
|
left: this.generateSingleLineHtml(file, oldLine),
|
4967
4954
|
right: this.generateSingleLineHtml(file, newLine),
|
4968
4955
|
};
|
4969
|
-
}
|
4970
|
-
|
4956
|
+
}
|
4957
|
+
generateSingleLineHtml(file, line) {
|
4971
4958
|
if (line === undefined)
|
4972
4959
|
return '';
|
4973
|
-
|
4960
|
+
const lineNumberHtml = this.hoganUtils.render(line_by_line_renderer_baseTemplatesPath, 'numbers', {
|
4974
4961
|
oldNumber: line.oldNumber || '',
|
4975
4962
|
newNumber: line.newNumber || '',
|
4976
4963
|
});
|
@@ -4981,63 +4968,51 @@ var LineByLineRenderer = (function () {
|
|
4981
4968
|
prefix: line.prefix === ' ' ? ' ' : line.prefix,
|
4982
4969
|
content: line.content,
|
4983
4970
|
lineNumber: lineNumberHtml,
|
4984
|
-
line
|
4985
|
-
file
|
4971
|
+
line,
|
4972
|
+
file,
|
4986
4973
|
});
|
4987
|
-
}
|
4988
|
-
|
4989
|
-
}());
|
4990
|
-
/* harmony default export */ const line_by_line_renderer = (LineByLineRenderer);
|
4974
|
+
}
|
4975
|
+
}
|
4991
4976
|
//# sourceMappingURL=line-by-line-renderer.js.map
|
4992
4977
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/side-by-side-renderer.js
|
4993
|
-
var side_by_side_renderer_assign = (undefined && undefined.__assign) || function () {
|
4994
|
-
side_by_side_renderer_assign = Object.assign || function(t) {
|
4995
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
4996
|
-
s = arguments[i];
|
4997
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
4998
|
-
t[p] = s[p];
|
4999
|
-
}
|
5000
|
-
return t;
|
5001
|
-
};
|
5002
|
-
return side_by_side_renderer_assign.apply(this, arguments);
|
5003
|
-
};
|
5004
4978
|
|
5005
4979
|
|
5006
4980
|
|
5007
|
-
|
5008
|
-
|
5009
|
-
|
5010
|
-
|
5011
|
-
|
5012
|
-
|
5013
|
-
|
5014
|
-
if (config === void 0) { config = {}; }
|
4981
|
+
const defaultSideBySideRendererConfig = Object.assign(Object.assign({}, defaultRenderConfig), { renderNothingWhenEmpty: false, matchingMaxComparisons: 2500, maxLineSizeInBlockForComparison: 200 });
|
4982
|
+
const side_by_side_renderer_genericTemplatesPath = 'generic';
|
4983
|
+
const side_by_side_renderer_baseTemplatesPath = 'side-by-side';
|
4984
|
+
const side_by_side_renderer_iconsBaseTemplatesPath = 'icon';
|
4985
|
+
const side_by_side_renderer_tagsBaseTemplatesPath = 'tag';
|
4986
|
+
class SideBySideRenderer {
|
4987
|
+
constructor(hoganUtils, config = {}) {
|
5015
4988
|
this.hoganUtils = hoganUtils;
|
5016
|
-
this.config =
|
4989
|
+
this.config = Object.assign(Object.assign({}, defaultSideBySideRendererConfig), config);
|
5017
4990
|
}
|
5018
|
-
|
5019
|
-
|
5020
|
-
|
5021
|
-
|
5022
|
-
var diffs;
|
4991
|
+
render(diffFiles) {
|
4992
|
+
const diffsHtml = diffFiles
|
4993
|
+
.map(file => {
|
4994
|
+
let diffs;
|
5023
4995
|
if (file.blocks.length) {
|
5024
|
-
diffs =
|
4996
|
+
diffs = this.generateFileHtml(file);
|
5025
4997
|
}
|
5026
4998
|
else {
|
5027
|
-
diffs =
|
4999
|
+
diffs = this.generateEmptyDiff();
|
5028
5000
|
}
|
5029
|
-
return
|
5001
|
+
return this.makeFileDiffHtml(file, diffs);
|
5030
5002
|
})
|
5031
5003
|
.join('\n');
|
5032
|
-
return this.hoganUtils.render(side_by_side_renderer_genericTemplatesPath, 'wrapper', {
|
5033
|
-
|
5034
|
-
|
5004
|
+
return this.hoganUtils.render(side_by_side_renderer_genericTemplatesPath, 'wrapper', {
|
5005
|
+
colorScheme: colorSchemeToCss(this.config.colorScheme),
|
5006
|
+
content: diffsHtml,
|
5007
|
+
});
|
5008
|
+
}
|
5009
|
+
makeFileDiffHtml(file, diffs) {
|
5035
5010
|
if (this.config.renderNothingWhenEmpty && Array.isArray(file.blocks) && file.blocks.length === 0)
|
5036
5011
|
return '';
|
5037
|
-
|
5038
|
-
|
5039
|
-
|
5040
|
-
|
5012
|
+
const fileDiffTemplate = this.hoganUtils.template(side_by_side_renderer_baseTemplatesPath, 'file-diff');
|
5013
|
+
const filePathTemplate = this.hoganUtils.template(side_by_side_renderer_genericTemplatesPath, 'file-path');
|
5014
|
+
const fileIconTemplate = this.hoganUtils.template(side_by_side_renderer_iconsBaseTemplatesPath, 'file');
|
5015
|
+
const fileTagTemplate = this.hoganUtils.template(side_by_side_renderer_tagsBaseTemplatesPath, getFileIcon(file));
|
5041
5016
|
return fileDiffTemplate.render({
|
5042
5017
|
file: file,
|
5043
5018
|
fileHtmlId: getHtmlId(file),
|
@@ -5049,8 +5024,8 @@ var SideBySideRenderer = (function () {
|
|
5049
5024
|
fileTag: fileTagTemplate,
|
5050
5025
|
}),
|
5051
5026
|
});
|
5052
|
-
}
|
5053
|
-
|
5027
|
+
}
|
5028
|
+
generateEmptyDiff() {
|
5054
5029
|
return {
|
5055
5030
|
right: '',
|
5056
5031
|
left: this.hoganUtils.render(side_by_side_renderer_genericTemplatesPath, 'empty-diff', {
|
@@ -5058,30 +5033,27 @@ var SideBySideRenderer = (function () {
|
|
5058
5033
|
CSSLineClass: CSSLineClass,
|
5059
5034
|
}),
|
5060
5035
|
};
|
5061
|
-
}
|
5062
|
-
|
5063
|
-
|
5064
|
-
var matcher = newMatcherFn(newDistanceFn(function (e) { return deconstructLine(e.content, file.isCombined).content; }));
|
5036
|
+
}
|
5037
|
+
generateFileHtml(file) {
|
5038
|
+
const matcher = newMatcherFn(newDistanceFn((e) => deconstructLine(e.content, file.isCombined).content));
|
5065
5039
|
return file.blocks
|
5066
|
-
.map(
|
5067
|
-
|
5068
|
-
left:
|
5069
|
-
right:
|
5040
|
+
.map(block => {
|
5041
|
+
const fileHtml = {
|
5042
|
+
left: this.makeHeaderHtml(block.header, file),
|
5043
|
+
right: this.makeHeaderHtml(''),
|
5070
5044
|
};
|
5071
|
-
|
5072
|
-
var contextLines = _a[0], oldLines = _a[1], newLines = _a[2];
|
5045
|
+
this.applyLineGroupping(block).forEach(([contextLines, oldLines, newLines]) => {
|
5073
5046
|
if (oldLines.length && newLines.length && !contextLines.length) {
|
5074
|
-
|
5075
|
-
|
5076
|
-
var _b = _this.processChangedLines(file.isCombined, oldLines, newLines), left = _b.left, right = _b.right;
|
5047
|
+
this.applyRematchMatching(oldLines, newLines, matcher).map(([oldLines, newLines]) => {
|
5048
|
+
const { left, right } = this.processChangedLines(file.isCombined, oldLines, newLines);
|
5077
5049
|
fileHtml.left += left;
|
5078
5050
|
fileHtml.right += right;
|
5079
5051
|
});
|
5080
5052
|
}
|
5081
5053
|
else if (contextLines.length) {
|
5082
|
-
contextLines.forEach(
|
5083
|
-
|
5084
|
-
|
5054
|
+
contextLines.forEach(line => {
|
5055
|
+
const { prefix, content } = deconstructLine(line.content, file.isCombined);
|
5056
|
+
const { left, right } = this.generateLineHtml({
|
5085
5057
|
type: CSSLineClass.CONTEXT,
|
5086
5058
|
prefix: prefix,
|
5087
5059
|
content: content,
|
@@ -5091,13 +5063,13 @@ var SideBySideRenderer = (function () {
|
|
5091
5063
|
prefix: prefix,
|
5092
5064
|
content: content,
|
5093
5065
|
number: line.newNumber,
|
5094
|
-
})
|
5066
|
+
});
|
5095
5067
|
fileHtml.left += left;
|
5096
5068
|
fileHtml.right += right;
|
5097
5069
|
});
|
5098
5070
|
}
|
5099
5071
|
else if (oldLines.length || newLines.length) {
|
5100
|
-
|
5072
|
+
const { left, right } = this.processChangedLines(file.isCombined, oldLines, newLines);
|
5101
5073
|
fileHtml.left += left;
|
5102
5074
|
fileHtml.right += right;
|
5103
5075
|
}
|
@@ -5107,16 +5079,16 @@ var SideBySideRenderer = (function () {
|
|
5107
5079
|
});
|
5108
5080
|
return fileHtml;
|
5109
5081
|
})
|
5110
|
-
.reduce(
|
5082
|
+
.reduce((accomulated, html) => {
|
5111
5083
|
return { left: accomulated.left + html.left, right: accomulated.right + html.right };
|
5112
5084
|
}, { left: '', right: '' });
|
5113
|
-
}
|
5114
|
-
|
5115
|
-
|
5116
|
-
|
5117
|
-
|
5118
|
-
for (
|
5119
|
-
|
5085
|
+
}
|
5086
|
+
applyLineGroupping(block) {
|
5087
|
+
const blockLinesGroups = [];
|
5088
|
+
let oldLines = [];
|
5089
|
+
let newLines = [];
|
5090
|
+
for (let i = 0; i < block.lines.length; i++) {
|
5091
|
+
const diffLine = block.lines[i];
|
5120
5092
|
if ((diffLine.type !== LineType.INSERT && newLines.length) ||
|
5121
5093
|
(diffLine.type === LineType.CONTEXT && oldLines.length > 0)) {
|
5122
5094
|
blockLinesGroups.push([[], oldLines, newLines]);
|
@@ -5142,86 +5114,84 @@ var SideBySideRenderer = (function () {
|
|
5142
5114
|
newLines = [];
|
5143
5115
|
}
|
5144
5116
|
return blockLinesGroups;
|
5145
|
-
}
|
5146
|
-
|
5147
|
-
|
5148
|
-
|
5149
|
-
|
5117
|
+
}
|
5118
|
+
applyRematchMatching(oldLines, newLines, matcher) {
|
5119
|
+
const comparisons = oldLines.length * newLines.length;
|
5120
|
+
const maxLineSizeInBlock = Math.max.apply(null, [0].concat(oldLines.concat(newLines).map(elem => elem.content.length)));
|
5121
|
+
const doMatching = comparisons < this.config.matchingMaxComparisons &&
|
5150
5122
|
maxLineSizeInBlock < this.config.maxLineSizeInBlockForComparison &&
|
5151
5123
|
(this.config.matching === 'lines' || this.config.matching === 'words');
|
5152
5124
|
return doMatching ? matcher(oldLines, newLines) : [[oldLines, newLines]];
|
5153
|
-
}
|
5154
|
-
|
5125
|
+
}
|
5126
|
+
makeHeaderHtml(blockHeader, file) {
|
5155
5127
|
return this.hoganUtils.render(side_by_side_renderer_genericTemplatesPath, 'block-header', {
|
5156
5128
|
CSSLineClass: CSSLineClass,
|
5157
5129
|
blockHeader: (file === null || file === void 0 ? void 0 : file.isTooBig) ? blockHeader : escapeForHtml(blockHeader),
|
5158
5130
|
lineClass: 'd2h-code-side-linenumber',
|
5159
5131
|
contentClass: 'd2h-code-side-line',
|
5160
5132
|
});
|
5161
|
-
}
|
5162
|
-
|
5163
|
-
|
5133
|
+
}
|
5134
|
+
processChangedLines(isCombined, oldLines, newLines) {
|
5135
|
+
const fileHtml = {
|
5164
5136
|
right: '',
|
5165
5137
|
left: '',
|
5166
5138
|
};
|
5167
|
-
|
5168
|
-
for (
|
5169
|
-
|
5170
|
-
|
5171
|
-
|
5139
|
+
const maxLinesNumber = Math.max(oldLines.length, newLines.length);
|
5140
|
+
for (let i = 0; i < maxLinesNumber; i++) {
|
5141
|
+
const oldLine = oldLines[i];
|
5142
|
+
const newLine = newLines[i];
|
5143
|
+
const diff = oldLine !== undefined && newLine !== undefined
|
5172
5144
|
? diffHighlight(oldLine.content, newLine.content, isCombined, this.config)
|
5173
5145
|
: undefined;
|
5174
|
-
|
5175
|
-
?
|
5146
|
+
const preparedOldLine = oldLine !== undefined && oldLine.oldNumber !== undefined
|
5147
|
+
? Object.assign(Object.assign({}, (diff !== undefined
|
5176
5148
|
? {
|
5177
5149
|
prefix: diff.oldLine.prefix,
|
5178
5150
|
content: diff.oldLine.content,
|
5179
5151
|
type: CSSLineClass.DELETE_CHANGES,
|
5180
5152
|
}
|
5181
|
-
:
|
5182
|
-
|
5183
|
-
?
|
5153
|
+
: Object.assign(Object.assign({}, deconstructLine(oldLine.content, isCombined)), { type: toCSSClass(oldLine.type) }))), { number: oldLine.oldNumber }) : undefined;
|
5154
|
+
const preparedNewLine = newLine !== undefined && newLine.newNumber !== undefined
|
5155
|
+
? Object.assign(Object.assign({}, (diff !== undefined
|
5184
5156
|
? {
|
5185
5157
|
prefix: diff.newLine.prefix,
|
5186
5158
|
content: diff.newLine.content,
|
5187
5159
|
type: CSSLineClass.INSERT_CHANGES,
|
5188
5160
|
}
|
5189
|
-
:
|
5190
|
-
|
5161
|
+
: Object.assign(Object.assign({}, deconstructLine(newLine.content, isCombined)), { type: toCSSClass(newLine.type) }))), { number: newLine.newNumber }) : undefined;
|
5162
|
+
const { left, right } = this.generateLineHtml(preparedOldLine, preparedNewLine);
|
5191
5163
|
fileHtml.left += left;
|
5192
5164
|
fileHtml.right += right;
|
5193
5165
|
}
|
5194
5166
|
return fileHtml;
|
5195
|
-
}
|
5196
|
-
|
5167
|
+
}
|
5168
|
+
generateLineHtml(oldLine, newLine) {
|
5197
5169
|
return {
|
5198
5170
|
left: this.generateSingleHtml(oldLine),
|
5199
5171
|
right: this.generateSingleHtml(newLine),
|
5200
5172
|
};
|
5201
|
-
}
|
5202
|
-
|
5203
|
-
|
5204
|
-
|
5173
|
+
}
|
5174
|
+
generateSingleHtml(line) {
|
5175
|
+
const lineClass = 'd2h-code-side-linenumber';
|
5176
|
+
const contentClass = 'd2h-code-side-line';
|
5205
5177
|
return this.hoganUtils.render(side_by_side_renderer_genericTemplatesPath, 'line', {
|
5206
|
-
type: (line === null || line === void 0 ? void 0 : line.type) ||
|
5207
|
-
lineClass: line !== undefined ? lineClass :
|
5208
|
-
contentClass: line !== undefined ? contentClass :
|
5178
|
+
type: (line === null || line === void 0 ? void 0 : line.type) || `${CSSLineClass.CONTEXT} d2h-emptyplaceholder`,
|
5179
|
+
lineClass: line !== undefined ? lineClass : `${lineClass} d2h-code-side-emptyplaceholder`,
|
5180
|
+
contentClass: line !== undefined ? contentClass : `${contentClass} d2h-code-side-emptyplaceholder`,
|
5209
5181
|
prefix: (line === null || line === void 0 ? void 0 : line.prefix) === ' ' ? ' ' : line === null || line === void 0 ? void 0 : line.prefix,
|
5210
5182
|
content: line === null || line === void 0 ? void 0 : line.content,
|
5211
5183
|
lineNumber: line === null || line === void 0 ? void 0 : line.number,
|
5212
5184
|
});
|
5213
|
-
}
|
5214
|
-
|
5215
|
-
}());
|
5216
|
-
/* harmony default export */ const side_by_side_renderer = (SideBySideRenderer);
|
5185
|
+
}
|
5186
|
+
}
|
5217
5187
|
//# sourceMappingURL=side-by-side-renderer.js.map
|
5218
5188
|
// EXTERNAL MODULE: ../../node_modules/hogan.js/lib/hogan.js
|
5219
5189
|
var hogan = __webpack_require__(112);
|
5220
5190
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/diff2html-templates.js
|
5221
5191
|
|
5222
|
-
|
5192
|
+
const defaultTemplates = {};
|
5223
5193
|
defaultTemplates["file-summary-line"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<li class=\"d2h-file-list-line\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-name-wrapper\">"); t.b("\n" + i); t.b(t.rp("<fileIcon0", c, p, " ")); t.b(" <a href=\"#"); t.b(t.v(t.f("fileHtmlId", c, p, 0))); t.b("\" class=\"d2h-file-name\">"); t.b(t.v(t.f("fileName", c, p, 0))); t.b("</a>"); t.b("\n" + i); t.b(" <span class=\"d2h-file-stats\">"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-added\">"); t.b(t.v(t.f("addedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" <span class=\"d2h-lines-deleted\">"); t.b(t.v(t.f("deletedLines", c, p, 0))); t.b("</span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b(" </span>"); t.b("\n" + i); t.b("</li>"); return t.fl(); }, partials: { "<fileIcon0": { name: "fileIcon", partials: {}, subs: {} } }, subs: {} });
|
5224
|
-
defaultTemplates["file-summary-wrapper"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-file-list-wrapper\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-list-header\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-list-title\">Files changed ("); t.b(t.v(t.f("filesNumber", c, p, 0))); t.b(")</span>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-hide\">hide</a>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-show\">show</a>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <ol class=\"d2h-file-list\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("files", c, p, 0))); t.b("\n" + i); t.b(" </ol>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
|
5194
|
+
defaultTemplates["file-summary-wrapper"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-file-list-wrapper "); t.b(t.v(t.f("colorScheme", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\"d2h-file-list-header\">"); t.b("\n" + i); t.b(" <span class=\"d2h-file-list-title\">Files changed ("); t.b(t.v(t.f("filesNumber", c, p, 0))); t.b(")</span>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-hide\">hide</a>"); t.b("\n" + i); t.b(" <a class=\"d2h-file-switch d2h-show\">show</a>"); t.b("\n" + i); t.b(" </div>"); t.b("\n" + i); t.b(" <ol class=\"d2h-file-list\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("files", c, p, 0))); t.b("\n" + i); t.b(" </ol>"); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
|
5225
5195
|
defaultTemplates["generic-block-header"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<tr>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.f("lineClass", c, p, 0))); t.b(" "); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\"></td>"); t.b("\n" + i); t.b(" <td class=\""); t.b(t.v(t.d("CSSLineClass.INFO", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" <div class=\""); t.b(t.v(t.f("contentClass", c, p, 0))); t.b("\">"); if (t.s(t.f("blockHeader", c, p, 1), c, p, 0, 156, 173, "{{ }}")) {
|
5226
5196
|
t.rs(c, p, function (c, p, t) { t.b(t.t(t.f("blockHeader", c, p, 0))); });
|
5227
5197
|
c.pop();
|
@@ -5243,7 +5213,7 @@ defaultTemplates["generic-line"] = new hogan.Template({ code: function (c, p, i)
|
|
5243
5213
|
t.b(" <span class=\"d2h-code-line-ctn\"><br></span>");
|
5244
5214
|
t.b("\n" + i);
|
5245
5215
|
} ; t.b(" </div>"); t.b("\n" + i); t.b(" </td>"); t.b("\n" + i); t.b("</tr>"); return t.fl(); }, partials: {}, subs: {} });
|
5246
|
-
defaultTemplates["generic-wrapper"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-wrapper\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("content", c, p, 0))); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
|
5216
|
+
defaultTemplates["generic-wrapper"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<div class=\"d2h-wrapper "); t.b(t.v(t.f("colorScheme", c, p, 0))); t.b("\">"); t.b("\n" + i); t.b(" "); t.b(t.t(t.f("content", c, p, 0))); t.b("\n" + i); t.b("</div>"); return t.fl(); }, partials: {}, subs: {} });
|
5247
5217
|
defaultTemplates["icon-file-added"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\""); t.b("\n" + i); t.b(" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
|
5248
5218
|
defaultTemplates["icon-file-changed"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
|
5249
5219
|
defaultTemplates["icon-file-deleted"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\""); t.b("\n" + i); t.b(" viewBox=\"0 0 14 16\" width=\"14\">"); t.b("\n" + i); t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>"); t.b("\n" + i); t.b("</svg>"); return t.fl(); }, partials: {}, subs: {} });
|
@@ -5258,85 +5228,58 @@ defaultTemplates["tag-file-deleted"] = new hogan.Template({ code: function (c, p
|
|
5258
5228
|
defaultTemplates["tag-file-renamed"] = new hogan.Template({ code: function (c, p, i) { var t = this; t.b(i = i || ""); t.b("<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>"); return t.fl(); }, partials: {}, subs: {} });
|
5259
5229
|
//# sourceMappingURL=diff2html-templates.js.map
|
5260
5230
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/hoganjs-utils.js
|
5261
|
-
var hoganjs_utils_assign = (undefined && undefined.__assign) || function () {
|
5262
|
-
hoganjs_utils_assign = Object.assign || function(t) {
|
5263
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5264
|
-
s = arguments[i];
|
5265
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
5266
|
-
t[p] = s[p];
|
5267
|
-
}
|
5268
|
-
return t;
|
5269
|
-
};
|
5270
|
-
return hoganjs_utils_assign.apply(this, arguments);
|
5271
|
-
};
|
5272
5231
|
|
5273
5232
|
|
5274
|
-
|
5275
|
-
|
5276
|
-
|
5277
|
-
|
5278
|
-
|
5279
|
-
var name = _a[0], templateString = _a[1];
|
5280
|
-
var compiledTemplate = hogan.compile(templateString, { asString: false });
|
5281
|
-
return hoganjs_utils_assign(hoganjs_utils_assign({}, previousTemplates), (_b = {}, _b[name] = compiledTemplate, _b));
|
5233
|
+
class HoganJsUtils {
|
5234
|
+
constructor({ compiledTemplates = {}, rawTemplates = {} }) {
|
5235
|
+
const compiledRawTemplates = Object.entries(rawTemplates).reduce((previousTemplates, [name, templateString]) => {
|
5236
|
+
const compiledTemplate = hogan.compile(templateString, { asString: false });
|
5237
|
+
return Object.assign(Object.assign({}, previousTemplates), { [name]: compiledTemplate });
|
5282
5238
|
}, {});
|
5283
|
-
this.preCompiledTemplates =
|
5239
|
+
this.preCompiledTemplates = Object.assign(Object.assign(Object.assign({}, defaultTemplates), compiledTemplates), compiledRawTemplates);
|
5284
5240
|
}
|
5285
|
-
|
5241
|
+
static compile(templateString) {
|
5286
5242
|
return hogan.compile(templateString, { asString: false });
|
5287
|
-
}
|
5288
|
-
|
5289
|
-
|
5243
|
+
}
|
5244
|
+
render(namespace, view, params, partials, indent) {
|
5245
|
+
const templateKey = this.templateKey(namespace, view);
|
5290
5246
|
try {
|
5291
|
-
|
5247
|
+
const template = this.preCompiledTemplates[templateKey];
|
5292
5248
|
return template.render(params, partials, indent);
|
5293
5249
|
}
|
5294
5250
|
catch (e) {
|
5295
|
-
throw new Error(
|
5251
|
+
throw new Error(`Could not find template to render '${templateKey}'`);
|
5296
5252
|
}
|
5297
|
-
}
|
5298
|
-
|
5253
|
+
}
|
5254
|
+
template(namespace, view) {
|
5299
5255
|
return this.preCompiledTemplates[this.templateKey(namespace, view)];
|
5300
|
-
}
|
5301
|
-
|
5302
|
-
return
|
5303
|
-
}
|
5304
|
-
|
5305
|
-
}());
|
5306
|
-
/* harmony default export */ const hoganjs_utils = (HoganJsUtils);
|
5256
|
+
}
|
5257
|
+
templateKey(namespace, view) {
|
5258
|
+
return `${namespace}-${view}`;
|
5259
|
+
}
|
5260
|
+
}
|
5307
5261
|
//# sourceMappingURL=hoganjs-utils.js.map
|
5308
5262
|
;// CONCATENATED MODULE: ../../node_modules/diff2html/lib-esm/diff2html.js
|
5309
|
-
var diff2html_assign = (undefined && undefined.__assign) || function () {
|
5310
|
-
diff2html_assign = Object.assign || function(t) {
|
5311
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5312
|
-
s = arguments[i];
|
5313
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
5314
|
-
t[p] = s[p];
|
5315
|
-
}
|
5316
|
-
return t;
|
5317
|
-
};
|
5318
|
-
return diff2html_assign.apply(this, arguments);
|
5319
|
-
};
|
5320
5263
|
|
5321
5264
|
|
5322
5265
|
|
5323
5266
|
|
5324
5267
|
|
5325
5268
|
|
5326
|
-
|
5327
|
-
function diff2html_parse(diffInput, configuration) {
|
5328
|
-
|
5329
|
-
return DiffParser.parse(diffInput, diff2html_assign(diff2html_assign({}, defaultDiff2HtmlConfig), configuration));
|
5269
|
+
const defaultDiff2HtmlConfig = Object.assign(Object.assign(Object.assign({}, defaultLineByLineRendererConfig), defaultSideBySideRendererConfig), { outputFormat: OutputFormatType.LINE_BY_LINE, drawFileList: true });
|
5270
|
+
function diff2html_parse(diffInput, configuration = {}) {
|
5271
|
+
return DiffParser.parse(diffInput, Object.assign(Object.assign({}, defaultDiff2HtmlConfig), configuration));
|
5330
5272
|
}
|
5331
|
-
function html(diffInput, configuration) {
|
5332
|
-
|
5333
|
-
|
5334
|
-
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5338
|
-
|
5339
|
-
|
5273
|
+
function html(diffInput, configuration = {}) {
|
5274
|
+
const config = Object.assign(Object.assign({}, defaultDiff2HtmlConfig), configuration);
|
5275
|
+
const diffJson = typeof diffInput === 'string' ? parse(diffInput, config) : diffInput;
|
5276
|
+
const hoganUtils = new HoganJsUtils(config);
|
5277
|
+
const { colorScheme } = config;
|
5278
|
+
const fileListRendererConfig = { colorScheme };
|
5279
|
+
const fileList = config.drawFileList ? new FileListRenderer(hoganUtils, fileListRendererConfig).render(diffJson) : '';
|
5280
|
+
const diffOutput = config.outputFormat === 'side-by-side'
|
5281
|
+
? new SideBySideRenderer(hoganUtils, config).render(diffJson)
|
5282
|
+
: new LineByLineRenderer(hoganUtils, config).render(diffJson);
|
5340
5283
|
return fileList + diffOutput;
|
5341
5284
|
}
|
5342
5285
|
//# sourceMappingURL=diff2html.js.map
|