Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.
Update project implementation and configuration
Aniket-5085e9f0f88e98e
diff --git a/.gitignore b/.gitignoreindex 54468ae..c4cd3fa 100644--- a/.gitignore+++ b/.gitignore@@ -2,6 +2,8 @@# dependencies/node_modules+/.pnpm-store/+/.registry-build//.pnp.pnp.*.yarn/*diff --git a/README.md b/README.mdindex bbf1551..a27239c 100644--- a/README.md+++ b/README.md@@ -5,43 +5,54 @@<h1 align="center">pdfcn</h1><p align="center">- A shadcn registry of PDF components for <strong>Takumi PDF</strong> and <strong>Forme PDF</strong> — invoices, reports, tables, and primitives with live PDF preview.- <br />- <br />- 100% catalog parity with <a href="https://github.com/akii09/pdfx">pdfx</a> across both bases.+ Free & open-source, ready-to-use, customizable PDF components for React.<br/>+ Copy, paste, and ship. Built on <a href="https://takumi.kane.tw/docs/pdf">Takumi</a> and <a href="https://docs.formepdf.com">Forme</a>, works seamlessly with <a href="https://ui.shadcn.com/">shadcn/ui</a>.</p>-## Bases+<p align="center">+ <a href="https://github.com/shadcn-labs/pdfcn"><img src="https://www.shieldcn.dev/github/stars/shadcn-labs/pdfcn.svg?variant=secondary&size=xs&theme=zinc" alt="GitHub Stars" /></a>+ <a href="https://github.com/shadcn-labs/pdfcn/actions"><img src="https://www.shieldcn.dev/github/ci/shadcn-labs/pdfcn.svg?variant=secondary&size=xs&theme=zinc" alt="CI" /></a>+ <a href="https://discord.gg/N6G36KhYK4"><img src="https://www.shieldcn.dev/discord/online-members/N6G36KhYK4.svg?variant=secondary&size=xs&theme=zinc" alt="Discord Members" /></a>+ <a href="https://x.com/shadcnlabs"><img src="https://www.shieldcn.dev/x/follow/shadcnlabs.svg?variant=branded&size=xs&theme=zinc" alt="X Follow" /></a>+</p>++<p align="center">+ <a href="https://pdfcn.vercel.app/docs">Get Started</a> ·+ <a href="https://pdfcn.vercel.app/docs/installation">Installation</a> ·+ <a href="https://pdfcn.vercel.app/docs/components">Components</a> ·+ <a href="https://pdfcn.vercel.app/docs/blocks">Blocks</a>+</p>++## Features++- ⚡ **Two rendering bases** — Generate PDFs with Takumi or Forme+- 🎯 **Zero config** — Works out of the box with sensible defaults+- 👀 **Live previews** — Render every component and block directly in the documentation+- 🎨 **Fully customizable** — Sensible props and shared themes; you own the code+- 📦 **shadcn/ui compatible** — Uses the same registry format and CLI workflow+- 🧩 **Composable** — Build documents from focused React components and renderer primitives+- 📄 **Components and blocks** — Tables, forms, charts, invoices, reports, and more-| Base | Generate | Browser preview |-| -------- | --------------------------------------------------------- | --------------------------------------------------- |-| `takumi` | [`takumi-pdf`](https://takumi.kane.tw/docs/pdf) | [react-pdf](https://github.com/wojtekmaj/react-pdf) |-| `forme` | [`@formepdf/react`](https://docs.formepdf.com/quickstart) | `@formepdf/core` / browser |+## Contributing-## Install+Contributions are welcome! Please feel free to submit a Pull Request.-```bash-npx shadcn@latest add @pdfcn/takumi/text-npx shadcn@latest add @pdfcn/forme/invoice-minimal-```+1. Fork the repository+2. Create your feature branch (`git checkout -b feature/amazing-feature`)+3. Commit your changes (`git commit -m 'Add some amazing feature'`)+4. Push to the branch (`git push origin feature/amazing-feature`)+5. Open a Pull Request-## Develop+## License-```bash-pnpm install-pnpm registry:build-pnpm dev-```+[MIT](LICENSE)-## Structure+## Star History-```-registry/- bases/- takumi/ # components, blocks, lib- forme/ # same catalog- themes/ # shared PdfcnTheme tokens-examples/- takumi/- forme/-```+<a href="https://www.star-history.com/?repos=shadcn-labs%2Fpdfcn&type=date&legend=top-left">+ <picture>+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=shadcn-labs/pdfcn&type=date&theme=dark&legend=top-left" />+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=shadcn-labs/pdfcn&type=date&legend=top-left" />+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=shadcn-labs/pdfcn&type=date&legend=top-left" />+ </picture>+</a>diff --git a/app/api/pdf/forme/route.tsx b/app/api/pdf/forme/route.tsxindex df32161..2a52495 100644--- a/app/api/pdf/forme/route.tsx+++ b/app/api/pdf/forme/route.tsx@@ -1,7 +1,8 @@-import { renderDocument } from "@formepdf/core";+import { renderPdf } from "@formepdf/core";import { serialize } from "@formepdf/react";import { demos } from "@/examples/__forme__";+import { replacePreviewImageSources } from "@/examples/preview-assets";export const GET = async (request: Request) => {const { searchParams } = new URL(request.url);@@ -17,7 +18,11 @@ export const GET = async (request: Request) => {return Response.json({ document: serialize(<Demo />) });}- const pdfBytes = await renderDocument(<Demo />);+ // Keep serialization in this module so Forme sees the same primitive+ // identities used by the demo tree. renderDocument() dynamically imports+ // another serializer instance and can otherwise discard nested Pages.+ const document = replacePreviewImageSources(serialize(<Demo />));+ const pdfBytes = await renderPdf(JSON.stringify(document));return new Response(Buffer.from(pdfBytes), {headers: {diff --git a/app/api/pdf/takumi/route.tsx b/app/api/pdf/takumi/route.tsxindex 8e4deb1..701e765 100644--- a/app/api/pdf/takumi/route.tsx+++ b/app/api/pdf/takumi/route.tsx@@ -1,8 +1,11 @@-import { googleFonts } from "@takumi-rs/helpers";+import { readFile } from "node:fs/promises";+import path from "node:path";+import { fromJsx } from "@takumi-rs/helpers/jsx";import { render } from "takumi-pdf";import { demos } from "@/examples/__takumi__";+import { getTakumiPreviewOptions } from "@/examples/preview-config";export const GET = async (request: Request) => {const { searchParams } = new URL(request.url);@@ -14,15 +17,18 @@ export const GET = async (request: Request) => {try {const Demo = demos[name as keyof typeof demos];+ const { node, stylesheets } = await fromJsx(<Demo />);if (searchParams.get("format") === "document") {- const { node, stylesheets } = await fromJsx(<Demo />);return Response.json({ node, stylesheets });}- const pdf = await render(<Demo />, {- fonts: await googleFonts(["Inter", "Times New Roman"]),- margin: { bottom: 48, left: 48, right: 48, top: 48 },- size: "a4",+ const logo = await readFile(path.join(process.cwd(), "public/favicon.png"));+ const pdf = await render(node, {+ ...getTakumiPreviewOptions(name),+ images: {+ sources: [{ data: logo, src: "/favicon.png" }],+ },+ stylesheets,});return new Response(Buffer.from(pdf), {diff --git a/components/component-preview.tsx b/components/component-preview.tsxindex 1f79060..3530046 100644--- a/components/component-preview.tsx+++ b/components/component-preview.tsx@@ -26,14 +26,10 @@ export const ComponentPreview = ({<>{children}{name ? (- <PdfPreview- base={base}- name={name}- className={cn("mt-4", className)}- />+ <PdfPreview base={base} name={name} className={cn("mt-4", className)} />) : null}- {!hideCode ? (+ {hideCode ? null : (<ComponentSource base={base} name={name} src={src} title={title} />- ) : null}+ )}</>);diff --git a/components/components-list.tsx b/components/components-list.tsxindex 910a8dd..77b7709 100644--- a/components/components-list.tsx+++ b/components/components-list.tsx@@ -60,9 +60,10 @@ export const ComponentsList = ({? ROUTES.DOCS_BLOCKS: ROUTES.DOCS_COMPONENTS;const basePages = getFolderPages(folder, base);- const pages = (basePages.length > 0 ? basePages : getFolderPages(folder)).filter(- (page) =>- page.url !== sectionUrl && page.url !== `${sectionUrl}/${base}`+ const pages = (+ basePages.length > 0 ? basePages : getFolderPages(folder)+ ).filter(+ (page) => page.url !== sectionUrl && page.url !== `${sectionUrl}/${base}`);return pages.length > 0 ? (diff --git a/components/docs-sidebar.tsx b/components/docs-sidebar.tsxindex 882ceb6..3f0c411 100644--- a/components/docs-sidebar.tsx+++ b/components/docs-sidebar.tsx@@ -42,11 +42,7 @@ const SidebarMenuItemLink = ({children: React.ReactNode;}) => (<SidebarMenuItem>- <SidebarMenuButton- asChild- className={MENU_BUTTON_CLS}- isActive={isActive}- >+ <SidebarMenuButton asChild className={MENU_BUTTON_CLS} isActive={isActive}><Link href={href}><span className="absolute inset-0 flex w-(--sidebar-menu-width) bg-transparent" />{children}@@ -116,40 +112,35 @@ const ComponentsSidebarPanel = ({// Get pages from the base folderconst baseFolder = findBaseFolder(folder, currentBase);- const pages = (baseFolder ? getAllPagesFromFolder(baseFolder) : getAllPagesFromFolder(folder))- .filter((page) => !page.url.endsWith("/components") && !page.url.endsWith("/components/"))- .map((page) => ({ url: page.url, name: page.name }));+ const pages = (+ baseFolder+ ? getAllPagesFromFolder(baseFolder)+ : getAllPagesFromFolder(folder)+ )+ .filter(+ (page) =>+ !page.url.endsWith("/components") && !page.url.endsWith("/components/")+ )+ .map((page) => ({ name: page.name, url: page.url }));return (- <SidebarPageGroup- label="Components"- pages={pages}- pathname={pathname}- />+ <SidebarPageGroup label="Components" pages={pages} pathname={pathname} />);};-const BlocksSidebarPanel = ({- currentBase,- pathname,- tree,-}: SidebarPanelProps) => {+const BlocksSidebarPanel = ({ pathname, tree }: SidebarPanelProps) => {const folder = findTopLevelFolder(tree, isBlocksFolder);if (!folder) {return null;}const pages = getAllPagesFromFolder(folder)- .filter((page) => !page.url.endsWith("/blocks") && !page.url.endsWith("/blocks/"))- .map((page) => ({ url: page.url, name: page.name }));+ .filter(+ (page) => !page.url.endsWith("/blocks") && !page.url.endsWith("/blocks/")+ )+ .map((page) => ({ name: page.name, url: page.url }));- return (- <SidebarPageGroup- label="Blocks"- pages={pages}- pathname={pathname}- />- );+ return <SidebarPageGroup label="Blocks" pages={pages} pathname={pathname} />;};export const DocsSidebar = ({diff --git a/components/logo.tsx b/components/logo.tsxindex 213091a..c91db8c 100644--- a/components/logo.tsx+++ b/components/logo.tsx@@ -5,20 +5,14 @@ export const LogoMark = ({...props}: React.ComponentProps<"svg">) => (<svg- xmlns="http://www.w3.org/2000/svg"- viewBox="0 0 24 24"+ viewBox="0 0 505 455"fill="none"- stroke="currentColor"- strokeWidth="2"- strokeLinecap="round"- strokeLinejoin="round"- className={cn("size-4", className)}+ xmlns="http://www.w3.org/2000/svg"+ className={cn("size-4 fill-foreground", className)}{...props}>- <path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z" />- <path d="M12 22V12" />- <polyline points="3.29 7 12 12 20.71 7" />- <path d="m7.5 4.27 9 5.15" />+ <path d="M155 45c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10H65c-5.523 0-10 4.477-10 10v225c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v35c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10H60c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10H10c-5.523 0-10-4.477-10-10V110c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V60c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V10c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10zm250-5c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v235c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-35c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10v-30c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V115c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10V65c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10V10c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10z" />+ <path d="M305 90c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v35c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-75c-5.523 0-10 4.477-10 10v75c0 5.523 4.477 10 10 10h80c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v85c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-85c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10v-35c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h75c5.523 0 10-4.477 10-10v-75c0-5.523-4.477-10-10-10h-80c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10v-85c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V60c0-5.523 4.477-10 10-10h85c5.523 0 10 4.477 10 10z" /></svg>);@@ -27,36 +21,41 @@ export const LogoType = ({...props}: React.ComponentProps<"svg">) => (<svg- viewBox="0 0 120 24"+ viewBox="0 0 554 60"fill="none"xmlns="http://www.w3.org/2000/svg"className={cn("h-4 w-auto fill-foreground", className)}{...props}>- <text- x="0"- y="18"- fontFamily="system-ui, sans-serif"- fontSize="18"- fontWeight="600"- fill="currentColor"- >- pdfcn- </text>+ <path d="M19.237 0c.733 0 1.327.59 1.328 1.318v4.616c0 .728-.595 1.319-1.328 1.319h-3.98c-.732 0-1.326.59-1.326 1.318v3.956c0 .729-.595 1.319-1.327 1.319h-3.98c-.733 0-1.327.59-1.327 1.319v29.67c0 .728.594 1.32 1.327 1.32h3.98c.732 0 1.327.59 1.327 1.318v3.956c0 .728.594 1.318 1.327 1.318h3.98c.732 0 1.326.591 1.326 1.32v4.615c0 .728-.594 1.318-1.327 1.318h-4.643c-.733 0-1.326-.59-1.326-1.318v-3.956c0-.729-.595-1.32-1.328-1.32H7.96c-.733 0-1.326-.59-1.326-1.318v-3.956c0-.728-.595-1.319-1.327-1.319h-3.98A1.324 1.324 0 0 1 0 45.494V14.506c0-.728.594-1.32 1.327-1.32h3.98c.732 0 1.327-.59 1.327-1.318V7.912c0-.728.593-1.318 1.326-1.318h3.98c.733 0 1.328-.591 1.328-1.32V1.318A1.32 1.32 0 0 1 14.594 0zm33.169 0c.733 0 1.326.59 1.326 1.318v3.956c0 .729.595 1.32 1.328 1.32h3.98c.733 0 1.326.59 1.326 1.318v3.956c0 .728.595 1.319 1.327 1.319h3.98c.733 0 1.327.59 1.327 1.319v30.988c0 .728-.594 1.32-1.327 1.32h-3.98c-.732 0-1.327.59-1.327 1.318v3.956c0 .728-.593 1.318-1.326 1.318h-3.98c-.733 0-1.328.591-1.328 1.32v3.956c0 .728-.593 1.318-1.326 1.318h-4.643c-.733 0-1.327-.59-1.328-1.318v-4.616c0-.728.595-1.319 1.328-1.319h3.98c.732 0 1.326-.59 1.326-1.318v-3.956c0-.729.595-1.319 1.328-1.319h3.979c.733 0 1.327-.59 1.327-1.319v-29.67c0-.728-.594-1.32-1.327-1.32h-3.98c-.732 0-1.327-.59-1.327-1.318V8.571c0-.728-.594-1.318-1.327-1.318h-3.98a1.324 1.324 0 0 1-1.327-1.32V1.319A1.324 1.324 0 0 1 47.764 0zm65.713 0q6.554 0 11.166 2.426 4.693 2.425 7.363 6.63 2.751 4.206 3.399 9.624l-8.982.484q-.404-3.315-2.023-5.821a10.7 10.7 0 0 0-4.369-3.963q-2.751-1.455-6.716-1.455-5.016 0-7.93 2.345-2.832 2.263-2.832 6.064 0 2.426 1.133 4.124 1.214 1.617 4.208 2.83 3.075 1.214 8.657 2.588 7.444 1.698 11.814 4.205 4.45 2.426 6.311 5.741 1.862 3.316 1.862 7.52 0 5.096-2.67 8.895-2.59 3.72-7.283 5.741Q126.534 60 120.304 60q-6.877 0-11.976-2.507-5.017-2.506-7.93-6.954Q97.486 46.092 97 40.19l8.981-.566q.567 4.042 2.347 6.873 1.78 2.75 4.775 4.205 3.074 1.374 7.362 1.374 3.722 0 6.311-.89 2.67-.97 4.046-2.83t1.376-4.528q0-2.425-1.214-4.285-1.132-1.941-4.45-3.477-3.236-1.618-9.548-3.154-6.877-1.698-11.005-3.72-4.126-2.021-5.987-5.013-1.78-3.074-1.78-7.52 0-4.934 2.347-8.652 2.428-3.801 6.877-5.903Q111.889 0 118.119 0" />+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M209.126 14.717q8.74 0 13.27 4.69 4.612 4.61 4.612 13.019v16.738q0 1.536.486 2.184.567.566 1.779.566h1.539v6.792q-.405.081-1.295.162t-1.862.081q-2.751 0-4.773-.89-1.942-.889-2.913-2.91-.59-1.28-.823-3.067a10.7 10.7 0 0 1-2.09 2.904q-2.105 2.184-5.421 3.478-3.237 1.213-7.04 1.213-6.717 0-10.762-3.074-3.965-3.072-3.965-8.652t3.318-8.652q3.398-3.154 10.438-4.529l14.808-2.83q0-5.013-2.347-7.439-2.346-2.507-6.959-2.507-4.126 0-6.474 1.86-2.346 1.78-3.236 5.337l-8.819-.566q1.213-6.468 5.987-10.189 4.855-3.72 12.542-3.72m-3.317 26.119q-3.884.728-5.502 2.345-1.538 1.536-1.538 3.962 0 2.748 1.861 4.286 1.942 1.455 5.341 1.455 3.883 0 6.634-1.455 2.751-1.537 4.289-4.205t1.538-6.065V38.41zm66.559 17.871h-8.01l-.243-6.469q-1.78 3.477-5.421 5.5-3.56 1.94-8.091 1.94-5.503 0-9.629-2.75-4.046-2.749-6.231-7.763-2.103-5.095-2.103-11.968t2.184-11.886q2.186-5.094 6.231-7.844 4.046-2.75 9.548-2.75 4.45 0 7.929 1.861t5.26 5.175V1.294h8.576zm-19.5-36.55q-5.178 0-8.253 4.043-3.075 3.963-3.075 10.997 0 6.955 3.075 10.998t8.253 4.043q3.48 0 5.906-1.779 2.428-1.778 3.723-5.175t1.295-8.087q0-4.852-1.295-8.167-1.295-3.395-3.723-5.093-2.427-1.78-5.906-1.78"+ />+ <path d="M299.041 14.717q5.26 0 9.305 1.86 4.127 1.779 6.635 5.256 2.589 3.477 3.318 8.49l-8.982.486q-.647-4.205-3.398-6.388-2.751-2.265-6.878-2.265-5.421 0-8.496 4.043-2.994 3.963-2.994 10.997 0 7.035 2.994 11.08 3.075 3.96 8.496 3.961 4.127 0 6.878-2.264 2.751-2.345 3.398-7.035l8.982.485q-.729 4.932-3.318 8.571-2.508 3.64-6.635 5.661-4.046 2.022-9.305 2.022-6.15 0-10.762-2.75t-7.121-7.843q-2.508-5.095-2.508-11.888 0-6.792 2.508-11.805 2.509-5.095 7.121-7.844 4.612-2.83 10.762-2.83" />+ <path+ fillRule="evenodd"+ clipRule="evenodd"+ d="M447.657 14.717q8.74 0 13.271 4.69 4.612 4.61 4.612 13.019v16.738q0 1.536.485 2.184.567.566 1.781.566h1.537v6.792q-.405.081-1.295.162t-1.86.081q-2.752 0-4.775-.89-1.942-.889-2.913-2.91-.59-1.28-.821-3.067a10.7 10.7 0 0 1-2.092 2.904q-2.104 2.184-5.421 3.478-3.237 1.213-7.04 1.213-6.716 0-10.762-3.074-3.965-3.072-3.965-8.652t3.318-8.652q3.398-3.154 10.438-4.529l14.808-2.83q0-5.013-2.347-7.439-2.346-2.507-6.959-2.507-4.126 0-6.472 1.86-2.347 1.78-3.238 5.337l-8.819-.566q1.214-6.468 5.987-10.189 4.856-3.72 12.542-3.72m-3.317 26.119q-3.883.728-5.502 2.345-1.537 1.536-1.537 3.962 0 2.748 1.86 4.286 1.942 1.455 5.341 1.455 3.884 0 6.635-1.455 2.751-1.537 4.289-4.205t1.537-6.065V38.41zm37.999-19.083q1.7-2.83 5.016-4.933 3.399-2.102 7.849-2.102 5.583 0 9.71 2.749 4.126 2.749 6.312 7.844 2.265 5.013 2.265 11.886t-2.265 11.968q-2.185 5.013-6.312 7.763t-9.71 2.75q-4.45 0-7.93-1.94a13.94 13.94 0 0 1-5.258-5.5l-.244 6.47h-8.01V1.293h8.577zm11.571.404q-3.64 0-6.23 1.78-2.59 1.779-3.965 5.174-1.376 3.316-1.376 8.086 0 4.61 1.376 8.006t3.965 5.256q2.59 1.78 6.149 1.78 4.935 0 7.849-3.963 2.913-4.043 2.913-11.079 0-7.035-2.913-10.997-2.913-4.043-7.768-4.043"+ />+ <path d="M535.309 14.717q5.582 0 9.385 1.94 3.804 1.86 5.908 5.095 2.184 3.154 2.751 7.116l-8.82.486q-.405-2.265-1.618-3.882-1.133-1.698-3.075-2.588-1.942-.97-4.612-.97-4.126 0-6.15 1.617-2.022 1.617-2.022 4.205 0 1.94.889 3.154.972 1.212 3.076 2.021 2.103.728 5.583 1.294 6.715 1.132 10.518 2.83 3.803 1.617 5.341 4.043Q554 43.504 554 46.981q0 4.044-2.266 6.874t-6.23 4.366q-3.965 1.456-9.144 1.456-6.068 0-10.276-1.86-4.126-1.86-6.392-5.094-2.266-3.316-2.589-7.602l8.82-.404q.647 3.557 3.074 5.66 2.428 2.102 7.363 2.102 4.046.001 6.393-1.294t2.347-4.123q0-1.536-.81-2.587-.728-1.133-2.913-1.86-2.184-.81-6.473-1.537-6.392-1.213-10.034-2.83-3.64-1.617-5.178-4.124t-1.538-6.064q0-5.904 4.37-9.623 4.45-3.72 12.785-3.72m-378.704 7.175q.663-1.45 1.62-2.566a11.8 11.8 0 0 1 4.773-3.477q2.832-1.132 6.231-1.132 4.692 0 7.929 2.102 3.237 2.022 4.855 5.742 1.699 3.72 1.699 8.49v27.655h-8.576v-25.39q0-5.823-2.024-8.572-1.941-2.83-6.149-2.83-4.693 0-7.525 2.991-2.833 2.912-2.833 8.572v25.23h-8.576V1.293h8.576zm188.21-7.175q4.855 0 8.011 2.183 3.237 2.103 4.855 5.823 1.698 3.637 1.699 8.328v27.655h-8.577V33.64q0-3.8-.809-6.388t-2.671-3.963q-1.86-1.374-4.854-1.374-4.532 0-7.364 2.991t-2.832 8.734v25.067h-8.577V15.688h7.849l.209 7.412q.716-1.883 1.814-3.289 2.023-2.587 4.936-3.8 2.913-1.294 6.311-1.294m51.137 35.984h27.997v8.005h-36.735V1.294h8.738zM39.139 6.594c.732 0 1.327.59 1.327 1.318v3.956c0 .728.593 1.319 1.326 1.319h3.98c.733 0 1.327.59 1.327 1.319v4.615c0 .728-.594 1.318-1.326 1.319h-4.644c-.733 0-1.327-.59-1.327-1.319v-3.956c0-.728-.594-1.32-1.326-1.32h-9.952c-.732 0-1.326.592-1.326 1.32v9.89c0 .728.594 1.319 1.326 1.319H39.14c.732 0 1.327.59 1.327 1.318v3.956c0 .729.593 1.319 1.326 1.319h3.98c.733 0 1.327.59 1.327 1.32v11.207c0 .728-.594 1.32-1.326 1.32h-3.981c-.733 0-1.326.59-1.326 1.318v3.956c0 .728-.595 1.318-1.327 1.318H27.86c-.732 0-1.327-.59-1.327-1.318v-3.956c0-.728-.593-1.319-1.326-1.319h-3.98a1.323 1.323 0 0 1-1.327-1.319V40.88c0-.728.594-1.318 1.326-1.319h4.644c.733 0 1.327.59 1.327 1.319v3.956c0 .728.594 1.32 1.326 1.32h9.952c.732 0 1.326-.592 1.326-1.32v-9.89c0-.728-.594-1.319-1.326-1.319H27.86c-.732 0-1.327-.59-1.327-1.318v-3.956c0-.729-.593-1.319-1.326-1.319h-3.98a1.323 1.323 0 0 1-1.327-1.32V14.507c0-.728.594-1.32 1.326-1.32h3.981c.733 0 1.326-.59 1.326-1.318V7.912c0-.728.595-1.318 1.327-1.318z" /></svg>);export const getLogoMarkSVG = (color: string) => `- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">- <path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"/>- <path d="M12 22V12"/>- <polyline points="3.29 7 12 12 20.71 7"/>- <path d="m7.5 4.27 9 5.15"/>+ <svg viewBox="0 0 505 455" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Logo">+ <path d="M155 45c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10H65c-5.523 0-10 4.477-10 10v225c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v35c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10H60c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10H10c-5.523 0-10-4.477-10-10V110c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V60c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V10c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10zm250-5c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v235c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-35c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10v-30c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V115c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10V65c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10V10c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10z" fill="${color}"/>+ <path d="M305 90c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v35c0 5.523-4.477 10-10 10h-35c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-75c-5.523 0-10 4.477-10 10v75c0 5.523 4.477 10 10 10h80c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h30c5.523 0 10 4.477 10 10v85c0 5.523-4.477 10-10 10h-30c-5.523 0-10 4.477-10 10v30c0 5.523-4.477 10-10 10h-85c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10v-35c0-5.523 4.477-10 10-10h35c5.523 0 10 4.477 10 10v30c0 5.523 4.477 10 10 10h75c5.523 0 10-4.477 10-10v-75c0-5.523-4.477-10-10-10h-80c-5.523 0-10-4.477-10-10v-30c0-5.523-4.477-10-10-10h-30c-5.523 0-10-4.477-10-10v-85c0-5.523 4.477-10 10-10h30c5.523 0 10-4.477 10-10V60c0-5.523 4.477-10 10-10h85c5.523 0 10 4.477 10 10z" fill="${color}"/></svg>`;export const getLogoTypeSVG = (color: string) => `- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 24" fill="none">- <text x="0" y="18" font-family="system-ui, sans-serif" font-size="18" font-weight="600" fill="${color}">pdfcn</text>+ <svg viewBox="0 0 554 60" fill="none" xmlns="http://www.w3.org/2000/svg" aria-label="Logo">+ <path d="M19.237 0c.733 0 1.327.59 1.328 1.318v4.616c0 .728-.595 1.319-1.328 1.319h-3.98c-.732 0-1.326.59-1.326 1.318v3.956c0 .729-.595 1.319-1.327 1.319h-3.98c-.733 0-1.327.59-1.327 1.319v29.67c0 .728.594 1.32 1.327 1.32h3.98c.732 0 1.327.59 1.327 1.318v3.956c0 .728.594 1.318 1.327 1.318h3.98c.732 0 1.326.591 1.326 1.32v4.615c0 .728-.594 1.318-1.327 1.318h-4.643c-.733 0-1.326-.59-1.326-1.318v-3.956c0-.729-.595-1.32-1.328-1.32H7.96c-.733 0-1.326-.59-1.326-1.318v-3.956c0-.728-.595-1.319-1.327-1.319h-3.98A1.324 1.324 0 0 1 0 45.494V14.506c0-.728.594-1.32 1.327-1.32h3.98c.732 0 1.327-.59 1.327-1.318V7.912c0-.728.593-1.318 1.326-1.318h3.98c.733 0 1.328-.591 1.328-1.32V1.318A1.32 1.32 0 0 1 14.594 0zm33.169 0c.733 0 1.326.59 1.326 1.318v3.956c0 .729.595 1.32 1.328 1.32h3.98c.733 0 1.326.59 1.326 1.318v3.956c0 .728.595 1.319 1.327 1.319h3.98c.733 0 1.327.59 1.327 1.319v30.988c0 .728-.594 1.32-1.327 1.32h-3.98c-.732 0-1.327.59-1.327 1.318v3.956c0 .728-.593 1.318-1.326 1.318h-3.98c-.733 0-1.328.591-1.328 1.32v3.956c0 .728-.593 1.318-1.326 1.318h-4.643c-.733 0-1.327-.59-1.328-1.318v-4.616c0-.728.595-1.319 1.328-1.319h3.98c.732 0 1.326-.59 1.326-1.318v-3.956c0-.729.595-1.319 1.328-1.319h3.979c.733 0 1.327-.59 1.327-1.319v-29.67c0-.728-.594-1.32-1.327-1.32h-3.98c-.732 0-1.327-.59-1.327-1.318V8.571c0-.728-.594-1.318-1.327-1.318h-3.98a1.324 1.324 0 0 1-1.327-1.32V1.319A1.324 1.324 0 0 1 47.764 0zm65.713 0q6.554 0 11.166 2.426 4.693 2.425 7.363 6.63 2.751 4.206 3.399 9.624l-8.982.484q-.404-3.315-2.023-5.821a10.7 10.7 0 0 0-4.369-3.963q-2.751-1.455-6.716-1.455-5.016 0-7.93 2.345-2.832 2.263-2.832 6.064 0 2.426 1.133 4.124 1.214 1.617 4.208 2.83 3.075 1.214 8.657 2.588 7.444 1.698 11.814 4.205 4.45 2.426 6.311 5.741 1.862 3.316 1.862 7.52 0 5.096-2.67 8.895-2.59 3.72-7.283 5.741Q126.534 60 120.304 60q-6.877 0-11.976-2.507-5.017-2.506-7.93-6.954Q97.486 46.092 97 40.19l8.981-.566q.567 4.042 2.347 6.873 1.78 2.75 4.775 4.205 3.074 1.374 7.362 1.374 3.722 0 6.311-.89 2.67-.97 4.046-2.83t1.376-4.528q0-2.425-1.214-4.285-1.132-1.941-4.45-3.477-3.236-1.618-9.548-3.154-6.877-1.698-11.005-3.72-4.126-2.021-5.987-5.013-1.78-3.074-1.78-7.52 0-4.934 2.347-8.652 2.428-3.801 6.877-5.903Q111.889 0 118.119 0" fill="${color}"/>+ <path fillRule="evenodd" clipRule="evenodd" d="M209.126 14.717q8.74 0 13.27 4.69 4.612 4.61 4.612 13.019v16.738q0 1.536.486 2.184.567.566 1.779.566h1.539v6.792q-.405.081-1.295.162t-1.862.081q-2.751 0-4.773-.89-1.942-.889-2.913-2.91-.59-1.28-.823-3.067a10.7 10.7 0 0 1-2.09 2.904q-2.105 2.184-5.421 3.478-3.237 1.213-7.04 1.213-6.717 0-10.762-3.074-3.965-3.072-3.965-8.652t3.318-8.652q3.398-3.154 10.438-4.529l14.808-2.83q0-5.013-2.347-7.439-2.346-2.507-6.959-2.507-4.126 0-6.474 1.86-2.346 1.78-3.236 5.337l-8.819-.566q1.213-6.468 5.987-10.189 4.855-3.72 12.542-3.72m-3.317 26.119q-3.884.728-5.502 2.345-1.538 1.536-1.538 3.962 0 2.748 1.861 4.286 1.942 1.455 5.341 1.455 3.883 0 6.634-1.455 2.751-1.537 4.289-4.205t1.538-6.065V38.41zm66.559 17.871h-8.01l-.243-6.469q-1.78 3.477-5.421 5.5-3.56 1.94-8.091 1.94-5.503 0-9.629-2.75-4.046-2.749-6.231-7.763-2.103-5.095-2.103-11.968t2.184-11.886q2.186-5.094 6.231-7.844 4.046-2.75 9.548-2.75 4.45 0 7.929 1.861t5.26 5.175V1.294h8.576zm-19.5-36.55q-5.178 0-8.253 4.043-3.075 3.963-3.075 10.997 0 6.955 3.075 10.998t8.253 4.043q3.48 0 5.906-1.779 2.428-1.778 3.723-5.175t1.295-8.087q0-4.852-1.295-8.167-1.295-3.395-3.723-5.093-2.427-1.78-5.906-1.78" fill="${color}"/>+ <path d="M299.041 14.717q5.26 0 9.305 1.86 4.127 1.779 6.635 5.256 2.589 3.477 3.318 8.49l-8.982.486q-.647-4.205-3.398-6.388-2.751-2.265-6.878-2.265-5.421 0-8.496 4.043-2.994 3.963-2.994 10.997 0 7.035 2.994 11.08 3.075 3.96 8.496 3.961 4.127 0 6.878-2.264 2.751-2.345 3.398-7.035l8.982.485q-.729 4.932-3.318 8.571-2.508 3.64-6.635 5.661-4.046 2.022-9.305 2.022-6.15 0-10.762-2.75t-7.121-7.843q-2.508-5.095-2.508-11.888 0-6.792 2.508-11.805 2.509-5.095 7.121-7.844 4.612-2.83 10.762-2.83" fill="${color}"/>+ <path fillRule="evenodd" clipRule="evenodd" d="M447.657 14.717q8.74 0 13.271 4.69 4.612 4.61 4.612 13.019v16.738q0 1.536.485 2.184.567.566 1.781.566h1.537v6.792q-.405.081-1.295.162t-1.86.081q-2.752 0-4.775-.89-1.942-.889-2.913-2.91-.59-1.28-.821-3.067a10.7 10.7 0 0 1-2.092 2.904q-2.104 2.184-5.421 3.478-3.237 1.213-7.04 1.213-6.716 0-10.762-3.074-3.965-3.072-3.965-8.652t3.318-8.652q3.398-3.154 10.438-4.529l14.808-2.83q0-5.013-2.347-7.439-2.346-2.507-6.959-2.507-4.126 0-6.472 1.86-2.347 1.78-3.238 5.337l-8.819-.566q1.214-6.468 5.987-10.189 4.856-3.72 12.542-3.72m-3.317 26.119q-3.883.728-5.502 2.345-1.537 1.536-1.537 3.962 0 2.748 1.86 4.286 1.942 1.455 5.341 1.455 3.884 0 6.635-1.455 2.751-1.537 4.289-4.205t1.537-6.065V38.41zm37.999-19.083q1.7-2.83 5.016-4.933 3.399-2.102 7.849-2.102 5.583 0 9.71 2.749 4.126 2.749 6.312 7.844 2.265 5.013 2.265 11.886t-2.265 11.968q-2.185 5.013-6.312 7.763t-9.71 2.75q-4.45 0-7.93-1.94a13.94 13.94 0 0 1-5.258-5.5l-.244 6.47h-8.01V1.293h8.577zm11.571.404q-3.64 0-6.23 1.78-2.59 1.779-3.965 5.174-1.376 3.316-1.376 8.086 0 4.61 1.376 8.006t3.965 5.256q2.59 1.78 6.149 1.78 4.935 0 7.849-3.963 2.913-4.043 2.913-11.079 0-7.035-2.913-10.997-2.913-4.043-7.768-4.043" fill="${color}"/>+ <path d="M535.309 14.717q5.582 0 9.385 1.94 3.804 1.86 5.908 5.095 2.184 3.154 2.751 7.116l-8.82.486q-.405-2.265-1.618-3.882-1.133-1.698-3.075-2.588-1.942-.97-4.612-.97-4.126 0-6.15 1.617-2.022 1.617-2.022 4.205 0 1.94.889 3.154.972 1.212 3.076 2.021 2.103.728 5.583 1.294 6.715 1.132 10.518 2.83 3.803 1.617 5.341 4.043Q554 43.504 554 46.981q0 4.044-2.266 6.874t-6.23 4.366q-3.965 1.456-9.144 1.456-6.068 0-10.276-1.86-4.126-1.86-6.392-5.094-2.266-3.316-2.589-7.602l8.82-.404q.647 3.557 3.074 5.66 2.428 2.102 7.363 2.102 4.046.001 6.393-1.294t2.347-4.123q0-1.536-.81-2.587-.728-1.133-2.913-1.86-2.184-.81-6.473-1.537-6.392-1.213-10.034-2.83-3.64-1.617-5.178-4.124t-1.538-6.064q0-5.904 4.37-9.623 4.45-3.72 12.785-3.72m-378.704 7.175q.663-1.45 1.62-2.566a11.8 11.8 0 0 1 4.773-3.477q2.832-1.132 6.231-1.132 4.692 0 7.929 2.102 3.237 2.022 4.855 5.742 1.699 3.72 1.699 8.49v27.655h-8.576v-25.39q0-5.823-2.024-8.572-1.941-2.83-6.149-2.83-4.693 0-7.525 2.991-2.833 2.912-2.833 8.572v25.23h-8.576V1.293h8.576zm188.21-7.175q4.855 0 8.011 2.183 3.237 2.103 4.855 5.823 1.698 3.637 1.699 8.328v27.655h-8.577V33.64q0-3.8-.809-6.388t-2.671-3.963q-1.86-1.374-4.854-1.374-4.532 0-7.364 2.991t-2.832 8.734v25.067h-8.577V15.688h7.849l.209 7.412q.716-1.883 1.814-3.289 2.023-2.587 4.936-3.8 2.913-1.294 6.311-1.294m51.137 35.984h27.997v8.005h-36.735V1.294h8.738zM39.139 6.594c.732 0 1.327.59 1.327 1.318v3.956c0 .728.593 1.319 1.326 1.319h3.98c.733 0 1.327.59 1.327 1.319v4.615c0 .728-.594 1.318-1.326 1.319h-4.644c-.733 0-1.327-.59-1.327-1.319v-3.956c0-.728-.594-1.32-1.326-1.32h-9.952c-.732 0-1.326.592-1.326 1.32v9.89c0 .728.594 1.319 1.326 1.319H39.14c.732 0 1.327.59 1.327 1.318v3.956c0 .729.593 1.319 1.326 1.319h3.98c.733 0 1.327.59 1.327 1.32v11.207c0 .728-.594 1.32-1.326 1.32h-3.981c-.733 0-1.326.59-1.326 1.318v3.956c0 .728-.595 1.318-1.327 1.318H27.86c-.732 0-1.327-.59-1.327-1.318v-3.956c0-.728-.593-1.319-1.326-1.319h-3.98a1.323 1.323 0 0 1-1.327-1.319V40.88c0-.728.594-1.318 1.326-1.319h4.644c.733 0 1.327.59 1.327 1.319v3.956c0 .728.594 1.32 1.326 1.32h9.952c.732 0 1.326-.592 1.326-1.32v-9.89c0-.728-.594-1.319-1.326-1.319H27.86c-.732 0-1.327-.59-1.327-1.318v-3.956c0-.729-.593-1.319-1.326-1.319h-3.98a1.323 1.323 0 0 1-1.327-1.32V14.507c0-.728.594-1.32 1.326-1.32h3.981c.733 0 1.326-.59 1.326-1.318V7.912c0-.728.595-1.318 1.327-1.318z" fill="${color}"/></svg>`;diff --git a/components/mobile-nav.tsx b/components/mobile-nav.tsxindex cf9c3b5..d2bdb63 100644--- a/components/mobile-nav.tsx+++ b/components/mobile-nav.tsx@@ -15,7 +15,11 @@ import {import { TOP_LEVEL_SECTIONS } from "@/constants/nav";import { ROUTES } from "@/constants/routes";import { useFeedback } from "@/hooks/use-feedback";-import { getDocsSidebarPanel, isBlocksFolder, isComponentsFolder } from "@/lib/docs";+import {+ getDocsSidebarPanel,+ isBlocksFolder,+ isComponentsFolder,+} from "@/lib/docs";import {getAllPagesFromFolder,getCurrentBase,@@ -96,11 +100,7 @@ const findTopLevelFolder = ((item): item is PageTreeFolder => item.type === "folder" && predicate(item));-const ComponentsMobilePanel = ({- currentBase,- setOpen,- tree,-}: MobilePanelProps) => {+const ComponentsMobilePanel = ({ setOpen, tree }: MobilePanelProps) => {const folder = findTopLevelFolder(tree, isComponentsFolder);if (!folder) {return null;@@ -108,22 +108,12 @@ const ComponentsMobilePanel = ({const pages = getAllPagesFromFolder(folder).filter((page) => page.url !== ROUTES.DOCS_COMPONENTS)- .map((page) => ({ url: page.url, name: page.name }));+ .map((page) => ({ name: page.name, url: page.url }));- return (- <MobileNavGroup- label="Components"- pages={pages}- setOpen={setOpen}- />- );+ return <MobileNavGroup label="Components" pages={pages} setOpen={setOpen} />;};-const BlocksMobilePanel = ({- currentBase,- setOpen,- tree,-}: MobilePanelProps) => {+const BlocksMobilePanel = ({ setOpen, tree }: MobilePanelProps) => {const folder = findTopLevelFolder(tree, isBlocksFolder);if (!folder) {return null;@@ -131,15 +121,9 @@ const BlocksMobilePanel = ({const pages = getAllPagesFromFolder(folder).filter((page) => page.url !== ROUTES.DOCS_BLOCKS)- .map((page) => ({ url: page.url, name: page.name }));+ .map((page) => ({ name: page.name, url: page.url }));- return (- <MobileNavGroup- label="Blocks"- pages={pages}- setOpen={setOpen}- />- );+ return <MobileNavGroup label="Blocks" pages={pages} setOpen={setOpen} />;};export const MobileNav = ({diff --git a/components/pdf-preview.tsx b/components/pdf-preview.tsxindex d2bd8a1..070391d 100644--- a/components/pdf-preview.tsx+++ b/components/pdf-preview.tsx@@ -1,18 +1,16 @@"use client";-import { createElement, useEffect, useMemo, useRef, useState } from "react";-import { Document, Page, pdfjs } from "react-pdf";+import { createElement, useEffect, useRef, useState } from "react";+import { replacePreviewImageSources } from "@/examples/preview-assets";+import { getTakumiPreviewOptions } from "@/examples/preview-config";import { cn } from "@/lib/utils";import type { BaseName } from "@/registry/bases";-import "react-pdf/dist/Page/AnnotationLayer.css";-import "react-pdf/dist/Page/TextLayer.css";+const TAKUMI_WASM_PATH = "/takumi_pdf_wasm_bg.wasm";+const PREVIEW_LOGO_PATH = "/favicon.png";-pdfjs.GlobalWorkerOptions.workerSrc = new URL(- "pdfjs-dist/build/pdf.worker.min.mjs",- import.meta.url-).toString();+let takumiWasmReady: Promise<unknown> | undefined;interface PdfPreviewProps {base: BaseName;@@ -21,95 +19,135 @@ interface PdfPreviewProps {height?: number;}+const startTakumi = async (+ initialize: (input: { module_or_path: string }) => Promise<unknown>+) => {+ try {+ return await initialize({ module_or_path: TAKUMI_WASM_PATH });+ } catch (error) {+ takumiWasmReady = undefined;+ throw error;+ }+};++const initializeTakumi = (+ initialize: (input: { module_or_path: string }) => Promise<unknown>+) => {+ takumiWasmReady ??= startTakumi(initialize);+ return takumiWasmReady;+};++const loadPreviewLogo = async () => {+ const response = await fetch(PREVIEW_LOGO_PATH);+ if (!response.ok) {+ throw new Error(`Unable to load preview logo (${response.status})`);+ }++ return {+ sources: [+ {+ data: await response.arrayBuffer(),+ src: PREVIEW_LOGO_PATH,+ },+ ],+ };+};++const assertPdfHasPages = (pdfBytes: Uint8Array) => {+ const source = new TextDecoder("latin1").decode(pdfBytes);+ const pageCounts = [...source.matchAll(/\/Count\s+(\d+)/g)].map((match) =>+ Number(match[1])+ );+ if (pageCounts.length > 0 && Math.max(...pageCounts) === 0) {+ throw new Error("PDF renderer returned a document with no pages");+ }+};+export const PdfPreview = ({base,name,className,height = 640,}: PdfPreviewProps) => {- const [data, setData] = useState<Uint8Array | null>(null);+ const [pdfUrl, setPdfUrl] = useState<string | null>(null);const [error, setError] = useState<string | null>(null);- const [numPages, setNumPages] = useState(0);- const [page, setPage] = useState(1);- const [pageWidth, setPageWidth] = useState(560);const containerRef = useRef<HTMLDivElement>(null);- const file = useMemo(() => (data ? { data } : null), [data]);-- useEffect(() => {- const container = containerRef.current;- if (!container) {- return;- }-- const updateWidth = () => {- setPageWidth(Math.min(560, Math.max(240, container.clientWidth - 32)));- };- const observer = new ResizeObserver(updateWidth);- updateWidth();- observer.observe(container);-- return () => observer.disconnect();- }, []);useEffect(() => {let cancelled = false;- setData(null);+ let nextPdfUrl: string | undefined;+ setPdfUrl(null);setError(null);- setPage(1);(async () => {try {+ let pdfBytes: Uint8Array;+if (base === "takumi") {const [{ demos },{ default: initialize, render },- pdfWasmModule,- { googleFonts },{ fromJsx },+ images,] = await Promise.all([import("@/examples/__takumi__"),import("takumi-pdf"),- import("takumi-pdf/takumi_pdf_wasm_bg.wasm"),- import("@takumi-rs/helpers"),import("@takumi-rs/helpers/jsx"),+ loadPreviewLogo(),]);const Demo = demos[name];if (!Demo) {throw new Error(`Unknown Takumi demo: ${name}`);}++ await initializeTakumi(initialize);const { node, stylesheets } = await fromJsx(createElement(Demo));- const pdfWasm = (- pdfWasmModule as unknown as { default: string }- ).default;- await initialize({ module_or_path: pdfWasm });- const buf = await render(node, {- fonts: await googleFonts(["Inter", "Times New Roman"]),- margin: { bottom: 48, left: 48, right: 48, top: 48 },- size: "a4",+ const buffer = await render(node, {+ ...getTakumiPreviewOptions(name),+ images,stylesheets,});- if (!cancelled) {- setData(new Uint8Array(buf));+ pdfBytes = new Uint8Array(buffer);+ } else {+ const [{ demos }, { renderSerializedDoc }, { serialize }] =+ await Promise.all([+ import("@/examples/__forme__"),+ import("@formepdf/core/browser"),+ import("@formepdf/react"),+ ]);+ const Demo = demos[name];+ if (!Demo) {+ throw new Error(`Unknown Forme demo: ${name}`);}- return;- }- const [{ demos }, { renderDocument }] = await Promise.all([- import("@/examples/__forme__"),- import("@formepdf/core/browser"),- ]);- const Demo = demos[name];- if (!Demo) {- throw new Error(`Unknown Forme demo: ${name}`);+ // Serialize with the same @formepdf/react instance that created the+ // demo primitives. renderDocument() dynamically imports a second+ // serializer instance, whose strict Page identity check can drop all+ // pages when bundled by Next.js.+ const document = replacePreviewImageSources(+ serialize(createElement(Demo))+ );+ const buffer = await renderSerializedDoc(+ document as unknown as Record<string, unknown>+ );+ pdfBytes = new Uint8Array(buffer);}- const buf = await renderDocument(createElement(Demo));- if (!cancelled) {- setData(new Uint8Array(buf));++ assertPdfHasPages(pdfBytes);+ nextPdfUrl = URL.createObjectURL(+ new Blob([pdfBytes as BlobPart], { type: "application/pdf" })+ );+ if (cancelled) {+ URL.revokeObjectURL(nextPdfUrl);+ return;}- } catch (error) {+ setPdfUrl(nextPdfUrl);+ } catch (renderError) {if (!cancelled) {setError(- error instanceof Error ? error.message : "Failed to render PDF"+ renderError instanceof Error+ ? renderError.message+ : "Failed to render PDF");}}@@ -117,6 +155,9 @@ export const PdfPreview = ({return () => {cancelled = true;+ if (nextPdfUrl) {+ URL.revokeObjectURL(nextPdfUrl);+ }};}, [base, name]);@@ -126,51 +167,30 @@ export const PdfPreview = ({className={cn("overflow-hidden rounded-lg border bg-muted/30", className)}style={{ minHeight: height }}>- {error && (- <div className="flex h-full items-center justify-center p-8 text-sm text-muted-foreground">+ {error ? (+ <div+ className="flex items-center justify-center p-8 text-sm text-muted-foreground"+ style={{ minHeight: height }}+ >{error}</div>- )}- {!error && !data && (- <div className="flex h-full items-center justify-center p-8 text-sm text-muted-foreground">+ ) : null}+ {!error && !pdfUrl ? (+ <div+ className="flex items-center justify-center p-8 text-sm text-muted-foreground"+ style={{ minHeight: height }}+ >Rendering PDF…</div>- )}- {file && (- <div className="flex flex-col items-center gap-3 p-4">- <Document- file={file}- onLoadError={(loadError) => setError(loadError.message)}- onLoadSuccess={({ numPages: n }) => setNumPages(n)}- loading={null}- >- <Page pageNumber={page} width={pageWidth} />- </Document>- {numPages > 1 && (- <div className="flex items-center gap-3 text-sm">- <button- type="button"- className="rounded border px-2 py-1 disabled:opacity-40"- disabled={page <= 1}- onClick={() => setPage((p) => Math.max(1, p - 1))}- >- Prev- </button>- <span>- {page} / {numPages}- </span>- <button- type="button"- className="rounded border px-2 py-1 disabled:opacity-40"- disabled={page >= numPages}- onClick={() => setPage((p) => Math.min(numPages, p + 1))}- >- Next- </button>- </div>- )}- </div>- )}+ ) : null}+ {pdfUrl ? (+ <iframe+ className="block w-full bg-background"+ src={`${pdfUrl}#toolbar=1&navpanes=0`}+ style={{ height }}+ title={`${name} PDF preview`}+ />+ ) : null}</div>);};diff --git a/components/playground/evaluate.ts b/components/playground/evaluate.tsindex 23dd808..0821320 100644--- a/components/playground/evaluate.ts+++ b/components/playground/evaluate.ts@@ -1,6 +1,7 @@import * as React from "react";import { transform } from "sucrase";import * as z from "zod/mini";+import { optionsSchema } from "./schema";const exportsSchema = z.object({@@ -10,8 +11,8 @@ const exportsSchema = z.object({function transformCode(code: string) {return transform(code, {- transforms: ["jsx", "typescript", "imports"],production: true,+ transforms: ["jsx", "typescript", "imports"],}).code;}@@ -22,9 +23,14 @@ export function evaluateCodeExports(code: string, react: typeof React) {}function mirrorTw<P>(props: P): P {- if (!props || typeof props !== "object" || !("tw" in props)) return props;+ if (!props || typeof props !== "object" || !("tw" in props)) {+ return props;+ }const { tw, className, class: klass } = props as Record<string, unknown>;- return { ...props, className: [className ?? klass, tw].filter(Boolean).join(" ") };+ return {+ ...props,+ className: [className ?? klass, tw].filter(Boolean).join(" "),+ };}export const renderReact: typeof React = {@@ -33,5 +39,10 @@ export const renderReact: typeof React = {type: React.ElementType,props: Record<string, unknown> | null,...children: React.ReactNode[]- ) => React.createElement(type, mirrorTw(props), ...children)) as typeof React.createElement,+ ) =>+ React.createElement(+ type,+ mirrorTw(props),+ ...children+ )) as typeof React.createElement,};diff --git a/components/playground/geometry.ts b/components/playground/geometry.tsindex 6b64199..5dd9d21 100644--- a/components/playground/geometry.ts+++ b/components/playground/geometry.ts@@ -1,41 +1,48 @@const PX_PER_MM = 96 / 25.4;const PAGE_SIZES = {- a4: { width: 210 * PX_PER_MM, height: 297 * PX_PER_MM },- letter: { width: 8.5 * 96, height: 11 * 96 },+ a4: { height: 297 * PX_PER_MM, width: 210 * PX_PER_MM },+ letter: { height: 11 * 96, width: 8.5 * 96 },};const DEFAULT_PAGE_MARGIN = 48;type PdfOptions = NonNullable<PlaygroundOptions["pdf"]>;-export type OutputGeometry = {+export interface OutputGeometry {width: number;height?: number;padding?: string;label: string;-};+}function marginPadding(margin: PdfOptions["margin"]): string {- if (margin === undefined) return `${DEFAULT_PAGE_MARGIN}px`;- if (typeof margin === "number") return `${margin}px`;+ if (margin === undefined) {+ return `${DEFAULT_PAGE_MARGIN}px`;+ }+ if (typeof margin === "number") {+ return `${margin}px`;+ }const { top = 0, right = 0, bottom = 0, left = 0 } = margin;return `${top}px ${right}px ${bottom}px ${left}px`;}function pdfGeometry(pdf: PdfOptions): OutputGeometry {- const size = typeof pdf.size === "object" ? pdf.size : PAGE_SIZES[pdf.size ?? "a4"];+ const size =+ typeof pdf.size === "object" ? pdf.size : PAGE_SIZES[pdf.size ?? "a4"];const preset = typeof pdf.size === "object" ? undefined : (pdf.size ?? "a4");const width = Math.round(pdf.landscape ? size.height : size.width);const height = Math.round(pdf.landscape ? size.width : size.height);const name = preset ? preset.toUpperCase() : `${width} × ${height}`;return {- width,label: pdf.landscape ? `${name} landscape` : name,padding: marginPadding(pdf.margin),+ width,};}export function outputGeometry(options: PlaygroundOptions): OutputGeometry {- if (options.pdf) return pdfGeometry(options.pdf);+ if (options.pdf) {+ return pdfGeometry(options.pdf);+ }const { width = 1200, height = 630 } = options;- return { width, height, label: `${width} × ${height}` };+ return { height, label: `${width} × ${height}`, width };}diff --git a/components/playground/inspect-pdf.ts b/components/playground/inspect-pdf.tsindex 2ead275..01bada8 100644--- a/components/playground/inspect-pdf.ts+++ b/components/playground/inspect-pdf.ts@@ -1,4 +1,4 @@-export type PdfInspection = {+export interface PdfInspection {pages: number;standards: string[];tagged: boolean;@@ -7,35 +7,45 @@ export type PdfInspection = {created?: string;bookmarks: Bookmark[];attachments: { name: string; description?: string }[];-};+}-type Bookmark = { title: string; depth: number };+interface Bookmark {+ title: string;+ depth: number;+}function bytesToChars(bytes: Uint8Array): string {let text = "";- for (let offset = 0; offset < bytes.length; offset += 0x8000) {- text += String.fromCharCode(...bytes.subarray(offset, offset + 0x8000));+ for (let offset = 0; offset < bytes.length; offset += 0x80_00) {+ text += String.fromCodePoint(...bytes.subarray(offset, offset + 0x80_00));}return text;}function utf8(value: string | undefined): string | undefined {- return value && new TextDecoder().decode(Uint8Array.from(value, (char) => char.charCodeAt(0)));+ return (+ value &&+ new TextDecoder().decode(+ Uint8Array.from(value, (char) => char.codePointAt(0) ?? 0)+ )+ );}function pdfString(raw: string): string {if (raw.startsWith("<")) {- const hex = raw.slice(1, -1).replace(/\s/g, "");+ const hex = raw.slice(1, -1).replaceAll(/\s/g, "");const text = (hex.match(/.{4}/g) ?? [])- .map((unit) => String.fromCharCode(Number.parseInt(unit, 16)))+ .map((unit) => String.fromCodePoint(Number.parseInt(unit, 16))).join("");return text.replace(/^/, "");}- return raw.slice(1, -1).replace(/\\([()\\])/g, "$1");+ return raw.slice(1, -1).replaceAll(/\\([()\\])/g, "$1");}function entry(object: string, key: string): string | undefined {- const match = object.match(new RegExp(`/${key}\\s*(\\([^)]*\\)|<[0-9A-Fa-f\\s]*>)`));+ const match = object.match(+ new RegExp(`/${key}\\s*(\\([^)]*\\)|<[0-9A-Fa-f\\s]*>)`)+ );return match?.[1] && pdfString(match[1]);}@@ -43,17 +53,21 @@ function readBookmarks(objects: string[]): Bookmark[] {const byNumber = new Map<string, string>();for (const object of objects) {const number = object.match(/(\d+)\s+0\s+obj/)?.[1];- if (number) byNumber.set(number, object);+ if (number) {+ byNumber.set(number, object);+ }}const followRef = (object: string | undefined, key: string) => {- const number = object?.match(new RegExp(`/${key}\\s+(\\d+)\\s+0\\s+R`))?.[1];+ const number = object?.match(+ new RegExp(`/${key}\\s+(\\d+)\\s+0\\s+R`)+ )?.[1];return number === undefined ? undefined : byNumber.get(number);};const bookmarks: Bookmark[] = [];const walk = (first: string | undefined, depth: number) => {let node = first;while (node && bookmarks.length < 500) {- bookmarks.push({ title: entry(node, "Title") ?? "", depth });+ bookmarks.push({ depth, title: entry(node, "Title") ?? "" });walk(followRef(node, "First"), depth + 1);node = followRef(node, "Next");}@@ -61,9 +75,9 @@ function readBookmarks(objects: string[]): Bookmark[] {walk(followRef(objects.find((object) => /\/Type\s*\/Outlines/.test(object)),- "First",+ "First"),- 0,+ 0);return bookmarks.filter((bookmark) => bookmark.title);}@@ -72,27 +86,32 @@ export function inspectPdf(bytes: Uint8Array): PdfInspection {const text = bytesToChars(bytes);const objects = text.split("endobj");const xmp = text.match(/<x:xmpmeta[\s\S]*?<\/x:xmpmeta>/)?.[0] ?? "";- const xmpValue = (tag: string) => xmp.match(new RegExp(`<${tag}>([^<]*)<`))?.[1];+ const xmpValue = (tag: string) =>+ xmp.match(new RegExp(`<${tag}>([^<]*)<`))?.[1];const archival = xmpValue("pdfaid:part");const accessible = xmpValue("pdfuaid:part");const standards = [- archival && `PDF/A-${archival}${(xmpValue("pdfaid:conformance") ?? "").toLowerCase()}`,+ archival &&+ `PDF/A-${archival}${(xmpValue("pdfaid:conformance") ?? "").toLowerCase()}`,accessible && `PDF/UA-${accessible}`,].filter((standard): standard is string => Boolean(standard));const authors = [...xmp.matchAll(/<dc:creator>[\s\S]*?<\/dc:creator>/g)].flatMap((match) => [...match[0].matchAll(/<rdf:li>([^<]*)</g)]).map((match) => utf8(match[1]));return {+ attachments: objects+ .filter((object) => object.includes("/Filespec"))+ .map((object) => ({+ name: entry(object, "F") ?? "",+ description: entry(object, "Desc"),+ }))+ .filter((attachment) => attachment.name),+ authors: authors.length > 0 ? (authors as string[]) : undefined,+ bookmarks: readBookmarks(objects),+ created: xmpValue("xmp:CreateDate")?.slice(0, 10),pages: text.match(/\/Type\s*\/Page[^s]/g)?.length ?? 0,standards,tagged: text.includes("/StructTreeRoot"),title: utf8(xmp.match(/<dc:title>[\s\S]*?<rdf:li[^>]*>([^<]*)</)?.[1]),- authors: authors.length > 0 ? (authors as string[]) : undefined,- created: xmpValue("xmp:CreateDate")?.slice(0, 10),- bookmarks: readBookmarks(objects),- attachments: objects- .filter((object) => object.includes("/Filespec"))- .map((object) => ({ name: entry(object, "F") ?? "", description: entry(object, "Desc") }))- .filter((attachment) => attachment.name),};}diff --git a/components/playground/options.ts b/components/playground/options.tsindex ac794d6..ca79084 100644--- a/components/playground/options.ts+++ b/components/playground/options.ts@@ -1,6 +1,8 @@import type { RenderOptions } from "takumi-pdf";-type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;+type DistributiveOmit<T, K extends PropertyKey> = T extends unknown+ ? Omit<T, K>+ : never;export type PlaygroundPdfOptions = DistributiveOmit<RenderOptions,@@ -8,7 +10,7 @@ export type PlaygroundPdfOptions = DistributiveOmit<>;declare global {- type PlaygroundOptions = {+ interface PlaygroundOptions {width?: number;height?: number;format?: "png" | "jpeg" | "webp";@@ -16,5 +18,5 @@ declare global {devicePixelRatio?: number;stylesheets?: string[];pdf?: PlaygroundPdfOptions;- };+ }}diff --git a/components/playground/output-panel.tsx b/components/playground/output-panel.tsxindex e238fbf..31382f5 100644--- a/components/playground/output-panel.tsx+++ b/components/playground/output-panel.tsx@@ -1,12 +1,22 @@"use client";import type { ReactNode } from "react";++import { cn } from "@/lib/utils";+import type { PdfInspection } from "./inspect-pdf";import type { RenderError, RenderSuccess } from "./use-render-worker";-import { cn } from "@/lib/utils";-function PdfPreview({ url, dimmed }: { url: string | undefined; dimmed: boolean }) {- if (!url) return null;+function PdfPreview({+ url,+ dimmed,+}: {+ url: string | undefined;+ dimmed: boolean;+}) {+ if (!url) {+ return null;+ }return (<objectdata={url}@@ -37,7 +47,9 @@ function DocumentPanel({ inspection }: { inspection: PdfInspection }) {<div className="h-full overflow-auto bg-muted/20 px-4 py-3 font-mono text-xs"><Field label="Standards">{inspection.standards.length > 0 ? (- <span className="text-primary">{inspection.standards.join(" · ")}</span>+ <span className="text-primary">+ {inspection.standards.join(" · ")}+ </span>) : (<span className="text-muted-foreground">plain PDF</span>)}@@ -45,8 +57,12 @@ function DocumentPanel({ inspection }: { inspection: PdfInspection }) {<Field label="Tagged">{inspection.tagged ? "yes" : "no"}</Field><Field label="Pages">{inspection.pages}</Field>{inspection.title && <Field label="Title">{inspection.title}</Field>}- {inspection.authors && <Field label="Authors">{inspection.authors.join(", ")}</Field>}- {inspection.created && <Field label="Created">{inspection.created}</Field>}+ {inspection.authors && (+ <Field label="Authors">{inspection.authors.join(", ")}</Field>+ )}+ {inspection.created && (+ <Field label="Created">{inspection.created}</Field>+ )}<Field label="Bookmarks">{inspection.bookmarks.length === 0 ? (<span className="text-muted-foreground">none</span>@@ -70,7 +86,10 @@ function DocumentPanel({ inspection }: { inspection: PdfInspection }) {<div key={attachment.name} className="truncate">{attachment.name}{attachment.description && (- <span className="text-muted-foreground"> — {attachment.description}</span>+ <span className="text-muted-foreground">+ {" "}+ — {attachment.description}+ </span>)}</div>))@@ -102,7 +121,11 @@ export function OutputPanel({);}- if (lastSuccess?.outputKind === "pdf" && pdfView === "document" && lastSuccess.inspection) {+ if (+ lastSuccess?.outputKind === "pdf" &&+ pdfView === "document" &&+ lastSuccess.inspection+ ) {return <DocumentPanel inspection={lastSuccess.inspection} />;}@@ -114,7 +137,10 @@ export function OutputPanel({<imgsrc={lastSuccess.outputUrl}alt="Rendered output"- className={cn("border max-h-full max-w-full object-contain", error && "opacity-40")}+ className={cn(+ "border max-h-full max-w-full object-contain",+ error && "opacity-40"+ )}/>));@@ -123,7 +149,9 @@ export function OutputPanel({{lastSuccess?.outputKind === "pdf" ? (<div className="absolute inset-0">{output}</div>) : (- <div className="absolute inset-0 flex items-center justify-center">{output}</div>+ <div className="absolute inset-0 flex items-center justify-center">+ {output}+ </div>)}{error && (<div className="absolute inset-x-0 bottom-0 border-t bg-background/95 px-3 py-2 font-mono text-xs">diff --git a/components/playground/schema.ts b/components/playground/schema.tsindex 1b36b59..fde917b 100644--- a/components/playground/schema.ts+++ b/components/playground/schema.ts@@ -1,14 +1,19 @@import * as z from "zod/mini";+import type { PdfInspection } from "./inspect-pdf";export const optionsSchema = z.object({- width: z.optional(z.int().check(z.positive(), z.minimum(1))),- height: z.optional(z.int().check(z.positive(), z.minimum(1))),- quality: z.optional(z.int().check(z.positive(), z.minimum(1), z.maximum(100))),+ devicePixelRatio: z.optional(+ z.number().check(z.positive(), z.minimum(0.1), z.maximum(10))+ ),format: z.optional(z.enum(["png", "jpeg", "webp"])),- devicePixelRatio: z.optional(z.number().check(z.positive(), z.minimum(0.1), z.maximum(10.0))),- stylesheets: z.optional(z.array(z.string())),+ height: z.optional(z.int().check(z.positive(), z.minimum(1))),pdf: z.optional(z.custom<Record<string, unknown>>()),+ quality: z.optional(+ z.int().check(z.positive(), z.minimum(1), z.maximum(100))+ ),+ stylesheets: z.optional(z.array(z.string())),+ width: z.optional(z.int().check(z.positive(), z.minimum(1))),});export const outputKinds = ["image", "pdf"] as const;@@ -16,32 +21,35 @@ export const outputKinds = ["image", "pdf"] as const;export type OutputKind = (typeof outputKinds)[number];const renderSuccessSchema = z.object({- status: z.literal("success"),+ duration: z.number(),id: z.int().check(z.positive(), z.minimum(1)),+ inspection: z.optional(z.custom<PdfInspection>()),+ label: z.string(),outputBuffer: z.any(),- outputUrl: z.optional(z.string()),- duration: z.number(),- outputKind: z.enum(outputKinds),outputFormat: z.string(),- label: z.string(),- inspection: z.optional(z.custom<PdfInspection>()),+ outputKind: z.enum(outputKinds),+ outputUrl: z.optional(z.string()),+ status: z.literal("success"),});const renderErrorSchema = z.object({- status: z.literal("error"),id: z.int().check(z.positive(), z.minimum(1)),message: z.string(),+ status: z.literal("error"),});const renderRequestSchema = z.object({- type: z.literal("render-request"),- id: z.int().check(z.positive(), z.minimum(1)),code: z.string(),+ id: z.int().check(z.positive(), z.minimum(1)),+ type: z.literal("render-request"),});export const renderResultSchema = z.object({+ result: z.discriminatedUnion("status", [+ renderSuccessSchema,+ renderErrorSchema,+ ]),type: z.literal("render-result"),- result: z.discriminatedUnion("status", [renderSuccessSchema, renderErrorSchema]),});const readySchema = z.object({@@ -49,13 +57,13 @@ const readySchema = z.object({});const previewResultSchema = z.object({- type: z.literal("preview-result"),- id: z.int().check(z.positive(), z.minimum(1)),- html: z.string(),- width: z.optional(z.int().check(z.positive(), z.minimum(1))),+ cssContents: z.optional(z.array(z.string())),height: z.optional(z.int().check(z.positive(), z.minimum(1))),+ html: z.string(),+ id: z.int().check(z.positive(), z.minimum(1)),padding: z.optional(z.string()),- cssContents: z.optional(z.array(z.string())),+ type: z.literal("preview-result"),+ width: z.optional(z.int().check(z.positive(), z.minimum(1))),});export const messageSchema = z.discriminatedUnion("type", [diff --git a/components/playground/takumi-preview.tsx b/components/playground/takumi-preview.tsxindex cdf778f..ab9c6a2 100644--- a/components/playground/takumi-preview.tsx+++ b/components/playground/takumi-preview.tsx@@ -1,9 +1,12 @@"use client";import { useState } from "react";+import { cn } from "@/lib/utils";++import { OutputPanel } from "./output-panel";+import type { PdfView } from "./output-panel";import { useRenderWorker } from "./use-render-worker";-import { OutputPanel, type PdfView } from "./output-panel";interface TakumiPreviewProps {code: string;@@ -11,7 +14,11 @@ interface TakumiPreviewProps {height?: number;}-export function TakumiPreview({ code, className, height = 640 }: TakumiPreviewProps) {+export function TakumiPreview({+ code,+ className,+ height = 640,+}: TakumiPreviewProps) {const [pdfView, setPdfView] = useState<PdfView>("preview");const { isReady, lastSuccess, renderError } = useRenderWorker(code);diff --git a/components/playground/use-render-worker.ts b/components/playground/use-render-worker.tsindex a9445be..4d91fbf 100644--- a/components/playground/use-render-worker.ts+++ b/components/playground/use-render-worker.ts@@ -2,14 +2,14 @@import { useEffect, useRef, useState } from "react";import type { z } from "zod/mini";-import {- messageSchema,- type RenderMessageInput,- type renderResultSchema,-} from "./schema";++import { messageSchema } from "./schema";+import type { RenderMessageInput, renderResultSchema } from "./schema";export type RenderResult = z.infer<typeof renderResultSchema>["result"];-export type RenderSuccess = Extract<RenderResult, { status: "success" }> & { outputSize: number };+export type RenderSuccess = Extract<RenderResult, { status: "success" }> & {+ outputSize: number;+};export type RenderError = Extract<RenderResult, { status: "error" }>;function isBlobUrl(url: string | undefined): url is string {@@ -17,7 +17,9 @@ function isBlobUrl(url: string | undefined): url is string {}function mimeType(result: RenderResult & { status: "success" }) {- return result.outputKind === "pdf" ? "application/pdf" : `image/${result.outputFormat}`;+ return result.outputKind === "pdf"+ ? "application/pdf"+ : `image/${result.outputFormat}`;}export function useRenderWorker(ranCode: string | undefined) {@@ -25,13 +27,12 @@ export function useRenderWorker(ranCode: string | undefined) {const [lastSuccess, setLastSuccess] = useState<RenderSuccess>();const [renderError, setRenderError] = useState<RenderError>();const currentRequestIdRef = useRef(0);- const workerRef = useRef<Worker | undefined>(undefined);+ const workerRef = useRef<Worker | null>(null);useEffect(() => {- const worker = new Worker(- new URL("./worker.ts", import.meta.url),- { type: "module" }- );+ const worker = new Worker(new URL("worker.ts", import.meta.url), {+ type: "module",+ });worker.onmessage = (event: MessageEvent) => {const message = messageSchema.parse(event.data);@@ -49,14 +50,18 @@ export function useRenderWorker(ranCode: string | undefined) {}case "render-result": {const { result } = message;- if (result.id !== currentRequestIdRef.current) break;+ if (result.id !== currentRequestIdRef.current) {+ break;+ }if (result.status === "success") {- const blob = new Blob([result.outputBuffer as BlobPart], { type: mimeType(result) });+ const blob = new Blob([result.outputBuffer as BlobPart], {+ type: mimeType(result),+ });setLastSuccess({...result,- outputUrl: URL.createObjectURL(blob),outputSize: blob.size,+ outputUrl: URL.createObjectURL(blob),});setRenderError(undefined);} else {@@ -74,25 +79,29 @@ export function useRenderWorker(ranCode: string | undefined) {return () => {worker.terminate();- workerRef.current = undefined;+ workerRef.current = null;setIsReady(false);};}, []);useEffect(() => {- if (!isReady || ranCode === undefined) return;+ if (!isReady || ranCode === undefined) {+ return;+ }const requestId = currentRequestIdRef.current + 1;currentRequestIdRef.current = requestId;workerRef.current?.postMessage({- type: "render-request",- id: requestId,code: ranCode,+ id: requestId,+ type: "render-request",} satisfies RenderMessageInput);}, [isReady, ranCode]);useEffect(() => {- if (!isBlobUrl(lastSuccess?.outputUrl)) return;+ if (!isBlobUrl(lastSuccess?.outputUrl)) {+ return;+ }const url = lastSuccess.outputUrl;return () => URL.revokeObjectURL(url);}, [lastSuccess]);diff --git a/components/playground/worker.ts b/components/playground/worker.tsindex ba2d041..fe8f343 100644--- a/components/playground/worker.ts+++ b/components/playground/worker.ts@@ -1,55 +1,84 @@-import initPdf, { render, type PageSize } from "takumi-pdf";-import { googleFonts } from "@takumi-rs/helpers";import type * as React from "react";import { renderToStaticMarkup } from "react-dom/server";+import initPdf, { render } from "takumi-pdf";+import type { PageSize } from "takumi-pdf";+import { evaluateCodeExports, renderReact } from "./evaluate";import { outputGeometry } from "./geometry";import { inspectPdf } from "./inspect-pdf";-import { messageSchema, type RenderMessageInput } from "./schema";+import { messageSchema } from "./schema";+import type { RenderMessageInput } from "./schema";function postMessage(message: RenderMessageInput, transfer?: Transferable[]) {return self.postMessage(message, { transfer });}-const GOOGLE_FONT_NAMES = ["Inter", "Times New Roman"];+const TAKUMI_WASM_URL = new URL(+ "/takumi_pdf_wasm_bg.wasm",+ self.location.origin+);+const PREVIEW_LOGO_PATH = "/favicon.png";-let fontsReady: ReturnType<typeof googleFonts> | undefined;+let imagesReady:+ | Promise<{+ sources: { data: ArrayBuffer; src: string }[];+ }>+ | undefined;let wasmReady: Promise<unknown> | undefined;-function getFonts() {- fontsReady ??= googleFonts(GOOGLE_FONT_NAMES);- return fontsReady;+async function loadImages() {+ const response = await fetch(PREVIEW_LOGO_PATH);+ if (!response.ok) {+ throw new Error(`Unable to load preview logo (${response.status})`);+ }+ return {+ sources: [+ {+ data: await response.arrayBuffer(),+ src: PREVIEW_LOGO_PATH,+ },+ ],+ };+}++function getImages() {+ imagesReady ??= loadImages();+ return imagesReady;}async function initWasm() {- wasmReady ??= initPdf();+ wasmReady ??= initPdf({ module_or_path: TAKUMI_WASM_URL });await wasmReady;}async function renderRequest(id: number, code: string) {await initWasm();- const { default: component, options } = evaluateCodeExports(code, renderReact);- const element = renderReact.createElement(component as React.JSXElementConstructor<unknown>);+ const { default: component, options } = evaluateCodeExports(+ code,+ renderReact+ );+ const element = renderReact.createElement(+ component as React.JSXElementConstructor<unknown>+ );const geometry = outputGeometry(options);postMessage({- type: "preview-result",- id,- html: renderToStaticMarkup(element),- width: geometry.width,height: geometry.height,+ html: renderToStaticMarkup(element),+ id,padding: geometry.padding,+ type: "preview-result",+ width: geometry.width,});- const fonts = await getFonts();const start = performance.now();- const pdfOptions = options.pdf ?? {} as Record<string, unknown>;+ const pdfOptions = options.pdf ?? ({} as Record<string, unknown>);const pdfBytes = await render(element, {- fonts,- size: (pdfOptions.size as PageSize | undefined) ?? "a4",+ images: await getImages(),margin: pdfOptions.margin ?? { top: 48, right: 48, bottom: 48, left: 48 },+ size: (pdfOptions.size as PageSize | undefined) ?? "a4",...pdfOptions,});@@ -57,19 +86,19 @@ async function renderRequest(id: number, code: string) {postMessage({- type: "render-result",result: {- status: "success",+ duration,id,+ inspection: inspectPdf(pdfBytes),+ label: geometry.label,outputBuffer: pdfBytes,- duration,- outputKind: "pdf",outputFormat: "pdf",- label: geometry.label,- inspection: inspectPdf(pdfBytes),+ outputKind: "pdf",+ status: "success",},+ type: "render-result",},- [pdfBytes.buffer],+ [pdfBytes.buffer]);}@@ -82,12 +111,12 @@ self.onmessage = async (event: MessageEvent) => {await renderRequest(payload.id, payload.code);} catch (error) {postMessage({- type: "render-result",result: {- status: "error",id: payload.id,message: error instanceof Error ? error.message : "Unknown error",+ status: "error",},+ type: "render-result",});}break;diff --git a/constants/site.ts b/constants/site.tsindex 1efa5c3..e6f0b7c 100644--- a/constants/site.ts+++ b/constants/site.ts@@ -20,7 +20,7 @@ export const SITE = {TWITTER: "@alaymanguy",},DESCRIPTION: {- LONG: "A collection of beautifully designed, accessible, and customizable PDF components. Built on Takumi PDF and Forme. Works with shadcn/ui.",+ LONG: "A collection of beautifully designed, accessible, and customizable PDF components. Built on Takumi and Forme. Works with shadcn/ui.",SHORT: "Beautiful PDFs, made simple",},KEYWORDS: [@@ -28,7 +28,7 @@ export const SITE = {"shadcn registry","pdf components","takumi-pdf",- "forme pdf",+ "forme","react pdf","npx shadcn add",] as const,diff --git a/content/docs/(root)/index.mdx b/content/docs/(root)/index.mdxindex 30eb573..73dd470 100644--- a/content/docs/(root)/index.mdx+++ b/content/docs/(root)/index.mdx@@ -1,15 +1,15 @@---title: "Introduction"-description: "Copy-paste PDF components for React. Built on Takumi PDF and Forme, works with the shadcn CLI."+description: "Copy-paste PDF components for React. Built on Takumi and Forme, works with the shadcn CLI."----**pdfcn** provides beautifully designed, accessible, and customizable PDF components. Built on [Takumi PDF](https://takumi.kane.tw/docs/pdf) and [Forme](https://docs.formepdf.com), and designed to work seamlessly with the [shadcn CLI](https://ui.shadcn.com).+**pdfcn** provides beautifully designed, accessible, and customizable PDF components. Built on [Takumi](https://takumi.kane.tw/docs/pdf) and [Forme](https://docs.formepdf.com), and designed to work seamlessly with the [shadcn CLI](https://ui.shadcn.com).## Philosophypdfcn follows the shadcn model for document generation: copy-paste components you can own, with zero lock-in and sensible defaults that work immediately.-PDF layouts are often treated as one-off templates — assembled with renderer-specific primitives, duplicated styling, and brittle page-break logic. pdfcn takes a different approach. It stays close to each renderer's primitives, keeps the API familiar across Takumi PDF and Forme, and lets you drop down to the underlying renderer whenever you need more control.+PDF layouts are often treated as one-off templates — assembled with renderer-specific primitives, duplicated styling, and brittle page-break logic. pdfcn takes a different approach. It stays close to each renderer's primitives, keeps the API familiar across Takumi and Forme, and lets you drop down to the underlying renderer whenever you need more control.The goal is simple: make generated PDFs feel like the rest of your stack — composable, themeable, accessible, and easy to customize.@@ -19,13 +19,13 @@ Most PDF component setups are either too opinionated or too scattered. pdfcn is- **Own Your Code:** Copy the components into your project and customize everything.- **Start Fast:** Run one command and render your first document with production-ready defaults.-- **Choose Your Engine:** Use the same component API with Takumi PDF or Forme, then drop to raw renderer APIs when needed.+- **Choose Your Engine:** Use the same component API with Takumi or Forme, then drop to raw renderer APIs when needed.## Two Rendering BasesEvery component and block ships in two implementations:-- [Takumi PDF](https://takumi.kane.tw/docs/pdf) — JSX and Tailwind-style classes rendered to paged, selectable-text PDFs with WebAssembly.+- [Takumi](https://takumi.kane.tw/docs/pdf) — JSX and Tailwind-style classes rendered to paged, selectable-text PDFs with WebAssembly.- [Forme](https://docs.formepdf.com) — React PDF primitives rendered with a page-native layout engine and first-class browser support.The public props and variants follow [pdfx](https://github.com/akii09/pdfx); only the renderer-specific primitives differ.@@ -51,7 +51,7 @@ The public props and variants follow [pdfx](https://github.com/akii09/pdfx); onl<FeatureCardicon={Code2Icon}title="TypeScript"- description="Full type safety with matching public props across Takumi PDF and Forme."+ description="Full type safety with matching public props across Takumi and Forme."/><FeatureCardicon={ClipboardCopyIcon}diff --git a/content/docs/(root)/installation.mdx b/content/docs/(root)/installation.mdxindex cd45976..082f19b 100644--- a/content/docs/(root)/installation.mdx+++ b/content/docs/(root)/installation.mdx@@ -5,11 +5,11 @@ description: Install PDF components, blocks, and themes from the registry.## Prerequisites-A React project that can run either [Takumi PDF](https://takumi.kane.tw/docs/pdf) or [Forme](https://docs.formepdf.com).+A React project that can run either [Takumi](https://takumi.kane.tw/docs/pdf) or [Forme](https://docs.formepdf.com).## Installation-Run the following command to add a Takumi PDF component:+Run the following command to add a Takumi component:```bashnpx shadcn@latest add @pdfcn/takumi/textdiff --git a/content/docs/(root)/mcp.mdx b/content/docs/(root)/mcp.mdxindex 443e56b..a3daf28 100644--- a/content/docs/(root)/mcp.mdx+++ b/content/docs/(root)/mcp.mdx@@ -17,7 +17,7 @@ Choose your MCP client when prompted, then enable the MCP server in that client## Usage-With MCP enabled, you can ask your IDE to work with **Takumi PDF** and **Forme PDF** patterns and pdfcn registry components. Example prompts:+With MCP enabled, you can ask your IDE to work with **Takumi** and **Forme** patterns and pdfcn registry components. Example prompts:- Build an invoice layout with **Table**, **Heading**, **Text**, and **KeyValue**.- Add a **QRCode** and **Signature** to a PDF document.diff --git a/content/docs/(root)/registry.mdx b/content/docs/(root)/registry.mdxindex 113df32..d2ddf70 100644--- a/content/docs/(root)/registry.mdx+++ b/content/docs/(root)/registry.mdx@@ -3,7 +3,7 @@ title: Registrydescription: Learn how to use the pdfcn registry with the shadcn CLI.----The **pdfcn** registry ships Takumi PDF and Forme PDF components, blocks, and themes in the [shadcn registry format](https://ui.shadcn.com/docs/registry). Register the namespace once in `components.json`, then pull items by name with the CLI.+The **pdfcn** registry ships Takumi and Forme components, blocks, and themes in the [shadcn registry format](https://ui.shadcn.com/docs/registry). Register the namespace once in `components.json`, then pull items by name with the CLI.## Setup@@ -21,7 +21,7 @@ You can replace `@pdfcn` with another namespace; it only needs to match what you## Usage-Items are namespaced by base: `takumi/` for Takumi PDF and `forme/` for Forme PDF.+Items are namespaced by base: `takumi/` for Takumi and `forme/` for Forme.Registry files follow these destinations:@@ -30,7 +30,7 @@ Registry files follow these destinations:Components declare their dependencies, so installing a component does not require additional setup.-### Takumi PDF+### TakumiInstall a component:@@ -50,7 +50,7 @@ Without a registry alias, use the full URL (as on each docs page):npx shadcn@latest add https://pdfcn.dev/r/takumi/text.json```-### Forme PDF+### FormeInstall a component:diff --git a/content/docs/blocks/forme/index.mdx b/content/docs/blocks/forme/index.mdxindex 7088e1f..abf9d87 100644--- a/content/docs/blocks/forme/index.mdx+++ b/content/docs/blocks/forme/index.mdx@@ -1,6 +1,6 @@----title: "Forme PDF"-description: "Invoice and report templates for the Forme PDF base."+title: "Forme"+description: "Invoice and report templates for the Forme base."---<ComponentsList folderName="Blocks" base="forme" />diff --git a/content/docs/blocks/forme/meta.json b/content/docs/blocks/forme/meta.jsonindex fe3158f..72742da 100644--- a/content/docs/blocks/forme/meta.json+++ b/content/docs/blocks/forme/meta.json@@ -12,5 +12,5 @@"report-operations","report-security"],- "title": "Forme PDF"+ "title": "Forme"}diff --git a/content/docs/blocks/takumi/index.mdx b/content/docs/blocks/takumi/index.mdxindex da686da..4fc3fd8 100644--- a/content/docs/blocks/takumi/index.mdx+++ b/content/docs/blocks/takumi/index.mdx@@ -1,6 +1,6 @@----title: "Takumi PDF"-description: "Invoice and report templates for the Takumi PDF base."+title: "Takumi"+description: "Invoice and report templates for the Takumi base."---<ComponentsList folderName="Blocks" base="takumi" />diff --git a/content/docs/blocks/takumi/meta.json b/content/docs/blocks/takumi/meta.jsonindex 8f66c9d..ed12e4d 100644--- a/content/docs/blocks/takumi/meta.json+++ b/content/docs/blocks/takumi/meta.json@@ -12,5 +12,5 @@"report-operations","report-security"],- "title": "Takumi PDF"+ "title": "Takumi"}diff --git a/content/docs/components/forme/card.mdx b/content/docs/components/forme/card.mdxindex 0888092..72c32f0 100644--- a/content/docs/components/forme/card.mdx+++ b/content/docs/components/forme/card.mdx@@ -80,10 +80,10 @@ import { PdfCard } from "@/components/pdf/card";### PdfCard-| Prop | Type | Default |-| ---------- | ------------- | --------- | ----- | ---- |-| `title` | `string` | - |-| `children` | `ReactNode` | - |-| `variant` | `CardVariant` | 'default' |-| `padding` | `"sm" | "md" | "lg"` | 'md' |-| `wrap` | `boolean` | false |+| Prop | Type | Default |+| ---------- | ---------------------- | ----------- |+| `title` | `string` | - |+| `children` | `ReactNode` | - |+| `variant` | `CardVariant` | `'default'` |+| `padding` | `'sm' \| 'md' \| 'lg'` | `'md'` |+| `wrap` | `boolean` | `false` |diff --git a/content/docs/components/forme/data-table.mdx b/content/docs/components/forme/data-table.mdxindex 56f05c8..9120ead 100644--- a/content/docs/components/forme/data-table.mdx+++ b/content/docs/components/forme/data-table.mdx@@ -91,24 +91,24 @@ Use any `TableVariant` for the table treatment and `size="compact"` for denser r### DataTable-| Prop | Type | Default |-| ---------- | --------------------- | ----------- |-| `columns` | `DataTableColumn<T>[]` | - |-| `data` | `T[]` | - |-| `variant` | `TableVariant` | `'grid'` |-| `footer` | `Partial<Record<keyof T, string \| number>>` | - |-| `stripe` | `boolean` | `false` |-| `size` | `'default' \| 'compact'` | `'default'` |-| `noWrap` | `boolean` | `false` |-| `style` | `Style` | - |+| Prop | Type | Default |+| --------- | -------------------------------------------- | ----------- |+| `columns` | `DataTableColumn<T>[]` | - |+| `data` | `T[]` | - |+| `variant` | `TableVariant` | `'grid'` |+| `footer` | `Partial<Record<keyof T, string \| number>>` | - |+| `stripe` | `boolean` | `false` |+| `size` | `'default' \| 'compact'` | `'default'` |+| `noWrap` | `boolean` | `false` |+| `style` | `Style` | - |### DataTableColumn-| Prop | Type | Default |-| -------------- | ----------------------------------------- | -------- |-| `key` | `keyof T & string` | - |-| `header` | `string` | - |-| `align` | `'left' \| 'center' \| 'right'` | `'left'` |-| `width` | `string \| number` | - |-| `render` | `(value, row) => ReactNode` | - |-| `renderFooter` | `(value) => ReactNode` | - |+| Prop | Type | Default |+| -------------- | ------------------------------- | -------- |+| `key` | `keyof T & string` | - |+| `header` | `string` | - |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `width` | `string \| number` | - |+| `render` | `(value, row) => ReactNode` | - |+| `renderFooter` | `(value) => ReactNode` | - |diff --git a/content/docs/components/forme/divider.mdx b/content/docs/components/forme/divider.mdxindex 1fc3f0d..94df2ab 100644--- a/content/docs/components/forme/divider.mdx+++ b/content/docs/components/forme/divider.mdx@@ -80,11 +80,11 @@ import { Divider } from "@/components/pdf/divider";### Divider-| Prop | Type | Default |-| ----------- | ------------------ | ------- | --- |-| `spacing` | `DividerSpacing` | 'md' |-| `variant` | `DividerVariant` | 'solid' |-| `color` | `string` | - |-| `thickness` | `DividerThickness` | 'thin' |-| `label` | `string` | - |-| `width` | `string | number` | - |+| Prop | Type | Default |+| ----------- | ------------------ | --------- |+| `spacing` | `DividerSpacing` | `'md'` |+| `variant` | `DividerVariant` | `'solid'` |+| `color` | `string` | - |+| `thickness` | `DividerThickness` | `'thin'` |+| `label` | `string` | - |+| `width` | `string \| number` | - |diff --git a/content/docs/components/forme/graph.mdx b/content/docs/components/forme/graph.mdxindex 9898363..ef92a8e 100644--- a/content/docs/components/forme/graph.mdx+++ b/content/docs/components/forme/graph.mdx@@ -87,26 +87,26 @@ import { PdfGraph } from "@/components/pdf/graph";### PdfGraph-| Prop | Type | Default |-| ------------- | -------------------------------- | ---------- |-| `variant` | `GraphVariant` | `'bar'` |-| `data` | `GraphDataPoint[] \| GraphSeries[]` | - |-| `title` | `string` | - |-| `subtitle` | `string` | - |-| `xLabel` | `string` | - |-| `yLabel` | `string` | - |-| `width` | `number` | `420` |-| `height` | `number` | `260` |-| `fullWidth` | `boolean` | `false` |-| `colors` | `string[]` | theme |-| `showValues` | `boolean` | `false` |-| `showGrid` | `boolean` | `true` |-| `legend` | `'bottom' \| 'right' \| 'none'` | `'bottom'` |-| `centerLabel` | `string` | - |-| `showDots` | `boolean` | `true` |-| `smooth` | `boolean` | `false` |-| `yTicks` | `number` | `5` |-| `noWrap` | `boolean` | `true` |-| `style` | `Style` | - |+| Prop | Type | Default |+| ------------- | ----------------------------------- | ---------- |+| `variant` | `GraphVariant` | `'bar'` |+| `data` | `GraphDataPoint[] \| GraphSeries[]` | - |+| `title` | `string` | - |+| `subtitle` | `string` | - |+| `xLabel` | `string` | - |+| `yLabel` | `string` | - |+| `width` | `number` | `420` |+| `height` | `number` | `260` |+| `fullWidth` | `boolean` | `false` |+| `colors` | `string[]` | theme |+| `showValues` | `boolean` | `false` |+| `showGrid` | `boolean` | `true` |+| `legend` | `'bottom' \| 'right' \| 'none'` | `'bottom'` |+| `centerLabel` | `string` | - |+| `showDots` | `boolean` | `true` |+| `smooth` | `boolean` | `false` |+| `yTicks` | `number` | `5` |+| `noWrap` | `boolean` | `true` |+| `style` | `Style` | - |`GraphVariant` is `'bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut'`.diff --git a/content/docs/components/forme/heading.mdx b/content/docs/components/forme/heading.mdxindex 0e18698..62af489 100644--- a/content/docs/components/forme/heading.mdx+++ b/content/docs/components/forme/heading.mdx@@ -80,13 +80,13 @@ import { Heading } from "@/components/pdf/heading";### Heading-| Prop | Type | Default |-| -------------- | ----------------- | ----------- | ------------- | ------ | --- | --- | --- |-| `level` | `1 | 2 | 3 | 4 | 5 | 6` | 1 |-| `align` | `"left" | "center" | "right"` | 'left' |-| `color` | `string` | - |-| `transform` | `"uppercase" | "lowercase" | "capitalize"` | - |-| `weight` | `HeadingWeight` | 'bold' |-| `tracking` | `HeadingTracking` | 'normal' |-| `noMargin` | `boolean` | false |-| `keepWithNext` | `boolean` | - |+| Prop | Type | Default |+| -------------- | -------------------------------------------- | ---------- |+| `level` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `1` |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `color` | `string` | - |+| `transform` | `'uppercase' \| 'lowercase' \| 'capitalize'` | - |+| `weight` | `HeadingWeight` | `'bold'` |+| `tracking` | `HeadingTracking` | `'normal'` |+| `noMargin` | `boolean` | `false` |+| `keepWithNext` | `boolean` | - |diff --git a/content/docs/components/forme/index.mdx b/content/docs/components/forme/index.mdxindex c8d65c5..f5b160f 100644--- a/content/docs/components/forme/index.mdx+++ b/content/docs/components/forme/index.mdx@@ -1,6 +1,6 @@----title: "Forme PDF"-description: "PDF UI primitives for the Forme PDF base."+title: "Forme"+description: "PDF UI primitives for the Forme base."---<ComponentsList folderName="Components" base="forme" />diff --git a/content/docs/components/forme/link.mdx b/content/docs/components/forme/link.mdxindex af2e313..ff35c76 100644--- a/content/docs/components/forme/link.mdx+++ b/content/docs/components/forme/link.mdx@@ -80,10 +80,10 @@ import { Link } from "@/components/pdf/link";### Link-| Prop | Type | Default |-| ----------- | --------------- | --------- | -------- | ------ |-| `href` | `string` | - |-| `align` | `"left" | "center" | "right"` | 'left' |-| `color` | `string` | - |-| `variant` | `LinkVariant` | 'default' |-| `underline` | `LinkUnderline` | 'always' |+| Prop | Type | Default |+| ----------- | ------------------------------- | ----------- |+| `href` | `string` | - |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `color` | `string` | - |+| `variant` | `LinkVariant` | `'default'` |+| `underline` | `LinkUnderline` | `'always'` |diff --git a/content/docs/components/forme/list.mdx b/content/docs/components/forme/list.mdxindex 7cf8773..16a29d3 100644--- a/content/docs/components/forme/list.mdx+++ b/content/docs/components/forme/list.mdx@@ -87,12 +87,12 @@ import { PdfList } from "@/components/pdf/list";### PdfList-| Prop | Type | Default |-| --------- | ---------------------------- | ---------- |-| `items` | `ListItem[]` | - |-| `variant` | `ListVariant` | `'bullet'` |-| `gap` | `'xs' \| 'sm' \| 'md'` | `'sm'` |-| `noWrap` | `boolean` | `false` |-| `style` | `Style` | - |+| Prop | Type | Default |+| --------- | ---------------------- | ---------- |+| `items` | `ListItem[]` | - |+| `variant` | `ListVariant` | `'bullet'` |+| `gap` | `'xs' \| 'sm' \| 'md'` | `'sm'` |+| `noWrap` | `boolean` | `false` |+| `style` | `Style` | - |`ListVariant` is `'bullet' | 'numbered' | 'checklist' | 'icon' | 'multi-level' | 'descriptive'`.diff --git a/content/docs/components/forme/meta.json b/content/docs/components/forme/meta.jsonindex 8231036..7b6999d 100644--- a/content/docs/components/forme/meta.json+++ b/content/docs/components/forme/meta.json@@ -26,5 +26,5 @@"text","watermark"],- "title": "Forme PDF"+ "title": "Forme"}diff --git a/content/docs/components/forme/pdf-image.mdx b/content/docs/components/forme/pdf-image.mdxindex 7aa3403..850fa26 100644--- a/content/docs/components/forme/pdf-image.mdx+++ b/content/docs/components/forme/pdf-image.mdx@@ -80,16 +80,16 @@ import { PdfImage } from "@/components/pdf/pdf-image";### PdfImage-| Prop | Type | Default |-| -------------- | ----------------- | --------- | --- |-| `src` | `PdfImageSrc` | - |-| `variant` | `PdfImageVariant` | 'default' |-| `width` | `number | string` | - |-| `height` | `number | string` | - |-| `fit` | `PdfImageFit` | - |-| `position` | `string` | '50% 50%' |-| `caption` | `string` | - |-| `aspectRatio` | `number` | - |-| `borderRadius` | `number` | - |-| `noWrap` | `boolean` | true |-| `style` | `Style` | - |+| Prop | Type | Default |+| -------------- | ------------------ | ----------- |+| `src` | `PdfImageSrc` | - |+| `variant` | `PdfImageVariant` | `'default'` |+| `width` | `number \| string` | - |+| `height` | `number \| string` | - |+| `fit` | `PdfImageFit` | - |+| `position` | `string` | `'50% 50%'` |+| `caption` | `string` | - |+| `aspectRatio` | `number` | - |+| `borderRadius` | `number` | - |+| `noWrap` | `boolean` | `true` |+| `style` | `Style` | - |diff --git a/content/docs/components/forme/table.mdx b/content/docs/components/forme/table.mdxindex b0b7e2c..50cb7c1 100644--- a/content/docs/components/forme/table.mdx+++ b/content/docs/components/forme/table.mdx@@ -113,21 +113,21 @@ import {### TableRow-| Prop | Type | Default |-| --------- | -------------- | ------- |-| `header` | `boolean` | `false` |-| `footer` | `boolean` | `false` |-| `stripe` | `boolean` | `false` |+| Prop | Type | Default |+| --------- | -------------- | --------- |+| `header` | `boolean` | `false` |+| `footer` | `boolean` | `false` |+| `stripe` | `boolean` | `false` || `variant` | `TableVariant` | inherited |### TableCell-| Prop | Type | Default |-| --------- | -------------------------------- | -------- |-| `header` | `boolean` | `false` |-| `footer` | `boolean` | `false` |-| `align` | `'left' \| 'center' \| 'right'` | `'left'` |-| `width` | `string \| number` | - |-| `variant` | `TableVariant` | inherited |+| Prop | Type | Default |+| --------- | ------------------------------- | --------- |+| `header` | `boolean` | `false` |+| `footer` | `boolean` | `false` |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `width` | `string \| number` | - |+| `variant` | `TableVariant` | inherited |`TableVariant` is `'line' | 'grid' | 'minimal' | 'striped' | 'compact' | 'bordered' | 'primary-header'`.diff --git a/content/docs/components/forme/text.mdx b/content/docs/components/forme/text.mdxindex 892a3c1..beba65c 100644--- a/content/docs/components/forme/text.mdx+++ b/content/docs/components/forme/text.mdx@@ -80,13 +80,13 @@ import { Text } from "@/components/pdf/text";### Text-| Prop | Type | Default |-| ------------ | ---------------- | ----------- | ------------- | ---------- | ------ |-| `variant` | `TextVariant` | 'base' |-| `align` | `"left" | "center" | "right" | "justify"` | 'left' |-| `color` | `string` | - |-| `weight` | `TextWeight` | 'normal' |-| `italic` | `boolean` | false |-| `decoration` | `TextDecoration` | 'none' |-| `transform` | `"uppercase" | "lowercase" | "capitalize"` | - |-| `noMargin` | `boolean` | false |+| Prop | Type | Default |+| ------------ | -------------------------------------------- | ---------- |+| `variant` | `TextVariant` | `'base'` |+| `align` | `'left' \| 'center' \| 'right' \| 'justify'` | `'left'` |+| `color` | `string` | - |+| `weight` | `TextWeight` | `'normal'` |+| `italic` | `boolean` | `false` |+| `decoration` | `TextDecoration` | `'none'` |+| `transform` | `'uppercase' \| 'lowercase' \| 'capitalize'` | - |+| `noMargin` | `boolean` | `false` |diff --git a/content/docs/components/index.mdx b/content/docs/components/index.mdxindex d5d9150..77bd97d 100644--- a/content/docs/components/index.mdx+++ b/content/docs/components/index.mdx@@ -3,6 +3,4 @@ title: Componentsdescription: Here you can find all the PDF components available in the library.----Every component is available for both the Takumi PDF and Forme bases with matching public props.-<ComponentsList className="mt-4" base="takumi" />diff --git a/content/docs/components/takumi/card.mdx b/content/docs/components/takumi/card.mdxindex 6ea8d1c..f162fc7 100644--- a/content/docs/components/takumi/card.mdx+++ b/content/docs/components/takumi/card.mdx@@ -92,10 +92,10 @@ import { PdfCard } from "@/components/pdf/card";### PdfCard-| Prop | Type | Default |-| ---------- | ------------- | --------- | ----- | ---- |-| `title` | `string` | - |-| `children` | `ReactNode` | - |-| `variant` | `CardVariant` | 'default' |-| `padding` | `"sm" | "md" | "lg"` | 'md' |-| `wrap` | `boolean` | false |+| Prop | Type | Default |+| ---------- | ---------------------- | ----------- |+| `title` | `string` | - |+| `children` | `ReactNode` | - |+| `variant` | `CardVariant` | `'default'` |+| `padding` | `'sm' \| 'md' \| 'lg'` | `'md'` |+| `wrap` | `boolean` | `false` |diff --git a/content/docs/components/takumi/data-table.mdx b/content/docs/components/takumi/data-table.mdxindex 5c96ccc..598711b 100644--- a/content/docs/components/takumi/data-table.mdx+++ b/content/docs/components/takumi/data-table.mdx@@ -103,24 +103,24 @@ Use any `TableVariant` for the table treatment and `size="compact"` for denser r### DataTable-| Prop | Type | Default |-| ---------- | --------------------- | ----------- |-| `columns` | `DataTableColumn<T>[]` | - |-| `data` | `T[]` | - |-| `variant` | `TableVariant` | `'grid'` |-| `footer` | `Partial<Record<keyof T, string \| number>>` | - |-| `stripe` | `boolean` | `false` |-| `size` | `'default' \| 'compact'` | `'default'` |-| `noWrap` | `boolean` | `false` |-| `style` | `Style` | - |+| Prop | Type | Default |+| --------- | -------------------------------------------- | ----------- |+| `columns` | `DataTableColumn<T>[]` | - |+| `data` | `T[]` | - |+| `variant` | `TableVariant` | `'grid'` |+| `footer` | `Partial<Record<keyof T, string \| number>>` | - |+| `stripe` | `boolean` | `false` |+| `size` | `'default' \| 'compact'` | `'default'` |+| `noWrap` | `boolean` | `false` |+| `style` | `Style` | - |### DataTableColumn-| Prop | Type | Default |-| -------------- | ----------------------------------------- | -------- |-| `key` | `keyof T & string` | - |-| `header` | `string` | - |-| `align` | `'left' \| 'center' \| 'right'` | `'left'` |-| `width` | `string \| number` | - |-| `render` | `(value, row) => ReactNode` | - |-| `renderFooter` | `(value) => ReactNode` | - |+| Prop | Type | Default |+| -------------- | ------------------------------- | -------- |+| `key` | `keyof T & string` | - |+| `header` | `string` | - |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `width` | `string \| number` | - |+| `render` | `(value, row) => ReactNode` | - |+| `renderFooter` | `(value) => ReactNode` | - |diff --git a/content/docs/components/takumi/divider.mdx b/content/docs/components/takumi/divider.mdxindex 39dac59..76a103c 100644--- a/content/docs/components/takumi/divider.mdx+++ b/content/docs/components/takumi/divider.mdx@@ -92,11 +92,11 @@ import { Divider } from "@/components/pdf/divider";### Divider-| Prop | Type | Default |-| ----------- | ------------------ | ------- | --- |-| `spacing` | `DividerSpacing` | 'md' |-| `variant` | `DividerVariant` | 'solid' |-| `color` | `string` | - |-| `thickness` | `DividerThickness` | 'thin' |-| `label` | `string` | - |-| `width` | `string | number` | - |+| Prop | Type | Default |+| ----------- | ------------------ | --------- |+| `spacing` | `DividerSpacing` | `'md'` |+| `variant` | `DividerVariant` | `'solid'` |+| `color` | `string` | - |+| `thickness` | `DividerThickness` | `'thin'` |+| `label` | `string` | - |+| `width` | `string \| number` | - |diff --git a/content/docs/components/takumi/graph.mdx b/content/docs/components/takumi/graph.mdxindex 45c7208..2c862e6 100644--- a/content/docs/components/takumi/graph.mdx+++ b/content/docs/components/takumi/graph.mdx@@ -99,26 +99,26 @@ import { PdfGraph } from "@/components/pdf/graph";### PdfGraph-| Prop | Type | Default |-| ------------- | -------------------------------- | ---------- |-| `variant` | `GraphVariant` | `'bar'` |-| `data` | `GraphDataPoint[] \| GraphSeries[]` | - |-| `title` | `string` | - |-| `subtitle` | `string` | - |-| `xLabel` | `string` | - |-| `yLabel` | `string` | - |-| `width` | `number` | `420` |-| `height` | `number` | `260` |-| `fullWidth` | `boolean` | `false` |-| `colors` | `string[]` | theme |-| `showValues` | `boolean` | `false` |-| `showGrid` | `boolean` | `true` |-| `legend` | `'bottom' \| 'right' \| 'none'` | `'bottom'` |-| `centerLabel` | `string` | - |-| `showDots` | `boolean` | `true` |-| `smooth` | `boolean` | `false` |-| `yTicks` | `number` | `5` |-| `noWrap` | `boolean` | `true` |-| `style` | `Style` | - |+| Prop | Type | Default |+| ------------- | ----------------------------------- | ---------- |+| `variant` | `GraphVariant` | `'bar'` |+| `data` | `GraphDataPoint[] \| GraphSeries[]` | - |+| `title` | `string` | - |+| `subtitle` | `string` | - |+| `xLabel` | `string` | - |+| `yLabel` | `string` | - |+| `width` | `number` | `420` |+| `height` | `number` | `260` |+| `fullWidth` | `boolean` | `false` |+| `colors` | `string[]` | theme |+| `showValues` | `boolean` | `false` |+| `showGrid` | `boolean` | `true` |+| `legend` | `'bottom' \| 'right' \| 'none'` | `'bottom'` |+| `centerLabel` | `string` | - |+| `showDots` | `boolean` | `true` |+| `smooth` | `boolean` | `false` |+| `yTicks` | `number` | `5` |+| `noWrap` | `boolean` | `true` |+| `style` | `Style` | - |`GraphVariant` is `'bar' | 'horizontal-bar' | 'line' | 'area' | 'pie' | 'donut'`.diff --git a/content/docs/components/takumi/heading.mdx b/content/docs/components/takumi/heading.mdxindex ae10eb7..564031f 100644--- a/content/docs/components/takumi/heading.mdx+++ b/content/docs/components/takumi/heading.mdx@@ -92,13 +92,13 @@ import { Heading } from "@/components/pdf/heading";### Heading-| Prop | Type | Default |-| -------------- | ----------------- | ----------- | ------------- | ------ | --- | --- | --- |-| `level` | `1 | 2 | 3 | 4 | 5 | 6` | 1 |-| `align` | `"left" | "center" | "right"` | 'left' |-| `color` | `string` | - |-| `transform` | `"uppercase" | "lowercase" | "capitalize"` | - |-| `weight` | `HeadingWeight` | 'bold' |-| `tracking` | `HeadingTracking` | 'normal' |-| `noMargin` | `boolean` | false |-| `keepWithNext` | `boolean` | - |+| Prop | Type | Default |+| -------------- | -------------------------------------------- | ---------- |+| `level` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `1` |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `color` | `string` | - |+| `transform` | `'uppercase' \| 'lowercase' \| 'capitalize'` | - |+| `weight` | `HeadingWeight` | `'bold'` |+| `tracking` | `HeadingTracking` | `'normal'` |+| `noMargin` | `boolean` | `false` |+| `keepWithNext` | `boolean` | - |diff --git a/content/docs/components/takumi/index.mdx b/content/docs/components/takumi/index.mdxindex 5cfd8cb..7e2c11b 100644--- a/content/docs/components/takumi/index.mdx+++ b/content/docs/components/takumi/index.mdx@@ -1,6 +1,6 @@----title: "Takumi PDF"-description: "PDF UI primitives for the Takumi PDF base."+title: "Takumi"+description: "PDF UI primitives for the Takumi base."---<ComponentsList folderName="Components" base="takumi" />diff --git a/content/docs/components/takumi/link.mdx b/content/docs/components/takumi/link.mdxindex ca2abf8..bdc749c 100644--- a/content/docs/components/takumi/link.mdx+++ b/content/docs/components/takumi/link.mdx@@ -92,10 +92,10 @@ import { Link } from "@/components/pdf/link";### Link-| Prop | Type | Default |-| ----------- | --------------- | --------- | -------- | ------ |-| `href` | `string` | - |-| `align` | `"left" | "center" | "right"` | 'left' |-| `color` | `string` | - |-| `variant` | `LinkVariant` | 'default' |-| `underline` | `LinkUnderline` | 'always' |+| Prop | Type | Default |+| ----------- | ------------------------------- | ----------- |+| `href` | `string` | - |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `color` | `string` | - |+| `variant` | `LinkVariant` | `'default'` |+| `underline` | `LinkUnderline` | `'always'` |diff --git a/content/docs/components/takumi/list.mdx b/content/docs/components/takumi/list.mdxindex fbb696f..25c8c13 100644--- a/content/docs/components/takumi/list.mdx+++ b/content/docs/components/takumi/list.mdx@@ -99,12 +99,12 @@ import { PdfList } from "@/components/pdf/list";### PdfList-| Prop | Type | Default |-| --------- | ---------------------------- | ---------- |-| `items` | `ListItem[]` | - |-| `variant` | `ListVariant` | `'bullet'` |-| `gap` | `'xs' \| 'sm' \| 'md'` | `'sm'` |-| `noWrap` | `boolean` | `false` |-| `style` | `Style` | - |+| Prop | Type | Default |+| --------- | ---------------------- | ---------- |+| `items` | `ListItem[]` | - |+| `variant` | `ListVariant` | `'bullet'` |+| `gap` | `'xs' \| 'sm' \| 'md'` | `'sm'` |+| `noWrap` | `boolean` | `false` |+| `style` | `Style` | - |`ListVariant` is `'bullet' | 'numbered' | 'checklist' | 'icon' | 'multi-level' | 'descriptive'`.diff --git a/content/docs/components/takumi/meta.json b/content/docs/components/takumi/meta.jsonindex 9848a80..ba1f7d4 100644--- a/content/docs/components/takumi/meta.json+++ b/content/docs/components/takumi/meta.json@@ -26,5 +26,5 @@"text","watermark"],- "title": "Takumi PDF"+ "title": "Takumi"}diff --git a/content/docs/components/takumi/pdf-image.mdx b/content/docs/components/takumi/pdf-image.mdxindex 47a098e..0dc2179 100644--- a/content/docs/components/takumi/pdf-image.mdx+++ b/content/docs/components/takumi/pdf-image.mdx@@ -92,16 +92,16 @@ import { PdfImage } from "@/components/pdf/pdf-image";### PdfImage-| Prop | Type | Default |-| -------------- | ----------------- | --------- | --- |-| `src` | `PdfImageSrc` | - |-| `variant` | `PdfImageVariant` | 'default' |-| `width` | `number | string` | - |-| `height` | `number | string` | - |-| `fit` | `PdfImageFit` | - |-| `position` | `string` | '50% 50%' |-| `caption` | `string` | - |-| `aspectRatio` | `number` | - |-| `borderRadius` | `number` | - |-| `noWrap` | `boolean` | true |-| `style` | `Style` | - |+| Prop | Type | Default |+| -------------- | ------------------ | ----------- |+| `src` | `PdfImageSrc` | - |+| `variant` | `PdfImageVariant` | `'default'` |+| `width` | `number \| string` | - |+| `height` | `number \| string` | - |+| `fit` | `PdfImageFit` | - |+| `position` | `string` | `'50% 50%'` |+| `caption` | `string` | - |+| `aspectRatio` | `number` | - |+| `borderRadius` | `number` | - |+| `noWrap` | `boolean` | `true` |+| `style` | `Style` | - |diff --git a/content/docs/components/takumi/table.mdx b/content/docs/components/takumi/table.mdxindex 7ba7ebf..71a86c8 100644--- a/content/docs/components/takumi/table.mdx+++ b/content/docs/components/takumi/table.mdx@@ -125,21 +125,21 @@ import {### TableRow-| Prop | Type | Default |-| --------- | -------------- | ------- |-| `header` | `boolean` | `false` |-| `footer` | `boolean` | `false` |-| `stripe` | `boolean` | `false` |+| Prop | Type | Default |+| --------- | -------------- | --------- |+| `header` | `boolean` | `false` |+| `footer` | `boolean` | `false` |+| `stripe` | `boolean` | `false` || `variant` | `TableVariant` | inherited |### TableCell-| Prop | Type | Default |-| --------- | -------------------------------- | -------- |-| `header` | `boolean` | `false` |-| `footer` | `boolean` | `false` |-| `align` | `'left' \| 'center' \| 'right'` | `'left'` |-| `width` | `string \| number` | - |-| `variant` | `TableVariant` | inherited |+| Prop | Type | Default |+| --------- | ------------------------------- | --------- |+| `header` | `boolean` | `false` |+| `footer` | `boolean` | `false` |+| `align` | `'left' \| 'center' \| 'right'` | `'left'` |+| `width` | `string \| number` | - |+| `variant` | `TableVariant` | inherited |`TableVariant` is `'line' | 'grid' | 'minimal' | 'striped' | 'compact' | 'bordered' | 'primary-header'`.diff --git a/content/docs/components/takumi/text.mdx b/content/docs/components/takumi/text.mdxindex a7c7fef..6a3ee5e 100644--- a/content/docs/components/takumi/text.mdx+++ b/content/docs/components/takumi/text.mdx@@ -92,13 +92,13 @@ import { Text } from "@/components/pdf/text";### Text-| Prop | Type | Default |-| ------------ | ---------------- | ----------- | ------------- | ---------- | ------ |-| `variant` | `TextVariant` | 'base' |-| `align` | `"left" | "center" | "right" | "justify"` | 'left' |-| `color` | `string` | - |-| `weight` | `TextWeight` | 'normal' |-| `italic` | `boolean` | false |-| `decoration` | `TextDecoration` | 'none' |-| `transform` | `"uppercase" | "lowercase" | "capitalize"` | - |-| `noMargin` | `boolean` | false |+| Prop | Type | Default |+| ------------ | -------------------------------------------- | ---------- |+| `variant` | `TextVariant` | `'base'` |+| `align` | `'left' \| 'center' \| 'right' \| 'justify'` | `'left'` |+| `color` | `string` | - |+| `weight` | `TextWeight` | `'normal'` |+| `italic` | `boolean` | `false` |+| `decoration` | `TextDecoration` | `'none'` |+| `transform` | `'uppercase' \| 'lowercase' \| 'capitalize'` | - |+| `noMargin` | `boolean` | `false` |diff --git a/examples/__index__.ts b/examples/__index__.tsindex eb50a6c..dabfcd9 100644--- a/examples/__index__.ts+++ b/examples/__index__.ts@@ -1,40 +1,5 @@import type { ComponentType } from "react";-import type { BaseName } from "@/registry/bases";-import takumi_alert from "@/examples/takumi/alert";-import takumi_badge from "@/examples/takumi/badge";-import takumi_card from "@/examples/takumi/card";-import takumi_data_table from "@/examples/takumi/data-table";-import takumi_divider from "@/examples/takumi/divider";-import takumi_form from "@/examples/takumi/form";-import takumi_graph from "@/examples/takumi/graph";-import takumi_heading from "@/examples/takumi/heading";-import takumi_keep_together from "@/examples/takumi/keep-together";-import takumi_key_value from "@/examples/takumi/key-value";-import takumi_link from "@/examples/takumi/link";-import takumi_list from "@/examples/takumi/list";-import takumi_page_break from "@/examples/takumi/page-break";-import takumi_page_footer from "@/examples/takumi/page-footer";-import takumi_page_header from "@/examples/takumi/page-header";-import takumi_page_number from "@/examples/takumi/page-number";-import takumi_pdf_image from "@/examples/takumi/pdf-image";-import takumi_qrcode from "@/examples/takumi/qrcode";-import takumi_section from "@/examples/takumi/section";-import takumi_signature from "@/examples/takumi/signature";-import takumi_stack from "@/examples/takumi/stack";-import takumi_table from "@/examples/takumi/table";-import takumi_text from "@/examples/takumi/text";-import takumi_watermark from "@/examples/takumi/watermark";-import takumi_invoice_classic from "@/examples/takumi/invoice-classic";-import takumi_invoice_consultant from "@/examples/takumi/invoice-consultant";-import takumi_invoice_corporate from "@/examples/takumi/invoice-corporate";-import takumi_invoice_creative from "@/examples/takumi/invoice-creative";-import takumi_invoice_minimal from "@/examples/takumi/invoice-minimal";-import takumi_invoice_modern from "@/examples/takumi/invoice-modern";-import takumi_report_financial from "@/examples/takumi/report-financial";-import takumi_report_marketing from "@/examples/takumi/report-marketing";-import takumi_report_operations from "@/examples/takumi/report-operations";-import takumi_report_security from "@/examples/takumi/report-security";import forme_alert from "@/examples/forme/alert";import forme_badge from "@/examples/forme/badge";import forme_card from "@/examples/forme/card";@@ -43,6 +8,12 @@ import forme_divider from "@/examples/forme/divider";import forme_form from "@/examples/forme/form";import forme_graph from "@/examples/forme/graph";import forme_heading from "@/examples/forme/heading";+import forme_invoice_classic from "@/examples/forme/invoice-classic";+import forme_invoice_consultant from "@/examples/forme/invoice-consultant";+import forme_invoice_corporate from "@/examples/forme/invoice-corporate";+import forme_invoice_creative from "@/examples/forme/invoice-creative";+import forme_invoice_minimal from "@/examples/forme/invoice-minimal";+import forme_invoice_modern from "@/examples/forme/invoice-modern";import forme_keep_together from "@/examples/forme/keep-together";import forme_key_value from "@/examples/forme/key-value";import forme_link from "@/examples/forme/link";@@ -53,97 +24,126 @@ import forme_page_header from "@/examples/forme/page-header";import forme_page_number from "@/examples/forme/page-number";import forme_pdf_image from "@/examples/forme/pdf-image";import forme_qrcode from "@/examples/forme/qrcode";+import forme_report_financial from "@/examples/forme/report-financial";+import forme_report_marketing from "@/examples/forme/report-marketing";+import forme_report_operations from "@/examples/forme/report-operations";+import forme_report_security from "@/examples/forme/report-security";import forme_section from "@/examples/forme/section";import forme_signature from "@/examples/forme/signature";import forme_stack from "@/examples/forme/stack";import forme_table from "@/examples/forme/table";import forme_text from "@/examples/forme/text";import forme_watermark from "@/examples/forme/watermark";-import forme_invoice_classic from "@/examples/forme/invoice-classic";-import forme_invoice_consultant from "@/examples/forme/invoice-consultant";-import forme_invoice_corporate from "@/examples/forme/invoice-corporate";-import forme_invoice_creative from "@/examples/forme/invoice-creative";-import forme_invoice_minimal from "@/examples/forme/invoice-minimal";-import forme_invoice_modern from "@/examples/forme/invoice-modern";-import forme_report_financial from "@/examples/forme/report-financial";-import forme_report_marketing from "@/examples/forme/report-marketing";-import forme_report_operations from "@/examples/forme/report-operations";-import forme_report_security from "@/examples/forme/report-security";+import takumi_alert from "@/examples/takumi/alert";+import takumi_badge from "@/examples/takumi/badge";+import takumi_card from "@/examples/takumi/card";+import takumi_data_table from "@/examples/takumi/data-table";+import takumi_divider from "@/examples/takumi/divider";+import takumi_form from "@/examples/takumi/form";+import takumi_graph from "@/examples/takumi/graph";+import takumi_heading from "@/examples/takumi/heading";+import takumi_invoice_classic from "@/examples/takumi/invoice-classic";+import takumi_invoice_consultant from "@/examples/takumi/invoice-consultant";+import takumi_invoice_corporate from "@/examples/takumi/invoice-corporate";+import takumi_invoice_creative from "@/examples/takumi/invoice-creative";+import takumi_invoice_minimal from "@/examples/takumi/invoice-minimal";+import takumi_invoice_modern from "@/examples/takumi/invoice-modern";+import takumi_keep_together from "@/examples/takumi/keep-together";+import takumi_key_value from "@/examples/takumi/key-value";+import takumi_link from "@/examples/takumi/link";+import takumi_list from "@/examples/takumi/list";+import takumi_page_break from "@/examples/takumi/page-break";+import takumi_page_footer from "@/examples/takumi/page-footer";+import takumi_page_header from "@/examples/takumi/page-header";+import takumi_page_number from "@/examples/takumi/page-number";+import takumi_pdf_image from "@/examples/takumi/pdf-image";+import takumi_qrcode from "@/examples/takumi/qrcode";+import takumi_report_financial from "@/examples/takumi/report-financial";+import takumi_report_marketing from "@/examples/takumi/report-marketing";+import takumi_report_operations from "@/examples/takumi/report-operations";+import takumi_report_security from "@/examples/takumi/report-security";+import takumi_section from "@/examples/takumi/section";+import takumi_signature from "@/examples/takumi/signature";+import takumi_stack from "@/examples/takumi/stack";+import takumi_table from "@/examples/takumi/table";+import takumi_text from "@/examples/takumi/text";+import takumi_watermark from "@/examples/takumi/watermark";+import type { BaseName } from "@/registry/bases";type DemoMap = Record<string, ComponentType>;export const demos: Record<BaseName, DemoMap> = {takumi: {- "alert": takumi_alert,- "badge": takumi_badge,- "card": takumi_card,+ alert: takumi_alert,+ badge: takumi_badge,+ card: takumi_card,"data-table": takumi_data_table,- "divider": takumi_divider,- "form": takumi_form,- "graph": takumi_graph,- "heading": takumi_heading,+ divider: takumi_divider,+ form: takumi_form,+ graph: takumi_graph,+ heading: takumi_heading,+ "invoice-classic": takumi_invoice_classic,+ "invoice-consultant": takumi_invoice_consultant,+ "invoice-corporate": takumi_invoice_corporate,+ "invoice-creative": takumi_invoice_creative,+ "invoice-minimal": takumi_invoice_minimal,+ "invoice-modern": takumi_invoice_modern,"keep-together": takumi_keep_together,"key-value": takumi_key_value,- "link": takumi_link,- "list": takumi_list,+ link: takumi_link,+ list: takumi_list,"page-break": takumi_page_break,"page-footer": takumi_page_footer,"page-header": takumi_page_header,"page-number": takumi_page_number,"pdf-image": takumi_pdf_image,- "qrcode": takumi_qrcode,- "section": takumi_section,- "signature": takumi_signature,- "stack": takumi_stack,- "table": takumi_table,- "text": takumi_text,- "watermark": takumi_watermark,- "invoice-classic": takumi_invoice_classic,- "invoice-consultant": takumi_invoice_consultant,- "invoice-corporate": takumi_invoice_corporate,- "invoice-creative": takumi_invoice_creative,- "invoice-minimal": takumi_invoice_minimal,- "invoice-modern": takumi_invoice_modern,+ qrcode: takumi_qrcode,"report-financial": takumi_report_financial,"report-marketing": takumi_report_marketing,"report-operations": takumi_report_operations,"report-security": takumi_report_security,+ section: takumi_section,+ signature: takumi_signature,+ stack: takumi_stack,+ table: takumi_table,+ text: takumi_text,+ watermark: takumi_watermark,},forme: {- "alert": forme_alert,- "badge": forme_badge,- "card": forme_card,+ alert: forme_alert,+ badge: forme_badge,+ card: forme_card,"data-table": forme_data_table,- "divider": forme_divider,- "form": forme_form,- "graph": forme_graph,- "heading": forme_heading,+ divider: forme_divider,+ form: forme_form,+ graph: forme_graph,+ heading: forme_heading,+ "invoice-classic": forme_invoice_classic,+ "invoice-consultant": forme_invoice_consultant,+ "invoice-corporate": forme_invoice_corporate,+ "invoice-creative": forme_invoice_creative,+ "invoice-minimal": forme_invoice_minimal,+ "invoice-modern": forme_invoice_modern,"keep-together": forme_keep_together,"key-value": forme_key_value,- "link": forme_link,- "list": forme_list,+ link: forme_link,+ list: forme_list,"page-break": forme_page_break,"page-footer": forme_page_footer,"page-header": forme_page_header,"page-number": forme_page_number,"pdf-image": forme_pdf_image,- "qrcode": forme_qrcode,- "section": forme_section,- "signature": forme_signature,- "stack": forme_stack,- "table": forme_table,- "text": forme_text,- "watermark": forme_watermark,- "invoice-classic": forme_invoice_classic,- "invoice-consultant": forme_invoice_consultant,- "invoice-corporate": forme_invoice_corporate,- "invoice-creative": forme_invoice_creative,- "invoice-minimal": forme_invoice_minimal,- "invoice-modern": forme_invoice_modern,+ qrcode: forme_qrcode,"report-financial": forme_report_financial,"report-marketing": forme_report_marketing,"report-operations": forme_report_operations,"report-security": forme_report_security,+ section: forme_section,+ signature: forme_signature,+ stack: forme_stack,+ table: forme_table,+ text: forme_text,+ watermark: forme_watermark,},};diff --git a/examples/forme/alert.tsx b/examples/forme/alert.tsxindex 9dce630..10e7189 100644--- a/examples/forme/alert.tsx+++ b/examples/forme/alert.tsx@@ -1,18 +1,44 @@import { Document, Page } from "@formepdf/react";-import { PdfAlert } from "@/registry/bases/forme/components/alert";+import {+ Heading,+ PdfAlert,+ Section,+ Text,+} from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Document Alerts</Heading>+ <Text>+ The PdfAlert component displays callout boxes with different severity+ levels.+ </Text>+ <Section>+ <PdfAlert variant="info" title="Information">+ This document contains important information about your account.+ </PdfAlert>+ <PdfAlert variant="success" title="Success">+ Your payment has been processed successfully.+ </PdfAlert>+ <PdfAlert variant="warning" title="Warning">+ Please review the terms and conditions before proceeding.+ </PdfAlert>+ <PdfAlert variant="error" title="Error">+ Missing required fields. Please complete all sections.+ </PdfAlert>+ </Section>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfAlert variant="info" title="Info">Alert body</PdfAlert>;-}+export default Demo;diff --git a/examples/forme/badge.tsx b/examples/forme/badge.tsxindex cb5fc6c..d5cecad 100644--- a/examples/forme/badge.tsx+++ b/examples/forme/badge.tsx@@ -1,18 +1,31 @@-import { Document, Page } from "@formepdf/react";-import { Badge } from "@/registry/bases/forme/components/badge";+import { Document, Page, View } from "@formepdf/react";+import { Badge } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View+ style={{+ display: "flex",+ flexDirection: "row",+ flexWrap: "wrap",+ gap: 6,+ marginBottom: 12,+ }}+ >+ <Badge label="Small" variant="default" size="sm" />+ <Badge label="Medium" variant="default" size="md" />+ <Badge label="Large" variant="default" size="lg" />+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size={{ width: 595, height: 200 }} margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Badge>Badge</Badge>;-}+export default Demo;diff --git a/examples/forme/card.tsx b/examples/forme/card.tsxindex a65f938..0e87c1e 100644--- a/examples/forme/card.tsx+++ b/examples/forme/card.tsx@@ -1,18 +1,24 @@import { Document, Page } from "@formepdf/react";-import { PdfCard } from "@/registry/bases/forme/components/card";+import { PdfCard, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfCard title="Project Summary" variant="default" padding="md">+ <Text noMargin>+ This card groups related content with a title and body area. Use cards to+ visually separate sections of your PDF document.+ </Text>+ </PdfCard>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfCard title="Card">Card body</PdfCard>;-}+export default Demo;diff --git a/examples/forme/data-table.tsx b/examples/forme/data-table.tsxindex c44daaa..c13a27f 100644--- a/examples/forme/data-table.tsx+++ b/examples/forme/data-table.tsx@@ -1,29 +1,41 @@import { Document, Page } from "@formepdf/react";-import { DataTable } from "@/registry/bases/forme/components/data-table";+import { DataTable, Heading, Section } from "@/registry/bases/forme/components";-const Demo =() => {- return (- <Document>- <Page size="A4" margin={48}>- <DemoBody />- </Page>- </Document>- );-}-export default Demo;--function DemoBody() {- return (+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={3}>Team Directory</Heading><DataTable+ size="compact"+ variant="striped"columns={[+ { key: "id", header: "ID", align: "center" },{ key: "name", header: "Name" },- { key: "price", header: "Price" },+ { key: "dept", header: "Department" },+ { key: "status", header: "Status", align: "center" },]}data={[- { name: "Widget", price: "$10" },- { name: "Gadget", price: "$20" },+ { id: 1, name: "Alice Johnson", dept: "Engineering", status: "Active" },+ { id: 2, name: "Bob Smith", dept: "Marketing", status: "Active" },+ { id: 3, name: "Carol Lee", dept: "Design", status: "Inactive" },+ { id: 4, name: "Dan Wilson", dept: "Engineering", status: "Active" },+ { id: 5, name: "Eve Brown", dept: "Sales", status: "Active" },+ { id: 6, name: "Frank Chen", dept: "Support", status: "Active" },+ { id: 7, name: "Grace Kim", dept: "Product", status: "Active" },+ { id: 8, name: "Hank Davis", dept: "Marketing", status: "Inactive" },]}/>+ </Section>+);++const Demo = () => {+ return (+ <Document>+ <Page size="A4" margin={40}>+ <DemoBody />+ </Page>+ </Document>);-}+};++export default Demo;diff --git a/examples/forme/divider.tsx b/examples/forme/divider.tsxindex aa21c3f..ba7ee33 100644--- a/examples/forme/divider.tsx+++ b/examples/forme/divider.tsx@@ -1,18 +1,34 @@-import { Document, Page } from "@formepdf/react";-import { Divider } from "@/registry/bases/forme/components/divider";+import { Document, Page, View } from "@formepdf/react";+import { Divider, Heading, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View>+ <Heading level={2}>Section 1</Heading>+ <Text>Content here.</Text>+ <Divider />+ <Heading level={2}>Section 2</Heading>+ <Text>More content.</Text>+ <Divider variant="dashed" />+ <Heading level={2}>Section 3</Heading>+ <Text>More content.</Text>+ <Divider variant="dotted" />+ <Heading level={2}>Section 4</Heading>+ <Text>More content.</Text>+ <Divider label="Section Divider" />+ <Heading level={2}>Section 5</Heading>+ <Text>More content.</Text>+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Divider />;-}+export default Demo;diff --git a/examples/forme/form.tsx b/examples/forme/form.tsxindex 24f2ae6..66ecb23 100644--- a/examples/forme/form.tsx+++ b/examples/forme/form.tsx@@ -1,23 +1,48 @@import { Document, Page } from "@formepdf/react";-import { PdfForm } from "@/registry/bases/forme/components/form";+import { PdfForm } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfForm+ title="Job Application"+ subtitle="Please complete all fields clearly in block capitals."+ variant="underline"+ groups={[+ {+ title: "Personal Information",+ fields: [+ { label: "Full Name", hint: "First and last name" },+ { label: "Date of Birth", hint: "DD / MM / YYYY" },+ { label: "Email Address" },+ { label: "Phone Number", hint: "+1 (555) 000-0000" },+ ],+ },+ {+ title: "Address",+ layout: "two-column",+ fields: [+ { label: "Street Address", width: "100%" },+ { label: "City" },+ { label: "State / Province" },+ { label: "Postal Code" },+ ],+ },+ {+ title: "Additional Information",+ fields: [{ label: "Cover Letter", height: 60 }],+ },+ ]}+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <PdfForm- title="Contact"- groups={[{ fields: [{ label: "Email" }, { label: "Phone" }] }]}- />- );-}+export default Demo;diff --git a/examples/forme/graph.tsx b/examples/forme/graph.tsxindex 968e28d..bf24c97 100644--- a/examples/forme/graph.tsx+++ b/examples/forme/graph.tsx@@ -1,27 +1,34 @@import { Document, Page } from "@formepdf/react";-import { PdfGraph } from "@/registry/bases/forme/components/graph";+import { PdfGraph } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfGraph+ variant="bar"+ title="Monthly Revenue"+ subtitle="FY 2025"+ data={[+ { label: "Jan", value: 42_000 },+ { label: "Feb", value: 38_000 },+ { label: "Mar", value: 55_000 },+ { label: "Apr", value: 61_000 },+ { label: "May", value: 49_000 },+ { label: "Jun", value: 72_000 },+ ]}+ showValues+ width={480}+ height={260}+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <PdfGraph- variant="bar"- data={[- { label: "Q1", value: 30 },- { label: "Q2", value: 45 },- { label: "Q3", value: 28 },- ]}- />- );-}+export default Demo;diff --git a/examples/forme/heading.tsx b/examples/forme/heading.tsxindex 5efd327..87cd6e0 100644--- a/examples/forme/heading.tsx+++ b/examples/forme/heading.tsx@@ -1,18 +1,27 @@import { Document, Page } from "@formepdf/react";-import { Heading } from "@/registry/bases/forme/components/heading";+import { Heading, Section } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Main Title</Heading>+ <Heading level={2} align="center" color="primary">+ Subtitle+ </Heading>+ <Heading level={3} style={{ color: "#1e3a5f" }}>+ Custom Styled+ </Heading>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Heading level={1}>Heading</Heading>;-}+export default Demo;diff --git a/examples/forme/invoice-classic.tsx b/examples/forme/invoice-classic.tsxindex e31ef0c..f2d6c98 100644--- a/examples/forme/invoice-classic.tsx+++ b/examples/forme/invoice-classic.tsx@@ -1,6 +1,6 @@import { InvoiceClassicDocument } from "@/registry/bases/forme/blocks/invoice-classic/invoice-classic";-const Demo =() => {+const Demo = () => {return <InvoiceClassicDocument />;-}+};export default Demo;diff --git a/examples/forme/invoice-consultant.tsx b/examples/forme/invoice-consultant.tsxindex 2227f7d..4a1fd6b 100644--- a/examples/forme/invoice-consultant.tsx+++ b/examples/forme/invoice-consultant.tsx@@ -1,6 +1,6 @@import { InvoiceConsultantDocument } from "@/registry/bases/forme/blocks/invoice-consultant/invoice-consultant";-const Demo =() => {+const Demo = () => {return <InvoiceConsultantDocument />;-}+};export default Demo;diff --git a/examples/forme/invoice-corporate.tsx b/examples/forme/invoice-corporate.tsxindex e6bf213..5120dab 100644--- a/examples/forme/invoice-corporate.tsx+++ b/examples/forme/invoice-corporate.tsx@@ -1,6 +1,6 @@import { InvoiceCorporateDocument } from "@/registry/bases/forme/blocks/invoice-corporate/invoice-corporate";-const Demo =() => {+const Demo = () => {return <InvoiceCorporateDocument />;-}+};export default Demo;diff --git a/examples/forme/invoice-creative.tsx b/examples/forme/invoice-creative.tsxindex 6e089f2..20aee85 100644--- a/examples/forme/invoice-creative.tsx+++ b/examples/forme/invoice-creative.tsx@@ -1,6 +1,6 @@import { InvoiceCreativeDocument } from "@/registry/bases/forme/blocks/invoice-creative/invoice-creative";-const Demo =() => {+const Demo = () => {return <InvoiceCreativeDocument />;-}+};export default Demo;diff --git a/examples/forme/invoice-minimal.tsx b/examples/forme/invoice-minimal.tsxindex 233a398..72dfd8a 100644--- a/examples/forme/invoice-minimal.tsx+++ b/examples/forme/invoice-minimal.tsx@@ -1,6 +1,6 @@import { InvoiceMinimalDocument } from "@/registry/bases/forme/blocks/invoice-minimal/invoice-minimal";-const Demo =() => {+const Demo = () => {return <InvoiceMinimalDocument />;-}+};export default Demo;diff --git a/examples/forme/invoice-modern.tsx b/examples/forme/invoice-modern.tsxindex 1676eb7..0c9638e 100644--- a/examples/forme/invoice-modern.tsx+++ b/examples/forme/invoice-modern.tsx@@ -1,6 +1,6 @@import { InvoiceModernDocument } from "@/registry/bases/forme/blocks/invoice-modern/invoice-modern";-const Demo =() => {+const Demo = () => {return <InvoiceModernDocument />;-}+};export default Demo;diff --git a/examples/forme/keep-together.tsx b/examples/forme/keep-together.tsxindex 04fe093..27155c8 100644--- a/examples/forme/keep-together.tsx+++ b/examples/forme/keep-together.tsx@@ -1,23 +1,47 @@import { Document, Page } from "@formepdf/react";-import { KeepTogether } from "@/registry/bases/forme/components/keep-together";-import { Text } from "@/registry/bases/forme/components/text";+import {+ Heading,+ KeepTogether,+ Section,+ Text,+} from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <KeepTogether>+ <Heading level={2}>Section Title</Heading>+ <Section variant="callout" padding="sm">+ <Text noMargin>+ This heading and callout stay together as one atomic block when the+ document flows onto another page.+ </Text>+ </Section>+ </KeepTogether>+ <KeepTogether minPresenceAhead={80}>+ <Heading level={3}>Subsection Heading</Heading>+ <Text>+ Reserve enough room before starting this subsection so its heading is+ never stranded at the bottom of a page.+ </Text>+ </KeepTogether>+ <KeepTogether>+ <Heading level={4}>Signature Block</Heading>+ <Section variant="card" padding="sm">+ <Text noMargin>Approved by: ____________________</Text>+ </Section>+ </KeepTogether>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <KeepTogether>- <Text>Keep these lines together on one page.</Text>- </KeepTogether>- );-}+export default Demo;diff --git a/examples/forme/key-value.tsx b/examples/forme/key-value.tsxindex 05d3a3e..a1dd386 100644--- a/examples/forme/key-value.tsx+++ b/examples/forme/key-value.tsx@@ -1,18 +1,29 @@import { Document, Page } from "@formepdf/react";-import { KeyValue } from "@/registry/bases/forme/components/key-value";+import { KeyValue } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <KeyValue+ direction="horizontal"+ divided+ items={[+ { key: "Invoice #", value: "INV-2026-0042" },+ { key: "Issue Date", value: "15 February 2026" },+ { key: "Due Date", value: "17 March 2026" },+ { key: "Status", value: "Unpaid", valueColor: "destructive" },+ { key: "Total", value: "$4,200.00", valueColor: "primary" },+ ]}+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <KeyValue items={[{ key: "Name", value: "Ada" }]} />;-}+export default Demo;diff --git a/examples/forme/link.tsx b/examples/forme/link.tsxindex eca5209..0e7bee4 100644--- a/examples/forme/link.tsx+++ b/examples/forme/link.tsx@@ -1,18 +1,24 @@import { Document, Page } from "@formepdf/react";-import { Link } from "@/registry/bases/forme/components/link";+import { Link, Section } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Link href="https://pdfcn.dev">Documentation</Link>+ <Link href="#section-1" color="primary">+ Internal link+ </Link>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Link href="https://example.com">Example</Link>;-}+export default Demo;diff --git a/examples/forme/list.tsx b/examples/forme/list.tsxindex b1aba72..21a0bd3 100644--- a/examples/forme/list.tsx+++ b/examples/forme/list.tsx@@ -1,18 +1,35 @@import { Document, Page } from "@formepdf/react";-import { PdfList } from "@/registry/bases/forme/components/list";+import { PdfList } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfList+ variant="bullet"+ items={[+ {+ text: "Design system alignment",+ description: "Match all components to the design specification.",+ },+ {+ text: "Component implementation",+ description: "Build PDF-native components for both renderer bases.",+ },+ {+ text: "Write unit tests",+ description: "Cover all variants and edge cases.",+ },+ ]}+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfList items={[{ text: "Alpha" }, { text: "Beta" }, { text: "Gamma" }]} />;-}+export default Demo;diff --git a/examples/forme/page-break.tsx b/examples/forme/page-break.tsxindex 6e09836..b8f5e53 100644--- a/examples/forme/page-break.tsx+++ b/examples/forme/page-break.tsx@@ -1,25 +1,25 @@-import { Document, Page } from "@formepdf/react";-import { PageBreak } from "@/registry/bases/forme/components/page-break";-import { Text } from "@/registry/bases/forme/components/text";+import { Document, Page, View } from "@formepdf/react";+import { Heading, PageBreak, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View>+ <Heading level={1}>Section 1</Heading>+ <Text>Content on the first page.</Text>+ <PageBreak />+ <Heading level={1}>Section 2</Heading>+ <Text>Content on the second page.</Text>+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <>- <Text>Before</Text>- <PageBreak />- <Text>After</Text>- </>- );-}+export default Demo;diff --git a/examples/forme/page-footer.tsx b/examples/forme/page-footer.tsxindex a85ca25..0669e0d 100644--- a/examples/forme/page-footer.tsx+++ b/examples/forme/page-footer.tsx@@ -1,18 +1,47 @@-import { Document, Page } from "@formepdf/react";-import { PageFooter } from "@/registry/bases/forme/components/page-footer";+import { Document, Page, View } from "@formepdf/react";+import { PageFooter, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View style={{ display: "flex", flexDirection: "column", minHeight: 220 }}>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ Invoice #1042 · Acme Corp · March 2026+ </Text>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ The footer remains visually separated from the document body.+ </Text>+ <View style={{ flex: 1 }} />+ <PageFooter+ leftText="© 2026 Acme Corp"+ centerText="Confidential"+ rightText="Page 1 of 1"+ variant="simple"+ />+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size={{ width: 595, height: 300 }} margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PageFooter leftText="pdfcn" rightText="Confidential" />;-}+export default Demo;diff --git a/examples/forme/page-header.tsx b/examples/forme/page-header.tsxindex 8c06091..6b861b0 100644--- a/examples/forme/page-header.tsx+++ b/examples/forme/page-header.tsx@@ -1,18 +1,47 @@-import { Document, Page } from "@formepdf/react";-import { PageHeader } from "@/registry/bases/forme/components/page-header";+import { Document, Page, View } from "@formepdf/react";+import { PageHeader, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View>+ <PageHeader+ title="Invoice #1042"+ subtitle="Acme Corp"+ rightText="March 2026"+ rightSubText="Due: 2026-03-31"+ variant="simple"+ />+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ Prepared for Northwind Industries+ </Text>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ This document demonstrates the simple page header variant.+ </Text>+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size={{ width: 595, height: 240 }} margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PageHeader title="Company" subtitle="Invoice" />;-}+export default Demo;diff --git a/examples/forme/page-number.tsx b/examples/forme/page-number.tsxindex 17ae9ba..81c6b80 100644--- a/examples/forme/page-number.tsx+++ b/examples/forme/page-number.tsx@@ -1,18 +1,37 @@-import { Document, Page } from "@formepdf/react";-import { PdfPageNumber } from "@/registry/bases/forme/components/page-number";+import { Document, Page, View } from "@formepdf/react";+import {+ Heading,+ PdfPageNumber,+ Text,+} from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View style={{ minHeight: 680, position: "relative" }}>+ <View style={{ marginBottom: 60 }}>+ <Heading level={1}>Multi-Page Report</Heading>+ <Text>+ Page numbers make long reports easier to review, reference, and print.+ </Text>+ <Text>+ The format token displays the current page together with the total page+ count.+ </Text>+ </View>+ <View style={{ bottom: 0, left: 0, position: "absolute", right: 0 }}>+ <PdfPageNumber format="Page 1 of 1" align="center" />+ </View>+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfPageNumber />;-}+export default Demo;diff --git a/examples/forme/pdf-image.tsx b/examples/forme/pdf-image.tsxindex f3cda38..d872a3d 100644--- a/examples/forme/pdf-image.tsx+++ b/examples/forme/pdf-image.tsx@@ -1,19 +1,26 @@import { Document, Page } from "@formepdf/react";-import { PdfImage } from "@/registry/bases/forme/components/pdf-image";-import { Text } from "@/registry/bases/forme/components/text";+import { PREVIEW_IMAGE_DATA_URI } from "@/examples/preview-assets";+import { PdfImage } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfImage+ src={PREVIEW_IMAGE_DATA_URI}+ variant="default"+ height={120}+ width={200}+ caption="Variant: default"+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Text>PdfImage demo — pass src in your document.</Text>;-}+export default Demo;diff --git a/examples/forme/qrcode.tsx b/examples/forme/qrcode.tsxindex 286458a..5de53ce 100644--- a/examples/forme/qrcode.tsx+++ b/examples/forme/qrcode.tsx@@ -1,18 +1,45 @@import { Document, Page } from "@formepdf/react";-import { PdfQRCode } from "@/registry/bases/forme/components/qrcode";+import {+ Heading,+ PdfQRCode,+ Section,+ Stack,+ Text,+} from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Invoice #12345</Heading>+ <Text>Amount Due: $500.00</Text>+ <Section>+ <Stack direction="horizontal" gap="lg" align="start">+ <PdfQRCode+ value="https://pdfcn.dev/pay/invoice-12345"+ size={100}+ caption="Scan to pay"+ />+ <PdfQRCode+ value="https://pdfcn.dev/verify/invoice-12345"+ size={80}+ caption="Verify document"+ />+ </Stack>+ </Section>+ <Text variant="sm" color="mutedForeground">+ QR codes are rendered as crisp vector graphics in the generated PDF.+ </Text>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfQRCode value="https://pdfcn.dev" />;-}+export default Demo;diff --git a/examples/forme/report-financial.tsx b/examples/forme/report-financial.tsxindex a5e7654..5c3957d 100644--- a/examples/forme/report-financial.tsx+++ b/examples/forme/report-financial.tsx@@ -1,6 +1,6 @@import { FinancialReportDocument } from "@/registry/bases/forme/blocks/report-financial/report-financial";-const Demo =() => {+const Demo = () => {return <FinancialReportDocument />;-}+};export default Demo;diff --git a/examples/forme/report-marketing.tsx b/examples/forme/report-marketing.tsxindex 2ad11c9..1b8ae5a 100644--- a/examples/forme/report-marketing.tsx+++ b/examples/forme/report-marketing.tsx@@ -1,6 +1,6 @@import { MarketingReportDocument } from "@/registry/bases/forme/blocks/report-marketing/report-marketing";-const Demo =() => {+const Demo = () => {return <MarketingReportDocument />;-}+};export default Demo;diff --git a/examples/forme/report-operations.tsx b/examples/forme/report-operations.tsxindex 92f8e52..c6089e6 100644--- a/examples/forme/report-operations.tsx+++ b/examples/forme/report-operations.tsx@@ -1,6 +1,6 @@import { OperationsReportDocument } from "@/registry/bases/forme/blocks/report-operations/report-operations";-const Demo =() => {+const Demo = () => {return <OperationsReportDocument />;-}+};export default Demo;diff --git a/examples/forme/report-security.tsx b/examples/forme/report-security.tsxindex 826abbc..576f133 100644--- a/examples/forme/report-security.tsx+++ b/examples/forme/report-security.tsx@@ -1,6 +1,6 @@import { SecurityReportDocument } from "@/registry/bases/forme/blocks/report-security/report-security";-const Demo =() => {+const Demo = () => {return <SecurityReportDocument />;-}+};export default Demo;diff --git a/examples/forme/section.tsx b/examples/forme/section.tsxindex 91ea2ac..46cdd6c 100644--- a/examples/forme/section.tsx+++ b/examples/forme/section.tsx@@ -1,19 +1,30 @@import { Document, Page } from "@formepdf/react";-import { Section } from "@/registry/bases/forme/components/section";-import { Text } from "@/registry/bases/forme/components/text";+import { Heading, Section, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Section spacing="lg">+ <Heading level={2}>Introduction</Heading>+ <Text>+ This section uses generous spacing for a primary document area.+ </Text>+ </Section>+ <Section spacing="md">+ <Heading level={2}>Details</Heading>+ <Text>This section groups related content with medium spacing.</Text>+ </Section>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Section><Text>Section body</Text></Section>;-}+export default Demo;diff --git a/examples/forme/signature.tsx b/examples/forme/signature.tsxindex 416a07c..b63c422 100644--- a/examples/forme/signature.tsx+++ b/examples/forme/signature.tsx@@ -1,18 +1,25 @@import { Document, Page } from "@formepdf/react";-import { PdfSignatureBlock } from "@/registry/bases/forme/components/signature";+import { PdfSignatureBlock } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <PdfSignatureBlock+ variant="single"+ label="Authorized By"+ name="John Doe"+ title="CEO, Acme Corp"+ date="15 February 2026"+ />+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfSignatureBlock name="Jane Doe" label="Authorized Signature" />;-}+export default Demo;diff --git a/examples/forme/stack.tsx b/examples/forme/stack.tsxindex b41586f..3d50141 100644--- a/examples/forme/stack.tsx+++ b/examples/forme/stack.tsx@@ -1,24 +1,33 @@import { Document, Page } from "@formepdf/react";-import { Stack } from "@/registry/bases/forme/components/stack";-import { Text } from "@/registry/bases/forme/components/text";+import {+ Divider,+ Heading,+ Stack,+ Text,+} from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Stack gap="md">+ <Heading level={2}>Section</Heading>+ <Text>First paragraph in the stack.</Text>+ <Text>Second paragraph with consistent spacing.</Text>+ <Divider spacing="lg" />+ <Stack gap="lg">+ <Heading level={3}>Wider gap</Heading>+ <Text>Content grouped with a larger vertical rhythm.</Text>+ </Stack>+ </Stack>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <Stack gap="md">- <Text>One</Text>- <Text>Two</Text>- </Stack>- );-}+export default Demo;diff --git a/examples/forme/table.tsx b/examples/forme/table.tsxindex 8268a34..ecb4979 100644--- a/examples/forme/table.tsx+++ b/examples/forme/table.tsx@@ -1,33 +1,63 @@import { Document, Page } from "@formepdf/react";-import { Table } from "@/registry/bases/forme/components/table";-import { TableBody, TableCell, TableHeader, TableRow, Text } from "@/registry/bases/forme/components";-const Demo =() => {+import {+ Table,+ TableBody,+ TableCell,+ TableFooter,+ TableHeader,+ TableRow,+} from "@/registry/bases/forme/components";++const DemoBody = () => (+ <Table variant="line" zebraStripe={false}>+ <TableHeader>+ <TableRow header>+ <TableCell>Item</TableCell>+ <TableCell align="center">Qty</TableCell>+ <TableCell align="right">Price</TableCell>+ <TableCell align="right">Total</TableCell>+ </TableRow>+ </TableHeader>+ <TableBody>+ <TableRow>+ <TableCell>Design</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$150.00</TableCell>+ <TableCell align="right">$150.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Development</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Testing</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$800.00</TableCell>+ <TableCell align="right">$800.00</TableCell>+ </TableRow>+ </TableBody>+ <TableFooter>+ <TableRow footer>+ <TableCell>Total</TableCell>+ <TableCell> </TableCell>+ <TableCell> </TableCell>+ <TableCell align="right">$3,450.00</TableCell>+ </TableRow>+ </TableFooter>+ </Table>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-const DemoBody =() => {- return (- <Table>- <TableHeader>- <TableRow>- <TableCell><Text>Item</Text></TableCell>- <TableCell><Text>Qty</Text></TableCell>- </TableRow>- </TableHeader>- <TableBody>- <TableRow>- <TableCell><Text>Widget</Text></TableCell>- <TableCell><Text>2</Text></TableCell>- </TableRow>- </TableBody>- </Table>- );-}+export default Demo;diff --git a/examples/forme/text.tsx b/examples/forme/text.tsxindex 9318acb..d885357 100644--- a/examples/forme/text.tsx+++ b/examples/forme/text.tsx@@ -1,18 +1,27 @@import { Document, Page } from "@formepdf/react";-import { Text } from "@/registry/bases/forme/components/text";+import { Section, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <Section spacing="none">+ <Text>+ Default body text for paragraphs, descriptions, and document content.+ </Text>+ <Text variant="xs" color="mutedForeground">+ Caption text for metadata and supporting details.+ </Text>+ <Text variant="lg">Lead paragraph with a larger typographic scale.</Text>+ </Section>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={30}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Text>Hello from pdfcn forme</Text>;-}+export default Demo;diff --git a/examples/forme/watermark.tsx b/examples/forme/watermark.tsxindex 61e3841..7a36ed0 100644--- a/examples/forme/watermark.tsx+++ b/examples/forme/watermark.tsx@@ -1,24 +1,31 @@-import { Document, Page } from "@formepdf/react";-import { PdfWatermark } from "@/registry/bases/forme/components/watermark";-import { Text } from "@/registry/bases/forme/components/text";+import { Document, Page, View } from "@formepdf/react";+import { Heading, PdfWatermark, Text } from "@/registry/bases/forme/components";-const Demo =() => {+const DemoBody = () => (+ <View style={{ minHeight: 680, position: "relative" }}>+ <PdfWatermark text="DRAFT" />+ <Heading level={1}>Draft Document</Heading>+ <Text>+ This report is under review and should not be distributed externally.+ </Text>+ <Text>+ The watermark sits behind the content while remaining clearly visible.+ </Text>+ <Text>+ Use watermarks for draft, confidential, sample, or approval states.+ </Text>+ </View>+);++const Demo = () => {return (<Document>- <Page size="A4" margin={48}>+ <Page size="A4" margin={40}><DemoBody /></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <>- <PdfWatermark text="DRAFT" />- <Text>Document content</Text>- </>- );-}+export default Demo;diff --git a/examples/preview-assets.ts b/examples/preview-assets.tsnew file mode 100644index 0000000..b8a179b--- /dev/null+++ b/examples/preview-assets.ts@@ -0,0 +1,20 @@+export const PREVIEW_IMAGE_DATA_URI =+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAAABmJLR0QA/wD/AP+gvaeTAAAJFUlEQVR4nO2dbUwU2xnHf7uswMqLQkDRYK+oaRvDSyKRxFQUr4KmSJUYo4namoompdaYED9p0FQTE2O11zYxIv1SojHGCBI15aUoBsTbohGhpMSCehFfiCDgIiywO/0wemVlZ9ldZmdml/klJyHncM75z3lmZ545rwamxkLgW2AF8HNgMTATmDXFcrVKP/AR+B/QBtwHaoAXSoqIBA4AjYCgBwTg38AfgIgptOukhAN/BN5r4IK1GnqBY0CYd00sza+AHzRwgf4SXgA5XrX0V4QAf9HABfljsAPfAcEet/onwoEKDVyIv4caxPemR0QivljUFh8o4V948IIOQbSa2qIDLVTj5uPorxoQG6jhz5M1/iYNiAzkYAc2jm9ww7i/ZwL/Qfy61fEdPwBLgUGAoHEJRxB/ATq+ZRZgBWrhyy8gEngORKmjadrRi/ik+WD8FLEbvfGVJBr4DcBnA/xaPS3Tll0gPoIWAs9UlTJ9+cYErFWqtsjISNasWUNwsOP3SHd3N7W1tUrJwGAwsGrVKubMmeMQPzIywp07dxgYGFBKyhqAiyjkB9fX1wtS7N+/XzF//MCBA5I66urqlPwuuGBEHMlShKSkJMm05ORkpWSQmJioCR3Az4xAgpI16jiwyEjgjt/6A7OMiF0QOuoQbuTLt4BPiYyMxGw2K1HVlDCbzURE+HRsfTxGk9wlxsTEsH37dsLCvoxLGwwGsrOzMZmkq2toaJBMW7FiBStXrsRodO9esdvt1NXVSZb54MED9u7d6zTNZDJx+/Ztbt26hSAIP8YPDg5y5coV3r1755YGdzEgukOyUV5eTk6O8/Fou93OoUOHePLkiUP8mzdvaGlpcZonPj6ejo4OZsyY4ZGO0dFREhIS6OrqcpqemJhIXFycQ1xKSgqnTp2SNHR5eTmbNsnfXymrb9vU1CTpY9+/f9/j8tLS0iTLm4y0tDSP62toaJAsr6mpSfZvAUWe/5/5+PGjktV5xeDgoKL1KWoAnYnoBlAZWQ1gNpuZP3++ZLrdbve4zEWLFnmtJyHB84/88Z7P18ybN4/Q0FCv9TjDKzd07ty5HDx4kOjoaIf45cuXExMT4zSPIAiUl5dLlpmZmcnmzZsdXNXg4GByc3O9kQjAhQsX2LBhAyMjIz/GjY2NUVZWRlVVldM85eXlrF27FoPBMCEtNjaW+vp6GhsbHeJ7e3s5e/Ys3d3dHmv0yg0tLi5mz549TtMEQSA/P5/KykqH+IGBAUkf2mw209vbK3l3PX36lB07dtDT0+OWvpiYGC5dusSSJUucpg8PDxMVFcXw8LBk/shIx8lsWVlZnD9/XrLOixcvsm/fPrf0fY3HrlNpaamkq9bZ2elxebGxsS7dyaNHj3pc5rFjx1yWGRsb63GZnZ2dkuWVlpZqww0d/3OXi9HRUU3o8EWZuhekMroBVCZgDTA2NjaldKUIWAPcuHGDjo6OCfFjY2OUlJTw/v17FVRNRPbuaK3Q1tbG4sWL1ZYxKQH7C/AXdAOojG4AlfELAzjrlwkUNGEAq9XqMn316tUeD0n6C5rwggYGBjhx4gTbtm0jKOjLmpHg4GDi4+PJzMzk1atXbs/ZtNls1NTUkJ+f71UXuNLI2hnX3t4u65hpYWGhy041VyQnJ8uqpb29XfudcXJTUVHhdV65B098geYNILgYoQoENG+AQCegDTD+ha5VNG8Ai8Xidd6dO3dq3n3VhBvqitbWVg4fPkxGRobbH2SxsbGkpKSQn59Pfn6+Q9ro6CiXL19m9+7dPlDrHZp2Q70N165dc+miRkVF6W6oL3n06JHLdFcztZUkYA3gL+gGUBndACqjjQchYpdzfHz8BLfx9evXDA0NqaTK92jCAAaDgdraWtLT0yekWSwWMjIyePjwoQrKfI8mHkHR0dFOGx8gPDyczMxMhRUphyYMMNniO3cX5/kjgXtlfoJuAJWR3QAzZ8q/8N6bBd6+0OGLMr3ygjo7OyXT4uLiOHnyJGVlZQ7zL0dGRmhpaXE6wNLf309fXx+zZ892WmZeXh6PHz/m+fPnbulbuHCh5AISgL6+Pvr7+52mGQwGEhMTHfY0MplM5ObmTlhXPJ4XL7w7QsCrFTJhYWHs2rWLWbMc9/lIT08nOztbMt/x48cpLCx0mpaUlMT69esd+vBDQkLIy8tjwYIFnkoExBuluLjYYdaFzWajoqKC5uZmSY1HjhyRLPPmzZvU1dU5xPX391NSUuL1ElfZeiCDgoKErq4uyR7D6upqj8vMyclx2avpio0bN3pcX3V1tWR5L1++FIKCgmTttZX1HWCz2WTfS+Ht27de5/Vm0Zwrenp6sNlsspape0EqoxtAZRQ1gJSXoyWiopTdv1b2zrjm5mbJje9SU1M5d+4c9fX1DlMGP3z4QGVlpdNphM+ePcNisRAeHu6RDovF4nSFDIhdG1lZWQ4bMxmNRlauXMmyZcsky/x6mx05kH2/oNDQUNatW+fw8WQ0GtmyZQtbt26VzFdQUMCZM2ecpiUkJJCamur2oLwgCDQ2Nkp+NxQUFHD69GnJ/FevXuX69esON8TQ0BBVVVWTTiT2BkUGyUNCQgSr1Srp4hUVFSmiAxCKiookdVitViEkJEQxLUbEQwV8jtVq9cndIzcK67QbEY/m01EHixHxfEQddeg3ouDO6YIfzHRWWGOHEfivUrVJ7ZAuCAJ3795VSgb37t2TbGgldQBtBuC3wN+UqM1kMrF06dIJMx96enrc7mqWi4SEhAkbTo2OjtLa2qrkNga7DcA3iOfH6CjPT4yIJ382TvafOrLzPdD5uS/o72oqmaaUwJdjrCIQfwn6SUrKMOEYqw/AOdXkTD/OIra5fpShCjgcZTh+POAjcACZe0d1HBCA3/Gp8aX4DoV6Aqdh+JOrhv9MMOLhw2qLDbRQCbi9ZDMC8RhutUUHSvgeD440/0w48A8NiPf38E/E02q9IhjxGG67Bi7E34IdOIMHjx1XbETsL1L7ovwlPAN+6U1Du2ImUAj0aOACtRreIZ5M7tOz2SKA/YgvFrUvWCvhAfB7xPemR0x1N7wFwLfAL4CfAks+iQjU4xH7AAvQDrQB94EaQHq+/iT8HztSCshZB914AAAAAElFTkSuQmCC";++export const replacePreviewImageSources = <T>(value: T): T => {+ if (value === "/favicon.png") {+ return PREVIEW_IMAGE_DATA_URI as T;+ }+ if (Array.isArray(value)) {+ return value.map((item) => replacePreviewImageSources(item)) as T;+ }+ if (value && typeof value === "object") {+ return Object.fromEntries(+ Object.entries(value).map(([key, item]) => [+ key,+ replacePreviewImageSources(item),+ ])+ ) as T;+ }+ return value;+};diff --git a/examples/preview-config.ts b/examples/preview-config.tsnew file mode 100644index 0000000..4bc5166--- /dev/null+++ b/examples/preview-config.ts@@ -0,0 +1,56 @@+import type { RenderOptions } from "takumi-pdf";++import { pointToCssPixel } from "@/registry/bases/takumi/lib/takumi-primitives";++const DEFAULT_MARGIN = 40;++const BLOCK_NAMES = new Set([+ "invoice-classic",+ "invoice-consultant",+ "invoice-corporate",+ "invoice-creative",+ "invoice-minimal",+ "invoice-modern",+ "report-financial",+ "report-marketing",+ "report-operations",+ "report-security",+]);++const COMPONENT_MARGINS: Record<string, number> = {+ divider: 30,+ heading: 30,+ link: 30,+ "page-break": 30,+ "page-footer": 30,+ "page-header": 30,+ section: 30,+ stack: 30,+ text: 30,+};++const COMPONENT_SIZES: Record<+ string,+ Extract<RenderOptions, { viewport?: never }>["size"]+> = {+ badge: { height: pointToCssPixel(200), width: pointToCssPixel(595) },+ "page-footer": {+ height: pointToCssPixel(300),+ width: pointToCssPixel(595),+ },+ "page-header": {+ height: pointToCssPixel(240),+ width: pointToCssPixel(595),+ },+};++export const getTakumiPreviewOptions = (name: string): RenderOptions => {+ const margin = BLOCK_NAMES.has(name)+ ? 0+ : pointToCssPixel(COMPONENT_MARGINS[name] ?? DEFAULT_MARGIN);++ return {+ margin: { bottom: margin, left: margin, right: margin, top: margin },+ size: COMPONENT_SIZES[name] ?? "a4",+ };+};diff --git a/examples/takumi/alert.tsx b/examples/takumi/alert.tsxindex 93a0326..43bc211 100644--- a/examples/takumi/alert.tsx+++ b/examples/takumi/alert.tsx@@ -1,9 +1,37 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Heading,+ PdfAlert,+ Section,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfAlert } from "@/registry/bases/takumi/components/alert";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Document Alerts</Heading>+ <Text>+ The PdfAlert component displays callout boxes with different severity+ levels.+ </Text>+ <Section>+ <PdfAlert variant="info" title="Information">+ This document contains important information about your account.+ </PdfAlert>+ <PdfAlert variant="success" title="Success">+ Your payment has been processed successfully.+ </PdfAlert>+ <PdfAlert variant="warning" title="Warning">+ Please review the terms and conditions before proceeding.+ </PdfAlert>+ <PdfAlert variant="error" title="Error">+ Missing required fields. Please complete all sections.+ </PdfAlert>+ </Section>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +41,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfAlert variant="info" title="Info">Alert body</PdfAlert>;-}+export default Demo;diff --git a/examples/takumi/badge.tsx b/examples/takumi/badge.tsxindex 9fe4a1d..debb38d 100644--- a/examples/takumi/badge.tsx+++ b/examples/takumi/badge.tsx@@ -1,21 +1,37 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Badge } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Badge } from "@/registry/bases/takumi/components/badge";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View+ style={{+ display: "flex",+ flexDirection: "row",+ flexWrap: "wrap",+ gap: 6,+ marginBottom: 12,+ }}+ >+ <Badge label="Small" variant="default" size="sm" />+ <Badge label="Medium" variant="default" size="md" />+ <Badge label="Large" variant="default" size="lg" />+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document>- <Page size="A4">+ <Page size={{ width: 595, height: 200 }}><PdfcnThemeProvider><DemoBody /></PdfcnThemeProvider></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Badge>Badge</Badge>;-}+export default Demo;diff --git a/examples/takumi/card.tsx b/examples/takumi/card.tsxindex 7af6041..524d380 100644--- a/examples/takumi/card.tsx+++ b/examples/takumi/card.tsx@@ -1,9 +1,17 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfCard, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfCard } from "@/registry/bases/takumi/components/card";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfCard title="Project Summary" variant="default" padding="md">+ <Text noMargin>+ This card groups related content with a title and body area. Use cards to+ visually separate sections of your PDF document.+ </Text>+ </PdfCard>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +21,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfCard title="Card">Card body</PdfCard>;-}+export default Demo;diff --git a/examples/takumi/data-table.tsx b/examples/takumi/data-table.tsxindex aa87c1b..59b88b8 100644--- a/examples/takumi/data-table.tsx+++ b/examples/takumi/data-table.tsx@@ -1,9 +1,38 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ DataTable,+ Heading,+ Section,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { DataTable } from "@/registry/bases/takumi/components/data-table";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={3}>Team Directory</Heading>+ <DataTable+ size="compact"+ variant="striped"+ columns={[+ { key: "id", header: "ID", align: "center" },+ { key: "name", header: "Name" },+ { key: "dept", header: "Department" },+ { key: "status", header: "Status", align: "center" },+ ]}+ data={[+ { id: 1, name: "Alice Johnson", dept: "Engineering", status: "Active" },+ { id: 2, name: "Bob Smith", dept: "Marketing", status: "Active" },+ { id: 3, name: "Carol Lee", dept: "Design", status: "Inactive" },+ { id: 4, name: "Dan Wilson", dept: "Engineering", status: "Active" },+ { id: 5, name: "Eve Brown", dept: "Sales", status: "Active" },+ { id: 6, name: "Frank Chen", dept: "Support", status: "Active" },+ { id: 7, name: "Grace Kim", dept: "Product", status: "Active" },+ { id: 8, name: "Hank Davis", dept: "Marketing", status: "Inactive" },+ ]}+ />+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,20 +42,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <DataTable- columns={[- { key: "name", header: "Name" },- { key: "price", header: "Price" },- ]}- data={[- { name: "Widget", price: "$10" },- { name: "Gadget", price: "$20" },- ]}- />- );-}+export default Demo;diff --git a/examples/takumi/divider.tsx b/examples/takumi/divider.tsxindex 3f21b83..42650c6 100644--- a/examples/takumi/divider.tsx+++ b/examples/takumi/divider.tsx@@ -1,9 +1,31 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Divider, Heading, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Divider } from "@/registry/bases/takumi/components/divider";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View>+ <Heading level={2}>Section 1</Heading>+ <Text>Content here.</Text>+ <Divider />+ <Heading level={2}>Section 2</Heading>+ <Text>More content.</Text>+ <Divider variant="dashed" />+ <Heading level={2}>Section 3</Heading>+ <Text>More content.</Text>+ <Divider variant="dotted" />+ <Heading level={2}>Section 4</Heading>+ <Text>More content.</Text>+ <Divider label="Section Divider" />+ <Heading level={2}>Section 5</Heading>+ <Text>More content.</Text>+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +35,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Divider />;-}+export default Demo;diff --git a/examples/takumi/form.tsx b/examples/takumi/form.tsxindex 301e5b0..c0aea1d 100644--- a/examples/takumi/form.tsx+++ b/examples/takumi/form.tsx@@ -1,9 +1,41 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfForm } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfForm } from "@/registry/bases/takumi/components/form";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfForm+ title="Job Application"+ subtitle="Please complete all fields clearly in block capitals."+ variant="underline"+ groups={[+ {+ title: "Personal Information",+ fields: [+ { label: "Full Name", hint: "First and last name" },+ { label: "Date of Birth", hint: "DD / MM / YYYY" },+ { label: "Email Address" },+ { label: "Phone Number", hint: "+1 (555) 000-0000" },+ ],+ },+ {+ title: "Address",+ layout: "two-column",+ fields: [+ { label: "Street Address", width: "100%" },+ { label: "City" },+ { label: "State / Province" },+ { label: "Postal Code" },+ ],+ },+ {+ title: "Additional Information",+ fields: [{ label: "Cover Letter", height: 60 }],+ },+ ]}+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,14 +45,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <PdfForm- title="Contact"- groups={[{ fields: [{ label: "Email" }, { label: "Phone" }] }]}- />- );-}+export default Demo;diff --git a/examples/takumi/graph.tsx b/examples/takumi/graph.tsxindex ab147f7..4273a5a 100644--- a/examples/takumi/graph.tsx+++ b/examples/takumi/graph.tsx@@ -1,9 +1,27 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfGraph } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfGraph } from "@/registry/bases/takumi/components/graph";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfGraph+ variant="bar"+ title="Monthly Revenue"+ subtitle="FY 2025"+ data={[+ { label: "Jan", value: 42_000 },+ { label: "Feb", value: 38_000 },+ { label: "Mar", value: 55_000 },+ { label: "Apr", value: 61_000 },+ { label: "May", value: 49_000 },+ { label: "Jun", value: 72_000 },+ ]}+ showValues+ width={480}+ height={260}+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,18 +31,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <PdfGraph- variant="bar"- data={[- { label: "Q1", value: 30 },- { label: "Q2", value: 45 },- { label: "Q3", value: 28 },- ]}- />- );-}+export default Demo;diff --git a/examples/takumi/heading.tsx b/examples/takumi/heading.tsxindex 42ed7ab..141292a 100644--- a/examples/takumi/heading.tsx+++ b/examples/takumi/heading.tsx@@ -1,9 +1,20 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Heading, Section } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Heading } from "@/registry/bases/takumi/components/heading";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Main Title</Heading>+ <Heading level={2} align="center" color="primary">+ Subtitle+ </Heading>+ <Heading level={3} style={{ color: "#1e3a5f" }}>+ Custom Styled+ </Heading>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +24,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Heading level={1}>Heading</Heading>;-}+export default Demo;diff --git a/examples/takumi/invoice-classic.tsx b/examples/takumi/invoice-classic.tsxindex 3307bdc..671f578 100644--- a/examples/takumi/invoice-classic.tsx+++ b/examples/takumi/invoice-classic.tsx@@ -1,6 +1,6 @@import { InvoiceClassicDocument } from "@/registry/bases/takumi/blocks/invoice-classic/invoice-classic";-const Demo =() => {+const Demo = () => {return <InvoiceClassicDocument />;-}+};export default Demo;diff --git a/examples/takumi/invoice-consultant.tsx b/examples/takumi/invoice-consultant.tsxindex 82ae4e6..2479407 100644--- a/examples/takumi/invoice-consultant.tsx+++ b/examples/takumi/invoice-consultant.tsx@@ -1,6 +1,6 @@import { InvoiceConsultantDocument } from "@/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant";-const Demo =() => {+const Demo = () => {return <InvoiceConsultantDocument />;-}+};export default Demo;diff --git a/examples/takumi/invoice-corporate-playground.tsx b/examples/takumi/invoice-corporate-playground.tsxindex 50d1fc0..1e4dfc9 100644--- a/examples/takumi/invoice-corporate-playground.tsx+++ b/examples/takumi/invoice-corporate-playground.tsx@@ -1,29 +1,33 @@const sampleData = {- invoiceNumber: "INV-2026-004",- invoiceDate: "February 22, 2026",- dueDate: "March 24, 2026",- companyName: "Your Company",- subtitle: "Professional Services",- companyAddress: "City, Country",billTo: {- name: "Global Industries Ltd.",address: "100 Corporate Plaza, Tower B",email: "[email protected]",+ name: "Global Industries Ltd.",phone: "+1 (555) 888-9999",},+ companyAddress: "City, Country",+ companyName: "Your Company",+ dueDate: "March 24, 2026",+ invoiceDate: "February 22, 2026",+ invoiceNumber: "INV-2026-004",items: [- { description: "Enterprise Software License", quantity: 5, unitPrice: 4500 },- { description: "Implementation Services", quantity: 1, unitPrice: 18000 },+ {+ description: "Enterprise Software License",+ quantity: 5,+ unitPrice: 4500,+ },+ { description: "Implementation Services", quantity: 1, unitPrice: 18_000 },{ description: "Training Workshop", quantity: 3, unitPrice: 2500 },{ description: "Annual Support Package", quantity: 1, unitPrice: 8500 },],- summary: { subtotal: 57000, tax: 4560, total: 61560 },+ notes: "Corporate billing – Net 30 terms apply.",paymentTerms: {dueDate: "March 24, 2026",- method: "Wire Transfer / Corporate Account",gst: "GSTIN 987654321",+ method: "Wire Transfer / Corporate Account",},- notes: "Corporate billing – Net 30 terms apply.",+ subtitle: "Professional Services",+ summary: { subtotal: 57_000, tax: 4560, total: 61_560 },};const money = (v: number) => `$${v.toLocaleString("en-US")}`;@@ -69,8 +73,12 @@ export default function InvoiceCorporate() {<div key={item.description} tw="flex break-inside-avoid pt-3 text-xs"><span tw="flex-1">{item.description}</span><span tw="w-[60px] text-right text-[#687385]">{item.quantity}</span>- <span tw="w-[100px] text-right text-[#687385]">{money(item.unitPrice)}</span>- <span tw="w-[100px] text-right">{money(item.quantity * item.unitPrice)}</span>+ <span tw="w-[100px] text-right text-[#687385]">+ {money(item.unitPrice)}+ </span>+ <span tw="w-[100px] text-right">+ {money(item.quantity * item.unitPrice)}+ </span></div>))}@@ -97,16 +105,14 @@ export default function InvoiceCorporate() {<p tw="m-0 mt-1">{d.paymentTerms.gst}</p></div>- {d.notes && (- <p tw="mt-8 mb-0 text-[11px] text-[#687385]">{d.notes}</p>- )}+ {d.notes && <p tw="mt-8 mb-0 text-[11px] text-[#687385]">{d.notes}</p>}</div>);}export const options: PlaygroundOptions = {pdf: {- size: "a4",margin: 48,+ size: "a4",},};diff --git a/examples/takumi/invoice-corporate.tsx b/examples/takumi/invoice-corporate.tsxindex 4b7c6ef..ecc865c 100644--- a/examples/takumi/invoice-corporate.tsx+++ b/examples/takumi/invoice-corporate.tsx@@ -1,6 +1,6 @@import { InvoiceCorporateDocument } from "@/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate";-const Demo =() => {+const Demo = () => {return <InvoiceCorporateDocument />;-}+};export default Demo;diff --git a/examples/takumi/invoice-creative.tsx b/examples/takumi/invoice-creative.tsxindex e26c571..dcb89c1 100644--- a/examples/takumi/invoice-creative.tsx+++ b/examples/takumi/invoice-creative.tsx@@ -1,6 +1,6 @@import { InvoiceCreativeDocument } from "@/registry/bases/takumi/blocks/invoice-creative/invoice-creative";-const Demo =() => {+const Demo = () => {return <InvoiceCreativeDocument />;-}+};export default Demo;diff --git a/examples/takumi/invoice-minimal.tsx b/examples/takumi/invoice-minimal.tsxindex 115ef7f..5ad55af 100644--- a/examples/takumi/invoice-minimal.tsx+++ b/examples/takumi/invoice-minimal.tsx@@ -1,6 +1,6 @@import { InvoiceMinimalDocument } from "@/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal";-const Demo =() => {+const Demo = () => {return <InvoiceMinimalDocument />;-}+};export default Demo;diff --git a/examples/takumi/invoice-modern.tsx b/examples/takumi/invoice-modern.tsxindex e127091..78c778d 100644--- a/examples/takumi/invoice-modern.tsx+++ b/examples/takumi/invoice-modern.tsx@@ -1,6 +1,6 @@import { InvoiceModernDocument } from "@/registry/bases/takumi/blocks/invoice-modern/invoice-modern";-const Demo =() => {+const Demo = () => {return <InvoiceModernDocument />;-}+};export default Demo;diff --git a/examples/takumi/keep-together.tsx b/examples/takumi/keep-together.tsxindex 16b9740..9772107 100644--- a/examples/takumi/keep-together.tsx+++ b/examples/takumi/keep-together.tsx@@ -1,10 +1,40 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Heading,+ KeepTogether,+ Section,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { KeepTogether } from "@/registry/bases/takumi/components/keep-together";-import { Text } from "@/registry/bases/takumi/components/text";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <KeepTogether>+ <Heading level={2}>Section Title</Heading>+ <Section variant="callout" padding="sm">+ <Text noMargin>+ This heading and callout stay together as one atomic block when the+ document flows onto another page.+ </Text>+ </Section>+ </KeepTogether>+ <KeepTogether minPresenceAhead={80}>+ <Heading level={3}>Subsection Heading</Heading>+ <Text>+ Reserve enough room before starting this subsection so its heading is+ never stranded at the bottom of a page.+ </Text>+ </KeepTogether>+ <KeepTogether>+ <Heading level={4}>Signature Block</Heading>+ <Section variant="card" padding="sm">+ <Text noMargin>Approved by: ____________________</Text>+ </Section>+ </KeepTogether>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,13 +44,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <KeepTogether>- <Text>Keep these lines together on one page.</Text>- </KeepTogether>- );-}+export default Demo;diff --git a/examples/takumi/key-value.tsx b/examples/takumi/key-value.tsxindex 5582df4..4d600ac 100644--- a/examples/takumi/key-value.tsx+++ b/examples/takumi/key-value.tsx@@ -1,9 +1,22 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { KeyValue } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { KeyValue } from "@/registry/bases/takumi/components/key-value";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <KeyValue+ direction="horizontal"+ divided+ items={[+ { key: "Invoice #", value: "INV-2026-0042" },+ { key: "Issue Date", value: "15 February 2026" },+ { key: "Due Date", value: "17 March 2026" },+ { key: "Status", value: "Unpaid", valueColor: "destructive" },+ { key: "Total", value: "$4,200.00", valueColor: "primary" },+ ]}+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +26,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <KeyValue items={[{ key: "Name", value: "Ada" }]} />;-}+export default Demo;diff --git a/examples/takumi/link.tsx b/examples/takumi/link.tsxindex 3014780..d8f43b1 100644--- a/examples/takumi/link.tsx+++ b/examples/takumi/link.tsx@@ -1,9 +1,17 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Link, Section } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Link } from "@/registry/bases/takumi/components/link";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Link href="https://pdfcn.dev">Documentation</Link>+ <Link href="#section-1" color="primary">+ Internal link+ </Link>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +21,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Link href="https://example.com">Example</Link>;-}+export default Demo;diff --git a/examples/takumi/list.tsx b/examples/takumi/list.tsxindex 76b6a6c..a80a369 100644--- a/examples/takumi/list.tsx+++ b/examples/takumi/list.tsx@@ -1,9 +1,28 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfList } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfList } from "@/registry/bases/takumi/components/list";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfList+ variant="bullet"+ items={[+ {+ text: "Design system alignment",+ description: "Match all components to the design specification.",+ },+ {+ text: "Component implementation",+ description: "Build PDF-native components for both renderer bases.",+ },+ {+ text: "Write unit tests",+ description: "Cover all variants and edge cases.",+ },+ ]}+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +32,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfList items={[{ text: "Alpha" }, { text: "Beta" }, { text: "Gamma" }]} />;-}+export default Demo;diff --git a/examples/takumi/page-break.tsx b/examples/takumi/page-break.tsxindex fba041e..9ef1ea1 100644--- a/examples/takumi/page-break.tsx+++ b/examples/takumi/page-break.tsx@@ -1,10 +1,22 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Heading, PageBreak, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PageBreak } from "@/registry/bases/takumi/components/page-break";-import { Text } from "@/registry/bases/takumi/components/text";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View>+ <Heading level={1}>Section 1</Heading>+ <Text>Content on the first page.</Text>+ <PageBreak />+ <Heading level={1}>Section 2</Heading>+ <Text>Content on the second page.</Text>+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,15 +26,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <>- <Text>Before</Text>- <PageBreak />- <Text>After</Text>- </>- );-}+export default Demo;diff --git a/examples/takumi/page-footer.tsx b/examples/takumi/page-footer.tsxindex cf0c52e..e07b1e0 100644--- a/examples/takumi/page-footer.tsx+++ b/examples/takumi/page-footer.tsx@@ -1,21 +1,53 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PageFooter, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PageFooter } from "@/registry/bases/takumi/components/page-footer";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View style={{ display: "flex", flexDirection: "column", minHeight: 220 }}>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ Invoice #1042 · Acme Corp · March 2026+ </Text>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ The footer remains visually separated from the document body.+ </Text>+ <View style={{ flex: 1 }} />+ <PageFooter+ leftText="© 2026 Acme Corp"+ centerText="Confidential"+ rightText="Page 1 of 1"+ variant="simple"+ />+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document>- <Page size="A4">+ <Page size={{ width: 595, height: 300 }}><PdfcnThemeProvider><DemoBody /></PdfcnThemeProvider></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PageFooter leftText="pdfcn" rightText="Confidential" />;-}+export default Demo;diff --git a/examples/takumi/page-header.tsx b/examples/takumi/page-header.tsxindex 643c7a7..ad3a984 100644--- a/examples/takumi/page-header.tsx+++ b/examples/takumi/page-header.tsx@@ -1,21 +1,53 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PageHeader, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PageHeader } from "@/registry/bases/takumi/components/page-header";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View>+ <PageHeader+ title="Invoice #1042"+ subtitle="Acme Corp"+ rightText="March 2026"+ rightSubText="Due: 2026-03-31"+ variant="simple"+ />+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ Prepared for Northwind Industries+ </Text>+ <Text+ style={{+ color: "#555555",+ fontSize: 10,+ lineHeight: 1.6,+ marginBottom: 6,+ }}+ >+ This document demonstrates the simple page header variant.+ </Text>+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document>- <Page size="A4">+ <Page size={{ width: 595, height: 240 }}><PdfcnThemeProvider><DemoBody /></PdfcnThemeProvider></Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PageHeader title="Company" subtitle="Invoice" />;-}+export default Demo;diff --git a/examples/takumi/page-number.tsx b/examples/takumi/page-number.tsxindex 29edf65..38fde04 100644--- a/examples/takumi/page-number.tsx+++ b/examples/takumi/page-number.tsx@@ -1,9 +1,34 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Heading,+ PdfPageNumber,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfPageNumber } from "@/registry/bases/takumi/components/page-number";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View style={{ minHeight: 680, position: "relative" }}>+ <View style={{ marginBottom: 60 }}>+ <Heading level={1}>Multi-Page Report</Heading>+ <Text>+ Page numbers make long reports easier to review, reference, and print.+ </Text>+ <Text>+ The format token displays the current page together with the total page+ count.+ </Text>+ </View>+ <View style={{ bottom: 0, left: 0, position: "absolute", right: 0 }}>+ <PdfPageNumber format="Page 1 of 1" align="center" />+ </View>+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +38,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfPageNumber />;-}+export default Demo;diff --git a/examples/takumi/pdf-image.tsx b/examples/takumi/pdf-image.tsxindex b527e69..f6d0ac0 100644--- a/examples/takumi/pdf-image.tsx+++ b/examples/takumi/pdf-image.tsx@@ -1,10 +1,19 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PREVIEW_IMAGE_DATA_URI } from "@/examples/preview-assets";+import { PdfImage } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfImage } from "@/registry/bases/takumi/components/pdf-image";-import { Text } from "@/registry/bases/takumi/components/text";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfImage+ src={PREVIEW_IMAGE_DATA_URI}+ variant="default"+ height={120}+ width={200}+ caption="Variant: default"+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,9 +23,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Text>PdfImage demo — pass src in your document.</Text>;-}+export default Demo;diff --git a/examples/takumi/qrcode.tsx b/examples/takumi/qrcode.tsxindex 4c4ccfd..0cd19e5 100644--- a/examples/takumi/qrcode.tsx+++ b/examples/takumi/qrcode.tsx@@ -1,9 +1,38 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Heading,+ PdfQRCode,+ Section,+ Stack,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfQRCode } from "@/registry/bases/takumi/components/qrcode";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Heading level={1}>Invoice #12345</Heading>+ <Text>Amount Due: $500.00</Text>+ <Section>+ <Stack direction="horizontal" gap="lg" align="start">+ <PdfQRCode+ value="https://pdfcn.dev/pay/invoice-12345"+ size={100}+ caption="Scan to pay"+ />+ <PdfQRCode+ value="https://pdfcn.dev/verify/invoice-12345"+ size={80}+ caption="Verify document"+ />+ </Stack>+ </Section>+ <Text variant="sm" color="mutedForeground">+ QR codes are rendered as crisp vector graphics in the generated PDF.+ </Text>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +42,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfQRCode value="https://pdfcn.dev" />;-}+export default Demo;diff --git a/examples/takumi/report-financial.tsx b/examples/takumi/report-financial.tsxindex 200d835..f3919d0 100644--- a/examples/takumi/report-financial.tsx+++ b/examples/takumi/report-financial.tsx@@ -1,6 +1,6 @@import { FinancialReportDocument } from "@/registry/bases/takumi/blocks/report-financial/report-financial";-const Demo =() => {+const Demo = () => {return <FinancialReportDocument />;-}+};export default Demo;diff --git a/examples/takumi/report-marketing.tsx b/examples/takumi/report-marketing.tsxindex 200e75a..9876dfb 100644--- a/examples/takumi/report-marketing.tsx+++ b/examples/takumi/report-marketing.tsx@@ -1,6 +1,6 @@import { MarketingReportDocument } from "@/registry/bases/takumi/blocks/report-marketing/report-marketing";-const Demo =() => {+const Demo = () => {return <MarketingReportDocument />;-}+};export default Demo;diff --git a/examples/takumi/report-operations.tsx b/examples/takumi/report-operations.tsxindex 0e2d81f..d2f190a 100644--- a/examples/takumi/report-operations.tsx+++ b/examples/takumi/report-operations.tsx@@ -1,6 +1,6 @@import { OperationsReportDocument } from "@/registry/bases/takumi/blocks/report-operations/report-operations";-const Demo =() => {+const Demo = () => {return <OperationsReportDocument />;-}+};export default Demo;diff --git a/examples/takumi/report-security.tsx b/examples/takumi/report-security.tsxindex a21c2a8..83e955d 100644--- a/examples/takumi/report-security.tsx+++ b/examples/takumi/report-security.tsx@@ -1,6 +1,6 @@import { SecurityReportDocument } from "@/registry/bases/takumi/blocks/report-security/report-security";-const Demo =() => {+const Demo = () => {return <SecurityReportDocument />;-}+};export default Demo;diff --git a/examples/takumi/section.tsx b/examples/takumi/section.tsxindex 016f90c..6c1b013 100644--- a/examples/takumi/section.tsx+++ b/examples/takumi/section.tsx@@ -1,10 +1,23 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Heading, Section, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Section } from "@/registry/bases/takumi/components/section";-import { Text } from "@/registry/bases/takumi/components/text";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Section spacing="lg">+ <Heading level={2}>Introduction</Heading>+ <Text>+ This section uses generous spacing for a primary document area.+ </Text>+ </Section>+ <Section spacing="md">+ <Heading level={2}>Details</Heading>+ <Text>This section groups related content with medium spacing.</Text>+ </Section>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,9 +27,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Section><Text>Section body</Text></Section>;-}+export default Demo;diff --git a/examples/takumi/signature.tsx b/examples/takumi/signature.tsxindex f990098..6764fb4 100644--- a/examples/takumi/signature.tsx+++ b/examples/takumi/signature.tsx@@ -1,9 +1,18 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfSignatureBlock } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfSignatureBlock } from "@/registry/bases/takumi/components/signature";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <PdfSignatureBlock+ variant="single"+ label="Authorized By"+ name="John Doe"+ title="CEO, Acme Corp"+ date="15 February 2026"+ />+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +22,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <PdfSignatureBlock name="Jane Doe" label="Authorized Signature" />;-}+export default Demo;diff --git a/examples/takumi/stack.tsx b/examples/takumi/stack.tsxindex 2167bdb..1e67e78 100644--- a/examples/takumi/stack.tsx+++ b/examples/takumi/stack.tsx@@ -1,10 +1,26 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Divider,+ Heading,+ Stack,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Stack } from "@/registry/bases/takumi/components/stack";-import { Text } from "@/registry/bases/takumi/components/text";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Stack gap="md">+ <Heading level={2}>Section</Heading>+ <Text>First paragraph in the stack.</Text>+ <Text>Second paragraph with consistent spacing.</Text>+ <Divider spacing="lg" />+ <Stack gap="lg">+ <Heading level={3}>Wider gap</Heading>+ <Text>Content grouped with a larger vertical rhythm.</Text>+ </Stack>+ </Stack>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,14 +30,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <Stack gap="md">- <Text>One</Text>- <Text>Two</Text>- </Stack>- );-}+export default Demo;diff --git a/examples/takumi/table.tsx b/examples/takumi/table.tsxindex 2570765..c9612f6 100644--- a/examples/takumi/table.tsx+++ b/examples/takumi/table.tsx@@ -1,36 +1,65 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Table,+ TableBody,+ TableCell,+ TableFooter,+ TableHeader,+ TableRow,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Table } from "@/registry/bases/takumi/components/table";-import { TableBody, TableCell, TableHeader, TableRow, Text } from "@/registry/bases/takumi/components";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";-const Demo =() => {+const DemoBody = () => (+ <Table variant="line" zebraStripe={false}>+ <TableHeader>+ <TableRow header>+ <TableCell>Item</TableCell>+ <TableCell align="center">Qty</TableCell>+ <TableCell align="right">Price</TableCell>+ <TableCell align="right">Total</TableCell>+ </TableRow>+ </TableHeader>+ <TableBody>+ <TableRow>+ <TableCell>Design</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$150.00</TableCell>+ <TableCell align="right">$150.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Development</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Testing</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$800.00</TableCell>+ <TableCell align="right">$800.00</TableCell>+ </TableRow>+ </TableBody>+ <TableFooter>+ <TableRow footer>+ <TableCell>Total</TableCell>+ <TableCell> </TableCell>+ <TableCell> </TableCell>+ <TableCell align="right">$3,450.00</TableCell>+ </TableRow>+ </TableFooter>+ </Table>+);++const Demo = () => {return (<Document><Page size="A4"><PdfcnThemeProvider>- <DemoBody />+ <DemoBody /></PdfcnThemeProvider></Page></Document>);-}-export default Demo;+};-const DemoBody =() => {- return (- <Table>- <TableHeader>- <TableRow>- <TableCell><Text>Item</Text></TableCell>- <TableCell><Text>Qty</Text></TableCell>- </TableRow>- </TableHeader>- <TableBody>- <TableRow>- <TableCell><Text>Widget</Text></TableCell>- <TableCell><Text>2</Text></TableCell>- </TableRow>- </TableBody>- </Table>- );-}+export default Demo;diff --git a/examples/takumi/text.tsx b/examples/takumi/text.tsxindex 00d9113..72bc022 100644--- a/examples/takumi/text.tsx+++ b/examples/takumi/text.tsx@@ -1,9 +1,20 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import { Section, Text } from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { Text } from "@/registry/bases/takumi/components/text";+import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <Section spacing="none">+ <Text>+ Default body text for paragraphs, descriptions, and document content.+ </Text>+ <Text variant="xs" color="mutedForeground">+ Caption text for metadata and supporting details.+ </Text>+ <Text variant="lg">Lead paragraph with a larger typographic scale.</Text>+ </Section>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -13,9 +24,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return <Text>Hello from pdfcn takumi</Text>;-}+export default Demo;diff --git a/examples/takumi/watermark.tsx b/examples/takumi/watermark.tsxindex c5b0a0d..44a5c95 100644--- a/examples/takumi/watermark.tsx+++ b/examples/takumi/watermark.tsx@@ -1,10 +1,32 @@-import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";+import {+ Heading,+ PdfWatermark,+ Text,+} from "@/registry/bases/takumi/components";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";-import { PdfWatermark } from "@/registry/bases/takumi/components/watermark";-import { Text } from "@/registry/bases/takumi/components/text";+import {+ Document,+ Page,+ View,+} from "@/registry/bases/takumi/lib/takumi-primitives";+const DemoBody = () => (+ <View style={{ minHeight: 680, position: "relative" }}>+ <PdfWatermark text="DRAFT" />+ <Heading level={1}>Draft Document</Heading>+ <Text>+ This report is under review and should not be distributed externally.+ </Text>+ <Text>+ The watermark sits behind the content while remaining clearly visible.+ </Text>+ <Text>+ Use watermarks for draft, confidential, sample, or approval states.+ </Text>+ </View>+);-const Demo =() => {+const Demo = () => {return (<Document><Page size="A4">@@ -14,14 +36,6 @@ const Demo =() => {</Page></Document>);-}-export default Demo;+};-function DemoBody() {- return (- <>- <PdfWatermark text="DRAFT" />- <Text>Document content</Text>- </>- );-}+export default Demo;diff --git a/oxfmt.config.ts b/oxfmt.config.tsindex bb2d687..2c0720d 100644--- a/oxfmt.config.ts+++ b/oxfmt.config.ts@@ -14,7 +14,10 @@ export default defineConfig({experimentalSortPackageJson: true,extends: [ultracite],ignorePatterns: [+ ...(ultracite.ignorePatterns ?? []),"public/r/**",+ ".pnpm-store/**",+ ".registry-build/**",".agents/**",".cursor/**",".changeset/**",diff --git a/oxlint.config.ts b/oxlint.config.tsindex 77fd1de..3e7e93c 100644--- a/oxlint.config.ts+++ b/oxlint.config.ts@@ -7,7 +7,10 @@ import vitest from "ultracite/oxlint/vitest";export default defineConfig({extends: [core, react, next, vitest],ignorePatterns: [+ ...(core.ignorePatterns ?? []),"public/r/**",+ ".pnpm-store/**",+ ".registry-build/**",".agents/**",".cursor/**",".changeset/**",@@ -15,4 +18,30 @@ export default defineConfig({".web-kits/**","audio/**",],+ overrides: [+ {+ files: ["components/playground/**/*.{ts,tsx}"],+ rules: {+ "func-style": "off",+ "nextjs/no-img-element": "off",+ "no-new-func": "off",+ "sort-keys": "off",+ "unicorn/prefer-add-event-listener": "off",+ "unicorn/prefer-native-coercion-functions": "off",+ },+ },+ {+ files: ["examples/**/*.{ts,tsx}"],+ rules: {+ "arrow-body-style": "off",+ "sort-keys": "off",+ },+ },+ {+ files: ["registry/bases/takumi/lib/takumi-primitives.tsx"],+ rules: {+ "nextjs/no-img-element": "off",+ },+ },+ ],});diff --git a/package.json b/package.jsonindex f363903..9a540fd 100644--- a/package.json+++ b/package.json@@ -7,12 +7,12 @@"build": "pnpm registry:build && next build --webpack","start": "next start","typecheck": "tsc --noEmit",- "registry:build": "node scripts/generate-registry.mjs && node scripts/build-registry.mjs",+ "registry:build": "pnpm registry:generate && node scripts/build-registry.mjs","postinstall": "fumadocs-mdx","check": "ultracite check","fix": "ultracite fix","prepare": "lefthook install",- "registry:generate": "node scripts/generate-registry.mjs"+ "registry:generate": "node scripts/generate-registry.mjs && oxfmt examples registry.json"},"dependencies": {"@formepdf/core": "^0.10.5",diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.pngindex f30234e..a8e2962 100644Binary files a/public/android-chrome-192x192.png and b/public/android-chrome-192x192.png differdiff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.pngindex d5363c3..2b92cbe 100644Binary files a/public/android-chrome-512x512.png and b/public/android-chrome-512x512.png differdiff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.pngindex f3d87bb..3802850 100644Binary files a/public/apple-touch-icon.png and b/public/apple-touch-icon.png differdiff --git a/public/favicon-16x16.png b/public/favicon-16x16.pngindex 50acd2c..0429350 100644Binary files a/public/favicon-16x16.png and b/public/favicon-16x16.png differdiff --git a/public/favicon-32x32.png b/public/favicon-32x32.pngindex ca76ddc..47bc32b 100644Binary files a/public/favicon-32x32.png and b/public/favicon-32x32.png differdiff --git a/public/favicon-96x96.png b/public/favicon-96x96.pngindex 27577a5..7e0b68b 100644Binary files a/public/favicon-96x96.png and b/public/favicon-96x96.png differdiff --git a/public/favicon.ico b/public/favicon.icoindex 575a4eb..b667a8a 100644Binary files a/public/favicon.ico and b/public/favicon.ico differdiff --git a/public/favicon.png b/public/favicon.pngnew file mode 100644index 0000000..7e0b68bBinary files /dev/null and b/public/favicon.png differdiff --git a/public/favicon.svg b/public/favicon.svgindex b9b76b1..51c4bf4 100644--- a/public/favicon.svg+++ b/public/favicon.svg@@ -1,3 +1,8 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-package-icon lucide-package"><metadata><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Description><dc:creator>RealFaviconGenerator</dc:creator><dc:source>https://realfavicongenerator.net</dc:source></rdf:Description></rdf:RDF></metadata><path d="M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z"></path><path d="M12 22V12"></path><polyline points="3.29 7 12 12 20.71 7"></polyline><path d="m7.5 4.27 9 5.15"></path><style>@media (prefers-color-scheme: light) { :root { filter: none; } }-@media (prefers-color-scheme: dark) { :root { filter: invert(100%); } }-</style></svg>\ No newline at end of file+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="none">+ <style>+ .bg{fill:#000}.icon{fill:#fff}@media (prefers-color-scheme:dark){.bg{fill:#fff}.icon{fill:#000}}+ </style>+ <rect width="512" height="512" rx="115" ry="115" class="bg"/>+ <path class="icon" d="M184.564 121.97a7.326 7.326 0 0 1-7.326 7.327h-21.981a7.326 7.326 0 0 0-7.326 7.327v21.98a7.33 7.33 0 0 1-7.327 7.327h-21.98a7.326 7.326 0 0 0-7.327 7.326v164.852a7.327 7.327 0 0 0 7.327 7.327h21.98a7.327 7.327 0 0 1 7.327 7.326v21.981a7.326 7.326 0 0 0 7.326 7.326h21.981a7.327 7.327 0 0 1 7.326 7.327v25.644a7.326 7.326 0 0 1-7.326 7.326h-25.644a7.327 7.327 0 0 1-7.327-7.326v-21.981a7.326 7.326 0 0 0-7.326-7.326H114.96a7.327 7.327 0 0 1-7.326-7.327v-21.98a7.327 7.327 0 0 0-7.327-7.327h-21.98A7.327 7.327 0 0 1 71 341.772V169.594a7.327 7.327 0 0 1 7.327-7.327h21.98a7.327 7.327 0 0 0 7.327-7.326V132.96a7.326 7.326 0 0 1 7.326-7.326h21.981a7.327 7.327 0 0 0 7.326-7.327v-21.98A7.327 7.327 0 0 1 151.594 89h25.644a7.326 7.326 0 0 1 7.326 7.327zm183.169-3.663a7.327 7.327 0 0 0 7.326 7.327h21.981a7.326 7.326 0 0 1 7.326 7.326v21.981a7.327 7.327 0 0 0 7.327 7.326h21.98a7.327 7.327 0 0 1 7.327 7.327v172.178a7.326 7.326 0 0 1-7.327 7.327h-21.98a7.327 7.327 0 0 0-7.327 7.327v21.98a7.327 7.327 0 0 1-7.326 7.327h-21.981a7.326 7.326 0 0 0-7.326 7.326v21.981a7.327 7.327 0 0 1-7.327 7.326h-25.644a7.326 7.326 0 0 1-7.326-7.326v-25.644a7.327 7.327 0 0 1 7.326-7.327h21.981a7.326 7.326 0 0 0 7.326-7.326v-21.981a7.327 7.327 0 0 1 7.327-7.326h21.98a7.327 7.327 0 0 0 7.327-7.327V173.257a7.326 7.326 0 0 0-7.327-7.326h-21.98a7.33 7.33 0 0 1-7.327-7.327v-21.98a7.326 7.326 0 0 0-7.326-7.327h-21.981a7.326 7.326 0 0 1-7.326-7.327V96.327A7.326 7.326 0 0 1 334.762 89h25.644a7.327 7.327 0 0 1 7.327 7.327z"/>+ <path class="icon" d="M294.465 154.941a7.327 7.327 0 0 0 7.327 7.326h21.98a7.327 7.327 0 0 1 7.327 7.327v25.644a7.326 7.326 0 0 1-7.327 7.326h-25.643a7.326 7.326 0 0 1-7.327-7.326v-21.981a7.326 7.326 0 0 0-7.327-7.326h-54.95a7.326 7.326 0 0 0-7.327 7.326v54.951a7.327 7.327 0 0 0 7.327 7.327h58.614a7.326 7.326 0 0 1 7.326 7.326v21.981a7.327 7.327 0 0 0 7.327 7.326h21.98a7.327 7.327 0 0 1 7.327 7.327v62.277a7.326 7.326 0 0 1-7.327 7.327h-21.98a7.327 7.327 0 0 0-7.327 7.327v21.98a7.327 7.327 0 0 1-7.326 7.327h-62.278a7.327 7.327 0 0 1-7.326-7.327v-21.98a7.327 7.327 0 0 0-7.327-7.327h-21.98a7.326 7.326 0 0 1-7.327-7.327v-25.643a7.326 7.326 0 0 1 7.327-7.327h25.643a7.326 7.326 0 0 1 7.327 7.327v21.98a7.327 7.327 0 0 0 7.327 7.327h54.95a7.327 7.327 0 0 0 7.327-7.327v-54.951a7.326 7.326 0 0 0-7.327-7.326h-58.614a7.327 7.327 0 0 1-7.326-7.327v-21.98a7.327 7.327 0 0 0-7.327-7.327h-21.98a7.326 7.326 0 0 1-7.327-7.327v-62.277a7.327 7.327 0 0 1 7.327-7.327h21.98a7.327 7.327 0 0 0 7.327-7.326V132.96a7.326 7.326 0 0 1 7.326-7.326h62.278a7.326 7.326 0 0 1 7.326 7.326z"/>+</svg>diff --git a/public/r/forme/alert.json b/public/r/forme/alert.jsonindex 318766b..0c7cf57 100644--- a/public/r/forme/alert.json+++ b/public/r/forme/alert.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/alert/alert.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Circle, Line, Path, Svg } from \"../../lib/forme-svg\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * Alert box with severity variants for info, success, warning, and error states.\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\n * @see {@link PdfAlertProps}\n */\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'info'\n */\n variant?: AlertVariant;\n title?: string;\n children?: ReactNode;\n /**\n * @default true\n */\n showIcon?: boolean;\n /**\n * @default true\n */\n showBorder?: boolean;\n}\n\n/** Stroke width for all alert SVG icons (SVG user units). */\nconst ICON_STROKE_WIDTH = 1.5;\n\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\n {children}\n </Svg>\n);\n\nconst ICON_MAP = {\n error: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Line\n x1={5.5}\n y1={5.5}\n x2={10.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Line\n x1={10.5}\n y1={5.5}\n x2={5.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n info: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Circle cx={8} cy={4.5} r={1} fill={color} />\n <Line\n x1={8}\n y1={7}\n x2={8}\n y2={11.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n success: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Path\n d=\"M5 8 L7 10 L11 6\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </SvgWrap>\n ),\n warning: ({ color }: { color: string }) => (\n <SvgWrap>\n <Path\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinejoin=\"round\"\n />\n <Line\n x1={8}\n y1={6}\n x2={8}\n y2={10}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\n </SvgWrap>\n ),\n};\n\nconst AlertIcon = ({\n variant,\n color,\n}: {\n variant: AlertVariant;\n color: string;\n}) => {\n const Icon = ICON_MAP[variant];\n return <Icon color={color} />;\n};\n\nconst borderLeft = (color: string) => ({\n borderLeftColor: color,\n borderLeftWidth: 4,\n});\n\nconst createAlertStyles = (theme: PdfcnTheme) => {\n const { typography, colors, primitives } = theme;\n\n const variantColors = {\n error: colors.destructive ?? \"#EF4444\",\n info: colors.info ?? \"#3B82F6\",\n success: colors.success ?? \"#22C55E\",\n warning: colors.warning ?? \"#F59E0B\",\n } satisfies Record<AlertVariant, string>;\n\n const sheet = StyleSheet.create({\n bg: {\n backgroundColor: colors.muted,\n },\n borderError: borderLeft(variantColors.error),\n borderInfo: borderLeft(variantColors.info),\n borderSuccess: borderLeft(variantColors.success),\n borderWarning: borderLeft(variantColors.warning),\n container: {\n borderRadius: 4,\n flexDirection: \"row\",\n marginBottom: theme.spacing.componentGap,\n padding: 12,\n },\n contentContainer: { flex: 1 },\n description: {\n color: colors.mutedForeground,\n fontFamily: typography.body.fontFamily,\n fontSize: primitives.typography.sm,\n lineHeight: typography.body.lineHeight,\n },\n iconContainer: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginRight: 10,\n paddingTop: 2,\n width: 20,\n },\n title: {\n color: colors.foreground,\n fontFamily: typography.heading.fontFamily,\n fontSize: primitives.typography.sm,\n fontWeight: primitives.fontWeights.semibold,\n marginBottom: 4,\n },\n });\n\n return {\n ...sheet,\n borderMap: {\n error: sheet.borderError,\n info: sheet.borderInfo,\n success: sheet.borderSuccess,\n warning: sheet.borderWarning,\n } as Record<AlertVariant, Style>,\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\n variantColors,\n };\n};\n\nexport const PdfAlert = ({\n variant = \"info\",\n title,\n children,\n showIcon = true,\n showBorder = true,\n style,\n}: PdfAlertProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\n\n if (!title && !children) {\n return null;\n }\n\n const containerStyles: Style[] = [\n styles.container,\n styles.bg,\n ...(showBorder ? [styles.borderMap[variant]] : []),\n ...(style ? [style].flat() : []),\n ];\n\n return (\n <View wrap={false} style={containerStyles as never}>\n {showIcon && (\n <View style={styles.iconContainer}>\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\n </View>\n )}\n <View style={styles.contentContainer}>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {typeof children === \"string\" ? (\n <PDFText style={styles.description}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n </View>\n );\n};\n",+ "content": "import type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { Circle, Line, Path, Svg } from \"../../lib/forme-svg\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"../../lib/pdfcn-theme-context\";\n\nexport type AlertVariant = \"info\" | \"success\" | \"warning\" | \"error\";\n\n/**\n * Alert box with severity variants for info, success, warning, and error states.\n * Props - `variant` | `title` | `children` | `showIcon` | `showBorder` | `style`\n * @see {@link PdfAlertProps}\n */\nexport interface PdfAlertProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'info'\n */\n variant?: AlertVariant;\n title?: string;\n children?: ReactNode;\n /**\n * @default true\n */\n showIcon?: boolean;\n /**\n * @default true\n */\n showBorder?: boolean;\n}\n\n/** Stroke width for all alert SVG icons (SVG user units). */\nconst ICON_STROKE_WIDTH = 1.5;\n\nconst SvgWrap = ({ children }: { children: ReactNode }) => (\n <Svg width={16} height={16} viewBox=\"0 0 16 16\">\n {children}\n </Svg>\n);\n\nconst ICON_MAP = {\n error: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Line\n x1={5.5}\n y1={5.5}\n x2={10.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Line\n x1={10.5}\n y1={5.5}\n x2={5.5}\n y2={10.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n info: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Circle cx={8} cy={4.5} r={1} fill={color} />\n <Line\n x1={8}\n y1={7}\n x2={8}\n y2={11.5}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n </SvgWrap>\n ),\n success: ({ color }: { color: string }) => (\n <SvgWrap>\n <Circle\n cx={8}\n cy={8}\n r={7}\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n />\n <Path\n d=\"M5 8 L7 10 L11 6\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </SvgWrap>\n ),\n warning: ({ color }: { color: string }) => (\n <SvgWrap>\n <Path\n d=\"M8 1.5 L15 14.5 L1 14.5 Z\"\n fill=\"none\"\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinejoin=\"round\"\n />\n <Line\n x1={8}\n y1={6}\n x2={8}\n y2={10}\n stroke={color}\n strokeWidth={ICON_STROKE_WIDTH}\n strokeLinecap=\"round\"\n />\n <Circle cx={8} cy={12.5} r={0.75} fill={color} />\n </SvgWrap>\n ),\n};\n\nconst AlertIcon = ({\n variant,\n color,\n}: {\n variant: AlertVariant;\n color: string;\n}) => {\n const Icon = ICON_MAP[variant];\n return <Icon color={color} />;\n};\n\nconst borderLeft = (color: string) => ({\n borderLeftColor: color,\n borderLeftWidth: 4,\n});\n\nconst createAlertStyles = (theme: PdfcnTheme) => {\n const { typography, colors, primitives } = theme;\n\n const variantColors = {\n error: colors.destructive ?? \"#EF4444\",\n info: colors.info ?? \"#3B82F6\",\n success: colors.success ?? \"#22C55E\",\n warning: colors.warning ?? \"#F59E0B\",\n } satisfies Record<AlertVariant, string>;\n\n const sheet = StyleSheet.create({\n bg: {\n backgroundColor: colors.muted,\n },\n borderError: borderLeft(variantColors.error),\n borderInfo: borderLeft(variantColors.info),\n borderSuccess: borderLeft(variantColors.success),\n borderWarning: borderLeft(variantColors.warning),\n container: {\n borderRadius: 4,\n flexDirection: \"row\",\n marginBottom: theme.spacing.componentGap,\n padding: 12,\n },\n contentContainer: { flex: 1 },\n description: {\n color: colors.mutedForeground,\n fontFamily: typography.body.fontFamily,\n fontSize: primitives.typography.sm,\n lineHeight: typography.body.lineHeight,\n },\n iconContainer: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginRight: 10,\n paddingTop: 2,\n width: 20,\n },\n title: {\n color: colors.foreground,\n fontFamily: typography.heading.fontFamily,\n fontSize: primitives.typography.sm,\n fontWeight: primitives.fontWeights.semibold,\n marginBottom: 4,\n },\n });\n\n return {\n ...sheet,\n borderMap: {\n error: sheet.borderError,\n info: sheet.borderInfo,\n success: sheet.borderSuccess,\n warning: sheet.borderWarning,\n } as Record<AlertVariant, Style>,\n /** Resolved hex colors for each variant — used to tint the SVG icons. */\n variantColors,\n };\n};\n\nexport const PdfAlert = ({\n variant = \"info\",\n title,\n children,\n showIcon = true,\n showBorder = true,\n style,\n}: PdfAlertProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createAlertStyles(theme), [theme]);\n\n if (!title && !children) {\n return null;\n }\n\n const containerStyles: Style[] = [\n styles.container,\n styles.bg,\n ...(showBorder ? [styles.borderMap[variant]] : []),\n ...(style ? [style].flat() : []),\n ];\n\n return (\n <View wrap={false} style={mergePdfStyles(containerStyles)}>\n {showIcon && (\n <View style={styles.iconContainer}>\n <AlertIcon variant={variant} color={styles.variantColors[variant]} />\n </View>\n )}\n <View style={styles.contentContainer}>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {typeof children === \"string\" ? (\n <PDFText style={styles.description}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/alert/alert.tsx"},diff --git a/public/r/forme/badge.json b/public/r/forme/badge.jsonindex 47f355b..9ad8a6f 100644--- a/public/r/forme/badge.json+++ b/public/r/forme/badge.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/badge/badge.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `@formepdf/react` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles as never}>\n <PDFText style={textStyles as never}>{text}</PDFText>\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `@formepdf/react` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles as never}>\n <PDFText style={textStyles as never}>{text}</PDFText>\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/badge/badge.tsx"},diff --git a/public/r/forme/card.json b/public/r/forme/card.jsonindex 9e2dc9a..ab463ac 100644--- a/public/r/forme/card.json+++ b/public/r/forme/card.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/card/card.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\n\n/**\n * Bordered content card with optional title and padding presets.\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\n * @see {@link PdfCardProps}\n */\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\n title?: string;\n children?: ReactNode;\n /**\n * @default 'default'\n */\n variant?: CardVariant;\n /**\n * @default 'md'\n */\n padding?: \"sm\" | \"md\" | \"lg\";\n /**\n * When false, the card will not split across PDF pages.\n * @default false\n */\n wrap?: boolean;\n}\n\nconst createCardStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n return StyleSheet.create({\n body: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n card: {\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: t.spacing.componentGap,\n },\n cardBordered: { borderWidth: 2 },\n cardMuted: { backgroundColor: t.colors.muted },\n paddingLg: { padding: spacing[4] },\n paddingMd: { padding: spacing[3] },\n paddingSm: { padding: spacing[2] },\n title: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[2],\n paddingBottom: spacing[1] + 2,\n },\n });\n};\n\nexport const PdfCard = ({\n title,\n children,\n variant = \"default\",\n padding = \"md\",\n wrap = false,\n style,\n}: PdfCardProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n sm: styles.paddingSm,\n };\n const cardStyles: Style[] = [styles.card];\n if (variant === \"bordered\") {\n cardStyles.push(styles.cardBordered);\n }\n if (variant === \"muted\") {\n cardStyles.push(styles.cardMuted);\n }\n cardStyles.push(paddingMap[padding]);\n if (style) {\n cardStyles.push(style);\n }\n return (\n <View wrap={wrap} style={cardStyles as never}>\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\n {typeof children === \"string\" ? (\n <PDFText style={styles.body}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n );\n};\n",+ "content": "import type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type CardVariant = \"default\" | \"bordered\" | \"muted\";\n\n/**\n * Bordered content card with optional title and padding presets.\n * Props - `title` | `children` | `variant` | `padding` | `wrap` | `style`\n * @see {@link PdfCardProps}\n */\nexport interface PdfCardProps extends Omit<PDFComponentProps, \"children\"> {\n title?: string;\n children?: ReactNode;\n /**\n * @default 'default'\n */\n variant?: CardVariant;\n /**\n * @default 'md'\n */\n padding?: \"sm\" | \"md\" | \"lg\";\n /**\n * When false, the card will not split across PDF pages.\n * @default false\n */\n wrap?: boolean;\n}\n\nconst createCardStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n return StyleSheet.create({\n body: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n card: {\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 1,\n marginBottom: t.spacing.componentGap,\n },\n cardBordered: { borderWidth: 2 },\n cardMuted: { backgroundColor: t.colors.muted },\n paddingLg: { padding: spacing[4] },\n paddingMd: { padding: spacing[3] },\n paddingSm: { padding: spacing[2] },\n title: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[2],\n paddingBottom: spacing[1] + 2,\n },\n });\n};\n\nexport const PdfCard = ({\n title,\n children,\n variant = \"default\",\n padding = \"md\",\n wrap = false,\n style,\n}: PdfCardProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createCardStyles(theme), [theme]);\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n sm: styles.paddingSm,\n };\n const cardStyles: Style[] = [styles.card];\n if (variant === \"bordered\") {\n cardStyles.push(styles.cardBordered);\n }\n if (variant === \"muted\") {\n cardStyles.push(styles.cardMuted);\n }\n cardStyles.push(paddingMap[padding]);\n if (style) {\n cardStyles.push(style);\n }\n return (\n <View wrap={wrap} style={cardStyles as never}>\n {title ? <PDFText style={styles.title}>{title}</PDFText> : null}\n {typeof children === \"string\" ? (\n <PDFText style={styles.body}>{children}</PDFText>\n ) : (\n children\n )}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/card/card.tsx"},diff --git a/public/r/forme/data-table.json b/public/r/forme/data-table.jsonindex 4b4bd98..aa047be 100644--- a/public/r/forme/data-table.json+++ b/public/r/forme/data-table.json@@ -20,7 +20,7 @@},{"path": "registry/bases/forme/components/data-table/data-table.tsx",- "content": "import { Text as PDFText } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport { Fragment } from \"react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"../table\";\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\nimport type { DataTableProps } from \"./data-table.types\";\n\nexport const DataTable = <T extends Record<string, unknown>>({\n columns,\n data,\n variant = \"grid\",\n footer,\n stripe = false,\n size = \"default\",\n noWrap = false,\n style,\n}: DataTableProps<T>) => {\n const theme = usePdfcnTheme();\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\n const isCompact = size === \"compact\";\n\n return (\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\n <TableHeader>\n <TableRow header>\n {columns.map((col) => (\n <TableCell\n key={col.key}\n header\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact ? (\n <PDFText\n style={\n [\n compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\n ] as never\n }\n >\n {col.header}\n </PDFText>\n ) : (\n col.header\n )}\n </TableCell>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.map((row, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\n <Fragment key={i}>\n <TableRow>\n {columns.map((col) => {\n const value = row[col.key];\n const rendered = col.render ? col.render(value, row) : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </Fragment>\n ))}\n </TableBody>\n {footer && (\n <TableFooter>\n <TableRow footer>\n {columns.map((col) => {\n const value = col.key in footer ? footer[col.key] : \"\";\n const rendered = col.renderFooter\n ? col.renderFooter(value)\n : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n footer={!!value}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </TableFooter>\n )}\n </Table>\n );\n};\n",+ "content": "import { Fragment } from \"react\";\n\nimport { Text as PDFText } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"../table\";\nimport { createCompactStyles, formatValue } from \"./data-table.styles\";\nimport type { DataTableProps } from \"./data-table.types\";\n\nexport const DataTable = <T extends Record<string, unknown>>({\n columns,\n data,\n variant = \"grid\",\n footer,\n stripe = false,\n size = \"default\",\n noWrap = false,\n style,\n}: DataTableProps<T>) => {\n const theme = usePdfcnTheme();\n const compact = useSafeMemo(() => createCompactStyles(theme), [theme]);\n const isCompact = size === \"compact\";\n\n return (\n <Table variant={variant} zebraStripe={stripe} noWrap={noWrap} style={style}>\n <TableHeader>\n <TableRow header>\n {columns.map((col) => (\n <TableCell\n key={col.key}\n header\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact ? (\n <PDFText\n style={\n [\n compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\n ] as never\n }\n >\n {col.header}\n </PDFText>\n ) : (\n col.header\n )}\n </TableCell>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.map((row, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: DataTable has no row id; order is stable for static data\n <Fragment key={i}>\n <TableRow>\n {columns.map((col) => {\n const value = row[col.key];\n const rendered = col.render ? col.render(value, row) : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </Fragment>\n ))}\n </TableBody>\n {footer && (\n <TableFooter>\n <TableRow footer>\n {columns.map((col) => {\n const value = col.key in footer ? footer[col.key] : \"\";\n const rendered = col.renderFooter\n ? col.renderFooter(value)\n : null;\n const text = rendered === null ? formatValue(value) : null;\n return (\n <TableCell\n key={col.key}\n footer={!!value}\n align={col.align ?? \"left\"}\n width={col.width}\n style={isCompact ? compact.cell : undefined}\n >\n {isCompact\n ? (rendered ?? (\n <PDFText\n style={\n [\n value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\n ] as never\n }\n >\n {text}\n </PDFText>\n ))\n : (rendered ?? text)}\n </TableCell>\n );\n })}\n </TableRow>\n </TableFooter>\n )}\n </Table>\n );\n};\n","type": "registry:component","target": "components/pdf/components/data-table/data-table.tsx"},diff --git a/public/r/forme/divider.json b/public/r/forme/divider.jsonindex fc1d3a5..176332f 100644--- a/public/r/forme/divider.json+++ b/public/r/forme/divider.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/divider/divider.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\n\n/**\n * Horizontal rule with optional label, style variants, and spacing presets.\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\n * @see {@link DividerProps}\n */\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'md'\n */\n spacing?: DividerSpacing;\n /**\n * @default 'solid'\n */\n variant?: DividerVariant;\n color?: string;\n /**\n * @default 'thin'\n */\n thickness?: DividerThickness;\n label?: string;\n width?: string | number;\n}\n\nconst createDividerStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n return StyleSheet.create({\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\n dashed: { borderBottomStyle: \"dashed\" },\n dotted: { borderBottomStyle: \"dotted\" },\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\n labelLine: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n flex: 1,\n },\n labelText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: t.primitives.letterSpacing.wider * 10,\n paddingHorizontal: spacing[3],\n textTransform: \"uppercase\",\n },\n medium: { borderBottomWidth: spacing[1] },\n solid: { borderBottomStyle: \"solid\" },\n spacingLg: { marginVertical: t.spacing.sectionGap },\n spacingMd: { marginVertical: t.spacing.componentGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: t.spacing.paragraphGap },\n thick: { borderBottomWidth: spacing[2] },\n thin: { borderBottomWidth: spacing[0.5] },\n } as Record<string, Style>);\n};\n\nexport const Divider = ({\n spacing = \"md\",\n variant = \"solid\",\n color,\n thickness = \"thin\",\n label,\n width,\n style,\n}: DividerProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n };\n const variantMap = {\n dashed: styles.dashed,\n dotted: styles.dotted,\n solid: styles.solid,\n };\n const thicknessMap = {\n medium: styles.medium,\n thick: styles.thick,\n thin: styles.thin,\n };\n\n if (label) {\n const lineStyle: Style[] = [\n styles.labelLine,\n thicknessMap[thickness],\n variantMap[variant],\n ];\n if (color) {\n lineStyle.push({\n borderBottomColor: resolveColor(color, theme.colors),\n } as Style);\n }\n const containerStyles: Style[] = [\n styles.labelContainer,\n spacingMap[spacing],\n ];\n if (width !== undefined) {\n containerStyles.push({ width } as Style);\n }\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const labelTextStyle: Style[] = [styles.labelText];\n if (color) {\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\n }\n return (\n <View style={containerStyles as never}>\n <View style={lineStyle as never} />\n <PDFText style={labelTextStyle as never}>{label}</PDFText>\n <View style={lineStyle as never} />\n </View>\n );\n }\n\n const styleArray: Style[] = [\n styles.base,\n spacingMap[spacing],\n variantMap[variant],\n thicknessMap[thickness],\n ];\n if (color) {\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\n }\n if (width !== undefined) {\n styleArray.push({ width } as Style);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray as never} />;\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type DividerVariant = \"solid\" | \"dashed\" | \"dotted\";\nexport type DividerThickness = \"thin\" | \"medium\" | \"thick\";\nexport type DividerSpacing = \"none\" | \"sm\" | \"md\" | \"lg\";\n\n/**\n * Horizontal rule with optional label, style variants, and spacing presets.\n * Props - `spacing` | `variant` | `color` | `thickness` | `label` | `width` | `style`\n * @see {@link DividerProps}\n */\nexport interface DividerProps extends Omit<PDFComponentProps, \"children\"> {\n /**\n * @default 'md'\n */\n spacing?: DividerSpacing;\n /**\n * @default 'solid'\n */\n variant?: DividerVariant;\n color?: string;\n /**\n * @default 'thin'\n */\n thickness?: DividerThickness;\n label?: string;\n width?: string | number;\n}\n\nconst createDividerStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n return StyleSheet.create({\n base: { borderBottomColor: t.colors.border, borderBottomStyle: \"solid\" },\n dashed: { borderBottomStyle: \"dashed\" },\n dotted: { borderBottomStyle: \"dotted\" },\n labelContainer: { alignItems: \"center\", flexDirection: \"row\" },\n labelLine: {\n borderBottomColor: t.colors.border,\n borderBottomStyle: \"solid\",\n flex: 1,\n },\n labelText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: t.primitives.letterSpacing.wider * 10,\n paddingHorizontal: spacing[3],\n textTransform: \"uppercase\",\n },\n medium: { borderBottomWidth: spacing[1] },\n solid: { borderBottomStyle: \"solid\" },\n spacingLg: { marginVertical: t.spacing.sectionGap },\n spacingMd: { marginVertical: t.spacing.componentGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: t.spacing.paragraphGap },\n thick: { borderBottomWidth: spacing[2] },\n thin: { borderBottomWidth: spacing[0.5] },\n } as Record<string, Style>);\n};\n\nexport const Divider = ({\n spacing = \"md\",\n variant = \"solid\",\n color,\n thickness = \"thin\",\n label,\n width,\n style,\n}: DividerProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createDividerStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n };\n const variantMap = {\n dashed: styles.dashed,\n dotted: styles.dotted,\n solid: styles.solid,\n };\n const thicknessMap = {\n medium: styles.medium,\n thick: styles.thick,\n thin: styles.thin,\n };\n\n if (label) {\n const lineStyle: Style[] = [\n styles.labelLine,\n thicknessMap[thickness],\n variantMap[variant],\n ];\n if (color) {\n lineStyle.push({\n borderBottomColor: resolveColor(color, theme.colors),\n } as Style);\n }\n const containerStyles: Style[] = [\n styles.labelContainer,\n spacingMap[spacing],\n ];\n if (width !== undefined) {\n containerStyles.push({ width } as Style);\n }\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const labelTextStyle: Style[] = [styles.labelText];\n if (color) {\n labelTextStyle.push({ color: resolveColor(color, theme.colors) });\n }\n return (\n <View style={containerStyles as never}>\n <View style={lineStyle as never} />\n <PDFText style={labelTextStyle as never}>{label}</PDFText>\n <View style={lineStyle as never} />\n </View>\n );\n }\n\n const styleArray: Style[] = [\n styles.base,\n spacingMap[spacing],\n variantMap[variant],\n thicknessMap[thickness],\n ];\n if (color) {\n styleArray.push({ borderBottomColor: resolveColor(color, theme.colors) });\n }\n if (width !== undefined) {\n styleArray.push({ width } as Style);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <View style={styleArray as never} />;\n};\n","type": "registry:component","target": "components/pdf/components/divider/divider.tsx"},diff --git a/public/r/forme/form.json b/public/r/forme/form.jsonindex a0e46f1..8f5ba83 100644--- a/public/r/forme/form.json+++ b/public/r/forme/form.json@@ -19,7 +19,7 @@},{"path": "registry/bases/forme/components/form/form.tsx",- "content": "import { Text as PDFText, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createFormStyles } from \"./form.styles\";\nimport type {\n FormLayout,\n PdfFormField,\n PdfFormGroup,\n PdfFormProps,\n} from \"./form.types\";\n\nconst renderFieldAbove = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderFieldLeft = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [\n styles.fieldArea,\n styles.fieldLeftArea,\n { minHeight: areaHeight },\n ];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderGroup = (\n group: PdfFormGroup,\n gi: number,\n styles: ReturnType<typeof createFormStyles>,\n labelPosition: \"above\" | \"left\"\n) => {\n const layout: FormLayout = group.layout ?? \"single\";\n let cols: number;\n if (layout === \"three-column\") {\n cols = 3;\n } else if (layout === \"two-column\") {\n cols = 2;\n } else {\n cols = 1;\n }\n\n const renderField = (field: PdfFormField, idx: number) =>\n labelPosition === \"left\"\n ? renderFieldLeft(field, idx, styles)\n : renderFieldAbove(field, idx, styles);\n\n if (cols === 1) {\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n {group.fields.map(renderField)}\n </View>\n );\n }\n\n const chunkSize = Math.ceil(group.fields.length / cols);\n const chunks: PdfFormField[][] = [];\n for (let i = 0; i < group.fields.length; i += chunkSize) {\n chunks.push(group.fields.slice(i, i + chunkSize));\n }\n while (chunks.length < cols) {\n chunks.push([]);\n }\n\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n <View style={styles.columnsRow}>\n {chunks.map((chunk, ci) => (\n <View\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\n style={styles.column}\n >\n {chunk.map(renderField)}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nexport const PdfForm = ({\n title,\n subtitle,\n groups,\n variant = \"underline\",\n labelPosition = \"above\",\n noWrap = false,\n style,\n}: PdfFormProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(\n () => createFormStyles(theme, variant),\n [theme, variant]\n );\n\n const rootStyles: Style[] = [styles.root];\n if (style) {\n rootStyles.push(style);\n }\n\n const inner = (\n <View style={rootStyles as never}>\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\n {subtitle ? (\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\n ) : null}\n {title || subtitle ? <View style={styles.formDivider} /> : null}\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n",+ "content": "import { Text as PDFText, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createFormStyles } from \"./form.styles\";\nimport type {\n FormLayout,\n PdfFormField,\n PdfFormGroup,\n PdfFormProps,\n} from \"./form.types\";\n\nconst renderFieldAbove = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [styles.fieldArea, { minHeight: areaHeight }];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldAbove}>\n <PDFText style={styles.labelAbove}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderFieldLeft = (\n field: PdfFormField,\n idx: number,\n styles: ReturnType<typeof createFormStyles>\n) => {\n const areaHeight = field.height ?? 18;\n const areaStyle: Style[] = [\n styles.fieldArea,\n styles.fieldLeftArea,\n { minHeight: areaHeight },\n ];\n\n return (\n <View key={`${field.label}-${idx}`} style={styles.fieldLeft}>\n <PDFText style={styles.labelLeft}>{field.label}</PDFText>\n <View style={areaStyle as never}>\n {field.hint ? (\n <PDFText style={styles.hint}>{field.hint}</PDFText>\n ) : null}\n </View>\n </View>\n );\n};\n\nconst renderGroup = (\n group: PdfFormGroup,\n gi: number,\n styles: ReturnType<typeof createFormStyles>,\n labelPosition: \"above\" | \"left\"\n) => {\n const layout: FormLayout = group.layout ?? \"single\";\n let cols: number;\n if (layout === \"three-column\") {\n cols = 3;\n } else if (layout === \"two-column\") {\n cols = 2;\n } else {\n cols = 1;\n }\n\n const renderField = (field: PdfFormField, idx: number) =>\n labelPosition === \"left\"\n ? renderFieldLeft(field, idx, styles)\n : renderFieldAbove(field, idx, styles);\n\n if (cols === 1) {\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n {group.fields.map(renderField)}\n </View>\n );\n }\n\n const chunkSize = Math.ceil(group.fields.length / cols);\n const chunks: PdfFormField[][] = [];\n for (let i = 0; i < group.fields.length; i += chunkSize) {\n chunks.push(group.fields.slice(i, i + chunkSize));\n }\n while (chunks.length < cols) {\n chunks.push([]);\n }\n\n return (\n <View key={`group-${gi}`} style={styles.group}>\n {group.title ? (\n <PDFText style={styles.groupTitle}>{group.title}</PDFText>\n ) : null}\n <View style={styles.columnsRow}>\n {chunks.map((chunk, ci) => (\n <View\n key={`col-${gi}-${chunk[0]?.label ?? ci}`}\n style={styles.column}\n >\n {chunk.map(renderField)}\n </View>\n ))}\n </View>\n </View>\n );\n};\n\nexport const PdfForm = ({\n title,\n subtitle,\n groups,\n variant = \"underline\",\n labelPosition = \"above\",\n noWrap = false,\n style,\n}: PdfFormProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(\n () => createFormStyles(theme, variant),\n [theme, variant]\n );\n\n const rootStyles: Style[] = [styles.root];\n if (style) {\n rootStyles.push(style);\n }\n\n const inner = (\n <View style={rootStyles as never}>\n {title ? <PDFText style={styles.formTitle}>{title}</PDFText> : null}\n {subtitle ? (\n <PDFText style={styles.formSubtitle}>{subtitle}</PDFText>\n ) : null}\n {title || subtitle ? <View style={styles.formDivider} /> : null}\n {groups.map((group, gi) => renderGroup(group, gi, styles, labelPosition))}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n","type": "registry:component","target": "components/pdf/components/form/form.tsx"},diff --git a/public/r/forme/graph.json b/public/r/forme/graph.jsonindex 421564f..fde4690 100644--- a/public/r/forme/graph.json+++ b/public/r/forme/graph.json@@ -19,7 +19,7 @@},{"path": "registry/bases/forme/components/graph/graph.tsx",- "content": "import { Text as PDFText, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type React from \"react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { Circle, G, Line, Path, Rect, Svg, SvgText } from \"../../lib/forme-svg\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle as never}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n axisLabels: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles as never}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n",+ "content": "import type React from \"react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { Circle, G, Line, Path, Rect, Svg, SvgText } from \"../../lib/forme-svg\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle as never}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderTextFallback = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n layout: ChartLayout,\n showValues: boolean,\n textColor: string\n) => {\n if (variant === \"pie\" || variant === \"donut\") {\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\n const cx = layout.svgW / 2;\n const cy = layout.svgH / 2;\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\n const labelRadius = radius * 1.18;\n let currentAngle = 0;\n\n return (\n <View\n style={{\n height: layout.svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: layout.svgW,\n }}\n >\n {data.map((point, index) => {\n const sweep = (point.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n currentAngle += sweep;\n if (sweep <= 15) {\n return null;\n }\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\n const onRight = labelPoint.x > cx;\n return (\n <PDFText\n key={`fallback-pie-${point.label}-${index}`}\n style={{\n color: textColor,\n fontSize: 7,\n left: onRight ? labelPoint.x : labelPoint.x - 60,\n lineHeight: 1,\n position: \"absolute\",\n textAlign: onRight ? \"left\" : \"right\",\n top: labelPoint.y - 4,\n width: 60,\n }}\n >\n {truncate(point.label, 10)}\n </PDFText>\n );\n })}\n </View>\n );\n }\n\n const {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH,\n svgW,\n xLabels,\n yMax,\n yMin,\n yTicks,\n } = layout;\n const range = yMax - yMin || 1;\n const toY = (value: number) =>\n chartY + chartH - ((value - yMin) / range) * chartH;\n const labelStyle = {\n color: textColor,\n fontSize: 7,\n lineHeight: 1,\n position: \"absolute\" as const,\n };\n\n if (variant === \"horizontal-bar\") {\n const labelWidth = 60;\n const rowHeight = chartH / Math.max(xLabels.length, 1);\n const maxValue = Math.max(\n ...series.flatMap((item) => item.data.map((point) => point.value)),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {xLabels.map((label, index) => {\n const value = series[0]?.data[index]?.value ?? 0;\n const barWidth = (value / maxValue) * (chartW - labelWidth);\n return (\n <View key={`fallback-horizontal-${label}`}>\n <PDFText\n style={{\n ...labelStyle,\n left: chartX,\n textAlign: \"right\",\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: labelWidth - 4,\n }}\n >\n {truncate(label, 14)}\n </PDFText>\n {showValues ? (\n <PDFText\n style={{\n ...labelStyle,\n color: textColor,\n fontSize: 6,\n left: chartX + labelWidth + barWidth + 3,\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: 28,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n ) : null}\n </View>\n );\n })}\n </View>\n );\n }\n\n const pointX = (index: number) =>\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\n const groupWidth = chartW / Math.max(xLabels.length, 1);\n const barGap = 2;\n const barWidth = Math.max(\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {yTicks.map((tick) => (\n <PDFText\n key={`fallback-y-${tick}`}\n style={{\n ...labelStyle,\n left: 0,\n textAlign: \"right\",\n top: toY(tick) - 4,\n width: chartX - 4,\n }}\n >\n {fmtNum(tick)}\n </PDFText>\n ))}\n {(variant === \"line\" || variant === \"area\") &&\n xLabels.map((label, index) => (\n <PDFText\n key={`fallback-x-${label}`}\n style={{\n ...labelStyle,\n left: pointX(index) - 12,\n textAlign: \"center\",\n top: chartY + chartH + 3,\n width: 24,\n }}\n >\n {truncate(label, 8)}\n </PDFText>\n ))}\n {variant === \"bar\" &&\n showValues &&\n xLabels.flatMap((label, categoryIndex) =>\n series.map((item, seriesIndex) => {\n const value = item.data[categoryIndex]?.value ?? 0;\n const left =\n chartX +\n categoryIndex * groupWidth +\n barGap +\n seriesIndex * (barWidth + barGap);\n return (\n <PDFText\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\n style={{\n ...labelStyle,\n fontSize: 6,\n left,\n textAlign: \"center\",\n top: toY(value) - 8,\n width: barWidth,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n );\n })\n )}\n </View>\n );\n};\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n chartLabels: React.ReactNode,\n axisLabels: React.ReactNode,\n textFallback: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <View style={{ height, position: \"relative\", width }}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {textFallback}\n </View>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {chartLabels}\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\nconst renderBarLabels = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n chartX: number,\n chartW: number\n) => {\n if (variant !== \"bar\") {\n return null;\n }\n\n return (\n <View\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n marginLeft: chartX,\n width: chartW,\n }}\n >\n {(series[0]?.data ?? []).map((point) => (\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles as never}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n chartLabels,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n renderTextFallback(\n variant,\n series,\n layout,\n showValues,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n","type": "registry:component","target": "components/pdf/components/graph/graph.tsx"},diff --git a/public/r/forme/heading.json b/public/r/forme/heading.jsonindex 7902f75..c62691d 100644--- a/public/r/forme/heading.json+++ b/public/r/forme/heading.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/heading/heading.tsx",- "content": "import { StyleSheet, Text } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\n\n/**\n * PDF heading mapped to h1–h6 font sizes from the theme.\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\n * @see {@link HeadingProps}\n */\nexport interface HeadingProps extends PDFComponentProps {\n /**\n * @default 1\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default 'bold'\n */\n weight?: HeadingWeight;\n /**\n * @default 'normal'\n */\n tracking?: HeadingTracking;\n /**\n * @default false\n */\n noMargin?: boolean;\n keepWithNext?: boolean;\n}\n\nconst createHeadingStyles = (t: PdfcnTheme) => {\n const { heading } = t.typography;\n const { spacing, fontWeights, letterSpacing } = t.primitives;\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\n const base = {\n color: t.colors.foreground,\n fontFamily: heading.fontFamily,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n };\n return StyleSheet.create({\n capitalize: { textTransform: \"capitalize\" },\n h1: {\n ...base,\n fontSize: heading.fontSize.h1,\n marginBottom: paragraphGap,\n marginTop: spacing[0],\n },\n h2: {\n ...base,\n fontSize: heading.fontSize.h2,\n marginBottom: paragraphGap,\n marginTop: sectionGap,\n },\n h3: {\n ...base,\n fontSize: heading.fontSize.h3,\n marginBottom: paragraphGap,\n marginTop: componentGap,\n },\n h4: {\n ...base,\n fontSize: heading.fontSize.h4,\n marginBottom: paragraphGap,\n marginTop: paragraphGap,\n },\n h5: {\n ...base,\n fontSize: heading.fontSize.h5,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n h6: {\n ...base,\n fontSize: heading.fontSize.h6,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n trackingNormal: { letterSpacing: letterSpacing.normal },\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n });\n};\n\nexport const Heading = ({\n level = 1,\n align,\n color,\n transform,\n weight,\n tracking,\n noMargin,\n children,\n style,\n}: HeadingProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6;\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const trackingMap = {\n normal: styles.trackingNormal,\n tight: styles.trackingTight,\n tighter: styles.trackingTighter,\n wide: styles.trackingWide,\n wider: styles.trackingWider,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\n ];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (tracking && tracking in trackingMap) {\n styleArray.push(trackingMap[tracking]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <Text style={styleArray as never}>{children}</Text>;\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { StyleSheet, Text } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type HeadingWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type HeadingTracking = \"tighter\" | \"tight\" | \"normal\" | \"wide\" | \"wider\";\n\n/**\n * PDF heading mapped to h1–h6 font sizes from the theme.\n * Props - `level` | `align` | `color` | `transform` | `weight` | `tracking` | `noMargin` | `keepWithNext` | `children` | `style`\n * @see {@link HeadingProps}\n */\nexport interface HeadingProps extends PDFComponentProps {\n /**\n * @default 1\n */\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default 'bold'\n */\n weight?: HeadingWeight;\n /**\n * @default 'normal'\n */\n tracking?: HeadingTracking;\n /**\n * @default false\n */\n noMargin?: boolean;\n keepWithNext?: boolean;\n}\n\nconst createHeadingStyles = (t: PdfcnTheme) => {\n const { heading } = t.typography;\n const { spacing, fontWeights, letterSpacing } = t.primitives;\n const { sectionGap, componentGap, paragraphGap } = t.spacing;\n const base = {\n color: t.colors.foreground,\n fontFamily: heading.fontFamily,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n };\n return StyleSheet.create({\n capitalize: { textTransform: \"capitalize\" },\n h1: {\n ...base,\n fontSize: heading.fontSize.h1,\n marginBottom: paragraphGap,\n marginTop: spacing[0],\n },\n h2: {\n ...base,\n fontSize: heading.fontSize.h2,\n marginBottom: paragraphGap,\n marginTop: sectionGap,\n },\n h3: {\n ...base,\n fontSize: heading.fontSize.h3,\n marginBottom: paragraphGap,\n marginTop: componentGap,\n },\n h4: {\n ...base,\n fontSize: heading.fontSize.h4,\n marginBottom: paragraphGap,\n marginTop: paragraphGap,\n },\n h5: {\n ...base,\n fontSize: heading.fontSize.h5,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n h6: {\n ...base,\n fontSize: heading.fontSize.h6,\n marginBottom: spacing[1],\n marginTop: paragraphGap,\n },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n trackingNormal: { letterSpacing: letterSpacing.normal },\n trackingTight: { letterSpacing: letterSpacing.tight * 10 },\n trackingTighter: { letterSpacing: letterSpacing.tight * 15 },\n trackingWide: { letterSpacing: letterSpacing.wide * 10 },\n trackingWider: { letterSpacing: letterSpacing.wider * 10 },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n });\n};\n\nexport const Heading = ({\n level = 1,\n align,\n color,\n transform,\n weight,\n tracking,\n noMargin,\n children,\n style,\n}: HeadingProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createHeadingStyles(theme), [theme]);\n const safeLevel = Math.min(Math.max(Math.round(level), 1), 6) as\n | 1\n | 2\n | 3\n | 4\n | 5\n | 6;\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const trackingMap = {\n normal: styles.trackingNormal,\n tight: styles.trackingTight,\n tighter: styles.trackingTighter,\n wide: styles.trackingWide,\n wider: styles.trackingWider,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [\n styles[`h${safeLevel}` as keyof typeof styles] as Style,\n ];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (tracking && tracking in trackingMap) {\n styleArray.push(trackingMap[tracking]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform as keyof typeof transformMap]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <Text style={mergePdfStyles(styleArray)}>{children}</Text>;\n};\n","type": "registry:component","target": "components/pdf/components/heading/heading.tsx"},diff --git a/public/r/forme/invoice-classic.json b/public/r/forme/invoice-classic.jsonindex 293e26a..1f78417 100644--- a/public/r/forme/invoice-classic.json+++ b/public/r/forme/invoice-classic.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section\n noWrap\n style={{\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n marginTop: 16,\n }}\n >\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-classic/invoice-classic.tsx"},diff --git a/public/r/forme/invoice-consultant.json b/public/r/forme/invoice-consultant.jsonindex f113f52..2259861 100644--- a/public/r/forme/invoice-consultant.json+++ b/public/r/forme/invoice-consultant.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"City, Country · [email protected]\",\n companyName: \"Your Consulting\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 10_300,\n tax: 515,\n total: 10_815,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 8 }}\n >\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"PDFx Inc.\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 9500,\n tax: 475,\n total: 9975,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 8 }}\n >\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"},diff --git a/public/r/forme/invoice-corporate.json b/public/r/forme/invoice-corporate.jsonindex 0c553d4..537ac79 100644--- a/public/r/forme/invoice-corporate.json+++ b/public/r/forme/invoice-corporate.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n { description: \"Training Workshop\", quantity: 3, unitPrice: 2500 },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Corporate billing – Net 30 terms apply.\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 57_000,\n tax: 4560,\n total: 61_560,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (8%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n {\n description: \"Training Workshop (per session)\",\n quantity: 3,\n unitPrice: 2500,\n },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes:\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 56_500,\n tax: 4520,\n total: 61_020,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (8%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"},diff --git a/public/r/forme/invoice-creative.json b/public/r/forme/invoice-creative.jsonindex 5f4d1d5..91ad56e 100644--- a/public/r/forme/invoice-creative.json+++ b/public/r/forme/invoice-creative.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"City, Country · [email protected]\",\n companyName: \"Your Agency\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Creative Services\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 4 }}\n >\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (6.5%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n style={{ marginTop: 4 }}\n >\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n {\n key: \"Tax (6.5%)\",\n value: `$${data.summary.tax.toFixed(2)}`,\n },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-creative/invoice-creative.tsx"},diff --git a/public/r/forme/invoice-minimal.json b/public/r/forme/invoice-minimal.jsonindex eec8111..bca8079 100644--- a/public/r/forme/invoice-minimal.json+++ b/public/r/forme/invoice-minimal.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual Licenselan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: 28,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ paddingRight: 20, width: 251 }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ width: 232 }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"},diff --git a/public/r/forme/invoice-modern.json b/public/r/forme/invoice-modern.jsonindex 4fe5609..bbd75b6 100644--- a/public/r/forme/invoice-modern.json+++ b/public/r/forme/invoice-modern.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n fontSize: 11,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text\n style={{ ...styles.metaValue, fontWeight: \"bold\" }}\n noMargin\n >\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n fontSize: 11,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text\n style={{ ...styles.metaValue, fontWeight: \"bold\" }}\n noMargin\n >\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-modern/invoice-modern.tsx"},diff --git a/public/r/forme/keep-together.json b/public/r/forme/keep-together.jsonindex 8288edf..71e2fde 100644--- a/public/r/forme/keep-together.json+++ b/public/r/forme/keep-together.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/keep-together/keep-together.tsx",- "content": "import { View } from \"@formepdf/react\";\nimport type { ReactNode } from \"react\";\n\nimport type { Style } from \"@/registry/themes\";\n\nexport interface KeepTogetherProps {\n children?: ReactNode;\n minPresenceAhead?: number;\n style?: Style;\n}\n\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\n <View wrap={false} style={style as never}>\n {children}\n </View>\n);\n",+ "content": "import type { ReactNode } from \"react\";\n\nimport type { Style } from \"@/registry/themes\";\n\nimport { View } from \"../../lib/forme-primitives\";\n\nexport interface KeepTogetherProps {\n children?: ReactNode;\n minPresenceAhead?: number;\n style?: Style;\n}\n\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\n <View wrap={false} style={style as never}>\n {children}\n </View>\n);\n","type": "registry:component","target": "components/pdf/components/keep-together/keep-together.tsx"},diff --git a/public/r/forme/key-value.json b/public/r/forme/key-value.jsonindex a06cfac..c96f4ee 100644--- a/public/r/forme/key-value.json+++ b/public/r/forme/key-value.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/key-value/key-value.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * A single key-value row with optional per-item color and style overrides.\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\n * @see {@link KeyValueEntry}\n */\nexport interface KeyValueEntry {\n key: string;\n value: string;\n valueColor?: string;\n valueStyle?: Style;\n keyStyle?: Style;\n}\n\n/**\n * List of key-value pairs with layout and style options.\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\n * @see {@link KeyValueProps}\n */\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\n items: KeyValueEntry[];\n /**\n * @default 'horizontal'\n */\n direction?: KeyValueDirection;\n /**\n * @default false\n */\n divided?: boolean;\n /**\n * @default 'md'\n */\n size?: KeyValueSize;\n /**\n * @default 1\n */\n labelFlex?: number;\n labelColor?: string;\n valueColor?: string;\n /**\n * @default false\n */\n boldValue?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n dividerColor?: string;\n dividerThickness?: number;\n dividerMargin?: number;\n}\n\nconst createKeyValueStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n const keyBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.medium,\n };\n const valueBase = {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.regular,\n };\n return StyleSheet.create({\n container: { flexDirection: \"column\" },\n divider: {\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n },\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\n keyMd: { ...keyBase, fontSize: body.fontSize },\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\n rowHorizontal: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n paddingVertical: spacing[1],\n },\n rowVertical: {\n flexDirection: \"column\",\n marginBottom: t.spacing.paragraphGap,\n },\n valueBold: { fontWeight: fontWeights.bold },\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\n valueMd: { ...valueBase, fontSize: body.fontSize },\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const KeyValue = ({\n items,\n direction = \"horizontal\",\n divided = false,\n size = \"md\",\n labelFlex = 1,\n labelColor,\n valueColor,\n boldValue = false,\n noWrap = false,\n dividerColor,\n dividerThickness,\n dividerMargin,\n style,\n}: KeyValueProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\n const keyStyleMap = {\n lg: styles.keyLg,\n md: styles.keyMd,\n sm: styles.keySm,\n } as Record<KeyValueSize, Style>;\n const valueStyleMap = {\n lg: styles.valueLg,\n md: styles.valueMd,\n sm: styles.valueSm,\n } as Record<KeyValueSize, Style>;\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View wrap={!noWrap} style={containerStyles as never}>\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n const keyStyles: Style[] = [keyStyleMap[size]];\n if (labelColor) {\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\n }\n if (item.keyStyle) {\n keyStyles.push(item.keyStyle);\n }\n const valStyles: Style[] = [valueStyleMap[size]];\n if (boldValue) {\n valStyles.push(styles.valueBold);\n }\n const resolvedValueColor = item.valueColor ?? valueColor;\n if (resolvedValueColor) {\n valStyles.push({\n color: resolveColor(resolvedValueColor, theme.colors),\n });\n }\n if (item.valueStyle) {\n valStyles.push(item.valueStyle);\n }\n\n if (direction === \"horizontal\") {\n const rowStyles: Style[] = [styles.rowHorizontal];\n if (divided && !isLast) {\n const dividerStyle: Style = {};\n if (dividerColor) {\n dividerStyle.borderBottomColor = resolveColor(\n dividerColor,\n theme.colors\n );\n }\n if (dividerThickness) {\n dividerStyle.borderBottomWidth = dividerThickness;\n }\n if (dividerMargin) {\n dividerStyle.marginBottom = dividerMargin;\n }\n rowStyles.push({ ...styles.divider, ...dividerStyle });\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={[...keyStyles, { flex: labelFlex }] as never}>\n {item.key}\n </PDFText>\n <PDFText\n style={[...valStyles, { flex: 1, textAlign: \"right\" }] as never}\n >\n {item.value}\n </PDFText>\n </View>\n );\n }\n\n const rowStyles: Style[] = [styles.rowVertical];\n if (divided && !isLast) {\n rowStyles.push(styles.divider);\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={keyStyles as never}>{item.key}</PDFText>\n <PDFText style={valStyles as never}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type KeyValueDirection = \"horizontal\" | \"vertical\";\nexport type KeyValueSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * A single key-value row with optional per-item color and style overrides.\n * Props - `key` | `value` | `valueColor` | `valueStyle` | `keyStyle`\n * @see {@link KeyValueEntry}\n */\nexport interface KeyValueEntry {\n key: string;\n value: string;\n valueColor?: string;\n valueStyle?: Style;\n keyStyle?: Style;\n}\n\n/**\n * List of key-value pairs with layout and style options.\n * Props - `items` | `direction` | `divided` | `size` | `labelFlex` | `labelColor` | `valueColor` | `boldValue` | `noWrap` | `dividerColor` | `dividerThickness` | `dividerMargin` | `style`\n * @see {@link KeyValueProps}\n */\nexport interface KeyValueProps extends Omit<PDFComponentProps, \"children\"> {\n items: KeyValueEntry[];\n /**\n * @default 'horizontal'\n */\n direction?: KeyValueDirection;\n /**\n * @default false\n */\n divided?: boolean;\n /**\n * @default 'md'\n */\n size?: KeyValueSize;\n /**\n * @default 1\n */\n labelFlex?: number;\n labelColor?: string;\n valueColor?: string;\n /**\n * @default false\n */\n boldValue?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n dividerColor?: string;\n dividerThickness?: number;\n dividerMargin?: number;\n}\n\nconst createKeyValueStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n const keyBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.medium,\n };\n const valueBase = {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontWeight: fontWeights.regular,\n };\n return StyleSheet.create({\n container: { flexDirection: \"column\", width: \"100%\" },\n divider: {\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n },\n keyLg: { ...keyBase, fontSize: t.primitives.typography.base },\n keyMd: { ...keyBase, fontSize: body.fontSize },\n keySm: { ...keyBase, fontSize: t.primitives.typography.xs },\n lastRowStretch: {\n borderBottomColor: \"#ffffff\",\n borderBottomStyle: \"solid\",\n borderBottomWidth: 0.01,\n },\n rowHorizontal: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n paddingVertical: spacing[1],\n width: \"100%\",\n },\n rowVertical: {\n flexDirection: \"column\",\n marginBottom: t.spacing.paragraphGap,\n },\n valueBold: { fontWeight: fontWeights.bold },\n valueLg: { ...valueBase, fontSize: t.primitives.typography.base },\n valueMd: { ...valueBase, fontSize: body.fontSize },\n valueSm: { ...valueBase, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const KeyValue = ({\n items,\n direction = \"horizontal\",\n divided = false,\n size = \"md\",\n labelFlex = 1,\n labelColor,\n valueColor,\n boldValue = false,\n noWrap = false,\n dividerColor,\n dividerThickness,\n dividerMargin,\n style,\n}: KeyValueProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createKeyValueStyles(theme), [theme]);\n const keyStyleMap = {\n lg: styles.keyLg,\n md: styles.keyMd,\n sm: styles.keySm,\n } as Record<KeyValueSize, Style>;\n const valueStyleMap = {\n lg: styles.valueLg,\n md: styles.valueMd,\n sm: styles.valueSm,\n } as Record<KeyValueSize, Style>;\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View wrap={!noWrap} style={containerStyles as never}>\n {items.map((item, index) => {\n const isLast = index === items.length - 1;\n const keyStyles: Style[] = [keyStyleMap[size]];\n if (labelColor) {\n keyStyles.push({ color: resolveColor(labelColor, theme.colors) });\n }\n if (item.keyStyle) {\n keyStyles.push(item.keyStyle);\n }\n const valStyles: Style[] = [valueStyleMap[size]];\n if (boldValue) {\n valStyles.push(styles.valueBold);\n }\n const resolvedValueColor = item.valueColor ?? valueColor;\n if (resolvedValueColor) {\n valStyles.push({\n color: resolveColor(resolvedValueColor, theme.colors),\n });\n }\n if (item.valueStyle) {\n valStyles.push(item.valueStyle);\n }\n\n if (direction === \"horizontal\") {\n const rowStyles: Style[] = [styles.rowHorizontal];\n if (divided) {\n if (isLast) {\n rowStyles.push(styles.lastRowStretch);\n } else {\n const dividerStyle: Style = {};\n if (dividerColor) {\n dividerStyle.borderBottomColor = resolveColor(\n dividerColor,\n theme.colors\n );\n }\n if (dividerThickness) {\n dividerStyle.borderBottomWidth = dividerThickness;\n }\n if (dividerMargin) {\n dividerStyle.marginBottom = dividerMargin;\n }\n rowStyles.push({ ...styles.divider, ...dividerStyle });\n }\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={[...keyStyles, { flex: labelFlex }] as never}>\n {item.key}\n </PDFText>\n <PDFText\n style={[...valStyles, { flex: 1, textAlign: \"right\" }] as never}\n >\n {item.value}\n </PDFText>\n </View>\n );\n }\n\n const rowStyles: Style[] = [styles.rowVertical];\n if (divided && !isLast) {\n rowStyles.push(styles.divider);\n }\n return (\n <View key={item.key} style={rowStyles as never}>\n <PDFText style={keyStyles as never}>{item.key}</PDFText>\n <PDFText style={valStyles as never}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/key-value/key-value.tsx"},diff --git a/public/r/forme/link.json b/public/r/forme/link.jsonindex 6cba25a..5368361 100644--- a/public/r/forme/link.json+++ b/public/r/forme/link.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/link/link.tsx",- "content": "import { Link as PDFLink, StyleSheet } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\nexport type LinkUnderline = \"always\" | \"none\";\n\n/**\n * Clickable hyperlink for PDF documents.\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\n * @see {@link LinkProps}\n */\nexport interface LinkProps extends PDFComponentProps {\n href: string;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n /**\n * @default 'default'\n */\n variant?: LinkVariant;\n /**\n * @default 'always'\n */\n underline?: LinkUnderline;\n}\n\nconst createLinkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n const base = {\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n };\n return StyleSheet.create({\n default: {\n ...base,\n color: t.colors.accent,\n fontWeight: fontWeights.medium,\n textDecoration: \"underline\",\n },\n muted: {\n ...base,\n color: t.colors.mutedForeground,\n fontWeight: fontWeights.regular,\n textDecoration: \"underline\",\n },\n primary: {\n ...base,\n color: t.colors.primary,\n fontWeight: fontWeights.semibold,\n textDecoration: \"underline\",\n },\n underlineAlways: { textDecoration: \"underline\" },\n underlineNone: { textDecoration: \"none\" },\n });\n};\n\nexport const Link = ({\n href,\n align,\n color,\n variant = \"default\",\n underline,\n children,\n style,\n}: LinkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\n const variantMap = {\n default: styles.default,\n muted: styles.muted,\n primary: styles.primary,\n };\n const underlineMap = {\n always: styles.underlineAlways,\n none: styles.underlineNone,\n };\n const styleArray: Style[] = [variantMap[variant]];\n if (underline && underline in underlineMap) {\n styleArray.push(underlineMap[underline]);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <PDFLink href={href} style={styleArray as never}>\n {children}\n </PDFLink>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Link as PDFLink,\n StyleSheet,\n Text as PDFText,\n} from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type LinkVariant = \"default\" | \"muted\" | \"primary\";\nexport type LinkUnderline = \"always\" | \"none\";\n\n/**\n * Clickable hyperlink for PDF documents.\n * Props - `href` | `children` | `align` | `color` | `variant` | `underline` | `style`\n * @see {@link LinkProps}\n */\nexport interface LinkProps extends PDFComponentProps {\n href: string;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\";\n color?: string;\n /**\n * @default 'default'\n */\n variant?: LinkVariant;\n /**\n * @default 'always'\n */\n underline?: LinkUnderline;\n}\n\nconst createLinkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n const base = {\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n };\n return StyleSheet.create({\n default: {\n ...base,\n color: t.colors.accent,\n fontWeight: fontWeights.medium,\n textDecoration: \"underline\",\n },\n muted: {\n ...base,\n color: t.colors.mutedForeground,\n fontWeight: fontWeights.regular,\n textDecoration: \"underline\",\n },\n primary: {\n ...base,\n color: t.colors.primary,\n fontWeight: fontWeights.semibold,\n textDecoration: \"underline\",\n },\n underlineAlways: { textDecoration: \"underline\" },\n underlineNone: { textDecoration: \"none\" },\n });\n};\n\nexport const Link = ({\n href,\n align,\n color,\n variant = \"default\",\n underline,\n children,\n style,\n}: LinkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createLinkStyles(theme), [theme]);\n const variantMap = {\n default: styles.default,\n muted: styles.muted,\n primary: styles.primary,\n };\n const underlineMap = {\n always: styles.underlineAlways,\n none: styles.underlineNone,\n };\n const styleArray: Style[] = [variantMap[variant]];\n if (underline && underline in underlineMap) {\n styleArray.push(underlineMap[underline]);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <PDFText style={styleArray as never}>\n <PDFLink href={href} style={styleArray as never}>\n {children}\n </PDFLink>\n </PDFText>\n );\n};\n","type": "registry:component","target": "components/pdf/components/link/link.tsx"},diff --git a/public/r/forme/list.json b/public/r/forme/list.jsonindex 482ee76..dba4684 100644--- a/public/r/forme/list.json+++ b/public/r/forme/list.json@@ -13,13 +13,13 @@"files": [{"path": "registry/bases/forme/components/list/list.styles.ts",- "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n checkMark: {\n color: t.colors.background,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 8,\n fontWeight: fontWeights.bold,\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n",+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n checklistTextWrap: {\n flex: 1,\n marginLeft: spacing[2],\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n","type": "registry:component","target": "components/pdf/components/list/list.styles.ts"},{"path": "registry/bases/forme/components/list/list.tsx",- "content": "import { Text as PDFText, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type React from \"react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View\n style={\n [styles.checkBox, isChecked ? styles.checkBoxChecked : {}] as never\n }\n >\n {isChecked ? <PDFText style={styles.checkMark}>✓</PDFText> : null}\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles) as never}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={\n [\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ] as never\n }\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View style={styleArray as never}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n",+ "content": "import type React from \"react\";\n\nimport { Text as PDFText, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View\n style={\n [styles.checkBox, isChecked ? styles.checkBoxChecked : {}] as never\n }\n ></View>\n <View style={styles.checklistTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\") as never}\n >\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles) as never}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles) as never}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={\n [\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ] as never\n }\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View style={styleArray as never}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/list/list.tsx"},diff --git a/public/r/forme/page-footer.json b/public/r/forme/page-footer.jsonindex 4933e4a..2e89f94 100644--- a/public/r/forme/page-footer.json+++ b/public/r/forme/page-footer.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/page-footer/page-footer.tsx",- "content": "import { Text as PDFText, StyleSheet, View, Fixed } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type React from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nconst wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {\n if (!fixed) {\n return node;\n }\n return <Fixed position=\"footer\">{node}</Fixed>;\n};\nexport type PageFooterVariant =\n | \"simple\"\n | \"centered\"\n | \"branded\"\n | \"minimal\"\n | \"three-column\"\n | \"detailed\";\n\n/**\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\n * @see {@link PageFooterProps}\n */\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\n leftText?: string;\n rightText?: string;\n centerText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageFooterVariant;\n background?: string;\n textColor?: string;\n marginTop?: number;\n address?: string;\n phone?: string;\n email?: string;\n website?: string;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default false\n */\n sticky?: boolean;\n /**\n * @default 0\n */\n pagePadding?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageFooterStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n\n const textBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: body.lineHeight,\n };\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingHorizontal: spacing[4],\n paddingVertical: spacing[3],\n },\n\n centeredContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n\n companyBold: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.bold,\n },\n\n companyName: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.medium,\n },\n\n contactInfoCenter: {\n ...textBase,\n fontSize: t.primitives.typography.xs - 1,\n marginTop: spacing[0.5],\n textAlign: \"center\",\n },\n detailedContainer: {\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n detailedLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n detailedPageNumber: {\n ...textBase,\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n paddingTop: spacing[2],\n textAlign: \"center\",\n },\n detailedRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n detailedTopRow: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: spacing[2],\n },\n\n minimalContainer: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[1],\n paddingTop: spacing[1],\n },\n simpleContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n textBranded: {\n ...textBase,\n color: c.primaryForeground,\n fontWeight: fontWeights.medium,\n },\n textBrandedRight: {\n ...textBase,\n color: c.primaryForeground,\n textAlign: \"right\",\n },\n textCenter: {\n ...textBase,\n flex: 1,\n textAlign: \"center\",\n },\n textCenteredVariant: {\n ...textBase,\n marginBottom: spacing[1],\n textAlign: \"center\",\n },\n\n textLeft: {\n ...textBase,\n flex: 1,\n },\n textRight: {\n ...textBase,\n textAlign: \"right\",\n },\n threeColumnCenter: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnContainer: {\n alignItems: \"flex-start\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n threeColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageFooterStyles>;\n\nconst applyTextColor = (\n styles: Style[],\n color: string | undefined\n): Style[] => {\n if (!color) {\n return styles;\n }\n return [...styles, { color }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n textStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={textStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={textStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderThreeColumn = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.threeColumnLeft}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle as never}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle as never}>{email}</PDFText>}\n {website && <PDFText style={centerStyle as never}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n </View>\n);\n\nconst renderDetailed = (\n styles: Styles,\n containerStyles: Style[],\n companyStyle: Style[],\n addrStyle: Style[],\n contactStyle: Style[],\n pageNumStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && (\n <PDFText style={companyStyle as never}>{leftText}</PDFText>\n )}\n {address && <PDFText style={addrStyle as never}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && (\n <PDFText style={contactStyle as never}>{`Phone: ${phone}`}</PDFText>\n )}\n {email && (\n <PDFText style={contactStyle as never}>{`Email: ${email}`}</PDFText>\n )}\n {website && (\n <PDFText style={contactStyle as never}>{`Web: ${website}`}</PDFText>\n )}\n </View>\n </View>\n {rightText && <PDFText style={pageNumStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n centerText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {centerText && <PDFText style={centerStyle as never}>{centerText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nexport const PageFooter = ({\n leftText,\n rightText,\n centerText,\n variant = \"simple\",\n background,\n textColor,\n marginTop,\n address,\n phone,\n email,\n website,\n fixed = false,\n sticky = false,\n pagePadding = 0,\n noWrap = true,\n style,\n}: PageFooterProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\n const _isFixed = fixed || sticky;\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\n const resolvedTextColor = textColor\n ? resolveColor(textColor, theme.colors)\n : undefined;\n const stickyStyle: Style = sticky\n ? {\n bottom: pagePadding,\n left: pagePadding,\n position: \"absolute\",\n right: pagePadding,\n }\n : {};\n\n const applyOverrides = (base: Style[]): Style[] => {\n if (background) {\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n base.push(style);\n }\n if (sticky) {\n base.push(stickyStyle);\n }\n return base;\n };\n\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\n applyTextColor([styles.textBranded], resolvedTextColor),\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n detailed: () =>\n renderDetailed(\n styles,\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\n applyTextColor([styles.companyBold], resolvedTextColor),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n centerText,\n rightText,\n noWrap\n ),\n \"three-column\": () =>\n renderThreeColumn(\n styles,\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\n applyTextColor([styles.companyName], resolvedTextColor),\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n };\n\n return wrapFixed(_isFixed, variantRenderers[variant]() as React.ReactElement);\n};\n",+ "content": "import type React from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nconst wrapFixed = (\n fixed: boolean | undefined,\n node: React.ReactElement,\n footerOffset = 0\n) => {\n if (!fixed) {\n return node;\n }\n const nodeProps = node.props as {\n children?: React.ReactNode;\n style?: Style;\n };\n return (\n <Fixed\n position=\"footer\"\n style={[\n nodeProps.style,\n footerOffset ? { marginBottom: -footerOffset } : undefined,\n ]}\n >\n {nodeProps.children}\n </Fixed>\n );\n};\nexport type PageFooterVariant =\n | \"simple\"\n | \"centered\"\n | \"branded\"\n | \"minimal\"\n | \"three-column\"\n | \"detailed\";\n\n/**\n * Footer row with layout variants, optional sticky or fixed positioning, and contact info support.\n * Props - `leftText` | `rightText` | `centerText` | `variant` | `background` | `textColor` | `marginTop` | `address` | `phone` | `email` | `website` | `fixed` | `sticky` | `pagePadding` | `noWrap` | `style`\n * @see {@link PageFooterProps}\n */\nexport interface PageFooterProps extends Omit<PDFComponentProps, \"children\"> {\n leftText?: string;\n rightText?: string;\n centerText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageFooterVariant;\n background?: string;\n textColor?: string;\n marginTop?: number;\n address?: string;\n phone?: string;\n email?: string;\n website?: string;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default false\n */\n sticky?: boolean;\n /**\n * @default 0\n */\n pagePadding?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageFooterStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights } = t.primitives;\n const c = t.colors;\n const { body } = t.typography;\n\n const textBase = {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: body.lineHeight,\n };\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingHorizontal: spacing[4],\n paddingVertical: spacing[3],\n },\n\n centeredContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n\n companyBold: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.bold,\n },\n\n companyName: {\n ...textBase,\n color: c.foreground,\n fontWeight: fontWeights.medium,\n },\n\n contactInfoCenter: {\n ...textBase,\n fontSize: t.primitives.typography.xs - 1,\n marginTop: spacing[0.5],\n textAlign: \"center\",\n },\n detailedContainer: {\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"column\",\n paddingTop: spacing[3],\n },\n detailedLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n detailedPageNumber: {\n ...textBase,\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n paddingTop: spacing[2],\n textAlign: \"center\",\n },\n detailedRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n detailedTopRow: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: spacing[2],\n },\n\n minimalContainer: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[1],\n paddingTop: spacing[1],\n },\n simpleContainer: {\n alignItems: \"center\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n simpleTextCenter: {\n ...textBase,\n textAlign: \"center\",\n },\n simpleTextLeft: {\n ...textBase,\n },\n simpleTextRight: {\n ...textBase,\n textAlign: \"right\",\n },\n textBranded: {\n ...textBase,\n color: c.primaryForeground,\n fontWeight: fontWeights.medium,\n },\n textBrandedRight: {\n ...textBase,\n color: c.primaryForeground,\n textAlign: \"right\",\n },\n textCenter: {\n ...textBase,\n flex: 1,\n textAlign: \"center\",\n },\n textCenteredVariant: {\n ...textBase,\n marginBottom: spacing[1],\n textAlign: \"center\",\n },\n\n textLeft: {\n ...textBase,\n flex: 1,\n },\n textRight: {\n ...textBase,\n textAlign: \"right\",\n },\n threeColumnCenter: {\n alignItems: \"center\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnContainer: {\n alignItems: \"flex-start\",\n borderTopColor: c.border,\n borderTopStyle: \"solid\",\n borderTopWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingTop: spacing[3],\n },\n threeColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n threeColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageFooterStyles>;\n\nconst applyTextColor = (\n styles: Style[],\n color: string | undefined\n): Style[] => {\n if (!color) {\n return styles;\n }\n return [...styles, { color }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n textStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={textStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={textStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderThreeColumn = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.threeColumnLeft}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle as never}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle as never}>{email}</PDFText>}\n {website && <PDFText style={centerStyle as never}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n </View>\n);\n\nconst renderDetailed = (\n styles: Styles,\n containerStyles: Style[],\n companyStyle: Style[],\n addrStyle: Style[],\n contactStyle: Style[],\n pageNumStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n website: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && (\n <PDFText style={companyStyle as never}>{leftText}</PDFText>\n )}\n {address && <PDFText style={addrStyle as never}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && (\n <PDFText style={contactStyle as never}>{`Phone: ${phone}`}</PDFText>\n )}\n {email && (\n <PDFText style={contactStyle as never}>{`Email: ${email}`}</PDFText>\n )}\n {website && (\n <PDFText style={contactStyle as never}>{`Web: ${website}`}</PDFText>\n )}\n </View>\n </View>\n {rightText && <PDFText style={pageNumStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n leftStyle: Style[],\n centerStyle: Style[],\n rightStyle: Style[],\n leftText: string | undefined,\n centerText: string | undefined,\n rightText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {leftText && <PDFText style={leftStyle as never}>{leftText}</PDFText>}\n {centerText && <PDFText style={centerStyle as never}>{centerText}</PDFText>}\n {rightText && <PDFText style={rightStyle as never}>{rightText}</PDFText>}\n </View>\n);\n\nexport const PageFooter = ({\n leftText,\n rightText,\n centerText,\n variant = \"simple\",\n background,\n textColor,\n marginTop,\n address,\n phone,\n email,\n website,\n fixed = false,\n sticky = false,\n pagePadding = 0,\n noWrap = true,\n style,\n}: PageFooterProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageFooterStyles(theme), [theme]);\n const _isFixed = fixed || sticky;\n const mt = sticky ? 0 : (marginTop ?? theme.spacing.sectionGap);\n const resolvedTextColor = textColor\n ? resolveColor(textColor, theme.colors)\n : undefined;\n const stickyStyle: Style = {};\n\n const applyOverrides = (base: Style[]): Style[] => {\n if (background) {\n base.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n base.push(style);\n }\n if (sticky) {\n base.push(stickyStyle);\n }\n return base;\n };\n\n const variantRenderers: Record<PageFooterVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n applyOverrides([styles.brandedContainer, { marginTop: mt }]),\n applyTextColor([styles.textBranded], resolvedTextColor),\n applyTextColor([styles.textBrandedRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n applyOverrides([styles.centeredContainer, { marginTop: mt }]),\n applyTextColor([styles.textCenteredVariant], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n detailed: () =>\n renderDetailed(\n styles,\n applyOverrides([styles.detailedContainer, { marginTop: mt }]),\n applyTextColor([styles.companyBold], resolvedTextColor),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n applyTextColor([styles.detailedPageNumber], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n applyOverrides([styles.minimalContainer, { marginTop: mt }]),\n applyTextColor([styles.textLeft], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n applyOverrides([styles.simpleContainer, { marginTop: mt }]),\n applyTextColor(\n [styles.simpleTextLeft, { width: centerText ? 160 : 360 }],\n resolvedTextColor\n ),\n applyTextColor(\n [styles.simpleTextCenter, { width: 160 }],\n resolvedTextColor\n ),\n applyTextColor(\n [styles.simpleTextRight, { width: centerText ? 160 : 120 }],\n resolvedTextColor\n ),\n leftText,\n centerText,\n rightText,\n noWrap\n ),\n \"three-column\": () =>\n renderThreeColumn(\n styles,\n applyOverrides([styles.threeColumnContainer, { marginTop: mt }]),\n applyTextColor([styles.companyName], resolvedTextColor),\n applyTextColor([styles.contactInfoCenter], resolvedTextColor),\n applyTextColor([styles.textRight], resolvedTextColor),\n leftText,\n rightText,\n address,\n phone,\n email,\n website,\n noWrap\n ),\n };\n\n return wrapFixed(\n _isFixed,\n variantRenderers[variant]() as React.ReactElement,\n sticky ? Math.max(theme.spacing.page.marginBottom - pagePadding, 0) : 0\n );\n};\n","type": "registry:component","target": "components/pdf/components/page-footer/page-footer.tsx"},diff --git a/public/r/forme/page-header.json b/public/r/forme/page-header.jsonindex 393b073..98e7d6f 100644--- a/public/r/forme/page-header.json+++ b/public/r/forme/page-header.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/page-header/page-header.tsx",- "content": "import { Text as PDFText, StyleSheet, View, Fixed } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nconst wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {\n if (!fixed) {\n return node;\n }\n return <Fixed position=\"header\">{node}</Fixed>;\n};\nexport type PageHeaderVariant =\n | \"simple\"\n | \"centered\"\n | \"minimal\"\n | \"branded\"\n | \"logo-left\"\n | \"logo-right\"\n | \"two-column\";\n\n/**\n * Header row with layout variants, logo support, and optional fixed positioning.\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\n * @see {@link PageHeaderProps}\n */\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\n title: string;\n subtitle?: string;\n rightText?: string;\n rightSubText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageHeaderVariant;\n background?: string;\n titleColor?: string;\n marginBottom?: number;\n address?: string;\n phone?: string;\n email?: string;\n logo?: ReactNode;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const { heading, body } = t.typography;\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n borderRadius: borderRadius.sm,\n display: \"flex\",\n flexDirection: \"column\",\n padding: spacing[6],\n },\n centeredContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingBottom: spacing[4],\n },\n contactInfo: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[0.5],\n textAlign: \"right\",\n },\n\n logoContainer: {\n height: 48,\n marginRight: spacing[4],\n width: 48,\n },\n\n logoContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n logoLeftContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n paddingBottom: spacing[4],\n },\n logoRightContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n logoRightContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n\n logoRightLogoContainer: {\n height: 48,\n marginLeft: spacing[4],\n width: 48,\n },\n minimalContainer: {\n alignItems: \"center\",\n borderBottomColor: c.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[3],\n },\n minimalLeft: {\n flex: 1,\n },\n minimalRight: {\n alignItems: \"flex-end\",\n },\n\n rightSubText: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"right\",\n },\n rightText: {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n fontWeight: fontWeights.medium,\n textAlign: \"right\",\n },\n simpleContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n simpleLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n simpleRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n\n subtitle: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n lineHeight: body.lineHeight,\n marginTop: spacing[1],\n },\n subtitleBranded: {\n color: c.primaryForeground,\n marginTop: spacing[1],\n },\n subtitleCentered: {\n textAlign: \"center\",\n },\n\n title: {\n color: c.foreground,\n fontFamily: heading.fontFamily,\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n marginBottom: 0,\n },\n titleBranded: {\n color: c.primaryForeground,\n },\n titleCentered: {\n textAlign: \"center\",\n },\n\n titleMinimal: {\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n },\n twoColumnContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n twoColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n twoColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\n\nconst buildContainerStyles = (\n base: Style,\n mb: number,\n background: string | undefined,\n theme: PdfcnTheme,\n style: Style | undefined,\n ...extras: Style[]\n): Style[] => {\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\n if (background) {\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n result.push(style);\n }\n return result;\n};\n\nconst buildTitleStyles = (\n base: Style[],\n titleColor: string | undefined,\n theme: PdfcnTheme\n): Style[] => {\n if (!titleColor) {\n return base;\n }\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderLogoRight = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\n </View>\n);\n\nconst renderLogoLeft = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderTwoColumn = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(address || phone || email) && (\n <View style={styles.twoColumnRight}>\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\n </View>\n )}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.minimalRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nexport const PageHeader = ({\n title,\n subtitle,\n rightText,\n rightSubText,\n variant = \"simple\",\n background,\n titleColor,\n marginBottom,\n logo,\n address,\n phone,\n email,\n fixed = false,\n noWrap = true,\n style,\n}: PageHeaderProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\n const mb = marginBottom ?? theme.spacing.sectionGap;\n\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n buildContainerStyles(\n styles.brandedContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleBranded, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n buildContainerStyles(\n styles.centeredContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n \"logo-left\": () =>\n renderLogoLeft(\n styles,\n buildContainerStyles(\n styles.logoLeftContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n rightText,\n rightSubText,\n noWrap\n ),\n \"logo-right\": () =>\n renderLogoRight(\n styles,\n buildContainerStyles(\n styles.logoRightContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n buildContainerStyles(\n styles.minimalContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleMinimal],\n titleColor,\n theme\n ),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n buildContainerStyles(\n styles.simpleContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n \"two-column\": () =>\n renderTwoColumn(\n styles,\n buildContainerStyles(\n styles.twoColumnContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n address,\n phone,\n email,\n noWrap\n ),\n };\n\n return wrapFixed(fixed, variantRenderers[variant]() as React.ReactElement);\n};\n",+ "content": "import type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nconst wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {\n if (!fixed) {\n return node;\n }\n return <Fixed position=\"header\">{node}</Fixed>;\n};\nexport type PageHeaderVariant =\n | \"simple\"\n | \"centered\"\n | \"minimal\"\n | \"branded\"\n | \"logo-left\"\n | \"logo-right\"\n | \"two-column\";\n\n/**\n * Header row with layout variants, logo support, and optional fixed positioning.\n * Props - `title` | `subtitle` | `rightText` | `rightSubText` | `variant` | `background` | `titleColor` | `marginBottom` | `address` | `phone` | `email` | `logo` | `fixed` | `noWrap` | `style`\n * @see {@link PageHeaderProps}\n */\nexport interface PageHeaderProps extends Omit<PDFComponentProps, \"children\"> {\n title: string;\n subtitle?: string;\n rightText?: string;\n rightSubText?: string;\n /**\n * @default 'simple'\n */\n variant?: PageHeaderVariant;\n background?: string;\n titleColor?: string;\n marginBottom?: number;\n address?: string;\n phone?: string;\n email?: string;\n logo?: ReactNode;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n noWrap?: boolean;\n}\n\nconst createPageHeaderStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const { heading, body } = t.typography;\n\n return StyleSheet.create({\n brandedContainer: {\n alignItems: \"center\",\n backgroundColor: c.primary,\n borderRadius: borderRadius.sm,\n display: \"flex\",\n flexDirection: \"column\",\n padding: spacing[6],\n },\n centeredContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"column\",\n paddingBottom: spacing[4],\n },\n contactInfo: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[0.5],\n textAlign: \"right\",\n },\n\n logoContainer: {\n flexShrink: 0,\n height: 48,\n marginRight: spacing[4],\n width: 48,\n },\n\n logoContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n paddingLeft: spacing[4],\n },\n logoLeftContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n paddingBottom: spacing[4],\n },\n logoRightContainer: {\n alignItems: \"center\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n logoRightContent: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n\n logoRightLogoContainer: {\n flexShrink: 0,\n height: 48,\n marginLeft: spacing[4],\n width: 48,\n },\n minimalContainer: {\n alignItems: \"center\",\n borderBottomColor: c.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[1],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[3],\n },\n minimalLeft: {\n flex: 1,\n },\n minimalRight: {\n alignItems: \"flex-end\",\n },\n\n rightSubText: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"right\",\n },\n rightText: {\n color: c.foreground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n fontWeight: fontWeights.medium,\n textAlign: \"right\",\n },\n simpleContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n\n simpleLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n simpleRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n\n subtitle: {\n color: c.mutedForeground,\n fontFamily: body.fontFamily,\n fontSize: body.fontSize,\n lineHeight: body.lineHeight,\n marginTop: spacing[1],\n },\n subtitleBranded: {\n color: c.primaryForeground,\n marginTop: spacing[1],\n },\n subtitleCentered: {\n textAlign: \"center\",\n },\n\n title: {\n color: c.foreground,\n fontFamily: heading.fontFamily,\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n lineHeight: heading.lineHeight,\n marginBottom: 0,\n },\n titleBranded: {\n color: c.primaryForeground,\n },\n titleCentered: {\n textAlign: \"center\",\n },\n\n titleMinimal: {\n fontSize: heading.fontSize.h3,\n fontWeight: fontWeights.bold,\n },\n twoColumnContainer: {\n alignItems: \"flex-start\",\n borderBottomColor: c.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: spacing[0.5],\n display: \"flex\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n paddingBottom: spacing[4],\n },\n twoColumnLeft: {\n display: \"flex\",\n flex: 1,\n flexDirection: \"column\",\n },\n twoColumnRight: {\n alignItems: \"flex-end\",\n display: \"flex\",\n flexDirection: \"column\",\n },\n });\n};\n\ntype Styles = ReturnType<typeof createPageHeaderStyles>;\n\nconst buildContainerStyles = (\n base: Style,\n mb: number,\n background: string | undefined,\n theme: PdfcnTheme,\n style: Style | undefined,\n ...extras: Style[]\n): Style[] => {\n const result: Style[] = [base, { marginBottom: mb }, ...extras];\n if (background) {\n result.push({ backgroundColor: resolveColor(background, theme.colors) });\n }\n if (style) {\n result.push(style);\n }\n return result;\n};\n\nconst buildTitleStyles = (\n base: Style[],\n titleColor: string | undefined,\n theme: PdfcnTheme\n): Style[] => {\n if (!titleColor) {\n return base;\n }\n return [...base, { color: resolveColor(titleColor, theme.colors) }];\n};\n\nconst renderBranded = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderCentered = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered] as never}>\n {subtitle}\n </PDFText>\n )}\n </View>\n);\n\nconst renderLogoRight = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {logo && <View style={styles.logoRightLogoContainer}>{logo}</View>}\n </View>\n);\n\nconst renderLogoLeft = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n logo: ReactNode | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderTwoColumn = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n address: string | undefined,\n phone: string | undefined,\n email: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(address || phone || email) && (\n <View style={styles.twoColumnRight}>\n {address && <PDFText style={styles.contactInfo}>{address}</PDFText>}\n {phone && <PDFText style={styles.contactInfo}>{phone}</PDFText>}\n {email && <PDFText style={styles.contactInfo}>{email}</PDFText>}\n </View>\n )}\n </View>\n);\n\nconst renderMinimal = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.minimalRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nconst renderSimple = (\n styles: Styles,\n containerStyles: Style[],\n titleStyles: Style[],\n title: string,\n subtitle: string | undefined,\n rightText: string | undefined,\n rightSubText: string | undefined,\n noWrap: boolean\n) => (\n <View wrap={!noWrap} style={containerStyles as never}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles as never}>{title}</PDFText>\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n </View>\n {(rightText || rightSubText) && (\n <View style={styles.simpleRight}>\n {rightText && <PDFText style={styles.rightText}>{rightText}</PDFText>}\n {rightSubText && (\n <PDFText style={styles.rightSubText}>{rightSubText}</PDFText>\n )}\n </View>\n )}\n </View>\n);\n\nexport const PageHeader = ({\n title,\n subtitle,\n rightText,\n rightSubText,\n variant = \"simple\",\n background,\n titleColor,\n marginBottom,\n logo,\n address,\n phone,\n email,\n fixed = false,\n noWrap = true,\n style,\n}: PageHeaderProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageHeaderStyles(theme), [theme]);\n const mb = marginBottom ?? theme.spacing.sectionGap;\n\n const variantRenderers: Record<PageHeaderVariant, () => React.ReactNode> = {\n branded: () =>\n renderBranded(\n styles,\n buildContainerStyles(\n styles.brandedContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleBranded, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n centered: () =>\n renderCentered(\n styles,\n buildContainerStyles(\n styles.centeredContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleCentered],\n titleColor,\n theme\n ),\n title,\n subtitle,\n noWrap\n ),\n \"logo-left\": () =>\n renderLogoLeft(\n styles,\n buildContainerStyles(\n styles.logoLeftContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n rightText,\n rightSubText,\n noWrap\n ),\n \"logo-right\": () =>\n renderLogoRight(\n styles,\n buildContainerStyles(\n styles.logoRightContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n logo,\n noWrap\n ),\n minimal: () =>\n renderMinimal(\n styles,\n buildContainerStyles(\n styles.minimalContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles(\n [styles.title, styles.titleMinimal],\n titleColor,\n theme\n ),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n simple: () =>\n renderSimple(\n styles,\n buildContainerStyles(\n styles.simpleContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n rightText,\n rightSubText,\n noWrap\n ),\n \"two-column\": () =>\n renderTwoColumn(\n styles,\n buildContainerStyles(\n styles.twoColumnContainer,\n mb,\n background,\n theme,\n style\n ),\n buildTitleStyles([styles.title], titleColor, theme),\n title,\n subtitle,\n address,\n phone,\n email,\n noWrap\n ),\n };\n\n return wrapFixed(fixed, variantRenderers[variant]() as React.ReactElement);\n};\n","type": "registry:component","target": "components/pdf/components/page-header/page-header.tsx"},diff --git a/public/r/forme/page-number.json b/public/r/forme/page-number.jsonindex 8776127..deebe6e 100644--- a/public/r/forme/page-number.json+++ b/public/r/forme/page-number.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/page-number/page-number.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PdfPageNumberProps}\n */\nexport interface PdfPageNumberProps extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: { width: \"100%\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nconst _formatPageNumber = (\n format: string,\n pageNumber: number,\n totalPages: number\n): string =>\n format\n .replace(\"{page}\", String(pageNumber))\n .replace(\"{total}\", String(totalPages));\n\nexport const PdfPageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PdfPageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={styles.container}>\n <PDFText style={textStyles as never}>\n {format\n .replace(\"{page}\", \"{{pageNumber}}\")\n .replace(\"{total}\", \"{{totalPages}}\")}\n </PDFText>\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PdfPageNumberProps}\n */\nexport interface PdfPageNumberProps extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: { width: \"100%\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nconst _formatPageNumber = (\n format: string,\n pageNumber: number,\n totalPages: number\n): string =>\n format\n .replace(\"{page}\", String(pageNumber))\n .replace(\"{total}\", String(totalPages));\n\nexport const PdfPageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PdfPageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={styles.container}>\n <PDFText style={textStyles as never}>\n {format\n .replace(\"{page}\", \"{{pageNumber}}\")\n .replace(\"{total}\", \"{{totalPages}}\")}\n </PDFText>\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/page-number/page-number.tsx"},diff --git a/public/r/forme/pdf-image.json b/public/r/forme/pdf-image.jsonindex 96abeed..c351752 100644--- a/public/r/forme/pdf-image.json+++ b/public/r/forme/pdf-image.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/pdf-image/pdf-image.tsx",- "content": "import { Image, Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\n/** HTTP method used when fetching the image from a URL. */\nexport type PdfImageHTTPMethod =\n | \"GET\"\n | \"HEAD\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\";\n\nexport type PdfImageSrc =\n | string\n | {\n uri: string;\n method?: PdfImageHTTPMethod;\n headers?: Record<string, string>;\n body?: string;\n };\n\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\n\nexport type PdfImageVariant =\n | \"default\"\n | \"full-width\"\n | \"thumbnail\"\n | \"avatar\"\n | \"cover\"\n | \"bordered\"\n | \"rounded\";\n\n/**\n * Image element with layout presets, caption, and aspect ratio support.\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\n * @see {@link PdfImageProps}\n */\nexport interface PdfImageProps {\n src: PdfImageSrc;\n /**\n * @default 'default'\n */\n variant?: PdfImageVariant;\n width?: number | string;\n height?: number | string;\n fit?: PdfImageFit;\n /**\n * @default '50% 50%'\n */\n position?: string;\n caption?: string;\n aspectRatio?: number;\n borderRadius?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\ninterface VariantDefaults {\n width?: number | string;\n height?: number | string;\n fit: PdfImageFit;\n borderRadius?: number;\n}\n\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\n bordered: { fit: \"contain\", width: \"100%\" },\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\n default: { fit: \"contain\" },\n \"full-width\": { fit: \"cover\", width: \"100%\" },\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\n};\n\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\n\nconst detectFormat = (src: PdfImageSrc): string | null => {\n if (typeof src !== \"string\") {\n return null;\n }\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\n if (dataMatch) {\n return dataMatch[1].toLowerCase();\n }\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\n};\n\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\n const fmt = detectFormat(src);\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\n console.warn(\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\n );\n }\n};\n\nconst createImageStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { flexDirection: \"column\" },\n image: {},\n imageBordered: {\n borderColor: t.colors.border,\n borderStyle: \"solid\",\n borderWidth: 1,\n },\n });\n};\n\nexport const PdfImage = ({\n src,\n variant = \"default\",\n width,\n height,\n fit,\n position = \"50% 50%\",\n caption,\n aspectRatio,\n borderRadius,\n noWrap = true,\n style,\n}: PdfImageProps) => {\n warnIfUnsupported(src);\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\n const defaults = VARIANT_DEFAULTS[variant];\n\n const resolvedWidth = width ?? defaults.width;\n const resolvedHeight: number | string | undefined = (() => {\n if (height !== undefined) {\n return height;\n }\n if (defaults.height !== undefined) {\n return defaults.height;\n }\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\n return resolvedWidth / aspectRatio;\n }\n })();\n\n const resolvedFit = fit ?? defaults.fit;\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\n\n const imageStyles: Style[] = [styles.image];\n if (resolvedWidth !== undefined) {\n imageStyles.push({ width: resolvedWidth } as Style);\n }\n if (resolvedHeight !== undefined) {\n imageStyles.push({ height: resolvedHeight } as Style);\n }\n imageStyles.push({\n objectFit: resolvedFit,\n objectPosition: position,\n } as Style);\n if (resolvedRadius !== undefined) {\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\n }\n if (variant === \"bordered\") {\n imageStyles.push(styles.imageBordered);\n }\n if (style) {\n imageStyles.push(style);\n }\n\n const content = (\n <View style={styles.container}>\n <Image src={src as never} style={imageStyles as never} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Image,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\n/** HTTP method used when fetching the image from a URL. */\nexport type PdfImageHTTPMethod =\n | \"GET\"\n | \"HEAD\"\n | \"POST\"\n | \"PUT\"\n | \"DELETE\"\n | \"PATCH\";\n\nexport type PdfImageSrc =\n | string\n | {\n uri: string;\n method?: PdfImageHTTPMethod;\n headers?: Record<string, string>;\n body?: string;\n };\n\nexport type PdfImageFit = \"cover\" | \"contain\" | \"fill\" | \"none\";\n\nexport type PdfImageVariant =\n | \"default\"\n | \"full-width\"\n | \"thumbnail\"\n | \"avatar\"\n | \"cover\"\n | \"bordered\"\n | \"rounded\";\n\n/**\n * Image element with layout presets, caption, and aspect ratio support.\n * Props - `src` | `variant` | `width` | `height` | `fit` | `position` | `caption` | `aspectRatio` | `borderRadius` | `noWrap` | `style`\n * @see {@link PdfImageProps}\n */\nexport interface PdfImageProps {\n src: PdfImageSrc;\n /**\n * @default 'default'\n */\n variant?: PdfImageVariant;\n width?: number | string;\n height?: number | string;\n fit?: PdfImageFit;\n /**\n * @default '50% 50%'\n */\n position?: string;\n caption?: string;\n aspectRatio?: number;\n borderRadius?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\ninterface VariantDefaults {\n width?: number | string;\n height?: number | string;\n fit: PdfImageFit;\n borderRadius?: number;\n}\n\nconst VARIANT_DEFAULTS: Record<PdfImageVariant, VariantDefaults> = {\n avatar: { borderRadius: 999, fit: \"cover\", height: 48, width: 48 },\n bordered: { fit: \"contain\", width: \"100%\" },\n cover: { fit: \"cover\", height: 160, width: \"100%\" },\n default: { fit: \"contain\" },\n \"full-width\": { fit: \"cover\", width: \"100%\" },\n rounded: { borderRadius: 8, fit: \"contain\", width: 200 },\n thumbnail: { fit: \"cover\", height: 80, width: 80 },\n};\n\nconst UNSUPPORTED_FORMATS = new Set([\"webp\", \"avif\", \"heic\", \"heif\", \"ico\"]);\n\nconst detectFormat = (src: PdfImageSrc): string | null => {\n if (typeof src !== \"string\") {\n return null;\n }\n const dataMatch = src.match(/^data:image\\/([a-zA-Z0-9+.-]+)/);\n if (dataMatch) {\n return dataMatch[1].toLowerCase();\n }\n return src.split(\"?\")[0].split(\".\").pop()?.toLowerCase() ?? null;\n};\n\nconst warnIfUnsupported = (src: PdfImageSrc): void => {\n const fmt = detectFormat(src);\n if (fmt && UNSUPPORTED_FORMATS.has(fmt)) {\n console.warn(\n `[PdfImage] Unsupported format \"${fmt}\" detected. react-pdf supports: JPEG, PNG, GIF (first frame), BMP, SVG. Convert to PNG or JPEG before use.`\n );\n }\n};\n\nconst createImageStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { flexDirection: \"column\" },\n image: {},\n imageBordered: {\n borderColor: t.colors.border,\n borderStyle: \"solid\",\n borderWidth: 1,\n },\n });\n};\n\nexport const PdfImage = ({\n src,\n variant = \"default\",\n width,\n height,\n fit,\n position = \"50% 50%\",\n caption,\n aspectRatio,\n borderRadius,\n noWrap = true,\n style,\n}: PdfImageProps) => {\n warnIfUnsupported(src);\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createImageStyles(theme), [theme]);\n const defaults = VARIANT_DEFAULTS[variant];\n\n const resolvedWidth = width ?? defaults.width;\n const resolvedHeight: number | string | undefined = (() => {\n if (height !== undefined) {\n return height;\n }\n if (defaults.height !== undefined) {\n return defaults.height;\n }\n if (aspectRatio !== undefined && typeof resolvedWidth === \"number\") {\n return resolvedWidth / aspectRatio;\n }\n })();\n\n const resolvedFit = fit ?? defaults.fit;\n const resolvedRadius = borderRadius ?? defaults.borderRadius;\n\n const imageStyles: Style[] = [styles.image];\n if (resolvedWidth !== undefined) {\n imageStyles.push({ width: resolvedWidth } as Style);\n }\n if (resolvedHeight !== undefined) {\n imageStyles.push({ height: resolvedHeight } as Style);\n }\n imageStyles.push({\n objectFit: resolvedFit,\n objectPosition: position,\n } as Style);\n if (resolvedRadius !== undefined) {\n imageStyles.push({ borderRadius: resolvedRadius } as Style);\n }\n if (variant === \"bordered\") {\n imageStyles.push(styles.imageBordered);\n }\n if (style) {\n imageStyles.push(style);\n }\n\n const content = (\n <View style={styles.container}>\n <Image src={src as never} style={imageStyles as never} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\n </View>\n );\n\n return noWrap ? <View wrap={false}>{content}</View> : content;\n};\n","type": "registry:component","target": "components/pdf/components/pdf-image/pdf-image.tsx"},diff --git a/public/r/forme/qrcode.json b/public/r/forme/qrcode.jsonindex 3e6a4e0..44e4bd2 100644--- a/public/r/forme/qrcode.json+++ b/public/r/forme/qrcode.json@@ -14,7 +14,7 @@"files": [{"path": "registry/bases/forme/components/qrcode/qrcode.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport QRCode from \"qrcode\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Rect, Svg } from \"../../lib/forme-svg\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/**\n * QR code rendered as an SVG grid for use in PDF documents.\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\n * @see {@link PdfQRCodeProps}\n */\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\n value: string;\n size?: number;\n color?: string;\n backgroundColor?: string;\n errorLevel?: QRCodeErrorLevel;\n margin?: number;\n caption?: string;\n children?: never;\n}\n\nconst createQRCodeStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { alignItems: \"center\" },\n });\n};\n\nconst generateQRMatrix = (\n value: string,\n errorLevel: QRCodeErrorLevel,\n margin: number\n): boolean[][] => {\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\n const { size, data } = qr.modules;\n const totalSize = size + margin * 2;\n const matrix: boolean[][] = [];\n for (let row = 0; row < totalSize; row += 1) {\n const rowData: boolean[] = [];\n for (let col = 0; col < totalSize; col += 1) {\n const isInMargin =\n row < margin ||\n row >= size + margin ||\n col < margin ||\n col >= size + margin;\n if (isInMargin) {\n rowData.push(false);\n } else {\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\n }\n }\n matrix.push(rowData);\n }\n return matrix;\n};\n\nexport const PdfQRCode = ({\n value,\n size = 100,\n color = \"#000000\",\n backgroundColor = \"#ffffff\",\n errorLevel = \"M\",\n margin = 2,\n caption,\n style,\n}: PdfQRCodeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\n const matrix = useSafeMemo(\n () => generateQRMatrix(value, errorLevel, margin),\n [value, errorLevel, margin]\n );\n const moduleSize = size / matrix.length;\n const resolvedColor = resolveColor(color, theme.colors);\n const resolvedBgColor =\n backgroundColor === \"transparent\"\n ? undefined\n : resolveColor(backgroundColor, theme.colors);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View style={containerStyles as never}>\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\n {resolvedBgColor !== undefined && (\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\n )}\n {matrix\n .flatMap((row, y) =>\n row\n .map((isDark, x) => (isDark ? { x, y } : null))\n .filter((pos): pos is { x: number; y: number } => pos !== null)\n )\n .map((pos) => (\n <Rect\n key={`qr-${pos.y}-${pos.x}`}\n x={pos.x * moduleSize}\n y={pos.y * moduleSize}\n width={moduleSize}\n height={moduleSize}\n fill={resolvedColor}\n />\n ))}\n </Svg>\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\n </View>\n );\n};\n",+ "content": "import QRCode from \"qrcode\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { Rect, Svg } from \"../../lib/forme-svg\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type QRCodeErrorLevel = \"L\" | \"M\" | \"Q\" | \"H\";\n\n/**\n * QR code rendered as an SVG grid for use in PDF documents.\n * Props - `value` | `size` | `color` | `backgroundColor` | `errorLevel` | `margin` | `caption` | `style`\n * @see {@link PdfQRCodeProps}\n */\nexport interface PdfQRCodeProps extends Omit<PDFComponentProps, \"children\"> {\n value: string;\n size?: number;\n color?: string;\n backgroundColor?: string;\n errorLevel?: QRCodeErrorLevel;\n margin?: number;\n caption?: string;\n children?: never;\n}\n\nconst createQRCodeStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n caption: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginTop: spacing[1],\n textAlign: \"center\",\n },\n container: { alignItems: \"center\" },\n });\n};\n\nconst generateQRMatrix = (\n value: string,\n errorLevel: QRCodeErrorLevel,\n margin: number\n): boolean[][] => {\n const qr = QRCode.create(value, { errorCorrectionLevel: errorLevel });\n const { size, data } = qr.modules;\n const totalSize = size + margin * 2;\n const matrix: boolean[][] = [];\n for (let row = 0; row < totalSize; row += 1) {\n const rowData: boolean[] = [];\n for (let col = 0; col < totalSize; col += 1) {\n const isInMargin =\n row < margin ||\n row >= size + margin ||\n col < margin ||\n col >= size + margin;\n if (isInMargin) {\n rowData.push(false);\n } else {\n rowData.push(data[(row - margin) * size + (col - margin)] === 1);\n }\n }\n matrix.push(rowData);\n }\n return matrix;\n};\n\nexport const PdfQRCode = ({\n value,\n size = 100,\n color = \"#000000\",\n backgroundColor = \"#ffffff\",\n errorLevel = \"M\",\n margin = 2,\n caption,\n style,\n}: PdfQRCodeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createQRCodeStyles(theme), [theme]);\n const matrix = useSafeMemo(\n () => generateQRMatrix(value, errorLevel, margin),\n [value, errorLevel, margin]\n );\n const moduleSize = size / matrix.length;\n const resolvedColor = resolveColor(color, theme.colors);\n const resolvedBgColor =\n backgroundColor === \"transparent\"\n ? undefined\n : resolveColor(backgroundColor, theme.colors);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n\n return (\n <View style={containerStyles as never}>\n <Svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>\n {resolvedBgColor !== undefined && (\n <Rect x={0} y={0} width={size} height={size} fill={resolvedBgColor} />\n )}\n {matrix\n .flatMap((row, y) =>\n row\n .map((isDark, x) => (isDark ? { x, y } : null))\n .filter((pos): pos is { x: number; y: number } => pos !== null)\n )\n .map((pos) => (\n <Rect\n key={`qr-${pos.y}-${pos.x}`}\n x={pos.x * moduleSize}\n y={pos.y * moduleSize}\n width={moduleSize}\n height={moduleSize}\n fill={resolvedColor}\n />\n ))}\n </Svg>\n {caption && <PDFText style={styles.caption}>{caption}</PDFText>}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/qrcode/qrcode.tsx"},diff --git a/public/r/forme/report-financial.json b/public/r/forme/report-financial.jsonindex 3949865..fd38a3a 100644--- a/public/r/forme/report-financial.json+++ b/public/r/forme/report-financial.json@@ -19,7 +19,7 @@},{"path": "registry/bases/forme/blocks/report-financial/report-layout.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={\n [\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ] as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap`\n for concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-financial/report-layout.tsx"},diff --git a/public/r/forme/report-marketing.json b/public/r/forme/report-marketing.jsonindex 4897c43..af0056c 100644--- a/public/r/forme/report-marketing.json+++ b/public/r/forme/report-marketing.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/report-marketing/report-layout.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={\n [\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ] as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap`\n for concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-marketing/report-layout.tsx"},diff --git a/public/r/forme/report-operations.json b/public/r/forme/report-operations.jsonindex 3719683..9f9a338 100644--- a/public/r/forme/report-operations.json+++ b/public/r/forme/report-operations.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/report-operations/report-layout.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={\n [\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ] as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap`\n for concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-operations/report-layout.tsx"},diff --git a/public/r/forme/report-security.json b/public/r/forme/report-security.jsonindex 1607327..25bb287 100644--- a/public/r/forme/report-security.json+++ b/public/r/forme/report-security.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/blocks/report-security/report-layout.tsx",- "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={48}>\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={\n [\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ] as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap`\n for concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 181,\n donut: 191,\n \"horizontal-bar\": 148,\n line: 191,\n pie: 191,\n };\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 59,\n donut: -3,\n \"horizontal-bar\": -4,\n line: -30,\n pie: 0,\n };\n const sectionOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 32,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const titleOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n\n const styles = StyleSheet.create({\n col: {\n width: 225,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n alignItems: \"flex-start\",\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 75,\n padding: 8,\n width: 225,\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"column\",\n gap: 8,\n },\n metricsRow: {\n flexDirection: \"row\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n width: 499,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {[0, 2].map((startIndex) => (\n <View key={startIndex} style={styles.metricsRow}>\n {data.summary\n .slice(startIndex, startIndex + 2)\n .map((metric) => (\n <View\n key={metric.label}\n style={\n {\n ...styles.metricCard,\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n } as never\n }\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n style={{\n height: 16,\n width: metric.trend.endsWith(\"QoQ\")\n ? metric.trend.length * 6.5 + 10\n : metric.trend.length * 5 + 18,\n }}\n />\n ) : null}\n </View>\n ))}\n </View>\n ))}\n </View>\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section\n padding=\"md\"\n noWrap\n style={{\n position: \"relative\",\n top: sectionOffset[graphVariant],\n }}\n >\n <Text\n variant=\"sm\"\n transform=\"uppercase\"\n color=\"mutedForeground\"\n style={{\n position: \"relative\",\n top: titleOffset[graphVariant],\n }}\n >\n Performance Trend\n </Text>\n <View\n style={\n {\n ...styles.graphShell,\n paddingBottom: graphVariant === \"horizontal-bar\" ? 56 : 12,\n } as never\n }\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n </View>\n </Page>\n\n <Page size=\"A4\" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n <View style={styles.page as never}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n </View>\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-security/report-layout.tsx"},diff --git a/public/r/forme/section.json b/public/r/forme/section.jsonindex 387d28a..3d87613 100644--- a/public/r/forme/section.json+++ b/public/r/forme/section.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/section/section.tsx",- "content": "import { StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\n\n/**\n * Layout container with spacing, padding, and visual style variants.\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\n * @see {@link SectionProps}\n */\nexport interface SectionProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n spacing?: SectionSpacing;\n padding?: SectionPadding;\n background?: string;\n /**\n * @default false\n */\n border?: boolean;\n /**\n * @default 'default'\n */\n variant?: SectionVariant;\n accentColor?: string;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createSectionStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius } = t.primitives;\n return StyleSheet.create({\n base: { flexDirection: \"column\" },\n border: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n },\n callout: {\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n paddingLeft: spacing[4],\n paddingVertical: spacing[2],\n },\n card: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n padding: spacing[4],\n },\n highlight: {\n backgroundColor: t.colors.muted,\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n padding: spacing[4],\n },\n paddingLg: { padding: spacing[6] },\n paddingMd: { padding: spacing[4] },\n paddingNone: { padding: spacing[0] },\n paddingSm: { padding: spacing[3] },\n spacingLg: { marginVertical: spacing[8] },\n spacingMd: { marginVertical: t.spacing.sectionGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: spacing[4] },\n spacingXl: { marginVertical: spacing[12] },\n });\n};\n\nexport const Section = ({\n spacing = \"md\",\n padding,\n background,\n border,\n variant = \"default\",\n accentColor,\n noWrap = false,\n children,\n style,\n}: SectionProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n xl: styles.spacingXl,\n };\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n none: styles.paddingNone,\n sm: styles.paddingSm,\n };\n const variantMap: Record<SectionVariant, Style | null> = {\n callout: styles.callout,\n card: styles.card,\n default: null,\n highlight: styles.highlight,\n };\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\n const variantStyle = variantMap[variant];\n if (variantStyle) {\n styleArray.push(variantStyle);\n }\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\n styleArray.push({\n borderLeftColor: resolveColor(accentColor, theme.colors),\n });\n }\n if (padding && padding in paddingMap) {\n styleArray.push(paddingMap[padding]);\n }\n if (border && variant === \"default\") {\n styleArray.push(styles.border);\n }\n if (background) {\n styleArray.push({\n backgroundColor: resolveColor(background, theme.colors),\n });\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={styleArray as never}>\n {children}\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type SectionSpacing = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type SectionPadding = \"none\" | \"sm\" | \"md\" | \"lg\";\nexport type SectionVariant = \"default\" | \"callout\" | \"highlight\" | \"card\";\n\n/**\n * Layout container with spacing, padding, and visual style variants.\n * Props - `spacing` | `padding` | `background` | `border` | `variant` | `accentColor` | `noWrap` | `children` | `style`\n * @see {@link SectionProps}\n */\nexport interface SectionProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n spacing?: SectionSpacing;\n padding?: SectionPadding;\n background?: string;\n /**\n * @default false\n */\n border?: boolean;\n /**\n * @default 'default'\n */\n variant?: SectionVariant;\n accentColor?: string;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createSectionStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius } = t.primitives;\n return StyleSheet.create({\n base: { flexDirection: \"column\" },\n border: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n },\n callout: {\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n paddingLeft: spacing[4],\n paddingVertical: spacing[2],\n },\n card: {\n borderColor: t.colors.border,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: spacing[0.5],\n padding: spacing[4],\n },\n highlight: {\n backgroundColor: t.colors.muted,\n borderLeftColor: t.colors.primary,\n borderLeftStyle: \"solid\",\n borderLeftWidth: spacing[1],\n padding: spacing[4],\n },\n paddingLg: { padding: spacing[6] },\n paddingMd: { padding: spacing[4] },\n paddingNone: { padding: spacing[0] },\n paddingSm: { padding: spacing[3] },\n spacingLg: { marginVertical: spacing[8] },\n spacingMd: { marginVertical: t.spacing.sectionGap },\n spacingNone: { marginVertical: spacing[0] },\n spacingSm: { marginVertical: spacing[4] },\n spacingXl: { marginVertical: spacing[12] },\n });\n};\n\nexport const Section = ({\n spacing = \"md\",\n padding,\n background,\n border,\n variant = \"default\",\n accentColor,\n noWrap = false,\n children,\n style,\n}: SectionProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSectionStyles(theme), [theme]);\n const spacingMap = {\n lg: styles.spacingLg,\n md: styles.spacingMd,\n none: styles.spacingNone,\n sm: styles.spacingSm,\n xl: styles.spacingXl,\n };\n const paddingMap = {\n lg: styles.paddingLg,\n md: styles.paddingMd,\n none: styles.paddingNone,\n sm: styles.paddingSm,\n };\n const variantMap: Record<SectionVariant, Style | null> = {\n callout: styles.callout,\n card: styles.card,\n default: null,\n highlight: styles.highlight,\n };\n const styleArray: Style[] = [styles.base, spacingMap[spacing]];\n const variantStyle = variantMap[variant];\n if (variantStyle) {\n styleArray.push(variantStyle);\n }\n if (accentColor && (variant === \"callout\" || variant === \"highlight\")) {\n styleArray.push({\n borderLeftColor: resolveColor(accentColor, theme.colors),\n });\n }\n if (padding && padding in paddingMap) {\n styleArray.push(paddingMap[padding]);\n }\n if (border && variant === \"default\") {\n styleArray.push(styles.border);\n }\n if (background) {\n styleArray.push({\n backgroundColor: resolveColor(background, theme.colors),\n });\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={mergePdfStyles(styleArray)}>\n {children}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/section/section.tsx"},diff --git a/public/r/forme/signature.json b/public/r/forme/signature.jsonindex 7797e60..01d700d 100644--- a/public/r/forme/signature.json+++ b/public/r/forme/signature.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/signature/signature.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\n\n/**\n * Signature signer properties.\n * Props - `label` | `name` | `title` | `date`\n * @see {@link SignatureSigner}\n */\nexport interface SignatureSigner {\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n}\n\n/**\n * Signature block properties.\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\n * @see {@link PdfSignatureBlockProps}\n */\nexport interface PdfSignatureBlockProps {\n /**\n * Layout variant: [single, double, inline]\n * @default 'single'\n */\n variant?: SignatureVariant;\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n signers?: [SignatureSigner, SignatureSigner];\n style?: Style;\n}\n\nconst createSignatureStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, typography } = t.primitives;\n return StyleSheet.create({\n block: { flex: 1, minWidth: 140 },\n container: {\n marginBottom: t.spacing.componentGap,\n marginTop: t.spacing.sectionGap,\n },\n dateText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n marginTop: 1,\n },\n doubleRow: {\n flexDirection: \"row\",\n gap: spacing[8],\n justifyContent: \"space-between\",\n },\n inlineLabel: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n inlineLine: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n height: spacing[5],\n minWidth: 120,\n paddingHorizontal: spacing[2],\n },\n inlineName: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n },\n inlineRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: spacing[3],\n },\n label: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n marginBottom: spacing[1],\n },\n line: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: spacing[1],\n minHeight: spacing[6],\n },\n name: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n },\n titleText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n });\n};\n\nconst renderSignerBlock = (\n signer: SignatureSigner,\n styles: ReturnType<typeof createSignatureStyles>\n) => (\n <View style={styles.block}>\n {signer.label ? (\n <PDFText style={styles.label}>{signer.label}</PDFText>\n ) : null}\n <View style={styles.line} />\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\n {signer.title ? (\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\n ) : null}\n {signer.date ? (\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\n ) : null}\n </View>\n);\n\nexport const PdfSignatureBlock = ({\n variant = \"single\",\n label = \"Signature\",\n name,\n title,\n date,\n signers,\n style,\n}: PdfSignatureBlockProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n if (variant === \"inline\") {\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.inlineRow}>\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\n <View style={styles.inlineLine} />\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\n </View>\n </View>\n );\n }\n\n if (variant === \"double\") {\n const [first, second] = signers ?? [\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\n ];\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View wrap={false} style={containerStyles as never}>\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type SignatureVariant = \"single\" | \"double\" | \"inline\";\n\n/**\n * Signature signer properties.\n * Props - `label` | `name` | `title` | `date`\n * @see {@link SignatureSigner}\n */\nexport interface SignatureSigner {\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n}\n\n/**\n * Signature block properties.\n * Props - `variant` | `label` | `name` | `title` | `date` | `signers` | `style`\n * @see {@link PdfSignatureBlockProps}\n */\nexport interface PdfSignatureBlockProps {\n /**\n * Layout variant: [single, double, inline]\n * @default 'single'\n */\n variant?: SignatureVariant;\n label?: string;\n name?: string;\n title?: string;\n date?: string;\n signers?: [SignatureSigner, SignatureSigner];\n style?: Style;\n}\n\nconst createSignatureStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, typography } = t.primitives;\n return StyleSheet.create({\n block: { flex: 1, minWidth: 140 },\n container: {\n marginBottom: t.spacing.componentGap,\n marginTop: t.spacing.sectionGap,\n },\n dateText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n marginTop: 1,\n },\n doubleRow: {\n flexDirection: \"row\",\n gap: spacing[8],\n justifyContent: \"space-between\",\n },\n inlineLabel: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n inlineLine: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n height: spacing[5],\n minWidth: 120,\n paddingHorizontal: spacing[2],\n },\n inlineName: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n },\n inlineRow: {\n alignItems: \"center\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: spacing[3],\n },\n label: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n marginBottom: spacing[1],\n },\n line: {\n borderBottomColor: t.colors.foreground,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n marginBottom: spacing[1],\n minHeight: spacing[6],\n },\n name: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n },\n titleText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n },\n });\n};\n\nconst renderSignerBlock = (\n signer: SignatureSigner,\n styles: ReturnType<typeof createSignatureStyles>\n) => (\n <View style={styles.block}>\n {signer.label ? (\n <PDFText style={styles.label}>{signer.label}</PDFText>\n ) : null}\n <View style={styles.line} />\n {signer.name ? <PDFText style={styles.name}>{signer.name}</PDFText> : null}\n {signer.title ? (\n <PDFText style={styles.titleText}>{signer.title}</PDFText>\n ) : null}\n {signer.date ? (\n <PDFText style={styles.dateText}>{signer.date}</PDFText>\n ) : null}\n </View>\n);\n\nexport const PdfSignatureBlock = ({\n variant = \"single\",\n label = \"Signature\",\n name,\n title,\n date,\n signers,\n style,\n}: PdfSignatureBlockProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createSignatureStyles(theme), [theme]);\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n if (variant === \"inline\") {\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.inlineRow}>\n <PDFText style={styles.inlineLabel}>{`${label}:`}</PDFText>\n <View style={styles.inlineLine} />\n {name ? <PDFText style={styles.inlineName}>{name}</PDFText> : null}\n </View>\n </View>\n );\n }\n\n if (variant === \"double\") {\n const [first, second] = signers ?? [\n { date: \"\", label: \"Authorized by\", name: \"\", title: \"\" },\n { date: \"\", label: \"Approved by\", name: \"\", title: \"\" },\n ];\n return (\n <View wrap={false} style={containerStyles as never}>\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View wrap={false} style={containerStyles as never}>\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/signature/signature.tsx"},diff --git a/public/r/forme/stack.json b/public/r/forme/stack.jsonindex d7f6bf7..49e5623 100644--- a/public/r/forme/stack.json+++ b/public/r/forme/stack.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/stack/stack.tsx",- "content": "import { StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type StackDirection = \"vertical\" | \"horizontal\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\n\n/**\n * Flex layout container with gap and direction control.\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\n * @see {@link StackProps}\n */\nexport interface StackProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n gap?: StackGap;\n /**\n * @default 'vertical'\n */\n direction?: StackDirection;\n /**\n * @default 'start'\n */\n align?: StackAlign;\n /**\n * @default 'start'\n */\n justify?: StackJustify;\n /**\n * @default false\n */\n wrap?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createStackStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n alignCenter: { alignItems: \"center\" },\n alignEnd: { alignItems: \"flex-end\" },\n alignStart: { alignItems: \"flex-start\" },\n alignStretch: { alignItems: \"stretch\" },\n gapLg: { gap: spacing[6] },\n gapMd: { gap: spacing[4] },\n gapNone: { gap: spacing[0] },\n gapSm: { gap: spacing[2] },\n gapXl: { gap: spacing[8] },\n horizontal: { flexDirection: \"row\" },\n justifyAround: { justifyContent: \"space-around\" },\n justifyBetween: { justifyContent: \"space-between\" },\n justifyCenter: { justifyContent: \"center\" },\n justifyEnd: { justifyContent: \"flex-end\" },\n justifyStart: { justifyContent: \"flex-start\" },\n vertical: { flexDirection: \"column\" },\n wrap: { flexWrap: \"wrap\" },\n });\n};\n\nexport const Stack = ({\n gap = \"md\",\n direction = \"vertical\",\n align,\n justify,\n wrap,\n noWrap,\n children,\n style,\n}: StackProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\n const gapMap = {\n lg: styles.gapLg,\n md: styles.gapMd,\n none: styles.gapNone,\n sm: styles.gapSm,\n xl: styles.gapXl,\n };\n const alignMap = {\n center: styles.alignCenter,\n end: styles.alignEnd,\n start: styles.alignStart,\n stretch: styles.alignStretch,\n };\n const justifyMap = {\n around: styles.justifyAround,\n between: styles.justifyBetween,\n center: styles.justifyCenter,\n end: styles.justifyEnd,\n start: styles.justifyStart,\n };\n const styleArray: Style[] = [\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\n gapMap[gap],\n ];\n if (align && align in alignMap) {\n styleArray.push(alignMap[align]);\n }\n if (justify && justify in justifyMap) {\n styleArray.push(justifyMap[justify]);\n }\n if (wrap) {\n styleArray.push(styles.wrap);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={styleArray as never}>\n {children}\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { StyleSheet, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\n\nexport type StackGap = \"none\" | \"sm\" | \"md\" | \"lg\" | \"xl\";\nexport type StackDirection = \"vertical\" | \"horizontal\";\nexport type StackAlign = \"start\" | \"center\" | \"end\" | \"stretch\";\nexport type StackJustify = \"start\" | \"center\" | \"end\" | \"between\" | \"around\";\n\n/**\n * Flex layout container with gap and direction control.\n * Props - `gap` | `direction` | `align` | `justify` | `wrap` | `noWrap` | `children` | `style`\n * @see {@link StackProps}\n */\nexport interface StackProps extends PDFComponentProps {\n /**\n * @default 'md'\n */\n gap?: StackGap;\n /**\n * @default 'vertical'\n */\n direction?: StackDirection;\n /**\n * @default 'start'\n */\n align?: StackAlign;\n /**\n * @default 'start'\n */\n justify?: StackJustify;\n /**\n * @default false\n */\n wrap?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nconst createStackStyles = (t: PdfcnTheme) => {\n const { spacing } = t.primitives;\n return StyleSheet.create({\n alignCenter: { alignItems: \"center\" },\n alignEnd: { alignItems: \"flex-end\" },\n alignStart: { alignItems: \"flex-start\" },\n alignStretch: { alignItems: \"stretch\" },\n gapLg: { gap: spacing[6] },\n gapMd: { gap: spacing[4] },\n gapNone: { gap: spacing[0] },\n gapSm: { gap: spacing[2] },\n gapXl: { gap: spacing[8] },\n horizontal: { flexDirection: \"row\" },\n justifyAround: { justifyContent: \"space-around\" },\n justifyBetween: { justifyContent: \"space-between\" },\n justifyCenter: { justifyContent: \"center\" },\n justifyEnd: { justifyContent: \"flex-end\" },\n justifyStart: { justifyContent: \"flex-start\" },\n vertical: { flexDirection: \"column\" },\n wrap: { flexWrap: \"wrap\" },\n });\n};\n\nexport const Stack = ({\n gap = \"md\",\n direction = \"vertical\",\n align,\n justify,\n wrap,\n noWrap,\n children,\n style,\n}: StackProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createStackStyles(theme), [theme]);\n const gapMap = {\n lg: styles.gapLg,\n md: styles.gapMd,\n none: styles.gapNone,\n sm: styles.gapSm,\n xl: styles.gapXl,\n };\n const alignMap = {\n center: styles.alignCenter,\n end: styles.alignEnd,\n start: styles.alignStart,\n stretch: styles.alignStretch,\n };\n const justifyMap = {\n around: styles.justifyAround,\n between: styles.justifyBetween,\n center: styles.justifyCenter,\n end: styles.justifyEnd,\n start: styles.justifyStart,\n };\n const styleArray: Style[] = [\n direction === \"horizontal\" ? styles.horizontal : styles.vertical,\n gapMap[gap],\n ];\n if (align && align in alignMap) {\n styleArray.push(alignMap[align]);\n }\n if (justify && justify in justifyMap) {\n styleArray.push(justifyMap[justify]);\n }\n if (wrap) {\n styleArray.push(styles.wrap);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return (\n <View wrap={noWrap ? false : undefined} style={styleArray as never}>\n {children}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/stack/stack.tsx"},diff --git a/public/r/forme/table.json b/public/r/forme/table.jsonindex bb4c6e0..ca0e32a 100644--- a/public/r/forme/table.json+++ b/public/r/forme/table.json@@ -19,7 +19,7 @@},{"path": "registry/bases/forme/components/table/table.tsx",- "content": "import { Text as PDFText, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createTableStyles } from \"./table.styles\";\nimport type {\n TableCellProps,\n TableProps,\n TableRowProps,\n TableSectionProps,\n TableVariant,\n} from \"./table.types\";\n\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableBody = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableCell = ({\n header,\n footer,\n align,\n width,\n children,\n style,\n variant = \"line\",\n _last,\n}: TableCellProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const cellStyles: Style[] =\n width === undefined\n ? [styles.cell]\n : [styles.cellFixed, { width } as Style];\n\n const cellVariantStyle = (\n {\n bordered: styles.cellBordered,\n compact: styles.cellCompact,\n minimal: styles.cellMinimal,\n \"primary-header\": styles.cellPrimaryHeader,\n striped: styles.cellStriped,\n } as Partial<Record<TableVariant, Style>>\n )[variant];\n if (cellVariantStyle) {\n cellStyles.push(cellVariantStyle);\n }\n\n if (variant === \"grid\" && !_last) {\n cellStyles.push(styles.cellGridBorder);\n } else if (variant === \"bordered\" && !_last) {\n cellStyles.push(styles.cellBorderedBorder);\n }\n\n if (align) {\n cellStyles.push({ textAlign: align } as Style);\n }\n\n const styleArray = style ? [...cellStyles, style] : cellStyles;\n\n let textStyle: Style = styles.cellText;\n if (header) {\n textStyle = {\n bordered: styles.cellTextHeaderBordered,\n compact: styles.cellTextHeaderCompact,\n grid: styles.cellTextHeaderGrid,\n line: styles.cellTextHeaderLine,\n minimal: styles.cellTextHeaderMinimal,\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\n striped: styles.cellTextHeaderStriped,\n }[variant];\n } else if (footer) {\n textStyle = styles.cellTextFooter;\n } else if (variant === \"compact\") {\n textStyle = styles.cellTextCompact;\n }\n\n const content =\n typeof children === \"string\" ? (\n <PDFText\n style={\n [\n textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ] as never\n }\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray as never}>{content}</View>;\n};\n\nexport const TableRow = ({\n header,\n footer,\n stripe,\n children,\n style,\n variant = \"line\",\n}: TableRowProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const rowStyles: Style[] = [\n styles.row,\n {\n bordered: styles.rowBordered,\n compact: styles.rowCompact,\n grid: styles.rowGrid,\n line: styles.rowLine,\n minimal: styles.rowMinimal,\n \"primary-header\": styles.rowPrimaryHeader,\n striped: styles.rowStriped,\n }[variant],\n ];\n\n if (header) {\n rowStyles.push(\n {\n bordered: styles.rowHeaderBordered,\n compact: styles.rowHeaderCompact,\n grid: styles.rowHeaderGrid,\n line: styles.rowHeaderLine,\n minimal: styles.rowHeaderMinimal,\n \"primary-header\": styles.rowHeaderPrimaryHeader,\n striped: styles.rowHeaderStriped,\n }[variant]\n );\n }\n\n if (footer) {\n if (variant === \"striped\") {\n rowStyles.push(styles.rowFooterStriped);\n } else {\n rowStyles.push(styles.rowFooter);\n }\n }\n\n if (stripe && !header && !footer) {\n rowStyles.push(styles.rowStripe);\n }\n\n const styleArray = style ? [...rowStyles, style] : rowStyles;\n const childArray = Children.toArray(children);\n const processedChildren = childArray.map((child, i) => {\n if (isValidElement(child) && child.type === TableCell) {\n return cloneElement(child as ReactElement<TableCellProps>, {\n _last: i === childArray.length - 1,\n footer,\n header,\n variant,\n });\n }\n return child;\n });\n\n return (\n <View wrap={false} style={styleArray as never}>\n {processedChildren}\n </View>\n );\n};\n\nconst processTableChildren = (\n children: ReactNode,\n variant: TableVariant,\n zebraStripe: boolean\n): ReactNode => {\n let bodyRowIndex = 0;\n\n return Children.map(children, (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n if (\n child.type === TableHeader ||\n child.type === TableBody ||\n child.type === TableFooter\n ) {\n const isBody = child.type === TableBody;\n const sectionChild = child as ReactElement<TableSectionProps>;\n const sectionChildren = Children.map(\n sectionChild.props.children,\n (rowChild) => {\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\n const rowProps: Partial<TableRowProps> = { variant };\n\n if (isBody && zebraStripe) {\n const isStripe = bodyRowIndex % 2 === 1;\n bodyRowIndex += 1;\n if (isStripe) {\n rowProps.stripe = true;\n }\n }\n\n return cloneElement(\n rowChild as ReactElement<TableRowProps>,\n rowProps\n );\n }\n return rowChild;\n }\n );\n\n return cloneElement(child, {}, sectionChildren);\n }\n\n if (child.type === TableRow) {\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\n }\n\n return child;\n });\n};\n\nexport const Table = ({\n children,\n style,\n variant = \"line\",\n zebraStripe = false,\n noWrap = false,\n}: TableProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const tableStyles: Style[] = [styles.table];\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\n\n tableStyles.push(\n {\n bordered: styles.tableBordered,\n compact: styles.tableCompact,\n grid: styles.tableGrid,\n line: styles.tableLine,\n minimal: styles.tableMinimal,\n \"primary-header\": styles.tablePrimaryHeader,\n striped: styles.tableStriped,\n }[variant]\n );\n\n const styleArray = style ? [...tableStyles, style] : tableStyles;\n const processedChildren = processTableChildren(\n children,\n variant,\n effectiveZebra\n );\n\n const inner = <View style={styleArray as never}>{processedChildren}</View>;\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n",+ "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport { Text as PDFText, View } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { createTableStyles } from \"./table.styles\";\nimport type {\n TableCellProps,\n TableProps,\n TableRowProps,\n TableSectionProps,\n TableVariant,\n} from \"./table.types\";\n\nexport const TableHeader = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableBody = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableFooter = ({ children, style }: TableSectionProps) => (\n <View style={style}>{children}</View>\n);\n\nexport const TableCell = ({\n header,\n footer,\n align,\n width,\n children,\n style,\n variant = \"line\",\n _last,\n}: TableCellProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const cellStyles: Style[] =\n width === undefined\n ? [styles.cell]\n : [styles.cellFixed, { width } as Style];\n\n const cellVariantStyle = (\n {\n bordered: styles.cellBordered,\n compact: styles.cellCompact,\n minimal: styles.cellMinimal,\n \"primary-header\": styles.cellPrimaryHeader,\n striped: styles.cellStriped,\n } as Partial<Record<TableVariant, Style>>\n )[variant];\n if (cellVariantStyle) {\n cellStyles.push(cellVariantStyle);\n }\n\n if (variant === \"grid\" && !_last) {\n cellStyles.push(styles.cellGridBorder);\n } else if (variant === \"bordered\" && !_last) {\n cellStyles.push(styles.cellBorderedBorder);\n }\n\n if (align) {\n cellStyles.push({ textAlign: align } as Style);\n }\n\n const styleArray = style ? [...cellStyles, style] : cellStyles;\n\n let textStyle: Style = styles.cellText;\n if (header) {\n textStyle = {\n bordered: styles.cellTextHeaderBordered,\n compact: styles.cellTextHeaderCompact,\n grid: styles.cellTextHeaderGrid,\n line: styles.cellTextHeaderLine,\n minimal: styles.cellTextHeaderMinimal,\n \"primary-header\": styles.cellTextHeaderPrimaryHeader,\n striped: styles.cellTextHeaderStriped,\n }[variant];\n } else if (footer) {\n textStyle = styles.cellTextFooter;\n } else if (variant === \"compact\") {\n textStyle = styles.cellTextCompact;\n }\n\n const content =\n typeof children === \"string\" ? (\n <PDFText\n style={\n [\n textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ] as never\n }\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray as never}>{content}</View>;\n};\n\nexport const TableRow = ({\n header,\n footer,\n stripe,\n children,\n style,\n variant = \"line\",\n}: TableRowProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const rowStyles: Style[] = [\n styles.row,\n {\n bordered: styles.rowBordered,\n compact: styles.rowCompact,\n grid: styles.rowGrid,\n line: styles.rowLine,\n minimal: styles.rowMinimal,\n \"primary-header\": styles.rowPrimaryHeader,\n striped: styles.rowStriped,\n }[variant],\n ];\n\n if (header) {\n rowStyles.push(\n {\n bordered: styles.rowHeaderBordered,\n compact: styles.rowHeaderCompact,\n grid: styles.rowHeaderGrid,\n line: styles.rowHeaderLine,\n minimal: styles.rowHeaderMinimal,\n \"primary-header\": styles.rowHeaderPrimaryHeader,\n striped: styles.rowHeaderStriped,\n }[variant]\n );\n }\n\n if (footer) {\n if (variant === \"striped\") {\n rowStyles.push(styles.rowFooterStriped);\n } else {\n rowStyles.push(styles.rowFooter);\n }\n }\n\n if (stripe && !header && !footer) {\n rowStyles.push(styles.rowStripe);\n }\n\n const styleArray = style ? [...rowStyles, style] : rowStyles;\n const childArray = Children.toArray(children);\n const processedChildren = childArray.map((child, i) => {\n if (isValidElement(child) && child.type === TableCell) {\n return cloneElement(child as ReactElement<TableCellProps>, {\n _last: i === childArray.length - 1,\n footer,\n header,\n variant,\n });\n }\n return child;\n });\n\n return (\n <View wrap={false} style={styleArray as never}>\n {processedChildren}\n </View>\n );\n};\n\nconst processTableChildren = (\n children: ReactNode,\n variant: TableVariant,\n zebraStripe: boolean\n): ReactNode => {\n let bodyRowIndex = 0;\n\n return Children.map(children, (child) => {\n if (!isValidElement(child)) {\n return child;\n }\n\n if (\n child.type === TableHeader ||\n child.type === TableBody ||\n child.type === TableFooter\n ) {\n const isBody = child.type === TableBody;\n const sectionChild = child as ReactElement<TableSectionProps>;\n const sectionChildren = Children.map(\n sectionChild.props.children,\n (rowChild) => {\n if (isValidElement(rowChild) && rowChild.type === TableRow) {\n const rowProps: Partial<TableRowProps> = { variant };\n\n if (isBody && zebraStripe) {\n const isStripe = bodyRowIndex % 2 === 1;\n bodyRowIndex += 1;\n if (isStripe) {\n rowProps.stripe = true;\n }\n }\n\n return cloneElement(\n rowChild as ReactElement<TableRowProps>,\n rowProps\n );\n }\n return rowChild;\n }\n );\n\n return cloneElement(child, {}, sectionChildren);\n }\n\n if (child.type === TableRow) {\n return cloneElement(child as ReactElement<TableRowProps>, { variant });\n }\n\n return child;\n });\n};\n\nexport const Table = ({\n children,\n style,\n variant = \"line\",\n zebraStripe = false,\n noWrap = false,\n}: TableProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTableStyles(theme), [theme]);\n const tableStyles: Style[] = [styles.table];\n const effectiveZebra = variant === \"striped\" ? true : zebraStripe;\n\n tableStyles.push(\n {\n bordered: styles.tableBordered,\n compact: styles.tableCompact,\n grid: styles.tableGrid,\n line: styles.tableLine,\n minimal: styles.tableMinimal,\n \"primary-header\": styles.tablePrimaryHeader,\n striped: styles.tableStriped,\n }[variant]\n );\n\n const styleArray = style ? [...tableStyles, style] : tableStyles;\n const processedChildren = processTableChildren(\n children,\n variant,\n effectiveZebra\n );\n\n const inner = <View style={styleArray as never}>{processedChildren}</View>;\n return noWrap ? <View wrap={false}>{inner}</View> : inner;\n};\n","type": "registry:component","target": "components/pdf/components/table/table.tsx"},diff --git a/public/r/forme/text.json b/public/r/forme/text.jsonindex ae2029e..57726e3 100644--- a/public/r/forme/text.json+++ b/public/r/forme/text.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/text/text.tsx",- "content": "import { Text as PDFText, StyleSheet } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\n\n/**\n * Body text with typography scale, alignment, and decoration options.\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\n * @see {@link TextProps}\n */\nexport interface TextProps extends PDFComponentProps {\n /**\n * @default 'base'\n */\n variant?: TextVariant;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\n color?: string;\n /**\n * @default 'normal'\n */\n weight?: TextWeight;\n /**\n * @default false\n */\n italic?: boolean;\n /**\n * @default 'none'\n */\n decoration?: TextDecoration;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default false\n */\n noMargin?: boolean;\n}\n\nconst createTextStyles = (t: PdfcnTheme) => {\n const { fontWeights, letterSpacing } = t.primitives;\n const base = {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n marginTop: 0,\n };\n return StyleSheet.create({\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\n base: { ...base, fontSize: t.primitives.typography.base },\n capitalize: { textTransform: \"capitalize\" },\n decorationNone: { textDecoration: \"none\" },\n italic: { fontStyle: \"italic\" },\n lg: { ...base, fontSize: t.primitives.typography.lg },\n lineThrough: { textDecoration: \"line-through\" },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n sm: { ...base, fontSize: t.primitives.typography.sm },\n text: { ...base, fontSize: t.typography.body.fontSize },\n underline: { textDecoration: \"underline\" },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n xl: { ...base, fontSize: t.primitives.typography.xl },\n xs: { ...base, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const Text = ({\n variant,\n align,\n color,\n weight,\n italic,\n decoration,\n transform,\n noMargin,\n children,\n style,\n}: TextProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const decorationMap = {\n \"line-through\": styles.lineThrough,\n none: styles.decorationNone,\n underline: styles.underline,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (italic) {\n styleArray.push(styles.italic);\n }\n if (decoration && decoration in decorationMap) {\n styleArray.push(decorationMap[decoration]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <PDFText style={styleArray as never}>{children}</PDFText>;\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { Text as PDFText, StyleSheet } from \"../../lib/forme-primitives\";\nimport type { Style } from \"../../lib/forme-primitives\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type TextVariant = \"xs\" | \"sm\" | \"base\" | \"lg\" | \"xl\" | \"2xl\" | \"3xl\";\nexport type TextWeight = \"normal\" | \"medium\" | \"semibold\" | \"bold\";\nexport type TextDecoration = \"underline\" | \"line-through\" | \"none\";\n\n/**\n * Body text with typography scale, alignment, and decoration options.\n * Props - `variant` | `align` | `color` | `weight` | `italic` | `decoration` | `transform` | `noMargin` | `children` | `style`\n * @see {@link TextProps}\n */\nexport interface TextProps extends PDFComponentProps {\n /**\n * @default 'base'\n */\n variant?: TextVariant;\n /**\n * @default 'left'\n */\n align?: \"left\" | \"center\" | \"right\" | \"justify\";\n color?: string;\n /**\n * @default 'normal'\n */\n weight?: TextWeight;\n /**\n * @default false\n */\n italic?: boolean;\n /**\n * @default 'none'\n */\n decoration?: TextDecoration;\n transform?: \"uppercase\" | \"lowercase\" | \"capitalize\";\n /**\n * @default false\n */\n noMargin?: boolean;\n}\n\nconst createTextStyles = (t: PdfcnTheme) => {\n const { fontWeights, letterSpacing } = t.primitives;\n const base = {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: t.spacing.paragraphGap,\n marginTop: 0,\n };\n return StyleSheet.create({\n \"2xl\": { ...base, fontSize: t.primitives.typography[\"2xl\"] },\n \"3xl\": { ...base, fontSize: t.primitives.typography[\"3xl\"] },\n base: { ...base, fontSize: t.primitives.typography.base },\n capitalize: { textTransform: \"capitalize\" },\n decorationNone: { textDecoration: \"none\" },\n italic: { fontStyle: \"italic\" },\n lg: { ...base, fontSize: t.primitives.typography.lg },\n lineThrough: { textDecoration: \"line-through\" },\n lowercase: { textTransform: \"lowercase\" },\n noMargin: { marginBottom: 0, marginTop: 0 },\n sm: { ...base, fontSize: t.primitives.typography.sm },\n text: { ...base, fontSize: t.typography.body.fontSize },\n underline: { textDecoration: \"underline\" },\n uppercase: {\n letterSpacing: letterSpacing.wider * 10,\n textTransform: \"uppercase\",\n },\n weightBold: { fontWeight: fontWeights.bold },\n weightMedium: { fontWeight: fontWeights.medium },\n weightNormal: { fontWeight: fontWeights.regular },\n weightSemibold: { fontWeight: fontWeights.semibold },\n xl: { ...base, fontSize: t.primitives.typography.xl },\n xs: { ...base, fontSize: t.primitives.typography.xs },\n });\n};\n\nexport const Text = ({\n variant,\n align,\n color,\n weight,\n italic,\n decoration,\n transform,\n noMargin,\n children,\n style,\n}: TextProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createTextStyles(theme), [theme]);\n const weightMap = {\n bold: styles.weightBold,\n medium: styles.weightMedium,\n normal: styles.weightNormal,\n semibold: styles.weightSemibold,\n };\n const decorationMap = {\n \"line-through\": styles.lineThrough,\n none: styles.decorationNone,\n underline: styles.underline,\n };\n const transformMap = {\n capitalize: styles.capitalize,\n lowercase: styles.lowercase,\n uppercase: styles.uppercase,\n };\n const styleArray: Style[] = [variant ? styles[variant] : styles.text];\n if (weight && weight in weightMap) {\n styleArray.push(weightMap[weight]);\n }\n if (italic) {\n styleArray.push(styles.italic);\n }\n if (decoration && decoration in decorationMap) {\n styleArray.push(decorationMap[decoration]);\n }\n if (transform && transform in transformMap) {\n styleArray.push(transformMap[transform]);\n }\n if (noMargin) {\n styleArray.push(styles.noMargin);\n }\n const semantic = {} as Style;\n if (align) {\n semantic.textAlign = align;\n }\n if (color) {\n semantic.color = resolveColor(color, theme.colors);\n }\n if (Object.keys(semantic).length > 0) {\n styleArray.push(semantic);\n }\n if (style) {\n styleArray.push(...[style].flat());\n }\n return <PDFText style={mergePdfStyles(styleArray)}>{children}</PDFText>;\n};\n","type": "registry:component","target": "components/pdf/components/text/text.tsx"},diff --git a/public/r/forme/utils.json b/public/r/forme/utils.jsonindex 1f5d29a..217d4e6 100644--- a/public/r/forme/utils.json+++ b/public/r/forme/utils.json@@ -16,7 +16,7 @@},{"path": "registry/bases/forme/lib/pdfcn-theme-context.tsx",- "content": "\"use client\";\n\n/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and hooks/context intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport * as React from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nexport const PdfcnThemeContext = createContext<PdfcnTheme>(defaultTheme);\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\n/**\n * Detect whether React currently has an active dispatcher.\n * When components are invoked as plain functions in tests, dispatcher is null.\n */\nconst hasActiveDispatcher = (): boolean => {\n const maybeInternals = React as unknown as {\n __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?: {\n H?: unknown;\n };\n };\n\n const dispatcher =\n maybeInternals\n .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.H;\n return dispatcher != null;\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) => (\n <PdfcnThemeContext.Provider value={theme ?? defaultTheme}>\n {children}\n </PdfcnThemeContext.Provider>\n);\n\n/**\n * Regex patterns that indicate a hook was called outside a valid React render tree.\n * These errors are caught and suppressed so components fall back to safe defaults.\n */\nconst HOOK_ERROR_PATTERNS =\n /invalid hook call|minified react error #321|useContext|useMemo|cannot read properties of null|dispatcher|renderWithHooks|resolveDispatcher|hooks can only be called|rendered fewer hooks/i;\n\n/**\n * Calls a React hook with a graceful fallback for non-render environments (e.g. unit tests).\n * Uses hasActiveDispatcher() as the primary guard; the try/catch is a safety net for edge\n * cases where the dispatcher check passes but the hook still cannot execute.\n */\nconst callHook = <T,>(hook: () => T, fallback: T): T => {\n if (!hasActiveDispatcher()) {\n return fallback;\n }\n try {\n return hook();\n } catch (error) {\n if (error instanceof Error && HOOK_ERROR_PATTERNS.test(error.message)) {\n return fallback;\n }\n throw error;\n }\n};\n\n/**\n * Returns the active PdfcnTheme from context, or the default theme when called\n * outside a React render tree (e.g. unit tests).\n */\nexport const usePdfcnTheme = (): PdfcnTheme =>\n callHook(() => useContext(PdfcnThemeContext), defaultTheme);\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",+ "content": "/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nlet serializedTheme = defaultTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\n\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\n if (Array.isArray(input)) {\n for (const item of input) {\n mergeStyleInput(target, item);\n }\n } else if (input) {\n Object.assign(target, input);\n }\n};\n\n/** Flattens React-PDF-style arrays into the object Forme serializes. */\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\n const merged: Style = {};\n for (const input of inputs) {\n mergeStyleInput(merged, input);\n }\n return merged;\n};\n\n/**\n * Forme serializes function components directly instead of mounting a React\n * tree. Resolve the provider's child so <Document> remains the top-level node.\n */\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? defaultTheme);\n\n/** Returns the theme selected by the nearest serialized provider. */\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n","type": "registry:lib","target": "components/pdf/lib/pdfcn-theme-context.tsx"},@@ -26,15 +26,21 @@"type": "registry:lib","target": "components/pdf/lib/resolve-color.ts"},+ {+ "path": "registry/bases/forme/lib/forme-primitives.tsx",+ "content": "import {\n Fixed as FormeFixed,\n Image as FormeImage,\n Link as FormeLink,\n StyleSheet,\n Text as FormeText,\n View as FormeView,\n} from \"@formepdf/react\";\nimport type {\n FixedProps,\n ImageProps,\n LinkProps,\n Style,\n TextProps,\n ViewProps,\n} from \"@formepdf/react\";\n\nexport type FormeStyleInput =\n | Style\n | false\n | null\n | undefined\n | readonly FormeStyleInput[];\n\nexport const mergeFormeStyles = (input: FormeStyleInput): Style | undefined => {\n if (!input) {\n return undefined;\n }\n\n if (!Array.isArray(input)) {\n return input as Style;\n }\n\n const merged: Style = {};\n for (const entry of input) {\n const resolved = mergeFormeStyles(entry);\n if (resolved) {\n Object.assign(merged, resolved);\n }\n }\n\n return Object.keys(merged).length > 0 ? merged : undefined;\n};\n\ntype WithStyle<T> = Omit<T, \"style\"> & { style?: FormeStyleInput };\n\nexport const View = ({ style, ...props }: WithStyle<ViewProps>) => (\n <FormeView {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Text = ({ style, ...props }: WithStyle<TextProps>) => (\n <FormeText {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Link = ({ style, ...props }: WithStyle<LinkProps>) => (\n <FormeLink {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Image = ({ style, ...props }: WithStyle<ImageProps>) => (\n <FormeImage {...props} style={mergeFormeStyles(style)} />\n);\n\nexport const Fixed = ({ style, ...props }: WithStyle<FixedProps>) => (\n <FormeFixed {...props} style={mergeFormeStyles(style)} />\n);\n\nexport { StyleSheet };\nexport type { Style };\n",+ "type": "registry:lib",+ "target": "components/pdf/lib/forme-primitives.tsx"+ },{"path": "registry/bases/forme/lib/forme-svg.tsx",- "content": "import { Svg as FormeSvg } from \"@formepdf/react\";\nimport { createElement } from \"react\";\nimport type { ReactNode, CSSProperties } from \"react\";\n\ntype AnyProps = Record<string, unknown> & {\n children?: ReactNode;\n style?: CSSProperties;\n};\n\nexport const Svg = ({\n children,\n width,\n height,\n viewBox,\n style,\n ...rest\n}: AnyProps & { width?: number; height?: number; viewBox?: string }) => (\n <FormeSvg\n width={width as number}\n height={height as number}\n viewBox={viewBox as string | undefined}\n style={style as never}\n {...rest}\n >\n {children}\n </FormeSvg>\n);\n\nexport const Circle = (props: AnyProps) => createElement(\"circle\", props);\nexport const Rect = (props: AnyProps) => createElement(\"rect\", props);\nexport const G = (props: AnyProps) => createElement(\"g\", props);\nexport const Line = (props: AnyProps) => createElement(\"line\", props);\nexport const Path = (props: AnyProps) => createElement(\"path\", props);\nexport const SvgText = (props: AnyProps) => createElement(\"text\", props);\n",+ "content": "import { Svg as FormeSvg } from \"@formepdf/react\";\nimport {\n Children,\n Fragment,\n cloneElement,\n createElement,\n isValidElement,\n} from \"react\";\nimport type { ReactNode, CSSProperties } from \"react\";\n\ntype AnyProps = Record<string, unknown> & {\n children?: ReactNode;\n style?: CSSProperties;\n};\n\nconst SVG_ATTRIBUTE_NAMES: Record<string, string> = {\n className: \"class\",\n dominantBaseline: \"dominant-baseline\",\n fillOpacity: \"fill-opacity\",\n fontFamily: \"font-family\",\n fontSize: \"font-size\",\n fontStyle: \"font-style\",\n fontWeight: \"font-weight\",\n strokeDasharray: \"stroke-dasharray\",\n strokeLinecap: \"stroke-linecap\",\n strokeLinejoin: \"stroke-linejoin\",\n strokeOpacity: \"stroke-opacity\",\n strokeWidth: \"stroke-width\",\n textAnchor: \"text-anchor\",\n};\n\nconst normalizeSvgProps = (props: AnyProps): AnyProps => {\n const normalized: AnyProps = {};\n\n for (const [name, value] of Object.entries(props)) {\n if (value === undefined) {\n continue;\n }\n\n if (name === \"style\" && value && typeof value === \"object\") {\n for (const [styleName, styleValue] of Object.entries(value)) {\n normalized[SVG_ATTRIBUTE_NAMES[styleName] ?? styleName] = styleValue;\n }\n continue;\n }\n\n normalized[SVG_ATTRIBUTE_NAMES[name] ?? name] = value;\n }\n\n return normalized;\n};\n\nconst resolveSvgChildren = (children: ReactNode): ReactNode =>\n Children.map(children, (child) => {\n if (!isValidElement<AnyProps>(child)) {\n return child;\n }\n\n if (typeof child.type === \"function\") {\n const resolved = (child.type as (props: AnyProps) => ReactNode)(\n child.props\n );\n return resolveSvgChildren(resolved);\n }\n\n if ((child.type as unknown) === Fragment) {\n return resolveSvgChildren(child.props.children);\n }\n\n if (child.props.children === undefined) {\n return child;\n }\n\n return cloneElement(\n child,\n undefined,\n resolveSvgChildren(child.props.children)\n );\n });\n\nexport const Svg = ({\n children,\n width,\n height,\n viewBox,\n style,\n ...rest\n}: AnyProps & { width?: number; height?: number; viewBox?: string }) => (\n <FormeSvg\n width={width as number}\n height={height as number}\n viewBox={viewBox as string | undefined}\n style={style as never}\n {...rest}\n >\n {resolveSvgChildren(children)}\n </FormeSvg>\n);\n\nexport const Circle = (props: AnyProps) =>\n createElement(\"circle\", normalizeSvgProps(props));\nexport const Rect = (props: AnyProps) =>\n createElement(\"rect\", normalizeSvgProps(props));\nexport const G = (props: AnyProps) =>\n createElement(\"g\", normalizeSvgProps(props));\nexport const Line = (props: AnyProps) =>\n createElement(\"line\", normalizeSvgProps(props));\nexport const Path = (props: AnyProps) =>\n createElement(\"path\", normalizeSvgProps(props));\nexport const SvgText = (props: AnyProps) =>\n createElement(\n \"text\",\n normalizeSvgProps({ fontFamily: \"sans-serif\", ...props })\n );\n","type": "registry:lib","target": "components/pdf/lib/forme-svg.tsx"},{"path": "registry/bases/forme/lib/maybe-fixed.tsx",- "content": "import { Fixed, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\nimport type { ReactNode } from \"react\";\n\nexport const MaybeFixed = ({\n fixed,\n position,\n wrap,\n style,\n children,\n}: {\n fixed?: boolean;\n position: \"header\" | \"footer\";\n wrap?: boolean;\n style?: Style | Style[];\n children?: ReactNode;\n}) => {\n const view = (\n <View wrap={wrap} style={style as never}>\n {children}\n </View>\n );\n if (!fixed) {\n return view;\n }\n return <Fixed position={position}>{view}</Fixed>;\n};\n",+ "content": "import type { ReactNode } from \"react\";\n\nimport { Fixed, View } from \"./forme-primitives\";\nimport type { Style } from \"./forme-primitives\";\n\nexport const MaybeFixed = ({\n fixed,\n position,\n wrap,\n style,\n children,\n}: {\n fixed?: boolean;\n position: \"header\" | \"footer\";\n wrap?: boolean;\n style?: Style | Style[];\n children?: ReactNode;\n}) => {\n const view = (\n <View wrap={wrap} style={style as never}>\n {children}\n </View>\n );\n if (!fixed) {\n return view;\n }\n return <Fixed position={position}>{view}</Fixed>;\n};\n","type": "registry:lib","target": "components/pdf/lib/maybe-fixed.tsx"}diff --git a/public/r/forme/watermark.json b/public/r/forme/watermark.jsonindex 4e6630a..7d4b6ce 100644--- a/public/r/forme/watermark.json+++ b/public/r/forme/watermark.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/forme/components/watermark/watermark.tsx",- "content": "import { Text as PDFText, StyleSheet, View } from \"@formepdf/react\";\nimport type { Style } from \"@formepdf/react\";\n\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type WatermarkPosition =\n | \"center\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\";\n\n/**\n * Diagonal watermark overlaid across the full page using absolute positioning.\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `fixed` | `style`\n * @see {@link PdfWatermarkProps}\n */\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\n text: string;\n opacity?: number;\n fontSize?: number;\n color?: string;\n angle?: number;\n position?: WatermarkPosition;\n /**\n * @default true\n */\n fixed?: boolean;\n children?: never;\n}\n\nconst createWatermarkStyles = (t: PdfcnTheme) => {\n const { fontWeights } = t.primitives;\n // Use page margins as corner insets so watermark position adapts to the active theme.\n const { marginTop, marginBottom, marginLeft, marginRight } = t.spacing.page;\n return StyleSheet.create({\n container: {\n alignItems: \"center\",\n bottom: 0,\n justifyContent: \"center\",\n left: 0,\n pointerEvents: \"none\",\n position: \"absolute\",\n right: 0,\n top: 0,\n zIndex: -1,\n },\n positionBottomLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-end\",\n paddingBottom: marginBottom,\n paddingLeft: marginLeft,\n },\n positionBottomRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-end\",\n paddingBottom: marginBottom,\n paddingRight: marginRight,\n },\n positionCenter: { alignItems: \"center\", justifyContent: \"center\" },\n positionTopLeft: {\n alignItems: \"flex-start\",\n justifyContent: \"flex-start\",\n paddingLeft: marginLeft,\n paddingTop: marginTop,\n },\n positionTopRight: {\n alignItems: \"flex-end\",\n justifyContent: \"flex-start\",\n paddingRight: marginRight,\n paddingTop: marginTop,\n },\n text: {\n fontFamily: t.typography.heading.fontFamily,\n fontWeight: fontWeights.bold,\n letterSpacing: 4,\n textTransform: \"uppercase\",\n },\n });\n};\n\nexport const PdfWatermark = ({\n text,\n opacity = 0.15,\n fontSize = 60,\n color = \"mutedForeground\",\n angle = -45,\n position = \"center\",\n style,\n}: PdfWatermarkProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createWatermarkStyles(theme), [theme]);\n const positionMap: Record<WatermarkPosition, Style> = {\n \"bottom-left\": styles.positionBottomLeft,\n \"bottom-right\": styles.positionBottomRight,\n center: styles.positionCenter,\n \"top-left\": styles.positionTopLeft,\n \"top-right\": styles.positionTopRight,\n };\n const containerStyles: Style[] = [styles.container, positionMap[position]];\n if (style) {\n containerStyles.push(...[style].flat());\n }\n const textStyles: Style[] = [\n styles.text,\n {\n color: resolveColor(color, theme.colors),\n fontSize,\n opacity,\n transform: `rotate(${angle}deg)`,\n },\n ];\n return (\n <View style={containerStyles as never}>\n <PDFText style={textStyles as never}>{text}</PDFText>\n </View>\n );\n};\n",+ "content": "import { Watermark as FormeWatermark } from \"@formepdf/react\";\n\nimport type { PDFComponentProps } from \"@/registry/themes\";\n\nimport { mergeFormeStyles } from \"../../lib/forme-primitives\";\nimport { usePdfcnTheme } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\n\nexport type WatermarkPosition =\n | \"center\"\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\";\n\n/**\n * Diagonal watermark overlaid across the full page using absolute positioning.\n * Props - `text` | `opacity` | `fontSize` | `color` | `angle` | `position` | `fixed` | `style`\n * @see {@link PdfWatermarkProps}\n */\nexport interface PdfWatermarkProps extends Omit<PDFComponentProps, \"children\"> {\n text: string;\n opacity?: number;\n fontSize?: number;\n color?: string;\n angle?: number;\n position?: WatermarkPosition;\n /**\n * @default true\n */\n fixed?: boolean;\n children?: never;\n}\n\nconst withOpacity = (color: string, opacity: number): string => {\n const match = color.match(/^#([\\da-f]{2})([\\da-f]{2})([\\da-f]{2})$/i);\n if (!match) {\n return color;\n }\n\n const [, red, green, blue] = match;\n return `rgba(${Number.parseInt(red, 16)}, ${Number.parseInt(green, 16)}, ${Number.parseInt(blue, 16)}, ${opacity})`;\n};\n\nexport const PdfWatermark = ({\n text,\n opacity = 0.15,\n fontSize = 60,\n color = \"mutedForeground\",\n angle = -45,\n style,\n}: PdfWatermarkProps) => {\n const theme = usePdfcnTheme();\n const resolvedColor = resolveColor(color, theme.colors);\n\n return (\n <FormeWatermark\n text={text}\n angle={angle}\n color={withOpacity(resolvedColor, opacity)}\n fontSize={fontSize}\n style={mergeFormeStyles(style)}\n />\n );\n};\n","type": "registry:component","target": "components/pdf/components/watermark/watermark.tsx"},diff --git a/public/r/registry.json b/public/r/registry.jsonindex 7da8cc0..56c6590 100644--- a/public/r/registry.json+++ b/public/r/registry.json@@ -3,10 +3,7 @@"homepage": "https://pdfcn.vercel.app","items": [{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Theme context and helpers for the takumi base","files": [{@@ -40,10 +37,7 @@"type": "registry:lib"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Alert PDF component (takumi)","files": [{@@ -58,17 +52,12 @@}],"name": "takumi/alert",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Alert","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Badge PDF component (takumi)","files": [{@@ -83,17 +72,12 @@}],"name": "takumi/badge",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Badge","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Card PDF component (takumi)","files": [{@@ -108,17 +92,12 @@}],"name": "takumi/card",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Card","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Data Table PDF component (takumi)","files": [{@@ -143,18 +122,12 @@}],"name": "takumi/data-table",- "registryDependencies": [- "takumi/utils",- "takumi/table"- ],+ "registryDependencies": ["takumi/utils", "takumi/table"],"title": "Data Table","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Divider PDF component (takumi)","files": [{@@ -169,17 +142,12 @@}],"name": "takumi/divider",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Divider","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Form PDF component (takumi)","files": [{@@ -204,17 +172,12 @@}],"name": "takumi/form",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Form","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Graph PDF component (takumi)","files": [{@@ -244,17 +207,12 @@}],"name": "takumi/graph",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Graph","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Heading PDF component (takumi)","files": [{@@ -269,17 +227,12 @@}],"name": "takumi/heading",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Heading","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Keep Together PDF component (takumi)","files": [{@@ -294,17 +247,12 @@}],"name": "takumi/keep-together",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Keep Together","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Key Value PDF component (takumi)","files": [{@@ -319,17 +267,12 @@}],"name": "takumi/key-value",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Key Value","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Link PDF component (takumi)","files": [{@@ -344,17 +287,12 @@}],"name": "takumi/link",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Link","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "List PDF component (takumi)","files": [{@@ -379,17 +317,12 @@}],"name": "takumi/list",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "List","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Break PDF component (takumi)","files": [{@@ -404,17 +337,12 @@}],"name": "takumi/page-break",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Break","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Footer PDF component (takumi)","files": [{@@ -429,17 +357,12 @@}],"name": "takumi/page-footer",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Footer","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Header PDF component (takumi)","files": [{@@ -454,17 +377,12 @@}],"name": "takumi/page-header",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Header","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Number PDF component (takumi)","files": [{@@ -479,17 +397,12 @@}],"name": "takumi/page-number",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Number","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Pdf Image PDF component (takumi)","files": [{@@ -504,18 +417,12 @@}],"name": "takumi/pdf-image",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Pdf Image","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers",- "qrcode"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers", "qrcode"],"description": "Qrcode PDF component (takumi)","files": [{@@ -530,17 +437,12 @@}],"name": "takumi/qrcode",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Qrcode","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Section PDF component (takumi)","files": [{@@ -555,17 +457,12 @@}],"name": "takumi/section",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Section","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Signature PDF component (takumi)","files": [{@@ -580,17 +477,12 @@}],"name": "takumi/signature",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Signature","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Stack PDF component (takumi)","files": [{@@ -605,17 +497,12 @@}],"name": "takumi/stack",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Stack","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Table PDF component (takumi)","files": [{@@ -640,17 +527,12 @@}],"name": "takumi/table",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Table","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Text PDF component (takumi)","files": [{@@ -665,17 +547,12 @@}],"name": "takumi/text",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Text","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Watermark PDF component (takumi)","files": [{@@ -690,17 +567,12 @@}],"name": "takumi/watermark",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Watermark","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Classic PDF block (takumi)","files": [{@@ -715,17 +587,12 @@}],"name": "takumi/invoice-classic",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Classic","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Consultant PDF block (takumi)","files": [{@@ -740,17 +607,12 @@}],"name": "takumi/invoice-consultant",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Consultant","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Corporate PDF block (takumi)","files": [{@@ -765,17 +627,12 @@}],"name": "takumi/invoice-corporate",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Corporate","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Creative PDF block (takumi)","files": [{@@ -790,17 +647,12 @@}],"name": "takumi/invoice-creative",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Creative","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Minimal PDF block (takumi)","files": [{@@ -815,17 +667,12 @@}],"name": "takumi/invoice-minimal",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Minimal","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Modern PDF block (takumi)","files": [{@@ -840,17 +687,12 @@}],"name": "takumi/invoice-modern",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Modern","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Financial PDF block (takumi)","files": [{@@ -870,17 +712,12 @@}],"name": "takumi/report-financial",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Financial","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Marketing PDF block (takumi)","files": [{@@ -900,17 +737,12 @@}],"name": "takumi/report-marketing",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Marketing","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Operations PDF block (takumi)","files": [{@@ -930,17 +762,12 @@}],"name": "takumi/report-operations",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Operations","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Security PDF block (takumi)","files": [{@@ -960,17 +787,12 @@}],"name": "takumi/report-security",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Security","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "professional theme tokens for takumi","files": [{@@ -999,10 +821,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "modern theme tokens for takumi","files": [{@@ -1031,10 +850,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "minimal theme tokens for takumi","files": [{@@ -1063,10 +879,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "executive theme tokens for takumi","files": [{@@ -1095,10 +908,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "corporate theme tokens for takumi","files": [{@@ -1127,10 +937,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "elegant theme tokens for takumi","files": [{@@ -1159,10 +966,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "vivid theme tokens for takumi","files": [{@@ -1191,10 +995,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "forest theme tokens for takumi","files": [{@@ -1223,10 +1024,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "blueprint theme tokens for takumi","files": [{@@ -1255,10 +1053,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Theme context and helpers for the forme base","files": [{@@ -1276,6 +1071,11 @@"type": "registry:lib","target": "components/pdf/lib/resolve-color.ts"},+ {+ "path": "registry/bases/forme/lib/forme-primitives.tsx",+ "type": "registry:lib",+ "target": "components/pdf/lib/forme-primitives.tsx"+ },{"path": "registry/bases/forme/lib/forme-svg.tsx","type": "registry:lib",@@ -1292,10 +1092,7 @@"type": "registry:lib"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Alert PDF component (forme)","files": [{@@ -1310,17 +1107,12 @@}],"name": "forme/alert",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Alert","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Badge PDF component (forme)","files": [{@@ -1335,17 +1127,12 @@}],"name": "forme/badge",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Badge","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Card PDF component (forme)","files": [{@@ -1360,17 +1147,12 @@}],"name": "forme/card",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Card","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Data Table PDF component (forme)","files": [{@@ -1395,18 +1177,12 @@}],"name": "forme/data-table",- "registryDependencies": [- "forme/utils",- "forme/table"- ],+ "registryDependencies": ["forme/utils", "forme/table"],"title": "Data Table","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Divider PDF component (forme)","files": [{@@ -1421,17 +1197,12 @@}],"name": "forme/divider",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Divider","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Form PDF component (forme)","files": [{@@ -1456,17 +1227,12 @@}],"name": "forme/form",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Form","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Graph PDF component (forme)","files": [{@@ -1496,17 +1262,12 @@}],"name": "forme/graph",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Graph","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Heading PDF component (forme)","files": [{@@ -1521,17 +1282,12 @@}],"name": "forme/heading",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Heading","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Keep Together PDF component (forme)","files": [{@@ -1546,17 +1302,12 @@}],"name": "forme/keep-together",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Keep Together","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Key Value PDF component (forme)","files": [{@@ -1571,17 +1322,12 @@}],"name": "forme/key-value",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Key Value","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Link PDF component (forme)","files": [{@@ -1596,17 +1342,12 @@}],"name": "forme/link",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Link","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "List PDF component (forme)","files": [{@@ -1631,17 +1372,12 @@}],"name": "forme/list",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "List","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Break PDF component (forme)","files": [{@@ -1656,17 +1392,12 @@}],"name": "forme/page-break",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Break","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Footer PDF component (forme)","files": [{@@ -1681,17 +1412,12 @@}],"name": "forme/page-footer",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Footer","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Header PDF component (forme)","files": [{@@ -1706,17 +1432,12 @@}],"name": "forme/page-header",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Header","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Number PDF component (forme)","files": [{@@ -1731,17 +1452,12 @@}],"name": "forme/page-number",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Number","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Pdf Image PDF component (forme)","files": [{@@ -1756,18 +1472,12 @@}],"name": "forme/pdf-image",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Pdf Image","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core",- "qrcode"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core", "qrcode"],"description": "Qrcode PDF component (forme)","files": [{@@ -1782,17 +1492,12 @@}],"name": "forme/qrcode",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Qrcode","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Section PDF component (forme)","files": [{@@ -1807,17 +1512,12 @@}],"name": "forme/section",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Section","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Signature PDF component (forme)","files": [{@@ -1832,17 +1532,12 @@}],"name": "forme/signature",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Signature","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Stack PDF component (forme)","files": [{@@ -1857,17 +1552,12 @@}],"name": "forme/stack",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Stack","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Table PDF component (forme)","files": [{@@ -1892,17 +1582,12 @@}],"name": "forme/table",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Table","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Text PDF component (forme)","files": [{@@ -1917,17 +1602,12 @@}],"name": "forme/text",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Text","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Watermark PDF component (forme)","files": [{@@ -1942,17 +1622,12 @@}],"name": "forme/watermark",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Watermark","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Classic PDF block (forme)","files": [{@@ -1967,17 +1642,12 @@}],"name": "forme/invoice-classic",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Classic","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Consultant PDF block (forme)","files": [{@@ -1992,17 +1662,12 @@}],"name": "forme/invoice-consultant",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Consultant","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Corporate PDF block (forme)","files": [{@@ -2017,17 +1682,12 @@}],"name": "forme/invoice-corporate",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Corporate","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Creative PDF block (forme)","files": [{@@ -2042,17 +1702,12 @@}],"name": "forme/invoice-creative",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Creative","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Minimal PDF block (forme)","files": [{@@ -2067,17 +1722,12 @@}],"name": "forme/invoice-minimal",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Minimal","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Modern PDF block (forme)","files": [{@@ -2092,17 +1742,12 @@}],"name": "forme/invoice-modern",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Modern","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Financial PDF block (forme)","files": [{@@ -2122,17 +1767,12 @@}],"name": "forme/report-financial",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Financial","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Marketing PDF block (forme)","files": [{@@ -2152,17 +1792,12 @@}],"name": "forme/report-marketing",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Marketing","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Operations PDF block (forme)","files": [{@@ -2182,17 +1817,12 @@}],"name": "forme/report-operations",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Operations","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Security PDF block (forme)","files": [{@@ -2212,17 +1842,12 @@}],"name": "forme/report-security",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Security","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "professional theme tokens for forme","files": [{@@ -2251,10 +1876,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "modern theme tokens for forme","files": [{@@ -2283,10 +1905,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "minimal theme tokens for forme","files": [{@@ -2315,10 +1934,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "executive theme tokens for forme","files": [{@@ -2347,10 +1963,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "corporate theme tokens for forme","files": [{@@ -2379,10 +1992,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "elegant theme tokens for forme","files": [{@@ -2411,10 +2021,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "vivid theme tokens for forme","files": [{@@ -2443,10 +2050,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "forest theme tokens for forme","files": [{@@ -2475,10 +2079,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "blueprint theme tokens for forme","files": [{diff --git a/public/r/takumi/badge.json b/public/r/takumi/badge.jsonindex 20c932a..69e1723 100644--- a/public/r/takumi/badge.json+++ b/public/r/takumi/badge.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/components/badge/badge.tsx",- "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\nimport { View, Text as PDFText, StyleSheet } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `Takumi PDF primitives` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { resolveColor } from \"../../lib/resolve-color\";\nimport { View, Text as PDFText, StyleSheet } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\n\nexport type BadgeVariant =\n | \"default\"\n | \"primary\"\n | \"success\"\n | \"warning\"\n | \"destructive\"\n | \"info\"\n | \"outline\";\nexport type BadgeSize = \"sm\" | \"md\" | \"lg\";\n\n/**\n * Inline label for status, tags, or categories.\n *\n * Accepts text via either `label` prop or `children` (string). `label` takes\n * precedence when both are provided. The children pattern (`<Badge>text</Badge>`)\n * is supported for compatibility with common React idioms, but note that\n * `Takumi primitives` doesn't support JSX children the way HTML does — only\n * string children are accepted.\n *\n * Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`\n * @see {@link BadgeProps}\n */\nexport interface BadgeProps extends Omit<PDFComponentProps, \"children\"> {\n /** Text to display. Takes precedence over children when both are provided. */\n label?: string;\n /** String children as an alternative to the label prop. */\n children?: string;\n /**\n * @default 'default'\n */\n variant?: BadgeVariant;\n /**\n * @default 'md'\n */\n size?: BadgeSize;\n background?: string;\n color?: string;\n}\n\nconst createBadgeStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights } = t.primitives;\n const c = t.colors;\n const textBase = {\n fontFamily: t.typography.body.fontFamily,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.3,\n };\n const variantBox = (borderColor: string, bgColor: string = c.muted) => ({\n backgroundColor: bgColor,\n borderColor,\n borderStyle: \"solid\" as const,\n borderWidth: spacing[0.5],\n });\n const sheet = StyleSheet.create({\n containerBase: {\n alignItems: \"center\" as const,\n alignSelf: \"flex-start\" as const,\n borderRadius: borderRadius.full,\n flexDirection: \"row\" as const,\n },\n sizeLg: { paddingHorizontal: spacing[4], paddingVertical: spacing[2] },\n sizeMd: { paddingHorizontal: spacing[3], paddingVertical: spacing[1] },\n sizeSm: { paddingHorizontal: spacing[2], paddingVertical: spacing[0.5] },\n textDefault: { ...textBase, color: c.mutedForeground },\n textDestructive: { ...textBase, color: c.destructive },\n textInfo: { ...textBase, color: c.info },\n textLg: { fontSize: t.primitives.typography.sm },\n textMd: { fontSize: t.primitives.typography.xs },\n textOutline: { ...textBase, color: c.foreground },\n textPrimary: { ...textBase, color: c.primaryForeground },\n textSm: { fontSize: t.primitives.typography.xs - 1 },\n textSuccess: { ...textBase, color: c.success },\n textWarning: { ...textBase, color: c.warning },\n variantDefault: variantBox(c.border),\n variantDestructive: variantBox(c.destructive),\n variantInfo: variantBox(c.info),\n variantOutline: variantBox(c.border, c.background),\n variantPrimary: variantBox(c.primary, c.primary),\n variantSuccess: variantBox(c.success),\n variantWarning: variantBox(c.warning),\n });\n return {\n ...sheet,\n containerSizeMap: {\n lg: sheet.sizeLg,\n md: sheet.sizeMd,\n sm: sheet.sizeSm,\n } as Record<BadgeSize, Style>,\n containerVariantMap: {\n default: sheet.variantDefault,\n destructive: sheet.variantDestructive,\n info: sheet.variantInfo,\n outline: sheet.variantOutline,\n primary: sheet.variantPrimary,\n success: sheet.variantSuccess,\n warning: sheet.variantWarning,\n } as Record<BadgeVariant, Style>,\n textSizeMap: {\n lg: sheet.textLg,\n md: sheet.textMd,\n sm: sheet.textSm,\n } as Record<BadgeSize, Style>,\n textVariantMap: {\n default: sheet.textDefault,\n destructive: sheet.textDestructive,\n info: sheet.textInfo,\n outline: sheet.textOutline,\n primary: sheet.textPrimary,\n success: sheet.textSuccess,\n warning: sheet.textWarning,\n } as Record<BadgeVariant, Style>,\n };\n};\n\nexport const Badge = ({\n label,\n children,\n variant = \"default\",\n size = \"md\",\n background,\n color,\n style,\n}: BadgeProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createBadgeStyles(theme), [theme]);\n // `label` takes precedence; fall back to string children for React idiom compatibility\n const text = label ?? children ?? \"\";\n const containerStyles: Style[] = [\n styles.containerBase,\n styles.containerVariantMap[variant],\n styles.containerSizeMap[size],\n ...(background\n ? [{ backgroundColor: resolveColor(background, theme.colors) }]\n : []),\n ...(style ? [style].flat() : []),\n ];\n const textStyles: Style[] = [\n styles.textVariantMap[variant],\n styles.textSizeMap[size],\n ...(color ? [{ color: resolveColor(color, theme.colors) }] : []),\n ];\n return (\n <View style={containerStyles}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/badge/badge.tsx"},diff --git a/public/r/takumi/data-table.json b/public/r/takumi/data-table.jsonindex 8fe89fd..b565063 100644--- a/public/r/takumi/data-table.json+++ b/public/r/takumi/data-table.json@@ -26,7 +26,7 @@},{"path": "registry/bases/takumi/components/data-table/data-table.types.ts",- "content": "import type React from \"react\";\n\nimport type { PDFComponentProps } from \"@/registry/themes\";\n\nimport type { TableVariant } from \"../table/table.types\";\n\n/** DataTable row density size. */\nexport type DataTableSize = \"default\" | \"compact\";\n\n/**\n * Column definition for a DataTable.\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\n * @see {@link DataTableColumn}\n */\nexport interface DataTableColumn<T = Record<string, unknown>> {\n key: keyof T & string;\n header: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n /**\n * Custom cell renderer. Must return Takumi PDF primitives elements (Text, View,\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\n * nodes will crash at runtime in the PDF renderer.\n */\n render?: (value: unknown, row: T) => React.ReactNode;\n /**\n * Custom footer cell renderer. Same constraint: return Takumi PDF primitives\n * elements only — no HTML/DOM nodes.\n */\n renderFooter?: (value: unknown) => React.ReactNode;\n}\n\n/**\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\n * @see {@link DataTableProps}\n */\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n columns: DataTableColumn<T>[];\n data: T[];\n /**\n * @default 'grid'\n */\n variant?: TableVariant;\n footer?: Partial<Record<keyof T & string, string | number>>;\n stripe?: boolean;\n /**\n * @default 'default'\n */\n size?: DataTableSize;\n noWrap?: boolean;\n}\n",+ "content": "import type React from \"react\";\n\nimport type { PDFComponentProps } from \"@/registry/themes\";\n\nimport type { TableVariant } from \"../table/table.types\";\n\n/** DataTable row density size. */\nexport type DataTableSize = \"default\" | \"compact\";\n\n/**\n * Column definition for a DataTable.\n * Props - `key` | `header` | `align` | `width` | `render` | `renderFooter`\n * @see {@link DataTableColumn}\n */\nexport interface DataTableColumn<T = Record<string, unknown>> {\n key: keyof T & string;\n header: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n /**\n * Custom cell renderer. Must return Takumi primitives elements (Text, View,\n * Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM\n * nodes will crash at runtime in the PDF renderer.\n */\n render?: (value: unknown, row: T) => React.ReactNode;\n /**\n * Custom footer cell renderer. Same constraint: return Takumi primitives\n * elements only — no HTML/DOM nodes.\n */\n renderFooter?: (value: unknown) => React.ReactNode;\n}\n\n/**\n * Data table for PDF rendering with column definitions, footer support, and stripe options.\n * Props - `columns` | `data` | `variant` | `footer` | `stripe` | `size` | `noWrap` | `style`\n * @see {@link DataTableProps}\n */\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n columns: DataTableColumn<T>[];\n data: T[];\n /**\n * @default 'grid'\n */\n variant?: TableVariant;\n footer?: Partial<Record<keyof T & string, string | number>>;\n stripe?: boolean;\n /**\n * @default 'default'\n */\n size?: DataTableSize;\n noWrap?: boolean;\n}\n","type": "registry:component","target": "components/pdf/components/data-table/data-table.types.ts"},diff --git a/public/r/takumi/graph.json b/public/r/takumi/graph.jsonindex 0e673df..19e044e 100644--- a/public/r/takumi/graph.json+++ b/public/r/takumi/graph.json@@ -19,7 +19,7 @@},{"path": "registry/bases/takumi/components/graph/graph.tsx",- "content": "import type React from \"react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"../../lib/takumi-svg\";\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n axisLabels: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {content}\n </View>\n ) : (\n content\n );\n};\n",+ "content": "import type React from \"react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"../../lib/takumi-svg\";\nimport { createGraphStyles } from \"./graph.styles\";\nimport type { ChartLayout, GraphProps, GraphSeries } from \"./graph.types\";\nimport {\n GRAPH_SAFE_WIDTHS,\n arcPath,\n buildLayout,\n fmtNum,\n getDefaultPalette,\n getGraphWidth,\n normalizeData,\n polarToCartesian,\n smoothPath,\n truncate,\n} from \"./graph.utils\";\n\n/**\n * Shared Y-axis grid lines and tick labels for cartesian charts (bar, line, area).\n * Extracted to avoid duplicating the identical block across render functions.\n */\nconst renderGridAndYAxis = (\n ticks: number[],\n toY: (v: number) => number,\n chartX: number,\n chartW: number,\n showGrid: boolean,\n gridColor: string,\n textColor: string\n) => (\n <>\n {ticks.map((tick) => {\n const ty = toY(tick);\n return (\n <G key={`grid-${tick}`}>\n {showGrid && (\n <Line\n x1={chartX}\n y1={ty}\n x2={chartX + chartW}\n y2={ty}\n stroke={gridColor}\n strokeWidth={0.5}\n strokeDasharray=\"3 3\"\n />\n )}\n <SvgText\n x={chartX - 4}\n y={ty + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {fmtNum(tick)}\n </SvgText>\n </G>\n );\n })}\n </>\n);\n\nconst renderBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const nCategories = xLabels.length;\n const nSeries = series.length;\n const groupGap = 0.25;\n const groupW = chartW / nCategories;\n const barW = (groupW * (1 - groupGap)) / nSeries;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const range = yMax - yMin || 1;\n const toY = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n toY,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {xLabels.map((label, ci) => {\n const groupLeft = chartX + ci * groupW + groupW * (groupGap / 2);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`group-${ci}`}>\n {series.map((s, si) => {\n const val = s.data[ci]?.value ?? 0;\n const color =\n s.data[ci]?.color ?? s.color ?? palette[si % palette.length];\n const barH = ((val - yMin) / range) * chartH;\n const bx = groupLeft + si * barW;\n const by = chartY + chartH - barH;\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`bar-${ci}-${si}`}>\n <Rect\n x={bx}\n y={by}\n width={barW - 1}\n height={barH}\n fill={color}\n />\n {showValues && barH > 10 && (\n <SvgText\n x={bx + barW / 2 - 0.5}\n y={by - 2}\n fill={axisColor}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <SvgText\n x={groupLeft + (nSeries * barW) / 2}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 10)}\n </SvgText>\n </G>\n );\n })}\n </>\n );\n};\n\nconst renderHorizontalBarChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showValues: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, xLabels } = layout;\n const nCategories = xLabels.length;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const maxVal = Math.max(...allValues, 1);\n const rowH = chartH / nCategories;\n const barH = rowH * 0.5;\n const textColor = theme.colors.mutedForeground;\n const axisColor = theme.colors.foreground;\n const labelW = 60;\n\n return (\n <>\n {xLabels.map((label, ci) => {\n const rowY = chartY + ci * rowH;\n const val = series[0]?.data[ci]?.value ?? 0;\n const color =\n series[0]?.data[ci]?.color ??\n series[0]?.color ??\n palette[ci % palette.length];\n const barW = (val / maxVal) * (chartW - labelW);\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`hbar-${ci}`}>\n <SvgText\n x={chartX + labelW - 4}\n y={rowY + rowH / 2 + 3}\n fill={textColor}\n textAnchor=\"end\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 14)}\n </SvgText>\n <Rect\n x={chartX + labelW}\n y={rowY + (rowH - barH) / 2}\n width={Math.max(barW, 1)}\n height={barH}\n fill={color}\n />\n {showValues && (\n <SvgText\n x={chartX + labelW + barW + 3}\n y={rowY + rowH / 2 + 3}\n fill={axisColor}\n textAnchor=\"start\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(val)}\n </SvgText>\n )}\n </G>\n );\n })}\n <Line\n x1={chartX + labelW}\n y1={chartY}\n x2={chartX + labelW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n </>\n );\n};\n\nconst renderLineAreaChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n isArea: boolean,\n theme: PdfcnTheme\n) => {\n const { chartX, chartY, chartW, chartH, yMin, yMax, yTicks, xLabels } =\n layout;\n const range = yMax - yMin || 1;\n const textColor = theme.colors.mutedForeground;\n const gridColor = theme.colors.border;\n const axisColor = theme.colors.foreground;\n const nPoints = xLabels.length;\n\n const xFor = (i: number) => chartX + (i / Math.max(nPoints - 1, 1)) * chartW;\n const yFor = (v: number) => chartY + chartH - ((v - yMin) / range) * chartH;\n\n return (\n <>\n {renderGridAndYAxis(\n yTicks,\n yFor,\n chartX,\n chartW,\n showGrid,\n gridColor,\n textColor\n )}\n\n <Line\n x1={chartX}\n y1={chartY + chartH}\n x2={chartX + chartW}\n y2={chartY + chartH}\n stroke={axisColor}\n strokeWidth={1}\n />\n\n {series.map((s, si) => {\n const color = s.color ?? palette[si % palette.length];\n const points = s.data.map((d, i) => ({ x: xFor(i), y: yFor(d.value) }));\n\n const lineDStr = smooth\n ? smoothPath(points)\n : `M ${points.map((p) => `${p.x} ${p.y}`).join(\" L \")}`;\n\n const lastPoint = points.at(-1);\n const firstPoint = points.at(0);\n const areaPath =\n isArea && points.length > 1 && lastPoint && firstPoint\n ? `${lineDStr} L ${lastPoint.x} ${chartY + chartH} L ${firstPoint.x} ${chartY + chartH} Z`\n : null;\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`series-${si}`}>\n {isArea && areaPath && (\n <Path d={areaPath} fill={color} fillOpacity={0.2} stroke=\"none\" />\n )}\n <Path d={lineDStr} stroke={color} strokeWidth={2} fill=\"none\" />\n {showDots &&\n points.map((p, pi) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <Circle\n key={`dot-${pi}`}\n cx={p.x}\n cy={p.y}\n r={3}\n fill={color}\n />\n ))}\n {showValues &&\n points.map((p, pi) => (\n <SvgText\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n key={`val-${pi}`}\n x={p.x}\n y={p.y - 5}\n fill={color}\n textAnchor=\"middle\"\n style={{ fontSize: 6 }}\n >\n {fmtNum(s.data[pi].value)}\n </SvgText>\n ))}\n </G>\n );\n })}\n\n {xLabels.map((label, i) => (\n <SvgText\n key={`xlabel-${label}`}\n x={xFor(i)}\n y={chartY + chartH + 10}\n fill={textColor}\n textAnchor=\"middle\"\n style={{ fontSize: 7 }}\n >\n {truncate(label, 8)}\n </SvgText>\n ))}\n </>\n );\n};\n\nconst renderPieDonutChart = (\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n centerLabel: string | undefined,\n isDonut: boolean,\n theme: PdfcnTheme\n) => {\n const { svgW, svgH } = layout;\n const cx = svgW / 2;\n const cy = svgH / 2;\n const r = Math.min(svgW, svgH) / 2 - 20;\n const innerR = isDonut ? r * 0.52 : 0;\n const textColor = theme.colors.mutedForeground;\n\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, d) => sum + d.value, 0) || 1;\n\n let currentAngle = 0;\n\n return (\n <>\n {data.map((d, i) => {\n const color = d.color ?? palette[i % palette.length];\n const sweep = (d.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n const path = arcPath(\n cx,\n cy,\n r,\n currentAngle,\n currentAngle + sweep,\n innerR\n );\n currentAngle += sweep;\n\n const labelR = r * 1.18;\n const lp = polarToCartesian(cx, cy, labelR, midAngle);\n const anchor = lp.x > cx ? \"start\" : \"end\";\n\n return (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF chart data — index is the stable identity\n <G key={`slice-${i}`}>\n <Path d={path} fill={color} stroke=\"white\" strokeWidth={1} />\n {/* Show label only if slice is large enough to label */}\n {sweep > 15 && (\n <SvgText\n x={lp.x}\n y={lp.y + 3}\n fill={textColor}\n textAnchor={anchor}\n style={{ fontSize: 7 }}\n >\n {truncate(d.label, 10)}\n </SvgText>\n )}\n </G>\n );\n })}\n\n {isDonut && centerLabel && (\n <>\n <Circle cx={cx} cy={cy} r={innerR} fill=\"white\" />\n <SvgText\n x={cx}\n y={cy + 4}\n fill={theme.colors.foreground}\n textAnchor=\"middle\"\n style={{ fontSize: 9, fontWeight: \"bold\" }}\n >\n {centerLabel}\n </SvgText>\n </>\n )}\n </>\n );\n};\n\nconst Legend = ({\n series,\n palette,\n styles,\n position = \"bottom\",\n}: {\n series: GraphSeries[];\n palette: string[];\n styles: ReturnType<typeof createGraphStyles>;\n position?: \"bottom\" | \"right\";\n}) => {\n const containerStyle =\n position === \"right\" ? styles.legendColumn : styles.legendRow;\n\n return (\n <View style={containerStyle}>\n {series.map((s, i) => (\n <View key={s.name} style={styles.legendItem}>\n <Svg width={10} height={10}>\n <Rect\n x={0}\n y={2}\n width={8}\n height={8}\n fill={s.color ?? palette[i % palette.length]}\n />\n </Svg>\n <PDFText style={styles.legendText}>{s.name}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\nconst renderChartContent = (\n variant: string,\n series: GraphSeries[],\n layout: ChartLayout,\n palette: string[],\n showGrid: boolean,\n showValues: boolean,\n showDots: boolean,\n smooth: boolean,\n centerLabel: string | undefined,\n theme: PdfcnTheme\n): React.ReactNode => {\n switch (variant) {\n case \"bar\": {\n return renderBarChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n theme\n );\n }\n case \"horizontal-bar\": {\n return renderHorizontalBarChart(\n series,\n layout,\n palette,\n showValues,\n theme\n );\n }\n case \"line\":\n case \"area\": {\n return renderLineAreaChart(\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n variant === \"area\",\n theme\n );\n }\n case \"pie\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n undefined,\n false,\n theme\n );\n }\n case \"donut\": {\n return renderPieDonutChart(\n series,\n layout,\n palette,\n centerLabel,\n true,\n theme\n );\n }\n default: {\n return null;\n }\n }\n};\n\nconst renderAxisLabels = (\n isPieOrDonut: boolean,\n xLabel: string | undefined,\n yLabel: string | undefined,\n chartX: number,\n chartW: number,\n height: number,\n mutedForeground: string\n) => (\n <>\n {!isPieOrDonut && xLabel && (\n <SvgText\n x={chartX + chartW / 2}\n y={height - 2}\n fill={mutedForeground}\n textAnchor=\"middle\"\n style={{ fontSize: 8 }}\n >\n {xLabel}\n </SvgText>\n )}\n {!isPieOrDonut && yLabel && (\n <SvgText\n x={2}\n y={10}\n fill={mutedForeground}\n textAnchor=\"start\"\n style={{ fontSize: 8 }}\n >\n {yLabel}\n </SvgText>\n )}\n </>\n);\n\nconst renderTextFallback = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n layout: ChartLayout,\n showValues: boolean,\n textColor: string\n) => {\n if (variant === \"pie\" || variant === \"donut\") {\n const data = series[0]?.data ?? [];\n const total = data.reduce((sum, point) => sum + point.value, 0) || 1;\n const cx = layout.svgW / 2;\n const cy = layout.svgH / 2;\n const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;\n const labelRadius = radius * 1.18;\n let currentAngle = 0;\n\n return (\n <View\n style={{\n height: layout.svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: layout.svgW,\n }}\n >\n {data.map((point, index) => {\n const sweep = (point.value / total) * 360;\n const midAngle = currentAngle + sweep / 2;\n currentAngle += sweep;\n if (sweep <= 15) {\n return null;\n }\n const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);\n const onRight = labelPoint.x > cx;\n return (\n <PDFText\n key={`fallback-pie-${point.label}-${index}`}\n style={{\n color: textColor,\n fontSize: 7,\n left: onRight ? labelPoint.x : labelPoint.x - 60,\n lineHeight: 1,\n position: \"absolute\",\n textAlign: onRight ? \"left\" : \"right\",\n top: labelPoint.y - 4,\n width: 60,\n }}\n >\n {truncate(point.label, 10)}\n </PDFText>\n );\n })}\n </View>\n );\n }\n\n const {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH,\n svgW,\n xLabels,\n yMax,\n yMin,\n yTicks,\n } = layout;\n const range = yMax - yMin || 1;\n const toY = (value: number) =>\n chartY + chartH - ((value - yMin) / range) * chartH;\n const labelStyle = {\n color: textColor,\n fontSize: 7,\n lineHeight: 1,\n position: \"absolute\" as const,\n };\n\n if (variant === \"horizontal-bar\") {\n const labelWidth = 60;\n const rowHeight = chartH / Math.max(xLabels.length, 1);\n const maxValue = Math.max(\n ...series.flatMap((item) => item.data.map((point) => point.value)),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {xLabels.map((label, index) => {\n const value = series[0]?.data[index]?.value ?? 0;\n const barWidth = (value / maxValue) * (chartW - labelWidth);\n return (\n <View key={`fallback-horizontal-${label}`}>\n <PDFText\n style={{\n ...labelStyle,\n left: chartX,\n textAlign: \"right\",\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: labelWidth - 4,\n }}\n >\n {truncate(label, 14)}\n </PDFText>\n {showValues ? (\n <PDFText\n style={{\n ...labelStyle,\n color: textColor,\n fontSize: 6,\n left: chartX + labelWidth + barWidth + 3,\n top: chartY + index * rowHeight + rowHeight / 2 - 4,\n width: 28,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n ) : null}\n </View>\n );\n })}\n </View>\n );\n }\n\n const pointX = (index: number) =>\n chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;\n const groupWidth = chartW / Math.max(xLabels.length, 1);\n const barGap = 2;\n const barWidth = Math.max(\n (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),\n 1\n );\n\n return (\n <View\n style={{\n height: svgH,\n left: 0,\n position: \"absolute\",\n top: 0,\n width: svgW,\n }}\n >\n {yTicks.map((tick) => (\n <PDFText\n key={`fallback-y-${tick}`}\n style={{\n ...labelStyle,\n left: 0,\n textAlign: \"right\",\n top: toY(tick) - 4,\n width: chartX - 4,\n }}\n >\n {fmtNum(tick)}\n </PDFText>\n ))}\n {(variant === \"line\" || variant === \"area\") &&\n xLabels.map((label, index) => (\n <PDFText\n key={`fallback-x-${label}`}\n style={{\n ...labelStyle,\n left: pointX(index) - 12,\n textAlign: \"center\",\n top: chartY + chartH + 3,\n width: 24,\n }}\n >\n {truncate(label, 8)}\n </PDFText>\n ))}\n {variant === \"bar\" &&\n showValues &&\n xLabels.flatMap((label, categoryIndex) =>\n series.map((item, seriesIndex) => {\n const value = item.data[categoryIndex]?.value ?? 0;\n const left =\n chartX +\n categoryIndex * groupWidth +\n barGap +\n seriesIndex * (barWidth + barGap);\n return (\n <PDFText\n key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}\n style={{\n ...labelStyle,\n fontSize: 6,\n left,\n textAlign: \"center\",\n top: toY(value) - 8,\n width: barWidth,\n }}\n >\n {fmtNum(value)}\n </PDFText>\n );\n })\n )}\n </View>\n );\n};\n\nconst renderGraphContent = (\n title: string | undefined,\n subtitle: string | undefined,\n chartContent: React.ReactNode,\n chartLabels: React.ReactNode,\n axisLabels: React.ReactNode,\n textFallback: React.ReactNode,\n width: number,\n height: number,\n legend: string,\n showLegend: boolean,\n isPieOrDonut: boolean,\n series: GraphSeries[],\n palette: string[],\n styles: ReturnType<typeof createGraphStyles>\n) => (\n <>\n {title && <PDFText style={styles.title}>{title}</PDFText>}\n {subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}\n <View style={legend === \"right\" ? styles.chartWithRightLegend : undefined}>\n <View style={{ height, position: \"relative\", width }}>\n <Svg width={width} height={height}>\n {chartContent}\n {axisLabels}\n </Svg>\n {textFallback}\n </View>\n {showLegend &&\n legend === \"right\" &&\n Legend({ palette, position: \"right\", series, styles })}\n </View>\n {chartLabels}\n {showLegend &&\n legend === \"bottom\" &&\n Legend({ palette, position: \"bottom\", series, styles })}\n </>\n);\n\nconst renderBarLabels = (\n variant: GraphProps[\"variant\"],\n series: GraphSeries[],\n chartX: number,\n chartW: number\n) => {\n if (variant !== \"bar\") {\n return null;\n }\n\n return (\n <View\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n marginLeft: chartX,\n width: chartW,\n }}\n >\n {(series[0]?.data ?? []).map((point) => (\n <View key={point.label} style={{ alignItems: \"center\", flex: 1 }}>\n <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>\n </View>\n ))}\n </View>\n );\n};\n\n/**\n * PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts\n * natively inside react-pdf documents using SVG primitives.\n *\n * No external chart libraries are required or used — all rendering is done via\n * react-pdf's built-in SVG support (`<Svg>`, `<Rect>`, `<Path>`, `<Line>`, etc.).\n *\n * @example Bar chart\n * ```tsx\n * <PdfGraph\n * variant=\"bar\"\n * title=\"Monthly Revenue\"\n * data={[\n * { label: 'Jan', value: 42000 },\n * { label: 'Feb', value: 38000 },\n * { label: 'Mar', value: 55000 },\n * ]}\n * />\n * ```\n *\n * @example Donut chart with center label\n * ```tsx\n * <PdfGraph\n * variant=\"donut\"\n * data={[\n * { label: 'Product A', value: 45 },\n * { label: 'Product B', value: 30 },\n * { label: 'Other', value: 25 },\n * ]}\n * centerLabel=\"$1.2M\"\n * />\n * ```\n *\n * **Limitations (by design):**\n * - No interactivity (PDFs are static)\n * - No animations\n * - SVG Text inside charts uses SVG font attributes (not react-pdf StyleSheet fonts)\n * - For print PDFs use SVG-friendly fonts registered with Font.register()\n */\nexport const PdfGraph = ({\n variant = \"bar\",\n data,\n title,\n subtitle,\n xLabel,\n yLabel,\n width: explicitWidth,\n height = 260,\n fullWidth = false,\n containerPadding = 0,\n wrapperPadding = 0,\n colors,\n showValues = false,\n showGrid = true,\n legend = \"bottom\",\n centerLabel,\n showDots = true,\n smooth = false,\n yTicks: yTickCount = 5,\n noWrap = true,\n style,\n}: GraphProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createGraphStyles(theme), [theme]);\n const palette = colors ?? getDefaultPalette(theme);\n const series = normalizeData(data);\n\n const width = useSafeMemo(() => {\n if (fullWidth) {\n return getGraphWidth(theme, { containerPadding, wrapperPadding });\n }\n return explicitWidth ?? GRAPH_SAFE_WIDTHS.default;\n }, [fullWidth, explicitWidth, theme, containerPadding, wrapperPadding]);\n\n const isPieOrDonut = variant === \"pie\" || variant === \"donut\";\n const layout = buildLayout(series, width, height, isPieOrDonut, yTickCount);\n const { chartX, chartW } = layout;\n\n const chartContent = renderChartContent(\n variant,\n series,\n layout,\n palette,\n showGrid,\n showValues,\n showDots,\n smooth,\n centerLabel,\n theme\n );\n\n const showLegend = legend !== \"none\" && !isPieOrDonut;\n const chartLabels = renderBarLabels(variant, series, chartX, chartW);\n\n const containerStyles: Style[] = [styles.container];\n if (style) {\n containerStyles.push(style);\n }\n\n const content = (\n <View style={containerStyles}>\n {renderGraphContent(\n title,\n subtitle,\n chartContent,\n chartLabels,\n renderAxisLabels(\n isPieOrDonut,\n xLabel,\n yLabel,\n chartX,\n chartW,\n height,\n theme.colors.mutedForeground\n ),\n renderTextFallback(\n variant,\n series,\n layout,\n showValues,\n theme.colors.mutedForeground\n ),\n width,\n height,\n legend,\n showLegend,\n isPieOrDonut,\n series,\n palette,\n styles\n )}\n </View>\n );\n\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {content}\n </View>\n ) : (\n content\n );\n};\n","type": "registry:component","target": "components/pdf/components/graph/graph.tsx"},diff --git a/public/r/takumi/invoice-classic.json b/public/r/takumi/invoice-classic.jsonindex 82922a0..bcf7057 100644--- a/public/r/takumi/invoice-classic.json+++ b/public/r/takumi/invoice-classic.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage src={data.logo ?? \"/favicon.png\"} style={{ margin: 0 }} />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceClassicData } from \"./invoice-classic.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceClassicData = {\n billTo: {\n address: \"456 Client Ave, Suite 2\",\n email: \"[email protected]\",\n name: \"Client Corp.\",\n phone: \"+1 (555) 123-4567\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 17, 2026\",\n invoiceDate: \"February 17, 2026\",\n invoiceNumber: \"INV-2026-001\",\n items: [\n { description: \"Web Development\", quantity: 1, unitPrice: 12_500 },\n { description: \"UI/UX Design\", quantity: 1, unitPrice: 8750 },\n { description: \"Consulting\", quantity: 10, unitPrice: 1500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 17, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"UPI / Card / Bank Transfer\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 36_250,\n tax: 2537.5,\n total: 38_787.5,\n },\n};\n\nconst InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-left\"\n logo={\n <PdfImage src={data.logo ?? \"/favicon.png\"} style={{ margin: 0 }} />\n }\n title={data.companyName}\n subtitle={data.subtitle}\n rightText={data.invoiceNumber}\n rightSubText={`Due: ${data.dueDate}`}\n style={{ marginBottom: 0 }}\n />\n <Section noWrap style={{ flexDirection: \"row\" }}>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n From\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyName}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyAddress}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.companyEmail}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Bill To\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.name}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.address}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.billTo.email}\n </Text>\n </View>\n <View style={{ flex: 1, paddingRight: 15 }}>\n <Text\n style={{ fontSize: 9, fontWeight: \"bold\", marginBottom: 2 }}\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Payment Terms\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.method}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.gst}\n </Text>\n <Text noMargin variant=\"xs\">\n {data.paymentTerms.dueDate}\n </Text>\n </View>\n </Section>\n <Table variant=\"grid\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">QTY</TableCell>\n <TableCell align=\"center\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"center\">{`$${item.unitPrice}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ marginLeft: \"auto\", width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceClassicDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceClassicData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceClassicContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-classic/invoice-classic.tsx"},diff --git a/public/r/takumi/invoice-consultant.json b/public/r/takumi/invoice-consultant.jsonindex 7b682d2..0a6a950 100644--- a/public/r/takumi/invoice-consultant.json+++ b/public/r/takumi/invoice-consultant.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"City, Country · [email protected]\",\n companyName: \"Your Consulting\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 10_300,\n tax: 515,\n total: 10_815,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 8 }}>\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceConsultantData } from \"./invoice-consultant.types\";\n\nconst sampleData: InvoiceConsultantData = {\n client: {\n address: \"500 Tech Park, Suite 200\",\n company: \"Acme Technologies\",\n email: \"[email protected]\",\n name: \"Sarah Johnson\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"PDFx Inc.\",\n consultant: {\n email: \"[email protected]\",\n name: \"John Smith\",\n title: \"Senior Technical Consultant\",\n },\n dueDate: \"March 28, 2026\",\n invoiceDate: \"February 26, 2026\",\n invoiceNumber: \"INV-2026-006\",\n notes:\n \"Services rendered for February 2026. All hours verified and approved by client.\",\n paymentTerms: {\n dueDate: \"March 28, 2026\",\n method: \"Bank Transfer / Check\",\n },\n projectRef: \"PROJ-2026-ACME-001\",\n services: [\n { description: \"Architecture Review & Planning\", hours: 16, rate: 175 },\n { description: \"Code Review & Optimization\", hours: 24, rate: 150 },\n { description: \"Technical Documentation\", hours: 12, rate: 125 },\n { description: \"Team Training & Knowledge Transfer\", hours: 8, rate: 200 },\n ],\n subtitle: \"Professional Consulting Services\",\n summary: {\n subtotal: 9500,\n tax: 475,\n total: 9975,\n totalHours: 60,\n },\n};\n\nconst InvoiceConsultantContent = ({\n data,\n}: {\n data: InvoiceConsultantData;\n}) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n calloutNote: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.info,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 3,\n marginTop: 16,\n paddingLeft: 12,\n paddingVertical: 8,\n },\n companyInfo: {\n flex: 1,\n },\n headerRow: {\n alignItems: \"flex-start\",\n borderBottomColor: theme.colors.primary,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 2,\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n paddingBottom: theme.spacing.componentGap,\n },\n hoursBadge: {\n alignSelf: \"flex-start\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n color: theme.colors.primaryForeground,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n hoursBox: {\n flex: 1,\n paddingRight: 24,\n },\n invoiceInfo: {\n alignItems: \"flex-end\",\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n partiesRow: {\n flexDirection: \"row\",\n gap: 40,\n marginBottom: theme.spacing.sectionGap,\n },\n partyColumn: {\n flex: 1,\n },\n partyLabel: {\n borderBottomColor: theme.colors.border,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n color: theme.colors.primary,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n paddingBottom: 4,\n textTransform: \"uppercase\",\n },\n projectRef: {\n alignItems: \"center\",\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n flexDirection: \"row\",\n gap: 8,\n marginBottom: theme.spacing.sectionGap,\n paddingHorizontal: 10,\n paddingVertical: 6,\n },\n summaryRow: {\n flexDirection: \"row\",\n marginTop: 20,\n },\n totalsBox: {\n width: 250,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.headerRow}>\n <View style={styles.companyInfo}>\n <Text variant=\"xl\" weight=\"bold\" noMargin>\n {data.companyName}\n </Text>\n <Text variant=\"sm\" color=\"mutedForeground\" noMargin>\n {data.subtitle}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.companyAddress}\n </Text>\n </View>\n <View style={styles.invoiceInfo}>\n <Text\n variant=\"xs\"\n color=\"mutedForeground\"\n transform=\"uppercase\"\n noMargin\n >\n Invoice\n </Text>\n <Text variant=\"lg\" weight=\"bold\" noMargin>\n {data.invoiceNumber}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n {data.invoiceDate}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Due: {data.dueDate}\n </Text>\n </View>\n </View>\n {data.projectRef && (\n <View style={styles.projectRef}>\n <Text\n variant=\"xs\"\n weight=\"semibold\"\n color=\"mutedForeground\"\n noMargin\n >\n Project Reference:\n </Text>\n <Text variant=\"xs\" weight=\"bold\" noMargin>\n {data.projectRef}\n </Text>\n </View>\n )}\n <View style={styles.partiesRow}>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n From (Consultant)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.consultant.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.title}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.consultant.email}\n </Text>\n </View>\n <View style={styles.partyColumn}>\n <Text style={styles.partyLabel} noMargin>\n Bill To (Client)\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.client.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.company}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.client.email}\n </Text>\n </View>\n </View>\n <Table variant=\"line\">\n <TableHeader>\n <TableRow header>\n <TableCell>Service Description</TableCell>\n <TableCell align=\"center\">Hours</TableCell>\n <TableCell align=\"right\">Rate ($/hr)</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.services.map((service, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{service.description}</TableCell>\n <TableCell align=\"center\">{`${service.hours}`}</TableCell>\n <TableCell align=\"right\">{`$${service.rate}`}</TableCell>\n <TableCell align=\"right\">{`$${(service.hours * service.rate).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summaryRow}>\n <View style={styles.hoursBox}>\n <View style={styles.hoursBadge}>\n <Text\n style={{\n color: theme.colors.primaryForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n }}\n noMargin\n >\n Total Hours: {data.summary.totalHours}\n </Text>\n </View>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 8 }}>\n Payment: {data.paymentTerms.method}\n </Text>\n </View>\n <View style={styles.totalsBox}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Amount Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n {data.notes && (\n <View style={styles.calloutNote}>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n </View>\n )}\n <PageFooter\n leftText=\"Professional services invoice – Please retain for records\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceConsultantDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceConsultantData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceConsultantContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"},diff --git a/public/r/takumi/invoice-corporate.json b/public/r/takumi/invoice-corporate.jsonindex 4c52f2d..67c3827 100644--- a/public/r/takumi/invoice-corporate.json+++ b/public/r/takumi/invoice-corporate.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n { description: \"Training Workshop\", quantity: 3, unitPrice: 2500 },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes: \"Corporate billing – Net 30 terms apply.\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 57_000,\n tax: 4560,\n total: 61_560,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (8%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfImage,\n PdfcnThemeProvider,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceCorporateData } from \"./invoice-corporate.types\";\n\nconst sampleData: InvoiceCorporateData = {\n billTo: {\n address: \"100 Corporate Plaza, Tower B\",\n email: \"[email protected]\",\n name: \"Global Industries Ltd.\",\n phone: \"+1 (555) 888-9999\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 24, 2026\",\n invoiceDate: \"February 22, 2026\",\n invoiceNumber: \"INV-2026-004\",\n items: [\n {\n description: \"Enterprise Software License\",\n quantity: 5,\n unitPrice: 4500,\n },\n { description: \"Implementation Services\", quantity: 1, unitPrice: 18_000 },\n {\n description: \"Training Workshop (per session)\",\n quantity: 3,\n unitPrice: 2500,\n },\n { description: \"Annual Support Package\", quantity: 1, unitPrice: 8500 },\n ],\n logo: \"/favicon.png\",\n notes:\n \"Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]\",\n paymentTerms: {\n dueDate: \"March 24, 2026\",\n gst: \"GSTIN 987654321\",\n method: \"Wire Transfer / Corporate Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 56_500,\n tax: 4520,\n total: 61_020,\n },\n};\n\nconst InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 24,\n marginBottom: theme.spacing.sectionGap,\n },\n infoLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n fontWeight: \"bold\",\n letterSpacing: 0.6,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n summaryCard: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.md,\n marginTop: 20,\n padding: 16,\n },\n summaryRow: {\n flexDirection: \"row\",\n justifyContent: \"flex-end\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"logo-right\"\n logo={\n <PdfImage\n src={data.logo ?? \"/favicon.png\"}\n width={56}\n height={56}\n style={{ margin: 0 }}\n />\n }\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n style={{ marginBottom: theme.spacing.sectionGap }}\n />\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Invoice #\", value: data.invoiceNumber },\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"bordered\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <View style={styles.summaryCard}>\n <View style={styles.summaryRow}>\n <View style={{ width: 260 }}>\n <KeyValue\n size=\"md\"\n dividerThickness={1}\n dividerColor=\"border\"\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (8%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </View>\n </View>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCorporateDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCorporateData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCorporateContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"},diff --git a/public/r/takumi/invoice-creative.json b/public/r/takumi/invoice-creative.jsonindex bf3b93c..302e18e 100644--- a/public/r/takumi/invoice-creative.json+++ b/public/r/takumi/invoice-creative.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"City, Country · [email protected]\",\n companyName: \"Your Agency\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Creative Services\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 4 }}>\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (6.5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceCreativeData } from \"./invoice-creative.types\";\n\nconst sampleData: InvoiceCreativeData = {\n billTo: {\n address: \"250 Design District, Loft 5\",\n email: \"[email protected]\",\n name: \"Creative Agency Co.\",\n phone: \"+1 (555) 321-7654\",\n },\n companyAddress: \"Nagpur, IN · [email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 26, 2026\",\n invoiceDate: \"February 24, 2026\",\n invoiceNumber: \"INV-2026-005\",\n items: [\n { description: \"Brand Identity Design\", quantity: 1, unitPrice: 8500 },\n {\n description: \"Marketing Collateral Package\",\n quantity: 1,\n unitPrice: 4200,\n },\n {\n description: \"Social Media Assets (per set)\",\n quantity: 4,\n unitPrice: 750,\n },\n { description: \"Motion Graphics (30s)\", quantity: 2, unitPrice: 3500 },\n ],\n notes:\n \"Creative work is protected under copyright. Full usage rights transfer upon payment.\",\n paymentTerms: {\n dueDate: \"March 26, 2026\",\n gst: \"GSTIN 456789123\",\n method: \"Credit Card / PayPal / Stripe\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 22_700,\n tax: 1475.5,\n total: 24_175.5,\n },\n};\n\nconst InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n accentBlock: {\n backgroundColor: theme.colors.muted,\n borderLeftColor: theme.colors.accent,\n borderLeftStyle: \"solid\",\n borderLeftWidth: 4,\n marginBottom: theme.spacing.sectionGap,\n paddingLeft: 14,\n paddingVertical: 10,\n },\n badgeLabel: {\n color: theme.colors.primaryForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 1.2,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n badgeNumber: {\n color: theme.colors.primaryForeground,\n fontSize: 16,\n fontWeight: \"bold\",\n },\n heroSection: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: theme.spacing.sectionGap,\n },\n infoColumn: {\n flex: 1,\n },\n infoGrid: {\n flexDirection: \"row\",\n gap: 32,\n },\n invoiceBadge: {\n alignItems: \"center\",\n backgroundColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.md,\n paddingHorizontal: 20,\n paddingVertical: 14,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n sectionLabel: {\n color: theme.colors.accent,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 6,\n textTransform: \"uppercase\",\n },\n summaryLeft: {\n flex: 1,\n paddingRight: 20,\n },\n summaryRight: {\n backgroundColor: theme.colors.muted,\n borderRadius: theme.primitives.borderRadius.sm,\n padding: 14,\n width: 240,\n },\n summarySection: {\n flexDirection: \"row\",\n marginTop: 24,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <View style={styles.heroSection}>\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"centered\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceBadge}>\n <Text style={styles.badgeLabel} noMargin>\n Invoice\n </Text>\n <Text style={styles.badgeNumber} noMargin>\n {data.invoiceNumber}\n </Text>\n </View>\n </View>\n <View style={styles.accentBlock}>\n <View style={styles.infoGrid}>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Billed To\n </Text>\n <Text variant=\"sm\" weight=\"semibold\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email} · {data.billTo.phone}\n </Text>\n </View>\n <View style={styles.infoColumn}>\n <Text style={styles.sectionLabel} noMargin>\n Invoice Info\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Issue Date\", value: data.invoiceDate },\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n ]}\n />\n </View>\n </View>\n </View>\n <Table variant=\"striped\" zebraStripe>\n <TableHeader>\n <TableRow header>\n <TableCell>Deliverable</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: static PDF list, no reordering\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toLocaleString()}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={styles.summarySection}>\n <View style={styles.summaryLeft}>\n <Text style={styles.sectionLabel} noMargin>\n Notes & Terms\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\">\n {data.notes}\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" style={{ marginTop: 4 }}>\n GST: {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={styles.summaryRight}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toLocaleString()}`,\n },\n { key: \"Tax (6.5%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total\",\n keyStyle: { fontSize: 13, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.accent,\n fontSize: 14,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n variant=\"centered\"\n centerText=\"Thank you for choosing us for your creative needs!\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceCreativeDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceCreativeData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceCreativeContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-creative/invoice-creative.tsx"},diff --git a/public/r/takumi/invoice-minimal.json b/public/r/takumi/invoice-minimal.jsonindex 703cf99..279a29a 100644--- a/public/r/takumi/invoice-minimal.json+++ b/public/r/takumi/invoice-minimal.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual Licenselan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ flex: 1 }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceMinimalData } from \"./invoice-minimal.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceMinimalData = {\n billTo: {\n address: \"500 Enterprise Way, Building A\",\n email: \"[email protected]\",\n name: \"Enterprise Corp\",\n phone: \"+1 (555) 246-8135\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 22, 2026\",\n invoiceDate: \"February 20, 2026\",\n invoiceNumber: \"INV-2026-003\",\n items: [\n { description: \"Annual License Plan\", quantity: 1, unitPrice: 25_000 },\n { description: \"Support & Maintenance\", quantity: 12, unitPrice: 1500 },\n { description: \"Custom Integration\", quantity: 1, unitPrice: 12_000 },\n ],\n notes:\n \"Invoice for annual enterprise subscription. Please retain for your records.\",\n paymentTerms: {\n dueDate: \"March 22, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"ACH Transfer / Check\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 55_000,\n tax: 3850,\n total: 58_850,\n },\n};\n\nconst InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n infoLabel: {\n color: theme.colors.primary,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.8,\n marginBottom: 4,\n textTransform: \"uppercase\",\n },\n infoRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n invoiceStamp: {\n alignSelf: \"flex-start\",\n borderColor: theme.colors.primary,\n borderRadius: theme.primitives.borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: 2,\n paddingHorizontal: 12,\n paddingVertical: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <Section\n noWrap\n style={{\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n }}\n >\n <View style={{ flex: 1 }}>\n <PageHeader\n variant=\"minimal\"\n title={data.companyName}\n subtitle={`${data.companyAddress} · ${data.companyEmail}`}\n marginBottom={0}\n />\n </View>\n <View style={styles.invoiceStamp}>\n <Text\n style={{\n color: theme.colors.primary,\n fontSize: 7,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n transform=\"uppercase\"\n >\n Invoice\n </Text>\n <Text\n style={{\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: \"bold\",\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n <Text\n style={{\n color: theme.colors.mutedForeground,\n fontSize: 8,\n textAlign: \"right\",\n }}\n noMargin\n >\n {data.invoiceDate}\n </Text>\n </View>\n </Section>\n <View style={styles.infoRow}>\n <View style={{ paddingRight: 20, width: \"50%\" }}>\n <Text style={styles.infoLabel} noMargin>\n Bill To\n </Text>\n <Text variant=\"sm\" noMargin>\n {data.billTo.name}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.address}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.email}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.billTo.phone}\n </Text>\n </View>\n <View style={{ width: \"50%\" }}>\n <Text style={styles.infoLabel} noMargin>\n Invoice Details\n </Text>\n <KeyValue\n size=\"sm\"\n items={[\n { key: \"Due Date\", value: data.dueDate },\n { key: \"Payment\", value: data.paymentTerms.method },\n { key: \"GST\", value: data.paymentTerms.gst },\n ]}\n />\n </View>\n </View>\n <Table variant=\"compact\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Rate</TableCell>\n <TableCell align=\"right\">Total</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 20 }}>\n <View style={{ flex: 1 }} />\n <View style={{ width: 240 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Balance Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: {\n color: theme.colors.primary,\n fontSize: 13,\n fontWeight: \"bold\",\n },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceMinimalDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceMinimalData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceMinimalContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"},diff --git a/public/r/takumi/invoice-modern.json b/public/r/takumi/invoice-modern.jsonindex 10d7ddc..158740c 100644--- a/public/r/takumi/invoice-modern.json+++ b/public/r/takumi/invoice-modern.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"City, Country\",\n companyEmail: \"[email protected]\",\n companyName: \"Your Company\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Professional Services\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{ ...styles.metaValue, fontSize: 11, fontWeight: \"bold\" }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text style={{ ...styles.metaValue, fontWeight: \"bold\" }} noMargin>\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n KeyValue,\n PageFooter,\n PageHeader,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { InvoiceModernData } from \"./invoice-modern.types\";\n\n// Sample data — replace with your own props or data source\nconst sampleData: InvoiceModernData = {\n billTo: {\n address: \"789 Innovation Blvd, Floor 3\",\n email: \"[email protected]\",\n name: \"TechStart Solutions\",\n phone: \"+1 (555) 987-6543\",\n },\n companyAddress: \"Nagpur, IN\",\n companyEmail: \"[email protected]\",\n companyName: \"PDFx Inc.\",\n dueDate: \"March 20, 2026\",\n invoiceDate: \"February 18, 2026\",\n invoiceNumber: \"INV-2026-002\",\n items: [\n { description: \"API Integration\", quantity: 1, unitPrice: 15_000 },\n { description: \"SEO\", quantity: 2, unitPrice: 5500 },\n { description: \"Security Audit\", quantity: 1, unitPrice: 7200 },\n ],\n notes: \"Payment terms: Net 30 days. Thank you for your business!\",\n paymentTerms: {\n dueDate: \"March 20, 2026\",\n gst: \"GSTIN 123456789\",\n method: \"Wire Transfer / Bank Account\",\n },\n subtitle: \"Innovative PDF Solutions\",\n summary: {\n subtotal: 33_200,\n tax: 2324,\n total: 35_524,\n },\n};\n\nconst InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {\n const theme = usePdfcnTheme();\n\n const styles = StyleSheet.create({\n dividerCol: {\n backgroundColor: theme.colors.border,\n marginRight: 12,\n width: 1,\n },\n metaCol: {\n flex: 1,\n paddingRight: 12,\n },\n metaLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n fontWeight: \"bold\",\n letterSpacing: 0.5,\n marginBottom: 3,\n textTransform: \"uppercase\",\n },\n metaRow: {\n flexDirection: \"row\",\n marginBottom: theme.spacing.sectionGap,\n },\n metaValue: {\n color: theme.colors.foreground,\n fontSize: 9,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n padding: theme.spacing.page.marginTop,\n paddingBottom: theme.spacing.page.marginBottom,\n position: \"relative\",\n },\n });\n\n return (\n <Document title={`Invoice ${data.invoiceNumber}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"branded\"\n title={data.companyName}\n subtitle={`${data.subtitle} · ${data.companyAddress} · ${data.companyEmail}`}\n />\n <View style={styles.metaRow}>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Number\n </Text>\n <Text\n style={{ ...styles.metaValue, fontSize: 11, fontWeight: \"bold\" }}\n noMargin\n >\n {data.invoiceNumber}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Invoice Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.invoiceDate}\n </Text>\n </View>\n <View style={styles.metaCol}>\n <Text style={styles.metaLabel} noMargin>\n Due Date\n </Text>\n <Text style={styles.metaValue} noMargin>\n {data.dueDate}\n </Text>\n </View>\n <View style={styles.dividerCol} />\n <View style={{ flex: 2 }}>\n <Text style={styles.metaLabel} noMargin>\n Billed To\n </Text>\n <Text style={{ ...styles.metaValue, fontWeight: \"bold\" }} noMargin>\n {data.billTo.name}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.address}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.email}\n </Text>\n <Text\n style={{\n ...styles.metaValue,\n color: theme.colors.mutedForeground,\n }}\n noMargin\n >\n {data.billTo.phone}\n </Text>\n </View>\n </View>\n <Table variant=\"primary-header\">\n <TableHeader>\n <TableRow header>\n <TableCell>Description</TableCell>\n <TableCell align=\"center\">Qty</TableCell>\n <TableCell align=\"right\">Unit Price</TableCell>\n <TableCell align=\"right\">Amount</TableCell>\n </TableRow>\n </TableHeader>\n <TableBody>\n {data.items.map((item, index) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: invoice items have no stable id\n <TableRow key={index}>\n <TableCell>{item.description}</TableCell>\n <TableCell align=\"center\">{`${item.quantity}`}</TableCell>\n <TableCell align=\"right\">{`$${item.unitPrice.toLocaleString()}`}</TableCell>\n <TableCell align=\"right\">{`$${(item.quantity * item.unitPrice).toFixed(2)}`}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n <Section noWrap style={{ flexDirection: \"row\", marginTop: 16 }}>\n <View style={{ flex: 1, paddingRight: 20 }}>\n <Text style={styles.metaLabel} noMargin>\n Payment Method\n </Text>\n <Text variant=\"xs\" noMargin>\n {data.paymentTerms.method}\n </Text>\n <Text variant=\"xs\" noMargin color=\"mutedForeground\">\n {data.paymentTerms.gst}\n </Text>\n </View>\n <View style={{ width: 220 }}>\n <KeyValue\n size=\"sm\"\n dividerThickness={1}\n items={[\n {\n key: \"Subtotal\",\n value: `$${data.summary.subtotal.toFixed(2)}`,\n },\n { key: \"Tax (7%)\", value: `$${data.summary.tax.toFixed(2)}` },\n {\n key: \"Total Due\",\n keyStyle: { fontSize: 12, fontWeight: \"bold\" },\n value: `$${data.summary.total.toFixed(2)}`,\n valueStyle: { fontSize: 12, fontWeight: \"bold\" },\n },\n ]}\n divided\n />\n </View>\n </Section>\n <PageFooter\n leftText={data.notes}\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={25}\n />\n </Page>\n </Document>\n );\n};\n\nexport const InvoiceModernDocument = ({\n theme,\n data = sampleData,\n}: {\n theme?: PdfcnTheme;\n data?: InvoiceModernData;\n}) => (\n <PdfcnThemeProvider theme={theme}>\n <InvoiceModernContent data={data} />\n </PdfcnThemeProvider>\n);\n","type": "registry:block","target": "components/pdf/blocks/invoice-modern/invoice-modern.tsx"},diff --git a/public/r/takumi/list.json b/public/r/takumi/list.jsonindex 2359276..5549823 100644--- a/public/r/takumi/list.json+++ b/public/r/takumi/list.json@@ -13,13 +13,13 @@"files": [{"path": "registry/bases/takumi/components/list/list.styles.ts",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { StyleSheet } from \"../../lib/takumi-primitives\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n checkMark: {\n color: t.colors.background,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 8,\n fontWeight: fontWeights.bold,\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport { StyleSheet } from \"../../lib/takumi-primitives\";\n\n/**\n * Creates all list styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createListStyles = (t: PdfcnTheme) => {\n const { borderRadius, spacing, fontWeights, typography } = t.primitives;\n\n return StyleSheet.create({\n checkBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.background,\n borderColor: t.colors.border,\n borderRadius: 3,\n borderStyle: \"solid\",\n borderWidth: 1.5,\n height: spacing[4],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[4],\n },\n checkBoxChecked: {\n backgroundColor: t.colors.success,\n borderColor: t.colors.success,\n },\n childrenContainer: {\n display: \"flex\",\n flexDirection: \"column\",\n marginLeft: spacing[5],\n marginTop: spacing[1],\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n descriptiveAccent: {\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.sm,\n marginRight: spacing[3],\n minHeight: spacing[4],\n width: 3,\n },\n descriptiveContent: {\n flex: 1,\n },\n descriptiveDesc: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginTop: 1,\n },\n descriptiveTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: t.typography.body.lineHeight,\n },\n iconBox: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: borderRadius.md,\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n iconMark: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: 9,\n fontWeight: fontWeights.bold,\n },\n itemRow: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n },\n itemRowCenter: {\n alignItems: \"center\",\n flexDirection: \"row\",\n },\n itemRowGapMd: { marginBottom: spacing[3] },\n itemRowGapSm: { marginBottom: spacing[2] },\n itemRowGapXs: { marginBottom: spacing[1] },\n itemText: {\n // No flex here — Text nodes with flex shorthand get flexBasis:0, which causes\n // Yoga to under-measure multi-line text height → overlapping rows.\n // flex:1 must live on the wrapping View, not on the Text itself.\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextBold: {\n fontWeight: fontWeights.semibold,\n },\n itemTextSub: {\n // Same: no flex — see itemText comment.\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize - 0.5,\n lineHeight: t.typography.body.lineHeight,\n },\n itemTextWrap: {\n // Companion to itemText / itemTextSub. Apply this to the View that wraps\n // the Text so flex expansion happens at the View level, not the Text level.\n flex: 1,\n },\n markerBulletDot: {\n backgroundColor: t.colors.primary,\n borderRadius: 3,\n height: 5,\n width: 5,\n },\n markerBulletSubDot: {\n backgroundColor: \"transparent\",\n borderColor: t.colors.mutedForeground,\n borderRadius: 2,\n borderStyle: \"solid\",\n borderWidth: 1,\n height: 4,\n width: 4,\n },\n markerBulletSubWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerBulletWrap: {\n alignItems: \"center\",\n justifyContent: \"flex-start\",\n marginTop: spacing[1],\n width: spacing[4],\n },\n markerNumberBadge: {\n alignItems: \"center\",\n backgroundColor: t.colors.primary,\n borderRadius: spacing[5],\n height: spacing[5],\n justifyContent: \"center\",\n marginRight: spacing[2],\n width: spacing[5],\n },\n markerNumberText: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.bold,\n },\n });\n};\n","type": "registry:component","target": "components/pdf/components/list/list.styles.ts"},{"path": "registry/bases/takumi/components/list/list.tsx",- "content": "import type React from \"react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\")}\n >\n <View style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}>\n {isChecked ? <PDFText style={styles.checkMark}>✓</PDFText> : null}\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles)}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={[\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ]}\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n noWrap = false,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View wrap={!noWrap} style={styleArray}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n",+ "content": "import type React from \"react\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\nimport { createListStyles } from \"./list.styles\";\nimport type { ListItem, ListVariant, PdfListProps } from \"./list.types\";\n\ntype Styles = ReturnType<typeof createListStyles>;\ntype GapProp = \"xs\" | \"sm\" | \"md\";\n\nconst getGapStyle = (gap: GapProp, styles: Styles): Style => {\n if (gap === \"xs\") {\n return styles.itemRowGapXs;\n }\n if (gap === \"md\") {\n return styles.itemRowGapMd;\n }\n return styles.itemRowGapSm;\n};\n\nconst buildRowStyles = (\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n align: \"start\" | \"center\" = \"start\"\n): Style[] => {\n const row: Style[] = [\n align === \"center\" ? styles.itemRowCenter : styles.itemRow,\n ];\n if (index !== total - 1) {\n row.push(getGapStyle(gap, styles));\n }\n return row;\n};\n\n/** Bullet dot marker — solid filled for level 0, outline ring for nested levels. */\nconst dotMarker = (level: number, styles: Styles): React.ReactElement =>\n level === 0 ? (\n <View style={styles.markerBulletWrap}>\n <View style={styles.markerBulletDot} />\n </View>\n ) : (\n <View style={styles.markerBulletSubWrap}>\n <View style={styles.markerBulletSubDot} />\n </View>\n );\n\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderBulletItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n// eslint-disable-next-line no-use-before-define, prefer-const\nlet renderMultiLevelItem: (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles,\n level: number\n) => React.ReactElement;\n\nconst renderNumberedItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.markerNumberBadge}>\n <PDFText style={styles.markerNumberText}>{`${index + 1}`}</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderChecklistItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => {\n const isChecked = item.checked ?? true;\n return (\n <View\n key={index}\n style={buildRowStyles(index, total, gap, styles, \"center\")}\n >\n <View\n style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}\n ></View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n );\n};\n\nconst renderIconItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles, \"center\")}>\n <View style={styles.iconBox}>\n <PDFText style={styles.iconMark}>★</PDFText>\n </View>\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n);\n\nconst renderDescriptiveItem = (\n item: ListItem,\n index: number,\n total: number,\n gap: GapProp,\n styles: Styles\n): React.ReactElement => (\n <View key={index} style={buildRowStyles(index, total, gap, styles)}>\n <View style={styles.descriptiveAccent} />\n <View style={styles.descriptiveContent}>\n <PDFText style={styles.descriptiveTitle}>{item.text}</PDFText>\n {item.description ? (\n <PDFText style={styles.descriptiveDesc}>{item.description}</PDFText>\n ) : null}\n </View>\n </View>\n);\n\nconst renderItem = (\n item: ListItem,\n index: number,\n total: number,\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement | null => {\n switch (variant) {\n case \"bullet\": {\n return renderBulletItem(item, index, total, gap, styles, level);\n }\n case \"numbered\": {\n return renderNumberedItem(item, index, total, gap, styles);\n }\n case \"checklist\": {\n return renderChecklistItem(item, index, total, gap, styles);\n }\n case \"icon\": {\n return renderIconItem(item, index, total, gap, styles);\n }\n case \"multi-level\": {\n return renderMultiLevelItem(item, index, total, gap, styles, level);\n }\n case \"descriptive\": {\n return renderDescriptiveItem(item, index, total, gap, styles);\n }\n default: {\n break;\n }\n }\n return null;\n};\n\nconst renderItemList = (\n items: ListItem[],\n variant: ListVariant,\n gap: GapProp,\n styles: Styles,\n level: number\n): React.ReactElement => (\n <View style={level > 0 ? styles.childrenContainer : undefined}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, level)\n )}\n </View>\n);\n\nrenderBulletItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText style={styles.itemText}>{item.text}</PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"bullet\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nrenderMultiLevelItem = (item, index, total, gap, styles, level) => (\n <View key={index}>\n <View style={buildRowStyles(index, total, gap, styles)}>\n {dotMarker(level, styles)}\n <View style={styles.itemTextWrap}>\n <PDFText\n style={[\n level === 0 ? styles.itemText : styles.itemTextSub,\n level === 0 ? styles.itemTextBold : {},\n ]}\n >\n {item.text}\n </PDFText>\n </View>\n </View>\n {item.children && item.children.length > 0\n ? renderItemList(item.children, \"multi-level\", gap, styles, level + 1)\n : null}\n </View>\n);\n\nexport const PdfList = ({\n items,\n variant = \"bullet\",\n gap = \"sm\",\n style,\n noWrap = false,\n _level = 0,\n}: PdfListProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createListStyles(theme), [theme]);\n\n const containerStyles: Style[] = [styles.container];\n if (_level > 0) {\n containerStyles.push(styles.childrenContainer);\n }\n const styleArray = style ? [...containerStyles, style] : containerStyles;\n\n return (\n <View wrap={!noWrap} style={styleArray}>\n {items.map((item, index) =>\n renderItem(item, index, items.length, variant, gap, styles, _level)\n )}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/list/list.tsx"},diff --git a/public/r/takumi/page-number.json b/public/r/takumi/page-number.jsonindex 8d6a07a..c2ab033 100644--- a/public/r/takumi/page-number.json+++ b/public/r/takumi/page-number.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/components/page-number/page-number.tsx",- "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText, StyleSheet } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PdfPageNumberProps}\n */\nexport interface PdfPageNumberProps extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: { width: \"100%\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nconst _formatPageNumber = (\n format: string,\n pageNumber: number,\n totalPages: number\n): string =>\n format\n .replace(\"{page}\", String(pageNumber))\n .replace(\"{total}\", String(totalPages));\n\nexport const PdfPageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PdfPageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={styles.container}>\n <PDFText style={textStyles}>\n {format.split(/({page}|{total})/).map((part, i) => {\n if (part === \"{page}\") {\n return <span key={i} className=\"pageNumber\" />;\n }\n if (part === \"{total}\") {\n return <span key={i} className=\"totalPages\" />;\n }\n return <span key={i}>{part}</span>;\n })}\n </PDFText>\n </View>\n );\n};\n",+ "content": "import type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\n\nimport { usePdfcnTheme, useSafeMemo } from \"../../lib/pdfcn-theme-context\";\nimport { View, Text as PDFText, StyleSheet } from \"../../lib/takumi-primitives\";\nimport type { Style } from \"../../lib/takumi-primitives\";\n\nexport type PageNumberAlign = \"left\" | \"center\" | \"right\";\nexport type PageNumberSize = \"xs\" | \"sm\" | \"md\";\n\n/**\n * Auto page number rendered with a configurable format string at a or inline position.\n * Props - `format` | `align` | `size` | `fixed` | `muted` | `style`\n * @see {@link PdfPageNumberProps}\n */\nexport interface PdfPageNumberProps extends Omit<\n PDFComponentProps,\n \"children\"\n> {\n /**\n * Format string — use `{page}` for current page and `{total}` for total page count.\n * @default 'Page {page} of {total}'\n */\n format?: string;\n /**\n * @default 'center'\n */\n align?: PageNumberAlign;\n /**\n * @default 'sm'\n */\n size?: PageNumberSize;\n /**\n * @default false\n */\n fixed?: boolean;\n /**\n * @default true\n */\n muted?: boolean;\n children?: never;\n}\n\nconst createPageNumberStyles = (t: PdfcnTheme) => {\n const { typography, colors, primitives } = t;\n return StyleSheet.create({\n alignCenter: { textAlign: \"center\" },\n alignLeft: { textAlign: \"left\" },\n alignRight: { textAlign: \"right\" },\n colorForeground: { color: colors.foreground },\n colorMuted: { color: colors.mutedForeground },\n container: {\n display: \"flex\",\n flexDirection: \"row\",\n width: \"100%\",\n },\n justifyCenter: { justifyContent: \"center\" },\n justifyLeft: { justifyContent: \"flex-start\" },\n justifyRight: { justifyContent: \"flex-end\" },\n sizeMd: { fontSize: primitives.typography.base },\n sizeSm: { fontSize: primitives.typography.sm },\n sizeXs: { fontSize: primitives.typography.xs },\n text: { fontFamily: typography.body.fontFamily },\n });\n};\n\nconst _formatPageNumber = (\n format: string,\n pageNumber: number,\n totalPages: number\n): string =>\n format\n .replace(\"{page}\", String(pageNumber))\n .replace(\"{total}\", String(totalPages));\n\nexport const PdfPageNumber = ({\n format = \"Page {page} of {total}\",\n align = \"center\",\n size = \"sm\",\n muted = true,\n style,\n}: PdfPageNumberProps) => {\n const theme = usePdfcnTheme();\n const styles = useSafeMemo(() => createPageNumberStyles(theme), [theme]);\n const alignMap = {\n center: styles.alignCenter,\n left: styles.alignLeft,\n right: styles.alignRight,\n } as Record<PageNumberAlign, Style>;\n const sizeMap = {\n md: styles.sizeMd,\n sm: styles.sizeSm,\n xs: styles.sizeXs,\n } as Record<PageNumberSize, Style>;\n const justifyMap = {\n center: styles.justifyCenter,\n left: styles.justifyLeft,\n right: styles.justifyRight,\n } as Record<PageNumberAlign, Style>;\n const textStyles: Style[] = [\n styles.text,\n alignMap[align],\n sizeMap[size],\n muted ? styles.colorMuted : styles.colorForeground,\n ];\n if (style) {\n textStyles.push(...[style].flat());\n }\n return (\n <View style={[styles.container, justifyMap[align]]}>\n {format.split(/({page}|{total})/).map((part, index) => {\n if (part === \"{page}\") {\n return (\n <PDFText\n key={`page-${index}`}\n className=\"pageNumber\"\n style={textStyles}\n />\n );\n }\n if (part === \"{total}\") {\n return (\n <PDFText\n key={`total-${index}`}\n className=\"totalPages\"\n style={textStyles}\n />\n );\n }\n return (\n <PDFText key={`text-${index}`} style={textStyles}>\n {part}\n </PDFText>\n );\n })}\n </View>\n );\n};\n","type": "registry:component","target": "components/pdf/components/page-number/page-number.tsx"},diff --git a/public/r/takumi/report-financial.json b/public/r/takumi/report-financial.jsonindex 2a0e17f..bd308d5 100644--- a/public/r/takumi/report-financial.json+++ b/public/r/takumi/report-financial.json@@ -19,7 +19,7 @@},{"path": "registry/bases/takumi/blocks/report-financial/report-layout.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap` for\n concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-financial/report-layout.tsx"},diff --git a/public/r/takumi/report-marketing.json b/public/r/takumi/report-marketing.jsonindex 45f5df8..16230d4 100644--- a/public/r/takumi/report-marketing.json+++ b/public/r/takumi/report-marketing.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/report-marketing/report-layout.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap` for\n concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-marketing/report-layout.tsx"},diff --git a/public/r/takumi/report-operations.json b/public/r/takumi/report-operations.jsonindex f82552d..7a98fb0 100644--- a/public/r/takumi/report-operations.json+++ b/public/r/takumi/report-operations.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/report-operations/report-layout.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap` for\n concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-operations/report-layout.tsx"},diff --git a/public/r/takumi/report-security.json b/public/r/takumi/report-security.jsonindex 7b7e3af..64182e5 100644--- a/public/r/takumi/report-security.json+++ b/public/r/takumi/report-security.json@@ -13,7 +13,7 @@"files": [{"path": "registry/bases/takumi/blocks/report-security/report-layout.tsx",- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n Divider,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Stack,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={styles.page}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <Section padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View style={styles.graphShell}>\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={200}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section padding=\"md\">\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Average Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n <Divider />\n <Stack gap=\"sm\">\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: keep each section under one page using `noWrap` for\n concise blocks.\n </Text>\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Best practice: pass explicit row keys/owners to avoid ambiguous\n reporting handoffs.\n </Text>\n </Stack>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n",+ "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"../../components\";\nimport { View, StyleSheet, Document, Page } from \"../../lib/takumi-primitives\";\nimport type { BaseReportData } from \"./report.types\";\n\nexport interface ReportTemplateProps {\n theme?: PdfcnTheme;\n data?: BaseReportData;\n}\n\ntype ReportGraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\ninterface ReportLayoutProps {\n data: BaseReportData;\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}\n\nconst toneColor = (\n theme: PdfcnTheme,\n tone: \"success\" | \"warning\" | \"destructive\" | \"info\"\n) => {\n if (tone === \"success\") {\n return theme.colors.success;\n }\n if (tone === \"warning\") {\n return theme.colors.warning;\n }\n if (tone === \"destructive\") {\n return theme.colors.destructive;\n }\n return theme.colors.info;\n};\n\nexport const ReportLayout = ({\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend = \"none\",\n graphShowValues = false,\n graphColors,\n graphData,\n}: ReportLayoutProps) => {\n const theme = usePdfcnTheme();\n const accent = toneColor(theme, statusTone);\n const deliveryOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 31,\n donut: 65,\n \"horizontal-bar\": -2,\n line: -31,\n pie: 0,\n };\n const graphHeight: Record<ReportGraphVariant, number> = {\n area: 191,\n bar: 184,\n donut: 193,\n \"horizontal-bar\": 163,\n line: 195,\n pie: 191,\n };\n const graphOffset: Record<ReportGraphVariant, number> = {\n area: 0,\n bar: 0,\n donut: 0,\n \"horizontal-bar\": 0,\n line: 0,\n pie: 0,\n };\n const styles = StyleSheet.create({\n col: {\n flex: 1,\n },\n graphShell: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 12,\n },\n metricCard: {\n backgroundColor: theme.colors.background,\n borderColor: theme.colors.border,\n borderRadius: theme.primitives.borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: 1,\n padding: 8,\n width: \"48.6%\",\n },\n metricLabel: {\n color: theme.colors.mutedForeground,\n fontSize: 8,\n letterSpacing: 0.5,\n marginBottom: 2,\n textTransform: \"uppercase\",\n },\n metricTrend: {\n color: theme.colors.mutedForeground,\n fontSize: 9,\n },\n metricValue: {\n color: theme.colors.foreground,\n fontSize: 14,\n fontWeight: theme.primitives.fontWeights.bold,\n marginBottom: 2,\n },\n metricsGrid: {\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 8,\n },\n page: {\n backgroundColor: theme.colors.background,\n boxSizing: \"border-box\",\n minHeight: 841,\n paddingBottom: theme.spacing.page.marginBottom,\n paddingLeft: theme.spacing.page.marginLeft,\n paddingRight: theme.spacing.page.marginRight,\n paddingTop: theme.spacing.page.marginTop,\n position: \"relative\",\n },\n pageBreak: {\n breakAfter: \"page\",\n },\n toolbar: {\n alignItems: \"center\",\n flexDirection: \"row\",\n justifyContent: \"space-between\",\n marginBottom: 8,\n },\n twoColumn: {\n alignItems: \"flex-start\",\n flexDirection: \"row\",\n gap: 10,\n },\n });\n\n return (\n <Document title={`${titlePrefix} ${data.period}`}>\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <PageHeader\n variant=\"two-column\"\n title={data.title}\n subtitle={`${titlePrefix} · ${data.subtitle}`}\n rightText={data.period}\n rightSubText={`Generated ${data.generatedAt}`}\n marginBottom={14}\n />\n\n <View style={styles.toolbar}>\n <Badge label={statusLabel} variant={statusTone} size=\"sm\" />\n <Text variant=\"xs\" color=\"mutedForeground\" noMargin>\n Author: {data.author}\n </Text>\n </View>\n\n <Section variant=\"card\" padding=\"md\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Executive Summary\n </Text>\n <View style={styles.metricsGrid}>\n {data.summary.map((metric) => (\n <View\n key={metric.label}\n style={[\n styles.metricCard,\n {\n borderLeftColor: metric.tone\n ? toneColor(theme, metric.tone)\n : accent,\n borderLeftWidth: 3,\n },\n ]}\n >\n <Text style={styles.metricLabel} noMargin>\n {metric.label}\n </Text>\n <Text style={styles.metricValue} noMargin>\n {metric.value}\n </Text>\n {metric.trend ? (\n <Badge\n label={metric.trend}\n size=\"sm\"\n variant={metric.tone ?? \"info\"}\n />\n ) : null}\n </View>\n ))}\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={[styles.page, styles.pageBreak]}>\n <Section\n padding=\"md\"\n noWrap\n style={\n graphVariant === \"horizontal-bar\" ? { marginTop: -6 } : undefined\n }\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Performance Trend\n </Text>\n <View\n style={[\n styles.graphShell,\n {\n marginTop: graphVariant === \"horizontal-bar\" ? 34 : 0,\n position: \"relative\",\n top: graphOffset[graphVariant],\n },\n ]}\n >\n <PdfGraph\n variant={graphVariant}\n data={graphData ?? data.series}\n title={graphTitle}\n subtitle={graphSubtitle}\n yLabel={undefined}\n xLabel={undefined}\n showGrid={graphVariant !== \"pie\" && graphVariant !== \"donut\"}\n showValues={graphShowValues}\n smooth={graphVariant === \"line\" || graphVariant === \"area\"}\n legend={graphLegend}\n height={graphHeight[graphVariant]}\n colors={graphColors}\n fullWidth\n containerPadding={12}\n wrapperPadding={12}\n style={{ marginBottom: 0 }}\n />\n </View>\n </Section>\n\n <Section\n padding=\"md\"\n style={{\n position: \"relative\",\n top: deliveryOffset[graphVariant],\n }}\n >\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Delivery Table\n </Text>\n <DataTable\n variant=\"compact\"\n size=\"compact\"\n stripe\n columns={[\n { header: \"Stream\", key: \"label\" },\n { header: \"Owner\", key: \"owner\" },\n { align: \"center\", header: \"Status\", key: \"status\" },\n {\n align: \"right\",\n header: \"Progress\",\n key: \"progress\",\n render: (value) => `${String(value)}%`,\n },\n { align: \"right\", header: \"Risk\", key: \"risk\" },\n ]}\n data={data.rows}\n footer={{\n label: \"Totals\",\n owner: \"-\",\n progress: Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n ),\n risk: \"-\",\n status: \"-\",\n }}\n />\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n\n <Page size=\"A4\" style={styles.page}>\n <Section padding=\"md\" variant=\"card\" noWrap>\n <Text variant=\"sm\" transform=\"uppercase\" color=\"mutedForeground\">\n Highlights & Risks\n </Text>\n <View style={styles.twoColumn}>\n <View style={styles.col}>\n <PdfList\n variant=\"checklist\"\n items={data.highlights.map((item) => ({\n checked: true,\n text: item,\n }))}\n gap=\"sm\"\n />\n </View>\n <View style={styles.col}>\n <KeyValue\n size=\"sm\"\n divided\n items={[\n {\n key: \"Open Risks\",\n value: `${data.rows.filter((r) => r.risk !== \"Low\").length}`,\n },\n {\n key: \"On-Track Streams\",\n value: `${data.rows.filter((r) => r.status === \"On Track\").length}/${data.rows.length}`,\n },\n {\n key: \"Avg Progress\",\n value: `${Math.round(\n data.rows.reduce((sum, row) => sum + row.progress, 0) /\n Math.max(data.rows.length, 1)\n )}%`,\n },\n ]}\n />\n </View>\n </View>\n </Section>\n\n <PageFooter\n variant=\"three-column\"\n leftText=\"Confidential — Internal Use\"\n centerText=\"Generated with PDFx\"\n rightText=\"Page 1 of 1\"\n sticky\n pagePadding={theme.spacing.page.marginLeft}\n />\n </Page>\n </Document>\n );\n};\n\nexport const ReportTemplateFrame = ({\n theme,\n data,\n titlePrefix,\n statusLabel,\n statusTone,\n graphVariant,\n graphTitle,\n graphSubtitle,\n graphLegend,\n graphShowValues,\n graphColors,\n graphData,\n}: ReportTemplateProps & {\n titlePrefix: string;\n statusLabel: string;\n statusTone: \"success\" | \"warning\" | \"destructive\" | \"info\";\n graphVariant: ReportGraphVariant;\n graphTitle: string;\n graphSubtitle: string;\n graphLegend?: \"bottom\" | \"right\" | \"none\";\n graphShowValues?: boolean;\n graphColors?: string[];\n graphData?: { label: string; value: number }[];\n}) => {\n if (!data) {\n return null;\n }\n\n return (\n <PdfcnThemeProvider theme={theme}>\n <ReportLayout\n data={data}\n titlePrefix={titlePrefix}\n statusLabel={statusLabel}\n statusTone={statusTone}\n graphVariant={graphVariant}\n graphTitle={graphTitle}\n graphSubtitle={graphSubtitle}\n graphLegend={graphLegend}\n graphShowValues={graphShowValues}\n graphColors={graphColors}\n graphData={graphData}\n />\n </PdfcnThemeProvider>\n );\n};\n","type": "registry:block","target": "components/pdf/blocks/report-security/report-layout.tsx"},diff --git a/public/r/takumi/utils.json b/public/r/takumi/utils.jsonindex 1419dac..ef9e5ec 100644--- a/public/r/takumi/utils.json+++ b/public/r/takumi/utils.json@@ -16,7 +16,7 @@},{"path": "registry/bases/takumi/lib/pdfcn-theme-context.tsx",- "content": "\"use client\";\n\n/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and hooks/context intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport * as React from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nexport const PdfcnThemeContext = createContext<PdfcnTheme>(defaultTheme);\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\n/**\n * Detect whether React currently has an active dispatcher.\n * When components are invoked as plain functions in tests, dispatcher is null.\n */\nconst hasActiveDispatcher = (): boolean => {\n const maybeInternals = React as unknown as {\n __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?: {\n H?: unknown;\n };\n };\n\n const dispatcher =\n maybeInternals\n .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.H;\n return dispatcher != null;\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) => (\n <PdfcnThemeContext.Provider value={theme ?? defaultTheme}>\n {children}\n </PdfcnThemeContext.Provider>\n);\n\n/**\n * Regex patterns that indicate a hook was called outside a valid React render tree.\n * These errors are caught and suppressed so components fall back to safe defaults.\n */\nconst HOOK_ERROR_PATTERNS =\n /invalid hook call|minified react error #321|useContext|useMemo|cannot read properties of null|dispatcher|renderWithHooks|resolveDispatcher|hooks can only be called|rendered fewer hooks/i;\n\n/**\n * Calls a React hook with a graceful fallback for non-render environments (e.g. unit tests).\n * Uses hasActiveDispatcher() as the primary guard; the try/catch is a safety net for edge\n * cases where the dispatcher check passes but the hook still cannot execute.\n */\nconst callHook = <T,>(hook: () => T, fallback: T): T => {\n if (!hasActiveDispatcher()) {\n return fallback;\n }\n try {\n return hook();\n } catch (error) {\n if (error instanceof Error && HOOK_ERROR_PATTERNS.test(error.message)) {\n return fallback;\n }\n throw error;\n }\n};\n\n/**\n * Returns the active PdfcnTheme from context, or the default theme when called\n * outside a React render tree (e.g. unit tests).\n */\nexport const usePdfcnTheme = (): PdfcnTheme =>\n callHook(() => useContext(PdfcnThemeContext), defaultTheme);\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",+ "content": "/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nlet serializedTheme = defaultTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\n/**\n * Takumi converts function components directly instead of mounting a React\n * tree. Resolve the provider's child so the converter receives PDF markup.\n */\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? defaultTheme);\n\n/** Returns the theme selected by the nearest serialized provider. */\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n","type": "registry:lib","target": "components/pdf/lib/pdfcn-theme-context.tsx"},@@ -28,13 +28,13 @@},{"path": "registry/bases/takumi/lib/takumi-primitives.tsx",- "content": "import type { ReactNode, ImgHTMLAttributes, AnchorHTMLAttributes } from \"react\";\n\nexport type Style = Record<string, unknown>;\n\nexport const StyleSheet = {\n create<T extends Record<string, Style>>(styles: T): T {\n return styles;\n },\n};\n\ntype StyleInput = Style | Style[] | false | null | undefined;\n\ninterface ViewProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n wrap?: boolean;\n fixed?: boolean;\n break?: boolean;\n minPresenceAhead?: number;\n}\n\nconst flatten = (style?: StyleInput): Record<string, unknown> | undefined => {\n if (!style) {\n return undefined;\n }\n if (Array.isArray(style)) {\n return Object.assign({}, ...style.filter(Boolean));\n }\n return style;\n};\n\nexport const View = ({ children, style, className, ...rest }: ViewProps) => {\n const {\n wrap: _w,\n fixed: _f,\n break: br,\n minPresenceAhead: _m,\n ...dom\n } = rest as ViewProps & Record<string, unknown>;\n const merged = flatten(style) ?? {};\n if (br) {\n Object.assign(merged, { breakBefore: \"page\" });\n }\n return (\n <div\n className={className}\n style={merged as React.CSSProperties}\n {...(dom as object)}\n >\n {children}\n </div>\n );\n};\n\ninterface TextProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n render?: (info: { pageNumber: number; totalPages: number }) => ReactNode;\n fixed?: boolean;\n href?: string;\n src?: string;\n}\n\nexport const Text = ({\n children,\n style,\n className,\n render: _render,\n href,\n src,\n ...rest\n}: TextProps) => {\n const merged = flatten(style) as React.CSSProperties | undefined;\n const link = href ?? src;\n if (link) {\n return (\n <a href={link} className={className} style={merged} {...(rest as object)}>\n {children}\n </a>\n );\n }\n return (\n <span className={className} style={merged} {...(rest as object)}>\n {children}\n </span>\n );\n};\n\nexport const Image = ({\n src,\n style,\n ...rest\n}: {\n src: string | { uri: string };\n style?: StyleInput;\n} & Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"style\">) => {\n const resolved = typeof src === \"string\" ? src : src.uri;\n return (\n <img\n src={resolved}\n style={flatten(style) as React.CSSProperties}\n alt=\"\"\n {...rest}\n />\n );\n};\n\nexport const Link = ({\n src,\n children,\n style,\n ...rest\n}: {\n src: string;\n children?: ReactNode;\n style?: StyleInput;\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"style\">) => (\n <a href={src} style={flatten(style) as React.CSSProperties} {...rest}>\n {children}\n </a>\n);\n\nexport const Document = ({\n children,\n title,\n style,\n}: {\n children?: ReactNode;\n title?: string;\n style?: StyleInput;\n}) => (\n <div data-pdf-document={title} style={flatten(style) as React.CSSProperties}>\n {children}\n </div>\n);\n\nexport const Page = ({\n children,\n size: _size,\n style,\n}: {\n children?: ReactNode;\n size?: string | { width: number; height: number };\n style?: StyleInput;\n}) => (\n <div data-pdf-page style={flatten(style) as React.CSSProperties}>\n {children}\n </div>\n);\n",+ "content": "import type { ReactNode, ImgHTMLAttributes, AnchorHTMLAttributes } from \"react\";\n\nexport type Style = Record<string, unknown>;\n\nexport const StyleSheet = {\n create<T extends Record<string, Style>>(styles: T): T {\n return styles;\n },\n};\n\ntype StyleInput = Style | Style[] | false | null | undefined;\n\n/**\n * pdfcn's shared component tokens follow the PDF convention of using points.\n * Takumi follows browser CSS instead, where numeric lengths are pixels at\n * 96 DPI. Converting at the primitive boundary keeps the public component API\n * and the generated document's physical measurements aligned with Forme.\n */\nexport const PDF_POINT_TO_CSS_PIXEL = 96 / 72;\n\nexport const pointToCssPixel = (value: number): number =>\n value * PDF_POINT_TO_CSS_PIXEL;\n\nconst POINT_LENGTH_PROPERTIES = new Set([\n \"blockSize\",\n \"borderBlockEndWidth\",\n \"borderBlockStartWidth\",\n \"borderBlockWidth\",\n \"borderBottomLeftRadius\",\n \"borderBottomRightRadius\",\n \"borderBottomWidth\",\n \"borderEndEndRadius\",\n \"borderEndStartRadius\",\n \"borderInlineEndWidth\",\n \"borderInlineStartWidth\",\n \"borderInlineWidth\",\n \"borderLeftWidth\",\n \"borderRadius\",\n \"borderRightWidth\",\n \"borderStartEndRadius\",\n \"borderStartStartRadius\",\n \"borderTopLeftRadius\",\n \"borderTopRightRadius\",\n \"borderTopWidth\",\n \"borderWidth\",\n \"bottom\",\n \"columnGap\",\n \"flexBasis\",\n \"fontSize\",\n \"gap\",\n \"height\",\n \"inlineSize\",\n \"inset\",\n \"insetBlock\",\n \"insetBlockEnd\",\n \"insetBlockStart\",\n \"insetInline\",\n \"insetInlineEnd\",\n \"insetInlineStart\",\n \"left\",\n \"letterSpacing\",\n \"margin\",\n \"marginBlock\",\n \"marginBlockEnd\",\n \"marginBlockStart\",\n \"marginBottom\",\n \"marginInline\",\n \"marginInlineEnd\",\n \"marginInlineStart\",\n \"marginLeft\",\n \"marginRight\",\n \"marginTop\",\n \"maxBlockSize\",\n \"maxHeight\",\n \"maxInlineSize\",\n \"maxWidth\",\n \"minBlockSize\",\n \"minHeight\",\n \"minInlineSize\",\n \"minWidth\",\n \"outlineOffset\",\n \"outlineWidth\",\n \"padding\",\n \"paddingBlock\",\n \"paddingBlockEnd\",\n \"paddingBlockStart\",\n \"paddingBottom\",\n \"paddingInline\",\n \"paddingInlineEnd\",\n \"paddingInlineStart\",\n \"paddingLeft\",\n \"paddingRight\",\n \"paddingTop\",\n \"right\",\n \"rowGap\",\n \"textDecorationThickness\",\n \"textIndent\",\n \"top\",\n \"width\",\n]);\n\ninterface ViewProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n wrap?: boolean;\n fixed?: boolean;\n break?: boolean;\n minPresenceAhead?: number;\n}\n\nexport const normalizeTakumiStyle = (style: Style): Style => {\n const {\n marginHorizontal,\n marginVertical,\n paddingHorizontal,\n paddingVertical,\n ...normalized\n } = style;\n\n if (marginHorizontal !== undefined) {\n normalized.marginLeft ??= marginHorizontal;\n normalized.marginRight ??= marginHorizontal;\n }\n if (marginVertical !== undefined) {\n normalized.marginBottom ??= marginVertical;\n normalized.marginTop ??= marginVertical;\n }\n if (paddingHorizontal !== undefined) {\n normalized.paddingLeft ??= paddingHorizontal;\n normalized.paddingRight ??= paddingHorizontal;\n }\n if (paddingVertical !== undefined) {\n normalized.paddingBottom ??= paddingVertical;\n normalized.paddingTop ??= paddingVertical;\n }\n\n const borderSides = [\"Top\", \"Right\", \"Bottom\", \"Left\"] as const;\n if (normalized.borderWidth !== undefined) {\n normalized.borderStyle ??= \"solid\";\n }\n for (const side of borderSides) {\n if (normalized[`border${side}Width`] !== undefined) {\n normalized[`border${side}Style`] ??= \"solid\";\n }\n }\n\n return Object.fromEntries(\n Object.entries(normalized).map(([property, value]) => [\n property,\n typeof value === \"number\" && POINT_LENGTH_PROPERTIES.has(property)\n ? pointToCssPixel(value)\n : value,\n ])\n );\n};\n\nconst flatten = (style?: StyleInput): Record<string, unknown> | undefined => {\n if (!style) {\n return undefined;\n }\n if (Array.isArray(style)) {\n return normalizeTakumiStyle(Object.assign({}, ...style.filter(Boolean)));\n }\n return normalizeTakumiStyle(style);\n};\n\nexport const View = ({ children, style, className, ...rest }: ViewProps) => {\n const {\n wrap: _w,\n fixed: _f,\n break: br,\n minPresenceAhead: _m,\n ...dom\n } = rest as ViewProps & Record<string, unknown>;\n const merged = {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n };\n if (br) {\n Object.assign(merged, { breakBefore: \"page\" });\n }\n return (\n <div\n className={className}\n style={merged as React.CSSProperties}\n {...(dom as object)}\n >\n {children}\n </div>\n );\n};\n\ninterface TextProps {\n children?: ReactNode;\n style?: StyleInput;\n className?: string;\n render?: (info: { pageNumber: number; totalPages: number }) => ReactNode;\n fixed?: boolean;\n href?: string;\n src?: string;\n}\n\nexport const Text = ({\n children,\n style,\n className,\n render: _render,\n href,\n src,\n ...rest\n}: TextProps) => {\n const merged = flatten(style) as React.CSSProperties | undefined;\n const link = href ?? src;\n if (link) {\n return (\n <a href={link} className={className} style={merged} {...(rest as object)}>\n {children}\n </a>\n );\n }\n return (\n <span className={className} style={merged} {...(rest as object)}>\n {children}\n </span>\n );\n};\n\nexport const Image = ({\n src,\n style,\n ...rest\n}: {\n src: string | { uri: string };\n style?: StyleInput;\n} & Omit<ImgHTMLAttributes<HTMLImageElement>, \"src\" | \"style\">) => {\n const resolved = typeof src === \"string\" ? src : src.uri;\n return (\n <img\n src={resolved}\n style={flatten(style) as React.CSSProperties}\n alt=\"\"\n {...rest}\n />\n );\n};\n\nexport const Link = ({\n src,\n children,\n style,\n ...rest\n}: {\n src: string;\n children?: ReactNode;\n style?: StyleInput;\n} & Omit<AnchorHTMLAttributes<HTMLAnchorElement>, \"href\" | \"style\">) => (\n <a href={src} style={flatten(style) as React.CSSProperties} {...rest}>\n {children}\n </a>\n);\n\nexport const Document = ({\n children,\n title,\n style,\n}: {\n children?: ReactNode;\n title?: string;\n style?: StyleInput;\n}) => (\n <div\n data-pdf-document={title}\n style={\n {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n } as React.CSSProperties\n }\n >\n {children}\n </div>\n);\n\nexport const Page = ({\n children,\n size: _size,\n style,\n}: {\n children?: ReactNode;\n size?: string | { width: number; height: number };\n style?: StyleInput;\n}) => (\n <div\n data-pdf-page\n style={\n {\n display: \"flex\",\n flexDirection: \"column\",\n ...flatten(style),\n } as React.CSSProperties\n }\n >\n {children}\n </div>\n);\n","type": "registry:lib","target": "components/pdf/lib/takumi-primitives.tsx"},{"path": "registry/bases/takumi/lib/takumi-svg.tsx",- "content": "import type { CSSProperties, ReactNode, SVGProps } from \"react\";\n\nexport const Svg = ({\n children,\n style,\n ...rest\n}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => (\n <svg style={style} {...rest}>\n {children}\n </svg>\n);\n\nexport const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;\nexport const Circle = (props: SVGProps<SVGCircleElement>) => (\n <circle {...props} />\n);\nexport const G = (props: SVGProps<SVGGElement>) => <g {...props} />;\nexport const Line = (props: SVGProps<SVGLineElement>) => <line {...props} />;\nexport const Path = (props: SVGProps<SVGPathElement>) => <path {...props} />;\nexport const SvgText = ({\n children,\n style,\n ...rest\n}: SVGProps<SVGTextElement> & {\n children?: ReactNode;\n style?: CSSProperties;\n}) => (\n <text style={style} {...rest}>\n {children}\n </text>\n);\n",+ "content": "import { Children, Fragment, cloneElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, SVGProps } from \"react\";\n\nimport { normalizeTakumiStyle, pointToCssPixel } from \"./takumi-primitives\";\n\ntype SvgChildProps = Record<string, unknown> & {\n children?: ReactNode;\n};\n\nconst resolveSvgChildren = (children: ReactNode): ReactNode =>\n Children.map(children, (child) => {\n if (!isValidElement<SvgChildProps>(child)) {\n return child;\n }\n\n if (typeof child.type === \"function\") {\n const resolved = (child.type as (props: SvgChildProps) => ReactNode)(\n child.props\n );\n return resolveSvgChildren(resolved);\n }\n\n if ((child.type as unknown) === Fragment) {\n return resolveSvgChildren(child.props.children);\n }\n\n if (child.props.children === undefined) {\n return child;\n }\n\n return cloneElement(\n child,\n undefined,\n resolveSvgChildren(child.props.children)\n );\n });\n\nexport const Svg = ({\n children,\n style,\n height,\n viewBox,\n width,\n ...rest\n}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => {\n const numericHeight = typeof height === \"number\" ? height : undefined;\n const numericWidth = typeof width === \"number\" ? width : undefined;\n\n return (\n <svg\n style={\n style\n ? (normalizeTakumiStyle(\n style as Record<string, unknown>\n ) as CSSProperties)\n : undefined\n }\n height={\n numericHeight === undefined ? height : pointToCssPixel(numericHeight)\n }\n viewBox={\n viewBox ??\n (numericWidth !== undefined && numericHeight !== undefined\n ? `0 0 ${numericWidth} ${numericHeight}`\n : undefined)\n }\n width={numericWidth === undefined ? width : pointToCssPixel(numericWidth)}\n {...rest}\n >\n {resolveSvgChildren(children)}\n </svg>\n );\n};\n\nexport const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;\nexport const Circle = (props: SVGProps<SVGCircleElement>) => (\n <circle {...props} />\n);\nexport const G = (props: SVGProps<SVGGElement>) => <g {...props} />;\nexport const Line = (props: SVGProps<SVGLineElement>) => <line {...props} />;\nexport const Path = (props: SVGProps<SVGPathElement>) => <path {...props} />;\nexport const SvgText = ({\n children,\n style,\n ...rest\n}: SVGProps<SVGTextElement> & {\n children?: ReactNode;\n style?: CSSProperties;\n}) => {\n const { fontFamily, fontSize, fontStyle, fontWeight, ...remainingStyle } =\n style ?? {};\n\n return (\n <text\n fontFamily={fontFamily ?? \"sans-serif\"}\n fontSize={fontSize}\n fontStyle={fontStyle}\n fontWeight={fontWeight}\n style={remainingStyle}\n {...rest}\n >\n {children}\n </text>\n );\n};\n","type": "registry:lib","target": "components/pdf/lib/takumi-svg.tsx"}diff --git a/public/takumi_pdf_wasm_bg.wasm b/public/takumi_pdf_wasm_bg.wasmnew file mode 100644index 0000000..65bd3fcBinary files /dev/null and b/public/takumi_pdf_wasm_bg.wasm differdiff --git a/registry.json b/registry.jsonindex 7da8cc0..56c6590 100644--- a/registry.json+++ b/registry.json@@ -3,10 +3,7 @@"homepage": "https://pdfcn.vercel.app","items": [{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Theme context and helpers for the takumi base","files": [{@@ -40,10 +37,7 @@"type": "registry:lib"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Alert PDF component (takumi)","files": [{@@ -58,17 +52,12 @@}],"name": "takumi/alert",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Alert","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Badge PDF component (takumi)","files": [{@@ -83,17 +72,12 @@}],"name": "takumi/badge",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Badge","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Card PDF component (takumi)","files": [{@@ -108,17 +92,12 @@}],"name": "takumi/card",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Card","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Data Table PDF component (takumi)","files": [{@@ -143,18 +122,12 @@}],"name": "takumi/data-table",- "registryDependencies": [- "takumi/utils",- "takumi/table"- ],+ "registryDependencies": ["takumi/utils", "takumi/table"],"title": "Data Table","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Divider PDF component (takumi)","files": [{@@ -169,17 +142,12 @@}],"name": "takumi/divider",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Divider","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Form PDF component (takumi)","files": [{@@ -204,17 +172,12 @@}],"name": "takumi/form",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Form","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Graph PDF component (takumi)","files": [{@@ -244,17 +207,12 @@}],"name": "takumi/graph",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Graph","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Heading PDF component (takumi)","files": [{@@ -269,17 +227,12 @@}],"name": "takumi/heading",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Heading","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Keep Together PDF component (takumi)","files": [{@@ -294,17 +247,12 @@}],"name": "takumi/keep-together",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Keep Together","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Key Value PDF component (takumi)","files": [{@@ -319,17 +267,12 @@}],"name": "takumi/key-value",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Key Value","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Link PDF component (takumi)","files": [{@@ -344,17 +287,12 @@}],"name": "takumi/link",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Link","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "List PDF component (takumi)","files": [{@@ -379,17 +317,12 @@}],"name": "takumi/list",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "List","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Break PDF component (takumi)","files": [{@@ -404,17 +337,12 @@}],"name": "takumi/page-break",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Break","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Footer PDF component (takumi)","files": [{@@ -429,17 +357,12 @@}],"name": "takumi/page-footer",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Footer","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Header PDF component (takumi)","files": [{@@ -454,17 +377,12 @@}],"name": "takumi/page-header",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Header","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Page Number PDF component (takumi)","files": [{@@ -479,17 +397,12 @@}],"name": "takumi/page-number",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Page Number","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Pdf Image PDF component (takumi)","files": [{@@ -504,18 +417,12 @@}],"name": "takumi/pdf-image",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Pdf Image","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers",- "qrcode"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers", "qrcode"],"description": "Qrcode PDF component (takumi)","files": [{@@ -530,17 +437,12 @@}],"name": "takumi/qrcode",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Qrcode","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Section PDF component (takumi)","files": [{@@ -555,17 +457,12 @@}],"name": "takumi/section",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Section","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Signature PDF component (takumi)","files": [{@@ -580,17 +477,12 @@}],"name": "takumi/signature",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Signature","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Stack PDF component (takumi)","files": [{@@ -605,17 +497,12 @@}],"name": "takumi/stack",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Stack","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Table PDF component (takumi)","files": [{@@ -640,17 +527,12 @@}],"name": "takumi/table",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Table","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Text PDF component (takumi)","files": [{@@ -665,17 +547,12 @@}],"name": "takumi/text",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Text","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Watermark PDF component (takumi)","files": [{@@ -690,17 +567,12 @@}],"name": "takumi/watermark",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Watermark","type": "registry:ui"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Classic PDF block (takumi)","files": [{@@ -715,17 +587,12 @@}],"name": "takumi/invoice-classic",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Classic","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Consultant PDF block (takumi)","files": [{@@ -740,17 +607,12 @@}],"name": "takumi/invoice-consultant",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Consultant","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Corporate PDF block (takumi)","files": [{@@ -765,17 +627,12 @@}],"name": "takumi/invoice-corporate",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Corporate","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Creative PDF block (takumi)","files": [{@@ -790,17 +647,12 @@}],"name": "takumi/invoice-creative",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Creative","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Minimal PDF block (takumi)","files": [{@@ -815,17 +667,12 @@}],"name": "takumi/invoice-minimal",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Minimal","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Invoice Modern PDF block (takumi)","files": [{@@ -840,17 +687,12 @@}],"name": "takumi/invoice-modern",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Invoice Modern","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Financial PDF block (takumi)","files": [{@@ -870,17 +712,12 @@}],"name": "takumi/report-financial",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Financial","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Marketing PDF block (takumi)","files": [{@@ -900,17 +737,12 @@}],"name": "takumi/report-marketing",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Marketing","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Operations PDF block (takumi)","files": [{@@ -930,17 +762,12 @@}],"name": "takumi/report-operations",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Operations","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "Report Security PDF block (takumi)","files": [{@@ -960,17 +787,12 @@}],"name": "takumi/report-security",- "registryDependencies": [- "takumi/utils"- ],+ "registryDependencies": ["takumi/utils"],"title": "Report Security","type": "registry:block"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "professional theme tokens for takumi","files": [{@@ -999,10 +821,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "modern theme tokens for takumi","files": [{@@ -1031,10 +850,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "minimal theme tokens for takumi","files": [{@@ -1063,10 +879,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "executive theme tokens for takumi","files": [{@@ -1095,10 +908,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "corporate theme tokens for takumi","files": [{@@ -1127,10 +937,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "elegant theme tokens for takumi","files": [{@@ -1159,10 +966,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "vivid theme tokens for takumi","files": [{@@ -1191,10 +995,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "forest theme tokens for takumi","files": [{@@ -1223,10 +1024,7 @@"type": "registry:theme"},{- "dependencies": [- "takumi-pdf",- "@takumi-rs/helpers"- ],+ "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],"description": "blueprint theme tokens for takumi","files": [{@@ -1255,10 +1053,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Theme context and helpers for the forme base","files": [{@@ -1276,6 +1071,11 @@"type": "registry:lib","target": "components/pdf/lib/resolve-color.ts"},+ {+ "path": "registry/bases/forme/lib/forme-primitives.tsx",+ "type": "registry:lib",+ "target": "components/pdf/lib/forme-primitives.tsx"+ },{"path": "registry/bases/forme/lib/forme-svg.tsx","type": "registry:lib",@@ -1292,10 +1092,7 @@"type": "registry:lib"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Alert PDF component (forme)","files": [{@@ -1310,17 +1107,12 @@}],"name": "forme/alert",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Alert","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Badge PDF component (forme)","files": [{@@ -1335,17 +1127,12 @@}],"name": "forme/badge",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Badge","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Card PDF component (forme)","files": [{@@ -1360,17 +1147,12 @@}],"name": "forme/card",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Card","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Data Table PDF component (forme)","files": [{@@ -1395,18 +1177,12 @@}],"name": "forme/data-table",- "registryDependencies": [- "forme/utils",- "forme/table"- ],+ "registryDependencies": ["forme/utils", "forme/table"],"title": "Data Table","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Divider PDF component (forme)","files": [{@@ -1421,17 +1197,12 @@}],"name": "forme/divider",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Divider","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Form PDF component (forme)","files": [{@@ -1456,17 +1227,12 @@}],"name": "forme/form",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Form","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Graph PDF component (forme)","files": [{@@ -1496,17 +1262,12 @@}],"name": "forme/graph",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Graph","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Heading PDF component (forme)","files": [{@@ -1521,17 +1282,12 @@}],"name": "forme/heading",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Heading","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Keep Together PDF component (forme)","files": [{@@ -1546,17 +1302,12 @@}],"name": "forme/keep-together",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Keep Together","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Key Value PDF component (forme)","files": [{@@ -1571,17 +1322,12 @@}],"name": "forme/key-value",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Key Value","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Link PDF component (forme)","files": [{@@ -1596,17 +1342,12 @@}],"name": "forme/link",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Link","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "List PDF component (forme)","files": [{@@ -1631,17 +1372,12 @@}],"name": "forme/list",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "List","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Break PDF component (forme)","files": [{@@ -1656,17 +1392,12 @@}],"name": "forme/page-break",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Break","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Footer PDF component (forme)","files": [{@@ -1681,17 +1412,12 @@}],"name": "forme/page-footer",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Footer","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Header PDF component (forme)","files": [{@@ -1706,17 +1432,12 @@}],"name": "forme/page-header",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Header","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Page Number PDF component (forme)","files": [{@@ -1731,17 +1452,12 @@}],"name": "forme/page-number",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Page Number","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Pdf Image PDF component (forme)","files": [{@@ -1756,18 +1472,12 @@}],"name": "forme/pdf-image",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Pdf Image","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core",- "qrcode"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core", "qrcode"],"description": "Qrcode PDF component (forme)","files": [{@@ -1782,17 +1492,12 @@}],"name": "forme/qrcode",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Qrcode","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Section PDF component (forme)","files": [{@@ -1807,17 +1512,12 @@}],"name": "forme/section",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Section","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Signature PDF component (forme)","files": [{@@ -1832,17 +1532,12 @@}],"name": "forme/signature",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Signature","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Stack PDF component (forme)","files": [{@@ -1857,17 +1552,12 @@}],"name": "forme/stack",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Stack","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Table PDF component (forme)","files": [{@@ -1892,17 +1582,12 @@}],"name": "forme/table",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Table","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Text PDF component (forme)","files": [{@@ -1917,17 +1602,12 @@}],"name": "forme/text",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Text","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Watermark PDF component (forme)","files": [{@@ -1942,17 +1622,12 @@}],"name": "forme/watermark",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Watermark","type": "registry:ui"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Classic PDF block (forme)","files": [{@@ -1967,17 +1642,12 @@}],"name": "forme/invoice-classic",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Classic","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Consultant PDF block (forme)","files": [{@@ -1992,17 +1662,12 @@}],"name": "forme/invoice-consultant",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Consultant","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Corporate PDF block (forme)","files": [{@@ -2017,17 +1682,12 @@}],"name": "forme/invoice-corporate",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Corporate","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Creative PDF block (forme)","files": [{@@ -2042,17 +1702,12 @@}],"name": "forme/invoice-creative",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Creative","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Minimal PDF block (forme)","files": [{@@ -2067,17 +1722,12 @@}],"name": "forme/invoice-minimal",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Minimal","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Invoice Modern PDF block (forme)","files": [{@@ -2092,17 +1742,12 @@}],"name": "forme/invoice-modern",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Invoice Modern","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Financial PDF block (forme)","files": [{@@ -2122,17 +1767,12 @@}],"name": "forme/report-financial",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Financial","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Marketing PDF block (forme)","files": [{@@ -2152,17 +1792,12 @@}],"name": "forme/report-marketing",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Marketing","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Operations PDF block (forme)","files": [{@@ -2182,17 +1817,12 @@}],"name": "forme/report-operations",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Operations","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "Report Security PDF block (forme)","files": [{@@ -2212,17 +1842,12 @@}],"name": "forme/report-security",- "registryDependencies": [- "forme/utils"- ],+ "registryDependencies": ["forme/utils"],"title": "Report Security","type": "registry:block"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "professional theme tokens for forme","files": [{@@ -2251,10 +1876,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "modern theme tokens for forme","files": [{@@ -2283,10 +1905,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "minimal theme tokens for forme","files": [{@@ -2315,10 +1934,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "executive theme tokens for forme","files": [{@@ -2347,10 +1963,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "corporate theme tokens for forme","files": [{@@ -2379,10 +1992,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "elegant theme tokens for forme","files": [{@@ -2411,10 +2021,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "vivid theme tokens for forme","files": [{@@ -2443,10 +2050,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "forest theme tokens for forme","files": [{@@ -2475,10 +2079,7 @@"type": "registry:theme"},{- "dependencies": [- "@formepdf/react",- "@formepdf/core"- ],+ "dependencies": ["@formepdf/react", "@formepdf/core"],"description": "blueprint theme tokens for forme","files": [{diff --git a/registry/bases.ts b/registry/bases.tsindex f75e4a4..d31112a 100644--- a/registry/bases.ts+++ b/registry/bases.ts@@ -11,7 +11,7 @@ export const BASES = [meta: {logo: TakumiIcon,},- title: "Takumi PDF",+ title: "Takumi",type: "registry:style" as const,},{@@ -22,7 +22,7 @@ export const BASES = [meta: {logo: FormeIcon,},- title: "Forme PDF",+ title: "Forme",type: "registry:style" as const,},] as const;diff --git a/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx b/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsxindex fa3cc00..fb0f468 100644--- a/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx+++ b/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx@@ -27,9 +27,9 @@ const sampleData: InvoiceClassicData = {name: "Client Corp.",phone: "+1 (555) 123-4567",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 17, 2026",invoiceDate: "February 17, 2026",invoiceNumber: "INV-2026-001",@@ -45,7 +45,7 @@ const sampleData: InvoiceClassicData = {gst: "GSTIN 123456789",method: "UPI / Card / Bank Transfer",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 36_250,tax: 2537.5,@@ -59,14 +59,18 @@ const InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {const styles = StyleSheet.create({page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},});return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ leftText={data.notes}+ rightText="Page 1 of 1"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><PageHeadervariant="logo-left"@@ -162,8 +166,15 @@ const InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {))}</TableBody></Table>- <Section noWrap style={{ flexDirection: "row", marginTop: 16 }}>- <View style={{ marginLeft: "auto", width: 220 }}>+ <Section+ noWrap+ style={{+ flexDirection: "row",+ justifyContent: "flex-end",+ marginTop: 16,+ }}+ >+ <View style={{ width: 220 }}><KeyValuesize="sm"dividerThickness={1}@@ -184,12 +195,6 @@ const InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {/></View></Section>- <PageFooter- leftText={data.notes}- rightText="Page 1 of 1"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx b/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsxindex 7b42afb..1ab9dd7 100644--- a/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx+++ b/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx@@ -24,10 +24,10 @@ const sampleData: InvoiceConsultantData = {email: "[email protected]",name: "Sarah Johnson",},- companyAddress: "City, Country · [email protected]",- companyName: "Your Consulting",+ companyAddress: "Nagpur, IN · [email protected]",+ companyName: "PDFx Inc.",consultant: {- email: "[email protected]",+ email: "[email protected]",name: "John Smith",title: "Senior Technical Consultant",},@@ -49,9 +49,9 @@ const sampleData: InvoiceConsultantData = {],subtitle: "Professional Consulting Services",summary: {- subtotal: 10_300,- tax: 515,- total: 10_815,+ subtotal: 9500,+ tax: 475,+ total: 9975,totalHours: 60,},};@@ -103,8 +103,6 @@ const InvoiceConsultantContent = ({},page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},partiesRow: {flexDirection: "row",@@ -147,7 +145,13 @@ const InvoiceConsultantContent = ({return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ leftText="Professional services invoice – Please retain for records"+ rightText="Page 1 of 1"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><View style={styles.headerRow}><View style={styles.companyInfo}>@@ -304,12 +308,6 @@ const InvoiceConsultantContent = ({</Text></View>)}- <PageFooter- leftText="Professional services invoice – Please retain for records"- rightText="Page 1 of 1"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx b/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsxindex 86984d0..6de9020 100644--- a/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx+++ b/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx@@ -25,9 +25,9 @@ const sampleData: InvoiceCorporateData = {name: "Global Industries Ltd.",phone: "+1 (555) 888-9999",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 24, 2026",invoiceDate: "February 22, 2026",invoiceNumber: "INV-2026-004",@@ -38,21 +38,26 @@ const sampleData: InvoiceCorporateData = {unitPrice: 4500,},{ description: "Implementation Services", quantity: 1, unitPrice: 18_000 },- { description: "Training Workshop", quantity: 3, unitPrice: 2500 },+ {+ description: "Training Workshop (per session)",+ quantity: 3,+ unitPrice: 2500,+ },{ description: "Annual Support Package", quantity: 1, unitPrice: 8500 },],logo: "/favicon.png",- notes: "Corporate billing – Net 30 terms apply.",+ notes:+ "Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]",paymentTerms: {dueDate: "March 24, 2026",gst: "GSTIN 987654321",method: "Wire Transfer / Corporate Account",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {- subtotal: 57_000,- tax: 4560,- total: 61_560,+ subtotal: 56_500,+ tax: 4520,+ total: 61_020,},};@@ -78,8 +83,6 @@ const InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {},page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},summaryCard: {backgroundColor: theme.colors.muted,@@ -95,7 +98,13 @@ const InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ leftText={data.notes}+ rightText="Page 1 of 1"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><PageHeadervariant="logo-right"@@ -197,12 +206,6 @@ const InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {</View></View></View>- <PageFooter- leftText={data.notes}- rightText="Page 1 of 1"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx b/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsxindex 7550279..f66feae 100644--- a/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx+++ b/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx@@ -25,8 +25,8 @@ const sampleData: InvoiceCreativeData = {name: "Creative Agency Co.",phone: "+1 (555) 321-7654",},- companyAddress: "City, Country · [email protected]",- companyName: "Your Agency",+ companyAddress: "Nagpur, IN · [email protected]",+ companyName: "PDFx Inc.",dueDate: "March 26, 2026",invoiceDate: "February 24, 2026",invoiceNumber: "INV-2026-005",@@ -51,7 +51,7 @@ const sampleData: InvoiceCreativeData = {gst: "GSTIN 456789123",method: "Credit Card / PayPal / Stripe",},- subtitle: "Creative Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 22_700,tax: 1475.5,@@ -107,8 +107,6 @@ const InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {},page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},sectionLabel: {color: theme.colors.accent,@@ -136,7 +134,13 @@ const InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ variant="centered"+ centerText="Thank you for choosing us for your creative needs!"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><View style={styles.heroSection}><View style={{ flex: 1 }}>@@ -252,12 +256,6 @@ const InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {/></View></Section>- <PageFooter- variant="centered"- centerText="Thank you for choosing us for your creative needs!"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx b/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsxindex 509d90e..ec51c74 100644--- a/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx+++ b/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx@@ -26,14 +26,14 @@ const sampleData: InvoiceMinimalData = {name: "Enterprise Corp",phone: "+1 (555) 246-8135",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 22, 2026",invoiceDate: "February 20, 2026",invoiceNumber: "INV-2026-003",items: [- { description: "Annual Licenselan", quantity: 1, unitPrice: 25_000 },+ { description: "Annual License Plan", quantity: 1, unitPrice: 25_000 },{ description: "Support & Maintenance", quantity: 12, unitPrice: 1500 },{ description: "Custom Integration", quantity: 1, unitPrice: 12_000 },],@@ -44,7 +44,7 @@ const sampleData: InvoiceMinimalData = {gst: "GSTIN 123456789",method: "ACH Transfer / Check",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 55_000,tax: 3850,@@ -66,7 +66,7 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {},infoRow: {flexDirection: "row",- marginBottom: theme.spacing.sectionGap,+ marginBottom: 28,},invoiceStamp: {alignSelf: "flex-start",@@ -79,14 +79,18 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {},page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},});return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ leftText={data.notes}+ rightText="Page 1 of 1"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><SectionnoWrap@@ -141,7 +145,7 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {</View></Section><View style={styles.infoRow}>- <View style={{ flex: 1, paddingRight: 20 }}>+ <View style={{ paddingRight: 20, width: 251 }}><Text style={styles.infoLabel} noMargin>Bill To</Text>@@ -158,7 +162,7 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {{data.billTo.phone}</Text></View>- <View style={{ flex: 1 }}>+ <View style={{ width: 232 }}><Text style={styles.infoLabel} noMargin>Invoice Details</Text>@@ -220,12 +224,6 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {/></View></Section>- <PageFooter- leftText={data.notes}- rightText="Page 1 of 1"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx b/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsxindex a9fcba4..642df9b 100644--- a/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx+++ b/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx@@ -26,9 +26,9 @@ const sampleData: InvoiceModernData = {name: "TechStart Solutions",phone: "+1 (555) 987-6543",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 20, 2026",invoiceDate: "February 18, 2026",invoiceNumber: "INV-2026-002",@@ -43,7 +43,7 @@ const sampleData: InvoiceModernData = {gst: "GSTIN 123456789",method: "Wire Transfer / Bank Account",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 33_200,tax: 2324,@@ -82,14 +82,18 @@ const InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {},page: {backgroundColor: theme.colors.background,- padding: theme.spacing.page.marginTop,- paddingBottom: theme.spacing.page.marginBottom,},});return (<Document title={`Invoice ${data.invoiceNumber}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 25, left: 56, right: 56, top: 56 }}>+ <PageFooter+ leftText={data.notes}+ rightText="Page 1 of 1"+ sticky+ pagePadding={25}+ /><View style={styles.page as never}><PageHeadervariant="branded"@@ -222,12 +226,6 @@ const InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {/></View></Section>- <PageFooter- leftText={data.notes}- rightText="Page 1 of 1"- sticky- pagePadding={25}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/report-financial/report-layout.tsx b/registry/bases/forme/blocks/report-financial/report-layout.tsxindex 1400d55..6114bce 100644--- a/registry/bases/forme/blocks/report-financial/report-layout.tsx+++ b/registry/bases/forme/blocks/report-financial/report-layout.tsx@@ -5,7 +5,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -13,7 +12,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -77,10 +75,42 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 181,+ donut: 191,+ "horizontal-bar": 148,+ line: 191,+ pie: 191,+ };+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 59,+ donut: -3,+ "horizontal-bar": -4,+ line: -30,+ pie: 0,+ };+ const sectionOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 32,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };+ const titleOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {- flex: 1,+ width: 225,},graphShell: {backgroundColor: theme.colors.background,@@ -91,13 +121,15 @@ export const ReportLayout = ({padding: 12,},metricCard: {+ alignItems: "flex-start",backgroundColor: theme.colors.background,borderColor: theme.colors.border,borderRadius: theme.primitives.borderRadius.md,borderStyle: "solid",borderWidth: 1,+ height: 75,padding: 8,- width: "48.6%",+ width: 225,},metricLabel: {color: theme.colors.mutedForeground,@@ -117,22 +149,22 @@ export const ReportLayout = ({marginBottom: 2,},metricsGrid: {+ flexDirection: "column",+ gap: 8,+ },+ metricsRow: {flexDirection: "row",- flexWrap: "wrap",gap: 8,},page: {backgroundColor: theme.colors.background,- paddingBottom: theme.spacing.page.marginBottom,- paddingLeft: theme.spacing.page.marginLeft,- paddingRight: theme.spacing.page.marginRight,- paddingTop: theme.spacing.page.marginTop,},toolbar: {alignItems: "center",flexDirection: "row",justifyContent: "space-between",marginBottom: 8,+ width: 499,},twoColumn: {alignItems: "flex-start",@@ -143,7 +175,15 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ /><View style={styles.page as never}><PageHeadervariant="two-column"@@ -166,44 +206,88 @@ export const ReportLayout = ({Executive Summary</Text><View style={styles.metricsGrid}>- {data.summary.map((metric) => (- <View- key={metric.label}- style={- [- styles.metricCard,- {- borderLeftColor: metric.tone- ? toneColor(theme, metric.tone)- : accent,- borderLeftWidth: 3,- },- ] as never- }- >- <Text style={styles.metricLabel} noMargin>- {metric.label}- </Text>- <Text style={styles.metricValue} noMargin>- {metric.value}- </Text>- {metric.trend ? (- <Badge- label={metric.trend}- size="sm"- variant={metric.tone ?? "info"}- />- ) : null}+ {[0, 2].map((startIndex) => (+ <View key={startIndex} style={styles.metricsRow}>+ {data.summary+ .slice(startIndex, startIndex + 2)+ .map((metric) => (+ <View+ key={metric.label}+ style={+ {+ ...styles.metricCard,+ borderLeftColor: metric.tone+ ? toneColor(theme, metric.tone)+ : accent,+ borderLeftWidth: 3,+ } as never+ }+ >+ <Text style={styles.metricLabel} noMargin>+ {metric.label}+ </Text>+ <Text style={styles.metricValue} noMargin>+ {metric.value}+ </Text>+ {metric.trend ? (+ <Badge+ label={metric.trend}+ size="sm"+ variant={metric.tone ?? "info"}+ style={{+ height: 16,+ width: metric.trend.endsWith("QoQ")+ ? metric.trend.length * 6.5 + 10+ : metric.trend.length * 5 + 18,+ }}+ />+ ) : null}+ </View>+ ))}</View>))}</View></Section>+ </View>+ </Page>- <Section padding="md" noWrap>- <Text variant="sm" transform="uppercase" color="mutedForeground">+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}>+ <Section+ padding="md"+ noWrap+ style={{+ position: "relative",+ top: sectionOffset[graphVariant],+ }}+ >+ <Text+ variant="sm"+ transform="uppercase"+ color="mutedForeground"+ style={{+ position: "relative",+ top: titleOffset[graphVariant],+ }}+ >Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={+ {+ ...styles.graphShell,+ paddingBottom: graphVariant === "horizontal-bar" ? 56 : 12,+ } as never+ }+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -215,7 +299,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -225,7 +309,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -258,7 +348,19 @@ export const ReportLayout = ({}}/></Section>+ </View>+ </Page>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -288,7 +390,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -298,27 +400,7 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap`- for concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section>-- <PageFooter- variant="three-column"- leftText="Confidential — Internal Use"- centerText="Generated with PDFx"- rightText="Page 1 of 1"- sticky- pagePadding={theme.spacing.page.marginLeft}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/report-marketing/report-layout.tsx b/registry/bases/forme/blocks/report-marketing/report-layout.tsxindex 1400d55..6114bce 100644--- a/registry/bases/forme/blocks/report-marketing/report-layout.tsx+++ b/registry/bases/forme/blocks/report-marketing/report-layout.tsx@@ -5,7 +5,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -13,7 +12,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -77,10 +75,42 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 181,+ donut: 191,+ "horizontal-bar": 148,+ line: 191,+ pie: 191,+ };+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 59,+ donut: -3,+ "horizontal-bar": -4,+ line: -30,+ pie: 0,+ };+ const sectionOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 32,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };+ const titleOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {- flex: 1,+ width: 225,},graphShell: {backgroundColor: theme.colors.background,@@ -91,13 +121,15 @@ export const ReportLayout = ({padding: 12,},metricCard: {+ alignItems: "flex-start",backgroundColor: theme.colors.background,borderColor: theme.colors.border,borderRadius: theme.primitives.borderRadius.md,borderStyle: "solid",borderWidth: 1,+ height: 75,padding: 8,- width: "48.6%",+ width: 225,},metricLabel: {color: theme.colors.mutedForeground,@@ -117,22 +149,22 @@ export const ReportLayout = ({marginBottom: 2,},metricsGrid: {+ flexDirection: "column",+ gap: 8,+ },+ metricsRow: {flexDirection: "row",- flexWrap: "wrap",gap: 8,},page: {backgroundColor: theme.colors.background,- paddingBottom: theme.spacing.page.marginBottom,- paddingLeft: theme.spacing.page.marginLeft,- paddingRight: theme.spacing.page.marginRight,- paddingTop: theme.spacing.page.marginTop,},toolbar: {alignItems: "center",flexDirection: "row",justifyContent: "space-between",marginBottom: 8,+ width: 499,},twoColumn: {alignItems: "flex-start",@@ -143,7 +175,15 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ /><View style={styles.page as never}><PageHeadervariant="two-column"@@ -166,44 +206,88 @@ export const ReportLayout = ({Executive Summary</Text><View style={styles.metricsGrid}>- {data.summary.map((metric) => (- <View- key={metric.label}- style={- [- styles.metricCard,- {- borderLeftColor: metric.tone- ? toneColor(theme, metric.tone)- : accent,- borderLeftWidth: 3,- },- ] as never- }- >- <Text style={styles.metricLabel} noMargin>- {metric.label}- </Text>- <Text style={styles.metricValue} noMargin>- {metric.value}- </Text>- {metric.trend ? (- <Badge- label={metric.trend}- size="sm"- variant={metric.tone ?? "info"}- />- ) : null}+ {[0, 2].map((startIndex) => (+ <View key={startIndex} style={styles.metricsRow}>+ {data.summary+ .slice(startIndex, startIndex + 2)+ .map((metric) => (+ <View+ key={metric.label}+ style={+ {+ ...styles.metricCard,+ borderLeftColor: metric.tone+ ? toneColor(theme, metric.tone)+ : accent,+ borderLeftWidth: 3,+ } as never+ }+ >+ <Text style={styles.metricLabel} noMargin>+ {metric.label}+ </Text>+ <Text style={styles.metricValue} noMargin>+ {metric.value}+ </Text>+ {metric.trend ? (+ <Badge+ label={metric.trend}+ size="sm"+ variant={metric.tone ?? "info"}+ style={{+ height: 16,+ width: metric.trend.endsWith("QoQ")+ ? metric.trend.length * 6.5 + 10+ : metric.trend.length * 5 + 18,+ }}+ />+ ) : null}+ </View>+ ))}</View>))}</View></Section>+ </View>+ </Page>- <Section padding="md" noWrap>- <Text variant="sm" transform="uppercase" color="mutedForeground">+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}>+ <Section+ padding="md"+ noWrap+ style={{+ position: "relative",+ top: sectionOffset[graphVariant],+ }}+ >+ <Text+ variant="sm"+ transform="uppercase"+ color="mutedForeground"+ style={{+ position: "relative",+ top: titleOffset[graphVariant],+ }}+ >Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={+ {+ ...styles.graphShell,+ paddingBottom: graphVariant === "horizontal-bar" ? 56 : 12,+ } as never+ }+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -215,7 +299,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -225,7 +309,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -258,7 +348,19 @@ export const ReportLayout = ({}}/></Section>+ </View>+ </Page>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -288,7 +390,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -298,27 +400,7 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap`- for concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section>-- <PageFooter- variant="three-column"- leftText="Confidential — Internal Use"- centerText="Generated with PDFx"- rightText="Page 1 of 1"- sticky- pagePadding={theme.spacing.page.marginLeft}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/report-operations/report-layout.tsx b/registry/bases/forme/blocks/report-operations/report-layout.tsxindex 1400d55..6114bce 100644--- a/registry/bases/forme/blocks/report-operations/report-layout.tsx+++ b/registry/bases/forme/blocks/report-operations/report-layout.tsx@@ -5,7 +5,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -13,7 +12,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -77,10 +75,42 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 181,+ donut: 191,+ "horizontal-bar": 148,+ line: 191,+ pie: 191,+ };+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 59,+ donut: -3,+ "horizontal-bar": -4,+ line: -30,+ pie: 0,+ };+ const sectionOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 32,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };+ const titleOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {- flex: 1,+ width: 225,},graphShell: {backgroundColor: theme.colors.background,@@ -91,13 +121,15 @@ export const ReportLayout = ({padding: 12,},metricCard: {+ alignItems: "flex-start",backgroundColor: theme.colors.background,borderColor: theme.colors.border,borderRadius: theme.primitives.borderRadius.md,borderStyle: "solid",borderWidth: 1,+ height: 75,padding: 8,- width: "48.6%",+ width: 225,},metricLabel: {color: theme.colors.mutedForeground,@@ -117,22 +149,22 @@ export const ReportLayout = ({marginBottom: 2,},metricsGrid: {+ flexDirection: "column",+ gap: 8,+ },+ metricsRow: {flexDirection: "row",- flexWrap: "wrap",gap: 8,},page: {backgroundColor: theme.colors.background,- paddingBottom: theme.spacing.page.marginBottom,- paddingLeft: theme.spacing.page.marginLeft,- paddingRight: theme.spacing.page.marginRight,- paddingTop: theme.spacing.page.marginTop,},toolbar: {alignItems: "center",flexDirection: "row",justifyContent: "space-between",marginBottom: 8,+ width: 499,},twoColumn: {alignItems: "flex-start",@@ -143,7 +175,15 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ /><View style={styles.page as never}><PageHeadervariant="two-column"@@ -166,44 +206,88 @@ export const ReportLayout = ({Executive Summary</Text><View style={styles.metricsGrid}>- {data.summary.map((metric) => (- <View- key={metric.label}- style={- [- styles.metricCard,- {- borderLeftColor: metric.tone- ? toneColor(theme, metric.tone)- : accent,- borderLeftWidth: 3,- },- ] as never- }- >- <Text style={styles.metricLabel} noMargin>- {metric.label}- </Text>- <Text style={styles.metricValue} noMargin>- {metric.value}- </Text>- {metric.trend ? (- <Badge- label={metric.trend}- size="sm"- variant={metric.tone ?? "info"}- />- ) : null}+ {[0, 2].map((startIndex) => (+ <View key={startIndex} style={styles.metricsRow}>+ {data.summary+ .slice(startIndex, startIndex + 2)+ .map((metric) => (+ <View+ key={metric.label}+ style={+ {+ ...styles.metricCard,+ borderLeftColor: metric.tone+ ? toneColor(theme, metric.tone)+ : accent,+ borderLeftWidth: 3,+ } as never+ }+ >+ <Text style={styles.metricLabel} noMargin>+ {metric.label}+ </Text>+ <Text style={styles.metricValue} noMargin>+ {metric.value}+ </Text>+ {metric.trend ? (+ <Badge+ label={metric.trend}+ size="sm"+ variant={metric.tone ?? "info"}+ style={{+ height: 16,+ width: metric.trend.endsWith("QoQ")+ ? metric.trend.length * 6.5 + 10+ : metric.trend.length * 5 + 18,+ }}+ />+ ) : null}+ </View>+ ))}</View>))}</View></Section>+ </View>+ </Page>- <Section padding="md" noWrap>- <Text variant="sm" transform="uppercase" color="mutedForeground">+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}>+ <Section+ padding="md"+ noWrap+ style={{+ position: "relative",+ top: sectionOffset[graphVariant],+ }}+ >+ <Text+ variant="sm"+ transform="uppercase"+ color="mutedForeground"+ style={{+ position: "relative",+ top: titleOffset[graphVariant],+ }}+ >Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={+ {+ ...styles.graphShell,+ paddingBottom: graphVariant === "horizontal-bar" ? 56 : 12,+ } as never+ }+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -215,7 +299,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -225,7 +309,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -258,7 +348,19 @@ export const ReportLayout = ({}}/></Section>+ </View>+ </Page>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -288,7 +390,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -298,27 +400,7 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap`- for concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section>-- <PageFooter- variant="three-column"- leftText="Confidential — Internal Use"- centerText="Generated with PDFx"- rightText="Page 1 of 1"- sticky- pagePadding={theme.spacing.page.marginLeft}- /></View></Page></Document>diff --git a/registry/bases/forme/blocks/report-security/report-layout.tsx b/registry/bases/forme/blocks/report-security/report-layout.tsxindex 1400d55..6114bce 100644--- a/registry/bases/forme/blocks/report-security/report-layout.tsx+++ b/registry/bases/forme/blocks/report-security/report-layout.tsx@@ -5,7 +5,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -13,7 +12,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -77,10 +75,42 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 181,+ donut: 191,+ "horizontal-bar": 148,+ line: 191,+ pie: 191,+ };+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 59,+ donut: -3,+ "horizontal-bar": -4,+ line: -30,+ pie: 0,+ };+ const sectionOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 32,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };+ const titleOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {- flex: 1,+ width: 225,},graphShell: {backgroundColor: theme.colors.background,@@ -91,13 +121,15 @@ export const ReportLayout = ({padding: 12,},metricCard: {+ alignItems: "flex-start",backgroundColor: theme.colors.background,borderColor: theme.colors.border,borderRadius: theme.primitives.borderRadius.md,borderStyle: "solid",borderWidth: 1,+ height: 75,padding: 8,- width: "48.6%",+ width: 225,},metricLabel: {color: theme.colors.mutedForeground,@@ -117,22 +149,22 @@ export const ReportLayout = ({marginBottom: 2,},metricsGrid: {+ flexDirection: "column",+ gap: 8,+ },+ metricsRow: {flexDirection: "row",- flexWrap: "wrap",gap: 8,},page: {backgroundColor: theme.colors.background,- paddingBottom: theme.spacing.page.marginBottom,- paddingLeft: theme.spacing.page.marginLeft,- paddingRight: theme.spacing.page.marginRight,- paddingTop: theme.spacing.page.marginTop,},toolbar: {alignItems: "center",flexDirection: "row",justifyContent: "space-between",marginBottom: 8,+ width: 499,},twoColumn: {alignItems: "flex-start",@@ -143,7 +175,15 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" margin={48}>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ /><View style={styles.page as never}><PageHeadervariant="two-column"@@ -166,44 +206,88 @@ export const ReportLayout = ({Executive Summary</Text><View style={styles.metricsGrid}>- {data.summary.map((metric) => (- <View- key={metric.label}- style={- [- styles.metricCard,- {- borderLeftColor: metric.tone- ? toneColor(theme, metric.tone)- : accent,- borderLeftWidth: 3,- },- ] as never- }- >- <Text style={styles.metricLabel} noMargin>- {metric.label}- </Text>- <Text style={styles.metricValue} noMargin>- {metric.value}- </Text>- {metric.trend ? (- <Badge- label={metric.trend}- size="sm"- variant={metric.tone ?? "info"}- />- ) : null}+ {[0, 2].map((startIndex) => (+ <View key={startIndex} style={styles.metricsRow}>+ {data.summary+ .slice(startIndex, startIndex + 2)+ .map((metric) => (+ <View+ key={metric.label}+ style={+ {+ ...styles.metricCard,+ borderLeftColor: metric.tone+ ? toneColor(theme, metric.tone)+ : accent,+ borderLeftWidth: 3,+ } as never+ }+ >+ <Text style={styles.metricLabel} noMargin>+ {metric.label}+ </Text>+ <Text style={styles.metricValue} noMargin>+ {metric.value}+ </Text>+ {metric.trend ? (+ <Badge+ label={metric.trend}+ size="sm"+ variant={metric.tone ?? "info"}+ style={{+ height: 16,+ width: metric.trend.endsWith("QoQ")+ ? metric.trend.length * 6.5 + 10+ : metric.trend.length * 5 + 18,+ }}+ />+ ) : null}+ </View>+ ))}</View>))}</View></Section>+ </View>+ </Page>- <Section padding="md" noWrap>- <Text variant="sm" transform="uppercase" color="mutedForeground">+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}>+ <Section+ padding="md"+ noWrap+ style={{+ position: "relative",+ top: sectionOffset[graphVariant],+ }}+ >+ <Text+ variant="sm"+ transform="uppercase"+ color="mutedForeground"+ style={{+ position: "relative",+ top: titleOffset[graphVariant],+ }}+ >Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={+ {+ ...styles.graphShell,+ paddingBottom: graphVariant === "horizontal-bar" ? 56 : 12,+ } as never+ }+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -215,7 +299,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -225,7 +309,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -258,7 +348,19 @@ export const ReportLayout = ({}}/></Section>+ </View>+ </Page>+ <Page size="A4" margin={{ bottom: 48, left: 48, right: 48, top: 56 }}>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ <View style={styles.page as never}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -288,7 +390,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -298,27 +400,7 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap`- for concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section>-- <PageFooter- variant="three-column"- leftText="Confidential — Internal Use"- centerText="Generated with PDFx"- rightText="Page 1 of 1"- sticky- pagePadding={theme.spacing.page.marginLeft}- /></View></Page></Document>diff --git a/registry/bases/forme/components/alert/alert.tsx b/registry/bases/forme/components/alert/alert.tsxindex ebb30e9..f98f9bd 100644--- a/registry/bases/forme/components/alert/alert.tsx+++ b/registry/bases/forme/components/alert/alert.tsx@@ -1,11 +1,15 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type { ReactNode } from "react";import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { Circle, Line, Path, Svg } from "../../lib/forme-svg";-import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";+import {+ mergePdfStyles,+ usePdfcnTheme,+ useSafeMemo,+} from "../../lib/pdfcn-theme-context";export type AlertVariant = "info" | "success" | "warning" | "error";@@ -235,7 +239,7 @@ export const PdfAlert = ({];return (- <View wrap={false} style={containerStyles as never}>+ <View wrap={false} style={mergePdfStyles(containerStyles)}>{showIcon && (<View style={styles.iconContainer}><AlertIcon variant={variant} color={styles.variantColors[variant]} />diff --git a/registry/bases/forme/components/badge/badge.tsx b/registry/bases/forme/components/badge/badge.tsxindex 326c300..9774e4d 100644--- a/registry/bases/forme/components/badge/badge.tsx+++ b/registry/bases/forme/components/badge/badge.tsx@@ -1,8 +1,7 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";diff --git a/registry/bases/forme/components/card/card.tsx b/registry/bases/forme/components/card/card.tsxindex cc2a987..97324f1 100644--- a/registry/bases/forme/components/card/card.tsx+++ b/registry/bases/forme/components/card/card.tsx@@ -1,9 +1,9 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type { ReactNode } from "react";import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";export type CardVariant = "default" | "bordered" | "muted";diff --git a/registry/bases/forme/components/data-table/data-table.tsx b/registry/bases/forme/components/data-table/data-table.tsxindex 890e584..dfdda2e 100644--- a/registry/bases/forme/components/data-table/data-table.tsx+++ b/registry/bases/forme/components/data-table/data-table.tsx@@ -1,7 +1,7 @@-import { Text as PDFText } from "@formepdf/react";-import type { Style } from "@formepdf/react";import { Fragment } from "react";+import { Text as PDFText } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import {Table,diff --git a/registry/bases/forme/components/divider/divider.tsx b/registry/bases/forme/components/divider/divider.tsxindex 0a5db83..8677920 100644--- a/registry/bases/forme/components/divider/divider.tsx+++ b/registry/bases/forme/components/divider/divider.tsx@@ -1,8 +1,7 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";diff --git a/registry/bases/forme/components/form/form.tsx b/registry/bases/forme/components/form/form.tsxindex c0c9544..4bf7d27 100644--- a/registry/bases/forme/components/form/form.tsx+++ b/registry/bases/forme/components/form/form.tsx@@ -1,6 +1,5 @@-import { Text as PDFText, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-+import { Text as PDFText, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { createFormStyles } from "./form.styles";import type {diff --git a/registry/bases/forme/components/graph/graph.tsx b/registry/bases/forme/components/graph/graph.tsxindex 07aac11..fde585d 100644--- a/registry/bases/forme/components/graph/graph.tsx+++ b/registry/bases/forme/components/graph/graph.tsx@@ -1,9 +1,9 @@-import { Text as PDFText, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type React from "react";import type { PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { Circle, G, Line, Path, Rect, Svg, SvgText } from "../../lib/forme-svg";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { createGraphStyles } from "./graph.styles";@@ -560,11 +560,226 @@ const renderAxisLabels = (</>);+const renderTextFallback = (+ variant: GraphProps["variant"],+ series: GraphSeries[],+ layout: ChartLayout,+ showValues: boolean,+ textColor: string+) => {+ if (variant === "pie" || variant === "donut") {+ const data = series[0]?.data ?? [];+ const total = data.reduce((sum, point) => sum + point.value, 0) || 1;+ const cx = layout.svgW / 2;+ const cy = layout.svgH / 2;+ const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;+ const labelRadius = radius * 1.18;+ let currentAngle = 0;++ return (+ <View+ style={{+ height: layout.svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: layout.svgW,+ }}+ >+ {data.map((point, index) => {+ const sweep = (point.value / total) * 360;+ const midAngle = currentAngle + sweep / 2;+ currentAngle += sweep;+ if (sweep <= 15) {+ return null;+ }+ const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);+ const onRight = labelPoint.x > cx;+ return (+ <PDFText+ key={`fallback-pie-${point.label}-${index}`}+ style={{+ color: textColor,+ fontSize: 7,+ left: onRight ? labelPoint.x : labelPoint.x - 60,+ lineHeight: 1,+ position: "absolute",+ textAlign: onRight ? "left" : "right",+ top: labelPoint.y - 4,+ width: 60,+ }}+ >+ {truncate(point.label, 10)}+ </PDFText>+ );+ })}+ </View>+ );+ }++ const {+ chartH,+ chartW,+ chartX,+ chartY,+ svgH,+ svgW,+ xLabels,+ yMax,+ yMin,+ yTicks,+ } = layout;+ const range = yMax - yMin || 1;+ const toY = (value: number) =>+ chartY + chartH - ((value - yMin) / range) * chartH;+ const labelStyle = {+ color: textColor,+ fontSize: 7,+ lineHeight: 1,+ position: "absolute" as const,+ };++ if (variant === "horizontal-bar") {+ const labelWidth = 60;+ const rowHeight = chartH / Math.max(xLabels.length, 1);+ const maxValue = Math.max(+ ...series.flatMap((item) => item.data.map((point) => point.value)),+ 1+ );++ return (+ <View+ style={{+ height: svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: svgW,+ }}+ >+ {xLabels.map((label, index) => {+ const value = series[0]?.data[index]?.value ?? 0;+ const barWidth = (value / maxValue) * (chartW - labelWidth);+ return (+ <View key={`fallback-horizontal-${label}`}>+ <PDFText+ style={{+ ...labelStyle,+ left: chartX,+ textAlign: "right",+ top: chartY + index * rowHeight + rowHeight / 2 - 4,+ width: labelWidth - 4,+ }}+ >+ {truncate(label, 14)}+ </PDFText>+ {showValues ? (+ <PDFText+ style={{+ ...labelStyle,+ color: textColor,+ fontSize: 6,+ left: chartX + labelWidth + barWidth + 3,+ top: chartY + index * rowHeight + rowHeight / 2 - 4,+ width: 28,+ }}+ >+ {fmtNum(value)}+ </PDFText>+ ) : null}+ </View>+ );+ })}+ </View>+ );+ }++ const pointX = (index: number) =>+ chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;+ const groupWidth = chartW / Math.max(xLabels.length, 1);+ const barGap = 2;+ const barWidth = Math.max(+ (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),+ 1+ );++ return (+ <View+ style={{+ height: svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: svgW,+ }}+ >+ {yTicks.map((tick) => (+ <PDFText+ key={`fallback-y-${tick}`}+ style={{+ ...labelStyle,+ left: 0,+ textAlign: "right",+ top: toY(tick) - 4,+ width: chartX - 4,+ }}+ >+ {fmtNum(tick)}+ </PDFText>+ ))}+ {(variant === "line" || variant === "area") &&+ xLabels.map((label, index) => (+ <PDFText+ key={`fallback-x-${label}`}+ style={{+ ...labelStyle,+ left: pointX(index) - 12,+ textAlign: "center",+ top: chartY + chartH + 3,+ width: 24,+ }}+ >+ {truncate(label, 8)}+ </PDFText>+ ))}+ {variant === "bar" &&+ showValues &&+ xLabels.flatMap((label, categoryIndex) =>+ series.map((item, seriesIndex) => {+ const value = item.data[categoryIndex]?.value ?? 0;+ const left =+ chartX ++ categoryIndex * groupWidth ++ barGap ++ seriesIndex * (barWidth + barGap);+ return (+ <PDFText+ key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}+ style={{+ ...labelStyle,+ fontSize: 6,+ left,+ textAlign: "center",+ top: toY(value) - 8,+ width: barWidth,+ }}+ >+ {fmtNum(value)}+ </PDFText>+ );+ })+ )}+ </View>+ );+};+const renderGraphContent = (title: string | undefined,subtitle: string | undefined,chartContent: React.ReactNode,+ chartLabels: React.ReactNode,axisLabels: React.ReactNode,+ textFallback: React.ReactNode,width: number,height: number,legend: string,@@ -578,20 +793,52 @@ const renderGraphContent = ({title && <PDFText style={styles.title}>{title}</PDFText>}{subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}<View style={legend === "right" ? styles.chartWithRightLegend : undefined}>- <Svg width={width} height={height}>- {chartContent}- {axisLabels}- </Svg>+ <View style={{ height, position: "relative", width }}>+ <Svg width={width} height={height}>+ {chartContent}+ {axisLabels}+ </Svg>+ {textFallback}+ </View>{showLegend &&legend === "right" &&Legend({ palette, position: "right", series, styles })}</View>+ {chartLabels}{showLegend &&legend === "bottom" &&Legend({ palette, position: "bottom", series, styles })}</>);+const renderBarLabels = (+ variant: GraphProps["variant"],+ series: GraphSeries[],+ chartX: number,+ chartW: number+) => {+ if (variant !== "bar") {+ return null;+ }++ return (+ <View+ style={{+ display: "flex",+ flexDirection: "row",+ marginLeft: chartX,+ width: chartW,+ }}+ >+ {(series[0]?.data ?? []).map((point) => (+ <View key={point.label} style={{ alignItems: "center", flex: 1 }}>+ <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>+ </View>+ ))}+ </View>+ );+};+/*** PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts* natively inside react-pdf documents using SVG primitives.@@ -684,6 +931,7 @@ export const PdfGraph = ({);const showLegend = legend !== "none" && !isPieOrDonut;+ const chartLabels = renderBarLabels(variant, series, chartX, chartW);const containerStyles: Style[] = [styles.container];if (style) {@@ -696,6 +944,7 @@ export const PdfGraph = ({title,subtitle,chartContent,+ chartLabels,renderAxisLabels(isPieOrDonut,xLabel,@@ -705,6 +954,13 @@ export const PdfGraph = ({height,theme.colors.mutedForeground),+ renderTextFallback(+ variant,+ series,+ layout,+ showValues,+ theme.colors.mutedForeground+ ),width,height,legend,diff --git a/registry/bases/forme/components/heading/heading.tsx b/registry/bases/forme/components/heading/heading.tsxindex 0af13e5..9415fbf 100644--- a/registry/bases/forme/components/heading/heading.tsx+++ b/registry/bases/forme/components/heading/heading.tsx@@ -1,9 +1,12 @@-import { StyleSheet, Text } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";-import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";+import { StyleSheet, Text } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";+import {+ mergePdfStyles,+ usePdfcnTheme,+ useSafeMemo,+} from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";export type HeadingWeight = "normal" | "medium" | "semibold" | "bold";@@ -172,5 +175,5 @@ export const Heading = ({if (style) {styleArray.push(...[style].flat());}- return <Text style={styleArray as never}>{children}</Text>;+ return <Text style={mergePdfStyles(styleArray)}>{children}</Text>;};diff --git a/registry/bases/forme/components/keep-together/keep-together.tsx b/registry/bases/forme/components/keep-together/keep-together.tsxindex 5722856..46b9fd3 100644--- a/registry/bases/forme/components/keep-together/keep-together.tsx+++ b/registry/bases/forme/components/keep-together/keep-together.tsx@@ -1,8 +1,9 @@-import { View } from "@formepdf/react";import type { ReactNode } from "react";import type { Style } from "@/registry/themes";+import { View } from "../../lib/forme-primitives";+export interface KeepTogetherProps {children?: ReactNode;minPresenceAhead?: number;diff --git a/registry/bases/forme/components/key-value/key-value.tsx b/registry/bases/forme/components/key-value/key-value.tsxindex 6464df5..7dcf779 100644--- a/registry/bases/forme/components/key-value/key-value.tsx+++ b/registry/bases/forme/components/key-value/key-value.tsx@@ -1,8 +1,7 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";@@ -75,7 +74,7 @@ const createKeyValueStyles = (t: PdfcnTheme) => {fontWeight: fontWeights.regular,};return StyleSheet.create({- container: { flexDirection: "column" },+ container: { flexDirection: "column", width: "100%" },divider: {borderBottomColor: c.border,borderBottomStyle: "solid",@@ -84,10 +83,16 @@ const createKeyValueStyles = (t: PdfcnTheme) => {keyLg: { ...keyBase, fontSize: t.primitives.typography.base },keyMd: { ...keyBase, fontSize: body.fontSize },keySm: { ...keyBase, fontSize: t.primitives.typography.xs },+ lastRowStretch: {+ borderBottomColor: "#ffffff",+ borderBottomStyle: "solid",+ borderBottomWidth: 0.01,+ },rowHorizontal: {alignItems: "flex-start",flexDirection: "row",paddingVertical: spacing[1],+ width: "100%",},rowVertical: {flexDirection: "column",@@ -159,21 +164,25 @@ export const KeyValue = ({if (direction === "horizontal") {const rowStyles: Style[] = [styles.rowHorizontal];- if (divided && !isLast) {- const dividerStyle: Style = {};- if (dividerColor) {- dividerStyle.borderBottomColor = resolveColor(- dividerColor,- theme.colors- );- }- if (dividerThickness) {- dividerStyle.borderBottomWidth = dividerThickness;- }- if (dividerMargin) {- dividerStyle.marginBottom = dividerMargin;+ if (divided) {+ if (isLast) {+ rowStyles.push(styles.lastRowStretch);+ } else {+ const dividerStyle: Style = {};+ if (dividerColor) {+ dividerStyle.borderBottomColor = resolveColor(+ dividerColor,+ theme.colors+ );+ }+ if (dividerThickness) {+ dividerStyle.borderBottomWidth = dividerThickness;+ }+ if (dividerMargin) {+ dividerStyle.marginBottom = dividerMargin;+ }+ rowStyles.push({ ...styles.divider, ...dividerStyle });}- rowStyles.push({ ...styles.divider, ...dividerStyle });}return (<View key={item.key} style={rowStyles as never}>diff --git a/registry/bases/forme/components/link/link.tsx b/registry/bases/forme/components/link/link.tsxindex ead86e4..c9e0978 100644--- a/registry/bases/forme/components/link/link.tsx+++ b/registry/bases/forme/components/link/link.tsx@@ -1,8 +1,11 @@-import { Link as PDFLink, StyleSheet } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import {+ Link as PDFLink,+ StyleSheet,+ Text as PDFText,+} from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";@@ -101,8 +104,10 @@ export const Link = ({styleArray.push(...[style].flat());}return (- <PDFLink href={href} style={styleArray as never}>- {children}- </PDFLink>+ <PDFText style={styleArray as never}>+ <PDFLink href={href} style={styleArray as never}>+ {children}+ </PDFLink>+ </PDFText>);};diff --git a/registry/bases/forme/components/list/list.styles.ts b/registry/bases/forme/components/list/list.styles.tsindex 5057807..a507b81 100644--- a/registry/bases/forme/components/list/list.styles.ts+++ b/registry/bases/forme/components/list/list.styles.ts@@ -26,11 +26,9 @@ export const createListStyles = (t: PdfcnTheme) => {backgroundColor: t.colors.success,borderColor: t.colors.success,},- checkMark: {- color: t.colors.background,- fontFamily: t.typography.body.fontFamily,- fontSize: 8,- fontWeight: fontWeights.bold,+ checklistTextWrap: {+ flex: 1,+ marginLeft: spacing[2],},childrenContainer: {display: "flex",diff --git a/registry/bases/forme/components/list/list.tsx b/registry/bases/forme/components/list/list.tsxindex cc3cf91..8a9f9b7 100644--- a/registry/bases/forme/components/list/list.tsx+++ b/registry/bases/forme/components/list/list.tsx@@ -1,7 +1,7 @@-import { Text as PDFText, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type React from "react";+import { Text as PDFText, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { createListStyles } from "./list.styles";import type { ListItem, ListVariant, PdfListProps } from "./list.types";@@ -103,10 +103,8 @@ const renderChecklistItem = (style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}] as never}- >- {isChecked ? <PDFText style={styles.checkMark}>✓</PDFText> : null}- </View>- <View style={styles.itemTextWrap}>+ ></View>+ <View style={styles.checklistTextWrap}><PDFText style={styles.itemText}>{item.text}</PDFText></View></View>diff --git a/registry/bases/forme/components/page-footer/page-footer.tsx b/registry/bases/forme/components/page-footer/page-footer.tsxindex 361ddbc..0151e9a 100644--- a/registry/bases/forme/components/page-footer/page-footer.tsx+++ b/registry/bases/forme/components/page-footer/page-footer.tsx@@ -1,17 +1,40 @@-import { Text as PDFText, StyleSheet, View, Fixed } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type React from "react";import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import {+ Fixed,+ Text as PDFText,+ StyleSheet,+ View,+} from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";-const wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {+const wrapFixed = (+ fixed: boolean | undefined,+ node: React.ReactElement,+ footerOffset = 0+) => {if (!fixed) {return node;}- return <Fixed position="footer">{node}</Fixed>;+ const nodeProps = node.props as {+ children?: React.ReactNode;+ style?: Style;+ };+ return (+ <Fixed+ position="footer"+ style={[+ nodeProps.style,+ footerOffset ? { marginBottom: -footerOffset } : undefined,+ ]}+ >+ {nodeProps.children}+ </Fixed>+ );};export type PageFooterVariant =| "simple"@@ -162,6 +185,17 @@ const createPageFooterStyles = (t: PdfcnTheme) => {justifyContent: "space-between",paddingTop: spacing[3],},+ simpleTextCenter: {+ ...textBase,+ textAlign: "center",+ },+ simpleTextLeft: {+ ...textBase,+ },+ simpleTextRight: {+ ...textBase,+ textAlign: "right",+ },textBranded: {...textBase,color: c.primaryForeground,@@ -389,14 +423,7 @@ export const PageFooter = ({const resolvedTextColor = textColor? resolveColor(textColor, theme.colors): undefined;- const stickyStyle: Style = sticky- ? {- bottom: pagePadding,- left: pagePadding,- position: "absolute",- right: pagePadding,- }- : {};+ const stickyStyle: Style = {};const applyOverrides = (base: Style[]): Style[] => {if (background) {@@ -461,9 +488,18 @@ export const PageFooter = ({renderSimple(styles,applyOverrides([styles.simpleContainer, { marginTop: mt }]),- applyTextColor([styles.textLeft], resolvedTextColor),- applyTextColor([styles.textCenter], resolvedTextColor),- applyTextColor([styles.textRight], resolvedTextColor),+ applyTextColor(+ [styles.simpleTextLeft, { width: centerText ? 160 : 360 }],+ resolvedTextColor+ ),+ applyTextColor(+ [styles.simpleTextCenter, { width: 160 }],+ resolvedTextColor+ ),+ applyTextColor(+ [styles.simpleTextRight, { width: centerText ? 160 : 120 }],+ resolvedTextColor+ ),leftText,centerText,rightText,@@ -486,5 +522,9 @@ export const PageFooter = ({),};- return wrapFixed(_isFixed, variantRenderers[variant]() as React.ReactElement);+ return wrapFixed(+ _isFixed,+ variantRenderers[variant]() as React.ReactElement,+ sticky ? Math.max(theme.spacing.page.marginBottom - pagePadding, 0) : 0+ );};diff --git a/registry/bases/forme/components/page-header/page-header.tsx b/registry/bases/forme/components/page-header/page-header.tsxindex e8744e8..856657b 100644--- a/registry/bases/forme/components/page-header/page-header.tsx+++ b/registry/bases/forme/components/page-header/page-header.tsx@@ -1,10 +1,15 @@-import { Text as PDFText, StyleSheet, View, Fixed } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type React from "react";import type { ReactNode } from "react";import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import {+ Fixed,+ Text as PDFText,+ StyleSheet,+ View,+} from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";@@ -86,6 +91,7 @@ const createPageHeaderStyles = (t: PdfcnTheme) => {},logoContainer: {+ flexShrink: 0,height: 48,marginRight: spacing[4],width: 48,@@ -95,6 +101,7 @@ const createPageHeaderStyles = (t: PdfcnTheme) => {display: "flex",flex: 1,flexDirection: "column",+ paddingLeft: spacing[4],},logoLeftContainer: {alignItems: "center",@@ -123,6 +130,7 @@ const createPageHeaderStyles = (t: PdfcnTheme) => {},logoRightLogoContainer: {+ flexShrink: 0,height: 48,marginLeft: spacing[4],width: 48,diff --git a/registry/bases/forme/components/page-number/page-number.tsx b/registry/bases/forme/components/page-number/page-number.tsxindex 3895331..2a5fbc9 100644--- a/registry/bases/forme/components/page-number/page-number.tsx+++ b/registry/bases/forme/components/page-number/page-number.tsx@@ -1,8 +1,7 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";export type PageNumberAlign = "left" | "center" | "right";diff --git a/registry/bases/forme/components/pdf-image/pdf-image.tsx b/registry/bases/forme/components/pdf-image/pdf-image.tsxindex a6dede2..b1c1b67 100644--- a/registry/bases/forme/components/pdf-image/pdf-image.tsx+++ b/registry/bases/forme/components/pdf-image/pdf-image.tsx@@ -1,8 +1,12 @@-import { Image, Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PdfcnTheme } from "@/registry/themes";+import {+ Image,+ Text as PDFText,+ StyleSheet,+ View,+} from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";/** HTTP method used when fetching the image from a URL. */diff --git a/registry/bases/forme/components/qrcode/qrcode.tsx b/registry/bases/forme/components/qrcode/qrcode.tsxindex 13b600f..98976b9 100644--- a/registry/bases/forme/components/qrcode/qrcode.tsx+++ b/registry/bases/forme/components/qrcode/qrcode.tsx@@ -1,9 +1,9 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import QRCode from "qrcode";import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { Rect, Svg } from "../../lib/forme-svg";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";diff --git a/registry/bases/forme/components/section/section.tsx b/registry/bases/forme/components/section/section.tsxindex 700ee79..d840d52 100644--- a/registry/bases/forme/components/section/section.tsx+++ b/registry/bases/forme/components/section/section.tsx@@ -1,9 +1,12 @@-import { StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";-import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";+import { StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";+import {+ mergePdfStyles,+ usePdfcnTheme,+ useSafeMemo,+} from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";export type SectionSpacing = "none" | "sm" | "md" | "lg" | "xl";@@ -137,7 +140,7 @@ export const Section = ({styleArray.push(...[style].flat());}return (- <View wrap={noWrap ? false : undefined} style={styleArray as never}>+ <View wrap={noWrap ? false : undefined} style={mergePdfStyles(styleArray)}>{children}</View>);diff --git a/registry/bases/forme/components/signature/signature.tsx b/registry/bases/forme/components/signature/signature.tsxindex ccbd777..ec32be9 100644--- a/registry/bases/forme/components/signature/signature.tsx+++ b/registry/bases/forme/components/signature/signature.tsx@@ -1,8 +1,7 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PdfcnTheme } from "@/registry/themes";+import { Text as PDFText, StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";export type SignatureVariant = "single" | "double" | "inline";diff --git a/registry/bases/forme/components/stack/stack.tsx b/registry/bases/forme/components/stack/stack.tsxindex 79f86ef..4f4860d 100644--- a/registry/bases/forme/components/stack/stack.tsx+++ b/registry/bases/forme/components/stack/stack.tsx@@ -1,8 +1,7 @@-import { StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import { StyleSheet, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";export type StackGap = "none" | "sm" | "md" | "lg" | "xl";diff --git a/registry/bases/forme/components/table/table.tsx b/registry/bases/forme/components/table/table.tsxindex 4e36c1d..0ff533d 100644--- a/registry/bases/forme/components/table/table.tsx+++ b/registry/bases/forme/components/table/table.tsx@@ -1,8 +1,8 @@-import { Text as PDFText, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import { Children, cloneElement, isValidElement } from "react";import type { ReactElement, ReactNode } from "react";+import { Text as PDFText, View } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";import { createTableStyles } from "./table.styles";import type {diff --git a/registry/bases/forme/components/text/text.tsx b/registry/bases/forme/components/text/text.tsxindex 5ba6401..be1778c 100644--- a/registry/bases/forme/components/text/text.tsx+++ b/registry/bases/forme/components/text/text.tsx@@ -1,9 +1,12 @@-import { Text as PDFText, StyleSheet } from "@formepdf/react";-import type { Style } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";-import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";+import { Text as PDFText, StyleSheet } from "../../lib/forme-primitives";+import type { Style } from "../../lib/forme-primitives";+import {+ mergePdfStyles,+ usePdfcnTheme,+ useSafeMemo,+} from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";export type TextVariant = "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl";@@ -139,5 +142,5 @@ export const Text = ({if (style) {styleArray.push(...[style].flat());}- return <PDFText style={styleArray as never}>{children}</PDFText>;+ return <PDFText style={mergePdfStyles(styleArray)}>{children}</PDFText>;};diff --git a/registry/bases/forme/components/watermark/watermark.tsx b/registry/bases/forme/components/watermark/watermark.tsxindex a10f607..aa7ed35 100644--- a/registry/bases/forme/components/watermark/watermark.tsx+++ b/registry/bases/forme/components/watermark/watermark.tsx@@ -1,9 +1,9 @@-import { Text as PDFText, StyleSheet, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";+import { Watermark as FormeWatermark } from "@formepdf/react";-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";+import type { PDFComponentProps } from "@/registry/themes";-import { usePdfcnTheme, useSafeMemo } from "../../lib/pdfcn-theme-context";+import { mergeFormeStyles } from "../../lib/forme-primitives";+import { usePdfcnTheme } from "../../lib/pdfcn-theme-context";import { resolveColor } from "../../lib/resolve-color";export type WatermarkPosition =@@ -32,54 +32,14 @@ export interface PdfWatermarkProps extends Omit<PDFComponentProps, "children"> {children?: never;}-const createWatermarkStyles = (t: PdfcnTheme) => {- const { fontWeights } = t.primitives;- // Use page margins as corner insets so watermark position adapts to the active theme.- const { marginTop, marginBottom, marginLeft, marginRight } = t.spacing.page;- return StyleSheet.create({- container: {- alignItems: "center",- bottom: 0,- justifyContent: "center",- left: 0,- pointerEvents: "none",- position: "absolute",- right: 0,- top: 0,- zIndex: -1,- },- positionBottomLeft: {- alignItems: "flex-start",- justifyContent: "flex-end",- paddingBottom: marginBottom,- paddingLeft: marginLeft,- },- positionBottomRight: {- alignItems: "flex-end",- justifyContent: "flex-end",- paddingBottom: marginBottom,- paddingRight: marginRight,- },- positionCenter: { alignItems: "center", justifyContent: "center" },- positionTopLeft: {- alignItems: "flex-start",- justifyContent: "flex-start",- paddingLeft: marginLeft,- paddingTop: marginTop,- },- positionTopRight: {- alignItems: "flex-end",- justifyContent: "flex-start",- paddingRight: marginRight,- paddingTop: marginTop,- },- text: {- fontFamily: t.typography.heading.fontFamily,- fontWeight: fontWeights.bold,- letterSpacing: 4,- textTransform: "uppercase",- },- });+const withOpacity = (color: string, opacity: number): string => {+ const match = color.match(/^#([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);+ if (!match) {+ return color;+ }++ const [, red, green, blue] = match;+ return `rgba(${Number.parseInt(red, 16)}, ${Number.parseInt(green, 16)}, ${Number.parseInt(blue, 16)}, ${opacity})`;};export const PdfWatermark = ({@@ -88,34 +48,18 @@ export const PdfWatermark = ({fontSize = 60,color = "mutedForeground",angle = -45,- position = "center",style,}: PdfWatermarkProps) => {const theme = usePdfcnTheme();- const styles = useSafeMemo(() => createWatermarkStyles(theme), [theme]);- const positionMap: Record<WatermarkPosition, Style> = {- "bottom-left": styles.positionBottomLeft,- "bottom-right": styles.positionBottomRight,- center: styles.positionCenter,- "top-left": styles.positionTopLeft,- "top-right": styles.positionTopRight,- };- const containerStyles: Style[] = [styles.container, positionMap[position]];- if (style) {- containerStyles.push(...[style].flat());- }- const textStyles: Style[] = [- styles.text,- {- color: resolveColor(color, theme.colors),- fontSize,- opacity,- transform: `rotate(${angle}deg)`,- },- ];+ const resolvedColor = resolveColor(color, theme.colors);+return (- <View style={containerStyles as never}>- <PDFText style={textStyles as never}>{text}</PDFText>- </View>+ <FormeWatermark+ text={text}+ angle={angle}+ color={withOpacity(resolvedColor, opacity)}+ fontSize={fontSize}+ style={mergeFormeStyles(style)}+ />);};diff --git a/registry/bases/forme/lib/forme-primitives.tsx b/registry/bases/forme/lib/forme-primitives.tsxnew file mode 100644index 0000000..b8fa469--- /dev/null+++ b/registry/bases/forme/lib/forme-primitives.tsx@@ -0,0 +1,68 @@+import {+ Fixed as FormeFixed,+ Image as FormeImage,+ Link as FormeLink,+ StyleSheet,+ Text as FormeText,+ View as FormeView,+} from "@formepdf/react";+import type {+ FixedProps,+ ImageProps,+ LinkProps,+ Style,+ TextProps,+ ViewProps,+} from "@formepdf/react";++export type FormeStyleInput =+ | Style+ | false+ | null+ | undefined+ | readonly FormeStyleInput[];++export const mergeFormeStyles = (input: FormeStyleInput): Style | undefined => {+ if (!input) {+ return undefined;+ }++ if (!Array.isArray(input)) {+ return input as Style;+ }++ const merged: Style = {};+ for (const entry of input) {+ const resolved = mergeFormeStyles(entry);+ if (resolved) {+ Object.assign(merged, resolved);+ }+ }++ return Object.keys(merged).length > 0 ? merged : undefined;+};++type WithStyle<T> = Omit<T, "style"> & { style?: FormeStyleInput };++export const View = ({ style, ...props }: WithStyle<ViewProps>) => (+ <FormeView {...props} style={mergeFormeStyles(style)} />+);++export const Text = ({ style, ...props }: WithStyle<TextProps>) => (+ <FormeText {...props} style={mergeFormeStyles(style)} />+);++export const Link = ({ style, ...props }: WithStyle<LinkProps>) => (+ <FormeLink {...props} style={mergeFormeStyles(style)} />+);++export const Image = ({ style, ...props }: WithStyle<ImageProps>) => (+ <FormeImage {...props} style={mergeFormeStyles(style)} />+);++export const Fixed = ({ style, ...props }: WithStyle<FixedProps>) => (+ <FormeFixed {...props} style={mergeFormeStyles(style)} />+);++export { StyleSheet };+export type { Style };diff --git a/registry/bases/forme/lib/forme-svg.tsx b/registry/bases/forme/lib/forme-svg.tsxindex 10713da..85563ae 100644--- a/registry/bases/forme/lib/forme-svg.tsx+++ b/registry/bases/forme/lib/forme-svg.tsx@@ -1,5 +1,11 @@import { Svg as FormeSvg } from "@formepdf/react";-import { createElement } from "react";+import {+ Children,+ Fragment,+ cloneElement,+ createElement,+ isValidElement,+} from "react";import type { ReactNode, CSSProperties } from "react";type AnyProps = Record<string, unknown> & {@@ -7,6 +13,71 @@ type AnyProps = Record<string, unknown> & {style?: CSSProperties;};+const SVG_ATTRIBUTE_NAMES: Record<string, string> = {+ className: "class",+ dominantBaseline: "dominant-baseline",+ fillOpacity: "fill-opacity",+ fontFamily: "font-family",+ fontSize: "font-size",+ fontStyle: "font-style",+ fontWeight: "font-weight",+ strokeDasharray: "stroke-dasharray",+ strokeLinecap: "stroke-linecap",+ strokeLinejoin: "stroke-linejoin",+ strokeOpacity: "stroke-opacity",+ strokeWidth: "stroke-width",+ textAnchor: "text-anchor",+};++const normalizeSvgProps = (props: AnyProps): AnyProps => {+ const normalized: AnyProps = {};++ for (const [name, value] of Object.entries(props)) {+ if (value === undefined) {+ continue;+ }++ if (name === "style" && value && typeof value === "object") {+ for (const [styleName, styleValue] of Object.entries(value)) {+ normalized[SVG_ATTRIBUTE_NAMES[styleName] ?? styleName] = styleValue;+ }+ continue;+ }++ normalized[SVG_ATTRIBUTE_NAMES[name] ?? name] = value;+ }++ return normalized;+};++const resolveSvgChildren = (children: ReactNode): ReactNode =>+ Children.map(children, (child) => {+ if (!isValidElement<AnyProps>(child)) {+ return child;+ }++ if (typeof child.type === "function") {+ const resolved = (child.type as (props: AnyProps) => ReactNode)(+ child.props+ );+ return resolveSvgChildren(resolved);+ }++ if ((child.type as unknown) === Fragment) {+ return resolveSvgChildren(child.props.children);+ }++ if (child.props.children === undefined) {+ return child;+ }++ return cloneElement(+ child,+ undefined,+ resolveSvgChildren(child.props.children)+ );+ });+export const Svg = ({children,width,@@ -22,13 +93,22 @@ export const Svg = ({style={style as never}{...rest}>- {children}+ {resolveSvgChildren(children)}</FormeSvg>);-export const Circle = (props: AnyProps) => createElement("circle", props);-export const Rect = (props: AnyProps) => createElement("rect", props);-export const G = (props: AnyProps) => createElement("g", props);-export const Line = (props: AnyProps) => createElement("line", props);-export const Path = (props: AnyProps) => createElement("path", props);-export const SvgText = (props: AnyProps) => createElement("text", props);+export const Circle = (props: AnyProps) =>+ createElement("circle", normalizeSvgProps(props));+export const Rect = (props: AnyProps) =>+ createElement("rect", normalizeSvgProps(props));+export const G = (props: AnyProps) =>+ createElement("g", normalizeSvgProps(props));+export const Line = (props: AnyProps) =>+ createElement("line", normalizeSvgProps(props));+export const Path = (props: AnyProps) =>+ createElement("path", normalizeSvgProps(props));+export const SvgText = (props: AnyProps) =>+ createElement(+ "text",+ normalizeSvgProps({ fontFamily: "sans-serif", ...props })+ );diff --git a/registry/bases/forme/lib/maybe-fixed.tsx b/registry/bases/forme/lib/maybe-fixed.tsxindex 1b67883..d3d66c3 100644--- a/registry/bases/forme/lib/maybe-fixed.tsx+++ b/registry/bases/forme/lib/maybe-fixed.tsx@@ -1,7 +1,8 @@-import { Fixed, View } from "@formepdf/react";-import type { Style } from "@formepdf/react";import type { ReactNode } from "react";+import { Fixed, View } from "./forme-primitives";+import type { Style } from "./forme-primitives";+export const MaybeFixed = ({fixed,position,diff --git a/registry/bases/forme/lib/pdfcn-theme-context.tsx b/registry/bases/forme/lib/pdfcn-theme-context.tsxindex 42fc442..a86f43b 100644--- a/registry/bases/forme/lib/pdfcn-theme-context.tsx+++ b/registry/bases/forme/lib/pdfcn-theme-context.tsx@@ -1,82 +1,71 @@-"use client";-/* eslint-disable react-refresh/only-export-components */-// Exports both a component (PdfcnThemeProvider) and hooks/context intentionally.+// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.// All PDF components import from a single file — splitting would break the public API.-import * as React from "react";-import { createContext, useContext } from "react";+import type { Style } from "@formepdf/react";+import { isValidElement } from "react";import type { DependencyList, ReactNode } from "react";import { theme as defaultTheme } from "./pdfcn-theme";export type PdfcnTheme = typeof defaultTheme;-export const PdfcnThemeContext = createContext<PdfcnTheme>(defaultTheme);+let serializedTheme = defaultTheme;export interface PdfcnThemeProviderProps {theme?: PdfcnTheme;children: ReactNode;}-/**- * Detect whether React currently has an active dispatcher.- * When components are invoked as plain functions in tests, dispatcher is null.- */-const hasActiveDispatcher = (): boolean => {- const maybeInternals = React as unknown as {- __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?: {- H?: unknown;- };- };+type PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;- const dispatcher =- maybeInternals- .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.H;- return dispatcher != null;+const mergeStyleInput = (target: Style, input: PdfStyleInput): void => {+ if (Array.isArray(input)) {+ for (const item of input) {+ mergeStyleInput(target, item);+ }+ } else if (input) {+ Object.assign(target, input);+ }};-export const PdfcnThemeProvider = ({- theme,- children,-}: PdfcnThemeProviderProps) => (- <PdfcnThemeContext.Provider value={theme ?? defaultTheme}>- {children}- </PdfcnThemeContext.Provider>-);+/** Flattens React-PDF-style arrays into the object Forme serializes. */+export const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {+ const merged: Style = {};+ for (const input of inputs) {+ mergeStyleInput(merged, input);+ }+ return merged;+};/**- * Regex patterns that indicate a hook was called outside a valid React render tree.- * These errors are caught and suppressed so components fall back to safe defaults.+ * Forme serializes function components directly instead of mounting a React+ * tree. Resolve the provider's child so <Document> remains the top-level node.*/-const HOOK_ERROR_PATTERNS =- /invalid hook call|minified react error #321|useContext|useMemo|cannot read properties of null|dispatcher|renderWithHooks|resolveDispatcher|hooks can only be called|rendered fewer hooks/i;+const renderForSerializer = (+ children: ReactNode,+ theme: PdfcnTheme+): ReactNode => {+ serializedTheme = theme;-/**- * Calls a React hook with a graceful fallback for non-render environments (e.g. unit tests).- * Uses hasActiveDispatcher() as the primary guard; the try/catch is a safety net for edge- * cases where the dispatcher check passes but the hook still cannot execute.- */-const callHook = <T,>(hook: () => T, fallback: T): T => {- if (!hasActiveDispatcher()) {- return fallback;+ if (!isValidElement(children) || typeof children.type !== "function") {+ return children;}- try {- return hook();- } catch (error) {- if (error instanceof Error && HOOK_ERROR_PATTERNS.test(error.message)) {- return fallback;- }- throw error;+ if ((children.type as { __formeType?: string }).__formeType === "Document") {+ return children;}++ return (children.type as (props: unknown) => ReactNode)(children.props);};-/**- * Returns the active PdfcnTheme from context, or the default theme when called- * outside a React render tree (e.g. unit tests).- */-export const usePdfcnTheme = (): PdfcnTheme =>- callHook(() => useContext(PdfcnThemeContext), defaultTheme);+export const PdfcnThemeProvider = ({+ theme,+ children,+}: PdfcnThemeProviderProps) =>+ renderForSerializer(children, theme ?? defaultTheme);++/** Returns the theme selected by the nearest serialized provider. */+export const usePdfcnTheme = (): PdfcnTheme => serializedTheme;/*** Calls factory() and returns the result.diff --git a/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx b/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsxindex 0820d32..5697eb6 100644--- a/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx+++ b/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx@@ -26,9 +26,9 @@ const sampleData: InvoiceClassicData = {name: "Client Corp.",phone: "+1 (555) 123-4567",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 17, 2026",invoiceDate: "February 17, 2026",invoiceNumber: "INV-2026-001",@@ -44,7 +44,7 @@ const sampleData: InvoiceClassicData = {gst: "GSTIN 123456789",method: "UPI / Card / Bank Transfer",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 36_250,tax: 2537.5,@@ -58,8 +58,11 @@ const InvoiceClassicContent = ({ data }: { data: InvoiceClassicData }) => {const styles = StyleSheet.create({page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},});diff --git a/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx b/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsxindex 35732af..3e1a026 100644--- a/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx+++ b/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx@@ -23,10 +23,10 @@ const sampleData: InvoiceConsultantData = {email: "[email protected]",name: "Sarah Johnson",},- companyAddress: "City, Country · [email protected]",- companyName: "Your Consulting",+ companyAddress: "Nagpur, IN · [email protected]",+ companyName: "PDFx Inc.",consultant: {- email: "[email protected]",+ email: "[email protected]",name: "John Smith",title: "Senior Technical Consultant",},@@ -48,9 +48,9 @@ const sampleData: InvoiceConsultantData = {],subtitle: "Professional Consulting Services",summary: {- subtotal: 10_300,- tax: 515,- total: 10_815,+ subtotal: 9500,+ tax: 475,+ total: 9975,totalHours: 60,},};@@ -102,8 +102,11 @@ const InvoiceConsultantContent = ({},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},partiesRow: {flexDirection: "row",diff --git a/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx b/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsxindex 4becbd8..263659d 100644--- a/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx+++ b/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx@@ -24,9 +24,9 @@ const sampleData: InvoiceCorporateData = {name: "Global Industries Ltd.",phone: "+1 (555) 888-9999",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 24, 2026",invoiceDate: "February 22, 2026",invoiceNumber: "INV-2026-004",@@ -37,21 +37,26 @@ const sampleData: InvoiceCorporateData = {unitPrice: 4500,},{ description: "Implementation Services", quantity: 1, unitPrice: 18_000 },- { description: "Training Workshop", quantity: 3, unitPrice: 2500 },+ {+ description: "Training Workshop (per session)",+ quantity: 3,+ unitPrice: 2500,+ },{ description: "Annual Support Package", quantity: 1, unitPrice: 8500 },],logo: "/favicon.png",- notes: "Corporate billing – Net 30 terms apply.",+ notes:+ "Corporate billing – Net 30 terms apply. For inquiries, contact [email protected]",paymentTerms: {dueDate: "March 24, 2026",gst: "GSTIN 987654321",method: "Wire Transfer / Corporate Account",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {- subtotal: 57_000,- tax: 4560,- total: 61_560,+ subtotal: 56_500,+ tax: 4520,+ total: 61_020,},};@@ -77,8 +82,11 @@ const InvoiceCorporateContent = ({ data }: { data: InvoiceCorporateData }) => {},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},summaryCard: {backgroundColor: theme.colors.muted,diff --git a/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx b/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsxindex 484f69d..c1e0144 100644--- a/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx+++ b/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx@@ -24,8 +24,8 @@ const sampleData: InvoiceCreativeData = {name: "Creative Agency Co.",phone: "+1 (555) 321-7654",},- companyAddress: "City, Country · [email protected]",- companyName: "Your Agency",+ companyAddress: "Nagpur, IN · [email protected]",+ companyName: "PDFx Inc.",dueDate: "March 26, 2026",invoiceDate: "February 24, 2026",invoiceNumber: "INV-2026-005",@@ -50,7 +50,7 @@ const sampleData: InvoiceCreativeData = {gst: "GSTIN 456789123",method: "Credit Card / PayPal / Stripe",},- subtitle: "Creative Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 22_700,tax: 1475.5,@@ -106,8 +106,11 @@ const InvoiceCreativeContent = ({ data }: { data: InvoiceCreativeData }) => {},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},sectionLabel: {color: theme.colors.accent,diff --git a/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx b/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsxindex 16f1a6a..0f85a43 100644--- a/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx+++ b/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx@@ -25,14 +25,14 @@ const sampleData: InvoiceMinimalData = {name: "Enterprise Corp",phone: "+1 (555) 246-8135",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 22, 2026",invoiceDate: "February 20, 2026",invoiceNumber: "INV-2026-003",items: [- { description: "Annual Licenselan", quantity: 1, unitPrice: 25_000 },+ { description: "Annual License Plan", quantity: 1, unitPrice: 25_000 },{ description: "Support & Maintenance", quantity: 12, unitPrice: 1500 },{ description: "Custom Integration", quantity: 1, unitPrice: 12_000 },],@@ -43,7 +43,7 @@ const sampleData: InvoiceMinimalData = {gst: "GSTIN 123456789",method: "ACH Transfer / Check",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 55_000,tax: 3850,@@ -78,8 +78,11 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},});@@ -139,7 +142,7 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {</View></Section><View style={styles.infoRow}>- <View style={{ flex: 1, paddingRight: 20 }}>+ <View style={{ paddingRight: 20, width: "50%" }}><Text style={styles.infoLabel} noMargin>Bill To</Text>@@ -156,7 +159,7 @@ const InvoiceMinimalContent = ({ data }: { data: InvoiceMinimalData }) => {{data.billTo.phone}</Text></View>- <View style={{ flex: 1 }}>+ <View style={{ width: "50%" }}><Text style={styles.infoLabel} noMargin>Invoice Details</Text>diff --git a/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx b/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsxindex 4f14b39..52ff204 100644--- a/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx+++ b/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx@@ -25,9 +25,9 @@ const sampleData: InvoiceModernData = {name: "TechStart Solutions",phone: "+1 (555) 987-6543",},- companyAddress: "City, Country",- companyEmail: "[email protected]",- companyName: "Your Company",+ companyAddress: "Nagpur, IN",+ companyEmail: "[email protected]",+ companyName: "PDFx Inc.",dueDate: "March 20, 2026",invoiceDate: "February 18, 2026",invoiceNumber: "INV-2026-002",@@ -42,7 +42,7 @@ const sampleData: InvoiceModernData = {gst: "GSTIN 123456789",method: "Wire Transfer / Bank Account",},- subtitle: "Professional Services",+ subtitle: "Innovative PDF Solutions",summary: {subtotal: 33_200,tax: 2324,@@ -81,8 +81,11 @@ const InvoiceModernContent = ({ data }: { data: InvoiceModernData }) => {},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,padding: theme.spacing.page.marginTop,paddingBottom: theme.spacing.page.marginBottom,+ position: "relative",},});diff --git a/registry/bases/takumi/blocks/report-financial/report-layout.tsx b/registry/bases/takumi/blocks/report-financial/report-layout.tsxindex bdff8f5..d6ed753 100644--- a/registry/bases/takumi/blocks/report-financial/report-layout.tsx+++ b/registry/bases/takumi/blocks/report-financial/report-layout.tsx@@ -3,7 +3,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -11,7 +10,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -76,7 +74,30 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);-+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 31,+ donut: 65,+ "horizontal-bar": -2,+ line: -31,+ pie: 0,+ };+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 184,+ donut: 193,+ "horizontal-bar": 163,+ line: 195,+ pie: 191,+ };+ const graphOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {flex: 1,@@ -122,10 +143,16 @@ export const ReportLayout = ({},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,paddingBottom: theme.spacing.page.marginBottom,paddingLeft: theme.spacing.page.marginLeft,paddingRight: theme.spacing.page.marginRight,paddingTop: theme.spacing.page.marginTop,+ position: "relative",+ },+ pageBreak: {+ breakAfter: "page",},toolbar: {alignItems: "center",@@ -142,7 +169,7 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" style={styles.page}>+ <Page size="A4" style={[styles.page, styles.pageBreak]}><PageHeadervariant="two-column"title={data.title}@@ -195,11 +222,37 @@ export const ReportLayout = ({</View></Section>- <Section padding="md" noWrap>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={[styles.page, styles.pageBreak]}>+ <Section+ padding="md"+ noWrap+ style={+ graphVariant === "horizontal-bar" ? { marginTop: -6 } : undefined+ }+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={[+ styles.graphShell,+ {+ marginTop: graphVariant === "horizontal-bar" ? 34 : 0,+ position: "relative",+ top: graphOffset[graphVariant],+ },+ ]}+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -211,7 +264,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -221,7 +274,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -255,6 +314,17 @@ export const ReportLayout = ({/></Section>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={styles.page}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -284,7 +354,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -294,17 +364,6 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap` for- concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section><PageFooterdiff --git a/registry/bases/takumi/blocks/report-marketing/report-layout.tsx b/registry/bases/takumi/blocks/report-marketing/report-layout.tsxindex bdff8f5..d6ed753 100644--- a/registry/bases/takumi/blocks/report-marketing/report-layout.tsx+++ b/registry/bases/takumi/blocks/report-marketing/report-layout.tsx@@ -3,7 +3,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -11,7 +10,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -76,7 +74,30 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);-+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 31,+ donut: 65,+ "horizontal-bar": -2,+ line: -31,+ pie: 0,+ };+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 184,+ donut: 193,+ "horizontal-bar": 163,+ line: 195,+ pie: 191,+ };+ const graphOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {flex: 1,@@ -122,10 +143,16 @@ export const ReportLayout = ({},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,paddingBottom: theme.spacing.page.marginBottom,paddingLeft: theme.spacing.page.marginLeft,paddingRight: theme.spacing.page.marginRight,paddingTop: theme.spacing.page.marginTop,+ position: "relative",+ },+ pageBreak: {+ breakAfter: "page",},toolbar: {alignItems: "center",@@ -142,7 +169,7 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" style={styles.page}>+ <Page size="A4" style={[styles.page, styles.pageBreak]}><PageHeadervariant="two-column"title={data.title}@@ -195,11 +222,37 @@ export const ReportLayout = ({</View></Section>- <Section padding="md" noWrap>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={[styles.page, styles.pageBreak]}>+ <Section+ padding="md"+ noWrap+ style={+ graphVariant === "horizontal-bar" ? { marginTop: -6 } : undefined+ }+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={[+ styles.graphShell,+ {+ marginTop: graphVariant === "horizontal-bar" ? 34 : 0,+ position: "relative",+ top: graphOffset[graphVariant],+ },+ ]}+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -211,7 +264,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -221,7 +274,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -255,6 +314,17 @@ export const ReportLayout = ({/></Section>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={styles.page}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -284,7 +354,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -294,17 +364,6 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap` for- concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section><PageFooterdiff --git a/registry/bases/takumi/blocks/report-operations/report-layout.tsx b/registry/bases/takumi/blocks/report-operations/report-layout.tsxindex bdff8f5..d6ed753 100644--- a/registry/bases/takumi/blocks/report-operations/report-layout.tsx+++ b/registry/bases/takumi/blocks/report-operations/report-layout.tsx@@ -3,7 +3,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -11,7 +10,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -76,7 +74,30 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);-+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 31,+ donut: 65,+ "horizontal-bar": -2,+ line: -31,+ pie: 0,+ };+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 184,+ donut: 193,+ "horizontal-bar": 163,+ line: 195,+ pie: 191,+ };+ const graphOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {flex: 1,@@ -122,10 +143,16 @@ export const ReportLayout = ({},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,paddingBottom: theme.spacing.page.marginBottom,paddingLeft: theme.spacing.page.marginLeft,paddingRight: theme.spacing.page.marginRight,paddingTop: theme.spacing.page.marginTop,+ position: "relative",+ },+ pageBreak: {+ breakAfter: "page",},toolbar: {alignItems: "center",@@ -142,7 +169,7 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" style={styles.page}>+ <Page size="A4" style={[styles.page, styles.pageBreak]}><PageHeadervariant="two-column"title={data.title}@@ -195,11 +222,37 @@ export const ReportLayout = ({</View></Section>- <Section padding="md" noWrap>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={[styles.page, styles.pageBreak]}>+ <Section+ padding="md"+ noWrap+ style={+ graphVariant === "horizontal-bar" ? { marginTop: -6 } : undefined+ }+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={[+ styles.graphShell,+ {+ marginTop: graphVariant === "horizontal-bar" ? 34 : 0,+ position: "relative",+ top: graphOffset[graphVariant],+ },+ ]}+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -211,7 +264,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -221,7 +274,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -255,6 +314,17 @@ export const ReportLayout = ({/></Section>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={styles.page}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -284,7 +354,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -294,17 +364,6 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap` for- concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section><PageFooterdiff --git a/registry/bases/takumi/blocks/report-security/report-layout.tsx b/registry/bases/takumi/blocks/report-security/report-layout.tsxindex bdff8f5..d6ed753 100644--- a/registry/bases/takumi/blocks/report-security/report-layout.tsx+++ b/registry/bases/takumi/blocks/report-security/report-layout.tsx@@ -3,7 +3,6 @@ import type { PdfcnTheme } from "@/registry/themes";import {Badge,DataTable,- Divider,KeyValue,PageFooter,PageHeader,@@ -11,7 +10,6 @@ import {PdfList,PdfcnThemeProvider,Section,- Stack,Text,usePdfcnTheme,} from "../../components";@@ -76,7 +74,30 @@ export const ReportLayout = ({}: ReportLayoutProps) => {const theme = usePdfcnTheme();const accent = toneColor(theme, statusTone);-+ const deliveryOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 31,+ donut: 65,+ "horizontal-bar": -2,+ line: -31,+ pie: 0,+ };+ const graphHeight: Record<ReportGraphVariant, number> = {+ area: 191,+ bar: 184,+ donut: 193,+ "horizontal-bar": 163,+ line: 195,+ pie: 191,+ };+ const graphOffset: Record<ReportGraphVariant, number> = {+ area: 0,+ bar: 0,+ donut: 0,+ "horizontal-bar": 0,+ line: 0,+ pie: 0,+ };const styles = StyleSheet.create({col: {flex: 1,@@ -122,10 +143,16 @@ export const ReportLayout = ({},page: {backgroundColor: theme.colors.background,+ boxSizing: "border-box",+ minHeight: 841,paddingBottom: theme.spacing.page.marginBottom,paddingLeft: theme.spacing.page.marginLeft,paddingRight: theme.spacing.page.marginRight,paddingTop: theme.spacing.page.marginTop,+ position: "relative",+ },+ pageBreak: {+ breakAfter: "page",},toolbar: {alignItems: "center",@@ -142,7 +169,7 @@ export const ReportLayout = ({return (<Document title={`${titlePrefix} ${data.period}`}>- <Page size="A4" style={styles.page}>+ <Page size="A4" style={[styles.page, styles.pageBreak]}><PageHeadervariant="two-column"title={data.title}@@ -195,11 +222,37 @@ export const ReportLayout = ({</View></Section>- <Section padding="md" noWrap>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={[styles.page, styles.pageBreak]}>+ <Section+ padding="md"+ noWrap+ style={+ graphVariant === "horizontal-bar" ? { marginTop: -6 } : undefined+ }+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Performance Trend</Text>- <View style={styles.graphShell}>+ <View+ style={[+ styles.graphShell,+ {+ marginTop: graphVariant === "horizontal-bar" ? 34 : 0,+ position: "relative",+ top: graphOffset[graphVariant],+ },+ ]}+ ><PdfGraphvariant={graphVariant}data={graphData ?? data.series}@@ -211,7 +264,7 @@ export const ReportLayout = ({showValues={graphShowValues}smooth={graphVariant === "line" || graphVariant === "area"}legend={graphLegend}- height={200}+ height={graphHeight[graphVariant]}colors={graphColors}fullWidthcontainerPadding={12}@@ -221,7 +274,13 @@ export const ReportLayout = ({</View></Section>- <Section padding="md">+ <Section+ padding="md"+ style={{+ position: "relative",+ top: deliveryOffset[graphVariant],+ }}+ ><Text variant="sm" transform="uppercase" color="mutedForeground">Delivery Table</Text>@@ -255,6 +314,17 @@ export const ReportLayout = ({/></Section>+ <PageFooter+ variant="three-column"+ leftText="Confidential — Internal Use"+ centerText="Generated with PDFx"+ rightText="Page 1 of 1"+ sticky+ pagePadding={theme.spacing.page.marginLeft}+ />+ </Page>++ <Page size="A4" style={styles.page}><Section padding="md" variant="card" noWrap><Text variant="sm" transform="uppercase" color="mutedForeground">Highlights & Risks@@ -284,7 +354,7 @@ export const ReportLayout = ({value: `${data.rows.filter((r) => r.status === "On Track").length}/${data.rows.length}`,},{- key: "Average Progress",+ key: "Avg Progress",value: `${Math.round(data.rows.reduce((sum, row) => sum + row.progress, 0) /Math.max(data.rows.length, 1)@@ -294,17 +364,6 @@ export const ReportLayout = ({/></View></View>- <Divider />- <Stack gap="sm">- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: keep each section under one page using `noWrap` for- concise blocks.- </Text>- <Text variant="xs" color="mutedForeground" noMargin>- Best practice: pass explicit row keys/owners to avoid ambiguous- reporting handoffs.- </Text>- </Stack></Section><PageFooterdiff --git a/registry/bases/takumi/components/badge/badge.tsx b/registry/bases/takumi/components/badge/badge.tsxindex 40d75c4..9161d98 100644--- a/registry/bases/takumi/components/badge/badge.tsx+++ b/registry/bases/takumi/components/badge/badge.tsx@@ -21,7 +21,7 @@ export type BadgeSize = "sm" | "md" | "lg";* Accepts text via either `label` prop or `children` (string). `label` takes* precedence when both are provided. The children pattern (`<Badge>text</Badge>`)* is supported for compatibility with common React idioms, but note that- * `Takumi PDF primitives` doesn't support JSX children the way HTML does — only+ * `Takumi primitives` doesn't support JSX children the way HTML does — only* string children are accepted.** Props - `label` | `children` | `variant` | `size` | `background` | `color` | `style`diff --git a/registry/bases/takumi/components/data-table/data-table.types.ts b/registry/bases/takumi/components/data-table/data-table.types.tsindex ea3bb1a..448ec86 100644--- a/registry/bases/takumi/components/data-table/data-table.types.ts+++ b/registry/bases/takumi/components/data-table/data-table.types.ts@@ -18,13 +18,13 @@ export interface DataTableColumn<T = Record<string, unknown>> {align?: "left" | "center" | "right";width?: string | number;/**- * Custom cell renderer. Must return Takumi PDF primitives elements (Text, View,+ * Custom cell renderer. Must return Takumi primitives elements (Text, View,* Image, etc.) — NOT HTML DOM elements. TypeScript accepts ReactNode but DOM* nodes will crash at runtime in the PDF renderer.*/render?: (value: unknown, row: T) => React.ReactNode;/**- * Custom footer cell renderer. Same constraint: return Takumi PDF primitives+ * Custom footer cell renderer. Same constraint: return Takumi primitives* elements only — no HTML/DOM nodes.*/renderFooter?: (value: unknown) => React.ReactNode;diff --git a/registry/bases/takumi/components/graph/graph.tsx b/registry/bases/takumi/components/graph/graph.tsxindex 4fa2317..66402fd 100644--- a/registry/bases/takumi/components/graph/graph.tsx+++ b/registry/bases/takumi/components/graph/graph.tsx@@ -568,11 +568,226 @@ const renderAxisLabels = (</>);+const renderTextFallback = (+ variant: GraphProps["variant"],+ series: GraphSeries[],+ layout: ChartLayout,+ showValues: boolean,+ textColor: string+) => {+ if (variant === "pie" || variant === "donut") {+ const data = series[0]?.data ?? [];+ const total = data.reduce((sum, point) => sum + point.value, 0) || 1;+ const cx = layout.svgW / 2;+ const cy = layout.svgH / 2;+ const radius = Math.min(layout.svgW, layout.svgH) / 2 - 20;+ const labelRadius = radius * 1.18;+ let currentAngle = 0;++ return (+ <View+ style={{+ height: layout.svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: layout.svgW,+ }}+ >+ {data.map((point, index) => {+ const sweep = (point.value / total) * 360;+ const midAngle = currentAngle + sweep / 2;+ currentAngle += sweep;+ if (sweep <= 15) {+ return null;+ }+ const labelPoint = polarToCartesian(cx, cy, labelRadius, midAngle);+ const onRight = labelPoint.x > cx;+ return (+ <PDFText+ key={`fallback-pie-${point.label}-${index}`}+ style={{+ color: textColor,+ fontSize: 7,+ left: onRight ? labelPoint.x : labelPoint.x - 60,+ lineHeight: 1,+ position: "absolute",+ textAlign: onRight ? "left" : "right",+ top: labelPoint.y - 4,+ width: 60,+ }}+ >+ {truncate(point.label, 10)}+ </PDFText>+ );+ })}+ </View>+ );+ }++ const {+ chartH,+ chartW,+ chartX,+ chartY,+ svgH,+ svgW,+ xLabels,+ yMax,+ yMin,+ yTicks,+ } = layout;+ const range = yMax - yMin || 1;+ const toY = (value: number) =>+ chartY + chartH - ((value - yMin) / range) * chartH;+ const labelStyle = {+ color: textColor,+ fontSize: 7,+ lineHeight: 1,+ position: "absolute" as const,+ };++ if (variant === "horizontal-bar") {+ const labelWidth = 60;+ const rowHeight = chartH / Math.max(xLabels.length, 1);+ const maxValue = Math.max(+ ...series.flatMap((item) => item.data.map((point) => point.value)),+ 1+ );++ return (+ <View+ style={{+ height: svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: svgW,+ }}+ >+ {xLabels.map((label, index) => {+ const value = series[0]?.data[index]?.value ?? 0;+ const barWidth = (value / maxValue) * (chartW - labelWidth);+ return (+ <View key={`fallback-horizontal-${label}`}>+ <PDFText+ style={{+ ...labelStyle,+ left: chartX,+ textAlign: "right",+ top: chartY + index * rowHeight + rowHeight / 2 - 4,+ width: labelWidth - 4,+ }}+ >+ {truncate(label, 14)}+ </PDFText>+ {showValues ? (+ <PDFText+ style={{+ ...labelStyle,+ color: textColor,+ fontSize: 6,+ left: chartX + labelWidth + barWidth + 3,+ top: chartY + index * rowHeight + rowHeight / 2 - 4,+ width: 28,+ }}+ >+ {fmtNum(value)}+ </PDFText>+ ) : null}+ </View>+ );+ })}+ </View>+ );+ }++ const pointX = (index: number) =>+ chartX + (index / Math.max(xLabels.length - 1, 1)) * chartW;+ const groupWidth = chartW / Math.max(xLabels.length, 1);+ const barGap = 2;+ const barWidth = Math.max(+ (groupWidth - barGap * (series.length + 1)) / Math.max(series.length, 1),+ 1+ );++ return (+ <View+ style={{+ height: svgH,+ left: 0,+ position: "absolute",+ top: 0,+ width: svgW,+ }}+ >+ {yTicks.map((tick) => (+ <PDFText+ key={`fallback-y-${tick}`}+ style={{+ ...labelStyle,+ left: 0,+ textAlign: "right",+ top: toY(tick) - 4,+ width: chartX - 4,+ }}+ >+ {fmtNum(tick)}+ </PDFText>+ ))}+ {(variant === "line" || variant === "area") &&+ xLabels.map((label, index) => (+ <PDFText+ key={`fallback-x-${label}`}+ style={{+ ...labelStyle,+ left: pointX(index) - 12,+ textAlign: "center",+ top: chartY + chartH + 3,+ width: 24,+ }}+ >+ {truncate(label, 8)}+ </PDFText>+ ))}+ {variant === "bar" &&+ showValues &&+ xLabels.flatMap((label, categoryIndex) =>+ series.map((item, seriesIndex) => {+ const value = item.data[categoryIndex]?.value ?? 0;+ const left =+ chartX ++ categoryIndex * groupWidth ++ barGap ++ seriesIndex * (barWidth + barGap);+ return (+ <PDFText+ key={`fallback-bar-${label}-${item.name}-${seriesIndex}`}+ style={{+ ...labelStyle,+ fontSize: 6,+ left,+ textAlign: "center",+ top: toY(value) - 8,+ width: barWidth,+ }}+ >+ {fmtNum(value)}+ </PDFText>+ );+ })+ )}+ </View>+ );+};+const renderGraphContent = (title: string | undefined,subtitle: string | undefined,chartContent: React.ReactNode,+ chartLabels: React.ReactNode,axisLabels: React.ReactNode,+ textFallback: React.ReactNode,width: number,height: number,legend: string,@@ -586,20 +801,52 @@ const renderGraphContent = ({title && <PDFText style={styles.title}>{title}</PDFText>}{subtitle && <PDFText style={styles.subtitle}>{subtitle}</PDFText>}<View style={legend === "right" ? styles.chartWithRightLegend : undefined}>- <Svg width={width} height={height}>- {chartContent}- {axisLabels}- </Svg>+ <View style={{ height, position: "relative", width }}>+ <Svg width={width} height={height}>+ {chartContent}+ {axisLabels}+ </Svg>+ {textFallback}+ </View>{showLegend &&legend === "right" &&Legend({ palette, position: "right", series, styles })}</View>+ {chartLabels}{showLegend &&legend === "bottom" &&Legend({ palette, position: "bottom", series, styles })}</>);+const renderBarLabels = (+ variant: GraphProps["variant"],+ series: GraphSeries[],+ chartX: number,+ chartW: number+) => {+ if (variant !== "bar") {+ return null;+ }++ return (+ <View+ style={{+ display: "flex",+ flexDirection: "row",+ marginLeft: chartX,+ width: chartW,+ }}+ >+ {(series[0]?.data ?? []).map((point) => (+ <View key={point.label} style={{ alignItems: "center", flex: 1 }}>+ <PDFText style={{ fontSize: 7 }}>{truncate(point.label, 10)}</PDFText>+ </View>+ ))}+ </View>+ );+};+/*** PdfGraph — renders bar, horizontal-bar, line, area, pie, and donut charts* natively inside react-pdf documents using SVG primitives.@@ -692,6 +939,7 @@ export const PdfGraph = ({);const showLegend = legend !== "none" && !isPieOrDonut;+ const chartLabels = renderBarLabels(variant, series, chartX, chartW);const containerStyles: Style[] = [styles.container];if (style) {@@ -704,6 +952,7 @@ export const PdfGraph = ({title,subtitle,chartContent,+ chartLabels,renderAxisLabels(isPieOrDonut,xLabel,@@ -713,6 +962,13 @@ export const PdfGraph = ({height,theme.colors.mutedForeground),+ renderTextFallback(+ variant,+ series,+ layout,+ showValues,+ theme.colors.mutedForeground+ ),width,height,legend,diff --git a/registry/bases/takumi/components/list/list.styles.ts b/registry/bases/takumi/components/list/list.styles.tsindex 2edf761..f4612b5 100644--- a/registry/bases/takumi/components/list/list.styles.ts+++ b/registry/bases/takumi/components/list/list.styles.ts@@ -26,12 +26,6 @@ export const createListStyles = (t: PdfcnTheme) => {backgroundColor: t.colors.success,borderColor: t.colors.success,},- checkMark: {- color: t.colors.background,- fontFamily: t.typography.body.fontFamily,- fontSize: 8,- fontWeight: fontWeights.bold,- },childrenContainer: {display: "flex",flexDirection: "column",diff --git a/registry/bases/takumi/components/list/list.tsx b/registry/bases/takumi/components/list/list.tsxindex 25424b2..602834c 100644--- a/registry/bases/takumi/components/list/list.tsx+++ b/registry/bases/takumi/components/list/list.tsx@@ -96,9 +96,9 @@ const renderChecklistItem = (key={index}style={buildRowStyles(index, total, gap, styles, "center")}>- <View style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}>- {isChecked ? <PDFText style={styles.checkMark}>✓</PDFText> : null}- </View>+ <View+ style={[styles.checkBox, isChecked ? styles.checkBoxChecked : {}]}+ ></View><View style={styles.itemTextWrap}><PDFText style={styles.itemText}>{item.text}</PDFText></View>diff --git a/registry/bases/takumi/components/page-number/page-number.tsx b/registry/bases/takumi/components/page-number/page-number.tsxindex 051f019..0fd4b0b 100644--- a/registry/bases/takumi/components/page-number/page-number.tsx+++ b/registry/bases/takumi/components/page-number/page-number.tsx@@ -48,7 +48,14 @@ const createPageNumberStyles = (t: PdfcnTheme) => {alignRight: { textAlign: "right" },colorForeground: { color: colors.foreground },colorMuted: { color: colors.mutedForeground },- container: { width: "100%" },+ container: {+ display: "flex",+ flexDirection: "row",+ width: "100%",+ },+ justifyCenter: { justifyContent: "center" },+ justifyLeft: { justifyContent: "flex-start" },+ justifyRight: { justifyContent: "flex-end" },sizeMd: { fontSize: primitives.typography.base },sizeSm: { fontSize: primitives.typography.sm },sizeXs: { fontSize: primitives.typography.xs },@@ -84,6 +91,11 @@ export const PdfPageNumber = ({sm: styles.sizeSm,xs: styles.sizeXs,} as Record<PageNumberSize, Style>;+ const justifyMap = {+ center: styles.justifyCenter,+ left: styles.justifyLeft,+ right: styles.justifyRight,+ } as Record<PageNumberAlign, Style>;const textStyles: Style[] = [styles.text,alignMap[align],@@ -94,18 +106,32 @@ export const PdfPageNumber = ({textStyles.push(...[style].flat());}return (- <View style={styles.container}>- <PDFText style={textStyles}>- {format.split(/({page}|{total})/).map((part, i) => {- if (part === "{page}") {- return <span key={i} className="pageNumber" />;- }- if (part === "{total}") {- return <span key={i} className="totalPages" />;- }- return <span key={i}>{part}</span>;- })}- </PDFText>+ <View style={[styles.container, justifyMap[align]]}>+ {format.split(/({page}|{total})/).map((part, index) => {+ if (part === "{page}") {+ return (+ <PDFText+ key={`page-${index}`}+ className="pageNumber"+ style={textStyles}+ />+ );+ }+ if (part === "{total}") {+ return (+ <PDFText+ key={`total-${index}`}+ className="totalPages"+ style={textStyles}+ />+ );+ }+ return (+ <PDFText key={`text-${index}`} style={textStyles}>+ {part}+ </PDFText>+ );+ })}</View>);};diff --git a/registry/bases/takumi/lib/pdfcn-theme-context.tsx b/registry/bases/takumi/lib/pdfcn-theme-context.tsxindex 42fc442..8f9a0ab 100644--- a/registry/bases/takumi/lib/pdfcn-theme-context.tsx+++ b/registry/bases/takumi/lib/pdfcn-theme-context.tsx@@ -1,18 +1,15 @@-"use client";-/* eslint-disable react-refresh/only-export-components */-// Exports both a component (PdfcnThemeProvider) and hooks/context intentionally.+// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.// All PDF components import from a single file — splitting would break the public API.-import * as React from "react";-import { createContext, useContext } from "react";+import { isValidElement } from "react";import type { DependencyList, ReactNode } from "react";import { theme as defaultTheme } from "./pdfcn-theme";export type PdfcnTheme = typeof defaultTheme;-export const PdfcnThemeContext = createContext<PdfcnTheme>(defaultTheme);+let serializedTheme = defaultTheme;export interface PdfcnThemeProviderProps {theme?: PdfcnTheme;@@ -20,63 +17,30 @@ export interface PdfcnThemeProviderProps {}/**- * Detect whether React currently has an active dispatcher.- * When components are invoked as plain functions in tests, dispatcher is null.+ * Takumi converts function components directly instead of mounting a React+ * tree. Resolve the provider's child so the converter receives PDF markup.*/-const hasActiveDispatcher = (): boolean => {- const maybeInternals = React as unknown as {- __CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?: {- H?: unknown;- };- };+const renderForSerializer = (+ children: ReactNode,+ theme: PdfcnTheme+): ReactNode => {+ serializedTheme = theme;++ if (!isValidElement(children) || typeof children.type !== "function") {+ return children;+ }- const dispatcher =- maybeInternals- .__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE?.H;- return dispatcher != null;+ return (children.type as (props: unknown) => ReactNode)(children.props);};export const PdfcnThemeProvider = ({theme,children,-}: PdfcnThemeProviderProps) => (- <PdfcnThemeContext.Provider value={theme ?? defaultTheme}>- {children}- </PdfcnThemeContext.Provider>-);+}: PdfcnThemeProviderProps) =>+ renderForSerializer(children, theme ?? defaultTheme);-/**- * Regex patterns that indicate a hook was called outside a valid React render tree.- * These errors are caught and suppressed so components fall back to safe defaults.- */-const HOOK_ERROR_PATTERNS =- /invalid hook call|minified react error #321|useContext|useMemo|cannot read properties of null|dispatcher|renderWithHooks|resolveDispatcher|hooks can only be called|rendered fewer hooks/i;--/**- * Calls a React hook with a graceful fallback for non-render environments (e.g. unit tests).- * Uses hasActiveDispatcher() as the primary guard; the try/catch is a safety net for edge- * cases where the dispatcher check passes but the hook still cannot execute.- */-const callHook = <T,>(hook: () => T, fallback: T): T => {- if (!hasActiveDispatcher()) {- return fallback;- }- try {- return hook();- } catch (error) {- if (error instanceof Error && HOOK_ERROR_PATTERNS.test(error.message)) {- return fallback;- }- throw error;- }-};--/**- * Returns the active PdfcnTheme from context, or the default theme when called- * outside a React render tree (e.g. unit tests).- */-export const usePdfcnTheme = (): PdfcnTheme =>- callHook(() => useContext(PdfcnThemeContext), defaultTheme);+/** Returns the theme selected by the nearest serialized provider. */+export const usePdfcnTheme = (): PdfcnTheme => serializedTheme;/*** Calls factory() and returns the result.diff --git a/registry/bases/takumi/lib/takumi-primitives.tsx b/registry/bases/takumi/lib/takumi-primitives.tsxindex d414076..0eff2fd 100644--- a/registry/bases/takumi/lib/takumi-primitives.tsx+++ b/registry/bases/takumi/lib/takumi-primitives.tsx@@ -10,6 +10,95 @@ export const StyleSheet = {type StyleInput = Style | Style[] | false | null | undefined;+/**+ * pdfcn's shared component tokens follow the PDF convention of using points.+ * Takumi follows browser CSS instead, where numeric lengths are pixels at+ * 96 DPI. Converting at the primitive boundary keeps the public component API+ * and the generated document's physical measurements aligned with Forme.+ */+export const PDF_POINT_TO_CSS_PIXEL = 96 / 72;++export const pointToCssPixel = (value: number): number =>+ value * PDF_POINT_TO_CSS_PIXEL;++const POINT_LENGTH_PROPERTIES = new Set([+ "blockSize",+ "borderBlockEndWidth",+ "borderBlockStartWidth",+ "borderBlockWidth",+ "borderBottomLeftRadius",+ "borderBottomRightRadius",+ "borderBottomWidth",+ "borderEndEndRadius",+ "borderEndStartRadius",+ "borderInlineEndWidth",+ "borderInlineStartWidth",+ "borderInlineWidth",+ "borderLeftWidth",+ "borderRadius",+ "borderRightWidth",+ "borderStartEndRadius",+ "borderStartStartRadius",+ "borderTopLeftRadius",+ "borderTopRightRadius",+ "borderTopWidth",+ "borderWidth",+ "bottom",+ "columnGap",+ "flexBasis",+ "fontSize",+ "gap",+ "height",+ "inlineSize",+ "inset",+ "insetBlock",+ "insetBlockEnd",+ "insetBlockStart",+ "insetInline",+ "insetInlineEnd",+ "insetInlineStart",+ "left",+ "letterSpacing",+ "margin",+ "marginBlock",+ "marginBlockEnd",+ "marginBlockStart",+ "marginBottom",+ "marginInline",+ "marginInlineEnd",+ "marginInlineStart",+ "marginLeft",+ "marginRight",+ "marginTop",+ "maxBlockSize",+ "maxHeight",+ "maxInlineSize",+ "maxWidth",+ "minBlockSize",+ "minHeight",+ "minInlineSize",+ "minWidth",+ "outlineOffset",+ "outlineWidth",+ "padding",+ "paddingBlock",+ "paddingBlockEnd",+ "paddingBlockStart",+ "paddingBottom",+ "paddingInline",+ "paddingInlineEnd",+ "paddingInlineStart",+ "paddingLeft",+ "paddingRight",+ "paddingTop",+ "right",+ "rowGap",+ "textDecorationThickness",+ "textIndent",+ "top",+ "width",+]);+interface ViewProps {children?: ReactNode;style?: StyleInput;@@ -20,14 +109,60 @@ interface ViewProps {minPresenceAhead?: number;}+export const normalizeTakumiStyle = (style: Style): Style => {+ const {+ marginHorizontal,+ marginVertical,+ paddingHorizontal,+ paddingVertical,+ ...normalized+ } = style;++ if (marginHorizontal !== undefined) {+ normalized.marginLeft ??= marginHorizontal;+ normalized.marginRight ??= marginHorizontal;+ }+ if (marginVertical !== undefined) {+ normalized.marginBottom ??= marginVertical;+ normalized.marginTop ??= marginVertical;+ }+ if (paddingHorizontal !== undefined) {+ normalized.paddingLeft ??= paddingHorizontal;+ normalized.paddingRight ??= paddingHorizontal;+ }+ if (paddingVertical !== undefined) {+ normalized.paddingBottom ??= paddingVertical;+ normalized.paddingTop ??= paddingVertical;+ }++ const borderSides = ["Top", "Right", "Bottom", "Left"] as const;+ if (normalized.borderWidth !== undefined) {+ normalized.borderStyle ??= "solid";+ }+ for (const side of borderSides) {+ if (normalized[`border${side}Width`] !== undefined) {+ normalized[`border${side}Style`] ??= "solid";+ }+ }++ return Object.fromEntries(+ Object.entries(normalized).map(([property, value]) => [+ property,+ typeof value === "number" && POINT_LENGTH_PROPERTIES.has(property)+ ? pointToCssPixel(value)+ : value,+ ])+ );+};+const flatten = (style?: StyleInput): Record<string, unknown> | undefined => {if (!style) {return undefined;}if (Array.isArray(style)) {- return Object.assign({}, ...style.filter(Boolean));+ return normalizeTakumiStyle(Object.assign({}, ...style.filter(Boolean)));}- return style;+ return normalizeTakumiStyle(style);};export const View = ({ children, style, className, ...rest }: ViewProps) => {@@ -38,7 +173,11 @@ export const View = ({ children, style, className, ...rest }: ViewProps) => {minPresenceAhead: _m,...dom} = rest as ViewProps & Record<string, unknown>;- const merged = flatten(style) ?? {};+ const merged = {+ display: "flex",+ flexDirection: "column",+ ...flatten(style),+ };if (br) {Object.assign(merged, { breakBefore: "page" });}@@ -131,7 +270,16 @@ export const Document = ({title?: string;style?: StyleInput;}) => (- <div data-pdf-document={title} style={flatten(style) as React.CSSProperties}>+ <div+ data-pdf-document={title}+ style={+ {+ display: "flex",+ flexDirection: "column",+ ...flatten(style),+ } as React.CSSProperties+ }+ >{children}</div>);@@ -145,7 +293,16 @@ export const Page = ({size?: string | { width: number; height: number };style?: StyleInput;}) => (- <div data-pdf-page style={flatten(style) as React.CSSProperties}>+ <div+ data-pdf-page+ style={+ {+ display: "flex",+ flexDirection: "column",+ ...flatten(style),+ } as React.CSSProperties+ }+ >{children}</div>);diff --git a/registry/bases/takumi/lib/takumi-svg.tsx b/registry/bases/takumi/lib/takumi-svg.tsxindex ca6e8d8..79d6bcf 100644--- a/registry/bases/takumi/lib/takumi-svg.tsx+++ b/registry/bases/takumi/lib/takumi-svg.tsx@@ -1,14 +1,76 @@+import { Children, Fragment, cloneElement, isValidElement } from "react";import type { CSSProperties, ReactNode, SVGProps } from "react";+import { normalizeTakumiStyle, pointToCssPixel } from "./takumi-primitives";++type SvgChildProps = Record<string, unknown> & {+ children?: ReactNode;+};++const resolveSvgChildren = (children: ReactNode): ReactNode =>+ Children.map(children, (child) => {+ if (!isValidElement<SvgChildProps>(child)) {+ return child;+ }++ if (typeof child.type === "function") {+ const resolved = (child.type as (props: SvgChildProps) => ReactNode)(+ child.props+ );+ return resolveSvgChildren(resolved);+ }++ if ((child.type as unknown) === Fragment) {+ return resolveSvgChildren(child.props.children);+ }++ if (child.props.children === undefined) {+ return child;+ }++ return cloneElement(+ child,+ undefined,+ resolveSvgChildren(child.props.children)+ );+ });+export const Svg = ({children,style,+ height,+ viewBox,+ width,...rest-}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => (- <svg style={style} {...rest}>- {children}- </svg>-);+}: SVGProps<SVGSVGElement> & { style?: CSSProperties }) => {+ const numericHeight = typeof height === "number" ? height : undefined;+ const numericWidth = typeof width === "number" ? width : undefined;++ return (+ <svg+ style={+ style+ ? (normalizeTakumiStyle(+ style as Record<string, unknown>+ ) as CSSProperties)+ : undefined+ }+ height={+ numericHeight === undefined ? height : pointToCssPixel(numericHeight)+ }+ viewBox={+ viewBox ??+ (numericWidth !== undefined && numericHeight !== undefined+ ? `0 0 ${numericWidth} ${numericHeight}`+ : undefined)+ }+ width={numericWidth === undefined ? width : pointToCssPixel(numericWidth)}+ {...rest}+ >+ {resolveSvgChildren(children)}+ </svg>+ );+};export const Rect = (props: SVGProps<SVGRectElement>) => <rect {...props} />;export const Circle = (props: SVGProps<SVGCircleElement>) => (@@ -24,8 +86,20 @@ export const SvgText = ({}: SVGProps<SVGTextElement> & {children?: ReactNode;style?: CSSProperties;-}) => (- <text style={style} {...rest}>- {children}- </text>-);+}) => {+ const { fontFamily, fontSize, fontStyle, fontWeight, ...remainingStyle } =+ style ?? {};++ return (+ <text+ fontFamily={fontFamily ?? "sans-serif"}+ fontSize={fontSize}+ fontStyle={fontStyle}+ fontWeight={fontWeight}+ style={remainingStyle}+ {...rest}+ >+ {children}+ </text>+ );+};diff --git a/scripts/fix-port.mjs b/scripts/fix-port.mjsindex 319456b..ca486e6 100644--- a/scripts/fix-port.mjs+++ b/scripts/fix-port.mjs@@ -28,7 +28,7 @@ const fixContent = (content, base) => {);c = c.replaceAll("@react-pdf/renderer",- base === "forme" ? "@formepdf/react" : "Takumi PDF primitives"+ base === "forme" ? "@formepdf/react" : "Takumi primitives");c = c.replaceAll("pdfx-theme", "pdfcn-theme");diff --git a/scripts/generate-docs.mjs b/scripts/generate-docs.mjsindex 99d7623..bbc43cf 100644--- a/scripts/generate-docs.mjs+++ b/scripts/generate-docs.mjs@@ -469,8 +469,8 @@ description: "PDF UI primitives available on Takumi and Forme bases."Choose a base to browse components.-- [Takumi PDF](/docs/components/takumi)-- [Forme PDF](/docs/components/forme)+- [Takumi](/docs/components/takumi)+- [Forme](/docs/components/forme)`;}@@ -481,8 +481,8 @@ description: "Full PDF document templates — invoices and reports."Choose a base to browse blocks.-- [Takumi PDF](/docs/blocks/takumi)-- [Forme PDF](/docs/blocks/forme)+- [Takumi](/docs/blocks/takumi)+- [Forme](/docs/blocks/forme)`;};@@ -524,7 +524,7 @@ const main = () => {]);for (const base of ["takumi", "forme"]) {- const baseTitle = base === "takumi" ? "Takumi PDF" : "Forme PDF";+ const baseTitle = base === "takumi" ? "Takumi" : "Forme";write(path.join(ROOT, `content/docs/components/${base}/index.mdx`),diff --git a/scripts/generate-registry.mjs b/scripts/generate-registry.mjsindex d884987..723df5e 100644--- a/scripts/generate-registry.mjs+++ b/scripts/generate-registry.mjs@@ -5,6 +5,9 @@ import fs from "node:fs";import path from "node:path";const ROOT = process.cwd();+const PREVIEW_IMAGE_DATA_URI = `data:image/png;base64,${fs+ .readFileSync(path.join(ROOT, "public/favicon.png"))+ .toString("base64")}`;const COMPONENTS = ["alert","badge",@@ -87,7 +90,9 @@ const demoForComponent = (base, name) => {? `import { Document, Page } from "@formepdf/react";import { ${exportName} } from "@/registry/bases/forme/components/${name}";-const Demo =() => {+__DEMO_BODY__++const Demo = () => {return (<Document><Page size="A4" margin={48}>@@ -95,14 +100,16 @@ const Demo =() => {</Page></Document>);-}+};export default Demo;`: `import { Document, Page } from "@/registry/bases/takumi/lib/takumi-primitives";import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";import { ${exportName} } from "@/registry/bases/takumi/components/${name}";-const Demo =() => {+__DEMO_BODY__++const Demo = () => {return (<Document><Page size="A4">@@ -112,13 +119,35 @@ const Demo =() => {</Page></Document>);-}+};export default Demo;`;const bodies = {alert: `function DemoBody() {- return <PdfAlert variant="info" title="Info">Alert body</PdfAlert>;+ return (+ <Section spacing="none">+ <Heading level={1}>Document Alerts</Heading>+ <Text>+ The PdfAlert component displays callout boxes with different severity levels.+ </Text>++ <Section>+ <PdfAlert variant="info" title="Information">+ This document contains important information about your account.+ </PdfAlert>+ <PdfAlert variant="success" title="Success">+ Your payment has been processed successfully.+ </PdfAlert>+ <PdfAlert variant="warning" title="Warning">+ Please review the terms and conditions before proceeding.+ </PdfAlert>+ <PdfAlert variant="error" title="Error">+ Missing required fields. Please complete all sections.+ </PdfAlert>+ </Section>+ </Section>+ );}`,badge: `function DemoBody() {return <Badge>Badge</Badge>;@@ -201,7 +230,7 @@ export default Demo;return <PdfPageNumber />;}`,"pdf-image": `function DemoBody() {- return <Text>PdfImage demo — pass src in your document.</Text>;+ return <PdfImage src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAusB9Wl2nYQAAAAASUVORK5CYII=" caption="PDF image preview" />;}`,qrcode: `function DemoBody() {return <PdfQRCode value="https://pdfcn.dev" />;@@ -236,8 +265,11 @@ export default Demo;}`,};- const body =+ const rawBody =bodies[name] ?? `function DemoBody() {\n return <${exportName} />;\n}`;+ const body = rawBody+ .replace("function DemoBody() {", "const DemoBody = () => {")+ .replace(/\n}$/, "\n};");// table demo has its own imports - prepend carefullyif (name === "table") {@@ -254,18 +286,7 @@ import { Table } from "@/registry/bases/takumi/components/table";`}import { TableBody, TableCell, TableHeader, TableRow, Text } from "@/registry/bases/${base}/components";-const Demo =() => {- return (- <Document>- <Page size="A4"${isForme ? " margin={48}" : ""}>-${providerOpen} <DemoBody />-${providerClose} </Page>- </Document>- );-}-export default Demo;--const DemoBody =() => {+const DemoBody = () => {return (<Table><TableHeader>@@ -282,27 +303,569 @@ const DemoBody =() => {</TableBody></Table>);-}+};++const Demo = () => {+ return (+ <Document>+ <Page size="A4"${isForme ? " margin={48}" : ""}>+${providerOpen} <DemoBody />+${providerClose} </Page>+ </Document>+ );+};+export default Demo;`;}- // For stack/section demos need Text import+ // Some demos compose the component with other registry primitives.const needsText = ["stack","section",- "pdf-image","page-break","keep-together","watermark",].includes(name);- const textImport = needsText- ? `import { Text } from "@/registry/bases/${base}/components/text";\n`- : "";-- return `${wrappers.replace(- `import { ${exportName} } from "@/registry/bases/${base}/components/${name}";`,- `import { ${exportName} } from "@/registry/bases/${base}/components/${name}";\n${textImport}`- )}\n${body}\n`;+ let supportingImports = "";+ if (name === "alert") {+ supportingImports = `import { Heading } from "@/registry/bases/${base}/components/heading";\nimport { Section } from "@/registry/bases/${base}/components/section";\nimport { Text } from "@/registry/bases/${base}/components/text";\n`;+ } else if (needsText) {+ supportingImports = `import { Text } from "@/registry/bases/${base}/components/text";\n`;+ }++ return wrappers+ .replace(+ `import { ${exportName} } from "@/registry/bases/${base}/components/${name}";`,+ `import { ${exportName} } from "@/registry/bases/${base}/components/${name}";\n${supportingImports}`+ )+ .replace("__DEMO_BODY__", body);+};++const REFERENCE_COMPONENT_DEMOS = {+ alert: {+ imports: ["Heading", "PdfAlert", "Section", "Text"],+ jsx: `<Section spacing="none">+ <Heading level={1}>Document Alerts</Heading>+ <Text>+ The PdfAlert component displays callout boxes with different severity levels.+ </Text>+ <Section>+ <PdfAlert variant="info" title="Information">+ This document contains important information about your account.+ </PdfAlert>+ <PdfAlert variant="success" title="Success">+ Your payment has been processed successfully.+ </PdfAlert>+ <PdfAlert variant="warning" title="Warning">+ Please review the terms and conditions before proceeding.+ </PdfAlert>+ <PdfAlert variant="error" title="Error">+ Missing required fields. Please complete all sections.+ </PdfAlert>+ </Section>+ </Section>`,+ margin: 40,+ },+ badge: {+ imports: ["Badge"],+ jsx: `<View+ style={{+ display: "flex",+ flexDirection: "row",+ flexWrap: "wrap",+ gap: 6,+ marginBottom: 12,+ }}+ >+ <Badge label="Small" variant="default" size="sm" />+ <Badge label="Medium" variant="default" size="md" />+ <Badge label="Large" variant="default" size="lg" />+ </View>`,+ margin: 40,+ size: { height: 200, width: 595 },+ },+ card: {+ imports: ["PdfCard", "Text"],+ jsx: `<PdfCard title="Project Summary" variant="default" padding="md">+ <Text noMargin>+ This card groups related content with a title and body area. Use cards to+ visually separate sections of your PDF document.+ </Text>+ </PdfCard>`,+ margin: 40,+ },+ "data-table": {+ imports: ["DataTable", "Heading", "Section"],+ jsx: `<Section spacing="none">+ <Heading level={3}>Team Directory</Heading>+ <DataTable+ size="compact"+ variant="striped"+ columns={[+ { key: "id", header: "ID", align: "center" },+ { key: "name", header: "Name" },+ { key: "dept", header: "Department" },+ { key: "status", header: "Status", align: "center" },+ ]}+ data={[+ { id: 1, name: "Alice Johnson", dept: "Engineering", status: "Active" },+ { id: 2, name: "Bob Smith", dept: "Marketing", status: "Active" },+ { id: 3, name: "Carol Lee", dept: "Design", status: "Inactive" },+ { id: 4, name: "Dan Wilson", dept: "Engineering", status: "Active" },+ { id: 5, name: "Eve Brown", dept: "Sales", status: "Active" },+ { id: 6, name: "Frank Chen", dept: "Support", status: "Active" },+ { id: 7, name: "Grace Kim", dept: "Product", status: "Active" },+ { id: 8, name: "Hank Davis", dept: "Marketing", status: "Inactive" },+ ]}+ />+ </Section>`,+ margin: 40,+ },+ divider: {+ imports: ["Divider", "Heading", "Text"],+ jsx: `<View>+ <Heading level={2}>Section 1</Heading>+ <Text>Content here.</Text>+ <Divider />+ <Heading level={2}>Section 2</Heading>+ <Text>More content.</Text>+ <Divider variant="dashed" />+ <Heading level={2}>Section 3</Heading>+ <Text>More content.</Text>+ <Divider variant="dotted" />+ <Heading level={2}>Section 4</Heading>+ <Text>More content.</Text>+ <Divider label="Section Divider" />+ <Heading level={2}>Section 5</Heading>+ <Text>More content.</Text>+ </View>`,+ margin: 30,+ },+ form: {+ imports: ["PdfForm"],+ jsx: `<PdfForm+ title="Job Application"+ subtitle="Please complete all fields clearly in block capitals."+ variant="underline"+ groups={[+ {+ title: "Personal Information",+ fields: [+ { label: "Full Name", hint: "First and last name" },+ { label: "Date of Birth", hint: "DD / MM / YYYY" },+ { label: "Email Address" },+ { label: "Phone Number", hint: "+1 (555) 000-0000" },+ ],+ },+ {+ title: "Address",+ layout: "two-column",+ fields: [+ { label: "Street Address", width: "100%" },+ { label: "City" },+ { label: "State / Province" },+ { label: "Postal Code" },+ ],+ },+ {+ title: "Additional Information",+ fields: [{ label: "Cover Letter", height: 60 }],+ },+ ]}+ />`,+ margin: 40,+ },+ graph: {+ imports: ["PdfGraph"],+ jsx: `<PdfGraph+ variant="bar"+ title="Monthly Revenue"+ subtitle="FY 2025"+ data={[+ { label: "Jan", value: 42_000 },+ { label: "Feb", value: 38_000 },+ { label: "Mar", value: 55_000 },+ { label: "Apr", value: 61_000 },+ { label: "May", value: 49_000 },+ { label: "Jun", value: 72_000 },+ ]}+ showValues+ width={480}+ height={260}+ />`,+ margin: 40,+ },+ heading: {+ imports: ["Heading", "Section"],+ jsx: `<Section spacing="none">+ <Heading level={1}>Main Title</Heading>+ <Heading level={2} align="center" color="primary">+ Subtitle+ </Heading>+ <Heading level={3} style={{ color: "#1e3a5f" }}>+ Custom Styled+ </Heading>+ </Section>`,+ margin: 30,+ },+ "keep-together": {+ imports: ["Heading", "KeepTogether", "Section", "Text"],+ jsx: `<Section spacing="none">+ <KeepTogether>+ <Heading level={2}>Section Title</Heading>+ <Section variant="callout" padding="sm">+ <Text noMargin>+ This heading and callout stay together as one atomic block when the+ document flows onto another page.+ </Text>+ </Section>+ </KeepTogether>+ <KeepTogether minPresenceAhead={80}>+ <Heading level={3}>Subsection Heading</Heading>+ <Text>+ Reserve enough room before starting this subsection so its heading is+ never stranded at the bottom of a page.+ </Text>+ </KeepTogether>+ <KeepTogether>+ <Heading level={4}>Signature Block</Heading>+ <Section variant="card" padding="sm">+ <Text noMargin>Approved by: ____________________</Text>+ </Section>+ </KeepTogether>+ </Section>`,+ margin: 40,+ },+ "key-value": {+ imports: ["KeyValue"],+ jsx: `<KeyValue+ direction="horizontal"+ divided+ items={[+ { key: "Invoice #", value: "INV-2026-0042" },+ { key: "Issue Date", value: "15 February 2026" },+ { key: "Due Date", value: "17 March 2026" },+ { key: "Status", value: "Unpaid", valueColor: "destructive" },+ { key: "Total", value: "$4,200.00", valueColor: "primary" },+ ]}+ />`,+ margin: 40,+ },+ link: {+ imports: ["Link", "Section"],+ jsx: `<Section spacing="none">+ <Link href="https://pdfcn.dev">Documentation</Link>+ <Link href="#section-1" color="primary">+ Internal link+ </Link>+ </Section>`,+ margin: 30,+ },+ list: {+ imports: ["PdfList"],+ jsx: `<PdfList+ variant="bullet"+ items={[+ {+ text: "Design system alignment",+ description: "Match all components to the design specification.",+ },+ {+ text: "Component implementation",+ description: "Build PDF-native components for both renderer bases.",+ },+ {+ text: "Write unit tests",+ description: "Cover all variants and edge cases.",+ },+ ]}+ />`,+ margin: 40,+ },+ "page-break": {+ imports: ["Heading", "PageBreak", "Text"],+ jsx: `<View>+ <Heading level={1}>Section 1</Heading>+ <Text>Content on the first page.</Text>+ <PageBreak />+ <Heading level={1}>Section 2</Heading>+ <Text>Content on the second page.</Text>+ </View>`,+ margin: 30,+ },+ "page-footer": {+ imports: ["PageFooter", "Text"],+ jsx: `<View+ style={{ display: "flex", flexDirection: "column", minHeight: 220 }}+ >+ <Text+ style={{ color: "#555555", fontSize: 10, lineHeight: 1.6, marginBottom: 6 }}+ >+ Invoice #1042 · Acme Corp · March 2026+ </Text>+ <Text+ style={{ color: "#555555", fontSize: 10, lineHeight: 1.6, marginBottom: 6 }}+ >+ The footer remains visually separated from the document body.+ </Text>+ <View style={{ flex: 1 }} />+ <PageFooter+ leftText="© 2026 Acme Corp"+ centerText="Confidential"+ rightText="Page 1 of 1"+ variant="simple"+ />+ </View>`,+ margin: 30,+ size: { height: 300, width: 595 },+ },+ "page-header": {+ imports: ["PageHeader", "Text"],+ jsx: `<View>+ <PageHeader+ title="Invoice #1042"+ subtitle="Acme Corp"+ rightText="March 2026"+ rightSubText="Due: 2026-03-31"+ variant="simple"+ />+ <Text+ style={{ color: "#555555", fontSize: 10, lineHeight: 1.6, marginBottom: 6 }}+ >+ Prepared for Northwind Industries+ </Text>+ <Text+ style={{ color: "#555555", fontSize: 10, lineHeight: 1.6, marginBottom: 6 }}+ >+ This document demonstrates the simple page header variant.+ </Text>+ </View>`,+ margin: 30,+ size: { height: 240, width: 595 },+ },+ "page-number": {+ imports: ["Heading", "PdfPageNumber", "Text"],+ jsx: `<View style={{ minHeight: 680, position: "relative" }}>+ <View style={{ marginBottom: 60 }}>+ <Heading level={1}>Multi-Page Report</Heading>+ <Text>+ Page numbers make long reports easier to review, reference, and print.+ </Text>+ <Text>+ The format token displays the current page together with the total page count.+ </Text>+ </View>+ <View+ style={{ bottom: 0, left: 0, position: "absolute", right: 0 }}+ >+ <PdfPageNumber format="Page 1 of 1" align="center" />+ </View>+ </View>`,+ margin: 40,+ },+ "pdf-image": {+ extraImports: `import { PREVIEW_IMAGE_DATA_URI } from "@/examples/preview-assets";`,+ imports: ["PdfImage"],+ jsx: `<PdfImage+ src={PREVIEW_IMAGE_DATA_URI}+ variant="default"+ height={120}+ width={200}+ caption="Variant: default"+ />`,+ margin: 40,+ },+ qrcode: {+ imports: ["Heading", "PdfQRCode", "Section", "Stack", "Text"],+ jsx: `<Section spacing="none">+ <Heading level={1}>Invoice #12345</Heading>+ <Text>Amount Due: $500.00</Text>+ <Section>+ <Stack direction="horizontal" gap="lg" align="start">+ <PdfQRCode+ value="https://pdfcn.dev/pay/invoice-12345"+ size={100}+ caption="Scan to pay"+ />+ <PdfQRCode+ value="https://pdfcn.dev/verify/invoice-12345"+ size={80}+ caption="Verify document"+ />+ </Stack>+ </Section>+ <Text variant="sm" color="mutedForeground">+ QR codes are rendered as crisp vector graphics in the generated PDF.+ </Text>+ </Section>`,+ margin: 40,+ },+ section: {+ imports: ["Heading", "Section", "Text"],+ jsx: `<Section spacing="none">+ <Section spacing="lg">+ <Heading level={2}>Introduction</Heading>+ <Text>This section uses generous spacing for a primary document area.</Text>+ </Section>+ <Section spacing="md">+ <Heading level={2}>Details</Heading>+ <Text>This section groups related content with medium spacing.</Text>+ </Section>+ </Section>`,+ margin: 30,+ },+ signature: {+ imports: ["PdfSignatureBlock"],+ jsx: `<PdfSignatureBlock+ variant="single"+ label="Authorized By"+ name="John Doe"+ title="CEO, Acme Corp"+ date="15 February 2026"+ />`,+ margin: 40,+ },+ stack: {+ imports: ["Divider", "Heading", "Stack", "Text"],+ jsx: `<Stack gap="md">+ <Heading level={2}>Section</Heading>+ <Text>First paragraph in the stack.</Text>+ <Text>Second paragraph with consistent spacing.</Text>+ <Divider spacing="lg" />+ <Stack gap="lg">+ <Heading level={3}>Wider gap</Heading>+ <Text>Content grouped with a larger vertical rhythm.</Text>+ </Stack>+ </Stack>`,+ margin: 30,+ },+ table: {+ imports: [+ "Table",+ "TableBody",+ "TableCell",+ "TableFooter",+ "TableHeader",+ "TableRow",+ ],+ jsx: `<Table variant="line" zebraStripe={false}>+ <TableHeader>+ <TableRow header>+ <TableCell>Item</TableCell>+ <TableCell align="center">Qty</TableCell>+ <TableCell align="right">Price</TableCell>+ <TableCell align="right">Total</TableCell>+ </TableRow>+ </TableHeader>+ <TableBody>+ <TableRow>+ <TableCell>Design</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$150.00</TableCell>+ <TableCell align="right">$150.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Development</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ <TableCell align="right">$2,500.00</TableCell>+ </TableRow>+ <TableRow>+ <TableCell>Testing</TableCell>+ <TableCell align="center">1</TableCell>+ <TableCell align="right">$800.00</TableCell>+ <TableCell align="right">$800.00</TableCell>+ </TableRow>+ </TableBody>+ <TableFooter>+ <TableRow footer>+ <TableCell>Total</TableCell>+ <TableCell> </TableCell>+ <TableCell> </TableCell>+ <TableCell align="right">$3,450.00</TableCell>+ </TableRow>+ </TableFooter>+ </Table>`,+ margin: 40,+ },+ text: {+ imports: ["Section", "Text"],+ jsx: `<Section spacing="none">+ <Text>+ Default body text for paragraphs, descriptions, and document content.+ </Text>+ <Text variant="xs" color="mutedForeground">+ Caption text for metadata and supporting details.+ </Text>+ <Text variant="lg">Lead paragraph with a larger typographic scale.</Text>+ </Section>`,+ margin: 30,+ },+ watermark: {+ imports: ["Heading", "PdfWatermark", "Text"],+ jsx: `<View style={{ minHeight: 680, position: "relative" }}>+ <PdfWatermark text="DRAFT" />+ <Heading level={1}>Draft Document</Heading>+ <Text>+ This report is under review and should not be distributed externally.+ </Text>+ <Text>+ The watermark sits behind the content while remaining clearly visible.+ </Text>+ <Text>+ Use watermarks for draft, confidential, sample, or approval states.+ </Text>+ </View>`,+ margin: 40,+ },+};++const referenceDemoForComponent = (base, name) => {+ const config = REFERENCE_COMPONENT_DEMOS[name];+ if (!config) {+ return demoForComponent(base, name);+ }++ const isForme = base === "forme";+ const size = config.size ?? "A4";+ const sizeExpression =+ typeof size === "string"+ ? `"${size}"`+ : `{{ width: ${size.width}, height: ${size.height} }}`;+ const primitiveNames = [+ "Document",+ "Page",+ ...(config.jsx.includes("<View") ? ["View"] : []),+ ];+ const primitiveImport = isForme+ ? `import { ${primitiveNames.join(", ")} } from "@formepdf/react";`+ : `import { ${primitiveNames.join(", ")} } from "@/registry/bases/takumi/lib/takumi-primitives";+import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/pdfcn-theme-context";`;+ const providerOpen = isForme ? "" : " <PdfcnThemeProvider>\n";+ const providerClose = isForme ? "" : " </PdfcnThemeProvider>\n";+ const marginProp = isForme ? ` margin={${config.margin}}` : "";++ const extraImports = config.extraImports ? `\n${config.extraImports}` : "";++ return `${primitiveImport}${extraImports}+import { ${config.imports.join(", ")} } from "@/registry/bases/${base}/components";++const DemoBody = () => (+ ${config.jsx}+);++const Demo = () => {+ return (+ <Document>+ <Page size=${sizeExpression}${marginProp}>+${providerOpen} <DemoBody />+${providerClose} </Page>+ </Document>+ );+};++export default Demo;+`;};const demoForBlock = (base, name) => {@@ -364,7 +927,7 @@ const libFiles = (base) => {if (base === "takumi") {files.push("takumi-primitives.tsx", "takumi-svg.tsx");} else {- files.push("forme-svg.tsx", "maybe-fixed.tsx");+ files.push("forme-primitives.tsx", "forme-svg.tsx", "maybe-fixed.tsx");}return files.filter((f) =>@@ -380,6 +943,30 @@ const main = () => {const items = [];const demoImports = { forme: [], takumi: [] };+ fs.writeFileSync(+ path.join(ROOT, "examples/preview-assets.ts"),+ `export const PREVIEW_IMAGE_DATA_URI = ${JSON.stringify(PREVIEW_IMAGE_DATA_URI)};++export const replacePreviewImageSources = <T>(value: T): T => {+ if (value === "/favicon.png") {+ return PREVIEW_IMAGE_DATA_URI as T;+ }+ if (Array.isArray(value)) {+ return value.map((item) => replacePreviewImageSources(item)) as T;+ }+ if (value && typeof value === "object") {+ return Object.fromEntries(+ Object.entries(value).map(([key, item]) => [+ key,+ replacePreviewImageSources(item),+ ])+ ) as T;+ }+ return value;+};+`+ );+for (const base of ["takumi", "forme"]) {const deps =base === "takumi"@@ -421,7 +1008,7 @@ const main = () => {const demoPath = path.join(ROOT, `examples/${base}/${name}.tsx`);fs.mkdirSync(path.dirname(demoPath), { recursive: true });- fs.writeFileSync(demoPath, demoForComponent(base, name));+ fs.writeFileSync(demoPath, referenceDemoForComponent(base, name));demoImports[base].push(name);}@@ -511,7 +1098,7 @@ const main = () => {// examples indexlet indexSrc = `import type { ComponentType } from "react";\nimport type { BaseName } from "@/registry/bases";\n\n`;for (const base of ["takumi", "forme"]) {- for (const name of demoImports[base]) {+ for (const name of demoImports[base].toSorted()) {const ident = `${base}_${name.replaceAll("-", "_")}`;indexSrc += `import ${ident} from "@/examples/${base}/${name}";\n`;}@@ -519,7 +1106,7 @@ const main = () => {indexSrc += `\ntype DemoMap = Record<string, ComponentType>;\n\nexport const demos: Record<BaseName, DemoMap> = {\n`;for (const base of ["takumi", "forme"]) {indexSrc += ` ${base}: {\n`;- for (const name of demoImports[base]) {+ for (const name of demoImports[base].toSorted()) {const ident = `${base}_${name.replaceAll("-", "_")}`;indexSrc += ` "${name}": ${ident},\n`;}diff --git a/seo/metadata.ts b/seo/metadata.tsindex 2d02553..2d1dea4 100644--- a/seo/metadata.ts+++ b/seo/metadata.ts@@ -110,22 +110,10 @@ export const baseMetadata: Metadata = {url: "/favicon.ico",},{- sizes: "96x96",- type: "image/png",- url: "/favicon-96x96.png",- },- {- media: "(prefers-color-scheme: light)",sizes: "any",type: "image/svg+xml",url: "/favicon.svg",},- {- media: "(prefers-color-scheme: dark)",- sizes: "any",- type: "image/svg+xml",- url: "/favicon-dark.svg",- },],shortcut: "/favicon-16x16.png",},