Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ustyle

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ustyle - npm Package Compare versions

Comparing version 1.12.6 to 1.14.1

301

dist/ustyle.js

@@ -108,303 +108,2 @@ var slice = [].slice;

var createContext;
var ref = this.Utils;
var merge = ref.merge;
var addClass = ref.addClass;
var hasClass = ref.hasClass;
var setOptions = ref.setOptions;
var removeClass = ref.removeClass;
var transformKey = ref.transformKey;
var indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
} return -1;
};
createContext = function(options) {
var Anchor;
return Anchor = (function() {
var documentYBoundary;
var getXBounds;
var getYBounds;
Anchor.prototype.defaults = {
classPrefix: "us-anchor",
openEvent: "click",
showClose: true,
isAjax: false
};
function Anchor(options) {
var ref1 = this.options = setOptions(options, this.defaults);
var ref2;
this.target = ref1.target;
this.classPrefix = ref1.classPrefix;
if (this.target === null) {
return;
}
this._boundEvents = [];
this._closeTargets = [];
ref2 = this.create(),
this.anchor = ref2.anchor,
this.arrow = ref2.arrow,
this.content = ref2.content;
this.setEvents(this.anchor);
this.watchWindow();
}
Anchor.prototype.setEvents = function(anchor) {
var toggle = (function(_this) {
return function(event) {
event.preventDefault();
event.stopPropagation();
if (!_this.isOpen()) {
return _this.show(anchor);
} else {
return _this.hide(anchor);
}
};
})(this);
var hide = (function(_this) {
return function(event) {
var ref1;
if (!_this.isOpen()) {
return;
}
if (ref1 = event.target, indexOf.call(_this._closeTargets, ref1) >= 0) {
event.preventDefault();
event.stopPropagation();
_this.hide(anchor);
}
if (event.target === anchor || anchor.contains(event.target)) {
return;
}
if (event.target === _this.target || _this.target.contains(event.target)) {
return;
}
return _this.hide(anchor);
};
})(this);
this._on(this.target, this.options.openEvent, toggle);
return this._on(document, this.options.openEvent, hide);
};
Anchor.prototype._on = function(element, event, handler) {
this._boundEvents.push({
element: element,
event: event,
handler: handler
});
return element.addEventListener(event, handler, false);
};
Anchor.prototype.show = function(anchor) {
var ref1;
var ref2;
var fire = (function(_this) {
return function() {
_this.content.appendChild(_this.options.content);
if (!anchor.parentNode) {
document.body.appendChild(anchor);
}
addClass(anchor, _this.classPrefix + "--open");
setTimeout(function() {
return addClass(anchor, _this.classPrefix + "--after-open");
});
return _this.setPosition();
};
})(this);
if (this.options.isAjax) {
return (ref1 = this.options.onOpen) != null ? ref1.call().done(function() {
return fire();
}) : void 0;
} else {
fire();
return (ref2 = this.options.onOpen) != null ? ref2.call() : void 0;
}
};
Anchor.prototype.hide = function(anchor) {
var ref1;
removeClass(anchor, this.classPrefix + "--open");
removeClass(anchor, this.classPrefix + "--after-open");
return (ref1 = this.options.onClose) != null ? ref1.call() : void 0;
};
Anchor.prototype.isOpen = function() {
return hasClass(this.anchor, this.classPrefix + "--open");
};
Anchor.prototype.create = function() {
var anchor;
var anchorCss;
var closeButton;
var arrow = document.createElement("div");
var content = document.createElement("div");
var arrowInner = document.createElement("div");
addClass(content, this.classPrefix + "__content");
addClass(arrowInner, this.classPrefix + "__arrow-inner");
addClass(arrow, this.classPrefix + "__arrow");
arrow.appendChild(arrowInner);
content.appendChild(arrow);
if (this.options.showClose) {
closeButton = document.createElement("a");
closeButton.href = "#";
addClass(closeButton, this.classPrefix + "__close-button");
content.appendChild(closeButton);
this._closeTargets.push(closeButton);
}
anchor = document.createElement("div");
addClass(anchor, this.classPrefix);
anchorCss = anchor.style;
anchorCss.position = "absolute";
anchorCss.zIndex = "9999";
anchorCss.top = "0px";
anchorCss.left = "0px";
anchor.appendChild(content);
addClass(document.documentElement, this.classPrefix + "--ready");
return {
anchor: anchor,
arrow: arrow,
content: content
};
};
Anchor.prototype.setPosition = function() {
var style;
var bottomOffset;
var transformXOrigin;
var transformYOrigin;
var leftOffset = getXBounds(this.target, this.anchor, this.arrow);
var targetBounds = this.target.getBoundingClientRect();
if (documentYBoundary(targetBounds, this.anchor)) {
addClass(this.anchor, this.classPrefix + "--bottom");
removeClass(this.anchor, this.classPrefix + "--top");
transformYOrigin = "calc(100% + 12px)";
bottomOffset = getYBounds(this.target, this.anchor, this.arrow);
} else {
addClass(this.anchor, this.classPrefix + "--top");
removeClass(this.anchor, this.classPrefix + "--bottom");
transformYOrigin = "-12px";
bottomOffset = getYBounds(this.target, this.anchor, this.arrow);
}
style = "translateX(" + (Math.round(leftOffset)) + "px) ";
style += "translateY(" + (Math.round(bottomOffset)) + "px)";
if (transformKey !== "msTransform") {
style += " translateZ(0)";
}
this.anchor.style[transformKey] = style;
transformXOrigin = (targetBounds.left - this.anchor.getBoundingClientRect().left) + (this.target.offsetWidth / 2);
this.arrow.style.left = transformXOrigin + "px";
return this.content.style[transformKey + "Origin"] = transformXOrigin + "px " + transformYOrigin;
};
getXBounds = function(target, anchor, arrow) {
var targetBounds = target.getBoundingClientRect();
var calculatedWidth = targetBounds.left + (anchor.offsetWidth / 2) + (target.offsetWidth / 2);
var centerPoint = targetBounds.left + target.offsetWidth / 2;
if (document.body.offsetWidth < calculatedWidth) {
return document.body.offsetWidth - anchor.offsetWidth;
} else if (centerPoint - anchor.offsetWidth / 2 < 0) {
return 0;
} else {
return targetBounds.left - (anchor.offsetWidth / 2) + (target.offsetWidth / 2);
}
};
getYBounds = function(target, anchor, arrow) {
var targetBounds = target.getBoundingClientRect();
if (documentYBoundary(targetBounds, anchor)) {
return targetBounds.top - (anchor.offsetHeight - window.pageYOffset) + arrow.offsetHeight - target.offsetHeight;
} else {
return targetBounds.top + arrow.offsetHeight + target.offsetHeight + window.pageYOffset;
}
};
documentYBoundary = function(target, anchor) {
if (target.top < anchor.offsetHeight) {
return;
}
return (window.innerHeight - target.top) < anchor.offsetHeight;
};
Anchor.prototype.watchWindow = function() {
var event;
var i;
var len;
var ref1 = ["resize", "scroll", "touchmove"];
var results = [];
for (i = 0, len = ref1.length; i < len; i++) {
event = ref1[i];
results.push(window.addEventListener(event, (function(_this) {
return function(event) {
var lastFired;
var maxWait;
var now;
var throttle;
var timer;
if (!_this.isOpen()) {
return;
}
now = +(new Date);
throttle = 16;
maxWait = throttle * 3;
if (!timer) {
if (now - lastFired > maxWait) {
_this.setPosition();
lastFired = now;
}
return timer = setTimeout(function(o) {
timer = null;
lastFired = +(new Date);
return _this.setPosition();
}, throttle);
}
};
})(this), false));
}
return results;
};
return Anchor;
})();
};
window.Anchor = createContext();
window.Backdrop = (function() {

@@ -411,0 +110,0 @@ var holds = 0;

2

dist/ustyle.min.js

@@ -1,1 +0,1 @@

var slice=[].slice,hasProp={}.hasOwnProperty;null==this.Utils&&(this.Utils={modules:[]});var addClass=function(a,b){return removeClass(a,b),a.className+=" "+b+" "},removeClass=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)","gi");return a.className=a.className.replace(c,"")},hasClass=function(a,b){return new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},merge=function(){var a,b,c,d,e=arguments[0],f=2<=arguments.length?slice.call(arguments,1):[];for(b=0,c=f.length;b<c;b++){a=f[b];for(d in a)hasProp.call(a,d)&&(e[d]=a[d])}return e},setOptions=function(a,b){return merge({},b,a)},deleteUndefined=function(a){var b,c,d=[];for(b in a)c=a[b],null===c||void 0===c?d.push(delete a[b]):d.push(void 0);return d},transformKey=function(){var a,b,c,d=document.createElement("div"),e=["transform","webkitTransform","OTransform","MozTransform","msTransform"];for(a=0,c=e.length;a<c;a++)if(b=e[a],void 0!==d.style[b])return b}(),requestAnimationFrame=function(a){var b,c,d,e=["ms","moz","webkit","o"];for(b=0,c=e.length;b<c&&(d=e[b],!a.requestAnimationFrame);b++)a.requestAnimationFrame=a[d+"RequestAnimationFrame"];return a.requestAnimationFrame||(a.requestAnimationFrame=function(a){return setTimeout(a,1e3/60)})}(window);this.Utils={addClass:addClass,removeClass:removeClass,hasClass:hasClass,merge:merge,setOptions:setOptions,deleteUndefined:deleteUndefined,transformKey:transformKey,requestAnimationFrame:requestAnimationFrame};var createContext,ref=this.Utils,merge=ref.merge,addClass=ref.addClass,hasClass=ref.hasClass,setOptions=ref.setOptions,removeClass=ref.removeClass,transformKey=ref.transformKey,indexOf=[].indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};createContext=function(a){var b;return b=function(){function a(a){var b,c=this.options=setOptions(a,this.defaults);this.target=c.target,this.classPrefix=c.classPrefix,null!==this.target&&(this._boundEvents=[],this._closeTargets=[],b=this.create(),this.anchor=b.anchor,this.arrow=b.arrow,this.content=b.content,this.setEvents(this.anchor),this.watchWindow())}var b,c,d;return a.prototype.defaults={classPrefix:"us-anchor",openEvent:"click",showClose:!0,isAjax:!1},a.prototype.setEvents=function(a){var b=function(b){return function(c){return c.preventDefault(),c.stopPropagation(),b.isOpen()?b.hide(a):b.show(a)}}(this),c=function(b){return function(c){var d;if(b.isOpen()&&(d=c.target,indexOf.call(b._closeTargets,d)>=0&&(c.preventDefault(),c.stopPropagation(),b.hide(a)),c.target!==a&&!a.contains(c.target)&&c.target!==b.target&&!b.target.contains(c.target)))return b.hide(a)}}(this);return this._on(this.target,this.options.openEvent,b),this._on(document,this.options.openEvent,c)},a.prototype._on=function(a,b,c){return this._boundEvents.push({element:a,event:b,handler:c}),a.addEventListener(b,c,!1)},a.prototype.show=function(a){var b,c,d=function(b){return function(){return b.content.appendChild(b.options.content),a.parentNode||document.body.appendChild(a),addClass(a,b.classPrefix+"--open"),setTimeout(function(){return addClass(a,b.classPrefix+"--after-open")}),b.setPosition()}}(this);return this.options.isAjax?null!=(b=this.options.onOpen)?b.call().done(function(){return d()}):void 0:(d(),null!=(c=this.options.onOpen)?c.call():void 0)},a.prototype.hide=function(a){var b;return removeClass(a,this.classPrefix+"--open"),removeClass(a,this.classPrefix+"--after-open"),null!=(b=this.options.onClose)?b.call():void 0},a.prototype.isOpen=function(){return hasClass(this.anchor,this.classPrefix+"--open")},a.prototype.create=function(){var a,b,c,d=document.createElement("div"),e=document.createElement("div"),f=document.createElement("div");return addClass(e,this.classPrefix+"__content"),addClass(f,this.classPrefix+"__arrow-inner"),addClass(d,this.classPrefix+"__arrow"),d.appendChild(f),e.appendChild(d),this.options.showClose&&(c=document.createElement("a"),c.href="#",addClass(c,this.classPrefix+"__close-button"),e.appendChild(c),this._closeTargets.push(c)),a=document.createElement("div"),addClass(a,this.classPrefix),b=a.style,b.position="absolute",b.zIndex="9999",b.top="0px",b.left="0px",a.appendChild(e),addClass(document.documentElement,this.classPrefix+"--ready"),{anchor:a,arrow:d,content:e}},a.prototype.setPosition=function(){var a,e,f,g,h=c(this.target,this.anchor,this.arrow),i=this.target.getBoundingClientRect();return b(i,this.anchor)?(addClass(this.anchor,this.classPrefix+"--bottom"),removeClass(this.anchor,this.classPrefix+"--top"),g="calc(100% + 12px)",e=d(this.target,this.anchor,this.arrow)):(addClass(this.anchor,this.classPrefix+"--top"),removeClass(this.anchor,this.classPrefix+"--bottom"),g="-12px",e=d(this.target,this.anchor,this.arrow)),a="translateX("+Math.round(h)+"px) ",a+="translateY("+Math.round(e)+"px)","msTransform"!==transformKey&&(a+=" translateZ(0)"),this.anchor.style[transformKey]=a,f=i.left-this.anchor.getBoundingClientRect().left+this.target.offsetWidth/2,this.arrow.style.left=f+"px",this.content.style[transformKey+"Origin"]=f+"px "+g},c=function(a,b,c){var d=a.getBoundingClientRect(),e=d.left+b.offsetWidth/2+a.offsetWidth/2,f=d.left+a.offsetWidth/2;return document.body.offsetWidth<e?document.body.offsetWidth-b.offsetWidth:f-b.offsetWidth/2<0?0:d.left-b.offsetWidth/2+a.offsetWidth/2},d=function(a,c,d){var e=a.getBoundingClientRect();return b(e,c)?e.top-(c.offsetHeight-window.pageYOffset)+d.offsetHeight-a.offsetHeight:e.top+d.offsetHeight+a.offsetHeight+window.pageYOffset},b=function(a,b){if(!(a.top<b.offsetHeight))return window.innerHeight-a.top<b.offsetHeight},a.prototype.watchWindow=function(){var a,b,c,d=["resize","scroll","touchmove"],e=[];for(b=0,c=d.length;b<c;b++)a=d[b],e.push(window.addEventListener(a,function(a){return function(b){var c,d,e,f,g;if(a.isOpen())return e=+new Date,f=16,d=3*f,g?void 0:(e-c>d&&(a.setPosition(),c=e),g=setTimeout(function(b){return g=null,c=+new Date,a.setPosition()},f))}}(this),!1));return e},a}()},window.Anchor=createContext(),window.Backdrop=function(){function a(){d=document.querySelector(".us-backdrop"),null==d&&(d=b())}var b,c=0,d=null;return a.prototype.element=d,b=function(){return d=document.createElement("div"),Utils.addClass(d,"us-backdrop"),document.body.appendChild(d)},a.prototype.retain=function(){var a;if(c++,1===c)return Utils.addClass(d,"us-backdrop--visible"),a=function(){if(c>=1)return Utils.addClass(d,"us-backdrop--active")},Utils.requestAnimationFrame.call(window,a)},a.prototype.release=function(){var a;return 1===c&&(Utils.removeClass(d,"us-backdrop--active"),a=function(){return setTimeout(function(){if(0===c)return Utils.removeClass(d,"us-backdrop--visible")},300)},Utils.requestAnimationFrame.call(window,a)),c=Math.max(0,c-1)},a}(),window.Overlay=function(a){function b(a){if(this.overlay=(this.options=f(a,h)).overlay,null==this.overlay||"undefined"==typeof Backdrop||null===Backdrop)throw new Error("There's no overlay or you haven't included Backdrop");this.backdrop=new Backdrop,this.addEventListeners()}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions,g=a.requestAnimationFrame,h={bodyActiveClass:"us-overlay--open",activeClass:"us-overlay-parent--active",visibleClass:"us-overlay-parent--visible",overlay:$(".us-overlay-parent"),openButton:".js-open-overlay",closeButton:".js-close-overlay",historyStatus:"#seedeal",history:!1,preventDefault:!0,animationSpeed:300};return b.prototype.addEventListeners=function(){if($(this.options.openButton).on("click.open-overlay",function(a){return function(b){return a.options.preventDefault&&b.preventDefault(),a.show(b)}}(this)),this.overlay.on("click.close-overlay",function(a){return function(b){for(var c=[],d=a.overlay.find(a.options.closeButton).toArray(),e=[a.overlay[0]].concat(d),f=e.length-1;f>=0;f--){var g=e[f];if(b.target===g){a.options.preventDefault&&b.preventDefault(),a.hide(b);break}c.push(void 0)}return c}}(this)),this.hasHistory())return window.onpopstate=function(a){return function(b){if(a.isOpen())return a.hide(b)}}(this)},b.prototype.show=function(a){var b,d=this;if($(document.body).addClass(this.options.bodyActiveClass),this.backdrop.retain(),c(this.overlay[0],this.options.visibleClass),b=function(){return c(d.overlay[0],d.options.activeClass),setTimeout(function(){var b;return"function"==typeof(b=d.options).onOpen?b.onOpen(a):void 0},d.options.animationSpeed)},g.call(window,b),this.hasHistory())return history.pushState("open",window.document.title,this.options.historyStatus)},b.prototype.hide=function(a){var b,c=this;if($(document.body).removeClass(this.options.bodyActiveClass),this.backdrop.release(),b=function(){return e(c.overlay[0],c.options.activeClass),setTimeout(function(){var b;return e(c.overlay[0],c.options.visibleClass),"function"==typeof(b=c.options).onClose?b.onClose(a):void 0},c.options.animationSpeed)},g.call(window,b),this.hasHistory()&&"open"===history.state)return history.back()},b.prototype.isOpen=function(){return d(this.overlay[0],this.options.activeClass)},b.prototype.hasHistory=function(){return this.options.history&&window.history&&window.history.pushState},b}(this.Utils);var setOptions=this.Utils.setOptions;window.Tabs=function(a){var b;return b=function(){function a(a){var b=this.options=setOptions(a,this.defaults),c=b.tabContainer,d=b.tabLinks;this.tabs=$(c).find(d),this.filter=this.tabs.data("target")?"data-target":"href",this.init(),this.tabs.on("click.ustyle.tab",function(a){return function(b){var c=$(b.currentTarget);return a.isAccordion()&&a.options.collapsible&&a.isActive(c)?(a.collapse(c),a.hashClear()):(a.navigateTo(c),a.scrollToTab(c),a.hashChange(c)),b.preventDefault()}}(this))}var b;return a.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},a.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b.length?this.navigateTo(b):a.length?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.first())},a.prototype.hashChange=function(a){if(this.options.changeUrls)return location.replace("#!"+b(a).replace(/#/,""))},a.prototype.hashClear=function(){if(this.options.changeUrls){var a=window.location.pathname+window.location.search;return"function"==typeof history.replaceState?history.replaceState("",document.title,a):void 0}},a.prototype.navigateTo=function(a){var c=b(a),d=$(c);return this.tabs.removeClass(this.options.activeClass).end(),this.tabs.filter("["+this.filter+"='"+c+"']").addClass(this.options.activeClass),d.siblings("."+this.options.activeClass).removeClass(this.options.activeClass).end().addClass(this.options.activeClass),d.trigger("ustyle.tab.active")},a.prototype.collapse=function(a){var c=$(b(a));return this.tabs.removeClass(this.options.activeClass).end(),c.removeClass(this.options.activeClass)},a.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){var c=$(b(a));return $("html,body").scrollTop(c.offset().top)}},a.prototype.activeTab=function(){return this.tabs.filter("."+this.options.activeClass)},a.prototype.tabFromHash=function(){var a=location.hash.replace("!","");return this.tabs.filter("["+this.filter+"='"+a+"']")},a.prototype.isActive=function(a){return b(a)===b(this.activeTab())},a.prototype.isAccordion=function(){return!$(this.options.tabNav).is(":visible")},b=function(a){return a.data("target")||a.attr("href")},a}()}(),window.ClassToggler=function(){function a(a){this.options=Utils.setOptions(a,b),this.options.$target?this.addEventListeners():console.trace("ClassToggle",this.options)}var b;return b={containerClass:null,$target:null,activeClass:"active",inactiveClass:null,toggleOn:"click"},a.prototype.addEventListeners=function(){return this.options.$target.on(this.options.toggleOn,function(a){return function(b){var c=a.options.containerClass?$(b.target).closest(a.options.containerClass):$(b.delegateTarget);return a.isActive(c)?a.hide(c,b):a.show(c,b)}}(this))},a.prototype.isActive=function(a){return a.hasClass(this.options.activeClass)},a.prototype.show=function(a,b){var c;return"function"==typeof(c=this.options).onShow&&c.onShow(a,b),a.addClass(this.options.activeClass)},a.prototype.hide=function(a,b){var c;return"function"==typeof(c=this.options).onHide&&c.onHide(a,b),a.removeClass(this.options.activeClass)},a}(),window.RadioToggle=function(){var a="RadioToggle is now deprecated";window.Raven&&window.Raven.captureMessage(a),console.warn(a)};
var slice=[].slice,hasProp={}.hasOwnProperty;null==this.Utils&&(this.Utils={modules:[]});var addClass=function(a,b){return removeClass(a,b),a.className+=" "+b+" "},removeClass=function(a,b){var c=new RegExp("(\\s|^)"+b+"(\\s|$)","gi");return a.className=a.className.replace(c,"")},hasClass=function(a,b){return new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},merge=function(){var a,b,c,d,e=arguments[0],f=2<=arguments.length?slice.call(arguments,1):[];for(b=0,c=f.length;b<c;b++){a=f[b];for(d in a)hasProp.call(a,d)&&(e[d]=a[d])}return e},setOptions=function(a,b){return merge({},b,a)},deleteUndefined=function(a){var b,c,d=[];for(b in a)c=a[b],null===c||void 0===c?d.push(delete a[b]):d.push(void 0);return d},transformKey=function(){var a,b,c,d=document.createElement("div"),e=["transform","webkitTransform","OTransform","MozTransform","msTransform"];for(a=0,c=e.length;a<c;a++)if(b=e[a],void 0!==d.style[b])return b}(),requestAnimationFrame=function(a){var b,c,d,e=["ms","moz","webkit","o"];for(b=0,c=e.length;b<c&&(d=e[b],!a.requestAnimationFrame);b++)a.requestAnimationFrame=a[d+"RequestAnimationFrame"];return a.requestAnimationFrame||(a.requestAnimationFrame=function(a){return setTimeout(a,1e3/60)})}(window);this.Utils={addClass:addClass,removeClass:removeClass,hasClass:hasClass,merge:merge,setOptions:setOptions,deleteUndefined:deleteUndefined,transformKey:transformKey,requestAnimationFrame:requestAnimationFrame},window.Backdrop=function(){function a(){d=document.querySelector(".us-backdrop"),null==d&&(d=b())}var b,c=0,d=null;return a.prototype.element=d,b=function(){return d=document.createElement("div"),Utils.addClass(d,"us-backdrop"),document.body.appendChild(d)},a.prototype.retain=function(){var a;if(c++,1===c)return Utils.addClass(d,"us-backdrop--visible"),a=function(){if(c>=1)return Utils.addClass(d,"us-backdrop--active")},Utils.requestAnimationFrame.call(window,a)},a.prototype.release=function(){var a;return 1===c&&(Utils.removeClass(d,"us-backdrop--active"),a=function(){return setTimeout(function(){if(0===c)return Utils.removeClass(d,"us-backdrop--visible")},300)},Utils.requestAnimationFrame.call(window,a)),c=Math.max(0,c-1)},a}(),window.Overlay=function(a){function b(a){if(this.overlay=(this.options=f(a,h)).overlay,null==this.overlay||"undefined"==typeof Backdrop||null===Backdrop)throw new Error("There's no overlay or you haven't included Backdrop");this.backdrop=new Backdrop,this.addEventListeners()}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions,g=a.requestAnimationFrame,h={bodyActiveClass:"us-overlay--open",activeClass:"us-overlay-parent--active",visibleClass:"us-overlay-parent--visible",overlay:$(".us-overlay-parent"),openButton:".js-open-overlay",closeButton:".js-close-overlay",historyStatus:"#seedeal",history:!1,preventDefault:!0,animationSpeed:300};return b.prototype.addEventListeners=function(){if($(this.options.openButton).on("click.open-overlay",function(a){return function(b){return a.options.preventDefault&&b.preventDefault(),a.show(b)}}(this)),this.overlay.on("click.close-overlay",function(a){return function(b){for(var c=[],d=a.overlay.find(a.options.closeButton).toArray(),e=[a.overlay[0]].concat(d),f=e.length-1;f>=0;f--){var g=e[f];if(b.target===g){a.options.preventDefault&&b.preventDefault(),a.hide(b);break}c.push(void 0)}return c}}(this)),this.hasHistory())return window.onpopstate=function(a){return function(b){if(a.isOpen())return a.hide(b)}}(this)},b.prototype.show=function(a){var b,d=this;if($(document.body).addClass(this.options.bodyActiveClass),this.backdrop.retain(),c(this.overlay[0],this.options.visibleClass),b=function(){return c(d.overlay[0],d.options.activeClass),setTimeout(function(){var b;return"function"==typeof(b=d.options).onOpen?b.onOpen(a):void 0},d.options.animationSpeed)},g.call(window,b),this.hasHistory())return history.pushState("open",window.document.title,this.options.historyStatus)},b.prototype.hide=function(a){var b,c=this;if($(document.body).removeClass(this.options.bodyActiveClass),this.backdrop.release(),b=function(){return e(c.overlay[0],c.options.activeClass),setTimeout(function(){var b;return e(c.overlay[0],c.options.visibleClass),"function"==typeof(b=c.options).onClose?b.onClose(a):void 0},c.options.animationSpeed)},g.call(window,b),this.hasHistory()&&"open"===history.state)return history.back()},b.prototype.isOpen=function(){return d(this.overlay[0],this.options.activeClass)},b.prototype.hasHistory=function(){return this.options.history&&window.history&&window.history.pushState},b}(this.Utils);var setOptions=this.Utils.setOptions;window.Tabs=function(a){var b;return b=function(){function a(a){var b=this.options=setOptions(a,this.defaults),c=b.tabContainer,d=b.tabLinks;this.tabs=$(c).find(d),this.filter=this.tabs.data("target")?"data-target":"href",this.init(),this.tabs.on("click.ustyle.tab",function(a){return function(b){var c=$(b.currentTarget);return a.isAccordion()&&a.options.collapsible&&a.isActive(c)?(a.collapse(c),a.hashClear()):(a.navigateTo(c),a.scrollToTab(c),a.hashChange(c)),b.preventDefault()}}(this))}var b;return a.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},a.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b.length?this.navigateTo(b):a.length?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.first())},a.prototype.hashChange=function(a){if(this.options.changeUrls)return location.replace("#!"+b(a).replace(/#/,""))},a.prototype.hashClear=function(){if(this.options.changeUrls){var a=window.location.pathname+window.location.search;return"function"==typeof history.replaceState?history.replaceState("",document.title,a):void 0}},a.prototype.navigateTo=function(a){var c=b(a),d=$(c);return this.tabs.removeClass(this.options.activeClass).end(),this.tabs.filter("["+this.filter+"='"+c+"']").addClass(this.options.activeClass),d.siblings("."+this.options.activeClass).removeClass(this.options.activeClass).end().addClass(this.options.activeClass),d.trigger("ustyle.tab.active")},a.prototype.collapse=function(a){var c=$(b(a));return this.tabs.removeClass(this.options.activeClass).end(),c.removeClass(this.options.activeClass)},a.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){var c=$(b(a));return $("html,body").scrollTop(c.offset().top)}},a.prototype.activeTab=function(){return this.tabs.filter("."+this.options.activeClass)},a.prototype.tabFromHash=function(){var a=location.hash.replace("!","");return this.tabs.filter("["+this.filter+"='"+a+"']")},a.prototype.isActive=function(a){return b(a)===b(this.activeTab())},a.prototype.isAccordion=function(){return!$(this.options.tabNav).is(":visible")},b=function(a){return a.data("target")||a.attr("href")},a}()}(),window.ClassToggler=function(){function a(a){this.options=Utils.setOptions(a,b),this.options.$target?this.addEventListeners():console.trace("ClassToggle",this.options)}var b;return b={containerClass:null,$target:null,activeClass:"active",inactiveClass:null,toggleOn:"click"},a.prototype.addEventListeners=function(){return this.options.$target.on(this.options.toggleOn,function(a){return function(b){var c=a.options.containerClass?$(b.target).closest(a.options.containerClass):$(b.delegateTarget);return a.isActive(c)?a.hide(c,b):a.show(c,b)}}(this))},a.prototype.isActive=function(a){return a.hasClass(this.options.activeClass)},a.prototype.show=function(a,b){var c;return"function"==typeof(c=this.options).onShow&&c.onShow(a,b),a.addClass(this.options.activeClass)},a.prototype.hide=function(a,b){var c;return"function"==typeof(c=this.options).onHide&&c.onHide(a,b),a.removeClass(this.options.activeClass)},a}(),window.RadioToggle=function(){var a="RadioToggle is now deprecated";window.Raven&&window.Raven.captureMessage(a),console.warn(a)};
{
"name": "ustyle",
"version": "1.12.6",
"version": "1.14.1",
"description": "A living styleguide and pattern library by uSwitch.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc