ink-sdl 0.2.1 → 0.3.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/README.md CHANGED
@@ -47,42 +47,60 @@ pnpm add ink-sdl
47
47
 
48
48
  ## Demo
49
49
 
50
- To run the included example:
50
+ Run the built-in demo to see ink-sdl in action:
51
51
 
52
52
  ```bash
53
- git clone https://github.com/anthropics/ink-sdl.git
54
- cd ink-sdl
55
- pnpm install
56
- 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
57
62
  ```
58
63
 
59
- The example supports CLI flags for testing different display settings:
64
+ **Example commands:**
60
65
 
61
66
  ```bash
62
67
  # Custom font size
63
- pnpm exec tsx examples/hello.tsx --font-size 20
68
+ npx ink-sdl --font-size 20
64
69
 
65
- # Override scale factor (useful for HiDPI testing)
66
- pnpm exec tsx examples/hello.tsx --scale-factor 2.0
70
+ # Dark background with system font
71
+ npx ink-sdl --background "#1a1a2e" --system-font
67
72
 
68
- # Use system font instead of bundled Cozette
69
- pnpm exec tsx examples/hello.tsx --system-font
73
+ # Borderless fullscreen mode
74
+ npx ink-sdl --fullscreen desktop
70
75
 
71
- # All options
72
- pnpm exec tsx examples/hello.tsx --title "Test" --width 800 --height 600 --font-size 18 --scale-factor 1.5 --system-font
76
+ # Use a specific font
77
+ npx ink-sdl --font-name Menlo
73
78
  ```
74
79
 
75
- | Flag | Description |
76
- | ---------------- | -------------------------------------------- |
77
- | `--title` | Window title |
78
- | `--width` | Window width in pixels |
79
- | `--height` | Window height in pixels |
80
- | `--font-size` | Font size in points |
81
- | `--scale-factor` | Scale factor (omit for auto-detect) |
82
- | `--system-font` | Use system monospace font instead of Cozette |
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 |
83
95
 
84
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.
85
97
 
98
+ **For local development**, run the demo directly from source:
99
+
100
+ ```bash
101
+ pnpm demo
102
+ ```
103
+
86
104
  ## Usage
87
105
 
88
106
  ```tsx
@@ -134,15 +152,22 @@ Creates stdin/stdout streams and a window for use with Ink.
134
152
 
135
153
  #### Options
136
154
 
137
- | Option | Type | Default | Description |
138
- | ------------- | ---------------- | ----------- | -------------------------------------------- |
139
- | `title` | `string` | `"ink-sdl"` | Window title |
140
- | `width` | `number` | `800` | Window width in pixels |
141
- | `height` | `number` | `600` | Window height in pixels |
142
- | `vsync` | `boolean` | `true` | Enable vertical sync |
143
- | `fontSize` | `number` | `16` | Font size in points |
144
- | `scaleFactor` | `number \| null` | `null` | Override scale factor (null = auto-detect) |
145
- | `systemFont` | `boolean` | `false` | Use system monospace font instead of Cozette |
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 |
146
171
 
147
172
  #### Returns
148
173