@ehfuse/overlay-scrollbar 1.7.33 → 1.7.35
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDragScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragScroll.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,kBAAkB;IACxB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,qBAAqB,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,aAAa,GAAI,qIAS3B,kBAAkB;;mCAeL,KAAK,CAAC,UAAU;
|
|
1
|
+
{"version":3,"file":"useDragScroll.d.ts","sourceRoot":"","sources":["../../src/hooks/useDragScroll.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,UAAU,kBAAkB;IACxB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,qBAAqB,EAAE,MAAM,WAAW,GAAG,IAAI,CAAC;IAChD,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,mBAAmB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAChD,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,aAAa,GAAI,qIAS3B,kBAAkB;;mCAeL,KAAK,CAAC,UAAU;CAiI/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePullToRefresh.d.ts","sourceRoot":"","sources":["../../src/hooks/usePullToRefresh.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,UAAU,qBAAqB;IAC3B,YAAY,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AAED,UAAU,sBAAsB;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,GAAI,2BAG9B,qBAAqB,KAAG,
|
|
1
|
+
{"version":3,"file":"usePullToRefresh.d.ts","sourceRoot":"","sources":["../../src/hooks/usePullToRefresh.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,UAAU,qBAAqB;IAC3B,YAAY,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,mBAAmB,CAAC;CAC/B;AAED,UAAU,sBAAsB;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,mCAAmC;AACnC,eAAO,MAAM,gBAAgB,GAAI,2BAG9B,qBAAqB,KAAG,sBAgM1B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useRef as R,useEffect as O,useState as v,useCallback as g,useMemo as he,forwardRef as mo,useImperativeHandle as ho,useLayoutEffect as bo,useId as go}from"react";var io=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],Ae=(r,s)=>{if(r instanceof HTMLElement&&r.isContentEditable||r.closest('[role="textbox"],[role="searchbox"]'))return!0;let f=r.tagName.toLowerCase();if(f==="input"){let c=(r.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(c)}if(["textarea","select","button"].includes(f)||["svg","path","circle","rect","line","polygon","polyline"].includes(f)||r.getAttribute("contenteditable")==="true")return!0;if(s?.excludeSelectors){for(let c of s.excludeSelectors)if(r.matches(c))return!0}return ao(r,s)},ao=(r,s)=>{if(r.closest('[data-drag-scroll="off"]'))return!0;let f=[...io,...s?.excludeClasses||[]],c=r,H=0,S=5;for(;c&&H<=S;){if(f.some(P=>c.classList.contains(P)))return!0;if(c.classList.contains("MuiDialogContent-root"))break;c=c.parentElement,H++}return!1};var so=r=>{if(r==null)return null;if(typeof r=="number")return Number.isFinite(r)?r:null;let s=r.trim();if(s==="")return null;let f=/^(-?\d*\.?\d+)(px)?$/.exec(s);if(!f)return null;let c=Number.parseFloat(f[1]);return Number.isFinite(c)?c:null},co=r=>{if(r==null)return;if(typeof r=="number")return r;let s=r.trim().split(/\s+/);if(!(s.length===0||s[0]===""))return s.length===1||s.length===2?s[0]:s[2]},uo=r=>{let s=typeof r=="number"?[`${r}px`]:r.trim().split(/\s+/),[f,c=f,H=f,S=c]=s;return`${f} ${c} 0 ${S}`},nt=r=>{if(!r)return{style:r,spacerHeight:0};let s=r.paddingBottom!==void 0,f=r.padding!==void 0;if(!s&&!f)return{style:r,spacerHeight:0};let c=s?r.paddingBottom:co(r.padding),H=so(c);if(H===null||H<=0)return{style:r,spacerHeight:0};let S={...r};return f&&r.padding!==void 0&&(S.padding=uo(r.padding)),s&&(S.paddingBottom=0),{style:S,spacerHeight:H}};import{useEffect as Mt,useRef as re,useState as Ct}from"react";var Ht=({containerRef:r,config:s})=>{let f=s.enabled??!0,c=s.threshold??80,H=s.maxDistance??c*2,S=s.onRefresh,[P,I]=Ct(0),[A,X]=Ct(!1),B=re(0),be=re(0),Y=re(!1),Q=re(!1),ne=re(!1),j=re(0),le=re(!1);return Mt(()=>{le.current=A},[A]),Mt(()=>{let w=r.current;if(!w||!(f&&typeof S=="function"))return;let Le=p=>{let D=p instanceof Element?p:null;for(;D&&D!==w;){if(D instanceof HTMLElement&&D.scrollHeight>D.clientHeight+1&&D.scrollTop>0)return!1;D=D.parentElement}return!0},We=p=>{Y.current=!1,Q.current=!1,ne.current=!1,!le.current&&p.touches.length===1&&w.scrollTop===0&&Le(p.target)&&(Y.current=!0,B.current=p.touches[0].clientY,be.current=p.touches[0].clientX)},J=p=>{if(!Y.current||le.current||p.touches.length!==1)return;let D=p.touches[0].clientY-B.current,Be=p.touches[0].clientX-be.current;if(!Q.current){if(D<=0||w.scrollTop>0){Y.current=!1;return}if(D>8&&D>Math.abs(Be))Q.current=!0,ne.current=w.scrollTop<0;else return}!ne.current&&p.cancelable&&p.preventDefault();let ae=Math.min(Math.max(D,0)*.5,H);j.current=ae,I(ae)},G=()=>{if(!Y.current||(Y.current=!1,!Q.current))return;Q.current=!1,ne.current=!1;let p=j.current;j.current=0,p>=c&&!le.current?(X(!0),I(c),Promise.resolve().then(()=>S()).catch(()=>{}).finally(()=>{X(!1),I(0)})):I(0)};return w.addEventListener("touchstart",We,{passive:!0}),w.addEventListener("touchmove",J,{passive:!1}),w.addEventListener("touchend",G,{passive:!0}),w.addEventListener("touchcancel",G,{passive:!0}),()=>{w.removeEventListener("touchstart",We),w.removeEventListener("touchmove",J),w.removeEventListener("touchend",G),w.removeEventListener("touchcancel",G)}},[r,f,S,c,H]),{pullDistance:P,isRefreshing:A,pullProgress:Math.min(P/c,1),pullThreshold:c}};import{useEffect as fo,useState as po}from"react";function Lt(){let[r,s]=po(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(pointer: coarse)").matches);return fo(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let f=window.matchMedia("(pointer: coarse)"),c=H=>s(H.matches);return s(f.matches),typeof f.addEventListener=="function"?(f.addEventListener("change",c),()=>f.removeEventListener("change",c)):(f.addListener(c),()=>f.removeListener(c))},[]),r}import{jsx as k,jsxs as He}from"react/jsx-runtime";var vo={},yo={},xo={},To={},wo={},So={},Eo=mo(({className:r="",style:s={},containerStyle:f={},contentStyle:c={},children:H,onScroll:S,thumb:P=vo,track:I=yo,arrows:A=xo,dragScroll:X=To,autoHide:B=wo,pullToRefresh:be=So,showScrollbar:Y=!0,showHorizontalScrollbar:Q=!0,detectInnerScroll:ne=!1,scrollTopFab:j=!1},le)=>{let w=Lt(),ie=Y,Le=w?!1:Q,J=`os-${go().replace(/[^a-zA-Z0-9_-]/g,"")}`,G=j!==!1&&j!=null,p=typeof j=="object"?j:{},D=p.threshold??600,Be=p.idleOpacity??p.scrollingOpacity??.45,ae=p.hideDelay??1500,Dt=p.position??"right",lt=p.offset??16,kt=p.offsetBottom??lt,Pt=p.background??"#1976d2",It=p.color??"#ffffff",Re=p.size??48,[Fe,it]=v(!1),[$t,ge]=v(!1),ee=R(null),Ot=R({});O(()=>{Ot.current={children:H,onScroll:S,showScrollbar:ie,showHorizontalScrollbar:Le,thumb:P,track:I,arrows:A,dragScroll:X,autoHide:B}});let Ne=R(null),a=R(null),ve=R(null),ye=R(null),zt=R(null),N=R(null),{pullDistance:Ue,isRefreshing:De,pullProgress:_e}=Ht({containerRef:a,config:be}),at=be.indicatorColor??"#1976d2",At=Ue>0||De,[ke,E]=v(!1),[U,st]=v(!1),[ct,ut]=v(!1),[qe,Wt]=v({y:0,scrollTop:0}),[xe,dt]=v(0),[Bt,Xe]=v(0),[se,ft]=v(!1),[pt,mt]=v(!1),[_,ht]=v(!1),[Ye,Ft]=v({x:0,scrollLeft:0}),[je,bt]=v(0),[Ge,gt]=v(0),[Nt,vt]=v(!1),ce=R(!1),[ue,yt]=v(!1),Ke=R(!1),[Te,Ut]=v({x:0,y:0,scrollTop:0,scrollLeft:0}),[Mo,Co]=v(null),[Pe,Ie]=v(null),[Ho,_t]=v(!1),[qt,Xt]=v(0),we=R(null),Ve=R(!1),Se=R(null),te=R(null),oe=R(null),M=he(()=>{let e=P.color??"#606060";return{width:P.width??8,minHeight:P.minHeight??50,radius:P.radius??(P.width??8)/2,color:e,opacity:P.opacity??.6,hoverColor:P.hoverColor??e,hoverOpacity:P.hoverOpacity??1}},[P]),l=he(()=>({width:I.width??16,color:I.color??"rgba(128, 128, 128, 0.1)",visible:I.visible??!0,alignment:I.alignment??"outside",radius:I.radius??M.radius??4,margin:I.margin??4,overflowX:I.overflowX??!0,overflowY:I.overflowY??!0}),[I,M.radius]),F=he(()=>{let e=A.color??"#808080";return{visible:A.visible??!1,step:A.step??50,color:e,opacity:A.opacity??.6,hoverColor:A.hoverColor??e,hoverOpacity:A.hoverOpacity??1}},[A]),Ee=he(()=>({enabled:w?!1:X.enabled??!0,excludeClasses:X.excludeClasses??[],excludeSelectors:X.excludeSelectors??[]}),[X,w]),u=he(()=>({enabled:B.enabled??!0,delay:B.delay??1500,delayOnWheel:B.delayOnWheel??700,initialDelay:B.initialDelay??200}),[B]),[de,Yt]=v(()=>(B.initialDelay??200)>0),x=M.width,jt=l.width,Ze=M.minHeight,q=F.visible,$e=F.step,W=g(()=>{if(!a.current)return;let e=document.activeElement;e&&a.current.contains(e)&&e!==a.current||a.current.focus()},[]);ho(le,()=>({getScrollContainer:()=>a.current,scrollTo:e=>{a.current&&a.current.scrollTo(e)},get scrollTop(){return a.current?.scrollTop||0},get scrollHeight(){return a.current?.scrollHeight||0},get clientHeight(){return a.current?.clientHeight||0}}),[]);let h=g(()=>{if(N.current){let t=N.current;if(document.contains(t)&&(t.scrollHeight>t.clientHeight+2||t.scrollWidth>t.clientWidth+2))return t;N.current=null}if(!a.current)return null;if(a.current.scrollHeight>a.current.clientHeight+2||a.current.scrollWidth>a.current.clientWidth+2)return N.current=a.current,a.current;if(!ne)return null;let e=a.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let t of e){let o=t;if(o!==a.current&&o.classList.contains("overlay-scrollbar-container"))continue;let i=o.parentElement,n=!1;for(;i&&i!==a.current;){if(i.classList.contains("overlay-scrollbar-container")&&i!==a.current){n=!0;break}i=i.parentElement}if(!n&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return N.current=o,o}return null},[]),K=g(()=>h()!==null,[h]),C=g(()=>{Se.current&&(clearTimeout(Se.current),Se.current=null)},[]),Oe=g(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),xt=g(()=>{oe.current&&(clearTimeout(oe.current),oe.current=null)},[]),Gt=g(()=>{Oe(),!(U||_||ue||ce.current)&&(C(),E(!1))},[C,Oe,U,_,ue]),y=g(e=>{u.enabled&&(C(),Se.current=setTimeout(()=>{E(!1),Se.current=null},e))},[C,u.enabled]),m=g(()=>{let e=h()??a.current;if(!e){E(!1),ft(!1),vt(!1),C();return}!u.enabled&&!de&&(E(!0),C());let t=e.clientHeight,o=e.scrollHeight,i=e.scrollTop,n=e.clientWidth,d=e.scrollWidth,T=e.scrollLeft,L=o-t>0,b=d-n>0,pe=L||b;ft(L),vt(b),pe||(E(!1),C());let Me=0,z=0;if(Ne.current){let V=window.getComputedStyle(Ne.current),Z=parseFloat(V.paddingTop)||0;z=parseFloat(V.paddingBottom)||0,Me=Z+z,Xt(z)}if(L){let V=q?x*2+l.margin*4:l.margin*2,Z=t-V+Me,ze=t/o,me=Math.max(Z*ze,Ze),Et=o-t,no=Z-me,lo=Et>0?i/Et*no:0;dt(me),Xe(lo)}else dt(0),Xe(0);let Ce=d-n;if(Ce>0){let V=n/d,Z=Math.max(n*V,50),ze=n-Z,me=Ce>0?T/Ce*ze:0;bt(Z),gt(me)}else bt(0),gt(0)},[h,C,q,x,Ze,u.enabled,de]),Kt=g(e=>{e.preventDefault(),e.stopPropagation();let t=h();t&&(st(!0),Wt({y:e.clientY,scrollTop:t.scrollTop}),C(),E(!0),W())},[h,C,W]),Qe=g(e=>{if(!U)return;let t=h();if(!t)return;let o=t.clientHeight,n=t.scrollHeight-o,d=e.clientY-qe.y,T=o-xe,L=d/T*n,b=Math.max(0,Math.min(n,qe.scrollTop+L));t.scrollTop=b,m()},[U,qe,xe,m,h]),Je=g(()=>{st(!1),K()&&y(u.delay)},[K,y,u.delay]),Vt=g(e=>{if(!ye.current)return;let o=ye.current.getBoundingClientRect(),i=e.clientY-o.top,n=h();if(!n)return;let d=n.clientHeight,T=n.scrollHeight,b=i/d*(T-d);n.scrollTop=Math.max(0,Math.min(T-d,b)),m(),E(!0),y(u.delay),W()},[m,y,u.delay,h,W]),Zt=g(e=>{if(e.preventDefault(),e.stopPropagation(),!a.current)return;let t=Math.max(0,a.current.scrollTop-$e);a.current.scrollTop=t,m(),E(!0),y(u.delay),W()},[m,y,$e,u.delay,W]),Qt=g(e=>{if(e.preventDefault(),e.stopPropagation(),!a.current||!ve.current)return;let t=a.current,i=ve.current.scrollHeight-t.clientHeight,n=Math.min(i,t.scrollTop+$e);t.scrollTop=n,m(),E(!0),y(u.delay),W()},[m,y,$e,u.delay,W]),Jt=g(e=>{e.preventDefault(),e.stopPropagation();let t=h();t&&(ht(!0),Ft({x:e.clientX,scrollLeft:t.scrollLeft}),C(),E(!0),W())},[h,C,W]),et=g(e=>{if(!_)return;let t=h();if(!t)return;let o=t.clientWidth,n=t.scrollWidth-o,d=e.clientX-Ye.x,T=o-je,L=d/T*n,b=Math.max(0,Math.min(n,Ye.scrollLeft+L));t.scrollLeft=b,m()},[_,Ye,je,m,h]),tt=g(()=>{ht(!1),K()&&y(u.delay)},[K,y,u.delay]),eo=g(e=>{if(!ye.current)return;let o=ye.current.getBoundingClientRect(),i=e.clientX-o.left,n=h();if(!n)return;let d=n.clientWidth,T=n.scrollWidth,b=i/d*(T-d);n.scrollLeft=Math.max(0,Math.min(T-d,b)),m(),E(!0),y(u.delay),W()},[m,y,u.delay,h,W]),to=g(e=>{if(!Ee.enabled||e.defaultPrevented)return;let t=e.target,o=a.current;if(!o||!o.contains(t)||Ae(t,Ee)||e.button!==0)return;let i=h();if(!i||i.scrollHeight<=i.clientHeight&&i.scrollWidth<=i.clientWidth)return;e.preventDefault();let n=document.activeElement;n instanceof HTMLElement&&n!==document.body&&!n.contains(t)&&n.blur(),ce.current=!0,Ut({x:e.clientX,y:e.clientY,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft||0})},[Ee,Ae,h]),ot=g(e=>{if(!ce.current&&!ue)return;let t=h();if(!t)return;let o=Te.x-e.clientX,i=Te.y-e.clientY;if(Math.abs(i)<5&&Math.abs(o)<5)return;ce.current&&(ce.current=!1,Ke.current=!0,yt(!0)),E(!0);let n=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,Te.scrollTop+i)),d=Math.max(0,Math.min(t.scrollWidth-t.clientWidth,Te.scrollLeft+o));t.scrollTop=n,t.scrollLeft=d,m()},[ue,Te,h,m]),rt=g(()=>{let e=Ke.current;ce.current=!1,Ke.current=!1,yt(!1),e&&K()&&y(u.delay)},[K,y,u.delay]);O(()=>{let e=d=>{if(m(),G){let b=(d.target?.scrollTop??0)>D;it(b),ee.current&&(clearTimeout(ee.current),ee.current=null),b&&ae>0&&(ee.current=setTimeout(()=>{ee.current=null,it(!1)},ae))}if(de){S&&S(d);return}C(),E(!0),xt();let T=Ve.current?u.delayOnWheel:u.delay;y(T),S&&S(d)},t=()=>{Ve.current=!0,we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{Ve.current=!1},300),xt(),oe.current=setTimeout(()=>{E(!0),oe.current=null,y(u.delayOnWheel)},50)},o=[],i=h();i&&o.push(i);let n=a.current;return n&&!i&&(o.push(n),n.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(T=>{let L=T;if(L!==n&&L.classList.contains("overlay-scrollbar-container"))return;let b=L.parentElement;for(;b&&b!==n;){if(b.classList.contains("overlay-scrollbar-container")&&b!==n)return;b=b.parentElement}o.push(L)})),o.forEach(d=>{d.addEventListener("scroll",e,{passive:!0}),d.addEventListener("wheel",t,{passive:!0})}),()=>{o.forEach(d=>{d.removeEventListener("scroll",e),d.removeEventListener("wheel",t)})}},[h,m,S,C,y,u,de,G,D,ae]),O(()=>()=>{ee.current&&clearTimeout(ee.current),we.current&&clearTimeout(we.current),oe.current&&clearTimeout(oe.current)},[]),O(()=>{let e=o=>{let i=o.target;if(o.defaultPrevented||i instanceof Element&&Ae(i,Ee))return;let n=h();if(!n)return;let{key:d}=o,{scrollTop:T,scrollHeight:L,clientHeight:b}=n,pe=L-b,Me=50,z=null;switch(d){case"ArrowUp":o.preventDefault(),z=Math.max(0,T-Me);break;case"ArrowDown":o.preventDefault(),z=Math.min(pe,T+Me);break;case"PageUp":o.preventDefault(),z=Math.max(0,T-b);break;case"PageDown":o.preventDefault(),z=Math.min(pe,T+b);break;case"Home":o.preventDefault(),z=0;break;case"End":o.preventDefault(),z=pe;break;default:return}if(z!==null){let Ce=z/pe,V=q?x*2+l.margin*4:l.margin*2,me=(b-V-xe)*Ce;Xe(me),n.scrollTop=z,C(),E(!0),y(u.delay)}},t=a.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[h,q,x,l.margin,xe,C,y,u.delay,Ee]),O(()=>(document.addEventListener("mousemove",ot),document.addEventListener("mouseup",rt),()=>{document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",rt)}),[ue,ot,rt]),O(()=>{if(U)return document.addEventListener("mousemove",Qe),document.addEventListener("mouseup",Je),()=>{document.removeEventListener("mousemove",Qe),document.removeEventListener("mouseup",Je)}},[U,Qe,Je]),O(()=>{if(_)return document.addEventListener("mousemove",et),document.addEventListener("mouseup",tt),()=>{document.removeEventListener("mousemove",et),document.removeEventListener("mouseup",tt)}},[_,et,tt]),O(()=>{m();let e=setTimeout(()=>{m()},100);return()=>clearTimeout(e)},[m]),bo(()=>{_t(!0),m(),!u.enabled&&!de&&K()&&E(!0)},[K,m,u.enabled,de]),O(()=>{if(u.initialDelay>0){let e=setTimeout(()=>{Yt(!1)},u.initialDelay);return()=>clearTimeout(e)}},[u.initialDelay]);let Tt=R(m);Tt.current=m;let fe=R(null),wt=g(()=>{fe.current===null&&(fe.current=requestAnimationFrame(()=>{fe.current=null,Tt.current()}))},[]);O(()=>()=>{fe.current!==null&&(cancelAnimationFrame(fe.current),fe.current=null)},[]),O(()=>{let e=new ResizeObserver(()=>{wt()}),t=[];return a.current&&t.push(a.current),ve.current&&t.push(ve.current),N.current&&document.contains(N.current)&&t.push(N.current),t.forEach(o=>{e.observe(o)}),()=>e.disconnect()},[m,wt]),O(()=>{if(!a.current)return;let e=new MutationObserver(()=>{N.current=null,m()});return e.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[m]);let $=Math.max(jt,x);O(()=>{let e="overlay-scrollbar-shared";if(document.getElementById(e))return;let t=document.createElement("style");t.id=e,t.textContent=`
|
|
1
|
+
import{useRef as D,useEffect as A,useState as g,useCallback as b,useMemo as be,forwardRef as ho,useImperativeHandle as mo,useLayoutEffect as bo,useId as go}from"react";var io=["editor","textarea","input","select","textfield","form-control","contenteditable","MuiInputBase-input","MuiSelect-select","MuiOutlinedInput-input","MuiFilledInput-input","MuiInput-input","MuiFormControl-root","MuiTextField-root","MuiSelect-root","MuiOutlinedInput-root","MuiFilledInput-root","MuiInput-root","MuiAutocomplete-input","MuiDatePicker-input","MuiSlider-thumb","MuiSlider-rail","MuiSlider-track","MuiSlider-mark","MuiSlider-markLabel","MuiSlider-root","MuiSlider-colorPrimary","MuiSlider-sizeMedium","MuiIconButton-root","MuiButton-root","MuiButtonBase-root","MuiTouchRipple-root","MuiCheckbox-root","MuiRadio-root","MuiSwitch-root","PrivateSwitchBase-root","ant-input","ant-input-affix-wrapper","ant-input-group-addon","ant-input-number","ant-input-number-handler","ant-select","ant-select-selector","ant-select-selection-search","ant-select-dropdown","ant-cascader","ant-cascader-input","ant-picker","ant-picker-input","ant-time-picker","ant-calendar-picker","ant-slider","ant-slider-track","ant-slider-handle","ant-switch","ant-checkbox","ant-checkbox-wrapper","ant-radio","ant-radio-wrapper","ant-rate","ant-upload","ant-upload-drag","ant-form-item","ant-form-item-control","ant-btn","ant-dropdown","ant-dropdown-trigger","ant-menu","ant-menu-item","ant-tooltip","ant-popover","ant-modal","ant-drawer","ant-tree-select","ant-auto-complete","ant-mentions","ant-transfer","ui-input","ui-textarea","ui-select","ui-select-trigger","ui-select-content","ui-select-item","ui-button","ui-checkbox","ui-radio-group","ui-switch","ui-slider","ui-range-slider","ui-calendar","ui-date-picker","ui-combobox","ui-command","ui-command-input","ui-popover","ui-dialog","ui-sheet","ui-dropdown-menu","ui-context-menu","ui-menubar","ui-navigation-menu","ui-form","ui-form-control","ui-form-item","ui-form-field","ui-label","radix-ui","radix-select","radix-dropdown","radix-dialog","radix-popover","radix-accordion","radix-tabs","radix-slider","radix-switch","radix-checkbox","radix-radio","ql-editor","ql-container","ql-toolbar","ql-picker","ql-picker-label","ql-picker-options","ql-formats","ql-snow","ql-bubble","quill","quilleditor","monaco-editor","monaco-editor-background","view-lines","decorationsOverviewRuler","monaco-scrollable-element","CodeMirror","CodeMirror-code","CodeMirror-lines","CodeMirror-scroll","CodeMirror-sizer","cm-editor","cm-focused","cm-content","tox-editor-container","tox-editor-header","tox-edit-area","tox-tinymce","mce-content-body","ck-editor","ck-content","ck-toolbar","ck-editor__editable","ck-widget","slate-editor","slate-content","DraftEditor-root","DraftEditor-editorContainer","public-DraftEditor-content","ehfuse-editor","ehfuse-editor-wrapper","ehfuse-editor-content","ehfuse-toolbar","ehfuse-toolbar-group","ehfuse-cursor","text-editor","rich-text-editor","wysiwyg","ace_editor","ace_content"],Ne=(r,s)=>{if(r instanceof HTMLElement&&r.isContentEditable||r.closest('[role="textbox"],[role="searchbox"]'))return!0;let f=r.tagName.toLowerCase();if(f==="input"){let c=(r.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(c)}if(["textarea","select","button"].includes(f)||["svg","path","circle","rect","line","polygon","polyline"].includes(f)||r.getAttribute("contenteditable")==="true")return!0;if(s?.excludeSelectors){for(let c of s.excludeSelectors)if(r.matches(c))return!0}return ao(r,s)},ao=(r,s)=>{if(r.closest('[data-drag-scroll="off"]'))return!0;let f=[...io,...s?.excludeClasses||[]],c=r,L=0,E=5;for(;c&&L<=E;){if(f.some(P=>c.classList.contains(P)))return!0;if(c.classList.contains("MuiDialogContent-root"))break;c=c.parentElement,L++}return!1};var so=r=>{if(r==null)return null;if(typeof r=="number")return Number.isFinite(r)?r:null;let s=r.trim();if(s==="")return null;let f=/^(-?\d*\.?\d+)(px)?$/.exec(s);if(!f)return null;let c=Number.parseFloat(f[1]);return Number.isFinite(c)?c:null},co=r=>{if(r==null)return;if(typeof r=="number")return r;let s=r.trim().split(/\s+/);if(!(s.length===0||s[0]===""))return s.length===1||s.length===2?s[0]:s[2]},uo=r=>{let s=typeof r=="number"?[`${r}px`]:r.trim().split(/\s+/),[f,c=f,L=f,E=c]=s;return`${f} ${c} 0 ${E}`},st=r=>{if(!r)return{style:r,spacerHeight:0};let s=r.paddingBottom!==void 0,f=r.padding!==void 0;if(!s&&!f)return{style:r,spacerHeight:0};let c=s?r.paddingBottom:co(r.padding),L=so(c);if(L===null||L<=0)return{style:r,spacerHeight:0};let E={...r};return f&&r.padding!==void 0&&(E.padding=uo(r.padding)),s&&(E.paddingBottom=0),{style:E,spacerHeight:L}};import{useEffect as Lt,useRef as ne,useState as Rt}from"react";var Dt=({containerRef:r,config:s})=>{let f=s.enabled??!0,c=s.threshold??80,L=s.maxDistance??c*2,E=s.onRefresh,[P,I]=Rt(0),[W,j]=Rt(!1),F=ne(0),ge=ne(0),U=ne(!1),J=ne(!1),le=ne(!1),G=ne(0),ie=ne(!1);return Lt(()=>{ie.current=W},[W]),Lt(()=>{let v=r.current;if(!v||!(f&&typeof E=="function"))return;let De=S=>{let y=S instanceof Element?S:null;for(;y&&y!==v;){if(y instanceof HTMLElement&&y.scrollHeight>y.clientHeight+1&&y.scrollTop>0)return!1;y=y.parentElement}return!0},Ue=S=>{U.current=!1,J.current=!1,le.current=!1,!ie.current&&S.touches.length===1&&v.scrollTop===0&&De(S.target)&&(U.current=!0,F.current=S.touches[0].clientY,ge.current=S.touches[0].clientX)},ee=S=>{if(!U.current||ie.current||S.touches.length!==1)return;let y=S.touches[0].clientY-F.current,_e=S.touches[0].clientX-ge.current;if(!J.current){if(y<=0||v.scrollTop>0){U.current=!1;return}if(y>8&&y>Math.abs(_e))J.current=!0,le.current=v.scrollTop<0;else return}!le.current&&S.cancelable&&S.preventDefault();let Pe=Math.min(Math.max(y,0)*.5,L);G.current=Pe,I(Pe)},K=()=>{if(!U.current||(U.current=!1,!J.current))return;J.current=!1,le.current=!1;let S=G.current;G.current=0,S>=c&&!ie.current?(j(!0),I(c),Promise.resolve().then(()=>E()).catch(()=>{}).finally(()=>{j(!1),I(0)})):I(0)},$=!1,ve=()=>{$||(v.addEventListener("touchmove",ee,{passive:!1}),$=!0)},ke=()=>{$&&(v.removeEventListener("touchmove",ee),$=!1)},se=S=>{let y=S.target;y instanceof HTMLElement&&(y.scrollHeight<=y.clientHeight+1||(y.scrollTop<=0?ve():U.current||ke()))};return ve(),v.addEventListener("scroll",se,{passive:!0,capture:!0}),v.addEventListener("touchstart",Ue,{passive:!0}),v.addEventListener("touchend",K,{passive:!0}),v.addEventListener("touchcancel",K,{passive:!0}),()=>{v.removeEventListener("touchstart",Ue),ke(),v.removeEventListener("scroll",se,{capture:!0}),v.removeEventListener("touchend",K),v.removeEventListener("touchcancel",K)}},[r,f,E,c,L]),{pullDistance:P,isRefreshing:W,pullProgress:Math.min(P/c,1),pullThreshold:c}};import{useEffect as fo,useState as po}from"react";function kt(){let[r,s]=po(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(pointer: coarse)").matches);return fo(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let f=window.matchMedia("(pointer: coarse)"),c=L=>s(L.matches);return s(f.matches),typeof f.addEventListener=="function"?(f.addEventListener("change",c),()=>f.removeEventListener("change",c)):(f.addListener(c),()=>f.removeListener(c))},[]),r}import{jsx as k,jsxs as Re}from"react/jsx-runtime";var vo={},yo={},xo={},To={},wo={},So={},Eo=ho(({className:r="",style:s={},containerStyle:f={},contentStyle:c={},children:L,onScroll:E,thumb:P=vo,track:I=yo,arrows:W=xo,dragScroll:j=To,autoHide:F=wo,pullToRefresh:ge=So,showScrollbar:U=!0,showHorizontalScrollbar:J=!0,detectInnerScroll:le=!1,scrollTopFab:G=!1},ie)=>{let v=kt(),ae=U,De=v?!1:J,ee=`os-${go().replace(/[^a-zA-Z0-9_-]/g,"")}`,K=G!==!1&&G!=null,$=typeof G=="object"?G:{},ve=$.threshold??600,ke=$.idleOpacity??$.scrollingOpacity??.45,se=$.hideDelay??1500,S=$.position??"right",y=$.offset??16,_e=$.offsetBottom??y,Pe=$.background??"#1976d2",It=$.color??"#ffffff",Ie=$.size??48,[qe,ct]=g(!1),[$t,ye]=g(!1),te=D(null),Ot=D({});A(()=>{Ot.current={children:L,onScroll:E,showScrollbar:ae,showHorizontalScrollbar:De,thumb:P,track:I,arrows:W,dragScroll:j,autoHide:F}});let Xe=D(null),a=D(null),xe=D(null),Te=D(null),At=D(null),_=D(null),{pullDistance:Ye,isRefreshing:$e,pullProgress:je}=Dt({containerRef:a,config:ge}),ut=ge.indicatorColor??"#1976d2",zt=Ye>0||$e,[Oe,M]=g(!1),[q,dt]=g(!1),[ft,pt]=g(!1),[Ge,Wt]=g({y:0,scrollTop:0}),[we,ht]=g(0),[Bt,Ke]=g(0),[ce,mt]=g(!1),[bt,gt]=g(!1),[X,vt]=g(!1),[Ve,Ft]=g({x:0,scrollLeft:0}),[Ze,yt]=g(0),[Qe,xt]=g(0),[Nt,Tt]=g(!1),ue=D(!1),[de,wt]=g(!1),Je=D(!1),[Se,Ut]=g({x:0,y:0,scrollTop:0,scrollLeft:0}),[Mo,Co]=g(null),[Ae,ze]=g(null),[Ho,_t]=g(!1),[qt,Xt]=g(0),Ee=D(null),et=D(!1),Me=D(null),oe=D(null),re=D(null),C=be(()=>{let e=P.color??"#606060";return{width:P.width??8,minHeight:P.minHeight??50,radius:P.radius??(P.width??8)/2,color:e,opacity:P.opacity??.6,hoverColor:P.hoverColor??e,hoverOpacity:P.hoverOpacity??1}},[P]),l=be(()=>({width:I.width??16,color:I.color??"rgba(128, 128, 128, 0.1)",visible:I.visible??!0,alignment:I.alignment??"outside",radius:I.radius??C.radius??4,margin:I.margin??4,overflowX:I.overflowX??!0,overflowY:I.overflowY??!0}),[I,C.radius]),N=be(()=>{let e=W.color??"#808080";return{visible:W.visible??!1,step:W.step??50,color:e,opacity:W.opacity??.6,hoverColor:W.hoverColor??e,hoverOpacity:W.hoverOpacity??1}},[W]),Ce=be(()=>({enabled:v?!1:j.enabled??!0,excludeClasses:j.excludeClasses??[],excludeSelectors:j.excludeSelectors??[]}),[j,v]),u=be(()=>({enabled:F.enabled??!0,delay:F.delay??1500,delayOnWheel:F.delayOnWheel??700,initialDelay:F.initialDelay??200}),[F]),[fe,Yt]=g(()=>(F.initialDelay??200)>0),T=C.width,jt=l.width,tt=C.minHeight,Y=N.visible,We=N.step,B=b(()=>{if(!a.current)return;let e=document.activeElement;e&&a.current.contains(e)&&e!==a.current||a.current.focus()},[]);mo(ie,()=>({getScrollContainer:()=>a.current,scrollTo:e=>{a.current&&a.current.scrollTo(e)},get scrollTop(){return a.current?.scrollTop||0},get scrollHeight(){return a.current?.scrollHeight||0},get clientHeight(){return a.current?.clientHeight||0}}),[]);let h=b(()=>{if(_.current){let t=_.current;if(document.contains(t)&&(t.scrollHeight>t.clientHeight+2||t.scrollWidth>t.clientWidth+2))return t;_.current=null}if(!a.current)return null;if(a.current.scrollHeight>a.current.clientHeight+2||a.current.scrollWidth>a.current.clientWidth+2)return _.current=a.current,a.current;if(!le)return null;let e=a.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let t of e){let o=t;if(o!==a.current&&o.classList.contains("overlay-scrollbar-container"))continue;let i=o.parentElement,n=!1;for(;i&&i!==a.current;){if(i.classList.contains("overlay-scrollbar-container")&&i!==a.current){n=!0;break}i=i.parentElement}if(!n&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return _.current=o,o}return null},[]),V=b(()=>h()!==null,[h]),H=b(()=>{Me.current&&(clearTimeout(Me.current),Me.current=null)},[]),Be=b(()=>{oe.current&&(clearTimeout(oe.current),oe.current=null)},[]),St=b(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),Gt=b(()=>{Be(),!(q||X||de||ue.current)&&(H(),M(!1))},[H,Be,q,X,de]),x=b(e=>{u.enabled&&(H(),Me.current=setTimeout(()=>{M(!1),Me.current=null},e))},[H,u.enabled]),p=b(()=>{let e=h()??a.current;if(!e){M(!1),mt(!1),Tt(!1),H();return}!u.enabled&&!fe&&(M(!0),H());let t=e.clientHeight,o=e.scrollHeight,i=e.scrollTop,n=e.clientWidth,d=e.scrollWidth,w=e.scrollLeft,R=o-t>0,m=d-n>0,he=R||m;mt(R),Tt(m),he||(M(!1),H());let He=0,z=0;if(Xe.current){let Z=window.getComputedStyle(Xe.current),Q=parseFloat(Z.paddingTop)||0;z=parseFloat(Z.paddingBottom)||0,He=Q+z,Xt(z)}if(R){let Z=Y?T*2+l.margin*4:l.margin*2,Q=t-Z+He,Fe=t/o,me=Math.max(Q*Fe,tt),Ht=o-t,no=Q-me,lo=Ht>0?i/Ht*no:0;ht(me),Ke(lo)}else ht(0),Ke(0);let Le=d-n;if(Le>0){let Z=n/d,Q=Math.max(n*Z,50),Fe=n-Q,me=Le>0?w/Le*Fe:0;yt(Q),xt(me)}else yt(0),xt(0)},[h,H,Y,T,tt,u.enabled,fe]),Kt=b(e=>{e.preventDefault(),e.stopPropagation();let t=h();t&&(dt(!0),Wt({y:e.clientY,scrollTop:t.scrollTop}),H(),M(!0),B())},[h,H,B]),ot=b(e=>{if(!q)return;let t=h();if(!t)return;let o=t.clientHeight,n=t.scrollHeight-o,d=e.clientY-Ge.y,w=o-we,R=d/w*n,m=Math.max(0,Math.min(n,Ge.scrollTop+R));t.scrollTop=m,p()},[q,Ge,we,p,h]),rt=b(()=>{dt(!1),V()&&x(u.delay)},[V,x,u.delay]),Vt=b(e=>{if(!Te.current)return;let o=Te.current.getBoundingClientRect(),i=e.clientY-o.top,n=h();if(!n)return;let d=n.clientHeight,w=n.scrollHeight,m=i/d*(w-d);n.scrollTop=Math.max(0,Math.min(w-d,m)),p(),M(!0),x(u.delay),B()},[p,x,u.delay,h,B]),Zt=b(e=>{if(e.preventDefault(),e.stopPropagation(),!a.current)return;let t=Math.max(0,a.current.scrollTop-We);a.current.scrollTop=t,p(),M(!0),x(u.delay),B()},[p,x,We,u.delay,B]),Qt=b(e=>{if(e.preventDefault(),e.stopPropagation(),!a.current||!xe.current)return;let t=a.current,i=xe.current.scrollHeight-t.clientHeight,n=Math.min(i,t.scrollTop+We);t.scrollTop=n,p(),M(!0),x(u.delay),B()},[p,x,We,u.delay,B]),Jt=b(e=>{e.preventDefault(),e.stopPropagation();let t=h();t&&(vt(!0),Ft({x:e.clientX,scrollLeft:t.scrollLeft}),H(),M(!0),B())},[h,H,B]),nt=b(e=>{if(!X)return;let t=h();if(!t)return;let o=t.clientWidth,n=t.scrollWidth-o,d=e.clientX-Ve.x,w=o-Ze,R=d/w*n,m=Math.max(0,Math.min(n,Ve.scrollLeft+R));t.scrollLeft=m,p()},[X,Ve,Ze,p,h]),lt=b(()=>{vt(!1),V()&&x(u.delay)},[V,x,u.delay]),eo=b(e=>{if(!Te.current)return;let o=Te.current.getBoundingClientRect(),i=e.clientX-o.left,n=h();if(!n)return;let d=n.clientWidth,w=n.scrollWidth,m=i/d*(w-d);n.scrollLeft=Math.max(0,Math.min(w-d,m)),p(),M(!0),x(u.delay),B()},[p,x,u.delay,h,B]),to=b(e=>{if(!Ce.enabled||e.defaultPrevented)return;let t=e.target,o=a.current;if(!o||!o.contains(t)||Ne(t,Ce)||e.button!==0)return;let i=h();if(!i||i.scrollHeight<=i.clientHeight&&i.scrollWidth<=i.clientWidth)return;e.preventDefault();let n=document.activeElement;n instanceof HTMLElement&&n!==document.body&&!n.contains(t)&&n.blur(),ue.current=!0,Ut({x:e.clientX,y:e.clientY,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft||0})},[Ce,Ne,h]),it=b(e=>{if(!ue.current&&!de)return;let t=h();if(!t)return;let o=Se.x-e.clientX,i=Se.y-e.clientY;if(Math.abs(i)<5&&Math.abs(o)<5)return;ue.current&&(ue.current=!1,Je.current=!0,wt(!0)),M(!0);let n=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,Se.scrollTop+i)),d=Math.max(0,Math.min(t.scrollWidth-t.clientWidth,Se.scrollLeft+o));t.scrollTop=n,t.scrollLeft=d,p()},[de,Se,h,p]),at=b(()=>{let e=Je.current;ue.current=!1,Je.current=!1,wt(!1),e&&V()&&x(u.delay)},[V,x,u.delay]);A(()=>{let e=d=>{if(p(),K){let m=(d.target?.scrollTop??0)>ve;ct(m),te.current&&(clearTimeout(te.current),te.current=null),m&&se>0&&(te.current=setTimeout(()=>{te.current=null,ct(!1)},se))}if(fe){E&&E(d);return}H(),M(!0),St();let w=et.current?u.delayOnWheel:u.delay;x(w),E&&E(d)},t=()=>{et.current=!0,Ee.current&&clearTimeout(Ee.current),Ee.current=setTimeout(()=>{et.current=!1},300),St(),re.current=setTimeout(()=>{M(!0),re.current=null,x(u.delayOnWheel)},50)},o=[],i=h();i&&o.push(i);let n=a.current;return n&&!i&&(o.push(n),n.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(w=>{let R=w;if(R!==n&&R.classList.contains("overlay-scrollbar-container"))return;let m=R.parentElement;for(;m&&m!==n;){if(m.classList.contains("overlay-scrollbar-container")&&m!==n)return;m=m.parentElement}o.push(R)})),o.forEach(d=>{d.addEventListener("scroll",e,{passive:!0}),d.addEventListener("wheel",t,{passive:!0})}),()=>{o.forEach(d=>{d.removeEventListener("scroll",e),d.removeEventListener("wheel",t)})}},[h,p,E,H,x,u,fe,K,ve,se]),A(()=>()=>{te.current&&clearTimeout(te.current),Ee.current&&clearTimeout(Ee.current),re.current&&clearTimeout(re.current)},[]),A(()=>{let e=o=>{let i=o.target;if(o.defaultPrevented||i instanceof Element&&Ne(i,Ce))return;let n=h();if(!n)return;let{key:d}=o,{scrollTop:w,scrollHeight:R,clientHeight:m}=n,he=R-m,He=50,z=null;switch(d){case"ArrowUp":o.preventDefault(),z=Math.max(0,w-He);break;case"ArrowDown":o.preventDefault(),z=Math.min(he,w+He);break;case"PageUp":o.preventDefault(),z=Math.max(0,w-m);break;case"PageDown":o.preventDefault(),z=Math.min(he,w+m);break;case"Home":o.preventDefault(),z=0;break;case"End":o.preventDefault(),z=he;break;default:return}if(z!==null){let Le=z/he,Z=Y?T*2+l.margin*4:l.margin*2,me=(m-Z-we)*Le;Ke(me),n.scrollTop=z,H(),M(!0),x(u.delay)}},t=a.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[h,Y,T,l.margin,we,H,x,u.delay,Ce]),A(()=>(document.addEventListener("mousemove",it),document.addEventListener("mouseup",at),()=>{document.removeEventListener("mousemove",it),document.removeEventListener("mouseup",at)}),[de,it,at]),A(()=>{if(q)return document.addEventListener("mousemove",ot),document.addEventListener("mouseup",rt),()=>{document.removeEventListener("mousemove",ot),document.removeEventListener("mouseup",rt)}},[q,ot,rt]),A(()=>{if(X)return document.addEventListener("mousemove",nt),document.addEventListener("mouseup",lt),()=>{document.removeEventListener("mousemove",nt),document.removeEventListener("mouseup",lt)}},[X,nt,lt]),A(()=>{p();let e=setTimeout(()=>{p()},100);return()=>clearTimeout(e)},[p]),bo(()=>{_t(!0),p(),!u.enabled&&!fe&&V()&&M(!0)},[V,p,u.enabled,fe]),A(()=>{if(u.initialDelay>0){let e=setTimeout(()=>{Yt(!1)},u.initialDelay);return()=>clearTimeout(e)}},[u.initialDelay]);let Et=D(p);Et.current=p;let pe=D(null),Mt=b(()=>{pe.current===null&&(pe.current=requestAnimationFrame(()=>{pe.current=null,Et.current()}))},[]);A(()=>()=>{pe.current!==null&&(cancelAnimationFrame(pe.current),pe.current=null)},[]),A(()=>{let e=new ResizeObserver(()=>{Mt()}),t=[];return a.current&&t.push(a.current),xe.current&&t.push(xe.current),_.current&&document.contains(_.current)&&t.push(_.current),t.forEach(o=>{e.observe(o)}),()=>e.disconnect()},[p,Mt]),A(()=>{if(!a.current)return;let e=new MutationObserver(()=>{_.current=null,p()});return e.observe(a.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[p]);let O=Math.max(jt,T);A(()=>{let e="overlay-scrollbar-shared";if(document.getElementById(e))return;let t=document.createElement("style");t.id=e,t.textContent=`
|
|
2
2
|
/* ehfuse-editor-content\uB294 \uC2A4\uD06C\uB864\uBC14 \uC720\uC9C0 */
|
|
3
3
|
.overlay-scrollbar-container .ehfuse-editor-content {
|
|
4
4
|
scrollbar-width: thin !important;
|
|
@@ -27,7 +27,7 @@ import{useRef as R,useEffect as O,useState as v,useCallback as g,useMemo as he,f
|
|
|
27
27
|
from { transform: rotate(0deg); }
|
|
28
28
|
to { transform: rotate(360deg); }
|
|
29
29
|
}
|
|
30
|
-
`,document.head.appendChild(t)},[]),
|
|
30
|
+
`,document.head.appendChild(t)},[]),A(()=>{let e=`overlay-scrollbar-instance-${ee}`,t=document.getElementById(e);t&&t.remove();let o=document.createElement("style");o.id=e;let i=`.${ee}`;return o.textContent=`
|
|
31
31
|
${i} {
|
|
32
32
|
scrollbar-width: none !important;
|
|
33
33
|
-ms-overflow-style: none !important;
|
|
@@ -38,5 +38,5 @@ import{useRef as R,useEffect as O,useState as v,useCallback as g,useMemo as he,f
|
|
|
38
38
|
height: 0 !important;
|
|
39
39
|
}
|
|
40
40
|
${i}::-webkit-scrollbar-track { display: none !important; }
|
|
41
|
-
${i}::-webkit-scrollbar-thumb { display: none !important; }`,document.head.appendChild(o),()=>{document.getElementById(e)?.remove()}},[
|
|
41
|
+
${i}::-webkit-scrollbar-thumb { display: none !important; }`,document.head.appendChild(o),()=>{document.getElementById(e)?.remove()}},[ee]);let{normalizedContainerStyle:oo,normalizedContentStyle:ro,bottomSpacerHeight:Ct}=be(()=>{let e=st(f),t=st(c);return{normalizedContainerStyle:e.style,normalizedContentStyle:t.style,bottomSpacerHeight:e.spacerHeight+t.spacerHeight}},[f,c]);return Re("div",{ref:Xe,className:`overlay-scrollbar-wrapper ${r}`,onMouseLeave:Gt,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",overflow:"visible",...s},children:[zt&&k("div",{className:"overlay-scrollbar-pull-indicator",style:{position:"absolute",top:0,left:"50%",transform:`translate(-50%, ${Ye-68}px)`,transition:$e?"transform 0.15s ease-out":Ye===0?"transform 0.2s ease-out":"none",width:60,height:60,borderRadius:"50%",background:"#ffffff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.25)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1001,pointerEvents:"none",opacity:$e?1:Math.min(je*1.5,1)},children:$e?k("svg",{width:"36",height:"36",viewBox:"0 0 24 24",style:{animation:"overlay-scrollbar-ptr-spin 0.8s linear infinite"},children:k("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:ut,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:"42",strokeDashoffset:"14"})}):k("svg",{width:"36",height:"36",viewBox:"0 0 24 24",style:{transform:`rotate(${je*270}deg)`,opacity:je>=1?1:.6},children:k("path",{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z",fill:ut})})}),k("div",{ref:a,className:`overlay-scrollbar-container ${ee}`,tabIndex:-1,onMouseDown:to,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",outline:"none",userSelect:de?"none":"auto",...oo},children:Re("div",{ref:xe,className:"overlay-scrollbar-content",style:{flex:"1 1 auto",display:"flex",flexDirection:"column",boxSizing:"border-box",...ro},children:[L,Ct>0&&k("div",{className:"overlay-scrollbar-bottom-spacer","aria-hidden":"true",style:{flex:"0 0 auto",height:Ct}})]})}),ae&&ce&&(l.overflowY??!0)&&Re("div",{ref:Te,className:"overlay-scrollbar-track",onMouseEnter:()=>{v||(H(),oe.current=setTimeout(()=>{M(!0),oe.current=null},100))},onMouseLeave:()=>{Be(),q||x(u.delay)},style:{position:"absolute",top:0,right:0,width:`${O}px`,height:"100%",opacity:Oe?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[l.visible&&k("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),Vt(e)},style:{position:"absolute",top:Y?`${C.width+l.margin*2}px`:`${l.margin}px`,right:l.alignment==="outside"?"0px":`${(O-C.width)/2}px`,width:`${C.width}px`,height:Y?`calc(100% - ${C.width*2+l.margin*4}px)`:`calc(100% - ${l.margin*2}px)`,backgroundColor:l.color,borderRadius:`${l.radius}px`,cursor:"pointer"}}),k("div",{ref:At,className:"overlay-scrollbar-thumb",onMouseDown:Kt,onMouseEnter:()=>pt(!0),onMouseLeave:()=>pt(!1),style:{position:"absolute",top:`${(Y?T+l.margin*2:l.margin)+Bt}px`,right:l.alignment==="outside"?"0px":`${(O-T)/2}px`,width:`${T}px`,height:`${Math.max(we,tt)}px`,backgroundColor:ft||q?C.hoverColor:C.color,opacity:ft||q?C.hoverOpacity:C.opacity,borderRadius:`${C.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),ae&&ce&&Y&&k("div",{className:"overlay-scrollbar-up-arrow",onClick:Zt,onMouseEnter:()=>ze("up"),onMouseLeave:()=>ze(null),style:{position:"absolute",top:`${l.margin}px`,right:l.alignment==="outside"?"0px":`${(O-T)/2}px`,width:`${T}px`,height:`${T}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(T*.75,8)}px`,color:Ae==="up"?N.hoverColor:N.color,userSelect:"none",zIndex:1001,opacity:Oe?Ae==="up"?N.hoverOpacity:N.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),ae&&ce&&Y&&k("div",{className:"overlay-scrollbar-down-arrow",onClick:Qt,onMouseEnter:()=>ze("down"),onMouseLeave:()=>ze(null),style:{position:"absolute",bottom:`${l.margin}px`,right:l.alignment==="outside"?"0px":`${(O-T)/2}px`,width:`${T}px`,height:`${T}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(T*.75,8)}px`,color:Ae==="down"?N.hoverColor:N.color,userSelect:"none",zIndex:1001,opacity:Oe?Ae==="down"?N.hoverOpacity:N.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"}),ae&&De&&Nt&&(l.overflowX??!0)&&Re("div",{className:"overlay-scrollbar-horizontal-track",onMouseEnter:()=>{v||(H(),oe.current=setTimeout(()=>{M(!0),oe.current=null},100))},onMouseLeave:()=>{Be(),X||x(u.delay)},style:{position:"absolute",bottom:`${qt}px`,left:0,width:"100%",height:`${O}px`,opacity:Oe?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[l.visible&&k("div",{className:"overlay-scrollbar-horizontal-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),eo(e)},style:{position:"absolute",bottom:l.alignment==="outside"?"0px":`${(O-T)/2}px`,left:`${l.margin}px`,right:ce?l.alignment==="outside"?`${O-l.margin}px`:`${O}px`:`${l.margin}px`,height:`${T}px`,backgroundColor:l.color,borderRadius:`${l.radius}px`,cursor:"pointer"}}),k("div",{className:"overlay-scrollbar-horizontal-thumb",onMouseDown:Jt,onMouseEnter:()=>gt(!0),onMouseLeave:()=>gt(!1),style:{position:"absolute",bottom:l.alignment==="outside"?"0px":`${(O-T)/2}px`,left:`${l.margin+Qe}px`,right:ce?l.alignment==="outside"?`${O-l.margin}px`:`${O}px`:"auto",maxWidth:ce?l.alignment==="outside"?`calc(100% - ${l.margin+Qe+O-l.margin}px)`:`calc(100% - ${l.margin+Qe+O}px)`:"none",width:`${Math.max(Ze,50)}px`,height:`${T}px`,backgroundColor:bt||X?C.hoverColor:C.color,opacity:bt||X?C.hoverOpacity:C.opacity,borderRadius:`${C.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),K&&k("button",{type:"button","aria-label":"\uB9E8 \uC704\uB85C",onClick:()=>{ye(!1),(h()??a.current)?.scrollTo({top:0,behavior:"smooth"})},onPointerDown:()=>ye(!0),onPointerUp:()=>ye(!1),onPointerLeave:()=>ye(!1),onPointerCancel:()=>ye(!1),style:{position:"absolute",[S]:y,bottom:_e,zIndex:1200,width:Ie,height:Ie,padding:0,display:"flex",alignItems:"center",justifyContent:"center",border:"none",borderRadius:"50%",backgroundColor:Pe,color:It,boxShadow:"0 3px 8px rgba(15, 23, 42, 0.28)",cursor:"pointer",opacity:qe?$t?1:ke:0,pointerEvents:qe?"auto":"none",transition:qe?"opacity 0.15s ease":"opacity 0.45s ease"},children:Re("svg",{width:Math.round(Ie*.5),height:Math.round(Ie*.5),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[k("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),k("polyline",{points:"5 12 12 5 19 12"})]})})]})}),Pt=Eo;export{Pt as OverlayScrollbar,Pt as default};
|
|
42
42
|
//# sourceMappingURL=index.esm.js.map
|