@wavy/react-pdf 0.0.13 → 0.0.14
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.js +1 -1
- package/package.json +2 -4
package/dist/main.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {View,Text,Image,Font,Document}from'@react-pdf/renderer';export{BlobProvider,Font,Image,PDFViewer,Page,Text,View,pdf,usePDF}from'@react-pdf/renderer';import {createContext,useContext}from'react';import {jsx,jsxs}from'react/jsx-runtime';import ie from'./fonts/normal/inter_black.ttf';import re from'./fonts/normal/inter_bold.ttf';import ne from'./fonts/normal/inter_extraBold.ttf';import oe from'./fonts/normal/inter_extraLight.ttf';import se from'./fonts/normal/inter_light.ttf';import le from'./fonts/normal/inter_medium.ttf';import ae from'./fonts/normal/inter_normal.ttf';import ce from'./fonts/normal/inter_semiBold.ttf';import me from'./fonts/normal/inter_thin.ttf';import de from'./fonts/italic/inter_black.ttf';import fe from'./fonts/italic/inter_bold.ttf';import pe from'./fonts/italic/inter_extraBold.ttf';import ge from'./fonts/italic/inter_extraLight.ttf';import ue from'./fonts/italic/inter_light.ttf';import ye from'./fonts/italic/inter_medium.ttf';import Se from'./fonts/italic/inter_normal.ttf';import he from'./fonts/italic/inter_semiBold.ttf';import Be from'./fonts/italic/inter_thin.ttf';var x=(i=>(i.paper="#ffffff",i.onPaper="#28282B",i))(x||{}),b=e=>`${e*16}px`,G=e=>/^#([A-Fa-f0-9]{3,4}){1,2}$/.test(e),k=e=>parseInt(e.repeat(2/e.length),16),S=(e,t=1)=>{let i=(d,y)=>d.match(new RegExp(`.{${y}}`,"g")),n=d=>typeof d<"u"?d/255:typeof t!="number"||t<0||t>1?1:t;if(!G(e))throw new Error(`Invalid HEX: ${e}`);let r=Math.floor((e.length-1)/3),o=i(e.slice(1),r),[s,c,f,u]=o.map(k);return `rgba(${s}, ${c}, ${f}, ${n(u)})`};var w=e=>e.split("").map((t,i)=>i===0?t.toUpperCase():t===t.toUpperCase()&&t!==t.toLowerCase()?` ${t}`:t).join("");var h=createContext(null);function j(e){let t=()=>e.columns.map(n=>{let r=typeof n=="object"?n:{},o={textAlign:"left",width:"100%"};return typeof n=="string"?r={name:n,...o}:["textAlign","width"].forEach(s=>{s in r&&r[s]||(r[s]=o[s]);}),r}),i=e.gap??".25rem";return jsx(h.Provider,{value:{entries:e.entries,columns:t(),rowGap:e.rowGap??i,columnGap:e.columnGap??i,padding:e.contentPadding||b(.25)},children:jsx(View,{style:{width:e.width||"100%",padding:e.padding},children:e.children})})}function _(e){let t=useContext(h);return jsx(View,{style:{width:"100%",flexDirection:"row",fontWeight:e.fontWeight,color:e.color||S("#28282B",.5),backgroundColor:S("#28282B",.1),fontSize:e.fontSize||".55rem",borderRadius:e.borderRadius??".25rem",padding:e.padding??t.padding,columnGap:t.columnGap},children:t.columns.map(i=>jsx(Text,{style:{width:i.width,textAlign:i.textAlign,overflow:"hidden"},children:e.formatColName?.(i.name)||w(i.name)},i.name))})}function $(e){let t=useContext(h);return jsx(View,{style:{width:"100%",padding:e.padding||t.padding,rowGap:e.rowGap??t.rowGap,marginTop:e.marginTop,marginBottom:e.marginBottom},children:t.entries.map((i,n)=>jsx(View,{style:{flexDirection:"row",fontSize:e.fontSize||".5rem",...e.styleRow?.(n,t.entries)||{},alignItems:"center",width:"100%",overflow:"hidden",columnGap:t.columnGap},children:t.columns.map((r,o)=>jsx(Text,{style:{textAlign:r.textAlign,opacity:r.opacity??1,...e.styleCell?.({cellIndex:t.columns.length*n+o,rowIndex:n,columnName:r.name,siblingData:{previous:i?.[t.columns[o-1]?.name||""]||null,next:i?.[t.columns[o+1]?.name||""]||null},data:i?.[r.name]})||{},width:r.width},children:i?.[r.name]||r.placeholder||"-"},r.name+o))}))})}var Ee={Root:j,Header:_,Body:$};var g=e=>{let{fullWidth:t,fullHeight:i,height:n,width:r,backgroundColor:o,color:s,fontWeight:c,fontSize:f,gap:u,halfFade:d,quarterFade:y,opacity:L,flex:A,corners:z,padding:R}=e,P="auto";return {width:t?"100%":r||P,height:i?"100%":n||P,backgroundColor:o,color:s,fontWeight:c,fontSize:f,gap:u,flex:A,padding:R,borderRadius:z,opacity:d?.5:y?.25:L}};var H=e=>{let{underline:t,lineThrough:i,upperFirst:n,uppercase:r,lowercase:o,caps:s,bold:c}=e;return {...g(e),fontWeight:c&&"bold",textDecoration:t&&i?"underline line-through":t?"underline":i?"line-through":"none",textTransform:n?"upperfirst":r?"uppercase":o?"lowercase":s?"capitalize":"none"}},T=H;var q=T;function B(e){let t=()=>e.text||e.children;return jsx(Text,{style:[q({...e}),e.style],children:jsx(t,{})})}var U=e=>{let{row:t,stretch:i,alignCenter:n,alignEnd:r,justifyCenter:o,justifySpaceBetween:s,justifySpaceEvenly:c,justifyEnd:f}=e;return {...g(e),flexDirection:t?"row":"column",alignItems:i?"stretch":n?"center":r?"flex-end":"flex-start",justifyContent:o?"center":f?"flex-end":s?"space-between":c?"space-evenly":"flex-start"}},C=U;var X=C;function O(e){let t=Array.isArray(e.style)?e.style:[e.style];return jsx(View,{style:[X({...e}),...t],children:e.children})}var M=e=>{let{size:t,padding:i,backgroundColor:n,objectFit:r,circle:o,corners:s}=e;return {height:t,width:t,borderRadius:o?t:s,padding:i||(o?1:0),backgroundColor:n,objectFit:r}},E=M;var Q=E;function mt(e){return jsx(Image,{src:{uri:e.src,method:"GET",headers:{"Cache-Control":"no-cache"}},style:[Q(e),e.style]})}function yt(e){return jsxs(O,{...e,children:[jsx(B,{...e.slotProps?.primary?.quickStyle,fontSize:e.primaryFontSize,text:e.primary,style:e.slotProps?.primary?.style}),e.secondary&&jsx(B,{...e.slotProps?.secondary?.quickStyle,halfFade:true,fontSize:e.secondaryFontSize||12,text:e.secondary,style:e.slotProps?.secondary?.style})]})}function Pe(e){let t=Array.isArray(e.style)?e.style:e.style?[e.style]:[],i="Inter";return Font.register({family:i,fonts:[{src:ae},{src:me,fontWeight:"thin"},{src:se,fontWeight:"light"},{src:oe,fontWeight:"ultralight"},{src:le,fontWeight:"medium"},{src:ce,fontWeight:"semibold"},{src:re,fontWeight:"bold"},{src:ne,fontWeight:"ultrabold"},{src:ie,fontWeight:"heavy"},{src:Se,fontStyle:"italic"},{src:Be,fontStyle:"italic",fontWeight:"thin"},{src:ue,fontStyle:"italic",fontWeight:"light"},{src:ge,fontStyle:"italic",fontWeight:"ultralight"},{src:ye,fontStyle:"italic",fontWeight:"medium"},{src:he,fontStyle:"italic",fontWeight:"semibold"},{src:fe,fontStyle:"italic",fontWeight:"bold"},{src:pe,fontStyle:"italic",fontWeight:"ultrabold"},{src:de,fontStyle:"italic",fontWeight:"heavy"}]}),jsx(Document,{...e,style:[{fontFamily:i},...t],children:e.children})}export{mt as BasicImage,yt as BasicPDFListItem,B as BasicText,O as BasicView,x as ColorResources,Pe as Document,Ee as TableView,S as hexToRgba,b as remAsPx};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavy/react-pdf",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
"type": "module",
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@types/react": "^19.2.7",
|
|
16
|
-
"@wavy/types": "^0.0.51",
|
|
17
16
|
"react": "^19.2.1",
|
|
18
17
|
"tsup": "^8.5.1",
|
|
19
18
|
"typescript": "^5.9.3"
|
|
20
19
|
},
|
|
21
20
|
"dependencies": {
|
|
22
|
-
"@react-pdf/renderer": "^4.3.1"
|
|
23
|
-
"@wavy/fn": "^0.0.20"
|
|
21
|
+
"@react-pdf/renderer": "^4.3.1"
|
|
24
22
|
}
|
|
25
23
|
}
|