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 +55 -30
- package/dist/chunk-BOQYTA3S.js +2822 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +437 -0
- package/dist/index.d.ts +412 -245
- package/dist/index.js +25 -2269
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -47,42 +47,60 @@ pnpm add ink-sdl
|
|
|
47
47
|
|
|
48
48
|
## Demo
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Run the built-in demo to see ink-sdl in action:
|
|
51
51
|
|
|
52
52
|
```bash
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
pnpm
|
|
56
|
-
|
|
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
|
-
|
|
64
|
+
**Example commands:**
|
|
60
65
|
|
|
61
66
|
```bash
|
|
62
67
|
# Custom font size
|
|
63
|
-
|
|
68
|
+
npx ink-sdl --font-size 20
|
|
64
69
|
|
|
65
|
-
#
|
|
66
|
-
|
|
70
|
+
# Dark background with system font
|
|
71
|
+
npx ink-sdl --background "#1a1a2e" --system-font
|
|
67
72
|
|
|
68
|
-
#
|
|
69
|
-
|
|
73
|
+
# Borderless fullscreen mode
|
|
74
|
+
npx ink-sdl --fullscreen desktop
|
|
70
75
|
|
|
71
|
-
#
|
|
72
|
-
|
|
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
|
|
81
|
-
| `--
|
|
82
|
-
| `--
|
|
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
|
|
138
|
-
|
|
|
139
|
-
| `title`
|
|
140
|
-
| `width`
|
|
141
|
-
| `height`
|
|
142
|
-
| `vsync`
|
|
143
|
-
| `fontSize`
|
|
144
|
-
| `scaleFactor`
|
|
145
|
-
| `systemFont`
|
|
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
|
|