ink-sdl 0.2.0 → 0.3.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/README.md CHANGED
@@ -9,7 +9,8 @@ Render [Ink](https://github.com/vadimdemedes/ink) TUI applications to an SDL win
9
9
  - Window resizing with automatic terminal dimension updates
10
10
  - HiDPI/Retina display support
11
11
  - Glyph caching for efficient text rendering
12
- - Bundled monospace font (Cozette)
12
+ - Bundled monospace font (Cozette) with system font option
13
+ - Emoji support via platform font fallback
13
14
 
14
15
  ## Prerequisites
15
16
 
@@ -46,38 +47,60 @@ pnpm add ink-sdl
46
47
 
47
48
  ## Demo
48
49
 
49
- To run the included example:
50
+ Run the built-in demo to see ink-sdl in action:
50
51
 
51
52
  ```bash
52
- git clone https://github.com/anthropics/ink-sdl.git
53
- cd ink-sdl
54
- pnpm install
55
- pnpm exec tsx examples/hello.tsx
53
+ npx ink-sdl
54
+ # or
55
+ pnpm dlx ink-sdl
56
+ ```
57
+
58
+ The demo showcases text styles, colors, box layouts, and dynamic updates. Use `--help` to see all available options:
59
+
60
+ ```bash
61
+ npx ink-sdl --help
56
62
  ```
57
63
 
58
- The example supports CLI flags for testing different display settings:
64
+ **Example commands:**
59
65
 
60
66
  ```bash
61
67
  # Custom font size
62
- pnpm exec tsx examples/hello.tsx --font-size 20
68
+ npx ink-sdl --font-size 20
63
69
 
64
- # Override scale factor (useful for HiDPI testing)
65
- pnpm exec tsx examples/hello.tsx --scale-factor 2.0
70
+ # Dark background with system font
71
+ npx ink-sdl --background "#1a1a2e" --system-font
66
72
 
67
- # All options
68
- pnpm exec tsx examples/hello.tsx --title "Test" --width 800 --height 600 --font-size 18 --scale-factor 1.5
73
+ # Borderless fullscreen mode
74
+ npx ink-sdl --fullscreen desktop
75
+
76
+ # Use a specific font
77
+ npx ink-sdl --font-name Menlo
69
78
  ```
70
79
 
71
- | Flag | Description |
72
- | ---------------- | ----------------------------------- |
73
- | `--title` | Window title |
74
- | `--width` | Window width in pixels |
75
- | `--height` | Window height in pixels |
76
- | `--font-size` | Font size in points |
77
- | `--scale-factor` | Scale factor (omit for auto-detect) |
80
+ | Flag | Description |
81
+ | ---------------- | ----------------------------------------------------------- |
82
+ | `--title` | Window title |
83
+ | `--width` | Window width in pixels |
84
+ | `--height` | Window height in pixels |
85
+ | `--font` | Path to a custom TTF font file |
86
+ | `--font-name` | Font name to find in system directories |
87
+ | `--font-size` | Font size in points |
88
+ | `--scale-factor` | Scale factor (omit for auto-detect) |
89
+ | `--system-font` | Use system monospace font instead of Cozette |
90
+ | `--background` | Background color as hex (e.g., "#1a1a2e") |
91
+ | `--fullscreen` | Enable fullscreen mode ("true" or "desktop" for borderless) |
92
+ | `--borderless` | Remove window decorations |
93
+ | `--min-width` | Minimum window width in pixels |
94
+ | `--min-height` | Minimum window height in pixels |
78
95
 
79
96
  > **Note:** This project uses [pnpm](https://pnpm.io/) for development. You can install and use ink-sdl in your own project with npm or pnpm, but if you're contributing to the library itself, use pnpm.
80
97
 
98
+ **For local development**, run the demo directly from source:
99
+
100
+ ```bash
101
+ pnpm demo
102
+ ```
103
+
81
104
  ## Usage
82
105
 
83
106
  ```tsx
@@ -129,14 +152,22 @@ Creates stdin/stdout streams and a window for use with Ink.
129
152
 
130
153
  #### Options
131
154
 
132
- | Option | Type | Default | Description |
133
- | ------------- | ---------------- | ----------- | ------------------------------------------ |
134
- | `title` | `string` | `"ink-sdl"` | Window title |
135
- | `width` | `number` | `800` | Window width in pixels |
136
- | `height` | `number` | `600` | Window height in pixels |
137
- | `vsync` | `boolean` | `true` | Enable vertical sync |
138
- | `fontSize` | `number` | `16` | Font size in points |
139
- | `scaleFactor` | `number \| null` | `null` | Override scale factor (null = auto-detect) |
155
+ | Option | Type | Default | Description |
156
+ | ----------------- | ------------------------------------ | ----------- | ---------------------------------------------------------- |
157
+ | `title` | `string` | `"ink-sdl"` | Window title |
158
+ | `width` | `number` | `800` | Window width in pixels |
159
+ | `height` | `number` | `600` | Window height in pixels |
160
+ | `vsync` | `boolean` | `true` | Enable vertical sync |
161
+ | `fontSize` | `number` | `16` | Font size in points |
162
+ | `scaleFactor` | `number \| null` | `null` | Override scale factor (null = auto-detect) |
163
+ | `systemFont` | `boolean` | `false` | Use system monospace font instead of Cozette |
164
+ | `fontPath` | `string` | `undefined` | Path to a custom TTF font file |
165
+ | `fontName` | `string` | `undefined` | Font name to find in system directories |
166
+ | `backgroundColor` | `[number, number, number] \| string` | `[0, 0, 0]` | Background color as RGB tuple or hex string "#RRGGBB" |
167
+ | `fullscreen` | `boolean \| "desktop"` | `undefined` | Fullscreen mode (true = exclusive, "desktop" = borderless) |
168
+ | `borderless` | `boolean` | `false` | Remove window decorations (title bar, borders) |
169
+ | `minWidth` | `number` | `undefined` | Minimum window width in pixels |
170
+ | `minHeight` | `number` | `undefined` | Minimum window height in pixels |
140
171
 
141
172
  #### Returns
142
173