@viswa-test/test-citation 0.0.142 → 0.0.143
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/dist/cjs/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/features/CognitiveCompare/hooks/useSideBySide.js +1 -1
- package/dist/types/src/CognitiveCompareTest.d.ts.map +1 -1
- package/dist/types/src/features/CognitiveCompare/hooks/useSideBySide.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../CognitiveComparehelpers.js");exports.useSideBySide=function(n){var r=n.maintainRelativeOrder,i=n.proposedSections,u=n.existingSections,l=n.leftContainerRef,o=n.rightContainerRef,c=n.scrollContainerRef,s=n.sectionLeftRefs,d=n.sectionRightRefs,a=n.subSectionLeftRefs,v=n.subSectionRightRefs,f=n.lhsBadgeRefs,p=n.rhsBadgeRefs,g=n.sectionRowRefs,h=n.sectionRightRowRefs,R=n.rhsTopSpacerRef,S=n.rhsBottomSpacerRef,A=n.lhsTopSpacerRef,E=n.lhsBottomSpacerRef,T=n.calculateLinesRef,y=n.setConnectedSections,B=n.setConnectedLines,m=n.cachedConnectedPositions,I=n.closeMoreFunctionsPopup,x=n.setErrorToast,O=n.moreFunctions,C=n.closeSummaryPopup,_=e.useState(!0),D=_[0],N=_[1],b=e.useState(!1),P=b[0],V=b[1],G=e.useState(!1),w=G[0],H=G[1],L=e.useState(!1),q=L[0],F=L[1],M=e.useState(null),k=M[0],j=M[1],z=e.useRef(!1),J=e.useRef(null),K=e.useRef(!1),Q=e.useRef(null),U=e.useRef(null),W=e.useRef(null),X=e.useRef(new Set),Y=function(){X.current.forEach(function(e){t.resetClauseHighlight(e)}),X.current.clear()},Z=function(e,n){var r,i,u,l,o,c,f;null!==e&&("string"==typeof e&&e.includes(t.DEVIATION_BADGE_SEPARATOR)?(f=(null===(r=a.current[e.split(t.DEVIATION_BADGE_SEPARATOR)[2]])||void 0===r?void 0:r.current)||(null===(i=s.current[Number(e.split(t.DEVIATION_BADGE_SEPARATOR)[2])])||void 0===i?void 0:i.current))&&(f.style.paddingTop="0px"):(f=null===(u=s.current[Number(e)])||void 0===u?void 0:u.current)&&(f.style.paddingTop="0px"));null!==n&&("string"==typeof n&&n.includes(t.DEVIATION_BADGE_SEPARATOR)?(f=(null===(l=v.current[n.split(t.DEVIATION_BADGE_SEPARATOR)[3]])||void 0===l?void 0:l.current)||(null===(o=d.current[Number(n.split(t.DEVIATION_BADGE_SEPARATOR)[3])])||void 0===o?void 0:o.current))&&(f.style.paddingTop="0px"):(f=null===(c=d.current[Number(n)])||void 0===c?void 0:c.current)&&(f.style.paddingTop="0px"))},$=function(e,n,r){var i,u,l,o,c,R,S,A,E,T,y,B,m=null,I=null,x=null,O=null;if(e){var C=n.split(t.DEVIATION_BADGE_SEPARATOR),_="".concat(C[0]).concat(t.DEVIATION_BADGE_SEPARATOR).concat(C[1]);m=(null===(i=a.current[C[2]])||void 0===i?void 0:i.current)||(null===(u=s.current[Number(C[2])])||void 0===u?void 0:u.current)||null,I=(null===(l=v.current[C[3]])||void 0===l?void 0:l.current)||(null===(o=d.current[Number(C[3])])||void 0===o?void 0:o.current)||null,x=(null===(c=f.current[_])||void 0===c?void 0:c.current)||m,O=(null===(R=p.current[_])||void 0===R?void 0:R.current)||I}else{var D=Number(n),N=null!==r?Number(r):null!==U.current?Number(U.current):D;m=(null===(S=s.current[D])||void 0===S?void 0:S.current)||null,I=(null===(A=d.current[N])||void 0===A?void 0:A.current)||null,x=(null===(E=f.current[D])||void 0===E?void 0:E.current)||(null===(T=g.current[D])||void 0===T?void 0:T.current)||m,O=(null===(y=p.current[N])||void 0===y?void 0:y.current)||(null===(B=h.current[N])||void 0===B?void 0:B.current)||I}if(x&&O&&m&&I){m.style.paddingTop="0px",I.style.paddingTop="0px",x.offsetHeight;var b=x.getBoundingClientRect(),P=O.getBoundingClientRect(),V=Math.round(b.top-P.top);V>0?I.style.paddingTop="".concat(V,"px"):V<0&&(m.style.paddingTop="".concat(Math.abs(V),"px"))}};e.useEffect(function(){K.current=D},[D]),e.useEffect(function(){Q.current=k},[k]);var ee=e.useCallback(function(){Y(),N(!1),K.current=!1,J.current=null,Z(Q.current,U.current),j(null),Q.current=null,U.current=null,V(!1),F(!1),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),A.current&&(A.current.style.height="0px"),E.current&&(E.current.style.height="0px")},[]),te=e.useCallback(function(e,n,s){var d,a,v=null===(d=null==s?void 0:s.toggleIfSame)||void 0===d||d,O=null==s?void 0:s.onReady,C=null!==(a=null==s?void 0:s.sourceSide)&&void 0!==a?a:"left";I(),null!=e&&(n?x("No counterpart exists for this section."):(Y(),D&&k===e?v?ee():null==O||O():(Z(Q.current,U.current),R.current&&(R.current.style.height="0px"),S.current&&(S.current.style.height="0px"),A.current&&(A.current.style.height="0px"),E.current&&(E.current.style.height="0px"),l.current&&l.current.offsetHeight,y(new Set([e])),B([]),m.current=[],F(!0),z.current=!0,j(e),Q.current=e,N(!0),K.current=!0,V(!1),requestAnimationFrame(function(){var n,s,d,a,v,y="string"==typeof e&&e.includes(t.DEVIATION_BADGE_SEPARATOR),B=null,m=null,I=null;if(y){var x=e.split(t.DEVIATION_BADGE_SEPARATOR),_="".concat(x[0]).concat(t.DEVIATION_BADGE_SEPARATOR).concat(x[1]);B=(null===(n=f.current[_])||void 0===n?void 0:n.current)||null,m=(null===(s=p.current[_])||void 0===s?void 0:s.current)||null,I=m?e:null}else if(B=(null===(d=g.current[e])||void 0===d?void 0:d.current)||null,r){var D=i[e],N=(null==D?void 0:D.refIndexes)||[];if(N.length>0){var b=N[0],P=u.findIndex(function(e){return e.selfIndex===b});-1!==P&&(m=(null===(v=h.current[P])||void 0===v?void 0:v.current)||null,I=P)}}else m=(null===(a=h.current[e])||void 0===a?void 0:a.current)||null,I=m?e:null;U.current=I;var G=l.current,w=o.current,H=function(){$(y,e,I),V(!0),T.current&&T.current(),z.current=!1,"right"===C&&w?w.dispatchEvent(new Event("scroll")):G&&G.dispatchEvent(new Event("scroll")),F(!1),null==O||O()};if(!B||!G)return z.current=!1,F(!1),void(null==O||O());if(m&&w){if(!r){var L=0;L="right"===C?m?m.getBoundingClientRect().top:0:B?B.getBoundingClientRect().top:0;var q=c.current,M=(null==q?void 0:q.getBoundingClientRect().top)||0,k=q?q.scrollTop+L-M-150:0;return q?void t.smoothScrollTo(q,k,200,H):void H()}var j=B.getBoundingClientRect().top-G.getBoundingClientRect().top+G.scrollTop,J=m.getBoundingClientRect().top-w.getBoundingClientRect().top+w.scrollTop,K=200;if("left"===C){var Q=J-(j-G.scrollTop);Q<0&&R.current&&(R.current.style.height="".concat(Math.abs(Q),"px")),requestAnimationFrame(function(){var e,n=w.scrollHeight-w.clientHeight;if(Q<0)e=0;else{if(Q>n){var r=Q-n;return S.current&&(S.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){t.smoothScrollTo(w,Q,K,H)})}e=Q}t.smoothScrollTo(w,e,K,H)})}else{var W=j-(J-w.scrollTop);W<0&&A.current&&(A.current.style.height="".concat(Math.abs(W),"px")),requestAnimationFrame(function(){var e,n=G.scrollHeight-G.clientHeight;if(W<0)e=0;else{if(W>n){var r=W-n;return E.current&&(E.current.style.height="".concat(r+150,"px")),void requestAnimationFrame(function(){t.smoothScrollTo(G,W,K,H)})}e=W}t.smoothScrollTo(G,e,K,H)})}}else H()}))))},[k,I,u,D,r,i,ee]);return e.useCallback(function(){var e,t=O.sectionIdx,n=O.isOrphan;if(C(),null!=t){var r="left";O.anchorEl&&(null===(e=o.current)||void 0===e?void 0:e.contains(O.anchorEl))&&(r="right"),te(t,n,{sourceSide:r})}},[te,O.isOrphan,O.sectionIdx,O.anchorEl,C]),{isSideBySide:D,setIsSideBySide:N,isArrowVisible:P,setIsArrowVisible:V,isResizing:w,setIsResizing:H,isSideBySideLoading:q,setIsSideBySideLoading:F,activeSideBySideSection:k,setActiveSideBySideSection:j,scrollLock:z,sideBySideCacheRef:J,isSideBySideRef:K,activeSideBySideSectionRef:Q,activeSideBySideRightSectionRef:U,sideBySideLineRef:W,highlightedClauseRefs:X,clearClauseHighlight:Y,applyAlignmentPadding:$,resetSideBySide:ee,activateSideBySide:te}};
|
|
2
2
|
//# sourceMappingURL=useSideBySide.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useState as e,useRef as n,useEffect as t,useCallback as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var
|
|
1
|
+
import{useState as e,useRef as n,useEffect as t,useCallback as r}from"react";import{DEVIATION_BADGE_SEPARATOR as i,smoothScrollTo as l,resetClauseHighlight as u}from"../CognitiveComparehelpers.js";var c=function(c){var o=c.maintainRelativeOrder,d=c.proposedSections,s=c.existingSections,a=c.leftContainerRef,v=c.rightContainerRef,p=c.scrollContainerRef,f=c.sectionLeftRefs,g=c.sectionRightRefs,h=c.subSectionLeftRefs,S=c.subSectionRightRefs,R=c.lhsBadgeRefs,y=c.rhsBadgeRefs,m=c.sectionRowRefs,x=c.sectionRightRowRefs,B=c.rhsTopSpacerRef,C=c.rhsBottomSpacerRef,b=c.lhsTopSpacerRef,T=c.lhsBottomSpacerRef,I=c.calculateLinesRef,N=c.setConnectedSections,A=c.setConnectedLines,E=c.cachedConnectedPositions,w=c.closeMoreFunctionsPopup,L=c.setErrorToast,F=c.moreFunctions,H=c.closeSummaryPopup,q=e(!0),M=q[0],P=q[1],O=e(!1),z=O[0],V=O[1],j=e(!1),k=j[0],D=j[1],G=e(!1),J=G[0],K=G[1],Q=e(null),U=Q[0],W=Q[1],X=n(!1),Y=n(null),Z=n(!1),$=n(null),_=n(null),ee=n(null),ne=n(new Set),te=function(){ne.current.forEach(function(e){u(e)}),ne.current.clear()},re=function(e,n){var t,r,l,u,c,o,d;null!==e&&("string"==typeof e&&e.includes(i)?(d=(null===(t=h.current[e.split(i)[2]])||void 0===t?void 0:t.current)||(null===(r=f.current[Number(e.split(i)[2])])||void 0===r?void 0:r.current))&&(d.style.paddingTop="0px"):(d=null===(l=f.current[Number(e)])||void 0===l?void 0:l.current)&&(d.style.paddingTop="0px"));null!==n&&("string"==typeof n&&n.includes(i)?(d=(null===(u=S.current[n.split(i)[3]])||void 0===u?void 0:u.current)||(null===(c=g.current[Number(n.split(i)[3])])||void 0===c?void 0:c.current))&&(d.style.paddingTop="0px"):(d=null===(o=g.current[Number(n)])||void 0===o?void 0:o.current)&&(d.style.paddingTop="0px"))},ie=function(e,n,t){var r,l,u,c,o,d,s,a,v,p,B,C,b=null,T=null,I=null,N=null;if(e){var A=n.split(i),E="".concat(A[0]).concat(i).concat(A[1]);b=(null===(r=h.current[A[2]])||void 0===r?void 0:r.current)||(null===(l=f.current[Number(A[2])])||void 0===l?void 0:l.current)||null,T=(null===(u=S.current[A[3]])||void 0===u?void 0:u.current)||(null===(c=g.current[Number(A[3])])||void 0===c?void 0:c.current)||null,I=(null===(o=R.current[E])||void 0===o?void 0:o.current)||b,N=(null===(d=y.current[E])||void 0===d?void 0:d.current)||T}else{var w=Number(n),L=null!==t?Number(t):null!==_.current?Number(_.current):w;b=(null===(s=f.current[w])||void 0===s?void 0:s.current)||null,T=(null===(a=g.current[L])||void 0===a?void 0:a.current)||null,I=(null===(v=R.current[w])||void 0===v?void 0:v.current)||(null===(p=m.current[w])||void 0===p?void 0:p.current)||b,N=(null===(B=y.current[L])||void 0===B?void 0:B.current)||(null===(C=x.current[L])||void 0===C?void 0:C.current)||T}if(I&&N&&b&&T){b.style.paddingTop="0px",T.style.paddingTop="0px",I.offsetHeight;var F=I.getBoundingClientRect(),H=N.getBoundingClientRect(),q=Math.round(F.top-H.top);q>0?T.style.paddingTop="".concat(q,"px"):q<0&&(b.style.paddingTop="".concat(Math.abs(q),"px"))}};t(function(){Z.current=M},[M]),t(function(){$.current=U},[U]);var le=r(function(){te(),P(!1),Z.current=!1,Y.current=null,re($.current,_.current),W(null),$.current=null,_.current=null,V(!1),K(!1),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px"),T.current&&(T.current.style.height="0px")},[]),ue=r(function(e,n,t){var r,u,c=null===(r=null==t?void 0:t.toggleIfSame)||void 0===r||r,f=null==t?void 0:t.onReady,g=null!==(u=null==t?void 0:t.sourceSide)&&void 0!==u?u:"left";w(),null!=e&&(n?L("No counterpart exists for this section."):(te(),M&&U===e?c?le():null==f||f():(re($.current,_.current),B.current&&(B.current.style.height="0px"),C.current&&(C.current.style.height="0px"),b.current&&(b.current.style.height="0px"),T.current&&(T.current.style.height="0px"),a.current&&a.current.offsetHeight,N(new Set([e])),A([]),E.current=[],K(!0),X.current=!0,W(e),$.current=e,P(!0),Z.current=!0,V(!1),requestAnimationFrame(function(){var n,t,r,u,c,h="string"==typeof e&&e.includes(i),S=null,N=null,A=null;if(h){var E=e.split(i),w="".concat(E[0]).concat(i).concat(E[1]);S=(null===(n=R.current[w])||void 0===n?void 0:n.current)||null,N=(null===(t=y.current[w])||void 0===t?void 0:t.current)||null,A=N?e:null}else if(S=(null===(r=m.current[e])||void 0===r?void 0:r.current)||null,o){var L=d[e],F=(null==L?void 0:L.refIndexes)||[];if(F.length>0){var H=F[0],q=s.findIndex(function(e){return e.selfIndex===H});-1!==q&&(N=(null===(c=x.current[q])||void 0===c?void 0:c.current)||null,A=q)}}else N=(null===(u=x.current[e])||void 0===u?void 0:u.current)||null,A=N?e:null;_.current=A;var M=a.current,P=v.current,O=function(){ie(h,e,A),V(!0),I.current&&I.current(),X.current=!1,"right"===g&&P?P.dispatchEvent(new Event("scroll")):M&&M.dispatchEvent(new Event("scroll")),K(!1),null==f||f()};if(!S||!M)return X.current=!1,K(!1),void(null==f||f());if(N&&P){if(!o){var z=0;z="right"===g?N?N.getBoundingClientRect().top:0:S?S.getBoundingClientRect().top:0;var j=p.current,k=(null==j?void 0:j.getBoundingClientRect().top)||0,D=j?j.scrollTop+z-k-150:0;return j?void l(j,D,200,O):void O()}var G=S.getBoundingClientRect().top-M.getBoundingClientRect().top+M.scrollTop,J=N.getBoundingClientRect().top-P.getBoundingClientRect().top+P.scrollTop,Q=200;if("left"===g){var U=J-(G-M.scrollTop);U<0&&B.current&&(B.current.style.height="".concat(Math.abs(U),"px")),requestAnimationFrame(function(){var e,n=P.scrollHeight-P.clientHeight;if(U<0)e=0;else{if(U>n){var t=U-n;return C.current&&(C.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(P,U,Q,O)})}e=U}l(P,e,Q,O)})}else{var W=G-(J-P.scrollTop);W<0&&b.current&&(b.current.style.height="".concat(Math.abs(W),"px")),requestAnimationFrame(function(){var e,n=M.scrollHeight-M.clientHeight;if(W<0)e=0;else{if(W>n){var t=W-n;return T.current&&(T.current.style.height="".concat(t+150,"px")),void requestAnimationFrame(function(){l(M,W,Q,O)})}e=W}l(M,e,Q,O)})}}else O()}))))},[U,w,s,M,o,d,le]);return r(function(){var e,n=F.sectionIdx,t=F.isOrphan;if(H(),null!=n){var r="left";F.anchorEl&&(null===(e=v.current)||void 0===e?void 0:e.contains(F.anchorEl))&&(r="right"),ue(n,t,{sourceSide:r})}},[ue,F.isOrphan,F.sectionIdx,F.anchorEl,H]),{isSideBySide:M,setIsSideBySide:P,isArrowVisible:z,setIsArrowVisible:V,isResizing:k,setIsResizing:D,isSideBySideLoading:J,setIsSideBySideLoading:K,activeSideBySideSection:U,setActiveSideBySideSection:W,scrollLock:X,sideBySideCacheRef:Y,isSideBySideRef:Z,activeSideBySideSectionRef:$,activeSideBySideRightSectionRef:_,sideBySideLineRef:ee,highlightedClauseRefs:ne,clearClauseHighlight:te,applyAlignmentPadding:ie,resetSideBySide:le,activateSideBySide:ue}};export{c as useSideBySide};
|
|
2
2
|
//# sourceMappingURL=useSideBySide.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+
|
|
1
|
+
{"version":3,"file":"CognitiveCompareTest.d.ts","sourceRoot":"","sources":["../../../src/CognitiveCompareTest.tsx"],"names":[],"mappings":"AAKA,QAAA,MAAM,oBAAoB,+CAoLzB,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSideBySide.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useSideBySide.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,aAAa,mfAavB,GAAG;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useSideBySide.d.ts","sourceRoot":"","sources":["../../../../../../src/features/CognitiveCompare/hooks/useSideBySide.tsx"],"names":[],"mappings":";AAGA,eAAO,MAAM,aAAa,mfAavB,GAAG;;;;;;;;;;;;;sBASgD,MAAM;0BAAoB,MAAM;iBAAW,MAAM;oBAAc,MAAM;cAAQ,MAAM;;;;;;;;mCAuC/F,OAAO,OAAO,GAAG,kBAAkB,GAAG;;8BAiF/D,MAAM,GAAG,MAAM,YACV,OAAO;;yBACmC,IAAI;;;CAyPnE,CAAA"}
|