v-onboarding 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -255
- package/package.json +16 -8
- package/src/types/VOnboardingWrapper.ts +1 -10
- package/web-types/web-types.json +1 -1
- package/dist/style.css +0 -1
- package/dist/v-onboarding.es.js +0 -2279
- package/dist/v-onboarding.umd.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Fatih Solhan
|
|
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.
|
package/README.md
CHANGED
|
@@ -3,21 +3,14 @@
|
|
|
3
3
|
# v-onboarding
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
**v-onboarding** is a super-slim, fully-typed onboarding component for Vue 3
|
|
6
|
+
**v-onboarding** is a super-slim, fully-typed onboarding component for Vue 3
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
<a href="https://www.npmjs.com/package/v-onboarding"><img src="https://img.shields.io/npm/v/v-onboarding.svg?sanitize=true&style=flat-square" alt="Version"></a>
|
|
9
|
+
<a href="https://www.npmjs.com/package/v-onboarding"><img src="https://img.shields.io/npm/l/v-onboarding.svg?sanitize=true&style=flat-square" alt="License"></a>
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
[Installation](#installation) •
|
|
14
|
-
[Usage](#usage) •
|
|
15
|
-
[Props](#props) •
|
|
16
|
-
[Slots](#slots) •
|
|
17
|
-
[Exposed Methods](#exposed-methods)
|
|
18
|
-
<br />
|
|
19
|
-
<br />
|
|
20
|
-
[Demo](https://v-onboarding.fatihsolhan.com/)
|
|
11
|
+
### [Demo](https://v-onboarding.fatihsolhan.com/)
|
|
12
|
+
|
|
13
|
+
### [Documentation](https://v-onboarding-docs.fatihsolhan.com/)
|
|
21
14
|
</div>
|
|
22
15
|
|
|
23
16
|
## Installation<a name="installation"></a>
|
|
@@ -30,245 +23,3 @@ npm install v-onboarding
|
|
|
30
23
|
```sh
|
|
31
24
|
yarn add v-onboarding
|
|
32
25
|
```
|
|
33
|
-
## Usage<a name="usage"></a>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```vue
|
|
37
|
-
<template>
|
|
38
|
-
<VOnboardingWrapper ref="wrapper" :steps="steps" />
|
|
39
|
-
<div>
|
|
40
|
-
<button id="foo">Update</button>
|
|
41
|
-
</div>
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<script>
|
|
45
|
-
import { defineComponent, ref, onMounted } from 'vue'
|
|
46
|
-
import { VOnboardingWrapper, useVOnboarding } from 'v-onboarding'
|
|
47
|
-
import 'v-onboarding/dist/style.css'
|
|
48
|
-
export default defineComponent ({
|
|
49
|
-
components: {
|
|
50
|
-
VOnboardingWrapper
|
|
51
|
-
},
|
|
52
|
-
setup() {
|
|
53
|
-
const wrapper = ref(null)
|
|
54
|
-
const steps = [
|
|
55
|
-
{
|
|
56
|
-
attachTo: {
|
|
57
|
-
el: '#foo'
|
|
58
|
-
},
|
|
59
|
-
content: {
|
|
60
|
-
title: "Welcome!",
|
|
61
|
-
description: "You can use this button update your informations"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
const { start } = useVOnboarding(wrapper)
|
|
67
|
-
|
|
68
|
-
onMounted(() => {
|
|
69
|
-
start()
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
return {
|
|
73
|
-
wrapper,
|
|
74
|
-
steps
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
</script>
|
|
79
|
-
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
<br />
|
|
83
|
-
|
|
84
|
-
## useVOnboarding
|
|
85
|
-
#### This composition function returns the same methods explained in [Exposed Methods](#exposed-methods)
|
|
86
|
-
```vue
|
|
87
|
-
<template>
|
|
88
|
-
<VOnboardingWrapper ref="wrapper" />
|
|
89
|
-
</template>
|
|
90
|
-
|
|
91
|
-
<script>
|
|
92
|
-
import { defineComponent, ref } from 'vue'
|
|
93
|
-
import { VOnboardingWrapper, useVOnboarding } from 'v-onboarding'
|
|
94
|
-
export default defineComponent ({
|
|
95
|
-
components: {
|
|
96
|
-
VOnboardingWrapper
|
|
97
|
-
},
|
|
98
|
-
setup() {
|
|
99
|
-
const wrapper = ref(null)
|
|
100
|
-
const { start, finish, goToStep } = useVOnboarding(wrapper)
|
|
101
|
-
return {
|
|
102
|
-
wrapper
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
})
|
|
106
|
-
</script>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
<br />
|
|
110
|
-
|
|
111
|
-
## Props<a name="props"></a>
|
|
112
|
-
|
|
113
|
-
### steps<a name="prop-step"></a>
|
|
114
|
-
|
|
115
|
-
| Name | Type | Description |
|
|
116
|
-
| :-------- | :------- | :------------------------- |
|
|
117
|
-
| `steps` | [Step[]](#prop-step) | **Required**. Onboarding steps |
|
|
118
|
-
|
|
119
|
-
```js
|
|
120
|
-
[
|
|
121
|
-
{
|
|
122
|
-
attachTo: {
|
|
123
|
-
element: "#foo" // or () => document.querySelector("#foo")
|
|
124
|
-
classList: ["attached", "bar"] // optional. Default: []
|
|
125
|
-
},
|
|
126
|
-
content: { // optional
|
|
127
|
-
title: "..."
|
|
128
|
-
description: "" // optional
|
|
129
|
-
},
|
|
130
|
-
on: { // optional
|
|
131
|
-
beforeStep: function() {}, // optional (could be async)
|
|
132
|
-
afterStep: function() {} // optional (could be async)
|
|
133
|
-
},
|
|
134
|
-
options: {} // [Options](#options)
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### options<a name="prop-options"></a>
|
|
140
|
-
|
|
141
|
-
| Name | Type | Description | Default|
|
|
142
|
-
| :-------- | :------- | :------------------------- | :-------- |
|
|
143
|
-
| `options` | [Object](#prop-options) | **Optional**. Onboarding options | [Default Options](#prop-options-default) |
|
|
144
|
-
|
|
145
|
-
```js
|
|
146
|
-
{
|
|
147
|
-
popper: {} // PopperJS options: https://popper.js.org/docs/v2/constructors/#options,
|
|
148
|
-
disableOverlay: boolean,
|
|
149
|
-
scrollToStep: {
|
|
150
|
-
enabled: boolean,
|
|
151
|
-
options: {} // scrollIntoViewOptions: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Default Options<a name="prop-options-default"></a>
|
|
157
|
-
|
|
158
|
-
```js
|
|
159
|
-
{
|
|
160
|
-
popper: {
|
|
161
|
-
modifiers: [
|
|
162
|
-
{
|
|
163
|
-
name: "offset",
|
|
164
|
-
options: {
|
|
165
|
-
offset: [0, 10],
|
|
166
|
-
},
|
|
167
|
-
}
|
|
168
|
-
]
|
|
169
|
-
},
|
|
170
|
-
disableOverlay: false,
|
|
171
|
-
scrollToStep: {
|
|
172
|
-
enabled: true,
|
|
173
|
-
options: {
|
|
174
|
-
behavior: 'smooth',
|
|
175
|
-
block: 'center',
|
|
176
|
-
inline: 'center'
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
- Note that you can override these options in each step
|
|
183
|
-
|
|
184
|
-
<br />
|
|
185
|
-
|
|
186
|
-
## Slots<a name="slots"></a>
|
|
187
|
-
|
|
188
|
-
### default<a name="slots-default"></a>
|
|
189
|
-
|
|
190
|
-
```vue
|
|
191
|
-
<template>
|
|
192
|
-
<VOnboardingWrapper ref="wrapper" :steps="steps">
|
|
193
|
-
|
|
194
|
-
<template #default="{ previous, next, step, exit, isFirst, isLast, index }">
|
|
195
|
-
<VOnboardingStep>
|
|
196
|
-
<div class="flex flex-col p-5">
|
|
197
|
-
<div class="flex flex-col bg-white shadow-md p-4 rounded">
|
|
198
|
-
<h3 class="font-medium text-xl">{{ step.content.title }}</h3>
|
|
199
|
-
<p v-if="step.content.description" class="text-sm">{{ step.content.description }}</p>
|
|
200
|
-
<div class="flex items-center space-x-2 mt-4">
|
|
201
|
-
<button v-if="!isFirst" @click="prev" class="flex flex-1 items-center justify-center px-2 py-1 rounded-sm text-gray-600 border-2 border-gray-600 hover:text-white hover:bg-gray-600 duration-200">Previous</button>
|
|
202
|
-
<button @click="next" class="flex flex-1 items-center justify-center px-2 py-1 rounded-sm text-indigo-600 border-2 border-indigo-600 hover:text-white hover:bg-indigo-600 duration-200">{{ isLast ? 'Finish' : 'Next' }}</button>
|
|
203
|
-
</div>
|
|
204
|
-
</div>
|
|
205
|
-
</div>
|
|
206
|
-
</VOnboardingStep>
|
|
207
|
-
<template>
|
|
208
|
-
|
|
209
|
-
</VOnboardingWrapper>
|
|
210
|
-
</template>
|
|
211
|
-
<script>
|
|
212
|
-
import { defineComponent } from 'vue'
|
|
213
|
-
import { VOnboardingWrapper, VOnboardingStep } from 'v-onboarding'
|
|
214
|
-
import 'v-onboarding/dist/style.css'
|
|
215
|
-
export default defineComponent({
|
|
216
|
-
components: {
|
|
217
|
-
VOnboardingWrapper,
|
|
218
|
-
VOnboardingStep
|
|
219
|
-
},
|
|
220
|
-
setup() {
|
|
221
|
-
// ...
|
|
222
|
-
}
|
|
223
|
-
})
|
|
224
|
-
</script>
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
<br />
|
|
228
|
-
|
|
229
|
-
## Exposed Methods<a name="exposed-methods"></a>
|
|
230
|
-
|
|
231
|
-
These methods can be accessed through `component ref`
|
|
232
|
-
|
|
233
|
-
### Example
|
|
234
|
-
```vue
|
|
235
|
-
<template>
|
|
236
|
-
<VOnboardingWrapper ref="wrapper"/>
|
|
237
|
-
</template>
|
|
238
|
-
|
|
239
|
-
<script>
|
|
240
|
-
import { defineComponent, ref, onMounted } from 'vue'
|
|
241
|
-
import { VOnboardingWrapper } from 'v-onboarding'
|
|
242
|
-
import 'v-onboarding/dist/style.css'
|
|
243
|
-
export default defineComponent({
|
|
244
|
-
components: {
|
|
245
|
-
VOnboardingWrapper
|
|
246
|
-
},
|
|
247
|
-
setup() {
|
|
248
|
-
const wrapper = ref(null)
|
|
249
|
-
onMounted(() => {
|
|
250
|
-
if (wrapper.value) {
|
|
251
|
-
wrapper.value.start() // here
|
|
252
|
-
}
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
return {
|
|
256
|
-
wrapper
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
})
|
|
260
|
-
</script>
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
| Name | Usage | Description |
|
|
265
|
-
| :-------- | :-------- | :-------- |
|
|
266
|
-
| `start` | `start()` |Starts the onboarding |
|
|
267
|
-
| `finish` | `finish()` |Finishes the onboarding |
|
|
268
|
-
| `goToStep` | `goToStep(2)` or `goToStep(current => current + 1)` | Moves to the specified step number (Starts from 0) |
|
|
269
|
-
|
|
270
|
-
<br />
|
|
271
|
-
|
|
272
|
-
## Roadmap
|
|
273
|
-
|
|
274
|
-
- Write tests
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "v-onboarding",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "v-onboarding is a super-slim, fully-typed onboarding component for Vue 3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,10 +37,14 @@
|
|
|
37
37
|
"./dist/style.css": "./dist/style.css"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"dev": "vite playground",
|
|
41
|
-
"build:playground": "vite build playground",
|
|
42
40
|
"build": "yarn update-web-types && vite build",
|
|
43
|
-
"update-web-types": "vue-docgen-web-types"
|
|
41
|
+
"update-web-types": "vue-docgen-web-types",
|
|
42
|
+
"docs:dev": "cd docs && npm run dev",
|
|
43
|
+
"docs:generate": "cd docs && npm run generate",
|
|
44
|
+
"demo:dev": "vite demo",
|
|
45
|
+
"demo:build": "vite build demo",
|
|
46
|
+
"semantic-release": "semantic-release --branches main",
|
|
47
|
+
"commit": "git-cz"
|
|
44
48
|
},
|
|
45
49
|
"dependencies": {
|
|
46
50
|
"vue": "^3.2.21"
|
|
@@ -54,13 +58,12 @@
|
|
|
54
58
|
"@types/lodash.merge": "^4.6.6",
|
|
55
59
|
"@types/node": "^16.11.7",
|
|
56
60
|
"@vitejs/plugin-vue": "^1.9.4",
|
|
57
|
-
"
|
|
61
|
+
"cz-conventional-changelog": "3.3.0",
|
|
58
62
|
"lodash.merge": "^4.6.2",
|
|
59
63
|
"minimist": "^1.2.5",
|
|
60
|
-
"postcss": "^8.4.4",
|
|
61
64
|
"rollup-plugin-vue": "^6.0.0",
|
|
62
65
|
"sass": "^1.45.0",
|
|
63
|
-
"
|
|
66
|
+
"semantic-release": "^19.0.2",
|
|
64
67
|
"tsup": "^5.7.0",
|
|
65
68
|
"unbuild": "^0.5.11",
|
|
66
69
|
"vite": "^2.6.14",
|
|
@@ -70,5 +73,10 @@
|
|
|
70
73
|
"bugs": {
|
|
71
74
|
"url": "https://github.com/fatihsolhan/v-onboarding/issues"
|
|
72
75
|
},
|
|
73
|
-
"homepage": "https://github.com/fatihsolhan/v-onboarding#readme"
|
|
76
|
+
"homepage": "https://github.com/fatihsolhan/v-onboarding#readme",
|
|
77
|
+
"config": {
|
|
78
|
+
"commitizen": {
|
|
79
|
+
"path": "./node_modules/cz-conventional-changelog"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
74
82
|
}
|
|
@@ -10,16 +10,7 @@ export interface VOnboardingWrapperOptions {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export const defaultVOnboardingWrapperOptions: VOnboardingWrapperOptions = {
|
|
13
|
-
popper: {
|
|
14
|
-
modifiers: [
|
|
15
|
-
{
|
|
16
|
-
name: "offset",
|
|
17
|
-
options: {
|
|
18
|
-
offset: [0, 10],
|
|
19
|
-
},
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
} as VOnboardingWrapperOptions["popper"],
|
|
13
|
+
popper: {},
|
|
23
14
|
disableOverlay: false,
|
|
24
15
|
scrollToStep: {
|
|
25
16
|
enabled: true,
|
package/web-types/web-types.json
CHANGED
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.v-onboarding-overlay{width:100%;height:100%;position:fixed;top:0;left:0;opacity:.5;z-index:10;pointer-events:none}.v-onboarding-item{width:20rem;padding:1rem;background-color:#fff;box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d;border-radius:.375rem}.v-onboarding-item__wrapper{position:relative;z-index:20}.v-onboarding-item__header{display:flex;justify-content:space-between}.v-onboarding-item__header-title{font-size:1.25rem;font-weight:500;line-height:1.5}.v-onboarding-item__header-close{display:inline-flex;align-items:center;justify-content:center;width:1.5rem;height:1.5rem;flex-shrink:0;border-radius:50%}.v-onboarding-item__header-close:hover{background:rgba(0,0,0,.1)}.v-onboarding-item__description{font-size:.875rem;color:#71717a;margin-top:.5rem}.v-onboarding-item__actions{display:flex;margin-top:1rem}.v-onboarding-item__actions>:not([hidden])~:not([hidden]){margin-left:.5rem}.v-onboarding-item__actions button{display:inline-flex;flex:1;align-items:center;justify-content:center;padding:.5rem 1.25rem;border-width:1px;border-style:solid;font-size:1rem;font-weight:500;box-shadow:0 1px 2px #0000000d;border-radius:9999px;background-color:transparent;background-image:none;cursor:pointer}.v-onboarding-item__actions button.v-onboarding-btn-primary{border-color:transparent;color:#fff;background-color:#4f46e5}.v-onboarding-item__actions button.v-onboarding-btn-primary:hover{background-color:#4338ca}.v-onboarding-item__actions button.v-onboarding-btn-secondary{border-color:#d4d4d8;color:#3f3f46}.v-onboarding-item__actions button.v-onboarding-btn-secondary:hover{background-color:#fafafa}
|