@ehfuse/overlay-scrollbar 1.6.15 → 1.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/OverlayScrollbar.d.ts +7 -0
- package/dist/OverlayScrollbar.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var He=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var gt=Object.prototype.hasOwnProperty;var vt=(h,y)=>{for(var C in y)He(h,C,{get:y[C],enumerable:!0})},yt=(h,y,C,T)=>{if(y&&typeof y=="object"||typeof y=="function")for(let H of bt(y))!gt.call(h,H)&&H!==C&&He(h,H,{get:()=>y[H],enumerable:!(T=ft(y,H))||T.enumerable});return h};var xt=h=>yt(He({},"__esModule",{value:!0}),h);var Dt={};vt(Dt,{OverlayScrollbar:()=>Le,default:()=>Le});module.exports=xt(Dt);var t=require("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"],me=(h,y)=>{if(h instanceof HTMLElement&&h.isContentEditable||h.closest('[role="textbox"],[role="searchbox"]'))return!0;let C=h.tagName.toLowerCase();if(C==="input"){let T=(h.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(T)}if(["textarea","select","button"].includes(C)||["svg","path","circle","rect","line","polygon","polyline"].includes(C)||h.getAttribute("contenteditable")==="true")return!0;if(y?.excludeSelectors){for(let T of y.excludeSelectors)if(h.matches(T))return!0}return Tt(h,y)},Tt=(h,y)=>{let C=[...wt,...y?.excludeClasses||[]],T=h,H=0,z=5;for(;T&&H<=z;){if(C.some(L=>T.classList.contains(L)))return!0;if(T.classList.contains("MuiDialogContent-root"))break;T=T.parentElement,H++}return!1};var E=require("react/jsx-runtime"),Mt={},St={},Et={},Ct={},Ht={},Lt=(0,t.forwardRef)(({className:h="",style:y={},containerStyle:C={},contentStyle:T={},children:H,onScroll:z,thumb:L=Mt,track:k=St,arrows:P=Et,dragScroll:Z=Ct,autoHide:_=Ht,showScrollbar:j=!0,showHorizontalScrollbar:De=!0,detectInnerScroll:Xe=!1},Ye)=>{let Ge=(0,t.useRef)({});(0,t.useEffect)(()=>{Ge.current={children:H,onScroll:z,showScrollbar:j,showHorizontalScrollbar:De,thumb:L,track:k,arrows:P,dragScroll:Z,autoHide:_}});let he=(0,t.useRef)(null),i=(0,t.useRef)(null),J=(0,t.useRef)(null),Q=(0,t.useRef)(null),Ke=(0,t.useRef)(null),I=(0,t.useRef)(null),[ie,x]=(0,t.useState)(!1),[W,ke]=(0,t.useState)(!1),[Re,Ie]=(0,t.useState)(!1),[fe,Ve]=(0,t.useState)({y:0,scrollTop:0}),[ee,We]=(0,t.useState)(0),[Ze,be]=(0,t.useState)(0),[Y,Oe]=(0,t.useState)(!1),[Ae,$e]=(0,t.useState)(!1),[O,ze]=(0,t.useState)(!1),[ge,je]=(0,t.useState)({x:0,scrollLeft:0}),[ve,Pe]=(0,t.useState)(0),[ye,Ne]=(0,t.useState)(0),[Je,Fe]=(0,t.useState)(!1),G=(0,t.useRef)(!1),[N,Be]=(0,t.useState)(!1),[te,Qe]=(0,t.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[kt,Rt]=(0,t.useState)(null),[ae,ce]=(0,t.useState)(null),[It,et]=(0,t.useState)(!1),[tt,ot]=(0,t.useState)(0),oe=(0,t.useRef)(null),[_e,Ue]=(0,t.useState)(!1),re=(0,t.useRef)(null),U=(0,t.useRef)(null),q=(0,t.useRef)(null),v=(0,t.useMemo)(()=>{let e=L.color??"#606060";return{width:L.width??8,minHeight:L.minHeight??50,radius:L.radius??(L.width??8)/2,color:e,opacity:L.opacity??.6,hoverColor:L.hoverColor??e,hoverOpacity:L.hoverOpacity??1}},[L]),n=(0,t.useMemo)(()=>({width:k.width??16,color:k.color??"rgba(128, 128, 128, 0.1)",visible:k.visible??!0,alignment:k.alignment??"default",radius:k.radius??v.radius??4,margin:k.margin??4,overflowX:k.overflowX??!0,overflowY:k.overflowY??!0}),[k,v.radius]),R=(0,t.useMemo)(()=>{let e=P.color??"#808080";return{visible:P.visible??!1,step:P.step??50,color:e,opacity:P.opacity??.6,hoverColor:P.hoverColor??e,hoverOpacity:P.hoverOpacity??1}},[P]),ne=(0,t.useMemo)(()=>({enabled:Z.enabled??!0,excludeClasses:Z.excludeClasses??[],excludeSelectors:Z.excludeSelectors??[]}),[Z]),a=(0,t.useMemo)(()=>({enabled:_.enabled??!0,delay:_.delay??1500,delayOnWheel:_.delayOnWheel??700,initialDelay:_.initialDelay??200}),[_]),[K,rt]=(0,t.useState)(()=>(_.initialDelay??200)>0),f=v.width,nt=n.width,xe=v.minHeight,A=R.visible,se=R.step,D=(0,t.useCallback)(()=>{if(!i.current)return;let e=document.activeElement;e&&i.current.contains(e)&&e!==i.current||i.current.focus()},[]);(0,t.useImperativeHandle)(Ye,()=>({getScrollContainer:()=>i.current,scrollTo:e=>{i.current&&i.current.scrollTo(e)},get scrollTop(){return i.current?.scrollTop||0},get scrollHeight(){return i.current?.scrollHeight||0},get clientHeight(){return i.current?.clientHeight||0}}),[]);let d=(0,t.useCallback)(()=>{if(I.current){let o=I.current;if(document.contains(o)&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return o;I.current=null}if(!i.current)return null;if(i.current.scrollHeight>i.current.clientHeight+2||i.current.scrollWidth>i.current.clientWidth+2)return I.current=i.current,i.current;if(!Xe)return null;let e=i.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of e){let r=o;if(r!==i.current&&r.classList.contains("overlay-scrollbar-container"))continue;let c=r.parentElement,l=!1;for(;c&&c!==i.current;){if(c.classList.contains("overlay-scrollbar-container")&&c!==i.current){l=!0;break}c=c.parentElement}if(!l&&(r.scrollHeight>r.clientHeight+2||r.scrollWidth>r.clientWidth+2))return I.current=r,r}return null},[]),F=(0,t.useCallback)(()=>d()!==null,[d]),g=(0,t.useCallback)(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),ue=(0,t.useCallback)(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),qe=(0,t.useCallback)(()=>{q.current&&(clearTimeout(q.current),q.current=null)},[]),lt=(0,t.useCallback)(()=>{ue(),!(W||O||N||G.current)&&(g(),x(!1))},[g,ue,W,O,N]),p=(0,t.useCallback)(e=>{a.enabled&&(g(),re.current=setTimeout(()=>{x(!1),re.current=null},e))},[g,a.enabled]),u=(0,t.useCallback)(()=>{let e=d();if(!e){x(!1),Oe(!1),Fe(!1),g();return}!a.enabled&&!K&&(x(!0),g());let o=e.clientHeight,r=e.scrollHeight,c=e.scrollTop,l=e.clientWidth,s=e.scrollWidth,b=e.scrollLeft,w=r-o>0,m=s-l>0;Oe(w),Fe(m);let X=0,V=0;if(he.current){let B=window.getComputedStyle(he.current),$=parseFloat(B.paddingTop)||0;V=parseFloat(B.paddingBottom)||0,X=$+V,ot(V)}if(w){let B=A?f*2+n.margin*4:n.margin*2,$=o-B+X,de=o/r,le=Math.max($*de,xe),pe=r-o,mt=$-le,ht=pe>0?c/pe*mt:0;We(le),be(ht)}else We(0),be(0);let S=s-l;if(S>0){let B=l/s,$=Math.max(l*B,50),de=l-$,le=S>0?b/S*de:0;Pe($),Ne(le)}else Pe(0),Ne(0)},[d,g,A,f,xe,a.enabled,K]),it=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=d();o&&(ke(!0),Ve({y:e.clientY,scrollTop:o.scrollTop}),g(),x(!0),D())},[d,g,D]),we=(0,t.useCallback)(e=>{if(!W)return;let o=d();if(!o)return;let r=o.clientHeight,l=o.scrollHeight-r,s=e.clientY-fe.y,b=r-ee,w=s/b*l,m=Math.max(0,Math.min(l,fe.scrollTop+w));o.scrollTop=m,u()},[W,fe,ee,u,d]),Te=(0,t.useCallback)(()=>{ke(!1),F()&&p(a.delay)},[F,p,a.delay]),at=(0,t.useCallback)(e=>{if(!Q.current)return;let r=Q.current.getBoundingClientRect(),c=e.clientY-r.top,l=d();if(!l)return;let s=l.clientHeight,b=l.scrollHeight,m=c/s*(b-s);l.scrollTop=Math.max(0,Math.min(b-s,m)),u(),x(!0),p(a.delay),D()},[u,p,a.delay,d,D]),ct=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!i.current)return;let o=Math.max(0,i.current.scrollTop-se);i.current.scrollTop=o,u(),x(!0),p(a.delay),D()},[u,p,se,a.delay,D]),st=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!i.current||!J.current)return;let o=i.current,c=J.current.scrollHeight-o.clientHeight,l=Math.min(c,o.scrollTop+se);o.scrollTop=l,u(),x(!0),p(a.delay),D()},[u,p,se,a.delay,D]),ut=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=d();o&&(ze(!0),je({x:e.clientX,scrollLeft:o.scrollLeft}),g(),x(!0),D())},[d,g,D]),Me=(0,t.useCallback)(e=>{if(!O)return;let o=d();if(!o)return;let r=o.clientWidth,l=o.scrollWidth-r,s=e.clientX-ge.x,b=r-ve,w=s/b*l,m=Math.max(0,Math.min(l,ge.scrollLeft+w));o.scrollLeft=m,u()},[O,ge,ve,u,d]),Se=(0,t.useCallback)(()=>{ze(!1),F()&&p(a.delay)},[F,p,a.delay]),dt=(0,t.useCallback)(e=>{if(!Q.current)return;let r=Q.current.getBoundingClientRect(),c=e.clientX-r.left,l=d();if(!l)return;let s=l.clientWidth,b=l.scrollWidth,m=c/s*(b-s);l.scrollLeft=Math.max(0,Math.min(b-s,m)),u(),x(!0),p(a.delay),D()},[u,p,a.delay,d,D]),pt=(0,t.useCallback)(e=>{if(!ne.enabled)return;let o=e.target;if(me(o,ne)||e.button!==0)return;let r=d();r&&(r.scrollHeight<=r.clientHeight&&r.scrollWidth<=r.clientWidth||(e.preventDefault(),G.current=!0,Qe({x:e.clientX,y:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft||0}),g()))},[ne,me,d,g]),Ee=(0,t.useCallback)(e=>{if(!G.current&&!N)return;let o=d();if(!o)return;let r=te.x-e.clientX,c=te.y-e.clientY;if(Math.abs(c)<5&&Math.abs(r)<5)return;G.current&&(G.current=!1,Be(!0)),x(!0);let l=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,te.scrollTop+c)),s=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,te.scrollLeft+r));o.scrollTop=l,o.scrollLeft=s,u()},[N,te,d,u]),Ce=(0,t.useCallback)(()=>{let e=N;G.current=!1,Be(!1),e&&F()&&p(a.delay)},[N,F,p,a.delay]);(0,t.useEffect)(()=>{let e=s=>{if(u(),K){z&&z(s);return}g(),x(!0),qe();let b=_e?a.delayOnWheel:a.delay;p(b),z&&z(s)},o=()=>{Ue(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{Ue(!1)},300),qe(),q.current=setTimeout(()=>{x(!0),q.current=null,p(a.delayOnWheel)},50)},r=[],c=d();c&&r.push(c);let l=i.current;return l&&!c&&(r.push(l),l.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(b=>{let w=b;if(w!==l&&w.classList.contains("overlay-scrollbar-container"))return;let m=w.parentElement;for(;m&&m!==l;){if(m.classList.contains("overlay-scrollbar-container")&&m!==l)return;m=m.parentElement}r.push(w)})),r.forEach(s=>{s.addEventListener("scroll",e,{passive:!0}),s.addEventListener("wheel",o,{passive:!0})}),()=>{r.forEach(s=>{s.removeEventListener("scroll",e),s.removeEventListener("wheel",o)}),oe.current&&clearTimeout(oe.current),q.current&&clearTimeout(q.current)}},[d,u,z,g,p,a,_e,K]),(0,t.useEffect)(()=>{let e=r=>{let c=r.target;if(r.defaultPrevented||c instanceof Element&&me(c,ne))return;let l=d();if(!l)return;let{key:s}=r,{scrollTop:b,scrollHeight:w,clientHeight:m}=l,X=w-m,V=50,S=null;switch(s){case"ArrowUp":r.preventDefault(),S=Math.max(0,b-V);break;case"ArrowDown":r.preventDefault(),S=Math.min(X,b+V);break;case"PageUp":r.preventDefault(),S=Math.max(0,b-m);break;case"PageDown":r.preventDefault(),S=Math.min(X,b+m);break;case"Home":r.preventDefault(),S=0;break;case"End":r.preventDefault(),S=X;break;default:return}if(S!==null){let B=S/X,$=A?f*2+n.margin*4:n.margin*2,pe=(m-$-ee)*B;be(pe),l.scrollTop=S,g(),x(!0),p(a.delay)}},o=i.current;if(o)return o.addEventListener("keydown",e),()=>{o.removeEventListener("keydown",e)}},[d,A,f,n.margin,ee,g,p,a.delay,ne]),(0,t.useEffect)(()=>(document.addEventListener("mousemove",Ee),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",Ee),document.removeEventListener("mouseup",Ce)}),[N,Ee,Ce]),(0,t.useEffect)(()=>{if(W)return document.addEventListener("mousemove",we),document.addEventListener("mouseup",Te),()=>{document.removeEventListener("mousemove",we),document.removeEventListener("mouseup",Te)}},[W,we,Te]),(0,t.useEffect)(()=>{if(O)return document.addEventListener("mousemove",Me),document.addEventListener("mouseup",Se),()=>{document.removeEventListener("mousemove",Me),document.removeEventListener("mouseup",Se)}},[O,Me,Se]),(0,t.useEffect)(()=>{u();let e=setTimeout(()=>{u()},100);return()=>clearTimeout(e)},[u]),(0,t.useLayoutEffect)(()=>{et(!0),u(),!a.enabled&&!K&&F()&&x(!0)},[F,u,a.enabled,K]),(0,t.useEffect)(()=>{if(a.initialDelay>0){let e=setTimeout(()=>{rt(!1)},a.initialDelay);return()=>clearTimeout(e)}},[a.initialDelay]),(0,t.useEffect)(()=>{let e=new ResizeObserver(()=>{u()}),o=[];return i.current&&o.push(i.current),J.current&&o.push(J.current),I.current&&document.contains(I.current)&&o.push(I.current),o.forEach(r=>{e.observe(r)}),()=>e.disconnect()},[u]),(0,t.useEffect)(()=>{if(!i.current)return;let e=new MutationObserver(()=>{I.current=null,u()});return e.observe(i.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[u]);let M=Math.max(nt,f);return(0,t.useEffect)(()=>{let e="overlay-scrollbar-webkit-hide",o=document.getElementById(e);o&&o.remove();let r=document.createElement("style");return r.id=e,r.textContent=`
|
|
1
|
+
"use strict";var Le=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var wt=(c,x)=>{for(var E in x)Le(c,E,{get:x[E],enumerable:!0})},Tt=(c,x,E,T)=>{if(x&&typeof x=="object"||typeof x=="function")for(let H of yt(x))!xt.call(c,H)&&H!==E&&Le(c,H,{get:()=>x[H],enumerable:!(T=vt(x,H))||T.enumerable});return c};var Mt=c=>Tt(Le({},"__esModule",{value:!0}),c);var Wt={};wt(Wt,{OverlayScrollbar:()=>De,default:()=>De});module.exports=Mt(Wt);var t=require("react");var St=["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"],he=(c,x)=>{if(c instanceof HTMLElement&&c.isContentEditable||c.closest('[role="textbox"],[role="searchbox"]'))return!0;let E=c.tagName.toLowerCase();if(E==="input"){let T=(c.type||"text").toLowerCase();return!["button","submit","reset","image","hidden"].includes(T)}if(["textarea","select","button"].includes(E)||["svg","path","circle","rect","line","polygon","polyline"].includes(E)||c.getAttribute("contenteditable")==="true")return!0;if(x?.excludeSelectors){for(let T of x.excludeSelectors)if(c.matches(T))return!0}return Ct(c,x)},Ct=(c,x)=>{let E=[...St,...x?.excludeClasses||[]],T=c,H=0,ae=5;for(;T&&H<=ae;){if(E.some($=>T.classList.contains($)))return!0;if(T.classList.contains("MuiDialogContent-root"))break;T=T.parentElement,H++}return!1};var C=require("react/jsx-runtime"),Et={},Ht={},Lt={},Dt={},kt={};function Rt(c){return typeof c=="number"?{paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c}:{paddingTop:c?.top??0,paddingRight:c?.right??0,paddingBottom:c?.bottom??0,paddingLeft:c?.left??0}}var It=(0,t.forwardRef)(({className:c="",style:x={},containerStyle:E={},contentStyle:T={},contentBleed:H,children:ae,onScroll:$,thumb:D=Et,track:k=Ht,arrows:z=Lt,dragScroll:Z=Dt,autoHide:_=kt,showScrollbar:j=!0,showHorizontalScrollbar:ke=!0,detectInnerScroll:Ge=!1},Ke)=>{let Ve=(0,t.useRef)({});(0,t.useEffect)(()=>{Ve.current={children:ae,onScroll:$,showScrollbar:j,showHorizontalScrollbar:ke,thumb:D,track:k,arrows:z,dragScroll:Z,autoHide:_}});let fe=(0,t.useRef)(null),i=(0,t.useRef)(null),J=(0,t.useRef)(null),Q=(0,t.useRef)(null),Ze=(0,t.useRef)(null),I=(0,t.useRef)(null),[ce,v]=(0,t.useState)(!1),[W,Re]=(0,t.useState)(!1),[Ie,We]=(0,t.useState)(!1),[be,je]=(0,t.useState)({y:0,scrollTop:0}),[ee,Oe]=(0,t.useState)(0),[Je,ge]=(0,t.useState)(0),[X,Ae]=(0,t.useState)(!1),[$e,ze]=(0,t.useState)(!1),[O,Pe]=(0,t.useState)(!1),[ve,Qe]=(0,t.useState)({x:0,scrollLeft:0}),[ye,Ne]=(0,t.useState)(0),[xe,Fe]=(0,t.useState)(0),[et,Be]=(0,t.useState)(!1),Y=(0,t.useRef)(!1),[P,_e]=(0,t.useState)(!1),[te,tt]=(0,t.useState)({x:0,y:0,scrollTop:0,scrollLeft:0}),[Ot,At]=(0,t.useState)(null),[se,ue]=(0,t.useState)(null),[$t,ot]=(0,t.useState)(!1),[rt,nt]=(0,t.useState)(0),oe=(0,t.useRef)(null),[Ue,qe]=(0,t.useState)(!1),re=(0,t.useRef)(null),U=(0,t.useRef)(null),q=(0,t.useRef)(null),y=(0,t.useMemo)(()=>{let e=D.color??"#606060";return{width:D.width??8,minHeight:D.minHeight??50,radius:D.radius??(D.width??8)/2,color:e,opacity:D.opacity??.6,hoverColor:D.hoverColor??e,hoverOpacity:D.hoverOpacity??1}},[D]),n=(0,t.useMemo)(()=>({width:k.width??16,color:k.color??"rgba(128, 128, 128, 0.1)",visible:k.visible??!0,alignment:k.alignment??"default",radius:k.radius??y.radius??4,margin:k.margin??4,overflowX:k.overflowX??!0,overflowY:k.overflowY??!0}),[k,y.radius]),R=(0,t.useMemo)(()=>{let e=z.color??"#808080";return{visible:z.visible??!1,step:z.step??50,color:e,opacity:z.opacity??.6,hoverColor:z.hoverColor??e,hoverOpacity:z.hoverOpacity??1}},[z]),ne=(0,t.useMemo)(()=>({enabled:Z.enabled??!0,excludeClasses:Z.excludeClasses??[],excludeSelectors:Z.excludeSelectors??[]}),[Z]),a=(0,t.useMemo)(()=>({enabled:_.enabled??!0,delay:_.delay??1500,delayOnWheel:_.delayOnWheel??700,initialDelay:_.initialDelay??200}),[_]),lt=(0,t.useMemo)(()=>Rt(H),[H]),[G,it]=(0,t.useState)(()=>(_.initialDelay??200)>0),f=y.width,at=n.width,we=y.minHeight,A=R.visible,de=R.step,L=(0,t.useCallback)(()=>{if(!i.current)return;let e=document.activeElement;e&&i.current.contains(e)&&e!==i.current||i.current.focus()},[]);(0,t.useImperativeHandle)(Ke,()=>({getScrollContainer:()=>i.current,scrollTo:e=>{i.current&&i.current.scrollTo(e)},get scrollTop(){return i.current?.scrollTop||0},get scrollHeight(){return i.current?.scrollHeight||0},get clientHeight(){return i.current?.clientHeight||0}}),[]);let p=(0,t.useCallback)(()=>{if(I.current){let o=I.current;if(document.contains(o)&&(o.scrollHeight>o.clientHeight+2||o.scrollWidth>o.clientWidth+2))return o;I.current=null}if(!i.current)return null;if(i.current.scrollHeight>i.current.clientHeight+2||i.current.scrollWidth>i.current.clientWidth+2)return I.current=i.current,i.current;if(!Ge)return null;let e=i.current.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]');for(let o of e){let r=o;if(r!==i.current&&r.classList.contains("overlay-scrollbar-container"))continue;let s=r.parentElement,l=!1;for(;s&&s!==i.current;){if(s.classList.contains("overlay-scrollbar-container")&&s!==i.current){l=!0;break}s=s.parentElement}if(!l&&(r.scrollHeight>r.clientHeight+2||r.scrollWidth>r.clientWidth+2))return I.current=r,r}return null},[]),N=(0,t.useCallback)(()=>p()!==null,[p]),b=(0,t.useCallback)(()=>{re.current&&(clearTimeout(re.current),re.current=null)},[]),pe=(0,t.useCallback)(()=>{U.current&&(clearTimeout(U.current),U.current=null)},[]),Xe=(0,t.useCallback)(()=>{q.current&&(clearTimeout(q.current),q.current=null)},[]),ct=(0,t.useCallback)(()=>{pe(),!(W||O||P||Y.current)&&(b(),v(!1))},[b,pe,W,O,P]),h=(0,t.useCallback)(e=>{a.enabled&&(b(),re.current=setTimeout(()=>{v(!1),re.current=null},e))},[b,a.enabled]),d=(0,t.useCallback)(()=>{let e=p()??i.current;if(!e){v(!1),Ae(!1),Be(!1),b();return}!a.enabled&&!G&&(v(!0),b());let o=e.clientHeight,r=e.scrollHeight,s=e.scrollTop,l=e.clientWidth,u=e.scrollWidth,g=e.scrollLeft,w=r-o>0,m=u-l>0,K=w||m;Ae(w),Be(m),K||(v(!1),b());let le=0,S=0;if(fe.current){let F=window.getComputedStyle(fe.current),B=parseFloat(F.paddingTop)||0;S=parseFloat(F.paddingBottom)||0,le=B+S,nt(S)}if(w){let F=A?f*2+n.margin*4:n.margin*2,B=o-F+le,me=o/r,V=Math.max(B*me,we),Ye=r-o,bt=B-V,gt=Ye>0?s/Ye*bt:0;Oe(V),ge(gt)}else Oe(0),ge(0);let ie=u-l;if(ie>0){let F=l/u,B=Math.max(l*F,50),me=l-B,V=ie>0?g/ie*me:0;Ne(B),Fe(V)}else Ne(0),Fe(0)},[p,b,A,f,we,a.enabled,G]),st=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=p();o&&(Re(!0),je({y:e.clientY,scrollTop:o.scrollTop}),b(),v(!0),L())},[p,b,L]),Te=(0,t.useCallback)(e=>{if(!W)return;let o=p();if(!o)return;let r=o.clientHeight,l=o.scrollHeight-r,u=e.clientY-be.y,g=r-ee,w=u/g*l,m=Math.max(0,Math.min(l,be.scrollTop+w));o.scrollTop=m,d()},[W,be,ee,d,p]),Me=(0,t.useCallback)(()=>{Re(!1),N()&&h(a.delay)},[N,h,a.delay]),ut=(0,t.useCallback)(e=>{if(!Q.current)return;let r=Q.current.getBoundingClientRect(),s=e.clientY-r.top,l=p();if(!l)return;let u=l.clientHeight,g=l.scrollHeight,m=s/u*(g-u);l.scrollTop=Math.max(0,Math.min(g-u,m)),d(),v(!0),h(a.delay),L()},[d,h,a.delay,p,L]),dt=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!i.current)return;let o=Math.max(0,i.current.scrollTop-de);i.current.scrollTop=o,d(),v(!0),h(a.delay),L()},[d,h,de,a.delay,L]),pt=(0,t.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),!i.current||!J.current)return;let o=i.current,s=J.current.scrollHeight-o.clientHeight,l=Math.min(s,o.scrollTop+de);o.scrollTop=l,d(),v(!0),h(a.delay),L()},[d,h,de,a.delay,L]),mt=(0,t.useCallback)(e=>{e.preventDefault(),e.stopPropagation();let o=p();o&&(Pe(!0),Qe({x:e.clientX,scrollLeft:o.scrollLeft}),b(),v(!0),L())},[p,b,L]),Se=(0,t.useCallback)(e=>{if(!O)return;let o=p();if(!o)return;let r=o.clientWidth,l=o.scrollWidth-r,u=e.clientX-ve.x,g=r-ye,w=u/g*l,m=Math.max(0,Math.min(l,ve.scrollLeft+w));o.scrollLeft=m,d()},[O,ve,ye,d,p]),Ce=(0,t.useCallback)(()=>{Pe(!1),N()&&h(a.delay)},[N,h,a.delay]),ht=(0,t.useCallback)(e=>{if(!Q.current)return;let r=Q.current.getBoundingClientRect(),s=e.clientX-r.left,l=p();if(!l)return;let u=l.clientWidth,g=l.scrollWidth,m=s/u*(g-u);l.scrollLeft=Math.max(0,Math.min(g-u,m)),d(),v(!0),h(a.delay),L()},[d,h,a.delay,p,L]),ft=(0,t.useCallback)(e=>{if(!ne.enabled)return;let o=e.target;if(he(o,ne)||e.button!==0)return;let r=p();r&&(r.scrollHeight<=r.clientHeight&&r.scrollWidth<=r.clientWidth||(e.preventDefault(),Y.current=!0,tt({x:e.clientX,y:e.clientY,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft||0}),b()))},[ne,he,p,b]),Ee=(0,t.useCallback)(e=>{if(!Y.current&&!P)return;let o=p();if(!o)return;let r=te.x-e.clientX,s=te.y-e.clientY;if(Math.abs(s)<5&&Math.abs(r)<5)return;Y.current&&(Y.current=!1,_e(!0)),v(!0);let l=Math.max(0,Math.min(o.scrollHeight-o.clientHeight,te.scrollTop+s)),u=Math.max(0,Math.min(o.scrollWidth-o.clientWidth,te.scrollLeft+r));o.scrollTop=l,o.scrollLeft=u,d()},[P,te,p,d]),He=(0,t.useCallback)(()=>{let e=P;Y.current=!1,_e(!1),e&&N()&&h(a.delay)},[P,N,h,a.delay]);(0,t.useEffect)(()=>{let e=u=>{if(d(),G){$&&$(u);return}b(),v(!0),Xe();let g=Ue?a.delayOnWheel:a.delay;h(g),$&&$(u)},o=()=>{qe(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{qe(!1)},300),Xe(),q.current=setTimeout(()=>{v(!0),q.current=null,h(a.delayOnWheel)},50)},r=[],s=p();s&&r.push(s);let l=i.current;return l&&!s&&(r.push(l),l.querySelectorAll('[data-virtuoso-scroller], [style*="overflow"], .virtuoso-scroller, [style*="overflow: auto"], [style*="overflow:auto"]').forEach(g=>{let w=g;if(w!==l&&w.classList.contains("overlay-scrollbar-container"))return;let m=w.parentElement;for(;m&&m!==l;){if(m.classList.contains("overlay-scrollbar-container")&&m!==l)return;m=m.parentElement}r.push(w)})),r.forEach(u=>{u.addEventListener("scroll",e,{passive:!0}),u.addEventListener("wheel",o,{passive:!0})}),()=>{r.forEach(u=>{u.removeEventListener("scroll",e),u.removeEventListener("wheel",o)}),oe.current&&clearTimeout(oe.current),q.current&&clearTimeout(q.current)}},[p,d,$,b,h,a,Ue,G]),(0,t.useEffect)(()=>{let e=r=>{let s=r.target;if(r.defaultPrevented||s instanceof Element&&he(s,ne))return;let l=p();if(!l)return;let{key:u}=r,{scrollTop:g,scrollHeight:w,clientHeight:m}=l,K=w-m,le=50,S=null;switch(u){case"ArrowUp":r.preventDefault(),S=Math.max(0,g-le);break;case"ArrowDown":r.preventDefault(),S=Math.min(K,g+le);break;case"PageUp":r.preventDefault(),S=Math.max(0,g-m);break;case"PageDown":r.preventDefault(),S=Math.min(K,g+m);break;case"Home":r.preventDefault(),S=0;break;case"End":r.preventDefault(),S=K;break;default:return}if(S!==null){let ie=S/K,F=A?f*2+n.margin*4:n.margin*2,V=(m-F-ee)*ie;ge(V),l.scrollTop=S,b(),v(!0),h(a.delay)}},o=i.current;if(o)return o.addEventListener("keydown",e),()=>{o.removeEventListener("keydown",e)}},[p,A,f,n.margin,ee,b,h,a.delay,ne]),(0,t.useEffect)(()=>(document.addEventListener("mousemove",Ee),document.addEventListener("mouseup",He),()=>{document.removeEventListener("mousemove",Ee),document.removeEventListener("mouseup",He)}),[P,Ee,He]),(0,t.useEffect)(()=>{if(W)return document.addEventListener("mousemove",Te),document.addEventListener("mouseup",Me),()=>{document.removeEventListener("mousemove",Te),document.removeEventListener("mouseup",Me)}},[W,Te,Me]),(0,t.useEffect)(()=>{if(O)return document.addEventListener("mousemove",Se),document.addEventListener("mouseup",Ce),()=>{document.removeEventListener("mousemove",Se),document.removeEventListener("mouseup",Ce)}},[O,Se,Ce]),(0,t.useEffect)(()=>{d();let e=setTimeout(()=>{d()},100);return()=>clearTimeout(e)},[d]),(0,t.useLayoutEffect)(()=>{ot(!0),d(),!a.enabled&&!G&&N()&&v(!0)},[N,d,a.enabled,G]),(0,t.useEffect)(()=>{if(a.initialDelay>0){let e=setTimeout(()=>{it(!1)},a.initialDelay);return()=>clearTimeout(e)}},[a.initialDelay]),(0,t.useEffect)(()=>{let e=new ResizeObserver(()=>{d()}),o=[];return i.current&&o.push(i.current),J.current&&o.push(J.current),I.current&&document.contains(I.current)&&o.push(I.current),o.forEach(r=>{e.observe(r)}),()=>e.disconnect()},[d]),(0,t.useEffect)(()=>{if(!i.current)return;let e=new MutationObserver(()=>{I.current=null,d()});return e.observe(i.current,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}),()=>e.disconnect()},[d]);let M=Math.max(at,f);return(0,t.useEffect)(()=>{let e="overlay-scrollbar-webkit-hide",o=document.getElementById(e);o&&o.remove();let r=document.createElement("style");return r.id=e,r.textContent=`
|
|
2
2
|
/* \uBAA8\uB4E0 \uC2A4\uD06C\uB864\uBC14 \uC228\uAE30\uAE30 */
|
|
3
3
|
.overlay-scrollbar-container {
|
|
4
4
|
scrollbar-width: none !important;
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
.overlay-scrollbar-container .ehfuse-editor-content::-webkit-scrollbar-thumb:hover {
|
|
39
39
|
background: #a1a1a1 !important;
|
|
40
40
|
}
|
|
41
|
-
`,document.head.appendChild(r),()=>{let
|
|
41
|
+
`,document.head.appendChild(r),()=>{let s=document.getElementById(e);s&&s.remove()}},[]),(0,C.jsxs)("div",{ref:fe,className:`overlay-scrollbar-wrapper ${c}`,onMouseLeave:ct,style:{display:"flex",flexDirection:"column",position:"relative",minHeight:0,height:"100%",flex:"1 1 0%",overflow:"hidden",...x},children:[(0,C.jsx)("div",{ref:i,className:"overlay-scrollbar-container",tabIndex:-1,onMouseDown:ft,style:{display:"flex",width:"100%",flex:"1 1 auto",minHeight:0,overflow:"auto",scrollbarWidth:"none",msOverflowStyle:"none",outline:"none",userSelect:P?"none":"auto",...E},children:(0,C.jsx)("div",{ref:J,className:"overlay-scrollbar-content",style:{flex:"1 1 0%",minHeight:0,display:"flex",flexDirection:"column",boxSizing:"border-box",...lt,...T},children:ae})}),j&&X&&(n.overflowY??!0)&&(0,C.jsxs)("div",{ref:Q,className:"overlay-scrollbar-track",onMouseEnter:()=>{b(),U.current=setTimeout(()=>{v(!0),U.current=null},100)},onMouseLeave:()=>{pe(),W||h(a.delay)},style:{position:"absolute",top:0,right:0,width:`${M}px`,height:"100%",opacity:ce?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[n.visible&&(0,C.jsx)("div",{className:"overlay-scrollbar-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),ut(e)},style:{position:"absolute",top:A?`${y.width+n.margin*2}px`:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(M-y.width)/2}px`,width:`${y.width}px`,height:A?`calc(100% - ${y.width*2+n.margin*4}px)`:`calc(100% - ${n.margin*2}px)`,backgroundColor:n.color,borderRadius:`${n.radius}px`,cursor:"pointer"}}),(0,C.jsx)("div",{ref:Ze,className:"overlay-scrollbar-thumb",onMouseDown:st,onMouseEnter:()=>We(!0),onMouseLeave:()=>We(!1),style:{position:"absolute",top:`${(A?f+n.margin*2:n.margin)+Je}px`,right:n.alignment==="outside"?"0px":`${(M-f)/2}px`,width:`${f}px`,height:`${Math.max(ee,we)}px`,backgroundColor:Ie||W?y.hoverColor:y.color,opacity:Ie||W?y.hoverOpacity:y.opacity,borderRadius:`${y.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]}),j&&X&&A&&(0,C.jsx)("div",{className:"overlay-scrollbar-up-arrow",onClick:dt,onMouseEnter:()=>ue("up"),onMouseLeave:()=>ue(null),style:{position:"absolute",top:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(M-f)/2}px`,width:`${f}px`,height:`${f}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(f*.75,8)}px`,color:se==="up"?R.hoverColor:R.color,userSelect:"none",zIndex:1001,opacity:ce?se==="up"?R.hoverOpacity:R.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25B2"}),j&&X&&A&&(0,C.jsx)("div",{className:"overlay-scrollbar-down-arrow",onClick:pt,onMouseEnter:()=>ue("down"),onMouseLeave:()=>ue(null),style:{position:"absolute",bottom:`${n.margin}px`,right:n.alignment==="outside"?"0px":`${(M-f)/2}px`,width:`${f}px`,height:`${f}px`,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",fontSize:`${Math.max(f*.75,8)}px`,color:se==="down"?R.hoverColor:R.color,userSelect:"none",zIndex:1001,opacity:ce?se==="down"?R.hoverOpacity:R.opacity:0,transition:"opacity 0.2s ease-in-out, color 0.15s ease-in-out"},children:"\u25BC"}),j&&ke&&et&&(n.overflowX??!0)&&(0,C.jsxs)("div",{className:"overlay-scrollbar-horizontal-track",onMouseEnter:()=>{b(),U.current=setTimeout(()=>{v(!0),U.current=null},100)},onMouseLeave:()=>{pe(),O||h(a.delay)},style:{position:"absolute",bottom:`${rt}px`,left:0,width:"100%",height:`${M}px`,opacity:ce?1:0,transition:"opacity 0.2s ease-in-out",cursor:"pointer",zIndex:1e3,pointerEvents:"auto"},children:[n.visible&&(0,C.jsx)("div",{className:"overlay-scrollbar-horizontal-track-background",onClick:e=>{e.preventDefault(),e.stopPropagation(),ht(e)},style:{position:"absolute",bottom:n.alignment==="outside"?"0px":`${(M-f)/2}px`,left:`${n.margin}px`,right:X?n.alignment==="outside"?`${M-n.margin}px`:`${M}px`:`${n.margin}px`,height:`${f}px`,backgroundColor:n.color,borderRadius:`${n.radius}px`,cursor:"pointer"}}),(0,C.jsx)("div",{className:"overlay-scrollbar-horizontal-thumb",onMouseDown:mt,onMouseEnter:()=>ze(!0),onMouseLeave:()=>ze(!1),style:{position:"absolute",bottom:n.alignment==="outside"?"0px":`${(M-f)/2}px`,left:`${n.margin+xe}px`,right:X?n.alignment==="outside"?`${M-n.margin}px`:`${M}px`:"auto",maxWidth:X?n.alignment==="outside"?`calc(100% - ${n.margin+xe+M-n.margin}px)`:`calc(100% - ${n.margin+xe+M}px)`:"none",width:`${Math.max(ye,50)}px`,height:`${f}px`,backgroundColor:$e||O?y.hoverColor:y.color,opacity:$e||O?y.hoverOpacity:y.opacity,borderRadius:`${y.radius}px`,cursor:"pointer",transition:"background-color 0.2s ease-in-out, opacity 0.2s ease-in-out"}})]})]})}),De=It;
|
|
42
42
|
//# sourceMappingURL=index.js.map
|