diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.css b/packages/overlayscrollbars/dist/overlayscrollbars.css
index 967dd50..ad5172d 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.css
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.css
@@ -19,7 +19,7 @@
z-index: -1;
contain: strict;
display: flex;
- flex-direction: column;
+ flex-direction: row;
flex-wrap: nowrap;
padding: inherit;
border: inherit;
@@ -118,11 +118,15 @@
min-height: 1px;
min-width: 1px; }
+[data-overlayscrollbars~='updating'] > .os-scrollbar {
+ display: none !important; }
+
.os-scrollbar {
+ contain: strict;
transition: opacity 0.3s, visibility 0.3s, top 0.3s, right 0.3s, bottom 0.3s, left 0.3s;
pointer-events: none;
position: absolute;
- z-index: 0;
+ z-index: 99999;
opacity: 0;
visibility: hidden; }
@@ -133,30 +137,24 @@ body > .os-scrollbar {
transition: none; }
.os-scrollbar-track {
- pointer-events: none;
position: relative;
- height: 100%;
- width: 100%;
+ direction: ltr !important;
padding: 0 !important;
border: none !important; }
+.os-scrollbar-handle {
+ position: absolute; }
+
+.os-scrollbar-track,
.os-scrollbar-handle {
pointer-events: none;
- position: absolute;
width: 100%;
height: 100%; }
-.os-scrollbar-handle-interactive,
-.os-scrollbar-track-interactive {
- pointer-events: auto; }
-
-.os-scrollbar-unusable,
-.os-scrollbar-unusable * {
- pointer-events: none !important; }
-
-.os-scrollbar-unusable .os-scrollbar-handle {
- opacity: 0 !important;
- visibility: hidden Im !important; }
+.os-scrollbar.os-scrollbar-track-interactive .os-scrollbar-track,
+.os-scrollbar.os-scrollbar-handle-interactive .os-scrollbar-handle {
+ pointer-events: auto;
+ touch-action: none; }
.os-scrollbar-horizontal {
bottom: 0;
@@ -173,7 +171,8 @@ body > .os-scrollbar {
right: auto;
left: 0; }
-.os-scrollbar-visible {
+.os-scrollbar-visible,
+.os-scrollbar-interaction.os-scrollbar-visible {
opacity: 1;
visibility: visible; }
@@ -181,9 +180,12 @@ body > .os-scrollbar {
opacity: 0;
visibility: hidden; }
-.os-scrollbar-interaction.os-scrollbar-visible {
- opacity: 1;
- visibility: visible; }
+.os-scrollbar-unusable,
+.os-scrollbar-unusable * {
+ pointer-events: none !important; }
+
+.os-scrollbar-unusable .os-scrollbar-handle {
+ opacity: 0 !important; }
.os-scrollbar.os-scrollbar-horizontal.os-scrollbar-cornerless {
left: 0;
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
index 7b16235..64c5b5b 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js
@@ -25,7 +25,7 @@ function style(t, n) {
}
return s;
}
- each(keys(n), (o => setCSSVal(t, o, n[o])));
+ t && each(keys(n), (o => setCSSVal(t, o, n[o])));
}
const createCache = (t, n) => {
@@ -291,10 +291,6 @@ const appendChildren = (t, n) => {
before(t, null, n);
};
-const prependChildren = (t, n) => {
- before(t, t && t.firstChild, n);
-};
-
const insertBefore = (t, n) => {
before(parent(t), t, n);
};
@@ -374,9 +370,9 @@ const a = jsAPI("IntersectionObserver");
const u = jsAPI("ResizeObserver");
-const d = jsAPI("cancelAnimationFrame");
+const f = jsAPI("cancelAnimationFrame");
-const f = jsAPI("requestAnimationFrame");
+const d = jsAPI("requestAnimationFrame");
const _ = window.setTimeout;
@@ -461,8 +457,8 @@ const debounce = (t, n) => {
if (l) {
const r = isFunction(i) ? i() : i;
const l = isNumber(r) && r >= 0;
- const u = n > 0 ? _ : f;
- const g = n > 0 ? h : d;
+ const u = n > 0 ? _ : d;
+ const g = n > 0 ? h : f;
const v = mergeParms(t);
const w = v || t;
const p = a.bind(0, w);
@@ -497,13 +493,11 @@ const getCSSVal = (t, n, o) => null != n ? n[o] || n.getPropertyValue(o) : t.sty
const setCSSVal = (t, n, o) => {
try {
- if (t) {
- const {style: s} = t;
- if (!isUndefined(s[n])) {
- s[n] = adaptCSSVal(n, o);
- } else {
- s.setProperty(n, o);
- }
+ const {style: s} = t;
+ if (!isUndefined(s[n])) {
+ s[n] = adaptCSSVal(n, o);
+ } else {
+ s.setProperty(n, o);
}
} catch (s) {}
};
@@ -588,8 +582,8 @@ const on = (t, n, o, s) => {
var e;
const c = supportPassiveEvents();
const r = null != (e = c && s && s.S) ? e : c;
- const i = s && s.C || false;
- const l = s && s.$ || false;
+ const i = s && s.$ || false;
+ const l = s && s.C || false;
const a = [];
const u = c ? {
passive: r,
@@ -608,6 +602,8 @@ const on = (t, n, o, s) => {
const stopPropagation = t => t.stopPropagation();
+const preventDefault = t => t.preventDefault();
+
const b = {
x: 0,
y: 0
@@ -684,61 +680,69 @@ const m = `${y}-flexbox-glue`;
const S = `${m}-max`;
-const C = "data-overlayscrollbars";
+const x = "data-overlayscrollbars";
-const x = `${C}-overflow-x`;
+const $ = `${x}-overflow-x`;
-const $ = `${C}-overflow-y`;
+const C = `${x}-overflow-y`;
const O = "overflowVisible";
-const z = "scrollbarHidden";
+const A = "scrollbarHidden";
-const I = "os-padding";
+const z = "updating";
-const A = "os-viewport";
+const T = "os-padding";
-const T = `${A}-arrange`;
+const I = "os-viewport";
-const D = "os-content";
+const E = `${I}-arrange`;
-const E = `${A}-scrollbar-hidden`;
+const L = "os-content";
+
+const H = `${I}-scrollbar-hidden`;
const P = `os-overflow-visible`;
-const H = "os-size-observer";
+const D = "os-size-observer";
-const L = `${H}-appear`;
+const M = `${D}-appear`;
-const M = `${H}-listener`;
+const R = `${D}-listener`;
-const R = `${M}-scroll`;
+const k = `${R}-scroll`;
-const V = `${M}-item`;
+const B = `${R}-item`;
-const k = `${V}-final`;
+const V = `${B}-final`;
-const B = "os-trinsic-observer";
+const j = "os-trinsic-observer";
-const j = "os-scrollbar";
+const Y = "os-scrollbar";
-const Y = `${j}-horizontal`;
+const q = `${Y}-horizontal`;
-const q = `${j}-vertical`;
+const F = `${Y}-vertical`;
-const F = "os-scrollbar-track";
+const G = `${Y}-track`;
-const G = "os-scrollbar-handle";
+const N = `${Y}-handle`;
-const N = `${j}-visible`;
+const U = `${Y}-visible`;
-const U = `${j}-cornerless`;
+const W = `${Y}-cornerless`;
-const W = `${j}-transitionless`;
+const X = `${Y}-transitionless`;
-const X = `${j}-interaction`;
+const J = `${Y}-interaction`;
-const J = `${j}-auto-hidden`;
+const K = `${Y}-unusable`;
+
+const Z = `${Y}-auto-hidden`;
+
+const Q = `${G}-interactive`;
+
+const tt = `${N}-interactive`;
const opsStringify = t => JSON.stringify(t, ((t, n) => {
if (isFunction(n)) {
@@ -747,7 +751,7 @@ const opsStringify = t => JSON.stringify(t, ((t, n) => {
return n;
}));
-const K = {
+const nt = {
paddingAbsolute: false,
showNativeOverlaidScrollbars: false,
updating: {
@@ -767,7 +771,7 @@ const K = {
autoHideDelay: 800,
dragScroll: true,
clickScroll: false,
- touch: true
+ pointers: [ "mouse", "touch", "pen" ]
}
};
@@ -796,19 +800,19 @@ const getOptionsDiff = (t, n) => {
return o;
};
-const Z = {};
+const ot = {};
-const getPlugins = () => assignDeep({}, Z);
+const getPlugins = () => assignDeep({}, ot);
const addPlugin = t => {
each(isArray(t) ? t : [ t ], (t => {
each(keys(t), (n => {
- Z[n] = t[n];
+ ot[n] = t[n];
}));
}));
};
-const Q = {
+const st = {
boolean: "__TPL_boolean_TYPE__",
number: "__TPL_number_TYPE__",
string: "__TPL_string_TYPE__",
@@ -818,56 +822,56 @@ const Q = {
null: "__TPL_null_TYPE__"
};
-const tt = Q.number;
+const et = st.number;
-const nt = Q.boolean;
+const ct = st.boolean;
-const ot = [ Q.array, Q.null ];
+const rt = [ st.array, st.null ];
-const st = "hidden scroll visible visible-hidden";
+const it = "hidden scroll visible visible-hidden";
-const et = "visible hidden auto";
+const lt = "visible hidden auto";
-const ct = "never scroll leavemove";
+const at = "never scroll leavemove";
({
- paddingAbsolute: nt,
- showNativeOverlaidScrollbars: nt,
+ paddingAbsolute: ct,
+ showNativeOverlaidScrollbars: ct,
updating: {
- elementEvents: ot,
- attributes: ot,
- debounce: [ Q.number, Q.array, Q.null ],
- ignoreMutation: [ Q.function, Q.null ]
+ elementEvents: rt,
+ attributes: rt,
+ debounce: [ st.number, st.array, st.null ],
+ ignoreMutation: [ st.function, st.null ]
},
overflow: {
- x: st,
- y: st
+ x: it,
+ y: it
},
scrollbars: {
- theme: [ Q.string, Q.null ],
- visibility: et,
- autoHide: ct,
- autoHideDelay: tt,
- dragScroll: nt,
- clickScroll: nt,
- touch: nt
+ theme: [ st.string, st.null ],
+ visibility: lt,
+ autoHide: at,
+ autoHideDelay: et,
+ dragScroll: ct,
+ clickScroll: ct,
+ pointers: [ st.array, st.null ]
}
});
-const rt = "__osOptionsValidationPlugin";
+const ut = "__osOptionsValidationPlugin";
-const it = 3333333;
+const ft = 3333333;
-const lt = "scroll";
+const dt = "scroll";
-const at = "__osSizeObserverPlugin";
+const _t = "__osSizeObserverPlugin";
-const ut = {
- [at]: {
+const ht = {
+ [_t]: {
O: (t, n, o) => {
- const s = createDOM(`
`);
+ const s = createDOM(``);
appendChildren(t, s);
- addClass(t, R);
+ addClass(t, k);
const e = s[0];
const c = e.lastChild;
const r = e.firstChild;
@@ -877,10 +881,10 @@ const ut = {
let u = false;
let _;
const reset = () => {
- scrollLeft(r, it);
- scrollTop(r, it);
- scrollLeft(c, it);
- scrollTop(c, it);
+ scrollLeft(r, ft);
+ scrollTop(r, ft);
+ scrollLeft(c, ft);
+ scrollTop(c, ft);
};
const onResized = t => {
_ = 0;
@@ -895,28 +899,28 @@ const ut = {
if (t) {
stopPropagation(t);
if (u && !_) {
- d(_);
- _ = f(onResized);
+ f(_);
+ _ = d(onResized);
}
} else {
onResized(false === t);
}
reset();
};
- const h = push([], [ on(r, lt, onScroll), on(c, lt, onScroll) ]);
+ const h = push([], [ on(r, dt, onScroll), on(c, dt, onScroll) ]);
style(i, {
- width: it,
- height: it
+ width: ft,
+ height: ft
});
- reset();
+ d(reset);
return [ o ? onScroll.bind(0, false) : reset, h ];
}
}
};
-let dt = 0;
+let gt = 0;
-const {round: ft, abs: _t} = Math;
+const {round: vt, abs: wt} = Math;
const getWindowDPR = () => {
const t = window.screen.deviceXDPI || 0;
@@ -925,40 +929,40 @@ const getWindowDPR = () => {
};
const diffBiggerThanOne = (t, n) => {
- const o = _t(t);
- const s = _t(n);
+ const o = wt(t);
+ const s = wt(n);
return !(o === s || o + 1 === s || o - 1 === s);
};
-const ht = "__osScrollbarsHidingPlugin";
+const pt = "__osScrollbarsHidingPlugin";
-const gt = {
- [ht]: {
- I: t => {
- const {A: n, T: o, D: s} = t;
+const bt = {
+ [pt]: {
+ A: t => {
+ const {T: n, I: o, L: s} = t;
const e = !s && !n && (o.x || o.y);
const c = e ? document.createElement("style") : false;
if (c) {
- attr(c, "id", `${T}-${dt}`);
- dt++;
+ attr(c, "id", `${E}-${gt}`);
+ gt++;
}
return c;
},
- P: (t, n, o, s, e, c, r) => {
+ H: (t, n, o, s, e, c, r) => {
const arrangeViewport = (n, c, r, i) => {
if (t) {
- const {H: t} = e();
- const {L: l, M: a} = n;
- const {x: u, y: d} = a;
- const {x: f, y: _} = l;
+ const {P: t} = e();
+ const {D: l, M: a} = n;
+ const {x: u, y: f} = a;
+ const {x: d, y: _} = l;
const h = i ? "paddingRight" : "paddingLeft";
const g = t[h];
const v = t.paddingTop;
const w = c.w + r.w;
const p = c.h + r.h;
const b = {
- w: _ && d ? `${_ + w - g}px` : "",
- h: f && u ? `${f + p - v}px` : ""
+ w: _ && f ? `${_ + w - g}px` : "",
+ h: d && u ? `${d + p - v}px` : ""
};
if (s) {
const {sheet: t} = s;
@@ -966,7 +970,7 @@ const gt = {
const {cssRules: n} = t;
if (n) {
if (!n.length) {
- t.insertRule(`#${attr(s, "id")} + .${T}::before {}`, 0);
+ t.insertRule(`#${attr(s, "id")} + .${E}::before {}`, 0);
}
const o = n[0].style;
o.width = b.w;
@@ -985,21 +989,21 @@ const gt = {
const undoViewportArrange = (s, i, l) => {
if (t) {
const a = l || c(s);
- const {H: u} = e();
- const {M: d} = a;
- const {x: f, y: _} = d;
+ const {P: u} = e();
+ const {M: f} = a;
+ const {x: d, y: _} = f;
const h = {};
const assignProps = t => each(t.split(" "), (t => {
h[t] = u[t];
}));
- if (f) {
+ if (d) {
assignProps("marginBottom paddingTop paddingBottom");
}
if (_) {
assignProps("marginLeft marginRight paddingLeft paddingRight");
}
const g = style(o, keys(h));
- removeClass(o, T);
+ removeClass(o, E);
if (!n) {
h.height = "";
}
@@ -1007,7 +1011,7 @@ const gt = {
return [ () => {
r(a, i, t, g);
style(o, g);
- addClass(o, T);
+ addClass(o, E);
}, a ];
}
return [ noop ];
@@ -1030,21 +1034,21 @@ const gt = {
return;
}
const i = {
- w: _t(r.w),
- h: _t(r.h)
+ w: wt(r.w),
+ h: wt(r.h)
};
const l = {
- w: _t(ft(c.w / (t.w / 100))),
- h: _t(ft(c.h / (t.h / 100)))
+ w: wt(vt(c.w / (t.w / 100))),
+ h: wt(vt(c.h / (t.h / 100)))
};
const a = getWindowDPR();
const u = i.w > 2 && i.h > 2;
- const d = !diffBiggerThanOne(l.w, l.h);
- const f = a !== n && a > 0;
- const _ = u && d && f;
+ const f = !diffBiggerThanOne(l.w, l.h);
+ const d = a !== n && a > 0;
+ const _ = u && f && d;
if (_) {
const [t, n] = s();
- assignDeep(o.V, t);
+ assignDeep(o.k, t);
if (n) {
e();
}
@@ -1056,7 +1060,7 @@ const gt = {
}
};
-let vt;
+let yt;
const getNativeScrollbarSize = (t, n, o, s) => {
appendChildren(t, n);
@@ -1072,7 +1076,7 @@ const getNativeScrollbarSize = (t, n, o, s) => {
const getNativeScrollbarsHiding = t => {
let n = false;
- const o = addClass(t, E);
+ const o = addClass(t, H);
try {
n = "none" === style(t, cssProperty("scrollbar-width")) || "none" === window.getComputedStyle(t, "::-webkit-scrollbar").getPropertyValue("display");
} catch (s) {}
@@ -1128,40 +1132,43 @@ const createEnvironment = () => {
x: 0 === l.x,
y: 0 === l.y
};
- const d = {
+ const f = {
+ host: null,
padding: !a,
+ viewport: t => a && t === t.ownerDocument.body && t,
content: false,
+ scrollbarsSlot: true,
cancel: {
nativeScrollbarsOverlaid: true,
body: null
}
};
- const f = assignDeep({}, K);
+ const d = assignDeep({}, nt);
const _ = {
- V: l,
- T: u,
- A: a,
- D: "-1" === style(o, "zIndex"),
- k: getRtlScrollBehavior(o, s),
- B: getFlexboxGlue(o, s),
+ k: l,
+ I: u,
+ T: a,
+ L: "-1" === style(o, "zIndex"),
+ B: getRtlScrollBehavior(o, s),
+ V: getFlexboxGlue(o, s),
j: t => e("_", t),
- Y: assignDeep.bind(0, {}, d),
+ Y: assignDeep.bind(0, {}, f),
q(t) {
- assignDeep(d, t);
- },
- F: assignDeep.bind(0, {}, f),
- G(t) {
assignDeep(f, t);
},
- N: assignDeep({}, d),
- U: assignDeep({}, f)
+ F: assignDeep.bind(0, {}, d),
+ G(t) {
+ assignDeep(d, t);
+ },
+ N: assignDeep({}, f),
+ U: assignDeep({}, d)
};
removeAttr(o, "style");
removeElements(o);
if (!a && (!u.x || !u.y)) {
let t;
window.addEventListener("resize", (() => {
- const n = getPlugins()[ht];
+ const n = getPlugins()[pt];
t = t || n && n.R();
t && t(_, r, c.bind(0, "_"));
}));
@@ -1170,37 +1177,39 @@ const createEnvironment = () => {
};
const getEnvironment = () => {
- if (!vt) {
- vt = createEnvironment();
+ if (!yt) {
+ yt = createEnvironment();
}
- return vt;
+ return yt;
};
const resolveInitialization = (t, n) => isFunction(t) ? t.apply(0, n) : t;
-const staticInitializationElement = (t, n, o, s) => resolveInitialization(s || resolveInitialization(o, t), t) || n.apply(0, t);
+const staticInitializationElement = (t, n, o, s) => {
+ const e = isUndefined(s) ? o : s;
+ const c = resolveInitialization(e, t);
+ return c || n();
+};
const dynamicInitializationElement = (t, n, o, s) => {
- let e = resolveInitialization(s, t);
- if (isNull(e) || isUndefined(e)) {
- e = resolveInitialization(o, t);
- }
- return true === e || isNull(e) || isUndefined(e) ? n.apply(0, t) : e;
+ const e = isUndefined(s) ? o : s;
+ const c = resolveInitialization(e, t);
+ return !!c && (isHTMLElement(c) ? c : n());
};
const cancelInitialization = (t, n) => {
const {nativeScrollbarsOverlaid: o, body: s} = t || {};
const {W: e, X: c} = n;
- const {Y: r, T: i} = getEnvironment();
+ const {Y: r, I: i} = getEnvironment();
const {nativeScrollbarsOverlaid: l, body: a} = r().cancel;
const u = null != o ? o : l;
- const d = isBoolean(s) || isNull(s) ? s : a;
- const f = (i.x || i.y) && u;
- const _ = e && (isNull(d) ? !c : d);
- return !!f || !!_;
+ const f = isUndefined(s) ? a : s;
+ const d = (i.x || i.y) && u;
+ const _ = e && (isNull(f) ? !c : f);
+ return !!d || !!_;
};
-const wt = createDiv.bind(0, "");
+const mt = createDiv.bind(0, "");
const unwrap = t => {
appendChildren(parent(t), contents(t));
@@ -1208,108 +1217,109 @@ const unwrap = t => {
};
const addDataAttrHost = (t, n) => {
- attr(t, C, n);
- return removeAttr.bind(0, t, C);
+ attr(t, x, n);
+ return removeAttr.bind(0, t, x);
};
const createStructureSetupElements = t => {
const n = getEnvironment();
- const {Y: o, A: s} = n;
- const e = getPlugins()[ht];
- const c = e && e.I;
+ const {Y: o, T: s} = n;
+ const e = getPlugins()[pt];
+ const c = e && e.A;
const {host: r, viewport: i, padding: l, content: a} = o();
- const d = isHTMLElement(t);
- const f = d ? {} : t;
- const {host: _, padding: h, viewport: g, content: v} = f;
- const w = d ? t : f.target;
- const p = is(w, "textarea");
- const b = w.ownerDocument;
- const y = w === b.body;
- const m = b.defaultView;
- const S = y ? s : !!u && !p && s;
- const O = staticInitializationElement.bind(0, [ w ]);
- const z = dynamicInitializationElement.bind(0, [ w ]);
- const T = [ O(wt, i, y && !hasOwnProperty(f, "viewport") ? w : g), O(wt, i), O(wt) ].filter((t => S ? true : t !== w))[0];
- const P = T === w;
- const H = {
- J: w,
- K: p ? O(wt, r, _) : w,
- Z: T,
- tt: !P && z(wt, l, h),
- nt: !P && z(wt, a, v),
- ot: !P && !s && c && c(n),
- st: m,
- et: b,
- ct: p,
- W: y,
- rt: d,
- X: P,
- it: (t, n) => P ? hasAttrClass(T, C, n) : hasClass(T, t),
- lt: (t, n, o) => P ? attrClass(T, C, n, o) : (o ? addClass : removeClass)(T, t)
+ const u = isHTMLElement(t);
+ const f = u ? {} : t;
+ const {host: d, padding: _, viewport: h, content: g} = f;
+ const v = u ? t : f.target;
+ const w = is(v, "textarea");
+ const p = v.ownerDocument;
+ const b = v === p.body;
+ const y = p.defaultView;
+ const m = staticInitializationElement.bind(0, [ v ]);
+ const S = dynamicInitializationElement.bind(0, [ v ]);
+ const O = m(mt, i, h);
+ const A = O === v;
+ const z = {
+ J: v,
+ K: w ? m(mt, r, d) : v,
+ Z: O,
+ tt: !A && S(mt, l, _),
+ nt: !A && S(mt, a, g),
+ ot: !A && !s && c && c(n),
+ st: b ? p.documentElement : O,
+ et: b ? p : O,
+ ct: y,
+ rt: p,
+ it: w,
+ W: b,
+ lt: u,
+ X: A,
+ ut: (t, n) => A ? hasAttrClass(O, x, n) : hasClass(O, t),
+ ft: (t, n, o) => A ? attrClass(O, x, n, o) : (o ? addClass : removeClass)(O, t)
};
- const L = keys(H).reduce(((t, n) => {
- const o = H[n];
+ const E = keys(z).reduce(((t, n) => {
+ const o = z[n];
return push(t, o && !parent(o) ? o : false);
}), []);
- const elementIsGenerated = t => t ? indexOf(L, t) > -1 : null;
- const {J: M, K: R, tt: V, Z: k, nt: B, ot: j} = H;
- const Y = [];
- const q = p && elementIsGenerated(R);
- const F = p ? M : contents([ B, k, V, R, M ].find((t => false === elementIsGenerated(t))));
- const G = B || k;
+ const elementIsGenerated = t => t ? indexOf(E, t) > -1 : null;
+ const {J: P, K: D, tt: M, Z: R, nt: k, ot: B} = z;
+ const V = [];
+ const j = w && elementIsGenerated(D);
+ const Y = w ? P : contents([ k, R, M, D, P ].find((t => false === elementIsGenerated(t))));
+ const q = k || R;
const appendElements = () => {
- const t = addDataAttrHost(R, P ? "viewport" : "host");
- const n = addClass(V, I);
- const o = addClass(k, !P && A);
- const e = addClass(B, D);
- const c = y ? addClass(parent(w), E) : noop;
- if (q) {
- insertAfter(M, R);
- push(Y, (() => {
- insertAfter(R, M);
- removeElements(R);
+ const t = addDataAttrHost(D, A ? "viewport" : "host");
+ const n = addClass(M, T);
+ const o = addClass(R, !A && I);
+ const e = addClass(k, L);
+ const c = b ? addClass(parent(v), H) : noop;
+ if (j) {
+ insertAfter(P, D);
+ push(V, (() => {
+ insertAfter(D, P);
+ removeElements(D);
}));
}
- appendChildren(G, F);
- appendChildren(R, V);
- appendChildren(V || R, !P && k);
- appendChildren(k, B);
- push(Y, (() => {
+ appendChildren(q, Y);
+ appendChildren(D, M);
+ appendChildren(M || D, !A && R);
+ appendChildren(R, k);
+ push(V, (() => {
c();
t();
- removeAttr(k, x);
- removeAttr(k, $);
- if (elementIsGenerated(B)) {
- unwrap(B);
- }
+ removeAttr(R, $);
+ removeAttr(R, C);
if (elementIsGenerated(k)) {
unwrap(k);
}
- if (elementIsGenerated(V)) {
- unwrap(V);
+ if (elementIsGenerated(R)) {
+ unwrap(R);
+ }
+ if (elementIsGenerated(M)) {
+ unwrap(M);
}
n();
o();
e();
}));
- if (s && !P) {
- push(Y, removeClass.bind(0, k, E));
+ if (s && !A) {
+ push(V, removeClass.bind(0, R, H));
}
- if (j) {
- insertBefore(k, j);
- push(Y, removeElements.bind(0, j));
+ if (B) {
+ insertBefore(R, B);
+ push(V, removeElements.bind(0, B));
}
};
- return [ H, appendElements, runEachAndClear.bind(0, Y) ];
+ return [ z, appendElements, runEachAndClear.bind(0, V) ];
};
const createTrinsicUpdateSegment = (t, n) => {
const {nt: o} = t;
const [s] = n;
return t => {
- const {B: n} = getEnvironment();
- const {ut: e} = s();
- const {dt: c} = t;
+ const {V: n} = getEnvironment();
+ const {dt: e} = s();
+ const {_t: c} = t;
const r = (o || !n) && c;
if (r) {
style(o, {
@@ -1317,8 +1327,8 @@ const createTrinsicUpdateSegment = (t, n) => {
});
}
return {
- ft: r,
- _t: r
+ ht: r,
+ gt: r
};
};
};
@@ -1331,18 +1341,18 @@ const createPaddingUpdateSegment = (t, n) => {
o: topRightBottomLeft()
}, topRightBottomLeft.bind(0, e, "padding", ""));
return (t, n, e) => {
- let [u, d] = a(e);
- const {A: f, B: _} = getEnvironment();
- const {ht: h} = o();
- const {ft: g, _t: v, gt: w} = t;
+ let [u, f] = a(e);
+ const {T: d, V: _} = getEnvironment();
+ const {vt: h} = o();
+ const {ht: g, gt: v, wt: w} = t;
const [p, b] = n("paddingAbsolute");
const y = !_ && v;
- if (g || d || y) {
- [u, d] = l(e);
+ if (g || f || y) {
+ [u, f] = l(e);
}
- const m = !i && (b || w || d);
+ const m = !i && (b || w || f);
if (m) {
- const t = !p || !c && !f;
+ const t = !p || !c && !d;
const n = u.r + u.l;
const o = u.t + u.b;
const e = {
@@ -1364,27 +1374,27 @@ const createPaddingUpdateSegment = (t, n) => {
style(r, i);
s({
tt: u,
- vt: !t,
- H: c ? i : assignDeep({}, e, i)
+ bt: !t,
+ P: c ? i : assignDeep({}, e, i)
});
}
return {
- wt: m
+ yt: m
};
};
};
-const {max: pt} = Math;
+const {max: St} = Math;
-const bt = pt.bind(0, 0);
+const xt = St.bind(0, 0);
-const yt = "visible";
+const $t = "visible";
-const mt = "hidden";
+const Ct = "hidden";
-const St = 42;
+const Ot = 42;
-const Ct = {
+const At = {
u: equalWH,
o: {
w: 0,
@@ -1392,19 +1402,19 @@ const Ct = {
}
};
-const xt = {
+const zt = {
u: equalXY,
o: {
- x: mt,
- y: mt
+ x: Ct,
+ y: Ct
}
};
const getOverflowAmount = (t, n) => {
const o = window.devicePixelRatio % 1 !== 0 ? 1 : 0;
const s = {
- w: bt(t.w - n.w),
- h: bt(t.h - n.h)
+ w: xt(t.w - n.w),
+ h: xt(t.h - n.h)
};
return {
w: s.w > o ? s.w : 0,
@@ -1414,61 +1424,61 @@ const getOverflowAmount = (t, n) => {
const conditionalClass = (t, n, o) => o ? addClass(t, n) : removeClass(t, n);
-const overflowIsVisible = t => 0 === t.indexOf(yt);
+const overflowIsVisible = t => 0 === t.indexOf($t);
const createOverflowUpdateSegment = (t, n) => {
const [o, s] = n;
- const {K: e, tt: c, Z: r, ot: i, X: l, lt: a} = t;
- const {V: u, B: d, A: f, T: _} = getEnvironment();
- const h = getPlugins()[ht];
- const g = !l && !f && (_.x || _.y);
- const [v, w] = createCache(Ct, fractionalSize.bind(0, r));
- const [p, b] = createCache(Ct, scrollSize.bind(0, r));
- const [y, m] = createCache(Ct);
- const [S, I] = createCache(Ct);
- const [A] = createCache(xt);
+ const {K: e, tt: c, Z: r, ot: i, X: l, ft: a} = t;
+ const {k: u, V: f, T: d, I: _} = getEnvironment();
+ const h = getPlugins()[pt];
+ const g = !l && !d && (_.x || _.y);
+ const [v, w] = createCache(At, fractionalSize.bind(0, r));
+ const [p, b] = createCache(At, scrollSize.bind(0, r));
+ const [y, m] = createCache(At);
+ const [S, z] = createCache(At);
+ const [T] = createCache(zt);
const fixFlexboxGlue = (t, n) => {
style(r, {
height: ""
});
if (n) {
- const {vt: n, tt: s} = o();
- const {bt: c, L: i} = t;
+ const {bt: n, tt: s} = o();
+ const {St: c, D: i} = t;
const l = fractionalSize(e);
const a = clientSize(e);
const u = "content-box" === style(r, "boxSizing");
- const d = n || u ? s.b + s.t : 0;
- const f = !(_.x && u);
+ const f = n || u ? s.b + s.t : 0;
+ const d = !(_.x && u);
style(r, {
- height: a.h + l.h + (c.x && f ? i.x : 0) - d
+ height: a.h + l.h + (c.x && d ? i.x : 0) - f
});
}
};
const getViewportOverflowState = (t, n) => {
- const o = !f && !t ? St : 0;
+ const o = !d && !t ? Ot : 0;
const getStatePerAxis = (t, s, e) => {
const c = style(r, t);
const i = n ? n[t] : c;
const l = "scroll" === i;
const a = s ? o : e;
- const u = l && !f ? a : 0;
- const d = s && !!o;
- return [ c, l, u, d ];
+ const u = l && !d ? a : 0;
+ const f = s && !!o;
+ return [ c, l, u, f ];
};
const [s, e, c, i] = getStatePerAxis("overflowX", _.x, u.x);
- const [l, a, d, h] = getStatePerAxis("overflowY", _.y, u.y);
+ const [l, a, f, h] = getStatePerAxis("overflowY", _.y, u.y);
return {
- yt: {
+ xt: {
x: s,
y: l
},
- bt: {
+ St: {
x: e,
y: a
},
- L: {
+ D: {
x: c,
- y: d
+ y: f
},
M: {
x: i,
@@ -1479,7 +1489,7 @@ const createOverflowUpdateSegment = (t, n) => {
const setViewportOverflowState = (t, n, o, s) => {
const setAxisOverflowStyle = (t, n) => {
const o = overflowIsVisible(t);
- const s = n && o && t.replace(`${yt}-`, "") || "";
+ const s = n && o && t.replace(`${$t}-`, "") || "";
return [ n && !o ? t : "", overflowIsVisible(s) ? "hidden" : s ];
};
const [e, c] = setAxisOverflowStyle(o.x, n.x);
@@ -1489,72 +1499,72 @@ const createOverflowUpdateSegment = (t, n) => {
return getViewportOverflowState(t, s);
};
const hideNativeScrollbars = (t, n, s, e) => {
- const {L: c, M: r} = t;
+ const {D: c, M: r} = t;
const {x: i, y: l} = r;
const {x: a, y: u} = c;
- const {H: d} = o();
- const f = n ? "marginLeft" : "marginRight";
+ const {P: f} = o();
+ const d = n ? "marginLeft" : "marginRight";
const _ = n ? "paddingLeft" : "paddingRight";
- const h = d[f];
- const g = d.marginBottom;
- const v = d[_];
- const w = d.paddingBottom;
+ const h = f[d];
+ const g = f.marginBottom;
+ const v = f[_];
+ const w = f.paddingBottom;
e.width = `calc(100% + ${u + -1 * h}px)`;
- e[f] = -u + h;
+ e[d] = -u + h;
e.marginBottom = -a + g;
if (s) {
e[_] = v + (l ? u : 0);
e.paddingBottom = w + (i ? a : 0);
}
};
- const [T, D] = h ? h.P(g, d, r, i, o, getViewportOverflowState, hideNativeScrollbars) : [ () => g, () => [ noop ] ];
+ const [I, E] = h ? h.H(g, f, r, i, o, getViewportOverflowState, hideNativeScrollbars) : [ () => g, () => [ noop ] ];
return (t, n, i) => {
- const {ft: u, St: h, _t: g, wt: H, dt: L, gt: M} = t;
- const {ut: R, ht: V} = o();
- const [k, B] = n("showNativeOverlaidScrollbars");
+ const {ht: u, $t: h, gt: g, yt: L, _t: D, wt: M} = t;
+ const {dt: R, vt: k} = o();
+ const [B, V] = n("showNativeOverlaidScrollbars");
const [j, Y] = n("overflow");
- const q = k && _.x && _.y;
- const F = !l && !d && (u || g || h || B || L);
+ const q = B && _.x && _.y;
+ const F = !l && !f && (u || g || h || V || D);
const G = overflowIsVisible(j.x);
const N = overflowIsVisible(j.y);
const U = G || N;
let W = w(i);
let X = b(i);
let J = m(i);
- let K = I(i);
+ let K = z(i);
let Z;
- if (B && f) {
- a(E, z, !q);
+ if (V && d) {
+ a(H, A, !q);
}
if (F) {
Z = getViewportOverflowState(q);
fixFlexboxGlue(Z, R);
}
- if (u || H || g || M || B) {
+ if (u || L || g || M || V) {
if (U) {
a(P, O, false);
}
- const [t, n] = D(q, V, Z);
+ const [t, n] = E(q, k, Z);
const [o, s] = W = v(i);
const [e, c] = X = p(i);
const l = clientSize(r);
let u = e;
- let d = l;
+ let f = l;
t();
- if ((c || s || B) && n && !q && T(n, e, o, V)) {
- d = clientSize(r);
+ if ((c || s || V) && n && !q && I(n, e, o, k)) {
+ f = clientSize(r);
u = scrollSize(r);
}
- const f = {
- w: bt(pt(e.w, u.w) + o.w),
- h: bt(pt(e.h, u.h) + o.h)
+ const d = {
+ w: xt(St(e.w, u.w) + o.w),
+ h: xt(St(e.h, u.h) + o.h)
};
const _ = {
- w: bt(d.w + bt(l.w - e.w) + o.w),
- h: bt(d.h + bt(l.h - e.h) + o.h)
+ w: xt(f.w + xt(l.w - e.w) + o.w),
+ h: xt(f.h + xt(l.h - e.h) + o.h)
};
K = S(_);
- J = y(getOverflowAmount(f, _), i);
+ J = y(getOverflowAmount(d, _), i);
}
const [Q, tt] = K;
const [nt, ot] = J;
@@ -1565,7 +1575,7 @@ const createOverflowUpdateSegment = (t, n) => {
y: nt.h > 0
};
const lt = G && N && (it.x || it.y) || G && it.x && !it.y || N && it.y && !it.x;
- if (H || M || rt || et || tt || ot || Y || B || F) {
+ if (L || M || rt || et || tt || ot || Y || V || F) {
const t = {
marginRight: 0,
marginBottom: 0,
@@ -1575,39 +1585,39 @@ const createOverflowUpdateSegment = (t, n) => {
overflowX: ""
};
const n = setViewportOverflowState(q, it, j, t);
- const o = T(n, st, ct, V);
+ const o = I(n, st, ct, k);
if (!l) {
- hideNativeScrollbars(n, V, o, t);
+ hideNativeScrollbars(n, k, o, t);
}
if (F) {
fixFlexboxGlue(n, R);
}
if (l) {
- attr(e, x, t.overflowX);
- attr(e, $, t.overflowY);
+ attr(e, $, t.overflowX);
+ attr(e, C, t.overflowY);
} else {
style(r, t);
}
}
- attrClass(e, C, O, lt);
+ attrClass(e, x, O, lt);
conditionalClass(c, P, lt);
!l && conditionalClass(r, P, U);
- const [at, ut] = A(getViewportOverflowState(q).yt);
+ const [at, ut] = T(getViewportOverflowState(q).xt);
s({
- yt: at,
+ xt: at,
Ct: {
x: Q.w,
y: Q.h
},
- xt: {
+ Ot: {
x: nt.w,
y: nt.h
},
- $t: it
+ At: it
});
return {
- Ot: ut,
- zt: tt,
+ zt: ut,
+ Tt: tt,
It: ot
};
};
@@ -1626,50 +1636,52 @@ const prepareUpdateHints = (t, n, o) => {
};
const createStructureSetupUpdate = (t, n) => {
- const {Z: o} = t;
- const {A: s, T: e, B: c} = getEnvironment();
- const r = !s && (e.x || e.y);
- const i = [ createTrinsicUpdateSegment(t, n), createPaddingUpdateSegment(t, n), createOverflowUpdateSegment(t, n) ];
- return (t, n, s) => {
- const e = prepareUpdateHints(assignDeep({
- ft: false,
+ const {Z: o, ft: s} = t;
+ const {T: e, I: c, V: r} = getEnvironment();
+ const i = !e && (c.x || c.y);
+ const l = [ createTrinsicUpdateSegment(t, n), createPaddingUpdateSegment(t, n), createOverflowUpdateSegment(t, n) ];
+ return (t, n, e) => {
+ const c = prepareUpdateHints(assignDeep({
+ ht: false,
+ yt: false,
wt: false,
- gt: false,
- dt: false,
- zt: false,
+ _t: false,
+ Tt: false,
It: false,
- Ot: false,
- St: false,
- _t: false
- }, n), {}, s);
- const l = r || !c;
- const a = l && scrollLeft(o);
- const u = l && scrollTop(o);
- let d = e;
- each(i, (n => {
- d = prepareUpdateHints(d, n(d, t, !!s) || {}, s);
+ zt: false,
+ $t: false,
+ gt: false
+ }, n), {}, e);
+ const a = i || !r;
+ const u = a && scrollLeft(o);
+ const f = a && scrollTop(o);
+ s("", z, true);
+ let d = c;
+ each(l, (n => {
+ d = prepareUpdateHints(d, n(d, t, !!e) || {}, e);
}));
- scrollLeft(o, a);
- scrollTop(o, u);
+ scrollLeft(o, u);
+ scrollTop(o, f);
+ s("", z);
return d;
};
};
-const $t = 3333333;
+const Tt = 3333333;
const getElmDirectionIsRTL = t => "rtl" === style(t, "direction");
const domRectHasDimensions = t => t && (t.height || t.width);
const createSizeObserver = (t, n, o) => {
- const {At: s = false, Tt: e = false} = o || {};
- const c = getPlugins()[at];
- const {k: r} = getEnvironment();
- const i = createDOM(``);
+ const {Et: s = false, Lt: e = false} = o || {};
+ const c = getPlugins()[_t];
+ const {B: r} = getEnvironment();
+ const i = createDOM(``);
const l = i[0];
const a = l.firstChild;
- const d = getElmDirectionIsRTL.bind(0, l);
- const [f] = createCache({
+ const f = getElmDirectionIsRTL.bind(0, l);
+ const [d] = createCache({
o: void 0,
_: true,
u: (t, n) => !(!t || !domRectHasDimensions(t) && domRectHasDimensions(n))
@@ -1681,7 +1693,7 @@ const createSizeObserver = (t, n, o) => {
let i = false;
let a = true;
if (o) {
- const [n, , o] = f(t.pop().contentRect);
+ const [n, , o] = d(t.pop().contentRect);
const s = domRectHasDimensions(n);
const e = domRectHasDimensions(o);
c = !o || !s;
@@ -1694,69 +1706,70 @@ const createSizeObserver = (t, n, o) => {
}
if (s && a) {
const n = e ? t[0] : getElmDirectionIsRTL(l);
- scrollLeft(l, n ? r.n ? -$t : r.i ? 0 : $t : $t);
- scrollTop(l, $t);
+ scrollLeft(l, n ? r.n ? -Tt : r.i ? 0 : Tt : Tt);
+ scrollTop(l, Tt);
}
if (!c) {
n({
- ft: !e,
- Dt: e ? t : void 0,
- Tt: !!i
+ ht: !e,
+ Ht: e ? t : void 0,
+ Lt: !!i
});
}
};
const _ = [];
let h = e ? onSizeChangedCallbackProxy : false;
let g;
- if (u) {
- const t = new u(onSizeChangedCallbackProxy);
- t.observe(a);
- push(_, (() => {
- t.disconnect();
- }));
- } else if (c) {
- const [t, n] = c.O(a, onSizeChangedCallbackProxy, e);
- h = t;
- push(_, n);
- }
- if (s) {
- g = createCache({
- o: !d()
- }, d);
- const [t] = g;
- push(_, on(l, "scroll", (n => {
- const o = t();
- const [s, e] = o;
- if (e) {
- removeClass(a, "ltr rtl");
- if (s) {
- addClass(a, "rtl");
- } else {
- addClass(a, "ltr");
- }
- onSizeChangedCallbackProxy(o);
- }
- stopPropagation(n);
- })));
- }
- if (h) {
- addClass(l, L);
- push(_, on(l, "animationstart", h, {
- $: !!u
- }));
- }
- prependChildren(t, l);
- return () => {
+ return [ () => {
runEachAndClear(_);
removeElements(l);
- };
+ }, () => {
+ if (u) {
+ const t = new u(onSizeChangedCallbackProxy);
+ t.observe(a);
+ push(_, (() => {
+ t.disconnect();
+ }));
+ } else if (c) {
+ const [t, n] = c.O(a, onSizeChangedCallbackProxy, e);
+ h = t;
+ push(_, n);
+ }
+ if (s) {
+ g = createCache({
+ o: !f()
+ }, f);
+ const [t] = g;
+ push(_, on(l, "scroll", (n => {
+ const o = t();
+ const [s, e] = o;
+ if (e) {
+ removeClass(a, "ltr rtl");
+ if (s) {
+ addClass(a, "rtl");
+ } else {
+ addClass(a, "ltr");
+ }
+ onSizeChangedCallbackProxy(o);
+ }
+ stopPropagation(n);
+ })));
+ }
+ if (h) {
+ addClass(l, M);
+ push(_, on(l, "animationstart", h, {
+ C: !!u
+ }));
+ }
+ appendChildren(t, l);
+ } ];
};
const isHeightIntrinsic = t => 0 === t.h || t.isIntersecting || t.intersectionRatio > 0;
const createTrinsicObserver = (t, n) => {
let o;
- const s = createDiv(B);
+ const s = createDiv(j);
const e = [];
const [c] = createCache({
o: false
@@ -1776,26 +1789,29 @@ const createTrinsicObserver = (t, n) => {
return triggerOnTrinsicChangedCallback(t.pop(), n);
}
};
- if (a) {
- o = new a((t => intersectionObserverCallback(t)), {
- root: t
- });
- o.observe(s);
- push(e, (() => {
- o.disconnect();
- }));
- } else {
- const onSizeChanged = () => {
- const t = offsetSize(s);
- triggerOnTrinsicChangedCallback(t);
- };
- push(e, createSizeObserver(s, onSizeChanged));
- onSizeChanged();
- }
- prependChildren(t, s);
return [ () => {
runEachAndClear(e);
removeElements(s);
+ }, () => {
+ if (a) {
+ o = new a((t => intersectionObserverCallback(t)), {
+ root: t
+ });
+ o.observe(s);
+ push(e, (() => {
+ o.disconnect();
+ }));
+ } else {
+ const onSizeChanged = () => {
+ const t = offsetSize(s);
+ triggerOnTrinsicChangedCallback(t);
+ };
+ const [t, n] = createSizeObserver(s, onSizeChanged);
+ push(e, t);
+ n();
+ onSizeChanged();
+ }
+ appendChildren(t, s);
}, () => {
if (o) {
return intersectionObserverCallback(o.takeRecords(), true);
@@ -1832,16 +1848,15 @@ const createEventContentChange = (t, n, o) => {
n();
}
}
- const listener = t => {
+ const i = on(o, c, (t => {
if (e) {
- off(o, c, listener);
+ i();
s.delete(o);
} else {
n(t);
}
- };
- on(o, c, listener);
- s.set(o, [ c, () => off(o, c, listener) ]);
+ }));
+ s.set(o, [ c, i ]);
}))));
}
};
@@ -1854,8 +1869,8 @@ const createEventContentChange = (t, n, o) => {
const createDOMObserver = (t, n, o, s) => {
let e = false;
- const {Et: c, Pt: r, Ht: i, Lt: a, Mt: u, Rt: d} = s || {};
- const f = debounce((() => {
+ const {Pt: c, Dt: r, Mt: i, Rt: a, kt: u, Bt: f} = s || {};
+ const d = debounce((() => {
if (e) {
o(true);
}
@@ -1863,43 +1878,43 @@ const createDOMObserver = (t, n, o, s) => {
g: 33,
v: 99
});
- const [_, h] = createEventContentChange(t, f, i);
+ const [_, h] = createEventContentChange(t, d, i);
const g = c || [];
const v = r || [];
const w = g.concat(v);
const observerCallback = (e, c) => {
const r = u || noop;
- const i = d || noop;
+ const i = f || noop;
const l = [];
- const f = [];
+ const d = [];
let _ = false;
let g = false;
let w = false;
each(e, (o => {
- const {attributeName: e, target: c, type: u, oldValue: d, addedNodes: h} = o;
+ const {attributeName: e, target: c, type: u, oldValue: f, addedNodes: h} = o;
const p = "attributes" === u;
const b = "childList" === u;
const y = t === c;
const m = p && isString(e) ? attr(c, e) : 0;
- const S = 0 !== m && d !== m;
- const C = indexOf(v, e) > -1 && S;
+ const S = 0 !== m && f !== m;
+ const x = indexOf(v, e) > -1 && S;
if (n && !y) {
const n = !p;
- const l = p && C;
+ const l = p && x;
const u = l && a && is(c, a);
- const _ = u ? !r(c, e, d, m) : n || l;
+ const _ = u ? !r(c, e, f, m) : n || l;
const v = _ && !i(o, !!u, t, s);
- push(f, h);
+ push(d, h);
g = g || v;
w = w || b;
}
- if (!n && y && S && !r(c, e, d, m)) {
+ if (!n && y && S && !r(c, e, f, m)) {
push(l, e);
- _ = _ || C;
+ _ = _ || x;
}
}));
- if (w && !isEmptyArray(f)) {
- h((t => f.reduce(((n, o) => {
+ if (w && !isEmptyArray(d)) {
+ h((t => d.reduce(((n, o) => {
push(n, find(t, o));
return is(o, t) ? push(n, o) : n;
}), [])));
@@ -1931,31 +1946,31 @@ const createDOMObserver = (t, n, o, s) => {
}
}, () => {
if (e) {
- f.m();
+ d.m();
const t = p.takeRecords();
return !isEmptyArray(t) && observerCallback(t, true);
}
} ];
};
-const Ot = `[${C}]`;
+const It = `[${x}]`;
-const zt = `.${A}`;
+const Et = `.${I}`;
-const It = [ "tabindex" ];
+const Lt = [ "tabindex" ];
-const At = [ "wrap", "cols", "rows" ];
+const Ht = [ "wrap", "cols", "rows" ];
-const Tt = [ "id", "class", "style", "open" ];
+const Pt = [ "id", "class", "style", "open" ];
const createStructureSetupObservers = (t, n, o) => {
let s;
let e;
let c;
const [, r] = n;
- const {K: i, Z: l, nt: a, ct: d, X: f, it: _, lt: h} = t;
- const {A: g, B: v} = getEnvironment();
- const [w] = createCache({
+ const {K: i, Z: l, nt: a, it: f, X: d, ut: _, ft: h} = t;
+ const {V: g} = getEnvironment();
+ const [v] = createCache({
u: equalWH,
o: {
w: 0,
@@ -1963,16 +1978,18 @@ const createStructureSetupObservers = (t, n, o) => {
}
}, (() => {
const t = _(P, O);
- const n = _(T, "");
+ const n = _(E, "");
const o = n && scrollLeft(l);
const s = n && scrollTop(l);
h(P, O);
- h(T, "");
+ h(E, "");
+ h("", z, true);
const e = scrollSize(a);
const c = scrollSize(l);
const r = fractionalSize(l);
h(P, O, t);
- h(T, "", n);
+ h(E, "", n);
+ h("", z);
scrollLeft(l, o);
scrollTop(l, s);
return {
@@ -1980,8 +1997,8 @@ const createStructureSetupObservers = (t, n, o) => {
h: c.h + e.h + r.h
};
}));
- const p = d ? At : Tt.concat(At);
- const b = debounce(o, {
+ const w = f ? Ht : Pt.concat(Ht);
+ const p = debounce(o, {
g: () => s,
v: () => e,
p(t, n) {
@@ -1994,8 +2011,8 @@ const createStructureSetupObservers = (t, n, o) => {
}
});
const updateViewportAttrsFromHost = t => {
- each(t || It, (t => {
- if (indexOf(It, t) > -1) {
+ each(t || Lt, (t => {
+ if (indexOf(Lt, t) > -1) {
const n = attr(i, t);
if (isString(n)) {
attr(l, t, n);
@@ -2008,35 +2025,35 @@ const createStructureSetupObservers = (t, n, o) => {
const onTrinsicChanged = (t, n) => {
const [s, e] = t;
const c = {
- dt: e
+ _t: e
};
r({
- ut: s
+ dt: s
});
!n && o(c);
return c;
};
- const onSizeChanged = ({ft: t, Dt: n, Tt: s}) => {
- const e = !t || s ? o : b;
+ const onSizeChanged = ({ht: t, Ht: n, Lt: s}) => {
+ const e = !t || s ? o : p;
let c = false;
if (n) {
const [t, o] = n;
c = o;
r({
- ht: t
+ vt: t
});
}
e({
- ft: t,
- gt: c
+ ht: t,
+ wt: c
});
};
const onContentMutation = (t, n) => {
- const [, s] = w();
+ const [, s] = v();
const e = {
- _t: s
+ gt: s
};
- const c = t ? o : b;
+ const c = t ? o : p;
if (s) {
!n && c(e);
}
@@ -2044,55 +2061,58 @@ const createStructureSetupObservers = (t, n, o) => {
};
const onHostMutation = (t, n, o) => {
const s = {
- St: n
+ $t: n
};
if (n) {
- !o && b(s);
- } else if (!f) {
+ !o && p(s);
+ } else if (!d) {
updateViewportAttrsFromHost(t);
}
return s;
};
- const y = (a || !v) && createTrinsicObserver(i, onTrinsicChanged);
- const m = !f && createSizeObserver(i, onSizeChanged, {
- Tt: true,
- At: !g
+ const [b, y, m] = a || !g ? createTrinsicObserver(i, onTrinsicChanged) : [ noop, noop, noop ];
+ const [S, x] = !d ? createSizeObserver(i, onSizeChanged, {
+ Lt: true,
+ Et: true
+ }) : [ noop, noop ];
+ const [$, C] = createDOMObserver(i, false, onHostMutation, {
+ Dt: Pt,
+ Pt: Pt.concat(Lt)
});
- const [S, C] = createDOMObserver(i, false, onHostMutation, {
- Pt: Tt,
- Et: Tt.concat(It)
- });
- const x = f && new u(onSizeChanged.bind(0, {
- ft: true
+ const A = d && u && new u(onSizeChanged.bind(0, {
+ ht: true
}));
- x && x.observe(i);
+ A && A.observe(i);
updateViewportAttrsFromHost();
return [ () => {
- c && c[0]();
- y && y[0]();
- m && m();
- x && x.disconnect();
+ b();
S();
+ c && c[0]();
+ A && A.disconnect();
+ $();
+ }, () => {
+ x();
+ y();
}, () => {
const t = {};
const n = C();
- const o = c && c[1]();
- const s = y && y[1]();
+ const o = m();
+ const s = c && c[1]();
if (n) {
assignDeep(t, onHostMutation.apply(0, push(n, true)));
}
if (o) {
- assignDeep(t, onContentMutation.apply(0, push(o, true)));
+ assignDeep(t, onTrinsicChanged.apply(0, push(o, true)));
}
if (s) {
- assignDeep(t, onTrinsicChanged.apply(0, push(s, true)));
+ assignDeep(t, onContentMutation.apply(0, push(s, true)));
}
return t;
}, t => {
const [n] = t("updating.ignoreMutation");
const [o, r] = t("updating.attributes");
const [i, u] = t("updating.elementEvents");
- const [d, f] = t("updating.debounce");
+ const [f, d] = t("updating.debounce");
const _ = u || r;
const ignoreMutationFromOptions = t => isFunction(n) && n(t);
if (_) {
@@ -2101,26 +2121,26 @@ const createStructureSetupObservers = (t, n, o) => {
c[0]();
}
c = createDOMObserver(a || l, true, onContentMutation, {
- Pt: p.concat(o || []),
- Et: p.concat(o || []),
- Ht: i,
- Lt: Ot,
- Rt: (t, n) => {
+ Dt: w.concat(o || []),
+ Pt: w.concat(o || []),
+ Mt: i,
+ Rt: It,
+ Bt: (t, n) => {
const {target: o, attributeName: s} = t;
- const e = !n && s ? liesBetween(o, Ot, zt) : false;
- return e || !!closest(o, `.${j}`) || !!ignoreMutationFromOptions(t);
+ const e = !n && s ? liesBetween(o, It, Et) : false;
+ return e || !!closest(o, `.${Y}`) || !!ignoreMutationFromOptions(t);
}
});
}
- if (f) {
- b.m();
- if (isArray(d)) {
- const t = d[0];
- const n = d[1];
+ if (d) {
+ p.m();
+ if (isArray(f)) {
+ const t = f[0];
+ const n = f[1];
s = isNumber(t) ? t : false;
e = isNumber(n) ? n : false;
- } else if (isNumber(d)) {
- s = d;
+ } else if (isNumber(f)) {
+ s = f;
e = false;
} else {
s = false;
@@ -2135,15 +2155,15 @@ const Dt = {
y: 0
};
-const Et = {
+const Mt = {
tt: {
t: 0,
r: 0,
b: 0,
l: 0
},
- vt: false,
- H: {
+ bt: false,
+ P: {
marginRight: 0,
marginBottom: 0,
marginLeft: 0,
@@ -2153,73 +2173,169 @@ const Et = {
paddingLeft: 0
},
Ct: Dt,
- xt: Dt,
- yt: {
+ Ot: Dt,
+ xt: {
x: "hidden",
y: "hidden"
},
- $t: {
+ At: {
x: false,
y: false
},
- ut: false,
- ht: false
+ dt: false,
+ vt: false
};
const createStructureSetup = (t, n) => {
const o = createOptionCheck(n, {});
- const s = createState(Et);
+ const s = createState(Mt);
const [e, c, r] = createEventListenerHub();
const [i] = s;
const [l, a, u] = createStructureSetupElements(t);
- const d = createStructureSetupUpdate(l, s);
+ const f = createStructureSetupUpdate(l, s);
const triggerUpdateEvent = (t, n, o) => {
const s = keys(t).some((n => t[n]));
if (s || !isEmptyObject(n) || o) {
r("u", [ t, n, o ]);
}
};
- const [f, _, h] = createStructureSetupObservers(l, s, (t => {
- triggerUpdateEvent(d(o, t), {}, false);
+ const [d, _, h, g] = createStructureSetupObservers(l, s, (t => {
+ triggerUpdateEvent(f(o, t), {}, false);
}));
- const g = i.bind(0);
- g.Vt = t => {
+ const v = i.bind(0);
+ v.Vt = t => {
e("u", t);
};
- g.kt = a;
- g.Bt = l;
+ v.jt = () => {
+ _();
+ a();
+ };
+ v.Yt = l;
return [ (t, o) => {
const s = createOptionCheck(n, t, o);
- h(s);
- triggerUpdateEvent(d(s, _(), o), t, !!o);
- }, g, () => {
+ g(s);
+ triggerUpdateEvent(f(s, h(), o), t, !!o);
+ }, v, () => {
c();
- f();
+ d();
u();
} ];
};
-const Pt = "touchstart mouseenter";
+const {round: Rt, abs: kt} = Math;
-const Ht = "touchend touchcancel mouseleave";
-
-const stopRootClickPropagation = (t, n) => on(t, "mousedown", on.bind(0, n, "click", stopPropagation, {
- $: true,
- C: true
-}), {
- C: true
+const getPageOffset = t => ({
+ x: t.pageX,
+ y: t.pageY
});
-const createScrollbarsSetupElements = (t, n) => {
- const {Y: o} = getEnvironment();
- const {scrollbarsSlot: s} = o();
- const {et: e, J: c, K: r, Z: i, rt: l} = n;
- const a = l ? null : t.scrollbarsSlot;
- const u = dynamicInitializationElement([ c, r, i ], (() => r), s, a);
- const scrollbarsAddRemoveClass = (t, n, o, s) => {
- const e = o ? addClass : removeClass;
+const getScale = t => {
+ const {width: n, height: o} = getBoundingClientRect(t);
+ const {w: s, h: e} = offsetSize(t);
+ return {
+ x: Rt(n) / s || 1,
+ y: Rt(o) / e || 1
+ };
+};
+
+const continuePointerDown = (t, n, o) => {
+ const s = n.scrollbars;
+ const {button: e, isPrimary: c, pointerType: r} = t;
+ const {pointers: i} = s;
+ return 0 === e && c && s[o] && (i || []).includes(r);
+};
+
+const createRootClickStopPropagationEvents = (t, n) => on(t, "mousedown", on.bind(0, n, "click", stopPropagation, {
+ C: true,
+ $: true
+}), {
+ $: true
+});
+
+const createDragScrollingEvents = (t, n, o, s, e, c) => {
+ const {B: r} = getEnvironment();
+ const {qt: i, Ft: l, Gt: a} = o;
+ const u = `scroll${c ? "Left" : "Top"}`;
+ const f = `${c ? "x" : "y"}`;
+ const d = `${c ? "w" : "h"}`;
+ const createOnPointerMoveHandler = (t, n, o) => _ => {
+ const {Ot: h} = e();
+ const g = (getPageOffset(_)[f] - n) * o;
+ const v = offsetSize(l)[d] - offsetSize(i)[d];
+ const w = g / v;
+ const p = w * h[f];
+ const b = "rtl" === style(a, "direction");
+ const y = b && c ? r.n || r.i ? 1 : -1 : 1;
+ s[u] = kt(t) + p * y;
+ };
+ return on(i, "pointerdown", (o => {
+ if (continuePointerDown(o, t, "dragScroll")) {
+ const t = on(n, "selectstart", (t => preventDefault(t)), {
+ S: false
+ });
+ const e = on(i, "pointermove", createOnPointerMoveHandler(s[u] || 0, getPageOffset(o)[f], 1 / getScale(s)[f]));
+ on(i, "pointerup", (n => {
+ t();
+ e();
+ i.releasePointerCapture(n.pointerId);
+ }), {
+ C: true
+ });
+ i.setPointerCapture(o.pointerId);
+ }
+ }));
+};
+
+const createScrollbarsSetupEvents = (t, n) => (o, s, e, c, r) => {
+ const {Gt: i} = o;
+ return runEachAndClear.bind(0, [ on(i, "pointerenter", (() => {
+ s(J, true);
+ })), on(i, "pointerleave pointercancel", (() => {
+ s(J);
+ })), createRootClickStopPropagationEvents(i, e), createDragScrollingEvents(t, e, o, c, n, r) ]);
+};
+
+const {min: Bt, max: Vt, abs: jt} = Math;
+
+const getScrollbarHandleLengthRatio = (t, n, o, s) => {
+ if (s) {
+ const t = o ? "x" : "y";
+ const {Ot: n, Ct: e} = s;
+ const c = e[t];
+ const r = n[t];
+ return Vt(0, Bt(1, c / (c + r)));
+ }
+ const e = o ? "w" : "h";
+ const c = offsetSize(t)[e];
+ const r = offsetSize(n)[e];
+ return Vt(0, Bt(1, c / r));
+};
+
+const getScrollbarHandleOffsetRatio = (t, n, o, s, e, c) => {
+ const {B: r} = getEnvironment();
+ const i = c ? "x" : "y";
+ const l = c ? "Left" : "Top";
+ const {Ot: a} = s;
+ const u = Math.floor(a[i]);
+ const f = jt(o[`scroll${l}`]);
+ const d = c && e;
+ const _ = r.i ? f : u - f;
+ const h = d ? _ : f;
+ const g = Bt(1, h / u);
+ const v = getScrollbarHandleLengthRatio(t, n, c);
+ return 1 / v * (1 - v) * g;
+};
+
+const createScrollbarsSetupElements = (t, n, o) => {
+ const {Y: s} = getEnvironment();
+ const {scrollbarsSlot: e} = s();
+ const {rt: c, J: r, K: i, Z: l, lt: a, st: u} = n;
+ const {scrollbarsSlot: f} = a ? {} : t;
+ const d = dynamicInitializationElement([ r, i, l ], (() => i), e, f);
+ const scrollbarStructureAddRemoveClass = (t, n, o) => {
+ const s = o ? addClass : removeClass;
each(t, (t => {
- e((s || noop)(t) || t.jt, n);
+ s(t.Gt, n);
}));
};
const scrollbarsHandleStyle = (t, n) => {
@@ -2228,86 +2344,99 @@ const createScrollbarsSetupElements = (t, n) => {
style(o, s);
}));
};
- const d = [];
- const f = [];
+ const scrollbarStructureRefreshHandleLength = (t, n, o) => {
+ scrollbarsHandleStyle(t, (t => {
+ const {qt: s, Ft: e} = t;
+ return [ s, {
+ [o ? "width" : "height"]: `${(100 * getScrollbarHandleLengthRatio(s, e, o, n)).toFixed(3)}%`
+ } ];
+ }));
+ };
+ const scrollbarStructureRefreshHandleOffset = (t, n, o) => {
+ const s = o ? "X" : "Y";
+ scrollbarsHandleStyle(t, (t => {
+ const {qt: e, Ft: c, Gt: r} = t;
+ const i = getScrollbarHandleOffsetRatio(e, c, u, n, "rtl" === style(r, "direction"), o);
+ const l = i === i;
+ return [ e, {
+ transform: l ? `translate${s}(${(100 * i).toFixed(3)}%)` : ""
+ } ];
+ }));
+ };
const h = [];
- const g = scrollbarsAddRemoveClass.bind(0, f);
- const v = scrollbarsAddRemoveClass.bind(0, h);
+ const g = [];
+ const v = [];
+ const scrollbarsAddRemoveClass = (t, n, o) => {
+ const s = isBoolean(o);
+ const e = s ? o : true;
+ const c = s ? !o : true;
+ e && scrollbarStructureAddRemoveClass(g, t, n);
+ c && scrollbarStructureAddRemoveClass(v, t, n);
+ };
+ const refreshScrollbarsHandleLength = t => {
+ scrollbarStructureRefreshHandleLength(g, t, true);
+ scrollbarStructureRefreshHandleLength(v, t);
+ };
+ const refreshScrollbarsHandleOffset = t => {
+ scrollbarStructureRefreshHandleOffset(g, t, true);
+ scrollbarStructureRefreshHandleOffset(v, t);
+ };
const generateScrollbarDOM = t => {
- const n = t ? Y : q;
- const o = t ? f : h;
- const s = isEmptyArray(o) ? W : "";
- const c = createDiv(`${j} ${n} ${s}`);
- const r = createDiv(F);
+ const n = t ? q : F;
+ const s = t ? g : v;
+ const e = isEmptyArray(s) ? X : "";
+ const r = createDiv(`${Y} ${n} ${e}`);
const i = createDiv(G);
- const l = {
- jt: c,
- Yt: r,
- qt: i
+ const l = createDiv(N);
+ const a = {
+ Gt: r,
+ Ft: i,
+ qt: l
};
- appendChildren(c, r);
appendChildren(r, i);
- push(o, l);
- push(d, [ removeElements.bind(0, c), on(c, Pt, (() => {
- g(X, true);
- v(X, true);
- })), on(c, Ht, (() => {
- g(X);
- v(X);
- })), stopRootClickPropagation(c, e) ]);
- return l;
+ appendChildren(i, l);
+ push(s, a);
+ push(h, [ removeElements.bind(0, r), o(a, scrollbarsAddRemoveClass, c, u, t) ]);
+ return a;
};
const w = generateScrollbarDOM.bind(0, true);
const p = generateScrollbarDOM.bind(0, false);
const appendElements = () => {
- appendChildren(u, f[0].jt);
- appendChildren(u, h[0].jt);
+ appendChildren(d, g[0].Gt);
+ appendChildren(d, v[0].Gt);
_((() => {
- g(W);
- v(W);
+ scrollbarsAddRemoveClass(X);
}), 300);
};
w();
p();
return [ {
- Ft: {
- Gt: f,
- Nt: w,
- Ut: g,
- Wt: scrollbarsHandleStyle.bind(0, f)
- },
+ Nt: refreshScrollbarsHandleLength,
+ Ut: refreshScrollbarsHandleOffset,
+ Wt: scrollbarsAddRemoveClass,
Xt: {
- Gt: h,
- Nt: p,
- Ut: v,
- Wt: scrollbarsHandleStyle.bind(0, h)
+ Jt: g,
+ Kt: w,
+ Zt: scrollbarsHandleStyle.bind(0, g)
+ },
+ Qt: {
+ Jt: v,
+ Kt: p,
+ Zt: scrollbarsHandleStyle.bind(0, v)
}
- }, appendElements, runEachAndClear.bind(0, d) ];
+ }, appendElements, runEachAndClear.bind(0, h) ];
};
-const {min: Lt} = Math;
-
const createSelfCancelTimeout = t => {
let n;
- const o = t ? _ : f;
- const s = t ? h : d;
+ const o = t ? _ : d;
+ const s = t ? h : f;
return [ e => {
s(n);
n = o(e, isFunction(t) ? t() : t);
}, () => s(n) ];
};
-const refreshScrollbarHandleLength = (t, n, o) => {
- const {xt: s, Ct: e} = n;
- const c = o ? "x" : "y";
- const r = e[c];
- const i = s[c];
- const l = Lt(1, r / (r + i));
- t((t => [ t.qt, {
- [o ? "width" : "height"]: `${(100 * l).toFixed(3)}%`
- } ]));
-};
-
const createScrollbarsSetup = (t, n, o) => {
let s;
let e;
@@ -2317,26 +2446,29 @@ const createScrollbarsSetup = (t, n, o) => {
let l = 0;
const a = createState({});
const [u] = a;
- const [d, f] = createSelfCancelTimeout();
+ const [f, d] = createSelfCancelTimeout();
const [_, h] = createSelfCancelTimeout();
const [g, v] = createSelfCancelTimeout(100);
const [w, p] = createSelfCancelTimeout(100);
const [b, y] = createSelfCancelTimeout((() => l));
- const [m, S, C] = createScrollbarsSetupElements(t, o.Bt);
- const {K: x, Z: $} = o.Bt;
- const {Ft: O, Xt: z} = m;
- const {Ut: I, Wt: A} = O;
- const {Ut: T, Wt: D} = z;
+ const [m, S, x] = createScrollbarsSetupElements(t, o.Yt, createScrollbarsSetupEvents(n, o));
+ const {K: $, Z: C, st: O, et: A, X: z, W: T} = o.Yt;
+ const {Xt: I, Qt: E, Wt: L, Nt: H, Ut: P} = m;
+ const {Zt: D} = I;
+ const {Zt: M} = E;
+ const styleScrollbarPosition = t => {
+ const {Gt: n} = t;
+ const o = z && !T && parent(n) === C && n;
+ return [ o, {
+ transform: o ? `translate(${scrollLeft(O)}px, ${scrollTop(O)}px)` : ""
+ } ];
+ };
const manageScrollbarsAutoHide = (t, n) => {
y();
if (t) {
- I(J);
- T(J);
+ L(Z);
} else {
- const hide = () => {
- I(J, true);
- T(J, true);
- };
+ const hide = () => L(Z, true);
if (l > 0 && !n) {
b(hide);
} else {
@@ -2348,91 +2480,99 @@ const createScrollbarsSetup = (t, n, o) => {
r = e;
r && manageScrollbarsAutoHide(true);
};
- const E = [ v, y, p, h, f, C, on(x, "mouseover", onHostMouseEnter, {
- $: true
- }), on(x, "mouseenter", onHostMouseEnter), on(x, "mouseleave", (() => {
+ const R = [ v, y, p, h, d, x, on($, "mouseover", onHostMouseEnter, {
+ C: true
+ }), on($, "mouseenter", onHostMouseEnter), on($, "mouseleave", (() => {
r = false;
e && manageScrollbarsAutoHide(false);
- })), on(x, "mousemove", (() => {
- s && d((() => {
+ })), on($, "mousemove", (() => {
+ s && f((() => {
v();
manageScrollbarsAutoHide(true);
w((() => {
s && manageScrollbarsAutoHide(false);
}));
}));
- })), on($, "scroll", (() => {
- c && _((() => {
- manageScrollbarsAutoHide(true);
+ })), on(A, "scroll", (() => {
+ _((() => {
+ P(o());
+ c && manageScrollbarsAutoHide(true);
g((() => {
c && !r && manageScrollbarsAutoHide(false);
}));
}));
+ z && D(styleScrollbarPosition);
+ z && M(styleScrollbarPosition);
})) ];
- const P = u.bind(0);
- P.Bt = m;
- P.kt = S;
+ const k = u.bind(0);
+ k.Yt = m;
+ k.jt = S;
return [ (t, r, a) => {
- const {zt: u, It: d, Ot: f} = a;
- const _ = createOptionCheck(n, t, r);
- const h = o();
- const [g, v] = _("scrollbars.theme");
- const [w, p] = _("scrollbars.visibility");
- const [b, y] = _("scrollbars.autoHide");
- const [m] = _("scrollbars.autoHideDelay");
- _("scrollbars.dragScrolling");
- _("scrollbars.touchSupport");
- const S = u || d;
- const C = f || p;
+ const {Tt: u, It: f, zt: d, wt: _} = a;
+ const h = createOptionCheck(n, t, r);
+ const g = o();
+ const {Ot: v, xt: w} = g;
+ const [p, b] = h("scrollbars.theme");
+ const [y, m] = h("scrollbars.visibility");
+ const [S, x] = h("scrollbars.autoHide");
+ const [$] = h("scrollbars.autoHideDelay");
+ const [C, O] = h("scrollbars.dragScroll");
+ const [A, z] = h("scrollbars.clickScroll");
+ const T = u || f || _;
+ const I = d || m;
const setScrollbarVisibility = (t, n) => {
- const o = "visible" === w || "auto" === w && "scroll" === t;
- n(N, o);
+ const o = "visible" === y || "auto" === y && "scroll" === t;
+ L(U, o, n);
return o;
};
- l = m;
- if (C) {
- const {yt: t} = h;
- const n = setScrollbarVisibility(t.x, I);
- const o = setScrollbarVisibility(t.y, T);
- const s = n && o;
- I(U, !s);
- T(U, !s);
+ l = $;
+ if (b) {
+ L(i);
+ L(p, true);
+ i = p;
}
- if (v) {
- I(i);
- T(i);
- I(g, true);
- T(g, true);
- i = g;
- }
- if (y) {
- s = "move" === b;
- e = "leave" === b;
- c = "never" !== b;
+ if (x) {
+ s = "move" === S;
+ e = "leave" === S;
+ c = "never" !== S;
manageScrollbarsAutoHide(!c, true);
}
- if (S) {
- refreshScrollbarHandleLength(A, h, true);
- refreshScrollbarHandleLength(D, h);
+ if (O) {
+ L(tt, C);
}
- }, P, runEachAndClear.bind(0, E) ];
+ if (z) {
+ L(Q, A);
+ }
+ if (I) {
+ const t = setScrollbarVisibility(w.x, true);
+ const n = setScrollbarVisibility(w.y, false);
+ const o = t && n;
+ L(W, !o);
+ }
+ if (T) {
+ H(g);
+ P(g);
+ L(K, !v.x, true);
+ L(K, !v.y, false);
+ }
+ }, k, runEachAndClear.bind(0, R) ];
};
-const Mt = new Set;
+const Yt = new Set;
-const Rt = new WeakMap;
+const qt = new WeakMap;
const addInstance = (t, n) => {
- Rt.set(t, n);
- Mt.add(t);
+ qt.set(t, n);
+ Yt.add(t);
};
const removeInstance = t => {
- Rt.delete(t);
- Mt.delete(t);
+ qt.delete(t);
+ Yt.delete(t);
};
-const getInstance = t => Rt.get(t);
+const getInstance = t => qt.get(t);
const OverlayScrollbars = (t, n, o) => {
let s = false;
@@ -2444,16 +2584,16 @@ const OverlayScrollbars = (t, n, o) => {
if (a) {
return a;
}
- const u = r[rt];
+ const u = r[ut];
const validateOptions = t => {
const n = t || {};
const o = u && u.O;
return o ? o(n, true) : n;
};
- const d = assignDeep({}, e(), validateOptions(n));
- const [f, _, h] = createEventListenerHub(o);
- const [g, v, w] = createStructureSetup(t, d);
- const [p, b, y] = createScrollbarsSetup(t, d, v);
+ const f = assignDeep({}, e(), validateOptions(n));
+ const [d, _, h] = createEventListenerHub(o);
+ const [g, v, w] = createStructureSetup(t, f);
+ const [p, b, y] = createScrollbarsSetup(t, f, v);
const update = (t, n) => {
g(t, !!n);
};
@@ -2470,20 +2610,20 @@ const OverlayScrollbars = (t, n, o) => {
const S = {
options(t) {
if (t) {
- const n = getOptionsDiff(d, validateOptions(t));
+ const n = getOptionsDiff(f, validateOptions(t));
if (!isEmptyObject(n)) {
- assignDeep(d, n);
+ assignDeep(f, n);
update(n);
}
}
- return assignDeep({}, d);
+ return assignDeep({}, f);
},
- on: f,
+ on: d,
off: (t, n) => {
t && n && _(t, n);
},
state() {
- const {Ct: t, xt: n, yt: o, $t: e, tt: c, vt: r} = v();
+ const {Ct: t, Ot: n, xt: o, At: e, tt: c, bt: r} = v();
return assignDeep({}, {
overflowEdge: t,
overflowAmount: n,
@@ -2495,7 +2635,7 @@ const OverlayScrollbars = (t, n, o) => {
});
},
elements() {
- const {J: t, K: n, tt: o, Z: s, nt: e} = v.Bt;
+ const {J: t, K: n, tt: o, Z: s, nt: e} = v.Yt;
return assignDeep({}, {
target: t,
host: n,
@@ -2519,16 +2659,16 @@ const OverlayScrollbars = (t, n, o) => {
n(OverlayScrollbars, S);
}
}));
- if (cancelInitialization(!i && t.cancel, v.Bt)) {
+ if (cancelInitialization(!i && t.cancel, v.Yt)) {
destroy(true);
return S;
}
- v.kt();
- b.kt();
+ v.jt();
+ b.jt();
addInstance(l, S);
h("initialized", [ S ]);
v.Vt(((t, n, o) => {
- const {ft: s, gt: e, dt: c, zt: r, It: i, Ot: l, _t: a, St: u} = t;
+ const {ht: s, wt: e, _t: c, Tt: r, It: i, zt: l, gt: a, $t: u} = t;
h("updated", [ S, {
updateHints: {
sizeChanged: s,
@@ -2550,7 +2690,7 @@ const OverlayScrollbars = (t, n, o) => {
OverlayScrollbars.plugin = addPlugin;
OverlayScrollbars.env = () => {
- const {V: t, T: n, A: o, k: s, B: e, D: c, N: r, U: i, Y: l, q: a, F: u, G: d} = getEnvironment();
+ const {k: t, I: n, T: o, B: s, V: e, L: c, N: r, U: i, Y: l, q: a, F: u, G: f} = getEnvironment();
return assignDeep({}, {
scrollbarsSize: t,
scrollbarsOverlaid: n,
@@ -2563,9 +2703,9 @@ OverlayScrollbars.env = () => {
getDefaultInitialization: l,
setDefaultInitialization: a,
getDefaultOptions: u,
- setDefaultOptions: d
+ setDefaultOptions: f
});
};
-export { OverlayScrollbars, gt as scrollbarsHidingPlugin, ut as sizeObserverPlugin };
+export { OverlayScrollbars, bt as scrollbarsHidingPlugin, ht as sizeObserverPlugin };
//# sourceMappingURL=overlayscrollbars.esm.js.map
diff --git a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
index 0f7e009..00e51d1 100644
--- a/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
+++ b/packages/overlayscrollbars/dist/overlayscrollbars.esm.js.map
@@ -1 +1 @@
-{"version":3,"file":"overlayscrollbars.esm.js","sources":["../src/support/utils/array.ts","../src/support/dom/style.ts","../src/support/cache.ts","../src/support/utils/types.ts","../src/support/utils/object.ts","../src/support/dom/attribute.ts","../src/support/dom/traversal.ts","../src/support/dom/manipulation.ts","../src/support/dom/create.ts","../src/support/compatibility/vendors.ts","../src/support/compatibility/apis.ts","../src/support/dom/class.ts","../src/support/utils/equal.ts","../src/support/utils/function.ts","../src/support/dom/dimensions.ts","../src/support/dom/events.ts","../src/support/dom/offset.ts","../src/support/eventListeners.ts","../src/setups/setups.ts","../src/classnames.ts","../src/options.ts","../src/plugins/plugins.ts","../src/plugins/optionsValidationPlugin/validation.ts","../src/plugins/optionsValidationPlugin/optionsValidationPlugin.ts","../src/plugins/sizeObserverPlugin/sizeObserverPlugin.ts","../src/plugins/scrollbarsHidingPlugin/scrollbarsHidingPlugin.ts","../src/environment.ts","../src/initialization.ts","../src/setups/structureSetup/structureSetup.elements.ts","../src/setups/structureSetup/updateSegments/trinsicUpdateSegment.ts","../src/setups/structureSetup/updateSegments/paddingUpdateSegment.ts","../src/setups/structureSetup/updateSegments/overflowUpdateSegment.ts","../src/setups/structureSetup/structureSetup.update.ts","../src/observers/sizeObserver.ts","../src/observers/trinsicObserver.ts","../src/observers/domObserver.ts","../src/setups/structureSetup/structureSetup.observers.ts","../src/setups/structureSetup/structureSetup.ts","../src/setups/scrollbarsSetup/scrollbarsSetup.elements.ts","../src/setups/scrollbarsSetup/scrollbarsSetup.ts","../src/instances.ts","../src/overlayscrollbars.ts"],"sourcesContent":["import { isArrayLike, isString } from 'support/utils/types';\r\nimport { PlainObject } from 'typings';\r\n\r\ntype RunEachItem = ((...args: any) => any | any[]) | null | undefined;\r\n\r\n/**\r\n * Iterates through a array or object\r\n * @param arrayLikeOrObject The array or object through which shall be iterated.\r\n * @param callback The function which is responsible for the iteration.\r\n * If the function returns true its treated like a \"continue\" statement.\r\n * If the function returns false its treated like a \"break\" statement.\r\n */\r\nexport function each(\r\n array: Array | ReadonlyArray,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | unknown\r\n): Array | ReadonlyArray;\r\nexport function each(\r\n array: Array | ReadonlyArray | false | null | undefined,\r\n callback: (value: T, indexOrKey: number, source: Array) => boolean | unknown\r\n): Array | ReadonlyArray | false | null | undefined;\r\nexport function each(\r\n arrayLikeObject: ArrayLike,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | unknown\r\n): ArrayLike;\r\nexport function each(\r\n arrayLikeObject: ArrayLike | false | null | undefined,\r\n callback: (value: T, indexOrKey: number, source: ArrayLike) => boolean | unknown\r\n): ArrayLike | false | null | undefined;\r\nexport function each(\r\n obj: PlainObject,\r\n callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | unknown\r\n): PlainObject;\r\nexport function each(\r\n obj: PlainObject | false | null | undefined,\r\n callback: (value: any, indexOrKey: string, source: PlainObject) => boolean | unknown\r\n): PlainObject | false | null | undefined;\r\nexport function each(\r\n source: Array | ArrayLike | ReadonlyArray | PlainObject | false | null | undefined,\r\n callback: (value: T, indexOrKey: any, source: any) => boolean | unknown\r\n): Array | ArrayLike | ReadonlyArray | PlainObject | false | null | undefined {\r\n if (isArrayLike(source)) {\r\n for (let i = 0; i < source.length; i++) {\r\n if (callback(source[i], i, source) === false) {\r\n break;\r\n }\r\n }\r\n } else if (source) {\r\n each(Object.keys(source), (key) => callback(source[key], key, source));\r\n }\r\n return source;\r\n}\r\n\r\n/**\r\n * Returns the index of the given inside the given array or -1 if the given item isn't part of the given array.\r\n * @param arr The array.\r\n * @param item The item.\r\n * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.\r\n */\r\nexport const indexOf = (arr: T[], item: T, fromIndex?: number): number =>\r\n arr.indexOf(item, fromIndex);\r\n\r\n/**\r\n * Pushesh all given items into the given array and returns it.\r\n * @param array The array the items shall be pushed into.\r\n * @param items The items which shall be pushed into the array.\r\n */\r\nexport const push = (array: T[], items: T | ArrayLike, arrayIsSingleItem?: boolean): T[] => {\r\n !arrayIsSingleItem && !isString(items) && isArrayLike(items)\r\n ? Array.prototype.push.apply(array, items as T[])\r\n : array.push(items as T);\r\n return array;\r\n};\r\n\r\n/**\r\n * Creates a shallow-copied Array instance from an array-like or iterable object.\r\n * @param arr The object from which the array instance shall be created.\r\n */\r\nexport const from = (arr?: ArrayLike | Set) => {\r\n const original = Array.from;\r\n const result: T[] = [];\r\n\r\n if (original && arr) {\r\n return original(arr);\r\n }\r\n\r\n if (arr instanceof Set) {\r\n arr.forEach((value) => {\r\n push(result, value);\r\n });\r\n } else {\r\n each(arr, (elm) => {\r\n push(result, elm);\r\n });\r\n }\r\n\r\n return result;\r\n};\r\n\r\n/**\r\n * Check whether the passed array is empty.\r\n * @param array The array which shall be checked.\r\n */\r\nexport const isEmptyArray = (array: any[] | null | undefined): boolean =>\r\n !!array && array.length === 0;\r\n\r\n/**\r\n * Calls all functions in the passed array/set of functions.\r\n * @param arr The array filled with function which shall be called.\r\n * @param args The args with which each function is called.\r\n * @param keep True when the Set / array should not be cleared afterwards, false otherwise.\r\n */\r\nexport const runEachAndClear = (arr: RunEachItem[], args?: any[], keep?: boolean): void => {\r\n // eslint-disable-next-line prefer-spread\r\n const runFn = (fn: RunEachItem) => fn && fn.apply(undefined, args || []);\r\n each(arr, runFn);\r\n !keep && ((arr as any[]).length = 0);\r\n};\r\n","import { each, keys } from 'support/utils';\r\nimport { isString, isNumber, isArray, isUndefined } from 'support/utils/types';\r\nimport { PlainObject, StyleObject } from 'typings';\r\n\r\nexport interface TRBL {\r\n t: number;\r\n r: number;\r\n b: number;\r\n l: number;\r\n}\r\n\r\nconst cssNumber = {\r\n // animationiterationcount: 1,\r\n // columncount: 1,\r\n // fillopacity: 1,\r\n // flexgrow: 1,\r\n // flexshrink: 1,\r\n // fontweight: 1,\r\n // lineheight: 1,\r\n // order: 1,\r\n // orphans: 1,\r\n // widows: 1,\r\n // zoom: 1,\r\n opacity: 1,\r\n zindex: 1,\r\n};\r\n\r\nconst parseToZeroOrNumber = (value: string, toFloat?: boolean): number => {\r\n /* istanbul ignore next */\r\n const num = toFloat ? parseFloat(value) : parseInt(value, 10);\r\n // num === num means num is not NaN\r\n /* istanbul ignore next */\r\n return num === num ? num : 0; // eslint-disable-line no-self-compare\r\n};\r\n\r\nconst adaptCSSVal = (prop: string, val: string | number): string | number =>\r\n !cssNumber[prop.toLowerCase()] && isNumber(val) ? `${val}px` : val;\r\n\r\nconst getCSSVal = (elm: HTMLElement, computedStyle: CSSStyleDeclaration, prop: string): string =>\r\n /* istanbul ignore next */\r\n computedStyle != null\r\n ? computedStyle[prop] || computedStyle.getPropertyValue(prop)\r\n : elm.style[prop];\r\n\r\nconst setCSSVal = (\r\n elm: HTMLElement | false | null | undefined,\r\n prop: string,\r\n val: string | number\r\n): void => {\r\n try {\r\n if (elm) {\r\n const { style: elmStyle } = elm;\r\n if (!isUndefined(elmStyle[prop])) {\r\n elmStyle[prop] = adaptCSSVal(prop, val);\r\n } else {\r\n elmStyle.setProperty(prop, val as string);\r\n }\r\n }\r\n } catch (e) {}\r\n};\r\n\r\n/**\r\n * Gets or sets the passed styles to the passed element.\r\n * @param elm The element to which the styles shall be applied to / be read from.\r\n * @param styles The styles which shall be set or read.\r\n */\r\nexport function style(\r\n elm: HTMLElement | false | null | undefined,\r\n styles: StyleObject\r\n): void;\r\nexport function style(\r\n elm: HTMLElement | false | null | undefined,\r\n styles: string\r\n): string;\r\nexport function style(\r\n elm: HTMLElement | false | null | undefined,\r\n styles: Array | string\r\n): { [key: string]: string };\r\nexport function style(\r\n elm: HTMLElement | false | null | undefined,\r\n styles: StyleObject | Array | string\r\n): { [key: string]: string } | string | void {\r\n const getSingleStyle = isString(styles);\r\n const getStyles = isArray(styles) || getSingleStyle;\r\n\r\n if (getStyles) {\r\n let getStylesResult: string | PlainObject = getSingleStyle ? '' : {};\r\n if (elm) {\r\n const computedStyle: CSSStyleDeclaration = window.getComputedStyle(elm, null);\r\n getStylesResult = getSingleStyle\r\n ? getCSSVal(elm, computedStyle, styles as string)\r\n : (styles as Array).reduce((result, key) => {\r\n result[key] = getCSSVal(elm, computedStyle, key as string);\r\n return result;\r\n }, getStylesResult);\r\n }\r\n return getStylesResult;\r\n }\r\n each(keys(styles), (key) => setCSSVal(elm, key, styles[key]));\r\n}\r\n\r\n/**\r\n * Hides the passed element (display: none).\r\n * @param elm The element which shall be hidden.\r\n */\r\nexport const hide = (elm: HTMLElement | false | null | undefined): void => {\r\n style(elm, { display: 'none' });\r\n};\r\n\r\n/**\r\n * Shows the passed element (display: block).\r\n * @param elm The element which shall be shown.\r\n */\r\nexport const show = (elm: HTMLElement | false | null | undefined): void => {\r\n style(elm, { display: 'block' });\r\n};\r\n\r\n/**\r\n * Returns the top right bottom left values of the passed css property.\r\n * @param elm The element of which the values shall be returned.\r\n * @param propertyPrefix The css property prefix. (e.g. \"border\")\r\n * @param propertySuffix The css property suffix. (e.g. \"width\")\r\n */\r\nexport const topRightBottomLeft = (\r\n elm?: HTMLElement | false | null | undefined,\r\n propertyPrefix?: string,\r\n propertySuffix?: string\r\n): TRBL => {\r\n const finalPrefix = propertyPrefix ? `${propertyPrefix}-` : '';\r\n const finalSuffix = propertySuffix ? `-${propertySuffix}` : '';\r\n const top = `${finalPrefix}top${finalSuffix}`;\r\n const right = `${finalPrefix}right${finalSuffix}`;\r\n const bottom = `${finalPrefix}bottom${finalSuffix}`;\r\n const left = `${finalPrefix}left${finalSuffix}`;\r\n const result = style(elm, [top, right, bottom, left]);\r\n return {\r\n t: parseToZeroOrNumber(result[top]),\r\n r: parseToZeroOrNumber(result[right]),\r\n b: parseToZeroOrNumber(result[bottom]),\r\n l: parseToZeroOrNumber(result[left]),\r\n };\r\n};\r\n","export interface CacheOptions {\r\n // initial value of _value.\r\n _initialValue: Value;\r\n // Custom comparison function if shallow compare isn't enough. Returns true if nothing changed.\r\n _equal?: EqualCachePropFunction;\r\n // If true always updates _value and _previous, otherwise they update only when they changed.\r\n _alwaysUpdateValues?: boolean;\r\n}\r\n\r\nexport type CacheValues = [value: T, changed: boolean, previous?: T];\r\n\r\nexport type EqualCachePropFunction = (currentVal: Value, newVal: Value) => boolean;\r\n\r\nexport type CacheUpdater = (current: Value, previous?: Value) => Value;\r\n\r\nexport type UpdateCacheContextual = (newValue: Value, force?: boolean) => CacheValues;\r\n\r\nexport type UpdateCache = (force?: boolean) => CacheValues;\r\n\r\nexport type GetCurrentCache = (force?: boolean) => CacheValues;\r\n\r\nexport type Cache = [UpdateCache, GetCurrentCache];\r\n\r\nexport type CacheContextual = [UpdateCacheContextual, GetCurrentCache];\r\n\r\ntype CreateCache = {\r\n (options: CacheOptions): CacheContextual;\r\n (options: CacheOptions, update: CacheUpdater): Cache;\r\n (options: CacheOptions, update?: CacheUpdater):\r\n | CacheContextual\r\n | Cache;\r\n};\r\n\r\nexport const createCache: CreateCache = (\r\n options: CacheOptions,\r\n update?: CacheUpdater\r\n): CacheContextual | Cache => {\r\n const { _initialValue, _equal, _alwaysUpdateValues } = options;\r\n let _value: Value = _initialValue;\r\n let _previous: Value | undefined;\r\n\r\n const cacheUpdateContextual: UpdateCacheContextual = (newValue, force?) => {\r\n const curr = _value;\r\n\r\n const newVal = newValue;\r\n const changed = force || (_equal ? !_equal(curr, newVal) : curr !== newVal);\r\n\r\n if (changed || _alwaysUpdateValues) {\r\n _value = newVal;\r\n _previous = curr;\r\n }\r\n\r\n return [_value, changed, _previous];\r\n };\r\n const cacheUpdateIsolated: UpdateCache = (force?) =>\r\n cacheUpdateContextual(update!(_value, _previous), force);\r\n\r\n const getCurrentCache: GetCurrentCache = (force?: boolean) => [\r\n _value,\r\n !!force, // changed\r\n _previous,\r\n ];\r\n\r\n return [update ? cacheUpdateIsolated : cacheUpdateContextual, getCurrentCache] as\r\n | CacheContextual\r\n | Cache;\r\n};\r\n","import { PlainObject } from 'typings';\r\n\r\nconst ElementNodeType = Node.ELEMENT_NODE;\r\nconst { toString, hasOwnProperty } = Object.prototype;\r\n\r\nexport const isUndefined = (obj: any): obj is undefined => obj === undefined;\r\n\r\nexport const isNull = (obj: any): obj is null => obj === null;\r\n\r\nexport const type = (obj: any): string =>\r\n isUndefined(obj) || isNull(obj)\r\n ? `${obj}`\r\n : toString\r\n .call(obj)\r\n .replace(/^\\[object (.+)\\]$/, '$1')\r\n .toLowerCase();\r\n\r\nexport const isNumber = (obj: any): obj is number => typeof obj === 'number';\r\n\r\nexport const isString = (obj: any): obj is string => typeof obj === 'string';\r\n\r\nexport const isBoolean = (obj: any): obj is boolean => typeof obj === 'boolean';\r\n\r\nexport const isFunction = (obj: any): obj is (...args: any[]) => any => typeof obj === 'function';\r\n\r\nexport const isArray = (obj: any): obj is Array => Array.isArray(obj);\r\n\r\nexport const isObject = (obj: any): boolean =>\r\n typeof obj === 'object' && !isArray(obj) && !isNull(obj);\r\n\r\n/**\r\n * Returns true if the given object is array like, false otherwise.\r\n * @param obj The Object\r\n */\r\nexport const isArrayLike = (obj: any): obj is ArrayLike => {\r\n const length = !!obj && obj.length;\r\n const lengthCorrectFormat = isNumber(length) && length > -1 && length % 1 == 0; // eslint-disable-line eqeqeq\r\n\r\n return isArray(obj) || (!isFunction(obj) && lengthCorrectFormat)\r\n ? length > 0 && isObject(obj)\r\n ? length - 1 in obj\r\n : true\r\n : false;\r\n};\r\n\r\n/**\r\n * Returns true if the given object is a \"plain\" (e.g. { key: value }) object, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport const isPlainObject = (obj: any): obj is PlainObject => {\r\n if (!obj || !isObject(obj) || type(obj) !== 'object') return false;\r\n\r\n let key;\r\n const cstr = 'constructor';\r\n const ctor = obj[cstr];\r\n const ctorProto = ctor && ctor.prototype;\r\n const hasOwnConstructor = hasOwnProperty.call(obj, cstr);\r\n const hasIsPrototypeOf = ctorProto && hasOwnProperty.call(ctorProto, 'isPrototypeOf');\r\n\r\n if (ctor && !hasOwnConstructor && !hasIsPrototypeOf) {\r\n return false;\r\n }\r\n\r\n /* eslint-disable no-restricted-syntax */\r\n for (key in obj) {\r\n /**/\r\n }\r\n /* eslint-enable */\r\n\r\n return isUndefined(key) || hasOwnProperty.call(obj, key);\r\n};\r\n\r\n/**\r\n * Checks whether the given object is a HTMLElement.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport const isHTMLElement = (obj: any): obj is HTMLElement => {\r\n const instanceofObj = HTMLElement;\r\n return obj\r\n ? instanceofObj\r\n ? obj instanceof instanceofObj\r\n : obj.nodeType === ElementNodeType\r\n : false;\r\n};\r\n\r\n/**\r\n * Checks whether the given object is a Element.\r\n * @param obj The object which shall be checked.\r\n */\r\nexport const isElement = (obj: any): obj is Element => {\r\n const instanceofObj = Element;\r\n return obj\r\n ? instanceofObj\r\n ? obj instanceof instanceofObj\r\n : obj.nodeType === ElementNodeType\r\n : false;\r\n};\r\n","import { isArray, isFunction, isPlainObject, isNull } from 'support/utils/types';\r\nimport { each } from 'support/utils/array';\r\n\r\n/**\r\n * Determines whether the passed object has a property with the passed name.\r\n * @param obj The object.\r\n * @param prop The name of the property.\r\n */\r\nexport const hasOwnProperty = (obj: any, prop: string | number | symbol): boolean =>\r\n Object.prototype.hasOwnProperty.call(obj, prop);\r\n\r\n/**\r\n * Returns the names of the enumerable string properties and methods of an object.\r\n * @param obj The object of which the properties shall be returned.\r\n */\r\nexport const keys = (obj: any): Array => (obj ? Object.keys(obj) : []);\r\n\r\ntype AssignDeep = {\r\n (target: T, object1: U): T & U;\r\n (target: T, object1: U, object2: V): T & U & V;\r\n (target: T, object1: U, object2: V, object3: W): T & U & V & W;\r\n (target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;\r\n (target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T &\r\n U &\r\n V &\r\n W &\r\n X &\r\n Y;\r\n (\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n ): T & U & V & W & X & Y & Z;\r\n};\r\n\r\n// https://github.com/jquery/jquery/blob/master/src/core.js#L116\r\nexport const assignDeep: AssignDeep = (\r\n target: T,\r\n object1?: U,\r\n object2?: V,\r\n object3?: W,\r\n object4?: X,\r\n object5?: Y,\r\n object6?: Z\r\n): T & U & V & W & X & Y & Z => {\r\n const sources: Array = [object1, object2, object3, object4, object5, object6];\r\n\r\n // Handle case when target is a string or something (possible in deep copy)\r\n if ((typeof target !== 'object' || isNull(target)) && !isFunction(target)) {\r\n target = {} as T;\r\n }\r\n\r\n each(sources, (source) => {\r\n // Extend the base object\r\n each(keys(source), (key) => {\r\n const copy: any = source[key];\r\n\r\n // Prevent Object.prototype pollution\r\n // Prevent never-ending loop\r\n if (target === copy) {\r\n return true;\r\n }\r\n\r\n const copyIsArray = isArray(copy);\r\n\r\n // Recurse if we're merging plain objects or arrays\r\n if (copy && (isPlainObject(copy) || copyIsArray)) {\r\n const src = target[key];\r\n let clone: any = src;\r\n\r\n // Ensure proper type for the source value\r\n if (copyIsArray && !isArray(src)) {\r\n clone = [];\r\n } else if (!copyIsArray && !isPlainObject(src)) {\r\n clone = {};\r\n }\r\n\r\n // Never move original objects, clone them\r\n target[key] = assignDeep(clone, copy) as any;\r\n } else {\r\n target[key] = copy;\r\n }\r\n });\r\n });\r\n\r\n // Return the modified object\r\n return target as any;\r\n};\r\n\r\n/**\r\n * Returns true if the given object is empty, false otherwise.\r\n * @param obj The Object.\r\n */\r\nexport const isEmptyObject = (obj: any): boolean => {\r\n /* eslint-disable no-restricted-syntax, guard-for-in */\r\n for (const name in obj) return false;\r\n return true;\r\n /* eslint-enable */\r\n};\r\n","import { from } from 'support/utils/array';\r\nimport { isNull, isUndefined } from 'support/utils/types';\r\n\r\ntype GetSetPropName = 'scrollLeft' | 'scrollTop' | 'value';\r\n\r\ntype Attr = {\r\n (elm: HTMLElement | false | null | undefined, attrName: string): string | null;\r\n (elm: HTMLElement | false | null | undefined, attrName: string, value: string): void;\r\n (elm: HTMLElement | false | null | undefined, attrName: string, value?: string):\r\n | string\r\n | null\r\n | void;\r\n};\r\n\r\ntype GetSetProp = {\r\n (elm: HTMLElement | false | null | undefined): T;\r\n (elm: HTMLElement | false | null | undefined, value: T | false | null): void;\r\n (elm: HTMLElement | false | null | undefined, value?: T | false | null): T | void;\r\n};\r\n\r\nconst getSetProp = (\r\n topLeft: GetSetPropName,\r\n fallback: number | string,\r\n elm: HTMLElement | HTMLInputElement | false | null | undefined,\r\n value?: number | string | false | null\r\n): number | string | void => {\r\n if (isUndefined(value)) {\r\n return elm ? elm[topLeft] : fallback;\r\n }\r\n elm && !isNull(value) && value !== false && (elm[topLeft] = value);\r\n};\r\n\r\n/**\r\n * Gets or sets a attribute with the given attribute of the given element depending whether the value attribute is given.\r\n * Returns null if the element has no attribute with the given name.\r\n * @param elm The element of which the attribute shall be get or set.\r\n * @param attrName The attribute name which shall be get or set.\r\n * @param value The value of the attribute which shall be set.\r\n */\r\nexport const attr = ((\r\n elm: HTMLElement | false | null | undefined,\r\n attrName: string,\r\n value?: string\r\n): string | null | void => {\r\n if (isUndefined(value)) {\r\n return elm ? elm.getAttribute(attrName) : null;\r\n }\r\n elm && elm.setAttribute(attrName, value);\r\n}) as Attr;\r\n\r\n/**\r\n * Treats the given attribute like the \"class\" attribute and adds or removes the given value from it.\r\n * @param elm The element.\r\n * @param attrName The attributeName to which the value shall be added or removed.\r\n * @param value The value which shall be added or removed.\r\n * @param add True if the value shall be added, false otherwise.\r\n */\r\nexport const attrClass = (\r\n elm: HTMLElement | false | null | undefined,\r\n attrName: string,\r\n value: string,\r\n add?: boolean\r\n) => {\r\n if (value) {\r\n const currValues = attr(elm, attrName) || '';\r\n const currValuesSet = new Set(currValues.split(' '));\r\n currValuesSet[add ? 'add' : 'delete'](value);\r\n\r\n attr(elm, attrName, from(currValuesSet).join(' ').trim());\r\n }\r\n};\r\n\r\n/**\r\n * Treats the given attribute like the \"class\" attribute and checks if the given value is in it.\r\n * @param elm The element.\r\n * @param attrName The attributeName from which the content shall be checked.\r\n * @param value The value.\r\n * @returns True if the given attribute has the value in it, false otherwise.\r\n */\r\nexport const hasAttrClass = (\r\n elm: HTMLElement | false | null | undefined,\r\n attrName: string,\r\n value: string\r\n) => {\r\n const currValues = attr(elm, attrName) || '';\r\n const currValuesSet = new Set(currValues.split(' '));\r\n return currValuesSet.has(value);\r\n};\r\n\r\n/**\r\n * Removes the given attribute from the given element.\r\n * @param elm The element of which the attribute shall be removed.\r\n * @param attrName The attribute name.\r\n */\r\nexport const removeAttr = (elm: Element | false | null | undefined, attrName: string): void => {\r\n elm && elm.removeAttribute(attrName);\r\n};\r\n\r\n/**\r\n * Gets or sets the scrollLeft value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollLeft value shall be get or set.\r\n * @param value The scrollLeft value which shall be set.\r\n */\r\nexport const scrollLeft = ((\r\n elm: HTMLElement | false | null | undefined,\r\n value?: number | false | null\r\n): number | void => getSetProp('scrollLeft', 0, elm, value) as number) as GetSetProp;\r\n\r\n/**\r\n * Gets or sets the scrollTop value of the given element depending whether the value attribute is given.\r\n * @param elm The element of which the scrollTop value shall be get or set.\r\n * @param value The scrollTop value which shall be set.\r\n */\r\nexport const scrollTop = ((\r\n elm: HTMLElement | false | null | undefined,\r\n value?: number | false | null\r\n): number | void => getSetProp('scrollTop', 0, elm, value) as number) as GetSetProp;\r\n\r\n/**\r\n * Gets or sets the value of the given input element depending whether the value attribute is given.\r\n * @param elm The input element of which the value shall be get or set.\r\n * @param value The value which shall be set.\r\n */\r\nexport const val = ((\r\n elm: HTMLInputElement | false | null | undefined,\r\n value?: string\r\n): string | void => getSetProp('value', '', elm, value) as string) as GetSetProp;\r\n","import { isElement } from 'support/utils/types';\r\nimport { push, from } from 'support/utils/array';\r\n\r\ntype InputElementType = Node | Element | Node | false | null | undefined;\r\ntype OutputElementType = Node | Element | null;\r\n\r\nconst elmPrototype = Element.prototype;\r\n\r\n/**\r\n * Find all elements with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nconst find = (selector: string, elm?: InputElementType): Element[] => {\r\n const arr: Array = [];\r\n const rootElm = elm ? (isElement(elm) ? elm : null) : document;\r\n\r\n return rootElm ? push(arr, rootElm.querySelectorAll(selector)) : arr;\r\n};\r\n\r\n/**\r\n * Find the first element with the passed selector, outgoing (and including) the passed element or the document if no element was provided.\r\n * @param selector The selector which has to be searched by.\r\n * @param elm The element from which the search shall be outgoing.\r\n */\r\nconst findFirst = (selector: string, elm?: InputElementType): OutputElementType => {\r\n const rootElm = elm ? (isElement(elm) ? elm : null) : document;\r\n\r\n return rootElm ? rootElm.querySelector(selector) : null;\r\n};\r\n\r\n/**\r\n * Determines whether the passed element is matching with the passed selector.\r\n * @param elm The element which has to be compared with the passed selector.\r\n * @param selector The selector which has to be compared with the passed element. Additional selectors: ':visible' and ':hidden'.\r\n */\r\nconst is = (elm: InputElementType, selector: string): boolean => {\r\n if (isElement(elm)) {\r\n /* istanbul ignore next */\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n const fn: (...args: any) => boolean = elmPrototype.matches || elmPrototype.msMatchesSelector;\r\n return fn.call(elm, selector);\r\n }\r\n return false;\r\n};\r\n\r\n/**\r\n * Returns the children (no text-nodes or comments) of the passed element which are matching the passed selector. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the children shall be returned.\r\n * @param selector The selector which must match with the children elements.\r\n */\r\nconst children = (elm: InputElementType, selector?: string): ReadonlyArray => {\r\n const childs: Array = [];\r\n\r\n return isElement(elm)\r\n ? push(\r\n childs,\r\n from(elm.children).filter((child) => (selector ? is(child, selector) : child))\r\n )\r\n : childs;\r\n};\r\n\r\n/**\r\n * Returns the childNodes (incl. text-nodes or comments etc.) of the passed element. An empty array is returned if the passed element is null.\r\n * @param elm The element of which the childNodes shall be returned.\r\n */\r\nconst contents = (elm: InputElementType): ReadonlyArray =>\r\n elm ? from(elm.childNodes) : [];\r\n\r\n/**\r\n * Returns the parent element of the passed element, or null if the passed element is null.\r\n * @param elm The element of which the parent element shall be returned.\r\n */\r\nconst parent = (elm: InputElementType): OutputElementType => (elm ? elm.parentElement : null);\r\n\r\nconst closest = (elm: InputElementType, selector: string): OutputElementType => {\r\n if (isElement(elm)) {\r\n const closestFn = elmPrototype.closest;\r\n if (closestFn) {\r\n return closestFn.call(elm, selector);\r\n }\r\n\r\n do {\r\n if (is(elm, selector)) {\r\n return elm as Element;\r\n }\r\n elm = parent(elm);\r\n } while (elm);\r\n }\r\n\r\n return null;\r\n};\r\n\r\n/**\r\n * Determines whether the given element lies between two selectors in the DOM.\r\n * @param elm The element.\r\n * @param highBoundarySelector The high boundary selector.\r\n * @param deepBoundarySelector The deep boundary selector.\r\n */\r\nconst liesBetween = (\r\n elm: InputElementType,\r\n highBoundarySelector: string,\r\n deepBoundarySelector: string\r\n): boolean => {\r\n const closestHighBoundaryElm = elm && closest(elm, highBoundarySelector);\r\n const closestDeepBoundaryElm = elm && findFirst(deepBoundarySelector, closestHighBoundaryElm);\r\n\r\n return closestHighBoundaryElm && closestDeepBoundaryElm\r\n ? closestHighBoundaryElm === elm ||\r\n closestDeepBoundaryElm === elm ||\r\n closest(closest(elm, deepBoundarySelector), highBoundarySelector) !== closestHighBoundaryElm\r\n : false;\r\n};\r\n\r\nexport { find, findFirst, is, children, contents, parent, liesBetween, closest };\r\n","import { isArrayLike } from 'support/utils/types';\r\nimport { each, from } from 'support/utils/array';\r\nimport { parent } from 'support/dom/traversal';\r\n\r\ntype NodeCollection = ArrayLike | Node | false | null | undefined;\r\n\r\n/**\r\n * Inserts Nodes before the given preferredAnchor element.\r\n * @param parentElm The parent of the preferredAnchor element or the element which shall be the parent of the inserted Nodes.\r\n * @param preferredAnchor The element before which the Nodes shall be inserted or null if the elements shall be appended at the end.\r\n * @param insertedElms The Nodes which shall be inserted.\r\n */\r\nconst before = (\r\n parentElm: Node | false | null | undefined,\r\n preferredAnchor: Node | false | null | undefined,\r\n insertedElms: NodeCollection\r\n): void => {\r\n if (insertedElms) {\r\n let anchor: Node | false | null | undefined = preferredAnchor;\r\n let fragment: DocumentFragment | Node | null | undefined;\r\n\r\n // parent must be defined\r\n if (parentElm) {\r\n if (isArrayLike(insertedElms)) {\r\n fragment = document.createDocumentFragment();\r\n\r\n // append all insertedElms to the fragment and if one of these is the anchor, change the anchor\r\n each(insertedElms, (insertedElm) => {\r\n if (insertedElm === anchor) {\r\n anchor = insertedElm.previousSibling;\r\n }\r\n fragment!.appendChild(insertedElm);\r\n });\r\n } else {\r\n fragment = insertedElms;\r\n }\r\n\r\n // if the preferred anchor isn't null set it to a valid anchor\r\n if (preferredAnchor) {\r\n if (!anchor) {\r\n anchor = parentElm.firstChild;\r\n } else if (anchor !== preferredAnchor) {\r\n anchor = anchor.nextSibling;\r\n }\r\n }\r\n\r\n parentElm.insertBefore(fragment, anchor || null);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Appends the given children at the end of the given Node.\r\n * @param node The Node to which the children shall be appended.\r\n * @param children The Nodes which shall be appended.\r\n */\r\nexport const appendChildren = (\r\n node: Node | false | null | undefined,\r\n children: NodeCollection\r\n): void => {\r\n before(node, null, children);\r\n};\r\n\r\n/**\r\n * Prepends the given children at the start of the given Node.\r\n * @param node The Node to which the children shall be prepended.\r\n * @param children The Nodes which shall be prepended.\r\n */\r\nexport const prependChildren = (\r\n node: Node | false | null | undefined,\r\n children: NodeCollection\r\n): void => {\r\n before(node, node && node.firstChild, children);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes before the given Node.\r\n * @param node The Node before which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertBefore = (\r\n node: Node | false | null | undefined,\r\n insertedNodes: NodeCollection\r\n): void => {\r\n before(parent(node), node, insertedNodes);\r\n};\r\n\r\n/**\r\n * Inserts the given Nodes after the given Node.\r\n * @param node The Node after which the given Nodes shall be inserted.\r\n * @param insertedNodes The Nodes which shall be inserted.\r\n */\r\nexport const insertAfter = (\r\n node: Node | false | null | undefined,\r\n insertedNodes: NodeCollection\r\n): void => {\r\n before(parent(node), node && node.nextSibling, insertedNodes);\r\n};\r\n\r\n/**\r\n * Removes the given Nodes from their parent.\r\n * @param nodes The Nodes which shall be removed.\r\n */\r\nexport const removeElements = (nodes: NodeCollection): void => {\r\n if (isArrayLike(nodes)) {\r\n each(from(nodes), (e) => removeElements(e));\r\n } else if (nodes) {\r\n const parentElm = parent(nodes);\r\n if (parentElm) {\r\n parentElm.removeChild(nodes);\r\n }\r\n }\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { attr } from 'support/dom/attribute';\r\nimport { contents } from 'support/dom/traversal';\r\nimport { removeElements } from 'support/dom/manipulation';\r\n\r\n/**\r\n * Creates a div DOM node.\r\n */\r\nexport const createDiv = (classNames?: string): HTMLDivElement => {\r\n const div = document.createElement('div');\r\n if (classNames) {\r\n attr(div, 'class', classNames);\r\n }\r\n return div;\r\n};\r\n\r\n/**\r\n * Creates DOM nodes modeled after the passed html string and returns the root dom nodes as a array.\r\n * @param html The html string after which the DOM nodes shall be created.\r\n */\r\nexport const createDOM = (html: string): ReadonlyArray => {\r\n const createdDiv = createDiv();\r\n createdDiv.innerHTML = html.trim();\r\n\r\n return each(contents(createdDiv), (elm) => removeElements(elm));\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { hasOwnProperty } from 'support/utils/object';\r\nimport { createDiv } from 'support/dom/create';\r\n\r\nconst firstLetterToUpper = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1);\r\nconst getDummyStyle = (): CSSStyleDeclaration => createDiv().style;\r\n\r\n// https://developer.mozilla.org/en-US/docs/Glossary/Vendor_Prefix\r\n\r\nexport const cssPrefixes: ReadonlyArray = ['-webkit-', '-moz-', '-o-', '-ms-'];\r\nexport const jsPrefixes: ReadonlyArray = [\r\n 'WebKit',\r\n 'Moz',\r\n 'O',\r\n 'MS',\r\n 'webkit',\r\n 'moz',\r\n 'o',\r\n 'ms',\r\n];\r\n\r\nexport const jsCache: { [key: string]: any } = {};\r\nexport const cssCache: { [key: string]: string } = {};\r\n\r\n/**\r\n * Gets the name of the given CSS property with vendor prefix if it isn't supported without it, or and empty string if unsupported.\r\n * @param name The name of the CSS property which shall be get.\r\n */\r\nexport const cssProperty = (name: string): string => {\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const uppercasedName: string = firstLetterToUpper(name);\r\n const elmStyle: CSSStyleDeclaration = getDummyStyle();\r\n\r\n each(cssPrefixes, (prefix: string) => {\r\n const prefixWithoutDashes: string = prefix.replace(/-/g, '');\r\n const resultPossibilities: Array = [\r\n name, // transition\r\n prefix + name, // -webkit-transition\r\n prefixWithoutDashes + uppercasedName, // webkitTransition\r\n firstLetterToUpper(prefixWithoutDashes) + uppercasedName, // WebkitTransition\r\n ];\r\n\r\n // eslint-disable-next-line no-return-assign\r\n return !(result = resultPossibilities.find(\r\n (resultPossibility: string) => elmStyle[resultPossibility] !== undefined\r\n ));\r\n });\r\n\r\n // eslint-disable-next-line no-return-assign\r\n return (cssCache[name] = result || '');\r\n};\r\n\r\n/**\r\n * Get the name of the given CSS property value(s), with vendor prefix if it isn't supported without it, or an empty string if no value is supported.\r\n * @param property The CSS property to which the CSS property value(s) belong.\r\n * @param values The value(s) separated by spaces which shall be get.\r\n * @param suffix A suffix which is added to each value in case the value is a function or something else more advanced.\r\n */\r\nexport const cssPropertyValue = (property: string, values: string, suffix?: string): string => {\r\n const name = `${property} ${values}`;\r\n let result: string | undefined = cssCache[name];\r\n\r\n if (hasOwnProperty(cssCache, name)) {\r\n return result;\r\n }\r\n\r\n const dummyStyle: CSSStyleDeclaration = getDummyStyle();\r\n const possbleValues: Array = values.split(' ');\r\n const preparedSuffix: string = suffix || '';\r\n const cssPrefixesWithFirstEmpty = [''].concat(cssPrefixes);\r\n\r\n each(possbleValues, (possibleValue: string) => {\r\n each(cssPrefixesWithFirstEmpty, (prefix: string) => {\r\n const prop = prefix + possibleValue;\r\n dummyStyle.cssText = `${property}:${prop}${preparedSuffix}`;\r\n if (dummyStyle.length) {\r\n result = prop;\r\n return false;\r\n }\r\n });\r\n return !result;\r\n });\r\n\r\n // eslint-disable-next-line no-return-assign\r\n return (cssCache[name] = result || '');\r\n};\r\n\r\n/**\r\n * Get the requested JS function, object or constructor with vendor prefix if it isn't supported without or undefined if unsupported.\r\n * @param name The name of the JS function, object or constructor.\r\n */\r\nexport const jsAPI = (name: string): T | undefined => {\r\n let result: any = jsCache[name] || window[name];\r\n\r\n if (hasOwnProperty(jsCache, name)) {\r\n return result;\r\n }\r\n\r\n each(jsPrefixes, (prefix: string) => {\r\n result = result || window[prefix + firstLetterToUpper(name)];\r\n return !result;\r\n });\r\n\r\n jsCache[name] = result;\r\n return result;\r\n};\r\n","import { jsAPI } from 'support/compatibility/vendors';\r\n\r\nexport const MutationObserverConstructor = jsAPI('MutationObserver');\r\nexport const IntersectionObserverConstructor =\r\n jsAPI('IntersectionObserver');\r\nexport const ResizeObserverConstructor = jsAPI('ResizeObserver');\r\nexport const cAF = jsAPI('cancelAnimationFrame');\r\nexport const rAF = jsAPI('requestAnimationFrame');\r\nexport const setT = window.setTimeout as (handler: TimerHandler, timeout?: number) => number;\r\nexport const clearT = window.clearTimeout as (id?: number) => void;\r\n","import { isString } from 'support/utils/types';\r\nimport { each } from 'support/utils/array';\r\nimport { keys } from 'support/utils/object';\r\n\r\ntype ClassContainingElement = Node | Element | false | null | undefined;\r\ntype ClassName = string | false | null | undefined;\r\n\r\nconst rnothtmlwhite = /[^\\x20\\t\\r\\n\\f]+/g;\r\nconst classListAction = (\r\n elm: ClassContainingElement,\r\n className: ClassName,\r\n action: (elmClassList: DOMTokenList, clazz: string) => boolean | void\r\n): boolean => {\r\n const classList = elm && (elm as Element).classList;\r\n let clazz: string;\r\n let i = 0;\r\n let result = false;\r\n\r\n if (classList && className && isString(className)) {\r\n const classes: Array = className.match(rnothtmlwhite) || [];\r\n result = classes.length > 0;\r\n while ((clazz = classes[i++])) {\r\n result = !!action(classList, clazz) && result;\r\n }\r\n }\r\n return result;\r\n};\r\n\r\n/**\r\n * Check whether the given element has the given class name(s).\r\n * @param elm The element.\r\n * @param className The class name(s).\r\n */\r\nexport const hasClass = (elm: ClassContainingElement, className: ClassName): boolean =>\r\n classListAction(elm, className, (classList, clazz) => classList.contains(clazz));\r\n\r\n/**\r\n * Removes the given class name(s) from the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be removed. (separated by spaces)\r\n */\r\nexport const removeClass = (elm: ClassContainingElement, className: ClassName): void => {\r\n classListAction(elm, className, (classList, clazz) => classList.remove(clazz));\r\n};\r\n\r\n/**\r\n * Adds the given class name(s) to the given element.\r\n * @param elm The element.\r\n * @param className The class name(s) which shall be added. (separated by spaces)\r\n * @returns A function which removes the added class name(s).\r\n */\r\nexport const addClass = (elm: ClassContainingElement, className: ClassName): (() => void) => {\r\n classListAction(elm, className, (classList, clazz) => classList.add(clazz));\r\n return removeClass.bind(0, elm, className);\r\n};\r\n\r\n/**\r\n * Takes two className strings, compares them and returns the difference as array.\r\n * @param classNameA ClassName A.\r\n * @param classNameB ClassName B.\r\n */\r\nexport const diffClass = (classNameA: ClassName, classNameB: ClassName) => {\r\n const classNameASplit = classNameA && classNameA.split(' ');\r\n const classNameBSplit = classNameB && classNameB.split(' ');\r\n const tempObj = {};\r\n\r\n each(classNameASplit, (className) => {\r\n tempObj[className] = 1;\r\n });\r\n each(classNameBSplit, (className) => {\r\n if (tempObj[className]) {\r\n delete tempObj[className];\r\n } else {\r\n tempObj[className] = 1;\r\n }\r\n });\r\n\r\n return keys(tempObj);\r\n};\r\n","import { each } from 'support/utils/array';\r\nimport { WH, XY, TRBL } from 'support/dom';\r\nimport { PlainObject } from 'typings';\r\n\r\n/**\r\n * Compares two objects and returns true if all values of the passed prop names are identical, false otherwise or if one of the two object is falsy.\r\n * @param a Object a.\r\n * @param b Object b.\r\n * @param props The props which shall be compared.\r\n */\r\nexport const equal = (\r\n a: T | undefined,\r\n b: T | undefined,\r\n props: Array,\r\n propMutation?: ((value: any) => any) | null | false\r\n): boolean => {\r\n if (a && b) {\r\n let result = true;\r\n each(props, (prop) => {\r\n const compareA = propMutation ? propMutation(a[prop]) : a[prop];\r\n const compareB = propMutation ? propMutation(b[prop]) : b[prop];\r\n if (compareA !== compareB) {\r\n result = false;\r\n }\r\n });\r\n return result;\r\n }\r\n return false;\r\n};\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalWH = (a?: WH, b?: WH) => equal>(a, b, ['w', 'h']);\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalXY = (a?: XY, b?: XY) => equal>(a, b, ['x', 'y']);\r\n\r\n/**\r\n * Compares object a with object b and returns true if both have the same property values, false otherwise.\r\n * Also returns false if one of the objects is undefined or null.\r\n * @param a Object a.\r\n * @param b Object b.\r\n */\r\nexport const equalTRBL = (a?: TRBL, b?: TRBL) => equal(a, b, ['t', 'r', 'b', 'l']);\r\n\r\n/**\r\n * Compares two DOM Rects for their equality of their width and height properties\r\n * Also returns false if one of the DOM Rects is undefined or null.\r\n * @param a DOM Rect a.\r\n * @param b DOM Rect b.\r\n * @param round Whether the values should be rounded.\r\n */\r\nexport const equalBCRWH = (a?: DOMRect, b?: DOMRect, round?: boolean) =>\r\n equal(a, b, ['width', 'height'], round && ((value) => Math.round(value)));\r\n","import { isNumber, isFunction } from 'support/utils/types';\r\nimport { from } from 'support/utils/array';\r\nimport { rAF, cAF, setT, clearT } from 'support/compatibility/apis';\r\n\r\ntype DebounceTiming = number | false | null | undefined;\r\n\r\nexport interface DebounceOptions any> {\r\n /**\r\n * The timeout for debouncing. If null, no debounce is applied.\r\n */\r\n _timeout?: DebounceTiming | (() => DebounceTiming);\r\n /**\r\n * A maximum amount of ms. before the function will be called even with debounce.\r\n */\r\n _maxDelay?: DebounceTiming | (() => DebounceTiming);\r\n /**\r\n * Function which merges parameters for each canceled debounce.\r\n * If parameters can't be merged the function will return null, otherwise it returns the merged parameters.\r\n */\r\n _mergeParams?: (\r\n prev: Parameters,\r\n curr: Parameters\r\n ) => Parameters | false | null | undefined;\r\n}\r\n\r\nexport interface Debounced any> {\r\n (...args: Parameters): ReturnType;\r\n _flush(): void;\r\n}\r\n\r\nexport const noop = () => {}; // eslint-disable-line\r\n\r\n/**\r\n * Debounces the given function either with a timeout or a animation frame.\r\n * @param functionToDebounce The function which shall be debounced.\r\n * @param options Options for debouncing.\r\n */\r\nexport const debounce = any>(\r\n functionToDebounce: FunctionToDebounce,\r\n options?: DebounceOptions\r\n): Debounced => {\r\n let maxTimeoutId: number | undefined;\r\n let prevArguments: Parameters | null | undefined;\r\n let latestArguments: Parameters | null | undefined;\r\n let clear: () => void = noop;\r\n const { _timeout, _maxDelay, _mergeParams } = options || {};\r\n\r\n const invokeFunctionToDebounce = function (args: IArguments) {\r\n clear();\r\n clearT(maxTimeoutId);\r\n maxTimeoutId = prevArguments = undefined;\r\n clear = noop;\r\n // eslint-disable-next-line\r\n // @ts-ignore\r\n functionToDebounce.apply(this, args);\r\n };\r\n\r\n const mergeParms = (\r\n curr: Parameters\r\n ): Parameters | false | null | undefined =>\r\n _mergeParams && prevArguments ? _mergeParams(prevArguments, curr) : curr;\r\n\r\n const flush = () => {\r\n /* istanbul ignore next */\r\n if (clear !== noop) {\r\n invokeFunctionToDebounce(mergeParms(latestArguments!) || latestArguments!);\r\n }\r\n };\r\n\r\n const debouncedFn = function () {\r\n // eslint-disable-next-line prefer-rest-params\r\n const args: Parameters = from(arguments) as Parameters;\r\n const finalTimeout = isFunction(_timeout) ? _timeout() : _timeout;\r\n const hasTimeout = isNumber(finalTimeout) && finalTimeout >= 0;\r\n\r\n if (hasTimeout) {\r\n const finalMaxWait = isFunction(_maxDelay) ? _maxDelay() : _maxDelay;\r\n const hasMaxWait = isNumber(finalMaxWait) && finalMaxWait >= 0;\r\n const setTimeoutFn = finalTimeout > 0 ? setT : rAF!;\r\n const clearTimeoutFn = finalTimeout > 0 ? clearT : cAF!;\r\n const mergeParamsResult = mergeParms(args);\r\n const invokedArgs = mergeParamsResult || args;\r\n const boundInvoke = invokeFunctionToDebounce.bind(0, invokedArgs);\r\n\r\n // if (!mergeParamsResult) {\r\n // invokeFunctionToDebounce(prevArguments || args);\r\n // }\r\n\r\n clear();\r\n // @ts-ignore\r\n const timeoutId = setTimeoutFn(boundInvoke, finalTimeout);\r\n clear = () => clearTimeoutFn(timeoutId);\r\n\r\n if (hasMaxWait && !maxTimeoutId) {\r\n maxTimeoutId = setT(flush, finalMaxWait as number);\r\n }\r\n\r\n prevArguments = latestArguments = invokedArgs;\r\n } else {\r\n invokeFunctionToDebounce(args);\r\n }\r\n };\r\n debouncedFn._flush = flush;\r\n\r\n return debouncedFn as Debounced;\r\n};\r\n","import { style } from 'support/dom/style';\r\n\r\nexport interface WH {\r\n w: T;\r\n h: T;\r\n}\r\n\r\nconst elementHasDimensions = (elm: HTMLElement): boolean =>\r\n !!(elm.offsetWidth || elm.offsetHeight || elm.getClientRects().length);\r\nconst zeroObj: WH = {\r\n w: 0,\r\n h: 0,\r\n};\r\n\r\n/**\r\n * Returns the window inner- width and height.\r\n */\r\nexport const windowSize = (): WH => ({\r\n w: window.innerWidth,\r\n h: window.innerHeight,\r\n});\r\n\r\n/**\r\n * Returns the scroll- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the scroll- width and height shall be returned.\r\n */\r\nexport const offsetSize = (elm: HTMLElement | null | undefined): WH =>\r\n elm\r\n ? {\r\n w: elm.offsetWidth,\r\n h: elm.offsetHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const clientSize = (elm: HTMLElement | false | null | undefined): WH =>\r\n elm\r\n ? {\r\n w: elm.clientWidth,\r\n h: elm.clientHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the client- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the client- width and height shall be returned.\r\n */\r\nexport const scrollSize = (elm: HTMLElement | false | null | undefined): WH =>\r\n elm\r\n ? {\r\n w: elm.scrollWidth,\r\n h: elm.scrollHeight,\r\n }\r\n : zeroObj;\r\n\r\n/**\r\n * Returns the fractional- width and height of the passed element. If the element is null the width and height values are 0.\r\n * @param elm The element of which the fractional- width and height shall be returned.\r\n */\r\nexport const fractionalSize = (elm: HTMLElement | false | null | undefined): WH => {\r\n const cssHeight = parseFloat(style(elm, 'height')) || 0;\r\n const cssWidth = parseFloat(style(elm, 'height')) || 0;\r\n return {\r\n w: cssWidth - Math.round(cssWidth),\r\n h: cssHeight - Math.round(cssHeight),\r\n };\r\n};\r\n\r\n/**\r\n * Returns the BoundingClientRect of the passed element.\r\n * @param elm The element of which the BoundingClientRect shall be returned.\r\n */\r\nexport const getBoundingClientRect = (elm: HTMLElement): DOMRect => elm.getBoundingClientRect();\r\n\r\n/**\r\n * Determines whether the passed element has any dimensions.\r\n * @param elm The element.\r\n */\r\nexport const hasDimensions = (elm: HTMLElement | false | null | undefined): boolean =>\r\n elm ? elementHasDimensions(elm as HTMLElement) : false;\r\n","import { isUndefined } from 'support/utils/types';\r\nimport { each, push, runEachAndClear } from 'support/utils/array';\r\n\r\nlet passiveEventsSupport: boolean;\r\nconst supportPassiveEvents = (): boolean => {\r\n if (isUndefined(passiveEventsSupport)) {\r\n passiveEventsSupport = false;\r\n try {\r\n /* eslint-disable */\r\n // @ts-ignore\r\n window.addEventListener(\r\n 'test',\r\n null,\r\n Object.defineProperty({}, 'passive', {\r\n get() {\r\n passiveEventsSupport = true;\r\n },\r\n })\r\n );\r\n /* eslint-enable */\r\n } catch (e) {}\r\n }\r\n return passiveEventsSupport;\r\n};\r\nconst splitEventNames = (eventNames: string) => eventNames.split(' ');\r\n\r\nexport interface OnOptions {\r\n _capture?: boolean;\r\n _passive?: boolean;\r\n _once?: boolean;\r\n}\r\n\r\n/**\r\n * Removes the passed event listener for the passed events with the passed options.\r\n * @param target The element from which the listener shall be removed.\r\n * @param eventNames The eventsnames for which the listener shall be removed.\r\n * @param listener The listener which shall be removed.\r\n * @param capture The options of the removed listener.\r\n */\r\nexport const off = (\r\n target: EventTarget,\r\n eventNames: string,\r\n listener: (event: T) => any,\r\n capture?: boolean\r\n): void => {\r\n each(splitEventNames(eventNames), (eventName) => {\r\n target.removeEventListener(eventName, listener as EventListener, capture);\r\n });\r\n};\r\n\r\n/**\r\n * Adds the passed event listener for the passed eventnames with the passed options.\r\n * @param target The element to which the listener shall be added.\r\n * @param eventNames The eventsnames for which the listener shall be called.\r\n * @param listener The listener which is called on the eventnames.\r\n * @param options The options of the added listener.\r\n */\r\nexport const on = (\r\n target: EventTarget,\r\n eventNames: string,\r\n listener: (event: T) => any,\r\n options?: OnOptions\r\n): (() => void) => {\r\n const doSupportPassiveEvents = supportPassiveEvents();\r\n const passive = (doSupportPassiveEvents && options && options._passive) ?? doSupportPassiveEvents;\r\n const capture = (options && options._capture) || false;\r\n const once = (options && options._once) || false;\r\n const offListeners: (() => void)[] = [];\r\n const nativeOptions: AddEventListenerOptions | boolean = doSupportPassiveEvents\r\n ? {\r\n passive,\r\n capture,\r\n }\r\n : capture;\r\n\r\n each(splitEventNames(eventNames), (eventName) => {\r\n const finalListener = (\r\n once\r\n ? (evt: T) => {\r\n target.removeEventListener(eventName, finalListener, capture);\r\n listener && listener(evt);\r\n }\r\n : listener\r\n ) as EventListener;\r\n\r\n push(offListeners, off.bind(null, target, eventName, finalListener, capture));\r\n target.addEventListener(eventName, finalListener, nativeOptions);\r\n });\r\n\r\n return runEachAndClear.bind(0, offListeners);\r\n};\r\n\r\n/**\r\n * Shorthand for the stopPropagation event Method.\r\n * @param evt The event of which the stopPropagation method shall be called.\r\n */\r\nexport const stopPropagation = (evt: Event): void => evt.stopPropagation();\r\n\r\n/**\r\n * Shorthand for the preventDefault event Method.\r\n * @param evt The event of which the preventDefault method shall be called.\r\n */\r\nexport const preventDefault = (evt: Event): void => evt.preventDefault();\r\n\r\n/**\r\n * Shorthand for the stopPropagation and preventDefault event Method.\r\n * @param evt The event of which the stopPropagation and preventDefault methods shall be called.\r\n */\r\nexport const stopAndPrevent = (evt: Event): void =>\r\n (stopPropagation(evt) as undefined) || (preventDefault(evt) as undefined);\r\n","import { getBoundingClientRect } from 'support/dom/dimensions';\r\n\r\nexport interface XY {\r\n x: T;\r\n y: T;\r\n}\r\n\r\nconst zeroObj: XY = {\r\n x: 0,\r\n y: 0,\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element relative to the document. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const absoluteCoordinates = (elm: HTMLElement | null | undefined): XY => {\r\n const rect = elm ? getBoundingClientRect(elm) : 0;\r\n return rect\r\n ? {\r\n x: rect.left + window.pageYOffset,\r\n y: rect.top + window.pageXOffset,\r\n }\r\n : zeroObj;\r\n};\r\n\r\n/**\r\n * Returns the offset- left and top coordinates of the passed element. If the element is null the top and left values are 0.\r\n * @param elm The element of which the offset- top and left coordinates shall be returned.\r\n */\r\nexport const offsetCoordinates = (elm: HTMLElement | null | undefined): XY =>\r\n elm\r\n ? {\r\n x: elm.offsetLeft,\r\n y: elm.offsetTop,\r\n }\r\n : zeroObj;\r\n","import { isArray } from 'support/utils/types';\r\nimport { keys } from 'support/utils/object';\r\nimport { each, from, isEmptyArray } from 'support/utils/array';\r\n\r\nexport type EventListener<\r\n EventMap extends Record,\r\n Name extends keyof EventMap = keyof EventMap\r\n> = (...args: EventMap[Name]) => void;\r\n\r\nexport type InitialEventListeners> = {\r\n [K in keyof EventMap]?: EventListener | EventListener[];\r\n};\r\n\r\nconst manageListener = >(\r\n callback: (listener?: EventListener) => void,\r\n listener?: EventListener | EventListener[]\r\n) => {\r\n each(isArray(listener) ? listener : [listener], callback);\r\n};\r\n\r\nexport const createEventListenerHub = >(\r\n initialEventListeners?: InitialEventListeners\r\n) => {\r\n type EventListener = (\r\n ...args: EventMap[Name]\r\n ) => void;\r\n type RemoveEvent = {\r\n (name?: Name, listener?: EventListener): void;\r\n (name?: Name, listener?: EventListener[]): void;\r\n (\r\n name?: Name,\r\n listener?: EventListener | EventListener[]\r\n ): void;\r\n };\r\n type AddEvent = {\r\n (name: Name, listener: EventListener): () => void;\r\n (name: Name, listener: EventListener[]): () => void;\r\n (\r\n name: Name,\r\n listener: EventListener | EventListener[]\r\n ): () => void;\r\n };\r\n type TriggerEvent = {\r\n (name: Name, args?: EventMap[Name]): void;\r\n };\r\n\r\n const events = new Map>();\r\n\r\n const removeEvent: RemoveEvent = (\r\n name?: Name,\r\n listener?: EventListener | EventListener[]\r\n ): void => {\r\n if (name) {\r\n const eventSet = events.get(name);\r\n manageListener((currListener) => {\r\n if (eventSet) {\r\n eventSet[currListener ? 'delete' : 'clear'](currListener!);\r\n }\r\n }, listener as any);\r\n } else {\r\n events.forEach((eventSet) => {\r\n eventSet.clear();\r\n });\r\n events.clear();\r\n }\r\n };\r\n\r\n const addEvent: AddEvent = (\r\n name: Name,\r\n listener: EventListener | EventListener[]\r\n ): (() => void) => {\r\n const eventSet = events.get(name) || new Set();\r\n events.set(name, eventSet);\r\n\r\n manageListener((currListener) => {\r\n currListener && eventSet.add(currListener);\r\n }, listener as any);\r\n\r\n return removeEvent.bind(0, name as any, listener as any);\r\n };\r\n\r\n const triggerEvent: TriggerEvent = (\r\n name: Name,\r\n args?: EventMap[Name]\r\n ): void => {\r\n const eventSet = events.get(name);\r\n\r\n each(from(eventSet), (event) => {\r\n if (args && !isEmptyArray(args)) {\r\n (event as (...args: EventMap[keyof EventMap]) => void).apply(0, args as any);\r\n } else {\r\n (event as () => void)();\r\n }\r\n });\r\n };\r\n\r\n const initialListenerKeys = keys(initialEventListeners) as Extract[];\r\n each(initialListenerKeys, (key) => {\r\n addEvent(key, initialEventListeners![key] as any);\r\n });\r\n\r\n return [addEvent, removeEvent, triggerEvent] as [AddEvent, RemoveEvent, TriggerEvent];\r\n};\r\n","import { assignDeep, hasOwnProperty } from 'support';\r\nimport type { Options, ReadonlyOSOptions } from 'options';\r\nimport type { DeepPartial } from 'typings';\r\n\r\nexport type SetupElements> = [elements: T, destroy: () => void];\r\n\r\nexport type SetupUpdate = (\r\n changedOptions: DeepPartial,\r\n force: boolean,\r\n ...args: T\r\n) => void;\r\n\r\nexport type SetupUpdateCheckOption = (path: string) => [value: T, changed: boolean];\r\n\r\nexport type SetupUpdateSegment> = (\r\n updateHints: Hints,\r\n checkOption: SetupUpdateCheckOption,\r\n force: boolean\r\n) => Partial | void;\r\n\r\nexport type SetupState> = [\r\n get: () => T,\r\n set: (newState: Partial) => void\r\n];\r\n\r\nexport type Setup<\r\n DynamicState,\r\n StaticState extends Record = Record,\r\n A extends any[] = []\r\n> = [update: SetupUpdate, state: (() => DynamicState) & StaticState, destroy: () => void];\r\n\r\nconst getPropByPath = (obj: any, path: string): T =>\r\n obj\r\n ? path.split('.').reduce((o, prop) => (o && hasOwnProperty(o, prop) ? o[prop] : undefined), obj)\r\n : undefined;\r\n\r\nexport const createOptionCheck =\r\n (\r\n options: ReadonlyOSOptions,\r\n changedOptions: DeepPartial,\r\n force?: boolean\r\n ): SetupUpdateCheckOption =>\r\n (path: string) =>\r\n [getPropByPath(options, path), force || getPropByPath(changedOptions, path) !== undefined];\r\n\r\nexport const createState = (initialState: S): SetupState => {\r\n let state: S = initialState;\r\n return [\r\n () => state,\r\n (newState: Partial) => {\r\n state = assignDeep({}, state, newState);\r\n },\r\n ];\r\n};\r\n","export const classNameEnvironment = 'os-environment';\r\nexport const classNameEnvironmentFlexboxGlue = `${classNameEnvironment}-flexbox-glue`;\r\nexport const classNameEnvironmentFlexboxGlueMax = `${classNameEnvironmentFlexboxGlue}-max`;\r\n\r\nexport const dataAttributeHost = 'data-overlayscrollbars';\r\nexport const dataAttributeHostOverflowX = `${dataAttributeHost}-overflow-x`;\r\nexport const dataAttributeHostOverflowY = `${dataAttributeHost}-overflow-y`;\r\nexport const dataValueHostOverflowVisible = 'overflowVisible';\r\nexport const dataValueHostScrollbarHidden = 'scrollbarHidden';\r\nexport const classNamePadding = 'os-padding';\r\nexport const classNameViewport = 'os-viewport';\r\nexport const classNameViewportArrange = `${classNameViewport}-arrange`;\r\nexport const classNameContent = 'os-content';\r\nexport const classNameViewportScrollbarHidden = `${classNameViewport}-scrollbar-hidden`;\r\nexport const classNameOverflowVisible = `os-overflow-visible`;\r\n\r\nexport const classNameSizeObserver = 'os-size-observer';\r\nexport const classNameSizeObserverAppear = `${classNameSizeObserver}-appear`;\r\nexport const classNameSizeObserverListener = `${classNameSizeObserver}-listener`;\r\nexport const classNameSizeObserverListenerScroll = `${classNameSizeObserverListener}-scroll`;\r\nexport const classNameSizeObserverListenerItem = `${classNameSizeObserverListener}-item`;\r\nexport const classNameSizeObserverListenerItemFinal = `${classNameSizeObserverListenerItem}-final`;\r\n\r\nexport const classNameTrinsicObserver = 'os-trinsic-observer';\r\n\r\nexport const classNameScrollbar = 'os-scrollbar';\r\nexport const classNameScrollbarHorizontal = `${classNameScrollbar}-horizontal`;\r\nexport const classNameScrollbarVertical = `${classNameScrollbar}-vertical`;\r\nexport const classNameScrollbarTrack = 'os-scrollbar-track';\r\nexport const classNameScrollbarHandle = 'os-scrollbar-handle';\r\nexport const classNamesScrollbarVisible = `${classNameScrollbar}-visible`;\r\nexport const classNamesScrollbarCornerless = `${classNameScrollbar}-cornerless`;\r\nexport const classNamesScrollbarTransitionless = `${classNameScrollbar}-transitionless`;\r\nexport const classNamesScrollbarInteraction = `${classNameScrollbar}-interaction`;\r\nexport const classNamesScrollbarAutoHidden = `${classNameScrollbar}-auto-hidden`;\r\n","import { assignDeep, each, isObject, keys, isArray, hasOwnProperty, isFunction } from 'support';\r\nimport { DeepPartial, ReadonlyOptions } from 'typings';\r\n\r\nconst opsStringify = (value: any) =>\r\n JSON.stringify(value, (_, val) => {\r\n if (isFunction(val)) {\r\n throw new Error();\r\n }\r\n return val;\r\n });\r\n\r\nexport type ResizeBehavior = 'none' | 'both' | 'horizontal' | 'vertical';\r\n\r\nexport type OverflowBehavior =\r\n | 'hidden'\r\n | 'scroll'\r\n | 'visible'\r\n | 'visible-hidden'\r\n | 'visible-scroll';\r\n\r\nexport type ScrollbarVisibilityBehavior = 'visible' | 'hidden' | 'auto';\r\n\r\nexport type ScrollbarAutoHideBehavior = 'never' | 'scroll' | 'leave' | 'move';\r\n\r\nexport type ScrollBehavior = 'always' | 'ifneeded' | 'never';\r\n\r\nexport type BasicEventCallback = (this: any) => void;\r\n\r\nexport type ScrollEventCallback = (this: any, args?: UIEvent) => void;\r\n\r\nexport type OverflowChangedCallback = (this: any, args?: OverflowChangedArgs) => void;\r\n\r\nexport type OverflowAmountChangedCallback = (this: any, args?: OverflowAmountChangedArgs) => void;\r\n\r\nexport type DirectionChangedCallback = (this: any, args?: DirectionChangedArgs) => void;\r\n\r\nexport type SizeChangedCallback = (this: any, args?: SizeChangedArgs) => void;\r\n\r\nexport type UpdatedCallback = (this: any, args?: UpdatedArgs) => void;\r\n\r\nexport interface Options {\r\n paddingAbsolute: boolean;\r\n showNativeOverlaidScrollbars: boolean;\r\n updating: {\r\n elementEvents: Array<[elementSelector: string, eventNames: string]> | null;\r\n attributes: string[] | null;\r\n debounce: [timeout: number, maxWait: number] | number | null; // (if tuple: [timeout: 0, maxWait: 33], if number: [timeout: number, maxWait: false]) debounce for content Changes\r\n ignoreMutation: ((mutation: MutationRecord) => any) | null;\r\n };\r\n overflow: {\r\n x: OverflowBehavior;\r\n y: OverflowBehavior;\r\n };\r\n scrollbars: {\r\n theme: string | null;\r\n visibility: ScrollbarVisibilityBehavior;\r\n autoHide: ScrollbarAutoHideBehavior;\r\n autoHideDelay: number;\r\n dragScroll: boolean;\r\n clickScroll: boolean;\r\n touch: boolean;\r\n };\r\n}\r\n\r\nexport type ReadonlyOSOptions = ReadonlyOptions;\r\n\r\nexport interface OverflowChangedArgs {\r\n x: boolean;\r\n y: boolean;\r\n xScrollable: boolean;\r\n yScrollable: boolean;\r\n clipped: boolean;\r\n}\r\n\r\nexport interface OverflowAmountChangedArgs {\r\n x: number;\r\n y: number;\r\n}\r\n\r\nexport interface DirectionChangedArgs {\r\n isRTL: number;\r\n dir: string;\r\n}\r\n\r\nexport interface SizeChangedArgs {\r\n width: number;\r\n height: number;\r\n}\r\n\r\nexport interface UpdatedArgs {\r\n forced: boolean;\r\n}\r\n\r\nexport const defaultOptions: Options = {\r\n // resize: 'none', // none || both || horizontal || vertical || n || b || h || v\r\n paddingAbsolute: false, // true || false\r\n showNativeOverlaidScrollbars: false, // true || false\r\n updating: {\r\n elementEvents: [['img', 'load']], // array of tuples || null\r\n debounce: [0, 33], // number || number array || null\r\n attributes: null, // string array || null\r\n ignoreMutation: null, // () => any || null\r\n },\r\n overflow: {\r\n x: 'scroll', // visible-hidden || visible-scroll || hidden || scroll || v-h || v-s || h || s\r\n y: 'scroll', // visible-hidden || visible-scroll || hidden || scroll || v-h || v-s || h || s\r\n },\r\n scrollbars: {\r\n theme: 'os-theme-dark',\r\n visibility: 'auto', // visible || hidden || auto || v || h || a\r\n autoHide: 'never', // never || scroll || leave || move || n || s || l || m\r\n autoHideDelay: 800, // number\r\n dragScroll: true, // true || false\r\n clickScroll: false, // true || false\r\n touch: true, // true || false\r\n },\r\n /*\r\n textarea: {\r\n dynWidth: false, // true || false\r\n dynHeight: false, // true || false\r\n inheritedAttrs: ['style', 'class'], // string || array || null\r\n },\r\n */\r\n};\r\n\r\nexport const getOptionsDiff = (currOptions: T, newOptions: DeepPartial): DeepPartial => {\r\n const diff: DeepPartial = {};\r\n const optionsKeys = keys(newOptions).concat(keys(currOptions));\r\n\r\n each(optionsKeys, (optionKey) => {\r\n const currOptionValue = currOptions[optionKey];\r\n const newOptionValue = newOptions[optionKey];\r\n\r\n if (isObject(currOptionValue) && isObject(newOptionValue)) {\r\n assignDeep((diff[optionKey] = {}), getOptionsDiff(currOptionValue, newOptionValue));\r\n } else if (hasOwnProperty(newOptions, optionKey) && newOptionValue !== currOptionValue) {\r\n let isDiff = true;\r\n\r\n if (isArray(currOptionValue) || isArray(newOptionValue)) {\r\n try {\r\n if (opsStringify(currOptionValue) === opsStringify(newOptionValue)) {\r\n isDiff = false;\r\n }\r\n } catch {}\r\n }\r\n\r\n if (isDiff) {\r\n diff[optionKey] = newOptionValue;\r\n }\r\n }\r\n });\r\n\r\n return diff;\r\n};\r\n","import { assignDeep, each, isArray, keys } from 'support';\r\nimport { OverlayScrollbars, OverlayScrollbarsStatic } from 'overlayscrollbars';\r\n\r\nexport type PluginInstance =\r\n | Record\r\n | ((staticObj: OverlayScrollbarsStatic, instanceObj: OverlayScrollbars) => void);\r\nexport type Plugin = {\r\n [pluginName: string]: T;\r\n};\r\n\r\nconst pluginRegistry: Record = {};\r\n\r\nexport const getPlugins = () => assignDeep({}, pluginRegistry);\r\n\r\nexport const addPlugin = (addedPlugin: Plugin | Plugin[]) => {\r\n each((isArray(addedPlugin) ? addedPlugin : [addedPlugin]) as Plugin[], (plugin) => {\r\n each(keys(plugin), (pluginName) => {\r\n pluginRegistry[pluginName] = plugin[pluginName];\r\n });\r\n });\r\n};\r\n","import { each, hasOwnProperty, keys, push, isEmptyObject } from 'support/utils';\r\nimport { type, isArray, isUndefined, isPlainObject, isString } from 'support/utils/types';\r\nimport { PlainObject, DeepPartial } from 'typings';\r\n\r\nexport type OptionsObjectType = Record;\r\nexport type OptionsFunctionType = (this: any, ...args: any[]) => any;\r\nexport type OptionsTemplateType = ExtractPropsKey<\r\n OptionsTemplateTypeMap,\r\n T\r\n>;\r\nexport type OptionsTemplateTypes = keyof OptionsTemplateTypeMap;\r\nexport type OptionsTemplateNativeTypes = OptionsTemplateTypeMap[keyof OptionsTemplateTypeMap];\r\n\r\nexport type OptionsTemplateValue = T extends string\r\n ? string extends T\r\n ? OptionsTemplateValueNonEnum\r\n : string\r\n : OptionsTemplateValueNonEnum;\r\n\r\nexport type OptionsTemplate = {\r\n [P in keyof T]: T[P] extends OptionsObjectType\r\n ? OptionsTemplate\r\n : T[P] extends OptionsTemplateNativeTypes\r\n ? OptionsTemplateValue\r\n : never;\r\n};\r\n\r\nexport type OptionsValidationResult = [\r\n DeepPartial, // validated\r\n Record // foreign\r\n];\r\n\r\ntype OptionsTemplateTypeMap = {\r\n __TPL_boolean_TYPE__: boolean;\r\n __TPL_number_TYPE__: number;\r\n __TPL_string_TYPE__: string;\r\n __TPL_array_TYPE__: Array | ReadonlyArray;\r\n __TPL_function_TYPE__: OptionsFunctionType;\r\n __TPL_null_TYPE__: null;\r\n __TPL_object_TYPE__: OptionsObjectType;\r\n};\r\n\r\ntype OptionsTemplateValueNonEnum =\r\n | OptionsTemplateType\r\n | [OptionsTemplateType, ...Array];\r\n\r\ntype ExtractPropsKey = {\r\n [P in keyof T]: TProps extends T[P] ? P : never;\r\n}[keyof T];\r\n\r\ntype OptionsTemplateTypesDictionary = {\r\n readonly boolean: OptionsTemplateType;\r\n readonly number: OptionsTemplateType;\r\n readonly string: OptionsTemplateType;\r\n readonly array: OptionsTemplateType>;\r\n readonly object: OptionsTemplateType;\r\n readonly function: OptionsTemplateType;\r\n readonly null: OptionsTemplateType;\r\n};\r\n\r\nconst optionsTemplateTypes: OptionsTemplateTypesDictionary = {\r\n boolean: '__TPL_boolean_TYPE__',\r\n number: '__TPL_number_TYPE__',\r\n string: '__TPL_string_TYPE__',\r\n array: '__TPL_array_TYPE__',\r\n object: '__TPL_object_TYPE__',\r\n function: '__TPL_function_TYPE__',\r\n null: '__TPL_null_TYPE__',\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a object which looks like:\r\n * {\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * }\r\n * @param template The template according to which the options object shall be validated.\r\n * @param options The options object which shall be validated.\r\n * @param optionsDiff When provided the returned validated object will only have properties which are different to this objects properties.\r\n * Example (assume all properties are valid to the template):\r\n * Options object : { a: 'a', b: 'b', c: 'c' }\r\n * optionsDiff object : { a: 'a', b: 'b', c: undefined }\r\n * Returned validated object : { c: 'c' }\r\n * Because the value of the properties a and b didn't change, they aren't included in the returned object.\r\n * Without the optionsDiff object the returned validated object would be: { a: 'a', b: 'b', c: 'c' }\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n * @param propPath The propertyPath which lead to this object. (used for error logging)\r\n */\r\nconst validateRecursive = (\r\n template: OptionsTemplate,\r\n options: DeepPartial,\r\n doWriteErrors?: boolean,\r\n propPath?: string\r\n): OptionsValidationResult => {\r\n const validatedOptions: DeepPartial = {};\r\n const optionsCopy: DeepPartial = { ...options };\r\n const props = keys(template).filter((prop) => hasOwnProperty(options, prop));\r\n\r\n each(props, (prop: Extract) => {\r\n const optionsValue: any = options[prop];\r\n const templateValue: PlainObject | string | OptionsTemplateTypes | Array =\r\n template[prop];\r\n const templateIsComplex = isPlainObject(templateValue);\r\n const propPrefix = propPath ? `${propPath}.` : '';\r\n\r\n // if the template has a object as value, it means that the options are complex (verschachtelt)\r\n if (templateIsComplex && isPlainObject(optionsValue)) {\r\n const [validated, foreign] = validateRecursive(\r\n templateValue as T,\r\n optionsValue,\r\n doWriteErrors,\r\n propPrefix + prop\r\n );\r\n validatedOptions[prop] = validated as any;\r\n optionsCopy[prop] = foreign as any;\r\n\r\n each([optionsCopy, validatedOptions], (value) => {\r\n if (isEmptyObject(value[prop])) {\r\n delete value[prop];\r\n }\r\n });\r\n } else if (!templateIsComplex) {\r\n let isValid = false;\r\n const errorEnumStrings: Array = [];\r\n const errorPossibleTypes: Array = [];\r\n const optionsValueType = type(optionsValue);\r\n const templateValueArr: Array = !isArray(templateValue)\r\n ? [templateValue as string | OptionsTemplateTypes]\r\n : (templateValue as Array);\r\n\r\n each(templateValueArr, (currTemplateType) => {\r\n // if currType value isn't inside possibleTemplateTypes we assume its a enum string value\r\n let typeString: string | undefined;\r\n each(optionsTemplateTypes, (value: string, key: string) => {\r\n if (value === currTemplateType) {\r\n typeString = key;\r\n }\r\n });\r\n const isEnumString = isUndefined(typeString);\r\n if (isEnumString && isString(optionsValue)) {\r\n // split it into a array which contains all possible values for example: [\"yes\", \"no\", \"maybe\"]\r\n const enumStringSplit = currTemplateType.split(' ');\r\n isValid = !!enumStringSplit.find((possibility) => possibility === optionsValue);\r\n\r\n // build error message\r\n push(errorEnumStrings, enumStringSplit);\r\n } else {\r\n isValid = optionsTemplateTypes[optionsValueType] === currTemplateType;\r\n }\r\n\r\n // build error message\r\n push(errorPossibleTypes, isEnumString ? optionsTemplateTypes.string : typeString!);\r\n\r\n // continue if invalid, break if valid\r\n return !isValid;\r\n });\r\n\r\n if (isValid) {\r\n validatedOptions[prop] = optionsValue;\r\n } else if (doWriteErrors) {\r\n console.warn(\r\n `${\r\n `The option \"${propPrefix}${prop}\" wasn't set, because it doesn't accept the type [ ${optionsValueType.toUpperCase()} ] with the value of \"${optionsValue}\".\\r\\n` +\r\n `Accepted types are: [ ${errorPossibleTypes.join(', ').toUpperCase()} ].\\r\\n`\r\n }${\r\n errorEnumStrings.length > 0\r\n ? `\\r\\nValid strings are: [ ${errorEnumStrings.join(', ')} ].`\r\n : ''\r\n }`\r\n );\r\n }\r\n\r\n delete optionsCopy[prop];\r\n }\r\n });\r\n\r\n return [validatedOptions, optionsCopy]; // optionsCopy equals now to foreign options\r\n};\r\n\r\n/**\r\n * Validates the given options object according to the given template object and returns a tuple which looks like:\r\n * [\r\n * validated : a object which consists only of valid properties. (property name is inside the template and value has a correct type)\r\n * foreign : a object which consists of properties which aren't defined inside the template. (foreign properties)\r\n * ]\r\n * @param template The template according to which the options object shall be validated.\r\n * @param options The options object which shall be validated.\r\n * @param doWriteErrors True if errors shall be logged into the console, false otherwise.\r\n */\r\nconst validateOptions = (\r\n template: OptionsTemplate,\r\n options: DeepPartial,\r\n doWriteErrors?: boolean\r\n): OptionsValidationResult => validateRecursive(template, options, doWriteErrors);\r\n\r\nexport { validateOptions, optionsTemplateTypes };\r\n","import {\r\n Options,\r\n OverflowBehavior,\r\n ScrollbarVisibilityBehavior,\r\n ScrollbarAutoHideBehavior,\r\n} from 'options';\r\nimport {\r\n validateOptions,\r\n OptionsTemplate,\r\n OptionsTemplateValue,\r\n optionsTemplateTypes as oTypes,\r\n} from 'plugins/optionsValidationPlugin/validation';\r\nimport type { DeepPartial } from 'typings';\r\nimport type { Plugin } from 'plugins';\r\n\r\nconst numberAllowedValues: OptionsTemplateValue = oTypes.number;\r\nconst booleanAllowedValues: OptionsTemplateValue = oTypes.boolean;\r\nconst arrayNullValues: OptionsTemplateValue