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 file paths to include 'blocks' and 'components' for improved organization

Aniket-5082b1fb42bd11b
diff --git a/content/docs/blocks/forme/invoice-classic.mdx b/content/docs/blocks/forme/invoice-classic.mdx
index 8c147ee..1a5aee8 100644
--- a/content/docs/blocks/forme/invoice-classic.mdx
+++ b/content/docs/blocks/forme/invoice-classic.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-classic/invoice-classic.tsx"
base="forme"
- title="components/pdf/invoice-classic.tsx"
+ title="components/pdf/blocks/invoice-classic/invoice-classic.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/invoice-consultant.mdx b/content/docs/blocks/forme/invoice-consultant.mdx
index 771eb2a..a9bdcfe 100644
--- a/content/docs/blocks/forme/invoice-consultant.mdx
+++ b/content/docs/blocks/forme/invoice-consultant.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-consultant/invoice-consultant.tsx"
base="forme"
- title="components/pdf/invoice-consultant.tsx"
+ title="components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/invoice-corporate.mdx b/content/docs/blocks/forme/invoice-corporate.mdx
index 2105ae5..1ba4314 100644
--- a/content/docs/blocks/forme/invoice-corporate.mdx
+++ b/content/docs/blocks/forme/invoice-corporate.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-corporate/invoice-corporate.tsx"
base="forme"
- title="components/pdf/invoice-corporate.tsx"
+ title="components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/invoice-creative.mdx b/content/docs/blocks/forme/invoice-creative.mdx
index b25bcbc..858aaa3 100644
--- a/content/docs/blocks/forme/invoice-creative.mdx
+++ b/content/docs/blocks/forme/invoice-creative.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-creative/invoice-creative.tsx"
base="forme"
- title="components/pdf/invoice-creative.tsx"
+ title="components/pdf/blocks/invoice-creative/invoice-creative.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/invoice-minimal.mdx b/content/docs/blocks/forme/invoice-minimal.mdx
index dcbd56e..6c1f528 100644
--- a/content/docs/blocks/forme/invoice-minimal.mdx
+++ b/content/docs/blocks/forme/invoice-minimal.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-minimal/invoice-minimal.tsx"
base="forme"
- title="components/pdf/invoice-minimal.tsx"
+ title="components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/invoice-modern.mdx b/content/docs/blocks/forme/invoice-modern.mdx
index 0556c95..2a2ff46 100644
--- a/content/docs/blocks/forme/invoice-modern.mdx
+++ b/content/docs/blocks/forme/invoice-modern.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/invoice-modern/invoice-modern.tsx"
base="forme"
- title="components/pdf/invoice-modern.tsx"
+ title="components/pdf/blocks/invoice-modern/invoice-modern.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/report-financial.mdx b/content/docs/blocks/forme/report-financial.mdx
index cd703fc..791ff00 100644
--- a/content/docs/blocks/forme/report-financial.mdx
+++ b/content/docs/blocks/forme/report-financial.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/report-financial/report-financial.tsx"
base="forme"
- title="components/pdf/report-financial.tsx"
+ title="components/pdf/blocks/report-financial/report-financial.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/report-marketing.mdx b/content/docs/blocks/forme/report-marketing.mdx
index ae0f4ea..9529456 100644
--- a/content/docs/blocks/forme/report-marketing.mdx
+++ b/content/docs/blocks/forme/report-marketing.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/report-marketing/report-marketing.tsx"
base="forme"
- title="components/pdf/report-marketing.tsx"
+ title="components/pdf/blocks/report-marketing/report-marketing.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/report-operations.mdx b/content/docs/blocks/forme/report-operations.mdx
index 8177164..174898a 100644
--- a/content/docs/blocks/forme/report-operations.mdx
+++ b/content/docs/blocks/forme/report-operations.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/report-operations/report-operations.tsx"
base="forme"
- title="components/pdf/report-operations.tsx"
+ title="components/pdf/blocks/report-operations/report-operations.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/forme/report-security.mdx b/content/docs/blocks/forme/report-security.mdx
index b56b557..25de4e5 100644
--- a/content/docs/blocks/forme/report-security.mdx
+++ b/content/docs/blocks/forme/report-security.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/blocks/report-security/report-security.tsx"
base="forme"
- title="components/pdf/report-security.tsx"
+ title="components/pdf/blocks/report-security/report-security.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/blocks/takumi/invoice-classic.mdx b/content/docs/blocks/takumi/invoice-classic.mdx
index 781f19e..d70b6a1 100644
--- a/content/docs/blocks/takumi/invoice-classic.mdx
+++ b/content/docs/blocks/takumi/invoice-classic.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-classic/invoice-classic.tsx"
base="takumi"
- title="components/pdf/invoice-classic.tsx"
+ title="components/pdf/blocks/invoice-classic/invoice-classic.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 dc955de..c790504 100644
--- a/content/docs/blocks/takumi/invoice-consultant.mdx
+++ b/content/docs/blocks/takumi/invoice-consultant.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-consultant/invoice-consultant.tsx"
base="takumi"
- title="components/pdf/invoice-consultant.tsx"
+ title="components/pdf/blocks/invoice-consultant/invoice-consultant.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 c917e10..3115475 100644
--- a/content/docs/blocks/takumi/invoice-corporate.mdx
+++ b/content/docs/blocks/takumi/invoice-corporate.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-corporate/invoice-corporate.tsx"
base="takumi"
- title="components/pdf/invoice-corporate.tsx"
+ title="components/pdf/blocks/invoice-corporate/invoice-corporate.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 040f8b1..35a3bf4 100644
--- a/content/docs/blocks/takumi/invoice-creative.mdx
+++ b/content/docs/blocks/takumi/invoice-creative.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-creative/invoice-creative.tsx"
base="takumi"
- title="components/pdf/invoice-creative.tsx"
+ title="components/pdf/blocks/invoice-creative/invoice-creative.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 2a5d09f..3d384f1 100644
--- a/content/docs/blocks/takumi/invoice-minimal.mdx
+++ b/content/docs/blocks/takumi/invoice-minimal.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-minimal/invoice-minimal.tsx"
base="takumi"
- title="components/pdf/invoice-minimal.tsx"
+ title="components/pdf/blocks/invoice-minimal/invoice-minimal.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 e74068e..670d48b 100644
--- a/content/docs/blocks/takumi/invoice-modern.mdx
+++ b/content/docs/blocks/takumi/invoice-modern.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/invoice-modern/invoice-modern.tsx"
base="takumi"
- title="components/pdf/invoice-modern.tsx"
+ title="components/pdf/blocks/invoice-modern/invoice-modern.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 b27b95c..8228dc1 100644
--- a/content/docs/blocks/takumi/report-financial.mdx
+++ b/content/docs/blocks/takumi/report-financial.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/report-financial/report-financial.tsx"
base="takumi"
- title="components/pdf/report-financial.tsx"
+ title="components/pdf/blocks/report-financial/report-financial.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 a340636..c862fd0 100644
--- a/content/docs/blocks/takumi/report-marketing.mdx
+++ b/content/docs/blocks/takumi/report-marketing.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/report-marketing/report-marketing.tsx"
base="takumi"
- title="components/pdf/report-marketing.tsx"
+ title="components/pdf/blocks/report-marketing/report-marketing.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 39d70bc..0481457 100644
--- a/content/docs/blocks/takumi/report-operations.mdx
+++ b/content/docs/blocks/takumi/report-operations.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/report-operations/report-operations.tsx"
base="takumi"
- title="components/pdf/report-operations.tsx"
+ title="components/pdf/blocks/report-operations/report-operations.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 b5bb665..a2f5131 100644
--- a/content/docs/blocks/takumi/report-security.mdx
+++ b/content/docs/blocks/takumi/report-security.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/blocks/report-security/report-security.tsx"
base="takumi"
- title="components/pdf/report-security.tsx"
+ title="components/pdf/blocks/report-security/report-security.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 f6b3c0f..97b24e7 100644
--- a/content/docs/components/forme/alert.mdx
+++ b/content/docs/components/forme/alert.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/alert/alert.tsx"
base="forme"
- title="components/pdf/alert.tsx"
+ title="components/pdf/alert/alert.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/badge.mdx b/content/docs/components/forme/badge.mdx
index dea0ca1..f712fe4 100644
--- a/content/docs/components/forme/badge.mdx
+++ b/content/docs/components/forme/badge.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/badge/badge.tsx"
base="forme"
- title="components/pdf/badge.tsx"
+ title="components/pdf/badge/badge.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/card.mdx b/content/docs/components/forme/card.mdx
index f852a46..44446c4 100644
--- a/content/docs/components/forme/card.mdx
+++ b/content/docs/components/forme/card.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/card/card.tsx"
base="forme"
- title="components/pdf/card.tsx"
+ title="components/pdf/card/card.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/data-table.mdx b/content/docs/components/forme/data-table.mdx
index 4f683ca..7b7d3d6 100644
--- a/content/docs/components/forme/data-table.mdx
+++ b/content/docs/components/forme/data-table.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/data-table/data-table.tsx"
base="forme"
- title="components/pdf/data-table.tsx"
+ title="components/pdf/data-table/data-table.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/divider.mdx b/content/docs/components/forme/divider.mdx
index 90b7360..aa22c17 100644
--- a/content/docs/components/forme/divider.mdx
+++ b/content/docs/components/forme/divider.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/divider/divider.tsx"
base="forme"
- title="components/pdf/divider.tsx"
+ title="components/pdf/divider/divider.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/form.mdx b/content/docs/components/forme/form.mdx
index e09e4bc..7636e08 100644
--- a/content/docs/components/forme/form.mdx
+++ b/content/docs/components/forme/form.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/form/form.tsx"
base="forme"
- title="components/pdf/form.tsx"
+ title="components/pdf/form/form.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/graph.mdx b/content/docs/components/forme/graph.mdx
index 9e4a0f9..f128f25 100644
--- a/content/docs/components/forme/graph.mdx
+++ b/content/docs/components/forme/graph.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/graph/graph.tsx"
base="forme"
- title="components/pdf/graph.tsx"
+ title="components/pdf/graph/graph.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/heading.mdx b/content/docs/components/forme/heading.mdx
index 577531a..47f42d7 100644
--- a/content/docs/components/forme/heading.mdx
+++ b/content/docs/components/forme/heading.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/heading/heading.tsx"
base="forme"
- title="components/pdf/heading.tsx"
+ title="components/pdf/heading/heading.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/keep-together.mdx b/content/docs/components/forme/keep-together.mdx
index 87bf58a..58a94f3 100644
--- a/content/docs/components/forme/keep-together.mdx
+++ b/content/docs/components/forme/keep-together.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/keep-together/keep-together.tsx"
base="forme"
- title="components/pdf/keep-together.tsx"
+ title="components/pdf/keep-together/keep-together.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/key-value.mdx b/content/docs/components/forme/key-value.mdx
index f9e78e4..1859e0b 100644
--- a/content/docs/components/forme/key-value.mdx
+++ b/content/docs/components/forme/key-value.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/key-value/key-value.tsx"
base="forme"
- title="components/pdf/key-value.tsx"
+ title="components/pdf/key-value/key-value.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/link.mdx b/content/docs/components/forme/link.mdx
index 84f0a86..e116408 100644
--- a/content/docs/components/forme/link.mdx
+++ b/content/docs/components/forme/link.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/link/link.tsx"
base="forme"
- title="components/pdf/link.tsx"
+ title="components/pdf/link/link.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/list.mdx b/content/docs/components/forme/list.mdx
index 9f12446..2717950 100644
--- a/content/docs/components/forme/list.mdx
+++ b/content/docs/components/forme/list.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/list/list.tsx"
base="forme"
- title="components/pdf/list.tsx"
+ title="components/pdf/list/list.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/page-break.mdx b/content/docs/components/forme/page-break.mdx
index 7947813..b028430 100644
--- a/content/docs/components/forme/page-break.mdx
+++ b/content/docs/components/forme/page-break.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/page-break/page-break.tsx"
base="forme"
- title="components/pdf/page-break.tsx"
+ title="components/pdf/page-break/page-break.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/page-footer.mdx b/content/docs/components/forme/page-footer.mdx
index e773751..cb774d6 100644
--- a/content/docs/components/forme/page-footer.mdx
+++ b/content/docs/components/forme/page-footer.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/page-footer/page-footer.tsx"
base="forme"
- title="components/pdf/page-footer.tsx"
+ title="components/pdf/page-footer/page-footer.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/page-header.mdx b/content/docs/components/forme/page-header.mdx
index eb5b275..53666c8 100644
--- a/content/docs/components/forme/page-header.mdx
+++ b/content/docs/components/forme/page-header.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/page-header/page-header.tsx"
base="forme"
- title="components/pdf/page-header.tsx"
+ title="components/pdf/page-header/page-header.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/page-number.mdx b/content/docs/components/forme/page-number.mdx
index f047a88..bc96616 100644
--- a/content/docs/components/forme/page-number.mdx
+++ b/content/docs/components/forme/page-number.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/page-number/page-number.tsx"
base="forme"
- title="components/pdf/page-number.tsx"
+ title="components/pdf/page-number/page-number.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/pdf-image.mdx b/content/docs/components/forme/pdf-image.mdx
index 7b77f3c..dbc7087 100644
--- a/content/docs/components/forme/pdf-image.mdx
+++ b/content/docs/components/forme/pdf-image.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/pdf-image/pdf-image.tsx"
base="forme"
- title="components/pdf/pdf-image.tsx"
+ title="components/pdf/pdf-image/pdf-image.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/qrcode.mdx b/content/docs/components/forme/qrcode.mdx
index 3cae3d8..4a61d12 100644
--- a/content/docs/components/forme/qrcode.mdx
+++ b/content/docs/components/forme/qrcode.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/qrcode/qrcode.tsx"
base="forme"
- title="components/pdf/qrcode.tsx"
+ title="components/pdf/qrcode/qrcode.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/section.mdx b/content/docs/components/forme/section.mdx
index bb657d6..559b857 100644
--- a/content/docs/components/forme/section.mdx
+++ b/content/docs/components/forme/section.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/section/section.tsx"
base="forme"
- title="components/pdf/section.tsx"
+ title="components/pdf/section/section.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/signature.mdx b/content/docs/components/forme/signature.mdx
index ebe9b9d..061a16e 100644
--- a/content/docs/components/forme/signature.mdx
+++ b/content/docs/components/forme/signature.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/signature/signature.tsx"
base="forme"
- title="components/pdf/signature.tsx"
+ title="components/pdf/signature/signature.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/stack.mdx b/content/docs/components/forme/stack.mdx
index e5b889a..a4e3db5 100644
--- a/content/docs/components/forme/stack.mdx
+++ b/content/docs/components/forme/stack.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/stack/stack.tsx"
base="forme"
- title="components/pdf/stack.tsx"
+ title="components/pdf/stack/stack.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/table.mdx b/content/docs/components/forme/table.mdx
index 2710c06..0b9307f 100644
--- a/content/docs/components/forme/table.mdx
+++ b/content/docs/components/forme/table.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/table/table.tsx"
base="forme"
- title="components/pdf/table.tsx"
+ title="components/pdf/table/table.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/text.mdx b/content/docs/components/forme/text.mdx
index 512850f..5c70a0b 100644
--- a/content/docs/components/forme/text.mdx
+++ b/content/docs/components/forme/text.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/text/text.tsx"
base="forme"
- title="components/pdf/text.tsx"
+ title="components/pdf/text/text.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/forme/watermark.mdx b/content/docs/components/forme/watermark.mdx
index 6911bbb..d0ad829 100644
--- a/content/docs/components/forme/watermark.mdx
+++ b/content/docs/components/forme/watermark.mdx
@@ -37,7 +37,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/components/watermark/watermark.tsx"
base="forme"
- title="components/pdf/watermark.tsx"
+ title="components/pdf/watermark/watermark.tsx"
/>
<ComponentSource
@@ -55,7 +55,7 @@ npm install @formepdf/react @formepdf/core
<ComponentSource
src="registry/bases/forme/lib/resolve-color.ts"
base="forme"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/content/docs/components/takumi/alert.mdx b/content/docs/components/takumi/alert.mdx
index 7a5d6de..f36de9a 100644
--- a/content/docs/components/takumi/alert.mdx
+++ b/content/docs/components/takumi/alert.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/alert/alert.tsx"
base="takumi"
- title="components/pdf/alert.tsx"
+ title="components/pdf/alert/alert.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 1988c79..a0027f2 100644
--- a/content/docs/components/takumi/badge.mdx
+++ b/content/docs/components/takumi/badge.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/badge/badge.tsx"
base="takumi"
- title="components/pdf/badge.tsx"
+ title="components/pdf/badge/badge.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 46a0c7f..0c92326 100644
--- a/content/docs/components/takumi/card.mdx
+++ b/content/docs/components/takumi/card.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/card/card.tsx"
base="takumi"
- title="components/pdf/card.tsx"
+ title="components/pdf/card/card.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 9e2de6a..3395fe8 100644
--- a/content/docs/components/takumi/data-table.mdx
+++ b/content/docs/components/takumi/data-table.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/data-table/data-table.tsx"
base="takumi"
- title="components/pdf/data-table.tsx"
+ title="components/pdf/data-table/data-table.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 ddbbb34..4fc7791 100644
--- a/content/docs/components/takumi/divider.mdx
+++ b/content/docs/components/takumi/divider.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/divider/divider.tsx"
base="takumi"
- title="components/pdf/divider.tsx"
+ title="components/pdf/divider/divider.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 6cdeafb..41d8426 100644
--- a/content/docs/components/takumi/form.mdx
+++ b/content/docs/components/takumi/form.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/form/form.tsx"
base="takumi"
- title="components/pdf/form.tsx"
+ title="components/pdf/form/form.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 eb72c35..e00d9c4 100644
--- a/content/docs/components/takumi/graph.mdx
+++ b/content/docs/components/takumi/graph.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/graph/graph.tsx"
base="takumi"
- title="components/pdf/graph.tsx"
+ title="components/pdf/graph/graph.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 9b6ff87..11b7e91 100644
--- a/content/docs/components/takumi/heading.mdx
+++ b/content/docs/components/takumi/heading.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/heading/heading.tsx"
base="takumi"
- title="components/pdf/heading.tsx"
+ title="components/pdf/heading/heading.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 894d54c..5bb2998 100644
--- a/content/docs/components/takumi/keep-together.mdx
+++ b/content/docs/components/takumi/keep-together.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/keep-together/keep-together.tsx"
base="takumi"
- title="components/pdf/keep-together.tsx"
+ title="components/pdf/keep-together/keep-together.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 0095971..c1899af 100644
--- a/content/docs/components/takumi/key-value.mdx
+++ b/content/docs/components/takumi/key-value.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/key-value/key-value.tsx"
base="takumi"
- title="components/pdf/key-value.tsx"
+ title="components/pdf/key-value/key-value.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 fbaae2f..5c3d202 100644
--- a/content/docs/components/takumi/link.mdx
+++ b/content/docs/components/takumi/link.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/link/link.tsx"
base="takumi"
- title="components/pdf/link.tsx"
+ title="components/pdf/link/link.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 6144a53..2ac14f1 100644
--- a/content/docs/components/takumi/list.mdx
+++ b/content/docs/components/takumi/list.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/list/list.tsx"
base="takumi"
- title="components/pdf/list.tsx"
+ title="components/pdf/list/list.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 d9cd5a7..d4c6ecf 100644
--- a/content/docs/components/takumi/page-break.mdx
+++ b/content/docs/components/takumi/page-break.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/page-break/page-break.tsx"
base="takumi"
- title="components/pdf/page-break.tsx"
+ title="components/pdf/page-break/page-break.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 0bdd3c1..0334434 100644
--- a/content/docs/components/takumi/page-footer.mdx
+++ b/content/docs/components/takumi/page-footer.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/page-footer/page-footer.tsx"
base="takumi"
- title="components/pdf/page-footer.tsx"
+ title="components/pdf/page-footer/page-footer.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 d91ad5d..93ec137 100644
--- a/content/docs/components/takumi/page-header.mdx
+++ b/content/docs/components/takumi/page-header.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/page-header/page-header.tsx"
base="takumi"
- title="components/pdf/page-header.tsx"
+ title="components/pdf/page-header/page-header.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 2dc2fba..01bfe8f 100644
--- a/content/docs/components/takumi/page-number.mdx
+++ b/content/docs/components/takumi/page-number.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/page-number/page-number.tsx"
base="takumi"
- title="components/pdf/page-number.tsx"
+ title="components/pdf/page-number/page-number.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 ea1ac0b..6260f37 100644
--- a/content/docs/components/takumi/pdf-image.mdx
+++ b/content/docs/components/takumi/pdf-image.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/pdf-image/pdf-image.tsx"
base="takumi"
- title="components/pdf/pdf-image.tsx"
+ title="components/pdf/pdf-image/pdf-image.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 392d52a..819d1dc 100644
--- a/content/docs/components/takumi/qrcode.mdx
+++ b/content/docs/components/takumi/qrcode.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/qrcode/qrcode.tsx"
base="takumi"
- title="components/pdf/qrcode.tsx"
+ title="components/pdf/qrcode/qrcode.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 d911387..6e18a97 100644
--- a/content/docs/components/takumi/section.mdx
+++ b/content/docs/components/takumi/section.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/section/section.tsx"
base="takumi"
- title="components/pdf/section.tsx"
+ title="components/pdf/section/section.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 2519a49..eb99904 100644
--- a/content/docs/components/takumi/signature.mdx
+++ b/content/docs/components/takumi/signature.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/signature/signature.tsx"
base="takumi"
- title="components/pdf/signature.tsx"
+ title="components/pdf/signature/signature.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 25ecb7c..f6e6b5b 100644
--- a/content/docs/components/takumi/stack.mdx
+++ b/content/docs/components/takumi/stack.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/stack/stack.tsx"
base="takumi"
- title="components/pdf/stack.tsx"
+ title="components/pdf/stack/stack.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 5385da9..ffee339 100644
--- a/content/docs/components/takumi/table.mdx
+++ b/content/docs/components/takumi/table.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/table/table.tsx"
base="takumi"
- title="components/pdf/table.tsx"
+ title="components/pdf/table/table.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 d7f58da..eb17456 100644
--- a/content/docs/components/takumi/text.mdx
+++ b/content/docs/components/takumi/text.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/text/text.tsx"
base="takumi"
- title="components/pdf/text.tsx"
+ title="components/pdf/text/text.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-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 1404370..381107a 100644
--- a/content/docs/components/takumi/watermark.mdx
+++ b/content/docs/components/takumi/watermark.mdx
@@ -37,7 +37,7 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/components/watermark/watermark.tsx"
base="takumi"
- title="components/pdf/watermark.tsx"
+ title="components/pdf/watermark/watermark.tsx"
/>
<ComponentSource
@@ -55,19 +55,19 @@ npm install takumi-pdf @takumi-rs/helpers
<ComponentSource
src="registry/bases/takumi/lib/resolve-color.ts"
base="takumi"
- title="components/pdf/resolve-color.ts"
+ title="lib/resolve-color.ts"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-primitives.tsx"
base="takumi"
- title="components/pdf/pdfcn-primitives.tsx"
+ title="lib/pdfcn-primitives.tsx"
/>
<ComponentSource
src="registry/bases/takumi/lib/pdfcn-svg.tsx"
base="takumi"
- title="components/pdf/pdfcn-svg.tsx"
+ title="lib/pdfcn-svg.tsx"
/>
<Step>Update the import paths to match your project setup.</Step>
diff --git a/lib/format-code.ts b/lib/format-code.ts
index 1b50562..2b727bb 100644
--- a/lib/format-code.ts
+++ b/lib/format-code.ts
@@ -2,6 +2,8 @@ import { transformIcons, transformMenu, transformRender } from "shadcn/utils";
import { Project, ScriptKind } from "ts-morph";
import type { SourceFile } from "ts-morph";
+import { BASES } from "@/registry/bases";
+
const buildDisplayConfig = () => ({
$schema: "https://ui.shadcn.com/schema.json",
aliases: {
@@ -44,40 +46,20 @@ type DisplayTransformer = (opts: {
export const formatCode = async (code: string) => {
let formattedCode = code;
- formattedCode = formattedCode.replaceAll(
- "@/registry/new-york/",
- "@/components/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/forme/lib/",
- "@/components/pdf/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/forme/components/",
- "@/components/pdf/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/takumi/lib/",
- "@/components/pdf/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/takumi/components/",
- "@/components/pdf/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/takumi/blocks/",
- "@/components/pdf/blocks/"
- );
-
- formattedCode = formattedCode.replaceAll(
- "@/registry/bases/forme/blocks/",
- "@/components/pdf/blocks/"
- );
+ for (const base of BASES) {
+ formattedCode = formattedCode.replaceAll(
+ `@/registry/bases/${base.name}/lib/`,
+ "@/lib/"
+ );
+ formattedCode = formattedCode.replaceAll(
+ `@/registry/bases/${base.name}/components/`,
+ "@/components/pdf/"
+ );
+ formattedCode = formattedCode.replaceAll(
+ `@/registry/bases/${base.name}/blocks/`,
+ "@/components/pdf/"
+ );
+ }
formattedCode = formattedCode.replaceAll(
"@/registry/themes",
diff --git a/public/r/forme/alert.json b/public/r/forme/alert.json
index 2297b38..c6d19cd 100644
--- a/public/r/forme/alert.json
+++ b/public/r/forme/alert.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/forme/components/alert/index.ts",
"content": "export { PdfAlert, type PdfAlertProps, type AlertVariant } from \"./alert\";\n",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/badge.json b/public/r/forme/badge.json
index 8981ab1..d6aa52a 100644
--- a/public/r/forme/badge.json
+++ b/public/r/forme/badge.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/forme/components/badge/index.ts",
"content": "export {\n Badge,\n type BadgeProps,\n type BadgeVariant,\n type BadgeSize,\n} from \"./badge\";\n",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/card.json b/public/r/forme/card.json
index 9d0774c..441e0fc 100644
--- a/public/r/forme/card.json
+++ b/public/r/forme/card.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/forme/components/card/index.ts",
"content": "export { PdfCard, type PdfCardProps, type CardVariant } from \"./card\";\n",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/data-table.json b/public/r/forme/data-table.json
index 19e4ba5..810ab5c 100644
--- a/public/r/forme/data-table.json
+++ b/public/r/forme/data-table.json
@@ -16,25 +16,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/forme/components/data-table/index.ts",
"content": "export { DataTable } from \"./data-table\";\nexport type {\n DataTableProps,\n DataTableColumn,\n DataTableSize,\n} from \"./data-table.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/divider.json b/public/r/forme/divider.json
index b8ba859..885dc0f 100644
--- a/public/r/forme/divider.json
+++ b/public/r/forme/divider.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/forme/components/divider/index.ts",
"content": "export {\n Divider,\n type DividerProps,\n type DividerVariant,\n type DividerThickness,\n type DividerSpacing,\n} from \"./divider\";\n",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/form.json b/public/r/forme/form.json
index 15096af..33fc19f 100644
--- a/public/r/forme/form.json
+++ b/public/r/forme/form.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/forme/components/form/form.types.ts",
"content": "import type { Style } from \"@formepdf/react\";\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/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/forme/components/form/index.ts",
"content": "export { PdfForm } from \"./form\";\nexport type {\n PdfFormProps,\n PdfFormVariant,\n PdfFormField,\n PdfFormGroup,\n FormLayout,\n FormLabelPosition,\n} from \"./form.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/graph.json b/public/r/forme/graph.json
index 6928580..2221ec4 100644
--- a/public/r/forme/graph.json
+++ b/public/r/forme/graph.json
@@ -15,31 +15,31 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/forme/components/graph/graph.types.ts",
"content": "import type { Style } from \"@formepdf/react\";\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/components/graph/graph.types.ts"
+ "target": "components/pdf/graph/graph.types.ts"
},
{
"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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/forme/components/graph/index.ts",
"content": "export { PdfGraph } from \"./graph\";\nexport { A4_WIDTH, GRAPH_SAFE_WIDTHS, getGraphWidth } from \"./graph.utils\";\nexport type {\n GraphDataPoint,\n GraphLegendPosition,\n GraphProps,\n GraphSeries,\n GraphVariant,\n GraphWidthOptions,\n} from \"./graph.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/heading.json b/public/r/forme/heading.json
index 41c6216..5a568fb 100644
--- a/public/r/forme/heading.json
+++ b/public/r/forme/heading.json
@@ -13,15 +13,15 @@
"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 {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/forme/components/heading/index.ts",
"content": "export {\n Heading,\n type HeadingProps,\n type HeadingWeight,\n type HeadingTracking,\n} from \"./heading\";\n",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/keep-together.json b/public/r/forme/keep-together.json
index 7adad77..fa64302 100644
--- a/public/r/forme/keep-together.json
+++ b/public/r/forme/keep-together.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/forme/components/keep-together/index.ts",
"content": "export { KeepTogether, type KeepTogetherProps } from \"./keep-together\";\n",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/key-value.json b/public/r/forme/key-value.json
index 221438f..f0bc65a 100644
--- a/public/r/forme/key-value.json
+++ b/public/r/forme/key-value.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/forme/components/key-value/index.ts",
"content": "export {\n KeyValue,\n type KeyValueProps,\n type KeyValueEntry,\n type KeyValueDirection,\n type KeyValueSize,\n} from \"./key-value\";\n",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/link.json b/public/r/forme/link.json
index e432490..4712ae6 100644
--- a/public/r/forme/link.json
+++ b/public/r/forme/link.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/forme/components/link/index.ts",
"content": "export {\n Link,\n type LinkProps,\n type LinkVariant,\n type LinkUnderline,\n} from \"./link\";\n",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/list.json b/public/r/forme/list.json
index 565a067..059605c 100644
--- a/public/r/forme/list.json
+++ b/public/r/forme/list.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/forme/components/list/list.types.ts",
"content": "import type { Style } from \"@formepdf/react\";\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/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/forme/components/list/index.ts",
"content": "export { PdfList } from \"./list\";\nexport type { PdfListProps, ListVariant, ListItem } from \"./list.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/page-break.json b/public/r/forme/page-break.json
index 453e521..aeb2914 100644
--- a/public/r/forme/page-break.json
+++ b/public/r/forme/page-break.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/forme/components/page-break/index.ts",
"content": "export { PageBreak } from \"./page-break\";\nexport type { PageBreakProps } from \"./page-break\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/page-footer.json b/public/r/forme/page-footer.json
index f445e4d..e8f7fe6 100644
--- a/public/r/forme/page-footer.json
+++ b/public/r/forme/page-footer.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/forme/components/page-footer/index.ts",
"content": "export {\n PageFooter,\n type PageFooterProps,\n type PageFooterVariant,\n} from \"./page-footer\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/page-header.json b/public/r/forme/page-header.json
index a71d62e..2100c1b 100644
--- a/public/r/forme/page-header.json
+++ b/public/r/forme/page-header.json
@@ -13,15 +13,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/forme/components/page-header/index.ts",
"content": "export {\n PageHeader,\n type PageHeaderProps,\n type PageHeaderVariant,\n} from \"./page-header\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/page-number.json b/public/r/forme/page-number.json
index 8a735dc..03eb6a5 100644
--- a/public/r/forme/page-number.json
+++ b/public/r/forme/page-number.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/forme/components/page-number/index.ts",
"content": "export {\n PdfPageNumber,\n type PdfPageNumberProps,\n type PageNumberAlign,\n type PageNumberSize,\n} from \"./page-number\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/pdf-image.json b/public/r/forme/pdf-image.json
index 6a7a582..21c25af 100644
--- a/public/r/forme/pdf-image.json
+++ b/public/r/forme/pdf-image.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/forme/components/pdf-image/index.ts",
"content": "export {\n PdfImage,\n type PdfImageProps,\n type PdfImageSrc,\n type PdfImageVariant,\n type PdfImageFit,\n} from \"./pdf-image\";\n",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/qrcode.json b/public/r/forme/qrcode.json
index cd89561..17bed04 100644
--- a/public/r/forme/qrcode.json
+++ b/public/r/forme/qrcode.json
@@ -14,15 +14,15 @@
"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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/forme/components/qrcode/index.ts",
"content": "export {\n PdfQRCode,\n type PdfQRCodeProps,\n type QRCodeErrorLevel,\n} from \"./qrcode\";\n",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/section.json b/public/r/forme/section.json
index 5bb955d..3ec569a 100644
--- a/public/r/forme/section.json
+++ b/public/r/forme/section.json
@@ -13,15 +13,15 @@
"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 {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/forme/components/section/index.ts",
"content": "export {\n Section,\n type SectionProps,\n type SectionSpacing,\n type SectionPadding,\n type SectionVariant,\n} from \"./section\";\n",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/signature.json b/public/r/forme/signature.json
index 98c9fe4..47dd610 100644
--- a/public/r/forme/signature.json
+++ b/public/r/forme/signature.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/forme/components/signature/index.ts",
"content": "export {\n PdfSignatureBlock,\n type PdfSignatureBlockProps,\n type SignatureVariant,\n type SignatureSigner,\n} from \"./signature\";\n",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/stack.json b/public/r/forme/stack.json
index 570bdae..c5c3ffd 100644
--- a/public/r/forme/stack.json
+++ b/public/r/forme/stack.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/forme/components/stack/index.ts",
"content": "export {\n Stack,\n type StackProps,\n type StackGap,\n type StackDirection,\n type StackAlign,\n type StackJustify,\n} from \"./stack\";\n",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/table.json b/public/r/forme/table.json
index e009181..c0b8f55 100644
--- a/public/r/forme/table.json
+++ b/public/r/forme/table.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/forme/components/table/index.ts",
"content": "export {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableCell,\n} from \"./table\";\nexport type {\n TableProps,\n TableSectionProps,\n TableRowProps,\n TableCellProps,\n TableVariant,\n} from \"./table.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/text.json b/public/r/forme/text.json
index ffb35ad..8637e47 100644
--- a/public/r/forme/text.json
+++ b/public/r/forme/text.json
@@ -13,15 +13,15 @@
"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 {\n mergePdfStyles,\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/forme/components/text/index.ts",
"content": "export {\n Text,\n type TextProps,\n type TextVariant,\n type TextWeight,\n type TextDecoration,\n} from \"./text\";\n",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/forme/utils.json b/public/r/forme/utils.json
index c45dff6..d0346cf 100644
--- a/public/r/forme/utils.json
+++ b/public/r/forme/utils.json
@@ -12,19 +12,37 @@
"path": "registry/bases/forme/lib/pdfcn-theme.ts",
"content": "import { professionalTheme } from \"@/registry/themes\";\n\nexport const theme = professionalTheme;\n",
"type": "registry:lib",
- "target": "components/pdf/lib/pdfcn-theme.ts"
+ "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",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/forme/lib/maybe-fixed.tsx",
"content": "import type { ReactNode } from \"react\";\n\nimport { Fixed, View } from \"./pdfcn-primitives\";\nimport type { Style } from \"./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",
"type": "registry:lib",
- "target": "components/pdf/lib/maybe-fixed.tsx"
+ "target": "lib/maybe-fixed.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/theme-provider.tsx",
+ "content": "/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport type { Style } from \"@formepdf/react\";\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nlet serializedTheme = defaultTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\ntype PdfStyleInput = Style | PdfStyleInput[] | false | null | undefined;\n\nconst mergeStyleInput = (target: Style, input: PdfStyleInput): void => {\n if (Array.isArray(input)) {\n for (const item of input) {\n mergeStyleInput(target, item);\n }\n } else if (input) {\n Object.assign(target, input);\n }\n};\n\n/** Flattens React-PDF-style arrays into the object Forme serializes. */\nexport const mergePdfStyles = (...inputs: PdfStyleInput[]): Style => {\n const merged: Style = {};\n for (const input of inputs) {\n mergeStyleInput(merged, input);\n }\n return merged;\n};\n\n/**\n * Forme serializes function components directly instead of mounting a React\n * tree. Resolve the provider's child so <Document> remains the top-level node.\n */\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n if ((children.type as { __formeType?: string }).__formeType === \"Document\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? defaultTheme);\n\n/** Returns the theme selected by the nearest serialized provider. */\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-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"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-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"
}
],
"type": "registry:lib"
diff --git a/public/r/forme/watermark.json b/public/r/forme/watermark.json
index a8c8538..e2b3c68 100644
--- a/public/r/forme/watermark.json
+++ b/public/r/forme/watermark.json
@@ -13,15 +13,15 @@
"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 { usePdfcnTheme } from \"@/registry/bases/forme/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/forme/lib/resolve-color\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/forme/components/watermark/index.ts",
"content": "export {\n PdfWatermark,\n type PdfWatermarkProps,\n type WatermarkPosition,\n} from \"./watermark\";\n",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/registry.json b/public/r/registry.json
index e18ee81..2267495 100644
--- a/public/r/registry.json
+++ b/public/r/registry.json
@@ -3,18 +3,36 @@
"homepage": "https://pdfcn.vercel.app",
"items": [
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Theme context and helpers for the takumi base",
"files": [
{
"path": "registry/bases/takumi/lib/pdfcn-theme.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/pdfcn-theme.ts"
+ "target": "lib/pdfcn-theme.ts"
},
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
+ },
+ {
+ "path": "registry/bases/takumi/lib/theme-provider.tsx",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/takumi/lib/pdfcn-primitives.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-primitives.tsx"
+ },
+ {
+ "path": "registry/bases/takumi/lib/pdfcn-svg.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-svg.tsx"
}
],
"name": "takumi/utils",
@@ -22,542 +40,667 @@
"type": "registry:lib"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Alert PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/alert/alert.tsx",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/takumi/components/alert/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"name": "takumi/alert",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Alert",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Badge PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/badge/badge.tsx",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/takumi/components/badge/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"name": "takumi/badge",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Badge",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Card PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/card/card.tsx",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/takumi/components/card/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"name": "takumi/card",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Card",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Data Table PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/data-table/data-table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/takumi/components/data-table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"name": "takumi/data-table",
- "registryDependencies": ["takumi/utils", "takumi/table"],
+ "registryDependencies": [
+ "takumi/utils",
+ "takumi/table"
+ ],
"title": "Data Table",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Divider PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/divider/divider.tsx",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/takumi/components/divider/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"name": "takumi/divider",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Divider",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Form PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/form/form.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/takumi/components/form/form.tsx",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/takumi/components/form/form.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/takumi/components/form/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"name": "takumi/form",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Form",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Graph PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/graph/graph.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.tsx",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/takumi/components/graph/graph.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.types.ts"
+ "target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.utils.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/takumi/components/graph/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"name": "takumi/graph",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Graph",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Heading PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/heading/heading.tsx",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/takumi/components/heading/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"name": "takumi/heading",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Heading",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Keep Together PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/keep-together/keep-together.tsx",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/takumi/components/keep-together/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"name": "takumi/keep-together",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Keep Together",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Key Value PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/key-value/key-value.tsx",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/takumi/components/key-value/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"name": "takumi/key-value",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Key Value",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Link PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/link/link.tsx",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/takumi/components/link/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"name": "takumi/link",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Link",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "List PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/list/list.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/takumi/components/list/list.tsx",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/takumi/components/list/list.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/takumi/components/list/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"name": "takumi/list",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "List",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Page Break PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/page-break/page-break.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/takumi/components/page-break/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"name": "takumi/page-break",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Page Break",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Page Footer PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/page-footer/page-footer.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/takumi/components/page-footer/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"name": "takumi/page-footer",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Page Footer",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Page Header PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/page-header/page-header.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/takumi/components/page-header/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"name": "takumi/page-header",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Page Header",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Page Number PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/page-number/page-number.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/takumi/components/page-number/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"name": "takumi/page-number",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Page Number",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Pdf Image PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/pdf-image/pdf-image.tsx",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/takumi/components/pdf-image/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"name": "takumi/pdf-image",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Pdf Image",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers", "qrcode"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers",
+ "qrcode"
+ ],
"description": "Qrcode PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/qrcode/qrcode.tsx",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/takumi/components/qrcode/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"name": "takumi/qrcode",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Qrcode",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Section PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/section/section.tsx",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/takumi/components/section/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"name": "takumi/section",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Section",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Signature PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/signature/signature.tsx",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/takumi/components/signature/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"name": "takumi/signature",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Signature",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Stack PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/stack/stack.tsx",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/takumi/components/stack/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"name": "takumi/stack",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Stack",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Table PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/table/table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/takumi/components/table/table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/takumi/components/table/table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/takumi/components/table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"name": "takumi/table",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Table",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Text PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/text/text.tsx",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/takumi/components/text/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"name": "takumi/text",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Text",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Watermark PDF component (takumi)",
"files": [
{
"path": "registry/bases/takumi/components/watermark/watermark.tsx",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/takumi/components/watermark/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"name": "takumi/watermark",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Watermark",
"type": "registry:ui"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Classic PDF block (takumi)",
"files": [
{
@@ -572,12 +715,17 @@
}
],
"name": "takumi/invoice-classic",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Classic",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Consultant PDF block (takumi)",
"files": [
{
@@ -592,12 +740,17 @@
}
],
"name": "takumi/invoice-consultant",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Consultant",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Corporate PDF block (takumi)",
"files": [
{
@@ -612,12 +765,17 @@
}
],
"name": "takumi/invoice-corporate",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Corporate",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Creative PDF block (takumi)",
"files": [
{
@@ -632,12 +790,17 @@
}
],
"name": "takumi/invoice-creative",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Creative",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Minimal PDF block (takumi)",
"files": [
{
@@ -652,12 +815,17 @@
}
],
"name": "takumi/invoice-minimal",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Minimal",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Invoice Modern PDF block (takumi)",
"files": [
{
@@ -672,12 +840,17 @@
}
],
"name": "takumi/invoice-modern",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Invoice Modern",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Report Financial PDF block (takumi)",
"files": [
{
@@ -697,12 +870,17 @@
}
],
"name": "takumi/report-financial",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Report Financial",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Report Marketing PDF block (takumi)",
"files": [
{
@@ -722,12 +900,17 @@
}
],
"name": "takumi/report-marketing",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Report Marketing",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Report Operations PDF block (takumi)",
"files": [
{
@@ -747,12 +930,17 @@
}
],
"name": "takumi/report-operations",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Report Operations",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "Report Security PDF block (takumi)",
"files": [
{
@@ -772,12 +960,17 @@
}
],
"name": "takumi/report-security",
- "registryDependencies": ["takumi/utils"],
+ "registryDependencies": [
+ "takumi/utils"
+ ],
"title": "Report Security",
"type": "registry:block"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "professional theme tokens for takumi",
"files": [
{
@@ -806,7 +999,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "modern theme tokens for takumi",
"files": [
{
@@ -835,7 +1031,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "minimal theme tokens for takumi",
"files": [
{
@@ -864,7 +1063,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "executive theme tokens for takumi",
"files": [
{
@@ -893,7 +1095,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "corporate theme tokens for takumi",
"files": [
{
@@ -922,7 +1127,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "elegant theme tokens for takumi",
"files": [
{
@@ -951,7 +1159,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "vivid theme tokens for takumi",
"files": [
{
@@ -980,7 +1191,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "forest theme tokens for takumi",
"files": [
{
@@ -1009,7 +1223,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["takumi-pdf", "@takumi-rs/helpers"],
+ "dependencies": [
+ "takumi-pdf",
+ "@takumi-rs/helpers"
+ ],
"description": "blueprint theme tokens for takumi",
"files": [
{
@@ -1038,23 +1255,41 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "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": "components/pdf/lib/pdfcn-theme.ts"
+ "target": "lib/pdfcn-theme.ts"
},
{
"path": "registry/bases/forme/lib/resolve-color.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/forme/lib/maybe-fixed.tsx",
"type": "registry:lib",
- "target": "components/pdf/lib/maybe-fixed.tsx"
+ "target": "lib/maybe-fixed.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/theme-provider.tsx",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-primitives.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-primitives.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-svg.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-svg.tsx"
}
],
"name": "forme/utils",
@@ -1062,542 +1297,667 @@
"type": "registry:lib"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Alert PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/alert/alert.tsx",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/forme/components/alert/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"name": "forme/alert",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Alert",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Badge PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/badge/badge.tsx",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/forme/components/badge/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"name": "forme/badge",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Badge",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Card PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/card/card.tsx",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/forme/components/card/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"name": "forme/card",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Card",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Data Table PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/data-table/data-table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/forme/components/data-table/data-table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/forme/components/data-table/data-table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/forme/components/data-table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"name": "forme/data-table",
- "registryDependencies": ["forme/utils", "forme/table"],
+ "registryDependencies": [
+ "forme/utils",
+ "forme/table"
+ ],
"title": "Data Table",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Divider PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/divider/divider.tsx",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/forme/components/divider/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"name": "forme/divider",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Divider",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Form PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/form/form.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/forme/components/form/form.tsx",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/forme/components/form/form.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/forme/components/form/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"name": "forme/form",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Form",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Graph PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/graph/graph.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.tsx",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/forme/components/graph/graph.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.types.ts"
+ "target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.utils.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/forme/components/graph/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"name": "forme/graph",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Graph",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Heading PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/heading/heading.tsx",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/forme/components/heading/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"name": "forme/heading",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Heading",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Keep Together PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/keep-together/keep-together.tsx",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/forme/components/keep-together/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"name": "forme/keep-together",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Keep Together",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Key Value PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/key-value/key-value.tsx",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/forme/components/key-value/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"name": "forme/key-value",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Key Value",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Link PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/link/link.tsx",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/forme/components/link/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"name": "forme/link",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Link",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "List PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/list/list.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/forme/components/list/list.tsx",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/forme/components/list/list.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/forme/components/list/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"name": "forme/list",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "List",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Page Break PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/page-break/page-break.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/forme/components/page-break/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"name": "forme/page-break",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Page Break",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Page Footer PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/page-footer/page-footer.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/forme/components/page-footer/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"name": "forme/page-footer",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Page Footer",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Page Header PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/page-header/page-header.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/forme/components/page-header/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"name": "forme/page-header",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Page Header",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Page Number PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/page-number/page-number.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/forme/components/page-number/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"name": "forme/page-number",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Page Number",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Pdf Image PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/pdf-image/pdf-image.tsx",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/forme/components/pdf-image/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"name": "forme/pdf-image",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Pdf Image",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core", "qrcode"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core",
+ "qrcode"
+ ],
"description": "Qrcode PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/qrcode/qrcode.tsx",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/forme/components/qrcode/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"name": "forme/qrcode",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Qrcode",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Section PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/section/section.tsx",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/forme/components/section/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"name": "forme/section",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Section",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Signature PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/signature/signature.tsx",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/forme/components/signature/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"name": "forme/signature",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Signature",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Stack PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/stack/stack.tsx",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/forme/components/stack/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"name": "forme/stack",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Stack",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Table PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/table/table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/forme/components/table/table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/forme/components/table/table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/forme/components/table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"name": "forme/table",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Table",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Text PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/text/text.tsx",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/forme/components/text/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"name": "forme/text",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Text",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Watermark PDF component (forme)",
"files": [
{
"path": "registry/bases/forme/components/watermark/watermark.tsx",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/forme/components/watermark/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"name": "forme/watermark",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Watermark",
"type": "registry:ui"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Classic PDF block (forme)",
"files": [
{
@@ -1612,12 +1972,17 @@
}
],
"name": "forme/invoice-classic",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Classic",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Consultant PDF block (forme)",
"files": [
{
@@ -1632,12 +1997,17 @@
}
],
"name": "forme/invoice-consultant",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Consultant",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Corporate PDF block (forme)",
"files": [
{
@@ -1652,12 +2022,17 @@
}
],
"name": "forme/invoice-corporate",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Corporate",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Creative PDF block (forme)",
"files": [
{
@@ -1672,12 +2047,17 @@
}
],
"name": "forme/invoice-creative",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Creative",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Minimal PDF block (forme)",
"files": [
{
@@ -1692,12 +2072,17 @@
}
],
"name": "forme/invoice-minimal",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Minimal",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Invoice Modern PDF block (forme)",
"files": [
{
@@ -1712,12 +2097,17 @@
}
],
"name": "forme/invoice-modern",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Invoice Modern",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Report Financial PDF block (forme)",
"files": [
{
@@ -1737,12 +2127,17 @@
}
],
"name": "forme/report-financial",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Report Financial",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Report Marketing PDF block (forme)",
"files": [
{
@@ -1762,12 +2157,17 @@
}
],
"name": "forme/report-marketing",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Report Marketing",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Report Operations PDF block (forme)",
"files": [
{
@@ -1787,12 +2187,17 @@
}
],
"name": "forme/report-operations",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Report Operations",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "Report Security PDF block (forme)",
"files": [
{
@@ -1812,12 +2217,17 @@
}
],
"name": "forme/report-security",
- "registryDependencies": ["forme/utils"],
+ "registryDependencies": [
+ "forme/utils"
+ ],
"title": "Report Security",
"type": "registry:block"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "professional theme tokens for forme",
"files": [
{
@@ -1846,7 +2256,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "modern theme tokens for forme",
"files": [
{
@@ -1875,7 +2288,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "minimal theme tokens for forme",
"files": [
{
@@ -1904,7 +2320,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "executive theme tokens for forme",
"files": [
{
@@ -1933,7 +2352,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "corporate theme tokens for forme",
"files": [
{
@@ -1962,7 +2384,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "elegant theme tokens for forme",
"files": [
{
@@ -1991,7 +2416,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "vivid theme tokens for forme",
"files": [
{
@@ -2020,7 +2448,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "forest theme tokens for forme",
"files": [
{
@@ -2049,7 +2480,10 @@
"type": "registry:theme"
},
{
- "dependencies": ["@formepdf/react", "@formepdf/core"],
+ "dependencies": [
+ "@formepdf/react",
+ "@formepdf/core"
+ ],
"description": "blueprint theme tokens for forme",
"files": [
{
@@ -2079,4 +2513,4 @@
}
],
"name": "pdfcn"
-}
+}
\ No newline at end of file
diff --git a/public/r/takumi/alert.json b/public/r/takumi/alert.json
index 09aa19c..0630708 100644
--- a/public/r/takumi/alert.json
+++ b/public/r/takumi/alert.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/alert/alert.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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 Circle,\n Line,\n Path,\n Svg,\n} from \"@/registry/bases/takumi/lib/pdfcn-svg\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/takumi/components/alert/index.ts",
"content": "export { PdfAlert, type PdfAlertProps, type AlertVariant } from \"./alert\";\n",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/badge.json b/public/r/takumi/badge.json
index 9539d81..877d561 100644
--- a/public/r/takumi/badge.json
+++ b/public/r/takumi/badge.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/badge/badge.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/takumi/components/badge/index.ts",
"content": "export {\n Badge,\n type BadgeProps,\n type BadgeVariant,\n type BadgeSize,\n} from \"./badge\";\n",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/card.json b/public/r/takumi/card.json
index b71a813..9dd2722 100644
--- a/public/r/takumi/card.json
+++ b/public/r/takumi/card.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/card/card.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/takumi/components/card/index.ts",
"content": "export { PdfCard, type PdfCardProps, type CardVariant } from \"./card\";\n",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/data-table.json b/public/r/takumi/data-table.json
index e9248a8..4f6dbcf 100644
--- a/public/r/takumi/data-table.json
+++ b/public/r/takumi/data-table.json
@@ -16,25 +16,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "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 {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { Text as PDFText } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-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",
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/takumi/components/data-table/index.ts",
"content": "export { DataTable } from \"./data-table\";\nexport type {\n DataTableProps,\n DataTableColumn,\n DataTableSize,\n} from \"./data-table.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/divider.json b/public/r/takumi/divider.json
index 00b320a..9c48df4 100644
--- a/public/r/takumi/divider.json
+++ b/public/r/takumi/divider.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/divider/divider.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/takumi/components/divider/index.ts",
"content": "export {\n Divider,\n type DividerProps,\n type DividerVariant,\n type DividerThickness,\n type DividerSpacing,\n} from \"./divider\";\n",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/form.json b/public/r/takumi/form.json
index dce3b74..3124d75 100644
--- a/public/r/takumi/form.json
+++ b/public/r/takumi/form.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/takumi/components/form/form.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/takumi/components/form/index.ts",
"content": "export { PdfForm } from \"./form\";\nexport type {\n PdfFormProps,\n PdfFormVariant,\n PdfFormField,\n PdfFormGroup,\n FormLayout,\n FormLabelPosition,\n} from \"./form.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/graph.json b/public/r/takumi/graph.json
index 1b389df..843b2c9 100644
--- a/public/r/takumi/graph.json
+++ b/public/r/takumi/graph.json
@@ -15,31 +15,31 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.tsx",
- "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.types.ts"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/takumi/components/graph/index.ts",
"content": "export { PdfGraph } from \"./graph\";\nexport { A4_WIDTH, GRAPH_SAFE_WIDTHS, getGraphWidth } from \"./graph.utils\";\nexport type {\n GraphDataPoint,\n GraphLegendPosition,\n GraphProps,\n GraphSeries,\n GraphVariant,\n GraphWidthOptions,\n} from \"./graph.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/heading.json b/public/r/takumi/heading.json
index e7205a3..9ba487e 100644
--- a/public/r/takumi/heading.json
+++ b/public/r/takumi/heading.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/heading/heading.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n Text,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/takumi/components/heading/index.ts",
"content": "export {\n Heading,\n type HeadingProps,\n type HeadingWeight,\n type HeadingTracking,\n} from \"./heading\";\n",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/keep-together.json b/public/r/takumi/keep-together.json
index 6110ae7..54b08b2 100644
--- a/public/r/takumi/keep-together.json
+++ b/public/r/takumi/keep-together.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/takumi/components/keep-together/index.ts",
"content": "export { KeepTogether, type KeepTogetherProps } from \"./keep-together\";\n",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/key-value.json b/public/r/takumi/key-value.json
index 2ea526c..430f236 100644
--- a/public/r/takumi/key-value.json
+++ b/public/r/takumi/key-value.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/key-value/key-value.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/takumi/components/key-value/index.ts",
"content": "export {\n KeyValue,\n type KeyValueProps,\n type KeyValueEntry,\n type KeyValueDirection,\n type KeyValueSize,\n} from \"./key-value\";\n",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/link.json b/public/r/takumi/link.json
index 19c0594..9eb9291 100644
--- a/public/r/takumi/link.json
+++ b/public/r/takumi/link.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/link/link.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/takumi/components/link/index.ts",
"content": "export {\n Link,\n type LinkProps,\n type LinkVariant,\n type LinkUnderline,\n} from \"./link\";\n",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/list.json b/public/r/takumi/list.json
index bd6a984..a4ba89f 100644
--- a/public/r/takumi/list.json
+++ b/public/r/takumi/list.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/takumi/components/list/list.tsx",
- "content": "import type React from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/takumi/components/list/index.ts",
"content": "export { PdfList } from \"./list\";\nexport type { PdfListProps, ListVariant, ListItem } from \"./list.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/page-break.json b/public/r/takumi/page-break.json
index ec6614a..6dd28a3 100644
--- a/public/r/takumi/page-break.json
+++ b/public/r/takumi/page-break.json
@@ -15,13 +15,13 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/takumi/components/page-break/index.ts",
"content": "export { PageBreak } from \"./page-break\";\nexport type { PageBreakProps } from \"./page-break\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/page-footer.json b/public/r/takumi/page-footer.json
index 2a36a36..4df345f 100644
--- a/public/r/takumi/page-footer.json
+++ b/public/r/takumi/page-footer.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/page-footer/page-footer.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/takumi/components/page-footer/index.ts",
"content": "export {\n PageFooter,\n type PageFooterProps,\n type PageFooterVariant,\n} from \"./page-footer\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/page-header.json b/public/r/takumi/page-header.json
index d602326..51520bf 100644
--- a/public/r/takumi/page-header.json
+++ b/public/r/takumi/page-header.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/page-header/page-header.tsx",
- "content": "import type { ReactNode } from \"react\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/takumi/components/page-header/index.ts",
"content": "export {\n PageHeader,\n type PageHeaderProps,\n type PageHeaderVariant,\n} from \"./page-header\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/page-number.json b/public/r/takumi/page-number.json
index e9c2501..3a144ae 100644
--- a/public/r/takumi/page-number.json
+++ b/public/r/takumi/page-number.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/page-number/page-number.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/takumi/components/page-number/index.ts",
"content": "export {\n PdfPageNumber,\n type PdfPageNumberProps,\n type PageNumberAlign,\n type PageNumberSize,\n} from \"./page-number\";\n",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/pdf-image.json b/public/r/takumi/pdf-image.json
index e134be9..f2ff36a 100644
--- a/public/r/takumi/pdf-image.json
+++ b/public/r/takumi/pdf-image.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/pdf-image/pdf-image.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport {\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/takumi/components/pdf-image/index.ts",
"content": "export {\n PdfImage,\n type PdfImageProps,\n type PdfImageSrc,\n type PdfImageVariant,\n type PdfImageFit,\n} from \"./pdf-image\";\n",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/qrcode.json b/public/r/takumi/qrcode.json
index 8f254d9..f9f6060 100644
--- a/public/r/takumi/qrcode.json
+++ b/public/r/takumi/qrcode.json
@@ -14,15 +14,15 @@
"files": [
{
"path": "registry/bases/takumi/components/qrcode/qrcode.tsx",
- "content": "import QRCode from \"qrcode\";\n\nimport {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/takumi/components/qrcode/index.ts",
"content": "export {\n PdfQRCode,\n type PdfQRCodeProps,\n type QRCodeErrorLevel,\n} from \"./qrcode\";\n",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/section.json b/public/r/takumi/section.json
index d6bb9f4..0017ede 100644
--- a/public/r/takumi/section.json
+++ b/public/r/takumi/section.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/section/section.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\n View,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/takumi/components/section/index.ts",
"content": "export {\n Section,\n type SectionProps,\n type SectionSpacing,\n type SectionPadding,\n type SectionVariant,\n} from \"./section\";\n",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/signature.json b/public/r/takumi/signature.json
index 900fd6d..a94bcf7 100644
--- a/public/r/takumi/signature.json
+++ b/public/r/takumi/signature.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/signature/signature.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/takumi/components/signature/index.ts",
"content": "export {\n PdfSignatureBlock,\n type PdfSignatureBlockProps,\n type SignatureVariant,\n type SignatureSigner,\n} from \"./signature\";\n",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/stack.json b/public/r/takumi/stack.json
index 3a67614..1be0c32 100644
--- a/public/r/takumi/stack.json
+++ b/public/r/takumi/stack.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/stack/stack.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport {\n View,\n StyleSheet,\n} from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\nimport type { Style } from \"@/registry/bases/takumi/lib/pdfcn-primitives\";\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 { 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",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/takumi/components/stack/index.ts",
"content": "export {\n Stack,\n type StackProps,\n type StackGap,\n type StackDirection,\n type StackAlign,\n type StackJustify,\n} from \"./stack\";\n",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/table.json b/public/r/takumi/table.json
index 49b1331..14776d2 100644
--- a/public/r/takumi/table.json
+++ b/public/r/takumi/table.json
@@ -15,25 +15,25 @@
"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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "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 usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\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\";\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 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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "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",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/takumi/components/table/index.ts",
"content": "export {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableRow,\n TableCell,\n} from \"./table\";\nexport type {\n TableProps,\n TableSectionProps,\n TableRowProps,\n TableCellProps,\n TableVariant,\n} from \"./table.types\";\n",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/text.json b/public/r/takumi/text.json
index 04d4a6e..b0e2fa7 100644
--- a/public/r/takumi/text.json
+++ b/public/r/takumi/text.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/text/text.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\nimport {\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/takumi/components/text/index.ts",
"content": "export {\n Text,\n type TextProps,\n type TextVariant,\n type TextWeight,\n type TextDecoration,\n} from \"./text\";\n",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"type": "registry:ui"
diff --git a/public/r/takumi/utils.json b/public/r/takumi/utils.json
index c12bf1f..60a364f 100644
--- a/public/r/takumi/utils.json
+++ b/public/r/takumi/utils.json
@@ -12,13 +12,31 @@
"path": "registry/bases/takumi/lib/pdfcn-theme.ts",
"content": "import { professionalTheme } from \"@/registry/themes\";\n\nexport const theme = professionalTheme;\n",
"type": "registry:lib",
- "target": "components/pdf/lib/pdfcn-theme.ts"
+ "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",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
+ },
+ {
+ "path": "registry/bases/takumi/lib/theme-provider.tsx",
+ "content": "/* eslint-disable react-refresh/only-export-components */\n// Exports both a component (PdfcnThemeProvider) and theme helpers intentionally.\n// All PDF components import from a single file — splitting would break the public API.\n\nimport { isValidElement } from \"react\";\nimport type { DependencyList, ReactNode } from \"react\";\n\nimport { theme as defaultTheme } from \"./pdfcn-theme\";\n\nexport type PdfcnTheme = typeof defaultTheme;\n\nlet serializedTheme = defaultTheme;\n\nexport interface PdfcnThemeProviderProps {\n theme?: PdfcnTheme;\n children: ReactNode;\n}\n\n/**\n * Takumi converts function components directly instead of mounting a React\n * tree. Resolve the provider's child so the converter receives PDF markup.\n */\nconst renderForSerializer = (\n children: ReactNode,\n theme: PdfcnTheme\n): ReactNode => {\n serializedTheme = theme;\n\n if (!isValidElement(children) || typeof children.type !== \"function\") {\n return children;\n }\n\n return (children.type as (props: unknown) => ReactNode)(children.props);\n};\n\nexport const PdfcnThemeProvider = ({\n theme,\n children,\n}: PdfcnThemeProviderProps) =>\n renderForSerializer(children, theme ?? defaultTheme);\n\n/** Returns the theme selected by the nearest serialized provider. */\nexport const usePdfcnTheme = (): PdfcnTheme => serializedTheme;\n\n/**\n * Calls factory() and returns the result.\n * The deps parameter is accepted for API compatibility with existing callers.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const useSafeMemo = <T,>(factory: () => T, _deps: DependencyList): T =>\n factory();\n",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/takumi/lib/pdfcn-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 <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"
+ },
+ {
+ "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 { normalizeTakumiStyle, pointToCssPixel } from \"./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",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-svg.tsx"
}
],
"type": "registry:lib"
diff --git a/public/r/takumi/watermark.json b/public/r/takumi/watermark.json
index cbc64d0..bf60372 100644
--- a/public/r/takumi/watermark.json
+++ b/public/r/takumi/watermark.json
@@ -13,15 +13,15 @@
"files": [
{
"path": "registry/bases/takumi/components/watermark/watermark.tsx",
- "content": "import {\n usePdfcnTheme,\n useSafeMemo,\n} from \"@/registry/bases/takumi/lib/theme-provider\";\nimport { resolveColor } from \"@/registry/bases/takumi/lib/resolve-color\";\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 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 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",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/takumi/components/watermark/index.ts",
"content": "export {\n PdfWatermark,\n type PdfWatermarkProps,\n type WatermarkPosition,\n} from \"./watermark\";\n",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"type": "registry:ui"
diff --git a/registry.json b/registry.json
index e18ee81..9fd5a11 100644
--- a/registry.json
+++ b/registry.json
@@ -9,12 +9,27 @@
{
"path": "registry/bases/takumi/lib/pdfcn-theme.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/pdfcn-theme.ts"
+ "target": "lib/pdfcn-theme.ts"
},
{
"path": "registry/bases/takumi/lib/resolve-color.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
+ },
+ {
+ "path": "registry/bases/takumi/lib/theme-provider.tsx",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/takumi/lib/pdfcn-primitives.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-primitives.tsx"
+ },
+ {
+ "path": "registry/bases/takumi/lib/pdfcn-svg.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-svg.tsx"
}
],
"name": "takumi/utils",
@@ -28,12 +43,12 @@
{
"path": "registry/bases/takumi/components/alert/alert.tsx",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/takumi/components/alert/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"name": "takumi/alert",
@@ -48,12 +63,12 @@
{
"path": "registry/bases/takumi/components/badge/badge.tsx",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/takumi/components/badge/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"name": "takumi/badge",
@@ -68,12 +83,12 @@
{
"path": "registry/bases/takumi/components/card/card.tsx",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/takumi/components/card/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"name": "takumi/card",
@@ -88,22 +103,22 @@
{
"path": "registry/bases/takumi/components/data-table/data-table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/takumi/components/data-table/data-table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/takumi/components/data-table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"name": "takumi/data-table",
@@ -118,12 +133,12 @@
{
"path": "registry/bases/takumi/components/divider/divider.tsx",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/takumi/components/divider/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"name": "takumi/divider",
@@ -138,22 +153,22 @@
{
"path": "registry/bases/takumi/components/form/form.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/takumi/components/form/form.tsx",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/takumi/components/form/form.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/takumi/components/form/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"name": "takumi/form",
@@ -168,27 +183,27 @@
{
"path": "registry/bases/takumi/components/graph/graph.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.tsx",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/takumi/components/graph/graph.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.types.ts"
+ "target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/takumi/components/graph/graph.utils.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/takumi/components/graph/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"name": "takumi/graph",
@@ -203,12 +218,12 @@
{
"path": "registry/bases/takumi/components/heading/heading.tsx",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/takumi/components/heading/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"name": "takumi/heading",
@@ -223,12 +238,12 @@
{
"path": "registry/bases/takumi/components/keep-together/keep-together.tsx",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/takumi/components/keep-together/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"name": "takumi/keep-together",
@@ -243,12 +258,12 @@
{
"path": "registry/bases/takumi/components/key-value/key-value.tsx",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/takumi/components/key-value/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"name": "takumi/key-value",
@@ -263,12 +278,12 @@
{
"path": "registry/bases/takumi/components/link/link.tsx",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/takumi/components/link/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"name": "takumi/link",
@@ -283,22 +298,22 @@
{
"path": "registry/bases/takumi/components/list/list.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/takumi/components/list/list.tsx",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/takumi/components/list/list.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/takumi/components/list/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"name": "takumi/list",
@@ -313,12 +328,12 @@
{
"path": "registry/bases/takumi/components/page-break/page-break.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/takumi/components/page-break/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"name": "takumi/page-break",
@@ -333,12 +348,12 @@
{
"path": "registry/bases/takumi/components/page-footer/page-footer.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/takumi/components/page-footer/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"name": "takumi/page-footer",
@@ -353,12 +368,12 @@
{
"path": "registry/bases/takumi/components/page-header/page-header.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/takumi/components/page-header/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"name": "takumi/page-header",
@@ -373,12 +388,12 @@
{
"path": "registry/bases/takumi/components/page-number/page-number.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/takumi/components/page-number/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"name": "takumi/page-number",
@@ -393,12 +408,12 @@
{
"path": "registry/bases/takumi/components/pdf-image/pdf-image.tsx",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/takumi/components/pdf-image/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"name": "takumi/pdf-image",
@@ -413,12 +428,12 @@
{
"path": "registry/bases/takumi/components/qrcode/qrcode.tsx",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/takumi/components/qrcode/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"name": "takumi/qrcode",
@@ -433,12 +448,12 @@
{
"path": "registry/bases/takumi/components/section/section.tsx",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/takumi/components/section/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"name": "takumi/section",
@@ -453,12 +468,12 @@
{
"path": "registry/bases/takumi/components/signature/signature.tsx",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/takumi/components/signature/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"name": "takumi/signature",
@@ -473,12 +488,12 @@
{
"path": "registry/bases/takumi/components/stack/stack.tsx",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/takumi/components/stack/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"name": "takumi/stack",
@@ -493,22 +508,22 @@
{
"path": "registry/bases/takumi/components/table/table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/takumi/components/table/table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/takumi/components/table/table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/takumi/components/table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"name": "takumi/table",
@@ -523,12 +538,12 @@
{
"path": "registry/bases/takumi/components/text/text.tsx",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/takumi/components/text/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"name": "takumi/text",
@@ -543,12 +558,12 @@
{
"path": "registry/bases/takumi/components/watermark/watermark.tsx",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/takumi/components/watermark/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"name": "takumi/watermark",
@@ -1044,17 +1059,32 @@
{
"path": "registry/bases/forme/lib/pdfcn-theme.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/pdfcn-theme.ts"
+ "target": "lib/pdfcn-theme.ts"
},
{
"path": "registry/bases/forme/lib/resolve-color.ts",
"type": "registry:lib",
- "target": "components/pdf/lib/resolve-color.ts"
+ "target": "lib/resolve-color.ts"
},
{
"path": "registry/bases/forme/lib/maybe-fixed.tsx",
"type": "registry:lib",
- "target": "components/pdf/lib/maybe-fixed.tsx"
+ "target": "lib/maybe-fixed.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/theme-provider.tsx",
+ "type": "registry:lib",
+ "target": "components/pdf/theme-provider.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-primitives.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-primitives.tsx"
+ },
+ {
+ "path": "registry/bases/forme/lib/pdfcn-svg.tsx",
+ "type": "registry:lib",
+ "target": "lib/pdfcn-svg.tsx"
}
],
"name": "forme/utils",
@@ -1068,12 +1098,12 @@
{
"path": "registry/bases/forme/components/alert/alert.tsx",
"type": "registry:component",
- "target": "components/pdf/components/alert/alert.tsx"
+ "target": "components/pdf/alert/alert.tsx"
},
{
"path": "registry/bases/forme/components/alert/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/alert/index.ts"
+ "target": "components/pdf/alert/index.ts"
}
],
"name": "forme/alert",
@@ -1088,12 +1118,12 @@
{
"path": "registry/bases/forme/components/badge/badge.tsx",
"type": "registry:component",
- "target": "components/pdf/components/badge/badge.tsx"
+ "target": "components/pdf/badge/badge.tsx"
},
{
"path": "registry/bases/forme/components/badge/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/badge/index.ts"
+ "target": "components/pdf/badge/index.ts"
}
],
"name": "forme/badge",
@@ -1108,12 +1138,12 @@
{
"path": "registry/bases/forme/components/card/card.tsx",
"type": "registry:component",
- "target": "components/pdf/components/card/card.tsx"
+ "target": "components/pdf/card/card.tsx"
},
{
"path": "registry/bases/forme/components/card/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/card/index.ts"
+ "target": "components/pdf/card/index.ts"
}
],
"name": "forme/card",
@@ -1128,22 +1158,22 @@
{
"path": "registry/bases/forme/components/data-table/data-table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.styles.ts"
+ "target": "components/pdf/data-table/data-table.styles.ts"
},
{
"path": "registry/bases/forme/components/data-table/data-table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.tsx"
+ "target": "components/pdf/data-table/data-table.tsx"
},
{
"path": "registry/bases/forme/components/data-table/data-table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/data-table.types.ts"
+ "target": "components/pdf/data-table/data-table.types.ts"
},
{
"path": "registry/bases/forme/components/data-table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/data-table/index.ts"
+ "target": "components/pdf/data-table/index.ts"
}
],
"name": "forme/data-table",
@@ -1158,12 +1188,12 @@
{
"path": "registry/bases/forme/components/divider/divider.tsx",
"type": "registry:component",
- "target": "components/pdf/components/divider/divider.tsx"
+ "target": "components/pdf/divider/divider.tsx"
},
{
"path": "registry/bases/forme/components/divider/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/divider/index.ts"
+ "target": "components/pdf/divider/index.ts"
}
],
"name": "forme/divider",
@@ -1178,22 +1208,22 @@
{
"path": "registry/bases/forme/components/form/form.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.styles.ts"
+ "target": "components/pdf/form/form.styles.ts"
},
{
"path": "registry/bases/forme/components/form/form.tsx",
"type": "registry:component",
- "target": "components/pdf/components/form/form.tsx"
+ "target": "components/pdf/form/form.tsx"
},
{
"path": "registry/bases/forme/components/form/form.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/form.types.ts"
+ "target": "components/pdf/form/form.types.ts"
},
{
"path": "registry/bases/forme/components/form/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/form/index.ts"
+ "target": "components/pdf/form/index.ts"
}
],
"name": "forme/form",
@@ -1208,27 +1238,27 @@
{
"path": "registry/bases/forme/components/graph/graph.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.styles.ts"
+ "target": "components/pdf/graph/graph.styles.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.tsx",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.tsx"
+ "target": "components/pdf/graph/graph.tsx"
},
{
"path": "registry/bases/forme/components/graph/graph.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.types.ts"
+ "target": "components/pdf/graph/graph.types.ts"
},
{
"path": "registry/bases/forme/components/graph/graph.utils.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/graph.utils.ts"
+ "target": "components/pdf/graph/graph.utils.ts"
},
{
"path": "registry/bases/forme/components/graph/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/graph/index.ts"
+ "target": "components/pdf/graph/index.ts"
}
],
"name": "forme/graph",
@@ -1243,12 +1273,12 @@
{
"path": "registry/bases/forme/components/heading/heading.tsx",
"type": "registry:component",
- "target": "components/pdf/components/heading/heading.tsx"
+ "target": "components/pdf/heading/heading.tsx"
},
{
"path": "registry/bases/forme/components/heading/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/heading/index.ts"
+ "target": "components/pdf/heading/index.ts"
}
],
"name": "forme/heading",
@@ -1263,12 +1293,12 @@
{
"path": "registry/bases/forme/components/keep-together/keep-together.tsx",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/keep-together.tsx"
+ "target": "components/pdf/keep-together/keep-together.tsx"
},
{
"path": "registry/bases/forme/components/keep-together/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/keep-together/index.ts"
+ "target": "components/pdf/keep-together/index.ts"
}
],
"name": "forme/keep-together",
@@ -1283,12 +1313,12 @@
{
"path": "registry/bases/forme/components/key-value/key-value.tsx",
"type": "registry:component",
- "target": "components/pdf/components/key-value/key-value.tsx"
+ "target": "components/pdf/key-value/key-value.tsx"
},
{
"path": "registry/bases/forme/components/key-value/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/key-value/index.ts"
+ "target": "components/pdf/key-value/index.ts"
}
],
"name": "forme/key-value",
@@ -1303,12 +1333,12 @@
{
"path": "registry/bases/forme/components/link/link.tsx",
"type": "registry:component",
- "target": "components/pdf/components/link/link.tsx"
+ "target": "components/pdf/link/link.tsx"
},
{
"path": "registry/bases/forme/components/link/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/link/index.ts"
+ "target": "components/pdf/link/index.ts"
}
],
"name": "forme/link",
@@ -1323,22 +1353,22 @@
{
"path": "registry/bases/forme/components/list/list.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.styles.ts"
+ "target": "components/pdf/list/list.styles.ts"
},
{
"path": "registry/bases/forme/components/list/list.tsx",
"type": "registry:component",
- "target": "components/pdf/components/list/list.tsx"
+ "target": "components/pdf/list/list.tsx"
},
{
"path": "registry/bases/forme/components/list/list.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/list.types.ts"
+ "target": "components/pdf/list/list.types.ts"
},
{
"path": "registry/bases/forme/components/list/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/list/index.ts"
+ "target": "components/pdf/list/index.ts"
}
],
"name": "forme/list",
@@ -1353,12 +1383,12 @@
{
"path": "registry/bases/forme/components/page-break/page-break.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-break/page-break.tsx"
+ "target": "components/pdf/page-break/page-break.tsx"
},
{
"path": "registry/bases/forme/components/page-break/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-break/index.ts"
+ "target": "components/pdf/page-break/index.ts"
}
],
"name": "forme/page-break",
@@ -1373,12 +1403,12 @@
{
"path": "registry/bases/forme/components/page-footer/page-footer.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/page-footer.tsx"
+ "target": "components/pdf/page-footer/page-footer.tsx"
},
{
"path": "registry/bases/forme/components/page-footer/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-footer/index.ts"
+ "target": "components/pdf/page-footer/index.ts"
}
],
"name": "forme/page-footer",
@@ -1393,12 +1423,12 @@
{
"path": "registry/bases/forme/components/page-header/page-header.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-header/page-header.tsx"
+ "target": "components/pdf/page-header/page-header.tsx"
},
{
"path": "registry/bases/forme/components/page-header/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-header/index.ts"
+ "target": "components/pdf/page-header/index.ts"
}
],
"name": "forme/page-header",
@@ -1413,12 +1443,12 @@
{
"path": "registry/bases/forme/components/page-number/page-number.tsx",
"type": "registry:component",
- "target": "components/pdf/components/page-number/page-number.tsx"
+ "target": "components/pdf/page-number/page-number.tsx"
},
{
"path": "registry/bases/forme/components/page-number/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/page-number/index.ts"
+ "target": "components/pdf/page-number/index.ts"
}
],
"name": "forme/page-number",
@@ -1433,12 +1463,12 @@
{
"path": "registry/bases/forme/components/pdf-image/pdf-image.tsx",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/pdf-image.tsx"
+ "target": "components/pdf/pdf-image/pdf-image.tsx"
},
{
"path": "registry/bases/forme/components/pdf-image/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/pdf-image/index.ts"
+ "target": "components/pdf/pdf-image/index.ts"
}
],
"name": "forme/pdf-image",
@@ -1453,12 +1483,12 @@
{
"path": "registry/bases/forme/components/qrcode/qrcode.tsx",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/qrcode.tsx"
+ "target": "components/pdf/qrcode/qrcode.tsx"
},
{
"path": "registry/bases/forme/components/qrcode/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/qrcode/index.ts"
+ "target": "components/pdf/qrcode/index.ts"
}
],
"name": "forme/qrcode",
@@ -1473,12 +1503,12 @@
{
"path": "registry/bases/forme/components/section/section.tsx",
"type": "registry:component",
- "target": "components/pdf/components/section/section.tsx"
+ "target": "components/pdf/section/section.tsx"
},
{
"path": "registry/bases/forme/components/section/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/section/index.ts"
+ "target": "components/pdf/section/index.ts"
}
],
"name": "forme/section",
@@ -1493,12 +1523,12 @@
{
"path": "registry/bases/forme/components/signature/signature.tsx",
"type": "registry:component",
- "target": "components/pdf/components/signature/signature.tsx"
+ "target": "components/pdf/signature/signature.tsx"
},
{
"path": "registry/bases/forme/components/signature/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/signature/index.ts"
+ "target": "components/pdf/signature/index.ts"
}
],
"name": "forme/signature",
@@ -1513,12 +1543,12 @@
{
"path": "registry/bases/forme/components/stack/stack.tsx",
"type": "registry:component",
- "target": "components/pdf/components/stack/stack.tsx"
+ "target": "components/pdf/stack/stack.tsx"
},
{
"path": "registry/bases/forme/components/stack/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/stack/index.ts"
+ "target": "components/pdf/stack/index.ts"
}
],
"name": "forme/stack",
@@ -1533,22 +1563,22 @@
{
"path": "registry/bases/forme/components/table/table.styles.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.styles.ts"
+ "target": "components/pdf/table/table.styles.ts"
},
{
"path": "registry/bases/forme/components/table/table.tsx",
"type": "registry:component",
- "target": "components/pdf/components/table/table.tsx"
+ "target": "components/pdf/table/table.tsx"
},
{
"path": "registry/bases/forme/components/table/table.types.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/table.types.ts"
+ "target": "components/pdf/table/table.types.ts"
},
{
"path": "registry/bases/forme/components/table/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/table/index.ts"
+ "target": "components/pdf/table/index.ts"
}
],
"name": "forme/table",
@@ -1563,12 +1593,12 @@
{
"path": "registry/bases/forme/components/text/text.tsx",
"type": "registry:component",
- "target": "components/pdf/components/text/text.tsx"
+ "target": "components/pdf/text/text.tsx"
},
{
"path": "registry/bases/forme/components/text/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/text/index.ts"
+ "target": "components/pdf/text/index.ts"
}
],
"name": "forme/text",
@@ -1583,12 +1613,12 @@
{
"path": "registry/bases/forme/components/watermark/watermark.tsx",
"type": "registry:component",
- "target": "components/pdf/components/watermark/watermark.tsx"
+ "target": "components/pdf/watermark/watermark.tsx"
},
{
"path": "registry/bases/forme/components/watermark/index.ts",
"type": "registry:component",
- "target": "components/pdf/components/watermark/index.ts"
+ "target": "components/pdf/watermark/index.ts"
}
],
"name": "forme/watermark",