@object-ui/types 0.3.1 → 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 (141) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
@@ -0,0 +1,259 @@
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 - CRUD Component Zod Validators
11
+ *
12
+ * Zod validation schemas for CRUD operations.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * Enhanced in Phase 2 with ajax, confirm, dialog actions, chaining, and conditional execution.
16
+ *
17
+ * @module zod/crud
18
+ * @packageDocumentation
19
+ */
20
+
21
+ import { z } from 'zod';
22
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
23
+
24
+ /**
25
+ * Action Execution Mode Schema
26
+ */
27
+ export const ActionExecutionModeSchema = z.enum(['sequential', 'parallel']).describe('Action execution mode for chaining');
28
+
29
+ /**
30
+ * Action Callback Schema
31
+ */
32
+ export const ActionCallbackSchema = z.object({
33
+ type: z.enum(['toast', 'message', 'redirect', 'reload', 'custom', 'ajax', 'dialog']).describe('Callback type'),
34
+ message: z.string().optional().describe('Message to display'),
35
+ url: z.string().optional().describe('Redirect URL'),
36
+ api: z.string().optional().describe('API endpoint for ajax callback'),
37
+ method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().describe('HTTP method for ajax callback'),
38
+ dialog: SchemaNodeSchema.optional().describe('Dialog schema to open'),
39
+ handler: z.string().optional().describe('Custom callback handler expression'),
40
+ });
41
+
42
+ /**
43
+ * Action Condition Schema
44
+ */
45
+ export const ActionConditionSchema: z.ZodType<any> = z.lazy(() => z.object({
46
+ expression: z.string().describe('Condition expression'),
47
+ then: z.union([ActionSchema, z.array(ActionSchema)]).optional().describe('Action to execute if condition is true'),
48
+ else: z.union([ActionSchema, z.array(ActionSchema)]).optional().describe('Action to execute if condition is false'),
49
+ }));
50
+
51
+ /**
52
+ * Action Schema - Enhanced with Phase 2 features
53
+ */
54
+ export const ActionSchema: z.ZodType<any> = z.lazy(() => BaseSchema.extend({
55
+ type: z.literal('action'),
56
+ label: z.string().describe('Action label'),
57
+ level: z.enum(['primary', 'secondary', 'success', 'warning', 'danger', 'info', 'default']).optional().default('default').describe('Action type/level'),
58
+ icon: z.string().optional().describe('Icon to display (lucide-react icon name)'),
59
+ variant: z.enum(['default', 'outline', 'ghost', 'link']).optional().describe('Action variant'),
60
+ disabled: z.boolean().optional().describe('Whether action is disabled'),
61
+ actionType: z.enum(['button', 'link', 'dropdown', 'ajax', 'confirm', 'dialog']).optional().describe('Action type'),
62
+ api: z.string().optional().describe('API endpoint to call (for ajax actions)'),
63
+ method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().default('POST').describe('HTTP method'),
64
+ data: z.any().optional().describe('Request body/data'),
65
+ headers: z.record(z.string(), z.string()).optional().describe('Request headers'),
66
+ confirm: z.object({
67
+ title: z.string().optional().describe('Confirmation title'),
68
+ message: z.string().optional().describe('Confirmation message'),
69
+ confirmText: z.string().optional().describe('Confirm button text'),
70
+ cancelText: z.string().optional().describe('Cancel button text'),
71
+ confirmVariant: z.enum(['default', 'destructive', 'outline', 'secondary', 'ghost']).optional().describe('Confirm button variant'),
72
+ }).optional().describe('Confirmation dialog configuration (for confirm actions)'),
73
+ confirmText: z.string().optional().describe('Legacy confirmation message (deprecated - use confirm object instead)'),
74
+ dialog: z.object({
75
+ title: z.string().optional().describe('Dialog title'),
76
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Dialog content'),
77
+ size: z.enum(['sm', 'default', 'lg', 'xl', 'full']).optional().describe('Dialog size'),
78
+ actions: z.array(ActionSchema).optional().describe('Dialog actions'),
79
+ }).optional().describe('Dialog configuration (for dialog actions)'),
80
+ successMessage: z.string().optional().describe('Success message after execution'),
81
+ errorMessage: z.string().optional().describe('Error message on failure'),
82
+ onSuccess: ActionCallbackSchema.optional().describe('Success callback'),
83
+ onFailure: ActionCallbackSchema.optional().describe('Failure callback'),
84
+ chain: z.array(ActionSchema).optional().describe('Action chaining - actions to execute after this one'),
85
+ chainMode: ActionExecutionModeSchema.optional().default('sequential').describe('Chain execution mode'),
86
+ condition: ActionConditionSchema.optional().describe('Conditional execution'),
87
+ reload: z.boolean().optional().default(true).describe('Whether to reload data after action'),
88
+ close: z.boolean().optional().default(true).describe('Whether to close dialog/modal after action'),
89
+ onClick: z.any().optional().describe('Custom click handler'),
90
+ redirect: z.string().optional().describe('Redirect URL after success'),
91
+ tracking: z.object({
92
+ enabled: z.boolean().optional().describe('Enable tracking'),
93
+ event: z.string().optional().describe('Event name'),
94
+ metadata: z.record(z.string(), z.any()).optional().describe('Additional metadata'),
95
+ }).optional().describe('Action logging/tracking'),
96
+ timeout: z.number().optional().describe('Timeout in milliseconds'),
97
+ retry: z.object({
98
+ maxAttempts: z.number().optional().describe('Maximum retry attempts'),
99
+ delay: z.number().optional().describe('Delay between retries (in ms)'),
100
+ }).optional().describe('Retry configuration'),
101
+ }));
102
+
103
+ /**
104
+ * CRUD Operation Schema
105
+ */
106
+ export const CRUDOperationSchema = z.object({
107
+ type: z.enum(['create', 'read', 'update', 'delete', 'export', 'import', 'custom']).describe('Operation type'),
108
+ label: z.string().optional().describe('Operation label'),
109
+ icon: z.string().optional().describe('Operation icon'),
110
+ enabled: z.boolean().optional().default(true).describe('Whether operation is enabled'),
111
+ api: z.string().optional().describe('API endpoint for this operation'),
112
+ method: z.enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH']).optional().describe('HTTP method'),
113
+ confirmText: z.string().optional().describe('Confirmation message'),
114
+ successMessage: z.string().optional().describe('Success message'),
115
+ visibleOn: z.string().optional().describe('Visibility condition'),
116
+ disabledOn: z.string().optional().describe('Disabled condition'),
117
+ });
118
+
119
+ /**
120
+ * CRUD Filter Schema
121
+ */
122
+ export const CRUDFilterSchema = z.object({
123
+ name: z.string().describe('Filter name (field name)'),
124
+ label: z.string().optional().describe('Filter label'),
125
+ type: z.enum(['input', 'select', 'date-picker', 'date-range', 'number-range']).optional().describe('Filter type'),
126
+ operator: z.enum(['equals', 'contains', 'startsWith', 'endsWith', 'gt', 'gte', 'lt', 'lte', 'between', 'in']).optional().default('equals').describe('Filter operator'),
127
+ options: z.array(z.object({ label: z.string(), value: z.union([z.string(), z.number()]) })).optional().describe('Options for select filter'),
128
+ placeholder: z.string().optional().describe('Placeholder text'),
129
+ defaultValue: z.any().optional().describe('Default value'),
130
+ });
131
+
132
+ /**
133
+ * CRUD Toolbar Schema
134
+ */
135
+ export const CRUDToolbarSchema = z.object({
136
+ showCreate: z.boolean().optional().default(true).describe('Show create button'),
137
+ showRefresh: z.boolean().optional().default(true).describe('Show refresh button'),
138
+ showExport: z.boolean().optional().default(false).describe('Show export button'),
139
+ showImport: z.boolean().optional().default(false).describe('Show import button'),
140
+ showFilter: z.boolean().optional().default(true).describe('Show filter toggle'),
141
+ showSearch: z.boolean().optional().default(true).describe('Show search box'),
142
+ actions: z.array(ActionSchema).optional().describe('Custom actions'),
143
+ });
144
+
145
+ /**
146
+ * CRUD Pagination Schema
147
+ */
148
+ export const CRUDPaginationSchema = z.object({
149
+ enabled: z.boolean().optional().default(true).describe('Whether pagination is enabled'),
150
+ pageSize: z.number().optional().default(10).describe('Default page size'),
151
+ pageSizeOptions: z.array(z.number()).optional().default([10, 20, 50, 100]).describe('Page size options'),
152
+ showTotal: z.boolean().optional().default(true).describe('Show total count'),
153
+ showSizeChanger: z.boolean().optional().default(true).describe('Show page size selector'),
154
+ });
155
+
156
+ /**
157
+ * CRUD Schema
158
+ */
159
+ export const CRUDSchema = BaseSchema.extend({
160
+ type: z.literal('crud'),
161
+ title: z.string().optional().describe('CRUD title'),
162
+ resource: z.string().optional().describe('Resource name (singular)'),
163
+ api: z.string().optional().describe('API endpoint for list/search'),
164
+ columns: z.array(z.any()).describe('Table columns configuration'),
165
+ fields: z.array(z.any()).optional().describe('Form fields for create/edit'),
166
+ operations: z.record(z.string(), z.union([z.boolean(), CRUDOperationSchema])).optional().describe('Enabled operations'),
167
+ toolbar: CRUDToolbarSchema.optional().describe('Toolbar configuration'),
168
+ filters: z.array(CRUDFilterSchema).optional().describe('Filter configuration'),
169
+ pagination: CRUDPaginationSchema.optional().describe('Pagination configuration'),
170
+ defaultSort: z.string().optional().describe('Default sort field'),
171
+ defaultSortOrder: z.enum(['asc', 'desc']).optional().default('asc').describe('Default sort order'),
172
+ selectable: z.union([z.boolean(), z.enum(['single', 'multiple'])]).optional().describe('Row selection mode'),
173
+ batchActions: z.array(ActionSchema).optional().describe('Batch actions for selected rows'),
174
+ rowActions: z.array(ActionSchema).optional().describe('Row actions (displayed in each row)'),
175
+ emptyState: SchemaNodeSchema.optional().describe('Custom empty state'),
176
+ loading: z.boolean().optional().default(true).describe('Whether to show loading state'),
177
+ loadingComponent: SchemaNodeSchema.optional().describe('Custom loading component'),
178
+ mode: z.enum(['table', 'grid', 'list', 'kanban']).optional().default('table').describe('Table layout mode'),
179
+ gridColumns: z.number().optional().default(3).describe('Grid columns (for grid mode)'),
180
+ cardTemplate: SchemaNodeSchema.optional().describe('Card template (for grid/list mode)'),
181
+ kanbanColumns: z.array(z.object({
182
+ id: z.string(),
183
+ title: z.string(),
184
+ color: z.string().optional(),
185
+ })).optional().describe('Kanban columns (for kanban mode)'),
186
+ kanbanGroupField: z.string().optional().describe('Kanban group field'),
187
+ });
188
+
189
+ /**
190
+ * Detail Schema
191
+ */
192
+ export const DetailSchema = BaseSchema.extend({
193
+ type: z.literal('detail'),
194
+ title: z.string().optional().describe('Detail title'),
195
+ api: z.string().optional().describe('API endpoint to fetch detail data'),
196
+ resourceId: z.union([z.string(), z.number()]).optional().describe('Resource ID to display'),
197
+ groups: z.array(z.object({
198
+ title: z.string().optional(),
199
+ description: z.string().optional(),
200
+ fields: z.array(z.object({
201
+ name: z.string(),
202
+ label: z.string().optional(),
203
+ type: z.enum(['text', 'image', 'link', 'badge', 'date', 'datetime', 'json', 'html', 'custom']).optional(),
204
+ format: z.string().optional(),
205
+ render: SchemaNodeSchema.optional(),
206
+ })),
207
+ })).optional().describe('Field groups for organized display'),
208
+ actions: z.array(ActionSchema).optional().describe('Actions available in detail view'),
209
+ tabs: z.array(z.object({
210
+ key: z.string(),
211
+ label: z.string(),
212
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]),
213
+ })).optional().describe('Tabs for additional content'),
214
+ showBack: z.boolean().optional().default(true).describe('Show back button'),
215
+ onBack: z.any().optional().describe('Custom back action'),
216
+ loading: z.boolean().optional().default(true).describe('Whether to show loading state'),
217
+ });
218
+
219
+ /**
220
+ * CRUD Dialog Schema
221
+ */
222
+ export const CRUDDialogSchema = BaseSchema.extend({
223
+ type: z.literal('crud-dialog'),
224
+ title: z.string().optional().describe('Dialog title'),
225
+ description: z.string().optional().describe('Dialog description'),
226
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Dialog content'),
227
+ size: z.enum(['sm', 'default', 'lg', 'xl', 'full']).optional().default('default').describe('Dialog size'),
228
+ actions: z.array(ActionSchema).optional().describe('Dialog actions/buttons'),
229
+ open: z.boolean().optional().describe('Whether dialog is open'),
230
+ onClose: z.any().optional().describe('Close handler'),
231
+ closeOnOutsideClick: z.boolean().optional().default(true).describe('Whether clicking outside closes dialog'),
232
+ closeOnEscape: z.boolean().optional().default(true).describe('Whether pressing Escape closes dialog'),
233
+ showClose: z.boolean().optional().default(true).describe('Show close button'),
234
+ });
235
+
236
+ /**
237
+ * Union of all CRUD schemas
238
+ */
239
+ export const CRUDComponentSchema = z.union([
240
+ ActionSchema,
241
+ CRUDSchema,
242
+ DetailSchema,
243
+ CRUDDialogSchema,
244
+ ]);
245
+
246
+ /**
247
+ * Export type inference helpers
248
+ */
249
+ export type ActionExecutionModeSchemaType = z.infer<typeof ActionExecutionModeSchema>;
250
+ export type ActionCallbackSchemaType = z.infer<typeof ActionCallbackSchema>;
251
+ export type ActionConditionSchemaType = z.infer<typeof ActionConditionSchema>;
252
+ export type ActionSchemaType = z.infer<typeof ActionSchema>;
253
+ export type CRUDOperationSchemaType = z.infer<typeof CRUDOperationSchema>;
254
+ export type CRUDFilterSchemaType = z.infer<typeof CRUDFilterSchema>;
255
+ export type CRUDToolbarSchemaType = z.infer<typeof CRUDToolbarSchema>;
256
+ export type CRUDPaginationSchemaType = z.infer<typeof CRUDPaginationSchema>;
257
+ export type CRUDSchemaType = z.infer<typeof CRUDSchema>;
258
+ export type DetailSchemaType = z.infer<typeof DetailSchema>;
259
+ export type CRUDDialogSchemaType = z.infer<typeof CRUDDialogSchema>;
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Alert Schema - Alert/notification component
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Accordion Item Schema
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Loading Schema - Loading indicator component
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Select Option Schema
@@ -34,6 +34,15 @@
34
34
  * @packageDocumentation
