@repdf/preview 0.3.0 → 0.3.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.
Files changed (32) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +215 -219
  3. package/dist/preview/.next/BUILD_ID +1 -1
  4. package/dist/preview/.next/build-manifest.json +3 -3
  5. package/dist/preview/.next/cache/.tsbuildinfo +1 -1
  6. package/dist/preview/.next/cache/webpack/client-production/0.pack +0 -0
  7. package/dist/preview/.next/cache/webpack/client-production/index.pack +0 -0
  8. package/dist/preview/.next/cache/webpack/edge-server-production/index.pack +0 -0
  9. package/dist/preview/.next/cache/webpack/server-production/0.pack +0 -0
  10. package/dist/preview/.next/cache/webpack/server-production/index.pack +0 -0
  11. package/dist/preview/.next/next-minimal-server.js.nft.json +1 -1
  12. package/dist/preview/.next/next-server.js.nft.json +1 -1
  13. package/dist/preview/.next/prerender-manifest.json +1 -1
  14. package/dist/preview/.next/routes-manifest.json +1 -1
  15. package/dist/preview/.next/server/chunks/900.js +1 -1
  16. package/dist/preview/.next/server/functions-config-manifest.json +1 -1
  17. package/dist/preview/.next/server/middleware-build-manifest.js +1 -1
  18. package/dist/preview/.next/server/pages/api/trpc/[trpc].js +1 -1
  19. package/dist/preview/.next/server/pages/api/trpc/[trpc].js.nft.json +1 -1
  20. package/dist/preview/.next/server/pages/en/404.html +1 -1
  21. package/dist/preview/.next/server/pages/en/500.html +1 -1
  22. package/dist/preview/.next/server/pages/en/test.html +1 -1
  23. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js +1 -1
  24. package/dist/preview/.next/server/pages/preview/[...relTemplatePath].js.nft.json +1 -1
  25. package/dist/preview/.next/server/webpack-runtime.js +1 -1
  26. package/dist/preview/.next/static/{xj9QNF1eN2zKV4_vUn8Da → 7nZIXWS8ShPv20tmMeSGr}/_buildManifest.js +1 -1
  27. package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-d13b73e31965195a.js +1 -0
  28. package/dist/preview/.next/trace +13 -12
  29. package/package.json +3 -3
  30. package/dist/preview/.next/server/chunks/870.js +0 -1
  31. package/dist/preview/.next/static/chunks/pages/preview/[...relTemplatePath]-00654ed564ac5dbe.js +0 -1
  32. /package/dist/preview/.next/static/{xj9QNF1eN2zKV4_vUn8Da → 7nZIXWS8ShPv20tmMeSGr}/_ssgManifest.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@repdf/preview",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -57,9 +57,9 @@
57
57
  "tailwind-merge": "^2.6.0",
58
58
  "webpack": "^5.95.0",
59
59
  "zod": "^3.1.11",
60
- "@repdf/tailwind-v4": "0.3.0",
60
+ "@repdf/core": "0.3.0",
61
61
  "@repdf/tailwind-v3": "0.3.0",
