react-resizable-panels 4.0.0-alpha.0 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as F } from "react/jsx-runtime";
|
|
3
|
-
import { useId as
|
|
4
|
-
function
|
|
3
|
+
import { useId as Pe, useLayoutEffect as Ee, useEffect as Ce, useRef as I, useCallback as fe, createContext as Me, useImperativeHandle as de, useState as M, useMemo as pe, useSyncExternalStore as Ge, useContext as Ie } from "react";
|
|
4
|
+
function Oe(e, t) {
|
|
5
5
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
6
6
|
return t * o;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function ke(e, t) {
|
|
9
9
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
10
10
|
return t * o;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Ae(e) {
|
|
13
13
|
return e / 100 * window.innerHeight;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function Ne(e) {
|
|
16
16
|
return e / 100 * window.innerWidth;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function $e(e) {
|
|
19
19
|
switch (typeof e) {
|
|
20
20
|
case "number":
|
|
21
21
|
return [e, "px"];
|
|
@@ -25,13 +25,13 @@ function Ne(e) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function j({
|
|
29
29
|
groupSize: e,
|
|
30
30
|
panelElement: t,
|
|
31
31
|
styleProp: n
|
|
32
32
|
}) {
|
|
33
33
|
let o;
|
|
34
|
-
const [s, i] =
|
|
34
|
+
const [s, i] = $e(n);
|
|
35
35
|
switch (i) {
|
|
36
36
|
case "%": {
|
|
37
37
|
o = s / 100 * e;
|
|
@@ -42,19 +42,19 @@ function H({
|
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
case "rem": {
|
|
45
|
-
o =
|
|
45
|
+
o = ke(t, s);
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
48
48
|
case "em": {
|
|
49
|
-
o =
|
|
49
|
+
o = Oe(t, s);
|
|
50
50
|
break;
|
|
51
51
|
}
|
|
52
52
|
case "vh": {
|
|
53
|
-
o =
|
|
53
|
+
o = Ae(s);
|
|
54
54
|
break;
|
|
55
55
|
}
|
|
56
56
|
case "vw": {
|
|
57
|
-
o =
|
|
57
|
+
o = Ne(s);
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -63,19 +63,19 @@ function H({
|
|
|
63
63
|
function L(e) {
|
|
64
64
|
return parseFloat(e.toFixed(3));
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function Q({
|
|
67
67
|
group: e
|
|
68
68
|
}) {
|
|
69
|
-
const {
|
|
69
|
+
const { orientation: t, panels: n } = e;
|
|
70
70
|
return n.reduce((o, s) => (o += t === "horizontal" ? s.element.offsetWidth : s.element.offsetHeight, o), 0);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
const { panels: t } = e, n =
|
|
72
|
+
function ae(e) {
|
|
73
|
+
const { panels: t } = e, n = Q({ group: e });
|
|
74
74
|
return t.map((o) => {
|
|
75
75
|
const { element: s, panelConstraints: i } = o;
|
|
76
76
|
let a = 0;
|
|
77
77
|
if (i.collapsedSize) {
|
|
78
|
-
const u =
|
|
78
|
+
const u = j({
|
|
79
79
|
groupSize: n,
|
|
80
80
|
panelElement: s,
|
|
81
81
|
styleProp: i.collapsedSize
|
|
@@ -84,7 +84,7 @@ function ie(e) {
|
|
|
84
84
|
}
|
|
85
85
|
let r;
|
|
86
86
|
if (i.defaultSize) {
|
|
87
|
-
const u =
|
|
87
|
+
const u = j({
|
|
88
88
|
groupSize: n,
|
|
89
89
|
panelElement: s,
|
|
90
90
|
styleProp: i.defaultSize
|
|
@@ -93,7 +93,7 @@ function ie(e) {
|
|
|
93
93
|
}
|
|
94
94
|
let l = 0;
|
|
95
95
|
if (i.minSize) {
|
|
96
|
-
const u =
|
|
96
|
+
const u = j({
|
|
97
97
|
groupSize: n,
|
|
98
98
|
panelElement: s,
|
|
99
99
|
styleProp: i.minSize
|
|
@@ -102,7 +102,7 @@ function ie(e) {
|
|
|
102
102
|
}
|
|
103
103
|
let c = 100;
|
|
104
104
|
if (i.maxSize) {
|
|
105
|
-
const u =
|
|
105
|
+
const u = j({
|
|
106
106
|
groupSize: n,
|
|
107
107
|
panelElement: s,
|
|
108
108
|
styleProp: i.maxSize
|
|
@@ -119,7 +119,7 @@ function ie(e) {
|
|
|
119
119
|
};
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
class
|
|
122
|
+
class De {
|
|
123
123
|
#e = {};
|
|
124
124
|
addListener(t, n) {
|
|
125
125
|
const o = this.#e[t];
|
|
@@ -158,70 +158,83 @@ class $e {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
let
|
|
161
|
+
let E = {
|
|
162
162
|
cursorFlags: 0,
|
|
163
163
|
interactionState: {
|
|
164
164
|
state: "inactive"
|
|
165
165
|
},
|
|
166
166
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
167
167
|
};
|
|
168
|
-
const
|
|
168
|
+
const T = new De();
|
|
169
169
|
function O() {
|
|
170
|
-
return
|
|
170
|
+
return E;
|
|
171
171
|
}
|
|
172
172
|
function G(e) {
|
|
173
|
-
const t = typeof e == "function" ? e(
|
|
174
|
-
return
|
|
175
|
-
...
|
|
173
|
+
const t = typeof e == "function" ? e(E) : e;
|
|
174
|
+
return E === t || (E = {
|
|
175
|
+
...E,
|
|
176
176
|
...t
|
|
177
|
-
}, t.cursorFlags !== void 0 &&
|
|
177
|
+
}, t.cursorFlags !== void 0 && T.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && T.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && T.emit("mountedGroupsChange", E.mountedGroups)), E;
|
|
178
178
|
}
|
|
179
|
-
const Te = (e) => e,
|
|
180
|
-
},
|
|
179
|
+
const Te = (e) => e, V = () => {
|
|
180
|
+
}, he = 1, me = 2, ve = 4, ge = 8, le = {
|
|
181
181
|
coarse: 10,
|
|
182
182
|
precise: 5
|
|
183
183
|
};
|
|
184
|
-
function
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
function X(e, t) {
|
|
185
|
+
return t.sort(
|
|
186
|
+
e === "horizontal" ? _e : Fe
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function _e(e, t) {
|
|
190
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
191
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
192
|
+
}
|
|
193
|
+
function Fe(e, t) {
|
|
194
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
195
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
196
|
+
}
|
|
197
|
+
function He(e) {
|
|
198
|
+
const { element: t, orientation: n, panels: o, separators: s } = e, i = X(
|
|
199
|
+
n,
|
|
200
|
+
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
201
|
+
).map(({ element: c }) => c), a = [];
|
|
189
202
|
let r, l;
|
|
190
203
|
for (const c of i) {
|
|
191
204
|
const u = o.find(
|
|
192
|
-
(
|
|
205
|
+
(d) => d.element === c
|
|
193
206
|
);
|
|
194
207
|
if (u) {
|
|
195
208
|
if (r) {
|
|
196
|
-
const
|
|
209
|
+
const d = r.element.getBoundingClientRect(), p = c.getBoundingClientRect();
|
|
197
210
|
a.push({
|
|
198
211
|
group: e,
|
|
199
212
|
panels: [r, u],
|
|
200
213
|
separator: l,
|
|
201
|
-
rect:
|
|
202
|
-
|
|
214
|
+
rect: n === "horizontal" ? new DOMRect(
|
|
215
|
+
d.right,
|
|
203
216
|
p.top,
|
|
204
|
-
p.left -
|
|
217
|
+
p.left - d.right,
|
|
205
218
|
p.height
|
|
206
219
|
) : new DOMRect(
|
|
207
220
|
p.left,
|
|
208
|
-
|
|
221
|
+
d.bottom,
|
|
209
222
|
p.width,
|
|
210
|
-
p.top -
|
|
223
|
+
p.top - d.bottom
|
|
211
224
|
)
|
|
212
225
|
});
|
|
213
226
|
}
|
|
214
|
-
r = u;
|
|
227
|
+
r = u, l = void 0;
|
|
215
228
|
} else {
|
|
216
|
-
const
|
|
229
|
+
const d = s.find(
|
|
217
230
|
(p) => p.element === c
|
|
218
231
|
);
|
|
219
|
-
|
|
232
|
+
d ? l = d : (r = void 0, l = void 0);
|
|
220
233
|
}
|
|
221
234
|
}
|
|
222
235
|
return a;
|
|
223
236
|
}
|
|
224
|
-
function
|
|
237
|
+
function je(e, t) {
|
|
225
238
|
return {
|
|
226
239
|
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
227
240
|
Math.abs(e.x - t.left),
|
|
@@ -233,13 +246,13 @@ function De(e, t) {
|
|
|
233
246
|
)
|
|
234
247
|
};
|
|
235
248
|
}
|
|
236
|
-
function
|
|
249
|
+
function We(e, t, n) {
|
|
237
250
|
let o, s = {
|
|
238
251
|
x: 1 / 0,
|
|
239
252
|
y: 1 / 0
|
|
240
253
|
};
|
|
241
254
|
for (const i of t) {
|
|
242
|
-
const a =
|
|
255
|
+
const a = je(n, i.rect);
|
|
243
256
|
switch (e) {
|
|
244
257
|
case "horizontal": {
|
|
245
258
|
a.x <= s.x && (o = i, s = a);
|
|
@@ -256,26 +269,26 @@ function Fe(e, t, n) {
|
|
|
256
269
|
hitRegion: o
|
|
257
270
|
} : void 0;
|
|
258
271
|
}
|
|
259
|
-
let
|
|
260
|
-
function
|
|
261
|
-
return
|
|
272
|
+
let W;
|
|
273
|
+
function Ue() {
|
|
274
|
+
return W === void 0 && (typeof matchMedia == "function" ? W = !!matchMedia("(pointer:coarse)").matches : W = !1), W;
|
|
262
275
|
}
|
|
263
|
-
function
|
|
276
|
+
function ye(e, t) {
|
|
264
277
|
const n = [];
|
|
265
278
|
return t.forEach((o, s) => {
|
|
266
279
|
if (s.disabled)
|
|
267
280
|
return;
|
|
268
|
-
const i =
|
|
281
|
+
const i = Ue() ? le.coarse : le.precise, a = He(s), r = We(s.orientation, a, {
|
|
269
282
|
x: e.clientX,
|
|
270
283
|
y: e.clientY
|
|
271
284
|
});
|
|
272
285
|
r && r.distance.x <= i && r.distance.y <= i && n.push(r.hitRegion);
|
|
273
286
|
}), n;
|
|
274
287
|
}
|
|
275
|
-
function
|
|
288
|
+
function ce(e) {
|
|
276
289
|
if (e.defaultPrevented)
|
|
277
290
|
return;
|
|
278
|
-
const { mountedGroups: t } = O(), n =
|
|
291
|
+
const { mountedGroups: t } = O(), n = ye(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
279
292
|
n.forEach((r) => {
|
|
280
293
|
o.add(r.group), r.panels.forEach((c) => {
|
|
281
294
|
s.add(c);
|
|
@@ -291,7 +304,7 @@ function se(e) {
|
|
|
291
304
|
}
|
|
292
305
|
}), n.length && e.preventDefault();
|
|
293
306
|
}
|
|
294
|
-
function
|
|
307
|
+
function Be({
|
|
295
308
|
cursorFlags: e,
|
|
296
309
|
groups: t,
|
|
297
310
|
state: n
|
|
@@ -302,7 +315,7 @@ function He({
|
|
|
302
315
|
case "hover":
|
|
303
316
|
t.forEach((i) => {
|
|
304
317
|
if (!i.disableCursor)
|
|
305
|
-
switch (i.
|
|
318
|
+
switch (i.orientation) {
|
|
306
319
|
case "horizontal": {
|
|
307
320
|
o++;
|
|
308
321
|
break;
|
|
@@ -318,7 +331,7 @@ function He({
|
|
|
318
331
|
return null;
|
|
319
332
|
switch (n) {
|
|
320
333
|
case "active": {
|
|
321
|
-
const i = (e &
|
|
334
|
+
const i = (e & he) !== 0, a = (e & me) !== 0, r = (e & ve) !== 0, l = (e & ge) !== 0;
|
|
322
335
|
if (e) {
|
|
323
336
|
if (i)
|
|
324
337
|
return r ? "se-resize" : l ? "ne-resize" : "e-resize";
|
|
@@ -334,34 +347,34 @@ function He({
|
|
|
334
347
|
}
|
|
335
348
|
return o > 0 && s > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
336
349
|
}
|
|
337
|
-
let
|
|
338
|
-
function
|
|
350
|
+
let K = null, P;
|
|
351
|
+
function Y() {
|
|
339
352
|
P === void 0 && (P = new CSSStyleSheet(), document.adoptedStyleSheets = [P]);
|
|
340
353
|
const { cursorFlags: e, interactionState: t } = O();
|
|
341
354
|
switch (t.state) {
|
|
342
355
|
case "active":
|
|
343
356
|
case "hover": {
|
|
344
|
-
const n =
|
|
357
|
+
const n = Be({
|
|
345
358
|
cursorFlags: e,
|
|
346
359
|
groups: t.hitRegions.map((o) => o.group),
|
|
347
360
|
state: t.state
|
|
348
361
|
});
|
|
349
|
-
if (
|
|
362
|
+
if (K === n)
|
|
350
363
|
return;
|
|
351
|
-
|
|
364
|
+
K = n, n ? P.cssRules.length === 0 ? P.insertRule(`*{cursor: ${n} !important;}`) : P.replaceSync(`*{cursor: ${n} !important;}`) : P.cssRules.length === 1 && P.deleteRule(0);
|
|
352
365
|
break;
|
|
353
366
|
}
|
|
354
367
|
case "inactive": {
|
|
355
|
-
|
|
368
|
+
K = null, P.cssRules.length === 1 && P.deleteRule(0);
|
|
356
369
|
break;
|
|
357
370
|
}
|
|
358
371
|
}
|
|
359
372
|
}
|
|
360
|
-
function
|
|
373
|
+
function C(e, t = "Assertion error") {
|
|
361
374
|
if (!e)
|
|
362
375
|
throw console.error(t), Error(t);
|
|
363
376
|
}
|
|
364
|
-
function
|
|
377
|
+
function Ve(e, t) {
|
|
365
378
|
if (e.length !== t.length)
|
|
366
379
|
return !1;
|
|
367
380
|
for (let n = 0; n < e.length; n++)
|
|
@@ -369,13 +382,13 @@ function Be(e, t) {
|
|
|
369
382
|
return !1;
|
|
370
383
|
return !0;
|
|
371
384
|
}
|
|
372
|
-
function
|
|
385
|
+
function w(e, t, n = 0) {
|
|
373
386
|
return Math.abs(L(e) - L(t)) <= n;
|
|
374
387
|
}
|
|
375
|
-
function
|
|
376
|
-
return
|
|
388
|
+
function Z(e, t) {
|
|
389
|
+
return w(e, t) ? 0 : e > t ? 1 : -1;
|
|
377
390
|
}
|
|
378
|
-
function
|
|
391
|
+
function D({
|
|
379
392
|
panelConstraints: e,
|
|
380
393
|
size: t
|
|
381
394
|
}) {
|
|
@@ -385,15 +398,15 @@ function T({
|
|
|
385
398
|
maxSize: s = 100,
|
|
386
399
|
minSize: i = 0
|
|
387
400
|
} = e;
|
|
388
|
-
if (
|
|
401
|
+
if (Z(t, i) < 0)
|
|
389
402
|
if (o) {
|
|
390
403
|
const a = (n + i) / 2;
|
|
391
|
-
|
|
404
|
+
Z(t, a) < 0 ? t = n : t = i;
|
|
392
405
|
} else
|
|
393
406
|
t = i;
|
|
394
407
|
return t = Math.min(s, t), t = L(t), t;
|
|
395
408
|
}
|
|
396
|
-
function
|
|
409
|
+
function Ke({
|
|
397
410
|
delta: e,
|
|
398
411
|
initialLayout: t,
|
|
399
412
|
panelConstraints: n,
|
|
@@ -401,97 +414,97 @@ function We({
|
|
|
401
414
|
prevLayout: s,
|
|
402
415
|
trigger: i
|
|
403
416
|
}) {
|
|
404
|
-
if (
|
|
417
|
+
if (w(e, 0))
|
|
405
418
|
return t;
|
|
406
419
|
const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
|
|
407
|
-
|
|
408
|
-
let
|
|
420
|
+
C(c != null, "Invalid first pivot index"), C(u != null, "Invalid second pivot index");
|
|
421
|
+
let d = 0;
|
|
409
422
|
{
|
|
410
|
-
const
|
|
411
|
-
let
|
|
423
|
+
const h = e < 0 ? 1 : -1;
|
|
424
|
+
let f = e < 0 ? u : c, v = 0;
|
|
412
425
|
for (; ; ) {
|
|
413
|
-
const x = a[
|
|
414
|
-
|
|
426
|
+
const x = a[f];
|
|
427
|
+
C(
|
|
415
428
|
x != null,
|
|
416
|
-
`Previous layout not found for panel index ${
|
|
429
|
+
`Previous layout not found for panel index ${f}`
|
|
417
430
|
);
|
|
418
|
-
const
|
|
419
|
-
panelConstraints: n[
|
|
431
|
+
const S = D({
|
|
432
|
+
panelConstraints: n[f],
|
|
420
433
|
size: 100
|
|
421
434
|
}) - x;
|
|
422
|
-
if (v +=
|
|
435
|
+
if (v += S, f += h, f < 0 || f >= n.length)
|
|
423
436
|
break;
|
|
424
437
|
}
|
|
425
|
-
const
|
|
426
|
-
e = e < 0 ? 0 -
|
|
438
|
+
const g = Math.min(Math.abs(e), Math.abs(v));
|
|
439
|
+
e = e < 0 ? 0 - g : g;
|
|
427
440
|
}
|
|
428
441
|
{
|
|
429
|
-
let
|
|
430
|
-
for (;
|
|
431
|
-
const v = Math.abs(e) - Math.abs(
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
`Previous layout not found for panel index ${
|
|
442
|
+
let f = e < 0 ? c : u;
|
|
443
|
+
for (; f >= 0 && f < n.length; ) {
|
|
444
|
+
const v = Math.abs(e) - Math.abs(d), g = a[f];
|
|
445
|
+
C(
|
|
446
|
+
g != null,
|
|
447
|
+
`Previous layout not found for panel index ${f}`
|
|
435
448
|
);
|
|
436
|
-
const x =
|
|
437
|
-
panelConstraints: n[
|
|
449
|
+
const x = g - v, z = D({
|
|
450
|
+
panelConstraints: n[f],
|
|
438
451
|
size: x
|
|
439
452
|
});
|
|
440
|
-
if (!
|
|
453
|
+
if (!w(g, z) && (d += g - z, l[f] = z, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
441
454
|
numeric: !0
|
|
442
455
|
}) >= 0))
|
|
443
456
|
break;
|
|
444
|
-
e < 0 ?
|
|
457
|
+
e < 0 ? f-- : f++;
|
|
445
458
|
}
|
|
446
459
|
}
|
|
447
|
-
if (
|
|
460
|
+
if (Ve(r, l))
|
|
448
461
|
return s;
|
|
449
462
|
{
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
`Previous layout not found for panel index ${
|
|
463
|
+
const h = e < 0 ? u : c, f = a[h];
|
|
464
|
+
C(
|
|
465
|
+
f != null,
|
|
466
|
+
`Previous layout not found for panel index ${h}`
|
|
454
467
|
);
|
|
455
|
-
const v =
|
|
456
|
-
panelConstraints: n[
|
|
468
|
+
const v = f + d, g = D({
|
|
469
|
+
panelConstraints: n[h],
|
|
457
470
|
size: v
|
|
458
471
|
});
|
|
459
|
-
if (l[
|
|
460
|
-
let x = v -
|
|
461
|
-
for (;
|
|
462
|
-
const R = l[
|
|
463
|
-
|
|
472
|
+
if (l[h] = g, !w(g, v)) {
|
|
473
|
+
let x = v - g, S = e < 0 ? u : c;
|
|
474
|
+
for (; S >= 0 && S < n.length; ) {
|
|
475
|
+
const R = l[S];
|
|
476
|
+
C(
|
|
464
477
|
R != null,
|
|
465
|
-
`Previous layout not found for panel index ${
|
|
478
|
+
`Previous layout not found for panel index ${S}`
|
|
466
479
|
);
|
|
467
|
-
const k = R + x, A =
|
|
468
|
-
panelConstraints: n[
|
|
480
|
+
const k = R + x, A = D({
|
|
481
|
+
panelConstraints: n[S],
|
|
469
482
|
size: k
|
|
470
483
|
});
|
|
471
|
-
if (
|
|
484
|
+
if (w(R, A) || (x -= A - R, l[S] = A), w(x, 0))
|
|
472
485
|
break;
|
|
473
|
-
e > 0 ?
|
|
486
|
+
e > 0 ? S-- : S++;
|
|
474
487
|
}
|
|
475
488
|
}
|
|
476
489
|
}
|
|
477
490
|
const p = Object.values(l).reduce(
|
|
478
|
-
(
|
|
491
|
+
(h, f) => f + h,
|
|
479
492
|
0
|
|
480
493
|
);
|
|
481
|
-
if (!
|
|
494
|
+
if (!w(p, 100, 0.1))
|
|
482
495
|
return s;
|
|
483
|
-
const
|
|
484
|
-
return l.reduce((
|
|
496
|
+
const m = Object.keys(s);
|
|
497
|
+
return l.reduce((h, f, v) => (h[m[v]] = f, h), {});
|
|
485
498
|
}
|
|
486
|
-
function
|
|
499
|
+
function ee(e, t) {
|
|
487
500
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
488
501
|
return !1;
|
|
489
502
|
for (const n in e)
|
|
490
|
-
if (
|
|
503
|
+
if (Z(e[n], t[n]) !== 0)
|
|
491
504
|
return !1;
|
|
492
505
|
return !0;
|
|
493
506
|
}
|
|
494
|
-
function
|
|
507
|
+
function U(e) {
|
|
495
508
|
if (e.defaultPrevented)
|
|
496
509
|
return;
|
|
497
510
|
const { interactionState: t, mountedGroups: n } = O();
|
|
@@ -514,50 +527,50 @@ function W(e) {
|
|
|
514
527
|
let o = 0;
|
|
515
528
|
const s = new Map(n);
|
|
516
529
|
t.hitRegions.forEach((i) => {
|
|
517
|
-
const {
|
|
530
|
+
const { disableCursor: a, element: r, orientation: l, panels: c } = i.group;
|
|
518
531
|
let u = 0;
|
|
519
|
-
t.state === "active" && (
|
|
520
|
-
const
|
|
532
|
+
t.state === "active" && (l === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / r.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / r.offsetHeight * 100);
|
|
533
|
+
const d = t.initialLayoutMap.get(
|
|
521
534
|
i.group
|
|
522
|
-
), { derivedPanelConstraints: p, layout:
|
|
523
|
-
if (p &&
|
|
524
|
-
const
|
|
535
|
+
), { derivedPanelConstraints: p, layout: m } = n.get(i.group) ?? {};
|
|
536
|
+
if (p && d && m) {
|
|
537
|
+
const h = Ke({
|
|
525
538
|
delta: u,
|
|
526
|
-
initialLayout:
|
|
539
|
+
initialLayout: d,
|
|
527
540
|
panelConstraints: p,
|
|
528
|
-
pivotIndices: i.panels.map((
|
|
529
|
-
prevLayout:
|
|
541
|
+
pivotIndices: i.panels.map((f) => c.indexOf(f)),
|
|
542
|
+
prevLayout: m,
|
|
530
543
|
trigger: "mouse-or-touch"
|
|
531
544
|
});
|
|
532
|
-
if (
|
|
533
|
-
if (u !== 0 && !
|
|
534
|
-
switch (
|
|
545
|
+
if (ee(h, m)) {
|
|
546
|
+
if (u !== 0 && !a)
|
|
547
|
+
switch (l) {
|
|
535
548
|
case "horizontal": {
|
|
536
|
-
o |= u < 0 ?
|
|
549
|
+
o |= u < 0 ? he : me;
|
|
537
550
|
break;
|
|
538
551
|
}
|
|
539
552
|
case "vertical": {
|
|
540
|
-
o |= u < 0 ?
|
|
553
|
+
o |= u < 0 ? ve : ge;
|
|
541
554
|
break;
|
|
542
555
|
}
|
|
543
556
|
}
|
|
544
557
|
} else {
|
|
545
558
|
s.set(i.group, {
|
|
546
559
|
derivedPanelConstraints: p,
|
|
547
|
-
layout:
|
|
560
|
+
layout: h
|
|
548
561
|
});
|
|
549
|
-
const
|
|
550
|
-
i.group.inMemoryLayouts[
|
|
562
|
+
const f = i.group.panels.map(({ id: v }) => v).join(",");
|
|
563
|
+
i.group.inMemoryLayouts[f] = h;
|
|
551
564
|
}
|
|
552
565
|
}
|
|
553
566
|
}), G({
|
|
554
567
|
cursorFlags: o,
|
|
555
568
|
mountedGroups: s
|
|
556
|
-
}),
|
|
569
|
+
}), Y();
|
|
557
570
|
break;
|
|
558
571
|
}
|
|
559
572
|
default: {
|
|
560
|
-
const o =
|
|
573
|
+
const o = ye(e, n);
|
|
561
574
|
o.length === 0 ? t.state !== "inactive" && G({
|
|
562
575
|
interactionState: { state: "inactive" }
|
|
563
576
|
}) : G({
|
|
@@ -565,12 +578,12 @@ function W(e) {
|
|
|
565
578
|
hitRegions: o,
|
|
566
579
|
state: "hover"
|
|
567
580
|
}
|
|
568
|
-
}),
|
|
581
|
+
}), Y();
|
|
569
582
|
break;
|
|
570
583
|
}
|
|
571
584
|
}
|
|
572
585
|
}
|
|
573
|
-
function
|
|
586
|
+
function ue(e) {
|
|
574
587
|
if (e.defaultPrevented)
|
|
575
588
|
return;
|
|
576
589
|
e.preventDefault();
|
|
@@ -582,10 +595,10 @@ function ae(e) {
|
|
|
582
595
|
interactionState: {
|
|
583
596
|
state: "inactive"
|
|
584
597
|
}
|
|
585
|
-
}),
|
|
598
|
+
}), Y();
|
|
586
599
|
}
|
|
587
600
|
}
|
|
588
|
-
function
|
|
601
|
+
function Xe(e) {
|
|
589
602
|
let t = 0, n = 0;
|
|
590
603
|
const o = {};
|
|
591
604
|
for (const i of e)
|
|
@@ -603,22 +616,25 @@ function Ue(e) {
|
|
|
603
616
|
}
|
|
604
617
|
return o;
|
|
605
618
|
}
|
|
606
|
-
function
|
|
619
|
+
function Ye(e, t, n) {
|
|
607
620
|
const o = n[0];
|
|
608
621
|
if (!o)
|
|
609
622
|
return;
|
|
610
623
|
const s = e.panels.find((a) => a.element === t);
|
|
611
624
|
if (!s || !s.onResize)
|
|
612
625
|
return;
|
|
613
|
-
const i =
|
|
614
|
-
s.onResize(
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
626
|
+
const i = Q({ group: e });
|
|
627
|
+
s.onResize(
|
|
628
|
+
{
|
|
629
|
+
asPercentage: L(
|
|
630
|
+
o.inlineSize / i * 100
|
|
631
|
+
),
|
|
632
|
+
inPixels: o.inlineSize
|
|
633
|
+
},
|
|
634
|
+
s.id
|
|
635
|
+
);
|
|
620
636
|
}
|
|
621
|
-
function
|
|
637
|
+
function q({
|
|
622
638
|
layout: e,
|
|
623
639
|
panelConstraints: t
|
|
624
640
|
}) {
|
|
@@ -630,57 +646,64 @@ function ve({
|
|
|
630
646
|
throw Error(
|
|
631
647
|
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
632
648
|
);
|
|
633
|
-
if (!
|
|
649
|
+
if (!w(s, 100) && o.length > 0)
|
|
634
650
|
for (let r = 0; r < t.length; r++) {
|
|
635
651
|
const l = o[r];
|
|
636
|
-
|
|
652
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
637
653
|
const c = 100 / s * l;
|
|
638
654
|
o[r] = c;
|
|
639
655
|
}
|
|
640
656
|
let i = 0;
|
|
641
657
|
for (let r = 0; r < t.length; r++) {
|
|
642
658
|
const l = o[r];
|
|
643
|
-
|
|
644
|
-
const c =
|
|
659
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
660
|
+
const c = D({
|
|
645
661
|
panelConstraints: t[r],
|
|
646
662
|
size: l
|
|
647
663
|
});
|
|
648
664
|
l != c && (i += l - c, o[r] = c);
|
|
649
665
|
}
|
|
650
|
-
if (!
|
|
666
|
+
if (!w(i, 0))
|
|
651
667
|
for (let r = 0; r < t.length; r++) {
|
|
652
668
|
const l = o[r];
|
|
653
|
-
|
|
654
|
-
const c = l + i, u =
|
|
669
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
670
|
+
const c = l + i, u = D({
|
|
655
671
|
panelConstraints: t[r],
|
|
656
672
|
size: c
|
|
657
673
|
});
|
|
658
|
-
if (l !== u && (i -= u - l, o[r] = u,
|
|
674
|
+
if (l !== u && (i -= u - l, o[r] = u, w(i, 0)))
|
|
659
675
|
break;
|
|
660
676
|
}
|
|
661
677
|
const a = Object.keys(e);
|
|
662
678
|
return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
|
|
663
679
|
}
|
|
664
|
-
function
|
|
680
|
+
function Ze(e) {
|
|
665
681
|
let t = !1;
|
|
666
682
|
const n = new ResizeObserver((l) => {
|
|
667
683
|
for (const c of l) {
|
|
668
|
-
const { borderBoxSize: u, target:
|
|
669
|
-
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
})
|
|
676
|
-
|
|
677
|
-
|
|
684
|
+
const { borderBoxSize: u, target: d } = c;
|
|
685
|
+
d === e.element ? t && G((p) => {
|
|
686
|
+
const m = p.mountedGroups.get(e);
|
|
687
|
+
if (m) {
|
|
688
|
+
const h = ae(e), f = m.layout, v = q({
|
|
689
|
+
layout: f,
|
|
690
|
+
panelConstraints: h
|
|
691
|
+
});
|
|
692
|
+
return {
|
|
693
|
+
mountedGroups: new Map(p.mountedGroups).set(e, {
|
|
694
|
+
derivedPanelConstraints: h,
|
|
695
|
+
layout: v
|
|
696
|
+
})
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
return p;
|
|
700
|
+
}) : Ye(e, d, u);
|
|
678
701
|
}
|
|
679
702
|
});
|
|
680
703
|
n.observe(e.element), e.panels.forEach((l) => {
|
|
681
704
|
l.onResize && n.observe(l.element);
|
|
682
705
|
});
|
|
683
|
-
const o =
|
|
706
|
+
const o = ae(e), s = e.panels.map(({ id: l }) => l).join(","), i = e.inMemoryLayouts[s] ?? e.defaultLayout ?? Xe(o), a = q({
|
|
684
707
|
layout: i,
|
|
685
708
|
panelConstraints: o
|
|
686
709
|
}), r = G((l) => ({
|
|
@@ -689,27 +712,27 @@ function Ve(e) {
|
|
|
689
712
|
layout: a
|
|
690
713
|
})
|
|
691
714
|
}));
|
|
692
|
-
return t = !0, r.mountedGroups.size === 1 && (window.addEventListener("pointerdown",
|
|
715
|
+
return t = !0, r.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ce), window.addEventListener("pointerleave", U), window.addEventListener("pointermove", U), window.addEventListener("pointerup", ue)), function() {
|
|
693
716
|
const c = G((u) => {
|
|
694
|
-
const
|
|
695
|
-
return
|
|
717
|
+
const d = new Map(u.mountedGroups);
|
|
718
|
+
return d.delete(e), { mountedGroups: d };
|
|
696
719
|
});
|
|
697
|
-
t = !1, c.mountedGroups.size === 0 && (window.removeEventListener("pointerdown",
|
|
720
|
+
t = !1, c.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ce), window.removeEventListener("pointerleave", U), window.removeEventListener("pointermove", U), window.removeEventListener("pointerup", ue)), n.disconnect();
|
|
698
721
|
};
|
|
699
722
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
723
|
+
function te(e) {
|
|
724
|
+
const t = Pe();
|
|
702
725
|
return `${e ?? t}`;
|
|
703
726
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
727
|
+
const _ = typeof window < "u" ? Ee : Ce;
|
|
728
|
+
function ne(e) {
|
|
706
729
|
const t = I(e);
|
|
707
|
-
return
|
|
730
|
+
return _(() => {
|
|
708
731
|
t.current = e;
|
|
709
|
-
}, [e]),
|
|
732
|
+
}, [e]), fe((n) => t.current?.(n), [t]);
|
|
710
733
|
}
|
|
711
|
-
function
|
|
712
|
-
return
|
|
734
|
+
function oe(...e) {
|
|
735
|
+
return ne((t) => {
|
|
713
736
|
e.forEach((n) => {
|
|
714
737
|
if (n)
|
|
715
738
|
switch (typeof n) {
|
|
@@ -725,18 +748,13 @@ function ee(...e) {
|
|
|
725
748
|
});
|
|
726
749
|
});
|
|
727
750
|
}
|
|
728
|
-
const
|
|
729
|
-
function
|
|
751
|
+
const Se = "--react-resizable-panels--panel--pointer-events";
|
|
752
|
+
function xe(e, t) {
|
|
730
753
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
731
754
|
return `--react-resizable-panels--${n}--${o}`;
|
|
732
755
|
}
|
|
733
|
-
const
|
|
734
|
-
function
|
|
735
|
-
return t.sort(
|
|
736
|
-
e === "horizontal" ? (n, o) => n.element.offsetLeft - o.element.offsetLeft : (n, o) => n.element.offsetTop - o.element.offsetTop
|
|
737
|
-
);
|
|
738
|
-
}
|
|
739
|
-
function Xe({
|
|
756
|
+
const ze = Me(null);
|
|
757
|
+
function qe({
|
|
740
758
|
groupId: e
|
|
741
759
|
}) {
|
|
742
760
|
const t = () => {
|
|
@@ -752,11 +770,11 @@ function Xe({
|
|
|
752
770
|
return n;
|
|
753
771
|
},
|
|
754
772
|
setLayout(n) {
|
|
755
|
-
const { derivedPanelConstraints: o, group: s, layout: i } = t(), a =
|
|
773
|
+
const { derivedPanelConstraints: o, group: s, layout: i } = t(), a = q({
|
|
756
774
|
layout: n,
|
|
757
775
|
panelConstraints: o
|
|
758
776
|
});
|
|
759
|
-
return
|
|
777
|
+
return ee(i, a) || G((r) => ({
|
|
760
778
|
mountedGroups: new Map(r.mountedGroups).set(s, {
|
|
761
779
|
derivedPanelConstraints: o,
|
|
762
780
|
layout: a
|
|
@@ -765,190 +783,182 @@ function Xe({
|
|
|
765
783
|
}
|
|
766
784
|
};
|
|
767
785
|
}
|
|
768
|
-
function
|
|
786
|
+
function Je(e, t) {
|
|
769
787
|
const n = I({
|
|
770
788
|
getLayout: () => ({}),
|
|
771
789
|
setLayout: Te
|
|
772
790
|
});
|
|
773
|
-
|
|
791
|
+
de(t, () => n.current, []), _(() => {
|
|
774
792
|
Object.assign(
|
|
775
793
|
n.current,
|
|
776
|
-
|
|
794
|
+
qe({ groupId: e })
|
|
777
795
|
);
|
|
778
796
|
});
|
|
779
797
|
}
|
|
780
|
-
function
|
|
798
|
+
function rt({
|
|
781
799
|
children: e,
|
|
782
800
|
className: t,
|
|
783
801
|
defaultLayout: n,
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
802
|
+
disableCursor: o,
|
|
803
|
+
disabled: s,
|
|
804
|
+
elementRef: i,
|
|
805
|
+
groupRef: a,
|
|
806
|
+
id: r,
|
|
807
|
+
onLayoutChange: l,
|
|
808
|
+
orientation: c = "horizontal",
|
|
791
809
|
style: u
|
|
792
810
|
}) {
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
}),
|
|
796
|
-
|
|
797
|
-
const we =
|
|
811
|
+
const d = I({}), p = ne((y) => {
|
|
812
|
+
ee(d.current, y) || (d.current = y, l?.(y));
|
|
813
|
+
}), m = te(r), [h, f] = M(!1), [v, g] = M(null), x = I({}), [z, S] = M(n ?? {}), [R, k] = M([]), [A, re] = M([]), be = oe(g, i);
|
|
814
|
+
Je(m, a);
|
|
815
|
+
const we = pe(
|
|
798
816
|
() => ({
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
registerPanel: (
|
|
802
|
-
k((
|
|
817
|
+
id: m,
|
|
818
|
+
orientation: c,
|
|
819
|
+
registerPanel: (y) => (k((b) => X(c, [...b, y])), () => {
|
|
820
|
+
k((b) => b.filter((N) => N !== y));
|
|
803
821
|
}),
|
|
804
|
-
registerSeparator: (
|
|
805
|
-
(
|
|
822
|
+
registerSeparator: (y) => (re(
|
|
823
|
+
(b) => X(c, [...b, y])
|
|
806
824
|
), () => {
|
|
807
|
-
|
|
808
|
-
(
|
|
825
|
+
re(
|
|
826
|
+
(b) => b.filter((N) => N !== y)
|
|
809
827
|
);
|
|
810
828
|
})
|
|
811
829
|
}),
|
|
812
|
-
[
|
|
830
|
+
[m, c]
|
|
813
831
|
);
|
|
814
|
-
|
|
832
|
+
_(() => {
|
|
815
833
|
if (v !== null && R.length > 0) {
|
|
816
|
-
const
|
|
834
|
+
const y = {
|
|
817
835
|
defaultLayout: n,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
disabled: !!i,
|
|
836
|
+
disableCursor: !!o,
|
|
837
|
+
disabled: !!s,
|
|
821
838
|
element: v,
|
|
822
|
-
id:
|
|
839
|
+
id: m,
|
|
823
840
|
inMemoryLayouts: x.current,
|
|
841
|
+
orientation: c,
|
|
824
842
|
panels: R,
|
|
825
843
|
separators: A
|
|
826
|
-
},
|
|
827
|
-
|
|
828
|
-
const
|
|
844
|
+
}, b = Ze(y), B = O().mountedGroups.get(y);
|
|
845
|
+
B && (S(B.layout), p?.(B.layout));
|
|
846
|
+
const Le = T.addListener(
|
|
829
847
|
"interactionStateChange",
|
|
830
|
-
(
|
|
831
|
-
switch (
|
|
848
|
+
(H) => {
|
|
849
|
+
switch (H.state) {
|
|
832
850
|
case "active":
|
|
833
851
|
case "hover": {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
($) => $.group ===
|
|
852
|
+
f(
|
|
853
|
+
H.hitRegions.some(
|
|
854
|
+
($) => $.group === y
|
|
837
855
|
)
|
|
838
856
|
);
|
|
839
857
|
break;
|
|
840
858
|
}
|
|
841
859
|
}
|
|
842
860
|
}
|
|
843
|
-
),
|
|
861
|
+
), Re = T.addListener(
|
|
844
862
|
"mountedGroupsChange",
|
|
845
|
-
(
|
|
846
|
-
const $ =
|
|
847
|
-
$ && $.derivedPanelConstraints.length > 0 && (
|
|
863
|
+
(H) => {
|
|
864
|
+
const $ = H.get(y);
|
|
865
|
+
$ && $.derivedPanelConstraints.length > 0 && (S($.layout), p?.($.layout));
|
|
848
866
|
}
|
|
849
867
|
);
|
|
850
868
|
return () => {
|
|
851
|
-
|
|
869
|
+
b(), Le(), Re();
|
|
852
870
|
};
|
|
853
871
|
}
|
|
854
872
|
}, [
|
|
855
873
|
n,
|
|
856
874
|
o,
|
|
857
875
|
s,
|
|
858
|
-
i,
|
|
859
876
|
v,
|
|
860
|
-
|
|
877
|
+
m,
|
|
861
878
|
p,
|
|
879
|
+
c,
|
|
862
880
|
R,
|
|
863
881
|
A
|
|
864
882
|
]);
|
|
865
|
-
const
|
|
866
|
-
[
|
|
883
|
+
const se = {
|
|
884
|
+
[Se]: h ? "none" : void 0
|
|
867
885
|
};
|
|
868
|
-
for (const
|
|
869
|
-
const
|
|
870
|
-
|
|
886
|
+
for (const y in z) {
|
|
887
|
+
const b = xe(m, y), N = z[y];
|
|
888
|
+
se[b] = N;
|
|
871
889
|
}
|
|
872
|
-
return /* @__PURE__ */ F(
|
|
890
|
+
return /* @__PURE__ */ F(ze.Provider, { value: we, children: /* @__PURE__ */ F(
|
|
873
891
|
"div",
|
|
874
892
|
{
|
|
893
|
+
"aria-orientation": c,
|
|
875
894
|
className: t,
|
|
876
|
-
"data-group":
|
|
877
|
-
|
|
878
|
-
"data-group-direction": o,
|
|
879
|
-
ref: ze,
|
|
895
|
+
"data-group": m,
|
|
896
|
+
ref: be,
|
|
880
897
|
style: {
|
|
881
898
|
...u,
|
|
882
|
-
...
|
|
899
|
+
...se,
|
|
883
900
|
display: "flex",
|
|
884
|
-
flexDirection:
|
|
885
|
-
flexWrap: "nowrap"
|
|
886
|
-
overflow: "hidden"
|
|
901
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
902
|
+
flexWrap: "nowrap"
|
|
887
903
|
},
|
|
888
904
|
children: e
|
|
889
905
|
}
|
|
890
906
|
) });
|
|
891
907
|
}
|
|
892
|
-
function
|
|
908
|
+
function J(e) {
|
|
893
909
|
return `react-resizable-panels:${e}`;
|
|
894
910
|
}
|
|
895
|
-
function
|
|
896
|
-
id: e,
|
|
897
|
-
storage: t
|
|
898
|
-
}) {
|
|
899
|
-
try {
|
|
900
|
-
const n = xe(e), o = t.getItem(n);
|
|
901
|
-
if (o)
|
|
902
|
-
return JSON.parse(o);
|
|
903
|
-
} catch (n) {
|
|
904
|
-
console.error(n);
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
function qe({
|
|
911
|
+
function Qe({
|
|
908
912
|
id: e,
|
|
909
913
|
layout: t,
|
|
910
914
|
storage: n
|
|
911
915
|
}) {
|
|
912
916
|
try {
|
|
913
|
-
const o =
|
|
917
|
+
const o = J(e);
|
|
914
918
|
n.setItem(o, JSON.stringify(t));
|
|
915
919
|
} catch (o) {
|
|
916
920
|
console.error(o);
|
|
917
921
|
}
|
|
918
922
|
}
|
|
919
|
-
function
|
|
923
|
+
function st({
|
|
920
924
|
groupId: e,
|
|
921
|
-
storage: t
|
|
925
|
+
storage: t
|
|
922
926
|
}) {
|
|
923
|
-
const n =
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
927
|
+
const n = Ge(
|
|
928
|
+
et,
|
|
929
|
+
() => t.getItem(J(e)),
|
|
930
|
+
() => t.getItem(J(e))
|
|
931
|
+
), o = pe(
|
|
932
|
+
() => n ? JSON.parse(n) : null,
|
|
933
|
+
[n]
|
|
934
|
+
), s = fe(
|
|
935
|
+
(i) => Qe({
|
|
930
936
|
id: e,
|
|
931
|
-
layout:
|
|
937
|
+
layout: i,
|
|
932
938
|
storage: t
|
|
933
939
|
}),
|
|
934
940
|
[e, t]
|
|
935
941
|
);
|
|
936
942
|
return {
|
|
937
|
-
defaultLayout:
|
|
938
|
-
onLayoutChange:
|
|
943
|
+
defaultLayout: o,
|
|
944
|
+
onLayoutChange: s
|
|
939
945
|
};
|
|
940
946
|
}
|
|
941
|
-
function
|
|
947
|
+
function et() {
|
|
948
|
+
return function() {
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function at() {
|
|
942
952
|
return M(null);
|
|
943
953
|
}
|
|
944
|
-
function
|
|
954
|
+
function lt() {
|
|
945
955
|
return I(null);
|
|
946
956
|
}
|
|
947
|
-
function
|
|
948
|
-
const e =
|
|
949
|
-
return
|
|
957
|
+
function ie() {
|
|
958
|
+
const e = Ie(ze);
|
|
959
|
+
return C(e, "Unexpected"), e;
|
|
950
960
|
}
|
|
951
|
-
function
|
|
961
|
+
function tt({
|
|
952
962
|
groupId: e,
|
|
953
963
|
panelId: t
|
|
954
964
|
}) {
|
|
@@ -986,7 +996,7 @@ function Je({
|
|
|
986
996
|
i();
|
|
987
997
|
},
|
|
988
998
|
getSize: () => {
|
|
989
|
-
const { group: a } = n(), r = i(), { element: l } = s(), c = a.
|
|
999
|
+
const { group: a } = n(), r = i(), { element: l } = s(), c = a.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
990
1000
|
return {
|
|
991
1001
|
asPercentage: r,
|
|
992
1002
|
inPixels: c
|
|
@@ -994,13 +1004,13 @@ function Je({
|
|
|
994
1004
|
},
|
|
995
1005
|
isCollapsed: () => {
|
|
996
1006
|
const { collapsible: a, collapsedSize: r } = o(), l = i();
|
|
997
|
-
return a &&
|
|
1007
|
+
return a && w(r, l);
|
|
998
1008
|
},
|
|
999
1009
|
resize: (a) => {
|
|
1000
1010
|
if (i() !== a)
|
|
1001
1011
|
switch (typeof a) {
|
|
1002
1012
|
case "number": {
|
|
1003
|
-
const { group: l } = n(), c =
|
|
1013
|
+
const { group: l } = n(), c = Q({ group: l });
|
|
1004
1014
|
L(a / c * 100);
|
|
1005
1015
|
break;
|
|
1006
1016
|
}
|
|
@@ -1008,25 +1018,25 @@ function Je({
|
|
|
1008
1018
|
}
|
|
1009
1019
|
};
|
|
1010
1020
|
}
|
|
1011
|
-
function
|
|
1012
|
-
const { id: n } =
|
|
1013
|
-
collapse:
|
|
1014
|
-
expand:
|
|
1021
|
+
function nt(e, t) {
|
|
1022
|
+
const { id: n } = ie(), o = I({
|
|
1023
|
+
collapse: V,
|
|
1024
|
+
expand: V,
|
|
1015
1025
|
getSize: () => ({
|
|
1016
1026
|
asPercentage: 0,
|
|
1017
1027
|
inPixels: 0
|
|
1018
1028
|
}),
|
|
1019
1029
|
isCollapsed: () => !1,
|
|
1020
|
-
resize:
|
|
1030
|
+
resize: V
|
|
1021
1031
|
});
|
|
1022
|
-
|
|
1032
|
+
de(t, () => o.current, []), _(() => {
|
|
1023
1033
|
Object.assign(
|
|
1024
1034
|
o.current,
|
|
1025
|
-
|
|
1035
|
+
tt({ groupId: n, panelId: e })
|
|
1026
1036
|
);
|
|
1027
1037
|
});
|
|
1028
1038
|
}
|
|
1029
|
-
function
|
|
1039
|
+
function ct({
|
|
1030
1040
|
children: e,
|
|
1031
1041
|
className: t,
|
|
1032
1042
|
collapsedSize: n = 0,
|
|
@@ -1038,18 +1048,18 @@ function st({
|
|
|
1038
1048
|
minSize: l = "0",
|
|
1039
1049
|
onResize: c,
|
|
1040
1050
|
panelRef: u,
|
|
1041
|
-
style:
|
|
1051
|
+
style: d
|
|
1042
1052
|
}) {
|
|
1043
|
-
const p = !!a,
|
|
1044
|
-
c?.(k);
|
|
1053
|
+
const p = !!a, m = te(a), [h, f] = M(null), v = oe(f, i), { id: g, registerPanel: x } = ie(), z = c !== null, S = ne((k) => {
|
|
1054
|
+
c?.(k, a);
|
|
1045
1055
|
});
|
|
1046
|
-
|
|
1047
|
-
if (
|
|
1056
|
+
_(() => {
|
|
1057
|
+
if (h !== null)
|
|
1048
1058
|
return x({
|
|
1049
|
-
element:
|
|
1050
|
-
id:
|
|
1059
|
+
element: h,
|
|
1060
|
+
id: m,
|
|
1051
1061
|
idIsStable: p,
|
|
1052
|
-
onResize: z ?
|
|
1062
|
+
onResize: z ? S : void 0,
|
|
1053
1063
|
panelConstraints: {
|
|
1054
1064
|
collapsedSize: n,
|
|
1055
1065
|
collapsible: o,
|
|
@@ -1062,21 +1072,20 @@ function st({
|
|
|
1062
1072
|
n,
|
|
1063
1073
|
o,
|
|
1064
1074
|
s,
|
|
1065
|
-
m,
|
|
1066
|
-
z,
|
|
1067
1075
|
h,
|
|
1076
|
+
z,
|
|
1077
|
+
m,
|
|
1068
1078
|
p,
|
|
1069
1079
|
r,
|
|
1070
1080
|
l,
|
|
1071
|
-
|
|
1081
|
+
S,
|
|
1072
1082
|
x
|
|
1073
|
-
]),
|
|
1074
|
-
const R =
|
|
1083
|
+
]), nt(m, u);
|
|
1084
|
+
const R = xe(g, m);
|
|
1075
1085
|
return /* @__PURE__ */ F(
|
|
1076
1086
|
"div",
|
|
1077
1087
|
{
|
|
1078
|
-
"data-panel":
|
|
1079
|
-
"data-panel-id": h,
|
|
1088
|
+
"data-panel": m,
|
|
1080
1089
|
ref: v,
|
|
1081
1090
|
style: {
|
|
1082
1091
|
flexBasis: 0,
|
|
@@ -1086,7 +1095,7 @@ function st({
|
|
|
1086
1095
|
overflow: "hidden",
|
|
1087
1096
|
// Disable pointer events inside of a panel during resize
|
|
1088
1097
|
// This avoid edge cases like nested iframes
|
|
1089
|
-
pointerEvents: `var(${
|
|
1098
|
+
pointerEvents: `var(${Se})`
|
|
1090
1099
|
},
|
|
1091
1100
|
children: /* @__PURE__ */ F(
|
|
1092
1101
|
"div",
|
|
@@ -1095,7 +1104,7 @@ function st({
|
|
|
1095
1104
|
style: {
|
|
1096
1105
|
width: "100%",
|
|
1097
1106
|
height: "100%",
|
|
1098
|
-
...
|
|
1107
|
+
...d
|
|
1099
1108
|
},
|
|
1100
1109
|
children: e
|
|
1101
1110
|
}
|
|
@@ -1103,65 +1112,67 @@ function st({
|
|
|
1103
1112
|
}
|
|
1104
1113
|
);
|
|
1105
1114
|
}
|
|
1106
|
-
function
|
|
1115
|
+
function ut() {
|
|
1107
1116
|
return M(null);
|
|
1108
1117
|
}
|
|
1109
|
-
function
|
|
1118
|
+
function ft() {
|
|
1110
1119
|
return I(null);
|
|
1111
1120
|
}
|
|
1112
|
-
function
|
|
1121
|
+
function dt({
|
|
1113
1122
|
children: e,
|
|
1114
1123
|
className: t,
|
|
1115
1124
|
elementRef: n,
|
|
1116
1125
|
id: o,
|
|
1117
1126
|
style: s
|
|
1118
1127
|
}) {
|
|
1119
|
-
const i =
|
|
1120
|
-
return
|
|
1128
|
+
const i = te(o), [a, r] = M(null), [l, c] = M("inactive"), u = oe(r, n), { orientation: d, registerSeparator: p } = ie(), m = d === "horizontal" ? "vertical" : "horizontal";
|
|
1129
|
+
return _(() => {
|
|
1121
1130
|
if (a !== null) {
|
|
1122
|
-
const
|
|
1131
|
+
const h = {
|
|
1123
1132
|
element: a,
|
|
1124
1133
|
id: i
|
|
1125
|
-
},
|
|
1134
|
+
}, f = p(h), v = T.addListener(
|
|
1126
1135
|
"interactionStateChange",
|
|
1127
|
-
(
|
|
1136
|
+
(g) => {
|
|
1128
1137
|
c(
|
|
1129
|
-
|
|
1130
|
-
(
|
|
1131
|
-
) ?
|
|
1138
|
+
g.state !== "inactive" && g.hitRegions.some(
|
|
1139
|
+
(x) => x.separator === h
|
|
1140
|
+
) ? g.state : "inactive"
|
|
1132
1141
|
);
|
|
1133
1142
|
}
|
|
1134
1143
|
);
|
|
1135
1144
|
return () => {
|
|
1136
|
-
|
|
1145
|
+
f(), v();
|
|
1137
1146
|
};
|
|
1138
1147
|
}
|
|
1139
|
-
}, [a, i,
|
|
1148
|
+
}, [a, i, p]), /* @__PURE__ */ F(
|
|
1140
1149
|
"div",
|
|
1141
1150
|
{
|
|
1151
|
+
"aria-orientation": m,
|
|
1142
1152
|
children: e,
|
|
1143
1153
|
className: t,
|
|
1144
|
-
"data-separator":
|
|
1145
|
-
"data-separator-id": i,
|
|
1154
|
+
"data-separator": i,
|
|
1146
1155
|
"data-separator-state": l,
|
|
1147
1156
|
ref: u,
|
|
1157
|
+
role: "separator",
|
|
1148
1158
|
style: {
|
|
1149
1159
|
flexBasis: "auto",
|
|
1150
1160
|
...s,
|
|
1151
1161
|
flexGrow: 0,
|
|
1152
1162
|
flexShrink: 0
|
|
1153
|
-
}
|
|
1163
|
+
},
|
|
1164
|
+
tabIndex: 0
|
|
1154
1165
|
}
|
|
1155
1166
|
);
|
|
1156
1167
|
}
|
|
1157
1168
|
export {
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1169
|
+
rt as Group,
|
|
1170
|
+
ct as Panel,
|
|
1171
|
+
dt as Separator,
|
|
1172
|
+
st as useDefaultLayout,
|
|
1173
|
+
at as useGroupCallbackRef,
|
|
1174
|
+
lt as useGroupRef,
|
|
1175
|
+
ut as usePanelCallbackRef,
|
|
1176
|
+
ft as usePanelRef
|
|
1166
1177
|
};
|
|
1167
1178
|
//# sourceMappingURL=react-resizable-panels.js.map
|