@travetto/email-inky 3.1.22 → 3.1.25
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/README.md +3 -2
- package/package.json +1 -1
- package/src/render/html.ts +2 -2
- package/src/render/renderer.ts +6 -1
- package/src/wrapper.ts +3 -2
package/README.md
CHANGED
|
@@ -25,10 +25,10 @@ export default inkyTpl(<>
|
|
|
25
25
|
<Title>Test Email</Title>
|
|
26
26
|
<Summary>Email Summary</Summary>
|
|
27
27
|
<Container>
|
|
28
|
-
<If
|
|
28
|
+
<If attr='person'>
|
|
29
29
|
<Row>
|
|
30
30
|
<Column small={5}>
|
|
31
|
-
<Button href='https://google.com/
|
|
31
|
+
<Button href='https://google.com/{{query}}'>Hello <Value attr='name' /></Button>
|
|
32
32
|
</Column>
|
|
33
33
|
</Row>
|
|
34
34
|
</If>
|
|
@@ -48,5 +48,6 @@ To that end, the module introduces additional components ([If Component](https:/
|
|
|
48
48
|
## Template Extension Points
|
|
49
49
|
The template extension points are defined at:
|
|
50
50
|
1. `email/main.scss` - The entry point for adding, and overriding any [sass](https://github.com/sass/dart-sass)
|
|
51
|
+
1. `email/inky.variables.scss` - Allows for specifying any variables that should be defined before [inky](https://github.com/zurb/inky)'s styles are loaded.
|
|
51
52
|
1. `email/inky.wrapper.html` - Provides direct access to override the entire base HTML document for all HTML emails.
|
|
52
53
|
In addition to the overrides, you can find the list of available settings at [Github](https://github.com/foundation/foundation-emails/blob/develop/scss/settings/_settings.scss)
|
package/package.json
CHANGED
package/src/render/html.ts
CHANGED
|
@@ -115,12 +115,12 @@ export const Html: RenderProvider<RenderContext> = {
|
|
|
115
115
|
const pProps = parent.props as { columnVisited: boolean };
|
|
116
116
|
if (!pProps.columnVisited) {
|
|
117
117
|
pProps.columnVisited = true;
|
|
118
|
+
|
|
118
119
|
const sibs = getKids(parent).filter(x => isOfType(x, 'Column'));
|
|
119
120
|
if (sibs.length) {
|
|
120
121
|
sibs[0].props.class = classStr(sibs[0].props.class ?? '', 'first');
|
|
121
122
|
sibs[sibs.length - 1].props.class = classStr(sibs[sibs.length - 1].props.class ?? '', 'last');
|
|
122
123
|
}
|
|
123
|
-
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// Check for sizes. If no attribute is provided, default to small-12. Divide evenly for large columns
|
|
@@ -148,7 +148,7 @@ export const Html: RenderProvider<RenderContext> = {
|
|
|
148
148
|
classes.push('hide-for-small');
|
|
149
149
|
}
|
|
150
150
|
if (props.largeOffset) {
|
|
151
|
-
classes.push(`large-offset-${props.
|
|
151
|
+
classes.push(`large-offset-${props.largeOffset}`);
|
|
152
152
|
}
|
|
153
153
|
if (props.hideLarge) {
|
|
154
154
|
classes.push('hide-for-large');
|
package/src/render/renderer.ts
CHANGED
|
@@ -81,7 +81,12 @@ export class InkyRenderer {
|
|
|
81
81
|
*/
|
|
82
82
|
static async render(root: DocumentShape, provider: RenderProvider<RenderContext>): Promise<string> {
|
|
83
83
|
const ctx = new RenderContext();
|
|
84
|
-
|
|
84
|
+
let par: JSXElement;
|
|
85
|
+
if (isJSXElement(root.text)) {
|
|
86
|
+
par = root.text;
|
|
87
|
+
} else {
|
|
88
|
+
par = { props: { children: Array.isArray(root.text) ? root.text : [] }, type: '', key: '' };
|
|
89
|
+
}
|
|
85
90
|
const text = await this.#render(ctx, provider, root.text, [par]);
|
|
86
91
|
|
|
87
92
|
let cleaned = `${text.replace(/\n{3,100}/msg, '\n\n').trim()}\n`;
|
package/src/wrapper.ts
CHANGED
|
@@ -19,8 +19,9 @@ export const inkyTpl = (content: JSXElement | JSXElement[]): MessageCompilationS
|
|
|
19
19
|
styles: {
|
|
20
20
|
search: [path.dirname(req.resolve('foundation-emails/scss/_global.scss'))],
|
|
21
21
|
global: `
|
|
22
|
-
@import '
|
|
23
|
-
@import '
|
|
22
|
+
@import 'email/inky.variables';
|
|
23
|
+
@import '_global';
|
|
24
|
+
@import 'foundation-emails';
|
|
24
25
|
`
|
|
25
26
|
}
|
|
26
27
|
});
|