62
- "@repdf/core": "0.3.0"
62
+ "@repdf/tailwind-v4": "0.3.0"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@arethetypeswrong/cli": "0.16.4",
@@ -1 +0,0 @@
1
- "use strict";exports.id=870,exports.ids=[870],exports.modules={5870:(_,s,e)=>{e.d(s,{ABSOLUTE_PATH_TO_PDF_FOLDER:()=>r});let r=()=>{if(!process.env.ABSOLUTE_PATH_TO_PDF_FOLDER)throw Error("ABSOLUTE_PATH_TO_PDF_FOLDER is not set");return process.env.ABSOLUTE_PATH_TO_PDF_FOLDER}}};
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[254],{2285:function(e,r,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/preview/[...relTemplatePath]",function(){return t(8654)}])},8654:function(e,r,t){"use strict";t.r(r),t.d(r,{__N_SSP:function(){return v},default:function(){return w}});var l=t(1549),n=t(7829),a=t(4695),s=t.n(a),i=t(6370),c=t.n(i),o=t(4194),d=t(1510);function p(e){let{children:r}=e,{data:t,isLoading:n}=d.h.core.templateCheck.useQuery({relTemplatePath:"test.txt"});return(0,l.jsx)(l.Fragment,{children:r})}var h=t(7406);function u(e){let{relTemplatePath:r}=e,{data:t,isLoading:n}=d.h.core.fileContents.useQuery({relTemplatePath:r});return n?(0,l.jsx)("div",{children:"Loading..."}):t?(0,l.jsx)("div",{children:(0,l.jsx)(h.y$,{theme:h.np.shadesOfPurple,code:t,language:"tsx",children:e=>{let{className:r,style:t,tokens:n,getLineProps:a,getTokenProps:s}=e;return(0,l.jsx)("pre",{style:{...t,fontSize:"0.8rem",wordWrap:"break-word",whiteSpace:"pre-wrap",overflowWrap:"break-word",maxWidth:"100%"},children:n.map((e,r)=>(0,l.jsxs)("div",{...a({line:e}),style:{display:"flex"},children:[(0,l.jsx)("span",{style:{minWidth:"2em",userSelect:"none",opacity:.5},children:r+1}),(0,l.jsx)("span",{style:{flex:1,overflow:"hidden"},children:e.map((e,r)=>(0,l.jsx)("span",{...s({token:e}),style:{...s({token:e}).style,wordBreak:"break-all",whiteSpace:"pre-wrap"}},r))})]},r))})}})}):(0,l.jsx)("div",{children:"Error"})}function x(e){let{relTemplatePath:r,previewPropGroup:t}=e,{data:n}=d.h.core.generic.useQuery(void 0,{staleTime:1/0,initialData:new Date().toISOString()}),[a,s]=(0,o.useState)(!0),[i,c]=(0,o.useState)("/api/component?relativeTemplatePath=".concat(r,"&previewPropGroup=").concat(null!=t?t:""));return(0,o.useEffect)(()=>{n&&(s(!0),c("/api/component?relativeTemplatePath=".concat(r,"&refresh=").concat(n,"&previewPropGroup=").concat(null!=t?t:"")))},[n,r,t]),(0,l.jsxs)("div",{className:"relative h-full w-full",children:[a&&(0,l.jsx)("div",{className:"absolute inset-0 flex h-full w-full items-center justify-center bg-gray-100 bg-opacity-50",children:(0,l.jsx)("p",{children:"Rendering Component..."})}),i&&(0,l.jsx)("iframe",{src:i,className:"h-full w-full border-none",onLoad:()=>s(!1)})]})}function m(e){let{relTemplatePath:r}=e,{data:t,isLoading:n}=d.h.core.renderedHtml.useQuery({relTemplatePath:r});return n?(0,l.jsx)("div",{children:"Loading..."}):t?(0,l.jsx)("div",{children:(0,l.jsx)(h.y$,{theme:h.np.shadesOfPurple,code:t,language:"tsx",children:e=>{let{className:r,style:t,tokens:n,getLineProps:a,getTokenProps:s}=e;return(0,l.jsx)("pre",{style:{...t,fontSize:"0.8rem",wordWrap:"break-word",whiteSpace:"pre-wrap",overflowWrap:"break-word"},children:n.map((e,r)=>(0,l.jsxs)("div",{...a({line:e}),style:{display:"flex"},children:[(0,l.jsx)("span",{style:{minWidth:"2em",userSelect:"none",opacity:.5},children:r+1}),(0,l.jsx)("span",{children:e.map((e,r)=>(0,l.jsx)("span",{...s({token:e})},r))})]},r))})}})}):(0,l.jsx)("div",{children:"Error"})}function f(e){let{relTemplatePath:r,previewPropGroup:t}=e,{data:n}=d.h.core.generic.useQuery(void 0,{staleTime:1/0,initialData:new Date().toISOString()}),[a,s]=(0,o.useState)(!0),[i,c]=(0,o.useState)("/api/pdf?relativeTemplatePath=".concat(r,"&previewPropGroup=").concat(null!=t?t:""));return(0,o.useEffect)(()=>{n&&(s(!0),c("/api/pdf?relativeTemplatePath=".concat(r,"&refresh=").concat(n,"&previewPropGroup=").concat(null!=t?t:"")))},[n,r,t]),(0,l.jsxs)("div",{className:"relative h-full w-full",children:[a&&(0,l.jsx)("div",{className:"absolute inset-0 flex h-full w-full items-center justify-center bg-gray-100 bg-opacity-50",children:(0,l.jsx)("p",{children:"Rendering PDF..."})}),(0,l.jsx)("iframe",{src:i,width:"100%",height:"100%",title:"PDF Preview",onLoad:()=>s(!1)},n)]})}function g(e){let{relTemplatePath:r,previewPropGroup:t,onChangePropGroup:n}=e,{data:a}=d.h.core.templateDetails.useQuery({relTemplatePath:r},{staleTime:1/0});return a&&0!==a.previewPropChoices.length?(0,l.jsx)("select",{className:"rounded-md border border-gray-300 p-2",onChange:e=>n(parseInt(e.target.value)),value:t,children:a.previewPropChoices.map((e,r)=>(0,l.jsxs)("option",{value:r,children:["Prop Group ",r+1]},r))}):null}function j(e){let{relTemplatePath:r,absoluteTemplatePath:t}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsx)("title",{children:"Template Not Found - rePDF"})}),(0,l.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,l.jsxs)("div",{className:"max-w-lg text-center",children:[(0,l.jsx)("h1",{className:"text-2xl font-semibold text-gray-800 mb-3",children:"Template Not Found"}),(0,l.jsxs)("p",{className:"text-gray-600 mb-4",children:["No template file found at"," ",(0,l.jsx)("code",{className:"bg-gray-100 px-2 py-1 rounded text-sm break-all",children:r})]}),(0,l.jsxs)("p",{className:"text-sm text-gray-400 mb-6 break-all",children:["Looking in: ",t]}),(0,l.jsx)(c(),{href:"/",className:"inline-block rounded bg-gray-800 px-4 py-2 text-sm text-white hover:bg-gray-700",children:"Back to templates"})]})})]})}var v=!0;function w(e){let{view:r,templateName:t,relTemplatePath:a,templateExists:i,absoluteTemplatePath:c}=e,[d,h]=(0,o.useState)(r||"component"),[v,w]=(0,o.useState)();return i?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s(),{children:(0,l.jsx)("title",{children:"Preview PDF - rePDF"})}),(0,l.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,l.jsxs)("div",{className:"flex items-center justify-between bg-gray-200 p-4",children:[(0,l.jsxs)("div",{children:[(0,l.jsx)("p",{children:t}),(0,l.jsx)("p",{className:"text-sm text-gray-500",children:t!==a?a:"​"})]}),(0,l.jsx)("div",{children:(0,l.jsx)(g,{relTemplatePath:a,previewPropGroup:v,onChangePropGroup:w})}),(0,l.jsx)("div",{children:(0,l.jsxs)("ul",{className:"flex",children:[(0,l.jsx)("li",{className:(0,n.Z)("rounded-l bg-gray-300 p-2 text-sm hover:bg-gray-400 hover:text-white cursor-pointer","code"===d&&"bg-gray-400 text-white"),onClick:()=>h("code"),children:"Code"}),(0,l.jsx)("li",{className:(0,n.Z)(" bg-gray-300 p-2 text-sm hover:bg-gray-400 hover:text-white cursor-pointer","component"===d&&"bg-gray-400 text-white"),onClick:()=>h("component"),children:"Component"}),(0,l.jsx)("li",{className:(0,n.Z)(" bg-gray-300 p-2 text-sm hover:bg-gray-400 hover:text-white cursor-pointer","pdf"===d&&"bg-gray-400 text-white"),onClick:()=>h("pdf"),children:"PDF"}),(0,l.jsx)("li",{className:(0,n.Z)("rounded-r bg-gray-300 p-2 text-sm hover:bg-gray-400 hover:text-white cursor-pointer","html"===d&&"bg-gray-400 text-white"),onClick:()=>h("html"),children:"HTML"})]})})]}),(0,l.jsx)("div",{className:"flex-grow",children:(0,l.jsxs)(p,{children:["code"===d&&(0,l.jsx)(u,{relTemplatePath:a}),"component"===d&&(0,l.jsx)(x,{relTemplatePath:a,previewPropGroup:null==v?void 0:v.toString()}),"html"===d&&(0,l.jsx)(m,{relTemplatePath:a}),"pdf"===d&&(0,l.jsx)(f,{relTemplatePath:a,previewPropGroup:null==v?void 0:v.toString()})]})})]})]}):(0,l.jsx)(j,{relTemplatePath:a,absoluteTemplatePath:c})}}},function(e){e.O(0,[64,888,774,179],function(){return e(e.s=2285)}),_N_E=e.O()}]);