@ulu/frontend-vue 0.6.30 → 0.6.31
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 +349 -304
- package/dist/plugins/tour/api.d.ts +4 -0
- package/dist/plugins/tour/api.d.ts.map +1 -1
- package/dist/plugins/tour/api.js +23 -12
- package/lib/plugins/tour/api.js +25 -3
- package/package.json +1 -1
|
@@ -56,5 +56,9 @@ export type TourStep = {
|
|
|
56
56
|
* - Async hook called before the step is rendered.
|
|
57
57
|
*/
|
|
58
58
|
onEnter?: Function | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* - Async hook called after the step is exited.
|
|
61
|
+
*/
|
|
62
|
+
onLeave?: Function | undefined;
|
|
59
63
|
};
|
|
60
64
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AA0BO,iCAHI,MAAM,GACJ,MAAM,CAqFjB"}
|
package/dist/plugins/tour/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { markRaw as
|
|
2
|
-
const
|
|
1
|
+
import { markRaw as o } from "vue";
|
|
2
|
+
const s = (e) => ({
|
|
3
3
|
/**
|
|
4
4
|
* Starts a new tour
|
|
5
5
|
* @param {Object} tour - The tour configuration object
|
|
@@ -10,9 +10,10 @@ const o = (e) => ({
|
|
|
10
10
|
* @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
|
|
11
11
|
* @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
|
|
12
12
|
* @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
|
|
13
|
+
* @param {Function} [tour.onStop] - Async hook called when the tour is closed/finished.
|
|
13
14
|
*/
|
|
14
15
|
async start(n) {
|
|
15
|
-
n?.steps?.length && (await this._runHooks(n.steps[0]), e.active =
|
|
16
|
+
n?.steps?.length && (await this._runHooks(n.steps[0]), e.active = o(n), e.stepIndex = 0);
|
|
16
17
|
},
|
|
17
18
|
/**
|
|
18
19
|
* Advances the tour to the next step, or stops if it is the last step
|
|
@@ -21,10 +22,11 @@ const o = (e) => ({
|
|
|
21
22
|
const n = e.active;
|
|
22
23
|
if (n)
|
|
23
24
|
if (e.stepIndex < n.steps.length - 1) {
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
await this._runLeaveHook(n.steps[e.stepIndex]);
|
|
26
|
+
const i = e.stepIndex + 1;
|
|
27
|
+
await this._runHooks(n.steps[i]), e.stepIndex = i;
|
|
26
28
|
} else
|
|
27
|
-
this.stop();
|
|
29
|
+
await this.stop();
|
|
28
30
|
},
|
|
29
31
|
/**
|
|
30
32
|
* Returns the tour to the previous step
|
|
@@ -32,24 +34,33 @@ const o = (e) => ({
|
|
|
32
34
|
async prev() {
|
|
33
35
|
const n = e.active;
|
|
34
36
|
if (n && e.stepIndex > 0) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
await this._runLeaveHook(n.steps[e.stepIndex]);
|
|
38
|
+
const i = e.stepIndex - 1;
|
|
39
|
+
await this._runHooks(n.steps[i]), e.stepIndex = i;
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
/**
|
|
40
43
|
* Stops and closes the current tour
|
|
41
44
|
*/
|
|
42
|
-
stop() {
|
|
43
|
-
|
|
45
|
+
async stop() {
|
|
46
|
+
const n = e.active;
|
|
47
|
+
n && (n.steps[e.stepIndex] && await this._runLeaveHook(n.steps[e.stepIndex]), typeof n.onStop == "function" && await n.onStop()), e.active = null, e.stepIndex = 0;
|
|
44
48
|
},
|
|
45
49
|
/**
|
|
46
|
-
* Internal method to run asynchronous
|
|
50
|
+
* Internal method to run asynchronous enter hooks on a step
|
|
47
51
|
* @param {Object} step - The tour step configuration
|
|
48
52
|
*/
|
|
49
53
|
async _runHooks(n) {
|
|
50
54
|
n && typeof n.onEnter == "function" && await n.onEnter();
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Internal method to run asynchronous leave hooks on a step
|
|
58
|
+
* @param {Object} step - The tour step configuration
|
|
59
|
+
*/
|
|
60
|
+
async _runLeaveHook(n) {
|
|
61
|
+
n && typeof n.onLeave == "function" && await n.onLeave();
|
|
51
62
|
}
|
|
52
63
|
});
|
|
53
64
|
export {
|
|
54
|
-
|
|
65
|
+
s as createApi
|
|
55
66
|
};
|
package/lib/plugins/tour/api.js
CHANGED
|
@@ -16,6 +16,7 @@ import { markRaw } from "vue";
|
|
|
16
16
|
* @property {Object} [modalProps] - Props to pass to the modal (if target is omitted).
|
|
17
17
|
* @property {Object} [popoverProps] - Props to pass to the popover (if target is present).
|
|
18
18
|
* @property {Function} [onEnter] - Async hook called before the step is rendered.
|
|
19
|
+
* @property {Function} [onLeave] - Async hook called after the step is exited.
|
|
19
20
|
*/
|
|
20
21
|
|
|
21
22
|
/**
|
|
@@ -34,6 +35,7 @@ export const createApi = (state) => ({
|
|
|
34
35
|
* @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
|
|
35
36
|
* @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
|
|
36
37
|
* @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
|
|
38
|
+
* @param {Function} [tour.onStop] - Async hook called when the tour is closed/finished.
|
|
37
39
|
*/
|
|
38
40
|
async start(tour) {
|
|
39
41
|
if (!tour?.steps?.length) return;
|
|
@@ -49,11 +51,12 @@ export const createApi = (state) => ({
|
|
|
49
51
|
if (!active) return;
|
|
50
52
|
|
|
51
53
|
if (state.stepIndex < active.steps.length - 1) {
|
|
54
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
52
55
|
const nextIndex = state.stepIndex + 1;
|
|
53
56
|
await this._runHooks(active.steps[nextIndex]);
|
|
54
57
|
state.stepIndex = nextIndex;
|
|
55
58
|
} else {
|
|
56
|
-
this.stop();
|
|
59
|
+
await this.stop();
|
|
57
60
|
}
|
|
58
61
|
},
|
|
59
62
|
/**
|
|
@@ -64,6 +67,7 @@ export const createApi = (state) => ({
|
|
|
64
67
|
if (!active) return;
|
|
65
68
|
|
|
66
69
|
if (state.stepIndex > 0) {
|
|
70
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
67
71
|
const prevIndex = state.stepIndex - 1;
|
|
68
72
|
await this._runHooks(active.steps[prevIndex]);
|
|
69
73
|
state.stepIndex = prevIndex;
|
|
@@ -72,17 +76,35 @@ export const createApi = (state) => ({
|
|
|
72
76
|
/**
|
|
73
77
|
* Stops and closes the current tour
|
|
74
78
|
*/
|
|
75
|
-
stop() {
|
|
79
|
+
async stop() {
|
|
80
|
+
const active = state.active;
|
|
81
|
+
if (active) {
|
|
82
|
+
if (active.steps[state.stepIndex]) {
|
|
83
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
84
|
+
}
|
|
85
|
+
if (typeof active.onStop === 'function') {
|
|
86
|
+
await active.onStop();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
76
89
|
state.active = null;
|
|
77
90
|
state.stepIndex = 0;
|
|
78
91
|
},
|
|
79
92
|
/**
|
|
80
|
-
* Internal method to run asynchronous
|
|
93
|
+
* Internal method to run asynchronous enter hooks on a step
|
|
81
94
|
* @param {Object} step - The tour step configuration
|
|
82
95
|
*/
|
|
83
96
|
async _runHooks(step) {
|
|
84
97
|
if (step && typeof step.onEnter === 'function') {
|
|
85
98
|
await step.onEnter();
|
|
86
99
|
}
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Internal method to run asynchronous leave hooks on a step
|
|
103
|
+
* @param {Object} step - The tour step configuration
|
|
104
|
+
*/
|
|
105
|
+
async _runLeaveHook(step) {
|
|
106
|
+
if (step && typeof step.onLeave === 'function') {
|
|
107
|
+
await step.onLeave();
|
|
108
|
+
}
|
|
87
109
|
}
|
|
88
110
|
});
|
package/package.json
CHANGED