@object-ui/types 0.3.1 → 2.0.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.
Files changed (141) hide show
  1. package/README.md +1 -1
  2. package/dist/ai.d.ts +376 -0
  3. package/dist/ai.d.ts.map +1 -0
  4. package/dist/ai.js +8 -0
  5. package/dist/app.d.ts +10 -0
  6. package/dist/app.d.ts.map +1 -1
  7. package/dist/blocks.d.ts +332 -0
  8. package/dist/blocks.d.ts.map +1 -0
  9. package/dist/blocks.js +8 -0
  10. package/dist/crud.d.ts +177 -3
  11. package/dist/crud.d.ts.map +1 -1
  12. package/dist/data-display.d.ts +35 -0
  13. package/dist/data-display.d.ts.map +1 -1
  14. package/dist/data-protocol.d.ts +1268 -0
  15. package/dist/data-protocol.d.ts.map +1 -0
  16. package/dist/data-protocol.js +8 -0
  17. package/dist/data.d.ts +74 -1
  18. package/dist/data.d.ts.map +1 -1
  19. package/dist/designer.d.ts +473 -0
  20. package/dist/designer.d.ts.map +1 -0
  21. package/dist/designer.js +8 -0
  22. package/dist/field-types.d.ts +353 -11
  23. package/dist/field-types.d.ts.map +1 -1
  24. package/dist/form.d.ts +35 -1
  25. package/dist/form.d.ts.map +1 -1
  26. package/dist/index.d.ts +58 -4
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +18 -0
  29. package/dist/layout.d.ts +63 -8
  30. package/dist/layout.d.ts.map +1 -1
  31. package/dist/mobile.d.ts +186 -0
  32. package/dist/mobile.d.ts.map +1 -0
  33. package/dist/mobile.js +8 -0
  34. package/dist/objectql.d.ts +337 -89
  35. package/dist/objectql.d.ts.map +1 -1
  36. package/dist/permissions.d.ts +150 -0
  37. package/dist/permissions.d.ts.map +1 -0
  38. package/dist/permissions.js +8 -0
  39. package/dist/plugin-scope.d.ts +194 -0
  40. package/dist/plugin-scope.d.ts.map +1 -0
  41. package/dist/plugin-scope.js +8 -0
  42. package/dist/reports.d.ts +336 -0
  43. package/dist/reports.d.ts.map +1 -0
  44. package/dist/reports.js +8 -0
  45. package/dist/tenant.d.ts +138 -0
  46. package/dist/tenant.d.ts.map +1 -0
  47. package/dist/tenant.js +8 -0
  48. package/dist/theme.d.ts +180 -0
  49. package/dist/theme.d.ts.map +1 -0
  50. package/dist/theme.js +8 -0
  51. package/dist/ui-action.d.ts +290 -0
  52. package/dist/ui-action.d.ts.map +1 -0
  53. package/dist/ui-action.js +8 -0
  54. package/dist/views.d.ts +427 -0
  55. package/dist/views.d.ts.map +1 -0
  56. package/dist/views.js +8 -0
  57. package/dist/widget.d.ts +181 -0
  58. package/dist/widget.d.ts.map +1 -0
  59. package/dist/widget.js +8 -0
  60. package/dist/workflow.d.ts +340 -0
  61. package/dist/workflow.d.ts.map +1 -0
  62. package/dist/workflow.js +8 -0
  63. package/dist/zod/app.zod.d.ts +120 -0
  64. package/dist/zod/app.zod.d.ts.map +1 -0
  65. package/dist/zod/app.zod.js +60 -0
  66. package/dist/zod/blocks.zod.d.ts +834 -0
  67. package/dist/zod/blocks.zod.d.ts.map +1 -0
  68. package/dist/zod/blocks.zod.js +145 -0
  69. package/dist/zod/complex.zod.d.ts +4 -4
  70. package/dist/zod/complex.zod.js +1 -1
  71. package/dist/zod/crud.zod.d.ts +598 -0
  72. package/dist/zod/crud.zod.d.ts.map +1 -0
  73. package/dist/zod/crud.zod.js +230 -0
  74. package/dist/zod/data-display.zod.js +1 -1
  75. package/dist/zod/disclosure.zod.js +1 -1
  76. package/dist/zod/feedback.zod.d.ts +10 -10
  77. package/dist/zod/feedback.zod.js +1 -1
  78. package/dist/zod/form.zod.d.ts +4 -4
  79. package/dist/zod/form.zod.js +1 -1
  80. package/dist/zod/index.zod.d.ts +2032 -30
  81. package/dist/zod/index.zod.d.ts.map +1 -1
  82. package/dist/zod/index.zod.js +96 -19
  83. package/dist/zod/layout.zod.d.ts +134 -2
  84. package/dist/zod/layout.zod.d.ts.map +1 -1
  85. package/dist/zod/layout.zod.js +35 -1
  86. package/dist/zod/navigation.zod.js +1 -1
  87. package/dist/zod/objectql.zod.d.ts +34 -18
  88. package/dist/zod/objectql.zod.d.ts.map +1 -1
  89. package/dist/zod/objectql.zod.js +9 -1
  90. package/dist/zod/overlay.zod.js +1 -1
  91. package/dist/zod/reports.zod.d.ts +1628 -0
  92. package/dist/zod/reports.zod.d.ts.map +1 -0
  93. package/dist/zod/reports.zod.js +152 -0
  94. package/dist/zod/theme.zod.d.ts +1292 -0
  95. package/dist/zod/theme.zod.d.ts.map +1 -0
  96. package/dist/zod/theme.zod.js +260 -0
  97. package/dist/zod/views.zod.d.ts +675 -0
  98. package/dist/zod/views.zod.d.ts.map +1 -0
  99. package/dist/zod/views.zod.js +159 -0
  100. package/package.json +3 -2
  101. package/src/__tests__/namespace-exports.test.ts +36 -0
  102. package/src/__tests__/phase2-schemas.test.ts +634 -0
  103. package/src/ai.ts +454 -0
  104. package/src/app.ts +12 -0
  105. package/src/blocks.ts +405 -0
  106. package/src/crud.ts +180 -3
  107. package/src/data-display.ts +31 -0
  108. package/src/data-protocol.ts +1679 -0
  109. package/src/data.ts +84 -1
  110. package/src/designer.ts +509 -0
  111. package/src/field-types.ts +392 -11
  112. package/src/form.ts +35 -1
  113. package/src/index.ts +426 -0
  114. package/src/layout.ts +66 -8
  115. package/src/mobile.ts +205 -0
  116. package/src/objectql.ts +412 -94
  117. package/src/permissions.ts +166 -0
  118. package/src/plugin-scope.ts +210 -0
  119. package/src/reports.ts +408 -0
  120. package/src/tenant.ts +153 -0
  121. package/src/theme.ts +238 -0
  122. package/src/ui-action.ts +415 -0
  123. package/src/views.ts +436 -0
  124. package/src/widget.ts +197 -0
  125. package/src/workflow.ts +409 -0
  126. package/src/zod/app.zod.ts +72 -0
  127. package/src/zod/blocks.zod.ts +170 -0
  128. package/src/zod/complex.zod.ts +1 -1
  129. package/src/zod/crud.zod.ts +259 -0
  130. package/src/zod/data-display.zod.ts +1 -1
  131. package/src/zod/disclosure.zod.ts +1 -1
  132. package/src/zod/feedback.zod.ts +1 -1
  133. package/src/zod/form.zod.ts +1 -1
  134. package/src/zod/index.zod.ts +178 -19
  135. package/src/zod/layout.zod.ts +39 -1
  136. package/src/zod/navigation.zod.ts +1 -1
  137. package/src/zod/objectql.zod.ts +9 -1
  138. package/src/zod/overlay.zod.ts +1 -1
  139. package/src/zod/reports.zod.ts +183 -0
  140. package/src/zod/theme.zod.ts +296 -0
  141. package/src/zod/views.zod.ts +182 -0
