@object-ui/core 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/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # @object-ui/core
2
+
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Unified version across all packages to 0.3.0 for consistent versioning
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - New plugin-object and ObjectQL SDK updates
14
+
15
+ **Added:**
16
+ - New Plugin: @object-ui/plugin-object - ObjectQL plugin for automatic table and form generation
17
+ - ObjectTable: Auto-generates tables from ObjectQL object schemas
18
+ - ObjectForm: Auto-generates forms from ObjectQL object schemas with create/edit/view modes
19
+ - Full TypeScript support with comprehensive type definitions
20
+ - Type Definitions: Added ObjectTableSchema and ObjectFormSchema to @object-ui/types
21
+ - ObjectQL Integration: Enhanced ObjectQLDataSource with getObjectSchema() method using MetadataApiClient
22
+
23
+ **Changed:**
24
+ - Updated @objectql/sdk from ^1.8.3 to ^1.9.1
25
+ - Updated @objectql/types from ^1.8.3 to ^1.9.1
26
+
27
+ - Updated dependencies
28
+ - @object-ui/types@0.3.0
29
+
30
+ ## 0.2.1
31
+
32
+ ### Patch Changes
33
+
34
+ - Patch release: Add automated changeset workflow and CI/CD improvements
35
+
36
+ This release includes infrastructure improvements:
37
+ - Added changeset-based version management
38
+ - Enhanced CI/CD workflows with GitHub Actions
39
+ - Improved documentation for contributing and releasing
40
+
41
+ - Updated dependencies
42
+ - @object-ui/types@0.2.1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ObjectQL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # @object-ui/core
2
+
3
+ Core logic, types, and validation for Object UI. Zero React dependencies.
4
+
5
+ ## Features
6
+
7
+ - 🎯 **Type Definitions** - Complete TypeScript schemas for all components
8
+ - 🔍 **Component Registry** - Framework-agnostic component registration system
9
+ - 📊 **Data Scope** - Data scope management and expression evaluation
10
+ - ✅ **Validation** - Zod-based schema validation
11
+ - 🚀 **Zero React** - Can run in Node.js or any JavaScript environment
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @object-ui/core
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ### Type Definitions
22
+
23
+ ```typescript
24
+ import type {
25
+ PageSchema,
26
+ FormSchema,
27
+ InputSchema,
28
+ BaseSchema
29
+ } from '@object-ui/core'
30
+
31
+ const mySchema: PageSchema = {
32
+ type: 'page',
33
+ title: 'My Page',
34
+ body: []
35
+ }
36
+ ```
37
+
38
+ ### Component Registry
39
+
40
+ ```typescript
41
+ import { ComponentRegistry } from '@object-ui/core'
42
+
43
+ const registry = new ComponentRegistry()
44
+ registry.register('button', buttonMetadata)
45
+ const metadata = registry.get('button')
46
+ ```
47
+
48
+ ### Data Scope
49
+
50
+ ```typescript
51
+ import { DataScope } from '@object-ui/core'
52
+
53
+ const scope = new DataScope({
54
+ user: { name: 'John', role: 'admin' }
55
+ })
56
+
57
+ const userName = scope.get('user.name') // 'John'
58
+ const isAdmin = scope.evaluate('${user.role === "admin"}') // true
59
+ ```
60
+
61
+ ## Philosophy
62
+
63
+ This package is designed to be **framework-agnostic**. It contains:
64
+
65
+ - ✅ Pure TypeScript types and interfaces
66
+ - ✅ Core logic and utilities
67
+ - ✅ Validation schemas
68
+ - ❌ NO React components
69
+ - ❌ NO UI rendering logic
70
+ - ❌ NO framework dependencies
71
+
72
+ This allows the core types and logic to be used in:
73
+ - Build tools and CLI utilities
74
+ - Backend validation
75
+ - Code generators
76
+ - Alternative framework adapters (Vue, Svelte, etc.)
77
+
78
+ ## API Reference
79
+
80
+ See [full documentation](https://objectui.org/api/core) for detailed API reference.
81
+
82
+ ## License
83
+
84
+ MIT
@@ -0,0 +1,287 @@
1
+ /**
2
+ * @object-ui/core - Schema Builder
3
+ *
4
+ * Fluent API for building schemas programmatically.
5
+ * Provides type-safe builder functions for common schema patterns.
6
+ *
7
+ * @module builder
8
+ * @packageDocumentation
9
+ */
10
+ import type { BaseSchema, FormSchema, FormField, CRUDSchema, TableColumn, ActionSchema, ButtonSchema, InputSchema, CardSchema, GridSchema, FlexSchema } from '@object-ui/types';
11
+ /**
12
+ * Base builder class
13
+ */
14
+ declare class SchemaBuilder<T extends BaseSchema> {
15
+ protected schema: any;
16
+ constructor(type: string);
17
+ /**
18
+ * Set the ID
19
+ */
20
+ id(id: string): this;
21
+ /**
22
+ * Set the className
23
+ */
24
+ className(className: string): this;
25
+ /**
26
+ * Set visibility
27
+ */
28
+ visible(visible: boolean): this;
29
+ /**
30
+ * Set conditional visibility
31
+ */
32
+ visibleOn(expression: string): this;
33
+ /**
34
+ * Set disabled state
35
+ */
36
+ disabled(disabled: boolean): this;
37
+ /**
38
+ * Set test ID
39
+ */
40
+ testId(testId: string): this;
41
+ /**
42
+ * Build the final schema
43
+ */
44
+ build(): T;
45
+ }
46
+ /**
47
+ * Form builder
48
+ */
49
+ export declare class FormBuilder extends SchemaBuilder<FormSchema> {
50
+ constructor();
51
+ /**
52
+ * Add a field to the form
53
+ */
54
+ field(field: FormField): this;
55
+ /**
56
+ * Add multiple fields
57
+ */
58
+ fields(fields: FormField[]): this;
59
+ /**
60
+ * Set default values
61
+ */
62
+ defaultValues(values: Record<string, any>): this;
63
+ /**
64
+ * Set submit label
65
+ */
66
+ submitLabel(label: string): this;
67
+ /**
68
+ * Set form layout
69
+ */
70
+ layout(layout: 'vertical' | 'horizontal'): this;
71
+ /**
72
+ * Set number of columns
73
+ */
74
+ columns(columns: number): this;
75
+ /**
76
+ * Set submit handler
77
+ */
78
+ onSubmit(handler: (data: Record<string, any>) => void | Promise<void>): this;
79
+ }
80
+ /**
81
+ * CRUD builder
82
+ */
83
+ export declare class CRUDBuilder extends SchemaBuilder<CRUDSchema> {
84
+ constructor();
85
+ /**
86
+ * Set resource name
87
+ */
88
+ resource(resource: string): this;
89
+ /**
90
+ * Set API endpoint
91
+ */
92
+ api(api: string): this;
93
+ /**
94
+ * Set title
95
+ */
96
+ title(title: string): this;
97
+ /**
98
+ * Set description
99
+ */
100
+ description(description: string): this;
101
+ /**
102
+ * Add a column
103
+ */
104
+ column(column: TableColumn): this;
105
+ /**
106
+ * Set all columns
107
+ */
108
+ columns(columns: TableColumn[]): this;
109
+ /**
110
+ * Set form fields
111
+ */
112
+ fields(fields: FormField[]): this;
113
+ /**
114
+ * Enable create operation
115
+ */
116
+ enableCreate(label?: string): this;
117
+ /**
118
+ * Enable update operation
119
+ */
120
+ enableUpdate(label?: string): this;
121
+ /**
122
+ * Enable delete operation
123
+ */
124
+ enableDelete(label?: string, confirmText?: string): this;
125
+ /**
126
+ * Set pagination
127
+ */
128
+ pagination(pageSize?: number): this;
129
+ /**
130
+ * Enable row selection
131
+ */
132
+ selectable(mode?: 'single' | 'multiple'): this;
133
+ /**
134
+ * Add a batch action
135
+ */
136
+ batchAction(action: ActionSchema): this;
137
+ /**
138
+ * Add a row action
139
+ */
140
+ rowAction(action: ActionSchema): this;
141
+ }
142
+ /**
143
+ * Button builder
144
+ */
145
+ export declare class ButtonBuilder extends SchemaBuilder<ButtonSchema> {
146
+ constructor();
147
+ /**
148
+ * Set button label
149
+ */
150
+ label(label: string): this;
151
+ /**
152
+ * Set button variant
153
+ */
154
+ variant(variant: 'default' | 'secondary' | 'destructive' | 'outline' | 'ghost' | 'link'): this;
155
+ /**
156
+ * Set button size
157
+ */
158
+ size(size: 'default' | 'sm' | 'lg' | 'icon'): this;
159
+ /**
160
+ * Set button icon
161
+ */
162
+ icon(icon: string): this;
163
+ /**
164
+ * Set click handler
165
+ */
166
+ onClick(handler: () => void | Promise<void>): this;
167
+ /**
168
+ * Set loading state
169
+ */
170
+ loading(loading: boolean): this;
171
+ }
172
+ /**
173
+ * Input builder
174
+ */
175
+ export declare class InputBuilder extends SchemaBuilder<InputSchema> {
176
+ constructor();
177
+ /**
178
+ * Set field name
179
+ */
180
+ name(name: string): this;
181
+ /**
182
+ * Set label
183
+ */
184
+ label(label: string): this;
185
+ /**
186
+ * Set placeholder
187
+ */
188
+ placeholder(placeholder: string): this;
189
+ /**
190
+ * Set input type
191
+ */
192
+ inputType(type: 'text' | 'email' | 'password' | 'number' | 'tel' | 'url'): this;
193
+ /**
194
+ * Mark as required
195
+ */
196
+ required(required?: boolean): this;
197
+ /**
198
+ * Set default value
199
+ */
200
+ defaultValue(value: string | number): this;
201
+ }
202
+ /**
203
+ * Card builder
204
+ */
205
+ export declare class CardBuilder extends SchemaBuilder<CardSchema> {
206
+ constructor();
207
+ /**
208
+ * Set card title
209
+ */
210
+ title(title: string): this;
211
+ /**
212
+ * Set card description
213
+ */
214
+ description(description: string): this;
215
+ /**
216
+ * Set card content
217
+ */
218
+ content(content: BaseSchema | BaseSchema[]): this;
219
+ /**
220
+ * Set card variant
221
+ */
222
+ variant(variant: 'default' | 'outline' | 'ghost'): this;
223
+ /**
224
+ * Make card hoverable
225
+ */
226
+ hoverable(hoverable?: boolean): this;
227
+ }
228
+ /**
229
+ * Grid builder
230
+ */
231
+ export declare class GridBuilder extends SchemaBuilder<GridSchema> {
232
+ constructor();
233
+ /**
234
+ * Set number of columns
235
+ */
236
+ columns(columns: number): this;
237
+ /**
238
+ * Set gap
239
+ */
240
+ gap(gap: number): this;
241
+ /**
242
+ * Add a child
243
+ */
244
+ child(child: BaseSchema): this;
245
+ /**
246
+ * Set all children
247
+ */
248
+ children(children: BaseSchema[]): this;
249
+ }
250
+ /**
251
+ * Flex builder
252
+ */
253
+ export declare class FlexBuilder extends SchemaBuilder<FlexSchema> {
254
+ constructor();
255
+ /**
256
+ * Set flex direction
257
+ */
258
+ direction(direction: 'row' | 'col' | 'row-reverse' | 'col-reverse'): this;
259
+ /**
260
+ * Set justify content
261
+ */
262
+ justify(justify: 'start' | 'end' | 'center' | 'between' | 'around' | 'evenly'): this;
263
+ /**
264
+ * Set align items
265
+ */
266
+ align(align: 'start' | 'end' | 'center' | 'baseline' | 'stretch'): this;
267
+ /**
268
+ * Set gap
269
+ */
270
+ gap(gap: number): this;
271
+ /**
272
+ * Add a child
273
+ */
274
+ child(child: BaseSchema): this;
275
+ /**
276
+ * Set all children
277
+ */
278
+ children(children: BaseSchema[]): this;
279
+ }
280
+ export declare const form: () => FormBuilder;
281
+ export declare const crud: () => CRUDBuilder;
282
+ export declare const button: () => ButtonBuilder;
283
+ export declare const input: () => InputBuilder;
284
+ export declare const card: () => CardBuilder;
285
+ export declare const grid: () => GridBuilder;
286
+ export declare const flex: () => FlexBuilder;
287
+ export {};