react-ajala
Advanced tools
Comparing version
@@ -36,2 +36,8 @@ import { jsxs as ot, jsx as Q } from "react/jsx-runtime"; | ||
if (o === "default") return; | ||
if (!Object.hasOwn(i, "default")) { | ||
const d = `Ajala step with id:"${s.id}" is missing a media query default value for the key "${n}". Please add a default value to avoid unexpected behavior.`; | ||
if (process.env.NODE_ENV === "development") | ||
throw new Error(d); | ||
console.error(d); | ||
} | ||
const r = { | ||
@@ -72,3 +78,3 @@ id: s.id, | ||
} | ||
const A = (l, t, e) => (e = Math.max(0, Math.min(1, e)), l + (t - l) * e); | ||
const O = (l, t, e) => (e = Math.max(0, Math.min(1, e)), l + (t - l) * e); | ||
function mt(l, t) { | ||
@@ -95,3 +101,3 @@ let e = null; | ||
var M, et, it, at; | ||
class gt { | ||
class ut { | ||
constructor(t) { | ||
@@ -331,3 +337,3 @@ E(this, M), p(this, "ajala"), p(this, "tooltip_element"), p(this, "wrapper_element"), p(this, "style_element"), p(this, "tooltip_container_element"), p(this, "arrow_element"), p(this, "overlay_element"), p(this, "overlay_path"), p(this, "next_btn"), p(this, "prev_btn"), p(this, "close_btn"), p(this, "is_default_tooltip_element"), p(this, "navigation"), p(this, "placement"), this.ajala = t, this.wrapper_element = document.createElement("div"), this.is_default_tooltip_element = !1, this.tooltip_element = this.ajala.options.custom_tooltip || document.createElement("div"), this.tooltip_container_element = document.createElement("div"), this.overlay_element = document.createElementNS( | ||
}; | ||
class ut { | ||
class gt { | ||
constructor({ ajala: t, ui: e }) { | ||
@@ -554,9 +560,9 @@ p(this, "ajala"), p(this, "ui"), p(this, "placement"), p(this, "animations"), this.ajala = t, this.ui = e, this.next = this.next.bind(this), this.prev = this.prev.bind(this), this.close = this.close.bind(this); | ||
if (d === "left") { | ||
let h = A(0, o.width, 0.05); | ||
let h = O(0, o.width, 0.05); | ||
n.width < o.width / 2 && (h = -i.width / 2 + n.width / 2), a.x = h; | ||
} else if (d === "center") { | ||
let h = A(0, o.width, 0.5); | ||
let h = O(0, o.width, 0.5); | ||
h = h - i.width / 2, a.x = h; | ||
} else if (d === "right") { | ||
let h = A(0, o.width, 0.95); | ||
let h = O(0, o.width, 0.95); | ||
h = h - i.width, n.width < o.width / 2 && (h = o.width - i.width / 2 - n.width / 2), a.x = h; | ||
@@ -568,9 +574,9 @@ } | ||
if (d === "top") { | ||
let h = A(0, o.height, 0.1); | ||
let h = O(0, o.height, 0.1); | ||
n.height < o.height / 2 && (h = -i.height / 2 + n.height / 2), a.y = h; | ||
} else if (d === "center") { | ||
let h = A(0, o.height, 0.5); | ||
let h = O(0, o.height, 0.5); | ||
h = h - i.height / 2, a.y = h; | ||
} else if (d === "bottom") { | ||
let h = A(0, o.height, 0.9); | ||
let h = O(0, o.height, 0.9); | ||
h = h - i.height, n.height < o.height / 2 && (h = o.height - i.height / 2 - n.height / 2), a.y = h; | ||
@@ -618,7 +624,7 @@ } | ||
let h = o.y + r, m = o.x + r; | ||
const g = this.calculatePlacementDelta({ | ||
const u = this.calculatePlacementDelta({ | ||
target: s, | ||
next_index: t | ||
}); | ||
return m = g.x_delta, h = g.y_delta, { | ||
return m = u.x_delta, h = u.y_delta, { | ||
y_delta: h, | ||
@@ -634,3 +640,3 @@ x_delta: m, | ||
scrolled: !1, | ||
placement: g.placement | ||
placement: u.placement | ||
}; | ||
@@ -657,3 +663,3 @@ } | ||
target: t | ||
}), g = c(this, C, U).call(this, { | ||
}), u = c(this, C, U).call(this, { | ||
align: o, | ||
@@ -663,4 +669,4 @@ target: t | ||
if (i === "top" || i === "bottom") | ||
if (g.is_valid && h.is_valid) | ||
a = g.alignment, s = h.axis, n = v; | ||
if (u.is_valid && h.is_valid) | ||
a = u.alignment, s = h.axis, n = v; | ||
else { | ||
@@ -738,8 +744,8 @@ const { auto_x_delta: f, auto_y_delta: y, auto_placement: w } = c(this, C, D).call(this, { | ||
target: l | ||
}), g = c(this, C, U).call(this, { | ||
}), u = c(this, C, U).call(this, { | ||
align: v, | ||
target: l | ||
}); | ||
if ((d === "bottom" || d === "top") && h.is_valid && g.is_valid) { | ||
s = g.alignment, n = h.axis; | ||
if ((d === "bottom" || d === "top") && h.is_valid && u.is_valid) { | ||
s = u.alignment, n = h.axis; | ||
break; | ||
@@ -751,3 +757,3 @@ } | ||
} | ||
o === a.length - 1 && (n = h.axis, s = g.alignment); | ||
o === a.length - 1 && (n = h.axis, s = u.alignment); | ||
} | ||
@@ -918,3 +924,3 @@ return { | ||
if (!r) return; | ||
const g = m - o, f = Math.min(g / a, 1), y = v(f), w = A(t, e, y); | ||
const u = m - o, f = Math.min(u / a, 1), y = v(f), w = O(t, e, y); | ||
n(w), f < 1 ? (d = requestAnimationFrame(h), this.is_animating = !0) : (i(), this.is_animating = !1); | ||
@@ -988,3 +994,3 @@ }; | ||
onUpdate(h) { | ||
const m = (d == null ? void 0 : d.x) ?? 0, g = (d == null ? void 0 : d.y) ?? 0, f = m + (n + i) * h, y = g + (o + r) * h; | ||
const m = (d == null ? void 0 : d.x) ?? 0, u = (d == null ? void 0 : d.y) ?? 0, f = m + (n + i) * h, y = u + (o + r) * h; | ||
s.style.transform = `translate(${f}px, ${y}px)`; | ||
@@ -1029,3 +1035,3 @@ }, | ||
}; | ||
var j, x, u, O, P, q, nt, J; | ||
var j, x, g, A, P, q, nt, J; | ||
class St extends ct { | ||
@@ -1035,3 +1041,3 @@ constructor(t, { start_immediately: e = !0, ...a } = { | ||
}) { | ||
super(), E(this, q), p(this, "options"), p(this, "is_active"), p(this, "initialized"), p(this, "original_steps"), p(this, "flatten_steps"), E(this, j), p(this, "active_step"), E(this, x), E(this, u), E(this, O), E(this, P); | ||
super(), E(this, q), p(this, "options"), p(this, "is_active"), p(this, "initialized"), p(this, "original_steps"), p(this, "flatten_steps"), E(this, j), p(this, "active_step"), E(this, x), E(this, g), E(this, A), E(this, P); | ||
const s = R(t); | ||
@@ -1041,10 +1047,10 @@ this.options = { start_immediately: e, ...a }, this.is_active = !1, this.original_steps = s, L(this, j, { | ||
queries: {} | ||
}), this.flatten_steps = [], this.initialized = !0, this.active_step = this.flatten_steps[0], L(this, x, new gt(this)), L(this, u, new ut({ | ||
}), this.flatten_steps = [], this.initialized = !0, this.active_step = this.flatten_steps[0], L(this, x, new ut(this)), L(this, g, new gt({ | ||
ajala: this, | ||
ui: _(this, x) | ||
})), L(this, O, new wt({ ajala: this, ui: _(this, x) })), L(this, P, new jt({ | ||
})), L(this, A, new wt({ ajala: this, ui: _(this, x) })), L(this, P, new jt({ | ||
ajala: this, | ||
ui: _(this, x), | ||
placement: _(this, O) | ||
})), _(this, x).navigation = _(this, u), _(this, x).placement = _(this, O), _(this, u).placement = _(this, O), _(this, u).animations = _(this, P), _(this, O).animations = _(this, P), this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], this.destroy = this.destroy.bind(this); | ||
placement: _(this, A) | ||
})), _(this, x).navigation = _(this, g), _(this, x).placement = _(this, A), _(this, g).placement = _(this, A), _(this, g).animations = _(this, P), _(this, A).animations = _(this, P), this.active_step = this.getFlattenSteps()[_(this, g).getValidNavIndex(0, "next")], this.destroy = this.destroy.bind(this); | ||
} | ||
@@ -1063,3 +1069,3 @@ /** | ||
_(this, j).queries | ||
), c(this, q, J).call(this), this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], _(this, x).init(), _(this, u).init(), (this.options.start_immediately || t) && this.start(); | ||
), c(this, q, J).call(this), this.active_step = this.getFlattenSteps()[_(this, g).getValidNavIndex(0, "next")], _(this, x).init(), _(this, g).init(), (this.options.start_immediately || t) && this.start(); | ||
} | ||
@@ -1161,3 +1167,3 @@ /** | ||
start() { | ||
this.is_active = !0, this.active_step = this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")], _(this, x).start(), _(this, u).start(), this.dispatchEvent({ | ||
this.is_active = !0, this.active_step = this.getFlattenSteps()[_(this, g).getValidNavIndex(0, "next")], _(this, x).start(), _(this, g).start(), this.dispatchEvent({ | ||
type: "onStart", | ||
@@ -1178,3 +1184,3 @@ data: this | ||
next() { | ||
this.is_active && _(this, u).next(); | ||
this.is_active && _(this, g).next(); | ||
} | ||
@@ -1185,3 +1191,3 @@ /** | ||
prev() { | ||
this.is_active && _(this, u).prev(); | ||
this.is_active && _(this, g).prev(); | ||
} | ||
@@ -1192,3 +1198,3 @@ /** | ||
close() { | ||
_(this, u).close(); | ||
_(this, g).close(); | ||
} | ||
@@ -1202,3 +1208,3 @@ /** | ||
const e = this.getFlattenSteps().findIndex((a) => a.id === t); | ||
e > -1 && _(this, u).goTo(e); | ||
e > -1 && _(this, g).goTo(e); | ||
} | ||
@@ -1218,6 +1224,6 @@ /** | ||
} | ||
j = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakSet(), nt = function() { | ||
j = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakSet(), nt = function() { | ||
_(this, j).instances.forEach((l) => { | ||
l.onchange = null; | ||
}), _(this, x).cleanUp(), _(this, u).cleanUp(); | ||
}), _(this, x).cleanUp(), _(this, g).cleanUp(); | ||
}, J = function() { | ||
@@ -1250,3 +1256,3 @@ for (const [l, t] of Object.entries( | ||
})), _(this, x).update(), this.goToStep( | ||
this.getFlattenSteps()[_(this, u).getValidNavIndex(0, "next")].id | ||
this.getFlattenSteps()[_(this, g).getValidNavIndex(0, "next")].id | ||
); | ||
@@ -1256,3 +1262,3 @@ }, _(this, j).instances.push(e); | ||
}; | ||
const st = lt(null), At = rt( | ||
const st = lt(null), Ot = rt( | ||
({ | ||
@@ -1269,3 +1275,3 @@ children: l, | ||
{} | ||
), [d, v] = b(), [h, m] = b(null), [g, f] = b(null), y = ht(null); | ||
), [d, v] = b(), [h, m] = b(null), [u, f] = b(null), y = ht(null); | ||
return H(() => { | ||
@@ -1329,7 +1335,7 @@ let w = null, $ = null; | ||
), | ||
s && g && X(/* @__PURE__ */ Q(s, {}), g) | ||
s && u && X(/* @__PURE__ */ Q(s, {}), u) | ||
] }); | ||
} | ||
); | ||
function Ot() { | ||
function At() { | ||
const l = dt(st); | ||
@@ -1344,4 +1350,4 @@ if (!l) | ||
St as AjalaJourney, | ||
At as AjalaJourneyProvider, | ||
Ot as useAjalaJourneyContext | ||
Ot as AjalaJourneyProvider, | ||
At as useAjalaJourneyContext | ||
}; |
{ | ||
"name": "react-ajala", | ||
"private": false, | ||
"version": "0.2.16", | ||
"version": "0.2.17", | ||
"type": "module", | ||
@@ -22,3 +22,3 @@ "main": "./dist/react-ajala.cjs", | ||
"dependencies": { | ||
"ajala.js": "0.4.8" | ||
"ajala.js": "0.4.9" | ||
}, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
98182
0.63%1574
0.45%4
100%+ Added
- Removed
Updated