diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 8162457..0000000 --- a/.editorconfig +++ /dev/null @@ -1,8 +0,0 @@ -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 4a2a051..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "airbnb-base", - "env": { - "browser": true - }, - "rules": { - "no-console": "off", - "no-underscore-dangle": "off", - "no-plusplus": "off", - "no-cond-assign": "off", - "func-names": "off", - "no-bitwise": "off", - "class-methods-use-this": "off", - "no-param-reassign": [ - "off" - ], - "max-len": "off", - "no-multi-spaces": "off" - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e1b67ac..0000000 --- a/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -npm-debug.log -.DS_Store -.idea -.vscode -package-lock.json -yarn-error.log \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index e779859..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -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. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -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. - -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. - -## Scope - -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. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at josh@joshuajohnson.co.uk. 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. - -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. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index e69de29..0000000 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index a0383ae..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2018 Kamran Ahmed - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/README.md b/README.md deleted file mode 100644 index d7fa6c3..0000000 --- a/README.md +++ /dev/null @@ -1,49 +0,0 @@ -
- Powerful yet light-weight, vanilla JavaScript engine to drive the user's focus across the page - Only ~4kb, no external dependency, supports all major browsers and highly customizable -
- -A light-weight, no-dependency, vanilla JavaScript library to drive the user's focus across the +
Light-weight, no-dependency, vanilla JavaScript engine to drive user's focus across + the page
- Quick Tour + + With Animation + Without Animation + + +@@ -53,8 +64,7 @@How does it do that?
Can you show some Examples?
-Below you find some of the examples and sample use-cases on how you can use it. Run by clicking the -
+RUN
button.Below you find some of the examples and sample use-cases on how you can use it.
Highlighting a Single Element – Without Popover
@@ -114,8 +124,8 @@Highlighting a Single Element – With Popover
-Popover Positioning
-You can also, change the position of the popover to be either
+left
,top
, -right
orbottom
.You can also, change the position of the popover to be either
Show Demoleft
,left-center
,left-bottom
,top
,top-center
,top-right
, +right
,right-center
,right-bottom
orbottom
,bottom-center
,bottom-right
,mid-center
.@@ -154,10 +167,32 @@const driver = new Driver(); driver.highlight({ @@ -123,7 +133,10 @@
Popover Positioning
popover: { title: 'Title for the Popover', description: 'Description for it', - position: 'left', // can be `top`, `left`, `right`, `bottom` + // position can be left, left-center, left-bottom, top, + // top-center, top-right, right, right-center, right-bottom, + // bottom, bottom-center, bottom-right, mid-center + position: 'left', } });HTML in Popovers
And of-course it can be any valid HTML.
+And of course it can be any valid HTML.
+++ +Disable Close on Outside Click
+By default, driver.js gets reset if user clicks outside the highlighted element, you can disable this:
+ Show Demo ++const driver = new Driver({ + allowClose: false, +}); +driver.highlight({ + element: '#some-element', + popover: { + title: '<em>An italicized title</em>', + description: 'Description may also contain <strong>HTML</strong>' + } +}); +
+ If you use this option, for multi-step driver, it would close after you are done with the popover or you can close it programmatically. For single element popover, you need to close it properly, otherwise it won't be closed +
+driver.reset()
+
+Creating Feature Introductions
You can also make powerful feature introductions to guide the users @@ -172,6 +207,7 @@
Creating Feature Introductions
{ element: '#first-element-introduction', popover: { + className: 'first-step-popover-class', title: 'Title on Popover', description: 'Body of the popover', position: 'left' @@ -237,29 +273,44 @@..and much much more
Driver Definition
Here are the options that Driver understands
const driver = new Driver({ + className: 'scoped-class', // className to wrap driver.js popover animate: true, // Animate while changing highlighted element opacity: 0.75, // Background opacity (0 means only popovers and without overlay) padding: 10, // Distance of element from around the edges + allowClose: true, // Whether clicking on overlay should close or not + overlayClickNext: false, // Should it move to next step on overlay click + doneBtnText: 'Done', // Text on the final button + closeBtnText: 'Close', // Text on the close button for this step + nextBtnText: 'Next', // Next button text for this step + prevBtnText: 'Previous', // Previous button text for this step + showButtons: false, // Do not show control buttons in footer + keyboardControl: true, // Allow controlling through keyboard (escape to close, arrow keys to move) + scrollIntoViewOptions: {}, // We use `scrollIntoView()` when possible, pass here the options for it if you want any onHighlightStarted: (Element) {}, // Called when element is about to be highlighted onHighlighted: (Element) {}, // Called when element is fully highlighted onDeselected: (Element) {}, // Called when element has been deselected + onReset: (Element) {}, // Called when overlay is about to be cleared + onNext: (Element) => {}, // Called when moving to next step on any step + onPrevious: (Element) => {}, // Called when moving to next step on any step });
Note that all the button options that you provide in the driver definition can be overridden for a + specific step by giving them in the step definition
Step Definition
Here are the set of options that you can pass in each step i.e. an item in array of steps or the object that you pass to
highlight
method@@ -279,10 +330,14 @@const stepDefinition = { - element: '#some-item', // Query selector for the item to be highlighted - popover: { // There will be no popover if empty or not given - title: 'Title', // Title on the popover + element: '#some-item', // Query selector string or Node to be highlighted + popover: { // There will be no popover if empty or not given + className: 'popover-class', // className to wrap this specific step popover in addition to the general className in Driver options + title: 'Title', // Title on the popover description: 'Description', // Body of the popover - showButtons: false, // Do not show control buttons in footer - doneBtnText: 'Done', // Text on the last button - closeBtnText: 'Close', // Text on the close button - nextBtnText: 'Next', // Next button text - prevBtnText: 'Previous', // Previous button text + showButtons: false, // Do not show control buttons in footer + closeBtnText: 'Close', // Text on the close button for this step + nextBtnText: 'Next', // Next button text for this step + prevBtnText: 'Previous', // Previous button text for this step } };
API Methods
driver.hasNextStep(); // Checks if there is next step to move to driver.hasPreviousStep(); // Checks if there is previous step to move to +// Prevents the current move. Useful in `onNext` or `onPrevious` if you want to +// perform some asynchronous task and manually move to next step +driver.preventMove(); + // Gets the currently highlighted element on screen const activeElement = driver.getHighlightedElement(); const lastActiveElement = driver.getLastHighlightedElement(); -activeElement.getScreenCoordinates(); // Gets screen co-ordinates of the active element +activeElement.getCalculatedPosition(); // Gets screen co-ordinates of the active element activeElement.hidePopover(); // Hide the popover activeElement.showPopover(); // Show the popover @@ -290,20 +345,20 @@API Methods
You can use a variety of options to achieve whatever you may want. I have some plans on improving - it further, make sure to keep an eye on the github + it further, make sure to keep an eye on the GitHub page
Contributing
You can find the contribution instructions on the github page. Feel free to submit an + target="_blank">GitHub page. Feel free to submit an issue, create a pull request or spread the word
A product by Kamran produced out of boredom and - frustration in cold Berlin after he gave up on trying to find a perfect solution to integrate journey introduction + frustration after he gave up on trying to find a perfect solution to integrate journey introduction and overlays.
Contributing - - - - - -