@object-ui/types 0.3.1 → 0.5.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/dist/app.d.ts +10 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/blocks.d.ts +332 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/blocks.js +8 -0
- package/dist/crud.d.ts +174 -3
- package/dist/crud.d.ts.map +1 -1
- package/dist/data-protocol.d.ts +1268 -0
- package/dist/data-protocol.d.ts.map +1 -0
- package/dist/data-protocol.js +8 -0
- package/dist/data.d.ts +6 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/field-types.d.ts +353 -11
- package/dist/field-types.d.ts.map +1 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/objectql.d.ts +8 -1
- package/dist/objectql.d.ts.map +1 -1
- package/dist/plugin-scope.d.ts +194 -0
- package/dist/plugin-scope.d.ts.map +1 -0
- package/dist/plugin-scope.js +8 -0
- package/dist/reports.d.ts +336 -0
- package/dist/reports.d.ts.map +1 -0
- package/dist/reports.js +8 -0
- package/dist/theme.d.ts +289 -0
- package/dist/theme.d.ts.map +1 -0
- package/dist/theme.js +8 -0
- package/dist/ui-action.d.ts +175 -0
- package/dist/ui-action.d.ts.map +1 -0
- package/dist/ui-action.js +8 -0
- package/dist/views.d.ts +417 -0
- package/dist/views.d.ts.map +1 -0
- package/dist/views.js +8 -0
- package/dist/zod/app.zod.d.ts +120 -0
- package/dist/zod/app.zod.d.ts.map +1 -0
- package/dist/zod/app.zod.js +60 -0
- package/dist/zod/blocks.zod.d.ts +834 -0
- package/dist/zod/blocks.zod.d.ts.map +1 -0
- package/dist/zod/blocks.zod.js +145 -0
- package/dist/zod/complex.zod.js +1 -1
- package/dist/zod/crud.zod.d.ts +598 -0
- package/dist/zod/crud.zod.d.ts.map +1 -0
- package/dist/zod/crud.zod.js +230 -0
- package/dist/zod/data-display.zod.js +1 -1
- package/dist/zod/disclosure.zod.js +1 -1
- package/dist/zod/feedback.zod.js +1 -1
- package/dist/zod/form.zod.js +1 -1
- package/dist/zod/index.zod.d.ts +1829 -18
- package/dist/zod/index.zod.d.ts.map +1 -1
- package/dist/zod/index.zod.js +96 -19
- package/dist/zod/layout.zod.d.ts +2 -2
- package/dist/zod/layout.zod.js +1 -1
- package/dist/zod/navigation.zod.js +1 -1
- package/dist/zod/objectql.zod.d.ts +10 -10
- package/dist/zod/objectql.zod.js +1 -1
- package/dist/zod/overlay.zod.js +1 -1
- package/dist/zod/reports.zod.d.ts +1628 -0
- package/dist/zod/reports.zod.d.ts.map +1 -0
- package/dist/zod/reports.zod.js +152 -0
- package/dist/zod/theme.zod.d.ts +611 -0
- package/dist/zod/theme.zod.d.ts.map +1 -0
- package/dist/zod/theme.zod.js +130 -0
- package/dist/zod/views.zod.d.ts +675 -0
- package/dist/zod/views.zod.d.ts.map +1 -0
- package/dist/zod/views.zod.js +159 -0
- package/package.json +2 -2
- package/src/__tests__/namespace-exports.test.ts +80 -0
- package/src/__tests__/phase2-schemas.test.ts +639 -0
- package/src/app.ts +12 -0
- package/src/blocks.ts +405 -0
- package/src/crud.ts +177 -3
- package/src/data-protocol.ts +1679 -0
- package/src/data.ts +3 -1
- package/src/field-types.ts +392 -11
- package/src/index.ts +214 -0
- package/src/objectql.ts +9 -1
- package/src/plugin-scope.ts +210 -0
- package/src/reports.ts +408 -0
- package/src/theme.ts +351 -0
- package/src/ui-action.ts +276 -0
- package/src/views.ts +429 -0
- package/src/zod/app.zod.ts +72 -0
- package/src/zod/blocks.zod.ts +170 -0
- package/src/zod/complex.zod.ts +1 -1
- package/src/zod/crud.zod.ts +259 -0
- package/src/zod/data-display.zod.ts +1 -1
- package/src/zod/disclosure.zod.ts +1 -1
- package/src/zod/feedback.zod.ts +1 -1
- package/src/zod/form.zod.ts +1 -1
- package/src/zod/index.zod.ts +167 -19
- package/src/zod/layout.zod.ts +1 -1
- package/src/zod/navigation.zod.ts +1 -1
- package/src/zod/objectql.zod.ts +1 -1
- package/src/zod/overlay.zod.ts +1 -1
- package/src/zod/reports.zod.ts +183 -0
- package/src/zod/theme.zod.ts +155 -0
- package/src/zod/views.zod.ts +182 -0
|
@@ -0,0 +1,130 @@
|
|
|
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 - Theme Schema Zod Validators
|
|
10
|
+
*
|
|
11
|
+
* Zod validation schemas for theme configuration.
|
|
12
|
+
* Following @objectstack/spec UI specification format.
|
|
13
|
+
*
|
|
14
|
+
* @module zod/theme
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
*/
|
|
17
|
+
import { z } from 'zod';
|
|
18
|
+
import { BaseSchema } from './base.zod.js';
|
|
19
|
+
/**
|
|
20
|
+
* Color Palette Schema
|
|
21
|
+
*/
|
|
22
|
+
export const ColorPaletteSchema = z.object({
|
|
23
|
+
primary: z.string().optional().describe('Primary brand color'),
|
|
24
|
+
secondary: z.string().optional().describe('Secondary color'),
|
|
25
|
+
accent: z.string().optional().describe('Accent color'),
|
|
26
|
+
background: z.string().optional().describe('Background color'),
|
|
27
|
+
foreground: z.string().optional().describe('Foreground/text color'),
|
|
28
|
+
muted: z.string().optional().describe('Muted color'),
|
|
29
|
+
mutedForeground: z.string().optional().describe('Muted foreground color'),
|
|
30
|
+
border: z.string().optional().describe('Border color'),
|
|
31
|
+
input: z.string().optional().describe('Input border color'),
|
|
32
|
+
ring: z.string().optional().describe('Ring/focus color'),
|
|
33
|
+
success: z.string().optional().describe('Success color'),
|
|
34
|
+
warning: z.string().optional().describe('Warning color'),
|
|
35
|
+
destructive: z.string().optional().describe('Error/destructive color'),
|
|
36
|
+
info: z.string().optional().describe('Info color'),
|
|
37
|
+
card: z.string().optional().describe('Card background color'),
|
|
38
|
+
cardForeground: z.string().optional().describe('Card foreground color'),
|
|
39
|
+
popover: z.string().optional().describe('Popover background color'),
|
|
40
|
+
popoverForeground: z.string().optional().describe('Popover foreground color'),
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Typography Schema
|
|
44
|
+
*/
|
|
45
|
+
export const TypographySchema = z.object({
|
|
46
|
+
fontSans: z.array(z.string()).optional().describe('Font family for sans-serif text'),
|
|
47
|
+
fontSerif: z.array(z.string()).optional().describe('Font family for serif text'),
|
|
48
|
+
fontMono: z.array(z.string()).optional().describe('Font family for monospace text'),
|
|
49
|
+
fontSize: z.number().optional().describe('Base font size (in rem)'),
|
|
50
|
+
lineHeight: z.number().optional().describe('Line height'),
|
|
51
|
+
headingWeight: z.number().optional().describe('Font weight for headings'),
|
|
52
|
+
bodyWeight: z.number().optional().describe('Font weight for body text'),
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Spacing Scale Schema
|
|
56
|
+
*/
|
|
57
|
+
export const SpacingScaleSchema = z.object({
|
|
58
|
+
base: z.number().optional().describe('Base spacing unit (in rem)'),
|
|
59
|
+
scale: z.record(z.string(), z.string()).optional().describe('Custom spacing values'),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Border Radius Schema
|
|
63
|
+
*/
|
|
64
|
+
export const BorderRadiusSchema = z.object({
|
|
65
|
+
sm: z.string().optional().describe('Small radius'),
|
|
66
|
+
default: z.string().optional().describe('Default radius'),
|
|
67
|
+
md: z.string().optional().describe('Medium radius'),
|
|
68
|
+
lg: z.string().optional().describe('Large radius'),
|
|
69
|
+
xl: z.string().optional().describe('Extra large radius'),
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Theme Mode Schema
|
|
73
|
+
*/
|
|
74
|
+
export const ThemeModeSchema = z.enum(['light', 'dark', 'system']).describe('Theme mode');
|
|
75
|
+
/**
|
|
76
|
+
* Theme Definition Schema
|
|
77
|
+
*/
|
|
78
|
+
export const ThemeDefinitionSchema = z.object({
|
|
79
|
+
name: z.string().describe('Theme name/identifier'),
|
|
80
|
+
label: z.string().optional().describe('Theme display label'),
|
|
81
|
+
light: ColorPaletteSchema.optional().describe('Light mode color palette'),
|
|
82
|
+
dark: ColorPaletteSchema.optional().describe('Dark mode color palette'),
|
|
83
|
+
typography: TypographySchema.optional().describe('Typography configuration'),
|
|
84
|
+
spacing: SpacingScaleSchema.optional().describe('Spacing scale configuration'),
|
|
85
|
+
radius: BorderRadiusSchema.optional().describe('Border radius configuration'),
|
|
86
|
+
cssVariables: z.record(z.string(), z.string()).optional().describe('Custom CSS variables'),
|
|
87
|
+
tailwind: z.record(z.string(), z.any()).optional().describe('Tailwind configuration overrides'),
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* Theme Schema
|
|
91
|
+
*/
|
|
92
|
+
export const ThemeSchema = BaseSchema.extend({
|
|
93
|
+
type: z.literal('theme'),
|
|
94
|
+
mode: ThemeModeSchema.optional().describe('Current theme mode'),
|
|
95
|
+
themes: z.array(ThemeDefinitionSchema).optional().describe('Available themes'),
|
|
96
|
+
activeTheme: z.string().optional().describe('Active theme name'),
|
|
97
|
+
allowSwitching: z.boolean().optional().describe('Allow user theme switching'),
|
|
98
|
+
persistPreference: z.boolean().optional().describe('Persist theme preference'),
|
|
99
|
+
storageKey: z.string().optional().describe('Storage key for persisting theme'),
|
|
100
|
+
});
|
|
101
|
+
/**
|
|
102
|
+
* Theme Switcher Schema
|
|
103
|
+
*/
|
|
104
|
+
export const ThemeSwitcherSchema = BaseSchema.extend({
|
|
105
|
+
type: z.literal('theme-switcher'),
|
|
106
|
+
variant: z.enum(['dropdown', 'toggle', 'buttons']).optional().describe('Switcher variant'),
|
|
107
|
+
showMode: z.boolean().optional().describe('Show mode selector (light/dark)'),
|
|
108
|
+
showThemes: z.boolean().optional().describe('Show theme selector'),
|
|
109
|
+
lightIcon: z.string().optional().describe('Icon for light mode'),
|
|
110
|
+
darkIcon: z.string().optional().describe('Icon for dark mode'),
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Theme Preview Schema
|
|
114
|
+
*/
|
|
115
|
+
export const ThemePreviewSchema = BaseSchema.extend({
|
|
116
|
+
type: z.literal('theme-preview'),
|
|
117
|
+
theme: ThemeDefinitionSchema.optional().describe('Theme to preview'),
|
|
118
|
+
mode: ThemeModeSchema.optional().describe('Preview mode'),
|
|
119
|
+
showColors: z.boolean().optional().describe('Show color palette'),
|
|
120
|
+
showTypography: z.boolean().optional().describe('Show typography samples'),
|
|
121
|
+
showComponents: z.boolean().optional().describe('Show component samples'),
|
|
122
|
+
});
|
|
123
|
+
/**
|
|
124
|
+
* Union of all theme schemas
|
|
125
|
+
*/
|
|
126
|
+
export const ThemeComponentSchema = z.union([
|
|
127
|
+
ThemeSchema,
|
|
128
|
+
ThemeSwitcherSchema,
|
|
129
|
+
ThemePreviewSchema,
|
|
130
|
+
]);
|