@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.
- package/README.md +19 -11
- package/dist/api-types.d.ts +7 -0
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +4 -6
- package/dist/app.d.ts +7 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +4 -3
- package/dist/base.d.ts +7 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +4 -6
- package/dist/complex.d.ts +68 -1
- package/dist/complex.d.ts.map +1 -1
- package/dist/complex.js +4 -5
- package/dist/crud.d.ts +7 -0
- package/dist/crud.d.ts.map +1 -1
- package/dist/crud.js +4 -6
- package/dist/data-display.d.ts +54 -2
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +4 -5
- package/dist/data.d.ts +16 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +4 -6
- package/dist/disclosure.d.ts +70 -1
- package/dist/disclosure.d.ts.map +1 -1
- package/dist/disclosure.js +4 -5
- package/dist/feedback.d.ts +68 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +4 -5
- package/dist/field-types.d.ts +386 -0
- package/dist/field-types.d.ts.map +1 -0
- package/dist/field-types.js +8 -0
- package/dist/form.d.ts +123 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/form.js +4 -5
- package/dist/index.d.ts +21 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -37
- package/dist/layout.d.ts +66 -16
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +4 -6
- package/dist/navigation.d.ts +102 -2
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +4 -5
- package/dist/objectql.d.ts +484 -54
- package/dist/objectql.d.ts.map +1 -1
- package/dist/objectql.js +4 -6
- package/dist/overlay.d.ts +31 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +4 -5
- package/dist/registry.d.ts +7 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +7 -0
- package/dist/zod/base.zod.d.ts +202 -0
- package/dist/zod/base.zod.d.ts.map +1 -0
- package/dist/zod/base.zod.js +198 -0
- package/dist/zod/complex.zod.d.ts +742 -0
- package/dist/zod/complex.zod.d.ts.map +1 -0
- package/dist/zod/complex.zod.js +233 -0
- package/dist/zod/data-display.zod.d.ts +996 -0
- package/dist/zod/data-display.zod.d.ts.map +1 -0
- package/dist/zod/data-display.zod.js +266 -0
- package/dist/zod/disclosure.zod.d.ts +267 -0
- package/dist/zod/disclosure.zod.d.ts.map +1 -0
- package/dist/zod/disclosure.zod.js +84 -0
- package/dist/zod/feedback.zod.d.ts +538 -0
- package/dist/zod/feedback.zod.d.ts.map +1 -0
- package/dist/zod/feedback.zod.js +127 -0
- package/dist/zod/form.zod.d.ts +1308 -0
- package/dist/zod/form.zod.d.ts.map +1 -0
- package/dist/zod/form.zod.js +406 -0
- package/dist/zod/index.zod.d.ts +3174 -0
- package/dist/zod/index.zod.d.ts.map +1 -0
- package/dist/zod/index.zod.js +106 -0
- package/dist/zod/layout.zod.d.ts +1048 -0
- package/dist/zod/layout.zod.d.ts.map +1 -0
- package/dist/zod/layout.zod.js +241 -0
- package/dist/zod/navigation.zod.d.ts +486 -0
- package/dist/zod/navigation.zod.d.ts.map +1 -0
- package/dist/zod/navigation.zod.js +142 -0
- package/dist/zod/objectql.zod.d.ts +1261 -0
- package/dist/zod/objectql.zod.d.ts.map +1 -0
- package/dist/zod/objectql.zod.js +248 -0
- package/dist/zod/overlay.zod.d.ts +691 -0
- package/dist/zod/overlay.zod.d.ts.map +1 -0
- package/dist/zod/overlay.zod.js +179 -0
- package/package.json +9 -1
- package/src/api-types.ts +8 -0
- package/src/app.ts +8 -0
- package/src/base.ts +8 -0
- package/src/complex.ts +69 -1
- package/src/crud.ts +8 -0
- package/src/data-display.ts +60 -2
- package/src/data.ts +18 -0
- package/src/disclosure.ts +74 -1
- package/src/feedback.ts +76 -2
- package/src/field-types.ts +465 -0
- package/src/form.ts +131 -1
- package/src/index.ts +91 -8
- package/src/layout.ts +70 -15
- package/src/navigation.ts +109 -2
- package/src/objectql.ts +555 -59
- package/src/overlay.ts +35 -1
- package/src/registry.ts +8 -0
- package/src/zod/README.md +329 -0
- package/src/zod/base.zod.ts +229 -0
- package/src/zod/complex.zod.ts +258 -0
- package/src/zod/data-display.zod.ts +290 -0
- package/src/zod/disclosure.zod.ts +92 -0
- package/src/zod/feedback.zod.ts +138 -0
- package/src/zod/form.zod.ts +434 -0
- package/src/zod/index.zod.ts +277 -0
- package/src/zod/layout.zod.ts +262 -0
- package/src/zod/navigation.zod.ts +159 -0
- package/src/zod/objectql.zod.ts +268 -0
- package/src/zod/overlay.zod.ts +196 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complex.zod.d.ts","sourceRoot":"","sources":["../../src/zod/complex.zod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;iBAU3B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;iBAO7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAQvB,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;EAA6C,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;iBAS9B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAc7B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAe/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;;;;;;;;;;;;;;;;;;mBAOxB,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
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 - Complex Component Zod Validators
|
|
10
|
+
*
|
|
11
|
+
* Zod validation schemas for advanced/composite components.
|
|
12
|
+
* Following @objectstack/spec UI specification format.
|
|
13
|
+
*
|
|
14
|
+
* @module zod/complex
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { BaseSchema, SchemaNodeSchema } from './base.zod';
|
|
19
|
+
/**
|
|
20
|
+
* Kanban Card Schema
|
|
21
|
+
*/
|
|
22
|
+
export const KanbanCardSchema = z.object({
|
|
23
|
+
id: z.string().describe('Card ID'),
|
|
24
|
+
title: z.string().describe('Card title'),
|
|
25
|
+
description: z.string().optional().describe('Card description'),
|
|
26
|
+
labels: z.array(z.string()).optional().describe('Card labels'),
|
|
27
|
+
assignees: z.array(z.string()).optional().describe('Card assignees'),
|
|
28
|
+
dueDate: z.union([z.string(), z.date()]).optional().describe('Due date'),
|
|
29
|
+
priority: z.enum(['low', 'medium', 'high', 'critical']).optional().describe('Card priority'),
|
|
30
|
+
content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Custom content'),
|
|
31
|
+
data: z.any().optional().describe('Custom card data'),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Kanban Column Schema
|
|
35
|
+
*/
|
|
36
|
+
export const KanbanColumnSchema = z.object({
|
|
37
|
+
id: z.string().describe('Column ID'),
|
|
38
|
+
title: z.string().describe('Column title'),
|
|
39
|
+
items: z.array(KanbanCardSchema).describe('Column cards'),
|
|
40
|
+
color: z.string().optional().describe('Column color'),
|
|
41
|
+
limit: z.number().optional().describe('Card limit'),
|
|
42
|
+
collapsed: z.boolean().optional().describe('Whether column is collapsed'),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Kanban Schema - Kanban board component
|
|
46
|
+
*/
|
|
47
|
+
export const KanbanSchema = BaseSchema.extend({
|
|
48
|
+
type: z.literal('kanban'),
|
|
49
|
+
columns: z.array(KanbanColumnSchema).describe('Kanban columns'),
|
|
50
|
+
draggable: z.boolean().optional().describe('Whether cards are draggable'),
|
|
51
|
+
onCardMove: z.function().optional().describe('Card move handler'),
|
|
52
|
+
onCardClick: z.function().optional().describe('Card click handler'),
|
|
53
|
+
onColumnAdd: z.function().optional().describe('Column add handler'),
|
|
54
|
+
onCardAdd: z.function().optional().describe('Card add handler'),
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Calendar View Mode
|
|
58
|
+
*/
|
|
59
|
+
export const CalendarViewModeSchema = z.enum(['month', 'week', 'day', 'agenda']);
|
|
60
|
+
/**
|
|
61
|
+
* Calendar Event Schema
|
|
62
|
+
*/
|
|
63
|
+
export const CalendarEventSchema = z.object({
|
|
64
|
+
id: z.string().describe('Event ID'),
|
|
65
|
+
title: z.string().describe('Event title'),
|
|
66
|
+
description: z.string().optional().describe('Event description'),
|
|
67
|
+
start: z.union([z.string(), z.date()]).describe('Event start time'),
|
|
68
|
+
end: z.union([z.string(), z.date()]).describe('Event end time'),
|
|
69
|
+
allDay: z.boolean().optional().describe('Whether event is all-day'),
|
|
70
|
+
color: z.string().optional().describe('Event color'),
|
|
71
|
+
data: z.any().optional().describe('Custom event data'),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Calendar View Schema - Calendar component
|
|
75
|
+
*/
|
|
76
|
+
export const CalendarViewSchema = BaseSchema.extend({
|
|
77
|
+
type: z.literal('calendar-view'),
|
|
78
|
+
events: z.array(CalendarEventSchema).describe('Calendar events'),
|
|
79
|
+
defaultView: CalendarViewModeSchema.optional().describe('Default view mode'),
|
|
80
|
+
view: CalendarViewModeSchema.optional().describe('Controlled view mode'),
|
|
81
|
+
defaultDate: z.union([z.string(), z.date()]).optional().describe('Default date'),
|
|
82
|
+
date: z.union([z.string(), z.date()]).optional().describe('Controlled date'),
|
|
83
|
+
views: z.array(CalendarViewModeSchema).optional().describe('Available views'),
|
|
84
|
+
editable: z.boolean().optional().describe('Whether events are editable'),
|
|
85
|
+
onEventClick: z.function().optional().describe('Event click handler'),
|
|
86
|
+
onEventCreate: z.function().optional().describe('Event create handler'),
|
|
87
|
+
onEventUpdate: z.function().optional().describe('Event update handler'),
|
|
88
|
+
onDateChange: z.function().optional().describe('Date change handler'),
|
|
89
|
+
onViewChange: z.function().optional().describe('View change handler'),
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Filter Operator Enum
|
|
93
|
+
*/
|
|
94
|
+
export const FilterOperatorSchema = z.enum([
|
|
95
|
+
'equals',
|
|
96
|
+
'not_equals',
|
|
97
|
+
'contains',
|
|
98
|
+
'not_contains',
|
|
99
|
+
'starts_with',
|
|
100
|
+
'ends_with',
|
|
101
|
+
'greater_than',
|
|
102
|
+
'greater_than_or_equal',
|
|
103
|
+
'less_than',
|
|
104
|
+
'less_than_or_equal',
|
|
105
|
+
'in',
|
|
106
|
+
'not_in',
|
|
107
|
+
'is_null',
|
|
108
|
+
'is_not_null',
|
|
109
|
+
]);
|
|
110
|
+
/**
|
|
111
|
+
* Filter Condition Schema
|
|
112
|
+
*/
|
|
113
|
+
export const FilterConditionSchema = z.lazy(() => z.object({
|
|
114
|
+
field: z.string().describe('Field name'),
|
|
115
|
+
operator: FilterOperatorSchema.describe('Filter operator'),
|
|
116
|
+
value: z.any().optional().describe('Filter value'),
|
|
117
|
+
}));
|
|
118
|
+
/**
|
|
119
|
+
* Filter Group Schema
|
|
120
|
+
*/
|
|
121
|
+
export const FilterGroupSchema = z.lazy(() => z.object({
|
|
122
|
+
operator: z.enum(['and', 'or']).describe('Group operator'),
|
|
123
|
+
conditions: z.array(z.union([FilterConditionSchema, FilterGroupSchema])).describe('Conditions or sub-groups'),
|
|
124
|
+
}));
|
|
125
|
+
/**
|
|
126
|
+
* Filter Field Schema
|
|
127
|
+
*/
|
|
128
|
+
export const FilterFieldSchema = z.object({
|
|
129
|
+
name: z.string().describe('Field name'),
|
|
130
|
+
label: z.string().describe('Field label'),
|
|
131
|
+
type: z.enum(['string', 'number', 'date', 'boolean', 'select']).describe('Field type'),
|
|
132
|
+
operators: z.array(FilterOperatorSchema).optional().describe('Available operators'),
|
|
133
|
+
options: z.array(z.object({
|
|
134
|
+
label: z.string(),
|
|
135
|
+
value: z.any(),
|
|
136
|
+
})).optional().describe('Options for select type'),
|
|
137
|
+
});
|
|
138
|
+
/**
|
|
139
|
+
* Filter Builder Schema - Filter builder component
|
|
140
|
+
*/
|
|
141
|
+
export const FilterBuilderSchema = BaseSchema.extend({
|
|
142
|
+
type: z.literal('filter-builder'),
|
|
143
|
+
fields: z.array(FilterFieldSchema).describe('Available filter fields'),
|
|
144
|
+
defaultValue: z.union([FilterConditionSchema, FilterGroupSchema]).optional().describe('Default filter value'),
|
|
145
|
+
value: z.union([FilterConditionSchema, FilterGroupSchema]).optional().describe('Controlled filter value'),
|
|
146
|
+
onChange: z.function().optional().describe('Change handler'),
|
|
147
|
+
allowGroups: z.boolean().optional().describe('Allow grouped conditions'),
|
|
148
|
+
maxDepth: z.number().optional().describe('Maximum nesting depth'),
|
|
149
|
+
});
|
|
150
|
+
/**
|
|
151
|
+
* Carousel Item Schema
|
|
152
|
+
*/
|
|
153
|
+
export const CarouselItemSchema = z.object({
|
|
154
|
+
id: z.string().optional().describe('Item ID'),
|
|
155
|
+
content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Item content'),
|
|
156
|
+
});
|
|
157
|
+
/**
|
|
158
|
+
* Carousel Schema - Carousel component
|
|
159
|
+
*/
|
|
160
|
+
export const CarouselSchema = BaseSchema.extend({
|
|
161
|
+
type: z.literal('carousel'),
|
|
162
|
+
items: z.array(CarouselItemSchema).describe('Carousel items'),
|
|
163
|
+
autoPlay: z.number().optional().describe('Auto-play interval (ms)'),
|
|
164
|
+
showArrows: z.boolean().optional().describe('Show navigation arrows'),
|
|
165
|
+
showDots: z.boolean().optional().describe('Show navigation dots'),
|
|
166
|
+
loop: z.boolean().optional().describe('Enable infinite loop'),
|
|
167
|
+
itemsPerView: z.number().optional().describe('Items per view'),
|
|
168
|
+
gap: z.number().optional().describe('Gap between items'),
|
|
169
|
+
onSlideChange: z.function().optional().describe('Slide change handler'),
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* Chat Message Schema
|
|
173
|
+
*/
|
|
174
|
+
export const ChatMessageSchema = z.object({
|
|
175
|
+
id: z.string().describe('Message ID'),
|
|
176
|
+
role: z.enum(['user', 'assistant', 'system']).describe('Message role'),
|
|
177
|
+
content: z.string().describe('Message content'),
|
|
178
|
+
timestamp: z.union([z.string(), z.date()]).optional().describe('Message timestamp'),
|
|
179
|
+
metadata: z.record(z.string(), z.any()).optional().describe('Custom metadata'),
|
|
180
|
+
});
|
|
181
|
+
/**
|
|
182
|
+
* Chatbot Schema - Chatbot component
|
|
183
|
+
*/
|
|
184
|
+
export const ChatbotSchema = BaseSchema.extend({
|
|
185
|
+
type: z.literal('chatbot'),
|
|
186
|
+
messages: z.array(ChatMessageSchema).describe('Chat messages'),
|
|
187
|
+
placeholder: z.string().optional().describe('Input placeholder'),
|
|
188
|
+
loading: z.boolean().optional().describe('Whether chat is loading'),
|
|
189
|
+
onSendMessage: z.function().optional().describe('Send message handler'),
|
|
190
|
+
showAvatars: z.boolean().optional().describe('Show user avatars'),
|
|
191
|
+
userAvatar: z.string().optional().describe('User avatar URL'),
|
|
192
|
+
assistantAvatar: z.string().optional().describe('Assistant avatar URL'),
|
|
193
|
+
markdown: z.boolean().optional().describe('Enable markdown rendering'),
|
|
194
|
+
height: z.union([z.string(), z.number()]).optional().describe('Chatbot height'),
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* Dashboard Widget Layout Schema
|
|
198
|
+
*/
|
|
199
|
+
export const DashboardWidgetLayoutSchema = z.object({
|
|
200
|
+
x: z.number().describe('Grid x position'),
|
|
201
|
+
y: z.number().describe('Grid y position'),
|
|
202
|
+
w: z.number().describe('Grid width'),
|
|
203
|
+
h: z.number().describe('Grid height'),
|
|
204
|
+
});
|
|
205
|
+
/**
|
|
206
|
+
* Dashboard Widget Schema
|
|
207
|
+
*/
|
|
208
|
+
export const DashboardWidgetSchema = z.object({
|
|
209
|
+
id: z.string().describe('Widget ID'),
|
|
210
|
+
title: z.string().optional().describe('Widget Title'),
|
|
211
|
+
component: SchemaNodeSchema.describe('Widget Component'),
|
|
212
|
+
layout: DashboardWidgetLayoutSchema.optional().describe('Widget Layout'),
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* Dashboard Schema - Dashboard component
|
|
216
|
+
*/
|
|
217
|
+
export const DashboardSchema = BaseSchema.extend({
|
|
218
|
+
type: z.literal('dashboard'),
|
|
219
|
+
columns: z.number().optional().describe('Number of columns'),
|
|
220
|
+
gap: z.number().optional().describe('Grid gap'),
|
|
221
|
+
widgets: z.array(DashboardWidgetSchema).describe('Dashboard widgets'),
|
|
222
|
+
});
|
|
223
|
+
/**
|
|
224
|
+
* Complex Schema Union - All complex component schemas
|
|
225
|
+
*/
|
|
226
|
+
export const ComplexSchema = z.union([
|
|
227
|
+
KanbanSchema,
|
|
228
|
+
CalendarViewSchema,
|
|
229
|
+
FilterBuilderSchema,
|
|
230
|
+
CarouselSchema,
|
|
231
|
+
ChatbotSchema,
|
|
232
|
+
DashboardSchema,
|
|
233
|
+
]);
|