@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
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { i as JsxSourceLocation } from "../source-locations-
|
|
2
|
-
import { Schema } from "effect";
|
|
1
|
+
import { i as JsxSourceLocation } from "../source-locations-DrCM82Ym.js";
|
|
3
2
|
//#region src/email/selection.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The attribute a preview stamps so a click in a rendered document resolves to
|
|
@@ -7,65 +6,55 @@ import { Schema } from "effect";
|
|
|
7
6
|
*/
|
|
8
7
|
declare const INSTANCE_PATH_ATTRIBUTE = "data-samva-instance";
|
|
9
8
|
/** Where one element sits in the emitted document, with the authoring that produced it. */
|
|
10
|
-
|
|
11
|
-
readonly start:
|
|
12
|
-
readonly end:
|
|
13
|
-
readonly origins:
|
|
14
|
-
readonly fileName: Schema.String;
|
|
15
|
-
readonly lineNumber: Schema.Int;
|
|
16
|
-
readonly columnNumber: Schema.Int;
|
|
17
|
-
}>>;
|
|
9
|
+
interface EmittedPosition {
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
readonly origins: ReadonlyArray<JsxSourceLocation>;
|
|
18
13
|
/**
|
|
19
14
|
* Dot-separated element indices from the document root, assigned as the
|
|
20
15
|
* document is written. It is the identity of one rendered instance.
|
|
21
16
|
*/
|
|
22
|
-
readonly instancePath:
|
|
23
|
-
readonly tag:
|
|
17
|
+
readonly instancePath: string;
|
|
18
|
+
readonly tag: string;
|
|
24
19
|
/** False when a compiler primitive generated this element. */
|
|
25
|
-
readonly authored:
|
|
26
|
-
}
|
|
27
|
-
interface EmittedPosition extends Schema.Schema.Type<typeof EmittedPosition> {}
|
|
20
|
+
readonly authored: boolean;
|
|
21
|
+
}
|
|
28
22
|
/** One rendered element, and the authoring it came from. */
|
|
29
|
-
|
|
23
|
+
interface EmailElementSelection {
|
|
30
24
|
/**
|
|
31
25
|
* Dot-separated element indices from the document root. It is the identity
|
|
32
26
|
* of one rendered instance, which is what tells two iterations of the same
|
|
33
27
|
* authored element apart: their origins are identical.
|
|
34
28
|
*/
|
|
35
|
-
readonly instancePath:
|
|
36
|
-
readonly tag:
|
|
29
|
+
readonly instancePath: string;
|
|
30
|
+
readonly tag: string;
|
|
37
31
|
/**
|
|
38
32
|
* The authored JSX element first, then each enclosing component call site,
|
|
39
33
|
* innermost first. Empty when the compiler generated this element with no
|
|
40
34
|
* authoring on the stack — the hidden preheader block, for instance.
|
|
41
35
|
*/
|
|
42
|
-
readonly origins:
|
|
43
|
-
readonly fileName: Schema.String;
|
|
44
|
-
readonly lineNumber: Schema.Int;
|
|
45
|
-
readonly columnNumber: Schema.Int;
|
|
46
|
-
}>>;
|
|
36
|
+
readonly origins: ReadonlyArray<JsxSourceLocation>;
|
|
47
37
|
/**
|
|
48
38
|
* False when a compiler primitive generated this element. `origins[0]` is
|
|
49
39
|
* then the authoring element that asked for it rather than this element
|
|
50
40
|
* itself, so the wrapper selects the primitive the author wrote.
|
|
51
41
|
*/
|
|
52
|
-
readonly authored:
|
|
42
|
+
readonly authored: boolean;
|
|
53
43
|
/** 1-based position among the rendered elements sharing this origin chain and tag. */
|
|
54
|
-
readonly occurrence:
|
|
44
|
+
readonly occurrence: number;
|
|
55
45
|
/**
|
|
56
46
|
* How many rendered elements share that chain and tag. Above one, one piece
|
|
57
47
|
* of authoring produced several rendered elements — a loop over a component,
|
|
58
48
|
* or a primitive that generates a repeated cell — so an edit there changes
|
|
59
49
|
* all of them.
|
|
60
50
|
*/
|
|
61
|
-
readonly occurrences:
|
|
51
|
+
readonly occurrences: number;
|
|
62
52
|
/** Absent for the document root. */
|
|
63
|
-
readonly parentPath
|
|
53
|
+
readonly parentPath?: string;
|
|
64
54
|
/** Offset range in the rendered HTML this selection was taken from. */
|
|
65
|
-
readonly start:
|
|
66
|
-
readonly end:
|
|
67
|
-
}
|
|
68
|
-
interface EmailElementSelection extends Schema.Schema.Type<typeof EmailElementSelection> {}
|
|
55
|
+
readonly start: number;
|
|
56
|
+
readonly end: number;
|
|
57
|
+
}
|
|
69
58
|
/**
|
|
70
59
|
* Turn one render's emitted positions into selections, in document order.
|
|
71
60
|
*
|
package/dist/email/selection.js
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
|
-
import { JsxSourceLocation } from "../source-locations.js";
|
|
2
|
-
import { Schema } from "effect";
|
|
3
1
|
//#region src/email/selection.ts
|
|
4
2
|
/**
|
|
5
3
|
* The attribute a preview stamps so a click in a rendered document resolves to
|
|
6
4
|
* exactly one rendered element. A delivered message never carries it.
|
|
7
5
|
*/
|
|
8
6
|
const INSTANCE_PATH_ATTRIBUTE = "data-samva-instance";
|
|
9
|
-
/** Where one element sits in the emitted document, with the authoring that produced it. */
|
|
10
|
-
const EmittedPosition = Schema.Struct({
|
|
11
|
-
start: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
12
|
-
end: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
13
|
-
origins: Schema.Array(JsxSourceLocation),
|
|
14
|
-
/**
|
|
15
|
-
* Dot-separated element indices from the document root, assigned as the
|
|
16
|
-
* document is written. It is the identity of one rendered instance.
|
|
17
|
-
*/
|
|
18
|
-
instancePath: Schema.String.check(Schema.isMinLength(1)),
|
|
19
|
-
tag: Schema.String.check(Schema.isMinLength(1)),
|
|
20
|
-
/** False when a compiler primitive generated this element. */
|
|
21
|
-
authored: Schema.Boolean
|
|
22
|
-
});
|
|
23
|
-
/** One rendered element, and the authoring it came from. */
|
|
24
|
-
const EmailElementSelection = Schema.Struct({
|
|
25
|
-
/**
|
|
26
|
-
* Dot-separated element indices from the document root. It is the identity
|
|
27
|
-
* of one rendered instance, which is what tells two iterations of the same
|
|
28
|
-
* authored element apart: their origins are identical.
|
|
29
|
-
*/
|
|
30
|
-
instancePath: Schema.String.check(Schema.isMinLength(1)),
|
|
31
|
-
tag: Schema.String.check(Schema.isMinLength(1)),
|
|
32
|
-
/**
|
|
33
|
-
* The authored JSX element first, then each enclosing component call site,
|
|
34
|
-
* innermost first. Empty when the compiler generated this element with no
|
|
35
|
-
* authoring on the stack — the hidden preheader block, for instance.
|
|
36
|
-
*/
|
|
37
|
-
origins: Schema.Array(JsxSourceLocation),
|
|
38
|
-
/**
|
|
39
|
-
* False when a compiler primitive generated this element. `origins[0]` is
|
|
40
|
-
* then the authoring element that asked for it rather than this element
|
|
41
|
-
* itself, so the wrapper selects the primitive the author wrote.
|
|
42
|
-
*/
|
|
43
|
-
authored: Schema.Boolean,
|
|
44
|
-
/** 1-based position among the rendered elements sharing this origin chain and tag. */
|
|
45
|
-
occurrence: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
|
|
46
|
-
/**
|
|
47
|
-
* How many rendered elements share that chain and tag. Above one, one piece
|
|
48
|
-
* of authoring produced several rendered elements — a loop over a component,
|
|
49
|
-
* or a primitive that generates a repeated cell — so an edit there changes
|
|
50
|
-
* all of them.
|
|
51
|
-
*/
|
|
52
|
-
occurrences: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
|
|
53
|
-
/** Absent for the document root. */
|
|
54
|
-
parentPath: Schema.optionalKey(Schema.String),
|
|
55
|
-
/** Offset range in the rendered HTML this selection was taken from. */
|
|
56
|
-
start: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
|
|
57
|
-
end: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0))
|
|
58
|
-
});
|
|
59
7
|
const locationKey = (origin) => `${origin.fileName}:${origin.lineNumber}:${origin.columnNumber}`;
|
|
60
8
|
/** One call site: the authored element and every component call enclosing it. */
|
|
61
9
|
const callSiteKey = (selection) => `${selection.tag}\u0000${selection.origins.map(locationKey).join("\0")}`;
|
|
@@ -138,6 +86,6 @@ const emailDefinitionInstances = (selections, selection) => {
|
|
|
138
86
|
return selections.filter((candidate) => definitionKey(candidate) === key);
|
|
139
87
|
};
|
|
140
88
|
//#endregion
|
|
141
|
-
export {
|
|
89
|
+
export { INSTANCE_PATH_ATTRIBUTE, emailAuthoringTarget, emailDefinitionInstances, emailSelectionAncestry, emailSelectionIndex, emailSelectionSiblings, emailSelections };
|
|
142
90
|
|
|
143
91
|
//# sourceMappingURL=selection.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as JsxSourceLocation } from "../source-locations-
|
|
1
|
+
import { i as JsxSourceLocation } from "../source-locations-DrCM82Ym.js";
|
|
2
2
|
//#region src/email/source-edit.d.ts
|
|
3
3
|
/** One exact source replacement; before text guards against concurrent changes. */
|
|
4
4
|
interface SourceReplacement {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { n as isObject } from "../guards-eV1qLbf2.js";
|
|
1
2
|
import { buildLineMap } from "../diagnostics.js";
|
|
2
|
-
import { Predicate } from "effect";
|
|
3
3
|
import { parse } from "@babel/parser";
|
|
4
4
|
//#region src/email/source-edit.ts
|
|
5
|
-
const node = (value) =>
|
|
5
|
+
const node = (value) => isObject(value) && "type" in value && typeof value.type === "string" && "start" in value && typeof value.start === "number" && "end" in value && typeof value.end === "number";
|
|
6
6
|
const children = (value) => Array.isArray(value) ? value.filter(node) : [];
|
|
7
7
|
const walk = (value, visit, parent = null) => {
|
|
8
8
|
if (Array.isArray(value)) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as Stylesheet } from "../css-
|
|
1
|
+
import { i as Stylesheet } from "../css-COcFOT1y.js";
|
|
2
2
|
//#region src/email/stylesheets.d.ts
|
|
3
3
|
/** Called by a compiler-generated stylesheet module at import time. */
|
|
4
4
|
declare const registerStylesheet: (sheet: Stylesheet) => void;
|
package/dist/email/text.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as EmailNode } from "../elements-
|
|
1
|
+
import { m as EmailNode } from "../elements-BzjjnoCS.js";
|
|
2
2
|
//#region src/email/text.d.ts
|
|
3
3
|
/** Derive the plain-text alternative from the semantic tree in reading order. */
|
|
4
4
|
declare const deriveEmailText: (node: EmailNode) => string;
|
package/dist/email/text.js
CHANGED
|
@@ -18,8 +18,8 @@ const block = (inner, separator) => {
|
|
|
18
18
|
return trimmed === "" ? "" : `${separator}${trimmed}${separator}`;
|
|
19
19
|
};
|
|
20
20
|
const collect = (nodes, keep, descend) => nodes.flatMap((child) => {
|
|
21
|
-
if (child.
|
|
22
|
-
if (child.
|
|
21
|
+
if (child.type === "Fragment") return collect(child.children, keep, descend);
|
|
22
|
+
if (child.type !== "Element") return [];
|
|
23
23
|
if (keep(child.tag)) return [child];
|
|
24
24
|
return descend(child.tag) ? collect(child.children, keep, descend) : [];
|
|
25
25
|
});
|
|
@@ -30,7 +30,7 @@ const TABLE_SECTIONS = /* @__PURE__ */ new Set([
|
|
|
30
30
|
]);
|
|
31
31
|
const childText = (node, context) => node.children.map((child) => derive(child, context)).join("");
|
|
32
32
|
const derive = (node, context) => {
|
|
33
|
-
switch (node.
|
|
33
|
+
switch (node.type) {
|
|
34
34
|
case "Text": return context.preformatted ? node.value : node.value.replace(INVISIBLE, "").replace(/[^\S\n]+/g, " ");
|
|
35
35
|
case "Raw": return node.text;
|
|
36
36
|
case "Fragment": return node.children.map((child) => derive(child, context)).join("");
|
package/dist/emit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Diagnostic } from "./diagnostics-
|
|
2
|
-
import {
|
|
1
|
+
import { t as Diagnostic } from "./diagnostics-OcQKQYSY.js";
|
|
2
|
+
import { s as UnboundTemplateSourceLocations } from "./source-locations-DrCM82Ym.js";
|
|
3
3
|
import { TemplateVariable } from "./render-template.js";
|
|
4
4
|
//#region src/emit.d.ts
|
|
5
5
|
/**
|
package/dist/emit.js
CHANGED
|
@@ -2,7 +2,7 @@ import { sameTemplateSourceLocations } from "./source-locations.js";
|
|
|
2
2
|
import { isRootTag } from "./ast.js";
|
|
3
3
|
import { createVariablesProxy } from "./variables.js";
|
|
4
4
|
import { renderTemplate } from "./render-template.js";
|
|
5
|
-
import { Result } from "
|
|
5
|
+
import { Result } from "better-result";
|
|
6
6
|
//#region src/emit.ts
|
|
7
7
|
/**
|
|
8
8
|
* emitModule — the module-level emit boundary for the TSX authoring layer
|
|
@@ -115,7 +115,7 @@ const emitModule = (moduleExports) => {
|
|
|
115
115
|
*/
|
|
116
116
|
const emitOne = (name, template) => {
|
|
117
117
|
const first = renderTemplate(template);
|
|
118
|
-
if (Result.
|
|
118
|
+
if (Result.isError(first)) return {
|
|
119
119
|
name,
|
|
120
120
|
ok: false,
|
|
121
121
|
source: void 0,
|
|
@@ -124,11 +124,11 @@ const emitOne = (name, template) => {
|
|
|
124
124
|
kind: "unavailable",
|
|
125
125
|
reason: "render-failed"
|
|
126
126
|
},
|
|
127
|
-
diagnostics: first.
|
|
127
|
+
diagnostics: first.error.diagnostics
|
|
128
128
|
};
|
|
129
|
-
const rendered = first.
|
|
129
|
+
const rendered = first.value;
|
|
130
130
|
const second = renderTemplate(template);
|
|
131
|
-
if (Result.
|
|
131
|
+
if (Result.isOk(second) && second.value.source === rendered.source && sameTemplateSourceLocations(second.value.sourceLocations, rendered.sourceLocations)) return {
|
|
132
132
|
name,
|
|
133
133
|
ok: true,
|
|
134
134
|
source: rendered.source,
|
package/dist/footer.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* the placeholder. */
|
|
8
8
|
const FOOTER_UNSUBSCRIBE_PLACEHOLDER = "%samva:unsubscribe-url%";
|
|
9
9
|
const escapeText = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
10
|
-
const escapeAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll("\"", """);
|
|
10
|
+
const escapeAttribute = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'");
|
|
11
11
|
const isSafeUrl = (url) => /^(https?:|mailto:)/i.test(url.trim());
|
|
12
12
|
const addressLines = (address) => {
|
|
13
13
|
const region = [
|
|
@@ -45,6 +45,9 @@ const renderFooterBlock = (input) => {
|
|
|
45
45
|
const containerPx = tokens.containerPx["xl"] ?? 600;
|
|
46
46
|
const fontSizePx = tokens.text["xs"]?.sizePx ?? 12;
|
|
47
47
|
const lineHeightPx = tokens.text["xs"]?.lineHeightPx ?? 18;
|
|
48
|
+
const fontFamilyAttribute = escapeAttribute(fontFamily);
|
|
49
|
+
const mutedColorAttribute = escapeAttribute(mutedColor);
|
|
50
|
+
const linkColorAttribute = escapeAttribute(linkColor);
|
|
48
51
|
const rows = [];
|
|
49
52
|
const textLines = [];
|
|
50
53
|
if (typeof footer.customHtml === "string" && footer.customHtml.trim().length > 0) rows.push(`<tr><td style="padding:0 0 12px 0;">${footer.customHtml}</td></tr>`);
|
|
@@ -61,20 +64,20 @@ const renderFooterBlock = (input) => {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
if (footer.socialLinks !== void 0 && footer.socialLinks.length > 0) {
|
|
64
|
-
const links = footer.socialLinks.map((link) => isSafeUrl(link.url) ? `<a href="${escapeAttribute(link.url.trim())}" style="color:${
|
|
67
|
+
const links = footer.socialLinks.map((link) => isSafeUrl(link.url) ? `<a href="${escapeAttribute(link.url.trim())}" style="color:${linkColorAttribute};text-decoration:underline;" ses:no-track>${escapeText(link.label)}</a>` : escapeText(link.label));
|
|
65
68
|
rows.push(`<tr><td style="padding:0 0 8px 0;">${links.join("<span style=\"padding:0 6px;\">·</span>")}</td></tr>`);
|
|
66
69
|
textLines.push(footer.socialLinks.map((link) => `${link.label}: ${link.url}`).join(" "));
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
if (unsubscribeUrl !== null) {
|
|
70
|
-
rows.push(`<tr><td style="padding:0;"><a href="${escapeAttribute(unsubscribeUrl)}" style="color:${
|
|
73
|
+
rows.push(`<tr><td style="padding:0;"><a href="${escapeAttribute(unsubscribeUrl)}" style="color:${mutedColorAttribute};text-decoration:underline;" ses:no-track>${escapeText(unsubscribeLabel)}</a></td></tr>`);
|
|
71
74
|
textLines.push(`${unsubscribeLabel}: ${unsubscribeUrl}`);
|
|
72
75
|
}
|
|
73
76
|
return {
|
|
74
77
|
html: rows.length === 0 ? "" : [
|
|
75
78
|
`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="100%" style="width:100%;border-collapse:collapse;">`,
|
|
76
79
|
`<tr><td align="center" style="padding:32px 16px;">`,
|
|
77
|
-
`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="${containerPx}" style="width:100%;max-width:${containerPx}px;border-collapse:collapse;font-family:${
|
|
80
|
+
`<table role="presentation" cellpadding="0" cellspacing="0" border="0" width="${containerPx}" style="width:100%;max-width:${containerPx}px;border-collapse:collapse;font-family:${fontFamilyAttribute};font-size:${fontSizePx}px;line-height:${lineHeightPx}px;color:${mutedColorAttribute};text-align:center;">`,
|
|
78
81
|
...rows,
|
|
79
82
|
`</table>`,
|
|
80
83
|
`</td></tr>`,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/internal/guards.ts
|
|
2
|
+
/** A non-null, non-array object, narrowed for property access. */
|
|
3
|
+
const isObject = (input) => typeof input === "object" && input !== null && !Array.isArray(input);
|
|
4
|
+
/** True when `input` carries `property`, narrowing it for reads. */
|
|
5
|
+
const hasProperty = (input, property) => typeof input === "object" && input !== null || typeof input === "function" ? property in input : false;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { isObject as n, hasProperty as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=guards-eV1qLbf2.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OutputUnit } from "@cfworker/json-schema";
|
|
2
|
-
import { StandardJSONSchemaV1 } from "
|
|
2
|
+
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
//#region src/input-schema.d.ts
|
|
4
4
|
/** JSON Schema dialect accepted by template publications. */
|
|
5
5
|
declare const INPUT_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
@@ -20,4 +20,4 @@ declare const inputSchema: <S extends StandardJSONSchemaV1>(source: S) => InputS
|
|
|
20
20
|
type InputIssue = OutputUnit;
|
|
21
21
|
//#endregion
|
|
22
22
|
export { jsonSchema as a, inputSchema as i, InputIssue as n, InputSchema as r, INPUT_SCHEMA_DIALECT as t };
|
|
23
|
-
//# sourceMappingURL=input-schema-
|
|
23
|
+
//# sourceMappingURL=input-schema-7dPFVvNE.d.ts.map
|