-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.ts
More file actions
340 lines (318 loc) · 9 KB
/
index.ts
File metadata and controls
340 lines (318 loc) · 9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/**
* @object-ui/types
*
* Pure TypeScript type definitions for Object UI - The Protocol Layer.
*
* This package contains ZERO runtime dependencies and defines the complete
* JSON schema protocol for the Object UI ecosystem.
*
* ## Philosophy
*
* Object UI follows a "Schema First" approach where:
* 1. Types define the protocol (this package)
* 2. Core implements the engine (@object-ui/core)
* 3. React provides the framework bindings (@object-ui/react)
* 4. Components provide the UI implementation (@object-ui/components)
*
* ## Design Principles
*
* - **Protocol Agnostic**: Works with any backend (REST, GraphQL, ObjectQL)
* - **Framework Agnostic**: Types can be used with React, Vue, or vanilla JS
* - **Zero Dependencies**: Pure TypeScript with no runtime dependencies
* - **Tailwind Native**: Designed for Tailwind CSS styling via className
* - **Type Safe**: Full TypeScript support with strict typing
*
* ## Usage
*
* ```typescript
* import type { InputSchema, FormSchema, ButtonSchema } from '@object-ui/types';
*
* const loginForm: FormSchema = {
* type: 'form',
* fields: [
* { name: 'email', type: 'input', inputType: 'email', required: true },
* { name: 'password', type: 'input', inputType: 'password', required: true }
* ]
* };
* ```
*
* @packageDocumentation
*/
// ============================================================================
// Application - Global Configuration
// ============================================================================
export type {
AppSchema,
AppAction,
MenuItem as AppMenuItem
} from './app';
// ============================================================================
// Base Types - The Foundation
// ============================================================================
export type {
BaseSchema,
SchemaNode,
ComponentRendererProps,
ComponentInput,
ComponentMeta,
ComponentConfig,
HTMLAttributes,
EventHandlers,
StyleProps,
} from './base';
// ============================================================================
// Layout Components - Structure & Organization
// ============================================================================
export type {
DivSchema,
SpanSchema,
TextSchema,
ImageSchema,
IconSchema,
SeparatorSchema,
ContainerSchema,
FlexSchema,
StackSchema,
GridSchema,
CardSchema,
TabsSchema,
TabItem,
ScrollAreaSchema,
ResizableSchema,
ResizablePanel,
LayoutSchema,
PageSchema,
} from './layout';
// ============================================================================
// Form Components - User Input & Interaction
// ============================================================================
export type {
ButtonSchema,
InputSchema,
TextareaSchema,
SelectSchema,
SelectOption,
CheckboxSchema,
RadioGroupSchema,
RadioOption,
SwitchSchema,
ToggleSchema,
SliderSchema,
FileUploadSchema,
DatePickerSchema,
CalendarSchema,
InputOTPSchema,
ValidationRule,
FieldCondition,
FormField,
FormSchema,
LabelSchema,
FormComponentSchema,
} from './form';
// ============================================================================
// Data Display Components - Information Presentation
// ============================================================================
export type {
AlertSchema,
BadgeSchema,
AvatarSchema,
ListSchema,
ListItem,
TableColumn,
TableSchema,
DataTableSchema,
MarkdownSchema,
TreeNode,
TreeViewSchema,
ChartType,
ChartSeries,
ChartSchema,
TimelineEvent,
TimelineSchema,
HtmlSchema,
StatisticSchema,
DataDisplaySchema,
} from './data-display';
// ============================================================================
// Feedback Components - Status & Progress Indication
// ============================================================================
export type {
LoadingSchema,
ProgressSchema,
SkeletonSchema,
ToastSchema,
ToasterSchema,
FeedbackSchema,
} from './feedback';
// ============================================================================
// Disclosure Components - Collapsible Content
// ============================================================================
export type {
AccordionItem,
AccordionSchema,
CollapsibleSchema,
DisclosureSchema,
} from './disclosure';
// ============================================================================
// Overlay Components - Modals & Popovers
// ============================================================================
export type {
OverlayPosition,
OverlayAlignment,
DialogSchema,
AlertDialogSchema,
SheetSchema,
DrawerSchema,
PopoverSchema,
TooltipSchema,
HoverCardSchema,
MenuItem,
DropdownMenuSchema,
ContextMenuSchema,
OverlaySchema,
} from './overlay';
// ============================================================================
// Navigation Components - Menus & Navigation
// ============================================================================
export type {
NavLink,
HeaderBarSchema,
SidebarSchema,
BreadcrumbItem,
BreadcrumbSchema,
PaginationSchema,
NavigationSchema,
} from './navigation';
// ============================================================================
// Complex Components - Advanced/Composite Components
// ============================================================================
export type {
KanbanColumn,
KanbanCard,
KanbanSchema,
CalendarViewMode,
CalendarEvent,
CalendarViewSchema,
FilterOperator,
FilterCondition,
FilterGroup,
FilterBuilderSchema,
FilterField,
CarouselItem,
CarouselSchema,
ChatMessage,
ChatbotSchema,
ComplexSchema,
} from './complex';
// ============================================================================
// Data Management - Backend Integration
// ============================================================================
export type {
QueryParams,
QueryResult,
DataSource,
DataScope,
DataContext,
DataBinding,
ValidationError,
APIError,
} from './data';
// ============================================================================
// CRUD Components - Create, Read, Update, Delete Operations
// ============================================================================
export type {
ActionSchema,
CRUDOperation,
CRUDFilter,
CRUDToolbar,
CRUDPagination,
CRUDSchema,
DetailSchema,
CRUDDialogSchema,
CRUDComponentSchema,
} from './crud';
// ============================================================================
// API and Events - API Integration and Event Handling
// ============================================================================
export type {
HTTPMethod,
APIRequest,
APIConfig,
EventHandler,
EventableSchema,
DataFetchConfig,
DataFetchableSchema,
ExpressionContext,
ExpressionSchema,
APISchema,
} from './api-types';
// ============================================================================
// Union Types - Discriminated Unions for All Schemas
// ============================================================================
import type { BaseSchema, SchemaNode } from './base';
import type { LayoutSchema } from './layout';
import type { FormComponentSchema } from './form';
import type { DataDisplaySchema } from './data-display';
import type { FeedbackSchema } from './feedback';
import type { DisclosureSchema } from './disclosure';
import type { OverlaySchema } from './overlay';
import type { NavigationSchema } from './navigation';
import type { ComplexSchema } from './complex';
import type { CRUDComponentSchema } from './crud';
import type { AppSchema } from './app';
/**
* Union of all component schemas.
* Use this for generic component rendering where the type is determined at runtime.
*/
export type AnySchema =
| AppSchema
| BaseSchema
| LayoutSchema
| FormComponentSchema
| DataDisplaySchema
| FeedbackSchema
| DisclosureSchema
| OverlaySchema
| NavigationSchema
| ComplexSchema
| CRUDComponentSchema;
/**
* Utility type to extract the schema type from a type string.
* Useful for type narrowing in renderers.
*
* @example
* ```typescript
* function renderComponent<T extends string>(schema: SchemaByType<T>) {
* // schema is now typed based on the type string
* }
* ```
*/
export type SchemaByType<T extends string> = Extract<AnySchema, { type: T }>;
/**
* Utility type to make all properties optional except the type.
* Useful for partial schema definitions in editors.
*/
export type PartialSchema<T extends BaseSchema> = {
type: T['type'];
} & Partial<Omit<T, 'type'>>;
/**
* Schema with required children (for container components).
*/
export type ContainerSchemaWithChildren = BaseSchema & {
children: SchemaNode | SchemaNode[];
};
/**
* Version information
*/
export const VERSION = '0.1.0';
/**
* Schema version for compatibility checking
*/
export const SCHEMA_VERSION = '1.0.0';
// ============================================================================
// Schema Registry - The Type Map
// ============================================================================
export type {
SchemaRegistry,
ComponentType,
} from './registry';