New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shepherd.js

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shepherd.js - npm Package Compare versions

Comparing version 2.0.0-beta.22 to 2.0.0-beta.23

babel.config.js

4

dist/js/shepherd.min.js
/*!
* /*! shepherd.js 2.0.0-beta.22 * /
* /*! shepherd.js 2.0.0-beta.23 * /
*
*/
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("popper.js")):"function"==typeof define&&define.amd?define(["popper.js"],e):"object"==typeof exports?exports.Shepherd=e(require("popper.js")):t.Shepherd=e(t.Popper)}(this,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e){t.exports=function(t){return void 0===t}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Evented=void 0;var r=s(n(14)),o=s(n(0)),i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function s(t){return t&&t.__esModule?t:{default:t}}e.Evented=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}return i(t,[{key:"on",value:function(t,e,n){var r=!(arguments.length<=3||void 0===arguments[3])&&arguments[3];(0,o.default)(this.bindings)&&(this.bindings={}),(0,o.default)(this.bindings[t])&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:r})}},{key:"once",value:function(t,e,n){this.on(t,e,n,!0)}},{key:"off",value:function(t,e){var n=this;if((0,o.default)(this.bindings)||(0,o.default)(this.bindings[t]))return!1;(0,o.default)(e)?delete this.bindings[t]:this.bindings[t].forEach(function(r,o){r.handler===e&&n.bindings[t].splice(o,1)})}},{key:"trigger",value:function(t){var e=this;if(!(0,o.default)(this.bindings)&&this.bindings[t]){var n=(0,r.default)(arguments);this.bindings[t].forEach(function(r,o){var i=r.ctx,s=r.handler,u=r.once,c=i||e;s.apply(c,n),u&&e.bindings[t].splice(o,1)})}}}]),t}()},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var r=n(2),o=n(23),i="[object AsyncFunction]",s="[object Function]",u="[object GeneratorFunction]",c="[object Proxy]";t.exports=function(t){if(!o(t))return!1;var e=r(t);return e==s||e==u||e==i||e==c}},function(t,e,n){var r=n(2),o=n(9),i=n(1),s="[object String]";t.exports=function(t){return"string"==typeof t||!o(t)&&i(t)&&r(t)==s}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Step=void 0;var r=h(n(8)),o=h(n(18)),i=h(n(10)),s=h(n(33)),u=h(n(0)),c=h(n(6)),a=h(n(5)),l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),p=n(3);n(34);var f=n(11),d=n(12);function h(t){return t&&t.__esModule?t:{default:t}}function v(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var b=function(){var t=0;return function(){return++t}}();e.Step=function(t){function e(t,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var r=v(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t,n));return r.tour=t,f.bindMethods.call(r,["_show","cancel","complete","destroy","hide","isOpen","render","scrollTo","show"]),r.setOptions(n),r.bindAdvance=f.bindAdvance.bind(r),r.bindButtonEvents=f.bindButtonEvents.bind(r),r.bindCancelLink=f.bindCancelLink.bind(r),r.setupPopper=d.setupPopper.bind(r),v(r,r)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,p.Evented),l(e,[{key:"_addButtons",value:function(t){var e=this;if(this.options.buttons){var n=document.createElement("footer"),r=(0,d.createFromHTML)('<ul class="shepherd-buttons"></ul>');this.options.buttons.map(function(t){var n=(0,d.createFromHTML)('<li><a class="shepherd-button '+(t.classes||"")+'">'+t.text+"</a>");r.appendChild(n),e.bindButtonEvents(t,n.querySelector("a"))}),n.appendChild(r),t.appendChild(n)}}},{key:"_addCancelLink",value:function(t,e){if(this.options.showCancelLink){var n=(0,d.createFromHTML)('<a href class="shepherd-cancel-link"></a>');e.appendChild(n),t.classList.add("shepherd-has-cancel-link"),this.bindCancelLink(n)}}},{key:"_addContent",value:function(t){var e=(0,d.createFromHTML)('<div class="shepherd-text"></div>'),n=this.options.text;(0,a.default)(n)&&(n=n.call(this,e)),n instanceof HTMLElement?e.appendChild(n):((0,c.default)(n)&&(n=[n]),n.map(function(t){e.innerHTML+="<p>"+t+"</p>"})),t.appendChild(e)}},{key:"_attach",value:function(t){var e=this.options.renderLocation;if(e){if(e instanceof HTMLElement)return e.appendChild(t);if((0,c.default)(e))return document.querySelector(e).appendChild(t)}return document.body.appendChild(t)}},{key:"_createElement",value:function(){var t=document.createElement("div"),e=this.options.classes||"",n=(0,d.createFromHTML)("<div class='"+e+"' data-id='"+this.id+"' id=\""+this.options.idAttribute+'"}>'),r=document.createElement("header");if(this.options.title){var o=document.createElement("h3");o.classList.add("shepherd-title"),o.innerHTML=""+this.options.title,r.prepend(o),n.classList.add("shepherd-has-title")}return t.classList.add("shepherd-content"),n.appendChild(t),t.appendChild(r),this.options.attachTo&&n.appendChild((0,d.createFromHTML)('<div class="popper__arrow" x-arrow></div>')),(0,u.default)(this.options.text)||this._addContent(t),this._addButtons(t),this._addCancelLink(n,r),n}},{key:"getTour",value:function(){return this.tour}},{key:"getAttachTo",value:function(){var t=(0,d.parsePosition)(this.options.attachTo)||{},e=Object.assign({},t);if((0,c.default)(t.element)){try{e.element=document.querySelector(t.element)}catch(t){}e.element||console.error("The element for this Shepherd step was not found "+t.element)}return e}},{key:"cancel",value:function(){this.tour.cancel(),this.trigger("cancel")}},{key:"complete",value:function(){this.tour.complete(),this.trigger("complete")}},{key:"destroy",value:function(){(0,s.default)(this.el)&&this.el.parentNode&&(this.el.parentNode.removeChild(this.el),delete this.el),this.popper&&this.popper.destroy(),this.popper=null,this.trigger("destroy")}},{key:"hide",value:function(){this.trigger("before-hide"),this.el&&(this.el.hidden=!0,this.el.style.display="none"),document.body.removeAttribute("data-shepherd-step"),this.target&&this.target.classList.remove("shepherd-enabled","shepherd-target"),this.popper&&this.popper.destroy(),this.popper=null,this.trigger("hide")}},{key:"isOpen",value:function(){return this.el&&!this.el.hidden}},{key:"render",value:function(){(0,u.default)(this.el)||this.destroy(),this.el=this._createElement(),this.options.advanceOn&&this.bindAdvance(),this._attach(this.el),this.setupPopper()}},{key:"scrollTo",value:function(){var t=this.getAttachTo().element;(0,a.default)(this.options.scrollToHandler)?this.options.scrollToHandler(t):(0,s.default)(t)&&t.scrollIntoView()}},{key:"setOptions",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.options=e;var n=this.options.when;this.destroy(),this.id=this.options.id||"step-"+b(),(0,i.default)(n,function(e,n){t.on(n,e,t)}),this._setUpButtons()}},{key:"show",value:function(){var t=this;if((0,a.default)(this.options.beforeShowPromise)){var e=this.options.beforeShowPromise();if(!(0,u.default)(e))return e.then(function(){return t._show()})}this._show()}},{key:"_setUpButtons",value:function(){var t=this.options.buttons;t&&((0,u.default)(t)||(0,o.default)(t)?this.options.buttons=[{text:"Next",action:this.tour.next,classes:"btn"}]:(0,r.default)(t)&&(this.options.buttons=[this.options.buttons]))}},{key:"_show",value:function(){var t=this;this.trigger("before-show"),this.el||this.render(),this.el.hidden=!1,this.el.style.display="block",document.body.setAttribute("data-shepherd-step",this.id),this.setupPopper(),this.options.scrollTo&&setTimeout(function(){t.scrollTo()}),this.trigger("show")}}]),e}()},function(t,e,n){var r=n(2),o=n(17),i=n(1),s="[object Object]",u=Function.prototype,c=Object.prototype,a=u.toString,l=c.hasOwnProperty,p=a.call(Object);t.exports=function(t){if(!i(t)||r(t)!=s)return!1;var e=o(t);if(null===e)return!0;var n=l.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&a.call(n)==p}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var r=n(28),o=n(32);t.exports=function(t,e){return t&&r(t,o(e))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=u(n(6)),o=u(n(10)),i=u(n(0));e.bindAdvance=function(){var t=(0,s.parseShorthand)(this.options.advanceOn,["selector","event"]),e=t.event,n=t.selector,r=function(t){var e=this;return function(n){if(e.isOpen()){var r=e.el&&n.target===e.el,o=!(0,i.default)(t)&&n.target.matches(t);(o||r)&&e.tour.next()}}}.call(this,n);if((0,i.default)(n))document.body.addEventListener(e,r);else{var o=document.querySelector(n);o.addEventListener(e,r)}this.on("destroy",function(){return document.body.removeEventListener(e,r)})},e.bindButtonEvents=function(t,e){var n=this;t.events=t.events||{},(0,i.default)(t.action)||(t.events.click=t.action);(0,o.default)(t.events,function(t,o){if((0,r.default)(t)){var i=t;t=function(){return n.tour.show(i)}}e.dataset.buttonEvent=!0,e.addEventListener(o,t),n.on("destroy",function(){e.removeAttribute("data-button-event"),e.removeEventListener(o,t)})})},e.bindCancelLink=function(t){var e=this;t.addEventListener("click",function(t){t.preventDefault(),e.cancel()})},e.bindMethods=function(t){var e=this;t.map(function(t){e[t]=e[t].bind(e)})};var s=n(12);function u(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=u(n(35)),o=u(n(0)),i=u(n(1));e.createFromHTML=function(t){var e=document.createElement("div");return e.innerHTML=t,e.children[0]},e.parsePosition=function(t){if((0,i.default)(t))return t.hasOwnProperty("element")&&t.hasOwnProperty("on")?t:null;var e=/^(.+) (top|left|right|bottom|center)$/.exec(t);if(!e)return null;return{element:e[1],on:e[2]}},e.parseShorthand=function(t,e){if(null===t||(0,o.default)(t))return t;if((0,i.default)(t))return t;var n=t.split(" ");return(0,r.default)(e,n)},e.setupPopper=function(){if((0,o.default)(s.default))throw new Error("Using the attachment feature of Shepherd requires the Popper.js library");var t=this.getAttachTo();t.modifiers=t.modifiers||{};var e=t.on||"right";t.positionFixed=!1,(0,o.default)(t.element)&&(e="top",function(t){t.element=document.body,t.modifiers=Object.assign({computeStyle:{enabled:!0,fn:function(t){return t.styles=Object.assign({},t.styles,{left:"50%",top:"50%",transform:"translate(-50%, -50%)"}),t}}},t.modifiers),t.positionFixed=!0}(t));this.popper&&this.popper.destroy();this.el.classList.add("shepherd-element");var n=function(t,e){return Object.assign({},{placement:t,arrowElement:this.el.querySelector(".popper__arrow"),modifiers:e.modifiers,positionFixed:e.positionFixed},this.options.popperOptions)}.call(this,e,t);this.popper=new s.default(t.element,this.el,n),this.target=t.element,this.target.classList.add("shepherd-enabled","shepherd-target")};var s=u(n(42));function u(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(3),o=n(7),i=n(43);Object.assign(i.Shepherd,{Tour:i.Tour,Step:o.Step,Evented:r.Evented}),e.default=i.Shepherd,t.exports=e.default},function(t,e,n){var r=n(15),o=n(16);t.exports=function(t,e,n){var i=null==t?0:t.length;return i?(e=n||void 0===e?1:o(e),r(t,e<0?0:e,i)):[]}},function(t,e){t.exports=function(t,e,n){var r=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(n=n>o?o:n)<0&&(n+=o),o=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(o);++r<o;)i[r]=t[r+e];return i}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(4)(Object.getPrototypeOf,Object);t.exports=r},function(t,e,n){var r=n(19),o=n(20),i=n(21),s=n(9),u=n(22),c=n(25),a=n(26),l=n(27),p="[object Map]",f="[object Set]",d=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(u(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||c(t)||l(t)||i(t)))return!t.length;var e=o(t);if(e==p||e==f)return!t.size;if(a(t))return!r(t).length;for(var n in t)if(d.call(t,n))return!1;return!0}},function(t,e,n){var r=n(4)(Object.keys,Object);t.exports=r},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(5),o=n(24);t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e){t.exports=function(){return!1}},function(t,e){t.exports=function(){return!1}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var r=n(29),o=n(31);t.exports=function(t,e){return t&&r(t,e,o)}},function(t,e,n){var r=n(30)();t.exports=r},function(t,e){t.exports=function(t){return function(e,n,r){for(var o=-1,i=Object(e),s=r(e),u=s.length;u--;){var c=s[t?u:++o];if(!1===n(i[c],c,i))break}return e}}},function(t,e,n){var r=n(4)(Object.keys,Object);t.exports=r},function(t,e){t.exports=function(t){return t}},function(t,e,n){var r=n(1),o=n(8);t.exports=function(t){return r(t)&&1===t.nodeType&&!o(t)}},function(t,e){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector)},function(t,e,n){var r=n(36),o=n(41);t.exports=function(t,e){return o(t||[],e||[],r)}},function(t,e,n){var r=n(37),o=n(40),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];i.call(t,e)&&o(s,n)&&(void 0!==n||e in t)||r(t,e,n)}},function(t,e,n){var r=n(38);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e,n){var r=n(39),o=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t,e,n){for(var r=-1,o=t.length,i=e.length,s={};++r<o;){var u=r<i?e[r]:void 0;n(s,t[r],u)}return s}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Shepherd=e.Tour=void 0;var r=p(n(5)),o=p(n(44)),i=p(n(6)),s=p(n(0)),u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(3),a=n(7),l=n(11);function p(t){return t&&t.__esModule?t:{default:t}}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var d=new c.Evented;e.Tour=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=f(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));l.bindMethods.call(n,["back","cancel","complete","next"]),n.options=t,n.steps=n.options.steps||[];return["active","cancel","complete","inactive","show","start"].map(function(t){!function(t){n.on(t,function(e){(e=e||{}).tour=n,d.trigger(t,e)})}(t)}),f(n,n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,c.Evented),u(e,[{key:"addStep",value:function(t,e){var n=void 0,r=void 0;return(0,s.default)(e)?r=t:(n=t,r=e),r instanceof a.Step?r.tour=this:r=this.setupStep(r,n),this.steps.push(r),r}},{key:"back",value:function(){var t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}},{key:"cancel",value:function(){this.done("cancel")}},{key:"complete",value:function(){this.done("complete")}},{key:"done",value:function(t){this.currentStep&&this.currentStep.hide(),this.trigger(t),d.activeTour&&d.activeTour.steps.forEach(function(t){t.destroy()}),d.activeTour=null,document.body.classList.remove("shepherd-active"),this.trigger("inactive",{tour:this})}},{key:"getById",value:function(t){return this.steps.find(function(e){return e.id===t})}},{key:"getCurrentStep",value:function(){return this.currentStep}},{key:"next",value:function(){var t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}},{key:"removeStep",value:function(t){var e=this,n=this.getCurrentStep();this.steps.some(function(n,r){if(n.id===t)return n.isOpen()&&n.hide(),n.destroy(),e.steps.splice(r,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}},{key:"setupStep",value:function(t,e){return((0,i.default)(e)||(0,o.default)(e))&&(t.id=e.toString()),t=Object.assign({},this.options.defaults,t),new a.Step(this,t)}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this._setupActiveTour();var n=(0,i.default)(t)?this.getById(t):this.steps[t];n&&((0,r.default)(n.options.showOn)&&!n.options.showOn()?this._skipStep(n,e):(this.trigger("show",{step:n,previous:this.currentStep}),this.currentStep=n,n.show()))}},{key:"start",value:function(){this.trigger("start"),this.currentStep=null,this.next()}},{key:"_setupActiveTour",value:function(){this.currentStep?this.currentStep.hide():(document.body.classList.add("shepherd-active"),this.trigger("active",{tour:this})),d.activeTour=this}},{key:"_skipStep",value:function(t,e){var n=this.steps.indexOf(t),r=e?n+1:n-1;this.show(r,e)}}]),e}();e.Shepherd=d},function(t,e,n){var r=n(2),o=n(1),i="[object Number]";t.exports=function(t){return"number"==typeof t||o(t)&&r(t)==i}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("popper.js")):"function"==typeof define&&define.amd?define(["popper.js"],e):"object"==typeof exports?exports.Shepherd=e(require("popper.js")):t.Shepherd=e(t.Popper)}(this,function(t){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=13)}([function(t,e){t.exports=function(t){return void 0===t}},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Evented=void 0;var o=r(n(0)),i=r(n(14));function r(t){return t&&t.__esModule?t:{default:t}}e.Evented=class{on(t,e,n){const i=!(arguments.length<=3||void 0===arguments[3])&&arguments[3];(0,o.default)(this.bindings)&&(this.bindings={}),(0,o.default)(this.bindings[t])&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:i})}once(t,e,n){this.on(t,e,n,!0)}off(t,e){if((0,o.default)(this.bindings)||(0,o.default)(this.bindings[t]))return!1;(0,o.default)(e)?delete this.bindings[t]:this.bindings[t].forEach((n,o)=>{n.handler===e&&this.bindings[t].splice(o,1)})}trigger(t){if(!(0,o.default)(this.bindings)&&this.bindings[t]){const e=(0,i.default)(arguments);this.bindings[t].forEach((n,o)=>{const i=n.ctx,r=n.handler,s=n.once,c=i||this;r.apply(c,e),s&&this.bindings[t].splice(o,1)})}}}},function(t,e,n){var o=n(2),i=n(8),r=n(1),s="[object String]";t.exports=function(t){return"string"==typeof t||!i(t)&&r(t)&&o(t)==s}},function(t,e){t.exports=function(t,e){return function(n){return t(e(n))}}},function(t,e,n){var o=n(2),i=n(18),r="[object AsyncFunction]",s="[object Function]",c="[object GeneratorFunction]",u="[object Proxy]";t.exports=function(t){if(!i(t))return!1;var e=o(t);return e==s||e==c||e==r||e==u}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Step=void 0;var o=l(n(0)),i=l(n(4)),r=l(n(9)),s=l(n(6)),c=l(n(19)),u=l(n(28)),p=l(n(10)),a=n(3);n(34);var d=n(11),h=n(12);function l(t){return t&&t.__esModule?t:{default:t}}const f=function(){let t=0;return function(){return++t}}();e.Step=class extends a.Evented{constructor(t,e){return super(t,e),this.tour=t,d.bindMethods.call(this,["_show","cancel","complete","destroy","hide","isOpen","render","scrollTo","show"]),this.setOptions(e),this.bindAdvance=d.bindAdvance.bind(this),this.bindButtonEvents=d.bindButtonEvents.bind(this),this.bindCancelLink=d.bindCancelLink.bind(this),this.setupPopper=h.setupPopper.bind(this),this}_addButtons(t){if(this.options.buttons){const e=document.createElement("footer"),n=(0,h.createFromHTML)('<ul class="shepherd-buttons"></ul>');this.options.buttons.map(t=>{const e=(0,h.createFromHTML)(`<li><a class="shepherd-button ${t.classes||""}">${t.text}</a>`);n.appendChild(e),this.bindButtonEvents(t,e.querySelector("a"))}),e.appendChild(n),t.appendChild(e)}}_addCancelLink(t,e){if(this.options.showCancelLink){const n=(0,h.createFromHTML)('<a href class="shepherd-cancel-link"></a>');e.appendChild(n),t.classList.add("shepherd-has-cancel-link"),this.bindCancelLink(n)}}_addContent(t){const e=(0,h.createFromHTML)('<div class="shepherd-text"></div>');let n=this.options.text;(0,s.default)(n)&&(n=n.call(this,e)),n instanceof HTMLElement?e.appendChild(n):((0,i.default)(n)&&(n=[n]),n.map(t=>{e.innerHTML+=`<p>${t}</p>`})),t.appendChild(e)}_attach(t){const e=this.options.renderLocation;if(e){if(e instanceof HTMLElement)return e.appendChild(t);if((0,i.default)(e))return document.querySelector(e).appendChild(t)}return document.body.appendChild(t)}_createElement(){const t=document.createElement("div"),e=this.options.classes||"",n=(0,h.createFromHTML)(`<div class='${e}' data-id='${this.id}' id="${this.options.idAttribute}"}>`),i=document.createElement("header");if(this.options.title){const t=document.createElement("h3");t.classList.add("shepherd-title"),t.innerHTML=`${this.options.title}`,i.prepend(t),n.classList.add("shepherd-has-title")}return t.classList.add("shepherd-content"),n.appendChild(t),t.appendChild(i),this.options.attachTo&&n.appendChild((0,h.createFromHTML)('<div class="popper__arrow" x-arrow></div>')),(0,o.default)(this.options.text)||this._addContent(t),this._addButtons(t),this._addCancelLink(n,i),n}getTour(){return this.tour}getAttachTo(){const t=(0,h.parsePosition)(this.options.attachTo)||{},e=Object.assign({},t);if((0,i.default)(t.element)){try{e.element=document.querySelector(t.element)}catch(t){}e.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return e}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){(0,u.default)(this.el)&&this.el.parentNode&&(this.el.parentNode.removeChild(this.el),delete this.el),this.popper&&this.popper.destroy(),this.popper=null,this.trigger("destroy")}hide(){this.trigger("before-hide"),this.el&&(this.el.hidden=!0,this.el.style.display="none"),document.body.removeAttribute("data-shepherd-step"),this.target&&this.target.classList.remove("shepherd-enabled","shepherd-target"),this.popper&&this.popper.destroy(),this.popper=null,this.trigger("hide")}isOpen(){return this.el&&!this.el.hidden}render(){(0,o.default)(this.el)||this.destroy(),this.el=this._createElement(),this.options.advanceOn&&this.bindAdvance(),this._attach(this.el),this.setupPopper()}scrollTo(){const t=this.getAttachTo().element;(0,s.default)(this.options.scrollToHandler)?this.options.scrollToHandler(t):(0,u.default)(t)&&t.scrollIntoView()}setOptions(t={}){this.options=t;const e=this.options.when;this.destroy(),this.id=this.options.id||`step-${f()}`,(0,p.default)(e,(t,e)=>{this.on(e,t,this)}),this._setUpButtons()}show(){if((0,s.default)(this.options.beforeShowPromise)){const t=this.options.beforeShowPromise();if(!(0,o.default)(t))return t.then(()=>this._show())}this._show()}_setUpButtons(){const t=this.options.buttons;t&&((0,o.default)(t)||(0,c.default)(t)?this.options.buttons=[{text:"Next",action:this.tour.next,classes:"btn"}]:(0,r.default)(t)&&(this.options.buttons=[this.options.buttons]))}_show(){this.trigger("before-show"),this.el||this.render(),this.el.hidden=!1,this.el.style.display="block",document.body.setAttribute("data-shepherd-step",this.id),this.setupPopper(),this.options.scrollTo&&setTimeout(()=>{this.scrollTo()}),this.trigger("show")}}},function(t,e){var n=Array.isArray;t.exports=n},function(t,e,n){var o=n(2),i=n(17),r=n(1),s="[object Object]",c=Function.prototype,u=Object.prototype,p=c.toString,a=u.hasOwnProperty,d=p.call(Object);t.exports=function(t){if(!r(t)||o(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=a.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&p.call(n)==d}},function(t,e,n){var o=n(29),i=n(33);t.exports=function(t,e){return t&&o(t,i(e))}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=c(n(0)),i=c(n(4)),r=c(n(10));e.bindAdvance=function(){const t=(0,s.parseShorthand)(this.options.advanceOn,["selector","event"]),e=t.event,n=t.selector,i=function(t){return e=>{if(this.isOpen()){const n=this.el&&e.target===this.el,i=!(0,o.default)(t)&&e.target.matches(t);(i||n)&&this.tour.next()}}}.call(this,n);if((0,o.default)(n))document.body.addEventListener(e,i);else{const t=document.querySelector(n);t.addEventListener(e,i)}this.on("destroy",()=>document.body.removeEventListener(e,i))},e.bindButtonEvents=function(t,e){t.events=t.events||{},(0,o.default)(t.action)||(t.events.click=t.action);(0,r.default)(t.events,(t,n)=>{if((0,i.default)(t)){const e=t;t=(()=>this.tour.show(e))}e.dataset.buttonEvent=!0,e.addEventListener(n,t),this.on("destroy",()=>{e.removeAttribute("data-button-event"),e.removeEventListener(n,t)})})},e.bindCancelLink=function(t){t.addEventListener("click",t=>{t.preventDefault(),this.cancel()})},e.bindMethods=function(t){t.map(t=>{this[t]=this[t].bind(this)})};var s=n(12);function c(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=c(n(35)),i=c(n(0)),r=c(n(1));e.createFromHTML=function(t){const e=document.createElement("div");return e.innerHTML=t,e.children[0]},e.parsePosition=function(t){if((0,r.default)(t))return t.hasOwnProperty("element")&&t.hasOwnProperty("on")?t:null;const e=/^(.+) (top|left|right|bottom|center)$/.exec(t);if(!e)return null;return{element:e[1],on:e[2]}},e.parseShorthand=function(t,e){if(null===t||(0,i.default)(t))return t;if((0,r.default)(t))return t;const n=t.split(" ");return(0,o.default)(e,n)},e.setupPopper=function(){if((0,i.default)(s.default))throw new Error("Using the attachment feature of Shepherd requires the Popper.js library");const t=this.getAttachTo();t.modifiers=t.modifiers||{};let e=t.on||"right";t.positionFixed=!1,(0,i.default)(t.element)&&(e="top",function(t){t.element=document.body,t.modifiers=Object.assign({computeStyle:{enabled:!0,fn:t=>(t.styles=Object.assign({},t.styles,{left:"50%",top:"50%",transform:"translate(-50%, -50%)"}),t)}},t.modifiers),t.positionFixed=!0}(t));this.popper&&this.popper.destroy();this.el.classList.add("shepherd-element");const n=function(t,e){return Object.assign({},{placement:t,arrowElement:this.el.querySelector(".popper__arrow"),modifiers:e.modifiers,positionFixed:e.positionFixed},this.options.popperOptions)}.call(this,e,t);this.popper=new s.default(t.element,this.el,n),this.target=t.element,this.target.classList.add("shepherd-enabled","shepherd-target")};var s=c(n(42));function c(t){return t&&t.__esModule?t:{default:t}}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(3),i=n(7),r=n(43);Object.assign(r.Shepherd,{Tour:r.Tour,Step:i.Step,Evented:o.Evented}),e.default=r.Shepherd,t.exports=e.default},function(t,e,n){var o=n(15),i=n(16);t.exports=function(t,e,n){var r=null==t?0:t.length;return r?(e=n||void 0===e?1:i(e),o(t,e<0?0:e,r)):[]}},function(t,e){t.exports=function(t,e,n){var o=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var r=Array(i);++o<i;)r[o]=t[o+e];return r}},function(t,e){t.exports=function(t){return t}},function(t,e,n){var o=n(5)(Object.getPrototypeOf,Object);t.exports=o},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e,n){var o=n(20),i=n(21),r=n(22),s=n(8),c=n(23),u=n(25),p=n(26),a=n(27),d="[object Map]",h="[object Set]",l=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(c(t)&&(s(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||a(t)||r(t)))return!t.length;var e=i(t);if(e==d||e==h)return!t.size;if(p(t))return!o(t).length;for(var n in t)if(l.call(t,n))return!1;return!0}},function(t,e,n){var o=n(5)(Object.keys,Object);t.exports=o},function(t,e){var n=Object.prototype.toString;t.exports=function(t){return n.call(t)}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var o=n(6),i=n(24);t.exports=function(t){return null!=t&&i(t.length)&&!o(t)}},function(t,e){var n=9007199254740991;t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=n}},function(t,e){t.exports=function(){return!1}},function(t,e){t.exports=function(){return!1}},function(t,e){t.exports=function(){return!1}},function(t,e,n){var o=n(1),i=n(9);t.exports=function(t){return o(t)&&1===t.nodeType&&!i(t)}},function(t,e,n){var o=n(30),i=n(32);t.exports=function(t,e){return t&&o(t,e,i)}},function(t,e,n){var o=n(31)();t.exports=o},function(t,e){t.exports=function(t){return function(e,n,o){for(var i=-1,r=Object(e),s=o(e),c=s.length;c--;){var u=s[t?c:++i];if(!1===n(r[u],u,r))break}return e}}},function(t,e,n){var o=n(5)(Object.keys,Object);t.exports=o},function(t,e){t.exports=function(t){return t}},function(t,e){Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector)},function(t,e,n){var o=n(36),i=n(41);t.exports=function(t,e){return i(t||[],e||[],o)}},function(t,e,n){var o=n(37),i=n(40),r=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var s=t[e];r.call(t,e)&&i(s,n)&&(void 0!==n||e in t)||o(t,e,n)}},function(t,e,n){var o=n(38);t.exports=function(t,e,n){"__proto__"==e&&o?o(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},function(t,e,n){var o=n(39),i=function(){try{var t=o(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t,e,n){for(var o=-1,i=t.length,r=e.length,s={};++o<i;){var c=o<r?e[o]:void 0;n(s,t[o],c)}return s}},function(e,n){e.exports=t},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Shepherd=e.Tour=void 0;var o=a(n(0)),i=a(n(4)),r=a(n(44)),s=a(n(6)),c=n(3),u=n(7),p=n(11);function a(t){return t&&t.__esModule?t:{default:t}}const d=new c.Evented;e.Tour=class extends c.Evented{constructor(t={}){return super(t),p.bindMethods.call(this,["back","cancel","complete","next"]),this.options=t,this.steps=this.options.steps||[],["active","cancel","complete","inactive","show","start"].map(t=>{(t=>{this.on(t,e=>{(e=e||{}).tour=this,d.trigger(t,e)})})(t)}),this}addStep(t,e){let n,i;return(0,o.default)(e)?i=t:(n=t,i=e),i instanceof u.Step?i.tour=this:i=this.setupStep(i,n),this.steps.push(i),i}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}cancel(){this.done("cancel")}complete(){this.done("complete")}done(t){this.currentStep&&this.currentStep.hide(),this.trigger(t),d.activeTour&&d.activeTour.steps.forEach(t=>{t.destroy()}),d.activeTour=null,document.body.classList.remove("shepherd-active"),this.trigger("inactive",{tour:this})}getById(t){return this.steps.find(e=>e.id===t)}getCurrentStep(){return this.currentStep}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const e=this.getCurrentStep();this.steps.some((e,n)=>{if(e.id===t)return e.isOpen()&&e.hide(),e.destroy(),this.steps.splice(n,1),!0}),e&&e.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}setupStep(t,e){return((0,i.default)(e)||(0,r.default)(e))&&(t.id=e.toString()),t=Object.assign({},this.options.defaults,t),new u.Step(this,t)}show(t=0,e=!0){this._setupActiveTour();const n=(0,i.default)(t)?this.getById(t):this.steps[t];n&&((0,s.default)(n.options.showOn)&&!n.options.showOn()?this._skipStep(n,e):(this.trigger("show",{step:n,previous:this.currentStep}),this.currentStep=n,n.show()))}start(){this.trigger("start"),this.currentStep=null,this.next()}_setupActiveTour(){this.currentStep?this.currentStep.hide():(document.body.classList.add("shepherd-active"),this.trigger("active",{tour:this})),d.activeTour=this}_skipStep(t,e){const n=this.steps.indexOf(t),o=e?n+1:n-1;this.show(o,e)}},e.Shepherd=d},function(t,e,n){var o=n(2),i=n(1),r="[object Number]";t.exports=function(t){return"number"==typeof t||i(t)&&o(t)==r}}])});
//# sourceMappingURL=shepherd.min.js.map
{
"name": "shepherd.js",
"version": "2.0.0-beta.22",
"version": "2.0.0-beta.23",
"repository": {

@@ -53,13 +53,14 @@ "type": "git",

"element-matches": "^0.1.2",
"lodash": "^4.17.10",
"lodash-es": "^4.17.10",
"popper.js": "^1.14.3"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"autoprefixer": "^9.1.3",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-loader": "^8.0.0",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-istanbul": "^4.1.6",
"babel-plugin-istanbul": "^5.0.1",
"babel-plugin-lodash": "^3.3.4",
"babel-preset-env": "^1.6.1",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
"browser-sync": "^2.24.7",

@@ -88,3 +89,3 @@ "browser-sync-webpack-plugin": "^2.2.2",

"istanbul-instrumenter-loader": "^3.0.1",
"istanbul-lib-coverage": "^1.2.0",
"istanbul-lib-coverage": "^2.0.1",
"lodash-webpack-plugin": "^0.11.5",

@@ -94,3 +95,3 @@ "mocha": "^5.2.0",

"node-sass": "^4.9.2",
"nyc": "^12.0.2",
"nyc": "^13.0.1",
"postcss": "^7.0.2",

@@ -103,3 +104,3 @@ "postcss-loader": "^3.0.0",

"start-server-and-test": "^1.7.0",
"style-loader": "^0.22.1",
"style-loader": "^0.23.0",
"stylelint-config-ship-shape": "^0.4.0",

@@ -106,0 +107,0 @@ "stylelint-webpack-plugin": "^0.10.5",

@@ -12,3 +12,3 @@ ## Shepherd

[![Guide your users through a tour of your app](http://i.imgur.com/LDhfBvd.png)](https://shipshapecode.github.io/shepherd/docs/welcome/)
[![Guide your users through a tour of your app](http://i.imgur.com/LDhfBvd.png)](https://shipshapecode.github.io/shepherd/docs/welcome/) [![Greenkeeper badge](https://badges.greenkeeper.io/shipshapecode/shepherd.svg)](https://greenkeeper.io/)

@@ -15,0 +15,0 @@

import { parseShorthand } from './utils.js';
import _ from 'lodash';
import { forOwn, isString, isUndefined } from 'lodash';

@@ -12,3 +12,3 @@ /**

const targetIsEl = this.el && e.target === this.el;
const targetIsSelector = !_.isUndefined(selector) && e.target.matches(selector);
const targetIsSelector = !isUndefined(selector) && e.target.matches(selector);
if (targetIsSelector || targetIsEl) {

@@ -30,3 +30,3 @@ this.tour.next();

// TODO: this should also bind/unbind on show/hide
if (!_.isUndefined(selector)) {
if (!isUndefined(selector)) {
const el = document.querySelector(selector);

@@ -49,3 +49,3 @@ el.addEventListener(event, handler);

cfg.events = cfg.events || {};
if (!_.isUndefined(cfg.action)) {
if (!isUndefined(cfg.action)) {
// Including both a click event and an action is not supported

@@ -55,4 +55,4 @@ cfg.events.click = cfg.action;

_.forOwn(cfg.events, (handler, event) => {
if (_.isString(handler)) {
forOwn(cfg.events, (handler, event) => {
if (isString(handler)) {
const page = handler;

@@ -59,0 +59,0 @@ handler = () => this.tour.show(page);

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

import _ from 'lodash';
import { drop, isUndefined } from 'lodash';

@@ -7,6 +7,6 @@ export class Evented {

if (_.isUndefined(this.bindings)) {
if (isUndefined(this.bindings)) {
this.bindings = {};
}
if (_.isUndefined(this.bindings[event])) {
if (isUndefined(this.bindings[event])) {
this.bindings[event] = [];

@@ -22,7 +22,7 @@ }

off(event, handler) {
if (_.isUndefined(this.bindings) || _.isUndefined(this.bindings[event])) {
if (isUndefined(this.bindings) || isUndefined(this.bindings[event])) {
return false;
}
if (_.isUndefined(handler)) {
if (isUndefined(handler)) {
delete this.bindings[event];

@@ -39,4 +39,4 @@ } else {

trigger(event) {
if (!_.isUndefined(this.bindings) && this.bindings[event]) {
const args = _.drop(arguments);
if (!isUndefined(this.bindings) && this.bindings[event]) {
const args = drop(arguments);

@@ -43,0 +43,0 @@ this.bindings[event].forEach((binding, index) => {

@@ -1,2 +0,10 @@

import _ from 'lodash';
import {
forOwn,
isElement,
isEmpty,
isFunction,
isPlainObject,
isString,
isUndefined
} from 'lodash';
import { Evented } from './evented.js';

@@ -107,3 +115,3 @@ import 'element-matches';

if (_.isFunction(paragraphs)) {
if (isFunction(paragraphs)) {
paragraphs = paragraphs.call(this, text);

@@ -115,3 +123,3 @@ }

} else {
if (_.isString(paragraphs)) {
if (isString(paragraphs)) {
paragraphs = [paragraphs];

@@ -141,3 +149,3 @@ }

}
if (_.isString(renderLocation)) {
if (isString(renderLocation)) {
return document.querySelector(renderLocation).appendChild(element);

@@ -177,3 +185,3 @@ }

if (!_.isUndefined(this.options.text)) {
if (!isUndefined(this.options.text)) {
this._addContent(content);

@@ -204,3 +212,3 @@ }

if (_.isString(opts.element)) {
if (isString(opts.element)) {
// Can't override the element in user opts reference because we can't

@@ -244,3 +252,3 @@ // guarantee that the element will exist in the future.

destroy() {
if (_.isElement(this.el) && this.el.parentNode) {
if (isElement(this.el) && this.el.parentNode) {
this.el.parentNode.removeChild(this.el);

@@ -296,3 +304,3 @@ delete this.el;

render() {
if (!_.isUndefined(this.el)) {
if (!isUndefined(this.el)) {
this.destroy();

@@ -318,5 +326,5 @@ }

if (_.isFunction(this.options.scrollToHandler)) {
if (isFunction(this.options.scrollToHandler)) {
this.options.scrollToHandler(element);
} else if (_.isElement(element)) {
} else if (isElement(element)) {
element.scrollIntoView();

@@ -337,3 +345,3 @@ }

_.forOwn(when, (handler, event) => {
forOwn(when, (handler, event) => {
this.on(event, handler, this);

@@ -350,5 +358,5 @@ });

show() {
if (_.isFunction(this.options.beforeShowPromise)) {
if (isFunction(this.options.beforeShowPromise)) {
const beforeShowPromise = this.options.beforeShowPromise();
if (!_.isUndefined(beforeShowPromise)) {
if (!isUndefined(beforeShowPromise)) {
return beforeShowPromise.then(() => this._show());

@@ -368,3 +376,3 @@ }

if (buttons) {
const buttonsAreDefault = _.isUndefined(buttons) || _.isEmpty(buttons);
const buttonsAreDefault = isUndefined(buttons) || isEmpty(buttons);
if (buttonsAreDefault) {

@@ -377,3 +385,3 @@ this.options.buttons = [{

} else {
const buttonsAreObject = _.isPlainObject(buttons);
const buttonsAreObject = isPlainObject(buttons);
// Can pass in an object which will assume a single button

@@ -380,0 +388,0 @@ if (buttonsAreObject) {

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

import _ from 'lodash';
import { isFunction, isNumber, isString, isUndefined } from 'lodash';
import { Evented } from './evented.js';

@@ -58,3 +58,3 @@ import { Step } from './step.js';

// If we just have one argument, we can assume it is an object of step options, with an id
if (_.isUndefined(arg2)) {
if (isUndefined(arg2)) {
step = arg1;

@@ -189,3 +189,3 @@ } else {

setupStep(stepOptions, name) {
if (_.isString(name) || _.isNumber(name)) {
if (isString(name) || isNumber(name)) {
stepOptions.id = name.toString();

@@ -207,3 +207,3 @@ }

const step = _.isString(key) ? this.getById(key) : this.steps[key];
const step = isString(key) ? this.getById(key) : this.steps[key];

@@ -214,3 +214,3 @@ if (!step) {

const shouldSkipStep = _.isFunction(step.options.showOn) && !step.options.showOn();
const shouldSkipStep = isFunction(step.options.showOn) && !step.options.showOn();
// If `showOn` returns false, we want to skip the step, otherwise, show the step like normal

@@ -217,0 +217,0 @@ if (shouldSkipStep) {

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

import _ from 'lodash';
import { isObjectLike, isUndefined, zipObject } from 'lodash';
import Popper from 'popper.js';

@@ -21,3 +21,3 @@

export function parsePosition(position) {
if (_.isObjectLike(position)) {
if (isObjectLike(position)) {
if (position.hasOwnProperty('element') && position.hasOwnProperty('on')) {

@@ -48,5 +48,5 @@ return position;

export function parseShorthand(obj, props) {
if (obj === null || _.isUndefined(obj)) {
if (obj === null || isUndefined(obj)) {
return obj;
} else if (_.isObjectLike(obj)) {
} else if (isObjectLike(obj)) {
return obj;

@@ -56,3 +56,3 @@ }

const values = obj.split(' ');
return _.zipObject(props, values);
return zipObject(props, values);
}

@@ -64,3 +64,3 @@

export function setupPopper() {
if (_.isUndefined(Popper)) {
if (isUndefined(Popper)) {
throw new Error('Using the attachment feature of Shepherd requires the Popper.js library');

@@ -74,3 +74,3 @@ }

if (_.isUndefined(opts.element)) {
if (isUndefined(opts.element)) {
attachment = 'top';

@@ -77,0 +77,0 @@ _setupCenteredPopper(opts);

@@ -179,9 +179,3 @@ /* global require, module, __dirname */

],
use: [{
loader: 'babel-loader',
options: {
'plugins': ['lodash'],
'presets': [['env', { 'modules': false, 'targets': { 'node': 6 } }]]
}
}]
loader: 'babel-loader'
}

@@ -188,0 +182,0 @@ ]

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

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