diff --git a/dashboard-ui/bower_components/emby-webcomponents/emby-scroller/emby-scroller.js b/dashboard-ui/bower_components/emby-webcomponents/emby-scroller/emby-scroller.js index 71c6c6f59c..71e4ed705a 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/emby-scroller/emby-scroller.js +++ b/dashboard-ui/bower_components/emby-webcomponents/emby-scroller/emby-scroller.js @@ -1 +1 @@ -define(["scroller","dom","layoutManager","registerElement"],function(scroller,dom,layoutManager){"use strict";function initCenterFocus(elem,scrollerInstance,selector){var classNames=selector.split(",");dom.addEventListener(elem,"focus",function(e){var focused=dom.parentWithClass(e.target,classNames);focused&&scrollerInstance.toCenter(focused)},{capture:!0,passive:!0})}var ScrollerProtoType=Object.create(HTMLDivElement.prototype);ScrollerProtoType.createdCallback=function(){this.classList.add("emby-scroller")},ScrollerProtoType.scrollToBeginning=function(){this.scroller&&this.scroller.slideTo(0,!0)},ScrollerProtoType.scrollToPosition=function(pos,immediate){this.scroller&&this.scroller.slideTo(pos,immediate)},ScrollerProtoType.getScrollPosition=function(){if(this.scroller)return this.scroller.getScrollPosition()},ScrollerProtoType.attachedCallback=function(){var horizontal="false"!==this.getAttribute("data-horizontal"),slider=this.querySelector(".scrollSlider");horizontal&&(slider.style["white-space"]="nowrap");var frameSizeElement,frameSizeConfig=this.getAttribute("data-framesize");"matchparent"===frameSizeConfig?frameSizeElement=this.parentNode:"matchgrandparent"===frameSizeConfig&&(frameSizeElement=this.parentNode.parentNode);var options={horizontal:horizontal,mouseDragging:1,mouseWheel:"false"!==this.getAttribute("data-mousewheel"),touchDragging:1,slidee:slider,scrollBy:200,speed:300,elasticBounds:1,dragHandle:1,scrollWidth:5e5,frameSizeElement:frameSizeElement,autoImmediate:!0,skipSlideToWhenVisible:"true"===this.getAttribute("data-skipfocuswhenvisible")},self=this;setTimeout(function(){self.scroller=new scroller(self,options),self.scroller.init();var centerFocus=self.getAttribute("data-centerfocus");centerFocus&&layoutManager.tv&&initCenterFocus(self,self.scroller,centerFocus)},0)},ScrollerProtoType.detachedCallback=function(){var scrollerInstance=this.scroller;scrollerInstance&&(scrollerInstance.destroy(),this.scroller=null)},document.registerElement("emby-scroller",{prototype:ScrollerProtoType,extends:"div"})}); \ No newline at end of file +define(["scroller","dom","layoutManager","inputManager","focusManager","registerElement"],function(scroller,dom,layoutManager,inputManager,focusManager){"use strict";function initCenterFocus(elem,scrollerInstance,selector){var classNames=selector.split(",");dom.addEventListener(elem,"focus",function(e){var focused=dom.parentWithClass(e.target,classNames);focused&&scrollerInstance.toCenter(focused)},{capture:!0,passive:!0})}function onInputCommand(e){var cmd=e.detail.command;"home"===cmd?(focusManager.focusFirst(this,"."+this.getAttribute("data-navcommands")),e.preventDefault(),e.stopPropagation()):"end"===cmd?(focusManager.focusLast(this,"."+this.getAttribute("data-navcommands")),e.preventDefault(),e.stopPropagation()):"pageup"===cmd?(focusManager.moveFocus(e.target,this,"."+this.getAttribute("data-navcommands"),-12),e.preventDefault(),e.stopPropagation()):"pagedown"===cmd&&(focusManager.moveFocus(e.target,this,"."+this.getAttribute("data-navcommands"),12),e.preventDefault(),e.stopPropagation())}var ScrollerProtoType=Object.create(HTMLDivElement.prototype);ScrollerProtoType.createdCallback=function(){this.classList.add("emby-scroller")},ScrollerProtoType.scrollToBeginning=function(){this.scroller&&this.scroller.slideTo(0,!0)},ScrollerProtoType.toStart=function(elem,immediate){this.scroller&&this.scroller.toStart(elem,immediate)},ScrollerProtoType.scrollToPosition=function(pos,immediate){this.scroller&&this.scroller.slideTo(pos,immediate)},ScrollerProtoType.getScrollPosition=function(){if(this.scroller)return this.scroller.getScrollPosition()},ScrollerProtoType.attachedCallback=function(){this.getAttribute("data-navcommands")&&inputManager.on(this,onInputCommand);var horizontal="false"!==this.getAttribute("data-horizontal"),slider=this.querySelector(".scrollSlider");horizontal&&(slider.style["white-space"]="nowrap");var options={horizontal:horizontal,mouseDragging:1,mouseWheel:"false"!==this.getAttribute("data-mousewheel"),touchDragging:1,slidee:slider,scrollBy:200,speed:horizontal?300:270,elasticBounds:1,dragHandle:1,scrollWidth:5e6,autoImmediate:!0,skipSlideToWhenVisible:"true"===this.getAttribute("data-skipfocuswhenvisible"),dispatchScrollEvent:"true"===this.getAttribute("data-scrollevent")},self=this;setTimeout(function(){self.scroller=new scroller(self,options),self.scroller.init();var centerFocus=self.getAttribute("data-centerfocus");centerFocus&&layoutManager.tv&&initCenterFocus(self,self.scroller,centerFocus)},0)},ScrollerProtoType.detachedCallback=function(){this.getAttribute("data-navcommands")&&inputManager.off(this,onInputCommand);var scrollerInstance=this.scroller;scrollerInstance&&(scrollerInstance.destroy(),this.scroller=null)},document.registerElement("emby-scroller",{prototype:ScrollerProtoType,extends:"div"})}); \ No newline at end of file diff --git a/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js b/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js index 9f35a8da11..4740a1a851 100644 --- a/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js +++ b/dashboard-ui/bower_components/emby-webcomponents/scroller/smoothscroller.js @@ -1 +1 @@ -define(["browser","layoutManager","dom","focusManager","scrollStyles"],function(browser,layoutManager,dom,focusManager){"use strict";function type(value){return null==value?String(value):"object"==typeof value||"function"==typeof value?Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof value}function disableOneEvent(event){event.preventDefault(),event.stopPropagation(),this.removeEventListener(event.type,disableOneEvent)}function within(number,min,max){return numbermax?max:number}var dragMouseEvents=["mousemove","mouseup"],dragTouchEvents=["touchmove","touchend"],wheelEvent=document.implementation.hasFeature("Event.wheel","3.0")?"wheel":"mousewheel",interactiveElements=["INPUT","SELECT","TEXTAREA"],abs=Math.abs,sqrt=Math.sqrt,pow=Math.pow,round=Math.round,max=Math.max,scrollerFactory=(Math.min,function(frame,options){function sibling(n,elem){for(var matched=[];n;n=n.nextSibling)1===n.nodeType&&n!==elem&&matched.push(n);return matched}function load(isInit){frameSize=o.horizontal?(o.frameSizeElement||frame).offsetWidth:(o.frameSizeElement||frame).offsetHeight;var slideeSize=o.scrollWidth||Math.max(slideeElement[o.horizontal?"offsetWidth":"offsetHeight"],slideeElement[o.horizontal?"scrollWidth":"scrollHeight"]);pos.start=0,pos.end=max(slideeSize-frameSize,0),isInit||slideTo(within(pos.dest,pos.start,pos.end))}function initFrameResizeObserver(){var observerOptions={};self.frameResizeObserver=new ResizeObserver(function(entries){for(var j=0,length2=entries.length;jabs(dragging.pathY):abs(dragging.pathX)dragging.pathToLock&&(dragging.locked=1,dragging.source.addEventListener("click",disableOneEvent)),dragging.released&&dragEnd(),slideTo(round(dragging.initPos-dragging.delta))}}function dragEnd(){dragging.released=!0,dragging.touch?dragTouchEvents.forEach(function(eventName){dom.removeEventListener(document,eventName,dragHandler,{passive:!0})}):dragMouseEvents.forEach(function(eventName){dom.removeEventListener(document,eventName,dragHandler,{passive:!0})}),slideeElement.classList.remove(o.draggedClass),setTimeout(function(){dragging.source.removeEventListener("click",disableOneEvent)}),dragging.init=0}function isInteractive(element){for(;element;){if(interactiveElements.indexOf(element.tagName)!==-1)return!0;element=element.parentNode}return!1}function normalizeWheelDelta(event){return scrolling.curDelta=(o.horizontal?event.deltaY||event.deltaX:event.deltaY)||-event.wheelDelta,transform&&(scrolling.curDelta/=1===event.deltaMode?3:100),scrolling.curDelta}function scrollHandler(event){if(o.scrollBy&&pos.start!==pos.end){var delta=normalizeWheelDelta(event);transform?(delta>0&&pos.destpos.start,self.slideBy(o.scrollBy*delta)):(isSmoothScrollSupported&&(delta*=12),o.horizontal?nativeScrollElement.scrollLeft+=delta:nativeScrollElement.scrollTop+=delta)}}function onResize(){load(!1)}function resetScroll(){o.horizontal?this.scrollLeft=0:this.scrollTop=0}function onFrameClick(e){if(1===e.which){var focusableParent=focusManager.focusableParent(e.target);focusableParent&&focusableParent!==document.activeElement&&focusableParent.focus()}}var o=Object.assign({},{slidee:null,horizontal:!1,mouseWheel:!0,scrollBy:0,dragSource:null,mouseDragging:1,touchDragging:1,swingSpeed:.2,dragThreshold:3,intervactive:null,speed:0,draggedClass:"dragged",activeClass:"active",disabledClass:"disabled"},options),isSmoothScrollSupported="scrollBehavior"in document.documentElement.style;isSmoothScrollSupported&&browser.firefox?options.enableNativeScroll=!0:options.requireAnimation&&browser.animate?options.enableNativeScroll=!1:layoutManager.tv&&browser.animate||(options.enableNativeScroll=!0);var self=this;self.options=o;var slideeElement=o.slidee?o.slidee:sibling(frame.firstChild)[0],frameSize=0,pos={start:0,center:0,end:0,cur:0,dest:0},transform=!options.enableNativeScroll,scrollSource=frame,dragSourceElement=o.dragSource?o.dragSource:frame,animation={},dragging={released:1},scrolling={last:0,delta:0,resetTime:200};self.initialized=0,self.slidee=slideeElement,self.options=o,self.dragging=dragging;var nativeScrollElement=frame;self.reload=function(){load()};self.getPos=function(item){var scrollElement=transform?slideeElement:nativeScrollElement,slideeOffset=getBoundingClientRect(scrollElement),itemOffset=getBoundingClientRect(item),offset=(o.horizontal?slideeOffset.left:slideeOffset.top,o.horizontal?slideeOffset.right:slideeOffset.bottom,o.horizontal?itemOffset.left-slideeOffset.left:itemOffset.top-slideeOffset.top),size=o.horizontal?itemOffset.width:itemOffset.height;size||0===size||(size=item[o.horizontal?"offsetWidth":"offsetHeight"]);var centerOffset=o.centerOffset||0;transform||(centerOffset=0,offset+=o.horizontal?nativeScrollElement.scrollLeft:nativeScrollElement.scrollTop);var currentStart=pos.cur,currentEnd=currentStart+frameSize,isVisible=offset>=currentStart&&offset+size<=currentEnd;return{start:offset,center:offset+centerOffset-frameSize/2+size/2,end:offset-frameSize+size,size:size,isVisible:isVisible}},self.getCenterPosition=function(item){var pos=self.getPos(item);return within(pos.center,pos.start,pos.end)},self.slideBy=function(delta,immediate){delta&&slideTo(pos.dest+delta,immediate)},self.slideTo=function(pos,immediate){slideTo(pos,immediate)},self.toStart=function(item,immediate){to("start",item,immediate)},self.toEnd=function(item,immediate){to("end",item,immediate)},self.toCenter=function(item,immediate){to("center",item,immediate)},self.destroy=function(){return dom.removeEventListener(window,"resize",onResize,{passive:!0}),self.frameResizeObserver&&(self.frameResizeObserver.disconnect(),self.frameResizeObserver=null),dom.removeEventListener(frame,"scroll",resetScroll,{passive:!0}),dom.removeEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0}),dom.removeEventListener(dragSourceElement,"touchstart",dragInitSlidee,{passive:!0}),dom.removeEventListener(frame,"click",onFrameClick,{passive:!0,capture:!0}),dom.removeEventListener(dragSourceElement,"mousedown",dragInitSlidee,{}),self.initialized=0,self},self.getScrollPosition=function(){return pos.cur},self.init=function(){if(!self.initialized)return transform?(frame.style.overflow="hidden",slideeElement.style["will-change"]="transform",slideeElement.style.transition="transform "+o.speed+"ms ease-out",o.horizontal?slideeElement.classList.add("animatedScrollX"):slideeElement.classList.add("animatedScrollY")):o.horizontal?layoutManager.desktop?nativeScrollElement.classList.add("smoothScrollX"):nativeScrollElement.classList.add("hiddenScrollX"):layoutManager.desktop?nativeScrollElement.classList.add("smoothScrollY"):nativeScrollElement.classList.add("hiddenScrollY"),(o.horizontal||transform)&&dom.addEventListener(dragSourceElement,"mousedown",dragInitSlidee,{}),transform?(dom.addEventListener(dragSourceElement,"touchstart",dragInitSlidee,{passive:!0}),window.ResizeObserver?initFrameResizeObserver():o.scrollWidth||dom.addEventListener(window,"resize",onResize,{passive:!0}),o.horizontal||dom.addEventListener(frame,"scroll",resetScroll,{passive:!0}),o.mouseWheel&&dom.addEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0})):o.horizontal&&o.mouseWheel&&dom.addEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0}),dom.addEventListener(frame,"click",onFrameClick,{passive:!0,capture:!0}),self.initialized=1,load(!0),self}});return scrollerFactory.create=function(frame,options){var instance=new scrollerFactory(frame,options);return Promise.resolve(instance)},scrollerFactory}); \ No newline at end of file +define(["browser","layoutManager","dom","focusManager","scrollStyles"],function(browser,layoutManager,dom,focusManager){"use strict";function type(value){return null==value?String(value):"object"==typeof value||"function"==typeof value?Object.prototype.toString.call(value).match(/\s([a-z]+)/i)[1].toLowerCase()||"object":typeof value}function disableOneEvent(event){event.preventDefault(),event.stopPropagation(),this.removeEventListener(event.type,disableOneEvent)}function within(number,min,max){return numbermax?max:number}var dragMouseEvents=["mousemove","mouseup"],dragTouchEvents=["touchmove","touchend"],wheelEvent=document.implementation.hasFeature("Event.wheel","3.0")?"wheel":"mousewheel",interactiveElements=["INPUT","SELECT","TEXTAREA"],abs=Math.abs,sqrt=Math.sqrt,pow=Math.pow,round=Math.round,max=Math.max,scrollerFactory=(Math.min,function(frame,options){function sibling(n,elem){for(var matched=[];n;n=n.nextSibling)1===n.nodeType&&n!==elem&&matched.push(n);return matched}function ensureSizeInfo(){if(requiresReflow){requiresReflow=!1,frameSize=o.horizontal?frame.offsetWidth:frame.offsetHeight;var slideeSize=o.scrollWidth||Math.max(slideeElement[o.horizontal?"offsetWidth":"offsetHeight"],slideeElement[o.horizontal?"scrollWidth":"scrollHeight"]);pos.end=max(slideeSize-frameSize,0)}}function load(isInit){requiresReflow=!0,isInit||(ensureSizeInfo(),slideTo(within(pos.dest,pos.start,pos.end)))}function initFrameResizeObserver(){var observerOptions={};self.frameResizeObserver=new ResizeObserver(function(entries){for(var j=0,length2=entries.length;jabs(dragging.pathY):abs(dragging.pathX)dragging.pathToLock&&(dragging.locked=1,dragging.source.addEventListener("click",disableOneEvent)),dragging.released&&dragEnd(),slideTo(round(dragging.initPos-dragging.delta))}}function dragEnd(){dragging.released=!0,dragTouchEvents.forEach(function(eventName){dom.removeEventListener(document,eventName,dragHandler,{passive:!0})}),dragMouseEvents.forEach(function(eventName){dom.removeEventListener(document,eventName,dragHandler,{passive:!0})}),setTimeout(function(){dragging.source.removeEventListener("click",disableOneEvent)}),dragging.init=0}function isInteractive(element){for(;element;){if(interactiveElements.indexOf(element.tagName)!==-1)return!0;element=element.parentNode}return!1}function normalizeWheelDelta(event){return scrolling.curDelta=(o.horizontal?event.deltaY||event.deltaX:event.deltaY)||-event.wheelDelta,transform&&(scrolling.curDelta/=1===event.deltaMode?3:100),scrolling.curDelta}function scrollHandler(event){if(ensureSizeInfo(),o.scrollBy&&pos.start!==pos.end){var delta=normalizeWheelDelta(event);transform?(delta>0&&pos.destpos.start,self.slideBy(o.scrollBy*delta)):(isSmoothScrollSupported&&(delta*=12),o.horizontal?nativeScrollElement.scrollLeft+=delta:nativeScrollElement.scrollTop+=delta)}}function onResize(){load(!1)}function resetScroll(){o.horizontal?this.scrollLeft=0:this.scrollTop=0}function onFrameClick(e){if(1===e.which){var focusableParent=focusManager.focusableParent(e.target);focusableParent&&focusableParent!==document.activeElement&&focusableParent.focus()}}var o=Object.assign({},{slidee:null,horizontal:!1,mouseWheel:!0,scrollBy:0,dragSource:null,mouseDragging:1,touchDragging:1,swingSpeed:.2,dragThreshold:3,intervactive:null,speed:0},options),isSmoothScrollSupported="scrollBehavior"in document.documentElement.style,browserSupportsAnimation=!!browser.animate;isSmoothScrollSupported&&browser.firefox?options.enableNativeScroll=!0:options.requireAnimation&&browserSupportsAnimation?options.enableNativeScroll=!1:layoutManager.tv&&browserSupportsAnimation||(options.enableNativeScroll=!0);var self=this;self.options=o;var slideeElement=o.slidee?o.slidee:sibling(frame.firstChild)[0],pos={start:0,center:0,end:0,cur:0,dest:0},transform=!options.enableNativeScroll,scrollSource=frame,dragSourceElement=o.dragSource?o.dragSource:frame,animation={},dragging={released:1},scrolling={last:0,delta:0,resetTime:200};self.initialized=0,self.slidee=slideeElement,self.options=o,self.dragging=dragging;var nativeScrollElement=frame,requiresReflow=!0,frameSize=0;self.reload=function(){load()};self.getPos=function(item){var scrollElement=transform?slideeElement:nativeScrollElement,slideeOffset=getBoundingClientRect(scrollElement),itemOffset=getBoundingClientRect(item),offset=(o.horizontal?slideeOffset.left:slideeOffset.top,o.horizontal?slideeOffset.right:slideeOffset.bottom,o.horizontal?itemOffset.left-slideeOffset.left:itemOffset.top-slideeOffset.top),size=o.horizontal?itemOffset.width:itemOffset.height;size||0===size||(size=item[o.horizontal?"offsetWidth":"offsetHeight"]);var centerOffset=o.centerOffset||0;transform||(centerOffset=0,offset+=o.horizontal?nativeScrollElement.scrollLeft:nativeScrollElement.scrollTop),ensureSizeInfo();var currentStart=pos.cur,currentEnd=currentStart+frameSize,isVisible=offset>=currentStart&&offset+size<=currentEnd;return{start:offset,center:offset+centerOffset-frameSize/2+size/2,end:offset-frameSize+size,size:size,isVisible:isVisible}},self.getCenterPosition=function(item){ensureSizeInfo();var pos=self.getPos(item);return within(pos.center,pos.start,pos.end)},self.slideBy=function(delta,immediate){delta&&slideTo(pos.dest+delta,immediate)},self.slideTo=function(pos,immediate){slideTo(pos,immediate)},self.toStart=function(item,immediate){to("start",item,immediate)},self.toEnd=function(item,immediate){to("end",item,immediate)},self.toCenter=function(item,immediate){to("center",item,immediate)},self.destroy=function(){return dom.removeEventListener(window,"resize",onResize,{passive:!0}),self.frameResizeObserver&&(self.frameResizeObserver.disconnect(),self.frameResizeObserver=null),dom.removeEventListener(frame,"scroll",resetScroll,{passive:!0}),dom.removeEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0}),dom.removeEventListener(dragSourceElement,"touchstart",dragInitSlidee,{passive:!0}),dom.removeEventListener(frame,"click",onFrameClick,{passive:!0,capture:!0}),dom.removeEventListener(dragSourceElement,"mousedown",dragInitSlidee,{}),self.initialized=0,self},self.getScrollPosition=function(){return pos.cur},self.init=function(){if(!self.initialized)return transform?(frame.style.overflow="hidden",slideeElement.style["will-change"]="transform",slideeElement.style.transition="transform "+o.speed+"ms ease-out",o.horizontal?slideeElement.classList.add("animatedScrollX"):slideeElement.classList.add("animatedScrollY")):o.horizontal?layoutManager.desktop?nativeScrollElement.classList.add("smoothScrollX"):nativeScrollElement.classList.add("hiddenScrollX"):layoutManager.desktop?nativeScrollElement.classList.add("smoothScrollY"):nativeScrollElement.classList.add("hiddenScrollY"),(transform||layoutManager.tv)&&dom.addEventListener(dragSourceElement,"mousedown",dragInitSlidee,{}),transform?(dom.addEventListener(dragSourceElement,"touchstart",dragInitSlidee,{passive:!0}),window.ResizeObserver?initFrameResizeObserver():o.scrollWidth||dom.addEventListener(window,"resize",onResize,{passive:!0}),o.horizontal||dom.addEventListener(frame,"scroll",resetScroll,{passive:!0}),o.mouseWheel&&dom.addEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0})):o.horizontal&&o.mouseWheel&&dom.addEventListener(scrollSource,wheelEvent,scrollHandler,{passive:!0}),dom.addEventListener(frame,"click",onFrameClick,{passive:!0,capture:!0}),self.initialized=1,load(!0),self}});return scrollerFactory.create=function(frame,options){var instance=new scrollerFactory(frame,options);return Promise.resolve(instance)},scrollerFactory}); \ No newline at end of file