@samva/markup 0.5.0 → 0.7.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 (85) hide show
  1. package/AGENTS.md +80 -45
  2. package/README.md +1 -1
  3. package/dist/{ast-BLybiDxp.d.ts → ast-BrDtApwS.d.ts} +2 -2
  4. package/dist/ast.d.ts +1 -1
  5. package/dist/ast.js +1 -1
  6. package/dist/{catalog-Db0UcCTg.d.ts → catalog-60eaYC7b.d.ts} +2 -2
  7. package/dist/{checks-CmmITP6j.js → checks-DBweSIPN.js} +12 -14
  8. package/dist/checks.d.ts +1 -1
  9. package/dist/checks.js +1 -1
  10. package/dist/classes.d.ts +1 -1
  11. package/dist/compile-sms.d.ts +3 -3
  12. package/dist/compile-whatsapp.d.ts +3 -3
  13. package/dist/compile.d.ts +2 -2
  14. package/dist/compiler.d.ts +7 -4
  15. package/dist/compiler.js +67 -46
  16. package/dist/components.d.ts +5 -5
  17. package/dist/conditionals.js +55 -23
  18. package/dist/{corpus-CM7rKX41.d.ts → corpus-BjYMqOoY.d.ts} +2 -2
  19. package/dist/{css-DoNc7CiC.d.ts → css-COcFOT1y.d.ts} +3 -3
  20. package/dist/{diagnostics-eFM9A_TU.d.ts → diagnostics-BMYtBCQk.d.ts} +2 -2
  21. package/dist/{diagnostics-CqepLcpI.d.ts → diagnostics-OcQKQYSY.d.ts} +4 -2
  22. package/dist/diagnostics.d.ts +2 -2
  23. package/dist/diagnostics.js +10 -5
  24. package/dist/{elements-ChJULZlh.d.ts → elements-BzjjnoCS.d.ts} +3 -3
  25. package/dist/email/components.d.ts +1 -1
  26. package/dist/email/components.js +40 -10
  27. package/dist/email/diagnostics.d.ts +1 -1
  28. package/dist/email/elements.d.ts +1 -1
  29. package/dist/email/html.d.ts +2 -2
  30. package/dist/email/html.js +2 -1
  31. package/dist/email/jsx-dev-runtime.d.ts +2 -2
  32. package/dist/email/jsx-runtime.d.ts +1 -1
  33. package/dist/email/render.d.ts +4 -4
  34. package/dist/email/render.js +1 -1
  35. package/dist/email/selection.d.ts +1 -1
  36. package/dist/email/source-edit.d.ts +1 -1
  37. package/dist/email/stylesheets.d.ts +1 -1
  38. package/dist/email/text.d.ts +1 -1
  39. package/dist/emit.d.ts +2 -2
  40. package/dist/emit.js +2 -2
  41. package/dist/footer.d.ts +3 -3
  42. package/dist/footer.js +9 -6
  43. package/dist/jsx-dev-runtime.d.ts +2 -2
  44. package/dist/{jsx-runtime-BI4gI19E.d.ts → jsx-runtime-I-1nCtl2.d.ts} +3 -3
  45. package/dist/jsx-runtime.d.ts +1 -1
  46. package/dist/lexer.js +17 -5
  47. package/dist/model.d.ts +1 -1
  48. package/dist/ops-2aiiYO7m.js +630 -0
  49. package/dist/ops.d.ts +2 -2
  50. package/dist/ops.js +1 -479
  51. package/dist/{parser-b_Kp5MT6.d.ts → parser-t29cHLVL.d.ts} +4 -4
  52. package/dist/parser.d.ts +1 -1
  53. package/dist/parser.js +2 -3
  54. package/dist/{predicate-DwXzmqIY.js → predicate-BI6uRRM-.js} +14 -4
  55. package/dist/{predicate-Bmvgw7Ao.d.ts → predicate-M-05Nd7R.d.ts} +2 -2
  56. package/dist/predicate.d.ts +1 -1
  57. package/dist/predicate.js +1 -1
  58. package/dist/presets/category-mapping.d.ts +1 -1
  59. package/dist/presets/corpus.d.ts +1 -1
  60. package/dist/presets/public-gallery.d.ts +2 -2
  61. package/dist/presets/public-gallery.js +10 -2
  62. package/dist/presets/public-handoff.d.ts +2 -2
  63. package/dist/presets/public-preview-artifacts.d.ts +3 -1
  64. package/dist/presets/public-preview-artifacts.js +1 -0
  65. package/dist/presets/showcase.d.ts +1 -1
  66. package/dist/presets.d.ts +1 -1
  67. package/dist/printer.d.ts +1 -1
  68. package/dist/{render-T6IFPnP4.js → render-aaJBnsXK.js} +33 -16
  69. package/dist/render-template.d.ts +5 -5
  70. package/dist/render-template.js +1 -1
  71. package/dist/{showcase-dvJMn-Lo.d.ts → showcase-DGZAWn4Z.d.ts} +2 -2
  72. package/dist/{source-locations-D6Te6Gy1.d.ts → source-locations-DrCM82Ym.d.ts} +2 -2
  73. package/dist/source-locations.d.ts +1 -1
  74. package/dist/{template-G-QPcfmn.d.ts → template-DWftqh4x.d.ts} +2 -2
  75. package/dist/template.d.ts +1 -1
  76. package/dist/theme-css.d.ts +1 -1
  77. package/dist/theme.js +25 -2
  78. package/dist/tsx-source-instrumentation.d.ts +9 -0
  79. package/dist/tsx-source-instrumentation.js +20 -2
  80. package/dist/tsx-tracer.d.ts +1 -1
  81. package/dist/tsx-tracer.js +3 -3
  82. package/dist/{variables-BnKs1iqb.d.ts → variables-J_L3qxRa.d.ts} +2 -2
  83. package/dist/variables.d.ts +1 -1
  84. package/dist/variables.js +1 -1
  85. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
