@dextinity/agent-features 10.11.0-canary-20261028113708 → 10.11.0-canary-20261028130442
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/package.json +1 -1
- package/skills/dextinity-mail-react/SKILL.md +61 -4
- package/skills/dextinity-mail-react/references/components-and-theme.md +4 -0
- package/skills/dextinity-mail-react/references/dark-mode.md +36 -0
- package/skills/dextinity-mail-react/references/layout-patterns.md +9 -1
- package/skills/dextinity-mail-react/references/styling-and-customization.md +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dextinity/agent-features",
|
|
3
|
-
"version": "10.11.0-canary-
|
|
3
|
+
"version": "10.11.0-canary-20261028130442",
|
|
4
4
|
"description": "Agent features (skills and rules) for Dextinity projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"directory": "packages/agent-features",
|
|
@@ -94,7 +94,7 @@ const halfGap = columnGap / 2;
|
|
|
94
94
|
|
|
95
95
|
On mobile, reset the gap padding so content stretches full-width, and add a vertical margin between the stacked columns. Column padding compiles to an inner `<td>`, so target it via `.className > table > tbody > tr > td`.
|
|
96
96
|
|
|
97
|
-
Set `disableResponsiveBehavior` on **every** section with more than one column. It wraps the columns in an `MjmlGroup`, which is what makes MJML write their widths inline; without it the widths exist only in a `min-width` media query, and clients that drop that query — GMX
|
|
97
|
+
Set `disableResponsiveBehavior` on **every** section with more than one column. It wraps the columns in an `MjmlGroup`, which is what makes MJML write their widths inline; without it the widths exist only in a `min-width` media query, and clients that drop that query — GMX, Web.de and the Gmail apps with a non-Google account, for example — show the columns stacked. The group never stacks by itself, so write the mobile stacking into `registerStyles`, and target the column container one level deeper (`… > td > div`).
|
|
98
98
|
|
|
99
99
|
→ For complete patterns — two columns, three or more, fixed+fluid — with responsive styles, CSS targeting rules, the stacking strategies, and the `direction="rtl"` technique for controlling mobile stack order, read [`references/layout-patterns.md`](references/layout-patterns.md).
|
|
100
100
|
|
|
@@ -120,7 +120,7 @@ Email styling follows a **desktop-first** approach:
|
|
|
120
120
|
|
|
121
121
|
Never rely on `<style>` blocks for base/desktop layout. Set all default styles inline via MJML component props.
|
|
122
122
|
|
|
123
|
-
MJML breaks this rule for column widths: it puts them in a `min-width` media query, so a multi-column section stacks in any client that drops that query — GMX
|
|
123
|
+
MJML breaks this rule for column widths: it puts them in a `min-width` media query, so a multi-column section stacks in any client that drops that query — GMX, Web.de and the Gmail apps with a non-Google account, for example. See [Multi-Column Layouts](#multi-column-layouts).
|
|
124
124
|
|
|
125
125
|
### Prefer Theme Breakpoints
|
|
126
126
|
|
|
@@ -168,6 +168,13 @@ Don't use `<p>`, `<h1>`, `<h2>`, or other block-level HTML elements inside endin
|
|
|
168
168
|
|
|
169
169
|
Outlook calculates line-height using its own rules, causing unexpected vertical spacing. **Every time** you set `line-height` on a raw HTML element inside an ending tag (`MjmlRaw`, `MjmlText`, etc.), you must also set `mso-line-height-rule: exactly` as an inline style on the same element. This applies to `<span>`, `<td>`, `<div>`, or any other element where you manually control line height. `HtmlText` and built-in MJML components handle this automatically — but any hand-written HTML needs it explicitly.
|
|
170
170
|
|
|
171
|
+
### Do Not Set `line-height: 0` Around Images
|
|
172
|
+
|
|
173
|
+
Classic Outlook cuts off the top of an image when `line-height: 0` is set on the `<td>` that holds the image, or on its `<table>`: about `3px` with `font-size: 0`, about `20px` with the default font size. A `line-height: 0` on a `<span>` or link inside that `<td>` does not prevent it.
|
|
174
|
+
|
|
175
|
+
- Use `1px` instead of `0`, or leave `line-height` unset. Without `mso-line-height-rule: exactly`, any other `line-height` smaller than the image does not cut it: classic Outlook treats the value as a minimum. `MjmlTable` has a default `line-height` of `22px`, and that value does no harm. Do not set `lineHeight={0}` on `MjmlTable`.
|
|
176
|
+
- With `mso-line-height-rule: exactly`, a `line-height` smaller than the image cuts the image to that height. `HtmlText` sets the theme `line-height` (`20px` by default) with `mso-line-height-rule: exactly`, so do not put images in it.
|
|
177
|
+
|
|
171
178
|
### No CSS `background-image` in Outlook
|
|
172
179
|
|
|
173
180
|
Classic Outlook ignores `background-image` entirely. Use a VML-based workaround for Outlook support, or provide a `background-color` fallback for graceful degradation. See [Bulletproof Backgrounds](https://www.backgrounds.cm/).
|
|
@@ -182,13 +189,19 @@ Everything else, buttons and containers included, needs a VML `v:roundrect` writ
|
|
|
182
189
|
|
|
183
190
|
```html
|
|
184
191
|
<!--[if mso]>
|
|
185
|
-
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" arcsize="
|
|
192
|
+
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" arcsize="19%" stroked="f" style="width:199px;height:43px;">
|
|
186
193
|
<center>Button label</center>
|
|
187
194
|
</v:roundrect>
|
|
188
195
|
<![endif]-->
|
|
189
196
|
```
|
|
190
197
|
|
|
191
|
-
Set `arcsize` to the corner radius divided by the shorter side, capped at `50%` — `8px` on a `44px`-high button gives `
|
|
198
|
+
Set `arcsize` to the corner radius divided by the shorter declared side, capped at `50%` — `8px` on a `44px`-high button, declared `43px`, gives `19%`. Do not take the value from the VML specification; it is twice what Outlook needs.
|
|
199
|
+
|
|
200
|
+
More rules for a hand-written VML shape:
|
|
201
|
+
|
|
202
|
+
- Declare a `v:roundrect` or `v:oval` `1px` smaller in `width` and `height` than the size it must have, and compute `arcsize` from that declared size. Classic Outlook draws the shape `1px` larger, even with `stroked="f"`.
|
|
203
|
+
- Copy the link (`href` on the shape), the alignment and the padding from the HTML element that the shape replaces, and hide that element from classic Outlook with `<!--[if !mso]><!-->…<!--<![endif]-->`.
|
|
204
|
+
- Give the shape a width that fits its column. Classic Outlook does not shrink VML to its container, so a wider shape makes the whole mail wider.
|
|
192
205
|
|
|
193
206
|
See the [Litmus VML button snippet](https://litmus.com/community/snippets/7-bulletproof-button-vml-approach).
|
|
194
207
|
|
|
@@ -214,6 +227,50 @@ Yahoo Mail rewrites `height` into `min-height`, which is only a lower limit —
|
|
|
214
227
|
- An `<img>` that a media query shrinks with `height` keeps its original size — use `max-height`.
|
|
215
228
|
- A row whose height comes only from `height` on a `<td>` collapses to nothing, and the cell's background disappears with it — put the height on a `<div>` inside the cell, or use padding.
|
|
216
229
|
|
|
230
|
+
### Keep `}}` Out of the Head CSS
|
|
231
|
+
|
|
232
|
+
Outlook on the web (Outlook.com) and the Outlook iOS and Android apps drop everything after the first `}}` in a `<style>` tag. Minified `@media` blocks end in `}}`. mail-react separates the braces in the registered styles, but not in CSS that you add through the `head` slot of `MjmlMailRoot`; write `} }` there. See [email-bugs#92](https://github.com/hteumeuleu/email-bugs/issues/92).
|
|
233
|
+
|
|
234
|
+
### Gmail Drops Head CSS Past 16 kB
|
|
235
|
+
|
|
236
|
+
Gmail counts the content of all `<style>` tags together, MJML's own included. Past `16 kB` (`16,384` characters), Gmail removes the `<style>` tag that passes the limit. mail-react puts the registered styles and the CSS from the `head` slot of `MjmlMailRoot` in one `<style>` tag, placed last, so the mail loses all of that CSS. `registerStyles` emits the CSS of every imported module, used or not; mail-react minifies the registered CSS. Keep unused variants and modules out of the mail, and check the size: count the characters in all `<style>` tags of a full rendered mail. See [email-bugs#90](https://github.com/hteumeuleu/email-bugs/issues/90).
|
|
237
|
+
|
|
238
|
+
### MJML Sets `word-break: break-word` on Column Content
|
|
239
|
+
|
|
240
|
+
MJML writes `word-break: break-word` on the `<td>` around each child of a column, except `MjmlRaw`, and nested cells inherit it. In Outlook on the web, this breaks short content onto several lines when its cell sits next to a `width="100%"` cell, such as the marker cell of a list item. Set `word-break: normal` inline on the cell of the short content, together with `white-space: nowrap`. `white-space: nowrap` alone does not help: Outlook on the web removes it from inline styles, and it also removes the `nowrap` attribute. Resetting `overflow-wrap` does not help either.
|
|
241
|
+
|
|
242
|
+
### Style the Links That Mail Clients Create
|
|
243
|
+
|
|
244
|
+
Clients turn plain-text mail addresses, URLs and phone numbers into links of their own, without the mail's inline styles:
|
|
245
|
+
|
|
246
|
+
- Gmail (iOS and web), Outlook iOS, Apple Mail iOS: a CSS rule in the mail head for links inside text components restores the text style: `.mjmlText a, .htmlText a { color: inherit !important; font-family: inherit !important; font-size: inherit !important; line-height: inherit !important; font-weight: inherit !important; text-decoration: underline !important; }`. The rule also changes links you write yourself, because `inherit !important` wins over their inline styles. To keep a custom color, font or `text-decoration` on such a link, set it with `!important` (see `HtmlInlineLink` → Custom Color in [`references/components-and-theme.md`](references/components-and-theme.md)).
|
|
247
|
+
- Classic Outlook: colors these links blue, and accepts only one color for them in the whole mail. Set the color in the mail head, inside `<!--[if mso]><style>…</style><![endif]-->`, and choose a color with enough contrast on every background of the mail (`#767677` is an example):
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
a:link,
|
|
251
|
+
span.MsoHyperlink {
|
|
252
|
+
mso-style-priority: 99;
|
|
253
|
+
color: #767677;
|
|
254
|
+
text-decoration: underline;
|
|
255
|
+
}
|
|
256
|
+
a:visited,
|
|
257
|
+
span.MsoHyperlinkFollowed {
|
|
258
|
+
mso-style-priority: 99;
|
|
259
|
+
color: #767677;
|
|
260
|
+
text-decoration: underline;
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Dark Mode Repaints Colors, Not Most Images
|
|
265
|
+
|
|
266
|
+
In dark mode, Gmail iOS, Yahoo Mail on the web, classic Outlook, Outlook on the web, Outlook iOS and Outlook Mac change the colors of the mail but leave most images alone. So a color that must stay is safest inside an image. Gmail Android is the exception: it inverts images with few colors that it shows at about `64px` or less.
|
|
267
|
+
|
|
268
|
+
- Keep a background color: set `background-color` and a `background-image` of a `100×100` px solid PNG in the same color. Use this technique behind images only, not behind text: some clients keep the background but still change the text color, so the text disappears.
|
|
269
|
+
- Keep a logo readable: put a light background into the image file of the logo, not behind it. Some Gmail Android phones invert only the logo or only a separate background; in one image, both change together. On a dark section, put a background image in the section color behind the logo only, not behind the whole section (Gmail iOS, Outlook on the web).
|
|
270
|
+
- Classic Outlook ignores CSS background images; use a VML shape with `fillcolor` there.
|
|
271
|
+
|
|
272
|
+
→ For per-client behavior, placement rules and size limits, read [`references/dark-mode.md`](references/dark-mode.md).
|
|
273
|
+
|
|
217
274
|
---
|
|
218
275
|
|
|
219
276
|
## Theme Setup & Type-Safety
|
|
@@ -341,6 +341,8 @@ The base spacing value comes from `theme.text.bottomSpacing`. Variants can overr
|
|
|
341
341
|
|
|
342
342
|
Outlook Desktop ignores `<style>` blocks and applies its own "Hyperlink" style to `<a>` tags, overriding inherited CSS. `HtmlInlineLink` counters this by setting explicit inline styles for font properties (sourced from the parent text component's context). On modern clients, a responsive CSS reset ensures the link adapts when responsive variant overrides apply.
|
|
343
343
|
|
|
344
|
+
This works only inside `MjmlText` or `HtmlText` with a theme, and only for the properties that the theme or the text's props set. Properties that the theme or the text's props do not set fall back to `inherit`. Classic Outlook ignores `inherit`, and shows the link in its own blue and in Times New Roman.
|
|
345
|
+
|
|
344
346
|
### Custom Color
|
|
345
347
|
|
|
346
348
|
Use `!important` when setting a custom link color — the responsive reset uses `inherit !important`, which would otherwise take precedence:
|
|
@@ -381,6 +383,8 @@ Themed button, styled from `theme.button` (base styles plus variants). Falls bac
|
|
|
381
383
|
|
|
382
384
|
`theme.button.padding` is the inner spacing around the label; `MjmlButton`'s `padding` prop is the outer spacing. `fullWidth` makes the button span its container. A gradient `backgroundImage` overlays the solid `backgroundColor`, which stays the fallback for clients that drop `background-image` (Outlook). Outlook ignores `border-radius`, so rounded buttons render with square corners there.
|
|
383
385
|
|
|
386
|
+
For a hand-written full-width button, `display: block` on the `<a>` makes it fill its `<td>`. Do not add `width: 100%` and `box-sizing: border-box`: Yahoo Mail does not support `box-sizing`, so it adds the padding to the full width and the anchor overflows its container.
|
|
387
|
+
|
|
384
388
|
```tsx
|
|
385
389
|
<MjmlButton variant="primary" fullWidth href="https://example.com">
|
|
386
390
|
Click me
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Dark Mode
|
|
2
|
+
|
|
3
|
+
What mail clients change in dark mode, and the techniques tested against them. After each fix, test the mail again in every client in the table below: a fix for one client can break another.
|
|
4
|
+
|
|
5
|
+
## Client Behavior
|
|
6
|
+
|
|
7
|
+
| Client | Changes in dark mode |
|
|
8
|
+
| ------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| Gmail iOS | Background and text colors; leaves background images |
|
|
10
|
+
| Outlook on the web | Background and text colors; dark backgrounds get lighter; leaves background images |
|
|
11
|
+
| Outlook iOS | Background and text colors; dark backgrounds get lighter; leaves background images |
|
|
12
|
+
| Outlook Mac | Background colors; leaves background images |
|
|
13
|
+
| Yahoo Mail on the web | Light background colors; leaves background images |
|
|
14
|
+
| Gmail Android | Light background colors on some phones; inverts images with few colors that it shows at about `64px` or less per side |
|
|
15
|
+
| Classic Outlook (Windows) | Inverts background and text colors, dark backgrounds included; ignores CSS background images; leaves VML fills |
|
|
16
|
+
|
|
17
|
+
## Keep a Background Color
|
|
18
|
+
|
|
19
|
+
Set the color twice: as `background-color`, and as a `background-image` of a solid PNG in that color. Then the color stays in Gmail iOS, Outlook on the web, Outlook Mac, Outlook iOS and Yahoo Mail on the web. It does not stay in classic Outlook, or on some Gmail Android phones.
|
|
20
|
+
|
|
21
|
+
- Use a `100×100` px PNG. Gmail Android inverts a solid background image whose file is `8px` or less on one side, such as a `1×1` px PNG.
|
|
22
|
+
- Set both properties on every element that paints the background, such as the inner `<table>` of a section too. Otherwise Gmail iOS, Outlook iOS and Outlook on the web paint the dark color of that element over the image.
|
|
23
|
+
- On an MJML section, set `background-color` and `background-image` with `!important` in an inlined style. Otherwise the `background` shorthand that MJML writes comes after the image and removes it.
|
|
24
|
+
- Gmail Android also inverts the background image, whatever its file size, of a box that it shows at about `64px` or less per side. For a small box, put the color into the content image instead (see [Keep a Logo Readable](#keep-a-logo-readable)).
|
|
25
|
+
- Use this technique behind images only, not behind text. Outlook iOS turns dark text on a light background light, and Gmail iOS and Outlook on the web turn light text on a dark background dark. In both cases the text disappears.
|
|
26
|
+
- Name the PNG after its color, such as `001e50-100x100.png` for `#001e50`. When the theme color changes, replace the image too.
|
|
27
|
+
|
|
28
|
+
## Keep a Logo Readable
|
|
29
|
+
|
|
30
|
+
- Put the light background of a dark logo into the image file. When the logo and its background are separate, some Gmail Android phones invert only one of them, even with the solid PNG from [Keep a Background Color](#keep-a-background-color). These phones may also invert the whole image. Then the logo and its background change together, so they keep their contrast.
|
|
31
|
+
- On a dark section, put a background image in the section color behind the logo only, not behind the whole section. Gmail iOS and Outlook on the web lighten the section and darken its text, so a background image behind the whole section leaves dark text on a dark background.
|
|
32
|
+
- Gmail Android still inverts a logo with few colors that it shows at about `64px` or less per side. Widening the logo image avoids this, but it also widens a background image behind the logo whose size comes from the logo. No solution for both is known.
|
|
33
|
+
|
|
34
|
+
## Classic Outlook
|
|
35
|
+
|
|
36
|
+
Classic Outlook for Windows ignores CSS background images, so the background-image techniques above fail there. The `background-url` attribute of an MJML section draws a VML background, but that VML moves the content of the section. Draw the background behind the logo as a VML shape with `fillcolor` (a `v:roundrect` for rounded corners), and declare the shape `1px` smaller in width and height than the size it must have (see "No CSS `border-radius` in Outlook" in `SKILL.md`). Put the image in a `v:textbox`, wrap the shape in one `<!--[if mso]>…<![endif]-->` comment, and hide the HTML version with `<!--[if !mso]><!-->…<!--<![endif]-->`. Classic Outlook does not change VML fills in dark mode. Do not set `line-height: 0` on the element that holds the image in the `v:textbox`: classic Outlook then cuts off the top of the image.
|
|
@@ -27,7 +27,7 @@ Follow the BEM convention with camelCase blocks. Adapt the block name to the com
|
|
|
27
27
|
|
|
28
28
|
## Column Widths Must Be Inline
|
|
29
29
|
|
|
30
|
-
Set `disableResponsiveBehavior` on **every** section with more than one column, including sections that are meant to stack. The prop wraps the columns in an `MjmlGroup`, which is what makes MJML write their widths inline. Without it the widths exist only in a `min-width` media query, and clients that drop that query — GMX
|
|
30
|
+
Set `disableResponsiveBehavior` on **every** section with more than one column, including sections that are meant to stack. The prop wraps the columns in an `MjmlGroup`, which is what makes MJML write their widths inline. Without it the widths exist only in a `min-width` media query, and clients that drop that query — GMX, Web.de and the Gmail apps with a non-Google account, for example — show the columns stacked.
|
|
31
31
|
|
|
32
32
|
Two things follow:
|
|
33
33
|
|
|
@@ -36,6 +36,8 @@ Two things follow:
|
|
|
36
36
|
|
|
37
37
|
Inside a group, a column without a `width` prop gets `parseInt(100 / siblings)%` — `33%` for three columns, not `33.33%`. Set explicit widths when the count does not divide 100 evenly.
|
|
38
38
|
|
|
39
|
+
Pixel widths on columns inside `MjmlGroup` work, although MJML's documentation asks for percentages. MJML converts them to percentages inline, but MJML's head CSS keeps the pixel width with `!important` above the mobile breakpoint. So the columns do not shrink between the mobile breakpoint and the body width of the mail (`sizes.bodyWidth`). Override their widths with `registerStyles` in `theme.breakpoints.default.belowMediaQuery`, or use percentages.
|
|
40
|
+
|
|
39
41
|
---
|
|
40
42
|
|
|
41
43
|
## Symmetric Two-Column Layout (Equal Width)
|
|
@@ -404,3 +406,9 @@ Key behaviors:
|
|
|
404
406
|
- `MjmlWrapper` applies `theme.colors.background.content` as its default background when a theme is present, so the `backgroundColor` prop is only needed when the wrapper should differ from the theme default.
|
|
405
407
|
- An explicit `backgroundColor` on an inner `MjmlSection` still wins — use that only when a single section inside the wrapper needs to stand out.
|
|
406
408
|
- For a region that also needs different default text color or variants, combine `MjmlWrapper` with a scoped `ThemeProvider` (see [`components-and-theme.md`](components-and-theme.md) → Scoped Theming). Text components pick up the scoped theme while the wrapper provides the background.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Fixed-Width Cells in a Row
|
|
413
|
+
|
|
414
|
+
`MjmlTable` writes `width: 100%` by default. When the cells of a row are narrower than the table together, Apple Mail and Safari spread the free table width over all cells, so fixed-width cells become wider than declared. An empty filler cell at the end of the row does not help. For a row of fixed-width items, such as icons, set `width="auto"` on the table.
|
|
@@ -106,6 +106,8 @@ registerStyles(css`
|
|
|
106
106
|
- Duplicate registrations with the same function/string reference overwrite (stored in a `Map`)
|
|
107
107
|
- Theme-aware entries always resolve against the **root theme** from `MjmlMailRoot` — nested `ThemeProvider` scopes do not affect them
|
|
108
108
|
- Optional second argument: partial `MjmlStyle` props (forwarded to the underlying `<mj-style>`)
|
|
109
|
+
- An entry registered with `{ inline: true }` as the second argument has its rules written into `style` attributes. It keeps no `@media` rules: MJML drops them without a warning.
|
|
110
|
+
- Do not write `//` comments inside a `css` template: CSS has no line comments, so mail-react throws an error when it minifies the registered styles. In an `{ inline: true }` entry there is no error, and the rule after the comment is lost. Use `/* */`, or a JS comment in an expression: `${/* note */ ""}`
|
|
109
111
|
|
|
110
112
|
---
|
|
111
113
|
|