@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.
@@ -1,100 +1,5 @@
1
- import { nextTick } from 'vue';
2
1
  declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
3
- popoverBase: ({
4
- $: import('vue').ComponentInternalInstance;
5
- $data: {};
6
- $props: Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>;
7
- $attrs: {
8
- [x: string]: unknown;
9
- };
10
- $refs: {
11
- [x: string]: unknown;
12
- } & {
13
- contentEl: HTMLSpanElement;
14
- contentArrow: HTMLSpanElement;
15
- };
16
- $slots: Readonly<{
17
- [name: string]: import('vue').Slot<any> | undefined;
18
- }>;
19
- $root: import('vue').ComponentPublicInstance | null;
20
- $parent: import('vue').ComponentPublicInstance | null;
21
- $host: Element | null;
22
- $emit: (event: string, ...args: any[]) => void;
23
- $el: HTMLSpanElement;
24
- $options: import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {
25
- close: () => void;
26
- update: Function;
27
- content: import('vue').Ref<null, null>;
28
- $emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
29
- isOpen: boolean;
30
- clickOutsideCloses: boolean;
31
- escapeCloses: boolean;
32
- directFocus: Function;
33
- trigger: Record<string, any>;
34
- config: Record<string, any>;
35
- modifiers?: string | Record<string, any> | unknown[] | undefined;
36
- $props: {
37
- readonly isOpen?: boolean | undefined;
38
- readonly clickOutsideCloses?: boolean | undefined;
39
- readonly escapeCloses?: boolean | undefined;
40
- readonly directFocus?: Function | undefined;
41
- readonly trigger?: Record<string, any> | undefined;
42
- readonly config?: Record<string, any> | undefined;
43
- readonly modifiers?: string | Record<string, any> | unknown[] | undefined;
44
- };
45
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & {
46
- beforeCreate?: (() => void) | (() => void)[];
47
- created?: (() => void) | (() => void)[];
48
- beforeMount?: (() => void) | (() => void)[];
49
- mounted?: (() => void) | (() => void)[];
50
- beforeUpdate?: (() => void) | (() => void)[];
51
- updated?: (() => void) | (() => void)[];
52
- activated?: (() => void) | (() => void)[];
53
- deactivated?: (() => void) | (() => void)[];
54
- beforeDestroy?: (() => void) | (() => void)[];
55
- beforeUnmount?: (() => void) | (() => void)[];
56
- destroyed?: (() => void) | (() => void)[];
57
- unmounted?: (() => void) | (() => void)[];
58
- renderTracked?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
59
- renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | ((e: import('vue').DebuggerEvent) => void)[];
60
- errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void)[];
61
- };
62
- $forceUpdate: () => void;
63
- $nextTick: typeof nextTick;
64
- $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
65
- } & Readonly<{}> & Omit<Readonly<{}> & Readonly<{}>, "$props" | "$emit" | "isOpen" | "clickOutsideCloses" | "escapeCloses" | "directFocus" | "trigger" | "config" | "modifiers" | "content" | "close" | "update"> & import('vue').ShallowUnwrapRef<{
66
- close: () => void;
67
- update: Function;
68
- content: import('vue').Ref<null, null>;
69
- $emit: (event: "close" | "update:isOpen", ...args: any[]) => void;
70
- isOpen: boolean;
71
- clickOutsideCloses: boolean;
72
- escapeCloses: boolean;
73
- directFocus: Function;
74
- trigger: Record<string, any>;
75
- config: Record<string, any>;
76
- modifiers?: string | Record<string, any> | unknown[] | undefined;
77
- $props: {
78
- readonly isOpen?: boolean | undefined;
79
- readonly clickOutsideCloses?: boolean | undefined;
80
- readonly escapeCloses?: boolean | undefined;
81
- readonly directFocus?: Function | undefined;
82
- readonly trigger?: Record<string, any> | undefined;
83
- readonly config?: Record<string, any> | undefined;
84
- readonly modifiers?: string | Record<string, any> | unknown[] | undefined;
85
- };
86
- }> & {} & import('vue').ComponentCustomProperties & {} & {
87
- $slots: {
88
- default?(_: {
89
- isOpen: boolean;
90
- close: () => void;
91
- }): any;
92
- footer?(_: {
93
- isOpen: boolean;
94
- close: () => void;
95
- }): any;
96
- };
97
- }) | null;
2
+ popoverBase: any;
98
3
  }, any>;
