@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/ActivityGrid.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-activity/graph-activity.tsx\n * The local port removes motion and graph variables in favour of deterministic\n * rendering and the design system's semantic token classes.\n */\n\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\nconst DAY_MS = 86_400_000;\nconst MAX_DAYS = 3660;\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;\nconst DEFAULT_GLYPHS = ['·', '░', '▒', '▓', '█'];\ntype Glyphs = 'shade' | 'ascii' | 'hash' | 'bar' | readonly string[];\ntype FigurePalette = 'mono' | 'duo' | 'multi';\n\nfunction glyphsOf(glyphs?: Glyphs): readonly string[] {\n if (Array.isArray(glyphs)) return glyphs.length ? glyphs : DEFAULT_GLYPHS;\n if (glyphs === 'ascii') return ['.', '-', '=', '#', '@'];\n if (glyphs === 'hash') return ['.', ':', '+', '#', '█'];\n if (glyphs === 'bar') return ['▁', '▂', '▃', '▅', '█'];\n return DEFAULT_GLYPHS;\n}\nfunction intensity(level: number, max: number): number { return level <= 0 || max <= 0 ? 0 : Math.max(1, Math.round(Math.min(1, level / max) * 4)); }\nfunction colorClass(level: number, palette: FigurePalette = 'mono'): string {\n if (!level) return 'text-content-muted';\n if (palette === 'mono') return level <= 2 ? 'text-content-secondary' : 'text-content-primary';\n return level === 1 ? 'text-accent-secondary' : level === 2 && palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-primary';\n}\nfunction renderGlyph(level: number, glyphs: readonly string[]): string { return glyphs[Math.round(Math.max(0, Math.min(4, level)) / 4 * (glyphs.length - 1))] ?? glyphs[0] ?? '·'; }\n\nexport interface ActivityDay {\n /** Calendar date in ISO `YYYY-MM-DD` form, interpreted in UTC. */\n date: string;\n /** Non-negative activity count for the date. */\n count: number;\n}\n\nexport interface ActivityGridProps extends React.HTMLAttributes<HTMLElement> {\n /** Dated counts used to derive the contribution grid. */\n data: ActivityDay[];\n /** First weekday in each column: Sunday (0) or Monday (1). */\n weekStartsOn?: 0 | 1;\n /** Optional upper bound for intensity scaling. */\n max?: number;\n /** Render the less/more glyph legend. */\n legend?: boolean;\n /** Glyph set name or custom glyph sequence. */\n glyphs?: Glyphs;\n /** Accent palette used for intensity levels. */\n palette?: FigurePalette;\n /** Additional classes for the renderer root. */\n className?: string;\n}\n\ninterface Cell { date: string; count: number; inRange: boolean }\n\nfunction parseDate(value: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return null;\n const [, y, m, d] = match;\n const date = new Date(0);\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCFullYear(Number(y), Number(m) - 1, Number(d));\n return date.getUTCFullYear() === Number(y) && date.getUTCMonth() === Number(m) - 1 && date.getUTCDate() === Number(d) ? date.getTime() : null;\n}\n\nfunction iso(time: number): string { return new Date(time).toISOString().slice(0, 10); }\n\nfunction dailyCounts(data: ActivityDay[]): ActivityDay[] {\n const counts = new Map<string, number>();\n for (const item of data) {\n if (parseDate(item.date) === null) continue;\n const count = Number.isFinite(item.count) ? Math.max(0, item.count) : 0;\n counts.set(item.date, (counts.get(item.date) ?? 0) + count);\n }\n return Array.from(counts, ([date, count]) => ({ date, count }));\n}\n\nfunction makeWeeks(data: ActivityDay[], weekStartsOn: 0 | 1): Cell[][] {\n const valid = data.map((item) => ({ item, time: parseDate(item.date) })).filter((entry): entry is { item: ActivityDay; time: number } => entry.time !== null);\n if (!valid.length) return [];\n const min = valid.reduce((earliest, entry) => Math.min(earliest, entry.time), Infinity);\n const max = valid.reduce((latest, entry) => Math.max(latest, entry.time), -Infinity);\n const span = Math.floor((max - min) / DAY_MS) + 1;\n if (span > MAX_DAYS) return [];\n const first = min - ((new Date(min).getUTCDay() - weekStartsOn + 7) % 7) * DAY_MS;\n const last = max + ((weekStartsOn + 6 - new Date(max).getUTCDay() + 7) % 7) * DAY_MS;\n const counts = new Map(valid.map(({ item }) => [item.date, Math.max(0, Number.isFinite(item.count) ? item.count : 0)]));\n const weeks: Cell[][] = [];\n for (let time = first; time <= last; time += 7 * DAY_MS) {\n weeks.push(Array.from({ length: 7 }, (_, offset) => {\n const dateTime = time + offset * DAY_MS;\n const date = iso(dateTime);\n const inRange = dateTime >= min && dateTime <= max;\n return { date, count: inRange ? counts.get(date) ?? 0 : 0, inRange };\n }));\n }\n return weeks;\n}\n\nfunction Legend({ glyphs, palette }: { glyphs: readonly string[]; palette?: FigurePalette }) {\n return <p className=\"flex items-center gap-2 text-content-muted\"><span>Less</span><span aria-hidden=\"true\" className=\"flex select-none\">{glyphs.map((glyph, index) => <span className={cn('w-[1ch] text-center', colorClass(Math.round(index / Math.max(glyphs.length - 1, 1) * 4), palette))} key={`${glyph}-${index}`}>{glyph}</span>)}</span><span>More</span></p>;\n}\n\n/** Renders dated counts as a bounded, UTC-stable contribution grid. */\nexport const ActivityGrid = React.forwardRef<HTMLElement, ActivityGridProps>(function ActivityGrid({ data, weekStartsOn = 0, max, legend = true, glyphs, palette, className, ...rest }, ref) {\n const valid = dailyCounts(data);\n const weeks = makeWeeks(valid, weekStartsOn);\n const total = valid.reduce((sum, item) => sum + item.count, 0);\n const summary = `${total.toLocaleString('en-US')} contributions across ${valid.length} dates`;\n const glyphSet = glyphsOf(glyphs);\n const peak = max == null ? valid.reduce((largest, item) => Math.max(largest, item.count), 0) : Math.max(0, max);\n const weekdayLabels = weekStartsOn === 1 ? ['Mon', '', 'Wed', '', 'Fri', '', ''] : ['', 'Tue', '', 'Thu', '', 'Sat', ''];\n\n if (!valid.length || !weeks.length) return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('font-mono text-sm text-content-primary', className)}><p className=\"text-content-muted\">{valid.length ? 'Date range is too large to display.' : 'No activity dates to display.'}</p><p className=\"sr-only\">{summary}</p></section>;\n\n return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('flex w-fit max-w-full min-w-0 flex-col gap-3 font-mono text-sm text-content-primary', className)}>\n <p className=\"sr-only\">{summary}, from {valid.reduce((a, b) => a.date < b.date ? a : b).date} to {valid.reduce((a, b) => a.date > b.date ? a : b).date}.</p>\n <div className=\"overflow-x-auto\" role=\"img\" aria-label={summary}>\n <div className=\"min-w-max\">\n <div className=\"flex pl-[4ch]\" aria-hidden=\"true\">{weeks.map((week, i) => { const firstOfMonth = week.find((cell) => cell.inRange && cell.date.slice(-2) === '01'); return <span className=\"w-[2ch] shrink-0 text-content-muted\" key={i}>{firstOfMonth ? MONTHS[Number(firstOfMonth.date.slice(5, 7)) - 1] : ''}</span>; })}</div>\n <div className=\"flex gap-1\"><div className=\"flex w-[3ch] shrink-0 flex-col\" aria-hidden=\"true\">{weekdayLabels.map((label, i) => <span className=\"h-[1.2em] text-[0.7em] text-content-muted\" key={i}>{label}</span>)}</div><div className=\"flex gap-1\">{weeks.map((week) => <div className=\"flex flex-col\" key={week[0].date}>{week.map((cell) => { const level = cell.inRange ? intensity(cell.count, peak) : 0; return <span aria-hidden=\"true\" title={cell.inRange ? `${cell.date}: ${cell.count} contributions` : undefined} className={cn('flex h-[1.2em] w-[2ch] items-center justify-center leading-none', cell.inRange ? colorClass(level, palette) : 'text-transparent')} key={cell.date}>{cell.inRange ? renderGlyph(level, glyphSet) : (glyphSet[0] ?? '·')}</span>; })}</div>)}</div></div>\n </div>\n </div>\n {legend ? <div className=\"flex justify-end\"><Legend glyphs={glyphSet} palette={palette} /></div> : null}\n </section>;\n});\n"],"mappings":";AAOA,YAAY,WAAW;AACvB,SAAS,UAAU;AA+FV,SAA0D,KAA1D;AA7FT,IAAM,SAAS;AACf,IAAM,WAAW;AACjB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keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-activity/graph-activity.tsx\n * The local port removes motion and graph variables in favour of deterministic\n * rendering and the design system's semantic token classes.\n */\n\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\nimport type { FigurePalette, Glyphs } from './FigureFrame';\n\nconst DAY_MS = 86_400_000;\nconst MAX_DAYS = 3660;\nconst MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] as const;\nconst DEFAULT_GLYPHS = ['·', '░', '▒', '▓', '█'];\n\nfunction glyphsOf(glyphs?: Glyphs): readonly string[] {\n if (Array.isArray(glyphs)) return glyphs.length ? glyphs : DEFAULT_GLYPHS;\n if (glyphs === 'ascii') return ['.', '-', '=', '#', '@'];\n if (glyphs === 'hash') return ['.', ':', '+', '#', '█'];\n if (glyphs === 'bar') return ['▁', '▂', '▃', '▅', '█'];\n return DEFAULT_GLYPHS;\n}\nfunction intensity(level: number, max: number): number { return level <= 0 || max <= 0 ? 0 : Math.max(1, Math.round(Math.min(1, level / max) * 4)); }\nfunction colorClass(level: number, palette: FigurePalette = 'mono'): string {\n if (!level) return 'text-content-muted';\n if (palette === 'mono') return level <= 2 ? 'text-content-secondary' : 'text-content-primary';\n return level === 1 ? 'text-accent-secondary' : level === 2 && palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-primary';\n}\nfunction renderGlyph(level: number, glyphs: readonly string[]): string { return glyphs[Math.round(Math.max(0, Math.min(4, level)) / 4 * (glyphs.length - 1))] ?? glyphs[0] ?? '·'; }\n\nexport interface ActivityDay {\n /** Calendar date in ISO `YYYY-MM-DD` form, interpreted in UTC. */\n date: string;\n /** Non-negative activity count for the date. */\n count: number;\n}\n\nexport interface ActivityGridProps extends React.HTMLAttributes<HTMLElement> {\n /** Dated counts used to derive the contribution grid. */\n data: ActivityDay[];\n /** First weekday in each column: Sunday (0) or Monday (1). */\n weekStartsOn?: 0 | 1;\n /** Optional upper bound for intensity scaling. */\n max?: number;\n /** Render the less/more glyph legend. */\n legend?: boolean;\n /** Glyph set name or custom glyph sequence. */\n glyphs?: Glyphs;\n /** Accent palette used for intensity levels. */\n palette?: FigurePalette;\n /** Additional classes for the renderer root. */\n className?: string;\n}\n\ninterface Cell { date: string; count: number; inRange: boolean }\n\nfunction parseDate(value: string): number | null {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/.exec(value);\n if (!match) return null;\n const [, y, m, d] = match;\n const date = new Date(0);\n date.setUTCHours(0, 0, 0, 0);\n date.setUTCFullYear(Number(y), Number(m) - 1, Number(d));\n return date.getUTCFullYear() === Number(y) && date.getUTCMonth() === Number(m) - 1 && date.getUTCDate() === Number(d) ? date.getTime() : null;\n}\n\nfunction iso(time: number): string { return new Date(time).toISOString().slice(0, 10); }\n\nfunction dailyCounts(data: ActivityDay[]): ActivityDay[] {\n const counts = new Map<string, number>();\n for (const item of data) {\n if (parseDate(item.date) === null) continue;\n const count = Number.isFinite(item.count) ? Math.max(0, item.count) : 0;\n counts.set(item.date, (counts.get(item.date) ?? 0) + count);\n }\n return Array.from(counts, ([date, count]) => ({ date, count }));\n}\n\nfunction makeWeeks(data: ActivityDay[], weekStartsOn: 0 | 1): Cell[][] {\n const valid = data.map((item) => ({ item, time: parseDate(item.date) })).filter((entry): entry is { item: ActivityDay; time: number } => entry.time !== null);\n if (!valid.length) return [];\n const min = valid.reduce((earliest, entry) => Math.min(earliest, entry.time), Infinity);\n const max = valid.reduce((latest, entry) => Math.max(latest, entry.time), -Infinity);\n const span = Math.floor((max - min) / DAY_MS) + 1;\n if (span > MAX_DAYS) return [];\n const first = min - ((new Date(min).getUTCDay() - weekStartsOn + 7) % 7) * DAY_MS;\n const last = max + ((weekStartsOn + 6 - new Date(max).getUTCDay() + 7) % 7) * DAY_MS;\n const counts = new Map(valid.map(({ item }) => [item.date, Math.max(0, Number.isFinite(item.count) ? item.count : 0)]));\n const weeks: Cell[][] = [];\n for (let time = first; time <= last; time += 7 * DAY_MS) {\n weeks.push(Array.from({ length: 7 }, (_, offset) => {\n const dateTime = time + offset * DAY_MS;\n const date = iso(dateTime);\n const inRange = dateTime >= min && dateTime <= max;\n return { date, count: inRange ? counts.get(date) ?? 0 : 0, inRange };\n }));\n }\n return weeks;\n}\n\nfunction Legend({ glyphs, palette }: { glyphs: readonly string[]; palette?: FigurePalette }) {\n return <p className=\"flex items-center gap-2 text-content-muted\"><span>Less</span><span aria-hidden=\"true\" className=\"flex select-none\">{glyphs.map((glyph, index) => <span className={cn('w-[1ch] text-center', colorClass(Math.round(index / Math.max(glyphs.length - 1, 1) * 4), palette))} key={`${glyph}-${index}`}>{glyph}</span>)}</span><span>More</span></p>;\n}\n\n/** Renders dated counts as a bounded, UTC-stable contribution grid. */\nexport const ActivityGrid = React.forwardRef<HTMLElement, ActivityGridProps>(function ActivityGrid({ data, weekStartsOn = 0, max, legend = true, glyphs, palette, className, ...rest }, ref) {\n const valid = dailyCounts(data);\n const weeks = makeWeeks(valid, weekStartsOn);\n const total = valid.reduce((sum, item) => sum + item.count, 0);\n const summary = `${total.toLocaleString('en-US')} contributions across ${valid.length} dates`;\n const glyphSet = glyphsOf(glyphs);\n const peak = max == null ? valid.reduce((largest, item) => Math.max(largest, item.count), 0) : Math.max(0, max);\n const weekdayLabels = weekStartsOn === 1 ? ['Mon', '', 'Wed', '', 'Fri', '', ''] : ['', 'Tue', '', 'Thu', '', 'Sat', ''];\n\n if (!valid.length || !weeks.length) return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('font-mono text-sm text-content-primary', className)}><p className=\"text-content-muted\">{valid.length ? 'Date range is too large to display.' : 'No activity dates to display.'}</p><p className=\"sr-only\">{summary}</p></section>;\n\n return <section data-slot=\"activity-grid\" ref={ref} aria-label=\"Activity grid\" {...rest} className={cn('flex w-fit max-w-full min-w-0 flex-col gap-3 font-mono text-sm text-content-primary', className)}>\n <p className=\"sr-only\">{summary}, from {valid.reduce((a, b) => a.date < b.date ? a : b).date} to {valid.reduce((a, b) => a.date > b.date ? a : b).date}.</p>\n <div className=\"overflow-x-auto\" role=\"img\" aria-label={summary}>\n <div className=\"min-w-max\">\n <div className=\"flex pl-[4ch]\" aria-hidden=\"true\">{weeks.map((week, i) => { const firstOfMonth = week.find((cell) => cell.inRange && cell.date.slice(-2) === '01'); return <span className=\"w-[2ch] shrink-0 text-content-muted\" key={i}>{firstOfMonth ? MONTHS[Number(firstOfMonth.date.slice(5, 7)) - 1] : ''}</span>; })}</div>\n <div className=\"flex gap-1\"><div className=\"flex w-[3ch] shrink-0 flex-col\" aria-hidden=\"true\">{weekdayLabels.map((label, i) => <span className=\"h-[1.2em] text-[0.7em] text-content-muted\" key={i}>{label}</span>)}</div><div className=\"flex gap-1\">{weeks.map((week) => <div className=\"flex flex-col\" key={week[0].date}>{week.map((cell) => { const level = cell.inRange ? intensity(cell.count, peak) : 0; return <span aria-hidden=\"true\" title={cell.inRange ? `${cell.date}: ${cell.count} contributions` : undefined} className={cn('flex h-[1.2em] w-[2ch] items-center justify-center leading-none', cell.inRange ? colorClass(level, palette) : 'text-transparent')} key={cell.date}>{cell.inRange ? renderGlyph(level, glyphSet) : (glyphSet[0] ?? '·')}</span>; })}</div>)}</div></div>\n </div>\n </div>\n {legend ? <div className=\"flex justify-end\"><Legend glyphs={glyphSet} palette={palette} /></div> : null}\n </section>;\n});\n"],"mappings":";AAOA,YAAY,WAAW;AACvB,SAAS,UAAU;AA8FV,SAA0D,KAA1D;AA3FT,IAAM,SAAS;AACf,IAAM,WAAW;AACjB,IAAM,SAAS,CAAC,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,OAAO,KAAK;AAClG,IAAM,iBAAiB,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAE/C,SAAS,SAAS,QAAoC;AACpD,MAAI,MAAM,QAAQ,MAA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uCAA+C,yBAAe,OAAO,OAAO,aAAa,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,MAAvE,CAA0E;AAAA,MAAS,CAAC,GAAE;AAAA,MAC5T,qBAAC,SAAI,WAAU,cAAa;AAAA,4BAAC,SAAI,WAAU,kCAAiC,eAAY,QAAQ,wBAAc,IAAI,CAAC,OAAO,MAAM,oBAAC,UAAK,WAAU,6CAAqD,mBAAJ,CAAU,CAAO,GAAE;AAAA,QAAM,oBAAC,SAAI,WAAU,cAAc,gBAAM,IAAI,CAAC,SAAS,oBAAC,SAAI,WAAU,iBAAoC,eAAK,IAAI,CAAC,SAAS;AAAE,gBAAM,QAAQ,KAAK,UAAU,UAAU,KAAK,OAAO,IAAI,IAAI;AAAG,iBAAO,oBAAC,UAAK,eAAY,QAAO,OAAO,KAAK,UAAU,GAAG,KAAK,IAAI,KAAK,KAAK,KAAK,mBAAmB,QAAW,WAAW,GAAG,mEAAmE,KAAK,UAAU,WAAW,OAAO,OAAO,IAAI,kBAAkB,GAAoB,eAAK,UAAU,YAAY,OAAO,QAAQ,IAAK,SAAS,CAAC,KAAK,UAA1E,KAAK,IAA0E;AAAA,QAAS,CAAC,KAAjc,KAAK,CAAC,EAAE,IAA2b,CAAM,GAAE;AAAA,SAAM;AAAA,OAClwB,GACF;AAAA,IACC,SAAS,oBAAC,SAAI,WAAU,oBAAmB,8BAAC,UAAO,QAAQ,UAAU,SAAkB,GAAE,IAAS;AAAA,KACrG;AACF,CAAC;","names":["ActivityGrid"]}
@@ -12,6 +12,7 @@ import {
12
12
  textOf
13
13
  } from "./FigureFrame.js";
