@delmaredigital/payload-puck 0.6.16 → 0.6.18

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.
Files changed (95) hide show
  1. package/dist/components/email/EmailButton/EmailButton.editor.d.ts +3 -0
  2. package/dist/components/email/EmailButton/EmailButton.editor.js +81 -0
  3. package/dist/components/email/EmailButton/EmailButton.server.d.ts +3 -0
  4. package/dist/components/email/EmailButton/EmailButton.server.js +69 -0
  5. package/dist/components/email/EmailButton/EmailButton.types.d.ts +11 -0
  6. package/dist/components/email/EmailButton/EmailButton.types.js +1 -0
  7. package/dist/components/email/EmailColumns/EmailColumns.editor.d.ts +2 -0
  8. package/dist/components/email/EmailColumns/EmailColumns.editor.js +45 -0
  9. package/dist/components/email/EmailColumns/EmailColumns.server.d.ts +2 -0
  10. package/dist/components/email/EmailColumns/EmailColumns.server.js +58 -0
  11. package/dist/components/email/EmailColumns/EmailColumns.types.d.ts +8 -0
  12. package/dist/components/email/EmailColumns/EmailColumns.types.js +1 -0
  13. package/dist/components/email/EmailDivider/EmailDivider.editor.d.ts +3 -0
  14. package/dist/components/email/EmailDivider/EmailDivider.editor.js +38 -0
  15. package/dist/components/email/EmailDivider/EmailDivider.server.d.ts +3 -0
  16. package/dist/components/email/EmailDivider/EmailDivider.server.js +38 -0
  17. package/dist/components/email/EmailDivider/EmailDivider.types.d.ts +6 -0
  18. package/dist/components/email/EmailDivider/EmailDivider.types.js +1 -0
  19. package/dist/components/email/EmailFooter/EmailFooter.editor.d.ts +3 -0
  20. package/dist/components/email/EmailFooter/EmailFooter.editor.js +22 -0
  21. package/dist/components/email/EmailFooter/EmailFooter.server.d.ts +3 -0
  22. package/dist/components/email/EmailFooter/EmailFooter.server.js +59 -0
  23. package/dist/components/email/EmailFooter/EmailFooter.types.d.ts +6 -0
  24. package/dist/components/email/EmailFooter/EmailFooter.types.js +1 -0
  25. package/dist/components/email/EmailHeader/EmailHeader.editor.d.ts +3 -0
  26. package/dist/components/email/EmailHeader/EmailHeader.editor.js +28 -0
  27. package/dist/components/email/EmailHeader/EmailHeader.server.d.ts +3 -0
  28. package/dist/components/email/EmailHeader/EmailHeader.server.js +60 -0
  29. package/dist/components/email/EmailHeader/EmailHeader.types.d.ts +8 -0
  30. package/dist/components/email/EmailHeader/EmailHeader.types.js +1 -0
  31. package/dist/components/email/EmailHeading/EmailHeading.editor.d.ts +3 -0
  32. package/dist/components/email/EmailHeading/EmailHeading.editor.js +50 -0
  33. package/dist/components/email/EmailHeading/EmailHeading.server.d.ts +3 -0
  34. package/dist/components/email/EmailHeading/EmailHeading.server.js +35 -0
  35. package/dist/components/email/EmailHeading/EmailHeading.types.d.ts +7 -0
  36. package/dist/components/email/EmailHeading/EmailHeading.types.js +1 -0
  37. package/dist/components/email/EmailImage/EmailImage.editor.d.ts +3 -0
  38. package/dist/components/email/EmailImage/EmailImage.editor.js +46 -0
  39. package/dist/components/email/EmailImage/EmailImage.server.d.ts +3 -0
  40. package/dist/components/email/EmailImage/EmailImage.server.js +81 -0
  41. package/dist/components/email/EmailImage/EmailImage.types.d.ts +9 -0
  42. package/dist/components/email/EmailImage/EmailImage.types.js +1 -0
  43. package/dist/components/email/EmailSection/EmailSection.editor.d.ts +2 -0
  44. package/dist/components/email/EmailSection/EmailSection.editor.js +21 -0
  45. package/dist/components/email/EmailSection/EmailSection.server.d.ts +2 -0
  46. package/dist/components/email/EmailSection/EmailSection.server.js +49 -0
  47. package/dist/components/email/EmailSection/EmailSection.types.d.ts +7 -0
  48. package/dist/components/email/EmailSection/EmailSection.types.js +1 -0
  49. package/dist/components/email/EmailSocial/EmailSocial.editor.d.ts +3 -0
  50. package/dist/components/email/EmailSocial/EmailSocial.editor.js +70 -0
  51. package/dist/components/email/EmailSocial/EmailSocial.server.d.ts +3 -0
  52. package/dist/components/email/EmailSocial/EmailSocial.server.js +89 -0
  53. package/dist/components/email/EmailSocial/EmailSocial.types.d.ts +10 -0
  54. package/dist/components/email/EmailSocial/EmailSocial.types.js +1 -0
  55. package/dist/components/email/EmailSpacer/EmailSpacer.editor.d.ts +3 -0
  56. package/dist/components/email/EmailSpacer/EmailSpacer.editor.js +12 -0
  57. package/dist/components/email/EmailSpacer/EmailSpacer.server.d.ts +3 -0
  58. package/dist/components/email/EmailSpacer/EmailSpacer.server.js +25 -0
  59. package/dist/components/email/EmailSpacer/EmailSpacer.types.d.ts +3 -0
  60. package/dist/components/email/EmailSpacer/EmailSpacer.types.js +1 -0
  61. package/dist/components/email/EmailText/EmailText.editor.d.ts +3 -0
  62. package/dist/components/email/EmailText/EmailText.editor.js +102 -0
  63. package/dist/components/email/EmailText/EmailText.server.d.ts +3 -0
  64. package/dist/components/email/EmailText/EmailText.server.js +35 -0
  65. package/dist/components/email/EmailText/EmailText.types.d.ts +8 -0
  66. package/dist/components/email/EmailText/EmailText.types.js +1 -0
  67. package/dist/components/email/EmailWrapper/EmailWrapper.editor.d.ts +2 -0
  68. package/dist/components/email/EmailWrapper/EmailWrapper.editor.js +21 -0
  69. package/dist/components/email/EmailWrapper/EmailWrapper.server.d.ts +2 -0
  70. package/dist/components/email/EmailWrapper/EmailWrapper.server.js +61 -0
  71. package/dist/components/email/EmailWrapper/EmailWrapper.types.d.ts +7 -0
  72. package/dist/components/email/EmailWrapper/EmailWrapper.types.js +1 -0
  73. package/dist/components/email/exports.d.ts +49 -0
  74. package/dist/components/email/exports.js +50 -0
  75. package/dist/components/email/utils.d.ts +74 -0
  76. package/dist/components/email/utils.js +137 -0
  77. package/dist/config/config.email.d.ts +71 -0
  78. package/dist/config/config.email.editor.d.ts +82 -0
  79. package/dist/config/config.email.editor.js +112 -0
  80. package/dist/config/config.email.js +101 -0
  81. package/dist/email/EmailRenderer.d.ts +16 -0
  82. package/dist/email/EmailRenderer.js +20 -0
  83. package/dist/email/email-document.d.ts +29 -0
  84. package/dist/email/email-document.js +67 -0
  85. package/dist/email/index.d.ts +23 -0
  86. package/dist/email/index.js +22 -0
  87. package/dist/email/renderToEmailHtml.d.ts +23 -0
  88. package/dist/email/renderToEmailHtml.js +43 -0
  89. package/dist/fields/index.d.ts +1 -0
  90. package/dist/fields/index.js +1 -0
  91. package/dist/fields/shared.d.ts +16 -0
  92. package/dist/fields/shared.js +59 -0
  93. package/dist/version.d.ts +1 -1
  94. package/dist/version.js +1 -1
  95. package/package.json +29 -17
