@oh-my-pi/pi-tui 11.1.0 → 11.2.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@oh-my-pi/pi-tui",
3
- "version": "11.1.0",
3
+ "version": "11.2.1",
4
4
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -47,8 +47,8 @@
47
47
  "bun": ">=1.3.7"
48
48
  },
49
49
  "dependencies": {
50
- "@oh-my-pi/pi-natives": "11.1.0",
51
- "@oh-my-pi/pi-utils": "11.1.0",
50
+ "@oh-my-pi/pi-natives": "11.2.1",
51
+ "@oh-my-pi/pi-utils": "11.2.1",
52
52
  "@types/mime-types": "^3.0.1",
53
53
  "chalk": "^5.6.2",
54
54
  "marked": "^17.0.1",
package/src/mermaid.ts CHANGED
@@ -63,8 +63,8 @@ export async function renderMermaidToPng(
63
63
  return null;
64
64
  }
65
65
 
66
- const buffer = Buffer.from(await outputFile.bytes());
67
- const base64 = buffer.toString("base64");
66
+ const buffer = await outputFile.bytes();
67
+ const base64 = buffer.toBase64();
68
68
 
69
69
  const dims = parsePngDimensions(buffer);
70
70
  if (!dims) {
@@ -83,14 +83,15 @@ export async function renderMermaidToPng(
83
83
  }
84
84
  }
85
85
 
86
- function parsePngDimensions(buffer: Buffer): { width: number; height: number } | null {
86
+ function parsePngDimensions(buffer: Uint8Array): { width: number; height: number } | null {
87
87
  if (buffer.length < 24) return null;
88
88
  if (buffer[0] !== 0x89 || buffer[1] !== 0x50 || buffer[2] !== 0x4e || buffer[3] !== 0x47) {
89
89
  return null;
90
90
  }
91
+ const view = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
91
92
  return {
92
- width: buffer.readUInt32BE(16),
93
- height: buffer.readUInt32BE(20),
93
+ width: view.getUint32(16, false),
94
+ height: view.getUint32(20, false),
94
95
  };
95
96
  }
96
97
 
@@ -192,7 +192,7 @@ export function encodeITerm2(
192
192
  if (options.width !== undefined) params.push(`width=${options.width}`);
193
193
  if (options.height !== undefined) params.push(`height=${options.height}`);
194
194
  if (options.name) {
195
- const nameBase64 = Buffer.from(options.name).toString("base64");
195
+ const nameBase64 = Buffer.from(options.name).toBase64();
196
196
  params.push(`name=${nameBase64}`);
197
197
  }
198
198
  if (options.preserveAspectRatio === false) {