14
14
  import { cn } from "../../../lib/recipe.js";
15
+ import { deltaSignificance, deltaTrend, trendTone } from "../../review/DeltaValue.js";
15
16
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
17
  var Line = defineAsciiItem("Line");
17
18
  function signOf(value) {
@@ -19,52 +20,94 @@ function signOf(value) {
19
20
  if (/^[−-]/.test(value.trim())) return "remove";
20
21
  return void 0;
21
22
  }
23
+ function relativeOf(text) {
24
+ const match = /\s*\(([+−-]?\d+(?:\.\d+)?)\s*%\)\s*$/.exec(text);
25
+ if (!match) return { text };
26
+ return { text: text.slice(0, match.index), relative: Number(match[1].replace("\u2212", "-")) / 100 };
27
+ }
22
28
  function diffFromList(children) {
23
29
  return listItems(children).map((item) => {
24
- const { label, rest } = splitLabel(itemText(item));
30
+ const { label, rest: raw } = splitLabel(itemText(item));
31
+ const { text: rest, relative } = relativeOf(raw);
25
32
  const content = item.props.children;
26
33
  return {
27
34
  label,
28
35
  value: rest.replace(/^[+−-]\s*/, "") || rest,
29
- sign: signOf(rest),
36
+ sign: signOf(rest) ?? (relative ? relative > 0 ? "add" : "remove" : void 0),
37
+ relative,
30
38
  total: hasHost(content, ["strong", "b"])
31
39
  };
32
40
  });
33
41
  }
34
- function signClass(sign) {
35
- if (sign === "add") return "text-delta-added";
36
- if (sign === "remove") return "text-delta-removed";
37
- return "text-content-primary";
38
- }
39
42
  function lineText(row) {
40
43
  return `${row.label ?? ""} ${row.value}`.trim();
41
44
  }
42
- var ChangeSummary = React.forwardRef(function ChangeSummary2({ label = "Change summary", rows: rowsProp, footer: footerProp, children, palette: _palette, className, ...rest }, ref) {
45
+ function percent(relative) {
46
+ const value = Math.abs(relative * 100);
47
+ return `${relative > 0 ? "+" : relative < 0 ? "\u2212" : ""}${value < 10 ? Number(value.toFixed(1)) : Math.round(value)}%`;
48
+ }
49
+ var GRID = "grid grid-cols-[1.25rem_minmax(0,1fr)_auto] items-baseline gap-x-3";
50
+ function judge(row, direction, bands) {
51
+ const sign = row.sign ?? (row.relative ? row.relative > 0 ? "add" : "remove" : "keep");
52
+ const change = sign === "add" ? 1 : sign === "remove" ? -1 : 0;
53
+ return { row, sign, trend: deltaTrend(change, row.direction ?? direction), size: change === 0 ? "noise" : deltaSignificance(row.relative, bands) };
54
+ }
55
+ function Row({ judged, scale, total = false }) {
56
+ const { row, sign, trend, size } = judged;
57
+ const directed = trend != null;
58
+ const tone = directed ? trendTone(trend, size) : sign === "add" ? "text-delta-added" : sign === "remove" ? "text-delta-removed" : "text-content-primary";
59
+ const mark = sign === "keep" ? " " : directed ? sign === "add" ? "\u25B2" : "\u25BC" : sign === "add" ? "+" : "-";
60
+ const heavy = directed && size === "major";
61
+ const bar = !total && row.relative != null && sign !== "keep" ? Math.max(0.04, Math.min(1, Math.abs(row.relative) / scale)) : 0;
62
+ const verdict = directed ? size === "noise" ? "within noise" : trend === "against" ? "worse" : "better" : sign;
63
+ return /* @__PURE__ */ jsxs(
64
+ "li",
65
+ {
66
+ className: cn(GRID, "gap-y-1", heavy && "-ml-2 border-l-4 pl-1", heavy && (trend === "against" ? "border-intent-danger" : "border-intent-success")),
67
+ "data-trend": trend,
68
+ "data-significance": directed ? size : void 0,
69
+ "aria-label": `${total ? "total" : verdict}: ${lineText(row)}${row.relative != null ? ` (${percent(row.relative)})` : ""}`,
70
+ children: [
71
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("select-none text-center text-xs", sign === "keep" ? "text-content-muted" : tone), children: mark }),
72
+ /* @__PURE__ */ jsx("span", { className: cn(directed ? "text-content-primary" : tone, heavy && "font-bold", directed && size === "noise" && "text-content-secondary"), children: row.label }),
73
+ /* @__PURE__ */ jsxs("span", { className: "flex items-baseline justify-end gap-2 whitespace-nowrap tabular-nums", children: [
74
+ /* @__PURE__ */ jsx("span", { className: cn(tone, heavy && "text-lg font-bold"), children: row.value }),
75
+ row.relative != null ? /* @__PURE__ */ jsx("span", { className: cn("text-xs", directed && size !== "noise" ? tone : "text-content-muted"), children: percent(row.relative) }) : null
76
+ ] }),
77
+ bar > 0 ? /* @__PURE__ */ jsxs("svg", { "aria-hidden": "true", viewBox: "0 0 100 1", preserveAspectRatio: "none", className: "col-start-2 col-end-4 block h-1.5 w-full fill-surface-sunken", children: [
78
+ /* @__PURE__ */ jsx("rect", { width: "100", height: "1" }),
79
+ /* @__PURE__ */ jsx("rect", { width: bar * 100, height: "1", className: directed ? size === "noise" ? "fill-content-muted" : trend === "against" ? "fill-intent-danger" : "fill-intent-success" : sign === "add" ? "fill-delta-added" : "fill-delta-removed" })
80
+ ] }) : null
81
+ ]
82
+ }
83
+ );
84
+ }
85
+ var ChangeSummary = React.forwardRef(function ChangeSummary2({ label = "Change summary", rows: rowsProp, footer: footerProp, direction, significance, children, palette: _palette, className, ...rest }, ref) {
43
86
  const listed = diffFromList(children);
44
87
  const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));
45
88
  const lines = listed.length > 0 ? listed : tagged;
46
- const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => ({ ...entry, label: entry.label ?? "" }));
89
+ const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => judge({ ...entry, label: entry.label ?? "" }, direction, significance));
47
90
  const footerLine = footerProp ?? lines.find((entry) => entry.total);
48
- const footer = footerLine ? { ...footerLine, label: footerLine.label ?? "" } : void 0;
91
+ const footer = footerLine ? judge({ ...footerLine, label: footerLine.label ?? "" }, direction, significance) : void 0;
92
+ const scale = Math.max(1e-9, ...rows.map((r) => Math.abs(r.row.relative ?? 0)));
93
+ const directed = rows.filter((r) => r.trend != null);
94
+ const tally = [
95
+ { word: "worse", count: directed.filter((r) => r.size !== "noise" && r.trend === "against").length, tone: "text-intent-danger" },
96
+ { word: "better", count: directed.filter((r) => r.size !== "noise" && r.trend === "with").length, tone: "text-intent-success" },
97
+ { word: "within noise", count: directed.filter((r) => r.size === "noise").length, tone: "text-content-secondary" }
98
+ ].filter((t) => t.count > 0);
49
99
  return /* @__PURE__ */ jsxs(AsciiFrameBody, { "data-slot": "change-summary", ref, ...rest, className: cn("flex flex-col gap-3", className), children: [
50
- /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", "aria-label": label, children: rows.map((row, index) => {
51
- const sign = row.sign ?? "keep";
52
- const tone = signClass(sign);
53
- return /* @__PURE__ */ jsxs("li", { className: "grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3", "aria-label": `${sign}: ${lineText(row)}`, children: [
54
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("select-none text-center", sign === "keep" ? "text-content-muted" : tone), children: sign === "keep" ? " " : sign === "add" ? "+" : "-" }),
55
- /* @__PURE__ */ jsx("span", { className: tone, children: row.label }),
56
- /* @__PURE__ */ jsx("span", { className: cn("text-right tabular-nums", tone), children: row.value })
57
- ] }, `${lineText(row)}-${index}`);
58
- }) }),
100
+ tally.length > 0 ? /* @__PURE__ */ jsx("p", { "data-slot": "change-summary-tally", className: "m-0 flex flex-wrap gap-x-4 gap-y-1 text-xs font-bold uppercase tracking-wider", children: tally.map((t) => /* @__PURE__ */ jsxs("span", { className: t.tone, children: [
101
+ /* @__PURE__ */ jsx("span", { className: "text-base tabular-nums", children: t.count }),
102
+ " ",
103
+ t.word
104
+ ] }, t.word)) }) : null,
105
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2.5", "aria-label": label, children: rows.map((judged, index) => /* @__PURE__ */ jsx(Row, { judged, scale }, `${lineText(judged.row)}-${index}`)) }),
59
106
  footer ? /* @__PURE__ */ jsxs(Fragment, { children: [
60
107
  /* @__PURE__ */ jsx(AsciiFrameRule, {}),
61
- /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3", "aria-label": `total: ${lineText(footer)}`, children: [
62
- /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-content-muted", children: " " }),
63
- /* @__PURE__ */ jsx("span", { className: "text-content-primary", children: footer.label }),
64
- /* @__PURE__ */ jsx("span", { className: "text-right tabular-nums text-content-primary", children: footer.value })
65
- ] })
108
+ /* @__PURE__ */ jsx("ul", { className: "flex flex-col", children: /* @__PURE__ */ jsx(Row, { judged: footer, scale, total: true }) })
66
109
  ] }) : null,
67
- /* @__PURE__ */ jsx("span", { className: "sr-only", children: rows.length === 0 && !footer ? "Empty diff." : `${rows.length} changed row${rows.length === 1 ? "" : "s"}${footer ? `, total ${lineText(footer)}` : ""}.` })
110
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: rows.length === 0 && !footer ? "Empty diff." : `${rows.length} changed row${rows.length === 1 ? "" : "s"}${footer ? `, total ${lineText(footer.row)}` : ""}.` })
68
111
  ] });
69
112
  });
