@solid-tui/runtime 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 solid-tui contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # @solid-tui/runtime
2
+
3
+ Core Solid renderer and terminal primitives for `solid-tui`.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install @solid-tui/runtime solid-js
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ import { Box, Text, createApp } from "@solid-tui/runtime";
15
+
16
+ function App() {
17
+ return (
18
+ <Box>
19
+ <Text>Hello from solid-tui</Text>
20
+ </Box>
21
+ );
22
+ }
23
+
24
+ createApp(App).mount();
25
+ ```
26
+
27
+ For Vite-based apps with HMR and production builds, use `@solid-tui/vite`.
28
+
29
+ ## License
30
+
31
+ MIT
@@ -0,0 +1,317 @@
1
+ import { $ as createSignal, B as Accessor, E as kittyModifiers, G as batch, H as JSX, J as createContext, K as catchError, Q as createRoot, S as KittyKeyboardOptions, T as kittyFlags, U as JSXElement, V as Component, W as Setter, X as createMemo, Y as createEffect, Z as createRenderEffect, _ as TuiApp, b as KittyFlagName, et as on, f as RenderToStringOptions, g as MountOptions, it as useContext, j as TuiNode, nt as splitProps, p as renderToString, q as children, rt as untrack, tt as onCleanup, v as createApp, z as CursorPosition } from "./internal-BBq9eUYH.mjs";
2
+ import cliBoxes from "cli-boxes";
3
+ import { JSX as JSX$1 } from "solid-js";
4
+
5
+ //#region src/renderer.d.ts
6
+ declare const createElement: (tag: string) => TuiNode;
7
+ declare const createTextNode: (value: string) => TuiNode;
8
+ declare const insertNode: (parent: TuiNode, node: TuiNode, anchor?: TuiNode | undefined) => void;
9
+ declare const insert: <T>(parent: TuiNode, accessor: T | (() => T), marker?: TuiNode | null | undefined, initial?: unknown) => TuiNode;
10
+ declare const spread: <T>(node: TuiNode, accessor: T | (() => T), skipChildren?: boolean) => void;
11
+ declare const setProp: <T>(node: TuiNode, name: string, value: T, prev?: T | undefined) => T;
12
+ declare const mergeProps: (...sources: unknown[]) => unknown;
13
+ declare const effect: <T>(fn: (prev?: T) => T, init?: T) => void;
14
+ declare const memo: <T>(fn: () => T, equal?: boolean) => () => T;
15
+ declare const createComponent: <T>(component: (props: T) => unknown, props: T) => JSX$1.Element;
16
+ declare const use: <A, T>(fn: (element: TuiNode, arg: A) => T, element: TuiNode, arg: A) => T;
17
+ //#endregion
18
+ //#region src/components/box-props.d.ts
19
+ type Spacing = number;
20
+ type FlexDirection = "row" | "row-reverse" | "column" | "column-reverse";
21
+ type FlexWrap = "nowrap" | "wrap" | "wrap-reverse";
22
+ type Align = "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
23
+ type AlignSelf = "auto" | "flex-start" | "center" | "flex-end" | "stretch" | "baseline";
24
+ type AlignContent = "flex-start" | "center" | "flex-end" | "stretch" | "space-between" | "space-around" | "space-evenly";
25
+ type Justify = "flex-start" | "center" | "flex-end" | "space-between" | "space-around" | "space-evenly";
26
+ type BorderStyle = "single" | "double" | "round" | "bold" | "singleDouble" | "doubleSingle" | "classic" | "arrow";
27
+ type BoxStyle = (typeof cliBoxes)[keyof cliBoxes.Boxes];
28
+ type AriaRole = "button" | "checkbox" | "combobox" | "list" | "listbox" | "listitem" | "menu" | "menuitem" | "option" | "progressbar" | "radio" | "radiogroup" | "tab" | "tablist" | "table" | "textbox" | "timer" | "toolbar";
29
+ interface AriaState {
30
+ busy?: boolean;
31
+ checked?: boolean;
32
+ disabled?: boolean;
33
+ expanded?: boolean;
34
+ multiline?: boolean;
35
+ multiselectable?: boolean;
36
+ readonly?: boolean;
37
+ required?: boolean;
38
+ selected?: boolean;
39
+ }
40
+ interface BoxProps {
41
+ children?: JSX.Element;
42
+ ref?: (node: unknown) => void;
43
+ flexDirection?: FlexDirection;
44
+ flexGrow?: number;
45
+ flexShrink?: number;
46
+ flexBasis?: number | string;
47
+ flexWrap?: FlexWrap;
48
+ alignItems?: Align;
49
+ alignSelf?: AlignSelf;
50
+ justifyContent?: Justify;
51
+ gap?: number;
52
+ columnGap?: number;
53
+ rowGap?: number;
54
+ width?: number | string;
55
+ height?: number | string;
56
+ minWidth?: number | string;
57
+ minHeight?: number | string;
58
+ maxWidth?: number | string;
59
+ maxHeight?: number | string;
60
+ aspectRatio?: number;
61
+ alignContent?: AlignContent;
62
+ position?: "absolute" | "relative" | "static";
63
+ top?: number | string;
64
+ right?: number | string;
65
+ bottom?: number | string;
66
+ left?: number | string;
67
+ margin?: Spacing;
68
+ marginX?: number;
69
+ marginY?: number;
70
+ marginTop?: number;
71
+ marginBottom?: number;
72
+ marginLeft?: number;
73
+ marginRight?: number;
74
+ padding?: number;
75
+ paddingX?: number;
76
+ paddingY?: number;
77
+ paddingTop?: number;
78
+ paddingBottom?: number;
79
+ paddingLeft?: number;
80
+ paddingRight?: number;
81
+ borderStyle?: BorderStyle | BoxStyle;
82
+ borderColor?: string;
83
+ borderDimColor?: boolean;
84
+ borderTopDimColor?: boolean;
85
+ borderBottomDimColor?: boolean;
86
+ borderLeftDimColor?: boolean;
87
+ borderRightDimColor?: boolean;
88
+ borderTop?: boolean;
89
+ borderBottom?: boolean;
90
+ borderLeft?: boolean;
91
+ borderRight?: boolean;
92
+ borderTopColor?: string;
93
+ borderBottomColor?: string;
94
+ borderLeftColor?: string;
95
+ borderRightColor?: string;
96
+ borderBackgroundColor?: string;
97
+ borderTopBackgroundColor?: string;
98
+ borderBottomBackgroundColor?: string;
99
+ borderLeftBackgroundColor?: string;
100
+ borderRightBackgroundColor?: string;
101
+ backgroundColor?: string;
102
+ overflow?: "visible" | "hidden";
103
+ overflowX?: "visible" | "hidden";
104
+ overflowY?: "visible" | "hidden";
105
+ display?: "flex" | "none";
106
+ ariaLabel?: string;
107
+ ariaHidden?: boolean;
108
+ ariaRole?: AriaRole;
109
+ ariaState?: AriaState;
110
+ }
111
+ type BoxLayoutStyle = Pick<BoxProps, "flexDirection" | "flexGrow" | "flexShrink" | "flexBasis" | "flexWrap" | "alignItems" | "alignSelf" | "justifyContent" | "gap" | "columnGap" | "rowGap" | "width" | "height" | "minWidth" | "minHeight" | "maxWidth" | "maxHeight" | "aspectRatio" | "alignContent" | "position" | "top" | "right" | "bottom" | "left" | "margin" | "marginX" | "marginY" | "marginTop" | "marginBottom" | "marginLeft" | "marginRight" | "padding" | "paddingX" | "paddingY" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "overflow" | "overflowX" | "overflowY" | "display">;
112
+ //#endregion
113
+ //#region src/components/box.d.ts
114
+ declare function Box(props: BoxProps): JSX.Element;
115
+ //#endregion
116
+ //#region src/components/text-props.d.ts
117
+ type WrapMode = "wrap" | "hard" | "truncate" | "truncate-end" | "truncate-middle" | "truncate-start";
118
+ interface TextProps {
119
+ children?: JSX.Element;
120
+ ref?: (node: unknown) => void;
121
+ color?: string;
122
+ backgroundColor?: string;
123
+ dimColor?: boolean;
124
+ bold?: boolean;
125
+ italic?: boolean;
126
+ underline?: boolean;
127
+ strikethrough?: boolean;
128
+ inverse?: boolean;
129
+ wrap?: WrapMode;
130
+ ariaLabel?: string;
131
+ ariaHidden?: boolean;
132
+ }
133
+ //#endregion
134
+ //#region src/components/text.d.ts
135
+ declare function Text(props: TextProps): JSX.Element;
136
+ //#endregion
137
+ //#region src/components/newline-props.d.ts
138
+ interface NewlineProps {
139
+ count?: number;
140
+ }
141
+ //#endregion
142
+ //#region src/components/newline.d.ts
143
+ declare function Newline(props: NewlineProps): TuiNode;
144
+ //#endregion
145
+ //#region src/components/spacer-props.d.ts
146
+ interface SpacerProps {
147
+ children?: never;
148
+ }
149
+ //#endregion
150
+ //#region src/components/spacer.d.ts
151
+ declare function Spacer(_props: SpacerProps): TuiNode;
152
+ //#endregion
153
+ //#region src/components/static-props.d.ts
154
+ interface StaticSlotProps<T = unknown> {
155
+ item: T;
156
+ index: number;
157
+ }
158
+ type StaticSlot<T = unknown> = (props: StaticSlotProps<T>) => JSX.Element;
159
+ type StaticChildren<T = unknown> = StaticSlot<T>;
160
+ type StaticStyle = BoxLayoutStyle;
161
+ interface StaticProps<T = unknown> {
162
+ items: T[];
163
+ style?: StaticStyle;
164
+ children?: StaticChildren<T>;
165
+ }
166
+ //#endregion
167
+ //#region src/components/static.d.ts
168
+ declare function Static<T = unknown>(props: StaticProps<T>): JSX.Element;
169
+ //#endregion
170
+ //#region src/components/transform.d.ts
171
+ type TransformFn = (line: string, lineIndex: number) => string;
172
+ interface TransformProps {
173
+ transform: TransformFn;
174
+ accessibilityLabel?: string;
175
+ children?: JSX.Element;
176
+ }
177
+ declare function Transform(props: TransformProps): JSX.Element;
178
+ //#endregion
179
+ //#region src/hooks/useApp.d.ts
180
+ interface UseAppReturn {
181
+ readonly exit: (errorOrResult?: unknown) => void;
182
+ readonly waitUntilRenderFlush: () => Promise<void>;
183
+ }
184
+ declare function useApp(): UseAppReturn;
185
+ //#endregion
186
+ //#region src/hooks/useInput.d.ts
187
+ interface Key {
188
+ upArrow: boolean;
189
+ downArrow: boolean;
190
+ leftArrow: boolean;
191
+ rightArrow: boolean;
192
+ pageDown: boolean;
193
+ pageUp: boolean;
194
+ home: boolean;
195
+ end: boolean;
196
+ return: boolean;
197
+ escape: boolean;
198
+ ctrl: boolean;
199
+ shift: boolean;
200
+ tab: boolean;
201
+ backspace: boolean;
202
+ delete: boolean;
203
+ meta: boolean;
204
+ super: boolean;
205
+ hyper: boolean;
206
+ capsLock: boolean;
207
+ numLock: boolean;
208
+ eventType?: "press" | "repeat" | "release";
209
+ }
210
+ interface UseInputOptions {
211
+ isActive?: boolean | (() => boolean);
212
+ }
213
+ type InputHandler = (input: string, key: Key) => void;
214
+ declare function useInput(handler: InputHandler, options?: UseInputOptions): void;
215
+ //#endregion
216
+ //#region src/hooks/usePaste.d.ts
217
+ interface UsePasteOptions {
218
+ isActive?: boolean | (() => boolean);
219
+ }
220
+ type PasteHandler = (text: string) => void;
221
+ declare function usePaste(handler: PasteHandler, options?: UsePasteOptions): void;
222
+ //#endregion
223
+ //#region src/hooks/useFocus.d.ts
224
+ interface UseFocusOptions {
225
+ autoFocus?: boolean | (() => boolean);
226
+ isActive?: boolean | (() => boolean);
227
+ id?: string | (() => string | undefined);
228
+ }
229
+ declare function useFocus(options?: UseFocusOptions): {
230
+ isFocused: Accessor<boolean>;
231
+ focus: (id: string) => void;
232
+ };
233
+ //#endregion
234
+ //#region src/hooks/useFocusManager.d.ts
235
+ declare function useFocusManager(): {
236
+ enableFocus: () => void;
237
+ disableFocus: () => void;
238
+ focusNext: () => void;
239
+ focusPrevious: () => void;
240
+ focus: (id: string) => void;
241
+ activeId: Accessor<string | null>;
242
+ };
243
+ //#endregion
244
+ //#region src/hooks/useStdin.d.ts
245
+ interface UseStdinReturn {
246
+ readonly stdin: NodeJS.ReadStream;
247
+ readonly setRawMode: (mode: boolean) => void;
248
+ readonly isRawModeSupported: boolean;
249
+ }
250
+ declare function useStdin(): UseStdinReturn;
251
+ //#endregion
252
+ //#region src/hooks/useStdout.d.ts
253
+ interface UseStdoutReturn {
254
+ readonly stdout: NodeJS.WriteStream;
255
+ readonly write: (data: string) => void;
256
+ }
257
+ declare function useStdout(): UseStdoutReturn;
258
+ //#endregion
259
+ //#region src/hooks/useStderr.d.ts
260
+ interface UseStderrReturn {
261
+ readonly stderr: NodeJS.WriteStream;
262
+ readonly write: (data: string) => void;
263
+ }
264
+ declare function useStderr(): UseStderrReturn;
265
+ //#endregion
266
+ //#region src/hooks/useWindowSize.d.ts
267
+ interface WindowSize {
268
+ readonly columns: number;
269
+ readonly rows: number;
270
+ }
271
+ declare function useWindowSize(): {
272
+ columns: Accessor<number>;
273
+ rows: Accessor<number>;
274
+ };
275
+ //#endregion
276
+ //#region src/hooks/useCursor.d.ts
277
+ declare function useCursor(): {
278
+ setCursorPosition: import("solid-js/types/reactive/signal.js").Setter<CursorPosition | undefined>;
279
+ };
280
+ //#endregion
281
+ //#region src/hooks/useIsScreenReaderEnabled.d.ts
282
+ declare function useIsScreenReaderEnabled(): boolean;
283
+ //#endregion
284
+ //#region src/hooks/useAnimation.d.ts
285
+ interface UseAnimationOptions {
286
+ interval?: number | (() => number | undefined);
287
+ isActive?: boolean | (() => boolean);
288
+ }
289
+ interface UseAnimationReturn {
290
+ readonly frame: Accessor<number>;
291
+ readonly time: Accessor<number>;
292
+ readonly delta: Accessor<number>;
293
+ readonly reset: () => void;
294
+ }
295
+ declare function useAnimation(options?: UseAnimationOptions): UseAnimationReturn;
296
+ //#endregion
297
+ //#region src/hooks/useBoxMetrics.d.ts
298
+ interface BoxMetrics {
299
+ readonly width: number;
300
+ readonly height: number;
301
+ readonly left: number;
302
+ readonly top: number;
303
+ }
304
+ interface UseBoxMetricsReturn {
305
+ readonly width: Accessor<number>;
306
+ readonly height: Accessor<number>;
307
+ readonly left: Accessor<number>;
308
+ readonly top: Accessor<number>;
309
+ readonly hasMeasured: Accessor<boolean>;
310
+ }
311
+ declare function measureElement(node: unknown): {
312
+ width: number;
313
+ height: number;
314
+ };
315
+ declare function useBoxMetrics(ref: Accessor<unknown>): UseBoxMetricsReturn;
316
+ //#endregion
317
+ export { type Accessor, type AriaRole, type AriaState, Box, type BoxLayoutStyle, type BoxMetrics, type BoxProps, type BoxStyle, type Component, type CursorPosition, type JSX, type JSXElement, type Key, type KittyFlagName, type KittyKeyboardOptions, type MountOptions, Newline, type NewlineProps, type RenderToStringOptions, type Setter, Spacer, type SpacerProps, Static, type StaticChildren, type StaticProps, type StaticSlot, type StaticSlotProps, type StaticStyle, Text, type TextProps, Transform, type TransformProps, type TuiApp, type UseAnimationOptions, type UseAnimationReturn, type UseAppReturn, type UseBoxMetricsReturn, type UseFocusOptions, type UseInputOptions, type UsePasteOptions, type UseStderrReturn, type UseStdinReturn, type UseStdoutReturn, type WindowSize, batch, catchError, children, createApp, createComponent, createContext, createEffect, createElement, createMemo, createRenderEffect, createRoot, createSignal, createTextNode, effect, insert, insertNode, kittyFlags, kittyModifiers, measureElement, memo, mergeProps, on, onCleanup, renderToString, setProp, splitProps, spread, untrack, use, useAnimation, useApp, useBoxMetrics, useContext, useCursor, useFocus, useFocusManager, useInput, useIsScreenReaderEnabled, usePaste, useStderr, useStdin, useStdout, useWindowSize };