vue-devui 1.5.8 → 1.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/alert/index.es.js +4 -3
  2. package/alert/index.umd.js +3 -3
  3. package/alert/style.css +1 -1
  4. package/auto-complete/index.es.js +7 -1
  5. package/auto-complete/index.umd.js +7 -7
  6. package/auto-complete/style.css +1 -1
  7. package/avatar/index.es.js +4 -3
  8. package/avatar/index.umd.js +3 -3
  9. package/avatar/style.css +1 -1
  10. package/badge/index.es.js +1 -0
  11. package/badge/index.umd.js +1 -1
  12. package/carousel/index.es.js +46 -9
  13. package/carousel/index.umd.js +1 -1
  14. package/carousel/style.css +1 -1
  15. package/checkbox/index.es.js +7 -1
  16. package/checkbox/index.umd.js +13 -13
  17. package/checkbox/style.css +1 -1
  18. package/code-review/index.es.js +689 -143
  19. package/code-review/index.umd.js +50 -23
  20. package/code-review/style.css +1 -1
  21. package/collapse/index.es.js +1 -1
  22. package/collapse/index.umd.js +2 -2
  23. package/collapse/style.css +1 -1
  24. package/date-picker-pro/index.es.js +7 -1
  25. package/date-picker-pro/index.umd.js +8 -8
  26. package/date-picker-pro/style.css +1 -1
  27. package/dragdrop/index.es.js +158 -0
  28. package/dragdrop/index.umd.js +1 -0
  29. package/dragdrop/package.json +8 -0
  30. package/editor-md/style.css +1 -1
  31. package/form/index.es.js +7 -1
  32. package/form/index.umd.js +7 -7
  33. package/form/style.css +1 -1
  34. package/global.d.ts +1 -0
  35. package/input/index.es.js +7 -1
  36. package/input/index.umd.js +6 -6
  37. package/input/style.css +1 -1
  38. package/input-number/index.es.js +7 -1
  39. package/input-number/index.umd.js +10 -10
  40. package/input-number/style.css +1 -1
  41. package/mention/index.es.js +7 -1
  42. package/mention/index.umd.js +9 -9
  43. package/mention/style.css +1 -1
  44. package/modal/index.es.js +2 -1
  45. package/modal/index.umd.js +1 -1
  46. package/package.json +1 -1
  47. package/pagination/index.es.js +7 -1
  48. package/pagination/index.umd.js +7 -7
  49. package/pagination/style.css +1 -1
  50. package/radio/index.es.js +7 -1
  51. package/radio/index.umd.js +13 -13
  52. package/radio/style.css +1 -1
  53. package/search/index.es.js +7 -1
  54. package/search/index.umd.js +8 -8
  55. package/search/style.css +1 -1
  56. package/select/index.es.js +7 -1
  57. package/select/index.umd.js +5 -5
  58. package/select/style.css +1 -1
  59. package/splitter/index.es.js +14 -3
  60. package/splitter/index.umd.js +12 -12
  61. package/style.css +1 -1
  62. package/switch/index.es.js +7 -1
  63. package/switch/index.umd.js +14 -14
  64. package/switch/style.css +1 -1
  65. package/table/index.es.js +10 -4
  66. package/table/index.umd.js +5 -5
  67. package/table/style.css +1 -1
  68. package/textarea/index.es.js +7 -1
  69. package/textarea/index.umd.js +12 -12
  70. package/textarea/style.css +1 -1
  71. package/time-picker/index.es.js +7 -1
  72. package/time-picker/index.umd.js +7 -7
  73. package/time-picker/style.css +1 -1
  74. package/time-select/index.es.js +7 -1
  75. package/time-select/index.umd.js +5 -5
  76. package/time-select/style.css +1 -1
  77. package/tree/index.es.js +7 -1
  78. package/tree/index.umd.js +7 -7
  79. package/tree/style.css +1 -1
  80. package/types/code-review/src/code-review-types.d.ts +17 -1
  81. package/types/code-review/src/code-review.d.ts +37 -4
  82. package/types/code-review/src/composables/use-code-review-comment.d.ts +10 -6
  83. package/types/code-review/src/composables/use-code-review-expand.d.ts +3 -2
  84. package/types/code-review/src/composables/use-code-review-fold.d.ts +6 -0
  85. package/types/code-review/src/composables/use-code-review.d.ts +6 -5
  86. package/types/code-review/src/const.d.ts +20 -0
  87. package/types/code-review/src/utils.d.ts +15 -2
  88. package/types/dragdrop/src/const.d.ts +0 -1
  89. package/types/dragdrop/src/draggable-directive.d.ts +1 -18
  90. package/types/dragdrop/src/droppable-directive.d.ts +1 -14
  91. package/types/dragdrop/src/sortable-directive.d.ts +1 -15
  92. package/types/dragdrop/src/utils.d.ts +2 -80
  93. package/types/form/src/form-types.d.ts +4 -0
  94. package/types/form/src/form.d.ts +9 -0
  95. package/types/modal/src/modal-types.d.ts +1 -1
  96. package/types/modal/src/modal.d.ts +2 -1
  97. package/types/shared/utils/index.d.ts +2 -0
  98. package/types/shared/utils/use-namespace.d.ts +13 -0
  99. package/vue-devui.es.js +1167 -645
  100. package/vue-devui.umd.js +101 -74
@@ -1,7 +1,24 @@
1
- import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, provide, Teleport, createTextVNode, onBeforeMount } from "vue";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ import { watch, onUnmounted, defineComponent, toRefs, createVNode, Transition, mergeProps, ref, unref, nextTick, withModifiers, Comment, Text, h, Fragment, inject, withDirectives, cloneVNode, computed, onMounted, provide, Teleport, createTextVNode, vShow } from "vue";
2
18
  import { offset, autoPlacement, arrow, shift, computePosition } from "@floating-ui/dom";
3
19
  import Clipboard from "clipboard";
4
20
  import * as Diff2Html from "diff2html";
21
+ import { Diff2HtmlUI } from "diff2html/lib/ui/js/diff2html-ui";
5
22
  const fixedOverlayProps = {
6
23
  modelValue: {
7
24
  type: Boolean,
@@ -283,6 +300,7 @@ const FlexibleOverlay = defineComponent({
283
300
  };
284
301
  }
285
302
  });
303
+ const inBrowser = typeof window !== "undefined";
286
304
  const POPPER_TRIGGER_TOKEN = Symbol("popper-trigger");
287
305
  const isObject = (val) => val !== null && typeof val === "object";
288
306
  const ns$1 = useNamespace("popper-trigger");
@@ -1082,7 +1100,7 @@ var lodash = { exports: {} };
1082
1100
  }
1083
1101
  var runInContext = function runInContext2(context) {
1084
1102
  context = context == null ? root : _.defaults(root.Object(), context, _.pick(root, contextProps));
1085
- var Array2 = context.Array, Date = context.Date, Error = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError = context.TypeError;
1103
+ var Array2 = context.Array, Date = context.Date, Error2 = context.Error, Function2 = context.Function, Math2 = context.Math, Object2 = context.Object, RegExp2 = context.RegExp, String2 = context.String, TypeError2 = context.TypeError;
1086
1104
  var arrayProto = Array2.prototype, funcProto = Function2.prototype, objectProto = Object2.prototype;
1087
1105
  var coreJsData = context["__core-js_shared__"];
1088
1106
  var funcToString = funcProto.toString;
@@ -1096,7 +1114,7 @@ var lodash = { exports: {} };
1096
1114
  var objectCtorString = funcToString.call(Object2);
1097
1115
  var oldDash = root._;
1098
1116
  var reIsNative = RegExp2("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
1099
- var Buffer = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
1117
+ var Buffer2 = moduleExports ? context.Buffer : undefined$1, Symbol2 = context.Symbol, Uint8Array2 = context.Uint8Array, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : undefined$1, getPrototype = overArg(Object2.getPrototypeOf, Object2), objectCreate = Object2.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol2 ? Symbol2.isConcatSpreadable : undefined$1, symIterator = Symbol2 ? Symbol2.iterator : undefined$1, symToStringTag = Symbol2 ? Symbol2.toStringTag : undefined$1;
1100
1118
  var defineProperty = function() {
1101
1119
  try {
1102
1120
  var func = getNative(Object2, "defineProperty");
@@ -1106,11 +1124,11 @@ var lodash = { exports: {} };
1106
1124
  }
1107
1125
  }();
1108
1126
  var ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout;
1109
- var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
1110
- var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1111
- var metaMap = WeakMap && new WeakMap();
1127
+ var nativeCeil = Math2.ceil, nativeFloor = Math2.floor, nativeGetSymbols = Object2.getOwnPropertySymbols, nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : undefined$1, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object2.keys, Object2), nativeMax = Math2.max, nativeMin = Math2.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math2.random, nativeReverse = arrayProto.reverse;
1128
+ var DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise2 = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap2 = getNative(context, "WeakMap"), nativeCreate = getNative(Object2, "create");
1129
+ var metaMap = WeakMap2 && new WeakMap2();
1112
1130
  var realNames = {};
1113
- var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap);
1131
+ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise2), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap2);
1114
1132
  var symbolProto = Symbol2 ? Symbol2.prototype : undefined$1, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined$1, symbolToString = symbolProto ? symbolProto.toString : undefined$1;
