@e-llm-studio/citation 0.0.148 → 0.0.149
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"),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,
|
|
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,x=void 0===c?"rgba(255, 220, 0, 0.35)":c,u=o.highlightBorderColor,p=void 0===u?"rgba(200, 160, 0, 0.4)":u,g=o.height,h=void 0===g?"700px":g,f=a.flatMap(function(e,i){return e.bboxes.map(function(n,t){return{bbox:n,pageIndex:e.pageIndex,key:"".concat(i,"-").concat(t)}})}).length,b=n.useState(0),_=b[0],m=b[1],y=n.useState(!1),v=y[0],j=y[1],k=n.useRef(null),w=n.useRef(null),C=n.useRef([]),I=n.useRef([]),z=n.useCallback(function(e,i){void 0===i&&(i=!1);var n=Math.max(0,Math.min(f-1,e));m(n),requestAnimationFrame(function(){var e=(i?I:C).current[n];e&&e.scrollIntoView({behavior:"smooth",block:"center"})})},[f]),M=function(n){return void 0===n&&(n=!1),f>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," / ",f]})),i.jsx("button",e.__assign({onClick:function(){return z(_-1,n)},disabled:_<=0,style:{padding:"2px 4px",cursor:_<=0?"not-allowed":"pointer",opacity:_<=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 z(_+1,n)},disabled:_>=f-1,style:{padding:"2px 4px",cursor:_>=f-1?"not-allowed":"pointer",opacity:_>=f-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:i.jsx(t.ChevronDown,{size:14,color:"#64748b"})})),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)}})]}))}))},R=function(n){void 0===n&&(n=!1);var t=n?I:C,r=-1;return s.map(function(n,o){var s=a.filter(function(e){return e.pageIndex===o}).flatMap(function(e,i){return e.bboxes.map(function(e,n){return r++,{bbox:e,key:"".concat(o,"-").concat(i,"-").concat(n),globalIndex:r}})});return i.jsxs("div",{children:[i.jsxs("div",e.__assign({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",o+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(o+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),s.map(function(e){var n=e.bbox,r=e.key,o=e.globalIndex,s=_===o;return i.jsx("div",{ref:function(e){t.current[o]=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:s?x:d,border:s?"1.5px solid ".concat(p):"none",borderRadius:"2px",zIndex:2}},r)})]}))}))]},o)})},q={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:[M(!1),i.jsx("div",e.__assign({ref:k,style:e.__assign(e.__assign({},q),{height:h})},{children:R(!1)}))]})),i.jsx(r.Modal,e.__assign({isOpen:v,onClose:function(){return j(!1)}},{children:i.jsxs("div",e.__assign({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[M(!0),i.jsx("div",e.__assign({ref:w,style:e.__assign(e.__assign({},q),{flex:1})},{children:v&&R(!0)}))]}))}))]})};
|
|
2
2
|
//# sourceMappingURL=ScannedDocCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as
|
|
1
|
+
import{__assign as i}from"tslib";import{jsxs as e,Fragment as o,jsx as n}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 s}from"lucide-react";import{Modal as p}from"../ChatCitation/components/wrappers/Modal.js";function u(u){var h=u.images,x=u.highlights,f=u.highlightColor,g=void 0===f?"rgba(255, 220, 0, 0.15)":f,b=u.highlightActiveColor,m=void 0===b?"rgba(255, 220, 0, 0.35)":b,y=u.highlightBorderColor,v=void 0===y?"rgba(200, 160, 0, 0.4)":y,k=u.height,w=void 0===k?"700px":k,I=x.flatMap(function(i,e){return i.bboxes.map(function(o,n){return{bbox:o,pageIndex:i.pageIndex,key:"".concat(e,"-").concat(n)}})}).length,C=t(0),z=C[0],M=C[1],R=t(!1),S=R[0],j=R[1],B=r(null),F=r(null),A=r([]),D=r([]),P=l(function(i,e){void 0===e&&(e=!1);var o=Math.max(0,Math.min(I-1,i));M(o),requestAnimationFrame(function(){var i=(e?D:A).current[o];i&&i.scrollIntoView({behavior:"smooth",block:"center"})})},[I]),q=function(o){return void 0===o&&(o=!1),I>0&&n("div",i({style:{display:"flex",alignItems:"center",marginBottom:"6px"}},{children:e("div",i({style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"4px"}},{children:[e("span",i({style:{fontSize:"12px",color:"#888"}},{children:[z+1," / ",I]})),n("button",i({onClick:function(){return P(z-1,o)},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(d,{size:14,color:"#64748b"})})),n("button",i({onClick:function(){return P(z+1,o)},disabled:z>=I-1,style:{padding:"2px 4px",cursor:z>=I-1?"not-allowed":"pointer",opacity:z>=I-1?.4:1,border:"1px solid #ddd",borderRadius:"3px",background:"white",display:"flex",alignItems:"center"}},{children:n(a,{size:14,color:"#64748b"})})),n("span",{style:{width:"1px",height:"16px",background:"#e2e8f0",margin:"0 2px"}}),o?n(c,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!1)}}):n(s,{size:16,color:"#64748b",style:{cursor:"pointer"},onClick:function(){return j(!0)}})]}))}))},L=function(o){void 0===o&&(o=!1);var t=o?D:A,r=-1;return h.map(function(o,l){var d=x.filter(function(i){return i.pageIndex===l}).flatMap(function(i,e){return i.bboxes.map(function(i,o){return r++,{bbox:i,key:"".concat(l,"-").concat(e,"-").concat(o),globalIndex:r}})});return e("div",{children:[e("div",i({style:{fontSize:"12px",color:"#888",marginBottom:"4px"}},{children:["Page ",l+1]})),n("div",i({style:{position:"relative",width:"100%",paddingTop:"129%",flexShrink:0}},{children:e("div",i({style:{position:"absolute",inset:0}},{children:[n("img",{src:o,alt:"Page ".concat(l+1),style:{display:"block",width:"100%",height:"100%",objectFit:"fill"},draggable:!1}),d.map(function(i){var e=i.bbox,o=i.key,r=i.globalIndex,l=z===r;return n("div",{ref:function(i){t.current[r]=i},style:{position:"absolute",left:"".concat(100*e.xmin,"%"),top:"".concat(100*e.ymin,"%"),width:"".concat(100*(e.xmax-e.xmin),"%"),height:"".concat(100*(e.ymax-e.ymin),"%"),background:l?m:g,border:l?"1.5px solid ".concat(v):"none",borderRadius:"2px",zIndex:2}},o)})]}))}))]},l)})},O={overflowY:"auto",border:"1px solid #ddd",borderRadius:"4px",padding:"8px",display:"flex",flexDirection:"column",gap:"8px",boxSizing:"border-box"};return e(o,{children:[e("div",i({style:{width:"100%",maxWidth:"600px",fontFamily:"inherit"}},{children:[q(!1),n("div",i({ref:B,style:i(i({},O),{height:w})},{children:L(!1)}))]})),n(p,i({isOpen:S,onClose:function(){return j(!1)}},{children:e("div",i({style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden"}},{children:[q(!0),n("div",i({ref:F,style:i(i({},O),{flex:1})},{children:S&&L(!0)}))]}))}))]})}export{u 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":"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,
|
|
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,2CA6IzB"}
|