@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,159 @@
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 - View Component Zod Validators
10
+ *
11
+ * Zod validation schemas for view components.
12
+ * Following @objectstack/spec UI specification format.
13
+ *
14
+ * @module zod/views
15
+ * @packageDocumentation
16
+ */
17
+ import { z } from 'zod';
18
+ import { BaseSchema, SchemaNodeSchema } from './base.zod.js';
19
+ /**
20
+ * View Type Schema
21
+ */
22
+ export const ViewTypeSchema = z.enum(['list', 'detail', 'grid', 'kanban', 'calendar', 'timeline', 'map']).describe('View type');
23
+ /**
24
+ * Detail View Field Schema
25
+ */
26
+ export const DetailViewFieldSchema = z.object({
27
+ name: z.string().describe('Field name/path'),
28
+ label: z.string().optional().describe('Display label'),
29
+ type: z.enum(['text', 'image', 'link', 'badge', 'date', 'datetime', 'json', 'html', 'markdown', 'custom']).optional().describe('Field type for rendering'),
30
+ format: z.string().optional().describe('Format string (e.g., date format)'),
31
+ render: SchemaNodeSchema.optional().describe('Custom renderer'),
32
+ value: z.any().optional().describe('Field value'),
33
+ readonly: z.boolean().optional().describe('Whether field is read-only'),
34
+ visible: z.union([z.boolean(), z.string()]).optional().describe('Field visibility condition'),
35
+ span: z.number().optional().describe('Span across columns (for grid layout)'),
36
+ });
37
+ /**
38
+ * Detail View Section Schema
39
+ */
40
+ export const DetailViewSectionSchema = z.object({
41
+ title: z.string().optional().describe('Section title'),
42
+ description: z.string().optional().describe('Section description'),
43
+ icon: z.string().optional().describe('Section icon'),
44
+ fields: z.array(DetailViewFieldSchema).describe('Fields in this section'),
45
+ collapsible: z.boolean().optional().describe('Collapsible section'),
46
+ defaultCollapsed: z.boolean().optional().describe('Default collapsed state'),
47
+ columns: z.number().optional().describe('Grid columns for field layout'),
48
+ visible: z.union([z.boolean(), z.string()]).optional().describe('Section visibility condition'),
49
+ });
50
+ /**
51
+ * Detail View Tab Schema
52
+ */
53
+ export const DetailViewTabSchema = z.object({
54
+ key: z.string().describe('Tab key/identifier'),
55
+ label: z.string().describe('Tab label'),
56
+ icon: z.string().optional().describe('Tab icon'),
57
+ content: z.union([SchemaNodeSchema, z.array(SchemaNodeSchema)]).describe('Tab content'),
58
+ visible: z.union([z.boolean(), z.string()]).optional().describe('Tab visibility condition'),
59
+ badge: z.union([z.string(), z.number()]).optional().describe('Badge count'),
60
+ });
61
+ /**
62
+ * Detail View Schema
63
+ */
64
+ export const DetailViewSchema = BaseSchema.extend({
65
+ type: z.literal('detail-view'),
66
+ title: z.string().optional().describe('Detail title'),
67
+ api: z.string().optional().describe('API endpoint to fetch detail data'),
68
+ resourceId: z.union([z.string(), z.number()]).optional().describe('Resource ID to display'),
69
+ objectName: z.string().optional().describe('Object name (for ObjectQL integration)'),
70
+ data: z.any().optional().describe('Data to display (if not fetching from API)'),
71
+ layout: z.enum(['vertical', 'horizontal', 'grid']).optional().describe('Layout mode'),
72
+ columns: z.number().optional().describe('Grid columns (for grid layout)'),
73
+ sections: z.array(DetailViewSectionSchema).optional().describe('Field sections for organized display'),
74
+ fields: z.array(DetailViewFieldSchema).optional().describe('Direct fields (without sections)'),
75
+ actions: z.array(z.any()).optional().describe('Actions available in detail view'),
76
+ tabs: z.array(DetailViewTabSchema).optional().describe('Tabs for additional content'),
77
+ showBack: z.boolean().optional().default(true).describe('Show back button'),
78
+ backUrl: z.string().optional().describe('Back button URL'),
79
+ onBack: z.string().optional().describe('Custom back action'),
80
+ showEdit: z.boolean().optional().describe('Show edit button'),
81
+ editUrl: z.string().optional().describe('Edit button URL'),
82
+ showDelete: z.boolean().optional().describe('Show delete button'),
83
+ deleteConfirmation: z.string().optional().describe('Delete confirmation message'),
84
+ loading: z.boolean().optional().default(true).describe('Whether to show loading state'),
85
+ header: SchemaNodeSchema.optional().describe('Custom header content'),
86
+ footer: SchemaNodeSchema.optional().describe('Custom footer content'),
87
+ related: z.array(z.object({
88
+ title: z.string().describe('Relation title'),
89
+ type: z.enum(['list', 'grid', 'table']).describe('Relation type'),
90
+ api: z.string().optional().describe('API endpoint for related data'),
91
+ data: z.array(z.any()).optional().describe('Static data'),
92
+ columns: z.array(z.any()).optional().describe('Columns for table view'),
93
+ fields: z.array(z.string()).optional().describe('Fields for list view'),
94
+ })).optional().describe('Related records section'),
95
+ });
96
+ /**
97
+ * View Switcher Schema
98
+ */
99
+ export const ViewSwitcherSchema = BaseSchema.extend({
100
+ type: z.literal('view-switcher'),
101
+ views: z.array(z.object({
102
+ type: ViewTypeSchema.describe('View type'),
103
+ label: z.string().optional().describe('View label'),
104
+ icon: z.string().optional().describe('View icon'),
105
+ schema: SchemaNodeSchema.optional().describe('View schema'),
106
+ })).describe('Available view types'),
107
+ defaultView: ViewTypeSchema.optional().describe('Default/active view'),
108
+ activeView: ViewTypeSchema.optional().describe('Current active view'),
109
+ variant: z.enum(['tabs', 'buttons', 'dropdown']).optional().describe('Switcher variant'),
110
+ position: z.enum(['top', 'bottom', 'left', 'right']).optional().describe('Switcher position'),
111
+ onViewChange: z.string().optional().describe('View change callback'),
112
+ persistPreference: z.boolean().optional().describe('Persist view preference'),
113
+ storageKey: z.string().optional().describe('Storage key for persisting view'),
114
+ });
115
+ /**
116
+ * Filter UI Schema
117
+ */
118
+ export const FilterUISchema = BaseSchema.extend({
119
+ type: z.literal('filter-ui'),
120
+ filters: z.array(z.object({
121
+ field: z.string().describe('Filter field'),
122
+ label: z.string().optional().describe('Filter label'),
123
+ type: z.enum(['text', 'number', 'select', 'date', 'date-range', 'boolean']).describe('Filter type'),
124
+ operator: z.enum(['equals', 'contains', 'startsWith', 'gt', 'lt', 'between', 'in']).optional().describe('Filter operator'),
125
+ options: z.array(z.object({ label: z.string(), value: z.any() })).optional().describe('Options for select filter'),
126
+ placeholder: z.string().optional().describe('Placeholder'),
127
+ })).describe('Available filters'),
128
+ values: z.record(z.string(), z.any()).optional().describe('Current filter values'),
129
+ onChange: z.string().optional().describe('Filter change callback'),
130
+ showClear: z.boolean().optional().describe('Show clear button'),
131
+ showApply: z.boolean().optional().describe('Show apply button'),
132
+ layout: z.enum(['inline', 'popover', 'drawer']).optional().describe('Filter layout'),
133
+ });
134
+ /**
135
+ * Sort UI Schema
136
+ */
137
+ export const SortUISchema = BaseSchema.extend({
138
+ type: z.literal('sort-ui'),
139
+ fields: z.array(z.object({
140
+ field: z.string().describe('Field name'),
141
+ label: z.string().optional().describe('Field label'),
142
+ })).describe('Sortable fields'),
143
+ sort: z.array(z.object({
144
+ field: z.string().describe('Field to sort by'),
145
+ direction: z.enum(['asc', 'desc']).describe('Sort direction'),
146
+ })).optional().describe('Current sort configuration'),
147
+ onChange: z.string().optional().describe('Sort change callback'),
148
+ multiple: z.boolean().optional().describe('Allow multiple sort fields'),
149
+ variant: z.enum(['dropdown', 'buttons']).optional().describe('UI variant'),
150
+ });
151
+ /**
152
+ * Union of all view schemas
153
+ */
154
+ export const ViewComponentSchema = z.union([
155
+ DetailViewSchema,
156
+ ViewSwitcherSchema,
157
+ FilterUISchema,
158
+ SortUISchema,
159
+ ]);
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@object-ui/types",
3
- "version": "0.3.1",
3
+ "version": "2.0.0",
4
4
  "description": "Pure TypeScript type definitions for Object UI - The Protocol Layer",
