@ehfuse/overlay-scrollbar 1.7.6 → 1.7.7
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":"OverlayScrollbar.d.ts","sourceRoot":"","sources":["../src/OverlayScrollbar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,EAMV,SAAS,EAIZ,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayScrollbar.d.ts","sourceRoot":"","sources":["../src/OverlayScrollbar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,EAMV,SAAS,EAIZ,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,MAAM,WAAW,WAAW;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,WAAW;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAGD,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAGD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAGD,MAAM,WAAW,cAAc;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACrC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAGlC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,aAAa,CAAC,EAAE,mBAAmB,CAAC;IAGpC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAGD,MAAM,WAAW,mBAAmB;IAChC,kBAAkB,EAAE,MAAM,cAAc,GAAG,IAAI,CAAC;IAChD,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACxB;AAUD,QAAA,MAAM,gBAAgB,mGAm4DrB,CAAC;AAEF,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useCoarsePointer.ts
|
|
3
|
+
* 주 입력장치가 터치(coarse pointer)인지 감지하는 훅.
|
|
4
|
+
*
|
|
5
|
+
* 터치 우선 기기(모바일/태블릿)에서는 커스텀 스크롤바 트랙/thumb·드래그 스크롤이 불필요하고
|
|
6
|
+
* 오히려 네이티브 스크롤·PTR 제스처와 충돌할 수 있어, 이 값으로 커스텀 UI 를 끄는 판단에 쓴다.
|
|
7
|
+
* `pointer: coarse` 미디어쿼리 기준(마우스=fine 는 false). SSR 등 matchMedia 미지원 환경은 false.
|
|
8
|
+
*
|
|
9
|
+
* @copyright 2025 KIM YOUNG JIN (ehfuse@gmail.com)
|
|
10
|
+
*/
|
|
11
|
+
/** 주 입력장치가 터치(coarse pointer)면 true 를 반환한다. */
|
|
12
|
+
export declare function useCoarsePointer(): boolean;
|
|
13
|
+
//# sourceMappingURL=useCoarsePointer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCoarsePointer.d.ts","sourceRoot":"","sources":["../../src/hooks/useCoarsePointer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,+CAA+C;AAC/C,wBAAgB,gBAAgB,IAAI,OAAO,CA2B1C"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useRef as $,useEffect as z,useState as h,useCallback as p,useMemo as Te,forwardRef as It,useImperativeHandle as Wt,useLayoutEffect as Ot}from"react";var Rt=["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"],De=(S,I)=>{if(S instanceof HTMLElement&&S.isContentEditable||S.closest('[role="textbox"],[role="searchbox"]'))return!0;let N=S.tagName.toLowerCase();if(N==="input"){let y=(S.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(y)}if(["textarea","select","button"].includes(N)||["svg","path","circle","rect","line","polygon","polyline"].includes(N)||S.getAttribute("contenteditable")==="true")return!0;if(I?.excludeSelectors){for(let y of I.excludeSelectors)if(S.matches(y))return!0}return kt(S,I)},kt=(S,I)=>{let N=[...Rt,...I?.excludeClasses||[]],y=S,B=0,W=5;for(;y&&B<=W;){if(N.some(C=>y.classList.contains(C)))return!0;if(y.classList.contains("MuiDialogContent-root"))break;y=y.parentElement,B++}return!1};import{useEffect as lt,useRef as oe,useState as it}from"react";var at=({containerRef:S,config:I})=>{let N=I.enabled??!0,y=I.threshold??80,B=I.maxDistance??y*2,W=I.onRefresh,[C,H]=it(0),[O,q]=it(!1),F=oe(0),ue=oe(0),P=oe(!1),G=oe(!1),re=oe(!1),de=oe(0),ne=oe(!1);return lt(()=>{ne.current=O},[O]),lt(()=>{let M=S.current;if(!M||!(N&&typeof W=="function"))return;let Q=v=>{let x=v instanceof Element?v:null;for(;x&&x!==M;){if(x instanceof HTMLElement&&x.scrollHeight>x.clientHeight+1&&x.scrollTop>0)return!1;x=x.parentElement}return!0},j=v=>{P.current=!1,G.current=!1,re.current=!1,!ne.current&&v.touches.length===1&&M.scrollTop===0&&Q(v.target)&&(P.current=!0,F.current=v.touches[0].clientY,ue.current=v.touches[0].clientX)},we=v=>{if(!P.current||ne.current||v.touches.length!==1)return;let x=v.touches[0].clientY-F.current,pe=v.touches[0].clientX-ue.current;if(!G.current){if(x<=0||M.scrollTop>0){P.current=!1;return}if(x>8&&x>Math.abs(pe))G.current=!0,re.current=M.scrollTop<0;else return}!re.current&&v.cancelable&&v.preventDefault();let fe=Math.min(Math.max(x,0)*.5,B);de.current=fe,H(fe)},L=()=>{if(!P.current||(P.current=!1,!G.current))return;G.current=!1,re.current=!1;let v=de.current;de.current=0,v>=y&&!ne.current?(q(!0),H(y),Promise.resolve().then(()=>W()).catch(()=>{}).finally(()=>{q(!1),H(0)})):H(0)};return M.addEventListener("touchstart",j,{passive:!0}),M.addEventListener("touchmove",we,{passive:!1}),M.addEventListener("touchend",L,{passive:!0}),M.addEventListener("touchcancel",L,{passive:!0}),()=>{M.removeEventListener("touchstart",j),M.removeEventListener("touchmove",we),M.removeEventListener("touchend",L),M.removeEventListener("touchcancel",L)}},[S,N,W,y,B]),{pullDistance:C,isRefreshing:O,pullProgress:Math.min(C/y,1),pullThreshold:y}};import{jsx as k,jsxs as Be}from"react/jsx-runtime";var Pt={},At={},$t={},zt={},Nt={},Ft={},_t=It(({className:S="",style:I={},containerStyle:N={},contentStyle:y={},children:B,onScroll:W,thumb:C=Pt,track:H=At,arrows:O=$t,dragScroll:q=zt,autoHide:F=Nt,pullToRefresh:ue=Ft,showScrollbar:P=!0,showHorizontalScrollbar:G=!0,detectInnerScroll:re=!1},de)=>{let ne=$({});z(()=>{ne.current={children:B,onScroll:W,showScrollbar:P,showHorizontalScrollbar:G,thumb:C,track:H,arrows:O,dragScroll:q,autoHide:F}});let M=$(null),l=$(null),Q=$(null),j=$(null),we=$(null),L=$(null),{pullDistance:v,isRefreshing:x,pullProgress:pe}=at({containerRef:l,config:ue}),fe=ue.indicatorColor??"#1976d2",st=v>0||x,[Me,T]=h(!1),[U,Ue]=h(!1),[Xe,Ye]=h(!1),[Re,ut]=h({y:0,scrollTop:0}),[he,qe]=h(0),[dt,ke]=h(0),[le,Ge]=h(!1),[je,Ke]=h(!1),[X,Ve]=h(!1),[Ie,pt]=h({x:0,scrollLeft:0}),[We,Ze]=h(0),[Oe,Je]=h(0),[ft,Qe]=h(!1),ie=$(!1),[K,et]=h(!1),[me,ht]=h({x:0,y:0,scrollTop:0,scrollLeft:0}),[Bt,Ut]=h(null),[Ee,Se]=h(null),[Xt,mt]=h(!1),[bt,gt]=h(0),be=$(null),[tt,ot]=h(!1),ge=$(null),ee=$(null),te=$(null),w=Te(()=>{let e=C.color??"#606060";return{width:C.width??8,minHeight:C.minHeight??50,radius:C.radius??(C.width??8)/2,color:e,opacity:C.opacity??.6,hoverColor:C.hoverColor??e,hoverOpacity:C.hoverOpacity??1}},[C]),r=Te(()=>({width:H.width??16,color:H.color??"rgba(128, 128, 128, 0.1)",visible:H.visible??!0,alignment:H.alignment??"outside",radius:H.radius??w.radius??4,margin:H.margin??4,overflowX:H.overflowX??!0,overflowY:H.overflowY??!0}),[H,w.radius]),_=Te(()=>{let e=O.color??"#808080";return{visible:O.visible??!1,step:O.step??50,color:e,opacity:O.opacity??.6,hoverColor:O.hoverColor??e,hoverOpacity:O.hoverOpacity??1}},[O]),ve=Te(()=>({enabled:q.enabled??!0,excludeClasses:q.excludeClasses??[],excludeSelectors:q.excludeSelectors??[]}),[q]),a=Te(()=>({enabled:F.enabled??!0,delay:F.delay??1500,delayOnWheel:F.delayOnWheel??700,initialDelay:F.initialDelay??200}),[F]),[ae,vt]=h(()=>(F.initialDelay??200)>0),m=w.width,yt=r.width,Pe=w.minHeight,Y=_.visible,Ce=_.step,A=p(()=>{if(!l.current)return;let e=document.activeElement;e&&l.current.contains(e)&&e!==l.current||l.current.focus()},[]);Wt(de,()=>({getScrollContainer:()=>l.current,scrollTo:e=>{l.current&&l.current.scrollTo(e)},get scrollTop(){return l.current?.scrollTop||0},get scrollHeight(){return l.current?.scrollHeight||0},get clientHeight(){return l.current?.clientHeight||0}}),[]);let u=p(()=>{if(L.current){let t=L.current;if(document.contains(t)&&(t.scrollHeight>t.clientHeight+2||t.scrollWidth>t.clientWidth+2))return t;L.current=null}if(!l.current)return null;if(l.current.scrollHeight>l.current.clientHeight+2||l.current.scrollWidth>l.current.clientWidth+2)return L.current=l.current,l.current;if(!re)return null;let e=l.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!==l.current&&o.classList.contains("overlay-scrollbar-container"))continue;let i=o.parentElement,n=!1;for(;i&&i!==l.current;){if(i.classList.contains("overlay-scrollbar-container")&&i!==l.current){n=!0;break}i=i.parentElement}if(!n&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return L.current=o,o}return null},[]),V=p(()=>u()!==null,[u]),b=p(()=>{ge.current&&(clearTimeout(ge.current),ge.current=null)},[]),He=p(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),rt=p(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),xt=p(()=>{He(),!(U||X||K||ie.current)&&(b(),T(!1))},[b,He,U,X,K]),f=p(e=>{a.enabled&&(b(),ge.current=setTimeout(()=>{T(!1),ge.current=null},e))},[b,a.enabled]),s=p(()=>{let e=u()??l.current;if(!e){T(!1),Ge(!1),Qe(!1),b();return}!a.enabled&&!ae&&(T(!0),b());let t=e.clientHeight,o=e.scrollHeight,i=e.scrollTop,n=e.clientWidth,c=e.scrollWidth,g=e.scrollLeft,E=o-t>0,d=c-n>0,ce=E||d;Ge(E),Qe(d),ce||(T(!1),b());let ye=0,R=0;if(M.current){let Z=window.getComputedStyle(M.current),J=parseFloat(Z.paddingTop)||0;R=parseFloat(Z.paddingBottom)||0,ye=J+R,gt(R)}if(E){let Z=Y?m*2+r.margin*4:r.margin*2,J=t-Z+ye,Le=t/o,se=Math.max(J*Le,Pe),nt=o-t,Lt=J-se,Dt=nt>0?i/nt*Lt:0;qe(se),ke(Dt)}else qe(0),ke(0);let xe=c-n;if(xe>0){let Z=n/c,J=Math.max(n*Z,50),Le=n-J,se=xe>0?g/xe*Le:0;Ze(J),Je(se)}else Ze(0),Je(0)},[u,b,Y,m,Pe,a.enabled,ae]),Tt=p(e=>{e.preventDefault(),e.stopPropagation();let t=u();t&&(Ue(!0),ut({y:e.clientY,scrollTop:t.scrollTop}),b(),T(!0),A())},[u,b,A]),Ae=p(e=>{if(!U)return;let t=u();if(!t)return;let o=t.clientHeight,n=t.scrollHeight-o,c=e.clientY-Re.y,g=o-he,E=c/g*n,d=Math.max(0,Math.min(n,Re.scrollTop+E));t.scrollTop=d,s()},[U,Re,he,s,u]),$e=p(()=>{Ue(!1),V()&&f(a.delay)},[V,f,a.delay]),wt=p(e=>{if(!j.current)return;let o=j.current.getBoundingClientRect(),i=e.clientY-o.top,n=u();if(!n)return;let c=n.clientHeight,g=n.scrollHeight,d=i/c*(g-c);n.scrollTop=Math.max(0,Math.min(g-c,d)),s(),T(!0),f(a.delay),A()},[s,f,a.delay,u,A]),Mt=p(e=>{if(e.preventDefault(),e.stopPropagation(),!l.current)return;let t=Math.max(0,l.current.scrollTop-Ce);l.current.scrollTop=t,s(),T(!0),f(a.delay),A()},[s,f,Ce,a.delay,A]),Et=p(e=>{if(e.preventDefault(),e.stopPropagation(),!l.current||!Q.current)return;let t=l.current,i=Q.current.scrollHeight-t.clientHeight,n=Math.min(i,t.scrollTop+Ce);t.scrollTop=n,s(),T(!0),f(a.delay),A()},[s,f,Ce,a.delay,A]),St=p(e=>{e.preventDefault(),e.stopPropagation();let t=u();t&&(Ve(!0),pt({x:e.clientX,scrollLeft:t.scrollLeft}),b(),T(!0),A())},[u,b,A]),ze=p(e=>{if(!X)return;let t=u();if(!t)return;let o=t.clientWidth,n=t.scrollWidth-o,c=e.clientX-Ie.x,g=o-We,E=c/g*n,d=Math.max(0,Math.min(n,Ie.scrollLeft+E));t.scrollLeft=d,s()},[X,Ie,We,s,u]),Ne=p(()=>{Ve(!1),V()&&f(a.delay)},[V,f,a.delay]),Ct=p(e=>{if(!j.current)return;let o=j.current.getBoundingClientRect(),i=e.clientX-o.left,n=u();if(!n)return;let c=n.clientWidth,g=n.scrollWidth,d=i/c*(g-c);n.scrollLeft=Math.max(0,Math.min(g-c,d)),s(),T(!0),f(a.delay),A()},[s,f,a.delay,u,A]),Ht=p(e=>{if(!ve.enabled||e.defaultPrevented)return;let t=e.target,o=l.current;if(!o||!o.contains(t)||De(t,ve)||e.button!==0)return;let i=u();i&&(i.scrollHeight<=i.clientHeight&&i.scrollWidth<=i.clientWidth||(e.preventDefault(),ie.current=!0,ht({x:e.clientX,y:e.clientY,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft||0}),b()))},[ve,De,u,b]),Fe=p(e=>{if(!ie.current&&!K)return;let t=u();if(!t)return;let o=me.x-e.clientX,i=me.y-e.clientY;if(Math.abs(i)<5&&Math.abs(o)<5)return;ie.current&&(ie.current=!1,et(!0)),T(!0);let n=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,me.scrollTop+i)),c=Math.max(0,Math.min(t.scrollWidth-t.clientWidth,me.scrollLeft+o));t.scrollTop=n,t.scrollLeft=c,s()},[K,me,u,s]),_e=p(()=>{let e=K;ie.current=!1,et(!1),e&&V()&&f(a.delay)},[K,V,f,a.delay]);z(()=>{let e=c=>{if(s(),ae){W&&W(c);return}b(),T(!0),rt();let g=tt?a.delayOnWheel:a.delay;f(g),W&&W(c)},t=()=>{ot(!0),be.current&&clearTimeout(be.current),be.current=setTimeout(()=>{ot(!1)},300),rt(),te.current=setTimeout(()=>{T(!0),te.current=null,f(a.delayOnWheel)},50)},o=[],i=u();i&&o.push(i);let n=l.current;return n&&!i&&(o.push(n),n.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(g=>{let E=g;if(E!==n&&E.classList.contains("overlay-scrollbar-container"))return;let d=E.parentElement;for(;d&&d!==n;){if(d.classList.contains("overlay-scrollbar-container")&&d!==n)return;d=d.parentElement}o.push(E)})),o.forEach(c=>{c.addEventListener("scroll",e,{passive:!0}),c.addEventListener("wheel",t,{passive:!0})}),()=>{o.forEach(c=>{c.removeEventListener("scroll",e),c.removeEventListener("wheel",t)}),be.current&&clearTimeout(be.current),te.current&&clearTimeout(te.current)}},[u,s,W,b,f,a,tt,ae]),z(()=>{let e=o=>{let i=o.target;if(o.defaultPrevented||i instanceof Element&&De(i,ve))return;let n=u();if(!n)return;let{key:c}=o,{scrollTop:g,scrollHeight:E,clientHeight:d}=n,ce=E-d,ye=50,R=null;switch(c){case"ArrowUp":o.preventDefault(),R=Math.max(0,g-ye);break;case"ArrowDown":o.preventDefault(),R=Math.min(ce,g+ye);break;case"PageUp":o.preventDefault(),R=Math.max(0,g-d);break;case"PageDown":o.preventDefault(),R=Math.min(ce,g+d);break;case"Home":o.preventDefault(),R=0;break;case"End":o.preventDefault(),R=ce;break;default:return}if(R!==null){let xe=R/ce,Z=Y?m*2+r.margin*4:r.margin*2,se=(d-Z-he)*xe;ke(se),n.scrollTop=R,b(),T(!0),f(a.delay)}},t=l.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[u,Y,m,r.margin,he,b,f,a.delay,ve]),z(()=>(document.addEventListener("mousemove",Fe),document.addEventListener("mouseup",_e),()=>{document.removeEventListener("mousemove",Fe),document.removeEventListener("mouseup",_e)}),[K,Fe,_e]),z(()=>{if(U)return document.addEventListener("mousemove",Ae),document.addEventListener("mouseup",$e),()=>{document.removeEventListener("mousemove",Ae),document.removeEventListener("mouseup",$e)}},[U,Ae,$e]),z(()=>{if(X)return document.addEventListener("mousemove",ze),document.addEventListener("mouseup",Ne),()=>{document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",Ne)}},[X,ze,Ne]),z(()=>{s();let e=setTimeout(()=>{s()},100);return()=>clearTimeout(e)},[s]),Ot(()=>{mt(!0),s(),!a.enabled&&!ae&&V()&&T(!0)},[V,s,a.enabled,ae]),z(()=>{if(a.initialDelay>0){let e=setTimeout(()=>{vt(!1)},a.initialDelay);return()=>clearTimeout(e)}},[a.initialDelay]),z(()=>{let e=new ResizeObserver(()=>{s()}),t=[];return l.current&&t.push(l.current),Q.current&&t.push(Q.current),L.current&&document.contains(L.current)&&t.push(L.current),t.forEach(o=>{e.observe(o)}),()=>e.disconnect()},[s]),z(()=>{if(!l.current)return;let e=new MutationObserver(()=>{L.current=null,s()});return e.observe(l.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[s]);let D=Math.max(yt,m);return z(()=>{let e="overlay-scrollbar-webkit-hide",t=document.getElementById(e);t&&t.remove();let o=document.createElement("style");return o.id=e,o.textContent=`
|
|
1
|
+
import{useRef as A,useEffect as N,useState as b,useCallback as p,useMemo as xe,forwardRef as zt,useImperativeHandle as Nt,useLayoutEffect as Ft}from"react";var Wt=["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"],Le=(M,C)=>{if(M instanceof HTMLElement&&M.isContentEditable||M.closest('[role="textbox"],[role="searchbox"]'))return!0;let E=M.tagName.toLowerCase();if(E==="input"){let d=(M.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(d)}if(["textarea","select","button"].includes(E)||["svg","path","circle","rect","line","polygon","polyline"].includes(E)||M.getAttribute("contenteditable")==="true")return!0;if(C?.excludeSelectors){for(let d of C.excludeSelectors)if(M.matches(d))return!0}return Ot(M,C)},Ot=(M,C)=>{let E=[...Wt,...C?.excludeClasses||[]],d=M,$=0,P=5;for(;d&&$<=P;){if(E.some(H=>d.classList.contains(H)))return!0;if(d.classList.contains("MuiDialogContent-root"))break;d=d.parentElement,$++}return!1};import{useEffect as ct,useRef as oe,useState as st}from"react";var ut=({containerRef:M,config:C})=>{let E=C.enabled??!0,d=C.threshold??80,$=C.maxDistance??d*2,P=C.onRefresh,[H,L]=st(0),[W,G]=st(!1),F=oe(0),de=oe(0),j=oe(!1),J=oe(!1),re=oe(!1),fe=oe(0),U=oe(!1);return ct(()=>{U.current=W},[W]),ct(()=>{let x=M.current;if(!x||!(E&&typeof P=="function"))return;let Re=h=>{let D=h instanceof Element?h:null;for(;D&&D!==x;){if(D instanceof HTMLElement&&D.scrollHeight>D.clientHeight+1&&D.scrollTop>0)return!1;D=D.parentElement}return!0},ne=h=>{j.current=!1,J.current=!1,re.current=!1,!U.current&&h.touches.length===1&&x.scrollTop===0&&Re(h.target)&&(j.current=!0,F.current=h.touches[0].clientY,de.current=h.touches[0].clientX)},r=h=>{if(!j.current||U.current||h.touches.length!==1)return;let D=h.touches[0].clientY-F.current,z=h.touches[0].clientX-de.current;if(!J.current){if(D<=0||x.scrollTop>0){j.current=!1;return}if(D>8&&D>Math.abs(z))J.current=!0,re.current=x.scrollTop<0;else return}!re.current&&h.cancelable&&h.preventDefault();let le=Math.min(Math.max(D,0)*.5,$);fe.current=le,L(le)},_=()=>{if(!j.current||(j.current=!1,!J.current))return;J.current=!1,re.current=!1;let h=fe.current;fe.current=0,h>=d&&!U.current?(G(!0),L(d),Promise.resolve().then(()=>P()).catch(()=>{}).finally(()=>{G(!1),L(0)})):L(0)};return x.addEventListener("touchstart",ne,{passive:!0}),x.addEventListener("touchmove",r,{passive:!1}),x.addEventListener("touchend",_,{passive:!0}),x.addEventListener("touchcancel",_,{passive:!0}),()=>{x.removeEventListener("touchstart",ne),x.removeEventListener("touchmove",r),x.removeEventListener("touchend",_),x.removeEventListener("touchcancel",_)}},[M,E,P,d,$]),{pullDistance:H,isRefreshing:W,pullProgress:Math.min(H/d,1),pullThreshold:d}};import{useEffect as At,useState as $t}from"react";function dt(){let[M,C]=$t(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(pointer: coarse)").matches);return At(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;let E=window.matchMedia("(pointer: coarse)"),d=$=>C($.matches);return C(E.matches),typeof E.addEventListener=="function"?(E.addEventListener("change",d),()=>E.removeEventListener("change",d)):(E.addListener(d),()=>E.removeListener(d))},[]),M}import{jsx as I,jsxs as Xe}from"react/jsx-runtime";var _t={},Bt={},Ut={},Xt={},qt={},Yt={},Gt=zt(({className:M="",style:C={},containerStyle:E={},contentStyle:d={},children:$,onScroll:P,thumb:H=_t,track:L=Bt,arrows:W=Ut,dragScroll:G=Xt,autoHide:F=qt,pullToRefresh:de=Yt,showScrollbar:j=!0,showHorizontalScrollbar:J=!0,detectInnerScroll:re=!1},fe)=>{let U=dt(),x=U?!1:j,De=U?!1:J,Re=A({});N(()=>{Re.current={children:$,onScroll:P,showScrollbar:x,showHorizontalScrollbar:De,thumb:H,track:L,arrows:W,dragScroll:G,autoHide:F}});let ne=A(null),r=A(null),_=A(null),h=A(null),D=A(null),z=A(null),{pullDistance:le,isRefreshing:we,pullProgress:ke}=ut({containerRef:r,config:de}),qe=de.indicatorColor??"#1976d2",pt=le>0||we,[Te,w]=b(!1),[X,Ye]=b(!1),[Ge,je]=b(!1),[Ie,ht]=b({y:0,scrollTop:0}),[pe,Ke]=b(0),[mt,Pe]=b(0),[ie,Ve]=b(!1),[Ze,Qe]=b(!1),[q,Je]=b(!1),[We,bt]=b({x:0,scrollLeft:0}),[Oe,et]=b(0),[Ae,tt]=b(0),[gt,ot]=b(!1),ae=A(!1),[K,rt]=b(!1),[he,vt]=b({x:0,y:0,scrollTop:0,scrollLeft:0}),[jt,Kt]=b(null),[Me,Ee]=b(null),[Vt,yt]=b(!1),[xt,wt]=b(0),me=A(null),[nt,lt]=b(!1),be=A(null),ee=A(null),te=A(null),T=xe(()=>{let e=H.color??"#606060";return{width:H.width??8,minHeight:H.minHeight??50,radius:H.radius??(H.width??8)/2,color:e,opacity:H.opacity??.6,hoverColor:H.hoverColor??e,hoverOpacity:H.hoverOpacity??1}},[H]),n=xe(()=>({width:L.width??16,color:L.color??"rgba(128, 128, 128, 0.1)",visible:L.visible??!0,alignment:L.alignment??"outside",radius:L.radius??T.radius??4,margin:L.margin??4,overflowX:L.overflowX??!0,overflowY:L.overflowY??!0}),[L,T.radius]),B=xe(()=>{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]),ge=xe(()=>({enabled:U?!1:G.enabled??!0,excludeClasses:G.excludeClasses??[],excludeSelectors:G.excludeSelectors??[]}),[G,U]),a=xe(()=>({enabled:F.enabled??!0,delay:F.delay??1500,delayOnWheel:F.delayOnWheel??700,initialDelay:F.initialDelay??200}),[F]),[ce,Tt]=b(()=>(F.initialDelay??200)>0),g=T.width,Mt=n.width,$e=T.minHeight,Y=B.visible,Se=B.step,O=p(()=>{if(!r.current)return;let e=document.activeElement;e&&r.current.contains(e)&&e!==r.current||r.current.focus()},[]);Nt(fe,()=>({getScrollContainer:()=>r.current,scrollTo:e=>{r.current&&r.current.scrollTo(e)},get scrollTop(){return r.current?.scrollTop||0},get scrollHeight(){return r.current?.scrollHeight||0},get clientHeight(){return r.current?.clientHeight||0}}),[]);let u=p(()=>{if(z.current){let t=z.current;if(document.contains(t)&&(t.scrollHeight>t.clientHeight+2||t.scrollWidth>t.clientWidth+2))return t;z.current=null}if(!r.current)return null;if(r.current.scrollHeight>r.current.clientHeight+2||r.current.scrollWidth>r.current.clientWidth+2)return z.current=r.current,r.current;if(!re)return null;let e=r.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!==r.current&&o.classList.contains("overlay-scrollbar-container"))continue;let i=o.parentElement,l=!1;for(;i&&i!==r.current;){if(i.classList.contains("overlay-scrollbar-container")&&i!==r.current){l=!0;break}i=i.parentElement}if(!l&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return z.current=o,o}return null},[]),V=p(()=>u()!==null,[u]),v=p(()=>{be.current&&(clearTimeout(be.current),be.current=null)},[]),Ce=p(()=>{ee.current&&(clearTimeout(ee.current),ee.current=null)},[]),it=p(()=>{te.current&&(clearTimeout(te.current),te.current=null)},[]),Et=p(()=>{Ce(),!(X||q||K||ae.current)&&(v(),w(!1))},[v,Ce,X,q,K]),m=p(e=>{a.enabled&&(v(),be.current=setTimeout(()=>{w(!1),be.current=null},e))},[v,a.enabled]),s=p(()=>{let e=u()??r.current;if(!e){w(!1),Ve(!1),ot(!1),v();return}!a.enabled&&!ce&&(w(!0),v());let t=e.clientHeight,o=e.scrollHeight,i=e.scrollTop,l=e.clientWidth,c=e.scrollWidth,y=e.scrollLeft,S=o-t>0,f=c-l>0,se=S||f;Ve(S),ot(f),se||(w(!1),v());let ve=0,k=0;if(ne.current){let Z=window.getComputedStyle(ne.current),Q=parseFloat(Z.paddingTop)||0;k=parseFloat(Z.paddingBottom)||0,ve=Q+k,wt(k)}if(S){let Z=Y?g*2+n.margin*4:n.margin*2,Q=t-Z+ve,He=t/o,ue=Math.max(Q*He,$e),at=o-t,It=Q-ue,Pt=at>0?i/at*It:0;Ke(ue),Pe(Pt)}else Ke(0),Pe(0);let ye=c-l;if(ye>0){let Z=l/c,Q=Math.max(l*Z,50),He=l-Q,ue=ye>0?y/ye*He:0;et(Q),tt(ue)}else et(0),tt(0)},[u,v,Y,g,$e,a.enabled,ce]),St=p(e=>{e.preventDefault(),e.stopPropagation();let t=u();t&&(Ye(!0),ht({y:e.clientY,scrollTop:t.scrollTop}),v(),w(!0),O())},[u,v,O]),ze=p(e=>{if(!X)return;let t=u();if(!t)return;let o=t.clientHeight,l=t.scrollHeight-o,c=e.clientY-Ie.y,y=o-pe,S=c/y*l,f=Math.max(0,Math.min(l,Ie.scrollTop+S));t.scrollTop=f,s()},[X,Ie,pe,s,u]),Ne=p(()=>{Ye(!1),V()&&m(a.delay)},[V,m,a.delay]),Ct=p(e=>{if(!h.current)return;let o=h.current.getBoundingClientRect(),i=e.clientY-o.top,l=u();if(!l)return;let c=l.clientHeight,y=l.scrollHeight,f=i/c*(y-c);l.scrollTop=Math.max(0,Math.min(y-c,f)),s(),w(!0),m(a.delay),O()},[s,m,a.delay,u,O]),Ht=p(e=>{if(e.preventDefault(),e.stopPropagation(),!r.current)return;let t=Math.max(0,r.current.scrollTop-Se);r.current.scrollTop=t,s(),w(!0),m(a.delay),O()},[s,m,Se,a.delay,O]),Lt=p(e=>{if(e.preventDefault(),e.stopPropagation(),!r.current||!_.current)return;let t=r.current,i=_.current.scrollHeight-t.clientHeight,l=Math.min(i,t.scrollTop+Se);t.scrollTop=l,s(),w(!0),m(a.delay),O()},[s,m,Se,a.delay,O]),Dt=p(e=>{e.preventDefault(),e.stopPropagation();let t=u();t&&(Je(!0),bt({x:e.clientX,scrollLeft:t.scrollLeft}),v(),w(!0),O())},[u,v,O]),Fe=p(e=>{if(!q)return;let t=u();if(!t)return;let o=t.clientWidth,l=t.scrollWidth-o,c=e.clientX-We.x,y=o-Oe,S=c/y*l,f=Math.max(0,Math.min(l,We.scrollLeft+S));t.scrollLeft=f,s()},[q,We,Oe,s,u]),_e=p(()=>{Je(!1),V()&&m(a.delay)},[V,m,a.delay]),Rt=p(e=>{if(!h.current)return;let o=h.current.getBoundingClientRect(),i=e.clientX-o.left,l=u();if(!l)return;let c=l.clientWidth,y=l.scrollWidth,f=i/c*(y-c);l.scrollLeft=Math.max(0,Math.min(y-c,f)),s(),w(!0),m(a.delay),O()},[s,m,a.delay,u,O]),kt=p(e=>{if(!ge.enabled||e.defaultPrevented)return;let t=e.target,o=r.current;if(!o||!o.contains(t)||Le(t,ge)||e.button!==0)return;let i=u();i&&(i.scrollHeight<=i.clientHeight&&i.scrollWidth<=i.clientWidth||(e.preventDefault(),ae.current=!0,vt({x:e.clientX,y:e.clientY,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft||0}),v()))},[ge,Le,u,v]),Be=p(e=>{if(!ae.current&&!K)return;let t=u();if(!t)return;let o=he.x-e.clientX,i=he.y-e.clientY;if(Math.abs(i)<5&&Math.abs(o)<5)return;ae.current&&(ae.current=!1,rt(!0)),w(!0);let l=Math.max(0,Math.min(t.scrollHeight-t.clientHeight,he.scrollTop+i)),c=Math.max(0,Math.min(t.scrollWidth-t.clientWidth,he.scrollLeft+o));t.scrollTop=l,t.scrollLeft=c,s()},[K,he,u,s]),Ue=p(()=>{let e=K;ae.current=!1,rt(!1),e&&V()&&m(a.delay)},[K,V,m,a.delay]);N(()=>{let e=c=>{if(s(),ce){P&&P(c);return}v(),w(!0),it();let y=nt?a.delayOnWheel:a.delay;m(y),P&&P(c)},t=()=>{lt(!0),me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{lt(!1)},300),it(),te.current=setTimeout(()=>{w(!0),te.current=null,m(a.delayOnWheel)},50)},o=[],i=u();i&&o.push(i);let l=r.current;return l&&!i&&(o.push(l),l.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(y=>{let S=y;if(S!==l&&S.classList.contains("overlay-scrollbar-container"))return;let f=S.parentElement;for(;f&&f!==l;){if(f.classList.contains("overlay-scrollbar-container")&&f!==l)return;f=f.parentElement}o.push(S)})),o.forEach(c=>{c.addEventListener("scroll",e,{passive:!0}),c.addEventListener("wheel",t,{passive:!0})}),()=>{o.forEach(c=>{c.removeEventListener("scroll",e),c.removeEventListener("wheel",t)}),me.current&&clearTimeout(me.current),te.current&&clearTimeout(te.current)}},[u,s,P,v,m,a,nt,ce]),N(()=>{let e=o=>{let i=o.target;if(o.defaultPrevented||i instanceof Element&&Le(i,ge))return;let l=u();if(!l)return;let{key:c}=o,{scrollTop:y,scrollHeight:S,clientHeight:f}=l,se=S-f,ve=50,k=null;switch(c){case"ArrowUp":o.preventDefault(),k=Math.max(0,y-ve);break;case"ArrowDown":o.preventDefault(),k=Math.min(se,y+ve);break;case"PageUp":o.preventDefault(),k=Math.max(0,y-f);break;case"PageDown":o.preventDefault(),k=Math.min(se,y+f);break;case"Home":o.preventDefault(),k=0;break;case"End":o.preventDefault(),k=se;break;default:return}if(k!==null){let ye=k/se,Z=Y?g*2+n.margin*4:n.margin*2,ue=(f-Z-pe)*ye;Pe(ue),l.scrollTop=k,v(),w(!0),m(a.delay)}},t=r.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[u,Y,g,n.margin,pe,v,m,a.delay,ge]),N(()=>(document.addEventListener("mousemove",Be),document.addEventListener("mouseup",Ue),()=>{document.removeEventListener("mousemove",Be),document.removeEventListener("mouseup",Ue)}),[K,Be,Ue]),N(()=>{if(X)return document.addEventListener("mousemove",ze),document.addEventListener("mouseup",Ne),()=>{document.removeEventListener("mousemove",ze),document.removeEventListener("mouseup",Ne)}},[X,ze,Ne]),N(()=>{if(q)return document.addEventListener("mousemove",Fe),document.addEventListener("mouseup",_e),()=>{document.removeEventListener("mousemove",Fe),document.removeEventListener("mouseup",_e)}},[q,Fe,_e]),N(()=>{s();let e=setTimeout(()=>{s()},100);return()=>clearTimeout(e)},[s]),Ft(()=>{yt(!0),s(),!a.enabled&&!ce&&V()&&w(!0)},[V,s,a.enabled,ce]),N(()=>{if(a.initialDelay>0){let e=setTimeout(()=>{Tt(!1)},a.initialDelay);return()=>clearTimeout(e)}},[a.initialDelay]),N(()=>{let e=new ResizeObserver(()=>{s()}),t=[];return r.current&&t.push(r.current),_.current&&t.push(_.current),z.current&&document.contains(z.current)&&t.push(z.current),t.forEach(o=>{e.observe(o)}),()=>e.disconnect()},[s]),N(()=>{if(!r.current)return;let e=new MutationObserver(()=>{z.current=null,s()});return e.observe(r.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[s]);let R=Math.max(Mt,g);return N(()=>{let e="overlay-scrollbar-webkit-hide",t=document.getElementById(e);t&&t.remove();let o=document.createElement("style");return o.id=e,o.textContent=`
|
|
2
2
|
/* \uBAA8\uB4E0 \uC2A4\uD06C\uB864\uBC14 \uC228\uAE30\uAE30 */
|
|
3
3
|
.overlay-scrollbar-container {
|
|
4
4
|
scrollbar-width: none !important;
|
|
@@ -43,5 +43,5 @@ import{useRef as $,useEffect as z,useState as h,useCallback as p,useMemo as Te,f
|
|
|
43
43
|
from { transform: rotate(0deg); }
|
|
44
44
|
to { transform: rotate(360deg); }
|
|
45
45
|
}
|
|
46
|
-
`,document.head.appendChild(o),()=>{let i=document.getElementById(e);i&&i.remove()}},[]),
|
|
46
|
+
`,document.head.appendChild(o),()=>{let i=document.getElementById(e);i&&i.remove()}},[]),Xe("div",{ref:ne,className:`overlay-scrollbar-wrapper ${M}`,onMouseLeave:Et,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",overflow:"visible",...C},children:[pt&&I("div",{className:"overlay-scrollbar-pull-indicator",style:{position:"absolute",top:0,left:"50%",transform:`translate(-50%, ${le-56}px)`,transition:we?"transform 0.15s ease-out":le===0?"transform 0.2s ease-out":"none",width:48,height:48,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:we?1:Math.min(ke*1.5,1)},children:we?I("svg",{width:"28",height:"28",viewBox:"0 0 24 24",style:{animation:"overlay-scrollbar-ptr-spin 0.8s linear infinite"},children:I("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:qe,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:"42",strokeDashoffset:"14"})}):I("svg",{width:"28",height:"28",viewBox:"0 0 24 24",style:{transform:`rotate(${ke*270}deg)`,opacity:ke>=1?1:.6},children:I("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:qe})})}),I("div",{ref:r,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:kt,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:K?"none":"auto",...E},children:I("div",{ref:_,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",boxSizing:"border-box",...d},children:$})}),x&&ie&&(n.overflowY??!0)&&Xe("div",{ref:h,className:"overlay-scrollbar-track",onMouseEnter:()=>{v(),ee.current=setTimeout(()=>{w(!0),ee.current=null},100)},onMouseLeave:()=>{Ce(),X||m(a.delay)},style:{position:"absolute",top:0,right:0,width:`${R}px`,height:"100%",opacity:Te?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[n.visible&&I("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),Ct(e)},style:{position:"absolute",top:Y?`${T.width+n.margin*2}px`:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(R-T.width)/2}px`,width:`${T.width}px`,height:Y?`calc(100% - ${T.width*2+n.margin*4}px)`:`calc(100% - ${n.margin*2}px)`,backgroundColor:n.color,borderRadius:`${n.radius}px`,cursor:"pointer"}}),I("div",{ref:D,className:"overlay-scrollbar-thumb",onMouseDown:St,onMouseEnter:()=>je(!0),onMouseLeave:()=>je(!1),style:{position:"absolute",top:`${(Y?g+n.margin*2:n.margin)+mt}px`,right:n.alignment==="outside"?"0px":`${(R-g)/2}px`,width:`${g}px`,height:`${Math.max(pe,$e)}px`,backgroundColor:Ge||X?T.hoverColor:T.color,opacity:Ge||X?T.hoverOpacity:T.opacity,borderRadius:`${T.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),x&&ie&&Y&&I("div",{className:"overlay-scrollbar-up-arrow",onClick:Ht,onMouseEnter:()=>Ee("up"),onMouseLeave:()=>Ee(null),style:{position:"absolute",top:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(R-g)/2}px`,width:`${g}px`,height:`${g}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(g*.75,8)}px`,color:Me==="up"?B.hoverColor:B.color,userSelect:"none",zIndex:1001,opacity:Te?Me==="up"?B.hoverOpacity:B.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),x&&ie&&Y&&I("div",{className:"overlay-scrollbar-down-arrow",onClick:Lt,onMouseEnter:()=>Ee("down"),onMouseLeave:()=>Ee(null),style:{position:"absolute",bottom:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(R-g)/2}px`,width:`${g}px`,height:`${g}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(g*.75,8)}px`,color:Me==="down"?B.hoverColor:B.color,userSelect:"none",zIndex:1001,opacity:Te?Me==="down"?B.hoverOpacity:B.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"}),x&&De&>&&(n.overflowX??!0)&&Xe("div",{className:"overlay-scrollbar-horizontal-track",onMouseEnter:()=>{v(),ee.current=setTimeout(()=>{w(!0),ee.current=null},100)},onMouseLeave:()=>{Ce(),q||m(a.delay)},style:{position:"absolute",bottom:`${xt}px`,left:0,width:"100%",height:`${R}px`,opacity:Te?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[n.visible&&I("div",{className:"overlay-scrollbar-horizontal-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),Rt(e)},style:{position:"absolute",bottom:n.alignment==="outside"?"0px":`${(R-g)/2}px`,left:`${n.margin}px`,right:ie?n.alignment==="outside"?`${R-n.margin}px`:`${R}px`:`${n.margin}px`,height:`${g}px`,backgroundColor:n.color,borderRadius:`${n.radius}px`,cursor:"pointer"}}),I("div",{className:"overlay-scrollbar-horizontal-thumb",onMouseDown:Dt,onMouseEnter:()=>Qe(!0),onMouseLeave:()=>Qe(!1),style:{position:"absolute",bottom:n.alignment==="outside"?"0px":`${(R-g)/2}px`,left:`${n.margin+Ae}px`,right:ie?n.alignment==="outside"?`${R-n.margin}px`:`${R}px`:"auto",maxWidth:ie?n.alignment==="outside"?`calc(100% - ${n.margin+Ae+R-n.margin}px)`:`calc(100% - ${n.margin+Ae+R}px)`:"none",width:`${Math.max(Oe,50)}px`,height:`${g}px`,backgroundColor:Ze||q?T.hoverColor:T.color,opacity:Ze||q?T.hoverOpacity:T.opacity,borderRadius:`${T.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]})]})}),ft=Gt;export{ft as OverlayScrollbar,ft as default};
|
|
47
47
|
//# sourceMappingURL=index.esm.js.map
|