70
113
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/ChangeSummary.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-diff/graph-diff.tsx\n * The local port removes motion and graph variables while retaining the\n * source component's Markdown and `<Line>` data forms.\n */\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport {\n childItems,\n defineAsciiItem,\n AsciiFrameBody,\n AsciiFrameRule,\n hasHost,\n itemText,\n listItems,\n splitLabel,\n textOf,\n type FigurePalette,\n} from './FigureFrame';\nimport { cn } from '../../../lib/recipe';\n\nexport type DiffSign = 'add' | 'remove' | 'keep';\n\nexport interface DiffRow {\n /** Falls back to the child text for `<Line value=\"31 kb\">app</Line>`. */\n label?: string;\n value: string;\n sign?: DiffSign;\n}\n\nexport interface DiffLineProps extends DiffRow {\n /** Draw the row under a rule as the total. */\n total?: boolean;\n}\n\nexport interface ChangeSummaryProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Accessible name; the enclosing FigureFrame owns the caption. */\n label?: string;\n /** Data form. If omitted, the component reads Markdown or `<Line>` children. */\n rows?: DiffRow[];\n /** Optional typed total shown below the row rule. */\n footer?: DiffRow;\n /** Markdown list or `<Line>` content used to derive rows. */\n children?: ReactNode;\n /**\n * Accepted for symmetry with the other figures and ignored: additions and removals take the\n * `delta` roles, so a summary reads the same in a `multi` figure as in a `mono` one.\n */\n palette?: FigurePalette;\n /** Additional classes for this summary. */\n className?: string;\n}\n\n/** MDX-only diff item, for example `<Line sign=\"add\" value=\"31 kb\">app</Line>`. */\nexport const Line = defineAsciiItem<DiffLineProps>('Line');\n\nfunction signOf(value: string): DiffSign | undefined {\n if (/^\\+/.test(value.trim())) return 'add';\n if (/^[−-]/.test(value.trim())) return 'remove';\n return undefined;\n}\n\nfunction diffFromList(children: ReactNode): DiffLineProps[] {\n return listItems(children).map((item) => {\n const { label, rest } = splitLabel(itemText(item));\n const content = (item.props as { children?: ReactNode }).children;\n return {\n label,\n value: rest.replace(/^[+−-]\\s*/, '') || rest,\n sign: signOf(rest),\n total: hasHost(content, ['strong', 'b']),\n };\n });\n}\n\n/** Signs are change, so they take the `delta` roles whatever palette the surrounding figures use. */\nfunction signClass(sign: DiffSign): string {\n if (sign === 'add') return 'text-delta-added';\n if (sign === 'remove') return 'text-delta-removed';\n return 'text-content-primary';\n}\n\nfunction lineText(row: DiffRow): string {\n return `${row.label ?? ''} ${row.value}`.trim();\n}\n\n/** Renders additions, removals, and unchanged rows with a readable text summary. */\nexport const ChangeSummary = React.forwardRef<HTMLDivElement, ChangeSummaryProps>(function ChangeSummary({ label = 'Change summary', rows: rowsProp, footer: footerProp, children, palette: _palette, className, ...rest }, ref) {\n const listed = diffFromList(children);\n const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));\n const lines = listed.length > 0 ? listed : tagged;\n const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => ({ ...entry, label: entry.label ?? '' }));\n const footerLine = footerProp ?? lines.find((entry) => entry.total);\n const footer = footerLine ? { ...footerLine, label: footerLine.label ?? '' } : undefined;\n\n return (\n <AsciiFrameBody data-slot=\"change-summary\" ref={ref} {...rest} className={cn('flex flex-col gap-3', className)}>\n <ul className=\"flex flex-col gap-2\" aria-label={label}>\n {rows.map((row, index) => {\n const sign = row.sign ?? 'keep';\n const tone = signClass(sign);\n return (\n <li className=\"grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3\" key={`${lineText(row)}-${index}`} aria-label={`${sign}: ${lineText(row)}`}>\n <span aria-hidden=\"true\" className={cn('select-none text-center', sign === 'keep' ? 'text-content-muted' : tone)}>{sign === 'keep' ? ' ' : sign === 'add' ? '+' : '-'}</span>\n <span className={tone}>{row.label}</span>\n <span className={cn('text-right tabular-nums', tone)}>{row.value}</span>\n </li>\n );\n })}\n </ul>\n {footer ? <><AsciiFrameRule /><div className=\"grid grid-cols-[1.25rem_minmax(0,1fr)_8ch] items-baseline gap-x-3\" aria-label={`total: ${lineText(footer)}`}><span aria-hidden=\"true\" className=\"text-content-muted\"> </span><span className=\"text-content-primary\">{footer.label}</span><span className=\"text-right tabular-nums text-content-primary\">{footer.value}</span></div></> : null}\n <span className=\"sr-only\">{rows.length === 0 && !footer ? 'Empty diff.' : `${rows.length} changed row${rows.length === 1 ? '' : 's'}${footer ? `, total ${lineText(footer)}` : ''}.`}</span>\n </AsciiFrameBody>\n );\n});\n"],"mappings":";AAQA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU;AAmFL,SAQI,UAPF,KADF;AAhDP,IAAM,OAAO,gBAA+B,MAAM;AAEzD,SAAS,OAAO,OAAqC;AACnD,MAAI,MAAM,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACrC,MAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACvC,SAAO;AACT;AAEA,SAAS,aAAa,UAAsC;AAC1D,SAAO,UAAU,QAAQ,EAAE,IAAI,CAAC,SAAS;AACvC,UAAM,EAAE,OAAO,KAAK,IAAI,WAAW,SAAS,IAAI,CAAC;AACjD,UAAM,UAAW,KAAK,MAAmC;AACzD,WAAO;AAAA,MACL;AAAA,MACA,OAAO,KAAK,QAAQ,aAAa,EAAE,KAAK;AAAA,MACxC,MAAM,OAAO,IAAI;A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AC,UAAK,eAAY,QAAO,WAAW,GAAG,2BAA2B,SAAS,SAAS,uBAAuB,IAAI,GAAI,mBAAS,SAAS,MAAM,SAAS,QAAQ,MAAM,KAAI;AAAA,QACtK,oBAAC,UAAK,WAAW,MAAO,cAAI,OAAM;AAAA,QAClC,oBAAC,UAAK,WAAW,GAAG,2BAA2B,IAAI,GAAI,cAAI,OAAM;AAAA,WAHoB,GAAG,SAAS,GAAG,CAAC,IAAI,KAAK,EAIhH;AAAA,IAEJ,CAAC,GACH;AAAA,IACC,SAAS,iCAAE;AAAA,0BAAC,kBAAe;AAAA,MAAE,qBAAC,SAAI,WAAU,qEAAoE,cAAY,UAAU,SAAS,MAAM,CAAC,IAAI;AAAA,4BAAC,UAAK,eAAY,QAAO,WAAU,sBAAqB,eAAC;AAAA,QAAO,oBAAC,UAAK,WAAU,wBAAwB,iBAAO,OAAM;AAAA,QAAO,oBAAC,UAAK,WAAU,gDAAgD,iBAAO,OAAM;AAAA,SAAO;AAAA,OAAM,IAAM;AAAA,IACvX,oBAAC,UAAK,WAAU,WAAW,eAAK,WAAW,KAAK,CAAC,SAAS,gBAAgB,GAAG,KAAK,MAAM,eAAe,KAAK,WAAW,IAAI,KAAK,GAAG,GAAG,SAAS,WAAW,SAAS,MAAM,CAAC,KAAK,EAAE,KAAI;AAAA,KACvL;AAEN,CAAC;","names":["ChangeSummary"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/ChangeSummary.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-diff/graph-diff.tsx\n * The local port removes motion and graph variables while retaining the\n * source component's Markdown and `<Line>` data forms.\n */\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport {\n childItems,\n defineAsciiItem,\n AsciiFrameBody,\n AsciiFrameRule,\n hasHost,\n itemText,\n listItems,\n splitLabel,\n textOf,\n type FigurePalette,\n} from './FigureFrame';\nimport { cn } from '../../../lib/recipe';\nimport { deltaSignificance, deltaTrend, trendTone, type DeltaSignificance, type MetricDirection } from '../../review/DeltaValue';\n\nexport type DiffSign = 'add' | 'remove' | 'keep';\n\nexport interface DiffRow {\n /** Falls back to the child text for `<Line value=\"31 kb\">app</Line>`. */\n label?: string;\n value: string;\n sign?: DiffSign;\n /** The change relative to its baseline, as a signed fraction: `0.18` for +18%. Sizes the row's bar and decides whether it is noise. */\n relative?: number;\n /** Which way this row is preferred to move, overriding the summary's `direction`. */\n direction?: MetricDirection;\n}\n\nexport interface DiffLineProps extends DiffRow {\n /** Draw the row under a rule as the total. */\n total?: boolean;\n}\n\nexport interface ChangeSummaryProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Accessible name; the enclosing FigureFrame owns the caption. */\n label?: string;\n /** Data form. If omitted, the component reads Markdown or `<Line>` children. */\n rows?: DiffRow[];\n /** Optional typed total shown below the row rule. */\n footer?: DiffRow;\n /**\n * Which way the rows are preferred to move. Given one, a row reads as better (success) or worse\n * (danger) instead of as an addition or removal, and a tally of each leads the summary.\n */\n direction?: MetricDirection;\n /** Relative-change bands. Rows under `noise` are drawn quiet; rows at or over `major` heavy. */\n significance?: DeltaSignificance;\n /** Markdown list or `<Line>` content used to derive rows. */\n children?: ReactNode;\n /**\n * Accepted for symmetry with the other figures and ignored: additions and removals take the\n * `delta` roles, so a summary reads the same in a `multi` figure as in a `mono` one.\n */\n palette?: FigurePalette;\n /** Additional classes for this summary. */\n className?: string;\n}\n\n/** MDX-only diff item, for example `<Line sign=\"add\" value=\"31 kb\">app</Line>`. */\nexport const Line = defineAsciiItem<DiffLineProps>('Line');\n\nfunction signOf(value: string): DiffSign | undefined {\n if (/^\\+/.test(value.trim())) return 'add';\n if (/^[−-]/.test(value.trim())) return 'remove';\n return undefined;\n}\n\n/** A trailing `(+18%)` on a Markdown row is its relative change. */\nfunction relativeOf(text: string): { text: string; relative?: number } {\n const match = /\\s*\\(([+−-]?\\d+(?:\\.\\d+)?)\\s*%\\)\\s*$/.exec(text);\n if (!match) return { text };\n return { text: text.slice(0, match.index), relative: Number(match[1]!.replace('−', '-')) / 100 };\n}\n\nfunction diffFromList(children: ReactNode): DiffLineProps[] {\n return listItems(children).map((item) => {\n const { label, rest: raw } = splitLabel(itemText(item));\n const { text: rest, relative } = relativeOf(raw);\n const content = (item.props as { children?: ReactNode }).children;\n return {\n label,\n value: rest.replace(/^[+−-]\\s*/, '') || rest,\n sign: signOf(rest) ?? (relative ? (relative > 0 ? 'add' : 'remove') : undefined),\n relative,\n total: hasHost(content, ['strong', 'b']),\n };\n });\n}\n\nfunction lineText(row: DiffRow): string {\n return `${row.label ?? ''} ${row.value}`.trim();\n}\n\nfunction percent(relative: number): string {\n const value = Math.abs(relative * 100);\n return `${relative > 0 ? '+' : relative < 0 ? '−' : ''}${value < 10 ? Number(value.toFixed(1)) : Math.round(value)}%`;\n}\n\nconst GRID = 'grid grid-cols-[1.25rem_minmax(0,1fr)_auto] items-baseline gap-x-3';\n\ninterface Judged {\n row: DiffRow & { label: string };\n sign: DiffSign;\n trend: 'against' | 'with' | undefined;\n size: 'noise' | 'notable' | 'major';\n}\n\nfunction judge(row: DiffRow & { label: string }, direction: MetricDirection | undefined, bands: DeltaSignificance | undefined): Judged {\n // A typed row with a relative move but no sign takes its sign from the move, as a Markdown row does.\n const sign = row.sign ?? (row.relative ? (row.relative > 0 ? 'add' : 'remove') : 'keep');\n const change = sign === 'add' ? 1 : sign === 'remove' ? -1 : 0;\n return { row, sign, trend: deltaTrend(change, row.direction ?? direction), size: change === 0 ? 'noise' : deltaSignificance(row.relative, bands) };\n}\n\nfunction Row({ judged, scale, total = false }: { judged: Judged; scale: number; total?: boolean }) {\n const { row, sign, trend, size } = judged;\n const directed = trend != null;\n // Undirected change keeps the `delta` roles: it is an addition or a removal, not better or worse.\n const tone = directed ? trendTone(trend, size) : sign === 'add' ? 'text-delta-added' : sign === 'remove' ? 'text-delta-removed' : 'text-content-primary';\n const mark = sign === 'keep' ? ' ' : directed ? (sign === 'add' ? '▲' : '▼') : sign === 'add' ? '+' : '-';\n const heavy = directed && size === 'major';\n const bar = !total && row.relative != null && sign !== 'keep' ? Math.max(0.04, Math.min(1, Math.abs(row.relative) / scale)) : 0;\n const verdict = directed ? (size === 'noise' ? 'within noise' : trend === 'against' ? 'worse' : 'better') : sign;\n return (\n <li\n className={cn(GRID, 'gap-y-1', heavy && '-ml-2 border-l-4 pl-1', heavy && (trend === 'against' ? 'border-intent-danger' : 'border-intent-success'))}\n data-trend={trend}\n data-significance={directed ? size : undefined}\n aria-label={`${total ? 'total' : verdict}: ${lineText(row)}${row.relative != null ? ` (${percent(row.relative)})` : ''}`}\n >\n <span aria-hidden=\"true\" className={cn('select-none text-center text-xs', sign === 'keep' ? 'text-content-muted' : tone)}>{mark}</span>\n <span className={cn(directed ? 'text-content-primary' : tone, heavy && 'font-bold', directed && size === 'noise' && 'text-content-secondary')}>{row.label}</span>\n <span className=\"flex items-baseline justify-end gap-2 whitespace-nowrap tabular-nums\">\n <span className={cn(tone, heavy && 'text-lg font-bold')}>{row.value}</span>\n {row.relative != null ? <span className={cn('text-xs', directed && size !== 'noise' ? tone : 'text-content-muted')}>{percent(row.relative)}</span> : null}\n </span>\n {bar > 0 ? (\n <svg aria-hidden=\"true\" viewBox=\"0 0 100 1\" preserveAspectRatio=\"none\" className=\"col-start-2 col-end-4 block h-1.5 w-full fill-surface-sunken\">\n <rect width=\"100\" height=\"1\" />\n <rect width={bar * 100} height=\"1\" className={directed ? (size === 'noise' ? 'fill-content-muted' : trend === 'against' ? 'fill-intent-danger' : 'fill-intent-success') : sign === 'add' ? 'fill-delta-added' : 'fill-delta-removed'} />\n </svg>\n ) : null}\n </li>\n );\n}\n\n/**\n * Renders additions, removals, and unchanged rows with a readable text summary.\n *\n * Given a `direction`, rows read as better or worse instead: colour says which way a row moved\n * against what is preferred, and its relative size says how loudly. A move under the noise band\n * stays quiet, a major one is bold with a rule beside it, and a bar under each row shows its\n * relative size against the largest move in the summary.\n */\nexport const ChangeSummary = React.forwardRef<HTMLDivElement, ChangeSummaryProps>(function ChangeSummary({ label = 'Change summary', rows: rowsProp, footer: footerProp, direction, significance, children, palette: _palette, className, ...rest }, ref) {\n const listed = diffFromList(children);\n const tagged = childItems(children, Line).map((entry) => ({ ...entry, label: entry.label ?? textOf(entry.children) }));\n const lines = listed.length > 0 ? listed : tagged;\n const rows = (rowsProp ?? lines.filter((entry) => !entry.total)).map((entry) => judge({ ...entry, label: entry.label ?? '' }, direction, significance));\n const footerLine = footerProp ?? lines.find((entry) => entry.total);\n const footer = footerLine ? judge({ ...footerLine, label: footerLine.label ?? '' }, direction, significance) : undefined;\n const scale = Math.max(1e-9, ...rows.map((r) => Math.abs(r.row.relative ?? 0)));\n const directed = rows.filter((r) => r.trend != null);\n const tally = [\n { word: 'worse', count: directed.filter((r) => r.size !== 'noise' && r.trend === 'against').length, tone: 'text-intent-danger' },\n { word: 'better', count: directed.filter((r) => r.size !== 'noise' && r.trend === 'with').length, tone: 'text-intent-success' },\n { word: 'within noise', count: directed.filter((r) => r.size === 'noise').length, tone: 'text-content-secondary' },\n ].filter((t) => t.count > 0);\n\n return (\n <AsciiFrameBody data-slot=\"change-summary\" ref={ref} {...rest} className={cn('flex flex-col gap-3', className)}>\n {tally.length > 0 ? (\n <p data-slot=\"change-summary-tally\" className=\"m-0 flex flex-wrap gap-x-4 gap-y-1 text-xs font-bold uppercase tracking-wider\">\n {tally.map((t) => (\n <span key={t.word} className={t.tone}>\n <span className=\"text-base tabular-nums\">{t.count}</span> {t.word}\n </span>\n ))}\n </p>\n ) : null}\n <ul className=\"flex flex-col gap-2.5\" aria-label={label}>\n {rows.map((judged, index) => (\n <Row key={`${lineText(judged.row)}-${index}`} judged={judged} scale={scale} />\n ))}\n </ul>\n {footer ? <><AsciiFrameRule /><ul className=\"flex flex-col\"><Row judged={footer} scale={scale} total /></ul></> : null}\n <span className=\"sr-only\">{rows.length === 0 && !footer ? 'Empty diff.' : `${rows.length} changed row${rows.length === 1 ? '' : 's'}${footer ? `, total ${lineText(footer.row)}` : ''}.`}</span>\n </AsciiFrameBody>\n );\n});\n"],"mappings":";AAQA,YAAY,WAAW;AACvB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,UAAU;AACnB,SAAS,mBAAmB,YAAY,iBAA+D;AAqHjG,SAuDY,UAvDZ,KAEA,YAFA;AAvEC,IAAM,OAAO,gBAA+B,MAAM;AAEzD,SAAS,OAAO,OAAqC;AACnD,MAAI,MAAM,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACrC,MAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,EAAG,QAAO;AACvC,SAAO;AACT;AAGA,SAAS,WAAW,MAAmD;AACrE,QAAM,QAAQ,uCAAuC,KAAK,IAAI;AAC9D,MAAI,CAAC,MAAO,QAAO,EAAE,KAAK;AAC1B,SAAO,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,GAAG,UAAU,OAAO,MAAM,CAAC,EAAG,QAAQ,UAAK,GAAG,CAAC,IAAI,IAAI;AACjG;AAEA,SAAS,aAAa,UAAsC;AAC1D,SAAO,UAAU,QAAQ,EAAE,IAAI,CAAC,SAAS;AACvC,UAAM,EAAE,OAAO,MAAM,IAAI,IAAI,WAAW,SAAS,IAAI,CAAC;AACtD,UAAM,EAAE,MAAM,MAAM,SAAS,IAAI,WAAW,GAAG;AAC/C,UAAM,UAAW,KAAK,MAAmC;AACzD,WAAO;AAAA,MACL;AAAA,MACA,OAAO,KAAK,QAAQ,aAAa,EAAE,KAAK;AAAA,MACxC,MAAM,OAAO,IAAI,MAAM,WAAY,WAAW,IAAI,QAAQ,WAAY;AAAA,MACtE;AAAA,MACA,OAAO,QAAQ,SAAS,CAAC,UAAU,GAAG,CAAC;AAAA,IACzC;AAAA,EACF,C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AAS,IACd,oBAAC,OAAE,aAAU,wBAAuB,WAAU,iFAC3C,gBAAM,IAAI,CAAC,MACV,qBAAC,UAAkB,WAAW,EAAE,MAC9B;AAAA,0BAAC,UAAK,WAAU,0BAA0B,YAAE,OAAM;AAAA,MAAO;AAAA,MAAE,EAAE;AAAA,SADpD,EAAE,IAEb,CACD,GACH,IACE;AAAA,IACJ,oBAAC,QAAG,WAAU,yBAAwB,cAAY,OAC/C,eAAK,IAAI,CAAC,QAAQ,UACjB,oBAAC,OAA6C,QAAgB,SAApD,GAAG,SAAS,OAAO,GAAG,CAAC,IAAI,KAAK,EAAkC,CAC7E,GACH;AAAA,IACC,SAAS,iCAAE;AAAA,0BAAC,kBAAe;AAAA,MAAE,oBAAC,QAAG,WAAU,iBAAgB,8BAAC,OAAI,QAAQ,QAAQ,OAAc,OAAK,MAAC,GAAE;AAAA,OAAK,IAAM;AAAA,IAClH,oBAAC,UAAK,WAAU,WAAW,eAAK,WAAW,KAAK,CAAC,SAAS,gBAAgB,GAAG,KAAK,MAAM,eAAe,KAAK,WAAW,IAAI,KAAK,GAAG,GAAG,SAAS,WAAW,SAAS,OAAO,GAAG,CAAC,KAAK,EAAE,KAAI;AAAA,KAC3L;AAEN,CAAC;","names":["ChangeSummary"]}
@@ -1,6 +1,9 @@
1
+ "use client";
2
+
1
3
  // src/components/docs/figures/DrawingSheet.tsx
2
4
  import * as React from "react";
3
5
  import { cn } from "../../../lib/recipe.js";
6
+ import { FigureSurfaceContext } from "./FigureSurfaceContext.js";
4
7
  import { jsx, jsxs } from "react/jsx-runtime";
5
8
  var LETTERS = "ABCDEFGHJKLMNPQRSTUVWXYZ";
6
9
  function sheetRowLabel(index) {
@@ -26,7 +29,7 @@ var DrawingSheet = React.forwardRef(function DrawingSheet2({ columns = 4, rows =
26
29
  top > 0 && side > 0 ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "border-b-2 border-r-2 border-edge-strong" }) : null,
27
30
  top > 0 ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-slot": "drawing-sheet-columns", className: "flex select-none border-b-2 border-edge-strong font-mono text-xs text-content-muted", children: Array.from({ length: top }, (_, index) => /* @__PURE__ */ jsx("span", { className: cn("flex-1 py-1 text-center", index > 0 && "border-l border-edge-default"), children: index + 1 }, index)) }) : null,
28
31
  side > 0 ? /* @__PURE__ */ jsx("div", { "aria-hidden": "true", "data-slot": "drawing-sheet-rows", className: "flex select-none flex-col border-r-2 border-edge-strong font-mono text-xs text-content-muted", children: Array.from({ length: side }, (_, index) => /* @__PURE__ */ jsx("span", { className: cn("flex flex-1 items-center justify-center", index > 0 && "border-t border-edge-default"), children: sheetRowLabel(index) }, index)) }) : null,
29
- /* @__PURE__ */ jsx("div", { "data-slot": "drawing-sheet-body", className: "flex min-w-0 flex-col gap-6 p-3 sm:p-6", children })
32
+ /* @__PURE__ */ jsx("div", { "data-slot": "drawing-sheet-body", className: "flex min-w-0 flex-col gap-6 p-3 sm:p-6", children: /* @__PURE__ */ jsx(FigureSurfaceContext.Provider, { value: "sheet", children }) })
30
33
  ]
31
34
  }
32
35
  );
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/DrawingSheet.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\n\n\nconst LETTERS = 'ABCDEFGHJKLMNPQRSTUVWXYZ';\n\n/** Row reference for an index — drawing-sheet convention skips I and O, which read as 1 and 0. */\nfunction sheetRowLabel(index: number): string {\n const letter = LETTERS[index % LETTERS.length] ?? 'A';\n return index < LETTERS.length ? letter : `${letter}${Math.floor(index / LETTERS.length) + 1}`;\n}\n\nexport interface DrawingSheetProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Grid references across the top edge, numbered from 1. `0` hides the top ruler. */\n columns?: number;\n /** Grid references down the left edge, lettered from A. `0` hides the side ruler. */\n rows?: number;\n /** Sheet content, usually one or more `IndexedSection`s. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An engineering drawing sheet: a hard border with numbered columns along the top and lettered\n * rows down the side, so a review can point at \"B2\" rather than \"the second box on the left\".\n *\n * The references divide the sheet evenly and are decorative — they are hidden from assistive\n * technology, which navigates by the sections' headings instead.\n */\nexport const DrawingSheet = React.forwardRef<HTMLDivElement, DrawingSheetProps>(function DrawingSheet({ columns = 4, rows = 3, children, className, ...rest }, ref) {\n const top = Math.max(0, Math.floor(columns));\n const side = Math.max(0, Math.floor(rows));\n return (\n <div\n ref={ref}\n {...rest}\n data-slot=\"drawing-sheet\"\n className={cn(\n 'grid w-full border-2 border-edge-strong bg-surface-base text-content-primary',\n side > 0 ? 'grid-cols-[1.75rem_minmax(0,1fr)]' : 'grid-cols-[minmax(0,1fr)]',\n top > 0 ? 'grid-rows-[auto_1fr]' : 'grid-rows-[1fr]',\n className,\n )}\n >\n {top > 0 && side > 0 ? <span aria-hidden=\"true\" className=\"border-b-2 border-r-2 border-edge-strong\" /> : null}\n {top > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-columns\" className=\"flex select-none border-b-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: top }, (_, index) => (\n <span key={index} className={cn('flex-1 py-1 text-center', index > 0 && 'border-l border-edge-default')}>\n {index + 1}\n </span>\n ))}\n </div>\n ) : null}\n {side > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-rows\" className=\"flex select-none flex-col border-r-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: side }, (_, index) => (\n <span key={index} className={cn('flex flex-1 items-center justify-center', index > 0 && 'border-t border-edge-default')}>\n {sheetRowLabel(index)}\n </span>\n ))}\n </div>\n ) : null}\n <div data-slot=\"drawing-sheet-body\" className=\"flex min-w-0 flex-col gap-6 p-3 sm:p-6\">\n {children}\n </div>\n </div>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AAkCf,SAWyB,KAXzB;AA9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AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["DrawingSheet"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/DrawingSheet.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\n\n\nimport { FigureSurfaceContext } from './FigureSurfaceContext';\n\nconst LETTERS = 'ABCDEFGHJKLMNPQRSTUVWXYZ';\n\n/** Row reference for an index — drawing-sheet convention skips I and O, which read as 1 and 0. */\nfunction sheetRowLabel(index: number): string {\n const letter = LETTERS[index % LETTERS.length] ?? 'A';\n return index < LETTERS.length ? letter : `${letter}${Math.floor(index / LETTERS.length) + 1}`;\n}\n\nexport interface DrawingSheetProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Grid references across the top edge, numbered from 1. `0` hides the top ruler. */\n columns?: number;\n /** Grid references down the left edge, lettered from A. `0` hides the side ruler. */\n rows?: number;\n /** Sheet content, usually one or more `IndexedSection`s. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An engineering drawing sheet: a hard border with numbered columns along the top and lettered\n * rows down the side, so a review can point at \"B2\" rather than \"the second box on the left\".\n *\n * The references divide the sheet evenly and are decorative — they are hidden from assistive\n * technology, which navigates by the sections' headings instead.\n */\nexport const DrawingSheet = React.forwardRef<HTMLDivElement, DrawingSheetProps>(function DrawingSheet({ columns = 4, rows = 3, children, className, ...rest }, ref) {\n const top = Math.max(0, Math.floor(columns));\n const side = Math.max(0, Math.floor(rows));\n return (\n <div\n ref={ref}\n {...rest}\n data-slot=\"drawing-sheet\"\n className={cn(\n 'grid w-full border-2 border-edge-strong bg-surface-base text-content-primary',\n side > 0 ? 'grid-cols-[1.75rem_minmax(0,1fr)]' : 'grid-cols-[minmax(0,1fr)]',\n top > 0 ? 'grid-rows-[auto_1fr]' : 'grid-rows-[1fr]',\n className,\n )}\n >\n {top > 0 && side > 0 ? <span aria-hidden=\"true\" className=\"border-b-2 border-r-2 border-edge-strong\" /> : null}\n {top > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-columns\" className=\"flex select-none border-b-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: top }, (_, index) => (\n <span key={index} className={cn('flex-1 py-1 text-center', index > 0 && 'border-l border-edge-default')}>\n {index + 1}\n </span>\n ))}\n </div>\n ) : null}\n {side > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-rows\" className=\"flex select-none flex-col border-r-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: side }, (_, index) => (\n <span key={index} className={cn('flex flex-1 items-center justify-center', index > 0 && 'border-t border-edge-default')}>\n {sheetRowLabel(index)}\n </span>\n ))}\n </div>\n ) : null}\n <div data-slot=\"drawing-sheet-body\" className=\"flex min-w-0 flex-col gap-6 p-3 sm:p-6\">\n <FigureSurfaceContext.Provider value=\"sheet\">\n {children}\n </FigureSurfaceContext.Provider>\n </div>\n </div>\n );\n});\n"],"mappings":";;;AAGA,YAAY,WAAW;AACvB,SAAS,UAAU;AAInB,SAAS,4BAA4B;AAgCjC,SAWyB,KAXzB;AA9BJ,IAAM,UAAU;AAGhB,SAAS,cAAc,OAAuB;AAC5C,QAAM,SAAS,QAAQ,QAAQ,QAAQ,MAAM,KAAK;AAClD,SAAO,QAAQ,QAAQ,SAAS,SAAS,GAAG,MAAM,GAAG,KAAK,MAAM,QAAQ,QAAQ,MAAM,IAAI,CAAC;AAC7F;AAoBO,IAAM,eAAqB,iBAA8C,SAASA,cAAa,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,WAAW,GAAG,KAAK,GAAG,KAAK;AAClK,QAAM,MAAM,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,CAAC;AAC3C,QAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC;AACzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,OAAO,IAAI,sCAAsC;AAAA,QACjD,MAAM,IAAI,yBAAyB;AAAA,QACnC;AAAA,MACF;AAAA,MAEC;AAAA,cAAM,KAAK,OAAO,IAAI,oBAAC,UAAK,eAAY,QAAO,WAAU,4CAA2C,IAAK;AAAA,QACzG,MAAM,IACL,oBAAC,SAAI,eAAY,QAAO,aAAU,yBAAwB,WAAU,uFACjE,gBAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,UAC/B,oBAAC,UAAiB,WAAW,GAAG,2BAA2B,QAAQ,KAAK,8BAA8B,GACnG,kBAAQ,KADA,KAEX,CACD,GACH,IACE;AAAA,QACH,OAAO,IACN,oBAAC,SAAI,eAAY,QAAO,aAAU,sBAAqB,WAAU,gGAC9D,gBAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,UAChC,oBAAC,UAAiB,WAAW,GAAG,2CAA2C,QAAQ,KAAK,8BAA8B,GACnH,wBAAc,KAAK,KADX,KAEX,CACD,GACH,IACE;AAAA,QACJ,oBAAC,SAAI,aAAU,sBAAqB,WAAU,0CAC5C,8BAAC,qBAAqB,UAArB,EAA8B,OAAM,SAClC,UACH,GACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["DrawingSheet"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/FigureFrame.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-frame/graph-frame.tsx\n * The port replaces mdxcn's motion runtime and graph variables with this\n * package's deterministic rendering and semantic token contracts.\n */\n\nimport * as React from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../../lib/recipe';\n\nexport type FigurePalette = 'mono' | 'duo' | 'multi';\nexport type FigureTone = 'primary' | 'secondary' | 'tertiary' | 'idle' | 'empty';\n\nexport const DIM_OPACITY = 0.4;\n\nexport const GLYPH_SETS = {\n shade: ['·', '░', '▒', '▓', '█'],\n ascii: ['.', '-', '=', '#', '@'],\n hash: ['.', ':', '+', '#', '█'],\n bar: ['▁', '▂', '▃', '▅', '█'],\n} as const;\n\nexport type GlyphSetName = keyof typeof GLYPH_SETS;\nexport type Glyphs = GlyphSetName | readonly string[];\n\nexport function resolveGlyphs(glyphs?: Glyphs): readonly string[] {\n if (glyphs == null) return GLYPH_SETS.shade;\n if (typeof glyphs === 'string') return GLYPH_SETS[glyphs] ?? GLYPH_SETS.shade;\n return glyphs.length > 0 ? glyphs : GLYPH_SETS.shade;\n}\n\nexport function toneClass(palette: FigurePalette | undefined, tone: FigureTone): string {\n if (tone === 'empty') return 'text-content-muted';\n if (tone === 'idle') return 'text-content-secondary';\n if (tone === 'primary') return 'text-accent-primary';\n if (tone === 'secondary') {\n return palette === 'mono' || palette == null ? 'text-content-secondary' : 'text-accent-secondary';\n }\n return palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-secondary';\n}\n\nexport function intensityClass(level: number, palette: FigurePalette = 'mono'): string {\n const value = Math.min(4, Math.max(0, Math.round(level)));\n if (value === 0) return toneClass(palette, 'empty');\n if (palette === 'mono') return value <= 2 ? toneClass(palette, 'idle') : 'text-content-primary';\n return value === 1 ? toneClass(palette, 'secondary') : value === 2 ? toneClass(palette, 'tertiary') : toneClass(palette, 'primary');\n}\n\nexport function intensityLevel(value: number, max: number): number {\n if (value <= 0 || max <= 0) return 0;\n return Math.max(1, Math.round(Math.min(1, value / max) * 4));\n}\n\nexport function intensityGlyph(level: number, glyphs: readonly string[] = GLYPH_SETS.shade): string {\n if (glyphs.length === 0) return '·';\n const clamped = Math.min(4, Math.max(0, Math.round(level)));\n return glyphs[Math.round((clamped / 4) * (glyphs.length - 1))] ?? glyphs[0] ?? '·';\n}\n\nexport function words<T extends string>(value: T[] | string): T[] {\n return Array.isArray(value) ? value : value.split(/[\\s,]+/).filter(Boolean) as T[];\n}\n\nexport interface FigureFrameProps extends Omit<React.ComponentProps<'figure'>, 'title'> {\n /** Short uppercase caption drawn across the top edge. */\n title?: string;\n /** Character used at each frame corner. */\n corner?: string;\n}\n\n/**\n * Shared border and caption for one or more documentation renderers.\n * Renderers own their data and can also appear without a frame.\n */\nexport const FigureFrame = React.forwardRef<HTMLElement, FigureFrameProps>(function FigureFrame({ title, corner = '+', className, children, ...rest }, ref) {\n return (\n <figure data-slot=\"figure-frame\"\n ref={ref}\n aria-label={title ?? 'Document figure'}\n className={cn(\n 'relative mx-auto my-8 w-full max-w-5xl border-2 border-dashed border-edge-strong bg-surface-base font-mono text-sm text-content-primary',\n className,\n )}\n {...rest}\n >\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute left-0 top-0 z-10 flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 top-0 z-10 flex size-4 translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 left-0 z-10 flex size-4 -translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 right-0 z-10 flex size-4 translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n {title ? <figcaption className=\"absolute left-1/2 top-0 z-10 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap bg-surface-base px-3 uppercase tracking-wide text-accent-primary\">[ {title} ]</figcaption> : null}\n <div className=\"flex min-w-0 flex-col gap-6 px-5 py-7 sm:px-8 sm:py-8\">{children}</div>\n </figure>\n );\n});\n\n/** Internal root for a renderer. The frame owns the inset. */\nexport const AsciiFrameBody = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(function AsciiFrameBody({ className, ...props }, ref) {\n return <div data-slot=\"ascii-frame-body\" ref={ref} className={cn('min-w-0', className)} {...props} />;\n});\n\n/** Markdown children inside a documentation visual. */\nexport function AsciiFrameProse({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div data-slot=\"ascii-frame-prose\"\n className={cn(\n 'flex min-w-0 flex-col gap-3 leading-relaxed',\n '[&_p]:m-0 [&_p]:text-pretty',\n '[&_ul]:m-0 [&_ul]:flex [&_ul]:list-none [&_ul]:flex-col [&_ul]:gap-1 [&_ul]:p-0',\n '[&_ol]:m-0 [&_ol]:flex [&_ol]:list-none [&_ol]:flex-col [&_ol]:gap-1 [&_ol]:p-0',\n '[&_li]:relative [&_li]:pl-4 [&_li]:before:absolute [&_li]:before:left-0 [&_li]:before:text-content-muted [&_li]:before:content-[\\'-\\']',\n '[&_a]:text-content-primary [&_a]:underline [&_a]:decoration-dashed [&_a]:underline-offset-[0.2em]',\n '[&_code]:font-semibold [&_code]:text-content-primary',\n '[&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre_code]:font-normal [&_pre_code]:text-inherit',\n '[&_strong]:font-semibold [&_strong]:text-content-primary',\n '[&_em]:text-content-secondary [&_em]:not-italic',\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A dashed horizontal rule inside a documentation visual. */\nexport function AsciiFrameRule({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule\" aria-hidden=\"true\" className={cn('my-1 h-px w-full border-t border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A dashed vertical rule inside a documentation visual. */\nexport function AsciiFrameRuleY({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule-y\" aria-hidden=\"true\" className={cn('w-px self-stretch border-l border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A full-width character track used by uptime and related figures. */\nexport function AsciiFrameTrack({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-track\" aria-hidden=\"true\" className={cn('flex w-full min-w-0 select-none', className)} {...props} />;\n}\n\n/** One flexible cell in a character track. */\nexport function AsciiFrameTick({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-tick\" className={cn('min-w-0 flex-1 overflow-hidden text-center', className)} {...props} />;\n}\n\n/** ASCII arrow used by flow diagrams. */\nexport function AsciiFrameArrow({ accent = false, stretch = false, className }: { accent?: boolean; stretch?: boolean; className?: string }) {\n return (\n <span data-slot=\"ascii-frame-arrow\" aria-hidden=\"true\" className={cn('flex min-w-6 items-center text-content-muted', stretch && 'flex-1', className)}>\n <span className={cn('w-full border-t border-dashed border-current', accent && 'text-accent-primary')} />\n <span className={cn('-ml-1', accent ? 'text-accent-primary' : 'text-content-muted')}>▶</span>\n </span>\n );\n}\n\ntype WithChildren<P> = P & { children?: ReactNode };\ntype AsciiItemComponent<P extends object> = ((props: WithChildren<P>) => null) & {\n graphItem: string;\n displayName?: string;\n};\n\n/** Defines an MDX-only data child that its parent renderer reads. */\nexport function defineAsciiItem<P extends object>(name: string): AsciiItemComponent<P> {\n const Item = (() => null) as unknown as AsciiItemComponent<P>;\n Item.displayName = name;\n Item.graphItem = name;\n return Item;\n}\n\nfunction typeName(type: unknown): string {\n if (typeof type === 'string') return type;\n if (typeof type === 'function') {\n const fn = type as { graphItem?: string; displayName?: string; name?: string };\n return fn.graphItem || fn.displayName || fn.name || '';\n }\n if (type && typeof type === 'object') {\n const value = type as { graphItem?: string; displayName?: string; name?: string; $$id?: string };\n if (value.graphItem) return value.graphItem;\n if (value.displayName) return value.displayName;\n if (typeof value.$$id === 'string') return value.$$id.split('#').pop()?.split('@')[0] ?? '';\n return value.name || '';\n }\n return '';\n}\n\nexport function isHost(element: ReactElement, tags: string | readonly string[]): boolean {\n const name = typeName(element.type).toLowerCase();\n const list = typeof tags === 'string' ? [tags] : tags;\n return list.some((tag) => tag.toLowerCase() === name);\n}\n\nexport function elementsOf(children: ReactNode): ReactElement[] {\n const result: ReactElement[] = [];\n for (const child of React.Children.toArray(children)) {\n if (!React.isValidElement(child)) continue;\n if (child.type === React.Fragment) {\n result.push(...elementsOf((child.props as { children?: ReactNode }).children));\n } else {\n result.push(child);\n }\n }\n return result;\n}\n\nexport function textOf(children: ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (React.isValidElement(child) ? textOf((child.props as { children?: ReactNode }).children) : String(child)))\n .join('');\n}\n\nexport function itemText(item: ReactElement): string {\n const children = (item.props as { children?: ReactNode }).children;\n return textOf(children).replace(/\\s+/g, ' ').trim();\n}\n\nexport function listItems(children: ReactNode): ReactElement[] {\n const elements = elementsOf(children);\n const lists = elements.filter((element) => isHost(element, ['ul', 'ol']));\n const items = lists.length > 0\n ? lists.flatMap((list) => elementsOf((list.props as { children?: ReactNode }).children))\n : elements;\n return items.filter((element) => isHost(element, 'li'));\n}\n\nexport function nestedList(item: ReactElement): ReactElement[] {\n return listItems((item.props as { children?: ReactNode }).children);\n}\n\nexport function paragraphsOf(children: ReactNode): ReactElement[] {\n return elementsOf(children).filter((element) => isHost(element, 'p'));\n}\n\nexport function hasHost(children: ReactNode, tags: string | readonly string[]): boolean {\n return React.Children.toArray(children).some((child) => {\n if (!React.isValidElement(child)) return false;\n return isHost(child, tags) || hasHost((child.props as { children?: ReactNode }).children, tags);\n });\n}\n\nexport function childItems<P extends object>(children: ReactNode, item: AsciiItemComponent<P>): (P & { children?: ReactNode })[] {\n return elementsOf(children)\n .filter((element) => typeName(element.type) === item.graphItem)\n .map((element) => element.props as P & { children?: ReactNode });\n}\n\nexport function splitLabel(value: string): { label: string; rest: string } {\n const match = value.match(/^([^:—–-]+?)\\s*:\\s*(.*)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function splitDash(value: string): { label: string; rest: string } {\n const match = value.match(/^(.+?)\\s+[-—–]\\s+(.+)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function numberOf(value: number | string): number {\n if (typeof value === 'number') return value;\n const parsed = Number(value.replace(/[^\\d.+-]/g, ''));\n return Number.isFinite(parsed) ? parsed : 0;\n}\n"],"mappings":";AAOA,YAAY,WAAW;AAEvB,SAAS,UAAU;AA6Eb,cAYS,YAZT;AAxEC,IAAM,cAAc;AAEpB,IAAM,aAAa;AAAA,EACxB,OAAO,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAAA,EAC/B,OAAO,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,EAC/B,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK,QAAG;AAAA,EAC9B,KAAK,CAAC,UAAK,UAAK,UAAK,UAAK,QAAG;AAC/B;AAKO,SAAS,cAAc,QAAoC;AAChE,MAAI,UAAU,KAAM,QAAO,WAAW;AACtC,MAAI,OAAO,WAAW,SAAU,QAAO,WAAW,MAAM,KAAK,WAAW;AACxE,SAAO,OAAO,SAAS,IAAI,SAAS,WAAW;AACjD;AAEO,SAAS,UAAU,SAAoC,MAA0B;AACtF,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,OAAQ,QAAO;AAC5B,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,SAAS,aAAa;AACxB,WAAO,YAAY,UAAU,WAAW,OAAO,2BAA2B;AAAA,EAC5E;AACA,SAAO,YAAY,UAAU,yBAAyB;AACxD;AAEO,SAAS,eAAe,OAAe,UAAyB,QAAgB;AACrF,QAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;AACxD,MAAI,UAAU,EAAG,QAAO,UAAU,SAAS,OAAO;AAClD,MAAI,YAAY,OAAQ,QAAO,SAAS,IAAI,UAAU,SAAS,MAAM,IAAI;AACzE,SAAO,UAAU,IAAI,UAAU,SAAS,WAAW,IAAI,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AW,OAAgD;AACzE,QAAM,QAAQ,MAAM,MAAM,0BAA0B;AACpD,MAAI,CAAC,MAAO,QAAO,EAAE,OAAO,MAAM,KAAK,GAAG,MAAM,GAAG;AACnD,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,UAAU,OAAgD;AACxE,QAAM,QAAQ,MAAM,MAAM,wBAAwB;AAClD,MAAI,CAAC,MAAO,QAAO,EAAE,OAAO,MAAM,KAAK,GAAG,MAAM,GAAG;AACnD,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,SAAS,OAAgC;AACvD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,SAAS,OAAO,MAAM,QAAQ,aAAa,EAAE,CAAC;AACpD,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;","names":["FigureFrame","AsciiFrameBody"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/FigureFrame.tsx"],"sourcesContent":["/**\n * Adapted from mdxcn by Keshav Bagaade, MIT licensed.\n * Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-frame/graph-frame.tsx\n * The port replaces mdxcn's motion runtime and graph variables with this\n * package's deterministic rendering and semantic token contracts.\n */\n\nimport * as React from 'react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { cn } from '../../../lib/recipe';\n\nexport type FigurePalette = 'mono' | 'duo' | 'multi';\nexport type FigureTone = 'primary' | 'secondary' | 'tertiary' | 'idle' | 'empty';\n\nexport const DIM_OPACITY = 0.4;\n\n/** A named glyph ramp, from empty to full. */\nexport type GlyphSetName = 'shade' | 'ascii' | 'hash' | 'bar';\n\n// Spelled out above and checked here, rather than `keyof typeof GLYPH_SETS`:\n// the public type then names no internal constant.\nexport const GLYPH_SETS = {\n shade: ['·', '░', '▒', '▓', '█'],\n ascii: ['.', '-', '=', '#', '@'],\n hash: ['.', ':', '+', '#', '█'],\n bar: ['▁', '▂', '▃', '▅', '█'],\n} as const satisfies Record<GlyphSetName, readonly string[]>;\n\nexport type Glyphs = GlyphSetName | readonly string[];\n\nexport function resolveGlyphs(glyphs?: Glyphs): readonly string[] {\n if (glyphs == null) return GLYPH_SETS.shade;\n if (typeof glyphs === 'string') return GLYPH_SETS[glyphs] ?? GLYPH_SETS.shade;\n return glyphs.length > 0 ? glyphs : GLYPH_SETS.shade;\n}\n\nexport function toneClass(palette: FigurePalette | undefined, tone: FigureTone): string {\n if (tone === 'empty') return 'text-content-muted';\n if (tone === 'idle') return 'text-content-secondary';\n if (tone === 'primary') return 'text-accent-primary';\n if (tone === 'secondary') {\n return palette === 'mono' || palette == null ? 'text-content-secondary' : 'text-accent-secondary';\n }\n return palette === 'multi' ? 'text-accent-tertiary' : 'text-accent-secondary';\n}\n\nexport function intensityClass(level: number, palette: FigurePalette = 'mono'): string {\n const value = Math.min(4, Math.max(0, Math.round(level)));\n if (value === 0) return toneClass(palette, 'empty');\n if (palette === 'mono') return value <= 2 ? toneClass(palette, 'idle') : 'text-content-primary';\n return value === 1 ? toneClass(palette, 'secondary') : value === 2 ? toneClass(palette, 'tertiary') : toneClass(palette, 'primary');\n}\n\nexport function intensityLevel(value: number, max: number): number {\n if (value <= 0 || max <= 0) return 0;\n return Math.max(1, Math.round(Math.min(1, value / max) * 4));\n}\n\nexport function intensityGlyph(level: number, glyphs: readonly string[] = GLYPH_SETS.shade): string {\n if (glyphs.length === 0) return '·';\n const clamped = Math.min(4, Math.max(0, Math.round(level)));\n return glyphs[Math.round((clamped / 4) * (glyphs.length - 1))] ?? glyphs[0] ?? '·';\n}\n\nexport function words<T extends string>(value: T[] | string): T[] {\n return Array.isArray(value) ? value : value.split(/[\\s,]+/).filter(Boolean) as T[];\n}\n\nexport interface FigureFrameProps extends Omit<React.ComponentProps<'figure'>, 'title'> {\n /** Short uppercase caption drawn across the top edge. */\n title?: string;\n /** Character used at each frame corner. */\n corner?: string;\n}\n\n/**\n * Shared border and caption for one or more documentation renderers.\n * Renderers own their data and can also appear without a frame.\n */\nexport const FigureFrame = React.forwardRef<HTMLElement, FigureFrameProps>(function FigureFrame({ title, corner = '+', className, children, ...rest }, ref) {\n return (\n <figure data-slot=\"figure-frame\"\n ref={ref}\n aria-label={title ?? 'Document figure'}\n className={cn(\n 'relative mx-auto my-8 w-full max-w-5xl border-2 border-dashed border-edge-strong bg-surface-base font-mono text-sm text-content-primary',\n className,\n )}\n {...rest}\n >\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute left-0 top-0 z-10 flex size-4 -translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute right-0 top-0 z-10 flex size-4 translate-x-1/2 -translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 left-0 z-10 flex size-4 -translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n <span aria-hidden=\"true\" className=\"pointer-events-none absolute bottom-0 right-0 z-10 flex size-4 translate-x-1/2 translate-y-1/2 items-center justify-center bg-surface-base font-mono text-xs leading-none text-content-muted\">\n {corner}\n </span>\n {title ? <figcaption className=\"absolute left-1/2 top-0 z-10 -translate-x-1/2 -translate-y-1/2 whitespace-nowrap bg-surface-base px-3 uppercase tracking-wide text-accent-primary\">[ {title} ]</figcaption> : null}\n <div className=\"flex min-w-0 flex-col gap-6 px-5 py-7 sm:px-8 sm:py-8\">{children}</div>\n </figure>\n );\n});\n\n/** Internal root for a renderer. The frame owns the inset. */\nexport const AsciiFrameBody = React.forwardRef<HTMLDivElement, React.ComponentProps<'div'>>(function AsciiFrameBody({ className, ...props }, ref) {\n return <div data-slot=\"ascii-frame-body\" ref={ref} className={cn('min-w-0', className)} {...props} />;\n});\n\n/** Markdown children inside a documentation visual. */\nexport function AsciiFrameProse({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div data-slot=\"ascii-frame-prose\"\n className={cn(\n 'flex min-w-0 flex-col gap-3 leading-relaxed',\n '[&_p]:m-0 [&_p]:text-pretty',\n '[&_ul]:m-0 [&_ul]:flex [&_ul]:list-none [&_ul]:flex-col [&_ul]:gap-1 [&_ul]:p-0',\n '[&_ol]:m-0 [&_ol]:flex [&_ol]:list-none [&_ol]:flex-col [&_ol]:gap-1 [&_ol]:p-0',\n '[&_li]:relative [&_li]:pl-4 [&_li]:before:absolute [&_li]:before:left-0 [&_li]:before:text-content-muted [&_li]:before:content-[\\'-\\']',\n '[&_a]:text-content-primary [&_a]:underline [&_a]:decoration-dashed [&_a]:underline-offset-[0.2em]',\n '[&_code]:font-semibold [&_code]:text-content-primary',\n '[&_pre]:m-0 [&_pre]:whitespace-pre-wrap [&_pre_code]:font-normal [&_pre_code]:text-inherit',\n '[&_strong]:font-semibold [&_strong]:text-content-primary',\n '[&_em]:text-content-secondary [&_em]:not-italic',\n className,\n )}\n {...props}\n />\n );\n}\n\n/** A dashed horizontal rule inside a documentation visual. */\nexport function AsciiFrameRule({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule\" aria-hidden=\"true\" className={cn('my-1 h-px w-full border-t border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A dashed vertical rule inside a documentation visual. */\nexport function AsciiFrameRuleY({ className, ...props }: React.ComponentProps<'div'>) {\n return <div data-slot=\"ascii-frame-rule-y\" aria-hidden=\"true\" className={cn('w-px self-stretch border-l border-dashed border-edge-subtle', className)} {...props} />;\n}\n\n/** A full-width character track used by uptime and related figures. */\nexport function AsciiFrameTrack({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-track\" aria-hidden=\"true\" className={cn('flex w-full min-w-0 select-none', className)} {...props} />;\n}\n\n/** One flexible cell in a character track. */\nexport function AsciiFrameTick({ className, ...props }: React.ComponentProps<'span'>) {\n return <span data-slot=\"ascii-frame-tick\" className={cn('min-w-0 flex-1 overflow-hidden text-center', className)} {...props} />;\n}\n\n/** ASCII arrow used by flow diagrams. */\nexport function AsciiFrameArrow({ accent = false, stretch = false, className }: { accent?: boolean; stretch?: boolean; className?: string }) {\n return (\n <span data-slot=\"ascii-frame-arrow\" aria-hidden=\"true\" className={cn('flex min-w-6 items-center text-content-muted', stretch && 'flex-1', className)}>\n <span className={cn('w-full border-t border-dashed border-current', accent && 'text-accent-primary')} />\n <span className={cn('-ml-1', accent ? 'text-accent-primary' : 'text-content-muted')}>▶</span>\n </span>\n );\n}\n\ntype WithChildren<P> = P & { children?: ReactNode };\ntype AsciiItemComponent<P extends object> = ((props: WithChildren<P>) => null) & {\n graphItem: string;\n displayName?: string;\n};\n\n/** Defines an MDX-only data child that its parent renderer reads. */\nexport function defineAsciiItem<P extends object>(name: string): AsciiItemComponent<P> {\n const Item = (() => null) as unknown as AsciiItemComponent<P>;\n Item.displayName = name;\n Item.graphItem = name;\n return Item;\n}\n\nfunction typeName(type: unknown): string {\n if (typeof type === 'string') return type;\n if (typeof type === 'function') {\n const fn = type as { graphItem?: string; displayName?: string; name?: string };\n return fn.graphItem || fn.displayName || fn.name || '';\n }\n if (type && typeof type === 'object') {\n const value = type as { graphItem?: string; displayName?: string; name?: string; $$id?: string };\n if (value.graphItem) return value.graphItem;\n if (value.displayName) return value.displayName;\n if (typeof value.$$id === 'string') return value.$$id.split('#').pop()?.split('@')[0] ?? '';\n return value.name || '';\n }\n return '';\n}\n\nexport function isHost(element: ReactElement, tags: string | readonly string[]): boolean {\n const name = typeName(element.type).toLowerCase();\n const list = typeof tags === 'string' ? [tags] : tags;\n return list.some((tag) => tag.toLowerCase() === name);\n}\n\nexport function elementsOf(children: ReactNode): ReactElement[] {\n const result: ReactElement[] = [];\n for (const child of React.Children.toArray(children)) {\n if (!React.isValidElement(child)) continue;\n if (child.type === React.Fragment) {\n result.push(...elementsOf((child.props as { children?: ReactNode }).children));\n } else {\n result.push(child);\n }\n }\n return result;\n}\n\nexport function textOf(children: ReactNode): string {\n return React.Children.toArray(children)\n .map((child) => (React.isValidElement(child) ? textOf((child.props as { children?: ReactNode }).children) : String(child)))\n .join('');\n}\n\nexport function itemText(item: ReactElement): string {\n const children = (item.props as { children?: ReactNode }).children;\n return textOf(children).replace(/\\s+/g, ' ').trim();\n}\n\nexport function listItems(children: ReactNode): ReactElement[] {\n const elements = elementsOf(children);\n const lists = elements.filter((element) => isHost(element, ['ul', 'ol']));\n const items = lists.length > 0\n ? lists.flatMap((list) => elementsOf((list.props as { children?: ReactNode }).children))\n : elements;\n return items.filter((element) => isHost(element, 'li'));\n}\n\nexport function nestedList(item: ReactElement): ReactElement[] {\n return listItems((item.props as { children?: ReactNode }).children);\n}\n\nexport function paragraphsOf(children: ReactNode): ReactElement[] {\n return elementsOf(children).filter((element) => isHost(element, 'p'));\n}\n\nexport function hasHost(children: ReactNode, tags: string | readonly string[]): boolean {\n return React.Children.toArray(children).some((child) => {\n if (!React.isValidElement(child)) return false;\n return isHost(child, tags) || hasHost((child.props as { children?: ReactNode }).children, tags);\n });\n}\n\nexport function childItems<P extends object>(children: ReactNode, item: AsciiItemComponent<P>): (P & { children?: ReactNode })[] {\n return elementsOf(children)\n .filter((element) => typeName(element.type) === item.graphItem)\n .map((element) => element.props as P & { children?: ReactNode });\n}\n\nexport function splitLabel(value: string): { label: string; rest: string } {\n const match = value.match(/^([^:—–-]+?)\\s*:\\s*(.*)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function splitDash(value: string): { label: string; rest: string } {\n const match = value.match(/^(.+?)\\s+[-—–]\\s+(.+)$/);\n if (!match) return { label: value.trim(), rest: '' };\n return { label: match[1]?.trim() ?? '', rest: match[2]?.trim() ?? '' };\n}\n\nexport function numberOf(value: number | string): number {\n if (typeof value === 'number') return value;\n const parsed = Number(value.replace(/[^\\d.+-]/g, ''));\n return Number.isFinite(parsed) ? parsed : 0;\n}\n"],"mappings":";AAOA,YAAY,WAAW;AAEvB,SAAS,UAAU;AAiFb,cAYS,YAZT;AA5EC,IAAM,cAAc;AAOpB,IAAM,aAAa;AAAA,EACxB,OAAO,CAAC,QAAK,UAAK,UAAK,UAAK,QAAG;AAAA,EAC/B,OAAO,CAAC,KAAK,KAAK,KAAK,KAAK,GAAG;AAAA,EAC/B,MAAM,CAAC,KAAK,KAAK,KAAK,KAAK,QAAG;AAAA,EAC9B,KAAK,CAAC,UAAK,UAAK,UAAK,UAAK,QAAG;AAC/B;AAIO,SAAS,cAAc,QAAoC;AAChE,MAAI,UAAU,KAAM,QAAO,WAAW;AACtC,MAAI,OAAO,WAAW,SAAU,QAAO,WAAW,MAAM,KAAK,WAAW;AACxE,SAAO,OAAO,SAAS,IAAI,SAAS,WAAW;AACjD;AAEO,SAAS,UAAU,SAAoC,MAA0B;AACtF,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,OAAQ,QAAO;AAC5B,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,SAAS,aAAa;AACxB,WAAO,YAAY,UAAU,WAAW,OAAO,2BAA2B;AAAA,EAC5E;AACA,SAAO,YAAY,UAAU,yBAAyB;AACxD;AAEO,SAAS,eAAe,OAAe,UAAyB,QAAgB;AACrF,QAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;AACxD,MAAI,UAAU,EAAG,QAAO,UAAU,SAAS,OAAO;AAClD,MAAI,YAAY,OAAQ,QAAO,SAAS,IAAI,UAAU,SAAS,MAAM,IAAI;AACzE,SAAO,UAAU,IAAI,UAAU,SAAS,WAAW,IAAI,UAAU,IAAI,UAAU,SAAS,UAAU,IAAI,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MAAM,0BAA0B;AACpD,MAAI,CAAC,MAAO,QAAO,EAAE,OAAO,MAAM,KAAK,GAAG,MAAM,GAAG;AACnD,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,UAAU,OAAgD;AACxE,QAAM,QAAQ,MAAM,MAAM,wBAAwB;AAClD,MAAI,CAAC,MAAO,QAAO,EAAE,OAAO,MAAM,KAAK,GAAG,MAAM,GAAG;AACnD,SAAO,EAAE,OAAO,MAAM,CAAC,GAAG,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC,GAAG,KAAK,KAAK,GAAG;AACvE;AAEO,SAAS,SAAS,OAAgC;AACvD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,SAAS,OAAO,MAAM,QAAQ,aAAa,EAAE,CAAC;AACpD,SAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAC5C;","names":["FigureFrame","AsciiFrameBody"]}
@@ -0,0 +1,9 @@
1
+ "use client";
2
+
3
+ // src/components/docs/figures/FigureSurfaceContext.ts
4
+ import * as React from "react";
5
+ var FigureSurfaceContext = React.createContext(null);
6
+ export {
7
+ FigureSurfaceContext
8
+ };
9
+ //# sourceMappingURL=FigureSurfaceContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/FigureSurfaceContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nexport type FigureSurface = 'base' | 'sheet';\n\n/**\n * Context communicating the enclosing figure container surface to child sections.\n *\n * When nested inside a `DrawingSheet`, child `IndexedSection` elements step up to\n * `bg-surface-raised` to provide crisp contrast against the sheet's `bg-surface-base`\n * grid canvas, preventing the \"same-surface sandwich\" effect.\n */\nexport const FigureSurfaceContext = React.createContext<FigureSurface | null>(null);\n"],"mappings":";;;AAEA,YAAY,WAAW;AAWhB,IAAM,uBAA6B,oBAAoC,IAAI;","names":[]}
@@ -1,8 +1,14 @@
1
+ "use client";
2
+
1
3
  // src/components/docs/figures/IndexedSection.tsx
2
4
  import * as React from "react";
3
5
  import { cn } from "../../../lib/recipe.js";
6
+ import { FigureSurfaceContext } from "./FigureSurfaceContext.js";
4
7
  import { jsx, jsxs } from "react/jsx-runtime";
5
- var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, headingLevel = 3, actions, children, className, ...rest }, ref) {
8
+ var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, headingLevel = 3, actions, surface, children, className, ...rest }, ref) {
9
+ const enclosingSurface = React.useContext(FigureSurfaceContext);
10
+ const resolvedSurface = surface ?? (enclosingSurface === "sheet" ? "raised" : "base");
11
+ const surfaceClass = resolvedSurface === "raised" ? "bg-surface-raised" : resolvedSurface === "transparent" ? "bg-transparent" : "bg-surface-base";
6
12
  const headingId = React.useId();
7
13
  const Heading = `h${headingLevel}`;
8
14
  return /* @__PURE__ */ jsxs(
@@ -12,7 +18,7 @@ var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, h
12
18
  "aria-labelledby": headingId,
13
19
  ...rest,
14
20
  "data-slot": "indexed-section",
15
- className: cn("flex min-w-0 flex-col border-2 border-edge-strong bg-surface-base", className),
21
+ className: cn("flex min-w-0 flex-col border-2 border-edge-strong", surfaceClass, className),
16
22
  children: [
17
23
  /* @__PURE__ */ jsxs("header", { "data-slot": "indexed-section-header", className: "flex items-stretch border-b-2 border-edge-strong", children: [
18
24
  /* @__PURE__ */ jsx(
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/IndexedSection.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\nexport interface IndexedSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** Short reference drawn in the solid tab, such as `A`, `B2`, or `01`. */\n index: ReactNode;\n /** Section heading. */\n title: ReactNode;\n /** Heading level for `title`, so the section sits correctly in the page outline. */\n headingLevel?: 2 | 3 | 4;\n /** Controls drawn at the right of the header, such as a comment button. */\n actions?: ReactNode;\n /** Section content. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An indexed section container: a solid high-contrast index tab, a heading, an optional actions\n * slot, and a hard-ruled body. Works on its own, inside an article/spec, or within a `DrawingSheet`.\n */\nexport const IndexedSection = React.forwardRef<HTMLElement, IndexedSectionProps>(function IndexedSection(\n { index, title, headingLevel = 3, actions, children, className, ...rest },\n ref,\n) {\n const headingId = React.useId();\n const Heading = `h${headingLevel}` as const;\n return (\n <section\n ref={ref}\n aria-labelledby={headingId}\n {...rest}\n data-slot=\"indexed-section\"\n className={cn('flex min-w-0 flex-col border-2 border-edge-strong bg-surface-base', className)}\n >\n <header data-slot=\"indexed-section-header\" className=\"flex items-stretch border-b-2 border-edge-strong\">\n <span\n data-slot=\"indexed-section-index\"\n className=\"flex min-w-12 items-center justify-center bg-content-primary px-3 font-mono text-lg font-bold text-content-inverse\"\n >\n {index}\n </span>\n <Heading\n id={headingId}\n data-slot=\"indexed-section-title\"\n className=\"m-0 flex flex-1 items-center px-4 py-3 font-mono text-lg font-bold tracking-tight text-content-primary\"\n >\n {title}\n </Heading>\n {actions != null ? (\n <div data-slot=\"indexed-section-actions\" className=\"flex items-center gap-2 px-3\">\n {actions}\n </div>\n ) : null}\n </header>\n <div data-slot=\"indexed-section-body\" className=\"min-w-0 p-4 sm:p-6\">\n {children}\n </div>\n </section>\n );\n});\n"],"mappings":";AACA,YAAY,WAAW;AACvB,SAAS,UAAU;AAmCb,SACE,KADF;AAdC,IAAM,iBAAuB,iBAA6C,SAASA,gBACxF,EAAE,OAAO,OAAO,eAAe,GAAG,SAAS,UAAU,WAAW,GAAG,KAAK,GACxE,KACA;AACA,QAAM,YAAkB,YAAM;AAC9B,QAAM,UAAU,IAAI,YAAY;AAChC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,mBAAiB;AAAA,MAChB,GAAG;AAAA,MACJ,aAAU;AAAA,MACV,WAAW,GAAG,qEAAqE,SAAS;AAAA,MAE5F;AAAA,6BAAC,YAAO,aAAU,0BAAyB,WAAU,oDACnD;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACC,WAAW,OACV,oBAAC,SAAI,aAAU,2BAA0B,WAAU,gCAChD,mBACH,IACE;AAAA,WACN;AAAA,QACA,oBAAC,SAAI,aAAU,wBAAuB,WAAU,sBAC7C,UACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["IndexedSection"]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/IndexedSection.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\nimport { FigureSurfaceContext } from './FigureSurfaceContext';\n\nexport interface IndexedSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** Short reference drawn in the solid tab, such as `A`, `B2`, or `01`. */\n index: ReactNode;\n /** Section heading. */\n title: ReactNode;\n /** Heading level for `title`, so the section sits correctly in the page outline. */\n headingLevel?: 2 | 3 | 4;\n /** Controls drawn at the right of the header, such as a comment button. */\n actions?: ReactNode;\n /**\n * Surface elevation rung for the section background.\n * If omitted, defaults to `'raised'` when nested in a `DrawingSheet`, or `'base'` standalone.\n */\n surface?: 'base' | 'raised' | 'transparent';\n /** Section content. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An indexed section container: a solid high-contrast index tab, a heading, an optional actions\n * slot, and a hard-ruled body. Works on its own, inside an article/spec, or within a `DrawingSheet`.\n */\nexport const IndexedSection = React.forwardRef<HTMLElement, IndexedSectionProps>(function IndexedSection(\n { index, title, headingLevel = 3, actions, surface, children, className, ...rest },\n ref,\n) {\n const enclosingSurface = React.useContext(FigureSurfaceContext);\n const resolvedSurface = surface ?? (enclosingSurface === 'sheet' ? 'raised' : 'base');\n const surfaceClass = resolvedSurface === 'raised'\n ? 'bg-surface-raised'\n : resolvedSurface === 'transparent'\n ? 'bg-transparent'\n : 'bg-surface-base';\n\n const headingId = React.useId();\n const Heading = `h${headingLevel}` as const;\n return (\n <section\n ref={ref}\n aria-labelledby={headingId}\n {...rest}\n data-slot=\"indexed-section\"\n className={cn('flex min-w-0 flex-col border-2 border-edge-strong', surfaceClass, className)}\n >\n <header data-slot=\"indexed-section-header\" className=\"flex items-stretch border-b-2 border-edge-strong\">\n <span\n data-slot=\"indexed-section-index\"\n className=\"flex min-w-12 items-center justify-center bg-content-primary px-3 font-mono text-lg font-bold text-content-inverse\"\n >\n {index}\n </span>\n <Heading\n id={headingId}\n data-slot=\"indexed-section-title\"\n className=\"m-0 flex flex-1 items-center px-4 py-3 font-mono text-lg font-bold tracking-tight text-content-primary\"\n >\n {title}\n </Heading>\n {actions != null ? (\n <div data-slot=\"indexed-section-actions\" className=\"flex items-center gap-2 px-3\">\n {actions}\n </div>\n ) : null}\n </header>\n <div data-slot=\"indexed-section-body\" className=\"min-w-0 p-4 sm:p-6\">\n {children}\n </div>\n </section>\n );\n});\n"],"mappings":";;;AAGA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,4BAA4B;AAgD/B,SACE,KADF;AAtBC,IAAM,iBAAuB,iBAA6C,SAASA,gBACxF,EAAE,OAAO,OAAO,eAAe,GAAG,SAAS,SAAS,UAAU,WAAW,GAAG,KAAK,GACjF,KACA;AACA,QAAM,mBAAyB,iBAAW,oBAAoB;AAC9D,QAAM,kBAAkB,YAAY,qBAAqB,UAAU,WAAW;AAC9E,QAAM,eAAe,oBAAoB,WACrC,sBACA,oBAAoB,gBAClB,mBACA;AAEN,QAAM,YAAkB,YAAM;AAC9B,QAAM,UAAU,IAAI,YAAY;AAChC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,mBAAiB;AAAA,MAChB,GAAG;AAAA,MACJ,aAAU;AAAA,MACV,WAAW,GAAG,qDAAqD,cAAc,SAAS;AAAA,MAE1F;AAAA,6BAAC,YAAO,aAAU,0BAAyB,WAAU,oDACnD;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACC,WAAW,OACV,oBAAC,SAAI,aAAU,2BAA0B,WAAU,gCAChD,mBACH,IACE;AAAA,WACN;AAAA,QACA,oBAAC,SAAI,aAAU,wBAAuB,WAAU,sBAC7C,UACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["IndexedSection"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps, FigurePalette, GlyphSetName, Glyphs } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport type { FigureSurface } from './FigureSurfaceContext';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/experiments/ExperimentsView.tsx"],"sourcesContent":["'use client';\n\nimport type React from 'react';\nimport { Beaker, Boxes, Palette, Type, Sparkles, Projector, Terminal } from 'lucide-react';\nimport { PageTitle } from '../PageTitle';\nimport { Badge } from '../Badge';\nimport type { AccentToken } from '../../lib/theme';\n\nexport interface ExperimentItem {\n /** Stable identifier, handed back by `onSelectExperiment`. */\n id: string;\n /** Card heading, uppercased by the type scale. */\n name: string;\n /** One line under the heading saying what the experiment explores. */\n description: string;\n /** Leading glyph. A node rather than a component type, so it can carry its own size. */\n icon?: React.ReactNode;\n /**\n * Lifecycle state, shown as a badge and coloured by {@link STATUS_ACCENT} —\n * `success` for `active`, `info` for `experimental`, `quiet` for `archived`.\n */\n status: 'active' | 'archived' | 'experimental';\n /** How many primitives the experiment exercises, shown in the footer line. */\n componentCount: number;\n}\n\n/**\n * The catalogue `ExperimentsView` falls back to — ryankelly.dev's own.\n *\n * Exported so a consumer can spread it, slice it or use it as the shape of\n * their own list. Until #95 it was exported and *not* accepted as a prop, so\n * the name promised a fallback the component had no way to take.\n */\nexport const DEFAULT_EXPERIMENTS: ExperimentItem[] = [\n {\n id: 'component-library',\n name: 'Component Library',\n description: 'Every core primitive component rendered across the full theme ladder, side by side',\n icon: <Boxes size={36} color=\"var(--ds-accent-primary)\" />,\n status: 'active',\n componentCount: 8,\n },\n {\n id: 'design-sandbox',\n name: 'Design System Sandbox',\n description: 'Interactive component variations, theme toggles, and live presentation playground',\n icon: <Palette size={36} color=\"var(--ds-accent-tertiary)\" />,\n status: 'active',\n componentCount: 12,\n },\n {\n id: 'typography-proposals',\n name: 'Editorial Typography Proposals',\n description: 'Three-role font pairings (Space Grotesk + Inter + IBM Plex Mono + VT323)',\n icon: <Type size={36} color=\"var(--ds-accent-secondary)\" />,\n status: 'active',\n componentCount: 4,\n },\n {\n id: 'presentation-decks',\n name: 'Brutalist Slide Decks',\n description: 'Keyboard-navigated presentation deck engine with fullscreen support',\n icon: <Projector size={36} color=\"var(--ds-intent-success)\" />,\n status: 'active',\n componentCount: 6,\n },\n {\n id: 'graphics-generators',\n name: 'Graphics Generators',\n description: 'Seed-driven SVG background and hero graphics generators for talks',\n icon: <Sparkles size={36} color=\"var(--ds-accent-primary)\" />,\n status: 'active',\n componentCount: 5,\n },\n];\n\n/**\n * How a lifecycle state is coloured.\n *\n * A `Record` over the union rather than a ternary, which is the ladder rule\n * from AGENTS.md applied to a smaller union: a fourth status becomes a compile\n * error here instead of silently falling through to whichever branch the\n * ternary ended on. The expression this replaced —\n * `status === 'active' ? 'cyan' : 'yellow'` — rendered `archived` and\n * `experimental` identically, so two different states looked the same while\n * their labels differed.\n *\n * `active` and `experimental` take **intent** roles because they are states a\n * reader acts on: one is live, one is in progress. `archived` takes `quiet`,\n * an *emphasis* role, and that is the deliberate exception — \"archived\" is not\n * a signal, it is the absence of one, so the right treatment is to recede\n * rather than to communicate.\n */\nconst STATUS_ACCENT: Record<ExperimentItem['status'], AccentToken> = {\n active: 'success',\n experimental: 'info',\n archived: 'quiet',\n};\n\nexport interface ExperimentsViewProps {\n /**\n * The catalogue to render, in display order. Defaults to\n * {@link DEFAULT_EXPERIMENTS}, which is *this site's* list rather than a\n * neutral one — pass your own to use this anywhere else.\n */\n experiments?: readonly ExperimentItem[];\n /**\n * Called with the experiment's `id` when a card is chosen. Omit it and the\n * grid is a read-only display: the cards lose their pointer cursor and do\n * nothing when clicked.\n */\n onSelectExperiment?: (id: string) => void;\n}\n\n/**\n * The experiments index: a grid of cards, one per experiment, each with a\n * status badge and a component count.\n *\n * Pass `experiments` to supply the catalogue; it defaults to\n * {@link DEFAULT_EXPERIMENTS}, which is this site's own list and is exported so\n * a consumer can extend it rather than start from nothing.\n * `onSelectExperiment` turns the cards into navigation — without it the grid is\n * a read-only display.\n *\n * `status` is the only place the component uses colour to mean something, and\n * it reads from {@link STATUS_ACCENT} — intent roles for the two states a\n * reader acts on, `quiet` for `archived`. See that constant for why the third\n * one is the exception.\n */\nexport const ExperimentsView: React.FC<ExperimentsViewProps> = ({\n experiments = DEFAULT_EXPERIMENTS,\n onSelectExperiment,\n}) => {\n return (\n <div data-slot=\"experiments-view\"\n style={{\n maxWidth: '1000px',\n margin: '0 auto',\n padding: '2rem 1.5rem',\n color: 'var(--ds-text-primary)',\n }}\n >\n <div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>\n <Beaker size={40} color=\"var(--ds-accent-primary)\" />\n <PageTitle subtitle=\"Interactive prototypes, design systems, and creative explorations\" bracketed>\n EXPERIMENTS & LABS\n </PageTitle>\n </div>\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '1.5rem', marginTop: '2rem' }}>\n {experiments.map((exp) => (\n <div\n key={exp.id}\n onClick={() => onSelectExperiment && onSelectExperiment(exp.id)}\n className=\"bg-surface-raised text-content-primary border-2 border-edge-strong shadow-hard-md p-6 transition-[transform,box-shadow] duration-150 ease-out hover:-translate-x-0.5 hover:-translate-y-0.5 hover:shadow-[6px_6px_0_0_var(--ds-accent-primary)] motion-reduce:transition-none motion-reduce:hover:translate-x-0 motion-reduce:hover:translate-y-0\"\n style={{\n display: 'flex',\n gap: '1.5rem',\n alignItems: 'center',\n cursor: onSelectExperiment ? 'pointer' : 'default',\n }}\n >\n <div>{exp.icon}</div>\n <div style={{ flex: 1 }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '0.4rem' }}>\n <h3\n style={{\n fontFamily: 'var(--ds-font-display)',\n fontSize: '1.4rem',\n fontWeight: 800,\n textTransform: 'uppercase',\n margin: 0,\n color: 'var(--ds-text-primary)',\n }}\n >\n {exp.name}\n </h3>\n <Badge accent={STATUS_ACCENT[exp.status]}>{exp.status.toUpperCase()}</Badge>\n </div>\n <p\n style={{\n fontFamily: 'var(--ds-font-mono)',\n fontSize: '0.875rem',\n color: 'var(--ds-text-primary)',\n opacity: 0.8,\n margin: 0,\n }}\n >\n {exp.description}\n </p>\n <div style={{ marginTop: '0.75rem', fontSize: '0.8rem', fontFamily: 'var(--ds-font-mono)', color: 'var(--ds-accent-secondary)', display: 'flex', alignItems: 'center', gap: '0.4rem' }}>\n <Terminal size={14} />\n <span>{exp.componentCount} primitives contained</span>\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"mappings":";;;AAGA,SAAS,QAAQ,OAAO,SAAS,MAAM,UAAU,WAAW,gBAAgB;AAC5E,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AAiCZ,cAwGJ,YAxGI;AALH,IAAM,sBAAwC;AAAA,EACnD;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,SAAM,MAAM,IAAI,OAAM,4BAA2B;AAAA,IACxD,QAAQ;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA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K,IAAI;AAAA,QA2CX,CACD,GACH;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/components/experiments/ExperimentsView.tsx"],"sourcesContent":["'use client';\n\nimport type React from 'react';\nimport { Beaker, Boxes, Palette, Type, Sparkles, Projector, Terminal } from 'lucide-react';\nimport { PageTitle } from '../PageTitle';\nimport { Badge } from '../Badge';\nimport type { AccentToken } from '../../lib/theme';\n\nexport interface ExperimentItem {\n /** Stable identifier, handed back by `onSelectExperiment`. */\n id: string;\n /** Card heading, uppercased by the type scale. */\n name: string;\n /** One line under the heading saying what the experiment explores. */\n description: string;\n /** Leading glyph. A node rather than a component type, so it can carry its own size. */\n icon?: React.ReactNode;\n /**\n * Lifecycle state, shown as a badge and coloured by `STATUS_ACCENT` —\n * `success` for `active`, `info` for `experimental`, `quiet` for `archived`.\n */\n status: 'active' | 'archived' | 'experimental';\n /** How many primitives the experiment exercises, shown in the footer line. */\n componentCount: number;\n}\n\n/**\n * The catalogue `ExperimentsView` falls back to — ryankelly.dev's own.\n *\n * Exported so a consumer can spread it, slice it or use it as the shape of\n * their own list. Until #95 it was exported and *not* accepted as a prop, so\n * the name promised a fallback the component had no way to take.\n */\nexport const DEFAULT_EXPERIMENTS: ExperimentItem[] = [\n {\n id: 'component-library',\n name: 'Component Library',\n description: 'Every core primitive component rendered across the full theme ladder, side by side',\n icon: <Boxes size={36} color=\"var(--ds-accent-primary)\" />,\n status: 'active',\n componentCount: 8,\n },\n {\n id: 'design-sandbox',\n name: 'Design System Sandbox',\n description: 'Interactive component variations, theme toggles, and live presentation playground',\n icon: <Palette size={36} color=\"var(--ds-accent-tertiary)\" />,\n status: 'active',\n componentCount: 12,\n },\n {\n id: 'typography-proposals',\n name: 'Editorial Typography Proposals',\n description: 'Three-role font pairings (Space Grotesk + Inter + IBM Plex Mono + VT323)',\n icon: <Type size={36} color=\"var(--ds-accent-secondary)\" />,\n status: 'active',\n componentCount: 4,\n },\n {\n id: 'presentation-decks',\n name: 'Brutalist Slide Decks',\n description: 'Keyboard-navigated presentation deck engine with fullscreen support',\n icon: <Projector size={36} color=\"var(--ds-intent-success)\" />,\n status: 'active',\n componentCount: 6,\n },\n {\n id: 'graphics-generators',\n name: 'Graphics Generators',\n description: 'Seed-driven SVG background and hero graphics generators for talks',\n icon: <Sparkles size={36} color=\"var(--ds-accent-primary)\" />,\n status: 'active',\n componentCount: 5,\n },\n];\n\n/**\n * How a lifecycle state is coloured.\n *\n * A `Record` over the union rather than a ternary, which is the ladder rule\n * from AGENTS.md applied to a smaller union: a fourth status becomes a compile\n * error here instead of silently falling through to whichever branch the\n * ternary ended on. The expression this replaced —\n * `status === 'active' ? 'cyan' : 'yellow'` — rendered `archived` and\n * `experimental` identically, so two different states looked the same while\n * their labels differed.\n *\n * `active` and `experimental` take **intent** roles because they are states a\n * reader acts on: one is live, one is in progress. `archived` takes `quiet`,\n * an *emphasis* role, and that is the deliberate exception — \"archived\" is not\n * a signal, it is the absence of one, so the right treatment is to recede\n * rather than to communicate.\n */\nconst STATUS_ACCENT: Record<ExperimentItem['status'], AccentToken> = {\n active: 'success',\n experimental: 'info',\n archived: 'quiet',\n};\n\nexport interface ExperimentsViewProps {\n /**\n * The catalogue to render, in display order. Defaults to\n * {@link DEFAULT_EXPERIMENTS}, which is *this site's* list rather than a\n * neutral one — pass your own to use this anywhere else.\n */\n experiments?: readonly ExperimentItem[];\n /**\n * Called with the experiment's `id` when a card is chosen. Omit it and the\n * grid is a read-only display: the cards lose their pointer cursor and do\n * nothing when clicked.\n */\n onSelectExperiment?: (id: string) => void;\n}\n\n/**\n * The experiments index: a grid of cards, one per experiment, each with a\n * status badge and a component count.\n *\n * Pass `experiments` to supply the catalogue; it defaults to\n * {@link DEFAULT_EXPERIMENTS}, which is this site's own list and is exported so\n * a consumer can extend it rather than start from nothing.\n * `onSelectExperiment` turns the cards into navigation — without it the grid is\n * a read-only display.\n *\n * `status` is the only place the component uses colour to mean something, and\n * it reads from `STATUS_ACCENT` — intent roles for the two states a\n * reader acts on, `quiet` for `archived`. See that constant for why the third\n * one is the exception.\n */\nexport const ExperimentsView: React.FC<ExperimentsViewProps> = ({\n experiments = DEFAULT_EXPERIMENTS,\n onSelectExperiment,\n}) => {\n return (\n <div data-slot=\"experiments-view\"\n style={{\n maxWidth: '1000px',\n margin: '0 auto',\n padding: '2rem 1.5rem',\n color: 'var(--ds-text-primary)',\n }}\n >\n <div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '1.5rem' }}>\n <Beaker size={40} color=\"var(--ds-accent-primary)\" />\n <PageTitle subtitle=\"Interactive prototypes, design systems, and creative explorations\" bracketed>\n EXPERIMENTS & LABS\n </PageTitle>\n </div>\n\n <div style={{ display: 'flex', flexDirection: 'column', gap: '1.5rem', marginTop: '2rem' }}>\n {experiments.map((exp) => (\n <div\n key={exp.id}\n onClick={() => onSelectExperiment && onSelectExperiment(exp.id)}\n className=\"bg-surface-raised text-content-primary border-2 border-edge-strong shadow-hard-md p-6 transition-[transform,box-shadow] duration-150 ease-out hover:-translate-x-0.5 hover:-translate-y-0.5 hover:shadow-[6px_6px_0_0_var(--ds-accent-primary)] motion-reduce:transition-none motion-reduce:hover:translate-x-0 motion-reduce:hover:translate-y-0\"\n style={{\n display: 'flex',\n gap: '1.5rem',\n alignItems: 'center',\n cursor: onSelectExperiment ? 'pointer' : 'default',\n }}\n >\n <div>{exp.icon}</div>\n <div style={{ flex: 1 }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '1rem', marginBottom: '0.4rem' }}>\n <h3\n style={{\n fontFamily: 'var(--ds-font-display)',\n fontSize: '1.4rem',\n fontWeight: 800,\n textTransform: 'uppercase',\n margin: 0,\n color: 'var(--ds-text-primary)',\n }}\n >\n {exp.name}\n </h3>\n <Badge accent={STATUS_ACCENT[exp.status]}>{exp.status.toUpperCase()}</Badge>\n </div>\n <p\n style={{\n fontFamily: 'var(--ds-font-mono)',\n fontSize: '0.875rem',\n color: 'var(--ds-text-primary)',\n opacity: 0.8,\n margin: 0,\n }}\n >\n {exp.description}\n </p>\n <div style={{ marginTop: '0.75rem', fontSize: '0.8rem', fontFamily: 'var(--ds-font-mono)', color: 'var(--ds-accent-secondary)', display: 'flex', alignItems: 'center', gap: '0.4rem' }}>\n <Terminal size={14} />\n <span>{exp.componentCount} primitives contained</span>\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n"],"mappings":";;;AAGA,SAAS,QAAQ,OAAO,SAAS,MAAM,UAAU,WAAW,gBAAgB;AAC5E,SAAS,iBAAiB;AAC1B,SAAS,aAAa;AAiCZ,cAwGJ,YAxGI;AALH,IAAM,sBAAwC;AAAA,EACnD;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,SAAM,MAAM,IAAI,OAAM,4BAA2B;AAAA,IACxD,QAAQ;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,WAAQ,MAAM,IAAI,OAAM,6BAA4B;AAAA,IAC3D,QAAQ;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,QAAK,MAAM,IAAI,OAAM,8BAA6B;AAAA,IACzD,QAAQ;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,aAAU,MAAM,IAAI,OAAM,4BAA2B;AAAA,IAC5D,QAAQ;AAAA,IACR,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA,IACb,MAAM,oBAAC,YAAS,MAAM,IAAI,OAAM,4BAA2B;AAAA,IAC3D,QAAQ;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cAAI;AAAA;AAAA,kBACP;AAAA,kBACA,oBAAC,SAAM,QAAQ,cAAc,IAAI,MAAM,GAAI,cAAI,OAAO,YAAY,GAAE;AAAA,mBACtE;AAAA,gBACA;AAAA,kBAAC;AAAA;AAAA,oBACC,OAAO;AAAA,sBACL,YAAY;AAAA,sBACZ,UAAU;AAAA,sBACV,OAAO;AAAA,sBACP,SAAS;AAAA,sBACT,QAAQ;AAAA,oBACV;AAAA,oBAEC,cAAI;AAAA;AAAA,gBACP;AAAA,gBACA,qBAAC,SAAI,OAAO,EAAE,WAAW,WAAW,UAAU,UAAU,YAAY,uBAAuB,OAAO,8BAA8B,SAAS,QAAQ,YAAY,UAAU,KAAK,SAAS,GACnL;AAAA,sCAAC,YAAS,MAAM,IAAI;AAAA,kBACpB,qBAAC,UAAM;AAAA,wBAAI;AAAA,oBAAe;AAAA,qBAAqB;AAAA,mBACjD;AAAA,iBACF;AAAA;AAAA;AAAA,UA1CK,IAAI;AAAA,QA2CX,CACD,GACH;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/marketing/FeatureGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { recipe } from '../../lib/recipe';\nimport { accentTextClass } from '../../lib/accentClasses';\nimport type { AccentToken } from '../../lib/theme';\nimport { Card } from '../Card';\nimport { SectionGrid } from './SectionGrid';\nimport type { SectionAlign, SectionColumns } from './SectionGrid';\n\nexport type { SectionAlign, SectionColumns };\n\nexport interface FeatureGridProps\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 — what the features add up to. */\n description?: ReactNode;\n /**\n * How many columns at desktop widths: `2`, `3` (the default) or `4`. Below\n * `md` the grid is always one column, so a phone never gets three cramped\n * cards side by side.\n */\n columns?: SectionColumns;\n /** Where the heading block sits — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** The cells — normally `Feature`s. */\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 features: an optional heading and line, over a grid\n * of {@link Feature} cells.\n *\n * A layout, not content. It holds no copy, no icons and no product name — the\n * page passes all of them — so the same section is a product's feature list, a\n * project's principles, or a service's \"how it works\".\n *\n * The grid is one column below `md` and `columns` wide above it. Vertical\n * margin is `my-12`, which collapses with a neighbouring section's, so a page\n * of sections stacked in a column spaces itself.\n *\n * @example\n * ```tsx\n * <FeatureGrid title=\"Built for control\" columns={3}>\n * <Feature title=\"Sync\" icon={<Cpu size={28} />} accent=\"primary\">\n * Changes land everywhere at once.\n * </Feature>\n * </FeatureGrid>\n * ```\n */\nexport const FeatureGrid = forwardRef<HTMLElement, FeatureGridProps>(function FeatureGrid(props, ref) {\n return <SectionGrid ref={ref} slot=\"feature-grid\" {...props} />;\n});\n\nexport interface FeatureProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The feature's name, set as the cell's `<h3>` in the accent. */\n title: string;\n /**\n * A decorative icon above the text — a `lucide-react` icon at about 28px.\n * Coloured by `accent`, and hidden from assistive technology: the title\n * already names the feature.\n */\n icon?: ReactNode;\n /** The semantic accent for the stripe, the title and the icon. None by default. */\n accent?: AccentToken;\n /** The description — a sentence or two. */\n children?: ReactNode;\n /** Merged into the cell's classes. */\n className?: string;\n}\n\nconst feature = recipe({\n slots: {\n body: 'mt-2',\n icon: 'block',\n description: 'mt-3 font-mono text-[0.85rem] leading-[1.6] text-content-primary opacity-90',\n },\n});\n\n/**\n * One cell of a {@link FeatureGrid}: a titled `Card` panel with an optional\n * icon and a short description.\n *\n * The accent is the whole colour budget — the panel's stripe, its title and\n * the icon all take it — so choose it by role, and let neighbouring cells\n * differ to tell them apart.\n *\n * @example\n * ```tsx\n * <Feature title=\"Backups\" icon={<Shield size={28} />} accent=\"secondary\">\n * Written on a schedule, restored in one step.\n * </Feature>\n * ```\n */\nexport const Feature = forwardRef<HTMLDivElement, FeatureProps>(function Feature(\n { title, icon, accent, children, className, ...props },\n ref,\n) {\n const styles = feature();\n return (\n <Card\n ref={ref}\n variant=\"panel\"\n accent={accent}\n title={title}\n data-slot=\"feature\"\n {...props}\n className={className}\n >\n <div data-slot=\"feature-body\" className={styles.body()}>\n {icon ? (\n <span\n data-slot=\"feature-icon\"\n aria-hidden=\"true\"\n className={styles.icon({ class: accent ? accentTextClass(accent) : undefined })}\n >\n {icon}\n </span>\n ) : null}\n {children ? (\n <div data-slot=\"feature-description\" className={styles.description()}>\n {children}\n </div>\n ) : null}\n </div>\n </Card>\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAEhC,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAkDnB,cA0DH,YA1DG;AADF,IAAM,cAAc,WAA0C,SAASA,aAAY,OAAO,KAAK;AACpG,SAAO,oBAAC,eAAY,KAAU,MAAK,gBAAgB,GAAG,OAAO;AAC/D,CAAC;AAmBD,IAAM,UAAU,OAAO;AAAA,EACrB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF,CAAC;AAiBM,IAAM,UAAU,WAAyC,SAASC,SACvE,EAAE,OAAO,MAAM,QAAQ,UAAU,WAAW,GAAG,MAAM,GACrD,KACA;AACA,QAAM,SAAS,QAAQ;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA,MACJ;AAAA,MAEA,+BAAC,SAAI,aAAU,gBAAe,WAAW,OAAO,KAAK,GAClD;AAAA,eACC;AAAA,UAAC;AAAA;AAAA,YACC,aAAU;AAAA,YACV,eAAY;AAAA,YACZ,WAAW,OAAO,KAAK,EAAE,OAAO,SAAS,gBAAgB,MAAM,IAAI,OAAU,CAAC;AAAA,YAE7E;AAAA;AAAA,QACH,IACE;AAAA,QACH,WACC,oBAAC,SAAI,aAAU,uBAAsB,WAAW,OAAO,YAAY,GAChE,UACH,IACE;AAAA,SACN;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FeatureGrid","Feature"]}
1
+ {"version":3,"sources":["../../../src/components/marketing/FeatureGrid.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { HTMLAttributes, ReactNode } from 'react';\nimport { recipe } from '../../lib/recipe';\nimport { accentTextClass } from '../../lib/accentClasses';\nimport type { AccentToken } from '../../lib/theme';\nimport { Card, type CardWeight } from '../Card';\nimport { SectionGrid } from './SectionGrid';\nimport type { SectionAlign, SectionColumns } from './SectionGrid';\n\nexport type { SectionAlign, SectionColumns };\n\nexport interface FeatureGridProps\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 — what the features add up to. */\n description?: ReactNode;\n /**\n * How many columns at desktop widths: `2`, `3` (the default) or `4`. Below\n * `md` the grid is always one column, so a phone never gets three cramped\n * cards side by side.\n */\n columns?: SectionColumns;\n /** Where the heading block sits — `center` (the default) or `start`. */\n align?: SectionAlign;\n /** The cells — normally `Feature`s. */\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 features: an optional heading and line, over a grid\n * of {@link Feature} cells.\n *\n * A layout, not content. It holds no copy, no icons and no product name — the\n * page passes all of them — so the same section is a product's feature list, a\n * project's principles, or a service's \"how it works\".\n *\n * The grid is one column below `md` and `columns` wide above it. Vertical\n * margin is `my-12`, which collapses with a neighbouring section's, so a page\n * of sections stacked in a column spaces itself.\n *\n * @example\n * ```tsx\n * <FeatureGrid title=\"Built for control\" columns={3}>\n * <Feature title=\"Sync\" icon={<Cpu size={28} />} accent=\"primary\">\n * Changes land everywhere at once.\n * </Feature>\n * </FeatureGrid>\n * ```\n */\nexport const FeatureGrid = forwardRef<HTMLElement, FeatureGridProps>(function FeatureGrid(props, ref) {\n return <SectionGrid ref={ref} slot=\"feature-grid\" {...props} />;\n});\n\nexport interface FeatureProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {\n /** The feature's name, set as the cell's `<h3>` in the accent. */\n title: string;\n /**\n * A decorative icon above the text — a `lucide-react` icon at about 28px.\n * Coloured by `accent`, and hidden from assistive technology: the title\n * already names the feature.\n */\n icon?: ReactNode;\n /** The semantic accent for the stripe, the title and the icon. None by default. */\n accent?: AccentToken;\n /** The panel's weight. `quiet` for a grid of features beside a heavier object on the page. */\n weight?: CardWeight;\n /** The description — a sentence or two. */\n children?: ReactNode;\n /** Merged into the cell's classes. */\n className?: string;\n}\n\nconst feature = recipe({\n slots: {\n body: 'mt-2',\n icon: 'block',\n description: 'mt-3 font-mono text-[0.85rem] leading-[1.6] text-content-primary opacity-90',\n },\n});\n\n/**\n * One cell of a {@link FeatureGrid}: a titled `Card` panel with an optional\n * icon and a short description.\n *\n * The accent is the whole colour budget — the panel's stripe, its title and\n * the icon all take it — so choose it by role, and let neighbouring cells\n * differ to tell them apart.\n *\n * @example\n * ```tsx\n * <Feature title=\"Backups\" icon={<Shield size={28} />} accent=\"secondary\">\n * Written on a schedule, restored in one step.\n * </Feature>\n * ```\n */\nexport const Feature = forwardRef<HTMLDivElement, FeatureProps>(function Feature(\n { title, icon, accent, children, className, ...props },\n ref,\n) {\n const styles = feature();\n return (\n <Card\n ref={ref}\n variant=\"panel\"\n accent={accent}\n title={title}\n data-slot=\"feature\"\n {...props}\n className={className}\n >\n <div data-slot=\"feature-body\" className={styles.body()}>\n {icon ? (\n <span\n data-slot=\"feature-icon\"\n aria-hidden=\"true\"\n className={styles.icon({ class: accent ? accentTextClass(accent) : undefined })}\n >\n {icon}\n </span>\n ) : null}\n {children ? (\n <div data-slot=\"feature-description\" className={styles.description()}>\n {children}\n </div>\n ) : null}\n </div>\n </Card>\n );\n});\n"],"mappings":";AAAA,SAAS,kBAAkB;AAE3B,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAEhC,SAAS,YAA6B;AACtC,SAAS,mBAAmB;AAkDnB,cA4DH,YA5DG;AADF,IAAM,cAAc,WAA0C,SAASA,aAAY,OAAO,KAAK;AACpG,SAAO,oBAAC,eAAY,KAAU,MAAK,gBAAgB,GAAG,OAAO;AAC/D,CAAC;AAqBD,IAAM,UAAU,OAAO;AAAA,EACrB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,aAAa;AAAA,EACf;AACF,CAAC;AAiBM,IAAM,UAAU,WAAyC,SAASC,SACvE,EAAE,OAAO,MAAM,QAAQ,UAAU,WAAW,GAAG,MAAM,GACrD,KACA;AACA,QAAM,SAAS,QAAQ;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,SAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,aAAU;AAAA,MACT,GAAG;AAAA,MACJ;AAAA,MAEA,+BAAC,SAAI,aAAU,gBAAe,WAAW,OAAO,KAAK,GAClD;AAAA,eACC;AAAA,UAAC;AAAA;AAAA,YACC,aAAU;AAAA,YACV,eAAY;AAAA,YACZ,WAAW,OAAO,KAAK,EAAE,OAAO,SAAS,gBAAgB,MAAM,IAAI,OAAU,CAAC;AAAA,YAE7E;AAAA;AAAA,QACH,IACE;AAAA,QACH,WACC,oBAAC,SAAI,aAAU,uBAAsB,WAAW,OAAO,YAAY,GAChE,UACH,IACE;AAAA,SACN;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["FeatureGrid","Feature"]}