@json-render/image 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/LICENSE +201 -0
- package/README.md +167 -0
- package/dist/catalog.d.mts +265 -0
- package/dist/catalog.d.ts +265 -0
- package/dist/catalog.js +207 -0
- package/dist/catalog.js.map +1 -0
- package/dist/catalog.mjs +7 -0
- package/dist/catalog.mjs.map +1 -0
- package/dist/chunk-A67OT34V.mjs +41 -0
- package/dist/chunk-A67OT34V.mjs.map +1 -0
- package/dist/chunk-KQSKKHJA.mjs +348 -0
- package/dist/chunk-KQSKKHJA.mjs.map +1 -0
- package/dist/chunk-PMEELRVP.mjs +183 -0
- package/dist/chunk-PMEELRVP.mjs.map +1 -0
- package/dist/index.d.mts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +600 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +19 -0
- package/dist/index.mjs.map +1 -0
- package/dist/render-DyXCSaYW.d.mts +40 -0
- package/dist/render-DyXCSaYW.d.ts +40 -0
- package/dist/render.d.mts +4 -0
- package/dist/render.d.ts +4 -0
- package/dist/render.js +380 -0
- package/dist/render.js.map +1 -0
- package/dist/render.mjs +11 -0
- package/dist/render.mjs.map +1 -0
- package/dist/server.d.mts +53 -0
- package/dist/server.d.ts +53 -0
- package/dist/server.js +248 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +11 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Standard component definitions for image catalogs.
|
|
5
|
+
*
|
|
6
|
+
* These define the available image components with their Zod prop schemas.
|
|
7
|
+
* All components render to Satori-compatible JSX (HTML-like elements with
|
|
8
|
+
* inline CSS flexbox styles).
|
|
9
|
+
*/
|
|
10
|
+
declare const standardComponentDefinitions: {
|
|
11
|
+
Frame: {
|
|
12
|
+
props: z.ZodObject<{
|
|
13
|
+
width: z.ZodNumber;
|
|
14
|
+
height: z.ZodNumber;
|
|
15
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
16
|
+
padding: z.ZodNullable<z.ZodNumber>;
|
|
17
|
+
display: z.ZodNullable<z.ZodEnum<{
|
|
18
|
+
flex: "flex";
|
|
19
|
+
none: "none";
|
|
20
|
+
}>>;
|
|
21
|
+
flexDirection: z.ZodNullable<z.ZodEnum<{
|
|
22
|
+
row: "row";
|
|
23
|
+
column: "column";
|
|
24
|
+
}>>;
|
|
25
|
+
alignItems: z.ZodNullable<z.ZodEnum<{
|
|
26
|
+
"flex-start": "flex-start";
|
|
27
|
+
center: "center";
|
|
28
|
+
"flex-end": "flex-end";
|
|
29
|
+
stretch: "stretch";
|
|
30
|
+
}>>;
|
|
31
|
+
justifyContent: z.ZodNullable<z.ZodEnum<{
|
|
32
|
+
"flex-start": "flex-start";
|
|
33
|
+
center: "center";
|
|
34
|
+
"flex-end": "flex-end";
|
|
35
|
+
"space-between": "space-between";
|
|
36
|
+
"space-around": "space-around";
|
|
37
|
+
}>>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
slots: string[];
|
|
40
|
+
description: string;
|
|
41
|
+
example: {
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
backgroundColor: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
Box: {
|
|
48
|
+
props: z.ZodObject<{
|
|
49
|
+
padding: z.ZodNullable<z.ZodNumber>;
|
|
50
|
+
paddingTop: z.ZodNullable<z.ZodNumber>;
|
|
51
|
+
paddingBottom: z.ZodNullable<z.ZodNumber>;
|
|
52
|
+
paddingLeft: z.ZodNullable<z.ZodNumber>;
|
|
53
|
+
paddingRight: z.ZodNullable<z.ZodNumber>;
|
|
54
|
+
margin: z.ZodNullable<z.ZodNumber>;
|
|
55
|
+
backgroundColor: z.ZodNullable<z.ZodString>;
|
|
56
|
+
borderWidth: z.ZodNullable<z.ZodNumber>;
|
|
57
|
+
borderColor: z.ZodNullable<z.ZodString>;
|
|
58
|
+
borderRadius: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
flex: z.ZodNullable<z.ZodNumber>;
|
|
60
|
+
width: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
61
|
+
height: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
62
|
+
alignItems: z.ZodNullable<z.ZodEnum<{
|
|
63
|
+
"flex-start": "flex-start";
|
|
64
|
+
center: "center";
|
|
65
|
+
"flex-end": "flex-end";
|
|
66
|
+
stretch: "stretch";
|
|
67
|
+
}>>;
|
|
68
|
+
justifyContent: z.ZodNullable<z.ZodEnum<{
|
|
69
|
+
"flex-start": "flex-start";
|
|
70
|
+
center: "center";
|
|
71
|
+
"flex-end": "flex-end";
|
|
72
|
+
"space-between": "space-between";
|
|
73
|
+
"space-around": "space-around";
|
|
74
|
+
}>>;
|
|
75
|
+
flexDirection: z.ZodNullable<z.ZodEnum<{
|
|
76
|
+
row: "row";
|
|
77
|
+
column: "column";
|
|
78
|
+
}>>;
|
|
79
|
+
position: z.ZodNullable<z.ZodEnum<{
|
|
80
|
+
relative: "relative";
|
|
81
|
+
absolute: "absolute";
|
|
82
|
+
}>>;
|
|
83
|
+
top: z.ZodNullable<z.ZodNumber>;
|
|
84
|
+
left: z.ZodNullable<z.ZodNumber>;
|
|
85
|
+
right: z.ZodNullable<z.ZodNumber>;
|
|
86
|
+
bottom: z.ZodNullable<z.ZodNumber>;
|
|
87
|
+
overflow: z.ZodNullable<z.ZodEnum<{
|
|
88
|
+
visible: "visible";
|
|
89
|
+
hidden: "hidden";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$strip>;
|
|
92
|
+
slots: string[];
|
|
93
|
+
description: string;
|
|
94
|
+
example: {
|
|
95
|
+
padding: number;
|
|
96
|
+
backgroundColor: string;
|
|
97
|
+
borderRadius: number;
|
|
98
|
+
alignItems: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
Row: {
|
|
102
|
+
props: z.ZodObject<{
|
|
103
|
+
gap: z.ZodNullable<z.ZodNumber>;
|
|
104
|
+
alignItems: z.ZodNullable<z.ZodEnum<{
|
|
105
|
+
"flex-start": "flex-start";
|
|
106
|
+
center: "center";
|
|
107
|
+
"flex-end": "flex-end";
|
|
108
|
+
stretch: "stretch";
|
|
109
|
+
}>>;
|
|
110
|
+
justifyContent: z.ZodNullable<z.ZodEnum<{
|
|
111
|
+
"flex-start": "flex-start";
|
|
112
|
+
center: "center";
|
|
113
|
+
"flex-end": "flex-end";
|
|
114
|
+
"space-between": "space-between";
|
|
115
|
+
"space-around": "space-around";
|
|
116
|
+
}>>;
|
|
117
|
+
padding: z.ZodNullable<z.ZodNumber>;
|
|
118
|
+
flex: z.ZodNullable<z.ZodNumber>;
|
|
119
|
+
wrap: z.ZodNullable<z.ZodBoolean>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
slots: string[];
|
|
122
|
+
description: string;
|
|
123
|
+
example: {
|
|
124
|
+
gap: number;
|
|
125
|
+
alignItems: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
Column: {
|
|
129
|
+
props: z.ZodObject<{
|
|
130
|
+
gap: z.ZodNullable<z.ZodNumber>;
|
|
131
|
+
alignItems: z.ZodNullable<z.ZodEnum<{
|
|
132
|
+
"flex-start": "flex-start";
|
|
133
|
+
center: "center";
|
|
134
|
+
"flex-end": "flex-end";
|
|
135
|
+
stretch: "stretch";
|
|
136
|
+
}>>;
|
|
137
|
+
justifyContent: z.ZodNullable<z.ZodEnum<{
|
|
138
|
+
"flex-start": "flex-start";
|
|
139
|
+
center: "center";
|
|
140
|
+
"flex-end": "flex-end";
|
|
141
|
+
"space-between": "space-between";
|
|
142
|
+
"space-around": "space-around";
|
|
143
|
+
}>>;
|
|
144
|
+
padding: z.ZodNullable<z.ZodNumber>;
|
|
145
|
+
flex: z.ZodNullable<z.ZodNumber>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
slots: string[];
|
|
148
|
+
description: string;
|
|
149
|
+
example: {
|
|
150
|
+
gap: number;
|
|
151
|
+
padding: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
Heading: {
|
|
155
|
+
props: z.ZodObject<{
|
|
156
|
+
text: z.ZodString;
|
|
157
|
+
level: z.ZodNullable<z.ZodEnum<{
|
|
158
|
+
h1: "h1";
|
|
159
|
+
h2: "h2";
|
|
160
|
+
h3: "h3";
|
|
161
|
+
h4: "h4";
|
|
162
|
+
}>>;
|
|
163
|
+
color: z.ZodNullable<z.ZodString>;
|
|
164
|
+
align: z.ZodNullable<z.ZodEnum<{
|
|
165
|
+
center: "center";
|
|
166
|
+
left: "left";
|
|
167
|
+
right: "right";
|
|
168
|
+
}>>;
|
|
169
|
+
letterSpacing: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
170
|
+
lineHeight: z.ZodNullable<z.ZodNumber>;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
slots: never[];
|
|
173
|
+
description: string;
|
|
174
|
+
example: {
|
|
175
|
+
text: string;
|
|
176
|
+
level: string;
|
|
177
|
+
color: string;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
Text: {
|
|
181
|
+
props: z.ZodObject<{
|
|
182
|
+
text: z.ZodString;
|
|
183
|
+
fontSize: z.ZodNullable<z.ZodNumber>;
|
|
184
|
+
color: z.ZodNullable<z.ZodString>;
|
|
185
|
+
align: z.ZodNullable<z.ZodEnum<{
|
|
186
|
+
center: "center";
|
|
187
|
+
left: "left";
|
|
188
|
+
right: "right";
|
|
189
|
+
}>>;
|
|
190
|
+
fontWeight: z.ZodNullable<z.ZodEnum<{
|
|
191
|
+
normal: "normal";
|
|
192
|
+
bold: "bold";
|
|
193
|
+
}>>;
|
|
194
|
+
fontStyle: z.ZodNullable<z.ZodEnum<{
|
|
195
|
+
normal: "normal";
|
|
196
|
+
italic: "italic";
|
|
197
|
+
}>>;
|
|
198
|
+
lineHeight: z.ZodNullable<z.ZodNumber>;
|
|
199
|
+
letterSpacing: z.ZodNullable<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
200
|
+
textDecoration: z.ZodNullable<z.ZodEnum<{
|
|
201
|
+
none: "none";
|
|
202
|
+
underline: "underline";
|
|
203
|
+
"line-through": "line-through";
|
|
204
|
+
}>>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
slots: never[];
|
|
207
|
+
description: string;
|
|
208
|
+
example: {
|
|
209
|
+
text: string;
|
|
210
|
+
fontSize: number;
|
|
211
|
+
color: string;
|
|
212
|
+
};
|
|
213
|
+
};
|
|
214
|
+
Image: {
|
|
215
|
+
props: z.ZodObject<{
|
|
216
|
+
src: z.ZodString;
|
|
217
|
+
width: z.ZodNullable<z.ZodNumber>;
|
|
218
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
219
|
+
borderRadius: z.ZodNullable<z.ZodNumber>;
|
|
220
|
+
objectFit: z.ZodNullable<z.ZodEnum<{
|
|
221
|
+
none: "none";
|
|
222
|
+
contain: "contain";
|
|
223
|
+
cover: "cover";
|
|
224
|
+
fill: "fill";
|
|
225
|
+
}>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
slots: never[];
|
|
228
|
+
description: string;
|
|
229
|
+
example: {
|
|
230
|
+
src: string;
|
|
231
|
+
width: number;
|
|
232
|
+
height: number;
|
|
233
|
+
};
|
|
234
|
+
};
|
|
235
|
+
Divider: {
|
|
236
|
+
props: z.ZodObject<{
|
|
237
|
+
color: z.ZodNullable<z.ZodString>;
|
|
238
|
+
thickness: z.ZodNullable<z.ZodNumber>;
|
|
239
|
+
marginTop: z.ZodNullable<z.ZodNumber>;
|
|
240
|
+
marginBottom: z.ZodNullable<z.ZodNumber>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
|
+
slots: never[];
|
|
243
|
+
description: string;
|
|
244
|
+
example: {
|
|
245
|
+
color: string;
|
|
246
|
+
thickness: number;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
Spacer: {
|
|
250
|
+
props: z.ZodObject<{
|
|
251
|
+
height: z.ZodNullable<z.ZodNumber>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
slots: never[];
|
|
254
|
+
description: string;
|
|
255
|
+
example: {
|
|
256
|
+
height: number;
|
|
257
|
+
};
|
|
258
|
+
};
|
|
259
|
+
};
|
|
260
|
+
type StandardComponentDefinitions = typeof standardComponentDefinitions;
|
|
261
|
+
type StandardComponentProps<K extends keyof StandardComponentDefinitions> = StandardComponentDefinitions[K]["props"] extends {
|
|
262
|
+
_output: infer O;
|
|
263
|
+
} ? O : z.output<StandardComponentDefinitions[K]["props"]>;
|
|
264
|
+
|
|
265
|
+
export { type StandardComponentDefinitions, type StandardComponentProps, standardComponentDefinitions };
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/catalog.ts
|
|
21
|
+
var catalog_exports = {};
|
|
22
|
+
__export(catalog_exports, {
|
|
23
|
+
standardComponentDefinitions: () => standardComponentDefinitions
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(catalog_exports);
|
|
26
|
+
var import_zod = require("zod");
|
|
27
|
+
var standardComponentDefinitions = {
|
|
28
|
+
// ==========================================================================
|
|
29
|
+
// Root
|
|
30
|
+
// ==========================================================================
|
|
31
|
+
Frame: {
|
|
32
|
+
props: import_zod.z.object({
|
|
33
|
+
width: import_zod.z.number(),
|
|
34
|
+
height: import_zod.z.number(),
|
|
35
|
+
backgroundColor: import_zod.z.string().nullable(),
|
|
36
|
+
padding: import_zod.z.number().nullable(),
|
|
37
|
+
display: import_zod.z.enum(["flex", "none"]).nullable(),
|
|
38
|
+
flexDirection: import_zod.z.enum(["row", "column"]).nullable(),
|
|
39
|
+
alignItems: import_zod.z.enum(["flex-start", "center", "flex-end", "stretch"]).nullable(),
|
|
40
|
+
justifyContent: import_zod.z.enum([
|
|
41
|
+
"flex-start",
|
|
42
|
+
"center",
|
|
43
|
+
"flex-end",
|
|
44
|
+
"space-between",
|
|
45
|
+
"space-around"
|
|
46
|
+
]).nullable()
|
|
47
|
+
}),
|
|
48
|
+
slots: ["default"],
|
|
49
|
+
description: "Root image container. Defines the output image dimensions and background. Must be the root element.",
|
|
50
|
+
example: { width: 1200, height: 630, backgroundColor: "#ffffff" }
|
|
51
|
+
},
|
|
52
|
+
// ==========================================================================
|
|
53
|
+
// Layout Components
|
|
54
|
+
// ==========================================================================
|
|
55
|
+
Box: {
|
|
56
|
+
props: import_zod.z.object({
|
|
57
|
+
padding: import_zod.z.number().nullable(),
|
|
58
|
+
paddingTop: import_zod.z.number().nullable(),
|
|
59
|
+
paddingBottom: import_zod.z.number().nullable(),
|
|
60
|
+
paddingLeft: import_zod.z.number().nullable(),
|
|
61
|
+
paddingRight: import_zod.z.number().nullable(),
|
|
62
|
+
margin: import_zod.z.number().nullable(),
|
|
63
|
+
backgroundColor: import_zod.z.string().nullable(),
|
|
64
|
+
borderWidth: import_zod.z.number().nullable(),
|
|
65
|
+
borderColor: import_zod.z.string().nullable(),
|
|
66
|
+
borderRadius: import_zod.z.number().nullable(),
|
|
67
|
+
flex: import_zod.z.number().nullable(),
|
|
68
|
+
width: import_zod.z.union([import_zod.z.number(), import_zod.z.string()]).nullable(),
|
|
69
|
+
height: import_zod.z.union([import_zod.z.number(), import_zod.z.string()]).nullable(),
|
|
70
|
+
alignItems: import_zod.z.enum(["flex-start", "center", "flex-end", "stretch"]).nullable(),
|
|
71
|
+
justifyContent: import_zod.z.enum([
|
|
72
|
+
"flex-start",
|
|
73
|
+
"center",
|
|
74
|
+
"flex-end",
|
|
75
|
+
"space-between",
|
|
76
|
+
"space-around"
|
|
77
|
+
]).nullable(),
|
|
78
|
+
flexDirection: import_zod.z.enum(["row", "column"]).nullable(),
|
|
79
|
+
position: import_zod.z.enum(["relative", "absolute"]).nullable(),
|
|
80
|
+
top: import_zod.z.number().nullable(),
|
|
81
|
+
left: import_zod.z.number().nullable(),
|
|
82
|
+
right: import_zod.z.number().nullable(),
|
|
83
|
+
bottom: import_zod.z.number().nullable(),
|
|
84
|
+
overflow: import_zod.z.enum(["visible", "hidden"]).nullable()
|
|
85
|
+
}),
|
|
86
|
+
slots: ["default"],
|
|
87
|
+
description: "Generic container with padding, margin, background, border, and flex alignment. Supports absolute positioning.",
|
|
88
|
+
example: {
|
|
89
|
+
padding: 20,
|
|
90
|
+
backgroundColor: "#f9f9f9",
|
|
91
|
+
borderRadius: 8,
|
|
92
|
+
alignItems: "center"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
Row: {
|
|
96
|
+
props: import_zod.z.object({
|
|
97
|
+
gap: import_zod.z.number().nullable(),
|
|
98
|
+
alignItems: import_zod.z.enum(["flex-start", "center", "flex-end", "stretch"]).nullable(),
|
|
99
|
+
justifyContent: import_zod.z.enum([
|
|
100
|
+
"flex-start",
|
|
101
|
+
"center",
|
|
102
|
+
"flex-end",
|
|
103
|
+
"space-between",
|
|
104
|
+
"space-around"
|
|
105
|
+
]).nullable(),
|
|
106
|
+
padding: import_zod.z.number().nullable(),
|
|
107
|
+
flex: import_zod.z.number().nullable(),
|
|
108
|
+
wrap: import_zod.z.boolean().nullable()
|
|
109
|
+
}),
|
|
110
|
+
slots: ["default"],
|
|
111
|
+
description: "Horizontal flex layout. Use for placing elements side by side.",
|
|
112
|
+
example: { gap: 10, alignItems: "center" }
|
|
113
|
+
},
|
|
114
|
+
Column: {
|
|
115
|
+
props: import_zod.z.object({
|
|
116
|
+
gap: import_zod.z.number().nullable(),
|
|
117
|
+
alignItems: import_zod.z.enum(["flex-start", "center", "flex-end", "stretch"]).nullable(),
|
|
118
|
+
justifyContent: import_zod.z.enum([
|
|
119
|
+
"flex-start",
|
|
120
|
+
"center",
|
|
121
|
+
"flex-end",
|
|
122
|
+
"space-between",
|
|
123
|
+
"space-around"
|
|
124
|
+
]).nullable(),
|
|
125
|
+
padding: import_zod.z.number().nullable(),
|
|
126
|
+
flex: import_zod.z.number().nullable()
|
|
127
|
+
}),
|
|
128
|
+
slots: ["default"],
|
|
129
|
+
description: "Vertical flex layout. Use for stacking elements top to bottom.",
|
|
130
|
+
example: { gap: 8, padding: 10 }
|
|
131
|
+
},
|
|
132
|
+
// ==========================================================================
|
|
133
|
+
// Content Components
|
|
134
|
+
// ==========================================================================
|
|
135
|
+
Heading: {
|
|
136
|
+
props: import_zod.z.object({
|
|
137
|
+
text: import_zod.z.string(),
|
|
138
|
+
level: import_zod.z.enum(["h1", "h2", "h3", "h4"]).nullable(),
|
|
139
|
+
color: import_zod.z.string().nullable(),
|
|
140
|
+
align: import_zod.z.enum(["left", "center", "right"]).nullable(),
|
|
141
|
+
letterSpacing: import_zod.z.union([import_zod.z.number(), import_zod.z.string()]).nullable(),
|
|
142
|
+
lineHeight: import_zod.z.number().nullable()
|
|
143
|
+
}),
|
|
144
|
+
slots: [],
|
|
145
|
+
description: "Heading text at various levels. h1 is largest, h4 is smallest.",
|
|
146
|
+
example: { text: "Hello World", level: "h1", color: "#000000" }
|
|
147
|
+
},
|
|
148
|
+
Text: {
|
|
149
|
+
props: import_zod.z.object({
|
|
150
|
+
text: import_zod.z.string(),
|
|
151
|
+
fontSize: import_zod.z.number().nullable(),
|
|
152
|
+
color: import_zod.z.string().nullable(),
|
|
153
|
+
align: import_zod.z.enum(["left", "center", "right"]).nullable(),
|
|
154
|
+
fontWeight: import_zod.z.enum(["normal", "bold"]).nullable(),
|
|
155
|
+
fontStyle: import_zod.z.enum(["normal", "italic"]).nullable(),
|
|
156
|
+
lineHeight: import_zod.z.number().nullable(),
|
|
157
|
+
letterSpacing: import_zod.z.union([import_zod.z.number(), import_zod.z.string()]).nullable(),
|
|
158
|
+
textDecoration: import_zod.z.enum(["none", "underline", "line-through"]).nullable()
|
|
159
|
+
}),
|
|
160
|
+
slots: [],
|
|
161
|
+
description: "Body text with configurable size, color, weight, and alignment.",
|
|
162
|
+
example: { text: "Some content here.", fontSize: 16, color: "#333333" }
|
|
163
|
+
},
|
|
164
|
+
Image: {
|
|
165
|
+
props: import_zod.z.object({
|
|
166
|
+
src: import_zod.z.string(),
|
|
167
|
+
width: import_zod.z.number().nullable(),
|
|
168
|
+
height: import_zod.z.number().nullable(),
|
|
169
|
+
borderRadius: import_zod.z.number().nullable(),
|
|
170
|
+
objectFit: import_zod.z.enum(["contain", "cover", "fill", "none"]).nullable()
|
|
171
|
+
}),
|
|
172
|
+
slots: [],
|
|
173
|
+
description: "Image from a URL. Specify width and/or height to control size. For placeholder images use https://picsum.photos/{width}/{height}?random={n}.",
|
|
174
|
+
example: {
|
|
175
|
+
src: "https://picsum.photos/400/300?random=1",
|
|
176
|
+
width: 400,
|
|
177
|
+
height: 300
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
// ==========================================================================
|
|
181
|
+
// Decorative Components
|
|
182
|
+
// ==========================================================================
|
|
183
|
+
Divider: {
|
|
184
|
+
props: import_zod.z.object({
|
|
185
|
+
color: import_zod.z.string().nullable(),
|
|
186
|
+
thickness: import_zod.z.number().nullable(),
|
|
187
|
+
marginTop: import_zod.z.number().nullable(),
|
|
188
|
+
marginBottom: import_zod.z.number().nullable()
|
|
189
|
+
}),
|
|
190
|
+
slots: [],
|
|
191
|
+
description: "Horizontal line separator between content sections.",
|
|
192
|
+
example: { color: "#e5e7eb", thickness: 1 }
|
|
193
|
+
},
|
|
194
|
+
Spacer: {
|
|
195
|
+
props: import_zod.z.object({
|
|
196
|
+
height: import_zod.z.number().nullable()
|
|
197
|
+
}),
|
|
198
|
+
slots: [],
|
|
199
|
+
description: "Empty vertical space between elements.",
|
|
200
|
+
example: { height: 20 }
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
204
|
+
0 && (module.exports = {
|
|
205
|
+
standardComponentDefinitions
|
|
206
|
+
});
|
|
207
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/catalog.ts"],"sourcesContent":["import { z } from \"zod\";\n\n/**\n * Standard component definitions for image catalogs.\n *\n * These define the available image components with their Zod prop schemas.\n * All components render to Satori-compatible JSX (HTML-like elements with\n * inline CSS flexbox styles).\n */\nexport const standardComponentDefinitions = {\n // ==========================================================================\n // Root\n // ==========================================================================\n\n Frame: {\n props: z.object({\n width: z.number(),\n height: z.number(),\n backgroundColor: z.string().nullable(),\n padding: z.number().nullable(),\n display: z.enum([\"flex\", \"none\"]).nullable(),\n flexDirection: z.enum([\"row\", \"column\"]).nullable(),\n alignItems: z\n .enum([\"flex-start\", \"center\", \"flex-end\", \"stretch\"])\n .nullable(),\n justifyContent: z\n .enum([\n \"flex-start\",\n \"center\",\n \"flex-end\",\n \"space-between\",\n \"space-around\",\n ])\n .nullable(),\n }),\n slots: [\"default\"],\n description:\n \"Root image container. Defines the output image dimensions and background. Must be the root element.\",\n example: { width: 1200, height: 630, backgroundColor: \"#ffffff\" },\n },\n\n // ==========================================================================\n // Layout Components\n // ==========================================================================\n\n Box: {\n props: z.object({\n padding: z.number().nullable(),\n paddingTop: z.number().nullable(),\n paddingBottom: z.number().nullable(),\n paddingLeft: z.number().nullable(),\n paddingRight: z.number().nullable(),\n margin: z.number().nullable(),\n backgroundColor: z.string().nullable(),\n borderWidth: z.number().nullable(),\n borderColor: z.string().nullable(),\n borderRadius: z.number().nullable(),\n flex: z.number().nullable(),\n width: z.union([z.number(), z.string()]).nullable(),\n height: z.union([z.number(), z.string()]).nullable(),\n alignItems: z\n .enum([\"flex-start\", \"center\", \"flex-end\", \"stretch\"])\n .nullable(),\n justifyContent: z\n .enum([\n \"flex-start\",\n \"center\",\n \"flex-end\",\n \"space-between\",\n \"space-around\",\n ])\n .nullable(),\n flexDirection: z.enum([\"row\", \"column\"]).nullable(),\n position: z.enum([\"relative\", \"absolute\"]).nullable(),\n top: z.number().nullable(),\n left: z.number().nullable(),\n right: z.number().nullable(),\n bottom: z.number().nullable(),\n overflow: z.enum([\"visible\", \"hidden\"]).nullable(),\n }),\n slots: [\"default\"],\n description:\n \"Generic container with padding, margin, background, border, and flex alignment. Supports absolute positioning.\",\n example: {\n padding: 20,\n backgroundColor: \"#f9f9f9\",\n borderRadius: 8,\n alignItems: \"center\",\n },\n },\n\n Row: {\n props: z.object({\n gap: z.number().nullable(),\n alignItems: z\n .enum([\"flex-start\", \"center\", \"flex-end\", \"stretch\"])\n .nullable(),\n justifyContent: z\n .enum([\n \"flex-start\",\n \"center\",\n \"flex-end\",\n \"space-between\",\n \"space-around\",\n ])\n .nullable(),\n padding: z.number().nullable(),\n flex: z.number().nullable(),\n wrap: z.boolean().nullable(),\n }),\n slots: [\"default\"],\n description:\n \"Horizontal flex layout. Use for placing elements side by side.\",\n example: { gap: 10, alignItems: \"center\" },\n },\n\n Column: {\n props: z.object({\n gap: z.number().nullable(),\n alignItems: z\n .enum([\"flex-start\", \"center\", \"flex-end\", \"stretch\"])\n .nullable(),\n justifyContent: z\n .enum([\n \"flex-start\",\n \"center\",\n \"flex-end\",\n \"space-between\",\n \"space-around\",\n ])\n .nullable(),\n padding: z.number().nullable(),\n flex: z.number().nullable(),\n }),\n slots: [\"default\"],\n description:\n \"Vertical flex layout. Use for stacking elements top to bottom.\",\n example: { gap: 8, padding: 10 },\n },\n\n // ==========================================================================\n // Content Components\n // ==========================================================================\n\n Heading: {\n props: z.object({\n text: z.string(),\n level: z.enum([\"h1\", \"h2\", \"h3\", \"h4\"]).nullable(),\n color: z.string().nullable(),\n align: z.enum([\"left\", \"center\", \"right\"]).nullable(),\n letterSpacing: z.union([z.number(), z.string()]).nullable(),\n lineHeight: z.number().nullable(),\n }),\n slots: [],\n description:\n \"Heading text at various levels. h1 is largest, h4 is smallest.\",\n example: { text: \"Hello World\", level: \"h1\", color: \"#000000\" },\n },\n\n Text: {\n props: z.object({\n text: z.string(),\n fontSize: z.number().nullable(),\n color: z.string().nullable(),\n align: z.enum([\"left\", \"center\", \"right\"]).nullable(),\n fontWeight: z.enum([\"normal\", \"bold\"]).nullable(),\n fontStyle: z.enum([\"normal\", \"italic\"]).nullable(),\n lineHeight: z.number().nullable(),\n letterSpacing: z.union([z.number(), z.string()]).nullable(),\n textDecoration: z.enum([\"none\", \"underline\", \"line-through\"]).nullable(),\n }),\n slots: [],\n description:\n \"Body text with configurable size, color, weight, and alignment.\",\n example: { text: \"Some content here.\", fontSize: 16, color: \"#333333\" },\n },\n\n Image: {\n props: z.object({\n src: z.string(),\n width: z.number().nullable(),\n height: z.number().nullable(),\n borderRadius: z.number().nullable(),\n objectFit: z.enum([\"contain\", \"cover\", \"fill\", \"none\"]).nullable(),\n }),\n slots: [],\n description:\n \"Image from a URL. Specify width and/or height to control size. For placeholder images use https://picsum.photos/{width}/{height}?random={n}.\",\n example: {\n src: \"https://picsum.photos/400/300?random=1\",\n width: 400,\n height: 300,\n },\n },\n\n // ==========================================================================\n // Decorative Components\n // ==========================================================================\n\n Divider: {\n props: z.object({\n color: z.string().nullable(),\n thickness: z.number().nullable(),\n marginTop: z.number().nullable(),\n marginBottom: z.number().nullable(),\n }),\n slots: [],\n description: \"Horizontal line separator between content sections.\",\n example: { color: \"#e5e7eb\", thickness: 1 },\n },\n\n Spacer: {\n props: z.object({\n height: z.number().nullable(),\n }),\n slots: [],\n description: \"Empty vertical space between elements.\",\n example: { height: 20 },\n },\n};\n\nexport type StandardComponentDefinitions = typeof standardComponentDefinitions;\n\nexport type StandardComponentProps<\n K extends keyof StandardComponentDefinitions,\n> = StandardComponentDefinitions[K][\"props\"] extends { _output: infer O }\n ? O\n : z.output<StandardComponentDefinitions[K][\"props\"]>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAkB;AASX,IAAM,+BAA+B;AAAA;AAAA;AAAA;AAAA,EAK1C,OAAO;AAAA,IACL,OAAO,aAAE,OAAO;AAAA,MACd,OAAO,aAAE,OAAO;AAAA,MAChB,QAAQ,aAAE,OAAO;AAAA,MACjB,iBAAiB,aAAE,OAAO,EAAE,SAAS;AAAA,MACrC,SAAS,aAAE,OAAO,EAAE,SAAS;AAAA,MAC7B,SAAS,aAAE,KAAK,CAAC,QAAQ,MAAM,CAAC,EAAE,SAAS;AAAA,MAC3C,eAAe,aAAE,KAAK,CAAC,OAAO,QAAQ,CAAC,EAAE,SAAS;AAAA,MAClD,YAAY,aACT,KAAK,CAAC,cAAc,UAAU,YAAY,SAAS,CAAC,EACpD,SAAS;AAAA,MACZ,gBAAgB,aACb,KAAK;AAAA,QACJ;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC,EACA,SAAS;AAAA,IACd,CAAC;AAAA,IACD,OAAO,CAAC,SAAS;AAAA,IACjB,aACE;AAAA,IACF,SAAS,EAAE,OAAO,MAAM,QAAQ,KAAK,iBAAiB,UAAU;AAAA,E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sBAAsB,UAAU,IAAI,OAAO,UAAU;AAAA,EACxE;AAAA,EAEA,OAAO;AAAA,IACL,OAAO,aAAE,OAAO;AAAA,MACd,KAAK,aAAE,OAAO;AAAA,MACd,OAAO,aAAE,OAAO,EAAE,SAAS;AAAA,MAC3B,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,MAC5B,cAAc,aAAE,OAAO,EAAE,SAAS;AAAA,MAClC,WAAW,aAAE,KAAK,CAAC,WAAW,SAAS,QAAQ,MAAM,CAAC,EAAE,SAAS;AAAA,IACnE,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aACE;AAAA,IACF,SAAS;AAAA,MACP,KAAK;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,IACV;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAMA,SAAS;AAAA,IACP,OAAO,aAAE,OAAO;AAAA,MACd,OAAO,aAAE,OAAO,EAAE,SAAS;AAAA,MAC3B,WAAW,aAAE,OAAO,EAAE,SAAS;AAAA,MAC/B,WAAW,aAAE,OAAO,EAAE,SAAS;AAAA,MAC/B,cAAc,aAAE,OAAO,EAAE,SAAS;AAAA,IACpC,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aAAa;AAAA,IACb,SAAS,EAAE,OAAO,WAAW,WAAW,EAAE;AAAA,EAC5C;AAAA,EAEA,QAAQ;AAAA,IACN,OAAO,aAAE,OAAO;AAAA,MACd,QAAQ,aAAE,OAAO,EAAE,SAAS;AAAA,IAC9B,CAAC;AAAA,IACD,OAAO,CAAC;AAAA,IACR,aAAa;AAAA,IACb,SAAS,EAAE,QAAQ,GAAG;AAAA,EACxB;AACF;","names":[]}
|
package/dist/catalog.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/schema.ts
|
|
2
|
+
import { defineSchema } from "@json-render/core";
|
|
3
|
+
var schema = defineSchema(
|
|
4
|
+
(s) => ({
|
|
5
|
+
spec: s.object({
|
|
6
|
+
root: s.string(),
|
|
7
|
+
elements: s.record(
|
|
8
|
+
s.object({
|
|
9
|
+
type: s.ref("catalog.components"),
|
|
10
|
+
props: s.propsOf("catalog.components"),
|
|
11
|
+
children: s.array(s.string()),
|
|
12
|
+
visible: s.any()
|
|
13
|
+
})
|
|
14
|
+
)
|
|
15
|
+
}),
|
|
16
|
+
catalog: s.object({
|
|
17
|
+
components: s.map({
|
|
18
|
+
props: s.zod(),
|
|
19
|
+
slots: s.array(s.string()),
|
|
20
|
+
description: s.string(),
|
|
21
|
+
example: s.any()
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
}),
|
|
25
|
+
{
|
|
26
|
+
defaultRules: [
|
|
27
|
+
"The root element MUST be a Frame component. It defines the image dimensions (width, height) and background.",
|
|
28
|
+
"Frame width and height determine the output image size. Common sizes: 1200x630 (OG image), 1080x1080 (social square), 1920x1080 (banner).",
|
|
29
|
+
"Use Row for horizontal layouts and Column for vertical layouts. Both support gap, align, and justify props.",
|
|
30
|
+
"All text content must use Heading or Text components. Raw strings are not supported.",
|
|
31
|
+
"Image src must be a fully qualified URL. For placeholder images, use https://picsum.photos/{width}/{height}?random={n}.",
|
|
32
|
+
"Satori renders a subset of CSS: flexbox layout, borders, backgrounds, text styling. Absolute positioning is supported via position/top/left/right/bottom.",
|
|
33
|
+
"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist."
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
schema
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=chunk-A67OT34V.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts"],"sourcesContent":["import { defineSchema } from \"@json-render/core\";\n\n/**\n * The schema for @json-render/image\n *\n * Defines:\n * - Spec: A flat tree of elements with keys, types, props, and children references\n * - Catalog: Components with props schemas\n *\n * Reuses the same { root, elements } spec format as the React and React PDF renderers.\n */\nexport const schema = defineSchema(\n (s) => ({\n spec: s.object({\n root: s.string(),\n elements: s.record(\n s.object({\n type: s.ref(\"catalog.components\"),\n props: s.propsOf(\"catalog.components\"),\n children: s.array(s.string()),\n visible: s.any(),\n }),\n ),\n }),\n\n catalog: s.object({\n components: s.map({\n props: s.zod(),\n slots: s.array(s.string()),\n description: s.string(),\n example: s.any(),\n }),\n }),\n }),\n {\n defaultRules: [\n \"The root element MUST be a Frame component. It defines the image dimensions (width, height) and background.\",\n \"Frame width and height determine the output image size. Common sizes: 1200x630 (OG image), 1080x1080 (social square), 1920x1080 (banner).\",\n \"Use Row for horizontal layouts and Column for vertical layouts. Both support gap, align, and justify props.\",\n \"All text content must use Heading or Text components. Raw strings are not supported.\",\n \"Image src must be a fully qualified URL. For placeholder images, use https://picsum.photos/{width}/{height}?random={n}.\",\n \"Satori renders a subset of CSS: flexbox layout, borders, backgrounds, text styling. Absolute positioning is supported via position/top/left/right/bottom.\",\n \"CRITICAL INTEGRITY CHECK: Before outputting ANY element that references children, you MUST have already output (or will output) each child as its own element. If an element has children: ['a', 'b'], then elements 'a' and 'b' MUST exist.\",\n ],\n },\n);\n\nexport type ImageSchema = typeof schema;\n\nexport type ImageSpec<TCatalog> = typeof schema extends {\n createCatalog: (catalog: TCatalog) => { _specType: infer S };\n}\n ? S\n : never;\n"],"mappings":";AAAA,SAAS,oBAAoB;AAWtB,IAAM,SAAS;AAAA,EACpB,CAAC,OAAO;AAAA,IACN,MAAM,EAAE,OAAO;AAAA,MACb,MAAM,EAAE,OAAO;AAAA,MACf,UAAU,EAAE;AAAA,QACV,EAAE,OAAO;AAAA,UACP,MAAM,EAAE,IAAI,oBAAoB;AAAA,UAChC,OAAO,EAAE,QAAQ,oBAAoB;AAAA,UACrC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,UAC5B,SAAS,EAAE,IAAI;AAAA,QACjB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,IAED,SAAS,EAAE,OAAO;AAAA,MAChB,YAAY,EAAE,IAAI;AAAA,QAChB,OAAO,EAAE,IAAI;AAAA,QACb,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC;AAAA,QACzB,aAAa,EAAE,OAAO;AAAA,QACtB,SAAS,EAAE,IAAI;AAAA,MACjB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,cAAc;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|