1115
1133
  function lodash2(value) {
1116
1134
  if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
@@ -1563,7 +1581,7 @@ var lodash = { exports: {} };
1563
1581
  }
1564
1582
  function baseDelay(func, wait, args) {
1565
1583
  if (typeof func != "function") {
1566
- throw new TypeError(FUNC_ERROR_TEXT);
1584
+ throw new TypeError2(FUNC_ERROR_TEXT);
1567
1585
  }
1568
1586
  return setTimeout(function() {
1569
1587
  func.apply(undefined$1, args);
@@ -2358,7 +2376,7 @@ var lodash = { exports: {} };
2358
2376
  }
2359
2377
  function cloneArrayBuffer(arrayBuffer) {
2360
2378
  var result2 = new arrayBuffer.constructor(arrayBuffer.byteLength);
2361
- new Uint8Array(result2).set(new Uint8Array(arrayBuffer));
2379
+ new Uint8Array2(result2).set(new Uint8Array2(arrayBuffer));
2362
2380
  return result2;
2363
2381
  }
2364
2382
  function cloneDataView(dataView, isDeep) {
@@ -2607,7 +2625,7 @@ var lodash = { exports: {} };
2607
2625
  while (index2--) {
2608
2626
  var func = funcs[index2];
2609
2627
  if (typeof func != "function") {
2610
- throw new TypeError(FUNC_ERROR_TEXT);
2628
+ throw new TypeError2(FUNC_ERROR_TEXT);
2611
2629
  }
2612
2630
  if (prereq && !wrapper && getFuncName(func) == "wrapper") {
2613
2631
  var wrapper = new LodashWrapper([], true);
@@ -2820,7 +2838,7 @@ var lodash = { exports: {} };
2820
2838
  function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary2, arity) {
2821
2839
  var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
2822
2840
  if (!isBindKey && typeof func != "function") {
2823
- throw new TypeError(FUNC_ERROR_TEXT);
2841
+ throw new TypeError2(FUNC_ERROR_TEXT);
2824
2842
  }
2825
2843
  var length = partials ? partials.length : 0;
2826
2844
  if (!length) {
@@ -2940,7 +2958,7 @@ var lodash = { exports: {} };
2940
2958
  object = object.buffer;
2941
2959
  other = other.buffer;
2942
2960
  case arrayBufferTag:
2943
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
2961
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
2944
2962
  return false;
2945
2963
  }
2946
2964
  return true;
@@ -3102,7 +3120,7 @@ var lodash = { exports: {} };
3102
3120
  return result2;
3103
3121
  };
3104
3122
  var getTag = baseGetTag;
3105
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) {
3123
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set && getTag(new Set()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
3106
3124
  getTag = function(value) {
3107
3125
  var result2 = baseGetTag(value), Ctor = result2 == objectTag ? value.constructor : undefined$1, ctorString = Ctor ? toSource(Ctor) : "";
3108
3126
  if (ctorString) {
@@ -4087,7 +4105,7 @@ var lodash = { exports: {} };
4087
4105
  };
4088
4106
  function after(n, func) {
4089
4107
  if (typeof func != "function") {
4090
- throw new TypeError(FUNC_ERROR_TEXT);
4108
+ throw new TypeError2(FUNC_ERROR_TEXT);
4091
4109
  }
4092
4110
  n = toInteger(n);
4093
4111
  return function() {
@@ -4104,7 +4122,7 @@ var lodash = { exports: {} };
4104
4122
  function before(n, func) {
4105
4123
  var result2;
4106
4124
  if (typeof func != "function") {
4107
- throw new TypeError(FUNC_ERROR_TEXT);
4125
+ throw new TypeError2(FUNC_ERROR_TEXT);
4108
4126
  }
4109
4127
  n = toInteger(n);
4110
4128
  return function() {
@@ -4148,7 +4166,7 @@ var lodash = { exports: {} };
4148
4166
  function debounce(func, wait, options) {
4149
4167
  var lastArgs, lastThis, maxWait, result2, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
4150
4168
  if (typeof func != "function") {
4151
- throw new TypeError(FUNC_ERROR_TEXT);
4169
+ throw new TypeError2(FUNC_ERROR_TEXT);
4152
4170
  }
4153
4171
  wait = toNumber(wait) || 0;
4154
4172
  if (isObject2(options)) {
@@ -4237,7 +4255,7 @@ var lodash = { exports: {} };
4237
4255
  }
4238
4256
  function memoize(func, resolver) {
4239
4257
  if (typeof func != "function" || resolver != null && typeof resolver != "function") {
4240
- throw new TypeError(FUNC_ERROR_TEXT);
4258
+ throw new TypeError2(FUNC_ERROR_TEXT);
4241
4259
  }
4242
4260
  var memoized = function() {
4243
4261
  var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
@@ -4254,7 +4272,7 @@ var lodash = { exports: {} };
4254
4272
  memoize.Cache = MapCache;
4255
4273
  function negate(predicate) {
4256
4274
  if (typeof predicate != "function") {
4257
- throw new TypeError(FUNC_ERROR_TEXT);
4275
+ throw new TypeError2(FUNC_ERROR_TEXT);
4258
4276
  }
4259
4277
  return function() {
4260
4278
  var args = arguments;
@@ -4298,14 +4316,14 @@ var lodash = { exports: {} };
4298
4316
  });
4299
4317
  function rest(func, start) {
4300
4318
  if (typeof func != "function") {
4301
- throw new TypeError(FUNC_ERROR_TEXT);
4319
+ throw new TypeError2(FUNC_ERROR_TEXT);
4302
4320
  }
4303
4321
  start = start === undefined$1 ? start : toInteger(start);
4304
4322
  return baseRest(func, start);
4305
4323
  }
4306
4324
  function spread(func, start) {
4307
4325
  if (typeof func != "function") {
4308
- throw new TypeError(FUNC_ERROR_TEXT);
4326
+ throw new TypeError2(FUNC_ERROR_TEXT);
4309
4327
  }
4310
4328
  start = start == null ? 0 : nativeMax(toInteger(start), 0);
4311
4329
  return baseRest(function(args) {
@@ -4319,7 +4337,7 @@ var lodash = { exports: {} };
4319
4337
  function throttle(func, wait, options) {
4320
4338
  var leading = true, trailing = true;
4321
4339
  if (typeof func != "function") {
4322
- throw new TypeError(FUNC_ERROR_TEXT);
4340
+ throw new TypeError2(FUNC_ERROR_TEXT);
4323
4341
  }
4324
4342
  if (isObject2(options)) {
4325
4343
  leading = "leading" in options ? !!options.leading : leading;
@@ -4461,7 +4479,7 @@ var lodash = { exports: {} };
4461
4479
  }
4462
4480
  function isNative(value) {
4463
4481
  if (isMaskable(value)) {
4464
- throw new Error(CORE_ERROR_TEXT);
4482
+ throw new Error2(CORE_ERROR_TEXT);
4465
4483
  }
4466
4484
  return baseIsNative(value);
4467
4485
  }
@@ -4999,7 +5017,7 @@ var lodash = { exports: {} };
4999
5017
  if (!variable) {
5000
5018
  source = "with (obj) {\n" + source + "\n}\n";
5001
5019
  } else if (reForbiddenIdentifierChars.test(variable)) {
5002
- throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
5020
+ throw new Error2(INVALID_TEMPL_VAR_ERROR_TEXT);
5003
5021
  }
5004
5022
  source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
5005
5023
  source = "function(" + (variable || "obj") + ") {\n" + (variable ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (isEscaping ? ", __e = _.escape" : "") + (isEvaluating ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
@@ -5118,7 +5136,7 @@ var lodash = { exports: {} };
5118
5136
  try {
5119
5137
  return apply(func, undefined$1, args);
5120
5138
  } catch (e) {
5121
- return isError(e) ? e : new Error(e);
5139
+ return isError(e) ? e : new Error2(e);
5122
5140
  }
5123
5141
  });
5124
5142
  var bindAll = flatRest(function(object, methodNames) {
@@ -5132,7 +5150,7 @@ var lodash = { exports: {} };
5132
5150
  var length = pairs == null ? 0 : pairs.length, toIteratee = getIteratee();
5133
5151
  pairs = !length ? [] : arrayMap(pairs, function(pair) {
5134
5152
  if (typeof pair[1] != "function") {
5135
- throw new TypeError(FUNC_ERROR_TEXT);
5153
+ throw new TypeError2(FUNC_ERROR_TEXT);
5136
5154
  }
5137
5155
  return [toIteratee(pair[0]), pair[1]];
5138
5156
  });
@@ -6198,13 +6216,28 @@ const codeReviewProps = {
6198
6216
  type: Boolean,
6199
6217
  default: false
6200
6218
  },
6219
+ allowComment: {
6220
+ type: Boolean,
6221
+ default: true
6222
+ },
6223
+ allowExpand: {
6224
+ type: Boolean,
6225
+ default: true
6226
+ },
6227
+ showBlob: {
6228
+ type: Boolean,
6229
+ default: false
6230
+ },
6201
6231
  outputFormat: {
6202
6232
  type: String,
6203
6233
  default: "line-by-line"
6204
6234
  },
6205
- expandAllThreshold: {
6235
+ expandThreshold: {
6206
6236
  type: Number,
6207
6237
  default: 50
6238
+ },
6239
+ expandLoader: {
6240
+ type: Function
6208
6241
  }
6209
6242
  };
6210
6243
  const CodeReviewInjectionKey = Symbol("d-code-review");
@@ -6296,10 +6329,285 @@ var CodeReviewHeader = defineComponent({
6296
6329
  });
6297
6330
  const ExpandLineReg = /^@@ -(\d+),(\d+) \+(\d+),(\d+) @@/;
6298
6331
  const FirstLineReg = /^@@ -[0,1](?!\d)/;
6332
+ const TableTrReg = /<tr[^>]*>[\s\S]*?<\/tr>/gi;
6333
+ const TableTdReg = /<td[^>]*>[\s\S]*?<\/td>/gi;
6334
+ const TableTbodyReg = /<tbody[^>]*>[\s\S]*?<\/tbody>/gi;
6335
+ const TableTbodyAttrReg = /<tbody([^>]*)>/i;
6336
+ const EmptyDataLangReg = /<div[^>]* data-lang="">[\s\S]*?<\/div>/gi;
6337
+ const LineByLineTemplate = `<div id="{{fileHtmlId}}" class="d2h-file-wrapper" data-lang="{{file.language}}">
6338
+ <div class="d2h-file-diff">
6339
+ <div class="d2h-code-wrapper">
6340
+ <table class="d2h-diff-table">
6341
+ <tbody class="d2h-diff-tbody">
6342
+ {{{diffs}}}
6343
+ </tbody>
6344
+ </table>
6345
+ </div>
6346
+ </div>
6347
+ </div>`;
6348
+ const SideBySideTemplate = `<div id="{{fileHtmlId}}" class="d2h-file-wrapper" data-lang="{{file.language}}">
6349
+ <div class="d2h-files-diff">
6350
+ <div class="d2h-file-side-diff">
6351
+ <div class="d2h-code-wrapper">
6352
+ <table class="d2h-diff-table">
6353
+ <tbody class="d2h-diff-tbody">
6354
+ {{{diffs.left}}}
6355
+ {{{diffs.right}}}
6356
+ </tbody>
6357
+ </table>
6358
+ </div>
6359
+ </div>
6360
+ </div>
6361
+ </div>`;
6362
+ const EmptyTemplate = {
6363
+ "generic-empty-diff": ""
6364
+ };
6365
+ const TemplateMap = {
6366
+ "line-by-line": __spreadValues({ "line-by-line-file-diff": LineByLineTemplate }, EmptyTemplate),
6367
+ "side-by-side": __spreadValues({ "side-by-side-file-diff": SideBySideTemplate }, EmptyTemplate)
6368
+ };
6299
6369
  function notEmptyNode(node) {
6300
6370
  const classes = node.classList;
6301
6371
  return !classes.contains("d2h-info") && !classes.contains("d2h-emptyplaceholder") && !classes.contains("comment-cell");
6302
6372
  }
6373
+ function insertIncrementLineToPage(referenceDom, trNodes, direction) {
6374
+ if (direction === "up") {
6375
+ const nextSibling = referenceDom.nextElementSibling;
6376
+ trNodes.forEach((item) => {
6377
+ var _a;
6378
+ (_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, nextSibling);
6379
+ });
6380
+ } else {
6381
+ trNodes.forEach((item) => {
6382
+ var _a;
6383
+ (_a = referenceDom.parentNode) == null ? void 0 : _a.insertBefore(item, referenceDom);
6384
+ });
6385
+ }
6386
+ }
6387
+ function ifRemoveExpandLineForDoubleColumn(expandDom, newExpandDom, direction) {
6388
+ var _a, _b, _c, _d, _e, _f, _g, _h;
6389
+ const matches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
6390
+ if (!matches) {
6391
+ return true;
6392
+ }
6393
+ const leftLineNumber = parseInt(matches[1]);
6394
+ const addedLine = parseInt(matches[2]);
6395
+ const rightLineNumber = parseInt(matches[3]);
6396
+ if (direction === "up") {
6397
+ const prevSibling = expandDom.previousElementSibling;
6398
+ if (!prevSibling) {
6399
+ if (leftLineNumber === 1 && rightLineNumber === 1) {
6400
+ expandDom == null ? void 0 : expandDom.remove();
6401
+ return true;
6402
+ }
6403
+ } else {
6404
+ const prevLeftLineNumber = parseInt((_b = (_a = prevSibling.children) == null ? void 0 : _a[0]) == null ? void 0 : _b.innerText);
6405
+ const prevRightLineNumber = parseInt((_d = (_c = prevSibling.children) == null ? void 0 : _c[2]) == null ? void 0 : _d.innerText);
6406
+ if (leftLineNumber === prevLeftLineNumber + 1 && rightLineNumber === prevRightLineNumber + 1) {
6407
+ expandDom.remove();
6408
+ return true;
6409
+ }
6410
+ }
6411
+ } else {
6412
+ const nextSibling = expandDom.nextElementSibling;
6413
+ if (nextSibling) {
6414
+ const nextLeftLineNumber = parseInt((_f = (_e = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _e[0]) == null ? void 0 : _f.innerText);
6415
+ const nextRightLineNumber = parseInt((_h = (_g = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _g[2]) == null ? void 0 : _h.innerText);
6416
+ if (leftLineNumber + addedLine === nextLeftLineNumber && rightLineNumber + addedLine === nextRightLineNumber) {
6417
+ expandDom.remove();
6418
+ return true;
6419
+ }
6420
+ }
6421
+ }
6422
+ return false;
6423
+ }
6424
+ function ifRemoveExpandLine(expandDom, newExpandDom, direction) {
6425
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
6426
+ const matches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
6427
+ if (!matches) {
6428
+ return true;
6429
+ }
6430
+ const leftLineNumber = parseInt(matches[1]);
6431
+ const addedLine = parseInt(matches[2]);
6432
+ const rightLineNumber = parseInt(matches[3]);
6433
+ if (direction === "up") {
6434
+ const prevSibling = expandDom.previousElementSibling;
6435
+ if (!prevSibling) {
6436
+ if (leftLineNumber === 1 && rightLineNumber === 1) {
6437
+ expandDom == null ? void 0 : expandDom.remove();
6438
+ return true;
6439
+ }
6440
+ } else {
6441
+ const prevLeftLineNumber = parseInt((_c = (_b = (_a = prevSibling.children) == null ? void 0 : _a[0].children) == null ? void 0 : _b[0]) == null ? void 0 : _c.innerText);
6442
+ const prevRightLineNumber = parseInt((_f = (_e = (_d = prevSibling.children) == null ? void 0 : _d[0].children) == null ? void 0 : _e[1]) == null ? void 0 : _f.innerText);
6443
+ if (leftLineNumber === prevLeftLineNumber + 1 && rightLineNumber === prevRightLineNumber + 1) {
6444
+ expandDom.remove();
6445
+ return true;
6446
+ }
6447
+ }
6448
+ } else {
6449
+ const nextSibling = expandDom.nextElementSibling;
6450
+ if (nextSibling) {
6451
+ const nextLeftLineNumber = parseInt((_i = (_h = (_g = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _g[0].children) == null ? void 0 : _h[0]) == null ? void 0 : _i.innerText);
6452
+ const nextRightLineNumber = parseInt((_l = (_k = (_j = nextSibling == null ? void 0 : nextSibling.children) == null ? void 0 : _j[0].children) == null ? void 0 : _k[1]) == null ? void 0 : _l.innerText);
6453
+ if (leftLineNumber + addedLine === nextLeftLineNumber && rightLineNumber + addedLine === nextRightLineNumber) {
6454
+ expandDom.remove();
6455
+ return true;
6456
+ }
6457
+ }
6458
+ }
6459
+ return false;
6460
+ }
6461
+ function updateExpandLineCount(expandDom, newExpandDom) {
6462
+ if (!expandDom.nextElementSibling) {
6463
+ return;
6464
+ }
6465
+ const curMatches = expandDom.children[1].innerText.trim().match(ExpandLineReg);
6466
+ const newMatches = newExpandDom.children[1].innerText.trim().match(ExpandLineReg);
6467
+ const newChangedNumLeft = parseInt((curMatches == null ? void 0 : curMatches[2]) || "") + parseInt((newMatches == null ? void 0 : newMatches[2]) || "");
6468
+ const newChangedNumRight = parseInt((curMatches == null ? void 0 : curMatches[4]) || "") + parseInt((newMatches == null ? void 0 : newMatches[4]) || "");
6469
+ expandDom.children[1].children[0].innerText = `@@ -${(newMatches == null ? void 0 : newMatches[1]) || 0},${newChangedNumLeft} +${(newMatches == null ? void 0 : newMatches[3]) || 0},${newChangedNumRight} @@`;
6470
+ }
6471
+ function parseDiffCode(container, code, outputFormat) {
6472
+ var _a;
6473
+ const diff2HtmlUi = new Diff2HtmlUI(container, code, {
6474
+ drawFileList: false,
6475
+ matching: "lines",
6476
+ outputFormat,
6477
+ highlight: true,
6478
+ rawTemplates: TemplateMap[outputFormat]
6479
+ });
6480
+ if (outputFormat === "side-by-side") {
6481
+ let diffHtmlStr = diff2HtmlUi.diffHtml;
6482
+ if (diffHtmlStr.match(EmptyDataLangReg)) {
6483
+ diffHtmlStr = diffHtmlStr.replace(EmptyDataLangReg, "");
6484
+ }
6485
+ const trList = diffHtmlStr.match(TableTrReg);
6486
+ const trListLength = trList.length;
6487
+ let newTrStr = "";
6488
+ const offset2 = trListLength / 2;
6489
+ for (let i = 0; i < trListLength / 2; i++) {
6490
+ const leftTdList = trList[i].match(TableTdReg);
6491
+ const rightTdList = trList[i + offset2].match(TableTdReg);
6492
+ newTrStr += `<tr>${leftTdList == null ? void 0 : leftTdList.join("")}${rightTdList == null ? void 0 : rightTdList.join("")}</tr>`;
6493
+ }
6494
+ const tbodyAttr = ((_a = diffHtmlStr.match(TableTbodyAttrReg)) == null ? void 0 : _a[1]) || "";
6495
+ const newDiffHtmlStr = diffHtmlStr.replace(TableTbodyReg, `<tbody ${tbodyAttr}>${newTrStr}</tbody>`);
6496
+ diff2HtmlUi.diffHtml = newDiffHtmlStr;
6497
+ }
6498
+ diff2HtmlUi.draw();
6499
+ }
6500
+ function setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR) {
6501
+ if (trNode) {
6502
+ trNode.classList.add("expand-line");
6503
+ trNode.dataset.prevL = String(prevL);
6504
+ trNode.dataset.prevR = String(prevR);
6505
+ trNode.dataset.nextL = String(nextL);
6506
+ trNode.dataset.nextR = String(nextR);
6507
+ }
6508
+ }
6509
+ function updateExpandUpDownButton(trNode) {
6510
+ trNode.children[0].children[0].remove();
6511
+ trNode.children[0].children[0].classList.remove("up-expand");
6512
+ trNode.children[0].children[0].classList.add("all-expand");
6513
+ trNode.children[0].children[0].innerHTML = AllExpandIcon();
6514
+ }
6515
+ function updateLineNumberInDatasetForDoubleColumn(trNode, expandThreshold, position, updateExpandButton = false) {
6516
+ let nextL;
6517
+ let prevL;
6518
+ let nextR;
6519
+ let prevR;
6520
+ if (position === "top") {
6521
+ const nextLineNode = trNode.nextElementSibling;
6522
+ nextL = parseInt(nextLineNode.children[0].innerText) - 1;
6523
+ prevL = Math.max(nextL - expandThreshold + 1, 1);
6524
+ nextR = parseInt(nextLineNode.children[2].innerText) - 1;
6525
+ prevR = Math.max(nextR - expandThreshold + 1, 1);
6526
+ } else if (position === "bottom") {
6527
+ const prevLineNode = trNode.previousElementSibling;
6528
+ prevL = parseInt(prevLineNode.children[0].innerText) + 1;
6529
+ nextL = prevL + expandThreshold - 1;
6530
+ prevR = parseInt(prevLineNode.children[2].innerText) + 1;
6531
+ nextR = prevR + expandThreshold - 1;
6532
+ } else {
6533
+ const prevLineNode = trNode.previousElementSibling;
6534
+ const nextLineNode = trNode.nextElementSibling;
6535
+ const prevLineNumber = parseInt(prevLineNode.children[0].innerText);
6536
+ const nextLineNumber = parseInt(nextLineNode.children[0].innerText);
6537
+ prevL = prevLineNumber + 1;
6538
+ prevR = parseInt(prevLineNode.children[2].innerText) + 1;
6539
+ nextL = nextLineNumber - 1;
6540
+ nextR = parseInt(nextLineNode.children[2].innerText) - 1;
6541
+ const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold;
6542
+ if (isExpandAll && updateExpandButton) {
6543
+ updateExpandUpDownButton(trNode);
6544
+ }
6545
+ }
6546
+ setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR);
6547
+ }
6548
+ function updateLineNumberInDataset(trNode, expandThreshold, position, updateExpandButton = false) {
6549
+ let nextL;
6550
+ let prevL;
6551
+ let nextR;
6552
+ let prevR;
6553
+ if (position === "top") {
6554
+ const nextLineNode = trNode.nextElementSibling;
6555
+ nextL = parseInt(nextLineNode.children[0].children[0].innerText) - 1;
6556
+ prevL = Math.max(nextL - expandThreshold + 1, 1);
6557
+ nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
6558
+ prevR = Math.max(nextR - expandThreshold + 1, 1);
6559
+ } else if (position === "bottom") {
6560
+ const prevLineNode = trNode.previousElementSibling;
6561
+ prevL = parseInt(prevLineNode.children[0].children[0].innerText) + 1;
6562
+ nextL = prevL + expandThreshold - 1;
6563
+ prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
6564
+ nextR = prevR + expandThreshold - 1;
6565
+ } else {
6566
+ const prevLineNode = trNode.previousElementSibling;
6567
+ const nextLineNode = trNode.nextElementSibling;
6568
+ const prevLineNumber = parseInt(prevLineNode.children[0].children[0].innerText);
6569
+ const nextLineNumber = parseInt(nextLineNode.children[0].children[0].innerText);
6570
+ prevL = prevLineNumber + 1;
6571
+ prevR = parseInt(prevLineNode.children[0].children[1].innerText) + 1;
6572
+ nextL = nextLineNumber - 1;
6573
+ nextR = parseInt(nextLineNode.children[0].children[1].innerText) - 1;
6574
+ const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold;
6575
+ if (isExpandAll && updateExpandButton) {
6576
+ updateExpandUpDownButton(trNode);
6577
+ }
6578
+ }
6579
+ setLineNumberInDataset(trNode, prevL, prevR, nextL, nextR);
6580
+ }
6581
+ function getLineNumberFromDataset(expandDom, expandThreshold) {
6582
+ var _a, _b, _c;
6583
+ const attrsMap = (_b = (_a = expandDom.parentElement) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.dataset;
6584
+ const prevL = Number(attrsMap == null ? void 0 : attrsMap.prevL);
6585
+ const nextL = Number(attrsMap == null ? void 0 : attrsMap.nextL);
6586
+ const prevR = Number(attrsMap == null ? void 0 : attrsMap.prevR);
6587
+ const nextR = Number(attrsMap == null ? void 0 : attrsMap.nextR);
6588
+ let leftLineStart, leftLineEnd, rightLineStart, rightLineEnd;
6589
+ if (prevL && nextL && prevR && nextR) {
6590
+ const buttonClasses = Array.from(expandDom.classList);
6591
+ const direction = (_c = buttonClasses.find((item) => item.endsWith("expand"))) == null ? void 0 : _c.split("-")[0];
6592
+ if (direction === "up") {
6593
+ leftLineEnd = nextL;
6594
+ leftLineStart = Math.max(leftLineEnd - expandThreshold + 1, prevL);
6595
+ rightLineEnd = nextR;
6596
+ rightLineStart = Math.max(rightLineEnd - expandThreshold + 1, prevR);
6597
+ } else if (direction === "down") {
6598
+ leftLineStart = prevL;
6599
+ leftLineEnd = Math.min(leftLineStart + expandThreshold - 1, nextL);
6600
+ rightLineStart = prevR;
6601
+ rightLineEnd = Math.min(rightLineStart + expandThreshold - 1, nextR);
6602
+ } else {
6603
+ leftLineStart = prevL;
6604
+ leftLineEnd = nextL;
6605
+ rightLineStart = prevR;
6606
+ rightLineEnd = nextR;
6607
+ }
6608
+ }
6609
+ return [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd];
6610
+ }
6303
6611
  function insertNode(parent, child) {
6304
6612
  if (parent.firstChild) {
6305
6613
  parent.insertBefore(child, parent.firstChild);
@@ -6334,7 +6642,7 @@ function attachExpandUpDownButton(parentNode, direction) {
6334
6642
  addExpandButton(parentNode, expandDirectionMap[direction], (_a = expandDirectionIconMap[direction]) == null ? void 0 : _a.call(expandDirectionIconMap));
6335
6643
  }
6336
6644
  }
6337
- function addCommentToPage(lineHost, commentDom, lineSide) {
6645
+ function addCommentToPageForSingleColumn(lineHost, commentDom, lineSide) {
6338
6646
  var _a, _b;
6339
6647
  const newLine = document.createElement("tr");
6340
6648
  const newCell = document.createElement("td");
@@ -6351,41 +6659,145 @@ function addCommentToPage(lineHost, commentDom, lineSide) {
6351
6659
  (_b = lineHost.parentElement) == null ? void 0 : _b.appendChild(newLine);
6352
6660
  }
6353
6661
  }
6354
- function useCodeReviewExpand(reviewContentRef, expandAllThreshold, outputFormat) {
6662
+ function addCommentToPageForDoubleColumn(lineHost, commentDom, lineSide) {
6663
+ var _a, _b, _c;
6664
+ const nextSibling = lineHost.nextElementSibling;
6665
+ if (nextSibling && ((_a = nextSibling.classList) == null ? void 0 : _a.contains("comment-block"))) {
6666
+ const insertTdDom = lineSide === "left" ? nextSibling.children[0] : nextSibling.children[1];
6667
+ insertTdDom.classList.add("comment-cell");
6668
+ insertTdDom.appendChild(commentDom);
6669
+ } else {
6670
+ const newLine = document.createElement("tr");
6671
+ const newLeftCell = document.createElement("td");
6672
+ const newRightCell = document.createElement("td");
6673
+ newLeftCell.style.width = "50%";
6674
+ newLeftCell.setAttribute("colspan", "2");
6675
+ newRightCell.style.width = "50%";
6676
+ newRightCell.setAttribute("colspan", "2");
6677
+ if (lineSide === "left") {
6678
+ newLeftCell.classList.add("comment-cell");
6679
+ newLeftCell.appendChild(commentDom);
6680
+ } else {
6681
+ newRightCell.classList.add("comment-cell");
6682
+ newRightCell.appendChild(commentDom);
6683
+ }
6684
+ newLine.classList.add("comment-block");
6685
+ newLine.classList.add(lineSide);
6686
+ newLine.appendChild(newLeftCell);
6687
+ newLine.appendChild(newRightCell);
6688
+ if (lineHost.nextElementSibling) {
6689
+ (_b = lineHost.parentElement) == null ? void 0 : _b.insertBefore(newLine, lineHost.nextElementSibling);
6690
+ } else {
6691
+ (_c = lineHost.parentElement) == null ? void 0 : _c.appendChild(newLine);
6692
+ }
6693
+ }
6694
+ }
6695
+ function findReferenceDomForSingleColumn(parentNode, lineNumber, lineSide) {
6696
+ var _a, _b, _c, _d;
6697
+ const trNodes = Array.from(parentNode.querySelectorAll("tr"));
6698
+ for (const index2 in trNodes) {
6699
+ const lineIndex = parseInt(index2);
6700
+ const lineNumberBox = Array.from(trNodes[lineIndex].children)[0];
6701
+ if (notEmptyNode(lineNumberBox)) {
6702
+ const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
6703
+ const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
6704
+ if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
6705
+ return trNodes[lineIndex];
6706
+ }
6707
+ }
6708
+ }
6709
+ }
6710
+ function findReferenceDomForDoubleColumn(parentNode, lineNumber, lineSide) {
6711
+ const trNodes = Array.from(parentNode.querySelectorAll("tr"));
6712
+ for (const index2 in trNodes) {
6713
+ const lineIndex = parseInt(index2);
6714
+ let lineNumberBox;
6715
+ if (lineSide === "left") {
6716
+ lineNumberBox = trNodes[lineIndex].children[0];
6717
+ } else {
6718
+ lineNumberBox = trNodes[lineIndex].children[2];
6719
+ }
6720
+ if (lineNumberBox && notEmptyNode(lineNumberBox)) {
6721
+ const currentLineNumber = parseInt(lineNumberBox.innerText);
6722
+ if (currentLineNumber === lineNumber) {
6723
+ return trNodes[lineIndex];
6724
+ }
6725
+ }
6726
+ }
6727
+ }
6728
+ function useCodeReviewExpand(reviewContentRef, props) {
6729
+ const { outputFormat, expandThreshold, expandLoader } = toRefs(props);
6355
6730
  const processSideBySide = () => {
6356
- const [leftTable, rightTable] = reviewContentRef.value.querySelectorAll("table");
6357
- const trNodes = Array.from(leftTable.querySelectorAll("tr"));
6731
+ var _a;
6732
+ const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
6358
6733
  const totalLines = trNodes.length;
6359
6734
  for (const index2 in trNodes) {
6360
6735
  const lineIndex = parseInt(index2);
6361
6736
  const lineChildren = Array.from(trNodes[lineIndex].children);
6362
6737
  const lineNumberBox = lineChildren[0];
6363
6738
  const lineContentBox = lineChildren[1];
6364
- const lineClassList = lineContentBox.classList.value;
6365
- const lineContent = lineContentBox.innerText.trim();
6366
- if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.includes("d2h-info")) {
6739
+ const lineContent = lineContentBox.innerText;
6740
+ const lineClassList = lineContentBox.classList;
6741
+ if (lineContent.match(ExpandLineReg) && !FirstLineReg.test(lineContent) && lineClassList && lineClassList.contains("d2h-info")) {
6367
6742
  const nextLineIndex = lineIndex + 1;
6368
6743
  const prevLineIndex = lineIndex - 1;
6369
6744
  if (lineIndex === 0 && nextLineIndex in trNodes) {
6745
+ updateLineNumberInDatasetForDoubleColumn(trNodes[lineIndex], expandThreshold.value, "top");
6370
6746
  attachExpandUpDownButton(lineNumberBox, "up");
6371
6747
  } else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
6372
- const preLineChildren = Array.from(trNodes[prevLineIndex].children);
6373
- const nextLineChildren = Array.from(trNodes[nextLineIndex].children);
6374
- const isExpandAll = parseInt(nextLineChildren[0].innerText) - parseInt(preLineChildren[0].innerText) - 1 < expandAllThreshold;
6748
+ const preLineNumber = parseInt(trNodes[prevLineIndex].children[0].innerText);
6749
+ const nextLineNumber = parseInt(trNodes[nextLineIndex].children[0].innerText);
6750
+ const isExpandAll = nextLineNumber - preLineNumber - 1 < expandThreshold.value;
6751
+ updateLineNumberInDatasetForDoubleColumn(trNodes[lineIndex], expandThreshold.value, "middle");
6375
6752
  attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
6376
6753
  }
6377
6754
  }
6378
6755
  }
6379
- const endLine = trNodes[0].cloneNode(true);
6380
- if (Object.prototype.hasOwnProperty.call(endLine.children[0].children, 0)) {
6381
- endLine.children[0].removeChild(endLine.children[0].children[0]);
6756
+ const loadMoreLine = trNodes[0].cloneNode(true);
6757
+ loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
6758
+ loadMoreLine.children[1].innerText = "";
6759
+ (_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
6760
+ updateLineNumberInDatasetForDoubleColumn(loadMoreLine, expandThreshold.value, "bottom");
6761
+ attachExpandUpDownButton(loadMoreLine.children[0], "down");
6762
+ };
6763
+ const insertIncrementCodeForDoubleColumn = (code, direction, referenceDom) => {
6764
+ if (!referenceDom) {
6765
+ return;
6766
+ }
6767
+ if (!code) {
6768
+ return referenceDom == null ? void 0 : referenceDom.remove();
6769
+ }
6770
+ const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
6771
+ const container = document.createElement("div");
6772
+ parseDiffCode(container, prefix + code, outputFormat.value);
6773
+ const trNodes = Array.from(container.querySelectorAll("tr"));
6774
+ const expandLine = trNodes.find((element) => {
6775
+ var _a;
6776
+ return (_a = element.children[1]) == null ? void 0 : _a.innerText.trim().match(ExpandLineReg);
6777
+ });
6778
+ if (!expandLine) {
6779
+ return;
6780
+ }
6781
+ const trNodesToBeInserted = trNodes.filter((element) => element !== expandLine);
6782
+ insertIncrementLineToPage(referenceDom, trNodesToBeInserted, direction);
6783
+ const removedExpandLine = ifRemoveExpandLineForDoubleColumn(referenceDom, expandLine, direction);
6784
+ if (removedExpandLine) {
6785
+ return;
6786
+ }
6787
+ updateExpandLineCount(referenceDom, expandLine);
6788
+ if (direction === "up") {
6789
+ if (!referenceDom.previousElementSibling) {
6790
+ updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "top");
6791
+ } else {
6792
+ updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "middle", true);
6793
+ }
6794
+ } else {
6795
+ if (referenceDom.nextElementSibling) {
6796
+ updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "middle", true);
6797
+ } else {
6798
+ updateLineNumberInDatasetForDoubleColumn(referenceDom, expandThreshold.value, "bottom");
6799
+ }
6382
6800
  }
6383
- endLine.children[1].innerText = "";
6384
- const leftEndLine = endLine.cloneNode(true);
6385
- const rightEndLint = endLine.cloneNode(true);
6386
- attachExpandUpDownButton(leftEndLine.children[0], "down");
6387
- leftTable.tBodies[0].appendChild(leftEndLine);
6388
- rightTable.tBodies[0].appendChild(rightEndLint);
6389
6801
  };
6390
6802
  const processLineByLine = () => {
6391
6803
  var _a;
@@ -6405,13 +6817,15 @@ function useCodeReviewExpand(reviewContentRef, expandAllThreshold, outputFormat)
6405
6817
  const nextLineIndex = lineIndex + 1;
6406
6818
  const prevLineIndex = lineIndex - 1;
6407
6819
  if (lineIndex === 0 && nextLineIndex in trNodes) {
6820
+ updateLineNumberInDataset(trNodes[lineIndex], expandThreshold.value, "top");
6408
6821
  attachExpandUpDownButton(lineNumberBox, "up");
6409
6822
  } else if (lineIndex > 0 && lineIndex < totalLines - 1 && nextLineIndex in trNodes && prevLineIndex in trNodes) {
6410
6823
  const prevTdNodes = Array.from(trNodes[prevLineIndex].children);
6411
6824
  const prevLineNumber = parseInt(prevTdNodes[0].children[0].innerText);
6412
6825
  const nextTdNodes = Array.from(trNodes[nextLineIndex].children);
6413
6826
  const nextLineNumber = parseInt(nextTdNodes[0].children[0].innerText);
6414
- const isExpandAll = nextLineNumber - prevLineNumber - 1 < expandAllThreshold;
6827
+ updateLineNumberInDataset(trNodes[lineIndex], expandThreshold.value, "middle");
6828
+ const isExpandAll = nextLineNumber - prevLineNumber <= expandThreshold.value;
6415
6829
  attachExpandUpDownButton(lineNumberBox, isExpandAll ? "all" : "updown");
6416
6830
  }
6417
6831
  }
@@ -6419,35 +6833,98 @@ function useCodeReviewExpand(reviewContentRef, expandAllThreshold, outputFormat)
6419
6833
  const loadMoreLine = trNodes[0].cloneNode(true);
6420
6834
  loadMoreLine.children[0].removeChild(loadMoreLine.children[0].children[0]);
6421
6835
  loadMoreLine.children[1].innerText = "";
6422
- loadMoreLine.children[1].style.height = "20px";
6423
- const lastTrNode = trNodes[totalLines - 1].children;
6424
- const leftLineStart = parseInt(lastTrNode[0].children[0].innerText) + 1;
6425
- const rightLineStart = parseInt(lastTrNode[0].children[1].innerText) + 1;
6426
- if (leftLineStart && rightLineStart) {
6427
- attachExpandUpDownButton(loadMoreLine.children[0], "down");
6428
- }
6429
6836
  (_a = trNodes[0].parentElement) == null ? void 0 : _a.appendChild(loadMoreLine);
6837
+ updateLineNumberInDataset(loadMoreLine, expandThreshold.value, "bottom");
6838
+ attachExpandUpDownButton(loadMoreLine.children[0], "down");
6839
+ };
6840
+ const insertIncrementCode = (code, direction, referenceDom) => {
6841
+ if (!referenceDom) {
6842
+ return;
6843
+ }
6844
+ if (!code) {
6845
+ return referenceDom == null ? void 0 : referenceDom.remove();
6846
+ }
6847
+ const prefix = "--- updated_at Jan 1, 2019, 0:0:0 AM\n+++ updated_at Jan 1, 2019, 0:0:0 AM\n";
6848
+ const container = document.createElement("div");
6849
+ parseDiffCode(container, prefix + code, outputFormat.value);
6850
+ const trNodes = Array.from(container.querySelectorAll("tr"));
6851
+ const expandLine = trNodes.find((element) => {
6852
+ var _a;
6853
+ return (_a = element.children[1]) == null ? void 0 : _a.innerText.trim().match(ExpandLineReg);
6854
+ });
6855
+ if (!expandLine) {
6856
+ return;
6857
+ }
6858
+ const trNodesToBeInserted = trNodes.filter((element) => element.children[0].children.length === 2);
6859
+ insertIncrementLineToPage(referenceDom, trNodesToBeInserted, direction);
6860
+ const removedExpandLine = ifRemoveExpandLine(referenceDom, expandLine, direction);
6861
+ if (removedExpandLine) {
6862
+ return;
6863
+ }
6864
+ updateExpandLineCount(referenceDom, expandLine);
6865
+ if (direction === "up") {
6866
+ if (!referenceDom.previousElementSibling) {
6867
+ updateLineNumberInDataset(referenceDom, expandThreshold.value, "top");
6868
+ } else {
6869
+ updateLineNumberInDataset(referenceDom, expandThreshold.value, "middle", true);
6870
+ }
6871
+ } else {
6872
+ if (referenceDom.nextElementSibling) {
6873
+ updateLineNumberInDataset(referenceDom, expandThreshold.value, "middle", true);
6874
+ } else {
6875
+ updateLineNumberInDataset(referenceDom, expandThreshold.value, "bottom");
6876
+ }
6877
+ }
6878
+ };
6879
+ const onExpandButtonClick = (e) => {
6880
+ var _a, _b;
6881
+ const composedPath = e.composedPath();
6882
+ const expandIconDom = composedPath.find((element) => {
6883
+ var _a2;
6884
+ return (_a2 = element.classList) == null ? void 0 : _a2.contains("expand-icon");
6885
+ });
6886
+ if (expandIconDom) {
6887
+ const expandDirection = (_a = Array.from(expandIconDom.classList).find((item) => item.endsWith("expand"))) == null ? void 0 : _a.split("-")[0];
6888
+ const direction = expandDirection === "up" || expandDirection === "all" ? "up" : "down";
6889
+ const [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd] = getLineNumberFromDataset(expandIconDom, expandThreshold.value);
6890
+ (_b = expandLoader == null ? void 0 : expandLoader.value) == null ? void 0 : _b.call(expandLoader, [leftLineStart, leftLineEnd, rightLineStart, rightLineEnd], (code) => {
6891
+ var _a2, _b2;
6892
+ outputFormat.value === "line-by-line" ? insertIncrementCode(code, direction, (_a2 = expandIconDom.parentElement) == null ? void 0 : _a2.parentElement) : insertIncrementCodeForDoubleColumn(code, direction, (_b2 = expandIconDom.parentElement) == null ? void 0 : _b2.parentElement);
6893
+ });
6894
+ }
6430
6895
  };
6431
6896
  const insertExpandButton = () => {
6432
- outputFormat === "side-by-side" ? processSideBySide() : processLineByLine();
6897
+ outputFormat.value === "side-by-side" ? processSideBySide() : processLineByLine();
6433
6898
  };
6434
- return { insertExpandButton };
6899
+ return { insertExpandButton, onExpandButtonClick };
6435
6900
  }
6436
6901
  function useCodeReview(props, ctx) {
6437
- const { diff, fold, outputFormat, expandAllThreshold } = toRefs(props);
6902
+ const { diff, outputFormat, allowExpand, showBlob } = toRefs(props);
6438
6903
  const renderHtml = ref("");
6439
- const isFold = ref(fold.value);
6440
6904
  const reviewContentRef = ref();
6441
- const diffFile = Diff2Html.parse(diff.value);
6442
- const { insertExpandButton } = useCodeReviewExpand(reviewContentRef, expandAllThreshold.value, outputFormat.value);
6905
+ const diffFile = ref([]);
6906
+ const { insertExpandButton, onExpandButtonClick } = useCodeReviewExpand(reviewContentRef, props);
6443
6907
  const initDiffContent = () => {
6444
- renderHtml.value = Diff2Html.html(diffFile, {
6445
- drawFileList: false,
6446
- matching: "lines",
6447
- outputFormat: outputFormat.value
6908
+ diffFile.value = Diff2Html.parse(diff.value);
6909
+ nextTick(() => {
6910
+ if (inBrowser && !showBlob.value) {
6911
+ parseDiffCode(reviewContentRef.value, diff.value, outputFormat.value);
6912
+ allowExpand.value && insertExpandButton();
6913
+ ctx.emit("contentRefresh", JSON.parse(JSON.stringify(diffFile.value)));
6914
+ }
6448
6915
  });
6449
- nextTick(insertExpandButton);
6450
6916
  };
6917
+ const onContentClick = (e) => {
6918
+ onExpandButtonClick(e);
6919
+ };
6920
+ watch(showBlob, initDiffContent);
6921
+ watch(outputFormat, initDiffContent);
6922
+ watch(diff, initDiffContent, { immediate: true });
6923
+ return { renderHtml, reviewContentRef, diffFile, onContentClick };
6924
+ }
6925
+ function useCodeReviewFold(props, ctx) {
6926
+ const { fold } = toRefs(props);
6927
+ const isFold = ref(fold.value);
6451
6928
  const toggleFold = (status) => {
6452
6929
  if (status !== void 0) {
6453
6930
  isFold.value = status;
@@ -6459,48 +6936,85 @@ function useCodeReview(props, ctx) {
6459
6936
  isFold.value = val;
6460
6937
  });
6461
6938
  watch(isFold, () => {
6462
- if (!isFold.value && renderHtml.value === "") {
6463
- initDiffContent();
6464
- }
6465
6939
  ctx.emit("foldChange", isFold.value);
6466
6940
  });
6467
- onBeforeMount(() => {
6468
- if (!isFold.value) {
6469
- initDiffContent();
6470
- }
6471
- });
6472
- provide(CodeReviewInjectionKey, { reviewContentRef, diffInfo: diffFile[0], isFold, rootCtx: ctx });
6473
- return { renderHtml, isFold, reviewContentRef, toggleFold };
6941
+ return { isFold, toggleFold };
6474
6942
  }
6475
- function useCodeReviewComment(reviewContentRef, ctx) {
6943
+ function useCodeReviewComment(reviewContentRef, props, ctx) {
6944
+ const { outputFormat, allowComment } = toRefs(props);
6476
6945
  const ns2 = useNamespace("code-review");
6477
6946
  const commentLeft = ref(-100);
6478
6947
  const commentTop = ref(-100);
6479
6948
  let currentLeftLineNumber = -1;
6480
6949
  let currentRightLineNumber = -1;
6950
+ let lastLineNumberContainer;
6481
6951
  const resetLeftTop = () => {
6482
6952
  commentLeft.value = -100;
6483
6953
  commentTop.value = -100;
6484
6954
  currentLeftLineNumber = -1;
6485
6955
  currentRightLineNumber = -1;
6486
- };
6487
- const onMouseEnter = (e) => {
6488
- e.currentTarget.getBoundingClientRect();
6956
+ lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
6957
+ lastLineNumberContainer = null;
6489
6958
  };
6490
6959
  const onMouseMove = (e) => {
6491
6960
  var _a, _b;
6492
6961
  const composedPath = e.composedPath();
6493
6962
  const trNode = composedPath.find((item) => item.tagName === "TR");
6494
6963
  if (trNode) {
6495
- const lineNumberContainer = Array.from(trNode.children)[0];
6496
- if (notEmptyNode(lineNumberContainer)) {
6497
- const { top, left } = lineNumberContainer.getBoundingClientRect();
6498
- commentLeft.value = left;
6499
- commentTop.value = top;
6500
- currentLeftLineNumber = parseInt((_a = lineNumberContainer.children[0]) == null ? void 0 : _a.innerText) || -1;
6501
- currentRightLineNumber = parseInt((_b = lineNumberContainer.children[1]) == null ? void 0 : _b.innerText) || -1;
6964
+ if (outputFormat.value === "line-by-line") {
6965
+ const lineNumberContainer = Array.from(trNode.children)[0];
6966
+ if (lastLineNumberContainer !== lineNumberContainer) {
6967
+ lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
6968
+ }
6969
+ if (notEmptyNode(lineNumberContainer)) {
6970
+ lastLineNumberContainer = lineNumberContainer;
6971
+ lineNumberContainer.classList.add("comment-icon-hover");
6972
+ const { top, left } = lineNumberContainer.getBoundingClientRect();
6973
+ commentLeft.value = left;
6974
+ commentTop.value = top;
6975
+ currentLeftLineNumber = parseInt((_a = lineNumberContainer.children[0]) == null ? void 0 : _a.innerText) || -1;
6976
+ currentRightLineNumber = parseInt((_b = lineNumberContainer.children[1]) == null ? void 0 : _b.innerText) || -1;
6977
+ } else {
6978
+ resetLeftTop();
6979
+ }
6502
6980
  } else {
6503
- resetLeftTop();
6981
+ if (trNode.classList.contains("comment-block")) {
6982
+ return resetLeftTop();
6983
+ }
6984
+ const tdNode = composedPath.find((item) => item.tagName === "TD");
6985
+ const tdIndex = Array.from(trNode.children).findIndex((item) => item === tdNode);
6986
+ const tdNodes = Array.from(trNode.children);
6987
+ const leftLineNumberContainer = tdNodes[0];
6988
+ const rightLineNumberContainer = tdNodes[2];
6989
+ if (tdIndex < 2) {
6990
+ if (lastLineNumberContainer !== leftLineNumberContainer) {
6991
+ lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
6992
+ }
6993
+ if (notEmptyNode(leftLineNumberContainer)) {
6994
+ lastLineNumberContainer = leftLineNumberContainer;
6995
+ leftLineNumberContainer.classList.add("comment-icon-hover");
6996
+ const { top, left } = leftLineNumberContainer.getBoundingClientRect();
6997
+ commentLeft.value = left;
6998
+ commentTop.value = top;
6999
+ currentLeftLineNumber = parseInt(leftLineNumberContainer.innerText);
7000
+ } else {
7001
+ resetLeftTop();
7002
+ }
7003
+ } else {
7004
+ if (lastLineNumberContainer !== rightLineNumberContainer) {
7005
+ lastLineNumberContainer == null ? void 0 : lastLineNumberContainer.classList.remove("comment-icon-hover");
7006
+ }
7007
+ if (rightLineNumberContainer && notEmptyNode(rightLineNumberContainer)) {
7008
+ lastLineNumberContainer = rightLineNumberContainer;
7009
+ rightLineNumberContainer.classList.add("comment-icon-hover");
7010
+ const { top, left } = rightLineNumberContainer.getBoundingClientRect();
7011
+ commentLeft.value = left;
7012
+ commentTop.value = top;
7013
+ currentRightLineNumber = parseInt(rightLineNumberContainer.innerText);
7014
+ } else {
7015
+ resetLeftTop();
7016
+ }
7017
+ }
6504
7018
  }
6505
7019
  }
6506
7020
  };
@@ -6516,46 +7030,68 @@ function useCodeReviewComment(reviewContentRef, ctx) {
6516
7030
  resetLeftTop();
6517
7031
  }
6518
7032
  };
6519
- const onCommentIconClick = () => {
6520
- ctx.emit("addComment", { left: currentLeftLineNumber, right: currentRightLineNumber });
6521
- };
6522
- const findReferenceDom = (lineNumber, lineSide) => {
6523
- var _a, _b, _c, _d;
6524
- const trNodes = Array.from(reviewContentRef.value.querySelectorAll("tr"));
6525
- for (const index2 in trNodes) {
6526
- const lineIndex = parseInt(index2);
6527
- const lineNumberBox = Array.from(trNodes[lineIndex].children)[0];
6528
- if (notEmptyNode(lineNumberBox)) {
6529
- const oldLineNumber = parseInt((_b = (_a = lineNumberBox.children[0]) == null ? void 0 : _a.innerText) != null ? _b : -1);
6530
- const newLineNumber = parseInt((_d = (_c = lineNumberBox.children[1]) == null ? void 0 : _c.innerText) != null ? _d : -1);
6531
- if (lineSide === "left" && oldLineNumber === lineNumber || lineSide === "right" && newLineNumber === lineNumber) {
6532
- return trNodes[lineIndex];
6533
- }
7033
+ const onCommentIconClick = (e) => {
7034
+ if (e) {
7035
+ const composedPath = e.composedPath();
7036
+ const lineNumberBox = composedPath.find((item) => {
7037
+ var _a, _b;
7038
+ return ((_a = item.classList) == null ? void 0 : _a.contains("comment-icon-hover")) || ((_b = item.classList) == null ? void 0 : _b.contains("comment-icon"));
7039
+ });
7040
+ if (!lineNumberBox) {
7041
+ return;
6534
7042
  }
6535
7043
  }
7044
+ if (outputFormat.value === "line-by-line")
7045
+ ;
7046
+ ctx.emit("addComment", { left: currentLeftLineNumber, right: currentRightLineNumber });
6536
7047
  };
6537
7048
  const insertComment = (lineNumber, lineSide, commentDom) => {
6538
- const lineHost = findReferenceDom(lineNumber, lineSide);
6539
- lineHost && addCommentToPage(lineHost, commentDom, lineSide);
7049
+ if (outputFormat.value === "line-by-line") {
7050
+ const lineHost = findReferenceDomForSingleColumn(reviewContentRef.value, lineNumber, lineSide);
7051
+ lineHost && addCommentToPageForSingleColumn(lineHost, commentDom, lineSide);
7052
+ } else {
7053
+ const lineHost = findReferenceDomForDoubleColumn(reviewContentRef.value, lineNumber, lineSide);
7054
+ lineHost && addCommentToPageForDoubleColumn(lineHost, commentDom, lineSide);
7055
+ }
6540
7056
  };
6541
7057
  const removeComment = (lineNumber, lineSide) => {
6542
- const lineHost = findReferenceDom(lineNumber, lineSide);
6543
- let nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
6544
- while (nextLineHost) {
6545
- const classList = nextLineHost == null ? void 0 : nextLineHost.classList;
6546
- if ((classList == null ? void 0 : classList.contains("comment-block")) && classList.contains(lineSide)) {
6547
- nextLineHost.remove();
6548
- return;
7058
+ if (outputFormat.value === "line-by-line") {
7059
+ const lineHost = findReferenceDomForSingleColumn(reviewContentRef.value, lineNumber, lineSide);
7060
+ let nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
7061
+ while (nextLineHost) {
7062
+ const classList = nextLineHost == null ? void 0 : nextLineHost.classList;
7063
+ if ((classList == null ? void 0 : classList.contains("comment-block")) && classList.contains(lineSide)) {
7064
+ nextLineHost.remove();
7065
+ return;
7066
+ }
7067
+ nextLineHost = nextLineHost.nextElementSibling;
7068
+ }
7069
+ } else {
7070
+ const lineHost = findReferenceDomForDoubleColumn(reviewContentRef.value, lineNumber, lineSide);
7071
+ const nextLineHost = lineHost == null ? void 0 : lineHost.nextElementSibling;
7072
+ if (nextLineHost && nextLineHost.classList.contains("comment-block")) {
7073
+ const leftChildren = nextLineHost.children[0];
7074
+ const rightChildren = nextLineHost.children[1];
7075
+ if (lineSide === "left") {
7076
+ leftChildren.children[0].remove();
7077
+ } else {
7078
+ rightChildren.children[0].remove();
7079
+ }
7080
+ if (!leftChildren.children.length && !rightChildren.children.length) {
7081
+ nextLineHost.remove();
7082
+ }
6549
7083
  }
6550
- nextLineHost = nextLineHost.nextElementSibling;
6551
7084
  }
6552
7085
  };
7086
+ const mouseEvent = allowComment.value ? { onMousemove: onMouseMove, onMouseleave } : {};
7087
+ window.addEventListener("scroll", resetLeftTop);
7088
+ onUnmounted(() => {
7089
+ window.removeEventListener("scroll", resetLeftTop);
7090
+ });
6553
7091
  return {
6554
7092
  commentLeft,
6555
7093
  commentTop,
6556
- onMouseEnter,
6557
- onMouseMove,
6558
- onMouseleave,
7094
+ mouseEvent,
6559
7095
  onCommentMouseLeave,
6560
7096
  onCommentIconClick,
6561
7097
  insertComment,
@@ -6566,26 +7102,28 @@ var codeReview = "";
6566
7102
  var CodeReview = defineComponent({
6567
7103
  name: "DCodeReview",
6568
7104
  props: codeReviewProps,
6569
- emits: ["foldChange", "addComment", "afterViewInit"],
7105
+ emits: ["foldChange", "addComment", "afterViewInit", "contentRefresh"],
6570
7106
  setup(props, ctx) {
6571
7107
  const ns2 = useNamespace("code-review");
6572
7108
  const {
6573
7109
  renderHtml,
6574
- isFold,
6575
7110
  reviewContentRef,
6576
- toggleFold
7111
+ diffFile,
7112
+ onContentClick
6577
7113
  } = useCodeReview(props, ctx);
7114
+ const {
7115
+ isFold,
7116
+ toggleFold
7117
+ } = useCodeReviewFold(props, ctx);
6578
7118
  const {
6579
7119
  commentLeft,
6580
7120
  commentTop,
6581
- onMouseEnter,
6582
- onMouseMove,
6583
- onMouseleave,
7121
+ mouseEvent,
6584
7122
  onCommentMouseLeave,
6585
7123
  onCommentIconClick,
6586
7124
  insertComment,
6587
7125
  removeComment
6588
- } = useCodeReviewComment(reviewContentRef, ctx);
7126
+ } = useCodeReviewComment(reviewContentRef, props, ctx);
6589
7127
  onMounted(() => {
6590
7128
  ctx.emit("afterViewInit", {
6591
7129
  toggleFold,
@@ -6593,28 +7131,36 @@ var CodeReview = defineComponent({
6593
7131
  removeComment
6594
7132
  });
6595
7133
  });
6596
- return () => createVNode("div", {
6597
- "class": ns2.b()
6598
- }, [createVNode(CodeReviewHeader, {
6599
- "onClick": () => isFold.value = !isFold.value
6600
- }, null), createVNode("div", {
6601
- "class": [ns2.e("content"), {
6602
- "hide-content": isFold.value
6603
- }],
6604
- "innerHTML": renderHtml.value,
6605
- "ref": reviewContentRef,
6606
- "onMouseenter": onMouseEnter,
6607
- "onMousemove": onMouseMove,
6608
- "onMouseleave": onMouseleave
6609
- }, null), createVNode("div", {
6610
- "class": "comment-icon",
6611
- "style": {
6612
- left: commentLeft.value + "px",
6613
- top: commentTop.value + "px"
6614
- },
6615
- "onClick": onCommentIconClick,
6616
- "onMouseleave": onCommentMouseLeave
6617
- }, [createVNode(CommentIcon, null, null)])]);
7134
+ provide(CodeReviewInjectionKey, {
7135
+ reviewContentRef,
7136
+ diffInfo: diffFile.value[0],
7137
+ isFold,
7138
+ rootCtx: ctx
7139
+ });
7140
+ return () => {
7141
+ var _a, _b;
7142
+ return createVNode("div", {
7143
+ "class": ns2.b()
7144
+ }, [createVNode(CodeReviewHeader, {
7145
+ "onClick": () => isFold.value = !isFold.value
7146
+ }, null), withDirectives(createVNode("div", null, [props.showBlob ? (_b = (_a = ctx.slots).blob) == null ? void 0 : _b.call(_a) : createVNode("div", mergeProps({
7147
+ "class": [ns2.e("content"), props.outputFormat],
7148
+ "innerHTML": renderHtml.value,
7149
+ "ref": reviewContentRef,
7150
+ "onClick": (e) => {
7151
+ onContentClick(e);
7152
+ onCommentIconClick(e);
7153
+ }
7154
+ }, mouseEvent), null)]), [[vShow, !isFold.value]]), props.allowComment && createVNode("div", {
7155
+ "class": "comment-icon",
7156
+ "style": {
7157
+ left: commentLeft.value + "px",
7158
+ top: commentTop.value + "px"
7159
+ },
7160
+ "onClick": onCommentIconClick,
7161
+ "onMouseleave": onCommentMouseLeave
7162
+ }, [createVNode(CommentIcon, null, null)])]);
7163
+ };
6618
7164
  }
6619
7165
  });
6620
7166
  var index = {