blinguidance
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "blinguidance", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "guidance", | ||
"main": "src/lib/guidance.umd.min.js", | ||
"files": [ | ||
"src" | ||
"src", | ||
"README.md" | ||
], | ||
@@ -9,0 +10,0 @@ "scripts": { |
@@ -1,3 +0,3 @@ | ||
"use strict";function t(){ | ||
"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
t=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var f={};function h(){}function p(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==r&&n.call(m,i)&&(v=m);var w=d.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=d,u(w,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},g(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw a}}}}function o(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,i(t,e,"set"),r),r}function i(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var c;function u(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}var s=new WeakMap,l=new WeakSet;c=Symbol.iterator;var f=function(){function r(t){var e,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),a(e=this,n=l),n.add(e),function(t,e,r){a(t,e),e.set(t,r)}(this,s,{writable:!0,value:!1});var o=t.flow,i=t.btns,c=void 0===i?{next:{},end:{}}:i,f=t.width,h=void 0===f?"100%":f;this.flow=o,this.mask=u("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.content=u("div",{width:h,height:"100%",margin:"0 auto",position:"relative"}),this.mask.appendChild(this.content),this.showBox=u("div",{position:"absolute",zIndex:"999"}),this.nextBtn=u("div",c.next),this.endBtn=u("div",c.end)}var f,p,d;return f=r,d=[{key:"create",value:function(t){var e=new r(t);return e.insert.bind(e)}}],(p=[{key:"insert",value:function(e,r){if(!function(t,e){return e.get?e.get.call(t):e.value}(a=this,i(a,s,"get"))){var a;document.body.appendChild(this.mask),o(this,s,!0);var c=t().mark((function o(i){var a,c,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i.content.appendChild(i.showBox),i.showBox.appendChild(i.nextBtn),i.showBox.appendChild(i.endBtn),i.nextBtn.onclick=e,i.endBtn.onclick=r,a=n(i.flow),t.prev=6,a.s();case 8:if((c=a.n()).done){t.next=17;break}return s=c.value,u(i.showBox,s),u(i.nextBtn,s.next),u(i.endBtn,s.end),void(t.next=15);case 15:t.next=8;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(6),a.e(t.t0);case 22:return t.prev=22,a.f(),t.finish(22);case 25:case"end":return t.stop()}}),o,null,[[6,19,22,25]])}))(this);return c.end=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}(this,l,h).bind(this),c}}},{key:c,value:t().mark((function e(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),e,this)}))}])&&e(f.prototype,p),d&&e(f,d),Object.defineProperty(f,"prototype",{writable:!1}),r}();function h(){document.body.removeChild(this.mask),this.mask=null,this.showBox=null}module.exports=f; | ||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function h(){}function p(){}function d(){}var y={};u(y,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==e&&n.call(g,i)&&(y=g);var w=d.prototype=h.prototype=Object.create(y);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=d,u(w,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},m(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=a(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,i=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw i}}}}function l(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,s(t,e,"set"),r),r}function s(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function f(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}function h(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p(t,e){h(t,e),e.add(t)}var d;function y(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}function v(t){window.scrollTo({top:t,behavior:"smooth"})}var g=new WeakMap,w=new WeakSet,m=new WeakSet,b=new WeakSet,x=new WeakSet,L=new WeakSet;d=Symbol.iterator;var E=function(){function t(r){var n,o,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,L),p(this,x),p(this,b),p(this,m),p(this,w),i={writable:!0,value:!1},h(n=this,o=g),o.set(n,i);var a=r.flow,c=r.btns,u=void 0===c?{next:{},end:{}}:c;this.flow=a,this.innerHeight=window.innerHeight,this.mask=y("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.showBox=y("div",{position:"absolute",zIndex:"999",backgroundSize:"cover",transition:"all 0.3s ease-in-out"});var l={cursor:"pointer",position:"absolute"};this.nextBtn=y("div",e(e({},u.next),l)),this.endBtn=y("div",e(e({},u.end),{},{cursor:"pointer"},l))}var o,i,a;return o=t,a=[{key:"create",value:function(e){var r=new t(e);return r.insert.bind(r)}}],(i=[{key:"insert",value:function(t,e){if(!function(t,e){return e.get?e.get.call(t):e.value}(n=this,s(n,g,"get"))){var n;l(this,g,!0);var o=r().mark((function n(o){var i,a,c;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:document.body.appendChild(o.mask),document.body.appendChild(o.showBox),f(o,b,j).call(o),o.showBox.appendChild(o.nextBtn),o.showBox.appendChild(o.endBtn),o.nextBtn.onclick=t,o.endBtn.onclick=e,i=u(o.flow),r.prev=8,i.s();case 10:if((a=i.n()).done){r.next=22;break}if((c=a.value).target){r.next=14;break}throw new Error("Target is not passed in");case 14:return o.currentStyle=c,f(o,m,k).call(o,c),y(o.nextBtn,c.next),y(o.endBtn,c.end),void(r.next=20);case 20:r.next=10;break;case 22:r.next=27;break;case 24:r.prev=24,r.t0=r.catch(8),i.e(r.t0);case 27:return r.prev=27,i.f(),r.finish(27);case 30:case"end":return r.stop()}}),n,null,[[8,24,27,30]])}))(this);return o.end=f(this,L,F).bind(this),o}}},{key:d,value:r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),t,this)}))}])&&n(o.prototype,i),a&&n(o,a),Object.defineProperty(o,"prototype",{writable:!1}),t}();function O(t,r){if(!t)return e(e({},r),{},{left:parseFloat(r.left)-parseFloat(r.width)+parseFloat(r.targetWidth)+"px"});var n={xLeft:parseFloat(r.left)-parseFloat(r.width)+"px",xRight:parseFloat(r.left)+parseFloat(r.targetWidth)+"px",xCenter:parseFloat(r.left)-parseFloat(r.width)/2+parseFloat(r.targetWidth)/2+"px",yTop:parseFloat(r.top)-parseFloat(r.height)+"px",yBottom:parseFloat(r.top)+parseFloat(r.targetHeight)+"px",yCenter:parseFloat(r.top)-parseFloat(r.height)/2+parseFloat(r.targetHeight)/2+"px"};switch(t){case"top":return e(e({},r),{},{top:n.yTop,left:n.xCenter});case"right":return e(e({},r),{},{left:n.xRight,top:n.yCenter});case"bottom":return e(e({},r),{},{top:n.yBottom,left:n.yCenter});case"left":return e(e({},r),{},{left:n.xLeft,top:n.yCenter});case"topLeft":return e(e({},r),{},{left:n.xLeft,top:n.yTop});case"topRight":return e(e({},r),{},{left:n.xRight,top:n.yTop});case"bottomLeft":case"bottomRight":return e(e({},r),{},{left:n.xLeft,top:n.yBottom})}}function k(t){var r,n,o,a=i((r=t.target,n=document.querySelector(r),o=n.offsetLeft,[n.offsetTop+"px",o+"px",n.clientHeight+"px",n.clientWidth+"px"]),4),c=a[0],u=a[1],l=a[2],s=a[3];f(this,x,S).call(this,c,l);var h=f(this,w,O).call(this,t.placement,e(e({},t),{},{top:c,left:u,targetWidth:s,targetHeight:l}));y(this.showBox,h)}function j(){var t=this;this.resize=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1;return function(){for(var i=this,a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];n&&!o?(t.apply(this,c),o=!0):(e&&clearTimeout(e),e=setTimeout((function(){t.apply(i,c),e=null,o=!1}),r))}}((function(){f(t,m,k).call(t,t.currentStyle)})),window.addEventListener("resize",this.resize)}function S(t,e){v(parseFloat(t)+parseFloat(e)/2-this.innerHeight/2)}function F(){v(0),document.body.removeChild(this.mask),document.body.removeChild(this.showBox),this.mask=null,this.showBox=null,window.removeEventListener("resize",this.resize)}module.exports=E; |
@@ -1,3 +0,3 @@ | ||
function t(){ | ||
function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
t=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var f={};function h(){}function p(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==r&&n.call(m,i)&&(v=m);var w=d.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=l(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return p.prototype=d,u(w,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},g(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw a}}}}function o(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,i(t,e,"set"),r),r}function i(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var c;function u(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}var s=new WeakMap,l=new WeakSet;c=Symbol.iterator;var f=function(){function r(t){var e,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),a(e=this,n=l),n.add(e),function(t,e,r){a(t,e),e.set(t,r)}(this,s,{writable:!0,value:!1});var o=t.flow,i=t.btns,c=void 0===i?{next:{},end:{}}:i,f=t.width,h=void 0===f?"100%":f;this.flow=o,this.mask=u("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.content=u("div",{width:h,height:"100%",margin:"0 auto",position:"relative"}),this.mask.appendChild(this.content),this.showBox=u("div",{position:"absolute",zIndex:"999"}),this.nextBtn=u("div",c.next),this.endBtn=u("div",c.end)}var f,p,d;return f=r,d=[{key:"create",value:function(t){var e=new r(t);return e.insert.bind(e)}}],(p=[{key:"insert",value:function(e,r){if(!function(t,e){return e.get?e.get.call(t):e.value}(a=this,i(a,s,"get"))){var a;document.body.appendChild(this.mask),o(this,s,!0);var c=t().mark((function o(i){var a,c,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i.content.appendChild(i.showBox),i.showBox.appendChild(i.nextBtn),i.showBox.appendChild(i.endBtn),i.nextBtn.onclick=e,i.endBtn.onclick=r,a=n(i.flow),t.prev=6,a.s();case 8:if((c=a.n()).done){t.next=17;break}return s=c.value,u(i.showBox,s),u(i.nextBtn,s.next),u(i.endBtn,s.end),void(t.next=15);case 15:t.next=8;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(6),a.e(t.t0);case 22:return t.prev=22,a.f(),t.finish(22);case 25:case"end":return t.stop()}}),o,null,[[6,19,22,25]])}))(this);return c.end=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}(this,l,h).bind(this),c}}},{key:c,value:t().mark((function e(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),e,this)}))}])&&e(f.prototype,p),d&&e(f,d),Object.defineProperty(f,"prototype",{writable:!1}),r}();function h(){document.body.removeChild(this.mask),this.mask=null,this.showBox=null}export{f as default}; | ||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function h(){}function p(){}function d(){}var y={};u(y,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==e&&n.call(g,i)&&(y=g);var w=d.prototype=h.prototype=Object.create(y);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=d,u(w,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},m(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=a(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,i=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw i}}}}function l(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,s(t,e,"set"),r),r}function s(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function f(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}function h(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p(t,e){h(t,e),e.add(t)}var d;function y(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}function v(t){window.scrollTo({top:t,behavior:"smooth"})}var g=new WeakMap,w=new WeakSet,m=new WeakSet,b=new WeakSet,x=new WeakSet,L=new WeakSet;d=Symbol.iterator;var E=function(){function t(r){var n,o,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,L),p(this,x),p(this,b),p(this,m),p(this,w),i={writable:!0,value:!1},h(n=this,o=g),o.set(n,i);var a=r.flow,c=r.btns,u=void 0===c?{next:{},end:{}}:c;this.flow=a,this.innerHeight=window.innerHeight,this.mask=y("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.showBox=y("div",{position:"absolute",zIndex:"999",backgroundSize:"cover",transition:"all 0.3s ease-in-out"});var l={cursor:"pointer",position:"absolute"};this.nextBtn=y("div",e(e({},u.next),l)),this.endBtn=y("div",e(e({},u.end),{},{cursor:"pointer"},l))}var o,i,a;return o=t,a=[{key:"create",value:function(e){var r=new t(e);return r.insert.bind(r)}}],(i=[{key:"insert",value:function(t,e){if(!function(t,e){return e.get?e.get.call(t):e.value}(n=this,s(n,g,"get"))){var n;l(this,g,!0);var o=r().mark((function n(o){var i,a,c;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:document.body.appendChild(o.mask),document.body.appendChild(o.showBox),f(o,b,j).call(o),o.showBox.appendChild(o.nextBtn),o.showBox.appendChild(o.endBtn),o.nextBtn.onclick=t,o.endBtn.onclick=e,i=u(o.flow),r.prev=8,i.s();case 10:if((a=i.n()).done){r.next=22;break}if((c=a.value).target){r.next=14;break}throw new Error("Target is not passed in");case 14:return o.currentStyle=c,f(o,m,k).call(o,c),y(o.nextBtn,c.next),y(o.endBtn,c.end),void(r.next=20);case 20:r.next=10;break;case 22:r.next=27;break;case 24:r.prev=24,r.t0=r.catch(8),i.e(r.t0);case 27:return r.prev=27,i.f(),r.finish(27);case 30:case"end":return r.stop()}}),n,null,[[8,24,27,30]])}))(this);return o.end=f(this,L,F).bind(this),o}}},{key:d,value:r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),t,this)}))}])&&n(o.prototype,i),a&&n(o,a),Object.defineProperty(o,"prototype",{writable:!1}),t}();function O(t,r){if(!t)return e(e({},r),{},{left:parseFloat(r.left)-parseFloat(r.width)+parseFloat(r.targetWidth)+"px"});var n={xLeft:parseFloat(r.left)-parseFloat(r.width)+"px",xRight:parseFloat(r.left)+parseFloat(r.targetWidth)+"px",xCenter:parseFloat(r.left)-parseFloat(r.width)/2+parseFloat(r.targetWidth)/2+"px",yTop:parseFloat(r.top)-parseFloat(r.height)+"px",yBottom:parseFloat(r.top)+parseFloat(r.targetHeight)+"px",yCenter:parseFloat(r.top)-parseFloat(r.height)/2+parseFloat(r.targetHeight)/2+"px"};switch(t){case"top":return e(e({},r),{},{top:n.yTop,left:n.xCenter});case"right":return e(e({},r),{},{left:n.xRight,top:n.yCenter});case"bottom":return e(e({},r),{},{top:n.yBottom,left:n.yCenter});case"left":return e(e({},r),{},{left:n.xLeft,top:n.yCenter});case"topLeft":return e(e({},r),{},{left:n.xLeft,top:n.yTop});case"topRight":return e(e({},r),{},{left:n.xRight,top:n.yTop});case"bottomLeft":case"bottomRight":return e(e({},r),{},{left:n.xLeft,top:n.yBottom})}}function k(t){var r,n,o,a=i((r=t.target,n=document.querySelector(r),o=n.offsetLeft,[n.offsetTop+"px",o+"px",n.clientHeight+"px",n.clientWidth+"px"]),4),c=a[0],u=a[1],l=a[2],s=a[3];f(this,x,S).call(this,c,l);var h=f(this,w,O).call(this,t.placement,e(e({},t),{},{top:c,left:u,targetWidth:s,targetHeight:l}));y(this.showBox,h)}function j(){var t=this;this.resize=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1;return function(){for(var i=this,a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];n&&!o?(t.apply(this,c),o=!0):(e&&clearTimeout(e),e=setTimeout((function(){t.apply(i,c),e=null,o=!1}),r))}}((function(){f(t,m,k).call(t,t.currentStyle)})),window.addEventListener("resize",this.resize)}function S(t,e){v(parseFloat(t)+parseFloat(e)/2-this.innerHeight/2)}function F(){v(0),document.body.removeChild(this.mask),document.body.removeChild(this.showBox),this.mask=null,this.showBox=null,window.removeEventListener("resize",this.resize)}export{E as default}; |
@@ -1,3 +0,3 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Guidance=e()}(this,(function(){"use strict";function t(){ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Guidance=e()}(this,(function(){"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(){ | ||
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ | ||
t=function(){return e};var e={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new k(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return O()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===l)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=s;var l={};function h(){}function d(){}function p(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,m=y&&y(y(j([])));m&&m!==r&&n.call(m,i)&&(v=m);var w=p.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,l;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:O}}function O(){return{value:void 0,done:!0}}return d.prototype=p,u(w,"constructor",p),u(p,"constructor",d),d.displayName=u(p,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},g(b.prototype),u(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=j,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),l}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}function e(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function n(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var o=0,i=function(){};return{s:i,n:function(){return o>=t.length?{done:!0}:{done:!1,value:t[o++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,c=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return c=t.done,t},e:function(t){u=!0,a=t},f:function(){try{c||null==n.return||n.return()}finally{if(u)throw a}}}}function o(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,i(t,e,"set"),r),r}function i(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var c;function u(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}var s=new WeakMap,f=new WeakSet;function l(){document.body.removeChild(this.mask),this.mask=null,this.showBox=null}return c=Symbol.iterator,function(){function r(t){var e,n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),a(e=this,n=f),n.add(e),function(t,e,r){a(t,e),e.set(t,r)}(this,s,{writable:!0,value:!1});var o=t.flow,i=t.btns,c=void 0===i?{next:{},end:{}}:i,l=t.width,h=void 0===l?"100%":l;this.flow=o,this.mask=u("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.content=u("div",{width:h,height:"100%",margin:"0 auto",position:"relative"}),this.mask.appendChild(this.content),this.showBox=u("div",{position:"absolute",zIndex:"999"}),this.nextBtn=u("div",c.next),this.endBtn=u("div",c.end)}var h,d,p;return h=r,p=[{key:"create",value:function(t){var e=new r(t);return e.insert.bind(e)}}],(d=[{key:"insert",value:function(e,r){if(!function(t,e){return e.get?e.get.call(t):e.value}(a=this,i(a,s,"get"))){var a;document.body.appendChild(this.mask),o(this,s,!0);var c=t().mark((function o(i){var a,c,s;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i.content.appendChild(i.showBox),i.showBox.appendChild(i.nextBtn),i.showBox.appendChild(i.endBtn),i.nextBtn.onclick=e,i.endBtn.onclick=r,a=n(i.flow),t.prev=6,a.s();case 8:if((c=a.n()).done){t.next=17;break}return s=c.value,u(i.showBox,s),u(i.nextBtn,s.next),u(i.endBtn,s.end),void(t.next=15);case 15:t.next=8;break;case 17:t.next=22;break;case 19:t.prev=19,t.t0=t.catch(6),a.e(t.t0);case 22:return t.prev=22,a.f(),t.finish(22);case 25:case"end":return t.stop()}}),o,null,[[6,19,22,25]])}))(this);return c.end=function(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}(this,f,l).bind(this),c}}},{key:c,value:t().mark((function e(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),e,this)}))}])&&e(h.prototype,d),p&&e(h,p),Object.defineProperty(h,"prototype",{writable:!1}),r}()})); | ||
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,i=Object.create(o.prototype),a=new O(n||[]);return i._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return j()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=s(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),i}function s(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=l;var f={};function h(){}function p(){}function d(){}var y={};u(y,i,(function(){return this}));var v=Object.getPrototypeOf,g=v&&v(v(k([])));g&&g!==e&&n.call(g,i)&&(y=g);var w=d.prototype=h.prototype=Object.create(y);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(o,i,a,c){var u=s(t[o],t,i);if("throw"!==u.type){var l=u.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){l.value=t,a(l)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return f;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,f;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=d,u(w,"constructor",d),u(d,"constructor",p),p.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},m(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(l(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(w),u(w,c,"Generator"),u(w,i,(function(){return this})),u(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function n(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function o(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],a=!0,c=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==r.return||r.return()}finally{if(c)throw o}}return i}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=a(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,c=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return c=t.done,t},e:function(t){u=!0,i=t},f:function(){try{c||null==r.return||r.return()}finally{if(u)throw i}}}}function l(t,e,r){return function(t,e,r){if(e.set)e.set.call(t,r);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=r}}(t,s(t,e,"set"),r),r}function s(t,e,r){if(!e.has(t))throw new TypeError("attempted to "+r+" private field on non-instance");return e.get(t)}function f(t,e,r){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return r}function h(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function p(t,e){h(t,e),e.add(t)}var d;function y(t,e){var r=t;for(var n in"string"==typeof t&&(r=document.createElement(t)),e)r.style[n]=e[n];return r}function v(t){window.scrollTo({top:t,behavior:"smooth"})}var g=new WeakMap,w=new WeakSet,m=new WeakSet,b=new WeakSet,x=new WeakSet,L=new WeakSet;function E(t,r){if(!t)return e(e({},r),{},{left:parseFloat(r.left)-parseFloat(r.width)+parseFloat(r.targetWidth)+"px"});var n={xLeft:parseFloat(r.left)-parseFloat(r.width)+"px",xRight:parseFloat(r.left)+parseFloat(r.targetWidth)+"px",xCenter:parseFloat(r.left)-parseFloat(r.width)/2+parseFloat(r.targetWidth)/2+"px",yTop:parseFloat(r.top)-parseFloat(r.height)+"px",yBottom:parseFloat(r.top)+parseFloat(r.targetHeight)+"px",yCenter:parseFloat(r.top)-parseFloat(r.height)/2+parseFloat(r.targetHeight)/2+"px"};switch(t){case"top":return e(e({},r),{},{top:n.yTop,left:n.xCenter});case"right":return e(e({},r),{},{left:n.xRight,top:n.yCenter});case"bottom":return e(e({},r),{},{top:n.yBottom,left:n.yCenter});case"left":return e(e({},r),{},{left:n.xLeft,top:n.yCenter});case"topLeft":return e(e({},r),{},{left:n.xLeft,top:n.yTop});case"topRight":return e(e({},r),{},{left:n.xRight,top:n.yTop});case"bottomLeft":case"bottomRight":return e(e({},r),{},{left:n.xLeft,top:n.yBottom})}}function O(t){var r,n,o,a=i((r=t.target,n=document.querySelector(r),o=n.offsetLeft,[n.offsetTop+"px",o+"px",n.clientHeight+"px",n.clientWidth+"px"]),4),c=a[0],u=a[1],l=a[2],s=a[3];f(this,x,j).call(this,c,l);var h=f(this,w,E).call(this,t.placement,e(e({},t),{},{top:c,left:u,targetWidth:s,targetHeight:l}));y(this.showBox,h)}function k(){var t=this;this.resize=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=!1;return function(){for(var i=this,a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];n&&!o?(t.apply(this,c),o=!0):(e&&clearTimeout(e),e=setTimeout((function(){t.apply(i,c),e=null,o=!1}),r))}}((function(){f(t,m,O).call(t,t.currentStyle)})),window.addEventListener("resize",this.resize)}function j(t,e){v(parseFloat(t)+parseFloat(e)/2-this.innerHeight/2)}function S(){v(0),document.body.removeChild(this.mask),document.body.removeChild(this.showBox),this.mask=null,this.showBox=null,window.removeEventListener("resize",this.resize)}return d=Symbol.iterator,function(){function t(r){var n,o,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),p(this,L),p(this,x),p(this,b),p(this,m),p(this,w),i={writable:!0,value:!1},h(n=this,o=g),o.set(n,i);var a=r.flow,c=r.btns,u=void 0===c?{next:{},end:{}}:c;this.flow=a,this.innerHeight=window.innerHeight,this.mask=y("div",{position:"fixed",top:"0",left:"0",right:"0",bottom:"0",background:"rgba(0,0,0,.5)",zIndex:"99"}),this.showBox=y("div",{position:"absolute",zIndex:"999",backgroundSize:"cover",transition:"all 0.3s ease-in-out"});var l={cursor:"pointer",position:"absolute"};this.nextBtn=y("div",e(e({},u.next),l)),this.endBtn=y("div",e(e({},u.end),{},{cursor:"pointer"},l))}var o,i,a;return o=t,a=[{key:"create",value:function(e){var r=new t(e);return r.insert.bind(r)}}],(i=[{key:"insert",value:function(t,e){if(!function(t,e){return e.get?e.get.call(t):e.value}(n=this,s(n,g,"get"))){var n;l(this,g,!0);var o=r().mark((function n(o){var i,a,c;return r().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:document.body.appendChild(o.mask),document.body.appendChild(o.showBox),f(o,b,k).call(o),o.showBox.appendChild(o.nextBtn),o.showBox.appendChild(o.endBtn),o.nextBtn.onclick=t,o.endBtn.onclick=e,i=u(o.flow),r.prev=8,i.s();case 10:if((a=i.n()).done){r.next=22;break}if((c=a.value).target){r.next=14;break}throw new Error("Target is not passed in");case 14:return o.currentStyle=c,f(o,m,O).call(o,c),y(o.nextBtn,c.next),y(o.endBtn,c.end),void(r.next=20);case 20:r.next=10;break;case 22:r.next=27;break;case 24:r.prev=24,r.t0=r.catch(8),i.e(r.t0);case 27:return r.prev=27,i.f(),r.finish(27);case 30:case"end":return r.stop()}}),n,null,[[8,24,27,30]])}))(this);return o.end=f(this,L,S).bind(this),o}}},{key:d,value:r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.delegateYield(this.flow,"t0",1);case 1:case"end":return t.stop()}}),t,this)}))}])&&n(o.prototype,i),a&&n(o,a),Object.defineProperty(o,"prototype",{writable:!1}),t}()})); |
195
src/main.js
@@ -0,1 +1,2 @@ | ||
// 给元素添加dom | ||
function elementWithStyle(tag, styles) { | ||
@@ -13,2 +14,38 @@ let el = tag | ||
// 获取dom的top和left | ||
function getElementTopAndLeft(selector) { | ||
const target = document.querySelector(selector) | ||
const { offsetLeft, offsetTop, clientHeight, clientWidth } = target | ||
return [ | ||
offsetTop + 'px', | ||
offsetLeft + 'px', | ||
clientHeight + 'px', | ||
clientWidth + 'px', | ||
] | ||
} | ||
// 防抖函数 | ||
function debounce(func, delay = 250, immediate = false) { | ||
let timer | ||
let invoke = false | ||
return function (...arg) { | ||
if (immediate && !invoke) { | ||
func.apply(this, arg) | ||
invoke = true | ||
} else { | ||
if (timer) clearTimeout(timer) | ||
timer = setTimeout(() => { | ||
func.apply(this, arg) | ||
timer = null | ||
invoke = false | ||
}, delay) | ||
} | ||
} | ||
} | ||
// 滚动函数 | ||
function scrollToTop(target) { | ||
window.scrollTo({ top: target, behavior: 'smooth' }) | ||
} | ||
class Guidance { | ||
@@ -21,5 +58,8 @@ /** | ||
constructor(options) { | ||
const { flow, btns = { next: {}, end: {} }, width = '100%' } = options | ||
const { flow, btns = { next: {}, end: {} } } = options | ||
this.flow = flow | ||
this.innerHeight = window.innerHeight | ||
this.mask = elementWithStyle('div', { | ||
@@ -35,9 +75,2 @@ position: 'fixed', | ||
this.content = elementWithStyle('div', { | ||
width, | ||
height: '100%', | ||
margin: '0 auto', | ||
position: 'relative', | ||
}) | ||
this.mask.appendChild(this.content) | ||
// showBoxStyle | ||
@@ -48,18 +81,30 @@ | ||
zIndex: '999', | ||
backgroundSize: 'cover', | ||
transition: 'all 0.3s ease-in-out', | ||
}) | ||
const btnsBaseStyle = { cursor: 'pointer', position: 'absolute' } | ||
// btnsStyle | ||
this.nextBtn = elementWithStyle('div', btns.next) | ||
this.nextBtn = elementWithStyle('div', { | ||
...btns.next, | ||
...btnsBaseStyle, | ||
}) | ||
this.endBtn = elementWithStyle('div', btns.end) | ||
this.endBtn = elementWithStyle('div', { | ||
...btns.end, | ||
cursor: 'pointer', | ||
...btnsBaseStyle, | ||
}) | ||
} | ||
insert(next, end) { | ||
if (this.#isCreate) return | ||
document.body.appendChild(this.mask) | ||
this.#isCreate = true | ||
const guidanceGenerator = (function* (_this) { | ||
_this.content.appendChild(_this.showBox) | ||
document.body.appendChild(_this.mask) | ||
document.body.appendChild(_this.showBox) | ||
_this.#listenerResize() | ||
_this.showBox.appendChild(_this.nextBtn) | ||
@@ -69,4 +114,8 @@ _this.showBox.appendChild(_this.endBtn) | ||
_this.endBtn.onclick = end | ||
for (const styles of _this.flow) { | ||
elementWithStyle(_this.showBox, styles) | ||
if (!styles.target) throw new Error('Target is not passed in') | ||
_this.currentStyle = styles | ||
_this.#setShowBoxStyle(styles) | ||
elementWithStyle(_this.nextBtn, styles.next) | ||
@@ -83,8 +132,124 @@ elementWithStyle(_this.endBtn, styles.end) | ||
} | ||
/** | ||
* | ||
* @param {'left'|'right'|'top'|'bottom'|'topLeft'|'topRight'|'bottomLeft'|'bottomRight'} position | ||
*/ | ||
#setPosition(position, styles) { | ||
// 如果不传默认右上角对其 | ||
if (!position) | ||
return { | ||
...styles, | ||
left: | ||
parseFloat(styles.left) - | ||
parseFloat(styles.width) + | ||
parseFloat(styles.targetWidth) + | ||
'px', | ||
} | ||
const positionObj = { | ||
xLeft: parseFloat(styles.left) - parseFloat(styles.width) + 'px', | ||
xRight: parseFloat(styles.left) + parseFloat(styles.targetWidth) + 'px', | ||
xCenter: | ||
parseFloat(styles.left) - | ||
parseFloat(styles.width) / 2 + | ||
parseFloat(styles.targetWidth) / 2 + | ||
'px', | ||
yTop: parseFloat(styles.top) - parseFloat(styles.height) + 'px', | ||
yBottom: parseFloat(styles.top) + parseFloat(styles.targetHeight) + 'px', | ||
yCenter: | ||
parseFloat(styles.top) - | ||
parseFloat(styles.height) / 2 + | ||
parseFloat(styles.targetHeight) / 2 + | ||
'px', | ||
} | ||
switch (position) { | ||
case 'top': | ||
return { | ||
...styles, | ||
top: positionObj.yTop, | ||
left: positionObj.xCenter, | ||
} | ||
case 'right': | ||
return { | ||
...styles, | ||
left: positionObj.xRight, | ||
top: positionObj.yCenter, | ||
} | ||
case 'bottom': | ||
return { | ||
...styles, | ||
top: positionObj.yBottom, | ||
left: positionObj.yCenter, | ||
} | ||
case 'left': | ||
return { | ||
...styles, | ||
left: positionObj.xLeft, | ||
top: positionObj.yCenter, | ||
} | ||
case 'topLeft': | ||
return { | ||
...styles, | ||
left: positionObj.xLeft, | ||
top: positionObj.yTop, | ||
} | ||
case 'topRight': | ||
return { | ||
...styles, | ||
left: positionObj.xRight, | ||
top: positionObj.yTop, | ||
} | ||
case 'bottomLeft': | ||
return { | ||
...styles, | ||
left: positionObj.xLeft, | ||
top: positionObj.yBottom, | ||
} | ||
case 'bottomRight': | ||
return { | ||
...styles, | ||
left: positionObj.xLeft, | ||
top: positionObj.yBottom, | ||
} | ||
} | ||
} | ||
#setShowBoxStyle(styles) { | ||
const [top, left, targetHeight, targetWidth] = getElementTopAndLeft( | ||
styles.target | ||
) | ||
this.#scroll(top, targetHeight) | ||
const showBoxStyle = this.#setPosition(styles.placement, { | ||
...styles, | ||
top, | ||
left, | ||
targetWidth, | ||
targetHeight, | ||
}) | ||
elementWithStyle(this.showBox, showBoxStyle) | ||
} | ||
#listenerResize() { | ||
this.resize = debounce(() => { | ||
this.#setShowBoxStyle(this.currentStyle) | ||
}) | ||
window.addEventListener('resize', this.resize) | ||
} | ||
#scroll(top, height) { | ||
const elCenter = parseFloat(top) + parseFloat(height) / 2 | ||
const center = this.innerHeight / 2 | ||
scrollToTop(elCenter - center) | ||
} | ||
#end() { | ||
scrollToTop(0) | ||
document.body.removeChild(this.mask) | ||
document.body.removeChild(this.showBox) | ||
this.mask = null | ||
this.showBox = null | ||
window.removeEventListener('resize', this.resize) | ||
} | ||
static create(options) { | ||
@@ -91,0 +256,0 @@ const g = new Guidance(options) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
145185
9
2770
1
101