From 59f1a8756f0bf8c446f659e8f1829b1079696bec Mon Sep 17 00:00:00 2001 From: percy507 Date: Fri, 22 Sep 2023 19:04:52 +0800 Subject: [PATCH] fix: https://github.com/johnwalley/allotment/issues/537 --- dist/legacy.js | 50 +++--- dist/modern.mjs | 247 ++++++++++++++--------------- dist/module.js | 255 +++++++++++++++--------------- dist/types/src/allotment.d.ts.map | 2 +- src/allotment.tsx | 11 +- 5 files changed, 270 insertions(+), 295 deletions(-) diff --git a/dist/legacy.js b/dist/legacy.js index d6ba81f8..6abfbd58 100644 --- a/dist/legacy.js +++ b/dist/legacy.js @@ -11,7 +11,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } -function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e30) { throw _e30; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e31) { didErr = true; err = _e31; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } +function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e29) { throw _e29; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e30) { didErr = true; err = _e30; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); } @@ -156,8 +156,8 @@ var f = function f(e, t, i) { } var T, F, - R, - k = Array.prototype, + k, + R = Array.prototype, H = Function.prototype, $ = Object.prototype, Y = V["__core-js_shared__"], @@ -170,12 +170,12 @@ var f = function f(e, t, i) { K = V.Symbol, Z = V.Uint8Array, q = $.propertyIsEnumerable, - Q = k.splice, + Q = R.splice, ee = K ? K.toStringTag : void 0, te = Object.getOwnPropertySymbols, ie = J ? J.isBuffer : void 0, - re = (F = Object.keys, R = Object, function (e) { - return F(R(e)); + re = (F = Object.keys, k = Object, function (e) { + return F(k(e)); }), se = Pe(V, "DataView"), ne = Pe(V, "Map"), @@ -226,9 +226,9 @@ var f = function f(e, t, i) { this.size = t.size; } function Se(e, t) { - var i = Re(e), + var i = ke(e), r = !i && Fe(e), - s = !i && !r && ke(e), + s = !i && !r && Re(e), n = !i && !r && !s && We(e), o = i || r || s || n, a = o ? function (e, t) { @@ -269,15 +269,15 @@ var f = function f(e, t, i) { } function Ee(e, t, i, r, c) { return e === t || (null == e || null == t || !Be(e) && !Be(t) ? e != e && t != t : function (e, t, i, r, c, m) { - var d = Re(e), - g = Re(t), + var d = ke(e), + g = ke(t), S = d ? n : Me(e), _ = g ? n : Me(t), x = (S = S == s ? f : S) == f, I = (_ = _ == s ? f : _) == f, E = S == _; - if (E && ke(e)) { - if (!ke(t)) return !1; + if (E && Re(e)) { + if (!Re(t)) return !1; d = !0, x = !1; } if (E && !x) return m || (m = new we()), d || We(e) ? je(e, t, i, r, c, m) : function (e, t, i, r, s, n, c) { @@ -409,7 +409,7 @@ var f = function f(e, t, i) { function Ne(e) { return function (e, t, i) { var r = t(e); - return Re(e) ? r : function (e, t) { + return ke(e) ? r : function (e, t) { for (var i = -1, r = t.length, s = e.length; ++i < r;) { e[s + i] = t[i]; } @@ -557,8 +557,8 @@ var f = function f(e, t, i) { }()) ? Ie : function (e) { return Be(e) && W.call(e, "callee") && !q.call(e, "callee"); }, - Re = Array.isArray; - var ke = ie || function () { + ke = Array.isArray; + var Re = ie || function () { return !1; }; function He(e) { @@ -862,8 +862,8 @@ function C(e, t) { } var T = /^\s+|\s+$/g, F = /^[-+]0x[0-9a-f]+$/i, - R = /^0b[01]+$/i, - k = /^0o[0-7]+$/i, + k = /^0b[01]+$/i, + R = /^0o[0-7]+$/i, H = parseInt, $ = "object" == _typeof(m) && m && m.Object === Object && m, Y = "object" == (typeof self === "undefined" ? "undefined" : _typeof(self)) && self && self.Object === Object && self, @@ -891,8 +891,8 @@ function K(e) { } if ("string" != typeof e) return 0 === e ? e : +e; e = e.replace(T, ""); - var i = R.test(e); - return i || k.test(e) ? H(e.slice(2), i ? 2 : 8) : F.test(e) ? NaN : +e; + var i = k.test(e); + return i || R.test(e) ? H(e.slice(2), i ? 2 : 8) : F.test(e) ? NaN : +e; } var Z = function Z(e, t, i) { var r, @@ -2099,17 +2099,11 @@ var Ie = t.forwardRef(function (_ref4, w) { var _j$current12; var e = _ref5.width, t = _ref5.height; - e && t && ((_j$current12 = j.current) !== null && _j$current12 !== void 0 && _j$current12.layout(l ? t : e), O.current.setSize(l ? t : e), C(!0)); + e && t && ((_j$current12 = j.current) !== null && _j$current12 !== void 0 && _j$current12.layout(l ? t : e), O.current.setSize(l ? t : e)); } }), N(function () { - if (!A) { - var _j$current13; - var _I$current$getBoundin = I.current.getBoundingClientRect(), - _e29 = _I$current$getBoundin.height, - _t21 = _I$current$getBoundin.width; - (_j$current13 = j.current) !== null && _j$current13 !== void 0 && _j$current13.layout(l ? _e29 : _t21), O.current.setSize(l ? _e29 : _t21), C(!0); - } - }, [A, l]), t.useEffect(function () { + C(!0); + }, []), t.useEffect(function () { L && Ee(20); }, []), t.createElement("div", { ref: I, diff --git a/dist/modern.mjs b/dist/modern.mjs index 358cea59..cf4b31ae 100644 --- a/dist/modern.mjs +++ b/dist/modern.mjs @@ -1,18 +1,18 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import e, { useRef as t, useState as i, useEffect as n, useCallback as r, useMemo as s, useLayoutEffect as o, forwardRef as a, useImperativeHandle as u } from "react"; -var c, - h = {}; +var h, + c = {}; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ -c = { +h = { get exports() { - return h; + return c; }, set exports(e) { - h = e; + c = e; } }, function () { var e = {}.hasOwnProperty; @@ -31,9 +31,9 @@ c = { } return i.join(" "); } - c.exports ? (t.default = t, c.exports = t) : window.classNames = t; + h.exports ? (t.default = t, h.exports = t) : window.classNames = t; }(); -var l = h, +var l = c, f = /^\s+|\s+$/g, m = /^[-+]0x[0-9a-f]+$/i, d = /^0b[01]+$/i, @@ -75,8 +75,8 @@ var z = function z(e, t, i) { o = "[object Boolean]", a = "[object Date]", u = "[object Error]", - c = "[object Function]", - h = "[object Map]", + h = "[object Function]", + c = "[object Map]", l = "[object Number]", f = "[object Object]", m = "[object Promise]", @@ -90,7 +90,7 @@ var z = function z(e, t, i) { S = /^\[object .+?Constructor\]$/, _ = /^(?:0|[1-9]\d*)$/, I = {}; - I["[object Float32Array]"] = I["[object Float64Array]"] = I["[object Int8Array]"] = I["[object Int16Array]"] = I["[object Int32Array]"] = I["[object Uint8Array]"] = I["[object Uint8ClampedArray]"] = I["[object Uint16Array]"] = I["[object Uint32Array]"] = !0, I[r] = I[s] = I[b] = I[o] = I[z] = I[a] = I[u] = I[c] = I[h] = I[l] = I[f] = I[d] = I[p] = I[v] = I[g] = !1; + I["[object Float32Array]"] = I["[object Float64Array]"] = I["[object Int8Array]"] = I["[object Int16Array]"] = I["[object Int32Array]"] = I["[object Uint8Array]"] = I["[object Uint8ClampedArray]"] = I["[object Uint16Array]"] = I["[object Uint32Array]"] = !0, I[r] = I[s] = I[b] = I[o] = I[z] = I[a] = I[u] = I[h] = I[c] = I[l] = I[f] = I[d] = I[p] = I[v] = I[g] = !1; var x = "object" == typeof w && w && w.Object === Object && w, E = "object" == typeof self && self && self.Object === Object && self, V = x || E || Function("return this")(), @@ -150,8 +150,8 @@ var z = function z(e, t, i) { oe = Oe(V, "Promise"), ae = Oe(V, "Set"), ue = Oe(V, "WeakMap"), - ce = Oe(Object, "create"), - he = Te(re), + he = Oe(Object, "create"), + ce = Te(re), le = Te(se), fe = Te(oe), me = Te(ae), @@ -202,7 +202,7 @@ var z = function z(e, t, i) { return n; }(e.length, String) : [], u = a.length; - for (var c in e) !t && !W.call(e, c) || o && ("length" == c || r && ("offset" == c || "parent" == c) || s && ("buffer" == c || "byteLength" == c || "byteOffset" == c) || Ae(c, u)) || a.push(c); + for (var h in e) !t && !W.call(e, h) || o && ("length" == h || r && ("offset" == h || "parent" == h) || s && ("buffer" == h || "byteLength" == h || "byteOffset" == h) || Ae(h, u)) || a.push(h); return a; } function _e(e, t) { @@ -227,8 +227,8 @@ var z = function z(e, t, i) { function xe(e) { return Re(e) && Ie(e) == r; } - function Ee(e, t, i, n, c) { - return e === t || (null == e || null == t || !Re(e) && !Re(t) ? e != e && t != t : function (e, t, i, n, c, m) { + function Ee(e, t, i, n, h) { + return e === t || (null == e || null == t || !Re(e) && !Re(t) ? e != e && t != t : function (e, t, i, n, h, m) { var g = ke(e), w = ke(t), S = g ? s : Pe(e), @@ -240,7 +240,7 @@ var z = function z(e, t, i) { if (!$e(t)) return !1; g = !0, I = !1; } - if (E && !I) return m || (m = new we()), g || We(e) ? Ne(e, t, i, n, c, m) : function (e, t, i, n, r, s, c) { + if (E && !I) return m || (m = new we()), g || We(e) ? Ne(e, t, i, n, h, m) : function (e, t, i, n, r, s, h) { switch (i) { case z: if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1; @@ -256,28 +256,28 @@ var z = function z(e, t, i) { case d: case v: return e == t + ""; - case h: + case c: var f = A; case p: var m = 1 & n; if (f || (f = T), e.size != t.size && !m) return !1; - var g = c.get(e); + var g = h.get(e); if (g) return g == t; - n |= 2, c.set(e, t); - var w = Ne(f(e), f(t), n, r, s, c); - return c.delete(e), w; + n |= 2, h.set(e, t); + var w = Ne(f(e), f(t), n, r, s, h); + return h.delete(e), w; case y: if (ve) return ve.call(e) == ve.call(t); } return !1; - }(e, t, S, i, n, c, m); + }(e, t, S, i, n, h, m); if (!(1 & i)) { var V = I && W.call(e, "__wrapped__"), j = x && W.call(t, "__wrapped__"); if (V || j) { var N = V ? e.value() : e, L = j ? t.value() : t; - return m || (m = new we()), c(N, L, i, n, m); + return m || (m = new we()), h(N, L, i, n, m); } } if (!E) return !1; @@ -285,11 +285,11 @@ var z = function z(e, t, i) { var o = 1 & i, a = Le(e), u = a.length, - c = Le(t).length; - if (u != c && !o) return !1; - var h = u; - for (; h--;) { - var l = a[h]; + h = Le(t).length; + if (u != h && !o) return !1; + var c = u; + for (; c--;) { + var l = a[c]; if (!(o ? l in t : W.call(t, l))) return !1; } var f = s.get(e); @@ -297,8 +297,8 @@ var z = function z(e, t, i) { var m = !0; s.set(e, t), s.set(t, e); var d = o; - for (; ++h < u;) { - var p = e[l = a[h]], + for (; ++c < u;) { + var p = e[l = a[c]], v = t[l]; if (n) var y = o ? n(v, p, l, t, e, s) : n(p, v, l, e, t, s); if (!(void 0 === y ? p === v || r(p, v, i, n, s) : y)) { @@ -313,8 +313,8 @@ var z = function z(e, t, i) { g == b || !("constructor" in e) || !("constructor" in t) || "function" == typeof g && g instanceof g && "function" == typeof b && b instanceof b || (m = !1); } return s.delete(e), s.delete(t), m; - }(e, t, i, n, c, m); - }(e, t, i, n, Ee, c)); + }(e, t, i, n, h, m); + }(e, t, i, n, Ee, h)); } function Ve(e) { return !(!Be(e) || function (e) { @@ -335,15 +335,15 @@ var z = function z(e, t, i) { a = e.length, u = t.length; if (a != u && !(o && u > a)) return !1; - var c = s.get(e); - if (c && s.get(t)) return c == t; - var h = -1, + var h = s.get(e); + if (h && s.get(t)) return h == t; + var c = -1, l = !0, f = 2 & i ? new ze() : void 0; - for (s.set(e, t), s.set(t, e); ++h < a;) { - var m = e[h], - d = t[h]; - if (n) var p = o ? n(d, m, h, t, e, s) : n(m, d, h, e, t, s); + for (s.set(e, t), s.set(t, e); ++c < a;) { + var m = e[c], + d = t[c]; + if (n) var p = o ? n(d, m, c, t, e, s) : n(m, d, c, e, t, s); if (void 0 !== p) { if (p) continue; l = !1; @@ -386,23 +386,23 @@ var z = function z(e, t, i) { return Ve(i) ? i : void 0; } ye.prototype.clear = function () { - this.__data__ = ce ? ce(null) : {}, this.size = 0; + this.__data__ = he ? he(null) : {}, this.size = 0; }, ye.prototype.delete = function (e) { var t = this.has(e) && delete this.__data__[e]; return this.size -= t ? 1 : 0, t; }, ye.prototype.get = function (e) { var t = this.__data__; - if (ce) { + if (he) { var n = t[e]; return n === i ? void 0 : n; } return W.call(t, e) ? t[e] : void 0; }, ye.prototype.has = function (e) { var t = this.__data__; - return ce ? void 0 !== t[e] : W.call(t, e); + return he ? void 0 !== t[e] : W.call(t, e); }, ye.prototype.set = function (e, t) { var n = this.__data__; - return this.size += this.has(e) ? 0 : 1, n[e] = ce && void 0 === t ? i : t, this; + return this.size += this.has(e) ? 0 : 1, n[e] = he && void 0 === t ? i : t, this; }, ge.prototype.clear = function () { this.__data__ = [], this.size = 0; }, ge.prototype.delete = function (e) { @@ -490,15 +490,15 @@ var z = function z(e, t, i) { function Ce(e, t) { return e === t || e != e && t != t; } - (re && Pe(new re(new ArrayBuffer(1))) != z || se && Pe(new se()) != h || oe && Pe(oe.resolve()) != m || ae && Pe(new ae()) != p || ue && Pe(new ue()) != g) && (Pe = function (e) { + (re && Pe(new re(new ArrayBuffer(1))) != z || se && Pe(new se()) != c || oe && Pe(oe.resolve()) != m || ae && Pe(new ae()) != p || ue && Pe(new ue()) != g) && (Pe = function (e) { var t = Ie(e), i = t == f ? e.constructor : void 0, n = i ? Te(i) : ""; if (n) switch (n) { - case he: + case ce: return z; case le: - return h; + return c; case fe: return m; case me: @@ -520,7 +520,7 @@ var z = function z(e, t, i) { function He(e) { if (!Be(e)) return !1; var t = Ie(e); - return t == c || "[object GeneratorFunction]" == t || "[object AsyncFunction]" == t || "[object Proxy]" == t; + return t == h || "[object GeneratorFunction]" == t || "[object AsyncFunction]" == t || "[object Proxy]" == t; } function Ye(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= n; @@ -564,13 +564,13 @@ function x(e) { a = t(void 0); a.current = o; var u = e.round || Math.round, - c = t(), - h = i({ + h = t(), + c = i({ width: void 0, height: void 0 }), - l = h[0], - f = h[1], + l = c[0], + f = c[1], m = t(!1); n(function () { return m.current = !1, function () { @@ -607,7 +607,7 @@ function x(e) { a.current = e, u(); }, [u]); }(r(function (t) { - return c.current && c.current.box === e.box && c.current.round === u || (c.current = { + return h.current && h.current.box === e.box && h.current.round === u || (h.current = { box: e.box, round: u, instance: new ResizeObserver(function (t) { @@ -616,19 +616,19 @@ function x(e) { r = I(i, n, "inlineSize"), s = I(i, n, "blockSize"), o = r ? u(r) : void 0, - c = s ? u(s) : void 0; - if (d.current.width !== o || d.current.height !== c) { - var h = { + h = s ? u(s) : void 0; + if (d.current.width !== o || d.current.height !== h) { + var c = { width: o, - height: c + height: h }; - d.current.width = o, d.current.height = c, a.current ? a.current(h) : m.current || f(h); + d.current.width = o, d.current.height = h, a.current ? a.current(c) : m.current || f(c); } }) - }), c.current.instance.observe(t, { + }), h.current.instance.observe(t, { box: e.box }), function () { - c.current && c.current.instance.unobserve(t); + h.current && h.current.instance.unobserve(t); }; }, [e.box, u]), e.ref); return s(function () { @@ -711,45 +711,45 @@ var H = {}; var a = i ? i + e : e; if (!this._events[a]) return !1; var u, - c, - h = this._events[a], + h, + c = this._events[a], l = arguments.length; - if (h.fn) { - switch (h.once && this.removeListener(e, h.fn, void 0, !0), l) { + if (c.fn) { + switch (c.once && this.removeListener(e, c.fn, void 0, !0), l) { case 1: - return h.fn.call(h.context), !0; + return c.fn.call(c.context), !0; case 2: - return h.fn.call(h.context, t), !0; + return c.fn.call(c.context, t), !0; case 3: - return h.fn.call(h.context, t, n), !0; + return c.fn.call(c.context, t, n), !0; case 4: - return h.fn.call(h.context, t, n, r), !0; + return c.fn.call(c.context, t, n, r), !0; case 5: - return h.fn.call(h.context, t, n, r, s), !0; + return c.fn.call(c.context, t, n, r, s), !0; case 6: - return h.fn.call(h.context, t, n, r, s, o), !0; + return c.fn.call(c.context, t, n, r, s, o), !0; } - for (c = 1, u = new Array(l - 1); c < l; c++) u[c - 1] = arguments[c]; - h.fn.apply(h.context, u); + for (h = 1, u = new Array(l - 1); h < l; h++) u[h - 1] = arguments[h]; + c.fn.apply(c.context, u); } else { var f, - m = h.length; - for (c = 0; c < m; c++) switch (h[c].once && this.removeListener(e, h[c].fn, void 0, !0), l) { + m = c.length; + for (h = 0; h < m; h++) switch (c[h].once && this.removeListener(e, c[h].fn, void 0, !0), l) { case 1: - h[c].fn.call(h[c].context); + c[h].fn.call(c[h].context); break; case 2: - h[c].fn.call(h[c].context, t); + c[h].fn.call(c[h].context, t); break; case 3: - h[c].fn.call(h[c].context, t, n); + c[h].fn.call(c[h].context, t, n); break; case 4: - h[c].fn.call(h[c].context, t, n, r); + c[h].fn.call(c[h].context, t, n, r); break; default: if (!u) for (f = 1, u = new Array(l - 1); f < l; f++) u[f - 1] = arguments[f]; - h[c].fn.apply(h[c].context, u); + c[h].fn.apply(c[h].context, u); } } return !0; @@ -763,8 +763,8 @@ var H = {}; if (!t) return o(this, s), this; var a = this._events[s]; if (a.fn) a.fn !== t || r && !a.once || n && a.context !== n || o(this, s);else { - for (var u = 0, c = [], h = a.length; u < h; u++) (a[u].fn !== t || r && !a[u].once || n && a[u].context !== n) && c.push(a[u]); - c.length ? this._events[s] = 1 === c.length ? c[0] : c : o(this, s); + for (var u = 0, h = [], c = a.length; u < c; u++) (a[u].fn !== t || r && !a[u].once || n && a[u].context !== n) && h.push(a[u]); + h.length ? this._events[s] = 1 === h.length ? h[0] : h : o(this, s); } return this; }, a.prototype.removeAllListeners = function (e) { @@ -835,29 +835,29 @@ var se = function se(e, t, i) { o, a, u, - c = 0, - h = !1, + h = 0, + c = !1, l = !1, f = !0; if ("function" != typeof e) throw new TypeError("Expected a function"); function m(t) { var i = n, s = r; - return n = r = void 0, c = t, o = e.apply(s, i); + return n = r = void 0, h = t, o = e.apply(s, i); } function d(e) { - return c = e, a = setTimeout(v, t), h ? m(e) : o; + return h = e, a = setTimeout(v, t), c ? m(e) : o; } function p(e) { var i = e - u; - return void 0 === u || i >= t || i < 0 || l && e - c >= s; + return void 0 === u || i >= t || i < 0 || l && e - h >= s; } function v() { var e = ie(); if (p(e)) return y(e); a = setTimeout(v, function (e) { var i = t - (e - u); - return l ? te(i, s - (e - c)) : i; + return l ? te(i, s - (e - h)) : i; }(e)); } function y(e) { @@ -872,8 +872,8 @@ var se = function se(e, t, i) { } return void 0 === a && (a = setTimeout(v, t)), o; } - return t = re(t) || 0, ne(i) && (h = !!i.leading, s = (l = "maxWait" in i) ? ee(re(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f), g.cancel = function () { - void 0 !== a && clearTimeout(a), c = 0, n = u = r = a = void 0; + return t = re(t) || 0, ne(i) && (c = !!i.leading, s = (l = "maxWait" in i) ? ee(re(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f), g.cancel = function () { + void 0 !== a && clearTimeout(a), h = 0, n = u = r = a = void 0; }, g.flush = function () { return void 0 === a ? o : y(ie()); }, g; @@ -881,8 +881,8 @@ var se = function se(e, t, i) { oe = "sash-module_sash__K-9lB", ae = "sash-module_disabled__Hm-wx", ue = "sash-module_mac__Jf6OJ", - ce = "sash-module_vertical__pB-rs", - he = "sash-module_minimum__-UKxp", + he = "sash-module_vertical__pB-rs", + ce = "sash-module_minimum__-UKxp", le = "sash-module_maximum__TCWxD", fe = "sash-module_horizontal__kFbiw", me = "sash-module_hover__80W6I", @@ -900,7 +900,7 @@ class be extends H { return this._state; } set state(e) { - this._state !== e && (this.el.classList.toggle(ae, e === ve.Disabled), this.el.classList.toggle("sash-disabled", e === ve.Disabled), this.el.classList.toggle(he, e === ve.Minimum), this.el.classList.toggle("sash-minimum", e === ve.Minimum), this.el.classList.toggle(le, e === ve.Maximum), this.el.classList.toggle("sash-maximum", e === ve.Maximum), this._state = e, this.emit("enablementChange", e)); + this._state !== e && (this.el.classList.toggle(ae, e === ve.Disabled), this.el.classList.toggle("sash-disabled", e === ve.Disabled), this.el.classList.toggle(ce, e === ve.Minimum), this.el.classList.toggle("sash-minimum", e === ve.Minimum), this.el.classList.toggle(le, e === ve.Maximum), this.el.classList.toggle("sash-maximum", e === ve.Maximum), this._state = e, this.emit("enablementChange", e)); } constructor(e, t, i) { var _i$orientation; @@ -936,7 +936,7 @@ class be extends H { this.hoverDelayer.cancel(), this.el.classList.remove("sash-hover", me); }, this.el = document.createElement("div"), this.el.classList.add("sash", oe), this.el.dataset.testid = "sash", e.append(this.el), C && this.el.classList.add("sash-mac", ue), this.el.addEventListener("pointerdown", this.onPointerStart), this.el.addEventListener("dblclick", this.onPointerDoublePress), this.el.addEventListener("mouseenter", this.onMouseEnter), this.el.addEventListener("mouseleave", this.onMouseLeave), "number" == typeof i.size ? (this.size = i.size, i.orientation === pe.Vertical ? this.el.style.width = `${this.size}px` : this.el.style.height = `${this.size}px`) : (this.size = ye, ge.on("onDidChangeGlobalSize", e => { this.size = e, this.layout(); - })), this.layoutProvider = t, this.orientation = (_i$orientation = i.orientation) != null ? _i$orientation : pe.Vertical, this.orientation === pe.Horizontal ? (this.el.classList.add("sash-horizontal", fe), this.el.classList.remove("sash-vertical", ce)) : (this.el.classList.remove("sash-horizontal", fe), this.el.classList.add("sash-vertical", ce)), this.layout(); + })), this.layoutProvider = t, this.orientation = (_i$orientation = i.orientation) != null ? _i$orientation : pe.Vertical, this.orientation === pe.Horizontal ? (this.el.classList.add("sash-horizontal", fe), this.el.classList.remove("sash-vertical", he)) : (this.el.classList.remove("sash-horizontal", fe), this.el.classList.add("sash-vertical", he)), this.layout(); } layout() { if (this.orientation === pe.Vertical) { @@ -1194,11 +1194,11 @@ class Ee extends H { o = Number.POSITIVE_INFINITY; const a = R(i, -1, -1), u = R(i + 1, this.viewItems.length), - c = a.reduce((e, i) => e + (this.viewItems[i].minimumSize - t[i]), 0), - h = a.reduce((e, i) => e + (this.viewItems[i].viewMaximumSize - t[i]), 0), + h = a.reduce((e, i) => e + (this.viewItems[i].minimumSize - t[i]), 0), + c = a.reduce((e, i) => e + (this.viewItems[i].viewMaximumSize - t[i]), 0), l = 0 === u.length ? Number.POSITIVE_INFINITY : u.reduce((e, i) => e + (t[i] - this.viewItems[i].minimumSize), 0), f = 0 === u.length ? Number.NEGATIVE_INFINITY : u.reduce((e, i) => e + (t[i] - this.viewItems[i].viewMaximumSize), 0); - s = Math.max(c, f), o = Math.min(l, h); + s = Math.max(h, f), o = Math.min(l, c); const m = this.findFirstSnapIndex(a), d = this.findFirstSnapIndex(u); if ("number" == typeof m) { @@ -1254,18 +1254,18 @@ class Ee extends H { } resize(e, t, i = this.viewItems.map(e => e.size), n, r, s = Number.NEGATIVE_INFINITY, o = Number.POSITIVE_INFINITY, a, u) { if (e < 0 || e >= this.viewItems.length) return 0; - const c = R(e, -1, -1), - h = R(e + 1, this.viewItems.length); - if (r) for (const _e7 of r) Y(c, _e7), Y(h, _e7); - if (n) for (const _e8 of n) B(c, _e8), B(h, _e8); - const l = c.map(e => this.viewItems[e]), - f = c.map(e => i[e]), - m = h.map(e => this.viewItems[e]), - d = h.map(e => i[e]), - p = c.reduce((e, t) => e + (this.viewItems[t].minimumSize - i[t]), 0), - v = c.reduce((e, t) => e + (this.viewItems[t].maximumSize - i[t]), 0), - y = 0 === h.length ? Number.POSITIVE_INFINITY : h.reduce((e, t) => e + (i[t] - this.viewItems[t].minimumSize), 0), - g = 0 === h.length ? Number.NEGATIVE_INFINITY : h.reduce((e, t) => e + (i[t] - this.viewItems[t].maximumSize), 0), + const h = R(e, -1, -1), + c = R(e + 1, this.viewItems.length); + if (r) for (const _e7 of r) Y(h, _e7), Y(c, _e7); + if (n) for (const _e8 of n) B(h, _e8), B(c, _e8); + const l = h.map(e => this.viewItems[e]), + f = h.map(e => i[e]), + m = c.map(e => this.viewItems[e]), + d = c.map(e => i[e]), + p = h.reduce((e, t) => e + (this.viewItems[t].minimumSize - i[t]), 0), + v = h.reduce((e, t) => e + (this.viewItems[t].maximumSize - i[t]), 0), + y = 0 === c.length ? Number.POSITIVE_INFINITY : c.reduce((e, t) => e + (i[t] - this.viewItems[t].minimumSize), 0), + g = 0 === c.length ? Number.NEGATIVE_INFINITY : c.reduce((e, t) => e + (i[t] - this.viewItems[t].maximumSize), 0), b = Math.max(p, g, s), w = Math.min(y, v, o); let S = !1; @@ -1336,9 +1336,9 @@ class Ee extends H { _s = R(_e14 + 1, this.viewItems.length), _a = this.findFirstSnapIndex(_i8), _u = this.findFirstSnapIndex(_s), - c = "number" == typeof _a && !this.viewItems[_a].visible, - h = "number" == typeof _u && !this.viewItems[_u].visible; - c && r[_e14] && (o > 0 || this.startSnappingEnabled) ? _n4.state = ve.Minimum : h && t[_e14] && (o < this.contentSize || this.endSnappingEnabled) ? _n4.state = ve.Maximum : _n4.state = ve.Disabled; + h = "number" == typeof _a && !this.viewItems[_a].visible, + c = "number" == typeof _u && !this.viewItems[_u].visible; + h && r[_e14] && (o > 0 || this.startSnappingEnabled) ? _n4.state = ve.Minimum : c && t[_e14] && (o < this.contentSize || this.endSnappingEnabled) ? _n4.state = ve.Maximum : _n4.state = ve.Disabled; } else _n4.state = a && !u ? ve.Minimum : !a && u ? ve.Maximum : ve.Enabled; } } @@ -1425,8 +1425,8 @@ Oe.displayName = "Allotment.Pane"; const Me = a(({ children: o, className: a, - maxSize: c = 1 / 0, - minSize: h = 30, + maxSize: h = 1 / 0, + minSize: c = 30, proportionalLayout: f = !0, separator: m = !0, sizes: d, @@ -1480,8 +1480,8 @@ const Me = a(({ const i = M.current.get(N.current[t]), n = new Le(C.current, _extends({ element: document.createElement("div"), - minimumSize: (_i$minSize = i == null ? void 0 : i.minSize) != null ? _i$minSize : h, - maximumSize: (_i$maxSize = i == null ? void 0 : i.maxSize) != null ? _i$maxSize : c, + minimumSize: (_i$minSize = i == null ? void 0 : i.minSize) != null ? _i$minSize : c, + maximumSize: (_i$maxSize = i == null ? void 0 : i.maxSize) != null ? _i$maxSize : h, priority: (_i$priority = i == null ? void 0 : i.priority) != null ? _i$priority : Se.Normal }, (i == null ? void 0 : i.preferredSize) && { preferredSize: i == null ? void 0 : i.preferredSize @@ -1538,8 +1538,8 @@ const Me = a(({ const _i9 = M.current.get(_n5), _r2 = new Le(C.current, _extends({ element: document.createElement("div"), - minimumSize: (_i9$minSize = _i9 == null ? void 0 : _i9.minSize) != null ? _i9$minSize : h, - maximumSize: (_i9$maxSize = _i9 == null ? void 0 : _i9.maxSize) != null ? _i9$maxSize : c, + minimumSize: (_i9$minSize = _i9 == null ? void 0 : _i9.minSize) != null ? _i9$minSize : c, + maximumSize: (_i9$maxSize = _i9 == null ? void 0 : _i9.maxSize) != null ? _i9$maxSize : h, priority: (_i9$priority = _i9 == null ? void 0 : _i9.priority) != null ? _i9$priority : Se.Normal }, (_i9 == null ? void 0 : _i9.preferredSize) && { preferredSize: _i9 == null ? void 0 : _i9.preferredSize @@ -1582,7 +1582,7 @@ const Me = a(({ } (i.length > 0 || r.length > 0) && (N.current = e); } - }, [B, H, c, h, v]), n(() => { + }, [B, H, h, c, v]), n(() => { P.current && (P.current.onDidChange = g); }, [g]), n(() => { P.current && (P.current.onDidDragStart = w); @@ -1595,18 +1595,11 @@ const Me = a(({ height: t }) => { var _P$current12; - e && t && ((_P$current12 = P.current) != null && _P$current12.layout(y ? t : e), C.current.setSize(y ? t : e), Y(!0)); + e && t && ((_P$current12 = P.current) != null && _P$current12.layout(y ? t : e), C.current.setSize(y ? t : e)); } }), F(() => { - if (!H) { - var _P$current13; - const { - height: e, - width: t - } = V.current.getBoundingClientRect(); - (_P$current13 = P.current) != null && _P$current13.layout(y ? e : t), C.current.setSize(y ? e : t), Y(!0); - } - }, [H, y]), n(() => { + Y(!0); + }, []), n(() => { T && Pe(20); }, []), e.createElement("div", { ref: V, diff --git a/dist/module.js b/dist/module.js index 2350eaa7..66031690 100644 --- a/dist/module.js +++ b/dist/module.js @@ -1,18 +1,18 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import e, { useRef as t, useState as i, useEffect as n, useCallback as r, useMemo as s, useLayoutEffect as o, forwardRef as a, useImperativeHandle as u } from "react"; -var c, - h = {}; +var h, + c = {}; /*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ -c = { +h = { get exports() { - return h; + return c; }, set exports(e) { - h = e; + c = e; } }, function () { var e = {}.hasOwnProperty; @@ -33,9 +33,9 @@ c = { } return i.join(" "); } - c.exports ? (t.default = t, c.exports = t) : window.classNames = t; + h.exports ? (t.default = t, h.exports = t) : window.classNames = t; }(); -var l = h, +var l = c, f = /^\s+|\s+$/g, m = /^[-+]0x[0-9a-f]+$/i, d = /^0b[01]+$/i, @@ -77,8 +77,8 @@ var z = function z(e, t, i) { o = "[object Boolean]", a = "[object Date]", u = "[object Error]", - c = "[object Function]", - h = "[object Map]", + h = "[object Function]", + c = "[object Map]", l = "[object Number]", f = "[object Object]", m = "[object Promise]", @@ -92,7 +92,7 @@ var z = function z(e, t, i) { S = /^\[object .+?Constructor\]$/, _ = /^(?:0|[1-9]\d*)$/, I = {}; - I["[object Float32Array]"] = I["[object Float64Array]"] = I["[object Int8Array]"] = I["[object Int16Array]"] = I["[object Int32Array]"] = I["[object Uint8Array]"] = I["[object Uint8ClampedArray]"] = I["[object Uint16Array]"] = I["[object Uint32Array]"] = !0, I[r] = I[s] = I[b] = I[o] = I[z] = I[a] = I[u] = I[c] = I[h] = I[l] = I[f] = I[d] = I[p] = I[v] = I[g] = !1; + I["[object Float32Array]"] = I["[object Float64Array]"] = I["[object Int8Array]"] = I["[object Int16Array]"] = I["[object Int32Array]"] = I["[object Uint8Array]"] = I["[object Uint8ClampedArray]"] = I["[object Uint16Array]"] = I["[object Uint32Array]"] = !0, I[r] = I[s] = I[b] = I[o] = I[z] = I[a] = I[u] = I[h] = I[c] = I[l] = I[f] = I[d] = I[p] = I[v] = I[g] = !1; var x = "object" == typeof w && w && w.Object === Object && w, E = "object" == typeof self && self && self.Object === Object && self, V = x || E || Function("return this")(), @@ -154,8 +154,8 @@ var z = function z(e, t, i) { oe = Oe(V, "Promise"), ae = Oe(V, "Set"), ue = Oe(V, "WeakMap"), - ce = Oe(Object, "create"), - he = Te(re), + he = Oe(Object, "create"), + ce = Te(re), le = Te(se), fe = Te(oe), me = Te(ae), @@ -210,8 +210,8 @@ var z = function z(e, t, i) { return n; }(e.length, String) : [], u = a.length; - for (var c in e) { - !t && !W.call(e, c) || o && ("length" == c || r && ("offset" == c || "parent" == c) || s && ("buffer" == c || "byteLength" == c || "byteOffset" == c) || Ae(c, u)) || a.push(c); + for (var h in e) { + !t && !W.call(e, h) || o && ("length" == h || r && ("offset" == h || "parent" == h) || s && ("buffer" == h || "byteLength" == h || "byteOffset" == h) || Ae(h, u)) || a.push(h); } return a; } @@ -239,8 +239,8 @@ var z = function z(e, t, i) { function xe(e) { return Re(e) && Ie(e) == r; } - function Ee(e, t, i, n, c) { - return e === t || (null == e || null == t || !Re(e) && !Re(t) ? e != e && t != t : function (e, t, i, n, c, m) { + function Ee(e, t, i, n, h) { + return e === t || (null == e || null == t || !Re(e) && !Re(t) ? e != e && t != t : function (e, t, i, n, h, m) { var g = ke(e), w = ke(t), S = g ? s : Pe(e), @@ -252,7 +252,7 @@ var z = function z(e, t, i) { if (!$e(t)) return !1; g = !0, I = !1; } - if (E && !I) return m || (m = new we()), g || We(e) ? Ne(e, t, i, n, c, m) : function (e, t, i, n, r, s, c) { + if (E && !I) return m || (m = new we()), g || We(e) ? Ne(e, t, i, n, h, m) : function (e, t, i, n, r, s, h) { switch (i) { case z: if (e.byteLength != t.byteLength || e.byteOffset != t.byteOffset) return !1; @@ -268,28 +268,28 @@ var z = function z(e, t, i) { case d: case v: return e == t + ""; - case h: + case c: var f = A; case p: var m = 1 & n; if (f || (f = T), e.size != t.size && !m) return !1; - var g = c.get(e); + var g = h.get(e); if (g) return g == t; - n |= 2, c.set(e, t); - var w = Ne(f(e), f(t), n, r, s, c); - return c.delete(e), w; + n |= 2, h.set(e, t); + var w = Ne(f(e), f(t), n, r, s, h); + return h.delete(e), w; case y: if (ve) return ve.call(e) == ve.call(t); } return !1; - }(e, t, S, i, n, c, m); + }(e, t, S, i, n, h, m); if (!(1 & i)) { var V = I && W.call(e, "__wrapped__"), j = x && W.call(t, "__wrapped__"); if (V || j) { var N = V ? e.value() : e, L = j ? t.value() : t; - return m || (m = new we()), c(N, L, i, n, m); + return m || (m = new we()), h(N, L, i, n, m); } } if (!E) return !1; @@ -297,11 +297,11 @@ var z = function z(e, t, i) { var o = 1 & i, a = Le(e), u = a.length, - c = Le(t).length; - if (u != c && !o) return !1; - var h = u; - for (; h--;) { - var l = a[h]; + h = Le(t).length; + if (u != h && !o) return !1; + var c = u; + for (; c--;) { + var l = a[c]; if (!(o ? l in t : W.call(t, l))) return !1; } var f = s.get(e); @@ -309,8 +309,8 @@ var z = function z(e, t, i) { var m = !0; s.set(e, t), s.set(t, e); var d = o; - for (; ++h < u;) { - var p = e[l = a[h]], + for (; ++c < u;) { + var p = e[l = a[c]], v = t[l]; if (n) var y = o ? n(v, p, l, t, e, s) : n(p, v, l, e, t, s); if (!(void 0 === y ? p === v || r(p, v, i, n, s) : y)) { @@ -325,8 +325,8 @@ var z = function z(e, t, i) { g == b || !("constructor" in e) || !("constructor" in t) || "function" == typeof g && g instanceof g && "function" == typeof b && b instanceof b || (m = !1); } return s.delete(e), s.delete(t), m; - }(e, t, i, n, c, m); - }(e, t, i, n, Ee, c)); + }(e, t, i, n, h, m); + }(e, t, i, n, Ee, h)); } function Ve(e) { return !(!Be(e) || function (e) { @@ -349,15 +349,15 @@ var z = function z(e, t, i) { a = e.length, u = t.length; if (a != u && !(o && u > a)) return !1; - var c = s.get(e); - if (c && s.get(t)) return c == t; - var h = -1, + var h = s.get(e); + if (h && s.get(t)) return h == t; + var c = -1, l = !0, f = 2 & i ? new ze() : void 0; - for (s.set(e, t), s.set(t, e); ++h < a;) { - var m = e[h], - d = t[h]; - if (n) var p = o ? n(d, m, h, t, e, s) : n(m, d, h, e, t, s); + for (s.set(e, t), s.set(t, e); ++c < a;) { + var m = e[c], + d = t[c]; + if (n) var p = o ? n(d, m, c, t, e, s) : n(m, d, c, e, t, s); if (void 0 !== p) { if (p) continue; l = !1; @@ -402,23 +402,23 @@ var z = function z(e, t, i) { return Ve(i) ? i : void 0; } ye.prototype.clear = function () { - this.__data__ = ce ? ce(null) : {}, this.size = 0; + this.__data__ = he ? he(null) : {}, this.size = 0; }, ye.prototype.delete = function (e) { var t = this.has(e) && delete this.__data__[e]; return this.size -= t ? 1 : 0, t; }, ye.prototype.get = function (e) { var t = this.__data__; - if (ce) { + if (he) { var n = t[e]; return n === i ? void 0 : n; } return W.call(t, e) ? t[e] : void 0; }, ye.prototype.has = function (e) { var t = this.__data__; - return ce ? void 0 !== t[e] : W.call(t, e); + return he ? void 0 !== t[e] : W.call(t, e); }, ye.prototype.set = function (e, t) { var n = this.__data__; - return this.size += this.has(e) ? 0 : 1, n[e] = ce && void 0 === t ? i : t, this; + return this.size += this.has(e) ? 0 : 1, n[e] = he && void 0 === t ? i : t, this; }, ge.prototype.clear = function () { this.__data__ = [], this.size = 0; }, ge.prototype.delete = function (e) { @@ -506,15 +506,15 @@ var z = function z(e, t, i) { function Ce(e, t) { return e === t || e != e && t != t; } - (re && Pe(new re(new ArrayBuffer(1))) != z || se && Pe(new se()) != h || oe && Pe(oe.resolve()) != m || ae && Pe(new ae()) != p || ue && Pe(new ue()) != g) && (Pe = function Pe(e) { + (re && Pe(new re(new ArrayBuffer(1))) != z || se && Pe(new se()) != c || oe && Pe(oe.resolve()) != m || ae && Pe(new ae()) != p || ue && Pe(new ue()) != g) && (Pe = function Pe(e) { var t = Ie(e), i = t == f ? e.constructor : void 0, n = i ? Te(i) : ""; if (n) switch (n) { - case he: + case ce: return z; case le: - return h; + return c; case fe: return m; case me: @@ -536,7 +536,7 @@ var z = function z(e, t, i) { function He(e) { if (!Be(e)) return !1; var t = Ie(e); - return t == c || "[object GeneratorFunction]" == t || "[object AsyncFunction]" == t || "[object Proxy]" == t; + return t == h || "[object GeneratorFunction]" == t || "[object AsyncFunction]" == t || "[object Proxy]" == t; } function Ye(e) { return "number" == typeof e && e > -1 && e % 1 == 0 && e <= n; @@ -580,13 +580,13 @@ function x(e) { a = t(void 0); a.current = o; var u = e.round || Math.round, - c = t(), - h = i({ + h = t(), + c = i({ width: void 0, height: void 0 }), - l = h[0], - f = h[1], + l = c[0], + f = c[1], m = t(!1); n(function () { return m.current = !1, function () { @@ -623,7 +623,7 @@ function x(e) { a.current = e, u(); }, [u]); }(r(function (t) { - return c.current && c.current.box === e.box && c.current.round === u || (c.current = { + return h.current && h.current.box === e.box && h.current.round === u || (h.current = { box: e.box, round: u, instance: new ResizeObserver(function (t) { @@ -632,19 +632,19 @@ function x(e) { r = I(i, n, "inlineSize"), s = I(i, n, "blockSize"), o = r ? u(r) : void 0, - c = s ? u(s) : void 0; - if (d.current.width !== o || d.current.height !== c) { - var h = { + h = s ? u(s) : void 0; + if (d.current.width !== o || d.current.height !== h) { + var c = { width: o, - height: c + height: h }; - d.current.width = o, d.current.height = c, a.current ? a.current(h) : m.current || f(h); + d.current.width = o, d.current.height = h, a.current ? a.current(c) : m.current || f(c); } }) - }), c.current.instance.observe(t, { + }), h.current.instance.observe(t, { box: e.box }), function () { - c.current && c.current.instance.unobserve(t); + h.current && h.current.instance.unobserve(t); }; }, [e.box, u]), e.ref); return s(function () { @@ -731,50 +731,50 @@ var H = {}; var a = i ? i + e : e; if (!this._events[a]) return !1; var u, - c, - h = this._events[a], + h, + c = this._events[a], l = arguments.length; - if (h.fn) { - switch (h.once && this.removeListener(e, h.fn, void 0, !0), l) { + if (c.fn) { + switch (c.once && this.removeListener(e, c.fn, void 0, !0), l) { case 1: - return h.fn.call(h.context), !0; + return c.fn.call(c.context), !0; case 2: - return h.fn.call(h.context, t), !0; + return c.fn.call(c.context, t), !0; case 3: - return h.fn.call(h.context, t, n), !0; + return c.fn.call(c.context, t, n), !0; case 4: - return h.fn.call(h.context, t, n, r), !0; + return c.fn.call(c.context, t, n, r), !0; case 5: - return h.fn.call(h.context, t, n, r, s), !0; + return c.fn.call(c.context, t, n, r, s), !0; case 6: - return h.fn.call(h.context, t, n, r, s, o), !0; + return c.fn.call(c.context, t, n, r, s, o), !0; } - for (c = 1, u = new Array(l - 1); c < l; c++) { - u[c - 1] = arguments[c]; + for (h = 1, u = new Array(l - 1); h < l; h++) { + u[h - 1] = arguments[h]; } - h.fn.apply(h.context, u); + c.fn.apply(c.context, u); } else { var f, - m = h.length; - for (c = 0; c < m; c++) { - switch (h[c].once && this.removeListener(e, h[c].fn, void 0, !0), l) { + m = c.length; + for (h = 0; h < m; h++) { + switch (c[h].once && this.removeListener(e, c[h].fn, void 0, !0), l) { case 1: - h[c].fn.call(h[c].context); + c[h].fn.call(c[h].context); break; case 2: - h[c].fn.call(h[c].context, t); + c[h].fn.call(c[h].context, t); break; case 3: - h[c].fn.call(h[c].context, t, n); + c[h].fn.call(c[h].context, t, n); break; case 4: - h[c].fn.call(h[c].context, t, n, r); + c[h].fn.call(c[h].context, t, n, r); break; default: if (!u) for (f = 1, u = new Array(l - 1); f < l; f++) { u[f - 1] = arguments[f]; } - h[c].fn.apply(h[c].context, u); + c[h].fn.apply(c[h].context, u); } } } @@ -789,10 +789,10 @@ var H = {}; if (!t) return o(this, s), this; var a = this._events[s]; if (a.fn) a.fn !== t || r && !a.once || n && a.context !== n || o(this, s);else { - for (var u = 0, c = [], h = a.length; u < h; u++) { - (a[u].fn !== t || r && !a[u].once || n && a[u].context !== n) && c.push(a[u]); + for (var u = 0, h = [], c = a.length; u < c; u++) { + (a[u].fn !== t || r && !a[u].once || n && a[u].context !== n) && h.push(a[u]); } - c.length ? this._events[s] = 1 === c.length ? c[0] : c : o(this, s); + h.length ? this._events[s] = 1 === h.length ? h[0] : h : o(this, s); } return this; }, a.prototype.removeAllListeners = function (e) { @@ -868,29 +868,29 @@ var se = function se(e, t, i) { o, a, u, - c = 0, - h = !1, + h = 0, + c = !1, l = !1, f = !0; if ("function" != typeof e) throw new TypeError("Expected a function"); function m(t) { var i = n, s = r; - return n = r = void 0, c = t, o = e.apply(s, i); + return n = r = void 0, h = t, o = e.apply(s, i); } function d(e) { - return c = e, a = setTimeout(v, t), h ? m(e) : o; + return h = e, a = setTimeout(v, t), c ? m(e) : o; } function p(e) { var i = e - u; - return void 0 === u || i >= t || i < 0 || l && e - c >= s; + return void 0 === u || i >= t || i < 0 || l && e - h >= s; } function v() { var e = ie(); if (p(e)) return y(e); a = setTimeout(v, function (e) { var i = t - (e - u); - return l ? te(i, s - (e - c)) : i; + return l ? te(i, s - (e - h)) : i; }(e)); } function y(e) { @@ -905,8 +905,8 @@ var se = function se(e, t, i) { } return void 0 === a && (a = setTimeout(v, t)), o; } - return t = re(t) || 0, ne(i) && (h = !!i.leading, s = (l = "maxWait" in i) ? ee(re(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f), g.cancel = function () { - void 0 !== a && clearTimeout(a), c = 0, n = u = r = a = void 0; + return t = re(t) || 0, ne(i) && (c = !!i.leading, s = (l = "maxWait" in i) ? ee(re(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f), g.cancel = function () { + void 0 !== a && clearTimeout(a), h = 0, n = u = r = a = void 0; }, g.flush = function () { return void 0 === a ? o : y(ie()); }, g; @@ -914,8 +914,8 @@ var se = function se(e, t, i) { oe = "sash-module_sash__K-9lB", ae = "sash-module_disabled__Hm-wx", ue = "sash-module_mac__Jf6OJ", - ce = "sash-module_vertical__pB-rs", - he = "sash-module_minimum__-UKxp", + he = "sash-module_vertical__pB-rs", + ce = "sash-module_minimum__-UKxp", le = "sash-module_maximum__TCWxD", fe = "sash-module_horizontal__kFbiw", me = "sash-module_hover__80W6I", @@ -933,7 +933,7 @@ class be extends H { return this._state; } set state(e) { - this._state !== e && (this.el.classList.toggle(ae, e === ve.Disabled), this.el.classList.toggle("sash-disabled", e === ve.Disabled), this.el.classList.toggle(he, e === ve.Minimum), this.el.classList.toggle("sash-minimum", e === ve.Minimum), this.el.classList.toggle(le, e === ve.Maximum), this.el.classList.toggle("sash-maximum", e === ve.Maximum), this._state = e, this.emit("enablementChange", e)); + this._state !== e && (this.el.classList.toggle(ae, e === ve.Disabled), this.el.classList.toggle("sash-disabled", e === ve.Disabled), this.el.classList.toggle(ce, e === ve.Minimum), this.el.classList.toggle("sash-minimum", e === ve.Minimum), this.el.classList.toggle(le, e === ve.Maximum), this.el.classList.toggle("sash-maximum", e === ve.Maximum), this._state = e, this.emit("enablementChange", e)); } constructor(e, t, i) { var _i$orientation; @@ -969,7 +969,7 @@ class be extends H { this.hoverDelayer.cancel(), this.el.classList.remove("sash-hover", me); }, this.el = document.createElement("div"), this.el.classList.add("sash", oe), this.el.dataset.testid = "sash", e.append(this.el), C && this.el.classList.add("sash-mac", ue), this.el.addEventListener("pointerdown", this.onPointerStart), this.el.addEventListener("dblclick", this.onPointerDoublePress), this.el.addEventListener("mouseenter", this.onMouseEnter), this.el.addEventListener("mouseleave", this.onMouseLeave), "number" == typeof i.size ? (this.size = i.size, i.orientation === pe.Vertical ? this.el.style.width = this.size + "px" : this.el.style.height = this.size + "px") : (this.size = ye, ge.on("onDidChangeGlobalSize", e => { this.size = e, this.layout(); - })), this.layoutProvider = t, this.orientation = (_i$orientation = i.orientation) != null ? _i$orientation : pe.Vertical, this.orientation === pe.Horizontal ? (this.el.classList.add("sash-horizontal", fe), this.el.classList.remove("sash-vertical", ce)) : (this.el.classList.remove("sash-horizontal", fe), this.el.classList.add("sash-vertical", ce)), this.layout(); + })), this.layoutProvider = t, this.orientation = (_i$orientation = i.orientation) != null ? _i$orientation : pe.Vertical, this.orientation === pe.Horizontal ? (this.el.classList.add("sash-horizontal", fe), this.el.classList.remove("sash-vertical", he)) : (this.el.classList.remove("sash-horizontal", fe), this.el.classList.add("sash-vertical", he)), this.layout(); } layout() { if (this.orientation === pe.Vertical) { @@ -1243,11 +1243,11 @@ class Ee extends H { o = Number.POSITIVE_INFINITY; var a = R(i, -1, -1), u = R(i + 1, this.viewItems.length), - c = a.reduce((e, i) => e + (this.viewItems[i].minimumSize - t[i]), 0), - h = a.reduce((e, i) => e + (this.viewItems[i].viewMaximumSize - t[i]), 0), + h = a.reduce((e, i) => e + (this.viewItems[i].minimumSize - t[i]), 0), + c = a.reduce((e, i) => e + (this.viewItems[i].viewMaximumSize - t[i]), 0), l = 0 === u.length ? Number.POSITIVE_INFINITY : u.reduce((e, i) => e + (t[i] - this.viewItems[i].minimumSize), 0), f = 0 === u.length ? Number.NEGATIVE_INFINITY : u.reduce((e, i) => e + (t[i] - this.viewItems[i].viewMaximumSize), 0); - s = Math.max(c, f), o = Math.min(l, h); + s = Math.max(h, f), o = Math.min(l, c); var m = this.findFirstSnapIndex(a), d = this.findFirstSnapIndex(u); if ("number" == typeof m) { @@ -1315,22 +1315,22 @@ class Ee extends H { o = Number.POSITIVE_INFINITY; } if (e < 0 || e >= this.viewItems.length) return 0; - var c = R(e, -1, -1), - h = R(e + 1, this.viewItems.length); + var h = R(e, -1, -1), + c = R(e + 1, this.viewItems.length); if (r) for (var _e9 of r) { - Y(c, _e9), Y(h, _e9); + Y(h, _e9), Y(c, _e9); } if (n) for (var _e10 of n) { - B(c, _e10), B(h, _e10); + B(h, _e10), B(c, _e10); } - var l = c.map(e => this.viewItems[e]), - f = c.map(e => i[e]), - m = h.map(e => this.viewItems[e]), - d = h.map(e => i[e]), - p = c.reduce((e, t) => e + (this.viewItems[t].minimumSize - i[t]), 0), - v = c.reduce((e, t) => e + (this.viewItems[t].maximumSize - i[t]), 0), - y = 0 === h.length ? Number.POSITIVE_INFINITY : h.reduce((e, t) => e + (i[t] - this.viewItems[t].minimumSize), 0), - g = 0 === h.length ? Number.NEGATIVE_INFINITY : h.reduce((e, t) => e + (i[t] - this.viewItems[t].maximumSize), 0), + var l = h.map(e => this.viewItems[e]), + f = h.map(e => i[e]), + m = c.map(e => this.viewItems[e]), + d = c.map(e => i[e]), + p = h.reduce((e, t) => e + (this.viewItems[t].minimumSize - i[t]), 0), + v = h.reduce((e, t) => e + (this.viewItems[t].maximumSize - i[t]), 0), + y = 0 === c.length ? Number.POSITIVE_INFINITY : c.reduce((e, t) => e + (i[t] - this.viewItems[t].minimumSize), 0), + g = 0 === c.length ? Number.NEGATIVE_INFINITY : c.reduce((e, t) => e + (i[t] - this.viewItems[t].maximumSize), 0), b = Math.max(p, g, s), w = Math.min(y, v, o); var S = !1; @@ -1403,9 +1403,9 @@ class Ee extends H { _s = R(_e16 + 1, this.viewItems.length), _a2 = this.findFirstSnapIndex(_i12), _u2 = this.findFirstSnapIndex(_s), - _c = "number" == typeof _a2 && !this.viewItems[_a2].visible, - _h = "number" == typeof _u2 && !this.viewItems[_u2].visible; - _c && r[_e16] && (o > 0 || this.startSnappingEnabled) ? _n6.state = ve.Minimum : _h && t[_e16] && (o < this.contentSize || this.endSnappingEnabled) ? _n6.state = ve.Maximum : _n6.state = ve.Disabled; + _h = "number" == typeof _a2 && !this.viewItems[_a2].visible, + _c = "number" == typeof _u2 && !this.viewItems[_u2].visible; + _h && r[_e16] && (o > 0 || this.startSnappingEnabled) ? _n6.state = ve.Minimum : _c && t[_e16] && (o < this.contentSize || this.endSnappingEnabled) ? _n6.state = ve.Maximum : _n6.state = ve.Disabled; } else _n6.state = _a && !_u ? ve.Minimum : !_a && _u ? ve.Maximum : ve.Enabled; } } @@ -1496,8 +1496,8 @@ var Me = a((_ref4, I) => { var { children: o, className: a, - maxSize: c = 1 / 0, - minSize: h = 30, + maxSize: h = 1 / 0, + minSize: c = 30, proportionalLayout: f = !0, separator: m = !0, sizes: d, @@ -1553,8 +1553,8 @@ var Me = a((_ref4, I) => { var i = M.current.get(N.current[t]), n = new Le(C.current, _extends({ element: document.createElement("div"), - minimumSize: (_i$minSize = i == null ? void 0 : i.minSize) != null ? _i$minSize : h, - maximumSize: (_i$maxSize = i == null ? void 0 : i.maxSize) != null ? _i$maxSize : c, + minimumSize: (_i$minSize = i == null ? void 0 : i.minSize) != null ? _i$minSize : c, + maximumSize: (_i$maxSize = i == null ? void 0 : i.maxSize) != null ? _i$maxSize : h, priority: (_i$priority = i == null ? void 0 : i.priority) != null ? _i$priority : Se.Normal }, (i == null ? void 0 : i.preferredSize) && { preferredSize: i == null ? void 0 : i.preferredSize @@ -1611,8 +1611,8 @@ var Me = a((_ref4, I) => { var i = M.current.get(_n8), r = new Le(C.current, _extends({ element: document.createElement("div"), - minimumSize: (_i$minSize2 = i == null ? void 0 : i.minSize) != null ? _i$minSize2 : h, - maximumSize: (_i$maxSize2 = i == null ? void 0 : i.maxSize) != null ? _i$maxSize2 : c, + minimumSize: (_i$minSize2 = i == null ? void 0 : i.minSize) != null ? _i$minSize2 : c, + maximumSize: (_i$maxSize2 = i == null ? void 0 : i.maxSize) != null ? _i$maxSize2 : h, priority: (_i$priority2 = i == null ? void 0 : i.priority) != null ? _i$priority2 : Se.Normal }, (i == null ? void 0 : i.preferredSize) && { preferredSize: i == null ? void 0 : i.preferredSize @@ -1673,7 +1673,7 @@ var Me = a((_ref4, I) => { } (_i14.length > 0 || _r4.length > 0) && (N.current = _e25); } - }, [B, H, c, h, v]), n(() => { + }, [B, H, h, c, v]), n(() => { P.current && (P.current.onDidChange = g); }, [g]), n(() => { P.current && (P.current.onDidDragStart = w); @@ -1687,18 +1687,11 @@ var Me = a((_ref4, I) => { width: e, height: t } = _ref5; - e && t && ((_P$current12 = P.current) != null && _P$current12.layout(y ? t : e), C.current.setSize(y ? t : e), Y(!0)); + e && t && ((_P$current12 = P.current) != null && _P$current12.layout(y ? t : e), C.current.setSize(y ? t : e)); } }), F(() => { - if (!H) { - var _P$current13; - var { - height: _e28, - width: _t24 - } = V.current.getBoundingClientRect(); - (_P$current13 = P.current) != null && _P$current13.layout(y ? _e28 : _t24), C.current.setSize(y ? _e28 : _t24), Y(!0); - } - }, [H, y]), n(() => { + Y(!0); + }, []), n(() => { T && Pe(20); }, []), e.createElement("div", { ref: V, diff --git a/dist/types/src/allotment.d.ts.map b/dist/types/src/allotment.d.ts.map index 26966033..8e96ad49 100644 --- a/dist/types/src/allotment.d.ts.map +++ b/dist/types/src/allotment.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"allotment.d.ts","sourceRoot":"","sources":["../../../src/allotment.tsx"],"names":[],"mappings":"AAGA,OAAO,KAQN,MAAM,OAAO,CAAC;AASf,OAAO,EACL,cAAc,EAIf,MAAM,cAAc,CAAC;AAgBtB,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAAC;AAEhB;;GAEG;AACH,eAAO,MAAM,IAAI;cAlBL,MAAM,SAAS;IACzB;;;OAGG;;IAEH;;;OAGG;;IAEH,yCAAyC;;sDAsB1C,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvC,GAAG,WAAW,CAAC;AA8bhB;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,QAW3C;;;IAreC,mCAAmC;;IAEnC,8DAA8D;;IAE9D,kDAAkD;;IAElD;;;OAGG;;IAEH,yBAAyB;;IAEzB,uBAAuB;;IAEvB,wBAAwB;;IAExB,oCAAoC;;IAEpC,6BAA6B;;IAE7B,2BAA2B;;;;;QAhE3B;;;WAGG;;QAEH;;;WAGG;;QAEH,yCAAyC;;;;AAwgB3C,wBAAwD"} \ No newline at end of file +{"version":3,"file":"allotment.d.ts","sourceRoot":"","sources":["../../../src/allotment.tsx"],"names":[],"mappings":"AAGA,OAAO,KAQN,MAAM,OAAO,CAAC;AASf,OAAO,EACL,cAAc,EAIf,MAAM,cAAc,CAAC;AAgBtB,MAAM,WAAW,WAAW;IAC1B,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,yCAAyC;IACzC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,WAAW,CAAC;AAEhB;;GAEG;AACH,eAAO,MAAM,IAAI;cAlBL,MAAM,SAAS;IACzB;;;OAGG;;IAEH;;;OAGG;;IAEH,yCAAyC;;sDAsB1C,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,mCAAmC;IACnC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,8DAA8D;IAC9D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,oCAAoC;IACpC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5D,6BAA6B;IAC7B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,2BAA2B;IAC3B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACvC,GAAG,WAAW,CAAC;AAybhB;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,QAW3C;;;IAheC,mCAAmC;;IAEnC,8DAA8D;;IAE9D,kDAAkD;;IAElD;;;OAGG;;IAEH,yBAAyB;;IAEzB,uBAAuB;;IAEvB,wBAAwB;;IAExB,oCAAoC;;IAEpC,6BAA6B;;IAE7B,2BAA2B;;;;;QAhE3B;;;WAGG;;QAEH;;;WAGG;;QAEH,yCAAyC;;;;AAmgB3C,wBAAwD"} \ No newline at end of file diff --git a/src/allotment.tsx b/src/allotment.tsx index 4c5fa3f4..b95d0302 100644 --- a/src/allotment.tsx +++ b/src/allotment.tsx @@ -473,19 +473,14 @@ const Allotment = forwardRef( if (width && height) { splitViewRef.current?.layout(vertical ? height : width); layoutService.current.setSize(vertical ? height : width); - setDimensionsInitialized(true); } }, }); useIsomorphicLayoutEffect(() => { - if (!dimensionsInitialized) { - const { height, width } = containerRef.current.getBoundingClientRect(); - splitViewRef.current?.layout(vertical ? height : width); - layoutService.current.setSize(vertical ? height : width); - setDimensionsInitialized(true); - } - }, [dimensionsInitialized, vertical]); + // update state to update views in #(line 313). + setDimensionsInitialized(true); + }, []); useEffect(() => { if (isIOS) {