@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.
@@ -34354,9 +34354,6 @@ var COMPOSITION_LABELS = {
34354
34354
  [4 /* BlockSegmented */]: "block-segmented",
34355
34355
  [5 /* Unknown */]: "unknown"
34356
34356
  };
34357
- function formatCompositionClassification(classification) {
34358
- return COMPOSITION_LABELS[classification];
34359
- }
34360
34357
  function formatCompositionFixSuggestion(subjectFingerprint) {
34361
34358
  if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
34362
34359
  if (subjectFingerprint.hasVerticalAlignMitigation) {
@@ -37349,6 +37346,19 @@ function formatAlignmentCauses(findings) {
37349
37346
  }
37350
37347
  return out;
37351
37348
  }
37349
+ function formatPrimaryFix(findings) {
37350
+ if (findings.length === 0) return "";
37351
+ let best = null;
37352
+ for (let i = 0; i < findings.length; i++) {
37353
+ const finding = findings[i];
37354
+ if (!finding) continue;
37355
+ if (best === null || finding.weight > best.weight) {
37356
+ best = finding;
37357
+ }
37358
+ }
37359
+ if (best === null) return "";
37360
+ return best.fix;
37361
+ }
37352
37362
  function compareAscii(left, right) {
37353
37363
  if (left < right) return -1;
37354
37364
  if (left > right) return 1;
@@ -38073,6 +38083,7 @@ function buildFindingsFromAtoms(atoms, input, evidence) {
38073
38083
  const next = {
38074
38084
  kind: factor.kind,
38075
38085
  message: factor.message,
38086
+ fix: factor.fix,
38076
38087
  weight
38077
38088
  };
38078
38089
  const existing = byKind.get(factor.kind);
@@ -38086,48 +38097,48 @@ function buildFindingsFromAtoms(atoms, input, evidence) {
38086
38097
  }
38087
38098
  return [...byKind.values()];
38088
38099
  }
38089
- function toFindingFactor(factorId, input, evidence) {
38100
+ function toFindingFactor(factorId, input, _evidence) {
38090
38101
  switch (factorId) {
38091
38102
  case "offset-delta":
38092
38103
  return {
38093
38104
  kind: "offset-delta",
38094
- message: "explicit block-axis offset differs from sibling cohort"
38105
+ message: "block-axis offset differs from siblings",
38106
+ fix: "normalize margin/padding to match sibling cohort"
38095
38107
  };
38096
38108
  case "declared-offset-delta":
38097
38109
  return {
38098
38110
  kind: "declared-offset-delta",
38099
- message: "declared block-axis offset differs from sibling cohort"
38111
+ message: "declared block-axis offset differs from siblings",
38112
+ fix: "remove or unify the offset"
38100
38113
  };
38101
38114
  case "baseline-conflict":
38102
38115
  return {
38103
38116
  kind: "baseline-conflict",
38104
- message: "baseline/line-height signals conflict between siblings"
38117
+ message: "baseline/line-height mismatch between siblings",
38118
+ fix: "unify line-height or add vertical-align"
38105
38119
  };
38106
38120
  case "context-conflict":
38107
38121
  return {
38108
38122
  kind: "context-conflict",
38109
- message: "container and child alignment settings conflict"
38123
+ message: "container and child alignment conflict",
38124
+ fix: "check align-items on the parent"
38110
38125
  };
38111
38126
  case "replaced-control-risk":
38112
38127
  return {
38113
38128
  kind: "replaced-control-risk",
38114
- message: "replaced/control baseline behavior differs from neighboring text"
38129
+ message: "replaced element baseline differs from text siblings",
38130
+ fix: "add vertical-align: middle to the replaced element"
38115
38131
  };
38116
38132
  case "content-composition-conflict":
38117
38133
  return {
38118
38134
  kind: "content-composition-conflict",
38119
- message: formatContentCompositionFinding(input, evidence)
38135
+ message: "content composition differs from siblings",
38136
+ fix: formatCompositionFixSuggestion(input.subjectContentComposition)
38120
38137
  };
38121
38138
  default:
38122
38139
  return null;
38123
38140
  }
38124
38141
  }
38125
- function formatContentCompositionFinding(input, evidence) {
38126
- const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
38127
- const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
38128
- const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
38129
- return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
38130
- }
38131
38142
  function round(value2) {
38132
38143
  return Math.round(value2 * 1e3) / 1e3;
38133
38144
  }
@@ -38890,7 +38901,7 @@ var jsxStylePolicy = defineCrossRule({
38890
38901
 
38891
38902
  // src/cross-file/rules/css-layout-sibling-alignment-outlier.ts
38892
38903
  var messages143 = {
38893
- misalignedSibling: "Element '{{subject}}' appears vertically misaligned relative to sibling cohort in '{{parent}}' (context {{context}}, severity {{severity}}, confidence {{confidence}}{{offsetClause}}; causes: {{causes}})."
38904
+ misalignedSibling: "Vertically misaligned '{{subject}}' in '{{parent}}'.{{fix}}{{offsetClause}}"
38894
38905
  };
38895
38906
  var MIN_CONFIDENCE_THRESHOLD = 0.48;
38896
38907
  var MIN_OFFSET_PX_THRESHOLD = 2;
@@ -38915,6 +38926,7 @@ var siblingAlignmentDetector = {
38915
38926
  severity: decision.evaluation.severity,
38916
38927
  confidence: decision.evaluation.confidence,
38917
38928
  causes: formatAlignmentCauses(decision.evaluation.signalFindings),
38929
+ primaryFix: formatPrimaryFix(decision.evaluation.signalFindings),
38918
38930
  contextKind: decision.evaluation.contextKind,
38919
38931
  contextCertainty: decision.evaluation.contextCertainty,
38920
38932
  estimatedOffsetPx: decision.evaluation.estimatedOffsetPx,
@@ -38997,8 +39009,11 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
38997
39009
  const confidence = formatFixed(detection.evidence.confidence);
38998
39010
  const offset = detection.evidence.estimatedOffsetPx;
38999
39011
  const hasOffset = offset !== null && Math.abs(offset) > 0.25;
39000
- const offsetClause = hasOffset ? `, estimated offset ${formatFixed(offset)}px` : "";
39012
+ const offsetClause = hasOffset ? ` Estimated offset: ${formatFixed(offset)}px.` : "";
39001
39013
  const causes = detection.evidence.causes.length === 0 ? "alignment signals indicate an outlier" : detection.evidence.causes.join("; ");
39014
+ const primaryFix = detection.evidence.primaryFix;
39015
+ const firstChar = primaryFix.length > 0 ? primaryFix[0] : void 0;
39016
+ const fix = firstChar !== void 0 ? ` ${firstChar.toUpperCase()}${primaryFix.slice(1)}.` : "";
39002
39017
  if (log.enabled) {
39003
39018
  log.debug(
39004
39019
  `${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}]`
@@ -39013,11 +39028,8 @@ var cssLayoutSiblingAlignmentOutlier = defineCrossRule({
39013
39028
  resolveMessage(messages143.misalignedSibling, {
39014
39029
  subject,
39015
39030
  parent,
39016
- context: detection.evidence.contextKind,
39017
- severity,
39018
- confidence,
39019
- offsetClause,
39020
- causes
39031
+ fix,
39032
+ offsetClause
39021
39033
  }),
39022
39034
  "warn"
39023
39035
  )
@@ -40448,4 +40460,4 @@ export {
40448
40460
  rules3,
40449
40461
  runCrossFileRules
40450
40462
  };
40451
- //# sourceMappingURL=chunk-64TMAKYI.js.map
40463
+ //# sourceMappingURL=chunk-XVYCT2RS.js.map