Fix - Production build and update static files
Browse files- CODE_OF_CONDUCT.md +46 -0
- types/index.d.ts → CONTRIBUTING.md +0 -0
- LICENSE +21 -0
- README.md +18 -1
- dist/driver.min.js +1 -1
- types/.todo +0 -0
- webpack.config.prod.js +3 -2
CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Contributor Covenant Code of Conduct
|
2 |
+
|
3 |
+
## Our Pledge
|
4 |
+
|
5 |
+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6 |
+
|
7 |
+
## Our Standards
|
8 |
+
|
9 |
+
Examples of behavior that contributes to creating a positive environment include:
|
10 |
+
|
11 |
+
* Using welcoming and inclusive language
|
12 |
+
* Being respectful of differing viewpoints and experiences
|
13 |
+
* Gracefully accepting constructive criticism
|
14 |
+
* Focusing on what is best for the community
|
15 |
+
* Showing empathy towards other community members
|
16 |
+
|
17 |
+
Examples of unacceptable behavior by participants include:
|
18 |
+
|
19 |
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
20 |
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
21 |
+
* Public or private harassment
|
22 |
+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
23 |
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
24 |
+
|
25 |
+
## Our Responsibilities
|
26 |
+
|
27 |
+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
28 |
+
|
29 |
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
30 |
+
|
31 |
+
## Scope
|
32 |
+
|
33 |
+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
34 |
+
|
35 |
+
## Enforcement
|
36 |
+
|
37 |
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
38 |
+
|
39 |
+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
40 |
+
|
41 |
+
## Attribution
|
42 |
+
|
43 |
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
44 |
+
|
45 |
+
[homepage]: http://contributor-covenant.org
|
46 |
+
[version]: http://contributor-covenant.org/version/1/4/
|
types/index.d.ts → CONTRIBUTING.md
RENAMED
File without changes
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
The MIT License (MIT)
|
2 |
+
|
3 |
+
Copyright (c) 2018 Kamran Ahmed
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -31,4 +31,21 @@
|
|
31 |
|
32 |

|
33 |
|
34 |
-
For Usage and Examples, [have a look at demo]()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |

|
33 |
|
34 |
+
For Usage and Examples, [have a look at demo](http://kamranahmed.info/driver)
|
35 |
+
|
36 |
+
## Installation
|
37 |
+
|
38 |
+
```zsh
|
39 |
+
yarn add driver.js
|
40 |
+
```
|
41 |
+
|
42 |
+
Or include directly
|
43 |
+
|
44 |
+
Or include Choices directly:
|
45 |
+
|
46 |
+
```html
|
47 |
+
<!-- Include Driver CSS -->
|
48 |
+
<link rel="stylesheet" href="/dist/driver.min.css">
|
49 |
+
<!-- Include Driver JavaScript -->
|
50 |
+
<script src="/dist/driver.min.js"></script>
|
51 |
+
```
|
dist/driver.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Driver=e():t.Driver=e()}(window,function(){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=8)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.OVERLAY_OPACITY=.75,e.OVERLAY_PADDING=10,e.OVERLAY_ANIMATE=!0,e.OVERLAY_ZINDEX="999999999",e.ESC_KEY_CODE=27,e.LEFT_KEY_CODE=37,e.RIGHT_KEY_CODE=39,e.ID_OVERLAY="driver-canvas-overlay";var o=e.ID_POPOVER="driver-popover-item",n=e.CLASS_POPOVER_TIP="driver-popover-tip",s=e.CLASS_POPOVER_TITLE="driver-popover-title",h=e.CLASS_POPOVER_DESCRIPTION="driver-popover-description",r=e.CLASS_POPOVER_FOOTER="driver-popover-footer",l=e.CLASS_CLOSE_BTN="driver-close-btn",a=e.CLASS_NEXT_STEP_BTN="driver-next-btn",d=e.CLASS_PREV_STEP_BTN="driver-prev-btn";e.CLASS_BTN_DISABLED="driver-disabled",e.POPOVER_HTML='\n <div id="'+o+'">\n <div class="'+n+'"></div>\n <div class="'+s+'">Popover Title</div>\n <div class="'+h+'">Popover Description</div>\n <div class="'+r+'">\n <a href="javascript:void(0)" class="'+l+'">Close</a>\n <span class="driver-btn-group">\n <a class="'+d+'" href="javascript:void(0)">← Previous</a>\n <a class="'+a+'" href="javascript:void(0)">Next →</a>\n </span>\n </div>\n </div>'},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(2),h=(o=s)&&o.__esModule?o:{default:o};var r=function(){function t(e,i,o,n,s,h){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.node=e,this.document=h,this.window=s,this.options=i,this.overlay=n,this.popover=o,this.highlightFinished=!1}return n(t,[{key:"getScreenCoordinates",value:function(){var t=this.node,e=this.document.documentElement.offsetLeft,i=this.document.documentElement.offsetTop;if(t.offsetParent)do{e+=t.offsetLeft,i+=t.offsetTop}while(t=t.offsetParent);return{x:e,y:i}}},{key:"isInView",value:function(){for(var t=this.node.offsetTop,e=this.node.offsetLeft,i=this.node.offsetWidth,o=this.node.offsetHeight,n=this.node;n.offsetParent;)t+=(n=n.offsetParent).offsetTop,e+=n.offsetLeft;return t>=this.window.pageYOffset&&e>=this.window.pageXOffset&&t+o<=this.window.pageYOffset+this.window.innerHeight&&e+i<=this.window.pageXOffset+this.window.innerWidth}},{key:"bringInView",value:function(){if(!this.isInView()){var t=this.node.getBoundingClientRect().top+this.window.pageYOffset-this.window.innerHeight/2;this.window.scrollTo(0,t)}}},{key:"getCalculatedPosition",value:function(){var t=this.getScreenCoordinates(),e=new h.default({left:Number.MAX_VALUE,top:Number.MAX_VALUE,right:0,bottom:0});return"number"==typeof t.x&&"number"==typeof t.y&&(this.node.offsetWidth>0||this.node.offsetHeight>0)&&(e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.right=Math.max(e.right,t.x+this.node.offsetWidth),e.bottom=Math.max(e.bottom,t.y+this.node.offsetHeight)),e}},{key:"onDeselected",value:function(){this.hidePopover(),this.highlightFinished=!1,this.options.onDeselected&&this.options.onDeselected(this)}},{key:"onHighlightStarted",value:function(){this.showPopover(),this.highlightFinished=!1,this.options.onHighlightStarted&&this.options.onHighlightStarted(this)}},{key:"onHighlighted",value:function(){this.showPopover(),this.highlightFinished=!0;var t=this.overlay.getLastHighlightedElement(),e=this.popover;this.node!==(t&&t.node)&&(e&&!e.isInView()&&e.bringInView(),this.isInView()||this.bringInView()),this.options.onHighlighted&&this.options.onHighlighted(this)}},{key:"getNode",value:function(){return this.node}},{key:"hidePopover",value:function(){this.popover&&this.popover.hide()}},{key:"showPopover",value:function(){if(this.popover){var t=this.getCalculatedPosition();this.popover.show(t)}}},{key:"getFullPageSize",value:function(){var t=this.document.body,e=this.document.documentElement;return{height:Math.max(t.scrollHeight,t.offsetHeight,e.scrollHeight,e.offsetHeight),width:Math.max(t.scrollWidth,t.offsetWidth,e.scrollWidth,e.offsetWidth)}}}]),t}();e.default=r},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}();var n=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.left,o=void 0===i?0:i,n=e.top,s=void 0===n?0:n,h=e.right,r=void 0===h?0:h,l=e.bottom,a=void 0===l?0:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.left=o,this.right=r,this.top=s,this.bottom=a}return o(t,[{key:"canHighlight",value:function(){return this.left<this.right&&this.top<this.bottom}},{key:"equals",value:function(t){return Math.round(this.left)===Math.round(t.left)&&Math.round(this.right)===Math.round(t.right)&&Math.round(this.top)===Math.round(t.top)&&Math.round(this.bottom)===Math.round(t.bottom)}}]),t}();e.default=n},function(t,e){},function(t,e,i){"use strict";!function(){for(var t=0,e=["ms","moz","webkit","o"],i=0;i<e.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var i=(new Date).getTime(),o=Math.max(0,16-(i-t)),n=window.setTimeout(function(){e(i+o)},o);return t=i+o,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(1),h=(o=s)&&o.__esModule?o:{default:o},r=i(0);var l=function(t){function e(t,i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(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}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.options=Object.assign({isFirst:!0,isLast:!0,totalCount:1,currentIndex:0,showButtons:!0,closeBtnText:"Close",doneBtnText:"Done",startBtnText:"Next →",nextBtnText:"Next →",prevBtnText:"← Previous"},t),n.window=i,n.document=o,n.makeNode(),n.hide(),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,h.default),n(e,[{key:"makeNode",value:function(){var t=this.document.getElementById(r.ID_POPOVER);t||(t=e.createFromString(r.POPOVER_HTML),document.body.appendChild(t)),this.node=t,this.tipNode=t.querySelector("."+r.CLASS_POPOVER_TIP),this.titleNode=t.querySelector("."+r.CLASS_POPOVER_TITLE),this.descriptionNode=t.querySelector("."+r.CLASS_POPOVER_DESCRIPTION),this.footerNode=t.querySelector("."+r.CLASS_POPOVER_FOOTER),this.nextBtnNode=t.querySelector("."+r.CLASS_NEXT_STEP_BTN),this.prevBtnNode=t.querySelector("."+r.CLASS_PREV_STEP_BTN),this.closeBtnNode=t.querySelector("."+r.CLASS_CLOSE_BTN)}},{key:"getSize",value:function(){return{height:Math.max(this.node.scrollHeight,this.node.offsetHeight),width:Math.max(this.node.scrollWidth,this.node.offsetWidth)}}},{key:"hide",value:function(){this.node.style.display="none"}},{key:"reset",value:function(){this.node.style.display="block",this.node.style.left="0",this.node.style.top="0",this.node.style.bottom="",this.node.style.right="",this.node.querySelector("."+r.CLASS_POPOVER_TIP).className=r.CLASS_POPOVER_TIP}},{key:"show",value:function(t){switch(this.reset(),this.titleNode.innerHTML=this.options.title,this.descriptionNode.innerHTML=this.options.description,this.renderButtons(),this.options.position){case"left":this.positionOnLeft(t);break;case"right":this.positionOnRight(t);break;case"top":this.positionOnTop(t);break;case"bottom":this.positionOnBottom(t);break;case"auto":default:this.autoPosition(t)}}},{key:"renderButtons",value:function(){this.nextBtnNode.innerHTML=this.options.nextBtnText,this.prevBtnNode.innerHTML=this.options.prevBtnText,this.closeBtnNode.innerHTML=this.options.closeBtnText,this.options.showButtons&&this.options.totalCount&&1!==this.options.totalCount?(this.footerNode.style.display="block",this.options.isFirst?(this.prevBtnNode.classList.add(r.CLASS_BTN_DISABLED),this.nextBtnNode.innerHTML=this.options.startBtnText):this.prevBtnNode.classList.remove(r.CLASS_BTN_DISABLED),this.options.isLast?this.nextBtnNode.innerHTML=this.options.doneBtnText:this.nextBtnNode.innerHTML=this.options.nextBtnText):this.footerNode.style.display="none"}},{key:"positionOnLeft",value:function(t){var e=this.getSize().width,i=this.options.padding+10;this.node.style.left=t.left-e-i+"px",this.node.style.top=t.top-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("right")}},{key:"positionOnRight",value:function(t){var e=this.options.padding+10;this.node.style.left=t.right+e+"px",this.node.style.top=t.top-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("left")}},{key:"positionOnTop",value:function(t){var e=this.getSize().height,i=this.options.padding+10;this.node.style.top=t.top-e-i+"px",this.node.style.left=t.left-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("bottom")}},{key:"positionOnBottom",value:function(t){var e=this.options.padding+10;this.node.style.top=t.bottom+e+"px",this.node.style.left=t.left-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("top")}},{key:"autoPosition",value:function(t){var e=this.getFullPageSize(),i=this.getSize(),o=e.height,n=i.height,s=this.options.padding+10;t.bottom+n+s>=o?this.positionOnTop(t):this.positionOnBottom(t)}}],[{key:"createFromString",value:function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}}]),e}();e.default=l},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(2),h=(o=s)&&o.__esModule?o:{default:o},r=i(0);var l=function(){function t(e,i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.overlayAlpha=0,this.positionToHighlight=new h.default({}),this.highlightedPosition=new h.default({}),this.redrawAnimation=null,this.highlightedElement=null,this.lastHighlightedElement=null,this.draw=this.draw.bind(this),this.window=i,this.document=o,this.resetOverlay(),this.setSize()}return n(t,[{key:"resetOverlay",value:function(){var t=this.document.getElementById(r.ID_OVERLAY);t&&t.parentNode&&t.parentNode.removeChild(t);var e=this.document.createElement("canvas");this.overlay=e,this.context=e.getContext("2d"),this.overlay.id=r.ID_OVERLAY,this.overlay.style.pointerEvents="none",this.overlay.style.background="transparent",this.overlay.style.position="fixed",this.overlay.style.top="0",this.overlay.style.left="0",this.overlay.style.zIndex=r.OVERLAY_ZINDEX}},{key:"highlight",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t&&t.node){t.onHighlightStarted(),this.highlightedElement&&this.highlightedElement.onDeselected();var i=t.getCalculatedPosition();i.canHighlight()&&(this.lastHighlightedElement=this.highlightedElement,this.highlightedElement=t,this.positionToHighlight=i,this.options.animate&&e||(this.highlightedPosition=this.positionToHighlight),this.draw())}else console.warn("Invalid element to highlight. Must be an instance of `Element`")}},{key:"getHighlightedElement",value:function(){return this.highlightedElement}},{key:"getLastHighlightedElement",value:function(){return this.lastHighlightedElement}},{key:"clear",value:function(){this.positionToHighlight=new h.default,this.highlightedElement&&this.highlightedElement.onDeselected(),this.highlightedElement=null,this.lastHighlightedElement=null,this.draw()}},{key:"draw",value:function(){var t=this.positionToHighlight.canHighlight();this.removeCloak(),this.addCloak();var e=this.overlayAlpha<.1;t&&(e?this.highlightedPosition=this.positionToHighlight:(this.highlightedPosition.left+=.18*(this.positionToHighlight.left-this.highlightedPosition.left),this.highlightedPosition.top+=.18*(this.positionToHighlight.top-this.highlightedPosition.top),this.highlightedPosition.right+=.18*(this.positionToHighlight.right-this.highlightedPosition.right),this.highlightedPosition.bottom+=.18*(this.positionToHighlight.bottom-this.highlightedPosition.bottom))),this.removeCloak({posX:this.highlightedPosition.left-this.window.scrollX-this.options.padding,posY:this.highlightedPosition.top-this.window.scrollY-this.options.padding,width:this.highlightedPosition.right-this.highlightedPosition.left+2*this.options.padding,height:this.highlightedPosition.bottom-this.highlightedPosition.top+2*this.options.padding}),t?this.options.animate?this.overlayAlpha+=.08*(this.options.opacity-this.overlayAlpha):this.overlayAlpha=this.options.opacity:this.overlayAlpha=Math.max(.85*this.overlayAlpha-.02,0),this.window.cancelAnimationFrame(this.redrawAnimation),t||this.overlayAlpha>0?(this.overlay.parentNode||this.document.body.appendChild(this.overlay),this.hasPositionHighlighted()?!this.options.animate&&e?this.redrawAnimation=this.window.requestAnimationFrame(this.draw):this.highlightedElement.onHighlighted():this.redrawAnimation=this.window.requestAnimationFrame(this.draw)):this.overlay.parentNode&&this.document.body.removeChild(this.overlay)}},{key:"hasPositionHighlighted",value:function(){return this.positionToHighlight.equals(this.highlightedPosition)&&this.overlayAlpha>this.options.opacity-.05}},{key:"removeCloak",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.posX,i=void 0===e?0:e,o=t.posY,n=void 0===o?0:o,s=t.width,h=void 0===s?this.overlay.width:s,r=t.height,l=void 0===r?this.overlay.height:r;this.context.clearRect(i,n,h,l)}},{key:"addCloak",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.posX,i=void 0===e?0:e,o=t.posY,n=void 0===o?0:o,s=t.width,h=void 0===s?this.overlay.width:s,r=t.height,l=void 0===r?this.overlay.height:r;this.context.fillStyle="rgba( 0, 0, 0, "+this.overlayAlpha+" )",this.context.fillRect(i,n,h,l)}},{key:"setSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.overlay.width=t||this.window.innerWidth,this.overlay.height=e||this.window.innerHeight}},{key:"refresh",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setSize(),this.highlightedElement&&(this.window.cancelAnimationFrame(this.redrawAnimation),this.highlight(this.highlightedElement,t),this.highlightedElement.onHighlighted())}}]),t}();e.default=l},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),n=l(i(6)),s=l(i(1)),h=l(i(5));i(4);var r=i(0);function l(t){return t&&t.__esModule?t:{default:t}}var a=function(){function t(){var e=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,t),this.options=Object.assign({animate:r.OVERLAY_ANIMATE,opacity:r.OVERLAY_OPACITY,padding:r.OVERLAY_PADDING,onHighlightStarted:function(){},onHighlighted:function(){},onDeselected:function(){}},e),this.document=document,this.window=window,this.isActivated=!1,this.overlay=new n.default(this.options,this.window,this.document),this.steps=[],this.currentStep=0,this.onScroll=this.onScroll.bind(this),this.onResize=this.onResize.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onClick=this.onClick.bind(this),this.bind()}return o(t,[{key:"bind",value:function(){this.document.addEventListener("scroll",this.onScroll,!1),this.document.addEventListener("DOMMouseScroll",this.onScroll,!1),this.window.addEventListener("resize",this.onResize,!1),this.window.addEventListener("keyup",this.onKeyUp,!1),this.window.addEventListener("click",this.onClick,!1)}},{key:"onClick",value:function(t){if(this.hasHighlightedElement()&&this.isActivated){var e=this.overlay.getHighlightedElement(),i=this.document.getElementById(r.ID_POPOVER),o=e.node.contains(t.target),n=i&&i.contains(t.target);if(o||n){var s=t.target.classList.contains(r.CLASS_NEXT_STEP_BTN),h=t.target.classList.contains(r.CLASS_PREV_STEP_BTN);t.target.classList.contains(r.CLASS_CLOSE_BTN)?this.reset():s?this.moveNext():h&&this.movePrevious()}else this.reset()}}},{key:"movePrevious",value:function(){this.currentStep-=1,this.steps[this.currentStep]?this.overlay.highlight(this.steps[this.currentStep]):this.reset()}},{key:"moveNext",value:function(){this.currentStep+=1,this.steps[this.currentStep]?this.overlay.highlight(this.steps[this.currentStep]):this.reset()}},{key:"hasNextStep",value:function(){return!!this.steps[this.currentStep+1]}},{key:"hasPreviousStep",value:function(){return!!this.steps[this.currentStep-1]}},{key:"reset",value:function(){this.currentStep=0,this.isActivated=!1,this.overlay.clear()}},{key:"hasHighlightedElement",value:function(){var t=this.overlay.getHighlightedElement();return t&&t.node&&t.highlightFinished}},{key:"getHighlightedElement",value:function(){return this.overlay.getHighlightedElement()}},{key:"getLastHighlightedElement",value:function(){return this.overlay.getLastHighlightedElement()}},{key:"onScroll",value:function(){this.isActivated&&this.overlay.refresh(!1)}},{key:"onResize",value:function(){this.isActivated&&this.overlay.refresh(!0)}},{key:"onKeyUp",value:function(t){this.isActivated&&(t.keyCode===r.ESC_KEY_CODE?this.reset():t.keyCode===r.RIGHT_KEY_CODE?this.moveNext():t.keyCode===r.LEFT_KEY_CODE&&this.movePrevious())}},{key:"defineSteps",value:function(t){var e=this;this.steps=[],t.forEach(function(i,o){if(!i.element||"string"!=typeof i.element)throw new Error("Element (query selector string) missing in step "+o);var n=e.prepareElementFromStep(i,t,o);n&&e.steps.push(n)})}},{key:"prepareElementFromStep",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o="",n={};"string"==typeof t?o=t:(o=t.element,n=Object.assign({},this.options,t));var r=this.document.querySelector(o);if(!r)return console.warn("Element to highlight "+o+" not found"),null;var l=null;if(n.popover&&n.popover.description){var a=Object.assign({},this.options,n.popover,{totalCount:e.length,currentIndex:i,isFirst:0===i,isLast:i===e.length-1});l=new h.default(a,this.window,this.document)}return new s.default(r,n,l,this.overlay,this.window,this.document)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.steps||0===this.steps.length)throw new Error("There are no steps defined to iterate");this.isActivated=!0,this.currentStep=t,this.overlay.highlight(this.steps[t])}},{key:"highlight",value:function(t){this.isActivated=!0;var e=this.prepareElementFromStep(t);e&&this.overlay.highlight(e)}}]),t}();e.default=a},function(t,e,i){i(7),t.exports=i(3)}])});
|
2 |
//# sourceMappingURL=driver.min.js.map
|
|
|
1 |
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Driver=e():t.Driver=e()}(window,function(){return function(t){var e={};function i(o){if(e[o])return e[o].exports;var n=e[o]={i:o,l:!1,exports:{}};return t[o].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,o){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s=8)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.OVERLAY_OPACITY=.75,e.OVERLAY_PADDING=10,e.OVERLAY_ANIMATE=!0,e.OVERLAY_ZINDEX="999999999",e.ESC_KEY_CODE=27,e.LEFT_KEY_CODE=37,e.RIGHT_KEY_CODE=39,e.ID_OVERLAY="driver-canvas-overlay";var o=e.ID_POPOVER="driver-popover-item",n=e.CLASS_POPOVER_TIP="driver-popover-tip",s=e.CLASS_POPOVER_TITLE="driver-popover-title",h=e.CLASS_POPOVER_DESCRIPTION="driver-popover-description",r=e.CLASS_POPOVER_FOOTER="driver-popover-footer",l=e.CLASS_CLOSE_BTN="driver-close-btn",a=e.CLASS_NEXT_STEP_BTN="driver-next-btn",d=e.CLASS_PREV_STEP_BTN="driver-prev-btn";e.CLASS_BTN_DISABLED="driver-disabled",e.POPOVER_HTML='\n <div id="'+o+'">\n <div class="'+n+'"></div>\n <div class="'+s+'">Popover Title</div>\n <div class="'+h+'">Popover Description</div>\n <div class="'+r+'">\n <a href="javascript:void(0)" class="'+l+'">Close</a>\n <span class="driver-btn-group">\n <a class="'+d+'" href="javascript:void(0)">← Previous</a>\n <a class="'+a+'" href="javascript:void(0)">Next →</a>\n </span>\n </div>\n </div>'},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(2),h=(o=s)&&o.__esModule?o:{default:o};var r=function(){function t(e,i,o,n,s,h){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.node=e,this.document=h,this.window=s,this.options=i,this.overlay=n,this.popover=o,this.highlightFinished=!1}return n(t,[{key:"getScreenCoordinates",value:function(){var t=this.node,e=this.document.documentElement.offsetLeft,i=this.document.documentElement.offsetTop;if(t.offsetParent)do{e+=t.offsetLeft,i+=t.offsetTop}while(t=t.offsetParent);return{x:e,y:i}}},{key:"isInView",value:function(){for(var t=this.node.offsetTop,e=this.node.offsetLeft,i=this.node.offsetWidth,o=this.node.offsetHeight,n=this.node;n.offsetParent;)t+=(n=n.offsetParent).offsetTop,e+=n.offsetLeft;return t>=this.window.pageYOffset&&e>=this.window.pageXOffset&&t+o<=this.window.pageYOffset+this.window.innerHeight&&e+i<=this.window.pageXOffset+this.window.innerWidth}},{key:"bringInView",value:function(){if(!this.isInView()){var t=this.node.getBoundingClientRect().top+this.window.pageYOffset-this.window.innerHeight/2;this.window.scrollTo(0,t)}}},{key:"getCalculatedPosition",value:function(){var t=this.getScreenCoordinates(),e=new h.default({left:Number.MAX_VALUE,top:Number.MAX_VALUE,right:0,bottom:0});return"number"==typeof t.x&&"number"==typeof t.y&&(this.node.offsetWidth>0||this.node.offsetHeight>0)&&(e.left=Math.min(e.left,t.x),e.top=Math.min(e.top,t.y),e.right=Math.max(e.right,t.x+this.node.offsetWidth),e.bottom=Math.max(e.bottom,t.y+this.node.offsetHeight)),e}},{key:"onDeselected",value:function(){this.hidePopover(),this.highlightFinished=!1,this.options.onDeselected&&this.options.onDeselected(this)}},{key:"onHighlightStarted",value:function(){this.showPopover(),this.highlightFinished=!1,this.options.onHighlightStarted&&this.options.onHighlightStarted(this)}},{key:"onHighlighted",value:function(){this.showPopover(),this.highlightFinished=!0;var t=this.overlay.getLastHighlightedElement(),e=this.popover;this.node!==(t&&t.node)&&(e&&!e.isInView()&&e.bringInView(),this.isInView()||this.bringInView()),this.options.onHighlighted&&this.options.onHighlighted(this)}},{key:"getNode",value:function(){return this.node}},{key:"hidePopover",value:function(){this.popover&&this.popover.hide()}},{key:"showPopover",value:function(){if(this.popover){var t=this.getCalculatedPosition();this.popover.show(t)}}},{key:"getFullPageSize",value:function(){var t=this.document.body,e=this.document.documentElement;return{height:Math.max(t.scrollHeight,t.offsetHeight,e.scrollHeight,e.offsetHeight),width:Math.max(t.scrollWidth,t.offsetWidth,e.scrollWidth,e.offsetWidth)}}}]),t}();e.default=r,t.exports=e.default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}();var n=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.left,o=void 0===i?0:i,n=e.top,s=void 0===n?0:n,h=e.right,r=void 0===h?0:h,l=e.bottom,a=void 0===l?0:l;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.left=o,this.right=r,this.top=s,this.bottom=a}return o(t,[{key:"canHighlight",value:function(){return this.left<this.right&&this.top<this.bottom}},{key:"equals",value:function(t){return Math.round(this.left)===Math.round(t.left)&&Math.round(this.right)===Math.round(t.right)&&Math.round(this.top)===Math.round(t.top)&&Math.round(this.bottom)===Math.round(t.bottom)}}]),t}();e.default=n,t.exports=e.default},function(t,e,i){"use strict";!function(){for(var t=0,e=["ms","moz","webkit","o"],i=0;i<e.length&&!window.requestAnimationFrame;++i)window.requestAnimationFrame=window[e[i]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[i]+"CancelAnimationFrame"]||window[e[i]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e){var i=(new Date).getTime(),o=Math.max(0,16-(i-t)),n=window.setTimeout(function(){e(i+o)},o);return t=i+o,n}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(t){clearTimeout(t)})}()},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(1),h=(o=s)&&o.__esModule?o:{default:o},r=i(0);var l=function(t){function e(t,i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var n=function(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}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return n.options=Object.assign({isFirst:!0,isLast:!0,totalCount:1,currentIndex:0,showButtons:!0,closeBtnText:"Close",doneBtnText:"Done",startBtnText:"Next →",nextBtnText:"Next →",prevBtnText:"← Previous"},t),n.window=i,n.document=o,n.makeNode(),n.hide(),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,h.default),n(e,[{key:"makeNode",value:function(){var t=this.document.getElementById(r.ID_POPOVER);t||(t=e.createFromString(r.POPOVER_HTML),document.body.appendChild(t)),this.node=t,this.tipNode=t.querySelector("."+r.CLASS_POPOVER_TIP),this.titleNode=t.querySelector("."+r.CLASS_POPOVER_TITLE),this.descriptionNode=t.querySelector("."+r.CLASS_POPOVER_DESCRIPTION),this.footerNode=t.querySelector("."+r.CLASS_POPOVER_FOOTER),this.nextBtnNode=t.querySelector("."+r.CLASS_NEXT_STEP_BTN),this.prevBtnNode=t.querySelector("."+r.CLASS_PREV_STEP_BTN),this.closeBtnNode=t.querySelector("."+r.CLASS_CLOSE_BTN)}},{key:"getSize",value:function(){return{height:Math.max(this.node.scrollHeight,this.node.offsetHeight),width:Math.max(this.node.scrollWidth,this.node.offsetWidth)}}},{key:"hide",value:function(){this.node.style.display="none"}},{key:"reset",value:function(){this.node.style.display="block",this.node.style.left="0",this.node.style.top="0",this.node.style.bottom="",this.node.style.right="",this.node.querySelector("."+r.CLASS_POPOVER_TIP).className=r.CLASS_POPOVER_TIP}},{key:"show",value:function(t){switch(this.reset(),this.titleNode.innerHTML=this.options.title,this.descriptionNode.innerHTML=this.options.description,this.renderButtons(),this.options.position){case"left":this.positionOnLeft(t);break;case"right":this.positionOnRight(t);break;case"top":this.positionOnTop(t);break;case"bottom":this.positionOnBottom(t);break;case"auto":default:this.autoPosition(t)}}},{key:"renderButtons",value:function(){this.nextBtnNode.innerHTML=this.options.nextBtnText,this.prevBtnNode.innerHTML=this.options.prevBtnText,this.closeBtnNode.innerHTML=this.options.closeBtnText,this.options.showButtons&&this.options.totalCount&&1!==this.options.totalCount?(this.footerNode.style.display="block",this.options.isFirst?(this.prevBtnNode.classList.add(r.CLASS_BTN_DISABLED),this.nextBtnNode.innerHTML=this.options.startBtnText):this.prevBtnNode.classList.remove(r.CLASS_BTN_DISABLED),this.options.isLast?this.nextBtnNode.innerHTML=this.options.doneBtnText:this.nextBtnNode.innerHTML=this.options.nextBtnText):this.footerNode.style.display="none"}},{key:"positionOnLeft",value:function(t){var e=this.getSize().width,i=this.options.padding+10;this.node.style.left=t.left-e-i+"px",this.node.style.top=t.top-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("right")}},{key:"positionOnRight",value:function(t){var e=this.options.padding+10;this.node.style.left=t.right+e+"px",this.node.style.top=t.top-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("left")}},{key:"positionOnTop",value:function(t){var e=this.getSize().height,i=this.options.padding+10;this.node.style.top=t.top-e-i+"px",this.node.style.left=t.left-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("bottom")}},{key:"positionOnBottom",value:function(t){var e=this.options.padding+10;this.node.style.top=t.bottom+e+"px",this.node.style.left=t.left-this.options.padding+"px",this.node.style.right="",this.node.style.bottom="",this.tipNode.classList.add("top")}},{key:"autoPosition",value:function(t){var e=this.getFullPageSize(),i=this.getSize(),o=e.height,n=i.height,s=this.options.padding+10;t.bottom+n+s>=o?this.positionOnTop(t):this.positionOnBottom(t)}}],[{key:"createFromString",value:function(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}}]),e}();e.default=l,t.exports=e.default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o,n=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),s=i(2),h=(o=s)&&o.__esModule?o:{default:o},r=i(0);var l=function(){function t(e,i,o){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=e,this.overlayAlpha=0,this.positionToHighlight=new h.default({}),this.highlightedPosition=new h.default({}),this.redrawAnimation=null,this.highlightedElement=null,this.lastHighlightedElement=null,this.draw=this.draw.bind(this),this.window=i,this.document=o,this.resetOverlay(),this.setSize()}return n(t,[{key:"resetOverlay",value:function(){var t=this.document.getElementById(r.ID_OVERLAY);t&&t.parentNode&&t.parentNode.removeChild(t);var e=this.document.createElement("canvas");this.overlay=e,this.context=e.getContext("2d"),this.overlay.id=r.ID_OVERLAY,this.overlay.style.pointerEvents="none",this.overlay.style.background="transparent",this.overlay.style.position="fixed",this.overlay.style.top="0",this.overlay.style.left="0",this.overlay.style.zIndex=r.OVERLAY_ZINDEX}},{key:"highlight",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t&&t.node){t.onHighlightStarted(),this.highlightedElement&&this.highlightedElement.onDeselected();var i=t.getCalculatedPosition();i.canHighlight()&&(this.lastHighlightedElement=this.highlightedElement,this.highlightedElement=t,this.positionToHighlight=i,this.options.animate&&e||(this.highlightedPosition=this.positionToHighlight),this.draw())}else console.warn("Invalid element to highlight. Must be an instance of `Element`")}},{key:"getHighlightedElement",value:function(){return this.highlightedElement}},{key:"getLastHighlightedElement",value:function(){return this.lastHighlightedElement}},{key:"clear",value:function(){this.positionToHighlight=new h.default,this.highlightedElement&&this.highlightedElement.onDeselected(),this.highlightedElement=null,this.lastHighlightedElement=null,this.draw()}},{key:"draw",value:function(){var t=this.positionToHighlight.canHighlight();this.removeCloak(),this.addCloak();var e=this.overlayAlpha<.1;t&&(e?this.highlightedPosition=this.positionToHighlight:(this.highlightedPosition.left+=.18*(this.positionToHighlight.left-this.highlightedPosition.left),this.highlightedPosition.top+=.18*(this.positionToHighlight.top-this.highlightedPosition.top),this.highlightedPosition.right+=.18*(this.positionToHighlight.right-this.highlightedPosition.right),this.highlightedPosition.bottom+=.18*(this.positionToHighlight.bottom-this.highlightedPosition.bottom))),this.removeCloak({posX:this.highlightedPosition.left-this.window.scrollX-this.options.padding,posY:this.highlightedPosition.top-this.window.scrollY-this.options.padding,width:this.highlightedPosition.right-this.highlightedPosition.left+2*this.options.padding,height:this.highlightedPosition.bottom-this.highlightedPosition.top+2*this.options.padding}),t?this.options.animate?this.overlayAlpha+=.08*(this.options.opacity-this.overlayAlpha):this.overlayAlpha=this.options.opacity:this.overlayAlpha=Math.max(.85*this.overlayAlpha-.02,0),this.window.cancelAnimationFrame(this.redrawAnimation),t||this.overlayAlpha>0?(this.overlay.parentNode||this.document.body.appendChild(this.overlay),this.hasPositionHighlighted()?!this.options.animate&&e?this.redrawAnimation=this.window.requestAnimationFrame(this.draw):this.highlightedElement.onHighlighted():this.redrawAnimation=this.window.requestAnimationFrame(this.draw)):this.overlay.parentNode&&this.document.body.removeChild(this.overlay)}},{key:"hasPositionHighlighted",value:function(){return this.positionToHighlight.equals(this.highlightedPosition)&&this.overlayAlpha>this.options.opacity-.05}},{key:"removeCloak",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.posX,i=void 0===e?0:e,o=t.posY,n=void 0===o?0:o,s=t.width,h=void 0===s?this.overlay.width:s,r=t.height,l=void 0===r?this.overlay.height:r;this.context.clearRect(i,n,h,l)}},{key:"addCloak",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.posX,i=void 0===e?0:e,o=t.posY,n=void 0===o?0:o,s=t.width,h=void 0===s?this.overlay.width:s,r=t.height,l=void 0===r?this.overlay.height:r;this.context.fillStyle="rgba( 0, 0, 0, "+this.overlayAlpha+" )",this.context.fillRect(i,n,h,l)}},{key:"setSize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.overlay.width=t||this.window.innerWidth,this.overlay.height=e||this.window.innerHeight}},{key:"refresh",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this.setSize(),this.highlightedElement&&(this.window.cancelAnimationFrame(this.redrawAnimation),this.highlight(this.highlightedElement,t),this.highlightedElement.onHighlighted())}}]),t}();e.default=l,t.exports=e.default},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(t,e){for(var i=0;i<e.length;i++){var o=e[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,i,o){return i&&t(e.prototype,i),o&&t(e,o),e}}(),n=l(i(5)),s=l(i(1)),h=l(i(4));i(3);var r=i(0);function l(t){return t&&t.__esModule?t:{default:t}}var a=function(){function t(){var e=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,t),this.options=Object.assign({animate:r.OVERLAY_ANIMATE,opacity:r.OVERLAY_OPACITY,padding:r.OVERLAY_PADDING,onHighlightStarted:function(){},onHighlighted:function(){},onDeselected:function(){}},e),this.document=document,this.window=window,this.isActivated=!1,this.overlay=new n.default(this.options,this.window,this.document),this.steps=[],this.currentStep=0,this.onScroll=this.onScroll.bind(this),this.onResize=this.onResize.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onClick=this.onClick.bind(this),this.bind()}return o(t,[{key:"bind",value:function(){this.document.addEventListener("scroll",this.onScroll,!1),this.document.addEventListener("DOMMouseScroll",this.onScroll,!1),this.window.addEventListener("resize",this.onResize,!1),this.window.addEventListener("keyup",this.onKeyUp,!1),this.window.addEventListener("click",this.onClick,!1)}},{key:"onClick",value:function(t){if(this.hasHighlightedElement()&&this.isActivated){var e=this.overlay.getHighlightedElement(),i=this.document.getElementById(r.ID_POPOVER),o=e.node.contains(t.target),n=i&&i.contains(t.target);if(o||n){var s=t.target.classList.contains(r.CLASS_NEXT_STEP_BTN),h=t.target.classList.contains(r.CLASS_PREV_STEP_BTN);t.target.classList.contains(r.CLASS_CLOSE_BTN)?this.reset():s?this.moveNext():h&&this.movePrevious()}else this.reset()}}},{key:"movePrevious",value:function(){this.currentStep-=1,this.steps[this.currentStep]?this.overlay.highlight(this.steps[this.currentStep]):this.reset()}},{key:"moveNext",value:function(){this.currentStep+=1,this.steps[this.currentStep]?this.overlay.highlight(this.steps[this.currentStep]):this.reset()}},{key:"hasNextStep",value:function(){return!!this.steps[this.currentStep+1]}},{key:"hasPreviousStep",value:function(){return!!this.steps[this.currentStep-1]}},{key:"reset",value:function(){this.currentStep=0,this.isActivated=!1,this.overlay.clear()}},{key:"hasHighlightedElement",value:function(){var t=this.overlay.getHighlightedElement();return t&&t.node&&t.highlightFinished}},{key:"getHighlightedElement",value:function(){return this.overlay.getHighlightedElement()}},{key:"getLastHighlightedElement",value:function(){return this.overlay.getLastHighlightedElement()}},{key:"onScroll",value:function(){this.isActivated&&this.overlay.refresh(!1)}},{key:"onResize",value:function(){this.isActivated&&this.overlay.refresh(!0)}},{key:"onKeyUp",value:function(t){this.isActivated&&(t.keyCode===r.ESC_KEY_CODE?this.reset():t.keyCode===r.RIGHT_KEY_CODE?this.moveNext():t.keyCode===r.LEFT_KEY_CODE&&this.movePrevious())}},{key:"defineSteps",value:function(t){var e=this;this.steps=[],t.forEach(function(i,o){if(!i.element||"string"!=typeof i.element)throw new Error("Element (query selector string) missing in step "+o);var n=e.prepareElementFromStep(i,t,o);n&&e.steps.push(n)})}},{key:"prepareElementFromStep",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o="",n={};"string"==typeof t?o=t:(o=t.element,n=Object.assign({},this.options,t));var r=this.document.querySelector(o);if(!r)return console.warn("Element to highlight "+o+" not found"),null;var l=null;if(n.popover&&n.popover.description){var a=Object.assign({},this.options,n.popover,{totalCount:e.length,currentIndex:i,isFirst:0===i,isLast:i===e.length-1});l=new h.default(a,this.window,this.document)}return new s.default(r,n,l,this.overlay,this.window,this.document)}},{key:"start",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!this.steps||0===this.steps.length)throw new Error("There are no steps defined to iterate");this.isActivated=!0,this.currentStep=t,this.overlay.highlight(this.steps[t])}},{key:"highlight",value:function(t){this.isActivated=!0;var e=this.prepareElementFromStep(t);e&&this.overlay.highlight(e)}}]),t}();e.default=a,t.exports=e.default},function(t,e){},function(t,e,i){i(7),t.exports=i(6)}])});
|
2 |
//# sourceMappingURL=driver.min.js.map
|
types/.todo
ADDED
File without changes
|
webpack.config.prod.js
CHANGED
@@ -4,8 +4,8 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
4 |
module.exports = {
|
5 |
mode: 'production',
|
6 |
entry: [
|
7 |
-
'./src/index.js',
|
8 |
'./src/driver.scss',
|
|
|
9 |
],
|
10 |
output: {
|
11 |
path: path.join(__dirname, '/dist'),
|
@@ -32,6 +32,7 @@ module.exports = {
|
|
32 |
loader: 'babel-loader',
|
33 |
options: {
|
34 |
presets: ['env'],
|
|
|
35 |
},
|
36 |
},
|
37 |
{
|
@@ -39,7 +40,7 @@ module.exports = {
|
|
39 |
loader: ExtractTextPlugin.extract([
|
40 |
{
|
41 |
loader: 'css-loader',
|
42 |
-
options: { minimize: true },
|
43 |
},
|
44 |
'sass-loader',
|
45 |
]),
|
|
|
4 |
module.exports = {
|
5 |
mode: 'production',
|
6 |
entry: [
|
|
|
7 |
'./src/driver.scss',
|
8 |
+
'./src/index.js',
|
9 |
],
|
10 |
output: {
|
11 |
path: path.join(__dirname, '/dist'),
|
|
|
32 |
loader: 'babel-loader',
|
33 |
options: {
|
34 |
presets: ['env'],
|
35 |
+
plugins: ['babel-plugin-add-module-exports'],
|
36 |
},
|
37 |
},
|
38 |
{
|
|
|
40 |
loader: ExtractTextPlugin.extract([
|
41 |
{
|
42 |
loader: 'css-loader',
|
43 |
+
options: { minimize: true, url: false },
|
44 |
},
|
45 |
'sass-loader',
|
46 |
]),
|