tt-pdf-generator 1.4.0 → 1.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tt-pdf-generator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "TT pdf generator - A powerful React-based PDF generation library for creating documents",
|
|
5
5
|
"main": "dist/pdf-generator.browser.js",
|
|
6
6
|
"module": "dist/pdf-generator.esm.js",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"@radix-ui/react-slot": "^1.2.3",
|
|
96
96
|
"@radix-ui/react-switch": "^1.2.6",
|
|
97
97
|
"@radix-ui/react-tabs": "^1.1.12",
|
|
98
|
-
"@react-pdf/renderer": "
|
|
98
|
+
"@react-pdf/renderer": ">=4.0.0",
|
|
99
99
|
"@supabase/auth-ui-react": "^0.4.7",
|
|
100
100
|
"@supabase/auth-ui-shared": "^0.1.8",
|
|
101
101
|
"@supabase/supabase-js": "^2.54.0",
|
|
@@ -106,8 +106,9 @@
|
|
|
106
106
|
"crypto": "^1.0.1",
|
|
107
107
|
"lucide-react": "^0.525.0",
|
|
108
108
|
"qrcode": "^1.5.4",
|
|
109
|
-
"react-dom": "
|
|
109
|
+
"react-dom": ">=18.0.0",
|
|
110
110
|
"react-markdown": "^10.1.0",
|
|
111
|
+
"react-pdf-html": "^2.1.4",
|
|
111
112
|
"remark": "^15.0.1",
|
|
112
113
|
"remark-parse": "^11.0.0",
|
|
113
114
|
"tailwind-merge": "^3.3.1",
|
package/dist/pdf-generator.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
|
|
3
|
-
// Font configuration types
|
|
4
|
-
export interface FontConfig {
|
|
5
|
-
family: string;
|
|
6
|
-
fonts: {
|
|
7
|
-
src: string;
|
|
8
|
-
fontWeight?: number;
|
|
9
|
-
fontStyle?: string;
|
|
10
|
-
}[];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Component data structure
|
|
14
|
-
export interface ComponentData {
|
|
15
|
-
type: string;
|
|
16
|
-
visible?: string;
|
|
17
|
-
props?: Record<string, any>;
|
|
18
|
-
children?: ComponentData[] | ComponentData | string | number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// Template structure
|
|
22
|
-
export interface Template {
|
|
23
|
-
fonts?: FontConfig[];
|
|
24
|
-
components: ComponentData[];
|
|
25
|
-
images?: Record<string, any>;
|
|
26
|
-
[key: string]: any;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Data structure (can be any valid JSON)
|
|
30
|
-
export type TemplateData = Record<string, any>;
|
|
31
|
-
|
|
32
|
-
// PDF Generator props
|
|
33
|
-
export interface PdfGeneratorProps {
|
|
34
|
-
data: string;
|
|
35
|
-
template: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Component map for rendering
|
|
39
|
-
export interface ComponentMap {
|
|
40
|
-
[key: string]: React.ComponentType<any>;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Render function arguments
|
|
44
|
-
export interface RenderPdfComponentArgs {
|
|
45
|
-
componentData: ComponentData | ComponentData[] | string | number;
|
|
46
|
-
components: ComponentMap;
|
|
47
|
-
data: TemplateData;
|
|
48
|
-
allProps: Record<string, any>;
|
|
49
|
-
images: Record<string, any>;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// PDF generation result
|
|
53
|
-
export type PdfResult = Blob;
|
|
54
|
-
|
|
55
|
-
// Error types
|
|
56
|
-
export interface PdfGenerationError extends Error {
|
|
57
|
-
originalError?: Error;
|
|
58
|
-
template?: string;
|
|
59
|
-
data?: string;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Function signatures
|
|
63
|
-
export type GeneratePdfFunction = (
|
|
64
|
-
template: string,
|
|
65
|
-
data: string,
|
|
66
|
-
) => Promise<PdfResult>;
|
|
67
|
-
|
|
68
|
-
export type ParseJsonFunction = (
|
|
69
|
-
jsonString: string,
|
|
70
|
-
) => Template | TemplateData | null;
|
|
71
|
-
|
|
72
|
-
export type RenderPdfComponentFunction = (
|
|
73
|
-
args: RenderPdfComponentArgs,
|
|
74
|
-
) => ReactElement | ReactElement[] | null;
|
|
75
|
-
|
|
76
|
-
// React PDF specific types
|
|
77
|
-
export type PdfDocumentElement = ReactElement<any>;
|
|
78
|
-
export type PdfComponentElement = ReactElement<any>;
|
|
79
|
-
|
|
80
|
-
// Main export
|
|
81
|
-
export declare const generatePdf: GeneratePdfFunction;
|
|
82
|
-
|
|
83
|
-
// Export all types
|
|
84
|
-
export type {
|
|
85
|
-
FontConfig,
|
|
86
|
-
ComponentData,
|
|
87
|
-
Template,
|
|
88
|
-
TemplateData,
|
|
89
|
-
PdfGeneratorProps,
|
|
90
|
-
ComponentMap,
|
|
91
|
-
RenderPdfComponentArgs,
|
|
92
|
-
PdfResult,
|
|
93
|
-
PdfGenerationError,
|
|
94
|
-
GeneratePdfFunction,
|
|
95
|
-
ParseJsonFunction,
|
|
96
|
-
RenderPdfComponentFunction,
|
|
97
|
-
PdfDocumentElement,
|
|
98
|
-
PdfComponentElement,
|
|
99
|
-
};
|