@samva/markup 0.1.2 → 0.2.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.
Files changed (92) hide show
  1. package/AGENTS.md +25 -5
  2. package/README.md +92 -26
  3. package/dist/{ast-DAhnAvQN.d.ts → ast-63I-VLQx.d.ts} +15 -2
  4. package/dist/ast.d.ts +2 -2
  5. package/dist/ast.js +14 -1
  6. package/dist/{checks-D-zFQt5R.js → checks-DXuERO4B.js} +36 -2
  7. package/dist/checks.d.ts +8 -1
  8. package/dist/checks.js +2 -2
  9. package/dist/compile-sms.d.ts +2 -2
  10. package/dist/compile-whatsapp.d.ts +2 -2
  11. package/dist/compile.d.ts +9 -84
  12. package/dist/compile.js +11 -920
  13. package/dist/compiler.d.ts +301 -0
  14. package/dist/compiler.js +1389 -0
  15. package/dist/components.d.ts +3 -3
  16. package/dist/corpus-Dz5irJ9x.d.ts +161 -0
  17. package/dist/diagnostics-Djd9ckLg.d.ts +90 -0
  18. package/dist/diagnostics.js +4 -1
  19. package/dist/elements-DtwKlFVH.d.ts +820 -0
  20. package/dist/email/components.d.ts +119 -0
  21. package/dist/email/components.js +207 -0
  22. package/dist/email/diagnostics.d.ts +2 -0
  23. package/dist/email/diagnostics.js +56 -0
  24. package/dist/email/elements.d.ts +2 -0
  25. package/dist/email/elements.js +299 -0
  26. package/dist/email/html.d.ts +42 -0
  27. package/dist/email/html.js +266 -0
  28. package/dist/email/jsx-dev-runtime.d.ts +26 -0
  29. package/dist/email/jsx-dev-runtime.js +12 -0
  30. package/dist/email/jsx-runtime.d.ts +2 -0
  31. package/dist/email/jsx-runtime.js +60 -0
  32. package/dist/email/render.d.ts +36 -0
  33. package/dist/email/render.js +6 -0
  34. package/dist/email/selection.d.ts +102 -0
  35. package/dist/email/selection.js +143 -0
  36. package/dist/email/source-edit.d.ts +67 -0
  37. package/dist/email/source-edit.js +185 -0
  38. package/dist/email/stylesheets.d.ts +2 -0
  39. package/dist/email/stylesheets.js +43 -0
  40. package/dist/email/text.d.ts +7 -0
  41. package/dist/email/text.js +92 -0
  42. package/dist/emit.d.ts +13 -12
  43. package/dist/emit.js +63 -63
  44. package/dist/input-schema-BIfzI63B.d.ts +23 -0
  45. package/dist/input-schema.d.ts +2 -0
  46. package/dist/input-schema.js +170 -0
  47. package/dist/jsx-dev-runtime.d.ts +4 -3
  48. package/dist/jsx-dev-runtime.js +9 -1
  49. package/dist/{jsx-runtime-eNIMY87F.d.ts → jsx-runtime-C5k_Zq0A.d.ts} +3 -3
  50. package/dist/jsx-runtime.d.ts +1 -1
  51. package/dist/jsx-runtime.js +20 -1
  52. package/dist/model.d.ts +1 -1
  53. package/dist/ops.d.ts +1 -1
  54. package/dist/ops.js +1 -1
  55. package/dist/{parser-DkQKIjDa.d.ts → parser-CGBS73Gz.d.ts} +2 -2
  56. package/dist/parser.d.ts +1 -1
  57. package/dist/presets/category-mapping.d.ts +1 -1
  58. package/dist/presets/corpus.d.ts +2 -0
  59. package/dist/presets/corpus.js +186 -0
  60. package/dist/presets/public-gallery.d.ts +272 -2
  61. package/dist/presets/public-gallery.js +305 -6
  62. package/dist/presets/public-handoff.d.ts +140 -2
  63. package/dist/presets/public-handoff.js +130 -33
  64. package/dist/presets/public-preview-artifacts.d.ts +2 -2
  65. package/dist/presets/public-preview-artifacts.js +20 -26
  66. package/dist/presets/public-preview.d.ts +56 -2
  67. package/dist/presets/public-preview.js +388 -1152
  68. package/dist/presets/sources.d.ts +17 -4
  69. package/dist/presets/sources.js +1212 -43
  70. package/dist/presets.d.ts +2 -2
  71. package/dist/printer.d.ts +1 -1
  72. package/dist/render-Cddsy_XF.js +585 -0
  73. package/dist/render-template.d.ts +5 -2
  74. package/dist/render-template.js +3 -1
  75. package/dist/source-locations-BCJQnIfU.d.ts +89 -0
  76. package/dist/source-locations.d.ts +2 -0
  77. package/dist/source-locations.js +125 -0
  78. package/dist/stylesheets-oDRAnYA3.d.ts +94 -0
  79. package/dist/template-Dy5yOPyp.d.ts +60 -0
  80. package/dist/template.d.ts +2 -0
  81. package/dist/template.js +37 -0
  82. package/dist/tsx-source-instrumentation.d.ts +23 -0
  83. package/dist/tsx-source-instrumentation.js +97 -0
  84. package/dist/tsx-tracer.d.ts +116 -0
  85. package/dist/tsx-tracer.js +985 -0
  86. package/generated/sml-agent-contract.json +574 -782
  87. package/generated/sml-email-agent-contract.json +502 -677
  88. package/generated/sml-email-language-reference.md +94 -160
  89. package/generated/sml-language-reference.md +195 -220
  90. package/package.json +111 -9
  91. package/dist/public-gallery-D0Zv0pZE.d.ts +0 -611
  92. package/dist/public-preview-u1Z9aaGq.d.ts +0 -1168
