@wavy/react-pdf 0.0.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/dist/main.d.ts ADDED
@@ -0,0 +1,44 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ComputedStyleProps } from '@wavy/react-ui';
3
+ import { SafeOmit } from '@wavy/types';
4
+ import { JSX } from 'react';
5
+ import { DocumentProps } from '@react-pdf/renderer';
6
+ export { Image, ImageProps, PDFViewer, PDFViewerProps, Page, PageProps, Text, TextProps, View, ViewProps, pdf } from '@react-pdf/renderer';
7
+
8
+ declare function usePDFDocument(): {
9
+ renderedAsPdf: boolean;
10
+ };
11
+
12
+ interface DivProps extends ComputedStyleProps {
13
+ row?: boolean;
14
+ }
15
+ declare function Div(props: DivProps): react_jsx_runtime.JSX.Element;
16
+
17
+ interface SpanProps extends ComputedStyleProps {
18
+ lineLimit?: number;
19
+ italic?: boolean;
20
+ strikeThrough?: boolean;
21
+ underline?: boolean;
22
+ text?: string;
23
+ ellipsis?: boolean | "native";
24
+ }
25
+ declare function Span(props: SpanProps): react_jsx_runtime.JSX.Element;
26
+
27
+ interface ImgProps extends SafeOmit<ComputedStyleProps, "children"> {
28
+ src: string;
29
+ }
30
+ declare function Img(props: ImgProps): react_jsx_runtime.JSX.Element;
31
+
32
+ /**
33
+ * This component represent the PDF document itself. It must be the root of your tree element structure,
34
+ * and under no circumstances should it be used as children of another react-pdf component.
35
+ * In addition, it should only have childs of type .
36
+ */
37
+ interface PDFDocumentProps extends DocumentProps {
38
+ /**@default false */
39
+ asPdf?: boolean;
40
+ children: JSX.Element | JSX.Element[];
41
+ }
42
+ declare function PDFDocument(props: PDFDocumentProps): react_jsx_runtime.JSX.Element;
43
+
44
+ export { Div, type DivProps, Img, type ImgProps, PDFDocument, type PDFDocumentProps, Span, usePDFDocument };
package/dist/main.js ADDED
@@ -0,0 +1 @@
1
+ import {createContext,useContext}from'react';import {View,Text,Image,Document}from'@react-pdf/renderer';export{Image,PDFViewer,Page,Text,View,pdf}from'@react-pdf/renderer';import {useComputedStyle,restrictLineCount,nativeEllipsis,ellipsis}from'@wavy/react-ui';import {jsx,Fragment}from'react/jsx-runtime';var o=createContext({asPdf:false});function J(){return {renderedAsPdf:useContext(o).asPdf}}function B(e){let{style:t}=useComputedStyle("div",e,{inject:()=>({flexDirection:e.style?.flexDirection||(e.row?"row":"column")})}),{asPdf:r}=useContext(o);return r?jsx(View,{style:t,children:e.children}):jsx("div",{style:t,children:e.children})}function W(e){let t=e.text||e.children,{style:r}=useComputedStyle("span",{...e,children:t},{inject:()=>({textDecoration:e.style?.textDecoration||[e.underline?"underline":"",e.strikeThrough?"line-through":""].join(" "),fontStyle:e.style?.fontStyle||e.italic?"italic":void 0,...e.ellipsis==="native"?nativeEllipsis():e.ellipsis?ellipsis():{},...e.lineLimit?restrictLineCount(e.lineLimit):{}})}),{asPdf:p}=useContext(o);return p?jsx(Text,{style:r,children:t}):jsx("span",{style:r,children:t})}function oe(e){let{asPdf:t}=useContext(o),{style:r}=useComputedStyle("img",e);return t?jsx(Image,{style:r,src:e.src}):jsx("img",{style:r,src:e.src})}function le(e){let t=e.asPdf??false;return jsx(o.Provider,{value:{asPdf:t},children:t?jsx(Document,{...e}):jsx(Fragment,{children:e.children})})}export{B as Div,oe as Img,le as PDFDocument,W as Span,J as usePDFDocument};
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@wavy/react-pdf",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "dist/main.js",
6
+ "scripts": {
7
+ "build": "tsup"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "MIT",
12
+ "type": "module",
13
+ "devDependencies": {
14
+ "@types/react": "^19.2.6",
15
+ "@types/react-dom": "^19.2.3",
16
+ "@wavy/react-ui": "^0.0.6",
17
+ "@wavy/types": "^0.0.51",
18
+ "react": "^19.2.0",
19
+ "react-dom": "^19.2.0",
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
22
+ },
23
+ "dependencies": {
24
+ "@react-pdf/renderer": "^4.3.1"
25
+ }
26
+ }