@tachybase/module-pdf 0.23.8

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.
Files changed (135) hide show
  1. package/.turbo/turbo-build.log +15 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/PdfInstruction.d.ts +107 -0
  6. package/dist/client/index.d.ts +10 -0
  7. package/dist/client/index.js +239 -0
  8. package/dist/externalVersion.js +11 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +39 -0
  11. package/dist/node_modules/@babel/core/LICENSE +22 -0
  12. package/dist/node_modules/@babel/core/cjs-proxy.cjs +68 -0
  13. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +3 -0
  14. package/dist/node_modules/@babel/core/lib/config/caching.js +261 -0
  15. package/dist/node_modules/@babel/core/lib/config/config-chain.js +469 -0
  16. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +190 -0
  17. package/dist/node_modules/@babel/core/lib/config/files/configuration.js +287 -0
  18. package/dist/node_modules/@babel/core/lib/config/files/import.cjs +6 -0
  19. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +58 -0
  20. package/dist/node_modules/@babel/core/lib/config/files/index.js +78 -0
  21. package/dist/node_modules/@babel/core/lib/config/files/module-types.js +195 -0
  22. package/dist/node_modules/@babel/core/lib/config/files/package.js +61 -0
  23. package/dist/node_modules/@babel/core/lib/config/files/plugins.js +229 -0
  24. package/dist/node_modules/@babel/core/lib/config/files/types.js +3 -0
  25. package/dist/node_modules/@babel/core/lib/config/files/utils.js +36 -0
  26. package/dist/node_modules/@babel/core/lib/config/full.js +312 -0
  27. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +84 -0
  28. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +23 -0
  29. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +12 -0
  30. package/dist/node_modules/@babel/core/lib/config/index.js +93 -0
  31. package/dist/node_modules/@babel/core/lib/config/item.js +67 -0
  32. package/dist/node_modules/@babel/core/lib/config/partial.js +158 -0
  33. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +38 -0
  34. package/dist/node_modules/@babel/core/lib/config/plugin.js +33 -0
  35. package/dist/node_modules/@babel/core/lib/config/printer.js +113 -0
  36. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +41 -0
  37. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +61 -0
  38. package/dist/node_modules/@babel/core/lib/config/util.js +31 -0
  39. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +277 -0
  40. package/dist/node_modules/@babel/core/lib/config/validation/options.js +189 -0
  41. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +67 -0
  42. package/dist/node_modules/@babel/core/lib/config/validation/removed.js +68 -0
  43. package/dist/node_modules/@babel/core/lib/errors/config-error.js +18 -0
  44. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +98 -0
  45. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +90 -0
  46. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +31 -0
  47. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +58 -0
  48. package/dist/node_modules/@babel/core/lib/index.js +227 -0
  49. package/dist/node_modules/@babel/core/lib/parse.js +47 -0
  50. package/dist/node_modules/@babel/core/lib/parser/index.js +79 -0
  51. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +339 -0
  52. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +144 -0
  53. package/dist/node_modules/@babel/core/lib/transform-ast.js +50 -0
  54. package/dist/node_modules/@babel/core/lib/transform-file-browser.js +23 -0
  55. package/dist/node_modules/@babel/core/lib/transform-file.js +40 -0
  56. package/dist/node_modules/@babel/core/lib/transform.js +49 -0
  57. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +84 -0
  58. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +4 -0
  59. package/dist/node_modules/@babel/core/lib/transformation/file/file.js +214 -0
  60. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +84 -0
  61. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +37 -0
  62. package/dist/node_modules/@babel/core/lib/transformation/index.js +92 -0
  63. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +129 -0
  64. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +59 -0
  65. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +50 -0
  66. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +36 -0
  67. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +1043 -0
  68. package/dist/node_modules/@babel/core/node_modules/.bin/json5 +17 -0
  69. package/dist/node_modules/@babel/core/node_modules/.bin/parser +17 -0
  70. package/dist/node_modules/@babel/core/node_modules/.bin/semver +17 -0
  71. package/dist/node_modules/@babel/core/package.json +1 -0
  72. package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +113 -0
  73. package/dist/node_modules/@babel/core/src/config/files/index.ts +29 -0
  74. package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +40 -0
  75. package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +56 -0
  76. package/dist/node_modules/@babel/core/src/transform-file-browser.ts +31 -0
  77. package/dist/node_modules/@babel/core/src/transform-file.ts +55 -0
  78. package/dist/node_modules/@react-pdf/renderer/index.d.ts +590 -0
  79. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.cjs +4558 -0
  80. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.d.cts +590 -0
  81. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.d.ts +590 -0
  82. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +4505 -0
  83. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.cjs +10 -0
  84. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.d.cts +590 -0
  85. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.d.ts +590 -0
  86. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.js +10 -0
  87. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.cjs +40 -0
  88. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.d.cts +590 -0
  89. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.d.ts +590 -0
  90. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.js +4393 -0
  91. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.cjs +10 -0
  92. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.d.cts +590 -0
  93. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.d.ts +590 -0
  94. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.js +10 -0
  95. package/dist/node_modules/@react-pdf/renderer/package.json +1 -0
  96. package/dist/node_modules/fs-extra/LICENSE +15 -0
  97. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  98. package/dist/node_modules/fs-extra/lib/copy/copy.js +177 -0
  99. package/dist/node_modules/fs-extra/lib/copy/index.js +7 -0
  100. package/dist/node_modules/fs-extra/lib/empty/index.js +39 -0
  101. package/dist/node_modules/fs-extra/lib/ensure/file.js +66 -0
  102. package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
  103. package/dist/node_modules/fs-extra/lib/ensure/link.js +64 -0
  104. package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
  105. package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
  106. package/dist/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
  107. package/dist/node_modules/fs-extra/lib/fs/index.js +140 -0
  108. package/dist/node_modules/fs-extra/lib/index.js +1 -0
  109. package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
  110. package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  111. package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  112. package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
  113. package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  114. package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  115. package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  116. package/dist/node_modules/fs-extra/lib/move/index.js +7 -0
  117. package/dist/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  118. package/dist/node_modules/fs-extra/lib/move/move.js +59 -0
  119. package/dist/node_modules/fs-extra/lib/output-file/index.js +31 -0
  120. package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  121. package/dist/node_modules/fs-extra/lib/remove/index.js +17 -0
  122. package/dist/node_modules/fs-extra/lib/util/stat.js +158 -0
  123. package/dist/node_modules/fs-extra/lib/util/utimes.js +36 -0
  124. package/dist/node_modules/fs-extra/package.json +1 -0
  125. package/dist/server/PdfInstruction.d.ts +10 -0
  126. package/dist/server/PdfInstruction.js +108 -0
  127. package/dist/server/index.d.ts +2 -0
  128. package/dist/server/index.js +53 -0
  129. package/dist/server/plugin.d.ts +11 -0
  130. package/dist/server/plugin.js +102 -0
  131. package/dist/server/services/font-manager.d.ts +6 -0
  132. package/dist/server/services/font-manager.js +199 -0
  133. package/package.json +32 -0
  134. package/server.d.ts +2 -0
  135. package/server.js +1 -0
