@paprize/react 0.0.2
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/README.md +5 -0
- package/dist/paprize-react.d.ts +247 -0
- package/dist/paprize-react.js +2022 -0
- package/dist/paprize-react.umd.cjs +55 -0
- package/package.json +72 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
(function(y,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],_):(y=typeof globalThis<"u"?globalThis:y||self,_(y.paprize_react={},y.jsxRuntime,y.React,y.ReactDOM))})(this,(function(y,_,v,at){"use strict";function ie(e){v.useInsertionEffect(()=>{const t=document.createElement("style");return t.textContent=e,document.head.appendChild(t),()=>t.remove()},[e])}const lt=`
|
|
2
|
+
:root {
|
|
3
|
+
--paprize-page-background-color: #ffffff;
|
|
4
|
+
--paprize-page-margin-bottom: 10px;
|
|
5
|
+
--paprize-page-box-shadow: rgb(142 138 138) -1px 3px 5px 2px;
|
|
6
|
+
--paprize-section-margin-bottom: 10px;
|
|
7
|
+
--paprize-preview-background-color: rgb(218 220 224);
|
|
8
|
+
--paprize-preview-padding: 30px 10px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
body {
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media screen {
|
|
16
|
+
.paprize-preview {
|
|
17
|
+
min-height: 100vh;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
align-items: center;
|
|
21
|
+
background-color: var(--paprize-preview-background-color);
|
|
22
|
+
padding: var(--paprize-preview-padding);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.paprize-page {
|
|
26
|
+
box-shadow: var(--paprize-page-box-shadow);
|
|
27
|
+
margin-bottom: var(--paprize-page-margin-bottom);
|
|
28
|
+
background-color: var(--paprize-page-background-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.paprize-section {
|
|
32
|
+
margin-bottom: var(--paprize-section-margin-bottom);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;function ct({children:e}){return ie(lt),_.jsx("div",{className:"paprize-preview",children:e})}const O={};function Ne(e,t){return e.unstable_is?e.unstable_is(t):t===e}function Ae(e){return"init"in e}function re(e){return!!e.write}function xe(e){return"v"in e||"e"in e}function Y(e){if("e"in e)throw e.e;if((O?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}const Z=new WeakMap;function Te(e){var t;return K(e)&&!!((t=Z.get(e))!=null&&t[0])}function ut(e){const t=Z.get(e);t?.[0]&&(t[0]=!1,t[1].forEach(n=>n()))}function se(e,t){let n=Z.get(e);if(!n){n=[!0,new Set],Z.set(e,n);const o=()=>{n[0]=!1};e.then(o,o)}n[1].add(t)}function K(e){return typeof e?.then=="function"}function Le(e,t,n){if(!n.p.has(e)){n.p.add(e);const o=()=>n.p.delete(e);t.then(o,o)}}function Ie(e,t,n){var o;const i=new Set;for(const r of((o=n.get(e))==null?void 0:o.t)||[])n.has(r)&&i.add(r);for(const r of t.p)i.add(r);return i}const dt=(e,t,...n)=>t.read(...n),ft=(e,t,...n)=>t.write(...n),pt=(e,t)=>{var n;return(n=t.unstable_onInit)==null?void 0:n.call(t,e)},gt=(e,t,n)=>{var o;return(o=t.onMount)==null?void 0:o.call(t,n)},ht=(e,t)=>{const n=A(e),o=n[0],i=n[9];if((O?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let r=o.get(t);return r||(r={d:new Map,p:new Set,n:0},o.set(t,r),i?.(e,t)),r},mt=e=>{const t=A(e),n=t[1],o=t[3],i=t[4],r=t[5],s=t[6],f=t[13],h=[],d=c=>{try{c()}catch(g){h.push(g)}};do{s.f&&d(s.f);const c=new Set,g=c.add.bind(c);o.forEach(S=>{var m;return(m=n.get(S))==null?void 0:m.l.forEach(g)}),o.clear(),r.forEach(g),r.clear(),i.forEach(g),i.clear(),c.forEach(d),o.size&&f(e)}while(o.size||r.size||i.size);if(h.length)throw new AggregateError(h)},vt=e=>{const t=A(e),n=t[1],o=t[2],i=t[3],r=t[11],s=t[14],f=t[17],h=[],d=new WeakSet,c=new WeakSet,g=Array.from(i);for(;g.length;){const S=g[g.length-1],m=r(e,S);if(c.has(S)){g.pop();continue}if(d.has(S)){if(o.get(S)===m.n)h.push([S,m]);else if((O?"production":void 0)!=="production"&&o.has(S))throw new Error("[Bug] invalidated atom exists");c.add(S),g.pop();continue}d.add(S);for(const b of Ie(S,m,n))d.has(b)||g.push(b)}for(let S=h.length-1;S>=0;--S){const[m,b]=h[S];let a=!1;for(const u of b.d.keys())if(u!==m&&i.has(u)){a=!0;break}a&&(s(e,m),f(e,m)),o.delete(m)}},St=(e,t)=>{var n;const o=A(e),i=o[1],r=o[2],s=o[3],f=o[6],h=o[7],d=o[11],c=o[12],g=o[13],S=o[14],m=o[16],b=o[17],a=d(e,t);if(xe(a)&&(i.has(t)&&r.get(t)!==a.n||Array.from(a.d).every(([E,I])=>S(e,E).n===I)))return a;a.d.clear();let u=!0;function l(){i.has(t)&&(b(e,t),g(e),c(e))}function C(E){var I;if(Ne(t,E)){const F=d(e,E);if(!xe(F))if(Ae(E))X(e,E,E.init);else throw new Error("no atom init");return Y(F)}const T=S(e,E);try{return Y(T)}finally{a.d.set(E,T.n),Te(a.v)&&Le(t,a.v,T),(I=i.get(E))==null||I.t.add(t),u||l()}}let N,P;const k={get signal(){return N||(N=new AbortController),N.signal},get setSelf(){return(O?"production":void 0)!=="production"&&!re(t)&&console.warn("setSelf function cannot be used with read-only atom"),!P&&re(t)&&(P=(...E)=>{if((O?"production":void 0)!=="production"&&u&&console.warn("setSelf function cannot be called in sync"),!u)try{return m(e,t,...E)}finally{g(e),c(e)}}),P}},V=a.n;try{const E=h(e,t,C,k);return X(e,t,E),K(E)&&(se(E,()=>N?.abort()),E.then(l,l)),a}catch(E){return delete a.v,a.e=E,++a.n,a}finally{u=!1,V!==a.n&&r.get(t)===V&&(r.set(t,a.n),s.add(t),(n=f.c)==null||n.call(f,t))}},_t=(e,t)=>{const n=A(e),o=n[1],i=n[2],r=n[11],s=[t];for(;s.length;){const f=s.pop(),h=r(e,f);for(const d of Ie(f,h,o)){const c=r(e,d);i.set(d,c.n),s.push(d)}}},Fe=(e,t,...n)=>{const o=A(e),i=o[3],r=o[6],s=o[8],f=o[11],h=o[12],d=o[13],c=o[14],g=o[15],S=o[17];let m=!0;const b=u=>Y(c(e,u)),a=(u,...l)=>{var C;const N=f(e,u);try{if(Ne(t,u)){if(!Ae(u))throw new Error("atom not writable");const P=N.n,k=l[0];X(e,u,k),S(e,u),P!==N.n&&(i.add(u),(C=r.c)==null||C.call(r,u),g(e,u));return}else return Fe(e,u,...l)}finally{m||(d(e),h(e))}};try{return s(e,t,b,a,...n)}finally{m=!1}},wt=(e,t)=>{var n;const o=A(e),i=o[1],r=o[3],s=o[6],f=o[11],h=o[15],d=o[18],c=o[19],g=f(e,t),S=i.get(t);if(S&&!Te(g.v)){for(const[m,b]of g.d)if(!S.d.has(m)){const a=f(e,m);d(e,m).t.add(t),S.d.add(m),b!==a.n&&(r.add(m),(n=s.c)==null||n.call(s,m),h(e,m))}for(const m of S.d||[])if(!g.d.has(m)){S.d.delete(m);const b=c(e,m);b?.t.delete(t)}}},ze=(e,t)=>{var n;const o=A(e),i=o[1],r=o[4],s=o[6],f=o[10],h=o[11],d=o[12],c=o[13],g=o[14],S=o[16],m=h(e,t);let b=i.get(t);if(!b){g(e,t);for(const a of m.d.keys())ze(e,a).t.add(t);if(b={l:new Set,d:new Set(m.d.keys()),t:new Set},i.set(t,b),(n=s.m)==null||n.call(s,t),re(t)){const a=()=>{let u=!0;const l=(...C)=>{try{return S(e,t,...C)}finally{u||(c(e),d(e))}};try{const C=f(e,t,l);C&&(b.u=()=>{u=!0;try{C()}finally{u=!1}})}finally{u=!1}};r.add(a)}}return b},yt=(e,t)=>{var n;const o=A(e),i=o[1],r=o[5],s=o[6],f=o[11],h=o[19],d=f(e,t);let c=i.get(t);if(c&&!c.l.size&&!Array.from(c.t).some(g=>{var S;return(S=i.get(g))==null?void 0:S.d.has(t)})){c.u&&r.add(c.u),c=void 0,i.delete(t),(n=s.u)==null||n.call(s,t);for(const g of d.d.keys()){const S=h(e,g);S?.t.delete(t)}return}return c},X=(e,t,n)=>{const o=A(e)[11],i=o(e,t),r="v"in i,s=i.v;if(K(n))for(const f of i.d.keys())Le(t,n,o(e,f));i.v=n,delete i.e,(!r||!Object.is(s,i.v))&&(++i.n,K(s)&&ut(s))},bt=(e,t)=>{const n=A(e)[14];return Y(n(e,t))},kt=(e,t,...n)=>{const o=A(e),i=o[12],r=o[13],s=o[16];try{return s(e,t,...n)}finally{r(e),i(e)}},Et=(e,t,n)=>{const o=A(e),i=o[12],r=o[18],s=o[19],h=r(e,t).l;return h.add(n),i(e),()=>{h.delete(n),s(e,t),i(e)}},Be=new WeakMap;function A(e){const t=Be.get(e);if((O?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t}function Ct(...e){const t={get(o){const i=A(t)[21];return i(t,o)},set(o,...i){const r=A(t)[22];return r(t,o,...i)},sub(o,i){const r=A(t)[23];return r(t,o,i)}},n=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},dt,ft,pt,gt,ht,mt,vt,St,_t,Fe,wt,ze,yt,X,bt,kt,Et].map((o,i)=>e[i]||o);return Be.set(t,Object.freeze(n)),t}const Oe={};let Pt=0;function U(e,t){const n=`atom${++Pt}`,o={toString(){return(Oe?"production":void 0)!=="production"&&this.debugLabel?n+":"+this.debugLabel:n}};return typeof e=="function"?o.read=e:(o.init=e,o.read=Nt,o.write=At),t&&(o.write=t),o}function Nt(e){return e(this)}function At(e,t,n){return t(this,typeof n=="function"?n(e(this)):n)}function ae(){return Ct()}let R;function xt(){return R||(R=ae(),(Oe?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=R),globalThis.__JOTAI_DEFAULT_STORE__!==R&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),R}const Tt={},Me=v.createContext(void 0);function De(e){return v.useContext(Me)||xt()}function Lt({children:e,store:t}){const n=v.useRef(void 0);return!t&&!n.current&&(n.current=ae()),v.createElement(Me.Provider,{value:t||n.current},e)}const le=e=>typeof e?.then=="function",ce=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},It=v.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(ce(e),e)}),ue=new WeakMap,He=(e,t)=>{let n=ue.get(e);return n||(n=new Promise((o,i)=>{let r=e;const s=d=>c=>{r===d&&o(c)},f=d=>c=>{r===d&&i(c)},h=()=>{try{const d=t();le(d)?(ue.set(d,n),r=d,d.then(s(d),f(d)),se(d,h)):o(d)}catch(d){i(d)}};e.then(s(e),f(e)),se(e,h)}),ue.set(e,n)),n};function Q(e,t){const{delay:n,unstable_promiseStatus:o=!v.use}={},i=De(),[[r,s,f],h]=v.useReducer(c=>{const g=i.get(e);return Object.is(c[0],g)&&c[1]===i&&c[2]===e?c:[g,i,e]},void 0,()=>[i.get(e),i,e]);let d=r;if((s!==i||f!==e)&&(h(),d=i.get(e)),v.useEffect(()=>{const c=i.sub(e,()=>{if(o)try{const g=i.get(e);le(g)&&ce(He(g,()=>i.get(e)))}catch{}if(typeof n=="number"){setTimeout(h,n);return}h()});return h(),c},[i,e,n,o]),v.useDebugValue(d),le(d)){const c=He(d,()=>i.get(e));return o&&ce(c),It(c)}return d}function de(e,t){const n=De();return v.useCallback((...i)=>{if((Tt?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return n.set(e,...i)},[n,e])}const Ft="__PAPRIZE_IS_READY",zt="__PAPRIZE_READ_JSON_DATA_FILE",Bt=ae(),Ot={totalPages:0,isPaginated:!1,pendingSuspensions:new Set},M=U(new Map);M.debugLabel="sectionsAtom";const fe=U({totalSections:0,isPaginated:!1});fe.debugLabel="reportAtom";function Mt(){const e=de(fe),t=Q(M);return v.useEffect(()=>{const n=t.size,o=Array.from(t.values()).every(i=>i.isPaginated);window[Ft]=o,e({isPaginated:o&&n>0,totalSections:n})},[t,e]),null}const Dt=`
|
|
36
|
+
html {
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
*,
|
|
41
|
+
*:before,
|
|
42
|
+
*:after {
|
|
43
|
+
box-sizing: inherit;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.paprize-page-component {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
}
|
|
50
|
+
`;function Ht({children:e}){return ie(Dt),_.jsxs(Lt,{store:Bt,children:[e,_.jsx(Mt,{})]})}function pe({children:e}){return _.jsx(_.Fragment,{children:e})}function ge({children:e}){return _.jsx(_.Fragment,{children:e})}function he({children:e}){return _.jsx(_.Fragment,{children:e})}function me({children:e}){return _.jsx(_.Fragment,{children:e})}function ve({children:e}){return _.jsx(_.Fragment,{children:e})}function $e({children:e}){return _.jsx(_.Fragment,{children:e})}function $t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee={exports:{}},Wt=ee.exports,We;function Vt(){return We||(We=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Wt,function(){var t=function(){},n="undefined",o=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function f(a,u){var l=a[u];if(typeof l.bind=="function")return l.bind(a);try{return Function.prototype.bind.call(l,a)}catch{return function(){return Function.prototype.apply.apply(l,[a,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function d(a){return a==="debug"&&(a="log"),typeof console===n?!1:a==="trace"&&o?h:console[a]!==void 0?f(console,a):console.log!==void 0?f(console,"log"):t}function c(){for(var a=this.getLevel(),u=0;u<i.length;u++){var l=i[u];this[l]=u<a?t:this.methodFactory(l,a,this.name)}if(this.log=this.debug,typeof console===n&&a<this.levels.SILENT)return"No console available for logging"}function g(a){return function(){typeof console!==n&&(c.call(this),this[a].apply(this,arguments))}}function S(a,u,l){return d(a)||g.apply(this,arguments)}function m(a,u){var l=this,C,N,P,k="loglevel";typeof a=="string"?k+=":"+a:typeof a=="symbol"&&(k=void 0);function V(p){var w=(i[p]||"silent").toUpperCase();if(!(typeof window===n||!k)){try{window.localStorage[k]=w;return}catch{}try{window.document.cookie=encodeURIComponent(k)+"="+w+";"}catch{}}}function E(){var p;if(!(typeof window===n||!k)){try{p=window.localStorage[k]}catch{}if(typeof p===n)try{var w=window.document.cookie,B=encodeURIComponent(k),q=w.indexOf(B+"=");q!==-1&&(p=/^([^;]+)/.exec(w.slice(q+B.length+1))[1])}catch{}return l.levels[p]===void 0&&(p=void 0),p}}function I(){if(!(typeof window===n||!k)){try{window.localStorage.removeItem(k)}catch{}try{window.document.cookie=encodeURIComponent(k)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function T(p){var w=p;if(typeof w=="string"&&l.levels[w.toUpperCase()]!==void 0&&(w=l.levels[w.toUpperCase()]),typeof w=="number"&&w>=0&&w<=l.levels.SILENT)return w;throw new TypeError("log.setLevel() called with invalid level: "+p)}l.name=a,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=u||S,l.getLevel=function(){return P??N??C},l.setLevel=function(p,w){return P=T(p),w!==!1&&V(P),c.call(l)},l.setDefaultLevel=function(p){N=T(p),E()||l.setLevel(p,!1)},l.resetLevel=function(){P=null,I(),c.call(l)},l.enableAll=function(p){l.setLevel(l.levels.TRACE,p)},l.disableAll=function(p){l.setLevel(l.levels.SILENT,p)},l.rebuild=function(){if(s!==l&&(C=T(s.getLevel())),c.call(l),s===l)for(var p in r)r[p].rebuild()},C=T(s?s.getLevel():"WARN");var F=E();F!=null&&(P=T(F)),c.call(l)}s=new m,s.getLogger=function(u){if(typeof u!="symbol"&&typeof u!="string"||u==="")throw new TypeError("You must supply a name when creating a logger.");var l=r[u];return l||(l=r[u]=new m(u,s.methodFactory)),l};var b=typeof window!==n?window.log:void 0;return s.noConflict=function(){return typeof window!==n&&window.log===s&&(window.log=b),s},s.getLoggers=function(){return r},s.default=s,s})})(ee)),ee.exports}var Ut=Vt();const z=$t(Ut),Ve=[pe,he,ge,$e,ve,me];function Rt(e){let t=null;const n={};if(v.Children.forEach(e,o=>{if(!v.isValidElement(o))throw z.error("Invalid React element found in children",{child:o}),new Error("Invalid React element found in children");const i=Ve.find(r=>r===o.type);if(!i)throw Error(`Component "${o.type}" is not valid as a child for Section, Expected one of: ${Ve.map(r=>r.name).join(",")}`);switch(i){case ve:n.sectionHeader=o;break;case me:n.sectionFooter=o;break;case pe:t=o;break;case he:n.header=o;break;case ge:n.footer=o;break;case $e:n.overlay=o;break}}),!t)throw Error("PageContent component is a required child for Section");return{...n,content:t}}function jt(e,t){return t==="landscape"?{height:e.width,width:e.height}:e}function Jt(e,t){return`@page section-${e} {
|
|
51
|
+
margin: none;
|
|
52
|
+
size:${t.width} ${t.height};
|
|
53
|
+
width:${t.width};
|
|
54
|
+
height:${t.height};
|
|
55
|
+
}`}const Gt="paprize",Ue="pz-temp-container",Re="data-pz-";function je(e){return e.nodeType===Node.ELEMENT_NODE}function qt(e){return e.nodeType===Node.TEXT_NODE}function te(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),o=parseFloat(n.marginTop)||0,i=parseFloat(n.marginBottom)||0;return t.height+o+i}function Yt(e){e.style.visibility="hidden",e.style.position="absolute",e.style.left="-9999px",e.style.top="-9999px"}class D{name;defaultValue;_reader;constructor(t,n,o){this.name=t,this._reader=n,this.defaultValue=o}read(t){return this._reader(t)}static createStr(t,n){return new D(t,o=>o,n)}static createBool(t,n){return new D(t,o=>o==="true",n)}}const ne={hyphen:D.createStr("hyphen","-"),keepOnSamePage:D.createBool("keep-on-same-page",!1),hyphenationEnabled:D.createBool("hyphenation-enabled",!0)};function Zt(e){const t={};for(const n in e){const o=e[n];if(o!==void 0){const i=ne[n];t[`${Re}${i.name}`]=String(o)}}return t}const Kt=Object.fromEntries(Object.entries(ne).map(([e,t])=>[e,t.defaultValue])),Je=new WeakMap;function Ge(e){if(!e)return{};if(!(e instanceof Element))return Ge(e?.parentNode);const t={};for(const i in ne){const r=ne[i],s=`${Re}${r.name}`,f=e.getAttribute(s);f!==null&&(t[i]=r.read(f))}const o={...e.parentNode?Je.get(e.parentNode):void 0,...t};return Je.set(e,o),o}const qe={plugins:[],...Kt};function Xt(e,t){const n=Ge(e);return{...qe,...t,...n}}const x=z.getLogger(Gt);x.setDefaultLevel("info");const Se="\x1B[46mPLUGIN\x1B[0m";function H(e,t,...n){e.forEach(o=>{const i=o[t];if(i){x.debug(Se,`executing plugin ${o.name}:${String(t)}`,n);try{i(...n),x.debug(Se,`plugin ${o.name}:${String(t)} executed`,n)}catch(r){x.debug(Se,`plugin ${o.name}:${String(t)} failed`,r)}}})}const $={Element:"element",Text:"text"};class _e{_node;_transaction;type=$.Element;config;constructor(t,n,o){this._node=t,this._transaction=n,this.config=o}appendChild(t){this._transaction.isActive&&this._transaction.addRollbackCallback(()=>{this._node.removeChild(t.getNode())}),this._node.appendChild(t.getNode())}clone(t){const n=this._node.cloneNode(t),o=new _e(n,this._transaction,this.config);return H(this.config.plugins,"onClone",this._node,o),o}getHeight(){return te(this._node)}remove(){this._transaction.addCommitCallback(()=>{this._node.remove()})}isEmpty(){return this._node.innerHTML===""}getChildrenCount(){return this._node.childNodes.length}getNode(){return this._node}}class Qt{_node;_transaction;type=$.Text;config;constructor(t,n,o){this._node=t,this._transaction=n,this.config=o}get textContent(){return this._node.textContent??""}set textContent(t){this._node.textContent=t}remove(){this._transaction.addCommitCallback(()=>{this._node.remove()})}getNode(){return this._node}}function we(e,t,n){if(qt(e))return new Qt(e,t,n);if(je(e))return new _e(e,t,n);throw new Error("Unsupported node type")}function On(e){}function Mn(e){}function Dn(e){}const j="\x1B[106mDOM\x1B[0m";class en{_transaction;_treeWalker;_config;_completed=!1;_currentNode=null;_previousNode=null;constructor(t,n,o){this._transaction=n,this._config=o,this._treeWalker=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT)}get completed(){return this._completed}get currentNode(){return this._currentNode}get previousNode(){return this._previousNode}nextNode(){this._treeWalker.nextNode()||(this._completed=!0),x.debug(j,"moving to next node"),this.setState()}nextSiblingOrParentSibling(){let t=0;if(this._treeWalker.nextSibling())return x.debug(j,"moving to next sibling node"),this.setState(),{parentsTraversed:t};for(;this._treeWalker.parentNode();)if(t++,this._treeWalker.nextSibling())return x.debug(j,"moving to parent sibling node, traversed:",t),this.setState(),{parentsTraversed:t};return this._completed=!0,{parentsTraversed:t}}firstChildOrNextNode(){return this._treeWalker.firstChild()?(x.debug(j,"moving to first child node"),this.setState(),{parentsTraversed:1}):(this.nextNode(),{parentsTraversed:0})}setState(){this._previousNode=this._currentNode,this._currentNode=we(this._treeWalker.currentNode,this._transaction,Xt(this._treeWalker.currentNode,this._config)),this.currentNode,this.previousNode,x.debug(j,"moved to node",{currentNode:this.currentNode,previousNode:this.previousNode})}}class tn{_onRollback;_onCommit;isActive;constructor(){this._onRollback=[],this._onCommit=[],this.isActive=!1}start=()=>{if(this.isActive)throw new Error("Transaction already in progress");this.isActive=!0,this._onRollback=[],this._onCommit=[]};addRollbackCallback=t=>{this._onRollback.push(t)};addCommitCallback=t=>{if(!this.isActive){t();return}this._onCommit.push(t)};rollback=()=>{this.isActive&&(this.isActive=!1,this._onRollback.forEach(t=>t()))};commit=()=>{this.isActive&&(this.isActive=!1,this._onCommit.forEach(t=>t()))}}const Ye="\x1B[102mPAGE\x1B[0m";class J{currentPage;activeElement;currentElement;parentStack;pageIsFull;pageIndex;pageHeight;constructor(t,n,o,i,r,s,f){this.currentPage=t,this.activeElement=n,this.currentElement=o,this.parentStack=i,this.pageIsFull=r,this.pageIndex=s,this.pageHeight=f}static create(t,n,o,i){return new J(t,null,t,n,!1,o,i)}clone=()=>new J(this.currentPage,this.activeElement,this.currentElement,[...this.parentStack],this.pageIsFull,this.pageIndex,this.pageHeight)}class ye{_pageState;_transaction;_tempContainer;_config;constructor(t,n,o,i){this._tempContainer=t,this._config=i,this._transaction=o;const r=ye.createPageHtmlElement(n.width),s=this.createNewPage(r);this._pageState=J.create(s,[],0,n.height),H(this._config.plugins,"onNewPage",this._pageState)}nextPage(){const t=this.createNewPage(this._pageState.currentPage.getNode().cloneNode(!1)),n=J.create(t,[],this._pageState.pageIndex+1,this._pageState.pageHeight);this.cloneParentStackToNewPage(n),this.cleanupEmptyParent(),this._pageState=n,H(this._config.plugins,"onNewPage",this._pageState)}cloneParentStackToNewPage(t){for(const n of this._pageState.parentStack){const o=n.clone(!1);t.currentElement.appendChild(o),t.currentElement=o,t.parentStack.push(o)}}cleanupEmptyParent(){const t=[...this._pageState.parentStack],n=()=>{for(let o=t.length-1;o>=0;o--){const i=t[o];i.isEmpty()&&i.remove()}};this._transaction.addCommitCallback(n)}enterElement(){if(!this._pageState.activeElement||this._pageState.activeElement.type!==$.Element)throw new Error("Invalid state: activeElement is not an Element");x.debug(Ye,"entering an element",this._pageState.activeElement),this._pageState.currentElement=this._pageState.activeElement,this._pageState.parentStack.push(this._pageState.activeElement)}leaveElement(){this._pageState.activeElement=null;const t=this._pageState.parentStack.pop();x.debug(Ye,"leaving a parent element",t);const n=this._pageState.parentStack.at(-1);this._pageState.currentElement=n??this._pageState.currentPage}static createPageHtmlElement(t){const n=document.createElement("div");return n.style.display="flex",n.style.flexDirection="column",n.style.width=`${t}px`,n.style.maxWidth=`${t}px`,n}createNewPage(t){return this._tempContainer.appendChild(t),this._transaction.isActive&&this._transaction.addRollbackCallback(()=>{this._tempContainer.removeChild(t)}),we(t,this._transaction,this._config)}startTransaction(){this._transaction.start();const t=this._pageState.clone();return this._transaction.addRollbackCallback(()=>{this._pageState=t}),this._transaction}hasEmptySpace(t){return!this._pageState.pageIsFull&&this._pageState.currentPage.getHeight()+(t||1)<=this._pageState.pageHeight}isOverFlow(){return this._pageState.currentPage.getHeight()>this._pageState.pageHeight}markPageAsFull(){this._pageState.pageIsFull=!0}appendChild(t,n){const o=t.clone(n);return this._pageState.currentElement.appendChild(o),this._pageState.activeElement=o,o}addTextNode(t){if(this._pageState.activeElement?.type===$.Text)return this._pageState.activeElement;const n=document.createTextNode(t),o=we(n,this._transaction,this._config);return this._pageState.currentElement.appendChild(o),this._pageState.activeElement=o,o}}const L={None:0,FullNodePlaced:1,SplitChildren:2};function nn(e,t){const n=Ze(e,t);if(n!==L.None)return n;const{rollback:o,commit:i}=t.startTransaction();t.nextPage();const r=Ze(e,t);return r!==L.None?(i(),r):(o(),x.debug("Element is too big to fit on a page",e),L.None)}function Ze(e,t){if(t.hasEmptySpace(e.getHeight())){const o=t.appendChild(e,!0);if(t.isOverFlow())o.remove();else return L.FullNodePlaced}if(e.config.keepOnSamePage||e.getChildrenCount()===0)return L.None;const n=t.appendChild(e,!1);return t.isOverFlow()?(n.remove(),L.None):L.SplitChildren}function on(e,t){let n=L.FullNodePlaced;const o=e.textContent.split(/(\s+)/).filter(s=>s!=="");let i,r=0;for(;i||r<o.length;){const s=i??o[r],f=rn(s,t,e.config);f.completed||(n=L.None),f.pendingToken?i=f.pendingToken:(i=void 0,r++)}return n}function rn(e,t,n){t.hasEmptySpace()||t.nextPage();let o=t.addTextNode("");const i=o.textContent;if(o.textContent+=e,!t.isOverFlow())return{completed:!0};o.textContent=i;const r=sn(e,t,n);return{pendingToken:r.leftovers,completed:r.completed}}function sn(e,t,n){const{rollback:o,commit:i}=t.startTransaction();if(t.nextPage(),t.addTextNode(e),!t.isOverFlow())return i(),{completed:!0};if(o(),!n.hyphenationEnabled)return x.warn("Hyphenation disabled, skipping oversized token:",e),{completed:!1};const r=an(e,n.hyphen,t);return{completed:!0,leftovers:r&&r.length>0?r:void 0}}function an(e,t,n){const o=n.addTextNode("");let i="";for(let r=0;r<e.length;r++){const s=e[r],f=i+s;if(o.textContent=f+t,!n.hasEmptySpace())return o.textContent=i?i+t:"",n.markPageAsFull(),e.slice(r);i=f}return null}const G="\x1B[103mPAGINATOR\x1B[0m";class oe{_domState;_pageManager;_transaction;_tempContainer;_config;constructor(t,n,o){this._config={...qe,...o},this._tempContainer=oe.createTempContainer(),this._transaction=new tn,this._domState=new en(t,this._transaction,this._config),this._pageManager=new ye(this._tempContainer,n,this._transaction,this._config)}static createTempContainer(){const t=document.createElement("div");return t.classList.add(Ue),Yt(t),document.body.appendChild(t),t}static paginate(t,n,o){const i=new oe(t,n,o);i.processAllNodes();const r=Array.from(i._tempContainer.childNodes).filter(s=>je(s)).map(s=>s.innerHTML);return i._tempContainer.remove(),r}processAllNodes(){this._domState.nextNode();do{switch(z.debug(G,"paginating node",this._domState.currentNode),this.processCurrentNode()){case L.None:this.handleNodeSkipped();break;case L.FullNodePlaced:this.handleFullNodePlaced();break;case L.SplitChildren:this.handleChildrenSplit();break}H(this._config.plugins,"afterVisitNode",this._domState,this._pageManager)}while(this._domState.completed===!1);z.debug(G,"pagination completed")}handleNodeSkipped(){z.debug(G,"node skipped - couldn't paginate"),this._domState.currentNode,this._domState.nextNode()}handleFullNodePlaced(){z.debug(G,"node fully paginated");const{parentsTraversed:t}=this._domState.nextSiblingOrParentSibling();for(let n=0;n<t;n++)this._pageManager.leaveElement()}handleChildrenSplit(){z.debug(G,"node partially paginated - splitting children"),this._domState.firstChildOrNextNode().parentsTraversed===1&&this._domState.previousNode?.type===$.Element&&this._pageManager.enterElement()}processCurrentNode(){if(!this._domState.currentNode)return L.None;if(this._domState.currentNode.type===$.Element){const t={};return H(this._config.plugins,"onVisitElement",this._domState,this._pageManager,t),t.result!==void 0?t.result:nn(this._domState.currentNode,this._pageManager)}else{const t={};return H(this._config.plugins,"onVisitText",this._domState,this._pageManager,t),t.result!==void 0?t.result:on(this._domState.currentNode,this._pageManager)}}}const Ke="data-pz-page-break",Xe=[{name:"pageBreak",onVisitElement:(e,t,n)=>{e.currentNode.getNode().getAttribute(Ke)==="true"&&(t.markPageAsFull(),n.result=L.FullNodePlaced)}}],Qe=v.createContext({pageNumber:0,totalPages:0});function ln(e){return e?`${e.top} ${e.right} ${e.bottom} ${e.left}`:"0"}function cn(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),o=parseFloat(n.marginLeft)||0,i=parseFloat(n.marginRight)||0;return{height:te(e),width:t.width+o+i}}function et({elements:e,dimensions:t,margin:n,pageNumber:o,totalPages:i,ref:r,sectionHeaderRef:s,sectionFooterRef:f,contentRef:h}){const d=v.useMemo(()=>({pageNumber:o,totalPages:i}),[o,i]);return _.jsx(Qe,{value:d,children:_.jsxs("div",{className:"paprize-page paprize-page-component",ref:r,style:{width:t.width,height:t.height,maxHeight:t.height,position:"relative",padding:ln(n),zIndex:1},children:[e.sectionHeader&&o==1&&_.jsx("div",{className:"paprize-page-component",ref:s,children:e.sectionHeader}),e.header&&_.jsx("div",{className:"paprize-page-component",children:e.header}),_.jsx("div",{style:{overflow:"hidden"},ref:h,children:e.content}),e.overlay&&_.jsx("div",{style:{position:"absolute",width:"100%",height:"100%",left:0,top:0},children:e.overlay}),(e.footer||e.sectionFooter)&&_.jsxs("div",{className:"paprize-page-component",style:{marginTop:"auto"},children:[e.footer&&_.jsx("div",{className:"paprize-page-component",children:e.footer}),e.sectionFooter&&o==i&&_.jsx("div",{className:"paprize-page-component",ref:f,children:e.sectionFooter})]})]})})}function un(e,t,n){const{height:o,width:i}=cn(e),r=t?te(t):0,s=n?te(n):0;return{height:o,width:i,sectionHeaderHeight:r,sectionFooterHeight:s}}function dn(e,t,n){return{name:"sectionPageHeight",afterVisitNode:(o,i)=>{!o.completed||n<=0||i.hasEmptySpace(n)||i.nextPage()},onNewPage:o=>{o.pageIndex===0?o.pageHeight=e+n:o.pageHeight=e+t+n}}}const be=v.createContext("");function fn(e,t){const n=v.useMemo(()=>U(null,(o,i,...r)=>e(o,i,...r)),[e]);return de(n)}const pn={totalPages:0,isPaginated:!1,pendingSuspensions:0},ke=()=>{const e=v.useContext(be),t=v.useMemo(()=>U(o=>{const i=o(M).get(e);return i?{totalPages:i.totalPages,isPaginated:i.isPaginated,pendingSuspensions:i.pendingSuspensions.size}:pn}),[e]),n=Q(t);return{sectionName:e,totalPages:n.totalPages}};function gn(e){return ke(),fn(n=>(n(M).get(e)?.pendingSuspensions?.size??0)>0)}const Ee=e=>{const t=v.useMemo(()=>U(()=>0,(n,o,i)=>{o(M,r=>new Map(r).set(e,i(r.get(e)??Ot)))}),[e]);return de(t)},Ce="\x1B[41mREACT\x1B[0m",tt=(e,t,n,o,i)=>e?.dimensions===n&&e?.margin===o&&e?.elements===t&&e?.config===i&&e?.elements===t;function hn(e,t,n,o){const i=v.useContext(be),r=gn(i),s=Ee(i),f=v.useRef(null),[h,d]=v.useState({results:null,isLoading:!0}),c=v.useRef(null),g=v.useRef(null),S=v.useRef(null),m=v.useRef(null);return v.useEffect(()=>{tt(f.current,e,t,n,o)||d({results:null,isLoading:!0})},[t,e,n,o]),v.useEffect(()=>{if(!c.current||!m.current||tt(f.current,e,t,n,o))return;if(r()){x.info(Ce,`Section "${i}" is suspended`);return}const{height:b,width:a,sectionFooterHeight:u,sectionHeaderHeight:l}=un(m.current,g.current,S.current),C=o?.plugins.length?o.plugins:[...Xe,dn(b,l,u)];x.debug(Ce,"Calling Paginator",{sectionName:i,height:b,width:a,sectionFooterHeight:u,sectionHeaderHeight:l,plugins:C});const N=oe.paginate(m.current,{height:b,width:a},{...o,plugins:C});x.debug(Ce,"Paginator Result",{sectionName:i,paginatorResult:N}),d({results:N,isLoading:!1}),s(P=>({...P,totalPages:N.length,isPaginated:!0})),f.current={elements:e,dimensions:t,margin:n,config:o}}),{...h,pageRef:c,sectionHeaderRef:g,sectionFooterRef:S,contentRef:m}}function mn({elements:e,dimensions:t,margin:n,config:o}){const{results:i,pageRef:r,sectionHeaderRef:s,sectionFooterRef:f,contentRef:h}=hn(e,t,n,o);if(i!==null)return _.jsx(_.Fragment,{children:i.map((c,g)=>_.jsx(et,{elements:{...e,content:_.jsx("div",{dangerouslySetInnerHTML:{__html:c}})},dimensions:t,margin:n,pageNumber:g+1,totalPages:i.length},g))});const d={visibility:"hidden",position:"absolute",left:"-9999px",top:"-9999px"};return at.createPortal(_.jsx("div",{className:Ue,style:d,children:_.jsx(et,{elements:e,dimensions:t,margin:n,pageNumber:1,totalPages:1,ref:r,sectionHeaderRef:s,sectionFooterRef:f,contentRef:h})}),document.body)}function vn({children:e,dimension:t,orientation:n="portrait",margin:o,config:i,name:r}){const s=v.useId(),f=r??s,h=Ee(f);v.useMemo(()=>{h(c=>({...c,isPaginated:!1}))},[h]);const d=v.useMemo(()=>({dimensions:jt(t,n),elements:Rt(e),margin:o,config:i}),[e,t,o,i,n]);return ie(Jt(s,d.dimensions)),_.jsx("section",{className:"paprize-section",id:`section-${f}`,style:{page:`section-${f}`},children:_.jsx(be,{value:f,children:_.jsx(mn,{elements:d.elements,dimensions:d.dimensions,margin:d.margin,config:d.config})})})}function Sn(){return _.jsx("span",{[Ke]:"true"})}function _n({children:e,...t}){return _.jsx("div",{style:{display:"contents"},...Zt(t),children:e})}const wn=()=>{const e=v.useContext(Qe);return{pageNumber:e.pageNumber,totalPages:e.totalPages}};function yn(){const e=Q(M),t=Q(fe);return v.useMemo(()=>({totalSections:t.totalSections,isPaginated:t.isPaginated,isFirstPaginationCompleted:t.totalSections>0,sections:Array.from(e.entries()).map(([n,{totalPages:o,isPaginated:i}])=>({sectionName:n,totalPages:o,isPaginated:i}))}),[t.isPaginated,t.totalSections,e])}function nt(e,t=!0){const n=v.useId(),o=Ee(e);return v.useMemo(()=>{t&&o(i=>({...i,pendingSuspensions:new Set(i.pendingSuspensions).add(n)}))},[n,o,t]),v.useMemo(()=>({release:()=>{o(i=>{const r=new Set(i.pendingSuspensions);return r.delete(n),{...i,pendingSuspensions:r}})}}),[n,o])}const bn="paprize";class W{name;defaultValue;_reader;constructor(t,n,o){this.name=t,this._reader=n,this.defaultValue=o}read(t){return this._reader(t)}static createStr(t,n){return new W(t,o=>o,n)}static createBool(t,n){return new W(t,o=>o==="true",n)}}const kn={hyphen:W.createStr("hyphen","-"),keepOnSamePage:W.createBool("keep-on-same-page",!1),hyphenationEnabled:W.createBool("hyphenation-enabled",!0)};({...Object.fromEntries(Object.entries(kn).map(([e,t])=>[e,t.defaultValue]))});function En(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pe={exports:{}},Cn=Pe.exports,ot;function Pn(){return ot||(ot=1,(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(Cn,function(){var t=function(){},n="undefined",o=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function f(a,u){var l=a[u];if(typeof l.bind=="function")return l.bind(a);try{return Function.prototype.bind.call(l,a)}catch{return function(){return Function.prototype.apply.apply(l,[a,arguments])}}}function h(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function d(a){return a==="debug"&&(a="log"),typeof console===n?!1:a==="trace"&&o?h:console[a]!==void 0?f(console,a):console.log!==void 0?f(console,"log"):t}function c(){for(var a=this.getLevel(),u=0;u<i.length;u++){var l=i[u];this[l]=u<a?t:this.methodFactory(l,a,this.name)}if(this.log=this.debug,typeof console===n&&a<this.levels.SILENT)return"No console available for logging"}function g(a){return function(){typeof console!==n&&(c.call(this),this[a].apply(this,arguments))}}function S(a,u,l){return d(a)||g.apply(this,arguments)}function m(a,u){var l=this,C,N,P,k="loglevel";typeof a=="string"?k+=":"+a:typeof a=="symbol"&&(k=void 0);function V(p){var w=(i[p]||"silent").toUpperCase();if(!(typeof window===n||!k)){try{window.localStorage[k]=w;return}catch{}try{window.document.cookie=encodeURIComponent(k)+"="+w+";"}catch{}}}function E(){var p;if(!(typeof window===n||!k)){try{p=window.localStorage[k]}catch{}if(typeof p===n)try{var w=window.document.cookie,B=encodeURIComponent(k),q=w.indexOf(B+"=");q!==-1&&(p=/^([^;]+)/.exec(w.slice(q+B.length+1))[1])}catch{}return l.levels[p]===void 0&&(p=void 0),p}}function I(){if(!(typeof window===n||!k)){try{window.localStorage.removeItem(k)}catch{}try{window.document.cookie=encodeURIComponent(k)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function T(p){var w=p;if(typeof w=="string"&&l.levels[w.toUpperCase()]!==void 0&&(w=l.levels[w.toUpperCase()]),typeof w=="number"&&w>=0&&w<=l.levels.SILENT)return w;throw new TypeError("log.setLevel() called with invalid level: "+p)}l.name=a,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=u||S,l.getLevel=function(){return P??N??C},l.setLevel=function(p,w){return P=T(p),w!==!1&&V(P),c.call(l)},l.setDefaultLevel=function(p){N=T(p),E()||l.setLevel(p,!1)},l.resetLevel=function(){P=null,I(),c.call(l)},l.enableAll=function(p){l.setLevel(l.levels.TRACE,p)},l.disableAll=function(p){l.setLevel(l.levels.SILENT,p)},l.rebuild=function(){if(s!==l&&(C=T(s.getLevel())),c.call(l),s===l)for(var p in r)r[p].rebuild()},C=T(s?s.getLevel():"WARN");var F=E();F!=null&&(P=T(F)),c.call(l)}s=new m,s.getLogger=function(a){if(typeof a!="symbol"&&typeof a!="string"||a==="")throw new TypeError("You must supply a name when creating a logger.");var u=r[a];return u||(u=r[a]=new m(a,s.methodFactory)),u};var b=typeof window!==n?window.log:void 0;return s.noConflict=function(){return typeof window!==n&&window.log===s&&(window.log=b),s},s.getLoggers=function(){return r},s.default=s,s})})(Pe)),Pe.exports}var Nn=Pn();const An=En(Nn),it=An.getLogger(bn);it.setDefaultLevel("info");function rt(e,t){const{sectionName:n}=ke(),{release:o}=nt(n),[i,r]=v.useState({state:"loading",value:t});return v.useMemo(()=>{e.then(s=>r({state:"hasData",value:s})).catch(s=>{r({state:"hasError",value:s}),it.error("Error in useSuspenseForPromise",s)})},[e]),v.useEffect(()=>{i.state!=="loading"&&o()},[i,o]),i.value}function xn(e){let t=null;return()=>(t||(t=e()),t)}const st=xn(async()=>{const e=await window[zt]?.();return e?JSON.parse(e):null});function Tn(e){return rt(st(),e)}const Ln={A1:{height:"841mm",width:"594mm"},A2:{height:"594mm",width:"420mm"},A3:{height:"420mm",width:"297mm"},A4:{height:"297mm",width:"210mm"},A5:{height:"210mm",width:"148mm"},A6:{height:"148mm",width:"105mm"},B3:{height:"500mm",width:"353mm"},B4:{height:"353mm",width:"250mm"},B5:{height:"250mm",width:"176mm"},Letter:{height:"8.5in",width:"11in"},Legal:{height:"11in",width:"8.5in"},Tabloid:{height:"11in",width:"17in"}},In={Normal:{top:"1in",right:"1in",bottom:"1in",left:"1in"},Narrow:{top:"0.4in",right:"0.6in",bottom:"0.6in",left:"0.6in"},Wide:{top:"0.5in",right:"2in",bottom:"0.5in",left:"2in"},None:{top:"0in",right:"0in",bottom:"0in",left:"0in"}},Fn=Ln,zn=In;y.Layout=_n,y.PageBreak=Sn,y.PageContent=pe,y.PageFooter=ge,y.PageHeader=he,y.ReportPreview=ct,y.ReportRoot=Ht,y.Section=vn,y.SectionFooter=me,y.SectionHeader=ve,y.defaultPlugins=Xe,y.jsonData=st,y.pageMargin=zn,y.pageSize=Fn,y.useJsonData=Tn,y.usePageInfo=wn,y.useReportInfo=yn,y.useSectionInfo=ke,y.useSectionSuspension=nt,y.useSuspenseForPromise=rt,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paprize/react",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "React library for creating professional, print-ready reports",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"main": "./dist/paprize-react.umd.cjs",
|
|
10
|
+
"module": "./dist/paprize-react.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/paprize-react.d.ts",
|
|
14
|
+
"import": "./dist/paprize-react.js",
|
|
15
|
+
"require": "./dist/paprize-core.umd.cjs"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"paper",
|
|
20
|
+
"print",
|
|
21
|
+
"report",
|
|
22
|
+
"pdf",
|
|
23
|
+
"html2pdf",
|
|
24
|
+
"react"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/PejmanNik/paprize#readme",
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/PejmanNik/paprize/issues"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/PejmanNik/paprize.git"
|
|
33
|
+
},
|
|
34
|
+
"license": "Apache-2.0",
|
|
35
|
+
"author": "PejmanNikram",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"dev": "vite",
|
|
38
|
+
"build": "tsc -b && vite build",
|
|
39
|
+
"lint": "eslint .",
|
|
40
|
+
"preview": "vite preview",
|
|
41
|
+
"prepack": "node ../../scripts/prepack.mjs"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@paprize/core": "*",
|
|
45
|
+
"@paprize/puppeteer": "*",
|
|
46
|
+
"jotai": "^2.13.1",
|
|
47
|
+
"loglevel": "^1.9.2"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": ">=17.0.0",
|
|
51
|
+
"react-dom": ">=17.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/js": "^9.30.1",
|
|
55
|
+
"@types/react": "^19.1.8",
|
|
56
|
+
"@types/react-dom": "^19.1.6",
|
|
57
|
+
"@vitejs/plugin-react-swc": "^3.10.2",
|
|
58
|
+
"eslint": "^9.30.1",
|
|
59
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
60
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
61
|
+
"globals": "^16.3.0",
|
|
62
|
+
"jotai-devtools": "^0.12.0",
|
|
63
|
+
"react": "^19.1.1",
|
|
64
|
+
"react-dom": "^19.1.1",
|
|
65
|
+
"typescript": "~5.8.3",
|
|
66
|
+
"typescript-eslint": "^8.35.1",
|
|
67
|
+
"unplugin-dts": "^1.0.0-beta.6",
|
|
68
|
+
"vite": "^7.0.4",
|
|
69
|
+
"vite-plugin-checker": "^0.10.3",
|
|
70
|
+
"vite-plugin-lib-inject-css": "^2.2.2"
|
|
71
|
+
}
|
|
72
|
+
}
|