@object-ui/types 0.5.0 → 3.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 (127) 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 +2 -2
  6. package/dist/complex.d.ts +2 -0
  7. package/dist/complex.d.ts.map +1 -1
  8. package/dist/crud.d.ts +3 -0
  9. package/dist/crud.d.ts.map +1 -1
  10. package/dist/data-display.d.ts +40 -0
  11. package/dist/data-display.d.ts.map +1 -1
  12. package/dist/data-protocol.d.ts +19 -19
  13. package/dist/data.d.ts +77 -0
  14. package/dist/data.d.ts.map +1 -1
  15. package/dist/designer.d.ts +473 -0
  16. package/dist/designer.d.ts.map +1 -0
  17. package/dist/designer.js +8 -0
  18. package/dist/form.d.ts +35 -1
  19. package/dist/form.d.ts.map +1 -1
  20. package/dist/index.d.ts +46 -8
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +18 -0
  23. package/dist/layout.d.ts +63 -8
  24. package/dist/layout.d.ts.map +1 -1
  25. package/dist/mobile.d.ts +186 -0
  26. package/dist/mobile.d.ts.map +1 -0
  27. package/dist/mobile.js +8 -0
  28. package/dist/objectql.d.ts +341 -88
  29. package/dist/objectql.d.ts.map +1 -1
  30. package/dist/permissions.d.ts +150 -0
  31. package/dist/permissions.d.ts.map +1 -0
  32. package/dist/permissions.js +8 -0
  33. package/dist/tenant.d.ts +138 -0
  34. package/dist/tenant.d.ts.map +1 -0
  35. package/dist/tenant.js +8 -0
  36. package/dist/theme.d.ts +115 -224
  37. package/dist/theme.d.ts.map +1 -1
  38. package/dist/ui-action.d.ts +126 -11
  39. package/dist/ui-action.d.ts.map +1 -1
  40. package/dist/views.d.ts +20 -0
  41. package/dist/views.d.ts.map +1 -1
  42. package/dist/widget.d.ts +181 -0
  43. package/dist/widget.d.ts.map +1 -0
  44. package/dist/widget.js +8 -0
  45. package/dist/workflow.d.ts +340 -0
  46. package/dist/workflow.d.ts.map +1 -0
  47. package/dist/workflow.js +8 -0
  48. package/dist/zod/blocks.zod.d.ts +2 -2
  49. package/dist/zod/blocks.zod.d.ts.map +1 -1
  50. package/dist/zod/blocks.zod.js +1 -1
  51. package/dist/zod/complex.zod.d.ts +6 -6
  52. package/dist/zod/complex.zod.d.ts.map +1 -1
  53. package/dist/zod/complex.zod.js +1 -1
  54. package/dist/zod/crud.zod.d.ts +5 -5
  55. package/dist/zod/data-display.zod.d.ts +2 -2
  56. package/dist/zod/data-display.zod.d.ts.map +1 -1
  57. package/dist/zod/data-display.zod.js +1 -1
  58. package/dist/zod/disclosure.zod.d.ts +2 -2
  59. package/dist/zod/disclosure.zod.d.ts.map +1 -1
  60. package/dist/zod/disclosure.zod.js +1 -1
  61. package/dist/zod/feedback.zod.d.ts +12 -12
  62. package/dist/zod/feedback.zod.d.ts.map +1 -1
  63. package/dist/zod/feedback.zod.js +1 -1
  64. package/dist/zod/form.zod.d.ts +6 -6
  65. package/dist/zod/form.zod.d.ts.map +1 -1
  66. package/dist/zod/form.zod.js +1 -1
  67. package/dist/zod/index.zod.d.ts +337 -146
  68. package/dist/zod/index.zod.d.ts.map +1 -1
  69. package/dist/zod/index.zod.js +4 -4
  70. package/dist/zod/layout.zod.d.ts +134 -2
  71. package/dist/zod/layout.zod.d.ts.map +1 -1
  72. package/dist/zod/layout.zod.js +35 -1
  73. package/dist/zod/navigation.zod.d.ts +2 -2
  74. package/dist/zod/navigation.zod.d.ts.map +1 -1
  75. package/dist/zod/navigation.zod.js +1 -1
  76. package/dist/zod/objectql.zod.d.ts +32 -16
  77. package/dist/zod/objectql.zod.d.ts.map +1 -1
  78. package/dist/zod/objectql.zod.js +8 -0
  79. package/dist/zod/overlay.zod.d.ts +2 -2
  80. package/dist/zod/overlay.zod.d.ts.map +1 -1
  81. package/dist/zod/overlay.zod.js +1 -1
  82. package/dist/zod/reports.zod.d.ts +19 -19
  83. package/dist/zod/reports.zod.d.ts.map +1 -1
  84. package/dist/zod/reports.zod.js +1 -1
  85. package/dist/zod/theme.zod.d.ts +948 -267
  86. package/dist/zod/theme.zod.d.ts.map +1 -1
  87. package/dist/zod/theme.zod.js +175 -45
  88. package/dist/zod/views.zod.d.ts +22 -22
  89. package/dist/zod/views.zod.d.ts.map +1 -1
  90. package/dist/zod/views.zod.js +1 -1
  91. package/package.json +3 -2
  92. package/src/__tests__/namespace-exports.test.ts +23 -68
  93. package/src/__tests__/phase2-schemas.test.ts +8 -13
  94. package/src/ai.ts +454 -0
  95. package/src/app.ts +2 -2
  96. package/src/complex.ts +2 -0
  97. package/src/crud.ts +3 -0
  98. package/src/data-display.ts +36 -0
  99. package/src/data-protocol.ts +19 -19
  100. package/src/data.ts +91 -0
  101. package/src/designer.ts +509 -0
  102. package/src/form.ts +35 -1
  103. package/src/index.ts +397 -8
  104. package/src/layout.ts +66 -8
  105. package/src/mobile.ts +205 -0
  106. package/src/objectql.ts +419 -93
  107. package/src/permissions.ts +166 -0
  108. package/src/tenant.ts +153 -0
  109. package/src/theme.ts +147 -260
  110. package/src/ui-action.ts +166 -27
  111. package/src/views.ts +17 -0
  112. package/src/widget.ts +197 -0
  113. package/src/workflow.ts +409 -0
  114. package/src/zod/blocks.zod.ts +1 -1
  115. package/src/zod/complex.zod.ts +1 -1
  116. package/src/zod/data-display.zod.ts +1 -1
  117. package/src/zod/disclosure.zod.ts +1 -1
  118. package/src/zod/feedback.zod.ts +1 -1
  119. package/src/zod/form.zod.ts +1 -1
  120. package/src/zod/index.zod.ts +14 -3
  121. package/src/zod/layout.zod.ts +39 -1
  122. package/src/zod/navigation.zod.ts +1 -1
  123. package/src/zod/objectql.zod.ts +8 -0
  124. package/src/zod/overlay.zod.ts +1 -1
  125. package/src/zod/reports.zod.ts +1 -1
  126. package/src/zod/theme.zod.ts +189 -48
  127. package/src/zod/views.zod.ts +1 -1
