@depup/react-resizable-panels 4.7.3-depup.0
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/LICENSE.md +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/react-resizable-panels.cjs +2 -0
- package/dist/react-resizable-panels.cjs.map +1 -0
- package/dist/react-resizable-panels.d.ts +477 -0
- package/dist/react-resizable-panels.js +2104 -0
- package/dist/react-resizable-panels.js.map +1 -0
- package/package.json +141 -0
|
@@ -0,0 +1,2104 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as ie } from "react/jsx-runtime";
|
|
3
|
+
import { useState as re, useCallback as ne, useId as pt, useLayoutEffect as Be, useEffect as de, useRef as T, createContext as ht, useImperativeHandle as We, useMemo as Ue, useSyncExternalStore as Ke, useContext as mt } from "react";
|
|
4
|
+
function gt(e, t) {
|
|
5
|
+
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
6
|
+
return t * o;
|
|
7
|
+
}
|
|
8
|
+
function St(e, t) {
|
|
9
|
+
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
10
|
+
return t * o;
|
|
11
|
+
}
|
|
12
|
+
function yt(e) {
|
|
13
|
+
return e / 100 * window.innerHeight;
|
|
14
|
+
}
|
|
15
|
+
function vt(e) {
|
|
16
|
+
return e / 100 * window.innerWidth;
|
|
17
|
+
}
|
|
18
|
+
function zt(e) {
|
|
19
|
+
switch (typeof e) {
|
|
20
|
+
case "number":
|
|
21
|
+
return [e, "px"];
|
|
22
|
+
case "string": {
|
|
23
|
+
const t = parseFloat(e);
|
|
24
|
+
return e.endsWith("%") ? [t, "%"] : e.endsWith("px") ? [t, "px"] : e.endsWith("rem") ? [t, "rem"] : e.endsWith("em") ? [t, "em"] : e.endsWith("vh") ? [t, "vh"] : e.endsWith("vw") ? [t, "vw"] : [t, "%"];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function te({
|
|
29
|
+
groupSize: e,
|
|
30
|
+
panelElement: t,
|
|
31
|
+
styleProp: n
|
|
32
|
+
}) {
|
|
33
|
+
let o;
|
|
34
|
+
const [i, s] = zt(n);
|
|
35
|
+
switch (s) {
|
|
36
|
+
case "%": {
|
|
37
|
+
o = i / 100 * e;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "px": {
|
|
41
|
+
o = i;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
case "rem": {
|
|
45
|
+
o = St(t, i);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "em": {
|
|
49
|
+
o = gt(t, i);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "vh": {
|
|
53
|
+
o = yt(i);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "vw": {
|
|
57
|
+
o = vt(i);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return o;
|
|
62
|
+
}
|
|
63
|
+
function D(e) {
|
|
64
|
+
return parseFloat(e.toFixed(3));
|
|
65
|
+
}
|
|
66
|
+
function Q({
|
|
67
|
+
group: e
|
|
68
|
+
}) {
|
|
69
|
+
const { orientation: t, panels: n } = e;
|
|
70
|
+
return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
|
|
71
|
+
}
|
|
72
|
+
function ge(e) {
|
|
73
|
+
const { panels: t } = e, n = Q({ group: e });
|
|
74
|
+
return n === 0 ? t.map((o) => ({
|
|
75
|
+
groupResizeBehavior: o.panelConstraints.groupResizeBehavior,
|
|
76
|
+
collapsedSize: 0,
|
|
77
|
+
collapsible: o.panelConstraints.collapsible === !0,
|
|
78
|
+
defaultSize: void 0,
|
|
79
|
+
disabled: o.panelConstraints.disabled,
|
|
80
|
+
minSize: 0,
|
|
81
|
+
maxSize: 100,
|
|
82
|
+
panelId: o.id
|
|
83
|
+
})) : t.map((o) => {
|
|
84
|
+
const { element: i, panelConstraints: s } = o;
|
|
85
|
+
let l = 0;
|
|
86
|
+
if (s.collapsedSize !== void 0) {
|
|
87
|
+
const c = te({
|
|
88
|
+
groupSize: n,
|
|
89
|
+
panelElement: i,
|
|
90
|
+
styleProp: s.collapsedSize
|
|
91
|
+
});
|
|
92
|
+
l = D(c / n * 100);
|
|
93
|
+
}
|
|
94
|
+
let r;
|
|
95
|
+
if (s.defaultSize !== void 0) {
|
|
96
|
+
const c = te({
|
|
97
|
+
groupSize: n,
|
|
98
|
+
panelElement: i,
|
|
99
|
+
styleProp: s.defaultSize
|
|
100
|
+
});
|
|
101
|
+
r = D(c / n * 100);
|
|
102
|
+
}
|
|
103
|
+
let a = 0;
|
|
104
|
+
if (s.minSize !== void 0) {
|
|
105
|
+
const c = te({
|
|
106
|
+
groupSize: n,
|
|
107
|
+
panelElement: i,
|
|
108
|
+
styleProp: s.minSize
|
|
109
|
+
});
|
|
110
|
+
a = D(c / n * 100);
|
|
111
|
+
}
|
|
112
|
+
let u = 100;
|
|
113
|
+
if (s.maxSize !== void 0) {
|
|
114
|
+
const c = te({
|
|
115
|
+
groupSize: n,
|
|
116
|
+
panelElement: i,
|
|
117
|
+
styleProp: s.maxSize
|
|
118
|
+
});
|
|
119
|
+
u = D(c / n * 100);
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
groupResizeBehavior: s.groupResizeBehavior,
|
|
123
|
+
collapsedSize: l,
|
|
124
|
+
collapsible: s.collapsible === !0,
|
|
125
|
+
defaultSize: r,
|
|
126
|
+
disabled: s.disabled,
|
|
127
|
+
minSize: a,
|
|
128
|
+
maxSize: u,
|
|
129
|
+
panelId: o.id
|
|
130
|
+
};
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function L(e, t = "Assertion error") {
|
|
134
|
+
if (!e)
|
|
135
|
+
throw Error(t);
|
|
136
|
+
}
|
|
137
|
+
function Se(e, t) {
|
|
138
|
+
return Array.from(t).sort(
|
|
139
|
+
e === "horizontal" ? bt : xt
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
function bt(e, t) {
|
|
143
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
144
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
145
|
+
}
|
|
146
|
+
function xt(e, t) {
|
|
147
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
148
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
149
|
+
}
|
|
150
|
+
function Xe(e) {
|
|
151
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
|
|
152
|
+
}
|
|
153
|
+
function qe(e, t) {
|
|
154
|
+
return {
|
|
155
|
+
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
156
|
+
Math.abs(e.x - t.left),
|
|
157
|
+
Math.abs(e.x - t.right)
|
|
158
|
+
),
|
|
159
|
+
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(
|
|
160
|
+
Math.abs(e.y - t.top),
|
|
161
|
+
Math.abs(e.y - t.bottom)
|
|
162
|
+
)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function wt({
|
|
166
|
+
orientation: e,
|
|
167
|
+
rects: t,
|
|
168
|
+
targetRect: n
|
|
169
|
+
}) {
|
|
170
|
+
const o = {
|
|
171
|
+
x: n.x + n.width / 2,
|
|
172
|
+
y: n.y + n.height / 2
|
|
173
|
+
};
|
|
174
|
+
let i, s = Number.MAX_VALUE;
|
|
175
|
+
for (const l of t) {
|
|
176
|
+
const { x: r, y: a } = qe(o, l), u = e === "horizontal" ? r : a;
|
|
177
|
+
u < s && (s = u, i = l);
|
|
178
|
+
}
|
|
179
|
+
return L(i, "No rect found"), i;
|
|
180
|
+
}
|
|
181
|
+
let ue;
|
|
182
|
+
function Pt() {
|
|
183
|
+
return ue === void 0 && (typeof matchMedia == "function" ? ue = !!matchMedia("(pointer:coarse)").matches : ue = !1), ue;
|
|
184
|
+
}
|
|
185
|
+
function Ye(e) {
|
|
186
|
+
const { element: t, orientation: n, panels: o, separators: i } = e, s = Se(
|
|
187
|
+
n,
|
|
188
|
+
Array.from(t.children).filter(Xe).map((x) => ({ element: x }))
|
|
189
|
+
).map(({ element: x }) => x), l = [];
|
|
190
|
+
let r = !1, a = !1, u = -1, c = -1, m = 0, d, v = [];
|
|
191
|
+
{
|
|
192
|
+
let x = -1;
|
|
193
|
+
for (const f of s)
|
|
194
|
+
f.hasAttribute("data-panel") && (x++, f.ariaDisabled === null && (m++, u === -1 && (u = x), c = x));
|
|
195
|
+
}
|
|
196
|
+
if (m > 1) {
|
|
197
|
+
let x = -1;
|
|
198
|
+
for (const f of s)
|
|
199
|
+
if (f.hasAttribute("data-panel")) {
|
|
200
|
+
x++;
|
|
201
|
+
const h = o.find(
|
|
202
|
+
(g) => g.element === f
|
|
203
|
+
);
|
|
204
|
+
if (h) {
|
|
205
|
+
if (d) {
|
|
206
|
+
const g = d.element.getBoundingClientRect(), y = f.getBoundingClientRect();
|
|
207
|
+
let z;
|
|
208
|
+
if (a) {
|
|
209
|
+
const S = n === "horizontal" ? new DOMRect(
|
|
210
|
+
g.right,
|
|
211
|
+
g.top,
|
|
212
|
+
0,
|
|
213
|
+
g.height
|
|
214
|
+
) : new DOMRect(
|
|
215
|
+
g.left,
|
|
216
|
+
g.bottom,
|
|
217
|
+
g.width,
|
|
218
|
+
0
|
|
219
|
+
), p = n === "horizontal" ? new DOMRect(y.left, y.top, 0, y.height) : new DOMRect(y.left, y.top, y.width, 0);
|
|
220
|
+
switch (v.length) {
|
|
221
|
+
case 0: {
|
|
222
|
+
z = [
|
|
223
|
+
S,
|
|
224
|
+
p
|
|
225
|
+
];
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
case 1: {
|
|
229
|
+
const P = v[0], R = wt({
|
|
230
|
+
orientation: n,
|
|
231
|
+
rects: [g, y],
|
|
232
|
+
targetRect: P.element.getBoundingClientRect()
|
|
233
|
+
});
|
|
234
|
+
z = [
|
|
235
|
+
P,
|
|
236
|
+
R === g ? p : S
|
|
237
|
+
];
|
|
238
|
+
break;
|
|
239
|
+
}
|
|
240
|
+
default: {
|
|
241
|
+
z = v;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} else
|
|
246
|
+
v.length ? z = v : z = [
|
|
247
|
+
n === "horizontal" ? new DOMRect(
|
|
248
|
+
g.right,
|
|
249
|
+
y.top,
|
|
250
|
+
y.left - g.right,
|
|
251
|
+
y.height
|
|
252
|
+
) : new DOMRect(
|
|
253
|
+
y.left,
|
|
254
|
+
g.bottom,
|
|
255
|
+
y.width,
|
|
256
|
+
y.top - g.bottom
|
|
257
|
+
)
|
|
258
|
+
];
|
|
259
|
+
for (const S of z) {
|
|
260
|
+
let p = "width" in S ? S : S.element.getBoundingClientRect();
|
|
261
|
+
const P = Pt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
|
|
262
|
+
if (p.width < P) {
|
|
263
|
+
const C = P - p.width;
|
|
264
|
+
p = new DOMRect(
|
|
265
|
+
p.x - C / 2,
|
|
266
|
+
p.y,
|
|
267
|
+
p.width + C,
|
|
268
|
+
p.height
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (p.height < P) {
|
|
272
|
+
const C = P - p.height;
|
|
273
|
+
p = new DOMRect(
|
|
274
|
+
p.x,
|
|
275
|
+
p.y - C / 2,
|
|
276
|
+
p.width,
|
|
277
|
+
p.height + C
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
const R = x <= u || x > c;
|
|
281
|
+
!r && !R && l.push({
|
|
282
|
+
group: e,
|
|
283
|
+
groupSize: Q({ group: e }),
|
|
284
|
+
panels: [d, h],
|
|
285
|
+
separator: "width" in S ? void 0 : S,
|
|
286
|
+
rect: p
|
|
287
|
+
}), r = !1;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
a = !1, d = h, v = [];
|
|
291
|
+
}
|
|
292
|
+
} else if (f.hasAttribute("data-separator")) {
|
|
293
|
+
f.ariaDisabled !== null && (r = !0);
|
|
294
|
+
const h = i.find(
|
|
295
|
+
(g) => g.element === f
|
|
296
|
+
);
|
|
297
|
+
h ? v.push(h) : (d = void 0, v = []);
|
|
298
|
+
} else
|
|
299
|
+
a = !0;
|
|
300
|
+
}
|
|
301
|
+
return l;
|
|
302
|
+
}
|
|
303
|
+
class Je {
|
|
304
|
+
#e = {};
|
|
305
|
+
addListener(t, n) {
|
|
306
|
+
const o = this.#e[t];
|
|
307
|
+
return o === void 0 ? this.#e[t] = [n] : o.includes(n) || o.push(n), () => {
|
|
308
|
+
this.removeListener(t, n);
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
emit(t, n) {
|
|
312
|
+
const o = this.#e[t];
|
|
313
|
+
if (o !== void 0)
|
|
314
|
+
if (o.length === 1)
|
|
315
|
+
o[0].call(null, n);
|
|
316
|
+
else {
|
|
317
|
+
let i = !1, s = null;
|
|
318
|
+
const l = Array.from(o);
|
|
319
|
+
for (let r = 0; r < l.length; r++) {
|
|
320
|
+
const a = l[r];
|
|
321
|
+
try {
|
|
322
|
+
a.call(null, n);
|
|
323
|
+
} catch (u) {
|
|
324
|
+
s === null && (i = !0, s = u);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if (i)
|
|
328
|
+
throw s;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
removeAllListeners() {
|
|
332
|
+
this.#e = {};
|
|
333
|
+
}
|
|
334
|
+
removeListener(t, n) {
|
|
335
|
+
const o = this.#e[t];
|
|
336
|
+
if (o !== void 0) {
|
|
337
|
+
const i = o.indexOf(n);
|
|
338
|
+
i >= 0 && o.splice(i, 1);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
let A = /* @__PURE__ */ new Map();
|
|
343
|
+
const Ze = new Je();
|
|
344
|
+
function Lt(e) {
|
|
345
|
+
A = new Map(A), A.delete(e);
|
|
346
|
+
}
|
|
347
|
+
function Me(e, t) {
|
|
348
|
+
for (const [n] of A)
|
|
349
|
+
if (n.id === e)
|
|
350
|
+
return n;
|
|
351
|
+
}
|
|
352
|
+
function $(e, t) {
|
|
353
|
+
for (const [n, o] of A)
|
|
354
|
+
if (n.id === e)
|
|
355
|
+
return o;
|
|
356
|
+
if (t)
|
|
357
|
+
throw Error(`Could not find data for Group with id ${e}`);
|
|
358
|
+
}
|
|
359
|
+
function U() {
|
|
360
|
+
return A;
|
|
361
|
+
}
|
|
362
|
+
function ye(e, t) {
|
|
363
|
+
return Ze.addListener("groupChange", (n) => {
|
|
364
|
+
n.group.id === e && t(n);
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
function _(e, t) {
|
|
368
|
+
const n = A.get(e);
|
|
369
|
+
A = new Map(A), A.set(e, t), Ze.emit("groupChange", {
|
|
370
|
+
group: e,
|
|
371
|
+
prev: n,
|
|
372
|
+
next: t
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function Ct(e, t, n) {
|
|
376
|
+
let o, i = {
|
|
377
|
+
x: 1 / 0,
|
|
378
|
+
y: 1 / 0
|
|
379
|
+
};
|
|
380
|
+
for (const s of t) {
|
|
381
|
+
const l = qe(n, s.rect);
|
|
382
|
+
switch (e) {
|
|
383
|
+
case "horizontal": {
|
|
384
|
+
l.x <= i.x && (o = s, i = l);
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
case "vertical": {
|
|
388
|
+
l.y <= i.y && (o = s, i = l);
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return o ? {
|
|
394
|
+
distance: i,
|
|
395
|
+
hitRegion: o
|
|
396
|
+
} : void 0;
|
|
397
|
+
}
|
|
398
|
+
function Rt(e) {
|
|
399
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
400
|
+
}
|
|
401
|
+
function Mt(e, t) {
|
|
402
|
+
if (e === t) throw new Error("Cannot compare node with itself");
|
|
403
|
+
const n = {
|
|
404
|
+
a: ke(e),
|
|
405
|
+
b: ke(t)
|
|
406
|
+
};
|
|
407
|
+
let o;
|
|
408
|
+
for (; n.a.at(-1) === n.b.at(-1); )
|
|
409
|
+
o = n.a.pop(), n.b.pop();
|
|
410
|
+
L(
|
|
411
|
+
o,
|
|
412
|
+
"Stacking order can only be calculated for elements with a common ancestor"
|
|
413
|
+
);
|
|
414
|
+
const i = {
|
|
415
|
+
a: Ie(Ee(n.a)),
|
|
416
|
+
b: Ie(Ee(n.b))
|
|
417
|
+
};
|
|
418
|
+
if (i.a === i.b) {
|
|
419
|
+
const s = o.childNodes, l = {
|
|
420
|
+
a: n.a.at(-1),
|
|
421
|
+
b: n.b.at(-1)
|
|
422
|
+
};
|
|
423
|
+
let r = s.length;
|
|
424
|
+
for (; r--; ) {
|
|
425
|
+
const a = s[r];
|
|
426
|
+
if (a === l.a) return 1;
|
|
427
|
+
if (a === l.b) return -1;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return Math.sign(i.a - i.b);
|
|
431
|
+
}
|
|
432
|
+
const Et = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
433
|
+
function It(e) {
|
|
434
|
+
const t = getComputedStyle(Qe(e) ?? e).display;
|
|
435
|
+
return t === "flex" || t === "inline-flex";
|
|
436
|
+
}
|
|
437
|
+
function kt(e) {
|
|
438
|
+
const t = getComputedStyle(e);
|
|
439
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || It(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || Et.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
440
|
+
}
|
|
441
|
+
function Ee(e) {
|
|
442
|
+
let t = e.length;
|
|
443
|
+
for (; t--; ) {
|
|
444
|
+
const n = e[t];
|
|
445
|
+
if (L(n, "Missing node"), kt(n)) return n;
|
|
446
|
+
}
|
|
447
|
+
return null;
|
|
448
|
+
}
|
|
449
|
+
function Ie(e) {
|
|
450
|
+
return e && Number(getComputedStyle(e).zIndex) || 0;
|
|
451
|
+
}
|
|
452
|
+
function ke(e) {
|
|
453
|
+
const t = [];
|
|
454
|
+
for (; e; )
|
|
455
|
+
t.push(e), e = Qe(e);
|
|
456
|
+
return t;
|
|
457
|
+
}
|
|
458
|
+
function Qe(e) {
|
|
459
|
+
const { parentNode: t } = e;
|
|
460
|
+
return Rt(t) ? t.host : t;
|
|
461
|
+
}
|
|
462
|
+
function Dt(e, t) {
|
|
463
|
+
return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
|
|
464
|
+
}
|
|
465
|
+
function Tt({
|
|
466
|
+
groupElement: e,
|
|
467
|
+
hitRegion: t,
|
|
468
|
+
pointerEventTarget: n
|
|
469
|
+
}) {
|
|
470
|
+
if (!Xe(n) || n.contains(e) || e.contains(n))
|
|
471
|
+
return !0;
|
|
472
|
+
if (Mt(n, e) > 0) {
|
|
473
|
+
let o = n;
|
|
474
|
+
for (; o; ) {
|
|
475
|
+
if (o.contains(e))
|
|
476
|
+
return !0;
|
|
477
|
+
if (Dt(o.getBoundingClientRect(), t))
|
|
478
|
+
return !1;
|
|
479
|
+
o = o.parentElement;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return !0;
|
|
483
|
+
}
|
|
484
|
+
function ve(e, t) {
|
|
485
|
+
const n = [];
|
|
486
|
+
return t.forEach((o, i) => {
|
|
487
|
+
if (i.disabled)
|
|
488
|
+
return;
|
|
489
|
+
const s = Ye(i), l = Ct(i.orientation, s, {
|
|
490
|
+
x: e.clientX,
|
|
491
|
+
y: e.clientY
|
|
492
|
+
});
|
|
493
|
+
l && l.distance.x <= 0 && l.distance.y <= 0 && Tt({
|
|
494
|
+
groupElement: i.element,
|
|
495
|
+
hitRegion: l.hitRegion.rect,
|
|
496
|
+
pointerEventTarget: e.target
|
|
497
|
+
}) && n.push(l.hitRegion);
|
|
498
|
+
}), n;
|
|
499
|
+
}
|
|
500
|
+
function Ot(e, t) {
|
|
501
|
+
if (e.length !== t.length)
|
|
502
|
+
return !1;
|
|
503
|
+
for (let n = 0; n < e.length; n++)
|
|
504
|
+
if (e[n] != t[n])
|
|
505
|
+
return !1;
|
|
506
|
+
return !0;
|
|
507
|
+
}
|
|
508
|
+
function I(e, t, n = 0) {
|
|
509
|
+
return Math.abs(D(e) - D(t)) <= n;
|
|
510
|
+
}
|
|
511
|
+
function G(e, t) {
|
|
512
|
+
return I(e, t) ? 0 : e > t ? 1 : -1;
|
|
513
|
+
}
|
|
514
|
+
function Y({
|
|
515
|
+
overrideDisabledPanels: e,
|
|
516
|
+
panelConstraints: t,
|
|
517
|
+
prevSize: n,
|
|
518
|
+
size: o
|
|
519
|
+
}) {
|
|
520
|
+
const {
|
|
521
|
+
collapsedSize: i = 0,
|
|
522
|
+
collapsible: s,
|
|
523
|
+
disabled: l,
|
|
524
|
+
maxSize: r = 100,
|
|
525
|
+
minSize: a = 0
|
|
526
|
+
} = t;
|
|
527
|
+
if (l && !e)
|
|
528
|
+
return n;
|
|
529
|
+
if (G(o, a) < 0)
|
|
530
|
+
if (s) {
|
|
531
|
+
const u = (i + a) / 2;
|
|
532
|
+
G(o, u) < 0 ? o = i : o = a;
|
|
533
|
+
} else
|
|
534
|
+
o = a;
|
|
535
|
+
return o = Math.min(r, o), o = D(o), o;
|
|
536
|
+
}
|
|
537
|
+
function se({
|
|
538
|
+
delta: e,
|
|
539
|
+
initialLayout: t,
|
|
540
|
+
panelConstraints: n,
|
|
541
|
+
pivotIndices: o,
|
|
542
|
+
prevLayout: i,
|
|
543
|
+
trigger: s
|
|
544
|
+
}) {
|
|
545
|
+
if (I(e, 0))
|
|
546
|
+
return t;
|
|
547
|
+
const l = s === "imperative-api", r = Object.values(t), a = Object.values(i), u = [...r], [c, m] = o;
|
|
548
|
+
L(c != null, "Invalid first pivot index"), L(m != null, "Invalid second pivot index");
|
|
549
|
+
let d = 0;
|
|
550
|
+
switch (s) {
|
|
551
|
+
case "keyboard": {
|
|
552
|
+
{
|
|
553
|
+
const f = e < 0 ? m : c, h = n[f];
|
|
554
|
+
L(
|
|
555
|
+
h,
|
|
556
|
+
`Panel constraints not found for index ${f}`
|
|
557
|
+
);
|
|
558
|
+
const {
|
|
559
|
+
collapsedSize: g = 0,
|
|
560
|
+
collapsible: y,
|
|
561
|
+
minSize: z = 0
|
|
562
|
+
} = h;
|
|
563
|
+
if (y) {
|
|
564
|
+
const S = r[f];
|
|
565
|
+
if (L(
|
|
566
|
+
S != null,
|
|
567
|
+
`Previous layout not found for panel index ${f}`
|
|
568
|
+
), I(S, g)) {
|
|
569
|
+
const p = z - S;
|
|
570
|
+
G(p, Math.abs(e)) > 0 && (e = e < 0 ? 0 - p : p);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
{
|
|
575
|
+
const f = e < 0 ? c : m, h = n[f];
|
|
576
|
+
L(
|
|
577
|
+
h,
|
|
578
|
+
`No panel constraints found for index ${f}`
|
|
579
|
+
);
|
|
580
|
+
const {
|
|
581
|
+
collapsedSize: g = 0,
|
|
582
|
+
collapsible: y,
|
|
583
|
+
minSize: z = 0
|
|
584
|
+
} = h;
|
|
585
|
+
if (y) {
|
|
586
|
+
const S = r[f];
|
|
587
|
+
if (L(
|
|
588
|
+
S != null,
|
|
589
|
+
`Previous layout not found for panel index ${f}`
|
|
590
|
+
), I(S, z)) {
|
|
591
|
+
const p = S - g;
|
|
592
|
+
G(p, Math.abs(e)) > 0 && (e = e < 0 ? 0 - p : p);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
default: {
|
|
599
|
+
const f = e < 0 ? m : c, h = n[f];
|
|
600
|
+
L(
|
|
601
|
+
h,
|
|
602
|
+
`Panel constraints not found for index ${f}`
|
|
603
|
+
);
|
|
604
|
+
const g = r[f], { collapsible: y, collapsedSize: z, minSize: S } = h;
|
|
605
|
+
if (y && G(g, S) < 0)
|
|
606
|
+
if (e > 0) {
|
|
607
|
+
const p = S - z, P = p / 2, R = g + e;
|
|
608
|
+
G(R, S) < 0 && (e = G(e, P) <= 0 ? 0 : p);
|
|
609
|
+
} else {
|
|
610
|
+
const p = S - z, P = 100 - p / 2, R = g - e;
|
|
611
|
+
G(R, S) < 0 && (e = G(100 + e, P) > 0 ? 0 : -p);
|
|
612
|
+
}
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
{
|
|
617
|
+
const f = e < 0 ? 1 : -1;
|
|
618
|
+
let h = e < 0 ? m : c, g = 0;
|
|
619
|
+
for (; ; ) {
|
|
620
|
+
const z = r[h];
|
|
621
|
+
L(
|
|
622
|
+
z != null,
|
|
623
|
+
`Previous layout not found for panel index ${h}`
|
|
624
|
+
);
|
|
625
|
+
const p = Y({
|
|
626
|
+
overrideDisabledPanels: l,
|
|
627
|
+
panelConstraints: n[h],
|
|
628
|
+
prevSize: z,
|
|
629
|
+
size: 100
|
|
630
|
+
}) - z;
|
|
631
|
+
if (g += p, h += f, h < 0 || h >= n.length)
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
const y = Math.min(Math.abs(e), Math.abs(g));
|
|
635
|
+
e = e < 0 ? 0 - y : y;
|
|
636
|
+
}
|
|
637
|
+
{
|
|
638
|
+
let h = e < 0 ? c : m;
|
|
639
|
+
for (; h >= 0 && h < n.length; ) {
|
|
640
|
+
const g = Math.abs(e) - Math.abs(d), y = r[h];
|
|
641
|
+
L(
|
|
642
|
+
y != null,
|
|
643
|
+
`Previous layout not found for panel index ${h}`
|
|
644
|
+
);
|
|
645
|
+
const z = y - g, S = Y({
|
|
646
|
+
overrideDisabledPanels: l,
|
|
647
|
+
panelConstraints: n[h],
|
|
648
|
+
prevSize: y,
|
|
649
|
+
size: z
|
|
650
|
+
});
|
|
651
|
+
if (!I(y, S) && (d += y - S, u[h] = S, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
652
|
+
numeric: !0
|
|
653
|
+
}) >= 0))
|
|
654
|
+
break;
|
|
655
|
+
e < 0 ? h-- : h++;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
if (Ot(a, u))
|
|
659
|
+
return i;
|
|
660
|
+
{
|
|
661
|
+
const f = e < 0 ? m : c, h = r[f];
|
|
662
|
+
L(
|
|
663
|
+
h != null,
|
|
664
|
+
`Previous layout not found for panel index ${f}`
|
|
665
|
+
);
|
|
666
|
+
const g = h + d, y = Y({
|
|
667
|
+
overrideDisabledPanels: l,
|
|
668
|
+
panelConstraints: n[f],
|
|
669
|
+
prevSize: h,
|
|
670
|
+
size: g
|
|
671
|
+
});
|
|
672
|
+
if (u[f] = y, !I(y, g)) {
|
|
673
|
+
let z = g - y, p = e < 0 ? m : c;
|
|
674
|
+
for (; p >= 0 && p < n.length; ) {
|
|
675
|
+
const P = u[p];
|
|
676
|
+
L(
|
|
677
|
+
P != null,
|
|
678
|
+
`Previous layout not found for panel index ${p}`
|
|
679
|
+
);
|
|
680
|
+
const R = P + z, C = Y({
|
|
681
|
+
overrideDisabledPanels: l,
|
|
682
|
+
panelConstraints: n[p],
|
|
683
|
+
prevSize: P,
|
|
684
|
+
size: R
|
|
685
|
+
});
|
|
686
|
+
if (I(P, C) || (z -= C - P, u[p] = C), I(z, 0))
|
|
687
|
+
break;
|
|
688
|
+
e > 0 ? p-- : p++;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
const v = Object.values(u).reduce(
|
|
693
|
+
(f, h) => h + f,
|
|
694
|
+
0
|
|
695
|
+
);
|
|
696
|
+
if (!I(v, 100, 0.1))
|
|
697
|
+
return i;
|
|
698
|
+
const x = Object.keys(i);
|
|
699
|
+
return u.reduce((f, h, g) => (f[x[g]] = h, f), {});
|
|
700
|
+
}
|
|
701
|
+
function j(e, t) {
|
|
702
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
703
|
+
return !1;
|
|
704
|
+
for (const n in e)
|
|
705
|
+
if (t[n] === void 0 || G(e[n], t[n]) !== 0)
|
|
706
|
+
return !1;
|
|
707
|
+
return !0;
|
|
708
|
+
}
|
|
709
|
+
function B({
|
|
710
|
+
layout: e,
|
|
711
|
+
panelConstraints: t
|
|
712
|
+
}) {
|
|
713
|
+
const n = Object.values(e), o = [...n], i = o.reduce(
|
|
714
|
+
(r, a) => r + a,
|
|
715
|
+
0
|
|
716
|
+
);
|
|
717
|
+
if (o.length !== t.length)
|
|
718
|
+
throw Error(
|
|
719
|
+
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
720
|
+
);
|
|
721
|
+
if (!I(i, 100) && o.length > 0)
|
|
722
|
+
for (let r = 0; r < t.length; r++) {
|
|
723
|
+
const a = o[r];
|
|
724
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
725
|
+
const u = 100 / i * a;
|
|
726
|
+
o[r] = u;
|
|
727
|
+
}
|
|
728
|
+
let s = 0;
|
|
729
|
+
for (let r = 0; r < t.length; r++) {
|
|
730
|
+
const a = n[r];
|
|
731
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
732
|
+
const u = o[r];
|
|
733
|
+
L(u != null, `No layout data found for index ${r}`);
|
|
734
|
+
const c = Y({
|
|
735
|
+
overrideDisabledPanels: !0,
|
|
736
|
+
panelConstraints: t[r],
|
|
737
|
+
prevSize: a,
|
|
738
|
+
size: u
|
|
739
|
+
});
|
|
740
|
+
u != c && (s += u - c, o[r] = c);
|
|
741
|
+
}
|
|
742
|
+
if (!I(s, 0))
|
|
743
|
+
for (let r = 0; r < t.length; r++) {
|
|
744
|
+
const a = o[r];
|
|
745
|
+
L(a != null, `No layout data found for index ${r}`);
|
|
746
|
+
const u = a + s, c = Y({
|
|
747
|
+
overrideDisabledPanels: !0,
|
|
748
|
+
panelConstraints: t[r],
|
|
749
|
+
prevSize: a,
|
|
750
|
+
size: u
|
|
751
|
+
});
|
|
752
|
+
if (a !== c && (s -= c - a, o[r] = c, I(s, 0)))
|
|
753
|
+
break;
|
|
754
|
+
}
|
|
755
|
+
const l = Object.keys(e);
|
|
756
|
+
return o.reduce((r, a, u) => (r[l[u]] = a, r), {});
|
|
757
|
+
}
|
|
758
|
+
function et({
|
|
759
|
+
groupId: e,
|
|
760
|
+
panelId: t
|
|
761
|
+
}) {
|
|
762
|
+
const n = () => {
|
|
763
|
+
const r = U();
|
|
764
|
+
for (const [
|
|
765
|
+
a,
|
|
766
|
+
{
|
|
767
|
+
defaultLayoutDeferred: u,
|
|
768
|
+
derivedPanelConstraints: c,
|
|
769
|
+
layout: m,
|
|
770
|
+
groupSize: d,
|
|
771
|
+
separatorToPanels: v
|
|
772
|
+
}
|
|
773
|
+
] of r)
|
|
774
|
+
if (a.id === e)
|
|
775
|
+
return {
|
|
776
|
+
defaultLayoutDeferred: u,
|
|
777
|
+
derivedPanelConstraints: c,
|
|
778
|
+
group: a,
|
|
779
|
+
groupSize: d,
|
|
780
|
+
layout: m,
|
|
781
|
+
separatorToPanels: v
|
|
782
|
+
};
|
|
783
|
+
throw Error(`Group ${e} not found`);
|
|
784
|
+
}, o = () => {
|
|
785
|
+
const r = n().derivedPanelConstraints.find(
|
|
786
|
+
(a) => a.panelId === t
|
|
787
|
+
);
|
|
788
|
+
if (r !== void 0)
|
|
789
|
+
return r;
|
|
790
|
+
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
791
|
+
}, i = () => {
|
|
792
|
+
const r = n().group.panels.find((a) => a.id === t);
|
|
793
|
+
if (r !== void 0)
|
|
794
|
+
return r;
|
|
795
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
796
|
+
}, s = () => {
|
|
797
|
+
const r = n().layout[t];
|
|
798
|
+
if (r !== void 0)
|
|
799
|
+
return r;
|
|
800
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
801
|
+
}, l = (r) => {
|
|
802
|
+
const a = s();
|
|
803
|
+
if (r === a)
|
|
804
|
+
return;
|
|
805
|
+
const {
|
|
806
|
+
defaultLayoutDeferred: u,
|
|
807
|
+
derivedPanelConstraints: c,
|
|
808
|
+
group: m,
|
|
809
|
+
groupSize: d,
|
|
810
|
+
layout: v,
|
|
811
|
+
separatorToPanels: x
|
|
812
|
+
} = n(), f = m.panels.findIndex((z) => z.id === t), h = f === m.panels.length - 1, g = se({
|
|
813
|
+
delta: h ? a - r : r - a,
|
|
814
|
+
initialLayout: v,
|
|
815
|
+
panelConstraints: c,
|
|
816
|
+
pivotIndices: h ? [f - 1, f] : [f, f + 1],
|
|
817
|
+
prevLayout: v,
|
|
818
|
+
trigger: "imperative-api"
|
|
819
|
+
}), y = B({
|
|
820
|
+
layout: g,
|
|
821
|
+
panelConstraints: c
|
|
822
|
+
});
|
|
823
|
+
j(v, y) || _(m, {
|
|
824
|
+
defaultLayoutDeferred: u,
|
|
825
|
+
derivedPanelConstraints: c,
|
|
826
|
+
groupSize: d,
|
|
827
|
+
layout: y,
|
|
828
|
+
separatorToPanels: x
|
|
829
|
+
});
|
|
830
|
+
};
|
|
831
|
+
return {
|
|
832
|
+
collapse: () => {
|
|
833
|
+
const { collapsible: r, collapsedSize: a } = o(), { mutableValues: u } = i(), c = s();
|
|
834
|
+
r && c !== a && (u.expandToSize = c, l(a));
|
|
835
|
+
},
|
|
836
|
+
expand: () => {
|
|
837
|
+
const { collapsible: r, collapsedSize: a, minSize: u } = o(), { mutableValues: c } = i(), m = s();
|
|
838
|
+
if (r && m === a) {
|
|
839
|
+
let d = c.expandToSize ?? u;
|
|
840
|
+
d === 0 && (d = 1), l(d);
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
getSize: () => {
|
|
844
|
+
const { group: r } = n(), a = s(), { element: u } = i(), c = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
|
|
845
|
+
return {
|
|
846
|
+
asPercentage: a,
|
|
847
|
+
inPixels: c
|
|
848
|
+
};
|
|
849
|
+
},
|
|
850
|
+
isCollapsed: () => {
|
|
851
|
+
const { collapsible: r, collapsedSize: a } = o(), u = s();
|
|
852
|
+
return r && I(a, u);
|
|
853
|
+
},
|
|
854
|
+
resize: (r) => {
|
|
855
|
+
const { group: a } = n(), { element: u } = i(), c = Q({ group: a }), m = te({
|
|
856
|
+
groupSize: c,
|
|
857
|
+
panelElement: u,
|
|
858
|
+
styleProp: r
|
|
859
|
+
}), d = D(m / c * 100);
|
|
860
|
+
l(d);
|
|
861
|
+
}
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
function De(e) {
|
|
865
|
+
if (e.defaultPrevented)
|
|
866
|
+
return;
|
|
867
|
+
const t = U();
|
|
868
|
+
ve(e, t).forEach((o) => {
|
|
869
|
+
if (o.separator) {
|
|
870
|
+
const i = o.panels.find(
|
|
871
|
+
(s) => s.panelConstraints.defaultSize !== void 0
|
|
872
|
+
);
|
|
873
|
+
if (i) {
|
|
874
|
+
const s = i.panelConstraints.defaultSize, l = et({
|
|
875
|
+
groupId: o.group.id,
|
|
876
|
+
panelId: i.id
|
|
877
|
+
});
|
|
878
|
+
l && s !== void 0 && (l.resize(s), e.preventDefault());
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
function fe(e) {
|
|
884
|
+
const t = U();
|
|
885
|
+
for (const [n] of t)
|
|
886
|
+
if (n.separators.some(
|
|
887
|
+
(o) => o.element === e
|
|
888
|
+
))
|
|
889
|
+
return n;
|
|
890
|
+
throw Error("Could not find parent Group for separator element");
|
|
891
|
+
}
|
|
892
|
+
function tt({
|
|
893
|
+
groupId: e
|
|
894
|
+
}) {
|
|
895
|
+
const t = () => {
|
|
896
|
+
const n = U();
|
|
897
|
+
for (const [o, i] of n)
|
|
898
|
+
if (o.id === e)
|
|
899
|
+
return { group: o, ...i };
|
|
900
|
+
throw Error(`Could not find Group with id "${e}"`);
|
|
901
|
+
};
|
|
902
|
+
return {
|
|
903
|
+
getLayout() {
|
|
904
|
+
const { defaultLayoutDeferred: n, layout: o } = t();
|
|
905
|
+
return n ? {} : o;
|
|
906
|
+
},
|
|
907
|
+
setLayout(n) {
|
|
908
|
+
const {
|
|
909
|
+
defaultLayoutDeferred: o,
|
|
910
|
+
derivedPanelConstraints: i,
|
|
911
|
+
group: s,
|
|
912
|
+
groupSize: l,
|
|
913
|
+
layout: r,
|
|
914
|
+
separatorToPanels: a
|
|
915
|
+
} = t(), u = B({
|
|
916
|
+
layout: n,
|
|
917
|
+
panelConstraints: i
|
|
918
|
+
});
|
|
919
|
+
return o ? r : (j(r, u) || _(s, {
|
|
920
|
+
defaultLayoutDeferred: o,
|
|
921
|
+
derivedPanelConstraints: i,
|
|
922
|
+
groupSize: l,
|
|
923
|
+
layout: u,
|
|
924
|
+
separatorToPanels: a
|
|
925
|
+
}), u);
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
}
|
|
929
|
+
function V(e, t) {
|
|
930
|
+
const n = fe(e), o = $(n.id, !0), i = n.separators.find(
|
|
931
|
+
(m) => m.element === e
|
|
932
|
+
);
|
|
933
|
+
L(i, "Matching separator not found");
|
|
934
|
+
const s = o.separatorToPanels.get(i);
|
|
935
|
+
L(s, "Matching panels not found");
|
|
936
|
+
const l = s.map((m) => n.panels.indexOf(m)), a = tt({ groupId: n.id }).getLayout(), u = se({
|
|
937
|
+
delta: t,
|
|
938
|
+
initialLayout: a,
|
|
939
|
+
panelConstraints: o.derivedPanelConstraints,
|
|
940
|
+
pivotIndices: l,
|
|
941
|
+
prevLayout: a,
|
|
942
|
+
trigger: "keyboard"
|
|
943
|
+
}), c = B({
|
|
944
|
+
layout: u,
|
|
945
|
+
panelConstraints: o.derivedPanelConstraints
|
|
946
|
+
});
|
|
947
|
+
j(a, c) || _(n, {
|
|
948
|
+
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
949
|
+
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
950
|
+
groupSize: o.groupSize,
|
|
951
|
+
layout: c,
|
|
952
|
+
separatorToPanels: o.separatorToPanels
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
function Te(e) {
|
|
956
|
+
if (e.defaultPrevented)
|
|
957
|
+
return;
|
|
958
|
+
const t = e.currentTarget, n = fe(t);
|
|
959
|
+
if (!n.disabled)
|
|
960
|
+
switch (e.key) {
|
|
961
|
+
case "ArrowDown": {
|
|
962
|
+
e.preventDefault(), n.orientation === "vertical" && V(t, 5);
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
case "ArrowLeft": {
|
|
966
|
+
e.preventDefault(), n.orientation === "horizontal" && V(t, -5);
|
|
967
|
+
break;
|
|
968
|
+
}
|
|
969
|
+
case "ArrowRight": {
|
|
970
|
+
e.preventDefault(), n.orientation === "horizontal" && V(t, 5);
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
case "ArrowUp": {
|
|
974
|
+
e.preventDefault(), n.orientation === "vertical" && V(t, -5);
|
|
975
|
+
break;
|
|
976
|
+
}
|
|
977
|
+
case "End": {
|
|
978
|
+
e.preventDefault(), V(t, 100);
|
|
979
|
+
break;
|
|
980
|
+
}
|
|
981
|
+
case "Enter": {
|
|
982
|
+
e.preventDefault();
|
|
983
|
+
const o = fe(t), i = $(o.id, !0), { derivedPanelConstraints: s, layout: l, separatorToPanels: r } = i, a = o.separators.find(
|
|
984
|
+
(d) => d.element === t
|
|
985
|
+
);
|
|
986
|
+
L(a, "Matching separator not found");
|
|
987
|
+
const u = r.get(a);
|
|
988
|
+
L(u, "Matching panels not found");
|
|
989
|
+
const c = u[0], m = s.find(
|
|
990
|
+
(d) => d.panelId === c.id
|
|
991
|
+
);
|
|
992
|
+
if (L(m, "Panel metadata not found"), m.collapsible) {
|
|
993
|
+
const d = l[c.id], v = m.collapsedSize === d ? o.mutableState.expandedPanelSizes[c.id] ?? m.minSize : m.collapsedSize;
|
|
994
|
+
V(t, v - d);
|
|
995
|
+
}
|
|
996
|
+
break;
|
|
997
|
+
}
|
|
998
|
+
case "F6": {
|
|
999
|
+
e.preventDefault();
|
|
1000
|
+
const i = fe(t).separators.map(
|
|
1001
|
+
(a) => a.element
|
|
1002
|
+
), s = Array.from(i).findIndex(
|
|
1003
|
+
(a) => a === e.currentTarget
|
|
1004
|
+
);
|
|
1005
|
+
L(s !== null, "Index not found");
|
|
1006
|
+
const l = e.shiftKey ? s > 0 ? s - 1 : i.length - 1 : s + 1 < i.length ? s + 1 : 0;
|
|
1007
|
+
i[l].focus({
|
|
1008
|
+
preventScroll: !0
|
|
1009
|
+
});
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
case "Home": {
|
|
1013
|
+
e.preventDefault(), V(t, -100);
|
|
1014
|
+
break;
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
let J = {
|
|
1019
|
+
cursorFlags: 0,
|
|
1020
|
+
state: "inactive"
|
|
1021
|
+
};
|
|
1022
|
+
const ze = new Je();
|
|
1023
|
+
function W() {
|
|
1024
|
+
return J;
|
|
1025
|
+
}
|
|
1026
|
+
function Gt(e) {
|
|
1027
|
+
return ze.addListener("change", e);
|
|
1028
|
+
}
|
|
1029
|
+
function At(e) {
|
|
1030
|
+
const t = J, n = { ...J };
|
|
1031
|
+
n.cursorFlags = e, J = n, ze.emit("change", {
|
|
1032
|
+
prev: t,
|
|
1033
|
+
next: n
|
|
1034
|
+
});
|
|
1035
|
+
}
|
|
1036
|
+
function Z(e) {
|
|
1037
|
+
const t = J;
|
|
1038
|
+
J = e, ze.emit("change", {
|
|
1039
|
+
prev: t,
|
|
1040
|
+
next: e
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
function Oe(e) {
|
|
1044
|
+
if (e.defaultPrevented)
|
|
1045
|
+
return;
|
|
1046
|
+
if (e.pointerType === "mouse" && e.button > 0)
|
|
1047
|
+
return;
|
|
1048
|
+
const t = U(), n = ve(e, t), o = /* @__PURE__ */ new Map();
|
|
1049
|
+
let i = !1;
|
|
1050
|
+
n.forEach((s) => {
|
|
1051
|
+
s.separator && (i || (i = !0, s.separator.element.focus({
|
|
1052
|
+
preventScroll: !0
|
|
1053
|
+
})));
|
|
1054
|
+
const l = t.get(s.group);
|
|
1055
|
+
l && o.set(s.group, l.layout);
|
|
1056
|
+
}), Z({
|
|
1057
|
+
cursorFlags: 0,
|
|
1058
|
+
hitRegions: n,
|
|
1059
|
+
initialLayoutMap: o,
|
|
1060
|
+
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
1061
|
+
state: "active"
|
|
1062
|
+
}), n.length && e.preventDefault();
|
|
1063
|
+
}
|
|
1064
|
+
const Nt = (e) => e, he = () => {
|
|
1065
|
+
}, nt = 1, ot = 2, it = 4, rt = 8, Ge = 3, Ae = 12;
|
|
1066
|
+
let ce;
|
|
1067
|
+
function Ne() {
|
|
1068
|
+
return ce === void 0 && (ce = !1, typeof window < "u" && (window.navigator.userAgent.includes("Chrome") || window.navigator.userAgent.includes("Firefox")) && (ce = !0)), ce;
|
|
1069
|
+
}
|
|
1070
|
+
function _t({
|
|
1071
|
+
cursorFlags: e,
|
|
1072
|
+
groups: t,
|
|
1073
|
+
state: n
|
|
1074
|
+
}) {
|
|
1075
|
+
let o = 0, i = 0;
|
|
1076
|
+
switch (n) {
|
|
1077
|
+
case "active":
|
|
1078
|
+
case "hover":
|
|
1079
|
+
t.forEach((s) => {
|
|
1080
|
+
if (!s.mutableState.disableCursor)
|
|
1081
|
+
switch (s.orientation) {
|
|
1082
|
+
case "horizontal": {
|
|
1083
|
+
o++;
|
|
1084
|
+
break;
|
|
1085
|
+
}
|
|
1086
|
+
case "vertical": {
|
|
1087
|
+
i++;
|
|
1088
|
+
break;
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
if (!(o === 0 && i === 0)) {
|
|
1094
|
+
switch (n) {
|
|
1095
|
+
case "active": {
|
|
1096
|
+
if (e && Ne()) {
|
|
1097
|
+
const s = (e & nt) !== 0, l = (e & ot) !== 0, r = (e & it) !== 0, a = (e & rt) !== 0;
|
|
1098
|
+
if (s)
|
|
1099
|
+
return r ? "se-resize" : a ? "ne-resize" : "e-resize";
|
|
1100
|
+
if (l)
|
|
1101
|
+
return r ? "sw-resize" : a ? "nw-resize" : "w-resize";
|
|
1102
|
+
if (r)
|
|
1103
|
+
return "s-resize";
|
|
1104
|
+
if (a)
|
|
1105
|
+
return "n-resize";
|
|
1106
|
+
}
|
|
1107
|
+
break;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
return Ne() ? o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize" : o > 0 && i > 0 ? "grab" : o > 0 ? "col-resize" : "row-resize";
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
const _e = /* @__PURE__ */ new WeakMap();
|
|
1114
|
+
function be(e) {
|
|
1115
|
+
if (e.defaultView === null || e.defaultView === void 0)
|
|
1116
|
+
return;
|
|
1117
|
+
let { prevStyle: t, styleSheet: n } = _e.get(e) ?? {};
|
|
1118
|
+
n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets && e.adoptedStyleSheets.push(n));
|
|
1119
|
+
const o = W();
|
|
1120
|
+
switch (o.state) {
|
|
1121
|
+
case "active":
|
|
1122
|
+
case "hover": {
|
|
1123
|
+
const i = _t({
|
|
1124
|
+
cursorFlags: o.cursorFlags,
|
|
1125
|
+
groups: o.hitRegions.map((l) => l.group),
|
|
1126
|
+
state: o.state
|
|
1127
|
+
}), s = `*, *:hover {cursor: ${i} !important; }`;
|
|
1128
|
+
if (t === s)
|
|
1129
|
+
return;
|
|
1130
|
+
t = s, i ? n.cssRules.length === 0 ? n.insertRule(s) : n.replaceSync(s) : n.cssRules.length === 1 && n.deleteRule(0);
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
case "inactive": {
|
|
1134
|
+
t = void 0, n.cssRules.length === 1 && n.deleteRule(0);
|
|
1135
|
+
break;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
_e.set(e, {
|
|
1139
|
+
prevStyle: t,
|
|
1140
|
+
styleSheet: n
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
function st({
|
|
1144
|
+
document: e,
|
|
1145
|
+
event: t,
|
|
1146
|
+
hitRegions: n,
|
|
1147
|
+
initialLayoutMap: o,
|
|
1148
|
+
mountedGroups: i,
|
|
1149
|
+
pointerDownAtPoint: s,
|
|
1150
|
+
prevCursorFlags: l
|
|
1151
|
+
}) {
|
|
1152
|
+
let r = 0;
|
|
1153
|
+
n.forEach((u) => {
|
|
1154
|
+
const { group: c, groupSize: m } = u, { orientation: d, panels: v } = c, { disableCursor: x } = c.mutableState;
|
|
1155
|
+
let f = 0;
|
|
1156
|
+
s ? d === "horizontal" ? f = (t.clientX - s.x) / m * 100 : f = (t.clientY - s.y) / m * 100 : d === "horizontal" ? f = t.clientX < 0 ? -100 : 100 : f = t.clientY < 0 ? -100 : 100;
|
|
1157
|
+
const h = o.get(c), g = i.get(c);
|
|
1158
|
+
if (!h || !g)
|
|
1159
|
+
return;
|
|
1160
|
+
const {
|
|
1161
|
+
defaultLayoutDeferred: y,
|
|
1162
|
+
derivedPanelConstraints: z,
|
|
1163
|
+
groupSize: S,
|
|
1164
|
+
layout: p,
|
|
1165
|
+
separatorToPanels: P
|
|
1166
|
+
} = g;
|
|
1167
|
+
if (z && p && P) {
|
|
1168
|
+
const R = se({
|
|
1169
|
+
delta: f,
|
|
1170
|
+
initialLayout: h,
|
|
1171
|
+
panelConstraints: z,
|
|
1172
|
+
pivotIndices: u.panels.map((C) => v.indexOf(C)),
|
|
1173
|
+
prevLayout: p,
|
|
1174
|
+
trigger: "mouse-or-touch"
|
|
1175
|
+
});
|
|
1176
|
+
if (j(R, p)) {
|
|
1177
|
+
if (f !== 0 && !x)
|
|
1178
|
+
switch (d) {
|
|
1179
|
+
case "horizontal": {
|
|
1180
|
+
r |= f < 0 ? nt : ot;
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
case "vertical": {
|
|
1184
|
+
r |= f < 0 ? it : rt;
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
} else
|
|
1189
|
+
_(u.group, {
|
|
1190
|
+
defaultLayoutDeferred: y,
|
|
1191
|
+
derivedPanelConstraints: z,
|
|
1192
|
+
groupSize: S,
|
|
1193
|
+
layout: R,
|
|
1194
|
+
separatorToPanels: P
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
let a = 0;
|
|
1199
|
+
t.movementX === 0 ? a |= l & Ge : a |= r & Ge, t.movementY === 0 ? a |= l & Ae : a |= r & Ae, At(a), be(e);
|
|
1200
|
+
}
|
|
1201
|
+
function Fe(e) {
|
|
1202
|
+
const t = U(), n = W();
|
|
1203
|
+
switch (n.state) {
|
|
1204
|
+
case "active":
|
|
1205
|
+
st({
|
|
1206
|
+
document: e.currentTarget,
|
|
1207
|
+
event: e,
|
|
1208
|
+
hitRegions: n.hitRegions,
|
|
1209
|
+
initialLayoutMap: n.initialLayoutMap,
|
|
1210
|
+
mountedGroups: t,
|
|
1211
|
+
prevCursorFlags: n.cursorFlags
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
function $e(e) {
|
|
1216
|
+
if (e.defaultPrevented)
|
|
1217
|
+
return;
|
|
1218
|
+
const t = W(), n = U();
|
|
1219
|
+
switch (t.state) {
|
|
1220
|
+
case "active": {
|
|
1221
|
+
if (
|
|
1222
|
+
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
1223
|
+
e.buttons === 0
|
|
1224
|
+
) {
|
|
1225
|
+
Z({
|
|
1226
|
+
cursorFlags: 0,
|
|
1227
|
+
state: "inactive"
|
|
1228
|
+
}), t.hitRegions.forEach((o) => {
|
|
1229
|
+
const i = $(o.group.id, !0);
|
|
1230
|
+
_(o.group, i);
|
|
1231
|
+
});
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
st({
|
|
1235
|
+
document: e.currentTarget,
|
|
1236
|
+
event: e,
|
|
1237
|
+
hitRegions: t.hitRegions,
|
|
1238
|
+
initialLayoutMap: t.initialLayoutMap,
|
|
1239
|
+
mountedGroups: n,
|
|
1240
|
+
pointerDownAtPoint: t.pointerDownAtPoint,
|
|
1241
|
+
prevCursorFlags: t.cursorFlags
|
|
1242
|
+
});
|
|
1243
|
+
break;
|
|
1244
|
+
}
|
|
1245
|
+
default: {
|
|
1246
|
+
const o = ve(e, n);
|
|
1247
|
+
o.length === 0 ? t.state !== "inactive" && Z({
|
|
1248
|
+
cursorFlags: 0,
|
|
1249
|
+
state: "inactive"
|
|
1250
|
+
}) : Z({
|
|
1251
|
+
cursorFlags: 0,
|
|
1252
|
+
hitRegions: o,
|
|
1253
|
+
state: "hover"
|
|
1254
|
+
}), be(e.currentTarget);
|
|
1255
|
+
break;
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
function He(e) {
|
|
1260
|
+
if (e.relatedTarget instanceof HTMLIFrameElement)
|
|
1261
|
+
switch (W().state) {
|
|
1262
|
+
case "hover":
|
|
1263
|
+
Z({
|
|
1264
|
+
cursorFlags: 0,
|
|
1265
|
+
state: "inactive"
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function Ve(e) {
|
|
1270
|
+
if (e.defaultPrevented)
|
|
1271
|
+
return;
|
|
1272
|
+
if (e.pointerType === "mouse" && e.button > 0)
|
|
1273
|
+
return;
|
|
1274
|
+
const t = W();
|
|
1275
|
+
switch (t.state) {
|
|
1276
|
+
case "active":
|
|
1277
|
+
Z({
|
|
1278
|
+
cursorFlags: 0,
|
|
1279
|
+
state: "inactive"
|
|
1280
|
+
}), t.hitRegions.length > 0 && (be(e.currentTarget), t.hitRegions.forEach((n) => {
|
|
1281
|
+
const o = $(n.group.id, !0);
|
|
1282
|
+
_(n.group, o);
|
|
1283
|
+
}), e.preventDefault());
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
function je(e) {
|
|
1287
|
+
let t = 0, n = 0;
|
|
1288
|
+
const o = {};
|
|
1289
|
+
for (const s of e)
|
|
1290
|
+
if (s.defaultSize !== void 0) {
|
|
1291
|
+
t++;
|
|
1292
|
+
const l = D(s.defaultSize);
|
|
1293
|
+
n += l, o[s.panelId] = l;
|
|
1294
|
+
} else
|
|
1295
|
+
o[s.panelId] = void 0;
|
|
1296
|
+
const i = e.length - t;
|
|
1297
|
+
if (i !== 0) {
|
|
1298
|
+
const s = D((100 - n) / i);
|
|
1299
|
+
for (const l of e)
|
|
1300
|
+
l.defaultSize === void 0 && (o[l.panelId] = s);
|
|
1301
|
+
}
|
|
1302
|
+
return o;
|
|
1303
|
+
}
|
|
1304
|
+
function Ft(e, t, n) {
|
|
1305
|
+
if (!n[0])
|
|
1306
|
+
return;
|
|
1307
|
+
const i = e.panels.find((u) => u.element === t);
|
|
1308
|
+
if (!i || !i.onResize)
|
|
1309
|
+
return;
|
|
1310
|
+
const s = Q({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, r = i.mutableValues.prevSize, a = {
|
|
1311
|
+
asPercentage: D(l / s * 100),
|
|
1312
|
+
inPixels: l
|
|
1313
|
+
};
|
|
1314
|
+
i.mutableValues.prevSize = a, i.onResize(a, i.id, r);
|
|
1315
|
+
}
|
|
1316
|
+
function $t(e, t) {
|
|
1317
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
1318
|
+
return !1;
|
|
1319
|
+
for (const o in e)
|
|
1320
|
+
if (e[o] !== t[o])
|
|
1321
|
+
return !1;
|
|
1322
|
+
return !0;
|
|
1323
|
+
}
|
|
1324
|
+
function Ht({
|
|
1325
|
+
group: e,
|
|
1326
|
+
nextGroupSize: t,
|
|
1327
|
+
prevGroupSize: n,
|
|
1328
|
+
prevLayout: o
|
|
1329
|
+
}) {
|
|
1330
|
+
if (n <= 0 || t <= 0 || n === t)
|
|
1331
|
+
return o;
|
|
1332
|
+
let i = 0, s = 0, l = !1;
|
|
1333
|
+
const r = /* @__PURE__ */ new Map(), a = [];
|
|
1334
|
+
for (const m of e.panels) {
|
|
1335
|
+
const d = o[m.id] ?? 0;
|
|
1336
|
+
switch (m.panelConstraints.groupResizeBehavior) {
|
|
1337
|
+
case "preserve-pixel-size": {
|
|
1338
|
+
l = !0;
|
|
1339
|
+
const v = d / 100 * n, x = D(
|
|
1340
|
+
v / t * 100
|
|
1341
|
+
);
|
|
1342
|
+
r.set(m.id, x), i += x;
|
|
1343
|
+
break;
|
|
1344
|
+
}
|
|
1345
|
+
case "preserve-relative-size":
|
|
1346
|
+
default: {
|
|
1347
|
+
a.push(m.id), s += d;
|
|
1348
|
+
break;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
if (!l || a.length === 0)
|
|
1353
|
+
return o;
|
|
1354
|
+
const u = 100 - i, c = { ...o };
|
|
1355
|
+
if (r.forEach((m, d) => {
|
|
1356
|
+
c[d] = m;
|
|
1357
|
+
}), s > 0)
|
|
1358
|
+
for (const m of a) {
|
|
1359
|
+
const d = o[m] ?? 0;
|
|
1360
|
+
c[m] = D(
|
|
1361
|
+
d / s * u
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
else {
|
|
1365
|
+
const m = D(
|
|
1366
|
+
u / a.length
|
|
1367
|
+
);
|
|
1368
|
+
for (const d of a)
|
|
1369
|
+
c[d] = m;
|
|
1370
|
+
}
|
|
1371
|
+
return c;
|
|
1372
|
+
}
|
|
1373
|
+
function Vt(e, t) {
|
|
1374
|
+
const n = e.map((i) => i.id), o = Object.keys(t);
|
|
1375
|
+
if (n.length !== o.length)
|
|
1376
|
+
return !1;
|
|
1377
|
+
for (const i of n)
|
|
1378
|
+
if (!o.includes(i))
|
|
1379
|
+
return !1;
|
|
1380
|
+
return !0;
|
|
1381
|
+
}
|
|
1382
|
+
const q = /* @__PURE__ */ new Map();
|
|
1383
|
+
function jt(e) {
|
|
1384
|
+
let t = !0;
|
|
1385
|
+
L(
|
|
1386
|
+
e.element.ownerDocument.defaultView,
|
|
1387
|
+
"Cannot register an unmounted Group"
|
|
1388
|
+
);
|
|
1389
|
+
const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = new n((f) => {
|
|
1390
|
+
for (const h of f) {
|
|
1391
|
+
const { borderBoxSize: g, target: y } = h;
|
|
1392
|
+
if (y === e.element) {
|
|
1393
|
+
if (t) {
|
|
1394
|
+
const z = Q({ group: e });
|
|
1395
|
+
if (z === 0)
|
|
1396
|
+
return;
|
|
1397
|
+
const S = $(e.id);
|
|
1398
|
+
if (!S)
|
|
1399
|
+
return;
|
|
1400
|
+
const p = ge(e), P = S.defaultLayoutDeferred ? je(p) : S.layout, R = Ht({
|
|
1401
|
+
group: e,
|
|
1402
|
+
nextGroupSize: z,
|
|
1403
|
+
prevGroupSize: S.groupSize,
|
|
1404
|
+
prevLayout: P
|
|
1405
|
+
}), C = B({
|
|
1406
|
+
layout: R,
|
|
1407
|
+
panelConstraints: p
|
|
1408
|
+
});
|
|
1409
|
+
if (!S.defaultLayoutDeferred && j(S.layout, C) && $t(
|
|
1410
|
+
S.derivedPanelConstraints,
|
|
1411
|
+
p
|
|
1412
|
+
) && S.groupSize === z)
|
|
1413
|
+
return;
|
|
1414
|
+
_(e, {
|
|
1415
|
+
defaultLayoutDeferred: !1,
|
|
1416
|
+
derivedPanelConstraints: p,
|
|
1417
|
+
groupSize: z,
|
|
1418
|
+
layout: C,
|
|
1419
|
+
separatorToPanels: S.separatorToPanels
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
} else
|
|
1423
|
+
Ft(e, y, g);
|
|
1424
|
+
}
|
|
1425
|
+
});
|
|
1426
|
+
s.observe(e.element), e.panels.forEach((f) => {
|
|
1427
|
+
L(
|
|
1428
|
+
!o.has(f.id),
|
|
1429
|
+
`Panel ids must be unique; id "${f.id}" was used more than once`
|
|
1430
|
+
), o.add(f.id), f.onResize && s.observe(f.element);
|
|
1431
|
+
});
|
|
1432
|
+
const l = Q({ group: e }), r = ge(e), a = e.panels.map(({ id: f }) => f).join(",");
|
|
1433
|
+
let u = e.mutableState.defaultLayout;
|
|
1434
|
+
u && (Vt(e.panels, u) || (u = void 0));
|
|
1435
|
+
const c = e.mutableState.layouts[a] ?? u ?? je(r), m = B({
|
|
1436
|
+
layout: c,
|
|
1437
|
+
panelConstraints: r
|
|
1438
|
+
}), d = e.element.ownerDocument;
|
|
1439
|
+
q.set(
|
|
1440
|
+
d,
|
|
1441
|
+
(q.get(d) ?? 0) + 1
|
|
1442
|
+
);
|
|
1443
|
+
const v = /* @__PURE__ */ new Map();
|
|
1444
|
+
return Ye(e).forEach((f) => {
|
|
1445
|
+
f.separator && v.set(f.separator, f.panels);
|
|
1446
|
+
}), _(e, {
|
|
1447
|
+
defaultLayoutDeferred: l === 0,
|
|
1448
|
+
derivedPanelConstraints: r,
|
|
1449
|
+
groupSize: l,
|
|
1450
|
+
layout: m,
|
|
1451
|
+
separatorToPanels: v
|
|
1452
|
+
}), e.separators.forEach((f) => {
|
|
1453
|
+
L(
|
|
1454
|
+
!i.has(f.id),
|
|
1455
|
+
`Separator ids must be unique; id "${f.id}" was used more than once`
|
|
1456
|
+
), i.add(f.id), f.element.addEventListener("keydown", Te);
|
|
1457
|
+
}), q.get(d) === 1 && (d.addEventListener("dblclick", De, !0), d.addEventListener("pointerdown", Oe, !0), d.addEventListener("pointerleave", Fe), d.addEventListener("pointermove", $e), d.addEventListener("pointerout", He), d.addEventListener("pointerup", Ve, !0)), function() {
|
|
1458
|
+
t = !1, q.set(
|
|
1459
|
+
d,
|
|
1460
|
+
Math.max(0, (q.get(d) ?? 0) - 1)
|
|
1461
|
+
), Lt(e), e.separators.forEach((h) => {
|
|
1462
|
+
h.element.removeEventListener("keydown", Te);
|
|
1463
|
+
}), q.get(d) || (d.removeEventListener(
|
|
1464
|
+
"dblclick",
|
|
1465
|
+
De,
|
|
1466
|
+
!0
|
|
1467
|
+
), d.removeEventListener(
|
|
1468
|
+
"pointerdown",
|
|
1469
|
+
Oe,
|
|
1470
|
+
!0
|
|
1471
|
+
), d.removeEventListener("pointerleave", Fe), d.removeEventListener("pointermove", $e), d.removeEventListener("pointerout", He), d.removeEventListener("pointerup", Ve, !0)), s.disconnect();
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
function Bt() {
|
|
1475
|
+
const [e, t] = re({}), n = ne(() => t({}), []);
|
|
1476
|
+
return [e, n];
|
|
1477
|
+
}
|
|
1478
|
+
function xe(e) {
|
|
1479
|
+
const t = pt();
|
|
1480
|
+
return `${e ?? t}`;
|
|
1481
|
+
}
|
|
1482
|
+
const K = typeof window < "u" ? Be : de;
|
|
1483
|
+
function oe(e) {
|
|
1484
|
+
const t = T(e);
|
|
1485
|
+
return K(() => {
|
|
1486
|
+
t.current = e;
|
|
1487
|
+
}, [e]), ne(
|
|
1488
|
+
(...n) => t.current?.(...n),
|
|
1489
|
+
[t]
|
|
1490
|
+
);
|
|
1491
|
+
}
|
|
1492
|
+
function we(...e) {
|
|
1493
|
+
return oe((t) => {
|
|
1494
|
+
e.forEach((n) => {
|
|
1495
|
+
if (n)
|
|
1496
|
+
switch (typeof n) {
|
|
1497
|
+
case "function": {
|
|
1498
|
+
n(t);
|
|
1499
|
+
break;
|
|
1500
|
+
}
|
|
1501
|
+
case "object": {
|
|
1502
|
+
n.current = t;
|
|
1503
|
+
break;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
});
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function Pe(e) {
|
|
1510
|
+
const t = T({ ...e });
|
|
1511
|
+
return K(() => {
|
|
1512
|
+
for (const n in e)
|
|
1513
|
+
t.current[n] = e[n];
|
|
1514
|
+
}, [e]), t.current;
|
|
1515
|
+
}
|
|
1516
|
+
const at = ht(null);
|
|
1517
|
+
function Wt(e, t) {
|
|
1518
|
+
const n = T({
|
|
1519
|
+
getLayout: () => ({}),
|
|
1520
|
+
setLayout: Nt
|
|
1521
|
+
});
|
|
1522
|
+
We(t, () => n.current, []), K(() => {
|
|
1523
|
+
Object.assign(
|
|
1524
|
+
n.current,
|
|
1525
|
+
tt({ groupId: e })
|
|
1526
|
+
);
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
function Ut({
|
|
1530
|
+
children: e,
|
|
1531
|
+
className: t,
|
|
1532
|
+
defaultLayout: n,
|
|
1533
|
+
disableCursor: o,
|
|
1534
|
+
disabled: i,
|
|
1535
|
+
elementRef: s,
|
|
1536
|
+
groupRef: l,
|
|
1537
|
+
id: r,
|
|
1538
|
+
onLayoutChange: a,
|
|
1539
|
+
onLayoutChanged: u,
|
|
1540
|
+
orientation: c = "horizontal",
|
|
1541
|
+
resizeTargetMinimumSize: m = {
|
|
1542
|
+
coarse: 20,
|
|
1543
|
+
fine: 10
|
|
1544
|
+
},
|
|
1545
|
+
style: d,
|
|
1546
|
+
...v
|
|
1547
|
+
}) {
|
|
1548
|
+
const x = T({
|
|
1549
|
+
onLayoutChange: {},
|
|
1550
|
+
onLayoutChanged: {}
|
|
1551
|
+
}), f = oe((b) => {
|
|
1552
|
+
j(x.current.onLayoutChange, b) || (x.current.onLayoutChange = b, a?.(b));
|
|
1553
|
+
}), h = oe((b) => {
|
|
1554
|
+
j(x.current.onLayoutChanged, b) || (x.current.onLayoutChanged = b, u?.(b));
|
|
1555
|
+
}), g = xe(r), y = T(null), [z, S] = Bt(), p = T({
|
|
1556
|
+
lastExpandedPanelSizes: {},
|
|
1557
|
+
layouts: {},
|
|
1558
|
+
panels: [],
|
|
1559
|
+
resizeTargetMinimumSize: m,
|
|
1560
|
+
separators: []
|
|
1561
|
+
}), P = we(y, s);
|
|
1562
|
+
Wt(g, l);
|
|
1563
|
+
const R = oe(
|
|
1564
|
+
(b, w) => {
|
|
1565
|
+
const E = W(), M = Me(b), k = $(b);
|
|
1566
|
+
if (k) {
|
|
1567
|
+
let O = !1;
|
|
1568
|
+
switch (E.state) {
|
|
1569
|
+
case "active": {
|
|
1570
|
+
O = E.hitRegions.some(
|
|
1571
|
+
(H) => H.group === M
|
|
1572
|
+
);
|
|
1573
|
+
break;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
return {
|
|
1577
|
+
flexGrow: k.layout[w] ?? 1,
|
|
1578
|
+
pointerEvents: O ? "none" : void 0
|
|
1579
|
+
};
|
|
1580
|
+
}
|
|
1581
|
+
return {
|
|
1582
|
+
flexGrow: n?.[w] ?? 1
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
), C = Pe({
|
|
1586
|
+
defaultLayout: n,
|
|
1587
|
+
disableCursor: o
|
|
1588
|
+
}), X = Ue(
|
|
1589
|
+
() => ({
|
|
1590
|
+
get disableCursor() {
|
|
1591
|
+
return !!C.disableCursor;
|
|
1592
|
+
},
|
|
1593
|
+
getPanelStyles: R,
|
|
1594
|
+
id: g,
|
|
1595
|
+
orientation: c,
|
|
1596
|
+
registerPanel: (b) => {
|
|
1597
|
+
const w = p.current;
|
|
1598
|
+
return w.panels = Se(c, [
|
|
1599
|
+
...w.panels,
|
|
1600
|
+
b
|
|
1601
|
+
]), S(), () => {
|
|
1602
|
+
w.panels = w.panels.filter(
|
|
1603
|
+
(E) => E !== b
|
|
1604
|
+
), S();
|
|
1605
|
+
};
|
|
1606
|
+
},
|
|
1607
|
+
registerSeparator: (b) => {
|
|
1608
|
+
const w = p.current;
|
|
1609
|
+
return w.separators = Se(c, [
|
|
1610
|
+
...w.separators,
|
|
1611
|
+
b
|
|
1612
|
+
]), S(), () => {
|
|
1613
|
+
w.separators = w.separators.filter(
|
|
1614
|
+
(E) => E !== b
|
|
1615
|
+
), S();
|
|
1616
|
+
};
|
|
1617
|
+
},
|
|
1618
|
+
togglePanelDisabled: (b, w) => {
|
|
1619
|
+
const M = p.current.panels.find(
|
|
1620
|
+
(H) => H.id === b
|
|
1621
|
+
);
|
|
1622
|
+
M && (M.panelConstraints.disabled = w);
|
|
1623
|
+
const k = Me(g), O = $(g);
|
|
1624
|
+
k && O && _(k, {
|
|
1625
|
+
...O,
|
|
1626
|
+
derivedPanelConstraints: ge(k)
|
|
1627
|
+
});
|
|
1628
|
+
},
|
|
1629
|
+
toggleSeparatorDisabled: (b, w) => {
|
|
1630
|
+
const M = p.current.separators.find(
|
|
1631
|
+
(k) => k.id === b
|
|
1632
|
+
);
|
|
1633
|
+
M && (M.disabled = w);
|
|
1634
|
+
}
|
|
1635
|
+
}),
|
|
1636
|
+
[R, g, S, c, C]
|
|
1637
|
+
), F = T(null);
|
|
1638
|
+
return K(() => {
|
|
1639
|
+
const b = y.current;
|
|
1640
|
+
if (b === null)
|
|
1641
|
+
return;
|
|
1642
|
+
const w = p.current;
|
|
1643
|
+
let E;
|
|
1644
|
+
if (C.defaultLayout !== void 0 && Object.keys(C.defaultLayout).length === w.panels.length) {
|
|
1645
|
+
E = {};
|
|
1646
|
+
for (const ee of w.panels) {
|
|
1647
|
+
const ae = C.defaultLayout[ee.id];
|
|
1648
|
+
ae !== void 0 && (E[ee.id] = ae);
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
const M = {
|
|
1652
|
+
disabled: !!i,
|
|
1653
|
+
element: b,
|
|
1654
|
+
id: g,
|
|
1655
|
+
mutableState: {
|
|
1656
|
+
defaultLayout: E,
|
|
1657
|
+
disableCursor: !!C.disableCursor,
|
|
1658
|
+
expandedPanelSizes: p.current.lastExpandedPanelSizes,
|
|
1659
|
+
layouts: p.current.layouts
|
|
1660
|
+
},
|
|
1661
|
+
orientation: c,
|
|
1662
|
+
panels: w.panels,
|
|
1663
|
+
resizeTargetMinimumSize: w.resizeTargetMinimumSize,
|
|
1664
|
+
separators: w.separators
|
|
1665
|
+
};
|
|
1666
|
+
F.current = M;
|
|
1667
|
+
const k = jt(M), { defaultLayoutDeferred: O, derivedPanelConstraints: H, layout: Ce } = $(M.id, !0);
|
|
1668
|
+
!O && H.length > 0 && (f(Ce), h(Ce));
|
|
1669
|
+
const lt = ye(g, (ee) => {
|
|
1670
|
+
const { defaultLayoutDeferred: ae, derivedPanelConstraints: Re, layout: le } = ee.next;
|
|
1671
|
+
if (ae || Re.length === 0)
|
|
1672
|
+
return;
|
|
1673
|
+
const ut = M.panels.map(({ id: N }) => N).join(",");
|
|
1674
|
+
M.mutableState.layouts[ut] = le, Re.forEach((N) => {
|
|
1675
|
+
if (N.collapsible) {
|
|
1676
|
+
const { layout: pe } = ee.prev ?? {};
|
|
1677
|
+
if (pe) {
|
|
1678
|
+
const ft = I(
|
|
1679
|
+
N.collapsedSize,
|
|
1680
|
+
le[N.panelId]
|
|
1681
|
+
), dt = I(
|
|
1682
|
+
N.collapsedSize,
|
|
1683
|
+
pe[N.panelId]
|
|
1684
|
+
);
|
|
1685
|
+
ft && !dt && (M.mutableState.expandedPanelSizes[N.panelId] = pe[N.panelId]);
|
|
1686
|
+
}
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
const ct = W().state !== "active";
|
|
1690
|
+
f(le), ct && h(le);
|
|
1691
|
+
});
|
|
1692
|
+
return () => {
|
|
1693
|
+
F.current = null, k(), lt();
|
|
1694
|
+
};
|
|
1695
|
+
}, [
|
|
1696
|
+
i,
|
|
1697
|
+
g,
|
|
1698
|
+
h,
|
|
1699
|
+
f,
|
|
1700
|
+
c,
|
|
1701
|
+
z,
|
|
1702
|
+
C
|
|
1703
|
+
]), de(() => {
|
|
1704
|
+
const b = F.current;
|
|
1705
|
+
b && (b.mutableState.defaultLayout = n, b.mutableState.disableCursor = !!o);
|
|
1706
|
+
}), /* @__PURE__ */ ie(at.Provider, { value: X, children: /* @__PURE__ */ ie(
|
|
1707
|
+
"div",
|
|
1708
|
+
{
|
|
1709
|
+
...v,
|
|
1710
|
+
className: t,
|
|
1711
|
+
"data-group": !0,
|
|
1712
|
+
"data-testid": g,
|
|
1713
|
+
id: g,
|
|
1714
|
+
ref: P,
|
|
1715
|
+
style: {
|
|
1716
|
+
height: "100%",
|
|
1717
|
+
width: "100%",
|
|
1718
|
+
overflow: "hidden",
|
|
1719
|
+
...d,
|
|
1720
|
+
display: "flex",
|
|
1721
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
1722
|
+
flexWrap: "nowrap",
|
|
1723
|
+
// Inform the browser that the library is handling touch events for this element
|
|
1724
|
+
// but still allow users to scroll content within panels in the non-resizing direction
|
|
1725
|
+
// NOTE This is not an inherited style
|
|
1726
|
+
// See github.com/bvaughn/react-resizable-panels/issues/662
|
|
1727
|
+
touchAction: c === "horizontal" ? "pan-y" : "pan-x"
|
|
1728
|
+
},
|
|
1729
|
+
children: e
|
|
1730
|
+
}
|
|
1731
|
+
) });
|
|
1732
|
+
}
|
|
1733
|
+
Ut.displayName = "Group";
|
|
1734
|
+
function me(e, t) {
|
|
1735
|
+
return `react-resizable-panels:${[e, ...t].join(":")}`;
|
|
1736
|
+
}
|
|
1737
|
+
function nn({
|
|
1738
|
+
debounceSaveMs: e = 100,
|
|
1739
|
+
panelIds: t,
|
|
1740
|
+
storage: n = localStorage,
|
|
1741
|
+
...o
|
|
1742
|
+
}) {
|
|
1743
|
+
const i = t !== void 0, s = "id" in o ? o.id : o.groupId, l = me(s, t ?? []), r = Ke(
|
|
1744
|
+
Kt,
|
|
1745
|
+
() => n.getItem(l),
|
|
1746
|
+
() => n.getItem(l)
|
|
1747
|
+
), a = Ue(
|
|
1748
|
+
() => r ? JSON.parse(r) : void 0,
|
|
1749
|
+
[r]
|
|
1750
|
+
), u = T(null), c = ne(() => {
|
|
1751
|
+
const v = u.current;
|
|
1752
|
+
v && (u.current = null, clearTimeout(v));
|
|
1753
|
+
}, []);
|
|
1754
|
+
Be(() => () => {
|
|
1755
|
+
c();
|
|
1756
|
+
}, [c]);
|
|
1757
|
+
const m = ne(
|
|
1758
|
+
(v) => {
|
|
1759
|
+
c();
|
|
1760
|
+
let x;
|
|
1761
|
+
i ? x = me(s, Object.keys(v)) : x = me(s, []);
|
|
1762
|
+
try {
|
|
1763
|
+
n.setItem(x, JSON.stringify(v));
|
|
1764
|
+
} catch (f) {
|
|
1765
|
+
console.error(f);
|
|
1766
|
+
}
|
|
1767
|
+
},
|
|
1768
|
+
[c, i, s, n]
|
|
1769
|
+
), d = ne(
|
|
1770
|
+
(v) => {
|
|
1771
|
+
c(), e === 0 ? m(v) : u.current = setTimeout(() => {
|
|
1772
|
+
m(v);
|
|
1773
|
+
}, e);
|
|
1774
|
+
},
|
|
1775
|
+
[c, e, m]
|
|
1776
|
+
);
|
|
1777
|
+
return {
|
|
1778
|
+
/**
|
|
1779
|
+
* Pass this value to `Group` as the `defaultLayout` prop.
|
|
1780
|
+
*/
|
|
1781
|
+
defaultLayout: a,
|
|
1782
|
+
/**
|
|
1783
|
+
* Attach this callback on the `Group` as the `onLayoutChange` prop.
|
|
1784
|
+
*
|
|
1785
|
+
* @deprecated Use the {@link onLayoutChanged} prop instead.
|
|
1786
|
+
*/
|
|
1787
|
+
onLayoutChange: d,
|
|
1788
|
+
/**
|
|
1789
|
+
* Attach this callback on the `Group` as the `onLayoutChanged` prop.
|
|
1790
|
+
*/
|
|
1791
|
+
onLayoutChanged: m
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
function Kt() {
|
|
1795
|
+
return function() {
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
function on() {
|
|
1799
|
+
return re(null);
|
|
1800
|
+
}
|
|
1801
|
+
function rn() {
|
|
1802
|
+
return T(null);
|
|
1803
|
+
}
|
|
1804
|
+
function Le() {
|
|
1805
|
+
const e = mt(at);
|
|
1806
|
+
return L(
|
|
1807
|
+
e,
|
|
1808
|
+
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1809
|
+
), e;
|
|
1810
|
+
}
|
|
1811
|
+
function Xt(e, t) {
|
|
1812
|
+
const { id: n } = Le(), o = T({
|
|
1813
|
+
collapse: he,
|
|
1814
|
+
expand: he,
|
|
1815
|
+
getSize: () => ({
|
|
1816
|
+
asPercentage: 0,
|
|
1817
|
+
inPixels: 0
|
|
1818
|
+
}),
|
|
1819
|
+
isCollapsed: () => !1,
|
|
1820
|
+
resize: he
|
|
1821
|
+
});
|
|
1822
|
+
We(t, () => o.current, []), K(() => {
|
|
1823
|
+
Object.assign(
|
|
1824
|
+
o.current,
|
|
1825
|
+
et({ groupId: n, panelId: e })
|
|
1826
|
+
);
|
|
1827
|
+
});
|
|
1828
|
+
}
|
|
1829
|
+
function qt({
|
|
1830
|
+
children: e,
|
|
1831
|
+
className: t,
|
|
1832
|
+
collapsedSize: n = "0%",
|
|
1833
|
+
collapsible: o = !1,
|
|
1834
|
+
defaultSize: i,
|
|
1835
|
+
disabled: s,
|
|
1836
|
+
elementRef: l,
|
|
1837
|
+
groupResizeBehavior: r = "preserve-relative-size",
|
|
1838
|
+
id: a,
|
|
1839
|
+
maxSize: u = "100%",
|
|
1840
|
+
minSize: c = "0%",
|
|
1841
|
+
onResize: m,
|
|
1842
|
+
panelRef: d,
|
|
1843
|
+
style: v,
|
|
1844
|
+
...x
|
|
1845
|
+
}) {
|
|
1846
|
+
const f = !!a, h = xe(a), g = Pe({
|
|
1847
|
+
disabled: s
|
|
1848
|
+
}), y = T(null), z = we(y, l), {
|
|
1849
|
+
getPanelStyles: S,
|
|
1850
|
+
id: p,
|
|
1851
|
+
orientation: P,
|
|
1852
|
+
registerPanel: R,
|
|
1853
|
+
togglePanelDisabled: C
|
|
1854
|
+
} = Le(), X = m !== null, F = oe(
|
|
1855
|
+
(w, E, M) => {
|
|
1856
|
+
m?.(w, a, M);
|
|
1857
|
+
}
|
|
1858
|
+
);
|
|
1859
|
+
K(() => {
|
|
1860
|
+
const w = y.current;
|
|
1861
|
+
if (w !== null) {
|
|
1862
|
+
const E = {
|
|
1863
|
+
element: w,
|
|
1864
|
+
id: h,
|
|
1865
|
+
idIsStable: f,
|
|
1866
|
+
mutableValues: {
|
|
1867
|
+
expandToSize: void 0,
|
|
1868
|
+
prevSize: void 0
|
|
1869
|
+
},
|
|
1870
|
+
onResize: X ? F : void 0,
|
|
1871
|
+
panelConstraints: {
|
|
1872
|
+
groupResizeBehavior: r,
|
|
1873
|
+
collapsedSize: n,
|
|
1874
|
+
collapsible: o,
|
|
1875
|
+
defaultSize: i,
|
|
1876
|
+
disabled: g.disabled,
|
|
1877
|
+
maxSize: u,
|
|
1878
|
+
minSize: c
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
return R(E);
|
|
1882
|
+
}
|
|
1883
|
+
}, [
|
|
1884
|
+
r,
|
|
1885
|
+
n,
|
|
1886
|
+
o,
|
|
1887
|
+
i,
|
|
1888
|
+
X,
|
|
1889
|
+
h,
|
|
1890
|
+
f,
|
|
1891
|
+
u,
|
|
1892
|
+
c,
|
|
1893
|
+
F,
|
|
1894
|
+
R,
|
|
1895
|
+
g
|
|
1896
|
+
]), de(() => {
|
|
1897
|
+
C(h, !!s);
|
|
1898
|
+
}, [s, h, C]), Xt(h, d);
|
|
1899
|
+
const b = Ke(
|
|
1900
|
+
(w) => ye(p, w),
|
|
1901
|
+
// useSyncExternalStore does not support a custom equality check
|
|
1902
|
+
// stringify avoids re-rendering when the style value hasn't changed
|
|
1903
|
+
() => JSON.stringify(S(p, h)),
|
|
1904
|
+
() => JSON.stringify(S(p, h))
|
|
1905
|
+
);
|
|
1906
|
+
return /* @__PURE__ */ ie(
|
|
1907
|
+
"div",
|
|
1908
|
+
{
|
|
1909
|
+
...x,
|
|
1910
|
+
"aria-disabled": s || void 0,
|
|
1911
|
+
"data-panel": !0,
|
|
1912
|
+
"data-testid": h,
|
|
1913
|
+
id: h,
|
|
1914
|
+
ref: z,
|
|
1915
|
+
style: {
|
|
1916
|
+
...Yt,
|
|
1917
|
+
display: "flex",
|
|
1918
|
+
flexBasis: 0,
|
|
1919
|
+
flexShrink: 1,
|
|
1920
|
+
overflow: "visible",
|
|
1921
|
+
...JSON.parse(b)
|
|
1922
|
+
},
|
|
1923
|
+
children: /* @__PURE__ */ ie(
|
|
1924
|
+
"div",
|
|
1925
|
+
{
|
|
1926
|
+
className: t,
|
|
1927
|
+
style: {
|
|
1928
|
+
maxHeight: "100%",
|
|
1929
|
+
maxWidth: "100%",
|
|
1930
|
+
flexGrow: 1,
|
|
1931
|
+
overflow: "auto",
|
|
1932
|
+
...v,
|
|
1933
|
+
// Inform the browser that the library is handling touch events for this element
|
|
1934
|
+
// but still allow users to scroll content within panels in the non-resizing direction
|
|
1935
|
+
// NOTE This is not an inherited style
|
|
1936
|
+
// See github.com/bvaughn/react-resizable-panels/issues/662
|
|
1937
|
+
touchAction: P === "horizontal" ? "pan-y" : "pan-x"
|
|
1938
|
+
},
|
|
1939
|
+
children: e
|
|
1940
|
+
}
|
|
1941
|
+
)
|
|
1942
|
+
}
|
|
1943
|
+
);
|
|
1944
|
+
}
|
|
1945
|
+
qt.displayName = "Panel";
|
|
1946
|
+
const Yt = {
|
|
1947
|
+
minHeight: 0,
|
|
1948
|
+
maxHeight: "100%",
|
|
1949
|
+
height: "auto",
|
|
1950
|
+
minWidth: 0,
|
|
1951
|
+
maxWidth: "100%",
|
|
1952
|
+
width: "auto",
|
|
1953
|
+
border: "none",
|
|
1954
|
+
borderWidth: 0,
|
|
1955
|
+
padding: 0,
|
|
1956
|
+
margin: 0
|
|
1957
|
+
};
|
|
1958
|
+
function sn() {
|
|
1959
|
+
return re(null);
|
|
1960
|
+
}
|
|
1961
|
+
function an() {
|
|
1962
|
+
return T(null);
|
|
1963
|
+
}
|
|
1964
|
+
function Jt({
|
|
1965
|
+
layout: e,
|
|
1966
|
+
panelConstraints: t,
|
|
1967
|
+
panelId: n,
|
|
1968
|
+
panelIndex: o
|
|
1969
|
+
}) {
|
|
1970
|
+
let i, s;
|
|
1971
|
+
const l = e[n], r = t.find(
|
|
1972
|
+
(a) => a.panelId === n
|
|
1973
|
+
);
|
|
1974
|
+
if (r) {
|
|
1975
|
+
const a = r.maxSize, u = r.collapsible ? r.collapsedSize : r.minSize, c = [o, o + 1];
|
|
1976
|
+
s = B({
|
|
1977
|
+
layout: se({
|
|
1978
|
+
delta: u - l,
|
|
1979
|
+
initialLayout: e,
|
|
1980
|
+
panelConstraints: t,
|
|
1981
|
+
pivotIndices: c,
|
|
1982
|
+
prevLayout: e
|
|
1983
|
+
}),
|
|
1984
|
+
panelConstraints: t
|
|
1985
|
+
})[n], i = B({
|
|
1986
|
+
layout: se({
|
|
1987
|
+
delta: a - l,
|
|
1988
|
+
initialLayout: e,
|
|
1989
|
+
panelConstraints: t,
|
|
1990
|
+
pivotIndices: c,
|
|
1991
|
+
prevLayout: e
|
|
1992
|
+
}),
|
|
1993
|
+
panelConstraints: t
|
|
1994
|
+
})[n];
|
|
1995
|
+
}
|
|
1996
|
+
return {
|
|
1997
|
+
valueControls: n,
|
|
1998
|
+
valueMax: i,
|
|
1999
|
+
valueMin: s,
|
|
2000
|
+
valueNow: l
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
function Zt({
|
|
2004
|
+
children: e,
|
|
2005
|
+
className: t,
|
|
2006
|
+
disabled: n,
|
|
2007
|
+
elementRef: o,
|
|
2008
|
+
id: i,
|
|
2009
|
+
style: s,
|
|
2010
|
+
...l
|
|
2011
|
+
}) {
|
|
2012
|
+
const r = xe(i), a = Pe({
|
|
2013
|
+
disabled: n
|
|
2014
|
+
}), [u, c] = re({}), [m, d] = re("inactive"), v = T(null), x = we(v, o), {
|
|
2015
|
+
disableCursor: f,
|
|
2016
|
+
id: h,
|
|
2017
|
+
orientation: g,
|
|
2018
|
+
registerSeparator: y,
|
|
2019
|
+
toggleSeparatorDisabled: z
|
|
2020
|
+
} = Le(), S = g === "horizontal" ? "vertical" : "horizontal";
|
|
2021
|
+
K(() => {
|
|
2022
|
+
const P = v.current;
|
|
2023
|
+
if (P !== null) {
|
|
2024
|
+
const R = {
|
|
2025
|
+
disabled: a.disabled,
|
|
2026
|
+
element: P,
|
|
2027
|
+
id: r
|
|
2028
|
+
}, C = y(R), X = Gt(
|
|
2029
|
+
(b) => {
|
|
2030
|
+
d(
|
|
2031
|
+
b.next.state !== "inactive" && b.next.hitRegions.some(
|
|
2032
|
+
(w) => w.separator === R
|
|
2033
|
+
) ? b.next.state : "inactive"
|
|
2034
|
+
);
|
|
2035
|
+
}
|
|
2036
|
+
), F = ye(
|
|
2037
|
+
h,
|
|
2038
|
+
(b) => {
|
|
2039
|
+
const { derivedPanelConstraints: w, layout: E, separatorToPanels: M } = b.next, k = M.get(R);
|
|
2040
|
+
if (k) {
|
|
2041
|
+
const O = k[0], H = k.indexOf(O);
|
|
2042
|
+
c(
|
|
2043
|
+
Jt({
|
|
2044
|
+
layout: E,
|
|
2045
|
+
panelConstraints: w,
|
|
2046
|
+
panelId: O.id,
|
|
2047
|
+
panelIndex: H
|
|
2048
|
+
})
|
|
2049
|
+
);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
);
|
|
2053
|
+
return () => {
|
|
2054
|
+
X(), F(), C();
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
}, [h, r, y, a]), de(() => {
|
|
2058
|
+
z(r, !!n);
|
|
2059
|
+
}, [n, r, z]);
|
|
2060
|
+
let p;
|
|
2061
|
+
return n && !f && (p = "not-allowed"), /* @__PURE__ */ ie(
|
|
2062
|
+
"div",
|
|
2063
|
+
{
|
|
2064
|
+
...l,
|
|
2065
|
+
"aria-controls": u.valueControls,
|
|
2066
|
+
"aria-disabled": n || void 0,
|
|
2067
|
+
"aria-orientation": S,
|
|
2068
|
+
"aria-valuemax": u.valueMax,
|
|
2069
|
+
"aria-valuemin": u.valueMin,
|
|
2070
|
+
"aria-valuenow": u.valueNow,
|
|
2071
|
+
children: e,
|
|
2072
|
+
className: t,
|
|
2073
|
+
"data-separator": n ? "disabled" : m,
|
|
2074
|
+
"data-testid": r,
|
|
2075
|
+
id: r,
|
|
2076
|
+
ref: x,
|
|
2077
|
+
role: "separator",
|
|
2078
|
+
style: {
|
|
2079
|
+
flexBasis: "auto",
|
|
2080
|
+
cursor: p,
|
|
2081
|
+
...s,
|
|
2082
|
+
flexGrow: 0,
|
|
2083
|
+
flexShrink: 0,
|
|
2084
|
+
// Inform the browser that the library is handling touch events for this element
|
|
2085
|
+
// See github.com/bvaughn/react-resizable-panels/issues/662
|
|
2086
|
+
touchAction: "none"
|
|
2087
|
+
},
|
|
2088
|
+
tabIndex: n ? void 0 : 0
|
|
2089
|
+
}
|
|
2090
|
+
);
|
|
2091
|
+
}
|
|
2092
|
+
Zt.displayName = "Separator";
|
|
2093
|
+
export {
|
|
2094
|
+
Ut as Group,
|
|
2095
|
+
qt as Panel,
|
|
2096
|
+
Zt as Separator,
|
|
2097
|
+
Pt as isCoarsePointer,
|
|
2098
|
+
nn as useDefaultLayout,
|
|
2099
|
+
on as useGroupCallbackRef,
|
|
2100
|
+
rn as useGroupRef,
|
|
2101
|
+
sn as usePanelCallbackRef,
|
|
2102
|
+
an as usePanelRef
|
|
2103
|
+
};
|
|
2104
|
+
//# sourceMappingURL=react-resizable-panels.js.map
|