35
35
  */
36
36
 
37
+ // ============================================================================
38
+ // Application - Global Configuration
39
+ // ============================================================================
40
+ export {
41
+ AppSchema,
42
+ AppActionSchema,
43
+ MenuItemSchema as AppMenuItemSchema,
44
+ } from './app.zod.js';
45
+
37
46
  // ============================================================================
38
47
  // Base Schema - Foundation
39
48
  // ============================================================================
@@ -46,7 +55,7 @@ export {
46
55
  HTMLAttributesSchema,
47
56
  EventHandlersSchema,
48
57
  StylePropsSchema,
49
- } from './base.zod';
58
+ } from './base.zod.js';
50
59
 
51
60
  // ============================================================================
52
61
  // Layout Components - Structure & Organization
@@ -69,9 +78,13 @@ export {
69
78
  ResizablePanelSchema,
70
79
  ResizableSchema,
71
80
  AspectRatioSchema,
81
+ PageRegionWidthSchema,
82
+ PageRegionSchema,
83
+ PageVariableSchema,
84
+ PageTypeSchema,
72
85
  PageSchema,
73
86
  LayoutSchema,
74
- } from './layout.zod';
87
+ } from './layout.zod.js';
75
88
 
76
89
  // ============================================================================
77
90
  // Form Components - User Input & Interaction
