@e-llm-studio/citation 0.0.147 → 0.0.148
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.
|
@@ -1,2 +1,2 @@
|
|
|
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");exports.default=function(
|
|
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"),r=require("../ChatCitation/components/wrappers/Modal.js");exports.default=function(o){var s=o.images,a=o.highlights,l=o.highlightColor,d=void 0===l?"rgba(255, 220, 0, 0.15)":l,c=o.highlightActiveColor,u=void 0===c?"rgba(255, 220, 0, 0.35)":c,x=o.highlightBorderColor,p=void 0===x?"rgba(200, 160, 0, 0.4)":x,g=o.height,h=void 0===g?"700px":g,b=a.flatMap(function(e,i){return e.bboxes.map(function(n,t){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(t)}})}).length,f=n.useState(0),_=f[0],m=f[1],y=n.useState(!1),v=y[0],j=y[1],k=n.useRef(null),C=n.useRef(null),w=n.useRef([]),z=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(b-1,e));m(n);var t=i?C.current:k.current,r=w.current[n];if(t&&r){var o=t.getBoundingClientRect().top,s=r.getBoundingClientRect().top-o+t.scrollTop-t.clientHeight/2+r.clientHeight/2;t.scrollTo({top:s,behavior:"smooth"})}},[b]),R=function(n){return void 0===n&&(n=!1),b>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:[_+1," / ",b]})),i.jsx("button",e.__assign({onClick:function(){return z(_-1,n)},disabled:_<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:_<=0?"not-allowed":"pointer",opacity:_<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),i.jsx("button",e.__assign({onClick:function(){return z(_+1,n)},disabled:_>=b-1,style:{padding:"2px 8px",fontSize:"12px",cursor:_>=b-1?"not-allowed":"pointer",opacity:_>=b-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{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 j(!1)}}):i.jsx(t.Maximize2,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!0)}})]}))}))},I=function(){var n=-1;return s.map(function(t,r){var o=a.filter(function(e){return e.pageIndex===r}).flatMap(function(e,i){return e.bboxes.map(function(e,t){return n++,{bbox:e,key:"".concat(r,"-").concat(i,"-").concat(t),globalIndex:n}})});return i.jsxs("div",{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:t,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),o.map(function(e){var n=e.bbox,t=e.key,r=e.globalIndex,o=_===r;return i.jsx("div",{ref:function(e){w.current[r]=e},style:{position:"absolute",left:"".concat(100*n.xmin,"%"),top:"".concat(100*n.ymin,"%"),width:"".concat(100*(n.xmax-n.xmin),"%"),height:"".concat(100*(n.ymax-n.ymin),"%"),background:o?u:d,border:o?"1.5px solid ".concat(p):"none",borderRadius:"2px",zIndex:2}},t)})]}))}))]},r)})},M={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[R(!1),i.jsx("div",e.__assign({ref:k,style:e.__assign(e.__assign({},M),{height:h})},{children:I()}))]})),i.jsxs(r.Modal,e.__assign({isOpen:v,onClose:function(){return j(!1)}},{children:[R(!0),i.jsx("div",e.__assign({ref:C,style:e.__assign(e.__assign({},M),{flex:1})},{children:I()}))]}))]})};
|
|
2
2
|
//# sourceMappingURL=ScannedDocCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as t}from"tslib";import{jsxs as i,Fragment as e,jsx as n}from"react/jsx-runtime";import{useState as o,useRef as r,useCallback as l}from"react";import{X as d,Maximize2 as a}from"lucide-react";import{Modal as c}from"../ChatCitation/components/wrappers/Modal.js";function p(p){var s=p.images,u=p.highlights,h=p.highlightColor,x=void 0===h?"rgba(255, 220, 0, 0.15)":h,g=p.highlightActiveColor,f=void 0===g?"rgba(255, 220, 0, 0.35)":g,b=p.highlightBorderColor,m=void 0===b?"rgba(200, 160, 0, 0.4)":b,y=p.height,v=void 0===y?"700px":y,k=u.flatMap(function(t,i){return t.bboxes.map(function(e,n){return{bbox:e,pageIndex:t.pageIndex,key:"".concat(i,"-").concat(n)}})}).length,C=o(0),w=C[0],z=C[1],I=o(!1),R=I[0],S=I[1],B=r(null),M=r(null),j=r([]),T=l(function(t,i){void 0===i&&(i=!1);var e=Math.max(0,Math.min(k-1,t));z(e);var n=i?M.current:B.current,o=j.current[e];if(n&&o){var r=n.getBoundingClientRect().top,l=o.getBoundingClientRect().top-r+n.scrollTop-n.clientHeight/2+o.clientHeight/2;n.scrollTo({top:l,behavior:"smooth"})}},[k]),F=function(e){return void 0===e&&(e=!1),k>0&&n("div",t({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:i("div",t({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[i("span",t({style:{fontSize:"12px",color:"#888"}},{children:[w+1," / ",k]})),n("button",t({onClick:function(){return T(w-1,e)},disabled:w<=0,style:{padding:"2px 8px",fontSize:"12px",cursor:w<=0?"not-allowed":"pointer",opacity:w<=0?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↑"})),n("button",t({onClick:function(){return T(w+1,e)},disabled:w>=k-1,style:{padding:"2px 8px",fontSize:"12px",cursor:w>=k-1?"not-allowed":"pointer",opacity:w>=k-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white"}},{children:"↓"})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),e?n(d,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!1)}}):n(a,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return S(!0)}})]}))}))},H=function(){var e=-1;return s.map(function(o,r){var l=u.filter(function(t){return t.pageIndex===r}).flatMap(function(t,i){return t.bboxes.map(function(t,n){return e++,{bbox:t,key:"".concat(r,"-").concat(i,"-").concat(n),globalIndex:e}})});return i("div",{children:[i("div",t({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",r+1]})),n("div",t({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:i("div",t({style:{position:"absolute",inset:0}},{children:[n("img",{src:o,alt:"Page ".concat(r+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),l.map(function(t){var i=t.bbox,e=t.key,o=t.globalIndex,r=w===o;return n("div",{ref:function(t){j.current[o]=t},style:{position:"absolute",left:"".concat(100*i.xmin,"%"),top:"".concat(100*i.ymin,"%"),width:"".concat(100*(i.xmax-i.xmin),"%"),height:"".concat(100*(i.ymax-i.ymin),"%"),background:r?f:x,border:r?"1.5px solid ".concat(m):"none",borderRadius:"2px",zIndex:2}},e)})]}))}))]},r)})},P={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return i(e,{children:[i("div",t({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[F(!1),n("div",t({ref:B,style:t(t({},P),{height:v})},{children:H()}))]})),i(c,t({isOpen:R,onClose:function(){return S(!1)}},{children:[F(!0),n("div",t({ref:M,style:t(t({},P),{flex:1})},{children:H()}))]}))]})}export{p as default};
|
|
2
2
|
//# sourceMappingURL=ScannedDocCitation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScannedDocCitation.d.ts","sourceRoot":"","sources":["../../../../../src/features/ScannedDocCitation/ScannedDocCitation.tsx"],"names":[],"mappings":"
|
|
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;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,EAAE,aAAa,EAAE,CAAC;IAC5B,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,cAA0C,EAC1C,oBAAgD,EAChD,oBAA+C,EAC/C,MAAgB,GACjB,EAAE,uBAAuB,2CA0IzB"}
|