@object-ui/types 0.5.0 → 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.
- package/README.md +1 -1
- package/dist/ai.d.ts +376 -0
- package/dist/ai.d.ts.map +1 -0
- package/dist/ai.js +8 -0
- package/dist/app.d.ts +2 -2
- package/dist/crud.d.ts +3 -0
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-display.d.ts +35 -0
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-protocol.d.ts +19 -19
- package/dist/data.d.ts +68 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/designer.d.ts +473 -0
- package/dist/designer.d.ts.map +1 -0
- package/dist/designer.js +8 -0
- package/dist/form.d.ts +35 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/index.d.ts +35 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -0
- package/dist/layout.d.ts +63 -8
- package/dist/layout.d.ts.map +1 -1
- package/dist/mobile.d.ts +186 -0
- package/dist/mobile.d.ts.map +1 -0
- package/dist/mobile.js +8 -0
- package/dist/objectql.d.ts +329 -88
- package/dist/objectql.d.ts.map +1 -1
- package/dist/permissions.d.ts +150 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +8 -0
- package/dist/tenant.d.ts +138 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +8 -0
- package/dist/theme.d.ts +115 -224
- package/dist/theme.d.ts.map +1 -1
- package/dist/ui-action.d.ts +126 -11
- package/dist/ui-action.d.ts.map +1 -1
- package/dist/views.d.ts +10 -0
- package/dist/views.d.ts.map +1 -1
- package/dist/widget.d.ts +181 -0
- package/dist/widget.d.ts.map +1 -0
- package/dist/widget.js +8 -0
- package/dist/workflow.d.ts +340 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +8 -0
- package/dist/zod/complex.zod.d.ts +4 -4
- package/dist/zod/crud.zod.d.ts +5 -5
- package/dist/zod/feedback.zod.d.ts +10 -10
- package/dist/zod/form.zod.d.ts +4 -4
- package/dist/zod/index.zod.d.ts +323 -132
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +4 -4
- package/dist/zod/layout.zod.d.ts +132 -0
- package/dist/zod/layout.zod.d.ts.map +1 -1
- package/dist/zod/layout.zod.js +34 -0
- package/dist/zod/objectql.zod.d.ts +32 -16
- package/dist/zod/objectql.zod.d.ts.map +1 -1
- package/dist/zod/objectql.zod.js +8 -0
- package/dist/zod/reports.zod.d.ts +17 -17
- package/dist/zod/theme.zod.d.ts +947 -266
- package/dist/zod/theme.zod.d.ts.map +1 -1
- package/dist/zod/theme.zod.js +175 -45
- package/dist/zod/views.zod.d.ts +20 -20
- package/package.json +3 -2
- package/src/__tests__/namespace-exports.test.ts +24 -68
- package/src/__tests__/phase2-schemas.test.ts +8 -13
- package/src/ai.ts +454 -0
- package/src/app.ts +2 -2
- package/src/crud.ts +3 -0
- package/src/data-display.ts +31 -0
- package/src/data-protocol.ts +19 -19
- package/src/data.ts +81 -0
- package/src/designer.ts +509 -0
- package/src/form.ts +35 -1
- package/src/index.ts +220 -8
- package/src/layout.ts +66 -8
- package/src/mobile.ts +205 -0
- package/src/objectql.ts +403 -93
- package/src/permissions.ts +166 -0
- package/src/tenant.ts +153 -0
- package/src/theme.ts +147 -260
- package/src/ui-action.ts +166 -27
- package/src/views.ts +7 -0
- package/src/widget.ts +197 -0
- package/src/workflow.ts +409 -0
- package/src/zod/index.zod.ts +14 -3
- package/src/zod/layout.zod.ts +38 -0
- package/src/zod/objectql.zod.ts +8 -0
- package/src/zod/theme.zod.ts +189 -48
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
52
|
+
* Shadow Configuration
|
|
53
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
199
54
|
*/
|
|
200
|
-
export type
|
|
55
|
+
export type { Shadow } from '@objectstack/spec/ui';
|
|
201
56
|
|
|
202
57
|
/**
|
|
203
|
-
*
|
|
58
|
+
* Responsive Breakpoints Configuration
|
|
59
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
204
60
|
*/
|
|
205
|
-
export
|
|
206
|
-
/**
|
|
207
|
-
* Theme name/identifier
|
|
208
|
-
*/
|
|
209
|
-
name: string;
|
|
61
|
+
export type { Breakpoints } from '@objectstack/spec/ui';
|
|
210
62
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Animation Configuration
|
|
65
|
+
* Canonical definition from @objectstack/spec/ui.
|
|
66
|
+
*/
|
|
67
|
+
export type { Animation } from '@objectstack/spec/ui';
|
|
215
68
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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;
|