@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
@@ -17,15 +17,17 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema } from './base.zod';
20
+ import { BaseSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * HTTP Method Schema
24
+ * Mirrors @objectstack/spec/ui HttpMethodSchema.
24
25
  */
25
26
  export const HttpMethodSchema = z.enum(['GET', 'POST', 'PUT', 'PATCH', 'DELETE']);
26
27
 
27
28
  /**
28
29
  * HTTP Request Schema
30
+ * Mirrors @objectstack/spec/ui HttpRequestSchema.
29
31
  */
30
32
  export const HttpRequestSchema = z.object({
31
33
  url: z.string().describe('API endpoint URL'),
@@ -37,6 +39,7 @@ export const HttpRequestSchema = z.object({
37
39
 
38
40
  /**
39
41
  * View Data Source Schema
42
+ * Mirrors @objectstack/spec/ui ViewDataSchema.
40
43
  */
41
44
  export const ViewDataSchema = z.union([
42
45
  z.object({
@@ -56,6 +59,7 @@ export const ViewDataSchema = z.union([
56
59
 
57
60
  /**
58
61
  * List Column Schema
62
+ * Mirrors @objectstack/spec/ui ListColumnSchema.
59
63
  */
60
64
  export const ListColumnSchema = z.object({
61
65
  field: z.string().describe('Field name'),
@@ -67,10 +71,13 @@ export const ListColumnSchema = z.object({
67
71
  resizable: z.boolean().optional().describe('Allow resizing'),
68
72
  wrap: z.boolean().optional().describe('Allow text wrapping'),
69
73
  type: z.string().optional().describe('Renderer type override'),
74
+ link: z.boolean().optional().describe('Functions as the primary navigation link (triggers View navigation)'),
75
+ action: z.string().optional().describe('Registered Action ID to execute when clicked'),
70
76
  });
71
77
 
72
78
  /**
73
79
  * Selection Config Schema
80
+ * Mirrors @objectstack/spec/ui SelectionConfigSchema.
74
81
  */
75
82
  export const SelectionConfigSchema = z.object({
76
83
  type: z.enum(['none', 'single', 'multiple']).optional().describe('Selection mode'),
@@ -78,6 +85,7 @@ export const SelectionConfigSchema = z.object({
78
85
 
79
86
  /**
80
87
  * Pagination Config Schema
88
+ * Mirrors @objectstack/spec/ui PaginationConfigSchema.
81
89
  */
82
90
  export const PaginationConfigSchema = z.object({
83
91
  pageSize: z.number().optional().describe('Page size'),
@@ -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
  * Dialog Schema - Dialog/modal component
@@ -0,0 +1,183 @@
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 - Report Schema Zod Validators
11
+ *
12
+ * Zod validation schemas for report configuration.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/reports
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
+ import { ChartSchema } from './data-display.zod.js';
22
+
23
+ /**
24
+ * Report Export Format Schema
25
+ */
26
+ export const ReportExportFormatSchema = z.enum(['pdf', 'excel', 'csv', 'json', 'html']).describe('Report export format');
27
+
28
+ /**
29
+ * Report Schedule Frequency Schema
30
+ */
31
+ export const ReportScheduleFrequencySchema = z.enum(['once', 'daily', 'weekly', 'monthly', 'quarterly', 'yearly']).describe('Report schedule frequency');
32
+
33
+ /**
34
+ * Report Aggregation Type Schema
35
+ */
36
+ export const ReportAggregationTypeSchema = z.enum(['sum', 'avg', 'min', 'max', 'count', 'distinct']).describe('Report aggregation type');
37
+
38
+ /**
39
+ * Report Field Schema
40
+ */
41
+ export const ReportFieldSchema = z.object({
42
+ name: z.string().describe('Field name/identifier'),
43
+ label: z.string().optional().describe('Display label'),
44
+ type: z.enum(['string', 'number', 'date', 'boolean']).optional().describe('Field type'),
45
+ aggregation: ReportAggregationTypeSchema.optional().describe('Aggregation function'),
46
+ format: z.string().optional().describe('Format string'),
47
+ showInSummary: z.boolean().optional().describe('Show in summary'),
48
+ sortOrder: z.number().optional().describe('Sort order'),
49
+ });
50
+
51
+ /**
52
+ * Report Filter Schema
53
+ */
54
+ export const ReportFilterSchema = z.object({
55
+ field: z.string().describe('Field to filter on'),
56
+ operator: z.enum(['equals', 'not_equals', 'contains', 'greater_than', 'less_than', 'between', 'in', 'not_in']).describe('Filter operator'),
57
+ value: z.any().optional().describe('Filter value'),
58
+ values: z.array(z.any()).optional().describe('Multiple values (for "in" operator)'),
59
+ });
60
+
61
+ /**
62
+ * Report Group By Schema
63
+ */
64
+ export const ReportGroupBySchema = z.object({
65
+ field: z.string().describe('Field to group by'),
66
+ label: z.string().optional().describe('Display label'),
67
+ sort: z.enum(['asc', 'desc']).optional().describe('Sort direction'),
68
+ });
69
+
70
+ /**
71
+ * Report Section Schema
72
+ */
73
+ export const ReportSectionSchema = z.object({
74
+ type: z.enum(['header', 'summary', 'chart', 'table', 'text', 'page-break']).describe('Section type'),
75
+ title: z.string().optional().describe('Section title'),
76
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Section content'),
77
+ chart: ChartSchema.optional().describe('Chart configuration (for type="chart")'),
78
+ columns: z.array(ReportFieldSchema).optional().describe('Columns to display (for type="table")'),
79
+ text: z.string().optional().describe('Text content (for type="text")'),
80
+ visible: z.union([z.boolean(), z.string()]).optional().describe('Visibility condition'),
81
+ });
82
+
83
+ /**
84
+ * Report Schedule Schema
85
+ */
86
+ export const ReportScheduleSchema = z.object({
87
+ enabled: z.boolean().optional().describe('Schedule enabled'),
88
+ frequency: ReportScheduleFrequencySchema.optional().describe('Frequency'),
89
+ dayOfWeek: z.number().optional().describe('Specific day of week (for weekly)'),
90
+ dayOfMonth: z.number().optional().describe('Specific day of month (for monthly)'),
91
+ time: z.string().optional().describe('Time to run (HH:mm format)'),
92
+ timezone: z.string().optional().describe('Timezone'),
93
+ recipients: z.array(z.string()).optional().describe('Email recipients'),
94
+ subject: z.string().optional().describe('Email subject'),
95
+ body: z.string().optional().describe('Email body'),
96
+ formats: z.array(ReportExportFormatSchema).optional().describe('Export formats to attach'),
97
+ });
98
+
99
+ /**
100
+ * Report Export Config Schema
101
+ */
102
+ export const ReportExportConfigSchema = z.object({
103
+ format: ReportExportFormatSchema.describe('Export format'),
104
+ filename: z.string().optional().describe('Filename template'),
105
+ includeHeaders: z.boolean().optional().describe('Include headers'),
106
+ orientation: z.enum(['portrait', 'landscape']).optional().describe('Page orientation (for PDF)'),
107
+ pageSize: z.enum(['A4', 'A3', 'Letter', 'Legal']).optional().describe('Page size (for PDF)'),
108
+ options: z.record(z.string(), z.any()).optional().describe('Custom options'),
109
+ });
110
+
111
+ /**
112
+ * Report Schema
113
+ */
114
+ export const ReportSchema = BaseSchema.extend({
115
+ type: z.literal('report'),
116
+ title: z.string().optional().describe('Report title'),
117
+ description: z.string().optional().describe('Report description'),
118
+ dataSource: z.any().optional().describe('Data source configuration'),
119
+ fields: z.array(ReportFieldSchema).optional().describe('Report fields'),
120
+ filters: z.array(ReportFilterSchema).optional().describe('Report filters'),
121
+ groupBy: z.array(ReportGroupBySchema).optional().describe('Group by configuration'),
122
+ sections: z.array(ReportSectionSchema).optional().describe('Report sections'),
123
+ schedule: ReportScheduleSchema.optional().describe('Schedule configuration'),
124
+ defaultExportFormat: ReportExportFormatSchema.optional().describe('Default export format'),
125
+ exportConfigs: z.record(z.string(), ReportExportConfigSchema).optional().describe('Export configurations'),
126
+ showExportButtons: z.boolean().optional().describe('Show export buttons'),
127
+ showPrintButton: z.boolean().optional().describe('Show print button'),
128
+ showScheduleButton: z.boolean().optional().describe('Show schedule button'),
129
+ refreshInterval: z.number().optional().describe('Auto-refresh interval (in seconds)'),
130
+ loading: z.boolean().optional().describe('Loading state'),
131
+ data: z.array(z.any()).optional().describe('Report data'),
132
+ });
133
+
134
+ /**
135
+ * Report Builder Schema
136
+ */
137
+ export const ReportBuilderSchema = BaseSchema.extend({
138
+ type: z.literal('report-builder'),
139
+ report: ReportSchema.optional().describe('Initial report configuration'),
140
+ dataSources: z.array(z.any()).optional().describe('Available data sources'),
141
+ availableFields: z.array(ReportFieldSchema).optional().describe('Available fields'),
142
+ showPreview: z.boolean().optional().describe('Show preview'),
143
+ onSave: z.string().optional().describe('Save callback'),
144
+ onCancel: z.string().optional().describe('Cancel callback'),
145
+ });
146
+
147
+ /**
148
+ * Report Viewer Schema
149
+ */
150
+ export const ReportViewerSchema = BaseSchema.extend({
151
+ type: z.literal('report-viewer'),
152
+ report: ReportSchema.optional().describe('Report to display'),
153
+ data: z.array(z.any()).optional().describe('Report data'),
154
+ showToolbar: z.boolean().optional().describe('Show toolbar'),
155
+ allowExport: z.boolean().optional().describe('Allow export'),
156
+ allowPrint: z.boolean().optional().describe('Allow print'),
157
+ loading: z.boolean().optional().describe('Loading state'),
158
+ });
159
+
160
+ /**
161
+ * Union of all report schemas
162
+ */
163
+ export const ReportComponentSchema = z.union([
164
+ ReportSchema,
165
+ ReportBuilderSchema,
166
+ ReportViewerSchema,
167
+ ]);
168
+
169
+ /**
170
+ * Export type inference helpers
171
+ */
172
+ export type ReportExportFormatSchemaType = z.infer<typeof ReportExportFormatSchema>;
173
+ export type ReportScheduleFrequencySchemaType = z.infer<typeof ReportScheduleFrequencySchema>;
174
+ export type ReportAggregationTypeSchemaType = z.infer<typeof ReportAggregationTypeSchema>;
175
+ export type ReportFieldSchemaType = z.infer<typeof ReportFieldSchema>;
176
+ export type ReportFilterSchemaType = z.infer<typeof ReportFilterSchema>;
177
+ export type ReportGroupBySchemaType = z.infer<typeof ReportGroupBySchema>;
178
+ export type ReportSectionSchemaType = z.infer<typeof ReportSectionSchema>;
179
+ export type ReportScheduleSchemaType = z.infer<typeof ReportScheduleSchema>;
180
+ export type ReportExportConfigSchemaType = z.infer<typeof ReportExportConfigSchema>;
181
+ export type ReportSchemaType = z.infer<typeof ReportSchema>;
182
+ export type ReportBuilderSchemaType = z.infer<typeof ReportBuilderSchema>;
183
+ export type ReportViewerSchemaType = z.infer<typeof ReportViewerSchema>;
@@ -0,0 +1,296 @@
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 - Theme Schema Zod Validators
11
+ *
12
+ * Zod validation schemas for theme configuration.
13
+ * Aligned with @objectstack/spec UI specification.
14
+ *
15
+ * @module zod/theme
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema } from './base.zod.js';
21
+
22
+ /**
23
+ * Color Palette Schema
24
+ * Mirrors @objectstack/spec/ui ColorPaletteSchema.
25
+ */
26
+ export const ColorPaletteSchema = z.object({
27
+ primary: z.string().describe('Primary brand color'),
28
+ secondary: z.string().optional().describe('Secondary color'),
29
+ accent: z.string().optional().describe('Accent color'),
30
+ success: z.string().optional().describe('Success color'),
31
+ warning: z.string().optional().describe('Warning color'),
32
+ error: z.string().optional().describe('Error color'),
33
+ info: z.string().optional().describe('Informational color'),
34
+ background: z.string().optional().describe('Background color'),
35
+ surface: z.string().optional().describe('Surface/card background color'),
36
+ text: z.string().optional().describe('Primary text color'),
37
+ textSecondary: z.string().optional().describe('Secondary text color'),
38
+ border: z.string().optional().describe('Border color'),
39
+ disabled: z.string().optional().describe('Disabled state color'),
40
+ primaryLight: z.string().optional().describe('Lighter primary variant'),
41
+ primaryDark: z.string().optional().describe('Darker primary variant'),
42
+ secondaryLight: z.string().optional().describe('Lighter secondary variant'),
43
+ secondaryDark: z.string().optional().describe('Darker secondary variant'),
44
+ });
45
+
46
+ /**
47
+ * Typography Schema
48
+ * Mirrors @objectstack/spec/ui TypographySchema.
49
+ */
50
+ export const TypographySchema = z.object({
51
+ fontFamily: z.object({
52
+ base: z.string().optional().describe('Base body font family'),
53
+ heading: z.string().optional().describe('Heading font family'),
54
+ mono: z.string().optional().describe('Monospace font family'),
55
+ }).optional().describe('Font family definitions'),
56
+ fontSize: z.object({
57
+ xs: z.string().optional(),
58
+ sm: z.string().optional(),
59
+ base: z.string().optional(),
60
+ lg: z.string().optional(),
61
+ xl: z.string().optional(),
62
+ '2xl': z.string().optional(),
63
+ '3xl': z.string().optional(),
64
+ '4xl': z.string().optional(),
65
+ }).optional().describe('Font size scale'),
66
+ fontWeight: z.object({
67
+ light: z.number().optional(),
68
+ normal: z.number().optional(),
69
+ medium: z.number().optional(),
70
+ semibold: z.number().optional(),
71
+ bold: z.number().optional(),
72
+ }).optional().describe('Font weight scale'),
73
+ lineHeight: z.object({
74
+ tight: z.string().optional(),
75
+ normal: z.string().optional(),
76
+ relaxed: z.string().optional(),
77
+ loose: z.string().optional(),
78
+ }).optional().describe('Line height scale'),
79
+ letterSpacing: z.object({
80
+ tighter: z.string().optional(),
81
+ tight: z.string().optional(),
82
+ normal: z.string().optional(),
83
+ wide: z.string().optional(),
84
+ wider: z.string().optional(),
85
+ }).optional().describe('Letter spacing scale'),
86
+ });
87
+
88
+ /**
89
+ * Spacing Scale Schema
90
+ * Mirrors @objectstack/spec/ui SpacingSchema.
91
+ */
92
+ export const SpacingSchema = z.object({
93
+ '0': z.string().optional(),
94
+ '1': z.string().optional(),
95
+ '2': z.string().optional(),
96
+ '3': z.string().optional(),
97
+ '4': z.string().optional(),
98
+ '5': z.string().optional(),
99
+ '6': z.string().optional(),
100
+ '8': z.string().optional(),
101
+ '10': z.string().optional(),
102
+ '12': z.string().optional(),
103
+ '16': z.string().optional(),
104
+ '20': z.string().optional(),
105
+ '24': z.string().optional(),
106
+ });
107
+
108
+ /**
109
+ * Border Radius Schema
110
+ * Mirrors @objectstack/spec/ui BorderRadiusSchema.
111
+ */
112
+ export const BorderRadiusSchema = z.object({
113
+ none: z.string().optional(),
114
+ sm: z.string().optional(),
115
+ base: z.string().optional(),
116
+ md: z.string().optional(),
117
+ lg: z.string().optional(),
118
+ xl: z.string().optional(),
119
+ '2xl': z.string().optional(),
120
+ full: z.string().optional(),
121
+ });
122
+
123
+ /**
124
+ * Shadow Schema
125
+ * Mirrors @objectstack/spec/ui ShadowSchema.
126
+ */
127
+ export const ShadowSchema = z.object({
128
+ none: z.string().optional(),
129
+ sm: z.string().optional(),
130
+ base: z.string().optional(),
131
+ md: z.string().optional(),
132
+ lg: z.string().optional(),
133
+ xl: z.string().optional(),
134
+ '2xl': z.string().optional(),
135
+ inner: z.string().optional(),
136
+ });
137
+
138
+ /**
139
+ * Breakpoints Schema
140
+ * Mirrors @objectstack/spec/ui BreakpointsSchema.
141
+ */
142
+ export const BreakpointsSchema = z.object({
143
+ xs: z.string().optional(),
144
+ sm: z.string().optional(),
145
+ md: z.string().optional(),
146
+ lg: z.string().optional(),
147
+ xl: z.string().optional(),
148
+ '2xl': z.string().optional(),
149
+ });
150
+
151
+ /**
152
+ * Animation Schema
153
+ * Mirrors @objectstack/spec/ui AnimationSchema.
154
+ */
155
+ export const AnimationSchema = z.object({
156
+ duration: z.object({
157
+ fast: z.string().optional(),
158
+ base: z.string().optional(),
159
+ slow: z.string().optional(),
160
+ }).optional().describe('Duration presets'),
161
+ timing: z.object({
162
+ linear: z.string().optional(),
163
+ ease: z.string().optional(),
164
+ easeIn: z.string().optional(),
165
+ easeOut: z.string().optional(),
166
+ easeInOut: z.string().optional(),
167
+ }).optional().describe('Timing function presets'),
168
+ });
169
+
170
+ /**
171
+ * Z-Index Schema
172
+ * Mirrors @objectstack/spec/ui ZIndexSchema.
173
+ */
174
+ export const ZIndexSchema = z.object({
175
+ base: z.number().optional(),
176
+ dropdown: z.number().optional(),
177
+ sticky: z.number().optional(),
178
+ fixed: z.number().optional(),
179
+ modalBackdrop: z.number().optional(),
180
+ modal: z.number().optional(),
181
+ popover: z.number().optional(),
182
+ tooltip: z.number().optional(),
183
+ });
184
+
185
+ /**
186
+ * Theme Mode Schema
187
+ * Mirrors @objectstack/spec/ui ThemeMode.
188
+ */
189
+ export const ThemeModeSchema = z.enum(['light', 'dark', 'auto']).describe('Theme mode');
190
+
191
+ /**
192
+ * Theme Logo Schema
193
+ * Mirrors the inline logo object in @objectstack/spec ThemeSchema.
194
+ */
195
+ export const ThemeLogoSchema = z.object({
196
+ light: z.string().optional().describe('Logo URL for light mode'),
197
+ dark: z.string().optional().describe('Logo URL for dark mode'),
198
+ favicon: z.string().optional().describe('Favicon URL'),
199
+ });
200
+
201
+ /**
202
+ * Theme Definition Schema
203
+ * Mirrors @objectstack/spec/ui ThemeSchema.
204
+ */
205
+ export const ThemeDefinitionSchema = z.object({
206
+ name: z.string().describe('Theme identifier'),
207
+ label: z.string().describe('Display label'),
208
+ description: z.string().optional().describe('Human-readable description'),
209
+ mode: ThemeModeSchema.default('auto').describe('Theme mode'),
210
+ colors: ColorPaletteSchema.describe('Semantic color palette'),
211
+ typography: TypographySchema.optional().describe('Typography design tokens'),
212
+ spacing: SpacingSchema.optional().describe('Spacing scale'),
213
+ borderRadius: BorderRadiusSchema.optional().describe('Border radius scale'),
214
+ shadows: ShadowSchema.optional().describe('Shadow scale'),
215
+ breakpoints: BreakpointsSchema.optional().describe('Responsive breakpoints'),
216
+ animation: AnimationSchema.optional().describe('Animation presets'),
217
+ zIndex: ZIndexSchema.optional().describe('Z-index layering'),
218
+ customVars: z.record(z.string(), z.string()).optional().describe('Custom CSS variables'),
219
+ logo: ThemeLogoSchema.optional().describe('Logo/branding assets'),
220
+ extends: z.string().optional().describe('Extend another theme by name'),
221
+ });
222
+
223
+ /**
224
+ * Theme Component Schema (ObjectUI rendering)
225
+ */
226
+ export const ThemeComponentSchema = BaseSchema.extend({
227
+ type: z.literal('theme'),
228
+ mode: ThemeModeSchema.optional().describe('Current theme mode'),
229
+ themes: z.array(ThemeDefinitionSchema).optional().describe('Available themes'),
230
+ activeTheme: z.string().optional().describe('Active theme name'),
231
+ allowSwitching: z.boolean().optional().describe('Allow user theme switching'),
232
+ persistPreference: z.boolean().optional().describe('Persist theme preference'),
233
+ storageKey: z.string().optional().describe('Storage key for persisting theme'),
234
+ });
235
+
236
+ /**
237
+ * Theme Switcher Schema
238
+ */
239
+ export const ThemeSwitcherSchema = BaseSchema.extend({
240
+ type: z.literal('theme-switcher'),
241
+ variant: z.enum(['dropdown', 'toggle', 'buttons']).optional().describe('Switcher variant'),
242
+ showMode: z.boolean().optional().describe('Show mode selector (light/dark)'),
243
+ showThemes: z.boolean().optional().describe('Show theme selector'),
244
+ lightIcon: z.string().optional().describe('Icon for light mode'),
245
+ darkIcon: z.string().optional().describe('Icon for dark mode'),
246
+ });
247
+
248
+ /**
249
+ * Theme Preview Schema
250
+ */
251
+ export const ThemePreviewSchema = BaseSchema.extend({
252
+ type: z.literal('theme-preview'),
253
+ theme: ThemeDefinitionSchema.optional().describe('Theme to preview'),
254
+ mode: ThemeModeSchema.optional().describe('Preview mode'),
255
+ showColors: z.boolean().optional().describe('Show color palette'),
256
+ showTypography: z.boolean().optional().describe('Show typography samples'),
257
+ showComponents: z.boolean().optional().describe('Show component samples'),
258
+ });
259
+
260
+ /**
261
+ * Legacy alias — use ThemeComponentSchema
262
+ * @deprecated
263
+ */
264
+ export const ThemeSchema = ThemeComponentSchema;
265
+
266
+ /**
267
+ * Union of all theme component schemas (for AnyComponentSchema union).
268
+ */
269
+ export const ThemeUnionSchema = z.union([
270
+ ThemeComponentSchema,
271
+ ThemeSwitcherSchema,
272
+ ThemePreviewSchema,
273
+ ]);
274
+
275
+ /**
276
+ * Legacy alias — use SpacingSchema
277
+ * @deprecated
278
+ */
279
+ export const SpacingScaleSchema = SpacingSchema;
280
+
281
+ /**
282
+ * Export type inference helpers
283
+ */
284
+ export type ColorPaletteSchemaType = z.infer<typeof ColorPaletteSchema>;
285
+ export type TypographySchemaType = z.infer<typeof TypographySchema>;
286
+ export type SpacingSchemaType = z.infer<typeof SpacingSchema>;
287
+ export type BorderRadiusSchemaType = z.infer<typeof BorderRadiusSchema>;
288
+ export type ShadowSchemaType = z.infer<typeof ShadowSchema>;
289
+ export type BreakpointsSchemaType = z.infer<typeof BreakpointsSchema>;
290
+ export type AnimationSchemaType = z.infer<typeof AnimationSchema>;
291
+ export type ZIndexSchemaType = z.infer<typeof ZIndexSchema>;
292
+ export type ThemeModeSchemaType = z.infer<typeof ThemeModeSchema>;
293
+ export type ThemeDefinitionSchemaType = z.infer<typeof ThemeDefinitionSchema>;
294
+ export type ThemeSchemaType = z.infer<typeof ThemeSchema>;
295
+ export type ThemeSwitcherSchemaType = z.infer<typeof ThemeSwitcherSchema>;
296
+ export type ThemePreviewSchemaType = z.infer<typeof ThemePreviewSchema>;