{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "spec-sheet", "type": "registry:block", "title": "Spec Sheet", "description": "Printed-manual parts for 1-bit pages: section ruler, hatched figure frame, fact strip, numbered steps and a native FAQ.", "dependencies": [ "@fungi.computer/stipe", "class-variance-authority", "cn", "react" ], "registryDependencies": [], "files": [ { "path": "../src/blocks/spec-sheet.tsx", "type": "registry:block", "target": "@components/blocks/spec-sheet.tsx", "content": "import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\n\nimport { cn } from \"@/lib/cn\";\n\n/*\n * Spec sheet: the printed-manual parts of a 1-bit page. Two tones, hard\n * edges, labels in mono, and a hatched band where a figure meets the paper.\n * Every part reads only theme tokens, so a host picks the ink and paper with\n * its theme and never restyles these parts.\n */\n\n/** Props accepted by SpecRuler. */\nexport type SpecRulerProps = Omit<\n HTMLAttributes,\n \"children\"\n> & {\n /** A short section label, such as `01 · Plans`. */\n label: ReactNode;\n};\n\n/**\n * A tick-marked rule that separates sections, with crosshairs at both ends.\n * It is decorative: the section heading carries the accessible name.\n */\nexport const SpecRuler = forwardRef(\n function SpecRuler({ className, label, ...props }, ref) {\n return (\n \n {label}\n \n );\n },\n);\n\n/** Props accepted by SpecFrame. */\nexport type SpecFrameProps = Omit, \"children\"> & {\n /** Caller-owned media, such as an `img` with its own alt text. */\n children: ReactNode;\n /** A short printed caption under the frame. */\n caption?: ReactNode;\n /** `inverse` seats dark media, such as a terminal readout, in the frame. */\n surface?: \"default\" | \"inverse\";\n};\n\n/** A figure seated in a hatched band, like a plate in a printed manual. */\nexport const SpecFrame = forwardRef(\n function SpecFrame(\n { caption, children, className, surface = \"default\", ...props },\n ref,\n ) {\n return (\n \n
{children}
\n {caption !== undefined ? (\n
{caption}
\n ) : null}\n \n );\n },\n);\n\n/** One fact in a SpecFacts strip. */\nexport type SpecFact = {\n id: string;\n value: ReactNode;\n label: ReactNode;\n};\n\n/** Props accepted by SpecFacts. */\nexport type SpecFactsProps = Omit<\n HTMLAttributes,\n \"children\"\n> & {\n facts: readonly SpecFact[];\n};\n\n/** A ruled strip of short facts: a big value over a small label. */\nexport const SpecFacts = forwardRef(\n function SpecFacts({ className, facts, ...props }, ref) {\n return (\n
\n {facts.map((fact) => (\n
\n
{fact.label}
\n
{fact.value}
\n
\n ))}\n
\n );\n },\n);\n\n/** One step in a SpecSteps list. */\nexport type SpecStep = {\n id: string;\n title: ReactNode;\n body: ReactNode;\n};\n\n/** Props accepted by SpecSteps. */\nexport type SpecStepsProps = Omit<\n HTMLAttributes,\n \"children\"\n> & {\n steps: readonly SpecStep[];\n};\n\n/** A numbered row of steps in ruled cells, numbered 01, 02 and on. */\nexport const SpecSteps = forwardRef(\n function SpecSteps({ className, steps, ...props }, ref) {\n return (\n
    \n {steps.map((step, index) => (\n
  1. \n \n {String(index + 1).padStart(2, \"0\")}\n \n

    {step.title}

    \n
    {step.body}
    \n
  2. \n ))}\n
\n );\n },\n);\n\n/** One question in a SpecFaq list. */\nexport type SpecFaqItem = {\n id: string;\n question: ReactNode;\n /** Caller-reviewed answer content. */\n answer: ReactNode;\n};\n\n/** Props accepted by SpecFaq. */\nexport type SpecFaqProps = Omit, \"children\"> & {\n items: readonly SpecFaqItem[];\n /** Ids of the items that start open. */\n defaultOpen?: readonly string[];\n};\n\n/**\n * Questions and answers as native disclosures. It works without JavaScript,\n * and every answer stays in the document for search and find-in-page.\n */\nexport const SpecFaq = forwardRef(\n function SpecFaq({ className, defaultOpen = [], items, ...props }, ref) {\n return (\n
\n {items.map((item, index) => (\n \n \n \n {String(index + 1).padStart(2, \"0\")}\n \n {item.question}\n \n \n
{item.answer}
\n \n ))}\n
\n );\n },\n);\n\n/** One labelled part of a SpecDiagram, placed in percent of the art. */\nexport type SpecDiagramMarker = {\n id: string;\n /** A short tag drawn on the art, such as `A`. */\n tag: string;\n /** Distance from the art's left edge, 0 to 100. */\n x: number;\n /** Distance from the art's top edge, 0 to 100. */\n y: number;\n label: ReactNode;\n note?: ReactNode;\n};\n\n/** Props accepted by SpecDiagram. */\nexport type SpecDiagramProps = Omit, \"children\"> & {\n /** Caller-owned art, such as an `img` with its own alt text. */\n art: ReactNode;\n markers: readonly SpecDiagramMarker[];\n};\n\nconst percent = (value: number) =>\n `${String(Math.min(100, Math.max(0, value)))}%`;\n\n/**\n * A manual-style parts diagram: tags drawn on the art and a legend that\n * names each part. The legend is the accessible text; tags are decorative.\n */\nexport const SpecDiagram = forwardRef(\n function SpecDiagram({ art, className, markers, ...props }, ref) {\n return (\n \n
\n {art}\n {markers.map((marker) => (\n \n {marker.tag}\n \n ))}\n
\n
\n
    \n {markers.map((marker) => (\n
  • \n \n {marker.tag}\n \n {marker.label}\n {marker.note !== undefined ? (\n {marker.note}\n ) : null}\n
  • \n ))}\n
