@shoppexio/builder-contracts 0.1.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/builder-contracts.test.d.ts +2 -0
- package/dist/builder-contracts.test.d.ts.map +1 -0
- package/dist/builder-contracts.test.js +361 -0
- package/dist/builder-settings.d.ts +801 -0
- package/dist/builder-settings.d.ts.map +1 -0
- package/dist/builder-settings.js +65 -0
- package/dist/events.d.ts +512 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +104 -0
- package/dist/fields.d.ts +300 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +111 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/legacy-manifest.d.ts +172 -0
- package/dist/legacy-manifest.d.ts.map +1 -0
- package/dist/legacy-manifest.js +272 -0
- package/dist/migrations.d.ts +31 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +175 -0
- package/dist/preview-protocol.d.ts +687 -0
- package/dist/preview-protocol.d.ts.map +1 -0
- package/dist/preview-protocol.js +79 -0
- package/dist/style-slots.d.ts +209 -0
- package/dist/style-slots.d.ts.map +1 -0
- package/dist/style-slots.js +93 -0
- package/dist/theme-manifest.d.ts +845 -0
- package/dist/theme-manifest.d.ts.map +1 -0
- package/dist/theme-manifest.js +119 -0
- package/dist/validation.d.ts +16 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +131 -0
- package/package.json +95 -0
- package/src/builder-contracts.test.ts +405 -0
- package/src/builder-settings.ts +85 -0
- package/src/events.ts +121 -0
- package/src/fields.ts +134 -0
- package/src/index.ts +9 -0
- package/src/legacy-manifest.ts +321 -0
- package/src/migrations.ts +240 -0
- package/src/preview-protocol.ts +93 -0
- package/src/style-slots.ts +111 -0
- package/src/theme-manifest.ts +140 -0
- package/src/validation.ts +196 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pre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AAC,CAAC;AAElE,eAAO,MAAM,0BAA0B;;;kBAK5B,CAAC;AAEZ,eAAO,MAAM,4BAA4B;;;kBAK9B,CAAC;AAEZ,eAAO,MAAM,gCAAgC;;;;kBAMlC,CAAC;AAEZ,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;kBAMrC,CAAC;AAEZ,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAKhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { BuilderSettingsSchema } from "./builder-settings.js";
|
|
3
|
+
export const BuilderSelectionSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
pageId: z.string().min(1).optional(),
|
|
6
|
+
blockId: z.string().min(1).optional(),
|
|
7
|
+
blockType: z.string().min(1).optional(),
|
|
8
|
+
contentPath: z.string().min(1).optional(),
|
|
9
|
+
slotId: z.string().min(1).optional(),
|
|
10
|
+
elementType: z.enum(['block', 'text', 'image', 'link', 'button', 'style']).optional(),
|
|
11
|
+
href: z.string().optional(),
|
|
12
|
+
target: z.string().optional(),
|
|
13
|
+
rel: z.string().optional(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
16
|
+
export const PreviewApplyStateMessageSchema = z
|
|
17
|
+
.object({
|
|
18
|
+
type: z.literal('APPLY_STATE'),
|
|
19
|
+
revision: z.number().int().nonnegative(),
|
|
20
|
+
state: BuilderSettingsSchema,
|
|
21
|
+
})
|
|
22
|
+
.strict();
|
|
23
|
+
export const PreviewReloadMessageSchema = z
|
|
24
|
+
.object({
|
|
25
|
+
type: z.literal('RELOAD'),
|
|
26
|
+
revision: z.number().int().nonnegative(),
|
|
27
|
+
reason: z.enum(['manifest-change', 'source-change']),
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
30
|
+
export const PreviewSelectElementMessageSchema = z
|
|
31
|
+
.object({
|
|
32
|
+
type: z.literal('SELECT_ELEMENT'),
|
|
33
|
+
revision: z.number().int().nonnegative().optional(),
|
|
34
|
+
selection: BuilderSelectionSchema,
|
|
35
|
+
})
|
|
36
|
+
.strict();
|
|
37
|
+
export const PreviewRequestReadyMessageSchema = z
|
|
38
|
+
.object({
|
|
39
|
+
type: z.literal('REQUEST_READY'),
|
|
40
|
+
})
|
|
41
|
+
.strict();
|
|
42
|
+
export const PreviewMessageSchema = z.discriminatedUnion('type', [
|
|
43
|
+
PreviewApplyStateMessageSchema,
|
|
44
|
+
PreviewReloadMessageSchema,
|
|
45
|
+
PreviewSelectElementMessageSchema,
|
|
46
|
+
PreviewRequestReadyMessageSchema,
|
|
47
|
+
]);
|
|
48
|
+
export const PreviewReadyResponseSchema = z
|
|
49
|
+
.object({
|
|
50
|
+
type: z.literal('READY'),
|
|
51
|
+
revision: z.number().int().nonnegative(),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
54
|
+
export const PreviewAppliedResponseSchema = z
|
|
55
|
+
.object({
|
|
56
|
+
type: z.literal('APPLIED'),
|
|
57
|
+
revision: z.number().int().nonnegative(),
|
|
58
|
+
})
|
|
59
|
+
.strict();
|
|
60
|
+
export const PreviewApplyFailedResponseSchema = z
|
|
61
|
+
.object({
|
|
62
|
+
type: z.literal('APPLY_FAILED'),
|
|
63
|
+
revision: z.number().int().nonnegative(),
|
|
64
|
+
error: z.string().min(1),
|
|
65
|
+
})
|
|
66
|
+
.strict();
|
|
67
|
+
export const PreviewElementClickedResponseSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
type: z.literal('ELEMENT_CLICKED'),
|
|
70
|
+
revision: z.number().int().nonnegative().optional(),
|
|
71
|
+
selection: BuilderSelectionSchema,
|
|
72
|
+
})
|
|
73
|
+
.strict();
|
|
74
|
+
export const PreviewResponseSchema = z.discriminatedUnion('type', [
|
|
75
|
+
PreviewReadyResponseSchema,
|
|
76
|
+
PreviewAppliedResponseSchema,
|
|
77
|
+
PreviewApplyFailedResponseSchema,
|
|
78
|
+
PreviewElementClickedResponseSchema,
|
|
79
|
+
]);
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
export declare const BreakpointSchema: z.ZodEnum<{
|
|
3
|
+
base: "base";
|
|
4
|
+
sm: "sm";
|
|
5
|
+
md: "md";
|
|
6
|
+
lg: "lg";
|
|
7
|
+
xl: "xl";
|
|
8
|
+
}>;
|
|
9
|
+
export type Breakpoint = z.infer<typeof BreakpointSchema>;
|
|
10
|
+
export declare const ResponsiveNumberSchema: z.ZodObject<{
|
|
11
|
+
base: z.ZodNumber;
|
|
12
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export type ResponsiveNumber = z.infer<typeof ResponsiveNumberSchema>;
|
|
18
|
+
export declare const ResponsiveStringSchema: z.ZodObject<{
|
|
19
|
+
base: z.ZodString;
|
|
20
|
+
sm: z.ZodOptional<z.ZodString>;
|
|
21
|
+
md: z.ZodOptional<z.ZodString>;
|
|
22
|
+
lg: z.ZodOptional<z.ZodString>;
|
|
23
|
+
xl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>;
|
|
25
|
+
export type ResponsiveString = z.infer<typeof ResponsiveStringSchema>;
|
|
26
|
+
export declare const ColorSchema: z.ZodString;
|
|
27
|
+
export type Color = z.infer<typeof ColorSchema>;
|
|
28
|
+
export declare const FontWeightSchema: z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<200>, z.ZodLiteral<300>, z.ZodLiteral<400>, z.ZodLiteral<500>, z.ZodLiteral<600>, z.ZodLiteral<700>, z.ZodLiteral<800>, z.ZodLiteral<900>]>;
|
|
29
|
+
export type FontWeight = z.infer<typeof FontWeightSchema>;
|
|
30
|
+
export declare const StyleSlotIdSchema: z.ZodEnum<{
|
|
31
|
+
"button.radius": "button.radius";
|
|
32
|
+
"button.background": "button.background";
|
|
33
|
+
"button.foreground": "button.foreground";
|
|
34
|
+
"button.border": "button.border";
|
|
35
|
+
"button.font.weight": "button.font.weight";
|
|
36
|
+
"input.radius": "input.radius";
|
|
37
|
+
"input.height": "input.height";
|
|
38
|
+
"input.border": "input.border";
|
|
39
|
+
"input.background": "input.background";
|
|
40
|
+
"input.foreground": "input.foreground";
|
|
41
|
+
"card.radius": "card.radius";
|
|
42
|
+
"card.background": "card.background";
|
|
43
|
+
"card.border": "card.border";
|
|
44
|
+
"section.padding.y": "section.padding.y";
|
|
45
|
+
"section.padding.x": "section.padding.x";
|
|
46
|
+
"container.width": "container.width";
|
|
47
|
+
"color.primary": "color.primary";
|
|
48
|
+
"color.accent": "color.accent";
|
|
49
|
+
"color.background": "color.background";
|
|
50
|
+
"color.foreground": "color.foreground";
|
|
51
|
+
"color.muted": "color.muted";
|
|
52
|
+
"link.color": "link.color";
|
|
53
|
+
"typography.heading.weight": "typography.heading.weight";
|
|
54
|
+
"typography.body.size": "typography.body.size";
|
|
55
|
+
}>;
|
|
56
|
+
export type StyleSlotId = z.infer<typeof StyleSlotIdSchema>;
|
|
57
|
+
export declare const CORE_STYLE_SLOT_IDS: ("button.radius" | "button.background" | "button.foreground" | "button.border" | "button.font.weight" | "input.radius" | "input.height" | "input.border" | "input.background" | "input.foreground" | "card.radius" | "card.background" | "card.border" | "section.padding.y" | "section.padding.x" | "container.width" | "color.primary" | "color.accent" | "color.background" | "color.foreground" | "color.muted" | "link.color" | "typography.heading.weight" | "typography.body.size")[];
|
|
58
|
+
export declare const StyleSlotsSchema: z.ZodObject<{
|
|
59
|
+
'button.radius': z.ZodOptional<z.ZodObject<{
|
|
60
|
+
base: z.ZodNumber;
|
|
61
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
}, z.core.$strict>>;
|
|
66
|
+
'button.background': z.ZodOptional<z.ZodString>;
|
|
67
|
+
'button.foreground': z.ZodOptional<z.ZodString>;
|
|
68
|
+
'button.border': z.ZodOptional<z.ZodString>;
|
|
69
|
+
'button.font.weight': z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<200>, z.ZodLiteral<300>, z.ZodLiteral<400>, z.ZodLiteral<500>, z.ZodLiteral<600>, z.ZodLiteral<700>, z.ZodLiteral<800>, z.ZodLiteral<900>]>>;
|
|
70
|
+
'input.radius': z.ZodOptional<z.ZodObject<{
|
|
71
|
+
base: z.ZodNumber;
|
|
72
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, z.core.$strict>>;
|
|
77
|
+
'input.height': z.ZodOptional<z.ZodObject<{
|
|
78
|
+
base: z.ZodNumber;
|
|
79
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
}, z.core.$strict>>;
|
|
84
|
+
'input.border': z.ZodOptional<z.ZodString>;
|
|
85
|
+
'input.background': z.ZodOptional<z.ZodString>;
|
|
86
|
+
'input.foreground': z.ZodOptional<z.ZodString>;
|
|
87
|
+
'card.radius': z.ZodOptional<z.ZodObject<{
|
|
88
|
+
base: z.ZodNumber;
|
|
89
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
'card.background': z.ZodOptional<z.ZodString>;
|
|
95
|
+
'card.border': z.ZodOptional<z.ZodString>;
|
|
96
|
+
'section.padding.y': z.ZodOptional<z.ZodObject<{
|
|
97
|
+
base: z.ZodNumber;
|
|
98
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
99
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
103
|
+
'section.padding.x': z.ZodOptional<z.ZodObject<{
|
|
104
|
+
base: z.ZodNumber;
|
|
105
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strict>>;
|
|
110
|
+
'container.width': z.ZodOptional<z.ZodObject<{
|
|
111
|
+
base: z.ZodNumber;
|
|
112
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
}, z.core.$strict>>;
|
|
117
|
+
'color.primary': z.ZodOptional<z.ZodString>;
|
|
118
|
+
'color.accent': z.ZodOptional<z.ZodString>;
|
|
119
|
+
'color.background': z.ZodOptional<z.ZodString>;
|
|
120
|
+
'color.foreground': z.ZodOptional<z.ZodString>;
|
|
121
|
+
'color.muted': z.ZodOptional<z.ZodString>;
|
|
122
|
+
'link.color': z.ZodOptional<z.ZodString>;
|
|
123
|
+
'typography.heading.weight': z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<200>, z.ZodLiteral<300>, z.ZodLiteral<400>, z.ZodLiteral<500>, z.ZodLiteral<600>, z.ZodLiteral<700>, z.ZodLiteral<800>, z.ZodLiteral<900>]>>;
|
|
124
|
+
'typography.body.size': z.ZodOptional<z.ZodObject<{
|
|
125
|
+
base: z.ZodNumber;
|
|
126
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
128
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
}, z.core.$strict>>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
export type StyleSlots = z.infer<typeof StyleSlotsSchema>;
|
|
133
|
+
export declare const StyleSlotDefaultsSchema: z.ZodObject<{
|
|
134
|
+
'button.radius': z.ZodOptional<z.ZodObject<{
|
|
135
|
+
base: z.ZodNumber;
|
|
136
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
'button.background': z.ZodOptional<z.ZodString>;
|
|
142
|
+
'button.foreground': z.ZodOptional<z.ZodString>;
|
|
143
|
+
'button.border': z.ZodOptional<z.ZodString>;
|
|
144
|
+
'button.font.weight': z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<200>, z.ZodLiteral<300>, z.ZodLiteral<400>, z.ZodLiteral<500>, z.ZodLiteral<600>, z.ZodLiteral<700>, z.ZodLiteral<800>, z.ZodLiteral<900>]>>;
|
|
145
|
+
'input.radius': z.ZodOptional<z.ZodObject<{
|
|
146
|
+
base: z.ZodNumber;
|
|
147
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
148
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
149
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
150
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
151
|
+
}, z.core.$strict>>;
|
|
152
|
+
'input.height': z.ZodOptional<z.ZodObject<{
|
|
153
|
+
base: z.ZodNumber;
|
|
154
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
'input.border': z.ZodOptional<z.ZodString>;
|
|
160
|
+
'input.background': z.ZodOptional<z.ZodString>;
|
|
161
|
+
'input.foreground': z.ZodOptional<z.ZodString>;
|
|
162
|
+
'card.radius': z.ZodOptional<z.ZodObject<{
|
|
163
|
+
base: z.ZodNumber;
|
|
164
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
165
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
167
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
168
|
+
}, z.core.$strict>>;
|
|
169
|
+
'card.background': z.ZodOptional<z.ZodString>;
|
|
170
|
+
'card.border': z.ZodOptional<z.ZodString>;
|
|
171
|
+
'section.padding.y': z.ZodOptional<z.ZodObject<{
|
|
172
|
+
base: z.ZodNumber;
|
|
173
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
}, z.core.$strict>>;
|
|
178
|
+
'section.padding.x': z.ZodOptional<z.ZodObject<{
|
|
179
|
+
base: z.ZodNumber;
|
|
180
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
183
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
}, z.core.$strict>>;
|
|
185
|
+
'container.width': z.ZodOptional<z.ZodObject<{
|
|
186
|
+
base: z.ZodNumber;
|
|
187
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
}, z.core.$strict>>;
|
|
192
|
+
'color.primary': z.ZodOptional<z.ZodString>;
|
|
193
|
+
'color.accent': z.ZodOptional<z.ZodString>;
|
|
194
|
+
'color.background': z.ZodOptional<z.ZodString>;
|
|
195
|
+
'color.foreground': z.ZodOptional<z.ZodString>;
|
|
196
|
+
'color.muted': z.ZodOptional<z.ZodString>;
|
|
197
|
+
'link.color': z.ZodOptional<z.ZodString>;
|
|
198
|
+
'typography.heading.weight': z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<100>, z.ZodLiteral<200>, z.ZodLiteral<300>, z.ZodLiteral<400>, z.ZodLiteral<500>, z.ZodLiteral<600>, z.ZodLiteral<700>, z.ZodLiteral<800>, z.ZodLiteral<900>]>>;
|
|
199
|
+
'typography.body.size': z.ZodOptional<z.ZodObject<{
|
|
200
|
+
base: z.ZodNumber;
|
|
201
|
+
sm: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
md: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
lg: z.ZodOptional<z.ZodNumber>;
|
|
204
|
+
xl: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
}, z.core.$strict>>;
|
|
206
|
+
}, z.core.$strict>;
|
|
207
|
+
export type StyleSlotDefaults = StyleSlots;
|
|
208
|
+
export declare function parseStyleSlots(input: unknown): StyleSlots;
|
|
209
|
+
//# sourceMappingURL=style-slots.d.ts.map
|
|
@@ -0,0 +1 @@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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAmB,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE1D"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
export const BreakpointSchema = z.enum(['base', 'sm', 'md', 'lg', 'xl']);
|
|
3
|
+
export const ResponsiveNumberSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
base: z.number().finite(),
|
|
6
|
+
sm: z.number().finite().optional(),
|
|
7
|
+
md: z.number().finite().optional(),
|
|
8
|
+
lg: z.number().finite().optional(),
|
|
9
|
+
xl: z.number().finite().optional(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
12
|
+
export const ResponsiveStringSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
base: z.string().min(1),
|
|
15
|
+
sm: z.string().min(1).optional(),
|
|
16
|
+
md: z.string().min(1).optional(),
|
|
17
|
+
lg: z.string().min(1).optional(),
|
|
18
|
+
xl: z.string().min(1).optional(),
|
|
19
|
+
})
|
|
20
|
+
.strict();
|
|
21
|
+
export const ColorSchema = z
|
|
22
|
+
.string()
|
|
23
|
+
.regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, 'Expected a hex color');
|
|
24
|
+
export const FontWeightSchema = z.union([
|
|
25
|
+
z.literal(100),
|
|
26
|
+
z.literal(200),
|
|
27
|
+
z.literal(300),
|
|
28
|
+
z.literal(400),
|
|
29
|
+
z.literal(500),
|
|
30
|
+
z.literal(600),
|
|
31
|
+
z.literal(700),
|
|
32
|
+
z.literal(800),
|
|
33
|
+
z.literal(900),
|
|
34
|
+
]);
|
|
35
|
+
export const StyleSlotIdSchema = z.enum([
|
|
36
|
+
'button.radius',
|
|
37
|
+
'button.background',
|
|
38
|
+
'button.foreground',
|
|
39
|
+
'button.border',
|
|
40
|
+
'button.font.weight',
|
|
41
|
+
'input.radius',
|
|
42
|
+
'input.height',
|
|
43
|
+
'input.border',
|
|
44
|
+
'input.background',
|
|
45
|
+
'input.foreground',
|
|
46
|
+
'card.radius',
|
|
47
|
+
'card.background',
|
|
48
|
+
'card.border',
|
|
49
|
+
'section.padding.y',
|
|
50
|
+
'section.padding.x',
|
|
51
|
+
'container.width',
|
|
52
|
+
'color.primary',
|
|
53
|
+
'color.accent',
|
|
54
|
+
'color.background',
|
|
55
|
+
'color.foreground',
|
|
56
|
+
'color.muted',
|
|
57
|
+
'link.color',
|
|
58
|
+
'typography.heading.weight',
|
|
59
|
+
'typography.body.size',
|
|
60
|
+
]);
|
|
61
|
+
export const CORE_STYLE_SLOT_IDS = StyleSlotIdSchema.options;
|
|
62
|
+
export const StyleSlotsSchema = z
|
|
63
|
+
.object({
|
|
64
|
+
'button.radius': ResponsiveNumberSchema.optional(),
|
|
65
|
+
'button.background': ColorSchema.optional(),
|
|
66
|
+
'button.foreground': ColorSchema.optional(),
|
|
67
|
+
'button.border': ColorSchema.optional(),
|
|
68
|
+
'button.font.weight': FontWeightSchema.optional(),
|
|
69
|
+
'input.radius': ResponsiveNumberSchema.optional(),
|
|
70
|
+
'input.height': ResponsiveNumberSchema.optional(),
|
|
71
|
+
'input.border': ColorSchema.optional(),
|
|
72
|
+
'input.background': ColorSchema.optional(),
|
|
73
|
+
'input.foreground': ColorSchema.optional(),
|
|
74
|
+
'card.radius': ResponsiveNumberSchema.optional(),
|
|
75
|
+
'card.background': ColorSchema.optional(),
|
|
76
|
+
'card.border': ColorSchema.optional(),
|
|
77
|
+
'section.padding.y': ResponsiveNumberSchema.optional(),
|
|
78
|
+
'section.padding.x': ResponsiveNumberSchema.optional(),
|
|
79
|
+
'container.width': ResponsiveNumberSchema.optional(),
|
|
80
|
+
'color.primary': ColorSchema.optional(),
|
|
81
|
+
'color.accent': ColorSchema.optional(),
|
|
82
|
+
'color.background': ColorSchema.optional(),
|
|
83
|
+
'color.foreground': ColorSchema.optional(),
|
|
84
|
+
'color.muted': ColorSchema.optional(),
|
|
85
|
+
'link.color': ColorSchema.optional(),
|
|
86
|
+
'typography.heading.weight': FontWeightSchema.optional(),
|
|
87
|
+
'typography.body.size': ResponsiveNumberSchema.optional(),
|
|
88
|
+
})
|
|
89
|
+
.strict();
|
|
90
|
+
export const StyleSlotDefaultsSchema = StyleSlotsSchema;
|
|
91
|
+
export function parseStyleSlots(input) {
|
|
92
|
+
return StyleSlotsSchema.parse(input);
|
|
93
|
+
}
|