@ulu/frontend-vue 0.6.30 → 0.6.32
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 +367 -322
- package/dist/plugins/tour/UluTourDisplay.vue.d.ts.map +1 -1
- package/dist/plugins/tour/UluTourDisplay.vue.js +60 -48
- 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/UluTourDisplay.vue +8 -0
- package/lib/plugins/tour/api.js +25 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluTourDisplay.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourDisplay.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UluTourDisplay.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourDisplay.vue"],"names":[],"mappings":"AA2EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAqjBs3Q,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAjXn6Q,KAAK"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { computed as s, ref as f, watch as B, nextTick as T, onMounted as b, onUnmounted as z, createBlock as r, openBlock as o, Teleport as L, createElementBlock as y, createCommentVNode as x, unref as u, Fragment as F, resolveDynamicComponent as g, mergeProps as v, createSlots as $, withCtx as d, createVNode as k, normalizeStyle as I } from "vue";
|
|
2
|
+
import R from "../../components/collapsible/UluModal.vue.js";
|
|
3
|
+
import V from "../popovers/UluPopoverBase.vue.js";
|
|
4
|
+
import w from "./UluTourPager.vue.js";
|
|
5
5
|
import _ from "./UluTourContent.vue.js";
|
|
6
|
-
import { useTour as
|
|
7
|
-
const
|
|
6
|
+
import { useTour as D } from "./useTour.js";
|
|
7
|
+
const G = {
|
|
8
8
|
__name: "UluTourDisplay",
|
|
9
|
-
setup(
|
|
10
|
-
const { api:
|
|
9
|
+
setup(M) {
|
|
10
|
+
const { api: c, state: n } = D(), t = s(() => n.active?.steps[n.stepIndex]), p = f(null), m = f(null), C = s(() => ({
|
|
11
11
|
placement: t.value?.placement || "bottom",
|
|
12
12
|
arrow: !0,
|
|
13
13
|
offset: 8
|
|
14
|
-
})),
|
|
15
|
-
...
|
|
14
|
+
})), P = s(() => ({
|
|
15
|
+
...n.active?.modalProps || {},
|
|
16
16
|
...t.value?.modalProps || {}
|
|
17
|
-
})),
|
|
17
|
+
})), S = s(() => ({
|
|
18
18
|
modifiers: "large",
|
|
19
|
-
...
|
|
19
|
+
...n.active?.popoverProps || {},
|
|
20
20
|
...t.value?.popoverProps || {}
|
|
21
|
-
})),
|
|
22
|
-
if (
|
|
23
|
-
const e =
|
|
24
|
-
|
|
21
|
+
})), a = f(null), i = () => {
|
|
22
|
+
if (p.value) {
|
|
23
|
+
const e = p.value.getBoundingClientRect();
|
|
24
|
+
a.value = {
|
|
25
25
|
top: e.top,
|
|
26
26
|
left: e.left,
|
|
27
27
|
width: e.width,
|
|
28
28
|
height: e.height
|
|
29
29
|
};
|
|
30
30
|
} else
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
if (!
|
|
34
|
-
const e =
|
|
31
|
+
a.value = null;
|
|
32
|
+
}, E = s(() => {
|
|
33
|
+
if (!a.value) return {};
|
|
34
|
+
const e = a.value;
|
|
35
35
|
return {
|
|
36
36
|
position: "fixed",
|
|
37
37
|
top: 0,
|
|
@@ -56,35 +56,42 @@ const H = {
|
|
|
56
56
|
)`
|
|
57
57
|
};
|
|
58
58
|
});
|
|
59
|
-
return
|
|
59
|
+
return B(t, async (e) => {
|
|
60
60
|
if (e?.target) {
|
|
61
61
|
await T();
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const l = document.querySelector(e.target);
|
|
63
|
+
l ? (p.value = l, m.value && m.value.update(), e.highlight && i()) : console.warn(`Tour target not found: ${e.target}`);
|
|
64
64
|
} else
|
|
65
|
-
|
|
65
|
+
p.value = null, a.value = null;
|
|
66
66
|
}, { immediate: !0 }), b(() => {
|
|
67
67
|
window.addEventListener("resize", i), window.addEventListener("scroll", i);
|
|
68
|
-
}),
|
|
68
|
+
}), z(() => {
|
|
69
69
|
window.removeEventListener("resize", i), window.removeEventListener("scroll", i);
|
|
70
|
-
}), (e,
|
|
71
|
-
|
|
72
|
-
t.value?.component ? (o(),
|
|
70
|
+
}), (e, l) => (o(), r(L, { to: "body" }, [
|
|
71
|
+
u(n).active ? (o(), y(F, { key: 0 }, [
|
|
72
|
+
t.value?.component ? (o(), r(g(t.value.component), v({
|
|
73
73
|
key: 0,
|
|
74
|
-
"data-ulu-tour-ui": "true"
|
|
75
|
-
|
|
74
|
+
"data-ulu-tour-ui": "true",
|
|
75
|
+
step: t.value,
|
|
76
|
+
tourState: u(n)
|
|
77
|
+
}, t.value.componentProps), null, 16, ["step", "tourState"])) : t.value?.target ? (o(), r(V, v({
|
|
76
78
|
key: 2,
|
|
77
79
|
ref_key: "popoverBase",
|
|
78
80
|
ref: m,
|
|
79
|
-
trigger:
|
|
81
|
+
trigger: p.value,
|
|
80
82
|
config: C.value,
|
|
81
83
|
style: { zIndex: 9999 },
|
|
82
84
|
isOpen: !0,
|
|
83
85
|
"data-ulu-tour-ui": "true",
|
|
84
|
-
onClose:
|
|
85
|
-
},
|
|
86
|
-
default:
|
|
87
|
-
t.value?.contentComponent ? (o(),
|
|
86
|
+
onClose: l[1] || (l[1] = (h) => u(c).stop())
|
|
87
|
+
}, S.value), $({
|
|
88
|
+
default: d(() => [
|
|
89
|
+
t.value?.contentComponent ? (o(), r(g(t.value.contentComponent), v({
|
|
90
|
+
key: 0,
|
|
91
|
+
step: t.value,
|
|
92
|
+
tourState: u(n),
|
|
93
|
+
"is-modal": !1
|
|
94
|
+
}, t.value.componentProps), null, 16, ["step", "tourState"])) : (o(), r(_, {
|
|
88
95
|
key: 1,
|
|
89
96
|
step: t.value,
|
|
90
97
|
"is-modal": !1
|
|
@@ -94,20 +101,25 @@ const H = {
|
|
|
94
101
|
}, [
|
|
95
102
|
t.value?.hideFooter ? void 0 : {
|
|
96
103
|
name: "footer",
|
|
97
|
-
fn:
|
|
98
|
-
w
|
|
104
|
+
fn: d(() => [
|
|
105
|
+
k(w)
|
|
99
106
|
]),
|
|
100
107
|
key: "0"
|
|
101
108
|
}
|
|
102
|
-
]), 1040, ["trigger", "config"])) : (o(),
|
|
109
|
+
]), 1040, ["trigger", "config"])) : (o(), r(R, v({
|
|
103
110
|
key: 1,
|
|
104
111
|
modelValue: !0,
|
|
105
112
|
"data-ulu-tour-ui": "true"
|
|
106
|
-
},
|
|
107
|
-
onClose:
|
|
113
|
+
}, P.value, {
|
|
114
|
+
onClose: l[0] || (l[0] = (h) => u(c).stop())
|
|
108
115
|
}), $({
|
|
109
|
-
default:
|
|
110
|
-
t.value?.contentComponent ? (o(),
|
|
116
|
+
default: d(() => [
|
|
117
|
+
t.value?.contentComponent ? (o(), r(g(t.value.contentComponent), v({
|
|
118
|
+
key: 0,
|
|
119
|
+
step: t.value,
|
|
120
|
+
tourState: u(n),
|
|
121
|
+
"is-modal": !0
|
|
122
|
+
}, t.value.componentProps), null, 16, ["step", "tourState"])) : (o(), r(_, {
|
|
111
123
|
key: 1,
|
|
112
124
|
step: t.value,
|
|
113
125
|
"is-modal": !0
|
|
@@ -117,23 +129,23 @@ const H = {
|
|
|
117
129
|
}, [
|
|
118
130
|
t.value?.hideFooter ? void 0 : {
|
|
119
131
|
name: "footer",
|
|
120
|
-
fn:
|
|
121
|
-
w
|
|
132
|
+
fn: d(() => [
|
|
133
|
+
k(w)
|
|
122
134
|
]),
|
|
123
135
|
key: "0"
|
|
124
136
|
}
|
|
125
137
|
]), 1040)),
|
|
126
|
-
t.value?.target && t.value?.highlight &&
|
|
138
|
+
t.value?.target && t.value?.highlight && a.value ? (o(), y("div", {
|
|
127
139
|
key: 3,
|
|
128
140
|
class: "tour-highlight-backdrop",
|
|
129
|
-
style:
|
|
141
|
+
style: I(E.value),
|
|
130
142
|
"data-ulu-tour-ui": "true",
|
|
131
|
-
onClick:
|
|
143
|
+
onClick: l[2] || (l[2] = (h) => u(c).stop())
|
|
132
144
|
}, null, 4)) : x("", !0)
|
|
133
145
|
], 64)) : x("", !0)
|
|
134
146
|
]));
|
|
135
147
|
}
|
|
136
148
|
};
|
|
137
149
|
export {
|
|
138
|
-
|
|
150
|
+
G as default
|
|
139
151
|
};
|
|
@@ -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
|
};
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
v-if="currentStep?.component"
|
|
8
8
|
:is="currentStep.component"
|
|
9
9
|
data-ulu-tour-ui="true"
|
|
10
|
+
:step="currentStep"
|
|
11
|
+
:tourState="tourState"
|
|
10
12
|
v-bind="currentStep.componentProps"
|
|
11
13
|
/>
|
|
12
14
|
|
|
@@ -21,6 +23,9 @@
|
|
|
21
23
|
<component
|
|
22
24
|
v-if="currentStep?.contentComponent"
|
|
23
25
|
:is="currentStep.contentComponent"
|
|
26
|
+
:step="currentStep"
|
|
27
|
+
:tourState="tourState"
|
|
28
|
+
:is-modal="true"
|
|
24
29
|
v-bind="currentStep.componentProps"
|
|
25
30
|
/>
|
|
26
31
|
<UluTourContent v-else :step="currentStep" :is-modal="true" />
|
|
@@ -45,6 +50,9 @@
|
|
|
45
50
|
<component
|
|
46
51
|
v-if="currentStep?.contentComponent"
|
|
47
52
|
:is="currentStep.contentComponent"
|
|
53
|
+
:step="currentStep"
|
|
54
|
+
:tourState="tourState"
|
|
55
|
+
:is-modal="false"
|
|
48
56
|
v-bind="currentStep.componentProps"
|
|
49
57
|
/>
|
|
50
58
|
<UluTourContent v-else :step="currentStep" :is-modal="false" />
|
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