@decocms/parity 0.26.16 → 0.26.17

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 (2) hide show
  1. package/dist/cli.js +28 -16
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -67589,11 +67589,17 @@ function esc3(s) {
67589
67589
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
67590
67590
  }
67591
67591
  function L2(pt, en, lang) {
67592
+ if (!pt.trim() || !en.trim()) {
67593
+ throw new Error(`deck i18n: both locales required, got pt=${JSON.stringify(pt)} en=${JSON.stringify(en)}. Use same("...") when one string serves both.`);
67594
+ }
67592
67595
  const initial = lang === "pt" ? pt : en;
67593
67596
  return `<span class="i18n" data-pt="${esc3(pt)}" data-en="${esc3(en)}">${esc3(initial)}</span>`;
67594
67597
  }
67598
+ function T(text3, lang) {
67599
+ return L2(text3.pt, text3.en, lang);
67600
+ }
67595
67601
  function tiles(items, lang) {
67596
- const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div>` + `<div class="tile-label">${esc3(t.label)}</div>` + `<div class="tile-sub">${esc3(t.sub)}</div></div>`).join("");
67602
+ const cells = items.map((t) => `<div class="tile"><div class="tile-val ${TONE_CLASS[t.tone]}">${esc3(t.value)}</div><div class="tile-label">${T(t.label, lang)}</div>${t.sub ? `<div class="tile-sub">${T(t.sub, lang)}</div>` : ""}</div>`).join("");
67597
67603
  return `<div class="stat-grid">${cells}</div>`;
67598
67604
  }
67599
67605
  function page(eyebrow, title, body, note) {
@@ -67614,7 +67620,7 @@ function findingsTable(findings, omitted, lang) {
67614
67620
  return `<tr><td><span class="pill ${pill}">${esc3(f.severity)}</span>${badge}</td><td>${esc3(f.category)}</td><td>${esc3(f.summary)}</td></tr>`;
67615
67621
  }).join("");
67616
67622
  const tail = omitted > 0 ? `<p class="annotation">${L2(`+${omitted} achado(s) além dos mostrados — veja report.json.`, `+${omitted} more finding(s) beyond those shown — see report.json.`, lang)}</p>` : "";
67617
- return `<table class="grid compact"><thead><tr><th>Sev</th><th>${L2("Categoria", "Category", lang)}</th><th>${L2("Achado", "Finding", lang)}</th></tr></thead><tbody>${rows}</tbody></table>${tail}`;
67623
+ return `<table class="grid compact"><thead><tr><th>${L2("Sev", "Sev", lang)}</th><th>${L2("Categoria", "Category", lang)}</th><th>${L2("Achado", "Finding", lang)}</th></tr></thead><tbody>${rows}</tbody></table>${tail}`;
67618
67624
  }
67619
67625
  function renderDeckHtml(model, lang = "en") {
67620
67626
  const pages = [];
@@ -67639,20 +67645,20 @@ function renderDeckHtml(model, lang = "en") {
67639
67645
  pages.push(page(L2("Visual", "Visual", lang), L2("Paridade visual", "Visual parity", lang), tiles([
67640
67646
  {
67641
67647
  value: String(model.visual.pagesChecked),
67642
- label: "páginas comparadas",
67643
- sub: "",
67648
+ label: { pt: "páginas comparadas", en: "pages compared" },
67649
+ sub: null,
67644
67650
  tone: "neutral"
67645
67651
  },
67646
67652
  {
67647
67653
  value: String(model.visual.pagesPassed),
67648
- label: "sem diferenças",
67649
- sub: "",
67654
+ label: { pt: "sem diferenças", en: "no differences" },
67655
+ sub: null,
67650
67656
  tone: "good"
67651
67657
  },
67652
67658
  {
67653
67659
  value: String(model.visual.pagesWithDiffs),
67654
- label: "com diferenças",
67655
- sub: "",
67660
+ label: { pt: "com diferenças", en: "with differences" },
67661
+ sub: null,
67656
67662
  tone: model.visual.pagesWithDiffs > 0 ? "warn" : "good"
67657
67663
  }
67658
67664
  ], lang)));
@@ -67684,6 +67690,9 @@ function hostOf4(raw) {
67684
67690
  }
67685
67691
 
67686
67692
  // src/report/deck-model.ts
67693
+ function same(text3) {
67694
+ return { pt: text3, en: text3 };
67695
+ }
67687
67696
  var MAX_FINDINGS = 12;
67688
67697
  function toneForStatus(status) {
67689
67698
  if (status === "pass")
@@ -67713,26 +67722,29 @@ function buildDeckModel(run) {
67713
67722
  headline: [
67714
67723
  {
67715
67724
  value: `${v.score}/100`,
67716
- label: "score parity",
67717
- sub: v.pagesAnalyzed ? `${v.pagesAnalyzed} páginas analisadas` : "",
67725
+ label: { pt: "score parity", en: "parity score" },
67726
+ sub: v.pagesAnalyzed ? {
67727
+ pt: `${v.pagesAnalyzed} páginas analisadas`,
67728
+ en: `${v.pagesAnalyzed} pages analyzed`
67729
+ } : null,
67718
67730
  tone: toneForStatus(v.status)
67719
67731
  },
67720
67732
  {
67721
67733
  value: String(v.critical),
67722
- label: "critical",
67723
- sub: "bloqueiam launch",
67734
+ label: same("critical"),
67735
+ sub: { pt: "bloqueiam launch", en: "block launch" },
67724
67736
  tone: v.critical > 0 ? "bad" : "good"
67725
67737
  },
67726
67738
  {
67727
67739
  value: String(v.high),
67728
- label: "high",
67729
- sub: "corrigir antes de produção",
67740
+ label: same("high"),
67741
+ sub: { pt: "corrigir antes de produção", en: "fix before production" },
67730
67742
  tone: v.high > 0 ? "warn" : "good"
67731
67743
  },
67732
67744
  {
67733
67745
  value: `${v.checksPassed}/${v.checksRun}`,
67734
- label: "checks passados",
67735
- sub: v.checksSkipped > 0 ? `${v.checksSkipped} pulados` : "",
67746
+ label: { pt: "checks passados", en: "checks passed" },
67747
+ sub: v.checksSkipped > 0 ? { pt: `${v.checksSkipped} pulados`, en: `${v.checksSkipped} skipped` } : null,
67736
67748
  tone: v.checksFailed > 0 ? "bad" : "good"
67737
67749
  }
67738
67750
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.26.16",
3
+ "version": "0.26.17",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",