diff --git a/dist/angular-sidebarjs.js b/dist/angular-sidebarjs.js index 1797c32..ba9cd0c 100644 --- a/dist/angular-sidebarjs.js +++ b/dist/angular-sidebarjs.js @@ -1,9 +1,9 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0 && arguments[0] !== undefined ? arguments[0] : ''; @@ -308,7 +308,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons instances[sidebarName] && instances[sidebarName].setPosition(position); }, - elemHasListener: _sidebarjs.SidebarJS.elemHasListener + elemHasListener: _sidebarjs2.default.elemHasListener }; } diff --git a/dist/angular-sidebarjs.min.js b/dist/angular-sidebarjs.min.js index acebf54..135cf7e 100644 --- a/dist/angular-sidebarjs.min.js +++ b/dist/angular-sidebarjs.min.js @@ -1 +1 @@ -!function t(e,n,i){function o(r,a){if(!n[r]){if(!e[r]){var c="function"==typeof require&&require;if(!a&&c)return c(r,!0);if(s)return s(r,!0);var d=new Error("Cannot find module '"+r+"'");throw d.code="MODULE_NOT_FOUND",d}var u=n[r]={exports:{}};e[r][0].call(u.exports,function(t){var n=e[r][1][t];return o(n?n:t)},u,u.exports,t,e,n,i)}return n[r].exports}for(var s="function"==typeof require&&require,r=0;r=0?t:s,c.forEach(function(t){return e.component.classList.remove(n+"--"+t)}),this.component.classList.add(n+"--"+(this.hasRightPosition()?r:s)),setTimeout(function(){return e.component.classList.remove(o)},a)},t.prototype.addAttrsEventsListeners=function(e){for(var i=["toggle","open","close"],o=0;othis.container.clientWidth/3.5?this.close():this.open(),this.container.removeAttribute("style"),this.background.removeAttribute("style"),delete this.initialTouch,delete this.touchMoveSidebar},t.prototype.moveSidebar=function(e){this.component.classList.add(o),t.vendorify(this.container,"transform","translate("+e+"px, 0)"),this.changeBackgroundOpacity(e)},t.prototype.changeBackgroundOpacity=function(t){var e=.3-Math.abs(t)/(3.5*this.container.clientWidth);this.background.style.opacity=e.toString()},t.prototype.onSwipeOpenStart=function(t){if(!this.targetElementIsBackground(t)){var e=document.body.clientWidth,n=t.touches[0].clientX,i=this.hasLeftPosition()?n:e-n;i0&&(t.vendorify(this.component,"transform","translate(0, 0)"),t.vendorify(this.component,"transition","none"),this.openMovement=i*(this.hasLeftPosition()?-1:1),this.moveSidebar(this.openMovement))}},t.prototype.onSwipeOpenEnd=function(){this.openMovement&&(delete this.openMovement,this.component.removeAttribute("style"),this.onTouchEnd())},t.prototype.getSidebarPosition=function(t){return this.container.clientWidth-(this.hasLeftPosition()?t:-t)},t.prototype.targetElementIsBackground=function(t){var e=t.target;return e.hasAttribute(n+"-background")},t.create=function(t){var e=document.createElement("div");return e.setAttribute(t,""),e},t.vendorify=function(t,e,n){var i=e.charAt(0).toUpperCase()+e.slice(1),o=["Moz","Webkit","O","ms"];t.style[e]=n;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].open()},close:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].close()},toggle:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].toggle()},isVisible:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!t[e]&&t[e].isVisible()},setPosition:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t[n]&&t[n].setPosition(e)},elemHasListener:s.SidebarJS.elemHasListener}}function e(t){return{controller:["SidebarJS",function(t){this.SidebarJS=t}],link:function(e,n,i,o){if(!o.SidebarJS.elemHasListener(n[0])){var s=i["sidebarjs"+(t.charAt(0).toUpperCase()+t.slice(1))];n[0].addEventListener("click",function(){return o.SidebarJS[t](s)}),o.SidebarJS.elemHasListener(n[0],!0)}}}}var n=function(){function t(e,n,o){i(this,t),this._$scope=e,this._SidebarJS=o,this.elem=n[0]}return t.$inject=["$scope","$element","SidebarJS"],o(t,[{key:"$onInit",value:function(){this.sidebarjsName=this.sidebarjsName||"",this.elem.setAttribute("sidebarjs",this.sidebarjsName)}},{key:"$postLink",value:function(){var t=this,e=this.elem.children[0],n=this.elem.children[1],i=Object.assign({},this.sidebarjsConfig,{component:this.elem,container:e,background:n});this._SidebarJS.init(i);var o=!1;e.addEventListener("transitionend",function(){var e=t._SidebarJS.isVisible(t.sidebarjsName);t.onOpen&&e&&!o?(o=!0,t.onOpen()):t.onClose&&!e&&o&&(o=!1,t.onClose()),t._$scope.$applyAsync()},!1)}}]),t}();angular.module("ngSidebarJS",[]).factory("SidebarJS",t).component("sidebarjs",{template:"
",transclude:!0,controller:n,bindings:{onOpen:"&?",onClose:"&?",sidebarjsConfig:"=0?t:s,c.forEach(function(t){return e.component.classList.remove(n+"--"+t)}),this.component.classList.add(n+"--"+(this.hasRightPosition()?r:s)),setTimeout(function(){return e.component.classList.remove(o)},a)},t.prototype.addAttrsEventsListeners=function(e){for(var i=["toggle","open","close"],o=0;othis.container.clientWidth/3.5?this.close():this.open(),this.container.removeAttribute("style"),this.background.removeAttribute("style"),delete this.initialTouch,delete this.touchMoveSidebar},t.prototype.moveSidebar=function(e){this.component.classList.add(o),t.vendorify(this.container,"transform","translate("+e+"px, 0)"),this.changeBackgroundOpacity(e)},t.prototype.changeBackgroundOpacity=function(t){var e=.3-Math.abs(t)/(3.5*this.container.clientWidth);this.background.style.opacity=e.toString()},t.prototype.onSwipeOpenStart=function(t){if(!this.targetElementIsBackground(t)){var e=document.body.clientWidth,n=t.touches[0].clientX,i=this.hasLeftPosition()?n:e-n;i0&&(t.vendorify(this.component,"transform","translate(0, 0)"),t.vendorify(this.component,"transition","none"),this.openMovement=i*(this.hasLeftPosition()?-1:1),this.moveSidebar(this.openMovement))}},t.prototype.onSwipeOpenEnd=function(){this.openMovement&&(delete this.openMovement,this.component.removeAttribute("style"),this.onTouchEnd())},t.prototype.getSidebarPosition=function(t){return this.container.clientWidth-(this.hasLeftPosition()?t:-t)},t.prototype.targetElementIsBackground=function(t){var e=t.target;return e.hasAttribute(n+"-background")},t.create=function(t){var e=document.createElement("div");return e.setAttribute(t,""),e},t.vendorify=function(t,e,n){var i=e.charAt(0).toUpperCase()+e.slice(1),o=["Moz","Webkit","O","ms"];t.style[e]=n;for(var s=0;s0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].open()},close:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].close()},toggle:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t[e]&&t[e].toggle()},isVisible:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return!!t[e]&&t[e].isVisible()},setPosition:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";t[n]&&t[n].setPosition(e)},elemHasListener:a["default"].elemHasListener}}function e(t){return{controller:["SidebarJS",function(t){this.SidebarJS=t}],link:function(e,n,i,o){if(!o.SidebarJS.elemHasListener(n[0])){var s=i["sidebarjs"+(t.charAt(0).toUpperCase()+t.slice(1))];n[0].addEventListener("click",function(){return o.SidebarJS[t](s)}),o.SidebarJS.elemHasListener(n[0],!0)}}}}var n=function(){function t(e,n,i){o(this,t),this._$scope=e,this._SidebarJS=i,this.elem=n[0]}return t.$inject=["$scope","$element","SidebarJS"],s(t,[{key:"$onInit",value:function(){this.sidebarjsName=this.sidebarjsName||"",this.elem.setAttribute("sidebarjs",this.sidebarjsName)}},{key:"$postLink",value:function(){var t=this,e=this.elem.children[0],n=this.elem.children[1],i=Object.assign({},this.sidebarjsConfig,{component:this.elem,container:e,background:n});this._SidebarJS.init(i);var o=!1;e.addEventListener("transitionend",function(){var e=t._SidebarJS.isVisible(t.sidebarjsName);t.onOpen&&e&&!o?(o=!0,t.onOpen()):t.onClose&&!e&&o&&(o=!1,t.onClose()),t._$scope.$applyAsync()},!1)}}]),t}();angular.module("ngSidebarJS",[]).factory("SidebarJS",t).component("sidebarjs",{template:"
",transclude:!0,controller:n,bindings:{onOpen:"&?",onClose:"&?",sidebarjsConfig:"