@ulu/frontend-vue 0.6.33 → 0.6.35
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 +2422 -2381
- 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 +65 -62
- package/dist/plugins/tour/api.d.ts +6 -2
- package/dist/plugins/tour/api.d.ts.map +1 -1
- package/dist/plugins/tour/api.js +70 -24
- package/dist/plugins/tour/index.d.ts.map +1 -1
- package/dist/plugins/tour/index.js +11 -10
- package/lib/plugins/tour/UluTourDisplay.vue +34 -18
- package/lib/plugins/tour/api.js +85 -27
- package/lib/plugins/tour/index.js +2 -1
- package/package.json +1 -1
package/lib/plugins/tour/api.js
CHANGED
|
@@ -2,7 +2,7 @@ import { markRaw } from "vue";
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {Object} TourStep
|
|
5
|
-
* @property {String} [target] - The CSS selector for the target element. If omitted, step renders as a modal.
|
|
5
|
+
* @property {String|Function|HTMLElement} [target] - The CSS selector, DOM element, or function returning either, for the target element. If omitted or resolves to falsy, step renders as a modal.
|
|
6
6
|
* @property {String} [title] - The title text for the step.
|
|
7
7
|
* @property {String|Array|Object} [titleClass] - Class to apply to the title.
|
|
8
8
|
* @property {String|Array|Object} [pagerClass] - Class to apply to the pager footer.
|
|
@@ -13,6 +13,7 @@ import { markRaw } from "vue";
|
|
|
13
13
|
* @property {Boolean} [hideFooter] - If true, hides the default tour footer (Next/Back buttons).
|
|
14
14
|
* @property {String} [placement] - Floating UI placement string (e.g. 'bottom', 'right').
|
|
15
15
|
* @property {Boolean} [highlight] - If true, darkens the backdrop around the target element.
|
|
16
|
+
* @property {Boolean|Function} [skip] - If true or returns true, this step will be skipped when navigating the tour.
|
|
16
17
|
* @property {Object} [modalProps] - Props to pass to the modal (if target is omitted).
|
|
17
18
|
* @property {Object} [popoverProps] - Props to pass to the popover (if target is present).
|
|
18
19
|
* @property {Function} [onEnter] - Async hook called before the step is rendered.
|
|
@@ -35,59 +36,116 @@ export const createApi = (state) => ({
|
|
|
35
36
|
* @param {String|Array|Object} [tour.modalTitleClass] - Global class applied to the title of modal steps.
|
|
36
37
|
* @param {String|Array|Object} [tour.popoverTitleClass] - Global class applied to the title of popover steps.
|
|
37
38
|
* @param {String|Array|Object} [tour.pagerClass] - Global class applied to the pager.
|
|
39
|
+
* @param {Function} [tour.onStart] - Async hook called before the tour starts.
|
|
38
40
|
* @param {Function} [tour.onStop] - Async hook called when the tour is closed/finished.
|
|
39
41
|
*/
|
|
40
42
|
async start(tour) {
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
if (state.isTransitioning) return;
|
|
44
|
+
state.isTransitioning = true;
|
|
45
|
+
try {
|
|
46
|
+
if (!tour?.steps?.length) return;
|
|
47
|
+
if (typeof tour.onStart === 'function') {
|
|
48
|
+
await tour.onStart();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
let startIndex = 0;
|
|
52
|
+
while (startIndex < tour.steps.length) {
|
|
53
|
+
const step = tour.steps[startIndex];
|
|
54
|
+
const shouldSkip = typeof step.skip === 'function' ? await step.skip() : step.skip;
|
|
55
|
+
if (!shouldSkip) break;
|
|
56
|
+
startIndex++;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (startIndex >= tour.steps.length) {
|
|
60
|
+
if (typeof tour.onStop === 'function') await tour.onStop();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
await this._runHooks(tour.steps[startIndex]);
|
|
65
|
+
state.active = markRaw(tour);
|
|
66
|
+
state.stepIndex = startIndex;
|
|
67
|
+
} finally {
|
|
68
|
+
state.isTransitioning = false;
|
|
69
|
+
}
|
|
45
70
|
},
|
|
46
71
|
/**
|
|
47
72
|
* Advances the tour to the next step, or stops if it is the last step
|
|
48
73
|
*/
|
|
49
74
|
async next() {
|
|
75
|
+
if (state.isTransitioning) return;
|
|
50
76
|
const active = state.active;
|
|
51
77
|
if (!active) return;
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
state.isTransitioning = true;
|
|
80
|
+
try {
|
|
81
|
+
let nextIndex = state.stepIndex + 1;
|
|
82
|
+
while (nextIndex < active.steps.length) {
|
|
83
|
+
const step = active.steps[nextIndex];
|
|
84
|
+
const shouldSkip = typeof step.skip === 'function' ? await step.skip() : step.skip;
|
|
85
|
+
if (!shouldSkip) break;
|
|
86
|
+
nextIndex++;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (nextIndex < active.steps.length) {
|
|
90
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
91
|
+
await this._runHooks(active.steps[nextIndex]);
|
|
92
|
+
state.stepIndex = nextIndex;
|
|
93
|
+
} else {
|
|
94
|
+
await this.stop(true);
|
|
95
|
+
}
|
|
96
|
+
} finally {
|
|
97
|
+
state.isTransitioning = false;
|
|
60
98
|
}
|
|
61
99
|
},
|
|
62
100
|
/**
|
|
63
101
|
* Returns the tour to the previous step
|
|
64
102
|
*/
|
|
65
103
|
async prev() {
|
|
104
|
+
if (state.isTransitioning) return;
|
|
66
105
|
const active = state.active;
|
|
67
106
|
if (!active) return;
|
|
68
107
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
108
|
+
state.isTransitioning = true;
|
|
109
|
+
try {
|
|
110
|
+
let prevIndex = state.stepIndex - 1;
|
|
111
|
+
while (prevIndex >= 0) {
|
|
112
|
+
const step = active.steps[prevIndex];
|
|
113
|
+
const shouldSkip = typeof step.skip === 'function' ? await step.skip() : step.skip;
|
|
114
|
+
if (!shouldSkip) break;
|
|
115
|
+
prevIndex--;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (prevIndex >= 0) {
|
|
119
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
120
|
+
await this._runHooks(active.steps[prevIndex]);
|
|
121
|
+
state.stepIndex = prevIndex;
|
|
122
|
+
}
|
|
123
|
+
} finally {
|
|
124
|
+
state.isTransitioning = false;
|
|
74
125
|
}
|
|
75
126
|
},
|
|
76
127
|
/**
|
|
77
128
|
* Stops and closes the current tour
|
|
129
|
+
* @param {Boolean} [internalBypass=false] - Used internally to bypass transition check
|
|
78
130
|
*/
|
|
79
|
-
async stop() {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
131
|
+
async stop(internalBypass = false) {
|
|
132
|
+
if (!internalBypass && state.isTransitioning) return;
|
|
133
|
+
state.isTransitioning = true;
|
|
134
|
+
try {
|
|
135
|
+
const active = state.active;
|
|
136
|
+
if (active) {
|
|
137
|
+
if (active.steps[state.stepIndex]) {
|
|
138
|
+
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
139
|
+
}
|
|
140
|
+
if (typeof active.onStop === 'function') {
|
|
141
|
+
await active.onStop();
|
|
142
|
+
}
|
|
87
143
|
}
|
|
144
|
+
state.active = null;
|
|
145
|
+
state.stepIndex = 0;
|
|
146
|
+
} finally {
|
|
147
|
+
state.isTransitioning = false;
|
|
88
148
|
}
|
|
89
|
-
state.active = null;
|
|
90
|
-
state.stepIndex = 0;
|
|
91
149
|
},
|
|
92
150
|
/**
|
|
93
151
|
* Internal method to run asynchronous enter hooks on a step
|
package/package.json
CHANGED