@travetto/email-inky 3.1.24 → 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 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 key='person'>
28
+ <If attr='person'>
29
29
  <Row>
30
30
  <Column small={5}>
31
- <Button href='https://google.com/[[query]]'>Hello <Value key='name' /></Button>
31
+ <Button href='https://google.com/{{query}}'>Hello <Value attr='name' /></Button>
32
32
  </Column>
33
33
  </Row>
34
34
  </If>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/email-inky",
3
- "version": "3.1.24",
3
+ "version": "3.1.25",
4
4
  "description": "Email Inky templating module",
5
5
  "keywords": [
6
6
  "email",
@@ -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.smallOffset}`);
151
+ classes.push(`large-offset-${props.largeOffset}`);
152
152
  }
153
153
  if (props.hideLarge) {
154
154
  classes.push('hide-for-large');
@@ -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
- const par = { props: { children: Array.isArray(root.text) ? root.text : [root.text] }, type: '', key: '' };
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`;