@f5xc-salesdemos/pi-tui 18.86.1 → 18.87.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5xc-salesdemos/pi-tui",
4
- "version": "18.86.1",
4
+ "version": "18.87.0",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://github.com/f5xc-salesdemos/xcsh",
7
7
  "author": "Can Boluk",
@@ -37,8 +37,8 @@
37
37
  "fmt": "biome format --write ."
38
38
  },
39
39
  "dependencies": {
40
- "@f5xc-salesdemos/pi-natives": "18.86.1",
41
- "@f5xc-salesdemos/pi-utils": "18.86.1",
40
+ "@f5xc-salesdemos/pi-natives": "18.87.0",
41
+ "@f5xc-salesdemos/pi-utils": "18.87.0",
42
42
  "marked": "^17.0"
43
43
  },
44
44
  "devDependencies": {
@@ -31,7 +31,13 @@ export class TerminalInfo {
31
31
  if (this.imageProtocol === ImageProtocol.Sixel) {
32
32
  return SIXEL_DCS_START_REGEX.test(line.slice(0, 128));
33
33
  }
34
- return line.slice(0, 64).includes(this.imageProtocol);
34
+ const prefix = line.slice(0, 64);
35
+ if (prefix.includes(this.imageProtocol)) return true;
36
+ // iTerm2 multipart transfer uses FilePart= and FileEnd instead of File=
37
+ if (this.imageProtocol === ImageProtocol.Iterm2) {
38
+ return prefix.includes("\x1b]1337;FilePart=") || prefix.includes("\x1b]1337;FileEnd");
39
+ }
40
+ return false;
35
41
  }
36
42
 
37
43
  formatNotification(message: string): string {
@@ -93,7 +99,9 @@ export function isWindowsTerminalPreviewSixelSupported(
93
99
  }
94
100
  function getFallbackImageProtocol(terminalId: TerminalId): ImageProtocol | null {
95
101
  if (!process.stdout.isTTY) return null;
96
- if (terminalId === "vscode" || terminalId === "alacritty") return null;
102
+ if (terminalId === "alacritty") return null;
103
+ // VS Code 1.80+ supports iTerm2 inline image protocol
104
+ if (terminalId === "vscode") return ImageProtocol.Iterm2;
97
105
  const term = Bun.env.TERM?.toLowerCase() ?? "";
98
106
  if (term.includes("screen") || term.includes("tmux") || term.includes("ghostty")) {
99
107
  return ImageProtocol.Kitty;
@@ -299,7 +307,7 @@ export function calculateImageRows(
299
307
  const targetWidthPx = targetWidthCells * cellDimensions.widthPx;
300
308
  const scale = targetWidthPx / imageDimensions.widthPx;
301
309
  const scaledHeightPx = imageDimensions.heightPx * scale;
302
- const rows = Math.ceil(scaledHeightPx / cellDimensions.heightPx);
310
+ const rows = Math.round(scaledHeightPx / cellDimensions.heightPx);
303
311
  return Math.max(1, rows);
304
312
  }
305
313
 
@@ -324,7 +332,7 @@ function calculateImageFit(
324
332
  const fittedHeightPx = imageDimensions.heightPx * scale;
325
333
 
326
334
  const columns = Math.max(1, Math.floor(fittedWidthPx / cellDims.widthPx));
327
- const rows = Math.max(1, Math.ceil(fittedHeightPx / cellDims.heightPx));
335
+ const rows = Math.max(1, Math.round(fittedHeightPx / cellDims.heightPx));
328
336
 
329
337
  return {
330
338
  columns: maxColumns !== undefined ? Math.min(columns, maxColumns) : columns,
@@ -507,7 +515,7 @@ export function renderImage(
507
515
  if (TERMINAL.imageProtocol === ImageProtocol.Iterm2) {
508
516
  const sequence = encodeITerm2(base64Data, {
509
517
  width: fit.columns,
510
- height: "auto",
518
+ height: fit.rows,
511
519
  preserveAspectRatio: options.preserveAspectRatio ?? true,
512
520
  });
513
521
  return { sequence, rows: fit.rows };