package/src/theme.ts CHANGED
@@ -8,281 +8,174 @@
8
8
 
9
9
  /**
10
10
  * @object-ui/types - Theme Schema
11
- *
12
- * Defines theme configuration for dynamic theme switching and customization.
11
+ *
12
+ * Defines theme configuration aligned with @objectstack/spec.
13
+ * Provides the complete design token system: colors, typography,
14
+ * spacing, borders, shadows, breakpoints, animation, z-index.
15
+ *
16
+ * @module theme
17
+ * @packageDocumentation
13
18
  */
14
19
 
15
20
  import type { BaseSchema } from './base';
16
21
 
22
+ // ============================================================================
23
+ // Spec-Canonical Theme Sub-types — imported from @objectstack/spec/ui
24
+ // Rule: "Never Redefine Types. ALWAYS import them."
25
+ // ============================================================================
26
+
17
27
  /**
18
28
  * Color Palette Definition
29
+ * Canonical definition from @objectstack/spec/ui.
19
30
  */
20
- export interface ColorPalette {
21
- /**
22
- * Primary brand color
23
- */
24
- primary?: string;
25
-
26
- /**
27
- * Secondary color
28
- */
29
- secondary?: string;
30
-
31
- /**
32
- * Accent color
33
- */
34
- accent?: string;
35
-
36
- /**
37
- * Background color
38
- */
39
- background?: string;
40
-
41
- /**
42
- * Foreground/text color
43
- */
44
- foreground?: string;
45
-
46
- /**
47
- * Muted color (for less prominent elements)
48
- */
49
- muted?: string;
50
-
51
- /**
52
- * Muted foreground color
53
- */
54
- mutedForeground?: string;
55
-
56
- /**
57
- * Border color
58
- */
59
- border?: string;
60
-
61
- /**
62
- * Input border color
63
- */
64
- input?: string;
65
-
66
- /**
67
- * Ring/focus color
68
- */
69
- ring?: string;
70
-
71
- /**
72
- * Success color
73
- */
74
- success?: string;
75
-
76
- /**
77
- * Warning color
78
- */
79
- warning?: string;
80
-
81
- /**
82
- * Error/destructive color
83
- */
84
- destructive?: string;
85
-
86
- /**
87
- * Info color
88
- */
89
- info?: string;
90
-
91
- /**
92
- * Card background color
93
- */
94
- card?: string;
95
-
96
- /**
97
- * Card foreground color
98
- */
99
- cardForeground?: string;
100
-
101
- /**
102
- * Popover background color
103
- */
104
- popover?: string;
105
-
106
- /**
107
- * Popover foreground color
108
- */
109
- popoverForeground?: string;
110
- }
31
+ export type { ColorPalette } from '@objectstack/spec/ui';
111
32
 
