This commit is contained in:
62
node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.js
generated
vendored
Normal file
62
node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.scrollIntoView = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
function t(t){return "object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return (!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return !!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return !1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m);}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else {G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)));}T.push({el:B,top:G,left:J});}return T};
|
||||
|
||||
function isOptionsObject(options) {
|
||||
return options === Object(options) && Object.keys(options).length !== 0;
|
||||
}
|
||||
function defaultBehavior(actions, behavior) {
|
||||
if (behavior === void 0) {
|
||||
behavior = 'auto';
|
||||
}
|
||||
var canSmoothScroll = ('scrollBehavior' in document.body.style);
|
||||
actions.forEach(function (_ref) {
|
||||
var el = _ref.el,
|
||||
top = _ref.top,
|
||||
left = _ref.left;
|
||||
if (el.scroll && canSmoothScroll) {
|
||||
el.scroll({
|
||||
top: top,
|
||||
left: left,
|
||||
behavior: behavior
|
||||
});
|
||||
} else {
|
||||
el.scrollTop = top;
|
||||
el.scrollLeft = left;
|
||||
}
|
||||
});
|
||||
}
|
||||
function getOptions(options) {
|
||||
if (options === false) {
|
||||
return {
|
||||
block: 'end',
|
||||
inline: 'nearest'
|
||||
};
|
||||
}
|
||||
if (isOptionsObject(options)) {
|
||||
return options;
|
||||
}
|
||||
return {
|
||||
block: 'start',
|
||||
inline: 'nearest'
|
||||
};
|
||||
}
|
||||
function scrollIntoView(target, options) {
|
||||
var isTargetAttached = target.isConnected || target.ownerDocument.documentElement.contains(target);
|
||||
if (isOptionsObject(options) && typeof options.behavior === 'function') {
|
||||
return options.behavior(isTargetAttached ? i(target, options) : []);
|
||||
}
|
||||
if (!isTargetAttached) {
|
||||
return;
|
||||
}
|
||||
var computeOptions = getOptions(options);
|
||||
return defaultBehavior(i(target, computeOptions), computeOptions.behavior);
|
||||
}
|
||||
|
||||
return scrollIntoView;
|
||||
|
||||
}));
|
||||
1
node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.min.js
generated
vendored
Normal file
1
node_modules/scroll-into-view-if-needed/umd/scroll-into-view-if-needed.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).scrollIntoView=t()}(this,(function(){"use strict";function e(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function t(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function n(e,n){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var o=getComputedStyle(e,null);return t(o.overflowY,n)||t(o.overflowX,n)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function o(e,t,n,o,i,r,l,f){return r<e&&l>t||r>e&&l<t?0:r<=e&&f<=n||l>=t&&f>=n?r-e-o:l>t&&f<n||r<e&&f>n?l-t+i:0}var i=function(t,i){var r=window,l=i.scrollMode,f=i.block,u=i.inline,c=i.boundary,d=i.skipOverflowHiddenElements,s="function"==typeof c?c:function(e){return e!==c};if(!e(t))throw new TypeError("Invalid target");for(var a,h,p=document.scrollingElement||document.documentElement,m=[],g=t;e(g)&&s(g);){if((g=null==(h=(a=g).parentElement)?a.getRootNode().host||null:h)===p){m.push(g);break}null!=g&&g===document.body&&n(g)&&!n(document.documentElement)||null!=g&&n(g,d)&&m.push(g)}for(var v=r.visualViewport?r.visualViewport.width:innerWidth,w=r.visualViewport?r.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,y=window.scrollY||pageYOffset,W=t.getBoundingClientRect(),H=W.height,E=W.width,M=W.top,T=W.right,V=W.bottom,k=W.left,x="start"===f||"nearest"===f?M:"end"===f?V:M+H/2,I="center"===u?k+E/2:"end"===u?T:k,C=[],O=0;O<m.length;O++){var j=m[O],B=j.getBoundingClientRect(),D=B.height,R=B.width,L=B.top,X=B.right,Y=B.bottom,S=B.left;if("if-needed"===l&&M>=0&&k>=0&&V<=w&&T<=v&&M>=L&&V<=Y&&k>=S&&T<=X)return C;var N=getComputedStyle(j),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in j?j.offsetWidth-j.clientWidth-q-A:0,P="offsetHeight"in j?j.offsetHeight-j.clientHeight-z-F:0,Q="offsetWidth"in j?0===j.offsetWidth?0:R/j.offsetWidth:0,U="offsetHeight"in j?0===j.offsetHeight?0:D/j.offsetHeight:0;if(p===j)G="start"===f?x:"end"===f?x-w:"nearest"===f?o(y,y+w,w,z,F,y+x,y+x+H,H):x-w/2,J="start"===u?I:"center"===u?I-v/2:"end"===u?I-v:o(b,b+v,v,q,A,b+I,b+I+E,E),G=Math.max(0,G+y),J=Math.max(0,J+b);else{G="start"===f?x-L-z:"end"===f?x-Y+F+P:"nearest"===f?o(L,Y,D,z,F+P,x,x+H,H):x-(L+D/2)+P/2,J="start"===u?I-S-q:"center"===u?I-(S+R/2)+K/2:"end"===u?I-X+A+K:o(S,X,R,q,A+K,I,I+E,E);var Z=j.scrollLeft,$=j.scrollTop;x+=$-(G=Math.max(0,Math.min($+G/U,j.scrollHeight-D/U+P))),I+=Z-(J=Math.max(0,Math.min(Z+J/Q,j.scrollWidth-R/Q+K)))}C.push({el:j,top:G,left:J})}return C};function r(e){return e===Object(e)&&0!==Object.keys(e).length}return function(e,t){var n=e.isConnected||e.ownerDocument.documentElement.contains(e);if(r(t)&&"function"==typeof t.behavior)return t.behavior(n?i(e,t):[]);if(n){var o=function(e){return!1===e?{block:"end",inline:"nearest"}:r(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach((function(e){var o=e.el,i=e.top,r=e.left;o.scroll&&n?o.scroll({top:i,left:r,behavior:t}):(o.scrollTop=i,o.scrollLeft=r)}))}(i(e,o),o.behavior)}}}));
|
||||
Reference in New Issue
Block a user