@@ -0,0 +1,590 @@
1
+ /* eslint-disable react/prefer-stateless-function */
2
+ /* eslint-disable no-unused-vars */
3
+ /* eslint-disable max-classes-per-file */
4
+ import * as React from 'react';
5
+ import {
6
+ Style,
7
+ PageSize,
8
+ FontStore,
9
+ PDFVersion,
10
+ Orientation,
11
+ SourceObject,
12
+ HyphenationCallback,
13
+ SVGPresentationAttributes,
14
+ Bookmark,
15
+ PageLayout,
16
+ PageMode,
17
+ } from '@react-pdf/types';
18
+
19
+ declare class ReactPDF {
20
+ // eslint-disable-next-line no-use-before-define
21
+ static default: typeof ReactPDF;
22
+ }
23
+
24
+ export = ReactPDF;
25
+
26
+ // eslint-disable-next-line no-redeclare
27
+ declare namespace ReactPDF {
28
+ interface Styles {
29
+ [key: string]: Style;
30
+ }
31
+ interface OnRenderProps {
32
+ blob?: Blob;
33
+ }
34
+
35
+ interface DocumentProps {
36
+ style?: Style | Style[];
37
+ title?: string;
38
+ author?: string;
39
+ subject?: string;
40
+ creator?: string;
41
+ keywords?: string;
42
+ producer?: string;
43
+ language?: string;
44
+ creationDate?: Date;
45
+ modificationDate?: Date;
46
+ pdfVersion?: PDFVersion;
47
+ pageMode?: PageMode;
48
+ pageLayout?: PageLayout;
49
+ onRender?: (props: OnRenderProps) => any;
50
+ }
51
+
52
+ /**
53
+ * This component represent the PDF document itself. It must be the root
54
+ * of your tree element structure, and under no circumstances should it be
55
+ * used as children of another react-pdf component. In addition, it should
56
+ * only have childs of type <Page />.
57
+ */
58
+ export class Document extends React.Component<
59
+ React.PropsWithChildren<DocumentProps>
60
+ > {}
61
+
62
+ interface NodeProps {
63
+ id?: string;
64
+ style?: Style | Style[];
65
+ /**
66
+ * Render component in all wrapped pages.
67
+ * @see https://react-pdf.org/advanced#fixed-components
68
+ */
69
+ fixed?: boolean;
70
+ /**
71
+ * Force the wrapping algorithm to start a new page when rendering the
72
+ * element.
73
+ * @see https://react-pdf.org/advanced#page-breaks
74
+ */
75
+ break?: boolean;
76
+ /**
77
+ * Hint that no page wrapping should occur between all sibling elements following the element within n points
78
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
79
+ */
80
+ minPresenceAhead?: number;
81
+ }
82
+
83
+ interface PageProps extends NodeProps {
84
+ /**
85
+ * Enable page wrapping for this page.
86
+ * @see https://react-pdf.org/components#page-wrapping
87
+ */
88
+ wrap?: boolean;
89
+ /**
90
+ * Enables debug mode on page bounding box.
91
+ * @see https://react-pdf.org/advanced#debugging
92
+ */
93
+ debug?: boolean;
94
+ size?: PageSize;
95
+ orientation?: Orientation;
96
+ dpi?: number;
97
+ bookmark?: Bookmark;
98
+ }
99
+
100
+ /**
101
+ * Represents single page inside the PDF document, or a subset of them if
102
+ * using the wrapping feature. A <Document /> can contain as many pages as
103
+ * you want, but ensure not rendering a page inside any component besides
104
+ * Document.
105
+ */
106
+ export class Page extends React.Component<
107
+ React.PropsWithChildren<PageProps>
108
+ > {}
109
+
110
+ interface ViewProps extends NodeProps {
111
+ id?: string;
112
+ /**
113
+ * Enable/disable page wrapping for element.
114
+ * @see https://react-pdf.org/components#page-wrapping
115
+ */
116
+ wrap?: boolean;
117
+ /**
118
+ * Enables debug mode on page bounding box.
119
+ * @see https://react-pdf.org/advanced#debugging
120
+ */
121
+ debug?: boolean;
122
+ render?: (props: {
123
+ pageNumber: number;
124
+ subPageNumber: number;
125
+ }) => React.ReactNode;
126
+ }
127
+
128
+ /**
129
+ * The most fundamental component for building a UI and is designed to be
130
+ * nested inside other views and can have 0 to many children.
131
+ */
132
+ export class View extends React.Component<
133
+ React.PropsWithChildren<ViewProps>
134
+ > {}
135
+
136
+ interface BaseImageProps extends NodeProps {
137
+ /**
138
+ * Enables debug mode on page bounding box.
139
+ * @see https://react-pdf.org/advanced#debugging
140
+ */
141
+ debug?: boolean;
142
+ cache?: boolean;
143
+ }
144
+
145
+ interface ImageWithSrcProp extends BaseImageProps {
146
+ src: SourceObject;
147
+ }
148
+
149
+ interface ImageWithSourceProp extends BaseImageProps {
150
+ source: SourceObject;
151
+ }
152
+
153
+ type ImageProps = ImageWithSrcProp | ImageWithSourceProp;
154
+
155
+ /**
156
+ * A React component for displaying network or local (Node only) JPG or
157
+ * PNG images, as well as base64 encoded image strings.
158
+ */
159
+ export class Image extends React.Component<ImageProps> {}
160
+
161
+ interface TextProps extends NodeProps {
162
+ id?: string;
163
+ /**
164
+ * Enable/disable page wrapping for element.
165
+ * @see https://react-pdf.org/components#page-wrapping
166
+ */
167
+ wrap?: boolean;
168
+ /**
169
+ * Enables debug mode on page bounding box.
170
+ * @see https://react-pdf.org/advanced#debugging
171
+ */
172
+ debug?: boolean;
173
+ render?: (props: {
174
+ pageNumber: number;
175
+ totalPages: number;
176
+ subPageNumber: number;
177
+ subPageTotalPages: number;
178
+ }) => React.ReactNode;
179
+ /**
180
+ * Override the default hyphenation-callback
181
+ * @see https://react-pdf.org/fonts#registerhyphenationcallback
182
+ */
183
+ hyphenationCallback?: HyphenationCallback;
184
+ /**
185
+ * Specifies the minimum number of lines in a text element that must be shown at the bottom of a page or its container.
186
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
187
+ */
188
+ orphans?: number;
189
+ /**
190
+ * Specifies the minimum number of lines in a text element that must be shown at the top of a page or its container..
191
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
192
+ */
193
+ widows?: number;
194
+ }
195
+
196
+ interface SVGTextProps extends SVGPresentationAttributes {
197
+ style?: SVGPresentationAttributes;
198
+ x: string | number;
199
+ y: string | number;
200
+ /**
201
+ * Override the default hyphenation-callback
202
+ * @see https://react-pdf.org/fonts#registerhyphenationcallback
203
+ */
204
+ hyphenationCallback?: HyphenationCallback;
205
+ }
206
+
207
+ /**
208
+ * A React component for displaying text. Text supports nesting of other
209
+ * Text or Link components to create inline styling.
210
+ */
211
+ export class Text extends React.Component<
212
+ React.PropsWithChildren<TextProps> | SVGTextProps
213
+ > {}
214
+
215
+ interface LinkProps extends NodeProps {
216
+ /**
217
+ * Enable/disable page wrapping for element.
218
+ * @see https://react-pdf.org/components#page-wrapping
219
+ */
220
+ wrap?: boolean;
221
+ /**
222
+ * Enables debug mode on page bounding box.
223
+ * @see https://react-pdf.org/advanced#debugging
224
+ */
225
+ debug?: boolean;
226
+ href?: string;
227
+ src?: string;
228
+ }
229
+
230
+ /**
231
+ * A React component for displaying a hyperlink. Link’s can be nested
232
+ * inside a Text component, or being inside any other valid primitive.
233
+ */
234
+ export class Link extends React.Component<
235
+ React.PropsWithChildren<LinkProps>
236
+ > {}
237
+
238
+ interface NoteProps extends NodeProps {
239
+ children: string;
240
+ }
241
+
242
+ export class Note extends React.Component<NoteProps> {}
243
+
244
+ interface CanvasProps extends NodeProps {
245
+ /**
246
+ * Enables debug mode on page bounding box.
247
+ * @see https://react-pdf.org/advanced#debugging
248
+ */
249
+ debug?: boolean;
250
+ paint: (
251
+ painter: any,
252
+ availableWidth: number,
253
+ availableHeight: number,
254
+ ) => null;
255
+ }
256
+
257
+ export class Canvas extends React.Component<CanvasProps> {}
258
+
259
+ interface SVGProps extends NodeProps, SVGPresentationAttributes {
260
+ /**
261
+ * Enables debug mode on page bounding box.
262
+ * @see https://react-pdf.org/advanced#debugging
263
+ */
264
+ debug?: boolean;
265
+ width?: string | number;
266
+ height?: string | number;
267
+ viewBox?: string;
268
+ preserveAspectRatio?: string;
269
+ }
270
+
271
+ /**
272
+ * The <SVG /> element is a container that defines a new coordinate system and viewport. It is used as the outermost element of SVG documents.
273
+ */
274
+ export class Svg extends React.Component<React.PropsWithChildren<SVGProps>> {}
275
+
276
+ interface LineProps extends SVGPresentationAttributes {
277
+ style?: SVGPresentationAttributes;
278
+ x1: string | number;
279
+ x2: string | number;
280
+ y1: string | number;
281
+ y2: string | number;
282
+ }
283
+
284
+ /**
285
+ * The <Line /> element is used to create a line.
286
+ */
287
+ export class Line extends React.Component<
288
+ React.PropsWithChildren<LineProps>
289
+ > {}
290
+
291
+ interface PolylineProps extends SVGPresentationAttributes {
292
+ style?: SVGPresentationAttributes;
293
+ points: string;
294
+ }
295
+
296
+ /**
297
+ * The <Polyline /> element is used to create any shape that consists of only straight lines (that is connected at several points).
298
+ */
299
+ export class Polyline extends React.Component<
300
+ React.PropsWithChildren<PolylineProps>
301
+ > {}
302
+
303
+ interface PolygonProps extends SVGPresentationAttributes {
304
+ style?: SVGPresentationAttributes;
305
+ points: string;
306
+ }
307
+
308
+ /**
309
+ * The <Polygon /> element is used to create a graphic that contains at least three sides.
310
+ * Polygons are made of straight lines, and the shape is "closed" (all the lines connect up).
311
+ */
312
+ export class Polygon extends React.Component<
313
+ React.PropsWithChildren<PolygonProps>
314
+ > {}
315
+
316
+ interface PathProps extends SVGPresentationAttributes {
317
+ style?: SVGPresentationAttributes;
318
+ d: string;
319
+ }
320
+
321
+ /**
322
+ * The <Path /> element is the most powerful element in the SVG library of basic shapes. It can be used to create lines, curves, arcs, and more.
323
+ */
324
+ export class Path extends React.Component<
325
+ React.PropsWithChildren<PathProps>
326
+ > {}
327
+
328
+ interface RectProps extends SVGPresentationAttributes {
329
+ style?: SVGPresentationAttributes;
330
+ x?: string | number;
331
+ y?: string | number;
332
+ width: string | number;
333
+ height: string | number;
334
+ rx?: string | number;
335
+ ry?: string | number;
336
+ }
337
+
338
+ /**
339
+ * The <Rect /> element is used to create a rectangle and variations of a rectangle shape.
340
+ */
341
+ export class Rect extends React.Component<
342
+ React.PropsWithChildren<RectProps>
343
+ > {}
344
+
345
+ interface CircleProps extends SVGPresentationAttributes {
346
+ style?: SVGPresentationAttributes;
347
+ cx?: string | number;
348
+ cy?: string | number;
349
+ r: string | number;
350
+ }
351
+
352
+ /**
353
+ * The <Circle /> element is used to create a circle.
354
+ */
355
+ export class Circle extends React.Component<
356
+ React.PropsWithChildren<CircleProps>
357
+ > {}
358
+
359
+ interface EllipseProps extends SVGPresentationAttributes {
360
+ style?: SVGPresentationAttributes;
361
+ cx?: string | number;
362
+ cy?: string | number;
363
+ rx: string | number;
364
+ ry: string | number;
365
+ }
366
+
367
+ /**
368
+ * The <Ellipse /> element is used to create an ellipse.
369
+ * An ellipse is closely related to a circle. The difference is that an ellipse has an x and a y radius that differs from each other, while a circle has equal x and y radius.
370
+ */
371
+ export class Ellipse extends React.Component<
372
+ React.PropsWithChildren<EllipseProps>
373
+ > {}
374
+
375
+ interface TspanProps extends SVGPresentationAttributes {
376
+ x?: string | number;
377
+ y?: string | number;
378
+ }
379
+
380
+ /**
381
+ * The <Tspan /> element defines a subtext within a <Text /> element or another <Tspan /> element.
382
+ * It allows for adjustment of the style and/or position of that subtext as needed.
383
+ */
384
+ export class Tspan extends React.Component<
385
+ React.PropsWithChildren<TspanProps>
386
+ > {}
387
+
388
+ interface GProps extends SVGPresentationAttributes {
389
+ style?: Style;
390
+ }
391
+
392
+ /**
393
+ * The <G /> SVG element is a container used to group other SVG elements.
394
+ * Transformations applied to the <G /> element are performed on its child elements, and its attributes are inherited by its children.
395
+ */
396
+ export class G extends React.Component<React.PropsWithChildren<GProps>> {}
397
+
398
+ interface StopProps {
399
+ offset: string | number;
400
+ stopColor: string;
401
+ stopOpacity?: string | number;
402
+ }
403
+
404
+ /**
405
+ * The SVG <Stop /> element defines a color and its position to use on a gradient. This element is always a child of a <LinearGradient /> or <RadialGradient /> element
406
+ */
407
+ export class Stop extends React.Component<
408
+ React.PropsWithChildren<StopProps>
409
+ > {}
410
+
411
+ interface DefsProps {}
412
+
413
+ /**
414
+ * The <Defs /> element is used to store graphical objects that will be used at a later time. Objects created inside a <Defs /> element are not rendered directly. To display them you have to reference them
415
+ */
416
+ export class Defs extends React.Component<
417
+ React.PropsWithChildren<DefsProps>
418
+ > {}
419
+
420
+ interface ClipPathProps {
421
+ id?: string;
422
+ }
423
+
424
+ /**
425
+ * The <ClipPath /> SVG element defines a clipping path, to be used by the clipPath property.
426
+ * A clipping path restricts the region to which paint can be applied. Conceptually, parts of the drawing that lie outside of the region bounded by the clipping path are not drawn.
427
+ */
428
+ export class ClipPath extends React.Component<
429
+ React.PropsWithChildren<ClipPathProps>
430
+ > {}
431
+
432
+ interface LinearGradientProps {
433
+ id: string;
434
+ x1?: string | number;
435
+ x2?: string | number;
436
+ y1?: string | number;
437
+ y2?: string | number;
438
+ }
439
+
440
+ /**
441
+ * The <LinearGradient /> element lets authors define linear gradients that can be applied to fill or stroke of graphical elements.
442
+ */
443
+ export class LinearGradient extends React.Component<
444
+ React.PropsWithChildren<LinearGradientProps>
445
+ > {}
446
+
447
+ interface RadialGradientProps {
448
+ id: string;
449
+ cx?: string | number;
450
+ cy?: string | number;
451
+ fr?: string | number;
452
+ fx?: string | number;
453
+ fy?: string | number;
454
+ }
455
+
456
+ /**
457
+ * The <RadialGradient /> element lets authors define radial gradients that can be applied to fill or stroke of graphical elements.
458
+ */
459
+ export class RadialGradient extends React.Component<
460
+ React.PropsWithChildren<RadialGradientProps>
461
+ > {}
462
+
463
+ interface BlobProviderParams {
464
+ blob: Blob | null;
465
+ url: string | null;
466
+ loading: boolean;
467
+ error: Error | null;
468
+ }
469
+ interface BlobProviderProps {
470
+ document: React.ReactElement<DocumentProps>;
471
+ children: (params: BlobProviderParams) => React.ReactNode;
472
+ }
473
+
474
+ /**
475
+ * Easy and declarative way of getting document's blob data without
476
+ * showing it on screen.
477
+ * @see https://react-pdf.org/advanced#on-the-fly-rendering
478
+ * @platform web
479
+ */
480
+ export class BlobProvider extends React.Component<BlobProviderProps> {}
481
+
482
+ interface PDFViewerProps {
483
+ width?: number | string;
484
+ height?: number | string;
485
+ style?: Style | Style[];
486
+ className?: string;
487
+ children?: React.ReactElement<DocumentProps>;
488
+ innerRef?: React.Ref<HTMLIFrameElement>;
489
+ showToolbar?: boolean;
490
+ }
491
+
492
+ /**
493
+ * Iframe PDF viewer for client-side generated documents.
494
+ * @platform web
495
+ */
496
+ export class PDFViewer extends React.Component<PDFViewerProps> {}
497
+
498
+ interface PDFDownloadLinkProps
499
+ extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
500
+ /** PDF filename. Alias for anchor tag `download` attribute. */
501
+ fileName?: string;
502
+ document: React.ReactElement<DocumentProps>;
503
+ children?: React.ReactNode | React.ReactElement<BlobProviderParams>;
504
+ onClick?: React.AnchorHTMLAttributes<HTMLAnchorElement>['onClick'] &
505
+ ((
506
+ event: React.MouseEvent<HTMLAnchorElement, MouseEvent>,
507
+ instance: UsePDFInstance,
508
+ ) => void);
509
+ }
510
+
511
+ /**
512
+ * Anchor tag to enable generate and download PDF documents on the fly.
513
+ * @see https://react-pdf.org/advanced#on-the-fly-rendering
514
+ * @platform web
515
+ */
516
+ export class PDFDownloadLink extends React.Component<PDFDownloadLinkProps> {}
517
+
518
+ interface UsePDFInstance {
519
+ loading: boolean;
520
+ blob: Blob | null;
521
+ url: string | null;
522
+ error: string | null;
523
+ }
524
+
525
+ /**
526
+ * React hook for creating and updating a PDF document instance
527
+ * @platform web
528
+ */
529
+ export function usePDF(options?: {
530
+ document?: React.ReactElement<DocumentProps>;
531
+ }): [
532
+ UsePDFInstance,
533
+ (newDocument: React.ReactElement<DocumentProps>) => void,
534
+ ];
535
+
536
+ export const Font: FontStore;
537
+
538
+ export const StyleSheet: {
539
+ create: <T extends Styles>(styles: T) => T;
540
+ };
541
+
542
+ export const version: any;
543
+
544
+ export const PDFRenderer: any;
545
+
546
+ export const pdf: (initialValue?: React.ReactElement<DocumentProps>) => {
547
+ container: any;
548
+ isDirty: () => boolean;
549
+ toString: () => string;
550
+ toBlob: () => Promise<Blob>;
551
+ // eslint-disable-next-line no-undef
552
+ toBuffer: () => Promise<NodeJS.ReadableStream>;
553
+ on: (event: 'change', callback: () => void) => void;
554
+ updateContainer: (
555
+ document: React.ReactElement<any>,
556
+ callback?: () => void,
557
+ ) => void;
558
+ removeListener: (event: 'change', callback: () => void) => void;
559
+ };
560
+
561
+ export const renderToStream: (
562
+ document: React.ReactElement<DocumentProps>,
563
+ // eslint-disable-next-line no-undef
564
+ ) => Promise<NodeJS.ReadableStream>;
565
+
566
+ /**
567
+ * @deprecated use the `renderToBuffer` method
568
+ */
569
+ export const renderToString: (
570
+ document: React.ReactElement<DocumentProps>,
571
+ ) => Promise<string>;
572
+
573
+ export const renderToFile: (
574
+ document: React.ReactElement<DocumentProps>,
575
+ filePath: string,
576
+ // eslint-disable-next-line no-undef
577
+ callback?: (output: NodeJS.ReadableStream, _filePath: string) => any,
578
+ // eslint-disable-next-line no-undef
579
+ ) => Promise<NodeJS.ReadableStream>;
580
+
581
+ const render: typeof renderToFile;
582
+
583
+ /**
584
+ * Render document into a nodejs buffer
585
+ * @platform node
586
+ */
587
+ export const renderToBuffer: (
588
+ document: React.ReactElement<ReactPDF.DocumentProps>,
589
+ ) => Promise<Buffer>;
590
+ }