@pagenflow/email 1.3.6 → 1.4.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/dist/components/Button.d.ts +15 -2
- package/dist/components/Divider.d.ts +1 -0
- package/dist/components/Font.d.ts +30 -0
- package/dist/components/Head.d.ts +16 -1
- package/dist/components/HeadDev.d.ts +9 -1
- package/dist/components/Heading.d.ts +6 -0
- package/dist/components/Icon.d.ts +3 -0
- package/dist/components/Image.d.ts +21 -9
- package/dist/components/MsoConditional.d.ts +29 -0
- package/dist/components/Row.d.ts +4 -1
- package/dist/components/Spacer.d.ts +1 -0
- package/dist/components/Text.d.ts +4 -0
- package/dist/index.cjs.js +755 -314
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +14 -11
- package/dist/index.esm.js +753 -315
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { BorderConfig } from "../types";
|
|
2
3
|
export interface ButtonConfig {
|
|
3
4
|
/** The destination URL for the button. Required. */
|
|
4
5
|
href: string;
|
|
@@ -12,8 +13,12 @@ export interface ButtonConfig {
|
|
|
12
13
|
padding?: string;
|
|
13
14
|
/** Border radius (e.g., "3px"). */
|
|
14
15
|
borderRadius?: string;
|
|
16
|
+
/** Border configuration for outline buttons. */
|
|
17
|
+
border?: BorderConfig;
|
|
15
18
|
/** Width of the button (e.g., "200px" or "100%"). */
|
|
16
19
|
width?: string;
|
|
20
|
+
/** Maximum width of the button (e.g., "300px"). Text will wrap if content exceeds this. */
|
|
21
|
+
maxWidth?: string;
|
|
17
22
|
/** Horizontal alignment within the container. */
|
|
18
23
|
justifyContent?: "start" | "center" | "end";
|
|
19
24
|
/** Horizontal text alignment within the button (e.g., 'left', 'center'). */
|
|
@@ -24,6 +29,8 @@ export interface ButtonConfig {
|
|
|
24
29
|
fontWeight?: string;
|
|
25
30
|
/** Font style (e.g., 'italic'). */
|
|
26
31
|
fontStyle?: string;
|
|
32
|
+
/** Font family (e.g., 'Arial, sans-serif'). */
|
|
33
|
+
fontFamily?: string;
|
|
27
34
|
/** Line height (e.g., '1.5' or '24px'). */
|
|
28
35
|
lineHeight?: string;
|
|
29
36
|
/** Letter spacing (e.g., '0.5px', '1px'). */
|
|
@@ -32,10 +39,16 @@ export interface ButtonConfig {
|
|
|
32
39
|
textTransform?: string;
|
|
33
40
|
/** Text decoration (e.g., 'underline', 'line-through'). */
|
|
34
41
|
textDecoration?: string;
|
|
35
|
-
/**
|
|
36
|
-
|
|
42
|
+
/** Text direction (e.g., 'ltr', 'rtl'). */
|
|
43
|
+
direction?: string;
|
|
44
|
+
/** Vertical alignment of text (e.g., 'sub', 'super'). */
|
|
45
|
+
verticalAlign?: string;
|
|
46
|
+
/** Opacity of the button text (e.g., '0.5', '1'). */
|
|
47
|
+
opacity?: string | number;
|
|
37
48
|
/** White space behavior (e.g., 'normal', 'nowrap', 'pre-wrap'). */
|
|
38
49
|
whiteSpace?: string;
|
|
50
|
+
/** Word break behavior (e.g., 'break-all', 'break-word', 'keep-all', 'normal'). */
|
|
51
|
+
wordBreak?: string;
|
|
39
52
|
}
|
|
40
53
|
export type ButtonProps = {
|
|
41
54
|
config: ButtonConfig;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type FontFormat = "woff2" | "woff" | "truetype" | "opentype" | "svg" | "embedded-opentype";
|
|
2
|
+
export interface WebFont {
|
|
3
|
+
/** Direct URL to the font file (woff2, woff, ttf, etc.) */
|
|
4
|
+
url: string;
|
|
5
|
+
/** Font format hint used in the CSS src descriptor */
|
|
6
|
+
format: FontFormat;
|
|
7
|
+
}
|
|
8
|
+
export interface FontProps {
|
|
9
|
+
/** The CSS font-family name, e.g. "Roboto" */
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
/**
|
|
12
|
+
* Fallback font family used:
|
|
13
|
+
* 1. In the MSO (Outlook) conditional comment so Outlook renders the
|
|
14
|
+
* closest web-safe equivalent.
|
|
15
|
+
* 2. As the CSS font-stack fallback after the web font.
|
|
16
|
+
* Accepts a single string or an array for a prioritised fallback chain.
|
|
17
|
+
*/
|
|
18
|
+
fallbackFontFamily?: string | string[];
|
|
19
|
+
/**
|
|
20
|
+
* Web font to load. When omitted the component only emits the MSO fallback
|
|
21
|
+
* comment (useful for system fonts you still want to declare explicitly).
|
|
22
|
+
*/
|
|
23
|
+
webFont?: WebFont;
|
|
24
|
+
/** CSS font-weight — numeric (400) or keyword ("bold"). Default: 400 */
|
|
25
|
+
fontWeight?: number | string;
|
|
26
|
+
/** CSS font-style. Default: "normal" */
|
|
27
|
+
fontStyle?: "normal" | "italic" | "oblique";
|
|
28
|
+
}
|
|
29
|
+
export default function Font({ fontFamily, fallbackFontFamily, webFont, fontWeight, fontStyle, }: FontProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export declare function cssClassName(fontFamily: string): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import type { ResolvedFont } from "@/lib/email-fonts/loadEmailFonts";
|
|
2
3
|
export interface HeadProps {
|
|
3
4
|
/** Additional elements like custom <style> blocks, <title>, etc. */
|
|
4
5
|
children?: ReactNode;
|
|
@@ -6,5 +7,19 @@ export interface HeadProps {
|
|
|
6
7
|
backgroundColor?: string;
|
|
7
8
|
/** Subject line for the email title. */
|
|
8
9
|
title?: string;
|
|
10
|
+
/** Array of gap values (e.g. ["8px", "12px", "48px"]) to generate mobile wrap margin-bottom rules */
|
|
11
|
+
rowGaps?: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Resolved fonts from `loadEmailFonts()`.
|
|
14
|
+
* Head will render a <Font> for every variant of every family.
|
|
15
|
+
* This is the preferred API when using the builder pipeline.
|
|
16
|
+
*
|
|
17
|
+
* Example:
|
|
18
|
+
* const { resolved } = await loadEmailFonts(
|
|
19
|
+
* extractFontFamilies(tree)
|
|
20
|
+
* );
|
|
21
|
+
* <Head fonts={resolved} ... />
|
|
22
|
+
*/
|
|
23
|
+
fonts?: ResolvedFont[];
|
|
9
24
|
}
|
|
10
|
-
export default function Head({ children, backgroundColor, title, }: HeadProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export default function Head({ children, backgroundColor, title, rowGaps, fonts, }: HeadProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ResolvedFont } from "@/lib/email-fonts/loadEmailFonts";
|
|
1
2
|
import { ReactNode } from "react";
|
|
2
3
|
export interface HeadDevProps {
|
|
3
4
|
/** Additional elements like custom <style> blocks, <title>, etc. */
|
|
@@ -6,9 +7,16 @@ export interface HeadDevProps {
|
|
|
6
7
|
backgroundColor?: string;
|
|
7
8
|
/** Subject line for the email title. */
|
|
8
9
|
title?: string;
|
|
10
|
+
/** Array of gap values (e.g. ["8px", "12px", "48px"]) to generate mobile wrap margin-bottom rules */
|
|
11
|
+
rowGaps?: string[];
|
|
12
|
+
fonts?: ResolvedFont[];
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* Dev variant of Head component for use in builder canvas.
|
|
12
16
|
* Injects styles directly into document head to maintain email behavior during development.
|
|
17
|
+
*
|
|
18
|
+
* All styles — including @font-face declarations — are injected imperatively into
|
|
19
|
+
* document.head via useEffect. This guarantees correct placement (always in <head>,
|
|
20
|
+
* never in <body>) and correct declaration order (fonts before selectors).
|
|
13
21
|
*/
|
|
14
|
-
export default function HeadDev({ children, backgroundColor, title, }: HeadDevProps):
|
|
22
|
+
export default function HeadDev({ children, backgroundColor, title, rowGaps, fonts, }: HeadDevProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +11,8 @@ export interface HeadingConfig {
|
|
|
11
11
|
color?: string;
|
|
12
12
|
/** Horizontal text alignment. */
|
|
13
13
|
textAlign?: "left" | "center" | "right" | "justify";
|
|
14
|
+
/** Font family (e.g., 'Arial, sans-serif'). */
|
|
15
|
+
fontFamily?: string;
|
|
14
16
|
/** Font size (e.g., '24px'). Overrides default size for the level. */
|
|
15
17
|
fontSize?: string;
|
|
16
18
|
/** Font weight (e.g., 'normal', 'bold', or '700'). */
|
|
@@ -31,6 +33,10 @@ export interface HeadingConfig {
|
|
|
31
33
|
verticalAlign?: string;
|
|
32
34
|
/** Background color of the heading block. */
|
|
33
35
|
backgroundColor?: string;
|
|
36
|
+
/** Word break behavior (e.g., 'break-all', 'break-word', 'keep-all', 'normal'). */
|
|
37
|
+
wordBreak?: string;
|
|
38
|
+
/** White space handling (e.g., 'nowrap', 'pre', 'pre-wrap', 'pre-line', 'normal'). */
|
|
39
|
+
whiteSpace?: string;
|
|
34
40
|
}
|
|
35
41
|
export type HeadingProps = {
|
|
36
42
|
config: HeadingConfig;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import IInnerLink from "../types/IInnerLink";
|
|
3
|
+
import { BorderConfig } from "../types";
|
|
3
4
|
export interface IconConfig {
|
|
4
5
|
/** Icon identifier for the Iconify API */
|
|
5
6
|
iconIdentifier?: string;
|
|
@@ -21,6 +22,8 @@ export interface IconConfig {
|
|
|
21
22
|
padding?: string;
|
|
22
23
|
/** Border radius for the icon container */
|
|
23
24
|
borderRadius?: string;
|
|
25
|
+
/** Border configuration for the icon container */
|
|
26
|
+
border?: BorderConfig;
|
|
24
27
|
/** Horizontal alignment within the container */
|
|
25
28
|
justifyContent?: "start" | "center" | "end";
|
|
26
29
|
}
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { BorderConfig } from "../types";
|
|
3
|
+
/** Style-only mobile overrides. Content props (src, alt, href, target) are excluded. */
|
|
4
|
+
export interface ImageMobileConfig {
|
|
5
|
+
width?: string;
|
|
6
|
+
height?: string;
|
|
7
|
+
maxWidth?: string;
|
|
8
|
+
maxHeight?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
padding?: string;
|
|
11
|
+
borderRadius?: string;
|
|
12
|
+
border?: BorderConfig;
|
|
13
|
+
/** When true, the mobile version of the image is not rendered at all. */
|
|
14
|
+
hidden?: boolean;
|
|
15
|
+
}
|
|
2
16
|
export interface ImageConfig {
|
|
3
|
-
/** The source URL of the image. Required. */
|
|
4
17
|
src: string;
|
|
5
|
-
/** Alt text for accessibility. Required. */
|
|
6
18
|
alt: string;
|
|
7
|
-
/** Width of the image. Can be fixed (e.g., "600px") or percentage (e.g., "100%"). */
|
|
8
19
|
width?: string;
|
|
9
|
-
/** Height of the image. Optional, usually auto-calculated if width is set. */
|
|
10
20
|
height?: string;
|
|
11
21
|
maxWidth?: string;
|
|
12
22
|
maxHeight?: string;
|
|
13
|
-
/** Background color of the containing TD/parent element if the image has transparency. */
|
|
14
23
|
backgroundColor?: string;
|
|
15
|
-
/** Padding around the image (applied to the containing TD). */
|
|
16
24
|
padding?: string;
|
|
17
|
-
/** Border radius for the image (CSS only, limited compatibility). */
|
|
18
25
|
borderRadius?: string;
|
|
19
|
-
|
|
26
|
+
border?: BorderConfig;
|
|
20
27
|
href?: string;
|
|
21
|
-
/** Link target attribute (e.g., "_blank" for new window) */
|
|
22
28
|
target?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Mobile-specific style overrides.
|
|
31
|
+
* Only explicitly set properties override the desktop value on mobile.
|
|
32
|
+
* Unset properties fall back to the desktop value.
|
|
33
|
+
*/
|
|
34
|
+
mobile?: ImageMobileConfig;
|
|
23
35
|
}
|
|
24
36
|
export type ImageProps = {
|
|
25
37
|
config: ImageConfig;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MSO conditional comment helpers.
|
|
3
|
+
*
|
|
4
|
+
* Follows the same pattern as Icon.tsx: raw HTML is injected via
|
|
5
|
+
* dangerouslySetInnerHTML on a <td>, which is the only way to emit
|
|
6
|
+
* unescaped conditional comment strings without a post-processing step.
|
|
7
|
+
*
|
|
8
|
+
* Accepts an HTML string (not ReactNode) — the caller is responsible
|
|
9
|
+
* for building the inner HTML, exactly like Icon does with vmlIcon/htmlContent.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
*
|
|
13
|
+
* <MsoOnly html={`<img src="..." />`} />
|
|
14
|
+
* <NonMso html={`<table>...</table>`} />
|
|
15
|
+
*/
|
|
16
|
+
type Props = {
|
|
17
|
+
html: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Content rendered by Outlook Classic only.
|
|
21
|
+
* Outputs: <!--[if mso]> ... <![endif]-->
|
|
22
|
+
*/
|
|
23
|
+
export declare function MsoOnly({ html }: Props): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Content hidden from Outlook Classic, visible in all other clients.
|
|
26
|
+
* Outputs: <!--[if !mso]><!--> ... <!--<![endif]-->
|
|
27
|
+
*/
|
|
28
|
+
export declare function NonMso({ html }: Props): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
package/dist/components/Row.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { AlignItems, BorderConfig, JustifyContent } from "../types";
|
|
3
|
+
import IInnerLink from "../types/IInnerLink";
|
|
3
4
|
export interface BackgroundImageType {
|
|
4
5
|
src: string;
|
|
5
6
|
repeat?: "no-repeat" | "repeat" | "repeat-x" | "repeat-y";
|
|
@@ -17,6 +18,7 @@ export interface RowConfig {
|
|
|
17
18
|
backgroundImage?: BackgroundImageType;
|
|
18
19
|
borderRadius?: string;
|
|
19
20
|
border?: BorderConfig;
|
|
21
|
+
innerLink?: IInnerLink;
|
|
20
22
|
mobile?: {
|
|
21
23
|
justifyContent?: JustifyContent;
|
|
22
24
|
alignItems?: AlignItems;
|
|
@@ -27,7 +29,8 @@ export type RowProps = {
|
|
|
27
29
|
children: ReactNode;
|
|
28
30
|
config: RowConfig;
|
|
29
31
|
devNode?: ReactNode;
|
|
32
|
+
devMode?: boolean;
|
|
30
33
|
};
|
|
31
|
-
declare function Row({ children, config, devNode }: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
declare function Row({ children, config, devNode, devMode }: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
32
35
|
declare const _default: import("react").MemoExoticComponent<typeof Row>;
|
|
33
36
|
export default _default;
|
|
@@ -8,6 +8,8 @@ export interface TextConfig {
|
|
|
8
8
|
color?: string;
|
|
9
9
|
/** Horizontal text alignment (e.g., 'left', 'center'). */
|
|
10
10
|
textAlign?: "left" | "center" | "right" | "justify";
|
|
11
|
+
/** Font family (e.g., 'Arial, sans-serif'). */
|
|
12
|
+
fontFamily?: string;
|
|
11
13
|
/** Font size (e.g., '16px'). */
|
|
12
14
|
fontSize?: string;
|
|
13
15
|
/** Font weight (e.g., 'bold' or '700'). */
|
|
@@ -32,6 +34,8 @@ export interface TextConfig {
|
|
|
32
34
|
opacity?: string | number;
|
|
33
35
|
/** White space handling (e.g., 'normal', 'nowrap', 'pre', 'pre-wrap'). */
|
|
34
36
|
whiteSpace?: string;
|
|
37
|
+
/** Word break behavior (e.g., 'break-all', 'break-word', 'keep-all', 'normal'). */
|
|
38
|
+
wordBreak?: string;
|
|
35
39
|
}
|
|
36
40
|
export type TextProps = {
|
|
37
41
|
config: TextConfig;
|