@samva/markup 0.16.0 → 0.17.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 +42 -40
- package/CHANGELOG.md +72 -0
- package/README.md +10 -9
- package/dist/{brand-jFV6YtSV.d.ts → assets-CS5Xa_mr.d.ts} +41 -3
- package/dist/{brand-Ci05p37c.js → brand-CIiEqkU7.js} +64 -3
- package/dist/{brand-plugin-CHhcei-j.d.ts → brand-plugin-Dj9SMpfS.d.ts} +3 -1
- package/dist/brand.d.ts +2 -3
- package/dist/brand.js +3 -4
- package/dist/compatibility.d.ts +76 -0
- package/dist/compatibility.js +807 -0
- package/dist/compiled-template-Bc4Dq9zy.d.ts +268 -0
- package/dist/compiler.d.ts +59 -193
- package/dist/compiler.js +473 -775
- package/dist/{components-3XHjYD3i.js → components-C5850-Qg.js} +37 -29
- package/dist/css-B_aVKrDo.js +436 -0
- package/dist/css-color-DLM12Osu.js +315 -0
- package/dist/{diagnostic-codes-8XDLR9ef.js → diagnostic-codes-DZKb0Xcg.js} +40 -1
- package/dist/{diagnostics-CUYlQ_6x.d.ts → diagnostics-D4vSLQrO.d.ts} +1 -10
- package/dist/diagnostics.d.ts +6 -2
- package/dist/diagnostics.js +3 -4
- package/dist/edit.d.ts +10 -9
- package/dist/edit.js +12 -11
- package/dist/email/jsx-dev-runtime.d.ts +1 -1
- package/dist/email/jsx-dev-runtime.js +1 -1
- package/dist/email/jsx-runtime.d.ts +2 -2
- package/dist/email/jsx-runtime.js +2 -2
- package/dist/email.d.ts +1 -1
- package/dist/email.js +1 -1
- package/dist/html-DJUK2YJF.js +483 -0
- package/dist/index.d.ts +1 -1
- package/dist/{jsx-runtime-DC7xG0aA.d.ts → jsx-runtime-DL8NVF1f.d.ts} +12 -6
- package/dist/{jsx-runtime-CBlexoeR.js → jsx-runtime-qL19u3Fy.js} +17 -10
- package/dist/preview-rNoJBEIY.d.ts +104 -0
- package/dist/{profile-BsY4dkan.js → profile-JTvgCD6X.js} +714 -29
- package/dist/{html-BvRFepeO.js → render-template-DwPDm3Hq.js} +155 -572
- package/dist/render.d.ts +40 -28
- package/dist/render.js +3 -47
- package/dist/selectors-CYWCoxZr.js +157 -0
- package/dist/sms.d.ts +1 -1
- package/dist/sms.js +1 -1
- package/dist/{template-B-UDXK8a.d.ts → template-DmNcoH4Q.d.ts} +2 -9
- package/dist/{theme-css-s9QwD5Ko.js → theme-css-P9F5S7Ic.js} +3 -316
- package/dist/whatsapp.d.ts +1 -1
- package/dist/whatsapp.js +1 -1
- package/generated/contract.json +7 -2
- package/generated/reference.md +3 -2
- package/package.json +5 -5
- package/skills/sml/SKILL.md +2 -2
- package/dist/assets-BSpgZOSR.js +0 -61
- package/dist/assets-BSuNT9gr.d.ts +0 -39
- package/dist/brand-footer-ClRtWnIc.d.ts +0 -40
- package/dist/brand-footer-DXVGsKE5.js +0 -746
- package/dist/brand-sample.d.ts +0 -4
- package/dist/brand-sample.js +0 -2
- package/dist/cascade-DoLWZ66g.js +0 -701
- package/dist/diagnostic-model-DJtqbETd.js +0 -36
- package/dist/ir-KJLFW08u.js +0 -5
- package/dist/render-CVnXZMyK.js +0 -258
- package/dist/render-CuZej25A.d.ts +0 -564
- package/dist/theme-imports-u_P0ygvQ.js +0 -102
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { t as BrandPlugin } from "./brand-plugin-Dj9SMpfS.js";
|
|
2
|
+
import { r as JsxSourceLocation } from "./source-locations-C8wCsiAy.js";
|
|
3
|
+
import { v as CompiledTemplate } from "./compiled-template-Bc4Dq9zy.js";
|
|
4
|
+
//#region src/preview.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* The attribute a preview stamps so a click in a rendered document resolves to exactly one
|
|
7
|
+
* rendered element. A delivered message never carries it.
|
|
8
|
+
*/
|
|
9
|
+
declare const INSTANCE_PATH_ATTRIBUTE = "data-samva-instance";
|
|
10
|
+
/** Where one element sits in the emitted document, with the authoring that produced it. */
|
|
11
|
+
interface EmittedPosition {
|
|
12
|
+
readonly start: number;
|
|
13
|
+
readonly end: number;
|
|
14
|
+
readonly origins: ReadonlyArray<JsxSourceLocation>;
|
|
15
|
+
/**
|
|
16
|
+
* Dot-separated element indices from the document root, assigned in document order. It is the
|
|
17
|
+
* identity of one rendered instance.
|
|
18
|
+
*/
|
|
19
|
+
readonly instancePath: string;
|
|
20
|
+
readonly tag: string;
|
|
21
|
+
/** False when a compiler primitive generated this element. */
|
|
22
|
+
readonly authored: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** One rendered element, and the authoring it came from. */
|
|
25
|
+
interface EmailElementSelection {
|
|
26
|
+
/**
|
|
27
|
+
* Dot-separated element indices from the document root. It is the identity of one rendered
|
|
28
|
+
* instance, which is what tells two iterations of the same authored element apart: their
|
|
29
|
+
* origins are identical.
|
|
30
|
+
*/
|
|
31
|
+
readonly instancePath: string;
|
|
32
|
+
readonly tag: string;
|
|
33
|
+
/**
|
|
34
|
+
* The authored JSX element. Empty when the compiler generated this element with no authoring
|
|
35
|
+
* behind it, the hidden preheader block for instance.
|
|
36
|
+
*/
|
|
37
|
+
readonly origins: ReadonlyArray<JsxSourceLocation>;
|
|
38
|
+
/**
|
|
39
|
+
* False when a compiler primitive generated this element. `origins[0]` is then the authoring
|
|
40
|
+
* element that asked for it rather than this element itself, so the wrapper selects the
|
|
41
|
+
* primitive the author wrote.
|
|
42
|
+
*/
|
|
43
|
+
readonly authored: boolean;
|
|
44
|
+
/** 1-based position among the rendered elements sharing this origin and tag. */
|
|
45
|
+
readonly occurrence: number;
|
|
46
|
+
/**
|
|
47
|
+
* How many rendered elements share that origin and tag. Above one, one piece of authoring
|
|
48
|
+
* produced several rendered elements (a loop, or a primitive that generates a repeated cell),
|
|
49
|
+
* so an edit there changes all of them.
|
|
50
|
+
*/
|
|
51
|
+
readonly occurrences: number;
|
|
52
|
+
/** Absent for the document root. */
|
|
53
|
+
readonly parentPath?: string;
|
|
54
|
+
/** Offset range in the rendered HTML this selection was taken from. */
|
|
55
|
+
readonly start: number;
|
|
56
|
+
readonly end: number;
|
|
57
|
+
}
|
|
58
|
+
/** A render of one fixture for an editor: the delivered content plus the identity of every element. */
|
|
59
|
+
interface EmailPreview {
|
|
60
|
+
readonly subject: string;
|
|
61
|
+
readonly preheader: string | undefined;
|
|
62
|
+
/** Carries `INSTANCE_PATH_ATTRIBUTE` on every element. Preview-only. */
|
|
63
|
+
readonly html: string;
|
|
64
|
+
readonly text: string;
|
|
65
|
+
/** Every rendered element in document order. */
|
|
66
|
+
readonly selections: readonly EmailElementSelection[];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Turn one render's positions into selections, in document order. `occurrence` and `occurrences`
|
|
70
|
+
* count the rendered elements that share an authored origin and tag.
|
|
71
|
+
*/
|
|
72
|
+
declare const emailSelections: (positions: readonly EmittedPosition[]) => readonly EmailElementSelection[];
|
|
73
|
+
/**
|
|
74
|
+
* Render one fixture with an instance path stamped on every element, and the selection each path
|
|
75
|
+
* resolves to. The selections come from the spans the compiler recorded, so a click on the canvas
|
|
76
|
+
* lands on the exact node of the source that produced it.
|
|
77
|
+
*/
|
|
78
|
+
declare const previewEmail: (template: CompiledTemplate, input: unknown, options?: {
|
|
79
|
+
readonly locale?: string | undefined;
|
|
80
|
+
readonly timeZone?: string | undefined;
|
|
81
|
+
readonly brandPlugin?: BrandPlugin | undefined;
|
|
82
|
+
}) => EmailPreview;
|
|
83
|
+
/** Look selections up by the instance path a rendered document carries. */
|
|
84
|
+
declare const emailSelectionIndex: (selections: readonly EmailElementSelection[]) => ReadonlyMap<string, EmailElementSelection>;
|
|
85
|
+
/**
|
|
86
|
+
* The authoring element a selection edits. For an authored element that is the element itself; for
|
|
87
|
+
* a generated wrapper it is the primitive that asked for it. Undefined only where the compiler
|
|
88
|
+
* generated markup with no authoring behind it, which nothing can edit in place.
|
|
89
|
+
*/
|
|
90
|
+
declare const emailAuthoringTarget: (selection: EmailElementSelection) => JsxSourceLocation | undefined;
|
|
91
|
+
/** Root-first ancestry of a selection, itself last. */
|
|
92
|
+
declare const emailSelectionAncestry: (index: ReadonlyMap<string, EmailElementSelection>, instancePath: string) => readonly EmailElementSelection[];
|
|
93
|
+
/**
|
|
94
|
+
* Every rendered instance produced by the same authored element, in document order. One entry
|
|
95
|
+
* means it rendered once; several mean it repeated.
|
|
96
|
+
*/
|
|
97
|
+
declare const emailSelectionSiblings: (selections: readonly EmailElementSelection[], selection: EmailElementSelection) => readonly EmailElementSelection[];
|
|
98
|
+
/**
|
|
99
|
+
* Every rendered instance of the same authored element. A partial edited at its definition changes
|
|
100
|
+
* all of these, which is the scope a control has to name before it applies.
|
|
101
|
+
*/
|
|
102
|
+
declare const emailDefinitionInstances: (selections: readonly EmailElementSelection[], selection: EmailElementSelection) => readonly EmailElementSelection[];
|
|
103
|
+
//#endregion
|
|
104
|
+
export { emailAuthoringTarget as a, emailSelectionIndex as c, previewEmail as d, INSTANCE_PATH_ATTRIBUTE as i, emailSelectionSiblings as l, EmailPreview as n, emailDefinitionInstances as o, EmittedPosition as r, emailSelectionAncestry as s, EmailElementSelection as t, emailSelections as u };
|