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