Comparing version
@@ -1,19 +0,24 @@ | ||
var Q = Object.defineProperty; | ||
var B = (h) => { | ||
throw TypeError(h); | ||
var Y = Object.defineProperty; | ||
var B = (r) => { | ||
throw TypeError(r); | ||
}; | ||
var X = (h, t, i) => t in h ? Q(h, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : h[t] = i; | ||
var p = (h, t, i) => X(h, typeof t != "symbol" ? t + "" : t, i), M = (h, t, i) => t.has(h) || B("Cannot " + i); | ||
var _ = (h, t, i) => (M(h, t, "read from private field"), i ? i.call(h) : t.get(h)), b = (h, t, i) => t.has(h) ? B("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(h) : t.set(h, i), C = (h, t, i, e) => (M(h, t, "write to private field"), e ? e.call(h, i) : t.set(h, i), i), u = (h, t, i) => (M(h, t, "access private method"), i); | ||
function G(h) { | ||
const t = /* @__PURE__ */ new Map(), i = [], e = []; | ||
for (const s of h) | ||
(s == null ? void 0 : s.order) === void 0 ? i.push(s) : (s == null ? void 0 : s.order) > h.length || (s == null ? void 0 : s.order) < 0 ? e.push(s) : t.set(s.order, s); | ||
const n = new Array(h.length); | ||
let a = 0, l = 0; | ||
for (let s = 0; s < h.length; s++) | ||
t.has(s) ? n[s] = t.get(s) : a < i.length ? n[s] = i[a++] : n[s] = e[l++]; | ||
return n.length === h.length ? n : n.slice(0, h.length); | ||
var X = (r, t, i) => t in r ? Y(r, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[t] = i; | ||
var p = (r, t, i) => X(r, typeof t != "symbol" ? t + "" : t, i), M = (r, t, i) => t.has(r) || B("Cannot " + i); | ||
var _ = (r, t, i) => (M(r, t, "read from private field"), i ? i.call(r) : t.get(r)), S = (r, t, i) => t.has(r) ? B("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(r) : t.set(r, i), C = (r, t, i, e) => (M(r, t, "write to private field"), e ? e.call(r, i) : t.set(r, i), i), v = (r, t, i) => (M(r, t, "access private method"), i); | ||
function G(r) { | ||
const t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), e = [], n = []; | ||
for (const l of r) | ||
(l == null ? void 0 : l.order) === void 0 ? e.push(l) : (l == null ? void 0 : l.order) > r.length || (l == null ? void 0 : l.order) < 0 ? n.push(l) : t.has(l.order) ? i.set(l.order, l) : t.set(l.order, l); | ||
const a = new Array(r.length); | ||
let s = 0, o = 0; | ||
for (let l = 0; l < r.length; l++) | ||
if (t.has(l)) { | ||
if (a[l] = t.get(l), i.has(l)) { | ||
const h = l + 1; | ||
a[h] = i.get(l), l = h; | ||
} | ||
} else s < e.length ? a[l] = e[s++] : a[l] = n[o++]; | ||
return a.length === r.length ? a : a.slice(0, r.length); | ||
} | ||
function N(h) { | ||
function H(r) { | ||
const t = {}, i = [ | ||
@@ -25,17 +30,17 @@ "id", | ||
]; | ||
for (let e = 0; e < h.length; e++) { | ||
const n = h[e]; | ||
for (let e = 0; e < r.length; e++) { | ||
const n = r[e]; | ||
Object.keys(n).forEach((a) => { | ||
if (!i.includes(a)) { | ||
const l = n[a]; | ||
l && typeof l == "object" && Object.keys(l).forEach((s) => { | ||
if (s === "default") return; | ||
const o = { | ||
const s = n[a]; | ||
s && typeof s == "object" && Object.keys(s).forEach((o) => { | ||
if (o === "default") return; | ||
const l = { | ||
id: n.id, | ||
key: a, | ||
value: l[s], | ||
media_query: s, | ||
default: l.default | ||
value: s[o], | ||
media_query: o, | ||
default: s.default | ||
}; | ||
t[s] ? t[s].push(o) : t[s] = [o]; | ||
t[o] ? t[o].push(l) : t[o] = [l]; | ||
}); | ||
@@ -47,7 +52,7 @@ } | ||
} | ||
function $(h, t, i) { | ||
const e = JSON.parse(JSON.stringify(h)); | ||
function $(r, t, i) { | ||
const e = JSON.parse(JSON.stringify(r)); | ||
return t.forEach((n) => { | ||
const a = e.findIndex( | ||
(l) => (l == null ? void 0 : l.id) === n.id | ||
(s) => (s == null ? void 0 : s.id) === n.id | ||
); | ||
@@ -57,5 +62,5 @@ a > -1 && (e[a][n.key] = n[i]); | ||
} | ||
function z(h, t) { | ||
function U(r, t) { | ||
let i = JSON.parse( | ||
JSON.stringify(h) | ||
JSON.stringify(r) | ||
); | ||
@@ -70,15 +75,15 @@ return Object.values(t).forEach((e) => { | ||
} | ||
const F = (h, t, i) => (i = Math.max(0, Math.min(1, i)), h + (t - h) * i); | ||
function K(h, t) { | ||
const E = (r, t, i) => (i = Math.max(0, Math.min(1, i)), r + (t - r) * i); | ||
function K(r, t) { | ||
let i = null; | ||
return function(...e) { | ||
i && clearTimeout(i), i = setTimeout(() => { | ||
h(...e), clearTimeout(i), i = null; | ||
r(...e), clearTimeout(i), i = null; | ||
}, t); | ||
}; | ||
} | ||
function R(h) { | ||
function D(r) { | ||
const t = /* @__PURE__ */ new Set(), i = []; | ||
for (let e = 0; e < h.length; e++) { | ||
const n = h[e], a = `step-${e + Math.random()}`; | ||
for (let e = 0; e < r.length; e++) { | ||
const n = r[e], a = `step-${e + Math.random()}`; | ||
n.id ? t.has(n.id) ? (console.warn( | ||
@@ -92,9 +97,10 @@ `Duplicate ajala step id found: ${n.id}. Please make sure all step ids are unique.` | ||
} | ||
var O, U, W, V; | ||
var O, V, W, J; | ||
class tt { | ||
constructor(t) { | ||
b(this, O); | ||
S(this, O); | ||
p(this, "ajala"); | ||
p(this, "tooltip_element"); | ||
p(this, "wrapper_element"); | ||
p(this, "style_element"); | ||
p(this, "tooltip_container_element"); | ||
@@ -116,7 +122,7 @@ p(this, "arrow_element"); | ||
"path" | ||
), this.arrow_element = document.createElement("div"), this.next_btn = null, this.prev_btn = null, this.close_btn = null, this.closeOnOverlayClickHandler = this.closeOnOverlayClickHandler.bind(this), this.refresh = K(this.refresh.bind(this), 200); | ||
), this.arrow_element = document.createElement("div"), this.style_element = document.createElement("style"), this.next_btn = null, this.prev_btn = null, this.close_btn = null, this.closeOnOverlayClickHandler = this.closeOnOverlayClickHandler.bind(this), this.refresh = K(this.refresh.bind(this), 200); | ||
} | ||
init() { | ||
var e, n, a, l, s, o, c, d, r, m; | ||
this.tooltip_element = this.ajala.options.custom_tooltip || document.createElement("div"), this.tooltip_container_element = document.createElement("div"), this.next_btn = null, this.prev_btn = null, this.close_btn = null, this.overlay_path.addEventListener( | ||
var i, e, n, a, s, o, l, h, d, c; | ||
this.wrapper_element = document.createElement("div"), this.tooltip_element = this.ajala.options.custom_tooltip || document.createElement("div"), this.tooltip_container_element = document.createElement("div"), this.next_btn = null, this.prev_btn = null, this.close_btn = null, this.overlay_path.addEventListener( | ||
"click", | ||
@@ -127,42 +133,24 @@ this.closeOnOverlayClickHandler | ||
this.closeOnOverlayClickHandler | ||
), this.ajala.options.custom_tooltip || u(this, O, U).call(this), this.ajala.options.custom_arrow ? this.arrow_element.appendChild(this.ajala.options.custom_arrow) : u(this, O, W).call(this); | ||
const t = (e = this.ajala.options.default_arrow_options) != null && e.size ? `${(n = this.ajala.options.default_arrow_options) == null ? void 0 : n.size}px` : "48px"; | ||
this.arrow_element.style.position = "absolute", this.arrow_element.style.width = t, this.arrow_element.style.height = t, this.arrow_element.style.top = "0px", this.arrow_element.style.left = "0px", this.arrow_element.style.fill = ((a = this.ajala.options.default_arrow_options) == null ? void 0 : a.color) || "#000000", this.arrow_element.style.zIndex = "2", this.arrow_element.style.pointerEvents = "none", this.arrow_element.classList.add("ajala_tooltip_arrow"), (l = this.ajala.options.default_arrow_options) != null && l.hide || this.tooltip_container_element.appendChild(this.arrow_element), this.tooltip_container_element.style.position = "fixed", this.tooltip_container_element.style.top = "0px", this.tooltip_container_element.style.left = "0px", this.tooltip_container_element.style.zIndex = "20", this.tooltip_container_element.style.width = (s = this.ajala.options) != null && s.tooltip_width ? `${(o = this.ajala.options) == null ? void 0 : o.tooltip_width}px` : "250px", this.tooltip_container_element.style.height = (c = this.ajala.options) != null && c.tooltip_height ? `${(d = this.ajala.options) == null ? void 0 : d.tooltip_height}px` : "180px", this.tooltip_container_element.style.pointerEvents = "auto", this.tooltip_container_element.classList.add("ajala_tooltip_container"), this.tooltip_container_element.appendChild(this.tooltip_element), this.tooltip_container_element.style.transform = "translate(0px, 0px)", this.wrapper_element.style.position = "fixed", this.wrapper_element.style.top = "0px", this.wrapper_element.style.left = "0px", this.wrapper_element.style.zIndex = "9999999", this.wrapper_element.classList.add("ajala"), this.wrapper_element.append(this.tooltip_container_element); | ||
const i = document.createElement("style"); | ||
i.innerHTML = ` | ||
.ajala_isOverlay.ajala_active * { | ||
pointer-events: none; | ||
} | ||
.ajala_target_interactive, .ajala_target_interactive * { | ||
pointer-events: auto !important; | ||
} | ||
.ajala_tooltip_container * { | ||
pointer-events: auto !important; | ||
} | ||
.ajala_tooltip_arrow, .ajala_tooltip_arrow * { | ||
pointer-events: none !important; | ||
} | ||
`, document.head.appendChild(i), (typeof ((r = this.ajala.options.overlay_options) == null ? void 0 : r.hide) > "u" || !((m = this.ajala.options.overlay_options) != null && m.hide)) && (u(this, O, V).call(this), this.wrapper_element.append(this.overlay_element), document.body.classList.add("ajala_isOverlay")); | ||
), this.ajala.options.custom_tooltip || v(this, O, V).call(this), this.ajala.options.custom_arrow ? this.arrow_element.appendChild(this.ajala.options.custom_arrow) : v(this, O, W).call(this); | ||
const t = (i = this.ajala.options.default_arrow_options) != null && i.size ? `${(e = this.ajala.options.default_arrow_options) == null ? void 0 : e.size}px` : "48px"; | ||
this.arrow_element.style.position = "absolute", this.arrow_element.style.width = t, this.arrow_element.style.height = t, this.arrow_element.style.top = "0px", this.arrow_element.style.left = "0px", this.arrow_element.style.fill = ((n = this.ajala.options.default_arrow_options) == null ? void 0 : n.color) || "#000000", this.arrow_element.style.zIndex = "2", this.arrow_element.style.pointerEvents = "none", this.arrow_element.classList.add("ajala_tooltip_arrow"), (a = this.ajala.options.default_arrow_options) != null && a.hide || this.tooltip_container_element.appendChild(this.arrow_element), this.tooltip_container_element.style.position = "fixed", this.tooltip_container_element.style.top = "0px", this.tooltip_container_element.style.left = "0px", this.tooltip_container_element.style.zIndex = "20", this.tooltip_container_element.style.width = (s = this.ajala.options) != null && s.tooltip_width ? `${(o = this.ajala.options) == null ? void 0 : o.tooltip_width}px` : "250px", this.tooltip_container_element.style.height = (l = this.ajala.options) != null && l.tooltip_height ? `${(h = this.ajala.options) == null ? void 0 : h.tooltip_height}px` : "180px", this.tooltip_container_element.style.pointerEvents = "auto", this.tooltip_container_element.classList.add("ajala_tooltip_container"), this.tooltip_container_element.appendChild(this.tooltip_element), this.tooltip_container_element.style.transform = "translate(0px, 0px)", this.wrapper_element.style.position = "fixed", this.wrapper_element.style.top = "0px", this.wrapper_element.style.left = "0px", this.wrapper_element.style.zIndex = "9999999", this.wrapper_element.classList.add("ajala"), this.wrapper_element.append(this.tooltip_container_element), (typeof ((d = this.ajala.options.overlay_options) == null ? void 0 : d.hide) > "u" || !((c = this.ajala.options.overlay_options) != null && c.hide)) && (v(this, O, J).call(this), this.wrapper_element.append(this.overlay_element), document.body.classList.add("ajala_isOverlay")); | ||
} | ||
update(t) { | ||
var e, n, a, l; | ||
var e, n, a, s; | ||
const i = this.ajala.options.default_tooltip_options; | ||
if (this.is_default_tooltip_element) { | ||
if (!(i != null && i.hide_dot_nav)) { | ||
const o = this.ajala.getFlattenSteps().map((d, r) => { | ||
const l = this.ajala.getFlattenSteps().map((d, c) => { | ||
const m = document.createElement("div"); | ||
return m.classList.add("ajala_dot_nav"), r === this.ajala.getActiveStepFlattenIndex() && m.classList.add("ajala_dot_nav_active"), m; | ||
}), c = this.wrapper_element.querySelector(".ajala_dot_navs"); | ||
c && c.replaceChildren(...o); | ||
return m.classList.add("ajala_dot_nav"), c === this.ajala.getActiveStepFlattenIndex() && m.classList.add("ajala_dot_nav_active"), m; | ||
}), h = this.wrapper_element.querySelector(".ajala_dot_navs"); | ||
h && h.replaceChildren(...l); | ||
} | ||
if (!(i != null && i.hide_title)) { | ||
const s = document.querySelector(".ajala_title"); | ||
s && (s.innerText = ((e = this.ajala.active_step) == null ? void 0 : e.title) ?? ""); | ||
const o = document.querySelector(".ajala_title"); | ||
o && (o.innerText = ((e = this.ajala.active_step) == null ? void 0 : e.title) ?? ""); | ||
} | ||
if (!(i != null && i.hide_content)) { | ||
const s = document.querySelector(".ajala_content"); | ||
s && (s.innerText = ((n = this.ajala.active_step) == null ? void 0 : n.content) ?? ""); | ||
const o = document.querySelector(".ajala_content"); | ||
o && (o.innerText = ((n = this.ajala.active_step) == null ? void 0 : n.content) ?? ""); | ||
} | ||
@@ -172,9 +160,9 @@ this.next_btn && (this.next_btn.innerText = "Next"); | ||
if (t) { | ||
const { active_index: s, placement: o, taregt_el: c } = t; | ||
if ((((a = this.ajala.active_step) == null ? void 0 : a.enable_target_interaction) ?? ((l = this.ajala.options) == null ? void 0 : l.enable_target_interaction)) && c && c.classList.add("ajala_target_interactive"), this.ajala.getFlattenSteps().length - 1 === this.ajala.getActiveStepFlattenIndex() && this.next_btn && (this.next_btn.innerText = "Finish"), c) { | ||
const { x: r, y: m, rotate: g } = this.placement.arrow.calculatePlacmentDelta({ | ||
active_index: s, | ||
placement: o | ||
const { active_index: o, placement: l, taregt_el: h } = t; | ||
if ((((a = this.ajala.active_step) == null ? void 0 : a.enable_target_interaction) ?? ((s = this.ajala.options) == null ? void 0 : s.enable_target_interaction)) && h && h.classList.add("ajala_target_interactive"), this.ajala.getFlattenSteps().length - 1 === this.ajala.getActiveStepFlattenIndex() && this.next_btn && (this.next_btn.innerText = "Finish"), h) { | ||
const { x: c, y: m, rotate: g } = this.placement.arrow.calculatePlacmentDelta({ | ||
active_index: o, | ||
placement: l | ||
}); | ||
this.arrow_element.style.visibility = "visible", this.arrow_element.style.transform = `translate(${r}px, ${m}px) rotate(${g}deg)`; | ||
this.arrow_element.style.visibility = "visible", this.arrow_element.style.transform = `translate(${c}px, ${m}px) rotate(${g}deg)`; | ||
} else | ||
@@ -191,3 +179,3 @@ this.arrow_element.style.visibility = "hidden"; | ||
}) { | ||
const l = ` | ||
const s = ` | ||
M${t + a},${i} | ||
@@ -203,7 +191,7 @@ h${Math.max(n - 2 * a, 0)} | ||
z | ||
`, s = ` | ||
`, o = ` | ||
M${window.innerWidth},0 L0,0 L0,${window.innerHeight} L${window.innerWidth},${window.innerHeight} L${window.innerWidth},0 Z | ||
${l} | ||
${s} | ||
`; | ||
this.overlay_path.setAttribute("d", s); | ||
this.overlay_path.setAttribute("d", o); | ||
} | ||
@@ -234,3 +222,3 @@ resetOverlayCutoutSvgRect() { | ||
var i, e, n; | ||
this.wrapper_element.remove(), document.body.classList.remove("ajala_active"), document.body.style.overflow = "hidden", this.ajala.dispatchEvent({ | ||
document.body.classList.remove("ajala_active"), document.body.style.overflow = "hidden", this.ajala.dispatchEvent({ | ||
type: "onBeforeDomInsert", | ||
@@ -253,3 +241,19 @@ data: { | ||
const t = this.tooltip_container_element.getBoundingClientRect(); | ||
this.tooltip_container_element.style.transform = `translate(-${t.width}px, 0px)`, this.resetOverlayCutoutSvgRect(), this.next_btn && (this.next_btn.innerText = "Next"), this.navigation && ((i = this.next_btn) == null || i.addEventListener("click", this.navigation.next), (e = this.prev_btn) == null || e.addEventListener("click", this.navigation.prev), (n = this.close_btn) == null || n.addEventListener("click", this.navigation.close)), window.addEventListener("resize", this.refresh); | ||
this.tooltip_container_element.style.transform = `translate(-${t.width}px, 0px)`, this.resetOverlayCutoutSvgRect(), this.style_element.innerHTML = ` | ||
.ajala_isOverlay.ajala_active * { | ||
pointer-events: none; | ||
} | ||
.ajala_target_interactive, .ajala_target_interactive * { | ||
pointer-events: auto !important; | ||
} | ||
.ajala_tooltip_container * { | ||
pointer-events: auto !important; | ||
} | ||
.ajala_tooltip_arrow, .ajala_tooltip_arrow * { | ||
pointer-events: none !important; | ||
} | ||
`, document.head.appendChild(this.style_element), this.next_btn && (this.next_btn.innerText = "Next"), this.navigation && ((i = this.next_btn) == null || i.addEventListener("click", this.navigation.next), (e = this.prev_btn) == null || e.addEventListener("click", this.navigation.prev), (n = this.close_btn) == null || n.addEventListener("click", this.navigation.close)), window.addEventListener("resize", this.refresh); | ||
} | ||
@@ -261,3 +265,3 @@ closeOnOverlayClickHandler() { | ||
async refresh() { | ||
if (console.log("this.ajala.is_active", this.ajala.is_active, this.ajala), !this.ajala.is_active) return; | ||
if (!this.ajala.is_active) return; | ||
const t = () => { | ||
@@ -268,3 +272,3 @@ var e; | ||
}; | ||
console.log("recalaculate Called"), t(), setTimeout(t, 1e3); | ||
t(), setTimeout(t, 1e3); | ||
} | ||
@@ -280,3 +284,3 @@ destroy() { | ||
} | ||
}), document.body.removeChild(this.wrapper_element), this.ajala.dispatchEvent({ | ||
}), document.head.removeChild(this.style_element), document.body.removeChild(this.wrapper_element), this.ajala.dispatchEvent({ | ||
type: "onAfterDomRemove", | ||
@@ -299,4 +303,4 @@ data: { | ||
} | ||
O = new WeakSet(), U = function() { | ||
var n, a, l, s, o, c; | ||
O = new WeakSet(), V = function() { | ||
var n, a, s, o, l, h; | ||
this.is_default_tooltip_element = !0; | ||
@@ -338,3 +342,3 @@ const t = this.ajala.options.default_tooltip_options; | ||
<button class="ajala_btn_next">Next</button> | ||
</div>`, this.next_btn = this.tooltip_element.querySelector(".ajala_btn_next"), this.prev_btn = this.tooltip_element.querySelector(".ajala_btn_prev"), this.close_btn = this.tooltip_element.querySelector(".ajala_close_btn"), t != null && t.class_name && this.tooltip_element.classList.add(t.class_name), t != null && t.hide_dot_nav && ((l = this.tooltip_element.querySelector(".ajala_dot_navs")) == null || l.remove()), t != null && t.hide_title && ((s = this.tooltip_element.querySelector(".ajala_title")) == null || s.remove()), t != null && t.hide_content && ((o = this.tooltip_element.querySelector(".ajala_content")) == null || o.remove()), t != null && t.hide_close_btn && ((c = this.close_btn) == null || c.remove()); | ||
</div>`, this.next_btn = this.tooltip_element.querySelector(".ajala_btn_next"), this.prev_btn = this.tooltip_element.querySelector(".ajala_btn_prev"), this.close_btn = this.tooltip_element.querySelector(".ajala_close_btn"), t != null && t.class_name && this.tooltip_element.classList.add(t.class_name), t != null && t.hide_dot_nav && ((s = this.tooltip_element.querySelector(".ajala_dot_navs")) == null || s.remove()), t != null && t.hide_title && ((o = this.tooltip_element.querySelector(".ajala_title")) == null || o.remove()), t != null && t.hide_content && ((l = this.tooltip_element.querySelector(".ajala_content")) == null || l.remove()), t != null && t.hide_close_btn && ((h = this.close_btn) == null || h.remove()); | ||
}, W = function() { | ||
@@ -346,3 +350,3 @@ var i, e; | ||
`; | ||
}, V = function() { | ||
}, J = function() { | ||
var e, n, a; | ||
@@ -380,7 +384,7 @@ const t = ((n = (e = this.ajala.options.overlay_options) == null ? void 0 : e.opacity) == null ? void 0 : n.toString()) || " 0.7", i = ((a = this.ajala.options.overlay_options) == null ? void 0 : a.color) || " black"; | ||
a && t !== this.ajala.getActiveStepFlattenIndex() && a(this.ajala.getActiveStep(), this.ajala); | ||
const l = await this.placement.tooltip.calculateTravelDistance(t), s = () => { | ||
var c; | ||
this.animations.is_animating = !1, this.ajala.active_step = this.ajala.getFlattenSteps()[l.active_index], this.ui.update(l); | ||
const o = (c = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : c.onActive; | ||
o && o(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
const s = await this.placement.tooltip.calculateTravelDistance(t), o = () => { | ||
var h; | ||
this.animations.is_animating = !1, this.ajala.active_step = this.ajala.getFlattenSteps()[s.active_index], this.ui.update(s); | ||
const l = (h = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : h.onActive; | ||
l && l(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
type: "onTransitionComplete", | ||
@@ -394,5 +398,5 @@ data: { | ||
this.animations.transition[this.animations.transition_type]( | ||
l, | ||
s, | ||
{ | ||
onComplete: s | ||
onComplete: o | ||
} | ||
@@ -415,6 +419,6 @@ ); | ||
const n = await this.placement.tooltip.calculateTravelDistance(t), a = () => { | ||
var s; | ||
var o; | ||
this.animations.is_animating = !1, this.ajala.active_step = this.ajala.getFlattenSteps()[n.active_index], this.ui.update(n); | ||
const l = (s = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : s.onActive; | ||
l && l(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
const s = (o = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : o.onActive; | ||
s && s(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
type: "onTransitionComplete", | ||
@@ -451,6 +455,6 @@ data: { | ||
const n = await this.placement.tooltip.calculateTravelDistance(t), a = () => { | ||
var s; | ||
var o; | ||
this.animations.is_animating = !1, this.ajala.active_step = this.ajala.getFlattenSteps()[n.active_index], this.ui.update(n); | ||
const l = (s = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : s.onActive; | ||
l && l(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
const s = (o = this.ajala.getOriginalSteps()[this.ajala.getActiveStepOriginalIndex()]) == null ? void 0 : o.onActive; | ||
s && s(this.ajala.getActiveStep(), this.ajala), this.ajala.dispatchEvent({ | ||
type: "onTransitionComplete", | ||
@@ -477,4 +481,4 @@ data: { | ||
for (let a = t; a < this.ajala.getFlattenSteps().length; a++) { | ||
const l = this.ajala.getFlattenSteps()[a]; | ||
if (!(l != null && l.skip)) { | ||
const s = this.ajala.getFlattenSteps()[a]; | ||
if (!(s != null && s.skip)) { | ||
n = a; | ||
@@ -487,4 +491,4 @@ break; | ||
for (let a = t; a > 0; a--) { | ||
const l = this.ajala.getFlattenSteps()[a]; | ||
if (!(l != null && l.skip)) { | ||
const s = this.ajala.getFlattenSteps()[a]; | ||
if (!(s != null && s.skip)) { | ||
n = a; | ||
@@ -558,3 +562,3 @@ break; | ||
const n = e.slice(0); | ||
for (let a = 0, l = n.length; a < l; a++) | ||
for (let a = 0, s = n.length; a < s; a++) | ||
n[a].call(this, t); | ||
@@ -564,3 +568,3 @@ } | ||
} | ||
var E; | ||
var I; | ||
class at { | ||
@@ -574,4 +578,4 @@ constructor({ | ||
p(this, "placement"); | ||
b(this, E); | ||
this.ajala = t, C(this, E, i), this.placement = e; | ||
S(this, I); | ||
this.ajala = t, C(this, I, i), this.placement = e; | ||
} | ||
@@ -586,35 +590,35 @@ calculatePlacmentDelta({ | ||
rotate: 0 | ||
}, n = _(this, E).getTargetElement( | ||
}, n = _(this, I).getTargetElement( | ||
this.ajala.getFlattenSteps()[t].target | ||
); | ||
if (!n) return e; | ||
const a = n.getBoundingClientRect(), l = _(this, E).arrow_element.getBoundingClientRect(), s = _(this, E).tooltip_container_element.getBoundingClientRect(), { axis: o, align: c } = this.placement.getMetadata({ | ||
const a = n.getBoundingClientRect(), s = _(this, I).arrow_element.getBoundingClientRect(), o = _(this, I).tooltip_container_element.getBoundingClientRect(), { axis: l, align: h } = this.placement.getMetadata({ | ||
next_index: t, | ||
placement: i | ||
}), d = 2; | ||
if (o === "top" || o === "bottom") { | ||
if (c === "left") { | ||
let r = F(0, s.width, 0.05); | ||
a.width < s.width / 2 && (r = -l.width / 2 + a.width / 2), e.x = r; | ||
} else if (c === "center") { | ||
let r = F(0, s.width, 0.5); | ||
r = r - l.width / 2, e.x = r; | ||
} else if (c === "right") { | ||
let r = F(0, s.width, 0.95); | ||
r = r - l.width, a.width < s.width / 2 && (r = s.width - l.width / 2 - a.width / 2), e.x = r; | ||
if (l === "top" || l === "bottom") { | ||
if (h === "left") { | ||
let c = E(0, o.width, 0.05); | ||
a.width < o.width / 2 && (c = -s.width / 2 + a.width / 2), e.x = c; | ||
} else if (h === "center") { | ||
let c = E(0, o.width, 0.5); | ||
c = c - s.width / 2, e.x = c; | ||
} else if (h === "right") { | ||
let c = E(0, o.width, 0.95); | ||
c = c - s.width, a.width < o.width / 2 && (c = o.width - s.width / 2 - a.width / 2), e.x = c; | ||
} | ||
o === "top" ? (e.rotate = 180, e.y = s.height - l.height / 2 + d) : o === "bottom" && (e.rotate = 0, e.y = -(l.height / 2) - d); | ||
l === "top" ? (e.rotate = 180, e.y = o.height - s.height / 2 + d) : l === "bottom" && (e.rotate = 0, e.y = -(s.height / 2) - d); | ||
} | ||
if (o === "left" || o === "right") { | ||
if (c === "top") { | ||
let r = F(0, s.height, 0.1); | ||
a.height < s.height / 2 && (r = -l.height / 2 + a.height / 2), e.y = r; | ||
} else if (c === "center") { | ||
let r = F(0, s.height, 0.5); | ||
r = r - l.height / 2, e.y = r; | ||
} else if (c === "bottom") { | ||
let r = F(0, s.height, 0.9); | ||
r = r - l.height, a.height < s.height / 2 && (r = s.height - l.height / 2 - a.height / 2), e.y = r; | ||
if (l === "left" || l === "right") { | ||
if (h === "top") { | ||
let c = E(0, o.height, 0.1); | ||
a.height < o.height / 2 && (c = -s.height / 2 + a.height / 2), e.y = c; | ||
} else if (h === "center") { | ||
let c = E(0, o.height, 0.5); | ||
c = c - s.height / 2, e.y = c; | ||
} else if (h === "bottom") { | ||
let c = E(0, o.height, 0.9); | ||
c = c - s.height, a.height < o.height / 2 && (c = o.height - s.height / 2 - a.height / 2), e.y = c; | ||
} | ||
o === "left" ? (e.rotate = 90, e.x = s.width - l.width / 2 + d) : o === "right" && (e.rotate = -90, e.x = -(l.width / 2) - d); | ||
l === "left" ? (e.rotate = 90, e.x = o.width - s.width / 2 + d) : l === "right" && (e.rotate = -90, e.x = -(s.width / 2) - d); | ||
} | ||
@@ -626,4 +630,4 @@ return e; | ||
} | ||
E = new WeakMap(); | ||
var w, k, D, P, q; | ||
I = new WeakMap(); | ||
var j, k, P, R, q; | ||
class nt { | ||
@@ -635,3 +639,3 @@ constructor({ | ||
}) { | ||
b(this, w); | ||
S(this, j); | ||
p(this, "ajala"); | ||
@@ -644,17 +648,14 @@ p(this, "placement"); | ||
var f, x; | ||
let i = !1; | ||
this.ui.arrow_element.style.visibility = "hidden"; | ||
const e = this.ui.getTargetElement( | ||
this.ajala.getFlattenSteps()[t].target | ||
), n = this.ui.tooltip_container_element; | ||
let a = n.getBoundingClientRect(); | ||
const l = (S) => S > 0 ? -S : Math.abs(S); | ||
), a = this.ui.tooltip_container_element.getBoundingClientRect(), s = (b) => b > 0 ? -b : Math.abs(b); | ||
if (!e) | ||
return { | ||
is_valid: !0, | ||
scrolled: i, | ||
scrolled: !1, | ||
y_delta: window.innerHeight / 2 - a.height / 2, | ||
x_delta: window.innerWidth / 2 - a.width / 2, | ||
y_offset: l(a.y), | ||
x_offset: l(a.x), | ||
y_offset: s(a.y), | ||
x_offset: s(a.x), | ||
active_index: t, | ||
@@ -666,9 +667,5 @@ tooltip_rect: a, | ||
}; | ||
let s = e.getBoundingClientRect(); | ||
const o = this.ajala.getFlattenSteps()[t].tooltip_gutter ?? this.ajala.options.tooltip_gutter ?? 0; | ||
let c = l(a.y), d = l(a.x), r = s.y + o, m = s.x + o; | ||
(r < 0 || r > window.innerHeight || r + s.height > window.innerHeight) && (((f = this.placement.animations) == null ? void 0 : f.transition_type) === "popout" && (this.ui.tooltip_container_element.style.visibility = "hidden"), await ((x = this.placement.animations) == null ? void 0 : x.scrollToLocation( | ||
e, | ||
t | ||
)), i = !0, s = e.getBoundingClientRect(), a = n.getBoundingClientRect(), c = l(a.y), d = l(a.x)); | ||
((f = this.placement.animations) == null ? void 0 : f.transition_type) === "popout" && (this.ui.tooltip_container_element.style.visibility = "hidden"), await ((x = this.placement.animations) == null ? void 0 : x.scrollIntoView(e, 100)); | ||
const o = e.getBoundingClientRect(), l = this.ajala.getFlattenSteps()[t].tooltip_gutter ?? this.ajala.options.tooltip_gutter ?? 0, h = s(a.y), d = s(a.x); | ||
let c = o.y + l, m = o.x + l; | ||
const g = this.calculatePlacementDelta({ | ||
@@ -678,13 +675,13 @@ target: e, | ||
}); | ||
return m = g.x_delta, r = g.y_delta, { | ||
y_delta: r, | ||
return m = g.x_delta, c = g.y_delta, { | ||
y_delta: c, | ||
x_delta: m, | ||
y_offset: c, | ||
y_offset: h, | ||
x_offset: d, | ||
tooltip_rect: a, | ||
target_rect: s, | ||
target_rect: o, | ||
taregt_el: e, | ||
active_index: t, | ||
is_valid: !0, | ||
scrolled: i, | ||
scrolled: !1, | ||
placement: g.placement | ||
@@ -699,48 +696,48 @@ }; | ||
const { | ||
axis: l, | ||
align: s, | ||
axis_gutter: o, | ||
spotlight: c, | ||
axis: s, | ||
align: o, | ||
axis_gutter: l, | ||
spotlight: h, | ||
placement: d | ||
} = this.placement.getMetadata({ next_index: i }), r = u(this, w, D).call(this, { | ||
axis: l, | ||
} = this.placement.getMetadata({ next_index: i }), c = v(this, j, P).call(this, { | ||
axis: s, | ||
target: t, | ||
axis_gutter: o, | ||
spotlight_padding: c.padding | ||
}), m = u(this, w, P).call(this, { | ||
align: s, | ||
axis_gutter: l, | ||
spotlight_padding: h.padding | ||
}), m = v(this, j, R).call(this, { | ||
align: o, | ||
target: t | ||
}), g = u(this, w, q).call(this, { | ||
align: s, | ||
}), g = v(this, j, q).call(this, { | ||
align: o, | ||
target: t | ||
}); | ||
if (l === "top" || l === "bottom") | ||
if (g.is_valid && r.is_valid) | ||
e = g.alignment, n = r.axis, a = d; | ||
if (s === "top" || s === "bottom") | ||
if (g.is_valid && c.is_valid) | ||
e = g.alignment, n = c.axis, a = d; | ||
else { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: S } = u(this, w, k).call(this, { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: b } = v(this, j, k).call(this, { | ||
target: t, | ||
axis_gutter: o, | ||
spotlight_padding: c.padding | ||
axis_gutter: l, | ||
spotlight_padding: h.padding | ||
}); | ||
e = f, n = x, a = S; | ||
e = f, n = x, a = b; | ||
} | ||
else if (l === "left" || l === "right") | ||
if (m.is_valid && r.is_valid) | ||
e = r.axis, n = m.alignment, a = d; | ||
else if (s === "left" || s === "right") | ||
if (m.is_valid && c.is_valid) | ||
e = c.axis, n = m.alignment, a = d; | ||
else { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: S } = u(this, w, k).call(this, { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: b } = v(this, j, k).call(this, { | ||
target: t, | ||
axis_gutter: o, | ||
spotlight_padding: c.padding | ||
axis_gutter: l, | ||
spotlight_padding: h.padding | ||
}); | ||
e = f, n = x, a = S; | ||
e = f, n = x, a = b; | ||
} | ||
else { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: S } = u(this, w, k).call(this, { | ||
const { auto_x_delta: f, auto_y_delta: x, auto_placement: b } = v(this, j, k).call(this, { | ||
target: t, | ||
axis_gutter: o, | ||
spotlight_padding: c.padding | ||
axis_gutter: l, | ||
spotlight_padding: h.padding | ||
}); | ||
e = f, n = x, a = S; | ||
e = f, n = x, a = b; | ||
} | ||
@@ -756,3 +753,3 @@ return { | ||
} | ||
w = new WeakSet(), /** | ||
j = new WeakSet(), /** | ||
* | ||
@@ -782,6 +779,6 @@ * @Desc Calculate tooltip placement after the `tooltip_placement` provided by user as been deem invalid. | ||
]; | ||
let a = 0, l = 0, s = "bottom_center"; | ||
for (let o = 0; o < n.length; o++) { | ||
s = n[o]; | ||
const c = s.split("_"), d = c[0], r = c[1], m = u(this, w, D).call(this, { | ||
let a = 0, s = 0, o = "bottom_center"; | ||
for (let l = 0; l < n.length; l++) { | ||
o = n[l]; | ||
const h = o.split("_"), d = h[0], c = h[1], m = v(this, j, P).call(this, { | ||
axis: d, | ||
@@ -791,25 +788,25 @@ target: t, | ||
spotlight_padding: e | ||
}), g = u(this, w, P).call(this, { | ||
align: r, | ||
}), g = v(this, j, R).call(this, { | ||
align: c, | ||
target: t | ||
}), f = u(this, w, q).call(this, { | ||
align: r, | ||
}), f = v(this, j, q).call(this, { | ||
align: c, | ||
target: t | ||
}); | ||
if ((d === "bottom" || d === "top") && m.is_valid && f.is_valid) { | ||
a = f.alignment, l = m.axis; | ||
a = f.alignment, s = m.axis; | ||
break; | ||
} | ||
if ((d === "right" || d === "left") && m.is_valid && g.is_valid) { | ||
a = m.axis, l = g.alignment; | ||
a = m.axis, s = g.alignment; | ||
break; | ||
} | ||
o === n.length - 1 && (l = m.axis, a = f.alignment); | ||
l === n.length - 1 && (s = m.axis, a = f.alignment); | ||
} | ||
return { | ||
auto_x_delta: a, | ||
auto_y_delta: l, | ||
auto_placement: s | ||
auto_y_delta: s, | ||
auto_placement: o | ||
}; | ||
}, D = function({ | ||
}, P = function({ | ||
axis: t, | ||
@@ -820,3 +817,3 @@ target: i, | ||
}) { | ||
const a = i.getBoundingClientRect(), l = this.ui.tooltip_container_element.getBoundingClientRect(), s = { | ||
const a = i.getBoundingClientRect(), s = this.ui.tooltip_container_element.getBoundingClientRect(), o = { | ||
is_valid: !1, | ||
@@ -826,19 +823,19 @@ axis: 0 | ||
if (t === "top") { | ||
const o = a.y - l.height - e - n; | ||
o >= 0 && a.y <= window.innerHeight ? (s.is_valid = !0, s.axis = o) : (s.is_valid = !1, s.axis = o); | ||
const l = a.y - s.height - e - n; | ||
l >= 0 && a.y <= window.innerHeight ? (o.is_valid = !0, o.axis = l) : (o.is_valid = !1, o.axis = l); | ||
} | ||
if (t === "bottom") { | ||
const o = a.bottom + e + n; | ||
o + l.height >= 0 && o + l.height <= window.innerHeight ? (s.is_valid = !0, s.axis = o) : (s.is_valid = !1, s.axis = o); | ||
const l = a.bottom + e + n; | ||
l + s.height >= 0 && l + s.height <= window.innerHeight ? (o.is_valid = !0, o.axis = l) : (o.is_valid = !1, o.axis = l); | ||
} | ||
if (t === "left") { | ||
const o = a.x - l.width - e - n; | ||
o >= 0 && a.x <= window.innerWidth ? (s.is_valid = !0, s.axis = o) : (s.is_valid = !1, s.axis = o); | ||
const l = a.x - s.width - e - n; | ||
l >= 0 && a.x <= window.innerWidth ? (o.is_valid = !0, o.axis = l) : (o.is_valid = !1, o.axis = l); | ||
} | ||
if (t === "right") { | ||
const o = a.right + e + n; | ||
o >= 0 && o + l.width <= window.innerWidth ? (s.is_valid = !0, s.axis = o) : (s.is_valid = !1, s.axis = o); | ||
const l = a.right + e + n; | ||
l >= 0 && l + s.width <= window.innerWidth ? (o.is_valid = !0, o.axis = l) : (o.is_valid = !1, o.axis = l); | ||
} | ||
return s; | ||
}, P = function({ | ||
return o; | ||
}, R = function({ | ||
align: t, | ||
@@ -852,8 +849,8 @@ target: i | ||
if (t === "top" && (e.y + n.height <= window.innerHeight && e.y >= 0 ? (a.is_valid = !0, a.alignment = e.y) : (a.is_valid = !1, a.alignment = e.y)), t === "center") { | ||
const l = e.height / 2, s = n.height / 2, o = e.y + l - s; | ||
o + e.height <= window.innerHeight && o >= 0 ? (a.is_valid = !0, a.alignment = o) : (a.is_valid = !1, a.alignment = o); | ||
const s = e.height / 2, o = n.height / 2, l = e.y + s - o; | ||
l + e.height <= window.innerHeight && l >= 0 ? (a.is_valid = !0, a.alignment = l) : (a.is_valid = !1, a.alignment = l); | ||
} | ||
if (t === "bottom") { | ||
const l = e.bottom - n.height; | ||
l + n.height <= window.innerHeight && l >= 0 ? (a.is_valid = !0, a.alignment = l) : (a.is_valid = !1, a.alignment = l); | ||
const s = e.bottom - n.height; | ||
s + n.height <= window.innerHeight && s >= 0 ? (a.is_valid = !0, a.alignment = s) : (a.is_valid = !1, a.alignment = s); | ||
} | ||
@@ -870,8 +867,8 @@ return a; | ||
if (t === "left" && (e.x + n.width <= window.innerWidth && e.x >= 0 ? (a.is_valid = !0, a.alignment = e.x) : (a.is_valid = !1, a.alignment = e.x)), t === "center") { | ||
const l = e.width / 2, s = n.width / 2, o = e.x + l - s; | ||
o >= 0 && o + n.width <= window.innerWidth ? (a.is_valid = !0, a.alignment = o) : (a.is_valid = !1, a.alignment = o); | ||
const s = e.width / 2, o = n.width / 2, l = e.x + s - o; | ||
l >= 0 && l + n.width <= window.innerWidth ? (a.is_valid = !0, a.alignment = l) : (a.is_valid = !1, a.alignment = l); | ||
} | ||
if (t === "right") { | ||
const l = e.right - n.width; | ||
l + n.width <= window.innerWidth && l >= 0 ? (a.is_valid = !0, a.alignment = l) : (a.is_valid = !1, a.alignment = l); | ||
const s = e.right - n.width; | ||
s + n.width <= window.innerWidth && s >= 0 ? (a.is_valid = !0, a.alignment = s) : (a.is_valid = !1, a.alignment = s); | ||
} | ||
@@ -932,4 +929,4 @@ return a; | ||
}) { | ||
var o, c; | ||
const e = this.ajala.getFlattenSteps()[t].tooltip_gutter || this.ajala.options.tooltip_gutter || 10, n = i || this.ajala.getFlattenSteps()[t].tooltip_placement || this.ajala.options.tooltip_placement || "auto", a = n.split("_"), l = this.ajala.getFlattenSteps()[t].spotlight_padding || ((o = this.ajala.options.spotlight_options) == null ? void 0 : o.padding) || 0, s = this.ajala.getFlattenSteps()[t].spotlight_border_radius || ((c = this.ajala.options.spotlight_options) == null ? void 0 : c.border_radius) || 0; | ||
var l, h; | ||
const e = this.ajala.getFlattenSteps()[t].tooltip_gutter || this.ajala.options.tooltip_gutter || 10, n = i || this.ajala.getFlattenSteps()[t].tooltip_placement || this.ajala.options.tooltip_placement || "auto", a = n.split("_"), s = this.ajala.getFlattenSteps()[t].spotlight_padding || ((l = this.ajala.options.spotlight_options) == null ? void 0 : l.padding) || 0, o = this.ajala.getFlattenSteps()[t].spotlight_border_radius || ((h = this.ajala.options.spotlight_options) == null ? void 0 : h.border_radius) || 0; | ||
return { | ||
@@ -941,4 +938,4 @@ placement: n, | ||
spotlight: { | ||
padding: l, | ||
border_radius: s | ||
padding: s, | ||
border_radius: o | ||
} | ||
@@ -950,3 +947,3 @@ }; | ||
} | ||
var L, H; | ||
var L, N; | ||
class ot { | ||
@@ -958,3 +955,3 @@ constructor({ | ||
}) { | ||
b(this, L); | ||
S(this, L); | ||
p(this, "ajala"); | ||
@@ -987,8 +984,8 @@ p(this, "ui"); | ||
}, | ||
onComplete: l = () => { | ||
onComplete: s = () => { | ||
} | ||
}) { | ||
const s = performance.now(); | ||
let o = !0, c; | ||
const r = { | ||
const o = performance.now(); | ||
let l = !0, h; | ||
const c = { | ||
easeInOut: (g) => g < 0.5 ? 2 * g * g : 1 - Math.pow(-2 * g + 2, 2) / 2 | ||
@@ -999,35 +996,27 @@ // Second half: decelerate | ||
const m = (g) => { | ||
if (!o) return; | ||
const f = g - s, x = Math.min(f / e, 1), S = r(x), Z = F(t, i, S); | ||
a(Z), x < 1 ? (c = requestAnimationFrame(m), this.is_animating = !0) : (l(), this.is_animating = !1); | ||
if (!l) return; | ||
const f = g - o, x = Math.min(f / e, 1), b = c(x), Q = E(t, i, b); | ||
a(Q), x < 1 ? (h = requestAnimationFrame(m), this.is_animating = !0) : (s(), this.is_animating = !1); | ||
}; | ||
return c = requestAnimationFrame(m), { | ||
return h = requestAnimationFrame(m), { | ||
stop: () => { | ||
o = !1, cancelAnimationFrame(c); | ||
l = !1, cancelAnimationFrame(h); | ||
} | ||
}; | ||
} | ||
scrollToLocation(t, i) { | ||
scrollIntoView(t, i = 100) { | ||
return new Promise((e) => { | ||
var c, d; | ||
const n = t.getBoundingClientRect(), a = window.innerHeight / 2 - n.height / 2; | ||
let l = window.scrollY + n.y - a; | ||
const s = document.documentElement.scrollHeight - window.innerHeight; | ||
l = Math.min(Math.max(0, l), s); | ||
const o = ((c = this.ajala.getFlattenSteps()[i]) == null ? void 0 : c.scroll_duration) ?? ((d = this.ajala.options) == null ? void 0 : d.scroll_duration) ?? 1e3; | ||
this.animate({ | ||
from: window.scrollY, | ||
to: l, | ||
duration: o, | ||
onUpdate(r) { | ||
window.scrollTo(0, r); | ||
}, | ||
onComplete() { | ||
e(null); | ||
} | ||
}); | ||
let n; | ||
function a() { | ||
clearTimeout(n), n = setTimeout(() => { | ||
document.removeEventListener("scroll", a, !0), e(null); | ||
}, i); | ||
} | ||
document.addEventListener("scroll", a, !0), t.scrollIntoView({ behavior: "smooth", block: "center" }), setTimeout(() => { | ||
n || e(null); | ||
}, i + 100); | ||
}); | ||
} | ||
spotlightTarget(t) { | ||
const { x: i, y: e, width: n, height: a, border_radius: l } = this.placement.overlay_cutout_svg_rect.calculatePlacmentDelta({ | ||
const { x: i, y: e, width: n, height: a, border_radius: s } = this.placement.overlay_cutout_svg_rect.calculatePlacmentDelta({ | ||
active_index: t | ||
@@ -1039,9 +1028,9 @@ }); | ||
duration: 500, | ||
onUpdate: (s) => { | ||
onUpdate: (o) => { | ||
this.ui.updateOverlayCutoutPathData({ | ||
x: i, | ||
y: e, | ||
width: n * s, | ||
height: a * s, | ||
border_radius: l | ||
width: n * o, | ||
height: a * o, | ||
border_radius: s | ||
}); | ||
@@ -1055,3 +1044,3 @@ }, | ||
height: 0, | ||
border_radius: l | ||
border_radius: s | ||
}); | ||
@@ -1069,6 +1058,6 @@ } | ||
x_delta: a, | ||
x_offset: l, | ||
y_delta: s, | ||
y_offset: o, | ||
tooltip_rect: c, | ||
x_offset: s, | ||
y_delta: o, | ||
y_offset: l, | ||
tooltip_rect: h, | ||
active_index: d | ||
@@ -1079,5 +1068,5 @@ } = t; | ||
to: 1, | ||
duration: u(this, L, H).call(this, d), | ||
onUpdate(r) { | ||
const m = (c == null ? void 0 : c.x) ?? 0, g = (c == null ? void 0 : c.y) ?? 0, f = m + (a + l) * r, x = g + (s + o) * r; | ||
duration: v(this, L, N).call(this, d), | ||
onUpdate(c) { | ||
const m = (h == null ? void 0 : h.x) ?? 0, g = (h == null ? void 0 : h.y) ?? 0, f = m + (a + s) * c, x = g + (o + l) * c; | ||
n.style.transform = `translate(${f}px, ${x}px)`; | ||
@@ -1100,9 +1089,9 @@ }, | ||
if (t.is_valid) { | ||
const { x_delta: a, y_delta: l, active_index: s } = t; | ||
const { x_delta: a, y_delta: s, active_index: o } = t; | ||
this.animate({ | ||
from: 0, | ||
to: 1, | ||
duration: u(this, L, H).call(this, s), | ||
onUpdate(o) { | ||
n.style.visibility = "visible", n.style.transform = `translate(${a}px, ${l}px) scale(${o})`; | ||
duration: v(this, L, N).call(this, o), | ||
onUpdate(l) { | ||
n.style.visibility = "visible", n.style.transform = `translate(${a}px, ${s}px) scale(${l})`; | ||
}, | ||
@@ -1113,3 +1102,3 @@ onComplete: () => { | ||
onPlay: () => { | ||
this.spotlightTarget(s), e && e(); | ||
this.spotlightTarget(o), e && e(); | ||
} | ||
@@ -1120,8 +1109,8 @@ }); | ||
} | ||
L = new WeakSet(), H = function(t) { | ||
L = new WeakSet(), N = function(t) { | ||
var i, e; | ||
return ((i = this.ajala.getFlattenSteps()[t]) == null ? void 0 : i.transition_duration) ?? ((e = this.ajala.options) == null ? void 0 : e.transition_duration) ?? 1e3; | ||
}; | ||
var j, y, v, A, I, T, J, Y; | ||
class rt extends it { | ||
var y, w, u, A, T, F, Z, z; | ||
class ht extends it { | ||
constructor(i, { start_immediately: e = !0, ...n } = { | ||
@@ -1131,3 +1120,3 @@ start_immediately: !0 | ||
super(); | ||
b(this, T); | ||
S(this, F); | ||
p(this, "options"); | ||
@@ -1138,20 +1127,20 @@ p(this, "is_active"); | ||
p(this, "flatten_steps"); | ||
b(this, j); | ||
S(this, y); | ||
p(this, "active_step"); | ||
b(this, y); | ||
b(this, v); | ||
b(this, A); | ||
b(this, I); | ||
const a = R(i); | ||
this.options = { start_immediately: e, ...n }, this.is_active = !1, this.original_steps = a, C(this, j, { | ||
S(this, w); | ||
S(this, u); | ||
S(this, A); | ||
S(this, T); | ||
const a = D(i); | ||
this.options = { start_immediately: e, ...n }, this.is_active = !1, this.original_steps = a, C(this, y, { | ||
instances: [], | ||
queries: {} | ||
}), this.flatten_steps = [], this.initialized = !0, this.active_step = this.flatten_steps[0], C(this, y, new tt(this)), C(this, v, new et({ | ||
}), this.flatten_steps = [], this.initialized = !0, this.active_step = this.flatten_steps[0], C(this, w, new tt(this)), C(this, u, new et({ | ||
ajala: this, | ||
ui: _(this, y) | ||
})), C(this, A, new lt({ ajala: this, ui: _(this, y) })), C(this, I, new ot({ | ||
ui: _(this, w) | ||
})), C(this, A, new lt({ ajala: this, ui: _(this, w) })), C(this, T, new ot({ | ||
ajala: this, | ||
ui: _(this, y), | ||
ui: _(this, w), | ||
placement: _(this, A) | ||
})), _(this, y).navigation = _(this, v), _(this, y).placement = _(this, A), _(this, v).placement = _(this, A), _(this, v).animations = _(this, I), _(this, A).animations = _(this, I), this.active_step = this.getFlattenSteps()[_(this, v).getValidNavIndex(0, "next")], this.destroy = this.destroy.bind(this); | ||
})), _(this, w).navigation = _(this, u), _(this, w).placement = _(this, A), _(this, u).placement = _(this, A), _(this, u).animations = _(this, T), _(this, A).animations = _(this, T), this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], this.destroy = this.destroy.bind(this); | ||
} | ||
@@ -1162,11 +1151,11 @@ /** | ||
init(i) { | ||
this.initialized = !0; | ||
const e = R(this.original_steps); | ||
this.is_active = !1, this.original_steps = e, C(this, j, { | ||
console.log("Initializing Againnn"), this.initialized = !0; | ||
const e = D(this.original_steps); | ||
this.is_active = !1, this.original_steps = e, C(this, y, { | ||
instances: [], | ||
queries: N(e) | ||
}), this.flatten_steps = z( | ||
queries: H(e) | ||
}), this.flatten_steps = U( | ||
e, | ||
_(this, j).queries | ||
), u(this, T, Y).call(this), this.active_step = this.getFlattenSteps()[_(this, v).getValidNavIndex(0, "next")], _(this, y).init(), _(this, v).init(), (this.options.start_immediately || i) && this.start(); | ||
_(this, y).queries | ||
), v(this, F, z).call(this), this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], _(this, w).init(), _(this, u).init(), (this.options.start_immediately || i) && this.start(); | ||
} | ||
@@ -1221,10 +1210,10 @@ /** | ||
updateSteps(i, e = !0) { | ||
const n = R(i); | ||
this.original_steps = n, C(this, j, { | ||
const n = D(i); | ||
this.original_steps = n, C(this, y, { | ||
instances: [], | ||
queries: N(n) | ||
}), this.flatten_steps = z( | ||
queries: H(n) | ||
}), this.flatten_steps = U( | ||
n, | ||
_(this, j).queries | ||
), this.active_step = this.getFlattenSteps()[0], e && this.restart(); | ||
_(this, y).queries | ||
), v(this, F, z).call(this), e && this.restart(); | ||
} | ||
@@ -1269,3 +1258,3 @@ /** | ||
start() { | ||
this.is_active = !0, this.active_step = this.getFlattenSteps()[_(this, v).getValidNavIndex(0, "next")], _(this, y).start(), _(this, v).start(), this.dispatchEvent({ | ||
this.is_active = !0, this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], _(this, w).start(), _(this, u).start(), this.dispatchEvent({ | ||
type: "onStart", | ||
@@ -1286,3 +1275,3 @@ data: this | ||
next() { | ||
this.is_active && _(this, v).next(); | ||
this.is_active && _(this, u).next(); | ||
} | ||
@@ -1293,3 +1282,3 @@ /** | ||
prev() { | ||
this.is_active && _(this, v).prev(); | ||
this.is_active && _(this, u).prev(); | ||
} | ||
@@ -1300,3 +1289,3 @@ /** | ||
close() { | ||
_(this, v).close(); | ||
_(this, u).close(); | ||
} | ||
@@ -1310,3 +1299,3 @@ /** | ||
const e = this.getFlattenSteps().findIndex((n) => n.id === i); | ||
e > -1 && _(this, v).goTo(e); | ||
e > -1 && _(this, u).goTo(e); | ||
} | ||
@@ -1317,3 +1306,3 @@ /** | ||
refresh() { | ||
this.is_active && _(this, y).refresh(); | ||
this.is_active && _(this, w).refresh(); | ||
} | ||
@@ -1324,13 +1313,16 @@ /** | ||
destroy() { | ||
u(this, T, J).call(this), _(this, y).destroy(), this.is_active = !1; | ||
v(this, F, Z).call(this), _(this, w).destroy(), this.is_active = !1; | ||
} | ||
} | ||
j = new WeakMap(), y = new WeakMap(), v = new WeakMap(), A = new WeakMap(), I = new WeakMap(), T = new WeakSet(), J = function() { | ||
_(this, j).instances.forEach((i) => { | ||
y = new WeakMap(), w = new WeakMap(), u = new WeakMap(), A = new WeakMap(), T = new WeakMap(), F = new WeakSet(), Z = function() { | ||
_(this, y).instances.forEach((i) => { | ||
i.onchange = null; | ||
}), _(this, y).cleanUp(), _(this, v).cleanUp(); | ||
}, Y = function() { | ||
}), _(this, w).cleanUp(), _(this, u).cleanUp(); | ||
}, z = function() { | ||
for (const [i, e] of Object.entries( | ||
_(this, j).queries | ||
_(this, y).queries | ||
)) { | ||
_(this, y).instances.forEach((a) => { | ||
a.onchange = null; | ||
}); | ||
const n = window.matchMedia(i); | ||
@@ -1342,26 +1334,26 @@ n.matches && (this.flatten_steps = $( | ||
)), n.onchange = (a) => { | ||
const l = _(this, j).queries[a.media]; | ||
a.matches && l ? this.flatten_steps = $( | ||
const s = _(this, y).queries[a.media]; | ||
a.matches && s ? this.flatten_steps = $( | ||
this.flatten_steps, | ||
l, | ||
s, | ||
"value" | ||
) : (l && (this.flatten_steps = $( | ||
) : (s && (this.flatten_steps = $( | ||
this.flatten_steps, | ||
l, | ||
s, | ||
"default" | ||
)), _(this, j).instances.forEach((s) => { | ||
const o = _(this, j).queries[s.media]; | ||
s.matches && o && (this.flatten_steps = $( | ||
)), _(this, y).instances.forEach((o) => { | ||
const l = _(this, y).queries[o.media]; | ||
o.matches && l && (this.flatten_steps = $( | ||
this.flatten_steps, | ||
o, | ||
l, | ||
"value" | ||
)); | ||
})), _(this, y).update(), this.goToStep( | ||
this.getFlattenSteps()[_(this, v).getValidNavIndex(0, "next")].id | ||
})), _(this, w).update(), this.goToStep( | ||
this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")].id | ||
); | ||
}, _(this, j).instances.push(n); | ||
}, _(this, y).instances.push(n); | ||
} | ||
}; | ||
export { | ||
rt as AjalaJourney | ||
ht as AjalaJourney | ||
}; |
@@ -137,3 +137,2 @@ export declare class AjalaJourney extends EventEmitter<TAjalaEventTypes> { | ||
tooltip_height?: number; | ||
scroll_duration?: number; | ||
transition_duration?: number; | ||
@@ -192,3 +191,2 @@ transition_type?: TTransitionType; | ||
spotlight_padding?: number; | ||
scroll_duration?: number; | ||
transition_duration?: number; | ||
@@ -195,0 +193,0 @@ enable_target_interaction?: boolean; |
{ | ||
"name": "ajala.js", | ||
"private": false, | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"type": "module", | ||
@@ -6,0 +6,0 @@ "main": "./dist/ajala.cjs", |
Sorry, the diff of this file is not supported yet
126133
-0.38%1694
-0.59%