@object-ui/types 0.3.0 → 0.3.1

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 (115) 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 +7 -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/complex.d.ts +68 -1
  12. package/dist/complex.d.ts.map +1 -1
  13. package/dist/complex.js +4 -5
  14. package/dist/crud.d.ts +7 -0
  15. package/dist/crud.d.ts.map +1 -1
  16. package/dist/crud.js +4 -6
  17. package/dist/data-display.d.ts +54 -2
  18. package/dist/data-display.d.ts.map +1 -1
  19. package/dist/data-display.js +4 -5
  20. package/dist/data.d.ts +16 -0
  21. package/dist/data.d.ts.map +1 -1
  22. package/dist/data.js +4 -6
  23. package/dist/disclosure.d.ts +70 -1
  24. package/dist/disclosure.d.ts.map +1 -1
  25. package/dist/disclosure.js +4 -5
  26. package/dist/feedback.d.ts +68 -1
  27. package/dist/feedback.d.ts.map +1 -1
  28. package/dist/feedback.js +4 -5
  29. package/dist/field-types.d.ts +386 -0
  30. package/dist/field-types.d.ts.map +1 -0
  31. package/dist/field-types.js +8 -0
  32. package/dist/form.d.ts +123 -1
  33. package/dist/form.d.ts.map +1 -1
  34. package/dist/form.js +4 -5
  35. package/dist/index.d.ts +21 -13
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +4 -37
  38. package/dist/layout.d.ts +66 -16
  39. package/dist/layout.d.ts.map +1 -1
  40. package/dist/layout.js +4 -6
  41. package/dist/navigation.d.ts +102 -2
  42. package/dist/navigation.d.ts.map +1 -1
  43. package/dist/navigation.js +4 -5
  44. package/dist/objectql.d.ts +484 -54
  45. package/dist/objectql.d.ts.map +1 -1
  46. package/dist/objectql.js +4 -6
  47. package/dist/overlay.d.ts +31 -1
  48. package/dist/overlay.d.ts.map +1 -1
  49. package/dist/overlay.js +4 -5
  50. package/dist/registry.d.ts +7 -0
  51. package/dist/registry.d.ts.map +1 -1
  52. package/dist/registry.js +7 -0
  53. package/dist/zod/base.zod.d.ts +202 -0
  54. package/dist/zod/base.zod.d.ts.map +1 -0
  55. package/dist/zod/base.zod.js +198 -0
  56. package/dist/zod/complex.zod.d.ts +742 -0
  57. package/dist/zod/complex.zod.d.ts.map +1 -0
  58. package/dist/zod/complex.zod.js +233 -0
  59. package/dist/zod/data-display.zod.d.ts +996 -0
  60. package/dist/zod/data-display.zod.d.ts.map +1 -0
  61. package/dist/zod/data-display.zod.js +266 -0
  62. package/dist/zod/disclosure.zod.d.ts +267 -0
  63. package/dist/zod/disclosure.zod.d.ts.map +1 -0
  64. package/dist/zod/disclosure.zod.js +84 -0
  65. package/dist/zod/feedback.zod.d.ts +538 -0
  66. package/dist/zod/feedback.zod.d.ts.map +1 -0
  67. package/dist/zod/feedback.zod.js +127 -0
  68. package/dist/zod/form.zod.d.ts +1308 -0
  69. package/dist/zod/form.zod.d.ts.map +1 -0
  70. package/dist/zod/form.zod.js +406 -0
  71. package/dist/zod/index.zod.d.ts +3174 -0
  72. package/dist/zod/index.zod.d.ts.map +1 -0
  73. package/dist/zod/index.zod.js +106 -0
  74. package/dist/zod/layout.zod.d.ts +1048 -0
  75. package/dist/zod/layout.zod.d.ts.map +1 -0
  76. package/dist/zod/layout.zod.js +241 -0
  77. package/dist/zod/navigation.zod.d.ts +486 -0
  78. package/dist/zod/navigation.zod.d.ts.map +1 -0
  79. package/dist/zod/navigation.zod.js +142 -0
  80. package/dist/zod/objectql.zod.d.ts +1261 -0
  81. package/dist/zod/objectql.zod.d.ts.map +1 -0
  82. package/dist/zod/objectql.zod.js +248 -0
  83. package/dist/zod/overlay.zod.d.ts +691 -0
  84. package/dist/zod/overlay.zod.d.ts.map +1 -0
  85. package/dist/zod/overlay.zod.js +179 -0
  86. package/package.json +9 -1
  87. package/src/api-types.ts +8 -0
  88. package/src/app.ts +8 -0
  89. package/src/base.ts +8 -0
  90. package/src/complex.ts +69 -1
  91. package/src/crud.ts +8 -0
  92. package/src/data-display.ts +60 -2
  93. package/src/data.ts +18 -0
  94. package/src/disclosure.ts +74 -1
  95. package/src/feedback.ts +76 -2
  96. package/src/field-types.ts +465 -0
  97. package/src/form.ts +131 -1
  98. package/src/index.ts +91 -8
  99. package/src/layout.ts +70 -15
  100. package/src/navigation.ts +109 -2
  101. package/src/objectql.ts +555 -59
  102. package/src/overlay.ts +35 -1
  103. package/src/registry.ts +8 -0
  104. package/src/zod/README.md +329 -0
  105. package/src/zod/base.zod.ts +229 -0
  106. package/src/zod/complex.zod.ts +258 -0
  107. package/src/zod/data-display.zod.ts +290 -0
  108. package/src/zod/disclosure.zod.ts +92 -0
  109. package/src/zod/feedback.zod.ts +138 -0
  110. package/src/zod/form.zod.ts +434 -0
  111. package/src/zod/index.zod.ts +277 -0
  112. package/src/zod/layout.zod.ts +262 -0
  113. package/src/zod/navigation.zod.ts +159 -0
  114. package/src/zod/objectql.zod.ts +268 -0
  115. package/src/zod/overlay.zod.ts +196 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.zod.d.ts","sourceRoot":"","sources":["../../src/zod/layout.zod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;iBAGpB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;iBAIrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQrB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAA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AAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAiBvB,CAAC"}
