react-resizable-panels 4.0.0-alpha.1 → 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 $e(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 j({
|
|
|
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
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 ae(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,83 +215,403 @@ class De {
|
|
|
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
|
-
return
|
|
186
|
-
e === "horizontal" ? _e : Fe
|
|
187
|
-
);
|
|
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;
|
|
188
265
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
266
|
+
function W(e, t) {
|
|
267
|
+
return L(e, t) ? 0 : e > t ? 1 : -1;
|
|
192
268
|
}
|
|
193
|
-
function
|
|
194
|
-
|
|
195
|
-
|
|
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;
|
|
196
286
|
}
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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}`
|
|
206
391
|
);
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
p.width,
|
|
223
|
-
p.top - d.bottom
|
|
224
|
-
)
|
|
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
|
|
225
407
|
});
|
|
408
|
+
if (L(w, O) || (z -= O - w, l[y] = O), L(z, 0))
|
|
409
|
+
break;
|
|
410
|
+
e > 0 ? y-- : y++;
|
|
226
411
|
}
|
|
227
|
-
r = u, l = void 0;
|
|
228
|
-
} else {
|
|
229
|
-
const d = s.find(
|
|
230
|
-
(p) => p.element === c
|
|
231
|
-
);
|
|
232
|
-
d ? l = d : (r = void 0, l = void 0);
|
|
233
412
|
}
|
|
234
413
|
}
|
|
235
|
-
|
|
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), {});
|
|
236
422
|
}
|
|
237
|
-
function
|
|
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), {});
|
|
482
|
+
}
|
|
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) {
|
|
238
615
|
return {
|
|
239
616
|
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
240
617
|
Math.abs(e.x - t.left),
|
|
@@ -246,13 +623,13 @@ function je(e, t) {
|
|
|
246
623
|
)
|
|
247
624
|
};
|
|
248
625
|
}
|
|
249
|
-
function
|
|
626
|
+
function qe(e, t, n) {
|
|
250
627
|
let o, s = {
|
|
251
628
|
x: 1 / 0,
|
|
252
629
|
y: 1 / 0
|
|
253
630
|
};
|
|
254
631
|
for (const i of t) {
|
|
255
|
-
const a =
|
|
632
|
+
const a = Ze(n, i.rect);
|
|
256
633
|
switch (e) {
|
|
257
634
|
case "horizontal": {
|
|
258
635
|
a.x <= s.x && (o = i, s = a);
|
|
@@ -269,33 +646,33 @@ function We(e, t, n) {
|
|
|
269
646
|
hitRegion: o
|
|
270
647
|
} : void 0;
|
|
271
648
|
}
|
|
272
|
-
let
|
|
273
|
-
function
|
|
274
|
-
return
|
|
649
|
+
let Z;
|
|
650
|
+
function Je() {
|
|
651
|
+
return Z === void 0 && (typeof matchMedia == "function" ? Z = !!matchMedia("(pointer:coarse)").matches : Z = !1), Z;
|
|
275
652
|
}
|
|
276
|
-
function
|
|
653
|
+
function Ce(e, t) {
|
|
277
654
|
const n = [];
|
|
278
655
|
return t.forEach((o, s) => {
|
|
279
656
|
if (s.disabled)
|
|
280
657
|
return;
|
|
281
|
-
const i =
|
|
658
|
+
const i = Je() ? he.coarse : he.precise, a = ze(s), r = qe(s.orientation, a, {
|
|
282
659
|
x: e.clientX,
|
|
283
660
|
y: e.clientY
|
|
284
661
|
});
|
|
285
662
|
r && r.distance.x <= i && r.distance.y <= i && n.push(r.hitRegion);
|
|
286
663
|
}), n;
|
|
287
664
|
}
|
|
288
|
-
function
|
|
665
|
+
function ve(e) {
|
|
289
666
|
if (e.defaultPrevented)
|
|
290
667
|
return;
|
|
291
|
-
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();
|
|
292
669
|
n.forEach((r) => {
|
|
293
670
|
o.add(r.group), r.panels.forEach((c) => {
|
|
294
671
|
s.add(c);
|
|
295
672
|
}), r.separator && i.add(r.separator);
|
|
296
673
|
const l = t.get(r.group);
|
|
297
674
|
l && a.set(r.group, l.layout);
|
|
298
|
-
}),
|
|
675
|
+
}), M({
|
|
299
676
|
interactionState: {
|
|
300
677
|
hitRegions: n,
|
|
301
678
|
initialLayoutMap: a,
|
|
@@ -304,7 +681,7 @@ function ce(e) {
|
|
|
304
681
|
}
|
|
305
682
|
}), n.length && e.preventDefault();
|
|
306
683
|
}
|
|
307
|
-
function
|
|
684
|
+
function Qe({
|
|
308
685
|
cursorFlags: e,
|
|
309
686
|
groups: t,
|
|
310
687
|
state: n
|
|
@@ -331,7 +708,7 @@ function Be({
|
|
|
331
708
|
return null;
|
|
332
709
|
switch (n) {
|
|
333
710
|
case "active": {
|
|
334
|
-
const i = (e &
|
|
711
|
+
const i = (e & Le) !== 0, a = (e & Pe) !== 0, r = (e & Ee) !== 0, l = (e & Re) !== 0;
|
|
335
712
|
if (e) {
|
|
336
713
|
if (i)
|
|
337
714
|
return r ? "se-resize" : l ? "ne-resize" : "e-resize";
|
|
@@ -347,174 +724,40 @@ function Be({
|
|
|
347
724
|
}
|
|
348
725
|
return o > 0 && s > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
349
726
|
}
|
|
350
|
-
let
|
|
351
|
-
function
|
|
352
|
-
|
|
353
|
-
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();
|
|
354
731
|
switch (t.state) {
|
|
355
732
|
case "active":
|
|
356
733
|
case "hover": {
|
|
357
|
-
const n =
|
|
734
|
+
const n = Qe({
|
|
358
735
|
cursorFlags: e,
|
|
359
736
|
groups: t.hitRegions.map((o) => o.group),
|
|
360
737
|
state: t.state
|
|
361
738
|
});
|
|
362
|
-
if (
|
|
739
|
+
if (ie === n)
|
|
363
740
|
return;
|
|
364
|
-
|
|
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);
|
|
365
742
|
break;
|
|
366
743
|
}
|
|
367
744
|
case "inactive": {
|
|
368
|
-
|
|
745
|
+
ie = null, I.cssRules.length === 1 && I.deleteRule(0);
|
|
369
746
|
break;
|
|
370
747
|
}
|
|
371
748
|
}
|
|
372
749
|
}
|
|
373
|
-
function
|
|
374
|
-
if (!e)
|
|
375
|
-
throw console.error(t), Error(t);
|
|
376
|
-
}
|
|
377
|
-
function Ve(e, t) {
|
|
378
|
-
if (e.length !== t.length)
|
|
379
|
-
return !1;
|
|
380
|
-
for (let n = 0; n < e.length; n++)
|
|
381
|
-
if (e[n] != t[n])
|
|
382
|
-
return !1;
|
|
383
|
-
return !0;
|
|
384
|
-
}
|
|
385
|
-
function w(e, t, n = 0) {
|
|
386
|
-
return Math.abs(L(e) - L(t)) <= n;
|
|
387
|
-
}
|
|
388
|
-
function Z(e, t) {
|
|
389
|
-
return w(e, t) ? 0 : e > t ? 1 : -1;
|
|
390
|
-
}
|
|
391
|
-
function D({
|
|
392
|
-
panelConstraints: e,
|
|
393
|
-
size: t
|
|
394
|
-
}) {
|
|
395
|
-
const {
|
|
396
|
-
collapsedSize: n = 0,
|
|
397
|
-
collapsible: o,
|
|
398
|
-
maxSize: s = 100,
|
|
399
|
-
minSize: i = 0
|
|
400
|
-
} = e;
|
|
401
|
-
if (Z(t, i) < 0)
|
|
402
|
-
if (o) {
|
|
403
|
-
const a = (n + i) / 2;
|
|
404
|
-
Z(t, a) < 0 ? t = n : t = i;
|
|
405
|
-
} else
|
|
406
|
-
t = i;
|
|
407
|
-
return t = Math.min(s, t), t = L(t), t;
|
|
408
|
-
}
|
|
409
|
-
function Ke({
|
|
410
|
-
delta: e,
|
|
411
|
-
initialLayout: t,
|
|
412
|
-
panelConstraints: n,
|
|
413
|
-
pivotIndices: o,
|
|
414
|
-
prevLayout: s,
|
|
415
|
-
trigger: i
|
|
416
|
-
}) {
|
|
417
|
-
if (w(e, 0))
|
|
418
|
-
return t;
|
|
419
|
-
const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
|
|
420
|
-
C(c != null, "Invalid first pivot index"), C(u != null, "Invalid second pivot index");
|
|
421
|
-
let d = 0;
|
|
422
|
-
{
|
|
423
|
-
const h = e < 0 ? 1 : -1;
|
|
424
|
-
let f = e < 0 ? u : c, v = 0;
|
|
425
|
-
for (; ; ) {
|
|
426
|
-
const x = a[f];
|
|
427
|
-
C(
|
|
428
|
-
x != null,
|
|
429
|
-
`Previous layout not found for panel index ${f}`
|
|
430
|
-
);
|
|
431
|
-
const S = D({
|
|
432
|
-
panelConstraints: n[f],
|
|
433
|
-
size: 100
|
|
434
|
-
}) - x;
|
|
435
|
-
if (v += S, f += h, f < 0 || f >= n.length)
|
|
436
|
-
break;
|
|
437
|
-
}
|
|
438
|
-
const g = Math.min(Math.abs(e), Math.abs(v));
|
|
439
|
-
e = e < 0 ? 0 - g : g;
|
|
440
|
-
}
|
|
441
|
-
{
|
|
442
|
-
let f = e < 0 ? c : u;
|
|
443
|
-
for (; f >= 0 && f < n.length; ) {
|
|
444
|
-
const v = Math.abs(e) - Math.abs(d), g = a[f];
|
|
445
|
-
C(
|
|
446
|
-
g != null,
|
|
447
|
-
`Previous layout not found for panel index ${f}`
|
|
448
|
-
);
|
|
449
|
-
const x = g - v, z = D({
|
|
450
|
-
panelConstraints: n[f],
|
|
451
|
-
size: x
|
|
452
|
-
});
|
|
453
|
-
if (!w(g, z) && (d += g - z, l[f] = z, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
454
|
-
numeric: !0
|
|
455
|
-
}) >= 0))
|
|
456
|
-
break;
|
|
457
|
-
e < 0 ? f-- : f++;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
if (Ve(r, l))
|
|
461
|
-
return s;
|
|
462
|
-
{
|
|
463
|
-
const h = e < 0 ? u : c, f = a[h];
|
|
464
|
-
C(
|
|
465
|
-
f != null,
|
|
466
|
-
`Previous layout not found for panel index ${h}`
|
|
467
|
-
);
|
|
468
|
-
const v = f + d, g = D({
|
|
469
|
-
panelConstraints: n[h],
|
|
470
|
-
size: v
|
|
471
|
-
});
|
|
472
|
-
if (l[h] = g, !w(g, v)) {
|
|
473
|
-
let x = v - g, S = e < 0 ? u : c;
|
|
474
|
-
for (; S >= 0 && S < n.length; ) {
|
|
475
|
-
const R = l[S];
|
|
476
|
-
C(
|
|
477
|
-
R != null,
|
|
478
|
-
`Previous layout not found for panel index ${S}`
|
|
479
|
-
);
|
|
480
|
-
const k = R + x, A = D({
|
|
481
|
-
panelConstraints: n[S],
|
|
482
|
-
size: k
|
|
483
|
-
});
|
|
484
|
-
if (w(R, A) || (x -= A - R, l[S] = A), w(x, 0))
|
|
485
|
-
break;
|
|
486
|
-
e > 0 ? S-- : S++;
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
const p = Object.values(l).reduce(
|
|
491
|
-
(h, f) => f + h,
|
|
492
|
-
0
|
|
493
|
-
);
|
|
494
|
-
if (!w(p, 100, 0.1))
|
|
495
|
-
return s;
|
|
496
|
-
const m = Object.keys(s);
|
|
497
|
-
return l.reduce((h, f, v) => (h[m[v]] = f, h), {});
|
|
498
|
-
}
|
|
499
|
-
function ee(e, t) {
|
|
500
|
-
if (Object.keys(e).length !== Object.keys(t).length)
|
|
501
|
-
return !1;
|
|
502
|
-
for (const n in e)
|
|
503
|
-
if (Z(e[n], t[n]) !== 0)
|
|
504
|
-
return !1;
|
|
505
|
-
return !0;
|
|
506
|
-
}
|
|
507
|
-
function U(e) {
|
|
750
|
+
function q(e) {
|
|
508
751
|
if (e.defaultPrevented)
|
|
509
752
|
return;
|
|
510
|
-
const { interactionState: t, mountedGroups: n } =
|
|
753
|
+
const { interactionState: t, mountedGroups: n } = k();
|
|
511
754
|
switch (t.state) {
|
|
512
755
|
case "active": {
|
|
513
756
|
if (
|
|
514
757
|
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
515
758
|
e.type !== "pointerleave" && e.buttons === 0
|
|
516
759
|
) {
|
|
517
|
-
|
|
760
|
+
M(
|
|
518
761
|
(i) => i.interactionState.state === "inactive" ? i : {
|
|
519
762
|
cursorFlags: 0,
|
|
520
763
|
interactionState: {
|
|
@@ -530,103 +773,108 @@ function U(e) {
|
|
|
530
773
|
const { disableCursor: a, element: r, orientation: l, panels: c } = i.group;
|
|
531
774
|
let u = 0;
|
|
532
775
|
t.state === "active" && (l === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / r.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / r.offsetHeight * 100);
|
|
533
|
-
const
|
|
776
|
+
const f = t.initialLayoutMap.get(
|
|
534
777
|
i.group
|
|
535
|
-
), {
|
|
536
|
-
|
|
537
|
-
|
|
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({
|
|
538
785
|
delta: u,
|
|
539
|
-
initialLayout:
|
|
540
|
-
panelConstraints:
|
|
541
|
-
pivotIndices: i.panels.map((
|
|
542
|
-
prevLayout:
|
|
786
|
+
initialLayout: f,
|
|
787
|
+
panelConstraints: m,
|
|
788
|
+
pivotIndices: i.panels.map((h) => c.indexOf(h)),
|
|
789
|
+
prevLayout: g,
|
|
543
790
|
trigger: "mouse-or-touch"
|
|
544
791
|
});
|
|
545
|
-
if (ee(
|
|
792
|
+
if (ee(d, g)) {
|
|
546
793
|
if (u !== 0 && !a)
|
|
547
794
|
switch (l) {
|
|
548
795
|
case "horizontal": {
|
|
549
|
-
o |= u < 0 ?
|
|
796
|
+
o |= u < 0 ? Le : Pe;
|
|
550
797
|
break;
|
|
551
798
|
}
|
|
552
799
|
case "vertical": {
|
|
553
|
-
o |= u < 0 ?
|
|
800
|
+
o |= u < 0 ? Ee : Re;
|
|
554
801
|
break;
|
|
555
802
|
}
|
|
556
803
|
}
|
|
557
804
|
} else {
|
|
558
805
|
s.set(i.group, {
|
|
559
|
-
derivedPanelConstraints:
|
|
560
|
-
layout:
|
|
806
|
+
derivedPanelConstraints: m,
|
|
807
|
+
layout: d,
|
|
808
|
+
separatorToPanels: p
|
|
561
809
|
});
|
|
562
|
-
const
|
|
563
|
-
i.group.inMemoryLayouts[
|
|
810
|
+
const h = i.group.panels.map(({ id: v }) => v).join(",");
|
|
811
|
+
i.group.inMemoryLayouts[h] = d;
|
|
564
812
|
}
|
|
565
813
|
}
|
|
566
|
-
}),
|
|
814
|
+
}), M({
|
|
567
815
|
cursorFlags: o,
|
|
568
816
|
mountedGroups: s
|
|
569
|
-
}),
|
|
817
|
+
}), se();
|
|
570
818
|
break;
|
|
571
819
|
}
|
|
572
820
|
default: {
|
|
573
|
-
const o =
|
|
574
|
-
o.length === 0 ? t.state !== "inactive" &&
|
|
821
|
+
const o = Ce(e, n);
|
|
822
|
+
o.length === 0 ? t.state !== "inactive" && M({
|
|
575
823
|
interactionState: { state: "inactive" }
|
|
576
|
-
}) :
|
|
824
|
+
}) : M({
|
|
577
825
|
interactionState: {
|
|
578
826
|
hitRegions: o,
|
|
579
827
|
state: "hover"
|
|
580
828
|
}
|
|
581
|
-
}),
|
|
829
|
+
}), se();
|
|
582
830
|
break;
|
|
583
831
|
}
|
|
584
832
|
}
|
|
585
833
|
}
|
|
586
|
-
function
|
|
834
|
+
function ye(e) {
|
|
587
835
|
if (e.defaultPrevented)
|
|
588
836
|
return;
|
|
589
837
|
e.preventDefault();
|
|
590
|
-
const { interactionState: t } =
|
|
838
|
+
const { interactionState: t } = k();
|
|
591
839
|
switch (t.state) {
|
|
592
840
|
case "active":
|
|
593
|
-
|
|
841
|
+
M({
|
|
594
842
|
cursorFlags: 0,
|
|
595
843
|
interactionState: {
|
|
596
844
|
state: "inactive"
|
|
597
845
|
}
|
|
598
|
-
}),
|
|
846
|
+
}), se();
|
|
599
847
|
}
|
|
600
848
|
}
|
|
601
|
-
function
|
|
849
|
+
function et(e) {
|
|
602
850
|
let t = 0, n = 0;
|
|
603
851
|
const o = {};
|
|
604
852
|
for (const i of e)
|
|
605
853
|
if (i.defaultSize !== void 0) {
|
|
606
854
|
t++;
|
|
607
|
-
const a =
|
|
855
|
+
const a = C(i.defaultSize);
|
|
608
856
|
n += a, o[i.panelId] = a;
|
|
609
857
|
} else
|
|
610
858
|
o[i.panelId] = void 0;
|
|
611
859
|
const s = e.length - t;
|
|
612
860
|
if (s !== 0) {
|
|
613
|
-
const i =
|
|
861
|
+
const i = C((100 - n) / s);
|
|
614
862
|
for (const a of e)
|
|
615
863
|
a.defaultSize === void 0 && (o[a.panelId] = i);
|
|
616
864
|
}
|
|
617
865
|
return o;
|
|
618
866
|
}
|
|
619
|
-
function
|
|
867
|
+
function tt(e, t, n) {
|
|
620
868
|
const o = n[0];
|
|
621
869
|
if (!o)
|
|
622
870
|
return;
|
|
623
871
|
const s = e.panels.find((a) => a.element === t);
|
|
624
872
|
if (!s || !s.onResize)
|
|
625
873
|
return;
|
|
626
|
-
const i =
|
|
874
|
+
const i = le({ group: e });
|
|
627
875
|
s.onResize(
|
|
628
876
|
{
|
|
629
|
-
asPercentage:
|
|
877
|
+
asPercentage: C(
|
|
630
878
|
o.inlineSize / i * 100
|
|
631
879
|
),
|
|
632
880
|
inPixels: o.inlineSize
|
|
@@ -634,105 +882,71 @@ function Ye(e, t, n) {
|
|
|
634
882
|
s.id
|
|
635
883
|
);
|
|
636
884
|
}
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
);
|
|
649
|
-
if (!w(s, 100) && o.length > 0)
|
|
650
|
-
for (let r = 0; r < t.length; r++) {
|
|
651
|
-
const l = o[r];
|
|
652
|
-
C(l != null, `No layout data found for index ${r}`);
|
|
653
|
-
const c = 100 / s * l;
|
|
654
|
-
o[r] = c;
|
|
655
|
-
}
|
|
656
|
-
let i = 0;
|
|
657
|
-
for (let r = 0; r < t.length; r++) {
|
|
658
|
-
const l = o[r];
|
|
659
|
-
C(l != null, `No layout data found for index ${r}`);
|
|
660
|
-
const c = D({
|
|
661
|
-
panelConstraints: t[r],
|
|
662
|
-
size: l
|
|
663
|
-
});
|
|
664
|
-
l != c && (i += l - c, o[r] = c);
|
|
665
|
-
}
|
|
666
|
-
if (!w(i, 0))
|
|
667
|
-
for (let r = 0; r < t.length; r++) {
|
|
668
|
-
const l = o[r];
|
|
669
|
-
C(l != null, `No layout data found for index ${r}`);
|
|
670
|
-
const c = l + i, u = D({
|
|
671
|
-
panelConstraints: t[r],
|
|
672
|
-
size: c
|
|
673
|
-
});
|
|
674
|
-
if (l !== u && (i -= u - l, o[r] = u, w(i, 0)))
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
const a = Object.keys(e);
|
|
678
|
-
return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
|
|
679
|
-
}
|
|
680
|
-
function Ze(e) {
|
|
681
|
-
let t = !1;
|
|
682
|
-
const n = new ResizeObserver((l) => {
|
|
683
|
-
for (const c of l) {
|
|
684
|
-
const { borderBoxSize: u, target: d } = c;
|
|
685
|
-
d === e.element ? t && G((p) => {
|
|
686
|
-
const m = p.mountedGroups.get(e);
|
|
687
|
-
if (m) {
|
|
688
|
-
const h = ae(e), f = m.layout, v = q({
|
|
689
|
-
layout: f,
|
|
690
|
-
panelConstraints: h
|
|
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
|
|
691
896
|
});
|
|
692
897
|
return {
|
|
693
|
-
mountedGroups: new Map(
|
|
694
|
-
derivedPanelConstraints:
|
|
695
|
-
layout: v
|
|
898
|
+
mountedGroups: new Map(g.mountedGroups).set(e, {
|
|
899
|
+
derivedPanelConstraints: d,
|
|
900
|
+
layout: v,
|
|
901
|
+
separatorToPanels: p.separatorToPanels
|
|
696
902
|
})
|
|
697
903
|
};
|
|
698
904
|
}
|
|
699
|
-
return
|
|
700
|
-
}) :
|
|
905
|
+
return g;
|
|
906
|
+
}) : tt(e, m, f);
|
|
701
907
|
}
|
|
702
908
|
});
|
|
703
|
-
n.observe(e.element), e.panels.forEach((
|
|
704
|
-
|
|
909
|
+
n.observe(e.element), e.panels.forEach((c) => {
|
|
910
|
+
c.onResize && n.observe(c.element);
|
|
705
911
|
});
|
|
706
|
-
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({
|
|
707
913
|
layout: i,
|
|
708
914
|
panelConstraints: o
|
|
709
|
-
}), r =
|
|
710
|
-
mountedGroups: new Map(
|
|
915
|
+
}), r = ze(e), l = M((c) => ({
|
|
916
|
+
mountedGroups: new Map(c.mountedGroups).set(e, {
|
|
711
917
|
derivedPanelConstraints: o,
|
|
712
|
-
layout: a
|
|
918
|
+
layout: a,
|
|
919
|
+
separatorToPanels: new Map(
|
|
920
|
+
r.filter((u) => u.separator).map((u) => [u.separator, u.panels])
|
|
921
|
+
)
|
|
713
922
|
})
|
|
714
923
|
}));
|
|
715
|
-
return
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
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 };
|
|
719
931
|
});
|
|
720
|
-
|
|
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();
|
|
721
935
|
};
|
|
722
936
|
}
|
|
723
|
-
function
|
|
724
|
-
const t =
|
|
937
|
+
function ce(e) {
|
|
938
|
+
const t = De();
|
|
725
939
|
return `${e ?? t}`;
|
|
726
940
|
}
|
|
727
|
-
const
|
|
728
|
-
function
|
|
729
|
-
const t =
|
|
730
|
-
return
|
|
941
|
+
const H = typeof window < "u" ? Te : Ae;
|
|
942
|
+
function ue(e) {
|
|
943
|
+
const t = D(e);
|
|
944
|
+
return H(() => {
|
|
731
945
|
t.current = e;
|
|
732
|
-
}, [e]),
|
|
946
|
+
}, [e]), ge((n) => t.current?.(n), [t]);
|
|
733
947
|
}
|
|
734
|
-
function
|
|
735
|
-
return
|
|
948
|
+
function fe(...e) {
|
|
949
|
+
return ue((t) => {
|
|
736
950
|
e.forEach((n) => {
|
|
737
951
|
if (n)
|
|
738
952
|
switch (typeof n) {
|
|
@@ -748,54 +962,25 @@ function oe(...e) {
|
|
|
748
962
|
});
|
|
749
963
|
});
|
|
750
964
|
}
|
|
751
|
-
const
|
|
752
|
-
function
|
|
965
|
+
const Me = "--react-resizable-panels--panel--pointer-events";
|
|
966
|
+
function Ge(e, t) {
|
|
753
967
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
754
968
|
return `--react-resizable-panels--${n}--${o}`;
|
|
755
969
|
}
|
|
756
|
-
const
|
|
757
|
-
function
|
|
758
|
-
|
|
759
|
-
}) {
|
|
760
|
-
const t = () => {
|
|
761
|
-
const { mountedGroups: n } = O();
|
|
762
|
-
for (const [o, { derivedPanelConstraints: s, layout: i }] of n)
|
|
763
|
-
if (o.id === e)
|
|
764
|
-
return { derivedPanelConstraints: s, group: o, layout: i };
|
|
765
|
-
throw Error(`Group ${e} not found`);
|
|
766
|
-
};
|
|
767
|
-
return {
|
|
768
|
-
getLayout() {
|
|
769
|
-
const { layout: n } = t();
|
|
770
|
-
return n;
|
|
771
|
-
},
|
|
772
|
-
setLayout(n) {
|
|
773
|
-
const { derivedPanelConstraints: o, group: s, layout: i } = t(), a = q({
|
|
774
|
-
layout: n,
|
|
775
|
-
panelConstraints: o
|
|
776
|
-
});
|
|
777
|
-
return ee(i, a) || G((r) => ({
|
|
778
|
-
mountedGroups: new Map(r.mountedGroups).set(s, {
|
|
779
|
-
derivedPanelConstraints: o,
|
|
780
|
-
layout: a
|
|
781
|
-
})
|
|
782
|
-
})), a;
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
function Je(e, t) {
|
|
787
|
-
const n = I({
|
|
970
|
+
const Ie = $e(null);
|
|
971
|
+
function ot(e, t) {
|
|
972
|
+
const n = D({
|
|
788
973
|
getLayout: () => ({}),
|
|
789
|
-
setLayout:
|
|
974
|
+
setLayout: Ye
|
|
790
975
|
});
|
|
791
|
-
|
|
976
|
+
Se(t, () => n.current, []), H(() => {
|
|
792
977
|
Object.assign(
|
|
793
978
|
n.current,
|
|
794
|
-
|
|
979
|
+
be({ groupId: e })
|
|
795
980
|
);
|
|
796
981
|
});
|
|
797
982
|
}
|
|
798
|
-
function
|
|
983
|
+
function ft({
|
|
799
984
|
children: e,
|
|
800
985
|
className: t,
|
|
801
986
|
defaultLayout: n,
|
|
@@ -808,95 +993,97 @@ function rt({
|
|
|
808
993
|
orientation: c = "horizontal",
|
|
809
994
|
style: u
|
|
810
995
|
}) {
|
|
811
|
-
const
|
|
812
|
-
ee(
|
|
813
|
-
}),
|
|
814
|
-
|
|
815
|
-
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(
|
|
816
1001
|
() => ({
|
|
817
|
-
id:
|
|
1002
|
+
id: g,
|
|
818
1003
|
orientation: c,
|
|
819
|
-
registerPanel: (
|
|
820
|
-
|
|
1004
|
+
registerPanel: (b) => (w((E) => re(c, [...E, b])), () => {
|
|
1005
|
+
w((E) => E.filter(($) => $ !== b));
|
|
821
1006
|
}),
|
|
822
|
-
registerSeparator: (
|
|
823
|
-
(
|
|
1007
|
+
registerSeparator: (b) => (O(
|
|
1008
|
+
(E) => re(c, [...E, b])
|
|
824
1009
|
), () => {
|
|
825
|
-
|
|
826
|
-
(
|
|
1010
|
+
O(
|
|
1011
|
+
(E) => E.filter(($) => $ !== b)
|
|
827
1012
|
);
|
|
828
1013
|
})
|
|
829
1014
|
}),
|
|
830
|
-
[
|
|
1015
|
+
[g, c]
|
|
831
1016
|
);
|
|
832
|
-
|
|
833
|
-
if (
|
|
834
|
-
const
|
|
1017
|
+
H(() => {
|
|
1018
|
+
if (h !== null && y.length > 0) {
|
|
1019
|
+
const b = {
|
|
835
1020
|
defaultLayout: n,
|
|
836
1021
|
disableCursor: !!o,
|
|
837
1022
|
disabled: !!s,
|
|
838
|
-
element:
|
|
839
|
-
id:
|
|
840
|
-
|
|
1023
|
+
element: h,
|
|
1024
|
+
id: g,
|
|
1025
|
+
inMemoryLastExpandedPanelSizes: te.current,
|
|
1026
|
+
inMemoryLayouts: U.current,
|
|
841
1027
|
orientation: c,
|
|
842
|
-
panels:
|
|
843
|
-
separators:
|
|
844
|
-
},
|
|
845
|
-
|
|
846
|
-
const
|
|
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(
|
|
847
1033
|
"interactionStateChange",
|
|
848
|
-
(
|
|
849
|
-
switch (
|
|
1034
|
+
(X) => {
|
|
1035
|
+
switch (X.state) {
|
|
850
1036
|
case "active":
|
|
851
1037
|
case "hover": {
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
(
|
|
1038
|
+
d(
|
|
1039
|
+
X.hitRegions.some(
|
|
1040
|
+
(N) => N.group === b
|
|
855
1041
|
)
|
|
856
1042
|
);
|
|
857
1043
|
break;
|
|
858
1044
|
}
|
|
859
1045
|
}
|
|
860
1046
|
}
|
|
861
|
-
),
|
|
1047
|
+
), Oe = A.addListener(
|
|
862
1048
|
"mountedGroupsChange",
|
|
863
|
-
(
|
|
864
|
-
const
|
|
865
|
-
|
|
1049
|
+
(X) => {
|
|
1050
|
+
const N = X.get(b);
|
|
1051
|
+
N && N.derivedPanelConstraints.length > 0 && (x(N.layout), m?.(N.layout));
|
|
866
1052
|
}
|
|
867
1053
|
);
|
|
868
1054
|
return () => {
|
|
869
|
-
|
|
1055
|
+
E(), ke(), Oe();
|
|
870
1056
|
};
|
|
871
1057
|
}
|
|
872
1058
|
}, [
|
|
873
1059
|
n,
|
|
874
1060
|
o,
|
|
875
1061
|
s,
|
|
876
|
-
|
|
1062
|
+
h,
|
|
1063
|
+
g,
|
|
877
1064
|
m,
|
|
878
|
-
p,
|
|
879
1065
|
c,
|
|
880
|
-
|
|
881
|
-
|
|
1066
|
+
y,
|
|
1067
|
+
G
|
|
882
1068
|
]);
|
|
883
|
-
const
|
|
884
|
-
[
|
|
1069
|
+
const V = {
|
|
1070
|
+
[Me]: p ? "none" : void 0
|
|
885
1071
|
};
|
|
886
|
-
for (const
|
|
887
|
-
const
|
|
888
|
-
|
|
1072
|
+
for (const b in z) {
|
|
1073
|
+
const E = Ge(g, b), $ = z[b];
|
|
1074
|
+
V[E] = $;
|
|
889
1075
|
}
|
|
890
|
-
return /* @__PURE__ */
|
|
1076
|
+
return /* @__PURE__ */ j(Ie.Provider, { value: K, children: /* @__PURE__ */ j(
|
|
891
1077
|
"div",
|
|
892
1078
|
{
|
|
893
1079
|
"aria-orientation": c,
|
|
894
1080
|
className: t,
|
|
895
|
-
"data-group":
|
|
896
|
-
|
|
1081
|
+
"data-group": !0,
|
|
1082
|
+
"data-testid": r ?? void 0,
|
|
1083
|
+
ref: B,
|
|
897
1084
|
style: {
|
|
898
1085
|
...u,
|
|
899
|
-
...
|
|
1086
|
+
...V,
|
|
900
1087
|
display: "flex",
|
|
901
1088
|
flexDirection: c === "horizontal" ? "row" : "column",
|
|
902
1089
|
flexWrap: "nowrap"
|
|
@@ -905,34 +1092,34 @@ function rt({
|
|
|
905
1092
|
}
|
|
906
1093
|
) });
|
|
907
1094
|
}
|
|
908
|
-
function
|
|
1095
|
+
function ae(e) {
|
|
909
1096
|
return `react-resizable-panels:${e}`;
|
|
910
1097
|
}
|
|
911
|
-
function
|
|
1098
|
+
function it({
|
|
912
1099
|
id: e,
|
|
913
1100
|
layout: t,
|
|
914
1101
|
storage: n
|
|
915
1102
|
}) {
|
|
916
1103
|
try {
|
|
917
|
-
const o =
|
|
1104
|
+
const o = ae(e);
|
|
918
1105
|
n.setItem(o, JSON.stringify(t));
|
|
919
1106
|
} catch (o) {
|
|
920
1107
|
console.error(o);
|
|
921
1108
|
}
|
|
922
1109
|
}
|
|
923
|
-
function
|
|
1110
|
+
function dt({
|
|
924
1111
|
groupId: e,
|
|
925
1112
|
storage: t
|
|
926
1113
|
}) {
|
|
927
|
-
const n =
|
|
928
|
-
|
|
929
|
-
() => t.getItem(
|
|
930
|
-
() => t.getItem(
|
|
931
|
-
), o =
|
|
1114
|
+
const n = Ne(
|
|
1115
|
+
rt,
|
|
1116
|
+
() => t.getItem(ae(e)),
|
|
1117
|
+
() => t.getItem(ae(e))
|
|
1118
|
+
), o = xe(
|
|
932
1119
|
() => n ? JSON.parse(n) : null,
|
|
933
1120
|
[n]
|
|
934
|
-
), s =
|
|
935
|
-
(i) =>
|
|
1121
|
+
), s = ge(
|
|
1122
|
+
(i) => it({
|
|
936
1123
|
id: e,
|
|
937
1124
|
layout: i,
|
|
938
1125
|
storage: t
|
|
@@ -944,26 +1131,26 @@ function st({
|
|
|
944
1131
|
onLayoutChange: s
|
|
945
1132
|
};
|
|
946
1133
|
}
|
|
947
|
-
function
|
|
1134
|
+
function rt() {
|
|
948
1135
|
return function() {
|
|
949
1136
|
};
|
|
950
1137
|
}
|
|
951
|
-
function
|
|
952
|
-
return
|
|
1138
|
+
function pt() {
|
|
1139
|
+
return R(null);
|
|
953
1140
|
}
|
|
954
|
-
function
|
|
955
|
-
return
|
|
1141
|
+
function mt() {
|
|
1142
|
+
return D(null);
|
|
956
1143
|
}
|
|
957
|
-
function
|
|
958
|
-
const e = Ie
|
|
959
|
-
return
|
|
1144
|
+
function de() {
|
|
1145
|
+
const e = _e(Ie);
|
|
1146
|
+
return S(e, "Unexpected"), e;
|
|
960
1147
|
}
|
|
961
|
-
function
|
|
1148
|
+
function st({
|
|
962
1149
|
groupId: e,
|
|
963
1150
|
panelId: t
|
|
964
1151
|
}) {
|
|
965
1152
|
const n = () => {
|
|
966
|
-
const { mountedGroups: a } =
|
|
1153
|
+
const { mountedGroups: a } = k();
|
|
967
1154
|
for (const [r, { derivedPanelConstraints: l, layout: c }] of a)
|
|
968
1155
|
if (r.id === e)
|
|
969
1156
|
return { derivedPanelConstraints: l, group: r, layout: c };
|
|
@@ -1004,39 +1191,39 @@ function tt({
|
|
|
1004
1191
|
},
|
|
1005
1192
|
isCollapsed: () => {
|
|
1006
1193
|
const { collapsible: a, collapsedSize: r } = o(), l = i();
|
|
1007
|
-
return a &&
|
|
1194
|
+
return a && L(r, l);
|
|
1008
1195
|
},
|
|
1009
1196
|
resize: (a) => {
|
|
1010
1197
|
if (i() !== a)
|
|
1011
1198
|
switch (typeof a) {
|
|
1012
1199
|
case "number": {
|
|
1013
|
-
const { group: l } = n(), c =
|
|
1014
|
-
|
|
1200
|
+
const { group: l } = n(), c = le({ group: l });
|
|
1201
|
+
C(a / c * 100);
|
|
1015
1202
|
break;
|
|
1016
1203
|
}
|
|
1017
1204
|
}
|
|
1018
1205
|
}
|
|
1019
1206
|
};
|
|
1020
1207
|
}
|
|
1021
|
-
function
|
|
1022
|
-
const { id: n } =
|
|
1023
|
-
collapse:
|
|
1024
|
-
expand:
|
|
1208
|
+
function at(e, t) {
|
|
1209
|
+
const { id: n } = de(), o = D({
|
|
1210
|
+
collapse: oe,
|
|
1211
|
+
expand: oe,
|
|
1025
1212
|
getSize: () => ({
|
|
1026
1213
|
asPercentage: 0,
|
|
1027
1214
|
inPixels: 0
|
|
1028
1215
|
}),
|
|
1029
1216
|
isCollapsed: () => !1,
|
|
1030
|
-
resize:
|
|
1217
|
+
resize: oe
|
|
1031
1218
|
});
|
|
1032
|
-
|
|
1219
|
+
Se(t, () => o.current, []), H(() => {
|
|
1033
1220
|
Object.assign(
|
|
1034
1221
|
o.current,
|
|
1035
|
-
|
|
1222
|
+
st({ groupId: n, panelId: e })
|
|
1036
1223
|
);
|
|
1037
1224
|
});
|
|
1038
1225
|
}
|
|
1039
|
-
function
|
|
1226
|
+
function ht({
|
|
1040
1227
|
children: e,
|
|
1041
1228
|
className: t,
|
|
1042
1229
|
collapsedSize: n = 0,
|
|
@@ -1048,18 +1235,18 @@ function ct({
|
|
|
1048
1235
|
minSize: l = "0",
|
|
1049
1236
|
onResize: c,
|
|
1050
1237
|
panelRef: u,
|
|
1051
|
-
style:
|
|
1238
|
+
style: f
|
|
1052
1239
|
}) {
|
|
1053
|
-
const
|
|
1054
|
-
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);
|
|
1055
1242
|
});
|
|
1056
|
-
|
|
1057
|
-
if (
|
|
1058
|
-
return
|
|
1059
|
-
element:
|
|
1060
|
-
id:
|
|
1061
|
-
idIsStable:
|
|
1062
|
-
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,
|
|
1063
1250
|
panelConstraints: {
|
|
1064
1251
|
collapsedSize: n,
|
|
1065
1252
|
collapsible: o,
|
|
@@ -1072,39 +1259,40 @@ function ct({
|
|
|
1072
1259
|
n,
|
|
1073
1260
|
o,
|
|
1074
1261
|
s,
|
|
1075
|
-
h,
|
|
1076
|
-
z,
|
|
1077
|
-
m,
|
|
1078
1262
|
p,
|
|
1263
|
+
x,
|
|
1264
|
+
g,
|
|
1265
|
+
m,
|
|
1079
1266
|
r,
|
|
1080
1267
|
l,
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
]),
|
|
1084
|
-
const
|
|
1085
|
-
return /* @__PURE__ */
|
|
1268
|
+
y,
|
|
1269
|
+
z
|
|
1270
|
+
]), at(g, u);
|
|
1271
|
+
const w = Ge(v, g);
|
|
1272
|
+
return /* @__PURE__ */ j(
|
|
1086
1273
|
"div",
|
|
1087
1274
|
{
|
|
1088
|
-
"data-panel":
|
|
1089
|
-
|
|
1275
|
+
"data-panel": !0,
|
|
1276
|
+
"data-testid": a ?? void 0,
|
|
1277
|
+
ref: h,
|
|
1090
1278
|
style: {
|
|
1091
1279
|
flexBasis: 0,
|
|
1092
|
-
flexGrow: `var(${
|
|
1280
|
+
flexGrow: `var(${w}, 1)`,
|
|
1093
1281
|
flexShrink: 1,
|
|
1094
1282
|
// Prevent Panel content from interfering with panel size
|
|
1095
1283
|
overflow: "hidden",
|
|
1096
1284
|
// Disable pointer events inside of a panel during resize
|
|
1097
1285
|
// This avoid edge cases like nested iframes
|
|
1098
|
-
pointerEvents: `var(${
|
|
1286
|
+
pointerEvents: `var(${Me})`
|
|
1099
1287
|
},
|
|
1100
|
-
children: /* @__PURE__ */
|
|
1288
|
+
children: /* @__PURE__ */ j(
|
|
1101
1289
|
"div",
|
|
1102
1290
|
{
|
|
1103
1291
|
className: t,
|
|
1104
1292
|
style: {
|
|
1105
1293
|
width: "100%",
|
|
1106
1294
|
height: "100%",
|
|
1107
|
-
...
|
|
1295
|
+
...f
|
|
1108
1296
|
},
|
|
1109
1297
|
children: e
|
|
1110
1298
|
}
|
|
@@ -1112,48 +1300,117 @@ function ct({
|
|
|
1112
1300
|
}
|
|
1113
1301
|
);
|
|
1114
1302
|
}
|
|
1115
|
-
function
|
|
1116
|
-
return
|
|
1303
|
+
function vt() {
|
|
1304
|
+
return R(null);
|
|
1117
1305
|
}
|
|
1118
|
-
function
|
|
1119
|
-
return
|
|
1306
|
+
function yt() {
|
|
1307
|
+
return D(null);
|
|
1120
1308
|
}
|
|
1121
|
-
function
|
|
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
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
function gt({
|
|
1122
1350
|
children: e,
|
|
1123
1351
|
className: t,
|
|
1124
1352
|
elementRef: n,
|
|
1125
1353
|
id: o,
|
|
1126
1354
|
style: s
|
|
1127
1355
|
}) {
|
|
1128
|
-
const i =
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
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,
|
|
1133
1365
|
id: i
|
|
1134
|
-
},
|
|
1366
|
+
}, z = d(v), x = A.addListener(
|
|
1135
1367
|
"interactionStateChange",
|
|
1136
|
-
(
|
|
1368
|
+
(w) => {
|
|
1137
1369
|
c(
|
|
1138
|
-
|
|
1139
|
-
(
|
|
1140
|
-
) ?
|
|
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
|
+
}
|
|
1141
1395
|
);
|
|
1142
1396
|
}
|
|
1143
1397
|
);
|
|
1144
1398
|
return () => {
|
|
1145
|
-
|
|
1399
|
+
x(), y(), z();
|
|
1146
1400
|
};
|
|
1147
1401
|
}
|
|
1148
|
-
}, [
|
|
1402
|
+
}, [u, g, i, d]), /* @__PURE__ */ j(
|
|
1149
1403
|
"div",
|
|
1150
1404
|
{
|
|
1151
|
-
"aria-orientation":
|
|
1405
|
+
"aria-orientation": h,
|
|
1406
|
+
"aria-valuemax": a.valueMax,
|
|
1407
|
+
"aria-valuemin": a.valueMin,
|
|
1408
|
+
"aria-valuenow": a.valueNow,
|
|
1152
1409
|
children: e,
|
|
1153
1410
|
className: t,
|
|
1154
|
-
"data-separator":
|
|
1155
|
-
"data-
|
|
1156
|
-
ref:
|
|
1411
|
+
"data-separator": l,
|
|
1412
|
+
"data-testid": o ?? void 0,
|
|
1413
|
+
ref: m,
|
|
1157
1414
|
role: "separator",
|
|
1158
1415
|
style: {
|
|
1159
1416
|
flexBasis: "auto",
|
|
@@ -1166,13 +1423,13 @@ function dt({
|
|
|
1166
1423
|
);
|
|
1167
1424
|
}
|
|
1168
1425
|
export {
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
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
|
|
1177
1434
|
};
|
|
1178
1435
|
//# sourceMappingURL=react-resizable-panels.js.map
|