@ulu/frontend-vue 0.6.34 → 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 +1983 -1965
- package/dist/plugins/tour/UluTourDisplay.vue.js +50 -47
- 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 +30 -16
- package/lib/plugins/tour/UluTourDisplay.vue +13 -6
- package/lib/plugins/tour/api.js +36 -7
- package/package.json +1 -1
|
@@ -1,37 +1,40 @@
|
|
|
1
|
-
import { computed as l, ref as h, watch as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useTour as
|
|
7
|
-
const
|
|
1
|
+
import { computed as l, ref as h, watch as L, nextTick as D, onMounted as F, onUnmounted as I, createBlock as a, openBlock as n, Teleport as M, createElementBlock as w, createCommentVNode as $, unref as r, Fragment as R, resolveDynamicComponent as p, mergeProps as c, createSlots as P, withCtx as f, normalizeStyle as U } from "vue";
|
|
2
|
+
import V from "../../components/collapsible/UluModal.vue.js";
|
|
3
|
+
import q from "../popovers/UluPopoverBase.vue.js";
|
|
4
|
+
import N from "./UluTourPager.vue.js";
|
|
5
|
+
import _ from "./UluTourContent.vue.js";
|
|
6
|
+
import { useTour as O } from "./useTour.js";
|
|
7
|
+
const W = {
|
|
8
8
|
__name: "UluTourDisplay",
|
|
9
|
-
setup(
|
|
10
|
-
const { api:
|
|
9
|
+
setup(j) {
|
|
10
|
+
const { api: s, state: o } = O(), t = l(() => o.active?.steps[o.stepIndex]), y = l(() => t.value?.component || o.active?.component), d = l(() => t.value?.contentComponent || o.active?.contentComponent), C = l(() => t.value?.pagerComponent || o.active?.pagerComponent || N), S = l(() => t.value?.modalComponent || o.active?.modalComponent || V), E = l(() => t.value?.popoverComponent || o.active?.popoverComponent || q), i = h(null), g = h(null), x = l(() => {
|
|
11
|
+
const e = t.value?.target;
|
|
12
|
+
return typeof e == "function" ? e() : e;
|
|
13
|
+
}), T = l(() => ({
|
|
11
14
|
placement: t.value?.placement || "bottom",
|
|
12
15
|
arrow: !0,
|
|
13
16
|
offset: 8
|
|
14
17
|
})), B = l(() => ({
|
|
15
18
|
...o.active?.modalProps || {},
|
|
16
19
|
...t.value?.modalProps || {}
|
|
17
|
-
})),
|
|
20
|
+
})), b = l(() => ({
|
|
18
21
|
modifiers: "large",
|
|
19
22
|
...o.active?.popoverProps || {},
|
|
20
23
|
...t.value?.popoverProps || {}
|
|
21
|
-
})),
|
|
22
|
-
if (
|
|
23
|
-
const e =
|
|
24
|
-
|
|
24
|
+
})), v = h(null), m = () => {
|
|
25
|
+
if (i.value) {
|
|
26
|
+
const e = i.value.getBoundingClientRect();
|
|
27
|
+
v.value = {
|
|
25
28
|
top: e.top,
|
|
26
29
|
left: e.left,
|
|
27
30
|
width: e.width,
|
|
28
31
|
height: e.height
|
|
29
32
|
};
|
|
30
33
|
} else
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
if (!
|
|
34
|
-
const e =
|
|
34
|
+
v.value = null;
|
|
35
|
+
}, z = l(() => {
|
|
36
|
+
if (!v.value) return {};
|
|
37
|
+
const e = v.value;
|
|
35
38
|
return {
|
|
36
39
|
position: "fixed",
|
|
37
40
|
top: 0,
|
|
@@ -56,44 +59,44 @@ const Q = {
|
|
|
56
59
|
)`
|
|
57
60
|
};
|
|
58
61
|
});
|
|
59
|
-
return
|
|
60
|
-
if (e
|
|
61
|
-
await
|
|
62
|
-
const u = document.querySelector(e
|
|
63
|
-
u ? (
|
|
62
|
+
return L(x, async (e) => {
|
|
63
|
+
if (e) {
|
|
64
|
+
await D();
|
|
65
|
+
const u = typeof e == "string" ? document.querySelector(e) : e;
|
|
66
|
+
u ? (i.value = u, g.value && g.value.update(), t.value?.highlight && m()) : (console.warn("Tour target not found:", e), i.value = null);
|
|
64
67
|
} else
|
|
65
|
-
|
|
68
|
+
i.value = null, v.value = null;
|
|
66
69
|
}, { immediate: !0 }), F(() => {
|
|
67
70
|
window.addEventListener("resize", m), window.addEventListener("scroll", m);
|
|
68
71
|
}), I(() => {
|
|
69
72
|
window.removeEventListener("resize", m), window.removeEventListener("scroll", m);
|
|
70
73
|
}), (e, u) => (n(), a(M, { to: "body" }, [
|
|
71
|
-
r(o).active ? (n(),
|
|
72
|
-
y.value ? (n(), a(p(y.value),
|
|
74
|
+
r(o).active ? (n(), w(R, { key: 0 }, [
|
|
75
|
+
y.value ? (n(), a(p(y.value), c({
|
|
73
76
|
key: 0,
|
|
74
77
|
"data-ulu-tour-ui": "true",
|
|
75
78
|
step: t.value,
|
|
76
79
|
tourState: r(o),
|
|
77
|
-
api: r(
|
|
78
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) :
|
|
80
|
+
api: r(s)
|
|
81
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : x.value ? (n(), a(p(E.value), c({
|
|
79
82
|
key: 2,
|
|
80
83
|
ref_key: "popoverBase",
|
|
81
84
|
ref: g,
|
|
82
|
-
trigger:
|
|
83
|
-
config:
|
|
85
|
+
trigger: i.value,
|
|
86
|
+
config: T.value,
|
|
84
87
|
style: { zIndex: 9999 },
|
|
85
88
|
isOpen: !0,
|
|
86
89
|
"data-ulu-tour-ui": "true",
|
|
87
|
-
onClose: u[1] || (u[1] = (
|
|
88
|
-
},
|
|
90
|
+
onClose: u[1] || (u[1] = (k) => r(s).stop())
|
|
91
|
+
}, b.value), P({
|
|
89
92
|
default: f(() => [
|
|
90
|
-
|
|
93
|
+
d.value ? (n(), a(p(d.value), c({
|
|
91
94
|
key: 0,
|
|
92
95
|
step: t.value,
|
|
93
96
|
tourState: r(o),
|
|
94
|
-
api: r(
|
|
97
|
+
api: r(s),
|
|
95
98
|
"is-modal": !1
|
|
96
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (n(), a(
|
|
99
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (n(), a(_, {
|
|
97
100
|
key: 1,
|
|
98
101
|
step: t.value,
|
|
99
102
|
"is-modal": !1
|
|
@@ -108,21 +111,21 @@ const Q = {
|
|
|
108
111
|
]),
|
|
109
112
|
key: "0"
|
|
110
113
|
}
|
|
111
|
-
]), 1040, ["trigger", "config"])) : (n(), a(p(
|
|
114
|
+
]), 1040, ["trigger", "config"])) : (n(), a(p(S.value), c({
|
|
112
115
|
key: 1,
|
|
113
116
|
modelValue: !0,
|
|
114
117
|
"data-ulu-tour-ui": "true"
|
|
115
118
|
}, B.value, {
|
|
116
|
-
onClose: u[0] || (u[0] = (
|
|
117
|
-
}),
|
|
119
|
+
onClose: u[0] || (u[0] = (k) => r(s).stop())
|
|
120
|
+
}), P({
|
|
118
121
|
default: f(() => [
|
|
119
|
-
|
|
122
|
+
d.value ? (n(), a(p(d.value), c({
|
|
120
123
|
key: 0,
|
|
121
124
|
step: t.value,
|
|
122
125
|
tourState: r(o),
|
|
123
|
-
api: r(
|
|
126
|
+
api: r(s),
|
|
124
127
|
"is-modal": !0
|
|
125
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (n(), a(
|
|
128
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (n(), a(_, {
|
|
126
129
|
key: 1,
|
|
127
130
|
step: t.value,
|
|
128
131
|
"is-modal": !0
|
|
@@ -138,17 +141,17 @@ const Q = {
|
|
|
138
141
|
key: "0"
|
|
139
142
|
}
|
|
140
143
|
]), 1040)),
|
|
141
|
-
t.value?.target && t.value?.highlight &&
|
|
144
|
+
t.value?.target && t.value?.highlight && v.value ? (n(), w("div", {
|
|
142
145
|
key: 3,
|
|
143
146
|
class: "tour-highlight-backdrop",
|
|
144
|
-
style:
|
|
147
|
+
style: U(z.value),
|
|
145
148
|
"data-ulu-tour-ui": "true",
|
|
146
|
-
onClick: u[2] || (u[2] = (
|
|
147
|
-
}, null, 4)) :
|
|
148
|
-
], 64)) :
|
|
149
|
+
onClick: u[2] || (u[2] = (k) => r(s).stop())
|
|
150
|
+
}, null, 4)) : $("", !0)
|
|
151
|
+
], 64)) : $("", !0)
|
|
149
152
|
]));
|
|
150
153
|
}
|
|
151
154
|
};
|
|
152
155
|
export {
|
|
153
|
-
|
|
156
|
+
W as default
|
|
154
157
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export function createApi(state: Object): Object;
|
|
2
2
|
export type TourStep = {
|
|
3
3
|
/**
|
|
4
|
-
* - The CSS selector for the target element. If omitted, step renders as a modal.
|
|
4
|
+
* - The CSS selector, DOM element, or function returning either, for the target element. If omitted or resolves to falsy, step renders as a modal.
|
|
5
5
|
*/
|
|
6
|
-
target?: string | undefined;
|
|
6
|
+
target?: string | Function | HTMLElement | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* - The title text for the step.
|
|
9
9
|
*/
|
|
@@ -44,6 +44,10 @@ export type TourStep = {
|
|
|
44
44
|
* - If true, darkens the backdrop around the target element.
|
|
45
45
|
*/
|
|
46
46
|
highlight?: boolean | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* - If true or returns true, this step will be skipped when navigating the tour.
|
|
49
|
+
*/
|
|
50
|
+
skip?: boolean | Function | undefined;
|
|
47
51
|
/**
|
|
48
52
|
* - Props to pass to the modal (if target is omitted).
|
|
49
53
|
*/
|
|
@@ -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":"AA2BO,iCAHI,MAAM,GACJ,MAAM,CA8IjB"}
|
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 a = (n) => ({
|
|
3
3
|
/**
|
|
4
4
|
* Starts a new tour
|
|
5
5
|
* @param {Object} tour - The tour configuration object
|
|
@@ -18,7 +18,18 @@ const r = (n) => ({
|
|
|
18
18
|
n.isTransitioning = !0;
|
|
19
19
|
try {
|
|
20
20
|
if (!i?.steps?.length) return;
|
|
21
|
-
typeof i.onStart == "function" && await i.onStart()
|
|
21
|
+
typeof i.onStart == "function" && await i.onStart();
|
|
22
|
+
let s = 0;
|
|
23
|
+
for (; s < i.steps.length; ) {
|
|
24
|
+
const e = i.steps[s];
|
|
25
|
+
if (!(typeof e.skip == "function" ? await e.skip() : e.skip)) break;
|
|
26
|
+
s++;
|
|
27
|
+
}
|
|
28
|
+
if (s >= i.steps.length) {
|
|
29
|
+
typeof i.onStop == "function" && await i.onStop();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
await this._runHooks(i.steps[s]), n.active = o(i), n.stepIndex = s;
|
|
22
33
|
} finally {
|
|
23
34
|
n.isTransitioning = !1;
|
|
24
35
|
}
|
|
@@ -33,12 +44,13 @@ const r = (n) => ({
|
|
|
33
44
|
if (i) {
|
|
34
45
|
n.isTransitioning = !0;
|
|
35
46
|
try {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const e =
|
|
39
|
-
await
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
let s = n.stepIndex + 1;
|
|
48
|
+
for (; s < i.steps.length; ) {
|
|
49
|
+
const e = i.steps[s];
|
|
50
|
+
if (!(typeof e.skip == "function" ? await e.skip() : e.skip)) break;
|
|
51
|
+
s++;
|
|
52
|
+
}
|
|
53
|
+
s < i.steps.length ? (await this._runLeaveHook(i.steps[n.stepIndex]), await this._runHooks(i.steps[s]), n.stepIndex = s) : await this.stop(!0);
|
|
42
54
|
} finally {
|
|
43
55
|
n.isTransitioning = !1;
|
|
44
56
|
}
|
|
@@ -53,11 +65,13 @@ const r = (n) => ({
|
|
|
53
65
|
if (i) {
|
|
54
66
|
n.isTransitioning = !0;
|
|
55
67
|
try {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const e =
|
|
59
|
-
await
|
|
68
|
+
let s = n.stepIndex - 1;
|
|
69
|
+
for (; s >= 0; ) {
|
|
70
|
+
const e = i.steps[s];
|
|
71
|
+
if (!(typeof e.skip == "function" ? await e.skip() : e.skip)) break;
|
|
72
|
+
s--;
|
|
60
73
|
}
|
|
74
|
+
s >= 0 && (await this._runLeaveHook(i.steps[n.stepIndex]), await this._runHooks(i.steps[s]), n.stepIndex = s);
|
|
61
75
|
} finally {
|
|
62
76
|
n.isTransitioning = !1;
|
|
63
77
|
}
|
|
@@ -71,8 +85,8 @@ const r = (n) => ({
|
|
|
71
85
|
if (!(!i && n.isTransitioning)) {
|
|
72
86
|
n.isTransitioning = !0;
|
|
73
87
|
try {
|
|
74
|
-
const
|
|
75
|
-
|
|
88
|
+
const s = n.active;
|
|
89
|
+
s && (s.steps[n.stepIndex] && await this._runLeaveHook(s.steps[n.stepIndex]), typeof s.onStop == "function" && await s.onStop()), n.active = null, n.stepIndex = 0;
|
|
76
90
|
} finally {
|
|
77
91
|
n.isTransitioning = !1;
|
|
78
92
|
}
|
|
@@ -94,5 +108,5 @@ const r = (n) => ({
|
|
|
94
108
|
}
|
|
95
109
|
});
|
|
96
110
|
export {
|
|
97
|
-
|
|
111
|
+
a as createApi
|
|
98
112
|
};
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
<!-- 2. RENDER MODAL STEP -->
|
|
17
17
|
<component
|
|
18
|
-
v-else-if="!
|
|
18
|
+
v-else-if="!resolvedTargetDescriptor"
|
|
19
19
|
:is="resolvedModalComponent"
|
|
20
20
|
:modelValue="true"
|
|
21
21
|
data-ulu-tour-ui="true"
|
|
@@ -102,6 +102,12 @@
|
|
|
102
102
|
const targetEl = ref(null);
|
|
103
103
|
const popoverBase = ref(null);
|
|
104
104
|
|
|
105
|
+
const resolvedTargetDescriptor = computed(() => {
|
|
106
|
+
const t = currentStep.value?.target;
|
|
107
|
+
if (typeof t === 'function') return t();
|
|
108
|
+
return t;
|
|
109
|
+
});
|
|
110
|
+
|
|
105
111
|
const resolvedConfig = computed(() => ({
|
|
106
112
|
placement: currentStep.value?.placement || 'bottom',
|
|
107
113
|
arrow: true,
|
|
@@ -170,10 +176,10 @@
|
|
|
170
176
|
});
|
|
171
177
|
|
|
172
178
|
// Watch for step changes to update floating UI target
|
|
173
|
-
watch(
|
|
174
|
-
if (
|
|
179
|
+
watch(resolvedTargetDescriptor, async (descriptor) => {
|
|
180
|
+
if (descriptor) {
|
|
175
181
|
await nextTick();
|
|
176
|
-
const el = document.querySelector(
|
|
182
|
+
const el = typeof descriptor === 'string' ? document.querySelector(descriptor) : descriptor;
|
|
177
183
|
if (el) {
|
|
178
184
|
targetEl.value = el;
|
|
179
185
|
// UluPopoverBase's isOpen watcher automatically calls update(),
|
|
@@ -182,11 +188,12 @@
|
|
|
182
188
|
if (popoverBase.value) {
|
|
183
189
|
popoverBase.value.update();
|
|
184
190
|
}
|
|
185
|
-
if (
|
|
191
|
+
if (currentStep.value?.highlight) {
|
|
186
192
|
updateTargetRect();
|
|
187
193
|
}
|
|
188
194
|
} else {
|
|
189
|
-
console.warn(`Tour target not found
|
|
195
|
+
console.warn(`Tour target not found:`, descriptor);
|
|
196
|
+
targetEl.value = null;
|
|
190
197
|
}
|
|
191
198
|
} else {
|
|
192
199
|
targetEl.value = null;
|
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.
|
|
@@ -46,9 +47,23 @@ export const createApi = (state) => ({
|
|
|
46
47
|
if (typeof tour.onStart === 'function') {
|
|
47
48
|
await tour.onStart();
|
|
48
49
|
}
|
|
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]);
|
|
50
65
|
state.active = markRaw(tour);
|
|
51
|
-
state.stepIndex =
|
|
66
|
+
state.stepIndex = startIndex;
|
|
52
67
|
} finally {
|
|
53
68
|
state.isTransitioning = false;
|
|
54
69
|
}
|
|
@@ -63,9 +78,16 @@ export const createApi = (state) => ({
|
|
|
63
78
|
|
|
64
79
|
state.isTransitioning = true;
|
|
65
80
|
try {
|
|
66
|
-
|
|
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) {
|
|
67
90
|
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
68
|
-
const nextIndex = state.stepIndex + 1;
|
|
69
91
|
await this._runHooks(active.steps[nextIndex]);
|
|
70
92
|
state.stepIndex = nextIndex;
|
|
71
93
|
} else {
|
|
@@ -85,9 +107,16 @@ export const createApi = (state) => ({
|
|
|
85
107
|
|
|
86
108
|
state.isTransitioning = true;
|
|
87
109
|
try {
|
|
88
|
-
|
|
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) {
|
|
89
119
|
await this._runLeaveHook(active.steps[state.stepIndex]);
|
|
90
|
-
const prevIndex = state.stepIndex - 1;
|
|
91
120
|
await this._runHooks(active.steps[prevIndex]);
|
|
92
121
|
state.stepIndex = prevIndex;
|
|
93
122
|
}
|
package/package.json
CHANGED