@travetto/email-inky 3.3.0 → 3.3.1

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/jsx-runtime.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ConcreteClass } from '@travetto/base';
2
2
 
3
3
  export type JSXChild = JSXElement | number | bigint | boolean | object | string;
4
- type JSXProps = { children?: JSXChild | JSXChild[] | null, class?: string, id?: string, name?: string, dir?: string };
4
+ type JSXProps = { children?: JSXChild | JSXChild[] | null, className?: string, id?: string, name?: string, dir?: string };
5
5
 
6
6
  export type JSXComponentFunction<P extends {} = {}> = (props: P & JSXProps, ...args: unknown[]) => (JSXElement | null);
7
7
 
@@ -34,7 +34,7 @@ declare global {
34
34
  namespace JSX {
35
35
  interface Element extends JSXElement { }
36
36
  interface IntrinsicAttributes {
37
- class?: string;
37
+ className?: string;
38
38
  id?: string;
39
39
  dir?: string;
40
40
  name?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/email-inky",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Email Inky templating module",
5
5
  "keywords": [
6
6
  "email",
@@ -34,7 +34,7 @@
34
34
  "foundation-emails": "^2.4.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@travetto/email-compiler": "^3.3.0"
37
+ "@travetto/email-compiler": "^3.3.1"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@travetto/cli": "^3.3.0"
@@ -44,9 +44,10 @@ export const classStr = (existing: string | undefined, ...toAdd: string[]): stri
44
44
 
45
45
  export const combinePropsToStr = (allowedProps: Set<string>, props: Record<string, unknown>, ...addClasses: string[]): string => {
46
46
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
47
- const out = { ...props, class: classStr(props.class as string, ...addClasses) };
47
+ const out = { ...props, className: classStr(props.className as string, ...addClasses) };
48
48
  return Object.entries(out)
49
49
  .filter(([k, v]) => allowedProps.has(k) && v !== undefined && v !== null && v !== '')
50
+ .map(([k, v]) => [k === 'className' ? 'class' : k, v])
50
51
  .map(([k, v]) => `${k}="${v}"`).join(' ');
51
52
  };
52
53
 
@@ -17,7 +17,7 @@ export const SUMMARY_STYLE = Object.entries({
17
17
  }).map(([k, v]) => `${k}: ${v}`).join('; ');
18
18
 
19
19
  const allowedProps = new Set([
20
- 'class', 'id', 'dir', 'name', 'src',
20
+ 'className', 'id', 'dir', 'name', 'src',
21
21
  'alt', 'href', 'title', 'height', 'target',
22
22
  'width', 'style', 'align', 'valign'
23
23
  ]);
@@ -94,8 +94,8 @@ export const Html: RenderProvider<RenderContext> = {
94
94
  if (!pProps.columnVisited) {
95
95
  pProps.columnVisited = true;
96
96
  if (sibs.length) {
97
- sibs[0].props.class = classStr(sibs[0].props.class ?? '', 'first');
98
- sibs[sibs.length - 1].props.class = classStr(sibs[sibs.length - 1].props.class ?? '', 'last');
97
+ sibs[0].props.className = classStr(sibs[0].props.className ?? '', 'first');
98
+ sibs[sibs.length - 1].props.className = classStr(sibs[sibs.length - 1].props.className ?? '', 'last');
99
99
  }
100
100
  }
101
101
 
@@ -166,7 +166,7 @@ export const Html: RenderProvider<RenderContext> = {
166
166
  if (href) {
167
167
  const linkProps = { href, target };
168
168
  if (props.expanded) {
169
- Object.assign(linkProps, { align: 'center', class: 'float-center' });
169
+ Object.assign(linkProps, { align: 'center', className: 'float-center' });
170
170
  }
171
171
  inner = `<a ${propsToStr(linkProps)}>${inner}</a>`;
172
172
  }
@@ -174,7 +174,7 @@ export const Html: RenderProvider<RenderContext> = {
174
174
  // If the button is expanded, it needs a <center> tag around the content
175
175
  if (props.expanded) {
176
176
  inner = await Html.Center(createState('Center', { children: [inner] }));
177
- rest.class = classStr(rest.class ?? '', 'expand');
177
+ rest.className = classStr(rest.className ?? '', 'expand');
178
178
  expander = '\n<td class="expander"></td>';
179
179
  }
180
180
 
@@ -219,7 +219,7 @@ export const Html: RenderProvider<RenderContext> = {
219
219
  visit(el, (child) => {
220
220
  if (isOfType(child, 'Item')) {
221
221
  return hasItem = true;
222
- } else if ((child.type === 'td' || child.type === 'th') && child.props.class?.includes('menu-item')) {
222
+ } else if ((child.type === 'td' || child.type === 'th') && child.props.className?.includes('menu-item')) {
223
223
  return hasItem = true;
224
224
  }
225
225
  });
@@ -260,13 +260,13 @@ export const Html: RenderProvider<RenderContext> = {
260
260
  for (const kid of getKids(el)) {
261
261
  Object.assign(kid.props, {
262
262
  align: 'center',
263
- class: classStr(kid.props.class, 'float-center')
263
+ className: classStr(kid.props.className, 'float-center')
264
264
  });
265
265
  }
266
266
 
267
267
  visit(el, child => {
268
268
  if (isOfType(child, 'Item')) {
269
- child.props.class = classStr(child.props.class, 'float-center');
269
+ child.props.className = classStr(child.props.className, 'float-center');
270
270
  }
271
271
  return;
272
272
  });
@@ -280,8 +280,8 @@ export const Html: RenderProvider<RenderContext> = {
280
280
 
281
281
  Callout: async ({ recurse, el, props }): Promise<string> => {
282
282
 
283
- const innerProps: JSXElement['props'] = { class: props.class };
284
- delete props.class;
283
+ const innerProps: JSXElement['props'] = { className: props.className };
284
+ delete props.className;
285
285
 
286
286
  return `
287
287
  <table ${propsToStr(props, 'callout')}>