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.16.1 to 1.16.2

139

dist/ustyle.js

@@ -97,2 +97,8 @@ var slice = [].slice;

var forEach = function (array, callback, scope) {
for (var i = array.length - 1; i >= 0; i--) {
callback.call(scope, i, array[i]);
}
};
this.Utils = {

@@ -106,3 +112,4 @@ addClass: addClass,

transformKey: transformKey,
requestAnimationFrame: requestAnimationFrame
requestAnimationFrame: requestAnimationFrame,
forEach: forEach
};

@@ -178,3 +185,3 @@

visibleClass: "us-overlay-parent--visible",
overlay: $(".us-overlay-parent"),
overlay: document.querySelector('.us-overlay-parent'),
openButton: ".js-open-overlay",

@@ -190,2 +197,11 @@ closeButton: ".js-close-overlay",

this.overlay = (this.options = setOptions(options, defaults)).overlay;
if (this.overlay instanceof jQuery) {
this.overlay = document.querySelector(this.overlay.selector);
}
if (this.options.openButton instanceof jQuery) {
this.options.openButton = document.querySelector(this.options.openButton.selector);
}
if ((this.overlay != null) && (typeof Backdrop !== "undefined" && Backdrop !== null)) {

@@ -199,5 +215,9 @@ this.backdrop = new Backdrop();

Overlay.prototype.addEventListeners = function() {
$(this.options.openButton).on("click.open-overlay", (function(_this) {
return function(e) {
Overlay.prototype.addEventListeners = function () {
var openOverlayEvent = new CustomEvent('click.open-overlay');
var closeOverlayEvent = new CustomEvent('click.close-overlay');
var openButton = typeof this.options.openButton === 'string' ? document.querySelector(this.options.openButton) : this.options.openButton;
var onOpenButtonClick = (function (_this) {
return function (e) {
if (_this.options.preventDefault) {

@@ -207,11 +227,17 @@ e.preventDefault();

openButton.dispatchEvent(openOverlayEvent);
return _this.show(e);
};
})(this));
}
})(this);
this.overlay.on("click.close-overlay", (function(_this) {
return function(e) {
if (openButton) {
openButton.addEventListener('click', onOpenButtonClick);
}
var onCloseOverlay = (function (_this) {
return function (e) {
var results = [];
var closeTargets = _this.overlay.find(_this.options.closeButton).toArray();
var targets = [_this.overlay[0]].concat(closeTargets);
var closeTargets = _this.overlay.querySelectorAll(_this.options.closeButton);
var targets = [_this.overlay].concat(Array.prototype.slice.call(closeTargets));

@@ -232,6 +258,10 @@ for (var i = targets.length - 1; i >= 0; i--) {

_this.overlay.dispatchEvent(closeOverlayEvent);
return results;
};
})(this));
})(this);
this.overlay.addEventListener('click', onCloseOverlay);
if (this.hasHistory()) {

@@ -248,10 +278,12 @@ return window.onpopstate = (function(_this) {

Overlay.prototype.show = function(e) {
Overlay.prototype.show = function (e) {
var onFrame;
var _this = this;
$(document.body).addClass(this.options.bodyActiveClass);
addClass(document.body, this.options.bodyActiveClass);
this.backdrop.retain();
addClass(this.overlay[0], this.options.visibleClass);
addClass(this.overlay, this.options.visibleClass);
onFrame = function() {
addClass(_this.overlay[0], _this.options.activeClass);
addClass(_this.overlay, _this.options.activeClass);
return setTimeout(function() {

@@ -272,9 +304,11 @@ var base;

var _this = this;
$(document.body).removeClass(this.options.bodyActiveClass);
removeClass(document.body, this.options.bodyActiveClass);
this.backdrop.release();
onFrame = function() {
removeClass(_this.overlay[0], _this.options.activeClass);
removeClass(_this.overlay, _this.options.activeClass);
return setTimeout(function() {
var base;
removeClass(_this.overlay[0], _this.options.visibleClass);
removeClass(_this.overlay, _this.options.visibleClass);
return typeof (base = _this.options).onClose === "function" ? base.onClose(e) : void 0;

@@ -289,3 +323,3 @@ }, _this.options.animationSpeed);

Overlay.prototype.isOpen = function() {
return hasClass(this.overlay[0], this.options.activeClass);
return hasClass(this.overlay, this.options.activeClass);
};

@@ -307,2 +341,3 @@

var setOptions = Utils.setOptions;
var forEach = Utils.forEach;

@@ -465,17 +500,14 @@ Tabs.prototype.defaults = {

var forEach = function (array, callback, scope) {
for (var i = array.length - 1; i >= 0; i--) {
callback.call(scope, i, array[i]);
}
};
return Tabs;
})(this.Utils);
window.ClassToggler = (function() {
var defaults;
window.ClassToggler = (function(Utils) {
var addClass = Utils.addClass;
var hasClass = Utils.hasClass;
var removeClass = Utils.removeClass;
var forEach = Utils.forEach;
defaults = {
var defaults = {
containerClass: null,
$target: null,
target: null,
activeClass: "active",

@@ -486,5 +518,15 @@ inactiveClass: null,

var findAncestor = function (el, cls) {
while ((el = el.parentElement) && ! hasClass(el, cls));
return el;
}
function ClassToggler(options) {
this.options = Utils.setOptions(options, defaults);
if (this.options.$target) {
if (!this.options.target && this.options.$target && this.options.$target instanceof jQuery) {
this.options.target = document.querySelectorAll(this.options.$target.selector);
}
if (this.options.target) {
this.addEventListeners();

@@ -497,34 +539,39 @@ } else {

ClassToggler.prototype.addEventListeners = function() {
return this.options.$target.on(this.options.toggleOn, (function(_this) {
var toggleEvent = this.options.toggleOn;
var onToggle = (function (_this) {
return function(e) {
var $togglableElement = _this.options.containerClass ? $(e.target).closest(_this.options.containerClass) : $(e.delegateTarget);
if (_this.isActive($togglableElement)) {
return _this.hide($togglableElement, e);
var togglableElement = _this.options.containerClass ? findAncestor(e.target, _this.options.containerClass) : (e.delegateTarget);
if (_this.isActive(togglableElement)) {
return _this.hide(togglableElement, e);
} else {
return _this.show($togglableElement, e);
return _this.show(togglableElement, e);
}
};
})(this));
})(this);
forEach(this.options.target, function (i, t) {
t.addEventListener(toggleEvent, onToggle);
});
};
ClassToggler.prototype.isActive = function($togglableElement) {
return $togglableElement.hasClass(this.options.activeClass);
ClassToggler.prototype.isActive = function(togglableElement) {
return hasClass(togglableElement, this.options.activeClass);
};
ClassToggler.prototype.show = function($togglableElement, e) {
ClassToggler.prototype.show = function(togglableElement, e) {
var base;
if (typeof (base = this.options).onShow === "function") {
base.onShow($togglableElement, e);
base.onShow(togglableElement, e);
}
return $togglableElement.addClass(this.options.activeClass);
return togglableElement.addClass(this.options.activeClass);
};
ClassToggler.prototype.hide = function($togglableElement, e) {
ClassToggler.prototype.hide = function(togglableElement, e) {
var base;
if (typeof (base = this.options).onHide === "function") {
base.onHide($togglableElement, e);
base.onHide(togglableElement, e);
}
return $togglableElement.removeClass(this.options.activeClass);
return removeClass(togglableElement, this.options.activeClass);
};

@@ -534,3 +581,3 @@

})();
})(this.Utils);

@@ -537,0 +584,0 @@ window.RadioToggle = function() {

@@ -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},window.Backdrop=function(){function a(){null==(d=document.querySelector(".us-backdrop"))&&(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(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),window.Tabs=function(a){function b(a){var b=this.options=f(a,this.defaults),c=b.tabContainer,d=b.tabLinks;if(this.activeTabEvent=new CustomEvent("ustyle.tab.active"),this.tabs=document.querySelectorAll(c+" "+d),this.tabs.length){this.filter=this.tabs.item(0).getAttribute("data-target")?"data-target":"href",this.init();var e=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);h(this.tabs,function(a,b){b.addEventListener("click",e)})}}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions;b.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},b.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b?this.navigateTo(b):a?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.item(0))},b.prototype.hashChange=function(a){if(this.options.changeUrls)return window.location.replace("#!"+g(a).replace(/#/,""))},b.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}},b.prototype.navigateTo=function(a){var b=g(a),d=document.querySelector(b),f=this.options.activeClass,i=this.filter;return h(this.tabs,function(a,b){e(b,f)}),h(this.tabs,function(a,d){if(d.getAttribute(i)===b)return c(d,f)}),h(d.parentNode.children,function(a,b){b!==d&&e(b,f)}),c(d,f),d.dispatchEvent(this.activeTabEvent)},b.prototype.collapse=function(a){var b=document.querySelector(g(a)),c=this.options.activeClass;return h(this.tabs,function(a,b){e(b,c)}),e(b,c)},b.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){return document.querySelector(g(a)).scrollIntoView()}},b.prototype.activeTab=function(){var a=this.options.activeClass,b=null;return h(this.tabs,function(c,e){if(d(e,a))return b=e}),b},b.prototype.tabFromHash=function(){var a=window.location.hash.replace("!",""),b=this.filter,c=null;return h(this.tabs,function(d,e){if(e.getAttribute(b)===a)return c=e}),c},b.prototype.isActive=function(a){return g(a)===g(this.activeTab())},b.prototype.isAccordion=function(){var a=document.querySelector(this.options.tabNav);return!(a.offsetWidth>0||a.offsetHeight>0)};var g=function(a){return a.getAttribute("data-target")||a.getAttribute("href")},h=function(a,b,c){for(var d=a.length-1;d>=0;d--)b.call(c,d,a[d])};return b}(this.Utils),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),forEach=function(a,b,c){for(var d=a.length-1;d>=0;d--)b.call(c,d,a[d])};this.Utils={addClass:addClass,removeClass:removeClass,hasClass:hasClass,merge:merge,setOptions:setOptions,deleteUndefined:deleteUndefined,transformKey:transformKey,requestAnimationFrame:requestAnimationFrame,forEach:forEach},window.Backdrop=function(){function a(){null==(d=document.querySelector(".us-backdrop"))&&(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(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,this.overlay instanceof jQuery&&(this.overlay=document.querySelector(this.overlay.selector)),this.options.openButton instanceof jQuery&&(this.options.openButton=document.querySelector(this.options.openButton.selector)),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:document.querySelector(".us-overlay-parent"),openButton:".js-open-overlay",closeButton:".js-close-overlay",historyStatus:"#seedeal",history:!1,preventDefault:!0,animationSpeed:300};return b.prototype.addEventListeners=function(){var a=new CustomEvent("click.open-overlay"),b=new CustomEvent("click.close-overlay"),c="string"==typeof this.options.openButton?document.querySelector(this.options.openButton):this.options.openButton,d=function(b){return function(d){return b.options.preventDefault&&d.preventDefault(),c.dispatchEvent(a),b.show(d)}}(this);c&&c.addEventListener("click",d);var e=function(a){return function(c){for(var d=[],e=a.overlay.querySelectorAll(a.options.closeButton),f=[a.overlay].concat(Array.prototype.slice.call(e)),g=f.length-1;g>=0;g--){var h=f[g];if(c.target===h){a.options.preventDefault&&c.preventDefault(),a.hide(c);break}d.push(void 0)}return a.overlay.dispatchEvent(b),d}}(this);if(this.overlay.addEventListener("click",e),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(c(document.body,this.options.bodyActiveClass),this.backdrop.retain(),c(this.overlay,this.options.visibleClass),b=function(){return c(d.overlay,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(e(document.body,this.options.bodyActiveClass),this.backdrop.release(),b=function(){return e(c.overlay,c.options.activeClass),setTimeout(function(){var b;return e(c.overlay,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,this.options.activeClass)},b.prototype.hasHistory=function(){return this.options.history&&window.history&&window.history.pushState},b}(this.Utils),window.Tabs=function(a){function b(a){var b=this.options=f(a,this.defaults),c=b.tabContainer,d=b.tabLinks;if(this.activeTabEvent=new CustomEvent("ustyle.tab.active"),this.tabs=document.querySelectorAll(c+" "+d),this.tabs.length){this.filter=this.tabs.item(0).getAttribute("data-target")?"data-target":"href",this.init();var e=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);g(this.tabs,function(a,b){b.addEventListener("click",e)})}}var c=a.addClass,d=a.hasClass,e=a.removeClass,f=a.setOptions,g=a.forEach;b.prototype.defaults={tabContainer:".us-tabs",tabLinks:".us-tabs-nav-mainlink",tabNav:".us-tabs-nav",changeUrls:!0,activeClass:"active",collapsible:!1,autoScroll:!0},b.prototype.init=function(){var a=this.activeTab(),b=this.tabFromHash();return b?this.navigateTo(b):a?this.navigateTo(a):this.options.collapsible&&this.isAccordion()?void 0:this.navigateTo(this.tabs.item(0))},b.prototype.hashChange=function(a){if(this.options.changeUrls)return window.location.replace("#!"+h(a).replace(/#/,""))},b.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}},b.prototype.navigateTo=function(a){var b=h(a),d=document.querySelector(b),f=this.options.activeClass,i=this.filter;return g(this.tabs,function(a,b){e(b,f)}),g(this.tabs,function(a,d){if(d.getAttribute(i)===b)return c(d,f)}),g(d.parentNode.children,function(a,b){b!==d&&e(b,f)}),c(d,f),d.dispatchEvent(this.activeTabEvent)},b.prototype.collapse=function(a){var b=document.querySelector(h(a)),c=this.options.activeClass;return g(this.tabs,function(a,b){e(b,c)}),e(b,c)},b.prototype.scrollToTab=function(a){if(this.isAccordion()&&this.options.autoScroll){return document.querySelector(h(a)).scrollIntoView()}},b.prototype.activeTab=function(){var a=this.options.activeClass,b=null;return g(this.tabs,function(c,e){if(d(e,a))return b=e}),b},b.prototype.tabFromHash=function(){var a=window.location.hash.replace("!",""),b=this.filter,c=null;return g(this.tabs,function(d,e){if(e.getAttribute(b)===a)return c=e}),c},b.prototype.isActive=function(a){return h(a)===h(this.activeTab())},b.prototype.isAccordion=function(){var a=document.querySelector(this.options.tabNav);return!(a.offsetWidth>0||a.offsetHeight>0)};var h=function(a){return a.getAttribute("data-target")||a.getAttribute("href")};return b}(this.Utils),window.ClassToggler=function(a){function b(b){this.options=a.setOptions(b,f),!this.options.target&&this.options.$target&&this.options.$target instanceof jQuery&&(this.options.target=document.querySelectorAll(this.options.$target.selector)),this.options.target?this.addEventListeners():console.trace("ClassToggle",this.options)}var c=(a.addClass,a.hasClass),d=a.removeClass,e=a.forEach,f={containerClass:null,target:null,activeClass:"active",inactiveClass:null,toggleOn:"click"},g=function(a,b){for(;(a=a.parentElement)&&!c(a,b););return a};return b.prototype.addEventListeners=function(){var a=this.options.toggleOn,b=function(a){return function(b){var c=a.options.containerClass?g(b.target,a.options.containerClass):b.delegateTarget;return a.isActive(c)?a.hide(c,b):a.show(c,b)}}(this);e(this.options.target,function(c,d){d.addEventListener(a,b)})},b.prototype.isActive=function(a){return c(a,this.options.activeClass)},b.prototype.show=function(a,b){var c;return"function"==typeof(c=this.options).onShow&&c.onShow(a,b),a.addClass(this.options.activeClass)},b.prototype.hide=function(a,b){var c;return"function"==typeof(c=this.options).onHide&&c.onHide(a,b),d(a,this.options.activeClass)},b}(this.Utils),window.RadioToggle=function(){var a="RadioToggle is now deprecated";window.Raven&&window.Raven.captureMessage(a),console.warn(a)};
{
"name": "ustyle",
"version": "1.16.1",
"version": "1.16.2",
"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

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