@object-ui/types 0.3.0 → 0.5.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 (169) hide show
  1. package/README.md +19 -11
  2. package/dist/api-types.d.ts +7 -0
  3. package/dist/api-types.d.ts.map +1 -1
  4. package/dist/api-types.js +4 -6
  5. package/dist/app.d.ts +17 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/app.js +4 -3
  8. package/dist/base.d.ts +7 -0
  9. package/dist/base.d.ts.map +1 -1
  10. package/dist/base.js +4 -6
  11. package/dist/blocks.d.ts +332 -0
  12. package/dist/blocks.d.ts.map +1 -0
  13. package/dist/blocks.js +8 -0
  14. package/dist/complex.d.ts +68 -1
  15. package/dist/complex.d.ts.map +1 -1
  16. package/dist/complex.js +4 -5
  17. package/dist/crud.d.ts +181 -3
  18. package/dist/crud.d.ts.map +1 -1
  19. package/dist/crud.js +4 -6
  20. package/dist/data-display.d.ts +54 -2
  21. package/dist/data-display.d.ts.map +1 -1
  22. package/dist/data-display.js +4 -5
  23. package/dist/data-protocol.d.ts +1268 -0
  24. package/dist/data-protocol.d.ts.map +1 -0
  25. package/dist/data-protocol.js +8 -0
  26. package/dist/data.d.ts +22 -1
  27. package/dist/data.d.ts.map +1 -1
  28. package/dist/data.js +4 -6
  29. package/dist/disclosure.d.ts +70 -1
  30. package/dist/disclosure.d.ts.map +1 -1
  31. package/dist/disclosure.js +4 -5
  32. package/dist/feedback.d.ts +68 -1
  33. package/dist/feedback.d.ts.map +1 -1
  34. package/dist/feedback.js +4 -5
  35. package/dist/field-types.d.ts +728 -0
  36. package/dist/field-types.d.ts.map +1 -0
  37. package/dist/field-types.js +8 -0
  38. package/dist/form.d.ts +123 -1
  39. package/dist/form.d.ts.map +1 -1
  40. package/dist/form.js +4 -5
  41. package/dist/index.d.ts +48 -13
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +4 -37
  44. package/dist/layout.d.ts +66 -16
  45. package/dist/layout.d.ts.map +1 -1
  46. package/dist/layout.js +4 -6
  47. package/dist/navigation.d.ts +102 -2
  48. package/dist/navigation.d.ts.map +1 -1
  49. package/dist/navigation.js +4 -5
  50. package/dist/objectql.d.ts +491 -54
  51. package/dist/objectql.d.ts.map +1 -1
  52. package/dist/objectql.js +4 -6
  53. package/dist/overlay.d.ts +31 -1
  54. package/dist/overlay.d.ts.map +1 -1
  55. package/dist/overlay.js +4 -5
  56. package/dist/plugin-scope.d.ts +194 -0
  57. package/dist/plugin-scope.d.ts.map +1 -0
  58. package/dist/plugin-scope.js +8 -0
  59. package/dist/registry.d.ts +7 -0
  60. package/dist/registry.d.ts.map +1 -1
  61. package/dist/registry.js +7 -0
  62. package/dist/reports.d.ts +336 -0
  63. package/dist/reports.d.ts.map +1 -0
  64. package/dist/reports.js +8 -0
  65. package/dist/theme.d.ts +289 -0
  66. package/dist/theme.d.ts.map +1 -0
  67. package/dist/theme.js +8 -0
  68. package/dist/ui-action.d.ts +175 -0
  69. package/dist/ui-action.d.ts.map +1 -0
  70. package/dist/ui-action.js +8 -0
  71. package/dist/views.d.ts +417 -0
  72. package/dist/views.d.ts.map +1 -0
  73. package/dist/views.js +8 -0
  74. package/dist/zod/app.zod.d.ts +120 -0
  75. package/dist/zod/app.zod.d.ts.map +1 -0
  76. package/dist/zod/app.zod.js +60 -0
  77. package/dist/zod/base.zod.d.ts +202 -0
  78. package/dist/zod/base.zod.d.ts.map +1 -0
  79. package/dist/zod/base.zod.js +198 -0
  80. package/dist/zod/blocks.zod.d.ts +834 -0
  81. package/dist/zod/blocks.zod.d.ts.map +1 -0
  82. package/dist/zod/blocks.zod.js +145 -0
  83. package/dist/zod/complex.zod.d.ts +742 -0
  84. package/dist/zod/complex.zod.d.ts.map +1 -0
  85. package/dist/zod/complex.zod.js +233 -0
  86. package/dist/zod/crud.zod.d.ts +598 -0
  87. package/dist/zod/crud.zod.d.ts.map +1 -0
  88. package/dist/zod/crud.zod.js +230 -0
  89. package/dist/zod/data-display.zod.d.ts +996 -0
  90. package/dist/zod/data-display.zod.d.ts.map +1 -0
  91. package/dist/zod/data-display.zod.js +266 -0
  92. package/dist/zod/disclosure.zod.d.ts +267 -0
  93. package/dist/zod/disclosure.zod.d.ts.map +1 -0
  94. package/dist/zod/disclosure.zod.js +84 -0
  95. package/dist/zod/feedback.zod.d.ts +538 -0
  96. package/dist/zod/feedback.zod.d.ts.map +1 -0
  97. package/dist/zod/feedback.zod.js +127 -0
  98. package/dist/zod/form.zod.d.ts +1308 -0
  99. package/dist/zod/form.zod.d.ts.map +1 -0
  100. package/dist/zod/form.zod.js +406 -0
  101. package/dist/zod/index.zod.d.ts +4985 -0
  102. package/dist/zod/index.zod.d.ts.map +1 -0
  103. package/dist/zod/index.zod.js +183 -0
  104. package/dist/zod/layout.zod.d.ts +1048 -0
  105. package/dist/zod/layout.zod.d.ts.map +1 -0
  106. package/dist/zod/layout.zod.js +241 -0
  107. package/dist/zod/navigation.zod.d.ts +486 -0
  108. package/dist/zod/navigation.zod.d.ts.map +1 -0
  109. package/dist/zod/navigation.zod.js +142 -0
  110. package/dist/zod/objectql.zod.d.ts +1261 -0
  111. package/dist/zod/objectql.zod.d.ts.map +1 -0
  112. package/dist/zod/objectql.zod.js +248 -0
  113. package/dist/zod/overlay.zod.d.ts +691 -0
  114. package/dist/zod/overlay.zod.d.ts.map +1 -0
  115. package/dist/zod/overlay.zod.js +179 -0
  116. package/dist/zod/reports.zod.d.ts +1628 -0
  117. package/dist/zod/reports.zod.d.ts.map +1 -0
  118. package/dist/zod/reports.zod.js +152 -0
  119. package/dist/zod/theme.zod.d.ts +611 -0
  120. package/dist/zod/theme.zod.d.ts.map +1 -0
  121. package/dist/zod/theme.zod.js +130 -0
  122. package/dist/zod/views.zod.d.ts +675 -0
  123. package/dist/zod/views.zod.d.ts.map +1 -0
  124. package/dist/zod/views.zod.js +159 -0
  125. package/package.json +9 -1
  126. package/src/__tests__/namespace-exports.test.ts +80 -0
  127. package/src/__tests__/phase2-schemas.test.ts +639 -0
  128. package/src/api-types.ts +8 -0
  129. package/src/app.ts +20 -0
  130. package/src/base.ts +8 -0
  131. package/src/blocks.ts +405 -0
  132. package/src/complex.ts +69 -1
  133. package/src/crud.ts +185 -3
  134. package/src/data-display.ts +60 -2
  135. package/src/data-protocol.ts +1679 -0
  136. package/src/data.ts +21 -1
  137. package/src/disclosure.ts +74 -1
  138. package/src/feedback.ts +76 -2
  139. package/src/field-types.ts +846 -0
  140. package/src/form.ts +131 -1
  141. package/src/index.ts +305 -8
  142. package/src/layout.ts +70 -15
  143. package/src/navigation.ts +109 -2
  144. package/src/objectql.ts +563 -59
  145. package/src/overlay.ts +35 -1
  146. package/src/plugin-scope.ts +210 -0
  147. package/src/registry.ts +8 -0
  148. package/src/reports.ts +408 -0
  149. package/src/theme.ts +351 -0
  150. package/src/ui-action.ts +276 -0
  151. package/src/views.ts +429 -0
  152. package/src/zod/README.md +329 -0
  153. package/src/zod/app.zod.ts +72 -0
  154. package/src/zod/base.zod.ts +229 -0
  155. package/src/zod/blocks.zod.ts +170 -0
  156. package/src/zod/complex.zod.ts +258 -0
  157. package/src/zod/crud.zod.ts +259 -0
  158. package/src/zod/data-display.zod.ts +290 -0
  159. package/src/zod/disclosure.zod.ts +92 -0
  160. package/src/zod/feedback.zod.ts +138 -0
  161. package/src/zod/form.zod.ts +434 -0
  162. package/src/zod/index.zod.ts +425 -0
  163. package/src/zod/layout.zod.ts +262 -0
  164. package/src/zod/navigation.zod.ts +159 -0
  165. package/src/zod/objectql.zod.ts +268 -0
  166. package/src/zod/overlay.zod.ts +196 -0
  167. package/src/zod/reports.zod.ts +183 -0
  168. package/src/zod/theme.zod.ts +155 -0
  169. package/src/zod/views.zod.ts +182 -0
