Skip to content

armgit / pdfcn

Public Imported from GitHub
0

Beautiful pdf components, built on Takumi and Forme. 100% Free, Zero config, one command setup.

refactor: update component paths and improve theme integration in documentation for 'takumi' and 'forme'

Aniket-508cd5460d1bbb9
diff --git a/content/docs/(root)/installation.mdx b/content/docs/(root)/installation.mdx
index 918a4ba..a23f4e6 100644
--- a/content/docs/(root)/installation.mdx
+++ b/content/docs/(root)/installation.mdx
@@ -28,7 +28,7 @@ The registry installs the matching renderer dependencies and the shared theme ut
Import the installed component and use it inside your renderer's document primitives:
```tsx
-import { Document, Page } from "@/components/pdf/pdfcn-primitives";
+import { Document, Page } from "@/components/pdf/pdf-primitives";
import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
import { Text } from "@/components/pdf/text";
diff --git a/content/docs/blocks/forme/invoice-classic.mdx b/content/docs/blocks/forme/invoice-classic.mdx
index 1a5aee8..9ee1586 100644
--- a/content/docs/blocks/forme/invoice-classic.mdx
+++ b/content/docs/blocks/forme/invoice-classic.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/invoice-consultant.mdx b/content/docs/blocks/forme/invoice-consultant.mdx
index a9bdcfe..1fe3e68 100644
--- a/content/docs/blocks/forme/invoice-consultant.mdx
+++ b/content/docs/blocks/forme/invoice-consultant.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/invoice-corporate.mdx b/content/docs/blocks/forme/invoice-corporate.mdx
index 1ba4314..7c4ffba 100644
--- a/content/docs/blocks/forme/invoice-corporate.mdx
+++ b/content/docs/blocks/forme/invoice-corporate.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/invoice-creative.mdx b/content/docs/blocks/forme/invoice-creative.mdx
index 858aaa3..fa96895 100644
--- a/content/docs/blocks/forme/invoice-creative.mdx
+++ b/content/docs/blocks/forme/invoice-creative.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/invoice-minimal.mdx b/content/docs/blocks/forme/invoice-minimal.mdx
index 6c1f528..86993ce 100644
--- a/content/docs/blocks/forme/invoice-minimal.mdx
+++ b/content/docs/blocks/forme/invoice-minimal.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/invoice-modern.mdx b/content/docs/blocks/forme/invoice-modern.mdx
index 2a2ff46..326feb5 100644
--- a/content/docs/blocks/forme/invoice-modern.mdx
+++ b/content/docs/blocks/forme/invoice-modern.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/report-financial.mdx b/content/docs/blocks/forme/report-financial.mdx
index 791ff00..ed79c5c 100644
--- a/content/docs/blocks/forme/report-financial.mdx
+++ b/content/docs/blocks/forme/report-financial.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/report-marketing.mdx b/content/docs/blocks/forme/report-marketing.mdx
index 9529456..0da9721 100644
--- a/content/docs/blocks/forme/report-marketing.mdx
+++ b/content/docs/blocks/forme/report-marketing.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/report-operations.mdx b/content/docs/blocks/forme/report-operations.mdx
index 174898a..59aafb3 100644
--- a/content/docs/blocks/forme/report-operations.mdx
+++ b/content/docs/blocks/forme/report-operations.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/forme/report-security.mdx b/content/docs/blocks/forme/report-security.mdx
index 25de4e5..7afea8e 100644
--- a/content/docs/blocks/forme/report-security.mdx
+++ b/content/docs/blocks/forme/report-security.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/blocks/takumi/invoice-classic.mdx b/content/docs/blocks/takumi/invoice-classic.mdx
index d70b6a1..d0520a0 100644
--- a/content/docs/blocks/takumi/invoice-classic.mdx
+++ b/content/docs/blocks/takumi/invoice-classic.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-consultant.mdx b/content/docs/blocks/takumi/invoice-consultant.mdx
index c790504..caafa75 100644
--- a/content/docs/blocks/takumi/invoice-consultant.mdx
+++ b/content/docs/blocks/takumi/invoice-consultant.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-corporate.mdx b/content/docs/blocks/takumi/invoice-corporate.mdx
index 3115475..1c7e45c 100644
--- a/content/docs/blocks/takumi/invoice-corporate.mdx
+++ b/content/docs/blocks/takumi/invoice-corporate.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-creative.mdx b/content/docs/blocks/takumi/invoice-creative.mdx
index 35a3bf4..d05b667 100644
--- a/content/docs/blocks/takumi/invoice-creative.mdx
+++ b/content/docs/blocks/takumi/invoice-creative.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-minimal.mdx b/content/docs/blocks/takumi/invoice-minimal.mdx
index 3d384f1..b779e20 100644
--- a/content/docs/blocks/takumi/invoice-minimal.mdx
+++ b/content/docs/blocks/takumi/invoice-minimal.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-modern.mdx b/content/docs/blocks/takumi/invoice-modern.mdx
index 670d48b..f3dc39e 100644
--- a/content/docs/blocks/takumi/invoice-modern.mdx
+++ b/content/docs/blocks/takumi/invoice-modern.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/report-financial.mdx b/content/docs/blocks/takumi/report-financial.mdx
index 8228dc1..bbada0c 100644
--- a/content/docs/blocks/takumi/report-financial.mdx
+++ b/content/docs/blocks/takumi/report-financial.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/report-marketing.mdx b/content/docs/blocks/takumi/report-marketing.mdx
index c862fd0..831dc3e 100644
--- a/content/docs/blocks/takumi/report-marketing.mdx
+++ b/content/docs/blocks/takumi/report-marketing.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/report-operations.mdx b/content/docs/blocks/takumi/report-operations.mdx
index 0481457..9c4039d 100644
--- a/content/docs/blocks/takumi/report-operations.mdx
+++ b/content/docs/blocks/takumi/report-operations.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/report-security.mdx b/content/docs/blocks/takumi/report-security.mdx
index a2f5131..17d4a1c 100644
--- a/content/docs/blocks/takumi/report-security.mdx
+++ b/content/docs/blocks/takumi/report-security.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/alert.mdx b/content/docs/components/forme/alert.mdx
index 97b24e7..f83f340 100644
--- a/content/docs/components/forme/alert.mdx
+++ b/content/docs/components/forme/alert.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/badge.mdx b/content/docs/components/forme/badge.mdx
index f712fe4..d89e0db 100644
--- a/content/docs/components/forme/badge.mdx
+++ b/content/docs/components/forme/badge.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/card.mdx b/content/docs/components/forme/card.mdx
index 44446c4..beaa546 100644
--- a/content/docs/components/forme/card.mdx
+++ b/content/docs/components/forme/card.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/data-table.mdx b/content/docs/components/forme/data-table.mdx
index 7b7d3d6..e0305d2 100644
--- a/content/docs/components/forme/data-table.mdx
+++ b/content/docs/components/forme/data-table.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/divider.mdx b/content/docs/components/forme/divider.mdx
index aa22c17..c404fed 100644
--- a/content/docs/components/forme/divider.mdx
+++ b/content/docs/components/forme/divider.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/form.mdx b/content/docs/components/forme/form.mdx
index 7636e08..7a5089c 100644
--- a/content/docs/components/forme/form.mdx
+++ b/content/docs/components/forme/form.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/graph.mdx b/content/docs/components/forme/graph.mdx
index f128f25..ff244c8 100644
--- a/content/docs/components/forme/graph.mdx
+++ b/content/docs/components/forme/graph.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/heading.mdx b/content/docs/components/forme/heading.mdx
index 47f42d7..2882e22 100644
--- a/content/docs/components/forme/heading.mdx
+++ b/content/docs/components/forme/heading.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/keep-together.mdx b/content/docs/components/forme/keep-together.mdx
index 58a94f3..eb8fda9 100644
--- a/content/docs/components/forme/keep-together.mdx
+++ b/content/docs/components/forme/keep-together.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/key-value.mdx b/content/docs/components/forme/key-value.mdx
index 1859e0b..84549fc 100644
--- a/content/docs/components/forme/key-value.mdx
+++ b/content/docs/components/forme/key-value.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/link.mdx b/content/docs/components/forme/link.mdx
index e116408..75552b5 100644
--- a/content/docs/components/forme/link.mdx
+++ b/content/docs/components/forme/link.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/list.mdx b/content/docs/components/forme/list.mdx
index 2717950..6a6e256 100644
--- a/content/docs/components/forme/list.mdx
+++ b/content/docs/components/forme/list.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/page-break.mdx b/content/docs/components/forme/page-break.mdx
index b028430..6cb64d1 100644
--- a/content/docs/components/forme/page-break.mdx
+++ b/content/docs/components/forme/page-break.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/page-footer.mdx b/content/docs/components/forme/page-footer.mdx
index cb774d6..48b51e6 100644
--- a/content/docs/components/forme/page-footer.mdx
+++ b/content/docs/components/forme/page-footer.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/page-header.mdx b/content/docs/components/forme/page-header.mdx
index 53666c8..ac13d84 100644
--- a/content/docs/components/forme/page-header.mdx
+++ b/content/docs/components/forme/page-header.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/page-number.mdx b/content/docs/components/forme/page-number.mdx
index bc96616..21725b6 100644
--- a/content/docs/components/forme/page-number.mdx
+++ b/content/docs/components/forme/page-number.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/pdf-image.mdx b/content/docs/components/forme/pdf-image.mdx
index dbc7087..34b1fdd 100644
--- a/content/docs/components/forme/pdf-image.mdx
+++ b/content/docs/components/forme/pdf-image.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/qrcode.mdx b/content/docs/components/forme/qrcode.mdx
index 4a61d12..f64c84a 100644
--- a/content/docs/components/forme/qrcode.mdx
+++ b/content/docs/components/forme/qrcode.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/section.mdx b/content/docs/components/forme/section.mdx
index 559b857..e744a51 100644
--- a/content/docs/components/forme/section.mdx
+++ b/content/docs/components/forme/section.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/signature.mdx b/content/docs/components/forme/signature.mdx
index 061a16e..a9b7987 100644
--- a/content/docs/components/forme/signature.mdx
+++ b/content/docs/components/forme/signature.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/stack.mdx b/content/docs/components/forme/stack.mdx
index a4e3db5..be1ac34 100644
--- a/content/docs/components/forme/stack.mdx
+++ b/content/docs/components/forme/stack.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/table.mdx b/content/docs/components/forme/table.mdx
index 0b9307f..7648bf2 100644
--- a/content/docs/components/forme/table.mdx
+++ b/content/docs/components/forme/table.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/text.mdx b/content/docs/components/forme/text.mdx
index 5c70a0b..8bf33a2 100644
--- a/content/docs/components/forme/text.mdx
+++ b/content/docs/components/forme/text.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/forme/watermark.mdx b/content/docs/components/forme/watermark.mdx
index d0ad829..7a61984 100644
--- a/content/docs/components/forme/watermark.mdx
+++ b/content/docs/components/forme/watermark.mdx
@@ -41,17 +41,11 @@ npm install @formepdf/react @formepdf/core
/>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
base="forme"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/forme/lib/pdfcn-theme.ts"
- base="forme"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
diff --git a/content/docs/components/takumi/alert.mdx b/content/docs/components/takumi/alert.mdx
index f36de9a..3cd4d48 100644
--- a/content/docs/components/takumi/alert.mdx
+++ b/content/docs/components/takumi/alert.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/badge.mdx b/content/docs/components/takumi/badge.mdx
index a0027f2..b95b600 100644
--- a/content/docs/components/takumi/badge.mdx
+++ b/content/docs/components/takumi/badge.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/card.mdx b/content/docs/components/takumi/card.mdx
index 0c92326..1412955 100644
--- a/content/docs/components/takumi/card.mdx
+++ b/content/docs/components/takumi/card.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/data-table.mdx b/content/docs/components/takumi/data-table.mdx
index 3395fe8..e3f5d1f 100644
--- a/content/docs/components/takumi/data-table.mdx
+++ b/content/docs/components/takumi/data-table.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/divider.mdx b/content/docs/components/takumi/divider.mdx
index 4fc7791..28a8a31 100644
--- a/content/docs/components/takumi/divider.mdx
+++ b/content/docs/components/takumi/divider.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/form.mdx b/content/docs/components/takumi/form.mdx
index 41d8426..e7e75fa 100644
--- a/content/docs/components/takumi/form.mdx
+++ b/content/docs/components/takumi/form.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/graph.mdx b/content/docs/components/takumi/graph.mdx
index e00d9c4..3c3c8a2 100644
--- a/content/docs/components/takumi/graph.mdx
+++ b/content/docs/components/takumi/graph.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/heading.mdx b/content/docs/components/takumi/heading.mdx
index 11b7e91..32ba506 100644
--- a/content/docs/components/takumi/heading.mdx
+++ b/content/docs/components/takumi/heading.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/keep-together.mdx b/content/docs/components/takumi/keep-together.mdx
index 5bb2998..34a3ea6 100644
--- a/content/docs/components/takumi/keep-together.mdx
+++ b/content/docs/components/takumi/keep-together.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/key-value.mdx b/content/docs/components/takumi/key-value.mdx
index c1899af..c51e70e 100644
--- a/content/docs/components/takumi/key-value.mdx
+++ b/content/docs/components/takumi/key-value.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/link.mdx b/content/docs/components/takumi/link.mdx
index 5c3d202..631f6ad 100644
--- a/content/docs/components/takumi/link.mdx
+++ b/content/docs/components/takumi/link.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/list.mdx b/content/docs/components/takumi/list.mdx
index 2ac14f1..c5f4fb6 100644
--- a/content/docs/components/takumi/list.mdx
+++ b/content/docs/components/takumi/list.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/page-break.mdx b/content/docs/components/takumi/page-break.mdx
index d4c6ecf..560dece 100644
--- a/content/docs/components/takumi/page-break.mdx
+++ b/content/docs/components/takumi/page-break.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/page-footer.mdx b/content/docs/components/takumi/page-footer.mdx
index 0334434..be42948 100644
--- a/content/docs/components/takumi/page-footer.mdx
+++ b/content/docs/components/takumi/page-footer.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/page-header.mdx b/content/docs/components/takumi/page-header.mdx
index 93ec137..aecdc1c 100644
--- a/content/docs/components/takumi/page-header.mdx
+++ b/content/docs/components/takumi/page-header.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/page-number.mdx b/content/docs/components/takumi/page-number.mdx
index 01bfe8f..f57c515 100644
--- a/content/docs/components/takumi/page-number.mdx
+++ b/content/docs/components/takumi/page-number.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/pdf-image.mdx b/content/docs/components/takumi/pdf-image.mdx
index 6260f37..2dc002e 100644
--- a/content/docs/components/takumi/pdf-image.mdx
+++ b/content/docs/components/takumi/pdf-image.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/qrcode.mdx b/content/docs/components/takumi/qrcode.mdx
index 819d1dc..03f4742 100644
--- a/content/docs/components/takumi/qrcode.mdx
+++ b/content/docs/components/takumi/qrcode.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/section.mdx b/content/docs/components/takumi/section.mdx
index 6e18a97..4016bb2 100644
--- a/content/docs/components/takumi/section.mdx
+++ b/content/docs/components/takumi/section.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/signature.mdx b/content/docs/components/takumi/signature.mdx
index eb99904..c97b9fe 100644
--- a/content/docs/components/takumi/signature.mdx
+++ b/content/docs/components/takumi/signature.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/stack.mdx b/content/docs/components/takumi/stack.mdx
index f6e6b5b..8366e4a 100644
--- a/content/docs/components/takumi/stack.mdx
+++ b/content/docs/components/takumi/stack.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/table.mdx b/content/docs/components/takumi/table.mdx
index ffee339..c1094b1 100644
--- a/content/docs/components/takumi/table.mdx
+++ b/content/docs/components/takumi/table.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/text.mdx b/content/docs/components/takumi/text.mdx
index eb17456..c04b9c7 100644
--- a/content/docs/components/takumi/text.mdx
+++ b/content/docs/components/takumi/text.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/watermark.mdx b/content/docs/components/takumi/watermark.mdx
index 381107a..186d456 100644
--- a/content/docs/components/takumi/watermark.mdx
+++ b/content/docs/components/takumi/watermark.mdx
@@ -41,17 +41,11 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
base="takumi"
title="components/pdf/theme-provider.tsx"
/>
-<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-theme.ts"
- base="takumi"
- title="components/pdf/pdfcn-theme.ts"
-/>
-
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
@@ -59,15 +53,15 @@ npm install takumi-pdf @takumi-rs/helpers
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
+ src="registry/bases/takumi/lib/pdf-primitives.tsx"
base="takumi"
- title="lib/pdfcn-primitives.tsx"
+ title="lib/pdf-primitives.tsx"
/>
<ComponentSource
- src="registry/bases/takumi/lib/pdfcn-svg.tsx"
+ src="registry/bases/takumi/lib/pdf-svg.tsx"
base="takumi"
- title="lib/pdfcn-svg.tsx"
+ title="lib/pdf-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/themes/blueprint.mdx b/content/docs/themes/blueprint.mdx
index 4d4aee7..6930710 100644
--- a/content/docs/themes/blueprint.mdx
+++ b/content/docs/themes/blueprint.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-blueprint
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { blueprintTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { blueprintTheme } from "@/lib/pdf-themes/blueprint";
export function Invoice() {
return (
diff --git a/content/docs/themes/corporate.mdx b/content/docs/themes/corporate.mdx
index bbadc75..3f8326a 100644
--- a/content/docs/themes/corporate.mdx
+++ b/content/docs/themes/corporate.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-corporate
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { corporateTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { corporateTheme } from "@/lib/pdf-themes/corporate";
export function Invoice() {
return (
diff --git a/content/docs/themes/elegant.mdx b/content/docs/themes/elegant.mdx
index aebbf14..211157c 100644
--- a/content/docs/themes/elegant.mdx
+++ b/content/docs/themes/elegant.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-elegant
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { elegantTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { elegantTheme } from "@/lib/pdf-themes/elegant";
export function Invoice() {
return (
diff --git a/content/docs/themes/executive.mdx b/content/docs/themes/executive.mdx
index 3b79750..02b7f44 100644
--- a/content/docs/themes/executive.mdx
+++ b/content/docs/themes/executive.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-executive
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { executiveTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { executiveTheme } from "@/lib/pdf-themes/executive";
export function Invoice() {
return (
diff --git a/content/docs/themes/forest.mdx b/content/docs/themes/forest.mdx
index 843e708..df4ed49 100644
--- a/content/docs/themes/forest.mdx
+++ b/content/docs/themes/forest.mdx
@@ -46,8 +46,8 @@ npx shadcn@latest add @pdfcn/theme-forest
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { forestTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { forestTheme } from "@/lib/pdf-themes/forest";
export function Invoice() {
return (
diff --git a/content/docs/themes/minimal.mdx b/content/docs/themes/minimal.mdx
index ab68ad8..3057641 100644
--- a/content/docs/themes/minimal.mdx
+++ b/content/docs/themes/minimal.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-minimal
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { minimalTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { minimalTheme } from "@/lib/pdf-themes/minimal";
export function Invoice() {
return (
diff --git a/content/docs/themes/modern.mdx b/content/docs/themes/modern.mdx
index c7d9d86..4419c0b 100644
--- a/content/docs/themes/modern.mdx
+++ b/content/docs/themes/modern.mdx
@@ -46,8 +46,8 @@ npx shadcn@latest add @pdfcn/theme-modern
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { modernTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { modernTheme } from "@/lib/pdf-themes/modern";
export function Invoice() {
return (
diff --git a/content/docs/themes/professional.mdx b/content/docs/themes/professional.mdx
index 12cb256..51e6b1a 100644
--- a/content/docs/themes/professional.mdx
+++ b/content/docs/themes/professional.mdx
@@ -49,8 +49,8 @@ npx shadcn@latest add @pdfcn/theme-professional
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { professionalTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { professionalTheme } from "@/lib/pdf-themes/professional";
export function Invoice() {
return (
diff --git a/content/docs/themes/vivid.mdx b/content/docs/themes/vivid.mdx
index c35d9b9..fe86d80 100644
--- a/content/docs/themes/vivid.mdx
+++ b/content/docs/themes/vivid.mdx
@@ -46,8 +46,8 @@ npx shadcn@latest add @pdfcn/theme-vivid
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { vividTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { vividTheme } from "@/lib/pdf-themes/vivid";
export function Invoice() {
return (
diff --git a/content/docs/theming/forme/index.mdx b/content/docs/theming/forme/index.mdx
index f0339ce..b4ed2fb 100644
--- a/content/docs/theming/forme/index.mdx
+++ b/content/docs/theming/forme/index.mdx
@@ -19,7 +19,7 @@ import { ThemePreviewGrid } from "@/components/theme-preview-grid";
<TabsContent value="cli">
```bash
-npx shadcn@latest add @pdfcn/theme-provider
+npx shadcn@latest add @pdfcn/forme/theme-provider
```
</TabsContent>
@@ -30,7 +30,7 @@ npx shadcn@latest add @pdfcn/theme-provider
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource
- src="registry/bases/forme/lib/theme-provider.tsx"
+ src="registry/bases/forme/components/theme-provider.tsx"
title="components/theme-provider.tsx"
/>
@@ -45,8 +45,8 @@ npx shadcn@latest add @pdfcn/theme-provider
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/forme/components";
-import { professionalTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { professionalTheme } from "@/lib/pdf-themes/professional";
export function Invoice() {
return (
diff --git a/content/docs/theming/takumi/index.mdx b/content/docs/theming/takumi/index.mdx
index 97384be..cb9275f 100644
--- a/content/docs/theming/takumi/index.mdx
+++ b/content/docs/theming/takumi/index.mdx
@@ -19,7 +19,7 @@ import { ThemePreviewGrid } from "@/components/theme-preview-grid";
<TabsContent value="cli">
```bash
-npx shadcn@latest add @pdfcn/theme-provider
+npx shadcn@latest add @pdfcn/takumi/theme-provider
```
</TabsContent>
@@ -30,7 +30,7 @@ npx shadcn@latest add @pdfcn/theme-provider
<Step>Copy and paste the following code into your project.</Step>
<ComponentSource
- src="registry/bases/takumi/lib/theme-provider.tsx"
+ src="registry/bases/takumi/components/theme-provider.tsx"
title="components/theme-provider.tsx"
/>
@@ -45,8 +45,8 @@ npx shadcn@latest add @pdfcn/theme-provider
## Usage
```tsx
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/components";
-import { professionalTheme } from "@/registry/themes";
+import { PdfcnThemeProvider } from "@/components/pdf/theme-provider";
+import { professionalTheme } from "@/lib/pdf-themes/professional";
export function Invoice() {
return (
diff --git a/examples/forme/alert.tsx b/examples/forme/alert.tsx
index effa8c2..129a8eb 100644
--- a/examples/forme/alert.tsx
+++ b/examples/forme/alert.tsx
@@ -1,11 +1,9 @@
import { Document, Page } from "@formepdf/react";
-import {
- Heading,
- PdfAlert,
- Section,
- Text,
-} from "@/registry/bases/forme/components";
+import { PdfAlert } from "@/registry/bases/forme/components/alert";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Section } from "@/registry/bases/forme/components/section";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/badge.tsx b/examples/forme/badge.tsx
index 180542a..bafe108 100644
--- a/examples/forme/badge.tsx
+++ b/examples/forme/badge.tsx
@@ -1,6 +1,6 @@
import { Document, Page, View } from "@formepdf/react";
-import { Badge } from "@/registry/bases/forme/components";
+import { Badge } from "@/registry/bases/forme/components/badge";
const DemoBody = () => (
<View
diff --git a/examples/forme/card.tsx b/examples/forme/card.tsx
index 6a2aa1d..1047ee1 100644
--- a/examples/forme/card.tsx
+++ b/examples/forme/card.tsx
@@ -1,6 +1,7 @@
import { Document, Page } from "@formepdf/react";
-import { PdfCard, Text } from "@/registry/bases/forme/components";
+import { PdfCard } from "@/registry/bases/forme/components/card";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<PdfCard title="Project Summary" variant="default" padding="md">
diff --git a/examples/forme/data-table.tsx b/examples/forme/data-table.tsx
index 029f3d1..c883329 100644
--- a/examples/forme/data-table.tsx
+++ b/examples/forme/data-table.tsx
@@ -1,6 +1,8 @@
import { Document, Page } from "@formepdf/react";
-import { DataTable, Heading, Section } from "@/registry/bases/forme/components";
+import { DataTable } from "@/registry/bases/forme/components/data-table";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Section } from "@/registry/bases/forme/components/section";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/divider.tsx b/examples/forme/divider.tsx
index a0fd548..a0c4276 100644
--- a/examples/forme/divider.tsx
+++ b/examples/forme/divider.tsx
@@ -1,6 +1,8 @@
import { Document, Page, View } from "@formepdf/react";
-import { Divider, Heading, Text } from "@/registry/bases/forme/components";
+import { Divider } from "@/registry/bases/forme/components/divider";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<View>
diff --git a/examples/forme/form.tsx b/examples/forme/form.tsx
index d9af9c0..979e18b 100644
--- a/examples/forme/form.tsx
+++ b/examples/forme/form.tsx
@@ -1,6 +1,6 @@
import { Document, Page } from "@formepdf/react";
-import { PdfForm } from "@/registry/bases/forme/components";
+import { PdfForm } from "@/registry/bases/forme/components/form";
const DemoBody = () => (
<PdfForm
diff --git a/examples/forme/graph.tsx b/examples/forme/graph.tsx
index e945611..db7d314 100644
--- a/examples/forme/graph.tsx
+++ b/examples/forme/graph.tsx
@@ -1,6 +1,6 @@
import { Document, Page } from "@formepdf/react";
-import { PdfGraph } from "@/registry/bases/forme/components";
+import { PdfGraph } from "@/registry/bases/forme/components/graph";
const DemoBody = () => (
<PdfGraph
diff --git a/examples/forme/heading.tsx b/examples/forme/heading.tsx
index befd543..e48a020 100644
--- a/examples/forme/heading.tsx
+++ b/examples/forme/heading.tsx
@@ -1,6 +1,7 @@
import { Document, Page } from "@formepdf/react";
-import { Heading, Section } from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Section } from "@/registry/bases/forme/components/section";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/keep-together.tsx b/examples/forme/keep-together.tsx
index 756df51..a111f98 100644
--- a/examples/forme/keep-together.tsx
+++ b/examples/forme/keep-together.tsx
@@ -1,11 +1,9 @@
import { Document, Page } from "@formepdf/react";
-import {
- Heading,
- KeepTogether,
- Section,
- Text,
-} from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { KeepTogether } from "@/registry/bases/forme/components/keep-together";
+import { Section } from "@/registry/bases/forme/components/section";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/key-value.tsx b/examples/forme/key-value.tsx
index 053b769..c63d67a 100644
--- a/examples/forme/key-value.tsx
+++ b/examples/forme/key-value.tsx
@@ -1,6 +1,6 @@
import { Document, Page } from "@formepdf/react";
-import { KeyValue } from "@/registry/bases/forme/components";
+import { KeyValue } from "@/registry/bases/forme/components/key-value";
const DemoBody = () => (
<KeyValue
diff --git a/examples/forme/link.tsx b/examples/forme/link.tsx
index 26ecefa..27ac6e6 100644
--- a/examples/forme/link.tsx
+++ b/examples/forme/link.tsx
@@ -1,6 +1,7 @@
import { Document, Page } from "@formepdf/react";
-import { Link, Section } from "@/registry/bases/forme/components";
+import { Link } from "@/registry/bases/forme/components/link";
+import { Section } from "@/registry/bases/forme/components/section";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/list.tsx b/examples/forme/list.tsx
index 3a885ba..30e61b4 100644
--- a/examples/forme/list.tsx
+++ b/examples/forme/list.tsx
@@ -1,6 +1,6 @@
import { Document, Page } from "@formepdf/react";
-import { PdfList } from "@/registry/bases/forme/components";
+import { PdfList } from "@/registry/bases/forme/components/list";
const DemoBody = () => (
<PdfList
diff --git a/examples/forme/page-break.tsx b/examples/forme/page-break.tsx
index b5033d2..e26c2e4 100644
--- a/examples/forme/page-break.tsx
+++ b/examples/forme/page-break.tsx
@@ -1,6 +1,8 @@
import { Document, Page, View } from "@formepdf/react";
-import { Heading, PageBreak, Text } from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { PageBreak } from "@/registry/bases/forme/components/page-break";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<View>
diff --git a/examples/forme/page-footer.tsx b/examples/forme/page-footer.tsx
index f77433a..bf3558c 100644
--- a/examples/forme/page-footer.tsx
+++ b/examples/forme/page-footer.tsx
@@ -1,6 +1,7 @@
import { Document, Page, View } from "@formepdf/react";
-import { PageFooter, Text } from "@/registry/bases/forme/components";
+import { PageFooter } from "@/registry/bases/forme/components/page-footer";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<View style={{ display: "flex", flexDirection: "column", minHeight: 220 }}>
diff --git a/examples/forme/page-header.tsx b/examples/forme/page-header.tsx
index 809c15a..c4cf28a 100644
--- a/examples/forme/page-header.tsx
+++ b/examples/forme/page-header.tsx
@@ -1,6 +1,7 @@
import { Document, Page, View } from "@formepdf/react";
-import { PageHeader, Text } from "@/registry/bases/forme/components";
+import { PageHeader } from "@/registry/bases/forme/components/page-header";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<View>
diff --git a/examples/forme/page-number.tsx b/examples/forme/page-number.tsx
index 585e7b1..c21cb3e 100644
--- a/examples/forme/page-number.tsx
+++ b/examples/forme/page-number.tsx
@@ -1,10 +1,8 @@
import { Document, Page, View } from "@formepdf/react";
-import {
- Heading,
- PdfPageNumber,
- Text,
-} from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { PdfPageNumber } from "@/registry/bases/forme/components/page-number";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<View style={{ minHeight: 680, position: "relative" }}>
diff --git a/examples/forme/pdf-image.tsx b/examples/forme/pdf-image.tsx
index 83364b6..e4d0180 100644
--- a/examples/forme/pdf-image.tsx
+++ b/examples/forme/pdf-image.tsx
@@ -1,7 +1,7 @@
import { Document, Page } from "@formepdf/react";
import { PREVIEW_IMAGE_DATA_URI } from "@/examples/preview-assets";
-import { PdfImage } from "@/registry/bases/forme/components";
+import { PdfImage } from "@/registry/bases/forme/components/pdf-image";
const DemoBody = () => (
<PdfImage
diff --git a/examples/forme/qrcode.tsx b/examples/forme/qrcode.tsx
index 50f3e47..530d635 100644
--- a/examples/forme/qrcode.tsx
+++ b/examples/forme/qrcode.tsx
@@ -1,12 +1,10 @@
import { Document, Page } from "@formepdf/react";
-import {
- Heading,
- PdfQRCode,
- Section,
- Stack,
- Text,
-} from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { PdfQRCode } from "@/registry/bases/forme/components/qrcode";
+import { Section } from "@/registry/bases/forme/components/section";
+import { Stack } from "@/registry/bases/forme/components/stack";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/section.tsx b/examples/forme/section.tsx
index 5df1835..ffece1d 100644
--- a/examples/forme/section.tsx
+++ b/examples/forme/section.tsx
@@ -1,6 +1,8 @@
import { Document, Page } from "@formepdf/react";
-import { Heading, Section, Text } from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Section } from "@/registry/bases/forme/components/section";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/signature.tsx b/examples/forme/signature.tsx
index 611befc..c2cfb44 100644
--- a/examples/forme/signature.tsx
+++ b/examples/forme/signature.tsx
@@ -1,6 +1,6 @@
import { Document, Page } from "@formepdf/react";
-import { PdfSignatureBlock } from "@/registry/bases/forme/components";
+import { PdfSignatureBlock } from "@/registry/bases/forme/components/signature";
const DemoBody = () => (
<PdfSignatureBlock
diff --git a/examples/forme/stack.tsx b/examples/forme/stack.tsx
index 15c8e1b..61682b2 100644
--- a/examples/forme/stack.tsx
+++ b/examples/forme/stack.tsx
@@ -1,11 +1,9 @@
import { Document, Page } from "@formepdf/react";
-import {
- Divider,
- Heading,
- Stack,
- Text,
-} from "@/registry/bases/forme/components";
+import { Divider } from "@/registry/bases/forme/components/divider";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Stack } from "@/registry/bases/forme/components/stack";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Stack gap="md">
diff --git a/examples/forme/table.tsx b/examples/forme/table.tsx
index d56a82d..1c8c814 100644
--- a/examples/forme/table.tsx
+++ b/examples/forme/table.tsx
@@ -7,7 +7,7 @@ import {
TableFooter,
TableHeader,
TableRow,
-} from "@/registry/bases/forme/components";
+} from "@/registry/bases/forme/components/table";
const DemoBody = () => (
<Table variant="line" zebraStripe={false}>
diff --git a/examples/forme/text.tsx b/examples/forme/text.tsx
index ed70f7c..8277a31 100644
--- a/examples/forme/text.tsx
+++ b/examples/forme/text.tsx
@@ -1,6 +1,7 @@
import { Document, Page } from "@formepdf/react";
-import { Section, Text } from "@/registry/bases/forme/components";
+import { Section } from "@/registry/bases/forme/components/section";
+import { Text } from "@/registry/bases/forme/components/text";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/forme/watermark.tsx b/examples/forme/watermark.tsx
index 6738359..bb0afea 100644
--- a/examples/forme/watermark.tsx
+++ b/examples/forme/watermark.tsx
@@ -1,6 +1,8 @@
import { Document, Page, View } from "@formepdf/react";
-import { Heading, PdfWatermark, Text } from "@/registry/bases/forme/components";
+import { Heading } from "@/registry/bases/forme/components/heading";
+import { Text } from "@/registry/bases/forme/components/text";
+import { PdfWatermark } from "@/registry/bases/forme/components/watermark";
const DemoBody = () => (
<View style={{ minHeight: 680, position: "relative" }}>
diff --git a/examples/preview-config.ts b/examples/preview-config.ts
index 61a8c5b..bbddc1c 100644
--- a/examples/preview-config.ts
+++ b/examples/preview-config.ts
@@ -1,6 +1,6 @@
import type { RenderOptions } from "takumi-pdf";
-import { pointToCssPixel } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+import { pointToCssPixel } from "@/registry/bases/takumi/lib/pdf-primitives";
const DEFAULT_MARGIN = 40;
diff --git a/examples/takumi/alert.tsx b/examples/takumi/alert.tsx
index fa86475..f813405 100644
--- a/examples/takumi/alert.tsx
+++ b/examples/takumi/alert.tsx
@@ -1,11 +1,9 @@
-import {
- Heading,
- PdfAlert,
- Section,
- Text,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfAlert } from "@/registry/bases/takumi/components/alert";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/badge.tsx b/examples/takumi/badge.tsx
index a42c53b..bcaadb9 100644
--- a/examples/takumi/badge.tsx
+++ b/examples/takumi/badge.tsx
@@ -1,10 +1,10 @@
-import { Badge } from "@/registry/bases/takumi/components";
+import { Badge } from "@/registry/bases/takumi/components/badge";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View
diff --git a/examples/takumi/card.tsx b/examples/takumi/card.tsx
index d99fb31..7eca85c 100644
--- a/examples/takumi/card.tsx
+++ b/examples/takumi/card.tsx
@@ -1,6 +1,7 @@
-import { PdfCard, Text } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfCard } from "@/registry/bases/takumi/components/card";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfCard title="Project Summary" variant="default" padding="md">
diff --git a/examples/takumi/data-table.tsx b/examples/takumi/data-table.tsx
index 531c703..9a819dc 100644
--- a/examples/takumi/data-table.tsx
+++ b/examples/takumi/data-table.tsx
@@ -1,10 +1,8 @@
-import {
- DataTable,
- Heading,
- Section,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { DataTable } from "@/registry/bases/takumi/components/data-table";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/divider.tsx b/examples/takumi/divider.tsx
index 54705aa..fd38cd7 100644
--- a/examples/takumi/divider.tsx
+++ b/examples/takumi/divider.tsx
@@ -1,10 +1,12 @@
-import { Divider, Heading, Text } from "@/registry/bases/takumi/components";
+import { Divider } from "@/registry/bases/takumi/components/divider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View>
diff --git a/examples/takumi/form.tsx b/examples/takumi/form.tsx
index 4949547..a996fa4 100644
--- a/examples/takumi/form.tsx
+++ b/examples/takumi/form.tsx
@@ -1,6 +1,6 @@
-import { PdfForm } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfForm } from "@/registry/bases/takumi/components/form";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfForm
diff --git a/examples/takumi/graph.tsx b/examples/takumi/graph.tsx
index f82a500..b87422d 100644
--- a/examples/takumi/graph.tsx
+++ b/examples/takumi/graph.tsx
@@ -1,6 +1,6 @@
-import { PdfGraph } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfGraph } from "@/registry/bases/takumi/components/graph";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfGraph
diff --git a/examples/takumi/heading.tsx b/examples/takumi/heading.tsx
index 0cf12fe..929db28 100644
--- a/examples/takumi/heading.tsx
+++ b/examples/takumi/heading.tsx
@@ -1,6 +1,7 @@
-import { Heading, Section } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/keep-together.tsx b/examples/takumi/keep-together.tsx
index b54a3e2..ea417fe 100644
--- a/examples/takumi/keep-together.tsx
+++ b/examples/takumi/keep-together.tsx
@@ -1,11 +1,9 @@
-import {
- Heading,
- KeepTogether,
- Section,
- Text,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { KeepTogether } from "@/registry/bases/takumi/components/keep-together";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/key-value.tsx b/examples/takumi/key-value.tsx
index 29ffe53..795c9e7 100644
--- a/examples/takumi/key-value.tsx
+++ b/examples/takumi/key-value.tsx
@@ -1,6 +1,6 @@
-import { KeyValue } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { KeyValue } from "@/registry/bases/takumi/components/key-value";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<KeyValue
diff --git a/examples/takumi/link.tsx b/examples/takumi/link.tsx
index a3cf256..6a22925 100644
--- a/examples/takumi/link.tsx
+++ b/examples/takumi/link.tsx
@@ -1,6 +1,7 @@
-import { Link, Section } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Link } from "@/registry/bases/takumi/components/link";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/list.tsx b/examples/takumi/list.tsx
index bd99c1f..6183b76 100644
--- a/examples/takumi/list.tsx
+++ b/examples/takumi/list.tsx
@@ -1,6 +1,6 @@
-import { PdfList } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfList } from "@/registry/bases/takumi/components/list";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfList
diff --git a/examples/takumi/page-break.tsx b/examples/takumi/page-break.tsx
index 8b5e12f..f89dd71 100644
--- a/examples/takumi/page-break.tsx
+++ b/examples/takumi/page-break.tsx
@@ -1,10 +1,12 @@
-import { Heading, PageBreak, Text } from "@/registry/bases/takumi/components";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { PageBreak } from "@/registry/bases/takumi/components/page-break";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View>
diff --git a/examples/takumi/page-footer.tsx b/examples/takumi/page-footer.tsx
index 5de73a9..de91b41 100644
--- a/examples/takumi/page-footer.tsx
+++ b/examples/takumi/page-footer.tsx
@@ -1,10 +1,11 @@
-import { PageFooter, Text } from "@/registry/bases/takumi/components";
+import { PageFooter } from "@/registry/bases/takumi/components/page-footer";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View style={{ display: "flex", flexDirection: "column", minHeight: 220 }}>
diff --git a/examples/takumi/page-header.tsx b/examples/takumi/page-header.tsx
index 6a4ba16..2fbcf55 100644
--- a/examples/takumi/page-header.tsx
+++ b/examples/takumi/page-header.tsx
@@ -1,10 +1,11 @@
-import { PageHeader, Text } from "@/registry/bases/takumi/components";
+import { PageHeader } from "@/registry/bases/takumi/components/page-header";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View>
diff --git a/examples/takumi/page-number.tsx b/examples/takumi/page-number.tsx
index 8a044b2..42a5fd8 100644
--- a/examples/takumi/page-number.tsx
+++ b/examples/takumi/page-number.tsx
@@ -1,14 +1,12 @@
-import {
- Heading,
- PdfPageNumber,
- Text,
-} from "@/registry/bases/takumi/components";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { PdfPageNumber } from "@/registry/bases/takumi/components/page-number";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View style={{ minHeight: 680, position: "relative" }}>
diff --git a/examples/takumi/pdf-image.tsx b/examples/takumi/pdf-image.tsx
index 62774a5..28f90d0 100644
--- a/examples/takumi/pdf-image.tsx
+++ b/examples/takumi/pdf-image.tsx
@@ -1,7 +1,7 @@
import { PREVIEW_IMAGE_DATA_URI } from "@/examples/preview-assets";
-import { PdfImage } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfImage } from "@/registry/bases/takumi/components/pdf-image";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfImage
diff --git a/examples/takumi/qrcode.tsx b/examples/takumi/qrcode.tsx
index 3c85413..5586b17 100644
--- a/examples/takumi/qrcode.tsx
+++ b/examples/takumi/qrcode.tsx
@@ -1,12 +1,10 @@
-import {
- Heading,
- PdfQRCode,
- Section,
- Stack,
- Text,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { PdfQRCode } from "@/registry/bases/takumi/components/qrcode";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { Stack } from "@/registry/bases/takumi/components/stack";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/section.tsx b/examples/takumi/section.tsx
index 1669e1a..0abe3f8 100644
--- a/examples/takumi/section.tsx
+++ b/examples/takumi/section.tsx
@@ -1,6 +1,8 @@
-import { Heading, Section, Text } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/signature.tsx b/examples/takumi/signature.tsx
index 75b0189..6eac052 100644
--- a/examples/takumi/signature.tsx
+++ b/examples/takumi/signature.tsx
@@ -1,6 +1,6 @@
-import { PdfSignatureBlock } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { PdfSignatureBlock } from "@/registry/bases/takumi/components/signature";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<PdfSignatureBlock
diff --git a/examples/takumi/stack.tsx b/examples/takumi/stack.tsx
index ca996b8..3dc354a 100644
--- a/examples/takumi/stack.tsx
+++ b/examples/takumi/stack.tsx
@@ -1,11 +1,9 @@
-import {
- Divider,
- Heading,
- Stack,
- Text,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Divider } from "@/registry/bases/takumi/components/divider";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Stack } from "@/registry/bases/takumi/components/stack";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Stack gap="md">
diff --git a/examples/takumi/table.tsx b/examples/takumi/table.tsx
index e9cd0c7..2de812a 100644
--- a/examples/takumi/table.tsx
+++ b/examples/takumi/table.tsx
@@ -5,9 +5,9 @@ import {
TableFooter,
TableHeader,
TableRow,
-} from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/components/table";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Table variant="line" zebraStripe={false}>
diff --git a/examples/takumi/text.tsx b/examples/takumi/text.tsx
index eeace90..0fca98c 100644
--- a/examples/takumi/text.tsx
+++ b/examples/takumi/text.tsx
@@ -1,6 +1,7 @@
-import { Section, Text } from "@/registry/bases/takumi/components";
-import { Document, Page } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+import { Section } from "@/registry/bases/takumi/components/section";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { Document, Page } from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<Section spacing="none">
diff --git a/examples/takumi/watermark.tsx b/examples/takumi/watermark.tsx
index d4b5f57..fd125fd 100644
--- a/examples/takumi/watermark.tsx
+++ b/examples/takumi/watermark.tsx
@@ -1,14 +1,12 @@
-import {
- Heading,
- PdfWatermark,
- Text,
-} from "@/registry/bases/takumi/components";
+import { Heading } from "@/registry/bases/takumi/components/heading";
+import { Text } from "@/registry/bases/takumi/components/text";
+import { PdfcnThemeProvider } from "@/registry/bases/takumi/components/theme-provider";
+import { PdfWatermark } from "@/registry/bases/takumi/components/watermark";
import {
Document,
Page,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { PdfcnThemeProvider } from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
const DemoBody = () => (
<View style={{ minHeight: 680, position: "relative" }}>
diff --git a/lib/format-code.ts b/lib/format-code.ts
index 2b727bb..f11ff90 100644
--- a/lib/format-code.ts
+++ b/lib/format-code.ts
@@ -48,22 +48,26 @@ export const formatCode = async (code: string) => {
for (const base of BASES) {
formattedCode = formattedCode.replaceAll(
- `@/registry/bases/${base.name}/lib/`,
- "@/lib/"
+ `@/registry/bases/${base.name}/lib`,
+ "@/lib"
);
formattedCode = formattedCode.replaceAll(
- `@/registry/bases/${base.name}/components/`,
- "@/components/pdf/"
+ `@/registry/bases/${base.name}/components`,
+ "@/components/pdf"
);
formattedCode = formattedCode.replaceAll(
- `@/registry/bases/${base.name}/blocks/`,
- "@/components/pdf/"
+ `@/registry/bases/${base.name}/blocks`,
+ "@/components/pdf"
);
}
formattedCode = formattedCode.replaceAll(
- "@/registry/themes",
- "@/components/pdf/themes"
+ "@/registry/themes/professional",
+ "@/lib/pdf-themes/professional"
+ );
+ formattedCode = formattedCode.replaceAll(
+ "@/registry/themes/primitives",
+ "@/lib/pdf-themes/primitives"
);
formattedCode = formattedCode.replaceAll("export default", "export");
diff --git a/public/r/forme/alert.json b/public/r/forme/alert.json
index c6d19cd..a5e9bac 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 type { ReactNode } from \"react\";\n\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/forme/lib/pdfcn-svg\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/forme/lib/pdf-svg\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/alert/alert.tsx"
},
diff --git a/public/r/forme/badge.json b/public/r/forme/badge.json
index d6aa52a..d8b6707 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 {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/badge/badge.tsx"
},
diff --git a/public/r/forme/card.json b/public/r/forme/card.json
index 441e0fc..be265f5 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 type { ReactNode } from \"react\";\n\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/card/card.tsx"
},
diff --git a/public/r/forme/data-table.json b/public/r/forme/data-table.json
index 810ab5c..5872bad 100644
--- a/public/r/forme/data-table.json
+++ b/public/r/forme/data-table.json
@@ -14,19 +14,19 @@
"files": [
{
"path": "registry/bases/forme/components/data-table/data-table.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/forme/components/data-table/data-table.tsx",
- "content": "import { Fragment } from \"react\";\n\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table\";\nimport { Text as PDFText } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\n\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 {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/forme/components/table\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { Text as PDFText } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\n\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/data-table/data-table.tsx"
},
{
"path": "registry/bases/forme/components/data-table/data-table.types.ts",
- "content": "import type React from \"react\";\n\nimport type { TableVariant } from \"@/registry/bases/forme/components/table/table.types\";\nimport type { PDFComponentProps } from \"@/registry/themes\";\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 @formepdf/react 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 @formepdf/react\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 { TableVariant } from \"@/registry/bases/forme/components/table/table.types\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\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 @formepdf/react 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 @formepdf/react\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/data-table/data-table.types.ts"
},
diff --git a/public/r/forme/divider.json b/public/r/forme/divider.json
index 885dc0f..2773443 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 {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/divider/divider.tsx"
},
diff --git a/public/r/forme/form.json b/public/r/forme/form.json
index 33fc19f..8725392 100644
--- a/public/r/forme/form.json
+++ b/public/r/forme/form.json
@@ -13,13 +13,13 @@
"files": [
{
"path": "registry/bases/forme/components/form/form.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/forme/components/form/form.tsx",
- "content": "import {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\n\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\n\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/form/form.tsx"
},
diff --git a/public/r/forme/graph.json b/public/r/forme/graph.json
index 2221ec4..68158a2 100644
--- a/public/r/forme/graph.json
+++ b/public/r/forme/graph.json
@@ -13,13 +13,13 @@
"files": [
{
"path": "registry/bases/forme/components/graph/graph.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.tsx",
- "content": "import type React from \"react\";\n\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/registry/bases/forme/lib/pdfcn-svg\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/registry/bases/forme/lib/pdf-svg\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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/graph/graph.tsx"
},
@@ -31,7 +31,7 @@
},
{
"path": "registry/bases/forme/components/graph/graph.utils.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.utils.ts"
},
diff --git a/public/r/forme/heading.json b/public/r/forme/heading.json
index 5a568fb..91a607a 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 \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { StyleSheet, Text } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/heading/heading.tsx"
},
diff --git a/public/r/forme/invoice-classic.json b/public/r/forme/invoice-classic.json
index b4761f3..52b5a30 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 {\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 48f9268..95d1cff 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 {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index b2f574b..0e89436 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 {\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index b5604f0..5cad3be 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 {\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index c880c39..cb1bed4 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 {\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 5394958..ba6fb72 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 {\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index fa64302..a779f30 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 type { ReactNode } from \"react\";\n\nimport { View } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\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 { View } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/types/pdf-components\";\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/keep-together/keep-together.tsx"
},
diff --git a/public/r/forme/key-value.json b/public/r/forme/key-value.json
index f0bc65a..7b00328 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 {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/key-value/key-value.tsx"
},
diff --git a/public/r/forme/link.json b/public/r/forme/link.json
index 4712ae6..b1a8f09 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 {\n Link as PDFLink,\n StyleSheet,\n Text as PDFText,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Link as PDFLink,\n StyleSheet,\n Text as PDFText,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/link/link.tsx"
},
diff --git a/public/r/forme/list.json b/public/r/forme/list.json
index 059605c..7c44f67 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 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",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/types/pdf-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/list/list.styles.ts"
},
{
"path": "registry/bases/forme/components/list/list.tsx",
- "content": "import type React from \"react\";\n\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\n\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",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\n\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/list/list.tsx"
},
diff --git a/public/r/forme/page-break.json b/public/r/forme/page-break.json
index aeb2914..3937847 100644
--- a/public/r/forme/page-break.json
+++ b/public/r/forme/page-break.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/forme/components/page-break/page-break.tsx",
- "content": "import { PageBreak as FormePageBreak } from \"@formepdf/react\";\n\nimport type { PDFComponentProps } from \"@/registry/themes\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = (_props: PageBreakProps) => <FormePageBreak />;\n",
+ "content": "import { PageBreak as FormePageBreak } from \"@formepdf/react\";\n\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = (_props: PageBreakProps) => <FormePageBreak />;\n",
"type": "registry:component",
"target": "components/pdf/page-break/page-break.tsx"
},
diff --git a/public/r/forme/page-footer.json b/public/r/forme/page-footer.json
index e8f7fe6..d8248ca 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 type React from \"react\";\n\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/page-footer/page-footer.tsx"
},
diff --git a/public/r/forme/page-header.json b/public/r/forme/page-header.json
index 2100c1b..4a1523d 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 type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import type React from \"react\";\nimport type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Fixed,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/page-header/page-header.tsx"
},
diff --git a/public/r/forme/page-number.json b/public/r/forme/page-number.json
index 03eb6a5..e1a51ff 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 {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/page-number/page-number.tsx"
},
diff --git a/public/r/forme/pdf-image.json b/public/r/forme/pdf-image.json
index 21c25af..1112add 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 {\n Image,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Image,\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/pdf-image/pdf-image.tsx"
},
diff --git a/public/r/forme/qrcode.json b/public/r/forme/qrcode.json
index 17bed04..f076c36 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 QRCode from \"qrcode\";\n\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { Rect, Svg } from \"@/registry/bases/forme/lib/pdfcn-svg\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { Rect, Svg } from \"@/registry/bases/forme/lib/pdf-svg\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/qrcode/qrcode.tsx"
},
diff --git a/public/r/forme/report-financial.json b/public/r/forme/report-financial.json
index 9e81e7a..6907e87 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index d89c1d1..71fedbe 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index 7dc594a..033b961 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index 9f79577..5222d54 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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",
+ "content": "import { Document, Page, StyleSheet, View } from \"@formepdf/react\";\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 \"@/registry/bases/forme/components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index 3ec569a..27f029f 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 \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { StyleSheet, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/section/section.tsx"
},
diff --git a/public/r/forme/signature.json b/public/r/forme/signature.json
index 47dd610..badadaa 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 {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/signature/signature.tsx"
},
diff --git a/public/r/forme/stack.json b/public/r/forme/stack.json
index c5c3ffd..0ab57d6 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 \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport { StyleSheet, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/stack/stack.tsx"
},
diff --git a/public/r/forme/table.json b/public/r/forme/table.json
index c0b8f55..a857362 100644
--- a/public/r/forme/table.json
+++ b/public/r/forme/table.json
@@ -13,19 +13,19 @@
"files": [
{
"path": "registry/bases/forme/components/table/table.styles.ts",
- "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
+ "content": "import { StyleSheet } from \"@formepdf/react\";\n\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/forme/components/table/table.tsx",
- "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\n\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n View,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\n\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/table/table.tsx"
},
{
"path": "registry/bases/forme/components/table/table.types.ts",
- "content": "import type { PDFComponentProps } from \"@/registry/themes\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
+ "content": "import type { PDFComponentProps } from \"@/registry/types/pdf-components\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/table/table.types.ts"
},
diff --git a/public/r/forme/text.json b/public/r/forme/text.json
index 8637e47..e9a0f6b 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 {\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/text/text.tsx"
},
diff --git a/public/r/forme/theme-provider.json b/public/r/forme/theme-provider.json
new file mode 100644
index 0000000..51414db
--- /dev/null
+++ b/public/r/forme/theme-provider.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "forme/theme-provider",
+ "title": "Theme Provider",
+ "description": "Theme provider for the forme base",
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
+ "files": [
+ {
+ "path": "registry/bases/forme/components/theme-provider.tsx",
+ "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\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\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\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 ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ }
+ ],
+ "type": "registry:lib"
+}
\ No newline at end of file
diff --git a/public/r/forme/utils.json b/public/r/forme/utils.json
index 2084374..d834458 100644
--- a/public/r/forme/utils.json
+++ b/public/r/forme/utils.json
@@ -7,42 +7,39 @@
"@formepdf/react",
"@formepdf/core"
],
+ "registryDependencies": [
+ "forme/theme-provider"
+ ],
"files": [
- {
- "path": "registry/bases/forme/lib/pdfcn-theme.ts",
- "content": "import { professionalTheme } from \"@/registry/themes\";\n\nexport const theme = professionalTheme;\n",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/forme/lib/resolve-color.ts",
- "content": "import type { ColorTokens } from \"@/registry/themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
+ "content": "import type { ColorTokens } from \"@/registry/types/pdf-themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/forme/lib/maybe-fixed.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport { Fixed, View } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdfcn-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",
+ "content": "import type { ReactNode } from \"react\";\n\nimport { Fixed, View } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/forme/lib/pdf-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": "lib/maybe-fixed.tsx"
},
{
- "path": "registry/bases/forme/lib/theme-provider.tsx",
- "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"@/registry/bases/forme/lib/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\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\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\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "path": "registry/bases/forme/components/theme-provider.tsx",
+ "content": "import type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\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\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\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 ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/forme/lib/pdf-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": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-svg.tsx",
+ "path": "registry/bases/forme/lib/pdf-svg.tsx",
"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": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"type": "registry:lib"
diff --git a/public/r/forme/watermark.json b/public/r/forme/watermark.json
index e2b3c68..57f4ad7 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 { Watermark as FormeWatermark } from \"@formepdf/react\";\n\nimport { mergeFormeStyles } from \"@/registry/bases/forme/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport { usePdfcnTheme } from \"@/registry/bases/forme/lib/theme-provider\";\nimport type { PDFComponentProps } from \"@/registry/themes\";\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",
+ "content": "import { Watermark as FormeWatermark } from \"@formepdf/react\";\n\nimport { usePdfcnTheme } from \"@/registry/bases/forme/components/theme-provider\";\nimport { mergeFormeStyles } from \"@/registry/bases/forme/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\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/watermark/watermark.tsx"
},
diff --git a/public/r/registry.json b/public/r/registry.json
index b7b646d..7231fef 100644
--- a/public/r/registry.json
+++ b/public/r/registry.json
@@ -6,35 +6,31 @@
"dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
"description": "Theme context and helpers for the takumi base",
"files": [
- {
- "path": "registry/bases/takumi/lib/pdfcn-theme.ts",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
- "path": "registry/bases/takumi/lib/theme-provider.tsx",
+ "path": "registry/bases/takumi/components/theme-provider.tsx",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/takumi/lib/pdf-primitives.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-svg.tsx",
+ "path": "registry/bases/takumi/lib/pdf-svg.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"name": "takumi/utils",
"title": "Takumi Utils",
- "type": "registry:lib"
+ "type": "registry:lib",
+ "registryDependencies": ["takumi/theme-provider"]
},
{
"dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
@@ -796,17 +792,22 @@
"files": [
{
"path": "registry/themes/professional.ts",
- "target": "components/pdf/theme-professional.ts",
+ "target": "lib/pdf-themes/professional.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -819,17 +820,22 @@
"files": [
{
"path": "registry/themes/modern.ts",
- "target": "components/pdf/theme-modern.ts",
+ "target": "lib/pdf-themes/modern.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -842,17 +848,22 @@
"files": [
{
"path": "registry/themes/minimal.ts",
- "target": "components/pdf/theme-minimal.ts",
+ "target": "lib/pdf-themes/minimal.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -865,17 +876,22 @@
"files": [
{
"path": "registry/themes/executive.ts",
- "target": "components/pdf/theme-executive.ts",
+ "target": "lib/pdf-themes/executive.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -888,17 +904,22 @@
"files": [
{
"path": "registry/themes/corporate.ts",
- "target": "components/pdf/theme-corporate.ts",
+ "target": "lib/pdf-themes/corporate.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -911,17 +932,22 @@
"files": [
{
"path": "registry/themes/elegant.ts",
- "target": "components/pdf/theme-elegant.ts",
+ "target": "lib/pdf-themes/elegant.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -934,17 +960,22 @@
"files": [
{
"path": "registry/themes/vivid.ts",
- "target": "components/pdf/theme-vivid.ts",
+ "target": "lib/pdf-themes/vivid.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -957,17 +988,22 @@
"files": [
{
"path": "registry/themes/forest.ts",
- "target": "components/pdf/theme-forest.ts",
+ "target": "lib/pdf-themes/forest.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -980,17 +1016,22 @@
"files": [
{
"path": "registry/themes/blueprint.ts",
- "target": "components/pdf/theme-blueprint.ts",
+ "target": "lib/pdf-themes/blueprint.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -1002,11 +1043,6 @@
"dependencies": ["@formepdf/react", "@formepdf/core"],
"description": "Theme context and helpers for the forme base",
"files": [
- {
- "path": "registry/bases/forme/lib/pdfcn-theme.ts",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/forme/lib/resolve-color.ts",
"type": "registry:lib",
@@ -1018,24 +1054,25 @@
"target": "lib/maybe-fixed.tsx"
},
{
- "path": "registry/bases/forme/lib/theme-provider.tsx",
+ "path": "registry/bases/forme/components/theme-provider.tsx",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/forme/lib/pdf-primitives.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-svg.tsx",
+ "path": "registry/bases/forme/lib/pdf-svg.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"name": "forme/utils",
"title": "Forme Utils",
- "type": "registry:lib"
+ "type": "registry:lib",
+ "registryDependencies": ["forme/theme-provider"]
},
{
"dependencies": ["@formepdf/react", "@formepdf/core"],
diff --git a/public/r/takumi/alert.json b/public/r/takumi/alert.json
index 0630708..3a1e014 100644
--- a/public/r/takumi/alert.json
+++ b/public/r/takumi/alert.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/alert/alert.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/takumi/lib/pdfcn-svg\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { Circle, Line, Path, Svg } from \"@/registry/bases/takumi/lib/pdf-svg\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\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/alert/alert.tsx"
},
diff --git a/public/r/takumi/badge.json b/public/r/takumi/badge.json
index 877d561..8a76c25 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 {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/badge/badge.tsx"
},
diff --git a/public/r/takumi/card.json b/public/r/takumi/card.json
index 9dd2722..5df431e 100644
--- a/public/r/takumi/card.json
+++ b/public/r/takumi/card.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/card/card.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\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/card/card.tsx"
},
diff --git a/public/r/takumi/data-table.json b/public/r/takumi/data-table.json
index 4f6dbcf..6b307a1 100644
--- a/public/r/takumi/data-table.json
+++ b/public/r/takumi/data-table.json
@@ -14,19 +14,19 @@
"files": [
{
"path": "registry/bases/takumi/components/data-table/data-table.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
+ "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Creates compact-mode cell and text styles for the DataTable component.\n * Used when `size=\"compact\"` to render denser rows with smaller font sizes.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createCompactStyles = (t: PdfcnTheme) => {\n const { spacing, fontWeights, lineHeights } = t.primitives;\n return StyleSheet.create({\n cell: {\n paddingHorizontal: spacing[2],\n paddingVertical: spacing[0.5],\n },\n footerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n headerText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n fontWeight: fontWeights.semibold,\n lineHeight: lineHeights.normal,\n },\n text: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n lineHeight: lineHeights.normal,\n },\n });\n};\n\n/**\n * Converts an arbitrary cell value to a display string.\n * Returns an empty string for null/undefined values.\n * @param value - The raw cell value to format.\n */\nexport const formatValue = (value: unknown): string => {\n if (value === null || value === undefined) {\n return \"\";\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n return String(value);\n};\n",
"type": "registry:component",
"target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.tsx",
- "content": "import { Fragment } from \"react\";\n\nimport {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table\";\nimport { Text as PDFText } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\n\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 compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\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 compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\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 value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\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 {\n Table,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from \"@/registry/bases/takumi/components/table\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport { Text as PDFText } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\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 compact.headerText,\n col.align ? ({ textAlign: col.align } as Style) : {},\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 compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\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 value ? compact.footerText : compact.text,\n col.align\n ? ({ textAlign: col.align } as Style)\n : {},\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/data-table/data-table.tsx"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.types.ts",
- "content": "import type React from \"react\";\n\nimport type { TableVariant } from \"@/registry/bases/takumi/components/table/table.types\";\nimport type { PDFComponentProps } from \"@/registry/themes\";\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",
+ "content": "import type React from \"react\";\n\nimport type { TableVariant } from \"@/registry/bases/takumi/components/table/table.types\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\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/data-table/data-table.types.ts"
},
diff --git a/public/r/takumi/divider.json b/public/r/takumi/divider.json
index 9c48df4..86fc30e 100644
--- a/public/r/takumi/divider.json
+++ b/public/r/takumi/divider.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/divider/divider.tsx",
- "content": "import {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 });\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({ borderBottomColor: resolveColor(color, theme.colors) });\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}>\n <View style={lineStyle} />\n <PDFText style={labelTextStyle}>{label}</PDFText>\n <View style={lineStyle} />\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} />;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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 });\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({ borderBottomColor: resolveColor(color, theme.colors) });\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}>\n <View style={lineStyle} />\n <PDFText style={labelTextStyle}>{label}</PDFText>\n <View style={lineStyle} />\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} />;\n};\n",
"type": "registry:component",
"target": "components/pdf/divider/divider.tsx"
},
diff --git a/public/r/takumi/form.json b/public/r/takumi/form.json
index 3124d75..798414b 100644
--- a/public/r/takumi/form.json
+++ b/public/r/takumi/form.json
@@ -13,19 +13,19 @@
"files": [
{
"path": "registry/bases/takumi/components/form/form.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
+ "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type { PdfFormVariant } from \"./form.types\";\n\n/** Style factory for fillable form layouts, derived from the active theme. */\nexport const createFormStyles = (\n t: PdfcnTheme,\n variant: PdfFormVariant = \"underline\"\n) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n // lighter than spacing[0.5]=2pt — more refined\n const hairline = 0.75;\n // group title rule\n const rule = 1;\n\n const fieldAreaByVariant: Record<PdfFormVariant, object> = {\n box: {\n borderColor,\n borderRadius: borderRadius.sm,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n ghost: {\n backgroundColor: t.colors.muted,\n borderRadius: borderRadius.sm,\n },\n outlined: {\n borderColor: t.colors.foreground,\n borderRadius: borderRadius.md,\n borderStyle: \"solid\",\n borderWidth: hairline,\n },\n underline: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: 1,\n },\n };\n\n const hasPadding =\n variant === \"box\" || variant === \"outlined\" || variant === \"ghost\";\n\n return StyleSheet.create({\n column: {\n flex: 1,\n },\n\n columnsRow: {\n flexDirection: \"row\",\n gap: spacing[4],\n },\n fieldAbove: {\n marginBottom: spacing[3],\n width: \"100%\",\n },\n fieldArea: {\n width: \"100%\" as const,\n ...fieldAreaByVariant[variant],\n },\n\n fieldLeft: {\n alignItems: \"flex-end\",\n flexDirection: \"row\",\n gap: spacing[2],\n marginBottom: spacing[3],\n },\n fieldLeftArea: {\n flex: 1,\n },\n\n formDivider: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n marginBottom: spacing[4],\n },\n formSubtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.sm,\n lineHeight: t.typography.body.lineHeight,\n marginBottom: spacing[3],\n },\n\n formTitle: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: typography.xl,\n fontWeight: fontWeights.bold,\n lineHeight: t.typography.heading.lineHeight,\n marginBottom: spacing[1],\n },\n group: {\n marginBottom: spacing[5],\n },\n\n groupTitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.8,\n lineHeight: 1.2,\n marginBottom: spacing[3],\n textTransform: \"uppercase\",\n },\n hint: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n opacity: 0.14,\n paddingBottom: hasPadding ? spacing[1] : 0,\n paddingHorizontal: hasPadding ? spacing[2] : 0,\n paddingTop: hasPadding ? spacing[1] : spacing[0.5],\n },\n labelAbove: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.medium,\n letterSpacing: 0.5,\n lineHeight: 1.2,\n marginBottom: spacing[1],\n textTransform: \"uppercase\",\n },\n\n labelLeft: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: t.typography.body.lineHeight,\n paddingBottom: hasPadding ? spacing[1] : 0,\n width: 80,\n },\n\n root: {\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/takumi/components/form/form.tsx",
- "content": "import {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\n\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}>\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}>\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}>\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 ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\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}>\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}>\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}>\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 ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/takumi/components/form/form.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\n\n/** Visual style variant for the fillable form. */\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\n\n/** Column layout for a form section. */\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\n\n/** Label position relative to the field. */\nexport type FormLabelPosition = \"above\" | \"left\";\n\n/**\n * A single fillable field definition.\n * Props - `label` | `hint` | `height` | `width`\n * @see {@link PdfFormField}\n */\nexport interface PdfFormField {\n label: string;\n hint?: string;\n /**\n * Height of the blank field area in points.\n * @default 18\n */\n height?: number;\n width?: number | string;\n}\n\n/**\n * A logical group of fields with an optional section title.\n * Props - `title` | `fields` | `layout`\n * @see {@link PdfFormGroup}\n */\nexport interface PdfFormGroup {\n title?: string;\n fields: PdfFormField[];\n /**\n * @default 'single'\n */\n layout?: FormLayout;\n}\n\n/**\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\n * @see {@link PdfFormProps}\n */\nexport interface PdfFormProps {\n title?: string;\n subtitle?: string;\n groups: PdfFormGroup[];\n /**\n * @default 'underline'\n */\n variant?: PdfFormVariant;\n /**\n * @default 'above'\n */\n labelPosition?: FormLabelPosition;\n noWrap?: boolean;\n style?: Style;\n}\n",
+ "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\n/** Visual style variant for the fillable form. */\nexport type PdfFormVariant = \"underline\" | \"box\" | \"outlined\" | \"ghost\";\n\n/** Column layout for a form section. */\nexport type FormLayout = \"single\" | \"two-column\" | \"three-column\";\n\n/** Label position relative to the field. */\nexport type FormLabelPosition = \"above\" | \"left\";\n\n/**\n * A single fillable field definition.\n * Props - `label` | `hint` | `height` | `width`\n * @see {@link PdfFormField}\n */\nexport interface PdfFormField {\n label: string;\n hint?: string;\n /**\n * Height of the blank field area in points.\n * @default 18\n */\n height?: number;\n width?: number | string;\n}\n\n/**\n * A logical group of fields with an optional section title.\n * Props - `title` | `fields` | `layout`\n * @see {@link PdfFormGroup}\n */\nexport interface PdfFormGroup {\n title?: string;\n fields: PdfFormField[];\n /**\n * @default 'single'\n */\n layout?: FormLayout;\n}\n\n/**\n * Fillable PDF form with grouped fields, layout variants, and label positioning options.\n * Props - `title` | `subtitle` | `groups` | `variant` | `labelPosition` | `noWrap` | `style`\n * @see {@link PdfFormProps}\n */\nexport interface PdfFormProps {\n title?: string;\n subtitle?: string;\n groups: PdfFormGroup[];\n /**\n * @default 'underline'\n */\n variant?: PdfFormVariant;\n /**\n * @default 'above'\n */\n labelPosition?: FormLabelPosition;\n noWrap?: boolean;\n style?: Style;\n}\n",
"type": "registry:component",
"target": "components/pdf/form/form.types.ts"
},
diff --git a/public/r/takumi/graph.json b/public/r/takumi/graph.json
index 843b2c9..3c26f93 100644
--- a/public/r/takumi/graph.json
+++ b/public/r/takumi/graph.json
@@ -13,25 +13,25 @@
"files": [
{
"path": "registry/bases/takumi/components/graph/graph.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
+ "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nexport const createGraphStyles = (t: PdfcnTheme) =>\n StyleSheet.create({\n chartWithRightLegend: {\n alignItems: \"flex-start\",\n display: \"flex\",\n flexDirection: \"row\",\n },\n container: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n },\n legendColumn: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: 8,\n marginLeft: 12,\n marginTop: 18,\n minWidth: 120,\n },\n legendItem: {\n alignItems: \"center\",\n display: \"flex\",\n flexDirection: \"row\",\n gap: 4,\n },\n legendRow: {\n display: \"flex\",\n flexDirection: \"row\",\n flexWrap: \"wrap\",\n gap: 12,\n marginTop: 6,\n },\n legendText: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n },\n subtitle: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.primitives.typography.xs,\n marginBottom: 6,\n },\n title: {\n color: t.colors.foreground,\n fontFamily: t.typography.heading.fontFamily,\n fontSize: t.primitives.typography.base,\n fontWeight: t.primitives.fontWeights.semibold,\n marginBottom: 2,\n },\n });\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.tsx",
- "content": "import type React from \"react\";\n\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/registry/bases/takumi/lib/pdfcn-svg\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport {\n Circle,\n G,\n Line,\n Path,\n Rect,\n Svg,\n SvgText,\n} from \"@/registry/bases/takumi/lib/pdf-svg\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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/graph/graph.tsx"
},
{
"path": "registry/bases/takumi/components/graph/graph.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\n\n/**\n * Options for calculating graph width based on theme page margins and container context.\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\n * @see {@link GraphWidthOptions}\n */\nexport interface GraphWidthOptions {\n containerPadding?: number;\n wrapperPadding?: number;\n pageWidth?: number;\n}\n\nexport type GraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\n\n/**\n * A single data point with a label, numeric value, and optional color override.\n * Props - `label` | `value` | `color`\n * @see {@link GraphDataPoint}\n */\nexport interface GraphDataPoint {\n label: string;\n value: number;\n color?: string;\n}\n\n/**\n * A named data series containing multiple data points, used for multi-series charts.\n * Props - `name` | `data` | `color`\n * @see {@link GraphSeries}\n */\nexport interface GraphSeries {\n name: string;\n data: GraphDataPoint[];\n color?: string;\n}\n\n/**\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\n * @see {@link GraphProps}\n */\nexport interface GraphProps {\n /**\n * @default 'bar'\n */\n variant?: GraphVariant;\n data: GraphDataPoint[] | GraphSeries[];\n title?: string;\n subtitle?: string;\n xLabel?: string;\n yLabel?: string;\n /**\n * @default 420\n */\n width?: number;\n /**\n * @default 260\n */\n height?: number;\n /**\n * @default false\n */\n fullWidth?: boolean;\n containerPadding?: number;\n wrapperPadding?: number;\n colors?: string[];\n /**\n * @default false\n */\n showValues?: boolean;\n /**\n * @default true\n */\n showGrid?: boolean;\n /**\n * @default 'bottom'\n */\n legend?: GraphLegendPosition;\n centerLabel?: string;\n /**\n * @default true\n */\n showDots?: boolean;\n /**\n * @default false\n */\n smooth?: boolean;\n /**\n * @default 5\n */\n yTicks?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\n/** Internal chart layout dimensions computed from props and data. */\nexport interface ChartLayout {\n svgW: number;\n svgH: number;\n chartX: number;\n chartY: number;\n chartW: number;\n chartH: number;\n yMin: number;\n yMax: number;\n yTicks: number[];\n xLabels: string[];\n}\n",
+ "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\n/**\n * Options for calculating graph width based on theme page margins and container context.\n * Props - `containerPadding` | `wrapperPadding` | `pageWidth`\n * @see {@link GraphWidthOptions}\n */\nexport interface GraphWidthOptions {\n containerPadding?: number;\n wrapperPadding?: number;\n pageWidth?: number;\n}\n\nexport type GraphVariant =\n | \"bar\"\n | \"horizontal-bar\"\n | \"line\"\n | \"area\"\n | \"pie\"\n | \"donut\";\n\nexport type GraphLegendPosition = \"bottom\" | \"right\" | \"none\";\n\n/**\n * A single data point with a label, numeric value, and optional color override.\n * Props - `label` | `value` | `color`\n * @see {@link GraphDataPoint}\n */\nexport interface GraphDataPoint {\n label: string;\n value: number;\n color?: string;\n}\n\n/**\n * A named data series containing multiple data points, used for multi-series charts.\n * Props - `name` | `data` | `color`\n * @see {@link GraphSeries}\n */\nexport interface GraphSeries {\n name: string;\n data: GraphDataPoint[];\n color?: string;\n}\n\n/**\n * Multi-variant PDF chart (bar, line, area, pie, donut) rendered with SVG primitives.\n * Props - `variant` | `data` | `title` | `subtitle` | `xLabel` | `yLabel` | `width` | `height` | `fullWidth` | `containerPadding` | `wrapperPadding` | `colors` | `showValues` | `showGrid` | `legend` | `centerLabel` | `showDots` | `smooth` | `yTicks` | `noWrap` | `style`\n * @see {@link GraphProps}\n */\nexport interface GraphProps {\n /**\n * @default 'bar'\n */\n variant?: GraphVariant;\n data: GraphDataPoint[] | GraphSeries[];\n title?: string;\n subtitle?: string;\n xLabel?: string;\n yLabel?: string;\n /**\n * @default 420\n */\n width?: number;\n /**\n * @default 260\n */\n height?: number;\n /**\n * @default false\n */\n fullWidth?: boolean;\n containerPadding?: number;\n wrapperPadding?: number;\n colors?: string[];\n /**\n * @default false\n */\n showValues?: boolean;\n /**\n * @default true\n */\n showGrid?: boolean;\n /**\n * @default 'bottom'\n */\n legend?: GraphLegendPosition;\n centerLabel?: string;\n /**\n * @default true\n */\n showDots?: boolean;\n /**\n * @default false\n */\n smooth?: boolean;\n /**\n * @default 5\n */\n yTicks?: number;\n /**\n * @default true\n */\n noWrap?: boolean;\n style?: Style;\n}\n\n/** Internal chart layout dimensions computed from props and data. */\nexport interface ChartLayout {\n svgW: number;\n svgH: number;\n chartX: number;\n chartY: number;\n chartW: number;\n chartH: number;\n yMin: number;\n yMax: number;\n yTicks: number[];\n xLabels: string[];\n}\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.utils.ts",
- "content": "import type { PdfcnTheme } from \"@/registry/themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport type {\n ChartLayout,\n GraphDataPoint,\n GraphSeries,\n GraphWidthOptions,\n} from \"./graph.types\";\n\n/** Standard A4 page width in PDF points. */\nexport const A4_WIDTH = 595;\n\n/**\n * Pre-calculated safe graph widths for common scenarios.\n * These values work with all built-in themes on A4 pages.\n */\nexport const GRAPH_SAFE_WIDTHS = {\n /** Safe width for graph directly in page content (no extra containers) */\n default: 420,\n /** Safe width for graph inside a Section with md padding */\n inSection: 400,\n /** Safe width for graph inside a Section + bordered wrapper (like graphShell) */\n inSectionWithWrapper: 380,\n} as const;\n\n/**\n * Calculate the safe graph width based on theme page margins and container context.\n *\n * This utility ensures graphs don't overflow their container by accounting for:\n * - Page margins (from theme)\n * - Container padding (e.g., Section component)\n * - Wrapper padding (e.g., a bordered graphShell View)\n *\n * @example\n * ```tsx\n * const width = getGraphWidth(theme);\n * // For a graph inside a Section with padding=\"md\" (12pt) and a graphShell (12pt):\n * const width = getGraphWidth(theme, { containerPadding: 12, wrapperPadding: 12 });\n * ```\n */\nexport const getGraphWidth = (\n theme: PdfcnTheme,\n options: GraphWidthOptions = {}\n): number => {\n const {\n containerPadding = 0,\n wrapperPadding = 0,\n pageWidth = A4_WIDTH,\n } = options;\n const { marginLeft, marginRight } = theme.spacing.page;\n const availableWidth =\n pageWidth -\n marginLeft -\n marginRight -\n containerPadding * 2 -\n wrapperPadding * 2;\n return Math.max(Math.floor(availableWidth), 100);\n};\n\nexport const CHART_MARGINS = {\n axisBottom: 24,\n axisLeft: 40,\n pieBottom: 10,\n pieLeft: 10,\n right: 10,\n top: 10,\n} as const;\n\n/** Normalize to always work with GraphSeries[]. */\nexport const normalizeData = (\n data: GraphDataPoint[] | GraphSeries[]\n): GraphSeries[] => {\n if (data.length === 0) {\n return [];\n }\n if (\"label\" in data[0] && \"value\" in data[0]) {\n return [{ data: data as GraphDataPoint[], name: \"Series 1\" }];\n }\n return data as GraphSeries[];\n};\n\n/** Compute nice Y-axis ticks for a given value range. */\nexport const computeYTicks = (\n min: number,\n max: number,\n count: number\n): number[] => {\n if (min === max) {\n return [0, max || 1];\n }\n const step = (max - min) / (count - 1);\n return Array.from({ length: count }, (_, i) => {\n const v = min + i * step;\n return Math.round(v * 100) / 100;\n });\n};\n\n/** Format a number for display on axis labels. */\nexport const fmtNum = (v: number): string => {\n if (Math.abs(v) >= 1_000_000) {\n return `${(v / 1_000_000).toFixed(1)}M`;\n }\n if (Math.abs(v) >= 1000) {\n return `${(v / 1000).toFixed(1)}K`;\n }\n if (!Number.isInteger(v)) {\n return v.toFixed(1);\n }\n return String(v);\n};\n\n/** Truncate a label to at most maxLen characters. */\nexport const truncate = (s: string, maxLen: number): string =>\n s.length > maxLen ? `${s.slice(0, maxLen - 1)}…` : s;\n\n/** Polar to Cartesian coordinate conversion for pie/donut arcs. */\nexport const polarToCartesian = (\n cx: number,\n cy: number,\n r: number,\n angleDeg: number\n) => {\n const rad = ((angleDeg - 90) * Math.PI) / 180;\n return { x: cx + r * Math.cos(rad), y: cy + r * Math.sin(rad) };\n};\n\n/** Build an SVG arc path for a pie/donut slice. */\nexport const arcPath = (\n cx: number,\n cy: number,\n r: number,\n startAngle: number,\n endAngle: number,\n innerR = 0\n): string => {\n const safeEnd = Math.min(endAngle, startAngle + 359.999);\n const large = safeEnd - startAngle > 180 ? 1 : 0;\n const s = polarToCartesian(cx, cy, r, safeEnd);\n const e = polarToCartesian(cx, cy, r, startAngle);\n if (innerR === 0) {\n return `M ${cx} ${cy} L ${s.x} ${s.y} A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y} Z`;\n }\n const si = polarToCartesian(cx, cy, innerR, safeEnd);\n const ei = polarToCartesian(cx, cy, innerR, startAngle);\n return [\n `M ${s.x} ${s.y}`,\n `A ${r} ${r} 0 ${large} 0 ${e.x} ${e.y}`,\n `L ${ei.x} ${ei.y}`,\n `A ${innerR} ${innerR} 0 ${large} 1 ${si.x} ${si.y}`,\n \"Z\",\n ].join(\" \");\n};\n\n/** Compute smooth bezier control points (Catmull-Rom → cubic bezier). */\nexport const smoothPath = (\n points: { x: number; y: number }[],\n tension = 0.4\n): string => {\n if (points.length < 2) {\n return \"\";\n }\n if (points.length === 2) {\n return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;\n }\n const parts: string[] = [`M ${points[0].x} ${points[0].y}`];\n for (let i = 0; i < points.length - 1; i += 1) {\n const p0 = points[Math.max(i - 1, 0)];\n const p1 = points[i];\n const p2 = points[i + 1];\n const p3 = points[Math.min(i + 2, points.length - 1)];\n const cp1x = p1.x + (p2.x - p0.x) * tension;\n const cp1y = p1.y + (p2.y - p0.y) * tension;\n const cp2x = p2.x - (p3.x - p1.x) * tension;\n const cp2y = p2.y - (p3.y - p1.y) * tension;\n parts.push(`C ${cp1x} ${cp1y} ${cp2x} ${cp2y} ${p2.x} ${p2.y}`);\n }\n return parts.join(\" \");\n};\n\n/** Get the default chart color palette from the theme. */\nexport const getDefaultPalette = (t: PdfcnTheme): string[] => [\n t.colors.primary,\n t.colors.info ?? \"#3B82F6\",\n t.colors.success ?? \"#22C55E\",\n t.colors.warning ?? \"#F59E0B\",\n t.colors.destructive ?? \"#EF4444\",\n \"#8B5CF6\",\n \"#F97316\",\n \"#14B8A6\",\n];\n\n/** Derive ChartLayout from series data, SVG dimensions, and variant. */\nexport const buildLayout = (\n series: GraphSeries[],\n width: number,\n height: number,\n isPieOrDonut: boolean,\n yTickCount: number\n): ChartLayout => {\n const mL = isPieOrDonut ? CHART_MARGINS.pieLeft : CHART_MARGINS.axisLeft;\n const mB = isPieOrDonut ? CHART_MARGINS.pieBottom : CHART_MARGINS.axisBottom;\n const chartX = mL;\n const chartY = CHART_MARGINS.top;\n const chartW = width - mL - CHART_MARGINS.right;\n const chartH = height - CHART_MARGINS.top - mB;\n const allValues = series.flatMap((s) => s.data.map((d) => d.value));\n const rawMin = Math.min(...allValues, 0);\n const rawMax = Math.max(...allValues, 1);\n const yMin = Math.min(0, rawMin);\n const yMax = rawMax + (rawMax - yMin) * 0.08;\n return {\n chartH,\n chartW,\n chartX,\n chartY,\n svgH: height,\n svgW: width,\n xLabels: series[0]?.data.map((d) => d.label) ?? [],\n yMax,\n yMin,\n yTicks: computeYTicks(yMin, yMax, yTickCount),\n };\n};\n",
"type": "registry:component",
"target": "components/pdf/graph/graph.utils.ts"
},
diff --git a/public/r/takumi/heading.json b/public/r/takumi/heading.json
index 9ba487e..d8b0375 100644
--- a/public/r/takumi/heading.json
+++ b/public/r/takumi/heading.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/heading/heading.tsx",
- "content": "import { Text, StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>{children}</Text>;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport { Text, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>{children}</Text>;\n};\n",
"type": "registry:component",
"target": "components/pdf/heading/heading.tsx"
},
diff --git a/public/r/takumi/invoice-classic.json b/public/r/takumi/invoice-classic.json
index fb104cb..80a5eaa 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 {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 6acbdd7..206d8d0 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 {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\n KeyValue,\n PageFooter,\n PdfcnThemeProvider,\n Section,\n Table,\n TableBody,\n TableCell,\n TableHeader,\n TableRow,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 639e6e1..8950de0 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 {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index dd82ccd..b6c1c97 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 {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 2b3634c..43c94c7 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 {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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.json
index 98d3869..be519f3 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 {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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: \"pdfcn\",\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",
+ "content": "import {\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 \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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: \"pdfcn\",\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/keep-together.json b/public/r/takumi/keep-together.json
index 54b08b2..05505a5 100644
--- a/public/r/takumi/keep-together.json
+++ b/public/r/takumi/keep-together.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/keep-together/keep-together.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport { View } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\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 style={[{ breakInside: \"avoid\" }, style].filter(Boolean) as never}>\n {children}\n </View>\n);\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport { View } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/types/pdf-components\";\n\nexport interface KeepTogetherProps {\n children?: ReactNode;\n minPresenceAhead?: number;\n style?: Style;\n}\n\nexport const KeepTogether = ({ children, style }: KeepTogetherProps) => (\n <View style={[{ breakInside: \"avoid\" }, style].filter(Boolean) as never}>\n {children}\n </View>\n);\n",
"type": "registry:component",
"target": "components/pdf/keep-together/keep-together.tsx"
},
diff --git a/public/r/takumi/key-value.json b/public/r/takumi/key-value.json
index 430f236..d50369e 100644
--- a/public/r/takumi/key-value.json
+++ b/public/r/takumi/key-value.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/key-value/key-value.tsx",
- "content": "import {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\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}>\n <PDFText style={[...keyStyles, { flex: labelFlex }]}>\n {item.key}\n </PDFText>\n <PDFText style={[...valStyles, { flex: 1, textAlign: \"right\" }]}>\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}>\n <PDFText style={keyStyles}>{item.key}</PDFText>\n <PDFText style={valStyles}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\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}>\n <PDFText style={[...keyStyles, { flex: labelFlex }]}>\n {item.key}\n </PDFText>\n <PDFText style={[...valStyles, { flex: 1, textAlign: \"right\" }]}>\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}>\n <PDFText style={keyStyles}>{item.key}</PDFText>\n <PDFText style={valStyles}>{item.value}</PDFText>\n </View>\n );\n })}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/key-value/key-value.tsx"
},
diff --git a/public/r/takumi/link.json b/public/r/takumi/link.json
index 9eb9291..10c6df0 100644
--- a/public/r/takumi/link.json
+++ b/public/r/takumi/link.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/link/link.tsx",
- "content": "import {\n StyleSheet,\n Link as PDFLink,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 src={href} style={styleArray}>\n {children}\n </PDFLink>\n );\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n StyleSheet,\n Link as PDFLink,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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 src={href} style={styleArray}>\n {children}\n </PDFLink>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/link/link.tsx"
},
diff --git a/public/r/takumi/list.json b/public/r/takumi/list.json
index a4ba89f..82afef3 100644
--- a/public/r/takumi/list.json
+++ b/public/r/takumi/list.json
@@ -13,19 +13,19 @@
"files": [
{
"path": "registry/bases/takumi/components/list/list.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\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 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 \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-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 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/list/list.styles.ts"
},
{
"path": "registry/bases/takumi/components/list/list.tsx",
- "content": "import type React from \"react\";\n\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\n\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",
+ "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\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/list/list.tsx"
},
{
"path": "registry/bases/takumi/components/list/list.types.ts",
- "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\n\n/** List visual style variant. */\nexport type ListVariant =\n | \"bullet\"\n | \"numbered\"\n | \"checklist\"\n | \"icon\"\n | \"multi-level\"\n | \"descriptive\";\n\n/**\n * A single list item, optionally with nested children.\n * Props - `text` | `description` | `checked` | `children`\n * @see {@link ListItem}\n */\nexport interface ListItem {\n text: string;\n description?: string;\n checked?: boolean;\n children?: ListItem[];\n}\n\n/**\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\n * @see {@link PdfListProps}\n */\nexport interface PdfListProps {\n items: ListItem[];\n /**\n * @default 'bullet'\n */\n variant?: ListVariant;\n /**\n * @default 'sm'\n */\n gap?: \"xs\" | \"sm\" | \"md\";\n style?: Style;\n _level?: number;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n",
+ "content": "import type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\n/** List visual style variant. */\nexport type ListVariant =\n | \"bullet\"\n | \"numbered\"\n | \"checklist\"\n | \"icon\"\n | \"multi-level\"\n | \"descriptive\";\n\n/**\n * A single list item, optionally with nested children.\n * Props - `text` | `description` | `checked` | `children`\n * @see {@link ListItem}\n */\nexport interface ListItem {\n text: string;\n description?: string;\n checked?: boolean;\n children?: ListItem[];\n}\n\n/**\n * List of items with multiple style variants including bullet, numbered, checklist, and descriptive.\n * Props - `items` | `variant` | `gap` | `style` | `_level` | `noWrap`\n * @see {@link PdfListProps}\n */\nexport interface PdfListProps {\n items: ListItem[];\n /**\n * @default 'bullet'\n */\n variant?: ListVariant;\n /**\n * @default 'sm'\n */\n gap?: \"xs\" | \"sm\" | \"md\";\n style?: Style;\n _level?: number;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/list/list.types.ts"
},
diff --git a/public/r/takumi/page-break.json b/public/r/takumi/page-break.json
index 6dd28a3..7f2fea2 100644
--- a/public/r/takumi/page-break.json
+++ b/public/r/takumi/page-break.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/page-break/page-break.tsx",
- "content": "import { View } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PDFComponentProps } from \"@/registry/themes\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = ({ style }: PageBreakProps) => (\n <View style={[{ breakBefore: \"page\" }, style].filter(Boolean) as never} />\n);\n",
+ "content": "import { View } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\n\nexport interface PageBreakProps extends Omit<PDFComponentProps, \"children\"> {\n children?: never;\n}\n\nexport const PageBreak = ({ style }: PageBreakProps) => (\n <View style={[{ breakBefore: \"page\" }, style].filter(Boolean) as never} />\n);\n",
"type": "registry:component",
"target": "components/pdf/page-break/page-break.tsx"
},
diff --git a/public/r/takumi/page-footer.json b/public/r/takumi/page-footer.json
index 4df345f..aa4cee7 100644
--- a/public/r/takumi/page-footer.json
+++ b/public/r/takumi/page-footer.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/page-footer/page-footer.tsx",
- "content": "import {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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}>\n {leftText && <PDFText style={textStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={textStyle}>{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}>\n <View style={styles.threeColumnLeft}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle}>{email}</PDFText>}\n {website && <PDFText style={centerStyle}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && <PDFText style={rightStyle}>{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}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && <PDFText style={companyStyle}>{leftText}</PDFText>}\n {address && <PDFText style={addrStyle}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && <PDFText style={contactStyle}>{`Phone: ${phone}`}</PDFText>}\n {email && <PDFText style={contactStyle}>{`Email: ${email}`}</PDFText>}\n {website && <PDFText style={contactStyle}>{`Web: ${website}`}</PDFText>}\n </View>\n </View>\n {rightText && <PDFText style={pageNumStyle}>{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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {centerText && <PDFText style={centerStyle}>{centerText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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 variantRenderers[variant]() as React.ReactNode;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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}>\n {leftText && <PDFText style={textStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={textStyle}>{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}>\n <View style={styles.threeColumnLeft}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {address && <PDFText style={styles.textLeft}>{address}</PDFText>}\n </View>\n <View style={styles.threeColumnCenter}>\n {phone && <PDFText style={centerStyle}>{phone}</PDFText>}\n {email && <PDFText style={centerStyle}>{email}</PDFText>}\n {website && <PDFText style={centerStyle}>{website}</PDFText>}\n </View>\n <View style={styles.threeColumnRight}>\n {rightText && <PDFText style={rightStyle}>{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}>\n <View style={styles.detailedTopRow}>\n <View style={styles.detailedLeft}>\n {leftText && <PDFText style={companyStyle}>{leftText}</PDFText>}\n {address && <PDFText style={addrStyle}>{address}</PDFText>}\n </View>\n <View style={styles.detailedRight}>\n {phone && <PDFText style={contactStyle}>{`Phone: ${phone}`}</PDFText>}\n {email && <PDFText style={contactStyle}>{`Email: ${email}`}</PDFText>}\n {website && <PDFText style={contactStyle}>{`Web: ${website}`}</PDFText>}\n </View>\n </View>\n {rightText && <PDFText style={pageNumStyle}>{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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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}>\n {leftText && <PDFText style={leftStyle}>{leftText}</PDFText>}\n {centerText && <PDFText style={centerStyle}>{centerText}</PDFText>}\n {rightText && <PDFText style={rightStyle}>{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 variantRenderers[variant]() as React.ReactNode;\n};\n",
"type": "registry:component",
"target": "components/pdf/page-footer/page-footer.tsx"
},
diff --git a/public/r/takumi/page-header.json b/public/r/takumi/page-header.json
index 51520bf..2ea176a 100644
--- a/public/r/takumi/page-header.json
+++ b/public/r/takumi/page-header.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/page-header/page-header.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded]}>\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}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered]}>\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}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles}>{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}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles}>{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 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 variantRenderers[variant]() as React.ReactNode;\n};\n",
+ "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n View,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleBranded]}>\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}>\n <PDFText style={titleStyles}>{title}</PDFText>\n {subtitle && (\n <PDFText style={[styles.subtitle, styles.subtitleCentered]}>\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}>\n <View style={styles.logoRightContent}>\n <PDFText style={titleStyles}>{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}>\n {logo && <View style={styles.logoContainer}>{logo}</View>}\n <View style={styles.logoContent}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.twoColumnLeft}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.minimalLeft}>\n <PDFText style={titleStyles}>{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}>\n <View style={styles.simpleLeft}>\n <PDFText style={titleStyles}>{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 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 variantRenderers[variant]() as React.ReactNode;\n};\n",
"type": "registry:component",
"target": "components/pdf/page-header/page-header.tsx"
},
diff --git a/public/r/takumi/page-number.json b/public/r/takumi/page-number.json
index 3a144ae..e52fc85 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 {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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/page-number/page-number.tsx"
},
diff --git a/public/r/takumi/pdf-image.json b/public/r/takumi/pdf-image.json
index f2ff36a..ae455f7 100644
--- a/public/r/takumi/pdf-image.json
+++ b/public/r/takumi/pdf-image.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/pdf-image/pdf-image.tsx",
- "content": "import {\n View,\n Text as PDFText,\n StyleSheet,\n Image,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\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} style={imageStyles} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n Image,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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} style={imageStyles} />\n {caption ? <PDFText style={styles.caption}>{caption}</PDFText> : null}\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/pdf-image/pdf-image.tsx"
},
diff --git a/public/r/takumi/qrcode.json b/public/r/takumi/qrcode.json
index f9f6060..e681c55 100644
--- a/public/r/takumi/qrcode.json
+++ b/public/r/takumi/qrcode.json
@@ -14,7 +14,7 @@
"files": [
{
"path": "registry/bases/takumi/components/qrcode/qrcode.tsx",
- "content": "import QRCode from \"qrcode\";\n\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { Rect, Svg } from \"@/registry/bases/takumi/lib/pdfcn-svg\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { Rect, Svg } from \"@/registry/bases/takumi/lib/pdf-svg\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\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/qrcode/qrcode.tsx"
},
diff --git a/public/r/takumi/report-financial.json b/public/r/takumi/report-financial.json
index 095eb67..5864119 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index a218bd1..01a9229 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index 2280e5c..acf32c6 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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.json
index d57fc97..fb08cae 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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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 {\n Badge,\n DataTable,\n KeyValue,\n PageFooter,\n PageHeader,\n PdfGraph,\n PdfList,\n PdfcnThemeProvider,\n Section,\n Text,\n usePdfcnTheme,\n} from \"@/registry/bases/takumi/components\";\nimport {\n View,\n StyleSheet,\n Document,\n Page,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\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 pdfcn\"\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 pdfcn\"\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 pdfcn\"\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/section.json b/public/r/takumi/section.json
index 0017ede..0bb129b 100644
--- a/public/r/takumi/section.json
+++ b/public/r/takumi/section.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/section/section.tsx",
- "content": "import { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 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 <View style={styleArray}>{children}</View>;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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 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 <View style={styleArray}>{children}</View>;\n};\n",
"type": "registry:component",
"target": "components/pdf/section/section.tsx"
},
diff --git a/public/r/takumi/signature.json b/public/r/takumi/signature.json
index a94bcf7..041f6aa 100644
--- a/public/r/takumi/signature.json
+++ b/public/r/takumi/signature.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/signature/signature.tsx",
- "content": "import {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\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\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n <View style={styles.doubleRow}>\n {renderSignerBlock(first, styles)}\n {renderSignerBlock(second, styles)}\n </View>\n </View>\n );\n }\n\n return (\n <View\n style={[{ breakInside: \"avoid\" as const }, containerStyles]\n .flat()\n .filter(Boolean)}\n >\n {renderSignerBlock({ date, label, name, title }, styles)}\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/signature/signature.tsx"
},
diff --git a/public/r/takumi/stack.json b/public/r/takumi/stack.json
index 1be0c32..e6d7cb0 100644
--- a/public/r/takumi/stack.json
+++ b/public/r/takumi/stack.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/stack/stack.tsx",
- "content": "import { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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 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 <View style={styleArray}>{children}</View>;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport { View, StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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 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 <View style={styleArray}>{children}</View>;\n};\n",
"type": "registry:component",
"target": "components/pdf/stack/stack.tsx"
},
diff --git a/public/r/takumi/table.json b/public/r/takumi/table.json
index 14776d2..3c6fd49 100644
--- a/public/r/takumi/table.json
+++ b/public/r/takumi/table.json
@@ -13,19 +13,19 @@
"files": [
{
"path": "registry/bases/takumi/components/table/table.styles.ts",
- "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { PdfcnTheme } from \"@/registry/themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
+ "content": "import { StyleSheet } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\n/**\n * Creates all table styles derived from the active theme.\n * @param t - The resolved PdfcnTheme instance.\n */\nexport const createTableStyles = (t: PdfcnTheme) => {\n const { spacing, borderRadius, fontWeights, typography } = t.primitives;\n const borderColor = t.colors.border;\n\n const hairline = 0.5;\n const rule = 1;\n const thick = 1.5;\n\n const cellPadV = spacing[2] - 2;\n const cellPadH = spacing[2] + 2;\n // eslint-disable-next-line prefer-destructuring\n const cellPadVCompact = spacing[0.5];\n // eslint-disable-next-line prefer-destructuring\n const cellPadHCompact = spacing[2];\n\n const rowDivider = {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\" as const,\n borderBottomWidth: hairline,\n };\n\n return StyleSheet.create({\n cell: {\n flex: 1,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBordered: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellBorderedBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellCompact: {\n paddingHorizontal: cellPadHCompact,\n paddingVertical: cellPadVCompact,\n },\n\n cellFixed: {\n flexGrow: 0,\n flexShrink: 0,\n justifyContent: \"center\",\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellGridBorder: {\n borderRightColor: borderColor,\n borderRightStyle: \"solid\",\n borderRightWidth: hairline,\n },\n\n cellMinimal: {\n paddingHorizontal: spacing[2] - 2,\n paddingVertical: spacing[1] + 1,\n },\n\n cellPrimaryHeader: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellStriped: {\n paddingHorizontal: cellPadH,\n paddingVertical: cellPadV,\n },\n\n cellText: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n lineHeight: 1.2,\n },\n cellTextCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n lineHeight: 1.2,\n },\n cellTextFooter: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderBordered: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.bold,\n lineHeight: 1.2,\n },\n cellTextHeaderCompact: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderGrid: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n cellTextHeaderLine: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n\n cellTextHeaderMinimal: {\n color: t.colors.mutedForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.medium,\n lineHeight: 1.2,\n },\n cellTextHeaderPrimaryHeader: {\n color: t.colors.primaryForeground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: typography.xs,\n fontWeight: fontWeights.semibold,\n letterSpacing: 0.6,\n lineHeight: 1.2,\n textTransform: \"uppercase\",\n },\n cellTextHeaderStriped: {\n color: t.colors.foreground,\n fontFamily: t.typography.body.fontFamily,\n fontSize: t.typography.body.fontSize,\n fontWeight: fontWeights.semibold,\n lineHeight: 1.2,\n },\n row: {\n display: \"flex\",\n flexDirection: \"row\",\n },\n rowBordered: rowDivider,\n rowCompact: rowDivider,\n rowFooter: {\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n\n rowFooterStriped: {\n backgroundColor: t.colors.muted,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: rule,\n },\n rowGrid: rowDivider,\n\n rowHeaderBordered: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n rowHeaderCompact: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderGrid: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n\n rowHeaderLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderMinimal: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowHeaderPrimaryHeader: {\n backgroundColor: t.colors.primary,\n },\n rowHeaderStriped: {\n backgroundColor: t.colors.muted,\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: rule,\n },\n rowLine: rowDivider,\n\n rowMinimal: rowDivider,\n rowPrimaryHeader: rowDivider,\n\n rowStripe: {\n backgroundColor: t.colors.muted,\n },\n\n rowStriped: {},\n table: {\n display: \"flex\",\n flexDirection: \"column\",\n marginBottom: t.spacing.componentGap,\n width: \"100%\",\n },\n tableBordered: {\n borderBottomLeftRadius: borderRadius.sm,\n borderBottomRightRadius: borderRadius.sm,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.sm,\n borderTopRightRadius: borderRadius.sm,\n borderWidth: rule,\n overflow: \"hidden\" as const,\n },\n tableCompact: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableGrid: {\n borderBottomLeftRadius: borderRadius.md,\n borderBottomRightRadius: borderRadius.md,\n borderColor,\n borderStyle: \"solid\",\n borderTopLeftRadius: borderRadius.md,\n borderTopRightRadius: borderRadius.md,\n borderWidth: thick,\n overflow: \"hidden\" as const,\n },\n tableLine: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n tableMinimal: {\n paddingVertical: spacing[2],\n },\n\n tablePrimaryHeader: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n },\n\n tableStriped: {\n borderBottomColor: borderColor,\n borderBottomStyle: \"solid\",\n borderBottomWidth: hairline,\n borderTopColor: borderColor,\n borderTopStyle: \"solid\",\n borderTopWidth: hairline,\n },\n });\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/takumi/components/table/table.tsx",
- "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\n\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 textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ]}\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray}>{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\n style={[{ breakInside: \"avoid\" as const }, styleArray]\n .flat()\n .filter(Boolean)}\n >\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}>{processedChildren}</View>;\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
+ "content": "import { Children, cloneElement, isValidElement } from \"react\";\nimport type { ReactElement, ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\n\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 textStyle,\n align ? { textAlign: align } : {},\n { margin: 0, padding: 0 },\n ]}\n >\n {children}\n </PDFText>\n ) : (\n children\n );\n\n return <View style={styleArray}>{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\n style={[{ breakInside: \"avoid\" as const }, styleArray]\n .flat()\n .filter(Boolean)}\n >\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}>{processedChildren}</View>;\n return noWrap ? (\n <View style={[{ breakInside: \"avoid\" as const }].filter(Boolean)}>\n {inner}\n </View>\n ) : (\n inner\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/takumi/components/table/table.types.ts",
- "content": "import type { PDFComponentProps } from \"@/registry/themes\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
+ "content": "import type { PDFComponentProps } from \"@/registry/types/pdf-components\";\n\n/** Table visual style variant. */\nexport type TableVariant =\n | \"line\"\n | \"grid\"\n | \"minimal\"\n | \"striped\"\n | \"compact\"\n | \"bordered\"\n | \"primary-header\";\n\n/**\n * Table container with visual style variants and optional zebra striping.\n * Props - `variant` | `zebraStripe` | `noWrap` | `children` | `style`\n * @see {@link TableProps}\n */\nexport interface TableProps extends PDFComponentProps {\n /**\n * @default 'line'\n */\n variant?: TableVariant;\n /**\n * @default false\n */\n zebraStripe?: boolean;\n /**\n * @default false\n */\n noWrap?: boolean;\n}\n\nexport type TableSectionProps = PDFComponentProps;\n\n/**\n * Table row with optional header, footer, and stripe states.\n * Props - `header` | `footer` | `stripe` | `variant` | `children` | `style`\n * @see {@link TableRowProps}\n */\nexport interface TableRowProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n stripe?: boolean;\n variant?: TableVariant;\n}\n\n/**\n * Table cell with alignment, width, and header or footer text styling.\n * Props - `header` | `footer` | `align` | `width` | `variant` | `_last` | `children` | `style`\n * @see {@link TableCellProps}\n */\nexport interface TableCellProps extends PDFComponentProps {\n header?: boolean;\n footer?: boolean;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | number;\n variant?: TableVariant;\n _last?: boolean;\n}\n",
"type": "registry:component",
"target": "components/pdf/table/table.types.ts"
},
diff --git a/public/r/takumi/text.json b/public/r/takumi/text.json
index b0e2fa7..4440b52 100644
--- a/public/r/takumi/text.json
+++ b/public/r/takumi/text.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/text/text.tsx",
- "content": "import {\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>{children}</PDFText>;\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>{children}</PDFText>;\n};\n",
"type": "registry:component",
"target": "components/pdf/text/text.tsx"
},
diff --git a/public/r/takumi/theme-provider.json b/public/r/takumi/theme-provider.json
new file mode 100644
index 0000000..540ddab
--- /dev/null
+++ b/public/r/takumi/theme-provider.json
@@ -0,0 +1,19 @@
+{
+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",
+ "name": "takumi/theme-provider",
+ "title": "Theme Provider",
+ "description": "Theme provider for the takumi base",
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
+ "files": [
+ {
+ "path": "registry/bases/takumi/components/theme-provider.tsx",
+ "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\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 ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ }
+ ],
+ "type": "registry:lib"
+}
\ No newline at end of file
diff --git a/public/r/takumi/utils.json b/public/r/takumi/utils.json
index 0b52a07..0897d7a 100644
--- a/public/r/takumi/utils.json
+++ b/public/r/takumi/utils.json
@@ -7,36 +7,33 @@
"takumi-pdf",
"@takumi-rs/helpers"
],
+ "registryDependencies": [
+ "takumi/theme-provider"
+ ],
"files": [
- {
- "path": "registry/bases/takumi/lib/pdfcn-theme.ts",
- "content": "import { professionalTheme } from \"@/registry/themes\";\n\nexport const theme = professionalTheme;\n",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
- "content": "import type { ColorTokens } from \"@/registry/themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
+ "content": "import type { ColorTokens } from \"@/registry/types/pdf-themes\";\n\n/** Theme color token keys that can be used for the color prop */\nexport const THEME_COLOR_KEYS = [\n \"foreground\",\n \"background\",\n \"muted\",\n \"mutedForeground\",\n \"primary\",\n \"primaryForeground\",\n \"border\",\n \"accent\",\n \"destructive\",\n \"success\",\n \"warning\",\n \"info\",\n] as const satisfies (keyof ColorTokens)[];\n\n/** Resolves a color value: theme token key → hex, or raw CSS color as-is. */\nexport const resolveColor = (value: string, colors: ColorTokens): string => {\n const key = value as (typeof THEME_COLOR_KEYS)[number];\n return THEME_COLOR_KEYS.includes(key) ? colors[key] : value;\n};\n",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
- "path": "registry/bases/takumi/lib/theme-provider.tsx",
- "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"@/registry/bases/takumi/lib/pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nlet serializedTheme = defaultTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\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\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "path": "registry/bases/takumi/components/theme-provider.tsx",
+ "content": "import { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { professionalTheme } from \"@/registry/themes/professional\";\n\nexport type PdfcnTheme = typeof professionalTheme;\n\nlet serializedTheme = professionalTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\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 ?? professionalTheme);\n\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/takumi/lib/pdf-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\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 // eslint-disable-next-line eslint(nextjs/no-img-element) -- PDF primitive, not Next.js page\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": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-svg.tsx",
- "content": "import { Children, Fragment, cloneElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, SVGProps } from \"react\";\n\nimport {\n normalizeTakumiStyle,\n pointToCssPixel,\n} from \"@/registry/bases/takumi/lib/pdfcn-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",
+ "path": "registry/bases/takumi/lib/pdf-svg.tsx",
+ "content": "import { Children, Fragment, cloneElement, isValidElement } from \"react\";\nimport type { CSSProperties, ReactNode, SVGProps } from \"react\";\n\nimport {\n normalizeTakumiStyle,\n pointToCssPixel,\n} from \"@/registry/bases/takumi/lib/pdf-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": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"type": "registry:lib"
diff --git a/public/r/takumi/watermark.json b/public/r/takumi/watermark.json
index bf60372..20f42fb 100644
--- a/public/r/takumi/watermark.json
+++ b/public/r/takumi/watermark.json
@@ -13,7 +13,7 @@
"files": [
{
"path": "registry/bases/takumi/components/watermark/watermark.tsx",
- "content": "import {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport type { PDFComponentProps, PdfcnTheme } from \"@/registry/themes\";\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}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n",
+ "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/components/theme-provider\";\nimport {\n View,\n Text as PDFText,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdf-primitives\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport type { PDFComponentProps } from \"@/registry/types/pdf-components\";\nimport type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\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}>\n <PDFText style={textStyles}>{text}</PDFText>\n </View>\n );\n};\n",
"type": "registry:component",
"target": "components/pdf/watermark/watermark.tsx"
},
diff --git a/public/r/theme-blueprint.json b/public/r/theme-blueprint.json
index c25dd52..f75cf2e 100644
--- a/public/r/theme-blueprint.json
+++ b/public/r/theme-blueprint.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/blueprint.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Blueprint theme preset.\n *\n * Character: Dark slate palette with cyan accent, JetBrains Mono headings,\n * Source Code Pro body — a technical, precision-first aesthetic.\n * Ideal for API docs, engineering specs, and developer-focused reports.\n */\nexport const blueprintTheme: PdfcnTheme = {\n colors: {\n accent: \"#0891b2\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#e11d48\",\n foreground: \"#0f172a\",\n info: \"#0284c7\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#475569\",\n primary: \"#0f172a\",\n primaryForeground: \"#f0f9ff\",\n success: \"#059669\",\n warning: \"#d97706\",\n },\n name: \"blueprint\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 52,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 52,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Source Code Pro\",\n fontSize: 10,\n lineHeight: 1.75,\n },\n heading: {\n fontFamily: \"JetBrains Mono\",\n fontSize: {\n h1: 28,\n h2: 21,\n h3: 17,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Blueprint theme preset.\n *\n * Character: Dark slate palette with cyan accent, JetBrains Mono headings,\n * Source Code Pro body — a technical, precision-first aesthetic.\n * Ideal for API docs, engineering specs, and developer-focused reports.\n */\nexport const blueprintTheme: PdfcnTheme = {\n colors: {\n accent: \"#0891b2\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#e11d48\",\n foreground: \"#0f172a\",\n info: \"#0284c7\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#475569\",\n primary: \"#0f172a\",\n primaryForeground: \"#f0f9ff\",\n success: \"#059669\",\n warning: \"#d97706\",\n },\n name: \"blueprint\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 52,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 52,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Source Code Pro\",\n fontSize: 10,\n lineHeight: 1.75,\n },\n heading: {\n fontFamily: \"JetBrains Mono\",\n fontSize: {\n h1: 28,\n h2: 21,\n h3: 17,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-blueprint.ts"
+ "target": "lib/pdf-themes/blueprint.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-corporate.json b/public/r/theme-corporate.json
index c264d51..0b28521 100644
--- a/public/r/theme-corporate.json
+++ b/public/r/theme-corporate.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/corporate.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Corporate theme preset.\n *\n * Character: Blue-gray palette, Lato sans-serif throughout, structured and\n * dependable. Sky-blue accent adds clarity without distraction.\n * Ideal for business proposals, project plans, and client-facing reports.\n */\nexport const corporateTheme: PdfcnTheme = {\n colors: {\n accent: \"#0ea5e9\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#1e293b\",\n info: \"#3b82f6\",\n muted: \"#f8fafc\",\n mutedForeground: \"#64748b\",\n primary: \"#0f4c81\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"corporate\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 13,\n page: {\n marginBottom: 52,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 52,\n },\n paragraphGap: 9,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Lato\",\n fontSize: 11,\n lineHeight: 1.55,\n },\n heading: {\n fontFamily: \"Lato\",\n fontSize: {\n h1: 30,\n h2: 22,\n h3: 18,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Corporate theme preset.\n *\n * Character: Blue-gray palette, Lato sans-serif throughout, structured and\n * dependable. Sky-blue accent adds clarity without distraction.\n * Ideal for business proposals, project plans, and client-facing reports.\n */\nexport const corporateTheme: PdfcnTheme = {\n colors: {\n accent: \"#0ea5e9\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#1e293b\",\n info: \"#3b82f6\",\n muted: \"#f8fafc\",\n mutedForeground: \"#64748b\",\n primary: \"#0f4c81\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"corporate\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 13,\n page: {\n marginBottom: 52,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 52,\n },\n paragraphGap: 9,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Lato\",\n fontSize: 11,\n lineHeight: 1.55,\n },\n heading: {\n fontFamily: \"Lato\",\n fontSize: {\n h1: 30,\n h2: 22,\n h3: 18,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-corporate.ts"
+ "target": "lib/pdf-themes/corporate.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-elegant.json b/public/r/theme-elegant.json
index 4ca8ee2..76aea4b 100644
--- a/public/r/theme-elegant.json
+++ b/public/r/theme-elegant.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/elegant.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Elegant theme preset.\n *\n * Character: Warm cream-adjacent whites, amber/gold accent, Playfair Display\n * headings paired with Lora body — a classic editorial combination.\n * Ideal for design portfolios, luxury brands, and high-end editorial PDFs.\n */\nexport const elegantTheme: PdfcnTheme = {\n colors: {\n accent: \"#b45309\",\n background: \"#ffffff\",\n border: \"#d6d3d1\",\n destructive: \"#dc2626\",\n foreground: \"#1c1917\",\n info: \"#0ea5e9\",\n muted: \"#fafaf9\",\n mutedForeground: \"#78716c\",\n primary: \"#78350f\",\n primaryForeground: \"#fffbeb\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"elegant\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 60,\n marginLeft: 52,\n marginRight: 52,\n marginTop: 60,\n },\n paragraphGap: 12,\n sectionGap: 30,\n },\n typography: {\n body: {\n fontFamily: \"Lora\",\n fontSize: 11,\n lineHeight: 1.7,\n },\n heading: {\n fontFamily: \"Playfair Display\",\n fontSize: {\n h1: 36,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Elegant theme preset.\n *\n * Character: Warm cream-adjacent whites, amber/gold accent, Playfair Display\n * headings paired with Lora body — a classic editorial combination.\n * Ideal for design portfolios, luxury brands, and high-end editorial PDFs.\n */\nexport const elegantTheme: PdfcnTheme = {\n colors: {\n accent: \"#b45309\",\n background: \"#ffffff\",\n border: \"#d6d3d1\",\n destructive: \"#dc2626\",\n foreground: \"#1c1917\",\n info: \"#0ea5e9\",\n muted: \"#fafaf9\",\n mutedForeground: \"#78716c\",\n primary: \"#78350f\",\n primaryForeground: \"#fffbeb\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"elegant\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 60,\n marginLeft: 52,\n marginRight: 52,\n marginTop: 60,\n },\n paragraphGap: 12,\n sectionGap: 30,\n },\n typography: {\n body: {\n fontFamily: \"Lora\",\n fontSize: 11,\n lineHeight: 1.7,\n },\n heading: {\n fontFamily: \"Playfair Display\",\n fontSize: {\n h1: 36,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-elegant.ts"
+ "target": "lib/pdf-themes/elegant.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-executive.json b/public/r/theme-executive.json
index 6803c02..b88eb3b 100644
--- a/public/r/theme-executive.json
+++ b/public/r/theme-executive.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/executive.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Executive theme preset.\n *\n * Character: Deep navy palette, Merriweather serif headings, Open Sans body.\n * Generous margins, high contrast, premium boardroom aesthetic.\n * Ideal for board reports, executive briefs, and investor documents.\n */\nexport const executiveTheme: PdfcnTheme = {\n colors: {\n accent: \"#1e40af\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#dc2626\",\n foreground: \"#0f172a\",\n info: \"#0369a1\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#1e3a5f\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#b45309\",\n },\n name: \"executive\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 64,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 64,\n },\n paragraphGap: 10,\n sectionGap: 32,\n },\n typography: {\n body: {\n fontFamily: \"Open Sans\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 34,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Executive theme preset.\n *\n * Character: Deep navy palette, Merriweather serif headings, Open Sans body.\n * Generous margins, high contrast, premium boardroom aesthetic.\n * Ideal for board reports, executive briefs, and investor documents.\n */\nexport const executiveTheme: PdfcnTheme = {\n colors: {\n accent: \"#1e40af\",\n background: \"#ffffff\",\n border: \"#cbd5e1\",\n destructive: \"#dc2626\",\n foreground: \"#0f172a\",\n info: \"#0369a1\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#1e3a5f\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#b45309\",\n },\n name: \"executive\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 16,\n page: {\n marginBottom: 64,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 64,\n },\n paragraphGap: 10,\n sectionGap: 32,\n },\n typography: {\n body: {\n fontFamily: \"Open Sans\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 34,\n h2: 26,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-executive.ts"
+ "target": "lib/pdf-themes/executive.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-forest.json b/public/r/theme-forest.json
index 69d0e5c..3b4655f 100644
--- a/public/r/theme-forest.json
+++ b/public/r/theme-forest.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/forest.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Forest theme preset.\n *\n * Character: Natural deep greens, Merriweather headings for gravitas, Inter\n * body for readability. Earthy and trustworthy.\n * Ideal for sustainability reports, environmental docs, and wellness brands.\n */\nexport const forestTheme: PdfcnTheme = {\n colors: {\n accent: \"#16a34a\",\n background: \"#ffffff\",\n border: \"#bbf7d0\",\n destructive: \"#dc2626\",\n foreground: \"#14532d\",\n info: \"#0ea5e9\",\n muted: \"#f0fdf4\",\n mutedForeground: \"#4d7c5f\",\n primary: \"#15803d\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#d97706\",\n },\n name: \"forest\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Inter\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Forest theme preset.\n *\n * Character: Natural deep greens, Merriweather headings for gravitas, Inter\n * body for readability. Earthy and trustworthy.\n * Ideal for sustainability reports, environmental docs, and wellness brands.\n */\nexport const forestTheme: PdfcnTheme = {\n colors: {\n accent: \"#16a34a\",\n background: \"#ffffff\",\n border: \"#bbf7d0\",\n destructive: \"#dc2626\",\n foreground: \"#14532d\",\n info: \"#0ea5e9\",\n muted: \"#f0fdf4\",\n mutedForeground: \"#4d7c5f\",\n primary: \"#15803d\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#d97706\",\n },\n name: \"forest\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Inter\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Merriweather\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 15,\n h5: 13,\n h6: 11,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-forest.ts"
+ "target": "lib/pdf-themes/forest.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-minimal.json b/public/r/theme-minimal.json
index 8ece457..87eab13 100644
--- a/public/r/theme-minimal.json
+++ b/public/r/theme-minimal.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/minimal.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Minimal theme preset.\n *\n * Character: Courier headings, zinc neutrals, maximum whitespace.\n * shadcn-inspired restrained palette. Ideal for clean documentation,\n * technical specs, and literary manuscripts.\n */\nexport const minimalTheme: PdfcnTheme = {\n colors: {\n accent: \"#71717a\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#b91c1c\",\n foreground: \"#18181b\",\n info: \"#0369a1\",\n muted: \"#fafafa\",\n mutedForeground: \"#a1a1aa\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#a16207\",\n },\n name: \"minimal\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 18,\n page: {\n marginBottom: 72,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 72,\n },\n paragraphGap: 14,\n sectionGap: 36,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Courier\",\n fontSize: {\n h1: 24,\n h2: 20,\n h3: 16,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Minimal theme preset.\n *\n * Character: Courier headings, zinc neutrals, maximum whitespace.\n * shadcn-inspired restrained palette. Ideal for clean documentation,\n * technical specs, and literary manuscripts.\n */\nexport const minimalTheme: PdfcnTheme = {\n colors: {\n accent: \"#71717a\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#b91c1c\",\n foreground: \"#18181b\",\n info: \"#0369a1\",\n muted: \"#fafafa\",\n mutedForeground: \"#a1a1aa\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#15803d\",\n warning: \"#a16207\",\n },\n name: \"minimal\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 18,\n page: {\n marginBottom: 72,\n marginLeft: 56,\n marginRight: 56,\n marginTop: 72,\n },\n paragraphGap: 14,\n sectionGap: 36,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.65,\n },\n heading: {\n fontFamily: \"Courier\",\n fontSize: {\n h1: 24,\n h2: 20,\n h3: 16,\n h4: 14,\n h5: 12,\n h6: 10,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-minimal.ts"
+ "target": "lib/pdf-themes/minimal.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-modern.json b/public/r/theme-modern.json
index 1212488..2d05d6a 100644
--- a/public/r/theme-modern.json
+++ b/public/r/theme-modern.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/modern.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Modern theme preset.\n *\n * Character: All-Helvetica, slate-cool neutrals with subtle violet accent,\n * clean spacing. shadcn-inspired contemporary feel.\n * Ideal for startups, tech companies, and design-forward documents.\n */\nexport const modernTheme: PdfcnTheme = {\n colors: {\n accent: \"#6366f1\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#0f172a\",\n info: \"#3b82f6\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#334155\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"modern\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 12,\n page: {\n marginBottom: 40,\n marginLeft: 40,\n marginRight: 40,\n marginTop: 40,\n },\n paragraphGap: 10,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Helvetica\",\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Modern theme preset.\n *\n * Character: All-Helvetica, slate-cool neutrals with subtle violet accent,\n * clean spacing. shadcn-inspired contemporary feel.\n * Ideal for startups, tech companies, and design-forward documents.\n */\nexport const modernTheme: PdfcnTheme = {\n colors: {\n accent: \"#6366f1\",\n background: \"#ffffff\",\n border: \"#e2e8f0\",\n destructive: \"#ef4444\",\n foreground: \"#0f172a\",\n info: \"#3b82f6\",\n muted: \"#f1f5f9\",\n mutedForeground: \"#64748b\",\n primary: \"#334155\",\n primaryForeground: \"#ffffff\",\n success: \"#22c55e\",\n warning: \"#f59e0b\",\n },\n name: \"modern\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 12,\n page: {\n marginBottom: 40,\n marginLeft: 40,\n marginRight: 40,\n marginTop: 40,\n },\n paragraphGap: 10,\n sectionGap: 24,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Helvetica\",\n fontSize: {\n h1: 28,\n h2: 22,\n h3: 18,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 600,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-modern.ts"
+ "target": "lib/pdf-themes/modern.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-professional.json b/public/r/theme-professional.json
index fc7d659..741fc15 100644
--- a/public/r/theme-professional.json
+++ b/public/r/theme-professional.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/professional.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Professional theme preset.\n *\n * Character: Serif headings (Times-Roman), refined zinc/slate palette,\n * generous margins, formal document feel. shadcn-inspired minimal aesthetic.\n * Ideal for business documents, reports, and official correspondence.\n */\nexport const professionalTheme: PdfcnTheme = {\n colors: {\n accent: \"#3b82f6\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#dc2626\",\n foreground: \"#18181b\",\n info: \"#0ea5e9\",\n muted: \"#f4f4f5\",\n mutedForeground: \"#71717a\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"professional\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Times-Roman\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Professional theme preset.\n *\n * Character: Serif headings (Times-Roman), refined zinc/slate palette,\n * generous margins, formal document feel. shadcn-inspired minimal aesthetic.\n * Ideal for business documents, reports, and official correspondence.\n */\nexport const professionalTheme: PdfcnTheme = {\n colors: {\n accent: \"#3b82f6\",\n background: \"#ffffff\",\n border: \"#e4e4e7\",\n destructive: \"#dc2626\",\n foreground: \"#18181b\",\n info: \"#0ea5e9\",\n muted: \"#f4f4f5\",\n mutedForeground: \"#71717a\",\n primary: \"#18181b\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"professional\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 56,\n marginLeft: 48,\n marginRight: 48,\n marginTop: 56,\n },\n paragraphGap: 10,\n sectionGap: 28,\n },\n typography: {\n body: {\n fontFamily: \"Helvetica\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Times-Roman\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 20,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.25,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-professional.ts"
+ "target": "lib/pdf-themes/professional.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/public/r/theme-vivid.json b/public/r/theme-vivid.json
index a961ceb..01f5bbc 100644
--- a/public/r/theme-vivid.json
+++ b/public/r/theme-vivid.json
@@ -6,21 +6,27 @@
"files": [
{
"path": "registry/themes/vivid.ts",
- "content": "import { defaultPrimitives } from \"./primitives\";\nimport type { PdfcnTheme } from \"./theme-types\";\n\n/**\n * Vivid theme preset.\n *\n * Character: Deep violet/purple palette, Nunito rounded sans-serif, playful\n * but still professional. High-energy creative accent.\n * Ideal for creative agencies, startups, marketing decks, and pitch docs.\n */\nexport const vividTheme: PdfcnTheme = {\n colors: {\n accent: \"#8b5cf6\",\n background: \"#ffffff\",\n border: \"#ddd6fe\",\n destructive: \"#dc2626\",\n foreground: \"#1e1b4b\",\n info: \"#0ea5e9\",\n muted: \"#f5f3ff\",\n mutedForeground: \"#7c3aed\",\n primary: \"#6d28d9\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"vivid\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 48,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 48,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Nunito\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Nunito\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
+ "content": "import type { PdfcnTheme } from \"@/registry/types/pdf-themes\";\n\nimport { defaultPrimitives } from \"./primitives\";\n\n/**\n * Vivid theme preset.\n *\n * Character: Deep violet/purple palette, Nunito rounded sans-serif, playful\n * but still professional. High-energy creative accent.\n * Ideal for creative agencies, startups, marketing decks, and pitch docs.\n */\nexport const vividTheme: PdfcnTheme = {\n colors: {\n accent: \"#8b5cf6\",\n background: \"#ffffff\",\n border: \"#ddd6fe\",\n destructive: \"#dc2626\",\n foreground: \"#1e1b4b\",\n info: \"#0ea5e9\",\n muted: \"#f5f3ff\",\n mutedForeground: \"#7c3aed\",\n primary: \"#6d28d9\",\n primaryForeground: \"#ffffff\",\n success: \"#16a34a\",\n warning: \"#d97706\",\n },\n name: \"vivid\",\n page: {\n orientation: \"portrait\",\n size: \"A4\",\n },\n primitives: defaultPrimitives,\n spacing: {\n componentGap: 14,\n page: {\n marginBottom: 48,\n marginLeft: 44,\n marginRight: 44,\n marginTop: 48,\n },\n paragraphGap: 10,\n sectionGap: 26,\n },\n typography: {\n body: {\n fontFamily: \"Nunito\",\n fontSize: 11,\n lineHeight: 1.6,\n },\n heading: {\n fontFamily: \"Nunito\",\n fontSize: {\n h1: 32,\n h2: 24,\n h3: 19,\n h4: 16,\n h5: 14,\n h6: 12,\n },\n fontWeight: 700,\n lineHeight: 1.2,\n },\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/theme-vivid.ts"
+ "target": "lib/pdf-themes/vivid.ts"
},
{
"path": "registry/themes/primitives.ts",
- "content": "import type { PrimitiveTokens } from \"./theme-types\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
+ "content": "import type { PrimitiveTokens } from \"@/registry/types/pdf-themes\";\n\n/**\n * Default primitive tokens shared by all theme presets.\n *\n * These define the raw design scales — the \"palette\" of values available.\n * Themes select from these scales when assigning semantic tokens.\n *\n * - Typography: Major Third (1.25) ratio, 12pt base\n * - Spacing: 4pt grid system\n * - Font weights: 400–700\n * - Line heights: 1.2–1.6\n * - Border radius: 0–8pt (plus full for pills)\n * - Letter spacing: -0.025 to 0.05 (em-like ratios for PDF points)\n */\nexport const defaultPrimitives: PrimitiveTokens = {\n borderRadius: {\n full: 9999,\n lg: 8,\n md: 4,\n none: 0,\n sm: 2,\n },\n fontWeights: {\n bold: 700,\n medium: 500,\n regular: 400,\n semibold: 600,\n },\n letterSpacing: {\n normal: 0,\n tight: -0.025,\n wide: 0.025,\n wider: 0.05,\n },\n lineHeights: {\n normal: 1.4,\n relaxed: 1.6,\n tight: 1.2,\n },\n spacing: {\n 0: 0,\n 0.5: 2,\n 1: 4,\n 10: 40,\n 12: 48,\n 16: 64,\n 2: 8,\n 3: 12,\n 4: 16,\n 5: 20,\n 6: 24,\n 8: 32,\n },\n typography: {\n \"2xl\": 28,\n \"3xl\": 36,\n base: 15,\n lg: 18,\n sm: 12,\n xl: 22,\n xs: 10,\n },\n};\n",
"type": "registry:theme",
- "target": "components/pdf/primitives.ts"
+ "target": "lib/pdf-themes/primitives.ts"
},
{
- "path": "registry/themes/theme-types.ts",
- "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdfcn-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
+ "path": "registry/types/pdf-themes.ts",
+ "content": "/**\n * pdfcn Theme System — Type Definitions\n *\n * Defines the complete type hierarchy for the pdfcn PDF theme system.\n * All PDF components consume these tokens instead of hardcoding style values.\n *\n * Architecture:\n * - PrimitiveTokens: Raw design scales (typography, spacing, weights, line heights)\n * - ColorTokens: Semantic color mappings (foreground/background pairs)\n * - TypographyTokens: Font family, size, weight, and line height decisions\n * - SpacingTokens: Page margins, section/paragraph/component gaps\n * - PageTokens: Default page size and orientation\n * - PdfcnTheme: The complete theme object combining all token layers\n *\n * @example\n * ```ts\n * import type { PdfcnTheme } from '@/registry/themes';\n *\n * const myTheme: PdfcnTheme = {\n * name: 'custom',\n * primitives: { ... },\n * colors: { foreground: '#1a1a1a', ... },\n * typography: { body: { ... }, heading: { ... } },\n * spacing: { page: { ... }, sectionGap: 24, ... },\n * page: { size: 'A4', orientation: 'portrait' },\n * };\n * ```\n */\n\n// ─── Primitive Tokens ───────────────────────────────────────────────────────\n// Raw design scales. These define WHAT values are available.\n// Themes choose from these when populating semantic tokens.\n\n/** Typography scale using a Major Third (1.25) ratio with 12pt base */\nexport interface TypographyScale {\n /** 10pt — Captions, footnotes */\n xs: number;\n /** 12pt — Body text (PDF standard) */\n sm: number;\n /** 15pt — Large body, small headings */\n base: number;\n /** 18pt — H4 equivalent */\n lg: number;\n /** 22pt — H3 equivalent */\n xl: number;\n /** 28pt — H2 equivalent */\n \"2xl\": number;\n /** 36pt — H1 equivalent */\n \"3xl\": number;\n}\n\n/** Spacing scale based on a 4pt grid system */\nexport interface SpacingScale {\n /** 0pt */\n 0: number;\n /** 2pt */\n 0.5: number;\n /** 4pt */\n 1: number;\n /** 8pt */\n 2: number;\n /** 12pt */\n 3: number;\n /** 16pt */\n 4: number;\n /** 20pt */\n 5: number;\n /** 24pt */\n 6: number;\n /** 32pt */\n 8: number;\n /** 40pt */\n 10: number;\n /** 48pt */\n 12: number;\n /** 64pt */\n 16: number;\n}\n\n/** Font weight scale */\nexport interface FontWeights {\n regular: number;\n medium: number;\n semibold: number;\n bold: number;\n}\n\n/** Line height scale */\nexport interface LineHeights {\n /** 1.2 — Tight, for headings */\n tight: number;\n /** 1.4 — Normal, for body text */\n normal: number;\n /** 1.6 — Relaxed, for reading-heavy content */\n relaxed: number;\n}\n\n/** Border radius scale for rounded corners */\nexport interface BorderRadiusScale {\n /** 0pt — Sharp corners */\n none: number;\n /** 2pt — Subtle rounding */\n sm: number;\n /** 4pt — Standard rounding */\n md: number;\n /** 8pt — Pronounced rounding */\n lg: number;\n /** 9999pt — Pill/circle shape */\n full: number;\n}\n\n/** Letter spacing scale for typography adjustments */\nexport interface LetterSpacingScale {\n /** -0.025em — Tighter spacing */\n tight: number;\n /** 0em — Normal spacing */\n normal: number;\n /** 0.025em — Slightly wider spacing */\n wide: number;\n /** 0.05em — Much wider spacing (for uppercase) */\n wider: number;\n}\n\n/** Raw design scales shared across themes */\nexport interface PrimitiveTokens {\n typography: TypographyScale;\n spacing: SpacingScale;\n fontWeights: FontWeights;\n lineHeights: LineHeights;\n borderRadius: BorderRadiusScale;\n letterSpacing: LetterSpacingScale;\n}\n\n// ─── Semantic Tokens ────────────────────────────────────────────────────────\n// These map primitives to design intent. Themes differ primarily here.\n\n/**\n * Semantic color tokens using the foreground/background pair convention.\n * All values must be hex strings (e.g., '#1a1a1a').\n * react-pdf supports hex, rgb(), and hsl() — but NOT oklch.\n */\nexport interface ColorTokens {\n /** Primary text and content color */\n foreground: string;\n /** Page background color */\n background: string;\n /** Subtle background for secondary areas (e.g., code blocks, table headers) */\n muted: string;\n /** Text on muted backgrounds (captions, footnotes, timestamps) */\n mutedForeground: string;\n /** Brand/accent color for emphasis and highlights */\n primary: string;\n /** Text on primary-colored backgrounds */\n primaryForeground: string;\n /** Table borders, dividers, rules */\n border: string;\n /** Secondary accent for call-to-action elements, badges */\n accent: string;\n /** Error text, warning indicators */\n destructive: string;\n /** Success states (e.g., badges, confirmations) */\n success: string;\n /** Warning states (e.g., badges, alerts) */\n warning: string;\n /** Info states (e.g., badges, informational alerts) */\n info: string;\n}\n\n/** Typography semantic tokens — what fonts and sizes to use where */\nexport interface TypographyTokens {\n /** Body text settings */\n body: {\n /** Font family for body text (e.g., 'Helvetica') */\n fontFamily: string;\n /** Base font size in points */\n fontSize: number;\n /** Line height multiplier */\n lineHeight: number;\n };\n /** Heading text settings */\n heading: {\n /** Font family for headings (e.g., 'Times-Roman', 'Courier') */\n fontFamily: string;\n /** Font weight as numeric value (400-700) */\n fontWeight: number;\n /** Line height multiplier for headings */\n lineHeight: number;\n /** Font sizes for each heading level in points */\n fontSize: {\n h1: number;\n h2: number;\n h3: number;\n h4: number;\n h5: number;\n h6: number;\n };\n };\n}\n\n/** Spacing semantic tokens — consistent spacing across the document */\nexport interface SpacingTokens {\n /** Page margin settings in points */\n page: {\n marginTop: number;\n marginRight: number;\n marginBottom: number;\n marginLeft: number;\n };\n /** Space between major document sections (after h2, before new sections) */\n sectionGap: number;\n /** Space between paragraphs and after text blocks */\n paragraphGap: number;\n /** Space between inline components, list items, table rows */\n componentGap: number;\n}\n\n/** Page layout defaults */\nexport interface PageTokens {\n /** Default page size */\n size: \"A4\" | \"LETTER\" | \"LEGAL\";\n /** Default page orientation */\n orientation: \"portrait\" | \"landscape\";\n}\n\n// ─── Full Theme ─────────────────────────────────────────────────────────────\n\n/**\n * The complete pdfcn theme object.\n *\n * Components import this and use its tokens for all style values.\n * Since React Context doesn't work in @react-pdf/renderer,\n * the theme is a plain TypeScript object imported directly by components.\n *\n * @example\n * ```tsx\n * // In a component:\n * import { theme } from '../lib/pdf-theme';\n *\n * function createStyles(t: PdfcnTheme) {\n * return StyleSheet.create({\n * text: {\n * fontFamily: t.typography.body.fontFamily,\n * fontSize: t.typography.body.fontSize,\n * color: t.colors.foreground,\n * },\n * });\n * }\n *\n * const styles = createStyles(theme);\n * ```\n */\nexport interface PdfcnTheme {\n /** Theme name identifier */\n name: string;\n /** Raw design scales */\n primitives: PrimitiveTokens;\n /** Semantic color mappings */\n colors: ColorTokens;\n /** Typography settings for body and headings */\n typography: TypographyTokens;\n /** Spacing settings for page, sections, and components */\n spacing: SpacingTokens;\n /** Page layout defaults */\n page: PageTokens;\n}\n",
"type": "registry:theme",
- "target": "components/pdf/theme-types.ts"
+ "target": "types/pdf-themes.ts"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "content": "import type { ReactNode } from \"react\";\n\n/** CSS-like style object compatible with both Takumi and Forme */\nexport type Style = Record<string, unknown>;\n\n/**\n * Base props shared by all pdfcn PDF components.\n */\nexport interface PDFComponentProps {\n style?: Style;\n children: ReactNode;\n}\n",
+ "type": "registry:theme",
+ "target": "types/pdf-components.ts"
}
],
"type": "registry:theme"
diff --git a/registry.json b/registry.json
index b7b646d..7231fef 100644
--- a/registry.json
+++ b/registry.json
@@ -6,35 +6,31 @@
"dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
"description": "Theme context and helpers for the takumi base",
"files": [
- {
- "path": "registry/bases/takumi/lib/pdfcn-theme.ts",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
"type": "registry:lib",
"target": "lib/resolve-color.ts"
},
{
- "path": "registry/bases/takumi/lib/theme-provider.tsx",
+ "path": "registry/bases/takumi/components/theme-provider.tsx",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/takumi/lib/pdf-primitives.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/takumi/lib/pdfcn-svg.tsx",
+ "path": "registry/bases/takumi/lib/pdf-svg.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"name": "takumi/utils",
"title": "Takumi Utils",
- "type": "registry:lib"
+ "type": "registry:lib",
+ "registryDependencies": ["takumi/theme-provider"]
},
{
"dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
@@ -796,17 +792,22 @@
"files": [
{
"path": "registry/themes/professional.ts",
- "target": "components/pdf/theme-professional.ts",
+ "target": "lib/pdf-themes/professional.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -819,17 +820,22 @@
"files": [
{
"path": "registry/themes/modern.ts",
- "target": "components/pdf/theme-modern.ts",
+ "target": "lib/pdf-themes/modern.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -842,17 +848,22 @@
"files": [
{
"path": "registry/themes/minimal.ts",
- "target": "components/pdf/theme-minimal.ts",
+ "target": "lib/pdf-themes/minimal.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -865,17 +876,22 @@
"files": [
{
"path": "registry/themes/executive.ts",
- "target": "components/pdf/theme-executive.ts",
+ "target": "lib/pdf-themes/executive.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -888,17 +904,22 @@
"files": [
{
"path": "registry/themes/corporate.ts",
- "target": "components/pdf/theme-corporate.ts",
+ "target": "lib/pdf-themes/corporate.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -911,17 +932,22 @@
"files": [
{
"path": "registry/themes/elegant.ts",
- "target": "components/pdf/theme-elegant.ts",
+ "target": "lib/pdf-themes/elegant.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -934,17 +960,22 @@
"files": [
{
"path": "registry/themes/vivid.ts",
- "target": "components/pdf/theme-vivid.ts",
+ "target": "lib/pdf-themes/vivid.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -957,17 +988,22 @@
"files": [
{
"path": "registry/themes/forest.ts",
- "target": "components/pdf/theme-forest.ts",
+ "target": "lib/pdf-themes/forest.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -980,17 +1016,22 @@
"files": [
{
"path": "registry/themes/blueprint.ts",
- "target": "components/pdf/theme-blueprint.ts",
+ "target": "lib/pdf-themes/blueprint.ts",
"type": "registry:theme"
},
{
"path": "registry/themes/primitives.ts",
- "target": "components/pdf/primitives.ts",
+ "target": "lib/pdf-themes/primitives.ts",
+ "type": "registry:theme"
+ },
+ {
+ "path": "registry/types/pdf-themes.ts",
+ "target": "types/pdf-themes.ts",
"type": "registry:theme"
},
{
- "path": "registry/themes/theme-types.ts",
- "target": "components/pdf/theme-types.ts",
+ "path": "registry/types/pdf-components.ts",
+ "target": "types/pdf-components.ts",
"type": "registry:theme"
}
],
@@ -1002,11 +1043,6 @@
"dependencies": ["@formepdf/react", "@formepdf/core"],
"description": "Theme context and helpers for the forme base",
"files": [
- {
- "path": "registry/bases/forme/lib/pdfcn-theme.ts",
- "type": "registry:lib",
- "target": "lib/pdfcn-theme.ts"
- },
{
"path": "registry/bases/forme/lib/resolve-color.ts",
"type": "registry:lib",
@@ -1018,24 +1054,25 @@
"target": "lib/maybe-fixed.tsx"
},
{
- "path": "registry/bases/forme/lib/theme-provider.tsx",
+ "path": "registry/bases/forme/components/theme-provider.tsx",
"type": "registry:lib",
"target": "components/pdf/theme-provider.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-primitives.tsx",
+ "path": "registry/bases/forme/lib/pdf-primitives.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-primitives.tsx"
+ "target": "lib/pdf-primitives.tsx"
},
{
- "path": "registry/bases/forme/lib/pdfcn-svg.tsx",
+ "path": "registry/bases/forme/lib/pdf-svg.tsx",
"type": "registry:lib",
- "target": "lib/pdfcn-svg.tsx"
+ "target": "lib/pdf-svg.tsx"
}
],
"name": "forme/utils",
"title": "Forme Utils",
- "type": "registry:lib"
+ "type": "registry:lib",
+ "registryDependencies": ["forme/theme-provider"]
},
{
"dependencies": ["@formepdf/react", "@formepdf/core"],
diff --git a/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx b/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx
index c744f6d..6f2c041 100644
--- a/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx
+++ b/registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx
@@ -15,7 +15,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceClassicData } from "./invoice-classic.types";
diff --git a/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx b/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx
index 4141755..512799c 100644
--- a/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx
+++ b/registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx
@@ -13,7 +13,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceConsultantData } from "./invoice-consultant.types";
diff --git a/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx b/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx
index 1afac33..56353ce 100644
--- a/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx
+++ b/registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx
@@ -14,7 +14,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceCorporateData } from "./invoice-corporate.types";
diff --git a/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx b/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx
index b71508c..cfdc159 100644
--- a/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx
+++ b/registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx
@@ -14,7 +14,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceCreativeData } from "./invoice-creative.types";
diff --git a/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx b/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx
index 2071da9..a9f0a1a 100644
--- a/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx
+++ b/registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx
@@ -14,7 +14,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceMinimalData } from "./invoice-minimal.types";
diff --git a/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx b/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx
index d2160a3..435e9af 100644
--- a/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx
+++ b/registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx
@@ -14,7 +14,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceModernData } from "./invoice-modern.types";
diff --git a/registry/bases/forme/blocks/report-financial/report-layout.tsx b/registry/bases/forme/blocks/report-financial/report-layout.tsx
index 3eed78b..49e727c 100644
--- a/registry/bases/forme/blocks/report-financial/report-layout.tsx
+++ b/registry/bases/forme/blocks/report-financial/report-layout.tsx
@@ -13,7 +13,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/forme/blocks/report-marketing/report-layout.tsx b/registry/bases/forme/blocks/report-marketing/report-layout.tsx
index 3eed78b..49e727c 100644
--- a/registry/bases/forme/blocks/report-marketing/report-layout.tsx
+++ b/registry/bases/forme/blocks/report-marketing/report-layout.tsx
@@ -13,7 +13,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/forme/blocks/report-operations/report-layout.tsx b/registry/bases/forme/blocks/report-operations/report-layout.tsx
index 3eed78b..49e727c 100644
--- a/registry/bases/forme/blocks/report-operations/report-layout.tsx
+++ b/registry/bases/forme/blocks/report-operations/report-layout.tsx
@@ -13,7 +13,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/forme/blocks/report-security/report-layout.tsx b/registry/bases/forme/blocks/report-security/report-layout.tsx
index 3eed78b..49e727c 100644
--- a/registry/bases/forme/blocks/report-security/report-layout.tsx
+++ b/registry/bases/forme/blocks/report-security/report-layout.tsx
@@ -13,7 +13,7 @@ import {
Text,
usePdfcnTheme,
} from "@/registry/bases/forme/components";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/forme/components/alert/alert.tsx b/registry/bases/forme/components/alert/alert.tsx
index 473612b..6ede71e 100644
--- a/registry/bases/forme/components/alert/alert.tsx
+++ b/registry/bases/forme/components/alert/alert.tsx
@@ -1,18 +1,19 @@
import type { ReactNode } from "react";
-import {
- Text as PDFText,
- StyleSheet,
- View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import { Circle, Line, Path, Svg } from "@/registry/bases/forme/lib/pdfcn-svg";
import {
mergePdfStyles,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+import {
+ Text as PDFText,
+ StyleSheet,
+ View,
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import { Circle, Line, Path, Svg } from "@/registry/bases/forme/lib/pdf-svg";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type AlertVariant = "info" | "success" | "warning" | "error";
diff --git a/registry/bases/forme/components/badge/badge.tsx b/registry/bases/forme/components/badge/badge.tsx
index 27486dc..7e22c6b 100644
--- a/registry/bases/forme/components/badge/badge.tsx
+++ b/registry/bases/forme/components/badge/badge.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type BadgeVariant =
| "default"
diff --git a/registry/bases/forme/components/card/card.tsx b/registry/bases/forme/components/card/card.tsx
index 64aa294..0ceb116 100644
--- a/registry/bases/forme/components/card/card.tsx
+++ b/registry/bases/forme/components/card/card.tsx
@@ -1,16 +1,17 @@
import type { ReactNode } from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type CardVariant = "default" | "bordered" | "muted";
diff --git a/registry/bases/forme/components/data-table/data-table.styles.ts b/registry/bases/forme/components/data-table/data-table.styles.ts
index 51bf9a8..3de333b 100644
--- a/registry/bases/forme/components/data-table/data-table.styles.ts
+++ b/registry/bases/forme/components/data-table/data-table.styles.ts
@@ -1,6 +1,6 @@
import { StyleSheet } from "@formepdf/react";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates compact-mode cell and text styles for the DataTable component.
diff --git a/registry/bases/forme/components/data-table/data-table.tsx b/registry/bases/forme/components/data-table/data-table.tsx
index cd2969a..6a0ca9e 100644
--- a/registry/bases/forme/components/data-table/data-table.tsx
+++ b/registry/bases/forme/components/data-table/data-table.tsx
@@ -8,12 +8,12 @@ import {
TableHeader,
TableRow,
} from "@/registry/bases/forme/components/table";
-import { Text as PDFText } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
+} from "@/registry/bases/forme/components/theme-provider";
+import { Text as PDFText } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { createCompactStyles, formatValue } from "./data-table.styles";
import type { DataTableProps } from "./data-table.types";
diff --git a/registry/bases/forme/components/data-table/data-table.types.ts b/registry/bases/forme/components/data-table/data-table.types.ts
index 31c872c..b16ce8d 100644
--- a/registry/bases/forme/components/data-table/data-table.types.ts
+++ b/registry/bases/forme/components/data-table/data-table.types.ts
@@ -1,7 +1,7 @@
import type React from "react";
import type { TableVariant } from "@/registry/bases/forme/components/table/table.types";
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
/** DataTable row density size. */
export type DataTableSize = "default" | "compact";
diff --git a/registry/bases/forme/components/divider/divider.tsx b/registry/bases/forme/components/divider/divider.tsx
index b8b0a56..bb6ed52 100644
--- a/registry/bases/forme/components/divider/divider.tsx
+++ b/registry/bases/forme/components/divider/divider.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type DividerVariant = "solid" | "dashed" | "dotted";
export type DividerThickness = "thin" | "medium" | "thick";
diff --git a/registry/bases/forme/components/form/form.styles.ts b/registry/bases/forme/components/form/form.styles.ts
index 8748593..b4b096d 100644
--- a/registry/bases/forme/components/form/form.styles.ts
+++ b/registry/bases/forme/components/form/form.styles.ts
@@ -1,6 +1,6 @@
import { StyleSheet } from "@formepdf/react";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { PdfFormVariant } from "./form.types";
diff --git a/registry/bases/forme/components/form/form.tsx b/registry/bases/forme/components/form/form.tsx
index 660f965..dd165cf 100644
--- a/registry/bases/forme/components/form/form.tsx
+++ b/registry/bases/forme/components/form/form.tsx
@@ -1,12 +1,12 @@
-import {
- Text as PDFText,
- View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
+} from "@/registry/bases/forme/components/theme-provider";
+import {
+ Text as PDFText,
+ View,
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { createFormStyles } from "./form.styles";
import type {
diff --git a/registry/bases/forme/components/graph/graph.styles.ts b/registry/bases/forme/components/graph/graph.styles.ts
index ad21aa1..aaf1954 100644
--- a/registry/bases/forme/components/graph/graph.styles.ts
+++ b/registry/bases/forme/components/graph/graph.styles.ts
@@ -1,6 +1,6 @@
import { StyleSheet } from "@formepdf/react";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export const createGraphStyles = (t: PdfcnTheme) =>
StyleSheet.create({
diff --git a/registry/bases/forme/components/graph/graph.tsx b/registry/bases/forme/components/graph/graph.tsx
index 2fd70e3..fdd2c98 100644
--- a/registry/bases/forme/components/graph/graph.tsx
+++ b/registry/bases/forme/components/graph/graph.tsx
@@ -1,10 +1,14 @@
import type React from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import {
Circle,
G,
@@ -13,12 +17,8 @@ import {
Rect,
Svg,
SvgText,
-} from "@/registry/bases/forme/lib/pdfcn-svg";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/lib/pdf-svg";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import { createGraphStyles } from "./graph.styles";
import type { ChartLayout, GraphProps, GraphSeries } from "./graph.types";
diff --git a/registry/bases/forme/components/graph/graph.utils.ts b/registry/bases/forme/components/graph/graph.utils.ts
index a0dc4d3..c1cba20 100644
--- a/registry/bases/forme/components/graph/graph.utils.ts
+++ b/registry/bases/forme/components/graph/graph.utils.ts
@@ -1,4 +1,4 @@
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type {
ChartLayout,
diff --git a/registry/bases/forme/components/heading/heading.tsx b/registry/bases/forme/components/heading/heading.tsx
index 062bba2..8e28406 100644
--- a/registry/bases/forme/components/heading/heading.tsx
+++ b/registry/bases/forme/components/heading/heading.tsx
@@ -1,12 +1,13 @@
-import { StyleSheet, Text } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
import {
mergePdfStyles,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+import { StyleSheet, Text } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type HeadingWeight = "normal" | "medium" | "semibold" | "bold";
export type HeadingTracking = "tighter" | "tight" | "normal" | "wide" | "wider";
diff --git a/registry/bases/forme/components/index.ts b/registry/bases/forme/components/index.ts
index c2bf15f..64a8fd1 100644
--- a/registry/bases/forme/components/index.ts
+++ b/registry/bases/forme/components/index.ts
@@ -1,4 +1,4 @@
-export type { PDFComponentProps } from "@/registry/themes";
+export type { PDFComponentProps } from "@/registry/types/pdf-components";
export {
Heading,
type HeadingProps,
@@ -147,5 +147,5 @@ export {
PdfcnThemeProvider,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-export type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+export type { PdfcnTheme } from "@/registry/types/pdf-themes";
diff --git a/registry/bases/forme/components/keep-together/keep-together.tsx b/registry/bases/forme/components/keep-together/keep-together.tsx
index 73380a2..630822a 100644
--- a/registry/bases/forme/components/keep-together/keep-together.tsx
+++ b/registry/bases/forme/components/keep-together/keep-together.tsx
@@ -1,7 +1,7 @@
import type { ReactNode } from "react";
-import { View } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/themes";
+import { View } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/types/pdf-components";
export interface KeepTogetherProps {
children?: ReactNode;
diff --git a/registry/bases/forme/components/key-value/key-value.tsx b/registry/bases/forme/components/key-value/key-value.tsx
index 6c6f614..11e9040 100644
--- a/registry/bases/forme/components/key-value/key-value.tsx
+++ b/registry/bases/forme/components/key-value/key-value.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type KeyValueDirection = "horizontal" | "vertical";
export type KeyValueSize = "sm" | "md" | "lg";
diff --git a/registry/bases/forme/components/link/link.tsx b/registry/bases/forme/components/link/link.tsx
index 59d4ab3..3963169 100644
--- a/registry/bases/forme/components/link/link.tsx
+++ b/registry/bases/forme/components/link/link.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Link as PDFLink,
StyleSheet,
Text as PDFText,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type LinkVariant = "default" | "muted" | "primary";
export type LinkUnderline = "always" | "none";
diff --git a/registry/bases/forme/components/list/list.styles.ts b/registry/bases/forme/components/list/list.styles.ts
index a507b81..b609397 100644
--- a/registry/bases/forme/components/list/list.styles.ts
+++ b/registry/bases/forme/components/list/list.styles.ts
@@ -1,6 +1,6 @@
import { StyleSheet } from "@formepdf/react";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates all list styles derived from the active theme.
diff --git a/registry/bases/forme/components/list/list.tsx b/registry/bases/forme/components/list/list.tsx
index 108bb6d..ab16d1a 100644
--- a/registry/bases/forme/components/list/list.tsx
+++ b/registry/bases/forme/components/list/list.tsx
@@ -1,14 +1,14 @@
import type React from "react";
-import {
- Text as PDFText,
- View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
+} from "@/registry/bases/forme/components/theme-provider";
+import {
+ Text as PDFText,
+ View,
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { createListStyles } from "./list.styles";
import type { ListItem, ListVariant, PdfListProps } from "./list.types";
diff --git a/registry/bases/forme/components/page-break/page-break.tsx b/registry/bases/forme/components/page-break/page-break.tsx
index b1ce414..533a8ff 100644
--- a/registry/bases/forme/components/page-break/page-break.tsx
+++ b/registry/bases/forme/components/page-break/page-break.tsx
@@ -1,6 +1,6 @@
import { PageBreak as FormePageBreak } from "@formepdf/react";
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
export interface PageBreakProps extends Omit<PDFComponentProps, "children"> {
children?: never;
diff --git a/registry/bases/forme/components/page-footer/page-footer.tsx b/registry/bases/forme/components/page-footer/page-footer.tsx
index ee0a5ae..6124468 100644
--- a/registry/bases/forme/components/page-footer/page-footer.tsx
+++ b/registry/bases/forme/components/page-footer/page-footer.tsx
@@ -1,18 +1,19 @@
import type React from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Fixed,
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
const wrapFixed = (
fixed: boolean | undefined,
diff --git a/registry/bases/forme/components/page-header/page-header.tsx b/registry/bases/forme/components/page-header/page-header.tsx
index 6b37553..6f2885e 100644
--- a/registry/bases/forme/components/page-header/page-header.tsx
+++ b/registry/bases/forme/components/page-header/page-header.tsx
@@ -1,19 +1,20 @@
import type React from "react";
import type { ReactNode } from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Fixed,
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
const wrapFixed = (fixed: boolean | undefined, node: React.ReactElement) => {
if (!fixed) {
diff --git a/registry/bases/forme/components/page-number/page-number.tsx b/registry/bases/forme/components/page-number/page-number.tsx
index 42c673b..462090c 100644
--- a/registry/bases/forme/components/page-number/page-number.tsx
+++ b/registry/bases/forme/components/page-number/page-number.tsx
@@ -1,14 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type PageNumberAlign = "left" | "center" | "right";
export type PageNumberSize = "xs" | "sm" | "md";
diff --git a/registry/bases/forme/components/pdf-image/pdf-image.tsx b/registry/bases/forme/components/pdf-image/pdf-image.tsx
index f72a329..2dfdc0a 100644
--- a/registry/bases/forme/components/pdf-image/pdf-image.tsx
+++ b/registry/bases/forme/components/pdf-image/pdf-image.tsx
@@ -1,15 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Image,
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/** HTTP method used when fetching the image from a URL. */
export type PdfImageHTTPMethod =
diff --git a/registry/bases/forme/components/qrcode/qrcode.tsx b/registry/bases/forme/components/qrcode/qrcode.tsx
index f5b2b23..4dba037 100644
--- a/registry/bases/forme/components/qrcode/qrcode.tsx
+++ b/registry/bases/forme/components/qrcode/qrcode.tsx
@@ -1,18 +1,19 @@
import QRCode from "qrcode";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import { Rect, Svg } from "@/registry/bases/forme/lib/pdfcn-svg";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import { Rect, Svg } from "@/registry/bases/forme/lib/pdf-svg";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type QRCodeErrorLevel = "L" | "M" | "Q" | "H";
diff --git a/registry/bases/forme/components/section/section.tsx b/registry/bases/forme/components/section/section.tsx
index 5cd28ac..7084a7a 100644
--- a/registry/bases/forme/components/section/section.tsx
+++ b/registry/bases/forme/components/section/section.tsx
@@ -1,12 +1,13 @@
-import { StyleSheet, View } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
import {
mergePdfStyles,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+import { StyleSheet, View } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type SectionSpacing = "none" | "sm" | "md" | "lg" | "xl";
export type SectionPadding = "none" | "sm" | "md" | "lg";
diff --git a/registry/bases/forme/components/signature/signature.tsx b/registry/bases/forme/components/signature/signature.tsx
index b8ba384..f31eaea 100644
--- a/registry/bases/forme/components/signature/signature.tsx
+++ b/registry/bases/forme/components/signature/signature.tsx
@@ -1,14 +1,14 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/forme/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type SignatureVariant = "single" | "double" | "inline";
diff --git a/registry/bases/forme/components/stack/stack.tsx b/registry/bases/forme/components/stack/stack.tsx
index 0fa97bc..bd1964d 100644
--- a/registry/bases/forme/components/stack/stack.tsx
+++ b/registry/bases/forme/components/stack/stack.tsx
@@ -1,10 +1,11 @@
-import { StyleSheet, View } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+import { StyleSheet, View } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type StackGap = "none" | "sm" | "md" | "lg" | "xl";
export type StackDirection = "vertical" | "horizontal";
diff --git a/registry/bases/forme/components/table/table.styles.ts b/registry/bases/forme/components/table/table.styles.ts
index ed68e6c..a41b84e 100644
--- a/registry/bases/forme/components/table/table.styles.ts
+++ b/registry/bases/forme/components/table/table.styles.ts
@@ -1,6 +1,6 @@
import { StyleSheet } from "@formepdf/react";
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates all table styles derived from the active theme.
diff --git a/registry/bases/forme/components/table/table.tsx b/registry/bases/forme/components/table/table.tsx
index e0c68e4..03ddd0f 100644
--- a/registry/bases/forme/components/table/table.tsx
+++ b/registry/bases/forme/components/table/table.tsx
@@ -1,15 +1,15 @@
import { Children, cloneElement, isValidElement } from "react";
import type { ReactElement, ReactNode } from "react";
-import {
- Text as PDFText,
- View,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
+} from "@/registry/bases/forme/components/theme-provider";
+import {
+ Text as PDFText,
+ View,
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
import { createTableStyles } from "./table.styles";
import type {
diff --git a/registry/bases/forme/components/table/table.types.ts b/registry/bases/forme/components/table/table.types.ts
index 2de199e..6db20f7 100644
--- a/registry/bases/forme/components/table/table.types.ts
+++ b/registry/bases/forme/components/table/table.types.ts
@@ -1,4 +1,4 @@
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
/** Table visual style variant. */
export type TableVariant =
diff --git a/registry/bases/forme/components/text/text.tsx b/registry/bases/forme/components/text/text.tsx
index 624c409..4e54d8b 100644
--- a/registry/bases/forme/components/text/text.tsx
+++ b/registry/bases/forme/components/text/text.tsx
@@ -1,15 +1,16 @@
-import {
- Text as PDFText,
- StyleSheet,
-} from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
import {
mergePdfStyles,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/forme/components/theme-provider";
+import {
+ Text as PDFText,
+ StyleSheet,
+} from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
+import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type TextVariant = "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl";
export type TextWeight = "normal" | "medium" | "semibold" | "bold";
diff --git a/registry/bases/forme/lib/theme-provider.tsx b/registry/bases/forme/components/theme-provider.tsx
similarity index 86%
rename from registry/bases/forme/lib/theme-provider.tsx
rename to registry/bases/forme/components/theme-provider.tsx
index ecf81f6..cd1218b 100644
--- a/registry/bases/forme/lib/theme-provider.tsx
+++ b/registry/bases/forme/components/theme-provider.tsx
@@ -2,11 +2,11 @@ import type { Style } from "@formepdf/react";
import { isValidElement } from "react";
import type { DependencyList, ReactNode } from "react";
-import { theme as defaultTheme } from "@/registry/bases/forme/lib/pdfcn-theme";
+import { professionalTheme } from "@/registry/themes/professional";
-export type PdfcnTheme = typeof defaultTheme;
+export type PdfcnTheme = typeof professionalTheme;
-let serializedTheme = defaultTheme;
+let serializedTheme = professionalTheme;
export interface PdfcnThemeProviderProps {
theme?: PdfcnTheme;
@@ -53,7 +53,7 @@ export const PdfcnThemeProvider = ({
theme,
children,
}: PdfcnThemeProviderProps) =>
- renderForSerializer(children, theme ?? defaultTheme);
+ renderForSerializer(children, theme ?? professionalTheme);
export const usePdfcnTheme = (): PdfcnTheme => serializedTheme;
diff --git a/registry/bases/forme/components/watermark/watermark.tsx b/registry/bases/forme/components/watermark/watermark.tsx
index b742ab8..1cc441d 100644
--- a/registry/bases/forme/components/watermark/watermark.tsx
+++ b/registry/bases/forme/components/watermark/watermark.tsx
@@ -1,9 +1,9 @@
import { Watermark as FormeWatermark } from "@formepdf/react";
-import { mergeFormeStyles } from "@/registry/bases/forme/lib/pdfcn-primitives";
+import { usePdfcnTheme } from "@/registry/bases/forme/components/theme-provider";
+import { mergeFormeStyles } from "@/registry/bases/forme/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/forme/lib/resolve-color";
-import { usePdfcnTheme } from "@/registry/bases/forme/lib/theme-provider";
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
export type WatermarkPosition =
| "center"
diff --git a/registry/bases/forme/lib/maybe-fixed.tsx b/registry/bases/forme/lib/maybe-fixed.tsx
index a2ba2da..0d6dc39 100644
--- a/registry/bases/forme/lib/maybe-fixed.tsx
+++ b/registry/bases/forme/lib/maybe-fixed.tsx
@@ -1,7 +1,7 @@
import type { ReactNode } from "react";
-import { Fixed, View } from "@/registry/bases/forme/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/forme/lib/pdfcn-primitives";
+import { Fixed, View } from "@/registry/bases/forme/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/forme/lib/pdf-primitives";
export const MaybeFixed = ({
fixed,
diff --git a/registry/bases/forme/lib/pdfcn-primitives.tsx b/registry/bases/forme/lib/pdf-primitives.tsx
similarity index 100%
rename from registry/bases/forme/lib/pdfcn-primitives.tsx
rename to registry/bases/forme/lib/pdf-primitives.tsx
diff --git a/registry/bases/forme/lib/pdfcn-svg.tsx b/registry/bases/forme/lib/pdf-svg.tsx
similarity index 100%
rename from registry/bases/forme/lib/pdfcn-svg.tsx
rename to registry/bases/forme/lib/pdf-svg.tsx
diff --git a/registry/bases/forme/lib/pdfcn-theme.ts b/registry/bases/forme/lib/pdfcn-theme.ts
deleted file mode 100644
index 6e9f81d..0000000
--- a/registry/bases/forme/lib/pdfcn-theme.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { professionalTheme } from "@/registry/themes";
-
-export const theme = professionalTheme;
diff --git a/registry/bases/forme/lib/resolve-color.ts b/registry/bases/forme/lib/resolve-color.ts
index cf6e984..74b3cf1 100644
--- a/registry/bases/forme/lib/resolve-color.ts
+++ b/registry/bases/forme/lib/resolve-color.ts
@@ -1,4 +1,4 @@
-import type { ColorTokens } from "@/registry/themes";
+import type { ColorTokens } from "@/registry/types/pdf-themes";
/** Theme color token keys that can be used for the color prop */
export const THEME_COLOR_KEYS = [
diff --git a/registry/bases/forme/lib/themes.ts b/registry/bases/forme/lib/themes.ts
deleted file mode 100644
index 4f0a9f3..0000000
--- a/registry/bases/forme/lib/themes.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export type { PDFComponentProps, Style } from "@/registry/themes";
-export type {
- PdfcnTheme,
- PrimitiveTokens,
- ColorTokens,
- TypographyTokens,
- SpacingTokens,
- PageTokens,
- TypographyScale,
- SpacingScale,
- FontWeights,
- LineHeights,
- BorderRadiusScale,
- LetterSpacingScale,
-} from "@/registry/themes/theme-types";
-
-export {
- defaultPrimitives,
- professionalTheme,
- modernTheme,
- minimalTheme,
- executiveTheme,
- corporateTheme,
- elegantTheme,
- vividTheme,
- forestTheme,
- blueprintTheme,
- themePresets,
- type ThemePresetName,
-} from "@/registry/themes";
diff --git a/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx b/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx
index 30fc268..91ba8d1 100644
--- a/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx
+++ b/registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx
@@ -18,8 +18,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceClassicData } from "./invoice-classic.types";
diff --git a/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx b/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx
index d2c17df..b47ea46 100644
--- a/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx
+++ b/registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx
@@ -16,8 +16,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceConsultantData } from "./invoice-consultant.types";
diff --git a/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx b/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx
index 163608b..4f5d8b7 100644
--- a/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx
+++ b/registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx
@@ -17,8 +17,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceCorporateData } from "./invoice-corporate.types";
diff --git a/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx b/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx
index 9c852b1..e2a601d 100644
--- a/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx
+++ b/registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx
@@ -17,8 +17,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceCreativeData } from "./invoice-creative.types";
diff --git a/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx b/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx
index 1f15a07..daa3c35 100644
--- a/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx
+++ b/registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx
@@ -17,8 +17,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceMinimalData } from "./invoice-minimal.types";
diff --git a/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx b/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx
index c35184c..9419c5b 100644
--- a/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx
+++ b/registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx
@@ -17,8 +17,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { InvoiceModernData } from "./invoice-modern.types";
diff --git a/registry/bases/takumi/blocks/report-financial/report-layout.tsx b/registry/bases/takumi/blocks/report-financial/report-layout.tsx
index f1dee0d..18b778d 100644
--- a/registry/bases/takumi/blocks/report-financial/report-layout.tsx
+++ b/registry/bases/takumi/blocks/report-financial/report-layout.tsx
@@ -16,8 +16,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/takumi/blocks/report-marketing/report-layout.tsx b/registry/bases/takumi/blocks/report-marketing/report-layout.tsx
index f1dee0d..18b778d 100644
--- a/registry/bases/takumi/blocks/report-marketing/report-layout.tsx
+++ b/registry/bases/takumi/blocks/report-marketing/report-layout.tsx
@@ -16,8 +16,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/takumi/blocks/report-operations/report-layout.tsx b/registry/bases/takumi/blocks/report-operations/report-layout.tsx
index f1dee0d..18b778d 100644
--- a/registry/bases/takumi/blocks/report-operations/report-layout.tsx
+++ b/registry/bases/takumi/blocks/report-operations/report-layout.tsx
@@ -16,8 +16,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/takumi/blocks/report-security/report-layout.tsx b/registry/bases/takumi/blocks/report-security/report-layout.tsx
index f1dee0d..18b778d 100644
--- a/registry/bases/takumi/blocks/report-security/report-layout.tsx
+++ b/registry/bases/takumi/blocks/report-security/report-layout.tsx
@@ -16,8 +16,8 @@ import {
StyleSheet,
Document,
Page,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { BaseReportData } from "./report.types";
diff --git a/registry/bases/takumi/components/alert/alert.tsx b/registry/bases/takumi/components/alert/alert.tsx
index fe54344..08d972c 100644
--- a/registry/bases/takumi/components/alert/alert.tsx
+++ b/registry/bases/takumi/components/alert/alert.tsx
@@ -1,17 +1,18 @@
import type { ReactNode } from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { Circle, Line, Path, Svg } from "@/registry/bases/takumi/lib/pdfcn-svg";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import { Circle, Line, Path, Svg } from "@/registry/bases/takumi/lib/pdf-svg";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type AlertVariant = "info" | "success" | "warning" | "error";
diff --git a/registry/bases/takumi/components/badge/badge.tsx b/registry/bases/takumi/components/badge/badge.tsx
index a5babea..50a3672 100644
--- a/registry/bases/takumi/components/badge/badge.tsx
+++ b/registry/bases/takumi/components/badge/badge.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type BadgeVariant =
| "default"
diff --git a/registry/bases/takumi/components/card/card.tsx b/registry/bases/takumi/components/card/card.tsx
index d58d99b..5ed9548 100644
--- a/registry/bases/takumi/components/card/card.tsx
+++ b/registry/bases/takumi/components/card/card.tsx
@@ -1,16 +1,17 @@
import type { ReactNode } from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type CardVariant = "default" | "bordered" | "muted";
diff --git a/registry/bases/takumi/components/data-table/data-table.styles.ts b/registry/bases/takumi/components/data-table/data-table.styles.ts
index e7106fe..a2f343a 100644
--- a/registry/bases/takumi/components/data-table/data-table.styles.ts
+++ b/registry/bases/takumi/components/data-table/data-table.styles.ts
@@ -1,5 +1,5 @@
-import { StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+import { StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates compact-mode cell and text styles for the DataTable component.
diff --git a/registry/bases/takumi/components/data-table/data-table.tsx b/registry/bases/takumi/components/data-table/data-table.tsx
index ca2948a..b411092 100644
--- a/registry/bases/takumi/components/data-table/data-table.tsx
+++ b/registry/bases/takumi/components/data-table/data-table.tsx
@@ -8,12 +8,12 @@ import {
TableHeader,
TableRow,
} from "@/registry/bases/takumi/components/table";
-import { Text as PDFText } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/components/theme-provider";
+import { Text as PDFText } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { createCompactStyles, formatValue } from "./data-table.styles";
import type { DataTableProps } from "./data-table.types";
diff --git a/registry/bases/takumi/components/data-table/data-table.types.ts b/registry/bases/takumi/components/data-table/data-table.types.ts
index 4cb2ab3..0b05fa1 100644
--- a/registry/bases/takumi/components/data-table/data-table.types.ts
+++ b/registry/bases/takumi/components/data-table/data-table.types.ts
@@ -1,7 +1,7 @@
import type React from "react";
import type { TableVariant } from "@/registry/bases/takumi/components/table/table.types";
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
/** DataTable row density size. */
export type DataTableSize = "default" | "compact";
diff --git a/registry/bases/takumi/components/divider/divider.tsx b/registry/bases/takumi/components/divider/divider.tsx
index a4f09f8..90ae15c 100644
--- a/registry/bases/takumi/components/divider/divider.tsx
+++ b/registry/bases/takumi/components/divider/divider.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type DividerVariant = "solid" | "dashed" | "dotted";
export type DividerThickness = "thin" | "medium" | "thick";
diff --git a/registry/bases/takumi/components/form/form.styles.ts b/registry/bases/takumi/components/form/form.styles.ts
index 1d9ba8b..babdb07 100644
--- a/registry/bases/takumi/components/form/form.styles.ts
+++ b/registry/bases/takumi/components/form/form.styles.ts
@@ -1,5 +1,5 @@
-import { StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+import { StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type { PdfFormVariant } from "./form.types";
diff --git a/registry/bases/takumi/components/form/form.tsx b/registry/bases/takumi/components/form/form.tsx
index 63fd292..e334db9 100644
--- a/registry/bases/takumi/components/form/form.tsx
+++ b/registry/bases/takumi/components/form/form.tsx
@@ -1,12 +1,12 @@
-import {
- View,
- Text as PDFText,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/components/theme-provider";
+import {
+ View,
+ Text as PDFText,
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { createFormStyles } from "./form.styles";
import type {
diff --git a/registry/bases/takumi/components/form/form.types.ts b/registry/bases/takumi/components/form/form.types.ts
index f5786e3..d0b1c4b 100644
--- a/registry/bases/takumi/components/form/form.types.ts
+++ b/registry/bases/takumi/components/form/form.types.ts
@@ -1,4 +1,4 @@
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
/** Visual style variant for the fillable form. */
export type PdfFormVariant = "underline" | "box" | "outlined" | "ghost";
diff --git a/registry/bases/takumi/components/graph/graph.styles.ts b/registry/bases/takumi/components/graph/graph.styles.ts
index 343c59c..f5721aa 100644
--- a/registry/bases/takumi/components/graph/graph.styles.ts
+++ b/registry/bases/takumi/components/graph/graph.styles.ts
@@ -1,5 +1,5 @@
-import { StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+import { StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export const createGraphStyles = (t: PdfcnTheme) =>
StyleSheet.create({
diff --git a/registry/bases/takumi/components/graph/graph.tsx b/registry/bases/takumi/components/graph/graph.tsx
index f7a5b26..b65e45f 100644
--- a/registry/bases/takumi/components/graph/graph.tsx
+++ b/registry/bases/takumi/components/graph/graph.tsx
@@ -1,10 +1,14 @@
import type React from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import {
Circle,
G,
@@ -13,12 +17,8 @@ import {
Rect,
Svg,
SvgText,
-} from "@/registry/bases/takumi/lib/pdfcn-svg";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-svg";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import { createGraphStyles } from "./graph.styles";
import type { ChartLayout, GraphProps, GraphSeries } from "./graph.types";
diff --git a/registry/bases/takumi/components/graph/graph.types.ts b/registry/bases/takumi/components/graph/graph.types.ts
index af9ac6a..f99547d 100644
--- a/registry/bases/takumi/components/graph/graph.types.ts
+++ b/registry/bases/takumi/components/graph/graph.types.ts
@@ -1,4 +1,4 @@
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
/**
* Options for calculating graph width based on theme page margins and container context.
diff --git a/registry/bases/takumi/components/graph/graph.utils.ts b/registry/bases/takumi/components/graph/graph.utils.ts
index a0dc4d3..c1cba20 100644
--- a/registry/bases/takumi/components/graph/graph.utils.ts
+++ b/registry/bases/takumi/components/graph/graph.utils.ts
@@ -1,4 +1,4 @@
-import type { PdfcnTheme } from "@/registry/themes";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
import type {
ChartLayout,
diff --git a/registry/bases/takumi/components/heading/heading.tsx b/registry/bases/takumi/components/heading/heading.tsx
index 059c4d7..90fbd9a 100644
--- a/registry/bases/takumi/components/heading/heading.tsx
+++ b/registry/bases/takumi/components/heading/heading.tsx
@@ -1,11 +1,12 @@
-import { Text, StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/components/theme-provider";
+import { Text, StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type HeadingWeight = "normal" | "medium" | "semibold" | "bold";
export type HeadingTracking = "tighter" | "tight" | "normal" | "wide" | "wider";
diff --git a/registry/bases/takumi/components/index.ts b/registry/bases/takumi/components/index.ts
index 51367be..f16c3fd 100644
--- a/registry/bases/takumi/components/index.ts
+++ b/registry/bases/takumi/components/index.ts
@@ -1,4 +1,4 @@
-export type { PDFComponentProps } from "@/registry/themes";
+export type { PDFComponentProps } from "@/registry/types/pdf-components";
export {
Heading,
type HeadingProps,
@@ -147,5 +147,5 @@ export {
PdfcnThemeProvider,
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-export type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/components/theme-provider";
+export type { PdfcnTheme } from "@/registry/types/pdf-themes";
diff --git a/registry/bases/takumi/components/keep-together/keep-together.tsx b/registry/bases/takumi/components/keep-together/keep-together.tsx
index 1aad377..678b462 100644
--- a/registry/bases/takumi/components/keep-together/keep-together.tsx
+++ b/registry/bases/takumi/components/keep-together/keep-together.tsx
@@ -1,7 +1,7 @@
import type { ReactNode } from "react";
-import { View } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/themes";
+import { View } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/types/pdf-components";
export interface KeepTogetherProps {
children?: ReactNode;
diff --git a/registry/bases/takumi/components/key-value/key-value.tsx b/registry/bases/takumi/components/key-value/key-value.tsx
index c0aa2ea..f492474 100644
--- a/registry/bases/takumi/components/key-value/key-value.tsx
+++ b/registry/bases/takumi/components/key-value/key-value.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type KeyValueDirection = "horizontal" | "vertical";
export type KeyValueSize = "sm" | "md" | "lg";
diff --git a/registry/bases/takumi/components/link/link.tsx b/registry/bases/takumi/components/link/link.tsx
index 2a018b6..7a1b6d4 100644
--- a/registry/bases/takumi/components/link/link.tsx
+++ b/registry/bases/takumi/components/link/link.tsx
@@ -1,14 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
StyleSheet,
Link as PDFLink,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type LinkVariant = "default" | "muted" | "primary";
export type LinkUnderline = "always" | "none";
diff --git a/registry/bases/takumi/components/list/list.styles.ts b/registry/bases/takumi/components/list/list.styles.ts
index ecf404d..c3578c3 100644
--- a/registry/bases/takumi/components/list/list.styles.ts
+++ b/registry/bases/takumi/components/list/list.styles.ts
@@ -1,5 +1,5 @@
-import { StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+import { StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates all list styles derived from the active theme.
diff --git a/registry/bases/takumi/components/list/list.tsx b/registry/bases/takumi/components/list/list.tsx
index 07c601f..2d0df3d 100644
--- a/registry/bases/takumi/components/list/list.tsx
+++ b/registry/bases/takumi/components/list/list.tsx
@@ -1,14 +1,14 @@
import type React from "react";
-import {
- View,
- Text as PDFText,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/components/theme-provider";
+import {
+ View,
+ Text as PDFText,
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { createListStyles } from "./list.styles";
import type { ListItem, ListVariant, PdfListProps } from "./list.types";
diff --git a/registry/bases/takumi/components/list/list.types.ts b/registry/bases/takumi/components/list/list.types.ts
index bf9611c..ffda42d 100644
--- a/registry/bases/takumi/components/list/list.types.ts
+++ b/registry/bases/takumi/components/list/list.types.ts
@@ -1,4 +1,4 @@
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
/** List visual style variant. */
export type ListVariant =
diff --git a/registry/bases/takumi/components/page-break/page-break.tsx b/registry/bases/takumi/components/page-break/page-break.tsx
index be7547e..ca6e7b5 100644
--- a/registry/bases/takumi/components/page-break/page-break.tsx
+++ b/registry/bases/takumi/components/page-break/page-break.tsx
@@ -1,5 +1,5 @@
-import { View } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PDFComponentProps } from "@/registry/themes";
+import { View } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
export interface PageBreakProps extends Omit<PDFComponentProps, "children"> {
children?: never;
diff --git a/registry/bases/takumi/components/page-footer/page-footer.tsx b/registry/bases/takumi/components/page-footer/page-footer.tsx
index d95dd4b..81ec77d 100644
--- a/registry/bases/takumi/components/page-footer/page-footer.tsx
+++ b/registry/bases/takumi/components/page-footer/page-footer.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type PageFooterVariant =
| "simple"
diff --git a/registry/bases/takumi/components/page-header/page-header.tsx b/registry/bases/takumi/components/page-header/page-header.tsx
index 3490498..fbfc4f1 100644
--- a/registry/bases/takumi/components/page-header/page-header.tsx
+++ b/registry/bases/takumi/components/page-header/page-header.tsx
@@ -1,17 +1,18 @@
import type { ReactNode } from "react";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
View,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type PageHeaderVariant =
| "simple"
diff --git a/registry/bases/takumi/components/page-number/page-number.tsx b/registry/bases/takumi/components/page-number/page-number.tsx
index bbd9c62..5373d7c 100644
--- a/registry/bases/takumi/components/page-number/page-number.tsx
+++ b/registry/bases/takumi/components/page-number/page-number.tsx
@@ -1,14 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type PageNumberAlign = "left" | "center" | "right";
export type PageNumberSize = "xs" | "sm" | "md";
diff --git a/registry/bases/takumi/components/pdf-image/pdf-image.tsx b/registry/bases/takumi/components/pdf-image/pdf-image.tsx
index f5aafdd..9b836be 100644
--- a/registry/bases/takumi/components/pdf-image/pdf-image.tsx
+++ b/registry/bases/takumi/components/pdf-image/pdf-image.tsx
@@ -1,15 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
Image,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/** HTTP method used when fetching the image from a URL. */
export type PdfImageHTTPMethod =
diff --git a/registry/bases/takumi/components/qrcode/qrcode.tsx b/registry/bases/takumi/components/qrcode/qrcode.tsx
index 577e7ff..f757f9d 100644
--- a/registry/bases/takumi/components/qrcode/qrcode.tsx
+++ b/registry/bases/takumi/components/qrcode/qrcode.tsx
@@ -1,18 +1,19 @@
import QRCode from "qrcode";
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { Rect, Svg } from "@/registry/bases/takumi/lib/pdfcn-svg";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import { Rect, Svg } from "@/registry/bases/takumi/lib/pdf-svg";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type QRCodeErrorLevel = "L" | "M" | "Q" | "H";
diff --git a/registry/bases/takumi/components/section/section.tsx b/registry/bases/takumi/components/section/section.tsx
index 7b3772e..2013af2 100644
--- a/registry/bases/takumi/components/section/section.tsx
+++ b/registry/bases/takumi/components/section/section.tsx
@@ -1,11 +1,12 @@
-import { View, StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/components/theme-provider";
+import { View, StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type SectionSpacing = "none" | "sm" | "md" | "lg" | "xl";
export type SectionPadding = "none" | "sm" | "md" | "lg";
diff --git a/registry/bases/takumi/components/signature/signature.tsx b/registry/bases/takumi/components/signature/signature.tsx
index 7bbc927..d89a730 100644
--- a/registry/bases/takumi/components/signature/signature.tsx
+++ b/registry/bases/takumi/components/signature/signature.tsx
@@ -1,14 +1,14 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type SignatureVariant = "single" | "double" | "inline";
diff --git a/registry/bases/takumi/components/stack/stack.tsx b/registry/bases/takumi/components/stack/stack.tsx
index 772b4d5..2bdc02b 100644
--- a/registry/bases/takumi/components/stack/stack.tsx
+++ b/registry/bases/takumi/components/stack/stack.tsx
@@ -1,10 +1,11 @@
-import { View, StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+} from "@/registry/bases/takumi/components/theme-provider";
+import { View, StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type StackGap = "none" | "sm" | "md" | "lg" | "xl";
export type StackDirection = "vertical" | "horizontal";
diff --git a/registry/bases/takumi/components/table/table.styles.ts b/registry/bases/takumi/components/table/table.styles.ts
index c06072e..aa6da2c 100644
--- a/registry/bases/takumi/components/table/table.styles.ts
+++ b/registry/bases/takumi/components/table/table.styles.ts
@@ -1,5 +1,5 @@
-import { StyleSheet } from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { PdfcnTheme } from "@/registry/themes";
+import { StyleSheet } from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
/**
* Creates all table styles derived from the active theme.
diff --git a/registry/bases/takumi/components/table/table.tsx b/registry/bases/takumi/components/table/table.tsx
index f3bed4c..d1f5b4f 100644
--- a/registry/bases/takumi/components/table/table.tsx
+++ b/registry/bases/takumi/components/table/table.tsx
@@ -1,15 +1,15 @@
import { Children, cloneElement, isValidElement } from "react";
import type { ReactElement, ReactNode } from "react";
-import {
- View,
- Text as PDFText,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
import {
usePdfcnTheme,
useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
+} from "@/registry/bases/takumi/components/theme-provider";
+import {
+ View,
+ Text as PDFText,
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { createTableStyles } from "./table.styles";
import type {
diff --git a/registry/bases/takumi/components/table/table.types.ts b/registry/bases/takumi/components/table/table.types.ts
index 2de199e..6db20f7 100644
--- a/registry/bases/takumi/components/table/table.types.ts
+++ b/registry/bases/takumi/components/table/table.types.ts
@@ -1,4 +1,4 @@
-import type { PDFComponentProps } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
/** Table visual style variant. */
export type TableVariant =
diff --git a/registry/bases/takumi/components/text/text.tsx b/registry/bases/takumi/components/text/text.tsx
index 182850d..0b53d06 100644
--- a/registry/bases/takumi/components/text/text.tsx
+++ b/registry/bases/takumi/components/text/text.tsx
@@ -1,14 +1,15 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type TextVariant = "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl";
export type TextWeight = "normal" | "medium" | "semibold" | "bold";
diff --git a/registry/bases/takumi/lib/theme-provider.tsx b/registry/bases/takumi/components/theme-provider.tsx
similarity index 76%
rename from registry/bases/takumi/lib/theme-provider.tsx
rename to registry/bases/takumi/components/theme-provider.tsx
index bcf9313..997ae70 100644
--- a/registry/bases/takumi/lib/theme-provider.tsx
+++ b/registry/bases/takumi/components/theme-provider.tsx
@@ -1,11 +1,11 @@
import { isValidElement } from "react";
import type { DependencyList, ReactNode } from "react";
-import { theme as defaultTheme } from "@/registry/bases/takumi/lib/pdfcn-theme";
+import { professionalTheme } from "@/registry/themes/professional";
-export type PdfcnTheme = typeof defaultTheme;
+export type PdfcnTheme = typeof professionalTheme;
-let serializedTheme = defaultTheme;
+let serializedTheme = professionalTheme;
export interface PdfcnThemeProviderProps {
theme?: PdfcnTheme;
@@ -29,7 +29,7 @@ export const PdfcnThemeProvider = ({
theme,
children,
}: PdfcnThemeProviderProps) =>
- renderForSerializer(children, theme ?? defaultTheme);
+ renderForSerializer(children, theme ?? professionalTheme);
export const usePdfcnTheme = (): PdfcnTheme => serializedTheme;
diff --git a/registry/bases/takumi/components/watermark/watermark.tsx b/registry/bases/takumi/components/watermark/watermark.tsx
index 6177f36..64ea525 100644
--- a/registry/bases/takumi/components/watermark/watermark.tsx
+++ b/registry/bases/takumi/components/watermark/watermark.tsx
@@ -1,15 +1,16 @@
+import {
+ usePdfcnTheme,
+ useSafeMemo,
+} from "@/registry/bases/takumi/components/theme-provider";
import {
View,
Text as PDFText,
StyleSheet,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
-import type { Style } from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
+import type { Style } from "@/registry/bases/takumi/lib/pdf-primitives";
import { resolveColor } from "@/registry/bases/takumi/lib/resolve-color";
-import {
- usePdfcnTheme,
- useSafeMemo,
-} from "@/registry/bases/takumi/lib/theme-provider";
-import type { PDFComponentProps, PdfcnTheme } from "@/registry/themes";
+import type { PDFComponentProps } from "@/registry/types/pdf-components";
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
export type WatermarkPosition =
| "center"
diff --git a/registry/bases/takumi/lib/pdfcn-primitives.tsx b/registry/bases/takumi/lib/pdf-primitives.tsx
similarity index 100%
rename from registry/bases/takumi/lib/pdfcn-primitives.tsx
rename to registry/bases/takumi/lib/pdf-primitives.tsx
diff --git a/registry/bases/takumi/lib/pdfcn-svg.tsx b/registry/bases/takumi/lib/pdf-svg.tsx
similarity index 98%
rename from registry/bases/takumi/lib/pdfcn-svg.tsx
rename to registry/bases/takumi/lib/pdf-svg.tsx
index d53303d..fdb841c 100644
--- a/registry/bases/takumi/lib/pdfcn-svg.tsx
+++ b/registry/bases/takumi/lib/pdf-svg.tsx
@@ -4,7 +4,7 @@ import type { CSSProperties, ReactNode, SVGProps } from "react";
import {
normalizeTakumiStyle,
pointToCssPixel,
-} from "@/registry/bases/takumi/lib/pdfcn-primitives";
+} from "@/registry/bases/takumi/lib/pdf-primitives";
type SvgChildProps = Record<string, unknown> & {
children?: ReactNode;
diff --git a/registry/bases/takumi/lib/pdfcn-theme.ts b/registry/bases/takumi/lib/pdfcn-theme.ts
deleted file mode 100644
index 6e9f81d..0000000
--- a/registry/bases/takumi/lib/pdfcn-theme.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import { professionalTheme } from "@/registry/themes";
-
-export const theme = professionalTheme;
diff --git a/registry/bases/takumi/lib/resolve-color.ts b/registry/bases/takumi/lib/resolve-color.ts
index cf6e984..74b3cf1 100644
--- a/registry/bases/takumi/lib/resolve-color.ts
+++ b/registry/bases/takumi/lib/resolve-color.ts
@@ -1,4 +1,4 @@
-import type { ColorTokens } from "@/registry/themes";
+import type { ColorTokens } from "@/registry/types/pdf-themes";
/** Theme color token keys that can be used for the color prop */
export const THEME_COLOR_KEYS = [
diff --git a/registry/bases/takumi/lib/themes.ts b/registry/bases/takumi/lib/themes.ts
deleted file mode 100644
index 4f0a9f3..0000000
--- a/registry/bases/takumi/lib/themes.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-export type { PDFComponentProps, Style } from "@/registry/themes";
-export type {
- PdfcnTheme,
- PrimitiveTokens,
- ColorTokens,
- TypographyTokens,
- SpacingTokens,
- PageTokens,
- TypographyScale,
- SpacingScale,
- FontWeights,
- LineHeights,
- BorderRadiusScale,
- LetterSpacingScale,
-} from "@/registry/themes/theme-types";
-
-export {
- defaultPrimitives,
- professionalTheme,
- modernTheme,
- minimalTheme,
- executiveTheme,
- corporateTheme,
- elegantTheme,
- vividTheme,
- forestTheme,
- blueprintTheme,
- themePresets,
- type ThemePresetName,
-} from "@/registry/themes";
diff --git a/registry/themes.ts b/registry/themes.ts
index 65b6c57..0e9cd55 100644
--- a/registry/themes.ts
+++ b/registry/themes.ts
@@ -8,7 +8,7 @@ import { modernTheme } from "./themes/modern";
import { professionalTheme } from "./themes/professional";
import { vividTheme } from "./themes/vivid";
-export type { PDFComponentProps, Style } from "./themes/component-types";
+export type { PDFComponentProps, Style } from "@/registry/types/pdf-components";
export type {
PdfcnTheme,
PrimitiveTokens,
@@ -22,7 +22,7 @@ export type {
LineHeights,
BorderRadiusScale,
LetterSpacingScale,
-} from "./themes/theme-types";
+} from "@/registry/types/pdf-themes";
export { defaultPrimitives } from "./themes/primitives";
export { professionalTheme } from "./themes/professional";
diff --git a/registry/themes/blueprint.ts b/registry/themes/blueprint.ts
index a7912af..6fa1dbf 100644
--- a/registry/themes/blueprint.ts
+++ b/registry/themes/blueprint.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Blueprint theme preset.
diff --git a/registry/themes/corporate.ts b/registry/themes/corporate.ts
index b77d45c..4f28faa 100644
--- a/registry/themes/corporate.ts
+++ b/registry/themes/corporate.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Corporate theme preset.
diff --git a/registry/themes/elegant.ts b/registry/themes/elegant.ts
index 2f7a84f..5f27997 100644
--- a/registry/themes/elegant.ts
+++ b/registry/themes/elegant.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Elegant theme preset.
diff --git a/registry/themes/executive.ts b/registry/themes/executive.ts
index 228a735..17945ca 100644
--- a/registry/themes/executive.ts
+++ b/registry/themes/executive.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Executive theme preset.
diff --git a/registry/themes/forest.ts b/registry/themes/forest.ts
index 3df89f2..9c00db7 100644
--- a/registry/themes/forest.ts
+++ b/registry/themes/forest.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Forest theme preset.
diff --git a/registry/themes/minimal.ts b/registry/themes/minimal.ts
index 719bc63..836f95e 100644
--- a/registry/themes/minimal.ts
+++ b/registry/themes/minimal.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Minimal theme preset.
diff --git a/registry/themes/modern.ts b/registry/themes/modern.ts
index 7c89a7e..738c3db 100644
--- a/registry/themes/modern.ts
+++ b/registry/themes/modern.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Modern theme preset.
diff --git a/registry/themes/primitives.ts b/registry/themes/primitives.ts
index 16da458..b1c52d3 100644
--- a/registry/themes/primitives.ts
+++ b/registry/themes/primitives.ts
@@ -1,4 +1,4 @@
-import type { PrimitiveTokens } from "./theme-types";
+import type { PrimitiveTokens } from "@/registry/types/pdf-themes";
/**
* Default primitive tokens shared by all theme presets.
diff --git a/registry/themes/professional.ts b/registry/themes/professional.ts
index d9fbe52..8eeb17d 100644
--- a/registry/themes/professional.ts
+++ b/registry/themes/professional.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Professional theme preset.
diff --git a/registry/themes/vivid.ts b/registry/themes/vivid.ts
index 06f8f9f..5ad60c4 100644
--- a/registry/themes/vivid.ts
+++ b/registry/themes/vivid.ts
@@ -1,5 +1,6 @@
+import type { PdfcnTheme } from "@/registry/types/pdf-themes";
+
import { defaultPrimitives } from "./primitives";
-import type { PdfcnTheme } from "./theme-types";
/**
* Vivid theme preset.
diff --git a/registry/themes/component-types.ts b/registry/types/pdf-components.ts
similarity index 100%
rename from registry/themes/component-types.ts
rename to registry/types/pdf-components.ts
diff --git a/registry/themes/theme-types.ts b/registry/types/pdf-themes.ts
similarity index 99%
rename from registry/themes/theme-types.ts
rename to registry/types/pdf-themes.ts
index fe2e007..f755420 100644
--- a/registry/themes/theme-types.ts
+++ b/registry/types/pdf-themes.ts
@@ -234,7 +234,7 @@ export interface PageTokens {
* @example
* ```tsx
* // In a component:
- * import { theme } from '../lib/pdfcn-theme';
+ * import { theme } from '../lib/pdf-theme';
*
* function createStyles(t: PdfcnTheme) {
* return StyleSheet.create({