@samva/markup 0.8.0 → 0.9.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 (171) hide show
  1. package/AGENTS.md +90 -37
  2. package/README.md +188 -52
  3. package/dist/assets-C5duwTya.d.ts +40 -0
  4. package/dist/{brand-DcoVkh_S.d.ts → brand-B-0bN_Ir.d.ts} +2 -2
  5. package/dist/{render-vAv_4r9v.js → cascade-t6kxlgEI.js} +93 -280
  6. package/dist/channel-edit.d.ts +121 -0
  7. package/dist/channel-edit.js +609 -0
  8. package/dist/channel-specs-B6M_HlaV.js +29 -0
  9. package/dist/channel-specs-C2feJwuP.d.ts +13 -0
  10. package/dist/compatibility-DbISoFIq.js +589 -0
  11. package/dist/compiler.d.ts +10 -257
  12. package/dist/compiler.js +10 -730
  13. package/dist/{css-CS2jLID6.d.ts → css-BVQKICKC.d.ts} +3 -3
  14. package/dist/diagnostic-codes.d.ts +403 -0
  15. package/dist/diagnostic-codes.js +399 -0
  16. package/dist/{diagnostics-BMYtBCQk.d.ts → diagnostics-B-Gym34R.d.ts} +8 -4
  17. package/dist/diagnostics.d.ts +31 -2
  18. package/dist/diagnostics.js +1 -19
  19. package/dist/{elements-BzjjnoCS.d.ts → elements-cqldpaJt.d.ts} +3 -3
  20. package/dist/email/assets.d.ts +2 -40
  21. package/dist/email/brand-footer.d.ts +2 -2
  22. package/dist/email/brand-footer.js +4 -3
  23. package/dist/email/brand.d.ts +1 -1
  24. package/dist/email/brand.js +1 -1
  25. package/dist/email/components.d.ts +21 -10
  26. package/dist/email/components.js +46 -11
  27. package/dist/email/diagnostics.d.ts +2 -2
  28. package/dist/email/diagnostics.js +2 -1
  29. package/dist/email/elements.d.ts +1 -1
  30. package/dist/email/html.d.ts +2 -2
  31. package/dist/email/html.js +45 -2
  32. package/dist/email/jsx-dev-runtime.d.ts +2 -2
  33. package/dist/email/jsx-runtime.d.ts +1 -1
  34. package/dist/email/render.d.ts +8 -18
  35. package/dist/email/render.js +163 -3
  36. package/dist/email/text.d.ts +1 -1
  37. package/dist/fmt.d.ts +32 -0
  38. package/dist/fmt.js +174 -0
  39. package/dist/{html-Bl9BAdqc.d.ts → html-BJepOwZ4.d.ts} +19 -5
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +2 -0
  42. package/dist/ir-aaqNE987.d.ts +252 -0
  43. package/dist/ir.d.ts +2 -0
  44. package/dist/ir.js +7 -0
  45. package/dist/preview-Ekdg1dXG.d.ts +100 -0
  46. package/dist/preview.d.ts +2 -0
  47. package/dist/preview.js +160 -0
  48. package/dist/profile-BH-OtdDA.js +3670 -0
  49. package/dist/render-ir.d.ts +19 -0
  50. package/dist/render-ir.js +826 -0
  51. package/dist/sms-segments.d.ts +13 -2
  52. package/dist/sms.d.ts +16 -0
  53. package/dist/sms.js +12 -0
  54. package/dist/{email/source-edit.d.ts → source-edit.d.ts} +55 -6
  55. package/dist/source-edit.js +343 -0
  56. package/dist/source-locations-C8wCsiAy.d.ts +23 -0
  57. package/dist/source-locations.d.ts +2 -2
  58. package/dist/source-locations.js +3 -89
  59. package/dist/static.d.ts +57 -0
  60. package/dist/static.js +69 -0
  61. package/dist/tailwind-CMYpZf1v.js +614 -0
  62. package/dist/template-_QE_rQND.d.ts +65 -0
  63. package/dist/template.d.ts +2 -2
  64. package/dist/template.js +15 -10
  65. package/dist/theme-css.d.ts +1 -1
  66. package/dist/theme-imports-lvBw3AD1.js +109 -0
  67. package/dist/transform-Ct2OMkFN.d.ts +153 -0
  68. package/dist/whatsapp.d.ts +57 -0
  69. package/dist/whatsapp.js +22 -0
  70. package/generated/contract.json +1782 -0
  71. package/generated/reference.md +353 -0
  72. package/package.json +41 -151
  73. package/skills/sml/SKILL.md +123 -0
  74. package/dist/ast-BrDtApwS.d.ts +0 -107
  75. package/dist/ast.d.ts +0 -2
  76. package/dist/ast.js +0 -124
  77. package/dist/candidate.d.ts +0 -29
  78. package/dist/candidate.js +0 -88
  79. package/dist/catalog-CKuOooB8.d.ts +0 -354
  80. package/dist/checks-D73Xizbw.js +0 -59366
  81. package/dist/checks.d.ts +0 -33
  82. package/dist/checks.js +0 -2
  83. package/dist/classes.d.ts +0 -26
  84. package/dist/classes.js +0 -184
  85. package/dist/compile-sms.d.ts +0 -28
  86. package/dist/compile-sms.js +0 -44
  87. package/dist/compile-whatsapp.d.ts +0 -56
  88. package/dist/compile-whatsapp.js +0 -186
  89. package/dist/compile.d.ts +0 -18
  90. package/dist/compile.js +0 -29
  91. package/dist/components.d.ts +0 -289
  92. package/dist/components.js +0 -106
  93. package/dist/conditionals.d.ts +0 -10
  94. package/dist/conditionals.js +0 -74
  95. package/dist/corpus-CPPfgAHN.d.ts +0 -106
  96. package/dist/diagnostics-OcQKQYSY.d.ts +0 -49
  97. package/dist/email/selection.d.ts +0 -2
  98. package/dist/email/selection.js +0 -91
  99. package/dist/email/source-edit.js +0 -185
  100. package/dist/email/stylesheets.d.ts +0 -15
  101. package/dist/email/stylesheets.js +0 -48
  102. package/dist/emit.d.ts +0 -51
  103. package/dist/emit.js +0 -151
  104. package/dist/interpolate.d.ts +0 -24
  105. package/dist/interpolate.js +0 -43
  106. package/dist/jsx-dev-runtime.d.ts +0 -11
  107. package/dist/jsx-dev-runtime.js +0 -15
  108. package/dist/jsx-runtime-I-1nCtl2.d.ts +0 -57
  109. package/dist/jsx-runtime.d.ts +0 -2
  110. package/dist/jsx-runtime.js +0 -121
  111. package/dist/lexer.d.ts +0 -60
  112. package/dist/lexer.js +0 -281
  113. package/dist/model.d.ts +0 -24
  114. package/dist/model.js +0 -77
  115. package/dist/ops-BvwqHl7V.js +0 -630
  116. package/dist/ops.d.ts +0 -114
  117. package/dist/ops.js +0 -2
  118. package/dist/parser-t29cHLVL.d.ts +0 -396
  119. package/dist/parser.d.ts +0 -2
  120. package/dist/parser.js +0 -859
  121. package/dist/predicate-BI6uRRM-.js +0 -549
  122. package/dist/predicate-M-05Nd7R.d.ts +0 -56
  123. package/dist/predicate.d.ts +0 -2
  124. package/dist/predicate.js +0 -2
  125. package/dist/printer.d.ts +0 -6
  126. package/dist/printer.js +0 -122
  127. package/dist/registry-Dcp6QEK_.d.ts +0 -73
  128. package/dist/registry.d.ts +0 -2
  129. package/dist/registry.js +0 -646
  130. package/dist/render-template.d.ts +0 -45
  131. package/dist/render-template.js +0 -76
  132. package/dist/selection-CCArx9lU.d.ts +0 -91
  133. package/dist/showcase-egkusQBf.d.ts +0 -415
  134. package/dist/sms-segments-y4FpPilJ.d.ts +0 -13
  135. package/dist/source-locations-DrCM82Ym.d.ts +0 -67
  136. package/dist/starters/category-mapping.d.ts +0 -13
  137. package/dist/starters/category-mapping.js +0 -49
  138. package/dist/starters/corpus.d.ts +0 -2
  139. package/dist/starters/corpus.js +0 -194
  140. package/dist/starters/library.d.ts +0 -18
  141. package/dist/starters/library.js +0 -692
  142. package/dist/starters/public-gallery.d.ts +0 -266
  143. package/dist/starters/public-gallery.js +0 -916
  144. package/dist/starters/public-handoff.d.ts +0 -164
  145. package/dist/starters/public-handoff.js +0 -361
  146. package/dist/starters/public-preview-artifacts.d.ts +0 -43
  147. package/dist/starters/public-preview-artifacts.js +0 -104
  148. package/dist/starters/public-preview.d.ts +0 -61
  149. package/dist/starters/public-preview.js +0 -83
  150. package/dist/starters/showcase.d.ts +0 -2
  151. package/dist/starters/showcase.js +0 -335
  152. package/dist/starters/sources.d.ts +0 -45
  153. package/dist/starters/sources.js +0 -7762
  154. package/dist/starters/theme.d.ts +0 -45
  155. package/dist/starters/theme.js +0 -77
  156. package/dist/starters.d.ts +0 -2
  157. package/dist/starters.js +0 -874
  158. package/dist/tailwind-BYq7Lo6u.js +0 -727
  159. package/dist/template-DWftqh4x.d.ts +0 -60
  160. package/dist/tsx-source-instrumentation.d.ts +0 -30
  161. package/dist/tsx-source-instrumentation.js +0 -115
  162. package/dist/tsx-tracer.d.ts +0 -112
  163. package/dist/tsx-tracer.js +0 -985
  164. package/dist/variables-J_L3qxRa.d.ts +0 -77
  165. package/dist/variables.d.ts +0 -2
  166. package/dist/variables.js +0 -141
  167. package/dist/version-BITr58kk.js +0 -96
  168. package/generated/sml-agent-contract.json +0 -709
  169. package/generated/sml-email-agent-contract.json +0 -615
  170. package/generated/sml-email-language-reference.md +0 -94
  171. package/generated/sml-language-reference.md +0 -195
