@samva/markup 0.3.0 → 0.5.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 +17 -0
- package/dist/{ast-63I-VLQx.d.ts → ast-BLybiDxp.d.ts} +34 -60
- package/dist/ast.d.ts +2 -2
- package/dist/ast.js +4 -52
- package/dist/catalog-Db0UcCTg.d.ts +356 -0
- package/dist/{checks-DXuERO4B.js → checks-CmmITP6j.js} +14 -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 +5 -5
- package/dist/compile-whatsapp.js +3 -3
- package/dist/compile.d.ts +5 -5
- package/dist/compile.js +5 -5
- package/dist/compiler.d.ts +4 -4
- package/dist/compiler.js +6 -6
- package/dist/components.d.ts +4 -4
- package/dist/conditionals.js +3 -3
- package/dist/corpus-CM7rKX41.d.ts +106 -0
- package/dist/{css-ar2lU3NC.d.ts → css-DoNc7CiC.d.ts} +4 -5
- package/dist/diagnostics-CqepLcpI.d.ts +47 -0
- package/dist/diagnostics-eFM9A_TU.d.ts +46 -0
- package/dist/diagnostics.d.ts +2 -2
- package/dist/diagnostics.js +15 -29
- package/dist/{elements-DtwKlFVH.d.ts → elements-ChJULZlh.d.ts} +40 -161
- package/dist/email/components.d.ts +1 -1
- package/dist/email/diagnostics.d.ts +1 -1
- package/dist/email/diagnostics.js +8 -43
- package/dist/email/elements.d.ts +1 -1
- package/dist/email/html.d.ts +2 -2
- package/dist/email/html.js +9 -9
- package/dist/email/jsx-dev-runtime.d.ts +3 -21
- package/dist/email/jsx-runtime.d.ts +1 -1
- package/dist/email/jsx-runtime.js +29 -3
- package/dist/email/render.d.ts +4 -4
- package/dist/email/render.js +1 -1
- package/dist/email/selection.d.ts +20 -31
- package/dist/email/selection.js +1 -53
- package/dist/email/source-edit.d.ts +1 -1
- package/dist/email/source-edit.js +2 -2
- package/dist/email/stylesheets.d.ts +1 -1
- package/dist/email/text.d.ts +1 -1
- package/dist/email/text.js +3 -3
- package/dist/emit.d.ts +2 -2
- package/dist/emit.js +5 -5
- package/dist/guards-eV1qLbf2.js +9 -0
- package/dist/{input-schema-BIfzI63B.d.ts → input-schema-7dPFVvNE.d.ts} +2 -2
- package/dist/input-schema-zjkgrXn2.js +455 -0
- package/dist/input-schema.d.ts +1 -1
- package/dist/input-schema.js +1 -169
- package/dist/interpolate.d.ts +9 -12
- package/dist/interpolate.js +1 -19
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/{jsx-runtime-C5k_Zq0A.d.ts → jsx-runtime-BI4gI19E.d.ts} +3 -3
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +3 -3
- package/dist/model.d.ts +18 -33
- package/dist/model.js +4 -17
- package/dist/ops.d.ts +78 -172
- package/dist/ops.js +51 -117
- package/dist/{parser-CGBS73Gz.d.ts → parser-b_Kp5MT6.d.ts} +5 -5
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +8 -8
- package/dist/{predicate-G2SeSvoN.d.ts → predicate-Bmvgw7Ao.d.ts} +4 -4
- package/dist/{predicate-CvkzT-a2.js → predicate-DwXzmqIY.js} +11 -11
- 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/corpus.js +87 -140
- package/dist/presets/public-gallery.d.ts +106 -130
- package/dist/presets/public-gallery.js +131 -209
- package/dist/presets/public-handoff.d.ts +4 -4
- package/dist/presets/public-handoff.js +13 -11
- package/dist/presets/public-preview-artifacts.d.ts +5 -5
- package/dist/presets/public-preview-artifacts.js +9 -9
- package/dist/presets/public-preview.d.ts +0 -4
- package/dist/presets/public-preview.js +37 -362
- package/dist/presets/showcase.d.ts +2 -0
- package/dist/presets/showcase.js +627 -0
- package/dist/presets/sources.d.ts +1 -1
- package/dist/presets/sources.js +5767 -2023
- package/dist/presets.d.ts +2 -384
- package/dist/presets.js +299 -765
- package/dist/printer.d.ts +1 -1
- package/dist/{render-ykQhtMs_.js → render-T6IFPnP4.js} +12 -12
- package/dist/render-template.d.ts +7 -7
- package/dist/render-template.js +6 -6
- package/dist/showcase-dvJMn-Lo.d.ts +456 -0
- package/dist/{source-locations-BCJQnIfU.d.ts → source-locations-D6Te6Gy1.d.ts} +4 -26
- package/dist/source-locations.d.ts +2 -2
- package/dist/source-locations.js +3 -26
- package/dist/{template-Dy5yOPyp.d.ts → template-G-QPcfmn.d.ts} +4 -4
- package/dist/template.d.ts +1 -1
- package/dist/template.js +3 -3
- package/dist/theme-css.d.ts +3 -3
- package/dist/theme-css.js +3 -3
- package/dist/tsx-source-instrumentation.d.ts +1 -3
- package/dist/tsx-source-instrumentation.js +6 -6
- package/dist/tsx-tracer.d.ts +7 -11
- package/dist/tsx-tracer.js +164 -164
- package/dist/{variables-if1VrV34.d.ts → variables-BnKs1iqb.d.ts} +2 -2
- package/dist/variables.d.ts +1 -1
- package/dist/variables.js +4 -4
- package/package.json +8 -3
- package/dist/corpus-qrUD5O6r.d.ts +0 -254
- package/dist/diagnostics-Djd9ckLg.d.ts +0 -90
- package/dist/diagnostics-oveE-laV.d.ts +0 -79
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formatDiagnostic } from "./diagnostics.js";
|
|
2
|
-
import { i as parsePredicate } from "./predicate-
|
|
2
|
+
import { i as parsePredicate } from "./predicate-DwXzmqIY.js";
|
|
3
3
|
import { stringAttribute } from "./ast.js";
|
|
4
4
|
import { parseCandidate, splitRoot } from "./candidate.js";
|
|
5
5
|
import { registryRoots, utilityRegistry } from "./registry.js";
|
|
@@ -7,7 +7,7 @@ import { resolveClasses } from "./classes.js";
|
|
|
7
7
|
import { decodeEntities } from "./lexer.js";
|
|
8
8
|
import { parseSml } from "./parser.js";
|
|
9
9
|
import { baseTokens } from "./tokens.js";
|
|
10
|
-
import { Result } from "
|
|
10
|
+
import { Result } from "better-result";
|
|
11
11
|
//#region src/caniemail-compact.ts
|
|
12
12
|
const caniemailCompactData = {
|
|
13
13
|
apiVersion: "1.0.4",
|
|
@@ -58604,7 +58604,7 @@ const DELIVERY_ASSET_ATTRIBUTES = {
|
|
|
58604
58604
|
*/
|
|
58605
58605
|
const checkDeliveryAssetDiagnostics = (source) => {
|
|
58606
58606
|
const parsed = parseSml(source);
|
|
58607
|
-
if (Result.
|
|
58607
|
+
if (Result.isError(parsed)) return [];
|
|
58608
58608
|
const diagnostics = [];
|
|
58609
58609
|
const visit = (node) => {
|
|
58610
58610
|
if (node.kind !== "element") return;
|
|
@@ -58621,7 +58621,7 @@ const checkDeliveryAssetDiagnostics = (source) => {
|
|
|
58621
58621
|
}
|
|
58622
58622
|
for (const child of node.children) visit(child);
|
|
58623
58623
|
};
|
|
58624
|
-
visit(parsed.
|
|
58624
|
+
visit(parsed.value.root);
|
|
58625
58625
|
return diagnostics;
|
|
58626
58626
|
};
|
|
58627
58627
|
function isBreakingCompatibilityCheck(message) {
|
|
@@ -58749,14 +58749,14 @@ const analyzeDocument = (document) => {
|
|
|
58749
58749
|
};
|
|
58750
58750
|
const analyzeSource = (source) => {
|
|
58751
58751
|
const parsed = parseSml(source);
|
|
58752
|
-
if (Result.
|
|
58752
|
+
if (Result.isError(parsed)) return {
|
|
58753
58753
|
featureSlugs: /* @__PURE__ */ new Set(),
|
|
58754
58754
|
hasDarkClasses: false,
|
|
58755
58755
|
hasImages: false,
|
|
58756
58756
|
hasPureBlackText: false,
|
|
58757
58757
|
styledElements: []
|
|
58758
58758
|
};
|
|
58759
|
-
return analyzeDocument(parsed.
|
|
58759
|
+
return analyzeDocument(parsed.value);
|
|
58760
58760
|
};
|
|
58761
58761
|
const collectPredicateVariableReferences = (ast) => {
|
|
58762
58762
|
const references = [];
|
|
@@ -58840,9 +58840,9 @@ const predicateDiagnosticMessages = (source, document, declaredVariables) => {
|
|
|
58840
58840
|
if (testAttribute?.value.kind === "string") {
|
|
58841
58841
|
const predicate = predicateSource(source, testAttribute);
|
|
58842
58842
|
const parsed = parsePredicate(predicate.text);
|
|
58843
|
-
if (Result.
|
|
58843
|
+
if (Result.isError(parsed)) for (const diagnostic of parsed.error) messages.push(`error: ${formatDiagnostic(source, predicate.mapDiagnostic(diagnostic))}`);
|
|
58844
58844
|
else if (declared !== void 0) {
|
|
58845
|
-
for (const reference of collectPredicateVariableReferences(parsed.
|
|
58845
|
+
for (const reference of collectPredicateVariableReferences(parsed.value)) if (!declared.has(reference.name)) messages.push(`error: ${formatDiagnostic(source, {
|
|
58846
58846
|
code: "predicate-unknown-variable",
|
|
58847
58847
|
message: `unknown predicate variable "${reference.name}" in <If test>`,
|
|
58848
58848
|
span: predicate.mapSpan(reference.span)
|
|
@@ -58857,8 +58857,8 @@ const predicateDiagnosticMessages = (source, document, declaredVariables) => {
|
|
|
58857
58857
|
};
|
|
58858
58858
|
const parseFailurePredicateMessages = (source) => {
|
|
58859
58859
|
const parsed = parseSml(source);
|
|
58860
|
-
if (Result.
|
|
58861
|
-
return parsed.
|
|
58860
|
+
if (Result.isOk(parsed)) return [];
|
|
58861
|
+
return parsed.error.diagnostics.filter((diagnostic) => diagnostic.code.startsWith("predicate-")).map((diagnostic) => `error: ${formatDiagnostic(source, diagnostic)}`);
|
|
58862
58862
|
};
|
|
58863
58863
|
const clientsByDarkBehavior = (profile, behavior) => profile.targets.filter((target) => target.darkBehavior === behavior).map(targetLabel).filter((label, index, labels) => labels.indexOf(label) === index);
|
|
58864
58864
|
const gmailForcedInvertClients = (profile) => profile.targets.filter((target) => target.family === "gmail" && target.darkBehavior === "force-inverts").map(targetLabel);
|
|
@@ -58941,10 +58941,10 @@ function worstCaseArtifactBytes(html) {
|
|
|
58941
58941
|
function checkSmlCompatibility(input) {
|
|
58942
58942
|
const profile = input.profile ?? DEFAULT_EMAIL_TARGET_CLIENT_PROFILE;
|
|
58943
58943
|
const parsed = parseSml(input.source);
|
|
58944
|
-
if (Result.
|
|
58945
|
-
const analysis = analyzeDocument(parsed.
|
|
58944
|
+
if (Result.isError(parsed)) return parseFailurePredicateMessages(input.source);
|
|
58945
|
+
const analysis = analyzeDocument(parsed.value);
|
|
58946
58946
|
return [
|
|
58947
|
-
...predicateDiagnosticMessages(input.source, parsed.
|
|
58947
|
+
...predicateDiagnosticMessages(input.source, parsed.value, input.declaredVariables),
|
|
58948
58948
|
...checkDeliveryAssetDiagnostics(input.source).map((diagnostic) => `error: ${formatDiagnostic(input.source, diagnostic)}`),
|
|
58949
58949
|
...caniemailMessages(analysis.featureSlugs, profile),
|
|
58950
58950
|
...darkModeMessages(analysis, profile)
|
|
@@ -58953,4 +58953,4 @@ function checkSmlCompatibility(input) {
|
|
|
58953
58953
|
//#endregion
|
|
58954
58954
|
export { isBreakingCompatibilityCheck as a, collectSmlFeatureSlugs as i, checkDeliveryAssetDiagnostics as n, worstCaseArtifactBytes as o, checkSmlCompatibility as r, DEFAULT_EMAIL_TARGET_CLIENT_PROFILE as t };
|
|
58955
58955
|
|
|
58956
|
-
//# sourceMappingURL=checks-
|
|
58956
|
+
//# sourceMappingURL=checks-CmmITP6j.js.map
|
package/dist/checks.d.ts
CHANGED
package/dist/checks.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as isBreakingCompatibilityCheck, i as collectSmlFeatureSlugs, n as checkDeliveryAssetDiagnostics, o as worstCaseArtifactBytes, r as checkSmlCompatibility, t as DEFAULT_EMAIL_TARGET_CLIENT_PROFILE } from "./checks-
|
|
1
|
+
import { a as isBreakingCompatibilityCheck, i as collectSmlFeatureSlugs, n as checkDeliveryAssetDiagnostics, o as worstCaseArtifactBytes, r as checkSmlCompatibility, t as DEFAULT_EMAIL_TARGET_CLIENT_PROFILE } from "./checks-CmmITP6j.js";
|
|
2
2
|
export { DEFAULT_EMAIL_TARGET_CLIENT_PROFILE, checkDeliveryAssetDiagnostics, checkSmlCompatibility, collectSmlFeatureSlugs, isBreakingCompatibilityCheck, worstCaseArtifactBytes };
|
package/dist/classes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as Span, t as Diagnostic } from "./diagnostics-CqepLcpI.js";
|
|
2
2
|
import { s as TokenTable } from "./theme-6ApjjiBo.js";
|
|
3
3
|
import { Declaration } from "./registry.js";
|
|
4
4
|
//#region src/classes.d.ts
|
package/dist/compile-sms.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as Diagnostic } from "./diagnostics-
|
|
2
|
-
import {
|
|
3
|
-
import { a as SMS_TAG_SPECS } from "./parser-
|
|
1
|
+
import { t as Diagnostic } from "./diagnostics-CqepLcpI.js";
|
|
2
|
+
import { f as ElementNode } from "./ast-BLybiDxp.js";
|
|
3
|
+
import { a as SMS_TAG_SPECS } from "./parser-b_Kp5MT6.js";
|
|
4
4
|
import { t as SmsEncoding } from "./sms-segments-y4FpPilJ.js";
|
|
5
5
|
//#region src/compile-sms.d.ts
|
|
6
6
|
/** Documented worst-case rendered width of one `{{variable}}`. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { l as WHATSAPP_TAG_SPECS } from "./parser-
|
|
4
|
-
import { Result } from "
|
|
1
|
+
import { r as SmlCompileError, t as Diagnostic } from "./diagnostics-CqepLcpI.js";
|
|
2
|
+
import { f as ElementNode } from "./ast-BLybiDxp.js";
|
|
3
|
+
import { l as WHATSAPP_TAG_SPECS } from "./parser-b_Kp5MT6.js";
|
|
4
|
+
import { Result } from "better-result";
|
|
5
5
|
//#region src/compile-whatsapp.d.ts
|
|
6
6
|
type WhatsAppSpecs = typeof WHATSAPP_TAG_SPECS;
|
|
7
7
|
/** Mirrors whatsappTemplateCategoryEnum, derived from the grammar's closed set. */
|
|
@@ -50,7 +50,7 @@ interface CompiledWhatsApp {
|
|
|
50
50
|
readonly compilerVersion: string;
|
|
51
51
|
}
|
|
52
52
|
/** Root is a parsed `<WhatsApp>` element; the grammar already validated its anatomy. */
|
|
53
|
-
declare const compileWhatsAppRoot: (root: ElementNode) => Result
|
|
53
|
+
declare const compileWhatsAppRoot: (root: ElementNode) => Result<CompiledWhatsApp, SmlCompileError>;
|
|
54
54
|
//#endregion
|
|
55
55
|
export { CompiledWhatsApp, WhatsAppButtonPayload, WhatsAppExamples, WhatsAppHeaderMediaType, WhatsAppHeaderType, WhatsAppTemplateCategory, compileWhatsAppRoot };
|
|
56
56
|
//# sourceMappingURL=compile-whatsapp.d.ts.map
|
package/dist/compile-whatsapp.js
CHANGED
|
@@ -2,7 +2,7 @@ import { SmlCompileError } from "./diagnostics.js";
|
|
|
2
2
|
import { stringAttribute } from "./ast.js";
|
|
3
3
|
import { n as channelTextVariants, r as flattenChannelText, t as COMPILER_VERSION } from "./version-BITr58kk.js";
|
|
4
4
|
import { variableReferences } from "./interpolate.js";
|
|
5
|
-
import { Result } from "
|
|
5
|
+
import { Result } from "better-result";
|
|
6
6
|
//#region src/compile-whatsapp.ts
|
|
7
7
|
const WHATSAPP_BUTTON_LIMITS = {
|
|
8
8
|
URL: 2,
|
|
@@ -158,8 +158,8 @@ const compileWhatsAppRoot = (root) => {
|
|
|
158
158
|
message: "whatsapp mixes positional {{1}} and named {{var}} placeholders; Meta requires one style",
|
|
159
159
|
span: root.span
|
|
160
160
|
});
|
|
161
|
-
if (errors.length > 0) return Result.
|
|
162
|
-
return Result.
|
|
161
|
+
if (errors.length > 0) return Result.err(new SmlCompileError({ diagnostics: errors }));
|
|
162
|
+
return Result.ok({
|
|
163
163
|
channel: "whatsapp",
|
|
164
164
|
name: stringAttribute(root, "name"),
|
|
165
165
|
language: stringAttribute(root, "language"),
|
package/dist/compile.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as SmlParseError, r as SmlCompileError } from "./diagnostics-CqepLcpI.js";
|
|
2
|
+
import { b as SmlDocument } from "./ast-BLybiDxp.js";
|
|
3
3
|
import { CompiledSms } from "./compile-sms.js";
|
|
4
4
|
import { CompiledWhatsApp } from "./compile-whatsapp.js";
|
|
5
|
-
import { Result } from "
|
|
5
|
+
import { Result } from "better-result";
|
|
6
6
|
//#region src/version.d.ts
|
|
7
7
|
declare const COMPILER_VERSION = "0.1.0";
|
|
8
8
|
//#endregion
|
|
@@ -10,9 +10,9 @@ declare const COMPILER_VERSION = "0.1.0";
|
|
|
10
10
|
/** Structured channel payloads compiled from recorded SML. */
|
|
11
11
|
type CompiledTemplate = CompiledSms | CompiledWhatsApp;
|
|
12
12
|
/** Compile a structured document; email definitions execute through the email runtime. */
|
|
13
|
-
declare const compileSml: (document: SmlDocument) => Result
|
|
13
|
+
declare const compileSml: (document: SmlDocument) => Result<CompiledTemplate, SmlCompileError>;
|
|
14
14
|
/** Parse and compile a structured SMS or WhatsApp document. */
|
|
15
|
-
declare const compileSource: (source: string) => Result
|
|
15
|
+
declare const compileSource: (source: string) => Result<CompiledTemplate, SmlParseError | SmlCompileError>;
|
|
16
16
|
//#endregion
|
|
17
17
|
export { COMPILER_VERSION, CompiledTemplate, compileSml, compileSource };
|
|
18
18
|
//# sourceMappingURL=compile.d.ts.map
|
package/dist/compile.js
CHANGED
|
@@ -3,14 +3,14 @@ import { parseSml } from "./parser.js";
|
|
|
3
3
|
import { t as COMPILER_VERSION } from "./version-BITr58kk.js";
|
|
4
4
|
import { compileSmsRoot } from "./compile-sms.js";
|
|
5
5
|
import { compileWhatsAppRoot } from "./compile-whatsapp.js";
|
|
6
|
-
import { Result } from "
|
|
6
|
+
import { Result } from "better-result";
|
|
7
7
|
//#region src/compile.ts
|
|
8
8
|
/** Compile a structured document; email definitions execute through the email runtime. */
|
|
9
9
|
const compileSml = (document) => {
|
|
10
10
|
switch (document.root.tag) {
|
|
11
|
-
case "Sms": return Result.
|
|
11
|
+
case "Sms": return Result.ok(compileSmsRoot(document.root));
|
|
12
12
|
case "WhatsApp": return compileWhatsAppRoot(document.root);
|
|
13
|
-
default: return Result.
|
|
13
|
+
default: return Result.err(new SmlCompileError({ diagnostics: [{
|
|
14
14
|
code: "email-requires-object-template",
|
|
15
15
|
message: "Email templates must default-export defineEmail with an input schema and fixtures.",
|
|
16
16
|
span: document.root.span
|
|
@@ -20,8 +20,8 @@ const compileSml = (document) => {
|
|
|
20
20
|
/** Parse and compile a structured SMS or WhatsApp document. */
|
|
21
21
|
const compileSource = (source) => {
|
|
22
22
|
const parsed = parseSml(source);
|
|
23
|
-
if (Result.
|
|
24
|
-
return compileSml(parsed.
|
|
23
|
+
if (Result.isError(parsed)) return Result.err(parsed.error);
|
|
24
|
+
return compileSml(parsed.value);
|
|
25
25
|
};
|
|
26
26
|
//#endregion
|
|
27
27
|
export { COMPILER_VERSION, compileSml, compileSource };
|
package/dist/compiler.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as formatEmailDiagnostic, i as EmailDiagnosticSeverity, n as EmailCompileError, o as hasBlockingDiagnostic, r as EmailDiagnostic } from "./diagnostics-
|
|
2
|
-
import { a as EmailGlobalProps, c as EmailStyle, d as isUrlAttribute, i as EmailElementSpec, l as EmailTag, m as EmailNode, n as EMAIL_GLOBAL_ATTRIBUTES, o as EmailIntrinsicElements, r as EmailAttributeSpec, s as EmailLayout, t as EMAIL_ELEMENTS, u as emailElement } from "./elements-
|
|
1
|
+
import { a as formatEmailDiagnostic, i as EmailDiagnosticSeverity, n as EmailCompileError, o as hasBlockingDiagnostic, r as EmailDiagnostic } from "./diagnostics-eFM9A_TU.js";
|
|
2
|
+
import { a as EmailGlobalProps, c as EmailStyle, d as isUrlAttribute, i as EmailElementSpec, l as EmailTag, m as EmailNode, 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";
|
|
3
3
|
import { EmailElementSelection, EmittedPosition, INSTANCE_PATH_ATTRIBUTE, emailAuthoringTarget, emailDefinitionInstances, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections } from "./email/selection.js";
|
|
4
4
|
import { EmailHtmlOutput, SerializeEmailOptions, escapeAttribute, escapeText, serializeEmailHtml } from "./email/html.js";
|
|
5
5
|
import { deriveEmailText } from "./email/text.js";
|
|
6
|
-
import { a as compileSelector, c as CompiledSelector, d as matchesSelector, i as Stylesheet, l as Compound, n as CssRule, o as parseStylesheet, r as Specificity, s as Ancestry, t as CssDeclaration, u as classListOf } from "./css-
|
|
6
|
+
import { a as compileSelector, c as CompiledSelector, d as matchesSelector, i as Stylesheet, l as Compound, n as CssRule, o as parseStylesheet, r as Specificity, s as Ancestry, t as CssDeclaration, u as classListOf } from "./css-DoNc7CiC.js";
|
|
7
7
|
import { EMAIL_DOCTYPE, EmailCompileOutput, RenderedEmail, compileEmail, renderEmail } from "./email/render.js";
|
|
8
8
|
import { collectStylesheets, hasStylesheets, registerStylesheet, resetStylesheets } from "./email/stylesheets.js";
|
|
9
9
|
import { instrumentTsxSourceForPreview } from "./tsx-source-instrumentation.js";
|
|
@@ -299,5 +299,5 @@ interface CompiledEmailProject {
|
|
|
299
299
|
*/
|
|
300
300
|
declare const compileEmailProject: (source: Readonly<Record<string, string | Uint8Array>>, authoredEntry: string, options: TransformOptions) => Promise<CompiledEmailProject>;
|
|
301
301
|
//#endregion
|
|
302
|
-
export { ASSET_CONTENT_TYPES, type Ancestry, type AppliedStyles, type AssetEntry, type AssetManifest, COMPATIBILITY_PROVENANCE, type ClassDiscovery, type CompatibilityInput, type CompatibilityProvenance, type CompiledEmailProject, type CompiledSelector, type Compound, type CssDeclaration, type CssRule, EMAIL_CLIENT_MATRIX, EMAIL_DOCTYPE, EMAIL_ELEMENTS, EMAIL_ENTRY_WRAPPER, EMAIL_GLOBAL_ATTRIBUTES, EMAIL_RESET_MODULE, ESSENTIAL_CONSTRUCTS, type EmailAttributeSpec, type EmailClientTarget, EmailCompileError, type EmailCompileOutput, EmailDiagnostic, EmailDiagnosticSeverity, EmailElementSelection, type EmailElementSpec, type EmailGlobalProps, type EmailHtmlOutput, type EmailIntrinsicElements, type EmailLayout, type EmailStyle, type EmailTag, EmittedPosition, INSTANCE_PATH_ATTRIBUTE, type ModuleTransform, type ProjectTransform, type RenderedEmail, type SerializeEmailOptions, type Specificity, type Stylesheet, TAILWIND_MODULE_PATH, TAILWIND_VERSION, type TailwindLimits, type TailwindOptions, type TailwindOutput, type TransformOptions, applyStylesheet, assetEntry, assetUrl, checkAssetBase, checkEmailCompatibility, classListOf, collectStylesheets, compileEmail, compileEmailProject, compileSelector, compileTailwind, deriveEmailText, discoverClassCandidates, downlevelColors, downlevelMediaQuery, emailAuthoringTarget, emailDefinitionInstances, emailElement, emailEntryWrapper, emailResetModule, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections, escapeAttribute, escapeText, finalizeValue, foldCalc, formatColor, formatEmailDiagnostic, hasBlockingCompatibility, hasBlockingDiagnostic, hasStylesheets, instrumentTsxSourceForPreview, isAssetPath, isExternalAsset, isUrlAttribute, matchesSelector, parseColor, parseStylesheet, registerStylesheet, renderEmail, renderHeadCss, resetStylesheets, resolveVariables, serializeEmailHtml, tailwindSpecifierFor, transformModule, transformProject, unknownCoverage, withLeadingImport };
|
|
302
|
+
export { ASSET_CONTENT_TYPES, type Ancestry, type AppliedStyles, type AssetEntry, type AssetManifest, COMPATIBILITY_PROVENANCE, type ClassDiscovery, type CompatibilityInput, type CompatibilityProvenance, type CompiledEmailProject, type CompiledSelector, type Compound, type CssDeclaration, type CssRule, EMAIL_CLIENT_MATRIX, EMAIL_DOCTYPE, EMAIL_ELEMENTS, EMAIL_ENTRY_WRAPPER, EMAIL_GLOBAL_ATTRIBUTES, EMAIL_RESET_MODULE, ESSENTIAL_CONSTRUCTS, type EmailAttributeSpec, type EmailClientTarget, EmailCompileError, type EmailCompileOutput, type EmailDiagnostic, type EmailDiagnosticSeverity, type EmailElementSelection, type EmailElementSpec, type EmailGlobalProps, type EmailHtmlOutput, type EmailIntrinsicElements, type EmailLayout, type EmailStyle, type EmailTag, type EmittedPosition, INSTANCE_PATH_ATTRIBUTE, type ModuleTransform, type ProjectTransform, type RenderedEmail, type SerializeEmailOptions, type Specificity, type Stylesheet, TAILWIND_MODULE_PATH, TAILWIND_VERSION, type TailwindLimits, type TailwindOptions, type TailwindOutput, type TransformOptions, applyStylesheet, assetEntry, assetUrl, checkAssetBase, checkEmailCompatibility, classListOf, collectStylesheets, compileEmail, compileEmailProject, compileSelector, compileTailwind, deriveEmailText, discoverClassCandidates, downlevelColors, downlevelMediaQuery, emailAuthoringTarget, emailDefinitionInstances, emailElement, emailEntryWrapper, emailResetModule, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections, escapeAttribute, escapeText, finalizeValue, foldCalc, formatColor, formatEmailDiagnostic, hasBlockingCompatibility, hasBlockingDiagnostic, hasStylesheets, instrumentTsxSourceForPreview, isAssetPath, isExternalAsset, isUrlAttribute, matchesSelector, parseColor, parseStylesheet, registerStylesheet, renderEmail, renderHeadCss, resetStylesheets, resolveVariables, serializeEmailHtml, tailwindSpecifierFor, transformModule, transformProject, unknownCoverage, withLeadingImport };
|
|
303
303
|
//# sourceMappingURL=compiler.d.ts.map
|
package/dist/compiler.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as isObject } from "./guards-eV1qLbf2.js";
|
|
2
|
+
import { a as applyStylesheet, c as downlevelMediaQuery, d as renderHeadCss, f as resolveVariables, i as renderEmail, l as finalizeValue, o as classListOf, r as compileEmail, s as matchesSelector, t as EMAIL_DOCTYPE, u as foldCalc } from "./render-T6IFPnP4.js";
|
|
2
3
|
import { EMAIL_ELEMENTS, EMAIL_GLOBAL_ATTRIBUTES, emailElement, isUrlAttribute } from "./email/elements.js";
|
|
3
|
-
import {
|
|
4
|
+
import { INSTANCE_PATH_ATTRIBUTE, emailAuthoringTarget, emailDefinitionInstances, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections } from "./email/selection.js";
|
|
4
5
|
import { escapeAttribute, escapeText, serializeEmailHtml } from "./email/html.js";
|
|
5
|
-
import { EmailCompileError,
|
|
6
|
+
import { EmailCompileError, formatEmailDiagnostic, hasBlockingDiagnostic } from "./email/diagnostics.js";
|
|
6
7
|
import { collectStylesheets, hasStylesheets, registerStylesheet, resetStylesheets } from "./email/stylesheets.js";
|
|
7
8
|
import { deriveEmailText } from "./email/text.js";
|
|
8
9
|
import { buildLineMap, lineColumn } from "./diagnostics.js";
|
|
9
10
|
import { instrumentTsxSourceForPreview } from "./tsx-source-instrumentation.js";
|
|
10
|
-
import { Predicate } from "effect";
|
|
11
11
|
import { parse } from "@babel/parser";
|
|
12
12
|
import { caniemail, parseHtml, rawData } from "caniemail";
|
|
13
13
|
import { generate, ident, parse as parse$1, walk } from "css-tree";
|
|
@@ -1134,7 +1134,7 @@ const compileTailwind = async (candidates, options = {}) => {
|
|
|
1134
1134
|
candidates: all
|
|
1135
1135
|
};
|
|
1136
1136
|
};
|
|
1137
|
-
const isRecord = (value) =>
|
|
1137
|
+
const isRecord = (value) => isObject(value) && !Array.isArray(value);
|
|
1138
1138
|
const isAstNode = (value) => isRecord(value) && typeof value.type === "string" && typeof value.start === "number" && typeof value.end === "number";
|
|
1139
1139
|
const walk$1 = (value, visit) => {
|
|
1140
1140
|
if (Array.isArray(value)) {
|
|
@@ -1385,6 +1385,6 @@ const compileEmailProject = async (source, authoredEntry, options) => {
|
|
|
1385
1385
|
};
|
|
1386
1386
|
};
|
|
1387
1387
|
//#endregion
|
|
1388
|
-
export { ASSET_CONTENT_TYPES, COMPATIBILITY_PROVENANCE, EMAIL_CLIENT_MATRIX, EMAIL_DOCTYPE, EMAIL_ELEMENTS, EMAIL_ENTRY_WRAPPER, EMAIL_GLOBAL_ATTRIBUTES, EMAIL_RESET_MODULE, ESSENTIAL_CONSTRUCTS, EmailCompileError,
|
|
1388
|
+
export { ASSET_CONTENT_TYPES, COMPATIBILITY_PROVENANCE, EMAIL_CLIENT_MATRIX, EMAIL_DOCTYPE, EMAIL_ELEMENTS, EMAIL_ENTRY_WRAPPER, EMAIL_GLOBAL_ATTRIBUTES, EMAIL_RESET_MODULE, ESSENTIAL_CONSTRUCTS, EmailCompileError, INSTANCE_PATH_ATTRIBUTE, TAILWIND_MODULE_PATH, TAILWIND_VERSION, applyStylesheet, assetEntry, assetUrl, checkAssetBase, checkEmailCompatibility, classListOf, collectStylesheets, compileEmail, compileEmailProject, compileSelector, compileTailwind, deriveEmailText, discoverClassCandidates, downlevelColors, downlevelMediaQuery, emailAuthoringTarget, emailDefinitionInstances, emailElement, emailEntryWrapper, emailResetModule, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections, escapeAttribute, escapeText, finalizeValue, foldCalc, formatColor, formatEmailDiagnostic, hasBlockingCompatibility, hasBlockingDiagnostic, hasStylesheets, instrumentTsxSourceForPreview, isAssetPath, isExternalAsset, isUrlAttribute, matchesSelector, parseColor, parseStylesheet, registerStylesheet, renderEmail, renderHeadCss, resetStylesheets, resolveVariables, serializeEmailHtml, tailwindSpecifierFor, transformModule, transformProject, unknownCoverage, withLeadingImport };
|
|
1389
1389
|
|
|
1390
1390
|
//# sourceMappingURL=compiler.js.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as EMAIL_TAG_SPECS, l as WHATSAPP_TAG_SPECS, o as TagSpec, t as AttributeSpec } from "./parser-
|
|
3
|
-
import { r as PredicateRef, s as VariableRef } from "./variables-
|
|
4
|
-
import { s as SmlChildren } from "./jsx-runtime-
|
|
1
|
+
import { f as ElementNode } from "./ast-BLybiDxp.js";
|
|
2
|
+
import { i as EMAIL_TAG_SPECS, l as WHATSAPP_TAG_SPECS, o as TagSpec, t as AttributeSpec } from "./parser-b_Kp5MT6.js";
|
|
3
|
+
import { r as PredicateRef, s as VariableRef } from "./variables-BnKs1iqb.js";
|
|
4
|
+
import { s as SmlChildren } from "./jsx-runtime-BI4gI19E.js";
|
|
5
5
|
//#region src/components.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* The scalar type an attribute spec accepts. `level` narrows to the Heading
|
package/dist/conditionals.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as parsePredicate, r as evaluatePredicate } from "./predicate-
|
|
2
|
-
import { Result } from "
|
|
1
|
+
import { i as parsePredicate, r as evaluatePredicate } from "./predicate-DwXzmqIY.js";
|
|
2
|
+
import { Result } from "better-result";
|
|
3
3
|
//#region src/conditionals.ts
|
|
4
4
|
const IF_MARKER = "<!--sml:if:";
|
|
5
5
|
const MARKER_CLOSE = "-->";
|
|
@@ -20,7 +20,7 @@ const resolve = (content, variables) => {
|
|
|
20
20
|
const elseCandidate = content.indexOf(elseMarker, bodyStart);
|
|
21
21
|
const elseIndex = elseCandidate !== -1 && elseCandidate < endIndex ? elseCandidate : -1;
|
|
22
22
|
const parsed = parsePredicate(predicateSource);
|
|
23
|
-
const condition = Result.
|
|
23
|
+
const condition = Result.isOk(parsed) && evaluatePredicate(parsed.value, variables);
|
|
24
24
|
const branchA = content.slice(bodyStart, elseIndex === -1 ? endIndex : elseIndex);
|
|
25
25
|
const branchB = elseIndex === -1 ? "" : content.slice(elseIndex + elseMarker.length, endIndex);
|
|
26
26
|
const selected = resolve(condition ? branchA : branchB, variables).trim();
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { n as OwnedShowcaseId, t as BrandRecreationShowcaseId } from "./showcase-dvJMn-Lo.js";
|
|
2
|
+
import { Result } from "better-result";
|
|
3
|
+
//#region presets/corpus.d.ts
|
|
4
|
+
type TemplateCorpusKind = "owned-editable-sml" | "brand-recreation-sml" | "inspiration-reference";
|
|
5
|
+
declare const templateFacetOptions: {
|
|
6
|
+
readonly jobType: readonly ["account-access", "commerce", "product-communication", "lifecycle", "publishing-campaigns"];
|
|
7
|
+
readonly lifecycle: readonly ["acquisition", "activation", "engagement", "transaction", "retention", "recovery"];
|
|
8
|
+
readonly industry: readonly ["saas", "ecommerce", "developer-tools", "newsletters-media"];
|
|
9
|
+
readonly season: readonly ["evergreen", "seasonal"];
|
|
10
|
+
readonly audience: readonly ["product-users", "customers", "members", "readers", "shoppers", "teams"];
|
|
11
|
+
readonly design: readonly ["minimal", "branded", "editorial", "data-heavy", "single-cta"];
|
|
12
|
+
readonly brandProvenance: readonly ["samva-original", "third-party-reference"];
|
|
13
|
+
};
|
|
14
|
+
/** Every facet dimension, with the closed value list each accepts. */
|
|
15
|
+
type TemplateFacetSet = { readonly [Dimension in keyof typeof templateFacetOptions]: ReadonlyArray<(typeof templateFacetOptions)[Dimension][number]>; };
|
|
16
|
+
interface CorpusReview {
|
|
17
|
+
readonly state: "draft" | "approved" | "rejected";
|
|
18
|
+
readonly reviewedBy: string;
|
|
19
|
+
readonly reviewedAt: string;
|
|
20
|
+
readonly notes: string;
|
|
21
|
+
}
|
|
22
|
+
interface CorpusDisplay {
|
|
23
|
+
readonly state: "hidden" | "public";
|
|
24
|
+
readonly attributionLabel: string;
|
|
25
|
+
}
|
|
26
|
+
interface CorpusRetention {
|
|
27
|
+
readonly policy: "retain-until-withdrawn" | "retain-while-linked";
|
|
28
|
+
readonly reviewedAt: string;
|
|
29
|
+
}
|
|
30
|
+
interface CorpusTakedown {
|
|
31
|
+
readonly state: "active" | "removed";
|
|
32
|
+
readonly contact: string;
|
|
33
|
+
readonly procedureUrl: string;
|
|
34
|
+
}
|
|
35
|
+
interface OwnedEditablePreset {
|
|
36
|
+
readonly type: "OwnedEditablePreset";
|
|
37
|
+
readonly corpusKind: "owned-editable-sml";
|
|
38
|
+
readonly provenance: {
|
|
39
|
+
readonly owner: "Samva";
|
|
40
|
+
readonly sourcePath: string;
|
|
41
|
+
readonly recordedAt: string;
|
|
42
|
+
};
|
|
43
|
+
readonly review: CorpusReview;
|
|
44
|
+
readonly display: CorpusDisplay;
|
|
45
|
+
readonly retention: CorpusRetention;
|
|
46
|
+
readonly takedown: CorpusTakedown;
|
|
47
|
+
}
|
|
48
|
+
interface BrandRecreationPreset {
|
|
49
|
+
readonly type: "BrandRecreationPreset";
|
|
50
|
+
readonly corpusKind: "brand-recreation-sml";
|
|
51
|
+
readonly provenance: {
|
|
52
|
+
readonly owner: "Samva";
|
|
53
|
+
readonly sourcePath: string;
|
|
54
|
+
readonly recordedAt: string;
|
|
55
|
+
/** The brand whose own email is recreated, named on every public surface. */
|
|
56
|
+
readonly brand: string;
|
|
57
|
+
/** What that brand's email does, in the customer's words. */
|
|
58
|
+
readonly subject: string;
|
|
59
|
+
readonly reviewedNote: string;
|
|
60
|
+
};
|
|
61
|
+
readonly review: CorpusReview;
|
|
62
|
+
readonly display: CorpusDisplay;
|
|
63
|
+
readonly retention: CorpusRetention;
|
|
64
|
+
readonly takedown: CorpusTakedown;
|
|
65
|
+
}
|
|
66
|
+
/** Clean-room recreations of a named brand's own email, authored as editable Samva projects. */
|
|
67
|
+
declare const brandRecreationProvenance: Record<BrandRecreationShowcaseId, BrandRecreationPreset["provenance"]>;
|
|
68
|
+
/**
|
|
69
|
+
* Owned presets authored as complete showcase projects with their own stylesheet and assets.
|
|
70
|
+
* Every other owned preset is the single module `packages/markup/presets/<id>.tsx`.
|
|
71
|
+
*/
|
|
72
|
+
declare const ownedShowcasePresetSources: Record<OwnedShowcaseId, string>;
|
|
73
|
+
declare const ownedPresetSourcePath: (id: string) => string;
|
|
74
|
+
interface InspirationReference {
|
|
75
|
+
readonly type: "InspirationReference";
|
|
76
|
+
readonly corpusKind: "inspiration-reference";
|
|
77
|
+
readonly provenance: {
|
|
78
|
+
readonly publisher: string;
|
|
79
|
+
readonly sourceUrl: string;
|
|
80
|
+
readonly capturedAt: string;
|
|
81
|
+
readonly rightsBasis: "display-link-and-commentary" | "permission";
|
|
82
|
+
};
|
|
83
|
+
readonly review: CorpusReview;
|
|
84
|
+
readonly display: CorpusDisplay;
|
|
85
|
+
readonly retention: CorpusRetention;
|
|
86
|
+
readonly takedown: CorpusTakedown;
|
|
87
|
+
}
|
|
88
|
+
type TemplateCorpusRecord = OwnedEditablePreset | BrandRecreationPreset | InspirationReference;
|
|
89
|
+
interface PublicCorpusRegistration {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly corpus: TemplateCorpusRecord;
|
|
92
|
+
readonly facets: TemplateFacetSet;
|
|
93
|
+
}
|
|
94
|
+
interface PublicCorpusRegistrationIssue {
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly message: string;
|
|
97
|
+
}
|
|
98
|
+
/** Decode and gate a record before it can enter any public projection. */
|
|
99
|
+
declare const registerPublicCorpusEntry: (input: unknown) => Result<PublicCorpusRegistration, PublicCorpusRegistrationIssue>;
|
|
100
|
+
/** A facet selection: any dimension may be left unselected. */
|
|
101
|
+
type TemplateFacetQuery = Partial<TemplateFacetSet>;
|
|
102
|
+
/** Strict intersection: every selected value in every selected dimension must match. */
|
|
103
|
+
declare const matchesTemplateFacets: (facets: TemplateFacetSet, query: TemplateFacetQuery) => boolean;
|
|
104
|
+
//#endregion
|
|
105
|
+
export { PublicCorpusRegistrationIssue as a, TemplateFacetQuery as c, matchesTemplateFacets as d, ownedPresetSourcePath as f, templateFacetOptions as h, PublicCorpusRegistration as i, TemplateFacetSet as l, registerPublicCorpusEntry as m, InspirationReference as n, TemplateCorpusKind as o, ownedShowcasePresetSources as p, OwnedEditablePreset as r, TemplateCorpusRecord as s, BrandRecreationPreset as t, brandRecreationProvenance as u };
|
|
106
|
+
//# sourceMappingURL=corpus-CM7rKX41.d.ts.map
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import {
|
|
3
|
-
import { m as EmailNode } from "./elements-DtwKlFVH.js";
|
|
1
|
+
import { r as EmailDiagnostic } from "./diagnostics-eFM9A_TU.js";
|
|
2
|
+
import { m as EmailNode } from "./elements-ChJULZlh.js";
|
|
4
3
|
import "css-tree";
|
|
5
4
|
//#region src/email/selectors.d.ts
|
|
6
5
|
type EmailElementNode = Extract<EmailNode, {
|
|
7
|
-
|
|
6
|
+
type: "Element";
|
|
8
7
|
}>;
|
|
9
8
|
interface AttributeTest {
|
|
10
9
|
readonly name: string;
|
|
@@ -81,4 +80,4 @@ declare const parseStylesheet: (source: string, options?: {
|
|
|
81
80
|
}) => Stylesheet;
|
|
82
81
|
//#endregion
|
|
83
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 };
|
|
84
|
-
//# sourceMappingURL=css-
|
|
83
|
+
//# sourceMappingURL=css-DoNc7CiC.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
declare const SmlParseError_base: import("better-result").TaggedErrorClass<"SmlParseError">;
|
|
19
|
+
declare class SmlParseError extends SmlParseError_base<{
|
|
20
|
+
readonly diagnostics: ReadonlyArray<Diagnostic>;
|
|
21
|
+
readonly message: string;
|
|
22
|
+
}> {
|
|
23
|
+
constructor(args: {
|
|
24
|
+
readonly diagnostics: ReadonlyArray<Diagnostic>;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
declare const SmlCompileError_base: import("better-result").TaggedErrorClass<"SmlCompileError">;
|
|
28
|
+
declare class SmlCompileError extends SmlCompileError_base<{
|
|
29
|
+
readonly diagnostics: ReadonlyArray<Diagnostic>;
|
|
30
|
+
readonly message: string;
|
|
31
|
+
}> {
|
|
32
|
+
constructor(args: {
|
|
33
|
+
readonly diagnostics: ReadonlyArray<Diagnostic>;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/** Newline-offset line map. Build once per source, query with `lineColumn`. */
|
|
37
|
+
declare const buildLineMap: (source: string) => ReadonlyArray<number>;
|
|
38
|
+
/** 1-based line/column for an absolute offset, via binary search. */
|
|
39
|
+
declare const lineColumn: (lineMap: ReadonlyArray<number>, offset: number) => {
|
|
40
|
+
readonly line: number;
|
|
41
|
+
readonly column: number;
|
|
42
|
+
};
|
|
43
|
+
/** "line 12:8 unknown class ..." — the shape agents iterate on. */
|
|
44
|
+
declare const formatDiagnostic: (source: string, diagnostic: Diagnostic) => string;
|
|
45
|
+
//#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
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { i as JsxSourceLocation } from "./source-locations-D6Te6Gy1.js";
|
|
2
|
+
//#region src/email/diagnostics.d.ts
|
|
3
|
+
type EmailDiagnosticSeverity = "error" | "warning" | "info";
|
|
4
|
+
/** What the emitted document establishes beyond the client feature matrix. */
|
|
5
|
+
interface EmailCompatibilityAssessment {
|
|
6
|
+
readonly assessment: "risk" | "degradation" | "unverified" | "not-applicable";
|
|
7
|
+
/** A short description of the consequence or the remaining verification. */
|
|
8
|
+
readonly title: string;
|
|
9
|
+
}
|
|
10
|
+
interface EmailDiagnostic {
|
|
11
|
+
/** Stable identifier, e.g. `unsupported-element` or `caniemail/css-border-radius`. */
|
|
12
|
+
readonly code: string;
|
|
13
|
+
readonly severity: EmailDiagnosticSeverity;
|
|
14
|
+
/** States what is wrong and what to write instead. */
|
|
15
|
+
readonly message: string;
|
|
16
|
+
/** Innermost authoring element first, then each enclosing component call site. */
|
|
17
|
+
readonly origins: ReadonlyArray<JsxSourceLocation>;
|
|
18
|
+
/** Target clients a compatibility finding applies to. */
|
|
19
|
+
readonly clients?: ReadonlyArray<string> | undefined;
|
|
20
|
+
/** Partial-support notes and other caveats a client matrix carries. */
|
|
21
|
+
readonly notes?: string | undefined;
|
|
22
|
+
/** Which pinned rule data produced the finding. */
|
|
23
|
+
readonly provenance?: string | undefined;
|
|
24
|
+
/** Declared fixtures whose rendered output produced this finding. */
|
|
25
|
+
readonly fixtures?: ReadonlyArray<string> | undefined;
|
|
26
|
+
/** Source chains for every located emitted occurrence; origins identifies the first. */
|
|
27
|
+
readonly occurrences?: ReadonlyArray<ReadonlyArray<JsxSourceLocation>> | undefined;
|
|
28
|
+
/** Compatibility observations are not automatically defects or proof of client rendering. */
|
|
29
|
+
readonly compatibility?: EmailCompatibilityAssessment | undefined;
|
|
30
|
+
}
|
|
31
|
+
declare const EmailCompileError_base: import("better-result").TaggedErrorClass<"EmailCompileError">;
|
|
32
|
+
declare class EmailCompileError extends EmailCompileError_base<{
|
|
33
|
+
readonly diagnostics: ReadonlyArray<EmailDiagnostic>;
|
|
34
|
+
readonly message: string;
|
|
35
|
+
}> {
|
|
36
|
+
constructor(args: {
|
|
37
|
+
readonly diagnostics: ReadonlyArray<EmailDiagnostic>;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** `emails/welcome.tsx:12:3 unsupported-element: …` — the shape agents iterate on. */
|
|
41
|
+
declare const formatEmailDiagnostic: (diagnostic: EmailDiagnostic) => string;
|
|
42
|
+
/** True when a set of findings must stop the compile or refuse a publication. */
|
|
43
|
+
declare const hasBlockingDiagnostic: (diagnostics: readonly EmailDiagnostic[]) => boolean;
|
|
44
|
+
//#endregion
|
|
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
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { Diagnostic, DiagnosticRepair,
|
|
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 };
|
package/dist/diagnostics.js
CHANGED
|
@@ -1,34 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TaggedError } from "better-result";
|
|
2
2
|
//#region src/diagnostics.ts
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"remove-class",
|
|
11
|
-
"rewrite-node",
|
|
12
|
-
"use-primitive"
|
|
13
|
-
]),
|
|
14
|
-
raw: Schema.optional(Schema.String),
|
|
15
|
-
suggestions: Schema.Array(Schema.String),
|
|
16
|
-
explanation: Schema.String
|
|
17
|
-
});
|
|
18
|
-
const DiagnosticSchema = Schema.Struct({
|
|
19
|
-
code: Schema.String,
|
|
20
|
-
message: Schema.String,
|
|
21
|
-
span: SpanSchema,
|
|
22
|
-
repair: Schema.optional(DiagnosticRepairSchema)
|
|
23
|
-
});
|
|
24
|
-
var SmlParseError = class extends Schema.TaggedError()("SmlParseError", { diagnostics: Schema.Array(DiagnosticSchema) }) {
|
|
25
|
-
get message() {
|
|
26
|
-
return this.diagnostics.map((diagnostic) => diagnostic.message).join("\n");
|
|
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
|
+
});
|
|
27
10
|
}
|
|
28
11
|
};
|
|
29
|
-
var SmlCompileError = class extends
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
var SmlCompileError = class extends TaggedError("SmlCompileError") {
|
|
13
|
+
constructor(args) {
|
|
14
|
+
super({
|
|
15
|
+
diagnostics: args.diagnostics,
|
|
16
|
+
message: diagnosticsMessage(args.diagnostics)
|
|
17
|
+
});
|
|
32
18
|
}
|
|
33
19
|
};
|
|
34
20
|
/** Newline-offset line map. Build once per source, query with `lineColumn`. */
|
|
@@ -60,6 +46,6 @@ const formatDiagnostic = (source, diagnostic) => {
|
|
|
60
46
|
return `line ${line}:${column} ${diagnostic.message}`;
|
|
61
47
|
};
|
|
62
48
|
//#endregion
|
|
63
|
-
export {
|
|
49
|
+
export { SmlCompileError, SmlParseError, buildLineMap, formatDiagnostic, lineColumn };
|
|
64
50
|
|
|
65
51
|
//# sourceMappingURL=diagnostics.js.map
|