@@ -1,220 +1,195 @@
1
- <!-- GENERATED by packages/markup/scripts/generate-sml-reference.ts — do not edit by hand. -->
2
-
3
- # SML language reference
4
-
5
- SML is JSX-strict markup: every tag is closed, every attribute is quoted (or
6
- `{numeric}`), and the vocabulary is closed. One document targets exactly one
7
- channel, declared by the root tag: `<Email>` compiles to email-safe table
8
- HTML, `<Sms>` to a plain-text message body, `<WhatsApp>` to a Meta template
9
- payload. Cross-channel compilation does not exist — one `.samva` file is one
10
- channel's template.
11
-
12
- ## Email primitives
13
-
14
- Styling is an email-safe subset of Tailwind utility classes on the `class`
15
- attribute (email only). The compiler lowers this to table-based HTML with
16
- Outlook/Gmail fallbacks — you never write raw HTML.
17
-
18
- | Tag | Attributes | Children | Notes |
19
- | ------------- | ------------------------------------------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
20
- | `<Email>` | lang, dir, width (1-10000), class | Subject?, Preview?, blocks | Email document root. Exactly one root per template; wraps the whole message. |
21
- | `<Subject>` | — | text, {{vars}} | Email subject line. Text and interpolations only; must appear before body blocks. |
22
- | `<Preview>` | — | text, {{vars}} | Inbox preview text (hidden in the body). Text and interpolations only. |
23
- | `<Container>` | class, backgroundImage, backgroundPosition, backgroundSize | blocks | Centered 600px max-width wrapper. Compiles to a table on the outlook-safe base. |
24
- | `<Section>` | class, backgroundImage, backgroundPosition, backgroundSize | blocks | Full-width band. Padding splits onto the inner cell for Outlook/Klaviyo. |
25
- | `<Row>` | class | Column+ | Horizontal layout. Children must be <Column>. Use instead of flex/grid. |
26
- | `<Column>` | class, width, valign | blocks | A cell inside a <Row>. `width` is an HTML width (e.g. "50%", "300"). |
27
- | `<Heading>` | level (1-6), class | text, {{vars}}, strong, em, a | Renders <h1>-<h6> by `level` (default 1). |
28
- | `<Text>` | class | text, {{vars}}, strong, em, a | Paragraph. Ships sane font-size/line-height/margin defaults. |
29
- | `<Button>` | href (required), class | text, {{vars}}, strong, em | Link styled as a button. Set padding via classes; the compiler injects the Outlook mso hack. |
30
- | `<Image>` | src (required), alt, width (0-10000), height (0-10000), class | Source? | Responsive image. Always set `alt` for accessibility. Add a <Source scheme="dark"> child to swap the asset in dark mode. |
31
- | `<Source>` | scheme (required), src (required) | void | Image source variant. Inside <Image>, `scheme="dark"` swaps the asset when dark-mode media queries are honored. |
32
- | `<Divider>` | class | void | Horizontal rule (border-top). |
33
- | `<Spacer>` | height (required, 1-2000) | void | Vertical gap of `height` px. |
34
- | `<List>` | type, class | ListItem+ | Bulleted or numbered list. `type` is "unordered" (default) or "ordered". Children must be <ListItem>. |
35
- | `<ListItem>` | class | text, {{vars}}, strong, em, a | A single list row. Inline content only (text, {{vars}}, strong/em/a). |
36
- | `<If>` | test (required) | blocks, Else? | Send-time conditional block. `test` is a predicate over declared variables (see "Send-time conditionals" below). Content: blocks, then an optional trailing <Else>. |
37
- | `<Else>` | — | blocks | The false branch of an <If>. Valid only as the last direct child of <If>. |
38
- | `<a>` | href (required), class | text, {{vars}}, strong, em | Inline link. It has deterministic theme-brand color and underline defaults; use safe classes to override either. |
39
- | `<strong>` | — | text, {{vars}}, strong, em | Bold inline text. |
40
- | `<em>` | — | text, {{vars}}, strong, em | Italic inline text. |
41
-
42
- - Interpolate variables with `{{name}}` (or `${name}`) inside text content.
43
- - Only `sm:` (min-width 640px, progressive enhancement) and `dark:` (color
44
- families only) class variants are supported. `hover:`/`focus:`/`md:`/`lg:`/etc.
45
- are rejected.
46
-
47
- ## SMS documents
48
-
49
- | Tag | Attributes | Children | Notes |
50
- | -------- | --------------- | ---------------------------------- | --------------------------------------------------------------------------------------------------------------- |
51
- | `<Sms>` | category | verbatim text, {{vars}}, If | SMS document root. The body is VERBATIM text — newlines and space runs are content. No layout tags, no classes. |
52
- | `<If>` | test (required) | verbatim text, {{vars}}, If, Else? | Send-time conditional inline in the body. Content is verbatim text/{{vars}}, then an optional trailing <Else>. |
53
- | `<Else>` | — | verbatim text, {{vars}}, If | The false branch of an <If>; must be its last child. Nothing may follow it, whitespace included. |
54
-
55
- - The body is VERBATIM: newlines and runs of spaces are content and are
56
- preserved exactly. There is no whitespace collapsing and no `class`
57
- attribute anywhere — SMS has no styling.
58
- - `category` is optional authoring intent: `transactional`, `promotional`,
59
- or `service_implicit`.
60
- - The compiler reports GSM-7/UCS-2 encoding and segment estimates (variables
61
- count at a 16-character worst case) and warns on multi-segment bodies and
62
- missing opt-out language (e.g. "Reply STOP to unsubscribe").
63
- - Example: `<Sms category="transactional">{{workspace}}: {{code}} is your
64
- code. Reply STOP to opt out.</Sms>`
65
-
66
- ## WhatsApp documents
67
-
68
- | Tag | Attributes | Children | Notes |
69
- | ------------ | ----------------------------------- | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
70
- | `<WhatsApp>` | name, language, category (required) | Header?, Body, Footer?, Buttons? (in order) | WhatsApp template root. Children are Meta's template anatomy in order: Header?, Body, Footer?, Buttons?. `name`/`language` default from the template slug/locale at the API layer. |
71
- | `<Header>` | type | verbatim text, {{vars}}, If | Optional template header. `type` is "text" (default, ≤60 chars) or "image"/"video"/"document" (content is the media URL/handle). |
72
- | `<Body>` | — | verbatim text, {{vars}}, If | Required template body (≤1024 chars). Verbatim text, {{vars}}, and <If> conditionals. |
73
- | `<Footer>` | — | verbatim text, {{vars}}, If | Optional template footer (≤60 chars). |
74
- | `<Buttons>` | — | Button+ | Interactive buttons container. Meta limits: ≤10 total, ≤2 url, ≤1 phone. |
75
- | `<Button>` | type (required), url, phone | verbatim text, {{vars}}, If | `type` is "quick-reply" (label only), "url" (requires `url`, ≤2), "phone" (requires `phone`, ≤1), or "copy-code" (content is the code to copy). Label text ≤25 chars. |
76
- | `<If>` | test (required) | verbatim text, {{vars}}, If, Else? | Send-time conditional inline in a text slot. Content is verbatim text/{{vars}}, then an optional trailing <Else>. |
77
- | `<Else>` | — | verbatim text, {{vars}}, If | The false branch of an <If>; must be its last child. Nothing may follow it, whitespace included. |
78
-
79
- - Components follow Meta's template anatomy in order — `Header?`, `Body`
80
- (required), `Footer?`, `Buttons?` — each at most once. Text slots are
81
- verbatim like SMS; no `class` attributes.
82
- - `category` is required: `marketing`, `utility`, `authentication`, or
83
- `service`. `name`/`language` are optional (defaulted from the template
84
- slug and variant locale).
85
- - Meta limits compile as diagnostics: header/footer ≤60 chars, body ≤1024,
86
- button labels ≤25 (warnings); button counts and missing `url`/`phone`
87
- attributes are errors. Don't mix positional `{{1}}` and named `{{var}}`
88
- placeholders.
89
-
90
- ## Send-time conditionals
91
-
92
- `<If test="...">...<Else>...</Else></If>` renders one branch per recipient at
93
- send time, selected by the per-recipient variables. It works on every channel:
94
- both branches compile into the artifact (email HTML/text, sms body, whatsapp
95
- component text) behind hidden markers; the send-time interpolation step picks
96
- a branch and strips the markers before `{{}}` substitution — sent messages
97
- never contain markers or the untaken branch.
98
-
99
- - `<Else>` is optional and, when present, must be the last direct child of
100
- `<If>`. There is no `<ElseIf>` — nest another `<If>` inside `<Else>` instead.
101
- In email, both `<If>` and `<Else>` accept the same children as any other
102
- block (Container, Section, Row, Heading, Text, Button, Image, Divider,
103
- Spacer, and nested If). In sms/whatsapp text slots they carry verbatim text,
104
- `{{vars}}`, and nested `<If>` inline.
105
- - `test` is a closed predicate grammar — comparisons and boolean combinators
106
- over flat variable names and literals, nothing else:
107
- - Comparison operators: `==`, `!=`, `>`, `>=`, `<`, `<=`.
108
- - Boolean keywords: `and`, `or`, `not`, plus
109
- `( )` grouping.
110
- - Literals: `'single-quoted strings'` or bare numbers. No arithmetic, no
111
- function calls, no method calls, no dotted paths — variable names are flat
112
- (`plan`, not `user.plan`).
113
- - A bare variable name (`seats`) means "present and non-empty"; a missing
114
- variable makes every comparison false, including `!=`.
115
- - Examples: `test="plan == 'pro'"`, `test="seats > 5 and plan != 'free'"`,
116
- `test="not (region == 'eu' or region == 'uk')"`.
117
- - Full grammar and evaluation semantics live in `packages/markup/src/predicate.ts`
118
- (parse / evaluate / print / collectPredicateVariables) — the same module the
119
- compiler, checks, send-time evaluator, and canvas all share, so predicate
120
- semantics cannot fork between them.
121
-
122
- ## Utility classes (email only)
123
-
124
- Email styling uses this Tailwind subset. Arbitrary values (`w-[600px]`, `text-[#374151]`,
125
- `bg-[#0088cc]`) are allowed where noted in each family's description. Sms and
126
- whatsapp documents have no `class` attribute anywhere.
127
-
128
- | Class | What it sets |
129
- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
130
- | `p-*` | Padding on all sides (p-4 = 16px). Compiles onto table cells for Outlook. |
131
- | `px-*` | Horizontal padding. |
132
- | `py-*` | Vertical padding. |
133
- | `pt-*` | Top padding. |
134
- | `pr-*` | Right padding. |
135
- | `pb-*` | Bottom padding. |
136
- | `pl-*` | Left padding. |
137
- | `m-*` | Margin on all sides. Warn tier — some clients strip margins. (warn: some clients strip it) |
138
- | `mx-*` | Horizontal margin; mx-auto centers block elements. (warn: some clients strip it) |
139
- | `my-*` | Vertical margin. (warn: some clients strip it) |
140
- | `mt-*` | Top margin. (warn: some clients strip it) |
141
- | `mr-*` | Right margin. (warn: some clients strip it) |
142
- | `mb-*` | Bottom margin. (warn: some clients strip it) |
143
- | `ml-*` | Left margin. (warn: some clients strip it) |
144
- | `w-*` | Width from the spacing scale (w-32 = 128px), w-full, or w-[600px]/w-[50%]. |
145
- | `max-w-*` | Max width from the container scale (max-w-lg = 512px) or max-w-[600px]. |
146
- | `h-*` | Height from the spacing scale (h-12 = 48px) or h-[80px]. |
147
- | `text-*` | Font size with paired line-height (text-sm = 14px/20px) or bounded px value (text-[15px] = 15px/22.5px). Put an explicit leading-* after it to override line-height. Text alignment: text-left, text-center, text-right, text-justify. Text color from the palette (text-gray-700) or text-[#374151]. |
148
- | `leading-*` | Line height: named ratios (leading-relaxed) or spacing steps (leading-6 = 24px). |
149
- | `font-*` | Font weight: font-normal, font-medium, font-semibold, font-bold, ... Font stack: font-sans, font-serif, font-mono. |
150
- | `tracking-*` | Letter spacing: tracking-tighter … tracking-widest (em-based; inlines fine in Outlook). Pair tracking-wide/wider with uppercase for eyebrows. |
151
- | `uppercase` | Uppercase text transform. |
152
- | `underline` | Underlined text. |
153
- | `no-underline` | Removes the underline (links render underlined by default in most clients). |
154
- | `bg-*` | Background color from the palette (bg-white, bg-blue-600) or bg-[#0088cc]. |
155
- | `bg-gradient-*` | Linear gradient background for hero sections: bg-gradient-to-b/t/l/r with from-{color} and to-{color}. Modern base compiles a CSS linear-gradient (plus a solid from-color fallback); the outlook-safe base degrades to the solid from-color — Outlook for Windows never renders the gradient. |
156
- | `from-*` | Gradient start color (from-indigo-600). Doubles as the solid fallback color on clients without gradient support (Outlook for Windows). |
157
- | `to-*` | Gradient end color (to-purple-600). |
158
- | `border-*` | Solid border width: border (1px), border-2, border-0. Border color from the palette (border-gray-200). |
159
- | `rounded-*` | Border radius (rounded-md = 6px). Ignored by Outlook for Windows — buttons degrade to square corners. |
160
- | `rounded-t-*` | Top border radius for card/header blocks (rounded-t-lg). Degrades to square corners in Outlook for Windows. |
161
- | `rounded-r-*` | Right-side border radius (rounded-r-lg). Degrades to square corners in Outlook for Windows. |
162
- | `rounded-b-*` | Bottom border radius for card/footer blocks (rounded-b-lg). Degrades to square corners in Outlook for Windows. |
163
- | `rounded-l-*` | Left-side border radius (rounded-l-lg). Degrades to square corners in Outlook for Windows. |
164
- | `block` | display: block. |
165
- | `inline-block` | display: inline-block. |
166
- | `hidden` | display: none. Pair with sm:block for mobile-only content. |
167
-
168
- Palette color families (each with the usual `50`-`950` steps, plus `white`,
169
- `black`, `transparent`): `amber`, `black`, `blue`, `brand`, `brand-foreground`, `cyan`, `emerald`, `fuchsia`, `gray`, `green`, `indigo`, `lime`, `mauve`, `mist`, `neutral`, `olive`, `orange`, `pink`, `purple`, `red`, `rose`, `sky`, `slate`, `stone`, `taupe`, `teal`, `violet`, `white`, `yellow`, `zinc`.
170
-
171
- ## Rejected utilities
172
-
173
- These compile to hard errors — the message names the failing client and the
174
- supported alternative. Drop the feature rather than break a client.
175
-
176
- | Class / prefix | Why it is rejected |
177
- | -------------- | -------------------------------------------------------------------------------------------- |
178
- | `flex` | display:flex is unsupported in Outlook for Windows (Word engine) — use <Row>/<Column> |
179
- | `inline-flex` | display:inline-flex is unsupported in Outlook for Windows — use <Row>/<Column> |
180
- | `grid` | display:grid is unsupported in Outlook for Windows and Gmail — use <Row>/<Column> |
181
- | `inline-grid` | display:inline-grid is unsupported in Outlook for Windows — use <Row>/<Column> |
182
- | `gap-` | gap requires flex/grid, unsupported in Outlook for Windows — use padding on <Column> |
183
- | `space-` | space-* margins require selectors Gmail strips — use padding or <Spacer> |
184
- | `items-` | flexbox alignment is unsupported in Outlook for Windows — use <Row>/<Column> |
185
- | `justify-` | flexbox alignment is unsupported in Outlook for Windows — use <Row>/<Column> and text-center |
186
- | `self-` | flexbox alignment is unsupported in Outlook for Windows — use <Row>/<Column> |
187
- | `content-` | flexbox alignment is unsupported in Outlook for Windows — use <Row>/<Column> |
188
- | `order-` | flex order is unsupported in Outlook for Windows — reorder the source instead |
189
- | `absolute` | CSS position is ignored by Gmail and Outlook — use nested <Section>s |
190
- | `relative` | CSS position is ignored by Gmail and Outlook — use nested <Section>s |
191
- | `fixed` | CSS position is ignored by Gmail and Outlook — use nested <Section>s |
192
- | `sticky` | CSS position is ignored by Gmail and Outlook — use nested <Section>s |
193
- | `static` | CSS position is ignored by Gmail and Outlook — remove it |
194
- | `inset-` | position offsets are ignored by Gmail and Outlook — use padding |
195
- | `top-` | position offsets are ignored by Gmail and Outlook — use padding |
196
- | `right-` | position offsets are ignored by Gmail and Outlook — use padding |
197
- | `bottom-` | position offsets are ignored by Gmail and Outlook — use padding |
198
- | `left-` | position offsets are ignored by Gmail and Outlook — use padding |
199
- | `z-` | z-index is ignored by Gmail and Outlook — remove it |
200
- | `float-` | float is unreliable across email clients — use <Row>/<Column> |
201
- | `shadow` | box-shadow is unsupported in Outlook for Windows and Gmail — use a border instead |
202
- | `shadow-` | box-shadow is unsupported in Outlook for Windows and Gmail — use a border instead |
203
- | `opacity-` | opacity is unsupported in Outlook for Windows — bake the tint into the color |
204
- | `transform` | CSS transforms are unsupported in email clients — remove them |
205
- | `rotate-` | CSS transforms are unsupported in email clients — remove them |
206
- | `scale-` | CSS transforms are unsupported in email clients — remove them |
207
- | `translate-` | CSS transforms are unsupported in email clients — remove them |
208
- | `skew-` | CSS transforms are unsupported in email clients — remove them |
209
- | `transition` | transitions don't run in email — remove them |
210
- | `transition-` | transitions don't run in email — remove them |
211
- | `duration-` | transitions don't run in email — remove them |
212
- | `animate-` | animations don't run in email — remove them |
213
- | `blur-` | CSS filters are unsupported in most email clients — remove them |
214
- | `brightness-` | CSS filters are unsupported in most email clients — remove them |
215
- | `grayscale` | CSS filters are unsupported in most email clients — remove them |
216
- | `grayscale-` | CSS filters are unsupported in most email clients — remove them |
217
- | `truncate` | text truncation is unsupported in Outlook for Windows — shorten the copy |
218
- | `line-clamp-` | line clamping is unsupported in email clients — shorten the copy |
219
- | `aspect-` | aspect-ratio is unsupported in Outlook and Gmail — set width/height on <Image> |
220
- | `overflow-` | overflow is unreliable across email clients — restructure the layout |
1
+ # Executable email authoring reference
2
+
3
+ Email entries default-export `defineEmail({ id, schema, fixtures, render })` from
4
+ `@samva/markup/template`. Set `jsxImportSource: "@samva/markup/email"`.
5
+ The schema accepts a Standard JSON Schema v1 converter, such as Effect's
6
+ `Schema.toStandardJSONSchemaV1` or Zod 4. Render receives actual validated JSON.
7
+ Return subject, optional preheader, body and optional text; omitted text is derived.
8
+
9
+ Use ordinary synchronous TypeScript helpers, conditions and mapped arrays. Template identity is
10
+ stable and unique within the project. Helper modules are excluded from the template catalog.
11
+ Declare fixtures for each meaningful input shape; fixtures do not prove every possible branch.
12
+
13
+ ## Email components
14
+
15
+ Import from `@samva/markup/email/components`: `Button`, `Column`, `Columns`, `Divider`, `Email`, `Image`, `Link`, `Section`, `Spacer`.
16
+ Use supported ordinary HTML for content. Email primitives generate layout tables and Outlook
17
+ fallbacks while preserving authoring origins. Scripts, event handlers and unsafe URLs fail.
18
+ Strings are escaped content, never interpreted as markup.
19
+
20
+ ## HTML elements
21
+
22
+ - `html`: flow content; attributes: `xmlns`, `xmlns:o`, `xmlns:v`, `xmlns:w`.
23
+ - `head`: flow content; attributes: global attributes only.
24
+ - `title`: text content; attributes: global attributes only.
25
+ - `style`: raw content; attributes: `type`.
26
+ - `meta`: void content; attributes: `name`, `content`, `charset`, `http-equiv`.
27
+ - `body`: flow content; attributes: `bgcolor`.
28
+ - `div`: flow content; attributes: `align`.
29
+ - `section`: flow content; attributes: `align`.
30
+ - `article`: flow content; attributes: `align`.
31
+ - `header`: flow content; attributes: `align`.
32
+ - `footer`: flow content; attributes: `align`.
33
+ - `main`: flow content; attributes: `align`.
34
+ - `center`: flow content; attributes: global attributes only.
35
+ - `p`: flow content; attributes: `align`.
36
+ - `blockquote`: flow content; attributes: `align`.
37
+ - `pre`: flow content; attributes: global attributes only.
38
+ - `h1`: flow content; attributes: `align`.
39
+ - `h2`: flow content; attributes: `align`.
40
+ - `h3`: flow content; attributes: `align`.
41
+ - `h4`: flow content; attributes: `align`.
42
+ - `h5`: flow content; attributes: `align`.
43
+ - `h6`: flow content; attributes: `align`.
44
+ - `span`: flow content; attributes: global attributes only.
45
+ - `strong`: flow content; attributes: global attributes only.
46
+ - `b`: flow content; attributes: global attributes only.
47
+ - `em`: flow content; attributes: global attributes only.
48
+ - `i`: flow content; attributes: global attributes only.
49
+ - `u`: flow content; attributes: global attributes only.
50
+ - `s`: flow content; attributes: global attributes only.
51
+ - `small`: flow content; attributes: global attributes only.
52
+ - `code`: flow content; attributes: global attributes only.
53
+ - `a`: flow content; attributes: `href`, `target`, `rel`, `name`.
54
+ - `img`: void content; attributes: `src`, `alt`, `width`, `height`, `border`, `align`.
55
+ - `table`: flow content; attributes: `width`, `height`, `border`, `cellpadding`, `cellspacing`, `align`, `bgcolor`.
56
+ - `caption`: flow content; attributes: `align`.
57
+ - `colgroup`: flow content; attributes: `span`, `width`.
58
+ - `col`: void content; attributes: `span`, `width`.
59
+ - `thead`: flow content; attributes: `align`, `valign`, `bgcolor`.
60
+ - `tbody`: flow content; attributes: `align`, `valign`, `bgcolor`.
61
+ - `tfoot`: flow content; attributes: `align`, `valign`, `bgcolor`.
62
+ - `tr`: flow content; attributes: `align`, `valign`, `bgcolor`, `height`.
63
+ - `td`: flow content; attributes: `align`, `valign`, `width`, `height`, `bgcolor`, `colspan`, `rowspan`.
64
+ - `th`: flow content; attributes: `align`, `valign`, `width`, `height`, `bgcolor`, `colspan`, `rowspan`.
65
+ - `ul`: flow content; attributes: global attributes only.
66
+ - `ol`: flow content; attributes: `start`, `type`.
67
+ - `li`: flow content; attributes: global attributes only.
68
+ - `br`: void content; attributes: global attributes only.
69
+ - `hr`: void content; attributes: `width`, `size`, `align`.
70
+
71
+ Global attributes: `id`, `title`, `lang`, `dir`, `role`.
72
+
73
+ ## CSS and assets
74
+
75
+ Imported CSS follows cascade and specificity; applicable declarations inline and supported media/head rules remain.
76
+ Uses the Tailwind compiler and discoverable source classes; dynamic classes may produce diagnostics.
77
+ Use email layout primitives for table and Outlook fallbacks; no general flex/grid conversion.
78
+ Imported assets are content-addressed. Delivery needs their actual HTTPS serving base; local export may use relative URLs. External HTTPS references are not fetched.
79
+
80
+ ## Execution and publication
81
+
82
+ Isolated hosted rendering has no I/O. Clock and entropy require declared fixed runtime values; locale is en-US and timezone UTC.
83
+ Hosted builds consume Bun text lockfile v2 or npm lockfile v3. Exact immutable publication is the default send pin; contract-latest is explicit and resolves at acceptance.
84
+ Local preview, build and export do not require Samva credentials. Build executes named fixtures;
85
+ export writes template/fixture HTML and text plus assets and a catalog manifest.
86
+
87
+ ## Quality bar
88
+
89
+ - Validate all declared fixtures and inspect structured diagnostics and source origins.
90
+ - Repair fatal compile/render failures before delivery.
91
+ - Check representative empty, nested, repeated and conditional inputs.
92
+ - Inspect HTML and text, light/dark styling and responsive layouts.
93
+ - Distinguish static compatibility findings and browser previews from actual inbox evidence.
94
+ - Keep source canonical; source edits and fixture data edits are separate operations.
95
+
96
+ ## Structured channels
97
+
98
+ SMS and WhatsApp retain their structured channel grammar and the `@samva/markup` JSX runtime.
99
+
100
+ ```json
101
+ {
102
+ "sms": {
103
+ "Sms": {
104
+ "attributes": {
105
+ "category": {
106
+ "type": "string",
107
+ "values": ["transactional", "promotional", "service_implicit"]
108
+ }
109
+ },
110
+ "content": "verbatim"
111
+ },
112
+ "If": {
113
+ "attributes": {
114
+ "test": {
115
+ "type": "string",
116
+ "required": true
117
+ }
118
+ },
119
+ "content": "verbatim-if"
120
+ },
121
+ "Else": {
122
+ "attributes": {},
123
+ "content": "verbatim"
124
+ }
125
+ },
126
+ "whatsapp": {
127
+ "WhatsApp": {
128
+ "attributes": {
129
+ "name": {
130
+ "type": "string"
131
+ },
132
+ "language": {
133
+ "type": "string"
134
+ },
135
+ "category": {
136
+ "type": "string",
137
+ "required": true,
138
+ "values": ["marketing", "utility", "authentication", "service"]
139
+ }
140
+ },
141
+ "content": "whatsapp"
142
+ },
143
+ "Header": {
144
+ "attributes": {
145
+ "type": {
146
+ "type": "string",
147
+ "values": ["text", "image", "video", "document"]
148
+ }
149
+ },
150
+ "content": "verbatim"
151
+ },
152
+ "Body": {
153
+ "attributes": {},
154
+ "content": "verbatim"
155
+ },
156
+ "Footer": {
157
+ "attributes": {},
158
+ "content": "verbatim"
159
+ },
160
+ "Buttons": {
161
+ "attributes": {},
162
+ "content": "buttons"
163
+ },
164
+ "Button": {
165
+ "attributes": {
166
+ "type": {
167
+ "type": "string",
168
+ "required": true,
169
+ "values": ["quick-reply", "url", "phone", "copy-code"]
170
+ },
171
+ "url": {
172
+ "type": "string"
173
+ },
174
+ "phone": {
175
+ "type": "string"
176
+ }
177
+ },
178
+ "content": "verbatim"
179
+ },
180
+ "If": {
181
+ "attributes": {
182
+ "test": {
183
+ "type": "string",
184
+ "required": true
185
+ }
186
+ },
187
+ "content": "verbatim-if"
188
+ },
189
+ "Else": {
190
+ "attributes": {},
191
+ "content": "verbatim"
192
+ }
193
+ }
194
+ }
195
+ ```