pdfn 0.8.11 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +1 -1
- package/package.json +6 -6
- package/templates/inline/contract.tsx +59 -48
- package/templates/inline/invoice.tsx +43 -30
- package/templates/inline/letter.tsx +44 -32
- package/templates/inline/poster.tsx +30 -17
- package/templates/inline/report.tsx +53 -40
- package/templates/inline/ticket.tsx +39 -23
- package/templates/tailwind/contract.tsx +59 -48
- package/templates/tailwind/invoice.tsx +43 -30
- package/templates/tailwind/letter.tsx +46 -32
- package/templates/tailwind/poster.tsx +30 -17
- package/templates/tailwind/report.tsx +53 -40
- package/templates/tailwind/ticket.tsx +39 -23
package/dist/cli.js
CHANGED
|
@@ -489,7 +489,9 @@ async function scanTemplates(templatesDir) {
|
|
|
489
489
|
const filePath = join(templatesDir, file);
|
|
490
490
|
try {
|
|
491
491
|
const content = readFileSync(filePath, "utf-8");
|
|
492
|
-
|
|
492
|
+
const hasDefaultExport = content.includes("export default");
|
|
493
|
+
const hasComponent = content.includes("function") || /const\s+\w+\s*=\s*\(/.test(content);
|
|
494
|
+
if (!hasDefaultExport || !hasComponent) {
|
|
493
495
|
continue;
|
|
494
496
|
}
|
|
495
497
|
if (!content.includes("Document") && !content.includes("Page")) {
|
|
@@ -2373,8 +2375,9 @@ async function startDevServer(options) {
|
|
|
2373
2375
|
const Component = mod.default;
|
|
2374
2376
|
const { pdfn: pdfn2 } = await vite.ssrLoadModule("@pdfn/react");
|
|
2375
2377
|
const client = pdfn2();
|
|
2378
|
+
const previewProps = Component.PreviewProps || {};
|
|
2376
2379
|
const { data, error } = await client.render({
|
|
2377
|
-
react: React.createElement(Component,
|
|
2380
|
+
react: React.createElement(Component, previewProps),
|
|
2378
2381
|
debug: debugOptions || void 0
|
|
2379
2382
|
});
|
|
2380
2383
|
if (error) {
|