@gajae-code/tui 0.12.6 → 0.12.7

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
@@ -2,9 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.12.7] - 2026-07-31
6
+
5
7
  ## [0.12.6] - 2026-07-31
6
8
  ### Fixed
7
9
 
10
+ - Truncated text now shrinks horizontal padding when the viewport is narrower than the requested inset, keeping every rendered line within its width contract.
8
11
  - Select-list no-match rows now stay within the requested render width instead of wrapping into extra terminal lines after narrow resizes (#3600).
9
12
 
10
13
  ## [0.12.5] - 2026-07-30
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/tui",
4
- "version": "0.12.6",
4
+ "version": "0.12.7",
5
5
  "description": "Terminal User Interface library with differential rendering for efficient text-based applications",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo and Gajae Code Contributors",
@@ -36,8 +36,8 @@
36
36
  "fmt": "biome format --write ."
37
37
  },
38
38
  "dependencies": {
39
- "@gajae-code/natives": "0.12.6",
40
- "@gajae-code/utils": "0.12.6",
39
+ "@gajae-code/natives": "0.12.7",
40
+ "@gajae-code/utils": "0.12.7",
41
41
  "lru-cache": "11.3.6",
42
42
  "marked": "18.0.6"
43
43
  },
@@ -21,9 +21,10 @@ export class TruncatedText implements Component {
21
21
 
22
22
  render(width: number): string[] {
23
23
  const result: string[] = [];
24
+ const safeWidth = Math.max(0, Math.trunc(width));
24
25
 
25
26
  // Empty line padded to width
26
- const emptyLine = padding(width);
27
+ const emptyLine = padding(safeWidth);
27
28
 
28
29
  // Add vertical padding above
29
30
  for (let i = 0; i < this.#paddingY; i++) {
@@ -31,7 +32,11 @@ export class TruncatedText implements Component {
31
32
  }
32
33
 
33
34
  // Calculate available width after horizontal padding
34
- const availableWidth = Math.max(1, width - this.#paddingX * 2);
35
+ const horizontalPadding = Math.max(
36
+ 0,
37
+ Math.min(Math.trunc(this.#paddingX), Math.floor(Math.max(0, safeWidth - 1) / 2)),
38
+ );
39
+ const availableWidth = safeWidth - horizontalPadding * 2;
35
40
 
36
41
  // Take only the first line (stop at newline)
37
42
  let singleLineText = this.#text;
@@ -44,8 +49,8 @@ export class TruncatedText implements Component {
44
49
  const displayText = truncateToWidth(singleLineText, availableWidth);
45
50
 
46
51
  // Add horizontal padding
47
- const leftPadding = padding(this.#paddingX);
48
- const rightPadding = padding(this.#paddingX);
52
+ const leftPadding = padding(horizontalPadding);
53
+ const rightPadding = padding(horizontalPadding);
49
54
  const lineWithPadding = leftPadding + displayText + rightPadding;
50
55
 
51
56
  // Don't pad to full width - avoids trailing spaces when copying