@rudyzeinoun/email-builder 0.0.33 → 0.0.35
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/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +11 -1
- package/dist/index.mjs +11 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -254,6 +254,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
254
254
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["HELVETICA", "GEORGIA", "MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
255
255
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
256
256
|
previewText: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
257
|
+
underline: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
257
258
|
}, "strip", z.ZodTypeAny, {
|
|
258
259
|
backdropColor?: string | null | undefined;
|
|
259
260
|
borderColor?: string | null | undefined;
|
|
@@ -263,6 +264,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
263
264
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
264
265
|
childrenIds?: string[] | null | undefined;
|
|
265
266
|
previewText?: string | null | undefined;
|
|
267
|
+
underline?: boolean | null | undefined;
|
|
266
268
|
}, {
|
|
267
269
|
backdropColor?: string | null | undefined;
|
|
268
270
|
borderColor?: string | null | undefined;
|
|
@@ -272,6 +274,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
272
274
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
273
275
|
childrenIds?: string[] | null | undefined;
|
|
274
276
|
previewText?: string | null | undefined;
|
|
277
|
+
underline?: boolean | null | undefined;
|
|
275
278
|
}>;
|
|
276
279
|
Avatar: z.ZodObject<{
|
|
277
280
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -1209,6 +1212,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1209
1212
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["HELVETICA", "GEORGIA", "MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
1210
1213
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
1211
1214
|
previewText: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1215
|
+
underline: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
1212
1216
|
}, "strip", z.ZodTypeAny, {
|
|
1213
1217
|
backdropColor?: string | null | undefined;
|
|
1214
1218
|
borderColor?: string | null | undefined;
|
|
@@ -1218,6 +1222,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1218
1222
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
1219
1223
|
childrenIds?: string[] | null | undefined;
|
|
1220
1224
|
previewText?: string | null | undefined;
|
|
1225
|
+
underline?: boolean | null | undefined;
|
|
1221
1226
|
}, {
|
|
1222
1227
|
backdropColor?: string | null | undefined;
|
|
1223
1228
|
borderColor?: string | null | undefined;
|
|
@@ -1227,6 +1232,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1227
1232
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
1228
1233
|
childrenIds?: string[] | null | undefined;
|
|
1229
1234
|
previewText?: string | null | undefined;
|
|
1235
|
+
underline?: boolean | null | undefined;
|
|
1230
1236
|
}>;
|
|
1231
1237
|
Avatar: z.ZodObject<{
|
|
1232
1238
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
package/dist/index.d.ts
CHANGED
|
@@ -254,6 +254,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
254
254
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["HELVETICA", "GEORGIA", "MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
255
255
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
256
256
|
previewText: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
257
|
+
underline: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
257
258
|
}, "strip", z.ZodTypeAny, {
|
|
258
259
|
backdropColor?: string | null | undefined;
|
|
259
260
|
borderColor?: string | null | undefined;
|
|
@@ -263,6 +264,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
263
264
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
264
265
|
childrenIds?: string[] | null | undefined;
|
|
265
266
|
previewText?: string | null | undefined;
|
|
267
|
+
underline?: boolean | null | undefined;
|
|
266
268
|
}, {
|
|
267
269
|
backdropColor?: string | null | undefined;
|
|
268
270
|
borderColor?: string | null | undefined;
|
|
@@ -272,6 +274,7 @@ declare const ReaderBlockSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"type", an
|
|
|
272
274
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
273
275
|
childrenIds?: string[] | null | undefined;
|
|
274
276
|
previewText?: string | null | undefined;
|
|
277
|
+
underline?: boolean | null | undefined;
|
|
275
278
|
}>;
|
|
276
279
|
Avatar: z.ZodObject<{
|
|
277
280
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
|
@@ -1209,6 +1212,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1209
1212
|
fontFamily: z.ZodOptional<z.ZodNullable<z.ZodEnum<["HELVETICA", "GEORGIA", "MODERN_SANS", "BOOK_SANS", "ORGANIC_SANS", "GEOMETRIC_SANS", "HEAVY_SANS", "ROUNDED_SANS", "MODERN_SERIF", "BOOK_SERIF", "MONOSPACE"]>>>;
|
|
1210
1213
|
childrenIds: z.ZodNullable<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
1211
1214
|
previewText: z.ZodNullable<z.ZodOptional<z.ZodString>>;
|
|
1215
|
+
underline: z.ZodNullable<z.ZodOptional<z.ZodBoolean>>;
|
|
1212
1216
|
}, "strip", z.ZodTypeAny, {
|
|
1213
1217
|
backdropColor?: string | null | undefined;
|
|
1214
1218
|
borderColor?: string | null | undefined;
|
|
@@ -1218,6 +1222,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1218
1222
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
1219
1223
|
childrenIds?: string[] | null | undefined;
|
|
1220
1224
|
previewText?: string | null | undefined;
|
|
1225
|
+
underline?: boolean | null | undefined;
|
|
1221
1226
|
}, {
|
|
1222
1227
|
backdropColor?: string | null | undefined;
|
|
1223
1228
|
borderColor?: string | null | undefined;
|
|
@@ -1227,6 +1232,7 @@ declare const ReaderDocumentSchema: z.ZodRecord<z.ZodString, z.ZodEffects<z.ZodD
|
|
|
1227
1232
|
fontFamily?: "HELVETICA" | "GEORGIA" | "MODERN_SANS" | "BOOK_SANS" | "ORGANIC_SANS" | "GEOMETRIC_SANS" | "HEAVY_SANS" | "ROUNDED_SANS" | "MODERN_SERIF" | "BOOK_SERIF" | "MONOSPACE" | null | undefined;
|
|
1228
1233
|
childrenIds?: string[] | null | undefined;
|
|
1229
1234
|
previewText?: string | null | undefined;
|
|
1235
|
+
underline?: boolean | null | undefined;
|
|
1230
1236
|
}>;
|
|
1231
1237
|
Avatar: z.ZodObject<{
|
|
1232
1238
|
style: z.ZodNullable<z.ZodOptional<z.ZodObject<{
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,8 @@ var EmailLayoutPropsSchema = import_zod3.z.object({
|
|
|
165
165
|
textColor: COLOR_SCHEMA,
|
|
166
166
|
fontFamily: FONT_FAMILY_SCHEMA,
|
|
167
167
|
childrenIds: import_zod3.z.array(import_zod3.z.string()).optional().nullable(),
|
|
168
|
-
previewText: import_zod3.z.string().optional().nullable()
|
|
168
|
+
previewText: import_zod3.z.string().optional().nullable(),
|
|
169
|
+
underline: import_zod3.z.boolean().optional().nullable()
|
|
169
170
|
});
|
|
170
171
|
|
|
171
172
|
// src/blocks/EmailLayout/EmailLayoutReader.tsx
|
|
@@ -316,7 +317,15 @@ function Reader({ document, rootBlockId }) {
|
|
|
316
317
|
}
|
|
317
318
|
|
|
318
319
|
// src/renderers/renderToStaticMarkup.tsx
|
|
320
|
+
function parseRootElement(rootElement) {
|
|
321
|
+
const result = EmailLayoutPropsSchema.safeParse(rootElement);
|
|
322
|
+
if (!result.success) {
|
|
323
|
+
throw new Error(`Invalid EmailLayout: ${JSON.stringify(result.error.issues)}`);
|
|
324
|
+
}
|
|
325
|
+
return result.data;
|
|
326
|
+
}
|
|
319
327
|
function renderToStaticMarkup(document, { rootBlockId }) {
|
|
328
|
+
const rootElement = parseRootElement(document["root"]);
|
|
320
329
|
return "<!DOCTYPE html>" + (0, import_server.renderToStaticMarkup)(
|
|
321
330
|
/* @__PURE__ */ import_react5.default.createElement("html", null, /* @__PURE__ */ import_react5.default.createElement("head", null, /* @__PURE__ */ import_react5.default.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }), /* @__PURE__ */ import_react5.default.createElement("style", { type: "text/css" }, `
|
|
322
331
|
.responsive-mobile { display: none !important; }
|
|
@@ -325,6 +334,7 @@ function renderToStaticMarkup(document, { rootBlockId }) {
|
|
|
325
334
|
.responsive-mobile { display: block !important; }
|
|
326
335
|
.responsive-desktop { display: none !important; }
|
|
327
336
|
}
|
|
337
|
+
${rootElement.underline !== true ? "a { text-decoration: none; }" : ""}
|
|
328
338
|
`)), /* @__PURE__ */ import_react5.default.createElement("body", null, /* @__PURE__ */ import_react5.default.createElement(Reader, { document, rootBlockId })))
|
|
329
339
|
);
|
|
330
340
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -132,7 +132,8 @@ var EmailLayoutPropsSchema = z3.object({
|
|
|
132
132
|
textColor: COLOR_SCHEMA,
|
|
133
133
|
fontFamily: FONT_FAMILY_SCHEMA,
|
|
134
134
|
childrenIds: z3.array(z3.string()).optional().nullable(),
|
|
135
|
-
previewText: z3.string().optional().nullable()
|
|
135
|
+
previewText: z3.string().optional().nullable(),
|
|
136
|
+
underline: z3.boolean().optional().nullable()
|
|
136
137
|
});
|
|
137
138
|
|
|
138
139
|
// src/blocks/EmailLayout/EmailLayoutReader.tsx
|
|
@@ -283,7 +284,15 @@ function Reader({ document, rootBlockId }) {
|
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
// src/renderers/renderToStaticMarkup.tsx
|
|
287
|
+
function parseRootElement(rootElement) {
|
|
288
|
+
const result = EmailLayoutPropsSchema.safeParse(rootElement);
|
|
289
|
+
if (!result.success) {
|
|
290
|
+
throw new Error(`Invalid EmailLayout: ${JSON.stringify(result.error.issues)}`);
|
|
291
|
+
}
|
|
292
|
+
return result.data;
|
|
293
|
+
}
|
|
286
294
|
function renderToStaticMarkup(document, { rootBlockId }) {
|
|
295
|
+
const rootElement = parseRootElement(document["root"]);
|
|
287
296
|
return "<!DOCTYPE html>" + baseRenderToStaticMarkup(
|
|
288
297
|
/* @__PURE__ */ React5.createElement("html", null, /* @__PURE__ */ React5.createElement("head", null, /* @__PURE__ */ React5.createElement("meta", { name: "viewport", content: "width=device-width, initial-scale=1.0" }), /* @__PURE__ */ React5.createElement("style", { type: "text/css" }, `
|
|
289
298
|
.responsive-mobile { display: none !important; }
|
|
@@ -292,6 +301,7 @@ function renderToStaticMarkup(document, { rootBlockId }) {
|
|
|
292
301
|
.responsive-mobile { display: block !important; }
|
|
293
302
|
.responsive-desktop { display: none !important; }
|
|
294
303
|
}
|
|
304
|
+
${rootElement.underline !== true ? "a { text-decoration: none; }" : ""}
|
|
295
305
|
`)), /* @__PURE__ */ React5.createElement("body", null, /* @__PURE__ */ React5.createElement(Reader, { document, rootBlockId })))
|
|
296
306
|
);
|
|
297
307
|
}
|