@mdxui/terminal 2.0.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.
Files changed (191) hide show
  1. package/README.md +571 -0
  2. package/dist/ansi-css-Sk5mWtdK.d.ts +119 -0
  3. package/dist/ansi-css-V6JIHGsM.d.ts +119 -0
  4. package/dist/ansi-css-_3eSEU9d.d.ts +119 -0
  5. package/dist/chunk-3EFDH7PK.js +5235 -0
  6. package/dist/chunk-3RG5ZIWI.js +10 -0
  7. package/dist/chunk-3X5IR6WE.js +884 -0
  8. package/dist/chunk-4FV5ZDCE.js +5236 -0
  9. package/dist/chunk-4OVMSF2J.js +243 -0
  10. package/dist/chunk-63FEETIS.js +4048 -0
  11. package/dist/chunk-B43KP7XJ.js +884 -0
  12. package/dist/chunk-BMTJXWUV.js +655 -0
  13. package/dist/chunk-C3SVH4N7.js +882 -0
  14. package/dist/chunk-EVWR7Y47.js +874 -0
  15. package/dist/chunk-F6A5VWUC.js +1285 -0
  16. package/dist/chunk-FD7KW7GE.js +882 -0
  17. package/dist/chunk-GBQ6UD6I.js +655 -0
  18. package/dist/chunk-GMDD3M6U.js +5227 -0
  19. package/dist/chunk-JBHRXOXM.js +1058 -0
  20. package/dist/chunk-JFOO3EYO.js +1182 -0
  21. package/dist/chunk-JQ5H3WXL.js +1291 -0
  22. package/dist/chunk-JQD5NASE.js +234 -0
  23. package/dist/chunk-KRHJP5R7.js +592 -0
  24. package/dist/chunk-KWF6WVJE.js +962 -0
  25. package/dist/chunk-LHYQVN3H.js +1038 -0
  26. package/dist/chunk-M3TLQLGC.js +1032 -0
  27. package/dist/chunk-MVW4Q5OP.js +240 -0
  28. package/dist/chunk-NXCZSWLU.js +1294 -0
  29. package/dist/chunk-O25TNRO6.js +607 -0
  30. package/dist/chunk-PNECDA2I.js +884 -0
  31. package/dist/chunk-QIHWRLJR.js +962 -0
  32. package/dist/chunk-QW5YMQ7K.js +882 -0
  33. package/dist/chunk-R5U7XKVJ.js +16 -0
  34. package/dist/chunk-RP2MVQLR.js +962 -0
  35. package/dist/chunk-TP6RXGXA.js +1087 -0
  36. package/dist/chunk-TQQSTITZ.js +655 -0
  37. package/dist/chunk-X24GWXQV.js +1281 -0
  38. package/dist/components/index.d.ts +802 -0
  39. package/dist/components/index.js +149 -0
  40. package/dist/data/index.d.ts +2554 -0
  41. package/dist/data/index.js +51 -0
  42. package/dist/forms/index.d.ts +1596 -0
  43. package/dist/forms/index.js +464 -0
  44. package/dist/index-CQRFZntR.d.ts +867 -0
  45. package/dist/index.d.ts +579 -0
  46. package/dist/index.js +786 -0
  47. package/dist/interactive-D0JkWosD.d.ts +217 -0
  48. package/dist/keyboard/index.d.ts +2 -0
  49. package/dist/keyboard/index.js +43 -0
  50. package/dist/renderers/index.d.ts +546 -0
  51. package/dist/renderers/index.js +2157 -0
  52. package/dist/storybook/index.d.ts +396 -0
  53. package/dist/storybook/index.js +641 -0
  54. package/dist/theme/index.d.ts +1339 -0
  55. package/dist/theme/index.js +123 -0
  56. package/dist/types-Bxu5PAgA.d.ts +710 -0
  57. package/dist/types-CIlop5Ji.d.ts +701 -0
  58. package/dist/types-Ca8p_p5X.d.ts +710 -0
  59. package/package.json +90 -0
  60. package/src/__tests__/components/data/card.test.ts +458 -0
  61. package/src/__tests__/components/data/list.test.ts +473 -0
  62. package/src/__tests__/components/data/metrics.test.ts +541 -0
  63. package/src/__tests__/components/data/table.test.ts +448 -0
  64. package/src/__tests__/components/input/field.test.ts +555 -0
  65. package/src/__tests__/components/input/form.test.ts +870 -0
  66. package/src/__tests__/components/input/search.test.ts +1238 -0
  67. package/src/__tests__/components/input/select.test.ts +658 -0
  68. package/src/__tests__/components/navigation/breadcrumb.test.ts +923 -0
  69. package/src/__tests__/components/navigation/command-palette.test.ts +1095 -0
  70. package/src/__tests__/components/navigation/sidebar.test.ts +1018 -0
  71. package/src/__tests__/components/navigation/tabs.test.ts +995 -0
  72. package/src/__tests__/components.test.tsx +1197 -0
  73. package/src/__tests__/core/compiler.test.ts +986 -0
  74. package/src/__tests__/core/parser.test.ts +785 -0
  75. package/src/__tests__/core/tier-switcher.test.ts +1103 -0
  76. package/src/__tests__/core/types.test.ts +1398 -0
  77. package/src/__tests__/data/collections.test.ts +1337 -0
  78. package/src/__tests__/data/db.test.ts +1265 -0
  79. package/src/__tests__/data/reactive.test.ts +1010 -0
  80. package/src/__tests__/data/sync.test.ts +1614 -0
  81. package/src/__tests__/errors.test.ts +660 -0
  82. package/src/__tests__/forms/integration.test.ts +444 -0
  83. package/src/__tests__/integration.test.ts +905 -0
  84. package/src/__tests__/keyboard.test.ts +1791 -0
  85. package/src/__tests__/renderer.test.ts +489 -0
  86. package/src/__tests__/renderers/ansi-css.test.ts +948 -0
  87. package/src/__tests__/renderers/ansi.test.ts +1366 -0
  88. package/src/__tests__/renderers/ascii.test.ts +1360 -0
  89. package/src/__tests__/renderers/interactive.test.ts +2353 -0
  90. package/src/__tests__/renderers/markdown.test.ts +1483 -0
  91. package/src/__tests__/renderers/text.test.ts +1369 -0
  92. package/src/__tests__/renderers/unicode.test.ts +1307 -0
  93. package/src/__tests__/theme.test.ts +639 -0
  94. package/src/__tests__/utils/assertions.ts +685 -0
  95. package/src/__tests__/utils/index.ts +115 -0
  96. package/src/__tests__/utils/test-renderer.ts +381 -0
  97. package/src/__tests__/utils/utils.test.ts +560 -0
  98. package/src/components/containers/card.ts +56 -0
  99. package/src/components/containers/dialog.ts +53 -0
  100. package/src/components/containers/index.ts +9 -0
  101. package/src/components/containers/panel.ts +59 -0
  102. package/src/components/feedback/badge.ts +40 -0
  103. package/src/components/feedback/index.ts +8 -0
  104. package/src/components/feedback/spinner.ts +23 -0
  105. package/src/components/helpers.ts +81 -0
  106. package/src/components/index.ts +153 -0
  107. package/src/components/layout/breadcrumb.ts +31 -0
  108. package/src/components/layout/index.ts +10 -0
  109. package/src/components/layout/list.ts +29 -0
  110. package/src/components/layout/sidebar.ts +79 -0
  111. package/src/components/layout/table.ts +62 -0
  112. package/src/components/primitives/box.ts +95 -0
  113. package/src/components/primitives/button.ts +54 -0
  114. package/src/components/primitives/index.ts +11 -0
  115. package/src/components/primitives/input.ts +88 -0
  116. package/src/components/primitives/select.ts +97 -0
  117. package/src/components/primitives/text.ts +60 -0
  118. package/src/components/render.ts +155 -0
  119. package/src/components/templates/app.ts +43 -0
  120. package/src/components/templates/index.ts +8 -0
  121. package/src/components/templates/site.ts +54 -0
  122. package/src/components/types.ts +777 -0
  123. package/src/core/compiler.ts +718 -0
  124. package/src/core/parser.ts +127 -0
  125. package/src/core/tier-switcher.ts +607 -0
  126. package/src/core/types.ts +672 -0
  127. package/src/data/collection.ts +316 -0
  128. package/src/data/collections.ts +50 -0
  129. package/src/data/context.tsx +174 -0
  130. package/src/data/db.ts +127 -0
  131. package/src/data/hooks.ts +532 -0
  132. package/src/data/index.ts +138 -0
  133. package/src/data/reactive.ts +1225 -0
  134. package/src/data/saas-collections.ts +375 -0
  135. package/src/data/sync.ts +1213 -0
  136. package/src/data/types.ts +660 -0
  137. package/src/forms/converters.ts +512 -0
  138. package/src/forms/index.ts +133 -0
  139. package/src/forms/schemas.ts +403 -0
  140. package/src/forms/types.ts +476 -0
  141. package/src/index.ts +542 -0
  142. package/src/keyboard/focus.ts +748 -0
  143. package/src/keyboard/index.ts +96 -0
  144. package/src/keyboard/integration.ts +371 -0
  145. package/src/keyboard/manager.ts +377 -0
  146. package/src/keyboard/presets.ts +90 -0
  147. package/src/renderers/ansi-css.ts +576 -0
  148. package/src/renderers/ansi.ts +802 -0
  149. package/src/renderers/ascii.ts +680 -0
  150. package/src/renderers/breadcrumb.ts +480 -0
  151. package/src/renderers/command-palette.ts +802 -0
  152. package/src/renderers/components/field.ts +210 -0
  153. package/src/renderers/components/form.ts +327 -0
  154. package/src/renderers/components/index.ts +21 -0
  155. package/src/renderers/components/search.ts +449 -0
  156. package/src/renderers/components/select.ts +222 -0
  157. package/src/renderers/index.ts +101 -0
  158. package/src/renderers/interactive/component-handlers.ts +622 -0
  159. package/src/renderers/interactive/cursor-manager.ts +147 -0
  160. package/src/renderers/interactive/focus-manager.ts +279 -0
  161. package/src/renderers/interactive/index.ts +661 -0
  162. package/src/renderers/interactive/input-handler.ts +164 -0
  163. package/src/renderers/interactive/keyboard-handler.ts +212 -0
  164. package/src/renderers/interactive/mouse-handler.ts +167 -0
  165. package/src/renderers/interactive/state-manager.ts +109 -0
  166. package/src/renderers/interactive/types.ts +338 -0
  167. package/src/renderers/interactive-string.ts +299 -0
  168. package/src/renderers/interactive.ts +59 -0
  169. package/src/renderers/markdown.ts +950 -0
  170. package/src/renderers/sidebar.ts +549 -0
  171. package/src/renderers/tabs.ts +682 -0
  172. package/src/renderers/text.ts +791 -0
  173. package/src/renderers/unicode.ts +917 -0
  174. package/src/renderers/utils.ts +942 -0
  175. package/src/router/adapters.ts +383 -0
  176. package/src/router/types.ts +140 -0
  177. package/src/router/utils.ts +452 -0
  178. package/src/schemas.ts +205 -0
  179. package/src/storybook/index.ts +91 -0
  180. package/src/storybook/interactive-decorator.tsx +659 -0
  181. package/src/storybook/keyboard-simulator.ts +501 -0
  182. package/src/theme/ansi-codes.ts +80 -0
  183. package/src/theme/box-drawing.ts +132 -0
  184. package/src/theme/color-convert.ts +254 -0
  185. package/src/theme/color-support.ts +321 -0
  186. package/src/theme/index.ts +134 -0
  187. package/src/theme/strip-ansi.ts +50 -0
  188. package/src/theme/tailwind-map.ts +469 -0
  189. package/src/theme/text-styles.ts +206 -0
  190. package/src/theme/theme-system.ts +568 -0
  191. package/src/types.ts +103 -0
