@rtkelly-labs/design-system 0.19.0 → 0.20.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 (63) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/BracketText.js +3 -2
  3. package/dist/components/BracketText.js.map +1 -1
  4. package/dist/components/Button.js.map +1 -1
  5. package/dist/components/Card.js +2 -1
  6. package/dist/components/Card.js.map +1 -1
  7. package/dist/components/DataTable.js.map +1 -1
  8. package/dist/components/Divider.js +21 -14
  9. package/dist/components/Divider.js.map +1 -1
  10. package/dist/components/InlineAction.js.map +1 -1
  11. package/dist/components/PageTitle.js +5 -1
  12. package/dist/components/PageTitle.js.map +1 -1
  13. package/dist/components/ResourceState.js.map +1 -1
  14. package/dist/components/SocialIcon.js.map +1 -1
  15. package/dist/components/StatCard.js +2 -2
  16. package/dist/components/StatCard.js.map +1 -1
  17. package/dist/components/StatusPage.js.map +1 -1
  18. package/dist/components/docs/figures/ActivityGrid.js.map +1 -1
  19. package/dist/components/docs/figures/ChangeSummary.js +68 -25
  20. package/dist/components/docs/figures/ChangeSummary.js.map +1 -1
  21. package/dist/components/docs/figures/FigureFrame.js.map +1 -1
  22. package/dist/components/docs/figures/index.js.map +1 -1
  23. package/dist/components/experiments/ExperimentsView.js.map +1 -1
  24. package/dist/components/marketing/FeatureGrid.js.map +1 -1
  25. package/dist/components/marketing/Hero.js +2 -2
  26. package/dist/components/marketing/Hero.js.map +1 -1
  27. package/dist/components/marketing/PricingGrid.js.map +1 -1
  28. package/dist/components/review/ChangeBar.js +29 -0
  29. package/dist/components/review/ChangeBar.js.map +1 -0
  30. package/dist/components/review/ChangeCount.js +27 -0
  31. package/dist/components/review/ChangeCount.js.map +1 -0
  32. package/dist/components/review/ChangeIndex.js +50 -0
  33. package/dist/components/review/ChangeIndex.js.map +1 -0
  34. package/dist/components/review/DeltaValue.js +87 -0
  35. package/dist/components/review/DeltaValue.js.map +1 -0
  36. package/dist/components/review/DiffView.js +115 -0
  37. package/dist/components/review/DiffView.js.map +1 -0
  38. package/dist/components/review/KeyedDiff.js +43 -0
  39. package/dist/components/review/KeyedDiff.js.map +1 -0
  40. package/dist/components/review/ProvenanceStrip.js +17 -0
  41. package/dist/components/review/ProvenanceStrip.js.map +1 -0
  42. package/dist/components/review/PullRequestPage.js +223 -0
  43. package/dist/components/review/PullRequestPage.js.map +1 -0
  44. package/dist/components/review/ReviewReportPage.js +111 -0
  45. package/dist/components/review/ReviewReportPage.js.map +1 -0
  46. package/dist/components/review/StatusMark.js +32 -0
  47. package/dist/components/review/StatusMark.js.map +1 -0
  48. package/dist/components/review/VerdictBand.js +45 -0
  49. package/dist/components/review/VerdictBand.js.map +1 -0
  50. package/dist/components/review/diff.js +53 -0
  51. package/dist/components/review/diff.js.map +1 -0
  52. package/dist/components/review/index.js +16 -0
  53. package/dist/components/review/index.js.map +1 -0
  54. package/dist/components/review/samples.js +235 -0
  55. package/dist/components/review/samples.js.map +1 -0
  56. package/dist/components/review/vocabulary.js +51 -0
  57. package/dist/components/review/vocabulary.js.map +1 -0
  58. package/dist/components/saas/SaasLandingPage.js +10 -2
  59. package/dist/components/saas/SaasLandingPage.js.map +1 -1
  60. package/dist/index.d.ts +640 -24
  61. package/dist/index.js +2 -1
  62. package/dist/index.js.map +1 -1
  63. package/package.json +8 -2
