@lucrex/storefront-blocks 0.0.0-stage → 0.2.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 +58 -2
- package/dist/index.cjs +2561 -0
- package/dist/index.mjs +2538 -0
- package/dist/server.cjs +2608 -0
- package/dist/server.mjs +2587 -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/blocks/store.d.ts +75 -0
- package/dist/types/context.d.ts +11 -0
- package/dist/types/data.d.ts +141 -0
- package/dist/types/document.d.ts +29 -0
- package/dist/types/index.d.ts +17 -0
- package/dist/types/json-schema.d.ts +15 -0
- package/dist/types/money.d.ts +2 -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/templates/online-stores.d.ts +10 -0
- package/dist/types/validate.d.ts +18 -0
- package/package.json +57 -5
|
@@ -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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PageDocument } from '../document';
|
|
2
|
+
export declare const OnlineStoreTemplateIds: readonly ["maison", "atelier", "noor", "block", "glow", "oud", "circuit", "hearth", "pebble", "souq"];
|
|
3
|
+
export type OnlineStoreTemplateId = (typeof OnlineStoreTemplateIds)[number];
|
|
4
|
+
export declare const OnlineStorePageTypes: readonly ["header", "footer", "home", "all-products", "category", "product", "thank-you", "contact", "about", "privacy-policy", "refund-policy", "terms-of-service", "not-found"];
|
|
5
|
+
export type OnlineStorePageType = (typeof OnlineStorePageTypes)[number];
|
|
6
|
+
export declare function onlineStoreTemplate(templateId: string, pageType: string): PageDocument;
|
|
7
|
+
export declare function onlineStorePages(templateId: string): {
|
|
8
|
+
pageType: OnlineStorePageType;
|
|
9
|
+
document: PageDocument;
|
|
10
|
+
}[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BlockDefinition } from './block';
|
|
3
|
+
import { BlockNode, PageDocument } from './document';
|
|
4
|
+
export declare const FontSchema: z.ZodObject<{
|
|
5
|
+
family: z.ZodString;
|
|
6
|
+
weights: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const PageRootPropsSchema: z.ZodObject<{
|
|
9
|
+
css: z.ZodOptional<z.ZodString>;
|
|
10
|
+
fonts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
11
|
+
family: z.ZodString;
|
|
12
|
+
weights: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
|
|
13
|
+
}, z.core.$strip>>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare function blockPropsSchema(definition: BlockDefinition<any>): z.ZodObject;
|
|
16
|
+
export declare function parsePageDocument(input: unknown): PageDocument;
|
|
17
|
+
export declare function walkBlocks(nodes: BlockNode[], visit: (node: BlockNode) => void): void;
|
|
18
|
+
export declare function countBlocks(document: PageDocument, type: string): number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "@lucrex/storefront-blocks",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Lucrex storefront page blocks: the JSON page format, the React blocks, the built-in templates and the server renderer shared by the page builder and the backend",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/types/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/types/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
},
|
|
16
|
+
"./server": {
|
|
17
|
+
"types": "./dist/types/server.d.ts",
|
|
18
|
+
"import": "./dist/server.mjs",
|
|
19
|
+
"require": "./dist/server.cjs"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"typesVersions": {
|
|
23
|
+
"*": {
|
|
24
|
+
"server": [
|
|
25
|
+
"./dist/types/server.d.ts"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "node build.mjs && tsc --emitDeclarationOnly --outDir dist/types",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"test": "node --test --import tsx tests/*.spec.tsx"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"lightningcss": "^1.30.0",
|
|
42
|
+
"zod": "^4.1.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"react": ">=18.3.0",
|
|
46
|
+
"react-dom": ">=18.3.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.0.0",
|
|
50
|
+
"@types/react": "^19.0.0",
|
|
51
|
+
"@types/react-dom": "^19.0.0",
|
|
52
|
+
"esbuild": "^0.25.0",
|
|
53
|
+
"react": "^19.0.0",
|
|
54
|
+
"react-dom": "^19.0.0",
|
|
55
|
+
"tsx": "^4.19.0",
|
|
56
|
+
"typescript": "^5.7.0"
|
|
57
|
+
}
|
|
58
|
+
}
|