99
4
  export default _default;
100
5
  //# sourceMappingURL=UluTourDisplay.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UluTourDisplay.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourDisplay.vue"],"names":[],"mappings":"AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCA8jByqQ,GAAG,8CAA8C,GAAG,yBAAyB,GAAG,6DAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAvXttQ,KAAK"}
1
+ {"version":3,"file":"UluTourDisplay.vue.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/UluTourDisplay.vue"],"names":[],"mappings":"AAgFA;"}
@@ -1,37 +1,40 @@
1
- import { computed as v, ref as f, watch as B, nextTick as T, onMounted as b, onUnmounted as z, createBlock as a, openBlock as o, Teleport as L, createElementBlock as y, createCommentVNode as x, unref as l, Fragment as F, resolveDynamicComponent as g, mergeProps as d, createSlots as $, withCtx as c, 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";
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
5
  import _ from "./UluTourContent.vue.js";
6
- import { useTour as D } from "./useTour.js";
7
- const G = {
6
+ import { useTour as O } from "./useTour.js";
7
+ const W = {
8
8
  __name: "UluTourDisplay",
9
- setup(M) {
10
- const { api: u, state: r } = D(), t = v(() => r.active?.steps[r.stepIndex]), i = f(null), m = f(null), C = v(() => ({
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
- })), P = v(() => ({
15
- ...r.active?.modalProps || {},
17
+ })), B = l(() => ({
18
+ ...o.active?.modalProps || {},
16
19
  ...t.value?.modalProps || {}
17
- })), S = v(() => ({
20
+ })), b = l(() => ({
18
21
  modifiers: "large",
19
- ...r.active?.popoverProps || {},
22
+ ...o.active?.popoverProps || {},
20
23
  ...t.value?.popoverProps || {}
21
- })), p = f(null), s = () => {
24
+ })), v = h(null), m = () => {
22
25
  if (i.value) {
23
26
  const e = i.value.getBoundingClientRect();
24
- p.value = {
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
- p.value = null;
32
- }, E = v(() => {
33
- if (!p.value) return {};
34
- const e = p.value;
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 G = {
56
59
  )`
57
60
  };
58
61
  });
59
- return B(t, async (e) => {
60
- if (e?.target) {
61
- await T();
62
- const n = document.querySelector(e.target);
63
- n ? (i.value = n, m.value && m.value.update(), e.highlight && s()) : console.warn(`Tour target not found: ${e.target}`);
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
- i.value = null, p.value = null;
66
- }, { immediate: !0 }), b(() => {
67
- window.addEventListener("resize", s), window.addEventListener("scroll", s);
68
- }), z(() => {
69
- window.removeEventListener("resize", s), window.removeEventListener("scroll", s);
70
- }), (e, n) => (o(), a(L, { to: "body" }, [
71
- l(r).active ? (o(), y(F, { key: 0 }, [
72
- t.value?.component ? (o(), a(g(t.value.component), d({
68
+ i.value = null, v.value = null;
69
+ }, { immediate: !0 }), F(() => {
70
+ window.addEventListener("resize", m), window.addEventListener("scroll", m);
71
+ }), I(() => {
72
+ window.removeEventListener("resize", m), window.removeEventListener("scroll", m);
73
+ }), (e, u) => (n(), a(M, { to: "body" }, [
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
- tourState: l(r),
77
- api: l(u)
78
- }, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : t.value?.target ? (o(), a(V, d({
79
+ tourState: r(o),
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
- ref: m,
84
+ ref: g,
82
85
  trigger: i.value,
83
- config: C.value,
86
+ config: T.value,
84
87
  style: { zIndex: 9999 },
85
88
  isOpen: !0,
86
89
  "data-ulu-tour-ui": "true",
87
- onClose: n[1] || (n[1] = (h) => l(u).stop())
88
- }, S.value), $({
89
- default: c(() => [
90
- t.value?.contentComponent ? (o(), a(g(t.value.contentComponent), d({
90
+ onClose: u[1] || (u[1] = (k) => r(s).stop())
91
+ }, b.value), P({
92
+ default: f(() => [
93
+ d.value ? (n(), a(p(d.value), c({
91
94
  key: 0,
92
95
  step: t.value,
93
- tourState: l(r),
94
- api: l(u),
96
+ tourState: r(o),
97
+ api: r(s),
95
98
  "is-modal": !1
96
- }, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (o(), 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
@@ -103,26 +106,26 @@ const G = {
103
106
  }, [
104
107
  t.value?.hideFooter ? void 0 : {
105
108
  name: "footer",
106
- fn: c(() => [
107
- k(w)
109
+ fn: f(() => [
110
+ (n(), a(p(C.value)))
108
111
  ]),
109
112
  key: "0"
110
113
  }
111
- ]), 1040, ["trigger", "config"])) : (o(), a(R, d({
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
- }, P.value, {
116
- onClose: n[0] || (n[0] = (h) => l(u).stop())
117
- }), $({
118
- default: c(() => [
119
- t.value?.contentComponent ? (o(), a(g(t.value.contentComponent), d({
118
+ }, B.value, {
119
+ onClose: u[0] || (u[0] = (k) => r(s).stop())
120
+ }), P({
121
+ default: f(() => [
122
+ d.value ? (n(), a(p(d.value), c({
120
123
  key: 0,
121
124
  step: t.value,
122
- tourState: l(r),
123
- api: l(u),
125
+ tourState: r(o),
126
+ api: r(s),
124
127
  "is-modal": !0
125
- }, t.value.componentProps), null, 16, ["step", "tourState", "api"])) : (o(), 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
@@ -132,23 +135,23 @@ const G = {
132
135
  }, [
133
136
  t.value?.hideFooter ? void 0 : {
134
137
  name: "footer",
135
- fn: c(() => [
136
- k(w)
138
+ fn: f(() => [
139
+ (n(), a(p(C.value)))
137
140
  ]),
138
141
  key: "0"
139
142
  }
140
143
  ]), 1040)),
141
- t.value?.target && t.value?.highlight && p.value ? (o(), y("div", {
144
+ t.value?.target && t.value?.highlight && v.value ? (n(), w("div", {
142
145
  key: 3,
143
146
  class: "tour-highlight-backdrop",
144
- style: I(E.value),
147
+ style: U(z.value),
145
148
  "data-ulu-tour-ui": "true",
146
- onClick: n[2] || (n[2] = (h) => l(u).stop())
147
- }, null, 4)) : x("", !0)
148
- ], 64)) : x("", !0)
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
- G as default
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":"AA0BO,iCAHI,MAAM,GACJ,MAAM,CAqFjB"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/api.js"],"names":[],"mappings":"AA2BO,iCAHI,MAAM,GACJ,MAAM,CA8IjB"}
@@ -1,5 +1,5 @@
1
1
  import { markRaw as o } from "vue";
2
- const s = (e) => ({
2
+ const a = (n) => ({
3
3
  /**
4
4
  * Starts a new tour
5
5
  * @param {Object} tour - The tour configuration object
@@ -10,57 +10,103 @@ const s = (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.onStart] - Async hook called before the tour starts.
13
14
  * @param {Function} [tour.onStop] - Async hook called when the tour is closed/finished.
14
15
  */
15
- async start(n) {
16
- n?.steps?.length && (await this._runHooks(n.steps[0]), e.active = o(n), e.stepIndex = 0);
16
+ async start(i) {
17
+ if (!n.isTransitioning) {
18
+ n.isTransitioning = !0;
19
+ try {
20
+ if (!i?.steps?.length) return;
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;
33
+ } finally {
34
+ n.isTransitioning = !1;
35
+ }
36
+ }
17
37
  },
18
38
  /**
19
39
  * Advances the tour to the next step, or stops if it is the last step
20
40
  */
21
41
  async next() {
22
- const n = e.active;
23
- if (n)
24
- if (e.stepIndex < n.steps.length - 1) {
25
- await this._runLeaveHook(n.steps[e.stepIndex]);
26
- const i = e.stepIndex + 1;
27
- await this._runHooks(n.steps[i]), e.stepIndex = i;
28
- } else
29
- await this.stop();
42
+ if (n.isTransitioning) return;
43
+ const i = n.active;
44
+ if (i) {
45
+ n.isTransitioning = !0;
46
+ try {
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);
54
+ } finally {
55
+ n.isTransitioning = !1;
56
+ }
57
+ }
30
58
  },
31
59
  /**
32
60
  * Returns the tour to the previous step
33
61
  */
34
62
  async prev() {
35
- const n = e.active;
36
- if (n && e.stepIndex > 0) {
37
- await this._runLeaveHook(n.steps[e.stepIndex]);
38
- const i = e.stepIndex - 1;
39
- await this._runHooks(n.steps[i]), e.stepIndex = i;
63
+ if (n.isTransitioning) return;
64
+ const i = n.active;
65
+ if (i) {
66
+ n.isTransitioning = !0;
67
+ try {
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--;
73
+ }
74
+ s >= 0 && (await this._runLeaveHook(i.steps[n.stepIndex]), await this._runHooks(i.steps[s]), n.stepIndex = s);
75
+ } finally {
76
+ n.isTransitioning = !1;
77
+ }
40
78
  }
41
79
  },
42
80
  /**
43
81
  * Stops and closes the current tour
82
+ * @param {Boolean} [internalBypass=false] - Used internally to bypass transition check
44
83
  */
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;
84
+ async stop(i = !1) {
85
+ if (!(!i && n.isTransitioning)) {
86
+ n.isTransitioning = !0;
87
+ try {
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;
90
+ } finally {
91
+ n.isTransitioning = !1;
92
+ }
93
+ }
48
94
  },
49
95
  /**
50
96
  * Internal method to run asynchronous enter hooks on a step
51
97
  * @param {Object} step - The tour step configuration
52
98
  */
53
- async _runHooks(n) {
54
- n && typeof n.onEnter == "function" && await n.onEnter();
99
+ async _runHooks(i) {
100
+ i && typeof i.onEnter == "function" && await i.onEnter();
55
101
  },
56
102
  /**
57
103
  * Internal method to run asynchronous leave hooks on a step
58
104
  * @param {Object} step - The tour step configuration
59
105
  */
60
- async _runLeaveHook(n) {
61
- n && typeof n.onLeave == "function" && await n.onLeave();
106
+ async _runLeaveHook(i) {
107
+ i && typeof i.onLeave == "function" && await i.onLeave();
62
108
  }
63
109
  });
64
110
  export {
65
- s as createApi
111
+ a as createApi
66
112
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/index.js"],"names":[],"mappings":"AAQA,gDAeC;;;;;wBAjBuB,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/plugins/tour/index.js"],"names":[],"mappings":"AAQA,gDAgBC;;;;;wBAlBuB,cAAc"}
@@ -1,14 +1,15 @@
1
- import { reactive as e } from "vue";
2
- import u from "./UluTourDisplay.vue.js";
3
- import { createApi as i } from "./api.js";
4
- function s(o) {
5
- const t = e({
1
+ import { reactive as r } from "vue";
2
+ import e from "./UluTourDisplay.vue.js";
3
+ import { createApi as u } from "./api.js";
4
+ function a(o) {
5
+ const t = r({
6
6
  active: null,
7
- stepIndex: 0
8
- }), r = i(t);
9
- o.component("UluTourDisplay", u), o.config.globalProperties.$uluTour = r, o.config.globalProperties.$uluTourState = t, o.provide("uluTour", r), o.provide("uluTourState", t);
7
+ stepIndex: 0,
8
+ isTransitioning: !1
9
+ }), i = u(t);
10
+ o.component("UluTourDisplay", e), o.config.globalProperties.$uluTour = i, o.config.globalProperties.$uluTourState = t, o.provide("uluTour", i), o.provide("uluTourState", t);
10
11
  }
11
12
  export {
12
- u as UluTourDisplay,
13
- s as default
13
+ e as UluTourDisplay,
14
+ a as default
14
15
  };
@@ -4,8 +4,8 @@
4
4
 
5
5
  <!-- 1. FULL COMPONENT TAKEOVER -->
6
6
  <component
7
- v-if="currentStep?.component"
8
- :is="currentStep.component"
7
+ v-if="resolvedComponent"
8
+ :is="resolvedComponent"
9
9
  data-ulu-tour-ui="true"
10
10
  :step="currentStep"
11
11
  :tourState="tourState"
@@ -14,16 +14,17 @@
14
14
  />
15
15
 
16
16
  <!-- 2. RENDER MODAL STEP -->
17
- <UluModal
18
- v-else-if="!currentStep?.target"
17
+ <component
18
+ v-else-if="!resolvedTargetDescriptor"
19
+ :is="resolvedModalComponent"
19
20
  :modelValue="true"
20
21
  data-ulu-tour-ui="true"
21
22
  v-bind="resolvedModalProps"
22
23
  @close="api.stop()"
23
24
  >
24
25
  <component
25
- v-if="currentStep?.contentComponent"
26
- :is="currentStep.contentComponent"
26
+ v-if="resolvedContentComponent"
27
+ :is="resolvedContentComponent"
27
28
  :step="currentStep"
28
29
  :tourState="tourState"
29
30
  :api="api"
@@ -33,13 +34,14 @@
33
34
  <UluTourContent v-else :step="currentStep" :is-modal="true" />
34
35
 
35
36
  <template #footer v-if="!currentStep?.hideFooter">
36
- <UluTourPager />
37
+ <component :is="resolvedPagerComponent" />
37
38
  </template>
38
- </UluModal>
39
+ </component>
39
40
 
40
41
  <!-- 3. RENDER POPOVER STEP -->
41
- <UluPopoverBase
42
+ <component
42
43
  v-else
44
+ :is="resolvedPopoverComponent"
43
45
  ref="popoverBase"
44
46
  :trigger="targetEl"
45
47
  :config="resolvedConfig"
@@ -50,8 +52,8 @@
50
52
  v-bind="resolvedPopoverProps"
51
53
  >
52
54
  <component
53
- v-if="currentStep?.contentComponent"
54
- :is="currentStep.contentComponent"
55
+ v-if="resolvedContentComponent"
56
+ :is="resolvedContentComponent"
55
57
  :step="currentStep"
56
58
  :tourState="tourState"
57
59
  :api="api"
@@ -61,9 +63,9 @@
61
63
  <UluTourContent v-else :step="currentStep" :is-modal="false" />
62
64
 
63
65
  <template #footer v-if="!currentStep?.hideFooter">
64
- <UluTourPager />
66
+ <component :is="resolvedPagerComponent" />
65
67
  </template>
66
- </UluPopoverBase>
68
+ </component>
67
69
 
68
70
  <!-- OPTIONAL HIGHLIGHT BACKDROP -->
69
71
  <div
@@ -89,10 +91,23 @@
89
91
 
90
92
  const currentStep = computed(() => tourState.active?.steps[tourState.stepIndex]);
91
93
 
94
+ // Component Resolution
95
+ const resolvedComponent = computed(() => currentStep.value?.component || tourState.active?.component);
96
+ const resolvedContentComponent = computed(() => currentStep.value?.contentComponent || tourState.active?.contentComponent);
97
+ const resolvedPagerComponent = computed(() => currentStep.value?.pagerComponent || tourState.active?.pagerComponent || UluTourPager);
98
+ const resolvedModalComponent = computed(() => currentStep.value?.modalComponent || tourState.active?.modalComponent || UluModal);
99
+ const resolvedPopoverComponent = computed(() => currentStep.value?.popoverComponent || tourState.active?.popoverComponent || UluPopoverBase);
100
+
92
101
  // Floating UI Setup for Popovers
93
102
  const targetEl = ref(null);
94
103
  const popoverBase = ref(null);
95
104
 
105
+ const resolvedTargetDescriptor = computed(() => {
106
+ const t = currentStep.value?.target;
107
+ if (typeof t === 'function') return t();
108
+ return t;
109
+ });
110
+
96
111
  const resolvedConfig = computed(() => ({
97
112
  placement: currentStep.value?.placement || 'bottom',
98
113
  arrow: true,
@@ -161,10 +176,10 @@
161
176
  });
162
177
 
163
178
  // Watch for step changes to update floating UI target
164
- watch(currentStep, async (step) => {
165
- if (step?.target) {
179
+ watch(resolvedTargetDescriptor, async (descriptor) => {
180
+ if (descriptor) {
166
181
  await nextTick();
167
- const el = document.querySelector(step.target);
182
+ const el = typeof descriptor === 'string' ? document.querySelector(descriptor) : descriptor;
168
183
  if (el) {
169
184
  targetEl.value = el;
170
185
  // UluPopoverBase's isOpen watcher automatically calls update(),
@@ -173,11 +188,12 @@
173
188
  if (popoverBase.value) {
174
189
  popoverBase.value.update();
175
190
  }
176
- if (step.highlight) {
191
+ if (currentStep.value?.highlight) {
177
192
  updateTargetRect();
178
193
  }
179
194
  } else {
180
- console.warn(`Tour target not found: ${step.target}`);
195
+ console.warn(`Tour target not found:`, descriptor);
196
+ targetEl.value = null;
181
197
  }
182
198
  } else {
183
199
  targetEl.value = null;