@window-splitter/vue 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.js +19 -0
- package/.storybook/preview.css +22 -0
- package/.storybook/preview.js +15 -0
- package/.turbo/turbo-build.log +15 -0
- package/CHANGELOG.md +28 -0
- package/dist/Panel.vue.d.ts +33 -0
- package/dist/Panel.vue.d.ts.map +1 -0
- package/dist/PanelGroup.vue.d.ts +33 -0
- package/dist/PanelGroup.vue.d.ts.map +1 -0
- package/dist/PanelResizer.vue.d.ts +22 -0
- package/dist/PanelResizer.vue.d.ts.map +1 -0
- package/dist/VueWindowSplitter.stories.d.ts +1147 -0
- package/dist/VueWindowSplitter.stories.d.ts.map +1 -0
- package/dist/VueWindowSplitter.test.d.ts +1 -0
- package/dist/VueWindowSplitter.test.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1493 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.mjs +25 -0
- package/package.json +84 -0
- package/src/Panel.vue +195 -0
- package/src/PanelGroup.vue +166 -0
- package/src/PanelResizer.vue +188 -0
- package/src/VueWindowSplitter.stories.ts +796 -0
- package/src/VueWindowSplitter.test.ts +275 -0
- package/src/__snapshots__/VueWindowSplitter.test.ts.snap +58 -0
- package/src/index.ts +6 -0
- package/tsconfig.json +21 -0
- package/vite.config.js +18 -0
- package/vitest.config.js +22 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1493 @@
|
|
|
1
|
+
import { defineComponent as ze, useId as be, inject as G, computed as N, onMounted as W, watchEffect as se, onUnmounted as De, createElementBlock as ye, openBlock as Ie, normalizeProps as Te, guardReactiveProps as Fe, renderSlot as Pe, createPropsRestProxy as ke, ref as de, provide as oe, onWatcherCleanup as je, mergeProps as Ee, unref as Ue } from "vue";
|
|
2
|
+
var We = 20, Ge = 1, J = 1e6, Xe = 1e6, Ye = -7, Je = 21, Qe = !1, ne = "[big.js] ", F = ne + "Invalid ", ue = F + "decimal places", Ze = F + "rounding mode", Be = ne + "Division by zero", b = {}, B = void 0, _e = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;
|
|
3
|
+
function Ke() {
|
|
4
|
+
function e(t) {
|
|
5
|
+
var a = this;
|
|
6
|
+
if (!(a instanceof e)) return t === B ? Ke() : new e(t);
|
|
7
|
+
if (t instanceof e)
|
|
8
|
+
a.s = t.s, a.e = t.e, a.c = t.c.slice();
|
|
9
|
+
else {
|
|
10
|
+
if (typeof t != "string") {
|
|
11
|
+
if (e.strict === !0 && typeof t != "bigint")
|
|
12
|
+
throw TypeError(F + "value");
|
|
13
|
+
t = t === 0 && 1 / t < 0 ? "-0" : String(t);
|
|
14
|
+
}
|
|
15
|
+
et(a, t);
|
|
16
|
+
}
|
|
17
|
+
a.constructor = e;
|
|
18
|
+
}
|
|
19
|
+
return e.prototype = b, e.DP = We, e.RM = Ge, e.NE = Ye, e.PE = Je, e.strict = Qe, e.roundDown = 0, e.roundHalfUp = 1, e.roundHalfEven = 2, e.roundUp = 3, e;
|
|
20
|
+
}
|
|
21
|
+
function et(e, t) {
|
|
22
|
+
var a, r, l;
|
|
23
|
+
if (!_e.test(t))
|
|
24
|
+
throw Error(F + "number");
|
|
25
|
+
for (e.s = t.charAt(0) == "-" ? (t = t.slice(1), -1) : 1, (a = t.indexOf(".")) > -1 && (t = t.replace(".", "")), (r = t.search(/e/i)) > 0 ? (a < 0 && (a = r), a += +t.slice(r + 1), t = t.substring(0, r)) : a < 0 && (a = t.length), l = t.length, r = 0; r < l && t.charAt(r) == "0"; ) ++r;
|
|
26
|
+
if (r == l)
|
|
27
|
+
e.c = [e.e = 0];
|
|
28
|
+
else {
|
|
29
|
+
for (; l > 0 && t.charAt(--l) == "0"; ) ;
|
|
30
|
+
for (e.e = a - r - 1, e.c = [], a = 0; r <= l; ) e.c[a++] = +t.charAt(r++);
|
|
31
|
+
}
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
function j(e, t, a, r) {
|
|
35
|
+
var l = e.c;
|
|
36
|
+
if (a === B && (a = e.constructor.RM), a !== 0 && a !== 1 && a !== 2 && a !== 3)
|
|
37
|
+
throw Error(Ze);
|
|
38
|
+
if (t < 1)
|
|
39
|
+
r = a === 3 && (r || !!l[0]) || t === 0 && (a === 1 && l[0] >= 5 || a === 2 && (l[0] > 5 || l[0] === 5 && (r || l[1] !== B))), l.length = 1, r ? (e.e = e.e - t + 1, l[0] = 1) : l[0] = e.e = 0;
|
|
40
|
+
else if (t < l.length) {
|
|
41
|
+
if (r = a === 1 && l[t] >= 5 || a === 2 && (l[t] > 5 || l[t] === 5 && (r || l[t + 1] !== B || l[t - 1] & 1)) || a === 3 && (r || !!l[0]), l.length = t, r) {
|
|
42
|
+
for (; ++l[--t] > 9; )
|
|
43
|
+
if (l[t] = 0, t === 0) {
|
|
44
|
+
++e.e, l.unshift(1);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (t = l.length; !l[--t]; ) l.pop();
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}
|
|
52
|
+
function Q(e, t, a) {
|
|
53
|
+
var r = e.e, l = e.c.join(""), n = l.length;
|
|
54
|
+
if (t)
|
|
55
|
+
l = l.charAt(0) + (n > 1 ? "." + l.slice(1) : "") + (r < 0 ? "e" : "e+") + r;
|
|
56
|
+
else if (r < 0) {
|
|
57
|
+
for (; ++r; ) l = "0" + l;
|
|
58
|
+
l = "0." + l;
|
|
59
|
+
} else if (r > 0)
|
|
60
|
+
if (++r > n)
|
|
61
|
+
for (r -= n; r--; ) l += "0";
|
|
62
|
+
else r < n && (l = l.slice(0, r) + "." + l.slice(r));
|
|
63
|
+
else n > 1 && (l = l.charAt(0) + "." + l.slice(1));
|
|
64
|
+
return e.s < 0 && a ? "-" + l : l;
|
|
65
|
+
}
|
|
66
|
+
b.abs = function() {
|
|
67
|
+
var e = new this.constructor(this);
|
|
68
|
+
return e.s = 1, e;
|
|
69
|
+
};
|
|
70
|
+
b.cmp = function(e) {
|
|
71
|
+
var t, a = this, r = a.c, l = (e = new a.constructor(e)).c, n = a.s, o = e.s, i = a.e, u = e.e;
|
|
72
|
+
if (!r[0] || !l[0]) return r[0] ? n : l[0] ? -o : 0;
|
|
73
|
+
if (n != o) return n;
|
|
74
|
+
if (t = n < 0, i != u) return i > u ^ t ? 1 : -1;
|
|
75
|
+
for (o = (i = r.length) < (u = l.length) ? i : u, n = -1; ++n < o; )
|
|
76
|
+
if (r[n] != l[n]) return r[n] > l[n] ^ t ? 1 : -1;
|
|
77
|
+
return i == u ? 0 : i > u ^ t ? 1 : -1;
|
|
78
|
+
};
|
|
79
|
+
b.div = function(e) {
|
|
80
|
+
var t = this, a = t.constructor, r = t.c, l = (e = new a(e)).c, n = t.s == e.s ? 1 : -1, o = a.DP;
|
|
81
|
+
if (o !== ~~o || o < 0 || o > J)
|
|
82
|
+
throw Error(ue);
|
|
83
|
+
if (!l[0])
|
|
84
|
+
throw Error(Be);
|
|
85
|
+
if (!r[0])
|
|
86
|
+
return e.s = n, e.c = [e.e = 0], e;
|
|
87
|
+
var i, u, d, c, m, s = l.slice(), f = i = l.length, g = r.length, p = r.slice(0, i), v = p.length, h = e, z = h.c = [], I = 0, C = o + (h.e = t.e - e.e) + 1;
|
|
88
|
+
for (h.s = n, n = C < 0 ? 0 : C, s.unshift(0); v++ < i; ) p.push(0);
|
|
89
|
+
do {
|
|
90
|
+
for (d = 0; d < 10; d++) {
|
|
91
|
+
if (i != (v = p.length))
|
|
92
|
+
c = i > v ? 1 : -1;
|
|
93
|
+
else
|
|
94
|
+
for (m = -1, c = 0; ++m < i; )
|
|
95
|
+
if (l[m] != p[m]) {
|
|
96
|
+
c = l[m] > p[m] ? 1 : -1;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (c < 0) {
|
|
100
|
+
for (u = v == i ? l : s; v; ) {
|
|
101
|
+
if (p[--v] < u[v]) {
|
|
102
|
+
for (m = v; m && !p[--m]; ) p[m] = 9;
|
|
103
|
+
--p[m], p[v] += 10;
|
|
104
|
+
}
|
|
105
|
+
p[v] -= u[v];
|
|
106
|
+
}
|
|
107
|
+
for (; !p[0]; ) p.shift();
|
|
108
|
+
} else
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
z[I++] = c ? d : ++d, p[0] && c ? p[v] = r[f] || 0 : p = [r[f]];
|
|
112
|
+
} while ((f++ < g || p[0] !== B) && n--);
|
|
113
|
+
return !z[0] && I != 1 && (z.shift(), h.e--, C--), I > C && j(h, C, a.RM, p[0] !== B), h;
|
|
114
|
+
};
|
|
115
|
+
b.eq = function(e) {
|
|
116
|
+
return this.cmp(e) === 0;
|
|
117
|
+
};
|
|
118
|
+
b.gt = function(e) {
|
|
119
|
+
return this.cmp(e) > 0;
|
|
120
|
+
};
|
|
121
|
+
b.gte = function(e) {
|
|
122
|
+
return this.cmp(e) > -1;
|
|
123
|
+
};
|
|
124
|
+
b.lt = function(e) {
|
|
125
|
+
return this.cmp(e) < 0;
|
|
126
|
+
};
|
|
127
|
+
b.lte = function(e) {
|
|
128
|
+
return this.cmp(e) < 1;
|
|
129
|
+
};
|
|
130
|
+
b.minus = b.sub = function(e) {
|
|
131
|
+
var t, a, r, l, n = this, o = n.constructor, i = n.s, u = (e = new o(e)).s;
|
|
132
|
+
if (i != u)
|
|
133
|
+
return e.s = -u, n.plus(e);
|
|
134
|
+
var d = n.c.slice(), c = n.e, m = e.c, s = e.e;
|
|
135
|
+
if (!d[0] || !m[0])
|
|
136
|
+
return m[0] ? e.s = -u : d[0] ? e = new o(n) : e.s = 1, e;
|
|
137
|
+
if (i = c - s) {
|
|
138
|
+
for ((l = i < 0) ? (i = -i, r = d) : (s = c, r = m), r.reverse(), u = i; u--; ) r.push(0);
|
|
139
|
+
r.reverse();
|
|
140
|
+
} else
|
|
141
|
+
for (a = ((l = d.length < m.length) ? d : m).length, i = u = 0; u < a; u++)
|
|
142
|
+
if (d[u] != m[u]) {
|
|
143
|
+
l = d[u] < m[u];
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
if (l && (r = d, d = m, m = r, e.s = -e.s), (u = (a = m.length) - (t = d.length)) > 0) for (; u--; ) d[t++] = 0;
|
|
147
|
+
for (u = t; a > i; ) {
|
|
148
|
+
if (d[--a] < m[a]) {
|
|
149
|
+
for (t = a; t && !d[--t]; ) d[t] = 9;
|
|
150
|
+
--d[t], d[a] += 10;
|
|
151
|
+
}
|
|
152
|
+
d[a] -= m[a];
|
|
153
|
+
}
|
|
154
|
+
for (; d[--u] === 0; ) d.pop();
|
|
155
|
+
for (; d[0] === 0; )
|
|
156
|
+
d.shift(), --s;
|
|
157
|
+
return d[0] || (e.s = 1, d = [s = 0]), e.c = d, e.e = s, e;
|
|
158
|
+
};
|
|
159
|
+
b.mod = function(e) {
|
|
160
|
+
var t, a = this, r = a.constructor, l = a.s, n = (e = new r(e)).s;
|
|
161
|
+
if (!e.c[0])
|
|
162
|
+
throw Error(Be);
|
|
163
|
+
return a.s = e.s = 1, t = e.cmp(a) == 1, a.s = l, e.s = n, t ? new r(a) : (l = r.DP, n = r.RM, r.DP = r.RM = 0, a = a.div(e), r.DP = l, r.RM = n, this.minus(a.times(e)));
|
|
164
|
+
};
|
|
165
|
+
b.neg = function() {
|
|
166
|
+
var e = new this.constructor(this);
|
|
167
|
+
return e.s = -e.s, e;
|
|
168
|
+
};
|
|
169
|
+
b.plus = b.add = function(e) {
|
|
170
|
+
var t, a, r, l = this, n = l.constructor;
|
|
171
|
+
if (e = new n(e), l.s != e.s)
|
|
172
|
+
return e.s = -e.s, l.minus(e);
|
|
173
|
+
var o = l.e, i = l.c, u = e.e, d = e.c;
|
|
174
|
+
if (!i[0] || !d[0])
|
|
175
|
+
return d[0] || (i[0] ? e = new n(l) : e.s = l.s), e;
|
|
176
|
+
if (i = i.slice(), t = o - u) {
|
|
177
|
+
for (t > 0 ? (u = o, r = d) : (t = -t, r = i), r.reverse(); t--; ) r.push(0);
|
|
178
|
+
r.reverse();
|
|
179
|
+
}
|
|
180
|
+
for (i.length - d.length < 0 && (r = d, d = i, i = r), t = d.length, a = 0; t; i[t] %= 10) a = (i[--t] = i[t] + d[t] + a) / 10 | 0;
|
|
181
|
+
for (a && (i.unshift(a), ++u), t = i.length; i[--t] === 0; ) i.pop();
|
|
182
|
+
return e.c = i, e.e = u, e;
|
|
183
|
+
};
|
|
184
|
+
b.pow = function(e) {
|
|
185
|
+
var t = this, a = new t.constructor("1"), r = a, l = e < 0;
|
|
186
|
+
if (e !== ~~e || e < -1e6 || e > Xe)
|
|
187
|
+
throw Error(F + "exponent");
|
|
188
|
+
for (l && (e = -e); e & 1 && (r = r.times(t)), e >>= 1, !!e; )
|
|
189
|
+
t = t.times(t);
|
|
190
|
+
return l ? a.div(r) : r;
|
|
191
|
+
};
|
|
192
|
+
b.prec = function(e, t) {
|
|
193
|
+
if (e !== ~~e || e < 1 || e > J)
|
|
194
|
+
throw Error(F + "precision");
|
|
195
|
+
return j(new this.constructor(this), e, t);
|
|
196
|
+
};
|
|
197
|
+
b.round = function(e, t) {
|
|
198
|
+
if (e === B) e = 0;
|
|
199
|
+
else if (e !== ~~e || e < -1e6 || e > J)
|
|
200
|
+
throw Error(ue);
|
|
201
|
+
return j(new this.constructor(this), e + this.e + 1, t);
|
|
202
|
+
};
|
|
203
|
+
b.sqrt = function() {
|
|
204
|
+
var e, t, a, r = this, l = r.constructor, n = r.s, o = r.e, i = new l("0.5");
|
|
205
|
+
if (!r.c[0]) return new l(r);
|
|
206
|
+
if (n < 0)
|
|
207
|
+
throw Error(ne + "No square root");
|
|
208
|
+
n = Math.sqrt(r + ""), n === 0 || n === 1 / 0 ? (t = r.c.join(""), t.length + o & 1 || (t += "0"), n = Math.sqrt(t), o = ((o + 1) / 2 | 0) - (o < 0 || o & 1), e = new l((n == 1 / 0 ? "5e" : (n = n.toExponential()).slice(0, n.indexOf("e") + 1)) + o)) : e = new l(n + ""), o = e.e + (l.DP += 4);
|
|
209
|
+
do
|
|
210
|
+
a = e, e = i.times(a.plus(r.div(a)));
|
|
211
|
+
while (a.c.slice(0, o).join("") !== e.c.slice(0, o).join(""));
|
|
212
|
+
return j(e, (l.DP -= 4) + e.e + 1, l.RM);
|
|
213
|
+
};
|
|
214
|
+
b.times = b.mul = function(e) {
|
|
215
|
+
var t, a = this, r = a.constructor, l = a.c, n = (e = new r(e)).c, o = l.length, i = n.length, u = a.e, d = e.e;
|
|
216
|
+
if (e.s = a.s == e.s ? 1 : -1, !l[0] || !n[0])
|
|
217
|
+
return e.c = [e.e = 0], e;
|
|
218
|
+
for (e.e = u + d, o < i && (t = l, l = n, n = t, d = o, o = i, i = d), t = new Array(d = o + i); d--; ) t[d] = 0;
|
|
219
|
+
for (u = i; u--; ) {
|
|
220
|
+
for (i = 0, d = o + u; d > u; )
|
|
221
|
+
i = t[d] + n[u] * l[d - u - 1] + i, t[d--] = i % 10, i = i / 10 | 0;
|
|
222
|
+
t[d] = i;
|
|
223
|
+
}
|
|
224
|
+
for (i ? ++e.e : t.shift(), u = t.length; !t[--u]; ) t.pop();
|
|
225
|
+
return e.c = t, e;
|
|
226
|
+
};
|
|
227
|
+
b.toExponential = function(e, t) {
|
|
228
|
+
var a = this, r = a.c[0];
|
|
229
|
+
if (e !== B) {
|
|
230
|
+
if (e !== ~~e || e < 0 || e > J)
|
|
231
|
+
throw Error(ue);
|
|
232
|
+
for (a = j(new a.constructor(a), ++e, t); a.c.length < e; ) a.c.push(0);
|
|
233
|
+
}
|
|
234
|
+
return Q(a, !0, !!r);
|
|
235
|
+
};
|
|
236
|
+
b.toFixed = function(e, t) {
|
|
237
|
+
var a = this, r = a.c[0];
|
|
238
|
+
if (e !== B) {
|
|
239
|
+
if (e !== ~~e || e < 0 || e > J)
|
|
240
|
+
throw Error(ue);
|
|
241
|
+
for (a = j(new a.constructor(a), e + a.e + 1, t), e = e + a.e + 1; a.c.length < e; ) a.c.push(0);
|
|
242
|
+
}
|
|
243
|
+
return Q(a, !1, !!r);
|
|
244
|
+
};
|
|
245
|
+
b[Symbol.for("nodejs.util.inspect.custom")] = b.toJSON = b.toString = function() {
|
|
246
|
+
var e = this, t = e.constructor;
|
|
247
|
+
return Q(e, e.e <= t.NE || e.e >= t.PE, !!e.c[0]);
|
|
248
|
+
};
|
|
249
|
+
b.toNumber = function() {
|
|
250
|
+
var e = Number(Q(this, !0, !0));
|
|
251
|
+
if (this.constructor.strict === !0 && !this.eq(e.toString()))
|
|
252
|
+
throw Error(ne + "Imprecise conversion");
|
|
253
|
+
return e;
|
|
254
|
+
};
|
|
255
|
+
b.toPrecision = function(e, t) {
|
|
256
|
+
var a = this, r = a.constructor, l = a.c[0];
|
|
257
|
+
if (e !== B) {
|
|
258
|
+
if (e !== ~~e || e < 1 || e > J)
|
|
259
|
+
throw Error(F + "precision");
|
|
260
|
+
for (a = j(new r(a), e, t); a.c.length < e; ) a.c.push(0);
|
|
261
|
+
}
|
|
262
|
+
return Q(a, e <= a.e || a.e <= r.NE || a.e >= r.PE, !!l);
|
|
263
|
+
};
|
|
264
|
+
b.valueOf = function() {
|
|
265
|
+
var e = this, t = e.constructor;
|
|
266
|
+
if (t.strict === !0)
|
|
267
|
+
throw Error(ne + "valueOf disallowed");
|
|
268
|
+
return Q(e, e.e <= t.NE || e.e >= t.PE, !0);
|
|
269
|
+
};
|
|
270
|
+
var y = Ke();
|
|
271
|
+
function tt(e, t) {
|
|
272
|
+
e.forEach((a) => {
|
|
273
|
+
try {
|
|
274
|
+
t(a);
|
|
275
|
+
} catch (r) {
|
|
276
|
+
console.error(r);
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
let _ = 0;
|
|
281
|
+
function nt() {
|
|
282
|
+
let e = /* @__PURE__ */ new Set(), t = e;
|
|
283
|
+
return {
|
|
284
|
+
add(a) {
|
|
285
|
+
_ += t == e && !e.has(a) ? 1 : 0, e.add(a);
|
|
286
|
+
},
|
|
287
|
+
delete(a) {
|
|
288
|
+
return _ -= t == e && e.has(a) ? 1 : 0, e.delete(a);
|
|
289
|
+
},
|
|
290
|
+
flush(a) {
|
|
291
|
+
t.size && (e = /* @__PURE__ */ new Set(), _ -= t.size, tt(t, (r) => r(a) && e.add(r)), _ += e.size, t = e);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
const Ne = nt(), Oe = typeof window < "u" ? window.requestAnimationFrame : () => {
|
|
296
|
+
}, ae = (e) => at(e, Ne);
|
|
297
|
+
ae.now = typeof performance < "u" ? () => performance.now() : Date.now;
|
|
298
|
+
ae.batchedUpdates = (e) => e();
|
|
299
|
+
let T = -1;
|
|
300
|
+
function at(e, t) {
|
|
301
|
+
t.add(e), rt();
|
|
302
|
+
}
|
|
303
|
+
function rt() {
|
|
304
|
+
T < 0 && (T = 0, Oe($e));
|
|
305
|
+
}
|
|
306
|
+
function lt() {
|
|
307
|
+
T = -1;
|
|
308
|
+
}
|
|
309
|
+
function $e() {
|
|
310
|
+
~T && (Oe($e), ae.batchedUpdates(ot));
|
|
311
|
+
}
|
|
312
|
+
function ot() {
|
|
313
|
+
const e = T;
|
|
314
|
+
if (T = ae.now(), !_) {
|
|
315
|
+
lt();
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
Ne.flush(e ? Math.min(64, T - e) : 16.667);
|
|
319
|
+
}
|
|
320
|
+
const Ce = 50;
|
|
321
|
+
function it(e) {
|
|
322
|
+
return { type: "percent", value: new y(e) };
|
|
323
|
+
}
|
|
324
|
+
function H(e) {
|
|
325
|
+
return { type: "pixel", value: new y(e) };
|
|
326
|
+
}
|
|
327
|
+
function st(e) {
|
|
328
|
+
let t = fe.linear, a = 300;
|
|
329
|
+
return e.collapseAnimation && (typeof e.collapseAnimation == "string" ? t = fe[e.collapseAnimation] : (a = e.collapseAnimation.duration, t = typeof e.collapseAnimation.easing == "function" ? e.collapseAnimation.easing : fe[e.collapseAnimation.easing])), { ease: t, duration: a };
|
|
330
|
+
}
|
|
331
|
+
const fe = {
|
|
332
|
+
"ease-in-out": function(t) {
|
|
333
|
+
return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
|
|
334
|
+
},
|
|
335
|
+
bounce: function(t) {
|
|
336
|
+
return ((t *= 2) < 1 ? t * t * ((1.70158 + 1) * t - 1.70158) : (t -= 2) * t * ((1.70158 + 1) * t + 1.70158) + 2) / 2;
|
|
337
|
+
},
|
|
338
|
+
linear: function(t) {
|
|
339
|
+
return +t;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
function xe(e) {
|
|
343
|
+
return e.orientation === "horizontal" ? e.dragOvershoot.gt(0) ? "w-resize" : e.dragOvershoot.lt(0) ? "e-resize" : "ew-resize" : e.dragOvershoot.gt(0) ? "n-resize" : e.dragOvershoot.lt(0) ? "s-resize" : "ns-resize";
|
|
344
|
+
}
|
|
345
|
+
function ut(e) {
|
|
346
|
+
if ("context" in e && (e = e.context), "items" in e) {
|
|
347
|
+
e.dragOvershoot = new y(e.dragOvershoot || 0);
|
|
348
|
+
for (const t of e.items)
|
|
349
|
+
P(t) ? (t.currentValue.value = new y(t.currentValue.value), t.collapsedSize.value = new y(t.collapsedSize.value), t.min.value = new y(t.min.value), t.max && t.max !== "1fr" && (t.max.value = new y(t.max.value))) : t.size.value = new y(t.size.value);
|
|
350
|
+
return e;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function Y(e, t) {
|
|
354
|
+
if (!e)
|
|
355
|
+
throw new Error(t);
|
|
356
|
+
}
|
|
357
|
+
function Z(e, t) {
|
|
358
|
+
Y(t.includes(e.type), `Invalid event type: ${t}. Expected: ${t.join(" | ")}`);
|
|
359
|
+
}
|
|
360
|
+
function P(e) {
|
|
361
|
+
return !!(e && typeof e == "object" && "type" in e && e.type === "panel");
|
|
362
|
+
}
|
|
363
|
+
function $(e) {
|
|
364
|
+
return !!(e && typeof e == "object" && "type" in e && e.type === "handle");
|
|
365
|
+
}
|
|
366
|
+
function ct(e) {
|
|
367
|
+
const t = () => {
|
|
368
|
+
let r = null;
|
|
369
|
+
return (l) => {
|
|
370
|
+
var n, o;
|
|
371
|
+
if (!r || r.pixel === l.pixel && r.percentage === l.percentage) {
|
|
372
|
+
r = l;
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
r = l, (o = (n = e.onResize) == null ? void 0 : n.current) == null || o.call(n, l);
|
|
376
|
+
};
|
|
377
|
+
};
|
|
378
|
+
return { ...{
|
|
379
|
+
type: "panel",
|
|
380
|
+
min: q(e.min || "0px"),
|
|
381
|
+
max: e.max ? q(e.max) : "1fr",
|
|
382
|
+
collapsed: e.collapsible ? e.collapsed ?? e.defaultCollapsed ?? !1 : void 0,
|
|
383
|
+
collapsible: e.collapsible,
|
|
384
|
+
collapsedSize: q(e.collapsedSize ?? "0px"),
|
|
385
|
+
onCollapseChange: e.onCollapseChange,
|
|
386
|
+
onResize: { current: t() },
|
|
387
|
+
collapseIsControlled: typeof e.collapsed < "u",
|
|
388
|
+
sizeBeforeCollapse: void 0,
|
|
389
|
+
id: e.id,
|
|
390
|
+
collapseAnimation: e.collapseAnimation,
|
|
391
|
+
default: e.default ? q(e.default) : void 0,
|
|
392
|
+
isStaticAtRest: e.isStaticAtRest
|
|
393
|
+
}, currentValue: H(-1) };
|
|
394
|
+
}
|
|
395
|
+
function ee(e, t) {
|
|
396
|
+
return e.type === t.type && e.value.eq(t.value);
|
|
397
|
+
}
|
|
398
|
+
function dt(e, t) {
|
|
399
|
+
return !!(!t || !ee(e.min, t.min) || e.max === "1fr" && t.max !== "1fr" || e.max !== "1fr" && t.max === "1fr" || e.max !== "1fr" && t.max !== "1fr" && !ee(e.max, t.max) || e.default && !t.default || !e.default && t.default || e.default && t.default && !ee(e.default, t.default) || !ee(e.collapsedSize, t.collapsedSize) || e.isStaticAtRest !== t.isStaticAtRest || e.collapseAnimation && !t.collapseAnimation || !e.collapseAnimation && t.collapseAnimation || typeof e.collapseAnimation == "string" && typeof t.collapseAnimation == "string" && e.collapseAnimation !== t.collapseAnimation || typeof e.collapseAnimation == "object" && typeof t.collapseAnimation == "object" && (e.collapseAnimation.duration !== t.collapseAnimation.duration || e.collapseAnimation.easing !== t.collapseAnimation.easing) || e.collapsible !== t.collapsible);
|
|
400
|
+
}
|
|
401
|
+
function ft(e, t) {
|
|
402
|
+
return !t || !ee(e.size, t.size);
|
|
403
|
+
}
|
|
404
|
+
function pt(e) {
|
|
405
|
+
return {
|
|
406
|
+
type: "handle",
|
|
407
|
+
...e,
|
|
408
|
+
size: typeof e.size == "string" ? q(e.size) : e.size
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
function q(e) {
|
|
412
|
+
if (e === "1fr" && (e = "100%"), e.endsWith("px"))
|
|
413
|
+
return H(parseFloat(e));
|
|
414
|
+
if (e.endsWith("%"))
|
|
415
|
+
return it(parseFloat(e) / 100);
|
|
416
|
+
throw new Error(`Invalid unit: ${e}`);
|
|
417
|
+
}
|
|
418
|
+
function X(e, t) {
|
|
419
|
+
return t.type === "pixel" ? e === 0 ? 0 : t.value.div(e).toNumber() : t.value.toNumber();
|
|
420
|
+
}
|
|
421
|
+
function V(e) {
|
|
422
|
+
return e.orientation === "horizontal" ? e.size.width : e.size.height;
|
|
423
|
+
}
|
|
424
|
+
function S(e, t) {
|
|
425
|
+
const a = t === "1fr" ? q(t) : t;
|
|
426
|
+
return a.type === "pixel" ? a.value : a.value.mul(V(e));
|
|
427
|
+
}
|
|
428
|
+
function K(e, t, a) {
|
|
429
|
+
const r = S(e, t.min), l = S(e, t.max);
|
|
430
|
+
return a.gte(r) && a.lte(l) ? a : a.lt(r) ? r : l;
|
|
431
|
+
}
|
|
432
|
+
function k(e, t) {
|
|
433
|
+
const a = e.items.find((r) => r.id === t);
|
|
434
|
+
if (a && P(a))
|
|
435
|
+
return a;
|
|
436
|
+
throw new Error(`Expected panel with id: ${t}`);
|
|
437
|
+
}
|
|
438
|
+
function He(e, t) {
|
|
439
|
+
const a = e.items.findIndex((r) => r.id === t);
|
|
440
|
+
if (a !== -1 && $(e.items[a]))
|
|
441
|
+
return a;
|
|
442
|
+
throw new Error(`Expected panel handle with id: ${t}`);
|
|
443
|
+
}
|
|
444
|
+
function mt(e, t) {
|
|
445
|
+
if (!e.items.length)
|
|
446
|
+
throw new Error("No items in group");
|
|
447
|
+
const a = He(e, t), r = e.items[a - 1], l = e.items[a + 1];
|
|
448
|
+
if (r && P(r) && r.collapsible)
|
|
449
|
+
return r;
|
|
450
|
+
if (l && P(l) && l.collapsible)
|
|
451
|
+
return l;
|
|
452
|
+
throw new Error(`No collapsible panel found for handle: ${t}`);
|
|
453
|
+
}
|
|
454
|
+
function te(e, t) {
|
|
455
|
+
const a = e.items.findIndex((l) => l.id === t);
|
|
456
|
+
Y(a !== -1, `Expected panel before: ${t}`);
|
|
457
|
+
let r = e.items[a + 1];
|
|
458
|
+
if (r && $(r))
|
|
459
|
+
return { item: r, direction: 1 };
|
|
460
|
+
if (r = e.items[a - 1], r && $(r))
|
|
461
|
+
return { item: r, direction: -1 };
|
|
462
|
+
throw new Error(`Cant find handle for panel: ${t}`);
|
|
463
|
+
}
|
|
464
|
+
function gt(e) {
|
|
465
|
+
const t = {}, a = e.map((o) => o.order).filter((o) => o !== void 0);
|
|
466
|
+
let r = 0;
|
|
467
|
+
for (const o of e)
|
|
468
|
+
if (o.order === void 0) {
|
|
469
|
+
for (; a.includes(r) || Object.values(t).includes(r); )
|
|
470
|
+
r++;
|
|
471
|
+
t[o.id] = r;
|
|
472
|
+
}
|
|
473
|
+
const l = e.filter((o) => o.order === void 0), n = e.filter((o) => o.order !== void 0).sort((o, i) => o.order - i.order);
|
|
474
|
+
for (const o of n)
|
|
475
|
+
l.splice(o.order, 0, o);
|
|
476
|
+
return l;
|
|
477
|
+
}
|
|
478
|
+
function ht(e, t, a) {
|
|
479
|
+
return Y(t.currentValue.type === "pixel", `panelHasSpace only works with number values: ${t.id} ${t.currentValue}`), t.collapsible && !t.collapsed ? !0 : a === "add" ? t.currentValue.value.gte(S(e, t.min)) && t.currentValue.value.lt(S(e, t.max)) : t.currentValue.value.gt(S(e, t.min));
|
|
480
|
+
}
|
|
481
|
+
function Le(e, t, a, r, l, n) {
|
|
482
|
+
const o = r === -1 ? t.slice(0, a + 1).reverse() : t.slice(a);
|
|
483
|
+
for (const i of o) {
|
|
484
|
+
if (!P(i))
|
|
485
|
+
continue;
|
|
486
|
+
const u = n ? ge(e, i) : i;
|
|
487
|
+
if (ht(e, u, l))
|
|
488
|
+
return i;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
function ce(e) {
|
|
492
|
+
let t = new y(0);
|
|
493
|
+
for (const a of e.items)
|
|
494
|
+
$(a) ? t = t.add(a.size.value) : (a.collapsed && a.currentValue.type === "pixel" || a.isStaticAtRest) && (t = t.add(a.currentValue.value));
|
|
495
|
+
return t;
|
|
496
|
+
}
|
|
497
|
+
function D(e) {
|
|
498
|
+
return e.type === "pixel" ? `${e.value.toNumber()}px` : `${e.value.mul(100).toNumber()}%`;
|
|
499
|
+
}
|
|
500
|
+
function vt(e) {
|
|
501
|
+
return O(e).map((t) => P(t) ? t.currentValue.value.toNumber() : S(e, t.size).toNumber());
|
|
502
|
+
}
|
|
503
|
+
function wt(e, t) {
|
|
504
|
+
return k({ ...e, items: O(e) }, t).currentValue.value.toNumber();
|
|
505
|
+
}
|
|
506
|
+
function zt(e) {
|
|
507
|
+
return Se({
|
|
508
|
+
...e,
|
|
509
|
+
items: O(e)
|
|
510
|
+
}).map((a) => $(a) ? X(V(e), a.size) : X(V(e), a.currentValue));
|
|
511
|
+
}
|
|
512
|
+
function bt(e, t) {
|
|
513
|
+
const a = O(e), r = k({ ...e, items: a }, t);
|
|
514
|
+
return X(V(e), r.currentValue);
|
|
515
|
+
}
|
|
516
|
+
function Ae(e) {
|
|
517
|
+
const t = ce(e);
|
|
518
|
+
let a = !1;
|
|
519
|
+
return e.items.map((r) => {
|
|
520
|
+
if (r.type === "panel") {
|
|
521
|
+
const l = D(r.min);
|
|
522
|
+
if (r.currentValue.type === "pixel" && r.currentValue.value.toNumber() !== -1) {
|
|
523
|
+
if (r.isStaticAtRest) {
|
|
524
|
+
const n = r.max === "1fr" ? "100%" : D(r.max);
|
|
525
|
+
return `clamp(${l}, ${D(r.currentValue)}, ${n})`;
|
|
526
|
+
}
|
|
527
|
+
return D(r.currentValue);
|
|
528
|
+
} else if (r.currentValue.type === "percent") {
|
|
529
|
+
if (!a && (r.max === "1fr" || r.max.type === "percent" && r.max.value.eq(100)))
|
|
530
|
+
return a = !0, `minmax(${l}, 1fr)`;
|
|
531
|
+
const n = r.max === "1fr" ? "100%" : D(r.max);
|
|
532
|
+
return `minmax(${l}, min(calc(${r.currentValue.value} * (100% - ${t}px)), ${n}))`;
|
|
533
|
+
} else {
|
|
534
|
+
if (r.collapsible && r.collapsed)
|
|
535
|
+
return D(r.collapsedSize);
|
|
536
|
+
if (r.default) {
|
|
537
|
+
if (e.items.some((i) => P(i) && i.id !== r.id && !i.collapsed && (i.max === "1fr" || i.max.type === "percent" && i.max.value.eq(100))))
|
|
538
|
+
return D(r.default);
|
|
539
|
+
const o = r.max === "1fr" ? "1fr" : D(r.max);
|
|
540
|
+
return `minmax(${D(r.default)}, ${o})`;
|
|
541
|
+
} else {
|
|
542
|
+
const n = r.max === "1fr" ? "1fr" : D(r.max);
|
|
543
|
+
return `minmax(${l}, ${n})`;
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return D(r.size);
|
|
548
|
+
}).join(" ");
|
|
549
|
+
}
|
|
550
|
+
function pe(e, t) {
|
|
551
|
+
const a = e.findIndex((l) => l.id === t.id || typeof l.order == "number" && l.order === t.order);
|
|
552
|
+
let r = e;
|
|
553
|
+
return a !== -1 && (r = e.filter((l, n) => n !== a)), gt([...r, t]);
|
|
554
|
+
}
|
|
555
|
+
function ge(e, t) {
|
|
556
|
+
return {
|
|
557
|
+
...t,
|
|
558
|
+
min: H(-1e5),
|
|
559
|
+
max: H(1e5)
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function O(e) {
|
|
563
|
+
const t = ce(e), a = [];
|
|
564
|
+
for (const r of e.items) {
|
|
565
|
+
if (!r || !P(r)) {
|
|
566
|
+
a.push({ ...r });
|
|
567
|
+
continue;
|
|
568
|
+
}
|
|
569
|
+
if (r.lastKnownSize) {
|
|
570
|
+
const n = H(e.orientation === "horizontal" ? r.lastKnownSize.width : r.lastKnownSize.height);
|
|
571
|
+
a.push({ ...r, currentValue: n });
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
if (r.currentValue.type === "pixel") {
|
|
575
|
+
a.push({ ...r });
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
const l = new y(V(e)).minus(t).mul(r.currentValue.value);
|
|
579
|
+
a.push({
|
|
580
|
+
...r,
|
|
581
|
+
currentValue: H(l.toNumber())
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
return a;
|
|
585
|
+
}
|
|
586
|
+
function ie(e, t) {
|
|
587
|
+
var A, E, L, M;
|
|
588
|
+
const a = He(e, t.handleId), r = e.items[a], l = [...e.items];
|
|
589
|
+
let n = e.orientation === "horizontal" ? t.value.deltaX : t.value.deltaY;
|
|
590
|
+
if (t.value.shiftKey && (n *= 15), n === 0)
|
|
591
|
+
return {};
|
|
592
|
+
const o = n / Math.abs(n), i = Le(e, l, a + o, o, "subtract", t.disregardCollapseBuffer);
|
|
593
|
+
if (!i)
|
|
594
|
+
return {
|
|
595
|
+
dragOvershoot: e.dragOvershoot.add(n)
|
|
596
|
+
};
|
|
597
|
+
Y(P(i), `Expected panel before: ${r.id}`);
|
|
598
|
+
const u = l[a - o];
|
|
599
|
+
if (Y(u && P(u), `Expected panel after: ${r.id}`), u.currentValue.value.eq(S(e, u.max)))
|
|
600
|
+
return {
|
|
601
|
+
dragOvershoot: e.dragOvershoot.add(n)
|
|
602
|
+
};
|
|
603
|
+
const d = e.dragOvershoot.add(n);
|
|
604
|
+
if (!t.disregardCollapseBuffer) {
|
|
605
|
+
const R = d.lt(0) && o > 0, w = d.gt(0) && o > 0, x = d.gt(0) && o < 0, U = d.lt(0) && o < 0, re = u.currentValue.value.add(new y(d).mul(x ? o : 1)), le = S(e, u.min), qe = d.abs().lt(Ce) && // Let the panel expand at it's min size
|
|
606
|
+
!u.currentValue.value.add(d.abs()).gte(u.min.value) && u.collapsible && u.collapsed && (w || U);
|
|
607
|
+
if (re.lte(le) && (d.eq(0) || x || R || qe))
|
|
608
|
+
return { dragOvershoot: d };
|
|
609
|
+
}
|
|
610
|
+
if (!t.disregardCollapseBuffer && i.collapsible && i.currentValue.value.eq(S(e, i.min))) {
|
|
611
|
+
const R = i.currentValue.value.sub(d.abs());
|
|
612
|
+
if (d.abs().lt(Ce) && R.gt(S(e, i.collapsedSize)))
|
|
613
|
+
return { dragOvershoot: d };
|
|
614
|
+
}
|
|
615
|
+
const c = ge(e, i), m = i.currentValue.value, s = i.currentValue.value.minus(new y(n).mul(o));
|
|
616
|
+
let f = t.disregardCollapseBuffer ? K(e, c, s) : K(e, i, s);
|
|
617
|
+
const g = ge(e, u), p = u.currentValue.value, v = m.minus(f), h = u.currentValue.value.add(v);
|
|
618
|
+
let z = t.disregardCollapseBuffer ? K(e, g, h) : K(e, u, h);
|
|
619
|
+
if (t.disregardCollapseBuffer)
|
|
620
|
+
u.collapsible && u.collapsed && (u.collapsed = !1);
|
|
621
|
+
else if (u.collapsible && u.collapsed) {
|
|
622
|
+
if ((A = u.onCollapseChange) != null && A.current && u.collapseIsControlled && !t.controlled && !t.isVirtual)
|
|
623
|
+
return u.onCollapseChange.current(!1), { dragOvershoot: d };
|
|
624
|
+
const R = (
|
|
625
|
+
// Take the size it was at
|
|
626
|
+
S(e, u.collapsedSize).add(e.dragOvershoot.abs()).sub(z.add(Math.abs(n)))
|
|
627
|
+
);
|
|
628
|
+
if (R.gt(0) && (z = z.add(R)), f = f.minus(z.minus(p).minus(Math.abs(n))), f.lt(i.min.value))
|
|
629
|
+
return { dragOvershoot: d };
|
|
630
|
+
u.collapsed = !1, (E = u.onCollapseChange) != null && E.current && !u.collapseIsControlled && !t.controlled && !t.isVirtual && u.onCollapseChange.current(!1);
|
|
631
|
+
}
|
|
632
|
+
const I = i.currentValue.value.eq(S(e, i.min));
|
|
633
|
+
if (!t.disregardCollapseBuffer && i.collapsible && I) {
|
|
634
|
+
if ((L = i.onCollapseChange) != null && L.current && i.collapseIsControlled && !t.controlled && !t.isVirtual)
|
|
635
|
+
return i.onCollapseChange.current(!0), { dragOvershoot: d };
|
|
636
|
+
i.collapsed = !0, f = S(e, i.collapsedSize), z = z.add(m.minus(f)), (M = i.onCollapseChange) != null && M.current && !i.collapseIsControlled && !t.controlled && !t.isVirtual && i.onCollapseChange.current(!0);
|
|
637
|
+
}
|
|
638
|
+
i.currentValue = { type: "pixel", value: f }, u.currentValue = { type: "pixel", value: z };
|
|
639
|
+
const C = new y(V(e)).minus(l.reduce((R, w) => R.add(P(w) ? w.currentValue.value : w.size.value), new y(0)));
|
|
640
|
+
return C.eq(0) || (i.currentValue.value = K(e, i, i.currentValue.value.add(C))), { items: l };
|
|
641
|
+
}
|
|
642
|
+
function Se(e) {
|
|
643
|
+
const t = [...e.items];
|
|
644
|
+
t.forEach((r, l) => {
|
|
645
|
+
r.type === "panel" && r.collapsed && (t[l] = {
|
|
646
|
+
...r,
|
|
647
|
+
currentValue: r.collapsedSize
|
|
648
|
+
});
|
|
649
|
+
});
|
|
650
|
+
const a = ce({ ...e, items: t });
|
|
651
|
+
return t.forEach((r, l) => {
|
|
652
|
+
r.type !== "panel" || r.collapsed || r.isStaticAtRest || (t[l] = {
|
|
653
|
+
...r,
|
|
654
|
+
currentValue: {
|
|
655
|
+
type: "percent",
|
|
656
|
+
value: r.currentValue.value.div(new y(V(e)).sub(a))
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}), t;
|
|
660
|
+
}
|
|
661
|
+
function he({ delta: e, orientation: t = "horizontal", shiftKey: a = !1 }) {
|
|
662
|
+
return {
|
|
663
|
+
type: "move",
|
|
664
|
+
pointerType: "keyboard",
|
|
665
|
+
shiftKey: a,
|
|
666
|
+
ctrlKey: !1,
|
|
667
|
+
altKey: !1,
|
|
668
|
+
metaKey: !1,
|
|
669
|
+
deltaX: t === "horizontal" ? e : 0,
|
|
670
|
+
deltaY: t === "horizontal" ? 0 : e
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
function ve({ context: e, handleId: t, delta: a, direction: r, controlled: l, disregardCollapseBuffer: n, isVirtual: o }) {
|
|
674
|
+
let i = e;
|
|
675
|
+
for (let u = 0; u < a.abs().toNumber(); u++)
|
|
676
|
+
i = ie({
|
|
677
|
+
...e,
|
|
678
|
+
...i
|
|
679
|
+
}, {
|
|
680
|
+
handleId: t,
|
|
681
|
+
controlled: l,
|
|
682
|
+
disregardCollapseBuffer: n,
|
|
683
|
+
isVirtual: o,
|
|
684
|
+
value: he({
|
|
685
|
+
delta: r,
|
|
686
|
+
orientation: e.orientation
|
|
687
|
+
})
|
|
688
|
+
});
|
|
689
|
+
return i;
|
|
690
|
+
}
|
|
691
|
+
function we(e, t, a, r) {
|
|
692
|
+
let l = !1, n = 1, o = new y(r);
|
|
693
|
+
for (; o.toNumber() !== 0; ) {
|
|
694
|
+
const i = Le(e, t, a + n, n, r.gt(0) ? "add" : "subtract");
|
|
695
|
+
if (!i) {
|
|
696
|
+
if (l)
|
|
697
|
+
break;
|
|
698
|
+
n = n === 1 ? -1 : 1, l = !0;
|
|
699
|
+
continue;
|
|
700
|
+
}
|
|
701
|
+
const u = i.currentValue.value, d = K(e, i, u.add(o));
|
|
702
|
+
i.currentValue.value = d, o = o.sub(d.sub(u)), n = n === 1 ? -1 : 1;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
function yt(e) {
|
|
706
|
+
if (e.items.some((u) => P(u) && u.currentValue.value.eq(-1)))
|
|
707
|
+
return e;
|
|
708
|
+
const t = new y(V(e)), a = t.sub(ce(e).toNumber()), l = e.items.map((u) => {
|
|
709
|
+
if ($(u))
|
|
710
|
+
return u.size.value;
|
|
711
|
+
if (u.collapsed)
|
|
712
|
+
return S(e, u.currentValue);
|
|
713
|
+
const d = u.currentValue.type === "pixel" && u.currentValue.value || u.currentValue.value.mul(a);
|
|
714
|
+
return K(e, u, d);
|
|
715
|
+
}).reduce((u, d) => u.add(d), new y(0)), n = l.abs().sub(t);
|
|
716
|
+
if (n.eq(0) || t.eq(0))
|
|
717
|
+
return e;
|
|
718
|
+
let o = { ...e, items: O(e) };
|
|
719
|
+
const i = o.items.find((u) => !!(P(u) && u.collapsible));
|
|
720
|
+
if (i) {
|
|
721
|
+
const u = o.items.findIndex((m) => m.id === i.id), d = te(o, i.id), c = i.currentValue.value.sub(S(o, i.collapsedSize));
|
|
722
|
+
o = {
|
|
723
|
+
...o,
|
|
724
|
+
...ve({
|
|
725
|
+
handleId: d.item.id,
|
|
726
|
+
delta: c,
|
|
727
|
+
direction: d.direction * -1,
|
|
728
|
+
context: {
|
|
729
|
+
...o,
|
|
730
|
+
// act like its the old size so the space is distributed correctly
|
|
731
|
+
size: { width: l.toNumber(), height: l.toNumber() }
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
}, we(o, o.items, u, n.neg());
|
|
735
|
+
}
|
|
736
|
+
return { ...o, items: Se(o) };
|
|
737
|
+
}
|
|
738
|
+
function Ve(e) {
|
|
739
|
+
return e.map((t) => ({ ...t, lastKnownSize: void 0 }));
|
|
740
|
+
}
|
|
741
|
+
function It(e, t) {
|
|
742
|
+
document.cookie = `${e}=${encodeURIComponent(`${t}`)};path=/;max-age=31536000`;
|
|
743
|
+
}
|
|
744
|
+
function Me(e, t) {
|
|
745
|
+
const a = k(e, t.panelId);
|
|
746
|
+
if (t.type === "expandPanel")
|
|
747
|
+
return new y(a.sizeBeforeCollapse ?? S(e, a.min)).minus(a.currentValue.value);
|
|
748
|
+
const r = S(e, a.collapsedSize);
|
|
749
|
+
return a.currentValue.value.minus(r);
|
|
750
|
+
}
|
|
751
|
+
function Re(e, t, a, r) {
|
|
752
|
+
const l = k(e, t.panelId), n = te(e, t.panelId);
|
|
753
|
+
let o = new y(n.direction);
|
|
754
|
+
const i = Me(e, t);
|
|
755
|
+
return new Promise((u, d) => {
|
|
756
|
+
r.signal.addEventListener("abort", () => {
|
|
757
|
+
d(new Error("Operation was canceled"));
|
|
758
|
+
}), t.type === "collapsePanel" && (l.sizeBeforeCollapse = l.currentValue.value.toNumber(), o = o.mul(new y(-1)));
|
|
759
|
+
const c = 60, { duration: m, ease: s } = st(l), f = Math.ceil(l.collapseAnimation ? m / (1e3 / c) : 1);
|
|
760
|
+
let g = 0, p = new y(0);
|
|
761
|
+
function v() {
|
|
762
|
+
const h = ++g / f, z = new y(l.collapseAnimation ? s(h) : 1), I = z.mul(i).sub(p).mul(o);
|
|
763
|
+
if (a({
|
|
764
|
+
type: "applyDelta",
|
|
765
|
+
handleId: n.item.id,
|
|
766
|
+
delta: I.toNumber()
|
|
767
|
+
}), p = p.add(I.abs().mul(I.gt(0) && o.lt(0) || I.lt(0) && o.gt(0) ? -1 : 1)), z.eq(1)) {
|
|
768
|
+
const C = t.type === "expandPanel" ? "expand" : "collapse";
|
|
769
|
+
return u({ panelId: l.id, action: C }), !1;
|
|
770
|
+
}
|
|
771
|
+
return !0;
|
|
772
|
+
}
|
|
773
|
+
ae(v);
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
function me(e, t) {
|
|
777
|
+
for (const a in t)
|
|
778
|
+
e[a] = t[a];
|
|
779
|
+
}
|
|
780
|
+
let Pt = 0;
|
|
781
|
+
function St(e, t) {
|
|
782
|
+
const a = new AbortController(), r = {
|
|
783
|
+
current: "idle"
|
|
784
|
+
};
|
|
785
|
+
let l = !1;
|
|
786
|
+
const n = {
|
|
787
|
+
size: e.size || { width: 0, height: 0 },
|
|
788
|
+
items: e.items || [],
|
|
789
|
+
orientation: e.orientation || "horizontal",
|
|
790
|
+
dragOvershoot: new y(0),
|
|
791
|
+
groupId: e.groupId || `group-${Pt++}`,
|
|
792
|
+
autosaveStrategy: e.autosaveStrategy
|
|
793
|
+
}, o = {
|
|
794
|
+
prepare: () => {
|
|
795
|
+
n.items = O(n);
|
|
796
|
+
},
|
|
797
|
+
clearLastKnownSize: () => {
|
|
798
|
+
n.items = Ve(n.items);
|
|
799
|
+
},
|
|
800
|
+
commit: () => {
|
|
801
|
+
n.dragOvershoot = new y(0), n.items = Se(n);
|
|
802
|
+
},
|
|
803
|
+
onResize: () => {
|
|
804
|
+
var c, m;
|
|
805
|
+
for (const s of n.items)
|
|
806
|
+
if (P(s)) {
|
|
807
|
+
const f = s.lastKnownSize ? new y(n.orientation === "horizontal" ? s.lastKnownSize.width : s.lastKnownSize.height) : K(n, s, S(n, s.currentValue)), g = V(n);
|
|
808
|
+
(m = (c = s.onResize) == null ? void 0 : c.current) == null || m.call(c, {
|
|
809
|
+
pixel: f.toNumber(),
|
|
810
|
+
percentage: g > 0 ? f.div(V(n)).toNumber() : -1
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
},
|
|
814
|
+
onAutosave: () => {
|
|
815
|
+
if (!n.autosaveStrategy || typeof window > "u")
|
|
816
|
+
return;
|
|
817
|
+
const c = { ...n };
|
|
818
|
+
c.items = Ve(n.items), c.activeDragHandleId = n.activeDragHandleId;
|
|
819
|
+
const m = JSON.stringify(c);
|
|
820
|
+
n.autosaveStrategy === "localStorage" ? localStorage.setItem(n.groupId, m) : It(n.groupId, m);
|
|
821
|
+
},
|
|
822
|
+
removeItem: (c) => {
|
|
823
|
+
const m = n.items.findIndex((p) => p.id === c), s = n.items[m];
|
|
824
|
+
if (!s)
|
|
825
|
+
return;
|
|
826
|
+
const f = n.items.filter((p) => p.id !== c), g = P(s) ? s.currentValue.value : s.size.value;
|
|
827
|
+
we(n, f, m, g), n.items = f;
|
|
828
|
+
},
|
|
829
|
+
notifyCollapseToggle: (c) => {
|
|
830
|
+
var s, f;
|
|
831
|
+
Z(c, ["collapsePanel", "expandPanel"]);
|
|
832
|
+
const m = k(n, c.panelId);
|
|
833
|
+
(f = (s = m.onCollapseChange) == null ? void 0 : s.current) == null || f.call(s, !m.collapsed);
|
|
834
|
+
},
|
|
835
|
+
runCollapseToggle: (c) => {
|
|
836
|
+
Z(c, ["collapsePanel", "expandPanel"]);
|
|
837
|
+
const m = te(n, c.panelId), s = c.type === "collapsePanel" ? m.direction * -1 : m.direction, f = ie(n, {
|
|
838
|
+
handleId: m.item.id,
|
|
839
|
+
controlled: c.controlled,
|
|
840
|
+
value: he({
|
|
841
|
+
delta: s,
|
|
842
|
+
orientation: n.orientation
|
|
843
|
+
})
|
|
844
|
+
});
|
|
845
|
+
me(n, f);
|
|
846
|
+
},
|
|
847
|
+
onAnimationEnd: (c) => {
|
|
848
|
+
var s, f;
|
|
849
|
+
Y(c, "Expected output from animation actor");
|
|
850
|
+
const m = k(n, c.panelId);
|
|
851
|
+
m.collapsed = c.action === "collapse", m.collapsed && (m.currentValue = m.collapsedSize), m.collapseIsControlled || (f = (s = m.onCollapseChange) == null ? void 0 : s.current) == null || f.call(s, m.collapsed), o.commit();
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
o.onAutosave();
|
|
855
|
+
const i = {
|
|
856
|
+
shouldNotifyCollapseToggle: (c) => {
|
|
857
|
+
Z(c, ["collapsePanel", "expandPanel"]);
|
|
858
|
+
const m = k(n, c.panelId);
|
|
859
|
+
return !c.controlled && m.collapseIsControlled === !0;
|
|
860
|
+
},
|
|
861
|
+
shouldCollapseToggle: (c) => (Z(c, ["collapsePanel", "expandPanel"]), k(n, c.panelId).collapseIsControlled === !0),
|
|
862
|
+
cannotExpandPanel: (c) => {
|
|
863
|
+
Z(c, ["expandPanel"]);
|
|
864
|
+
const m = Me(n, c), s = te(n, c.panelId), f = O(n);
|
|
865
|
+
let g = { ...n, items: f };
|
|
866
|
+
g = {
|
|
867
|
+
...g,
|
|
868
|
+
...ve({
|
|
869
|
+
context: g,
|
|
870
|
+
handleId: s.item.id,
|
|
871
|
+
controlled: c.controlled,
|
|
872
|
+
delta: m,
|
|
873
|
+
direction: s.direction,
|
|
874
|
+
isVirtual: !0
|
|
875
|
+
})
|
|
876
|
+
};
|
|
877
|
+
const p = g.items.find((z) => z.id === c.panelId), v = g.items.reduce((z, I) => z.add(P(I) ? I.currentValue.value : I.size.value), new y(0)), h = p && P(p) && !p.currentValue.value.eq(p.collapsedSize.value);
|
|
878
|
+
return v.gt(V(n)) || !h;
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
function u(c) {
|
|
882
|
+
switch (r.current) {
|
|
883
|
+
case "dragging":
|
|
884
|
+
o.commit(), n.activeDragHandleId = void 0;
|
|
885
|
+
break;
|
|
886
|
+
}
|
|
887
|
+
switch (c) {
|
|
888
|
+
case "idle":
|
|
889
|
+
o.onAutosave();
|
|
890
|
+
break;
|
|
891
|
+
case "dragging":
|
|
892
|
+
o.prepare();
|
|
893
|
+
break;
|
|
894
|
+
case "togglingCollapse":
|
|
895
|
+
o.prepare(), o.clearLastKnownSize();
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
r.current = c;
|
|
899
|
+
}
|
|
900
|
+
function d(c) {
|
|
901
|
+
var m;
|
|
902
|
+
switch (c.type) {
|
|
903
|
+
case "lockGroup":
|
|
904
|
+
l = !0;
|
|
905
|
+
break;
|
|
906
|
+
case "unlockGroup":
|
|
907
|
+
l = !1;
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
if (!l) {
|
|
911
|
+
switch (c.type) {
|
|
912
|
+
case "registerPanel":
|
|
913
|
+
n.items = pe(n.items, {
|
|
914
|
+
type: "panel",
|
|
915
|
+
currentValue: H(-1),
|
|
916
|
+
...c.data
|
|
917
|
+
});
|
|
918
|
+
break;
|
|
919
|
+
case "unregisterPanel":
|
|
920
|
+
o.prepare(), o.removeItem(c.id), o.clearLastKnownSize(), o.commit(), o.onResize(), o.onAutosave();
|
|
921
|
+
break;
|
|
922
|
+
case "registerPanelHandle": {
|
|
923
|
+
n.items = pe(n.items, c.data);
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
case "unregisterPanelHandle":
|
|
927
|
+
o.prepare(), o.removeItem(c.id), o.clearLastKnownSize(), o.commit(), o.onResize(), o.onAutosave();
|
|
928
|
+
break;
|
|
929
|
+
case "registerDynamicPanel": {
|
|
930
|
+
o.prepare();
|
|
931
|
+
let s = H(0);
|
|
932
|
+
c.data.collapsible && c.data.collapsed && c.data.collapsedSize ? s = c.data.collapsedSize : c.data.default ? s = c.data.default : s = c.data.min;
|
|
933
|
+
const f = pe(n.items, {
|
|
934
|
+
type: "panel",
|
|
935
|
+
...c.data,
|
|
936
|
+
currentValue: s
|
|
937
|
+
}), g = f.findIndex((h) => h.id === c.data.id), p = { ...n }, v = n.items.reduce((h, z) => $(z) ? h.add(S(n, z.size)) : h.add(z.currentValue.value), new y(0)).minus(V(n));
|
|
938
|
+
we(p, f, g, s.value.add(v).neg()), n.items = f, o.clearLastKnownSize(), o.commit(), o.onResize(), o.onAutosave();
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
case "rebindPanelCallbacks":
|
|
942
|
+
for (const s of n.items)
|
|
943
|
+
P(s) && s.id === c.data.id && (s.onCollapseChange = c.data.onCollapseChange, s.onResize = c.data.onResize);
|
|
944
|
+
break;
|
|
945
|
+
case "updateConstraints":
|
|
946
|
+
o.prepare();
|
|
947
|
+
for (const s of n.items)
|
|
948
|
+
if (P(s) && s.id === c.data.id) {
|
|
949
|
+
const f = c.data;
|
|
950
|
+
s.min = f.min, s.max = f.max, s.default = f.default, s.collapsedSize = f.collapsedSize, s.isStaticAtRest = f.isStaticAtRest, s.collapseAnimation = f.collapseAnimation, s.collapsible = f.collapsible;
|
|
951
|
+
} else if ($(s) && s.id === c.data.id) {
|
|
952
|
+
const f = c.data;
|
|
953
|
+
s.size = f.size;
|
|
954
|
+
}
|
|
955
|
+
o.clearLastKnownSize(), o.commit(), o.onResize(), o.onAutosave();
|
|
956
|
+
break;
|
|
957
|
+
case "setActualItemsSize": {
|
|
958
|
+
const s = n.items.map((p) => {
|
|
959
|
+
if (!P(p))
|
|
960
|
+
return p;
|
|
961
|
+
const v = c.childrenSizes[p.id] || p.lastKnownSize;
|
|
962
|
+
return { ...p, lastKnownSize: v };
|
|
963
|
+
});
|
|
964
|
+
let f = 0, g = !1;
|
|
965
|
+
for (const p of s)
|
|
966
|
+
if (P(p)) {
|
|
967
|
+
const v = (m = p.lastKnownSize) == null ? void 0 : m[n.orientation === "horizontal" ? "width" : "height"];
|
|
968
|
+
if (!v) {
|
|
969
|
+
n.items = s, g = !0;
|
|
970
|
+
break;
|
|
971
|
+
}
|
|
972
|
+
f += v;
|
|
973
|
+
} else
|
|
974
|
+
f += p.size.value.toNumber();
|
|
975
|
+
g ? n.items = s : f > V(n) && r.current !== "dragging" ? n.items = yt({
|
|
976
|
+
...n,
|
|
977
|
+
items: O({ ...n, items: s })
|
|
978
|
+
}).items : n.items = s, o.onResize();
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
case "setSize": {
|
|
982
|
+
n.size = c.size, o.onResize();
|
|
983
|
+
break;
|
|
984
|
+
}
|
|
985
|
+
case "setOrientation":
|
|
986
|
+
n.orientation = c.orientation, o.clearLastKnownSize(), o.onResize();
|
|
987
|
+
break;
|
|
988
|
+
}
|
|
989
|
+
if (r.current === "idle")
|
|
990
|
+
switch (c.type) {
|
|
991
|
+
case "dragHandleStart":
|
|
992
|
+
u("dragging"), n.activeDragHandleId = c.handleId;
|
|
993
|
+
break;
|
|
994
|
+
case "setPanelPixelSize": {
|
|
995
|
+
o.prepare(), o.clearLastKnownSize();
|
|
996
|
+
const s = k(n, c.panelId), f = te(n, c.panelId), g = s.currentValue.value, p = K(n, s, S(n, q(c.size))), v = p > g, h = v ? p.minus(g) : g.minus(p);
|
|
997
|
+
Object.assign(n, ve({
|
|
998
|
+
context: n,
|
|
999
|
+
direction: f.direction * (v ? 1 : -1),
|
|
1000
|
+
handleId: f.item.id,
|
|
1001
|
+
delta: h
|
|
1002
|
+
})), o.commit(), o.onResize(), o.onAutosave();
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
case "collapsePanel":
|
|
1006
|
+
i.shouldNotifyCollapseToggle(c) ? o.notifyCollapseToggle(c) : k(n, c.panelId).collapsed || (u("togglingCollapse"), a.abort(), Re(n, c, d, a).then((f) => {
|
|
1007
|
+
o.onAnimationEnd(f), u("idle");
|
|
1008
|
+
}));
|
|
1009
|
+
break;
|
|
1010
|
+
case "expandPanel":
|
|
1011
|
+
if (i.cannotExpandPanel(c))
|
|
1012
|
+
break;
|
|
1013
|
+
i.shouldNotifyCollapseToggle(c) ? o.notifyCollapseToggle(c) : k(n, c.panelId).collapsed && (u("togglingCollapse"), a.abort(), Re(n, c, d, a).then((f) => {
|
|
1014
|
+
o.onAnimationEnd(f), u("idle");
|
|
1015
|
+
}));
|
|
1016
|
+
break;
|
|
1017
|
+
}
|
|
1018
|
+
else if (r.current === "dragging")
|
|
1019
|
+
switch (c.type) {
|
|
1020
|
+
case "dragHandle":
|
|
1021
|
+
o.clearLastKnownSize(), me(n, ie(n, c)), o.onResize();
|
|
1022
|
+
break;
|
|
1023
|
+
case "dragHandleEnd":
|
|
1024
|
+
u("idle");
|
|
1025
|
+
break;
|
|
1026
|
+
case "expandPanel":
|
|
1027
|
+
case "collapsePanel":
|
|
1028
|
+
i.shouldCollapseToggle(c) && o.runCollapseToggle(c);
|
|
1029
|
+
break;
|
|
1030
|
+
}
|
|
1031
|
+
else if (r.current === "togglingCollapse")
|
|
1032
|
+
switch (c.type) {
|
|
1033
|
+
case "applyDelta":
|
|
1034
|
+
me(n, ie(n, {
|
|
1035
|
+
handleId: c.handleId,
|
|
1036
|
+
disregardCollapseBuffer: !0,
|
|
1037
|
+
value: he({
|
|
1038
|
+
delta: c.delta,
|
|
1039
|
+
orientation: n.orientation
|
|
1040
|
+
})
|
|
1041
|
+
})), o.onResize();
|
|
1042
|
+
break;
|
|
1043
|
+
}
|
|
1044
|
+
t == null || t(n);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
return [n, d, r];
|
|
1048
|
+
}
|
|
1049
|
+
function Ct({ groupId: e, id: t, collapsible: a, collapsed: r }) {
|
|
1050
|
+
return {
|
|
1051
|
+
id: t,
|
|
1052
|
+
"data-splitter-group-id": e,
|
|
1053
|
+
"data-splitter-type": "panel",
|
|
1054
|
+
"data-splitter-id": t,
|
|
1055
|
+
"data-collapsed": a ? r : void 0
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
function xt({ groupId: e, id: t, orientation: a, isDragging: r, activeDragHandleId: l, disabled: n, controlsId: o, min: i, max: u, currentValue: d, groupSize: c }) {
|
|
1059
|
+
return {
|
|
1060
|
+
id: t,
|
|
1061
|
+
role: "separator",
|
|
1062
|
+
"data-splitter-type": "handle",
|
|
1063
|
+
"data-splitter-id": t,
|
|
1064
|
+
"data-splitter-group-id": e,
|
|
1065
|
+
"data-handle-orientation": a,
|
|
1066
|
+
"data-state": r ? "dragging" : l ? "inactive" : "idle",
|
|
1067
|
+
"aria-label": "Resize Handle",
|
|
1068
|
+
"aria-disabled": n,
|
|
1069
|
+
"aria-controls": o,
|
|
1070
|
+
"aria-valuemin": i ? X(c, i) : void 0,
|
|
1071
|
+
"aria-valuemax": u === "1fr" ? 100 : u ? X(c, u) : void 0,
|
|
1072
|
+
"aria-valuenow": d ? X(c, d) : void 0
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
function At(e, t) {
|
|
1076
|
+
const a = new ResizeObserver((l) => {
|
|
1077
|
+
const n = {};
|
|
1078
|
+
for (const o of l) {
|
|
1079
|
+
const u = o.target.getAttribute("data-splitter-id"), d = o.borderBoxSize[0];
|
|
1080
|
+
u && d && (n[u] = {
|
|
1081
|
+
width: d.inlineSize,
|
|
1082
|
+
height: d.blockSize
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
t(n);
|
|
1086
|
+
}), r = document.querySelectorAll(`[data-splitter-group-id="${e}"]`);
|
|
1087
|
+
for (const l of r)
|
|
1088
|
+
a.observe(l);
|
|
1089
|
+
return () => {
|
|
1090
|
+
a.disconnect();
|
|
1091
|
+
};
|
|
1092
|
+
}
|
|
1093
|
+
function Vt(e) {
|
|
1094
|
+
const { onMoveStart: t, onMove: a, onMoveEnd: r } = e, l = { didMove: !1, lastPosition: null, id: null }, n = (s, f, g, p) => {
|
|
1095
|
+
g === 0 && p === 0 || (l.didMove || (l.didMove = !0, t == null || t({
|
|
1096
|
+
type: "movestart",
|
|
1097
|
+
pointerType: f,
|
|
1098
|
+
shiftKey: s.shiftKey,
|
|
1099
|
+
metaKey: s.metaKey,
|
|
1100
|
+
ctrlKey: s.ctrlKey,
|
|
1101
|
+
altKey: s.altKey
|
|
1102
|
+
})), a == null || a({
|
|
1103
|
+
type: "move",
|
|
1104
|
+
pointerType: f,
|
|
1105
|
+
deltaX: g,
|
|
1106
|
+
deltaY: p,
|
|
1107
|
+
shiftKey: s.shiftKey,
|
|
1108
|
+
metaKey: s.metaKey,
|
|
1109
|
+
ctrlKey: s.ctrlKey,
|
|
1110
|
+
altKey: s.altKey
|
|
1111
|
+
}));
|
|
1112
|
+
}, o = (s, f) => {
|
|
1113
|
+
l.didMove && (r == null || r({
|
|
1114
|
+
type: "moveend",
|
|
1115
|
+
pointerType: f,
|
|
1116
|
+
shiftKey: s.shiftKey,
|
|
1117
|
+
metaKey: s.metaKey,
|
|
1118
|
+
ctrlKey: s.ctrlKey,
|
|
1119
|
+
altKey: s.altKey
|
|
1120
|
+
}));
|
|
1121
|
+
}, i = {}, u = () => {
|
|
1122
|
+
l.didMove = !1;
|
|
1123
|
+
}, d = (s) => {
|
|
1124
|
+
var f, g;
|
|
1125
|
+
if (s.pointerId === l.id) {
|
|
1126
|
+
const p = s.pointerType || "mouse";
|
|
1127
|
+
n(s, p, s.pageX - (((f = l.lastPosition) == null ? void 0 : f.pageX) ?? 0), s.pageY - (((g = l.lastPosition) == null ? void 0 : g.pageY) ?? 0)), l.lastPosition = { pageX: s.pageX, pageY: s.pageY };
|
|
1128
|
+
}
|
|
1129
|
+
}, c = (s) => {
|
|
1130
|
+
if (s.pointerId === l.id) {
|
|
1131
|
+
const f = s.pointerType || "mouse";
|
|
1132
|
+
o(s, f), l.id = null, window.removeEventListener("pointermove", d, !1), window.removeEventListener("pointerup", c, !1), window.removeEventListener("pointercancel", c, !1);
|
|
1133
|
+
}
|
|
1134
|
+
};
|
|
1135
|
+
i.onPointerDown = (s) => {
|
|
1136
|
+
s.button === 0 && l.id == null && (u(), s.stopPropagation(), s.preventDefault(), l.lastPosition = { pageX: s.pageX, pageY: s.pageY }, l.id = s.pointerId, window.addEventListener("pointermove", d, !1), window.addEventListener("pointerup", c, !1), window.addEventListener("pointercancel", c, !1));
|
|
1137
|
+
};
|
|
1138
|
+
const m = (s, f, g) => {
|
|
1139
|
+
u(), n(s, "keyboard", f, g), o(s, "keyboard");
|
|
1140
|
+
};
|
|
1141
|
+
return i.onKeyDown = (s) => {
|
|
1142
|
+
switch (s.key) {
|
|
1143
|
+
case "Left":
|
|
1144
|
+
case "ArrowLeft":
|
|
1145
|
+
s.preventDefault(), s.stopPropagation(), m(s, -1, 0);
|
|
1146
|
+
break;
|
|
1147
|
+
case "Right":
|
|
1148
|
+
case "ArrowRight":
|
|
1149
|
+
s.preventDefault(), s.stopPropagation(), m(s, 1, 0);
|
|
1150
|
+
break;
|
|
1151
|
+
case "Up":
|
|
1152
|
+
case "ArrowUp":
|
|
1153
|
+
s.preventDefault(), s.stopPropagation(), m(s, 0, -1);
|
|
1154
|
+
break;
|
|
1155
|
+
case "Down":
|
|
1156
|
+
case "ArrowDown":
|
|
1157
|
+
s.preventDefault(), s.stopPropagation(), m(s, 0, 1);
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
}, { moveProps: i };
|
|
1161
|
+
}
|
|
1162
|
+
const Et = /* @__PURE__ */ ze({
|
|
1163
|
+
__name: "Panel",
|
|
1164
|
+
props: {
|
|
1165
|
+
onResize: {},
|
|
1166
|
+
collapsed: { type: Boolean, default: void 0 },
|
|
1167
|
+
onCollapseChange: {},
|
|
1168
|
+
min: {},
|
|
1169
|
+
max: {},
|
|
1170
|
+
default: {},
|
|
1171
|
+
collapsible: { type: Boolean },
|
|
1172
|
+
defaultCollapsed: { type: Boolean },
|
|
1173
|
+
collapsedSize: {},
|
|
1174
|
+
isStaticAtRest: { type: Boolean },
|
|
1175
|
+
collapseAnimation: {},
|
|
1176
|
+
id: {}
|
|
1177
|
+
},
|
|
1178
|
+
setup(e, { expose: t }) {
|
|
1179
|
+
const a = e, {
|
|
1180
|
+
min: r,
|
|
1181
|
+
max: l,
|
|
1182
|
+
id: n,
|
|
1183
|
+
collapsible: o,
|
|
1184
|
+
collapsedSize: i,
|
|
1185
|
+
onCollapseChange: u,
|
|
1186
|
+
collapseAnimation: d,
|
|
1187
|
+
onResize: c,
|
|
1188
|
+
defaultCollapsed: m,
|
|
1189
|
+
default: s,
|
|
1190
|
+
isStaticAtRest: f,
|
|
1191
|
+
collapsed: g,
|
|
1192
|
+
...p
|
|
1193
|
+
} = a, v = n || be(), h = G("send"), z = G("state"), I = G("isPrerender"), C = () => ct({
|
|
1194
|
+
id: v,
|
|
1195
|
+
min: a.min,
|
|
1196
|
+
max: a.max,
|
|
1197
|
+
collapsible: a.collapsible,
|
|
1198
|
+
collapsed: a.collapsed,
|
|
1199
|
+
collapsedSize: a.collapsedSize,
|
|
1200
|
+
onCollapseChange: a.onCollapseChange ? { current: a.onCollapseChange } : void 0,
|
|
1201
|
+
collapseAnimation: a.collapseAnimation,
|
|
1202
|
+
onResize: a.onResize ? { current: a.onResize } : void 0,
|
|
1203
|
+
defaultCollapsed: m,
|
|
1204
|
+
default: s,
|
|
1205
|
+
isStaticAtRest: f
|
|
1206
|
+
}), A = N(() => {
|
|
1207
|
+
var x;
|
|
1208
|
+
const w = (x = z == null ? void 0 : z.value) == null ? void 0 : x.items.find((U) => U.id === v);
|
|
1209
|
+
if (!(!w || !P(w)))
|
|
1210
|
+
return w;
|
|
1211
|
+
});
|
|
1212
|
+
let E = !1;
|
|
1213
|
+
A.value ? h == null || h({
|
|
1214
|
+
type: "rebindPanelCallbacks",
|
|
1215
|
+
data: {
|
|
1216
|
+
id: v,
|
|
1217
|
+
onCollapseChange: a.onCollapseChange ? { current: a.onCollapseChange } : void 0,
|
|
1218
|
+
onResize: a.onResize ? { current: a.onResize } : void 0
|
|
1219
|
+
}
|
|
1220
|
+
}) : I != null && I.value ? h == null || h({ type: "registerPanel", data: C() }) : E = !0, W(() => {
|
|
1221
|
+
var le;
|
|
1222
|
+
const w = (le = z == null ? void 0 : z.value) == null ? void 0 : le.groupId;
|
|
1223
|
+
if (!w || !E) return;
|
|
1224
|
+
const x = document.getElementById(w);
|
|
1225
|
+
if (!x) return;
|
|
1226
|
+
const U = document.getElementById(v);
|
|
1227
|
+
if (!U) return;
|
|
1228
|
+
const re = Array.from(x.children).indexOf(U);
|
|
1229
|
+
typeof re == "number" && (h == null || h({
|
|
1230
|
+
type: "registerDynamicPanel",
|
|
1231
|
+
data: { ...C(), order: re }
|
|
1232
|
+
}), E = !1);
|
|
1233
|
+
});
|
|
1234
|
+
const L = N(
|
|
1235
|
+
() => !E && dt(C(), A.value)
|
|
1236
|
+
);
|
|
1237
|
+
se(() => {
|
|
1238
|
+
L.value && (h == null || h({ type: "updateConstraints", data: C() }));
|
|
1239
|
+
}), De(() => {
|
|
1240
|
+
requestAnimationFrame(() => h == null ? void 0 : h({ type: "unregisterPanel", id: v }));
|
|
1241
|
+
}), t({
|
|
1242
|
+
getId: () => v,
|
|
1243
|
+
collapse: () => {
|
|
1244
|
+
var w;
|
|
1245
|
+
(w = A.value) != null && w.collapsible && (h == null || h({ type: "collapsePanel", panelId: v, controlled: !0 }));
|
|
1246
|
+
},
|
|
1247
|
+
isCollapsed: () => {
|
|
1248
|
+
var w, x;
|
|
1249
|
+
return !!((w = A.value) != null && w.collapsible && ((x = A.value) != null && x.collapsed));
|
|
1250
|
+
},
|
|
1251
|
+
expand: () => {
|
|
1252
|
+
var w;
|
|
1253
|
+
(w = A.value) != null && w.collapsible && (h == null || h({ type: "expandPanel", panelId: v, controlled: !0 }));
|
|
1254
|
+
},
|
|
1255
|
+
isExpanded: () => {
|
|
1256
|
+
var w, x;
|
|
1257
|
+
return !!((w = A.value) != null && w.collapsible && !((x = A.value) != null && x.collapsed));
|
|
1258
|
+
},
|
|
1259
|
+
getPixelSize: () => wt(z.value, v),
|
|
1260
|
+
getPercentageSize: () => bt(z.value, v),
|
|
1261
|
+
setSize: (w) => h == null ? void 0 : h({ type: "setPanelPixelSize", panelId: v, size: w })
|
|
1262
|
+
});
|
|
1263
|
+
const M = N(
|
|
1264
|
+
() => {
|
|
1265
|
+
var w;
|
|
1266
|
+
return (w = A.value) == null ? void 0 : w.collapseIsControlled;
|
|
1267
|
+
}
|
|
1268
|
+
);
|
|
1269
|
+
se(() => {
|
|
1270
|
+
a.collapsed, requestAnimationFrame(() => {
|
|
1271
|
+
M.value && (a.collapsed ? h == null || h({ type: "collapsePanel", panelId: v, controlled: !0 }) : h == null || h({ type: "expandPanel", panelId: v, controlled: !0 }));
|
|
1272
|
+
});
|
|
1273
|
+
});
|
|
1274
|
+
const R = N(() => {
|
|
1275
|
+
var x;
|
|
1276
|
+
const w = A.value;
|
|
1277
|
+
return {
|
|
1278
|
+
...p,
|
|
1279
|
+
...Ct({
|
|
1280
|
+
groupId: (x = z == null ? void 0 : z.value) == null ? void 0 : x.groupId,
|
|
1281
|
+
id: v,
|
|
1282
|
+
collapsible: w == null ? void 0 : w.collapsible,
|
|
1283
|
+
collapsed: w == null ? void 0 : w.collapsed
|
|
1284
|
+
}),
|
|
1285
|
+
style: {
|
|
1286
|
+
minWidth: 0,
|
|
1287
|
+
minHeight: 0,
|
|
1288
|
+
overflow: "hidden"
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
});
|
|
1292
|
+
return (w, x) => (Ie(), ye("div", Te(Fe(R.value)), [
|
|
1293
|
+
Pe(w.$slots, "default")
|
|
1294
|
+
], 16));
|
|
1295
|
+
}
|
|
1296
|
+
}), Rt = ["id"], Bt = /* @__PURE__ */ ze({
|
|
1297
|
+
__name: "PanelGroup",
|
|
1298
|
+
props: {
|
|
1299
|
+
snapshot: {},
|
|
1300
|
+
autosaveId: {},
|
|
1301
|
+
orientation: { default: "horizontal" },
|
|
1302
|
+
autosaveStrategy: { default: "localStorage" },
|
|
1303
|
+
id: {}
|
|
1304
|
+
},
|
|
1305
|
+
setup(e, { expose: t }) {
|
|
1306
|
+
const a = ke(e, ["orientation", "autosaveStrategy", "snapshot", "autosaveId", "id"]);
|
|
1307
|
+
let r = e.snapshot;
|
|
1308
|
+
if (!r && typeof window < "u" && e.autosaveId && e.autosaveStrategy === "localStorage") {
|
|
1309
|
+
const f = localStorage.getItem(e.autosaveId);
|
|
1310
|
+
f && (r = JSON.parse(f));
|
|
1311
|
+
}
|
|
1312
|
+
const l = de(!0);
|
|
1313
|
+
oe("isPrerender", l);
|
|
1314
|
+
const n = e.autosaveId || e.id || be(), [o, i, u] = St(
|
|
1315
|
+
{
|
|
1316
|
+
orientation: e.orientation,
|
|
1317
|
+
groupId: n,
|
|
1318
|
+
autosaveStrategy: e.autosaveStrategy,
|
|
1319
|
+
...r ? ut(r) : void 0
|
|
1320
|
+
},
|
|
1321
|
+
(f) => {
|
|
1322
|
+
d.value = { ...f };
|
|
1323
|
+
}
|
|
1324
|
+
);
|
|
1325
|
+
W(() => {
|
|
1326
|
+
l.value = !1;
|
|
1327
|
+
});
|
|
1328
|
+
const d = de(o), c = N(() => {
|
|
1329
|
+
const f = Ae(d.value);
|
|
1330
|
+
return {
|
|
1331
|
+
height: "100%",
|
|
1332
|
+
display: "grid",
|
|
1333
|
+
gridTemplateColumns: e.orientation === "horizontal" ? f : void 0,
|
|
1334
|
+
gridTemplateRows: e.orientation === "vertical" ? f : void 0
|
|
1335
|
+
};
|
|
1336
|
+
});
|
|
1337
|
+
oe("send", i), oe("state", d), oe("id", u);
|
|
1338
|
+
const m = de(null);
|
|
1339
|
+
W(() => {
|
|
1340
|
+
const f = new ResizeObserver(([g]) => {
|
|
1341
|
+
g && g.contentRect.width > 0 && g.contentRect.height > 0 && (i == null || i({ type: "setSize", size: g.contentRect }));
|
|
1342
|
+
});
|
|
1343
|
+
return m.value && f.observe(m.value), () => f.disconnect();
|
|
1344
|
+
});
|
|
1345
|
+
const s = N(
|
|
1346
|
+
() => {
|
|
1347
|
+
var f;
|
|
1348
|
+
return (f = d.value) == null ? void 0 : f.items.map((g) => g.id).join(",");
|
|
1349
|
+
}
|
|
1350
|
+
);
|
|
1351
|
+
return W(() => {
|
|
1352
|
+
se(() => {
|
|
1353
|
+
s.value;
|
|
1354
|
+
const f = At(n, (g) => {
|
|
1355
|
+
i({ type: "setActualItemsSize", childrenSizes: g });
|
|
1356
|
+
});
|
|
1357
|
+
je(f);
|
|
1358
|
+
});
|
|
1359
|
+
}), W(() => (i({ type: "unlockGroup" }), () => i({ type: "lockGroup" }))), t({
|
|
1360
|
+
getId: () => n,
|
|
1361
|
+
getPixelSizes: () => vt(d.value),
|
|
1362
|
+
getPercentageSizes: () => zt(d.value),
|
|
1363
|
+
getTemplate: () => Ae({
|
|
1364
|
+
...d.value,
|
|
1365
|
+
items: O(d.value)
|
|
1366
|
+
}),
|
|
1367
|
+
getState: () => u.current === "idle" ? "idle" : "dragging",
|
|
1368
|
+
setSizes: (f) => {
|
|
1369
|
+
var g;
|
|
1370
|
+
for (let p = 0; p < f.length; p++) {
|
|
1371
|
+
const v = (g = d.value) == null ? void 0 : g.items[p], h = f[p];
|
|
1372
|
+
v && P(v) && h && i({
|
|
1373
|
+
type: "setPanelPixelSize",
|
|
1374
|
+
panelId: v.id,
|
|
1375
|
+
size: h
|
|
1376
|
+
});
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
}), (f, g) => (Ie(), ye("div", Ee(a, {
|
|
1380
|
+
id: Ue(n),
|
|
1381
|
+
ref_key: "elementRef",
|
|
1382
|
+
ref: m,
|
|
1383
|
+
"data-panel-group-wrapper": "",
|
|
1384
|
+
style: c.value
|
|
1385
|
+
}), [
|
|
1386
|
+
Pe(f.$slots, "default")
|
|
1387
|
+
], 16, Rt));
|
|
1388
|
+
}
|
|
1389
|
+
}), Dt = ["tabindex"], Kt = /* @__PURE__ */ ze({
|
|
1390
|
+
__name: "PanelResizer",
|
|
1391
|
+
props: {
|
|
1392
|
+
disabled: { type: Boolean },
|
|
1393
|
+
size: { default: "0px" },
|
|
1394
|
+
onDragStart: { type: Function },
|
|
1395
|
+
onDrag: { type: Function },
|
|
1396
|
+
onDragEnd: { type: Function },
|
|
1397
|
+
setSize: { type: Function },
|
|
1398
|
+
id: {}
|
|
1399
|
+
},
|
|
1400
|
+
setup(e) {
|
|
1401
|
+
const t = ke(e, ["size", "id", "onDragStart", "onDrag", "onDragEnd", "disabled"]), r = e.id || be(), l = G("send"), n = G("state"), o = G("isPrerender"), i = () => pt({ size: e.size, id: r }), u = N(() => {
|
|
1402
|
+
var p;
|
|
1403
|
+
const g = (p = n == null ? void 0 : n.value) == null ? void 0 : p.items.find((v) => v.id === r);
|
|
1404
|
+
if (!(!g || !$(g)))
|
|
1405
|
+
return g;
|
|
1406
|
+
});
|
|
1407
|
+
let d = !1;
|
|
1408
|
+
u.value || (o != null && o.value ? l == null || l({ type: "registerPanelHandle", data: i() }) : d = !0), W(() => {
|
|
1409
|
+
var z, I;
|
|
1410
|
+
if (!((z = n == null ? void 0 : n.value) == null ? void 0 : z.groupId) || !d) return;
|
|
1411
|
+
const p = document.getElementById((I = n == null ? void 0 : n.value) == null ? void 0 : I.groupId);
|
|
1412
|
+
if (!p) return;
|
|
1413
|
+
const v = document.getElementById(r);
|
|
1414
|
+
if (!v) return;
|
|
1415
|
+
const h = Array.from(p.children).indexOf(v);
|
|
1416
|
+
typeof h == "number" && (l == null || l({
|
|
1417
|
+
type: "registerPanelHandle",
|
|
1418
|
+
data: { ...i(), order: h }
|
|
1419
|
+
}), d = !1);
|
|
1420
|
+
});
|
|
1421
|
+
const c = N(
|
|
1422
|
+
() => !d && ft(i(), u.value)
|
|
1423
|
+
);
|
|
1424
|
+
se(() => {
|
|
1425
|
+
c.value && (l == null || l({ type: "updateConstraints", data: i() }));
|
|
1426
|
+
}), De(() => {
|
|
1427
|
+
requestAnimationFrame(() => l == null ? void 0 : l({ type: "unregisterPanelHandle", id: r }));
|
|
1428
|
+
});
|
|
1429
|
+
const { moveProps: m } = Vt({
|
|
1430
|
+
onMoveStart: () => {
|
|
1431
|
+
var g;
|
|
1432
|
+
l == null || l({ type: "dragHandleStart", handleId: r }), (g = e.onDragStart) == null || g.call(e), n != null && n.value && (document.body.style.cursor = xe(n == null ? void 0 : n.value) || "auto");
|
|
1433
|
+
},
|
|
1434
|
+
onMove: (g) => {
|
|
1435
|
+
var p;
|
|
1436
|
+
l == null || l({ type: "dragHandle", handleId: r, value: g }), (p = e.onDrag) == null || p.call(e);
|
|
1437
|
+
},
|
|
1438
|
+
onMoveEnd: () => {
|
|
1439
|
+
var g;
|
|
1440
|
+
l == null || l({ type: "dragHandleEnd", handleId: r }), (g = e.onDragEnd) == null || g.call(e), document.body.style.cursor = "auto";
|
|
1441
|
+
}
|
|
1442
|
+
}), s = (g) => {
|
|
1443
|
+
if (n != null && n.value)
|
|
1444
|
+
try {
|
|
1445
|
+
const p = mt(n == null ? void 0 : n.value, r);
|
|
1446
|
+
g.key === "Enter" && p && (p.collapsed ? l == null || l({ type: "expandPanel", panelId: p.id }) : l == null || l({ type: "collapsePanel", panelId: p.id }));
|
|
1447
|
+
} catch {
|
|
1448
|
+
}
|
|
1449
|
+
}, f = N(() => {
|
|
1450
|
+
var h, z, I, C, A, E, L, M, R;
|
|
1451
|
+
const g = (h = n == null ? void 0 : n.value) == null ? void 0 : h.items.findIndex((w) => w.id === r);
|
|
1452
|
+
if (!g) return { id: r };
|
|
1453
|
+
const p = (z = n == null ? void 0 : n.value) == null ? void 0 : z.items[g], v = (I = n == null ? void 0 : n.value) == null ? void 0 : I.items[g - 1];
|
|
1454
|
+
return !v || !P(v) ? { id: r } : {
|
|
1455
|
+
...t,
|
|
1456
|
+
...xt({
|
|
1457
|
+
groupId: (C = n == null ? void 0 : n.value) == null ? void 0 : C.groupId,
|
|
1458
|
+
id: r,
|
|
1459
|
+
orientation: ((A = n == null ? void 0 : n.value) == null ? void 0 : A.orientation) || "horizontal",
|
|
1460
|
+
isDragging: ((E = n == null ? void 0 : n.value) == null ? void 0 : E.activeDragHandleId) === r,
|
|
1461
|
+
activeDragHandleId: (L = n == null ? void 0 : n.value) == null ? void 0 : L.activeDragHandleId,
|
|
1462
|
+
disabled: e.disabled,
|
|
1463
|
+
controlsId: v.id,
|
|
1464
|
+
min: v.min,
|
|
1465
|
+
max: v.max,
|
|
1466
|
+
currentValue: v.currentValue,
|
|
1467
|
+
groupSize: V(n.value)
|
|
1468
|
+
}),
|
|
1469
|
+
onpointerdown: e.disabled ? void 0 : m.onPointerDown,
|
|
1470
|
+
onkeydown: e.disabled ? void 0 : (w) => {
|
|
1471
|
+
m.onKeyDown(w), s(w);
|
|
1472
|
+
},
|
|
1473
|
+
style: {
|
|
1474
|
+
cursor: n != null && n.value ? xe(n.value) : void 0,
|
|
1475
|
+
width: ((M = n == null ? void 0 : n.value) == null ? void 0 : M.orientation) === "horizontal" ? `${p == null ? void 0 : p.size.value.toNumber()}px` : "100%",
|
|
1476
|
+
height: ((R = n == null ? void 0 : n.value) == null ? void 0 : R.orientation) === "vertical" ? `${p == null ? void 0 : p.size.value.toNumber()}px` : "100%"
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
1479
|
+
});
|
|
1480
|
+
return (g, p) => (Ie(), ye("div", Ee(f.value, {
|
|
1481
|
+
"data-panel-resizer": "",
|
|
1482
|
+
tabindex: g.disabled ? -1 : 0
|
|
1483
|
+
}), [
|
|
1484
|
+
Pe(g.$slots, "default")
|
|
1485
|
+
], 16, Dt));
|
|
1486
|
+
}
|
|
1487
|
+
});
|
|
1488
|
+
export {
|
|
1489
|
+
Et as Panel,
|
|
1490
|
+
Bt as PanelGroup,
|
|
1491
|
+
Kt as PanelResizer
|
|
1492
|
+
};
|
|
1493
|
+
//# sourceMappingURL=index.mjs.map
|