- import { r as EmailDiagnostic } from "./diagnostics-eFM9A_TU.js";
2
- import { m as EmailNode } from "./elements-ChJULZlh.js";
1
+ import { r as EmailDiagnostic } from "./diagnostics-BMYtBCQk.js";
2
+ import { m as EmailNode } from "./elements-BzjjnoCS.js";
3
3
  import "css-tree";
4
4
  //#region src/email/selectors.d.ts
5
5
  type EmailElementNode = Extract<EmailNode, {
@@ -80,4 +80,4 @@ declare const parseStylesheet: (source: string, options?: {
80
80
  }) => Stylesheet;
81
81
  //#endregion
82
82
  export { compileSelector as a, CompiledSelector as c, matchesSelector as d, Stylesheet as i, Compound as l, CssRule as n, parseStylesheet as o, Specificity as r, Ancestry as s, CssDeclaration as t, classListOf as u };
83
- //# sourceMappingURL=css-DoNc7CiC.d.ts.map
83
+ //# sourceMappingURL=css-COcFOT1y.d.ts.map
@@ -1,4 +1,4 @@
1
- import { i as JsxSourceLocation } from "./source-locations-D6Te6Gy1.js";
1
+ import { i as JsxSourceLocation } from "./source-locations-DrCM82Ym.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. */
@@ -43,4 +43,4 @@ declare const formatEmailDiagnostic: (diagnostic: EmailDiagnostic) => string;
43
43
  declare const hasBlockingDiagnostic: (diagnostics: readonly EmailDiagnostic[]) => boolean;
44
44
  //#endregion
45
45
  export { formatEmailDiagnostic as a, EmailDiagnosticSeverity as i, EmailCompileError as n, hasBlockingDiagnostic as o, EmailDiagnostic as r, EmailCompatibilityAssessment as t };
46
- //# sourceMappingURL=diagnostics-eFM9A_TU.d.ts.map
46
+ //# sourceMappingURL=diagnostics-BMYtBCQk.d.ts.map
@@ -40,8 +40,10 @@ declare const lineColumn: (lineMap: ReadonlyArray<number>, offset: number) => {
40
40
  readonly line: number;
41
41
  readonly column: number;
42
42
  };
43
+ /** Build one formatter for a batch of diagnostics against the same source. */
44
+ declare const createDiagnosticFormatter: (source: string) => ((diagnostic: Diagnostic) => string);
43
45
  /** "line 12:8 unknown class ..." — the shape agents iterate on. */
44
46
  declare const formatDiagnostic: (source: string, diagnostic: Diagnostic) => string;
45
47
  //#endregion
46
- export { Span as a, lineColumn as c, SmlParseError as i, DiagnosticRepair as n, buildLineMap as o, SmlCompileError as r, formatDiagnostic as s, Diagnostic as t };
47
- //# sourceMappingURL=diagnostics-CqepLcpI.d.ts.map
48
+ export { Span as a, formatDiagnostic as c, SmlParseError as i, lineColumn as l, DiagnosticRepair as n, buildLineMap as o, SmlCompileError as r, createDiagnosticFormatter as s, Diagnostic as t };
49
+ //# sourceMappingURL=diagnostics-OcQKQYSY.d.ts.map
@@ -1,2 +1,2 @@
1
- import { a as Span, c as lineColumn, i as SmlParseError, n as DiagnosticRepair, o as buildLineMap, r as SmlCompileError, s as formatDiagnostic, t as Diagnostic } from "./diagnostics-CqepLcpI.js";
2
- export { Diagnostic, DiagnosticRepair, SmlCompileError, SmlParseError, Span, buildLineMap, formatDiagnostic, lineColumn };
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 };
@@ -40,12 +40,17 @@ const lineColumn = (lineMap, offset) => {
40
40
  column: offset - lineMap[low] + 1
41
41
  };
42
42
  };
