useblocks 1.3.4 → 1.3.8

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +21 -0
  3. package/iframe/.vite/manifest.json +4 -4
  4. package/iframe/css/sandbox-dark.css +2 -9
  5. package/iframe/css/sandbox-light.css +2 -9
  6. package/iframe/css/sandbox.css +13 -23
  7. package/iframe/{iframe-eblock.6067f806.html → iframe-eblock.a0b8903e.html} +2 -2
  8. package/iframe/{iframe.6067f806.html → iframe.a0b8903e.html} +2 -2
  9. package/iframe/js/elMarkupHelper.C1NUEUOF.js +279 -0
  10. package/iframe/js/{iframe-eblock.body.6067f806.js → iframe-eblock.body.a0b8903e.js} +1 -1
  11. package/iframe/js/iframe-eblock.js +2 -2
  12. package/iframe/js/iframe.body.a0b8903e.js +129 -0
  13. package/iframe/js/iframe.js +2 -2
  14. package/package.json +1 -1
  15. package/runtime/react/index.js +1 -1
  16. package/static/core/{ea7c2c44.js → 1b6e3017.js} +1 -1
  17. package/static/core/2ca6f0ad.js +19 -0
  18. package/static/core/{3e34d695.js → 2d458997.js} +1 -1
  19. package/static/core/{398809e7.js → 31aad6a0.js} +1 -1
  20. package/static/core/3339abc3.js +1 -0
  21. package/static/core/3d73b614.js +1 -0
  22. package/static/core/{0f33f820.js → 3e55fbd4.js} +1 -1
  23. package/static/core/3fc88c79.js +1 -0
  24. package/static/core/{2135fa81.js → 4a69114d.js} +1 -1
  25. package/static/core/4e869a27.js +1 -0
  26. package/static/core/{28a3c758.js → 4f9f6515.js} +1 -1
  27. package/static/core/55a6e3bc.js +163 -0
  28. package/static/core/{d3a3d35f.js → 58b98b23.js} +2 -2
  29. package/static/core/{4f3c76a3.js → 5bf0cc25.js} +1 -1
  30. package/static/core/{17083884.js → 64a5118e.js} +1 -1
  31. package/static/core/{18ab364c.js → 6584ba9a.js} +1 -1
  32. package/static/core/74b30e13.js +1 -0
  33. package/static/core/{19740098.js → 75b3d05d.js} +2 -2
  34. package/static/core/7a1ca179.js +1 -0
  35. package/static/core/{13b95c98.js → 80f29ed0.js} +1 -1
  36. package/static/core/{f8eeeaf9.js → 851da4d1.js} +1 -1
  37. package/static/core/{8b7571c7.js → 88ed7988.js} +1 -1
  38. package/static/core/91a91433.js +1 -0
  39. package/static/core/9f12c233.js +1 -0
  40. package/static/core/{401a0cfb.js → a2fb7ae9.js} +1 -1
  41. package/static/core/a7e83e25.js +10 -0
  42. package/static/core/{5519258a.js → addbb53c.js} +1 -1
  43. package/static/core/{66619f08.js → b1edf5c5.js} +6 -6
  44. package/static/core/{78d9a411.js → b79eddad.js} +1 -1
  45. package/static/core/bd188fca.js +1 -0
  46. package/static/core/{a598ff39.js → c015f53f.js} +1 -1
  47. package/static/core/c0f26c01.js +1 -0
  48. package/static/core/{840b1cdc.js → cad7dc27.js} +1 -1
  49. package/static/core/d4aa63e7.js +1 -0
  50. package/static/core/d5774798.js +1 -0
  51. package/static/core/d5cd129a.js +1 -0
  52. package/static/core/d67c9b4e.js +2 -0
  53. package/static/core/{b060be67.js → d7ccd97b.js} +1 -1
  54. package/static/core/{807a1f00.js → e4ebcc13.js} +1 -1
  55. package/static/core/e6079a68.js +1 -0
  56. package/static/core/{e7a5e467.js → e85778fc.js} +1 -1
  57. package/static/core/ec23adac.js +1 -0
  58. package/static/core/{760dd956.js → f06286dd.js} +1 -1
  59. package/static/core/{7bf0fabd.js → f370243f.js} +1 -1
  60. package/static/core/{eb02ff3a.js → ffabcd69.js} +3 -3
  61. package/static/esm/{3ce60f99.js → b6a1b54a.js} +1 -1
  62. package/static/umd-runtime/{runtime.BqqI2xz2.js → runtime.B77pxBrU.js} +1 -1
  63. package/useblocks-core.a0b8903e.js +874 -0
  64. package/useblocks-esm.js +53 -39
  65. package/{useblocks-po.6067f806.js → useblocks-po.a0b8903e.js} +1 -1
  66. package/useblocks.d.ts +95 -5
  67. package/useblocks.js +54 -40
  68. package/vendor/useblocks-ui-kit/package.json +1 -1
  69. package/iframe/js/elMarkupHelper.CnysQPQn.js +0 -278
  70. package/iframe/js/iframe.body.6067f806.js +0 -129
  71. package/static/core/20f8e2cc.js +0 -1
  72. package/static/core/94ba164b.js +0 -28
  73. package/useblocks-core.6067f806.js +0 -859
