improve code

This commit is contained in:
Rene Haas
2022-07-18 21:56:48 +02:00
parent 45e4b743c9
commit a548b60484
9 changed files with 505 additions and 415 deletions
+8 -5
View File
@@ -126,11 +126,14 @@
opacity: 0; opacity: 0;
visibility: hidden; } visibility: hidden; }
body > .os-scrollbar {
position: fixed; }
.os-scrollbar-transitionless { .os-scrollbar-transitionless {
transition: none; } transition: none; }
.os-scrollbar-track { .os-scrollbar-track {
pointer-events: auto; pointer-events: none;
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
@@ -138,14 +141,14 @@
border: none !important; } border: none !important; }
.os-scrollbar-handle { .os-scrollbar-handle {
pointer-events: auto; pointer-events: none;
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; } height: 100%; }
.os-scrollbar-handle-off, .os-scrollbar-handle-interactive,
.os-scrollbar-track-off { .os-scrollbar-track-interactive {
pointer-events: none; } pointer-events: auto; }
.os-scrollbar-unusable, .os-scrollbar-unusable,
.os-scrollbar-unusable * { .os-scrollbar-unusable * {
+183 -140
View File
@@ -183,7 +183,7 @@ const getSetProp = (t, n, o, s) => {
if (isUndefined(s)) { if (isUndefined(s)) {
return o ? o[t] : n; return o ? o[t] : n;
} }
o && (o[t] = s); o && !isNull(s) && false !== s && (o[t] = s);
}; };
const attr = (t, n, o) => { const attr = (t, n, o) => {
@@ -194,10 +194,12 @@ const attr = (t, n, o) => {
}; };
const attrClass = (t, n, o, s) => { const attrClass = (t, n, o, s) => {
const e = attr(t, n) || ""; if (o) {
const c = new Set(e.split(" ")); const e = attr(t, n) || "";
c[s ? "add" : "delete"](o); const c = new Set(e.split(" "));
attr(t, n, from(c).join(" ").trim()); c[s ? "add" : "delete"](o);
attr(t, n, from(c).join(" ").trim());
}
}; };
const hasAttrClass = (t, n, o) => { const hasAttrClass = (t, n, o) => {
@@ -766,6 +768,7 @@ const K = {
initialize: false initialize: false
}, },
scrollbars: { scrollbars: {
theme: "os-theme-dark",
visibility: "auto", visibility: "auto",
autoHide: "never", autoHide: "never",
autoHideDelay: 800, autoHideDelay: 800,
@@ -926,6 +929,7 @@ const lt = {
y: ct y: ct
}, },
scrollbars: { scrollbars: {
theme: [ nt.string, nt.null ],
visibility: rt, visibility: rt,
autoHide: it, autoHide: it,
autoHideDelay: ot, autoHideDelay: ot,
@@ -1223,8 +1227,8 @@ const createEnvironment = () => {
y: 0 === l.y y: 0 === l.y
}; };
const d = { const d = {
k: !a, padding: !a,
B: false content: false
}; };
const f = assignDeep({}, K); const f = assignDeep({}, K);
const _ = { const _ = {
@@ -1232,19 +1236,19 @@ const createEnvironment = () => {
P: u, P: u,
T: a, T: a,
L: "-1" === style(o, "zIndex"), L: "-1" === style(o, "zIndex"),
F: getRtlScrollBehavior(o, s), k: getRtlScrollBehavior(o, s),
Y: getFlexboxGlue(o, s), B: getFlexboxGlue(o, s),
q: t => e("_", t), F: t => e("_", t),
G: assignDeep.bind(0, {}, d), Y: assignDeep.bind(0, {}, d),
N(t) { q(t) {
assignDeep(d, t); assignDeep(d, t);
}, },
U: assignDeep.bind(0, {}, f), G: assignDeep.bind(0, {}, f),
W(t) { N(t) {
assignDeep(f, t); assignDeep(f, t);
}, },
X: assignDeep({}, d), U: assignDeep({}, d),
J: assignDeep({}, f) W: assignDeep({}, f)
}; };
removeAttr(o, "style"); removeAttr(o, "style");
removeElements(o); removeElements(o);
@@ -1292,10 +1296,10 @@ const addDataAttrHost = (t, n) => {
const createStructureSetupElements = t => { const createStructureSetupElements = t => {
const n = getEnvironment(); const n = getEnvironment();
const {G: o, T: s} = n; const {Y: o, T: s} = n;
const e = getPlugins()[pt]; const e = getPlugins()[pt];
const c = e && e.I; const c = e && e.I;
const {K: r, Z: i, k: l, B: a} = o(); const {host: r, viewport: i, padding: l, content: a} = o();
const d = isHTMLElement(t); const d = isHTMLElement(t);
const f = t; const f = t;
const _ = d ? t : f.target; const _ = d ? t : f.target;
@@ -1310,11 +1314,11 @@ const createStructureSetupElements = t => {
const S = [ y(mt, i, f.viewport), y(mt, i), y(mt) ].filter((t => !b ? t !== _ : true))[0]; const S = [ y(mt, i, f.viewport), y(mt, i), y(mt) ].filter((t => !b ? t !== _ : true))[0];
const O = S === _; const O = S === _;
const z = { const z = {
tt: _, X: _,
K: g ? y(mt, r, f.host) : _, J: g ? y(mt, r, f.host) : _,
Z: S, K: S,
k: !O && m(mt, l, f.padding), Z: !O && m(mt, l, f.padding),
B: !O && m(mt, a, f.content), tt: !O && m(mt, a, f.content),
nt: !O && !s && c && c(n), nt: !O && !s && c && c(n),
ot: p, ot: p,
st: v, st: v,
@@ -1332,7 +1336,7 @@ const createStructureSetupElements = t => {
return push(t, o && !parent(o) ? o : false); return push(t, o && !parent(o) ? o : false);
}), []); }), []);
const elementIsGenerated = t => t ? indexOf(T, t) > -1 : null; const elementIsGenerated = t => t ? indexOf(T, t) > -1 : null;
const {tt: L, K: H, k: M, Z: R, B: D, nt: j} = z; const {X: L, J: H, Z: M, K: R, tt: D, nt: j} = z;
const V = []; const V = [];
const k = g && elementIsGenerated(H); const k = g && elementIsGenerated(H);
const B = g ? L : contents([ D, R, M, H, L ].find((t => false === elementIsGenerated(t)))); const B = g ? L : contents([ D, R, M, H, L ].find((t => false === elementIsGenerated(t))));
@@ -1382,10 +1386,10 @@ const createStructureSetupElements = t => {
}; };
const createTrinsicUpdateSegment = (t, n) => { const createTrinsicUpdateSegment = (t, n) => {
const {B: o} = t; const {tt: o} = t;
const [s] = n; const [s] = n;
return t => { return t => {
const {Y: n} = getEnvironment(); const {B: n} = getEnvironment();
const {_t: e} = s(); const {_t: e} = s();
const {gt: c} = t; const {gt: c} = t;
const r = (o || !n) && c; const r = (o || !n) && c;
@@ -1403,14 +1407,14 @@ const createTrinsicUpdateSegment = (t, n) => {
const createPaddingUpdateSegment = (t, n) => { const createPaddingUpdateSegment = (t, n) => {
const [o, s] = n; const [o, s] = n;
const {K: e, k: c, Z: r, ut: i} = t; const {J: e, Z: c, K: r, ut: i} = t;
const [l, a] = createCache({ const [l, a] = createCache({
_: equalTRBL, _: equalTRBL,
u: topRightBottomLeft() u: topRightBottomLeft()
}, topRightBottomLeft.bind(0, e, "padding", "")); }, topRightBottomLeft.bind(0, e, "padding", ""));
return (t, n, e) => { return (t, n, e) => {
let [u, d] = a(e); let [u, d] = a(e);
const {T: f, Y: _} = getEnvironment(); const {T: f, B: _} = getEnvironment();
const {wt: g} = o(); const {wt: g} = o();
const {ht: h, vt: v, bt: w} = t; const {ht: h, vt: v, bt: w} = t;
const [p, b] = n("paddingAbsolute"); const [p, b] = n("paddingAbsolute");
@@ -1441,7 +1445,7 @@ const createPaddingUpdateSegment = (t, n) => {
style(c || r, e); style(c || r, e);
style(r, i); style(r, i);
s({ s({
k: u, Z: u,
yt: !t, yt: !t,
M: c ? i : assignDeep({}, e, i) M: c ? i : assignDeep({}, e, i)
}); });
@@ -1496,8 +1500,8 @@ const overflowIsVisible = t => 0 === t.indexOf(Ct);
const createOverflowUpdateSegment = (t, n) => { const createOverflowUpdateSegment = (t, n) => {
const [o, s] = n; const [o, s] = n;
const {K: e, k: c, Z: r, nt: i, ut: l, ft: a} = t; const {J: e, Z: c, K: r, nt: i, ut: l, ft: a} = t;
const {V: u, Y: d, T: f, P: _} = getEnvironment(); const {V: u, B: d, T: f, P: _} = getEnvironment();
const g = getPlugins()[pt]; const g = getPlugins()[pt];
const h = !l && !f && (_.x || _.y); const h = !l && !f && (_.x || _.y);
const [v, w] = createCache(zt, fractionalSize.bind(0, r)); const [v, w] = createCache(zt, fractionalSize.bind(0, r));
@@ -1510,7 +1514,7 @@ const createOverflowUpdateSegment = (t, n) => {
height: "" height: ""
}); });
if (n) { if (n) {
const {yt: n, k: s} = o(); const {yt: n, Z: s} = o();
const {xt: c, R: i} = t; const {xt: c, R: i} = t;
const l = fractionalSize(e); const l = fractionalSize(e);
const a = clientSize(e); const a = clientSize(e);
@@ -1704,8 +1708,8 @@ const prepareUpdateHints = (t, n, o) => {
}; };
const createStructureSetupUpdate = (t, n) => { const createStructureSetupUpdate = (t, n) => {
const {Z: o} = t; const {K: o} = t;
const {T: s, P: e, Y: c} = getEnvironment(); const {T: s, P: e, B: c} = getEnvironment();
const r = !s && (e.x || e.y); const r = !s && (e.x || e.y);
const i = [ createTrinsicUpdateSegment(t, n), createPaddingUpdateSegment(t, n), createOverflowUpdateSegment(t, n) ]; const i = [ createTrinsicUpdateSegment(t, n), createPaddingUpdateSegment(t, n), createOverflowUpdateSegment(t, n) ];
return (t, n, s) => { return (t, n, s) => {
@@ -1727,12 +1731,8 @@ const createStructureSetupUpdate = (t, n) => {
each(i, (n => { each(i, (n => {
d = prepareUpdateHints(d, n(d, t, !!s) || {}, s); d = prepareUpdateHints(d, n(d, t, !!s) || {}, s);
})); }));
if (isNumber(a)) { scrollLeft(o, a);
scrollLeft(o, a); scrollTop(o, u);
}
if (isNumber(u)) {
scrollTop(o, u);
}
return d; return d;
}; };
}; };
@@ -1746,7 +1746,7 @@ const domRectHasDimensions = t => t && (t.height || t.width);
const createSizeObserver = (t, n, o) => { const createSizeObserver = (t, n, o) => {
const {Pt: s = false, Lt: e = false} = o || {}; const {Pt: s = false, Lt: e = false} = o || {};
const c = getPlugins()[_t]; const c = getPlugins()[_t];
const {F: r} = getEnvironment(); const {k: r} = getEnvironment();
const i = createDOM(`<div class="${H}"><div class="${R}"></div></div>`); const i = createDOM(`<div class="${H}"><div class="${R}"></div></div>`);
const l = i[0]; const l = i[0];
const a = l.firstChild; const a = l.firstChild;
@@ -2034,8 +2034,8 @@ const createStructureSetupObservers = (t, n, o) => {
let e; let e;
let c; let c;
const [, r] = n; const [, r] = n;
const {K: i, Z: l, B: a, rt: d, ut: f, dt: _, ft: g} = t; const {J: i, K: l, tt: a, rt: d, ut: f, dt: _, ft: g} = t;
const {T: h, Y: v} = getEnvironment(); const {T: h, B: v} = getEnvironment();
const [w] = createCache({ const [w] = createCache({
_: equalWH, _: equalWH,
u: { u: {
@@ -2044,14 +2044,21 @@ const createStructureSetupObservers = (t, n, o) => {
} }
}, (() => { }, (() => {
const t = _(L, O); const t = _(L, O);
t && g(L, O); const n = _(T, "");
const n = scrollSize(a); const o = n && scrollLeft(l);
const o = scrollSize(l); const s = n && scrollTop(l);
const s = fractionalSize(l); g(L, O);
t && g(L, O, true); g(T, "");
const e = scrollSize(a);
const c = scrollSize(l);
const r = fractionalSize(l);
g(L, O, t);
g(T, "", n);
scrollLeft(l, o);
scrollTop(l, s);
return { return {
w: o.w + n.w + s.w, w: c.w + e.w + r.w,
h: o.h + n.h + s.h h: c.h + e.h + r.h
}; };
})); }));
const p = d ? Lt : Ht.concat(Lt); const p = d ? Lt : Ht.concat(Lt);
@@ -2210,7 +2217,7 @@ const Mt = {
}; };
const Rt = { const Rt = {
k: { Z: {
t: 0, t: 0,
r: 0, r: 0,
b: 0, b: 0,
@@ -2285,15 +2292,21 @@ const stopRootClickPropagation = (t, n) => on(t, "mousedown", on.bind(0, n, "cli
}); });
const createScrollbarsSetupElements = (t, n) => { const createScrollbarsSetupElements = (t, n) => {
const {G: o} = getEnvironment(); const {Y: o} = getEnvironment();
const {qt: s} = o(); const {scrollbarsSlot: s} = o();
const {st: e, tt: c, K: r, Z: i, lt: l} = n; const {st: e, X: c, J: r, K: i, lt: l} = n;
const a = !l && t.scrollbarsSlot; const a = l ? null : t.scrollbarsSlot;
const u = dynamicInitializationElement([ c, r, i ], (() => r), s, a); const u = dynamicInitializationElement([ c, r, i ], (() => r), s, a);
const scrollbarsAddRemoveClass = (t, n, o) => { const scrollbarsAddRemoveClass = (t, n, o, s) => {
const s = o ? addClass : removeClass; const e = o ? addClass : removeClass;
each(t, (t => { each(t, (t => {
s(t.Gt, n); e((s || noop)(t) || t.qt, n);
}));
};
const scrollbarsHandleStyle = (t, n) => {
each(t, (t => {
const [o, s] = n(t);
style(o, s);
})); }));
}; };
const d = []; const d = [];
@@ -2305,13 +2318,13 @@ const createScrollbarsSetupElements = (t, n) => {
const n = t ? F : Y; const n = t ? F : Y;
const o = t ? f : g; const o = t ? f : g;
const s = isEmptyArray(o) ? W : ""; const s = isEmptyArray(o) ? W : "";
const c = createDiv(`${B} ${n} ${s} os-theme-dark`); const c = createDiv(`${B} ${n} ${s}`);
const r = createDiv(q); const r = createDiv(q);
const i = createDiv(G); const i = createDiv(G);
const l = { const l = {
Gt: c, qt: c,
Nt: r, Gt: r,
Ut: i Nt: i
}; };
appendChildren(c, r); appendChildren(c, r);
appendChildren(r, i); appendChildren(r, i);
@@ -2328,8 +2341,8 @@ const createScrollbarsSetupElements = (t, n) => {
const w = generateScrollbarDOM.bind(0, true); const w = generateScrollbarDOM.bind(0, true);
const p = generateScrollbarDOM.bind(0, false); const p = generateScrollbarDOM.bind(0, false);
const appendElements = () => { const appendElements = () => {
appendChildren(u, f[0].Gt); appendChildren(u, f[0].qt);
appendChildren(u, g[0].Gt); appendChildren(u, g[0].qt);
_((() => { _((() => {
h(W); h(W);
v(W); v(W);
@@ -2338,19 +2351,23 @@ const createScrollbarsSetupElements = (t, n) => {
w(); w();
p(); p();
return [ { return [ {
Wt: { Ut: {
Xt: f, Wt: f,
Jt: w, Xt: w,
Kt: h Jt: h,
Kt: scrollbarsHandleStyle.bind(0, f)
}, },
Zt: { Zt: {
Xt: g, Wt: g,
Jt: p, Xt: p,
Kt: v Jt: v,
Kt: scrollbarsHandleStyle.bind(0, g)
} }
}, appendElements, runEachAndClear.bind(0, d) ]; }, appendElements, runEachAndClear.bind(0, d) ];
}; };
const {min: Vt} = Math;
const createSelfCancelTimeout = t => { const createSelfCancelTimeout = t => {
let n; let n;
const o = t ? _ : f; const o = t ? _ : f;
@@ -2361,120 +2378,146 @@ const createSelfCancelTimeout = t => {
}, () => s(n) ]; }, () => s(n) ];
}; };
const refreshScrollbarHandleLength = (t, n, o) => {
const {zt: s, Ot: e} = n;
const c = o ? "x" : "y";
const r = e[c];
const i = s[c];
const l = Vt(1, r / (r + i));
t((t => [ t.Nt, {
[o ? "width" : "height"]: `${(100 * l).toFixed(3)}%`
} ]));
};
const createScrollbarsSetup = (t, n, o) => { const createScrollbarsSetup = (t, n, o) => {
let s = 0; let s;
let e; let e;
let c; let c;
let r; let r;
let i; let i;
const l = createState({}); let l = 0;
const [a] = l; const a = createState({});
const [u, d] = createSelfCancelTimeout(); const [u] = a;
const [f, _] = createSelfCancelTimeout(); const [d, f] = createSelfCancelTimeout();
const [g, h] = createSelfCancelTimeout(100); const [_, g] = createSelfCancelTimeout();
const [v, w] = createSelfCancelTimeout(100); const [h, v] = createSelfCancelTimeout(100);
const [p, b] = createSelfCancelTimeout((() => s)); const [w, p] = createSelfCancelTimeout(100);
const [y, m, S] = createScrollbarsSetupElements(t, o.Yt); const [b, y] = createSelfCancelTimeout((() => l));
const {K: x, Z: C} = o.Yt; const [m, S, x] = createScrollbarsSetupElements(t, o.Yt);
const {Wt: $, Zt: O} = y; const {J: C, K: $} = o.Yt;
const {Kt: z} = $; const {Ut: O, Zt: z} = m;
const {Kt: A} = O; const {Jt: A, Kt: I} = O;
const {Jt: T, Kt: E} = z;
const manageScrollbarsAutoHide = (t, n) => { const manageScrollbarsAutoHide = (t, n) => {
b(); y();
if (t) { if (t) {
z(J);
A(J); A(J);
T(J);
} else { } else {
const hide = () => { const hide = () => {
z(J, true);
A(J, true); A(J, true);
T(J, true);
}; };
if (s > 0 && !n) { if (l > 0 && !n) {
p(hide); b(hide);
} else { } else {
hide(); hide();
} }
} }
}; };
const onHostMouseEnter = () => { const onHostMouseEnter = () => {
i = c; r = e;
i && manageScrollbarsAutoHide(true); r && manageScrollbarsAutoHide(true);
}; };
const I = [ h, b, w, _, d, S, on(x, "mouseover", onHostMouseEnter, { const P = [ v, y, p, g, f, x, on(C, "mouseover", onHostMouseEnter, {
O: true O: true
}), on(x, "mouseenter", onHostMouseEnter), on(x, "mouseleave", (() => { }), on(C, "mouseenter", onHostMouseEnter), on(C, "mouseleave", (() => {
i = false; r = false;
c && manageScrollbarsAutoHide(false); e && manageScrollbarsAutoHide(false);
})), on(x, "mousemove", (() => { })), on(C, "mousemove", (() => {
e && u((() => { s && d((() => {
h(); v();
manageScrollbarsAutoHide(true); manageScrollbarsAutoHide(true);
v((() => { w((() => {
e && manageScrollbarsAutoHide(false); s && manageScrollbarsAutoHide(false);
})); }));
})); }));
})), on(C, "scroll", (() => { })), on($, "scroll", (() => {
r && f((() => { c && _((() => {
manageScrollbarsAutoHide(true); manageScrollbarsAutoHide(true);
g((() => { h((() => {
r && !i && manageScrollbarsAutoHide(false); c && !r && manageScrollbarsAutoHide(false);
})); }));
})); }));
})) ]; })) ];
const T = a.bind(0); const L = u.bind(0);
T.Yt = y; L.Yt = m;
T.Ft = m; L.Ft = S;
return [ (t, i, l) => { return [ (t, r, a) => {
const {Tt: a, Et: u, It: d} = l; const {Tt: u, Et: d, It: f} = a;
const f = createOptionCheck(n, t, i); const _ = createOptionCheck(n, t, r);
const [_, g] = f("scrollbars.visibility"); const g = o();
const [h, v] = f("scrollbars.autoHide"); const [h, v] = _("scrollbars.theme");
const [w] = f("scrollbars.autoHideDelay"); const [w, p] = _("scrollbars.visibility");
f("scrollbars.dragScrolling"); const [b, y] = _("scrollbars.autoHide");
f("scrollbars.touchSupport"); const [m] = _("scrollbars.autoHideDelay");
const p = d || g; _("scrollbars.dragScrolling");
_("scrollbars.touchSupport");
const S = u || d;
const x = f || p;
const setScrollbarVisibility = (t, n) => { const setScrollbarVisibility = (t, n) => {
const o = "visible" === _ || "auto" === _ && "scroll" === t; const o = "visible" === w || "auto" === w && "scroll" === t;
n(N, o); n(N, o);
return o; return o;
}; };
s = w; l = m;
if (p) { if (x) {
const {Ct: t} = o(); const {Ct: t} = g;
const n = setScrollbarVisibility(t.x, z); const n = setScrollbarVisibility(t.x, A);
const s = setScrollbarVisibility(t.y, A); const o = setScrollbarVisibility(t.y, T);
const e = n && s; const s = n && o;
z(U, !e); A(U, !s);
A(U, !e); T(U, !s);
} }
if (v) { if (v) {
e = "move" === h; A(i);
c = "leave" === h; T(i);
r = "never" !== h; A(h, true);
manageScrollbarsAutoHide(!r, true); T(h, true);
i = h;
} }
}, T, runEachAndClear.bind(0, I) ]; if (y) {
s = "move" === b;
e = "leave" === b;
c = "never" !== b;
manageScrollbarsAutoHide(!c, true);
}
if (S) {
refreshScrollbarHandleLength(I, g, true);
refreshScrollbarHandleLength(E, g);
}
}, L, runEachAndClear.bind(0, P) ];
}; };
const Vt = new Set; const kt = new Set;
const kt = new WeakMap; const Bt = new WeakMap;
const addInstance = (t, n) => { const addInstance = (t, n) => {
kt.set(t, n); Bt.set(t, n);
Vt.add(t); kt.add(t);
}; };
const removeInstance = t => { const removeInstance = t => {
Bt.delete(t);
kt.delete(t); kt.delete(t);
Vt.delete(t);
}; };
const getInstance = t => kt.get(t); const getInstance = t => Bt.get(t);
const OverlayScrollbars = (t, n, o) => { const OverlayScrollbars = (t, n, o) => {
let s = false; let s = false;
const {U: e, P: c, q: r} = getEnvironment(); const {G: e, P: c, F: r} = getEnvironment();
const i = getPlugins(); const i = getPlugins();
const l = isHTMLElement(t) ? t : t.target; const l = isHTMLElement(t) ? t : t.target;
const a = getInstance(l); const a = getInstance(l);
@@ -2520,7 +2563,7 @@ const OverlayScrollbars = (t, n, o) => {
t && n && _(t, n); t && n && _(t, n);
}, },
state() { state() {
const {Ot: t, zt: n, Ct: o, At: e, k: c, yt: r} = v(); const {Ot: t, zt: n, Ct: o, At: e, Z: c, yt: r} = v();
return assignDeep({}, { return assignDeep({}, {
overflowEdge: t, overflowEdge: t,
overflowAmount: n, overflowAmount: n,
@@ -2532,7 +2575,7 @@ const OverlayScrollbars = (t, n, o) => {
}); });
}, },
elements() { elements() {
const {tt: t, K: n, k: o, Z: s, B: e} = v.Yt; const {X: t, J: n, Z: o, K: s, tt: e} = v.Yt;
return assignDeep({}, { return assignDeep({}, {
target: t, target: t,
host: n, host: n,
@@ -2587,7 +2630,7 @@ const OverlayScrollbars = (t, n, o) => {
OverlayScrollbars.plugin = addPlugin; OverlayScrollbars.plugin = addPlugin;
OverlayScrollbars.env = () => { OverlayScrollbars.env = () => {
const {V: t, P: n, T: o, F: s, Y: e, L: c, X: r, J: i, G: l, N: a, U: u, W: d} = getEnvironment(); const {V: t, P: n, T: o, k: s, B: e, L: c, U: r, W: i, Y: l, q: a, G: u, N: d} = getEnvironment();
return assignDeep({}, { return assignDeep({}, {
scrollbarsSize: t, scrollbarsSize: t,
scrollbarsOverlaid: n, scrollbarsOverlaid: n,
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -44,7 +44,7 @@ export interface ScrollbarsSetupElement {
_scrollbarStructures: ScrollbarStructure[]; _scrollbarStructures: ScrollbarStructure[];
_clone: () => ScrollbarStructure; _clone: () => ScrollbarStructure;
_addRemoveClass: ( _addRemoveClass: (
classNames: string, classNames: string | false | null | undefined,
add?: boolean, add?: boolean,
elm?: (scrollbarStructure: ScrollbarStructure) => HTMLElement | false | null | undefined elm?: (scrollbarStructure: ScrollbarStructure) => HTMLElement | false | null | undefined
) => void; ) => void;
@@ -101,7 +101,7 @@ export const createScrollbarsSetupElements = (
); );
const scrollbarsAddRemoveClass = ( const scrollbarsAddRemoveClass = (
scrollbarStructures: ScrollbarStructure[], scrollbarStructures: ScrollbarStructure[],
classNames: string, classNames: string | false | null | undefined,
add?: boolean, add?: boolean,
elm?: (scrollbarStructure: ScrollbarStructure) => HTMLElement | false | null | undefined elm?: (scrollbarStructure: ScrollbarStructure) => HTMLElement | false | null | undefined
) => { ) => {
+3 -2
View File
@@ -51,6 +51,7 @@ interface Options {
y: OverflowBehavior; y: OverflowBehavior;
}; };
scrollbars: { scrollbars: {
theme: string | null;
visibility: ScrollbarVisibilityBehavior; visibility: ScrollbarVisibilityBehavior;
autoHide: ScrollbarAutoHideBehavior; autoHide: ScrollbarAutoHideBehavior;
autoHideDelay: number; autoHideDelay: number;
@@ -115,7 +116,7 @@ interface ScrollbarsInitialization {
scrollbarsSlot?: ScrollbarsDynamicInitializationElement; scrollbarsSlot?: ScrollbarsDynamicInitializationElement;
} }
type ScrollbarsInitializationStrategy = { type ScrollbarsInitializationStrategy = {
[K in keyof ScrollbarsInitialization as `_${K}`]: InitializtationElementStrategy<ScrollbarsInitialization[K]>; [K in keyof ScrollbarsInitialization]: InitializtationElementStrategy<ScrollbarsInitialization[K]>;
}; };
interface StructureSetupState { interface StructureSetupState {
_padding: TRBL; _padding: TRBL;
@@ -152,7 +153,7 @@ interface StructureInitialization {
content?: StructureDynamicInitializationElement; content?: StructureDynamicInitializationElement;
} }
type StructureInitializationStrategy = { type StructureInitializationStrategy = {
[K in keyof Omit<StructureInitialization, "target"> as `_${K}`]: InitializtationElementStrategy<StructureInitialization[K]>; [K in keyof Omit<StructureInitialization, "target">]: InitializtationElementStrategy<StructureInitialization[K]>;
}; };
interface ViewportOverflowState { interface ViewportOverflowState {
_scrollbarsHideOffset: XY<number>; _scrollbarsHideOffset: XY<number>;