@samva/markup 0.4.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-Ck1tAGwO.d.ts → catalog-Db0UcCTg.d.ts} +2 -2
- 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 +74 -117
- package/dist/presets/public-gallery.d.ts +2 -2
- package/dist/presets/public-gallery.js +7 -7
- 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 +5 -5
- package/dist/presets/public-preview-artifacts.js +9 -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-T6IFPnP4.js} +12 -12
- package/dist/render-template.d.ts +7 -7
- package/dist/render-template.js +6 -6
- package/dist/{showcase-C_xgl6hz.d.ts → showcase-dvJMn-Lo.d.ts} +2 -2
- 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 +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,26 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as JSX, h as Fragment, m as EmailNode, p as EmailComponent } from "../elements-
|
|
1
|
+
import { r as JsxSource } from "../source-locations-D6Te6Gy1.js";
|
|
2
|
+
import { g as JSX, h as Fragment, m as EmailNode, p as EmailComponent } from "../elements-ChJULZlh.js";
|
|
3
3
|
//#region src/email/jsx-dev-runtime.d.ts
|
|
4
4
|
/** Development JSX retains compiler-provided origins directly on the semantic tree. */
|
|
5
|
-
declare const jsxDEV: (type: string | EmailComponent<Record<string, unknown>> | typeof Fragment, props: Record<string, unknown> | null, _key?: unknown, _staticChildren?: boolean, source?: JsxSource) =>
|
|
6
|
-
readonly _tag: "Element";
|
|
7
|
-
readonly tag: string;
|
|
8
|
-
readonly props: Readonly<Record<string, unknown>>;
|
|
9
|
-
readonly children: readonly EmailNode[];
|
|
10
|
-
readonly origins: readonly JsxSourceLocation[];
|
|
11
|
-
readonly authored: boolean;
|
|
12
|
-
} | {
|
|
13
|
-
readonly _tag: "Fragment";
|
|
14
|
-
readonly children: readonly EmailNode[];
|
|
15
|
-
} | {
|
|
16
|
-
readonly _tag: "Raw";
|
|
17
|
-
readonly html: string;
|
|
18
|
-
readonly text: string;
|
|
19
|
-
readonly origins: readonly JsxSourceLocation[];
|
|
20
|
-
} | {
|
|
21
|
-
readonly _tag: "Text";
|
|
22
|
-
readonly value: string;
|
|
23
|
-
};
|
|
5
|
+
declare const jsxDEV: (type: string | EmailComponent<Record<string, unknown>> | typeof Fragment, props: Record<string, unknown> | null, _key?: unknown, _staticChildren?: boolean, source?: JsxSource) => EmailNode;
|
|
24
6
|
//#endregion
|
|
25
7
|
export { Fragment, type JSX, jsxDEV };
|
|
26
8
|
//# sourceMappingURL=jsx-dev-runtime.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as reportEmailDiagnostic, S as rawMarkup, _ as currentEmailOrigins, b as jsxs, f as EmailChild, g as JSX, h as Fragment, m as EmailNode, p as EmailComponent, v as drainEmailDiagnostics, x as normalizeChildren, y as jsx } from "../elements-
|
|
1
|
+
import { C as reportEmailDiagnostic, S as rawMarkup, _ as currentEmailOrigins, b as jsxs, f as EmailChild, g as JSX, h as Fragment, m as EmailNode, p as EmailComponent, v as drainEmailDiagnostics, x as normalizeChildren, y as jsx } from "../elements-ChJULZlh.js";
|
|
2
2
|
export { EmailChild, EmailComponent, EmailNode, Fragment, JSX, currentEmailOrigins, drainEmailDiagnostics, jsx, jsxs, normalizeChildren, rawMarkup, reportEmailDiagnostic };
|
|
@@ -1,7 +1,33 @@
|
|
|
1
|
+
import { t as hasProperty } from "../guards-eV1qLbf2.js";
|
|
1
2
|
import { JSX_SOURCE_LOCATION_PROP, completeJsxSourceLocation } from "../source-locations.js";
|
|
2
|
-
import { Data, Predicate } from "effect";
|
|
3
3
|
//#region src/email/jsx-runtime.ts
|
|
4
|
-
|
|
4
|
+
/** Constructors for the authoring tree. The tree is data; nothing here validates it. */
|
|
5
|
+
const EmailNode = {
|
|
6
|
+
Text: (fields) => ({
|
|
7
|
+
type: "Text",
|
|
8
|
+
...fields
|
|
9
|
+
}),
|
|
10
|
+
Element: (fields) => ({
|
|
11
|
+
type: "Element",
|
|
12
|
+
...fields
|
|
13
|
+
}),
|
|
14
|
+
Fragment: (fields) => ({
|
|
15
|
+
type: "Fragment",
|
|
16
|
+
...fields
|
|
17
|
+
}),
|
|
18
|
+
Raw: (fields) => ({
|
|
19
|
+
type: "Raw",
|
|
20
|
+
...fields
|
|
21
|
+
})
|
|
22
|
+
};
|
|
23
|
+
const EMAIL_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
24
|
+
"Text",
|
|
25
|
+
"Element",
|
|
26
|
+
"Fragment",
|
|
27
|
+
"Raw"
|
|
28
|
+
]);
|
|
29
|
+
/** True for a node this runtime built; anything else is not a child it can place. */
|
|
30
|
+
const isEmailNode = (input) => hasProperty(input, "type") && typeof input.type === "string" && EMAIL_NODE_TYPES.has(input.type);
|
|
5
31
|
const Fragment = Symbol.for("@samva/markup/email/Fragment");
|
|
6
32
|
const callSites = [];
|
|
7
33
|
/** Call sites enclosing the element being built, innermost first. */
|
|
@@ -22,7 +48,7 @@ const normalizeChildren = (input) => {
|
|
|
22
48
|
if (typeof input === "string") return [EmailNode.Text({ value: input })];
|
|
23
49
|
if (typeof input === "number" && Number.isFinite(input)) return [EmailNode.Text({ value: String(input) })];
|
|
24
50
|
if (Array.isArray(input)) return input.flatMap(normalizeChildren);
|
|
25
|
-
if (
|
|
51
|
+
if (isEmailNode(input)) return [input];
|
|
26
52
|
throw new TypeError("Email children must be synchronous text, finite numbers, elements, or arrays");
|
|
27
53
|
};
|
|
28
54
|
/** Compatibility markup emitted by a compiler primitive, with the text it stands for. */
|
package/dist/email/render.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { r as EmailDiagnostic } from "../diagnostics-
|
|
2
|
-
import { m as EmailNode } from "../elements-
|
|
1
|
+
import { r as EmailDiagnostic } from "../diagnostics-eFM9A_TU.js";
|
|
2
|
+
import { m as EmailNode } from "../elements-ChJULZlh.js";
|
|
3
3
|
import { EmittedPosition } from "./selection.js";
|
|
4
4
|
import { SerializeEmailOptions } from "./html.js";
|
|
5
|
-
import { r as TemplateDefinition } from "../template-
|
|
6
|
-
import { i as Stylesheet } from "../css-
|
|
5
|
+
import { r as TemplateDefinition } from "../template-G-QPcfmn.js";
|
|
6
|
+
import { i as Stylesheet } from "../css-DoNc7CiC.js";
|
|
7
7
|
//#region src/email/render.d.ts
|
|
8
8
|
/** Classic Outlook lays a document out correctly only under a transitional doctype. */
|
|
9
9
|
declare const EMAIL_DOCTYPE = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
|
package/dist/email/render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as renderEmail, n as bindStylesheets, r as compileEmail, t as EMAIL_DOCTYPE } from "../render-
|
|
1
|
+
import { i as renderEmail, n as bindStylesheets, r as compileEmail, t as EMAIL_DOCTYPE } from "../render-T6IFPnP4.js";
|
|
2
2
|
import "./html.js";
|
|
3
3
|
import "./diagnostics.js";
|
|
4
4
|
import "./stylesheets.js";
|
|
@@ -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-D6Te6Gy1.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-D6Te6Gy1.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-DoNc7CiC.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-ChJULZlh.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-CqepLcpI.js";
|
|
2
|
+
import { s as UnboundTemplateSourceLocations } from "./source-locations-D6Te6Gy1.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,
|
|
@@ -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
|