@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,777 @@
1
+ /**
2
+ * @mdxui/terminal/components/types
3
+ *
4
+ * Component prop interfaces and type guards for terminal components.
5
+ */
6
+
7
+ import type { ReactNode } from 'react'
8
+
9
+ // ============================================================================
10
+ // Render Context
11
+ // ============================================================================
12
+
13
+ export interface RenderContext {
14
+ width: number
15
+ parentWidth?: number
16
+ /** Enable color output (optional, for testing) */
17
+ colors?: boolean
18
+ /** Color support level (optional, for testing) */
19
+ colorSupport?: 'none' | '16' | '256' | 'truecolor'
20
+ }
21
+
22
+ // ============================================================================
23
+ // Component Type
24
+ // ============================================================================
25
+
26
+ /**
27
+ * Valid component type strings used in createElement
28
+ */
29
+ export type TerminalComponentType =
30
+ | 'box'
31
+ | 'text'
32
+ | 'table'
33
+ | 'input'
34
+ | 'select'
35
+ | 'sidebar'
36
+ | 'sidebar-item'
37
+ | 'breadcrumb'
38
+ | 'badge'
39
+ | 'dialog'
40
+ | 'spinner'
41
+ | 'button'
42
+ | 'panel'
43
+ | 'list'
44
+ | 'card'
45
+
46
+ /**
47
+ * Set of all valid component types for O(1) lookup
48
+ */
49
+ export const COMPONENT_TYPES: Set<string> = new Set<TerminalComponentType>([
50
+ 'box',
51
+ 'text',
52
+ 'table',
53
+ 'input',
54
+ 'select',
55
+ 'sidebar',
56
+ 'sidebar-item',
57
+ 'breadcrumb',
58
+ 'badge',
59
+ 'dialog',
60
+ 'spinner',
61
+ 'button',
62
+ 'panel',
63
+ 'list',
64
+ 'card',
65
+ ])
66
+
67
+ // ============================================================================
68
+ // Primitive Component Props
69
+ // ============================================================================
70
+
71
+ export interface BoxProps {
72
+ children?: ReactNode
73
+ border?: 'none' | 'single' | 'double' | 'rounded'
74
+ padding?: number
75
+ margin?: number
76
+ width?: number | string
77
+ height?: number | string
78
+ flexDirection?: 'row' | 'column'
79
+ justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between'
80
+ alignItems?: 'flex-start' | 'center' | 'flex-end' | 'stretch'
81
+ gap?: number
82
+ bg?: string
83
+ }
84
+
85
+ export interface TextProps {
86
+ children?: ReactNode
87
+ bold?: boolean
88
+ italic?: boolean
89
+ underline?: boolean
90
+ dim?: boolean
91
+ color?: string
92
+ backgroundColor?: string
93
+ wrap?: 'wrap' | 'truncate' | 'truncate-middle' | 'truncate-end'
94
+ }
95
+
96
+ export interface InputProps {
97
+ value?: string
98
+ onChange?: (value: string) => void
99
+ placeholder?: string
100
+ label?: string
101
+ disabled?: boolean
102
+ focused?: boolean
103
+ type?: 'text' | 'password'
104
+ /** Cursor position within the input value (defaults to end of value) */
105
+ cursorPosition?: number
106
+ /** Width of the input field */
107
+ width?: number
108
+ }
109
+
110
+ export interface SelectOption<T> {
111
+ label: string
112
+ value: T
113
+ /** Optional: disable this option */
114
+ disabled?: boolean
115
+ }
116
+
117
+ export interface SelectProps<T> {
118
+ options: SelectOption<T>[]
119
+ value?: T
120
+ onChange?: (value: T) => void
121
+ label?: string
122
+ focused?: boolean
123
+ highlightedIndex?: number
124
+ /** Maximum visible options when expanded (defaults to 5) */
125
+ maxVisible?: number
126
+ }
127
+
128
+ export interface ButtonProps {
129
+ children?: ReactNode
130
+ onPress?: () => void
131
+ hotkey?: string
132
+ disabled?: boolean
133
+ focused?: boolean
134
+ variant?: 'primary' | 'secondary' | 'destructive'
135
+ }
136
+
137
+ // ============================================================================
138
+ // Container Component Props
139
+ // ============================================================================
140
+
141
+ export interface PanelProps {
142
+ children?: ReactNode
143
+ title?: string
144
+ border?: 'none' | 'single' | 'double' | 'rounded'
145
+ collapsible?: boolean
146
+ collapsed?: boolean
147
+ padding?: number
148
+ }
149
+
150
+ export interface CardProps {
151
+ children?: ReactNode
152
+ title?: string
153
+ border?: 'none' | 'single' | 'double'
154
+ }
155
+
156
+ export interface DialogProps {
157
+ open?: boolean
158
+ onClose?: () => void
159
+ title?: string
160
+ children?: ReactNode
161
+ }
162
+
163
+ // ============================================================================
164
+ // Layout Component Props
165
+ // ============================================================================
166
+
167
+ /**
168
+ * Sidebar layout component props (internal terminal component).
169
+ * This is distinct from the mdxui SidebarProps for AppComponents.
170
+ * @deprecated Use SidebarProps (mdxui-compatible) instead for new code.
171
+ */
172
+ export interface TerminalSidebarLayoutProps {
173
+ children?: ReactNode
174
+ width?: number
175
+ collapsed?: boolean
176
+ }
177
+
178
+ export interface SidebarItemProps {
179
+ label: string
180
+ icon?: string
181
+ active?: boolean
182
+ onSelect?: () => void
183
+ children?: ReactNode
184
+ }
185
+
186
+ export interface BreadcrumbProps {
187
+ items: Array<{ label: string; path?: string }>
188
+ separator?: string
189
+ }
190
+
191
+ export interface ListProps {
192
+ items: string[] | ReactNode[]
193
+ selectedIndex?: number
194
+ onSelect?: (item: string | ReactNode, index: number) => void
195
+ bullet?: string
196
+ numbered?: boolean
197
+ }
198
+
199
+ export interface TableColumn<T> {
200
+ key: keyof T | string
201
+ header: string
202
+ width?: number
203
+ align?: 'left' | 'center' | 'right'
204
+ render?: (value: unknown, row: T) => ReactNode
205
+ }
206
+
207
+ export interface TableProps<T> {
208
+ data: T[]
209
+ columns: TableColumn<T>[]
210
+ onSelect?: (row: T, index: number) => void
211
+ selectedIndex?: number
212
+ navigable?: boolean
213
+ }
214
+
215
+ // ============================================================================
216
+ // Feedback Component Props
217
+ // ============================================================================
218
+
219
+ export interface BadgeProps {
220
+ children?: ReactNode
221
+ variant?: 'default' | 'success' | 'warning' | 'error' | 'info'
222
+ }
223
+
224
+ export interface SpinnerProps {
225
+ label?: string
226
+ }
227
+
228
+ // ============================================================================
229
+ // mdxui Common Types (re-exported from mdxui for convenience)
230
+ // ============================================================================
231
+
232
+ /**
233
+ * Navigation item for headers, sidebars, etc.
234
+ * Compatible with mdxui NavItem.
235
+ */
236
+ export interface NavItem {
237
+ label: string
238
+ href: string
239
+ icon?: string
240
+ description?: string
241
+ children?: NavItem[]
242
+ }
243
+
244
+ /**
245
+ * Action configuration for behavior props.
246
+ * Compatible with mdxui ActionConfig.
247
+ */
248
+ export interface ActionConfig {
249
+ kind?: 'config'
250
+ href: string
251
+ onClick?: () => void
252
+ target?: '_blank' | '_self'
253
+ }
254
+
255
+ /**
256
+ * Action prop accepts either a simple string (href) or full config.
257
+ */
258
+ export type ActionProp = string | ActionConfig
259
+
260
+ /**
261
+ * Standard actions object for components with primary/secondary actions.
262
+ */
263
+ export interface ActionsProps {
264
+ primary?: ActionProp
265
+ secondary?: ActionProp
266
+ }
267
+
268
+ /**
269
+ * Footer link group structure.
270
+ */
271
+ export interface FooterLinkGroup {
272
+ title: string
273
+ links: Array<{ label: string; href: string }>
274
+ }
275
+
276
+ /**
277
+ * Social link structure.
278
+ */
279
+ export interface SocialLink {
280
+ platform: string
281
+ href: string
282
+ icon?: ReactNode
283
+ }
284
+
285
+ /**
286
+ * Feature item for Features section.
287
+ */
288
+ export interface FeatureItem {
289
+ title: string
290
+ description: string
291
+ icon?: ReactNode
292
+ actions?: { link?: ActionProp }
293
+ }
294
+
295
+ /**
296
+ * Pricing tier structure.
297
+ */
298
+ export interface PricingTier {
299
+ name: string
300
+ price: string
301
+ description?: string
302
+ features: string[]
303
+ callToAction: string
304
+ highlighted?: boolean
305
+ actions?: ActionsProps
306
+ }
307
+
308
+ /**
309
+ * FAQ item structure.
310
+ */
311
+ export interface FAQItem {
312
+ question: string
313
+ answer: string
314
+ }
315
+
316
+ /**
317
+ * Dashboard metric structure.
318
+ */
319
+ export interface DashboardMetric {
320
+ label: string
321
+ value: string | number
322
+ change?: number
323
+ trend?: 'up' | 'down' | 'neutral'
324
+ }
325
+
326
+ /**
327
+ * Settings section types.
328
+ */
329
+ export type SettingsSection =
330
+ | 'profile'
331
+ | 'security'
332
+ | 'notifications'
333
+ | 'billing'
334
+ | 'team'
335
+ | 'api'
336
+ | 'integrations'
337
+
338
+ /**
339
+ * App header user structure.
340
+ */
341
+ export interface AppHeaderUser {
342
+ name: string
343
+ email: string
344
+ avatar?: string
345
+ }
346
+
347
+ /**
348
+ * Breadcrumb item structure.
349
+ */
350
+ export interface BreadcrumbItem {
351
+ label: string
352
+ href?: string
353
+ }
354
+
355
+ // ============================================================================
356
+ // Site Component Props (mdxui SiteComponents interface)
357
+ // ============================================================================
358
+
359
+ /**
360
+ * Site component props - root container for marketing sites.
361
+ * Compatible with mdxui SiteProps.
362
+ */
363
+ export interface SiteProps {
364
+ /** Site display name (required by mdxui) */
365
+ name: string
366
+ /** Primary domain (e.g., "example.com") */
367
+ domain?: string
368
+ /** Theme mode */
369
+ theme?: 'light' | 'dark' | 'system'
370
+ /** Child content */
371
+ children?: ReactNode
372
+ }
373
+
374
+ /**
375
+ * Header component props - navigation header.
376
+ * Compatible with both mdxui HeaderProps (SiteComponents) and AppHeaderProps (AppComponents).
377
+ *
378
+ * This combined interface allows the terminal Header component to work in
379
+ * both site and app contexts. In site mode, logo and nav are typically used.
380
+ * In app mode, user and breadcrumbs are typically used.
381
+ *
382
+ * Note: For strict mdxui HeaderProps compatibility in site context,
383
+ * logo and nav should be provided. They are optional here to allow
384
+ * the same component to work with AppHeaderProps.
385
+ */
386
+ export interface HeaderProps {
387
+ // Site header props (from mdxui HeaderProps)
388
+ /**
389
+ * Logo element or URL.
390
+ * Required for site usage (mdxui HeaderProps).
391
+ * Optional here to support dual use with AppHeaderProps.
392
+ */
393
+ logo?: ReactNode
394
+ /**
395
+ * Navigation links.
396
+ * Required for site usage (mdxui HeaderProps).
397
+ * Optional here to support dual use with AppHeaderProps.
398
+ */
399
+ nav?: NavItem[]
400
+ /** Primary CTA button text */
401
+ callToAction?: string
402
+ /** Action behaviors */
403
+ actions?: ActionsProps
404
+ /** Custom link component */
405
+ LinkComponent?: ReactNode
406
+
407
+ // App header props (from mdxui AppHeaderProps)
408
+ /** Current user (used in app mode) */
409
+ user?: AppHeaderUser
410
+ /** Show search */
411
+ showSearch?: boolean
412
+ /** Show notifications */
413
+ showNotifications?: boolean
414
+ /** Breadcrumbs */
415
+ breadcrumbs?: BreadcrumbItem[]
416
+
417
+ /** Child content */
418
+ children?: ReactNode
419
+ }
420
+
421
+ /**
422
+ * Footer component props - site footer.
423
+ * Compatible with mdxui FooterProps.
424
+ */
425
+ export interface FooterProps {
426
+ /** Logo element or URL (required by mdxui) */
427
+ logo: ReactNode
428
+ /** Footer link groups (required by mdxui) */
429
+ links: FooterLinkGroup[]
430
+ /** Social media links */
431
+ social?: SocialLink[]
432
+ /** Copyright text */
433
+ copyright?: string
434
+ /** Newsletter signup configuration */
435
+ newsletter?: {
436
+ headline: string
437
+ subheadline: string
438
+ }
439
+ /** Child content */
440
+ children?: ReactNode
441
+ }
442
+
443
+ /**
444
+ * Hero component props - hero section.
445
+ * Compatible with mdxui HeroProps.
446
+ */
447
+ export interface HeroProps {
448
+ /** Main title (required by mdxui as string) */
449
+ title: string
450
+ /** Subtitle or description */
451
+ subtitle?: string
452
+ /** Badge text (above headline) */
453
+ badge?: string
454
+ /** Primary call-to-action text (required by mdxui) */
455
+ callToAction: string
456
+ /** Secondary call-to-action text */
457
+ secondaryCallToAction?: string
458
+ /** Layout variant */
459
+ variant?: 'default' | 'centered' | 'split' | 'code-below' | 'video-beside' | 'image-split'
460
+ /** Hero image URL */
461
+ image?: string
462
+ /** Hero video URL */
463
+ video?: string
464
+ /** Product screenshot URL */
465
+ screenshot?: string
466
+ /** Code block content */
467
+ code?: {
468
+ language: string
469
+ code: string
470
+ }
471
+ /** Action behaviors */
472
+ actions?: ActionsProps
473
+ /** Child content */
474
+ children?: ReactNode
475
+ }
476
+
477
+ /**
478
+ * Features component props - features section.
479
+ * Compatible with mdxui FeaturesProps.
480
+ */
481
+ export interface FeaturesProps {
482
+ /** Section title */
483
+ title?: string
484
+ /** Section description */
485
+ description?: string
486
+ /** Feature items (required by mdxui) */
487
+ features: FeatureItem[]
488
+ /** Layout variant */
489
+ variant?: 'grid' | 'list' | 'bento'
490
+ /** Number of columns (for grid) */
491
+ columns?: number
492
+ /** Child content */
493
+ children?: ReactNode
494
+ }
495
+
496
+ /**
497
+ * Pricing component props - pricing section.
498
+ * Compatible with mdxui PricingProps.
499
+ */
500
+ export interface PricingProps {
501
+ /** Section title */
502
+ title?: string
503
+ /** Section description */
504
+ description?: string
505
+ /** Pricing tiers (required by mdxui) */
506
+ tiers: PricingTier[]
507
+ /** Show annual/monthly toggle */
508
+ showToggle?: boolean
509
+ /** Layout variant */
510
+ variant?: 'cards' | 'comparison-table' | 'toggle'
511
+ /** Child content */
512
+ children?: ReactNode
513
+ }
514
+
515
+ /**
516
+ * FAQ component props - FAQ section.
517
+ * Compatible with mdxui FAQProps.
518
+ */
519
+ export interface FAQProps {
520
+ /** Section title */
521
+ title?: string
522
+ /** FAQ items (required by mdxui) */
523
+ items: FAQItem[]
524
+ /** Layout variant */
525
+ variant?: 'accordion' | 'grid' | 'list'
526
+ /** Child content */
527
+ children?: ReactNode
528
+ }
529
+
530
+ /**
531
+ * LandingPage component props - homepage layout.
532
+ * Compatible with mdxui LandingPageProps.
533
+ */
534
+ export interface LandingPageProps {
535
+ /** Child sections (Hero, Features, Pricing, etc.) */
536
+ children?: ReactNode
537
+ }
538
+
539
+ /**
540
+ * Page component props - generic content page.
541
+ * Compatible with mdxui PageProps.
542
+ */
543
+ export interface PageProps {
544
+ /** Page title */
545
+ title?: string
546
+ /** Page description */
547
+ description?: string
548
+ /** Page content */
549
+ children?: ReactNode
550
+ }
551
+
552
+ // ============================================================================
553
+ // App Component Props (mdxui AppComponents interface)
554
+ // ============================================================================
555
+
556
+ /**
557
+ * App component props - root container for SaaS applications.
558
+ * Compatible with mdxui AppProps.
559
+ */
560
+ export interface AppProps {
561
+ /** App display name (required by mdxui) */
562
+ name: string
563
+ /** Authentication configuration */
564
+ auth?: {
565
+ provider: 'workos' | 'clerk' | 'auth0' | 'custom'
566
+ clientId?: string
567
+ loginUrl?: string
568
+ redirectUri?: string
569
+ }
570
+ /** Child content */
571
+ children?: ReactNode
572
+ }
573
+
574
+ /**
575
+ * Shell component props - app shell layout.
576
+ * Compatible with mdxui ShellProps.
577
+ */
578
+ export interface ShellProps {
579
+ /** Show sidebar */
580
+ sidebar?: boolean
581
+ /** Show header */
582
+ header?: boolean
583
+ /** Sidebar collapsed by default */
584
+ sidebarCollapsed?: boolean
585
+ /** Child content */
586
+ children?: ReactNode
587
+ }
588
+
589
+ /**
590
+ * Sidebar component props - navigation sidebar.
591
+ * Compatible with mdxui SidebarProps.
592
+ */
593
+ export interface SidebarProps {
594
+ /** Navigation items (required by mdxui) */
595
+ nav: NavItem[]
596
+ /** User info for bottom of sidebar */
597
+ user?: AppHeaderUser
598
+ /** Branding */
599
+ logo?: ReactNode
600
+ /** Collapsed state */
601
+ collapsed?: boolean
602
+ /** On collapse toggle */
603
+ onCollapse?: () => void
604
+ /** Width */
605
+ width?: number
606
+ /** Child content */
607
+ children?: ReactNode
608
+ }
609
+
610
+ /**
611
+ * AppHeader component props - top header bar.
612
+ * Compatible with mdxui AppHeaderProps.
613
+ */
614
+ export interface AppHeaderProps {
615
+ /** Current user */
616
+ user?: AppHeaderUser
617
+ /** Show search */
618
+ showSearch?: boolean
619
+ /** Show notifications */
620
+ showNotifications?: boolean
621
+ /** Breadcrumbs */
622
+ breadcrumbs?: BreadcrumbItem[]
623
+ /** Child content */
624
+ children?: ReactNode
625
+ }
626
+
627
+ /**
628
+ * Dashboard component props - main dashboard view.
629
+ * Compatible with mdxui DashboardProps.
630
+ */
631
+ export interface DashboardProps {
632
+ /** Dashboard title */
633
+ title?: string
634
+ /** Metrics to display */
635
+ metrics?: DashboardMetric[]
636
+ /** Child widgets/content */
637
+ children?: ReactNode
638
+ }
639
+
640
+ /**
641
+ * Settings component props - settings page layout.
642
+ * Compatible with mdxui SettingsProps.
643
+ */
644
+ export interface SettingsProps {
645
+ /** Settings sections to show */
646
+ sections?: SettingsSection[]
647
+ /** Child content */
648
+ children?: ReactNode
649
+ }
650
+
651
+ // ============================================================================
652
+ // Type Guards
653
+ // ============================================================================
654
+
655
+ /**
656
+ * Type guard to check if a value is a valid TerminalComponentType
657
+ */
658
+ export function isTerminalComponentType(type: unknown): type is TerminalComponentType {
659
+ return typeof type === 'string' && COMPONENT_TYPES.has(type)
660
+ }
661
+
662
+ /**
663
+ * Type guard for props objects - validates object shape
664
+ */
665
+ export function isPropsObject(props: unknown): props is Record<string, unknown> {
666
+ return typeof props === 'object' && props !== null
667
+ }
668
+
669
+ /**
670
+ * Type guard for BoxProps
671
+ */
672
+ export function isBoxProps(props: unknown): props is BoxProps {
673
+ return isPropsObject(props)
674
+ }
675
+
676
+ /**
677
+ * Type guard for TextProps
678
+ */
679
+ export function isTextProps(props: unknown): props is TextProps {
680
+ return isPropsObject(props)
681
+ }
682
+
683
+ /**
684
+ * Type guard for TableProps
685
+ */
686
+ export function isTableProps(props: unknown): props is TableProps<unknown> {
687
+ if (!isPropsObject(props)) return false
688
+ return Array.isArray(props.data) && Array.isArray(props.columns)
689
+ }
690
+
691
+ /**
692
+ * Type guard for InputProps
693
+ */
694
+ export function isInputProps(props: unknown): props is InputProps {
695
+ return isPropsObject(props)
696
+ }
697
+
698
+ /**
699
+ * Type guard for SelectProps
700
+ */
701
+ export function isSelectProps(props: unknown): props is SelectProps<unknown> {
702
+ if (!isPropsObject(props)) return false
703
+ return Array.isArray(props.options)
704
+ }
705
+
706
+ /**
707
+ * Type guard for SidebarProps
708
+ */
709
+ export function isSidebarProps(props: unknown): props is SidebarProps {
710
+ return isPropsObject(props)
711
+ }
712
+
713
+ /**
714
+ * Type guard for SidebarItemProps
715
+ */
716
+ export function isSidebarItemProps(props: unknown): props is SidebarItemProps {
717
+ if (!isPropsObject(props)) return false
718
+ return typeof props.label === 'string'
719
+ }
720
+
721
+ /**
722
+ * Type guard for BreadcrumbProps
723
+ */
724
+ export function isBreadcrumbProps(props: unknown): props is BreadcrumbProps {
725
+ if (!isPropsObject(props)) return false
726
+ return Array.isArray(props.items)
727
+ }
728
+
729
+ /**
730
+ * Type guard for BadgeProps
731
+ */
732
+ export function isBadgeProps(props: unknown): props is BadgeProps {
733
+ return isPropsObject(props)
734
+ }
735
+
736
+ /**
737
+ * Type guard for DialogProps
738
+ */
739
+ export function isDialogProps(props: unknown): props is DialogProps {
740
+ return isPropsObject(props)
741
+ }
742
+
743
+ /**
744
+ * Type guard for SpinnerProps
745
+ */
746
+ export function isSpinnerProps(props: unknown): props is SpinnerProps {
747
+ return isPropsObject(props)
748
+ }
749
+
750
+ /**
751
+ * Type guard for ButtonProps
752
+ */
753
+ export function isButtonProps(props: unknown): props is ButtonProps {
754
+ return isPropsObject(props)
755
+ }
756
+
757
+ /**
758
+ * Type guard for PanelProps
759
+ */
760
+ export function isPanelProps(props: unknown): props is PanelProps {
761
+ return isPropsObject(props)
762
+ }
763
+
764
+ /**
765
+ * Type guard for ListProps
766
+ */
767
+ export function isListProps(props: unknown): props is ListProps {
768
+ if (!isPropsObject(props)) return false
769
+ return Array.isArray(props.items)
770
+ }
771
+
772
+ /**
773
+ * Type guard for CardProps
774
+ */
775
+ export function isCardProps(props: unknown): props is CardProps {
776
+ return isPropsObject(props)
777
+ }