@e-llm-studio/citation 0.0.156 → 0.0.157

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 CHANGED
@@ -1150,6 +1150,8 @@ return <ScannedDocCitation images={images} highlights={highlights} />;
1150
1150
  | `highlights` | `PageHighlight[]` | ✅ | — | Array of highlight groups with bounding boxes per page |
1151
1151
  | `highlightColor` | `string` | ❌ | `rgba(255, 220, 0, 0.15)` | Background color of inactive highlights |
1152
1152
  | `citationLabelColor` | `string` | ❌ | `#FFFF2E` | Background color of the citation label. |
1153
+ | `subHeadingText` | `string` | ❌ | `""` | Gives you option to add a heading to ScannedDocCitation. |
1154
+ | `showFullScreenMode` | `boolean` | ❌ | `true` | Gives you option to toggle fullscreen tool in renderNav. |
1153
1155
  | `showCitationLabelOnHover` | `boolean` | ❌ | `true` | Show label only on hover (if `false` → always visible). |
1154
1156
  | `highlightActiveColor` | `string` | ❌ | `rgba(255, 220, 0, 0.35)` | Background color of the currently active highlight |
1155
1157
  | `highlightBorderColor` | `string` | ❌ | `rgba(200, 160, 0, 0.4)` | Border color of the active highlight |
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),t=require("lucide-react"),o=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(r){var s=r.images,a=r.highlights,l=r.pages,d=r.citationLabelColor,c=void 0===d?"#FFFF2E":d,u=r.showCitationLabelOnHover,p=void 0!==u&&u,x=r.highlightColor,g=void 0===x?"rgba(255, 220, 0, 0.15)":x,h=r.highlightActiveColor,f=void 0===h?"rgba(255, 220, 0, 0.35)":h,b=r.highlightBorderColor,_=void 0===b?"rgba(200, 160, 0, 0.4)":b,v=r.height,m=void 0===v?"700px":v,y=[],j=[];(null==l?void 0:l.length)?l.forEach(function(e,n){var i;e.gs_url&&y.push(e.gs_url),null===(i=e.highlighted_coordinates)||void 0===i||i.forEach(function(e){j.push({pageIndex:n,bboxes:[e]})})}):(y.push.apply(y,s||[]),j.push.apply(j,a||[]));var C=j.flatMap(function(e,n){return e.bboxes.map(function(i,t){return{bbox:i,pageIndex:e.pageIndex,key:"".concat(n,"-").concat(t)}})}).length,k=i.useState(null),w=k[0],I=k[1],R=i.useState(0),z=R[0],M=R[1],S=i.useState(!1),F=S[0],B=S[1],q=i.useState({}),L=q[0],D=q[1],E=i.useRef(null),H=i.useRef(null),O=i.useRef([]),P=i.useRef([]),T=i.useCallback(function(e,n){void 0===n&&(n=!1);var i=Math.max(0,Math.min(C-1,e));M(i),requestAnimationFrame(function(){var e=n?H.current:E.current,t=(n?P:O).current[i];if(e&&t){var o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=r.top-o.top+e.scrollTop-e.clientHeight/2+r.height/2;e.scrollTo({top:s,behavior:"smooth"})}})},[C]),A=function(i){return void 0===i&&(i=!1),C>0&&n.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:n.jsxs("div",e.__assign({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[z+1," / ",C]})),n.jsx("button",e.__assign({onClick:function(){return T(z-1,i)},disabled:z<=0,style:{padding:"2px 4px",cursor:z<=0?"not-allowed":"pointer",opacity:z<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(t.ChevronUp,{size:14,color:"#64748b"})})),n.jsx("button",e.__assign({onClick:function(){return T(z+1,i)},disabled:z>=C-1,style:{padding:"2px 4px",cursor:z>=C-1?"not-allowed":"pointer",opacity:z>=C-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n.jsx(t.ChevronDown,{size:14,color:"#64748b"})})),n.jsx("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),i?n.jsx(t.X,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return B(!1)}}):n.jsx(t.Maximize2,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return B(!0)}})]}))}))},U=function(i){void 0===i&&(i=!1);var t=i?P:O,o=-1;return y.map(function(i,r){var s=j.filter(function(e){return e.pageIndex===r}).flatMap(function(e,n){return e.bboxes.map(function(e,i){return o++,{bbox:e,key:"".concat(r,"-").concat(n,"-").concat(i),globalIndex:o}})});return n.jsxs("div",e.__assign({style:{marginBottom:"8px"}},{children:[n.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),n.jsx("div",e.__assign({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:n.jsxs("div",e.__assign({style:{position:"absolute",inset:0}},{children:[n.jsx("img",{src:i,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(n){n&&n.complete&&!L[r]&&D(function(n){var i;return e.__assign(e.__assign({},n),((i={})[r]=!0,i))})},onLoad:function(){return D(function(n){var i;return e.__assign(e.__assign({},n),((i={})[r]=!0,i))})}}),L[r]&&s.map(function(i){var o=i.bbox,r=i.key,s=i.globalIndex,a=z===s;return n.jsx("div",e.__assign({ref:function(e){t.current[s]=e},onMouseEnter:function(){return I(s)},onMouseLeave:function(){return I(null)},style:{position:"absolute",left:"".concat(100*o.xmin,"%"),top:"".concat(100*o.ymin,"%"),width:"".concat(100*(o.xmax-o.xmin),"%"),height:"".concat(100*(o.ymax-o.ymin),"%"),background:a?f:g,border:a?"1.5px solid ".concat(_):"none",borderRadius:"2px",zIndex:2}},{children:p&&w===s&&n.jsxs("div",e.__assign({style:{position:"absolute",top:"-18px",right:"0",fontSize:"10px",background:c,color:"black",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap"}},{children:["Citation ",s+1]}))}),r)})]}))}))]}),r)})},W={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return n.jsxs(n.Fragment,{children:[n.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[A(!1),n.jsx("div",e.__assign({ref:E,style:e.__assign(e.__assign({},W),{maxHeight:m})},{children:U(!1)}))]})),n.jsx(o.Modal,e.__assign({isOpen:F,onClose:function(){return B(!1)}},{children:n.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[A(!0),n.jsx("div",e.__assign({ref:H,style:e.__assign(e.__assign({},W),{flex:1})},{children:F&&U(!0)}))]}))}))]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("lucide-react"),o=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(r){var s=r.images,a=r.highlights,l=r.pages,d=r.subHeadingText,c=void 0===d?"":d,u=r.showFullScreenMode,g=void 0===u||u,x=r.citationLabelColor,p=void 0===x?"#FFFF2E":x,h=r.showCitationLabelOnHover,f=void 0!==h&&h,_=r.highlightColor,b=void 0===_?"rgba(255, 220, 0, 0.15)":_,v=r.highlightActiveColor,m=void 0===v?"rgba(255, 220, 0, 0.35)":v,y=r.highlightBorderColor,j=void 0===y?"rgba(200, 160, 0, 0.4)":y,C=r.height,w=void 0===C?"700px":C,k=[],I=[];(null==l?void 0:l.length)?l.forEach(function(e,i){var n;e.gs_url&&k.push(e.gs_url),null===(n=e.highlighted_coordinates)||void 0===n||n.forEach(function(e){I.push({pageIndex:i,bboxes:[e]})})}):(k.push.apply(k,s||[]),I.push.apply(I,a||[]));var S=I.flatMap(function(e,i){return e.bboxes.map(function(n,t){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(t)}})}).length,z=n.useState(null),M=z[0],R=z[1],F=n.useState(0),B=F[0],q=F[1],L=n.useState(!1),D=L[0],E=L[1],H=n.useState({}),T=H[0],O=H[1],P=n.useRef(null),A=n.useRef(null),W=n.useRef([]),U=n.useRef([]),X=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(S-1,e));q(n),requestAnimationFrame(function(){var e=i?A.current:P.current,t=(i?U:W).current[n];if(e&&t){var o=e.getBoundingClientRect(),r=t.getBoundingClientRect(),s=r.top-o.top+e.scrollTop-e.clientHeight/2+r.height/2;e.scrollTo({top:s,behavior:"smooth"})}})},[S]),Y=function(n){return void 0===n&&(n=!1),S>0&&i.jsx("div",e.__assign({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i.jsxs("div",e.__assign({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i.jsxs("span",e.__assign({style:{fontSize:"12px",color:"#888"}},{children:[B+1," / ",S]})),i.jsx("button",e.__assign({onClick:function(){return X(B-1,n)},disabled:B<=0,style:{padding:"2px 4px",cursor:B<=0?"not-allowed":"pointer",opacity:B<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i.jsx(t.ChevronUp,{size:14,color:"#64748b"})})),i.jsx("button",e.__assign({onClick:function(){return X(B+1,n)},disabled:B>=S-1,style:{padding:"2px 4px",cursor:B>=S-1?"not-allowed":"pointer",opacity:B>=S-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i.jsx(t.ChevronDown,{size:14,color:"#64748b"})})),g&&i.jsxs(i.Fragment,{children:[i.jsx("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),n?i.jsx(t.X,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return E(!1)}}):i.jsx(t.Maximize2,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return E(!0)}})]})]}))}))},G=function(n){void 0===n&&(n=!1);var t=n?U:W,o=-1;return k.map(function(n,r){var s=I.filter(function(e){return e.pageIndex===r}).flatMap(function(e,i){return e.bboxes.map(function(e,n){return o++,{bbox:e,key:"".concat(r,"-").concat(i,"-").concat(n),globalIndex:o}})});return i.jsxs("div",e.__assign({style:{marginBottom:"8px"}},{children:[i.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),i.jsx("div",e.__assign({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i.jsxs("div",e.__assign({style:{position:"absolute",inset:0}},{children:[i.jsx("img",{src:n,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(i){i&&i.complete&&!T[r]&&O(function(i){var n;return e.__assign(e.__assign({},i),((n={})[r]=!0,n))})},onLoad:function(){return O(function(i){var n;return e.__assign(e.__assign({},i),((n={})[r]=!0,n))})}}),T[r]&&s.map(function(n){var o=n.bbox,r=n.key,s=n.globalIndex,a=B===s;return i.jsx("div",e.__assign({ref:function(e){t.current[s]=e},onMouseEnter:function(){return R(s)},onMouseLeave:function(){return R(null)},style:{position:"absolute",left:"".concat(100*o.xmin,"%"),top:"".concat(100*o.ymin,"%"),width:"".concat(100*(o.xmax-o.xmin),"%"),height:"".concat(100*(o.ymax-o.ymin),"%"),background:a?m:b,border:a?"1.5px solid ".concat(j):"none",borderRadius:"2px",zIndex:2}},{children:f&&M===s&&i.jsxs("div",e.__assign({style:{position:"absolute",top:"-18px",right:"0",fontSize:"10px",background:p,color:"black",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap"}},{children:["Citation ",s+1]}))}),r)})]}))}))]}),r)})},J={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[(c||S>0)&&i.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:[c&&i.jsx("div",e.__assign({style:{fontSize:"14px",fontWeight:500,color:"#111"}},{children:c})),i.jsx("div",e.__assign({style:{marginLeft:"auto"}},{children:Y(!1)}))]})),i.jsx("div",e.__assign({ref:P,style:e.__assign(e.__assign({},J),{maxHeight:w})},{children:G(!1)}))]})),i.jsx(o.Modal,e.__assign({isOpen:D,onClose:function(){return E(!1)}},{children:i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[Y(!0),i.jsx("div",e.__assign({ref:A,style:e.__assign(e.__assign({},J),{flex:1})},{children:D&&G(!0)}))]}))}))]})};
2
2
  //# sourceMappingURL=ScannedDocCitation.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as n}from"tslib";import{jsxs as o,Fragment as i,jsx as e}from"react/jsx-runtime";import{useState as t,useRef as r,useCallback as l}from"react";import{ChevronUp as a,ChevronDown as d,X as c,Maximize2 as p}from"lucide-react";import{Modal as u}from"../ChatCitation/components/wrappers/Modal.js";function s(s){var h=s.images,x=s.highlights,g=s.pages,f=s.citationLabelColor,b=void 0===f?"#FFFF2E":f,m=s.showCitationLabelOnHover,v=void 0!==m&&m,y=s.highlightColor,k=void 0===y?"rgba(255, 220, 0, 0.15)":y,w=s.highlightActiveColor,C=void 0===w?"rgba(255, 220, 0, 0.35)":w,I=s.highlightBorderColor,z=void 0===I?"rgba(200, 160, 0, 0.4)":I,B=s.height,F=void 0===B?"700px":B,M=[],R=[];(null==g?void 0:g.length)?g.forEach(function(n,o){var i;n.gs_url&&M.push(n.gs_url),null===(i=n.highlighted_coordinates)||void 0===i||i.forEach(function(n){R.push({pageIndex:o,bboxes:[n]})})}):(M.push.apply(M,h||[]),R.push.apply(R,x||[]));var S=R.flatMap(function(n,o){return n.bboxes.map(function(i,e){return{bbox:i,pageIndex:n.pageIndex,key:"".concat(o,"-").concat(e)}})}).length,L=t(null),E=L[0],j=L[1],D=t(0),H=D[0],T=D[1],_=t(!1),A=_[0],O=_[1],P=t({}),q=P[0],W=P[1],Y=r(null),G=r(null),J=r([]),K=r([]),N=l(function(n,o){void 0===o&&(o=!1);var i=Math.max(0,Math.min(S-1,n));T(i),requestAnimationFrame(function(){var n=o?G.current:Y.current,e=(o?K:J).current[i];if(n&&e){var t=n.getBoundingClientRect(),r=e.getBoundingClientRect(),l=r.top-t.top+n.scrollTop-n.clientHeight/2+r.height/2;n.scrollTo({top:l,behavior:"smooth"})}})},[S]),Q=function(i){return void 0===i&&(i=!1),S>0&&e("div",n({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:o("div",n({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[o("span",n({style:{fontSize:"12px",color:"#888"}},{children:[H+1," / ",S]})),e("button",n({onClick:function(){return N(H-1,i)},disabled:H<=0,style:{padding:"2px 4px",cursor:H<=0?"not-allowed":"pointer",opacity:H<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e(a,{size:14,color:"#64748b"})})),e("button",n({onClick:function(){return N(H+1,i)},disabled:H>=S-1,style:{padding:"2px 4px",cursor:H>=S-1?"not-allowed":"pointer",opacity:H>=S-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:e(d,{size:14,color:"#64748b"})})),e("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),i?e(c,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return O(!1)}}):e(p,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return O(!0)}})]}))}))},U=function(i){void 0===i&&(i=!1);var t=i?K:J,r=-1;return M.map(function(i,l){var a=R.filter(function(n){return n.pageIndex===l}).flatMap(function(n,o){return n.bboxes.map(function(n,i){return r++,{bbox:n,key:"".concat(l,"-").concat(o,"-").concat(i),globalIndex:r}})});return o("div",n({style:{marginBottom:"8px"}},{children:[o("div",n({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",l+1]})),e("div",n({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:o("div",n({style:{position:"absolute",inset:0}},{children:[e("img",{src:i,alt:"Page ".concat(l+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(o){o&&o.complete&&!q[l]&&W(function(o){var i;return n(n({},o),((i={})[l]=!0,i))})},onLoad:function(){return W(function(o){var i;return n(n({},o),((i={})[l]=!0,i))})}}),q[l]&&a.map(function(i){var r=i.bbox,l=i.key,a=i.globalIndex,d=H===a;return e("div",n({ref:function(n){t.current[a]=n},onMouseEnter:function(){return j(a)},onMouseLeave:function(){return j(null)},style:{position:"absolute",left:"".concat(100*r.xmin,"%"),top:"".concat(100*r.ymin,"%"),width:"".concat(100*(r.xmax-r.xmin),"%"),height:"".concat(100*(r.ymax-r.ymin),"%"),background:d?C:k,border:d?"1.5px solid ".concat(z):"none",borderRadius:"2px",zIndex:2}},{children:v&&E===a&&o("div",n({style:{position:"absolute",top:"-18px",right:"0",fontSize:"10px",background:b,color:"black",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap"}},{children:["Citation ",a+1]}))}),l)})]}))}))]}),l)})},V={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return o(i,{children:[o("div",n({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[Q(!1),e("div",n({ref:Y,style:n(n({},V),{maxHeight:F})},{children:U(!1)}))]})),e(u,n({isOpen:A,onClose:function(){return O(!1)}},{children:o("div",n({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[Q(!0),e("div",n({ref:G,style:n(n({},V),{flex:1})},{children:A&&U(!0)}))]}))}))]})}export{s as default};
