@viswa-test/test-citation 0.0.129 → 0.0.130

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"),o=require("react"),i=require("../CognitiveComparehelpers.js");exports.useDeviationNavigation=function(n){var t=n.proposedSections,r=n.existingSections,l=n.parentDeviationRecord,u=n.expandedSections,c=n.maintainRelativeOrder,s=n.scrollContainerRef,d=n.leftContainerRef,v=n.rightContainerRef,a=n.lhsBadgeRefs,f=n.rhsBadgeRefs,h=o.useState({}),R=h[0],g=h[1],w=o.useRef();o.useEffect(function(){if(s.current){var o=c?d.current:s.current;if(o){var n=null,v=setTimeout(function(){var s=function(e,o){var i=e.getBoundingClientRect(),n=o.getBoundingClientRect();return i.bottom<n.top?"above":i.top>n.bottom?"below":"inside"};n=i.debounce(function(){g(function(n){var d=e.__assign({},n);return t.forEach(function(e,n){var t=c?!!u["left-".concat(n)]:!!u[String(n)],r=!1,v=!1,f=null,h=null,R=null,g=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t="".concat(n.id).concat(i.DEVIATION_BADGE_SEPARATOR,"0"),l=a.current[t];if(null==l?void 0:l.current){var u=s(l.current,o);R||(R=l,g=u),"above"===u?(r=!0,f=l):"below"!==u||v?w.current===e.id&&(w.current=""):(v=!0,h=l)}}),e.id&&(d[e.id]={showAbove:r,showBelow:v,showAboveRef:f,showBelowRef:h,firstDeviationRef:R,firstDeviationPosition:g,columnKey:"left"})}),c||r.forEach(function(e,n){var t=!!u[String(n)],r=!1,c=!1,v=null,a=null,h=null,R=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t,l,u,g,p,b=!(null===(t=n.refIndexes)||void 0===t?void 0:t.length)||void 0!==n.selfIndex&&n.selfIndex<0,B="".concat(n.id).concat(i.DEVIATION_BADGE_SEPARATOR,"0"),m=f.current[B];if((null==m?void 0:m.current)&&b&&(null==e?void 0:e.id)){var A=s(m.current,o);if(h||(h=m,R=A),"above"===A){var D=null===(u=null===(l=d[e.id])||void 0===l?void 0:l.showAboveRef)||void 0===u?void 0:u.current;(!D||D.getBoundingClientRect().top<m.current.getBoundingClientRect().top)&&(r=!0,v=m)}else if("below"!==A||c)w.current===e.id&&(w.current="");else{var T=null===(p=null===(g=d[e.id])||void 0===g?void 0:g.showBelowRef)||void 0===p?void 0:p.current;(!T||T.getBoundingClientRect().top>m.current.getBoundingClientRect().top)&&(c=!0,a=m)}}}),e.id&&t&&(r&&(d[e.id]=d[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},d[e.id].showAbove=r,d[e.id].showAboveRef=v,d[e.id].firstDeviationRef=h,d[e.id].firstDeviationPosition=R,d[e.id].columnKey="right"),c&&(d[e.id]=d[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},d[e.id].showBelow=c,d[e.id].showBelowRef=a,d[e.id].firstDeviationRef=h,d[e.id].firstDeviationPosition=R,d[e.id].columnKey="right"))}),d})},100),n(),null==o||o.addEventListener("scroll",n)},0);return function(){clearTimeout(v),n&&o.removeEventListener("scroll",n)}}}},[t,r,l,u,c,s,d,a,f]);var p=o.useCallback(function(e,o){var n,t;if(e){var r=s.current;if(c&&((null===(n=d.current)||void 0===n?void 0:n.contains(e))?r=d.current:(null===(t=v.current)||void 0===t?void 0:t.contains(e))&&(r=v.current)),r){var l=e.getBoundingClientRect(),u=r.getBoundingClientRect(),a=u.top+.6*u.height;if(l.bottom>a){var f=.65*u.height,h=250;if(c){var R=d.current,g=v.current;R&&g?(i.smoothScrollTo(g,g.scrollTop+f,h),i.smoothScrollTo(R,R.scrollTop+f,h,o)):R?i.smoothScrollTo(R,R.scrollTop+f,h,o):g?i.smoothScrollTo(g,g.scrollTop+f,h,o):o()}else s.current?i.smoothScrollTo(s.current,s.current.scrollTop+f,h,o):o()}else o()}else o()}else o()},[c]);return{showDeviationNavigation:R,showOpenNodeRef:w,adjustScrollForPopup:p}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react"),i=require("../CognitiveComparehelpers.js");exports.useDeviationNavigation=function(n){var t=n.proposedSections,r=n.existingSections,l=n.parentDeviationRecord,u=n.expandedSections,c=n.maintainRelativeOrder,s=n.scrollContainerRef,d=n.leftContainerRef,v=n.rightContainerRef,a=n.lhsBadgeRefs,f=n.rhsBadgeRefs,h=o.useState({}),R=h[0],g=h[1],w=o.useRef();o.useEffect(function(){if(s.current){var o=c?d.current:s.current;if(o){var n=null,v=setTimeout(function(){var s=function(e,o){var i=e.getBoundingClientRect(),n=o.getBoundingClientRect();return i.bottom<n.top?"above":i.top>n.bottom?"below":"inside"};n=i.debounce(function(){g(function(n){var d=e.__assign({},n);return t.forEach(function(e,n){var t=c?!!u["left-".concat(n)]:!!u[String(n)],r=!1,v=!1,f=null,h=null,R=null,g=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t="".concat(n.id).concat(i.DEVIATION_BADGE_SEPARATOR,"0"),l=a.current[t];if(null==l?void 0:l.current){var u=s(l.current,o);R||(R=l,g=u),"above"===u?(r=!0,f=l):"below"!==u||v?w.current===e.id&&(w.current=""):(v=!0,h=l)}}),e.id&&(d[e.id]={showAbove:r,showBelow:v,showAboveRef:f,showBelowRef:h,firstDeviationRef:R,firstDeviationPosition:g,columnKey:"left"})}),c||r.forEach(function(e,n){var t=!!u[String(n)],r=!1,c=!1,v=null,a=null,h=null,R=null;t&&(null==e?void 0:e.id)&&(l[e.id]||[]).forEach(function(n){var t,l,u,g,p,b=!(null===(t=n.refIndexes)||void 0===t?void 0:t.length)||void 0!==n.selfIndex&&n.selfIndex<0,B="".concat(n.id).concat(i.DEVIATION_BADGE_SEPARATOR,"0"),m=f.current[B];if((null==m?void 0:m.current)&&b&&(null==e?void 0:e.id)){var A=s(m.current,o);if(h||(h=m,R=A),"above"===A){var D=null===(u=null===(l=d[e.id])||void 0===l?void 0:l.showAboveRef)||void 0===u?void 0:u.current;(!D||D.getBoundingClientRect().top<m.current.getBoundingClientRect().top)&&(r=!0,v=m)}else if("below"!==A||c)w.current===e.id&&(w.current="");else{var T=null===(p=null===(g=d[e.id])||void 0===g?void 0:g.showBelowRef)||void 0===p?void 0:p.current;(!T||T.getBoundingClientRect().top>m.current.getBoundingClientRect().top)&&(c=!0,a=m)}}}),e.id&&t&&(r&&(d[e.id]=d[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},d[e.id].showAbove=r,d[e.id].showAboveRef=v,d[e.id].firstDeviationRef=h,d[e.id].firstDeviationPosition=R,d[e.id].columnKey="right"),c&&(d[e.id]=d[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},d[e.id].showBelow=c,d[e.id].showBelowRef=a,d[e.id].firstDeviationRef=h,d[e.id].firstDeviationPosition=R,d[e.id].columnKey="right"))}),d})},100),n(),null==o||o.addEventListener("scroll",n)},0);return function(){clearTimeout(v),n&&o.removeEventListener("scroll",n)}}}},[t,r,l,u,c,s,d,a,f]);var p=o.useCallback(function(e,o){var n,t;if(e){var r=s.current;if(c&&((null===(n=d.current)||void 0===n?void 0:n.contains(e))?r=d.current:(null===(t=v.current)||void 0===t?void 0:t.contains(e))&&(r=v.current)),r){var l=e.getBoundingClientRect(),u=r.getBoundingClientRect(),a=u.top+.7*u.height;if(l.bottom>a){var f=.6*u.height,h=250;if(c){var R=d.current,g=v.current;R&&g?(i.smoothScrollTo(g,g.scrollTop+f,h),i.smoothScrollTo(R,R.scrollTop+f,h,o)):R?i.smoothScrollTo(R,R.scrollTop+f,h,o):g?i.smoothScrollTo(g,g.scrollTop+f,h,o):o()}else s.current?i.smoothScrollTo(s.current,s.current.scrollTop+f,h,o):o()}else o()}else o()}else o()},[c]);return{showDeviationNavigation:R,showOpenNodeRef:w,adjustScrollForPopup:p}};
2
2
  //# sourceMappingURL=useDeviationNavigation.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{useState as o,useRef as n,useEffect as i,useCallback as t}from"react";import{smoothScrollTo as r,debounce as l,DEVIATION_BADGE_SEPARATOR as u}from"../CognitiveComparehelpers.js";var c=function(c){var d=c.proposedSections,s=c.existingSections,v=c.parentDeviationRecord,f=c.expandedSections,a=c.maintainRelativeOrder,h=c.scrollContainerRef,w=c.leftContainerRef,g=c.rightContainerRef,R=c.lhsBadgeRefs,p=c.rhsBadgeRefs,b=o({}),m=b[0],B=b[1],C=n();i(function(){if(h.current){var o=a?w.current:h.current;if(o){var n=null,i=setTimeout(function(){var i=function(e,o){var n=e.getBoundingClientRect(),i=o.getBoundingClientRect();return n.bottom<i.top?"above":n.top>i.bottom?"below":"inside"};n=l(function(){B(function(n){var t=e({},n);return d.forEach(function(e,n){var r=a?!!f["left-".concat(n)]:!!f[String(n)],l=!1,c=!1,d=null,s=null,h=null,w=null;r&&(null==e?void 0:e.id)&&(v[e.id]||[]).forEach(function(n){var t="".concat(n.id).concat(u,"0"),r=R.current[t];if(null==r?void 0:r.current){var v=i(r.current,o);h||(h=r,w=v),"above"===v?(l=!0,d=r):"below"!==v||c?C.current===e.id&&(C.current=""):(c=!0,s=r)}}),e.id&&(t[e.id]={showAbove:l,showBelow:c,showAboveRef:d,showBelowRef:s,firstDeviationRef:h,firstDeviationPosition:w,columnKey:"left"})}),a||s.forEach(function(e,n){var r=!!f[String(n)],l=!1,c=!1,d=null,s=null,a=null,h=null;r&&(null==e?void 0:e.id)&&(v[e.id]||[]).forEach(function(n){var r,v,f,w,g,R=!(null===(r=n.refIndexes)||void 0===r?void 0:r.length)||void 0!==n.selfIndex&&n.selfIndex<0,b="".concat(n.id).concat(u,"0"),m=p.current[b];if((null==m?void 0:m.current)&&R&&(null==e?void 0:e.id)){var B=i(m.current,o);if(a||(a=m,h=B),"above"===B){var D=null===(f=null===(v=t[e.id])||void 0===v?void 0:v.showAboveRef)||void 0===f?void 0:f.current;(!D||D.getBoundingClientRect().top<m.current.getBoundingClientRect().top)&&(l=!0,d=m)}else if("below"!==B||c)C.current===e.id&&(C.current="");else{var A=null===(g=null===(w=t[e.id])||void 0===w?void 0:w.showBelowRef)||void 0===g?void 0:g.current;(!A||A.getBoundingClientRect().top>m.current.getBoundingClientRect().top)&&(c=!0,s=m)}}}),e.id&&r&&(l&&(t[e.id]=t[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},t[e.id].showAbove=l,t[e.id].showAboveRef=d,t[e.id].firstDeviationRef=a,t[e.id].firstDeviationPosition=h,t[e.id].columnKey="right"),c&&(t[e.id]=t[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},t[e.id].showBelow=c,t[e.id].showBelowRef=s,t[e.id].firstDeviationRef=a,t[e.id].firstDeviationPosition=h,t[e.id].columnKey="right"))}),t})},100),n(),null==o||o.addEventListener("scroll",n)},0);return function(){clearTimeout(i),n&&o.removeEventListener("scroll",n)}}}},[d,s,v,f,a,h,w,R,p]);var D=t(function(e,o){var n,i;if(e){var t=h.current;if(a&&((null===(n=w.current)||void 0===n?void 0:n.contains(e))?t=w.current:(null===(i=g.current)||void 0===i?void 0:i.contains(e))&&(t=g.current)),t){var l=e.getBoundingClientRect(),u=t.getBoundingClientRect(),c=u.top+.6*u.height;if(l.bottom>c){var d=.65*u.height,s=250;if(a){var v=w.current,f=g.current;v&&f?(r(f,f.scrollTop+d,s),r(v,v.scrollTop+d,s,o)):v?r(v,v.scrollTop+d,s,o):f?r(f,f.scrollTop+d,s,o):o()}else h.current?r(h.current,h.current.scrollTop+d,s,o):o()}else o()}else o()}else o()},[a]);return{showDeviationNavigation:m,showOpenNodeRef:C,adjustScrollForPopup:D}};export{c as useDeviationNavigation};
