@pagenflow/email 1.4.6 → 1.4.8
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 +3 -1
- package/dist/components/Column.d.ts +4 -1
- package/dist/components/Container.d.ts +4 -2
- package/dist/components/Divider.d.ts +3 -1
- package/dist/components/Heading.d.ts +6 -1
- package/dist/components/Icon.d.ts +4 -2
- package/dist/components/Image.d.ts +25 -2
- package/dist/components/Row.d.ts +20 -1
- package/dist/components/Section.d.ts +2 -0
- package/dist/components/Spacer.d.ts +6 -1
- package/dist/components/Text.d.ts +13 -1
- package/dist/components/utils/bindingAttribute.d.ts +38 -0
- package/dist/components/utils/linearizeStyle.d.ts +10 -0
- package/dist/index.cjs.js +368 -138
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +368 -138
- package/dist/index.esm.js.map +1 -1
- package/dist/types/DataBindings.d.ts +87 -0
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { BorderConfig } from "../types";
|
|
3
3
|
import IInnerLink from "../types/IInnerLink";
|
|
4
|
+
import { DataBindings } from "../types/DataBindings";
|
|
4
5
|
export interface ButtonConfig {
|
|
5
6
|
/** Link configuration for the button destination. Required. */
|
|
6
7
|
innerLink?: IInnerLink;
|
|
@@ -58,7 +59,8 @@ export interface ButtonConfig {
|
|
|
58
59
|
export type ButtonProps = {
|
|
59
60
|
config: ButtonConfig;
|
|
60
61
|
devMode?: boolean;
|
|
62
|
+
bindings?: DataBindings;
|
|
61
63
|
};
|
|
62
|
-
declare function Button({ config, devMode }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
declare function Button({ config, devMode, bindings }: ButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
63
65
|
declare const _default: import("react").MemoExoticComponent<typeof Button>;
|
|
64
66
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { BorderConfig } from "../types";
|
|
3
|
+
import { DataBindings } from "../types/DataBindings";
|
|
3
4
|
export interface BackgroundImageType {
|
|
4
5
|
src: string;
|
|
5
6
|
repeat?: "no-repeat" | "repeat" | "repeat-x" | "repeat-y";
|
|
@@ -16,13 +17,15 @@ export type ColumnConfig = {
|
|
|
16
17
|
backgroundImage?: BackgroundImageType;
|
|
17
18
|
width?: string;
|
|
18
19
|
height?: string;
|
|
20
|
+
maxWidth?: string;
|
|
19
21
|
gap?: string;
|
|
20
22
|
};
|
|
21
23
|
export type ColumnProps = {
|
|
22
24
|
children?: ReactNode;
|
|
23
25
|
config: ColumnConfig;
|
|
24
26
|
devNode?: ReactNode;
|
|
27
|
+
bindings?: DataBindings;
|
|
25
28
|
};
|
|
26
|
-
declare function Column({ children, config, devNode }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
declare function Column({ children, config, devNode, bindings }: ColumnProps): import("react/jsx-runtime").JSX.Element;
|
|
27
30
|
declare const _default: import("react").MemoExoticComponent<typeof Column>;
|
|
28
31
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { BorderConfig } from "../types";
|
|
3
|
+
import { DataBindings } from "../types/DataBindings";
|
|
3
4
|
export type WidthType = "full" | "fixed";
|
|
4
5
|
export type WidthDistributionType = "equals" | "ratio" | "manual";
|
|
5
6
|
export interface RatioConstraint {
|
|
@@ -17,7 +18,7 @@ export type ChildrenConstraints = {
|
|
|
17
18
|
};
|
|
18
19
|
export interface ContainerConfig {
|
|
19
20
|
widthType: WidthType;
|
|
20
|
-
childrenConstraints
|
|
21
|
+
childrenConstraints?: ChildrenConstraints;
|
|
21
22
|
shouldWrap?: boolean;
|
|
22
23
|
borderRadius?: string;
|
|
23
24
|
border?: BorderConfig;
|
|
@@ -38,9 +39,10 @@ export interface ContainerConfig {
|
|
|
38
39
|
export type ContainerProps = {
|
|
39
40
|
config: ContainerConfig;
|
|
40
41
|
children?: ReactNode;
|
|
42
|
+
bindings?: DataBindings;
|
|
41
43
|
devMode?: boolean;
|
|
42
44
|
devNode?: ReactNode;
|
|
43
45
|
};
|
|
44
|
-
declare function Container({ children, config, devMode, devNode }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
declare function Container({ children, config, bindings, devMode, devNode, }: ContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
45
47
|
declare const _default: import("react").MemoExoticComponent<typeof Container>;
|
|
46
48
|
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { DataBindings } from "../types/DataBindings";
|
|
2
3
|
export interface DividerConfig {
|
|
3
4
|
height?: string;
|
|
4
5
|
color?: string;
|
|
@@ -10,7 +11,8 @@ export interface DividerConfig {
|
|
|
10
11
|
export type DividerProps = {
|
|
11
12
|
config: DividerConfig;
|
|
12
13
|
devNode?: ReactNode;
|
|
14
|
+
bindings?: DataBindings;
|
|
13
15
|
};
|
|
14
|
-
declare function Divider({ config, devNode }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function Divider({ config, devNode, bindings }: DividerProps): import("react/jsx-runtime").JSX.Element;
|
|
15
17
|
declare const _default: import("react").MemoExoticComponent<typeof Divider>;
|
|
16
18
|
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import IInnerLink from "../types/IInnerLink";
|
|
3
|
+
import { DataBindings } from "../types/DataBindings";
|
|
2
4
|
export type HeadingLevel = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";
|
|
3
5
|
export interface HeadingConfig {
|
|
4
6
|
/** The text content. */
|
|
@@ -37,12 +39,15 @@ export interface HeadingConfig {
|
|
|
37
39
|
wordBreak?: string;
|
|
38
40
|
/** White space handling (e.g., 'nowrap', 'pre', 'pre-wrap', 'pre-line', 'normal'). */
|
|
39
41
|
whiteSpace?: string;
|
|
42
|
+
/** Inner link configuration for making the entire heading block clickable */
|
|
43
|
+
innerLink?: IInnerLink;
|
|
40
44
|
}
|
|
41
45
|
export type HeadingProps = {
|
|
42
46
|
config: HeadingConfig;
|
|
43
47
|
devMode?: ReactNode;
|
|
44
48
|
children?: ReactNode;
|
|
49
|
+
bindings?: DataBindings;
|
|
45
50
|
};
|
|
46
|
-
declare function Heading({ config, devMode, children }: HeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
declare function Heading({ config, devMode, children, bindings }: HeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
47
52
|
declare const _default: import("react").MemoExoticComponent<typeof Heading>;
|
|
48
53
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import IInnerLink from "../types/IInnerLink";
|
|
3
2
|
import { BorderConfig } from "../types";
|
|
3
|
+
import IInnerLink from "../types/IInnerLink";
|
|
4
|
+
import { DataBindings } from "../types/DataBindings";
|
|
4
5
|
export interface IconConfig {
|
|
5
6
|
/** Icon identifier for the Iconify API */
|
|
6
7
|
iconIdentifier?: string;
|
|
@@ -32,7 +33,8 @@ export type IconProps = {
|
|
|
32
33
|
devNode?: ReactNode;
|
|
33
34
|
devMode?: boolean;
|
|
34
35
|
children?: ReactNode;
|
|
36
|
+
bindings?: DataBindings;
|
|
35
37
|
};
|
|
36
|
-
declare function Icon({ config, devNode, devMode, children }: IconProps): import("react/jsx-runtime").JSX.Element | null;
|
|
38
|
+
declare function Icon({ config, devNode, devMode, children, bindings }: IconProps): import("react/jsx-runtime").JSX.Element | null;
|
|
37
39
|
declare const _default: import("react").MemoExoticComponent<typeof Icon>;
|
|
38
40
|
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { BorderConfig } from "../types";
|
|
3
3
|
import IInnerLink from "../types/IInnerLink";
|
|
4
|
+
import { DataBindings } from "../types/DataBindings";
|
|
4
5
|
/**
|
|
5
6
|
* RULES NOT TO BE REMOVED
|
|
6
7
|
* -------------------
|
|
@@ -20,7 +21,7 @@ export interface ImageMobileConfig {
|
|
|
20
21
|
hidden?: boolean;
|
|
21
22
|
}
|
|
22
23
|
export interface ImageConfig {
|
|
23
|
-
src
|
|
24
|
+
src?: string;
|
|
24
25
|
alt: string;
|
|
25
26
|
width?: string;
|
|
26
27
|
height?: string;
|
|
@@ -42,13 +43,35 @@ export interface ImageConfig {
|
|
|
42
43
|
objectFit?: CSSProperties["objectFit"];
|
|
43
44
|
objectPosition?: string;
|
|
44
45
|
mobile?: ImageMobileConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Pixel width constraint for Outlook Classic only.
|
|
48
|
+
*
|
|
49
|
+
* Outlook Classic ignores CSS width/maxWidth on <img> and always renders
|
|
50
|
+
* images at their intrinsic size. The only reliable workaround is a wrapping
|
|
51
|
+
* <td> with a hard pixel `width` attribute, injected inside an MSO
|
|
52
|
+
* conditional comment so it is invisible to every other client.
|
|
53
|
+
*
|
|
54
|
+
* When set, the image is wrapped in:
|
|
55
|
+
* <!--[if mso]><table><tr><td width="${outlookWidth}"><![endif]-->
|
|
56
|
+
* <img ... />
|
|
57
|
+
* <!--[if mso]></td></tr></table><![endif]-->
|
|
58
|
+
*
|
|
59
|
+
* Modern clients (Gmail, Apple Mail, mobile) ignore MSO conditional comments
|
|
60
|
+
* entirely — they never see the wrapping <td> and continue to render the
|
|
61
|
+
* image using its CSS styles alone.
|
|
62
|
+
*
|
|
63
|
+
* Retrocompat: undefined by default. Existing templates that do not set this
|
|
64
|
+
* property are completely unaffected.
|
|
65
|
+
*/
|
|
66
|
+
outlookWidth?: string;
|
|
45
67
|
}
|
|
46
68
|
export type ImageProps = {
|
|
47
69
|
config: ImageConfig;
|
|
48
70
|
devNode?: ReactNode;
|
|
49
71
|
devMode?: boolean;
|
|
50
72
|
previewMode?: boolean;
|
|
73
|
+
bindings?: DataBindings;
|
|
51
74
|
};
|
|
52
|
-
declare function Image({ config, devNode, devMode }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
declare function Image({ config, devNode, devMode, bindings }: ImageProps): import("react/jsx-runtime").JSX.Element;
|
|
53
76
|
declare const _default: import("react").MemoExoticComponent<typeof Image>;
|
|
54
77
|
export default _default;
|
package/dist/components/Row.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { AlignItems, BorderConfig, JustifyContent } from "../types";
|
|
3
3
|
import IInnerLink from "../types/IInnerLink";
|
|
4
|
+
import { DataBindings } from "../types/DataBindings";
|
|
4
5
|
export interface BackgroundImageType {
|
|
5
6
|
src: string;
|
|
6
7
|
repeat?: "no-repeat" | "repeat" | "repeat-x" | "repeat-y";
|
|
@@ -23,6 +24,23 @@ export interface RowConfig {
|
|
|
23
24
|
* behavior. Use this for icon rows, button rows, social link rows.
|
|
24
25
|
*/
|
|
25
26
|
fillWidth?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Controls how child <td> widths are distributed across the row.
|
|
29
|
+
*
|
|
30
|
+
* - "equal" → each child gets `${100 / numChildren}%`; table-layout:fixed
|
|
31
|
+
* is applied so Outlook Classic honours the declaration.
|
|
32
|
+
* - string[] → explicit width per child (px, %, or mixed), e.g.
|
|
33
|
+
* ["200px","50%","1px"]. Length must match the number of
|
|
34
|
+
* children; table-layout:fixed is applied.
|
|
35
|
+
* - undefined → default / retrocompat: no width is set on child <td>s and
|
|
36
|
+
* table-layout remains unset, preserving the original
|
|
37
|
+
* shrink-wrap / fillWidth behaviour.
|
|
38
|
+
*
|
|
39
|
+
* Note: when mixing % and px the author is responsible for ensuring values
|
|
40
|
+
* do not overflow the row width — the same trade-off accepted by MJML and
|
|
41
|
+
* Foundation for Emails.
|
|
42
|
+
*/
|
|
43
|
+
layoutColumns?: "equal" | string[];
|
|
26
44
|
padding?: string;
|
|
27
45
|
backgroundColor?: string;
|
|
28
46
|
backgroundImage?: BackgroundImageType;
|
|
@@ -40,7 +58,8 @@ export type RowProps = {
|
|
|
40
58
|
config: RowConfig;
|
|
41
59
|
devNode?: ReactNode;
|
|
42
60
|
devMode?: boolean;
|
|
61
|
+
bindings?: DataBindings;
|
|
43
62
|
};
|
|
44
|
-
declare function Row({ children, config, devNode, devMode }: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
63
|
+
declare function Row({ children, config, devNode, devMode, bindings }: RowProps): import("react/jsx-runtime").JSX.Element;
|
|
45
64
|
declare const _default: import("react").MemoExoticComponent<typeof Row>;
|
|
46
65
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { BorderConfig } from "../types";
|
|
3
|
+
import { DataBindings } from "../types/DataBindings";
|
|
3
4
|
export type SectionConfig = {
|
|
4
5
|
sectionType: "header" | "footer" | "content";
|
|
5
6
|
gap?: string;
|
|
@@ -17,6 +18,7 @@ export interface SectionProps {
|
|
|
17
18
|
config: SectionConfig;
|
|
18
19
|
children?: ReactNode;
|
|
19
20
|
devNode?: ReactNode;
|
|
21
|
+
bindings?: DataBindings;
|
|
20
22
|
}
|
|
21
23
|
declare const _default: React.NamedExoticComponent<SectionProps>;
|
|
22
24
|
export default _default;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import { DataBindings } from "../types/DataBindings";
|
|
3
|
+
import { BackgroundImageType } from "./Row";
|
|
2
4
|
export interface SpacerConfig {
|
|
3
5
|
/** The height of the vertical space (e.g., "20px"). Required. */
|
|
4
6
|
height: string;
|
|
5
7
|
hideOnMobile?: boolean;
|
|
8
|
+
backgroundColor?: string;
|
|
9
|
+
backgroundImage?: BackgroundImageType;
|
|
6
10
|
}
|
|
7
11
|
export type SpacerProps = {
|
|
8
12
|
config: SpacerConfig;
|
|
9
13
|
devNode?: ReactNode;
|
|
14
|
+
bindings?: DataBindings;
|
|
10
15
|
};
|
|
11
|
-
declare function Spacer({ config, devNode }: SpacerProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare function Spacer({ config, devNode, bindings }: SpacerProps): import("react/jsx-runtime").JSX.Element;
|
|
12
17
|
declare const _default: import("react").MemoExoticComponent<typeof Spacer>;
|
|
13
18
|
export default _default;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import IInnerLink from "../types/IInnerLink";
|
|
3
|
+
import { DataBindings } from "../types/DataBindings";
|
|
2
4
|
export interface TextConfig {
|
|
3
5
|
/** The text content or React nodes to render. */
|
|
4
6
|
text?: string;
|
|
@@ -36,14 +38,24 @@ export interface TextConfig {
|
|
|
36
38
|
whiteSpace?: string;
|
|
37
39
|
/** Word break behavior (e.g., 'break-all', 'break-word', 'keep-all', 'normal'). */
|
|
38
40
|
wordBreak?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Constrains the text block width in modern clients via CSS, and in
|
|
43
|
+
* Outlook Classic (Word rendering engine) via a <center> + table `width`
|
|
44
|
+
* HTML attribute pattern — identical to the Column maxWidth approach.
|
|
45
|
+
* The outer table always stays at 100% so no retro layout is disturbed;
|
|
46
|
+
* only the inner constrained table is capped.
|
|
47
|
+
*/
|
|
39
48
|
maxWidth?: string;
|
|
40
49
|
listStyle?: string;
|
|
50
|
+
/** Inner link configuration for making the entire text block clickable */
|
|
51
|
+
innerLink?: IInnerLink;
|
|
41
52
|
}
|
|
42
53
|
export type TextProps = {
|
|
43
54
|
config: TextConfig;
|
|
44
55
|
devMode?: ReactNode;
|
|
45
56
|
children?: ReactNode;
|
|
57
|
+
bindings?: DataBindings;
|
|
46
58
|
};
|
|
47
|
-
declare function Text({ config, devMode, children }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
59
|
+
declare function Text({ config, devMode, children, bindings }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
48
60
|
declare const _default: import("react").MemoExoticComponent<typeof Text>;
|
|
49
61
|
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* bindingAttribute.ts
|
|
3
|
+
* -------------------
|
|
4
|
+
* Serialises DataBindings into discrete HTML attributes:
|
|
5
|
+
*
|
|
6
|
+
* data-bind-if → visible condition → stamped on the root element
|
|
7
|
+
* data-bind-list → repeater (dataList + itemAlias) → stamped on the
|
|
8
|
+
* direct parent of the children loop, NOT the root
|
|
9
|
+
* data-bind → propertyMap → stamped on the root element
|
|
10
|
+
*
|
|
11
|
+
* Keeping the three concerns in separate attributes lets the post-processor
|
|
12
|
+
* handle them independently without ambiguity.
|
|
13
|
+
*/
|
|
14
|
+
import { DataBindings } from '../../types/DataBindings';
|
|
15
|
+
/**
|
|
16
|
+
* Props to spread onto the component's root element.
|
|
17
|
+
* Carries `data-bind-if` and/or `data-bind` (propertyMap).
|
|
18
|
+
*/
|
|
19
|
+
export declare function rootBindingProps(bindings: DataBindings | undefined): {
|
|
20
|
+
'data-bind-if'?: string;
|
|
21
|
+
'data-bind'?: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Props to spread onto the *direct parent* of the children loop.
|
|
25
|
+
* Carries `data-bind-list` only when a repeater is defined.
|
|
26
|
+
*
|
|
27
|
+
* Usage inside a component:
|
|
28
|
+
* <tbody {...listBindingProps(bindings)}>
|
|
29
|
+
* {children}
|
|
30
|
+
* </tbody>
|
|
31
|
+
*/
|
|
32
|
+
export declare function listBindingProps(bindings: DataBindings | undefined): {
|
|
33
|
+
'data-bind-list'?: string;
|
|
34
|
+
};
|
|
35
|
+
/** @deprecated Use rootBindingProps + listBindingProps instead. */
|
|
36
|
+
export declare function bindingProps(bindings: DataBindings | undefined): {
|
|
37
|
+
'data-bind'?: string;
|
|
38
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a CSSProperties object to an inline style string suitable for
|
|
4
|
+
* embedding inside a dangerouslySetInnerHTML / VML conditional comment where
|
|
5
|
+
* JSX style objects are not available.
|
|
6
|
+
*
|
|
7
|
+
* Converts camelCase keys to kebab-case (e.g. borderRadius → border-radius).
|
|
8
|
+
* Skips undefined/null values.
|
|
9
|
+
*/
|
|
10
|
+
export default function linearizeStyle(style: CSSProperties): string;
|