pi-diff-widget 0.1.2 → 0.1.3

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/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.3] - 2026-10-12
8
+
9
+ ### Added
10
+
11
+ - `pi.image` gallery preview: a screenshot of the live edits widget, shown on the
12
+ pi.dev package page and in the README.
13
+
7
14
  ## [0.1.2] - 2026-10-12
8
15
 
9
16
  ### Changed
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Interactive diff viewer and live edits widget for [pi](https://pi.dev).
4
4
 
5
+ ![Live edits widget showing 4 files, +17 -2](https://cdn.jsdelivr.net/gh/omgzsa/pi-diff-widget@v0.1.3/docs/widget.png)
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-diff-widget",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Interactive diff viewer for pi: uncommitted changes and per-turn diffs",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -26,6 +26,7 @@
26
26
  "LICENSE"
27
27
  ],
28
28
  "pi": {
29
+ "image": "https://cdn.jsdelivr.net/gh/omgzsa/pi-diff-widget@v0.1.3/docs/widget.png",
29
30
  "extensions": [
30
31
  "./src/index.ts"
31
32
  ]
package/src/baseline.ts CHANGED
@@ -38,7 +38,11 @@ export async function readBaseline(
38
38
  return { content, existed: true };
39
39
  }
40
40
 
41
- /** Content only, for callers that do not care whether the file existed. */
41
+ /**
42
+ * Content only, for callers that do not care whether the file existed. A missing
43
+ * path returns an empty string, not undefined, so callers that must tell a
44
+ * vanished file apart from an empty one use readBaseline or locationGone.
45
+ */
42
46
  export async function readFileCapped(
43
47
  path: string,
44
48
  maxBytes = MAX_BASELINE_BYTES,
package/src/git.ts CHANGED
@@ -19,6 +19,8 @@ export interface DiffFile {
19
19
  diff: string;
20
20
  }
21
21
 
22
+ // Files larger than this are reported as too-large instead of read into memory,
23
+ // and diffs are cut off at the line cap so one huge file cannot stall the view.
22
24
  const MAX_TEXT_BYTES = 512 * 1024;
23
25
  const MAX_DIFF_LINES = 4000;
24
26
 
package/src/ui.ts CHANGED
@@ -76,7 +76,9 @@ export class DiffViewer implements Component {
76
76
  const label = this.turns[this.turnIndex]?.label ?? '';
77
77
  return `${this.title} · turns ${this.theme.fg('dim', `${counter} ${label}`)}`;
78
78
  }
79
- return `${this.title} · uncommitted ${this.theme.fg('dim', `[${this.uncommitted.length} files]`)}`;
79
+ const count = this.uncommitted.length;
80
+ const label = count === 1 ? '1 file' : `${count} files`;
81
+ return `${this.title} · uncommitted ${this.theme.fg('dim', `[${label}]`)}`;
80
82
  }
81
83
 
82
84
  private footerHint(): string {