@@ -0,0 +1,546 @@
1
+ export { A as ANSIToCSSResult, C as CSSStyleProperties, S as StyledSpan, T as TextRenderOptions, a as ansiToCSS, b as ansiToHTML, p as parseAnsiToSpans, r as renderText, s as spanToInlineStyle } from '../ansi-css-_3eSEU9d.js';
2
+ import { U as UINode, a as RenderContext } from '../types-Bxu5PAgA.js';
3
+ export { C as ClickableOptions, d as ComponentOptions, F as FocusableOptions, b as InputOptions, I as InteractiveRenderer, a as InteractiveRendererConfig, c as createInteractiveRenderer } from '../interactive-D0JkWosD.js';
4
+ import 'zod';
5
+
6
+ /**
7
+ * Markdown Renderer
8
+ *
9
+ * Converts UINode trees to Markdown strings for AI agent consumption via MCP.
10
+ *
11
+ * The Markdown renderer outputs structured markdown that is:
12
+ * - Easily parseable by AI agents
13
+ * - Human-readable in raw form
14
+ * - Compatible with MCP (Model Context Protocol) text transport
15
+ *
16
+ * Markdown Tier (tier 2 of 6):
17
+ * Designed for AI agents that consume structured text via MCP protocols.
18
+ * More structured than TEXT tier, less visual than ASCII/UNICODE/ANSI.
19
+ */
20
+
21
+ /**
22
+ * Markdown render options
23
+ */
24
+ interface MarkdownRenderOptions {
25
+ /** Maximum line width for wrapping (optional) */
26
+ width?: number;
27
+ /** Whether to include navigation footer hints */
28
+ includeNavFooter?: boolean;
29
+ /** Header level offset (e.g., 1 to start at H2 instead of H1) */
30
+ headerOffset?: number;
31
+ /** Whether to escape special markdown characters in content */
32
+ escapeContent?: boolean;
33
+ }
34
+ /**
35
+ * Renders a UINode tree to a Markdown string for AI agent consumption.
36
+ *
37
+ * @param node - The UINode tree to render
38
+ * @param options - Optional rendering configuration
39
+ * @returns Markdown string
40
+ */
41
+ declare function renderMarkdown(node: UINode, options?: MarkdownRenderOptions): string;
42
+
43
+ /**
44
+ * ASCII Renderer - TDD GREEN Phase Implementation
45
+ *
46
+ * This file implements the ASCII renderer for the 6-tier Universal Terminal UI.
47
+ * All output uses pure ASCII characters (0x00-0x7F) for maximum compatibility.
48
+ *
49
+ * ASCII Tier Constraints:
50
+ * - Output must contain ONLY ASCII characters (0x00-0x7F)
51
+ * - No unicode box drawing characters (U+2500-U+257F)
52
+ * - No ANSI escape sequences
53
+ * - No emoji or special symbols
54
+ */
55
+
56
+ /**
57
+ * Renders a UINode tree to pure ASCII output for low-capability terminals.
58
+ */
59
+ declare function renderASCII(node: UINode, context?: RenderContext): string;
60
+
61
+ /**
62
+ * Unicode Renderer - Renders UINode trees using Unicode box-drawing characters
63
+ *
64
+ * This renderer is part of the 6-tier Universal Terminal UI system.
65
+ * It uses Unicode characters for beautiful terminal output without ANSI colors.
66
+ *
67
+ * Unicode box drawing characters:
68
+ * - Single: ┌ ─ ┐ │ └ ┘ ├ ┤ ┬ ┴ ┼
69
+ * - Double: ╔ ═ ╗ ║ ╚ ╝
70
+ * - Rounded: ╭ ╮ ╰ ╯
71
+ *
72
+ * Bullets: • ◦ ▪ ▸ ▾ ✓ ✗
73
+ * Progress: ▓ ░ ▒
74
+ * Spinners: ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
75
+ */
76
+
77
+ /**
78
+ * Renders a UINode tree to Unicode box-drawing output.
79
+ *
80
+ * This renderer is part of the 6-tier Universal Terminal UI system.
81
+ * It outputs Unicode characters for beautiful terminal borders and
82
+ * symbols without using ANSI escape sequences for colors.
83
+ *
84
+ * @param node - The UINode tree to render
85
+ * @param context - Optional render context with width, height, theme
86
+ * @returns Unicode string ready for terminal output
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const node: UINode = {
91
+ * type: 'box',
92
+ * props: { border: 'single' },
93
+ * children: [{ type: 'text', props: { content: 'Hello' } }]
94
+ * }
95
+ *
96
+ * const output = renderUnicode(node)
97
+ * // ┌───────┐
98
+ * // │ Hello │
99
+ * // └───────┘
100
+ * ```
101
+ */
102
+ declare function renderUnicode(node: UINode, context?: RenderContext): string;
103
+
104
+ /**
105
+ * ANSI Renderer
106
+ *
107
+ * Converts UINode trees to ANSI-escaped terminal strings with support for:
108
+ * - 16 color, 256 color, and true color modes
109
+ * - Text formatting (bold, italic, underline, etc.)
110
+ * - Theme colors (dark/light mode with semantic colors)
111
+ * - Graceful color degradation
112
+ */
113
+
114
+ /**
115
+ * ANSI render options
116
+ */
117
+ interface ANSIRenderOptions {
118
+ colorSupport?: 'none' | '16' | '256' | 'truecolor';
119
+ theme?: 'dark' | 'light';
120
+ width?: number;
121
+ resetBetweenElements?: boolean;
122
+ }
123
+ /**
124
+ * Renders a UINode tree to an ANSI-escaped string for terminal output.
125
+ *
126
+ * @param node - The UINode tree to render
127
+ * @param options - Rendering options (color support, theme, width)
128
+ * @returns ANSI-escaped string ready for terminal output
129
+ *
130
+ * @example
131
+ * ```tsx
132
+ * const node = { type: 'text', text: 'Hello', props: { color: 'cyan', bold: true } }
133
+ * const output = renderANSI(node)
134
+ * console.log(output) // Outputs bold cyan text
135
+ * ```
136
+ */
137
+ declare function renderANSI(node: UINode, options?: ANSIRenderOptions): string;
138
+
139
+ /**
140
+ * @mdxui/terminal Interactive String Renderer
141
+ *
142
+ * This module provides a string-based implementation of the interactive tier
143
+ * that does not depend on @opentui/core. It is used for testing and situations
144
+ * where a string output is needed rather than an actual TUI.
145
+ *
146
+ * @packageDocumentation
147
+ */
148
+
149
+ /**
150
+ * Renders a UINode to a string for the interactive tier.
151
+ * This provides compatibility with the test suite that expects
152
+ * a string-returning render function like other tiers.
153
+ */
154
+ declare function renderInteractive(node: UINode, _context: RenderContext): string;
155
+
156
+ /**
157
+ * Renderer Common Utilities
158
+ *
159
+ * Shared abstractions used across all 6-tier renderers (TEXT, MARKDOWN, ASCII, UNICODE, ANSI, INTERACTIVE).
160
+ * Extracted to ensure DRY principles and consistent behavior across renderers.
161
+ *
162
+ * Key abstractions:
163
+ * - Box drawing (ASCII/Unicode share logic)
164
+ * - Width/height calculations
165
+ * - Text alignment and wrapping
166
+ * - Indentation helpers
167
+ * - Character sanitization
168
+ * - Renderer registry pattern
169
+ */
170
+
171
+ /**
172
+ * Box drawing character sets for different border styles
173
+ */
174
+ interface BoxChars {
175
+ topLeft: string;
176
+ topRight: string;
177
+ bottomLeft: string;
178
+ bottomRight: string;
179
+ horizontal: string;
180
+ vertical: string;
181
+ }
182
+ /**
183
+ * Text alignment options
184
+ */
185
+ type TextAlign = 'left' | 'center' | 'right';
186
+ /**
187
+ * Indent calculation: returns a string of spaces for the given level
188
+ * Each level = 2 spaces
189
+ *
190
+ * @param level - Indentation level (0-based)
191
+ * @returns Indentation string (2 spaces per level)
192
+ */
193
+ declare function getIndentStr(level: number): string;
194
+ /**
195
+ * Calculates visible text width by counting characters
196
+ * This is a basic implementation; use in TEXT/MARKDOWN tiers
197
+ *
198
+ * @param text - Text to measure
199
+ * @returns Character count (visible width)
200
+ */
201
+ declare function getTextWidth(text: string): number;
202
+ /**
203
+ * Pads text to a given width for alignment
204
+ * Supports left/center/right alignment
205
+ *
206
+ * @param text - Text to pad
207
+ * @param width - Target width
208
+ * @param align - Alignment direction (default: 'left')
209
+ * @param padChar - Character to use for padding (default: space)
210
+ * @returns Padded text string
211
+ */
212
+ declare function padText(text: string, width: number, align?: TextAlign, padChar?: string): string;
213
+ /**
214
+ * Wraps text to fit within a given width, preserving words when possible.
215
+ * Handles explicit newlines and long words.
216
+ *
217
+ * @param text - Text to wrap
218
+ * @param maxWidth - Maximum line width
219
+ * @returns Array of wrapped lines
220
+ */
221
+ declare function wrapText(text: string, maxWidth: number): string[];
222
+ /**
223
+ * Sanitizes text to ensure only ASCII characters (0x00-0x7F) are present.
224
+ * Replaces unicode characters with ASCII equivalents or removes them.
225
+ *
226
+ * @param text - Text to sanitize
227
+ * @returns ASCII-safe text string
228
+ */
229
+ declare function sanitizeToASCII(text: string): string;
230
+ /**
231
+ * Converts unicode box drawing character to ASCII equivalent
232
+ * Used by sanitizeToASCII and ASCII renderer
233
+ *
234
+ * @param char - Unicode box drawing character
235
+ * @returns ASCII equivalent or '+'
236
+ */
237
+ declare function boxDrawingToASCII(char: string): string;
238
+ /**
239
+ * Builds a box (border + content) using provided box characters
240
+ * Shared logic for ASCII and Unicode renderers
241
+ *
242
+ * @param chars - Box characters (corners, edges)
243
+ * @param contentLines - Content lines to place inside box
244
+ * @param width - Total box width (including borders)
245
+ * @returns Array of box lines (ready to join with '\n')
246
+ */
247
+ declare function buildBox(chars: BoxChars, contentLines: string[], width: number): string[];
248
+ /**
249
+ * Extracts string values from mixed-type arrays
250
+ * Common pattern: converting items array to string array for rendering
251
+ *
252
+ * @param items - Array of unknown items
253
+ * @returns Array of string values
254
+ */
255
+ declare function extractStringArray(items: unknown[]): string[];
256
+ /**
257
+ * Extracts headers from column definitions
258
+ * Common pattern: table renderers need to map columns to headers
259
+ *
260
+ * @param columns - Array of column definitions with 'header' property
261
+ * @returns Array of header strings
262
+ */
263
+ declare function extractHeaders(columns: Array<{
264
+ header?: string;
265
+ key?: string;
266
+ }> | undefined): string[];
267
+ /**
268
+ * Extracts values from a row using column keys
269
+ * Common pattern: table row rendering
270
+ *
271
+ * @param row - Object with row data
272
+ * @param columns - Array of column definitions with 'key' property
273
+ * @returns Array of row values as strings
274
+ */
275
+ declare function extractRowValues(row: Record<string, unknown>, columns: Array<{
276
+ key: string;
277
+ }> | undefined): string[];
278
+ /**
279
+ * Combines multiple strings into a single output with separator
280
+ * Used for joining title, content, and footer sections
281
+ *
282
+ * @param parts - Array of string parts (filtered to remove empty)
283
+ * @param separator - String to join parts (default: '\n\n')
284
+ * @returns Joined string or empty string
285
+ */
286
+ declare function joinParts(parts: string[], separator?: string): string;
287
+ /**
288
+ * Type-safe property access with default fallback
289
+ * Used throughout renderers to safely extract typed props
290
+ *
291
+ * @param obj - Object to access
292
+ * @param key - Property key
293
+ * @param defaultValue - Fallback value if undefined
294
+ * @returns Property value or default
295
+ */
296
+ declare function getProp<T>(obj: Record<string, unknown>, key: string, defaultValue: T): T;
297
+ /**
298
+ * Renderer registry pattern: allows dynamic renderer lookup
299
+ * Used by multi-tier rendering to delegate to appropriate renderer
300
+ */
301
+ type RendererRegistry = {
302
+ [tier in 'text' | 'markdown' | 'ascii' | 'unicode' | 'ansi' | 'interactive']?: (node: any, context?: any) => string;
303
+ };
304
+ /**
305
+ * Theme token color constants
306
+ * Shared across renderers for theme support
307
+ */
308
+ declare const DEFAULT_THEME_TOKENS: {
309
+ readonly primary: "";
310
+ readonly secondary: "";
311
+ readonly muted: "";
312
+ readonly foreground: "";
313
+ readonly background: "";
314
+ readonly border: "";
315
+ readonly success: "";
316
+ readonly warning: "";
317
+ readonly error: "";
318
+ readonly info: "";
319
+ };
320
+ /**
321
+ * Default render context values
322
+ * Standard dimensions for terminal rendering
323
+ */
324
+ declare const DEFAULT_RENDER_CONTEXT: {
325
+ readonly width: 80;
326
+ readonly height: 24;
327
+ readonly depth: 0;
328
+ };
329
+ /**
330
+ * ASCII box drawing characters
331
+ * Uses +, -, | for maximum compatibility
332
+ */
333
+ declare const ASCII_BOX_CHARS: BoxChars;
334
+ /**
335
+ * ASCII double-line box drawing characters
336
+ * Uses = for horizontal lines
337
+ */
338
+ declare const ASCII_DOUBLE_BOX_CHARS: BoxChars;
339
+ /**
340
+ * Unicode single-line box drawing characters
341
+ */
342
+ declare const UNICODE_SINGLE_BOX_CHARS: BoxChars;
343
+ /**
344
+ * Unicode double-line box drawing characters
345
+ */
346
+ declare const UNICODE_DOUBLE_BOX_CHARS: BoxChars;
347
+ /**
348
+ * Unicode rounded box drawing characters
349
+ */
350
+ declare const UNICODE_ROUNDED_BOX_CHARS: BoxChars;
351
+ /**
352
+ * Gets ASCII box characters for a border style
353
+ *
354
+ * @param style - Border style: 'single', 'double', or 'none'
355
+ * @returns BoxChars for the specified style
356
+ */
357
+ declare function getASCIIBoxChars(style: string): BoxChars;
358
+ /**
359
+ * Gets Unicode box characters for a border style
360
+ *
361
+ * @param style - Border style: 'single', 'double', 'rounded', or 'none'
362
+ * @returns BoxChars for the specified style
363
+ */
364
+ declare function getUnicodeBoxChars(style: string): BoxChars;
365
+ /**
366
+ * Unicode symbols for lists, progress, spinners, etc.
367
+ * Shared across Unicode and ANSI renderers
368
+ */
369
+ declare const UNICODE_SYMBOLS: {
370
+ readonly bullet: "•";
371
+ readonly hollowBullet: "◦";
372
+ readonly squareBullet: "▪";
373
+ readonly triangleRight: "▸";
374
+ readonly triangleDown: "▾";
375
+ readonly checkmark: "✓";
376
+ readonly crossMark: "✗";
377
+ readonly unchecked: "☐";
378
+ readonly arrowRight: "→";
379
+ readonly arrowDown: "↓";
380
+ readonly progressFull: "▓";
381
+ readonly progressEmpty: "░";
382
+ readonly progressHalf: "▒";
383
+ readonly ellipsis: "…";
384
+ readonly middleDot: "·";
385
+ readonly teeLeft: "├";
386
+ readonly teeRight: "┤";
387
+ readonly teeTop: "┬";
388
+ readonly teeBottom: "┴";
389
+ readonly crossJunction: "┼";
390
+ };
391
+ /**
392
+ * Braille spinner animation frames
393
+ */
394
+ declare const SPINNER_FRAMES: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
395
+ /**
396
+ * Calculates column widths for table rendering
397
+ *
398
+ * @param headers - Array of header strings
399
+ * @param rows - Array of row data (string arrays)
400
+ * @param maxTableWidth - Maximum allowed table width (optional)
401
+ * @returns Array of column widths
402
+ */
403
+ declare function calculateColumnWidths(headers: string[], rows: string[][], maxTableWidth?: number): number[];
404
+ /**
405
+ * Builds a table separator line
406
+ *
407
+ * @param colWidths - Array of column widths
408
+ * @param chars - Characters for corners and horizontal line
409
+ * @returns Separator line string
410
+ */
411
+ declare function buildTableSeparator(colWidths: number[], chars: {
412
+ left: string;
413
+ middle: string;
414
+ right: string;
415
+ horizontal: string;
416
+ }): string;
417
+ /**
418
+ * Builds a table row with cell content
419
+ *
420
+ * @param cells - Array of cell content strings
421
+ * @param colWidths - Array of column widths
422
+ * @param vertical - Vertical separator character
423
+ * @returns Row line string
424
+ */
425
+ declare function buildTableRow(cells: string[], colWidths: number[], vertical: string): string;
426
+ /**
427
+ * Route matching mode for navigation components
428
+ */
429
+ type RouteMatchMode = 'exact' | 'prefix' | 'pattern';
430
+ /**
431
+ * Router adapter interface - implement this to integrate with any router library
432
+ * This abstraction allows components to work with React Router, Next.js, Vue Router, etc.
433
+ */
434
+ interface RouterAdapter {
435
+ /** Get the current path/location */
436
+ getCurrentPath(): string;
437
+ /** Navigate to a path */
438
+ navigate(path: string): void;
439
+ /** Check if a path matches the current route */
440
+ isActive(path: string, mode?: RouteMatchMode): boolean;
441
+ /** Subscribe to route changes (returns unsubscribe function) */
442
+ subscribe?(callback: (path: string) => void): () => void;
443
+ }
444
+ /**
445
+ * Default router adapter that works without any router library
446
+ * Uses callbacks provided by the component user
447
+ */
448
+ declare function createCallbackRouterAdapter(config: {
449
+ currentPath?: string;
450
+ onNavigate?: (path: string) => void;
451
+ }): RouterAdapter;
452
+ /**
453
+ * Matches a current path against a target path using the specified mode
454
+ *
455
+ * @param currentPath - The current route path
456
+ * @param targetPath - The path to match against
457
+ * @param mode - Match mode: 'exact', 'prefix', or 'pattern'
458
+ * @returns true if the paths match according to the mode
459
+ */
460
+ declare function matchPath(currentPath: string, targetPath: string, mode?: RouteMatchMode): boolean;
461
+ /**
462
+ * Normalizes a path by removing trailing slashes (except for root)
463
+ *
464
+ * @param path - Path to normalize
465
+ * @returns Normalized path
466
+ */
467
+ declare function normalizePath(path: string): string;
468
+ /**
469
+ * Matches a path against a pattern with :param and * wildcards
470
+ *
471
+ * @param path - Actual path to test
472
+ * @param pattern - Pattern with :param segments or * wildcard
473
+ * @returns true if the path matches the pattern
474
+ */
475
+ declare function matchPathPattern(path: string, pattern: string): boolean;
476
+ /**
477
+ * Generates breadcrumb segments from a path
478
+ *
479
+ * @param path - URL path (e.g., '/products/electronics/phones')
480
+ * @param options - Configuration for segment generation
481
+ * @returns Array of breadcrumb segments with labels and paths
482
+ */
483
+ declare function generateBreadcrumbSegments(path: string, options?: {
484
+ /** Custom labels for specific paths (e.g., { '/products': 'Shop' }) */
485
+ labels?: Record<string, string>;
486
+ /** Function to generate label from segment (default: capitalize) */
487
+ labelGenerator?: (segment: string, fullPath: string) => string;
488
+ /** Whether to include home segment */
489
+ includeHome?: boolean;
490
+ /** Home segment label */
491
+ homeLabel?: string;
492
+ }): Array<{
493
+ label: string;
494
+ path: string;
495
+ }>;
496
+ /**
497
+ * Formats a URL segment into a human-readable label
498
+ * Converts kebab-case or snake_case to Title Case
499
+ *
500
+ * @param segment - URL path segment (e.g., 'my-products')
501
+ * @returns Formatted label (e.g., 'My Products')
502
+ */
503
+ declare function formatSegmentLabel(segment: string): string;
504
+ /**
505
+ * Finds the active item in a navigation structure based on current path
506
+ *
507
+ * @param items - Array of items with path property
508
+ * @param currentPath - Current route path
509
+ * @param mode - Match mode for path comparison
510
+ * @returns The matching item's ID or undefined
511
+ */
512
+ declare function findActiveItemByPath<T extends {
513
+ id: string;
514
+ path?: string;
515
+ }>(items: T[], currentPath: string, mode?: RouteMatchMode): string | undefined;
516
+ /**
517
+ * Finds the active item in nested navigation sections based on current path
518
+ *
519
+ * @param sections - Array of sections containing items with path property
520
+ * @param currentPath - Current route path
521
+ * @param mode - Match mode for path comparison
522
+ * @returns The matching item's ID or undefined
523
+ */
524
+ declare function findActiveItemInSections<T extends {
525
+ id: string;
526
+ path?: string;
527
+ }>(sections: Array<{
528
+ items: T[];
529
+ }>, currentPath: string, mode?: RouteMatchMode): string | undefined;
530
+ /**
531
+ * Builds a path by joining segments
532
+ *
533
+ * @param segments - Path segments to join
534
+ * @returns Joined and normalized path
535
+ */
536
+ declare function joinPath(...segments: string[]): string;
537
+ /**
538
+ * Extracts path parameters from a path using a pattern
539
+ *
540
+ * @param path - Actual path (e.g., '/users/123/edit')
541
+ * @param pattern - Pattern with :param segments (e.g., '/users/:id/edit')
542
+ * @returns Object with extracted parameters or null if no match
543
+ */
544
+ declare function extractPathParams(path: string, pattern: string): Record<string, string> | null;
545
+
546
+ export { ASCII_BOX_CHARS, ASCII_DOUBLE_BOX_CHARS, type BoxChars, DEFAULT_RENDER_CONTEXT, DEFAULT_THEME_TOKENS, type MarkdownRenderOptions, type RendererRegistry, type RouteMatchMode, type RouterAdapter, SPINNER_FRAMES, type TextAlign, UNICODE_DOUBLE_BOX_CHARS, UNICODE_ROUNDED_BOX_CHARS, UNICODE_SINGLE_BOX_CHARS, UNICODE_SYMBOLS, boxDrawingToASCII, buildBox, buildTableRow, buildTableSeparator, calculateColumnWidths, createCallbackRouterAdapter, extractHeaders, extractPathParams, extractRowValues, extractStringArray, findActiveItemByPath, findActiveItemInSections, formatSegmentLabel, generateBreadcrumbSegments, getASCIIBoxChars, getIndentStr, getProp, getTextWidth, getUnicodeBoxChars, joinParts, joinPath, matchPath, matchPathPattern, normalizePath, padText, renderANSI, renderASCII, renderInteractive, renderMarkdown, renderUnicode, sanitizeToASCII, wrapText };