@samva/markup 0.15.1 → 0.17.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 (51) hide show
  1. package/AGENTS.md +42 -35
  2. package/CHANGELOG.md +92 -0
  3. package/README.md +10 -9
  4. package/dist/{assets-tISHaQNF.d.ts → assets-CS5Xa_mr.d.ts} +3 -3
  5. package/dist/{brand-nreeKWxF.js → brand-CIiEqkU7.js} +24 -31
  6. package/dist/{brand-plugin-CHhcei-j.d.ts → brand-plugin-Dj9SMpfS.d.ts} +3 -1
  7. package/dist/brand.d.ts +2 -2
  8. package/dist/brand.js +3 -3
  9. package/dist/compatibility.d.ts +76 -0
  10. package/dist/compatibility.js +807 -0
  11. package/dist/compiled-template-Bc4Dq9zy.d.ts +268 -0
  12. package/dist/compiler.d.ts +58 -225
  13. package/dist/compiler.js +261 -1297
  14. package/dist/{components-3XHjYD3i.js → components-C5850-Qg.js} +37 -29
  15. package/dist/css-B_aVKrDo.js +436 -0
  16. package/dist/css-color-DLM12Osu.js +315 -0
  17. package/dist/{diagnostic-codes-UXwOO3A-.js → diagnostic-codes-DZKb0Xcg.js} +4 -0
  18. package/dist/{diagnostics-CUYlQ_6x.d.ts → diagnostics-D4vSLQrO.d.ts} +1 -10
  19. package/dist/diagnostics.d.ts +6 -2
  20. package/dist/diagnostics.js +3 -3
  21. package/dist/edit.d.ts +10 -9
  22. package/dist/edit.js +12 -11
  23. package/dist/email/jsx-dev-runtime.d.ts +1 -1
  24. package/dist/email/jsx-dev-runtime.js +1 -1
  25. package/dist/email/jsx-runtime.d.ts +2 -2
  26. package/dist/email/jsx-runtime.js +2 -2
  27. package/dist/email.d.ts +1 -1
  28. package/dist/email.js +1 -1
  29. package/dist/html-DJUK2YJF.js +483 -0
  30. package/dist/index.d.ts +1 -1
  31. package/dist/{jsx-runtime-DC7xG0aA.d.ts → jsx-runtime-DL8NVF1f.d.ts} +12 -6
  32. package/dist/{jsx-runtime-CBlexoeR.js → jsx-runtime-qL19u3Fy.js} +17 -10
  33. package/dist/preview-rNoJBEIY.d.ts +104 -0
  34. package/dist/{profile-AatO_SvP.js → profile-JTvgCD6X.js} +614 -24
  35. package/dist/{html-BvRFepeO.js → render-template-DwPDm3Hq.js} +155 -572
  36. package/dist/render.d.ts +40 -28
  37. package/dist/render.js +3 -47
  38. package/dist/selectors-CYWCoxZr.js +157 -0
  39. package/dist/sms.d.ts +1 -1
  40. package/dist/sms.js +1 -1
  41. package/dist/{template-B-UDXK8a.d.ts → template-DmNcoH4Q.d.ts} +2 -9
  42. package/dist/{theme-css-s9QwD5Ko.js → theme-css-P9F5S7Ic.js} +3 -316
  43. package/dist/whatsapp.d.ts +1 -1
  44. package/dist/whatsapp.js +1 -1
  45. package/generated/contract.json +7 -2
  46. package/generated/reference.md +3 -2
  47. package/package.json +5 -1
  48. package/skills/sml/SKILL.md +2 -2
  49. package/dist/ir-DNL6H7jA.js +0 -705
  50. package/dist/render-BdvewoQt.d.ts +0 -564
  51. package/dist/render-DpYouYYG.js +0 -258
package/dist/whatsapp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as jsx, n as Fragment } from "./jsx-runtime-CBlexoeR.js";
1
+ import { a as jsx, n as Fragment } from "./jsx-runtime-qL19u3Fy.js";
2
2
  //#region src/whatsapp.ts
3
3
  const fragment = (children) => jsx(Fragment, { children });
