@rtkelly-labs/design-system 0.18.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 (77) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  3. package/dist/components/BracketText.js +3 -2
  4. package/dist/components/BracketText.js.map +1 -1
  5. package/dist/components/Button.js.map +1 -1
  6. package/dist/components/Card.js +2 -1
  7. package/dist/components/Card.js.map +1 -1
  8. package/dist/components/DataTable.js +135 -52
  9. package/dist/components/DataTable.js.map +1 -1
  10. package/dist/components/Divider.js +21 -14
  11. package/dist/components/Divider.js.map +1 -1
  12. package/dist/components/InlineAction.js +58 -0
  13. package/dist/components/InlineAction.js.map +1 -0
  14. package/dist/components/PageTitle.js +5 -1
  15. package/dist/components/PageTitle.js.map +1 -1
  16. package/dist/components/ResourceState.js +55 -0
  17. package/dist/components/ResourceState.js.map +1 -0
  18. package/dist/components/SocialIcon.js.map +1 -1
  19. package/dist/components/StatCard.js +2 -2
  20. package/dist/components/StatCard.js.map +1 -1
  21. package/dist/components/StatusPage.js.map +1 -1
  22. package/dist/components/docs/figures/ActivityGrid.js.map +1 -1
  23. package/dist/components/docs/figures/ChangeSummary.js +68 -25
  24. package/dist/components/docs/figures/ChangeSummary.js.map +1 -1
  25. package/dist/components/docs/figures/DrawingSheet.js +4 -1
  26. package/dist/components/docs/figures/DrawingSheet.js.map +1 -1
  27. package/dist/components/docs/figures/FigureFrame.js.map +1 -1
  28. package/dist/components/docs/figures/FigureSurfaceContext.js +9 -0
  29. package/dist/components/docs/figures/FigureSurfaceContext.js.map +1 -0
  30. package/dist/components/docs/figures/IndexedSection.js +8 -2
  31. package/dist/components/docs/figures/IndexedSection.js.map +1 -1
  32. package/dist/components/docs/figures/index.js.map +1 -1
  33. package/dist/components/experiments/ExperimentsView.js.map +1 -1
  34. package/dist/components/marketing/FeatureGrid.js.map +1 -1
  35. package/dist/components/marketing/Hero.js +2 -2
  36. package/dist/components/marketing/Hero.js.map +1 -1
  37. package/dist/components/marketing/PricingGrid.js.map +1 -1
  38. package/dist/components/review/ChangeBar.js +29 -0
  39. package/dist/components/review/ChangeBar.js.map +1 -0
  40. package/dist/components/review/ChangeCount.js +27 -0
  41. package/dist/components/review/ChangeCount.js.map +1 -0
  42. package/dist/components/review/ChangeIndex.js +50 -0
  43. package/dist/components/review/ChangeIndex.js.map +1 -0
  44. package/dist/components/review/DeltaValue.js +87 -0
  45. package/dist/components/review/DeltaValue.js.map +1 -0
  46. package/dist/components/review/DiffView.js +115 -0
  47. package/dist/components/review/DiffView.js.map +1 -0
  48. package/dist/components/review/KeyedDiff.js +43 -0
  49. package/dist/components/review/KeyedDiff.js.map +1 -0
  50. package/dist/components/review/ProvenanceStrip.js +17 -0
  51. package/dist/components/review/ProvenanceStrip.js.map +1 -0
  52. package/dist/components/review/PullRequestPage.js +223 -0
  53. package/dist/components/review/PullRequestPage.js.map +1 -0
  54. package/dist/components/review/ReviewReportPage.js +111 -0
  55. package/dist/components/review/ReviewReportPage.js.map +1 -0
  56. package/dist/components/review/StatusMark.js +32 -0
  57. package/dist/components/review/StatusMark.js.map +1 -0
  58. package/dist/components/review/VerdictBand.js +45 -0
  59. package/dist/components/review/VerdictBand.js.map +1 -0
  60. package/dist/components/review/diff.js +53 -0
  61. package/dist/components/review/diff.js.map +1 -0
  62. package/dist/components/review/index.js +16 -0
  63. package/dist/components/review/index.js.map +1 -0
  64. package/dist/components/review/samples.js +235 -0
  65. package/dist/components/review/samples.js.map +1 -0
  66. package/dist/components/review/vocabulary.js +51 -0
  67. package/dist/components/review/vocabulary.js.map +1 -0
  68. package/dist/components/saas/SaasLandingPage.js +10 -2
  69. package/dist/components/saas/SaasLandingPage.js.map +1 -1
  70. package/dist/hooks/usePolledResource.js +98 -0
  71. package/dist/hooks/usePolledResource.js.map +1 -0
  72. package/dist/index.d.ts +908 -26
  73. package/dist/index.js +6 -1
  74. package/dist/index.js.map +1 -1
  75. package/dist/lib/units.js +25 -0
  76. package/dist/lib/units.js.map +1 -0
  77. package/package.json +9 -3
@@ -18,7 +18,7 @@ var hero = recipe({
18
18
  },
19
19
  defaultVariants: { align: "center" }
20
20
  });
