@ulu/frontend-vue 0.6.36 → 0.6.37
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed as r, ref as
|
|
1
|
+
import { computed as r, ref as y, unref as n, watch as M, nextTick as $, onMounted as R, onUnmounted as q, createBlock as u, openBlock as a, Teleport as U, createElementBlock as P, createCommentVNode as S, Fragment as V, resolveDynamicComponent as s, mergeProps as c, createSlots as _, withCtx as C, normalizeStyle as H } from "vue";
|
|
2
2
|
import N from "../../components/collapsible/UluModal.vue.js";
|
|
3
3
|
import O from "../popovers/UluPopoverBase.vue.js";
|
|
4
4
|
import j from "./UluTourPager.vue.js";
|
|
@@ -7,11 +7,11 @@ import { useTour as A } from "./useTour.js";
|
|
|
7
7
|
const Z = {
|
|
8
8
|
__name: "UluTourDisplay",
|
|
9
9
|
setup(G) {
|
|
10
|
-
const { api:
|
|
10
|
+
const { api: i, state: l } = A(), t = r(() => l.active?.steps[l.stepIndex]), h = r(() => t.value?.component || l.active?.component), f = r(() => t.value?.contentComponent || l.active?.contentComponent), x = r(() => t.value?.pagerComponent || l.active?.pagerComponent || j), T = r(() => t.value?.modalComponent || l.active?.modalComponent || N), b = r(() => t.value?.popoverComponent || l.active?.popoverComponent || O), v = y(null), g = y(null), w = y(null), k = r(() => {
|
|
11
11
|
const e = n(t.value?.target);
|
|
12
12
|
return typeof e == "function" ? n(e()) : e;
|
|
13
|
-
}),
|
|
14
|
-
const e = n(t.value?.
|
|
13
|
+
}), B = r(() => {
|
|
14
|
+
const e = n(t.value?.highlight);
|
|
15
15
|
return typeof e == "function" ? n(e()) : e;
|
|
16
16
|
}), z = r(() => ({
|
|
17
17
|
placement: t.value?.placement || "bottom",
|
|
@@ -24,21 +24,21 @@ const Z = {
|
|
|
24
24
|
modifiers: "large",
|
|
25
25
|
...l.active?.popoverProps || {},
|
|
26
26
|
...t.value?.popoverProps || {}
|
|
27
|
-
})),
|
|
27
|
+
})), d = y(null), m = () => {
|
|
28
28
|
const e = g.value || v.value;
|
|
29
29
|
if (e) {
|
|
30
30
|
const o = e.getBoundingClientRect();
|
|
31
|
-
|
|
31
|
+
d.value = {
|
|
32
32
|
top: o.top,
|
|
33
33
|
left: o.left,
|
|
34
34
|
width: o.width,
|
|
35
35
|
height: o.height
|
|
36
36
|
};
|
|
37
37
|
} else
|
|
38
|
-
|
|
38
|
+
d.value = null;
|
|
39
39
|
}, I = r(() => {
|
|
40
|
-
if (!
|
|
41
|
-
const e =
|
|
40
|
+
if (!d.value) return {};
|
|
41
|
+
const e = d.value;
|
|
42
42
|
return {
|
|
43
43
|
position: "fixed",
|
|
44
44
|
top: 0,
|
|
@@ -63,51 +63,51 @@ const Z = {
|
|
|
63
63
|
)`
|
|
64
64
|
};
|
|
65
65
|
});
|
|
66
|
-
return M([k,
|
|
66
|
+
return M([k, B], async ([e, o]) => {
|
|
67
67
|
if (e) {
|
|
68
68
|
await $();
|
|
69
69
|
const p = typeof e == "string" ? document.querySelector(e) : n(e);
|
|
70
|
-
p ? (v.value = p,
|
|
70
|
+
p ? (v.value = p, w.value && w.value.update()) : (console.warn("Tour target not found:", e), v.value = null);
|
|
71
71
|
} else
|
|
72
72
|
v.value = null;
|
|
73
|
-
if (o) {
|
|
73
|
+
if (o && typeof o != "boolean") {
|
|
74
74
|
await $();
|
|
75
75
|
const p = typeof o == "string" ? document.querySelector(o) : n(o);
|
|
76
76
|
p ? g.value = p : (console.warn("Tour highlight element not found:", o), g.value = null);
|
|
77
77
|
} else
|
|
78
78
|
g.value = null;
|
|
79
|
-
|
|
79
|
+
o && m();
|
|
80
80
|
}, { immediate: !0 }), R(() => {
|
|
81
|
-
window.addEventListener("resize",
|
|
81
|
+
window.addEventListener("resize", m), window.addEventListener("scroll", m);
|
|
82
82
|
}), q(() => {
|
|
83
|
-
window.removeEventListener("resize",
|
|
84
|
-
}), (e, o) => (
|
|
85
|
-
n(l).active ? (
|
|
86
|
-
|
|
83
|
+
window.removeEventListener("resize", m), window.removeEventListener("scroll", m);
|
|
84
|
+
}), (e, o) => (a(), u(U, { to: "body" }, [
|
|
85
|
+
n(l).active ? (a(), P(V, { key: 0 }, [
|
|
86
|
+
h.value ? (a(), u(s(h.value), c({
|
|
87
87
|
key: 0,
|
|
88
88
|
"data-ulu-tour-ui": "true",
|
|
89
89
|
step: t.value,
|
|
90
90
|
tourState: n(l),
|
|
91
|
-
api: n(
|
|
92
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : k.value ? (
|
|
91
|
+
api: n(i)
|
|
92
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : k.value ? (a(), u(s(b.value), c({
|
|
93
93
|
key: 2,
|
|
94
94
|
ref_key: "popoverBase",
|
|
95
|
-
ref:
|
|
95
|
+
ref: w,
|
|
96
96
|
trigger: v.value,
|
|
97
97
|
config: z.value,
|
|
98
98
|
style: { zIndex: 9999 },
|
|
99
99
|
isOpen: !0,
|
|
100
100
|
"data-ulu-tour-ui": "true",
|
|
101
|
-
onClose: o[1] || (o[1] = (p) => n(
|
|
101
|
+
onClose: o[1] || (o[1] = (p) => n(i).stop())
|
|
102
102
|
}, F.value), _({
|
|
103
|
-
default:
|
|
104
|
-
f.value ? (
|
|
103
|
+
default: C(() => [
|
|
104
|
+
f.value ? (a(), u(s(f.value), c({
|
|
105
105
|
key: 0,
|
|
106
106
|
step: t.value,
|
|
107
107
|
tourState: n(l),
|
|
108
|
-
api: n(
|
|
108
|
+
api: n(i),
|
|
109
109
|
"is-modal": !1
|
|
110
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (
|
|
110
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (a(), u(E, {
|
|
111
111
|
key: 1,
|
|
112
112
|
step: t.value,
|
|
113
113
|
"is-modal": !1
|
|
@@ -117,26 +117,26 @@ const Z = {
|
|
|
117
117
|
}, [
|
|
118
118
|
t.value?.hideFooter ? void 0 : {
|
|
119
119
|
name: "footer",
|
|
120
|
-
fn:
|
|
121
|
-
(
|
|
120
|
+
fn: C(() => [
|
|
121
|
+
(a(), u(s(x.value)))
|
|
122
122
|
]),
|
|
123
123
|
key: "0"
|
|
124
124
|
}
|
|
125
|
-
]), 1040, ["trigger", "config"])) : (
|
|
125
|
+
]), 1040, ["trigger", "config"])) : (a(), u(s(T.value), c({
|
|
126
126
|
key: 1,
|
|
127
127
|
modelValue: !0,
|
|
128
128
|
"data-ulu-tour-ui": "true"
|
|
129
129
|
}, L.value, {
|
|
130
|
-
onClose: o[0] || (o[0] = (p) => n(
|
|
130
|
+
onClose: o[0] || (o[0] = (p) => n(i).stop())
|
|
131
131
|
}), _({
|
|
132
|
-
default:
|
|
133
|
-
f.value ? (
|
|
132
|
+
default: C(() => [
|
|
133
|
+
f.value ? (a(), u(s(f.value), c({
|
|
134
134
|
key: 0,
|
|
135
135
|
step: t.value,
|
|
136
136
|
tourState: n(l),
|
|
137
|
-
api: n(
|
|
137
|
+
api: n(i),
|
|
138
138
|
"is-modal": !0
|
|
139
|
-
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (
|
|
139
|
+
}, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (a(), u(E, {
|
|
140
140
|
key: 1,
|
|
141
141
|
step: t.value,
|
|
142
142
|
"is-modal": !0
|
|
@@ -146,18 +146,18 @@ const Z = {
|
|
|
146
146
|
}, [
|
|
147
147
|
t.value?.hideFooter ? void 0 : {
|
|
148
148
|
name: "footer",
|
|
149
|
-
fn:
|
|
150
|
-
(
|
|
149
|
+
fn: C(() => [
|
|
150
|
+
(a(), u(s(x.value)))
|
|
151
151
|
]),
|
|
152
152
|
key: "0"
|
|
153
153
|
}
|
|
154
154
|
]), 1040)),
|
|
155
|
-
t.value?.target && t.value?.highlight &&
|
|
155
|
+
t.value?.target && t.value?.highlight && d.value ? (a(), P("div", {
|
|
156
156
|
key: 3,
|
|
157
157
|
class: "tour-highlight-backdrop",
|
|
158
158
|
style: H(I.value),
|
|
159
159
|
"data-ulu-tour-ui": "true",
|
|
160
|
-
onClick: o[2] || (o[2] = (p) => n(
|
|
160
|
+
onClick: o[2] || (o[2] = (p) => n(i).stop())
|
|
161
161
|
}, null, 4)) : S("", !0)
|
|
162
162
|
], 64)) : S("", !0)
|
|
163
163
|
]));
|
|
@@ -4,10 +4,6 @@ export type TourStep = {
|
|
|
4
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
6
|
target?: string | Function | HTMLElement | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* - Element to highlight if different from target. Falls back to target if not provided.
|
|
9
|
-
*/
|
|
10
|
-
highlightElement?: string | Function | HTMLElement | undefined;
|
|
11
7
|
/**
|
|
12
8
|
* - The title text for the step.
|
|
13
9
|
*/
|
|
@@ -53,9 +49,9 @@ export type TourStep = {
|
|
|
53
49
|
*/
|
|
54
50
|
placement?: string | undefined;
|
|
55
51
|
/**
|
|
56
|
-
* - If true, darkens the backdrop around the target element.
|
|
52
|
+
* - If true, darkens the backdrop around the target element. If a selector, element, or function is provided, the backdrop highlights that specific element instead of the target.
|
|
57
53
|
*/
|
|
58
|
-
highlight?: boolean | undefined;
|
|
54
|
+
highlight?: string | boolean | Function | HTMLElement | undefined;
|
|
59
55
|
/**
|
|
60
56
|
* - If true or returns true, this step will be skipped when navigating the tour.
|
|
61
57
|
*/
|
|
@@ -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":"AA6BO,iCAHI,MAAM,GACJ,MAAM,CAgJjB"}
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
const resolvedHighlightDescriptor = computed(() => {
|
|
113
|
-
const h = unref(currentStep.value?.
|
|
113
|
+
const h = unref(currentStep.value?.highlight);
|
|
114
114
|
if (typeof h === 'function') return unref(h());
|
|
115
115
|
return h;
|
|
116
116
|
});
|
|
@@ -204,7 +204,7 @@
|
|
|
204
204
|
targetEl.value = null;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
if (highlightDesc) {
|
|
207
|
+
if (highlightDesc && typeof highlightDesc !== 'boolean') {
|
|
208
208
|
await nextTick();
|
|
209
209
|
const hEl = typeof highlightDesc === 'string' ? document.querySelector(highlightDesc) : unref(highlightDesc);
|
|
210
210
|
if (hEl) {
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
highlightEl.value = null;
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
if (
|
|
220
|
+
if (highlightDesc) {
|
|
221
221
|
updateTargetRect();
|
|
222
222
|
}
|
|
223
223
|
}, { immediate: true });
|
package/lib/plugins/tour/api.js
CHANGED
|
@@ -3,7 +3,6 @@ import { markRaw } from "vue";
|
|
|
3
3
|
/**
|
|
4
4
|
* @typedef {Object} TourStep
|
|
5
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
|
-
* @property {String|Function|HTMLElement} [highlightElement] - Element to highlight if different from target. Falls back to target if not provided.
|
|
7
6
|
* @property {String} [title] - The title text for the step.
|
|
8
7
|
* @property {String|Array|Object} [titleClass] - Class to apply to the title.
|
|
9
8
|
* @property {String|Array|Object} [pagerClass] - Class to apply to the pager footer.
|
|
@@ -15,7 +14,7 @@ import { markRaw } from "vue";
|
|
|
15
14
|
* @property {Boolean} [hideFooter] - If true, hides the default tour footer (Next/Back buttons).
|
|
16
15
|
* @property {Boolean} [hideProgress] - If true, hides the "Part X / Y" progress indicator for this step.
|
|
17
16
|
* @property {String} [placement] - Floating UI placement string (e.g. 'bottom', 'right').
|
|
18
|
-
* @property {Boolean} [highlight] - If true, darkens the backdrop around the target element.
|
|
17
|
+
* @property {Boolean|String|Function|HTMLElement} [highlight] - If true, darkens the backdrop around the target element. If a selector, element, or function is provided, the backdrop highlights that specific element instead of the target.
|
|
19
18
|
* @property {Boolean|Function} [skip] - If true or returns true, this step will be skipped when navigating the tour.
|
|
20
19
|
* @property {Object} [modalProps] - Props to pass to the modal (if target is omitted).
|
|
21
20
|
* @property {Object} [popoverProps] - Props to pass to the popover (if target is present).
|
package/package.json
CHANGED