@samva/markup 0.4.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 +19 -0
- package/dist/{ast-63I-VLQx.d.ts → ast-BrDtApwS.d.ts} +34 -60
- package/dist/ast.d.ts +2 -2
- package/dist/ast.js +4 -52
- package/dist/{catalog-Ck1tAGwO.d.ts → catalog-60eaYC7b.d.ts} +2 -2
- package/dist/{checks-DXuERO4B.js → checks-DBweSIPN.js} +18 -20
- 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 +8 -5
- package/dist/compiler.js +45 -45
- package/dist/components.d.ts +4 -4
- package/dist/conditionals.js +56 -24
- package/dist/corpus-BjYMqOoY.d.ts +106 -0
- package/dist/{css-ar2lU3NC.d.ts → css-COcFOT1y.d.ts} +4 -5
- package/dist/diagnostics-BMYtBCQk.d.ts +46 -0
- package/dist/diagnostics-OcQKQYSY.d.ts +49 -0
- package/dist/diagnostics.d.ts +2 -2
- package/dist/diagnostics.js +24 -33
- package/dist/{elements-DtwKlFVH.d.ts → elements-BzjjnoCS.d.ts} +40 -161
- 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/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 +11 -10
- 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/footer.js +7 -4
- 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-I-1nCtl2.d.ts} +3 -3
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +3 -3
- package/dist/lexer.js +17 -5
- package/dist/model.d.ts +18 -33
- package/dist/model.js +4 -17
- package/dist/ops-2aiiYO7m.js +630 -0
- package/dist/ops.d.ts +78 -172
- package/dist/ops.js +2 -546
- package/dist/{parser-CGBS73Gz.d.ts → parser-CQcASEyy.d.ts} +5 -5
- package/dist/parser.d.ts +1 -1
- package/dist/parser.js +8 -8
- package/dist/{predicate-CvkzT-a2.js → predicate-BI6uRRM-.js} +24 -14
- package/dist/{predicate-G2SeSvoN.d.ts → predicate-M-05Nd7R.d.ts} +4 -4
- 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 +74 -117
- package/dist/presets/public-gallery.d.ts +2 -2
- package/dist/presets/public-gallery.js +17 -9
- package/dist/presets/public-handoff.d.ts +4 -4
- package/dist/presets/public-handoff.js +10 -9
- package/dist/presets/public-preview-artifacts.d.ts +7 -5
- package/dist/presets/public-preview-artifacts.js +10 -9
- 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-ykQhtMs_.js → render-aaJBnsXK.js} +44 -27
- package/dist/render-template.d.ts +7 -7
- package/dist/render-template.js +6 -6
- package/dist/{showcase-C_xgl6hz.d.ts → showcase-DGZAWn4Z.d.ts} +2 -2
- package/dist/{source-locations-BCJQnIfU.d.ts → source-locations-DrCM82Ym.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-DWftqh4x.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/theme.js +25 -2
- 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 +165 -165
- package/dist/{variables-if1VrV34.d.ts → variables-J_L3qxRa.d.ts} +2 -2
- package/dist/variables.d.ts +1 -1
- package/dist/variables.js +4 -4
- package/package.json +4 -3
- package/dist/corpus-U2EeALvS.d.ts +0 -234
- package/dist/diagnostics-Djd9ckLg.d.ts +0 -90
- package/dist/diagnostics-oveE-laV.d.ts +0 -79
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-aaJBnsXK.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";
|
|
@@ -895,45 +895,6 @@ const compileSelector = (selector) => {
|
|
|
895
895
|
};
|
|
896
896
|
/** Substitute a nested rule's `&` against its parent selector. */
|
|
897
897
|
const nestSelector = (parent, child) => child.includes("&") ? child.replaceAll("&", parent) : `${parent} ${child}`;
|
|
898
|
-
const selectorFacts = /* @__PURE__ */ new Map();
|
|
899
|
-
/** Everything a rule needs from its selector, computed once per distinct string. */
|
|
900
|
-
const factsFor = (selector) => {
|
|
901
|
-
const cached = selectorFacts.get(selector);
|
|
902
|
-
if (cached !== void 0) return cached;
|
|
903
|
-
let facts;
|
|
904
|
-
try {
|
|
905
|
-
const node = parse$1(selector, {
|
|
906
|
-
context: "selector",
|
|
907
|
-
positions: false
|
|
908
|
-
});
|
|
909
|
-
const classes = /* @__PURE__ */ new Set();
|
|
910
|
-
walk(node, {
|
|
911
|
-
visit: "ClassSelector",
|
|
912
|
-
enter: (part) => {
|
|
913
|
-
classes.add(ident.decode(part.name));
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
facts = {
|
|
917
|
-
classes: [...classes],
|
|
918
|
-
specificity: specificityOf(node),
|
|
919
|
-
pseudo: hasPseudo(node),
|
|
920
|
-
matcher: compileSelector(selector)
|
|
921
|
-
};
|
|
922
|
-
} catch {
|
|
923
|
-
facts = {
|
|
924
|
-
classes: [],
|
|
925
|
-
specificity: [
|
|
926
|
-
0,
|
|
927
|
-
0,
|
|
928
|
-
0
|
|
929
|
-
],
|
|
930
|
-
pseudo: true,
|
|
931
|
-
matcher: void 0
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
selectorFacts.set(selector, facts);
|
|
935
|
-
return facts;
|
|
936
|
-
};
|
|
937
898
|
/** Parse one stylesheet into rules, keeping layer, order and conditions. */
|
|
938
899
|
const parseStylesheet = (source, options = {}) => {
|
|
939
900
|
const rules = [];
|
|
@@ -942,7 +903,46 @@ const parseStylesheet = (source, options = {}) => {
|
|
|
942
903
|
const conditionalVariables = /* @__PURE__ */ new Set();
|
|
943
904
|
const diagnostics = [];
|
|
944
905
|
const layers = /* @__PURE__ */ new Map();
|
|
906
|
+
const selectorFacts = /* @__PURE__ */ new Map();
|
|
945
907
|
let order = options.startOrder ?? 0;
|
|
908
|
+
/** Everything a rule needs from its selector, computed once per distinct string. */
|
|
909
|
+
const factsFor = (selector) => {
|
|
910
|
+
const cached = selectorFacts.get(selector);
|
|
911
|
+
if (cached !== void 0) return cached;
|
|
912
|
+
let facts;
|
|
913
|
+
try {
|
|
914
|
+
const node = parse$1(selector, {
|
|
915
|
+
context: "selector",
|
|
916
|
+
positions: false
|
|
917
|
+
});
|
|
918
|
+
const classes = /* @__PURE__ */ new Set();
|
|
919
|
+
walk(node, {
|
|
920
|
+
visit: "ClassSelector",
|
|
921
|
+
enter: (part) => {
|
|
922
|
+
classes.add(ident.decode(part.name));
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
facts = {
|
|
926
|
+
classes: [...classes],
|
|
927
|
+
specificity: specificityOf(node),
|
|
928
|
+
pseudo: hasPseudo(node),
|
|
929
|
+
matcher: compileSelector(selector)
|
|
930
|
+
};
|
|
931
|
+
} catch {
|
|
932
|
+
facts = {
|
|
933
|
+
classes: [],
|
|
934
|
+
specificity: [
|
|
935
|
+
0,
|
|
936
|
+
0,
|
|
937
|
+
0
|
|
938
|
+
],
|
|
939
|
+
pseudo: true,
|
|
940
|
+
matcher: void 0
|
|
941
|
+
};
|
|
942
|
+
}
|
|
943
|
+
selectorFacts.set(selector, facts);
|
|
944
|
+
return facts;
|
|
945
|
+
};
|
|
946
946
|
let ast;
|
|
947
947
|
try {
|
|
948
948
|
ast = parse$1(source, {
|
|
@@ -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-BrDtApwS.js";
|
|
2
|
+
import { i as EMAIL_TAG_SPECS, l as WHATSAPP_TAG_SPECS, o as TagSpec, t as AttributeSpec } from "./parser-CQcASEyy.js";
|
|
3
|
+
import { r as PredicateRef, s as VariableRef } from "./variables-J_L3qxRa.js";
|
|
4
|
+
import { s as SmlChildren } from "./jsx-runtime-I-1nCtl2.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,31 +1,63 @@
|
|
|
1
|
-
import { i as parsePredicate, r as evaluatePredicate } from "./predicate-
|
|
2
|
-
import { Result } from "
|
|
1
|
+
import { i as parsePredicate, r as evaluatePredicate } from "./predicate-BI6uRRM-.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 = "-->";
|
|
6
6
|
const resolve = (content, variables) => {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
7
|
+
const stack = [{
|
|
8
|
+
cursor: 0,
|
|
9
|
+
end: content.length,
|
|
10
|
+
trim: false,
|
|
11
|
+
chunks: []
|
|
12
|
+
}];
|
|
13
|
+
let resolved = content;
|
|
14
|
+
while (stack.length > 0) {
|
|
15
|
+
const frame = stack.at(-1);
|
|
16
|
+
const start = content.indexOf(IF_MARKER, frame.cursor);
|
|
17
|
+
if (start === -1 || start >= frame.end) {
|
|
18
|
+
frame.chunks.push(content.slice(frame.cursor, frame.end));
|
|
19
|
+
const value = frame.trim ? frame.chunks.join("").trim() : frame.chunks.join("");
|
|
20
|
+
stack.pop();
|
|
21
|
+
const parent = stack.at(-1);
|
|
22
|
+
if (parent === void 0) resolved = value;
|
|
23
|
+
else parent.chunks.push(value);
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
const headEnd = content.indexOf(MARKER_CLOSE, start);
|
|
27
|
+
if (headEnd === -1 || headEnd >= frame.end) {
|
|
28
|
+
frame.chunks.push(content.slice(frame.cursor, frame.end));
|
|
29
|
+
frame.cursor = frame.end;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
const header = content.slice(start + 11, headEnd);
|
|
33
|
+
const spaceIndex = header.indexOf(" ");
|
|
34
|
+
const id = spaceIndex === -1 ? header : header.slice(0, spaceIndex);
|
|
35
|
+
const predicateSource = spaceIndex === -1 ? "" : header.slice(spaceIndex + 1);
|
|
36
|
+
const elseMarker = `<!--sml:else:${id}-->`;
|
|
37
|
+
const endMarker = `<!--sml:endif:${id}-->`;
|
|
38
|
+
const bodyStart = headEnd + 3;
|
|
39
|
+
const endIndex = content.indexOf(endMarker, bodyStart);
|
|
40
|
+
if (endIndex === -1 || endIndex + endMarker.length > frame.end) {
|
|
41
|
+
frame.chunks.push(content.slice(frame.cursor, frame.end));
|
|
42
|
+
frame.cursor = frame.end;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const elseCandidate = content.indexOf(elseMarker, bodyStart);
|
|
46
|
+
const elseIndex = elseCandidate !== -1 && elseCandidate < endIndex ? elseCandidate : -1;
|
|
47
|
+
const parsed = parsePredicate(predicateSource);
|
|
48
|
+
const condition = Result.isOk(parsed) && evaluatePredicate(parsed.value, variables);
|
|
49
|
+
const branchStart = condition ? bodyStart : elseIndex === -1 ? endIndex : elseIndex + elseMarker.length;
|
|
50
|
+
const branchEnd = condition && elseIndex !== -1 ? elseIndex : endIndex;
|
|
51
|
+
frame.chunks.push(content.slice(frame.cursor, start));
|
|
52
|
+
frame.cursor = endIndex + endMarker.length;
|
|
53
|
+
stack.push({
|
|
54
|
+
cursor: branchStart,
|
|
55
|
+
end: branchEnd,
|
|
56
|
+
trim: true,
|
|
57
|
+
chunks: []
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return resolved;
|
|
29
61
|
};
|
|
30
62
|
/**
|
|
31
63
|
* Selects <If> branches in a compiled artifact (html or plain-text alt) for
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { n as OwnedShowcaseId, t as BrandRecreationShowcaseId } from "./showcase-DGZAWn4Z.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-BjYMqOoY.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-BMYtBCQk.js";
|
|
2
|
+
import { m as EmailNode } from "./elements-BzjjnoCS.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-COcFOT1y.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { i as JsxSourceLocation } from "./source-locations-DrCM82Ym.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-BMYtBCQk.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
/** Build one formatter for a batch of diagnostics against the same source. */
|
|
44
|
+
declare const createDiagnosticFormatter: (source: string) => ((diagnostic: Diagnostic) => string);
|
|
45
|
+
/** "line 12:8 unknown class ..." — the shape agents iterate on. */
|
|
46
|
+
declare const formatDiagnostic: (source: string, diagnostic: Diagnostic) => string;
|
|
47
|
+
//#endregion
|
|
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
|
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 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 };
|
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`. */
|
|
@@ -54,12 +40,17 @@ const lineColumn = (lineMap, offset) => {
|
|
|
54
40
|
column: offset - lineMap[low] + 1
|
|
55
41
|
};
|
|
56
42
|
};
|
|
57
|
-
/**
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
return
|
|
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
|
+
};
|
|
61
50
|
};
|
|
51
|
+
/** "line 12:8 unknown class ..." — the shape agents iterate on. */
|
|
52
|
+
const formatDiagnostic = (source, diagnostic) => createDiagnosticFormatter(source)(diagnostic);
|
|
62
53
|
//#endregion
|
|
63
|
-
export {
|
|
54
|
+
export { SmlCompileError, SmlParseError, buildLineMap, createDiagnosticFormatter, formatDiagnostic, lineColumn };
|
|
64
55
|
|
|
65
56
|
//# sourceMappingURL=diagnostics.js.map
|