@@ -103,7 +116,7 @@ export {
103
116
  FormFieldSchema,
104
117
  FormSchema,
105
118
  FormComponentSchema,
106
- } from './form.zod';
119
+ } from './form.zod.js';
107
120
 
108
121
  // ============================================================================
109
122
  // Data Display Components - Information Presentation
@@ -129,7 +142,7 @@ export {
129
142
  KbdSchema,
130
143
  HtmlSchema,
131
144
  DataDisplaySchema,
132
- } from './data-display.zod';
145
+ } from './data-display.zod.js';
133
146
 
134
147
  // ============================================================================
135
148
  // Feedback Components - Status & Progress Indication
@@ -144,7 +157,7 @@ export {
144
157
  EmptySchema,
145
158
  SonnerSchema,
146
159
  FeedbackSchema,
147
- } from './feedback.zod';
160
+ } from './feedback.zod.js';
148
161
 
149
162
  // ============================================================================
150
163
  // Disclosure Components - Collapsible Content
@@ -156,7 +169,7 @@ export {
156
169
  ToggleGroupItemSchema,
157
170
  ToggleGroupSchema,
158
171
  DisclosureSchema,
159
- } from './disclosure.zod';
172
+ } from './disclosure.zod.js';
160
173
 
161
174
  // ============================================================================
