react-resizable-panels 4.0.8-alpha.2 → 4.0.9-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as B } from "react/jsx-runtime";
|
|
3
|
-
import { useId as
|
|
4
|
-
function
|
|
3
|
+
import { useId as We, useLayoutEffect as je, useEffect as Be, useRef as T, useCallback as Le, createContext as Ue, useImperativeHandle as Pe, useState as I, useMemo as Ce, useSyncExternalStore as Ve, useContext as Ke } from "react";
|
|
4
|
+
function x(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
7
7
|
}
|
|
@@ -13,73 +13,73 @@ function H({
|
|
|
13
13
|
}
|
|
14
14
|
function se(e, t) {
|
|
15
15
|
return t.sort(
|
|
16
|
-
e === "horizontal" ?
|
|
16
|
+
e === "horizontal" ? Xe : Ye
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Xe(e, t) {
|
|
20
20
|
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
21
21
|
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Ye(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 Re(e) {
|
|
28
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, a = se(
|
|
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(), z = 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
|
+
z.top,
|
|
48
|
+
z.left - d.right,
|
|
49
|
+
z.height
|
|
50
50
|
) : new DOMRect(
|
|
51
|
-
|
|
51
|
+
z.left,
|
|
52
52
|
d.bottom,
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
z.width,
|
|
54
|
+
z.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
|
+
(z) => z.element === l
|
|
62
62
|
);
|
|
63
|
-
d ?
|
|
63
|
+
d ? s = d : (i = void 0, s = void 0);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
return u;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function qe(e, t) {
|
|
69
69
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
70
70
|
return t * o;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function Ze(e, t) {
|
|
73
73
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
74
74
|
return t * o;
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function Je(e) {
|
|
77
77
|
return e / 100 * window.innerHeight;
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function Qe(e) {
|
|
80
80
|
return e / 100 * window.innerWidth;
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function et(e) {
|
|
83
83
|
switch (typeof e) {
|
|
84
84
|
case "number":
|
|
85
85
|
return [e, "px"];
|
|
@@ -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] = et(n);
|
|
99
|
+
switch (a) {
|
|
100
100
|
case "%": {
|
|
101
101
|
o = r / 100 * e;
|
|
102
102
|
break;
|
|
@@ -106,25 +106,25 @@ function Q({
|
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
108
108
|
case "rem": {
|
|
109
|
-
o =
|
|
109
|
+
o = Ze(t, r);
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case "em": {
|
|
113
|
-
o =
|
|
113
|
+
o = qe(t, r);
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
116
|
case "vh": {
|
|
117
|
-
o =
|
|
117
|
+
o = Je(r);
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
case "vw": {
|
|
121
|
-
o =
|
|
121
|
+
o = Qe(r);
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
return o;
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function G(e) {
|
|
128
128
|
return parseFloat(e.toFixed(3));
|
|
129
129
|
}
|
|
130
130
|
function pe(e) {
|
|
@@ -137,54 +137,54 @@ 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
|
-
u =
|
|
148
|
+
u = G(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
|
-
i =
|
|
157
|
+
i = G(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 = G(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
|
-
l =
|
|
175
|
+
l = G(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
|
};
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
class
|
|
187
|
+
class tt {
|
|
188
188
|
#e = {};
|
|
189
189
|
addListener(t, n) {
|
|
190
190
|
const o = this.#e[t];
|
|
@@ -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,8 +223,8 @@ class Ze {
|
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
function
|
|
227
|
-
return Math.abs(
|
|
226
|
+
function P(e, t, n = 0) {
|
|
227
|
+
return Math.abs(G(e) - G(t)) <= n;
|
|
228
228
|
}
|
|
229
229
|
let R = {
|
|
230
230
|
cursorFlags: 0,
|
|
@@ -233,11 +233,11 @@ let R = {
|
|
|
233
233
|
},
|
|
234
234
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
235
235
|
};
|
|
236
|
-
const
|
|
236
|
+
const D = new tt();
|
|
237
237
|
function O() {
|
|
238
238
|
return R;
|
|
239
239
|
}
|
|
240
|
-
function
|
|
240
|
+
function E(e) {
|
|
241
241
|
const t = typeof e == "function" ? e(R) : e;
|
|
242
242
|
if (R === t)
|
|
243
243
|
return R;
|
|
@@ -245,30 +245,30 @@ function C(e) {
|
|
|
245
245
|
return R = {
|
|
246
246
|
...R,
|
|
247
247
|
...t
|
|
248
|
-
}, t.cursorFlags !== void 0 &&
|
|
249
|
-
o.derivedPanelConstraints.forEach((
|
|
250
|
-
if (
|
|
248
|
+
}, t.cursorFlags !== void 0 && D.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && D.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, r) => {
|
|
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
|
});
|
|
264
|
-
}),
|
|
264
|
+
}), D.emit("mountedGroupsChange", R.mountedGroups)), R;
|
|
265
265
|
}
|
|
266
|
-
const
|
|
267
|
-
},
|
|
266
|
+
const nt = (e) => e, ie = () => {
|
|
267
|
+
}, Ee = 1, Me = 2, Ie = 4, Ge = 8, me = {
|
|
268
268
|
coarse: 10,
|
|
269
269
|
precise: 5
|
|
270
270
|
};
|
|
271
|
-
function
|
|
271
|
+
function ot({
|
|
272
272
|
cursorFlags: e,
|
|
273
273
|
groups: t,
|
|
274
274
|
state: n
|
|
@@ -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 & Ee) !== 0, u = (e & Me) !== 0, i = (e & Ie) !== 0, s = (e & Ge) !== 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;
|
|
@@ -318,7 +318,7 @@ function le() {
|
|
|
318
318
|
switch (t.state) {
|
|
319
319
|
case "active":
|
|
320
320
|
case "hover": {
|
|
321
|
-
const n =
|
|
321
|
+
const n = ot({
|
|
322
322
|
cursorFlags: e,
|
|
323
323
|
groups: t.hitRegions.map((r) => r.group),
|
|
324
324
|
state: t.state
|
|
@@ -334,7 +334,7 @@ function le() {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
function
|
|
337
|
+
function it(e, t) {
|
|
338
338
|
if (e.length !== t.length)
|
|
339
339
|
return !1;
|
|
340
340
|
for (let n = 0; n < e.length; n++)
|
|
@@ -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,70 +353,70 @@ 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 =
|
|
364
|
-
return t = Math.min(r, t), t =
|
|
363
|
+
t = a;
|
|
364
|
+
return t = Math.min(r, t), t = G(t), t;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function V({
|
|
367
367
|
delta: e,
|
|
368
368
|
initialLayout: t,
|
|
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),
|
|
377
|
-
|
|
376
|
+
const u = Object.values(t), i = Object.values(r), s = [...u], [l, c] = o;
|
|
377
|
+
x(l != null, "Invalid first pivot index"), x(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
|
+
x(
|
|
383
383
|
p,
|
|
384
384
|
`Panel constraints not found for index ${f}`
|
|
385
385
|
);
|
|
386
386
|
const {
|
|
387
|
-
collapsedSize:
|
|
388
|
-
collapsible:
|
|
387
|
+
collapsedSize: h = 0,
|
|
388
|
+
collapsible: y,
|
|
389
389
|
minSize: S = 0
|
|
390
390
|
} = p;
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
393
|
-
if (
|
|
394
|
-
|
|
391
|
+
if (y) {
|
|
392
|
+
const v = u[f];
|
|
393
|
+
if (x(
|
|
394
|
+
v != null,
|
|
395
395
|
`Previous layout not found for panel index ${f}`
|
|
396
|
-
),
|
|
397
|
-
const g = S -
|
|
396
|
+
), P(v, h)) {
|
|
397
|
+
const g = S - v;
|
|
398
398
|
U(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
399
399
|
}
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
{
|
|
403
403
|
const f = e < 0 ? l : c, p = n[f];
|
|
404
|
-
|
|
404
|
+
x(
|
|
405
405
|
p,
|
|
406
406
|
`No panel constraints found for index ${f}`
|
|
407
407
|
);
|
|
408
408
|
const {
|
|
409
|
-
collapsedSize:
|
|
410
|
-
collapsible:
|
|
409
|
+
collapsedSize: h = 0,
|
|
410
|
+
collapsible: y,
|
|
411
411
|
minSize: S = 0
|
|
412
412
|
} = p;
|
|
413
|
-
if (
|
|
414
|
-
const
|
|
415
|
-
if (
|
|
416
|
-
|
|
413
|
+
if (y) {
|
|
414
|
+
const v = u[f];
|
|
415
|
+
if (x(
|
|
416
|
+
v != null,
|
|
417
417
|
`Previous layout not found for panel index ${f}`
|
|
418
|
-
),
|
|
419
|
-
const g =
|
|
418
|
+
), P(v, S)) {
|
|
419
|
+
const g = v - h;
|
|
420
420
|
U(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
421
421
|
}
|
|
422
422
|
}
|
|
@@ -424,10 +424,10 @@ function K({
|
|
|
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
|
+
x(
|
|
431
431
|
S != null,
|
|
432
432
|
`Previous layout not found for panel index ${p}`
|
|
433
433
|
);
|
|
@@ -435,69 +435,69 @@ function K({
|
|
|
435
435
|
panelConstraints: n[p],
|
|
436
436
|
size: 100
|
|
437
437
|
}) - S;
|
|
438
|
-
if (
|
|
438
|
+
if (h += g, p += f, p < 0 || p >= n.length)
|
|
439
439
|
break;
|
|
440
440
|
}
|
|
441
|
-
const
|
|
442
|
-
e = e < 0 ? 0 -
|
|
441
|
+
const y = Math.min(Math.abs(e), Math.abs(h));
|
|
442
|
+
e = e < 0 ? 0 - y : y;
|
|
443
443
|
}
|
|
444
444
|
{
|
|
445
445
|
let p = e < 0 ? l : c;
|
|
446
446
|
for (; p >= 0 && p < n.length; ) {
|
|
447
|
-
const
|
|
448
|
-
|
|
449
|
-
|
|
447
|
+
const h = Math.abs(e) - Math.abs(d), y = u[p];
|
|
448
|
+
x(
|
|
449
|
+
y != null,
|
|
450
450
|
`Previous layout not found for panel index ${p}`
|
|
451
451
|
);
|
|
452
|
-
const S =
|
|
452
|
+
const S = y - h, v = F({
|
|
453
453
|
panelConstraints: n[p],
|
|
454
454
|
size: S
|
|
455
455
|
});
|
|
456
|
-
if (!
|
|
456
|
+
if (!P(y, v) && (d += y - v, s[p] = v, 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 (
|
|
463
|
+
if (it(i, s))
|
|
464
464
|
return r;
|
|
465
465
|
{
|
|
466
466
|
const f = e < 0 ? c : l, p = u[f];
|
|
467
|
-
|
|
467
|
+
x(
|
|
468
468
|
p != null,
|
|
469
469
|
`Previous layout not found for panel index ${f}`
|
|
470
470
|
);
|
|
471
|
-
const
|
|
471
|
+
const h = p + d, y = F({
|
|
472
472
|
panelConstraints: n[f],
|
|
473
|
-
size:
|
|
473
|
+
size: h
|
|
474
474
|
});
|
|
475
|
-
if (
|
|
476
|
-
let S =
|
|
475
|
+
if (s[f] = y, !P(y, h)) {
|
|
476
|
+
let S = h - y, g = e < 0 ? c : l;
|
|
477
477
|
for (; g >= 0 && g < n.length; ) {
|
|
478
|
-
const w =
|
|
479
|
-
|
|
478
|
+
const w = s[g];
|
|
479
|
+
x(
|
|
480
480
|
w != null,
|
|
481
481
|
`Previous layout not found for panel index ${g}`
|
|
482
482
|
);
|
|
483
|
-
const
|
|
483
|
+
const L = w + S, C = F({
|
|
484
484
|
panelConstraints: n[g],
|
|
485
|
-
size:
|
|
485
|
+
size: L
|
|
486
486
|
});
|
|
487
|
-
if (
|
|
487
|
+
if (P(w, C) || (S -= C - w, s[g] = C), P(S, 0))
|
|
488
488
|
break;
|
|
489
489
|
e > 0 ? g-- : g++;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
const
|
|
493
|
+
const z = Object.values(s).reduce(
|
|
494
494
|
(f, p) => p + f,
|
|
495
495
|
0
|
|
496
496
|
);
|
|
497
|
-
if (!
|
|
497
|
+
if (!P(z, 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)
|
|
@@ -507,42 +507,42 @@ function W(e, t) {
|
|
|
507
507
|
return !1;
|
|
508
508
|
return !0;
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function ke({
|
|
511
511
|
event: e,
|
|
512
512
|
hitRegions: t,
|
|
513
513
|
initialLayoutMap: n,
|
|
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: z } = 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 &&
|
|
529
|
-
const S =
|
|
530
|
-
delta:
|
|
525
|
+
layout: h,
|
|
526
|
+
separatorToPanels: y
|
|
527
|
+
} = o.get(s) ?? {};
|
|
528
|
+
if (p && f && h && y) {
|
|
529
|
+
const S = V({
|
|
530
|
+
delta: m,
|
|
531
531
|
initialLayout: f,
|
|
532
532
|
panelConstraints: p,
|
|
533
|
-
pivotIndices: i.panels.map((
|
|
534
|
-
prevLayout:
|
|
533
|
+
pivotIndices: i.panels.map((v) => z.indexOf(v)),
|
|
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 ? Ee : Me;
|
|
542
542
|
break;
|
|
543
543
|
}
|
|
544
544
|
case "vertical": {
|
|
545
|
-
|
|
545
|
+
a |= m < 0 ? Ie : Ge;
|
|
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: y
|
|
554
554
|
});
|
|
555
|
-
const
|
|
556
|
-
i.group.inMemoryLayouts[
|
|
555
|
+
const v = i.group.panels.map(({ id: g }) => g).join(",");
|
|
556
|
+
i.group.inMemoryLayouts[v] = S;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
|
-
}),
|
|
560
|
-
cursorFlags:
|
|
559
|
+
}), E({
|
|
560
|
+
cursorFlags: a,
|
|
561
561
|
mountedGroups: u
|
|
562
562
|
}), le();
|
|
563
563
|
}
|
|
@@ -572,7 +572,7 @@ function he(e) {
|
|
|
572
572
|
switch (t.state) {
|
|
573
573
|
case "active":
|
|
574
574
|
t.hitRegions.forEach((o) => {
|
|
575
|
-
e.currentTarget === o.group.element &&
|
|
575
|
+
e.currentTarget === o.group.element && ke({
|
|
576
576
|
event: e,
|
|
577
577
|
hitRegions: t.hitRegions,
|
|
578
578
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -583,57 +583,57 @@ function he(e) {
|
|
|
583
583
|
}
|
|
584
584
|
function te(e) {
|
|
585
585
|
const t = e.parentElement;
|
|
586
|
-
|
|
586
|
+
x(t, "Parent group element not found");
|
|
587
587
|
const { mountedGroups: n } = O();
|
|
588
588
|
for (const [o] of n)
|
|
589
589
|
if (o.element === t)
|
|
590
590
|
return o;
|
|
591
591
|
throw Error("Could not find parent Group for separator element");
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function A({
|
|
594
594
|
layout: e,
|
|
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
|
-
|
|
609
|
-
const l = 100 / r *
|
|
607
|
+
const s = o[i];
|
|
608
|
+
x(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
|
-
|
|
614
|
+
const s = o[i];
|
|
615
|
+
x(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
|
-
|
|
626
|
-
const l =
|
|
624
|
+
const s = o[i];
|
|
625
|
+
x(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
|
-
function
|
|
636
|
+
function Oe({
|
|
637
637
|
groupId: e
|
|
638
638
|
}) {
|
|
639
639
|
const t = () => {
|
|
@@ -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
|
-
} = t(), i =
|
|
657
|
+
} = t(), i = A({
|
|
658
658
|
layout: n,
|
|
659
659
|
panelConstraints: o
|
|
660
660
|
});
|
|
661
|
-
return W(
|
|
662
|
-
mountedGroups: new Map(
|
|
661
|
+
return W(a, i) || E((s) => ({
|
|
662
|
+
mountedGroups: new Map(s.mountedGroups).set(r, {
|
|
663
663
|
derivedPanelConstraints: o,
|
|
664
664
|
layout: i,
|
|
665
665
|
separatorToPanels: u
|
|
@@ -668,29 +668,29 @@ function Ge({
|
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function Te(e) {
|
|
672
672
|
const { mountedGroups: t } = O(), n = t.get(e);
|
|
673
|
-
return
|
|
673
|
+
return x(n, `Mounted Group ${e.id} not found`), n;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
const n = te(e), o =
|
|
675
|
+
function _(e, t) {
|
|
676
|
+
const n = te(e), o = Te(n), r = n.separators.find(
|
|
677
677
|
(d) => d.element === e
|
|
678
678
|
);
|
|
679
|
-
|
|
680
|
-
const
|
|
681
|
-
|
|
682
|
-
const u =
|
|
679
|
+
x(r, "Matching separator not found");
|
|
680
|
+
const a = o.separatorToPanels.get(r);
|
|
681
|
+
x(a, "Matching panels not found");
|
|
682
|
+
const u = a.map((d) => n.panels.indexOf(d)), s = Oe({ groupId: n.id }).getLayout(), l = V({
|
|
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
|
-
}), c =
|
|
689
|
+
}), c = A({
|
|
690
690
|
layout: l,
|
|
691
691
|
panelConstraints: o.derivedPanelConstraints
|
|
692
692
|
});
|
|
693
|
-
W(
|
|
693
|
+
W(s, c) || E((d) => ({
|
|
694
694
|
mountedGroups: new Map(d.mountedGroups).set(n, {
|
|
695
695
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
696
696
|
layout: c,
|
|
@@ -698,68 +698,68 @@ function D(e, t) {
|
|
|
698
698
|
})
|
|
699
699
|
}));
|
|
700
700
|
}
|
|
701
|
-
function
|
|
701
|
+
function ge(e) {
|
|
702
702
|
if (e.defaultPrevented)
|
|
703
703
|
return;
|
|
704
704
|
const t = e.currentTarget, n = te(t);
|
|
705
705
|
if (!n.disabled)
|
|
706
706
|
switch (e.key) {
|
|
707
707
|
case "ArrowDown": {
|
|
708
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
708
|
+
e.preventDefault(), n.orientation === "vertical" && _(t, 5);
|
|
709
709
|
break;
|
|
710
710
|
}
|
|
711
711
|
case "ArrowLeft": {
|
|
712
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
712
|
+
e.preventDefault(), n.orientation === "horizontal" && _(t, -5);
|
|
713
713
|
break;
|
|
714
714
|
}
|
|
715
715
|
case "ArrowRight": {
|
|
716
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
716
|
+
e.preventDefault(), n.orientation === "horizontal" && _(t, 5);
|
|
717
717
|
break;
|
|
718
718
|
}
|
|
719
719
|
case "ArrowUp": {
|
|
720
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
720
|
+
e.preventDefault(), n.orientation === "vertical" && _(t, -5);
|
|
721
721
|
break;
|
|
722
722
|
}
|
|
723
723
|
case "End": {
|
|
724
|
-
e.preventDefault(),
|
|
724
|
+
e.preventDefault(), _(t, 100);
|
|
725
725
|
break;
|
|
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 } = Te(o), i = o.separators.find(
|
|
730
730
|
(d) => d.element === t
|
|
731
731
|
);
|
|
732
|
-
|
|
733
|
-
const
|
|
734
|
-
|
|
735
|
-
const l =
|
|
732
|
+
x(i, "Matching separator not found");
|
|
733
|
+
const s = u.get(i);
|
|
734
|
+
x(s, "Matching panels not found");
|
|
735
|
+
const l = s[0], c = r.find(
|
|
736
736
|
(d) => d.panelId === l.id
|
|
737
737
|
);
|
|
738
|
-
if (
|
|
739
|
-
const d =
|
|
740
|
-
|
|
738
|
+
if (x(c, "Panel metadata not found"), c.collapsible) {
|
|
739
|
+
const d = a[l.id], z = c.collapsedSize === d ? o.inMemoryLastExpandedPanelSizes[l.id] ?? c.minSize : c.collapsedSize;
|
|
740
|
+
_(t, z - 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
|
-
|
|
752
|
-
const u = e.shiftKey ?
|
|
751
|
+
x(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
|
}
|
|
756
756
|
case "Home": {
|
|
757
|
-
e.preventDefault(),
|
|
757
|
+
e.preventDefault(), _(t, -100);
|
|
758
758
|
break;
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function rt(e, t) {
|
|
763
763
|
return {
|
|
764
764
|
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
765
765
|
Math.abs(e.x - t.left),
|
|
@@ -771,20 +771,20 @@ function tt(e, t) {
|
|
|
771
771
|
)
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function st(e, t, n) {
|
|
775
775
|
let o, r = {
|
|
776
776
|
x: 1 / 0,
|
|
777
777
|
y: 1 / 0
|
|
778
778
|
};
|
|
779
|
-
for (const
|
|
780
|
-
const u =
|
|
779
|
+
for (const a of t) {
|
|
780
|
+
const u = rt(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
|
}
|
|
@@ -795,33 +795,120 @@ function nt(e, t, n) {
|
|
|
795
795
|
} : void 0;
|
|
796
796
|
}
|
|
797
797
|
let ee;
|
|
798
|
-
function
|
|
798
|
+
function at() {
|
|
799
799
|
return ee === void 0 && (typeof matchMedia == "function" ? ee = !!matchMedia("(pointer:coarse)").matches : ee = !1), ee;
|
|
800
800
|
}
|
|
801
|
-
function
|
|
801
|
+
function lt(e, t) {
|
|
802
|
+
if (e === t) throw new Error("Cannot compare node with itself");
|
|
803
|
+
const n = {
|
|
804
|
+
a: Se(e),
|
|
805
|
+
b: Se(t)
|
|
806
|
+
};
|
|
807
|
+
let o;
|
|
808
|
+
for (; n.a.at(-1) === n.b.at(-1); )
|
|
809
|
+
e = n.a.pop(), t = n.b.pop(), o = e;
|
|
810
|
+
x(
|
|
811
|
+
o,
|
|
812
|
+
"Stacking order can only be calculated for elements with a common ancestor"
|
|
813
|
+
);
|
|
814
|
+
const r = {
|
|
815
|
+
a: ve(ye(n.a)),
|
|
816
|
+
b: ve(ye(n.b))
|
|
817
|
+
};
|
|
818
|
+
if (r.a === r.b) {
|
|
819
|
+
const a = o.childNodes, u = {
|
|
820
|
+
a: n.a.at(-1),
|
|
821
|
+
b: n.b.at(-1)
|
|
822
|
+
};
|
|
823
|
+
let i = a.length;
|
|
824
|
+
for (; i--; ) {
|
|
825
|
+
const s = a[i];
|
|
826
|
+
if (s === u.a) return 1;
|
|
827
|
+
if (s === u.b) return -1;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
return Math.sign(r.a - r.b);
|
|
831
|
+
}
|
|
832
|
+
const ut = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
833
|
+
function ct(e) {
|
|
834
|
+
const t = getComputedStyle(_e(e) ?? e).display;
|
|
835
|
+
return t === "flex" || t === "inline-flex";
|
|
836
|
+
}
|
|
837
|
+
function ft(e) {
|
|
838
|
+
const t = getComputedStyle(e);
|
|
839
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ct(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || ut.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
840
|
+
}
|
|
841
|
+
function ye(e) {
|
|
842
|
+
let t = e.length;
|
|
843
|
+
for (; t--; ) {
|
|
844
|
+
const n = e[t];
|
|
845
|
+
if (x(n, "Missing node"), ft(n)) return n;
|
|
846
|
+
}
|
|
847
|
+
return null;
|
|
848
|
+
}
|
|
849
|
+
function ve(e) {
|
|
850
|
+
return e && Number(getComputedStyle(e).zIndex) || 0;
|
|
851
|
+
}
|
|
852
|
+
function Se(e) {
|
|
853
|
+
const t = [];
|
|
854
|
+
for (; e; )
|
|
855
|
+
t.push(e), e = _e(e);
|
|
856
|
+
return t;
|
|
857
|
+
}
|
|
858
|
+
function _e(e) {
|
|
859
|
+
const { parentNode: t } = e;
|
|
860
|
+
return t && t instanceof ShadowRoot ? t.host : t;
|
|
861
|
+
}
|
|
862
|
+
function dt(e, t) {
|
|
863
|
+
return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
|
|
864
|
+
}
|
|
865
|
+
function pt({
|
|
866
|
+
groupElement: e,
|
|
867
|
+
hitRegion: t,
|
|
868
|
+
pointerEventTarget: n
|
|
869
|
+
}) {
|
|
870
|
+
if (!(n instanceof HTMLElement) || n.contains(e) || e.contains(n))
|
|
871
|
+
return !0;
|
|
872
|
+
if (lt(n, e) > 0) {
|
|
873
|
+
let o = n;
|
|
874
|
+
for (; o; ) {
|
|
875
|
+
if (o.contains(e))
|
|
876
|
+
return !0;
|
|
877
|
+
if (dt(o.getBoundingClientRect(), t))
|
|
878
|
+
return !1;
|
|
879
|
+
o = o.parentElement;
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
return !0;
|
|
883
|
+
}
|
|
884
|
+
function De(e, t) {
|
|
802
885
|
const n = [];
|
|
803
886
|
return t.forEach((o, r) => {
|
|
804
887
|
if (r.disabled)
|
|
805
888
|
return;
|
|
806
|
-
const
|
|
889
|
+
const a = at() ? me.coarse : me.precise, u = Re(r), i = st(r.orientation, u, {
|
|
807
890
|
x: e.clientX,
|
|
808
891
|
y: e.clientY
|
|
809
892
|
});
|
|
810
|
-
i && i.distance.x <=
|
|
893
|
+
i && i.distance.x <= a && i.distance.y <= a && pt({
|
|
894
|
+
groupElement: r.element,
|
|
895
|
+
hitRegion: i.hitRegion.rect,
|
|
896
|
+
pointerEventTarget: e.target
|
|
897
|
+
}) && n.push(i.hitRegion);
|
|
811
898
|
}), n;
|
|
812
899
|
}
|
|
813
|
-
function
|
|
900
|
+
function xe(e) {
|
|
814
901
|
if (e.defaultPrevented)
|
|
815
902
|
return;
|
|
816
|
-
const { mountedGroups: t } = O(), n =
|
|
903
|
+
const { mountedGroups: t } = O(), n = De(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Map();
|
|
817
904
|
let i = !1;
|
|
818
|
-
n.forEach((
|
|
819
|
-
o.add(
|
|
905
|
+
n.forEach((s) => {
|
|
906
|
+
o.add(s.group), s.panels.forEach((c) => {
|
|
820
907
|
r.add(c);
|
|
821
|
-
}),
|
|
822
|
-
const l = t.get(
|
|
823
|
-
l && u.set(
|
|
824
|
-
}),
|
|
908
|
+
}), s.separator && (a.add(s.separator), i || (i = !0, s.separator.element.focus()));
|
|
909
|
+
const l = t.get(s.group);
|
|
910
|
+
l && u.set(s.group, l.layout);
|
|
911
|
+
}), E({
|
|
825
912
|
interactionState: {
|
|
826
913
|
hitRegions: n,
|
|
827
914
|
initialLayoutMap: u,
|
|
@@ -830,7 +917,7 @@ function ge(e) {
|
|
|
830
917
|
}
|
|
831
918
|
}), n.length && e.preventDefault();
|
|
832
919
|
}
|
|
833
|
-
function
|
|
920
|
+
function ze(e) {
|
|
834
921
|
if (e.defaultPrevented)
|
|
835
922
|
return;
|
|
836
923
|
const { interactionState: t, mountedGroups: n } = O();
|
|
@@ -840,7 +927,7 @@ function ye(e) {
|
|
|
840
927
|
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
841
928
|
e.type !== "pointerleave" && e.buttons === 0
|
|
842
929
|
) {
|
|
843
|
-
|
|
930
|
+
E(
|
|
844
931
|
(o) => o.interactionState.state === "inactive" ? o : {
|
|
845
932
|
cursorFlags: 0,
|
|
846
933
|
interactionState: {
|
|
@@ -850,7 +937,7 @@ function ye(e) {
|
|
|
850
937
|
);
|
|
851
938
|
return;
|
|
852
939
|
}
|
|
853
|
-
|
|
940
|
+
ke({
|
|
854
941
|
event: e,
|
|
855
942
|
hitRegions: t.hitRegions,
|
|
856
943
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -860,10 +947,10 @@ function ye(e) {
|
|
|
860
947
|
break;
|
|
861
948
|
}
|
|
862
949
|
default: {
|
|
863
|
-
const o =
|
|
864
|
-
o.length === 0 ? t.state !== "inactive" &&
|
|
950
|
+
const o = De(e, n);
|
|
951
|
+
o.length === 0 ? t.state !== "inactive" && E({
|
|
865
952
|
interactionState: { state: "inactive" }
|
|
866
|
-
}) :
|
|
953
|
+
}) : E({
|
|
867
954
|
interactionState: {
|
|
868
955
|
hitRegions: o,
|
|
869
956
|
state: "hover"
|
|
@@ -873,14 +960,14 @@ function ye(e) {
|
|
|
873
960
|
}
|
|
874
961
|
}
|
|
875
962
|
}
|
|
876
|
-
function
|
|
963
|
+
function be(e) {
|
|
877
964
|
if (e.defaultPrevented)
|
|
878
965
|
return;
|
|
879
966
|
e.preventDefault();
|
|
880
967
|
const { interactionState: t } = O();
|
|
881
968
|
switch (t.state) {
|
|
882
969
|
case "active":
|
|
883
|
-
|
|
970
|
+
E({
|
|
884
971
|
cursorFlags: 0,
|
|
885
972
|
interactionState: {
|
|
886
973
|
state: "inactive"
|
|
@@ -888,122 +975,125 @@ function Se(e) {
|
|
|
888
975
|
}), le();
|
|
889
976
|
}
|
|
890
977
|
}
|
|
891
|
-
function
|
|
978
|
+
function we(e) {
|
|
892
979
|
let t = 0, n = 0;
|
|
893
980
|
const o = {};
|
|
894
|
-
for (const
|
|
895
|
-
if (
|
|
981
|
+
for (const a of e)
|
|
982
|
+
if (a.defaultSize !== void 0) {
|
|
896
983
|
t++;
|
|
897
|
-
const u =
|
|
898
|
-
n += u, o[
|
|
984
|
+
const u = G(a.defaultSize);
|
|
985
|
+
n += u, o[a.panelId] = u;
|
|
899
986
|
} else
|
|
900
|
-
o[
|
|
987
|
+
o[a.panelId] = void 0;
|
|
901
988
|
const r = e.length - t;
|
|
902
989
|
if (r !== 0) {
|
|
903
|
-
const
|
|
990
|
+
const a = G((100 - n) / r);
|
|
904
991
|
for (const u of e)
|
|
905
|
-
u.defaultSize === void 0 && (o[u.panelId] =
|
|
992
|
+
u.defaultSize === void 0 && (o[u.panelId] = a);
|
|
906
993
|
}
|
|
907
994
|
return o;
|
|
908
995
|
}
|
|
909
|
-
function
|
|
996
|
+
function mt(e, t, n) {
|
|
910
997
|
const o = n[0];
|
|
911
998
|
if (!o)
|
|
912
999
|
return;
|
|
913
1000
|
const r = e.panels.find((u) => u.element === t);
|
|
914
1001
|
if (!r || !r.onResize)
|
|
915
1002
|
return;
|
|
916
|
-
const
|
|
1003
|
+
const a = H({ group: e });
|
|
917
1004
|
r.onResize(
|
|
918
1005
|
{
|
|
919
|
-
asPercentage:
|
|
920
|
-
o.inlineSize /
|
|
1006
|
+
asPercentage: G(
|
|
1007
|
+
o.inlineSize / a * 100
|
|
921
1008
|
),
|
|
922
1009
|
inPixels: o.inlineSize
|
|
923
1010
|
},
|
|
924
1011
|
r.id
|
|
925
1012
|
);
|
|
926
1013
|
}
|
|
927
|
-
function
|
|
1014
|
+
function ht(e) {
|
|
928
1015
|
let t = !0;
|
|
929
|
-
|
|
1016
|
+
x(
|
|
930
1017
|
e.separators.length === 0 || e.separators.length < e.panels.length,
|
|
931
1018
|
"Invalid Group configuration; too many Separator components"
|
|
932
1019
|
);
|
|
933
1020
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((m) => {
|
|
934
|
-
for (const
|
|
935
|
-
const { borderBoxSize:
|
|
936
|
-
if (
|
|
1021
|
+
for (const f of m) {
|
|
1022
|
+
const { borderBoxSize: p, target: h } = f;
|
|
1023
|
+
if (h === e.element) {
|
|
937
1024
|
if (t) {
|
|
938
1025
|
if (H({ group: e }) === 0)
|
|
939
1026
|
return;
|
|
940
|
-
|
|
941
|
-
const
|
|
942
|
-
if (
|
|
943
|
-
const
|
|
944
|
-
layout:
|
|
945
|
-
panelConstraints:
|
|
1027
|
+
E((S) => {
|
|
1028
|
+
const v = S.mountedGroups.get(e);
|
|
1029
|
+
if (v) {
|
|
1030
|
+
const g = pe(e), w = v.defaultLayoutDeferred ? we(g) : v.layout, L = A({
|
|
1031
|
+
layout: w,
|
|
1032
|
+
panelConstraints: g
|
|
946
1033
|
});
|
|
947
|
-
return !
|
|
948
|
-
mountedGroups: new Map(
|
|
949
|
-
derivedPanelConstraints:
|
|
950
|
-
layout:
|
|
951
|
-
separatorToPanels:
|
|
1034
|
+
return !v.defaultLayoutDeferred && W(w, L) ? S : {
|
|
1035
|
+
mountedGroups: new Map(S.mountedGroups).set(e, {
|
|
1036
|
+
derivedPanelConstraints: g,
|
|
1037
|
+
layout: L,
|
|
1038
|
+
separatorToPanels: v.separatorToPanels
|
|
952
1039
|
})
|
|
953
1040
|
};
|
|
954
1041
|
}
|
|
955
|
-
return
|
|
1042
|
+
return S;
|
|
956
1043
|
});
|
|
957
1044
|
}
|
|
958
1045
|
} else
|
|
959
|
-
|
|
1046
|
+
mt(e, h, p);
|
|
960
1047
|
}
|
|
961
1048
|
});
|
|
962
1049
|
r.observe(e.element), e.panels.forEach((m) => {
|
|
963
|
-
|
|
1050
|
+
x(
|
|
964
1051
|
!n.has(m.id),
|
|
965
1052
|
`Panel ids must be unique; id "${m.id}" was used more than once`
|
|
966
1053
|
), n.add(m.id), m.onResize && r.observe(m.element);
|
|
967
1054
|
});
|
|
968
|
-
const
|
|
969
|
-
|
|
1055
|
+
const a = H({ group: e }), u = pe(e), i = e.panels.map(({ id: m }) => m).join(",");
|
|
1056
|
+
let s = e.defaultLayout;
|
|
1057
|
+
s && e.panels.length !== Object.keys(s).length && (s = void 0);
|
|
1058
|
+
const l = e.inMemoryLayouts[i] ?? s ?? we(u), c = A({
|
|
1059
|
+
layout: l,
|
|
970
1060
|
panelConstraints: u
|
|
971
|
-
}),
|
|
1061
|
+
}), d = Re(e), z = E((m) => ({
|
|
972
1062
|
mountedGroups: new Map(m.mountedGroups).set(e, {
|
|
973
|
-
defaultLayoutDeferred:
|
|
1063
|
+
defaultLayoutDeferred: a === 0,
|
|
974
1064
|
derivedPanelConstraints: u,
|
|
975
|
-
layout:
|
|
1065
|
+
layout: c,
|
|
976
1066
|
separatorToPanels: new Map(
|
|
977
|
-
|
|
1067
|
+
d.filter((f) => f.separator).map((f) => [f.separator, f.panels])
|
|
978
1068
|
)
|
|
979
1069
|
})
|
|
980
1070
|
}));
|
|
981
1071
|
return e.element.addEventListener("pointerleave", he), e.separators.forEach((m) => {
|
|
982
|
-
|
|
1072
|
+
x(
|
|
983
1073
|
!o.has(m.id),
|
|
984
1074
|
`Separator ids must be unique; id "${m.id}" was used more than once`
|
|
985
|
-
), o.add(m.id), m.element.addEventListener("keydown",
|
|
986
|
-
}),
|
|
1075
|
+
), o.add(m.id), m.element.addEventListener("keydown", ge);
|
|
1076
|
+
}), z.mountedGroups.size === 1 && (window.addEventListener("pointerdown", xe), window.addEventListener("pointermove", ze), window.addEventListener("pointerup", be)), function() {
|
|
987
1077
|
t = !1;
|
|
988
|
-
const
|
|
989
|
-
const
|
|
990
|
-
return
|
|
1078
|
+
const f = E((p) => {
|
|
1079
|
+
const h = new Map(p.mountedGroups);
|
|
1080
|
+
return h.delete(e), { mountedGroups: h };
|
|
991
1081
|
});
|
|
992
|
-
e.element.removeEventListener("pointerleave", he), e.separators.forEach((
|
|
993
|
-
|
|
994
|
-
}),
|
|
1082
|
+
e.element.removeEventListener("pointerleave", he), e.separators.forEach((p) => {
|
|
1083
|
+
p.element.removeEventListener("keydown", ge);
|
|
1084
|
+
}), f.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", xe), window.removeEventListener("pointermove", ze), window.removeEventListener("pointerup", be)), r.disconnect();
|
|
995
1085
|
};
|
|
996
1086
|
}
|
|
997
1087
|
function ue(e) {
|
|
998
|
-
const t =
|
|
1088
|
+
const t = We();
|
|
999
1089
|
return `${e ?? t}`;
|
|
1000
1090
|
}
|
|
1001
|
-
const j = typeof window < "u" ?
|
|
1091
|
+
const j = typeof window < "u" ? je : Be;
|
|
1002
1092
|
function ce(e) {
|
|
1003
1093
|
const t = T(e);
|
|
1004
1094
|
return j(() => {
|
|
1005
1095
|
t.current = e;
|
|
1006
|
-
}, [e]),
|
|
1096
|
+
}, [e]), Le((n) => t.current?.(n), [t]);
|
|
1007
1097
|
}
|
|
1008
1098
|
function fe(...e) {
|
|
1009
1099
|
return ce((t) => {
|
|
@@ -1022,53 +1112,53 @@ function fe(...e) {
|
|
|
1022
1112
|
});
|
|
1023
1113
|
});
|
|
1024
1114
|
}
|
|
1025
|
-
const
|
|
1026
|
-
function
|
|
1115
|
+
const Ae = "--react-resizable-panels--panel--pointer-events";
|
|
1116
|
+
function Ne(e, t) {
|
|
1027
1117
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1028
1118
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1029
1119
|
}
|
|
1030
|
-
const
|
|
1031
|
-
function
|
|
1120
|
+
const $e = Ue(null);
|
|
1121
|
+
function gt(e, t) {
|
|
1032
1122
|
const n = T({
|
|
1033
1123
|
getLayout: () => ({}),
|
|
1034
|
-
setLayout:
|
|
1124
|
+
setLayout: nt
|
|
1035
1125
|
});
|
|
1036
|
-
|
|
1126
|
+
Pe(t, () => n.current, []), j(() => {
|
|
1037
1127
|
Object.assign(
|
|
1038
1128
|
n.current,
|
|
1039
|
-
|
|
1129
|
+
Oe({ groupId: e })
|
|
1040
1130
|
);
|
|
1041
1131
|
});
|
|
1042
1132
|
}
|
|
1043
|
-
function
|
|
1133
|
+
function Pt({
|
|
1044
1134
|
children: e,
|
|
1045
1135
|
className: t,
|
|
1046
1136
|
defaultLayout: n,
|
|
1047
1137
|
disableCursor: o,
|
|
1048
1138
|
disabled: r,
|
|
1049
|
-
elementRef:
|
|
1139
|
+
elementRef: a,
|
|
1050
1140
|
groupRef: u,
|
|
1051
1141
|
id: i,
|
|
1052
|
-
onLayoutChange:
|
|
1142
|
+
onLayoutChange: s,
|
|
1053
1143
|
orientation: l = "horizontal",
|
|
1054
1144
|
style: c,
|
|
1055
1145
|
...d
|
|
1056
1146
|
}) {
|
|
1057
|
-
const
|
|
1058
|
-
W(
|
|
1059
|
-
}), f = ue(i), [p,
|
|
1060
|
-
|
|
1061
|
-
const q =
|
|
1147
|
+
const z = T({}), m = ce((b) => {
|
|
1148
|
+
W(z.current, b) || (z.current = b, s?.(b));
|
|
1149
|
+
}), f = ue(i), [p, h] = I(!1), [y, S] = I(null), [v, g] = I(n ?? {}), [w, L] = I([]), [C, K] = I([]), ne = T({}), X = T({}), Y = fe(S, a);
|
|
1150
|
+
gt(f, u);
|
|
1151
|
+
const q = Ce(
|
|
1062
1152
|
() => ({
|
|
1063
1153
|
id: f,
|
|
1064
1154
|
orientation: l,
|
|
1065
|
-
registerPanel: (b) => (
|
|
1066
|
-
|
|
1155
|
+
registerPanel: (b) => (L((M) => se(l, [...M, b])), () => {
|
|
1156
|
+
L((M) => M.filter((N) => N !== b));
|
|
1067
1157
|
}),
|
|
1068
|
-
registerSeparator: (b) => (
|
|
1158
|
+
registerSeparator: (b) => (K(
|
|
1069
1159
|
(M) => se(l, [...M, b])
|
|
1070
1160
|
), () => {
|
|
1071
|
-
|
|
1161
|
+
K(
|
|
1072
1162
|
(M) => M.filter((N) => N !== b)
|
|
1073
1163
|
);
|
|
1074
1164
|
})
|
|
@@ -1076,68 +1166,68 @@ function ht({
|
|
|
1076
1166
|
[f, l]
|
|
1077
1167
|
);
|
|
1078
1168
|
j(() => {
|
|
1079
|
-
if (
|
|
1169
|
+
if (y === null || w.length === 0)
|
|
1080
1170
|
return;
|
|
1081
1171
|
const b = {
|
|
1082
1172
|
defaultLayout: n,
|
|
1083
1173
|
disableCursor: !!o,
|
|
1084
1174
|
disabled: !!r,
|
|
1085
|
-
element:
|
|
1175
|
+
element: y,
|
|
1086
1176
|
id: f,
|
|
1087
1177
|
inMemoryLastExpandedPanelSizes: ne.current,
|
|
1088
1178
|
inMemoryLayouts: X.current,
|
|
1089
1179
|
orientation: l,
|
|
1090
1180
|
panels: w,
|
|
1091
|
-
separators:
|
|
1092
|
-
}, M =
|
|
1093
|
-
oe && (g(oe.layout),
|
|
1094
|
-
const
|
|
1181
|
+
separators: C
|
|
1182
|
+
}, M = ht(b), oe = O().mountedGroups.get(b);
|
|
1183
|
+
oe && (g(oe.layout), m?.(oe.layout));
|
|
1184
|
+
const Fe = D.addListener(
|
|
1095
1185
|
"interactionStateChange",
|
|
1096
1186
|
(J) => {
|
|
1097
1187
|
switch (J.state) {
|
|
1098
1188
|
case "active": {
|
|
1099
|
-
|
|
1189
|
+
h(
|
|
1100
1190
|
J.hitRegions.some(
|
|
1101
|
-
(
|
|
1191
|
+
($) => $.group === b
|
|
1102
1192
|
)
|
|
1103
1193
|
);
|
|
1104
1194
|
break;
|
|
1105
1195
|
}
|
|
1106
1196
|
default: {
|
|
1107
|
-
|
|
1197
|
+
h(!1);
|
|
1108
1198
|
break;
|
|
1109
1199
|
}
|
|
1110
1200
|
}
|
|
1111
1201
|
}
|
|
1112
|
-
),
|
|
1202
|
+
), He = D.addListener(
|
|
1113
1203
|
"mountedGroupsChange",
|
|
1114
1204
|
(J) => {
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1205
|
+
const $ = J.get(b);
|
|
1206
|
+
$ && $.derivedPanelConstraints.length > 0 && (g($.layout), m?.($.layout));
|
|
1117
1207
|
}
|
|
1118
1208
|
);
|
|
1119
1209
|
return () => {
|
|
1120
|
-
M(),
|
|
1210
|
+
M(), Fe(), He();
|
|
1121
1211
|
};
|
|
1122
1212
|
}, [
|
|
1123
1213
|
n,
|
|
1124
1214
|
o,
|
|
1125
1215
|
r,
|
|
1126
|
-
|
|
1216
|
+
y,
|
|
1127
1217
|
f,
|
|
1128
|
-
|
|
1218
|
+
m,
|
|
1129
1219
|
l,
|
|
1130
1220
|
w,
|
|
1131
|
-
|
|
1221
|
+
C
|
|
1132
1222
|
]);
|
|
1133
1223
|
const Z = {
|
|
1134
|
-
[
|
|
1224
|
+
[Ae]: p ? "none" : void 0
|
|
1135
1225
|
};
|
|
1136
|
-
for (const b in
|
|
1137
|
-
const M =
|
|
1226
|
+
for (const b in v) {
|
|
1227
|
+
const M = Ne(f, b), N = v[b];
|
|
1138
1228
|
Z[M] = N;
|
|
1139
1229
|
}
|
|
1140
|
-
return /* @__PURE__ */ B(
|
|
1230
|
+
return /* @__PURE__ */ B($e.Provider, { value: q, children: /* @__PURE__ */ B(
|
|
1141
1231
|
"div",
|
|
1142
1232
|
{
|
|
1143
1233
|
...d,
|
|
@@ -1161,7 +1251,7 @@ function ht({
|
|
|
1161
1251
|
function ae(e) {
|
|
1162
1252
|
return `react-resizable-panels:${e}`;
|
|
1163
1253
|
}
|
|
1164
|
-
function
|
|
1254
|
+
function yt({
|
|
1165
1255
|
id: e,
|
|
1166
1256
|
layout: t,
|
|
1167
1257
|
storage: n
|
|
@@ -1173,21 +1263,21 @@ function at({
|
|
|
1173
1263
|
console.error(o);
|
|
1174
1264
|
}
|
|
1175
1265
|
}
|
|
1176
|
-
function
|
|
1266
|
+
function Ct({
|
|
1177
1267
|
groupId: e,
|
|
1178
1268
|
storage: t
|
|
1179
1269
|
}) {
|
|
1180
|
-
const n =
|
|
1181
|
-
|
|
1270
|
+
const n = Ve(
|
|
1271
|
+
vt,
|
|
1182
1272
|
() => t.getItem(ae(e)),
|
|
1183
1273
|
() => t.getItem(ae(e))
|
|
1184
|
-
), o =
|
|
1274
|
+
), o = Ce(
|
|
1185
1275
|
() => n ? JSON.parse(n) : void 0,
|
|
1186
1276
|
[n]
|
|
1187
|
-
), r =
|
|
1188
|
-
(
|
|
1277
|
+
), r = Le(
|
|
1278
|
+
(a) => yt({
|
|
1189
1279
|
id: e,
|
|
1190
|
-
layout:
|
|
1280
|
+
layout: a,
|
|
1191
1281
|
storage: t
|
|
1192
1282
|
}),
|
|
1193
1283
|
[e, t]
|
|
@@ -1197,108 +1287,108 @@ function vt({
|
|
|
1197
1287
|
onLayoutChange: r
|
|
1198
1288
|
};
|
|
1199
1289
|
}
|
|
1200
|
-
function
|
|
1290
|
+
function vt() {
|
|
1201
1291
|
return function() {
|
|
1202
1292
|
};
|
|
1203
1293
|
}
|
|
1204
|
-
function
|
|
1205
|
-
return
|
|
1294
|
+
function Rt() {
|
|
1295
|
+
return I(null);
|
|
1206
1296
|
}
|
|
1207
|
-
function
|
|
1297
|
+
function Et() {
|
|
1208
1298
|
return T(null);
|
|
1209
1299
|
}
|
|
1210
1300
|
function de() {
|
|
1211
|
-
const e =
|
|
1212
|
-
return
|
|
1301
|
+
const e = Ke($e);
|
|
1302
|
+
return x(
|
|
1213
1303
|
e,
|
|
1214
1304
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1215
1305
|
), e;
|
|
1216
1306
|
}
|
|
1217
|
-
function
|
|
1307
|
+
function St({
|
|
1218
1308
|
groupId: e,
|
|
1219
1309
|
panelId: t
|
|
1220
1310
|
}) {
|
|
1221
1311
|
const n = () => {
|
|
1222
1312
|
const { mountedGroups: i } = O();
|
|
1223
1313
|
for (const [
|
|
1224
|
-
|
|
1314
|
+
s,
|
|
1225
1315
|
{ derivedPanelConstraints: l, layout: c, separatorToPanels: d }
|
|
1226
1316
|
] of i)
|
|
1227
|
-
if (
|
|
1228
|
-
return { derivedPanelConstraints: l, group:
|
|
1317
|
+
if (s.id === e)
|
|
1318
|
+
return { derivedPanelConstraints: l, group: s, layout: c, separatorToPanels: d };
|
|
1229
1319
|
throw Error(`Group ${e} not found`);
|
|
1230
1320
|
}, o = () => {
|
|
1231
1321
|
const i = n().derivedPanelConstraints.find(
|
|
1232
|
-
(
|
|
1322
|
+
(s) => s.panelId === t
|
|
1233
1323
|
);
|
|
1234
1324
|
if (i !== void 0)
|
|
1235
1325
|
return i;
|
|
1236
1326
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1237
1327
|
}, r = () => {
|
|
1238
|
-
const i = n().group.panels.find((
|
|
1328
|
+
const i = n().group.panels.find((s) => s.id === t);
|
|
1239
1329
|
if (i !== void 0)
|
|
1240
1330
|
return i;
|
|
1241
1331
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1242
|
-
},
|
|
1332
|
+
}, a = () => {
|
|
1243
1333
|
const i = n().layout[t];
|
|
1244
1334
|
if (i !== void 0)
|
|
1245
1335
|
return i;
|
|
1246
1336
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1247
1337
|
}, u = (i) => {
|
|
1248
|
-
const
|
|
1249
|
-
if (i ===
|
|
1338
|
+
const s = a();
|
|
1339
|
+
if (i === s)
|
|
1250
1340
|
return;
|
|
1251
1341
|
const {
|
|
1252
1342
|
derivedPanelConstraints: l,
|
|
1253
1343
|
group: c,
|
|
1254
1344
|
layout: d,
|
|
1255
|
-
separatorToPanels:
|
|
1256
|
-
} = n(),
|
|
1257
|
-
delta: f ?
|
|
1345
|
+
separatorToPanels: z
|
|
1346
|
+
} = n(), m = c.panels.findIndex((y) => y.id === t), f = m === c.panels.length - 1, p = V({
|
|
1347
|
+
delta: f ? s - i : i - s,
|
|
1258
1348
|
initialLayout: d,
|
|
1259
1349
|
panelConstraints: l,
|
|
1260
|
-
pivotIndices: f ? [
|
|
1350
|
+
pivotIndices: f ? [m - 1, m] : [m, m + 1],
|
|
1261
1351
|
prevLayout: d,
|
|
1262
1352
|
trigger: "imperative-api"
|
|
1263
|
-
}),
|
|
1353
|
+
}), h = A({
|
|
1264
1354
|
layout: p,
|
|
1265
1355
|
panelConstraints: l
|
|
1266
1356
|
});
|
|
1267
|
-
W(d,
|
|
1268
|
-
mountedGroups: new Map(
|
|
1357
|
+
W(d, h) || E((y) => ({
|
|
1358
|
+
mountedGroups: new Map(y.mountedGroups).set(c, {
|
|
1269
1359
|
derivedPanelConstraints: l,
|
|
1270
|
-
layout:
|
|
1271
|
-
separatorToPanels:
|
|
1360
|
+
layout: h,
|
|
1361
|
+
separatorToPanels: z
|
|
1272
1362
|
})
|
|
1273
1363
|
}));
|
|
1274
1364
|
};
|
|
1275
1365
|
return {
|
|
1276
1366
|
collapse: () => {
|
|
1277
|
-
const { collapsible: i, collapsedSize:
|
|
1278
|
-
i && l !==
|
|
1367
|
+
const { collapsible: i, collapsedSize: s } = o(), l = a();
|
|
1368
|
+
i && l !== s && u(s);
|
|
1279
1369
|
},
|
|
1280
1370
|
expand: () => {
|
|
1281
|
-
const { collapsible: i, collapsedSize:
|
|
1282
|
-
i && c ===
|
|
1371
|
+
const { collapsible: i, collapsedSize: s, minSize: l } = o(), c = a();
|
|
1372
|
+
i && c === s && u(l);
|
|
1283
1373
|
},
|
|
1284
1374
|
getSize: () => {
|
|
1285
|
-
const { group: i } = n(),
|
|
1375
|
+
const { group: i } = n(), s = a(), { element: l } = r(), c = i.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
1286
1376
|
return {
|
|
1287
|
-
asPercentage:
|
|
1377
|
+
asPercentage: s,
|
|
1288
1378
|
inPixels: c
|
|
1289
1379
|
};
|
|
1290
1380
|
},
|
|
1291
1381
|
isCollapsed: () => {
|
|
1292
|
-
const { collapsible: i, collapsedSize:
|
|
1293
|
-
return i &&
|
|
1382
|
+
const { collapsible: i, collapsedSize: s } = o(), l = a();
|
|
1383
|
+
return i && P(s, l);
|
|
1294
1384
|
},
|
|
1295
1385
|
resize: (i) => {
|
|
1296
|
-
if (
|
|
1386
|
+
if (a() !== i) {
|
|
1297
1387
|
let l;
|
|
1298
1388
|
switch (typeof i) {
|
|
1299
1389
|
case "number": {
|
|
1300
1390
|
const { group: c } = n(), d = H({ group: c });
|
|
1301
|
-
l =
|
|
1391
|
+
l = G(i / d * 100);
|
|
1302
1392
|
break;
|
|
1303
1393
|
}
|
|
1304
1394
|
case "string": {
|
|
@@ -1311,7 +1401,7 @@ function ut({
|
|
|
1311
1401
|
}
|
|
1312
1402
|
};
|
|
1313
1403
|
}
|
|
1314
|
-
function
|
|
1404
|
+
function xt(e, t) {
|
|
1315
1405
|
const { id: n } = de(), o = T({
|
|
1316
1406
|
collapse: ie,
|
|
1317
1407
|
expand: ie,
|
|
@@ -1322,44 +1412,44 @@ function ct(e, t) {
|
|
|
1322
1412
|
isCollapsed: () => !1,
|
|
1323
1413
|
resize: ie
|
|
1324
1414
|
});
|
|
1325
|
-
|
|
1415
|
+
Pe(t, () => o.current, []), j(() => {
|
|
1326
1416
|
Object.assign(
|
|
1327
1417
|
o.current,
|
|
1328
|
-
|
|
1418
|
+
St({ groupId: n, panelId: e })
|
|
1329
1419
|
);
|
|
1330
1420
|
});
|
|
1331
1421
|
}
|
|
1332
|
-
function
|
|
1422
|
+
function Mt({
|
|
1333
1423
|
children: e,
|
|
1334
1424
|
className: t,
|
|
1335
1425
|
collapsedSize: n = "0%",
|
|
1336
1426
|
collapsible: o = !1,
|
|
1337
1427
|
defaultSize: r,
|
|
1338
|
-
elementRef:
|
|
1428
|
+
elementRef: a,
|
|
1339
1429
|
id: u,
|
|
1340
1430
|
maxSize: i = "100%",
|
|
1341
|
-
minSize:
|
|
1431
|
+
minSize: s = "0%",
|
|
1342
1432
|
onResize: l,
|
|
1343
1433
|
panelRef: c,
|
|
1344
1434
|
style: d,
|
|
1345
|
-
...
|
|
1435
|
+
...z
|
|
1346
1436
|
}) {
|
|
1347
|
-
const
|
|
1348
|
-
l?.(
|
|
1437
|
+
const m = !!u, f = ue(u), [p, h] = I(null), y = fe(h, a), { id: S, registerPanel: v } = de(), g = l !== null, w = ce((C) => {
|
|
1438
|
+
l?.(C, u);
|
|
1349
1439
|
});
|
|
1350
1440
|
j(() => {
|
|
1351
1441
|
if (p !== null)
|
|
1352
|
-
return
|
|
1442
|
+
return v({
|
|
1353
1443
|
element: p,
|
|
1354
1444
|
id: f,
|
|
1355
|
-
idIsStable:
|
|
1445
|
+
idIsStable: m,
|
|
1356
1446
|
onResize: g ? w : void 0,
|
|
1357
1447
|
panelConstraints: {
|
|
1358
1448
|
collapsedSize: n,
|
|
1359
1449
|
collapsible: o,
|
|
1360
1450
|
defaultSize: r,
|
|
1361
1451
|
maxSize: i,
|
|
1362
|
-
minSize:
|
|
1452
|
+
minSize: s
|
|
1363
1453
|
}
|
|
1364
1454
|
});
|
|
1365
1455
|
}, [
|
|
@@ -1369,31 +1459,31 @@ function St({
|
|
|
1369
1459
|
p,
|
|
1370
1460
|
g,
|
|
1371
1461
|
f,
|
|
1372
|
-
|
|
1462
|
+
m,
|
|
1373
1463
|
i,
|
|
1374
|
-
|
|
1464
|
+
s,
|
|
1375
1465
|
w,
|
|
1376
|
-
|
|
1377
|
-
]),
|
|
1378
|
-
const
|
|
1466
|
+
v
|
|
1467
|
+
]), xt(f, c);
|
|
1468
|
+
const L = Ne(S, f);
|
|
1379
1469
|
return /* @__PURE__ */ B(
|
|
1380
1470
|
"div",
|
|
1381
1471
|
{
|
|
1382
|
-
...
|
|
1472
|
+
...z,
|
|
1383
1473
|
"data-panel": !0,
|
|
1384
1474
|
"data-testid": f,
|
|
1385
1475
|
id: f,
|
|
1386
|
-
ref:
|
|
1476
|
+
ref: y,
|
|
1387
1477
|
style: {
|
|
1388
|
-
...
|
|
1478
|
+
...zt,
|
|
1389
1479
|
flexBasis: 0,
|
|
1390
|
-
flexGrow: `var(${
|
|
1480
|
+
flexGrow: `var(${L}, 1)`,
|
|
1391
1481
|
flexShrink: 1,
|
|
1392
1482
|
// Prevent Panel content from interfering with panel size
|
|
1393
1483
|
overflow: "hidden",
|
|
1394
1484
|
// Disable pointer events inside of a panel during resize
|
|
1395
1485
|
// This avoid edge cases like nested iframes
|
|
1396
|
-
pointerEvents: `var(${
|
|
1486
|
+
pointerEvents: `var(${Ae})`
|
|
1397
1487
|
},
|
|
1398
1488
|
children: /* @__PURE__ */ B(
|
|
1399
1489
|
"div",
|
|
@@ -1410,7 +1500,7 @@ function St({
|
|
|
1410
1500
|
}
|
|
1411
1501
|
);
|
|
1412
1502
|
}
|
|
1413
|
-
const
|
|
1503
|
+
const zt = {
|
|
1414
1504
|
minHeight: "unset",
|
|
1415
1505
|
maxHeight: "unset",
|
|
1416
1506
|
height: "unset",
|
|
@@ -1426,26 +1516,26 @@ const ft = {
|
|
|
1426
1516
|
padding: "unset",
|
|
1427
1517
|
margin: "unset"
|
|
1428
1518
|
};
|
|
1429
|
-
function
|
|
1430
|
-
return
|
|
1519
|
+
function It() {
|
|
1520
|
+
return I(null);
|
|
1431
1521
|
}
|
|
1432
|
-
function
|
|
1522
|
+
function Gt() {
|
|
1433
1523
|
return T(null);
|
|
1434
1524
|
}
|
|
1435
|
-
function
|
|
1525
|
+
function bt({
|
|
1436
1526
|
layout: e,
|
|
1437
1527
|
panelConstraints: t,
|
|
1438
1528
|
panelId: n,
|
|
1439
1529
|
panelIndex: o
|
|
1440
1530
|
}) {
|
|
1441
|
-
let r,
|
|
1531
|
+
let r, a;
|
|
1442
1532
|
const u = e[n], i = t.find(
|
|
1443
|
-
(
|
|
1533
|
+
(s) => s.panelId === n
|
|
1444
1534
|
);
|
|
1445
1535
|
if (i) {
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
layout:
|
|
1536
|
+
const s = i.maxSize, l = a = i.collapsible ? i.collapsedSize : i.minSize, c = [o, o + 1];
|
|
1537
|
+
a = A({
|
|
1538
|
+
layout: V({
|
|
1449
1539
|
delta: l - u,
|
|
1450
1540
|
initialLayout: e,
|
|
1451
1541
|
panelConstraints: t,
|
|
@@ -1454,9 +1544,9 @@ function dt({
|
|
|
1454
1544
|
trigger: "keyboard"
|
|
1455
1545
|
}),
|
|
1456
1546
|
panelConstraints: t
|
|
1457
|
-
})[n], r =
|
|
1458
|
-
layout:
|
|
1459
|
-
delta:
|
|
1547
|
+
})[n], r = A({
|
|
1548
|
+
layout: V({
|
|
1549
|
+
delta: s - u,
|
|
1460
1550
|
initialLayout: e,
|
|
1461
1551
|
panelConstraints: t,
|
|
1462
1552
|
pivotIndices: c,
|
|
@@ -1469,50 +1559,50 @@ function dt({
|
|
|
1469
1559
|
return {
|
|
1470
1560
|
valueControls: n,
|
|
1471
1561
|
valueMax: r,
|
|
1472
|
-
valueMin:
|
|
1562
|
+
valueMin: a,
|
|
1473
1563
|
valueNow: u
|
|
1474
1564
|
};
|
|
1475
1565
|
}
|
|
1476
|
-
function
|
|
1566
|
+
function kt({
|
|
1477
1567
|
children: e,
|
|
1478
1568
|
className: t,
|
|
1479
1569
|
elementRef: n,
|
|
1480
1570
|
id: o,
|
|
1481
1571
|
style: r,
|
|
1482
|
-
...
|
|
1572
|
+
...a
|
|
1483
1573
|
}) {
|
|
1484
|
-
const u = ue(o), [i,
|
|
1574
|
+
const u = ue(o), [i, s] = I({}), [l, c] = I("inactive"), [d, z] = I(null), m = fe(z, n), {
|
|
1485
1575
|
id: f,
|
|
1486
1576
|
orientation: p,
|
|
1487
|
-
registerSeparator:
|
|
1488
|
-
} = de(),
|
|
1577
|
+
registerSeparator: h
|
|
1578
|
+
} = de(), y = p === "horizontal" ? "vertical" : "horizontal";
|
|
1489
1579
|
return j(() => {
|
|
1490
1580
|
if (d !== null) {
|
|
1491
1581
|
const S = {
|
|
1492
1582
|
element: d,
|
|
1493
1583
|
id: u
|
|
1494
|
-
},
|
|
1584
|
+
}, v = h(S), g = D.addListener(
|
|
1495
1585
|
"interactionStateChange",
|
|
1496
|
-
(
|
|
1586
|
+
(L) => {
|
|
1497
1587
|
c(
|
|
1498
|
-
|
|
1499
|
-
(
|
|
1500
|
-
) ?
|
|
1588
|
+
L.state !== "inactive" && L.hitRegions.some(
|
|
1589
|
+
(C) => C.separator === S
|
|
1590
|
+
) ? L.state : "inactive"
|
|
1501
1591
|
);
|
|
1502
1592
|
}
|
|
1503
|
-
), w =
|
|
1593
|
+
), w = D.addListener(
|
|
1504
1594
|
"mountedGroupsChange",
|
|
1505
|
-
(
|
|
1506
|
-
|
|
1507
|
-
({ derivedPanelConstraints:
|
|
1595
|
+
(L) => {
|
|
1596
|
+
L.forEach(
|
|
1597
|
+
({ derivedPanelConstraints: C, layout: K, separatorToPanels: ne }, X) => {
|
|
1508
1598
|
if (X.id === f) {
|
|
1509
1599
|
const Y = ne.get(S);
|
|
1510
1600
|
if (Y) {
|
|
1511
1601
|
const q = Y[0], Z = X.panels.indexOf(q);
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
layout:
|
|
1515
|
-
panelConstraints:
|
|
1602
|
+
s(
|
|
1603
|
+
bt({
|
|
1604
|
+
layout: K,
|
|
1605
|
+
panelConstraints: C,
|
|
1516
1606
|
panelId: q.id,
|
|
1517
1607
|
panelIndex: Z
|
|
1518
1608
|
})
|
|
@@ -1524,15 +1614,15 @@ function bt({
|
|
|
1524
1614
|
}
|
|
1525
1615
|
);
|
|
1526
1616
|
return () => {
|
|
1527
|
-
g(), w(),
|
|
1617
|
+
g(), w(), v();
|
|
1528
1618
|
};
|
|
1529
1619
|
}
|
|
1530
|
-
}, [d, f, u,
|
|
1620
|
+
}, [d, f, u, h]), /* @__PURE__ */ B(
|
|
1531
1621
|
"div",
|
|
1532
1622
|
{
|
|
1533
|
-
...
|
|
1623
|
+
...a,
|
|
1534
1624
|
"aria-controls": i.valueControls,
|
|
1535
|
-
"aria-orientation":
|
|
1625
|
+
"aria-orientation": y,
|
|
1536
1626
|
"aria-valuemax": i.valueMax,
|
|
1537
1627
|
"aria-valuemin": i.valueMin,
|
|
1538
1628
|
"aria-valuenow": i.valueNow,
|
|
@@ -1541,7 +1631,7 @@ function bt({
|
|
|
1541
1631
|
"data-separator": l,
|
|
1542
1632
|
"data-testid": u,
|
|
1543
1633
|
id: u,
|
|
1544
|
-
ref:
|
|
1634
|
+
ref: m,
|
|
1545
1635
|
role: "separator",
|
|
1546
1636
|
style: {
|
|
1547
1637
|
flexBasis: "auto",
|
|
@@ -1554,13 +1644,13 @@ function bt({
|
|
|
1554
1644
|
);
|
|
1555
1645
|
}
|
|
1556
1646
|
export {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1647
|
+
Pt as Group,
|
|
1648
|
+
Mt as Panel,
|
|
1649
|
+
kt as Separator,
|
|
1650
|
+
Ct as useDefaultLayout,
|
|
1651
|
+
Rt as useGroupCallbackRef,
|
|
1652
|
+
Et as useGroupRef,
|
|
1653
|
+
It as usePanelCallbackRef,
|
|
1654
|
+
Gt as usePanelRef
|
|
1565
1655
|
};
|
|
1566
1656
|
//# sourceMappingURL=react-resizable-panels.js.map
|