@heyhuynhgiabuu/pi-diff 0.1.3 → 0.1.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heyhuynhgiabuu/pi-diff",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Shiki-powered terminal diff renderer for pi — syntax-highlighted, word-level diffs in split and unified views.",
5
5
  "author": "huynhgiabuu",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -400,7 +400,7 @@ const BORDER_BAR = "▌";
400
400
  /** Generate a dense diagonal stripe fill for empty filler cells.
401
401
  * Solid ╱ characters — uniform direction like CSS diagonal hatching. */
402
402
  function stripes(w: number, _rowOffset: number): string {
403
- return FG_STRIPE + "╱".repeat(w) + RST;
403
+ return BG_BASE + FG_STRIPE + "╱".repeat(w) + RST;
404
404
  }
405
405
 
406
406
  let DIVIDER = `${FG_RULE}│${RST}`;
@@ -665,7 +665,7 @@ function summarize(a: number, d: number): string {
665
665
  }
666
666
 
667
667
  function rule(w: number): string {
668
- return `${FG_RULE}${"─".repeat(w)}${RST}`;
668
+ return `${BG_BASE}${FG_RULE}${"─".repeat(w)}${RST}`;
669
669
  }
670
670
 
671
671
  /**
@@ -1002,7 +1002,7 @@ async function renderUnified(
1002
1002
  const pad = Math.max(0, totalW - label.length - 2);
1003
1003
  const half1 = Math.floor(pad / 2),
1004
1004
  half2 = pad - half1;
1005
- out.push(`${FG_DIM}${"─".repeat(half1)}${label}${"─".repeat(half2)}${RST}`);
1005
+ out.push(`${BG_BASE}${FG_DIM}${"─".repeat(half1)}${label}${"─".repeat(half2)}${RST}`);
1006
1006
  idx++;
1007
1007
  continue;
1008
1008
  }
@@ -1062,7 +1062,7 @@ async function renderUnified(
1062
1062
 
1063
1063
  out.push(rule(tw));
1064
1064
  if (diff.lines.length > vis.length) {
1065
- out.push(`${FG_DIM} … ${diff.lines.length - vis.length} more lines${RST}`);
1065
+ out.push(`${BG_BASE}${FG_DIM} … ${diff.lines.length - vis.length} more lines${RST}`);
1066
1066
  }
1067
1067
  return out.join("\n");
1068
1068
  }
@@ -1148,8 +1148,8 @@ async function renderSplit(
1148
1148
  if (line.type === "sep") {
1149
1149
  const gap = line.newNum;
1150
1150
  const label = gap && gap > 0 ? `··· ${gap} lines ···` : "···";
1151
- const g = ` ${FG_DIM}${fit("", nw + 2)}${RST}${FG_RULE}│${RST} `;
1152
- return { gutter: g, contGutter: g, bodyRows: [`${FG_DIM}${fit(label, cw)}${RST}`] };
1151
+ const g = `${BG_BASE} ${FG_DIM}${fit("", nw + 2)}${RST}${FG_RULE}│${RST} `;
1152
+ return { gutter: g, contGutter: g, bodyRows: [`${BG_BASE}${FG_DIM}${fit(label, cw)}${RST}`] };
1153
1153
  }
1154
1154
 
1155
1155
  const isDel = line.type === "del",
@@ -1182,9 +1182,9 @@ async function renderSplit(
1182
1182
 
1183
1183
  const out: string[] = [];
1184
1184
  // Column headers — "old" / "new" positioned above line numbers
1185
- const hdrOld = `${" ".repeat(Math.max(0, nw - 2))}${dc.fgDel}${DIM}old${RST}`;
1186
- const hdrNew = `${" ".repeat(Math.max(0, nw - 2))}${dc.fgAdd}${DIM}new${RST}`;
1187
- out.push(`${hdrOld}${" ".repeat(Math.max(0, half - nw - 1))}${FG_RULE}┊${RST}${hdrNew}`);
1185
+ const hdrOld = `${BG_BASE}${" ".repeat(Math.max(0, nw - 2))}${dc.fgDel}${DIM}old${RST}`;
1186
+ const hdrNew = `${BG_BASE}${" ".repeat(Math.max(0, nw - 2))}${dc.fgAdd}${DIM}new${RST}`;
1187
+ out.push(`${BG_BASE}${hdrOld}${" ".repeat(Math.max(0, half - nw - 1))}${FG_RULE}┊${RST}${hdrNew}`);
1188
1188
  out.push(`${rule(half)}${FG_RULE}┊${RST}${rule(half)}`);
1189
1189
 
1190
1190
  for (const r of vis) {
@@ -1230,7 +1230,7 @@ async function renderSplit(
1230
1230
 
1231
1231
  out.push(`${rule(half)}${FG_RULE}┊${RST}${rule(half)}`);
1232
1232
  if (rows.length > vis.length) {
1233
- out.push(`${FG_DIM} … ${rows.length - vis.length} more lines${RST}`);
1233
+ out.push(`${BG_BASE}${FG_DIM} … ${rows.length - vis.length} more lines${RST}`);
1234
1234
  }
1235
1235
  return out.join("\n");
1236
1236
  }