@@ -0,0 +1,399 @@
1
+ //#region src/diagnostic-codes.ts
2
+ const codes = (table) => table;
3
+ const DIAGNOSTIC_CODES = codes({
4
+ "no-template": {
5
+ summary: "The entry does not default-export a template.",
6
+ fix: "Default-export defineTemplate({ ... }) imported from @samva/markup."
7
+ },
8
+ "legacy-definition": {
9
+ summary: "The entry default-exports something other than defineTemplate.",
10
+ fix: "Import { defineTemplate } from \"@samva/markup\" and default-export defineTemplate({ ... }).",
11
+ upgrade: [
12
+ "Read the entry and its imports without executing them. For a default-exported defineEmail definition, import defineTemplate from \"@samva/markup\" and replace the definition call.",
13
+ "Preserve the entry path, template id, schema, named fixtures, content, design, bindings, conditions, project partials, assets, theme and brand imports. Replace render(input) returning { subject, preheader?, body } with email: { subject: (input) => ..., preheader: (input) => ..., body: (input) => ... }, retaining its parameter bindings and each returned expression; omit preheader when absent.",
14
+ "Inline module constants only when they are literal strings, numbers or booleans and their bindings are unambiguous; never substitute a fixture value for an input binding. Keep each channel function a single static-profile expression, and keep subject and preheader off <Email>.",
15
+ "Helper calls, `Math.*`, general arithmetic, render statements, spreads, computed properties and runtime clock or seed have no direct conversion. Rewrite with static-profile bindings, conditions, .map, .filter, project partials or `fmt.*` where equivalent; arithmetic is allowed only in formatter arguments and conditions. Otherwise compute the value in the sender, declare a payload field in the schema and every fixture, and explain the required sender change. Never guess time, randomness or computed data.",
16
+ "Explicit text has no email-channel field: plain text is derived from the body. If deriving it changes intended content, or another construct cannot be preserved, explain the tradeoff and ask rather than silently discard it. Do not drop fixtures, weaken validation or hide diagnostics.",
17
+ "Convert every affected entry in the project at its existing path, including emails/ entries. Compile each entry, render every declared fixture and inspect the affected output. Resolve errors before requesting one saved version for the whole project, approved by the user; do not publish."
18
+ ].join("\n\n")
19
+ },
20
+ "dynamic-definition": {
21
+ summary: "A definition field is spread or computed instead of written out.",
22
+ fix: "Write each field as name: value."
23
+ },
24
+ "invalid-template-id": {
25
+ summary: "The template id is not a lowercase kebab-case string literal.",
26
+ fix: "Write id: \"order-shipped\"."
27
+ },
28
+ "missing-schema": {
29
+ summary: "The template declares no input schema.",
30
+ fix: "Add schema: jsonSchema<Input>({ ... })."
31
+ },
32
+ "schema-not-static": {
33
+ summary: "The schema cannot be read without running code.",
34
+ fix: "Write the schema as a literal jsonSchema<Input>({ type: 'object', ... })."
35
+ },
36
+ "invalid-schema": {
37
+ summary: "The schema uses JSON Schema keywords the compiler cannot validate against.",
38
+ fix: "Use only the JSON Schema keywords the package README lists."
39
+ },
40
+ "missing-fixtures": {
41
+ summary: "The template declares no fixtures.",
42
+ fix: "Add fixtures: { default: { ... } } with at least one valid payload."
43
+ },
44
+ "fixtures-not-static": {
45
+ summary: "A fixture is computed instead of written as data.",
46
+ fix: "Write each fixture as a literal object; an imported asset is allowed."
47
+ },
48
+ "invalid-fixture-name": {
49
+ summary: "A fixture key is not a single path segment.",
50
+ fix: "Use letters, digits, '.', '_' and '-', starting with a letter or digit."
51
+ },
52
+ "fixture-invalid": {
53
+ summary: "A fixture does not match the schema.",
54
+ fix: "Change the fixture, or the schema, so every fixture is a payload a send could carry."
55
+ },
56
+ "invalid-locale": {
57
+ summary: "The template's default locale is not a string literal.",
58
+ fix: "Write locale: \"en-US\"."
59
+ },
60
+ "no-channel": {
61
+ summary: "The template declares no channel body.",
62
+ fix: "Add an email body."
63
+ },
64
+ "invalid-channel": {
65
+ summary: "A channel field is not shaped as the channel requires.",
66
+ fix: "Write email: { subject, preheader?, body } with each a function of the input."
67
+ },
68
+ "not-a-function": {
69
+ summary: "A channel field is not a function of the input.",
70
+ fix: "Write (input) => ... in place or declare the function in the project."
71
+ },
72
+ "missing-subject": {
73
+ summary: "The email channel has no subject.",
74
+ fix: "Add subject: (input) => ...."
75
+ },
76
+ "missing-body": {
77
+ summary: "The email channel has no body.",
78
+ fix: "Add body: (input) => (<Email>...</Email>)."
79
+ },
80
+ "multiple-roots": {
81
+ summary: "The body renders nothing or more than one root.",
82
+ fix: "Wrap the body in a single element such as <Email>."
83
+ },
84
+ "preheader-without-shell": {
85
+ summary: "A preheader is set but the body has no <Email> shell to hold it.",
86
+ fix: "Wrap the body in <Email>."
87
+ },
88
+ "wrong-channel": {
89
+ summary: "A channel body does not return its own channel component.",
90
+ fix: "Return one element imported from the channel package.",
91
+ channelOnly: true
92
+ },
93
+ "syntax-error": {
94
+ summary: "A project file does not parse as TSX.",
95
+ fix: "Fix the syntax at the reported location."
96
+ },
97
+ "non-project-import": {
98
+ summary: "The file imports something other than @samva/markup or a project file.",
99
+ fix: "Remove the import, or copy the code you need into a project file."
100
+ },
101
+ "unresolved-import": {
102
+ summary: "An import names no file in the project.",
103
+ fix: "Check the path and the file extension."
104
+ },
105
+ "recursive-partial": {
106
+ summary: "A partial renders itself; partials are inlined at compile time.",
107
+ fix: "Flatten the recursion, or repeat the structure with .map."
108
+ },
109
+ "nesting-limit": {
110
+ summary: "The template nests deeper than the compiler reads.",
111
+ fix: "Flatten the structure."
112
+ },
113
+ "dynamic-expression": {
114
+ summary: "An expression outside the static profile: a call other than fmt.* and .map, a computed value, or a spread.",
115
+ fix: "Compute the value where the message is sent and bind it from the payload."
116
+ },
117
+ "statement-in-body": {
118
+ summary: "A body contains a statement (const, if, a loop); a body is one expression.",
119
+ fix: "Use cond && <X />, cond ? <A /> : <B /> and .map, or send the computed value in the payload."
120
+ },
121
+ "unsupported-pattern": {
122
+ summary: "A parameter pattern or default value the profile cannot bind.",
123
+ fix: "Use plain names or destructuring without defaults; declare the field required or guard it."
124
+ },
125
+ "hook-call": {
126
+ summary: "A hook was called; templates have no state, effects or context.",
127
+ fix: "Read the input through the function's parameter and send anything else in the payload."
128
+ },
129
+ "unknown-formatter": {
130
+ summary: "fmt.<name> is not a formatter.",
131
+ fix: "Use fmt.money, number, date, time, plural or list."
132
+ },
133
+ "formatter-arguments": {
134
+ summary: "A formatter got the wrong number of arguments.",
135
+ fix: "Match the formatter's signature in the contract."
136
+ },
137
+ "reserved-character": {
138
+ summary: "Text contains a private-use character the compiler reserves.",
139
+ fix: "Remove the characters U+E000 to U+E003."
140
+ },
141
+ "reserved-url": {
142
+ summary: "A URL is the unsubscribe placeholder only BrandFooter can write.",
143
+ fix: "Render <BrandFooter /> instead."
144
+ },
145
+ "reserved-attribute": {
146
+ summary: "An attribute is written only by a brand component.",
147
+ fix: "Render BrandFooter from samva:brand instead of marking an element as the footer."
148
+ },
149
+ "dynamic-class": {
150
+ summary: "A class name is built at run time, and Tailwind cannot see it.",
151
+ fix: "Write classes literally, or choose between literal lists: input.vip ? \"bg-amber-100\" : \"bg-white\"."
152
+ },
153
+ "too-many-class-variants": {
154
+ summary: "A class list chooses between more literal lists than the compiler resolves.",
155
+ fix: "Split the choice into fewer conditions, or move part of it to a partial."
156
+ },
157
+ "invalid-style": {
158
+ summary: "A style prop is not a static property object.",
159
+ fix: "Write style={{ backgroundColor: \"#fff\" }} with literal values, or use classes."
160
+ },
161
+ "unknown-field": {
162
+ summary: "A binding names a field the schema does not declare.",
163
+ fix: "Add the field to the schema, or bind a field it declares (the message suggests the nearest)."
164
+ },
165
+ "unguarded-optional": {
166
+ summary: "An optional field is read outside a guard, so a send without it would render a blank.",
167
+ fix: "Guard it with {input.field && ...}, or make the field required."
168
+ },
169
+ "invalid-binding-type": {
170
+ summary: "A binding has the wrong type for where it is used.",
171
+ fix: "Bind a field of the type the position needs, or send it in that type."
172
+ },
173
+ "unknown-component": {
174
+ summary: "A component the profile cannot read.",
175
+ fix: "Import components from @samva/markup/email/components, samva:brand, or the project."
176
+ },
177
+ "dynamic-numeric-prop": {
178
+ summary: "A prop that sizes layout at compile time is not a number literal.",
179
+ fix: "Write the number literally, for example height={44}."
180
+ },
181
+ "button-dynamic-label": {
182
+ summary: "A Button label is read at render time, so classic Outlook cannot size it.",
183
+ fix: "Give the button a width: <Button width={200}>."
184
+ },
185
+ "invalid-columns-each": {
186
+ summary: "<Columns each> is not a list from the input.",
187
+ fix: "Write each={input.items} with a callback returning <Column>."
188
+ },
189
+ "invalid-columns-per": {
190
+ summary: "<Columns per> is not a positive integer literal.",
191
+ fix: "Write per={2}."
192
+ },
193
+ "invalid-button-number": {
194
+ summary: "A Button size prop is not a finite number.",
195
+ fix: "Pass a finite number."
196
+ },
197
+ "unsupported-element": {
198
+ summary: "An element outside the supported email vocabulary.",
199
+ fix: "Use an element from the contract's element table."
200
+ },
201
+ "unsupported-attribute": {
202
+ summary: "An attribute the element does not support.",
203
+ fix: "Use a supported attribute, or data-* and aria-*."
204
+ },
205
+ "missing-attribute": {
206
+ summary: "An element is missing a required attribute.",
207
+ fix: "Add the attribute, for example alt on img."
208
+ },
209
+ "invalid-attribute-value": {
210
+ summary: "An attribute value is not a string or number, or contains control characters.",
211
+ fix: "Pass plain text."
212
+ },
213
+ "duplicate-attribute": {
214
+ summary: "An attribute is written twice.",
215
+ fix: "Keep one."
216
+ },
217
+ "invalid-content": {
218
+ summary: "An element holds content its content model does not allow.",
219
+ fix: "Move the child to a parent that accepts it."
220
+ },
221
+ "void-element-children": {
222
+ summary: "A void element has children.",
223
+ fix: "Remove the children."
224
+ },
225
+ "event-handler": {
226
+ summary: "An event handler; email clients strip scripting.",
227
+ fix: "Remove the handler; use a link for interaction."
228
+ },
229
+ "dangerous-html": {
230
+ summary: "dangerouslySetInnerHTML; there is no raw-HTML escape hatch.",
231
+ fix: "Write the markup as JSX."
232
+ },
233
+ "unsafe-url": {
234
+ summary: "A URL uses a scheme email cannot send safely.",
235
+ fix: "Use an https URL, a mailto: or tel: link, or a bound URL."
236
+ },
237
+ "unsafe-raw-text": {
238
+ summary: "Raw text content contains markup that could end its element.",
239
+ fix: "Remove the offending sequence."
240
+ },
241
+ "unsupported-style-property": {
242
+ summary: "A style property name is not a CSS property.",
243
+ fix: "Write camelCase (backgroundColor) or a custom property (--brand)."
244
+ },
245
+ "invalid-style-value": {
246
+ summary: "A style value is not a string or number.",
247
+ fix: "Pass a string or number."
248
+ },
249
+ "unsafe-style-value": {
250
+ summary: "A style value contains CSS that could break out of its declaration.",
251
+ fix: "Remove the offending characters."
252
+ },
253
+ "missing-head": {
254
+ summary: "Styles that cannot be inlined need a <head> to live in.",
255
+ fix: "Wrap the message in <Email>, or write those declarations inline."
256
+ },
257
+ "invalid-subject": {
258
+ summary: "The subject is not one line of text.",
259
+ fix: "Return a single-line string."
260
+ },
261
+ "invalid-preheader": {
262
+ summary: "The preheader is not a string.",
263
+ fix: "Return a string."
264
+ },
265
+ "invalid-text": {
266
+ summary: "The plain-text body is not a string.",
267
+ fix: "Return a string."
268
+ },
269
+ "button-outlook-fallback": {
270
+ summary: "Classic Outlook needs a height and a plain string label to draw the button.",
271
+ fix: "Give <Button> a height and a string label."
272
+ },
273
+ "unmatched-class": {
274
+ summary: "A class produced no styles.",
275
+ fix: "Use a class the theme or Tailwind defines, or write the style inline."
276
+ },
277
+ "tailwind-dynamic-class": {
278
+ summary: "A class list is assembled at run time.",
279
+ fix: "Write the classes literally."
280
+ },
281
+ "css-parse-error": {
282
+ summary: "A stylesheet does not parse.",
283
+ fix: "Fix the CSS at the reported location."
284
+ },
285
+ "css-import-unresolved": {
286
+ summary: "A stylesheet @import cannot be resolved.",
287
+ fix: "Import the stylesheet from the template module, or use the theme.css layers."
288
+ },
289
+ "css-unsupported-at-rule": {
290
+ summary: "An at-rule is not applied to email output.",
291
+ fix: "Remove it or move the declarations into a class rule."
292
+ },
293
+ "css-conditional-variable": {
294
+ summary: "A custom property is redefined inside a conditional at-rule.",
295
+ fix: "Keep the override on a class rule."
296
+ },
297
+ "email-font-fallback": {
298
+ summary: "A font stack names a project font without a generic fallback.",
299
+ fix: "End the stack with sans-serif, serif or monospace."
300
+ },
301
+ "email-font-family": {
302
+ summary: "@font-face declares no font-family.",
303
+ fix: "Add font-family."
304
+ },
305
+ "email-font-src": {
306
+ summary: "@font-face declares no usable url() src.",
307
+ fix: "Add a url() pointing at a .woff2 file."
308
+ },
309
+ "email-font-format": {
310
+ summary: "@font-face uses a format other than WOFF2.",
311
+ fix: "Convert the file to .woff2."
312
+ },
313
+ "email-font-missing": {
314
+ summary: "@font-face names a file the project does not hold.",
315
+ fix: "Add the file; paths resolve from the stylesheet's directory."
316
+ },
317
+ "invalid-asset-base": {
318
+ summary: "The asset base is not an https URL or a path.",
319
+ fix: "Use an https URL, an absolute path, or a relative path."
320
+ },
321
+ "brand-unavailable": {
322
+ summary: "The build has no brand to resolve a samva:brand import.",
323
+ fix: "Create or select the brand the import names."
324
+ },
325
+ "brand-import-conflict": {
326
+ summary: "The project imports two different brands.",
327
+ fix: "Import one brand specifier everywhere."
328
+ },
329
+ "caniemail/unknown-coverage": {
330
+ summary: "A feature has no client-support data.",
331
+ fix: "Verify it in the target clients."
332
+ },
333
+ "invalid-attribute": {
334
+ summary: "A channel component attribute has a value the channel does not accept.",
335
+ fix: "Use one of the listed values.",
336
+ channelOnly: true
337
+ },
338
+ "unknown-attribute": {
339
+ summary: "A channel component attribute the component does not have.",
340
+ fix: "Use one of the listed attributes.",
341
+ channelOnly: true
342
+ },
343
+ "sms-markup": {
344
+ summary: "An SMS body contains an element; SMS is plain text.",
345
+ fix: "Write text and bindings, with a newline for a line break.",
346
+ channelOnly: true
347
+ },
348
+ "whatsapp-structure": {
349
+ summary: "WhatsApp content sits outside Header, Body, Footer or Buttons.",
350
+ fix: "Move it into <WhatsApp.Body>.",
351
+ channelOnly: true
352
+ },
353
+ "whatsapp-body-required": {
354
+ summary: "A WhatsApp template has no body.",
355
+ fix: "Add <WhatsApp.Body>...</WhatsApp.Body>.",
356
+ channelOnly: true
357
+ },
358
+ "whatsapp-conditional": {
359
+ summary: "A WhatsApp part branches or contains elements; Meta registers its text once.",
360
+ fix: "Choose the wording in the payload, or write separate templates.",
361
+ channelOnly: true
362
+ },
363
+ "whatsapp-header-media": {
364
+ summary: "A WhatsApp media header is not exactly one URL.",
365
+ fix: "Write the URL as the only child: a literal or one binding.",
366
+ channelOnly: true
367
+ },
368
+ "whatsapp-header-variables": {
369
+ summary: "A WhatsApp header text takes more than one variable.",
370
+ fix: "Keep one binding in the header and move the rest to the body.",
371
+ channelOnly: true
372
+ },
373
+ "whatsapp-length": {
374
+ summary: "A WhatsApp part exceeds Meta's length limit.",
375
+ fix: "Shorten the text.",
376
+ channelOnly: true
377
+ },
378
+ "whatsapp-button-text": {
379
+ summary: "A WhatsApp button has no label or value between its tags.",
380
+ fix: "Write the label or value as text between the tags.",
381
+ channelOnly: true
382
+ },
383
+ "whatsapp-button-limit": {
384
+ summary: "The conditions can produce more buttons of a kind than Meta allows.",
385
+ fix: "Remove buttons, or split the template.",
386
+ channelOnly: true
387
+ }
388
+ });
389
+ /** Whether a diagnostic identifier selects an agent-driven format upgrade. */
390
+ const hasUpgradeRecipe = (code) => Object.entries(DIAGNOSTIC_CODES).some(([identifier, spec]) => identifier === code && "upgrade" in spec);
391
+ /** Families whose code carries a suffix chosen at run time. */
392
+ const DIAGNOSTIC_CODE_FAMILIES = { "caniemail/": {
393
+ summary: "A CSS property, HTML element or attribute that a target email client ignores or partly supports (from the caniemail.com data), reported as caniemail/<feature>.",
394
+ fix: "Use the alternative the message names, such as an email component instead of display: flex."
395
+ } };
396
+ //#endregion
397
+ export { DIAGNOSTIC_CODES, DIAGNOSTIC_CODE_FAMILIES, hasUpgradeRecipe };
398
+
399
+ //# sourceMappingURL=diagnostic-codes.js.map
@@ -1,4 +1,4 @@
1
- import { i as JsxSourceLocation } from "./source-locations-DrCM82Ym.js";
1
+ import { r as JsxSourceLocation } from "./source-locations-C8wCsiAy.js";
2
2
  //#region src/email/diagnostics.d.ts
