@fauzi-dhuhuri/react-pdf-layout 4.7.0-zi-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.
package/lib/index.d.ts ADDED
@@ -0,0 +1,976 @@
1
+ import { Style, SafeStyle, Transform } from '@react-pdf/stylesheet';
2
+ import { YogaNode } from 'yoga-layout/load';
3
+ import * as React from 'react';
4
+ import * as P from '@react-pdf/primitives';
5
+ import { Paragraph } from '@react-pdf/textkit';
6
+ import { SrcSet, Sizes, HitSlop } from '@react-pdf/types';
7
+ import { Image } from '@react-pdf/image';
8
+ import { HyphenationCallback } from '@react-pdf/font';
9
+
10
+ interface LineProps extends SVGPresentationAttributes {
11
+ style?: SVGPresentationAttributes;
12
+ x1: string | number;
13
+ x2: string | number;
14
+ y1: string | number;
15
+ y2: string | number;
16
+ }
17
+ interface SafeLineProps extends SafeSVGPresentationAttributes {
18
+ style?: SafeSVGPresentationAttributes;
19
+ x1: number;
20
+ x2: number;
21
+ y1: number;
22
+ y2: number;
23
+ }
24
+ type LineNode = {
25
+ type: typeof P.Line;
26
+ props: LineProps;
27
+ style?: Style | Style[];
28
+ box?: never;
29
+ origin?: never;
30
+ yogaNode?: never;
31
+ children?: never[];
32
+ };
33
+ type SafeLineNode = Omit<LineNode, 'style' | 'props'> & {
34
+ style: SafeStyle;
35
+ props: SafeLineProps;
36
+ };
37
+
38
+ interface PolylineProps extends SVGPresentationAttributes {
39
+ style?: SVGPresentationAttributes;
40
+ points: string;
41
+ }
42
+ interface SafePolylineProps extends SafeSVGPresentationAttributes {
43
+ style?: SafeSVGPresentationAttributes;
44
+ points: string;
45
+ }
46
+ type PolylineNode = {
47
+ type: typeof P.Polyline;
48
+ props: PolylineProps;
49
+ style?: Style | Style[];
50
+ box?: never;
51
+ origin?: never;
52
+ yogaNode?: never;
53
+ children?: never[];
54
+ };
55
+ type SafePolylineNode = Omit<PolylineNode, 'style' | 'props'> & {
56
+ style: SafeStyle;
57
+ props: SafePolylineProps;
58
+ };
59
+
60
+ interface PolygonProps extends SVGPresentationAttributes {
61
+ style?: SVGPresentationAttributes;
62
+ points: string;
63
+ }
64
+ interface SafePolygonProps extends SafeSVGPresentationAttributes {
65
+ style?: SafeSVGPresentationAttributes;
66
+ points: string;
67
+ }
68
+ type PolygonNode = {
69
+ type: typeof P.Polygon;
70
+ props: PolygonProps;
71
+ style?: Style | Style[];
72
+ box?: never;
73
+ origin?: never;
74
+ yogaNode?: never;
75
+ children?: never[];
76
+ };
77
+ type SafePolygonNode = Omit<PolygonNode, 'style' | 'props'> & {
78
+ style: SafeStyle;
79
+ props: SafePolygonProps;
80
+ };
81
+
82
+ interface PathProps extends SVGPresentationAttributes {
83
+ style?: SVGPresentationAttributes;
84
+ d: string;
85
+ }
86
+ interface SafePathProps extends SafeSVGPresentationAttributes {
87
+ style?: SafeSVGPresentationAttributes;
88
+ d: string;
89
+ }
90
+ type PathNode = {
91
+ type: typeof P.Path;
92
+ props: PathProps;
93
+ style?: Style | Style[];
94
+ box?: never;
95
+ origin?: never;
96
+ yogaNode?: never;
97
+ children?: never[];
98
+ };
99
+ type SafePathNode = Omit<PathNode, 'style' | 'props'> & {
100
+ style: SafeStyle;
101
+ props: SafePathProps;
102
+ };
103
+
104
+ interface RectProps extends SVGPresentationAttributes {
105
+ style?: SVGPresentationAttributes;
106
+ x?: string | number;
107
+ y?: string | number;
108
+ width: string | number;
109
+ height: string | number;
110
+ rx?: string | number;
111
+ ry?: string | number;
112
+ }
113
+ interface SafeRectProps extends SafeSVGPresentationAttributes {
114
+ style?: SafeSVGPresentationAttributes;
115
+ x?: number;
116
+ y?: number;
117
+ width: number;
118
+ height: number;
119
+ rx?: number;
120
+ ry?: number;
121
+ }
122
+ type RectNode = {
123
+ type: typeof P.Rect;
124
+ props: RectProps;
125
+ style?: Style | Style[];
126
+ box?: never;
127
+ origin?: never;
128
+ yogaNode?: never;
129
+ children?: never[];
130
+ };
131
+ type SafeRectNode = Omit<RectNode, 'style' | 'props'> & {
132
+ style: SafeStyle;
133
+ props: SafeRectProps;
134
+ };
135
+
136
+ interface CircleProps extends SVGPresentationAttributes {
137
+ style?: SVGPresentationAttributes;
138
+ cx?: string | number;
139
+ cy?: string | number;
140
+ r: string | number;
141
+ }
142
+ interface SafeCircleProps extends SafeSVGPresentationAttributes {
143
+ style?: SafeSVGPresentationAttributes;
144
+ cx?: number;
145
+ cy?: number;
146
+ r: number;
147
+ }
148
+ type CircleNode = {
149
+ type: typeof P.Circle;
150
+ props: CircleProps;
151
+ style?: Style | Style[];
152
+ box?: never;
153
+ origin?: Origin;
154
+ yogaNode?: never;
155
+ children?: never[];
156
+ };
157
+ type SafeCircleNode = Omit<CircleNode, 'style' | 'props'> & {
158
+ style: SafeStyle;
159
+ props: SafeCircleProps;
160
+ };
161
+
162
+ interface EllipseProps extends SVGPresentationAttributes {
163
+ style?: SVGPresentationAttributes;
164
+ cx?: string | number;
165
+ cy?: string | number;
166
+ rx: string | number;
167
+ ry: string | number;
168
+ }
169
+ interface SafeEllipseProps extends SafeSVGPresentationAttributes {
170
+ style?: SafeSVGPresentationAttributes;
171
+ cx?: number;
172
+ cy?: number;
173
+ rx: number;
174
+ ry: number;
175
+ }
176
+ type EllipseNode = {
177
+ type: typeof P.Ellipse;
178
+ props: EllipseProps;
179
+ style?: Style | Style[];
180
+ box?: never;
181
+ origin?: never;
182
+ yogaNode?: never;
183
+ children?: never[];
184
+ };
185
+ type SafeEllipseNode = Omit<EllipseNode, 'style' | 'props'> & {
186
+ style: SafeStyle;
187
+ props: SafeEllipseProps;
188
+ };
189
+
190
+ interface ClipPathProps {
191
+ id?: string;
192
+ }
193
+ type ClipPathNode = {
194
+ type: typeof P.ClipPath;
195
+ props: ClipPathProps;
196
+ style: never;
197
+ box?: never;
198
+ origin?: never;
199
+ yogaNode?: never;
200
+ children?: (LineNode | PolylineNode | PolygonNode | PathNode | RectNode | CircleNode | EllipseNode)[];
201
+ };
202
+ type SafeClipPathNode = Omit<ClipPathNode, 'children'> & {
203
+ children?: (SafeLineNode | SafePolylineNode | SafePolygonNode | SafePathNode | SafeRectNode | SafeCircleNode | SafeEllipseNode)[];
204
+ };
205
+
206
+ interface StopProps {
207
+ offset: string | number;
208
+ stopColor: string;
209
+ stopOpacity?: string | number;
210
+ }
211
+ interface StopSafeProps {
212
+ offset: number;
213
+ stopColor: string;
214
+ stopOpacity?: number;
215
+ }
216
+ type StopNode = {
217
+ type: typeof P.Stop;
218
+ props: StopProps;
219
+ style?: never;
220
+ box?: never;
221
+ origin?: never;
222
+ yogaNode?: never;
223
+ children?: never[];
224
+ };
225
+ type SafeStopNode = Omit<StopNode, 'props'> & {
226
+ props: StopSafeProps;
227
+ };
228
+
229
+ interface LinearGradientProps {
230
+ id: string;
231
+ x1?: string | number;
232
+ x2?: string | number;
233
+ y1?: string | number;
234
+ y2?: string | number;
235
+ xlinkHref?: string;
236
+ gradientTransform?: string;
237
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
238
+ }
239
+ interface SafeLinearGradientProps {
240
+ id: string;
241
+ x1?: number;
242
+ x2?: number;
243
+ y1?: number;
244
+ y2?: number;
245
+ xlinkHref?: string;
246
+ gradientTransform?: Transform[];
247
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
248
+ }
249
+ type LinearGradientNode = {
250
+ type: typeof P.LinearGradient;
251
+ props: LinearGradientProps;
252
+ style?: never;
253
+ box?: never;
254
+ origin?: never;
255
+ yogaNode?: never;
256
+ children?: StopNode[];
257
+ };
258
+ type SafeLinearGradientNode = Omit<LinearGradientNode, 'props' | 'children'> & {
259
+ props: SafeLinearGradientProps;
260
+ children?: SafeStopNode[];
261
+ };
262
+
263
+ type TextInstanceNode = {
264
+ type: typeof P.TextInstance;
265
+ props?: never;
266
+ style?: never;
267
+ box?: never;
268
+ origin?: never;
269
+ children?: never[];
270
+ yogaNode?: never;
271
+ value: string;
272
+ };
273
+ type SafeTextInstanceNode = TextInstanceNode;
274
+
275
+ interface TspanProps extends SVGPresentationAttributes {
276
+ x?: string | number;
277
+ y?: string | number;
278
+ }
279
+ interface SafeTspanProps extends SafeSVGPresentationAttributes {
280
+ x?: number;
281
+ y?: number;
282
+ }
283
+ type TspanNode = {
284
+ type: typeof P.Tspan;
285
+ props: TspanProps;
286
+ style?: Style | Style[];
287
+ box?: never;
288
+ origin?: never;
289
+ yogaNode?: never;
290
+ lines?: Paragraph;
291
+ children?: TextInstanceNode[];
292
+ };
293
+ type SafeTspanNode = Omit<TspanNode, 'style' | 'props' | 'children'> & {
294
+ style: SafeStyle;
295
+ props: SafeTspanProps;
296
+ children?: SafeTextInstanceNode[];
297
+ };
298
+
299
+ type HTTPMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
300
+ type SourceURL = string;
301
+ type SourceBuffer = Buffer;
302
+ type SourceBlob = Blob;
303
+ type SourceDataBuffer = {
304
+ data: Buffer;
305
+ format: 'png' | 'jpg' | 'webp';
306
+ };
307
+ type SourceURLObject = {
308
+ uri: string;
309
+ method?: HTTPMethod;
310
+ body?: any;
311
+ headers?: any;
312
+ credentials?: 'omit' | 'same-origin' | 'include';
313
+ };
314
+ type Source = SourceURL | SourceBuffer | SourceBlob | SourceDataBuffer | SourceURLObject | undefined;
315
+ type SourceFactory = () => Source;
316
+ type SourceAsync = Promise<Source>;
317
+ type SourceAsyncFactory = () => Promise<Source>;
318
+ type SourceObject = Source | SourceFactory | SourceAsync | SourceAsyncFactory;
319
+ interface BaseImageProps extends NodeProps {
320
+ cache?: boolean;
321
+ x?: number;
322
+ y?: number;
323
+ srcSet?: SrcSet;
324
+ sizes?: Sizes;
325
+ }
326
+ interface ImageWithSrcProp extends BaseImageProps {
327
+ src: SourceObject;
328
+ source?: never;
329
+ }
330
+ interface ImageWithSourceProp extends BaseImageProps {
331
+ source: SourceObject;
332
+ src?: never;
333
+ }
334
+ type ImageProps = ImageWithSrcProp | ImageWithSourceProp;
335
+ type ImageNode = {
336
+ type: typeof P.Image;
337
+ props: ImageProps;
338
+ image?: Image;
339
+ style?: Style | Style[];
340
+ box?: Box;
341
+ origin?: Origin;
342
+ yogaNode?: YogaNode;
343
+ children?: never[];
344
+ };
345
+ type SafeImageNode = Omit<ImageNode, 'style'> & {
346
+ style: SafeStyle;
347
+ };
348
+
349
+ interface TextProps extends NodeProps {
350
+ /**
351
+ * Enable/disable page wrapping for element.
352
+ * @see https://react-pdf.org/components#page-wrapping
353
+ */
354
+ wrap?: boolean;
355
+ render?: RenderProp;
356
+ /**
357
+ * Override the default hyphenation-callback
358
+ * @see https://react-pdf.org/fonts#registerhyphenationcallback
359
+ */
360
+ hyphenationCallback?: HyphenationCallback;
361
+ /**
362
+ * Specifies the minimum number of lines in a text element that must be shown at the bottom of a page or its container.
363
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
364
+ */
365
+ orphans?: number;
366
+ /**
367
+ * Specifies the minimum number of lines in a text element that must be shown at the top of a page or its container..
368
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
369
+ */
370
+ widows?: number;
371
+ x?: number;
372
+ y?: number;
373
+ }
374
+ type TextNode = {
375
+ type: typeof P.Text;
376
+ props: TextProps;
377
+ style?: Style | Style[];
378
+ box?: Box;
379
+ origin?: Origin;
380
+ yogaNode?: YogaNode;
381
+ lines?: Paragraph;
382
+ alignOffset?: number;
383
+ children?: (TextNode | TextInstanceNode | ImageNode | TspanNode)[];
384
+ };
385
+ type SafeTextNode = Omit<TextNode, 'style' | 'children'> & {
386
+ style: SafeStyle;
387
+ children?: (SafeTextNode | SafeTextInstanceNode | SafeImageNode | SafeTspanNode)[];
388
+ };
389
+
390
+ interface GProps extends SVGPresentationAttributes {
391
+ style?: Style | Style[];
392
+ }
393
+ interface SafeGProps extends SafeSVGPresentationAttributes {
394
+ style?: Style;
395
+ }
396
+ type GNode = {
397
+ type: typeof P.G;
398
+ props: GProps;
399
+ style?: Style | Style[];
400
+ box?: never;
401
+ origin?: never;
402
+ yogaNode?: never;
403
+ children?: (LineNode | PolylineNode | PolygonNode | PathNode | RectNode | CircleNode | EllipseNode | ImageNode | TextNode | TspanNode | GNode)[];
404
+ };
405
+ type SafeGNode = Omit<GNode, 'style' | 'props' | 'children'> & {
406
+ style: SafeStyle;
407
+ props: SafeGProps;
408
+ children?: (SafeLineNode | SafePolylineNode | SafePolygonNode | SafePathNode | SafeRectNode | SafeCircleNode | SafeEllipseNode | SafeImageNode | SafeTextNode | SafeTspanNode | SafeGNode)[];
409
+ };
410
+
411
+ interface RadialGradientProps {
412
+ id: string;
413
+ cx?: string | number;
414
+ cy?: string | number;
415
+ fr?: string | number;
416
+ fx?: string | number;
417
+ fy?: string | number;
418
+ r?: string | number;
419
+ xlinkHref?: string;
420
+ gradientTransform?: string;
421
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
422
+ }
423
+ interface SafeRadialGradientProps {
424
+ id: string;
425
+ cx?: number;
426
+ cy?: number;
427
+ fr?: number;
428
+ fx?: number;
429
+ fy?: number;
430
+ r?: number;
431
+ xlinkHref?: string;
432
+ gradientTransform?: Transform[];
433
+ gradientUnits?: 'userSpaceOnUse' | 'objectBoundingBox';
434
+ }
435
+ type RadialGradientNode = {
436
+ type: typeof P.RadialGradient;
437
+ props: RadialGradientProps;
438
+ style?: never;
439
+ box?: never;
440
+ origin?: never;
441
+ yogaNode?: never;
442
+ children?: StopNode[];
443
+ };
444
+ type SafeRadialGradientNode = Omit<RadialGradientNode, 'props' | 'children'> & {
445
+ props: SafeRadialGradientProps;
446
+ children?: SafeStopNode[];
447
+ };
448
+
449
+ type DefsNode = {
450
+ type: typeof P.Defs;
451
+ props?: never;
452
+ style?: never;
453
+ box?: never;
454
+ origin?: never;
455
+ yogaNode?: never;
456
+ children?: (ClipPathNode | LinearGradientNode | RadialGradientNode | MarkerNode)[];
457
+ };
458
+ type Defs = Record<string, DefsNode['children'][number]>;
459
+ type SafeDefsNode = Omit<DefsNode, 'children'> & {
460
+ children?: (SafeClipPathNode | SafeLinearGradientNode | SafeRadialGradientNode | SafeMarkerNode)[];
461
+ };
462
+ type SafeDefs = Record<string, SafeDefsNode['children'][number]>;
463
+
464
+ type Viewbox = {
465
+ minX: number;
466
+ minY: number;
467
+ maxX: number;
468
+ maxY: number;
469
+ };
470
+ type PreserveAspectRatio = {
471
+ align: 'none' | 'xMinYMin' | 'xMidYMin' | 'xMaxYMin' | 'xMinYMid' | 'xMidYMid' | 'xMaxYMid' | 'xMinYMax' | 'xMidYMax' | 'xMaxYMax';
472
+ meetOrSlice: 'meet' | 'slice';
473
+ };
474
+ interface SvgProps extends NodeProps, SVGPresentationAttributes {
475
+ width?: string | number;
476
+ height?: string | number;
477
+ viewBox?: string | Viewbox;
478
+ preserveAspectRatio?: string;
479
+ }
480
+ interface SvgSafeProps extends NodeProps, SafeSVGPresentationAttributes {
481
+ width?: string | number;
482
+ height?: string | number;
483
+ viewBox?: Viewbox;
484
+ preserveAspectRatio?: PreserveAspectRatio;
485
+ }
486
+ type SvgNode = {
487
+ type: typeof P.Svg;
488
+ props: SvgProps;
489
+ style?: Style | Style[];
490
+ box?: Box;
491
+ origin?: Origin;
492
+ yogaNode?: YogaNode;
493
+ children?: (LineNode | PolylineNode | PolygonNode | PathNode | RectNode | CircleNode | EllipseNode | ImageNode | TextNode | TspanNode | GNode | DefsNode)[];
494
+ };
495
+ type SafeSvgNode = Omit<SvgNode, 'style' | 'props' | 'children'> & {
496
+ style: SafeStyle;
497
+ props: SvgSafeProps;
498
+ children?: (SafeLineNode | SafePolylineNode | SafePolygonNode | SafePathNode | SafeRectNode | SafeCircleNode | SafeEllipseNode | SafeImageNode | SafeTextNode | SafeTspanNode | SafeGNode | SafeDefsNode)[];
499
+ };
500
+
501
+ type MarkerOrient = 'auto' | 'auto-start-reverse' | number;
502
+ interface MarkerProps {
503
+ id: string;
504
+ viewBox?: string;
505
+ refX?: string | number;
506
+ refY?: string | number;
507
+ markerWidth?: string | number;
508
+ markerHeight?: string | number;
509
+ orient?: MarkerOrient;
510
+ markerUnits?: 'strokeWidth' | 'userSpaceOnUse';
511
+ }
512
+ interface SafeMarkerProps {
513
+ id: string;
514
+ viewBox?: Viewbox;
515
+ refX?: number;
516
+ refY?: number;
517
+ markerWidth?: number;
518
+ markerHeight?: number;
519
+ orient?: MarkerOrient;
520
+ markerUnits?: 'strokeWidth' | 'userSpaceOnUse';
521
+ }
522
+ type MarkerNode = {
523
+ type: typeof P.Marker;
524
+ props: MarkerProps;
525
+ style?: never;
526
+ box?: never;
527
+ origin?: never;
528
+ yogaNode?: never;
529
+ children?: (LineNode | PolylineNode | PolygonNode | PathNode | RectNode | CircleNode | EllipseNode | GNode)[];
530
+ };
531
+ type SafeMarkerNode = Omit<MarkerNode, 'props' | 'children'> & {
532
+ props: SafeMarkerProps;
533
+ children?: (SafeLineNode | SafePolylineNode | SafePolygonNode | SafePathNode | SafeRectNode | SafeCircleNode | SafeEllipseNode | SafeGNode)[];
534
+ };
535
+
536
+ type YogaInstance = {
537
+ node: {
538
+ create: () => YogaNode;
539
+ };
540
+ };
541
+ type Box = {
542
+ width: number;
543
+ height: number;
544
+ top: number;
545
+ left: number;
546
+ right: number;
547
+ bottom: number;
548
+ marginTop?: number;
549
+ marginRight?: number;
550
+ marginBottom?: number;
551
+ marginLeft?: number;
552
+ paddingTop?: number;
553
+ paddingRight?: number;
554
+ paddingBottom?: number;
555
+ paddingLeft?: number;
556
+ borderTopWidth?: number;
557
+ borderRightWidth?: number;
558
+ borderBottomWidth?: number;
559
+ borderLeftWidth?: number;
560
+ };
561
+ type Origin = {
562
+ left: number;
563
+ top: number;
564
+ };
565
+ interface Bookmark {
566
+ title: string;
567
+ top?: number;
568
+ left?: number;
569
+ zoom?: number;
570
+ fit?: true | false;
571
+ expanded?: true | false;
572
+ parent?: number;
573
+ ref?: number;
574
+ }
575
+ type DynamicPageProps = {
576
+ pageNumber: number;
577
+ totalPages?: number;
578
+ subPageNumber?: number;
579
+ subPageTotalPages?: number;
580
+ };
581
+ type RenderProp = (props: DynamicPageProps) => React.ReactNode | null | undefined;
582
+ type NodeProps = {
583
+ id?: string;
584
+ /**
585
+ * Render component in all wrapped pages.
586
+ * @see https://react-pdf.org/advanced#fixed-components
587
+ */
588
+ fixed?: boolean;
589
+ /**
590
+ * Force the wrapping algorithm to start a new page when rendering the
591
+ * element.
592
+ * @see https://react-pdf.org/advanced#page-breaks
593
+ */
594
+ break?: boolean;
595
+ /**
596
+ * Hint that no page wrapping should occur between all sibling elements following the element within n points
597
+ * @see https://react-pdf.org/advanced#orphan-&-widow-protection
598
+ */
599
+ minPresenceAhead?: number;
600
+ /**
601
+ * Enables debug mode on page bounding box.
602
+ * @see https://react-pdf.org/advanced#debugging
603
+ */
604
+ debug?: boolean;
605
+ /**
606
+ * Bookmark for the element.
607
+ * @see https://react-pdf.org/advanced#bookmarks
608
+ */
609
+ bookmark?: string | Bookmark;
610
+ };
611
+ type FillRule = 'nonzero' | 'evenodd';
612
+ type TextAnchor = 'start' | 'middle' | 'end';
613
+ type StrokeLinecap = 'butt' | 'round' | 'square';
614
+ type StrokeLinejoin = 'butt' | 'round' | 'square' | 'miter' | 'bevel';
615
+ type Visibility = 'visible' | 'hidden' | 'collapse';
616
+ type DominantBaseline = 'auto' | 'middle' | 'central' | 'hanging' | 'mathematical' | 'text-after-edge' | 'text-before-edge';
617
+ type SVGPresentationAttributes = {
618
+ fill?: string;
619
+ color?: string;
620
+ stroke?: string;
621
+ transform?: string;
622
+ strokeDasharray?: string;
623
+ opacity?: string | number;
624
+ strokeWidth?: string | number;
625
+ fillOpacity?: string | number;
626
+ fillRule?: FillRule;
627
+ strokeOpacity?: string | number;
628
+ textAnchor?: TextAnchor;
629
+ strokeLinecap?: StrokeLinecap;
630
+ strokeLinejoin?: StrokeLinejoin;
631
+ visibility?: Visibility;
632
+ clipPath?: string;
633
+ dominantBaseline?: DominantBaseline;
634
+ markerStart?: string;
635
+ markerMid?: string;
636
+ markerEnd?: string;
637
+ };
638
+ type SafeSVGPresentationAttributes = {
639
+ fill?: string | SafeLinearGradientNode | SafeRadialGradientNode;
640
+ color?: string;
641
+ stroke?: string;
642
+ transform?: Transform[];
643
+ strokeDasharray?: string;
644
+ opacity?: number;
645
+ strokeWidth?: number;
646
+ fillOpacity?: number;
647
+ fillRule?: FillRule;
648
+ strokeOpacity?: number;
649
+ textAnchor?: TextAnchor;
650
+ strokeLinecap?: StrokeLinecap;
651
+ strokeLinejoin?: StrokeLinejoin;
652
+ visibility?: Visibility;
653
+ clipPath?: SafeClipPathNode;
654
+ dominantBaseline?: DominantBaseline;
655
+ markerStart?: SafeMarkerNode;
656
+ markerMid?: SafeMarkerNode;
657
+ markerEnd?: SafeMarkerNode;
658
+ };
659
+ interface FormCommonProps extends NodeProps {
660
+ name?: string;
661
+ required?: boolean;
662
+ noExport?: boolean;
663
+ readOnly?: boolean;
664
+ value?: number | string;
665
+ defaultValue?: number | string;
666
+ }
667
+
668
+ interface CanvasProps extends NodeProps {
669
+ paint: (painter: any, availableWidth?: number, availableHeight?: number) => null;
670
+ }
671
+ type CanvasNode = {
672
+ type: typeof P.Canvas;
673
+ props: CanvasProps;
674
+ style?: Style | Style[];
675
+ box?: Box;
676
+ origin?: Origin;
677
+ yogaNode?: YogaNode;
678
+ children?: never[];
679
+ };
680
+ type SafeCanvasNode = Omit<CanvasNode, 'style'> & {
681
+ style: SafeStyle;
682
+ };
683
+
684
+ interface CheckboxProps extends FormCommonProps {
685
+ backgroundColor?: string;
686
+ borderColor?: string;
687
+ checked?: boolean;
688
+ onState?: string;
689
+ offState?: string;
690
+ xMark?: boolean;
691
+ }
692
+ type CheckboxNode = {
693
+ type: typeof P.Checkbox;
694
+ props: CheckboxProps;
695
+ style?: Style | Style[];
696
+ box?: Box;
697
+ origin?: Origin;
698
+ yogaNode?: YogaNode;
699
+ children?: never[];
700
+ };
701
+ type SafeCheckboxNode = Omit<CheckboxNode, 'style'> & {
702
+ style: SafeStyle;
703
+ };
704
+
705
+ interface LinkProps extends NodeProps {
706
+ /**
707
+ * Enable/disable page wrapping for element.
708
+ * @see https://react-pdf.org/components#page-wrapping
709
+ */
710
+ wrap?: boolean;
711
+ href?: string;
712
+ src?: string;
713
+ hitSlop?: HitSlop;
714
+ render?: RenderProp;
715
+ }
716
+ type LinkNode = {
717
+ type: typeof P.Link;
718
+ props: LinkProps;
719
+ style?: Style | Style[];
720
+ box?: Box;
721
+ origin?: Origin;
722
+ yogaNode?: YogaNode;
723
+ children?: (ViewNode | ImageNode | TextNode | TextInstanceNode)[];
724
+ };
725
+ type SafeLinkNode = Omit<LinkNode, 'style' | 'children'> & {
726
+ style: SafeStyle;
727
+ children?: (SafeViewNode | SafeImageNode | SafeTextNode | SafeTextInstanceNode)[];
728
+ };
729
+
730
+ interface TextInputFormatting {
731
+ type: 'date' | 'time' | 'percent' | 'number' | 'zip' | 'zipPlus4' | 'phone' | 'ssn';
732
+ param?: string;
733
+ nDec?: number;
734
+ sepComma?: boolean;
735
+ negStyle?: 'MinusBlack' | 'Red' | 'ParensBlack' | 'ParensRed';
736
+ currency?: string;
737
+ currencyPrepend?: boolean;
738
+ }
739
+ interface TextInputProps extends FormCommonProps {
740
+ align?: 'left' | 'center' | 'right';
741
+ multiline?: boolean;
742
+ /**
743
+ * The text will be masked (e.g. with asterisks).
744
+ */
745
+ password?: boolean;
746
+ /**
747
+ * If set, text entered in the field is not spell-checked
748
+ */
749
+ noSpell?: boolean;
750
+ format?: TextInputFormatting;
751
+ /**
752
+ * Sets the fontSize (default or 0 means auto sizing)
753
+ */
754
+ fontSize?: number;
755
+ /**
756
+ * Sets the maximum length (characters) of the text in the field
757
+ */
758
+ maxLength?: number;
759
+ }
760
+ type TextInputNode = {
761
+ type: typeof P.TextInput;
762
+ props: TextInputProps;
763
+ style?: Style | Style[];
764
+ box?: Box;
765
+ origin?: Origin;
766
+ yogaNode?: YogaNode;
767
+ children?: never[];
768
+ };
769
+ type SafeTextInputNode = Omit<TextInputNode, 'style'> & {
770
+ style: SafeStyle;
771
+ };
772
+
773
+ interface FieldSetProps extends NodeProps {
774
+ name: string;
775
+ }
776
+ type FieldSetNode = {
777
+ type: typeof P.FieldSet;
778
+ props: FieldSetProps;
779
+ style?: Style | Style[];
780
+ box?: Box;
781
+ origin?: Origin;
782
+ yogaNode?: YogaNode;
783
+ children?: (TextNode | ViewNode | TextInputNode)[];
784
+ };
785
+ type SafeFieldSetNode = Omit<FieldSetNode, 'style' | 'children'> & {
786
+ style: SafeStyle;
787
+ children?: (SafeTextNode | SafeViewNode | SafeTextInputNode)[];
788
+ };
789
+
790
+ interface SelectAndListProps extends FormCommonProps {
791
+ sort?: boolean;
792
+ edit?: boolean;
793
+ multiSelect?: boolean;
794
+ noSpell?: boolean;
795
+ select?: string[];
796
+ }
797
+ type SelectNode = {
798
+ type: typeof P.Select;
799
+ props: SelectAndListProps;
800
+ style?: Style | Style[];
801
+ box?: Box;
802
+ origin?: Origin;
803
+ yogaNode?: never;
804
+ children?: never[];
805
+ };
806
+ type SafeSelectNode = Omit<SelectNode, 'style'> & {
807
+ style: SafeStyle;
808
+ };
809
+ type ListNode = {
810
+ type: typeof P.List;
811
+ props: SelectAndListProps;
812
+ style?: Style | Style[];
813
+ box?: Box;
814
+ origin?: Origin;
815
+ yogaNode?: YogaNode;
816
+ children?: never[];
817
+ };
818
+ type SafeListNode = Omit<ListNode, 'style'> & {
819
+ style: SafeStyle;
820
+ };
821
+
822
+ type NoteNode = {
823
+ type: typeof P.Note;
824
+ props: NodeProps;
825
+ style?: Style | Style[];
826
+ box?: never;
827
+ origin?: never;
828
+ yogaNode?: never;
829
+ children?: TextInstanceNode[];
830
+ };
831
+ type SafeNoteNode = Omit<NoteNode, 'style' | 'children'> & {
832
+ style: SafeStyle;
833
+ children?: SafeTextInstanceNode[];
834
+ };
835
+
836
+ interface ViewProps extends NodeProps {
837
+ id?: string;
838
+ /**
839
+ * Enable/disable page wrapping for element.
840
+ * @see https://react-pdf.org/components#page-wrapping
841
+ */
842
+ wrap?: boolean;
843
+ render?: RenderProp;
844
+ }
845
+ type ViewNode = {
846
+ type: typeof P.View;
847
+ props: ViewProps;
848
+ style?: Style | Style[];
849
+ box?: Box;
850
+ origin?: Origin;
851
+ yogaNode?: YogaNode;
852
+ children?: (ViewNode | ImageNode | ImageBackgroundNode | TextNode | LinkNode | CanvasNode | FieldSetNode | TextInputNode | SelectNode | ListNode | CheckboxNode | NoteNode)[];
853
+ };
854
+ type SafeViewNode = Omit<ViewNode, 'style' | 'children'> & {
855
+ style: SafeStyle;
856
+ children?: (SafeViewNode | SafeImageNode | SafeImageBackgroundNode | SafeTextNode | SafeLinkNode | SafeCanvasNode | SafeFieldSetNode | SafeTextInputNode | SafeSelectNode | SafeListNode | SafeCanvasNode | SafeNoteNode)[];
857
+ };
858
+
859
+ interface BaseImageBackgroundProps extends NodeProps {
860
+ cache?: boolean;
861
+ srcSet?: SrcSet;
862
+ sizes?: Sizes;
863
+ imageStyle?: Style;
864
+ wrap?: boolean;
865
+ }
866
+ interface ImageBackgroundWithSrcProp extends BaseImageBackgroundProps {
867
+ src: SourceObject;
868
+ source?: never;
869
+ }
870
+ interface ImageBackgroundWithSourceProp extends BaseImageBackgroundProps {
871
+ source: SourceObject;
872
+ src?: never;
873
+ }
874
+ type ImageBackgroundProps = ImageBackgroundWithSrcProp | ImageBackgroundWithSourceProp;
875
+ type ImageBackgroundNode = {
876
+ type: typeof P.ImageBackground;
877
+ props: ImageBackgroundProps;
878
+ image?: Image;
879
+ style?: Style | Style[];
880
+ box?: Box;
881
+ origin?: Origin;
882
+ yogaNode?: YogaNode;
883
+ children?: (ViewNode | ImageNode | TextNode | LinkNode | CanvasNode | FieldSetNode | TextInputNode | SelectNode | ListNode | CheckboxNode | NoteNode)[];
884
+ };
885
+ type SafeImageBackgroundNode = Omit<ImageBackgroundNode, 'style' | 'children'> & {
886
+ style: SafeStyle;
887
+ children?: (SafeViewNode | SafeImageNode | SafeTextNode | SafeLinkNode | SafeCanvasNode | SafeFieldSetNode | SafeTextInputNode | SafeSelectNode | SafeListNode | SafeCheckboxNode | SafeNoteNode)[];
888
+ };
889
+
890
+ type Orientation = 'portrait' | 'landscape';
891
+ type StandardPageSize = '4A0' | '2A0' | 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'A7' | 'A8' | 'A9' | 'A10' | 'B0' | 'B1' | 'B2' | 'B3' | 'B4' | 'B5' | 'B6' | 'B7' | 'B8' | 'B9' | 'B10' | 'C0' | 'C1' | 'C2' | 'C3' | 'C4' | 'C5' | 'C6' | 'C7' | 'C8' | 'C9' | 'C10' | 'RA0' | 'RA1' | 'RA2' | 'RA3' | 'RA4' | 'SRA0' | 'SRA1' | 'SRA2' | 'SRA3' | 'SRA4' | 'EXECUTIVE' | 'FOLIO' | 'LEGAL' | 'LETTER' | 'TABLOID' | 'ID1';
892
+ type StaticSize = number | string;
893
+ type PageSize = number | StandardPageSize | [StaticSize] | [StaticSize, StaticSize] | {
894
+ width: StaticSize;
895
+ height?: StaticSize;
896
+ };
897
+ interface PageProps extends NodeProps {
898
+ /**
899
+ * Enable page wrapping for this page.
900
+ * @see https://react-pdf.org/components#page-wrapping
901
+ */
902
+ wrap?: boolean;
903
+ size?: PageSize;
904
+ orientation?: Orientation;
905
+ dpi?: number;
906
+ }
907
+ type PageNode = {
908
+ type: typeof P.Page;
909
+ props: PageProps;
910
+ style?: Style | Style[];
911
+ box?: Box;
912
+ origin?: Origin;
913
+ yogaNode?: YogaNode;
914
+ children?: (ViewNode | ImageNode | ImageBackgroundNode | TextNode | LinkNode | CanvasNode | FieldSetNode | TextInputNode | SelectNode | ListNode | CheckboxNode | NoteNode)[];
915
+ };
916
+ type SafePageNode = Omit<PageNode, 'style' | 'children'> & {
917
+ style: SafeStyle;
918
+ children?: (SafeViewNode | SafeImageNode | SafeImageBackgroundNode | SafeTextNode | SafeLinkNode | SafeCanvasNode | SafeFieldSetNode | SafeTextInputNode | SafeSelectNode | SafeListNode | SafeCheckboxNode | SafeNoteNode)[];
919
+ };
920
+
921
+ type PDFVersion = '1.3' | '1.4' | '1.5' | '1.6' | '1.7' | '1.7ext3';
922
+ type PageLayout = 'singlePage' | 'oneColumn' | 'twoColumnLeft' | 'twoColumnRight' | 'twoPageLeft' | 'twoPageRight';
923
+ type PageMode = 'useNone' | 'useOutlines' | 'useThumbs' | 'fullScreen' | 'useOC' | 'useAttachments';
924
+ interface OnRenderProps {
925
+ blob?: Blob;
926
+ }
927
+ type Permissions = {
928
+ printing?: 'lowResolution' | 'highResolution';
929
+ modifying?: boolean;
930
+ copying?: boolean;
931
+ annotating?: boolean;
932
+ fillingForms?: boolean;
933
+ contentAccessibility?: boolean;
934
+ documentAssembly?: boolean;
935
+ };
936
+ type DocumentProps = {
937
+ bookmark?: never;
938
+ title?: string;
939
+ author?: string;
940
+ subject?: string;
941
+ creator?: string;
942
+ keywords?: string;
943
+ producer?: string;
944
+ language?: string;
945
+ creationDate?: Date;
946
+ modificationDate?: Date;
947
+ pdfVersion?: PDFVersion;
948
+ pageMode?: PageMode;
949
+ pageLayout?: PageLayout;
950
+ ownerPassword?: string;
951
+ userPassword?: string;
952
+ permissions?: Permissions;
953
+ onRender?: (props: OnRenderProps) => any;
954
+ };
955
+ type DocumentNode = {
956
+ type: typeof P.Document;
957
+ props: DocumentProps;
958
+ box?: never;
959
+ origin?: never;
960
+ style?: Style | Style[];
961
+ yoga?: YogaInstance;
962
+ yogaNode?: never;
963
+ children: PageNode[];
964
+ };
965
+ type SafeDocumentNode = Omit<DocumentNode, 'style' | 'children'> & {
966
+ style: SafeStyle;
967
+ children: SafePageNode[];
968
+ };
969
+
970
+ type Node = DocumentNode | PageNode | ImageNode | ImageBackgroundNode | SvgNode | CircleNode | ClipPathNode | DefsNode | EllipseNode | GNode | LineNode | LinearGradientNode | MarkerNode | PathNode | PolygonNode | PolylineNode | RadialGradientNode | RectNode | StopNode | TspanNode | ViewNode | LinkNode | TextNode | TextInstanceNode | NoteNode | CanvasNode | FieldSetNode | TextInputNode | SelectNode | ListNode | CheckboxNode;
971
+ type SafeNode = SafeDocumentNode | SafePageNode | SafeImageNode | SafeImageBackgroundNode | SafeSvgNode | SafeCircleNode | SafeClipPathNode | SafeDefsNode | SafeEllipseNode | SafeGNode | SafeLineNode | SafeLinearGradientNode | SafeMarkerNode | SafePathNode | SafePolygonNode | SafePolylineNode | SafeRadialGradientNode | SafeRectNode | SafeStopNode | SafeTspanNode | SafeViewNode | SafeLinkNode | SafeTextNode | SafeTextInstanceNode | SafeNoteNode | SafeCanvasNode | SafeFieldSetNode | SafeTextInputNode | SafeSelectNode | SafeListNode | SafeCheckboxNode;
972
+
973
+ declare const layout: (value: DocumentNode) => Promise<SafeDocumentNode>;
974
+
975
+ export { layout as default };
976
+ export type { Bookmark, Box, CanvasNode, CheckboxNode, CircleNode, ClipPathNode, Defs, DefsNode, DocumentNode, DocumentProps, DominantBaseline, DynamicPageProps, EllipseNode, FieldSetNode, FillRule, FormCommonProps, GNode, ImageBackgroundNode, ImageBackgroundProps, ImageNode, ImageProps, LineNode, LinearGradientNode, LinkNode, ListNode, MarkerNode, Node, NodeProps, NoteNode, OnRenderProps, Orientation, Origin, PDFVersion, PageLayout, PageMode, PageNode, PageSize, PathNode, Permissions, PolygonNode, PolylineNode, PreserveAspectRatio, RadialGradientNode, RectNode, RenderProp, SVGPresentationAttributes, SafeCanvasNode, SafeCheckboxNode, SafeCircleNode, SafeClipPathNode, SafeDefs, SafeDefsNode, SafeDocumentNode, SafeEllipseNode, SafeFieldSetNode, SafeGNode, SafeImageBackgroundNode, SafeImageNode, SafeLineNode, SafeLinearGradientNode, SafeLinkNode, SafeListNode, SafeMarkerNode, SafeNode, SafeNoteNode, SafePageNode, SafePathNode, SafePolygonNode, SafePolylineNode, SafeRadialGradientNode, SafeRectNode, SafeSVGPresentationAttributes, SafeSelectNode, SafeStopNode, SafeSvgNode, SafeTextInputNode, SafeTextInstanceNode, SafeTextNode, SafeTspanNode, SafeViewNode, SelectNode, SourceObject, StandardPageSize, StopNode, StrokeLinecap, StrokeLinejoin, SvgNode, TextAnchor, TextInputNode, TextInstanceNode, TextNode, TspanNode, ViewNode, Viewbox, Visibility, YogaInstance };