@samva/markup 0.5.0 → 0.6.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 +2 -0
- package/dist/{ast-BLybiDxp.d.ts → ast-BrDtApwS.d.ts} +2 -2
- package/dist/ast.d.ts +1 -1
- package/dist/ast.js +1 -1
- package/dist/{catalog-Db0UcCTg.d.ts → catalog-60eaYC7b.d.ts} +2 -2
- package/dist/{checks-CmmITP6j.js → checks-DBweSIPN.js} +12 -14
- package/dist/checks.d.ts +1 -1
- package/dist/checks.js +1 -1
- package/dist/classes.d.ts +1 -1
- package/dist/compile-sms.d.ts +3 -3
- package/dist/compile-whatsapp.d.ts +3 -3
- package/dist/compile.d.ts +2 -2
- package/dist/compiler.d.ts +7 -4
- package/dist/compiler.js +40 -40
- package/dist/components.d.ts +4 -4
- package/dist/conditionals.js +55 -23
- package/dist/{corpus-CM7rKX41.d.ts → corpus-BjYMqOoY.d.ts} +2 -2
- package/dist/{css-DoNc7CiC.d.ts → css-COcFOT1y.d.ts} +3 -3
- package/dist/{diagnostics-eFM9A_TU.d.ts → diagnostics-BMYtBCQk.d.ts} +2 -2
- package/dist/{diagnostics-CqepLcpI.d.ts → diagnostics-OcQKQYSY.d.ts} +4 -2
- package/dist/diagnostics.d.ts +2 -2
- package/dist/diagnostics.js +10 -5
- package/dist/{elements-ChJULZlh.d.ts → elements-BzjjnoCS.d.ts} +3 -3
- package/dist/email/components.d.ts +1 -1
- package/dist/email/components.js +40 -10
- package/dist/email/diagnostics.d.ts +1 -1
- package/dist/email/elements.d.ts +1 -1
- package/dist/email/html.d.ts +2 -2
- package/dist/email/html.js +2 -1
- package/dist/email/jsx-dev-runtime.d.ts +2 -2
- package/dist/email/jsx-runtime.d.ts +1 -1
- package/dist/email/render.d.ts +4 -4
- package/dist/email/render.js +1 -1
- package/dist/email/selection.d.ts +1 -1
- package/dist/email/source-edit.d.ts +1 -1
- package/dist/email/stylesheets.d.ts +1 -1
- package/dist/email/text.d.ts +1 -1
- package/dist/emit.d.ts +2 -2
- package/dist/footer.js +7 -4
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/{jsx-runtime-BI4gI19E.d.ts → jsx-runtime-I-1nCtl2.d.ts} +3 -3
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/lexer.js +17 -5
- package/dist/model.d.ts +1 -1
- package/dist/ops-2aiiYO7m.js +630 -0
- package/dist/ops.d.ts +2 -2
- package/dist/ops.js +1 -479
- package/dist/{parser-b_Kp5MT6.d.ts → parser-CQcASEyy.d.ts} +3 -3
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +1 -1
- package/dist/{predicate-DwXzmqIY.js → predicate-BI6uRRM-.js} +14 -4
- package/dist/{predicate-Bmvgw7Ao.d.ts → predicate-M-05Nd7R.d.ts} +2 -2
- package/dist/predicate.d.ts +1 -1
- package/dist/predicate.js +1 -1
- package/dist/presets/category-mapping.d.ts +1 -1
- package/dist/presets/corpus.d.ts +1 -1
- package/dist/presets/public-gallery.d.ts +2 -2
- package/dist/presets/public-gallery.js +10 -2
- package/dist/presets/public-handoff.d.ts +2 -2
- package/dist/presets/public-preview-artifacts.d.ts +3 -1
- package/dist/presets/public-preview-artifacts.js +1 -0
- package/dist/presets/showcase.d.ts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/printer.d.ts +1 -1
- package/dist/{render-T6IFPnP4.js → render-aaJBnsXK.js} +33 -16
- package/dist/render-template.d.ts +5 -5
- package/dist/render-template.js +1 -1
- package/dist/{showcase-dvJMn-Lo.d.ts → showcase-DGZAWn4Z.d.ts} +2 -2
- package/dist/{source-locations-D6Te6Gy1.d.ts → source-locations-DrCM82Ym.d.ts} +2 -2
- package/dist/source-locations.d.ts +1 -1
- package/dist/{template-G-QPcfmn.d.ts → template-DWftqh4x.d.ts} +2 -2
- package/dist/template.d.ts +1 -1
- package/dist/theme-css.d.ts +1 -1
- package/dist/theme.js +25 -2
- package/dist/tsx-tracer.d.ts +1 -1
- package/dist/tsx-tracer.js +1 -1
- package/dist/{variables-BnKs1iqb.d.ts → variables-J_L3qxRa.d.ts} +2 -2
- package/dist/variables.d.ts +1 -1
- package/dist/variables.js +1 -1
- package/package.json +1 -1
package/dist/email/html.js
CHANGED
|
@@ -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
|
|
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-
|
|
2
|
-
import { g as JSX, h as Fragment, m as EmailNode, p as EmailComponent } from "../elements-
|
|
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-
|
|
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 };
|
package/dist/email/render.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as EmailDiagnostic } from "../diagnostics-
|
|
2
|
-
import { m as EmailNode } from "../elements-
|
|
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-
|
|
6
|
-
import { i as Stylesheet } from "../css-
|
|
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\">";
|
package/dist/email/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderEmail, n as bindStylesheets, r as compileEmail, t as EMAIL_DOCTYPE } from "../render-
|
|
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-
|
|
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-
|
|
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-
|
|
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;
|
package/dist/email/text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as EmailNode } from "../elements-
|
|
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-
|
|
2
|
-
import { s as UnboundTemplateSourceLocations } from "./source-locations-
|
|
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/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("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
10
|
-
const escapeAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll("\"", """);
|
|
10
|
+
const escapeAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
11
11
|
const isSafeUrl = (url) => /^(https?:|mailto:)/i.test(url.trim());
|
|
12
12
|
const addressLines = (address) => {
|
|
13
13
|
const region = [
|
|
@@ -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:${
|
|
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:${
|
|
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:${
|
|
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-
|
|
2
|
-
import { a as JsxResult, i as JSX, n as Fragment, t as Component } from "./jsx-runtime-
|
|
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-
|
|
2
|
-
import { s as VariableRef } from "./variables-
|
|
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-
|
|
57
|
+
//# sourceMappingURL=jsx-runtime-I-1nCtl2.d.ts.map
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -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-
|
|
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
|
|
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
|
-
|
|
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"))
|
|
106
|
-
|
|
107
|
-
|
|
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-
|
|
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. */
|