21
- var Hero = forwardRef(function Hero2({ title, subtitle, eyebrow, actions, children, bracketed = true, align = "center", className, ...props }, ref) {
21
+ var Hero = forwardRef(function Hero2({ title, subtitle, eyebrow, actions, children, bracketed = true, framed = true, align = "center", className, ...props }, ref) {
22
22
  const styles = hero({ align });
23
23
  const titleId = useId();
24
24
  return /* @__PURE__ */ jsxs(
@@ -31,7 +31,7 @@ var Hero = forwardRef(function Hero2({ title, subtitle, eyebrow, actions, childr
31
31
  className: styles.root({ class: className }),
32
32
  children: [
33
33
  eyebrow ? /* @__PURE__ */ jsx("span", { "data-slot": "hero-eyebrow", className: styles.eyebrow(), children: eyebrow }) : null,
34
- /* @__PURE__ */ jsx(PageTitle, { id: titleId, subtitle, bracketed, children: title }),
34
+ /* @__PURE__ */ jsx(PageTitle, { id: titleId, subtitle, bracketed, framed, children: title }),
35
35
  actions ? /* @__PURE__ */ jsx("div", { "data-slot": "hero-actions", className: styles.actions(), children: actions }) : null,
36
36
  children ? /* @__PURE__ */ jsx("div", { "data-slot": "hero-media", className: styles.media(), children }) : null
37
37
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/marketing/Hero.tsx"],"sourcesContent":["import { forwardRef, useId } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { recipe } from '../../lib/recipe';\nimport { PageTitle } from '../PageTitle';\nimport type { SectionAlign } from './SectionGrid';\n\nexport interface HeroProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /** The page's headline, rendered as its one `<h1>` through `PageTitle`. */\n title: ReactNode;\n /** A line under the headline, in the primary accent. */\n subtitle?: string;\n /**\n * A short marker above the headline — normally a `Badge`: a release, a\n * category, a status.\n */\n eyebrow?: ReactNode;\n /**\n * The calls to action, in a row under the headline that wraps on a narrow\n * screen — normally one or two `Button`s, the first the one you want pressed.\n */\n actions?: ReactNode;\n /**\n * The hero's media, below the actions — a screenshot, a terminal, a code\n * sample. Give it its own width; the hero does not constrain it.\n */\n children?: ReactNode;\n /** Draw the headline's brackets. On by default, as `PageTitle` does. */\n bracketed?: boolean;\n /** Where the headline and actions sit — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** Merged into the `<section>`'s classes. */\n className?: string;\n}\n\nconst hero = recipe({\n slots: {\n root: 'mb-16',\n eyebrow: 'mb-6 inline-block',\n actions: 'mt-10 flex flex-wrap gap-5',\n media: 'mt-14',\n },\n variants: {\n align: {\n center: { root: 'text-center', actions: 'justify-center' },\n start: { root: 'text-left', actions: 'justify-start' },\n },\n },\n defaultVariants: { align: 'center' },\n});\n\n/**\n * The opening section of a marketing page: an eyebrow, the headline, a line\n * under it, the calls to action and an optional piece of media.\n *\n * Every slot is the caller's. The hero holds no copy, no product name and no\n * default buttons, so one component opens a product launch and a project site\n * without either knowing about the other. The headline is the page's `<h1>`,\n * and it names the section.\n *\n * @example\n * ```tsx\n * <Hero\n * eyebrow={<Badge accent=\"primary\">NEW</Badge>}\n * title=\"Ship the thing\"\n * subtitle=\"One line on why.\"\n * actions={<Button href=\"/start\" variant=\"tertiary\" bracketed size=\"lg\">START</Button>}\n * />\n * ```\n */\nexport const Hero = forwardRef<HTMLElement, HeroProps>(function Hero(\n { title, subtitle, eyebrow, actions, children, bracketed = true, align = 'center', className, ...props },\n ref,\n) {\n const styles = hero({ align });\n const titleId = useId();\n\n return (\n <section\n ref={ref}\n data-slot=\"hero\"\n aria-labelledby={titleId}\n {...props}\n className={styles.root({ class: className })}\n >\n {eyebrow ? (\n <span data-slot=\"hero-eyebrow\" className={styles.eyebrow()}>\n {eyebrow}\n </span>\n ) : null}\n <PageTitle id={titleId} subtitle={subtitle} bracketed={bracketed}>\n {title}\n </PageTitle>\n {actions ? (\n <div data-slot=\"hero-actions\" className={styles.actions()}>\n {actions}\n </div>\n ) : null}\n {children ? (\n <div data-slot=\"hero-media\" className={styles.media()}>\n {children}\n </div>\n ) : null}\n </section>\n );\n});\n"],"mappings":";AAAA,SAAS,YAAY,aAAa;AAElC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AA2EtB,SAQI,KARJ;AA3CJ,IAAM,OAAO,OAAO;AAAA,EAClB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,MACL,QAAQ,EAAE,MAAM,eAAe,SAAS,iBAAiB;AAAA,MACzD,OAAO,EAAE,MAAM,aAAa,SAAS,gBAAgB;AAAA,IACvD;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,OAAO,SAAS;AACrC,CAAC;AAqBM,IAAM,OAAO,WAAmC,SAASA,MAC9D,EAAE,OAAO,UAAU,SAAS,SAAS,UAAU,YAAY,MAAM,QAAQ,UAAU,WAAW,GAAG,MAAM,GACvG,KACA;AACA,QAAM,SAAS,KAAK,EAAE,MAAM,CAAC;AAC7B,QAAM,UAAU,MAAM;AAEtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,mBAAiB;AAAA,MAChB,GAAG;AAAA,MACJ,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,MAE1C;AAAA,kBACC,oBAAC,UAAK,aAAU,gBAAe,WAAW,OAAO,QAAQ,GACtD,mBACH,IACE;AAAA,QACJ,oBAAC,aAAU,IAAI,SAAS,UAAoB,WACzC,iBACH;AAAA,QACC,UACC,oBAAC,SAAI,aAAU,gBAAe,WAAW,OAAO,QAAQ,GACrD,mBACH,IACE;AAAA,QACH,WACC,oBAAC,SAAI,aAAU,cAAa,WAAW,OAAO,MAAM,GACjD,UACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["Hero"]}
1
+ {"version":3,"sources":["../../../src/components/marketing/Hero.tsx"],"sourcesContent":["import { forwardRef, useId } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { recipe } from '../../lib/recipe';\nimport { PageTitle } from '../PageTitle';\nimport type { SectionAlign } from './SectionGrid';\n\nexport interface HeroProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'children' | 'className'> {\n /** The page's headline, rendered as its one `<h1>` through `PageTitle`. */\n title: ReactNode;\n /** A line under the headline, in the primary accent. */\n subtitle?: string;\n /**\n * A short marker above the headline — normally a `Badge`: a release, a\n * category, a status.\n */\n eyebrow?: ReactNode;\n /**\n * The calls to action, in a row under the headline that wraps on a narrow\n * screen — normally one or two `Button`s, the first the one you want pressed.\n */\n actions?: ReactNode;\n /**\n * The hero's media, below the actions — a screenshot, a terminal, a code\n * sample. Give it its own width; the hero does not constrain it.\n */\n children?: ReactNode;\n /** Draw the headline's brackets. On by default, as `PageTitle` does. */\n bracketed?: boolean;\n /** Draw the title in its double-ruled box. `true` by default; `false` when the hero's media leads. */\n framed?: boolean;\n /** Where the headline and actions sit — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** Merged into the `<section>`'s classes. */\n className?: string;\n}\n\nconst hero = recipe({\n slots: {\n root: 'mb-16',\n eyebrow: 'mb-6 inline-block',\n actions: 'mt-10 flex flex-wrap gap-5',\n media: 'mt-14',\n },\n variants: {\n align: {\n center: { root: 'text-center', actions: 'justify-center' },\n start: { root: 'text-left', actions: 'justify-start' },\n },\n },\n defaultVariants: { align: 'center' },\n});\n\n/**\n * The opening section of a marketing page: an eyebrow, the headline, a line\n * under it, the calls to action and an optional piece of media.\n *\n * Every slot is the caller's. The hero holds no copy, no product name and no\n * default buttons, so one component opens a product launch and a project site\n * without either knowing about the other. The headline is the page's `<h1>`,\n * and it names the section.\n *\n * @example\n * ```tsx\n * <Hero\n * eyebrow={<Badge accent=\"primary\">NEW</Badge>}\n * title=\"Ship the thing\"\n * subtitle=\"One line on why.\"\n * actions={<Button href=\"/start\" variant=\"tertiary\" bracketed size=\"lg\">START</Button>}\n * />\n * ```\n */\nexport const Hero = forwardRef<HTMLElement, HeroProps>(function Hero(\n { title, subtitle, eyebrow, actions, children, bracketed = true, framed = true, align = 'center', className, ...props },\n ref,\n) {\n const styles = hero({ align });\n const titleId = useId();\n\n return (\n <section\n ref={ref}\n data-slot=\"hero\"\n aria-labelledby={titleId}\n {...props}\n className={styles.root({ class: className })}\n >\n {eyebrow ? (\n <span data-slot=\"hero-eyebrow\" className={styles.eyebrow()}>\n {eyebrow}\n </span>\n ) : null}\n <PageTitle id={titleId} subtitle={subtitle} bracketed={bracketed} framed={framed}>\n {title}\n </PageTitle>\n {actions ? (\n <div data-slot=\"hero-actions\" className={styles.actions()}>\n {actions}\n </div>\n ) : null}\n {children ? (\n <div data-slot=\"hero-media\" className={styles.media()}>\n {children}\n </div>\n ) : null}\n </section>\n );\n});\n"],"mappings":";AAAA,SAAS,YAAY,aAAa;AAElC,SAAS,cAAc;AACvB,SAAS,iBAAiB;AA6EtB,SAQI,KARJ;AA3CJ,IAAM,OAAO,OAAO;AAAA,EAClB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,MACL,QAAQ,EAAE,MAAM,eAAe,SAAS,iBAAiB;AAAA,MACzD,OAAO,EAAE,MAAM,aAAa,SAAS,gBAAgB;AAAA,IACvD;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,OAAO,SAAS;AACrC,CAAC;AAqBM,IAAM,OAAO,WAAmC,SAASA,MAC9D,EAAE,OAAO,UAAU,SAAS,SAAS,UAAU,YAAY,MAAM,SAAS,MAAM,QAAQ,UAAU,WAAW,GAAG,MAAM,GACtH,KACA;AACA,QAAM,SAAS,KAAK,EAAE,MAAM,CAAC;AAC7B,QAAM,UAAU,MAAM;AAEtB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,mBAAiB;AAAA,MAChB,GAAG;AAAA,MACJ,WAAW,OAAO,KAAK,EAAE,OAAO,UAAU,CAAC;AAAA,MAE1C;AAAA,kBACC,oBAAC,UAAK,aAAU,gBAAe,WAAW,OAAO,QAAQ,GACtD,mBACH,IACE;AAAA,QACJ,oBAAC,aAAU,IAAI,SAAS,UAAoB,WAAsB,QAC/D,iBACH;AAAA,QACC,UACC,oBAAC,SAAI,aAAU,gBAAe,WAAW,OAAO,QAAQ,GACrD,mBACH,IACE;AAAA,QACH,WACC,oBAAC,SAAI,aAAU,cAAa,WAAW,OAAO,MAAM,GACjD,UACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["Hero"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/marketing/PricingGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { Check } from 'lucide-react';\nimport { recipe } from '../../lib/recipe';\nimport { ACCENT_CLASS_MAPS, accentTextClass, canonicalAccent } from '../../lib/accentClasses';\nimport { Card } from '../Card';\nimport { SectionGrid } from './SectionGrid';\nimport type { SectionAlign, SectionColumns } from './SectionGrid';\n\nexport interface PricingGridProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'className'> {\n /**\n * The section's heading, rendered as its `<h2>`. When present the section is\n * named by it, so it becomes a landmark a screen reader can list.\n */\n title?: ReactNode;\n /** A line under the heading — billing terms, a trial, a guarantee. */\n description?: ReactNode;\n /**\n * How many columns at desktop widths: `2`, `3` (the default) or `4`. Match\n * it to the number of tiers. Below `md` the tiers stack in one column.\n */\n columns?: SectionColumns;\n /** Where the heading block sits — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** The tiers — normally `PricingTier`s. Every cell in a row stretches to the tallest. */\n children?: ReactNode;\n /** Merged into the `<section>`'s classes. Spacing between sections is the page's to set. */\n className?: string;\n}\n\n/**\n * A marketing section of price plans: an optional heading and line, over a\n * grid of {@link PricingTier} cells stretched to one height so their actions\n * line up.\n *\n * Holds no prices, plan names or currency. The same grid is a SaaS plan table,\n * a consulting rate card or a donation ladder.\n *\n * @example\n * ```tsx\n * <PricingGrid title=\"Pricing\" columns={2}>\n * <PricingTier name=\"Solo\" price=\"$0\" period=\"/month\" features={['One workspace']} />\n * <PricingTier name=\"Team\" price=\"$12\" period=\"/seat\" badge=\"POPULAR\" accent=\"tertiary\" />\n * </PricingGrid>\n * ```\n */\nexport const PricingGrid = forwardRef<HTMLElement, PricingGridProps>(function PricingGrid(props, ref) {\n return <SectionGrid ref={ref} slot=\"pricing-grid\" {...props} />;\n});\n\n/**\n * The roles a tier's accent may take. The emphasis roles less `quiet`, because\n * the accent colours the price and is the natural `variant` for the tier's\n * `Button`, and `Button` omits `quiet`: inverse text on a quiet fill is not a\n * gated pair.\n */\nexport type PricingTierAccent = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * One tier as data — the shape `SaasLandingPage`'s `pricingTiers` takes.\n *\n * It shares the component's name because it was public under that name before\n * the component existed: the type `PricingTier` is this record, the value\n * `PricingTier` is the component. `highlighted` and `ctaText` are the landing\n * page's own vocabulary; the component takes a `badge` and an `action` instead,\n * so that no label is decided on the caller's behalf.\n */\nexport interface PricingTier {\n name: string;\n price: string;\n period?: string;\n description: string;\n features: string[];\n /**\n * The tier's accent, used three ways — `Card accent`, the price, and\n * `Button variant` for the CTA. See {@link PricingTierAccent}.\n */\n accent: PricingTierAccent;\n highlighted?: boolean;\n ctaText?: string;\n}\n\nexport interface PricingTierProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The plan's name, set as the tier's `<h3>`. */\n name: ReactNode;\n /** The price as displayed — currency and all, since only the caller knows the locale. */\n price: ReactNode;\n /** What the price is per — `/month`, `/seat`, `one-off`. Set small, in the muted ink. */\n period?: ReactNode;\n /** A line on who the plan is for. */\n description?: ReactNode;\n /** What the plan includes, one entry per line, each ticked. */\n features?: readonly ReactNode[];\n /**\n * The semantic accent for the stripe and the price. `primary` by default.\n * Pass the same role as the action `Button`'s `variant` so the tier reads as\n * one colour.\n */\n accent?: PricingTierAccent;\n /**\n * A label in the tier's header strip — `POPULAR`, `BEST VALUE`. None by\n * default: which tier is recommended, and what that is called, is the page's\n * decision.\n */\n badge?: string;\n /**\n * The call to action, pinned to the bottom of the tier below a rule — a\n * `Button`, normally in the tier's accent and full width. Omit it for a\n * tier with nothing to choose.\n */\n action?: ReactNode;\n /** Merged into the tier's classes. */\n className?: string;\n}\n\nconst pricingTier = recipe({\n slots: {\n root: 'relative flex flex-col justify-between',\n badge: 'absolute -top-3 left-4 inline-block px-2 py-[0.15rem] font-mono text-[0.65rem] font-bold uppercase text-content-inverse',\n name: 'mb-2 font-display text-[1.1rem] font-extrabold uppercase text-content-primary',\n priceRow: 'mb-4',\n price: 'font-display text-[3rem] font-black',\n period: 'font-mono text-[0.85rem] text-content-muted',\n description: 'mb-6 font-mono text-[0.75rem] leading-[1.5] text-content-primary opacity-80',\n features: 'm-0 mb-6 list-none p-0',\n feature: 'mb-[0.6rem] flex items-start gap-2 font-mono text-[0.8rem] text-content-primary opacity-90',\n tick: 'mt-[2px] shrink-0 text-intent-success',\n action: 'mt-auto border-t border-edge-strong pt-4',\n },\n});\n\n/**\n * One plan in a {@link PricingGrid}: name, price, a line about it, a ticked\n * feature list, and an action pinned to the bottom.\n *\n * A `Card` panel in a column, so the action sits on the tier's floor however\n * long its list is, and tiers of different lengths in one row keep their\n * actions level. Holds no labels of its own: the badge, the action's text and\n * whether there is one at all come from the caller.\n *\n * @example\n * ```tsx\n * <PricingTier\n * name=\"Team\"\n * price=\"$12\"\n * period=\"/seat\"\n * description=\"For a team that ships together.\"\n * features={['Shared workspaces', 'Audit log']}\n * accent=\"tertiary\"\n * badge=\"POPULAR\"\n * action={<Button variant=\"tertiary\" bracketed className=\"w-full justify-center\">START</Button>}\n * />\n * ```\n */\nexport const PricingTier = forwardRef<HTMLDivElement, PricingTierProps>(function PricingTier(\n { name, price, period, description, features, accent = 'primary', badge, action, className, ...props },\n ref,\n) {\n const styles = pricingTier();\n return (\n <Card\n ref={ref}\n variant=\"panel\"\n accent={accent}\n data-slot=\"pricing-tier\"\n {...props}\n className={styles.root({ class: className })}\n >\n {badge ? (\n // Hung on the card's top edge rather than set in its flow: in flow it\n // pushes this tier's name, price and list below its neighbours'.\n <span data-slot=\"pricing-tier-badge\" className={styles.badge({ class: ACCENT_CLASS_MAPS.FILL[canonicalAccent(accent)] })}>\n {badge}\n </span>\n ) : null}\n <div data-slot=\"pricing-tier-body\">\n <h3 className={styles.name()}>{name}</h3>\n <div data-slot=\"pricing-tier-price\" className={styles.priceRow()}>\n <span className={styles.price({ class: accentTextClass(accent) })}>{price}</span>\n {period ? <span className={styles.period()}>{period}</span> : null}\n </div>\n {description ? <p className={styles.description()}>{description}</p> : null}\n {features && features.length > 0 ? (\n <ul data-slot=\"pricing-tier-features\" className={styles.features()}>\n {features.map((item, i) => (\n <li key={typeof item === 'string' ? item : i} className={styles.feature()}>\n <Check size={14} aria-hidden=\"true\" className={styles.tick()} />\n <span>{item}</span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n {action ? (\n <div data-slot=\"pricing-tier-action\" className={styles.action()}>\n {action}\n </div>\n ) : null}\n </Card>\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,mBAAmB,iBAAiB,uBAAuB;AACpE,SAAS,YAAY;AACrB,SAAS,mBAAmB;AA0CnB,cAkID,YAlIC;AADF,IAAM,cAAc,WAA0C,SAASA,aAAY,OAAO,KAAK;AACpG,SAAO,oBAAC,eAAY,KAAU,MAAK,gBAAgB,GAAG,OAAO;AAC/D,CAAC;AAmED,IAAM,cAAc,OAAO;AAAA,EACzB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,I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AO,SAAS,WAAW,OAAO,CAG3C,CACD,GACH,IACE;AAAA,WACN;AAAA,QACC,SACC,oBAAC,SAAI,aAAU,uBAAsB,WAAW,OAAO,OAAO,GAC3D,kBACH,IACE;AAAA;AAAA;AAAA,EACN;AAEJ,CAAC;","names":["PricingGrid","PricingTier"]}
1
+ {"version":3,"sources":["../../../src/components/marketing/PricingGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { Check } from 'lucide-react';\nimport { recipe } from '../../lib/recipe';\nimport { ACCENT_CLASS_MAPS, accentTextClass, canonicalAccent } from '../../lib/accentClasses';\nimport { Card, type CardWeight } from '../Card';\nimport { SectionGrid } from './SectionGrid';\nimport type { SectionAlign, SectionColumns } from './SectionGrid';\n\nexport interface PricingGridProps\n extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'className'> {\n /**\n * The section's heading, rendered as its `<h2>`. When present the section is\n * named by it, so it becomes a landmark a screen reader can list.\n */\n title?: ReactNode;\n /** A line under the heading — billing terms, a trial, a guarantee. */\n description?: ReactNode;\n /**\n * How many columns at desktop widths: `2`, `3` (the default) or `4`. Match\n * it to the number of tiers. Below `md` the tiers stack in one column.\n */\n columns?: SectionColumns;\n /** Where the heading block sits — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** The tiers — normally `PricingTier`s. Every cell in a row stretches to the tallest. */\n children?: ReactNode;\n /** Merged into the `<section>`'s classes. Spacing between sections is the page's to set. */\n className?: string;\n}\n\n/**\n * A marketing section of price plans: an optional heading and line, over a\n * grid of {@link (PricingTier:variable)} cells stretched to one height so their actions\n * line up.\n *\n * Holds no prices, plan names or currency. The same grid is a SaaS plan table,\n * a consulting rate card or a donation ladder.\n *\n * @example\n * ```tsx\n * <PricingGrid title=\"Pricing\" columns={2}>\n * <PricingTier name=\"Solo\" price=\"$0\" period=\"/month\" features={['One workspace']} />\n * <PricingTier name=\"Team\" price=\"$12\" period=\"/seat\" badge=\"POPULAR\" accent=\"tertiary\" />\n * </PricingGrid>\n * ```\n */\nexport const PricingGrid = forwardRef<HTMLElement, PricingGridProps>(function PricingGrid(props, ref) {\n return <SectionGrid ref={ref} slot=\"pricing-grid\" {...props} />;\n});\n\n/**\n * The roles a tier's accent may take. The emphasis roles less `quiet`, because\n * the accent colours the price and is the natural `variant` for the tier's\n * `Button`, and `Button` omits `quiet`: inverse text on a quiet fill is not a\n * gated pair.\n */\nexport type PricingTierAccent = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * One tier as data — the shape `SaasLandingPage`'s `pricingTiers` takes.\n *\n * It shares the component's name because it was public under that name before\n * the component existed: the type `PricingTier` is this record, the value\n * `PricingTier` is the component. `highlighted` and `ctaText` are the landing\n * page's own vocabulary; the component takes a `badge` and an `action` instead,\n * so that no label is decided on the caller's behalf.\n */\nexport interface PricingTier {\n name: string;\n price: string;\n period?: string;\n description: string;\n features: string[];\n /**\n * The tier's accent, used three ways — `Card accent`, the price, and\n * `Button variant` for the CTA. See {@link PricingTierAccent}.\n */\n accent: PricingTierAccent;\n highlighted?: boolean;\n ctaText?: string;\n}\n\nexport interface PricingTierProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The plan's name, set as the tier's `<h3>`. */\n name: ReactNode;\n /**\n * The tier's weight. Leave the recommended tier `strong` and set the others `quiet`, so the\n * plan the page recommends is the one heavy object in the row.\n */\n weight?: CardWeight;\n /** The price as displayed — currency and all, since only the caller knows the locale. */\n price: ReactNode;\n /** What the price is per — `/month`, `/seat`, `one-off`. Set small, in the muted ink. */\n period?: ReactNode;\n /** A line on who the plan is for. */\n description?: ReactNode;\n /** What the plan includes, one entry per line, each ticked. */\n features?: readonly ReactNode[];\n /**\n * The semantic accent for the stripe and the price. `primary` by default.\n * Pass the same role as the action `Button`'s `variant` so the tier reads as\n * one colour.\n */\n accent?: PricingTierAccent;\n /**\n * A label in the tier's header strip — `POPULAR`, `BEST VALUE`. None by\n * default: which tier is recommended, and what that is called, is the page's\n * decision.\n */\n badge?: string;\n /**\n * The call to action, pinned to the bottom of the tier below a rule — a\n * `Button`, normally in the tier's accent and full width. Omit it for a\n * tier with nothing to choose.\n */\n action?: ReactNode;\n /** Merged into the tier's classes. */\n className?: string;\n}\n\nconst pricingTier = recipe({\n slots: {\n root: 'relative flex flex-col justify-between',\n badge: 'absolute -top-3 left-4 inline-block px-2 py-[0.15rem] font-mono text-[0.65rem] font-bold uppercase text-content-inverse',\n name: 'mb-2 font-display text-[1.1rem] font-extrabold uppercase text-content-primary',\n priceRow: 'mb-4',\n price: 'font-display text-[3rem] font-black',\n period: 'font-mono text-[0.85rem] text-content-muted',\n description: 'mb-6 font-mono text-[0.75rem] leading-[1.5] text-content-primary opacity-80',\n features: 'm-0 mb-6 list-none p-0',\n feature: 'mb-[0.6rem] flex items-start gap-2 font-mono text-[0.8rem] text-content-primary opacity-90',\n tick: 'mt-[2px] shrink-0 text-intent-success',\n action: 'mt-auto border-t border-edge-strong pt-4',\n },\n});\n\n/**\n * One plan in a {@link PricingGrid}: name, price, a line about it, a ticked\n * feature list, and an action pinned to the bottom.\n *\n * A `Card` panel in a column, so the action sits on the tier's floor however\n * long its list is, and tiers of different lengths in one row keep their\n * actions level. Holds no labels of its own: the badge, the action's text and\n * whether there is one at all come from the caller.\n *\n * @example\n * ```tsx\n * <PricingTier\n * name=\"Team\"\n * price=\"$12\"\n * period=\"/seat\"\n * description=\"For a team that ships together.\"\n * features={['Shared workspaces', 'Audit log']}\n * accent=\"tertiary\"\n * badge=\"POPULAR\"\n * action={<Button variant=\"tertiary\" bracketed className=\"w-full justify-center\">START</Button>}\n * />\n * ```\n */\nexport const PricingTier = forwardRef<HTMLDivElement, PricingTierProps>(function PricingTier(\n { name, price, period, description, features, accent = 'primary', badge, action, className, ...props },\n ref,\n) {\n const styles = pricingTier();\n return (\n <Card\n ref={ref}\n variant=\"panel\"\n accent={accent}\n data-slot=\"pricing-tier\"\n {...props}\n className={styles.root({ class: className })}\n >\n {badge ? (\n // Hung on the card's top edge rather than set in its flow: in flow it\n // pushes this tier's name, price and list below its neighbours'.\n <span data-slot=\"pricing-tier-badge\" className={styles.badge({ class: ACCENT_CLASS_MAPS.FILL[canonicalAccent(accent)] })}>\n {badge}\n </span>\n ) : null}\n <div data-slot=\"pricing-tier-body\">\n <h3 className={styles.name()}>{name}</h3>\n <div data-slot=\"pricing-tier-price\" className={styles.priceRow()}>\n <span className={styles.price({ class: accentTextClass(accent) })}>{price}</span>\n {period ? <span className={styles.period()}>{period}</span> : null}\n </div>\n {description ? <p className={styles.description()}>{description}</p> : null}\n {features && features.length > 0 ? (\n <ul data-slot=\"pricing-tier-features\" className={styles.features()}>\n {features.map((item, i) => (\n <li key={typeof item === 'string' ? item : i} className={styles.feature()}>\n <Check size={14} aria-hidden=\"true\" className={styles.tick()} />\n <span>{item}</span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n {action ? (\n <div data-slot=\"pricing-tier-action\" className={styles.action()}>\n {action}\n </div>\n ) : null}\n </Card>\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,mBAAmB,iBAAiB,uBAAuB;AACpE,SAAS,YAA6B;AACtC,SAAS,mBAAmB;AA0CnB,cAuID,YAvIC;AADF,IAAM,cAAc,WAA0C,SAASA,aAAY,OAAO,KAAK;AACpG,SAAO,oBAAC,eAAY,KAAU,MAAK,gBAAgB,GAAG,OAAO;AAC/D,CAAC;AAwED,IAAM,cAAc,OAAO;AAAA,EACzB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,QAAQ;AAAA,EACV;AACF,CAAC;AAyBM,IAAM,cAAc,WAA6C,SAASC,aAC/E,EAAE,MAAM,OAAO,QAAQ,aAA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EACN;AAEJ,CAAC;","names":["PricingGrid","PricingTier"]}
@@ -0,0 +1,29 @@
1
+ // src/components/review/ChangeBar.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var ChangeBar = React.forwardRef(function ChangeBar2({ added, removed, max, label, className, ...rest }, ref) {
6
+ const scale = Math.max(max ?? added + removed, 1);
7
+ const a = Math.min(added / scale * 100, 100);
8
+ const d = Math.min(removed / scale * 100, 100 - a);
9
+ return /* @__PURE__ */ jsxs(
10
+ "svg",
11
+ {
12
+ ref,
13
+ "data-slot": "change-bar",
14
+ viewBox: "0 0 100 10",
15
+ preserveAspectRatio: "none",
16
+ ...label ? { role: "img", "aria-label": label } : { "aria-hidden": true },
17
+ ...rest,
18
+ className: cn("inline-block h-2.5 w-[4.5rem] shrink-0 border border-edge-default bg-surface-sunken align-middle", className),
19
+ children: [
20
+ /* @__PURE__ */ jsx("rect", { "data-slot": "change-bar-added", x: "0", y: "0", width: a, height: "10", className: "fill-delta-added" }),
21
+ /* @__PURE__ */ jsx("rect", { "data-slot": "change-bar-removed", x: a, y: "0", width: d, height: "10", className: "fill-delta-removed" })
22
+ ]
23
+ }
24
+ );
25
+ });
26
+ export {
27
+ ChangeBar
28
+ };
29
+ //# sourceMappingURL=ChangeBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/ChangeBar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/recipe';\n\nexport interface ChangeBarProps extends Omit<React.SVGAttributes<SVGSVGElement>, 'children'> {\n /** Lines or records added. */\n added: number;\n /** Lines or records removed. */\n removed: number;\n /**\n * The size of a full bar. Pass the largest change in the list so sibling bars share a scale;\n * defaults to this change alone, which fills the bar.\n */\n max?: number;\n /** Accessible name. Without one the bar is decorative, and a `ChangeCount` beside it carries the figures. */\n label?: string;\n /** Additional classes for the bar. */\n className?: string;\n}\n\n/**\n * The share of a change, added then removed, on a track scaled to the largest change beside it.\n *\n * Drawn as SVG so the proportion is geometry rather than an inline style, and the fills take the\n * `delta` roles. Decorative by default: it repeats a count printed next to it.\n */\nexport const ChangeBar = React.forwardRef<SVGSVGElement, ChangeBarProps>(function ChangeBar(\n { added, removed, max, label, className, ...rest },\n ref,\n) {\n const scale = Math.max(max ?? added + removed, 1);\n const a = Math.min((added / scale) * 100, 100);\n const d = Math.min((removed / scale) * 100, 100 - a);\n return (\n <svg\n ref={ref}\n data-slot=\"change-bar\"\n viewBox=\"0 0 100 10\"\n preserveAspectRatio=\"none\"\n {...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': true })}\n {...rest}\n className={cn('inline-block h-2.5 w-[4.5rem] shrink-0 border border-edge-default bg-surface-sunken align-middle', className)}\n >\n <rect data-slot=\"change-bar-added\" x=\"0\" y=\"0\" width={a} height=\"10\" className=\"fill-delta-added\" />\n <rect data-slot=\"change-bar-removed\" x={a} y=\"0\" width={d} height=\"10\" className=\"fill-delta-removed\" />\n </svg>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,UAAU;AAgCf,SASE,KATF;AARG,IAAM,YAAkB,iBAA0C,SAASA,WAChF,EAAE,OAAO,SAAS,KAAK,OAAO,WAAW,GAAG,KAAK,GACjD,KACA;AACA,QAAM,QAAQ,KAAK,IAAI,OAAO,QAAQ,SAAS,CAAC;AAChD,QAAM,IAAI,KAAK,IAAK,QAAQ,QAAS,KAAK,GAAG;AAC7C,QAAM,IAAI,KAAK,IAAK,UAAU,QAAS,KAAK,MAAM,CAAC;AACnD,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,aAAU;AAAA,MACV,SAAQ;AAAA,MACR,qBAAoB;AAAA,MACnB,GAAI,QAAQ,EAAE,MAAM,OAAO,cAAc,MAAM,IAAI,EAAE,eAAe,KAAK;AAAA,MACzE,GAAG;AAAA,MACJ,WAAW,GAAG,oGAAoG,SAAS;AAAA,MAE3H;AAAA,4BAAC,UAAK,aAAU,oBAAmB,GAAE,KAAI,GAAE,KAAI,OAAO,GAAG,QAAO,MAAK,WAAU,oBAAmB;AAAA,QAClG,oBAAC,UAAK,aAAU,sBAAqB,GAAG,GAAG,GAAE,KAAI,OAAO,GAAG,QAAO,MAAK,WAAU,sBAAqB;AAAA;AAAA;AAAA,EACxG;AAEJ,CAAC;","names":["ChangeBar"]}
@@ -0,0 +1,27 @@
1
+ // src/components/review/ChangeCount.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var ChangeCount = React.forwardRef(function ChangeCount2({ added, removed, moved, noun, className, ...rest }, ref) {
6
+ const say = (count, verb) => noun ? `${count} ${count === 1 ? noun[0] : noun[1]} ${verb}` : `${count} ${verb}`;
7
+ const spoken = [say(added, "added"), say(removed, "removed"), ...moved != null ? [say(moved, "moved")] : []].join(", ");
8
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "change-count", ...rest, className: cn("inline-flex gap-2 whitespace-nowrap font-mono text-sm tabular-nums", className), children: [
9
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "text-delta-added", children: [
10
+ "+",
11
+ added
12
+ ] }),
13
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "text-delta-removed", children: [
14
+ "\u2212",
15
+ removed
16
+ ] }),
17
+ moved != null ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "text-delta-moved", children: [
18
+ "\u2192",
19
+ moved
20
+ ] }) : null,
21
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: spoken })
22
+ ] });
23
+ });
24
+ export {
25
+ ChangeCount
26
+ };
27
+ //# sourceMappingURL=ChangeCount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/ChangeCount.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/recipe';\n\nexport interface ChangeCountProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {\n /** Lines or records added. */\n added: number;\n /** Lines or records removed. */\n removed: number;\n /** Lines or records moved or renamed. Printed only when given. */\n moved?: number;\n /**\n * The thing counted, for the spoken form, singular then plural: `['line', 'lines']` reads\n * \"1 line added, 50 lines removed\".\n */\n noun?: readonly [one: string, other: string];\n /** Additional classes for the count. */\n className?: string;\n}\n\n/**\n * The size of a change as `+77 −50`, in the `delta` roles.\n *\n * Change, not meaning: the added count is green because it was added, not because adding is\n * good. Screen readers hear the words rather than the signs.\n */\nexport const ChangeCount = React.forwardRef<HTMLSpanElement, ChangeCountProps>(function ChangeCount(\n { added, removed, moved, noun, className, ...rest },\n ref,\n) {\n const say = (count: number, verb: string) => (noun ? `${count} ${count === 1 ? noun[0] : noun[1]} ${verb}` : `${count} ${verb}`);\n const spoken = [say(added, 'added'), say(removed, 'removed'), ...(moved != null ? [say(moved, 'moved')] : [])].join(', ');\n return (\n <span ref={ref} data-slot=\"change-count\" {...rest} className={cn('inline-flex gap-2 whitespace-nowrap font-mono text-sm tabular-nums', className)}>\n <span aria-hidden=\"true\" className=\"text-delta-added\">+{added}</span>\n <span aria-hidden=\"true\" className=\"text-delta-removed\">−{removed}</span>\n {moved != null ? <span aria-hidden=\"true\" className=\"text-delta-moved\">→{moved}</span> : null}\n <span className=\"sr-only\">{spoken}</span>\n </span>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,UAAU;AAgCb,SAGA,KAHA;AARC,IAAM,cAAoB,iBAA8C,SAASA,aACtF,EAAE,OAAO,SAAS,OAAO,MAAM,WAAW,GAAG,KAAK,GAClD,KACA;AACA,QAAM,MAAM,CAAC,OAAe,SAAkB,OAAO,GAAG,KAAK,IAAI,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,KAAK,GAAG,KAAK,IAAI,IAAI;AAC7H,QAAM,SAAS,CAAC,IAAI,OAAO,OAAO,GAAG,IAAI,SAAS,SAAS,GAAG,GAAI,SAAS,OAAO,CAAC,IAAI,OAAO,OAAO,CAAC,IAAI,CAAC,CAAE,EAAE,KAAK,IAAI;AACxH,SACE,qBAAC,UAAK,KAAU,aAAU,gBAAgB,GAAG,MAAM,WAAW,GAAG,sEAAsE,SAAS,GAC9I;AAAA,yBAAC,UAAK,eAAY,QAAO,WAAU,oBAAmB;AAAA;AAAA,MAAE;AAAA,OAAM;AAAA,IAC9D,qBAAC,UAAK,eAAY,QAAO,WAAU,sBAAqB;AAAA;AAAA,MAAE;AAAA,OAAQ;AAAA,IACjE,SAAS,OAAO,qBAAC,UAAK,eAAY,QAAO,WAAU,oBAAmB;AAAA;AAAA,MAAE;AAAA,OAAM,IAAU;AAAA,IACzF,oBAAC,UAAK,WAAU,WAAW,kBAAO;AAAA,KACpC;AAEJ,CAAC;","names":["ChangeCount"]}
@@ -0,0 +1,50 @@
1
+ // src/components/review/ChangeIndex.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { ChangeBar } from "./ChangeBar.js";
5
+ import { ChangeCount } from "./ChangeCount.js";
6
+ import { diffAnchor } from "./diff.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ var LINES = ["line", "lines"];
9
+ function PathLabel({ path }) {
10
+ const cut = path.lastIndexOf("/");
11
+ return /* @__PURE__ */ jsxs("span", { className: "min-w-0 [overflow-wrap:anywhere]", children: [
12
+ cut >= 0 ? /* @__PURE__ */ jsx("span", { className: "text-content-muted", children: path.slice(0, cut + 1) }) : null,
13
+ path.slice(cut + 1)
14
+ ] });
15
+ }
16
+ var ChangeIndex = React.forwardRef(function ChangeIndex2({ label = "Changed files", groups, emptyText = "No files changed.", className, ...rest }, ref) {
17
+ const files = groups.flatMap((group) => group.files);
18
+ const max = Math.max(1, ...files.map((file) => file.added + file.removed));
19
+ return /* @__PURE__ */ jsxs("nav", { ref, "aria-label": label, "data-slot": "change-index", ...rest, className: cn("border-t-2 border-edge-strong font-mono text-sm", className), children: [
20
+ files.length === 0 ? /* @__PURE__ */ jsx("p", { className: "m-0 py-3 font-sans text-content-muted", children: emptyText }) : null,
21
+ groups.filter((group) => group.files.length > 0).map((group) => {
22
+ const added = group.files.reduce((sum, file) => sum + file.added, 0);
23
+ const removed = group.files.reduce((sum, file) => sum + file.removed, 0);
24
+ return /* @__PURE__ */ jsxs("section", { "data-slot": "change-index-group", "aria-label": group.title, className: "border-b border-dashed border-edge-subtle pb-2 last:border-b-0", children: [
25
+ /* @__PURE__ */ jsxs("h3", { className: "m-0 flex items-center gap-3 px-0 pb-1 pt-2.5 text-xs font-bold uppercase tracking-wider text-content-primary", children: [
26
+ /* @__PURE__ */ jsx("span", { className: "flex-1", children: group.title }),
27
+ /* @__PURE__ */ jsx(ChangeCount, { added, removed, noun: LINES, className: "text-xs" })
28
+ ] }),
29
+ /* @__PURE__ */ jsx("ul", { className: "m-0 list-none p-0", children: group.files.map((file) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
30
+ "a",
31
+ {
32
+ href: file.href ?? `#${diffAnchor(file.path)}`,
33
+ "data-slot": "change-index-file",
34
+ "data-path": file.path,
35
+ className: "grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 py-1.5 pl-4 pr-0 text-content-primary no-underline hover:bg-surface-sunken focus-visible:bg-surface-sunken sm:grid-cols-[minmax(0,1fr)_auto_auto]",
36
+ children: [
37
+ /* @__PURE__ */ jsx(PathLabel, { path: file.path }),
38
+ /* @__PURE__ */ jsx(ChangeCount, { added: file.added, removed: file.removed, noun: LINES }),
39
+ /* @__PURE__ */ jsx(ChangeBar, { added: file.added, removed: file.removed, max, className: "hidden sm:inline-block" })
40
+ ]
41
+ }
42
+ ) }, file.path)) })
43
+ ] }, group.title);
44
+ })
45
+ ] });
46
+ });
47
+ export {
48
+ ChangeIndex
49
+ };
50
+ //# sourceMappingURL=ChangeIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/ChangeIndex.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/recipe';\nimport { ChangeBar } from './ChangeBar';\nimport { ChangeCount } from './ChangeCount';\n\nconst LINES = ['line', 'lines'] as const;\nimport { diffAnchor } from './diff';\n\nexport interface ChangeIndexFile {\n /** The file's path. */\n path: string;\n /** Lines added. */\n added: number;\n /** Lines removed. */\n removed: number;\n /** Where the file's diff is. Defaults to `#` + `diffAnchor(path)`, which `DiffView` uses for its id. */\n href?: string;\n}\n\nexport interface ChangeIndexGroup {\n /** The group's name, such as `Call graph` or `Hand-written code metrics`. */\n title: string;\n /** The group's files, in reading order. A group with none is left out. */\n files: readonly ChangeIndexFile[];\n}\n\nexport interface ChangeIndexProps extends React.HTMLAttributes<HTMLElement> {\n /** Accessible name for the index. */\n label?: string;\n /** Groups in reading order. Each prints its own total before its files. */\n groups: readonly ChangeIndexGroup[];\n /** Printed when every group is empty. */\n emptyText?: React.ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\nfunction PathLabel({ path }: { path: string }) {\n const cut = path.lastIndexOf('/');\n return (\n <span className=\"min-w-0 [overflow-wrap:anywhere]\">\n {cut >= 0 ? <span className=\"text-content-muted\">{path.slice(0, cut + 1)}</span> : null}\n {path.slice(cut + 1)}\n </span>\n );\n}\n\n/**\n * The files a change touched, grouped, each group totalled before its files, each file with a\n * count and a bar on one shared scale, and each linking to its diff.\n *\n * Plain anchors, so the index works in a report with no script. A flat, scannable list rather\n * than `FileChangeTree`'s drawn directory layout: that figure explains a small changeset's shape,\n * this one indexes a large one.\n */\nexport const ChangeIndex = React.forwardRef<HTMLElement, ChangeIndexProps>(function ChangeIndex(\n { label = 'Changed files', groups, emptyText = 'No files changed.', className, ...rest },\n ref,\n) {\n const files = groups.flatMap((group) => group.files);\n const max = Math.max(1, ...files.map((file) => file.added + file.removed));\n return (\n <nav ref={ref} aria-label={label} data-slot=\"change-index\" {...rest} className={cn('border-t-2 border-edge-strong font-mono text-sm', className)}>\n {files.length === 0 ? <p className=\"m-0 py-3 font-sans text-content-muted\">{emptyText}</p> : null}\n {groups\n .filter((group) => group.files.length > 0)\n .map((group) => {\n const added = group.files.reduce((sum, file) => sum + file.added, 0);\n const removed = group.files.reduce((sum, file) => sum + file.removed, 0);\n return (\n <section key={group.title} data-slot=\"change-index-group\" aria-label={group.title} className=\"border-b border-dashed border-edge-subtle pb-2 last:border-b-0\">\n <h3 className=\"m-0 flex items-center gap-3 px-0 pb-1 pt-2.5 text-xs font-bold uppercase tracking-wider text-content-primary\">\n <span className=\"flex-1\">{group.title}</span>\n <ChangeCount added={added} removed={removed} noun={LINES} className=\"text-xs\" />\n </h3>\n <ul className=\"m-0 list-none p-0\">\n {group.files.map((file) => (\n <li key={file.path}>\n <a\n href={file.href ?? `#${diffAnchor(file.path)}`}\n data-slot=\"change-index-file\"\n data-path={file.path}\n className=\"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 py-1.5 pl-4 pr-0 text-content-primary no-underline hover:bg-surface-sunken focus-visible:bg-surface-sunken sm:grid-cols-[minmax(0,1fr)_auto_auto]\"\n >\n <PathLabel path={file.path} />\n <ChangeCount added={file.added} removed={file.removed} noun={LINES} />\n <ChangeBar added={file.added} removed={file.removed} max={max} className=\"hidden sm:inline-block\" />\n </a>\n </li>\n ))}\n </ul>\n </section>\n );\n })}\n </nav>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAG5B,SAAS,kBAAkB;AAkCvB,SACc,KADd;AAnCJ,IAAM,QAAQ,CAAC,QAAQ,OAAO;AAgC9B,SAAS,UAAU,EAAE,KAAK,GAAqB;AAC7C,QAAM,MAAM,KAAK,YAAY,GAAG;AAChC,SACE,qBAAC,UAAK,WAAU,oCACb;AAAA,WAAO,IAAI,oBAAC,UAAK,WAAU,sBAAsB,eAAK,MAAM,GAAG,MAAM,CAAC,GAAE,IAAU;AAAA,IAClF,KAAK,MAAM,MAAM,CAAC;AAAA,KACrB;AAEJ;AAUO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;AAAA,cACpE,oBAAC,aAAU,OAAO,KAAK,OAAO,SAAS,KAAK,SAAS,KAAU,WAAU,0BAAyB;AAAA;AAAA;AAAA,QACpG,KAVO,KAAK,IAWd,CACD,GACH;AAAA,WApBY,MAAM,KAqBpB;AAAA,IAEJ,CAAC;AAAA,KACL;AAEJ,CAAC;","names":["ChangeIndex"]}
@@ -0,0 +1,87 @@
1
+ // src/components/review/DeltaValue.tsx
2
+ import * as React from "react";
3
+ import { cn } from "../../lib/recipe.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ var DEFAULT_FORMAT = new Intl.NumberFormat("en", { maximumFractionDigits: 2 });
6
+ function signed(value, format) {
7
+ if (value > 0) return `+${format(value)}`;
8
+ if (value < 0) return `\u2212${format(-value)}`;
9
+ return format(0);
10
+ }
11
+ function deltaTrend(change, direction) {
12
+ if (direction == null || change === 0) return void 0;
13
+ const up = change > 0;
14
+ return direction === "lower-is-better" === up ? "against" : "with";
15
+ }
16
+ var DEFAULT_SIGNIFICANCE = { noise: 0.02, major: 0.1 };
17
+ function deltaSignificance(relative, bands = {}) {
18
+ if (relative == null || !Number.isFinite(relative)) return "notable";
19
+ const { noise, major } = { ...DEFAULT_SIGNIFICANCE, ...bands };
20
+ const size = Math.abs(relative);
21
+ if (size < noise) return "noise";
22
+ return size >= major ? "major" : "notable";
23
+ }
24
+ function trendTone(trend, significance) {
25
+ if (trend == null || significance === "noise") return "text-content-secondary";
26
+ return trend === "against" ? "text-intent-danger" : "text-intent-success";
27
+ }
28
+ var DeltaValue = React.forwardRef(function DeltaValue2({ before, after, unit, direction, significance, relative = false, format = DEFAULT_FORMAT.format, className, ...rest }, ref) {
29
+ const withUnit = (value) => unit ? `${format(value)} ${unit}` : format(value);
30
+ const base = "inline-flex items-baseline gap-1.5 whitespace-nowrap font-mono text-sm tabular-nums";
31
+ const invalid = (v) => v != null && !Number.isFinite(v);
32
+ if (before == null && after == null || invalid(before) || invalid(after)) {
33
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "delta-value", "data-state": "unmeasured", ...rest, className: cn(base, "text-content-muted", className), children: [
34
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2014" }),
35
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "not measured" })
36
+ ] });
37
+ }
38
+ if (before == null) {
39
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "delta-value", "data-state": "new", ...rest, className: cn(base, "text-content-primary", className), children: [
40
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold uppercase tracking-wider text-content-muted", children: "new" }),
41
+ /* @__PURE__ */ jsx("span", { children: withUnit(after) })
42
+ ] });
43
+ }
44
+ if (after == null) {
45
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "delta-value", "data-state": "missing", ...rest, className: cn(base, "text-content-secondary", className), children: [
46
+ /* @__PURE__ */ jsx("span", { className: "line-through", children: withUnit(before) }),
47
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-bold uppercase tracking-wider text-content-muted", children: "gone" })
48
+ ] });
49
+ }
50
+ const change = after - before;
51
+ if (change === 0) {
52
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "delta-value", "data-state": "unchanged", ...rest, className: cn(base, "text-content-muted", className), children: [
53
+ /* @__PURE__ */ jsx("span", { children: withUnit(after) }),
54
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "=" }),
55
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "unchanged" })
56
+ ] });
57
+ }
58
+ const trend = deltaTrend(change, direction);
59
+ const size = deltaSignificance(before === 0 ? void 0 : change / Math.abs(before), significance);
60
+ const rel = relative ? before === 0 ? "n/a" : `${signed(change / Math.abs(before) * 100, (v) => DEFAULT_FORMAT.format(Number(v.toFixed(1))))}%` : null;
61
+ return /* @__PURE__ */ jsxs("span", { ref, "data-slot": "delta-value", "data-state": "changed", "data-trend": trend, "data-significance": size, ...rest, className: cn(base, "text-content-primary", className), children: [
62
+ /* @__PURE__ */ jsx("span", { className: "text-content-secondary", children: withUnit(before) }),
63
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-content-muted", children: "\u2192" }),
64
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: "to" }),
65
+ /* @__PURE__ */ jsx("span", { children: withUnit(after) }),
66
+ /* @__PURE__ */ jsxs("span", { "data-slot": "delta-value-change", className: cn(trendTone(trend, size), trend && size !== "noise" && (trend === "against" || size === "major") && "font-bold"), children: [
67
+ signed(change, format),
68
+ rel != null ? /* @__PURE__ */ jsxs("span", { className: "pl-1 text-content-muted", children: [
69
+ "(",
70
+ rel,
71
+ ")"
72
+ ] }) : null
73
+ ] }),
74
+ trend ? /* @__PURE__ */ jsxs(Fragment, { children: [
75
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("text-xs", trendTone(trend, size)), children: change > 0 ? "\u25B2" : "\u25BC" }),
76
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: trend === "against" ? `, against the preferred direction (${direction?.replace(/-/g, " ")})` : `, with the preferred direction (${direction?.replace(/-/g, " ")})` })
77
+ ] }) : null
78
+ ] });
79
+ });
80
+ export {
81
+ DEFAULT_SIGNIFICANCE,
82
+ DeltaValue,
83
+ deltaSignificance,
84
+ deltaTrend,
85
+ trendTone
86
+ };
87
+ //# sourceMappingURL=DeltaValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/DeltaValue.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn } from '../../lib/recipe';\n\n/** Which way a measurement is preferred to move. Omit when neither is. */\nexport type MetricDirection = 'higher-is-better' | 'lower-is-better';\n\nexport interface DeltaValueProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'children'> {\n /** The baseline's value. `null` or omitted when the measurement is new. */\n before?: number | null;\n /** The candidate's value. `null` or omitted when the measurement is gone. */\n after?: number | null;\n /** Printed after each value, e.g. `kB` or `ms`. */\n unit?: string;\n /**\n * The measurement's declared direction. A move with it is drawn in the success role, a move\n * against it in danger with ▲ or ▼ in bold. Without one, change stays uncoloured.\n */\n direction?: MetricDirection;\n /** Relative-change bands. A move under `noise` stays uncoloured; at or over `major` it is bold. */\n significance?: DeltaSignificance;\n /** Also print the relative change. A zero baseline prints `n/a` rather than infinity. */\n relative?: boolean;\n /** Formats each number. Defaults to a fixed `en` grouping, so output does not vary by machine. */\n format?: (value: number) => string;\n /** Additional classes for the value. */\n className?: string;\n}\n\nconst DEFAULT_FORMAT = new Intl.NumberFormat('en', { maximumFractionDigits: 2 });\n\nfunction signed(value: number, format: (value: number) => string): string {\n if (value > 0) return `+${format(value)}`;\n if (value < 0) return `−${format(-value)}`;\n return format(0);\n}\n\n/** `against` when the change moves away from the preferred direction, `with` when toward it. */\nexport function deltaTrend(change: number, direction?: MetricDirection): 'against' | 'with' | undefined {\n if (direction == null || change === 0) return undefined;\n const up = change > 0;\n return (direction === 'lower-is-better') === up ? 'against' : 'with';\n}\n\n/** Relative-change bands, as fractions of the baseline: under `noise` is drawn quiet, at or over `major` heavy. */\nexport interface DeltaSignificance {\n noise?: number;\n major?: number;\n}\n\nexport const DEFAULT_SIGNIFICANCE: Required<DeltaSignificance> = { noise: 0.02, major: 0.1 };\n\n/** How loudly a relative change should read. `undefined` relative (no baseline to divide by) is `notable`. */\nexport function deltaSignificance(relative: number | undefined, bands: DeltaSignificance = {}): 'noise' | 'notable' | 'major' {\n if (relative == null || !Number.isFinite(relative)) return 'notable';\n const { noise, major } = { ...DEFAULT_SIGNIFICANCE, ...bands };\n const size = Math.abs(relative);\n if (size < noise) return 'noise';\n return size >= major ? 'major' : 'notable';\n}\n\n/** Text colour for a directed change: better is success, worse is danger, noise and undirected change stay neutral. */\nexport function trendTone(trend: 'against' | 'with' | undefined, significance: 'noise' | 'notable' | 'major'): string {\n if (trend == null || significance === 'noise') return 'text-content-secondary';\n return trend === 'against' ? 'text-intent-danger' : 'text-intent-success';\n}\n\n/**\n * A measured change, `before → after +n`, the form a numeric Delta reports.\n *\n * Colour follows the declared direction and the size of the move: toward the preferred direction\n * reads as success, away from it as danger, and a relative move under the noise band stays\n * neutral. With no direction declared a change is only a change and is never coloured. Whether a\n * move is acceptable is still the Assessment's call; this only says which way it went and how far. A new or missing measurement says so\n * in words, and a zero baseline makes the relative change `n/a` rather than an infinite percent.\n */\nexport const DeltaValue = React.forwardRef<HTMLSpanElement, DeltaValueProps>(function DeltaValue(\n { before, after, unit, direction, significance, relative = false, format = DEFAULT_FORMAT.format, className, ...rest },\n ref,\n) {\n const withUnit = (value: number) => (unit ? `${format(value)} ${unit}` : format(value));\n const base = 'inline-flex items-baseline gap-1.5 whitespace-nowrap font-mono text-sm tabular-nums';\n\n // NaN or an infinity is not a measurement: say so rather than report a zero or infinite move.\n const invalid = (v: number | null | undefined) => v != null && !Number.isFinite(v);\n if ((before == null && after == null) || invalid(before) || invalid(after)) {\n return (\n <span ref={ref} data-slot=\"delta-value\" data-state=\"unmeasured\" {...rest} className={cn(base, 'text-content-muted', className)}>\n <span aria-hidden=\"true\">—</span>\n <span className=\"sr-only\">not measured</span>\n </span>\n );\n }\n if (before == null) {\n return (\n <span ref={ref} data-slot=\"delta-value\" data-state=\"new\" {...rest} className={cn(base, 'text-content-primary', className)}>\n <span className=\"text-xs font-bold uppercase tracking-wider text-content-muted\">new</span>\n <span>{withUnit(after!)}</span>\n </span>\n );\n }\n if (after == null) {\n return (\n <span ref={ref} data-slot=\"delta-value\" data-state=\"missing\" {...rest} className={cn(base, 'text-content-secondary', className)}>\n <span className=\"line-through\">{withUnit(before)}</span>\n <span className=\"text-xs font-bold uppercase tracking-wider text-content-muted\">gone</span>\n </span>\n );\n }\n\n const change = after - before;\n if (change === 0) {\n return (\n <span ref={ref} data-slot=\"delta-value\" data-state=\"unchanged\" {...rest} className={cn(base, 'text-content-muted', className)}>\n <span>{withUnit(after)}</span>\n <span aria-hidden=\"true\">=</span>\n <span className=\"sr-only\">unchanged</span>\n </span>\n );\n }\n\n const trend = deltaTrend(change, direction);\n const size = deltaSignificance(before === 0 ? undefined : change / Math.abs(before), significance);\n const rel = relative ? (before === 0 ? 'n/a' : `${signed((change / Math.abs(before)) * 100, (v) => DEFAULT_FORMAT.format(Number(v.toFixed(1))))}%`) : null;\n return (\n <span ref={ref} data-slot=\"delta-value\" data-state=\"changed\" data-trend={trend} data-significance={size} {...rest} className={cn(base, 'text-content-primary', className)}>\n <span className=\"text-content-secondary\">{withUnit(before)}</span>\n <span aria-hidden=\"true\" className=\"text-content-muted\">→</span>\n <span className=\"sr-only\">to</span>\n <span>{withUnit(after)}</span>\n <span data-slot=\"delta-value-change\" className={cn(trendTone(trend, size), trend && size !== 'noise' && (trend === 'against' || size === 'major') && 'font-bold')}>\n {signed(change, format)}\n {rel != null ? <span className=\"pl-1 text-content-muted\">({rel})</span> : null}\n </span>\n {trend ? (\n <>\n <span aria-hidden=\"true\" className={cn('text-xs', trendTone(trend, size))}>{change > 0 ? '▲' : '▼'}</span>\n <span className=\"sr-only\">{trend === 'against' ? `, against the preferred direction (${direction?.replace(/-/g, ' ')})` : `, with the preferred direction (${direction?.replace(/-/g, ' ')})`}</span>\n </>\n ) : null}\n </span>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,UAAU;AAqFb,SAgDE,UA/CA,KADF;AA1DN,IAAM,iBAAiB,IAAI,KAAK,aAAa,MAAM,EAAE,uBAAuB,EAAE,CAAC;AAE/E,SAAS,OAAO,OAAe,QAA2C;AACxE,MAAI,QAAQ,EAAG,QAAO,IAAI,OAAO,KAAK,CAAC;AACvC,MAAI,QAAQ,EAAG,QAAO,SAAI,OAAO,CAAC,KAAK,CAAC;AACxC,SAAO,OAAO,CAAC;AACjB;AAGO,SAAS,WAAW,QAAgB,WAA6D;AACtG,MAAI,aAAa,QAAQ,WAAW,EAAG,QAAO;AAC9C,QAAM,KAAK,SAAS;AACpB,SAAQ,cAAc,sBAAuB,KAAK,YAAY;AAChE;AAQO,IAAM,uBAAoD,EAAE,OAAO,M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A,IACvB,qBAAC,UAAK,aAAU,sBAAqB,WAAW,GAAG,UAAU,OAAO,IAAI,GAAG,SAAS,SAAS,YAAY,UAAU,aAAa,SAAS,YAAY,WAAW,GAC7J;AAAA,aAAO,QAAQ,MAAM;AAAA,MACrB,OAAO,OAAO,qBAAC,UAAK,WAAU,2BAA0B;AAAA;AAAA,QAAE;AAAA,QAAI;AAAA,SAAC,IAAU;AAAA,OAC5E;AAAA,IACC,QACC,iCACE;AAAA,0BAAC,UAAK,eAAY,QAAO,WAAW,GAAG,WAAW,UAAU,OAAO,IAAI,CAAC,GAAI,mBAAS,IAAI,WAAM,UAAI;AAAA,MACnG,oBAAC,UAAK,WAAU,WAAW,oBAAU,YAAY,sCAAsC,WAAW,QAAQ,MAAM,GAAG,CAAC,MAAM,mCAAmC,WAAW,QAAQ,MAAM,GAAG,CAAC,KAAI;AAAA,OAChM,IACE;AAAA,KACN;AAEJ,CAAC;","names":["DeltaValue"]}
@@ -0,0 +1,115 @@
1
+ // src/components/review/DiffView.tsx
2
+ import * as React from "react";
3
+ import { cn, recipe } from "../../lib/recipe.js";
4
+ import { ChangeBar } from "./ChangeBar.js";
5
+ import { ChangeCount } from "./ChangeCount.js";
6
+ import { countDiff, diffAnchor } from "./diff.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ var LINES = ["line", "lines"];
9
+ var SIGN = { added: "+", removed: "\u2212", context: " " };
10
+ var SPOKEN = { added: "added", removed: "removed", context: "" };
11
+ var diffStyles = recipe({
12
+ slots: {
13
+ root: "border border-edge-default bg-surface-raised scroll-mt-3",
14
+ summary: "grid cursor-pointer list-none grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 px-3 py-2.5 font-mono text-sm sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] [&::-webkit-details-marker]:hidden group-open:border-b group-open:border-edge-default group-open:bg-surface-sunken",
15
+ scroll: "overflow-x-auto",
16
+ table: "w-full border-collapse font-mono text-xs leading-relaxed",
17
+ gutter: "w-px select-none whitespace-nowrap border-r border-edge-subtle px-2.5 text-right align-top tabular-nums text-content-muted",
18
+ sign: "w-px select-none px-2 align-top font-bold",
19
+ text: "px-2.5 align-top text-content-primary"
20
+ },
21
+ variants: {
22
+ wrap: {
23
+ true: { text: "whitespace-pre-wrap [overflow-wrap:anywhere]" },
24
+ false: { text: "whitespace-pre" }
25
+ }
26
+ },
27
+ defaultVariants: { wrap: false }
28
+ });
29
+ var ROW = {
30
+ added: "bg-delta-ground-added",
31
+ removed: "bg-delta-ground-removed",
32
+ context: ""
33
+ };
34
+ var SIGN_TONE = {
35
+ added: "text-delta-added",
36
+ removed: "text-delta-removed",
37
+ context: "text-content-muted"
38
+ };
39
+ function PathLabel({ path }) {
40
+ const cut = path.lastIndexOf("/");
41
+ return /* @__PURE__ */ jsxs("span", { "data-slot": "diff-view-path", className: "min-w-0 font-semibold [overflow-wrap:anywhere]", children: [
42
+ cut >= 0 ? /* @__PURE__ */ jsx("span", { className: "font-normal text-content-muted", children: path.slice(0, cut + 1) }) : null,
43
+ path.slice(cut + 1)
44
+ ] });
45
+ }
46
+ var DiffView = React.forwardRef(function DiffView2({ path, hunks, collapsible = true, defaultOpen = false, wrap = false, max, id, className, ...rest }, ref) {
47
+ const styles = diffStyles({ wrap });
48
+ const { added, removed } = countDiff(hunks);
49
+ const anchor = id ?? diffAnchor(path);
50
+ const body = hunks.length === 0 ? /* @__PURE__ */ jsx("p", { className: "m-0 px-3 py-3 text-sm text-content-muted", children: "No line changes." }) : (
51
+ // A long line scrolls sideways; the region takes focus so the keyboard can scroll it too.
52
+ /* @__PURE__ */ jsx("div", { className: styles.scroll(), tabIndex: 0, role: "region", "aria-label": `Diff of ${path}`, children: /* @__PURE__ */ jsxs("table", { "data-slot": "diff-view-table", className: styles.table(), children: [
53
+ /* @__PURE__ */ jsx("caption", { className: "sr-only", children: `Changes to ${path}: ${added} added, ${removed} removed` }),
54
+ hunks.map((hunk, h) => /* @__PURE__ */ jsxs("tbody", { "data-slot": "diff-view-hunk", children: [
55
+ /* @__PURE__ */ jsxs("tr", { className: "bg-delta-ground-hunk", children: [
56
+ /* @__PURE__ */ jsx("td", { className: cn(styles.gutter(), "border-r-0"), colSpan: 3, "aria-hidden": "true" }),
57
+ /* @__PURE__ */ jsx("td", { className: "px-2.5 py-0.5 text-content-secondary whitespace-pre-wrap [overflow-wrap:anywhere]", children: hunk.header })
58
+ ] }),
59
+ hunk.lines.flatMap((line, l) => [
60
+ /* @__PURE__ */ jsxs("tr", { "data-kind": line.kind, className: ROW[line.kind], children: [
61
+ /* @__PURE__ */ jsx("td", { className: styles.gutter(), children: line.oldNumber ?? "" }),
62
+ /* @__PURE__ */ jsx("td", { className: styles.gutter(), children: line.newNumber ?? "" }),
63
+ /* @__PURE__ */ jsxs("td", { className: cn(styles.sign(), SIGN_TONE[line.kind]), children: [
64
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: SIGN[line.kind] }),
65
+ line.kind !== "context" ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: SPOKEN[line.kind] }) : null
66
+ ] }),
67
+ /* @__PURE__ */ jsx("td", { className: styles.text(), children: line.text })
68
+ ] }, l),
69
+ ...(line.comments ?? []).map((comment, c) => /* @__PURE__ */ jsx("tr", { "data-slot": "diff-view-comment", children: /* @__PURE__ */ jsx("td", { colSpan: 4, className: "px-2.5 py-2 font-sans", children: /* @__PURE__ */ jsxs("div", { className: "sticky left-2 flex w-[min(48rem,calc(100vw-4.5rem))] flex-col sm:ml-24 gap-1.5 whitespace-normal border border-l-2 border-edge-default border-l-accent-primary bg-surface-raised px-3 py-2.5", children: [
70
+ /* @__PURE__ */ jsxs("p", { className: "m-0 flex flex-wrap items-baseline gap-x-2 font-mono text-xs", children: [
71
+ /* @__PURE__ */ jsx("span", { className: "font-bold text-content-primary", children: comment.author }),
72
+ comment.meta ? /* @__PURE__ */ jsx("span", { className: "text-content-muted", children: comment.meta }) : null,
73
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: `commented on ${line.kind === "removed" ? "removed" : ""} line ${line.newNumber ?? line.oldNumber ?? ""}` })
74
+ ] }),
75
+ /* @__PURE__ */ jsx("div", { className: "text-sm text-content-primary [overflow-wrap:anywhere]", children: comment.body })
76
+ ] }) }) }, `${l}-comment-${c}`))
77
+ ])
78
+ ] }, `${hunk.header}-${h}`))
79
+ ] }) })
80
+ );
81
+ const summary = /* @__PURE__ */ jsxs(Fragment, { children: [
82
+ collapsible ? /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "font-bold text-content-muted", children: [
83
+ /* @__PURE__ */ jsx("span", { className: "group-open:hidden", children: "[+]" }),
84
+ /* @__PURE__ */ jsx("span", { className: "hidden group-open:inline", children: "[\u2212]" })
85
+ ] }) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }),
86
+ /* @__PURE__ */ jsx(PathLabel, { path }),
87
+ /* @__PURE__ */ jsx(ChangeCount, { added, removed, noun: LINES }),
88
+ /* @__PURE__ */ jsx(ChangeBar, { added, removed, max, className: "hidden sm:inline-block" })
89
+ ] });
90
+ if (!collapsible) {
91
+ return /* @__PURE__ */ jsxs("section", { ref, id: anchor, "aria-label": path, "data-slot": "diff-view", ...rest, className: cn(styles.root(), className), children: [
92
+ /* @__PURE__ */ jsx("div", { className: cn(styles.summary(), "cursor-auto border-b border-edge-default bg-surface-sunken"), children: summary }),
93
+ body
94
+ ] });
95
+ }
96
+ return /* @__PURE__ */ jsxs(
97
+ "details",
98
+ {
99
+ ref,
100
+ id: anchor,
101
+ open: defaultOpen,
102
+ "data-slot": "diff-view",
103
+ ...rest,
104
+ className: cn("group", styles.root(), className),
105
+ children: [
106
+ /* @__PURE__ */ jsx("summary", { className: styles.summary(), children: summary }),
107
+ body
108
+ ]
109
+ }
110
+ );
111
+ });
112
+ export {
113
+ DiffView
114
+ };
115
+ //# sourceMappingURL=DiffView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/review/DiffView.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cn, recipe } from '../../lib/recipe';\nimport { ChangeBar } from './ChangeBar';\nimport { ChangeCount } from './ChangeCount';\n\nconst LINES = ['line', 'lines'] as const;\nimport { countDiff, diffAnchor, type DiffHunk, type DiffLineKind } from './diff';\n\nexport interface DiffViewProps extends Omit<React.HTMLAttributes<HTMLElement>, 'children'> {\n /** The file's path. The directory part is drawn muted; the anchor `id` is derived from it. */\n path: string;\n /** The hunks to draw. `parseUnifiedDiff` reads them from `git diff` output. */\n hunks: readonly DiffHunk[];\n /** Fold the file behind its summary row, as a `<details>`. Defaults to `true`. */\n collapsible?: boolean;\n /** Start unfolded. Printing prints only what is open. */\n defaultOpen?: boolean;\n /** Wrap long lines instead of scrolling them. */\n wrap?: boolean;\n /** The largest change beside this one, so the summary bars share a scale. */\n max?: number;\n /** Additional classes for the root. */\n className?: string;\n}\n\nconst SIGN: Record<DiffLineKind, string> = { added: '+', removed: '−', context: ' ' };\nconst SPOKEN: Record<DiffLineKind, string> = { added: 'added', removed: 'removed', context: '' };\n\nconst diffStyles = recipe({\n slots: {\n root: 'border border-edge-default bg-surface-raised scroll-mt-3',\n summary: 'grid cursor-pointer list-none grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 px-3 py-2.5 font-mono text-sm sm:grid-cols-[auto_minmax(0,1fr)_auto_auto] [&::-webkit-details-marker]:hidden group-open:border-b group-open:border-edge-default group-open:bg-surface-sunken',\n scroll: 'overflow-x-auto',\n table: 'w-full border-collapse font-mono text-xs leading-relaxed',\n gutter: 'w-px select-none whitespace-nowrap border-r border-edge-subtle px-2.5 text-right align-top tabular-nums text-content-muted',\n sign: 'w-px select-none px-2 align-top font-bold',\n text: 'px-2.5 align-top text-content-primary',\n },\n variants: {\n wrap: {\n true: { text: 'whitespace-pre-wrap [overflow-wrap:anywhere]' },\n false: { text: 'whitespace-pre' },\n },\n },\n defaultVariants: { wrap: false },\n});\n\nconst ROW: Record<DiffLineKind, string> = {\n added: 'bg-delta-ground-added',\n removed: 'bg-delta-ground-removed',\n context: '',\n};\n\nconst SIGN_TONE: Record<DiffLineKind, string> = {\n added: 'text-delta-added',\n removed: 'text-delta-removed',\n context: 'text-content-muted',\n};\n\nfunction PathLabel({ path }: { path: string }) {\n const cut = path.lastIndexOf('/');\n return (\n <span data-slot=\"diff-view-path\" className=\"min-w-0 font-semibold [overflow-wrap:anywhere]\">\n {cut >= 0 ? <span className=\"font-normal text-content-muted\">{path.slice(0, cut + 1)}</span> : null}\n {path.slice(cut + 1)}\n </span>\n );\n}\n\n/**\n * One file's line diff: a summary row with the path, a change count and a bar, then each hunk's\n * header and its lines with baseline and candidate line numbers in two gutters.\n *\n * A changed row is told by its sign column as well as its ground, so the diff survives\n * greyscale printing. Folds as a `<details>` by default — the one disclosure a static report\n * has — with a `[+]`/`[−]` text marker. Colours are the `delta` roles: an added line is added,\n * not approved.\n */\nexport const DiffView = React.forwardRef<HTMLElement, DiffViewProps>(function DiffView(\n { path, hunks, collapsible = true, defaultOpen = false, wrap = false, max, id, className, ...rest },\n ref,\n) {\n const styles = diffStyles({ wrap });\n const { added, removed } = countDiff(hunks);\n const anchor = id ?? diffAnchor(path);\n\n const body =\n hunks.length === 0 ? (\n <p className=\"m-0 px-3 py-3 text-sm text-content-muted\">No line changes.</p>\n ) : (\n // A long line scrolls sideways; the region takes focus so the keyboard can scroll it too.\n <div className={styles.scroll()} tabIndex={0} role=\"region\" aria-label={`Diff of ${path}`}>\n <table data-slot=\"diff-view-table\" className={styles.table()}>\n <caption className=\"sr-only\">{`Changes to ${path}: ${added} added, ${removed} removed`}</caption>\n {hunks.map((hunk, h) => (\n <tbody key={`${hunk.header}-${h}`} data-slot=\"diff-view-hunk\">\n <tr className=\"bg-delta-ground-hunk\">\n <td className={cn(styles.gutter(), 'border-r-0')} colSpan={3} aria-hidden=\"true\" />\n <td className=\"px-2.5 py-0.5 text-content-secondary whitespace-pre-wrap [overflow-wrap:anywhere]\">{hunk.header}</td>\n </tr>\n {hunk.lines.flatMap((line, l) => [\n <tr key={l} data-kind={line.kind} className={ROW[line.kind]}>\n <td className={styles.gutter()}>{line.oldNumber ?? ''}</td>\n <td className={styles.gutter()}>{line.newNumber ?? ''}</td>\n <td className={cn(styles.sign(), SIGN_TONE[line.kind])}>\n <span aria-hidden=\"true\">{SIGN[line.kind]}</span>\n {line.kind !== 'context' ? <span className=\"sr-only\">{SPOKEN[line.kind]}</span> : null}\n </td>\n <td className={styles.text()}>{line.text}</td>\n </tr>,\n ...(line.comments ?? []).map((comment, c) => (\n <tr key={`${l}-comment-${c}`} data-slot=\"diff-view-comment\">\n <td colSpan={4} className=\"px-2.5 py-2 font-sans\">\n {/* Sticky to the scroller's left edge and no wider than the viewport, so a comment stays\n readable on a narrow screen while the long lines beside it scroll. */}\n <div className=\"sticky left-2 flex w-[min(48rem,calc(100vw-4.5rem))] flex-col sm:ml-24 gap-1.5 whitespace-normal border border-l-2 border-edge-default border-l-accent-primary bg-surface-raised px-3 py-2.5\">\n <p className=\"m-0 flex flex-wrap items-baseline gap-x-2 font-mono text-xs\">\n <span className=\"font-bold text-content-primary\">{comment.author}</span>\n {comment.meta ? <span className=\"text-content-muted\">{comment.meta}</span> : null}\n <span className=\"sr-only\">{`commented on ${line.kind === 'removed' ? 'removed' : ''} line ${line.newNumber ?? line.oldNumber ?? ''}`}</span>\n </p>\n <div className=\"text-sm text-content-primary [overflow-wrap:anywhere]\">{comment.body}</div>\n </div>\n </td>\n </tr>\n )),\n ])}\n </tbody>\n ))}\n </table>\n </div>\n );\n\n const summary = (\n <>\n {collapsible ? (\n <span aria-hidden=\"true\" className=\"font-bold text-content-muted\">\n <span className=\"group-open:hidden\">[+]</span>\n <span className=\"hidden group-open:inline\">[−]</span>\n </span>\n ) : (\n <span aria-hidden=\"true\" />\n )}\n <PathLabel path={path} />\n <ChangeCount added={added} removed={removed} noun={LINES} />\n <ChangeBar added={added} removed={removed} max={max} className=\"hidden sm:inline-block\" />\n </>\n );\n\n if (!collapsible) {\n return (\n <section ref={ref} id={anchor} aria-label={path} data-slot=\"diff-view\" {...rest} className={cn(styles.root(), className)}>\n <div className={cn(styles.summary(), 'cursor-auto border-b border-edge-default bg-surface-sunken')}>{summary}</div>\n {body}\n </section>\n );\n }\n return (\n <details\n ref={ref as React.Ref<HTMLDetailsElement>}\n id={anchor}\n open={defaultOpen}\n data-slot=\"diff-view\"\n {...(rest as React.HTMLAttributes<HTMLDetailsElement>)}\n className={cn('group', styles.root(), className)}\n >\n <summary className={styles.summary()}>{summary}</summary>\n {body}\n </details>\n );\n});\n"],"mappings":";AAAA,YAAY,WAAW;AACvB,SAAS,IAAI,cAAc;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB;AAG5B,SAAS,WAAW,kBAAoD;AAwDpE,SAwEA,UAvEc,KADd;AAzDJ,IAAM,QAAQ,CAAC,QAAQ,OAAO;AAoB9B,IAAM,OAAqC,EAAE,OAAO,KAAK,SAAS,UAAK,SAAS,IAAI;AACpF,IAAM,SAAuC,EAAE,OAAO,SAAS,SAAS,WAAW,SAAS,GAAG;AAE/F,IAAM,aAAa,OAAO;AAAA,EACxB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,MAAM,EAAE,MAAM,+CAA+C;AAAA,MAC7D,OAAO,EAAE,MAAM,iBAAiB;AAAA,IAClC;AAAA,EACF;AAAA,EACA,iBAAiB,EAAE,MAAM,MAAM;AACjC,CAAC;AAED,IAAM,MAAoC;AAAA,EACxC,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AAEA,IAAM,YAA0C;AAAA,EAC9C,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX;AAEA,SAAS,UAAU,EAAE,KAAK,GAAqB;AAC7C,QAAM,MAAM,KAAK,YAAY,GAAG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,aAAU,MAAY;AAAA,IACvB,oBAAC,eAAY,OAAc,SAAkB,MAAM,OAAO;AAAA,IAC1D,oBAAC,aAAU,OAAc,SAAkB,KAAU,WAAU,0BAAyB;AAAA,KAC1F;AAGF,MAAI,CAAC,aAAa;AAChB,WACE,qBAAC,aAAQ,KAAU,IAAI,QAAQ,cAAY,MAAM,aAAU,aAAa,GAAG,MAAM,WAAW,GAAG,OAAO,KAAK,GAAG,SAAS,GACrH;AAAA,0BAAC,SAAI,WAAW,GAAG,OAAO,QAAQ,GAAG,4DAA4D,GAAI,mBAAQ;AAAA,MAC5G;AAAA,OACH;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,aAAU;AAAA,MACT,GAAI;AAAA,MACL,WAAW,GAAG,SAAS,OAAO,KAAK,GAAG,SAAS;AAAA,MAE/C;AAAA,4BAAC,aAAQ,WAAW,OAAO,QAAQ,GAAI,mBAAQ;AAAA,QAC9C;AAAA;AAAA;AAAA,EACH;AAEJ,CAAC;","names":["DiffView"]}
@@ -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,WAAY,GAAG,MAAM,WAAW,GAAG,iDAAiD,SAAS,GAC7K,+BAAC,WAAM,WAAU,uEACf;AAAA,0BAAC,aAAQ,IAAI,WAAW,WAAU,iGAAiG,mBAAQ;AAAA,MAC3I,oBAAC,WACC,+BAAC,QACC;AAAA,4BAAC,QAAG,OAAM,OAAM,WAAW,MAAM,oBAAM;AAAA,QACvC,oBAAC,QAAG,OAAM,OAAM,WAAW,MAAO,yBAAc;AAAA,QAC/C,QAAQ,IAAI,CAAC,WACZ,oBAAC,QAAgB,OAAM,OAAM,WAAW,GAAG,MAAM,YAAY,GAAI,oBAAxD,MAA+D,CACzE;AAAA,SACH,GACF;AAAA,MACA,oBAAC,WACE,eAAK,WAAW,IACf,oBAAC,QACC,8BAAC,QAAG,SAAS,IAAI,QAAQ,QAAQ,WAAW,GAAG,MAAM,oBAAoB,GAAI,qBAAU,GACzF,IAEA,KAAK,IAAI,CAAC,KAAK,UAAU;AACvB,cAAM,OAAO,KAAK,IAAI,MAAM;AAC5B,eACE,qBAAC,QAAyB,eAAa,IAAI,QACzC;AAAA,+BAAC,QAAG,WAAW,GAAG,MAAM,0EAA0E,KAAK,IAAI,GACzG;AAAA,gCAAC,UAAK,eAAY,QAAO,WAAU,UAAU,eAAK,OAAM;AAAA,YACvD,MAAM,IAAI,MAAM;AAAA,aACnB;AAAA,UACA,oBAAC,QAAG,OAAM,OAAM,WAAW,GAAG,MAAM,iFAAiF,IAAI,WAAW,aAAa,cAAc,GAC5J,cAAI,UACP;AAAA,UACC,QAAQ,IAAI,CAAC,QAAQ,MACpB,oBAAC,QAAgB,WAAW,GAAG,MAAM,yBAAyB,GAAI,cAAI,QAAQ,CAAC,KAAtE,MAAwE,CAClF;AAAA,aAVM,IAAI,MAAM,KAWnB;AAAA,MAEJ,CAAC,GAEL;AAAA,OACF,GACF;AAAA;AAEJ,CAAC;","names":["KeyedDiff"]}
@@ -0,0 +1,17 @@
1
+ // src/components/review/ProvenanceStrip.tsx
2
+ import * as React from "react";
3
+ 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