@object-ui/types 0.5.0 → 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 (89) 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 +2 -2
  6. package/dist/crud.d.ts +3 -0
  7. package/dist/crud.d.ts.map +1 -1
  8. package/dist/data-display.d.ts +35 -0
  9. package/dist/data-display.d.ts.map +1 -1
  10. package/dist/data-protocol.d.ts +19 -19
  11. package/dist/data.d.ts +68 -0
  12. package/dist/data.d.ts.map +1 -1
  13. package/dist/designer.d.ts +473 -0
  14. package/dist/designer.d.ts.map +1 -0
  15. package/dist/designer.js +8 -0
  16. package/dist/form.d.ts +35 -1
  17. package/dist/form.d.ts.map +1 -1
  18. package/dist/index.d.ts +35 -8
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +18 -0
  21. package/dist/layout.d.ts +63 -8
  22. package/dist/layout.d.ts.map +1 -1
  23. package/dist/mobile.d.ts +186 -0
  24. package/dist/mobile.d.ts.map +1 -0
  25. package/dist/mobile.js +8 -0
  26. package/dist/objectql.d.ts +329 -88
  27. package/dist/objectql.d.ts.map +1 -1
  28. package/dist/permissions.d.ts +150 -0
  29. package/dist/permissions.d.ts.map +1 -0
  30. package/dist/permissions.js +8 -0
  31. package/dist/tenant.d.ts +138 -0
  32. package/dist/tenant.d.ts.map +1 -0
  33. package/dist/tenant.js +8 -0
  34. package/dist/theme.d.ts +115 -224
  35. package/dist/theme.d.ts.map +1 -1
  36. package/dist/ui-action.d.ts +126 -11
  37. package/dist/ui-action.d.ts.map +1 -1
  38. package/dist/views.d.ts +10 -0
  39. package/dist/views.d.ts.map +1 -1
  40. package/dist/widget.d.ts +181 -0
  41. package/dist/widget.d.ts.map +1 -0
  42. package/dist/widget.js +8 -0
  43. package/dist/workflow.d.ts +340 -0
  44. package/dist/workflow.d.ts.map +1 -0
  45. package/dist/workflow.js +8 -0
  46. package/dist/zod/complex.zod.d.ts +4 -4
  47. package/dist/zod/crud.zod.d.ts +5 -5
  48. package/dist/zod/feedback.zod.d.ts +10 -10
  49. package/dist/zod/form.zod.d.ts +4 -4
  50. package/dist/zod/index.zod.d.ts +323 -132
  51. package/dist/zod/index.zod.d.ts.map +1 -1
  52. package/dist/zod/index.zod.js +4 -4
  53. package/dist/zod/layout.zod.d.ts +132 -0
  54. package/dist/zod/layout.zod.d.ts.map +1 -1
  55. package/dist/zod/layout.zod.js +34 -0
  56. package/dist/zod/objectql.zod.d.ts +32 -16
  57. package/dist/zod/objectql.zod.d.ts.map +1 -1
  58. package/dist/zod/objectql.zod.js +8 -0
  59. package/dist/zod/reports.zod.d.ts +17 -17
  60. package/dist/zod/theme.zod.d.ts +947 -266
  61. package/dist/zod/theme.zod.d.ts.map +1 -1
  62. package/dist/zod/theme.zod.js +175 -45
  63. package/dist/zod/views.zod.d.ts +20 -20
  64. package/package.json +3 -2
  65. package/src/__tests__/namespace-exports.test.ts +24 -68
  66. package/src/__tests__/phase2-schemas.test.ts +8 -13
  67. package/src/ai.ts +454 -0
  68. package/src/app.ts +2 -2
  69. package/src/crud.ts +3 -0
  70. package/src/data-display.ts +31 -0
  71. package/src/data-protocol.ts +19 -19
  72. package/src/data.ts +81 -0
  73. package/src/designer.ts +509 -0
  74. package/src/form.ts +35 -1
  75. package/src/index.ts +220 -8
  76. package/src/layout.ts +66 -8
  77. package/src/mobile.ts +205 -0
  78. package/src/objectql.ts +403 -93
  79. package/src/permissions.ts +166 -0
  80. package/src/tenant.ts +153 -0
  81. package/src/theme.ts +147 -260
  82. package/src/ui-action.ts +166 -27
  83. package/src/views.ts +7 -0
  84. package/src/widget.ts +197 -0
  85. package/src/workflow.ts +409 -0
  86. package/src/zod/index.zod.ts +14 -3
  87. package/src/zod/layout.zod.ts +38 -0
  88. package/src/zod/objectql.zod.ts +8 -0
  89. package/src/zod/theme.zod.ts +189 -48
@@ -8,10 +8,10 @@
8
8
 
9
9
  /**
10
10
  * @object-ui/types/zod - Theme Schema Zod Validators
11
- *
11
+ *
12
12
  * Zod validation schemas for theme configuration.
13
- * Following @objectstack/spec UI specification format.
14
- *
13
+ * Aligned with @objectstack/spec UI specification.
14
+ *
15
15
  * @module zod/theme
16
16
  * @packageDocumentation
17
17
  */
