@ulu/frontend-vue 0.6.33 → 0.6.34
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/dist/mcp-data.json +451 -428
- package/dist/plugins/tour/UluTourDisplay.vue.d.ts +1 -96
- package/dist/plugins/tour/UluTourDisplay.vue.d.ts.map +1 -1
- package/dist/plugins/tour/UluTourDisplay.vue.js +64 -64
- package/dist/plugins/tour/api.d.ts.map +1 -1
- package/dist/plugins/tour/api.js +57 -25
- package/dist/plugins/tour/index.d.ts.map +1 -1
- package/dist/plugins/tour/index.js +11 -10
- package/lib/plugins/tour/UluTourDisplay.vue +21 -12
- package/lib/plugins/tour/api.js +55 -26
- package/lib/plugins/tour/index.js +2 -1
- package/package.json +1 -1
package/lib/plugins/tour/api.js
CHANGED
|
@@ -35,59 +35,88 @@ export const createApi = (state) => ({
|
|
|
35
35
|
* @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
|
|
36
36
|
* @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
|
|
37
37
|
* @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
|
|
38
|
+
* @param {Function} [tour.onStart] - Async hook called before the tour starts.
|
|
38
39
|
* @param {Function} [tour.onStop] - Async hook called when the tour is closed/finished.
|
|
39
40
|
*/
|
|
40
41
|
async start(tour) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
if (state.isTransitioning) return;
|
|
43
|
+
state.isTransitioning = true;
|
|
44
|
+
try {
|
|
45
|
+
if (!tour?.steps?.length) return;
|
|
46
|
+
if (typeof tour.onStart === 'function') {
|
|
47
|
+
await tour.onStart();
|
|
48
|
+
}
|
|
49
|
+
await this._runHooks(tour.steps[0]);
|
|
50
|
+
state.active = markRaw(tour);
|
|
51
|
+
state.stepIndex = 0;
|
|
52
|
+
} finally {
|
|
53
|
+
state.isTransitioning = false;
|
|
54
|
+
}
|
|
45
55
|
},
|
|
46
56
|
/**
|
|
47
57
|
* Advances the tour to the next step, or stops if it is the last step
|
|
48
58
|
*/
|
|
49
59
|
async next() {
|
|
60
|
+
if (state.isTransitioning) return;
|
|
50
61
|
const active = state.active;
|
|
51
62
|
if (!active) return;
|
|
52
63
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
state.isTransitioning = true;
|
|
65
|
+
try {
|
|
66
|
+
if (state.stepIndex < active.steps.length - 1) {
|
|
67
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
68
|
+
const nextIndex = state.stepIndex + 1;
|
|
69
|
+
await this._runHooks(active.steps[nextIndex]);
|
|
70
|
+
state.stepIndex = nextIndex;
|
|
71
|
+
} else {
|
|
72
|
+
await this.stop(true);
|
|
73
|
+
}
|
|
74
|
+
} finally {
|
|
75
|
+
state.isTransitioning = false;
|
|
60
76
|
}
|
|
61
77
|
},
|
|
62
78
|
/**
|
|
63
79
|
* Returns the tour to the previous step
|
|
64
80
|
*/
|
|
65
81
|
async prev() {
|
|
82
|
+
if (state.isTransitioning) return;
|
|
66
83
|
const active = state.active;
|
|
67
84
|
if (!active) return;
|
|
68
85
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
state.isTransitioning = true;
|
|
87
|
+
try {
|
|
88
|
+
if (state.stepIndex > 0) {
|
|
89
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
90
|
+
const prevIndex = state.stepIndex - 1;
|
|
91
|
+
await this._runHooks(active.steps[prevIndex]);
|
|
92
|
+
state.stepIndex = prevIndex;
|
|
93
|
+
}
|
|
94
|
+
} finally {
|
|
95
|
+
state.isTransitioning = false;
|
|
74
96
|
}
|
|
75
97
|
},
|
|
76
98
|
/**
|
|
77
99
|
* Stops and closes the current tour
|
|
100
|
+
* @param {Boolean} [internalBypass=false] - Used internally to bypass transition check
|
|
78
101
|
*/
|
|
79
|
-
async stop() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
102
|
+
async stop(internalBypass = false) {
|
|
103
|
+
if (!internalBypass && state.isTransitioning) return;
|
|
104
|
+
state.isTransitioning = true;
|
|
105
|
+
try {
|
|
106
|
+
const active = state.active;
|
|
107
|
+
if (active) {
|
|
108
|
+
if (active.steps[state.stepIndex]) {
|
|
109
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
110
|
+
}
|
|
111
|
+
if (typeof active.onStop === 'function') {
|
|
112
|
+
await active.onStop();
|
|
113
|
+
}
|
|
87
114
|
}
|
|
115
|
+
state.active = null;
|
|
116
|
+
state.stepIndex = 0;
|
|
117
|
+
} finally {
|
|
118
|
+
state.isTransitioning = false;
|
|
88
119
|
}
|
|
89
|
-
state.active = null;
|
|
90
|
-
state.stepIndex = 0;
|
|
91
120
|
},
|
|
92
121
|
/**
|
|
93
122
|
* Internal method to run asynchronous enter hooks on a step
|
package/package.json
CHANGED