@samva/markup 0.18.1 → 0.19.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.
Files changed (54) hide show
  1. package/AGENTS.md +11 -4
  2. package/CHANGELOG.md +36 -0
  3. package/README.md +89 -5
  4. package/dist/assets-BSpgZOSR.js +61 -0
  5. package/dist/assets-k7_v3IOJ.d.ts +39 -0
  6. package/dist/{assets-CS5Xa_mr.d.ts → brand-Bxb6Sm7y.d.ts} +34 -41
  7. package/dist/brand.d.ts +2 -2
  8. package/dist/brand.js +3 -3
  9. package/dist/compatibility.d.ts +15 -5
  10. package/dist/compatibility.js +48 -5
  11. package/dist/compile-C1GWLQ5C.js +490 -0
  12. package/dist/compile-CIeuGmP-.d.ts +98 -0
  13. package/dist/{compiled-template-Bc4Dq9zy.d.ts → compiled-template-CPDHvFlt.d.ts} +157 -6
  14. package/dist/compiler.d.ts +4 -89
  15. package/dist/compiler.js +8 -486
  16. package/dist/components-DNBCz20_.js +3267 -0
  17. package/dist/{css-color-DLM12Osu.js → dark-scheme-BGDCCaUq.js} +12 -1
  18. package/dist/{diagnostic-codes-DZKb0Xcg.js → diagnostic-codes-BCwfUgnF.js} +33 -36
  19. package/dist/diagnostic-model-DJtqbETd.js +36 -0
  20. package/dist/{diagnostics-D4vSLQrO.d.ts → diagnostics-C3TSx6SU.d.ts} +22 -2
  21. package/dist/diagnostics.d.ts +33 -1
  22. package/dist/diagnostics.js +2 -1
  23. package/dist/edit.d.ts +15 -4
  24. package/dist/edit.js +67 -4
  25. package/dist/email/jsx-dev-runtime.d.ts +2 -2
  26. package/dist/email/jsx-runtime.d.ts +1 -1
  27. package/dist/email.d.ts +6 -2
  28. package/dist/email.js +6 -2
  29. package/dist/index.d.ts +1 -1
  30. package/dist/{jsx-runtime-DL8NVF1f.d.ts → jsx-runtime-HHfrVZEf.d.ts} +1 -2
  31. package/dist/markdown.d.ts +69 -0
  32. package/dist/markdown.js +95 -0
  33. package/dist/parse-Bex7QFqj.js +921 -0
  34. package/dist/{preview-rNoJBEIY.d.ts → preview-DRLWgmfg.d.ts} +3 -3
  35. package/dist/profile-DFk4gs7o.js +56 -0
  36. package/dist/{profile-JTvgCD6X.js → project-B6D64SZS.js} +497 -234
  37. package/dist/render.d.ts +8 -8
  38. package/dist/render.js +1 -2
  39. package/dist/{css-B_aVKrDo.js → selectors-CKGuc9MO.js} +158 -4
  40. package/dist/sms.d.ts +1 -1
  41. package/dist/{template-DmNcoH4Q.d.ts → template-4Dse7_OC.d.ts} +1 -1
  42. package/dist/{theme-css-P9F5S7Ic.js → theme-css-BujDuuEA.js} +1 -2
  43. package/dist/whatsapp.d.ts +1 -1
  44. package/generated/contract.json +41 -1
  45. package/generated/reference.md +97 -89
  46. package/package.json +15 -4
  47. package/dist/brand-CIiEqkU7.js +0 -193
  48. package/dist/brand-plugin-Dj9SMpfS.d.ts +0 -33
  49. package/dist/components-C5850-Qg.js +0 -409
  50. package/dist/dark-scheme-CbCwGDWH.js +0 -12
  51. package/dist/html-DJUK2YJF.js +0 -483
  52. package/dist/render-template-DwPDm3Hq.js +0 -1226
  53. package/dist/selectors-CYWCoxZr.js +0 -157
  54. package/dist/source-locations-C8wCsiAy.d.ts +0 -22
@@ -1,6 +1,6 @@
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";
1
+ import { m as BrandPlugin } from "./brand-Bxb6Sm7y.js";
2
+ import { l as JsxSourceLocation } from "./diagnostics-C3TSx6SU.js";
3
+ import { v as CompiledTemplate } from "./compiled-template-CPDHvFlt.js";
4
4
  //#region src/preview.d.ts
5
5
  /**
6
6
  * The attribute a preview stamps so a click in a rendered document resolves to exactly one
@@ -0,0 +1,56 @@
1
+ import { et as samvaBrandPlugin } from "./components-DNBCz20_.js";
2
+ import { r as lowerProject, t as loadProject, u as Findings } from "./project-B6D64SZS.js";
3
+ //#region src/sml/profile.ts
4
+ const DEFAULT_ENTRY = "template.tsx";
5
+ /** A stand-in base: a structural check has no build, and an imported asset must read as a project asset. */
6
+ const ASSET_BASE = "https://assets.invalid";
7
+ /** Findings that come from the inputs this check leaves out, not from the source. */
8
+ const MISSING_INPUT_CODES = /* @__PURE__ */ new Set(["brand-unavailable", "unmatched-class"]);
9
+ const asFiles = (files, entry) => typeof files === "string" ? { [entry]: files } : files;
10
+ /**
11
+ * Check an entry against the static profile. Pass the entry's source alone, or the project's files
12
+ * and the entry's path. Imports of files that are absent are trusted to exist, and the brand,
13
+ * Tailwind and theme are not resolved, so the result holds only findings the source itself owns.
14
+ */
15
+ const checkTemplate = (files, options = {}) => {
16
+ const entry = options.entry ?? DEFAULT_ENTRY;
17
+ const brandPlugin = options.brandPlugin ?? samvaBrandPlugin;
18
+ const findings = new Findings();
19
+ const project = loadProject(asFiles(files, entry), entry, findings, {
20
+ brandPlugin,
21
+ lenient: true
22
+ });
23
+ if (project === void 0) return findings.items;
24
+ lowerProject({
25
+ entry,
26
+ brand: void 0,
27
+ brandPlugin,
28
+ assetBase: ASSET_BASE
29
+ }, project, findings, {
30
+ assets: [],
31
+ stylesheets: /* @__PURE__ */ new Map(),
32
+ tailwindSheet: void 0,
33
+ urlFor: (path) => `${ASSET_BASE}/${path}`
34
+ });
35
+ const unresolved = [...project.unresolved];
36
+ return findings.items.filter((item) => !MISSING_INPUT_CODES.has(item.code) && !item.code.startsWith("tailwind-") && !unresolved.some((name) => item.message.includes(`<${name}`) || item.message.includes(`\`${name}\``)));
37
+ };
38
+ const key = (item) => `${item.code}\0${item.message}`;
39
+ /**
40
+ * The errors in `after` that `before` did not already have, compared by code and message so a
41
+ * finding that only moved does not count as new.
42
+ */
43
+ const introducedErrors = (before, after) => {
44
+ const known = /* @__PURE__ */ new Map();
45
+ for (const item of before) if (item.severity === "error") known.set(key(item), (known.get(key(item)) ?? 0) + 1);
46
+ const added = [];
47
+ for (const item of after) {
48
+ if (item.severity !== "error") continue;
49
+ const remaining = known.get(key(item)) ?? 0;
50
+ if (remaining > 0) known.set(key(item), remaining - 1);
51
+ else added.push(item);
52
+ }
53
+ return added;
54
+ };
55
+ //#endregion
56
+ export { introducedErrors as n, checkTemplate as t };