react-resizable-panels 4.0.8-alpha.2 → 4.0.8
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,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as B } from "react/jsx-runtime";
|
|
3
|
-
import { useId as Ne, useLayoutEffect as _e, useEffect as Fe, useRef as T, useCallback as ze, createContext as He, useImperativeHandle as be, useState as G, useMemo as
|
|
3
|
+
import { useId as Ne, useLayoutEffect as _e, useEffect as Fe, useRef as T, useCallback as ze, createContext as He, useImperativeHandle as be, useState as G, useMemo as Le, useSyncExternalStore as We, useContext as je } from "react";
|
|
4
4
|
function z(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
@@ -11,7 +11,7 @@ function H({
|
|
|
11
11
|
const { orientation: t, panels: n } = e;
|
|
12
12
|
return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function re(e, t) {
|
|
15
15
|
return t.sort(
|
|
16
16
|
e === "horizontal" ? Be : Ue
|
|
17
17
|
);
|
|
@@ -24,43 +24,43 @@ function Ue(e, t) {
|
|
|
24
24
|
const n = e.element.offsetTop - t.element.offsetTop;
|
|
25
25
|
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const { element: t, orientation: n, panels: o, separators: r } = e,
|
|
27
|
+
function we(e) {
|
|
28
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, a = re(
|
|
29
29
|
n,
|
|
30
30
|
Array.from(t.children).filter((l) => l instanceof HTMLElement).map((l) => ({ element: l }))
|
|
31
31
|
).map(({ element: l }) => l), u = [];
|
|
32
|
-
let i,
|
|
33
|
-
for (const l of
|
|
32
|
+
let i, s;
|
|
33
|
+
for (const l of a) {
|
|
34
34
|
const c = o.find(
|
|
35
35
|
(d) => d.element === l
|
|
36
36
|
);
|
|
37
37
|
if (c) {
|
|
38
38
|
if (i) {
|
|
39
|
-
const d = i.element.getBoundingClientRect(),
|
|
39
|
+
const d = i.element.getBoundingClientRect(), x = l.getBoundingClientRect();
|
|
40
40
|
u.push({
|
|
41
41
|
group: e,
|
|
42
42
|
groupSize: H({ group: e }),
|
|
43
43
|
panels: [i, c],
|
|
44
|
-
separator:
|
|
44
|
+
separator: s,
|
|
45
45
|
rect: n === "horizontal" ? new DOMRect(
|
|
46
46
|
d.right,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
x.top,
|
|
48
|
+
x.left - d.right,
|
|
49
|
+
x.height
|
|
50
50
|
) : new DOMRect(
|
|
51
|
-
|
|
51
|
+
x.left,
|
|
52
52
|
d.bottom,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
x.width,
|
|
54
|
+
x.top - d.bottom
|
|
55
55
|
)
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
i = c,
|
|
58
|
+
i = c, s = void 0;
|
|
59
59
|
} else {
|
|
60
60
|
const d = r.find(
|
|
61
|
-
(
|
|
61
|
+
(x) => x.element === l
|
|
62
62
|
);
|
|
63
|
-
d ?
|
|
63
|
+
d ? s = d : (i = void 0, s = void 0);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
return u;
|
|
@@ -95,8 +95,8 @@ function Q({
|
|
|
95
95
|
styleProp: n
|
|
96
96
|
}) {
|
|
97
97
|
let o;
|
|
98
|
-
const [r,
|
|
99
|
-
switch (
|
|
98
|
+
const [r, a] = qe(n);
|
|
99
|
+
switch (a) {
|
|
100
100
|
case "%": {
|
|
101
101
|
o = r / 100 * e;
|
|
102
102
|
break;
|
|
@@ -137,48 +137,48 @@ function pe(e) {
|
|
|
137
137
|
maxSize: 100,
|
|
138
138
|
panelId: o.id
|
|
139
139
|
})) : t.map((o) => {
|
|
140
|
-
const { element: r, panelConstraints:
|
|
140
|
+
const { element: r, panelConstraints: a } = o;
|
|
141
141
|
let u = 0;
|
|
142
|
-
if (
|
|
142
|
+
if (a.collapsedSize) {
|
|
143
143
|
const c = Q({
|
|
144
144
|
groupSize: n,
|
|
145
145
|
panelElement: r,
|
|
146
|
-
styleProp:
|
|
146
|
+
styleProp: a.collapsedSize
|
|
147
147
|
});
|
|
148
148
|
u = I(c / n * 100);
|
|
149
149
|
}
|
|
150
150
|
let i;
|
|
151
|
-
if (
|
|
151
|
+
if (a.defaultSize) {
|
|
152
152
|
const c = Q({
|
|
153
153
|
groupSize: n,
|
|
154
154
|
panelElement: r,
|
|
155
|
-
styleProp:
|
|
155
|
+
styleProp: a.defaultSize
|
|
156
156
|
});
|
|
157
157
|
i = I(c / n * 100);
|
|
158
158
|
}
|
|
159
|
-
let
|
|
160
|
-
if (
|
|
159
|
+
let s = 0;
|
|
160
|
+
if (a.minSize) {
|
|
161
161
|
const c = Q({
|
|
162
162
|
groupSize: n,
|
|
163
163
|
panelElement: r,
|
|
164
|
-
styleProp:
|
|
164
|
+
styleProp: a.minSize
|
|
165
165
|
});
|
|
166
|
-
|
|
166
|
+
s = I(c / n * 100);
|
|
167
167
|
}
|
|
168
168
|
let l = 100;
|
|
169
|
-
if (
|
|
169
|
+
if (a.maxSize) {
|
|
170
170
|
const c = Q({
|
|
171
171
|
groupSize: n,
|
|
172
172
|
panelElement: r,
|
|
173
|
-
styleProp:
|
|
173
|
+
styleProp: a.maxSize
|
|
174
174
|
});
|
|
175
175
|
l = I(c / n * 100);
|
|
176
176
|
}
|
|
177
177
|
return {
|
|
178
178
|
collapsedSize: u,
|
|
179
|
-
collapsible:
|
|
179
|
+
collapsible: a.collapsible === !0,
|
|
180
180
|
defaultSize: i,
|
|
181
|
-
minSize:
|
|
181
|
+
minSize: s,
|
|
182
182
|
maxSize: l,
|
|
183
183
|
panelId: o.id
|
|
184
184
|
};
|
|
@@ -198,18 +198,18 @@ class Ze {
|
|
|
198
198
|
if (o.length === 1)
|
|
199
199
|
o[0].call(null, n);
|
|
200
200
|
else {
|
|
201
|
-
let r = !1,
|
|
201
|
+
let r = !1, a = null;
|
|
202
202
|
const u = Array.from(o);
|
|
203
203
|
for (let i = 0; i < u.length; i++) {
|
|
204
|
-
const
|
|
204
|
+
const s = u[i];
|
|
205
205
|
try {
|
|
206
|
-
|
|
206
|
+
s.call(null, n);
|
|
207
207
|
} catch (l) {
|
|
208
|
-
|
|
208
|
+
a === null && (r = !0, a = l);
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
if (r)
|
|
212
|
-
throw
|
|
212
|
+
throw a;
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
removeAllListeners() {
|
|
@@ -223,7 +223,7 @@ class Ze {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function P(e, t, n = 0) {
|
|
227
227
|
return Math.abs(I(e) - I(t)) <= n;
|
|
228
228
|
}
|
|
229
229
|
let R = {
|
|
@@ -246,18 +246,18 @@ function C(e) {
|
|
|
246
246
|
...R,
|
|
247
247
|
...t
|
|
248
248
|
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, r) => {
|
|
249
|
-
o.derivedPanelConstraints.forEach((
|
|
250
|
-
if (
|
|
249
|
+
o.derivedPanelConstraints.forEach((a) => {
|
|
250
|
+
if (a.collapsible) {
|
|
251
251
|
const { layout: u } = n.mountedGroups.get(r) ?? {};
|
|
252
252
|
if (u) {
|
|
253
|
-
const i =
|
|
254
|
-
|
|
255
|
-
o.layout[
|
|
256
|
-
),
|
|
257
|
-
|
|
258
|
-
u[
|
|
253
|
+
const i = P(
|
|
254
|
+
a.collapsedSize,
|
|
255
|
+
o.layout[a.panelId]
|
|
256
|
+
), s = P(
|
|
257
|
+
a.collapsedSize,
|
|
258
|
+
u[a.panelId]
|
|
259
259
|
);
|
|
260
|
-
i && !
|
|
260
|
+
i && !s && (r.inMemoryLastExpandedPanelSizes[a.panelId] = u[a.panelId]);
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
});
|
|
@@ -277,9 +277,9 @@ function Qe({
|
|
|
277
277
|
switch (n) {
|
|
278
278
|
case "active":
|
|
279
279
|
case "hover":
|
|
280
|
-
t.forEach((
|
|
281
|
-
if (!
|
|
282
|
-
switch (
|
|
280
|
+
t.forEach((a) => {
|
|
281
|
+
if (!a.disableCursor)
|
|
282
|
+
switch (a.orientation) {
|
|
283
283
|
case "horizontal": {
|
|
284
284
|
o++;
|
|
285
285
|
break;
|
|
@@ -295,15 +295,15 @@ function Qe({
|
|
|
295
295
|
return null;
|
|
296
296
|
switch (n) {
|
|
297
297
|
case "active": {
|
|
298
|
-
const
|
|
298
|
+
const a = (e & Pe) !== 0, u = (e & Ee) !== 0, i = (e & Re) !== 0, s = (e & Ce) !== 0;
|
|
299
299
|
if (e) {
|
|
300
|
-
if (
|
|
301
|
-
return i ? "se-resize" :
|
|
300
|
+
if (a)
|
|
301
|
+
return i ? "se-resize" : s ? "ne-resize" : "e-resize";
|
|
302
302
|
if (u)
|
|
303
|
-
return i ? "sw-resize" :
|
|
303
|
+
return i ? "sw-resize" : s ? "nw-resize" : "w-resize";
|
|
304
304
|
if (i)
|
|
305
305
|
return "s-resize";
|
|
306
|
-
if (
|
|
306
|
+
if (s)
|
|
307
307
|
return "n-resize";
|
|
308
308
|
}
|
|
309
309
|
break;
|
|
@@ -311,7 +311,7 @@ function Qe({
|
|
|
311
311
|
}
|
|
312
312
|
return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
313
313
|
}
|
|
314
|
-
let
|
|
314
|
+
let se, k;
|
|
315
315
|
function le() {
|
|
316
316
|
k === void 0 && (k = new CSSStyleSheet(), document.adoptedStyleSheets = [k]);
|
|
317
317
|
const { cursorFlags: e, interactionState: t } = O();
|
|
@@ -323,13 +323,13 @@ function le() {
|
|
|
323
323
|
groups: t.hitRegions.map((r) => r.group),
|
|
324
324
|
state: t.state
|
|
325
325
|
}), o = `*{cursor: ${n} !important; ${t.state === "active" ? "touch-action: none;" : ""} }`;
|
|
326
|
-
if (
|
|
326
|
+
if (se === o)
|
|
327
327
|
return;
|
|
328
|
-
|
|
328
|
+
se = o, n ? k.cssRules.length === 0 ? k.insertRule(o) : k.replaceSync(o) : k.cssRules.length === 1 && k.deleteRule(0);
|
|
329
329
|
break;
|
|
330
330
|
}
|
|
331
331
|
case "inactive": {
|
|
332
|
-
|
|
332
|
+
se = void 0, k.cssRules.length === 1 && k.deleteRule(0);
|
|
333
333
|
break;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
@@ -343,7 +343,7 @@ function et(e, t) {
|
|
|
343
343
|
return !0;
|
|
344
344
|
}
|
|
345
345
|
function U(e, t) {
|
|
346
|
-
return
|
|
346
|
+
return P(e, t) ? 0 : e > t ? 1 : -1;
|
|
347
347
|
}
|
|
348
348
|
function F({
|
|
349
349
|
panelConstraints: e,
|
|
@@ -353,14 +353,14 @@ function F({
|
|
|
353
353
|
collapsedSize: n = 0,
|
|
354
354
|
collapsible: o,
|
|
355
355
|
maxSize: r = 100,
|
|
356
|
-
minSize:
|
|
356
|
+
minSize: a = 0
|
|
357
357
|
} = e;
|
|
358
|
-
if (U(t,
|
|
358
|
+
if (U(t, a) < 0)
|
|
359
359
|
if (o) {
|
|
360
|
-
const u = (n +
|
|
361
|
-
U(t, u) < 0 ? t = n : t =
|
|
360
|
+
const u = (n + a) / 2;
|
|
361
|
+
U(t, u) < 0 ? t = n : t = a;
|
|
362
362
|
} else
|
|
363
|
-
t =
|
|
363
|
+
t = a;
|
|
364
364
|
return t = Math.min(r, t), t = I(t), t;
|
|
365
365
|
}
|
|
366
366
|
function K({
|
|
@@ -369,14 +369,14 @@ function K({
|
|
|
369
369
|
panelConstraints: n,
|
|
370
370
|
pivotIndices: o,
|
|
371
371
|
prevLayout: r,
|
|
372
|
-
trigger:
|
|
372
|
+
trigger: a
|
|
373
373
|
}) {
|
|
374
|
-
if (
|
|
374
|
+
if (P(e, 0))
|
|
375
375
|
return t;
|
|
376
|
-
const u = Object.values(t), i = Object.values(r),
|
|
376
|
+
const u = Object.values(t), i = Object.values(r), s = [...u], [l, c] = o;
|
|
377
377
|
z(l != null, "Invalid first pivot index"), z(c != null, "Invalid second pivot index");
|
|
378
378
|
let d = 0;
|
|
379
|
-
if (
|
|
379
|
+
if (a === "keyboard") {
|
|
380
380
|
{
|
|
381
381
|
const f = e < 0 ? c : l, p = n[f];
|
|
382
382
|
z(
|
|
@@ -384,18 +384,18 @@ function K({
|
|
|
384
384
|
`Panel constraints not found for index ${f}`
|
|
385
385
|
);
|
|
386
386
|
const {
|
|
387
|
-
collapsedSize:
|
|
388
|
-
collapsible:
|
|
387
|
+
collapsedSize: h = 0,
|
|
388
|
+
collapsible: g,
|
|
389
389
|
minSize: S = 0
|
|
390
390
|
} = p;
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
391
|
+
if (g) {
|
|
392
|
+
const y = u[f];
|
|
393
393
|
if (z(
|
|
394
|
-
|
|
394
|
+
y != null,
|
|
395
395
|
`Previous layout not found for panel index ${f}`
|
|
396
|
-
),
|
|
397
|
-
const
|
|
398
|
-
U(
|
|
396
|
+
), P(y, h)) {
|
|
397
|
+
const v = S - y;
|
|
398
|
+
U(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}
|
|
@@ -406,61 +406,61 @@ function K({
|
|
|
406
406
|
`No panel constraints found for index ${f}`
|
|
407
407
|
);
|
|
408
408
|
const {
|
|
409
|
-
collapsedSize:
|
|
410
|
-
collapsible:
|
|
409
|
+
collapsedSize: h = 0,
|
|
410
|
+
collapsible: g,
|
|
411
411
|
minSize: S = 0
|
|
412
412
|
} = p;
|
|
413
|
-
if (
|
|
414
|
-
const
|
|
413
|
+
if (g) {
|
|
414
|
+
const y = u[f];
|
|
415
415
|
if (z(
|
|
416
|
-
|
|
416
|
+
y != null,
|
|
417
417
|
`Previous layout not found for panel index ${f}`
|
|
418
|
-
),
|
|
419
|
-
const
|
|
420
|
-
U(
|
|
418
|
+
), P(y, S)) {
|
|
419
|
+
const v = y - h;
|
|
420
|
+
U(v, Math.abs(e)) > 0 && (e = e < 0 ? 0 - v : v);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
{
|
|
426
426
|
const f = e < 0 ? 1 : -1;
|
|
427
|
-
let p = e < 0 ? c : l,
|
|
427
|
+
let p = e < 0 ? c : l, h = 0;
|
|
428
428
|
for (; ; ) {
|
|
429
429
|
const S = u[p];
|
|
430
430
|
z(
|
|
431
431
|
S != null,
|
|
432
432
|
`Previous layout not found for panel index ${p}`
|
|
433
433
|
);
|
|
434
|
-
const
|
|
434
|
+
const v = F({
|
|
435
435
|
panelConstraints: n[p],
|
|
436
436
|
size: 100
|
|
437
437
|
}) - S;
|
|
438
|
-
if (
|
|
438
|
+
if (h += v, p += f, p < 0 || p >= n.length)
|
|
439
439
|
break;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
e = e < 0 ? 0 -
|
|
441
|
+
const g = Math.min(Math.abs(e), Math.abs(h));
|
|
442
|
+
e = e < 0 ? 0 - g : g;
|
|
443
443
|
}
|
|
444
444
|
{
|
|
445
445
|
let p = e < 0 ? l : c;
|
|
446
446
|
for (; p >= 0 && p < n.length; ) {
|
|
447
|
-
const
|
|
447
|
+
const h = Math.abs(e) - Math.abs(d), g = u[p];
|
|
448
448
|
z(
|
|
449
|
-
|
|
449
|
+
g != null,
|
|
450
450
|
`Previous layout not found for panel index ${p}`
|
|
451
451
|
);
|
|
452
|
-
const S =
|
|
452
|
+
const S = g - h, y = F({
|
|
453
453
|
panelConstraints: n[p],
|
|
454
454
|
size: S
|
|
455
455
|
});
|
|
456
|
-
if (!
|
|
456
|
+
if (!P(g, y) && (d += g - y, s[p] = y, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
457
457
|
numeric: !0
|
|
458
458
|
}) >= 0))
|
|
459
459
|
break;
|
|
460
460
|
e < 0 ? p-- : p++;
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
if (et(i,
|
|
463
|
+
if (et(i, s))
|
|
464
464
|
return r;
|
|
465
465
|
{
|
|
466
466
|
const f = e < 0 ? c : l, p = u[f];
|
|
@@ -468,36 +468,36 @@ function K({
|
|
|
468
468
|
p != null,
|
|
469
469
|
`Previous layout not found for panel index ${f}`
|
|
470
470
|
);
|
|
471
|
-
const
|
|
471
|
+
const h = p + d, g = F({
|
|
472
472
|
panelConstraints: n[f],
|
|
473
|
-
size:
|
|
473
|
+
size: h
|
|
474
474
|
});
|
|
475
|
-
if (
|
|
476
|
-
let S =
|
|
477
|
-
for (;
|
|
478
|
-
const
|
|
475
|
+
if (s[f] = g, !P(g, h)) {
|
|
476
|
+
let S = h - g, v = e < 0 ? c : l;
|
|
477
|
+
for (; v >= 0 && v < n.length; ) {
|
|
478
|
+
const L = s[v];
|
|
479
479
|
z(
|
|
480
|
-
|
|
481
|
-
`Previous layout not found for panel index ${
|
|
480
|
+
L != null,
|
|
481
|
+
`Previous layout not found for panel index ${v}`
|
|
482
482
|
);
|
|
483
|
-
const
|
|
484
|
-
panelConstraints: n[
|
|
485
|
-
size:
|
|
483
|
+
const w = L + S, E = F({
|
|
484
|
+
panelConstraints: n[v],
|
|
485
|
+
size: w
|
|
486
486
|
});
|
|
487
|
-
if (L
|
|
487
|
+
if (P(L, E) || (S -= E - L, s[v] = E), P(S, 0))
|
|
488
488
|
break;
|
|
489
|
-
e > 0 ?
|
|
489
|
+
e > 0 ? v-- : v++;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
const
|
|
493
|
+
const x = Object.values(s).reduce(
|
|
494
494
|
(f, p) => p + f,
|
|
495
495
|
0
|
|
496
496
|
);
|
|
497
|
-
if (!
|
|
497
|
+
if (!P(x, 100, 0.1))
|
|
498
498
|
return r;
|
|
499
|
-
const
|
|
500
|
-
return
|
|
499
|
+
const m = Object.keys(r);
|
|
500
|
+
return s.reduce((f, p, h) => (f[m[h]] = p, f), {});
|
|
501
501
|
}
|
|
502
502
|
function W(e, t) {
|
|
503
503
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -514,35 +514,35 @@ function Me({
|
|
|
514
514
|
mountedGroups: o,
|
|
515
515
|
pointerDownAtPoint: r
|
|
516
516
|
}) {
|
|
517
|
-
let
|
|
517
|
+
let a = 0;
|
|
518
518
|
const u = new Map(o);
|
|
519
519
|
t.forEach((i) => {
|
|
520
|
-
const { group:
|
|
521
|
-
let
|
|
522
|
-
r ? d === "horizontal" ?
|
|
523
|
-
const f = n.get(
|
|
520
|
+
const { group: s, groupSize: l } = i, { disableCursor: c, orientation: d, panels: x } = s;
|
|
521
|
+
let m = 0;
|
|
522
|
+
r ? d === "horizontal" ? m = (e.clientX - r.x) / l * 100 : m = (e.clientY - r.y) / l * 100 : d === "horizontal" ? m = e.clientX < 0 ? -100 : 100 : m = e.clientY < 0 ? -100 : 100;
|
|
523
|
+
const f = n.get(s), {
|
|
524
524
|
derivedPanelConstraints: p,
|
|
525
|
-
layout:
|
|
526
|
-
separatorToPanels:
|
|
527
|
-
} = o.get(
|
|
528
|
-
if (p && f &&
|
|
525
|
+
layout: h,
|
|
526
|
+
separatorToPanels: g
|
|
527
|
+
} = o.get(s) ?? {};
|
|
528
|
+
if (p && f && h && g) {
|
|
529
529
|
const S = K({
|
|
530
|
-
delta:
|
|
530
|
+
delta: m,
|
|
531
531
|
initialLayout: f,
|
|
532
532
|
panelConstraints: p,
|
|
533
|
-
pivotIndices: i.panels.map((
|
|
534
|
-
prevLayout:
|
|
533
|
+
pivotIndices: i.panels.map((y) => x.indexOf(y)),
|
|
534
|
+
prevLayout: h,
|
|
535
535
|
trigger: "mouse-or-touch"
|
|
536
536
|
});
|
|
537
|
-
if (W(S,
|
|
538
|
-
if (
|
|
537
|
+
if (W(S, h)) {
|
|
538
|
+
if (m !== 0 && !c)
|
|
539
539
|
switch (d) {
|
|
540
540
|
case "horizontal": {
|
|
541
|
-
|
|
541
|
+
a |= m < 0 ? Pe : Ee;
|
|
542
542
|
break;
|
|
543
543
|
}
|
|
544
544
|
case "vertical": {
|
|
545
|
-
|
|
545
|
+
a |= m < 0 ? Re : Ce;
|
|
546
546
|
break;
|
|
547
547
|
}
|
|
548
548
|
}
|
|
@@ -550,14 +550,14 @@ function Me({
|
|
|
550
550
|
u.set(i.group, {
|
|
551
551
|
derivedPanelConstraints: p,
|
|
552
552
|
layout: S,
|
|
553
|
-
separatorToPanels:
|
|
553
|
+
separatorToPanels: g
|
|
554
554
|
});
|
|
555
|
-
const
|
|
556
|
-
i.group.inMemoryLayouts[
|
|
555
|
+
const y = i.group.panels.map(({ id: v }) => v).join(",");
|
|
556
|
+
i.group.inMemoryLayouts[y] = S;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
}), C({
|
|
560
|
-
cursorFlags:
|
|
560
|
+
cursorFlags: a,
|
|
561
561
|
mountedGroups: u
|
|
562
562
|
}), le();
|
|
563
563
|
}
|
|
@@ -595,43 +595,43 @@ function $({
|
|
|
595
595
|
panelConstraints: t
|
|
596
596
|
}) {
|
|
597
597
|
const o = [...Object.values(e)], r = o.reduce(
|
|
598
|
-
(i,
|
|
598
|
+
(i, s) => i + s,
|
|
599
599
|
0
|
|
600
600
|
);
|
|
601
601
|
if (o.length !== t.length)
|
|
602
602
|
throw Error(
|
|
603
603
|
`Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
|
|
604
604
|
);
|
|
605
|
-
if (!
|
|
605
|
+
if (!P(r, 100) && o.length > 0)
|
|
606
606
|
for (let i = 0; i < t.length; i++) {
|
|
607
|
-
const
|
|
608
|
-
z(
|
|
609
|
-
const l = 100 / r *
|
|
607
|
+
const s = o[i];
|
|
608
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
609
|
+
const l = 100 / r * s;
|
|
610
610
|
o[i] = l;
|
|
611
611
|
}
|
|
612
|
-
let
|
|
612
|
+
let a = 0;
|
|
613
613
|
for (let i = 0; i < t.length; i++) {
|
|
614
|
-
const
|
|
615
|
-
z(
|
|
614
|
+
const s = o[i];
|
|
615
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
616
616
|
const l = F({
|
|
617
617
|
panelConstraints: t[i],
|
|
618
|
-
size:
|
|
618
|
+
size: s
|
|
619
619
|
});
|
|
620
|
-
|
|
620
|
+
s != l && (a += s - l, o[i] = l);
|
|
621
621
|
}
|
|
622
|
-
if (!
|
|
622
|
+
if (!P(a, 0))
|
|
623
623
|
for (let i = 0; i < t.length; i++) {
|
|
624
|
-
const
|
|
625
|
-
z(
|
|
626
|
-
const l =
|
|
624
|
+
const s = o[i];
|
|
625
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
626
|
+
const l = s + a, c = F({
|
|
627
627
|
panelConstraints: t[i],
|
|
628
628
|
size: l
|
|
629
629
|
});
|
|
630
|
-
if (
|
|
630
|
+
if (s !== c && (a -= c - s, o[i] = c, P(a, 0)))
|
|
631
631
|
break;
|
|
632
632
|
}
|
|
633
633
|
const u = Object.keys(e);
|
|
634
|
-
return o.reduce((i,
|
|
634
|
+
return o.reduce((i, s, l) => (i[u[l]] = s, i), {});
|
|
635
635
|
}
|
|
636
636
|
function Ge({
|
|
637
637
|
groupId: e
|
|
@@ -652,14 +652,14 @@ function Ge({
|
|
|
652
652
|
const {
|
|
653
653
|
derivedPanelConstraints: o,
|
|
654
654
|
group: r,
|
|
655
|
-
layout:
|
|
655
|
+
layout: a,
|
|
656
656
|
separatorToPanels: u
|
|
657
657
|
} = t(), i = $({
|
|
658
658
|
layout: n,
|
|
659
659
|
panelConstraints: o
|
|
660
660
|
});
|
|
661
|
-
return W(
|
|
662
|
-
mountedGroups: new Map(
|
|
661
|
+
return W(a, i) || C((s) => ({
|
|
662
|
+
mountedGroups: new Map(s.mountedGroups).set(r, {
|
|
663
663
|
derivedPanelConstraints: o,
|
|
664
664
|
layout: i,
|
|
665
665
|
separatorToPanels: u
|
|
@@ -677,20 +677,20 @@ function D(e, t) {
|
|
|
677
677
|
(d) => d.element === e
|
|
678
678
|
);
|
|
679
679
|
z(r, "Matching separator not found");
|
|
680
|
-
const
|
|
681
|
-
z(
|
|
682
|
-
const u =
|
|
680
|
+
const a = o.separatorToPanels.get(r);
|
|
681
|
+
z(a, "Matching panels not found");
|
|
682
|
+
const u = a.map((d) => n.panels.indexOf(d)), s = Ge({ groupId: n.id }).getLayout(), l = K({
|
|
683
683
|
delta: t,
|
|
684
|
-
initialLayout:
|
|
684
|
+
initialLayout: s,
|
|
685
685
|
panelConstraints: o.derivedPanelConstraints,
|
|
686
686
|
pivotIndices: u,
|
|
687
|
-
prevLayout:
|
|
687
|
+
prevLayout: s,
|
|
688
688
|
trigger: "keyboard"
|
|
689
689
|
}), c = $({
|
|
690
690
|
layout: l,
|
|
691
691
|
panelConstraints: o.derivedPanelConstraints
|
|
692
692
|
});
|
|
693
|
-
W(
|
|
693
|
+
W(s, c) || C((d) => ({
|
|
694
694
|
mountedGroups: new Map(d.mountedGroups).set(n, {
|
|
695
695
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
696
696
|
layout: c,
|
|
@@ -726,30 +726,30 @@ function ve(e) {
|
|
|
726
726
|
}
|
|
727
727
|
case "Enter": {
|
|
728
728
|
e.preventDefault();
|
|
729
|
-
const o = te(t), { derivedPanelConstraints: r, layout:
|
|
729
|
+
const o = te(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: u } = Ie(o), i = o.separators.find(
|
|
730
730
|
(d) => d.element === t
|
|
731
731
|
);
|
|
732
732
|
z(i, "Matching separator not found");
|
|
733
|
-
const
|
|
734
|
-
z(
|
|
735
|
-
const l =
|
|
733
|
+
const s = u.get(i);
|
|
734
|
+
z(s, "Matching panels not found");
|
|
735
|
+
const l = s[0], c = r.find(
|
|
736
736
|
(d) => d.panelId === l.id
|
|
737
737
|
);
|
|
738
738
|
if (z(c, "Panel metadata not found"), c.collapsible) {
|
|
739
|
-
const d =
|
|
740
|
-
D(t,
|
|
739
|
+
const d = a[l.id], x = c.collapsedSize === d ? o.inMemoryLastExpandedPanelSizes[l.id] ?? c.minSize : c.collapsedSize;
|
|
740
|
+
D(t, x - d);
|
|
741
741
|
}
|
|
742
742
|
break;
|
|
743
743
|
}
|
|
744
744
|
case "F6": {
|
|
745
745
|
e.preventDefault();
|
|
746
746
|
const r = te(t).separators.map(
|
|
747
|
-
(
|
|
748
|
-
),
|
|
749
|
-
(
|
|
747
|
+
(s) => s.element
|
|
748
|
+
), a = Array.from(r).findIndex(
|
|
749
|
+
(s) => s === e.currentTarget
|
|
750
750
|
);
|
|
751
|
-
z(
|
|
752
|
-
const u = e.shiftKey ?
|
|
751
|
+
z(a !== null, "Index not found");
|
|
752
|
+
const u = e.shiftKey ? a > 0 ? a - 1 : r.length - 1 : a + 1 < r.length ? a + 1 : 0;
|
|
753
753
|
r[u].focus();
|
|
754
754
|
break;
|
|
755
755
|
}
|
|
@@ -776,15 +776,15 @@ function nt(e, t, n) {
|
|
|
776
776
|
x: 1 / 0,
|
|
777
777
|
y: 1 / 0
|
|
778
778
|
};
|
|
779
|
-
for (const
|
|
780
|
-
const u = tt(n,
|
|
779
|
+
for (const a of t) {
|
|
780
|
+
const u = tt(n, a.rect);
|
|
781
781
|
switch (e) {
|
|
782
782
|
case "horizontal": {
|
|
783
|
-
u.x <= r.x && (o =
|
|
783
|
+
u.x <= r.x && (o = a, r = u);
|
|
784
784
|
break;
|
|
785
785
|
}
|
|
786
786
|
case "vertical": {
|
|
787
|
-
u.y <= r.y && (o =
|
|
787
|
+
u.y <= r.y && (o = a, r = u);
|
|
788
788
|
break;
|
|
789
789
|
}
|
|
790
790
|
}
|
|
@@ -803,24 +803,24 @@ function ke(e, t) {
|
|
|
803
803
|
return t.forEach((o, r) => {
|
|
804
804
|
if (r.disabled)
|
|
805
805
|
return;
|
|
806
|
-
const
|
|
806
|
+
const a = ot() ? me.coarse : me.precise, u = we(r), i = nt(r.orientation, u, {
|
|
807
807
|
x: e.clientX,
|
|
808
808
|
y: e.clientY
|
|
809
809
|
});
|
|
810
|
-
i && i.distance.x <=
|
|
810
|
+
i && i.distance.x <= a && i.distance.y <= a && n.push(i.hitRegion);
|
|
811
811
|
}), n;
|
|
812
812
|
}
|
|
813
813
|
function ge(e) {
|
|
814
814
|
if (e.defaultPrevented)
|
|
815
815
|
return;
|
|
816
|
-
const { mountedGroups: t } = O(), n = ke(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(),
|
|
816
|
+
const { mountedGroups: t } = O(), n = ke(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
817
817
|
let i = !1;
|
|
818
|
-
n.forEach((
|
|
819
|
-
o.add(
|
|
818
|
+
n.forEach((s) => {
|
|
819
|
+
o.add(s.group), s.panels.forEach((c) => {
|
|
820
820
|
r.add(c);
|
|
821
|
-
}),
|
|
822
|
-
const l = t.get(
|
|
823
|
-
l && u.set(
|
|
821
|
+
}), s.separator && (a.add(s.separator), i || (i = !0, s.separator.element.focus()));
|
|
822
|
+
const l = t.get(s.group);
|
|
823
|
+
l && u.set(s.group, l.layout);
|
|
824
824
|
}), C({
|
|
825
825
|
interactionState: {
|
|
826
826
|
hitRegions: n,
|
|
@@ -891,18 +891,18 @@ function Se(e) {
|
|
|
891
891
|
function xe(e) {
|
|
892
892
|
let t = 0, n = 0;
|
|
893
893
|
const o = {};
|
|
894
|
-
for (const
|
|
895
|
-
if (
|
|
894
|
+
for (const a of e)
|
|
895
|
+
if (a.defaultSize !== void 0) {
|
|
896
896
|
t++;
|
|
897
|
-
const u = I(
|
|
898
|
-
n += u, o[
|
|
897
|
+
const u = I(a.defaultSize);
|
|
898
|
+
n += u, o[a.panelId] = u;
|
|
899
899
|
} else
|
|
900
|
-
o[
|
|
900
|
+
o[a.panelId] = void 0;
|
|
901
901
|
const r = e.length - t;
|
|
902
902
|
if (r !== 0) {
|
|
903
|
-
const
|
|
903
|
+
const a = I((100 - n) / r);
|
|
904
904
|
for (const u of e)
|
|
905
|
-
u.defaultSize === void 0 && (o[u.panelId] =
|
|
905
|
+
u.defaultSize === void 0 && (o[u.panelId] = a);
|
|
906
906
|
}
|
|
907
907
|
return o;
|
|
908
908
|
}
|
|
@@ -913,50 +913,50 @@ function it(e, t, n) {
|
|
|
913
913
|
const r = e.panels.find((u) => u.element === t);
|
|
914
914
|
if (!r || !r.onResize)
|
|
915
915
|
return;
|
|
916
|
-
const
|
|
916
|
+
const a = H({ group: e });
|
|
917
917
|
r.onResize(
|
|
918
918
|
{
|
|
919
919
|
asPercentage: I(
|
|
920
|
-
o.inlineSize /
|
|
920
|
+
o.inlineSize / a * 100
|
|
921
921
|
),
|
|
922
922
|
inPixels: o.inlineSize
|
|
923
923
|
},
|
|
924
924
|
r.id
|
|
925
925
|
);
|
|
926
926
|
}
|
|
927
|
-
function
|
|
927
|
+
function st(e) {
|
|
928
928
|
let t = !0;
|
|
929
929
|
z(
|
|
930
930
|
e.separators.length === 0 || e.separators.length < e.panels.length,
|
|
931
931
|
"Invalid Group configuration; too many Separator components"
|
|
932
932
|
);
|
|
933
933
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((m) => {
|
|
934
|
-
for (const
|
|
935
|
-
const { borderBoxSize:
|
|
936
|
-
if (
|
|
934
|
+
for (const f of m) {
|
|
935
|
+
const { borderBoxSize: p, target: h } = f;
|
|
936
|
+
if (h === e.element) {
|
|
937
937
|
if (t) {
|
|
938
938
|
if (H({ group: e }) === 0)
|
|
939
939
|
return;
|
|
940
|
-
C((
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
layout:
|
|
945
|
-
panelConstraints:
|
|
940
|
+
C((S) => {
|
|
941
|
+
const y = S.mountedGroups.get(e);
|
|
942
|
+
if (y) {
|
|
943
|
+
const v = pe(e), L = y.defaultLayoutDeferred ? xe(v) : y.layout, w = $({
|
|
944
|
+
layout: L,
|
|
945
|
+
panelConstraints: v
|
|
946
946
|
});
|
|
947
|
-
return !
|
|
948
|
-
mountedGroups: new Map(
|
|
949
|
-
derivedPanelConstraints:
|
|
947
|
+
return !y.defaultLayoutDeferred && W(L, w) ? S : {
|
|
948
|
+
mountedGroups: new Map(S.mountedGroups).set(e, {
|
|
949
|
+
derivedPanelConstraints: v,
|
|
950
950
|
layout: w,
|
|
951
|
-
separatorToPanels:
|
|
951
|
+
separatorToPanels: y.separatorToPanels
|
|
952
952
|
})
|
|
953
953
|
};
|
|
954
954
|
}
|
|
955
|
-
return
|
|
955
|
+
return S;
|
|
956
956
|
});
|
|
957
957
|
}
|
|
958
958
|
} else
|
|
959
|
-
it(e,
|
|
959
|
+
it(e, h, p);
|
|
960
960
|
}
|
|
961
961
|
});
|
|
962
962
|
r.observe(e.element), e.panels.forEach((m) => {
|
|
@@ -965,16 +965,19 @@ function rt(e) {
|
|
|
965
965
|
`Panel ids must be unique; id "${m.id}" was used more than once`
|
|
966
966
|
), n.add(m.id), m.onResize && r.observe(m.element);
|
|
967
967
|
});
|
|
968
|
-
const
|
|
969
|
-
|
|
968
|
+
const a = H({ group: e }), u = pe(e), i = e.panels.map(({ id: m }) => m).join(",");
|
|
969
|
+
let s = e.defaultLayout;
|
|
970
|
+
s && e.panels.length !== Object.keys(s).length && (s = void 0);
|
|
971
|
+
const l = e.inMemoryLayouts[i] ?? s ?? xe(u), c = $({
|
|
972
|
+
layout: l,
|
|
970
973
|
panelConstraints: u
|
|
971
|
-
}),
|
|
974
|
+
}), d = we(e), x = C((m) => ({
|
|
972
975
|
mountedGroups: new Map(m.mountedGroups).set(e, {
|
|
973
|
-
defaultLayoutDeferred:
|
|
976
|
+
defaultLayoutDeferred: a === 0,
|
|
974
977
|
derivedPanelConstraints: u,
|
|
975
|
-
layout:
|
|
978
|
+
layout: c,
|
|
976
979
|
separatorToPanels: new Map(
|
|
977
|
-
|
|
980
|
+
d.filter((f) => f.separator).map((f) => [f.separator, f.panels])
|
|
978
981
|
)
|
|
979
982
|
})
|
|
980
983
|
}));
|
|
@@ -983,15 +986,15 @@ function rt(e) {
|
|
|
983
986
|
!o.has(m.id),
|
|
984
987
|
`Separator ids must be unique; id "${m.id}" was used more than once`
|
|
985
988
|
), o.add(m.id), m.element.addEventListener("keydown", ve);
|
|
986
|
-
}),
|
|
989
|
+
}), x.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ge), window.addEventListener("pointermove", ye), window.addEventListener("pointerup", Se)), function() {
|
|
987
990
|
t = !1;
|
|
988
|
-
const
|
|
989
|
-
const
|
|
990
|
-
return
|
|
991
|
+
const f = C((p) => {
|
|
992
|
+
const h = new Map(p.mountedGroups);
|
|
993
|
+
return h.delete(e), { mountedGroups: h };
|
|
991
994
|
});
|
|
992
|
-
e.element.removeEventListener("pointerleave", he), e.separators.forEach((
|
|
993
|
-
|
|
994
|
-
}),
|
|
995
|
+
e.element.removeEventListener("pointerleave", he), e.separators.forEach((p) => {
|
|
996
|
+
p.element.removeEventListener("keydown", ve);
|
|
997
|
+
}), f.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ge), window.removeEventListener("pointermove", ye), window.removeEventListener("pointerup", Se)), r.disconnect();
|
|
995
998
|
};
|
|
996
999
|
}
|
|
997
1000
|
function ue(e) {
|
|
@@ -1028,7 +1031,7 @@ function Te(e, t) {
|
|
|
1028
1031
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1029
1032
|
}
|
|
1030
1033
|
const De = He(null);
|
|
1031
|
-
function
|
|
1034
|
+
function rt(e, t) {
|
|
1032
1035
|
const n = T({
|
|
1033
1036
|
getLayout: () => ({}),
|
|
1034
1037
|
setLayout: Je
|
|
@@ -1046,27 +1049,27 @@ function ht({
|
|
|
1046
1049
|
defaultLayout: n,
|
|
1047
1050
|
disableCursor: o,
|
|
1048
1051
|
disabled: r,
|
|
1049
|
-
elementRef:
|
|
1052
|
+
elementRef: a,
|
|
1050
1053
|
groupRef: u,
|
|
1051
1054
|
id: i,
|
|
1052
|
-
onLayoutChange:
|
|
1055
|
+
onLayoutChange: s,
|
|
1053
1056
|
orientation: l = "horizontal",
|
|
1054
1057
|
style: c,
|
|
1055
1058
|
...d
|
|
1056
1059
|
}) {
|
|
1057
|
-
const
|
|
1058
|
-
W(
|
|
1059
|
-
}), f = ue(i), [p,
|
|
1060
|
-
|
|
1061
|
-
const q =
|
|
1060
|
+
const x = T({}), m = ce((b) => {
|
|
1061
|
+
W(x.current, b) || (x.current = b, s?.(b));
|
|
1062
|
+
}), f = ue(i), [p, h] = G(!1), [g, S] = G(null), [y, v] = G(n ?? {}), [L, w] = G([]), [E, V] = G([]), ne = T({}), X = T({}), Y = fe(S, a);
|
|
1063
|
+
rt(f, u);
|
|
1064
|
+
const q = Le(
|
|
1062
1065
|
() => ({
|
|
1063
1066
|
id: f,
|
|
1064
1067
|
orientation: l,
|
|
1065
|
-
registerPanel: (b) => (
|
|
1066
|
-
|
|
1068
|
+
registerPanel: (b) => (w((M) => re(l, [...M, b])), () => {
|
|
1069
|
+
w((M) => M.filter((N) => N !== b));
|
|
1067
1070
|
}),
|
|
1068
1071
|
registerSeparator: (b) => (V(
|
|
1069
|
-
(M) =>
|
|
1072
|
+
(M) => re(l, [...M, b])
|
|
1070
1073
|
), () => {
|
|
1071
1074
|
V(
|
|
1072
1075
|
(M) => M.filter((N) => N !== b)
|
|
@@ -1076,27 +1079,27 @@ function ht({
|
|
|
1076
1079
|
[f, l]
|
|
1077
1080
|
);
|
|
1078
1081
|
j(() => {
|
|
1079
|
-
if (
|
|
1082
|
+
if (g === null || L.length === 0)
|
|
1080
1083
|
return;
|
|
1081
1084
|
const b = {
|
|
1082
1085
|
defaultLayout: n,
|
|
1083
1086
|
disableCursor: !!o,
|
|
1084
1087
|
disabled: !!r,
|
|
1085
|
-
element:
|
|
1088
|
+
element: g,
|
|
1086
1089
|
id: f,
|
|
1087
1090
|
inMemoryLastExpandedPanelSizes: ne.current,
|
|
1088
1091
|
inMemoryLayouts: X.current,
|
|
1089
1092
|
orientation: l,
|
|
1090
|
-
panels:
|
|
1093
|
+
panels: L,
|
|
1091
1094
|
separators: E
|
|
1092
|
-
}, M =
|
|
1093
|
-
oe && (
|
|
1095
|
+
}, M = st(b), oe = O().mountedGroups.get(b);
|
|
1096
|
+
oe && (v(oe.layout), m?.(oe.layout));
|
|
1094
1097
|
const Ae = A.addListener(
|
|
1095
1098
|
"interactionStateChange",
|
|
1096
1099
|
(J) => {
|
|
1097
1100
|
switch (J.state) {
|
|
1098
1101
|
case "active": {
|
|
1099
|
-
|
|
1102
|
+
h(
|
|
1100
1103
|
J.hitRegions.some(
|
|
1101
1104
|
(_) => _.group === b
|
|
1102
1105
|
)
|
|
@@ -1104,7 +1107,7 @@ function ht({
|
|
|
1104
1107
|
break;
|
|
1105
1108
|
}
|
|
1106
1109
|
default: {
|
|
1107
|
-
|
|
1110
|
+
h(!1);
|
|
1108
1111
|
break;
|
|
1109
1112
|
}
|
|
1110
1113
|
}
|
|
@@ -1113,7 +1116,7 @@ function ht({
|
|
|
1113
1116
|
"mountedGroupsChange",
|
|
1114
1117
|
(J) => {
|
|
1115
1118
|
const _ = J.get(b);
|
|
1116
|
-
_ && _.derivedPanelConstraints.length > 0 && (
|
|
1119
|
+
_ && _.derivedPanelConstraints.length > 0 && (v(_.layout), m?.(_.layout));
|
|
1117
1120
|
}
|
|
1118
1121
|
);
|
|
1119
1122
|
return () => {
|
|
@@ -1123,18 +1126,18 @@ function ht({
|
|
|
1123
1126
|
n,
|
|
1124
1127
|
o,
|
|
1125
1128
|
r,
|
|
1126
|
-
|
|
1129
|
+
g,
|
|
1127
1130
|
f,
|
|
1128
|
-
|
|
1131
|
+
m,
|
|
1129
1132
|
l,
|
|
1130
|
-
|
|
1133
|
+
L,
|
|
1131
1134
|
E
|
|
1132
1135
|
]);
|
|
1133
1136
|
const Z = {
|
|
1134
1137
|
[Oe]: p ? "none" : void 0
|
|
1135
1138
|
};
|
|
1136
|
-
for (const b in
|
|
1137
|
-
const M = Te(f, b), N =
|
|
1139
|
+
for (const b in y) {
|
|
1140
|
+
const M = Te(f, b), N = y[b];
|
|
1138
1141
|
Z[M] = N;
|
|
1139
1142
|
}
|
|
1140
1143
|
return /* @__PURE__ */ B(De.Provider, { value: q, children: /* @__PURE__ */ B(
|
|
@@ -1181,13 +1184,13 @@ function vt({
|
|
|
1181
1184
|
lt,
|
|
1182
1185
|
() => t.getItem(ae(e)),
|
|
1183
1186
|
() => t.getItem(ae(e))
|
|
1184
|
-
), o =
|
|
1187
|
+
), o = Le(
|
|
1185
1188
|
() => n ? JSON.parse(n) : void 0,
|
|
1186
1189
|
[n]
|
|
1187
1190
|
), r = ze(
|
|
1188
|
-
(
|
|
1191
|
+
(a) => at({
|
|
1189
1192
|
id: e,
|
|
1190
|
-
layout:
|
|
1193
|
+
layout: a,
|
|
1191
1194
|
storage: t
|
|
1192
1195
|
}),
|
|
1193
1196
|
[e, t]
|
|
@@ -1221,79 +1224,79 @@ function ut({
|
|
|
1221
1224
|
const n = () => {
|
|
1222
1225
|
const { mountedGroups: i } = O();
|
|
1223
1226
|
for (const [
|
|
1224
|
-
|
|
1227
|
+
s,
|
|
1225
1228
|
{ derivedPanelConstraints: l, layout: c, separatorToPanels: d }
|
|
1226
1229
|
] of i)
|
|
1227
|
-
if (
|
|
1228
|
-
return { derivedPanelConstraints: l, group:
|
|
1230
|
+
if (s.id === e)
|
|
1231
|
+
return { derivedPanelConstraints: l, group: s, layout: c, separatorToPanels: d };
|
|
1229
1232
|
throw Error(`Group ${e} not found`);
|
|
1230
1233
|
}, o = () => {
|
|
1231
1234
|
const i = n().derivedPanelConstraints.find(
|
|
1232
|
-
(
|
|
1235
|
+
(s) => s.panelId === t
|
|
1233
1236
|
);
|
|
1234
1237
|
if (i !== void 0)
|
|
1235
1238
|
return i;
|
|
1236
1239
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1237
1240
|
}, r = () => {
|
|
1238
|
-
const i = n().group.panels.find((
|
|
1241
|
+
const i = n().group.panels.find((s) => s.id === t);
|
|
1239
1242
|
if (i !== void 0)
|
|
1240
1243
|
return i;
|
|
1241
1244
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1242
|
-
},
|
|
1245
|
+
}, a = () => {
|
|
1243
1246
|
const i = n().layout[t];
|
|
1244
1247
|
if (i !== void 0)
|
|
1245
1248
|
return i;
|
|
1246
1249
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1247
1250
|
}, u = (i) => {
|
|
1248
|
-
const
|
|
1249
|
-
if (i ===
|
|
1251
|
+
const s = a();
|
|
1252
|
+
if (i === s)
|
|
1250
1253
|
return;
|
|
1251
1254
|
const {
|
|
1252
1255
|
derivedPanelConstraints: l,
|
|
1253
1256
|
group: c,
|
|
1254
1257
|
layout: d,
|
|
1255
|
-
separatorToPanels:
|
|
1256
|
-
} = n(),
|
|
1257
|
-
delta: f ?
|
|
1258
|
+
separatorToPanels: x
|
|
1259
|
+
} = n(), m = c.panels.findIndex((g) => g.id === t), f = m === c.panels.length - 1, p = K({
|
|
1260
|
+
delta: f ? s - i : i - s,
|
|
1258
1261
|
initialLayout: d,
|
|
1259
1262
|
panelConstraints: l,
|
|
1260
|
-
pivotIndices: f ? [
|
|
1263
|
+
pivotIndices: f ? [m - 1, m] : [m, m + 1],
|
|
1261
1264
|
prevLayout: d,
|
|
1262
1265
|
trigger: "imperative-api"
|
|
1263
|
-
}),
|
|
1266
|
+
}), h = $({
|
|
1264
1267
|
layout: p,
|
|
1265
1268
|
panelConstraints: l
|
|
1266
1269
|
});
|
|
1267
|
-
W(d,
|
|
1268
|
-
mountedGroups: new Map(
|
|
1270
|
+
W(d, h) || C((g) => ({
|
|
1271
|
+
mountedGroups: new Map(g.mountedGroups).set(c, {
|
|
1269
1272
|
derivedPanelConstraints: l,
|
|
1270
|
-
layout:
|
|
1271
|
-
separatorToPanels:
|
|
1273
|
+
layout: h,
|
|
1274
|
+
separatorToPanels: x
|
|
1272
1275
|
})
|
|
1273
1276
|
}));
|
|
1274
1277
|
};
|
|
1275
1278
|
return {
|
|
1276
1279
|
collapse: () => {
|
|
1277
|
-
const { collapsible: i, collapsedSize:
|
|
1278
|
-
i && l !==
|
|
1280
|
+
const { collapsible: i, collapsedSize: s } = o(), l = a();
|
|
1281
|
+
i && l !== s && u(s);
|
|
1279
1282
|
},
|
|
1280
1283
|
expand: () => {
|
|
1281
|
-
const { collapsible: i, collapsedSize:
|
|
1282
|
-
i && c ===
|
|
1284
|
+
const { collapsible: i, collapsedSize: s, minSize: l } = o(), c = a();
|
|
1285
|
+
i && c === s && u(l);
|
|
1283
1286
|
},
|
|
1284
1287
|
getSize: () => {
|
|
1285
|
-
const { group: i } = n(),
|
|
1288
|
+
const { group: i } = n(), s = a(), { element: l } = r(), c = i.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
1286
1289
|
return {
|
|
1287
|
-
asPercentage:
|
|
1290
|
+
asPercentage: s,
|
|
1288
1291
|
inPixels: c
|
|
1289
1292
|
};
|
|
1290
1293
|
},
|
|
1291
1294
|
isCollapsed: () => {
|
|
1292
|
-
const { collapsible: i, collapsedSize:
|
|
1293
|
-
return i &&
|
|
1295
|
+
const { collapsible: i, collapsedSize: s } = o(), l = a();
|
|
1296
|
+
return i && P(s, l);
|
|
1294
1297
|
},
|
|
1295
1298
|
resize: (i) => {
|
|
1296
|
-
if (
|
|
1299
|
+
if (a() !== i) {
|
|
1297
1300
|
let l;
|
|
1298
1301
|
switch (typeof i) {
|
|
1299
1302
|
case "number": {
|
|
@@ -1335,31 +1338,31 @@ function St({
|
|
|
1335
1338
|
collapsedSize: n = "0%",
|
|
1336
1339
|
collapsible: o = !1,
|
|
1337
1340
|
defaultSize: r,
|
|
1338
|
-
elementRef:
|
|
1341
|
+
elementRef: a,
|
|
1339
1342
|
id: u,
|
|
1340
1343
|
maxSize: i = "100%",
|
|
1341
|
-
minSize:
|
|
1344
|
+
minSize: s = "0%",
|
|
1342
1345
|
onResize: l,
|
|
1343
1346
|
panelRef: c,
|
|
1344
1347
|
style: d,
|
|
1345
|
-
...
|
|
1348
|
+
...x
|
|
1346
1349
|
}) {
|
|
1347
|
-
const
|
|
1350
|
+
const m = !!u, f = ue(u), [p, h] = G(null), g = fe(h, a), { id: S, registerPanel: y } = de(), v = l !== null, L = ce((E) => {
|
|
1348
1351
|
l?.(E, u);
|
|
1349
1352
|
});
|
|
1350
1353
|
j(() => {
|
|
1351
1354
|
if (p !== null)
|
|
1352
|
-
return
|
|
1355
|
+
return y({
|
|
1353
1356
|
element: p,
|
|
1354
1357
|
id: f,
|
|
1355
|
-
idIsStable:
|
|
1356
|
-
onResize:
|
|
1358
|
+
idIsStable: m,
|
|
1359
|
+
onResize: v ? L : void 0,
|
|
1357
1360
|
panelConstraints: {
|
|
1358
1361
|
collapsedSize: n,
|
|
1359
1362
|
collapsible: o,
|
|
1360
1363
|
defaultSize: r,
|
|
1361
1364
|
maxSize: i,
|
|
1362
|
-
minSize:
|
|
1365
|
+
minSize: s
|
|
1363
1366
|
}
|
|
1364
1367
|
});
|
|
1365
1368
|
}, [
|
|
@@ -1367,27 +1370,27 @@ function St({
|
|
|
1367
1370
|
o,
|
|
1368
1371
|
r,
|
|
1369
1372
|
p,
|
|
1370
|
-
g,
|
|
1371
|
-
f,
|
|
1372
1373
|
v,
|
|
1374
|
+
f,
|
|
1375
|
+
m,
|
|
1373
1376
|
i,
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
+
s,
|
|
1378
|
+
L,
|
|
1379
|
+
y
|
|
1377
1380
|
]), ct(f, c);
|
|
1378
|
-
const
|
|
1381
|
+
const w = Te(S, f);
|
|
1379
1382
|
return /* @__PURE__ */ B(
|
|
1380
1383
|
"div",
|
|
1381
1384
|
{
|
|
1382
|
-
...
|
|
1385
|
+
...x,
|
|
1383
1386
|
"data-panel": !0,
|
|
1384
1387
|
"data-testid": f,
|
|
1385
1388
|
id: f,
|
|
1386
|
-
ref:
|
|
1389
|
+
ref: g,
|
|
1387
1390
|
style: {
|
|
1388
1391
|
...ft,
|
|
1389
1392
|
flexBasis: 0,
|
|
1390
|
-
flexGrow: `var(${
|
|
1393
|
+
flexGrow: `var(${w}, 1)`,
|
|
1391
1394
|
flexShrink: 1,
|
|
1392
1395
|
// Prevent Panel content from interfering with panel size
|
|
1393
1396
|
overflow: "hidden",
|
|
@@ -1438,13 +1441,13 @@ function dt({
|
|
|
1438
1441
|
panelId: n,
|
|
1439
1442
|
panelIndex: o
|
|
1440
1443
|
}) {
|
|
1441
|
-
let r,
|
|
1444
|
+
let r, a;
|
|
1442
1445
|
const u = e[n], i = t.find(
|
|
1443
|
-
(
|
|
1446
|
+
(s) => s.panelId === n
|
|
1444
1447
|
);
|
|
1445
1448
|
if (i) {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1449
|
+
const s = i.maxSize, l = a = i.collapsible ? i.collapsedSize : i.minSize, c = [o, o + 1];
|
|
1450
|
+
a = $({
|
|
1448
1451
|
layout: K({
|
|
1449
1452
|
delta: l - u,
|
|
1450
1453
|
initialLayout: e,
|
|
@@ -1456,7 +1459,7 @@ function dt({
|
|
|
1456
1459
|
panelConstraints: t
|
|
1457
1460
|
})[n], r = $({
|
|
1458
1461
|
layout: K({
|
|
1459
|
-
delta:
|
|
1462
|
+
delta: s - u,
|
|
1460
1463
|
initialLayout: e,
|
|
1461
1464
|
panelConstraints: t,
|
|
1462
1465
|
pivotIndices: c,
|
|
@@ -1469,7 +1472,7 @@ function dt({
|
|
|
1469
1472
|
return {
|
|
1470
1473
|
valueControls: n,
|
|
1471
1474
|
valueMax: r,
|
|
1472
|
-
valueMin:
|
|
1475
|
+
valueMin: a,
|
|
1473
1476
|
valueNow: u
|
|
1474
1477
|
};
|
|
1475
1478
|
}
|
|
@@ -1479,37 +1482,37 @@ function bt({
|
|
|
1479
1482
|
elementRef: n,
|
|
1480
1483
|
id: o,
|
|
1481
1484
|
style: r,
|
|
1482
|
-
...
|
|
1485
|
+
...a
|
|
1483
1486
|
}) {
|
|
1484
|
-
const u = ue(o), [i,
|
|
1487
|
+
const u = ue(o), [i, s] = G({}), [l, c] = G("inactive"), [d, x] = G(null), m = fe(x, n), {
|
|
1485
1488
|
id: f,
|
|
1486
1489
|
orientation: p,
|
|
1487
|
-
registerSeparator:
|
|
1488
|
-
} = de(),
|
|
1490
|
+
registerSeparator: h
|
|
1491
|
+
} = de(), g = p === "horizontal" ? "vertical" : "horizontal";
|
|
1489
1492
|
return j(() => {
|
|
1490
1493
|
if (d !== null) {
|
|
1491
1494
|
const S = {
|
|
1492
1495
|
element: d,
|
|
1493
1496
|
id: u
|
|
1494
|
-
},
|
|
1497
|
+
}, y = h(S), v = A.addListener(
|
|
1495
1498
|
"interactionStateChange",
|
|
1496
|
-
(
|
|
1499
|
+
(w) => {
|
|
1497
1500
|
c(
|
|
1498
|
-
|
|
1501
|
+
w.state !== "inactive" && w.hitRegions.some(
|
|
1499
1502
|
(E) => E.separator === S
|
|
1500
|
-
) ?
|
|
1503
|
+
) ? w.state : "inactive"
|
|
1501
1504
|
);
|
|
1502
1505
|
}
|
|
1503
|
-
),
|
|
1506
|
+
), L = A.addListener(
|
|
1504
1507
|
"mountedGroupsChange",
|
|
1505
|
-
(
|
|
1506
|
-
|
|
1508
|
+
(w) => {
|
|
1509
|
+
w.forEach(
|
|
1507
1510
|
({ derivedPanelConstraints: E, layout: V, separatorToPanels: ne }, X) => {
|
|
1508
1511
|
if (X.id === f) {
|
|
1509
1512
|
const Y = ne.get(S);
|
|
1510
1513
|
if (Y) {
|
|
1511
1514
|
const q = Y[0], Z = X.panels.indexOf(q);
|
|
1512
|
-
|
|
1515
|
+
s(
|
|
1513
1516
|
dt({
|
|
1514
1517
|
layout: V,
|
|
1515
1518
|
panelConstraints: E,
|
|
@@ -1524,15 +1527,15 @@ function bt({
|
|
|
1524
1527
|
}
|
|
1525
1528
|
);
|
|
1526
1529
|
return () => {
|
|
1527
|
-
|
|
1530
|
+
v(), L(), y();
|
|
1528
1531
|
};
|
|
1529
1532
|
}
|
|
1530
|
-
}, [d, f, u,
|
|
1533
|
+
}, [d, f, u, h]), /* @__PURE__ */ B(
|
|
1531
1534
|
"div",
|
|
1532
1535
|
{
|
|
1533
|
-
...
|
|
1536
|
+
...a,
|
|
1534
1537
|
"aria-controls": i.valueControls,
|
|
1535
|
-
"aria-orientation":
|
|
1538
|
+
"aria-orientation": g,
|
|
1536
1539
|
"aria-valuemax": i.valueMax,
|
|
1537
1540
|
"aria-valuemin": i.valueMin,
|
|
1538
1541
|
"aria-valuenow": i.valueNow,
|
|
@@ -1541,7 +1544,7 @@ function bt({
|
|
|
1541
1544
|
"data-separator": l,
|
|
1542
1545
|
"data-testid": u,
|
|
1543
1546
|
id: u,
|
|
1544
|
-
ref:
|
|
1547
|
+
ref: m,
|
|
1545
1548
|
role: "separator",
|
|
1546
1549
|
style: {
|
|
1547
1550
|
flexBasis: "auto",
|