112
33
  /**
113
34
  * Typography Configuration
35
+ * Canonical definition from @objectstack/spec/ui.
114
36
  */
115
- export interface Typography {
116
- /**
117
- * Font family for sans-serif text
118
- */
119
- fontSans?: string[];
120
-
121
- /**
122
- * Font family for serif text
123
- */
124
- fontSerif?: string[];
125
-
126
- /**
127
- * Font family for monospace text
128
- */
129
- fontMono?: string[];
130
-
131
- /**
132
- * Base font size (in rem)
133
- */
134
- fontSize?: number;
135
-
136
- /**
137
- * Line height
138
- */
139
- lineHeight?: number;
140
-
141
- /**
142
- * Font weight for headings
143
- */
144
- headingWeight?: number;
145
-
146
- /**
147
- * Font weight for body text
148
- */
149
- bodyWeight?: number;
150
- }
37
+ export type { Typography } from '@objectstack/spec/ui';
151
38
 
152
39
  /**
153
40
  * Spacing Scale Configuration
41
+ * Canonical definition from @objectstack/spec/ui.
154
42
  */
155
- export interface SpacingScale {
156
- /**
157
- * Base spacing unit (in rem)
158
- */
159
- base?: number;
160
-
161
- /**
162
- * Custom spacing values
163
- */
164
- scale?: Record<string, string>;
165
- }
43
+ export type { Spacing } from '@objectstack/spec/ui';
166
44
 
167
45
  /**
168
46
  * Border Radius Configuration
47
+ * Canonical definition from @objectstack/spec/ui.
169
48
  */
170
- export interface BorderRadius {
171
- /**
172
- * Small radius
173
- */
174
- sm?: string;
175
-
176
- /**
177
- * Default radius
178
- */
179
- default?: string;
180
-
181
- /**
182
- * Medium radius
183
- */
184
- md?: string;
185
-
186
- /**
187
- * Large radius
188
- */
189
- lg?: string;
190
-
191
- /**
192
- * Extra large radius
193
- */
194
- xl?: string;
195
- }
49
+ export type { BorderRadius } from '@objectstack/spec/ui';
196
50
 
197
51
  /**
198
- * Theme Mode
52
+ * Shadow Configuration
53
+ * Canonical definition from @objectstack/spec/ui.
199
54
  */
200
- export type ThemeMode = 'light' | 'dark' | 'system';
55
+ export type { Shadow } from '@objectstack/spec/ui';
201
56
 