162
175
  // Overlay Components - Modals & Popovers
@@ -175,7 +188,7 @@ export {
175
188
  MenubarMenuSchema,
176
189
  MenubarSchema,
177
190
  OverlaySchema,
178
- } from './overlay.zod';
191
+ } from './overlay.zod.js';
179
192
 
180
193
  // ============================================================================
181
194
  // Navigation Components - Menus & Navigation
@@ -190,7 +203,7 @@ export {
190
203
  ButtonGroupButtonSchema,
191
204
  ButtonGroupSchema,
192
205
  NavigationSchema,
193
- } from './navigation.zod';
206
+ } from './navigation.zod.js';
194
207
 
195
208
  // ============================================================================
196
209
  // Complex Components - Advanced/Composite Components
@@ -215,7 +228,7 @@ export {
215
228
  DashboardWidgetSchema,
216
229
  DashboardSchema,
217
230
  ComplexSchema,
218
- } from './complex.zod';
231
+ } from './complex.zod.js';
219
232
 
220
233
  // ============================================================================
221
234
  // ObjectQL Components - Smart Data Components
@@ -238,28 +251,117 @@ export {
238
251
  ObjectChartSchema,
239
252
  ListViewSchema,
240
253
  ObjectQLComponentSchema,
241
- } from './objectql.zod';
254
+ } from './objectql.zod.js';
255
+
256
+ // ============================================================================
257
+ // CRUD Components - Create, Read, Update, Delete Operations
258
+ // ============================================================================
259
+ export {
260
+ ActionExecutionModeSchema,
261
+ ActionCallbackSchema,
262
+ ActionConditionSchema,
263
+ ActionSchema,
264
+ CRUDOperationSchema,
265
+ CRUDFilterSchema,
266
+ CRUDToolbarSchema,
267
+ CRUDPaginationSchema,
268
+ CRUDSchema,
269
+ DetailSchema,
270
+ CRUDDialogSchema,
271
+ CRUDComponentSchema,
272
+ } from './crud.zod.js';
273
+
274
+ // ============================================================================
275
+ // Phase 2 Schemas - Theme, Reports, Blocks, and Views
276
+ // ============================================================================
277
+ export {
278
+ ColorPaletteSchema,
279
+ TypographySchema,
280
+ SpacingSchema,
281
+ SpacingScaleSchema,
282
+ BorderRadiusSchema,
283
+ ShadowSchema,
284
+ BreakpointsSchema,
285
+ AnimationSchema,
286
+ ZIndexSchema,
287
+ ThemeLogoSchema,
288
+ ThemeModeSchema,
289
+ ThemeDefinitionSchema,
290
+ ThemeSchema,
291
+ ThemeComponentSchema,
292
+ ThemeUnionSchema,
293
+ ThemeSwitcherSchema,
294
+ ThemePreviewSchema,
295
+ } from './theme.zod.js';
296
+
297
+ export {
298
+ ReportExportFormatSchema,
299
+ ReportScheduleFrequencySchema,
300
+ ReportAggregationTypeSchema,
301
+ ReportFieldSchema,
302
+ ReportFilterSchema,
303
+ ReportGroupBySchema,
304
+ ReportSectionSchema,
305
+ ReportScheduleSchema,
306
+ ReportExportConfigSchema,
307
+ ReportSchema,
308
+ ReportBuilderSchema,
309
+ ReportViewerSchema,
310
+ ReportComponentSchema,
311
+ } from './reports.zod.js';
312
+
313
+ export {
314
+ BlockVariableSchema,
315
+ BlockSlotSchema,
316
+ BlockMetadataSchema,
317
+ BlockSchema,
318
+ BlockLibraryItemSchema,
319
+ BlockLibrarySchema,
320
+ BlockEditorSchema,
321
+ BlockInstanceSchema,
322
+ ComponentSchema,
323
+ BlockComponentSchema,
324
+ } from './blocks.zod.js';
325
+
326
+ export {
327
+ ViewTypeSchema,
328
+ DetailViewFieldSchema,
329
+ DetailViewSectionSchema,
330
+ DetailViewTabSchema,
331
+ DetailViewSchema,
332
+ ViewSwitcherSchema,
333
+ FilterUISchema,
334
+ SortUISchema,
335
+ ViewComponentSchema,
336
+ } from './views.zod.js';
242
337
 
