@oh-my-pi/pi-tui 8.0.20 → 8.2.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 +24 -18
- package/src/autocomplete.ts +86 -60
- package/src/components/box.ts +2 -2
- package/src/components/cancellable-loader.ts +1 -1
- package/src/components/editor.ts +57 -28
- package/src/components/image.ts +2 -2
- package/src/components/input.ts +4 -4
- package/src/components/loader.ts +1 -1
- package/src/components/markdown.ts +106 -10
- package/src/components/select-list.ts +5 -5
- package/src/components/settings-list.ts +6 -6
- package/src/components/spacer.ts +1 -1
- package/src/components/tab-bar.ts +3 -4
- package/src/components/text.ts +2 -2
- package/src/components/truncated-text.ts +2 -2
- package/src/fuzzy.ts +2 -2
- package/src/index.ts +8 -0
- package/src/keybindings.ts +2 -2
- package/src/mermaid.ts +139 -0
- package/src/stdin-buffer.ts +1 -2
- package/src/terminal.ts +43 -27
- package/src/tui.ts +5 -6
- package/src/utils.ts +1 -1
- package/tsconfig.json +0 -42
package/src/tui.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Minimal TUI implementation with differential rendering
|
|
3
3
|
*/
|
|
4
|
-
|
|
5
4
|
import * as fs from "node:fs";
|
|
6
5
|
import * as os from "node:os";
|
|
7
6
|
import * as path from "node:path";
|
|
@@ -337,7 +336,7 @@ export class TUI extends Container {
|
|
|
337
336
|
|
|
338
337
|
/** Check if there are any visible overlays */
|
|
339
338
|
hasOverlay(): boolean {
|
|
340
|
-
return this.overlayStack.some(
|
|
339
|
+
return this.overlayStack.some(o => this.isOverlayVisible(o));
|
|
341
340
|
}
|
|
342
341
|
|
|
343
342
|
/** Check if an overlay entry is currently visible */
|
|
@@ -366,7 +365,7 @@ export class TUI extends Container {
|
|
|
366
365
|
|
|
367
366
|
start(): void {
|
|
368
367
|
this.terminal.start(
|
|
369
|
-
|
|
368
|
+
data => this.handleInput(data),
|
|
370
369
|
() => this.requestRender(),
|
|
371
370
|
);
|
|
372
371
|
this.terminal.hideCursor();
|
|
@@ -423,7 +422,7 @@ export class TUI extends Container {
|
|
|
423
422
|
|
|
424
423
|
async waitForRender(): Promise<void> {
|
|
425
424
|
if (!this.renderRequested && !this.rendering) return;
|
|
426
|
-
await new Promise<void>(
|
|
425
|
+
await new Promise<void>(resolve => {
|
|
427
426
|
const check = () => {
|
|
428
427
|
if (!this.renderRequested && !this.rendering) {
|
|
429
428
|
resolve();
|
|
@@ -467,7 +466,7 @@ export class TUI extends Container {
|
|
|
467
466
|
|
|
468
467
|
// If focused component is an overlay, verify it's still visible
|
|
469
468
|
// (visibility can change due to terminal resize or visible() callback)
|
|
470
|
-
const focusedOverlay = this.overlayStack.find(
|
|
469
|
+
const focusedOverlay = this.overlayStack.find(o => o.component === this.focusedComponent);
|
|
471
470
|
if (focusedOverlay && !this.isOverlayVisible(focusedOverlay)) {
|
|
472
471
|
// Focused overlay is no longer visible, redirect to topmost visible overlay
|
|
473
472
|
const topVisible = this.getTopmostVisibleOverlay();
|
|
@@ -752,7 +751,7 @@ export class TUI extends Container {
|
|
|
752
751
|
|
|
753
752
|
private applyLineResets(lines: string[]): string[] {
|
|
754
753
|
const reset = TUI.SEGMENT_RESET;
|
|
755
|
-
return lines.map(
|
|
754
|
+
return lines.map(line => (this.containsImage(line) ? line : line + reset));
|
|
756
755
|
}
|
|
757
756
|
|
|
758
757
|
/**
|
package/src/utils.ts
CHANGED
|
@@ -555,7 +555,7 @@ function wrapSingleLine(line: string, width: number): string[] {
|
|
|
555
555
|
}
|
|
556
556
|
|
|
557
557
|
// Trailing whitespace can cause lines to exceed the requested width
|
|
558
|
-
return wrapped.length > 0 ? wrapped.map(
|
|
558
|
+
return wrapped.length > 0 ? wrapped.map(line => line.trimEnd()) : [""];
|
|
559
559
|
}
|
|
560
560
|
|
|
561
561
|
const PUNCTUATION_REGEX = /[(){}[\]<>.,;:'"!?+\-=*/\\|&%^$#@~`]/;
|
package/tsconfig.json
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2024",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"lib": [
|
|
6
|
-
"ES2024"
|
|
7
|
-
],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"moduleResolution": "Bundler",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"allowImportingTsExtensions": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"emitDecoratorMetadata": true,
|
|
17
|
-
"useDefineForClassFields": false,
|
|
18
|
-
"types": [
|
|
19
|
-
"bun",
|
|
20
|
-
"node"
|
|
21
|
-
],
|
|
22
|
-
"noEmit": true,
|
|
23
|
-
"baseUrl": ".",
|
|
24
|
-
"paths": {
|
|
25
|
-
"@oh-my-pi/pi-tui": [
|
|
26
|
-
"./src/index.ts"
|
|
27
|
-
],
|
|
28
|
-
"@oh-my-pi/pi-tui/*": [
|
|
29
|
-
"./src/*"
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"include": [
|
|
34
|
-
"src/**/*.ts"
|
|
35
|
-
],
|
|
36
|
-
"exclude": [
|
|
37
|
-
"node_modules",
|
|
38
|
-
"dist",
|
|
39
|
-
"**/*.test.ts",
|
|
40
|
-
"test/**"
|
|
41
|
-
]
|
|
42
|
-
}
|