@@ -0,0 +1,241 @@
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
+ * @object-ui/types/zod - Layout Component Zod Validators
10
+ *
11
+ * Zod validation schemas for layout and container components.
12
+ * Following @objectstack/spec UI specification format.
13
+ *
14
+ * @module zod/layout
15
+ * @packageDocumentation
16
+ */
17
+ import { z } from 'zod';
18
+ import { BaseSchema, SchemaNodeSchema } from './base.zod';
19
+ /**
20
+ * Div Schema - Basic HTML container
21
+ */
22
+ export const DivSchema = BaseSchema.extend({
23
+ type: z.literal('div'),
24
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
25
+ });
26
+ /**
27
+ * Span Schema - Inline text container
28
+ */
29
+ export const SpanSchema = BaseSchema.extend({
30
+ type: z.literal('span'),
31
+ value: z.string().optional().describe('Text content'),
32
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
33
+ });
34
+ /**
35
+ * Text Schema - Text display component
36
+ */
37
+ export const TextSchema = BaseSchema.extend({
38
+ type: z.literal('text'),
39
+ value: z.string().optional().describe('Text content'),
40
+ variant: z.enum(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'body', 'caption', 'overline'])
41
+ .optional()
42
+ .default('body')
43
+ .describe('Text variant/style'),
44
+ align: z.enum(['left', 'center', 'right', 'justify']).optional().describe('Text alignment'),
45
+ });
46
+ /**
47
+ * Image Schema - Image component
48
+ */
49
+ export const ImageSchema = BaseSchema.extend({
50
+ type: z.literal('image'),
51
+ src: z.string().describe('Image source URL'),
52
+ alt: z.string().optional().describe('Alt text for accessibility'),
53
+ width: z.union([z.string(), z.number()]).optional().describe('Image width'),
54
+ height: z.union([z.string(), z.number()]).optional().describe('Image height'),
55
+ objectFit: z.enum(['contain', 'cover', 'fill', 'none', 'scale-down']).optional().describe('Object fit property'),
56
+ });
57
+ /**
58
+ * Icon Schema - Icon component (Lucide icons)
59
+ */
60
+ export const IconSchema = BaseSchema.extend({
61
+ type: z.literal('icon'),
62
+ name: z.string().describe('Icon name (lucide-react)'),
63
+ size: z.number().optional().default(24).describe('Icon size in pixels'),
64
+ color: z.string().optional().describe('Icon color'),
65
+ });
66
+ /**
67
+ * Separator Schema - Divider component
68
+ */
69
+ export const SeparatorSchema = BaseSchema.extend({
70
+ type: z.literal('separator'),
71
+ orientation: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Separator orientation'),
72
+ decorative: z.boolean().optional().describe('Whether decorative'),
73
+ });
74
+ /**
75
+ * Container Schema - Generic container component
76
+ */
77
+ export const ContainerSchema = BaseSchema.extend({
78
+ type: z.literal('container'),
79
+ maxWidth: z.union([
80
+ z.enum(['sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', 'full', 'screen']),
81
+ z.boolean(),
82
+ ]).optional().default('lg').describe('Max width constraint'),
83
+ centered: z.boolean().optional().default(true).describe('Center the container'),
84
+ padding: z.number().optional().describe('Padding value'),
85
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
86
+ });
87
+ /**
88
+ * Flex Schema - Flexbox layout component
89
+ */
90
+ export const FlexSchema = BaseSchema.extend({
91
+ type: z.literal('flex'),
92
+ direction: z.enum(['row', 'col', 'row-reverse', 'col-reverse'])
93
+ .optional()
94
+ .default('row')
95
+ .describe('Flex direction'),
96
+ justify: z.enum(['start', 'end', 'center', 'between', 'around', 'evenly'])
97
+ .optional()
98
+ .default('start')
99
+ .describe('Justify content alignment'),
100
+ align: z.enum(['start', 'end', 'center', 'baseline', 'stretch'])
101
+ .optional()
102
+ .default('center')
103
+ .describe('Align items'),
104
+ gap: z.number().optional().default(2).describe('Gap between items (Tailwind scale 0-8)'),
105
+ wrap: z.boolean().optional().default(false).describe('Allow items to wrap'),
106
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
107
+ });
108
+ /**
109
+ * Stack Schema - Vertical flex layout (shortcut)
110
+ */
111
+ export const StackSchema = BaseSchema.extend({
112
+ type: z.literal('stack'),
113
+ direction: z.enum(['row', 'col', 'row-reverse', 'col-reverse']).optional(),
114
+ justify: z.enum(['start', 'end', 'center', 'between', 'around', 'evenly']).optional(),
115
+ align: z.enum(['start', 'end', 'center', 'baseline', 'stretch']).optional(),
116
+ gap: z.number().optional(),
117
+ wrap: z.boolean().optional(),
118
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
119
+ });
120
+ /**
121
+ * Grid Schema - CSS Grid layout component
122
+ */
123
+ export const GridSchema = BaseSchema.extend({
124
+ type: z.literal('grid'),
125
+ columns: z.union([
126
+ z.number(),
127
+ z.record(z.string(), z.number()),
128
+ ]).optional().default(3).describe('Number of columns (responsive)'),
129
+ gap: z.number().optional().default(4).describe('Gap between items (Tailwind scale 0-8)'),
130
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
131
+ });
132
+ /**
133
+ * Card Schema - Card component
134
+ */
135
+ export const CardSchema = BaseSchema.extend({
136
+ type: z.literal('card'),
137
+ title: z.string().optional().describe('Card title'),
138
+ description: z.string().optional().describe('Card description'),
139
+ header: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card header content'),
140
+ body: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card body content'),
141
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
142
+ footer: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Card footer content'),
143
+ variant: z.enum(['default', 'outline', 'ghost']).optional().default('default').describe('Card variant style'),
144
+ hoverable: z.boolean().optional().default(false).describe('Whether the card is hoverable'),
145
+ clickable: z.boolean().optional().default(false).describe('Whether the card is clickable'),
146
+ onClick: z.function().optional().describe('Click handler'),
147
+ });
148
+ /**
149
+ * Tab Item Schema
150
+ */
151
+ export const TabItemSchema = z.object({
152
+ value: z.string().describe('Unique tab identifier'),
153
+ label: z.string().describe('Tab label'),
154
+ icon: z.string().optional().describe('Tab icon'),
155
+ disabled: z.boolean().optional().describe('Whether tab is disabled'),
156
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Tab content'),
157
+ });
158
+ /**
159
+ * Tabs Schema - Tabs component
160
+ */
161
+ export const TabsSchema = BaseSchema.extend({
162
+ type: z.literal('tabs'),
163
+ defaultValue: z.string().optional().describe('Default active tab value'),
164
+ value: z.string().optional().describe('Controlled active tab value'),
165
+ orientation: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Tabs orientation'),
166
+ items: z.array(TabItemSchema).describe('Tab items configuration'),
167
+ onValueChange: z.function().optional().describe('Change handler'),
168
+ });
169
+ /**
170
+ * Scroll Area Schema
171
+ */
172
+ export const ScrollAreaSchema = BaseSchema.extend({
173
+ type: z.literal('scroll-area'),
174
+ height: z.union([z.string(), z.number()]).optional().describe('Height of scroll container'),
175
+ width: z.union([z.string(), z.number()]).optional().describe('Width of scroll container'),
176
+ orientation: z.enum(['vertical', 'horizontal', 'both']).optional().default('vertical').describe('Scrollbar orientation'),
177
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional(),
178
+ });
179
+ /**
180
+ * Resizable Panel Schema
181
+ */
182
+ export const ResizablePanelSchema = z.object({
183
+ id: z.string().describe('Unique panel identifier'),
184
+ defaultSize: z.number().optional().describe('Default size (percentage 0-100)'),
185
+ minSize: z.number().optional().describe('Minimum size (percentage 0-100)'),
186
+ maxSize: z.number().optional().describe('Maximum size (percentage 0-100)'),
187
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Panel content'),
188
+ });
189
+ /**
190
+ * Resizable Schema - Resizable panels component
191
+ */
192
+ export const ResizableSchema = BaseSchema.extend({
193
+ type: z.literal('resizable'),
194
+ direction: z.enum(['horizontal', 'vertical']).optional().default('horizontal').describe('Direction of resizable panels'),
195
+ minHeight: z.union([z.string(), z.number()]).optional().describe('Minimum height'),
196
+ withHandle: z.boolean().optional().default(true).describe('Show resize handle'),
197
+ panels: z.array(ResizablePanelSchema).describe('Resizable panels'),
198
+ });
199
+ /**
200
+ * Aspect Ratio Schema
201
+ */
202
+ export const AspectRatioSchema = BaseSchema.extend({
203
+ type: z.literal('aspect-ratio'),
204
+ ratio: z.number().optional().default(16 / 9).describe('Aspect ratio (width / height)'),
205
+ image: z.string().optional().describe('Image URL to display'),
206
+ alt: z.string().optional().describe('Image alt text'),
207
+ body: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components (alternative to image)'),
208
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Child components'),
209
+ });
210
+ /**
211
+ * Page Schema - Top-level page layout
212
+ */
213
+ export const PageSchema = BaseSchema.extend({
214
+ type: z.literal('page'),
215
+ title: z.string().optional().describe('Page title'),
216
+ icon: z.string().optional().describe('Page icon (Lucide icon name)'),
217
+ description: z.string().optional().describe('Page description'),
218
+ body: z.array(SchemaNodeSchema).optional().describe('Main content array'),
219
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Alternative content prop'),
220
+ });
221
+ /**
222
+ * Layout Schema Union - All layout component schemas
223
+ */
224
+ export const LayoutSchema = z.union([
225
+ DivSchema,
226
+ SpanSchema,
227
+ TextSchema,
228
+ ImageSchema,
229
+ IconSchema,
230
+ SeparatorSchema,
231
+ ContainerSchema,
232
+ FlexSchema,
233
+ StackSchema,
234
+ GridSchema,
235
+ CardSchema,
236
+ TabsSchema,
237
+ ScrollAreaSchema,
238
+ ResizableSchema,
239
+ AspectRatioSchema,
240
+ PageSchema,
241
+ ]);