243
338
  // ============================================================================
244
339
  // Union Types - All Component Schemas
245
340
  // ============================================================================
246
341
 
247
342
  import { z } from 'zod';
248
- import { LayoutSchema } from './layout.zod';
249
- import { FormComponentSchema } from './form.zod';
250
- import { DataDisplaySchema } from './data-display.zod';
251
- import { FeedbackSchema } from './feedback.zod';
252
- import { DisclosureSchema } from './disclosure.zod';
253
- import { OverlaySchema } from './overlay.zod';
254
- import { NavigationSchema } from './navigation.zod';
255
- import { ComplexSchema } from './complex.zod';
256
- import { ObjectQLComponentSchema } from './objectql.zod';
343
+ import { AppSchema } from './app.zod.js';
344
+ import { LayoutSchema } from './layout.zod.js';
345
+ import { FormComponentSchema } from './form.zod.js';
346
+ import { DataDisplaySchema } from './data-display.zod.js';
347
+ import { FeedbackSchema } from './feedback.zod.js';
348
+ import { DisclosureSchema } from './disclosure.zod.js';
349
+ import { OverlaySchema } from './overlay.zod.js';
350
+ import { NavigationSchema } from './navigation.zod.js';
351
+ import { ComplexSchema } from './complex.zod.js';
352
+ import { ObjectQLComponentSchema } from './objectql.zod.js';
353
+ import { CRUDComponentSchema } from './crud.zod.js';
354
+ import { ThemeUnionSchema } from './theme.zod.js';
355
+ import { ReportComponentSchema } from './reports.zod.js';
356
+ import { BlockComponentSchema } from './blocks.zod.js';
357
+ import { ViewComponentSchema } from './views.zod.js';
257
358
 