@@ -0,0 +1,102 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { createRichTextField } from '../../../fields/richtext/index.js';
5
+ import { createColorPickerField } from '../../../fields/ColorPickerField.js';
6
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
7
+ const defaultProps = {
8
+ content: '<p>Enter your text here...</p>',
9
+ fontSize: '16px',
10
+ color: {
11
+ hex: '#333333'
12
+ },
13
+ alignment: 'left',
14
+ lineHeight: '1.5'
15
+ };
16
+ export const EmailTextEditorConfig = {
17
+ label: 'Text',
18
+ fields: {
19
+ content: createRichTextField({
20
+ label: 'Content',
21
+ contentEditable: true
22
+ }),
23
+ fontSize: {
24
+ type: 'select',
25
+ label: 'Font Size',
26
+ options: [
27
+ {
28
+ label: 'Small (14px)',
29
+ value: '14px'
30
+ },
31
+ {
32
+ label: 'Normal (16px)',
33
+ value: '16px'
34
+ },
35
+ {
36
+ label: 'Large (18px)',
37
+ value: '18px'
38
+ },
39
+ {
40
+ label: 'Extra Large (20px)',
41
+ value: '20px'
42
+ }
43
+ ]
44
+ },
45
+ color: createColorPickerField({
46
+ label: 'Text Color'
47
+ }),
48
+ alignment: {
49
+ type: 'radio',
50
+ label: 'Alignment',
51
+ options: [
52
+ {
53
+ label: 'Left',
54
+ value: 'left'
55
+ },
56
+ {
57
+ label: 'Center',
58
+ value: 'center'
59
+ },
60
+ {
61
+ label: 'Right',
62
+ value: 'right'
63
+ }
64
+ ]
65
+ },
66
+ lineHeight: {
67
+ type: 'select',
68
+ label: 'Line Height',
69
+ options: [
70
+ {
71
+ label: 'Tight (1.2)',
72
+ value: '1.2'
73
+ },
74
+ {
75
+ label: 'Normal (1.5)',
76
+ value: '1.5'
77
+ },
78
+ {
79
+ label: 'Relaxed (1.8)',
80
+ value: '1.8'
81
+ },
82
+ {
83
+ label: 'Loose (2.0)',
84
+ value: '2.0'
85
+ }
86
+ ]
87
+ }
88
+ },
89
+ defaultProps,
90
+ render: ({ content, fontSize, color, alignment, lineHeight })=>{
91
+ const textColor = colorValueToEmailCSS(color) ?? '#333333';
92
+ return /*#__PURE__*/ _jsx("div", {
93
+ style: {
94
+ fontSize,
95
+ color: textColor,
96
+ textAlign: alignment,
97
+ lineHeight
98
+ },
99
+ children: content
100
+ });
101
+ }
102
+ };
@@ -0,0 +1,3 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ import type { EmailTextProps } from './EmailText.types.js';
3
+ export declare const EmailTextConfig: ComponentConfig<EmailTextProps>;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
3
+ import { tiptapHtmlToEmailHtml } from '../utils.js';
4
+ const defaultProps = {
5
+ content: '<p>Enter your text here...</p>',
6
+ fontSize: '16px',
7
+ color: {
8
+ hex: '#333333'
9
+ },
10
+ alignment: 'left',
11
+ lineHeight: '1.5'
12
+ };
13
+ export const EmailTextConfig = {
14
+ label: 'Text',
15
+ defaultProps,
16
+ render: ({ content, fontSize, color, alignment, lineHeight })=>{
17
+ const textColor = colorValueToEmailCSS(color) ?? '#333333';
18
+ const htmlContent = typeof content === 'string' ? tiptapHtmlToEmailHtml(content, {
19
+ fontSize,
20
+ color: textColor,
21
+ lineHeight
22
+ }) : '';
23
+ return /*#__PURE__*/ _jsx("div", {
24
+ style: {
25
+ fontSize,
26
+ color: textColor,
27
+ textAlign: alignment,
28
+ lineHeight
29
+ },
30
+ dangerouslySetInnerHTML: {
31
+ __html: htmlContent
32
+ }
33
+ });
34
+ }
35
+ };
@@ -0,0 +1,8 @@
1
+ import type { ColorValue } from '../../../fields/shared.js';
2
+ export interface EmailTextProps {
3
+ content: React.ReactNode;
4
+ fontSize: string;
5
+ color: ColorValue | null;
6
+ alignment: 'left' | 'center' | 'right';
7
+ lineHeight: string;
8
+ }
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ export declare const EmailWrapperEditorConfig: ComponentConfig;
@@ -0,0 +1,21 @@
1
+ import { EmailWrapperConfig } from './EmailWrapper.server.js';
2
+ import { createColorPickerField } from '../../../fields/ColorPickerField.js';
3
+ export const EmailWrapperEditorConfig = {
4
+ ...EmailWrapperConfig,
5
+ fields: {
6
+ ...EmailWrapperConfig.fields,
7
+ backgroundColor: createColorPickerField({
8
+ label: 'Background Color'
9
+ }),
10
+ backgroundImage: {
11
+ type: 'text',
12
+ label: 'Background Image URL'
13
+ },
14
+ maxWidth: {
15
+ type: 'number',
16
+ label: 'Max Width (px)',
17
+ min: 200,
18
+ max: 900
19
+ }
20
+ }
21
+ };
@@ -0,0 +1,2 @@
1
+ import type { ComponentConfig } from '@puckeditor/core';
2
+ export declare const EmailWrapperConfig: ComponentConfig;
@@ -0,0 +1,61 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { TABLE_ATTRS, FULL_WIDTH_TABLE_STYLE, vmlBackgroundOpen, vmlBackgroundClose } from '../utils.js';
3
+ import { colorValueToEmailCSS } from '../../../fields/shared.js';
4
+ const defaultProps = {
5
+ content: [],
6
+ backgroundColor: {
7
+ hex: '#ffffff'
8
+ },
9
+ backgroundImage: '',
10
+ maxWidth: 600
11
+ };
12
+ export const EmailWrapperConfig = {
13
+ label: 'Wrapper',
14
+ fields: {
15
+ content: {
16
+ type: 'slot'
17
+ }
18
+ },
19
+ defaultProps,
20
+ render: ({ content: Content, backgroundColor, backgroundImage, maxWidth })=>{
21
+ const bgColor = colorValueToEmailCSS(backgroundColor) ?? '#ffffff';
22
+ const ContentSlot = Content;
23
+ const tdStyle = {
24
+ backgroundColor: bgColor
25
+ };
26
+ if (backgroundImage) {
27
+ tdStyle.backgroundImage = `url(${backgroundImage})`;
28
+ tdStyle.backgroundSize = 'cover';
29
+ tdStyle.backgroundPosition = 'center';
30
+ }
31
+ // VML markup is generated internally by vmlBackgroundOpen/Close utilities
32
+ // for Outlook email client compatibility - no user input is used
33
+ return /*#__PURE__*/ _jsx("table", {
34
+ ...TABLE_ATTRS,
35
+ style: FULL_WIDTH_TABLE_STYLE,
36
+ children: /*#__PURE__*/ _jsx("tbody", {
37
+ children: /*#__PURE__*/ _jsx("tr", {
38
+ children: /*#__PURE__*/ _jsxs("td", {
39
+ style: tdStyle,
40
+ children: [
41
+ backgroundImage && /*#__PURE__*/ _jsx("div", {
42
+ dangerouslySetInnerHTML: {
43
+ __html: vmlBackgroundOpen({
44
+ width: maxWidth ?? 600,
45
+ src: backgroundImage
46
+ })
47
+ }
48
+ }),
49
+ /*#__PURE__*/ _jsx(ContentSlot, {}),
50
+ backgroundImage && /*#__PURE__*/ _jsx("div", {
51
+ dangerouslySetInnerHTML: {
52
+ __html: vmlBackgroundClose()
53
+ }
54
+ })
55
+ ]
56
+ })
57
+ })
58
+ })
59
+ });
60
+ }
61
+ };
@@ -0,0 +1,7 @@
1
+ import type { ColorValue } from '../../../fields/shared.js';
2
+ export interface EmailWrapperProps {
3
+ content: unknown;
4
+ backgroundColor: ColorValue | null;
5
+ backgroundImage: string;
6
+ maxWidth: number;
7
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Individual email component config exports
3
+ *
4
+ * Cherry-pick email components for custom configs.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import {
9
+ * EmailSectionEditorConfig,
10
+ * EmailTextEditorConfig,
11
+ * } from '@delmaredigital/payload-puck/email/components'
12
+ * ```
13
+ */
14
+ export { EmailWrapperEditorConfig } from './EmailWrapper/EmailWrapper.editor.js';
15
+ export { EmailSectionEditorConfig } from './EmailSection/EmailSection.editor.js';
16
+ export { EmailColumnsEditorConfig } from './EmailColumns/EmailColumns.editor.js';
17
+ export { EmailTextEditorConfig } from './EmailText/EmailText.editor.js';
18
+ export { EmailHeadingEditorConfig } from './EmailHeading/EmailHeading.editor.js';
19
+ export { EmailImageEditorConfig } from './EmailImage/EmailImage.editor.js';
20
+ export { EmailButtonEditorConfig } from './EmailButton/EmailButton.editor.js';
21
+ export { EmailSpacerEditorConfig } from './EmailSpacer/EmailSpacer.editor.js';
22
+ export { EmailDividerEditorConfig } from './EmailDivider/EmailDivider.editor.js';
23
+ export { EmailHeaderEditorConfig } from './EmailHeader/EmailHeader.editor.js';
24
+ export { EmailFooterEditorConfig } from './EmailFooter/EmailFooter.editor.js';
25
+ export { EmailSocialEditorConfig } from './EmailSocial/EmailSocial.editor.js';
26
+ export { EmailWrapperConfig } from './EmailWrapper/EmailWrapper.server.js';
27
+ export { EmailSectionConfig } from './EmailSection/EmailSection.server.js';
28
+ export { EmailColumnsConfig } from './EmailColumns/EmailColumns.server.js';
29
+ export { EmailTextConfig } from './EmailText/EmailText.server.js';
30
+ export { EmailHeadingConfig } from './EmailHeading/EmailHeading.server.js';
31
+ export { EmailImageConfig } from './EmailImage/EmailImage.server.js';
32
+ export { EmailButtonConfig } from './EmailButton/EmailButton.server.js';
33
+ export { EmailSpacerConfig } from './EmailSpacer/EmailSpacer.server.js';
34
+ export { EmailDividerConfig } from './EmailDivider/EmailDivider.server.js';
35
+ export { EmailHeaderConfig } from './EmailHeader/EmailHeader.server.js';
36
+ export { EmailFooterConfig } from './EmailFooter/EmailFooter.server.js';
37
+ export { EmailSocialConfig } from './EmailSocial/EmailSocial.server.js';
38
+ export type { EmailWrapperProps } from './EmailWrapper/EmailWrapper.types.js';
39
+ export type { EmailSectionProps } from './EmailSection/EmailSection.types.js';
40
+ export type { EmailColumnsProps } from './EmailColumns/EmailColumns.types.js';
41
+ export type { EmailTextProps } from './EmailText/EmailText.types.js';
42
+ export type { EmailHeadingProps } from './EmailHeading/EmailHeading.types.js';
43
+ export type { EmailImageProps } from './EmailImage/EmailImage.types.js';
44
+ export type { EmailButtonProps } from './EmailButton/EmailButton.types.js';
45
+ export type { EmailSpacerProps } from './EmailSpacer/EmailSpacer.types.js';
46
+ export type { EmailDividerProps } from './EmailDivider/EmailDivider.types.js';
47
+ export type { EmailHeaderProps } from './EmailHeader/EmailHeader.types.js';
48
+ export type { EmailFooterProps } from './EmailFooter/EmailFooter.types.js';
49
+ export type { EmailSocialProps, SocialPlatform, SocialLink } from './EmailSocial/EmailSocial.types.js';
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Individual email component config exports
3
+ *
4
+ * Cherry-pick email components for custom configs.
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * import {
9
+ * EmailSectionEditorConfig,
10
+ * EmailTextEditorConfig,
11
+ * } from '@delmaredigital/payload-puck/email/components'
12
+ * ```
13
+ */ // =============================================================================
14
+ // Editor Component Configs (for Puck Editor)
15
+ // =============================================================================
16
+ // Layout
17
+ export { EmailWrapperEditorConfig } from './EmailWrapper/EmailWrapper.editor.js';
18
+ export { EmailSectionEditorConfig } from './EmailSection/EmailSection.editor.js';
19
+ export { EmailColumnsEditorConfig } from './EmailColumns/EmailColumns.editor.js';
20
+ // Content
21
+ export { EmailTextEditorConfig } from './EmailText/EmailText.editor.js';
22
+ export { EmailHeadingEditorConfig } from './EmailHeading/EmailHeading.editor.js';
23
+ export { EmailImageEditorConfig } from './EmailImage/EmailImage.editor.js';
24
+ export { EmailButtonEditorConfig } from './EmailButton/EmailButton.editor.js';
25
+ // Utility
26
+ export { EmailSpacerEditorConfig } from './EmailSpacer/EmailSpacer.editor.js';
27
+ export { EmailDividerEditorConfig } from './EmailDivider/EmailDivider.editor.js';
28
+ // Prebuilt
29
+ export { EmailHeaderEditorConfig } from './EmailHeader/EmailHeader.editor.js';
30
+ export { EmailFooterEditorConfig } from './EmailFooter/EmailFooter.editor.js';
31
+ export { EmailSocialEditorConfig } from './EmailSocial/EmailSocial.editor.js';
32
+ // =============================================================================
33
+ // Server Component Configs (for EmailRenderer / renderToEmailHtml)
34
+ // =============================================================================
35
+ // Layout
36
+ export { EmailWrapperConfig } from './EmailWrapper/EmailWrapper.server.js';
37
+ export { EmailSectionConfig } from './EmailSection/EmailSection.server.js';
38
+ export { EmailColumnsConfig } from './EmailColumns/EmailColumns.server.js';
39
+ // Content
40
+ export { EmailTextConfig } from './EmailText/EmailText.server.js';
41
+ export { EmailHeadingConfig } from './EmailHeading/EmailHeading.server.js';
42
+ export { EmailImageConfig } from './EmailImage/EmailImage.server.js';
43
+ export { EmailButtonConfig } from './EmailButton/EmailButton.server.js';
44
+ // Utility
45
+ export { EmailSpacerConfig } from './EmailSpacer/EmailSpacer.server.js';
46
+ export { EmailDividerConfig } from './EmailDivider/EmailDivider.server.js';
47
+ // Prebuilt
48
+ export { EmailHeaderConfig } from './EmailHeader/EmailHeader.server.js';
49
+ export { EmailFooterConfig } from './EmailFooter/EmailFooter.server.js';
50
+ export { EmailSocialConfig } from './EmailSocial/EmailSocial.server.js';
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Shared email rendering utilities
3
+ *
4
+ * Helpers for building email-safe HTML with table-based layouts.
5
+ * All email components use these to ensure consistent rendering.
6
+ */
7
+ import type React from 'react';
8
+ /** Standard table attributes for email-safe presentation tables */
9
+ export declare const TABLE_ATTRS: {
10
+ readonly role: "presentation";
11
+ readonly cellPadding: "0";
12
+ readonly cellSpacing: "0";
13
+ readonly border: 0;
14
+ };
15
+ /** Full-width table style (100% width, no borders) */
16
+ export declare const FULL_WIDTH_TABLE_STYLE: React.CSSProperties;
17
+ /** Centered content table (max-width with auto margins) */
18
+ export declare function centeredTableStyle(maxWidth: number): React.CSSProperties;
19
+ type EmailAlignment = 'left' | 'center' | 'right';
20
+ /** Maps alignment to table `align` attribute value */
21
+ export declare function emailAlign(alignment: EmailAlignment | null | undefined): 'left' | 'center' | 'right';
22
+ /** Maps alignment to margin style for block centering */
23
+ export declare function alignmentToMargin(alignment: EmailAlignment | null | undefined): React.CSSProperties;
24
+ export declare const WEB_SAFE_FONTS: readonly [{
25
+ readonly label: "Arial";
26
+ readonly value: "Arial, Helvetica, sans-serif";
27
+ }, {
28
+ readonly label: "Helvetica";
29
+ readonly value: "Helvetica, Arial, sans-serif";
30
+ }, {
31
+ readonly label: "Georgia";
32
+ readonly value: "Georgia, Times, serif";
33
+ }, {
34
+ readonly label: "Times New Roman";
35
+ readonly value: "'Times New Roman', Times, serif";
36
+ }, {
37
+ readonly label: "Courier New";
38
+ readonly value: "'Courier New', Courier, monospace";
39
+ }, {
40
+ readonly label: "Verdana";
41
+ readonly value: "Verdana, Geneva, sans-serif";
42
+ }, {
43
+ readonly label: "Tahoma";
44
+ readonly value: "Tahoma, Geneva, sans-serif";
45
+ }, {
46
+ readonly label: "Trebuchet MS";
47
+ readonly value: "'Trebuchet MS', Helvetica, sans-serif";
48
+ }];
49
+ export type WebSafeFont = (typeof WEB_SAFE_FONTS)[number]['value'];
50
+ /**
51
+ * Converts TipTap-generated HTML to email-safe inline-styled HTML.
52
+ *
53
+ * TipTap outputs semantic HTML with classes. Email clients need:
54
+ * - Inline styles instead of classes
55
+ * - No CSS that email clients strip (position, display:flex, etc.)
56
+ * - Block elements with explicit margins
57
+ */
58
+ export declare function tiptapHtmlToEmailHtml(html: string, options?: {
59
+ fontSize?: string;
60
+ color?: string;
61
+ lineHeight?: string;
62
+ fontFamily?: string;
63
+ }): string;
64
+ /**
65
+ * Generates VML markup for background images in Outlook.
66
+ * Wrap around your content in a conditional comment.
67
+ */
68
+ export declare function vmlBackgroundOpen(options: {
69
+ width: number;
70
+ height?: number;
71
+ src: string;
72
+ }): string;
73
+ export declare function vmlBackgroundClose(): string;
74
+ export {};
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Shared email rendering utilities
3
+ *
4
+ * Helpers for building email-safe HTML with table-based layouts.
5
+ * All email components use these to ensure consistent rendering.
6
+ */ // =============================================================================
7
+ // Table Helper Props
8
+ // =============================================================================
9
+ /** Standard table attributes for email-safe presentation tables */ export const TABLE_ATTRS = {
10
+ role: 'presentation',
11
+ cellPadding: '0',
12
+ cellSpacing: '0',
13
+ border: 0
14
+ };
15
+ /** Full-width table style (100% width, no borders) */ export const FULL_WIDTH_TABLE_STYLE = {
16
+ width: '100%',
17
+ borderCollapse: 'collapse',
18
+ borderSpacing: 0
19
+ };
20
+ /** Centered content table (max-width with auto margins) */ export function centeredTableStyle(maxWidth) {
21
+ return {
22
+ width: '100%',
23
+ maxWidth: `${maxWidth}px`,
24
+ margin: '0 auto',
25
+ borderCollapse: 'collapse',
26
+ borderSpacing: 0
27
+ };
28
+ }
29
+ /** Maps alignment to table `align` attribute value */ export function emailAlign(alignment) {
30
+ return alignment ?? 'left';
31
+ }
32
+ /** Maps alignment to margin style for block centering */ export function alignmentToMargin(alignment) {
33
+ switch(alignment){
34
+ case 'center':
35
+ return {
36
+ marginLeft: 'auto',
37
+ marginRight: 'auto'
38
+ };
39
+ case 'right':
40
+ return {
41
+ marginLeft: 'auto',
42
+ marginRight: 0
43
+ };
44
+ default:
45
+ return {
46
+ marginLeft: 0,
47
+ marginRight: 'auto'
48
+ };
49
+ }
50
+ }
51
+ // =============================================================================
52
+ // Font Stacks (web-safe only)
53
+ // =============================================================================
54
+ export const WEB_SAFE_FONTS = [
55
+ {
56
+ label: 'Arial',
57
+ value: 'Arial, Helvetica, sans-serif'
58
+ },
59
+ {
60
+ label: 'Helvetica',
61
+ value: 'Helvetica, Arial, sans-serif'
62
+ },
63
+ {
64
+ label: 'Georgia',
65
+ value: 'Georgia, Times, serif'
66
+ },
67
+ {
68
+ label: 'Times New Roman',
69
+ value: "'Times New Roman', Times, serif"
70
+ },
71
+ {
72
+ label: 'Courier New',
73
+ value: "'Courier New', Courier, monospace"
74
+ },
75
+ {
76
+ label: 'Verdana',
77
+ value: 'Verdana, Geneva, sans-serif'
78
+ },
79
+ {
80
+ label: 'Tahoma',
81
+ value: 'Tahoma, Geneva, sans-serif'
82
+ },
83
+ {
84
+ label: 'Trebuchet MS',
85
+ value: "'Trebuchet MS', Helvetica, sans-serif"
86
+ }
87
+ ];
88
+ // =============================================================================
89
+ // TipTap HTML to Email-Safe HTML
90
+ // =============================================================================
91
+ /**
92
+ * Converts TipTap-generated HTML to email-safe inline-styled HTML.
93
+ *
94
+ * TipTap outputs semantic HTML with classes. Email clients need:
95
+ * - Inline styles instead of classes
96
+ * - No CSS that email clients strip (position, display:flex, etc.)
97
+ * - Block elements with explicit margins
98
+ */ export function tiptapHtmlToEmailHtml(html, options) {
99
+ if (!html) return '';
100
+ const baseStyle = [
101
+ options?.fontSize ? `font-size:${options.fontSize}` : 'font-size:16px',
102
+ options?.color ? `color:${options.color}` : 'color:#333333',
103
+ options?.lineHeight ? `line-height:${options.lineHeight}` : 'line-height:1.5',
104
+ options?.fontFamily ? `font-family:${options.fontFamily}` : '',
105
+ 'margin:0',
106
+ 'padding:0'
107
+ ].filter(Boolean).join(';');
108
+ // First strip existing style and class attributes (TipTap may add them)
109
+ // so we don't end up with duplicate attributes
110
+ const cleaned = html.replace(/\s+style="[^"]*"/g, '').replace(/\s+class="[^"]*"/g, '');
111
+ const result = cleaned// Paragraphs
112
+ .replace(/<p>/g, `<p style="${baseStyle};margin-bottom:1em">`).replace(/<p\s/g, `<p style="${baseStyle};margin-bottom:1em" `)// Headings
113
+ .replace(/<h1>/g, `<h1 style="${baseStyle};font-size:32px;font-weight:bold;margin-bottom:0.5em">`).replace(/<h2>/g, `<h2 style="${baseStyle};font-size:24px;font-weight:bold;margin-bottom:0.5em">`).replace(/<h3>/g, `<h3 style="${baseStyle};font-size:20px;font-weight:bold;margin-bottom:0.5em">`)// Lists
114
+ .replace(/<ul>/g, `<ul style="margin:0 0 1em 0;padding-left:20px;${baseStyle}">`).replace(/<ol>/g, `<ol style="margin:0 0 1em 0;padding-left:20px;${baseStyle}">`).replace(/<li>/g, '<li style="margin-bottom:0.25em">')// Links
115
+ .replace(/<a /g, '<a style="color:#007bff;text-decoration:underline" ')// Blockquotes
116
+ .replace(/<blockquote>/g, `<blockquote style="margin:0 0 1em 0;padding:10px 20px;border-left:4px solid #dddddd;${baseStyle}">`);
117
+ return result;
118
+ }
119
+ // =============================================================================
120
+ // VML Background Image (Outlook)
121
+ // =============================================================================
122
+ /**
123
+ * Generates VML markup for background images in Outlook.
124
+ * Wrap around your content in a conditional comment.
125
+ */ export function vmlBackgroundOpen(options) {
126
+ return `<!--[if gte mso 9]>
127
+ <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:${options.width}px${options.height ? `;height:${options.height}px` : ''}">
128
+ <v:fill type="frame" src="${options.src}" />
129
+ <v:textbox inset="0,0,0,0">
130
+ <![endif]-->`;
131
+ }
132
+ export function vmlBackgroundClose() {
133
+ return `<!--[if gte mso 9]>
134
+ </v:textbox>
135
+ </v:rect>
136
+ <![endif]-->`;
137
+ }
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Email Puck configuration - Server-safe
3
+ *
4
+ * All components render to table-based, inline-styled HTML
5
+ * compatible with email clients. No Tailwind, no CSS classes.
6
+ *
7
+ * Use with EmailRenderer or renderToEmailHtml().
8
+ */
9
+ import type { ComponentConfig } from '@puckeditor/core';
10
+ import type { ReactNode } from 'react';
11
+ export declare const emailBaseConfig: {
12
+ root: {
13
+ fields: {
14
+ subject: {
15
+ type: "text";
16
+ label: string;
17
+ };
18
+ previewText: {
19
+ type: "textarea";
20
+ label: string;
21
+ };
22
+ maxWidth: {
23
+ type: "number";
24
+ label: string;
25
+ };
26
+ };
27
+ defaultProps: {
28
+ subject: string;
29
+ previewText: string;
30
+ backgroundColor: string;
31
+ fontFamily: string;
32
+ maxWidth: number;
33
+ };
34
+ render: ({ children }: {
35
+ children: ReactNode;
36
+ }) => import("react").JSX.Element;
37
+ };
38
+ categories: {
39
+ layout: {
40
+ title: string;
41
+ components: string[];
42
+ defaultExpanded: true;
43
+ };
44
+ content: {
45
+ title: string;
46
+ components: string[];
47
+ };
48
+ utility: {
49
+ title: string;
50
+ components: string[];
51
+ };
52
+ prebuilt: {
53
+ title: string;
54
+ components: string[];
55
+ };
56
+ };
57
+ components: {
58
+ EmailWrapper: ComponentConfig<any>;
59
+ EmailSection: ComponentConfig<any>;
60
+ EmailColumns: ComponentConfig<any>;
61
+ EmailText: ComponentConfig<any>;
62
+ EmailHeading: ComponentConfig<any>;
63
+ EmailImage: ComponentConfig<any>;
64
+ EmailButton: ComponentConfig<any>;
65
+ EmailSpacer: ComponentConfig<any>;
66
+ EmailDivider: ComponentConfig<any>;
67
+ EmailHeader: ComponentConfig<any>;
68
+ EmailFooter: ComponentConfig<any>;
69
+ EmailSocial: ComponentConfig<any>;
70
+ };
71
+ };