43
- /** "line 12:8 unknown class ..." — the shape agents iterate on. */
44
- const formatDiagnostic = (source, diagnostic) => {
45
- const { line, column } = lineColumn(buildLineMap(source), diagnostic.span.start);
46
- return `line ${line}:${column} ${diagnostic.message}`;
43
+ /** Build one formatter for a batch of diagnostics against the same source. */
44
+ const createDiagnosticFormatter = (source) => {
45
+ const lineMap = buildLineMap(source);
46
+ return (diagnostic) => {
47
+ const { line, column } = lineColumn(lineMap, diagnostic.span.start);
48
+ return `line ${line}:${column} ${diagnostic.message}`;
49
+ };
47
50
  };
51
+ /** "line 12:8 unknown class ..." — the shape agents iterate on. */
52
+ const formatDiagnostic = (source, diagnostic) => createDiagnosticFormatter(source)(diagnostic);
48
53
  //#endregion
49
- export { SmlCompileError, SmlParseError, buildLineMap, formatDiagnostic, lineColumn };
54
+ export { SmlCompileError, SmlParseError, buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
50
55
 
51
56
  //# sourceMappingURL=diagnostics.js.map
@@ -1,5 +1,5 @@
1
- import { i as JsxSourceLocation } from "./source-locations-D6Te6Gy1.js";
2
- import { r as EmailDiagnostic } from "./diagnostics-eFM9A_TU.js";
1
+ import { i as JsxSourceLocation } from "./source-locations-DrCM82Ym.js";
2
+ import { r as EmailDiagnostic } from "./diagnostics-BMYtBCQk.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-ChJULZlh.d.ts.map
699
+ //# sourceMappingURL=elements-BzjjnoCS.d.ts.map
@@ -1,4 +1,4 @@
1
- import { c as EmailStyle, f as EmailChild, m as EmailNode } from "../elements-ChJULZlh.js";
1
+ import { c as EmailStyle, f as EmailChild, m as EmailNode } from "../elements-BzjjnoCS.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";
@@ -107,24 +107,54 @@ const Column = ({ className, align, valign, width, style, children }) => jsx("td
107
107
  const DEFAULT_BUTTON_FONT = "Helvetica, Arial, sans-serif";
108
108
  /** Average advance of a bold sans-serif glyph, as a fraction of the font size. */
109
109
  const BOLD_GLYPH_ADVANCE = .6;
110
+ const invalidButtonNumber = (name) => reportEmailDiagnostic({
111
+ code: "invalid-button-number",
112
+ severity: "error",
113
+ message: `<Button ${name}> must be a finite number.`
114
+ });
115
+ const buttonNumber = (name, value, fallback) => {
116
+ if (typeof value === "number" && Number.isFinite(value)) return value;
117
+ invalidButtonNumber(name);
118
+ return fallback;
119
+ };
120
+ const optionalButtonNumber = (name, value) => {
121
+ if (value === void 0) return void 0;
122
+ if (typeof value === "number" && Number.isFinite(value)) return value;
123
+ invalidButtonNumber(name);
124
+ };
125
+ const optionalPositiveButtonNumber = (name, value) => {
126
+ if (value === void 0) return void 0;
127
+ if (typeof value === "number" && Number.isFinite(value) && value > 0) return value;
128
+ reportEmailDiagnostic({
129
+ code: "invalid-button-number",
130
+ severity: "error",
131
+ message: `<Button ${name}> must be a positive finite number.`
132
+ });
133
+ };
110
134
  /** A link styled as a button, with a VML fallback so classic Outlook draws the shape. */
111
135
  const Button = ({ className, href, width, height, paddingX = 16, backgroundColor = "#000000", color = "#ffffff", borderRadius = 0, borderColor, borderWidth = 0, fontSize = 16, fontFamily = DEFAULT_BUTTON_FONT, align = "left", style, children }) => {
136
+ const safeWidth = optionalButtonNumber("width", width);
137
+ const safeHeight = optionalPositiveButtonNumber("height", height);
138
+ const safePaddingX = buttonNumber("paddingX", paddingX, 16);
139
+ const safeBorderRadius = buttonNumber("borderRadius", borderRadius, 0);
140
+ const safeBorderWidth = buttonNumber("borderWidth", borderWidth, 0);
141
+ const safeFontSize = buttonNumber("fontSize", fontSize, 16);
112
142
  const label = typeof children === "string" ? children : void 0;
113
- const fallback = height !== void 0 && label !== void 0;
143
+ const fallback = safeHeight !== void 0 && label !== void 0;
114
144
  if (!fallback) reportEmailDiagnostic({
115
145
  code: "button-outlook-fallback",
116
146
  severity: "warning",
117
147
  message: "<Button> draws its classic Outlook shape from VML, which needs a height and a plain string label. Without both, classic Windows Outlook shows an unstyled link.",
118
148
  clients: ["outlook-windows"]
119
149
  });
120
- const arcsize = height === void 0 ? 0 : Math.round(borderRadius / height * 100);
121
- const fallbackWidth = width ?? Math.ceil((label?.length ?? 0) * fontSize * BOLD_GLYPH_ADVANCE) + 2 * paddingX;
150
+ const arcsize = safeHeight === void 0 ? 0 : Math.round(safeBorderRadius / safeHeight * 100);
151
+ const fallbackWidth = safeWidth ?? Math.ceil((label?.length ?? 0) * safeFontSize * BOLD_GLYPH_ADVANCE) + 2 * safePaddingX;
122
152
  return presentation({
123
153
  width: "100%",
124
154
  style: { borderCollapse: "collapse" }
125
155
  }, jsx("td", {
126
156
  align,
127
- children: [fallback ? rawMarkup(`<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${escapeAttribute(href)}" style="height:${height}px;v-text-anchor:middle;width:${fallbackWidth}px;" arcsize="${arcsize}%" ${borderColor === void 0 ? "stroke=\"false\"" : `strokecolor="${escapeAttribute(borderColor)}" strokeweight="${borderWidth}px"`} fillcolor="${escapeAttribute(backgroundColor)}"><w:anchorlock/><center style="color:${escapeAttribute(color)};font-family:${escapeAttribute(fontFamily)};font-size:${fontSize}px;font-weight:bold;">${escapeText(label)}</center></v:roundrect><![endif]-->`) : null, jsx("a", {
157
+ children: [fallback ? rawMarkup(`<!--[if mso]><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="${escapeAttribute(href)}" style="height:${safeHeight}px;v-text-anchor:middle;width:${fallbackWidth}px;" arcsize="${arcsize}%" ${borderColor === void 0 ? "stroke=\"false\"" : `strokecolor="${escapeAttribute(borderColor)}" strokeweight="${safeBorderWidth}px"`} fillcolor="${escapeAttribute(backgroundColor)}"><w:anchorlock/><center style="color:${escapeAttribute(color)};font-family:${escapeAttribute(fontFamily)};font-size:${safeFontSize}px;font-weight:bold;">${escapeText(label)}</center></v:roundrect><![endif]-->`) : null, jsx("a", {
128
158
  className,
129
159
  href,
130
160
  target: "_blank",
@@ -132,19 +162,19 @@ const Button = ({ className, href, width, height, paddingX = 16, backgroundColor
132
162
  style: {
133
163
  backgroundColor,
134
164
  color,
135
- borderRadius: `${borderRadius}px`,
165
+ borderRadius: `${safeBorderRadius}px`,
136
166
  display: "inline-block",
137
167
  fontFamily,
138
- fontSize: `${fontSize}px`,
168
+ fontSize: `${safeFontSize}px`,
139
169
  fontWeight: "bold",
140
- lineHeight: height === void 0 ? "120%" : `${height - 2 * borderWidth}px`,
170
+ lineHeight: safeHeight === void 0 ? "120%" : `${safeHeight - 2 * safeBorderWidth}px`,
141
171
  textAlign: "center",
142
172
  textDecoration: "none",
143
- ...width === void 0 ? { padding: `0 ${paddingX}px` } : {
144
- width: `${width}px`,
173
+ ...safeWidth === void 0 ? { padding: `0 ${safePaddingX}px` } : {
174
+ width: `${safeWidth}px`,
145
175
  maxWidth: "100%"
146
176
  },
147
- ...borderColor === void 0 ? {} : { border: `${borderWidth}px solid ${borderColor}` },
177
+ ...borderColor === void 0 ? {} : { border: `${safeBorderWidth}px solid ${borderColor}` },
148
178
  ...fallback ? { msoHide: "all" } : {},
149
179
  ...style
150
180
  },
@@ -1,2 +1,2 @@
1
- import { a as formatEmailDiagnostic, i as EmailDiagnosticSeverity, n as EmailCompileError, o as hasBlockingDiagnostic, r as EmailDiagnostic, t as EmailCompatibilityAssessment } from "../diagnostics-eFM9A_TU.js";
1
+ import { a as formatEmailDiagnostic, i as EmailDiagnosticSeverity, n as EmailCompileError, o as hasBlockingDiagnostic, r as EmailDiagnostic, t as EmailCompatibilityAssessment } from "../diagnostics-BMYtBCQk.js";
2
2
  export { EmailCompatibilityAssessment, EmailCompileError, EmailDiagnostic, EmailDiagnosticSeverity, formatEmailDiagnostic, hasBlockingDiagnostic };
@@ -1,2 +1,2 @@
1
- import { a as EmailGlobalProps, c as EmailStyle, d as isUrlAttribute, i as EmailElementSpec, l as EmailTag, n as EMAIL_GLOBAL_ATTRIBUTES, o as EmailIntrinsicElements, r as EmailAttributeSpec, s as EmailLayout, t as EMAIL_ELEMENTS, u as emailElement } from "../elements-ChJULZlh.js";
1
+ import { a as EmailGlobalProps, c as EmailStyle, d as isUrlAttribute, i as EmailElementSpec, l as EmailTag, n as EMAIL_GLOBAL_ATTRIBUTES, o as EmailIntrinsicElements, r as EmailAttributeSpec, s as EmailLayout, t as EMAIL_ELEMENTS, u as emailElement } from "../elements-BzjjnoCS.js";
2
2
  export { EMAIL_ELEMENTS, EMAIL_GLOBAL_ATTRIBUTES, EmailAttributeSpec, EmailElementSpec, EmailGlobalProps, EmailIntrinsicElements, EmailLayout, EmailStyle, EmailTag, emailElement, isUrlAttribute };
@@ -1,5 +1,5 @@
1
- import { r as EmailDiagnostic } from "../diagnostics-eFM9A_TU.js";
2
- import { m as EmailNode } from "../elements-ChJULZlh.js";
1
+ import { r as EmailDiagnostic } from "../diagnostics-BMYtBCQk.js";
2
+ import { m as EmailNode } from "../elements-BzjjnoCS.js";
3
3
  import { EmittedPosition } from "./selection.js";
4
4
  //#region src/email/html.d.ts
5
5
  /** Escape a value for element content. */
@@ -153,7 +153,8 @@ const attributes = (sink, tag, spec, props, origins) => {
153
153
  if (text !== void 0) emitted.push(` ${name}="${escapeAttribute(text)}"`);
154
154
  continue;
155
155
  }
156
- const attribute = EMAIL_GLOBAL_ATTRIBUTES[name] ?? spec.attributes[name];
156
+ const globalAttributes = EMAIL_GLOBAL_ATTRIBUTES;
157
+ const attribute = Object.hasOwn(globalAttributes, name) ? globalAttributes[name] : Object.hasOwn(spec.attributes, name) ? spec.attributes[name] : void 0;
157
158
  if (attribute === void 0) {
158
159
  const supported = [
159
160
  ...Object.keys(EMAIL_GLOBAL_ATTRIBUTES),
@@ -1,5 +1,5 @@
1
- import { r as JsxSource } from "../source-locations-D6Te6Gy1.js";
2
- import { g as JSX, h as Fragment, m as EmailNode, p as EmailComponent } from "../elements-ChJULZlh.js";
1
+ import { r as JsxSource } from "../source-locations-DrCM82Ym.js";
2
+ import { g as JSX, h as Fragment, m as EmailNode, p as EmailComponent } from "../elements-BzjjnoCS.js";
3
3
  //#region src/email/jsx-dev-runtime.d.ts
4
4
  /** Development JSX retains compiler-provided origins directly on the semantic tree. */
5
5
  declare const jsxDEV: (type: string | EmailComponent<Record<string, unknown>> | typeof Fragment, props: Record<string, unknown> | null, _key?: unknown, _staticChildren?: boolean, source?: JsxSource) => EmailNode;
@@ -1,2 +1,2 @@
1
- import { C as reportEmailDiagnostic, S as rawMarkup, _ as currentEmailOrigins, b as jsxs, f as EmailChild, g as JSX, h as Fragment, m as EmailNode, p as EmailComponent, v as drainEmailDiagnostics, x as normalizeChildren, y as jsx } from "../elements-ChJULZlh.js";
1
+ import { C as reportEmailDiagnostic, S as rawMarkup, _ as currentEmailOrigins, b as jsxs, f as EmailChild, g as JSX, h as Fragment, m as EmailNode, p as EmailComponent, v as drainEmailDiagnostics, x as normalizeChildren, y as jsx } from "../elements-BzjjnoCS.js";
2
2
  export { EmailChild, EmailComponent, EmailNode, Fragment, JSX, currentEmailOrigins, drainEmailDiagnostics, jsx, jsxs, normalizeChildren, rawMarkup, reportEmailDiagnostic };
@@ -1,9 +1,9 @@
1
- import { r as EmailDiagnostic } from "../diagnostics-eFM9A_TU.js";
2
- import { m as EmailNode } from "../elements-ChJULZlh.js";
1
+ import { r as EmailDiagnostic } from "../diagnostics-BMYtBCQk.js";
2
+ import { m as EmailNode } from "../elements-BzjjnoCS.js";
3
3
  import { EmittedPosition } from "./selection.js";
4
4
  import { SerializeEmailOptions } from "./html.js";
5
- import { r as TemplateDefinition } from "../template-G-QPcfmn.js";
6
- import { i as Stylesheet } from "../css-DoNc7CiC.js";
5
+ import { r as TemplateDefinition } from "../template-DWftqh4x.js";
6
+ import { i as Stylesheet } from "../css-COcFOT1y.js";
7
7
  //#region src/email/render.d.ts
8
8
  /** Classic Outlook lays a document out correctly only under a transitional doctype. */
9
9
  declare const EMAIL_DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
@@ -1,4 +1,4 @@
1
- import { i as renderEmail, n as bindStylesheets, r as compileEmail, t as EMAIL_DOCTYPE } from "../render-T6IFPnP4.js";
1
+ import { i as renderEmail, n as bindStylesheets, r as compileEmail, t as EMAIL_DOCTYPE } from "../render-aaJBnsXK.js";
2
2
  import "./html.js";
3
3
  import "./diagnostics.js";
4
4
  import "./stylesheets.js";
@@ -1,4 +1,4 @@
1
- import { i as JsxSourceLocation } from "../source-locations-D6Te6Gy1.js";
1
+ import { i as JsxSourceLocation } from "../source-locations-DrCM82Ym.js";
2
2
  //#region src/email/selection.d.ts
3
3
  /**
4
4
  * The attribute a preview stamps so a click in a rendered document resolves to
@@ -1,4 +1,4 @@
1
- import { i as JsxSourceLocation } from "../source-locations-D6Te6Gy1.js";
1
+ import { i as JsxSourceLocation } from "../source-locations-DrCM82Ym.js";
2
2
  //#region src/email/source-edit.d.ts
3
3
  /** One exact source replacement; before text guards against concurrent changes. */
4
4
  interface SourceReplacement {
@@ -1,4 +1,4 @@
1
- import { i as Stylesheet } from "../css-DoNc7CiC.js";
1
+ import { i as Stylesheet } from "../css-COcFOT1y.js";
2
2
  //#region src/email/stylesheets.d.ts
3
3
  /** Called by a compiler-generated stylesheet module at import time. */
4
4
  declare const registerStylesheet: (sheet: Stylesheet) => void;
@@ -1,4 +1,4 @@
1
- import { m as EmailNode } from "../elements-ChJULZlh.js";
1
+ import { m as EmailNode } from "../elements-BzjjnoCS.js";
2
2
  //#region src/email/text.d.ts
3
3
  /** Derive the plain-text alternative from the semantic tree in reading order. */
4
4
  declare const deriveEmailText: (node: EmailNode) => string;
package/dist/emit.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as Diagnostic } from "./diagnostics-CqepLcpI.js";
2
- import { s as UnboundTemplateSourceLocations } from "./source-locations-D6Te6Gy1.js";
1
+ import { t as Diagnostic } from "./diagnostics-OcQKQYSY.js";
2
+ import { s as UnboundTemplateSourceLocations } from "./source-locations-DrCM82Ym.js";
3
3
  import { TemplateVariable } from "./render-template.js";
4
4
  //#region src/emit.d.ts
5
5
  /**
package/dist/emit.js CHANGED
@@ -5,8 +5,8 @@ import { renderTemplate } from "./render-template.js";
5
5
  import { Result } from "better-result";
6
6
  //#region src/emit.ts
7
7
  /**
8
- * emitModule — the module-level emit boundary for the TSX authoring layer
9
- * (design brief §7b). The vite plugin does the importing: TSX runs at the
8
+ * emitModule — the module-level emit boundary for the TSX authoring layer.
9
+ * The vite plugin does the importing: TSX runs at the
10
10
  * USER's build time and this receives the already-evaluated module object (a
11
11
  * record of its exports). emitModule stays bundler-agnostic — it never touches
12
12
  * the filesystem, esbuild, or vite. It reads only `moduleExports.default`,
package/dist/footer.d.ts CHANGED
@@ -29,7 +29,7 @@ interface FooterContent {
29
29
  readonly customHtml?: string | undefined;
30
30
  }
31
31
  /** Which compliance-relevant footer fields the effective content is missing,
32
- * surfaced on the design read path for M6's dashboard nudge. */
32
+ * surfaced on the design read path for the dashboard's footer nudge. */
33
33
  interface FooterCompleteness {
34
34
  /** No physical mailing address is set anywhere in the cascade (CAN-SPAM). */
35
35
  readonly missingAddress: boolean;
@@ -42,8 +42,8 @@ interface RenderedFooter {
42
42
  readonly completeness: FooterCompleteness;
43
43
  }
44
44
  /**
45
- * Which compliance-relevant fields the footer content lacks — the signal M6's
46
- * dashboard nudge reads. Derivable from `design.footer` alone (no token table),
45
+ * Which compliance-relevant fields the footer content lacks — the signal the
46
+ * dashboard's footer nudge reads. Derivable from `design.footer` alone (no token table),
47
47
  * so the design read path can report it without composing the block. A
48
48
  * `customHtml` footer is treated as complete (the org owns its own content).
49
49
  */
package/dist/footer.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * the placeholder. */
8
8
  const FOOTER_UNSUBSCRIBE_PLACEHOLDER = "%samva:unsubscribe-url%";
9
9
  const escapeText = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
10
- const escapeAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll("\"", "&quot;");
10
+ const escapeAttribute = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&#39;");
11
11
  const isSafeUrl = (url) => /^(https?:|mailto:)/i.test(url.trim());
12
12
  const addressLines = (address) => {
13
13
  const region = [
@@ -23,8 +23,8 @@ const addressLines = (address) => {
23
23
  ].filter((line) => typeof line === "string" && line.trim().length > 0);
24
24
  };
25
25
  /**
26
- * Which compliance-relevant fields the footer content lacks — the signal M6's
27
- * dashboard nudge reads. Derivable from `design.footer` alone (no token table),
26
+ * Which compliance-relevant fields the footer content lacks — the signal the
27
+ * dashboard's footer nudge reads. Derivable from `design.footer` alone (no token table),
28
28
  * so the design read path can report it without composing the block. A
29
29
  * `customHtml` footer is treated as complete (the org owns its own content).
30
30
  */
@@ -45,6 +45,9 @@ const renderFooterBlock = (input) => {
45
45
  const containerPx = tokens.containerPx["xl"] ?? 600;
46
46
  const fontSizePx = tokens.text["xs"]?.sizePx ?? 12;
47
47
  const lineHeightPx = tokens.text["xs"]?.lineHeightPx ?? 18;
48
+ const fontFamilyAttribute = escapeAttribute(fontFamily);
49
+ const mutedColorAttribute = escapeAttribute(mutedColor);
50
+ const linkColorAttribute = escapeAttribute(linkColor);
48
51
  const rows = [];
49
52
  const textLines = [];
50
53
  if (typeof footer.customHtml === "string" && footer.customHtml.trim().length > 0) rows.push(`<tr><td style="padding:0 0 12px 0;">${footer.customHtml}</td></tr>`);
@@ -61,20 +64,20 @@ const renderFooterBlock = (input) => {
61
64
  }
62
65
  }
63
66
  if (footer.socialLinks !== void 0 && footer.socialLinks.length > 0) {
64
- const links = footer.socialLinks.map((link) => isSafeUrl(link.url) ? `<a href="${escapeAttribute(link.url.trim())}" style="color:${linkColor};text-decoration:underline;" ses:no-track>${escapeText(link.label)}</a>` : escapeText(link.label));
67
+ const links = footer.socialLinks.map((link) => isSafeUrl(link.url) ? `<a href="${escapeAttribute(link.url.trim())}" style="color:${linkColorAttribute};text-decoration:underline;" ses:no-track>${escapeText(link.label)}</a>` : escapeText(link.label));
65
68
  rows.push(`<tr><td style="padding:0 0 8px 0;">${links.join("<span style=\"padding:0 6px;\">·</span>")}</td></tr>`);
66
69
  textLines.push(footer.socialLinks.map((link) => `${link.label}: ${link.url}`).join(" "));
67
70
  }
68
71
  }
69
72
  if (unsubscribeUrl !== null) {
70
- rows.push(`<tr><td style="padding:0;"><a href="${escapeAttribute(unsubscribeUrl)}" style="color:${mutedColor};text-decoration:underline;" ses:no-track>${escapeText(unsubscribeLabel)}</a></td></tr>`);
73
+ rows.push(`<tr><td style="padding:0;"><a href="${escapeAttribute(unsubscribeUrl)}" style="color:${mutedColorAttribute};text-decoration:underline;" ses:no-track>${escapeText(unsubscribeLabel)}</a></td></tr>`);
71
74
  textLines.push(`${unsubscribeLabel}: ${unsubscribeUrl}`);
72
75
  }
73
76
  return {
74
77
  html: rows.length === 0 ? "" : [
75
78
  `<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;border-collapse:collapse;">`,
76
79
  `<tr><td align="center" style="padding:32px 16px;">`,
77
- `<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="${containerPx}" style="width:100%;max-width:${containerPx}px;border-collapse:collapse;font-family:${fontFamily};font-size:${fontSizePx}px;line-height:${lineHeightPx}px;color:${mutedColor};text-align:center;">`,
80
+ `<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="${containerPx}" style="width:100%;max-width:${containerPx}px;border-collapse:collapse;font-family:${fontFamilyAttribute};font-size:${fontSizePx}px;line-height:${lineHeightPx}px;color:${mutedColorAttribute};text-align:center;">`,
78
81
  ...rows,
79
82
  `</table>`,
80
83
  `</td></tr>`,
@@ -1,5 +1,5 @@
1
- import { r as JsxSource } from "./source-locations-D6Te6Gy1.js";
2
- import { a as JsxResult, i as JSX, n as Fragment, t as Component } from "./jsx-runtime-BI4gI19E.js";
1
+ import { r as JsxSource } from "./source-locations-DrCM82Ym.js";
2
+ import { a as JsxResult, i as JSX, n as Fragment, t as Component } from "./jsx-runtime-I-1nCtl2.js";
3
3
  //#region src/jsx-dev-runtime.d.ts
4
4
  interface JsxDevProps {
5
5
  readonly children?: unknown;
@@ -1,5 +1,5 @@
1
- import { f as ElementNode, n as Attribute, x as SmlNode } from "./ast-BLybiDxp.js";
2
- import { s as VariableRef } from "./variables-BnKs1iqb.js";
1
+ import { f as ElementNode, n as Attribute, x as SmlNode } from "./ast-BrDtApwS.js";
2
+ import { s as VariableRef } from "./variables-J_L3qxRa.js";
3
3
  //#region src/jsx-runtime.d.ts
4
4
  /** A component is a plain function of its props that returns a draft node. */
5
5
  type Component<P> = (props: P) => SmlNode;
@@ -54,4 +54,4 @@ declare namespace JSX {
54
54
  }
55
55
  //#endregion
56
56
  export { JsxResult as a, elementDraft as c, normalizeChildren as d, JSX as i, jsx as l, Fragment as n, SmlChild as o, FragmentDraft as r, SmlChildren as s, Component as t, jsxs as u };
57
- //# sourceMappingURL=jsx-runtime-BI4gI19E.d.ts.map
57
+ //# sourceMappingURL=jsx-runtime-I-1nCtl2.d.ts.map
@@ -1,2 +1,2 @@
1
- import { a as JsxResult, c as elementDraft, d as normalizeChildren, i as JSX, l as jsx, n as Fragment, o as SmlChild, r as FragmentDraft, s as SmlChildren, t as Component, u as jsxs } from "./jsx-runtime-BI4gI19E.js";
1
+ import { a as JsxResult, c as elementDraft, d as normalizeChildren, i as JSX, l as jsx, n as Fragment, o as SmlChild, r as FragmentDraft, s as SmlChildren, t as Component, u as jsxs } from "./jsx-runtime-I-1nCtl2.js";
2
2
  export { Component, Fragment, FragmentDraft, JSX, JsxResult, SmlChild, SmlChildren, elementDraft, jsx, jsxs, normalizeChildren };
package/dist/lexer.js CHANGED
@@ -21,6 +21,7 @@ const CHAR_UNDERSCORE = 95;
21
21
  const CHAR_0 = 48;
22
22
  const CHAR_9 = 57;
23
23
  const CHAR_UPPER_A = 65;
24
+ const CHAR_UPPER_X = 88;
24
25
  const CHAR_UPPER_Z = 90;
25
26
  const CHAR_LOWER_A = 97;
26
27
  const CHAR_LOWER_X = 120;
@@ -60,6 +61,10 @@ const NAMED_ENTITIES = {
60
61
  apos: "'",
61
62
  nbsp: "\xA0"
62
63
  };
64
+ const numericEntityCodePoint = (digits, radix) => {
65
+ const codePoint = Number.parseInt(digits, radix);
66
+ return Number.isFinite(codePoint) && codePoint <= 1114111 ? codePoint : void 0;
67
+ };
63
68
  /**
64
69
  * Validates the entity starting at `offset` (which points at `&`).
65
70
  * Returns the end offset (past `;`) or -1 when malformed.
@@ -68,7 +73,8 @@ const scanEntity = (source, offset) => {
68
73
  let index = offset + 1;
69
74
  if (source.charCodeAt(index) === CHAR_HASH) {
70
75
  index++;
71
- const hex = source.charCodeAt(index) === CHAR_LOWER_X;
76
+ const marker = source.charCodeAt(index);
77
+ const hex = marker === CHAR_LOWER_X || marker === CHAR_UPPER_X;
72
78
  if (hex) index++;
73
79
  const digitsStart = index;
74
80
  while (index < source.length) {
@@ -77,11 +83,13 @@ const scanEntity = (source, offset) => {
77
83
  index++;
78
84
  }
79
85
  if (index === digitsStart) return -1;
86
+ if (numericEntityCodePoint(source.slice(digitsStart, index), hex ? 16 : 10) === void 0) return -1;
80
87
  return source.charCodeAt(index) === CHAR_SEMICOLON ? index + 1 : -1;
81
88
  }
82
89
  const nameStart = index;
83
90
  while (index < source.length && isLetter(source.charCodeAt(index))) index++;
84
- if (!(source.slice(nameStart, index) in NAMED_ENTITIES)) return -1;
91
+ const name = source.slice(nameStart, index);
92
+ if (!Object.hasOwn(NAMED_ENTITIES, name)) return -1;
85
93
  return source.charCodeAt(index) === CHAR_SEMICOLON ? index + 1 : -1;
86
94
  };
87
95
  /** Decodes entities in text that already passed `scanEntity` validation. */
@@ -102,9 +110,13 @@ const decodeEntities = (raw) => {
102
110
  break;
103
111
  }
104
112
  const body = raw.slice(ampersand + 1, semicolon);
105
- if (body.startsWith("#x") || body.startsWith("#X")) result += String.fromCodePoint(Number.parseInt(body.slice(2), 16));
106
- else if (body.startsWith("#")) result += String.fromCodePoint(Number.parseInt(body.slice(1), 10));
107
- else result += NAMED_ENTITIES[body];
113
+ if (body.startsWith("#x") || body.startsWith("#X")) {
114
+ const codePoint = numericEntityCodePoint(body.slice(2), 16);
115
+ result += codePoint === void 0 ? raw.slice(ampersand, semicolon + 1) : String.fromCodePoint(codePoint);
116
+ } else if (body.startsWith("#")) {
117
+ const codePoint = numericEntityCodePoint(body.slice(1), 10);
118
+ result += codePoint === void 0 ? raw.slice(ampersand, semicolon + 1) : String.fromCodePoint(codePoint);
119
+ } else result += Object.hasOwn(NAMED_ENTITIES, body) ? NAMED_ENTITIES[body] : raw.slice(ampersand, semicolon + 1);
108
120
  index = semicolon + 1;
109
121
  }
110
122
  return result;
package/dist/model.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as SmlTag, b as SmlDocument } from "./ast-BLybiDxp.js";
1
+ import { S as SmlTag, b as SmlDocument } from "./ast-BrDtApwS.js";
2
2
  import { Result } from "better-result";
3
3
  //#region src/model.d.ts
4
4
  /** The subset of an element's attributes the navigator and agent tools read. */