@maily-to/render 2.0.0-beta.18 → 2.0.0-beta.20

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/index.cjs CHANGED
@@ -515,6 +515,19 @@ const container = (node, ctx) => {
515
515
  });
516
516
  };
517
517
  //#endregion
518
+ //#region src/nodes/div.tsx
519
+ function isEmptyBox(node) {
520
+ const [only] = node.content;
521
+ return node.content.length === 1 && _maily_to_shared.is.paragraph(only) && !(only.content?.length ?? 0);
522
+ }
523
+ const div = (node, ctx) => {
524
+ if (!_maily_to_shared.is.div(node)) return null;
525
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
526
+ style: getNodeStyle(node.attrs?.style),
527
+ children: isEmptyBox(node) ? null : ctx.children(node)
528
+ });
529
+ };
530
+ //#endregion
518
531
  //#region src/lib/font-face.ts
519
532
  /**
520
533
  * Registers a font face in the context's shared font collector.
@@ -1309,6 +1322,7 @@ const MAILY_NODE_RENDERERS = {
1309
1322
  [_maily_to_shared.MAILY_NODE_TYPES.BODY]: body,
1310
1323
  [_maily_to_shared.MAILY_NODE_TYPES.CONTAINER]: container,
1311
1324
  [_maily_to_shared.MAILY_NODE_TYPES.SECTION]: section,
1325
+ [_maily_to_shared.MAILY_NODE_TYPES.DIV]: div,
1312
1326
  [_maily_to_shared.MAILY_NODE_TYPES.COLUMNS]: columns,
1313
1327
  [_maily_to_shared.MAILY_NODE_TYPES.COLUMN]: column,
1314
1328
  [_maily_to_shared.MAILY_NODE_TYPES.PARAGRAPH]: paragraph,