@samva/markup 0.1.2 → 0.3.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/AGENTS.md +25 -5
- package/README.md +92 -26
- package/dist/{ast-DAhnAvQN.d.ts → ast-63I-VLQx.d.ts} +15 -2
- package/dist/ast.d.ts +2 -2
- package/dist/ast.js +14 -1
- package/dist/{checks-D-zFQt5R.js → checks-DXuERO4B.js} +36 -2
- package/dist/checks.d.ts +8 -1
- package/dist/checks.js +2 -2
- package/dist/compile-sms.d.ts +2 -2
- package/dist/compile-whatsapp.d.ts +2 -2
- package/dist/compile.d.ts +9 -84
- package/dist/compile.js +11 -920
- package/dist/compiler.d.ts +303 -0
- package/dist/compiler.js +1390 -0
- package/dist/components.d.ts +3 -3
- package/dist/corpus-qrUD5O6r.d.ts +254 -0
- package/dist/css-ar2lU3NC.d.ts +84 -0
- package/dist/diagnostics-Djd9ckLg.d.ts +90 -0
- package/dist/diagnostics.js +4 -1
- package/dist/elements-DtwKlFVH.d.ts +820 -0
- package/dist/email/components.d.ts +125 -0
- package/dist/email/components.js +210 -0
- package/dist/email/diagnostics.d.ts +2 -0
- package/dist/email/diagnostics.js +56 -0
- package/dist/email/elements.d.ts +2 -0
- package/dist/email/elements.js +299 -0
- package/dist/email/html.d.ts +42 -0
- package/dist/email/html.js +266 -0
- package/dist/email/jsx-dev-runtime.d.ts +26 -0
- package/dist/email/jsx-dev-runtime.js +12 -0
- package/dist/email/jsx-runtime.d.ts +2 -0
- package/dist/email/jsx-runtime.js +60 -0
- package/dist/email/render.d.ts +43 -0
- package/dist/email/render.js +6 -0
- package/dist/email/selection.d.ts +102 -0
- package/dist/email/selection.js +143 -0
- package/dist/email/source-edit.d.ts +67 -0
- package/dist/email/source-edit.js +185 -0
- package/dist/email/stylesheets.d.ts +15 -0
- package/dist/email/stylesheets.js +45 -0
- package/dist/email/text.d.ts +7 -0
- package/dist/email/text.js +100 -0
- package/dist/emit.d.ts +13 -12
- package/dist/emit.js +63 -63
- package/dist/input-schema-BIfzI63B.d.ts +23 -0
- package/dist/input-schema.d.ts +2 -0
- package/dist/input-schema.js +170 -0
- package/dist/jsx-dev-runtime.d.ts +4 -3
- package/dist/jsx-dev-runtime.js +9 -1
- package/dist/{jsx-runtime-eNIMY87F.d.ts → jsx-runtime-C5k_Zq0A.d.ts} +3 -3
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +20 -1
- package/dist/model.d.ts +1 -1
- package/dist/ops.d.ts +1 -1
- package/dist/ops.js +1 -1
- package/dist/{parser-DkQKIjDa.d.ts → parser-CGBS73Gz.d.ts} +2 -2
- package/dist/parser.d.ts +1 -1
- package/dist/presets/category-mapping.d.ts +1 -1
- package/dist/presets/corpus.d.ts +2 -0
- package/dist/presets/corpus.js +247 -0
- package/dist/presets/public-gallery.d.ts +290 -2
- package/dist/presets/public-gallery.js +428 -6
- package/dist/presets/public-handoff.d.ts +164 -2
- package/dist/presets/public-handoff.js +229 -61
- package/dist/presets/public-preview-artifacts.d.ts +2 -2
- package/dist/presets/public-preview-artifacts.js +25 -31
- package/dist/presets/public-preview.d.ts +65 -2
- package/dist/presets/public-preview.js +402 -1152
- package/dist/presets/sources.d.ts +35 -4
- package/dist/presets/sources.js +2328 -43
- package/dist/presets.d.ts +39 -5
- package/dist/presets.js +96 -0
- package/dist/printer.d.ts +1 -1
- package/dist/render-template.d.ts +5 -2
- package/dist/render-template.js +3 -1
- package/dist/render-ykQhtMs_.js +592 -0
- package/dist/source-locations-BCJQnIfU.d.ts +89 -0
- package/dist/source-locations.d.ts +2 -0
- package/dist/source-locations.js +125 -0
- package/dist/template-Dy5yOPyp.d.ts +60 -0
- package/dist/template.d.ts +2 -0
- package/dist/template.js +37 -0
- package/dist/tsx-source-instrumentation.d.ts +23 -0
- package/dist/tsx-source-instrumentation.js +97 -0
- package/dist/tsx-tracer.d.ts +116 -0
- package/dist/tsx-tracer.js +985 -0
- package/generated/sml-agent-contract.json +574 -782
- package/generated/sml-email-agent-contract.json +502 -677
- package/generated/sml-email-language-reference.md +94 -160
- package/generated/sml-language-reference.md +195 -220
- package/package.json +111 -9
- package/dist/public-gallery-D0Zv0pZE.d.ts +0 -611
- package/dist/public-preview-u1Z9aaGq.d.ts +0 -1168
|
@@ -1,220 +1,195 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
- `
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
whatsapp
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
+
```
|