Skip to content

Commit

Permalink
Added a new binding option called "useLargerDisplay" (defaults to fal…
Browse files Browse the repository at this point in the history
…se), which states if the bigger display for the dialog should be used (uses a new class called "journey-js-dialog-lg").
  • Loading branch information
William Troup committed Sep 4, 2024
1 parent 736fe77 commit 1586551
Show file tree
Hide file tree
Showing 17 changed files with 200 additions and 92 deletions.
62 changes: 36 additions & 26 deletions dist/journey.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ var init_is = __esm({
return t(e) && typeof e === "function";
}
e.definedFunction = s;
function r(e) {
function l(e) {
return t(e) && typeof e === "number";
}
e.definedNumber = r;
function l(e) {
e.definedNumber = l;
function r(e) {
return o(e) && e instanceof Array;
}
e.definedArray = l;
e.definedArray = r;
})(Is || (Is = {}));
}
});
Expand Down Expand Up @@ -95,14 +95,14 @@ var init_default = __esm({
return Is.definedFunction(e) ? e : t;
}
e.getFunction = s;
function r(e, t) {
function l(e, t) {
return Is.definedObject(e) ? e : t;
}
e.getObject = r;
function l(e, t) {
e.getObject = l;
function r(e, t) {
return Is.definedArray(e) ? e : t;
}
e.getArray = l;
e.getArray = r;
function a(e, t) {
let o = t;
if (Is.definedString(e)) {
Expand All @@ -113,7 +113,7 @@ var init_default = __esm({
o = n;
}
} else {
o = l(e, t);
o = r(e, t);
}
return o;
}
Expand Down Expand Up @@ -175,7 +175,7 @@ var init_dom = __esm({
return n;
}
e.getStyleValueByName = s;
function r(e, t) {
function l(e, t) {
try {
if (!e.contains(t)) {
e.appendChild(t);
Expand All @@ -184,8 +184,8 @@ var init_dom = __esm({
console.warn(e.message);
}
}
e.addNode = r;
function l(e, t) {
e.addNode = l;
function r(e, t) {
try {
if (e.contains(t)) {
e.removeChild(t);
Expand All @@ -194,7 +194,7 @@ var init_dom = __esm({
console.warn(e.message);
}
}
e.removeNode = l;
e.removeNode = r;
function a(e) {
e.preventDefault();
e.stopPropagation();
Expand All @@ -203,7 +203,7 @@ var init_dom = __esm({
function _(e, t, o) {
let n = e.pageX;
let s = e.pageY;
const r = i();
const l = i();
t.style.display = "block";
if (n + t.offsetWidth > window.innerWidth) {
n -= t.offsetWidth + o;
Expand All @@ -217,10 +217,10 @@ var init_dom = __esm({
s++;
s += o;
}
if (n < r.left) {
if (n < l.left) {
n = e.pageX + 1;
}
if (s < r.top) {
if (s < l.top) {
s = e.pageY + 1;
}
t.style.left = `${n}px`;
Expand All @@ -247,11 +247,11 @@ var init_dom = __esm({
n.appendChild(i);
i.appendChild(s);
s.type = "checkbox";
const r = t("span", "check-mark");
const l = t("span", "text");
l.innerHTML = o;
i.appendChild(r);
const l = t("span", "check-mark");
const r = t("span", "text");
r.innerHTML = o;
i.appendChild(l);
i.appendChild(r);
return s;
}
e.createCheckBox = g;
Expand Down Expand Up @@ -292,6 +292,7 @@ var init_binding = __esm({
t.ignore = Default.getBoolean(t.ignore, false);
t.moveToNextOnClick = Default.getBoolean(t.moveToNextOnClick, false);
t.offset = Default.getNumber(t.offset, 0);
t.useLargerDisplay = Default.getBoolean(t.useLargerDisplay, false);
t = o(t);
t = n(t);
return t;
Expand Down Expand Up @@ -412,10 +413,10 @@ var init_tooltip = __esm({
t.style.display = "none";
document.body.appendChild(t);
document.body.addEventListener("mousemove", (() => {
r();
l();
}));
document.addEventListener("scroll", (() => {
r();
l();
}));
}
}
Expand All @@ -430,15 +431,15 @@ var init_tooltip = __esm({
e.add = i;
function s(e, n, i) {
DomElement.cancelBubble(e);
r();
l();
o = setTimeout((() => {
t.innerHTML = n;
t.style.display = "block";
DomElement.showElementAtMousePosition(e, t, i.tooltipOffset);
}), i.tooltipDelay);
}
e.show = s;
function r() {
function l() {
if (Is.defined(t)) {
if (o !== 0) {
clearTimeout(o);
Expand All @@ -449,7 +450,7 @@ var init_tooltip = __esm({
}
}
}
e.hide = r;
e.hide = l;
})(ToolTip || (ToolTip = {}));
}
});
Expand Down Expand Up @@ -684,14 +685,23 @@ var require_journey = __commonJS({
}
}
function setDialogPosition(e, t) {
_element_Dialog_IsHint = t.isHint === true;
if (_element_Dialog_IsHint) {
_element_Dialog.className = "journey-js-dialog";
} else {
if (t.useLargerDisplay && _element_Dialog.className === "journey-js-dialog") {
_element_Dialog.className = "journey-js-dialog-lg";
} else if (!t.useLargerDisplay && _element_Dialog.className === "journey-js-dialog-lg") {
_element_Dialog.className = "journey-js-dialog";
}
}
if (_element_Dialog.style.display !== "block") {
_element_Dialog.style.display = "block";
Trigger.customEvent(t.events.onOpen, t._currentView.element);
}
if (_groups[_groups_Current].position === 0) {
Trigger.customEvent(t.events.onStart, t._currentView.element);
}
_element_Dialog_IsHint = t.isHint === true;
if (t.attach || t.isHint) {
if (t.isHint && t.alignHintToClickPosition) {
DomElement.showElementAtMousePosition(e, _element_Dialog, _configuration.hintClickPositionOffset);
Expand Down
2 changes: 1 addition & 1 deletion dist/journey.esm.js.map

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion dist/journey.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ var Binding;
t.ignore = Default.getBoolean(t.ignore, false);
t.moveToNextOnClick = Default.getBoolean(t.moveToNextOnClick, false);
t.offset = Default.getNumber(t.offset, 0);
t.useLargerDisplay = Default.getBoolean(t.useLargerDisplay, false);
t = o(t);
t = n(t);
return t;
Expand Down Expand Up @@ -597,14 +598,23 @@ var Disabled;
}
}
function setDialogPosition(e, t) {
_element_Dialog_IsHint = t.isHint === true;
if (_element_Dialog_IsHint) {
_element_Dialog.className = "journey-js-dialog";
} else {
if (t.useLargerDisplay && _element_Dialog.className === "journey-js-dialog") {
_element_Dialog.className = "journey-js-dialog-lg";
} else if (!t.useLargerDisplay && _element_Dialog.className === "journey-js-dialog-lg") {
_element_Dialog.className = "journey-js-dialog";
}
}
if (_element_Dialog.style.display !== "block") {
_element_Dialog.style.display = "block";
Trigger.customEvent(t.events.onOpen, t._currentView.element);
}
if (_groups[_groups_Current].position === 0) {
Trigger.customEvent(t.events.onStart, t._currentView.element);
}
_element_Dialog_IsHint = t.isHint === true;
if (t.attach || t.isHint) {
if (t.isHint && t.alignHintToClickPosition) {
DomElement.showElementAtMousePosition(e, _element_Dialog, _configuration.hintClickPositionOffset);
Expand Down
Loading

0 comments on commit 1586551

Please sign in to comment.