react-resizable-panels 4.0.0-alpha.0 → 4.0.0-alpha.2
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.
|
@@ -1,21 +1,74 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useId as
|
|
4
|
-
function
|
|
2
|
+
import { jsx as j } from "react/jsx-runtime";
|
|
3
|
+
import { useId as De, useLayoutEffect as Te, useEffect as Ae, useRef as D, useCallback as ge, createContext as $e, useImperativeHandle as Se, useState as R, useMemo as xe, useSyncExternalStore as Ne, useContext as _e } from "react";
|
|
4
|
+
function re(e, t) {
|
|
5
|
+
return t.sort(
|
|
6
|
+
e === "horizontal" ? Fe : He
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
function Fe(e, t) {
|
|
10
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
11
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
12
|
+
}
|
|
13
|
+
function He(e, t) {
|
|
14
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
15
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
16
|
+
}
|
|
17
|
+
function ze(e) {
|
|
18
|
+
const { element: t, orientation: n, panels: o, separators: s } = e, i = re(
|
|
19
|
+
n,
|
|
20
|
+
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
21
|
+
).map(({ element: c }) => c), a = [];
|
|
22
|
+
let r, l;
|
|
23
|
+
for (const c of i) {
|
|
24
|
+
const u = o.find(
|
|
25
|
+
(f) => f.element === c
|
|
26
|
+
);
|
|
27
|
+
if (u) {
|
|
28
|
+
if (r) {
|
|
29
|
+
const f = r.element.getBoundingClientRect(), m = c.getBoundingClientRect();
|
|
30
|
+
a.push({
|
|
31
|
+
group: e,
|
|
32
|
+
panels: [r, u],
|
|
33
|
+
separator: l,
|
|
34
|
+
rect: n === "horizontal" ? new DOMRect(
|
|
35
|
+
f.right,
|
|
36
|
+
m.top,
|
|
37
|
+
m.left - f.right,
|
|
38
|
+
m.height
|
|
39
|
+
) : new DOMRect(
|
|
40
|
+
m.left,
|
|
41
|
+
f.bottom,
|
|
42
|
+
m.width,
|
|
43
|
+
m.top - f.bottom
|
|
44
|
+
)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
r = u, l = void 0;
|
|
48
|
+
} else {
|
|
49
|
+
const f = s.find(
|
|
50
|
+
(m) => m.element === c
|
|
51
|
+
);
|
|
52
|
+
f ? l = f : (r = void 0, l = void 0);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return a;
|
|
56
|
+
}
|
|
57
|
+
function je(e, t) {
|
|
5
58
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
6
59
|
return t * o;
|
|
7
60
|
}
|
|
8
|
-
function
|
|
61
|
+
function We(e, t) {
|
|
9
62
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
10
63
|
return t * o;
|
|
11
64
|
}
|
|
12
|
-
function
|
|
65
|
+
function Ue(e) {
|
|
13
66
|
return e / 100 * window.innerHeight;
|
|
14
67
|
}
|
|
15
|
-
function
|
|
68
|
+
function Be(e) {
|
|
16
69
|
return e / 100 * window.innerWidth;
|
|
17
70
|
}
|
|
18
|
-
function
|
|
71
|
+
function Ke(e) {
|
|
19
72
|
switch (typeof e) {
|
|
20
73
|
case "number":
|
|
21
74
|
return [e, "px"];
|
|
@@ -25,13 +78,13 @@ function Ne(e) {
|
|
|
25
78
|
}
|
|
26
79
|
}
|
|
27
80
|
}
|
|
28
|
-
function
|
|
81
|
+
function Y({
|
|
29
82
|
groupSize: e,
|
|
30
83
|
panelElement: t,
|
|
31
84
|
styleProp: n
|
|
32
85
|
}) {
|
|
33
86
|
let o;
|
|
34
|
-
const [s, i] =
|
|
87
|
+
const [s, i] = Ke(n);
|
|
35
88
|
switch (i) {
|
|
36
89
|
case "%": {
|
|
37
90
|
o = s / 100 * e;
|
|
@@ -42,72 +95,72 @@ function H({
|
|
|
42
95
|
break;
|
|
43
96
|
}
|
|
44
97
|
case "rem": {
|
|
45
|
-
o =
|
|
98
|
+
o = We(t, s);
|
|
46
99
|
break;
|
|
47
100
|
}
|
|
48
101
|
case "em": {
|
|
49
|
-
o =
|
|
102
|
+
o = je(t, s);
|
|
50
103
|
break;
|
|
51
104
|
}
|
|
52
105
|
case "vh": {
|
|
53
|
-
o =
|
|
106
|
+
o = Ue(s);
|
|
54
107
|
break;
|
|
55
108
|
}
|
|
56
109
|
case "vw": {
|
|
57
|
-
o =
|
|
110
|
+
o = Be(s);
|
|
58
111
|
break;
|
|
59
112
|
}
|
|
60
113
|
}
|
|
61
114
|
return o;
|
|
62
115
|
}
|
|
63
|
-
function
|
|
116
|
+
function C(e) {
|
|
64
117
|
return parseFloat(e.toFixed(3));
|
|
65
118
|
}
|
|
66
|
-
function
|
|
119
|
+
function le({
|
|
67
120
|
group: e
|
|
68
121
|
}) {
|
|
69
|
-
const {
|
|
122
|
+
const { orientation: t, panels: n } = e;
|
|
70
123
|
return n.reduce((o, s) => (o += t === "horizontal" ? s.element.offsetWidth : s.element.offsetHeight, o), 0);
|
|
71
124
|
}
|
|
72
|
-
function
|
|
73
|
-
const { panels: t } = e, n =
|
|
125
|
+
function pe(e) {
|
|
126
|
+
const { panels: t } = e, n = le({ group: e });
|
|
74
127
|
return t.map((o) => {
|
|
75
128
|
const { element: s, panelConstraints: i } = o;
|
|
76
129
|
let a = 0;
|
|
77
130
|
if (i.collapsedSize) {
|
|
78
|
-
const u =
|
|
131
|
+
const u = Y({
|
|
79
132
|
groupSize: n,
|
|
80
133
|
panelElement: s,
|
|
81
134
|
styleProp: i.collapsedSize
|
|
82
135
|
});
|
|
83
|
-
a =
|
|
136
|
+
a = C(u / n * 100);
|
|
84
137
|
}
|
|
85
138
|
let r;
|
|
86
139
|
if (i.defaultSize) {
|
|
87
|
-
const u =
|
|
140
|
+
const u = Y({
|
|
88
141
|
groupSize: n,
|
|
89
142
|
panelElement: s,
|
|
90
143
|
styleProp: i.defaultSize
|
|
91
144
|
});
|
|
92
|
-
r =
|
|
145
|
+
r = C(u / n * 100);
|
|
93
146
|
}
|
|
94
147
|
let l = 0;
|
|
95
148
|
if (i.minSize) {
|
|
96
|
-
const u =
|
|
149
|
+
const u = Y({
|
|
97
150
|
groupSize: n,
|
|
98
151
|
panelElement: s,
|
|
99
152
|
styleProp: i.minSize
|
|
100
153
|
});
|
|
101
|
-
l =
|
|
154
|
+
l = C(u / n * 100);
|
|
102
155
|
}
|
|
103
156
|
let c = 100;
|
|
104
157
|
if (i.maxSize) {
|
|
105
|
-
const u =
|
|
158
|
+
const u = Y({
|
|
106
159
|
groupSize: n,
|
|
107
160
|
panelElement: s,
|
|
108
161
|
styleProp: i.maxSize
|
|
109
162
|
});
|
|
110
|
-
c =
|
|
163
|
+
c = C(u / n * 100);
|
|
111
164
|
}
|
|
112
165
|
return {
|
|
113
166
|
collapsedSize: a,
|
|
@@ -119,7 +172,11 @@ function ie(e) {
|
|
|
119
172
|
};
|
|
120
173
|
});
|
|
121
174
|
}
|
|
122
|
-
|
|
175
|
+
function S(e, t = "Assertion error") {
|
|
176
|
+
if (!e)
|
|
177
|
+
throw console.error(t), Error(t);
|
|
178
|
+
}
|
|
179
|
+
class Ve {
|
|
123
180
|
#e = {};
|
|
124
181
|
addListener(t, n) {
|
|
125
182
|
const o = this.#e[t];
|
|
@@ -158,70 +215,403 @@ class $e {
|
|
|
158
215
|
}
|
|
159
216
|
}
|
|
160
217
|
}
|
|
161
|
-
|
|
218
|
+
function L(e, t, n = 0) {
|
|
219
|
+
return Math.abs(C(e) - C(t)) <= n;
|
|
220
|
+
}
|
|
221
|
+
let P = {
|
|
162
222
|
cursorFlags: 0,
|
|
163
223
|
interactionState: {
|
|
164
224
|
state: "inactive"
|
|
165
225
|
},
|
|
166
226
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
167
227
|
};
|
|
168
|
-
const
|
|
169
|
-
function
|
|
170
|
-
return
|
|
228
|
+
const A = new Ve();
|
|
229
|
+
function k() {
|
|
230
|
+
return P;
|
|
171
231
|
}
|
|
172
|
-
function
|
|
173
|
-
const t = typeof e == "function" ? e(
|
|
174
|
-
|
|
175
|
-
|
|
232
|
+
function M(e) {
|
|
233
|
+
const t = typeof e == "function" ? e(P) : e;
|
|
234
|
+
if (P === t)
|
|
235
|
+
return P;
|
|
236
|
+
const n = P;
|
|
237
|
+
return P = {
|
|
238
|
+
...P,
|
|
176
239
|
...t
|
|
177
|
-
}, t.cursorFlags !== void 0 &&
|
|
240
|
+
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", P.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", P.interactionState), t.mountedGroups !== void 0 && (P.mountedGroups.forEach((o, s) => {
|
|
241
|
+
o.derivedPanelConstraints.forEach((i) => {
|
|
242
|
+
if (i.collapsible) {
|
|
243
|
+
const { layout: a } = n.mountedGroups.get(s) ?? {};
|
|
244
|
+
if (a) {
|
|
245
|
+
const r = L(
|
|
246
|
+
i.collapsedSize,
|
|
247
|
+
o.layout[i.panelId]
|
|
248
|
+
), l = L(
|
|
249
|
+
i.collapsedSize,
|
|
250
|
+
a[i.panelId]
|
|
251
|
+
);
|
|
252
|
+
r && !l && (s.inMemoryLastExpandedPanelSizes[i.panelId] = a[i.panelId]);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}), A.emit("mountedGroupsChange", P.mountedGroups)), P;
|
|
178
257
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
258
|
+
function Xe(e, t) {
|
|
259
|
+
if (e.length !== t.length)
|
|
260
|
+
return !1;
|
|
261
|
+
for (let n = 0; n < e.length; n++)
|
|
262
|
+
if (e[n] != t[n])
|
|
263
|
+
return !1;
|
|
264
|
+
return !0;
|
|
265
|
+
}
|
|
266
|
+
function W(e, t) {
|
|
267
|
+
return L(e, t) ? 0 : e > t ? 1 : -1;
|
|
268
|
+
}
|
|
269
|
+
function _({
|
|
270
|
+
panelConstraints: e,
|
|
271
|
+
size: t
|
|
272
|
+
}) {
|
|
273
|
+
const {
|
|
274
|
+
collapsedSize: n = 0,
|
|
275
|
+
collapsible: o,
|
|
276
|
+
maxSize: s = 100,
|
|
277
|
+
minSize: i = 0
|
|
278
|
+
} = e;
|
|
279
|
+
if (W(t, i) < 0)
|
|
280
|
+
if (o) {
|
|
281
|
+
const a = (n + i) / 2;
|
|
282
|
+
W(t, a) < 0 ? t = n : t = i;
|
|
283
|
+
} else
|
|
284
|
+
t = i;
|
|
285
|
+
return t = Math.min(s, t), t = C(t), t;
|
|
286
|
+
}
|
|
287
|
+
function Q({
|
|
288
|
+
delta: e,
|
|
289
|
+
initialLayout: t,
|
|
290
|
+
panelConstraints: n,
|
|
291
|
+
pivotIndices: o,
|
|
292
|
+
prevLayout: s,
|
|
293
|
+
trigger: i
|
|
294
|
+
}) {
|
|
295
|
+
if (L(e, 0))
|
|
296
|
+
return t;
|
|
297
|
+
const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
|
|
298
|
+
S(c != null, "Invalid first pivot index"), S(u != null, "Invalid second pivot index");
|
|
299
|
+
let f = 0;
|
|
300
|
+
if (i === "keyboard") {
|
|
301
|
+
{
|
|
302
|
+
const p = e < 0 ? u : c, d = n[p];
|
|
303
|
+
S(
|
|
304
|
+
d,
|
|
305
|
+
`Panel constraints not found for index ${p}`
|
|
306
|
+
);
|
|
307
|
+
const {
|
|
308
|
+
collapsedSize: h = 0,
|
|
309
|
+
collapsible: v,
|
|
310
|
+
minSize: z = 0
|
|
311
|
+
} = d;
|
|
312
|
+
if (v) {
|
|
313
|
+
const x = a[p];
|
|
314
|
+
if (S(
|
|
315
|
+
x != null,
|
|
316
|
+
`Previous layout not found for panel index ${p}`
|
|
317
|
+
), L(x, h)) {
|
|
318
|
+
const y = z - x;
|
|
319
|
+
W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
{
|
|
324
|
+
const p = e < 0 ? c : u, d = n[p];
|
|
325
|
+
S(
|
|
326
|
+
d,
|
|
327
|
+
`No panel constraints found for index ${p}`
|
|
328
|
+
);
|
|
329
|
+
const {
|
|
330
|
+
collapsedSize: h = 0,
|
|
331
|
+
collapsible: v,
|
|
332
|
+
minSize: z = 0
|
|
333
|
+
} = d;
|
|
334
|
+
if (v) {
|
|
335
|
+
const x = a[p];
|
|
336
|
+
if (S(
|
|
337
|
+
x != null,
|
|
338
|
+
`Previous layout not found for panel index ${p}`
|
|
339
|
+
), L(x, z)) {
|
|
340
|
+
const y = x - h;
|
|
341
|
+
W(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
{
|
|
347
|
+
const p = e < 0 ? 1 : -1;
|
|
348
|
+
let d = e < 0 ? u : c, h = 0;
|
|
349
|
+
for (; ; ) {
|
|
350
|
+
const z = a[d];
|
|
351
|
+
S(
|
|
352
|
+
z != null,
|
|
353
|
+
`Previous layout not found for panel index ${d}`
|
|
354
|
+
);
|
|
355
|
+
const y = _({
|
|
356
|
+
panelConstraints: n[d],
|
|
357
|
+
size: 100
|
|
358
|
+
}) - z;
|
|
359
|
+
if (h += y, d += p, d < 0 || d >= n.length)
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
const v = Math.min(Math.abs(e), Math.abs(h));
|
|
363
|
+
e = e < 0 ? 0 - v : v;
|
|
364
|
+
}
|
|
365
|
+
{
|
|
366
|
+
let d = e < 0 ? c : u;
|
|
367
|
+
for (; d >= 0 && d < n.length; ) {
|
|
368
|
+
const h = Math.abs(e) - Math.abs(f), v = a[d];
|
|
369
|
+
S(
|
|
370
|
+
v != null,
|
|
371
|
+
`Previous layout not found for panel index ${d}`
|
|
372
|
+
);
|
|
373
|
+
const z = v - h, x = _({
|
|
374
|
+
panelConstraints: n[d],
|
|
375
|
+
size: z
|
|
376
|
+
});
|
|
377
|
+
if (!L(v, x) && (f += v - x, l[d] = x, f.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
378
|
+
numeric: !0
|
|
379
|
+
}) >= 0))
|
|
380
|
+
break;
|
|
381
|
+
e < 0 ? d-- : d++;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
if (Xe(r, l))
|
|
385
|
+
return s;
|
|
386
|
+
{
|
|
387
|
+
const p = e < 0 ? u : c, d = a[p];
|
|
388
|
+
S(
|
|
389
|
+
d != null,
|
|
390
|
+
`Previous layout not found for panel index ${p}`
|
|
193
391
|
);
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
p.width,
|
|
210
|
-
p.top - f.bottom
|
|
211
|
-
)
|
|
392
|
+
const h = d + f, v = _({
|
|
393
|
+
panelConstraints: n[p],
|
|
394
|
+
size: h
|
|
395
|
+
});
|
|
396
|
+
if (l[p] = v, !L(v, h)) {
|
|
397
|
+
let z = h - v, y = e < 0 ? u : c;
|
|
398
|
+
for (; y >= 0 && y < n.length; ) {
|
|
399
|
+
const w = l[y];
|
|
400
|
+
S(
|
|
401
|
+
w != null,
|
|
402
|
+
`Previous layout not found for panel index ${y}`
|
|
403
|
+
);
|
|
404
|
+
const G = w + z, O = _({
|
|
405
|
+
panelConstraints: n[y],
|
|
406
|
+
size: G
|
|
212
407
|
});
|
|
408
|
+
if (L(w, O) || (z -= O - w, l[y] = O), L(z, 0))
|
|
409
|
+
break;
|
|
410
|
+
e > 0 ? y-- : y++;
|
|
213
411
|
}
|
|
214
|
-
r = u;
|
|
215
|
-
} else {
|
|
216
|
-
const f = s.find(
|
|
217
|
-
(p) => p.element === c
|
|
218
|
-
);
|
|
219
|
-
f ? l = f : (r = void 0, l = void 0);
|
|
220
412
|
}
|
|
221
413
|
}
|
|
222
|
-
|
|
414
|
+
const m = Object.values(l).reduce(
|
|
415
|
+
(p, d) => d + p,
|
|
416
|
+
0
|
|
417
|
+
);
|
|
418
|
+
if (!L(m, 100, 0.1))
|
|
419
|
+
return s;
|
|
420
|
+
const g = Object.keys(s);
|
|
421
|
+
return l.reduce((p, d, h) => (p[g[h]] = d, p), {});
|
|
422
|
+
}
|
|
423
|
+
function J(e) {
|
|
424
|
+
const t = e.parentElement;
|
|
425
|
+
S(t, "Parent group element not found");
|
|
426
|
+
const { mountedGroups: n } = k();
|
|
427
|
+
for (const [o] of n)
|
|
428
|
+
if (o.element === t)
|
|
429
|
+
return o;
|
|
430
|
+
throw Error("Could not find parent Group for separator element");
|
|
431
|
+
}
|
|
432
|
+
function ee(e, t) {
|
|
433
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
434
|
+
return !1;
|
|
435
|
+
for (const n in e)
|
|
436
|
+
if (W(e[n], t[n]) !== 0)
|
|
437
|
+
return !1;
|
|
438
|
+
return !0;
|
|
439
|
+
}
|
|
440
|
+
function F({
|
|
441
|
+
layout: e,
|
|
442
|
+
panelConstraints: t
|
|
443
|
+
}) {
|
|
444
|
+
const o = [...Object.values(e)], s = o.reduce(
|
|
445
|
+
(r, l) => r + l,
|
|
446
|
+
0
|
|
447
|
+
);
|
|
448
|
+
if (o.length !== t.length)
|
|
449
|
+
throw Error(
|
|
450
|
+
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
451
|
+
);
|
|
452
|
+
if (!L(s, 100) && o.length > 0)
|
|
453
|
+
for (let r = 0; r < t.length; r++) {
|
|
454
|
+
const l = o[r];
|
|
455
|
+
S(l != null, `No layout data found for index ${r}`);
|
|
456
|
+
const c = 100 / s * l;
|
|
457
|
+
o[r] = c;
|
|
458
|
+
}
|
|
459
|
+
let i = 0;
|
|
460
|
+
for (let r = 0; r < t.length; r++) {
|
|
461
|
+
const l = o[r];
|
|
462
|
+
S(l != null, `No layout data found for index ${r}`);
|
|
463
|
+
const c = _({
|
|
464
|
+
panelConstraints: t[r],
|
|
465
|
+
size: l
|
|
466
|
+
});
|
|
467
|
+
l != c && (i += l - c, o[r] = c);
|
|
468
|
+
}
|
|
469
|
+
if (!L(i, 0))
|
|
470
|
+
for (let r = 0; r < t.length; r++) {
|
|
471
|
+
const l = o[r];
|
|
472
|
+
S(l != null, `No layout data found for index ${r}`);
|
|
473
|
+
const c = l + i, u = _({
|
|
474
|
+
panelConstraints: t[r],
|
|
475
|
+
size: c
|
|
476
|
+
});
|
|
477
|
+
if (l !== u && (i -= u - l, o[r] = u, L(i, 0)))
|
|
478
|
+
break;
|
|
479
|
+
}
|
|
480
|
+
const a = Object.keys(e);
|
|
481
|
+
return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
|
|
223
482
|
}
|
|
224
|
-
function
|
|
483
|
+
function be({
|
|
484
|
+
groupId: e
|
|
485
|
+
}) {
|
|
486
|
+
const t = () => {
|
|
487
|
+
const { mountedGroups: n } = k();
|
|
488
|
+
for (const [o, s] of n)
|
|
489
|
+
if (o.id === e)
|
|
490
|
+
return { group: o, ...s };
|
|
491
|
+
throw Error(`Group ${e} not found`);
|
|
492
|
+
};
|
|
493
|
+
return {
|
|
494
|
+
getLayout() {
|
|
495
|
+
const { layout: n } = t();
|
|
496
|
+
return n;
|
|
497
|
+
},
|
|
498
|
+
setLayout(n) {
|
|
499
|
+
const {
|
|
500
|
+
derivedPanelConstraints: o,
|
|
501
|
+
group: s,
|
|
502
|
+
layout: i,
|
|
503
|
+
separatorToPanels: a
|
|
504
|
+
} = t(), r = F({
|
|
505
|
+
layout: n,
|
|
506
|
+
panelConstraints: o
|
|
507
|
+
});
|
|
508
|
+
return ee(i, r) || M((l) => ({
|
|
509
|
+
mountedGroups: new Map(l.mountedGroups).set(s, {
|
|
510
|
+
derivedPanelConstraints: o,
|
|
511
|
+
layout: r,
|
|
512
|
+
separatorToPanels: a
|
|
513
|
+
})
|
|
514
|
+
})), r;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
function we(e) {
|
|
519
|
+
const { mountedGroups: t } = k(), n = t.get(e);
|
|
520
|
+
return S(n, `Mounted Group ${e.id} not found`), n;
|
|
521
|
+
}
|
|
522
|
+
function T(e, t) {
|
|
523
|
+
const n = J(e), o = we(n), s = n.separators.find(
|
|
524
|
+
(f) => f.element === e
|
|
525
|
+
);
|
|
526
|
+
S(s, "Matching separator not found");
|
|
527
|
+
const i = o.separatorToPanels.get(s);
|
|
528
|
+
S(i, "Matching panels not found");
|
|
529
|
+
const a = i.map((f) => n.panels.indexOf(f)), l = be({ groupId: n.id }).getLayout(), c = Q({
|
|
530
|
+
delta: t,
|
|
531
|
+
initialLayout: l,
|
|
532
|
+
panelConstraints: o.derivedPanelConstraints,
|
|
533
|
+
pivotIndices: a,
|
|
534
|
+
prevLayout: l,
|
|
535
|
+
trigger: "keyboard"
|
|
536
|
+
}), u = F({
|
|
537
|
+
layout: c,
|
|
538
|
+
panelConstraints: o.derivedPanelConstraints
|
|
539
|
+
});
|
|
540
|
+
ee(l, u) || M((f) => ({
|
|
541
|
+
mountedGroups: new Map(f.mountedGroups).set(n, {
|
|
542
|
+
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
543
|
+
layout: u,
|
|
544
|
+
separatorToPanels: o.separatorToPanels
|
|
545
|
+
})
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
548
|
+
function me(e) {
|
|
549
|
+
if (e.defaultPrevented)
|
|
550
|
+
return;
|
|
551
|
+
const t = e.currentTarget, n = J(t);
|
|
552
|
+
if (!n.disabled)
|
|
553
|
+
switch (e.key) {
|
|
554
|
+
case "ArrowDown": {
|
|
555
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, 5);
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
case "ArrowLeft": {
|
|
559
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
|
|
560
|
+
break;
|
|
561
|
+
}
|
|
562
|
+
case "ArrowRight": {
|
|
563
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
|
|
564
|
+
break;
|
|
565
|
+
}
|
|
566
|
+
case "ArrowUp": {
|
|
567
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, -5);
|
|
568
|
+
break;
|
|
569
|
+
}
|
|
570
|
+
case "End": {
|
|
571
|
+
e.preventDefault(), T(t, 100);
|
|
572
|
+
break;
|
|
573
|
+
}
|
|
574
|
+
case "Enter": {
|
|
575
|
+
e.preventDefault();
|
|
576
|
+
const o = J(t), { derivedPanelConstraints: s, layout: i, separatorToPanels: a } = we(o), r = o.separators.find(
|
|
577
|
+
(f) => f.element === t
|
|
578
|
+
);
|
|
579
|
+
S(r, "Matching separator not found");
|
|
580
|
+
const l = a.get(r);
|
|
581
|
+
S(l, "Matching panels not found");
|
|
582
|
+
const c = l[0], u = s.find(
|
|
583
|
+
(f) => f.panelId === c.id
|
|
584
|
+
);
|
|
585
|
+
if (S(u, "Panel metadata not found"), u.collapsible) {
|
|
586
|
+
const f = i[c.id], m = u.collapsedSize === f ? o.inMemoryLastExpandedPanelSizes[c.id] ?? u.minSize : u.collapsedSize;
|
|
587
|
+
T(t, m - f);
|
|
588
|
+
}
|
|
589
|
+
break;
|
|
590
|
+
}
|
|
591
|
+
case "F6": {
|
|
592
|
+
e.preventDefault();
|
|
593
|
+
const s = J(t).separators.map(
|
|
594
|
+
(l) => l.element
|
|
595
|
+
), i = Array.from(s).findIndex(
|
|
596
|
+
(l) => l === e.currentTarget
|
|
597
|
+
);
|
|
598
|
+
S(i !== null, "Index not found");
|
|
599
|
+
const a = e.shiftKey ? i > 0 ? i - 1 : s.length - 1 : i + 1 < s.length ? i + 1 : 0;
|
|
600
|
+
s[a].focus();
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
case "Home": {
|
|
604
|
+
e.preventDefault(), T(t, -100);
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const Ye = (e) => e, oe = () => {
|
|
610
|
+
}, Le = 1, Pe = 2, Ee = 4, Re = 8, he = {
|
|
611
|
+
coarse: 10,
|
|
612
|
+
precise: 5
|
|
613
|
+
};
|
|
614
|
+
function Ze(e, t) {
|
|
225
615
|
return {
|
|
226
616
|
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
227
617
|
Math.abs(e.x - t.left),
|
|
@@ -233,13 +623,13 @@ function De(e, t) {
|
|
|
233
623
|
)
|
|
234
624
|
};
|
|
235
625
|
}
|
|
236
|
-
function
|
|
626
|
+
function qe(e, t, n) {
|
|
237
627
|
let o, s = {
|
|
238
628
|
x: 1 / 0,
|
|
239
629
|
y: 1 / 0
|
|
240
630
|
};
|
|
241
631
|
for (const i of t) {
|
|
242
|
-
const a =
|
|
632
|
+
const a = Ze(n, i.rect);
|
|
243
633
|
switch (e) {
|
|
244
634
|
case "horizontal": {
|
|
245
635
|
a.x <= s.x && (o = i, s = a);
|
|
@@ -256,33 +646,33 @@ function Fe(e, t, n) {
|
|
|
256
646
|
hitRegion: o
|
|
257
647
|
} : void 0;
|
|
258
648
|
}
|
|
259
|
-
let
|
|
260
|
-
function
|
|
261
|
-
return
|
|
649
|
+
let Z;
|
|
650
|
+
function Je() {
|
|
651
|
+
return Z === void 0 && (typeof matchMedia == "function" ? Z = !!matchMedia("(pointer:coarse)").matches : Z = !1), Z;
|
|
262
652
|
}
|
|
263
|
-
function
|
|
653
|
+
function Ce(e, t) {
|
|
264
654
|
const n = [];
|
|
265
655
|
return t.forEach((o, s) => {
|
|
266
656
|
if (s.disabled)
|
|
267
657
|
return;
|
|
268
|
-
const i =
|
|
658
|
+
const i = Je() ? he.coarse : he.precise, a = ze(s), r = qe(s.orientation, a, {
|
|
269
659
|
x: e.clientX,
|
|
270
660
|
y: e.clientY
|
|
271
661
|
});
|
|
272
662
|
r && r.distance.x <= i && r.distance.y <= i && n.push(r.hitRegion);
|
|
273
663
|
}), n;
|
|
274
664
|
}
|
|
275
|
-
function
|
|
665
|
+
function ve(e) {
|
|
276
666
|
if (e.defaultPrevented)
|
|
277
667
|
return;
|
|
278
|
-
const { mountedGroups: t } =
|
|
668
|
+
const { mountedGroups: t } = k(), n = Ce(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
279
669
|
n.forEach((r) => {
|
|
280
670
|
o.add(r.group), r.panels.forEach((c) => {
|
|
281
671
|
s.add(c);
|
|
282
672
|
}), r.separator && i.add(r.separator);
|
|
283
673
|
const l = t.get(r.group);
|
|
284
674
|
l && a.set(r.group, l.layout);
|
|
285
|
-
}),
|
|
675
|
+
}), M({
|
|
286
676
|
interactionState: {
|
|
287
677
|
hitRegions: n,
|
|
288
678
|
initialLayoutMap: a,
|
|
@@ -291,7 +681,7 @@ function se(e) {
|
|
|
291
681
|
}
|
|
292
682
|
}), n.length && e.preventDefault();
|
|
293
683
|
}
|
|
294
|
-
function
|
|
684
|
+
function Qe({
|
|
295
685
|
cursorFlags: e,
|
|
296
686
|
groups: t,
|
|
297
687
|
state: n
|
|
@@ -302,7 +692,7 @@ function He({
|
|
|
302
692
|
case "hover":
|
|
303
693
|
t.forEach((i) => {
|
|
304
694
|
if (!i.disableCursor)
|
|
305
|
-
switch (i.
|
|
695
|
+
switch (i.orientation) {
|
|
306
696
|
case "horizontal": {
|
|
307
697
|
o++;
|
|
308
698
|
break;
|
|
@@ -318,7 +708,7 @@ function He({
|
|
|
318
708
|
return null;
|
|
319
709
|
switch (n) {
|
|
320
710
|
case "active": {
|
|
321
|
-
const i = (e &
|
|
711
|
+
const i = (e & Le) !== 0, a = (e & Pe) !== 0, r = (e & Ee) !== 0, l = (e & Re) !== 0;
|
|
322
712
|
if (e) {
|
|
323
713
|
if (i)
|
|
324
714
|
return r ? "se-resize" : l ? "ne-resize" : "e-resize";
|
|
@@ -334,174 +724,40 @@ function He({
|
|
|
334
724
|
}
|
|
335
725
|
return o > 0 && s > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
336
726
|
}
|
|
337
|
-
let
|
|
338
|
-
function
|
|
339
|
-
|
|
340
|
-
const { cursorFlags: e, interactionState: t } =
|
|
727
|
+
let ie = null, I;
|
|
728
|
+
function se() {
|
|
729
|
+
I === void 0 && (I = new CSSStyleSheet(), document.adoptedStyleSheets = [I]);
|
|
730
|
+
const { cursorFlags: e, interactionState: t } = k();
|
|
341
731
|
switch (t.state) {
|
|
342
732
|
case "active":
|
|
343
733
|
case "hover": {
|
|
344
|
-
const n =
|
|
734
|
+
const n = Qe({
|
|
345
735
|
cursorFlags: e,
|
|
346
736
|
groups: t.hitRegions.map((o) => o.group),
|
|
347
737
|
state: t.state
|
|
348
738
|
});
|
|
349
|
-
if (
|
|
739
|
+
if (ie === n)
|
|
350
740
|
return;
|
|
351
|
-
|
|
741
|
+
ie = n, n ? I.cssRules.length === 0 ? I.insertRule(`*{cursor: ${n} !important;}`) : I.replaceSync(`*{cursor: ${n} !important;}`) : I.cssRules.length === 1 && I.deleteRule(0);
|
|
352
742
|
break;
|
|
353
743
|
}
|
|
354
744
|
case "inactive": {
|
|
355
|
-
|
|
745
|
+
ie = null, I.cssRules.length === 1 && I.deleteRule(0);
|
|
356
746
|
break;
|
|
357
747
|
}
|
|
358
748
|
}
|
|
359
749
|
}
|
|
360
|
-
function
|
|
361
|
-
if (!e)
|
|
362
|
-
throw console.error(t), Error(t);
|
|
363
|
-
}
|
|
364
|
-
function Be(e, t) {
|
|
365
|
-
if (e.length !== t.length)
|
|
366
|
-
return !1;
|
|
367
|
-
for (let n = 0; n < e.length; n++)
|
|
368
|
-
if (e[n] != t[n])
|
|
369
|
-
return !1;
|
|
370
|
-
return !0;
|
|
371
|
-
}
|
|
372
|
-
function b(e, t, n = 0) {
|
|
373
|
-
return Math.abs(L(e) - L(t)) <= n;
|
|
374
|
-
}
|
|
375
|
-
function Y(e, t) {
|
|
376
|
-
return b(e, t) ? 0 : e > t ? 1 : -1;
|
|
377
|
-
}
|
|
378
|
-
function T({
|
|
379
|
-
panelConstraints: e,
|
|
380
|
-
size: t
|
|
381
|
-
}) {
|
|
382
|
-
const {
|
|
383
|
-
collapsedSize: n = 0,
|
|
384
|
-
collapsible: o,
|
|
385
|
-
maxSize: s = 100,
|
|
386
|
-
minSize: i = 0
|
|
387
|
-
} = e;
|
|
388
|
-
if (Y(t, i) < 0)
|
|
389
|
-
if (o) {
|
|
390
|
-
const a = (n + i) / 2;
|
|
391
|
-
Y(t, a) < 0 ? t = n : t = i;
|
|
392
|
-
} else
|
|
393
|
-
t = i;
|
|
394
|
-
return t = Math.min(s, t), t = L(t), t;
|
|
395
|
-
}
|
|
396
|
-
function We({
|
|
397
|
-
delta: e,
|
|
398
|
-
initialLayout: t,
|
|
399
|
-
panelConstraints: n,
|
|
400
|
-
pivotIndices: o,
|
|
401
|
-
prevLayout: s,
|
|
402
|
-
trigger: i
|
|
403
|
-
}) {
|
|
404
|
-
if (b(e, 0))
|
|
405
|
-
return t;
|
|
406
|
-
const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
|
|
407
|
-
E(c != null, "Invalid first pivot index"), E(u != null, "Invalid second pivot index");
|
|
408
|
-
let f = 0;
|
|
409
|
-
{
|
|
410
|
-
const m = e < 0 ? 1 : -1;
|
|
411
|
-
let d = e < 0 ? u : c, v = 0;
|
|
412
|
-
for (; ; ) {
|
|
413
|
-
const x = a[d];
|
|
414
|
-
E(
|
|
415
|
-
x != null,
|
|
416
|
-
`Previous layout not found for panel index ${d}`
|
|
417
|
-
);
|
|
418
|
-
const y = T({
|
|
419
|
-
panelConstraints: n[d],
|
|
420
|
-
size: 100
|
|
421
|
-
}) - x;
|
|
422
|
-
if (v += y, d += m, d < 0 || d >= n.length)
|
|
423
|
-
break;
|
|
424
|
-
}
|
|
425
|
-
const S = Math.min(Math.abs(e), Math.abs(v));
|
|
426
|
-
e = e < 0 ? 0 - S : S;
|
|
427
|
-
}
|
|
428
|
-
{
|
|
429
|
-
let d = e < 0 ? c : u;
|
|
430
|
-
for (; d >= 0 && d < n.length; ) {
|
|
431
|
-
const v = Math.abs(e) - Math.abs(f), S = a[d];
|
|
432
|
-
E(
|
|
433
|
-
S != null,
|
|
434
|
-
`Previous layout not found for panel index ${d}`
|
|
435
|
-
);
|
|
436
|
-
const x = S - v, z = T({
|
|
437
|
-
panelConstraints: n[d],
|
|
438
|
-
size: x
|
|
439
|
-
});
|
|
440
|
-
if (!b(S, z) && (f += S - z, l[d] = z, f.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
441
|
-
numeric: !0
|
|
442
|
-
}) >= 0))
|
|
443
|
-
break;
|
|
444
|
-
e < 0 ? d-- : d++;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
if (Be(r, l))
|
|
448
|
-
return s;
|
|
449
|
-
{
|
|
450
|
-
const m = e < 0 ? u : c, d = a[m];
|
|
451
|
-
E(
|
|
452
|
-
d != null,
|
|
453
|
-
`Previous layout not found for panel index ${m}`
|
|
454
|
-
);
|
|
455
|
-
const v = d + f, S = T({
|
|
456
|
-
panelConstraints: n[m],
|
|
457
|
-
size: v
|
|
458
|
-
});
|
|
459
|
-
if (l[m] = S, !b(S, v)) {
|
|
460
|
-
let x = v - S, y = e < 0 ? u : c;
|
|
461
|
-
for (; y >= 0 && y < n.length; ) {
|
|
462
|
-
const R = l[y];
|
|
463
|
-
E(
|
|
464
|
-
R != null,
|
|
465
|
-
`Previous layout not found for panel index ${y}`
|
|
466
|
-
);
|
|
467
|
-
const k = R + x, A = T({
|
|
468
|
-
panelConstraints: n[y],
|
|
469
|
-
size: k
|
|
470
|
-
});
|
|
471
|
-
if (b(R, A) || (x -= A - R, l[y] = A), b(x, 0))
|
|
472
|
-
break;
|
|
473
|
-
e > 0 ? y-- : y++;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
const p = Object.values(l).reduce(
|
|
478
|
-
(m, d) => d + m,
|
|
479
|
-
0
|
|
480
|
-
);
|
|
481
|
-
if (!b(p, 100, 0.1))
|
|
482
|
-
return s;
|
|
483
|
-
const h = Object.keys(s);
|
|
484
|
-
return l.reduce((m, d, v) => (m[h[v]] = d, m), {});
|
|
485
|
-
}
|
|
486
|
-
function q(e, t) {
|
|
487
|
-
if (Object.keys(e).length !== Object.keys(t).length)
|
|
488
|
-
return !1;
|
|
489
|
-
for (const n in e)
|
|
490
|
-
if (Y(e[n], t[n]) !== 0)
|
|
491
|
-
return !1;
|
|
492
|
-
return !0;
|
|
493
|
-
}
|
|
494
|
-
function W(e) {
|
|
750
|
+
function q(e) {
|
|
495
751
|
if (e.defaultPrevented)
|
|
496
752
|
return;
|
|
497
|
-
const { interactionState: t, mountedGroups: n } =
|
|
753
|
+
const { interactionState: t, mountedGroups: n } = k();
|
|
498
754
|
switch (t.state) {
|
|
499
755
|
case "active": {
|
|
500
756
|
if (
|
|
501
757
|
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
502
758
|
e.type !== "pointerleave" && e.buttons === 0
|
|
503
759
|
) {
|
|
504
|
-
|
|
760
|
+
M(
|
|
505
761
|
(i) => i.interactionState.state === "inactive" ? i : {
|
|
506
762
|
cursorFlags: 0,
|
|
507
763
|
interactionState: {
|
|
@@ -514,202 +770,183 @@ function W(e) {
|
|
|
514
770
|
let o = 0;
|
|
515
771
|
const s = new Map(n);
|
|
516
772
|
t.hitRegions.forEach((i) => {
|
|
517
|
-
const {
|
|
773
|
+
const { disableCursor: a, element: r, orientation: l, panels: c } = i.group;
|
|
518
774
|
let u = 0;
|
|
519
|
-
t.state === "active" && (
|
|
775
|
+
t.state === "active" && (l === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / r.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / r.offsetHeight * 100);
|
|
520
776
|
const f = t.initialLayoutMap.get(
|
|
521
777
|
i.group
|
|
522
|
-
), {
|
|
523
|
-
|
|
524
|
-
|
|
778
|
+
), {
|
|
779
|
+
derivedPanelConstraints: m,
|
|
780
|
+
layout: g,
|
|
781
|
+
separatorToPanels: p
|
|
782
|
+
} = n.get(i.group) ?? {};
|
|
783
|
+
if (m && f && g && p) {
|
|
784
|
+
const d = Q({
|
|
525
785
|
delta: u,
|
|
526
786
|
initialLayout: f,
|
|
527
|
-
panelConstraints:
|
|
528
|
-
pivotIndices: i.panels.map((
|
|
529
|
-
prevLayout:
|
|
787
|
+
panelConstraints: m,
|
|
788
|
+
pivotIndices: i.panels.map((h) => c.indexOf(h)),
|
|
789
|
+
prevLayout: g,
|
|
530
790
|
trigger: "mouse-or-touch"
|
|
531
791
|
});
|
|
532
|
-
if (
|
|
533
|
-
if (u !== 0 && !
|
|
534
|
-
switch (
|
|
792
|
+
if (ee(d, g)) {
|
|
793
|
+
if (u !== 0 && !a)
|
|
794
|
+
switch (l) {
|
|
535
795
|
case "horizontal": {
|
|
536
|
-
o |= u < 0 ?
|
|
796
|
+
o |= u < 0 ? Le : Pe;
|
|
537
797
|
break;
|
|
538
798
|
}
|
|
539
799
|
case "vertical": {
|
|
540
|
-
o |= u < 0 ?
|
|
800
|
+
o |= u < 0 ? Ee : Re;
|
|
541
801
|
break;
|
|
542
802
|
}
|
|
543
803
|
}
|
|
544
804
|
} else {
|
|
545
805
|
s.set(i.group, {
|
|
546
|
-
derivedPanelConstraints:
|
|
547
|
-
layout:
|
|
806
|
+
derivedPanelConstraints: m,
|
|
807
|
+
layout: d,
|
|
808
|
+
separatorToPanels: p
|
|
548
809
|
});
|
|
549
|
-
const
|
|
550
|
-
i.group.inMemoryLayouts[
|
|
810
|
+
const h = i.group.panels.map(({ id: v }) => v).join(",");
|
|
811
|
+
i.group.inMemoryLayouts[h] = d;
|
|
551
812
|
}
|
|
552
813
|
}
|
|
553
|
-
}),
|
|
814
|
+
}), M({
|
|
554
815
|
cursorFlags: o,
|
|
555
816
|
mountedGroups: s
|
|
556
|
-
}),
|
|
817
|
+
}), se();
|
|
557
818
|
break;
|
|
558
819
|
}
|
|
559
820
|
default: {
|
|
560
|
-
const o =
|
|
561
|
-
o.length === 0 ? t.state !== "inactive" &&
|
|
821
|
+
const o = Ce(e, n);
|
|
822
|
+
o.length === 0 ? t.state !== "inactive" && M({
|
|
562
823
|
interactionState: { state: "inactive" }
|
|
563
|
-
}) :
|
|
824
|
+
}) : M({
|
|
564
825
|
interactionState: {
|
|
565
826
|
hitRegions: o,
|
|
566
827
|
state: "hover"
|
|
567
828
|
}
|
|
568
|
-
}),
|
|
829
|
+
}), se();
|
|
569
830
|
break;
|
|
570
831
|
}
|
|
571
832
|
}
|
|
572
833
|
}
|
|
573
|
-
function
|
|
834
|
+
function ye(e) {
|
|
574
835
|
if (e.defaultPrevented)
|
|
575
836
|
return;
|
|
576
837
|
e.preventDefault();
|
|
577
|
-
const { interactionState: t } =
|
|
838
|
+
const { interactionState: t } = k();
|
|
578
839
|
switch (t.state) {
|
|
579
840
|
case "active":
|
|
580
|
-
|
|
841
|
+
M({
|
|
581
842
|
cursorFlags: 0,
|
|
582
843
|
interactionState: {
|
|
583
844
|
state: "inactive"
|
|
584
845
|
}
|
|
585
|
-
}),
|
|
846
|
+
}), se();
|
|
586
847
|
}
|
|
587
848
|
}
|
|
588
|
-
function
|
|
849
|
+
function et(e) {
|
|
589
850
|
let t = 0, n = 0;
|
|
590
851
|
const o = {};
|
|
591
852
|
for (const i of e)
|
|
592
853
|
if (i.defaultSize !== void 0) {
|
|
593
854
|
t++;
|
|
594
|
-
const a =
|
|
855
|
+
const a = C(i.defaultSize);
|
|
595
856
|
n += a, o[i.panelId] = a;
|
|
596
857
|
} else
|
|
597
858
|
o[i.panelId] = void 0;
|
|
598
859
|
const s = e.length - t;
|
|
599
860
|
if (s !== 0) {
|
|
600
|
-
const i =
|
|
861
|
+
const i = C((100 - n) / s);
|
|
601
862
|
for (const a of e)
|
|
602
863
|
a.defaultSize === void 0 && (o[a.panelId] = i);
|
|
603
864
|
}
|
|
604
865
|
return o;
|
|
605
866
|
}
|
|
606
|
-
function
|
|
867
|
+
function tt(e, t, n) {
|
|
607
868
|
const o = n[0];
|
|
608
869
|
if (!o)
|
|
609
870
|
return;
|
|
610
871
|
const s = e.panels.find((a) => a.element === t);
|
|
611
872
|
if (!s || !s.onResize)
|
|
612
873
|
return;
|
|
613
|
-
const i =
|
|
614
|
-
s.onResize(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
layout: e,
|
|
623
|
-
panelConstraints: t
|
|
624
|
-
}) {
|
|
625
|
-
const o = [...Object.values(e)], s = o.reduce(
|
|
626
|
-
(r, l) => r + l,
|
|
627
|
-
0
|
|
874
|
+
const i = le({ group: e });
|
|
875
|
+
s.onResize(
|
|
876
|
+
{
|
|
877
|
+
asPercentage: C(
|
|
878
|
+
o.inlineSize / i * 100
|
|
879
|
+
),
|
|
880
|
+
inPixels: o.inlineSize
|
|
881
|
+
},
|
|
882
|
+
s.id
|
|
628
883
|
);
|
|
629
|
-
if (o.length !== t.length)
|
|
630
|
-
throw Error(
|
|
631
|
-
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
632
|
-
);
|
|
633
|
-
if (!b(s, 100) && o.length > 0)
|
|
634
|
-
for (let r = 0; r < t.length; r++) {
|
|
635
|
-
const l = o[r];
|
|
636
|
-
E(l != null, `No layout data found for index ${r}`);
|
|
637
|
-
const c = 100 / s * l;
|
|
638
|
-
o[r] = c;
|
|
639
|
-
}
|
|
640
|
-
let i = 0;
|
|
641
|
-
for (let r = 0; r < t.length; r++) {
|
|
642
|
-
const l = o[r];
|
|
643
|
-
E(l != null, `No layout data found for index ${r}`);
|
|
644
|
-
const c = T({
|
|
645
|
-
panelConstraints: t[r],
|
|
646
|
-
size: l
|
|
647
|
-
});
|
|
648
|
-
l != c && (i += l - c, o[r] = c);
|
|
649
|
-
}
|
|
650
|
-
if (!b(i, 0))
|
|
651
|
-
for (let r = 0; r < t.length; r++) {
|
|
652
|
-
const l = o[r];
|
|
653
|
-
E(l != null, `No layout data found for index ${r}`);
|
|
654
|
-
const c = l + i, u = T({
|
|
655
|
-
panelConstraints: t[r],
|
|
656
|
-
size: c
|
|
657
|
-
});
|
|
658
|
-
if (l !== u && (i -= u - l, o[r] = u, b(i, 0)))
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
const a = Object.keys(e);
|
|
662
|
-
return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
|
|
663
884
|
}
|
|
664
|
-
function
|
|
665
|
-
let t = !
|
|
666
|
-
const n = new ResizeObserver((
|
|
667
|
-
for (const
|
|
668
|
-
const { borderBoxSize:
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
})
|
|
676
|
-
|
|
677
|
-
|
|
885
|
+
function nt(e) {
|
|
886
|
+
let t = !0;
|
|
887
|
+
const n = new ResizeObserver((c) => {
|
|
888
|
+
for (const u of c) {
|
|
889
|
+
const { borderBoxSize: f, target: m } = u;
|
|
890
|
+
m === e.element ? t && M((g) => {
|
|
891
|
+
const p = g.mountedGroups.get(e);
|
|
892
|
+
if (p) {
|
|
893
|
+
const d = pe(e), h = p.layout, v = F({
|
|
894
|
+
layout: h,
|
|
895
|
+
panelConstraints: d
|
|
896
|
+
});
|
|
897
|
+
return {
|
|
898
|
+
mountedGroups: new Map(g.mountedGroups).set(e, {
|
|
899
|
+
derivedPanelConstraints: d,
|
|
900
|
+
layout: v,
|
|
901
|
+
separatorToPanels: p.separatorToPanels
|
|
902
|
+
})
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
return g;
|
|
906
|
+
}) : tt(e, m, f);
|
|
678
907
|
}
|
|
679
908
|
});
|
|
680
|
-
n.observe(e.element), e.panels.forEach((
|
|
681
|
-
|
|
909
|
+
n.observe(e.element), e.panels.forEach((c) => {
|
|
910
|
+
c.onResize && n.observe(c.element);
|
|
682
911
|
});
|
|
683
|
-
const o =
|
|
912
|
+
const o = pe(e), s = e.panels.map(({ id: c }) => c).join(","), i = e.inMemoryLayouts[s] ?? e.defaultLayout ?? et(o), a = F({
|
|
684
913
|
layout: i,
|
|
685
914
|
panelConstraints: o
|
|
686
|
-
}), r =
|
|
687
|
-
mountedGroups: new Map(
|
|
915
|
+
}), r = ze(e), l = M((c) => ({
|
|
916
|
+
mountedGroups: new Map(c.mountedGroups).set(e, {
|
|
688
917
|
derivedPanelConstraints: o,
|
|
689
|
-
layout: a
|
|
918
|
+
layout: a,
|
|
919
|
+
separatorToPanels: new Map(
|
|
920
|
+
r.filter((u) => u.separator).map((u) => [u.separator, u.panels])
|
|
921
|
+
)
|
|
690
922
|
})
|
|
691
923
|
}));
|
|
692
|
-
return
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
924
|
+
return e.separators.forEach((c) => {
|
|
925
|
+
c.element.addEventListener("keydown", me);
|
|
926
|
+
}), l.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ve), window.addEventListener("pointerleave", q), window.addEventListener("pointermove", q), window.addEventListener("pointerup", ye)), function() {
|
|
927
|
+
t = !1;
|
|
928
|
+
const u = M((f) => {
|
|
929
|
+
const m = new Map(f.mountedGroups);
|
|
930
|
+
return m.delete(e), { mountedGroups: m };
|
|
696
931
|
});
|
|
697
|
-
|
|
932
|
+
e.separators.forEach((f) => {
|
|
933
|
+
f.element.removeEventListener("keydown", me);
|
|
934
|
+
}), u.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ve), window.removeEventListener("pointerleave", q), window.removeEventListener("pointermove", q), window.removeEventListener("pointerup", ye)), n.disconnect();
|
|
698
935
|
};
|
|
699
936
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
937
|
+
function ce(e) {
|
|
938
|
+
const t = De();
|
|
702
939
|
return `${e ?? t}`;
|
|
703
940
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
706
|
-
const t =
|
|
707
|
-
return
|
|
941
|
+
const H = typeof window < "u" ? Te : Ae;
|
|
942
|
+
function ue(e) {
|
|
943
|
+
const t = D(e);
|
|
944
|
+
return H(() => {
|
|
708
945
|
t.current = e;
|
|
709
|
-
}, [e]),
|
|
946
|
+
}, [e]), ge((n) => t.current?.(n), [t]);
|
|
710
947
|
}
|
|
711
|
-
function
|
|
712
|
-
return
|
|
948
|
+
function fe(...e) {
|
|
949
|
+
return ue((t) => {
|
|
713
950
|
e.forEach((n) => {
|
|
714
951
|
if (n)
|
|
715
952
|
switch (typeof n) {
|
|
@@ -725,235 +962,195 @@ function ee(...e) {
|
|
|
725
962
|
});
|
|
726
963
|
});
|
|
727
964
|
}
|
|
728
|
-
const
|
|
729
|
-
function
|
|
965
|
+
const Me = "--react-resizable-panels--panel--pointer-events";
|
|
966
|
+
function Ge(e, t) {
|
|
730
967
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
731
968
|
return `--react-resizable-panels--${n}--${o}`;
|
|
732
969
|
}
|
|
733
|
-
const
|
|
734
|
-
function
|
|
735
|
-
|
|
736
|
-
e === "horizontal" ? (n, o) => n.element.offsetLeft - o.element.offsetLeft : (n, o) => n.element.offsetTop - o.element.offsetTop
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
function Xe({
|
|
740
|
-
groupId: e
|
|
741
|
-
}) {
|
|
742
|
-
const t = () => {
|
|
743
|
-
const { mountedGroups: n } = O();
|
|
744
|
-
for (const [o, { derivedPanelConstraints: s, layout: i }] of n)
|
|
745
|
-
if (o.id === e)
|
|
746
|
-
return { derivedPanelConstraints: s, group: o, layout: i };
|
|
747
|
-
throw Error(`Group ${e} not found`);
|
|
748
|
-
};
|
|
749
|
-
return {
|
|
750
|
-
getLayout() {
|
|
751
|
-
const { layout: n } = t();
|
|
752
|
-
return n;
|
|
753
|
-
},
|
|
754
|
-
setLayout(n) {
|
|
755
|
-
const { derivedPanelConstraints: o, group: s, layout: i } = t(), a = ve({
|
|
756
|
-
layout: n,
|
|
757
|
-
panelConstraints: o
|
|
758
|
-
});
|
|
759
|
-
return q(i, a) || G((r) => ({
|
|
760
|
-
mountedGroups: new Map(r.mountedGroups).set(s, {
|
|
761
|
-
derivedPanelConstraints: o,
|
|
762
|
-
layout: a
|
|
763
|
-
})
|
|
764
|
-
})), a;
|
|
765
|
-
}
|
|
766
|
-
};
|
|
767
|
-
}
|
|
768
|
-
function Ye(e, t) {
|
|
769
|
-
const n = I({
|
|
970
|
+
const Ie = $e(null);
|
|
971
|
+
function ot(e, t) {
|
|
972
|
+
const n = D({
|
|
770
973
|
getLayout: () => ({}),
|
|
771
|
-
setLayout:
|
|
974
|
+
setLayout: Ye
|
|
772
975
|
});
|
|
773
|
-
|
|
976
|
+
Se(t, () => n.current, []), H(() => {
|
|
774
977
|
Object.assign(
|
|
775
978
|
n.current,
|
|
776
|
-
|
|
979
|
+
be({ groupId: e })
|
|
777
980
|
);
|
|
778
981
|
});
|
|
779
982
|
}
|
|
780
|
-
function
|
|
983
|
+
function ft({
|
|
781
984
|
children: e,
|
|
782
985
|
className: t,
|
|
783
986
|
defaultLayout: n,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
987
|
+
disableCursor: o,
|
|
988
|
+
disabled: s,
|
|
989
|
+
elementRef: i,
|
|
990
|
+
groupRef: a,
|
|
991
|
+
id: r,
|
|
992
|
+
onLayoutChange: l,
|
|
993
|
+
orientation: c = "horizontal",
|
|
791
994
|
style: u
|
|
792
995
|
}) {
|
|
793
|
-
const f =
|
|
794
|
-
|
|
795
|
-
}),
|
|
796
|
-
|
|
797
|
-
const
|
|
996
|
+
const f = D({}), m = ue((b) => {
|
|
997
|
+
ee(f.current, b) || (f.current = b, l?.(b));
|
|
998
|
+
}), g = ce(r), [p, d] = R(!1), [h, v] = R(null), [z, x] = R(n ?? {}), [y, w] = R([]), [G, O] = R([]), te = D({}), U = D({}), B = fe(v, i);
|
|
999
|
+
ot(g, a);
|
|
1000
|
+
const K = xe(
|
|
798
1001
|
() => ({
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
registerPanel: (
|
|
802
|
-
|
|
1002
|
+
id: g,
|
|
1003
|
+
orientation: c,
|
|
1004
|
+
registerPanel: (b) => (w((E) => re(c, [...E, b])), () => {
|
|
1005
|
+
w((E) => E.filter(($) => $ !== b));
|
|
803
1006
|
}),
|
|
804
|
-
registerSeparator: (
|
|
805
|
-
(
|
|
1007
|
+
registerSeparator: (b) => (O(
|
|
1008
|
+
(E) => re(c, [...E, b])
|
|
806
1009
|
), () => {
|
|
807
|
-
|
|
808
|
-
(
|
|
1010
|
+
O(
|
|
1011
|
+
(E) => E.filter(($) => $ !== b)
|
|
809
1012
|
);
|
|
810
1013
|
})
|
|
811
1014
|
}),
|
|
812
|
-
[
|
|
1015
|
+
[g, c]
|
|
813
1016
|
);
|
|
814
|
-
|
|
815
|
-
if (
|
|
816
|
-
const
|
|
1017
|
+
H(() => {
|
|
1018
|
+
if (h !== null && y.length > 0) {
|
|
1019
|
+
const b = {
|
|
817
1020
|
defaultLayout: n,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
inMemoryLayouts:
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
1021
|
+
disableCursor: !!o,
|
|
1022
|
+
disabled: !!s,
|
|
1023
|
+
element: h,
|
|
1024
|
+
id: g,
|
|
1025
|
+
inMemoryLastExpandedPanelSizes: te.current,
|
|
1026
|
+
inMemoryLayouts: U.current,
|
|
1027
|
+
orientation: c,
|
|
1028
|
+
panels: y,
|
|
1029
|
+
separators: G
|
|
1030
|
+
}, E = nt(b), ne = k().mountedGroups.get(b);
|
|
1031
|
+
ne && (x(ne.layout), m?.(ne.layout));
|
|
1032
|
+
const ke = A.addListener(
|
|
829
1033
|
"interactionStateChange",
|
|
830
|
-
(
|
|
831
|
-
switch (
|
|
1034
|
+
(X) => {
|
|
1035
|
+
switch (X.state) {
|
|
832
1036
|
case "active":
|
|
833
1037
|
case "hover": {
|
|
834
1038
|
d(
|
|
835
|
-
|
|
836
|
-
(
|
|
1039
|
+
X.hitRegions.some(
|
|
1040
|
+
(N) => N.group === b
|
|
837
1041
|
)
|
|
838
1042
|
);
|
|
839
1043
|
break;
|
|
840
1044
|
}
|
|
841
1045
|
}
|
|
842
1046
|
}
|
|
843
|
-
),
|
|
1047
|
+
), Oe = A.addListener(
|
|
844
1048
|
"mountedGroupsChange",
|
|
845
|
-
(
|
|
846
|
-
const
|
|
847
|
-
|
|
1049
|
+
(X) => {
|
|
1050
|
+
const N = X.get(b);
|
|
1051
|
+
N && N.derivedPanelConstraints.length > 0 && (x(N.layout), m?.(N.layout));
|
|
848
1052
|
}
|
|
849
1053
|
);
|
|
850
1054
|
return () => {
|
|
851
|
-
|
|
1055
|
+
E(), ke(), Oe();
|
|
852
1056
|
};
|
|
853
1057
|
}
|
|
854
1058
|
}, [
|
|
855
1059
|
n,
|
|
856
1060
|
o,
|
|
857
1061
|
s,
|
|
858
|
-
i,
|
|
859
|
-
v,
|
|
860
1062
|
h,
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
1063
|
+
g,
|
|
1064
|
+
m,
|
|
1065
|
+
c,
|
|
1066
|
+
y,
|
|
1067
|
+
G
|
|
864
1068
|
]);
|
|
865
|
-
const
|
|
866
|
-
[
|
|
1069
|
+
const V = {
|
|
1070
|
+
[Me]: p ? "none" : void 0
|
|
867
1071
|
};
|
|
868
|
-
for (const
|
|
869
|
-
const
|
|
870
|
-
|
|
1072
|
+
for (const b in z) {
|
|
1073
|
+
const E = Ge(g, b), $ = z[b];
|
|
1074
|
+
V[E] = $;
|
|
871
1075
|
}
|
|
872
|
-
return /* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ j(Ie.Provider, { value: K, children: /* @__PURE__ */ j(
|
|
873
1077
|
"div",
|
|
874
1078
|
{
|
|
1079
|
+
"aria-orientation": c,
|
|
875
1080
|
className: t,
|
|
876
1081
|
"data-group": !0,
|
|
877
|
-
"data-
|
|
878
|
-
|
|
879
|
-
ref: ze,
|
|
1082
|
+
"data-testid": r ?? void 0,
|
|
1083
|
+
ref: B,
|
|
880
1084
|
style: {
|
|
881
1085
|
...u,
|
|
882
|
-
...
|
|
1086
|
+
...V,
|
|
883
1087
|
display: "flex",
|
|
884
|
-
flexDirection:
|
|
885
|
-
flexWrap: "nowrap"
|
|
886
|
-
overflow: "hidden"
|
|
1088
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
1089
|
+
flexWrap: "nowrap"
|
|
887
1090
|
},
|
|
888
1091
|
children: e
|
|
889
1092
|
}
|
|
890
1093
|
) });
|
|
891
1094
|
}
|
|
892
|
-
function
|
|
1095
|
+
function ae(e) {
|
|
893
1096
|
return `react-resizable-panels:${e}`;
|
|
894
1097
|
}
|
|
895
|
-
function
|
|
896
|
-
id: e,
|
|
897
|
-
storage: t
|
|
898
|
-
}) {
|
|
899
|
-
try {
|
|
900
|
-
const n = xe(e), o = t.getItem(n);
|
|
901
|
-
if (o)
|
|
902
|
-
return JSON.parse(o);
|
|
903
|
-
} catch (n) {
|
|
904
|
-
console.error(n);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function qe({
|
|
1098
|
+
function it({
|
|
908
1099
|
id: e,
|
|
909
1100
|
layout: t,
|
|
910
1101
|
storage: n
|
|
911
1102
|
}) {
|
|
912
1103
|
try {
|
|
913
|
-
const o =
|
|
1104
|
+
const o = ae(e);
|
|
914
1105
|
n.setItem(o, JSON.stringify(t));
|
|
915
1106
|
} catch (o) {
|
|
916
1107
|
console.error(o);
|
|
917
1108
|
}
|
|
918
1109
|
}
|
|
919
|
-
function
|
|
1110
|
+
function dt({
|
|
920
1111
|
groupId: e,
|
|
921
|
-
storage: t
|
|
1112
|
+
storage: t
|
|
922
1113
|
}) {
|
|
923
|
-
const n =
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1114
|
+
const n = Ne(
|
|
1115
|
+
rt,
|
|
1116
|
+
() => t.getItem(ae(e)),
|
|
1117
|
+
() => t.getItem(ae(e))
|
|
1118
|
+
), o = xe(
|
|
1119
|
+
() => n ? JSON.parse(n) : null,
|
|
1120
|
+
[n]
|
|
1121
|
+
), s = ge(
|
|
1122
|
+
(i) => it({
|
|
930
1123
|
id: e,
|
|
931
|
-
layout:
|
|
1124
|
+
layout: i,
|
|
932
1125
|
storage: t
|
|
933
1126
|
}),
|
|
934
1127
|
[e, t]
|
|
935
1128
|
);
|
|
936
1129
|
return {
|
|
937
|
-
defaultLayout:
|
|
938
|
-
onLayoutChange:
|
|
1130
|
+
defaultLayout: o,
|
|
1131
|
+
onLayoutChange: s
|
|
939
1132
|
};
|
|
940
1133
|
}
|
|
941
|
-
function it() {
|
|
942
|
-
return M(null);
|
|
943
|
-
}
|
|
944
1134
|
function rt() {
|
|
945
|
-
return
|
|
1135
|
+
return function() {
|
|
1136
|
+
};
|
|
1137
|
+
}
|
|
1138
|
+
function pt() {
|
|
1139
|
+
return R(null);
|
|
1140
|
+
}
|
|
1141
|
+
function mt() {
|
|
1142
|
+
return D(null);
|
|
946
1143
|
}
|
|
947
|
-
function
|
|
948
|
-
const e =
|
|
949
|
-
return
|
|
1144
|
+
function de() {
|
|
1145
|
+
const e = _e(Ie);
|
|
1146
|
+
return S(e, "Unexpected"), e;
|
|
950
1147
|
}
|
|
951
|
-
function
|
|
1148
|
+
function st({
|
|
952
1149
|
groupId: e,
|
|
953
1150
|
panelId: t
|
|
954
1151
|
}) {
|
|
955
1152
|
const n = () => {
|
|
956
|
-
const { mountedGroups: a } =
|
|
1153
|
+
const { mountedGroups: a } = k();
|
|
957
1154
|
for (const [r, { derivedPanelConstraints: l, layout: c }] of a)
|
|
958
1155
|
if (r.id === e)
|
|
959
1156
|
return { derivedPanelConstraints: l, group: r, layout: c };
|
|
@@ -986,7 +1183,7 @@ function Je({
|
|
|
986
1183
|
i();
|
|
987
1184
|
},
|
|
988
1185
|
getSize: () => {
|
|
989
|
-
const { group: a } = n(), r = i(), { element: l } = s(), c = a.
|
|
1186
|
+
const { group: a } = n(), r = i(), { element: l } = s(), c = a.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
990
1187
|
return {
|
|
991
1188
|
asPercentage: r,
|
|
992
1189
|
inPixels: c
|
|
@@ -994,39 +1191,39 @@ function Je({
|
|
|
994
1191
|
},
|
|
995
1192
|
isCollapsed: () => {
|
|
996
1193
|
const { collapsible: a, collapsedSize: r } = o(), l = i();
|
|
997
|
-
return a &&
|
|
1194
|
+
return a && L(r, l);
|
|
998
1195
|
},
|
|
999
1196
|
resize: (a) => {
|
|
1000
1197
|
if (i() !== a)
|
|
1001
1198
|
switch (typeof a) {
|
|
1002
1199
|
case "number": {
|
|
1003
|
-
const { group: l } = n(), c =
|
|
1004
|
-
|
|
1200
|
+
const { group: l } = n(), c = le({ group: l });
|
|
1201
|
+
C(a / c * 100);
|
|
1005
1202
|
break;
|
|
1006
1203
|
}
|
|
1007
1204
|
}
|
|
1008
1205
|
}
|
|
1009
1206
|
};
|
|
1010
1207
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const { id: n } =
|
|
1013
|
-
collapse:
|
|
1014
|
-
expand:
|
|
1208
|
+
function at(e, t) {
|
|
1209
|
+
const { id: n } = de(), o = D({
|
|
1210
|
+
collapse: oe,
|
|
1211
|
+
expand: oe,
|
|
1015
1212
|
getSize: () => ({
|
|
1016
1213
|
asPercentage: 0,
|
|
1017
1214
|
inPixels: 0
|
|
1018
1215
|
}),
|
|
1019
1216
|
isCollapsed: () => !1,
|
|
1020
|
-
resize:
|
|
1217
|
+
resize: oe
|
|
1021
1218
|
});
|
|
1022
|
-
|
|
1219
|
+
Se(t, () => o.current, []), H(() => {
|
|
1023
1220
|
Object.assign(
|
|
1024
1221
|
o.current,
|
|
1025
|
-
|
|
1222
|
+
st({ groupId: n, panelId: e })
|
|
1026
1223
|
);
|
|
1027
1224
|
});
|
|
1028
1225
|
}
|
|
1029
|
-
function
|
|
1226
|
+
function ht({
|
|
1030
1227
|
children: e,
|
|
1031
1228
|
className: t,
|
|
1032
1229
|
collapsedSize: n = 0,
|
|
@@ -1040,16 +1237,16 @@ function st({
|
|
|
1040
1237
|
panelRef: u,
|
|
1041
1238
|
style: f
|
|
1042
1239
|
}) {
|
|
1043
|
-
const
|
|
1044
|
-
c?.(
|
|
1240
|
+
const m = !!a, g = ce(a), [p, d] = R(null), h = fe(d, i), { id: v, registerPanel: z } = de(), x = c !== null, y = ue((G) => {
|
|
1241
|
+
c?.(G, a);
|
|
1045
1242
|
});
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1048
|
-
return
|
|
1049
|
-
element:
|
|
1050
|
-
id:
|
|
1051
|
-
idIsStable:
|
|
1052
|
-
onResize:
|
|
1243
|
+
H(() => {
|
|
1244
|
+
if (p !== null)
|
|
1245
|
+
return z({
|
|
1246
|
+
element: p,
|
|
1247
|
+
id: g,
|
|
1248
|
+
idIsStable: m,
|
|
1249
|
+
onResize: x ? y : void 0,
|
|
1053
1250
|
panelConstraints: {
|
|
1054
1251
|
collapsedSize: n,
|
|
1055
1252
|
collapsible: o,
|
|
@@ -1062,33 +1259,33 @@ function st({
|
|
|
1062
1259
|
n,
|
|
1063
1260
|
o,
|
|
1064
1261
|
s,
|
|
1065
|
-
m,
|
|
1066
|
-
z,
|
|
1067
|
-
h,
|
|
1068
1262
|
p,
|
|
1263
|
+
x,
|
|
1264
|
+
g,
|
|
1265
|
+
m,
|
|
1069
1266
|
r,
|
|
1070
1267
|
l,
|
|
1071
1268
|
y,
|
|
1072
|
-
|
|
1073
|
-
]),
|
|
1074
|
-
const
|
|
1075
|
-
return /* @__PURE__ */
|
|
1269
|
+
z
|
|
1270
|
+
]), at(g, u);
|
|
1271
|
+
const w = Ge(v, g);
|
|
1272
|
+
return /* @__PURE__ */ j(
|
|
1076
1273
|
"div",
|
|
1077
1274
|
{
|
|
1078
1275
|
"data-panel": !0,
|
|
1079
|
-
"data-
|
|
1080
|
-
ref:
|
|
1276
|
+
"data-testid": a ?? void 0,
|
|
1277
|
+
ref: h,
|
|
1081
1278
|
style: {
|
|
1082
1279
|
flexBasis: 0,
|
|
1083
|
-
flexGrow: `var(${
|
|
1280
|
+
flexGrow: `var(${w}, 1)`,
|
|
1084
1281
|
flexShrink: 1,
|
|
1085
1282
|
// Prevent Panel content from interfering with panel size
|
|
1086
1283
|
overflow: "hidden",
|
|
1087
1284
|
// Disable pointer events inside of a panel during resize
|
|
1088
1285
|
// This avoid edge cases like nested iframes
|
|
1089
|
-
pointerEvents: `var(${
|
|
1286
|
+
pointerEvents: `var(${Me})`
|
|
1090
1287
|
},
|
|
1091
|
-
children: /* @__PURE__ */
|
|
1288
|
+
children: /* @__PURE__ */ j(
|
|
1092
1289
|
"div",
|
|
1093
1290
|
{
|
|
1094
1291
|
className: t,
|
|
@@ -1103,65 +1300,136 @@ function st({
|
|
|
1103
1300
|
}
|
|
1104
1301
|
);
|
|
1105
1302
|
}
|
|
1106
|
-
function
|
|
1107
|
-
return
|
|
1303
|
+
function vt() {
|
|
1304
|
+
return R(null);
|
|
1305
|
+
}
|
|
1306
|
+
function yt() {
|
|
1307
|
+
return D(null);
|
|
1108
1308
|
}
|
|
1109
|
-
function lt(
|
|
1110
|
-
|
|
1309
|
+
function lt({
|
|
1310
|
+
layout: e,
|
|
1311
|
+
panelConstraints: t,
|
|
1312
|
+
panelId: n,
|
|
1313
|
+
panelIndex: o
|
|
1314
|
+
}) {
|
|
1315
|
+
let s, i;
|
|
1316
|
+
const a = e[n], r = t.find(
|
|
1317
|
+
(l) => l.panelId === n
|
|
1318
|
+
);
|
|
1319
|
+
if (r) {
|
|
1320
|
+
const l = r.maxSize, c = i = r.collapsible ? r.collapsedSize : r.minSize, u = [o, o + 1];
|
|
1321
|
+
i = F({
|
|
1322
|
+
layout: Q({
|
|
1323
|
+
delta: c - a,
|
|
1324
|
+
initialLayout: e,
|
|
1325
|
+
panelConstraints: t,
|
|
1326
|
+
pivotIndices: u,
|
|
1327
|
+
prevLayout: e,
|
|
1328
|
+
trigger: "keyboard"
|
|
1329
|
+
}),
|
|
1330
|
+
panelConstraints: t
|
|
1331
|
+
})[n], s = F({
|
|
1332
|
+
layout: Q({
|
|
1333
|
+
delta: l - a,
|
|
1334
|
+
initialLayout: e,
|
|
1335
|
+
panelConstraints: t,
|
|
1336
|
+
pivotIndices: u,
|
|
1337
|
+
prevLayout: e,
|
|
1338
|
+
trigger: "keyboard"
|
|
1339
|
+
}),
|
|
1340
|
+
panelConstraints: t
|
|
1341
|
+
})[n];
|
|
1342
|
+
}
|
|
1343
|
+
return {
|
|
1344
|
+
valueMax: s,
|
|
1345
|
+
valueMin: i,
|
|
1346
|
+
valueNow: a
|
|
1347
|
+
};
|
|
1111
1348
|
}
|
|
1112
|
-
function
|
|
1349
|
+
function gt({
|
|
1113
1350
|
children: e,
|
|
1114
1351
|
className: t,
|
|
1115
1352
|
elementRef: n,
|
|
1116
1353
|
id: o,
|
|
1117
1354
|
style: s
|
|
1118
1355
|
}) {
|
|
1119
|
-
const i =
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1356
|
+
const i = ce(o), [a, r] = R({}), [l, c] = R("inactive"), [u, f] = R(null), m = fe(f, n), {
|
|
1357
|
+
id: g,
|
|
1358
|
+
orientation: p,
|
|
1359
|
+
registerSeparator: d
|
|
1360
|
+
} = de(), h = p === "horizontal" ? "vertical" : "horizontal";
|
|
1361
|
+
return H(() => {
|
|
1362
|
+
if (u !== null) {
|
|
1363
|
+
const v = {
|
|
1364
|
+
element: u,
|
|
1124
1365
|
id: i
|
|
1125
|
-
},
|
|
1366
|
+
}, z = d(v), x = A.addListener(
|
|
1126
1367
|
"interactionStateChange",
|
|
1127
|
-
(
|
|
1368
|
+
(w) => {
|
|
1128
1369
|
c(
|
|
1129
|
-
|
|
1130
|
-
(
|
|
1131
|
-
) ?
|
|
1370
|
+
w.state !== "inactive" && w.hitRegions.some(
|
|
1371
|
+
(G) => G.separator === v
|
|
1372
|
+
) ? w.state : "inactive"
|
|
1373
|
+
);
|
|
1374
|
+
}
|
|
1375
|
+
), y = A.addListener(
|
|
1376
|
+
"mountedGroupsChange",
|
|
1377
|
+
(w) => {
|
|
1378
|
+
w.forEach(
|
|
1379
|
+
({ derivedPanelConstraints: G, layout: O, separatorToPanels: te }, U) => {
|
|
1380
|
+
if (U.id === g) {
|
|
1381
|
+
const B = te.get(v);
|
|
1382
|
+
if (B) {
|
|
1383
|
+
const K = B[0], V = U.panels.indexOf(K);
|
|
1384
|
+
r(
|
|
1385
|
+
lt({
|
|
1386
|
+
layout: O,
|
|
1387
|
+
panelConstraints: G,
|
|
1388
|
+
panelId: K.id,
|
|
1389
|
+
panelIndex: V
|
|
1390
|
+
})
|
|
1391
|
+
);
|
|
1392
|
+
}
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1132
1395
|
);
|
|
1133
1396
|
}
|
|
1134
1397
|
);
|
|
1135
1398
|
return () => {
|
|
1136
|
-
|
|
1399
|
+
x(), y(), z();
|
|
1137
1400
|
};
|
|
1138
1401
|
}
|
|
1139
|
-
}, [
|
|
1402
|
+
}, [u, g, i, d]), /* @__PURE__ */ j(
|
|
1140
1403
|
"div",
|
|
1141
1404
|
{
|
|
1405
|
+
"aria-orientation": h,
|
|
1406
|
+
"aria-valuemax": a.valueMax,
|
|
1407
|
+
"aria-valuemin": a.valueMin,
|
|
1408
|
+
"aria-valuenow": a.valueNow,
|
|
1142
1409
|
children: e,
|
|
1143
1410
|
className: t,
|
|
1144
|
-
"data-separator":
|
|
1145
|
-
"data-
|
|
1146
|
-
|
|
1147
|
-
|
|
1411
|
+
"data-separator": l,
|
|
1412
|
+
"data-testid": o ?? void 0,
|
|
1413
|
+
ref: m,
|
|
1414
|
+
role: "separator",
|
|
1148
1415
|
style: {
|
|
1149
1416
|
flexBasis: "auto",
|
|
1150
1417
|
...s,
|
|
1151
1418
|
flexGrow: 0,
|
|
1152
1419
|
flexShrink: 0
|
|
1153
|
-
}
|
|
1420
|
+
},
|
|
1421
|
+
tabIndex: 0
|
|
1154
1422
|
}
|
|
1155
1423
|
);
|
|
1156
1424
|
}
|
|
1157
1425
|
export {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1426
|
+
ft as Group,
|
|
1427
|
+
ht as Panel,
|
|
1428
|
+
gt as Separator,
|
|
1429
|
+
dt as useDefaultLayout,
|
|
1430
|
+
pt as useGroupCallbackRef,
|
|
1431
|
+
mt as useGroupRef,
|
|
1432
|
+
vt as usePanelCallbackRef,
|
|
1433
|
+
yt as usePanelRef
|
|
1166
1434
|
};
|
|
1167
1435
|
//# sourceMappingURL=react-resizable-panels.js.map
|