@lucrex/storefront-blocks 0.0.0-stage → 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/README.md +44 -2
- package/dist/index.cjs +1231 -0
- package/dist/index.mjs +1208 -0
- package/dist/server.cjs +1278 -0
- package/dist/server.mjs +1257 -0
- package/dist/types/block.d.ts +244 -0
- package/dist/types/blocks/checkout.d.ts +5 -0
- package/dist/types/blocks/content.d.ts +19 -0
- package/dist/types/blocks/index.d.ts +3 -0
- package/dist/types/blocks/layout.d.ts +9 -0
- package/dist/types/blocks/product.d.ts +13 -0
- package/dist/types/context.d.ts +7 -0
- package/dist/types/data.d.ts +71 -0
- package/dist/types/document.d.ts +29 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/json-schema.d.ts +15 -0
- package/dist/types/page.d.ts +14 -0
- package/dist/types/server.d.ts +10 -0
- package/dist/types/style.d.ts +188 -0
- package/dist/types/templates/funnels.d.ts +7 -0
- package/dist/types/validate.d.ts +18 -0
- package/package.json +57 -5
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { PageData } from './data';
|
|
4
|
+
import { BlockStyle } from './style';
|
|
5
|
+
export type BlockCategory = 'layout' | 'content' | 'product' | 'checkout';
|
|
6
|
+
export type FieldDefinition = {
|
|
7
|
+
type: 'text' | 'textarea' | 'number';
|
|
8
|
+
label: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'select' | 'radio';
|
|
11
|
+
label: string;
|
|
12
|
+
options: {
|
|
13
|
+
label: string;
|
|
14
|
+
value: string | number | boolean;
|
|
15
|
+
}[];
|
|
16
|
+
} | {
|
|
17
|
+
type: 'slot';
|
|
18
|
+
label: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const BlockIdSchema: z.ZodString;
|
|
21
|
+
export declare const ClassNameSchema: z.ZodString;
|
|
22
|
+
export declare const BlockNodeSchema: z.ZodObject<{
|
|
23
|
+
type: z.ZodString;
|
|
24
|
+
props: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
}, z.core.$loose>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export declare const BaseBlockPropsSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
className: z.ZodOptional<z.ZodString>;
|
|
31
|
+
style: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
display: z.ZodOptional<z.ZodString>;
|
|
33
|
+
position: z.ZodOptional<z.ZodString>;
|
|
34
|
+
top: z.ZodOptional<z.ZodString>;
|
|
35
|
+
right: z.ZodOptional<z.ZodString>;
|
|
36
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
37
|
+
left: z.ZodOptional<z.ZodString>;
|
|
38
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
39
|
+
width: z.ZodOptional<z.ZodString>;
|
|
40
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
41
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
42
|
+
height: z.ZodOptional<z.ZodString>;
|
|
43
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
44
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
45
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
46
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
47
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
48
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
49
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
50
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
51
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
52
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
53
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
54
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
55
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
56
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
57
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
58
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
59
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
60
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
61
|
+
color: z.ZodOptional<z.ZodString>;
|
|
62
|
+
background: z.ZodOptional<z.ZodString>;
|
|
63
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
64
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
65
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
66
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
67
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
68
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
69
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
70
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
71
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
72
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
73
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
74
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
75
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
76
|
+
border: z.ZodOptional<z.ZodString>;
|
|
77
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
78
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
79
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
80
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
81
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
82
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
83
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
84
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
85
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
86
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
87
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
88
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
display: z.ZodOptional<z.ZodString>;
|
|
90
|
+
position: z.ZodOptional<z.ZodString>;
|
|
91
|
+
top: z.ZodOptional<z.ZodString>;
|
|
92
|
+
right: z.ZodOptional<z.ZodString>;
|
|
93
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
94
|
+
left: z.ZodOptional<z.ZodString>;
|
|
95
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
96
|
+
width: z.ZodOptional<z.ZodString>;
|
|
97
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
98
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
99
|
+
height: z.ZodOptional<z.ZodString>;
|
|
100
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
101
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
102
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
103
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
104
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
105
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
106
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
107
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
108
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
109
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
110
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
111
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
112
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
113
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
114
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
115
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
116
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
117
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
118
|
+
color: z.ZodOptional<z.ZodString>;
|
|
119
|
+
background: z.ZodOptional<z.ZodString>;
|
|
120
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
121
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
122
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
123
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
124
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
125
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
126
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
127
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
128
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
129
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
130
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
131
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
132
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
133
|
+
border: z.ZodOptional<z.ZodString>;
|
|
134
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
135
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
136
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
137
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
138
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
139
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
140
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
141
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
142
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
143
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
144
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
mobile: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
display: z.ZodOptional<z.ZodString>;
|
|
148
|
+
position: z.ZodOptional<z.ZodString>;
|
|
149
|
+
top: z.ZodOptional<z.ZodString>;
|
|
150
|
+
right: z.ZodOptional<z.ZodString>;
|
|
151
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
152
|
+
left: z.ZodOptional<z.ZodString>;
|
|
153
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
154
|
+
width: z.ZodOptional<z.ZodString>;
|
|
155
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
156
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
157
|
+
height: z.ZodOptional<z.ZodString>;
|
|
158
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
159
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
160
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
161
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
162
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
163
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
164
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
165
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
166
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
167
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
168
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
169
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
170
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
171
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
172
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
173
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
174
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
175
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
176
|
+
color: z.ZodOptional<z.ZodString>;
|
|
177
|
+
background: z.ZodOptional<z.ZodString>;
|
|
178
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
179
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
180
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
181
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
182
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
183
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
184
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
185
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
186
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
187
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
188
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
189
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
190
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
191
|
+
border: z.ZodOptional<z.ZodString>;
|
|
192
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
193
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
194
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
195
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
196
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
197
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
198
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
199
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
200
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
201
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
202
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
}, z.core.$strip>>;
|
|
205
|
+
css: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.core.$strip>;
|
|
207
|
+
export interface BaseBlockProps {
|
|
208
|
+
id: string;
|
|
209
|
+
className?: string;
|
|
210
|
+
style?: BlockStyle;
|
|
211
|
+
css?: string;
|
|
212
|
+
}
|
|
213
|
+
export type BlockRenderProps<P> = P & BaseBlockProps & {
|
|
214
|
+
slots: Record<string, ReactNode>;
|
|
215
|
+
};
|
|
216
|
+
export interface BlockDefinition<P extends object = Record<string, unknown>> {
|
|
217
|
+
type: string;
|
|
218
|
+
label: string;
|
|
219
|
+
description: string;
|
|
220
|
+
category: BlockCategory;
|
|
221
|
+
schema: z.ZodObject;
|
|
222
|
+
slots: readonly string[];
|
|
223
|
+
defaultProps: P;
|
|
224
|
+
fields: Partial<Record<keyof P & string, FieldDefinition>>;
|
|
225
|
+
preload?: (props: P, data: PageData) => string[];
|
|
226
|
+
baseCss?: string;
|
|
227
|
+
render: (props: BlockRenderProps<P>) => ReactElement | null;
|
|
228
|
+
}
|
|
229
|
+
export declare function defineBlock<S extends z.ZodObject>(definition: {
|
|
230
|
+
type: string;
|
|
231
|
+
label: string;
|
|
232
|
+
description: string;
|
|
233
|
+
category: BlockCategory;
|
|
234
|
+
schema: S;
|
|
235
|
+
slots?: readonly string[];
|
|
236
|
+
fields: Partial<Record<keyof z.output<S> & string, FieldDefinition>>;
|
|
237
|
+
preload?: (props: z.output<S>, data: PageData) => string[];
|
|
238
|
+
baseCss?: string;
|
|
239
|
+
render: (props: BlockRenderProps<z.output<S>>) => ReactElement | null;
|
|
240
|
+
}): BlockDefinition<z.output<S>>;
|
|
241
|
+
export declare function blockRoot(props: BaseBlockProps, ...classNames: (string | false | undefined)[]): {
|
|
242
|
+
'data-block': string;
|
|
243
|
+
className?: string;
|
|
244
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const Heading: import("..").BlockDefinition<{
|
|
2
|
+
text: string;
|
|
3
|
+
level: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
4
|
+
}>;
|
|
5
|
+
export declare const Text: import("..").BlockDefinition<{
|
|
6
|
+
text: string;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const Image: import("..").BlockDefinition<{
|
|
9
|
+
src: string;
|
|
10
|
+
alt: string;
|
|
11
|
+
href: string;
|
|
12
|
+
loading: "lazy" | "eager";
|
|
13
|
+
}>;
|
|
14
|
+
export declare const Button: import("..").BlockDefinition<{
|
|
15
|
+
label: string;
|
|
16
|
+
href: string;
|
|
17
|
+
newTab: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const Spacer: import("..").BlockDefinition<Record<string, never>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Section: import("..").BlockDefinition<{
|
|
2
|
+
tag: "section" | "div" | "header" | "footer" | "aside" | "nav";
|
|
3
|
+
anchorId: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const Stack: import("..").BlockDefinition<Record<string, never>>;
|
|
6
|
+
export declare const Columns: import("..").BlockDefinition<{
|
|
7
|
+
count: 2 | 4 | 3;
|
|
8
|
+
stackOnMobile: boolean;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const ProductTitle: import("..").BlockDefinition<{
|
|
2
|
+
level: "h1" | "h2" | "h3";
|
|
3
|
+
}>;
|
|
4
|
+
export declare const ProductPrice: import("..").BlockDefinition<Record<string, never>>;
|
|
5
|
+
export declare const ProductTagline: import("..").BlockDefinition<Record<string, never>>;
|
|
6
|
+
export declare const ProductGallery: import("..").BlockDefinition<Record<string, never>>;
|
|
7
|
+
export declare const LandingImages: import("..").BlockDefinition<{
|
|
8
|
+
eagerFirstImage: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const ProductDescription: import("..").BlockDefinition<{
|
|
11
|
+
onlyWithoutLandingImages: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const ProductFaq: import("..").BlockDefinition<Record<string, never>>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export interface PageVariantDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
values: string[];
|
|
4
|
+
}
|
|
5
|
+
export interface PageFormField {
|
|
6
|
+
type: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
required: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface PageOffer {
|
|
11
|
+
trackingId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
price: number;
|
|
14
|
+
freeShipping: boolean;
|
|
15
|
+
notes: string | null;
|
|
16
|
+
products: {
|
|
17
|
+
trackingId: string;
|
|
18
|
+
quantity: number;
|
|
19
|
+
}[];
|
|
20
|
+
}
|
|
21
|
+
export interface PageState {
|
|
22
|
+
id: string;
|
|
23
|
+
code: string;
|
|
24
|
+
name: string;
|
|
25
|
+
nameAr: string;
|
|
26
|
+
}
|
|
27
|
+
export interface PageCity extends PageState {
|
|
28
|
+
stateId: string;
|
|
29
|
+
}
|
|
30
|
+
export interface FunnelPageData {
|
|
31
|
+
funnel: {
|
|
32
|
+
language: string;
|
|
33
|
+
form: {
|
|
34
|
+
position: string;
|
|
35
|
+
fields: PageFormField[];
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
landingPage: {
|
|
39
|
+
images: string[];
|
|
40
|
+
leadImages: string[];
|
|
41
|
+
};
|
|
42
|
+
product: {
|
|
43
|
+
name: string;
|
|
44
|
+
tagline: string | null;
|
|
45
|
+
description: string | null;
|
|
46
|
+
images: string[];
|
|
47
|
+
isBundle: boolean;
|
|
48
|
+
variantDefinitions: PageVariantDefinition[];
|
|
49
|
+
bundleProducts: {
|
|
50
|
+
trackingId: string;
|
|
51
|
+
name: string;
|
|
52
|
+
variantDefinitions: PageVariantDefinition[];
|
|
53
|
+
}[];
|
|
54
|
+
faq: {
|
|
55
|
+
question: string;
|
|
56
|
+
answer: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
offers: PageOffer[];
|
|
60
|
+
deliveryPrices: {
|
|
61
|
+
stopdeskEnabled: boolean;
|
|
62
|
+
} | null;
|
|
63
|
+
geo: {
|
|
64
|
+
states: PageState[];
|
|
65
|
+
cities: PageCity[];
|
|
66
|
+
};
|
|
67
|
+
api: {
|
|
68
|
+
recaptchaSiteKey: string;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export type PageData = FunnelPageData;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface BlockNode {
|
|
2
|
+
type: string;
|
|
3
|
+
props: {
|
|
4
|
+
id: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
export interface PageFont {
|
|
9
|
+
family: string;
|
|
10
|
+
weights?: number[];
|
|
11
|
+
}
|
|
12
|
+
export interface PageRootProps {
|
|
13
|
+
css?: string;
|
|
14
|
+
fonts?: PageFont[];
|
|
15
|
+
}
|
|
16
|
+
export interface PageDocument {
|
|
17
|
+
root: {
|
|
18
|
+
props: PageRootProps;
|
|
19
|
+
};
|
|
20
|
+
content: BlockNode[];
|
|
21
|
+
}
|
|
22
|
+
export interface PageIssue {
|
|
23
|
+
path: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class PageDocumentError extends Error {
|
|
27
|
+
readonly issues: PageIssue[];
|
|
28
|
+
constructor(issues: PageIssue[]);
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type { BlockNode, PageDocument, PageFont, PageIssue, PageRootProps } from './document';
|
|
2
|
+
export { PageDocumentError } from './document';
|
|
3
|
+
export type { FunnelPageData, PageCity, PageData, PageFormField, PageOffer, PageState, PageVariantDefinition, } from './data';
|
|
4
|
+
export type { BaseBlockProps, BlockCategory, BlockDefinition, BlockRenderProps, FieldDefinition, } from './block';
|
|
5
|
+
export type { BlockStyle, StyleDeclarations, StyleProperty } from './style';
|
|
6
|
+
export { Breakpoints, StyleProperties } from './style';
|
|
7
|
+
export { blocks } from './blocks';
|
|
8
|
+
export { PageDataProvider, usePageData } from './context';
|
|
9
|
+
export { BlockList, PageContent, blockSelector, pageCss, pageFontStylesheets, pagePreloadImages, } from './page';
|
|
10
|
+
export { countBlocks, parsePageDocument, walkBlocks } from './validate';
|
|
11
|
+
export { pageJsonSchema } from './json-schema';
|
|
12
|
+
export type { BlockJsonSchema, PageJsonSchema } from './json-schema';
|
|
13
|
+
export { FunnelTemplateIds, funnelTemplate } from './templates/funnels';
|
|
14
|
+
export type { FunnelTemplateId, FunnelTemplateOptions } from './templates/funnels';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BlockCategory } from './block';
|
|
2
|
+
export interface BlockJsonSchema {
|
|
3
|
+
type: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
category: BlockCategory;
|
|
7
|
+
slots: readonly string[];
|
|
8
|
+
props: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface PageJsonSchema {
|
|
11
|
+
format: string;
|
|
12
|
+
root: Record<string, unknown>;
|
|
13
|
+
blocks: BlockJsonSchema[];
|
|
14
|
+
}
|
|
15
|
+
export declare function pageJsonSchema(): PageJsonSchema;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { PageData } from './data';
|
|
3
|
+
import { BlockNode, PageDocument } from './document';
|
|
4
|
+
export declare function BlockList({ nodes }: {
|
|
5
|
+
nodes: BlockNode[];
|
|
6
|
+
}): ReactElement;
|
|
7
|
+
export declare function PageContent({ document, data, }: {
|
|
8
|
+
document: PageDocument;
|
|
9
|
+
data: PageData;
|
|
10
|
+
}): ReactElement;
|
|
11
|
+
export declare function blockSelector(id: string): string;
|
|
12
|
+
export declare function pageCss(document: PageDocument): string;
|
|
13
|
+
export declare function pagePreloadImages(document: PageDocument, data: PageData): string[];
|
|
14
|
+
export declare function pageFontStylesheets(document: PageDocument): string[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageData } from './data';
|
|
2
|
+
export interface RenderedPage {
|
|
3
|
+
html: string;
|
|
4
|
+
css: string;
|
|
5
|
+
fontStylesheets: string[];
|
|
6
|
+
preloadImages: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function processCss(css: string): string;
|
|
9
|
+
export declare function renderPage(input: unknown, data: PageData): RenderedPage;
|
|
10
|
+
export * from './index';
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const StyleProperties: readonly ["display", "position", "top", "right", "bottom", "left", "zIndex", "width", "minWidth", "maxWidth", "height", "minHeight", "maxHeight", "margin", "marginTop", "marginRight", "marginBottom", "marginLeft", "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "flexDirection", "flexWrap", "alignItems", "justifyContent", "gap", "gridTemplateColumns", "color", "background", "backgroundColor", "backgroundImage", "backgroundSize", "backgroundPosition", "fontFamily", "fontSize", "fontWeight", "fontStyle", "lineHeight", "letterSpacing", "textAlign", "textTransform", "textDecoration", "border", "borderTop", "borderBottom", "borderColor", "borderRadius", "boxShadow", "opacity", "overflow", "objectFit", "aspectRatio", "transition", "transform"];
|
|
3
|
+
export type StyleProperty = (typeof StyleProperties)[number];
|
|
4
|
+
export type StyleDeclarations = Partial<Record<StyleProperty, string>>;
|
|
5
|
+
export interface BlockStyle extends StyleDeclarations {
|
|
6
|
+
tablet?: StyleDeclarations;
|
|
7
|
+
mobile?: StyleDeclarations;
|
|
8
|
+
}
|
|
9
|
+
export declare const Breakpoints: {
|
|
10
|
+
readonly tablet: "(max-width: 1023px)";
|
|
11
|
+
readonly mobile: "(max-width: 767px)";
|
|
12
|
+
};
|
|
13
|
+
export declare const BlockStyleSchema: z.ZodObject<{
|
|
14
|
+
display: z.ZodOptional<z.ZodString>;
|
|
15
|
+
position: z.ZodOptional<z.ZodString>;
|
|
16
|
+
top: z.ZodOptional<z.ZodString>;
|
|
17
|
+
right: z.ZodOptional<z.ZodString>;
|
|
18
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
19
|
+
left: z.ZodOptional<z.ZodString>;
|
|
20
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
21
|
+
width: z.ZodOptional<z.ZodString>;
|
|
22
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
23
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
24
|
+
height: z.ZodOptional<z.ZodString>;
|
|
25
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
26
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
27
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
28
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
29
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
30
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
31
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
32
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
33
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
34
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
35
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
36
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
37
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
38
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
39
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
40
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
41
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
42
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
43
|
+
color: z.ZodOptional<z.ZodString>;
|
|
44
|
+
background: z.ZodOptional<z.ZodString>;
|
|
45
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
46
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
47
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
48
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
49
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
50
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
51
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
52
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
53
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
54
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
55
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
56
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
57
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
58
|
+
border: z.ZodOptional<z.ZodString>;
|
|
59
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
60
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
61
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
62
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
63
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
64
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
65
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
66
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
67
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
68
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
69
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
70
|
+
tablet: z.ZodOptional<z.ZodObject<{
|
|
71
|
+
display: z.ZodOptional<z.ZodString>;
|
|
72
|
+
position: z.ZodOptional<z.ZodString>;
|
|
73
|
+
top: z.ZodOptional<z.ZodString>;
|
|
74
|
+
right: z.ZodOptional<z.ZodString>;
|
|
75
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
76
|
+
left: z.ZodOptional<z.ZodString>;
|
|
77
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
78
|
+
width: z.ZodOptional<z.ZodString>;
|
|
79
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
80
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
81
|
+
height: z.ZodOptional<z.ZodString>;
|
|
82
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
83
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
84
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
85
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
86
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
87
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
88
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
89
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
90
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
91
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
92
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
93
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
94
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
95
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
96
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
97
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
98
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
99
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
100
|
+
color: z.ZodOptional<z.ZodString>;
|
|
101
|
+
background: z.ZodOptional<z.ZodString>;
|
|
102
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
103
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
104
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
105
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
106
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
107
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
108
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
109
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
110
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
111
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
112
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
113
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
114
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
115
|
+
border: z.ZodOptional<z.ZodString>;
|
|
116
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
117
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
118
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
119
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
120
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
121
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
122
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
123
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
124
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
125
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
126
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strip>>;
|
|
128
|
+
mobile: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
display: z.ZodOptional<z.ZodString>;
|
|
130
|
+
position: z.ZodOptional<z.ZodString>;
|
|
131
|
+
top: z.ZodOptional<z.ZodString>;
|
|
132
|
+
right: z.ZodOptional<z.ZodString>;
|
|
133
|
+
bottom: z.ZodOptional<z.ZodString>;
|
|
134
|
+
left: z.ZodOptional<z.ZodString>;
|
|
135
|
+
zIndex: z.ZodOptional<z.ZodString>;
|
|
136
|
+
width: z.ZodOptional<z.ZodString>;
|
|
137
|
+
minWidth: z.ZodOptional<z.ZodString>;
|
|
138
|
+
maxWidth: z.ZodOptional<z.ZodString>;
|
|
139
|
+
height: z.ZodOptional<z.ZodString>;
|
|
140
|
+
minHeight: z.ZodOptional<z.ZodString>;
|
|
141
|
+
maxHeight: z.ZodOptional<z.ZodString>;
|
|
142
|
+
margin: z.ZodOptional<z.ZodString>;
|
|
143
|
+
marginTop: z.ZodOptional<z.ZodString>;
|
|
144
|
+
marginRight: z.ZodOptional<z.ZodString>;
|
|
145
|
+
marginBottom: z.ZodOptional<z.ZodString>;
|
|
146
|
+
marginLeft: z.ZodOptional<z.ZodString>;
|
|
147
|
+
padding: z.ZodOptional<z.ZodString>;
|
|
148
|
+
paddingTop: z.ZodOptional<z.ZodString>;
|
|
149
|
+
paddingRight: z.ZodOptional<z.ZodString>;
|
|
150
|
+
paddingBottom: z.ZodOptional<z.ZodString>;
|
|
151
|
+
paddingLeft: z.ZodOptional<z.ZodString>;
|
|
152
|
+
flexDirection: z.ZodOptional<z.ZodString>;
|
|
153
|
+
flexWrap: z.ZodOptional<z.ZodString>;
|
|
154
|
+
alignItems: z.ZodOptional<z.ZodString>;
|
|
155
|
+
justifyContent: z.ZodOptional<z.ZodString>;
|
|
156
|
+
gap: z.ZodOptional<z.ZodString>;
|
|
157
|
+
gridTemplateColumns: z.ZodOptional<z.ZodString>;
|
|
158
|
+
color: z.ZodOptional<z.ZodString>;
|
|
159
|
+
background: z.ZodOptional<z.ZodString>;
|
|
160
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
161
|
+
backgroundImage: z.ZodOptional<z.ZodString>;
|
|
162
|
+
backgroundSize: z.ZodOptional<z.ZodString>;
|
|
163
|
+
backgroundPosition: z.ZodOptional<z.ZodString>;
|
|
164
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
165
|
+
fontSize: z.ZodOptional<z.ZodString>;
|
|
166
|
+
fontWeight: z.ZodOptional<z.ZodString>;
|
|
167
|
+
fontStyle: z.ZodOptional<z.ZodString>;
|
|
168
|
+
lineHeight: z.ZodOptional<z.ZodString>;
|
|
169
|
+
letterSpacing: z.ZodOptional<z.ZodString>;
|
|
170
|
+
textAlign: z.ZodOptional<z.ZodString>;
|
|
171
|
+
textTransform: z.ZodOptional<z.ZodString>;
|
|
172
|
+
textDecoration: z.ZodOptional<z.ZodString>;
|
|
173
|
+
border: z.ZodOptional<z.ZodString>;
|
|
174
|
+
borderTop: z.ZodOptional<z.ZodString>;
|
|
175
|
+
borderBottom: z.ZodOptional<z.ZodString>;
|
|
176
|
+
borderColor: z.ZodOptional<z.ZodString>;
|
|
177
|
+
borderRadius: z.ZodOptional<z.ZodString>;
|
|
178
|
+
boxShadow: z.ZodOptional<z.ZodString>;
|
|
179
|
+
opacity: z.ZodOptional<z.ZodString>;
|
|
180
|
+
overflow: z.ZodOptional<z.ZodString>;
|
|
181
|
+
objectFit: z.ZodOptional<z.ZodString>;
|
|
182
|
+
aspectRatio: z.ZodOptional<z.ZodString>;
|
|
183
|
+
transition: z.ZodOptional<z.ZodString>;
|
|
184
|
+
transform: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
}, z.core.$strip>;
|
|
187
|
+
export declare const CssSchema: z.ZodString;
|
|
188
|
+
export declare function styleToCss(selector: string, style: BlockStyle | undefined): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PageDocument } from '../document';
|
|
2
|
+
export declare const FunnelTemplateIds: readonly ["classic-product", "classic-landing"];
|
|
3
|
+
export type FunnelTemplateId = (typeof FunnelTemplateIds)[number];
|
|
4
|
+
export interface FunnelTemplateOptions {
|
|
5
|
+
formPosition: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function funnelTemplate(templateId: string, options: FunnelTemplateOptions): PageDocument;
|