@drskillissue/ganko 0.1.24 → 0.1.26

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.
@@ -30730,6 +30730,19 @@ function formatAlignmentCauses(findings) {
30730
30730
  }
30731
30731
  return out;
30732
30732
  }
30733
+ function formatPrimaryFix(findings) {
30734
+ if (findings.length === 0) return "";
30735
+ let best = null;
30736
+ for (let i = 0; i < findings.length; i++) {
30737
+ const finding = findings[i];
30738
+ if (!finding) continue;
30739
+ if (best === null || finding.weight > best.weight) {
30740
+ best = finding;
30741
+ }
30742
+ }
30743
+ if (best === null) return "";
30744
+ return best.fix;
30745
+ }
30733
30746
  function compareAscii(left, right) {
30734
30747
  if (left < right) return -1;
30735
30748
  if (left > right) return 1;
@@ -34113,9 +34126,6 @@ var COMPOSITION_LABELS = {
34113
34126
  [4 /* BlockSegmented */]: "block-segmented",
34114
34127
  [5 /* Unknown */]: "unknown"
34115
34128
  };
34116
- function formatCompositionClassification(classification) {
34117
- return COMPOSITION_LABELS[classification];
34118
- }
34119
34129
  function formatCompositionFixSuggestion(subjectFingerprint) {
34120
34130
  if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
34121
34131
  if (subjectFingerprint.hasVerticalAlignMitigation) {
@@ -37794,6 +37804,7 @@ function buildFindingsFromAtoms(atoms, input, evidence) {
37794
37804
  const next = {
37795
37805
  kind: factor.kind,
37796
37806
  message: factor.message,
37807
+ fix: factor.fix,
37797
37808
  weight
37798
37809
  };
37799
37810
  const existing = byKind.get(factor.kind);
@@ -37807,48 +37818,48 @@ function buildFindingsFromAtoms(atoms, input, evidence) {
37807
37818
  }
37808
37819
  return [...byKind.values()];
37809
37820
  }
37810
- function toFindingFactor(factorId, input, evidence) {
37821
+ function toFindingFactor(factorId, input, _evidence) {
37811
37822
  switch (factorId) {
37812
37823
  case "offset-delta":
37813
37824
  return {
37814
37825
  kind: "offset-delta",
37815
- message: "explicit block-axis offset differs from sibling cohort"
37826
+ message: "block-axis offset differs from siblings",
37827
+ fix: "normalize margin/padding to match sibling cohort"
37816
37828
  };
37817
37829
  case "declared-offset-delta":
37818
37830
  return {
37819
37831
  kind: "declared-offset-delta",
37820
- message: "declared block-axis offset differs from sibling cohort"
37832
+ message: "declared block-axis offset differs from siblings",
37833
+ fix: "remove or unify the offset"
37821
37834
  };
37822
37835
  case "baseline-conflict":
37823
37836
  return {
37824
37837
  kind: "baseline-conflict",
37825
- message: "baseline/line-height signals conflict between siblings"
37838
+ message: "baseline/line-height mismatch between siblings",
37839
+ fix: "unify line-height or add vertical-align"
37826
37840
  };
37827
37841
  case "context-conflict":
37828
37842
  return {
37829
37843
  kind: "context-conflict",
37830
- message: "container and child alignment settings conflict"
37844
+ message: "container and child alignment conflict",
37845
+ fix: "check align-items on the parent"
37831
37846
  };
37832
37847
  case "replaced-control-risk":
37833
37848
  return {
37834
37849
  kind: "replaced-control-risk",
37835
- message: "replaced/control baseline behavior differs from neighboring text"
37850
+ message: "replaced element baseline differs from text siblings",
37851
+ fix: "add vertical-align: middle to the replaced element"
37836
37852
  };
37837
37853
  case "content-composition-conflict":
37838
37854
  return {
37839
37855
  kind: "content-composition-conflict",
37840
- message: formatContentCompositionFinding(input, evidence)
37856
+ message: "content composition differs from siblings",
37857
+ fix: formatCompositionFixSuggestion(input.subjectContentComposition)
37841
37858
  };
37842
37859
  default:
37843
37860
  return null;
37844
37861
  }
37845
37862
  }
37846
- function formatContentCompositionFinding(input, evidence) {
37847
- const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
37848
- const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
37849
- const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
37850
- return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
37851
- }
37852
37863
  function round(value2) {
37853
37864
  return Math.round(value2 * 1e3) / 1e3;
37854
37865
  }
@@ -38618,7 +38629,7 @@ var jsxStylePolicy = defineCrossRule({
38618
38629
 
38619
38630
  // src/cross-file/rules/css-layout-sibling-alignment-outlier.ts
38620
38631
  var messages143 = {
38621
- misalignedSibling: "Element '{{subject}}' appears vertically misaligned relative to sibling cohort in '{{parent}}' (context {{context}}, severity {{severity}}, confidence {{confidence}}{{offsetClause}}; causes: {{causes}})."
38632
+ misalignedSibling: "Vertically misaligned '{{subject}}' in '{{parent}}'.{{fix}}{{offsetClause}}"
38622
38633
  };
38623
38634
  var MIN_CONFIDENCE_THRESHOLD = 0.48;
38624
38635
  var MIN_OFFSET_PX_THRESHOLD = 2;
@@ -38643,6 +38654,7 @@ var siblingAlignmentDetector = {
38643
38654
  severity: decision.evaluation.severity,
38644
38655
  confidence: decision.evaluation.confidence,
38645
38656
  causes: formatAlignmentCauses(decision.evaluation.signalFindings),
38657
+ primaryFix: formatPrimaryFix(decision.evaluation.signalFindings),
38646
38658
  contextKind: decision.evaluation.contextKind,
38647
38659
  contextCertainty: decision.evaluation.contextCertainty,
38648
38660
  estimatedOffsetPx: decision.evaluation.estimatedOffsetPx,
@@ -38725,8 +38737,11 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
38725
38737
  const confidence = formatFixed(detection.evidence.confidence);
38726
38738
  const offset = detection.evidence.estimatedOffsetPx;
38727
38739
  const hasOffset = offset !== null && Math.abs(offset) > 0.25;
38728
- const offsetClause = hasOffset ? `, estimated offset ${formatFixed(offset)}px` : "";
38740
+ const offsetClause = hasOffset ? ` Estimated offset: ${formatFixed(offset)}px.` : "";
38729
38741
  const causes = detection.evidence.causes.length === 0 ? "alignment signals indicate an outlier" : detection.evidence.causes.join("; ");
38742
+ const primaryFix = detection.evidence.primaryFix;
38743
+ const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
38744
+ const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
38730
38745
  if (log.enabled) {
38731
38746
  log.debug(
38732
38747
  `${logPrefix} EMIT: severity=${severity} confidence=${confidence} offset=${offset?.toFixed(2) ?? "null"} posterior=[${detection.evidence.posteriorLower.toFixed(3)},${detection.evidence.posteriorUpper.toFixed(3)}] evidenceMass=${detection.evidence.evidenceMass.toFixed(3)} topFactors=[${detection.evidence.topFactors.join(",")}] causes=[${causes}]`
@@ -38741,11 +38756,8 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
38741
38756
  resolveMessage(messages143.misalignedSibling, {
38742
38757
  subject,
38743
38758
  parent,
38744
- context: detection.evidence.contextKind,
38745
- severity,
38746
- confidence,
38747
- offsetClause,
38748
- causes
38759
+ fix,
38760
+ offsetClause
38749
38761
  }),
38750
38762
  "warn"
38751
38763
  )