5
5
  "type": "module",
6
+ "sideEffects": false,
6
7
  "main": "./dist/index.js",
7
8
  "module": "./dist/index.js",
8
9
  "types": "./dist/index.d.ts",
@@ -75,7 +76,7 @@
75
76
  "directory": "packages/types"
76
77
  },
77
78
  "dependencies": {
78
- "@objectstack/spec": "^0.3.3",
79
+ "@objectstack/spec": "^2.0.7",
79
80
  "zod": "^4.3.6"
80
81
  },
81
82
  "devDependencies": {
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Test to verify ObjectStack Spec v2.0.1 namespace exports
3
+ */
4
+ import { describe, it, expect } from 'vitest';
5
+
6
+ describe('ObjectStack Spec v2.0.1 Namespace Exports', () => {
7
+ it('should export Data namespace', async () => {
8
+ const types = await import('../index');
9
+ // Data namespace should exist and have content
10
+ expect(types).toHaveProperty('defineStack');
11
+ });
12
+
13
+ it('should export UI types via spec', async () => {
14
+ // Verify that types can be imported from @object-ui/types
15
+ const types = await import('../index');
16
+ // defineStack and definePlugin should be exported
17
+ expect(typeof types.defineStack).toBe('function');
18
+ expect(typeof types.definePlugin).toBe('function');
19
+ });
20
+
21
+ it('should export ObjectStack schemas', async () => {
22
+ const types = await import('../index');
23
+ // ObjectStack capability schemas should be exported
24
+ expect(types.ObjectStackSchema).toBeDefined();
25
+ expect(types.ObjectStackDefinitionSchema).toBeDefined();
26
+ expect(types.ObjectStackCapabilitiesSchema).toBeDefined();
27
+ expect(types.ObjectOSCapabilitiesSchema).toBeDefined();
28
+ expect(types.ObjectQLCapabilitiesSchema).toBeDefined();
29
+ expect(types.ObjectUICapabilitiesSchema).toBeDefined();
30
+ });
31
+
32
+ it('should export VERSION constant', async () => {
33
+ const types = await import('../index');
34
+ expect(types.VERSION).toBeDefined();
35
+ });
36
+ });