@@ -0,0 +1,425 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types/zod - Zod Validation Schemas
11
+ *
12
+ * Complete Zod validation schemas for all ObjectUI components.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * ## Usage
16
+ *
17
+ * ```typescript
18
+ * import { ButtonSchema, InputSchema, FormSchema } from '@object-ui/types/zod';
19
+ *
20
+ * // Validate a schema
21
+ * const result = ButtonSchema.safeParse({
22
+ * type: 'button',
23
+ * label: 'Click Me',
24
+ * variant: 'primary',
25
+ * });
26
+ *
27
+ * if (result.success) {
28
+ * console.log('Valid schema:', result.data);
29
+ * } else {
30
+ * console.error('Validation errors:', result.error);
31
+ * }
32
+ * ```
33
+ *
34
+ * @packageDocumentation
35
+ */
36
+
37
+ // ============================================================================
38
+ // Application - Global Configuration
39
+ // ============================================================================
40
+ export {
41
+ AppSchema,
42
+ AppActionSchema,
43
+ MenuItemSchema as AppMenuItemSchema,
44
+ } from './app.zod.js';
45
+
46
+ // ============================================================================
47
+ // Base Schema - Foundation
48
+ // ============================================================================
49
+ export {
50
+ BaseSchema,
51
+ SchemaNodeSchema,
52
+ ComponentInputSchema,
53
+ ComponentMetaSchema,
54
+ ComponentConfigSchema,
55
+ HTMLAttributesSchema,
56
+ EventHandlersSchema,
57
+ StylePropsSchema,
58
+ } from './base.zod.js';
59
+
60
+ // ============================================================================
61
+ // Layout Components - Structure & Organization
62
+ // ============================================================================
63
+ export {
64
+ DivSchema,
65
+ SpanSchema,
66
+ TextSchema,
67
+ ImageSchema,
68
+ IconSchema,
69
+ SeparatorSchema,
70
+ ContainerSchema,
71
+ FlexSchema,
72
+ StackSchema,
73
+ GridSchema,
74
+ CardSchema,
75
+ TabItemSchema,
76
+ TabsSchema,
77
+ ScrollAreaSchema,
78
+ ResizablePanelSchema,
79
+ ResizableSchema,
80
+ AspectRatioSchema,
81
+ PageSchema,
82
+ LayoutSchema,
83
+ } from './layout.zod.js';
84
+
85
+ // ============================================================================
86
+ // Form Components - User Input & Interaction
87
+ // ============================================================================
88
+ export {
89
+ SelectOptionSchema,
90
+ RadioOptionSchema,
91
+ ComboboxOptionSchema,
92
+ CommandItemSchema,
93
+ CommandGroupSchema,
94
+ ValidationRuleSchema,
95
+ FieldConditionSchema,
96
+ ButtonSchema,
97
+ InputSchema,
98
+ TextareaSchema,
99
+ SelectSchema,
100
+ CheckboxSchema,
101
+ RadioGroupSchema,
102
+ SwitchSchema,
103
+ ToggleSchema,
104
+ SliderSchema,
105
+ FileUploadSchema,
106
+ DatePickerSchema,
107
+ CalendarSchema,
108
+ InputOTPSchema,
109
+ ComboboxSchema,
110
+ LabelSchema,
111
+ CommandSchema,
112
+ FormFieldSchema,
113
+ FormSchema,
114
+ FormComponentSchema,
115
+ } from './form.zod.js';
116
+
117
+ // ============================================================================
118
+ // Data Display Components - Information Presentation
119
+ // ============================================================================
120
+ export {
121
+ AlertSchema,
122
+ StatisticSchema,
123
+ BadgeSchema,
124
+ AvatarSchema,
125
+ ListItemSchema,
126
+ ListSchema,
127
+ TableColumnSchema,
128
+ TableSchema,
129
+ DataTableSchema,
130
+ MarkdownSchema,
131
+ TreeNodeSchema,
132
+ TreeViewSchema,
133
+ ChartTypeSchema,
134
+ ChartSeriesSchema,
135
+ ChartSchema,
136
+ TimelineEventSchema,
137
+ TimelineSchema,
138
+ KbdSchema,
139
+ HtmlSchema,
140
+ DataDisplaySchema,
141
+ } from './data-display.zod.js';
142
+
143
+ // ============================================================================
144
+ // Feedback Components - Status & Progress Indication
145
+ // ============================================================================
146
+ export {
147
+ LoadingSchema,
148
+ ProgressSchema,
149
+ SkeletonSchema,
150
+ ToastSchema,
151
+ ToasterSchema,
152
+ SpinnerSchema,
153
+ EmptySchema,
154
+ SonnerSchema,
155
+ FeedbackSchema,
156
+ } from './feedback.zod.js';
157
+
158
+ // ============================================================================
159
+ // Disclosure Components - Collapsible Content
160
+ // ============================================================================
161
+ export {
162
+ AccordionItemSchema,
163
+ AccordionSchema,
164
+ CollapsibleSchema,
165
+ ToggleGroupItemSchema,
166
+ ToggleGroupSchema,
167
+ DisclosureSchema,
168
+ } from './disclosure.zod.js';
169
+
170
+ // ============================================================================
171
+ // Overlay Components - Modals & Popovers
172
+ // ============================================================================
173
+ export {
174
+ DialogSchema,
175
+ AlertDialogSchema,
176
+ SheetSchema,
177
+ DrawerSchema,
178
+ PopoverSchema,
179
+ TooltipSchema,
180
+ HoverCardSchema,
181
+ MenuItemSchema,
182
+ DropdownMenuSchema,
183
+ ContextMenuSchema,
184
+ MenubarMenuSchema,
185
+ MenubarSchema,
186
+ OverlaySchema,
187
+ } from './overlay.zod.js';
188
+
189
+ // ============================================================================
190
+ // Navigation Components - Menus & Navigation
191
+ // ============================================================================
192
+ export {
193
+ NavLinkSchema,
194
+ HeaderBarSchema,
195
+ SidebarSchema,
196
+ PaginationSchema,
197
+ NavigationMenuItemSchema,
198
+ NavigationMenuSchema,
199
+ ButtonGroupButtonSchema,
200
+ ButtonGroupSchema,
201
+ NavigationSchema,
202
+ } from './navigation.zod.js';
203
+
204
+ // ============================================================================
205
+ // Complex Components - Advanced/Composite Components
206
+ // ============================================================================
207
+ export {
208
+ KanbanCardSchema,
209
+ KanbanColumnSchema,
210
+ KanbanSchema,
211
+ CalendarViewModeSchema,
212
+ CalendarEventSchema,
213
+ CalendarViewSchema,
214
+ FilterOperatorSchema,
215
+ FilterConditionSchema,
216
+ FilterGroupSchema,
217
+ FilterFieldSchema,
218
+ FilterBuilderSchema,
219
+ CarouselItemSchema,
220
+ CarouselSchema,
221
+ ChatMessageSchema,
222
+ ChatbotSchema,
223
+ DashboardWidgetLayoutSchema,
224
+ DashboardWidgetSchema,
225
+ DashboardSchema,
226
+ ComplexSchema,
227
+ } from './complex.zod.js';
228
+
229
+ // ============================================================================
230
+ // ObjectQL Components - Smart Data Components
231
+ // ============================================================================
232
+ export {
233
+ HttpMethodSchema,
234
+ HttpRequestSchema,
235
+ ViewDataSchema,
236
+ ListColumnSchema,
237
+ SelectionConfigSchema,
238
+ PaginationConfigSchema,
239
+ SortConfigSchema,
240
+ ObjectGridSchema,
241
+ ObjectFormSchema,
242
+ ObjectViewSchema,
243
+ ObjectMapSchema,
244
+ ObjectGanttSchema,
245
+ ObjectCalendarSchema,
246
+ ObjectKanbanSchema,
247
+ ObjectChartSchema,
248
+ ListViewSchema,
249
+ ObjectQLComponentSchema,
250
+ } from './objectql.zod.js';
251
+
252
+ // ============================================================================
253
+ // CRUD Components - Create, Read, Update, Delete Operations
254
+ // ============================================================================
255
+ export {
256
+ ActionExecutionModeSchema,
257
+ ActionCallbackSchema,
258
+ ActionConditionSchema,
259
+ ActionSchema,
260
+ CRUDOperationSchema,
261
+ CRUDFilterSchema,
262
+ CRUDToolbarSchema,
263
+ CRUDPaginationSchema,
264
+ CRUDSchema,
265
+ DetailSchema,
266
+ CRUDDialogSchema,
267
+ CRUDComponentSchema,
268
+ } from './crud.zod.js';
269
+
270
+ // ============================================================================
271
+ // Phase 2 Schemas - Theme, Reports, Blocks, and Views
272
+ // ============================================================================
273
+ export {
274
+ ColorPaletteSchema,
275
+ TypographySchema,
276
+ SpacingScaleSchema,
277
+ BorderRadiusSchema,
278
+ ThemeModeSchema,
279
+ ThemeDefinitionSchema,
280
+ ThemeSchema,
281
+ ThemeSwitcherSchema,
282
+ ThemePreviewSchema,
283
+ ThemeComponentSchema,
284
+ } from './theme.zod.js';
285
+
286
+ export {
287
+ ReportExportFormatSchema,
288
+ ReportScheduleFrequencySchema,
289
+ ReportAggregationTypeSchema,
290
+ ReportFieldSchema,
291
+ ReportFilterSchema,
292
+ ReportGroupBySchema,
293
+ ReportSectionSchema,
294
+ ReportScheduleSchema,
295
+ ReportExportConfigSchema,
296
+ ReportSchema,
297
+ ReportBuilderSchema,
298
+ ReportViewerSchema,
299
+ ReportComponentSchema,
300
+ } from './reports.zod.js';
301
+
302
+ export {
303
+ BlockVariableSchema,
304
+ BlockSlotSchema,
305
+ BlockMetadataSchema,
306
+ BlockSchema,
307
+ BlockLibraryItemSchema,
308
+ BlockLibrarySchema,
309
+ BlockEditorSchema,
310
+ BlockInstanceSchema,
311
+ ComponentSchema,
312
+ BlockComponentSchema,
313
+ } from './blocks.zod.js';
314
+
315
+ export {
316
+ ViewTypeSchema,
317
+ DetailViewFieldSchema,
318
+ DetailViewSectionSchema,
319
+ DetailViewTabSchema,
320
+ DetailViewSchema,
321
+ ViewSwitcherSchema,
322
+ FilterUISchema,
323
+ SortUISchema,
324
+ ViewComponentSchema,
325
+ } from './views.zod.js';
326
+
327
+ // ============================================================================
328
+ // Union Types - All Component Schemas
329
+ // ============================================================================
330
+
331
+ import { z } from 'zod';
332
+ import { AppSchema } from './app.zod.js';
333
+ import { LayoutSchema } from './layout.zod.js';
334
+ import { FormComponentSchema } from './form.zod.js';
335
+ import { DataDisplaySchema } from './data-display.zod.js';
336
+ import { FeedbackSchema } from './feedback.zod.js';
337
+ import { DisclosureSchema } from './disclosure.zod.js';
338
+ import { OverlaySchema } from './overlay.zod.js';
339
+ import { NavigationSchema } from './navigation.zod.js';
340
+ import { ComplexSchema } from './complex.zod.js';
341
+ import { ObjectQLComponentSchema } from './objectql.zod.js';
342
+ import { CRUDComponentSchema } from './crud.zod.js';
343
+ import { ThemeComponentSchema } from './theme.zod.js';
344
+ import { ReportComponentSchema } from './reports.zod.js';
345
+ import { BlockComponentSchema } from './blocks.zod.js';
346
+ import { ViewComponentSchema } from './views.zod.js';
347
+
348
+ /**
349
+ * Union of all component schemas.
350
+ * Use this for generic component rendering where the type is determined at runtime.
351
+ */
352
+ export const AnyComponentSchema = z.union([
353
+ AppSchema,
354
+ LayoutSchema,
355
+ FormComponentSchema,
356
+ DataDisplaySchema,
357
+ FeedbackSchema,
358
+ DisclosureSchema,
359
+ OverlaySchema,
360
+ NavigationSchema,
361
+ ComplexSchema,
362
+ ObjectQLComponentSchema,
363
+ CRUDComponentSchema,
364
+ ThemeComponentSchema,
365
+ ReportComponentSchema,
366
+ BlockComponentSchema,
367
+ ViewComponentSchema,
368
+ ]);
369
+
370
+ /**
371
+ * Validate a schema against the AnyComponentSchema
372
+ *
373
+ * @param schema - The schema to validate
374
+ * @returns The validated and typed schema
375
+ * @throws ZodError if validation fails
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * import { validateSchema } from '@object-ui/types/zod';
380
+ *
381
+ * try {
382
+ * const validSchema = validateSchema({
383
+ * type: 'button',
384
+ * label: 'Click Me',
385
+ * });
386
+ * console.log('Valid schema:', validSchema);
387
+ * } catch (error) {
388
+ * console.error('Validation failed:', error);
389
+ * }
390
+ * ```
391
+ */
392
+ export function validateSchema(schema: unknown) {
393
+ return AnyComponentSchema.parse(schema);
394
+ }
395
+
396
+ /**
397
+ * Safely validate a schema without throwing errors
398
+ *
399
+ * @param schema - The schema to validate
400
+ * @returns Object with success boolean and either data or error
401
+ *
402
+ * @example
403
+ * ```typescript
404
+ * import { safeValidateSchema } from '@object-ui/types/zod';
405
+ *
406
+ * const result = safeValidateSchema({
407
+ * type: 'button',
408
+ * label: 'Click Me',
409
+ * });
410
+ *
411
+ * if (result.success) {
412
+ * console.log('Valid schema:', result.data);
413
+ * } else {
414
+ * console.error('Validation errors:', result.error);
415
+ * }
416
+ * ```
417
+ */
418
+ export function safeValidateSchema(schema: unknown) {
419
+ return AnyComponentSchema.safeParse(schema);
420
+ }
421
+
422
+ /**
423
+ * Version information
424
+ */
425
+ export const SCHEMA_VERSION = '1.0.0';
@@ -0,0 +1,262 @@
1
+ /**
2
+ * ObjectUI
3
+ * Copyright (c) 2024-present ObjectStack Inc.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+
9
+ /**
10
+ * @object-ui/types/zod - Layout Component Zod Validators
11
+ *
12
+ * Zod validation schemas for layout and container components.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/layout
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
+
22
+ /**
23
+ * Div Schema - Basic HTML container
24
+ */
25
+ export const DivSchema = BaseSchema.extend({
26
+ type: z.literal('div'),
27
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
28
+ });
29
+
30
+ /**
31
+ * Span Schema - Inline text container
32
+ */
33
+ export const SpanSchema = BaseSchema.extend({
34
+ type: z.literal('span'),
35
+ value: z.string().optional().describe('Text content'),
36
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
37
+ });
38
+
39
+ /**
40
+ * Text Schema - Text display component
41
+ */
42
+ export const TextSchema = BaseSchema.extend({
43
+ type: z.literal('text'),
44
+ value: z.string().optional().describe('Text content'),
45
+ variant: z.enum(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body', 'caption', 'overline'])
46
+ .optional()
47
+ .default('body')
48
+ .describe('Text variant/style'),
49
+ align: z.enum(['left', 'center', 'right', 'justify']).optional().describe('Text alignment'),
50
+ });
51
+
52
+ /**
53
+ * Image Schema - Image component
54
+ */
55
+ export const ImageSchema = BaseSchema.extend({
56
+ type: z.literal('image'),
57
+ src: z.string().describe('Image source URL'),
58
+ alt: z.string().optional().describe('Alt text for accessibility'),
59
+ width: z.union([z.string(), z.number()]).optional().describe('Image width'),
60
+ height: z.union([z.string(), z.number()]).optional().describe('Image height'),
61
+ objectFit: z.enum(['contain', 'cover', 'fill', 'none', 'scale-down']).optional().describe('Object fit property'),
62
+ });
63
+
64
+ /**
65
+ * Icon Schema - Icon component (Lucide icons)
66
+ */
67
+ export const IconSchema = BaseSchema.extend({
68
+ type: z.literal('icon'),
69
+ name: z.string().describe('Icon name (lucide-react)'),
70
+ size: z.number().optional().default(24).describe('Icon size in pixels'),
71
+ color: z.string().optional().describe('Icon color'),
72
+ });
73
+
74
+ /**
75
+ * Separator Schema - Divider component
76
+ */
77
+ export const SeparatorSchema = BaseSchema.extend({
78
+ type: z.literal('separator'),
79
+ orientation: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Separator orientation'),
80
+ decorative: z.boolean().optional().describe('Whether decorative'),
81
+ });
82
+
83
+ /**
84
+ * Container Schema - Generic container component
85
+ */
86
+ export const ContainerSchema = BaseSchema.extend({
87
+ type: z.literal('container'),
88
+ maxWidth: z.union([
89
+ z.enum(['sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', 'full', 'screen']),
90
+ z.boolean(),
91
+ ]).optional().default('lg').describe('Max width constraint'),
92
+ centered: z.boolean().optional().default(true).describe('Center the container'),
93
+ padding: z.number().optional().describe('Padding value'),
94
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
95
+ });
96
+
97
+ /**
98
+ * Flex Schema - Flexbox layout component
99
+ */
100
+ export const FlexSchema = BaseSchema.extend({
101
+ type: z.literal('flex'),
102
+ direction: z.enum(['row', 'col', 'row-reverse', 'col-reverse'])
103
+ .optional()
104
+ .default('row')
105
+ .describe('Flex direction'),
106
+ justify: z.enum(['start', 'end', 'center', 'between', 'around', 'evenly'])
107
+ .optional()
108
+ .default('start')
109
+ .describe('Justify content alignment'),
110
+ align: z.enum(['start', 'end', 'center', 'baseline', 'stretch'])
111
+ .optional()
112
+ .default('center')
113
+ .describe('Align items'),
114
+ gap: z.number().optional().default(2).describe('Gap between items (Tailwind scale 0-8)'),
115
+ wrap: z.boolean().optional().default(false).describe('Allow items to wrap'),
116
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
117
+ });
118
+
119
+ /**
120
+ * Stack Schema - Vertical flex layout (shortcut)
121
+ */
122
+ export const StackSchema = BaseSchema.extend({
123
+ type: z.literal('stack'),
124
+ direction: z.enum(['row', 'col', 'row-reverse', 'col-reverse']).optional(),
125
+ justify: z.enum(['start', 'end', 'center', 'between', 'around', 'evenly']).optional(),
126
+ align: z.enum(['start', 'end', 'center', 'baseline', 'stretch']).optional(),
127
+ gap: z.number().optional(),
128
+ wrap: z.boolean().optional(),
129
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
130
+ });
131
+
132
+ /**
133
+ * Grid Schema - CSS Grid layout component
134
+ */
135
+ export const GridSchema = BaseSchema.extend({
136
+ type: z.literal('grid'),
137
+ columns: z.union([
138
+ z.number(),
139
+ z.record(z.string(), z.number()),
140
+ ]).optional().default(3).describe('Number of columns (responsive)'),
141
+ gap: z.number().optional().default(4).describe('Gap between items (Tailwind scale 0-8)'),
142
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
143
+ });
144
+
145
+ /**
146
+ * Card Schema - Card component
147
+ */
148
+ export const CardSchema = BaseSchema.extend({
149
+ type: z.literal('card'),
150
+ title: z.string().optional().describe('Card title'),
151
+ description: z.string().optional().describe('Card description'),
152
+ header: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card header content'),
153
+ body: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card body content'),
154
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
155
+ footer: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card footer content'),
156
+ variant: z.enum(['default', 'outline', 'ghost']).optional().default('default').describe('Card variant style'),
157
+ hoverable: z.boolean().optional().default(false).describe('Whether the card is hoverable'),
158
+ clickable: z.boolean().optional().default(false).describe('Whether the card is clickable'),
159
+ onClick: z.function().optional().describe('Click handler'),
160
+ });
161
+
162
+ /**
163
+ * Tab Item Schema
164
+ */
165
+ export const TabItemSchema = z.object({
166
+ value: z.string().describe('Unique tab identifier'),
167
+ label: z.string().describe('Tab label'),
168
+ icon: z.string().optional().describe('Tab icon'),
169
+ disabled: z.boolean().optional().describe('Whether tab is disabled'),
170
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Tab content'),
171
+ });
172
+
173
+ /**
174
+ * Tabs Schema - Tabs component
175
+ */
176
+ export const TabsSchema = BaseSchema.extend({
177
+ type: z.literal('tabs'),
178
+ defaultValue: z.string().optional().describe('Default active tab value'),
179
+ value: z.string().optional().describe('Controlled active tab value'),
180
+ orientation: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Tabs orientation'),
181
+ items: z.array(TabItemSchema).describe('Tab items configuration'),
182
+ onValueChange: z.function().optional().describe('Change handler'),
183
+ });
184
+
185
+ /**
186
+ * Scroll Area Schema
187
+ */
188
+ export const ScrollAreaSchema = BaseSchema.extend({
189
+ type: z.literal('scroll-area'),
190
+ height: z.union([z.string(), z.number()]).optional().describe('Height of scroll container'),
191
+ width: z.union([z.string(), z.number()]).optional().describe('Width of scroll container'),
192
+ orientation: z.enum(['vertical', 'horizontal', 'both']).optional().default('vertical').describe('Scrollbar orientation'),
193
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
194
+ });
195
+
196
+ /**
197
+ * Resizable Panel Schema
198
+ */
199
+ export const ResizablePanelSchema = z.object({
200
+ id: z.string().describe('Unique panel identifier'),
201
+ defaultSize: z.number().optional().describe('Default size (percentage 0-100)'),
202
+ minSize: z.number().optional().describe('Minimum size (percentage 0-100)'),
203
+ maxSize: z.number().optional().describe('Maximum size (percentage 0-100)'),
204
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Panel content'),
205
+ });
206
+
207
+ /**
208
+ * Resizable Schema - Resizable panels component
209
+ */
210
+ export const ResizableSchema = BaseSchema.extend({
211
+ type: z.literal('resizable'),
212
+ direction: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Direction of resizable panels'),
213
+ minHeight: z.union([z.string(), z.number()]).optional().describe('Minimum height'),
214
+ withHandle: z.boolean().optional().default(true).describe('Show resize handle'),
215
+ panels: z.array(ResizablePanelSchema).describe('Resizable panels'),
216
+ });
217
+
218
+ /**
219
+ * Aspect Ratio Schema
220
+ */
221
+ export const AspectRatioSchema = BaseSchema.extend({
222
+ type: z.literal('aspect-ratio'),
223
+ ratio: z.number().optional().default(16 / 9).describe('Aspect ratio (width / height)'),
224
+ image: z.string().optional().describe('Image URL to display'),
225
+ alt: z.string().optional().describe('Image alt text'),
226
+ body: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components (alternative to image)'),
227
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
228
+ });
229
+
230
+ /**
231
+ * Page Schema - Top-level page layout
232
+ */
233
+ export const PageSchema = BaseSchema.extend({
234
+ type: z.literal('page'),
235
+ title: z.string().optional().describe('Page title'),
236
+ icon: z.string().optional().describe('Page icon (Lucide icon name)'),
237
+ description: z.string().optional().describe('Page description'),
238
+ body: z.array(SchemaNodeSchema).optional().describe('Main content array'),
239
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Alternative content prop'),
240
+ });
241
+
242
+ /**
243
+ * Layout Schema Union - All layout component schemas
244
+ */
245
+ export const LayoutSchema = z.union([
246
+ DivSchema,
247
+ SpanSchema,
248
+ TextSchema,
249
+ ImageSchema,
250
+ IconSchema,
251
+ SeparatorSchema,
252
+ ContainerSchema,
253
+ FlexSchema,
254
+ StackSchema,
255
+ GridSchema,
256
+ CardSchema,
257
+ TabsSchema,
258
+ ScrollAreaSchema,
259
+ ResizableSchema,
260
+ AspectRatioSchema,
261
+ PageSchema,
262
+ ]);