You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

6 lines
6.4 KiB

  1. var x=(r,a)=>()=>(a||r((a={exports:{}}).exports,a),a.exports);var b=x((B,y)=>{/*!
  2. * Stickyfill – `position: sticky` polyfill
  3. * v. 2.1.0 | https://github.com/wilddeer/stickyfill
  4. * MIT License
  5. */(function(r,a){function R(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])}function p(e){return parseFloat(e)||0}function w(e){for(var t=0;e;)t+=e.offsetTop,e=e.offsetParent;return t}function k(){function e(){r.pageXOffset!=d.left?(d.top=r.pageYOffset,d.left=r.pageXOffset,m.refreshAll()):r.pageYOffset!=d.top&&(d.top=r.pageYOffset,d.left=r.pageXOffset,s.forEach(function(l){return l._recalcPosition()}))}function t(){o=setInterval(function(){s.forEach(function(l){return l._fastCheck()})},500)}function i(){clearInterval(o)}if(!E){E=!0,e(),r.addEventListener("scroll",e),r.addEventListener("resize",m.refreshAll),r.addEventListener("orientationchange",m.refreshAll);var o=void 0,n=void 0,f=void 0;"hidden"in a?(n="hidden",f="visibilitychange"):"webkitHidden"in a&&(n="webkitHidden",f="webkitvisibilitychange"),f?(a[n]||t(),a.addEventListener(f,function(){a[n]?i():t()})):t()}}var M=function(){function e(t,i){for(var o=0;o<i.length;o++){var n=i[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),u=!1,L=typeof r<"u";L&&r.getComputedStyle?function(){var e=a.createElement("div");["","-webkit-","-moz-","-ms-"].some(function(t){try{e.style.position=t+"sticky"}catch{}return e.style.position!=""})&&(u=!0)}():u=!0;var E=!1,P=typeof ShadowRoot<"u",d={top:null,left:null},s=[],T=function(){function e(t){if(R(this,e),!(t instanceof HTMLElement))throw new Error("First argument must be HTMLElement");if(s.some(function(i){return i._node===t}))throw new Error("Stickyfill is already applied to this node");this._node=t,this._stickyMode=null,this._active=!1,s.push(this),this.refresh()}return M(e,[{key:"refresh",value:function(){if(!u&&!this._removed){this._active&&this._deactivate();var t=this._node,i=getComputedStyle(t),o={position:i.position,top:i.top,display:i.display,marginTop:i.marginTop,marginBottom:i.marginBottom,marginLeft:i.marginLeft,marginRight:i.marginRight,cssFloat:i.cssFloat};if(!isNaN(parseFloat(o.top))&&o.display!="table-cell"&&o.display!="none"){this._active=!0;var n=t.style.position;i.position!="sticky"&&i.position!="-webkit-sticky"||(t.style.position="static");var f=t.parentNode,l=P&&f instanceof ShadowRoot?f.host:f,h=t.getBoundingClientRect(),v=l.getBoundingClientRect(),g=getComputedStyle(l);this._parent={node:l,styles:{position:l.style.position},offsetHeight:l.offsetHeight},this._offsetToWindow={left:h.left,right:a.documentElement.clientWidth-h.right},this._offsetToParent={top:h.top-v.top-p(g.borderTopWidth),left:h.left-v.left-p(g.borderLeftWidth),right:-h.right+v.right-p(g.borderRightWidth)},this._styles={position:n,top:t.style.top,bottom:t.style.bottom,left:t.style.left,right:t.style.right,width:t.style.width,marginTop:t.style.marginTop,marginLeft:t.style.marginLeft,marginRight:t.style.marginRight};var H=p(o.top);this._limits={start:h.top+r.pageYOffset-H,end:v.top+r.pageYOffset+l.offsetHeight-p(g.borderBottomWidth)-t.offsetHeight-H-p(o.marginBottom)};var O=g.position;O!="absolute"&&O!="relative"&&(l.style.position="relative"),this._recalcPosition();var _=this._clone={};_.node=a.createElement("div"),c(_.node.style,{width:h.right-h.left+"px",height:h.bottom-h.top+"px",marginTop:o.marginTop,marginBottom:o.marginBottom,marginLeft:o.marginLeft,marginRight:o.marginRight,cssFloat:o.cssFloat,padding:0,border:0,borderSpacing:0,fontSize:"1em",position:"static"}),f.insertBefore(_.node,t),_.docOffsetTop=w(_.node)}}}},{key:"_recalcPosition",value:function(){if(this._active&&!this._removed){var t=d.top<=this._limits.start?"start":d.top>=this._limits.end?"end":"middle";if(this._stickyMode!=t){switch(t){case"start":c(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:this._offsetToParent.top+"px",bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"middle":c(this._node.style,{position:"fixed",left:this._offsetToWindow.left+"px",right:this._offsetToWindow.right+"px",top:this._styles.top,bottom:"auto",width:"auto",marginLeft:0,marginRight:0,marginTop:0});break;case"end":c(this._node.style,{position:"absolute",left:this._offsetToParent.left+"px",right:this._offsetToParent.right+"px",top:"auto",bottom:0,width:"auto",marginLeft:0,marginRight:0})}this._stickyMode=t}}}},{key:"_fastCheck",value:function(){this._active&&!this._removed&&(Math.abs(w(this._clone.node)-this._clone.docOffsetTop)>1||Math.abs(this._parent.node.offsetHeight-this._parent.offsetHeight)>1)&&this.refresh()}},{key:"_deactivate",value:function(){var t=this;this._active&&!this._removed&&(this._clone.node.parentNode.removeChild(this._clone.node),delete this._clone,c(this._node.style,this._styles),delete this._styles,s.some(function(i){return i!==t&&i._parent&&i._parent.node===t._parent.node})||c(this._parent.node.style,this._parent.styles),delete this._parent,this._stickyMode=null,this._active=!1,delete this._offsetToWindow,delete this._offsetToParent,delete this._limits)}},{key:"remove",value:function(){var t=this;this._deactivate(),s.some(function(i,o){if(i._node===t._node)return s.splice(o,1),!0}),this._removed=!0}}]),e}(),m={stickies:s,Sticky:T,forceSticky:function(){u=!1,k(),this.refreshAll()},addOne:function(e){if(!(e instanceof HTMLElement)){if(!e.length||!e[0])return;e=e[0]}for(var t=0;t<s.length;t++)if(s[t]._node===e)return s[t];return new T(e)},add:function(e){if(e instanceof HTMLElement&&(e=[e]),e.length){for(var t=[],i=function(n){var f=e[n];return f instanceof HTMLElement?s.some(function(l){if(l._node===f)return t.push(l),!0})?"continue":void t.push(new T(f)):(t.push(void 0),"continue")},o=0;o<e.length;o++)i(o);return t}},refreshAll:function(){s.forEach(function(e){return e.refresh()})},removeOne:function(e){if(!(e instanceof HTMLElement)){if(!e.length||!e[0])return;e=e[0]}s.some(function(t){if(t._node===e)return t.remove(),!0})},remove:function(e){if(e instanceof HTMLElement&&(e=[e]),e.length)for(var t=function(o){var n=e[o];s.some(function(f){if(f._node===n)return f.remove(),!0})},i=0;i<e.length;i++)t(i)},removeAll:function(){for(;s.length;)s[0].remove()}};u||k(),typeof y<"u"&&y.exports?y.exports=m:L&&(r.Stickyfill=m)})(window,document)});export default b();