1
+ import{__assign as e}from"tslib";import{jsxs as i,Fragment as n,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as r,useCallback as l}from"react";import{ChevronUp as d,ChevronDown as a,X as c,Maximize2 as p}from"lucide-react";import{Modal as u}from"../ChatCitation/components/wrappers/Modal.js";function s(s){var h=s.images,g=s.highlights,x=s.pages,f=s.subHeadingText,b=void 0===f?"":f,m=s.showFullScreenMode,v=void 0===m||m,y=s.citationLabelColor,w=void 0===y?"#FFFF2E":y,k=s.showCitationLabelOnHover,C=void 0!==k&&k,I=s.highlightColor,z=void 0===I?"rgba(255, 220, 0, 0.15)":I,B=s.highlightActiveColor,F=void 0===B?"rgba(255, 220, 0, 0.35)":B,M=s.highlightBorderColor,S=void 0===M?"rgba(200, 160, 0, 0.4)":M,R=s.height,L=void 0===R?"700px":R,E=[],H=[];(null==x?void 0:x.length)?x.forEach(function(e,i){var n;e.gs_url&&E.push(e.gs_url),null===(n=e.highlighted_coordinates)||void 0===n||n.forEach(function(e){H.push({pageIndex:i,bboxes:[e]})})}):(E.push.apply(E,h||[]),H.push.apply(H,g||[]));var T=H.flatMap(function(e,i){return e.bboxes.map(function(n,o){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(o)}})}).length,j=t(null),D=j[0],_=j[1],A=t(0),O=A[0],P=A[1],W=t(!1),q=W[0],Y=W[1],G=t({}),J=G[0],K=G[1],N=r(null),Q=r(null),U=r([]),V=r([]),X=l(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(T-1,e));P(n),requestAnimationFrame(function(){var e=i?Q.current:N.current,o=(i?V:U).current[n];if(e&&o){var t=e.getBoundingClientRect(),r=o.getBoundingClientRect(),l=r.top-t.top+e.scrollTop-e.clientHeight/2+r.height/2;e.scrollTo({top:l,behavior:"smooth"})}})},[T]),Z=function(t){return void 0===t&&(t=!1),T>0&&o("div",e({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i("div",e({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i("span",e({style:{fontSize:"12px",color:"#888"}},{children:[O+1," / ",T]})),o("button",e({onClick:function(){return X(O-1,t)},disabled:O<=0,style:{padding:"2px 4px",cursor:O<=0?"not-allowed":"pointer",opacity:O<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:o(d,{size:14,color:"#64748b"})})),o("button",e({onClick:function(){return X(O+1,t)},disabled:O>=T-1,style:{padding:"2px 4px",cursor:O>=T-1?"not-allowed":"pointer",opacity:O>=T-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:o(a,{size:14,color:"#64748b"})})),v&&i(n,{children:[o("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),t?o(c,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return Y(!1)}}):o(p,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return Y(!0)}})]})]}))}))},$=function(n){void 0===n&&(n=!1);var t=n?V:U,r=-1;return E.map(function(n,l){var d=H.filter(function(e){return e.pageIndex===l}).flatMap(function(e,i){return e.bboxes.map(function(e,n){return r++,{bbox:e,key:"".concat(l,"-").concat(i,"-").concat(n),globalIndex:r}})});return i("div",e({style:{marginBottom:"8px"}},{children:[i("div",e({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",l+1]})),o("div",e({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i("div",e({style:{position:"absolute",inset:0}},{children:[o("img",{src:n,alt:"Page ".concat(l+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1,ref:function(i){i&&i.complete&&!J[l]&&K(function(i){var n;return e(e({},i),((n={})[l]=!0,n))})},onLoad:function(){return K(function(i){var n;return e(e({},i),((n={})[l]=!0,n))})}}),J[l]&&d.map(function(n){var r=n.bbox,l=n.key,d=n.globalIndex,a=O===d;return o("div",e({ref:function(e){t.current[d]=e},onMouseEnter:function(){return _(d)},onMouseLeave:function(){return _(null)},style:{position:"absolute",left:"".concat(100*r.xmin,"%"),top:"".concat(100*r.ymin,"%"),width:"".concat(100*(r.xmax-r.xmin),"%"),height:"".concat(100*(r.ymax-r.ymin),"%"),background:a?F:z,border:a?"1.5px solid ".concat(S):"none",borderRadius:"2px",zIndex:2}},{children:C&&D===d&&i("div",e({style:{position:"absolute",top:"-18px",right:"0",fontSize:"10px",background:w,color:"black",padding:"2px 6px",borderRadius:"3px",whiteSpace:"nowrap"}},{children:["Citation ",d+1]}))}),l)})]}))}))]}),l)})},ee={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",paddingBottom:0,display:"flex",flexDirection:"column",boxSizing:"border-box"};return i(n,{children:[i("div",e({style:{width:"100%",maxWidth:"800px",fontFamily:"inherit",display:"flex",flexDirection:"column"}},{children:[(b||T>0)&&i("div",e({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:[b&&o("div",e({style:{fontSize:"14px",fontWeight:500,color:"#111"}},{children:b})),o("div",e({style:{marginLeft:"auto"}},{children:Z(!1)}))]})),o("div",e({ref:N,style:e(e({},ee),{maxHeight:L})},{children:$(!1)}))]})),o(u,e({isOpen:q,onClose:function(){return Y(!1)}},{children:i("div",e({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[Z(!0),o("div",e({ref:Q,style:e(e({},ee),{flex:1})},{children:q&&$(!0)}))]}))}))]})}export{s as default};
2
2
  //# sourceMappingURL=ScannedDocCitation.js.map
@@ -34,10 +34,12 @@ export interface ScannedDocCitationProps {
34
34
  pages?: CitationPage[];
35
35
  citationLabelColor?: string;
36
36
  showCitationLabelOnHover?: boolean;
37
+ subHeadingText?: string;
38
+ showFullScreenMode?: boolean;
37
39
  highlightColor?: string;
38
40
  highlightActiveColor?: string;
39
41
  highlightBorderColor?: string;
40
42
  height?: string | number;
41
43
  }
42
- export default function ScannedDocCitation({ images, highlights, pages, citationLabelColor, showCitationLabelOnHover, highlightColor, highlightActiveColor, highlightBorderColor, height, }: ScannedDocCitationProps): import("react/jsx-runtime").JSX.Element;
44
+ export default function ScannedDocCitation({ images, highlights, pages, subHeadingText, showFullScreenMode, citationLabelColor, showCitationLabelOnHover, highlightColor, highlightActiveColor, highlightBorderColor, height, }: ScannedDocCitationProps): import("react/jsx-runtime").JSX.Element;
43
45
  //# sourceMappingURL=ScannedDocCitation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScannedDocCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/ScannedDocCitation/ScannedDocCitation.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AACD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,IAAI,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,MAAM,EACN,UAAU,EACV,KAAK,EACL,kBAA8B,EAC9B,wBAAgC,EAChC,cAA0C,EAC1C,oBAAgD,EAChD,oBAA+C,EAC/C,MAAgB,GACjB,EAAE,uBAAuB,2CAgNzB"}
1
+ {"version":3,"file":"ScannedDocCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/ScannedDocCitation/ScannedDocCitation.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,CAAC;CAChB;AACD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,MAAM,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,IAAI,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EACzC,MAAM,EACN,UAAU,EACV,KAAK,EACL,cAAiB,EACjB,kBAAuB,EACvB,kBAA8B,EAC9B,wBAAgC,EAChC,cAA0C,EAC1C,oBAAgD,EAChD,oBAA+C,EAC/C,MAAgB,GACjB,EAAE,uBAAuB,2CAiOzB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/citation",
3
- "version": "0.0.156",
3
+ "version": "0.0.157",
4
4
  "author": "Devesh Patel",
5
5
  "description": "",
6
6
  "license": "MIT",