prev-cli 0.24.14 → 0.24.16
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/cli.d.ts +1 -1
- package/dist/cli.js +4474 -1673
- package/dist/jsx/adapters/html.d.ts +15 -0
- package/dist/jsx/adapters/react.d.ts +26 -0
- package/dist/jsx/define-component.d.ts +68 -0
- package/dist/jsx/index.d.ts +7 -0
- package/dist/jsx/jsx-runtime.d.ts +34 -0
- package/dist/jsx/migrate.d.ts +24 -0
- package/dist/jsx/schemas/index.d.ts +2 -0
- package/dist/jsx/schemas/primitives.d.ts +355 -0
- package/dist/jsx/schemas/tokens.d.ts +79 -0
- package/dist/jsx/validation.d.ts +28 -0
- package/dist/jsx/vnode.d.ts +58 -0
- package/dist/migrate.d.ts +18 -0
- package/dist/primitives/index.d.ts +5 -0
- package/dist/primitives/migrate.d.ts +25 -0
- package/dist/primitives/parser.d.ts +32 -0
- package/dist/primitives/template-parser.d.ts +33 -0
- package/dist/primitives/template-renderer.d.ts +19 -0
- package/dist/primitives/types.d.ts +164 -0
- package/dist/renderers/html/index.d.ts +6 -0
- package/dist/renderers/index.d.ts +5 -0
- package/dist/renderers/react/index.d.ts +6 -0
- package/dist/renderers/registry.d.ts +41 -0
- package/dist/renderers/render.d.ts +35 -0
- package/dist/renderers/types.d.ts +188 -0
- package/dist/tokens/defaults.d.ts +2 -0
- package/dist/tokens/resolver.d.ts +67 -0
- package/dist/tokens/utils.d.ts +15 -0
- package/dist/tokens/validation.d.ts +36 -0
- package/dist/typecheck/index.d.ts +24 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/validators/index.d.ts +59 -0
- package/dist/validators/schema-validator.d.ts +27 -0
- package/dist/validators/semantic-validator.d.ts +47 -0
- package/dist/vite/plugins/tokens-plugin.d.ts +2 -0
- package/package.json +8 -4
- package/src/preview-runtime/build-optimized.ts +6 -1
- package/src/preview-runtime/fast-template.html +115 -0
- package/src/preview-runtime/tailwind.ts +22 -7
- package/src/preview-runtime/template.html +50 -8
- package/src/preview-runtime/vendors.ts +9 -0
- package/src/theme/entry.tsx +153 -12
- package/src/theme/previews/TokensPage.tsx +328 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { VNodeType } from '../vnode';
|
|
2
|
+
import { type TokensConfig } from '../../tokens/resolver';
|
|
3
|
+
export declare function setTokensConfig(tokens: TokensConfig | undefined): void;
|
|
4
|
+
export interface RenderContext {
|
|
5
|
+
/** Current state for slot resolution */
|
|
6
|
+
state?: string;
|
|
7
|
+
/** Slots mapping: slotName -> stateName -> VNode */
|
|
8
|
+
slots?: Record<string, Record<string, VNodeType>>;
|
|
9
|
+
/** Callback to render component nodes */
|
|
10
|
+
renderComponent?: (name: string, props: Record<string, unknown>, children?: VNodeType[]) => string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Render a VNode tree to HTML
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderToHtml(node: VNodeType, context?: RenderContext): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { VNodeType } from '../vnode';
|
|
3
|
+
export interface TokensConfig {
|
|
4
|
+
colors: Record<string, string>;
|
|
5
|
+
backgrounds: Record<string, string>;
|
|
6
|
+
spacing: Record<string, string>;
|
|
7
|
+
typography: {
|
|
8
|
+
sizes: Record<string, string>;
|
|
9
|
+
weights: Record<string, number>;
|
|
10
|
+
};
|
|
11
|
+
radius: Record<string, string>;
|
|
12
|
+
shadows: Record<string, string>;
|
|
13
|
+
}
|
|
14
|
+
export declare function setTokensConfig(tokens: TokensConfig | undefined): void;
|
|
15
|
+
export interface ReactRenderContext {
|
|
16
|
+
/** Current state for slot resolution */
|
|
17
|
+
state?: string;
|
|
18
|
+
/** Slots mapping: slotName -> stateName -> VNode */
|
|
19
|
+
slots?: Record<string, Record<string, VNodeType>>;
|
|
20
|
+
/** Callback to render component nodes */
|
|
21
|
+
renderComponent?: (name: string, props: Record<string, unknown>, children?: React.ReactNode) => React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Render a VNode tree to React elements
|
|
25
|
+
*/
|
|
26
|
+
export declare function toReact(node: VNodeType | VNodeType[], context?: ReactRenderContext): React.ReactNode;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type VNodeType } from './vnode';
|
|
3
|
+
/**
|
|
4
|
+
* Render context passed to component render function
|
|
5
|
+
*/
|
|
6
|
+
export interface ComponentContext<TProps, TState> {
|
|
7
|
+
props: TProps;
|
|
8
|
+
state: TState;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Component definition options
|
|
12
|
+
*/
|
|
13
|
+
export interface ComponentDefinition<TProps extends z.ZodType, TStates extends z.ZodType> {
|
|
14
|
+
/** Component name (used in VNode tree) */
|
|
15
|
+
name: string;
|
|
16
|
+
/** Zod schema for props */
|
|
17
|
+
props: TProps;
|
|
18
|
+
/** Zod schema for states */
|
|
19
|
+
states: TStates;
|
|
20
|
+
/** Default state value */
|
|
21
|
+
defaultState: z.infer<TStates>;
|
|
22
|
+
/** Render function that returns a VNode tree */
|
|
23
|
+
render: (ctx: ComponentContext<z.infer<TProps>, z.infer<TStates>>) => VNodeType;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Component function type returned by defineComponent
|
|
27
|
+
*/
|
|
28
|
+
export type ComponentFunction<TProps, TState> = {
|
|
29
|
+
(props: TProps, state?: TState): VNodeType;
|
|
30
|
+
componentName: string;
|
|
31
|
+
propsSchema: z.ZodType<TProps>;
|
|
32
|
+
statesSchema: z.ZodType<TState>;
|
|
33
|
+
defaultState: TState;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Define a reusable component with typed props and states
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```tsx
|
|
40
|
+
* const Button = defineComponent({
|
|
41
|
+
* name: 'Button',
|
|
42
|
+
* props: z.object({
|
|
43
|
+
* label: z.string(),
|
|
44
|
+
* variant: z.enum(['primary', 'secondary']).optional(),
|
|
45
|
+
* }),
|
|
46
|
+
* states: z.enum(['idle', 'loading', 'disabled']),
|
|
47
|
+
* defaultState: 'idle',
|
|
48
|
+
* render: ({ props, state }) => (
|
|
49
|
+
* <Box bg={state === 'loading' ? 'muted' : 'primary'} padding="md" radius="md">
|
|
50
|
+
* <Text>{props.label}</Text>
|
|
51
|
+
* </Box>
|
|
52
|
+
* ),
|
|
53
|
+
* })
|
|
54
|
+
*
|
|
55
|
+
* // Usage
|
|
56
|
+
* <Button label="Click me" />
|
|
57
|
+
* <Button label="Processing..." state="loading" />
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function defineComponent<TProps extends z.ZodType, TStates extends z.ZodType>(definition: ComponentDefinition<TProps, TStates>): ComponentFunction<z.infer<TProps>, z.infer<TStates>>;
|
|
61
|
+
/**
|
|
62
|
+
* Helper to create a simple component without states
|
|
63
|
+
*/
|
|
64
|
+
export declare function defineStatelessComponent<TProps extends z.ZodType>(definition: {
|
|
65
|
+
name: string;
|
|
66
|
+
props: TProps;
|
|
67
|
+
render: (props: z.infer<TProps>) => VNodeType;
|
|
68
|
+
}): (props: z.infer<TProps>) => VNodeType;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './schemas';
|
|
2
|
+
export { createVNode, createComponentVNode, normalizeChildren, vnodeEquals, resetIdCounter, VNode, type VNodeType, } from './vnode';
|
|
3
|
+
export { Col, Row, Box, Spacer, Slot, Text, Icon, Image, Fragment, } from './jsx-runtime';
|
|
4
|
+
export { defineComponent, defineStatelessComponent, type ComponentContext, type ComponentDefinition, type ComponentFunction, } from './define-component';
|
|
5
|
+
export { renderToHtml, type RenderContext } from './adapters/html';
|
|
6
|
+
export { toReact, setTokensConfig, type ReactRenderContext, type TokensConfig } from './adapters/react';
|
|
7
|
+
export { migrateYamlToJsx, type MigrationResult, type YamlConfig } from './migrate';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type VNodeType } from './vnode';
|
|
2
|
+
import { ColProps, RowProps, BoxProps, SpacerProps, SlotProps, TextProps, IconProps, ImageProps } from './schemas/primitives';
|
|
3
|
+
export { setValidationMode, getValidationMode, type ValidationMode } from './validation';
|
|
4
|
+
export declare function Col(props: ColProps): VNodeType;
|
|
5
|
+
export declare function Row(props: RowProps): VNodeType;
|
|
6
|
+
export declare function Box(props: BoxProps): VNodeType;
|
|
7
|
+
export declare function Spacer(props?: SpacerProps): VNodeType;
|
|
8
|
+
export declare function Slot(props: SlotProps): VNodeType;
|
|
9
|
+
export declare function Text(props: TextProps): VNodeType;
|
|
10
|
+
export declare function Icon(props: IconProps): VNodeType;
|
|
11
|
+
export declare function Image(props: ImageProps): VNodeType;
|
|
12
|
+
type JSXElementType = ((props: Record<string, unknown>, state?: unknown) => VNodeType) & {
|
|
13
|
+
statesSchema?: unknown;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* JSX factory function - called for each JSX element
|
|
17
|
+
* Extracts `state` prop for components created with defineComponent
|
|
18
|
+
*/
|
|
19
|
+
export declare function jsx(type: JSXElementType, props: Record<string, unknown>): VNodeType;
|
|
20
|
+
/**
|
|
21
|
+
* JSX factory for elements with static children
|
|
22
|
+
*/
|
|
23
|
+
export declare const jsxs: typeof jsx;
|
|
24
|
+
/**
|
|
25
|
+
* JSX factory for development mode (with source info)
|
|
26
|
+
*/
|
|
27
|
+
export declare function jsxDEV(type: JSXElementType, props: Record<string, unknown>, _key?: string, _isStaticChildren?: boolean, _source?: {
|
|
28
|
+
fileName: string;
|
|
29
|
+
lineNumber: number;
|
|
30
|
+
columnNumber: number;
|
|
31
|
+
}, _self?: unknown): VNodeType;
|
|
32
|
+
export declare function Fragment({ children }: {
|
|
33
|
+
children?: unknown;
|
|
34
|
+
}): VNodeType[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { TemplateNode, Slots } from '../primitives/types';
|
|
2
|
+
export interface MigrationResult {
|
|
3
|
+
success: boolean;
|
|
4
|
+
jsx?: string;
|
|
5
|
+
errors: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface YamlConfig {
|
|
8
|
+
kind: string;
|
|
9
|
+
id: string;
|
|
10
|
+
title: string;
|
|
11
|
+
schemaVersion?: string;
|
|
12
|
+
states?: Record<string, {
|
|
13
|
+
description?: string;
|
|
14
|
+
}>;
|
|
15
|
+
template?: {
|
|
16
|
+
root: TemplateNode;
|
|
17
|
+
};
|
|
18
|
+
slots?: Slots;
|
|
19
|
+
props?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Migrate a YAML config file to JSX/TSX
|
|
23
|
+
*/
|
|
24
|
+
export declare function migrateYamlToJsx(yamlContent: string): MigrationResult;
|
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ColProps: z.ZodObject<{
|
|
3
|
+
gap: z.ZodOptional<z.ZodEnum<{
|
|
4
|
+
none: "none";
|
|
5
|
+
xs: "xs";
|
|
6
|
+
sm: "sm";
|
|
7
|
+
md: "md";
|
|
8
|
+
lg: "lg";
|
|
9
|
+
xl: "xl";
|
|
10
|
+
"2xl": "2xl";
|
|
11
|
+
}>>;
|
|
12
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
end: "end";
|
|
14
|
+
start: "start";
|
|
15
|
+
center: "center";
|
|
16
|
+
stretch: "stretch";
|
|
17
|
+
between: "between";
|
|
18
|
+
}>>;
|
|
19
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
none: "none";
|
|
21
|
+
xs: "xs";
|
|
22
|
+
sm: "sm";
|
|
23
|
+
md: "md";
|
|
24
|
+
lg: "lg";
|
|
25
|
+
xl: "xl";
|
|
26
|
+
"2xl": "2xl";
|
|
27
|
+
}>>;
|
|
28
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type ColProps = z.infer<typeof ColProps>;
|
|
31
|
+
export declare const RowProps: z.ZodObject<{
|
|
32
|
+
gap: z.ZodOptional<z.ZodEnum<{
|
|
33
|
+
none: "none";
|
|
34
|
+
xs: "xs";
|
|
35
|
+
sm: "sm";
|
|
36
|
+
md: "md";
|
|
37
|
+
lg: "lg";
|
|
38
|
+
xl: "xl";
|
|
39
|
+
"2xl": "2xl";
|
|
40
|
+
}>>;
|
|
41
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
42
|
+
end: "end";
|
|
43
|
+
start: "start";
|
|
44
|
+
center: "center";
|
|
45
|
+
stretch: "stretch";
|
|
46
|
+
between: "between";
|
|
47
|
+
}>>;
|
|
48
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
49
|
+
none: "none";
|
|
50
|
+
xs: "xs";
|
|
51
|
+
sm: "sm";
|
|
52
|
+
md: "md";
|
|
53
|
+
lg: "lg";
|
|
54
|
+
xl: "xl";
|
|
55
|
+
"2xl": "2xl";
|
|
56
|
+
}>>;
|
|
57
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type RowProps = z.infer<typeof RowProps>;
|
|
60
|
+
export declare const BoxProps: z.ZodObject<{
|
|
61
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
none: "none";
|
|
63
|
+
xs: "xs";
|
|
64
|
+
sm: "sm";
|
|
65
|
+
md: "md";
|
|
66
|
+
lg: "lg";
|
|
67
|
+
xl: "xl";
|
|
68
|
+
"2xl": "2xl";
|
|
69
|
+
}>>;
|
|
70
|
+
bg: z.ZodOptional<z.ZodEnum<{
|
|
71
|
+
input: "input";
|
|
72
|
+
primary: "primary";
|
|
73
|
+
secondary: "secondary";
|
|
74
|
+
muted: "muted";
|
|
75
|
+
accent: "accent";
|
|
76
|
+
destructive: "destructive";
|
|
77
|
+
transparent: "transparent";
|
|
78
|
+
background: "background";
|
|
79
|
+
card: "card";
|
|
80
|
+
}>>;
|
|
81
|
+
radius: z.ZodOptional<z.ZodEnum<{
|
|
82
|
+
none: "none";
|
|
83
|
+
sm: "sm";
|
|
84
|
+
md: "md";
|
|
85
|
+
lg: "lg";
|
|
86
|
+
xl: "xl";
|
|
87
|
+
full: "full";
|
|
88
|
+
}>>;
|
|
89
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type BoxProps = z.infer<typeof BoxProps>;
|
|
92
|
+
export declare const SpacerProps: z.ZodObject<{
|
|
93
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
none: "none";
|
|
95
|
+
xs: "xs";
|
|
96
|
+
sm: "sm";
|
|
97
|
+
md: "md";
|
|
98
|
+
lg: "lg";
|
|
99
|
+
xl: "xl";
|
|
100
|
+
"2xl": "2xl";
|
|
101
|
+
}>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type SpacerProps = z.infer<typeof SpacerProps>;
|
|
104
|
+
export declare const SlotProps: z.ZodObject<{
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type SlotProps = z.infer<typeof SlotProps>;
|
|
108
|
+
export declare const TextProps: z.ZodObject<{
|
|
109
|
+
children: z.ZodOptional<z.ZodString>;
|
|
110
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
111
|
+
base: "base";
|
|
112
|
+
xs: "xs";
|
|
113
|
+
sm: "sm";
|
|
114
|
+
lg: "lg";
|
|
115
|
+
xl: "xl";
|
|
116
|
+
"2xl": "2xl";
|
|
117
|
+
}>>;
|
|
118
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
bold: "bold";
|
|
120
|
+
normal: "normal";
|
|
121
|
+
medium: "medium";
|
|
122
|
+
semibold: "semibold";
|
|
123
|
+
}>>;
|
|
124
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
125
|
+
foreground: "foreground";
|
|
126
|
+
"card-foreground": "card-foreground";
|
|
127
|
+
primary: "primary";
|
|
128
|
+
"primary-foreground": "primary-foreground";
|
|
129
|
+
secondary: "secondary";
|
|
130
|
+
"secondary-foreground": "secondary-foreground";
|
|
131
|
+
muted: "muted";
|
|
132
|
+
"muted-foreground": "muted-foreground";
|
|
133
|
+
accent: "accent";
|
|
134
|
+
"accent-foreground": "accent-foreground";
|
|
135
|
+
destructive: "destructive";
|
|
136
|
+
"destructive-foreground": "destructive-foreground";
|
|
137
|
+
border: "border";
|
|
138
|
+
ring: "ring";
|
|
139
|
+
}>>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export type TextProps = z.infer<typeof TextProps>;
|
|
142
|
+
export declare const IconProps: z.ZodObject<{
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
145
|
+
base: "base";
|
|
146
|
+
xs: "xs";
|
|
147
|
+
sm: "sm";
|
|
148
|
+
lg: "lg";
|
|
149
|
+
xl: "xl";
|
|
150
|
+
"2xl": "2xl";
|
|
151
|
+
}>>;
|
|
152
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
153
|
+
foreground: "foreground";
|
|
154
|
+
"card-foreground": "card-foreground";
|
|
155
|
+
primary: "primary";
|
|
156
|
+
"primary-foreground": "primary-foreground";
|
|
157
|
+
secondary: "secondary";
|
|
158
|
+
"secondary-foreground": "secondary-foreground";
|
|
159
|
+
muted: "muted";
|
|
160
|
+
"muted-foreground": "muted-foreground";
|
|
161
|
+
accent: "accent";
|
|
162
|
+
"accent-foreground": "accent-foreground";
|
|
163
|
+
destructive: "destructive";
|
|
164
|
+
"destructive-foreground": "destructive-foreground";
|
|
165
|
+
border: "border";
|
|
166
|
+
ring: "ring";
|
|
167
|
+
}>>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
export type IconProps = z.infer<typeof IconProps>;
|
|
170
|
+
export declare const ImageProps: z.ZodObject<{
|
|
171
|
+
src: z.ZodString;
|
|
172
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
173
|
+
fit: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
fill: "fill";
|
|
175
|
+
cover: "cover";
|
|
176
|
+
contain: "contain";
|
|
177
|
+
}>>;
|
|
178
|
+
}, z.core.$strip>;
|
|
179
|
+
export type ImageProps = z.infer<typeof ImageProps>;
|
|
180
|
+
export declare const PrimitiveType: z.ZodEnum<{
|
|
181
|
+
component: "component";
|
|
182
|
+
text: "text";
|
|
183
|
+
slot: "slot";
|
|
184
|
+
col: "col";
|
|
185
|
+
row: "row";
|
|
186
|
+
box: "box";
|
|
187
|
+
spacer: "spacer";
|
|
188
|
+
icon: "icon";
|
|
189
|
+
image: "image";
|
|
190
|
+
}>;
|
|
191
|
+
export type PrimitiveType = z.infer<typeof PrimitiveType>;
|
|
192
|
+
export declare const PrimitiveProps: z.ZodUnion<readonly [z.ZodObject<{
|
|
193
|
+
gap: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
none: "none";
|
|
195
|
+
xs: "xs";
|
|
196
|
+
sm: "sm";
|
|
197
|
+
md: "md";
|
|
198
|
+
lg: "lg";
|
|
199
|
+
xl: "xl";
|
|
200
|
+
"2xl": "2xl";
|
|
201
|
+
}>>;
|
|
202
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
203
|
+
end: "end";
|
|
204
|
+
start: "start";
|
|
205
|
+
center: "center";
|
|
206
|
+
stretch: "stretch";
|
|
207
|
+
between: "between";
|
|
208
|
+
}>>;
|
|
209
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
210
|
+
none: "none";
|
|
211
|
+
xs: "xs";
|
|
212
|
+
sm: "sm";
|
|
213
|
+
md: "md";
|
|
214
|
+
lg: "lg";
|
|
215
|
+
xl: "xl";
|
|
216
|
+
"2xl": "2xl";
|
|
217
|
+
}>>;
|
|
218
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
gap: z.ZodOptional<z.ZodEnum<{
|
|
221
|
+
none: "none";
|
|
222
|
+
xs: "xs";
|
|
223
|
+
sm: "sm";
|
|
224
|
+
md: "md";
|
|
225
|
+
lg: "lg";
|
|
226
|
+
xl: "xl";
|
|
227
|
+
"2xl": "2xl";
|
|
228
|
+
}>>;
|
|
229
|
+
align: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
end: "end";
|
|
231
|
+
start: "start";
|
|
232
|
+
center: "center";
|
|
233
|
+
stretch: "stretch";
|
|
234
|
+
between: "between";
|
|
235
|
+
}>>;
|
|
236
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
237
|
+
none: "none";
|
|
238
|
+
xs: "xs";
|
|
239
|
+
sm: "sm";
|
|
240
|
+
md: "md";
|
|
241
|
+
lg: "lg";
|
|
242
|
+
xl: "xl";
|
|
243
|
+
"2xl": "2xl";
|
|
244
|
+
}>>;
|
|
245
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
246
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
247
|
+
padding: z.ZodOptional<z.ZodEnum<{
|
|
248
|
+
none: "none";
|
|
249
|
+
xs: "xs";
|
|
250
|
+
sm: "sm";
|
|
251
|
+
md: "md";
|
|
252
|
+
lg: "lg";
|
|
253
|
+
xl: "xl";
|
|
254
|
+
"2xl": "2xl";
|
|
255
|
+
}>>;
|
|
256
|
+
bg: z.ZodOptional<z.ZodEnum<{
|
|
257
|
+
input: "input";
|
|
258
|
+
primary: "primary";
|
|
259
|
+
secondary: "secondary";
|
|
260
|
+
muted: "muted";
|
|
261
|
+
accent: "accent";
|
|
262
|
+
destructive: "destructive";
|
|
263
|
+
transparent: "transparent";
|
|
264
|
+
background: "background";
|
|
265
|
+
card: "card";
|
|
266
|
+
}>>;
|
|
267
|
+
radius: z.ZodOptional<z.ZodEnum<{
|
|
268
|
+
none: "none";
|
|
269
|
+
sm: "sm";
|
|
270
|
+
md: "md";
|
|
271
|
+
lg: "lg";
|
|
272
|
+
xl: "xl";
|
|
273
|
+
full: "full";
|
|
274
|
+
}>>;
|
|
275
|
+
children: z.ZodOptional<z.ZodAny>;
|
|
276
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
277
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
278
|
+
none: "none";
|
|
279
|
+
xs: "xs";
|
|
280
|
+
sm: "sm";
|
|
281
|
+
md: "md";
|
|
282
|
+
lg: "lg";
|
|
283
|
+
xl: "xl";
|
|
284
|
+
"2xl": "2xl";
|
|
285
|
+
}>>;
|
|
286
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
287
|
+
name: z.ZodString;
|
|
288
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
289
|
+
children: z.ZodOptional<z.ZodString>;
|
|
290
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
291
|
+
base: "base";
|
|
292
|
+
xs: "xs";
|
|
293
|
+
sm: "sm";
|
|
294
|
+
lg: "lg";
|
|
295
|
+
xl: "xl";
|
|
296
|
+
"2xl": "2xl";
|
|
297
|
+
}>>;
|
|
298
|
+
weight: z.ZodOptional<z.ZodEnum<{
|
|
299
|
+
bold: "bold";
|
|
300
|
+
normal: "normal";
|
|
301
|
+
medium: "medium";
|
|
302
|
+
semibold: "semibold";
|
|
303
|
+
}>>;
|
|
304
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
305
|
+
foreground: "foreground";
|
|
306
|
+
"card-foreground": "card-foreground";
|
|
307
|
+
primary: "primary";
|
|
308
|
+
"primary-foreground": "primary-foreground";
|
|
309
|
+
secondary: "secondary";
|
|
310
|
+
"secondary-foreground": "secondary-foreground";
|
|
311
|
+
muted: "muted";
|
|
312
|
+
"muted-foreground": "muted-foreground";
|
|
313
|
+
accent: "accent";
|
|
314
|
+
"accent-foreground": "accent-foreground";
|
|
315
|
+
destructive: "destructive";
|
|
316
|
+
"destructive-foreground": "destructive-foreground";
|
|
317
|
+
border: "border";
|
|
318
|
+
ring: "ring";
|
|
319
|
+
}>>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
name: z.ZodString;
|
|
322
|
+
size: z.ZodOptional<z.ZodEnum<{
|
|
323
|
+
base: "base";
|
|
324
|
+
xs: "xs";
|
|
325
|
+
sm: "sm";
|
|
326
|
+
lg: "lg";
|
|
327
|
+
xl: "xl";
|
|
328
|
+
"2xl": "2xl";
|
|
329
|
+
}>>;
|
|
330
|
+
color: z.ZodOptional<z.ZodEnum<{
|
|
331
|
+
foreground: "foreground";
|
|
332
|
+
"card-foreground": "card-foreground";
|
|
333
|
+
primary: "primary";
|
|
334
|
+
"primary-foreground": "primary-foreground";
|
|
335
|
+
secondary: "secondary";
|
|
336
|
+
"secondary-foreground": "secondary-foreground";
|
|
337
|
+
muted: "muted";
|
|
338
|
+
"muted-foreground": "muted-foreground";
|
|
339
|
+
accent: "accent";
|
|
340
|
+
"accent-foreground": "accent-foreground";
|
|
341
|
+
destructive: "destructive";
|
|
342
|
+
"destructive-foreground": "destructive-foreground";
|
|
343
|
+
border: "border";
|
|
344
|
+
ring: "ring";
|
|
345
|
+
}>>;
|
|
346
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
347
|
+
src: z.ZodString;
|
|
348
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
349
|
+
fit: z.ZodOptional<z.ZodEnum<{
|
|
350
|
+
fill: "fill";
|
|
351
|
+
cover: "cover";
|
|
352
|
+
contain: "contain";
|
|
353
|
+
}>>;
|
|
354
|
+
}, z.core.$strip>]>;
|
|
355
|
+
export type PrimitiveProps = z.infer<typeof PrimitiveProps>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SpacingToken: z.ZodEnum<{
|
|
3
|
+
none: "none";
|
|
4
|
+
xs: "xs";
|
|
5
|
+
sm: "sm";
|
|
6
|
+
md: "md";
|
|
7
|
+
lg: "lg";
|
|
8
|
+
xl: "xl";
|
|
9
|
+
"2xl": "2xl";
|
|
10
|
+
}>;
|
|
11
|
+
export type SpacingToken = z.infer<typeof SpacingToken>;
|
|
12
|
+
export declare const AlignToken: z.ZodEnum<{
|
|
13
|
+
end: "end";
|
|
14
|
+
start: "start";
|
|
15
|
+
center: "center";
|
|
16
|
+
stretch: "stretch";
|
|
17
|
+
between: "between";
|
|
18
|
+
}>;
|
|
19
|
+
export type AlignToken = z.infer<typeof AlignToken>;
|
|
20
|
+
export declare const BackgroundToken: z.ZodEnum<{
|
|
21
|
+
input: "input";
|
|
22
|
+
primary: "primary";
|
|
23
|
+
secondary: "secondary";
|
|
24
|
+
muted: "muted";
|
|
25
|
+
accent: "accent";
|
|
26
|
+
destructive: "destructive";
|
|
27
|
+
transparent: "transparent";
|
|
28
|
+
background: "background";
|
|
29
|
+
card: "card";
|
|
30
|
+
}>;
|
|
31
|
+
export type BackgroundToken = z.infer<typeof BackgroundToken>;
|
|
32
|
+
export declare const RadiusToken: z.ZodEnum<{
|
|
33
|
+
none: "none";
|
|
34
|
+
sm: "sm";
|
|
35
|
+
md: "md";
|
|
36
|
+
lg: "lg";
|
|
37
|
+
xl: "xl";
|
|
38
|
+
full: "full";
|
|
39
|
+
}>;
|
|
40
|
+
export type RadiusToken = z.infer<typeof RadiusToken>;
|
|
41
|
+
export declare const ColorToken: z.ZodEnum<{
|
|
42
|
+
foreground: "foreground";
|
|
43
|
+
"card-foreground": "card-foreground";
|
|
44
|
+
primary: "primary";
|
|
45
|
+
"primary-foreground": "primary-foreground";
|
|
46
|
+
secondary: "secondary";
|
|
47
|
+
"secondary-foreground": "secondary-foreground";
|
|
48
|
+
muted: "muted";
|
|
49
|
+
"muted-foreground": "muted-foreground";
|
|
50
|
+
accent: "accent";
|
|
51
|
+
"accent-foreground": "accent-foreground";
|
|
52
|
+
destructive: "destructive";
|
|
53
|
+
"destructive-foreground": "destructive-foreground";
|
|
54
|
+
border: "border";
|
|
55
|
+
ring: "ring";
|
|
56
|
+
}>;
|
|
57
|
+
export type ColorToken = z.infer<typeof ColorToken>;
|
|
58
|
+
export declare const SizeToken: z.ZodEnum<{
|
|
59
|
+
base: "base";
|
|
60
|
+
xs: "xs";
|
|
61
|
+
sm: "sm";
|
|
62
|
+
lg: "lg";
|
|
63
|
+
xl: "xl";
|
|
64
|
+
"2xl": "2xl";
|
|
65
|
+
}>;
|
|
66
|
+
export type SizeToken = z.infer<typeof SizeToken>;
|
|
67
|
+
export declare const WeightToken: z.ZodEnum<{
|
|
68
|
+
bold: "bold";
|
|
69
|
+
normal: "normal";
|
|
70
|
+
medium: "medium";
|
|
71
|
+
semibold: "semibold";
|
|
72
|
+
}>;
|
|
73
|
+
export type WeightToken = z.infer<typeof WeightToken>;
|
|
74
|
+
export declare const FitToken: z.ZodEnum<{
|
|
75
|
+
fill: "fill";
|
|
76
|
+
cover: "cover";
|
|
77
|
+
contain: "contain";
|
|
78
|
+
}>;
|
|
79
|
+
export type FitToken = z.infer<typeof FitToken>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Validation mode controls how schema validation behaves:
|
|
4
|
+
* - 'strict': throws on validation errors (useful for development/testing)
|
|
5
|
+
* - 'warn': logs warnings but continues (default in DEV)
|
|
6
|
+
* - 'off': no validation (default in production)
|
|
7
|
+
*/
|
|
8
|
+
export type ValidationMode = 'strict' | 'warn' | 'off';
|
|
9
|
+
/**
|
|
10
|
+
* Set the validation mode for JSX primitives
|
|
11
|
+
* @param mode - The validation mode to use
|
|
12
|
+
*/
|
|
13
|
+
export declare function setValidationMode(mode: ValidationMode): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get the current validation mode
|
|
16
|
+
*/
|
|
17
|
+
export declare function getValidationMode(): ValidationMode;
|
|
18
|
+
/**
|
|
19
|
+
* Validate props against a Zod schema based on current mode.
|
|
20
|
+
* In 'strict' mode, throws on error.
|
|
21
|
+
* In 'warn' mode, logs a warning and continues.
|
|
22
|
+
* In 'off' mode, skips validation entirely.
|
|
23
|
+
*
|
|
24
|
+
* @param schema - Zod schema to validate against
|
|
25
|
+
* @param props - Props to validate
|
|
26
|
+
* @param componentName - Component name for error messages
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateProps(schema: z.ZodType, props: unknown, componentName: string): void;
|