@@ -0,0 +1,409 @@
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
+ /**
10
+ * @object-ui/types - Workflow Schema
11
+ *
12
+ * Defines workflow UI types for visual workflow design, approval processes,
13
+ * and workflow instance tracking.
14
+ */
15
+
16
+ import type { BaseSchema } from './base';
17
+
18
+ /**
19
+ * Workflow lifecycle status
20
+ */
21
+ export type WorkflowStatus = 'draft' | 'active' | 'paused' | 'completed' | 'cancelled';
22
+
23
+ /**
24
+ * Types of nodes available in the workflow designer
25
+ */
26
+ export type WorkflowNodeType = 'start' | 'end' | 'task' | 'approval' | 'condition' | 'parallel' | 'delay' | 'notification' | 'script';
27
+
28
+ /**
29
+ * Types of edges connecting workflow nodes
30
+ */
31
+ export type WorkflowEdgeType = 'default' | 'conditional' | 'timeout';
32
+
33
+ /**
34
+ * Action that can be performed on a workflow node
35
+ */
36
+ export interface WorkflowNodeAction {
37
+ /**
38
+ * Action type
39
+ */
40
+ type: 'approve' | 'reject' | 'reassign' | 'comment' | 'escalate' | 'custom';
41
+
42
+ /**
43
+ * Display label for the action
44
+ */
45
+ label: string;
46
+
47
+ /**
48
+ * Target node to transition to after action
49
+ */
50
+ nextNodeId?: string;
51
+
52
+ /**
53
+ * Condition expression for action availability
54
+ */
55
+ condition?: string;
56
+ }
57
+
58
+ /**
59
+ * A node in the workflow graph
60
+ */
61
+ export interface WorkflowNode {
62
+ /**
63
+ * Unique node identifier
64
+ */
65
+ id: string;
66
+
67
+ /**
68
+ * Node type
69
+ */
70
+ type: WorkflowNodeType;
71
+
72
+ /**
73
+ * Display label
74
+ */
75
+ label: string;
76
+
77
+ /**
78
+ * Node description
79
+ */
80
+ description?: string;
81
+
82
+ /**
83
+ * Position in the workflow canvas
84
+ */
85
+ position?: { x: number; y: number };
86
+
87
+ /**
88
+ * Node-specific configuration
89
+ */
90
+ config?: Record<string, any>;
91
+
92
+ /**
93
+ * Assignee identifier
94
+ */
95
+ assignee?: string;
96
+
97
+ /**
98
+ * How the assignee is resolved
99
+ */
100
+ assigneeType?: 'user' | 'role' | 'group' | 'expression';
101
+
102
+ /**
103
+ * Timeout duration in minutes
104
+ */
105
+ timeout?: number;
106
+
107
+ /**
108
+ * Available actions for this node
109
+ */
110
+ actions?: WorkflowNodeAction[];
111
+ }
112
+
113
+ /**
114
+ * An edge connecting two workflow nodes
115
+ */
116
+ export interface WorkflowEdge {
117
+ /**
118
+ * Unique edge identifier
119
+ */
120
+ id: string;
121
+
122
+ /**
123
+ * Source node identifier
124
+ */
125
+ source: string;
126
+
127
+ /**
128
+ * Target node identifier
129
+ */
130
+ target: string;
131
+
132
+ /**
133
+ * Edge type
134
+ */
135
+ type?: WorkflowEdgeType;
136
+
137
+ /**
138
+ * Display label
139
+ */
140
+ label?: string;
141
+
142
+ /**
143
+ * Condition expression for conditional edges
144
+ */
145
+ condition?: string;
146
+ }
147
+
148
+ /**
149
+ * Rule governing how approvals are processed
150
+ */
151
+ export interface ApprovalRule {
152
+ /**
153
+ * Approval strategy type
154
+ */
155
+ type: 'any' | 'all' | 'majority' | 'sequential';
156
+
157
+ /**
158
+ * Minimum number of approvals required
159
+ */
160
+ minApprovals?: number;
161
+
162
+ /**
163
+ * Timeout duration in minutes
164
+ */
165
+ timeout?: number;
166
+
167
+ /**
168
+ * Identifier to escalate to on timeout
169
+ */
170
+ escalateTo?: string;
171
+
172
+ /**
173
+ * Expression that triggers automatic approval
174
+ */
175
+ autoApproveCondition?: string;
176
+ }
177
+
178
+ /**
179
+ * Variable definition for workflow context
180
+ */
181
+ export interface WorkflowVariable {
182
+ /**
183
+ * Variable name
184
+ */
185
+ name: string;
186
+
187
+ /**
188
+ * Variable data type
189
+ */
190
+ type: 'string' | 'number' | 'boolean' | 'date' | 'object';
191
+
192
+ /**
193
+ * Default value
194
+ */
195
+ defaultValue?: any;
196
+
197
+ /**
198
+ * Whether the variable is required
199
+ */
200
+ required?: boolean;
201
+ }
202
+
203
+ /**
204
+ * Workflow Schema - Main workflow definition
205
+ */
206
+ export interface WorkflowSchema extends BaseSchema {
207
+ type: 'workflow';
208
+
209
+ /**
210
+ * Workflow title
211
+ */
212
+ title?: string;
213
+
214
+ /**
215
+ * Workflow description
216
+ */
217
+ description?: string;
218
+
219
+ /**
220
+ * Current workflow status
221
+ */
222
+ status?: WorkflowStatus;
223
+
224
+ /**
225
+ * Workflow nodes
226
+ */
227
+ nodes: WorkflowNode[];
228
+
229
+ /**
230
+ * Workflow edges
231
+ */
232
+ edges: WorkflowEdge[];
233
+
234
+ /**
235
+ * Workflow variables
236
+ */
237
+ variables?: WorkflowVariable[];
238
+
239
+ /**
240
+ * Workflow version number
241
+ */
242
+ version?: number;
243
+ }
244
+
245
+ /**
246
+ * Workflow Designer Schema - Visual workflow editor component
247
+ */
248
+ export interface WorkflowDesignerSchema extends BaseSchema {
249
+ type: 'workflow-designer';
250
+
251
+ /**
252
+ * Workflow to edit
253
+ */
254
+ workflow?: WorkflowSchema;
255
+
256
+ /**
257
+ * Whether the designer is in read-only mode
258
+ */
259
+ readOnly?: boolean;
260
+
261
+ /**
262
+ * Show minimap navigation panel
263
+ */
264
+ showMinimap?: boolean;
265
+
266
+ /**
267
+ * Show designer toolbar
268
+ */
269
+ showToolbar?: boolean;
270
+
271
+ /**
272
+ * Save callback action
273
+ */
274
+ onSave?: string;
275
+
276
+ /**
277
+ * Publish callback action
278
+ */
279
+ onPublish?: string;
280
+ }
281
+
282
+ /**
283
+ * A single entry in the approval history
284
+ */
285
+ export interface ApprovalHistoryItem {
286
+ /**
287
+ * Node where the action was taken
288
+ */
289
+ nodeId: string;
290
+
291
+ /**
292
+ * Action that was performed
293
+ */
294
+ action: string;
295
+
296
+ /**
297
+ * Actor identifier
298
+ */
299
+ actor: string;
300
+
301
+ /**
302
+ * Display name of the actor
303
+ */
304
+ actorName?: string;
305
+
306
+ /**
307
+ * ISO 8601 timestamp of the action
308
+ */
309
+ timestamp: string;
310
+
311
+ /**
312
+ * Optional comment
313
+ */
314
+ comment?: string;
315
+ }
316
+
317
+ /**
318
+ * Approval Process Schema - Approval workflow UI component
319
+ */
320
+ export interface ApprovalProcessSchema extends BaseSchema {
321
+ type: 'approval-process';
322
+
323
+ /**
324
+ * Associated workflow identifier
325
+ */
326
+ workflowId?: string;
327
+
328
+ /**
329
+ * Workflow instance identifier
330
+ */
331
+ instanceId?: string;
332
+
333
+ /**
334
+ * Current active node identifier
335
+ */
336
+ currentNodeId?: string;
337
+
338
+ /**
339
+ * Approval rule configuration
340
+ */
341
+ approvalRule?: ApprovalRule;
342
+
343
+ /**
344
+ * Approval history entries
345
+ */
346
+ history?: ApprovalHistoryItem[];
347
+
348
+ /**
349
+ * Approval process data
350
+ */
351
+ data?: Record<string, any>;
352
+
353
+ /**
354
+ * Show approval history timeline
355
+ */
356
+ showHistory?: boolean;
357
+
358
+ /**
359
+ * Show comments section
360
+ */
361
+ showComments?: boolean;
362
+ }
363
+
364
+ /**
365
+ * Workflow Instance Schema - Runtime state of a workflow execution
366
+ */
367
+ export interface WorkflowInstanceSchema extends BaseSchema {
368
+ type: 'workflow-instance';
369
+
370
+ /**
371
+ * Associated workflow definition identifier
372
+ */
373
+ workflowId: string;
374
+
375
+ /**
376
+ * Unique instance identifier
377
+ */
378
+ instanceId: string;
379
+
380
+ /**
381
+ * Current instance status
382
+ */
383
+ status: WorkflowStatus;
384
+
385
+ /**
386
+ * Currently active node identifiers
387
+ */
388
+ currentNodes: string[];
389
+
390
+ /**
391
+ * Runtime variable values
392
+ */
393
+ variables?: Record<string, any>;
394
+
395
+ /**
396
+ * ISO 8601 timestamp when the instance started
397
+ */
398
+ startedAt?: string;
399
+
400
+ /**
401
+ * ISO 8601 timestamp when the instance completed
402
+ */
403
+ completedAt?: string;
404
+
405
+ /**
406
+ * Instance data payload
407
+ */
408
+ data?: Record<string, any>;
409
+ }
@@ -0,0 +1,72 @@
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
+ /**
10
+ * @object-ui/types/zod - Application Schema Zod Validators
11
+ *
12
+ * Zod validation schemas for top-level application configuration.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/app
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema } from './base.zod.js';
21
+
22
+ /**
23
+ * Menu Item Schema - Navigation menu item
24
+ */
25
+ export const MenuItemSchema: z.ZodType<any> = z.lazy(() => z.object({
26
+ type: z.enum(['item', 'group', 'separator']).optional().describe('Item type'),
27
+ label: z.string().optional().describe('Display label'),
28
+ icon: z.string().optional().describe('Icon name (Lucide)'),
29
+ path: z.string().optional().describe('Target path (route)'),
30
+ href: z.string().optional().describe('External link'),
31
+ children: z.array(MenuItemSchema).optional().describe('Child items (submenu)'),
32
+ badge: z.union([z.string(), z.number()]).optional().describe('Badge or count'),
33
+ hidden: z.union([z.boolean(), z.string()]).optional().describe('Visibility condition'),
34
+ }));
35
+
36
+ /**
37
+ * App Action Schema - Application header/toolbar action
38
+ */
39
+ export const AppActionSchema = z.object({
40
+ type: z.enum(['button', 'dropdown', 'user']).describe('Action type'),
41
+ label: z.string().optional().describe('Action label'),
42
+ icon: z.string().optional().describe('Icon name'),
43
+ onClick: z.string().optional().describe('Click handler expression'),
44
+ avatar: z.string().optional().describe('User avatar URL (for type="user")'),
45
+ description: z.string().optional().describe('Additional description (e.g., email for user)'),
46
+ items: z.array(MenuItemSchema).optional().describe('Dropdown menu items (for type="dropdown" or "user")'),
47
+ shortcut: z.string().optional().describe('Keyboard shortcut'),
48
+ variant: z.enum(['default', 'destructive', 'outline', 'secondary', 'ghost', 'link']).optional().describe('Button variant'),
49
+ size: z.enum(['default', 'sm', 'lg', 'icon']).optional().describe('Button size'),
50
+ });
51
+
52
+ /**
53
+ * App Schema - Top-level application configuration
54
+ */
55
+ export const AppSchema = BaseSchema.extend({
56
+ type: z.literal('app'),
57
+ name: z.string().optional().describe('Application name (system ID)'),
58
+ title: z.string().optional().describe('Display title'),
59
+ description: z.string().optional().describe('Application description'),
60
+ logo: z.string().optional().describe('Logo URL or icon name'),
61
+ favicon: z.string().optional().describe('Favicon URL'),
62
+ layout: z.enum(['sidebar', 'header', 'empty']).optional().default('sidebar').describe('Global layout strategy'),
63
+ menu: z.array(MenuItemSchema).optional().describe('Global navigation menu'),
64
+ actions: z.array(AppActionSchema).optional().describe('Global actions (user profile, settings, etc.)'),
65
+ });
66
+
67
+ /**
68
+ * Export type inference helpers
69
+ */
70
+ export type MenuItemSchemaType = z.infer<typeof MenuItemSchema>;
71
+ export type AppActionSchemaType = z.infer<typeof AppActionSchema>;
72
+ export type AppSchemaType = z.infer<typeof AppSchema>;
@@ -0,0 +1,170 @@
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
+ /**
10
+ * @object-ui/types/zod - Block Schema Zod Validators
11
+ *
12
+ * Zod validation schemas for reusable component blocks.
13
+ * Following @objectstack/spec UI specification format.
14
+ *
15
+ * @module zod/blocks
16
+ * @packageDocumentation
17
+ */
18
+
19
+ import { z } from 'zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
+
22
+ /**
23
+ * Block Variable Schema
24
+ */
25
+ export const BlockVariableSchema = z.object({
26
+ name: z.string().describe('Variable name'),
27
+ label: z.string().optional().describe('Display label'),
28
+ type: z.enum(['string', 'number', 'boolean', 'object', 'array', 'component']).optional().describe('Variable type'),
29
+ defaultValue: z.any().optional().describe('Default value'),
30
+ description: z.string().optional().describe('Description/help text'),
31
+ required: z.boolean().optional().describe('Whether this variable is required'),
32
+ validation: z.any().optional().describe('Validation rules'),
33
+ enum: z.array(z.any()).optional().describe('Enum options (for string/number types)'),
34
+ });
35
+
36
+ /**
37
+ * Block Slot Schema
38
+ */
39
+ export const BlockSlotSchema = z.object({
40
+ name: z.string().describe('Slot name'),
41
+ label: z.string().optional().describe('Display label'),
42
+ description: z.string().optional().describe('Description'),
43
+ defaultContent: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Default content'),
44
+ allowedTypes: z.array(z.string()).optional().describe('Allowed component types'),
45
+ maxChildren: z.number().optional().describe('Maximum number of children'),
46
+ required: z.boolean().optional().describe('Whether this slot is required'),
47
+ });
48
+
49
+ /**
50
+ * Block Metadata Schema
51
+ */
52
+ export const BlockMetadataSchema = z.object({
53
+ name: z.string().describe('Block name/identifier'),
54
+ label: z.string().optional().describe('Display label'),
55
+ description: z.string().optional().describe('Block description'),
56
+ category: z.string().optional().describe('Block category'),
57
+ icon: z.string().optional().describe('Block icon'),
58
+ tags: z.array(z.string()).optional().describe('Block tags for search'),
59
+ author: z.string().optional().describe('Author/creator'),
60
+ version: z.string().optional().describe('Version'),
61
+ license: z.string().optional().describe('License'),
62
+ repository: z.string().optional().describe('Repository URL'),
63
+ preview: z.string().optional().describe('Preview image URL'),
64
+ premium: z.boolean().optional().describe('Is this a premium/paid block'),
65
+ });
66
+
67
+ /**
68
+ * Block Schema
69
+ */
70
+ export const BlockSchema = BaseSchema.extend({
71
+ type: z.literal('block'),
72
+ meta: BlockMetadataSchema.optional().describe('Block metadata'),
73
+ variables: z.array(BlockVariableSchema).optional().describe('Block variables/props'),
74
+ slots: z.array(BlockSlotSchema).optional().describe('Block slots for content injection'),
75
+ template: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Block template (component tree)'),
76
+ values: z.record(z.string(), z.any()).optional().describe('Variable values (when using a block)'),
77
+ slotContent: z.record(z.string(), z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)])).optional().describe('Slot content (when using a block)'),
78
+ blockRef: z.string().optional().describe('Block reference (for reusing saved blocks)'),
79
+ editable: z.boolean().optional().describe('Enable edit mode'),
80
+ });
81
+
82
+ /**
83
+ * Block Library Item Schema
84
+ */
85
+ export const BlockLibraryItemSchema = z.object({
86
+ id: z.string().describe('Unique identifier'),
87
+ meta: BlockMetadataSchema.describe('Block metadata'),
88
+ schema: BlockSchema.describe('Block schema'),
89
+ installs: z.number().optional().describe('Installation count'),
90
+ rating: z.number().optional().describe('Rating (1-5)'),
91
+ ratingCount: z.number().optional().describe('Number of ratings'),
92
+ updatedAt: z.string().optional().describe('Last updated timestamp'),
93
+ createdAt: z.string().optional().describe('Created timestamp'),
94
+ });
95
+
96
+ /**
97
+ * Block Library Schema
98
+ */
99
+ export const BlockLibrarySchema = BaseSchema.extend({
100
+ type: z.literal('block-library'),
101
+ apiEndpoint: z.string().optional().describe('Library API endpoint'),
102
+ category: z.string().optional().describe('Filter by category'),
103
+ searchQuery: z.string().optional().describe('Search query'),
104
+ tags: z.array(z.string()).optional().describe('Filter by tags'),
105
+ showPremium: z.boolean().optional().describe('Show premium blocks'),
106
+ blocks: z.array(BlockLibraryItemSchema).optional().describe('Blocks to display'),
107
+ loading: z.boolean().optional().describe('Loading state'),
108
+ onInstall: z.string().optional().describe('Install callback'),
109
+ onPreview: z.string().optional().describe('Preview callback'),
110
+ });
111
+
112
+ /**
113
+ * Block Editor Schema
114
+ */
115
+ export const BlockEditorSchema = BaseSchema.extend({
116
+ type: z.literal('block-editor'),
117
+ block: BlockSchema.optional().describe('Block being edited'),
118
+ showVariables: z.boolean().optional().describe('Show variable editor'),
119
+ showSlots: z.boolean().optional().describe('Show slot editor'),
120
+ showTemplate: z.boolean().optional().describe('Show template editor'),
121
+ showPreview: z.boolean().optional().describe('Show preview'),
122
+ onSave: z.string().optional().describe('Save callback'),
123
+ onCancel: z.string().optional().describe('Cancel callback'),
124
+ });
125
+
126
+ /**
127
+ * Block Instance Schema
128
+ */
129
+ export const BlockInstanceSchema = BaseSchema.extend({
130
+ type: z.literal('block-instance'),
131
+ blockId: z.string().describe('Block reference ID'),
132
+ blockName: z.string().optional().describe('Block name (for local blocks)'),
133
+ values: z.record(z.string(), z.any()).optional().describe('Variable values'),
134
+ slotContent: z.record(z.string(), z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)])).optional().describe('Slot content'),
135
+ overrideStyles: z.boolean().optional().describe('Override styles'),
136
+ });
137
+
138
+ /**
139
+ * Component Schema
140
+ */
141
+ export const ComponentSchema = BaseSchema.extend({
142
+ type: z.literal('component'),
143
+ componentName: z.string().optional().describe('Component name/identifier'),
144
+ props: z.record(z.string(), z.any()).optional().describe('Component props'),
145
+ children: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).optional().describe('Component children'),
146
+ });
147
+
148
+ /**
149
+ * Union of all block schemas
150
+ */
151
+ export const BlockComponentSchema = z.union([
152
+ BlockSchema,
153
+ BlockLibrarySchema,
154
+ BlockEditorSchema,
155
+ BlockInstanceSchema,
156
+ ComponentSchema,
157
+ ]);
158
+
159
+ /**
160
+ * Export type inference helpers
161
+ */
162
+ export type BlockVariableSchemaType = z.infer<typeof BlockVariableSchema>;
163
+ export type BlockSlotSchemaType = z.infer<typeof BlockSlotSchema>;
164
+ export type BlockMetadataSchemaType = z.infer<typeof BlockMetadataSchema>;
165
+ export type BlockSchemaType = z.infer<typeof BlockSchema>;
166
+ export type BlockLibraryItemSchemaType = z.infer<typeof BlockLibraryItemSchema>;
167
+ export type BlockLibrarySchemaType = z.infer<typeof BlockLibrarySchema>;
168
+ export type BlockEditorSchemaType = z.infer<typeof BlockEditorSchema>;
169
+ export type BlockInstanceSchemaType = z.infer<typeof BlockInstanceSchema>;
170
+ export type ComponentSchemaType = z.infer<typeof ComponentSchema>;
@@ -17,7 +17,7 @@
17
17
  */
18
18
 
19
19
  import { z } from 'zod';
20
- import { BaseSchema, SchemaNodeSchema } from './base.zod';
20
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
21
21
 
22
22
  /**
23
23
  * Kanban Card Schema