4
4
  /**
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contract": 1,
3
- "irVersion": 1,
3
+ "compiledTemplateVersion": 1,
4
4
  "template": {
5
5
  "extension": ".tsx",
6
6
  "directories": ["templates", "emails"],
@@ -14,7 +14,7 @@
14
14
  "emailBody": "{ subject, preheader?, body }, each a function of the validated input",
15
15
  "schema": "Any Standard JSON Schema converter, or a literal jsonSchema<Input>({ ... }); portable JSON Schema 2020-12. It validates every send and drives the binding checker. No coercion and no inserted defaults.",
16
16
  "fixtures": "Named payloads that must validate. At least one. Each is a preview and a publish check.",
17
- "execution": "Nothing runs at send time. A template compiles to IR and the send path renders the IR against the input. Locale and time zone are send options."
17
+ "execution": "Nothing runs at send time. A template compiles to a compiled template and the send path renders it against the input. Locale and time zone are send options."
18
18
  },
19
19
  "profile": {
20
20
  "forms": [
@@ -1556,6 +1556,11 @@
1556
1556
  "fix": "Pair background and text tokens (bg-primary with text-primary-foreground), give the theme's dark-mode @theme a value for the token, or choose colors that reach the required ratio.",
1557
1557
  "upgrade": "Move the project's theme onto the theme vocabulary with one dark-mode block. In starter.css and theme.css, rename each color token to the vocabulary name for its role (reference.md, Theme): a page color to --color-background, the main text to --color-foreground, a surface to --color-card with --color-card-foreground, the brand or action color to --color-primary with --color-primary-foreground, subdued text to --color-muted-foreground, a highlight to --color-accent with --color-accent-foreground, rules to --color-border, body and heading fonts to --font-sans and --font-heading, and a corner radius to --radius. Keep every value.\n\nMove each --color-<name>-dark value into @media (prefers-color-scheme: dark) { @theme { --color-<name>: <value>; } } under the renamed token, and delete the -dark tokens. In every template and partial, rename the utilities to match (bg-surface to bg-card, text-muted to text-muted-foreground, and so on) and delete each dark:…-dark class whose token now has a dark value; keep a dark: class only where it picks a different token in dark mode.\n\nThen fix what email-contrast still reports at its location: pair each fill with its -foreground token, or give the dark block a value that reaches the ratio. Do not weaken the design to pass: keep the brand's colors and adjust the paired token.\n\nCompile every entry and render every fixture in light and dark mode; confirm the light render is unchanged apart from fixes. Resolve errors before requesting one saved version for the whole project, approved by the user; do not publish."
1558
1558
  },
1559
+ {
1560
+ "code": "email-external-asset",
1561
+ "summary": "An image points at another site's URL; a hotlinked image can disappear, be blocked, track recipients or slow the message.",
1562
+ "fix": "Add the image to the project's files and import it (import logo from './logo.png'), then use the import as the src."
1563
+ },
1559
1564
  {
1560
1565
  "code": "email-font-fallback",
1561
1566
  "summary": "A font stack names a project font without a generic fallback.",
@@ -3,8 +3,8 @@
3
3
  A template is one TSX file that default-exports `defineTemplate({ id, schema, fixtures, email })`
4
4
  from `@samva/markup`, in `templates/` (`emails/` is also recognized). Set
5
5
  `jsxImportSource: "@samva/markup/email"`. `email` is `{ subject, preheader?, body }`; each is a
6
- function of the validated input that the compiler reads without running. The IR it produces is what
7
- every preview and send renders (IR version 1).
6
+ function of the validated input that the compiler reads without running. The compiled template it
7
+ produces is what every preview and send renders (compiled template version 1).
8
8
 
9
9
  ## Static profile
10
10
 
@@ -305,6 +305,7 @@ Global attributes: `id`, `title`, `lang`, `dir`, `role`.
305
305
  | `dynamic-expression` | An expression outside the static profile: a call other than fmt.* and .map, a computed value, or a spread. | Compute the value where the message is sent and bind it from the payload. |
306
306
  | `dynamic-numeric-prop` | A prop that sizes layout at compile time is not a number literal. | Write the number literally, for example height={44}. |
307
307
  | `email-contrast` | Text, or a filled button against its surroundings, falls below the contrast ratio in light or dark mode (below 1.5:1 a button is indistinguishable from its surface; WCAG 1.4.11 asks 3:1). | Pair background and text tokens (bg-primary with text-primary-foreground), give the theme's dark-mode @theme a value for the token, or choose colors that reach the required ratio. |
308
+ | `email-external-asset` | An image points at another site's URL; a hotlinked image can disappear, be blocked, track recipients or slow the message. | Add the image to the project's files and import it (import logo from './logo.png'), then use the import as the src. |
308
309
  | `email-font-fallback` | A font stack names a project font without a generic fallback. | End the stack with sans-serif, serif or monospace. |
309
310
  | `email-font-family` | @font-face declares no font-family. | Add font-family. |
310
311
  | `email-font-format` | @font-face uses a format other than WOFF2. | Convert the file to .woff2. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samva/markup",
3
- "version": "0.15.1",
3
+ "version": "0.17.0",
4
4
  "description": "Type-safe authoring and compilation primitives for Samva templates",
5
5
  "keywords": [
6
6
  "email",
@@ -73,6 +73,10 @@
73
73
  "types": "./dist/compiler.d.ts",
74
74
  "import": "./dist/compiler.js"
75
75
  },
76
+ "./compatibility": {
77
+ "types": "./dist/compatibility.d.ts",
78
+ "import": "./dist/compatibility.js"
79
+ },
76
80
  "./diagnostics": {
77
81
  "types": "./dist/diagnostics.d.ts",
78
82
  "import": "./dist/diagnostics.js"
@@ -7,7 +7,7 @@ description: Author, check, render and repair Samva email templates written as s
7
7
 
8
8
  A template is one `.tsx` file that default-exports `defineTemplate` from `@samva/markup`. It is
9
9
  ordinary JSX, HTML and Tailwind written in a static profile: the compiler reads it without running
10
- it and produces a JSON IR. Every preview and every send renders that IR against the input, so
10
+ it and produces a compiled template: JSON. Every preview and every send renders that template against the input, so
11
11
  nothing you write executes at send time.
12
12
 
13
13
  ## The loop
@@ -23,7 +23,7 @@ samva templates dev # local editor with every fixture re
23
23
 
24
24
  Add `--json` for diagnostics as data: each has a `code`, a location, a severity and a `fix`. Apply
25
25
  the fix the diagnostic names rather than rewriting around it. Without the CLI, call
26
- `compileTemplate` from `@samva/markup/compiler` and `renderIr` from `@samva/markup/render`.
26
+ `compileTemplate` from `@samva/markup/compiler` and `render` from `@samva/markup/render`.
27
27
 
28
28
  ## Upgrades
29
29