@@ -1 +1 @@
1
- __useblocks__.define("static/core/28a3c758.js",["require","exports","module","static/core/2ff39ddf.js","static/core/48432fd6.js","static/core/cd8bd365.js","static/core/78d9a411.js","static/core/a598ff39.js","static/core/8b7571c7.js"],function(r,i,x){const b=r("./2ff39ddf.js"),s=r("./48432fd6.js"),n=r("./cd8bd365.js"),_=r("./78d9a411.js"),j=r("./a598ff39.js"),d=r("./8b7571c7.js");function p(t){return t?.tagName===s.SCRIPT_STAND_IN.toUpperCase()}function a(t){return p(t)&&t.src?.startsWith("https://cdn.ampproject.org/v0")}var u=t=>a(t)||_.isAmpElement(t)||s.isForm(t),h=t=>{if(u(t))return!0;if(s.isElement(t)||s.isDocument(t)){for(const c of t.querySelectorAll("*"))if(u(c))return!0}return!1};async function y(t,c={amp:!0,text:!1},l){const A=c===!0||typeof c=="object"&&c.amp,E=c===!0||typeof c=="object"&&c.text;typeof t=="string"&&(t={code:t});let m;const o={html:"",ampHtml:"",text:""};try{o.html=t.code?await n.prepareHTML(t.code||"",[800],t.utm_parameters,async e=>{m=h(e.document),m&&await s.processAmp(e,"html")},l):""}catch(e){throw new Error("[useblocks] compileEmail: не удалось собрать html письма",{cause:e})}try{o.ampHtml=A&&t.code&&m?await n.prepareHTML(t.code||"",[800],t.utm_parameters,e=>{s.processAmp(e,"amp")},l):""}catch{}try{o.text=E&&t.code?await n.prepareHTML(t.code||"",[800],t.utm_parameters,async e=>{e.handleReadHtml(f=>{f.html=j.convert(f.contentDocument,d.EmailTextPlainConvertOptions)})}):""}catch{}return{...t,compiled:o}}i.compileEmail=y,i.isAmpScript=a,i.isScriptElement=p});
1
+ __useblocks__.define("static/core/4f9f6515.js",["require","exports","module","static/core/2ff39ddf.js","static/core/a71d1c3a.js","static/core/438121be.js","static/core/b79eddad.js","static/core/c015f53f.js","static/core/88ed7988.js"],function(r,i,x){const b=r("./2ff39ddf.js"),s=r("./a71d1c3a.js"),n=r("./438121be.js"),_=r("./b79eddad.js"),j=r("./c015f53f.js"),d=r("./88ed7988.js");function p(t){return t?.tagName===s.SCRIPT_STAND_IN.toUpperCase()}function a(t){return p(t)&&t.src?.startsWith("https://cdn.ampproject.org/v0")}var u=t=>a(t)||_.isAmpElement(t)||s.isForm(t),h=t=>{if(u(t))return!0;if(s.isElement(t)||s.isDocument(t)){for(const c of t.querySelectorAll("*"))if(u(c))return!0}return!1};async function y(t,c={amp:!0,text:!1},l){const A=c===!0||typeof c=="object"&&c.amp,E=c===!0||typeof c=="object"&&c.text;typeof t=="string"&&(t={code:t});let m;const o={html:"",ampHtml:"",text:""};try{o.html=t.code?await n.prepareHTML(t.code||"",[800],t.utm_parameters,async e=>{m=h(e.document),m&&await s.processAmp(e,"html")},l):""}catch(e){throw new Error("[useblocks] compileEmail: не удалось собрать html письма",{cause:e})}try{o.ampHtml=A&&t.code&&m?await n.prepareHTML(t.code||"",[800],t.utm_parameters,e=>{s.processAmp(e,"amp")},l):""}catch{}try{o.text=E&&t.code?await n.prepareHTML(t.code||"",[800],t.utm_parameters,async e=>{e.handleReadHtml(f=>{f.html=j.convert(f.contentDocument,d.EmailTextPlainConvertOptions)})}):""}catch{}return{...t,compiled:o}}i.compileEmail=y,i.isAmpScript=a,i.isScriptElement=p});
@@ -0,0 +1,163 @@
1
+ __useblocks__.define("static/core/55a6e3bc.js",["require","exports","module","static/core/2ff39ddf.js","static/core/a71d1c3a.js","static/core/3339abc3.js","static/core/d67c9b4e.js","static/core/d5774798.js"],function(u,k,Y){const X=u("./2ff39ddf.js"),a=u("./a71d1c3a.js"),R=u("./3339abc3.js"),c=u("./d67c9b4e.js"),b=u("./d5774798.js");var S=["# Rows of an email",'You add rows to the open email with row.insertHtml. Send only rows: an optional <style em="styles"> with the @media rules for every em-mob-* class the rows use, then one or more <tr em="block">.','The document shell, TR em="group" and table.em-narrow-table already exist in the email: never send <html>, <head>, <body>, em="group" or em-narrow-table.',"Make the rows as wide as the email: take the width from document.getSettings (660 px when it is not set).","Design the rows freely and richly: backgrounds, cards, columns, images, buttons, dividers, footers. Write all copy yourself in the language of the user.","Images: use real https addresses; for an illustration without a source use https://placehold.co/WIDTHxHEIGHT with the real pixel size.","row.insertHtml checks the rows against the rules below and answers invalidMarkup with a list of problems: fix them and send the rows again.","The rules below come from the converter of whole emails; where they speak of a source email, read them as the design you make."].join(`
2
+ `),O=[`## EmailMaker document architecture (mandatory hierarchy)
3
+ Build from the outside in (ASCII tree):
4
+
5
+ BODY (reset padding/margin on body if needed)
6
+ └── TABLE cellpadding="0" cellspacing="0" border="0" width="100%" style="font-size: 1px; line-height: normal;" (full-width wrapper)
7
+ └── TR em="group"
8
+ └── TD align="center" (MUST hold the outer background color for the email or group)
9
+ └── TABLE class="em-narrow-table" (main content column, typically ~600px effective width)
10
+ └── TR em="block" (repeat per horizontal section)
11
+ └── TD (block padding/background live here)
12
+ └── TABLE = Layout Table (columns) — see below
13
+
14
+ - em="group": on the TR that wraps the main container. Multiple groups are allowed if the design has distinct full-width background bands.
15
+ - em-narrow-table: fixed-width email container. Do not put the global outer background on this table; keep it transparent so the outer background shows in side gutters. Apply outer letter background on the first TD inside the TR em="group".
16
+ - In <style em="styles">, .em-narrow-table MUST appear only inside this @media block (not as a global rule). The width values in the media query MUST match the email's actual width (NNNpx):
17
+ @media only screen and (max-device-width:NNNpx),only screen and (max-width:NNNpx) {
18
+ .em-narrow-table {
19
+ width: 100% !important;
20
+ max-width: NNNpx !important;
21
+ min-width: 320px !important;
22
+ }
23
+ }
24
+ Set NNN to the same pixel width as on the table.em-narrow-table element (max-width in its inline style, else min-width, else width; default 660px).
25
+ - Wrap table.em-narrow-table for Outlook/IE with conditional comments (same width W as the narrow table):
26
+ <!--[if (gte mso 9)|(IE)]>
27
+ <table cellpadding="0" cellspacing="0" border="0" width="W"><tr><td>
28
+ <![endif]-->
29
+ ... em-narrow-table ...
30
+ <!--[if (gte mso 9)|(IE)]>
31
+ </td></tr></table>
32
+ <![endif]-->
33
+ Place the open comment immediately before em-narrow-table and the close comment immediately after its closing </table> (typically inside tr em="group" > td align="center").
34
+ - Inside the same @media block, declare a CSS rule for **every** em-mob-* class that appears in the HTML body (only classes actually used). Typical patterns:
35
+ - .em-mob-wrap { display: block!important; }
36
+ - .em-mob-wrap.em-mob-wrap-cancel { display: table-cell!important; } when em-mob-wrap-cancel is used
37
+ - .em-mob-width-100perc { width: 100%!important; max-width: 100%!important; }
38
+ - .em-mob-height-{N}px { height: Npx!important; }
39
+ - .em-mob-padding_{left|right|top|bottom}-{N} { padding-*: Npx!important; }
40
+ - .em-mob-text_align-{left|center|right}, .em-mob-table_align-{left|center|right}
41
+ - .em-mob-width-auto, .em-mob-font_size-{N}px, .em-mob-line_height-{N}px as needed
42
+ - Do not put em-mob-* rules outside this @media block. Do not reference em-mob-* classes in CSS without matching rules in this block.
43
+ - em="block": one block = one visual horizontal strip (one inner layout table with exactly one tr). If sections stack header, hero, body, footer in one table row, split into separate em="block" rows. NEVER nest a tr em="block" inside another tr em="block" or inside an extra wrapper table.
44
+ - Layout table (inside every block): Required even for a single full-width column. The TABLE that is the direct child of TR[em="block"] > TD must:
45
+ - NOT have a width attribute and NOT use style="width:..." on that table.
46
+ - MUST use class="em-mob-width-100perc" and cellpadding="0" cellspacing="0" border="0".
47
+ - MUST be the DIRECT child of the TD inside TR[em="block"]. Do not wrap it in another table.
48
+ - Column cells: use td width="NNN" class="em-mob-wrap em-mob-width-100perc". Every em-mob-wrap column must have an explicit width attribute.
49
+ - **No nested em-mob-wrap:** em-mob-wrap belongs only on layout **column** TDs inside the layout table row. Forbidden: block TD with class em-mob-wrap; forbidden: an extra wrapper table whose sole cell is td.em-mob-wrap wrapping the real layout table (block TD → layout table → column TDs with em-mob-wrap — never block TD → table → td.em-mob-wrap → layout table → td.em-mob-wrap).
50
+ - **No horizontal padding on the column TDs of a multi-column row:** when the layout row holds two or more content columns, do not set padding-left, padding-right, or any padding shorthand that adds left/right inset on those cells (invalid: td.em-mob-wrap style="padding: 0 0 0 32px") — the gap TD carries the space between them. Horizontal inset inside such a column belongs on the **inner td** of each em="atom". A **single** column TD that carries a card box is the exception, see "Card blocks". Block TD (parent of the layout table) may still use horizontal padding for the whole section; gap TDs stay padding-free aside from height/spacing classes.
51
+ - em="atom": every final content unit (text block, image, button) sits in its own wrapper: table width="100%" cellpadding="0" cellspacing="0" border="0" em="atom" with **exactly one** tr and **exactly one** td inside that table (single-row atom only). Forbidden: two or more tr inside the same table em="atom" (e.g. nav links as multiple rows in one atom). For multiple items in one column, use **separate** atom tables stacked vertically (each with its own single tr/td). Never put a naked img directly in the layout table — wrap images in an atom.
52
+ - Text atoms: put the visible copy inside an inner DIV (see "Text atoms" under Typography). Do not place font-size, line-height, font-family, color, font-weight, letter-spacing, or text-align on the atom TD.
53
+
54
+ Forbidden chain: TR[em="block"] > TD directly containing TABLE[em="atom"] without a layout table in between. Always: block TD → layout table → column TD(s) → atom(s).`,`## Card blocks
55
+ A block is often a card: an outer gap around it, and inside a box with its own background colour, background image, border-radius and inner padding. Build it like this:
56
+ - **Block TD** carries only the outer gap — vertical padding, plus horizontal padding if the source has one. No card background or radius here.
57
+ - **Layout table** as usual, class="em-mob-width-100perc", direct child of the block TD.
58
+ - **Its single column TD** carries the card box: bgcolor, background image, border-radius, inner padding. This is the one place a column TD may hold left/right padding.
59
+ - Atoms go inside that column TD. A card needing two or more columns gets a **nested** layout table inside the card, with its own column and gap TDs.
60
+ Never drop the card box when a block turns out to be multi-column: background, background image and radius belong to the block whether it has one column or three.`,`## Atom granularity
61
+ An atom is the unit the user edits, moves and deletes.
62
+ - **Everything stacked vertically is its own atom:** a heading, each paragraph, each list item, an image, a button, a divider. Never wrap a vertical stack (a product card, a list, a footer column) into one atom.
63
+ - **A row of like small items on one line is one atom** with an inner table: social icons, a pair of logos, a rating scale.
64
+ - **Content outside an atom does not exist.** Any visible text, image or link inside TR em="block" sits inside a table em="atom". Gap TDs holding only &nbsp; are not content.`,`## Multi-column rows and gap columns (critical)
65
+ When a block has two or more columns, insert a gap td between every pair of content columns:
66
+ td width="{gap}" class="em-mob-wrap em-mob-height-{GAP}px" with &nbsp;
67
+ If columns touch (0px gap), still output:
68
+ td width="0" class="em-mob-wrap em-mob-height-0px" with &nbsp;
69
+ Do not simulate horizontal gaps only with padding on content columns when a gap column should carry it. For multi-column blocks, avoid em-mob-padding_bottom on content columns when a non-zero gap column handles mobile spacing (gap column height class provides vertical spacing when columns stack).
70
+
71
+ ### Column order and dir
72
+ **The desktop column order is not negotiable:** on desktop columns appear in the same order as in the source. Swapping them for a nicer mobile stack mirrors the block and reads as a broken letter. When DOM order must differ from desktop order (to choose which column stacks on top), restore the desktop with dir — never by leaving the columns swapped.
73
+ - Normally dir="rtl" goes on the **block TD**, with dir="ltr" on each content column.
74
+ - Inside a card the block TD is taken by the outer gap, so there dir="rtl" goes on the layout table of that row, again with dir="ltr" on each content column and on the gap TD.
75
+
76
+ ### Worked case: text left + image-only right
77
+ The common reason to reorder the DOM. Put the **image** in the first content td and the **text** in the second, so the image stacks on top on mobile, and restore the desktop order with dir as described above (dir="rtl" on the block TD, dir="ltr" on both content tds, gap td unchanged). Do not use this when both columns hold substantial text — only for a text + image-only pair. Never put dir="rtl" on the layout TR: many clients mishandle direction on a row.`,`## Typography and fonts
78
+ ### Text atoms (mandatory inner DIV)
79
+ - For every em="atom" that carries body copy, headings, captions, lists, or rich text: wrap the content in a DIV. The use of <p> and <h1>-<h6> tags is STRICTLY FORBIDDEN. Only <div> tags are allowed for text elements. Put font-size, line-height, color, font-weight, letter-spacing, direction, and mso-line-height-alt in the DIV inline style. Do NOT use text-align on the DIV. Instead, use the align attribute on the parent TD (the atom's inner TD) to control text alignment. Supply font-family via inline style for web-safe stacks, or via class="em-font-..." when the source uses a non-standard face (see Font stacks). Match EmailMaker reference HTML (typography on DIV, not on the atom TD).
80
+ - **Paragraph splitting:** If the source HTML contains multiple paragraphs (e.g., multiple <p> or <div> elements inside a single text block), they MUST be split during conversion. Each paragraph MUST be wrapped in its own separate em="atom" table, stacked vertically. Do NOT combine multiple paragraphs into a single atom. Any vertical spacing (like margin-bottom on the original <p>) MUST be converted to padding-bottom on the inner TD of that specific atom.
81
+ - The atom's inner TD must not duplicate typographic properties (font-size, color, etc.). The TD MUST hold the align attribute (e.g. align="center") for text alignment, and may hold other **layout-only** styles: padding-* (including padding-left/right for inset within the column — use here, not on em-mob-wrap column TDs), valign, width.
82
+ - Inline links/spans inside the typography DIV are fine; keep the outer wrapper as DIV with the base type styles.
83
+
84
+ ### Font stacks
85
+ - **Web-safe / standard fonts** (Arial, Helvetica, Times New Roman, Verdana, Georgia, Tahoma, Courier New, sans-serif, serif): put **font-family in the typography DIV inline style** (e.g. style="font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#333333;"). Do **not** use generic em-font-* tokens such as em-font-sans-serif for these.
86
+ - **Custom faces used by the source** (a web font the source loads through a stylesheet link, or a non-web-safe family name in its font-family): use EmailMaker **em-font-***:
87
+ - In head: link rel="stylesheet" with em-class="em-font-{Name}" pointing at the same stylesheet URL the source used.
88
+ - In style em="styles": matching .em-font-{Name} { font-family: ... } rules, keeping the fallback chain the source declared.
89
+ - On typography DIVs: class="em-font-{Name}" for copy in that face; keep font-size, line-height, color, etc. in inline style on the same DIV (but NOT text-align). Do **not** put the custom family name in inline font-family when the class supplies it.
90
+ - Forbidden: div with class="em-font-sans-serif" and only font-size/color in style — use inline font-family for standard stacks instead.
91
+ - Never put non-web-safe raw font names in inline font-family on DIVs (Outlook breaks); custom faces go through em-font-* + head link + em="styles" only.`,`## Buttons
92
+ - By default, buttons MUST be converted WITHOUT VML. The standard button structure is based on a table cell with background and border-radius, containing an <a> tag:
93
+ <table cellpadding="0" cellspacing="0" border="0" width="100%" class="em-mob-width-100perc" em="atom">
94
+ <tr>
95
+ <td style="padding: 10px 0;">
96
+ <table cellpadding="0" cellspacing="0" border="0" width="200" class="em-mob-width-100perc">
97
+ <tr>
98
+ <td align="center" valign="middle" height="41" bgcolor="#1C52DC" style="height: 41px; background-color: #1C52DC; border-radius: 5px;">
99
+ <a href="URL" target="_blank" style="display: block; font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #FFFFFF; font-size: 16px; line-height: 41px; text-decoration: none; white-space: nowrap;">
100
+ Button Label
101
+ </a>
102
+ </td>
103
+ </tr>
104
+ </table>
105
+ </td>
106
+ </tr>
107
+ </table>
108
+ - The background color, height, and border-radius MUST be applied to the <td> that directly wraps the <a> tag.
109
+ - The <a> tag MUST have display: block, text-decoration: none, and its line-height MUST match the height of the button.
110
+ - Do NOT use the bulletproof VML (<v:roundrect>) structure by default during conversion. The VML structure is only applied later by the editor's specific settings if the user explicitly enables "Outlook rounding".`,`## Repeated elements
111
+ Cells of one row or items of one list that play the same role are identical in everything except their text, link and image: same attributes, same set of CSS properties, same structure. A different colour on an accent item is design; a property present on the first items and missing on the last is a slip. Output every item of a repeating group in full however long the row is — the fifth cell gets the same attributes as the first.`,`## CSS and layout prohibitions
112
+ - No flexbox/grid for layout. Table-based layout only.
113
+ - No margin on content elements (no margin on div/img/table/td). The ONLY exception is margin: 0 auto; strictly for centering tables.
114
+ - No overflow properties.
115
+ - **Never put padding on a TABLE, a TR or a typography DIV.** Outlook's Word engine ignores padding on a table and the spacing silently disappears. Spacing lives on TDs.
116
+ - No colspan / rowspan — use nested tables instead.
117
+ - Do not use border-collapse: collapse; on tables. It MUST be removed from all tables.
118
+ - Do not use align="left" or align="right" on TABLE for layout; use patterns compatible with EmailMaker (e.g. em-mob-table_align-center for centering).
119
+ - Avoid padding on **typography** divs for vertical rhythm when the same gap can live on the atom TD (or block TD); prefer padding on those TDs or spacer rows/divs with &nbsp; for typography-free spacers.`,`## Spacing discipline
120
+ - Encode vertical space with padding on the relevant td (block TD, or inner td inside em="atom").
121
+ - Encode horizontal inset within a content column with padding on **atom** inner td only; never with left/right padding on a column td of a multi-column row (a single column TD carrying a card box is the exception).
122
+ - Spacer div pattern when needed: div style height Npx; line-height Npx; font-size 1px; with &nbsp;
123
+ - Transparent gap between colored sections can use a dedicated spacer row tr em="block" / td height="N" with matching bgcolor if required.`,`## Snippet: single-column block (structure only, not literal pixels)
124
+ <tr em="block">
125
+ <td style="padding: 20px 40px;" bgcolor="#FFFFFF">
126
+ <table class="em-mob-width-100perc" cellpadding="0" cellspacing="0" border="0">
127
+ <tr>
128
+ <td width="520" class="em-mob-wrap em-mob-width-100perc">
129
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" em="atom">
130
+ <tr><td style="padding-bottom:12px;"><div style="font-family:Arial,sans-serif;font-size:14px;line-height:20px;color:#333333;">Text</div></td></tr>
131
+ </table>
132
+ </td>
133
+ </tr>
134
+ </table>
135
+ </td>
136
+ </tr>`,`## Snippet: two columns with mandatory gap
137
+ <tr em="block">
138
+ <td style="padding: 20px 40px;">
139
+ <table class="em-mob-width-100perc" cellpadding="0" cellspacing="0" border="0">
140
+ <tr>
141
+ <td width="250" valign="top" class="em-mob-wrap em-mob-width-100perc">... atom ...</td>
142
+ <td width="20" class="em-mob-wrap em-mob-height-20px">&nbsp;</td>
143
+ <td width="250" valign="top" class="em-mob-wrap em-mob-width-100perc">... atom ...</td>
144
+ </tr>
145
+ </table>
146
+ </td>
147
+ </tr>`,`## Snippet: text left + image-only right (dir for mobile stack; image first in DOM, gap, then text)
148
+ <tr em="block">
149
+ <td dir="rtl" style="padding: 20px 40px;">
150
+ <table class="em-mob-width-100perc" cellpadding="0" cellspacing="0" border="0">
151
+ <tr>
152
+ <td width="250" valign="top" class="em-mob-wrap em-mob-width-100perc" dir="ltr">... image atom ...</td>
153
+ <td width="20" class="em-mob-wrap em-mob-height-20px">&nbsp;</td>
154
+ <td width="250" valign="top" class="em-mob-wrap em-mob-width-100perc" dir="ltr">... text atom ...</td>
155
+ </tr>
156
+ </table>
157
+ </td>
158
+ </tr>`,`## Visual styles (backgrounds, borders, radius)
159
+ - Apply background-color, borders, box-shadow, border-radius on td per EmailMaker rules — not on table/tr for ownership of the visual box. Gradients: also set a solid background-color fallback (average of gradient) on the same td.`],A=/\bEmailMaker\b/g;function F(){return[S,...O].join(`
160
+
161
+ `).replace(A,"editor")}var T={text:e=>a.Text_default(e),header:e=>a.Header_default(e),image:()=>a.image,button:e=>a.Button_default(e),spacer:()=>a.Spacer_default,divider:()=>a.Divider_default,"list-ul":e=>a.ListUl_default(e),"list-ol":e=>a.ListOl_default(e),video:()=>a.video},J=Object.keys(T);function B(e,t){return a.isPlanLocked(e,a.getAtomPlanFeature(t))?void 0:{name:t,className:"",html:T[t](a.agentTranslator(e))}}function v(e){return e.flatMap(t=>{const o=v(t.children??[]),n=a.publicElementKind(t.type);return n==="none"?o:[{element:t.element,kind:n,...t.text?{text:t.text}:{},...o.length?{children:o}:{}}]})}var j=50,C=200,x=120;function D(e,t){return t===""?!e:(e??"").toLowerCase().includes(t.toLowerCase())}function L(e,{kind:t,textContains:o,where:n}){return t!==void 0&&a.publicElementKind(e.type)!==t||o!==void 0&&!D(e.text,o)?!1:Object.entries(n??{}).every(([r,i])=>typeof i!="string"||e.attrs!==void 0&&r in e.attrs&&D(e.attrs[r],i))}function U(e){const t=e.text&&e.text.length>x?`${e.text.slice(0,x)}…`:e.text;return{element:e.element,kind:a.publicElementKind(e.type),...t?{text:t}:{},...e.attrs}}function m(e,t){return a.askCanvasElement(e,t)}function h(e,t){return a.readOnlyRefusal(e)??a.askCanvasElement(e,t)}function N(e,t,o){return o.aborted?a.cancelledError():h(e,t)}function g(e,t,o,n){return(n.aborted?void 0:a.changedDocumentRefusal(e,t))??N(e,o,n)}function H(e){return"textReplacer"in e?a.err("invalidArgs",'"textReplacer" is written into the markup as it is; insert a merge variable with element.insertVariable.'):c.unsafeUrlRefusal(e)??c.fontNameRefusal(e)}async function z(e,t){const o=await b.readProjectBlocks(e);if(!o)return a.blocksNotLoaded();const n=o.find(i=>String(i.id)===t);if(!n)return a.err("notFound",`There is no block "${t}" in the project; take an id from block.list.`);const r=await b.projectBlockHtml(e,n);return r===void 0?a.err("unavailable",R.waitsForWrite(n)?"The block is being saved right now; try again in a moment.":"The block has no markup to insert; pick another one."):{html:r,type:"project",name:n.title??"",catalogBlock:n,project:n.project}}async function V(e,t){const o=await b.galleryBlockList(e);if(a.isResult(o))return o;const n=o.find(i=>String(i.id)===t);if(!n)return a.err("notFound",`There is no block "${t}" in the gallery; take an id from block.list with source "gallery".`);const r=await b.projectBlockHtml(e,n);return r===void 0?a.err("unavailable","The markup of the block could not be loaded."):{html:r,type:"common",name:n.title??"",catalogBlock:{...n,html:r},project:a.getCurrentProjectId(e)}}var P={1:{name:"column-one",html:a.column_1_default},2:{name:"column-two-50",html:a.column_2_50_default},"1:2":{name:"column-two-33",html:a.column_2_33_default},"2:1":{name:"column-two-66",html:a.column_2_66_default},3:{name:"column-three",html:a.column_3_default},4:{name:"column-four",html:a.column_4_default}},f="agent-row",W=25;async function I(e){const t=await m(e,{op:"tree",depth:1}),o=(t.ok?t.value.nodes.filter(n=>n.type==="structure"):[]).at(-1);return o?{element:o.element,place:"after"}:void 0}function _(e){return e.flatMap(t=>t.type==="column"||t.type==="floatBlock"?[t.element]:_(t.children??[]))}async function $(e,t){const o=await m(e,{op:"tree",root:t,depth:2});return o.ok?_(o.value.nodes):[]}function G(e){return{"element.delete":{precheck:()=>a.readOnlyRefusal(e),consent:a.elementConsent(e,({__:t},o,{kind:n,text:r})=>({title:t("Delete this element from the email"),...a.detailsOf(n,r)}))}}}function K(e){return{"element.getTree":async({root:t,depth:o})=>{const n=await m(e,{op:"tree",root:t,depth:o});if(!n.ok)return n;const r=n.value;return{nodes:v(r.nodes),truncated:r.truncated}},"element.find":async t=>{const o=await m(e,{op:"find",root:t.inside});if(!o.ok)return o;const{nodes:n,truncated:r}=o.value,i=n.filter(s=>a.publicElementKind(s.type)!=="none"&&L(s,t)),l=Math.min(Math.max(Math.round(t.limit??j),1),C);return{matches:i.slice(0,l).map(U),total:i.length,...r?{truncated:r}:{}}},"text.replace":({find:t,replace:o,matchCase:n,wholeWord:r,inside:i})=>h(e,{op:"replaceText",find:t,replace:o,matchCase:n,wholeWord:r,root:i}),"element.get":async({element:t})=>{const o=await m(e,{op:"get",element:t});if(!o.ok)return o;const{type:n,...r}=o.value;return{...r,kind:a.publicElementKind(n)}},"element.select":async({element:t})=>{const o=await m(e,{op:"select",element:t});return o.ok?void 0:o},"ui.highlight":async({element:t,durationMs:o})=>{const n=await m(e,{op:"highlight",element:t,durationMs:o});return n.ok?void 0:n},"element.setProps":async({element:t,props:o},n)=>H(o)??(a.isReadOnly(e)?a.readOnlyError():await c.closedFieldRefusal(e,t,o))??N(e,{op:"setProps",element:t,props:o},n.signal),"element.setText":({element:t,text:o})=>h(e,{op:"setText",element:t,text:o}),"row.insert":async({columns:t,at:o},n)=>{if(a.isReadOnly(e))return a.readOnlyError();const r=a.openDocument(e),i=P[t],l=await g(e,r,{op:"insertBlock",block:await a.prepareBlockInsert(e,{html:i.html,type:void 0,name:i.name,catalogBlock:{id:i.name,title:i.name,type:"structure"},project:a.getCurrentProjectId(e)}),at:o??await I(e)},n.signal);if(!l.ok)return l;const s=l.value?.element;return s?{element:s,columns:await $(e,s)}:void 0},"document.getMarkupRules":()=>F(),"row.insertHtml":async({html:t,at:o},n)=>{if(a.isReadOnly(e))return a.readOnlyError();const r=a.openDocument(e),{rows:i,findings:l,hasVariables:s,hasPreheader:q}=c.checkRowsMarkup(t),E=(s?a.featureRefusal(e,"variables","merge variables"):void 0)??c.preheaderRefusal(e,q);if(E)return E;if(l.length>0){const w=l.slice(0,W).map(d=>`- ${d.rule} at ${d.where}: ${d.detail}`).join(`
162
+ `);return a.err("invalidMarkup",`The rows break the markup rules in ${l.length} place(s); nothing was inserted. Fix and send again:
163
+ ${w}`)}const p=[];let M=o??await I(e);for(const w of i){if(n.signal.aborted)return a.err("aborted","The call was cancelled; the remaining rows were not inserted.");const d=await g(e,r,{op:"insertBlock",block:await a.prepareBlockInsert(e,{html:w,type:void 0,name:f,catalogBlock:{id:f,title:f,type:"structure"},project:a.getCurrentProjectId(e)}),at:M},n.signal);if(d.ok===!1)return p.length?a.err("partialInsert",`Inserted ${p.length} of ${i.length} rows (${p.join(", ")}); they stay in the document, in one undo step. The next row failed with ${d.error.code}: ${d.error.message}`):d;const y=d.value?.element;y&&(p.push(y),M={element:y,place:"after"})}return{rows:p}},"element.insert":async({kind:t,at:o},n)=>{if(a.isReadOnly(e))return a.readOnlyError();const r=B(e,t);if(!r)return a.planRefusal(`The "${t}" element is not available on the current plan.`);const i=a.openDocument(e),{atomHTML:l,name:s}=await a.prepareAtomInsert(e,r);return g(e,i,{op:"insertAtom",atom:{atomHTML:l??"",name:s},at:o},n.signal)},"block.insert":async({block:t,source:o,at:n},r)=>{if(a.isReadOnly(e))return a.readOnlyError();const i=a.openDocument(e),l=await(o==="gallery"?V(e,t):z(e,t));if(a.isResult(l))return l;const s=c.preheaderRefusal(e,c.holdsPreheader(l.html));return s||g(e,i,{op:"insertBlock",block:await a.prepareBlockInsert(e,l),at:n},r.signal)},"element.delete":async({element:t})=>{const o=await h(e,{op:"delete",element:t});return o.ok?void 0:o},"element.clone":({element:t})=>h(e,{op:"clone",element:t}),"element.move":({element:t,direction:o})=>h(e,{op:"move",element:t,direction:o})}}k.agentElementGates=G,k.agentElementHandlers=K});