@alcyone-labs/arg-parser 2.13.1 → 2.13.3

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.
@@ -0,0 +1,292 @@
1
+ /**
2
+ * OpenTUI v2 - SolidJS-based Terminal User Interface Framework
3
+ *
4
+ * Type declarations for @alcyone-labs/arg-parser/tui
5
+ */
6
+
7
+ // Re-export core OpenTUI primitives from @opentui/solid
8
+ export {
9
+ render,
10
+ createComponent,
11
+ effect,
12
+ memo,
13
+ insert,
14
+ spread,
15
+ mergeProps,
16
+ useKeyboard,
17
+ useRenderer,
18
+ } from "@opentui/solid";
19
+
20
+ // Re-export JSX types for TypeScript support
21
+ export type { JSX } from "@opentui/solid";
22
+
23
+ // Re-export Accessor from solid-js for component props
24
+ import type { Accessor as SolidAccessor } from "solid-js";
25
+ export type Accessor<T> = SolidAccessor<T>;
26
+
27
+ // =============================================================================
28
+ // App Configuration
29
+ // =============================================================================
30
+
31
+ export interface TuiAppConfig {
32
+ theme?: string | TuiTheme;
33
+ shortcuts?: ShortcutBinding[];
34
+ onDestroy?: () => void;
35
+ }
36
+
37
+ export declare function createTuiApp(
38
+ App: () => JSX.Element,
39
+ config?: TuiAppConfig
40
+ ): void;
41
+
42
+ // =============================================================================
43
+ // TUI Provider
44
+ // =============================================================================
45
+
46
+ export interface TuiContextValue {
47
+ viewportHeight: Accessor<number>;
48
+ viewportWidth: Accessor<number>;
49
+ exit: (code?: number) => void;
50
+ }
51
+
52
+ export interface TuiProviderProps {
53
+ theme?: string | TuiTheme;
54
+ shortcuts?: ShortcutBinding[];
55
+ onScroll?: (delta: number) => void;
56
+ scrollSpeed?: number;
57
+ reservedRows?: number;
58
+ children: JSX.Element;
59
+ }
60
+
61
+ export declare function TuiProvider(props: TuiProviderProps): JSX.Element;
62
+ export declare function useTui(): TuiContextValue;
63
+
64
+ // =============================================================================
65
+ // Theme System
66
+ // =============================================================================
67
+
68
+ export interface TuiTheme {
69
+ name: string;
70
+ colors: {
71
+ text: string;
72
+ muted: string;
73
+ background: string;
74
+ accent: string;
75
+ success: string;
76
+ warning: string;
77
+ error: string;
78
+ border: string;
79
+ selection: string;
80
+ };
81
+ }
82
+
83
+ export interface ThemeContextValue {
84
+ current: Accessor<TuiTheme>;
85
+ setTheme: (name: string) => void;
86
+ cycle: () => void;
87
+ names: string[];
88
+ }
89
+
90
+ export declare const THEMES: Record<string, TuiTheme>;
91
+ export declare const TuiThemes: typeof THEMES;
92
+
93
+ export declare const Theme: {
94
+ from(base: TuiTheme): {
95
+ extend(overrides: Partial<TuiTheme>): TuiTheme;
96
+ };
97
+ create(theme: TuiTheme): TuiTheme;
98
+ };
99
+
100
+ export declare function ThemeProvider(props: {
101
+ initial?: string;
102
+ children: JSX.Element;
103
+ }): JSX.Element;
104
+
105
+ export declare function useTheme(): ThemeContextValue;
106
+
107
+ // =============================================================================
108
+ // Shortcuts
109
+ // =============================================================================
110
+
111
+ export interface ShortcutBinding {
112
+ key: string;
113
+ action: () => void;
114
+ description?: string;
115
+ }
116
+
117
+ export interface ShortcutContextValue {
118
+ register: (binding: ShortcutBinding) => void;
119
+ unregister: (key: string) => void;
120
+ }
121
+
122
+ export declare function ShortcutProvider(props: {
123
+ bindings?: ShortcutBinding[];
124
+ children: JSX.Element;
125
+ }): JSX.Element;
126
+
127
+ export declare function useShortcuts(): ShortcutContextValue;
128
+
129
+ // =============================================================================
130
+ // Toast
131
+ // =============================================================================
132
+
133
+ export type ToastType = "info" | "success" | "warning" | "error";
134
+
135
+ export interface ToastContextValue {
136
+ show: (message: string, type?: ToastType) => void;
137
+ success: (message: string) => void;
138
+ error: (message: string) => void;
139
+ warning: (message: string) => void;
140
+ info: (message: string) => void;
141
+ }
142
+
143
+ export declare function ToastProvider(props: {
144
+ children: JSX.Element;
145
+ }): JSX.Element;
146
+
147
+ export declare function useToast(): ToastContextValue;
148
+
149
+ // =============================================================================
150
+ // Components
151
+ // =============================================================================
152
+
153
+ export interface BreadcrumbProps {
154
+ segments: string[];
155
+ separator?: string;
156
+ }
157
+
158
+ export declare function Breadcrumb(props: BreadcrumbProps): JSX.Element;
159
+
160
+ export interface VirtualListProps<T = unknown> {
161
+ items: T[] | Accessor<T[]>;
162
+ selectedIndex: number | Accessor<number>;
163
+ viewportHeight: number | Accessor<number>;
164
+ title?: string;
165
+ onSelect?: (idx: number) => void;
166
+ getLabel?: (item: T) => string;
167
+ showIndicator?: boolean;
168
+ renderItem?: (item: T, idx: number, selected: boolean) => JSX.Element;
169
+ }
170
+
171
+ export interface VirtualListResult {
172
+ scrollOffset: Accessor<number>;
173
+ selectNext: () => void;
174
+ selectPrevious: () => void;
175
+ scrollTo: (idx: number) => void;
176
+ }
177
+
178
+ export declare function VirtualList<T = unknown>(
179
+ props: VirtualListProps<T>
180
+ ): JSX.Element;
181
+
182
+ export declare function createVirtualListController<T = unknown>(
183
+ items: Accessor<T[]>,
184
+ selectedIndex: Accessor<number>,
185
+ setSelectedIndex: (idx: number) => void,
186
+ viewportHeight: Accessor<number>
187
+ ): VirtualListResult;
188
+
189
+ export interface MasterDetailProps {
190
+ header?: string | JSX.Element;
191
+ headerIcon?: string;
192
+ breadcrumb?: string[];
193
+ footer?: string;
194
+ masterWidth?: string;
195
+ master: JSX.Element;
196
+ detail: JSX.Element;
197
+ }
198
+
199
+ export declare function MasterDetail(props: MasterDetailProps): JSX.Element;
200
+
201
+ export interface CardProps {
202
+ title?: string;
203
+ padding?: number;
204
+ borderStyle?: string;
205
+ children: JSX.Element;
206
+ }
207
+
208
+ export declare function Card(props: CardProps): JSX.Element;
209
+
210
+ export interface StatCardProps {
211
+ label: string;
212
+ value: number | string;
213
+ format?: "percent" | "number";
214
+ trend?: "up" | "down" | "none";
215
+ }
216
+
217
+ export declare function StatCard(props: StatCardProps): JSX.Element;
218
+
219
+ export interface ButtonProps {
220
+ label: string;
221
+ onClick?: () => void;
222
+ variant?: "primary" | "danger" | "muted";
223
+ disabled?: boolean;
224
+ }
225
+
226
+ export declare function Button(props: ButtonProps): JSX.Element;
227
+
228
+ export interface MarkdownBlockProps {
229
+ content: string;
230
+ }
231
+
232
+ export declare function MarkdownBlock(props: MarkdownBlockProps): JSX.Element;
233
+
234
+ export interface DrillDownNavigatorProps {
235
+ children: (nav: {
236
+ push: (component: () => JSX.Element) => void;
237
+ pop: () => void;
238
+ replace: (component: () => JSX.Element) => void;
239
+ }) => JSX.Element;
240
+ }
241
+
242
+ export declare function DrillDownNavigator(
243
+ props: DrillDownNavigatorProps
244
+ ): JSX.Element;
245
+
246
+ export interface MasterDetailLayoutProps {
247
+ masterWidth?: string;
248
+ master: JSX.Element;
249
+ detail: JSX.Element;
250
+ }
251
+
252
+ export declare function MasterDetailLayout(
253
+ props: MasterDetailLayoutProps
254
+ ): JSX.Element;
255
+
256
+ // =============================================================================
257
+ // Hooks
258
+ // =============================================================================
259
+
260
+ export interface VirtualScrollResult {
261
+ scrollOffset: Accessor<number>;
262
+ setScrollOffset: (offset: number) => void;
263
+ scrollBy: (delta: number) => void;
264
+ }
265
+
266
+ export declare function useVirtualScroll(
267
+ itemCount: Accessor<number>,
268
+ viewportHeight: Accessor<number>
269
+ ): VirtualScrollResult;
270
+
271
+ export declare function getViewportHeight(reservedRows?: number): number;
272
+
273
+ export interface UseMouseOptions {
274
+ onWheel?: (delta: number) => void;
275
+ }
276
+
277
+ export declare function useMouse(options?: UseMouseOptions): void;
278
+
279
+ // =============================================================================
280
+ // TTY Utilities
281
+ // =============================================================================
282
+
283
+ export declare function cleanupTerminal(): void;
284
+ export declare function enableMouseReporting(): void;
285
+ export declare function disableMouseReporting(): void;
286
+ export declare function clearScreen(): void;
287
+ export declare function resetAttributes(): void;
288
+ export declare function restoreStdin(): void;
289
+ export declare function parseMouseScroll(data: Buffer): {
290
+ direction: "up" | "down" | null;
291
+ delta: number;
292
+ } | null;