tt-pdf-generator 1.4.1 → 1.5.1

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.
@@ -1,99 +1,2 @@
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
1
+ import { GeneratePdfFunction } from './types';
81
2
  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
- };