202
57
  /**
203
- * Complete Theme Definition
58
+ * Responsive Breakpoints Configuration
59
+ * Canonical definition from @objectstack/spec/ui.
204
60
  */
205
- export interface ThemeDefinition {
206
- /**
207
- * Theme name/identifier
208
- */
209
- name: string;
61
+ export type { Breakpoints } from '@objectstack/spec/ui';
210
62
 
211
- /**
212
- * Theme display label
213
- */
214
- label?: string;
63
+ /**
64
+ * Animation Configuration
65
+ * Canonical definition from @objectstack/spec/ui.
66
+ */
67
+ export type { Animation } from '@objectstack/spec/ui';
215
68
 
216
- /**
217
- * Light mode color palette
218
- */
219
- light?: ColorPalette;
69
+ /**
70
+ * Z-Index Layer Configuration
71
+ * Canonical definition from @objectstack/spec/ui.
72
+ */
73
+ export type { ZIndex } from '@objectstack/spec/ui';
220
74
 
221
- /**
222
- * Dark mode color palette
223
- */
224
- dark?: ColorPalette;
75
+ /**
76
+ * Theme Mode
77
+ * Canonical definition from @objectstack/spec/ui.
78
+ */
79
+ export type { ThemeMode } from '@objectstack/spec/ui';
80
+
81
+ // Import spec types for local use in interfaces below
82
+ import type {
83
+ ColorPalette,
84
+ Typography,
85
+ Spacing,
86
+ BorderRadius,
87
+ Shadow,
88
+ Breakpoints,
89
+ Animation,
90
+ ZIndex,
91
+ ThemeMode,
92
+ } from '@objectstack/spec/ui';
225
93
 
226
- /**
227
- * Typography configuration
228
- */
229
- typography?: Typography;
94
+ /**
95
+ * Logo / Branding Assets
96
+ * ObjectUI-specific convenience type matching the inline logo object
97
+ * in @objectstack/spec ThemeSchema.
98
+ */
99
+ export interface ThemeLogo {
100
+ /** Logo URL for light mode */
101
+ light?: string;
102
+ /** Logo URL for dark mode */
103
+ dark?: string;
104
+ /** Favicon URL */
105
+ favicon?: string;
106
+ }
230
107
 
231
- /**
232
- * Spacing scale configuration
233
- */
234
- spacing?: SpacingScale;
235
-
236
- /**
237
- * Border radius configuration
238
- */
239
- radius?: BorderRadius;
240
-
241
- /**
242
- * Custom CSS variables
243
- */
244
- cssVariables?: Record<string, string>;
245
-
246
- /**
247
- * Tailwind configuration overrides
248
- */
249
- tailwind?: Record<string, any>;
108
+ /**
109
+ * Complete Theme Definition
110
+ * Compatible with @objectstack/spec Theme (input shape).
111
+ *
112
+ * Note: The spec's z.infer<Theme> has `mode` required (via ZodDefault).
113
+ * ObjectUI uses the input shape where `mode` is optional (defaults to 'auto').
114
+ *
115
+ * This is the canonical JSON shape for a theme.
116
+ * It can be serialized, stored, and applied at runtime via ThemeProvider.
117
+ */
118
+ export interface Theme {
119
+ /** Theme identifier (required) */
120
+ name: string;
121
+ /** Display label (required) */
122
+ label: string;
123
+ /** Human-readable description */
124
+ description?: string;
125
+ /** Theme mode: light, dark, or auto (default: 'auto') */
126
+ mode?: ThemeMode;
127
+ /** Semantic color palette (primary is required) */
128
+ colors: ColorPalette;
129
+ /** Typography design tokens */
130
+ typography?: Typography;
131
+ /** Spacing scale */
132
+ spacing?: Spacing;
133
+ /** Border radius scale */
134
+ borderRadius?: BorderRadius;
135
+ /** Shadow scale */
136
+ shadows?: Shadow;
137
+ /** Responsive breakpoint definitions */
138
+ breakpoints?: Breakpoints;
139
+ /** Animation duration and timing */
140
+ animation?: Animation;
141
+ /** Z-index layering system */
142
+ zIndex?: ZIndex;
143
+ /** Arbitrary CSS custom properties */
144
+ customVars?: Record<string, string>;
145
+ /** Logo/branding assets */
146
+ logo?: ThemeLogo;
147
+ /** Extend another theme by name */
148
+ extends?: string;
250
149
  }
251
150
 
151
+ // ============================================================================
152
+ // ObjectUI Component Schemas (UI rendering)
153
+ // ============================================================================
154
+
252
155
  /**
253
- * Theme Schema - Theme configuration and switching
156
+ * Theme Component Schema
157
+ *
158
+ * Used by SchemaRenderer to render a theme manager component.
254
159
  */
255
160
  export interface ThemeSchema extends BaseSchema {
256
161
  type: 'theme';
257
162
 
258
- /**
259
- * Current theme mode
260
- */
163
+ /** Current theme mode */
261
164
  mode?: ThemeMode;
262
165
 
263
- /**
264
- * Available themes
265
- */
266
- themes?: ThemeDefinition[];
166
+ /** Available themes */
167
+ themes?: Theme[];
267
168
 
268
- /**
269
- * Active theme name
270
- */
169
+ /** Active theme name */
271
170
  activeTheme?: string;
272
171
 
273
- /**
274
- * Allow user theme switching
275
- */
172
+ /** Allow user theme switching */
276
173
  allowSwitching?: boolean;
277
174
 
278
- /**
279
- * Persist theme preference
280
- */
175
+ /** Persist theme preference to storage */
281
176
  persistPreference?: boolean;
282
177
 
283
- /**
284
- * Storage key for persisting theme
285
- */
178
+ /** Storage key for persisting theme */
286
179
  storageKey?: string;
287
180
  }
288
181
 
@@ -292,29 +185,19 @@ export interface ThemeSchema extends BaseSchema {
292
185
  export interface ThemeSwitcherSchema extends BaseSchema {
293
186
  type: 'theme-switcher';
294
187
 
295
- /**
296
- * Switcher variant
297
- */
188
+ /** Switcher variant */
298
189
  variant?: 'dropdown' | 'toggle' | 'buttons';
299
190
 
300
- /**
301
- * Show mode selector (light/dark)
302
- */
191
+ /** Show mode selector (light/dark) */
303
192
  showMode?: boolean;
304
193
 
305
- /**
306
- * Show theme selector
307
- */
194
+ /** Show theme selector */
308
195
  showThemes?: boolean;
309
196
 
310
- /**
311
- * Icon for light mode
312
- */
197
+ /** Icon for light mode */
313
198
  lightIcon?: string;
314
199
 
315
- /**
316
- * Icon for dark mode
317
- */
200
+ /** Icon for dark mode */
318
201
  darkIcon?: string;
319
202
  }
320
203
 
@@ -324,28 +207,32 @@ export interface ThemeSwitcherSchema extends BaseSchema {
324
207
  export interface ThemePreviewSchema extends BaseSchema {
325
208
  type: 'theme-preview';
326
209
 
327
- /**
328
- * Theme to preview
329
- */
330
- theme?: ThemeDefinition;
210
+ /** Theme to preview */
211
+ theme?: Theme;
331
212
 
332
- /**
333
- * Preview mode
334
- */
213
+ /** Preview mode */
335
214
  mode?: ThemeMode;
336
215
 
337
- /**
338
- * Show color palette
339
- */
216
+ /** Show color palette */
340
217
  showColors?: boolean;
341
218
 
342
- /**
343
- * Show typography samples
344
- */
219
+ /** Show typography samples */
345
220
  showTypography?: boolean;
346
221
 
347
- /**
348
- * Show component samples
349
- */
222
+ /** Show component samples */
350
223
  showComponents?: boolean;
351
224
  }
225
+
226
+ // ============================================================================
227
+ // Legacy Aliases (Backward Compatibility)
228
+ // ============================================================================
229
+
230
+ /**
231
+ * @deprecated Use `Theme` instead. Kept for backward compatibility.
232
+ */
233
+ export type ThemeDefinition = Theme;
234
+
235
+ /**
236
+ * @deprecated Use `Spacing` instead. Kept for backward compatibility.
237
+ */
238
+ export type SpacingScale = Spacing;