\n
\n \n );\n },\n);\n\n/** Props accepted by SpecPrintFilter. */\nexport type SpecPrintFilterProps = {\n /** Misregistration of the second ink, in CSS pixels. Defaults to 2, 1. */\n offset?: { x: number; y: number };\n};\n\n/**\n * The `#caps-print` SVG filter, rendered once per page. It turns 1-bit art\n * (dark ink on light paper) into the theme's ink on a transparent ground,\n * with a second ink printed slightly off register underneath, like a two-drum\n * risograph. Art opts in through the theme's `--caps-print-filter`; the inks\n * come from `--caps-print-ink` and `--caps-print-offset`.\n */\nexport function SpecPrintFilter({\n offset = { x: 2, y: 1 },\n}: SpecPrintFilterProps) {\n return (\n \n \n {/* Ink coverage: dark pixels opaque, paper transparent. */}\n \n {/* Only where the art itself is painted, never its empty edges. */}\n \n \n \n \n \n \n \n \n \n \n \n \n );\n}\n" }, { "path": "../src/lib/cn.ts", "type": "registry:lib", "target": "@lib/cn.ts", "content": "import { STIPE_SPACING_NAMES } from \"@fungi.computer/stipe\";\nimport { cva } from \"class-variance-authority\";\nimport { createCn } from \"cn/config\";\n\n/** A conditional class value accepted by cn. */\nexport type { ClassValue } from \"cn\";\nexport { cva };\n\n/** Merge conditional classes with Tailwind rules and Stipe's named spacing. */\nexport const cn = createCn({\n extend: { theme: { spacing: [...STIPE_SPACING_NAMES] } },\n});\n\n/** Resolve a typed React class-name prop before merging its classes. */\nexport function resolveClassName(\n className: string | ((state: State) => string | undefined) | undefined,\n state: State,\n): string | undefined {\n return typeof className === \"function\" ? className(state) : className;\n}\n" } ], "css": { "@import \"@fungi.computer/stipe/styles.css\"": {}, "@plugin \"@tailwindcss/typography\"": {}, "@layer utilities": { ".caps-spec-ruler": { "--caps-spec-tick": "color-mix(\n in oklab,\n var(--color-base-content) 55%,\n transparent\n )", "position": "relative", "display": "flex", "alignItems": "center", "justifyContent": "center", "minHeight": "calc(var(--spacing-xl) + var(--spacing-xs))", "borderBlock": "var(--border) solid var(--color-base-content)", "background": "repeating-linear-gradient(\n to right,\n var(--caps-spec-tick) 0 1px,\n transparent 1px 64px\n )\n 0 0 / 100% 100% no-repeat,\n repeating-linear-gradient(\n to right,\n var(--caps-spec-tick) 0 1px,\n transparent 1px 8px\n )\n 0 100% / 100% 7px no-repeat,\n var(--color-base-100)" }, ".caps-spec-ruler-label": { "paddingInline": "var(--spacing-md)", "background": "var(--color-base-100)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-xs)", "letterSpacing": "0.12em", "textTransform": "uppercase" }, ".caps-spec-ruler::before,.caps-spec-ruler::after": { "content": "\"+\"", "position": "absolute", "top": "50%", "background": "var(--color-base-100)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-lg)", "lineHeight": 1, "transform": "translate(-50%, -52%)" }, ".caps-spec-ruler::before": { "left": "0" }, ".caps-spec-ruler::after": { "left": "100%" }, ".caps-spec-frame": { "display": "grid", "gridTemplateColumns": "minmax(0, 1fr)", "gap": "var(--spacing-sm)", "minWidth": "0", "margin": "0" }, ".caps-spec-frame-window": { "padding": "var(--spacing-sm)", "border": "var(--border) solid var(--color-base-content)", "background": "repeating-linear-gradient(\n 45deg,\n var(--color-base-content) 0 1px,\n transparent 1px 5px\n ),\n var(--color-base-100)" }, ".caps-spec-frame-window > *": { "display": "block", "width": "100%", "maxWidth": "100%", "overflowX": "auto", "height": "auto", "margin": "0", "border": "calc(var(--border) * 2) solid var(--color-base-content)", "background": "var(--color-base-100)" }, ".caps-spec-frame-window > img": { "imageRendering": "pixelated" }, ".caps-spec-frame[data-surface=\"inverse\"] .caps-spec-frame-window > *": { "background": "var(--color-base-content)", "color": "var(--color-base-100)" }, ".caps-spec-frame-caption": { "display": "flex", "flexWrap": "wrap", "justifyContent": "space-between", "gap": "var(--spacing-xs) var(--spacing-lg)", "color": "var(--stipe-fg-muted)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-xs)", "letterSpacing": "0.06em", "textTransform": "uppercase" }, ".caps-spec-facts": { "display": "grid", "gridTemplateColumns": "repeat(auto-fit, minmax(min(100%, 13rem), 1fr))", "margin": "0", "borderTop": "var(--border) solid var(--color-base-content)" }, ".caps-spec-fact": { "display": "flex", "flexDirection": "column-reverse", "justifyContent": "flex-end", "gap": "var(--spacing-xs)", "padding": "var(--spacing-lg) var(--spacing-xl)", "borderBottom": "var(--border) solid var(--color-base-content)", "boxShadow": "inset calc(var(--border) * -1) 0 0 var(--stipe-hairline)" }, ".caps-spec-fact-value": { "margin": "0", "color": "var(--stipe-figure-ink)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-2xl)", "lineHeight": 1.1 }, ".caps-spec-fact-label": { "color": "var(--stipe-fg-muted)", "fontSize": "var(--text-sm)", "lineHeight": 1.45 }, ".caps-spec-steps": { "display": "grid", "gridTemplateColumns": "repeat(auto-fit, minmax(min(100%, 14rem), 1fr))", "margin": "0", "padding": "0", "border": "calc(var(--border) * 2) solid var(--color-base-content)", "listStyle": "none" }, ".caps-spec-step": { "display": "grid", "gridTemplateRows": "auto auto 1fr", "alignContent": "start", "gap": "var(--spacing-sm)", "padding": "var(--spacing-xl)", "boxShadow": "inset calc(var(--border) * -1) 0 0 var(--stipe-hairline),\n inset 0 calc(var(--border) * -1) 0 var(--stipe-hairline)" }, ".caps-spec-step-number": { "justifySelf": "start", "padding": "var(--spacing-2xs) var(--spacing-sm)", "background": "var(--color-base-content)", "color": "var(--color-base-100)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-xs)", "letterSpacing": "0.08em" }, ".caps-spec-step-title": { "margin": "var(--spacing-sm) 0 0", "fontSize": "var(--text-xl)", "fontWeight": 600, "lineHeight": 1.25 }, ".caps-spec-step-body": { "color": "var(--stipe-fg-muted)", "fontSize": "var(--text-sm)", "lineHeight": 1.6 }, ".caps-spec-faq": { "display": "grid", "borderTop": "calc(var(--border) * 2) solid var(--color-base-content)" }, ".caps-spec-faq-item": { "borderBottom": "var(--border) solid var(--stipe-hairline-quiet)" }, ".caps-spec-faq-question": { "display": "grid", "gridTemplateColumns": "auto 1fr auto", "alignItems": "baseline", "gap": "var(--spacing-lg)", "padding": "var(--spacing-lg) 0", "cursor": "pointer", "fontSize": "var(--text-lg)", "fontWeight": 500, "lineHeight": 1.4, "listStyle": "none" }, ".caps-spec-faq-question::-webkit-details-marker": { "display": "none" }, ".caps-spec-faq-question:hover .caps-spec-faq-text": { "textDecoration": "underline", "textUnderlineOffset": "0.2em" }, ".caps-spec-faq-question:focus-visible": { "outline": "calc(var(--border) * 2) solid var(--color-base-content)", "outlineOffset": "var(--spacing-xs)" }, ".caps-spec-faq-number": { "color": "var(--stipe-fg-muted)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-xs)", "letterSpacing": "0.08em" }, ".caps-spec-faq-mark": { "display": "grid", "placeItems": "center", "width": "1.5em", "height": "1.5em", "border": "var(--border) solid var(--color-base-content)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-sm)", "lineHeight": 1 }, ".caps-spec-faq-mark::before": { "content": "\"+\"" }, ".caps-spec-faq-item[open] .caps-spec-faq-mark": { "background": "var(--color-base-content)", "color": "var(--color-base-100)" }, ".caps-spec-faq-item[open] .caps-spec-faq-mark::before": { "content": "\"−\"" }, ".caps-spec-faq-answer": { "display": "grid", "gap": "var(--spacing-sm)", "maxWidth": "68ch", "padding": "0 0 var(--spacing-xl) calc(var(--spacing-lg) + 2ch)", "color": "var(--stipe-fg-muted)", "lineHeight": 1.65 }, ".caps-spec-faq-answer > *": { "margin": "0" }, ".caps-spec-diagram": { "display": "grid", "gap": "var(--spacing-lg)", "minWidth": "0", "margin": "0" }, ".caps-spec-diagram-art": { "position": "relative", "lineHeight": 0 }, ".caps-spec-diagram-art > img": { "display": "block", "width": "100%", "height": "auto", "imageRendering": "pixelated", "filter": "var(--caps-print-filter, none)" }, ".caps-spec-diagram-tag,.caps-spec-diagram-key": { "display": "inline-grid", "placeItems": "center", "width": "1.75em", "height": "1.75em", "background": "var(--color-accent)", "color": "var(--color-accent-content)", "fontFamily": "var(--font-mono)", "fontSize": "var(--text-xs)", "lineHeight": 1 }, ".caps-spec-diagram-tag": { "position": "absolute", "outline": "calc(var(--border) * 2) solid var(--color-base-100)", "transform": "translate(-50%, -50%)" }, ".caps-spec-diagram-legend ul": { "display": "grid", "gridTemplateColumns": "repeat(auto-fit, minmax(min(100%, 9rem), 1fr))", "gap": "var(--spacing-md) var(--spacing-lg)", "margin": "0", "padding": "var(--spacing-md) 0 0", "borderTop": "var(--border) solid var(--color-base-content)", "listStyle": "none" }, ".caps-spec-diagram-legend li": { "display": "grid", "gridTemplateColumns": "auto 1fr", "alignContent": "start", "alignItems": "start", "gap": "var(--spacing-2xs) var(--spacing-sm)" }, ".caps-spec-diagram-label": { "fontSize": "var(--text-sm)", "fontWeight": 600, "lineHeight": 1.35 }, ".caps-spec-diagram-note": { "gridColumn": "2", "color": "var(--stipe-fg-muted)", "fontSize": "var(--text-sm)", "lineHeight": 1.45 } }, "@property --caps-game-host-ink": { "syntax": "\"\"", "inherits": "true", "initialValue": "black" } } }