@@ -0,0 +1,43 @@
1
+ // src/components/review/KeyedDiff.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var LOOK = {
6
+ added: { glyph: "+", tone: "text-delta-added", word: "added" },
7
+ removed: { glyph: "\u2212", tone: "text-delta-removed", word: "removed" },
8
+ changed: { glyph: "\u0394", tone: "text-content-secondary", word: "changed" },
9
+ renamed: { glyph: "\u2192", tone: "text-delta-moved", word: "renamed" },
10
+ unchanged: { glyph: "=", tone: "text-content-muted", word: "unchanged" }
11
+ };
12
+ var KeyedDiff = React.forwardRef(function KeyedDiff2({ caption, identityLabel = "Record", columns = [], rows, emptyText = "No records changed.", changeLabels, className, ...rest }, ref) {
13
+ const words = { ...Object.fromEntries(Object.entries(LOOK).map(([k, v]) => [k, v.word])), ...changeLabels };
14
+ const head = "border-b border-edge-default px-3 py-2 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted whitespace-nowrap";
15
+ const cell = "border-b border-edge-subtle px-3 py-2 align-top";
16
+ const captionId = React.useId();
17
+ return (
18
+ // A wide table scrolls sideways; the region takes focus so the keyboard can scroll it too.
19
+ /* @__PURE__ */ jsx("div", { ref, "data-slot": "keyed-diff", role: "region", tabIndex: 0, "aria-labelledby": captionId, ...rest, className: cn("overflow-x-auto border-t-2 border-edge-strong", className), children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm [&_tbody_tr:last-child>*]:border-b-0", children: [
20
+ /* @__PURE__ */ jsx("caption", { id: captionId, className: "px-3 py-2.5 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted", children: caption }),
21
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
22
+ /* @__PURE__ */ jsx("th", { scope: "col", className: head, children: "Change" }),
23
+ /* @__PURE__ */ jsx("th", { scope: "col", className: head, children: identityLabel }),
24
+ columns.map((column) => /* @__PURE__ */ jsx("th", { scope: "col", className: cn(head, "text-right"), children: column }, column))
25
+ ] }) }),
26
+ /* @__PURE__ */ jsx("tbody", { children: rows.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 2 + columns.length, className: cn(cell, "text-content-muted"), children: emptyText }) }) : rows.map((row, index) => {
27
+ const look = LOOK[row.change];
28
+ return /* @__PURE__ */ jsxs("tr", { "data-change": row.change, children: [
29
+ /* @__PURE__ */ jsxs("td", { className: cn(cell, "whitespace-nowrap font-mono text-xs font-bold uppercase tracking-wider", look.tone), children: [
30
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "pr-1.5", children: look.glyph }),
31
+ words[row.change]
32
+ ] }),
33
+ /* @__PURE__ */ jsx("th", { scope: "row", className: cn(cell, "text-left font-mono font-normal text-content-primary [overflow-wrap:anywhere]", row.change === "removed" && "line-through"), children: row.identity }),
34
+ columns.map((column, c) => /* @__PURE__ */ jsx("td", { className: cn(cell, "text-right tabular-nums"), children: row.cells?.[c] }, column))
35
+ ] }, row.id ?? index);
36
+ }) })
37
+ ] }) })
38
+ );
39
+ });
40
+ export {
41
+ KeyedDiff
42
+ };
43
+ //# sourceMappingURL=KeyedDiff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/KeyedDiff.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../lib/recipe';\n\n/** What happened to a record between baseline and candidate, matched by its stable key. */\nexport type KeyedChange = 'added' | 'removed' | 'changed' | 'renamed' | 'unchanged';\n\nexport interface KeyedDiffRow {\n /** A stable React key for the row. Give one when rows can reorder or be inserted and `cells` hold state; the index is used otherwise. */\n id?: string | number;\n /** The record's stable identity — a method id, a package name, a cluster key. */\n identity: ReactNode;\n /** What happened to the record. */\n change: KeyedChange;\n /** One cell per entry in `columns`, typically `DeltaValue`s. */\n cells?: readonly ReactNode[];\n}\n\nexport interface KeyedDiffProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Says what the records are and what they are keyed by. Rendered as the table caption. */\n caption: ReactNode;\n /** Heading for the identity column. */\n identityLabel?: string;\n /** Headings for the measured columns after the identity. */\n columns?: readonly string[];\n /** One row per record, in reading order. Sort by change or by identity before passing them in. */\n rows: readonly KeyedDiffRow[];\n /** Printed when there are no rows. */\n emptyText?: ReactNode;\n /** Replaces the change words, for a translated page. */\n changeLabels?: Partial<Record<KeyedChange, string>>;\n /** Additional classes for the root. */\n className?: string;\n}\n\nconst LOOK: Record<KeyedChange, { glyph: string; tone: string; word: string }> = {\n added: { glyph: '+', tone: 'text-delta-added', word: 'added' },\n removed: { glyph: '−', tone: 'text-delta-removed', word: 'removed' },\n changed: { glyph: 'Δ', tone: 'text-content-secondary', word: 'changed' },\n renamed: { glyph: '→', tone: 'text-delta-moved', word: 'renamed' },\n unchanged: { glyph: '=', tone: 'text-content-muted', word: 'unchanged' },\n};\n\n/**\n * Records compared by stable identity rather than by line: one row per record, a change word,\n * and the measured fields beside it.\n *\n * The form a keyed-collection comparison reports. A method whose signature changed is one\n * `changed` row here where a line diff shows a removal and an addition, and reordering a keyed\n * collection is no change at all.\n */\nexport const KeyedDiff = React.forwardRef<HTMLDivElement, KeyedDiffProps>(function KeyedDiff(\n { caption, identityLabel = 'Record', columns = [], rows, emptyText = 'No records changed.', changeLabels, className, ...rest },\n ref,\n) {\n const words = { ...Object.fromEntries(Object.entries(LOOK).map(([k, v]) => [k, v.word])), ...changeLabels } as Record<KeyedChange, string>;\n const head = 'border-b border-edge-default px-3 py-2 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted whitespace-nowrap';\n const cell = 'border-b border-edge-subtle px-3 py-2 align-top';\n const captionId = React.useId();\n return (\n // A wide table scrolls sideways; the region takes focus so the keyboard can scroll it too.\n <div ref={ref} data-slot=\"keyed-diff\" role=\"region\" tabIndex={0} aria-labelledby={captionId} {...rest} className={cn('overflow-x-auto border-t-2 border-edge-strong', className)}>\n <table className=\"w-full border-collapse text-sm [&_tbody_tr:last-child>*]:border-b-0\">\n <caption id={captionId} className=\"px-3 py-2.5 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">{caption}</caption>\n <thead>\n <tr>\n <th scope=\"col\" className={head}>Change</th>\n <th scope=\"col\" className={head}>{identityLabel}</th>\n {columns.map((column) => (\n <th key={column} scope=\"col\" className={cn(head, 'text-right')}>{column}</th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.length === 0 ? (\n <tr>\n <td colSpan={2 + columns.length} className={cn(cell, 'text-content-muted')}>{emptyText}</td>\n </tr>\n ) : (\n rows.map((row, index) => {\n const look = LOOK[row.change];\n return (\n <tr key={row.id ?? index} data-change={row.change}>\n <td className={cn(cell, 'whitespace-nowrap font-mono text-xs font-bold uppercase tracking-wider', look.tone)}>\n <span aria-hidden=\"true\" className=\"pr-1.5\">{look.glyph}</span>\n {words[row.change]}\n </td>\n <th scope=\"row\" className={cn(cell, 'text-left font-mono font-normal text-content-primary [overflow-wrap:anywhere]', row.change === 'removed' && 'line-through')}>\n {row.identity}\n </th>\n {columns.map((column, c) => (\n <td key={column} className={cn(cell, 'text-right tabular-nums')}>{row.cells?.[c]}</td>\n ))}\n </tr>\n );\n })\n )}\n </tbody>\n </table>\n </div>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AA6DX,cAEE,YAFF;AA5BR,IAAM,OAA2E;AAAA,EAC/E,OAAO,EAAE,OAAO,KAAK,MAAM,oBAAoB,MAAM,QAAQ;AAAA,EAC7D,SAAS,EAAE,OAAO,UAAK,MAAM,sBAAsB,MAAM,UAAU;AAAA,EACnE,SAAS,EAAE,OAAO,UAAK,MAAM,0BAA0B,MAAM,UAAU;AAAA,EACvE,SAAS,EAAE,OAAO,UAAK,MAAM,oBAAoB,MAAM,UAAU;AAAA,EACjE,WAAW,EAAE,OAAO,KAAK,MAAM,sBAAsB,MAAM,YAAY;AACzE;AAUO,IAAM,YAAkB,iBAA2C,SAASA,WACjF,EAAE,SAAS,gBAAgB,UAAU,UAAU,CAAC,GAAG,MAAM,YAAY,uBAAuB,cAAc,WAAW,GAAG,KAAK,GAC7H,KACA;AACA,QAAM,QAAQ,EAAE,GAAG,OAAO,YAAY,OAAO,QAAQ,IAAI,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,GAAG,GAAG,aAAa;AAC1G,QAAM,OAAO;AACb,QAAM,OAAO;AACb,QAAM,YAAkB,YAAM;AAC9B;AAAA;AAAA,IAEE,oBAAC,SAAI,KAAU,aAAU,cAAa,MAAK,UAAS,UAAU,GAAG,mBAAiB,WA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
+ import { cn } from "../../lib/recipe.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var ProvenanceStrip = React.forwardRef(function ProvenanceStrip2({ label = "Provenance", items, className, ...rest }, ref) {
6
+ return /* @__PURE__ */ jsx("section", { ref, "aria-label": label, "data-slot": "provenance-strip", ...rest, className: cn("border-y border-t-2 border-edge-subtle border-t-edge-strong", className), children: /* @__PURE__ */ jsx("dl", { className: "m-0 grid grid-cols-[repeat(auto-fit,minmax(min(100%,13rem),1fr))] gap-x-8", children: items.map((item, index) => /* @__PURE__ */ jsxs("div", { "data-slot": "provenance-strip-item", className: "flex min-w-0 flex-col gap-1.5 py-3", children: [
7
+ /* @__PURE__ */ jsx("dt", { className: "font-mono text-[0.7rem] font-bold uppercase tracking-[0.08em] text-content-muted", children: item.label }),
8
+ /* @__PURE__ */ jsxs("dd", { className: "m-0 flex flex-col gap-1.5", children: [
9
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-sm text-content-primary [overflow-wrap:anywhere]", children: item.value }),
10
+ item.note != null ? /* @__PURE__ */ jsx("span", { className: "text-xs text-content-muted", children: item.note }) : null
11
+ ] })
12
+ ] }, `${item.label}-${index}`)) }) });
13
+ });
14
+ export {
15
+ ProvenanceStrip
16
+ };
17
+ //# sourceMappingURL=ProvenanceStrip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/ProvenanceStrip.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../lib/recipe';\n\nexport interface ProvenanceItem {\n /** What the value is, in a few words: `Baseline commit`, `Trust`, `Comparator`. */\n label: string;\n /** The value. Digests and commits are drawn in mono and wrap anywhere rather than overflow. */\n value: ReactNode;\n /** One short line under the value, such as what a baseline role asks. */\n note?: ReactNode;\n}\n\nexport interface ProvenanceStripProps extends React.HTMLAttributes<HTMLElement> {\n /** Accessible name for the strip. */\n label?: string;\n /** Each fact the result can be traced back to, in reading order. */\n items: readonly ProvenanceItem[];\n /** Additional classes for the strip. */\n className?: string;\n}\n\n/**\n * Where a result came from — subject, baseline role and commit, manifest digest, trust state,\n * producer and comparator — as a title block: one strong rule above, a hairline below, cells\n * spaced by a gutter, and no box — so a row that wraps reads the same as the first.\n *\n * Wider than `ReportDocument`'s `meta` line because a review's provenance is long (a forty-\n * character commit, a SHA-256 digest) and a reader checks it rather than skims it. A value that\n * was not recorded belongs here too, as a `StatusMark`, rather than being left out.\n */\nexport const ProvenanceStrip = React.forwardRef<HTMLElement, ProvenanceStripProps>(function ProvenanceStrip(\n { label = 'Provenance', items, className, ...rest },\n ref,\n) {\n return (\n <section ref={ref} aria-label={label} data-slot=\"provenance-strip\" {...rest} className={cn('border-y border-t-2 border-edge-subtle border-t-edge-strong', className)}>\n <dl className=\"m-0 grid grid-cols-[repeat(auto-fit,minmax(min(100%,13rem),1fr))] gap-x-8\">\n {items.map((item, index) => (\n <div key={`${item.label}-${index}`} data-slot=\"provenance-strip-item\" className=\"flex min-w-0 flex-col gap-1.5 py-3\">\n <dt className=\"font-mono text-[0.7rem] font-bold uppercase tracking-[0.08em] text-content-muted\">{item.label}</dt>\n {/* The note explains the value, so it shares its <dd>: a second <dd> would be an alternative value. */}\n <dd className=\"m-0 flex flex-col gap-1.5\">\n <span className=\"font-mono text-sm text-content-primary [overflow-wrap:anywhere]\">{item.value}</span>\n {item.note != null ? <span className=\"text-xs text-content-muted\">{item.note}</span> : null}\n </dd>\n </div>\n ))}\n </dl>\n </section>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AAsCP,cAEA,YAFA;AATL,IAAM,kBAAwB,iBAA8C,SAASA,iBAC1F,EAAE,QAAQ,cAAc,OAAO,WAAW,GAAG,KAAK,GAClD,KACA;AACA,SACE,oBAAC,aAAQ,KAAU,cAAY,OAAO,aAAU,oBAAoB,GAAG,MAAM,WAAW,GAAG,+DAA+D,SAAS,GACjK,8BAAC,QAAG,WAAU,6EACX,gBAAM,IAAI,CAAC,MAAM,UAChB,qBAAC,SAAmC,aAAU,yBAAwB,WAAU,sCAC9E;AAAA,wBAAC,QAAG,WAAU,oFAAoF,eAAK,OAAM;AAAA,IAE7G,qBAAC,QAAG,WAAU,6BACZ;AAAA,0BAAC,UAAK,WAAU,mEAAmE,eAAK,OAAM;AAAA,MAC7F,KAAK,QAAQ,OAAO,oBAAC,UAAK,WAAU,8BAA8B,eAAK,MAAK,IAAU;AAAA,OACzF;AAAA,OANQ,GAAG,KAAK,KAAK,IAAI,KAAK,EAOhC,CACD,GACH,GACF;AAEJ,CAAC;","names":["ProvenanceStrip"]}
@@ -0,0 +1,223 @@
1
+ // src/components/review/PullRequestPage.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { ChangeCount } from "./ChangeCount.js";
5
+ import { ChangeIndex } from "./ChangeIndex.js";
6
+ import { DiffView } from "./DiffView.js";
7
+ import { StatusMark } from "./StatusMark.js";
8
+ import { VerdictBand } from "./VerdictBand.js";
9
+ import { countDiff } from "./diff.js";
10
+ import { STATUS_APPEARANCE, STATUS_TONE_TEXT } from "./vocabulary.js";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ function mergeSummary(pr, failing) {
13
+ if (pr.state === "merged") return `Merged into ${pr.base}.`;
14
+ if (pr.state === "closed") return "Closed without merging.";
15
+ const checks = failing > 0 ? `${failing} failing check${failing === 1 ? "" : "s"}.` : "No failing checks.";
16
+ if (pr.state === "draft") return `${checks} Still a draft, so it cannot merge yet.`;
17
+ const blocking = pr.reviewers.filter((r) => r.state === "changes-requested").map((r) => r.name);
18
+ if (blocking.length > 0) return `Changes requested by ${blocking.join(" and ")}. ${checks}`;
19
+ if (pr.reviewers.length > 0 && pr.reviewers.every((r) => r.state === "approved")) return `${checks} Approved.`;
20
+ return `${checks} Waiting on review.`;
21
+ }
22
+ function mergeHeadline(pr, failing) {
23
+ if (pr.state === "merged") return { title: "Merged", tone: "success" };
24
+ if (pr.state === "closed") return { title: "Closed", tone: "neutral" };
25
+ if (pr.state === "draft") return { title: "Draft", tone: "hollow" };
26
+ if (failing > 0 || pr.reviewers.some((r) => r.state === "changes-requested")) return { title: "Cannot merge yet", tone: "danger" };
27
+ if (pr.reviewers.length > 0 && pr.reviewers.every((r) => r.state === "approved")) return { title: "Ready to merge", tone: "success" };
28
+ return { title: "Waiting on review", tone: "warning" };
29
+ }
30
+ var TONE_RULE = {
31
+ success: "border-intent-success",
32
+ warning: "border-intent-warning",
33
+ danger: "border-intent-danger",
34
+ info: "border-intent-info",
35
+ neutral: "border-edge-strong",
36
+ hollow: "border-edge-default"
37
+ };
38
+ var OUTCOME_ORDER = ["fail", "warn", "needs-review", "inconclusive", "none", "pass"];
39
+ var REVIEWER_ORDER = ["changes-requested", "pending", "commented", "approved"];
40
+ var STATE = {
41
+ open: { glyph: "\u25CF", tone: "border-accent-primary text-accent-primary" },
42
+ draft: { glyph: "\u25CB", tone: "border-dashed border-content-muted text-content-muted" },
43
+ merged: { glyph: "\u25C6", tone: "border-accent-secondary text-accent-secondary" },
44
+ closed: { glyph: "\u2715", tone: "border-content-secondary text-content-secondary" }
45
+ };
46
+ var REVIEWER = {
47
+ approved: { glyph: "\u2713", tone: "success", word: "approved" },
48
+ "changes-requested": { glyph: "\u2715", tone: "danger", word: "changes requested" },
49
+ commented: { glyph: "\u25CF", tone: "neutral", word: "commented" },
50
+ pending: { glyph: "\u25CB", tone: "hollow", word: "review pending" }
51
+ };
52
+ var label = "font-mono text-xs font-bold uppercase tracking-wider text-content-muted";
53
+ var TAB = "pb-3 pt-1 text-content-primary no-underline decoration-accent-primary decoration-[3px] underline-offset-[0.6rem] hover:underline focus-visible:underline";
54
+ function Comment({ author, meta, children }) {
55
+ return /* @__PURE__ */ jsxs("article", { className: "flex flex-col gap-1.5 border-l-2 border-edge-subtle pl-4", children: [
56
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-wrap items-baseline gap-x-2 font-mono text-xs", children: [
57
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-content-primary", children: author }),
58
+ meta ? /* @__PURE__ */ jsx("span", { className: "text-content-muted", children: meta }) : null
59
+ ] }),
60
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-content-primary", children })
61
+ ] });
62
+ }
63
+ function Tally({ label: name, items }) {
64
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-4 gap-y-1", children: [
65
+ /* @__PURE__ */ jsx("span", { className: cn(label, "w-16 shrink-0"), children: name }),
66
+ /* @__PURE__ */ jsx("ul", { "aria-label": name, className: "m-0 flex list-none flex-wrap gap-x-3 gap-y-1 p-0 font-mono text-xs", children: items.map((item) => /* @__PURE__ */ jsxs("li", { className: cn("inline-flex items-baseline gap-1", STATUS_TONE_TEXT[item.tone]), children: [
67
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: item.glyph }),
68
+ /* @__PURE__ */ jsx("span", { className: "font-bold tabular-nums", children: item.count }),
69
+ /* @__PURE__ */ jsx("span", { children: item.word })
70
+ ] }, item.key)) })
71
+ ] });
72
+ }
73
+ var PullRequestPage = React.forwardRef(function PullRequestPage2({ pullRequest: pr, className, ...rest }, ref) {
74
+ const files = pr.files.map((file) => ({ ...file, ...countDiff(file.hunks) }));
75
+ const added = files.reduce((sum, file) => sum + file.added, 0);
76
+ const removed = files.reduce((sum, file) => sum + file.removed, 0);
77
+ const max = Math.max(1, ...files.map((file) => file.added + file.removed));
78
+ const commentCount = files.reduce((sum, file) => sum + file.hunks.reduce((n, hunk) => n + hunk.lines.reduce((m, line) => m + (line.comments?.length ?? 0), 0), 0), 0);
79
+ const failing = pr.checks.filter((check) => check.status === "fail").length;
80
+ const state = STATE[pr.state];
81
+ const headline = mergeHeadline(pr, failing);
82
+ const checkTally = OUTCOME_ORDER.flatMap((status) => {
83
+ const matching = pr.checks.filter((check) => check.status === status);
84
+ if (matching.length === 0) return [];
85
+ const look = STATUS_APPEARANCE.outcome[status];
86
+ const word = matching.every((check) => check.label === matching[0].label) && matching[0].label ? matching[0].label : look.word;
87
+ return [{ key: status, count: matching.length, glyph: look.glyph, tone: look.tone, word }];
88
+ });
89
+ const reviewTally = REVIEWER_ORDER.flatMap((reviewState) => {
90
+ const count = pr.reviewers.filter((reviewer) => reviewer.state === reviewState).length;
91
+ return count === 0 ? [] : [{ key: reviewState, count, ...REVIEWER[reviewState], word: REVIEWER[reviewState].word.replace("review ", "") }];
92
+ });
93
+ const passing = pr.checks.filter((check) => check.status === "pass");
94
+ const attention = pr.checks.filter((check) => check.status !== "pass");
95
+ return /* @__PURE__ */ jsxs("main", { ref, "data-slot": "pull-request-page", ...rest, className: cn("mx-auto flex w-full max-w-6xl flex-col gap-8 px-4 py-8 font-sans text-content-primary sm:px-6", className), children: [
96
+ /* @__PURE__ */ jsxs("header", { className: "flex flex-col gap-3 border-b-4 border-edge-strong", children: [
97
+ /* @__PURE__ */ jsxs("p", { className: "m-0 font-mono text-xs font-bold uppercase tracking-widest text-content-muted", children: [
98
+ "[ ",
99
+ pr.repository,
100
+ " \xB7 pull request #",
101
+ pr.number,
102
+ " ]"
103
+ ] }),
104
+ /* @__PURE__ */ jsxs("h1", { className: "m-0 font-display text-2xl font-bold leading-tight sm:text-3xl", children: [
105
+ pr.title,
106
+ " ",
107
+ /* @__PURE__ */ jsxs("span", { className: "font-normal text-content-muted", children: [
108
+ "#",
109
+ pr.number
110
+ ] })
111
+ ] }),
112
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2 text-sm", children: [
113
+ /* @__PURE__ */ jsxs("span", { "data-slot": "pull-request-state", className: cn("inline-flex items-center gap-1.5 border px-2 py-1 font-mono text-xs font-bold uppercase tracking-wider", state.tone), children: [
114
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: state.glyph }),
115
+ pr.state
116
+ ] }),
117
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-content-secondary sm:text-sm", children: [
118
+ /* @__PURE__ */ jsx("span", { className: "font-mono font-bold text-content-primary", children: pr.author }),
119
+ " wants to merge",
120
+ " ",
121
+ /* @__PURE__ */ jsx("code", { className: "border border-edge-subtle bg-surface-sunken px-1.5 font-mono text-xs", children: pr.head }),
122
+ " into",
123
+ " ",
124
+ /* @__PURE__ */ jsx("code", { className: "border border-edge-subtle bg-surface-sunken px-1.5 font-mono text-xs", children: pr.base }),
125
+ " \xB7 ",
126
+ pr.opened
127
+ ] })
128
+ ] }),
129
+ /* @__PURE__ */ jsxs("section", { "data-slot": "pull-request-status", "aria-label": "Merge status", className: cn("flex flex-col gap-2.5 border-l-4 bg-surface-sunken px-4 py-3", TONE_RULE[headline.tone]), children: [
130
+ /* @__PURE__ */ jsx("p", { className: cn("m-0 font-display text-xl font-bold leading-tight", STATUS_TONE_TEXT[headline.tone]), children: headline.title }),
131
+ /* @__PURE__ */ jsx("p", { className: "m-0 text-sm text-content-secondary", children: mergeSummary(pr, failing) }),
132
+ pr.state === "open" || pr.state === "draft" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
133
+ /* @__PURE__ */ jsx(Tally, { label: "Checks", items: checkTally }),
134
+ reviewTally.length > 0 ? /* @__PURE__ */ jsx(Tally, { label: "Reviews", items: reviewTally }) : null
135
+ ] }) : null
136
+ ] }),
137
+ /* @__PURE__ */ jsxs("nav", { "aria-label": "Pull request sections", className: "mt-1 flex max-w-full flex-wrap gap-x-6 font-mono text-xs font-bold uppercase tracking-wider", children: [
138
+ /* @__PURE__ */ jsx("a", { href: "#conversation", className: TAB, children: "Conversation" }),
139
+ /* @__PURE__ */ jsxs("a", { href: "#checks", className: TAB, children: [
140
+ "Checks ",
141
+ /* @__PURE__ */ jsx("span", { className: "text-content-muted", children: pr.checks.length })
142
+ ] }),
143
+ /* @__PURE__ */ jsxs("a", { href: "#files", className: cn(TAB, "flex items-center gap-2"), children: [
144
+ "Files changed ",
145
+ /* @__PURE__ */ jsx("span", { className: "text-content-muted", children: files.length }),
146
+ /* @__PURE__ */ jsx(ChangeCount, { added, removed, noun: ["line", "lines"], className: "text-xs" })
147
+ ] })
148
+ ] })
149
+ ] }),
150
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-8 lg:grid-cols-[minmax(0,1fr)_16rem]", children: [
151
+ /* @__PURE__ */ jsxs("section", { id: "conversation", "aria-label": "Conversation", className: "flex min-w-0 scroll-mt-4 flex-col gap-4", children: [
152
+ pr.verdict ? /* @__PURE__ */ jsx(VerdictBand, { outcome: pr.verdict.outcome, title: pr.verdict.title, children: pr.verdict.context }) : null,
153
+ /* @__PURE__ */ jsx(Comment, { author: pr.author, meta: "opened this pull request", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: pr.description.map((paragraph, i) => /* @__PURE__ */ jsx("p", { className: "m-0", children: paragraph }, i)) }) }),
154
+ pr.conversation?.map((entry, i) => /* @__PURE__ */ jsx(Comment, { author: entry.author, meta: entry.meta, children: entry.body }, i)),
155
+ /* @__PURE__ */ jsxs("p", { className: "m-0 font-mono text-xs text-content-muted", children: [
156
+ commentCount,
157
+ " review comment",
158
+ commentCount === 1 ? "" : "s",
159
+ " on the changed files."
160
+ ] })
161
+ ] }),
162
+ /* @__PURE__ */ jsxs("aside", { "aria-label": "Details", className: "flex flex-col gap-6 text-sm", children: [
163
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", children: [
164
+ /* @__PURE__ */ jsx("h2", { className: cn("m-0", label), children: "Reviewers" }),
165
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col gap-2 p-0", children: pr.reviewers.map((reviewer) => {
166
+ const look = REVIEWER[reviewer.state];
167
+ return /* @__PURE__ */ jsxs("li", { className: "flex items-center justify-between gap-2", children: [
168
+ /* @__PURE__ */ jsx("span", { className: "font-mono", children: reviewer.name }),
169
+ /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center gap-1 font-mono text-xs font-bold uppercase tracking-wider", STATUS_TONE_TEXT[look.tone]), children: [
170
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: look.glyph }),
171
+ look.word
172
+ ] })
173
+ ] }, reviewer.name);
174
+ }) })
175
+ ] }),
176
+ pr.labels && pr.labels.length > 0 ? /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", children: [
177
+ /* @__PURE__ */ jsx("h2", { className: cn("m-0", label), children: "Labels" }),
178
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-wrap gap-2 p-0", children: pr.labels.map((name) => /* @__PURE__ */ jsx("li", { className: "border border-edge-subtle bg-surface-sunken px-1.5 py-0.5 font-mono text-xs", children: name }, name)) })
179
+ ] }) : null
180
+ ] })
181
+ ] }),
182
+ /* @__PURE__ */ jsxs("section", { id: "checks", "aria-labelledby": "checks-heading", className: "flex scroll-mt-4 flex-col gap-3", children: [
183
+ /* @__PURE__ */ jsx("h2", { id: "checks-heading", className: "m-0 border-b-2 border-edge-subtle pb-2 font-display text-xl font-bold uppercase", children: "Checks" }),
184
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", children: attention.map((check) => /* @__PURE__ */ jsxs("li", { "data-slot": "pull-request-check", className: "grid grid-cols-[minmax(7.5rem,auto)_minmax(0,1fr)] items-start gap-x-4 gap-y-1 border-b border-edge-subtle py-2.5 last:border-b-0 sm:grid-cols-[minmax(9rem,auto)_minmax(0,1fr)_auto]", children: [
185
+ /* @__PURE__ */ jsx(StatusMark, { vocabulary: "outcome", status: check.status, label: check.label, className: "w-fit" }),
186
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
187
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-bold [overflow-wrap:anywhere]", children: check.name }),
188
+ check.summary ? /* @__PURE__ */ jsx("span", { className: "text-sm text-content-secondary", children: check.summary }) : null
189
+ ] }),
190
+ check.duration ? /* @__PURE__ */ jsx("span", { className: "col-start-2 font-mono text-xs tabular-nums text-content-muted sm:col-start-auto", children: check.duration }) : null
191
+ ] }, check.name)) }),
192
+ passing.length > 0 ? /* @__PURE__ */ jsxs("details", { "data-slot": "pull-request-passing", className: "group", children: [
193
+ /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer list-none items-baseline gap-2 py-1 font-mono text-xs font-bold uppercase tracking-wider text-intent-success [&::-webkit-details-marker]:hidden", children: [
194
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-content-muted group-open:hidden", children: "[+]" }),
195
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "hidden text-content-muted group-open:inline", children: "[\u2212]" }),
196
+ "\u2713 ",
197
+ passing.length,
198
+ " passing"
199
+ ] }),
200
+ /* @__PURE__ */ jsx("ul", { className: "m-0 flex list-none flex-col p-0", children: passing.map((check) => /* @__PURE__ */ jsxs("li", { "data-slot": "pull-request-check", className: "grid grid-cols-[minmax(7.5rem,auto)_minmax(0,1fr)] items-start gap-x-4 gap-y-1 border-b border-edge-subtle py-2.5 last:border-b-0 sm:grid-cols-[minmax(9rem,auto)_minmax(0,1fr)_auto]", children: [
201
+ /* @__PURE__ */ jsx(StatusMark, { vocabulary: "outcome", status: check.status, label: check.label, className: "w-fit" }),
202
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-0.5", children: [
203
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-sm font-bold [overflow-wrap:anywhere]", children: check.name }),
204
+ check.summary ? /* @__PURE__ */ jsx("span", { className: "text-sm text-content-secondary", children: check.summary }) : null
205
+ ] }),
206
+ check.duration ? /* @__PURE__ */ jsx("span", { className: "col-start-2 font-mono text-xs tabular-nums text-content-muted sm:col-start-auto", children: check.duration }) : null
207
+ ] }, check.name)) })
208
+ ] }) : null
209
+ ] }),
210
+ /* @__PURE__ */ jsxs("section", { id: "files", "aria-labelledby": "files-heading", className: "flex scroll-mt-4 flex-col gap-4", children: [
211
+ /* @__PURE__ */ jsxs("h2", { id: "files-heading", className: "m-0 flex flex-wrap items-baseline gap-3 border-b-2 border-edge-subtle pb-2 font-display text-xl font-bold uppercase", children: [
212
+ "Files changed ",
213
+ /* @__PURE__ */ jsx(ChangeCount, { added, removed, noun: ["line", "lines"] })
214
+ ] }),
215
+ /* @__PURE__ */ jsx(ChangeIndex, { label: "Files changed", groups: [{ title: `${files.length} file${files.length === 1 ? "" : "s"}`, files: files.map(({ path, added: a, removed: r }) => ({ path, added: a, removed: r })) }] }),
216
+ files.map((file) => /* @__PURE__ */ jsx(DiffView, { path: file.path, hunks: file.hunks, max, defaultOpen: file.hunks.some((hunk) => hunk.lines.some((line) => (line.comments?.length ?? 0) > 0)) }, file.path))
217
+ ] })
218
+ ] });
219
+ });
220
+ export {
221
+ PullRequestPage
222
+ };
223
+ //# sourceMappingURL=PullRequestPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/PullRequestPage.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../lib/recipe';\nimport { ChangeCount } from './ChangeCount';\nimport { ChangeIndex } from './ChangeIndex';\nimport { DiffView } from './DiffView';\nimport { StatusMark } from './StatusMark';\nimport { VerdictBand } from './VerdictBand';\nimport { countDiff, type DiffHunk } from './diff';\nimport { STATUS_APPEARANCE, STATUS_TONE_TEXT, type AssessmentOutcome, type StatusTone } from './vocabulary';\n\nexport type PullRequestState = 'open' | 'draft' | 'merged' | 'closed';\nexport type ReviewerState = 'approved' | 'changes-requested' | 'commented' | 'pending';\n\n/** The status panel's reason, under its headline. A finished pull request says how it finished; only an open one weighs checks and reviews. */\nfunction mergeSummary(pr: Pick<PullRequestData, 'state' | 'base' | 'reviewers'>, failing: number): string {\n if (pr.state === 'merged') return `Merged into ${pr.base}.`;\n if (pr.state === 'closed') return 'Closed without merging.';\n const checks = failing > 0 ? `${failing} failing check${failing === 1 ? '' : 's'}.` : 'No failing checks.';\n if (pr.state === 'draft') return `${checks} Still a draft, so it cannot merge yet.`;\n const blocking = pr.reviewers.filter((r) => r.state === 'changes-requested').map((r) => r.name);\n if (blocking.length > 0) return `Changes requested by ${blocking.join(' and ')}. ${checks}`;\n if (pr.reviewers.length > 0 && pr.reviewers.every((r) => r.state === 'approved')) return `${checks} Approved.`;\n return `${checks} Waiting on review.`;\n}\n\n/** The status panel's headline and its tone: whether this can merge, before any reason why. */\nfunction mergeHeadline(pr: Pick<PullRequestData, 'state' | 'reviewers'>, failing: number): { title: string; tone: StatusTone } {\n if (pr.state === 'merged') return { title: 'Merged', tone: 'success' };\n if (pr.state === 'closed') return { title: 'Closed', tone: 'neutral' };\n if (pr.state === 'draft') return { title: 'Draft', tone: 'hollow' };\n if (failing > 0 || pr.reviewers.some((r) => r.state === 'changes-requested')) return { title: 'Cannot merge yet', tone: 'danger' };\n if (pr.reviewers.length > 0 && pr.reviewers.every((r) => r.state === 'approved')) return { title: 'Ready to merge', tone: 'success' };\n return { title: 'Waiting on review', tone: 'warning' };\n}\n\nconst TONE_RULE: Record<StatusTone, string> = {\n success: 'border-intent-success',\n warning: 'border-intent-warning',\n danger: 'border-intent-danger',\n info: 'border-intent-info',\n neutral: 'border-edge-strong',\n hollow: 'border-edge-default',\n};\n\n/** Worst first, so the tally reads as what needs attention. */\nconst OUTCOME_ORDER: readonly AssessmentOutcome[] = ['fail', 'warn', 'needs-review', 'inconclusive', 'none', 'pass'];\nconst REVIEWER_ORDER: readonly ReviewerState[] = ['changes-requested', 'pending', 'commented', 'approved'];\n\n/** One CI check. Its status is an Assessment outcome, because a check is a policy that ran. */\nexport interface PullRequestCheck {\n name: string;\n status: AssessmentOutcome;\n /** Replaces the printed status word, e.g. `pending` for a queued run drawn as `inconclusive`. */\n label?: string;\n /** One line on what it found. */\n summary?: string;\n /** Pre-formatted, e.g. `6m 12s`. */\n duration?: string;\n}\n\n/** Everything a pull request page shows. */\nexport interface PullRequestData {\n /** `owner/name`. */\n repository: string;\n number: number;\n title: string;\n state: PullRequestState;\n author: string;\n /** The branch merged into. */\n base: string;\n /** The branch merged from. */\n head: string;\n /** Pre-formatted, e.g. `opened 23 Oct 2026`. Formatted by the caller so a render never reads the clock. */\n opened: string;\n labels?: readonly string[];\n /** The description, one paragraph per entry. */\n description: readonly ReactNode[];\n reviewers: readonly { name: string; state: ReviewerState }[];\n checks: readonly PullRequestCheck[];\n /** A comparison tool's summary of the change, drawn as a verdict band at the top of the conversation. */\n verdict?: { outcome: AssessmentOutcome; title: string; context?: string };\n /** Top-level comments, oldest first. */\n conversation?: readonly { author: string; meta?: string; body: ReactNode }[];\n /** Changed files. Lines may carry review comments. */\n files: readonly { path: string; hunks: readonly DiffHunk[] }[];\n}\n\nexport interface PullRequestPageProps extends React.HTMLAttributes<HTMLElement> {\n /** The pull request to draw. `DEFAULT_PULL_REQUEST` is a sample to start from. */\n pullRequest: PullRequestData;\n /** Additional classes for the page. */\n className?: string;\n}\n\nconst STATE: Record<PullRequestState, { glyph: string; tone: string }> = {\n open: { glyph: '●', tone: 'border-accent-primary text-accent-primary' },\n draft: { glyph: '○', tone: 'border-dashed border-content-muted text-content-muted' },\n merged: { glyph: '◆', tone: 'border-accent-secondary text-accent-secondary' },\n closed: { glyph: '✕', tone: 'border-content-secondary text-content-secondary' },\n};\n\nconst REVIEWER: Record<ReviewerState, { glyph: string; tone: StatusTone; word: string }> = {\n approved: { glyph: '✓', tone: 'success', word: 'approved' },\n 'changes-requested': { glyph: '✕', tone: 'danger', word: 'changes requested' },\n commented: { glyph: '●', tone: 'neutral', word: 'commented' },\n pending: { glyph: '○', tone: 'hollow', word: 'review pending' },\n};\n\nconst label = 'font-mono text-xs font-bold uppercase tracking-wider text-content-muted';\n\n/** A section link above the header's own rule: an accent underline on hover, not a boxed tab. */\nconst TAB = 'pb-3 pt-1 text-content-primary no-underline decoration-accent-primary decoration-[3px] underline-offset-[0.6rem] hover:underline focus-visible:underline';\n\n/** A comment is a quoted voice, not a panel: a rule beside it, the author above it, no box. */\nfunction Comment({ author, meta, children }: { author: string; meta?: string; children: ReactNode }) {\n return (\n <article className=\"flex flex-col gap-1.5 border-l-2 border-edge-subtle pl-4\">\n <header className=\"flex flex-wrap items-baseline gap-x-2 font-mono text-xs\">\n <span className=\"font-bold text-content-primary\">{author}</span>\n {meta ? <span className=\"text-content-muted\">{meta}</span> : null}\n </header>\n <div className=\"text-sm text-content-primary\">{children}</div>\n </article>\n );\n}\n\n/** Counts per status, worst first, each in its own tone with its glyph and word. */\nfunction Tally({ label: name, items }: { label: string; items: readonly { key: string; count: number; glyph: string; tone: StatusTone; word: string }[] }) {\n return (\n <div className=\"flex flex-wrap items-baseline gap-x-4 gap-y-1\">\n <span className={cn(label, 'w-16 shrink-0')}>{name}</span>\n <ul aria-label={name} className=\"m-0 flex list-none flex-wrap gap-x-3 gap-y-1 p-0 font-mono text-xs\">\n {items.map((item) => (\n <li key={item.key} className={cn('inline-flex items-baseline gap-1', STATUS_TONE_TEXT[item.tone])}>\n <span aria-hidden=\"true\">{item.glyph}</span>\n <span className=\"font-bold tabular-nums\">{item.count}</span>\n <span>{item.word}</span>\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n/**\n * A pull request under review, the page a code host shows: title and state, the branches, a\n * conversation led by a comparison tool's verdict, reviewers and labels in a side rail, the\n * checks as status marks, and the changed files as line diffs with review comments pinned under\n * their lines.\n *\n * The first phone screen answers whether it can merge: the header carries a status panel with\n * the merge headline, the reason, and the checks and reviews as tallies, worst first. Below the\n * fold the detail stays, quieter: comments are rules rather than boxes, passing checks fold, and\n * only files with review comments open.\n *\n * Static: the section links are anchors, the files fold as `<details>`, and nothing posts. A\n * check is drawn with the Assessment vocabulary because a check is a policy that ran; the files\n * use the `delta` roles because a diff is not a verdict.\n */\nexport const PullRequestPage = React.forwardRef<HTMLElement, PullRequestPageProps>(function PullRequestPage(\n { pullRequest: pr, className, ...rest },\n ref,\n) {\n const files = pr.files.map((file) => ({ ...file, ...countDiff(file.hunks) }));\n const added = files.reduce((sum, file) => sum + file.added, 0);\n const removed = files.reduce((sum, file) => sum + file.removed, 0);\n const max = Math.max(1, ...files.map((file) => file.added + file.removed));\n const commentCount = files.reduce((sum, file) => sum + file.hunks.reduce((n, hunk) => n + hunk.lines.reduce((m, line) => m + (line.comments?.length ?? 0), 0), 0), 0);\n const failing = pr.checks.filter((check) => check.status === 'fail').length;\n const state = STATE[pr.state];\n const headline = mergeHeadline(pr, failing);\n const checkTally = OUTCOME_ORDER.flatMap((status) => {\n const matching = pr.checks.filter((check) => check.status === status);\n if (matching.length === 0) return [];\n const look = STATUS_APPEARANCE.outcome[status];\n // A queued run is drawn `inconclusive` but labelled `pending`; the tally says what the rows say.\n const word = matching.every((check) => check.label === matching[0]!.label) && matching[0]!.label ? matching[0]!.label : look.word;\n return [{ key: status, count: matching.length, glyph: look.glyph, tone: look.tone, word }];\n });\n const reviewTally = REVIEWER_ORDER.flatMap((reviewState) => {\n const count = pr.reviewers.filter((reviewer) => reviewer.state === reviewState).length;\n return count === 0 ? [] : [{ key: reviewState, count, ...REVIEWER[reviewState], word: REVIEWER[reviewState].word.replace('review ', '') }];\n });\n const passing = pr.checks.filter((check) => check.status === 'pass');\n const attention = pr.checks.filter((check) => check.status !== 'pass');\n\n return (\n <main ref={ref} data-slot=\"pull-request-page\" {...rest} className={cn('mx-auto flex w-full max-w-6xl flex-col gap-8 px-4 py-8 font-sans text-content-primary sm:px-6', className)}>\n <header className=\"flex flex-col gap-3 border-b-4 border-edge-strong\">\n <p className=\"m-0 font-mono text-xs font-bold uppercase tracking-widest text-content-muted\">\n [ {pr.repository} · pull request #{pr.number} ]\n </p>\n <h1 className=\"m-0 font-display text-2xl font-bold leading-tight sm:text-3xl\">\n {pr.title} <span className=\"font-normal text-content-muted\">#{pr.number}</span>\n </h1>\n <div className=\"flex flex-wrap items-center gap-x-3 gap-y-2 text-sm\">\n <span data-slot=\"pull-request-state\" className={cn('inline-flex items-center gap-1.5 border px-2 py-1 font-mono text-xs font-bold uppercase tracking-wider', state.tone)}>\n <span aria-hidden=\"true\">{state.glyph}</span>\n {pr.state}\n </span>\n <span className=\"text-xs text-content-secondary sm:text-sm\">\n <span className=\"font-mono font-bold text-content-primary\">{pr.author}</span> wants to merge{' '}\n <code className=\"border border-edge-subtle bg-surface-sunken px-1.5 font-mono text-xs\">{pr.head}</code> into{' '}\n <code className=\"border border-edge-subtle bg-surface-sunken px-1.5 font-mono text-xs\">{pr.base}</code> · {pr.opened}\n </span>\n </div>\n <section data-slot=\"pull-request-status\" aria-label=\"Merge status\" className={cn('flex flex-col gap-2.5 border-l-4 bg-surface-sunken px-4 py-3', TONE_RULE[headline.tone])}>\n <p className={cn('m-0 font-display text-xl font-bold leading-tight', STATUS_TONE_TEXT[headline.tone])}>{headline.title}</p>\n <p className=\"m-0 text-sm text-content-secondary\">{mergeSummary(pr, failing)}</p>\n {pr.state === 'open' || pr.state === 'draft' ? (\n <div className=\"flex flex-col gap-1.5\">\n <Tally label=\"Checks\" items={checkTally} />\n {reviewTally.length > 0 ? <Tally label=\"Reviews\" items={reviewTally} /> : null}\n </div>\n ) : null}\n </section>\n <nav aria-label=\"Pull request sections\" className=\"mt-1 flex max-w-full flex-wrap gap-x-6 font-mono text-xs font-bold uppercase tracking-wider\">\n <a href=\"#conversation\" className={TAB}>Conversation</a>\n <a href=\"#checks\" className={TAB}>\n Checks <span className=\"text-content-muted\">{pr.checks.length}</span>\n </a>\n <a href=\"#files\" className={cn(TAB, 'flex items-center gap-2')}>\n Files changed <span className=\"text-content-muted\">{files.length}</span>\n <ChangeCount added={added} removed={removed} noun={['line', 'lines']} className=\"text-xs\" />\n </a>\n </nav>\n </header>\n\n <div className=\"grid gap-8 lg:grid-cols-[minmax(0,1fr)_16rem]\">\n <section id=\"conversation\" aria-label=\"Conversation\" className=\"flex min-w-0 scroll-mt-4 flex-col gap-4\">\n {pr.verdict ? (\n <VerdictBand outcome={pr.verdict.outcome} title={pr.verdict.title}>\n {pr.verdict.context}\n </VerdictBand>\n ) : null}\n <Comment author={pr.author} meta=\"opened this pull request\">\n <div className=\"flex flex-col gap-2\">\n {pr.description.map((paragraph, i) => (\n <p key={i} className=\"m-0\">{paragraph}</p>\n ))}\n </div>\n </Comment>\n {pr.conversation?.map((entry, i) => (\n <Comment key={i} author={entry.author} meta={entry.meta}>\n {entry.body}\n </Comment>\n ))}\n <p className=\"m-0 font-mono text-xs text-content-muted\">\n {commentCount} review comment{commentCount === 1 ? '' : 's'} on the changed files.\n </p>\n </section>\n\n <aside aria-label=\"Details\" className=\"flex flex-col gap-6 text-sm\">\n <section className=\"flex flex-col gap-2\">\n <h2 className={cn('m-0', label)}>Reviewers</h2>\n <ul className=\"m-0 flex list-none flex-col gap-2 p-0\">\n {pr.reviewers.map((reviewer) => {\n const look = REVIEWER[reviewer.state];\n return (\n <li key={reviewer.name} className=\"flex items-center justify-between gap-2\">\n <span className=\"font-mono\">{reviewer.name}</span>\n <span className={cn('inline-flex items-center gap-1 font-mono text-xs font-bold uppercase tracking-wider', STATUS_TONE_TEXT[look.tone])}>\n <span aria-hidden=\"true\">{look.glyph}</span>\n {look.word}\n </span>\n </li>\n );\n })}\n </ul>\n </section>\n {pr.labels && pr.labels.length > 0 ? (\n <section className=\"flex flex-col gap-2\">\n <h2 className={cn('m-0', label)}>Labels</h2>\n <ul className=\"m-0 flex list-none flex-wrap gap-2 p-0\">\n {pr.labels.map((name) => (\n <li key={name} className=\"border border-edge-subtle bg-surface-sunken px-1.5 py-0.5 font-mono text-xs\">{name}</li>\n ))}\n </ul>\n </section>\n ) : null}\n </aside>\n </div>\n\n <section id=\"checks\" aria-labelledby=\"checks-heading\" className=\"flex scroll-mt-4 flex-col gap-3\">\n <h2 id=\"checks-heading\" className=\"m-0 border-b-2 border-edge-subtle pb-2 font-display text-xl font-bold uppercase\">Checks</h2>\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {attention.map((check) => (\n <li key={check.name} data-slot=\"pull-request-check\" className=\"grid grid-cols-[minmax(7.5rem,auto)_minmax(0,1fr)] items-start gap-x-4 gap-y-1 border-b border-edge-subtle py-2.5 last:border-b-0 sm:grid-cols-[minmax(9rem,auto)_minmax(0,1fr)_auto]\">\n <StatusMark vocabulary=\"outcome\" status={check.status} label={check.label} className=\"w-fit\" />\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"font-mono text-sm font-bold [overflow-wrap:anywhere]\">{check.name}</span>\n {check.summary ? <span className=\"text-sm text-content-secondary\">{check.summary}</span> : null}\n </div>\n {check.duration ? <span className=\"col-start-2 font-mono text-xs tabular-nums text-content-muted sm:col-start-auto\">{check.duration}</span> : null}\n </li>\n ))}\n </ul>\n {passing.length > 0 ? (\n <details data-slot=\"pull-request-passing\" className=\"group\">\n <summary className=\"flex cursor-pointer list-none items-baseline gap-2 py-1 font-mono text-xs font-bold uppercase tracking-wider text-intent-success [&::-webkit-details-marker]:hidden\">\n <span aria-hidden=\"true\" className=\"text-content-muted group-open:hidden\">[+]</span>\n <span aria-hidden=\"true\" className=\"hidden text-content-muted group-open:inline\">[−]</span>\n ✓ {passing.length} passing\n </summary>\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {passing.map((check) => (\n <li key={check.name} data-slot=\"pull-request-check\" className=\"grid grid-cols-[minmax(7.5rem,auto)_minmax(0,1fr)] items-start gap-x-4 gap-y-1 border-b border-edge-subtle py-2.5 last:border-b-0 sm:grid-cols-[minmax(9rem,auto)_minmax(0,1fr)_auto]\">\n <StatusMark vocabulary=\"outcome\" status={check.status} label={check.label} className=\"w-fit\" />\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"font-mono text-sm font-bold [overflow-wrap:anywhere]\">{check.name}</span>\n {check.summary ? <span className=\"text-sm text-content-secondary\">{check.summary}</span> : null}\n </div>\n {check.duration ? <span className=\"col-start-2 font-mono text-xs tabular-nums text-content-muted sm:col-start-auto\">{check.duration}</span> : null}\n </li>\n ))}\n </ul>\n </details>\n ) : null}\n </section>\n\n <section id=\"files\" aria-labelledby=\"files-heading\" className=\"flex scroll-mt-4 flex-col gap-4\">\n <h2 id=\"files-heading\" className=\"m-0 flex flex-wrap items-baseline gap-3 border-b-2 border-edge-subtle pb-2 font-display text-xl font-bold uppercase\">\n Files changed <ChangeCount added={added} removed={removed} noun={['line', 'lines']} />\n </h2>\n <ChangeIndex label=\"Files changed\" groups={[{ title: `${files.length} file${files.length === 1 ? '' : 's'}`, files: files.map(({ path, added: a, removed: r }) => ({ path, added: a, removed: r })) }]} />\n {files.map((file) => (\n <DiffView key={file.path} path={file.path} hunks={file.hunks} max={max} defaultOpen={file.hunks.some((hunk) => hunk.lines.some((line) => (line.comments?.length ?? 0) > 0))} />\n ))}\n </section>\n </main>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,iBAAgC;AACzC,SAAS,mBAAmB,wBAAiE;AA6GvF,SACE,KADF;AAvGN,SAAS,aAAa,IAA2D,SAAyB;AACxG,MAAI,GAAG,UAAU,SAAU,QAAO,eAAe,GAAG,IAAI;AACxD,MAAI,GAAG,UAAU,SAAU,QAAO;AAClC,QAAM,SAAS,UAAU,IAAI,GAAG,OAAO,iBAAiB,YAAY,IAAI,KAAK,GAAG,MAAM;AACtF,MAAI,GAAG,UAAU,QAAS,QAAO,GAAG,MAAM;AAC1C,QAAM,WAAW,GAAG,UAAU,OAAO,CAAC,MAAM,EAAE,UAAU,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI;AAC9F,MAAI,SAAS,SAAS,EAAG,QAAO,wBAAwB,SAAS,KAAK,OAAO,CAAC,KAAK,MAAM;AACzF,MAAI,GAAG,UAAU,SAAS,KAAK,GAAG,UAAU,MAAM,CAAC,MAAM,EAAE,UAAU,UAAU,EAAG,QAAO,GAAG,MAAM;AAClG,SAAO,GAAG,MAAM;AAClB;AAGA,SAAS,cAAc,IAAkD,SAAsD;AAC7H,MAAI,GAAG,UAAU,SAAU,QAAO,EAAE,OAAO,UAAU,MAAM,UAAU;AACrE,MA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AM,IAAI,CAAC,EAAE,MAAM,OAAO,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,GAAG;AAAA,MACvM,MAAM,IAAI,CAAC,SACV,oBAAC,YAAyB,MAAM,KAAK,MAAM,OAAO,KAAK,OAAO,KAAU,aAAa,KAAK,MAAM,KAAK,CAAC,SAAS,KAAK,MAAM,KAAK,CAAC,UAAU,KAAK,UAAU,UAAU,KAAK,CAAC,CAAC,KAA3J,KAAK,IAAyJ,CAC9K;AAAA,OACH;AAAA,KACF;AAEJ,CAAC;","names":["PullRequestPage"]}
@@ -0,0 +1,111 @@
1
+ // src/components/review/ReviewReportPage.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { ReportDocument, ReportSection } from "../ReportDocument.js";
5
+ import { ChangeIndex } from "./ChangeIndex.js";
6
+ import { DeltaValue } from "./DeltaValue.js";
7
+ import { DiffView } from "./DiffView.js";
8
+ import { KeyedDiff } from "./KeyedDiff.js";
9
+ import { ProvenanceStrip } from "./ProvenanceStrip.js";
10
+ import { VerdictBand } from "./VerdictBand.js";
11
+ import { countDiff } from "./diff.js";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ var DIRECTION_MARK = { "lower-is-better": "\u2193", "higher-is-better": "\u2191" };
14
+ function ColumnHead({ column }) {
15
+ return /* @__PURE__ */ jsxs("th", { scope: "col", className: "whitespace-nowrap border-b border-edge-default px-3 py-2 text-right font-mono text-xs font-bold uppercase tracking-wider text-content-muted", children: [
16
+ column.label,
17
+ column.direction ? /* @__PURE__ */ jsxs(Fragment, { children: [
18
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "pl-1", children: DIRECTION_MARK[column.direction] }),
19
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: `, ${column.direction.replace(/-/g, " ")}` })
20
+ ] }) : null
21
+ ] });
22
+ }
23
+ function valueCell(column, value, key) {
24
+ return /* @__PURE__ */ jsx(
25
+ DeltaValue,
26
+ {
27
+ before: value?.before,
28
+ after: value?.after,
29
+ direction: value?.direction ?? column.direction,
30
+ unit: value?.unit ?? column.unit
31
+ },
32
+ key
33
+ );
34
+ }
35
+ function MeasurementTable({ table }) {
36
+ const captionId = React.useId();
37
+ return (
38
+ // A wide table scrolls sideways; the region takes focus so the keyboard can scroll it too.
39
+ /* @__PURE__ */ jsx("div", { "data-slot": "review-report-measurements", role: "region", tabIndex: 0, "aria-labelledby": captionId, className: "overflow-x-auto border-t-2 border-edge-strong", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-sm [&_tbody_tr:last-child>*]:border-b-0", children: [
40
+ /* @__PURE__ */ jsx("caption", { id: captionId, className: "px-3 py-2.5 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted", children: table.caption }),
41
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
42
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "border-b border-edge-default px-3 py-2 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted", children: table.identityLabel }),
43
+ table.columns.map((column) => /* @__PURE__ */ jsx(ColumnHead, { column }, column.label))
44
+ ] }) }),
45
+ /* @__PURE__ */ jsx("tbody", { children: table.rows.map((row) => /* @__PURE__ */ jsxs("tr", { children: [
46
+ /* @__PURE__ */ jsx("th", { scope: "row", className: "border-b border-edge-subtle px-3 py-2 text-left font-mono font-normal text-content-primary", children: row.identity }),
47
+ table.columns.map((column, c) => /* @__PURE__ */ jsx("td", { className: "border-b border-edge-subtle px-3 py-2 text-right", children: valueCell(column, row.values[c], c) }, column.label))
48
+ ] }, row.identity)) })
49
+ ] }) })
50
+ );
51
+ }
52
+ var ReviewReportPage = React.forwardRef(function ReviewReportPage2({ report, className, ...rest }, ref) {
53
+ const measured = (report.measurements?.length ?? 0) > 0;
54
+ const sized = report.files.map((group) => ({
55
+ title: group.title,
56
+ files: group.files.map((file) => ({ ...file, ...countDiff(file.hunks) }))
57
+ }));
58
+ const all = sized.flatMap((group) => group.files);
59
+ const max = Math.max(1, ...all.map((file) => file.added + file.removed));
60
+ const largest = all.reduce((best, file) => !best || file.added + file.removed > best.added + best.removed ? file : best, void 0);
61
+ return /* @__PURE__ */ jsxs(
62
+ ReportDocument,
63
+ {
64
+ ref,
65
+ "data-slot": "review-report-page",
66
+ title: report.title,
67
+ subtitle: report.subtitle,
68
+ meta: report.meta,
69
+ ...rest,
70
+ className: cn("max-w-6xl", className),
71
+ children: [
72
+ /* @__PURE__ */ jsx(VerdictBand, { outcome: report.outcome, title: report.verdict, children: report.verdictContext }),
73
+ /* @__PURE__ */ jsx(ProvenanceStrip, { items: report.provenance }),
74
+ report.figures && report.figures.length > 0 ? /* @__PURE__ */ jsx("dl", { "data-slot": "review-report-figures", className: "m-0 grid grid-cols-[repeat(auto-fit,minmax(min(100%,11rem),1fr))] border-y border-edge-subtle", children: report.figures.map((figure) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col-reverse gap-1.5 border-l border-dashed border-edge-subtle px-4 py-3.5 first:border-l-0 first:pl-0", children: [
75
+ figure.note ? /* @__PURE__ */ jsx("dd", { className: "m-0 text-xs text-content-secondary", children: figure.note }) : null,
76
+ /* @__PURE__ */ jsx("dd", { className: "m-0 font-display text-2xl font-bold tabular-nums", children: figure.value }),
77
+ /* @__PURE__ */ jsx("dt", { className: "font-mono text-[0.7rem] font-bold uppercase tracking-[0.08em] text-content-muted", children: figure.label })
78
+ ] }, figure.label)) }) : null,
79
+ measured || (report.caveats?.length ?? 0) > 0 ? /* @__PURE__ */ jsxs(ReportSection, { title: measured ? "Measured drift" : "Caveats", children: [
80
+ measured ? /* @__PURE__ */ jsx("p", { className: "m-0 max-w-3xl text-sm text-content-secondary", children: "Each measurement with its direction. Red with \u25B2 or \u25BC in bold marks a move against the preferred direction, green a move with it; a move under 2% stays uncoloured as noise. That says which way the number went, not whether it is acceptable: that is for a policy to decide." }) : null,
81
+ report.measurements?.map((table) => /* @__PURE__ */ jsx(MeasurementTable, { table }, table.caption)),
82
+ report.caveats?.map((caveat) => /* @__PURE__ */ jsxs("div", { "data-slot": "review-report-caveat", className: "flex flex-col gap-1.5 border-l-4 border-accent-quiet bg-surface-sunken px-4 py-3", children: [
83
+ /* @__PURE__ */ jsx("p", { className: "m-0 font-mono text-xs font-bold uppercase tracking-wider text-content-primary", children: caveat.title }),
84
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-content-secondary", children: caveat.body })
85
+ ] }, caveat.title))
86
+ ] }) : null,
87
+ report.records ? /* @__PURE__ */ jsx(ReportSection, { title: "Records by identity", children: /* @__PURE__ */ jsx(
88
+ KeyedDiff,
89
+ {
90
+ caption: report.records.caption,
91
+ identityLabel: report.records.identityLabel,
92
+ columns: report.records.columns.map((column) => column.direction ? `${column.label} ${DIRECTION_MARK[column.direction]}` : column.label),
93
+ rows: report.records.rows.map((row) => ({
94
+ identity: row.identity,
95
+ change: row.change,
96
+ cells: report.records.columns.map((column, c) => valueCell(column, row.values[c], c))
97
+ }))
98
+ }
99
+ ) }) : null,
100
+ /* @__PURE__ */ jsxs(ReportSection, { title: "Changed files", children: [
101
+ /* @__PURE__ */ jsx(ChangeIndex, { label: "Changed files", groups: sized.map((group) => ({ title: group.title, files: group.files.map(({ path, added, removed }) => ({ path, added, removed })) })) }),
102
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: all.map((file) => /* @__PURE__ */ jsx(DiffView, { path: file.path, hunks: file.hunks, max, defaultOpen: file === largest }, file.path)) })
103
+ ] })
104
+ ]
105
+ }
106
+ );
107
+ });
108
+ export {
109
+ ReviewReportPage
110
+ };
111
+ //# sourceMappingURL=ReviewReportPage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/ReviewReportPage.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../lib/recipe';\nimport { ReportDocument, ReportSection, type ReportMetaItem } from '../ReportDocument';\nimport { ChangeIndex } from './ChangeIndex';\nimport { DeltaValue, type MetricDirection } from './DeltaValue';\nimport { DiffView } from './DiffView';\nimport { KeyedDiff, type KeyedChange } from './KeyedDiff';\nimport { ProvenanceStrip, type ProvenanceItem } from './ProvenanceStrip';\nimport { VerdictBand } from './VerdictBand';\nimport { countDiff, type DiffHunk } from './diff';\nimport type { AssessmentOutcome } from './vocabulary';\n\n/** One measured value: the baseline's and the candidate's. A `direction` here overrides the column's. */\nexport interface ReviewValue {\n before?: number | null;\n after?: number | null;\n direction?: MetricDirection;\n unit?: string;\n}\n\nexport interface ReviewColumn {\n /** The measurement's name. Its direction, if any, is printed beside it. */\n label: string;\n direction?: MetricDirection;\n unit?: string;\n}\n\n/** A table of numeric deltas, one row per subject, one column per measurement. */\nexport interface ReviewMeasurementTable {\n caption: string;\n /** Heading for the subject column. */\n identityLabel: string;\n columns: readonly ReviewColumn[];\n rows: readonly { identity: string; values: readonly ReviewValue[] }[];\n}\n\n/** Records compared by stable identity, each with its measured values. */\nexport interface ReviewRecordTable {\n caption: string;\n identityLabel: string;\n columns: readonly ReviewColumn[];\n rows: readonly { identity: string; change: KeyedChange; values: readonly ReviewValue[] }[];\n}\n\n/** A group of changed files, each with its hunks. */\nexport interface ReviewFileGroup {\n title: string;\n files: readonly { path: string; hunks: readonly DiffHunk[] }[];\n}\n\n/** Everything a review report shows, in the order it shows it. */\nexport interface ReviewReportData {\n title: string;\n /** One line saying what was compared. */\n subtitle?: string;\n /** The header strip: comparator, Delta status, policy. */\n meta?: readonly ReportMetaItem[];\n /** The Assessment's outcome, or `none` when no policy ran. */\n outcome: AssessmentOutcome;\n /** The verdict line. */\n verdict: string;\n /** One line of context under it. */\n verdictContext?: string;\n /** What the result can be traced back to. */\n provenance: readonly ProvenanceItem[];\n /** Headline counts, read before the detail. */\n figures?: readonly { label: string; value: string; note?: string }[];\n /** Numeric deltas. */\n measurements?: readonly ReviewMeasurementTable[];\n /** Records compared by stable identity. */\n records?: ReviewRecordTable;\n /** Methodology or coverage notes that qualify a measurement. Never a verdict. */\n caveats?: readonly { title: string; body: ReactNode }[];\n /** The changed files, grouped. */\n files: readonly ReviewFileGroup[];\n}\n\nexport interface ReviewReportPageProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** The report to draw. `DEFAULT_REVIEW_REPORT` is a real comparison to start from. */\n report: ReviewReportData;\n /** Additional classes for the document. */\n className?: string;\n}\n\nconst DIRECTION_MARK: Record<MetricDirection, string> = { 'lower-is-better': '↓', 'higher-is-better': '↑' };\n\nfunction ColumnHead({ column }: { column: ReviewColumn }) {\n return (\n <th scope=\"col\" className=\"whitespace-nowrap border-b border-edge-default px-3 py-2 text-right font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">\n {column.label}\n {column.direction ? (\n <>\n <span aria-hidden=\"true\" className=\"pl-1\">{DIRECTION_MARK[column.direction]}</span>\n <span className=\"sr-only\">{`, ${column.direction.replace(/-/g, ' ')}`}</span>\n </>\n ) : null}\n </th>\n );\n}\n\nfunction valueCell(column: ReviewColumn, value: ReviewValue | undefined, key: React.Key) {\n return (\n <DeltaValue\n key={key}\n before={value?.before}\n after={value?.after}\n direction={value?.direction ?? column.direction}\n unit={value?.unit ?? column.unit}\n />\n );\n}\n\nfunction MeasurementTable({ table }: { table: ReviewMeasurementTable }) {\n const captionId = React.useId();\n return (\n // A wide table scrolls sideways; the region takes focus so the keyboard can scroll it too.\n <div data-slot=\"review-report-measurements\" role=\"region\" tabIndex={0} aria-labelledby={captionId} className=\"overflow-x-auto border-t-2 border-edge-strong\">\n <table className=\"w-full border-collapse text-sm [&_tbody_tr:last-child>*]:border-b-0\">\n <caption id={captionId} className=\"px-3 py-2.5 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">{table.caption}</caption>\n <thead>\n <tr>\n <th scope=\"col\" className=\"border-b border-edge-default px-3 py-2 text-left font-mono text-xs font-bold uppercase tracking-wider text-content-muted\">{table.identityLabel}</th>\n {table.columns.map((column) => (\n <ColumnHead key={column.label} column={column} />\n ))}\n </tr>\n </thead>\n <tbody>\n {table.rows.map((row) => (\n <tr key={row.identity}>\n <th scope=\"row\" className=\"border-b border-edge-subtle px-3 py-2 text-left font-mono font-normal text-content-primary\">{row.identity}</th>\n {table.columns.map((column, c) => (\n <td key={column.label} className=\"border-b border-edge-subtle px-3 py-2 text-right\">{valueCell(column, row.values[c], c)}</td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\n/**\n * A whole review report, the document a comparison tool such as Diffra emits: the verdict, its\n * provenance, headline figures, numeric deltas with their directions, records by stable identity,\n * methodology caveats, then every changed file indexed and drawn as a line diff.\n *\n * Static-safe throughout, so it renders the same in an application and in a `ds-report` file.\n * The largest file opens by default; the rest fold. Change is drawn in the `delta` roles and only\n * the verdict and status marks use `intent`.\n */\nexport const ReviewReportPage = React.forwardRef<HTMLElement, ReviewReportPageProps>(function ReviewReportPage(\n { report, className, ...rest },\n ref,\n) {\n const measured = (report.measurements?.length ?? 0) > 0;\n const sized = report.files.map((group) => ({\n title: group.title,\n files: group.files.map((file) => ({ ...file, ...countDiff(file.hunks) })),\n }));\n const all = sized.flatMap((group) => group.files);\n const max = Math.max(1, ...all.map((file) => file.added + file.removed));\n const largest = all.reduce<(typeof all)[number] | undefined>((best, file) => (!best || file.added + file.removed > best.added + best.removed ? file : best), undefined);\n\n return (\n <ReportDocument\n ref={ref}\n data-slot=\"review-report-page\"\n title={report.title}\n subtitle={report.subtitle}\n meta={report.meta}\n {...rest}\n className={cn('max-w-6xl', className)}\n >\n <VerdictBand outcome={report.outcome} title={report.verdict}>\n {report.verdictContext}\n </VerdictBand>\n <ProvenanceStrip items={report.provenance} />\n\n {report.figures && report.figures.length > 0 ? (\n <dl data-slot=\"review-report-figures\" className=\"m-0 grid grid-cols-[repeat(auto-fit,minmax(min(100%,11rem),1fr))] border-y border-edge-subtle\">\n {report.figures.map((figure) => (\n <div key={figure.label} className=\"flex flex-col-reverse gap-1.5 border-l border-dashed border-edge-subtle px-4 py-3.5 first:border-l-0 first:pl-0\">\n {figure.note ? <dd className=\"m-0 text-xs text-content-secondary\">{figure.note}</dd> : null}\n <dd className=\"m-0 font-display text-2xl font-bold tabular-nums\">{figure.value}</dd>\n <dt className=\"font-mono text-[0.7rem] font-bold uppercase tracking-[0.08em] text-content-muted\">{figure.label}</dt>\n </div>\n ))}\n </dl>\n ) : null}\n\n {/* Caveats qualify the evidence, not the tables: a report with no\n measurements can still carry them, so either one opens the section. */}\n {measured || (report.caveats?.length ?? 0) > 0 ? (\n <ReportSection title={measured ? 'Measured drift' : 'Caveats'}>\n {measured ? (\n <p className=\"m-0 max-w-3xl text-sm text-content-secondary\">\n Each measurement with its direction. Red with ▲ or ▼ in bold marks a move against the preferred direction, green a move with it; a move under 2% stays uncoloured as noise. That says which way the number went, not whether it is acceptable: that is for a policy to decide.\n </p>\n ) : null}\n {report.measurements?.map((table) => (\n <MeasurementTable key={table.caption} table={table} />\n ))}\n {report.caveats?.map((caveat) => (\n <div key={caveat.title} data-slot=\"review-report-caveat\" className=\"flex flex-col gap-1.5 border-l-4 border-accent-quiet bg-surface-sunken px-4 py-3\">\n <p className=\"m-0 font-mono text-xs font-bold uppercase tracking-wider text-content-primary\">{caveat.title}</p>\n <div className=\"text-sm text-content-secondary\">{caveat.body}</div>\n </div>\n ))}\n </ReportSection>\n ) : null}\n\n {report.records ? (\n <ReportSection title=\"Records by identity\">\n <KeyedDiff\n caption={report.records.caption}\n identityLabel={report.records.identityLabel}\n columns={report.records.columns.map((column) => (column.direction ? `${column.label} ${DIRECTION_MARK[column.direction]}` : column.label))}\n rows={report.records.rows.map((row) => ({\n identity: row.identity,\n change: row.change,\n cells: report.records!.columns.map((column, c) => valueCell(column, row.values[c], c)),\n }))}\n />\n </ReportSection>\n ) : null}\n\n <ReportSection title=\"Changed files\">\n <ChangeIndex label=\"Changed files\" groups={sized.map((group) => ({ title: group.title, files: group.files.map(({ path, added, removed }) => ({ path, added, removed })) }))} />\n <div className=\"flex flex-col gap-4\">\n {all.map((file) => (\n <DiffView key={file.path} path={file.path} hunks={file.hunks} max={max} defaultOpen={file === largest} />\n ))}\n </div>\n </ReportSection>\n </ReportDocument>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,gBAAgB,qBAA0C;AACnE,SAAS,mBAAmB;AAC5B,SAAS,kBAAwC;AACjD,SAAS,gBAAgB;AACzB,SAAS,iBAAmC;AAC5C,SAAS,uBAA4C;AACrD,SAAS,mBAAmB;AAC5B,SAAS,iBAAgC;AAkFjC,mBACE,KADF;AAPR,IAAM,iBAAkD,EAAE,mBAAmB,UAAK,oBAAoB,SAAI;AAE1G,SAAS,WAAW,EAAE,OAAO,GAA6B;AACxD,SACE,qBAAC,QAAG,OAAM,OAAM,WAAU,+IACvB;AAAA,WAAO;AAAA,IACP,OAAO,YACN,iCACE;AAAA,0BAAC,UAAK,eAAY,QAAO,WAAU,QAAQ,yBAAe,OAAO,SAAS,GAAE;AAAA,MAC5E,oBAAC,UAAK,WAAU,WAAW,eAAK,OAAO,UAAU,QAAQ,MAAM,GAAG,CAAC,IAAG;AAAA,OACxE,IACE;AAAA,KACN;AAEJ;AAEA,SAAS,UAAU,QAAsB,OAAgC,KAAgB;AACvF,SACE;AAAA,IAAC;AAAA;AAAA,MAEC,QAAQ,OAAO;AAAA,MACf,OAAO,OAAO;AAAA,MACd,WAAW,OAAO,aAAa,OAAO;AAAA,MACtC,MAAM,OAAO,QAAQ,OAAO;AAAA;AAAA,IAJvB;AAAA,EAKP;AAEJ;AAEA,SAAS,iBAAiB,EAAE,MAAM,GAAsC;AACtE,QAAM,YAAkB,YAAM;AAC9B;AAAA;AAAA,IAEE,oBAAC,SAAI,aAAU,8BAA6B,MAAK,UAAS,UAAU,GAAG,mBAAiB,WAAW,WAAU,iDAC3G,+BAAC,WAAM,WAAU,uEACf;AAAA,0BAAC,aAAQ,IAAI,WAAW,WAAU,iGAAiG,gBAAM,SAAQ;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YAAY,GAAG,OAAO,KAAK,IAAI,eAAe,OAAO,SAAS,CAAC,KAAK,OAAO,KAAM;AAAA,YACzI,MAAM,OAAO,QAAQ,KAAK,IAAI,CAAC,SAAS;AAAA,cACtC,UAAU,IAAI;AAAA,cACd,QAAQ,IAAI;AAAA,cACZ,OAAO,OAAO,QAAS,QAAQ,IAAI,CAAC,QAAQ,MAAM,UAAU,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;AAAA,YACvF,EAAE;AAAA;AAAA,QACJ,GACF,IACE;AAAA,QAEJ,qBAAC,iBAAc,OAAM,iBACnB;AAAA,8BAAC,eAAY,OAAM,iBAAgB,QAAQ,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,MAAM,OAAO,OAAO,MAAM,MAAM,IAAI,CAAC,EAAE,MAAM,OAAO,QAAQ,OAAO,EAAE,MAAM,OAAO,QAAQ,EAAE,EAAE,EAAE,GAAG;AAAA,UAC7K,oBAAC,SAAI,WAAU,uBACZ,cAAI,IAAI,CAAC,SACR,oBAAC,YAAyB,MAAM,KAAK,MAAM,OAAO,KAAK,OAAO,KAAU,aAAa,SAAS,WAA/E,KAAK,IAAmF,CACxG,GACH;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["ReviewReportPage"]}
@@ -0,0 +1,32 @@
1
+ // src/components/review/StatusMark.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { STATUS_TONE_TEXT, statusAppearance } from "./vocabulary.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ var StatusMark = React.forwardRef(function StatusMark2({ vocabulary, status, label, className, ...rest }, ref) {
7
+ const look = statusAppearance(vocabulary, status);
8
+ return /* @__PURE__ */ jsxs(
9
+ "span",
10
+ {
11
+ ref,
12
+ "data-slot": "status-mark",
13
+ "data-vocabulary": vocabulary,
14
+ "data-status": status,
15
+ ...rest,
16
+ className: cn(
17
+ "inline-flex items-center gap-1.5 whitespace-nowrap border border-current px-1.5 py-0.5 font-mono text-xs font-bold uppercase leading-none tracking-wider",
18
+ look.tone === "hollow" && "border-dashed",
19
+ STATUS_TONE_TEXT[look.tone],
20
+ className
21
+ ),
22
+ children: [
23
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: look.glyph }),
24
+ /* @__PURE__ */ jsx("span", { children: label ?? look.word })
25
+ ]
26
+ }
27
+ );
28
+ });
29
+ export {
30
+ StatusMark
31
+ };
32
+ //# sourceMappingURL=StatusMark.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/StatusMark.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/recipe';\nimport { STATUS_TONE_TEXT, statusAppearance, type StatusVocabularies, type StatusVocabulary } from './vocabulary';\n\ntype StatusMarkOwnProps = {\n [V in StatusVocabulary]: {\n /** Which document's words this status is from. */\n vocabulary: V;\n /** The status itself. The glyph, word and colour all follow from it. */\n status: StatusVocabularies[V];\n };\n}[StatusVocabulary];\n\nexport type StatusMarkProps = StatusMarkOwnProps &\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> & {\n /** Replaces the printed word, for a translated page. The glyph and colour stay. */\n label?: string;\n /** Additional classes for the mark. */\n className?: string;\n };\n\n/**\n * One status from a review's closed vocabularies — an Assessment outcome, a Delta or Evidence\n * status, or a Baseline's trust — drawn as a fixed glyph and word in a hairline mark — light enough to sit in a table cell\n * or a list row many times over.\n *\n * The colour repeats what the word says and never replaces it: `inconclusive`, `missing` and\n * `unavailable` share one dashed, muted treatment and are told apart by their words.\n */\nexport const StatusMark = React.forwardRef<HTMLSpanElement, StatusMarkProps>(function StatusMark(\n { vocabulary, status, label, className, ...rest },\n ref,\n) {\n const look = statusAppearance(vocabulary, status as never);\n return (\n <span\n ref={ref}\n data-slot=\"status-mark\"\n data-vocabulary={vocabulary}\n data-status={status}\n {...rest}\n className={cn(\n 'inline-flex items-center gap-1.5 whitespace-nowrap border border-current px-1.5 py-0.5 font-mono text-xs font-bold uppercase leading-none tracking-wider',\n look.tone === 'hollow' && 'border-dashed',\n STATUS_TONE_TEXT[look.tone],\n className,\n )}\n >\n <span aria-hidden=\"true\">{look.glyph}</span>\n <span>{label ?? look.word}</span>\n </span>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,kBAAkB,wBAAwE;AAiC/F,SAaE,KAbF;AANG,IAAM,aAAmB,iBAA6C,SAASA,YACpF,EAAE,YAAY,QAAQ,OAAO,WAAW,GAAG,KAAK,GAChD,KACA;AACA,QAAM,OAAO,iBAAiB,YAAY,MAAe;AACzD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,mBAAiB;AAAA,MACjB,eAAa;AAAA,MACZ,GAAG;AAAA,MACJ,WAAW;AAAA,QACT;AAAA,QACA,KAAK,SAAS,YAAY;AAAA,QAC1B,iBAAiB,KAAK,IAAI;AAAA,QAC1B;AAAA,MACF;AAAA,MAEA;AAAA,4BAAC,UAAK,eAAY,QAAQ,eAAK,OAAM;AAAA,QACrC,oBAAC,UAAM,mBAAS,KAAK,MAAK;AAAA;AAAA;AAAA,EAC5B;AAEJ,CAAC;","names":["StatusMark"]}