3
3
  type EmailDiagnosticSeverity = "error" | "warning" | "info";
4
4
  /** What the emitted document establishes beyond the client feature matrix. */
@@ -28,6 +28,10 @@ interface EmailDiagnostic {
28
28
  /** Compatibility observations are not automatically defects or proof of client rendering. */
29
29
  readonly compatibility?: EmailCompatibilityAssessment | undefined;
30
30
  }
31
+ /** A finding of the static compiler: an `EmailDiagnostic` plus the change that resolves it. */
32
+ interface TemplateDiagnostic extends EmailDiagnostic {
33
+ readonly fix?: string | undefined;
34
+ }
31
35
  declare const EmailCompileError_base: import("better-result").TaggedErrorClass<"EmailCompileError">;
32
36
  declare class EmailCompileError extends EmailCompileError_base<{
33
37
  readonly diagnostics: ReadonlyArray<EmailDiagnostic>;
@@ -38,9 +42,9 @@ declare class EmailCompileError extends EmailCompileError_base<{
38
42
  });
39
43
  }
40
44
  /** `emails/welcome.tsx:12:3 unsupported-element: …` — the shape agents iterate on. */
41
- declare const formatEmailDiagnostic: (diagnostic: EmailDiagnostic) => string;
45
+ declare const formatEmailDiagnostic: (diagnostic: TemplateDiagnostic) => string;
42
46
  /** True when a set of findings must stop the compile or refuse a publication. */