258
359
  /**
259
360
  * Union of all component schemas.
260
361
  * Use this for generic component rendering where the type is determined at runtime.
261
362
  */
262
363
  export const AnyComponentSchema = z.union([
364
+ AppSchema,
263
365
  LayoutSchema,
264
366
  FormComponentSchema,
265
367
  DataDisplaySchema,
@@ -269,8 +371,65 @@ export const AnyComponentSchema = z.union([
269
371
  NavigationSchema,
270
372
  ComplexSchema,
271
373
  ObjectQLComponentSchema,
374
+ CRUDComponentSchema,
375
+ ThemeUnionSchema,
376
+ ReportComponentSchema,
377
+ BlockComponentSchema,
378
+ ViewComponentSchema,
272
379
  ]);
273
380
 
381
+ /**
382
+ * Validate a schema against the AnyComponentSchema
383
+ *
384
+ * @param schema - The schema to validate
385
+ * @returns The validated and typed schema
386
+ * @throws ZodError if validation fails
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * import { validateSchema } from '@object-ui/types/zod';
391
+ *
392
+ * try {
393
+ * const validSchema = validateSchema({
394
+ * type: 'button',
395
+ * label: 'Click Me',
396
+ * });
397
+ * console.log('Valid schema:', validSchema);
398
+ * } catch (error) {
399
+ * console.error('Validation failed:', error);
400
+ * }
401
+ * ```
402
+ */
403
+ export function validateSchema(schema: unknown) {
404
+ return AnyComponentSchema.parse(schema);
405
+ }
406
+
407
+ /**
408
+ * Safely validate a schema without throwing errors
409
+ *
410
+ * @param schema - The schema to validate
411
+ * @returns Object with success boolean and either data or error
412
+ *
413
+ * @example
414
+ * ```typescript
415
+ * import { safeValidateSchema } from '@object-ui/types/zod';
416
+ *
417
+ * const result = safeValidateSchema({
418
+ * type: 'button',
419
+ * label: 'Click Me',
420
+ * });
421
+ *
422
+ * if (result.success) {
423
+ * console.log('Valid schema:', result.data);
424
+ * } else {
425
+ * console.error('Validation errors:', result.error);
426
+ * }
427
+ * ```
428
+ */
429
+ export function safeValidateSchema(schema: unknown) {
430
+ return AnyComponentSchema.safeParse(schema);
431
+ }
432
+
274
433
  /**
275
434
  * Version information
276
435
  */
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Div Schema - Basic HTML container
@@ -227,16 +227,54 @@ export const AspectRatioSchema = BaseSchema.extend({
227
227
  children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
228
228
  });
229
229
 
230
+ /**
231
+ * Page Region Width Schema
232
+ */
233
+ export const PageRegionWidthSchema = z.enum(['small', 'medium', 'large', 'full']);
234
+
235
+ /**
236
+ * Page Region Schema
237
+ */
238
+ export const PageRegionSchema = z.object({
239
+ name: z.string().describe('Region name (e.g. "sidebar", "main", "header")'),
240
+ type: z.enum(['header', 'sidebar', 'main', 'footer', 'aside']).optional().describe('Semantic region type'),
241
+ width: z.union([PageRegionWidthSchema, z.string()]).optional().describe('Region width'),
242
+ components: z.array(SchemaNodeSchema).describe('Components in this region'),
243
+ className: z.string().optional().describe('CSS class overrides'),
244
+ });
245
+
246
+ /**
247
+ * Page Variable Schema
248
+ */
249
+ export const PageVariableSchema = z.object({
250
+ name: z.string().describe('Variable name'),
251
+ type: z.enum(['string', 'number', 'boolean', 'object', 'array']).optional().default('string').describe('Variable type'),
252
+ defaultValue: z.any().optional().describe('Default value'),
253
+ });
254
+
255
+ /**
256
+ * Page Type Schema
257
+ */
258
+ export const PageTypeSchema = z.enum(['record', 'home', 'app', 'utility']);
259
+
230
260
  /**
231
261
  * Page Schema - Top-level page layout
262
+ * Aligned with @objectstack/spec PageSchema
232
263
  */
233
264
  export const PageSchema = BaseSchema.extend({
234
265
  type: z.literal('page'),
235
266
  title: z.string().optional().describe('Page title'),
236
267
  icon: z.string().optional().describe('Page icon (Lucide icon name)'),
237
268
  description: z.string().optional().describe('Page description'),
269
+ pageType: PageTypeSchema.optional().describe('Page type (record, home, app, utility)'),
270
+ object: z.string().optional().describe('Bound object name (for record pages)'),
271
+ template: z.string().optional().default('default').describe('Layout template name'),
272
+ variables: z.array(PageVariableSchema).optional().describe('Local page state variables'),
273
+ regions: z.array(PageRegionSchema).optional().describe('Page layout regions'),
238
274
  body: z.array(SchemaNodeSchema).optional().describe('Main content array'),
239
275
  children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Alternative content prop'),
276
+ isDefault: z.boolean().optional().default(false).describe('Whether this is the default page'),
277
+ assignedProfiles: z.array(z.string()).optional().describe('Profiles that can access this page'),
240
278
  });
241
279
 
242
280
  /**
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Nav Link Schema