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