@templatical/renderer 0.44.3 → 0.45.0
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/assets/social/circle/behance.png +0 -0
- package/assets/social/circle/discord.png +0 -0
- package/assets/social/circle/dribbble.png +0 -0
- package/assets/social/circle/email.png +0 -0
- package/assets/social/circle/facebook.png +0 -0
- package/assets/social/circle/github.png +0 -0
- package/assets/social/circle/instagram.png +0 -0
- package/assets/social/circle/linkedin.png +0 -0
- package/assets/social/circle/pinterest.png +0 -0
- package/assets/social/circle/reddit.png +0 -0
- package/assets/social/circle/snapchat.png +0 -0
- package/assets/social/circle/telegram.png +0 -0
- package/assets/social/circle/tiktok.png +0 -0
- package/assets/social/circle/twitter.png +0 -0
- package/assets/social/circle/website.png +0 -0
- package/assets/social/circle/whatsapp.png +0 -0
- package/assets/social/circle/youtube.png +0 -0
- package/assets/social/circle-dark/behance.png +0 -0
- package/assets/social/circle-dark/discord.png +0 -0
- package/assets/social/circle-dark/dribbble.png +0 -0
- package/assets/social/circle-dark/email.png +0 -0
- package/assets/social/circle-dark/facebook.png +0 -0
- package/assets/social/circle-dark/github.png +0 -0
- package/assets/social/circle-dark/instagram.png +0 -0
- package/assets/social/circle-dark/linkedin.png +0 -0
- package/assets/social/circle-dark/pinterest.png +0 -0
- package/assets/social/circle-dark/reddit.png +0 -0
- package/assets/social/circle-dark/snapchat.png +0 -0
- package/assets/social/circle-dark/telegram.png +0 -0
- package/assets/social/circle-dark/tiktok.png +0 -0
- package/assets/social/circle-dark/twitter.png +0 -0
- package/assets/social/circle-dark/website.png +0 -0
- package/assets/social/circle-dark/whatsapp.png +0 -0
- package/assets/social/circle-dark/youtube.png +0 -0
- package/assets/social/circle-light/behance.png +0 -0
- package/assets/social/circle-light/discord.png +0 -0
- package/assets/social/circle-light/dribbble.png +0 -0
- package/assets/social/circle-light/email.png +0 -0
- package/assets/social/circle-light/facebook.png +0 -0
- package/assets/social/circle-light/github.png +0 -0
- package/assets/social/circle-light/instagram.png +0 -0
- package/assets/social/circle-light/linkedin.png +0 -0
- package/assets/social/circle-light/pinterest.png +0 -0
- package/assets/social/circle-light/reddit.png +0 -0
- package/assets/social/circle-light/snapchat.png +0 -0
- package/assets/social/circle-light/telegram.png +0 -0
- package/assets/social/circle-light/tiktok.png +0 -0
- package/assets/social/circle-light/twitter.png +0 -0
- package/assets/social/circle-light/website.png +0 -0
- package/assets/social/circle-light/whatsapp.png +0 -0
- package/assets/social/circle-light/youtube.png +0 -0
- package/assets/social/outlined/behance.png +0 -0
- package/assets/social/outlined/discord.png +0 -0
- package/assets/social/outlined/dribbble.png +0 -0
- package/assets/social/outlined/email.png +0 -0
- package/assets/social/outlined/facebook.png +0 -0
- package/assets/social/outlined/github.png +0 -0
- package/assets/social/outlined/instagram.png +0 -0
- package/assets/social/outlined/linkedin.png +0 -0
- package/assets/social/outlined/pinterest.png +0 -0
- package/assets/social/outlined/reddit.png +0 -0
- package/assets/social/outlined/snapchat.png +0 -0
- package/assets/social/outlined/telegram.png +0 -0
- package/assets/social/outlined/tiktok.png +0 -0
- package/assets/social/outlined/twitter.png +0 -0
- package/assets/social/outlined/website.png +0 -0
- package/assets/social/outlined/whatsapp.png +0 -0
- package/assets/social/outlined/youtube.png +0 -0
- package/assets/social/outlined-dark/behance.png +0 -0
- package/assets/social/outlined-dark/discord.png +0 -0
- package/assets/social/outlined-dark/dribbble.png +0 -0
- package/assets/social/outlined-dark/email.png +0 -0
- package/assets/social/outlined-dark/facebook.png +0 -0
- package/assets/social/outlined-dark/github.png +0 -0
- package/assets/social/outlined-dark/instagram.png +0 -0
- package/assets/social/outlined-dark/linkedin.png +0 -0
- package/assets/social/outlined-dark/pinterest.png +0 -0
- package/assets/social/outlined-dark/reddit.png +0 -0
- package/assets/social/outlined-dark/snapchat.png +0 -0
- package/assets/social/outlined-dark/telegram.png +0 -0
- package/assets/social/outlined-dark/tiktok.png +0 -0
- package/assets/social/outlined-dark/twitter.png +0 -0
- package/assets/social/outlined-dark/website.png +0 -0
- package/assets/social/outlined-dark/whatsapp.png +0 -0
- package/assets/social/outlined-dark/youtube.png +0 -0
- package/assets/social/outlined-light/behance.png +0 -0
- package/assets/social/outlined-light/discord.png +0 -0
- package/assets/social/outlined-light/dribbble.png +0 -0
- package/assets/social/outlined-light/email.png +0 -0
- package/assets/social/outlined-light/facebook.png +0 -0
- package/assets/social/outlined-light/github.png +0 -0
- package/assets/social/outlined-light/instagram.png +0 -0
- package/assets/social/outlined-light/linkedin.png +0 -0
- package/assets/social/outlined-light/pinterest.png +0 -0
- package/assets/social/outlined-light/reddit.png +0 -0
- package/assets/social/outlined-light/snapchat.png +0 -0
- package/assets/social/outlined-light/telegram.png +0 -0
- package/assets/social/outlined-light/tiktok.png +0 -0
- package/assets/social/outlined-light/twitter.png +0 -0
- package/assets/social/outlined-light/website.png +0 -0
- package/assets/social/outlined-light/whatsapp.png +0 -0
- package/assets/social/outlined-light/youtube.png +0 -0
- package/assets/social/plain/behance.png +0 -0
- package/assets/social/plain/discord.png +0 -0
- package/assets/social/plain/dribbble.png +0 -0
- package/assets/social/plain/email.png +0 -0
- package/assets/social/plain/facebook.png +0 -0
- package/assets/social/plain/github.png +0 -0
- package/assets/social/plain/instagram.png +0 -0
- package/assets/social/plain/linkedin.png +0 -0
- package/assets/social/plain/pinterest.png +0 -0
- package/assets/social/plain/reddit.png +0 -0
- package/assets/social/plain/snapchat.png +0 -0
- package/assets/social/plain/telegram.png +0 -0
- package/assets/social/plain/tiktok.png +0 -0
- package/assets/social/plain/twitter.png +0 -0
- package/assets/social/plain/website.png +0 -0
- package/assets/social/plain/whatsapp.png +0 -0
- package/assets/social/plain/youtube.png +0 -0
- package/assets/social/plain-dark/behance.png +0 -0
- package/assets/social/plain-dark/discord.png +0 -0
- package/assets/social/plain-dark/dribbble.png +0 -0
- package/assets/social/plain-dark/email.png +0 -0
- package/assets/social/plain-dark/facebook.png +0 -0
- package/assets/social/plain-dark/github.png +0 -0
- package/assets/social/plain-dark/instagram.png +0 -0
- package/assets/social/plain-dark/linkedin.png +0 -0
- package/assets/social/plain-dark/pinterest.png +0 -0
- package/assets/social/plain-dark/reddit.png +0 -0
- package/assets/social/plain-dark/snapchat.png +0 -0
- package/assets/social/plain-dark/telegram.png +0 -0
- package/assets/social/plain-dark/tiktok.png +0 -0
- package/assets/social/plain-dark/twitter.png +0 -0
- package/assets/social/plain-dark/website.png +0 -0
- package/assets/social/plain-dark/whatsapp.png +0 -0
- package/assets/social/plain-dark/youtube.png +0 -0
- package/assets/social/plain-light/behance.png +0 -0
- package/assets/social/plain-light/discord.png +0 -0
- package/assets/social/plain-light/dribbble.png +0 -0
- package/assets/social/plain-light/email.png +0 -0
- package/assets/social/plain-light/facebook.png +0 -0
- package/assets/social/plain-light/github.png +0 -0
- package/assets/social/plain-light/instagram.png +0 -0
- package/assets/social/plain-light/linkedin.png +0 -0
- package/assets/social/plain-light/pinterest.png +0 -0
- package/assets/social/plain-light/reddit.png +0 -0
- package/assets/social/plain-light/snapchat.png +0 -0
- package/assets/social/plain-light/telegram.png +0 -0
- package/assets/social/plain-light/tiktok.png +0 -0
- package/assets/social/plain-light/twitter.png +0 -0
- package/assets/social/plain-light/website.png +0 -0
- package/assets/social/plain-light/whatsapp.png +0 -0
- package/assets/social/plain-light/youtube.png +0 -0
- package/assets/social/rounded/behance.png +0 -0
- package/assets/social/rounded/discord.png +0 -0
- package/assets/social/rounded/dribbble.png +0 -0
- package/assets/social/rounded/email.png +0 -0
- package/assets/social/rounded/facebook.png +0 -0
- package/assets/social/rounded/github.png +0 -0
- package/assets/social/rounded/instagram.png +0 -0
- package/assets/social/rounded/linkedin.png +0 -0
- package/assets/social/rounded/pinterest.png +0 -0
- package/assets/social/rounded/reddit.png +0 -0
- package/assets/social/rounded/snapchat.png +0 -0
- package/assets/social/rounded/telegram.png +0 -0
- package/assets/social/rounded/tiktok.png +0 -0
- package/assets/social/rounded/twitter.png +0 -0
- package/assets/social/rounded/website.png +0 -0
- package/assets/social/rounded/whatsapp.png +0 -0
- package/assets/social/rounded/youtube.png +0 -0
- package/assets/social/rounded-dark/behance.png +0 -0
- package/assets/social/rounded-dark/discord.png +0 -0
- package/assets/social/rounded-dark/dribbble.png +0 -0
- package/assets/social/rounded-dark/email.png +0 -0
- package/assets/social/rounded-dark/facebook.png +0 -0
- package/assets/social/rounded-dark/github.png +0 -0
- package/assets/social/rounded-dark/instagram.png +0 -0
- package/assets/social/rounded-dark/linkedin.png +0 -0
- package/assets/social/rounded-dark/pinterest.png +0 -0
- package/assets/social/rounded-dark/reddit.png +0 -0
- package/assets/social/rounded-dark/snapchat.png +0 -0
- package/assets/social/rounded-dark/telegram.png +0 -0
- package/assets/social/rounded-dark/tiktok.png +0 -0
- package/assets/social/rounded-dark/twitter.png +0 -0
- package/assets/social/rounded-dark/website.png +0 -0
- package/assets/social/rounded-dark/whatsapp.png +0 -0
- package/assets/social/rounded-dark/youtube.png +0 -0
- package/assets/social/rounded-light/behance.png +0 -0
- package/assets/social/rounded-light/discord.png +0 -0
- package/assets/social/rounded-light/dribbble.png +0 -0
- package/assets/social/rounded-light/email.png +0 -0
- package/assets/social/rounded-light/facebook.png +0 -0
- package/assets/social/rounded-light/github.png +0 -0
- package/assets/social/rounded-light/instagram.png +0 -0
- package/assets/social/rounded-light/linkedin.png +0 -0
- package/assets/social/rounded-light/pinterest.png +0 -0
- package/assets/social/rounded-light/reddit.png +0 -0
- package/assets/social/rounded-light/snapchat.png +0 -0
- package/assets/social/rounded-light/telegram.png +0 -0
- package/assets/social/rounded-light/tiktok.png +0 -0
- package/assets/social/rounded-light/twitter.png +0 -0
- package/assets/social/rounded-light/website.png +0 -0
- package/assets/social/rounded-light/whatsapp.png +0 -0
- package/assets/social/rounded-light/youtube.png +0 -0
- package/assets/social/solid/behance.png +0 -0
- package/assets/social/solid/discord.png +0 -0
- package/assets/social/solid/dribbble.png +0 -0
- package/assets/social/solid/email.png +0 -0
- package/assets/social/solid/facebook.png +0 -0
- package/assets/social/solid/github.png +0 -0
- package/assets/social/solid/instagram.png +0 -0
- package/assets/social/solid/linkedin.png +0 -0
- package/assets/social/solid/pinterest.png +0 -0
- package/assets/social/solid/reddit.png +0 -0
- package/assets/social/solid/snapchat.png +0 -0
- package/assets/social/solid/telegram.png +0 -0
- package/assets/social/solid/tiktok.png +0 -0
- package/assets/social/solid/twitter.png +0 -0
- package/assets/social/solid/website.png +0 -0
- package/assets/social/solid/whatsapp.png +0 -0
- package/assets/social/solid/youtube.png +0 -0
- package/assets/social/solid-dark/behance.png +0 -0
- package/assets/social/solid-dark/discord.png +0 -0
- package/assets/social/solid-dark/dribbble.png +0 -0
- package/assets/social/solid-dark/email.png +0 -0
- package/assets/social/solid-dark/facebook.png +0 -0
- package/assets/social/solid-dark/github.png +0 -0
- package/assets/social/solid-dark/instagram.png +0 -0
- package/assets/social/solid-dark/linkedin.png +0 -0
- package/assets/social/solid-dark/pinterest.png +0 -0
- package/assets/social/solid-dark/reddit.png +0 -0
- package/assets/social/solid-dark/snapchat.png +0 -0
- package/assets/social/solid-dark/telegram.png +0 -0
- package/assets/social/solid-dark/tiktok.png +0 -0
- package/assets/social/solid-dark/twitter.png +0 -0
- package/assets/social/solid-dark/website.png +0 -0
- package/assets/social/solid-dark/whatsapp.png +0 -0
- package/assets/social/solid-dark/youtube.png +0 -0
- package/assets/social/solid-light/behance.png +0 -0
- package/assets/social/solid-light/discord.png +0 -0
- package/assets/social/solid-light/dribbble.png +0 -0
- package/assets/social/solid-light/email.png +0 -0
- package/assets/social/solid-light/facebook.png +0 -0
- package/assets/social/solid-light/github.png +0 -0
- package/assets/social/solid-light/instagram.png +0 -0
- package/assets/social/solid-light/linkedin.png +0 -0
- package/assets/social/solid-light/pinterest.png +0 -0
- package/assets/social/solid-light/reddit.png +0 -0
- package/assets/social/solid-light/snapchat.png +0 -0
- package/assets/social/solid-light/telegram.png +0 -0
- package/assets/social/solid-light/tiktok.png +0 -0
- package/assets/social/solid-light/twitter.png +0 -0
- package/assets/social/solid-light/website.png +0 -0
- package/assets/social/solid-light/whatsapp.png +0 -0
- package/assets/social/solid-light/youtube.png +0 -0
- package/assets/social/square/behance.png +0 -0
- package/assets/social/square/discord.png +0 -0
- package/assets/social/square/dribbble.png +0 -0
- package/assets/social/square/email.png +0 -0
- package/assets/social/square/facebook.png +0 -0
- package/assets/social/square/github.png +0 -0
- package/assets/social/square/instagram.png +0 -0
- package/assets/social/square/linkedin.png +0 -0
- package/assets/social/square/pinterest.png +0 -0
- package/assets/social/square/reddit.png +0 -0
- package/assets/social/square/snapchat.png +0 -0
- package/assets/social/square/telegram.png +0 -0
- package/assets/social/square/tiktok.png +0 -0
- package/assets/social/square/twitter.png +0 -0
- package/assets/social/square/website.png +0 -0
- package/assets/social/square/whatsapp.png +0 -0
- package/assets/social/square/youtube.png +0 -0
- package/assets/social/square-dark/behance.png +0 -0
- package/assets/social/square-dark/discord.png +0 -0
- package/assets/social/square-dark/dribbble.png +0 -0
- package/assets/social/square-dark/email.png +0 -0
- package/assets/social/square-dark/facebook.png +0 -0
- package/assets/social/square-dark/github.png +0 -0
- package/assets/social/square-dark/instagram.png +0 -0
- package/assets/social/square-dark/linkedin.png +0 -0
- package/assets/social/square-dark/pinterest.png +0 -0
- package/assets/social/square-dark/reddit.png +0 -0
- package/assets/social/square-dark/snapchat.png +0 -0
- package/assets/social/square-dark/telegram.png +0 -0
- package/assets/social/square-dark/tiktok.png +0 -0
- package/assets/social/square-dark/twitter.png +0 -0
- package/assets/social/square-dark/website.png +0 -0
- package/assets/social/square-dark/whatsapp.png +0 -0
- package/assets/social/square-dark/youtube.png +0 -0
- package/assets/social/square-light/behance.png +0 -0
- package/assets/social/square-light/discord.png +0 -0
- package/assets/social/square-light/dribbble.png +0 -0
- package/assets/social/square-light/email.png +0 -0
- package/assets/social/square-light/facebook.png +0 -0
- package/assets/social/square-light/github.png +0 -0
- package/assets/social/square-light/instagram.png +0 -0
- package/assets/social/square-light/linkedin.png +0 -0
- package/assets/social/square-light/pinterest.png +0 -0
- package/assets/social/square-light/reddit.png +0 -0
- package/assets/social/square-light/snapchat.png +0 -0
- package/assets/social/square-light/telegram.png +0 -0
- package/assets/social/square-light/tiktok.png +0 -0
- package/assets/social/square-light/twitter.png +0 -0
- package/assets/social/square-light/website.png +0 -0
- package/assets/social/square-light/whatsapp.png +0 -0
- package/assets/social/square-light/youtube.png +0 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -170,6 +170,16 @@ export declare function richTextGapClass(gap: number): string;
|
|
|
170
170
|
*/
|
|
171
171
|
export declare function resolveParagraphGap(spacing: number | undefined): number;
|
|
172
172
|
//#endregion
|
|
173
|
+
//#region src/renderers/button.d.ts
|
|
174
|
+
/**
|
|
175
|
+
* Marks the `mj-button` of a full-width button. MJML gives the button's `<a>`
|
|
176
|
+
* a width only for a px `width`; for `100%` it widens the `<table>` and leaves
|
|
177
|
+
* the `<a>` at `display:inline-block`, so only the label is clickable.
|
|
178
|
+
* `renderToMjml` scopes the head rule that makes the `<a>` fill the button to
|
|
179
|
+
* this class.
|
|
180
|
+
*/
|
|
181
|
+
export declare const BUTTON_FULL_WIDTH_CSS_CLASS = "tpl-button-full";
|
|
182
|
+
//#endregion
|
|
173
183
|
//#region src/columns.d.ts
|
|
174
184
|
/**
|
|
175
185
|
* Get width percentages for each column in a layout.
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { HEADING_LEVEL_FONT_SIZE, RICH_TEXT_SPACING, applyLayout, assertNoSlotInContent, assertNoWrapperInContent, findOpenTagEnd, getTagAttrValue, isButton, isCustomBlock, isDivider, isHtml, isImage, isMenu, isParagraph, isSection, isSocialIcons, isSpacer, isTable, isTitle, isVideo, isWrapper, resolveContentDirection, toBorderDeclarations, toBorderRadiusCss } from "@templatical/types";
|
|
1
|
+
import { HEADING_LEVEL_FONT_SIZE, RICH_TEXT_SPACING, applyLayout, assertNoSlotInContent, assertNoWrapperInContent, findOpenTagEnd, getTagAttrValue, isButton, isCustomBlock, isDivider, isHtml, isImage, isMenu, isParagraph, isSection, isSocialIcons, isSpacer, isTable, isTitle, isVideo, isWrapper, resolveContentDirection, socialIconAssetDir, toBorderDeclarations, toBorderRadiusCss } from "@templatical/types";
|
|
2
2
|
//#endregion
|
|
3
3
|
//#region src/render-context.ts
|
|
4
|
-
const DEFAULT_SOCIAL_ICONS_BASE_URL = `https://cdn.jsdelivr.net/npm/@templatical/renderer@0.
|
|
4
|
+
const DEFAULT_SOCIAL_ICONS_BASE_URL = `https://cdn.jsdelivr.net/npm/@templatical/renderer@0.45.0/assets/social`;
|
|
5
5
|
const BUILT_IN_FONT_FALLBACKS = {
|
|
6
6
|
arial: "Arial, sans-serif",
|
|
7
7
|
helvetica: "Helvetica, sans-serif",
|
|
@@ -495,6 +495,14 @@ function renderImage(block, context) {
|
|
|
495
495
|
//#endregion
|
|
496
496
|
//#region src/renderers/button.ts
|
|
497
497
|
/**
|
|
498
|
+
* Marks the `mj-button` of a full-width button. MJML gives the button's `<a>`
|
|
499
|
+
* a width only for a px `width`; for `100%` it widens the `<table>` and leaves
|
|
500
|
+
* the `<a>` at `display:inline-block`, so only the label is clickable.
|
|
501
|
+
* `renderToMjml` scopes the head rule that makes the `<a>` fill the button to
|
|
502
|
+
* this class.
|
|
503
|
+
*/
|
|
504
|
+
const BUTTON_FULL_WIDTH_CSS_CLASS = "tpl-button-full";
|
|
505
|
+
/**
|
|
498
506
|
* Render a button block to MJML markup.
|
|
499
507
|
*/
|
|
500
508
|
function renderButton(block, context) {
|
|
@@ -512,7 +520,7 @@ function renderButton(block, context) {
|
|
|
512
520
|
const targetAttr = block.openInNewTab ? " target=\"_blank\" rel=\"noopener\"" : "";
|
|
513
521
|
const fontFamilyAttr = renderFontFamilyAttr$2(block.fontFamily, context);
|
|
514
522
|
const widthAttr = renderWidthAttr(block.width);
|
|
515
|
-
const
|
|
523
|
+
const cssClassAttr = getCssClassAttr(block, block.width === "full" ? [BUTTON_FULL_WIDTH_CSS_CLASS] : []);
|
|
516
524
|
return `<mj-button${hrefAttr}${targetAttr}
|
|
517
525
|
background-color="${backgroundColor}"
|
|
518
526
|
color="${textColor}"
|
|
@@ -521,7 +529,7 @@ function renderButton(block, context) {
|
|
|
521
529
|
border-radius="${borderRadius}"${borderAttr(block.border)}
|
|
522
530
|
inner-padding="${buttonPadding}"
|
|
523
531
|
align="${block.align ?? "center"}"
|
|
524
|
-
padding="${padding}"${bgColor}${fontFamilyAttr}${widthAttr}${
|
|
532
|
+
padding="${padding}"${bgColor}${fontFamilyAttr}${widthAttr}${cssClassAttr}
|
|
525
533
|
>${text}</mj-button>`;
|
|
526
534
|
}
|
|
527
535
|
/**
|
|
@@ -603,13 +611,14 @@ ${content}
|
|
|
603
611
|
/**
|
|
604
612
|
* Render a social icons block to MJML markup.
|
|
605
613
|
*
|
|
606
|
-
* Icons are emitted as `<img src="…/{
|
|
614
|
+
* Icons are emitted as `<img src="…/{dir}/{platform}.png">` rather than
|
|
607
615
|
* inline SVG or base64 data URIs. Outlook desktop (Word rendering engine)
|
|
608
616
|
* does not support SVG and rejects base64 in `<img src>`, so hosted PNGs are
|
|
609
617
|
* the only format that renders across every mainstream client. The base URL
|
|
610
618
|
* is read from `context.socialIconsBaseUrl` (configurable via
|
|
611
619
|
* `RenderOptions.socialIconsBaseUrl`; default is the version-pinned jsDelivr
|
|
612
|
-
* mirror of this package).
|
|
620
|
+
* mirror of this package). `{dir}` is the style, plus `-{tone}` for a
|
|
621
|
+
* one-color tone (`socialIconAssetDir`).
|
|
613
622
|
*/
|
|
614
623
|
function renderSocialIcons(block, context) {
|
|
615
624
|
if (isHiddenOnAll(block)) return "";
|
|
@@ -621,6 +630,7 @@ function renderSocialIcons(block, context) {
|
|
|
621
630
|
const align = block.align;
|
|
622
631
|
const iconSize = block.iconSize;
|
|
623
632
|
const iconStyle = block.iconStyle;
|
|
633
|
+
const assetDir = socialIconAssetDir(iconStyle, block.iconTone);
|
|
624
634
|
const spacing = block.spacing;
|
|
625
635
|
let iconSizePx;
|
|
626
636
|
switch (iconSize) {
|
|
@@ -655,7 +665,7 @@ function renderSocialIcons(block, context) {
|
|
|
655
665
|
${icons.map((icon, index) => {
|
|
656
666
|
const platform = icon.platform;
|
|
657
667
|
const url = escapeAttr(icon.url);
|
|
658
|
-
const iconSrc = `${context.socialIconsBaseUrl}/${
|
|
668
|
+
const iconSrc = `${context.socialIconsBaseUrl}/${assetDir}/${platform}.png`;
|
|
659
669
|
const rightPad = index === iconCount - 1 ? 0 : spacing;
|
|
660
670
|
return `<mj-social-element src="${iconSrc}" href="${url}" icon-size="${iconSizePx}px" padding="0 ${rightPad}px 0 0" border-radius="${borderRadius}" background-color="transparent"></mj-social-element>`;
|
|
661
671
|
}).join("\n")}
|
|
@@ -960,6 +970,19 @@ function renderBlock(block, context) {
|
|
|
960
970
|
//#endregion
|
|
961
971
|
//#region src/index.ts
|
|
962
972
|
/**
|
|
973
|
+
* Makes a full-width button's whole fill clickable. MJML sizes a button's `<a>`
|
|
974
|
+
* only for a px width, so without this rule the link of a `100%` button stays
|
|
975
|
+
* the size of its label.
|
|
976
|
+
*
|
|
977
|
+
* It sits in the inline `<mj-style>` so `mjml`'s juice pass writes it onto the
|
|
978
|
+
* `<a>`; MRML's default build emits that block as a plain `<style>` instead.
|
|
979
|
+
* `!important` lets it beat MJML's inline `display:inline-block` either way.
|
|
980
|
+
* Every template carries it, so nothing has to walk the tree for full-width
|
|
981
|
+
* buttons: juice drops a rule that matches nothing, so with `mjml` it costs
|
|
982
|
+
* nothing in the compiled HTML.
|
|
983
|
+
*/
|
|
984
|
+
const BUTTON_FULL_WIDTH_RULE = `.${BUTTON_FULL_WIDTH_CSS_CLASS} a { display: block !important; }`;
|
|
985
|
+
/**
|
|
963
986
|
* Render template content to an MJML string.
|
|
964
987
|
*
|
|
965
988
|
* The function is async because resolving custom blocks may require
|
|
@@ -998,6 +1021,7 @@ async function renderToMjml(content, options) {
|
|
|
998
1021
|
</mj-attributes>${fontDeclarations}
|
|
999
1022
|
<mj-style inline="inline">
|
|
1000
1023
|
${richTextStylesheet(collectParagraphGaps(blocks), contentDirection)}
|
|
1024
|
+
${BUTTON_FULL_WIDTH_RULE}
|
|
1001
1025
|
</mj-style>
|
|
1002
1026
|
<mj-style>
|
|
1003
1027
|
a { color: ${linkColor}; text-decoration: ${linkDecoration}; }
|
|
@@ -1139,6 +1163,6 @@ function renderCustomBlockStylesheets(stylesheets) {
|
|
|
1139
1163
|
return stylesheets.map((css) => `\n <mj-style>\n${css}\n </mj-style>`).join("");
|
|
1140
1164
|
}
|
|
1141
1165
|
//#endregion
|
|
1142
|
-
export { DEFAULT_SOCIAL_ICONS_BASE_URL, RICH_TEXT_CSS_CLASS, RenderContext, UNRENDERABLE_MARKER_PREFIX, convertMergeTagsToValues, escapeAttr, escapeHtml, getCssClassAttr, getCssClasses, getWidthPercentages, getWidthPixels, isHiddenOnAll, renderBlock, renderToMjml, renderUnrenderableBlock, resolveParagraphGap, richTextGapClass, toPaddingString };
|
|
1166
|
+
export { BUTTON_FULL_WIDTH_CSS_CLASS, DEFAULT_SOCIAL_ICONS_BASE_URL, RICH_TEXT_CSS_CLASS, RenderContext, UNRENDERABLE_MARKER_PREFIX, convertMergeTagsToValues, escapeAttr, escapeHtml, getCssClassAttr, getCssClasses, getWidthPercentages, getWidthPixels, isHiddenOnAll, renderBlock, renderToMjml, renderUnrenderableBlock, resolveParagraphGap, richTextGapClass, toPaddingString };
|
|
1143
1167
|
|
|
1144
1168
|
//# sourceMappingURL=index.js.map
|