@@ -21,84 +21,209 @@ import { BaseSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Color Palette Schema
24
+ * Mirrors @objectstack/spec/ui ColorPaletteSchema.
24
25
  */
25
26
  export const ColorPaletteSchema = z.object({
26
- primary: z.string().optional().describe('Primary brand color'),
27
+ primary: z.string().describe('Primary brand color'),
27
28
  secondary: z.string().optional().describe('Secondary color'),
28
29
  accent: z.string().optional().describe('Accent color'),
29
- background: z.string().optional().describe('Background color'),
30
- foreground: z.string().optional().describe('Foreground/text color'),
31
- muted: z.string().optional().describe('Muted color'),
32
- mutedForeground: z.string().optional().describe('Muted foreground color'),
33
- border: z.string().optional().describe('Border color'),
34
- input: z.string().optional().describe('Input border color'),
35
- ring: z.string().optional().describe('Ring/focus color'),
36
30
  success: z.string().optional().describe('Success color'),
37
31
  warning: z.string().optional().describe('Warning color'),
38
- destructive: z.string().optional().describe('Error/destructive color'),
39
- info: z.string().optional().describe('Info color'),
40
- card: z.string().optional().describe('Card background color'),
41
- cardForeground: z.string().optional().describe('Card foreground color'),
42
- popover: z.string().optional().describe('Popover background color'),
43
- popoverForeground: z.string().optional().describe('Popover foreground 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
44
  });
45
45
 
46
46
  /**
47
47
  * Typography Schema
48
+ * Mirrors @objectstack/spec/ui TypographySchema.
48
49
  */
49
50
  export const TypographySchema = z.object({
50
- fontSans: z.array(z.string()).optional().describe('Font family for sans-serif text'),
51
- fontSerif: z.array(z.string()).optional().describe('Font family for serif text'),
52
- fontMono: z.array(z.string()).optional().describe('Font family for monospace text'),
53
- fontSize: z.number().optional().describe('Base font size (in rem)'),
54
- lineHeight: z.number().optional().describe('Line height'),
55
- headingWeight: z.number().optional().describe('Font weight for headings'),
56
- bodyWeight: z.number().optional().describe('Font weight for body text'),
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'),
57
86
  });
58
87
 
59
88
  /**
60
89
  * Spacing Scale Schema
90
+ * Mirrors @objectstack/spec/ui SpacingSchema.
61
91
  */
62
- export const SpacingScaleSchema = z.object({
63
- base: z.number().optional().describe('Base spacing unit (in rem)'),
64
- scale: z.record(z.string(), z.string()).optional().describe('Custom spacing values'),
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(),
65
106
  });
66
107
 
67
108
  /**
68
109
  * Border Radius Schema
110
+ * Mirrors @objectstack/spec/ui BorderRadiusSchema.
69
111
  */
70
112
  export const BorderRadiusSchema = z.object({
71
- sm: z.string().optional().describe('Small radius'),
72
- default: z.string().optional().describe('Default radius'),
73
- md: z.string().optional().describe('Medium radius'),
74
- lg: z.string().optional().describe('Large radius'),
75
- xl: z.string().optional().describe('Extra large radius'),
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(),
76
183
  });
77
184
 
78
185
  /**
79
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.
80
194
  */
81
- export const ThemeModeSchema = z.enum(['light', 'dark', 'system']).describe('Theme mode');
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
+ });
82
200
 
83
201
  /**
84
202
  * Theme Definition Schema
203
+ * Mirrors @objectstack/spec/ui ThemeSchema.
85
204
  */
86
205
  export const ThemeDefinitionSchema = z.object({
87
- name: z.string().describe('Theme name/identifier'),
88
- label: z.string().optional().describe('Theme display label'),
89
- light: ColorPaletteSchema.optional().describe('Light mode color palette'),
90
- dark: ColorPaletteSchema.optional().describe('Dark mode color palette'),
91
- typography: TypographySchema.optional().describe('Typography configuration'),
92
- spacing: SpacingScaleSchema.optional().describe('Spacing scale configuration'),
93
- radius: BorderRadiusSchema.optional().describe('Border radius configuration'),
94
- cssVariables: z.record(z.string(), z.string()).optional().describe('Custom CSS variables'),
95
- tailwind: z.record(z.string(), z.any()).optional().describe('Tailwind configuration overrides'),
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'),
96
221
  });
97
222
 
98
223
  /**
99
- * Theme Schema
224
+ * Theme Component Schema (ObjectUI rendering)
100
225
  */
101
- export const ThemeSchema = BaseSchema.extend({
226
+ export const ThemeComponentSchema = BaseSchema.extend({
102
227
  type: z.literal('theme'),
103
228
  mode: ThemeModeSchema.optional().describe('Current theme mode'),
104
229
  themes: z.array(ThemeDefinitionSchema).optional().describe('Available themes'),
@@ -133,21 +258,37 @@ export const ThemePreviewSchema = BaseSchema.extend({
133
258
  });
134
259
 
135
260
  /**
136
- * Union of all theme schemas
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).
137
268
  */
138
- export const ThemeComponentSchema = z.union([
139
- ThemeSchema,
269
+ export const ThemeUnionSchema = z.union([
270
+ ThemeComponentSchema,
140
271
  ThemeSwitcherSchema,
141
272
  ThemePreviewSchema,
142
273
  ]);
143
274
 
275
+ /**
276
+ * Legacy alias — use SpacingSchema
277
+ * @deprecated
278
+ */
279
+ export const SpacingScaleSchema = SpacingSchema;
280
+
144
281
  /**
145
282
  * Export type inference helpers
146
283
  */
147
284
  export type ColorPaletteSchemaType = z.infer<typeof ColorPaletteSchema>;
148
285
  export type TypographySchemaType = z.infer<typeof TypographySchema>;
149
- export type SpacingScaleSchemaType = z.infer<typeof SpacingScaleSchema>;
286
+ export type SpacingSchemaType = z.infer<typeof SpacingSchema>;
150
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>;
151
292
  export type ThemeModeSchemaType = z.infer<typeof ThemeModeSchema>;
152
293
  export type ThemeDefinitionSchemaType = z.infer<typeof ThemeDefinitionSchema>;
153
294
  export type ThemeSchemaType = z.infer<typeof ThemeSchema>;