1
+ import{__assign as e}from"tslib";import{useState as o,useRef as n,useEffect as i,useCallback as t}from"react";import{smoothScrollTo as r,debounce as l,DEVIATION_BADGE_SEPARATOR as u}from"../CognitiveComparehelpers.js";var c=function(c){var d=c.proposedSections,s=c.existingSections,v=c.parentDeviationRecord,f=c.expandedSections,a=c.maintainRelativeOrder,h=c.scrollContainerRef,w=c.leftContainerRef,g=c.rightContainerRef,R=c.lhsBadgeRefs,p=c.rhsBadgeRefs,b=o({}),m=b[0],B=b[1],C=n();i(function(){if(h.current){var o=a?w.current:h.current;if(o){var n=null,i=setTimeout(function(){var i=function(e,o){var n=e.getBoundingClientRect(),i=o.getBoundingClientRect();return n.bottom<i.top?"above":n.top>i.bottom?"below":"inside"};n=l(function(){B(function(n){var t=e({},n);return d.forEach(function(e,n){var r=a?!!f["left-".concat(n)]:!!f[String(n)],l=!1,c=!1,d=null,s=null,h=null,w=null;r&&(null==e?void 0:e.id)&&(v[e.id]||[]).forEach(function(n){var t="".concat(n.id).concat(u,"0"),r=R.current[t];if(null==r?void 0:r.current){var v=i(r.current,o);h||(h=r,w=v),"above"===v?(l=!0,d=r):"below"!==v||c?C.current===e.id&&(C.current=""):(c=!0,s=r)}}),e.id&&(t[e.id]={showAbove:l,showBelow:c,showAboveRef:d,showBelowRef:s,firstDeviationRef:h,firstDeviationPosition:w,columnKey:"left"})}),a||s.forEach(function(e,n){var r=!!f[String(n)],l=!1,c=!1,d=null,s=null,a=null,h=null;r&&(null==e?void 0:e.id)&&(v[e.id]||[]).forEach(function(n){var r,v,f,w,g,R=!(null===(r=n.refIndexes)||void 0===r?void 0:r.length)||void 0!==n.selfIndex&&n.selfIndex<0,b="".concat(n.id).concat(u,"0"),m=p.current[b];if((null==m?void 0:m.current)&&R&&(null==e?void 0:e.id)){var B=i(m.current,o);if(a||(a=m,h=B),"above"===B){var D=null===(f=null===(v=t[e.id])||void 0===v?void 0:v.showAboveRef)||void 0===f?void 0:f.current;(!D||D.getBoundingClientRect().top<m.current.getBoundingClientRect().top)&&(l=!0,d=m)}else if("below"!==B||c)C.current===e.id&&(C.current="");else{var A=null===(g=null===(w=t[e.id])||void 0===w?void 0:w.showBelowRef)||void 0===g?void 0:g.current;(!A||A.getBoundingClientRect().top>m.current.getBoundingClientRect().top)&&(c=!0,s=m)}}}),e.id&&r&&(l&&(t[e.id]=t[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},t[e.id].showAbove=l,t[e.id].showAboveRef=d,t[e.id].firstDeviationRef=a,t[e.id].firstDeviationPosition=h,t[e.id].columnKey="right"),c&&(t[e.id]=t[e.id]||{showAbove:!1,showAboveRef:null,showBelow:!1,showBelowRef:null,firstDeviationRef:null,firstDeviationPosition:null,columnKey:"right"},t[e.id].showBelow=c,t[e.id].showBelowRef=s,t[e.id].firstDeviationRef=a,t[e.id].firstDeviationPosition=h,t[e.id].columnKey="right"))}),t})},100),n(),null==o||o.addEventListener("scroll",n)},0);return function(){clearTimeout(i),n&&o.removeEventListener("scroll",n)}}}},[d,s,v,f,a,h,w,R,p]);var D=t(function(e,o){var n,i;if(e){var t=h.current;if(a&&((null===(n=w.current)||void 0===n?void 0:n.contains(e))?t=w.current:(null===(i=g.current)||void 0===i?void 0:i.contains(e))&&(t=g.current)),t){var l=e.getBoundingClientRect(),u=t.getBoundingClientRect(),c=u.top+.7*u.height;if(l.bottom>c){var d=.6*u.height,s=250;if(a){var v=w.current,f=g.current;v&&f?(r(f,f.scrollTop+d,s),r(v,v.scrollTop+d,s,o)):v?r(v,v.scrollTop+d,s,o):f?r(f,f.scrollTop+d,s,o):o()}else h.current?r(h.current,h.current.scrollTop+d,s,o):o()}else o()}else o()}else o()},[a]);return{showDeviationNavigation:m,showOpenNodeRef:C,adjustScrollForPopup:D}};export{c as useDeviationNavigation};
2
2
  //# sourceMappingURL=useDeviationNavigation.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viswa-test/test-citation",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "author": "Viswa Koduru",
5
5
  "description": "",
6
6
  "license": "MIT",