@samva/markup 0.7.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.
- package/AGENTS.md +104 -37
- package/README.md +188 -52
- package/dist/assets-C5duwTya.d.ts +40 -0
- package/dist/brand-B-0bN_Ir.d.ts +88 -0
- package/dist/{render-aaJBnsXK.js → cascade-t6kxlgEI.js} +130 -160
- package/dist/channel-edit.d.ts +121 -0
- package/dist/channel-edit.js +609 -0
- package/dist/channel-specs-B6M_HlaV.js +29 -0
- package/dist/channel-specs-C2feJwuP.d.ts +13 -0
- package/dist/compatibility-DbISoFIq.js +589 -0
- package/dist/compiler.d.ts +19 -249
- package/dist/compiler.js +10 -1408
- package/dist/{css-COcFOT1y.d.ts → css-BVQKICKC.d.ts} +30 -4
- package/dist/diagnostic-codes.d.ts +403 -0
- package/dist/diagnostic-codes.js +399 -0
- package/dist/{diagnostics-BMYtBCQk.d.ts → diagnostics-B-Gym34R.d.ts} +8 -4
- package/dist/diagnostics.d.ts +31 -2
- package/dist/diagnostics.js +1 -19
- package/dist/{elements-BzjjnoCS.d.ts → elements-cqldpaJt.d.ts} +3 -3
- package/dist/email/assets.d.ts +2 -0
- package/dist/email/assets.js +63 -0
- package/dist/email/brand-footer.d.ts +34 -0
- package/dist/email/brand-footer.js +63 -0
- package/dist/email/brand.d.ts +2 -0
- package/dist/email/brand.js +148 -0
- package/dist/email/components.d.ts +21 -10
- package/dist/email/components.js +46 -11
- package/dist/email/diagnostics.d.ts +2 -2
- package/dist/email/diagnostics.js +2 -1
- package/dist/email/elements.d.ts +1 -1
- package/dist/email/html.d.ts +2 -42
- package/dist/email/html.js +56 -2
- 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 +10 -13
- package/dist/email/render.js +163 -6
- package/dist/email/text.d.ts +1 -1
- package/dist/fmt.d.ts +32 -0
- package/dist/fmt.js +174 -0
- package/dist/html-BJepOwZ4.d.ts +56 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/ir-aaqNE987.d.ts +252 -0
- package/dist/ir.d.ts +2 -0
- package/dist/ir.js +7 -0
- package/dist/preview-Ekdg1dXG.d.ts +100 -0
- package/dist/preview.d.ts +2 -0
- package/dist/preview.js +160 -0
- package/dist/profile-BH-OtdDA.js +3670 -0
- package/dist/render-ir.d.ts +19 -0
- package/dist/render-ir.js +826 -0
- package/dist/sms-segments.d.ts +13 -2
- package/dist/sms.d.ts +16 -0
- package/dist/sms.js +12 -0
- package/dist/{email/source-edit.d.ts → source-edit.d.ts} +55 -6
- package/dist/source-edit.js +343 -0
- package/dist/source-locations-C8wCsiAy.d.ts +23 -0
- package/dist/source-locations.d.ts +2 -2
- package/dist/source-locations.js +3 -89
- package/dist/static.d.ts +57 -0
- package/dist/static.js +69 -0
- package/dist/tailwind-CMYpZf1v.js +614 -0
- package/dist/template-_QE_rQND.d.ts +65 -0
- package/dist/template.d.ts +2 -2
- package/dist/template.js +15 -10
- package/dist/theme-css-hFqcPSar.js +587 -0
- package/dist/theme-css.d.ts +57 -16
- package/dist/theme-css.js +2 -509
- package/dist/theme-imports-lvBw3AD1.js +109 -0
- package/dist/transform-Ct2OMkFN.d.ts +153 -0
- package/dist/unsubscribe-link-CoesnQDU.js +26 -0
- package/dist/whatsapp.d.ts +57 -0
- package/dist/whatsapp.js +22 -0
- package/generated/contract.json +1782 -0
- package/generated/reference.md +353 -0
- package/package.json +56 -154
- package/samva-brand.d.ts +14 -0
- package/skills/sml/SKILL.md +123 -0
- package/dist/ast-BrDtApwS.d.ts +0 -107
- package/dist/ast.d.ts +0 -2
- package/dist/ast.js +0 -124
- package/dist/candidate.d.ts +0 -29
- package/dist/candidate.js +0 -88
- package/dist/catalog-60eaYC7b.d.ts +0 -356
- package/dist/checks-DBweSIPN.js +0 -58954
- package/dist/checks.d.ts +0 -33
- package/dist/checks.js +0 -2
- package/dist/classes.d.ts +0 -27
- package/dist/classes.js +0 -184
- package/dist/compile-sms.d.ts +0 -28
- package/dist/compile-sms.js +0 -44
- package/dist/compile-whatsapp.d.ts +0 -56
- package/dist/compile-whatsapp.js +0 -186
- package/dist/compile.d.ts +0 -18
- package/dist/compile.js +0 -29
- package/dist/components.d.ts +0 -289
- package/dist/components.js +0 -106
- package/dist/conditionals.d.ts +0 -10
- package/dist/conditionals.js +0 -74
- package/dist/corpus-BjYMqOoY.d.ts +0 -106
- package/dist/diagnostics-OcQKQYSY.d.ts +0 -49
- package/dist/email/selection.d.ts +0 -91
- package/dist/email/selection.js +0 -91
- package/dist/email/source-edit.js +0 -185
- package/dist/email/stylesheets.d.ts +0 -15
- package/dist/email/stylesheets.js +0 -45
- package/dist/emit.d.ts +0 -51
- package/dist/emit.js +0 -151
- package/dist/footer.d.ts +0 -66
- package/dist/footer.js +0 -93
- package/dist/interpolate.d.ts +0 -24
- package/dist/interpolate.js +0 -43
- package/dist/jsx-dev-runtime.d.ts +0 -11
- package/dist/jsx-dev-runtime.js +0 -15
- package/dist/jsx-runtime-I-1nCtl2.d.ts +0 -57
- package/dist/jsx-runtime.d.ts +0 -2
- package/dist/jsx-runtime.js +0 -121
- package/dist/lexer.d.ts +0 -60
- package/dist/lexer.js +0 -281
- package/dist/model.d.ts +0 -24
- package/dist/model.js +0 -77
- package/dist/ops-2aiiYO7m.js +0 -630
- package/dist/ops.d.ts +0 -114
- package/dist/ops.js +0 -2
- package/dist/parser-t29cHLVL.d.ts +0 -396
- package/dist/parser.d.ts +0 -2
- package/dist/parser.js +0 -859
- package/dist/predicate-BI6uRRM-.js +0 -549
- package/dist/predicate-M-05Nd7R.d.ts +0 -56
- package/dist/predicate.d.ts +0 -2
- package/dist/predicate.js +0 -2
- package/dist/presets/category-mapping.d.ts +0 -13
- package/dist/presets/category-mapping.js +0 -49
- package/dist/presets/corpus.d.ts +0 -2
- package/dist/presets/corpus.js +0 -194
- package/dist/presets/public-gallery.d.ts +0 -266
- package/dist/presets/public-gallery.js +0 -916
- package/dist/presets/public-handoff.d.ts +0 -164
- package/dist/presets/public-handoff.js +0 -361
- package/dist/presets/public-preview-artifacts.d.ts +0 -43
- package/dist/presets/public-preview-artifacts.js +0 -104
- package/dist/presets/public-preview.d.ts +0 -61
- package/dist/presets/public-preview.js +0 -83
- package/dist/presets/showcase.d.ts +0 -2
- package/dist/presets/showcase.js +0 -627
- package/dist/presets/sources.d.ts +0 -38
- package/dist/presets/sources.js +0 -6083
- package/dist/presets.d.ts +0 -2
- package/dist/presets.js +0 -881
- package/dist/printer.d.ts +0 -6
- package/dist/printer.js +0 -122
- package/dist/registry.d.ts +0 -42
- package/dist/registry.js +0 -646
- package/dist/render-template.d.ts +0 -45
- package/dist/render-template.js +0 -76
- package/dist/showcase-DGZAWn4Z.d.ts +0 -456
- package/dist/sms-segments-y4FpPilJ.d.ts +0 -13
- package/dist/source-locations-DrCM82Ym.d.ts +0 -67
- package/dist/template-DWftqh4x.d.ts +0 -60
- package/dist/theme-6ApjjiBo.d.ts +0 -116
- package/dist/theme.d.ts +0 -2
- package/dist/theme.js +0 -118
- package/dist/tokens.d.ts +0 -6
- package/dist/tokens.js +0 -417
- package/dist/tsx-source-instrumentation.d.ts +0 -30
- package/dist/tsx-source-instrumentation.js +0 -115
- package/dist/tsx-tracer.d.ts +0 -112
- package/dist/tsx-tracer.js +0 -985
- package/dist/variables-J_L3qxRa.d.ts +0 -77
- package/dist/variables.d.ts +0 -2
- package/dist/variables.js +0 -141
- package/dist/version-BITr58kk.js +0 -96
- package/generated/sml-agent-contract.json +0 -709
- package/generated/sml-email-agent-contract.json +0 -615
- package/generated/sml-email-language-reference.md +0 -94
- package/generated/sml-language-reference.md +0 -195
package/dist/printer.d.ts
DELETED
package/dist/printer.js
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
//#region src/printer.ts
|
|
2
|
-
const MAX_WIDTH = 100;
|
|
3
|
-
const INDENT = " ";
|
|
4
|
-
const escapeText = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("{", "{");
|
|
5
|
-
const escapeAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll("\"", """);
|
|
6
|
-
const printAttribute = (attribute) => attribute.value.kind === "number" ? `${attribute.name}={${attribute.value.value}}` : `${attribute.name}="${escapeAttribute(attribute.value.value)}"`;
|
|
7
|
-
const printInterpolation = (node) => node.syntax === "curly" ? `{{${node.name}}}` : `\${${node.name}}`;
|
|
8
|
-
const printInlineFlow = (children) => {
|
|
9
|
-
let result = "";
|
|
10
|
-
for (const child of children) if (child.kind === "text") result += escapeText(child.value);
|
|
11
|
-
else if (child.kind === "interpolation") result += printInterpolation(child);
|
|
12
|
-
else {
|
|
13
|
-
const attributes = child.attributes.map((a) => ` ${printAttribute(a)}`).join("");
|
|
14
|
-
result += child.children.length === 0 ? `<${child.tag}${attributes} />` : `<${child.tag}${attributes}>${printInlineFlow(child.children)}</${child.tag}>`;
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
};
|
|
18
|
-
const isInlineContainer = (node) => node.tag === "Text" || node.tag === "Heading" || node.tag === "Button" || node.tag === "Subject" || node.tag === "Preview" || node.tag === "ListItem" || node.tag === "a" || node.tag === "strong" || node.tag === "em";
|
|
19
|
-
/**
|
|
20
|
-
* Splits an inline flow into reflow chunks. Chunk boundaries are exactly the
|
|
21
|
-
* spaces in text nodes — the only positions where a line break re-parses to
|
|
22
|
-
* the same AST. Everything between two spaces (words, interpolations, whole
|
|
23
|
-
* or partial inline elements) glues into one atomic chunk.
|
|
24
|
-
*/
|
|
25
|
-
const chunkInlineFlow = (children) => {
|
|
26
|
-
const chunks = [];
|
|
27
|
-
let glue = false;
|
|
28
|
-
const emit = (text) => {
|
|
29
|
-
if (text.length === 0) return;
|
|
30
|
-
if (glue && chunks.length > 0) chunks[chunks.length - 1] += text;
|
|
31
|
-
else chunks.push(text);
|
|
32
|
-
glue = true;
|
|
33
|
-
};
|
|
34
|
-
const space = () => {
|
|
35
|
-
glue = false;
|
|
36
|
-
};
|
|
37
|
-
const visit = (nodes) => {
|
|
38
|
-
for (const child of nodes) if (child.kind === "text") escapeText(child.value).split(" ").forEach((word, index) => {
|
|
39
|
-
if (index > 0) space();
|
|
40
|
-
emit(word);
|
|
41
|
-
});
|
|
42
|
-
else if (child.kind === "interpolation") emit(printInterpolation(child));
|
|
43
|
-
else {
|
|
44
|
-
const attributes = child.attributes.map((a) => ` ${printAttribute(a)}`).join("");
|
|
45
|
-
if (child.children.length === 0) emit(`<${child.tag}${attributes} />`);
|
|
46
|
-
else {
|
|
47
|
-
emit(`<${child.tag}${attributes}>`);
|
|
48
|
-
visit(child.children);
|
|
49
|
-
emit(`</${child.tag}>`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
visit(children);
|
|
54
|
-
return chunks;
|
|
55
|
-
};
|
|
56
|
-
/** Greedy fill: chunks joined by single spaces, wrapped at MAX_WIDTH. */
|
|
57
|
-
const reflowInlineFlow = (children, indent) => {
|
|
58
|
-
const chunks = chunkInlineFlow(children);
|
|
59
|
-
const lines = [];
|
|
60
|
-
let line = null;
|
|
61
|
-
for (const chunk of chunks) if (line === null) line = `${indent}${chunk}`;
|
|
62
|
-
else if (line.length + 1 + chunk.length <= MAX_WIDTH) line += ` ${chunk}`;
|
|
63
|
-
else {
|
|
64
|
-
lines.push(line);
|
|
65
|
-
line = `${indent}${chunk}`;
|
|
66
|
-
}
|
|
67
|
-
if (line !== null) lines.push(line);
|
|
68
|
-
return lines.join("\n");
|
|
69
|
-
};
|
|
70
|
-
const printOpenTag = (node, indent, selfClosing) => {
|
|
71
|
-
const attributes = node.attributes.map((a) => ` ${printAttribute(a)}`).join("");
|
|
72
|
-
const singleLine = `${indent}<${node.tag}${attributes}${selfClosing ? " />" : ">"}`;
|
|
73
|
-
if (singleLine.length <= MAX_WIDTH || node.attributes.length === 0) return singleLine;
|
|
74
|
-
const lines = [`${indent}<${node.tag}`];
|
|
75
|
-
for (const attribute of node.attributes) lines.push(`${indent}${INDENT}${printAttribute(attribute)}`);
|
|
76
|
-
lines.push(`${indent}${selfClosing ? "/>" : ">"}`);
|
|
77
|
-
return lines.join("\n");
|
|
78
|
-
};
|
|
79
|
-
/**
|
|
80
|
-
* A verbatim flow prints its content byte-preserving: text exactly as stored
|
|
81
|
-
* (escaped), interpolations canonical, and <If>/<Else> glued into the flow
|
|
82
|
-
* with single-line open tags (whitespace inside a TAG is insignificant, but a
|
|
83
|
-
* line break in the FLOW would become content on reparse).
|
|
84
|
-
*/
|
|
85
|
-
const printVerbatimFlow = (children) => {
|
|
86
|
-
let result = "";
|
|
87
|
-
for (const child of children) if (child.kind === "text") result += escapeText(child.value);
|
|
88
|
-
else if (child.kind === "interpolation") result += printInterpolation(child);
|
|
89
|
-
else result += printVerbatimElement(child);
|
|
90
|
-
return result;
|
|
91
|
-
};
|
|
92
|
-
const printVerbatimElement = (node) => {
|
|
93
|
-
const attributes = node.attributes.map((a) => ` ${printAttribute(a)}`).join("");
|
|
94
|
-
return node.children.length === 0 ? `<${node.tag}${attributes} />` : `<${node.tag}${attributes}>${printVerbatimFlow(node.children)}</${node.tag}>`;
|
|
95
|
-
};
|
|
96
|
-
/** A verbatim container: open tag at its indent, content glued, close tag glued. */
|
|
97
|
-
const printVerbatimContainer = (node, indent) => {
|
|
98
|
-
if (node.children.length === 0) return printOpenTag(node, indent, true);
|
|
99
|
-
const attributes = node.attributes.map((a) => ` ${printAttribute(a)}`).join("");
|
|
100
|
-
return `${indent}<${node.tag}${attributes}>${printVerbatimFlow(node.children)}</${node.tag}>`;
|
|
101
|
-
};
|
|
102
|
-
/** Tags whose content is verbatim. <Button> is verbatim only inside <WhatsApp>. */
|
|
103
|
-
const isVerbatimContainer = (node, inWhatsApp) => node.tag === "Sms" || node.tag === "Header" || node.tag === "Body" || node.tag === "Footer" || inWhatsApp && node.tag === "Button";
|
|
104
|
-
const printElement = (node, depth, inWhatsApp = false) => {
|
|
105
|
-
const indent = INDENT.repeat(depth);
|
|
106
|
-
if (isVerbatimContainer(node, inWhatsApp)) return printVerbatimContainer(node, indent);
|
|
107
|
-
if (node.children.length === 0) return printOpenTag(node, indent, true);
|
|
108
|
-
if (isInlineContainer(node) && !inWhatsApp) {
|
|
109
|
-
const flow = printInlineFlow(node.children);
|
|
110
|
-
const openTag = printOpenTag(node, indent, false);
|
|
111
|
-
const singleLine = `${openTag}${flow}</${node.tag}>`;
|
|
112
|
-
if (!openTag.includes("\n") && singleLine.length <= MAX_WIDTH) return singleLine;
|
|
113
|
-
return `${openTag}\n${reflowInlineFlow(node.children, indent + INDENT)}\n${indent}</${node.tag}>`;
|
|
114
|
-
}
|
|
115
|
-
const nextInWhatsApp = inWhatsApp || node.tag === "WhatsApp";
|
|
116
|
-
return `${printOpenTag(node, indent, false)}\n${node.children.map((child) => child.kind === "element" ? printElement(child, depth + 1, nextInWhatsApp) : child.kind === "text" ? `${indent}${INDENT}${escapeText(child.value)}` : `${indent}${INDENT}${printInterpolation(child)}`).join("\n")}\n${indent}</${node.tag}>`;
|
|
117
|
-
};
|
|
118
|
-
const printSml = (document) => `${printElement(document.root, 0)}\n`;
|
|
119
|
-
//#endregion
|
|
120
|
-
export { printSml };
|
|
121
|
-
|
|
122
|
-
//# sourceMappingURL=printer.js.map
|
package/dist/registry.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { s as TokenTable } from "./theme-6ApjjiBo.js";
|
|
2
|
-
//#region src/registry.d.ts
|
|
3
|
-
interface Declaration {
|
|
4
|
-
readonly property: string;
|
|
5
|
-
readonly value: string;
|
|
6
|
-
}
|
|
7
|
-
interface UtilityFamily {
|
|
8
|
-
readonly root: string;
|
|
9
|
-
/** Accepts `root` with no value ("border", "rounded", "block"). */
|
|
10
|
-
readonly bare?: ReadonlyArray<Declaration> | undefined;
|
|
11
|
-
/** Resolve a named value; null = this family does not accept it. */
|
|
12
|
-
readonly named?: ((value: string, theme: TokenTable) => ReadonlyArray<Declaration> | null) | undefined;
|
|
13
|
-
/** Resolve an arbitrary `[...]` value; null = malformed for this family. */
|
|
14
|
-
readonly arbitrary?: ((value: string, theme: TokenTable) => ReadonlyArray<Declaration> | null) | undefined;
|
|
15
|
-
/** dark: variant is only legal on color families. */
|
|
16
|
-
readonly colorFamily?: boolean | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Base-variant only: sm:/dark: are rejected. Set on the gradient family —
|
|
19
|
-
* its declarations are compiler-internal placeholders that must be combined
|
|
20
|
-
* per node, which head rules cannot express.
|
|
21
|
-
*/
|
|
22
|
-
readonly baseOnly?: boolean | undefined;
|
|
23
|
-
/** "warn" families compile but surface a lint warning. */
|
|
24
|
-
readonly warn?: string | undefined;
|
|
25
|
-
readonly description: string;
|
|
26
|
-
readonly caniemailSlugs: ReadonlyArray<string>;
|
|
27
|
-
}
|
|
28
|
-
interface ForbiddenUtility {
|
|
29
|
-
/** Exact class or `prefix-` match against the candidate base. */
|
|
30
|
-
readonly match: string;
|
|
31
|
-
readonly message: string;
|
|
32
|
-
}
|
|
33
|
-
declare const GRADIENT_DIRECTION_PROPERTY = "-sml-gradient-direction";
|
|
34
|
-
declare const GRADIENT_FROM_PROPERTY = "-sml-gradient-from";
|
|
35
|
-
declare const GRADIENT_TO_PROPERTY = "-sml-gradient-to";
|
|
36
|
-
declare const utilityRegistry: ReadonlyArray<UtilityFamily>;
|
|
37
|
-
declare const forbiddenUtilities: ReadonlyArray<ForbiddenUtility>;
|
|
38
|
-
/** Every root the resolver may try to split on, longest-match first (candidate.ts). */
|
|
39
|
-
declare const registryRoots: ReadonlySet<string>;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { Declaration, ForbiddenUtility, GRADIENT_DIRECTION_PROPERTY, GRADIENT_FROM_PROPERTY, GRADIENT_TO_PROPERTY, UtilityFamily, forbiddenUtilities, registryRoots, utilityRegistry };
|
|
42
|
-
//# sourceMappingURL=registry.d.ts.map
|