diff --git a/src/Masa.Blazor.JSComponents.DriverJS/MDriverJS.razor.js b/src/Masa.Blazor.JSComponents.DriverJS/MDriverJS.razor.js index f02f381faa..88f1c1353e 100644 --- a/src/Masa.Blazor.JSComponents.DriverJS/MDriverJS.razor.js +++ b/src/Masa.Blazor.JSComponents.DriverJS/MDriverJS.razor.js @@ -1,686 +1 @@ -let z = {}, J; -function F(e = {}) { - z = { - animate: true, - allowClose: true, - overlayClickBehavior: "close", - overlayOpacity: 0.7, - smoothScroll: false, - disableActiveInteraction: false, - showProgress: false, - stagePadding: 10, - stageRadius: 5, - popoverOffset: 10, - showButtons: ["next", "previous", "close"], - disableButtons: [], - overlayColor: "#000", - ...e - }; -} -function s(e) { - return e ? z[e] : z; -} -function le(e) { - J = e; -} -function _() { - return J; -} -let I = {}; -function N(e, o) { - I[e] = o; -} -function E(e) { - var o; - (o = I[e]) == null || o.call(I); -} -function de() { - I = {}; -} -function O(e, o, t, i) { - return (e /= i / 2) < 1 ? t / 2 * e * e + o : -t / 2 * (--e * (e - 2) - 1) + o; -} -function U(e) { - const o = 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])'; - return e.flatMap((t) => { - const i = t.matches(o), d = Array.from(t.querySelectorAll(o)); - return [...i ? [t] : [], ...d]; - }).filter((t) => getComputedStyle(t).pointerEvents !== "none" && ve(t)); -} -function ee(e) { - if (!e || ue(e)) - return; - const o = s("smoothScroll"), t = e.offsetHeight > window.innerHeight; - e.scrollIntoView({ - // Removing the smooth scrolling for elements which exist inside the scrollable parent - // This was causing the highlight to not properly render - behavior: !o || pe(e) ? "auto" : "smooth", - inline: "center", - block: t ? "start" : "center" - }); -} -function pe(e) { - if (!e || !e.parentElement) - return; - const o = e.parentElement; - return o.scrollHeight > o.clientHeight; -} -function ue(e) { - const o = e.getBoundingClientRect(); - return o.top >= 0 && o.left >= 0 && o.bottom <= (window.innerHeight || document.documentElement.clientHeight) && o.right <= (window.innerWidth || document.documentElement.clientWidth); -} -function ve(e) { - return !!(e.offsetWidth || e.offsetHeight || e.getClientRects().length); -} -let D = {}; -function k(e, o) { - D[e] = o; -} -function l(e) { - return e ? D[e] : D; -} -function X() { - D = {}; -} -function fe(e, o, t, i) { - let d = l("__activeStagePosition"); - const n = d || t.getBoundingClientRect(), f = i.getBoundingClientRect(), w = O(e, n.x, f.x - n.x, o), r = O(e, n.y, f.y - n.y, o), v = O(e, n.width, f.width - n.width, o), g = O(e, n.height, f.height - n.height, o); - d = { - x: w, - y: r, - width: v, - height: g - }, oe(d), k("__activeStagePosition", d); -} -function te(e) { - if (!e) - return; - const o = e.getBoundingClientRect(), t = { - x: o.x, - y: o.y, - width: o.width, - height: o.height - }; - k("__activeStagePosition", t), oe(t); -} -function he() { - const e = l("__activeStagePosition"), o = l("__overlaySvg"); - if (!e) - return; - if (!o) { - console.warn("No stage svg found."); - return; - } - const t = window.innerWidth, i = window.innerHeight; - o.setAttribute("viewBox", `0 0 ${t} ${i}`); -} -function ge(e) { - const o = we(e); - document.body.appendChild(o), re(o, (t) => { - t.target.tagName === "path" && E("overlayClick"); - }), k("__overlaySvg", o); -} -function oe(e) { - const o = l("__overlaySvg"); - if (!o) { - ge(e); - return; - } - const t = o.firstElementChild; - if ((t == null ? void 0 : t.tagName) !== "path") - throw new Error("no path element found in stage svg"); - t.setAttribute("d", ie(e)); -} -function we(e) { - const o = window.innerWidth, t = window.innerHeight, i = document.createElementNS("http://www.w3.org/2000/svg", "svg"); - i.classList.add("driver-overlay", "driver-overlay-animated"), i.setAttribute("viewBox", `0 0 ${o} ${t}`), i.setAttribute("xmlSpace", "preserve"), i.setAttribute("xmlnsXlink", "http://www.w3.org/1999/xlink"), i.setAttribute("version", "1.1"), i.setAttribute("preserveAspectRatio", "xMinYMin slice"), i.style.fillRule = "evenodd", i.style.clipRule = "evenodd", i.style.strokeLinejoin = "round", i.style.strokeMiterlimit = "2", i.style.zIndex = "10000", i.style.position = "fixed", i.style.top = "0", i.style.left = "0", i.style.width = "100%", i.style.height = "100%"; - const d = document.createElementNS("http://www.w3.org/2000/svg", "path"); - return d.setAttribute("d", ie(e)), d.style.fill = s("overlayColor") || "rgb(0,0,0)", d.style.opacity = `${s("overlayOpacity")}`, d.style.pointerEvents = "auto", d.style.cursor = "auto", i.appendChild(d), i; -} -function ie(e) { - const o = window.innerWidth, t = window.innerHeight, i = s("stagePadding") || 0, d = s("stageRadius") || 0, n = e.width + i * 2, f = e.height + i * 2, w = Math.min(d, n / 2, f / 2), r = Math.floor(Math.max(w, 0)), v = e.x - i + r, g = e.y - i, y = n - r * 2, a = f - r * 2; - return `M${o},0L0,0L0,${t}L${o},${t}L${o},0Z - M${v},${g} h${y} a${r},${r} 0 0 1 ${r},${r} v${a} a${r},${r} 0 0 1 -${r},${r} h-${y} a${r},${r} 0 0 1 -${r},-${r} v-${a} a${r},${r} 0 0 1 ${r},-${r} z`; -} -function me() { - const e = l("__overlaySvg"); - e && e.remove(); -} -function ye() { - const e = document.getElementById("driver-dummy-element"); - if (e) - return e; - let o = document.createElement("div"); - return o.id = "driver-dummy-element", o.style.width = "0", o.style.height = "0", o.style.pointerEvents = "none", o.style.opacity = "0", o.style.position = "fixed", o.style.top = "50%", o.style.left = "50%", document.body.appendChild(o), o; -} -function j(e) { - const { element: o } = e; - let t = typeof o == "function" ? o() : typeof o == "string" ? document.querySelector(o) : o; - t || (t = ye()), be(t, e); -} -function xe() { - const e = l("__activeElement"), o = l("__activeStep"); - e && (te(e), he(), ae(e, o)); -} -function be(e, o) { - var C; - const i = Date.now(), d = l("__activeStep"), n = l("__activeElement") || e, f = !n || n === e, w = e.id === "driver-dummy-element", r = n.id === "driver-dummy-element", v = s("animate"), g = o.onHighlightStarted || s("onHighlightStarted"), y = (o == null ? void 0 : o.onHighlighted) || s("onHighlighted"), a = (d == null ? void 0 : d.onDeselected) || s("onDeselected"), p = s(), c = l(); - !f && a && a(r ? void 0 : n, d, { - config: p, - state: c, - driver: _() - }), g && g(w ? void 0 : e, o, { - config: p, - state: c, - driver: _() - }); - const u = !f && v; - let h = false; - _e(), k("previousStep", d), k("previousElement", n), k("activeStep", o), k("activeElement", e); - const m = () => { - if (l("__transitionCallback") !== m) - return; - const b = Date.now() - i, L = 400 - b <= 400 / 2; - o.popover && L && !h && u && (Q(e, o), h = true), s("animate") && b < 400 ? fe(b, 400, n, e) : (te(e), y && y(w ? void 0 : e, o, { - config: s(), - state: l(), - driver: _() - }), k("__transitionCallback", void 0), k("__previousStep", d), k("__previousElement", n), k("__activeStep", o), k("__activeElement", e)), window.requestAnimationFrame(m); - }; - k("__transitionCallback", m), window.requestAnimationFrame(m), ee(e), !u && o.popover && Q(e, o), n.classList.remove("driver-active-element", "driver-no-interaction"), n.removeAttribute("aria-haspopup"), n.removeAttribute("aria-expanded"), n.removeAttribute("aria-controls"), ((C = o.disableActiveInteraction) != null ? C : s("disableActiveInteraction")) && e.classList.add("driver-no-interaction"), e.classList.add("driver-active-element"), e.setAttribute("aria-haspopup", "dialog"), e.setAttribute("aria-expanded", "true"), e.setAttribute("aria-controls", "driver-popover-content"); -} -function Ce() { - var e; - (e = document.getElementById("driver-dummy-element")) == null || e.remove(), document.querySelectorAll(".driver-active-element").forEach((o) => { - o.classList.remove("driver-active-element", "driver-no-interaction"), o.removeAttribute("aria-haspopup"), o.removeAttribute("aria-expanded"), o.removeAttribute("aria-controls"); - }); -} -function M() { - const e = l("__resizeTimeout"); - e && window.cancelAnimationFrame(e), k("__resizeTimeout", window.requestAnimationFrame(xe)); -} -function Pe(e) { - var r; - if (!l("isInitialized") || !(e.key === "Tab" || e.keyCode === 9)) - return; - const i = l("__activeElement"), d = (r = l("popover")) == null ? void 0 : r.wrapper, n = U([ - ...d ? [d] : [], - ...i ? [i] : [] - ]), f = n[0], w = n[n.length - 1]; - if (e.preventDefault(), e.shiftKey) { - const v = n[n.indexOf(document.activeElement) - 1] || w; - v == null || v.focus(); - } else { - const v = n[n.indexOf(document.activeElement) + 1] || f; - v == null || v.focus(); - } -} -function ne(e) { - var t; - ((t = s("allowKeyboardControl")) == null || t) && (e.key === "Escape" ? E("escapePress") : e.key === "ArrowRight" ? E("arrowRightPress") : e.key === "ArrowLeft" && E("arrowLeftPress")); -} -function re(e, o, t) { - const i = (n, f) => { - const w = n.target; - e.contains(w) && ((!t || t(w)) && (n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation()), f == null || f(n)); - }; - document.addEventListener("pointerdown", i, true), document.addEventListener("mousedown", i, true), document.addEventListener("pointerup", i, true), document.addEventListener("mouseup", i, true), document.addEventListener( - "click", - (n) => { - i(n, o); - }, - true - ); -} -function ke() { - window.addEventListener("keyup", ne, false), window.addEventListener("keydown", Pe, false), window.addEventListener("resize", M), window.addEventListener("scroll", M); -} -function Se() { - window.removeEventListener("keyup", ne), window.removeEventListener("resize", M), window.removeEventListener("scroll", M); -} -function _e() { - const e = l("popover"); - e && (e.wrapper.style.display = "none"); -} -function Q(e, o) { - var b, P; - let t = l("popover"); - t && document.body.removeChild(t.wrapper), t = Ee(), document.body.appendChild(t.wrapper); - const { - title: i, - description: d, - showButtons: n, - disableButtons: f, - showProgress: w, - nextBtnText: r = s("nextBtnText") || "Next →", - prevBtnText: v = s("prevBtnText") || "← Previous", - progressText: g = s("progressText") || "{current} of {total}" - } = o.popover || {}; - t.nextButton.innerHTML = r, t.previousButton.innerHTML = v, t.progress.innerHTML = g, i ? (t.title.innerHTML = i, t.title.style.display = "block") : t.title.style.display = "none", d ? (t.description.innerHTML = d, t.description.style.display = "block") : t.description.style.display = "none"; - const y = n || s("showButtons"), a = w || s("showProgress") || false, p = (y == null ? void 0 : y.includes("next")) || (y == null ? void 0 : y.includes("previous")) || a; - t.closeButton.style.display = y.includes("close") ? "block" : "none", p ? (t.footer.style.display = "flex", t.progress.style.display = a ? "block" : "none", t.nextButton.style.display = y.includes("next") ? "block" : "none", t.previousButton.style.display = y.includes("previous") ? "block" : "none") : t.footer.style.display = "none"; - const c = f || s("disableButtons") || []; - c != null && c.includes("next") && (t.nextButton.disabled = true, t.nextButton.classList.add("driver-popover-btn-disabled")), c != null && c.includes("previous") && (t.previousButton.disabled = true, t.previousButton.classList.add("driver-popover-btn-disabled")), c != null && c.includes("close") && (t.closeButton.disabled = true, t.closeButton.classList.add("driver-popover-btn-disabled")); - const u = t.wrapper; - u.style.display = "block", u.style.left = "", u.style.top = "", u.style.bottom = "", u.style.right = "", u.id = "driver-popover-content", u.setAttribute("role", "dialog"), u.setAttribute("aria-labelledby", "driver-popover-title"), u.setAttribute("aria-describedby", "driver-popover-description"); - const h = t.arrow; - h.className = "driver-popover-arrow"; - const m = ((b = o.popover) == null ? void 0 : b.popoverClass) || s("popoverClass") || ""; - u.className = `driver-popover ${m}`.trim(), re( - t.wrapper, - (L) => { - var B, R, W; - const T = L.target, A = ((B = o.popover) == null ? void 0 : B.onNextClick) || s("onNextClick"), H = ((R = o.popover) == null ? void 0 : R.onPrevClick) || s("onPrevClick"), $ = ((W = o.popover) == null ? void 0 : W.onCloseClick) || s("onCloseClick"); - if (T.classList.contains("driver-popover-next-btn")) - return A ? A(e, o, { - config: s(), - state: l(), - driver: _() - }) : E("nextClick"); - if (T.classList.contains("driver-popover-prev-btn")) - return H ? H(e, o, { - config: s(), - state: l(), - driver: _() - }) : E("prevClick"); - if (T.classList.contains("driver-popover-close-btn")) - return $ ? $(e, o, { - config: s(), - state: l(), - driver: _() - }) : E("closeClick"); - }, - (L) => !(t != null && t.description.contains(L)) && !(t != null && t.title.contains(L)) && typeof L.className == "string" && L.className.includes("driver-popover") - ), k("popover", t); - const x = ((P = o.popover) == null ? void 0 : P.onPopoverRender) || s("onPopoverRender"); - x && x(t, { - config: s(), - state: l(), - driver: _() - }), ae(e, o), ee(u); - const C = e.classList.contains("driver-dummy-element"), S = U([u, ...C ? [] : [e]]); - S.length > 0 && S[0].focus(); -} -function se() { - const e = l("popover"); - if (!(e != null && e.wrapper)) - return; - const o = e.wrapper.getBoundingClientRect(), t = s("stagePadding") || 0, i = s("popoverOffset") || 0; - return { - width: o.width + t + i, - height: o.height + t + i, - realWidth: o.width, - realHeight: o.height - }; -} -function Z(e, o) { - const { elementDimensions: t, popoverDimensions: i, popoverPadding: d, popoverArrowDimensions: n } = o; - return e === "start" ? Math.max( - Math.min( - t.top - d, - window.innerHeight - i.realHeight - n.width - ), - n.width - ) : e === "end" ? Math.max( - Math.min( - t.top - (i == null ? void 0 : i.realHeight) + t.height + d, - window.innerHeight - (i == null ? void 0 : i.realHeight) - n.width - ), - n.width - ) : e === "center" ? Math.max( - Math.min( - t.top + t.height / 2 - (i == null ? void 0 : i.realHeight) / 2, - window.innerHeight - (i == null ? void 0 : i.realHeight) - n.width - ), - n.width - ) : 0; -} -function G(e, o) { - const { elementDimensions: t, popoverDimensions: i, popoverPadding: d, popoverArrowDimensions: n } = o; - return e === "start" ? Math.max( - Math.min( - t.left - d, - window.innerWidth - i.realWidth - n.width - ), - n.width - ) : e === "end" ? Math.max( - Math.min( - t.left - (i == null ? void 0 : i.realWidth) + t.width + d, - window.innerWidth - (i == null ? void 0 : i.realWidth) - n.width - ), - n.width - ) : e === "center" ? Math.max( - Math.min( - t.left + t.width / 2 - (i == null ? void 0 : i.realWidth) / 2, - window.innerWidth - (i == null ? void 0 : i.realWidth) - n.width - ), - n.width - ) : 0; -} -function ae(e, o) { - const t = l("popover"); - if (!t) - return; - const { align: i = "start", side: d = "left" } = (o == null ? void 0 : o.popover) || {}, n = i, f = e.id === "driver-dummy-element" ? "over" : d, w = s("stagePadding") || 0, r = se(), v = t.arrow.getBoundingClientRect(), g = e.getBoundingClientRect(), y = g.top - r.height; - let a = y >= 0; - const p = window.innerHeight - (g.bottom + r.height); - let c = p >= 0; - const u = g.left - r.width; - let h = u >= 0; - const m = window.innerWidth - (g.right + r.width); - let x = m >= 0; - const C = !a && !c && !h && !x; - let S = f; - if (f === "top" && a ? x = h = c = false : f === "bottom" && c ? x = h = a = false : f === "left" && h ? x = a = c = false : f === "right" && x && (h = a = c = false), f === "over") { - const b = window.innerWidth / 2 - r.realWidth / 2, P = window.innerHeight / 2 - r.realHeight / 2; - t.wrapper.style.left = `${b}px`, t.wrapper.style.right = "auto", t.wrapper.style.top = `${P}px`, t.wrapper.style.bottom = "auto"; - } else if (C) { - const b = window.innerWidth / 2 - (r == null ? void 0 : r.realWidth) / 2, P = 10; - t.wrapper.style.left = `${b}px`, t.wrapper.style.right = "auto", t.wrapper.style.bottom = `${P}px`, t.wrapper.style.top = "auto"; - } else if (h) { - const b = Math.min( - u, - window.innerWidth - (r == null ? void 0 : r.realWidth) - v.width - ), P = Z(n, { - elementDimensions: g, - popoverDimensions: r, - popoverPadding: w, - popoverArrowDimensions: v - }); - t.wrapper.style.left = `${b}px`, t.wrapper.style.top = `${P}px`, t.wrapper.style.bottom = "auto", t.wrapper.style.right = "auto", S = "left"; - } else if (x) { - const b = Math.min( - m, - window.innerWidth - (r == null ? void 0 : r.realWidth) - v.width - ), P = Z(n, { - elementDimensions: g, - popoverDimensions: r, - popoverPadding: w, - popoverArrowDimensions: v - }); - t.wrapper.style.right = `${b}px`, t.wrapper.style.top = `${P}px`, t.wrapper.style.bottom = "auto", t.wrapper.style.left = "auto", S = "right"; - } else if (a) { - const b = Math.min( - y, - window.innerHeight - r.realHeight - v.width - ); - let P = G(n, { - elementDimensions: g, - popoverDimensions: r, - popoverPadding: w, - popoverArrowDimensions: v - }); - t.wrapper.style.top = `${b}px`, t.wrapper.style.left = `${P}px`, t.wrapper.style.bottom = "auto", t.wrapper.style.right = "auto", S = "top"; - } else if (c) { - const b = Math.min( - p, - window.innerHeight - (r == null ? void 0 : r.realHeight) - v.width - ); - let P = G(n, { - elementDimensions: g, - popoverDimensions: r, - popoverPadding: w, - popoverArrowDimensions: v - }); - t.wrapper.style.left = `${P}px`, t.wrapper.style.bottom = `${b}px`, t.wrapper.style.top = "auto", t.wrapper.style.right = "auto", S = "bottom"; - } - C ? t.arrow.classList.add("driver-popover-arrow-none") : Le(n, S, e); -} -function Le(e, o, t) { - const i = l("popover"); - if (!i) - return; - const d = t.getBoundingClientRect(), n = se(), f = i.arrow, w = n.width, r = window.innerWidth, v = d.width, g = d.left, y = n.height, a = window.innerHeight, p = d.top, c = d.height; - f.className = "driver-popover-arrow"; - let u = o, h = e; - if (o === "top" ? (g + v <= 0 ? (u = "right", h = "end") : g + v - w <= 0 && (u = "top", h = "start"), g >= r ? (u = "left", h = "end") : g + w >= r && (u = "top", h = "end")) : o === "bottom" ? (g + v <= 0 ? (u = "right", h = "start") : g + v - w <= 0 && (u = "bottom", h = "start"), g >= r ? (u = "left", h = "start") : g + w >= r && (u = "bottom", h = "end")) : o === "left" ? (p + c <= 0 ? (u = "bottom", h = "end") : p + c - y <= 0 && (u = "left", h = "start"), p >= a ? (u = "top", h = "end") : p + y >= a && (u = "left", h = "end")) : o === "right" && (p + c <= 0 ? (u = "bottom", h = "start") : p + c - y <= 0 && (u = "right", h = "start"), p >= a ? (u = "top", h = "start") : p + y >= a && (u = "right", h = "end")), !u) - f.classList.add("driver-popover-arrow-none"); - else { - f.classList.add(`driver-popover-arrow-side-${u}`), f.classList.add(`driver-popover-arrow-align-${h}`); - const m = t.getBoundingClientRect(), x = f.getBoundingClientRect(), C = s("stagePadding") || 0, S = m.left - C < window.innerWidth && m.right + C > 0 && m.top - C < window.innerHeight && m.bottom + C > 0; - o === "bottom" && S && (x.x > m.x && x.x + x.width < m.x + m.width ? i.wrapper.style.transform = "translateY(0)" : (f.classList.remove(`driver-popover-arrow-align-${h}`), f.classList.add("driver-popover-arrow-none"), i.wrapper.style.transform = `translateY(-${C / 2}px)`)); - } -} -function Ee() { - const e = document.createElement("div"); - e.classList.add("driver-popover"); - const o = document.createElement("div"); - o.classList.add("driver-popover-arrow"); - const t = document.createElement("header"); - t.id = "driver-popover-title", t.classList.add("driver-popover-title"), t.style.display = "none", t.innerText = "Popover Title"; - const i = document.createElement("div"); - i.id = "driver-popover-description", i.classList.add("driver-popover-description"), i.style.display = "none", i.innerText = "Popover description is here"; - const d = document.createElement("button"); - d.type = "button", d.classList.add("driver-popover-close-btn"), d.setAttribute("aria-label", "Close"), d.innerHTML = "×"; - const n = document.createElement("footer"); - n.classList.add("driver-popover-footer"); - const f = document.createElement("span"); - f.classList.add("driver-popover-progress-text"), f.innerText = ""; - const w = document.createElement("span"); - w.classList.add("driver-popover-navigation-btns"); - const r = document.createElement("button"); - r.type = "button", r.classList.add("driver-popover-prev-btn"), r.innerHTML = "← Previous"; - const v = document.createElement("button"); - return v.type = "button", v.classList.add("driver-popover-next-btn"), v.innerHTML = "Next →", w.appendChild(r), w.appendChild(v), n.appendChild(f), n.appendChild(w), e.appendChild(d), e.appendChild(o), e.appendChild(t), e.appendChild(i), e.appendChild(n), { - wrapper: e, - arrow: o, - title: t, - description: i, - footer: n, - previousButton: r, - nextButton: v, - closeButton: d, - footerButtons: w, - progress: f - }; -} -function Te() { - var o; - const e = l("popover"); - e && ((o = e.wrapper.parentElement) == null || o.removeChild(e.wrapper)); -} -function Ae(e = {}) { - F(e); - function o() { - s("allowClose") && g(); - } - function t() { - const a = s("overlayClickBehavior"); - if (s("allowClose") && a === "close") { - g(); - return; - } - a === "nextStep" && i(); - } - function i() { - const a = l("activeIndex"), p = s("steps") || []; - if (typeof a == "undefined") - return; - const c = a + 1; - p[c] ? v(c) : g(); - } - function d() { - const a = l("activeIndex"), p = s("steps") || []; - if (typeof a == "undefined") - return; - const c = a - 1; - p[c] ? v(c) : g(); - } - function n(a) { - (s("steps") || [])[a] ? v(a) : g(); - } - function f() { - var x; - if (l("__transitionCallback")) - return; - const p = l("activeIndex"), c = l("__activeStep"), u = l("__activeElement"); - if (typeof p == "undefined" || typeof c == "undefined" || typeof l("activeIndex") == "undefined") - return; - const m = ((x = c.popover) == null ? void 0 : x.onPrevClick) || s("onPrevClick"); - if (m) - return m(u, c, { - config: s(), - state: l(), - driver: _() - }); - d(); - } - function w() { - var m; - if (l("__transitionCallback")) - return; - const p = l("activeIndex"), c = l("__activeStep"), u = l("__activeElement"); - if (typeof p == "undefined" || typeof c == "undefined") - return; - const h = ((m = c.popover) == null ? void 0 : m.onNextClick) || s("onNextClick"); - if (h) - return h(u, c, { - config: s(), - state: l(), - driver: _() - }); - i(); - } - function r() { - l("isInitialized") || (k("isInitialized", true), document.body.classList.add("driver-active", s("animate") ? "driver-fade" : "driver-simple"), ke(), N("overlayClick", t), N("escapePress", o), N("arrowLeftPress", f), N("arrowRightPress", w)); - } - function v(a = 0) { - var $, B, R, W, V, q, K, Y; - const p = s("steps"); - if (!p) { - console.error("No steps to drive through"), g(); - return; - } - if (!p[a]) { - g(); - return; - } - k("__activeOnDestroyed", document.activeElement), k("activeIndex", a); - const c = p[a], u = p[a + 1], h = p[a - 1], m = (($ = c.popover) == null ? void 0 : $.doneBtnText) || s("doneBtnText") || "Done", x = s("allowClose"), C = typeof ((B = c.popover) == null ? void 0 : B.showProgress) != "undefined" ? (R = c.popover) == null ? void 0 : R.showProgress : s("showProgress"), b = (((W = c.popover) == null ? void 0 : W.progressText) || s("progressText") || "{{current}} of {{total}}").replace("{{current}}", `${a + 1}`).replace("{{total}}", `${p.length}`), P = ((V = c.popover) == null ? void 0 : V.showButtons) || s("showButtons"), L = [ - "next", - "previous", - ...x ? ["close"] : [] - ].filter((ce) => !(P != null && P.length) || P.includes(ce)), T = ((q = c.popover) == null ? void 0 : q.onNextClick) || s("onNextClick"), A = ((K = c.popover) == null ? void 0 : K.onPrevClick) || s("onPrevClick"), H = ((Y = c.popover) == null ? void 0 : Y.onCloseClick) || s("onCloseClick"); - j({ - ...c, - popover: { - showButtons: L, - nextBtnText: u ? void 0 : m, - disableButtons: [...h ? [] : ["previous"]], - showProgress: C, - progressText: b, - onNextClick: T || (() => { - u ? v(a + 1) : g(); - }), - onPrevClick: A || (() => { - v(a - 1); - }), - onCloseClick: H || (() => { - g(); - }), - ...(c == null ? void 0 : c.popover) || {} - } - }); - } - function g(a = true) { - const p = l("__activeElement"), c = l("__activeStep"), u = l("__activeOnDestroyed"), h = s("onDestroyStarted"); - if (a && h) { - const C = !p || (p == null ? void 0 : p.id) === "driver-dummy-element"; - h(C ? void 0 : p, c, { - config: s(), - state: l(), - driver: _() - }); - return; - } - const m = (c == null ? void 0 : c.onDeselected) || s("onDeselected"), x = s("onDestroyed"); - if (document.body.classList.remove("driver-active", "driver-fade", "driver-simple"), Se(), Te(), Ce(), me(), de(), X(), p && c) { - const C = p.id === "driver-dummy-element"; - m && m(C ? void 0 : p, c, { - config: s(), - state: l(), - driver: _() - }), x && x(C ? void 0 : p, c, { - config: s(), - state: l(), - driver: _() - }); - } - u && u.focus(); - } - const y = { - isActive: () => l("isInitialized") || false, - refresh: M, - drive: (a = 0) => { - r(), v(a); - }, - setConfig: F, - setSteps: (a) => { - X(), F({ - ...s(), - steps: a - }); - }, - getConfig: s, - getState: l, - getActiveIndex: () => l("activeIndex"), - isFirstStep: () => l("activeIndex") === 0, - isLastStep: () => { - const a = s("steps") || [], p = l("activeIndex"); - return p !== void 0 && p === a.length - 1; - }, - getActiveStep: () => l("activeStep"), - getActiveElement: () => l("activeElement"), - getPreviousElement: () => l("previousElement"), - getPreviousStep: () => l("previousStep"), - moveNext: i, - movePrevious: d, - moveTo: n, - hasNextStep: () => { - const a = s("steps") || [], p = l("activeIndex"); - return p !== void 0 && !!a[p + 1]; - }, - hasPreviousStep: () => { - const a = s("steps") || [], p = l("activeIndex"); - return p !== void 0 && !!a[p - 1]; - }, - highlight: (a) => { - r(), j({ - ...a, - popover: a.popover ? { - showButtons: [], - showProgress: false, - progressText: "", - ...a.popover - } : void 0 - }); - }, - destroy: () => { - g(false); - } - }; - return le(y), y; -} - -function init() { - return { - create(config = {}) { - const driverObj = Ae(config); - driverObj.drive(); - return driverObj; - }, - }; - // const driverObj = driver(config); - // if (drive) { - // driverObj.drive(); - // } - // return driverObj; -} -function drive(config, stepIndex) { - Ae(config).drive(stepIndex); -} -function highlight(config, step) { - Ae(config).highlight(step); -} - -export { drive, highlight, init }; +let e,t={};function o(e={}){t={animate:!0,allowClose:!0,overlayClickBehavior:"close",overlayOpacity:.7,smoothScroll:!1,disableActiveInteraction:!1,showProgress:!1,stagePadding:10,stageRadius:5,popoverOffset:10,showButtons:["next","previous","close"],disableButtons:[],overlayColor:"#000",...e}}function n(e){return e?t[e]:t}function i(){return e}let r={};function s(e,t){r[e]=t}function l(e){var t;null==(t=r[e])||t.call(r)}function d(e,t,o,n){return(e/=n/2)<1?o/2*e*e+t:-o/2*(--e*(e-2)-1)+t}function a(e){const t='a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])';return e.flatMap((e=>{const o=e.matches(t),n=Array.from(e.querySelectorAll(t));return[...o?[e]:[],...n]})).filter((e=>"none"!==getComputedStyle(e).pointerEvents&&function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}(e)))}function p(e){if(!e||function(e){const t=e.getBoundingClientRect();return t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth)}(e))return;const t=n("smoothScroll"),o=e.offsetHeight>window.innerHeight;e.scrollIntoView({behavior:!t||c(e)?"auto":"smooth",inline:"center",block:o?"start":"center"})}function c(e){if(!e||!e.parentElement)return;const t=e.parentElement;return t.scrollHeight>t.clientHeight}let v={};function u(e,t){v[e]=t}function h(e){return e?v[e]:v}function m(){v={}}function w(e){if(!e)return;const t=e.getBoundingClientRect(),o={x:t.x,y:t.y,width:t.width,height:t.height};u("__activeStagePosition",o),f(o)}function g(e){const t=function(e){const t=window.innerWidth,o=window.innerHeight,i=document.createElementNS("http://www.w3.org/2000/svg","svg");i.classList.add("driver-overlay","driver-overlay-animated"),i.setAttribute("viewBox",`0 0 ${t} ${o}`),i.setAttribute("xmlSpace","preserve"),i.setAttribute("xmlnsXlink","http://www.w3.org/1999/xlink"),i.setAttribute("version","1.1"),i.setAttribute("preserveAspectRatio","xMinYMin slice"),i.style.fillRule="evenodd",i.style.clipRule="evenodd",i.style.strokeLinejoin="round",i.style.strokeMiterlimit="2",i.style.zIndex="10000",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.width="100%",i.style.height="100%";const r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",y(e)),r.style.fill=n("overlayColor")||"rgb(0,0,0)",r.style.opacity=`${n("overlayOpacity")}`,r.style.pointerEvents="auto",r.style.cursor="auto",i.appendChild(r),i}(e);document.body.appendChild(t),E(t,(e=>{"path"===e.target.tagName&&l("overlayClick")})),u("__overlaySvg",t)}function f(e){const t=h("__overlaySvg");if(!t)return void g(e);const o=t.firstElementChild;if("path"!==(null==o?void 0:o.tagName))throw new Error("no path element found in stage svg");o.setAttribute("d",y(e))}function y(e){const t=window.innerWidth,o=window.innerHeight,i=n("stagePadding")||0,r=n("stageRadius")||0,s=e.width+2*i,l=e.height+2*i,d=Math.min(r,s/2,l/2),a=Math.floor(Math.max(d,0)),p=s-2*a,c=l-2*a;return`M${t},0L0,0L0,${o}L${t},${o}L${t},0Z\n M${e.x-i+a},${e.y-i} h${p} a${a},${a} 0 0 1 ${a},${a} v${c} a${a},${a} 0 0 1 -${a},${a} h-${p} a${a},${a} 0 0 1 -${a},-${a} v-${c} a${a},${a} 0 0 1 ${a},-${a} z`}function x(e){const{element:t}=e;let o="function"==typeof t?t():"string"==typeof t?document.querySelector(t):t;o||(o=function(){const e=document.getElementById("driver-dummy-element");if(e)return e;let t=document.createElement("div");return t.id="driver-dummy-element",t.style.width="0",t.style.height="0",t.style.pointerEvents="none",t.style.opacity="0",t.style.position="fixed",t.style.top="50%",t.style.left="50%",document.body.appendChild(t),t}()),function(e,t){var o;const r=Date.now(),s=h("__activeStep"),l=h("__activeElement")||e,a=!l||l===e,c="driver-dummy-element"===e.id,v="driver-dummy-element"===l.id,m=n("animate"),g=t.onHighlightStarted||n("onHighlightStarted"),y=(null==t?void 0:t.onHighlighted)||n("onHighlighted"),x=(null==s?void 0:s.onDeselected)||n("onDeselected"),b=n(),C=h();!a&&x&&x(v?void 0:l,s,{config:b,state:C,driver:i()}),g&&g(c?void 0:e,t,{config:b,state:C,driver:i()});const _=!a&&m;let L=!1;(function(){const e=h("popover");e&&(e.wrapper.style.display="none")})(),u("previousStep",s),u("previousElement",l),u("activeStep",t),u("activeElement",e);const E=()=>{if(h("__transitionCallback")!==E)return;const o=Date.now()-r,a=400-o<=200;t.popover&&a&&!L&&_&&(k(e,t),L=!0),n("animate")&&o<400?function(e,t,o,n){let i=h("__activeStagePosition");const r=i||o.getBoundingClientRect(),s=n.getBoundingClientRect();i={x:d(e,r.x,s.x-r.x,t),y:d(e,r.y,s.y-r.y,t),width:d(e,r.width,s.width-r.width,t),height:d(e,r.height,s.height-r.height,t)},f(i),u("__activeStagePosition",i)}(o,400,l,e):(w(e),y&&y(c?void 0:e,t,{config:n(),state:h(),driver:i()}),u("__transitionCallback",void 0),u("__previousStep",s),u("__previousElement",l),u("__activeStep",t),u("__activeElement",e)),window.requestAnimationFrame(E)};u("__transitionCallback",E),window.requestAnimationFrame(E),p(e),!_&&t.popover&&k(e,t),l.classList.remove("driver-active-element","driver-no-interaction"),l.removeAttribute("aria-haspopup"),l.removeAttribute("aria-expanded"),l.removeAttribute("aria-controls"),(null!=(o=t.disableActiveInteraction)?o:n("disableActiveInteraction"))&&e.classList.add("driver-no-interaction"),e.classList.add("driver-active-element"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded","true"),e.setAttribute("aria-controls","driver-popover-content")}(o,e)}function b(){const e=h("__activeElement"),t=h("__activeStep");e&&(w(e),function(){const e=h("__activeStagePosition"),t=h("__overlaySvg");if(!e)return;if(!t)return void console.warn("No stage svg found.");const o=window.innerWidth,n=window.innerHeight;t.setAttribute("viewBox",`0 0 ${o} ${n}`)}(),A(e,t))}function C(){const e=h("__resizeTimeout");e&&window.cancelAnimationFrame(e),u("__resizeTimeout",window.requestAnimationFrame(b))}function _(e){var t;if(!h("isInitialized")||"Tab"!==e.key&&9!==e.keyCode)return;const o=h("__activeElement"),n=null==(t=h("popover"))?void 0:t.wrapper,i=a([...n?[n]:[],...o?[o]:[]]),r=i[0],s=i[i.length-1];if(e.preventDefault(),e.shiftKey){const e=i[i.indexOf(document.activeElement)-1]||s;null==e||e.focus()}else{const e=i[i.indexOf(document.activeElement)+1]||r;null==e||e.focus()}}function L(e){var t;(null==(t=n("allowKeyboardControl"))||t)&&("Escape"===e.key?l("escapePress"):"ArrowRight"===e.key?l("arrowRightPress"):"ArrowLeft"===e.key&&l("arrowLeftPress"))}function E(e,t,o){const n=(t,n)=>{const i=t.target;e.contains(i)&&((!o||o(i))&&(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation()),null==n||n(t))};document.addEventListener("pointerdown",n,!0),document.addEventListener("mousedown",n,!0),document.addEventListener("pointerup",n,!0),document.addEventListener("mouseup",n,!0),document.addEventListener("click",(e=>{n(e,t)}),!0)}function k(e,t){var o,r;let s=h("popover");s&&document.body.removeChild(s.wrapper),s=function(){const e=document.createElement("div");e.classList.add("driver-popover");const t=document.createElement("div");t.classList.add("driver-popover-arrow");const o=document.createElement("header");o.id="driver-popover-title",o.classList.add("driver-popover-title"),o.style.display="none",o.innerText="Popover Title";const n=document.createElement("div");n.id="driver-popover-description",n.classList.add("driver-popover-description"),n.style.display="none",n.innerText="Popover description is here";const i=document.createElement("button");i.type="button",i.classList.add("driver-popover-close-btn"),i.setAttribute("aria-label","Close"),i.innerHTML="×";const r=document.createElement("footer");r.classList.add("driver-popover-footer");const s=document.createElement("span");s.classList.add("driver-popover-progress-text"),s.innerText="";const l=document.createElement("span");l.classList.add("driver-popover-navigation-btns");const d=document.createElement("button");d.type="button",d.classList.add("driver-popover-prev-btn"),d.innerHTML="← Previous";const a=document.createElement("button");return a.type="button",a.classList.add("driver-popover-next-btn"),a.innerHTML="Next →",l.appendChild(d),l.appendChild(a),r.appendChild(s),r.appendChild(l),e.appendChild(i),e.appendChild(t),e.appendChild(o),e.appendChild(n),e.appendChild(r),{wrapper:e,arrow:t,title:o,description:n,footer:r,previousButton:d,nextButton:a,closeButton:i,footerButtons:l,progress:s}}(),document.body.appendChild(s.wrapper);const{title:d,description:c,showButtons:v,disableButtons:m,showProgress:w,nextBtnText:g=n("nextBtnText")||"Next →",prevBtnText:f=n("prevBtnText")||"← Previous",progressText:y=n("progressText")||"{current} of {total}"}=t.popover||{};s.nextButton.innerHTML=g,s.previousButton.innerHTML=f,s.progress.innerHTML=y,d?(s.title.innerHTML=d,s.title.style.display="block"):s.title.style.display="none",c?(s.description.innerHTML=c,s.description.style.display="block"):s.description.style.display="none";const x=v||n("showButtons"),b=w||n("showProgress")||!1,C=(null==x?void 0:x.includes("next"))||(null==x?void 0:x.includes("previous"))||b;s.closeButton.style.display=x.includes("close")?"block":"none",C?(s.footer.style.display="flex",s.progress.style.display=b?"block":"none",s.nextButton.style.display=x.includes("next")?"block":"none",s.previousButton.style.display=x.includes("previous")?"block":"none"):s.footer.style.display="none";const _=m||n("disableButtons")||[];null!=_&&_.includes("next")&&(s.nextButton.disabled=!0,s.nextButton.classList.add("driver-popover-btn-disabled")),null!=_&&_.includes("previous")&&(s.previousButton.disabled=!0,s.previousButton.classList.add("driver-popover-btn-disabled")),null!=_&&_.includes("close")&&(s.closeButton.disabled=!0,s.closeButton.classList.add("driver-popover-btn-disabled"));const L=s.wrapper;L.style.display="block",L.style.left="",L.style.top="",L.style.bottom="",L.style.right="",L.id="driver-popover-content",L.setAttribute("role","dialog"),L.setAttribute("aria-labelledby","driver-popover-title"),L.setAttribute("aria-describedby","driver-popover-description");s.arrow.className="driver-popover-arrow";const k=(null==(o=t.popover)?void 0:o.popoverClass)||n("popoverClass")||"";L.className=`driver-popover ${k}`.trim(),E(s.wrapper,(o=>{var r,s,d;const a=o.target,p=(null==(r=t.popover)?void 0:r.onNextClick)||n("onNextClick"),c=(null==(s=t.popover)?void 0:s.onPrevClick)||n("onPrevClick"),v=(null==(d=t.popover)?void 0:d.onCloseClick)||n("onCloseClick");return a.classList.contains("driver-popover-next-btn")?p?p(e,t,{config:n(),state:h(),driver:i()}):l("nextClick"):a.classList.contains("driver-popover-prev-btn")?c?c(e,t,{config:n(),state:h(),driver:i()}):l("prevClick"):a.classList.contains("driver-popover-close-btn")?v?v(e,t,{config:n(),state:h(),driver:i()}):l("closeClick"):void 0}),(e=>!(null!=s&&s.description.contains(e))&&!(null!=s&&s.title.contains(e))&&"string"==typeof e.className&&e.className.includes("driver-popover"))),u("popover",s);const $=(null==(r=t.popover)?void 0:r.onPopoverRender)||n("onPopoverRender");$&&$(s,{config:n(),state:h(),driver:i()}),A(e,t),p(L);const B=a([L,...e.classList.contains("driver-dummy-element")?[]:[e]]);B.length>0&&B[0].focus()}function $(){const e=h("popover");if(null==e||!e.wrapper)return;const t=e.wrapper.getBoundingClientRect(),o=n("stagePadding")||0,i=n("popoverOffset")||0;return{width:t.width+o+i,height:t.height+o+i,realWidth:t.width,realHeight:t.height}}function B(e,t){const{elementDimensions:o,popoverDimensions:n,popoverPadding:i,popoverArrowDimensions:r}=t;return"start"===e?Math.max(Math.min(o.top-i,window.innerHeight-n.realHeight-r.width),r.width):"end"===e?Math.max(Math.min(o.top-(null==n?void 0:n.realHeight)+o.height+i,window.innerHeight-(null==n?void 0:n.realHeight)-r.width),r.width):"center"===e?Math.max(Math.min(o.top+o.height/2-(null==n?void 0:n.realHeight)/2,window.innerHeight-(null==n?void 0:n.realHeight)-r.width),r.width):0}function P(e,t){const{elementDimensions:o,popoverDimensions:n,popoverPadding:i,popoverArrowDimensions:r}=t;return"start"===e?Math.max(Math.min(o.left-i,window.innerWidth-n.realWidth-r.width),r.width):"end"===e?Math.max(Math.min(o.left-(null==n?void 0:n.realWidth)+o.width+i,window.innerWidth-(null==n?void 0:n.realWidth)-r.width),r.width):"center"===e?Math.max(Math.min(o.left+o.width/2-(null==n?void 0:n.realWidth)/2,window.innerWidth-(null==n?void 0:n.realWidth)-r.width),r.width):0}function A(e,t){const o=h("popover");if(!o)return;const{align:i="start",side:r="left"}=(null==t?void 0:t.popover)||{},s=i,l="driver-dummy-element"===e.id?"over":r,d=n("stagePadding")||0,a=$(),p=o.arrow.getBoundingClientRect(),c=e.getBoundingClientRect(),v=c.top-a.height;let u=v>=0;const m=window.innerHeight-(c.bottom+a.height);let w=m>=0;const g=c.left-a.width;let f=g>=0;const y=window.innerWidth-(c.right+a.width);let x=y>=0;const b=!(u||w||f||x);let C=l;if("top"===l&&u?x=f=w=!1:"bottom"===l&&w?x=f=u=!1:"left"===l&&f?x=u=w=!1:"right"===l&&x&&(f=u=w=!1),"over"===l){const e=window.innerWidth/2-a.realWidth/2,t=window.innerHeight/2-a.realHeight/2;o.wrapper.style.left=`${e}px`,o.wrapper.style.right="auto",o.wrapper.style.top=`${t}px`,o.wrapper.style.bottom="auto"}else if(b){const e=window.innerWidth/2-(null==a?void 0:a.realWidth)/2,t=10;o.wrapper.style.left=`${e}px`,o.wrapper.style.right="auto",o.wrapper.style.bottom=`${t}px`,o.wrapper.style.top="auto"}else if(f){const e=Math.min(g,window.innerWidth-(null==a?void 0:a.realWidth)-p.width),t=B(s,{elementDimensions:c,popoverDimensions:a,popoverPadding:d,popoverArrowDimensions:p});o.wrapper.style.left=`${e}px`,o.wrapper.style.top=`${t}px`,o.wrapper.style.bottom="auto",o.wrapper.style.right="auto",C="left"}else if(x){const e=Math.min(y,window.innerWidth-(null==a?void 0:a.realWidth)-p.width),t=B(s,{elementDimensions:c,popoverDimensions:a,popoverPadding:d,popoverArrowDimensions:p});o.wrapper.style.right=`${e}px`,o.wrapper.style.top=`${t}px`,o.wrapper.style.bottom="auto",o.wrapper.style.left="auto",C="right"}else if(u){const e=Math.min(v,window.innerHeight-a.realHeight-p.width);let t=P(s,{elementDimensions:c,popoverDimensions:a,popoverPadding:d,popoverArrowDimensions:p});o.wrapper.style.top=`${e}px`,o.wrapper.style.left=`${t}px`,o.wrapper.style.bottom="auto",o.wrapper.style.right="auto",C="top"}else if(w){const e=Math.min(m,window.innerHeight-(null==a?void 0:a.realHeight)-p.width);let t=P(s,{elementDimensions:c,popoverDimensions:a,popoverPadding:d,popoverArrowDimensions:p});o.wrapper.style.left=`${t}px`,o.wrapper.style.bottom=`${e}px`,o.wrapper.style.top="auto",o.wrapper.style.right="auto",C="bottom"}b?o.arrow.classList.add("driver-popover-arrow-none"):function(e,t,o){const i=h("popover");if(!i)return;const r=o.getBoundingClientRect(),s=$(),l=i.arrow,d=s.width,a=window.innerWidth,p=r.width,c=r.left,v=s.height,u=window.innerHeight,m=r.top,w=r.height;l.className="driver-popover-arrow";let g=t,f=e;if("top"===t?(c+p<=0?(g="right",f="end"):c+p-d<=0&&(g="top",f="start"),c>=a?(g="left",f="end"):c+d>=a&&(g="top",f="end")):"bottom"===t?(c+p<=0?(g="right",f="start"):c+p-d<=0&&(g="bottom",f="start"),c>=a?(g="left",f="start"):c+d>=a&&(g="bottom",f="end")):"left"===t?(m+w<=0?(g="bottom",f="end"):m+w-v<=0&&(g="left",f="start"),m>=u?(g="top",f="end"):m+v>=u&&(g="left",f="end")):"right"===t&&(m+w<=0?(g="bottom",f="start"):m+w-v<=0&&(g="right",f="start"),m>=u?(g="top",f="start"):m+v>=u&&(g="right",f="end")),g){l.classList.add(`driver-popover-arrow-side-${g}`),l.classList.add(`driver-popover-arrow-align-${f}`);const e=o.getBoundingClientRect(),r=l.getBoundingClientRect(),s=n("stagePadding")||0,d=e.left-s0&&e.top-s0;"bottom"===t&&d&&(r.x>e.x&&r.x+r.width!(null!=C&&C.length)||C.includes(e))),L=(null==(l=c.popover)?void 0:l.onNextClick)||n("onNextClick"),E=(null==(d=c.popover)?void 0:d.onPrevClick)||n("onPrevClick"),k=(null==(a=c.popover)?void 0:a.onCloseClick)||n("onCloseClick");x({...c,popover:{showButtons:_,nextBtnText:v?void 0:m,disableButtons:[...h?[]:["previous"]],showProgress:y,progressText:b,onNextClick:L||(()=>{v?g(e+1):f()}),onPrevClick:E||(()=>{g(e-1)}),onCloseClick:k||(()=>{f()}),...(null==c?void 0:c.popover)||{}}})}function f(e=!0){const t=h("__activeElement"),o=h("__activeStep"),s=h("__activeOnDestroyed"),l=n("onDestroyStarted");if(e&&l){return void l(!t||"driver-dummy-element"===(null==t?void 0:t.id)?void 0:t,o,{config:n(),state:h(),driver:i()})}const d=(null==o?void 0:o.onDeselected)||n("onDeselected"),a=n("onDestroyed");if(document.body.classList.remove("driver-active","driver-fade","driver-simple"),window.removeEventListener("keyup",L),window.removeEventListener("resize",C),window.removeEventListener("scroll",C),function(){var e;const t=h("popover");t&&(null==(e=t.wrapper.parentElement)||e.removeChild(t.wrapper))}(),function(){var e;null==(e=document.getElementById("driver-dummy-element"))||e.remove(),document.querySelectorAll(".driver-active-element").forEach((e=>{e.classList.remove("driver-active-element","driver-no-interaction"),e.removeAttribute("aria-haspopup"),e.removeAttribute("aria-expanded"),e.removeAttribute("aria-controls")}))}(),function(){const e=h("__overlaySvg");e&&e.remove()}(),r={},m(),t&&o){const e="driver-dummy-element"===t.id;d&&d(e?void 0:t,o,{config:n(),state:h(),driver:i()}),a&&a(e?void 0:t,o,{config:n(),state:h(),driver:i()})}s&&s.focus()}o(t);const y={isActive:()=>h("isInitialized")||!1,refresh:C,drive:(e=0)=>{w(),g(e)},setConfig:o,setSteps:e=>{m(),o({...n(),steps:e})},getConfig:n,getState:h,getActiveIndex:()=>h("activeIndex"),isFirstStep:()=>0===h("activeIndex"),isLastStep:()=>{const e=n("steps")||[],t=h("activeIndex");return void 0!==t&&t===e.length-1},getActiveStep:()=>h("activeStep"),getActiveElement:()=>h("activeElement"),getPreviousElement:()=>h("previousElement"),getPreviousStep:()=>h("previousStep"),moveNext:a,movePrevious:p,moveTo:function(e){(n("steps")||[])[e]?g(e):f()},hasNextStep:()=>{const e=n("steps")||[],t=h("activeIndex");return void 0!==t&&!!e[t+1]},hasPreviousStep:()=>{const e=n("steps")||[],t=h("activeIndex");return void 0!==t&&!!e[t-1]},highlight:e=>{w(),x({...e,popover:e.popover?{showButtons:[],showProgress:!1,progressText:"",...e.popover}:void 0})},destroy:()=>{f(!1)}};return function(t){e=t}(y),y}function S(){return{create(e={}){const t=H(e);return t.drive(),t}}}function M(e,t){H(e).drive(t)}function D(e,t){H(e).highlight(t)}export{M as drive,D as highlight,S as init}; diff --git a/src/Masa.Blazor.JSComponents.DriverJS/Masa.Blazor.JSComponents.DriverJS.csproj b/src/Masa.Blazor.JSComponents.DriverJS/Masa.Blazor.JSComponents.DriverJS.csproj index 22de8e9996..31f8ab2b21 100644 --- a/src/Masa.Blazor.JSComponents.DriverJS/Masa.Blazor.JSComponents.DriverJS.csproj +++ b/src/Masa.Blazor.JSComponents.DriverJS/Masa.Blazor.JSComponents.DriverJS.csproj @@ -6,8 +6,6 @@ enable 12 Masa.Blazor96_96.png - - true @@ -27,3 +25,4 @@ + diff --git a/src/Masa.Blazor.JSComponents.DriverJS/js-module/main.ts b/src/Masa.Blazor.JSComponents.DriverJS/js-module/main.ts index 7a38fba597..0d0da38672 100644 --- a/src/Masa.Blazor.JSComponents.DriverJS/js-module/main.ts +++ b/src/Masa.Blazor.JSComponents.DriverJS/js-module/main.ts @@ -10,14 +10,6 @@ export function init() { return driverObj; }, }; - - // const driverObj = driver(config); - - // if (drive) { - // driverObj.drive(); - // } - - // return driverObj; } export function drive(config: Config, stepIndex?: number) { diff --git a/src/Masa.Blazor.JSComponents.DriverJS/package.json b/src/Masa.Blazor.JSComponents.DriverJS/package.json index a5263df250..f420804461 100644 --- a/src/Masa.Blazor.JSComponents.DriverJS/package.json +++ b/src/Masa.Blazor.JSComponents.DriverJS/package.json @@ -8,7 +8,7 @@ }, "keywords": [], "author": "", - "license": "ISC", + "license": "MIT", "dependencies": { "driver.js": "^1.3.5" }, diff --git a/src/Masa.Blazor.JSComponents.DriverJS/rollup.config.ts b/src/Masa.Blazor.JSComponents.DriverJS/rollup.config.ts index 83fdbeba4f..13ba66d5c0 100644 --- a/src/Masa.Blazor.JSComponents.DriverJS/rollup.config.ts +++ b/src/Masa.Blazor.JSComponents.DriverJS/rollup.config.ts @@ -4,7 +4,6 @@ import css from "rollup-plugin-import-css"; import resolve from "@rollup/plugin-node-resolve"; import terser from "@rollup/plugin-terser"; import typescript from "@rollup/plugin-typescript"; - export default defineConfig({ input: "./js-module/main.ts", output: [ @@ -16,7 +15,7 @@ export default defineConfig({ plugins: [ typescript(), resolve(), - // terser(), + terser(), css({ output: "wwwroot/driver.css", }),