43
47
  declare const hasBlockingDiagnostic: (diagnostics: readonly EmailDiagnostic[]) => boolean;
44
48
  //#endregion
45
- export { formatEmailDiagnostic as a, EmailDiagnosticSeverity as i, EmailCompileError as n, hasBlockingDiagnostic as o, EmailDiagnostic as r, EmailCompatibilityAssessment as t };
46
- //# sourceMappingURL=diagnostics-BMYtBCQk.d.ts.map
49
+ export { TemplateDiagnostic as a, EmailDiagnosticSeverity as i, EmailCompileError as n, formatEmailDiagnostic as o, EmailDiagnostic as r, hasBlockingDiagnostic as s, EmailCompatibilityAssessment as t };
50
+ //# sourceMappingURL=diagnostics-B-Gym34R.d.ts.map
@@ -1,2 +1,31 @@
1
- import { a as Span, c as formatDiagnostic, i as SmlParseError, l as lineColumn, n as DiagnosticRepair, o as buildLineMap, r as SmlCompileError, s as createDiagnosticFormatter, t as Diagnostic } from "./diagnostics-OcQKQYSY.js";
2
- export { Diagnostic, DiagnosticRepair, SmlCompileError, SmlParseError, Span, buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
1
+ //#region src/diagnostics.d.ts
2
+ interface Span {
3
+ readonly start: number;
4
+ readonly end: number;
5
+ }
6
+ interface DiagnosticRepair {
7
+ readonly kind: "replace-class" | "remove-class" | "rewrite-node" | "use-primitive";
8
+ readonly raw?: string | undefined;
9
+ readonly suggestions: ReadonlyArray<string>;
10
+ readonly explanation: string;
11
+ }
12
+ interface Diagnostic {
13
+ readonly code: string;
14
+ readonly message: string;
15
+ readonly span: Span;
16
+ readonly repair?: DiagnosticRepair | undefined;
17
+ }
18
+ /** Newline-offset line map. Build once per source, query with `lineColumn`. */
19
+ declare const buildLineMap: (source: string) => ReadonlyArray<number>;
20
+ /** 1-based line/column for an absolute offset, via binary search. */
21
+ declare const lineColumn: (lineMap: ReadonlyArray<number>, offset: number) => {
22
+ readonly line: number;
23
+ readonly column: number;
24
+ };
25
+ /** Build one formatter for a batch of diagnostics against the same source. */
26
+ declare const createDiagnosticFormatter: (source: string) => ((diagnostic: Diagnostic) => string);
27
+ /** "line 12:8 unknown class ..." — the shape agents iterate on. */
28
+ declare const formatDiagnostic: (source: string, diagnostic: Diagnostic) => string;
29
+ //#endregion
30
+ export { Diagnostic, DiagnosticRepair, Span, buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
31
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -1,22 +1,4 @@
1
- import { TaggedError } from "better-result";
2
1
  //#region src/diagnostics.ts
3
- const diagnosticsMessage = (diagnostics) => diagnostics.map((diagnostic) => diagnostic.message).join("\n");
4
- var SmlParseError = class extends TaggedError("SmlParseError") {
5
- constructor(args) {
6
- super({
7
- diagnostics: args.diagnostics,
8
- message: diagnosticsMessage(args.diagnostics)
9
- });
10
- }
11
- };
12
- var SmlCompileError = class extends TaggedError("SmlCompileError") {
13
- constructor(args) {
14
- super({
15
- diagnostics: args.diagnostics,
16
- message: diagnosticsMessage(args.diagnostics)
17
- });
18
- }
19
- };
20
2
  /** Newline-offset line map. Build once per source, query with `lineColumn`. */
21
3
  const buildLineMap = (source) => {
22
4
  const lineStarts = [0];
@@ -51,6 +33,6 @@ const createDiagnosticFormatter = (source) => {
51
33
  /** "line 12:8 unknown class ..." — the shape agents iterate on. */
52
34
  const formatDiagnostic = (source, diagnostic) => createDiagnosticFormatter(source)(diagnostic);
53
35
  //#endregion
54
- export { SmlCompileError, SmlParseError, buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
36
+ export { buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
55
37
 
56
38
  //# sourceMappingURL=diagnostics.js.map
@@ -1,5 +1,5 @@
1
- import { i as JsxSourceLocation } from "./source-locations-DrCM82Ym.js";
2
- import { r as EmailDiagnostic } from "./diagnostics-BMYtBCQk.js";
1
+ import { r as JsxSourceLocation } from "./source-locations-C8wCsiAy.js";
2
+ import { r as EmailDiagnostic } from "./diagnostics-B-Gym34R.js";
3
3
  //#region src/email/jsx-runtime.d.ts
4
4
  /** Derived authoring tree; source stays canonical. Origins run from inner element to component call sites. */
5
5
  type EmailNode = {
@@ -696,4 +696,4 @@ type ChildrenProp<Content extends EmailElementSpec["content"]> = Content extends
696
696
  type EmailIntrinsicElements = { readonly [Tag in EmailTag]: EmailGlobalProps & AttributeProps<typeof EMAIL_GLOBAL_ATTRIBUTES> & AttributeProps<(typeof EMAIL_ELEMENTS)[Tag]["attributes"]> & ChildrenProp<(typeof EMAIL_ELEMENTS)[Tag]["content"]>; };
697
697
  //#endregion
698
698
  export { reportEmailDiagnostic as C, rawMarkup as S, currentEmailOrigins as _, EmailGlobalProps as a, jsxs as b, EmailStyle as c, isUrlAttribute as d, EmailChild as f, JSX as g, Fragment as h, EmailElementSpec as i, EmailTag as l, EmailNode as m, EMAIL_GLOBAL_ATTRIBUTES as n, EmailIntrinsicElements as o, EmailComponent as p, EmailAttributeSpec as r, EmailLayout as s, EMAIL_ELEMENTS as t, emailElement as u, drainEmailDiagnostics as v, normalizeChildren as x, jsx as y };
699
- //# sourceMappingURL=elements-BzjjnoCS.d.ts.map
699
+ //# sourceMappingURL=elements-cqldpaJt.d.ts.map
@@ -1,40 +1,2 @@
1
- import { r as EmailDiagnostic } from "../diagnostics-BMYtBCQk.js";
2
- //#region src/email/assets.d.ts
3
- /** Files a template may import, and what they are served as. */
4
- declare const ASSET_CONTENT_TYPES: Readonly<Record<string, string>>;
5
- interface AssetEntry {
6
- /** Project-relative path the template imported. */
7
- readonly path: string;
8
- /** SHA-256 of the exact bytes, lowercase hex. */
9
- readonly digest: string;
10
- readonly bytes: number;
11
- readonly contentType: string;
12
- /** `<digest><ext>` — the name the asset has under any base. */
13
- readonly fileName: string;
14
- }
15
- interface AssetManifest {
16
- /** Where these assets are served from in this build. */
17
- readonly base: string;
18
- readonly assets: readonly AssetEntry[];
19
- }
20
- /** True when the compiler turns this import into a content-addressed asset. */
21
- declare const isAssetPath: (path: string) => boolean;
22
- /** Address one file by its content. */
23
- declare const assetEntry: (path: string, bytes: Uint8Array) => Promise<AssetEntry>;
24
- /**
25
- * The URL an asset has under a base. The base is a build input: publication
26
- * passes its hosted origin, and a local export passes whatever it will serve
27
- * the exported files from.
28
- */
29
- declare const assetUrl: (entry: AssetEntry, base: string) => string;
30
- /** Record, but never fetch, a URL the template points at. */
31
- declare const isExternalAsset: (reference: string) => boolean;
32
- /**
33
- * Reject an asset base that would produce URLs a client will not load. The
34
- * relative forms are the ones a page on disk resolves against its own
35
- * directory, which is what a local export writes.
36
- */
37
- declare const checkAssetBase: (base: string) => readonly EmailDiagnostic[];
38
- //#endregion
39
- export { ASSET_CONTENT_TYPES, AssetEntry, AssetManifest, assetEntry, assetUrl, checkAssetBase, isAssetPath, isExternalAsset };
40
- //# sourceMappingURL=assets.d.ts.map
1
+ import { a as assetUrl, c as isExternalAsset, i as assetEntry, n as AssetEntry, o as checkAssetBase, r as AssetManifest, s as isAssetPath, t as ASSET_CONTENT_TYPES } from "../assets-C5duwTya.js";
2
+ export { ASSET_CONTENT_TYPES, AssetEntry, AssetManifest, assetEntry, assetUrl, checkAssetBase, isAssetPath, isExternalAsset };
@@ -1,6 +1,6 @@
1
- import { t as EmailContent } from "../template-DWftqh4x.js";
1
+ import { n as EmailContent } from "../template-_QE_rQND.js";
2
2
  import { RenderedEmail } from "./render.js";
3
- import { a as EmailBrand, n as BrandComponents } from "../brand-DcoVkh_S.js";
3
+ import { a as EmailBrand, n as BrandComponents } from "../brand-B-0bN_Ir.js";
4
4
  //#region src/email/brand-footer.d.ts
5
5
  /** A footer block for the send path to append, and its plain-text tail. */
6
6
  interface RenderedBrandFooter {
@@ -1,8 +1,9 @@
1
- import { a as renderEmailContent, o as applyStylesheet, r as compileEmail } from "../render-vAv_4r9v.js";
2
1
  import { EmailCompileError } from "./diagnostics.js";
3
- import { BRAND_COMPONENT_CLASSES, brandComponents, withoutUnsubscribeRow } from "./brand.js";
4
2
  import { c as parseBrandCss, i as brandTailwindCss } from "../theme-css-hFqcPSar.js";
5
- import { t as compileTailwind, u as parseStylesheet } from "../tailwind-BYq7Lo6u.js";
3
+ import { BRAND_COMPONENT_CLASSES, brandComponents, withoutUnsubscribeRow } from "./brand.js";
4
+ import { t as applyStylesheet } from "../cascade-t6kxlgEI.js";
5
+ import { a as parseStylesheet, t as compileTailwind } from "../tailwind-CMYpZf1v.js";
6
+ import { compileEmail, renderEmailContent } from "./render.js";
6
7
  //#region src/email/brand-footer.ts
7
8
  /** The brand theme as Tailwind compiles it; a theme outside the grammar is a compile refusal. */
8
9
  const brandTheme = (brand) => {
@@ -1,2 +1,2 @@
1
- import { a as EmailBrand, c as EmailBrandFooter, d as RenderedFooterMarkers, f as UNSUBSCRIBE_ROW_ATTRIBUTE, g as UNSUBSCRIBE_URL_PLACEHOLDER, h as withoutUnsubscribeRow, i as BrandLogoProps, l as EmailBrandSocialLink, m as renderedFooterMarkers, n as BrandComponents, o as EmailBrandAddress, p as brandComponents, r as BrandFooterProps, s as EmailBrandAssets, t as BRAND_COMPONENT_CLASSES, u as FOOTER_ATTRIBUTE } from "../brand-DcoVkh_S.js";
1
+ import { a as EmailBrand, c as EmailBrandFooter, d as RenderedFooterMarkers, f as UNSUBSCRIBE_ROW_ATTRIBUTE, g as UNSUBSCRIBE_URL_PLACEHOLDER, h as withoutUnsubscribeRow, i as BrandLogoProps, l as EmailBrandSocialLink, m as renderedFooterMarkers, n as BrandComponents, o as EmailBrandAddress, p as brandComponents, r as BrandFooterProps, s as EmailBrandAssets, t as BRAND_COMPONENT_CLASSES, u as FOOTER_ATTRIBUTE } from "../brand-B-0bN_Ir.js";
2
2
  export { BRAND_COMPONENT_CLASSES, BrandComponents, BrandFooterProps, BrandLogoProps, EmailBrand, EmailBrandAddress, EmailBrandAssets, EmailBrandFooter, EmailBrandSocialLink, FOOTER_ATTRIBUTE, RenderedFooterMarkers, UNSUBSCRIBE_ROW_ATTRIBUTE, UNSUBSCRIBE_URL_PLACEHOLDER, brandComponents, renderedFooterMarkers, withoutUnsubscribeRow };
@@ -1,5 +1,5 @@
1
- import { Fragment, jsx } from "./jsx-runtime.js";
2
1
  import { i as UNSUBSCRIBE_URL_PLACEHOLDER, r as UNSUBSCRIBE_LINK, t as BRAND_FOOTER_MARKER } from "../unsubscribe-link-CoesnQDU.js";
2
+ import { Fragment, jsx } from "./jsx-runtime.js";
3
3
  //#region src/email/brand.ts
4
4
  /** Marks the block the send path recognizes as the template's own footer. */
5
5
  const FOOTER_ATTRIBUTE = "data-samva-footer";
@@ -1,4 +1,4 @@
1
- import { c as EmailStyle, f as EmailChild, m as EmailNode } from "../elements-BzjjnoCS.js";
1
+ import { c as EmailStyle, f as EmailChild, m as EmailNode } from "../elements-cqldpaJt.js";
2
2
  //#region src/email/components.d.ts
3
3
  /** Marks the hidden preview block so the renderer can read it back and the text lane can keep it. */
4
4
  declare const PREHEADER_ATTRIBUTE = "data-samva-preheader";
@@ -9,8 +9,6 @@ interface EmailProps {
9
9
  readonly dir?: "ltr" | "rtl" | undefined;
10
10
  /** Document title; several clients use it as the fallback preview line. */
11
11
  readonly title?: string | undefined;
12
- /** Hidden preview text shown in the inbox list next to the subject. */
13
- readonly preheader?: string | undefined;
14
12
  readonly backgroundColor?: string | undefined;
15
13
  /** Applied to the content cell, where Yahoo and AOL keep body styling. */
16
14
  readonly style?: EmailStyle | undefined;
@@ -19,7 +17,7 @@ interface EmailProps {
19
17
  /** The hidden inbox preview block. Padding characters stop the client borrowing body copy. */
20
18
  declare const preheaderNode: (text: string) => EmailNode;
21
19
  /** Document shell: the head every target client needs, plus the body content cell. */
22
- declare const Email: ({ className, lang, dir, title, preheader, backgroundColor, style, children }: EmailProps) => EmailNode;
20
+ declare const Email: ({ className, lang, dir, title, backgroundColor, style, children }: EmailProps) => EmailNode;
23
21
  interface SectionProps {
24
22
  /** CSS classes applied to the primitive's content element. */
25
23
  readonly className?: string | undefined;
@@ -33,17 +31,30 @@ interface SectionProps {
33
31
  }
34
32
  /** A full-width band of content, as the single-cell table every client agrees on. */
35
33
  declare const Section: ({ className, align, width, bgcolor, style, tableStyle, children }: SectionProps) => EmailNode;
36
- interface ColumnsProps {
34
+ interface ColumnsProps<Item = never> {
37
35
  /** CSS classes applied to the primitive's content element. */
38
36
  readonly className?: string | undefined;
39
37
  readonly align?: "left" | "center" | "right" | undefined;
40
38
  readonly width?: number | string | undefined;
41
39
  readonly style?: EmailStyle | undefined;
42
- /** `Column` elements; anything else is a content-model error. */
43
- readonly children?: EmailChild;
40
+ /**
41
+ * Repeat the cells for each item: `children` is then a function from an item (and its index in
42
+ * the row) to a `Column`. Without `per` all items share one row.
43
+ */
44
+ readonly each?: readonly Item[] | undefined;
45
+ /** With `each`, the cells in a row; each chunk of items is its own `Columns` table. */
46
+ readonly per?: number | undefined;
47
+ /** `Column` elements, or with `each` a function that returns one. */
48
+ readonly children?: EmailChild | ((item: Item, index: number) => EmailChild);
44
49
  }
45
- /** A row of side-by-side `Column`s. No flex or grid conversion happens here. */
46
- declare const Columns: ({ className, align, width, style, children }: ColumnsProps) => EmailNode;
50
+ /** The equal share of a row that each of `count` cells takes, whole percent rounded down. */
51
+ declare const equalColumnWidth: (count: number) => string;
52
+ /**
53
+ * A row of side-by-side `Column`s. No flex or grid conversion happens here. With `each` it repeats
54
+ * its cells over a list, `per` to a row, and splits the row equally between cells that state no
55
+ * width.
56
+ */
57
+ declare const Columns: <Item = never>({ className, align, width, style, each, per, children }: ColumnsProps<Item>) => EmailNode;
47
58
  interface ColumnProps {
48
59
  /** CSS classes applied to the primitive's content element. */
49
60
  readonly className?: string | undefined;
@@ -121,5 +132,5 @@ interface LinkProps {
121
132
  /** A text link that opens outside the client and cannot reach back at the opener. */
122
133
  declare const Link: ({ className, href, target, rel, style, children }: LinkProps) => EmailNode;
123
134
  //#endregion
124
- export { Button, ButtonProps, Column, ColumnProps, Columns, ColumnsProps, Divider, DividerProps, Email, EmailProps, Image, ImageProps, Link, LinkProps, PREHEADER_ATTRIBUTE, Section, SectionProps, Spacer, SpacerProps, preheaderNode };
135
+ export { Button, ButtonProps, Column, ColumnProps, Columns, ColumnsProps, Divider, DividerProps, Email, EmailProps, Image, ImageProps, Link, LinkProps, PREHEADER_ATTRIBUTE, Section, SectionProps, Spacer, SpacerProps, equalColumnWidth, preheaderNode };
125
136
  //# sourceMappingURL=components.d.ts.map