@shoppexio/builder-contracts 0.1.0 → 0.1.2
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-settings.d.ts +11 -666
- package/dist/builder-settings.d.ts.map +1 -1
- package/dist/builder-settings.js +2 -1
- package/dist/canonical-settings.d.ts +18 -0
- package/dist/canonical-settings.d.ts.map +1 -0
- package/dist/canonical-settings.js +106 -0
- package/dist/custom-pages.d.ts +15 -0
- package/dist/custom-pages.d.ts.map +1 -0
- package/dist/custom-pages.js +40 -0
- package/dist/dedicated-pages.d.ts +15 -0
- package/dist/dedicated-pages.d.ts.map +1 -0
- package/dist/dedicated-pages.js +142 -0
- package/dist/events.d.ts +35 -240
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +7 -0
- package/dist/fields.d.ts +229 -10
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +27 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/legacy-manifest.d.ts +18 -0
- package/dist/legacy-manifest.d.ts.map +1 -1
- package/dist/legacy-manifest.js +137 -22
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +55 -6
- package/dist/persistence.d.ts +7 -0
- package/dist/persistence.d.ts.map +1 -0
- package/dist/persistence.js +58 -0
- package/dist/preview-boot.d.ts +68 -0
- package/dist/preview-boot.d.ts.map +1 -0
- package/dist/preview-boot.js +38 -0
- package/dist/preview-protocol.d.ts +227 -459
- package/dist/preview-protocol.d.ts.map +1 -1
- package/dist/preview-protocol.js +112 -0
- package/dist/preview-session-resolve.d.ts +115 -0
- package/dist/preview-session-resolve.d.ts.map +1 -0
- package/dist/preview-session-resolve.js +25 -0
- package/dist/preview-trusted-origins.d.ts +4 -0
- package/dist/preview-trusted-origins.d.ts.map +1 -0
- package/dist/preview-trusted-origins.js +28 -0
- package/dist/storefront-initial-data-html.d.ts +17 -0
- package/dist/storefront-initial-data-html.d.ts.map +1 -0
- package/dist/storefront-initial-data-html.js +83 -0
- package/dist/storefront-typography-fonts.d.ts +18 -0
- package/dist/storefront-typography-fonts.d.ts.map +1 -0
- package/dist/storefront-typography-fonts.js +89 -0
- package/dist/style-slots.d.ts +50 -152
- package/dist/style-slots.d.ts.map +1 -1
- package/dist/style-slots.js +80 -32
- package/dist/theme-manifest.d.ts +287 -456
- package/dist/theme-manifest.d.ts.map +1 -1
- package/dist/theme-manifest.js +92 -0
- package/dist/theme-schemes.d.ts +10 -0
- package/dist/theme-schemes.d.ts.map +1 -0
- package/dist/theme-schemes.js +25 -0
- package/dist/validation.d.ts +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +23 -12
- package/package.json +43 -1
- package/src/builder-contracts.test.ts +416 -3
- package/src/builder-settings.ts +4 -1
- package/src/canonical-settings.ts +156 -0
- package/src/custom-pages.test.ts +74 -0
- package/src/custom-pages.ts +70 -0
- package/src/dedicated-pages.test.ts +88 -0
- package/src/dedicated-pages.ts +173 -0
- package/src/events.ts +8 -0
- package/src/fields.ts +30 -0
- package/src/index.ts +10 -0
- package/src/legacy-manifest.ts +147 -23
- package/src/migrations.ts +70 -6
- package/src/persistence.ts +77 -0
- package/src/preview-boot.test.ts +72 -0
- package/src/preview-boot.ts +49 -0
- package/src/preview-protocol.test.ts +132 -0
- package/src/preview-protocol.ts +122 -0
- package/src/preview-session-resolve.test.ts +37 -0
- package/src/preview-session-resolve.ts +34 -0
- package/src/preview-trusted-origins.test.ts +24 -0
- package/src/preview-trusted-origins.ts +35 -0
- package/src/storefront-initial-data-html.test.ts +73 -0
- package/src/storefront-initial-data-html.ts +112 -0
- package/src/storefront-typography-fonts.test.ts +48 -0
- package/src/storefront-typography-fonts.ts +108 -0
- package/src/style-slots.ts +102 -34
- package/src/theme-manifest.ts +118 -1
- package/src/theme-schemes.ts +34 -0
- package/src/validation.ts +32 -13
- package/dist/builder-contracts.test.d.ts +0 -2
- package/dist/builder-contracts.test.d.ts.map +0 -1
- package/dist/builder-contracts.test.js +0 -361
package/dist/style-slots.d.ts
CHANGED
|
@@ -23,11 +23,11 @@ export declare const ResponsiveStringSchema: z.ZodObject<{
|
|
|
23
23
|
xl: z.ZodOptional<z.ZodString>;
|
|
24
24
|
}, z.core.$strict>;
|
|
25
25
|
export type ResponsiveString = z.infer<typeof ResponsiveStringSchema>;
|
|
26
|
-
export declare const ColorSchema: z.ZodString
|
|
26
|
+
export declare const ColorSchema: z.ZodUnion<readonly [z.ZodLiteral<"transparent">, z.ZodString]>;
|
|
27
27
|
export type Color = z.infer<typeof ColorSchema>;
|
|
28
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
29
|
export type FontWeight = z.infer<typeof FontWeightSchema>;
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const CoreStyleSlotIdSchema: z.ZodEnum<{
|
|
31
31
|
"button.radius": "button.radius";
|
|
32
32
|
"button.background": "button.background";
|
|
33
33
|
"button.foreground": "button.foreground";
|
|
@@ -53,157 +53,55 @@ export declare const StyleSlotIdSchema: z.ZodEnum<{
|
|
|
53
53
|
"typography.heading.weight": "typography.heading.weight";
|
|
54
54
|
"typography.body.size": "typography.body.size";
|
|
55
55
|
}>;
|
|
56
|
-
export type
|
|
56
|
+
export type CoreStyleSlotId = z.infer<typeof CoreStyleSlotIdSchema>;
|
|
57
|
+
export declare const ThemeStyleSlotIdSchema: z.ZodString;
|
|
58
|
+
export type ThemeStyleSlotId = `theme.${string}`;
|
|
59
|
+
export declare const StyleSlotIdSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
60
|
+
"button.radius": "button.radius";
|
|
61
|
+
"button.background": "button.background";
|
|
62
|
+
"button.foreground": "button.foreground";
|
|
63
|
+
"button.border": "button.border";
|
|
64
|
+
"button.font.weight": "button.font.weight";
|
|
65
|
+
"input.radius": "input.radius";
|
|
66
|
+
"input.height": "input.height";
|
|
67
|
+
"input.border": "input.border";
|
|
68
|
+
"input.background": "input.background";
|
|
69
|
+
"input.foreground": "input.foreground";
|
|
70
|
+
"card.radius": "card.radius";
|
|
71
|
+
"card.background": "card.background";
|
|
72
|
+
"card.border": "card.border";
|
|
73
|
+
"section.padding.y": "section.padding.y";
|
|
74
|
+
"section.padding.x": "section.padding.x";
|
|
75
|
+
"container.width": "container.width";
|
|
76
|
+
"color.primary": "color.primary";
|
|
77
|
+
"color.accent": "color.accent";
|
|
78
|
+
"color.background": "color.background";
|
|
79
|
+
"color.foreground": "color.foreground";
|
|
80
|
+
"color.muted": "color.muted";
|
|
81
|
+
"link.color": "link.color";
|
|
82
|
+
"typography.heading.weight": "typography.heading.weight";
|
|
83
|
+
"typography.body.size": "typography.body.size";
|
|
84
|
+
}>, z.ZodString]>;
|
|
85
|
+
export type StyleSlotId = CoreStyleSlotId | ThemeStyleSlotId;
|
|
57
86
|
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
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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>;
|
|
87
|
+
export declare const ThemeStyleSlotValueSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"transparent">, z.ZodString]>, 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>, z.ZodObject<{
|
|
94
|
+
base: z.ZodString;
|
|
95
|
+
sm: z.ZodOptional<z.ZodString>;
|
|
96
|
+
md: z.ZodOptional<z.ZodString>;
|
|
97
|
+
lg: z.ZodOptional<z.ZodString>;
|
|
98
|
+
xl: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strict>, 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>]>, z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
100
|
+
export type ThemeStyleSlotValue = z.infer<typeof ThemeStyleSlotValueSchema>;
|
|
101
|
+
export type StyleSlotValue = Color | ResponsiveNumber | ResponsiveString | FontWeight | string | number | boolean;
|
|
102
|
+
export type StyleSlots = Partial<Record<StyleSlotId, StyleSlotValue>>;
|
|
103
|
+
export declare const StyleSlotsSchema: z.ZodType<StyleSlots>;
|
|
104
|
+
export declare const StyleSlotDefaultsSchema: z.ZodType<Partial<Record<StyleSlotId, StyleSlotValue>>, unknown, z.core.$ZodTypeInternals<Partial<Record<StyleSlotId, StyleSlotValue>>, unknown>>;
|
|
207
105
|
export type StyleSlotDefaults = StyleSlots;
|
|
208
106
|
export declare function parseStyleSlots(input: unknown): StyleSlots;
|
|
209
107
|
//# sourceMappingURL=style-slots.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style-slots.d.ts","sourceRoot":"","sources":["../src/style-slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,gBAAgB;;;;;;EAA2C,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,sBAAsB;;;;;;kBAQxB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;kBAQxB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"style-slots.d.ts","sourceRoot":"","sources":["../src/style-slots.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,gBAAgB;;;;;;EAA2C,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,sBAAsB;;;;;;kBAQxB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,sBAAsB;;;;;;kBAQxB,CAAC;AACZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAItE,eAAO,MAAM,WAAW,iEAGtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,gBAAgB,kMAU3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;EAyBhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,eAAO,MAAM,sBAAsB,aAE+C,CAAC;AACnF,MAAM,MAAM,gBAAgB,GAAG,SAAS,MAAM,EAAE,CAAC;AAEjD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;iBAA2D,CAAC;AAC1F,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAE7D,eAAO,MAAM,mBAAmB,8dAAgC,CAAC;AAEjE,eAAO,MAAM,yBAAyB;;;;;;;;;;;;8PAQpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,MAAM,cAAc,GACtB,KAAK,GACL,gBAAgB,GAChB,gBAAgB,GAChB,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,CAAC;AA6BZ,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;AAEtE,eAAO,MAAM,gBAAgB,EAoCrB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE9B,eAAO,MAAM,uBAAuB,mJAAmB,CAAC;AACxD,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE3C,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAE1D"}
|
package/dist/style-slots.js
CHANGED
|
@@ -18,9 +18,11 @@ export const ResponsiveStringSchema = z
|
|
|
18
18
|
xl: z.string().min(1).optional(),
|
|
19
19
|
})
|
|
20
20
|
.strict();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
21
|
+
const HEX_COLOR_PATTERN = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
|
|
22
|
+
export const ColorSchema = z.union([
|
|
23
|
+
z.literal('transparent'),
|
|
24
|
+
z.string().regex(HEX_COLOR_PATTERN, 'Expected a hex color'),
|
|
25
|
+
]);
|
|
24
26
|
export const FontWeightSchema = z.union([
|
|
25
27
|
z.literal(100),
|
|
26
28
|
z.literal(200),
|
|
@@ -32,7 +34,7 @@ export const FontWeightSchema = z.union([
|
|
|
32
34
|
z.literal(800),
|
|
33
35
|
z.literal(900),
|
|
34
36
|
]);
|
|
35
|
-
export const
|
|
37
|
+
export const CoreStyleSlotIdSchema = z.enum([
|
|
36
38
|
'button.radius',
|
|
37
39
|
'button.background',
|
|
38
40
|
'button.foreground',
|
|
@@ -58,35 +60,81 @@ export const StyleSlotIdSchema = z.enum([
|
|
|
58
60
|
'typography.heading.weight',
|
|
59
61
|
'typography.body.size',
|
|
60
62
|
]);
|
|
61
|
-
export const
|
|
63
|
+
export const ThemeStyleSlotIdSchema = z
|
|
64
|
+
.string()
|
|
65
|
+
.regex(/^theme\.[a-z0-9][a-z0-9._-]*$/, 'Expected a theme-scoped style slot id');
|
|
66
|
+
export const StyleSlotIdSchema = z.union([CoreStyleSlotIdSchema, ThemeStyleSlotIdSchema]);
|
|
67
|
+
export const CORE_STYLE_SLOT_IDS = CoreStyleSlotIdSchema.options;
|
|
68
|
+
export const ThemeStyleSlotValueSchema = z.union([
|
|
69
|
+
ColorSchema,
|
|
70
|
+
ResponsiveNumberSchema,
|
|
71
|
+
ResponsiveStringSchema,
|
|
72
|
+
FontWeightSchema,
|
|
73
|
+
z.string().min(1),
|
|
74
|
+
z.number().finite(),
|
|
75
|
+
z.boolean(),
|
|
76
|
+
]);
|
|
77
|
+
const CORE_STYLE_SLOT_SCHEMAS = {
|
|
78
|
+
'button.radius': ResponsiveNumberSchema,
|
|
79
|
+
'button.background': ColorSchema,
|
|
80
|
+
'button.foreground': ColorSchema,
|
|
81
|
+
'button.border': ColorSchema,
|
|
82
|
+
'button.font.weight': FontWeightSchema,
|
|
83
|
+
'input.radius': ResponsiveNumberSchema,
|
|
84
|
+
'input.height': ResponsiveNumberSchema,
|
|
85
|
+
'input.border': ColorSchema,
|
|
86
|
+
'input.background': ColorSchema,
|
|
87
|
+
'input.foreground': ColorSchema,
|
|
88
|
+
'card.radius': ResponsiveNumberSchema,
|
|
89
|
+
'card.background': ColorSchema,
|
|
90
|
+
'card.border': ColorSchema,
|
|
91
|
+
'section.padding.y': ResponsiveNumberSchema,
|
|
92
|
+
'section.padding.x': ResponsiveNumberSchema,
|
|
93
|
+
'container.width': ResponsiveNumberSchema,
|
|
94
|
+
'color.primary': ColorSchema,
|
|
95
|
+
'color.accent': ColorSchema,
|
|
96
|
+
'color.background': ColorSchema,
|
|
97
|
+
'color.foreground': ColorSchema,
|
|
98
|
+
'color.muted': ColorSchema,
|
|
99
|
+
'link.color': ColorSchema,
|
|
100
|
+
'typography.heading.weight': FontWeightSchema,
|
|
101
|
+
'typography.body.size': ResponsiveNumberSchema,
|
|
102
|
+
};
|
|
62
103
|
export const StyleSlotsSchema = z
|
|
63
|
-
.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
104
|
+
.record(z.string().min(1), z.unknown())
|
|
105
|
+
.superRefine((slots, ctx) => {
|
|
106
|
+
for (const [slotId, value] of Object.entries(slots)) {
|
|
107
|
+
const coreSlotId = CoreStyleSlotIdSchema.safeParse(slotId);
|
|
108
|
+
if (coreSlotId.success) {
|
|
109
|
+
const parsedValue = CORE_STYLE_SLOT_SCHEMAS[coreSlotId.data].safeParse(value);
|
|
110
|
+
if (!parsedValue.success) {
|
|
111
|
+
ctx.addIssue({
|
|
112
|
+
code: 'custom',
|
|
113
|
+
path: [slotId],
|
|
114
|
+
message: `Invalid value for core style slot "${slotId}"`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const themeSlotId = ThemeStyleSlotIdSchema.safeParse(slotId);
|
|
120
|
+
if (!themeSlotId.success) {
|
|
121
|
+
ctx.addIssue({
|
|
122
|
+
code: 'custom',
|
|
123
|
+
path: [slotId],
|
|
124
|
+
message: `Unknown style slot "${slotId}"`,
|
|
125
|
+
});
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const parsedThemeValue = ThemeStyleSlotValueSchema.safeParse(value);
|
|
129
|
+
if (!parsedThemeValue.success) {
|
|
130
|
+
ctx.addIssue({
|
|
131
|
+
code: 'custom',
|
|
132
|
+
path: [slotId],
|
|
133
|
+
message: `Invalid value for theme style slot "${slotId}"`,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
});
|
|
90
138
|
export const StyleSlotDefaultsSchema = StyleSlotsSchema;
|
|
91
139
|
export function parseStyleSlots(input) {
|
|
92
140
|
return StyleSlotsSchema.parse(input);
|