@samva/markup 0.8.0 → 0.9.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 +90 -37
- package/README.md +188 -52
- package/dist/assets-C5duwTya.d.ts +40 -0
- package/dist/{brand-DcoVkh_S.d.ts → brand-B-0bN_Ir.d.ts} +2 -2
- package/dist/{render-vAv_4r9v.js → cascade-t6kxlgEI.js} +93 -280
- package/dist/channel-edit.d.ts +121 -0
- package/dist/channel-edit.js +609 -0
- package/dist/channel-specs-B6M_HlaV.js +29 -0
- package/dist/channel-specs-C2feJwuP.d.ts +13 -0
- package/dist/compatibility-DbISoFIq.js +589 -0
- package/dist/compiler.d.ts +10 -257
- package/dist/compiler.js +10 -730
- package/dist/{css-CS2jLID6.d.ts → css-BVQKICKC.d.ts} +3 -3
- package/dist/diagnostic-codes.d.ts +403 -0
- package/dist/diagnostic-codes.js +399 -0
- package/dist/{diagnostics-BMYtBCQk.d.ts → diagnostics-B-Gym34R.d.ts} +8 -4
- package/dist/diagnostics.d.ts +31 -2
- package/dist/diagnostics.js +1 -19
- package/dist/{elements-BzjjnoCS.d.ts → elements-cqldpaJt.d.ts} +3 -3
- package/dist/email/assets.d.ts +2 -40
- package/dist/email/brand-footer.d.ts +2 -2
- package/dist/email/brand-footer.js +4 -3
- package/dist/email/brand.d.ts +1 -1
- package/dist/email/brand.js +1 -1
- package/dist/email/components.d.ts +21 -10
- package/dist/email/components.js +46 -11
- package/dist/email/diagnostics.d.ts +2 -2
- package/dist/email/diagnostics.js +2 -1
- package/dist/email/elements.d.ts +1 -1
- package/dist/email/html.d.ts +2 -2
- package/dist/email/html.js +45 -2
- package/dist/email/jsx-dev-runtime.d.ts +2 -2
- package/dist/email/jsx-runtime.d.ts +1 -1
- package/dist/email/render.d.ts +8 -18
- package/dist/email/render.js +163 -3
- package/dist/email/text.d.ts +1 -1
- package/dist/fmt.d.ts +32 -0
- package/dist/fmt.js +174 -0
- package/dist/{html-Bl9BAdqc.d.ts → html-BJepOwZ4.d.ts} +19 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/ir-aaqNE987.d.ts +252 -0
- package/dist/ir.d.ts +2 -0
- package/dist/ir.js +7 -0
- package/dist/preview-Ekdg1dXG.d.ts +100 -0
- package/dist/preview.d.ts +2 -0
- package/dist/preview.js +160 -0
- package/dist/profile-BH-OtdDA.js +3670 -0
- package/dist/render-ir.d.ts +19 -0
- package/dist/render-ir.js +826 -0
- package/dist/sms-segments.d.ts +13 -2
- package/dist/sms.d.ts +16 -0
- package/dist/sms.js +12 -0
- package/dist/{email/source-edit.d.ts → source-edit.d.ts} +55 -6
- package/dist/source-edit.js +343 -0
- package/dist/source-locations-C8wCsiAy.d.ts +23 -0
- package/dist/source-locations.d.ts +2 -2
- package/dist/source-locations.js +3 -89
- package/dist/static.d.ts +57 -0
- package/dist/static.js +69 -0
- package/dist/tailwind-CMYpZf1v.js +614 -0
- package/dist/template-_QE_rQND.d.ts +65 -0
- package/dist/template.d.ts +2 -2
- package/dist/template.js +15 -10
- package/dist/theme-css.d.ts +1 -1
- package/dist/theme-imports-lvBw3AD1.js +109 -0
- package/dist/transform-Ct2OMkFN.d.ts +153 -0
- package/dist/whatsapp.d.ts +57 -0
- package/dist/whatsapp.js +22 -0
- package/generated/contract.json +1782 -0
- package/generated/reference.md +353 -0
- package/package.json +41 -151
- package/skills/sml/SKILL.md +123 -0
- package/dist/ast-BrDtApwS.d.ts +0 -107
- package/dist/ast.d.ts +0 -2
- package/dist/ast.js +0 -124
- package/dist/candidate.d.ts +0 -29
- package/dist/candidate.js +0 -88
- package/dist/catalog-CKuOooB8.d.ts +0 -354
- package/dist/checks-D73Xizbw.js +0 -59366
- package/dist/checks.d.ts +0 -33
- package/dist/checks.js +0 -2
- package/dist/classes.d.ts +0 -26
- package/dist/classes.js +0 -184
- package/dist/compile-sms.d.ts +0 -28
- package/dist/compile-sms.js +0 -44
- package/dist/compile-whatsapp.d.ts +0 -56
- package/dist/compile-whatsapp.js +0 -186
- package/dist/compile.d.ts +0 -18
- package/dist/compile.js +0 -29
- package/dist/components.d.ts +0 -289
- package/dist/components.js +0 -106
- package/dist/conditionals.d.ts +0 -10
- package/dist/conditionals.js +0 -74
- package/dist/corpus-CPPfgAHN.d.ts +0 -106
- package/dist/diagnostics-OcQKQYSY.d.ts +0 -49
- package/dist/email/selection.d.ts +0 -2
- package/dist/email/selection.js +0 -91
- package/dist/email/source-edit.js +0 -185
- package/dist/email/stylesheets.d.ts +0 -15
- package/dist/email/stylesheets.js +0 -48
- package/dist/emit.d.ts +0 -51
- package/dist/emit.js +0 -151
- package/dist/interpolate.d.ts +0 -24
- package/dist/interpolate.js +0 -43
- package/dist/jsx-dev-runtime.d.ts +0 -11
- package/dist/jsx-dev-runtime.js +0 -15
- package/dist/jsx-runtime-I-1nCtl2.d.ts +0 -57
- package/dist/jsx-runtime.d.ts +0 -2
- package/dist/jsx-runtime.js +0 -121
- package/dist/lexer.d.ts +0 -60
- package/dist/lexer.js +0 -281
- package/dist/model.d.ts +0 -24
- package/dist/model.js +0 -77
- package/dist/ops-BvwqHl7V.js +0 -630
- package/dist/ops.d.ts +0 -114
- package/dist/ops.js +0 -2
- package/dist/parser-t29cHLVL.d.ts +0 -396
- package/dist/parser.d.ts +0 -2
- package/dist/parser.js +0 -859
- package/dist/predicate-BI6uRRM-.js +0 -549
- package/dist/predicate-M-05Nd7R.d.ts +0 -56
- package/dist/predicate.d.ts +0 -2
- package/dist/predicate.js +0 -2
- package/dist/printer.d.ts +0 -6
- package/dist/printer.js +0 -122
- package/dist/registry-Dcp6QEK_.d.ts +0 -73
- package/dist/registry.d.ts +0 -2
- package/dist/registry.js +0 -646
- package/dist/render-template.d.ts +0 -45
- package/dist/render-template.js +0 -76
- package/dist/selection-CCArx9lU.d.ts +0 -91
- package/dist/showcase-egkusQBf.d.ts +0 -415
- package/dist/sms-segments-y4FpPilJ.d.ts +0 -13
- package/dist/source-locations-DrCM82Ym.d.ts +0 -67
- package/dist/starters/category-mapping.d.ts +0 -13
- package/dist/starters/category-mapping.js +0 -49
- package/dist/starters/corpus.d.ts +0 -2
- package/dist/starters/corpus.js +0 -194
- package/dist/starters/library.d.ts +0 -18
- package/dist/starters/library.js +0 -692
- package/dist/starters/public-gallery.d.ts +0 -266
- package/dist/starters/public-gallery.js +0 -916
- package/dist/starters/public-handoff.d.ts +0 -164
- package/dist/starters/public-handoff.js +0 -361
- package/dist/starters/public-preview-artifacts.d.ts +0 -43
- package/dist/starters/public-preview-artifacts.js +0 -104
- package/dist/starters/public-preview.d.ts +0 -61
- package/dist/starters/public-preview.js +0 -83
- package/dist/starters/showcase.d.ts +0 -2
- package/dist/starters/showcase.js +0 -335
- package/dist/starters/sources.d.ts +0 -45
- package/dist/starters/sources.js +0 -7762
- package/dist/starters/theme.d.ts +0 -45
- package/dist/starters/theme.js +0 -77
- package/dist/starters.d.ts +0 -2
- package/dist/starters.js +0 -874
- package/dist/tailwind-BYq7Lo6u.js +0 -727
- package/dist/template-DWftqh4x.d.ts +0 -60
- package/dist/tsx-source-instrumentation.d.ts +0 -30
- package/dist/tsx-source-instrumentation.js +0 -115
- package/dist/tsx-tracer.d.ts +0 -112
- package/dist/tsx-tracer.js +0 -985
- package/dist/variables-J_L3qxRa.d.ts +0 -77
- package/dist/variables.d.ts +0 -2
- package/dist/variables.js +0 -141
- package/dist/version-BITr58kk.js +0 -96
- package/generated/sml-agent-contract.json +0 -709
- package/generated/sml-email-agent-contract.json +0 -615
- package/generated/sml-email-language-reference.md +0 -94
- package/generated/sml-language-reference.md +0 -195
package/dist/static.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { a as TemplateDiagnostic, r as EmailDiagnostic } from "./diagnostics-B-Gym34R.js";
|
|
2
|
+
import { E as TemplateIr } from "./ir-aaqNE987.js";
|
|
3
|
+
import { g as EmailClientTarget, n as TransformOptions } from "./transform-Ct2OMkFN.js";
|
|
4
|
+
import "./css-BVQKICKC.js";
|
|
5
|
+
import { n as AssetEntry } from "./assets-C5duwTya.js";
|
|
6
|
+
//#region src/sml/lower-project.d.ts
|
|
7
|
+
interface CompiledTemplate {
|
|
8
|
+
/** The IR, or `undefined` when a finding blocks it. */
|
|
9
|
+
readonly ir: TemplateIr | undefined;
|
|
10
|
+
/** The fixtures read from the entry, with imported assets resolved to their URLs. */
|
|
11
|
+
readonly fixtures: Readonly<Record<string, unknown>>;
|
|
12
|
+
readonly assets: readonly AssetEntry[];
|
|
13
|
+
/** Errors block the IR; warnings ride along. */
|
|
14
|
+
readonly diagnostics: readonly TemplateDiagnostic[];
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/sml/compile.d.ts
|
|
18
|
+
interface CompileTemplateOptions extends TransformOptions {
|
|
19
|
+
/** The project's files by path. Binary files are addressed as assets. */
|
|
20
|
+
readonly files: Readonly<Record<string, string | Uint8Array>>;
|
|
21
|
+
/** The entry: a `.tsx` file that default-exports `defineTemplate({ ... })`. */
|
|
22
|
+
readonly entry: string;
|
|
23
|
+
/**
|
|
24
|
+
* The portable JSON Schema, for an entry whose `schema` is not a literal `jsonSchema(...)`
|
|
25
|
+
* (a Zod or Effect schema needs a library to become JSON Schema). A host that has evaluated the
|
|
26
|
+
* schema passes its conversion here; a literal schema is read from source and this is ignored.
|
|
27
|
+
*/
|
|
28
|
+
readonly schema?: Readonly<Record<string, unknown>> | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Compile a project's entry template to IR without evaluating any of it. */
|
|
31
|
+
declare const compileTemplate: (options: CompileTemplateOptions) => Promise<CompiledTemplate>;
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/sml/compatibility.d.ts
|
|
34
|
+
/**
|
|
35
|
+
* Check what each declared fixture delivers against the pinned client matrix. The rules run on the
|
|
36
|
+
* rendered document, because what a client drops is what the compiler produced, and every finding
|
|
37
|
+
* is located at the source of the element that produced it.
|
|
38
|
+
*/
|
|
39
|
+
declare const checkTemplateCompatibility: (ir: TemplateIr, fixtures: Readonly<Record<string, unknown>>, options?: {
|
|
40
|
+
readonly clients?: readonly EmailClientTarget[] | undefined;
|
|
41
|
+
}) => readonly EmailDiagnostic[];
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/sml/profile.d.ts
|
|
44
|
+
/**
|
|
45
|
+
* Check an entry against the static profile. Pass the entry's source alone, or the project's files
|
|
46
|
+
* and the entry's path. Imports of files that are absent are trusted to exist, and the brand,
|
|
47
|
+
* Tailwind and theme are not resolved, so the result holds only findings the source itself owns.
|
|
48
|
+
*/
|
|
49
|
+
declare const checkStaticProfile: (files: string | Readonly<Record<string, string | Uint8Array>>, entry?: string) => readonly TemplateDiagnostic[];
|
|
50
|
+
/**
|
|
51
|
+
* The errors in `after` that `before` did not already have, compared by code and message so a
|
|
52
|
+
* finding that only moved does not count as new.
|
|
53
|
+
*/
|
|
54
|
+
declare const introducedProfileErrors: (before: readonly TemplateDiagnostic[], after: readonly TemplateDiagnostic[]) => readonly TemplateDiagnostic[];
|
|
55
|
+
//#endregion
|
|
56
|
+
export { type CompileTemplateOptions, type CompiledTemplate, checkStaticProfile, checkTemplateCompatibility, compileTemplate, introducedProfileErrors };
|
|
57
|
+
//# sourceMappingURL=static.d.ts.map
|
package/dist/static.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { assetUrl } from "./email/assets.js";
|
|
2
|
+
import { EmailCompileError } from "./email/diagnostics.js";
|
|
3
|
+
import { c as transformProject, i as checkEmailCompatibility } from "./compatibility-DbISoFIq.js";
|
|
4
|
+
import { a as lowerProject, i as completed, n as introducedProfileErrors, o as Findings, r as loadProject, t as checkStaticProfile } from "./profile-BH-OtdDA.js";
|
|
5
|
+
import { renderIr } from "./render-ir.js";
|
|
6
|
+
//#region src/sml/compile.ts
|
|
7
|
+
/** Compile a project's entry template to IR without evaluating any of it. */
|
|
8
|
+
const compileTemplate = async (options) => {
|
|
9
|
+
const findings = new Findings();
|
|
10
|
+
const project = loadProject(options.files, options.entry, findings);
|
|
11
|
+
if (project === void 0) return completed(findings, void 0);
|
|
12
|
+
let transformed;
|
|
13
|
+
try {
|
|
14
|
+
transformed = await transformProject(options.files, options);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (!(error instanceof EmailCompileError)) throw error;
|
|
17
|
+
findings.items.push(...error.diagnostics);
|
|
18
|
+
return completed(findings, void 0);
|
|
19
|
+
}
|
|
20
|
+
findings.items.push(...transformed.diagnostics.filter((item) => item.code !== "tailwind-dynamic-class"));
|
|
21
|
+
const assetsByPath = new Map(transformed.assets.map((asset) => [asset.path, asset]));
|
|
22
|
+
return lowerProject(options, project, findings, {
|
|
23
|
+
assets: transformed.assets,
|
|
24
|
+
stylesheets: transformed.stylesheets,
|
|
25
|
+
tailwindSheet: transformed.tailwindSheet,
|
|
26
|
+
urlFor: (path) => {
|
|
27
|
+
const entry = assetsByPath.get(path);
|
|
28
|
+
return entry === void 0 ? void 0 : assetUrl(entry, options.assetBase);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/sml/compatibility.ts
|
|
34
|
+
/**
|
|
35
|
+
* Check what each declared fixture delivers against the pinned client matrix. The rules run on the
|
|
36
|
+
* rendered document, because what a client drops is what the compiler produced, and every finding
|
|
37
|
+
* is located at the source of the element that produced it.
|
|
38
|
+
*/
|
|
39
|
+
const checkTemplateCompatibility = (ir, fixtures, options = {}) => {
|
|
40
|
+
if (ir.email === void 0) return [];
|
|
41
|
+
const sources = ir.sources ?? [];
|
|
42
|
+
const findings = [];
|
|
43
|
+
for (const [fixture, input] of Object.entries(fixtures)) {
|
|
44
|
+
const rendered = renderIr(ir, input, { positions: true });
|
|
45
|
+
const positions = (rendered.positions ?? []).map((position, index) => ({
|
|
46
|
+
start: position.start,
|
|
47
|
+
end: position.end,
|
|
48
|
+
tag: position.tag,
|
|
49
|
+
instancePath: String(index),
|
|
50
|
+
authored: true,
|
|
51
|
+
origins: position.src === void 0 ? [] : [{
|
|
52
|
+
fileName: sources[position.src[2] ?? 0] ?? "",
|
|
53
|
+
lineNumber: position.src[0],
|
|
54
|
+
columnNumber: position.src[1]
|
|
55
|
+
}]
|
|
56
|
+
}));
|
|
57
|
+
findings.push(...checkEmailCompatibility({
|
|
58
|
+
html: rendered.html,
|
|
59
|
+
fixture,
|
|
60
|
+
positions,
|
|
61
|
+
...options.clients === void 0 ? {} : { clients: options.clients }
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
return findings;
|
|
65
|
+
};
|
|
66
|
+
//#endregion
|
|
67
|
+
export { checkStaticProfile, checkTemplateCompatibility, compileTemplate, introducedProfileErrors };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=static.js.map
|