react-resizable-panels 4.0.8-alpha.0 → 4.0.8-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,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useId as _e, useLayoutEffect as Fe, useEffect as He, useRef as T, useCallback as ze, createContext as
|
|
2
|
+
import { jsx as W } from "react/jsx-runtime";
|
|
3
|
+
import { useId as _e, useLayoutEffect as Fe, useEffect as He, useRef as T, useCallback as ze, createContext as We, useImperativeHandle as be, useSyncExternalStore as we, useState as G, useMemo as Le, useContext as je } from "react";
|
|
4
4
|
function z(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
7
7
|
}
|
|
8
8
|
function re(e, t) {
|
|
9
9
|
return t.sort(
|
|
10
|
-
e === "horizontal" ?
|
|
10
|
+
e === "horizontal" ? Ve : Be
|
|
11
11
|
);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function Ve(e, t) {
|
|
14
14
|
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
15
15
|
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
16
16
|
}
|
|
@@ -22,26 +22,26 @@ function ee({
|
|
|
22
22
|
group: e
|
|
23
23
|
}) {
|
|
24
24
|
const { orientation: t, panels: n } = e;
|
|
25
|
-
return n.reduce((o,
|
|
25
|
+
return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
|
|
26
26
|
}
|
|
27
27
|
function Pe(e) {
|
|
28
|
-
const { element: t, orientation: n, panels: o, separators:
|
|
28
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, s = re(
|
|
29
29
|
n,
|
|
30
|
-
Array.from(t.children).filter((
|
|
31
|
-
).map(({ element:
|
|
32
|
-
let i,
|
|
33
|
-
for (const
|
|
34
|
-
const
|
|
35
|
-
(u) => u.element ===
|
|
30
|
+
Array.from(t.children).filter((l) => l instanceof HTMLElement).map((l) => ({ element: l }))
|
|
31
|
+
).map(({ element: l }) => l), c = [];
|
|
32
|
+
let i, a;
|
|
33
|
+
for (const l of s) {
|
|
34
|
+
const f = o.find(
|
|
35
|
+
(u) => u.element === l
|
|
36
36
|
);
|
|
37
|
-
if (
|
|
37
|
+
if (f) {
|
|
38
38
|
if (i) {
|
|
39
|
-
const u = i.element.getBoundingClientRect(), h =
|
|
40
|
-
|
|
39
|
+
const u = i.element.getBoundingClientRect(), h = l.getBoundingClientRect();
|
|
40
|
+
c.push({
|
|
41
41
|
group: e,
|
|
42
42
|
groupSize: ee({ group: e }),
|
|
43
|
-
panels: [i,
|
|
44
|
-
separator:
|
|
43
|
+
panels: [i, f],
|
|
44
|
+
separator: a,
|
|
45
45
|
rect: n === "horizontal" ? new DOMRect(
|
|
46
46
|
u.right,
|
|
47
47
|
h.top,
|
|
@@ -55,15 +55,15 @@ function Pe(e) {
|
|
|
55
55
|
)
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
|
-
i =
|
|
58
|
+
i = f, a = void 0;
|
|
59
59
|
} else {
|
|
60
|
-
const u =
|
|
61
|
-
(h) => h.element ===
|
|
60
|
+
const u = r.find(
|
|
61
|
+
(h) => h.element === l
|
|
62
62
|
);
|
|
63
|
-
u ?
|
|
63
|
+
u ? a = u : (i = void 0, a = void 0);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return c;
|
|
67
67
|
}
|
|
68
68
|
function Ue(e, t) {
|
|
69
69
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
@@ -95,30 +95,30 @@ function Z({
|
|
|
95
95
|
styleProp: n
|
|
96
96
|
}) {
|
|
97
97
|
let o;
|
|
98
|
-
const [
|
|
99
|
-
switch (
|
|
98
|
+
const [r, s] = qe(n);
|
|
99
|
+
switch (s) {
|
|
100
100
|
case "%": {
|
|
101
|
-
o =
|
|
101
|
+
o = r / 100 * e;
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
104
|
case "px": {
|
|
105
|
-
o =
|
|
105
|
+
o = r;
|
|
106
106
|
break;
|
|
107
107
|
}
|
|
108
108
|
case "rem": {
|
|
109
|
-
o = Ke(t,
|
|
109
|
+
o = Ke(t, r);
|
|
110
110
|
break;
|
|
111
111
|
}
|
|
112
112
|
case "em": {
|
|
113
|
-
o = Ue(t,
|
|
113
|
+
o = Ue(t, r);
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
116
|
case "vh": {
|
|
117
|
-
o = Xe(
|
|
117
|
+
o = Xe(r);
|
|
118
118
|
break;
|
|
119
119
|
}
|
|
120
120
|
case "vw": {
|
|
121
|
-
o = Ye(
|
|
121
|
+
o = Ye(r);
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -128,62 +128,59 @@ function I(e) {
|
|
|
128
128
|
return parseFloat(e.toFixed(3));
|
|
129
129
|
}
|
|
130
130
|
function me(e) {
|
|
131
|
-
const {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
groupSize: o,
|
|
148
|
-
panelElement: a,
|
|
149
|
-
styleProp: l.collapsedSize
|
|
131
|
+
const { panels: t } = e, n = ee({ group: e });
|
|
132
|
+
return n === 0 ? t.map((o) => ({
|
|
133
|
+
collapsedSize: 0,
|
|
134
|
+
collapsible: o.panelConstraints.collapsible === !0,
|
|
135
|
+
defaultSize: void 0,
|
|
136
|
+
minSize: 0,
|
|
137
|
+
maxSize: 100,
|
|
138
|
+
panelId: o.id
|
|
139
|
+
})) : t.map((o) => {
|
|
140
|
+
const { element: r, panelConstraints: s } = o;
|
|
141
|
+
let c = 0;
|
|
142
|
+
if (s.collapsedSize) {
|
|
143
|
+
const f = Z({
|
|
144
|
+
groupSize: n,
|
|
145
|
+
panelElement: r,
|
|
146
|
+
styleProp: s.collapsedSize
|
|
150
147
|
});
|
|
151
|
-
|
|
148
|
+
c = I(f / n * 100);
|
|
152
149
|
}
|
|
153
|
-
let
|
|
154
|
-
if (
|
|
155
|
-
const
|
|
156
|
-
groupSize:
|
|
157
|
-
panelElement:
|
|
158
|
-
styleProp:
|
|
150
|
+
let i;
|
|
151
|
+
if (s.defaultSize) {
|
|
152
|
+
const f = Z({
|
|
153
|
+
groupSize: n,
|
|
154
|
+
panelElement: r,
|
|
155
|
+
styleProp: s.defaultSize
|
|
159
156
|
});
|
|
160
|
-
|
|
157
|
+
i = I(f / n * 100);
|
|
161
158
|
}
|
|
162
|
-
let
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
groupSize:
|
|
166
|
-
panelElement:
|
|
167
|
-
styleProp:
|
|
159
|
+
let a = 0;
|
|
160
|
+
if (s.minSize) {
|
|
161
|
+
const f = Z({
|
|
162
|
+
groupSize: n,
|
|
163
|
+
panelElement: r,
|
|
164
|
+
styleProp: s.minSize
|
|
168
165
|
});
|
|
169
|
-
|
|
166
|
+
a = I(f / n * 100);
|
|
170
167
|
}
|
|
171
|
-
let
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
groupSize:
|
|
175
|
-
panelElement:
|
|
176
|
-
styleProp:
|
|
168
|
+
let l = 100;
|
|
169
|
+
if (s.maxSize) {
|
|
170
|
+
const f = Z({
|
|
171
|
+
groupSize: n,
|
|
172
|
+
panelElement: r,
|
|
173
|
+
styleProp: s.maxSize
|
|
177
174
|
});
|
|
178
|
-
|
|
175
|
+
l = I(f / n * 100);
|
|
179
176
|
}
|
|
180
177
|
return {
|
|
181
|
-
collapsedSize:
|
|
182
|
-
collapsible:
|
|
183
|
-
defaultSize:
|
|
184
|
-
minSize:
|
|
185
|
-
maxSize:
|
|
186
|
-
panelId:
|
|
178
|
+
collapsedSize: c,
|
|
179
|
+
collapsible: s.collapsible === !0,
|
|
180
|
+
defaultSize: i,
|
|
181
|
+
minSize: a,
|
|
182
|
+
maxSize: l,
|
|
183
|
+
panelId: o.id
|
|
187
184
|
};
|
|
188
185
|
});
|
|
189
186
|
}
|
|
@@ -201,18 +198,18 @@ class Ze {
|
|
|
201
198
|
if (o.length === 1)
|
|
202
199
|
o[0].call(null, n);
|
|
203
200
|
else {
|
|
204
|
-
let
|
|
205
|
-
const
|
|
206
|
-
for (let i = 0; i <
|
|
207
|
-
const
|
|
201
|
+
let r = !1, s = null;
|
|
202
|
+
const c = Array.from(o);
|
|
203
|
+
for (let i = 0; i < c.length; i++) {
|
|
204
|
+
const a = c[i];
|
|
208
205
|
try {
|
|
209
|
-
|
|
210
|
-
} catch (
|
|
211
|
-
|
|
206
|
+
a.call(null, n);
|
|
207
|
+
} catch (l) {
|
|
208
|
+
s === null && (r = !0, s = l);
|
|
212
209
|
}
|
|
213
210
|
}
|
|
214
|
-
if (
|
|
215
|
-
throw
|
|
211
|
+
if (r)
|
|
212
|
+
throw s;
|
|
216
213
|
}
|
|
217
214
|
}
|
|
218
215
|
removeAllListeners() {
|
|
@@ -221,8 +218,8 @@ class Ze {
|
|
|
221
218
|
removeListener(t, n) {
|
|
222
219
|
const o = this.#e[t];
|
|
223
220
|
if (o !== void 0) {
|
|
224
|
-
const
|
|
225
|
-
|
|
221
|
+
const r = o.indexOf(n);
|
|
222
|
+
r >= 0 && o.splice(r, 1);
|
|
226
223
|
}
|
|
227
224
|
}
|
|
228
225
|
}
|
|
@@ -248,19 +245,19 @@ function C(e) {
|
|
|
248
245
|
return R = {
|
|
249
246
|
...R,
|
|
250
247
|
...t
|
|
251
|
-
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o,
|
|
252
|
-
o.derivedPanelConstraints.forEach((
|
|
253
|
-
if (
|
|
254
|
-
const { layout:
|
|
255
|
-
if (
|
|
248
|
+
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, r) => {
|
|
249
|
+
o.derivedPanelConstraints.forEach((s) => {
|
|
250
|
+
if (s.collapsible) {
|
|
251
|
+
const { layout: c } = n.mountedGroups.get(r) ?? {};
|
|
252
|
+
if (c) {
|
|
256
253
|
const i = w(
|
|
257
|
-
|
|
258
|
-
o.layout[
|
|
259
|
-
),
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
s.collapsedSize,
|
|
255
|
+
o.layout[s.panelId]
|
|
256
|
+
), a = w(
|
|
257
|
+
s.collapsedSize,
|
|
258
|
+
c[s.panelId]
|
|
262
259
|
);
|
|
263
|
-
i && !
|
|
260
|
+
i && !a && (r.inMemoryLastExpandedPanelSizes[s.panelId] = c[s.panelId]);
|
|
264
261
|
}
|
|
265
262
|
}
|
|
266
263
|
});
|
|
@@ -276,43 +273,43 @@ function Qe({
|
|
|
276
273
|
groups: t,
|
|
277
274
|
state: n
|
|
278
275
|
}) {
|
|
279
|
-
let o = 0,
|
|
276
|
+
let o = 0, r = 0;
|
|
280
277
|
switch (n) {
|
|
281
278
|
case "active":
|
|
282
279
|
case "hover":
|
|
283
|
-
t.forEach((
|
|
284
|
-
if (!
|
|
285
|
-
switch (
|
|
280
|
+
t.forEach((s) => {
|
|
281
|
+
if (!s.disableCursor)
|
|
282
|
+
switch (s.orientation) {
|
|
286
283
|
case "horizontal": {
|
|
287
284
|
o++;
|
|
288
285
|
break;
|
|
289
286
|
}
|
|
290
287
|
case "vertical": {
|
|
291
|
-
|
|
288
|
+
r++;
|
|
292
289
|
break;
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
292
|
});
|
|
296
293
|
}
|
|
297
|
-
if (o === 0 &&
|
|
294
|
+
if (o === 0 && r === 0)
|
|
298
295
|
return null;
|
|
299
296
|
switch (n) {
|
|
300
297
|
case "active": {
|
|
301
|
-
const
|
|
298
|
+
const s = (e & Ee) !== 0, c = (e & Re) !== 0, i = (e & Ce) !== 0, a = (e & Me) !== 0;
|
|
302
299
|
if (e) {
|
|
303
|
-
if (
|
|
304
|
-
return i ? "se-resize" :
|
|
305
|
-
if (
|
|
306
|
-
return i ? "sw-resize" :
|
|
300
|
+
if (s)
|
|
301
|
+
return i ? "se-resize" : a ? "ne-resize" : "e-resize";
|
|
302
|
+
if (c)
|
|
303
|
+
return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
|
|
307
304
|
if (i)
|
|
308
305
|
return "s-resize";
|
|
309
|
-
if (
|
|
306
|
+
if (a)
|
|
310
307
|
return "n-resize";
|
|
311
308
|
}
|
|
312
309
|
break;
|
|
313
310
|
}
|
|
314
311
|
}
|
|
315
|
-
return o > 0 &&
|
|
312
|
+
return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
316
313
|
}
|
|
317
314
|
let se, k;
|
|
318
315
|
function le() {
|
|
@@ -323,7 +320,7 @@ function le() {
|
|
|
323
320
|
case "hover": {
|
|
324
321
|
const n = Qe({
|
|
325
322
|
cursorFlags: e,
|
|
326
|
-
groups: t.hitRegions.map((
|
|
323
|
+
groups: t.hitRegions.map((r) => r.group),
|
|
327
324
|
state: t.state
|
|
328
325
|
}), o = `*{cursor: ${n} !important; ${t.state === "active" ? "touch-action: none;" : ""} }`;
|
|
329
326
|
if (se === o)
|
|
@@ -345,7 +342,7 @@ function et(e, t) {
|
|
|
345
342
|
return !1;
|
|
346
343
|
return !0;
|
|
347
344
|
}
|
|
348
|
-
function
|
|
345
|
+
function j(e, t) {
|
|
349
346
|
return w(e, t) ? 0 : e > t ? 1 : -1;
|
|
350
347
|
}
|
|
351
348
|
function F({
|
|
@@ -355,36 +352,36 @@ function F({
|
|
|
355
352
|
const {
|
|
356
353
|
collapsedSize: n = 0,
|
|
357
354
|
collapsible: o,
|
|
358
|
-
maxSize:
|
|
359
|
-
minSize:
|
|
355
|
+
maxSize: r = 100,
|
|
356
|
+
minSize: s = 0
|
|
360
357
|
} = e;
|
|
361
|
-
if (
|
|
358
|
+
if (j(t, s) < 0)
|
|
362
359
|
if (o) {
|
|
363
|
-
const
|
|
364
|
-
|
|
360
|
+
const c = (n + s) / 2;
|
|
361
|
+
j(t, c) < 0 ? t = n : t = s;
|
|
365
362
|
} else
|
|
366
|
-
t =
|
|
367
|
-
return t = Math.min(
|
|
363
|
+
t = s;
|
|
364
|
+
return t = Math.min(r, t), t = I(t), t;
|
|
368
365
|
}
|
|
369
|
-
function
|
|
366
|
+
function V({
|
|
370
367
|
delta: e,
|
|
371
368
|
initialLayout: t,
|
|
372
369
|
panelConstraints: n,
|
|
373
370
|
pivotIndices: o,
|
|
374
|
-
prevLayout:
|
|
375
|
-
trigger:
|
|
371
|
+
prevLayout: r,
|
|
372
|
+
trigger: s
|
|
376
373
|
}) {
|
|
377
374
|
if (w(e, 0))
|
|
378
375
|
return t;
|
|
379
|
-
const
|
|
380
|
-
z(
|
|
376
|
+
const c = Object.values(t), i = Object.values(r), a = [...c], [l, f] = o;
|
|
377
|
+
z(l != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
|
|
381
378
|
let u = 0;
|
|
382
|
-
if (
|
|
379
|
+
if (s === "keyboard") {
|
|
383
380
|
{
|
|
384
|
-
const
|
|
381
|
+
const d = e < 0 ? f : l, p = n[d];
|
|
385
382
|
z(
|
|
386
383
|
p,
|
|
387
|
-
`Panel constraints not found for index ${
|
|
384
|
+
`Panel constraints not found for index ${d}`
|
|
388
385
|
);
|
|
389
386
|
const {
|
|
390
387
|
collapsedSize: v = 0,
|
|
@@ -392,21 +389,21 @@ function j({
|
|
|
392
389
|
minSize: x = 0
|
|
393
390
|
} = p;
|
|
394
391
|
if (m) {
|
|
395
|
-
const S =
|
|
392
|
+
const S = c[d];
|
|
396
393
|
if (z(
|
|
397
394
|
S != null,
|
|
398
|
-
`Previous layout not found for panel index ${
|
|
395
|
+
`Previous layout not found for panel index ${d}`
|
|
399
396
|
), w(S, v)) {
|
|
400
397
|
const g = x - S;
|
|
401
|
-
|
|
398
|
+
j(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
402
399
|
}
|
|
403
400
|
}
|
|
404
401
|
}
|
|
405
402
|
{
|
|
406
|
-
const
|
|
403
|
+
const d = e < 0 ? l : f, p = n[d];
|
|
407
404
|
z(
|
|
408
405
|
p,
|
|
409
|
-
`No panel constraints found for index ${
|
|
406
|
+
`No panel constraints found for index ${d}`
|
|
410
407
|
);
|
|
411
408
|
const {
|
|
412
409
|
collapsedSize: v = 0,
|
|
@@ -414,22 +411,22 @@ function j({
|
|
|
414
411
|
minSize: x = 0
|
|
415
412
|
} = p;
|
|
416
413
|
if (m) {
|
|
417
|
-
const S =
|
|
414
|
+
const S = c[d];
|
|
418
415
|
if (z(
|
|
419
416
|
S != null,
|
|
420
|
-
`Previous layout not found for panel index ${
|
|
417
|
+
`Previous layout not found for panel index ${d}`
|
|
421
418
|
), w(S, x)) {
|
|
422
419
|
const g = S - v;
|
|
423
|
-
|
|
420
|
+
j(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
424
421
|
}
|
|
425
422
|
}
|
|
426
423
|
}
|
|
427
424
|
}
|
|
428
425
|
{
|
|
429
|
-
const
|
|
430
|
-
let p = e < 0 ?
|
|
426
|
+
const d = e < 0 ? 1 : -1;
|
|
427
|
+
let p = e < 0 ? f : l, v = 0;
|
|
431
428
|
for (; ; ) {
|
|
432
|
-
const x =
|
|
429
|
+
const x = c[p];
|
|
433
430
|
z(
|
|
434
431
|
x != null,
|
|
435
432
|
`Previous layout not found for panel index ${p}`
|
|
@@ -438,16 +435,16 @@ function j({
|
|
|
438
435
|
panelConstraints: n[p],
|
|
439
436
|
size: 100
|
|
440
437
|
}) - x;
|
|
441
|
-
if (v += g, p +=
|
|
438
|
+
if (v += g, p += d, p < 0 || p >= n.length)
|
|
442
439
|
break;
|
|
443
440
|
}
|
|
444
441
|
const m = Math.min(Math.abs(e), Math.abs(v));
|
|
445
442
|
e = e < 0 ? 0 - m : m;
|
|
446
443
|
}
|
|
447
444
|
{
|
|
448
|
-
let p = e < 0 ?
|
|
445
|
+
let p = e < 0 ? l : f;
|
|
449
446
|
for (; p >= 0 && p < n.length; ) {
|
|
450
|
-
const v = Math.abs(e) - Math.abs(u), m =
|
|
447
|
+
const v = Math.abs(e) - Math.abs(u), m = c[p];
|
|
451
448
|
z(
|
|
452
449
|
m != null,
|
|
453
450
|
`Previous layout not found for panel index ${p}`
|
|
@@ -456,29 +453,29 @@ function j({
|
|
|
456
453
|
panelConstraints: n[p],
|
|
457
454
|
size: x
|
|
458
455
|
});
|
|
459
|
-
if (!w(m, S) && (u += m - S,
|
|
456
|
+
if (!w(m, S) && (u += m - S, a[p] = S, u.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
460
457
|
numeric: !0
|
|
461
458
|
}) >= 0))
|
|
462
459
|
break;
|
|
463
460
|
e < 0 ? p-- : p++;
|
|
464
461
|
}
|
|
465
462
|
}
|
|
466
|
-
if (et(i,
|
|
467
|
-
return
|
|
463
|
+
if (et(i, a))
|
|
464
|
+
return r;
|
|
468
465
|
{
|
|
469
|
-
const
|
|
466
|
+
const d = e < 0 ? f : l, p = c[d];
|
|
470
467
|
z(
|
|
471
468
|
p != null,
|
|
472
|
-
`Previous layout not found for panel index ${
|
|
469
|
+
`Previous layout not found for panel index ${d}`
|
|
473
470
|
);
|
|
474
471
|
const v = p + u, m = F({
|
|
475
|
-
panelConstraints: n[
|
|
472
|
+
panelConstraints: n[d],
|
|
476
473
|
size: v
|
|
477
474
|
});
|
|
478
|
-
if (
|
|
479
|
-
let x = v - m, g = e < 0 ?
|
|
475
|
+
if (a[d] = m, !w(m, v)) {
|
|
476
|
+
let x = v - m, g = e < 0 ? f : l;
|
|
480
477
|
for (; g >= 0 && g < n.length; ) {
|
|
481
|
-
const L =
|
|
478
|
+
const L = a[g];
|
|
482
479
|
z(
|
|
483
480
|
L != null,
|
|
484
481
|
`Previous layout not found for panel index ${g}`
|
|
@@ -487,26 +484,26 @@ function j({
|
|
|
487
484
|
panelConstraints: n[g],
|
|
488
485
|
size: P
|
|
489
486
|
});
|
|
490
|
-
if (w(L, E) || (x -= E - L,
|
|
487
|
+
if (w(L, E) || (x -= E - L, a[g] = E), w(x, 0))
|
|
491
488
|
break;
|
|
492
489
|
e > 0 ? g-- : g++;
|
|
493
490
|
}
|
|
494
491
|
}
|
|
495
492
|
}
|
|
496
|
-
const h = Object.values(
|
|
497
|
-
(
|
|
493
|
+
const h = Object.values(a).reduce(
|
|
494
|
+
(d, p) => p + d,
|
|
498
495
|
0
|
|
499
496
|
);
|
|
500
497
|
if (!w(h, 100, 0.1))
|
|
501
|
-
return
|
|
502
|
-
const y = Object.keys(
|
|
503
|
-
return
|
|
498
|
+
return r;
|
|
499
|
+
const y = Object.keys(r);
|
|
500
|
+
return a.reduce((d, p, v) => (d[y[v]] = p, d), {});
|
|
504
501
|
}
|
|
505
502
|
function B(e, t) {
|
|
506
503
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
507
504
|
return !1;
|
|
508
505
|
for (const n in e)
|
|
509
|
-
if (
|
|
506
|
+
if (j(e[n], t[n]) !== 0)
|
|
510
507
|
return !1;
|
|
511
508
|
return !0;
|
|
512
509
|
}
|
|
@@ -515,42 +512,42 @@ function Ge({
|
|
|
515
512
|
hitRegions: t,
|
|
516
513
|
initialLayoutMap: n,
|
|
517
514
|
mountedGroups: o,
|
|
518
|
-
pointerDownAtPoint:
|
|
515
|
+
pointerDownAtPoint: r
|
|
519
516
|
}) {
|
|
520
|
-
let
|
|
521
|
-
const
|
|
517
|
+
let s = 0;
|
|
518
|
+
const c = new Map(o);
|
|
522
519
|
t.forEach((i) => {
|
|
523
|
-
const { group:
|
|
520
|
+
const { group: a, groupSize: l } = i, { disableCursor: f, orientation: u, panels: h } = a;
|
|
524
521
|
let y = 0;
|
|
525
|
-
|
|
526
|
-
const
|
|
522
|
+
r ? u === "horizontal" ? y = (e.clientX - r.x) / l * 100 : y = (e.clientY - r.y) / l * 100 : u === "horizontal" ? y = e.clientX < 0 ? -100 : 100 : y = e.clientY < 0 ? -100 : 100;
|
|
523
|
+
const d = n.get(a), {
|
|
527
524
|
derivedPanelConstraints: p,
|
|
528
525
|
layout: v,
|
|
529
526
|
separatorToPanels: m
|
|
530
|
-
} = o.get(
|
|
531
|
-
if (p &&
|
|
532
|
-
const x =
|
|
527
|
+
} = o.get(a) ?? {};
|
|
528
|
+
if (p && d && v && m) {
|
|
529
|
+
const x = V({
|
|
533
530
|
delta: y,
|
|
534
|
-
initialLayout:
|
|
531
|
+
initialLayout: d,
|
|
535
532
|
panelConstraints: p,
|
|
536
533
|
pivotIndices: i.panels.map((S) => h.indexOf(S)),
|
|
537
534
|
prevLayout: v,
|
|
538
535
|
trigger: "mouse-or-touch"
|
|
539
536
|
});
|
|
540
537
|
if (B(x, v)) {
|
|
541
|
-
if (y !== 0 && !
|
|
538
|
+
if (y !== 0 && !f)
|
|
542
539
|
switch (u) {
|
|
543
540
|
case "horizontal": {
|
|
544
|
-
|
|
541
|
+
s |= y < 0 ? Ee : Re;
|
|
545
542
|
break;
|
|
546
543
|
}
|
|
547
544
|
case "vertical": {
|
|
548
|
-
|
|
545
|
+
s |= y < 0 ? Ce : Me;
|
|
549
546
|
break;
|
|
550
547
|
}
|
|
551
548
|
}
|
|
552
549
|
} else {
|
|
553
|
-
|
|
550
|
+
c.set(i.group, {
|
|
554
551
|
derivedPanelConstraints: p,
|
|
555
552
|
layout: x,
|
|
556
553
|
separatorToPanels: m
|
|
@@ -560,8 +557,8 @@ function Ge({
|
|
|
560
557
|
}
|
|
561
558
|
}
|
|
562
559
|
}), C({
|
|
563
|
-
cursorFlags:
|
|
564
|
-
mountedGroups:
|
|
560
|
+
cursorFlags: s,
|
|
561
|
+
mountedGroups: c
|
|
565
562
|
}), le();
|
|
566
563
|
}
|
|
567
564
|
function ve(e) {
|
|
@@ -597,53 +594,53 @@ function $({
|
|
|
597
594
|
layout: e,
|
|
598
595
|
panelConstraints: t
|
|
599
596
|
}) {
|
|
600
|
-
const o = [...Object.values(e)],
|
|
601
|
-
(i,
|
|
597
|
+
const o = [...Object.values(e)], r = o.reduce(
|
|
598
|
+
(i, a) => i + a,
|
|
602
599
|
0
|
|
603
600
|
);
|
|
604
601
|
if (o.length !== t.length)
|
|
605
602
|
throw Error(
|
|
606
603
|
`Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
|
|
607
604
|
);
|
|
608
|
-
if (!w(
|
|
605
|
+
if (!w(r, 100) && o.length > 0)
|
|
609
606
|
for (let i = 0; i < t.length; i++) {
|
|
610
|
-
const
|
|
611
|
-
z(
|
|
612
|
-
const
|
|
613
|
-
o[i] =
|
|
607
|
+
const a = o[i];
|
|
608
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
609
|
+
const l = 100 / r * a;
|
|
610
|
+
o[i] = l;
|
|
614
611
|
}
|
|
615
|
-
let
|
|
612
|
+
let s = 0;
|
|
616
613
|
for (let i = 0; i < t.length; i++) {
|
|
617
|
-
const
|
|
618
|
-
z(
|
|
619
|
-
const
|
|
614
|
+
const a = o[i];
|
|
615
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
616
|
+
const l = F({
|
|
620
617
|
panelConstraints: t[i],
|
|
621
|
-
size:
|
|
618
|
+
size: a
|
|
622
619
|
});
|
|
623
|
-
|
|
620
|
+
a != l && (s += a - l, o[i] = l);
|
|
624
621
|
}
|
|
625
|
-
if (!w(
|
|
622
|
+
if (!w(s, 0))
|
|
626
623
|
for (let i = 0; i < t.length; i++) {
|
|
627
|
-
const
|
|
628
|
-
z(
|
|
629
|
-
const
|
|
624
|
+
const a = o[i];
|
|
625
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
626
|
+
const l = a + s, f = F({
|
|
630
627
|
panelConstraints: t[i],
|
|
631
|
-
size:
|
|
628
|
+
size: l
|
|
632
629
|
});
|
|
633
|
-
if (
|
|
630
|
+
if (a !== f && (s -= f - a, o[i] = f, w(s, 0)))
|
|
634
631
|
break;
|
|
635
632
|
}
|
|
636
|
-
const
|
|
637
|
-
return o.reduce((i,
|
|
633
|
+
const c = Object.keys(e);
|
|
634
|
+
return o.reduce((i, a, l) => (i[c[l]] = a, i), {});
|
|
638
635
|
}
|
|
639
636
|
function Ie({
|
|
640
637
|
groupId: e
|
|
641
638
|
}) {
|
|
642
639
|
const t = () => {
|
|
643
640
|
const { mountedGroups: n } = O();
|
|
644
|
-
for (const [o,
|
|
641
|
+
for (const [o, r] of n)
|
|
645
642
|
if (o.id === e)
|
|
646
|
-
return { group: o, ...
|
|
643
|
+
return { group: o, ...r };
|
|
647
644
|
throw Error(`Group ${e} not found`);
|
|
648
645
|
};
|
|
649
646
|
return {
|
|
@@ -654,18 +651,18 @@ function Ie({
|
|
|
654
651
|
setLayout(n) {
|
|
655
652
|
const {
|
|
656
653
|
derivedPanelConstraints: o,
|
|
657
|
-
group:
|
|
658
|
-
layout:
|
|
659
|
-
separatorToPanels:
|
|
654
|
+
group: r,
|
|
655
|
+
layout: s,
|
|
656
|
+
separatorToPanels: c
|
|
660
657
|
} = t(), i = $({
|
|
661
658
|
layout: n,
|
|
662
659
|
panelConstraints: o
|
|
663
660
|
});
|
|
664
|
-
return B(
|
|
665
|
-
mountedGroups: new Map(
|
|
661
|
+
return B(s, i) || C((a) => ({
|
|
662
|
+
mountedGroups: new Map(a.mountedGroups).set(r, {
|
|
666
663
|
derivedPanelConstraints: o,
|
|
667
664
|
layout: i,
|
|
668
|
-
separatorToPanels:
|
|
665
|
+
separatorToPanels: c
|
|
669
666
|
})
|
|
670
667
|
})), i;
|
|
671
668
|
}
|
|
@@ -676,27 +673,27 @@ function ke(e) {
|
|
|
676
673
|
return z(n, `Mounted Group ${e.id} not found`), n;
|
|
677
674
|
}
|
|
678
675
|
function D(e, t) {
|
|
679
|
-
const n = Q(e), o = ke(n),
|
|
676
|
+
const n = Q(e), o = ke(n), r = n.separators.find(
|
|
680
677
|
(u) => u.element === e
|
|
681
678
|
);
|
|
682
|
-
z(
|
|
683
|
-
const
|
|
684
|
-
z(
|
|
685
|
-
const
|
|
679
|
+
z(r, "Matching separator not found");
|
|
680
|
+
const s = o.separatorToPanels.get(r);
|
|
681
|
+
z(s, "Matching panels not found");
|
|
682
|
+
const c = s.map((u) => n.panels.indexOf(u)), a = Ie({ groupId: n.id }).getLayout(), l = V({
|
|
686
683
|
delta: t,
|
|
687
|
-
initialLayout:
|
|
684
|
+
initialLayout: a,
|
|
688
685
|
panelConstraints: o.derivedPanelConstraints,
|
|
689
|
-
pivotIndices:
|
|
690
|
-
prevLayout:
|
|
686
|
+
pivotIndices: c,
|
|
687
|
+
prevLayout: a,
|
|
691
688
|
trigger: "keyboard"
|
|
692
|
-
}),
|
|
693
|
-
layout:
|
|
689
|
+
}), f = $({
|
|
690
|
+
layout: l,
|
|
694
691
|
panelConstraints: o.derivedPanelConstraints
|
|
695
692
|
});
|
|
696
|
-
B(
|
|
693
|
+
B(a, f) || C((u) => ({
|
|
697
694
|
mountedGroups: new Map(u.mountedGroups).set(n, {
|
|
698
695
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
699
|
-
layout:
|
|
696
|
+
layout: f,
|
|
700
697
|
separatorToPanels: o.separatorToPanels
|
|
701
698
|
})
|
|
702
699
|
}));
|
|
@@ -729,31 +726,31 @@ function ye(e) {
|
|
|
729
726
|
}
|
|
730
727
|
case "Enter": {
|
|
731
728
|
e.preventDefault();
|
|
732
|
-
const o = Q(t), { derivedPanelConstraints:
|
|
729
|
+
const o = Q(t), { derivedPanelConstraints: r, layout: s, separatorToPanels: c } = ke(o), i = o.separators.find(
|
|
733
730
|
(u) => u.element === t
|
|
734
731
|
);
|
|
735
732
|
z(i, "Matching separator not found");
|
|
736
|
-
const
|
|
737
|
-
z(
|
|
738
|
-
const
|
|
739
|
-
(u) => u.panelId ===
|
|
733
|
+
const a = c.get(i);
|
|
734
|
+
z(a, "Matching panels not found");
|
|
735
|
+
const l = a[0], f = r.find(
|
|
736
|
+
(u) => u.panelId === l.id
|
|
740
737
|
);
|
|
741
|
-
if (z(
|
|
742
|
-
const u =
|
|
738
|
+
if (z(f, "Panel metadata not found"), f.collapsible) {
|
|
739
|
+
const u = s[l.id], h = f.collapsedSize === u ? o.inMemoryLastExpandedPanelSizes[l.id] ?? f.minSize : f.collapsedSize;
|
|
743
740
|
D(t, h - u);
|
|
744
741
|
}
|
|
745
742
|
break;
|
|
746
743
|
}
|
|
747
744
|
case "F6": {
|
|
748
745
|
e.preventDefault();
|
|
749
|
-
const
|
|
750
|
-
(
|
|
751
|
-
),
|
|
752
|
-
(
|
|
746
|
+
const r = Q(t).separators.map(
|
|
747
|
+
(a) => a.element
|
|
748
|
+
), s = Array.from(r).findIndex(
|
|
749
|
+
(a) => a === e.currentTarget
|
|
753
750
|
);
|
|
754
|
-
z(
|
|
755
|
-
const
|
|
756
|
-
|
|
751
|
+
z(s !== null, "Index not found");
|
|
752
|
+
const c = e.shiftKey ? s > 0 ? s - 1 : r.length - 1 : s + 1 < r.length ? s + 1 : 0;
|
|
753
|
+
r[c].focus();
|
|
757
754
|
break;
|
|
758
755
|
}
|
|
759
756
|
case "Home": {
|
|
@@ -775,25 +772,25 @@ function tt(e, t) {
|
|
|
775
772
|
};
|
|
776
773
|
}
|
|
777
774
|
function nt(e, t, n) {
|
|
778
|
-
let o,
|
|
775
|
+
let o, r = {
|
|
779
776
|
x: 1 / 0,
|
|
780
777
|
y: 1 / 0
|
|
781
778
|
};
|
|
782
|
-
for (const
|
|
783
|
-
const
|
|
779
|
+
for (const s of t) {
|
|
780
|
+
const c = tt(n, s.rect);
|
|
784
781
|
switch (e) {
|
|
785
782
|
case "horizontal": {
|
|
786
|
-
|
|
783
|
+
c.x <= r.x && (o = s, r = c);
|
|
787
784
|
break;
|
|
788
785
|
}
|
|
789
786
|
case "vertical": {
|
|
790
|
-
|
|
787
|
+
c.y <= r.y && (o = s, r = c);
|
|
791
788
|
break;
|
|
792
789
|
}
|
|
793
790
|
}
|
|
794
791
|
}
|
|
795
792
|
return o ? {
|
|
796
|
-
distance:
|
|
793
|
+
distance: r,
|
|
797
794
|
hitRegion: o
|
|
798
795
|
} : void 0;
|
|
799
796
|
}
|
|
@@ -803,31 +800,31 @@ function ot() {
|
|
|
803
800
|
}
|
|
804
801
|
function Oe(e, t) {
|
|
805
802
|
const n = [];
|
|
806
|
-
return t.forEach((o,
|
|
807
|
-
if (
|
|
803
|
+
return t.forEach((o, r) => {
|
|
804
|
+
if (r.disabled)
|
|
808
805
|
return;
|
|
809
|
-
const
|
|
806
|
+
const s = ot() ? he.coarse : he.precise, c = Pe(r), i = nt(r.orientation, c, {
|
|
810
807
|
x: e.clientX,
|
|
811
808
|
y: e.clientY
|
|
812
809
|
});
|
|
813
|
-
i && i.distance.x <=
|
|
810
|
+
i && i.distance.x <= s && i.distance.y <= s && n.push(i.hitRegion);
|
|
814
811
|
}), n;
|
|
815
812
|
}
|
|
816
813
|
function ge(e) {
|
|
817
814
|
if (e.defaultPrevented)
|
|
818
815
|
return;
|
|
819
|
-
const { mountedGroups: t } = O(), n = Oe(e, t), o = /* @__PURE__ */ new Set(),
|
|
816
|
+
const { mountedGroups: t } = O(), n = Oe(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
820
817
|
let i = !1;
|
|
821
|
-
n.forEach((
|
|
822
|
-
o.add(
|
|
823
|
-
|
|
824
|
-
}),
|
|
825
|
-
const
|
|
826
|
-
|
|
818
|
+
n.forEach((a) => {
|
|
819
|
+
o.add(a.group), a.panels.forEach((f) => {
|
|
820
|
+
r.add(f);
|
|
821
|
+
}), a.separator && (s.add(a.separator), i || (i = !0, a.separator.element.focus()));
|
|
822
|
+
const l = t.get(a.group);
|
|
823
|
+
l && c.set(a.group, l.layout);
|
|
827
824
|
}), C({
|
|
828
825
|
interactionState: {
|
|
829
826
|
hitRegions: n,
|
|
830
|
-
initialLayoutMap:
|
|
827
|
+
initialLayoutMap: c,
|
|
831
828
|
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
832
829
|
state: "active"
|
|
833
830
|
}
|
|
@@ -894,18 +891,18 @@ function xe(e) {
|
|
|
894
891
|
function it(e) {
|
|
895
892
|
let t = 0, n = 0;
|
|
896
893
|
const o = {};
|
|
897
|
-
for (const
|
|
898
|
-
if (
|
|
894
|
+
for (const s of e)
|
|
895
|
+
if (s.defaultSize !== void 0) {
|
|
899
896
|
t++;
|
|
900
|
-
const
|
|
901
|
-
n +=
|
|
897
|
+
const c = I(s.defaultSize);
|
|
898
|
+
n += c, o[s.panelId] = c;
|
|
902
899
|
} else
|
|
903
|
-
o[
|
|
904
|
-
const
|
|
905
|
-
if (
|
|
906
|
-
const
|
|
907
|
-
for (const
|
|
908
|
-
|
|
900
|
+
o[s.panelId] = void 0;
|
|
901
|
+
const r = e.length - t;
|
|
902
|
+
if (r !== 0) {
|
|
903
|
+
const s = I((100 - n) / r);
|
|
904
|
+
for (const c of e)
|
|
905
|
+
c.defaultSize === void 0 && (o[c.panelId] = s);
|
|
909
906
|
}
|
|
910
907
|
return o;
|
|
911
908
|
}
|
|
@@ -913,18 +910,18 @@ function st(e, t, n) {
|
|
|
913
910
|
const o = n[0];
|
|
914
911
|
if (!o)
|
|
915
912
|
return;
|
|
916
|
-
const
|
|
917
|
-
if (!
|
|
913
|
+
const r = e.panels.find((c) => c.element === t);
|
|
914
|
+
if (!r || !r.onResize)
|
|
918
915
|
return;
|
|
919
|
-
const
|
|
920
|
-
|
|
916
|
+
const s = ee({ group: e });
|
|
917
|
+
r.onResize(
|
|
921
918
|
{
|
|
922
919
|
asPercentage: I(
|
|
923
|
-
o.inlineSize /
|
|
920
|
+
o.inlineSize / s * 100
|
|
924
921
|
),
|
|
925
922
|
inPixels: o.inlineSize
|
|
926
923
|
},
|
|
927
|
-
|
|
924
|
+
r.id
|
|
928
925
|
);
|
|
929
926
|
}
|
|
930
927
|
function rt(e) {
|
|
@@ -933,48 +930,43 @@ function rt(e) {
|
|
|
933
930
|
e.separators.length === 0 || e.separators.length < e.panels.length,
|
|
934
931
|
"Invalid Group configuration; too many Separator components"
|
|
935
932
|
);
|
|
936
|
-
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(),
|
|
933
|
+
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((u) => {
|
|
937
934
|
for (const h of u) {
|
|
938
|
-
const { borderBoxSize: y, target:
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
957
|
-
return p;
|
|
958
|
-
});
|
|
959
|
-
} else
|
|
960
|
-
st(e, f, y);
|
|
935
|
+
const { borderBoxSize: y, target: d } = h;
|
|
936
|
+
d === e.element ? t && C((p) => {
|
|
937
|
+
const v = p.mountedGroups.get(e);
|
|
938
|
+
if (v) {
|
|
939
|
+
const m = me(e), x = v.layout, S = $({
|
|
940
|
+
layout: x,
|
|
941
|
+
panelConstraints: m
|
|
942
|
+
});
|
|
943
|
+
return {
|
|
944
|
+
mountedGroups: new Map(p.mountedGroups).set(e, {
|
|
945
|
+
derivedPanelConstraints: m,
|
|
946
|
+
layout: S,
|
|
947
|
+
separatorToPanels: v.separatorToPanels
|
|
948
|
+
})
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
return p;
|
|
952
|
+
}) : st(e, d, y);
|
|
961
953
|
}
|
|
962
954
|
});
|
|
963
|
-
|
|
955
|
+
r.observe(e.element), e.panels.forEach((u) => {
|
|
964
956
|
z(
|
|
965
957
|
!n.has(u.id),
|
|
966
958
|
`Panel ids must be unique; id "${u.id}" was used more than once`
|
|
967
|
-
), n.add(u.id), u.onResize &&
|
|
959
|
+
), n.add(u.id), u.onResize && r.observe(u.element);
|
|
968
960
|
});
|
|
969
|
-
const
|
|
961
|
+
const s = me(e), c = e.panels.map(({ id: u }) => u).join(","), i = e.inMemoryLayouts[c] ?? e.defaultLayout ?? it(s), a = $({
|
|
970
962
|
layout: i,
|
|
971
|
-
panelConstraints:
|
|
972
|
-
}),
|
|
963
|
+
panelConstraints: s
|
|
964
|
+
}), l = Pe(e), f = C((u) => ({
|
|
973
965
|
mountedGroups: new Map(u.mountedGroups).set(e, {
|
|
974
|
-
derivedPanelConstraints:
|
|
975
|
-
layout:
|
|
966
|
+
derivedPanelConstraints: s,
|
|
967
|
+
layout: a,
|
|
976
968
|
separatorToPanels: new Map(
|
|
977
|
-
|
|
969
|
+
l.filter((h) => h.separator).map((h) => [h.separator, h.panels])
|
|
978
970
|
)
|
|
979
971
|
})
|
|
980
972
|
}));
|
|
@@ -983,15 +975,15 @@ function rt(e) {
|
|
|
983
975
|
!o.has(u.id),
|
|
984
976
|
`Separator ids must be unique; id "${u.id}" was used more than once`
|
|
985
977
|
), o.add(u.id), u.element.addEventListener("keydown", ye);
|
|
986
|
-
}),
|
|
978
|
+
}), f.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ge), window.addEventListener("pointermove", Se), window.addEventListener("pointerup", xe)), function() {
|
|
987
979
|
t = !1;
|
|
988
980
|
const h = C((y) => {
|
|
989
|
-
const
|
|
990
|
-
return
|
|
981
|
+
const d = new Map(y.mountedGroups);
|
|
982
|
+
return d.delete(e), { mountedGroups: d };
|
|
991
983
|
});
|
|
992
984
|
e.element.removeEventListener("pointerleave", ve), e.separators.forEach((y) => {
|
|
993
985
|
y.element.removeEventListener("keydown", ye);
|
|
994
|
-
}), h.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ge), window.removeEventListener("pointermove", Se), window.removeEventListener("pointerup", xe)),
|
|
986
|
+
}), h.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ge), window.removeEventListener("pointermove", Se), window.removeEventListener("pointerup", xe)), r.disconnect();
|
|
995
987
|
};
|
|
996
988
|
}
|
|
997
989
|
function ce(e) {
|
|
@@ -1027,7 +1019,7 @@ function De(e, t) {
|
|
|
1027
1019
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1028
1020
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1029
1021
|
}
|
|
1030
|
-
const Ae =
|
|
1022
|
+
const Ae = We(null);
|
|
1031
1023
|
function at(e, t) {
|
|
1032
1024
|
const n = T({
|
|
1033
1025
|
getLayout: () => ({}),
|
|
@@ -1060,48 +1052,48 @@ function yt({
|
|
|
1060
1052
|
className: t,
|
|
1061
1053
|
defaultLayout: n,
|
|
1062
1054
|
disableCursor: o,
|
|
1063
|
-
disabled:
|
|
1064
|
-
elementRef:
|
|
1065
|
-
groupRef:
|
|
1055
|
+
disabled: r,
|
|
1056
|
+
elementRef: s,
|
|
1057
|
+
groupRef: c,
|
|
1066
1058
|
id: i,
|
|
1067
|
-
onLayoutChange:
|
|
1068
|
-
orientation:
|
|
1069
|
-
style:
|
|
1059
|
+
onLayoutChange: a,
|
|
1060
|
+
orientation: l = "horizontal",
|
|
1061
|
+
style: f,
|
|
1070
1062
|
...u
|
|
1071
1063
|
}) {
|
|
1072
1064
|
const h = T({}), y = ue((b) => {
|
|
1073
|
-
B(h.current, b) || (h.current = b,
|
|
1074
|
-
}),
|
|
1075
|
-
at(
|
|
1065
|
+
B(h.current, b) || (h.current = b, a?.(b));
|
|
1066
|
+
}), d = ce(i), [p, v] = G(!1), [m, x] = G(null), [S, g] = G(n ?? {}), [L, P] = G([]), [E, U] = G([]), te = lt(m), K = T({}), X = T({}), Y = fe(x, s);
|
|
1067
|
+
at(d, c);
|
|
1076
1068
|
const ne = Le(
|
|
1077
1069
|
() => ({
|
|
1078
|
-
id:
|
|
1079
|
-
orientation:
|
|
1080
|
-
registerPanel: (b) => (P((M) => re(
|
|
1070
|
+
id: d,
|
|
1071
|
+
orientation: l,
|
|
1072
|
+
registerPanel: (b) => (P((M) => re(l, [...M, b])), () => {
|
|
1081
1073
|
P((M) => M.filter((N) => N !== b));
|
|
1082
1074
|
}),
|
|
1083
1075
|
registerSeparator: (b) => (U(
|
|
1084
|
-
(M) => re(
|
|
1076
|
+
(M) => re(l, [...M, b])
|
|
1085
1077
|
), () => {
|
|
1086
1078
|
U(
|
|
1087
1079
|
(M) => M.filter((N) => N !== b)
|
|
1088
1080
|
);
|
|
1089
1081
|
})
|
|
1090
1082
|
}),
|
|
1091
|
-
[
|
|
1083
|
+
[d, l]
|
|
1092
1084
|
);
|
|
1093
1085
|
H(() => {
|
|
1094
|
-
if (m === null || L.length === 0
|
|
1086
|
+
if (m === null || L.length === 0)
|
|
1095
1087
|
return;
|
|
1096
1088
|
const b = {
|
|
1097
1089
|
defaultLayout: n,
|
|
1098
1090
|
disableCursor: !!o,
|
|
1099
|
-
disabled: !!
|
|
1091
|
+
disabled: !!r,
|
|
1100
1092
|
element: m,
|
|
1101
|
-
id:
|
|
1093
|
+
id: d,
|
|
1102
1094
|
inMemoryLastExpandedPanelSizes: K.current,
|
|
1103
1095
|
inMemoryLayouts: X.current,
|
|
1104
|
-
orientation:
|
|
1096
|
+
orientation: l,
|
|
1105
1097
|
panels: L,
|
|
1106
1098
|
separators: E
|
|
1107
1099
|
}, M = rt(b), oe = O().mountedGroups.get(b);
|
|
@@ -1137,12 +1129,12 @@ function yt({
|
|
|
1137
1129
|
}, [
|
|
1138
1130
|
n,
|
|
1139
1131
|
o,
|
|
1140
|
-
|
|
1132
|
+
r,
|
|
1141
1133
|
m,
|
|
1142
|
-
|
|
1134
|
+
d,
|
|
1143
1135
|
te,
|
|
1144
1136
|
y,
|
|
1145
|
-
|
|
1137
|
+
l,
|
|
1146
1138
|
L,
|
|
1147
1139
|
E
|
|
1148
1140
|
]);
|
|
@@ -1150,25 +1142,25 @@ function yt({
|
|
|
1150
1142
|
[Te]: p ? "none" : void 0
|
|
1151
1143
|
};
|
|
1152
1144
|
for (const b in S) {
|
|
1153
|
-
const M = De(
|
|
1145
|
+
const M = De(d, b), N = S[b];
|
|
1154
1146
|
pe[M] = N;
|
|
1155
1147
|
}
|
|
1156
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ W(Ae.Provider, { value: ne, children: /* @__PURE__ */ W(
|
|
1157
1149
|
"div",
|
|
1158
1150
|
{
|
|
1159
1151
|
...u,
|
|
1160
|
-
"aria-orientation":
|
|
1152
|
+
"aria-orientation": l,
|
|
1161
1153
|
className: t,
|
|
1162
1154
|
"data-group": !0,
|
|
1163
|
-
"data-testid":
|
|
1164
|
-
id:
|
|
1155
|
+
"data-testid": d,
|
|
1156
|
+
id: d,
|
|
1165
1157
|
ref: Y,
|
|
1166
1158
|
style: {
|
|
1167
|
-
...
|
|
1159
|
+
...f,
|
|
1168
1160
|
...pe,
|
|
1169
1161
|
contentVisibility: "auto",
|
|
1170
1162
|
display: "flex",
|
|
1171
|
-
flexDirection:
|
|
1163
|
+
flexDirection: l === "horizontal" ? "row" : "column",
|
|
1172
1164
|
flexWrap: "nowrap"
|
|
1173
1165
|
},
|
|
1174
1166
|
children: e
|
|
@@ -1201,17 +1193,17 @@ function gt({
|
|
|
1201
1193
|
), o = Le(
|
|
1202
1194
|
() => n ? JSON.parse(n) : void 0,
|
|
1203
1195
|
[n]
|
|
1204
|
-
),
|
|
1205
|
-
(
|
|
1196
|
+
), r = ze(
|
|
1197
|
+
(s) => ct({
|
|
1206
1198
|
id: e,
|
|
1207
|
-
layout:
|
|
1199
|
+
layout: s,
|
|
1208
1200
|
storage: t
|
|
1209
1201
|
}),
|
|
1210
1202
|
[e, t]
|
|
1211
1203
|
);
|
|
1212
1204
|
return {
|
|
1213
1205
|
defaultLayout: o,
|
|
1214
|
-
onLayoutChange:
|
|
1206
|
+
onLayoutChange: r
|
|
1215
1207
|
};
|
|
1216
1208
|
}
|
|
1217
1209
|
function ut() {
|
|
@@ -1225,7 +1217,7 @@ function xt() {
|
|
|
1225
1217
|
return T(null);
|
|
1226
1218
|
}
|
|
1227
1219
|
function de() {
|
|
1228
|
-
const e =
|
|
1220
|
+
const e = je(Ae);
|
|
1229
1221
|
return z(
|
|
1230
1222
|
e,
|
|
1231
1223
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
@@ -1238,52 +1230,52 @@ function ft({
|
|
|
1238
1230
|
const n = () => {
|
|
1239
1231
|
const { mountedGroups: i } = O();
|
|
1240
1232
|
for (const [
|
|
1241
|
-
|
|
1242
|
-
{ derivedPanelConstraints:
|
|
1233
|
+
a,
|
|
1234
|
+
{ derivedPanelConstraints: l, layout: f, separatorToPanels: u }
|
|
1243
1235
|
] of i)
|
|
1244
|
-
if (
|
|
1245
|
-
return { derivedPanelConstraints:
|
|
1236
|
+
if (a.id === e)
|
|
1237
|
+
return { derivedPanelConstraints: l, group: a, layout: f, separatorToPanels: u };
|
|
1246
1238
|
throw Error(`Group ${e} not found`);
|
|
1247
1239
|
}, o = () => {
|
|
1248
1240
|
const i = n().derivedPanelConstraints.find(
|
|
1249
|
-
(
|
|
1241
|
+
(a) => a.panelId === t
|
|
1250
1242
|
);
|
|
1251
1243
|
if (i !== void 0)
|
|
1252
1244
|
return i;
|
|
1253
1245
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1254
|
-
},
|
|
1255
|
-
const i = n().group.panels.find((
|
|
1246
|
+
}, r = () => {
|
|
1247
|
+
const i = n().group.panels.find((a) => a.id === t);
|
|
1256
1248
|
if (i !== void 0)
|
|
1257
1249
|
return i;
|
|
1258
1250
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1259
|
-
},
|
|
1251
|
+
}, s = () => {
|
|
1260
1252
|
const i = n().layout[t];
|
|
1261
1253
|
if (i !== void 0)
|
|
1262
1254
|
return i;
|
|
1263
1255
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1264
|
-
},
|
|
1265
|
-
const
|
|
1266
|
-
if (i ===
|
|
1256
|
+
}, c = (i) => {
|
|
1257
|
+
const a = s();
|
|
1258
|
+
if (i === a)
|
|
1267
1259
|
return;
|
|
1268
1260
|
const {
|
|
1269
|
-
derivedPanelConstraints:
|
|
1270
|
-
group:
|
|
1261
|
+
derivedPanelConstraints: l,
|
|
1262
|
+
group: f,
|
|
1271
1263
|
layout: u,
|
|
1272
1264
|
separatorToPanels: h
|
|
1273
|
-
} = n(), y =
|
|
1274
|
-
delta:
|
|
1265
|
+
} = n(), y = f.panels.findIndex((m) => m.id === t), d = y === f.panels.length - 1, p = V({
|
|
1266
|
+
delta: d ? a - i : i - a,
|
|
1275
1267
|
initialLayout: u,
|
|
1276
|
-
panelConstraints:
|
|
1277
|
-
pivotIndices:
|
|
1268
|
+
panelConstraints: l,
|
|
1269
|
+
pivotIndices: d ? [y - 1, y] : [y, y + 1],
|
|
1278
1270
|
prevLayout: u,
|
|
1279
1271
|
trigger: "imperative-api"
|
|
1280
1272
|
}), v = $({
|
|
1281
1273
|
layout: p,
|
|
1282
|
-
panelConstraints:
|
|
1274
|
+
panelConstraints: l
|
|
1283
1275
|
});
|
|
1284
1276
|
B(u, v) || C((m) => ({
|
|
1285
|
-
mountedGroups: new Map(m.mountedGroups).set(
|
|
1286
|
-
derivedPanelConstraints:
|
|
1277
|
+
mountedGroups: new Map(m.mountedGroups).set(f, {
|
|
1278
|
+
derivedPanelConstraints: l,
|
|
1287
1279
|
layout: v,
|
|
1288
1280
|
separatorToPanels: h
|
|
1289
1281
|
})
|
|
@@ -1291,39 +1283,39 @@ function ft({
|
|
|
1291
1283
|
};
|
|
1292
1284
|
return {
|
|
1293
1285
|
collapse: () => {
|
|
1294
|
-
const { collapsible: i, collapsedSize:
|
|
1295
|
-
i &&
|
|
1286
|
+
const { collapsible: i, collapsedSize: a } = o(), l = s();
|
|
1287
|
+
i && l !== a && c(a);
|
|
1296
1288
|
},
|
|
1297
1289
|
expand: () => {
|
|
1298
|
-
const { collapsible: i, collapsedSize:
|
|
1299
|
-
i &&
|
|
1290
|
+
const { collapsible: i, collapsedSize: a, minSize: l } = o(), f = s();
|
|
1291
|
+
i && f === a && c(l);
|
|
1300
1292
|
},
|
|
1301
1293
|
getSize: () => {
|
|
1302
|
-
const { group: i } = n(),
|
|
1294
|
+
const { group: i } = n(), a = s(), { element: l } = r(), f = i.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
1303
1295
|
return {
|
|
1304
|
-
asPercentage:
|
|
1305
|
-
inPixels:
|
|
1296
|
+
asPercentage: a,
|
|
1297
|
+
inPixels: f
|
|
1306
1298
|
};
|
|
1307
1299
|
},
|
|
1308
1300
|
isCollapsed: () => {
|
|
1309
|
-
const { collapsible: i, collapsedSize:
|
|
1310
|
-
return i && w(
|
|
1301
|
+
const { collapsible: i, collapsedSize: a } = o(), l = s();
|
|
1302
|
+
return i && w(a, l);
|
|
1311
1303
|
},
|
|
1312
1304
|
resize: (i) => {
|
|
1313
|
-
if (
|
|
1314
|
-
let
|
|
1305
|
+
if (s() !== i) {
|
|
1306
|
+
let l;
|
|
1315
1307
|
switch (typeof i) {
|
|
1316
1308
|
case "number": {
|
|
1317
|
-
const { group:
|
|
1318
|
-
|
|
1309
|
+
const { group: f } = n(), u = ee({ group: f });
|
|
1310
|
+
l = I(i / u * 100);
|
|
1319
1311
|
break;
|
|
1320
1312
|
}
|
|
1321
1313
|
case "string": {
|
|
1322
|
-
|
|
1314
|
+
l = parseFloat(i);
|
|
1323
1315
|
break;
|
|
1324
1316
|
}
|
|
1325
1317
|
}
|
|
1326
|
-
l
|
|
1318
|
+
c(l);
|
|
1327
1319
|
}
|
|
1328
1320
|
}
|
|
1329
1321
|
};
|
|
@@ -1351,55 +1343,55 @@ function zt({
|
|
|
1351
1343
|
className: t,
|
|
1352
1344
|
collapsedSize: n = "0%",
|
|
1353
1345
|
collapsible: o = !1,
|
|
1354
|
-
defaultSize:
|
|
1355
|
-
elementRef:
|
|
1356
|
-
id:
|
|
1346
|
+
defaultSize: r,
|
|
1347
|
+
elementRef: s,
|
|
1348
|
+
id: c,
|
|
1357
1349
|
maxSize: i = "100%",
|
|
1358
|
-
minSize:
|
|
1359
|
-
onResize:
|
|
1360
|
-
panelRef:
|
|
1350
|
+
minSize: a = "0%",
|
|
1351
|
+
onResize: l,
|
|
1352
|
+
panelRef: f,
|
|
1361
1353
|
style: u,
|
|
1362
1354
|
...h
|
|
1363
1355
|
}) {
|
|
1364
|
-
const y = !!
|
|
1365
|
-
|
|
1356
|
+
const y = !!c, d = ce(c), [p, v] = G(null), m = fe(v, s), { id: x, registerPanel: S } = de(), g = l !== null, L = ue((E) => {
|
|
1357
|
+
l?.(E, c);
|
|
1366
1358
|
});
|
|
1367
1359
|
H(() => {
|
|
1368
1360
|
if (p !== null)
|
|
1369
1361
|
return S({
|
|
1370
1362
|
element: p,
|
|
1371
|
-
id:
|
|
1363
|
+
id: d,
|
|
1372
1364
|
idIsStable: y,
|
|
1373
1365
|
onResize: g ? L : void 0,
|
|
1374
1366
|
panelConstraints: {
|
|
1375
1367
|
collapsedSize: n,
|
|
1376
1368
|
collapsible: o,
|
|
1377
|
-
defaultSize:
|
|
1369
|
+
defaultSize: r,
|
|
1378
1370
|
maxSize: i,
|
|
1379
|
-
minSize:
|
|
1371
|
+
minSize: a
|
|
1380
1372
|
}
|
|
1381
1373
|
});
|
|
1382
1374
|
}, [
|
|
1383
1375
|
n,
|
|
1384
1376
|
o,
|
|
1385
|
-
|
|
1377
|
+
r,
|
|
1386
1378
|
p,
|
|
1387
1379
|
g,
|
|
1388
|
-
|
|
1380
|
+
d,
|
|
1389
1381
|
y,
|
|
1390
1382
|
i,
|
|
1391
|
-
|
|
1383
|
+
a,
|
|
1392
1384
|
L,
|
|
1393
1385
|
S
|
|
1394
|
-
]), dt(
|
|
1395
|
-
const P = De(x,
|
|
1396
|
-
return /* @__PURE__ */
|
|
1386
|
+
]), dt(d, f);
|
|
1387
|
+
const P = De(x, d);
|
|
1388
|
+
return /* @__PURE__ */ W(
|
|
1397
1389
|
"div",
|
|
1398
1390
|
{
|
|
1399
1391
|
...h,
|
|
1400
1392
|
"data-panel": !0,
|
|
1401
|
-
"data-testid":
|
|
1402
|
-
id:
|
|
1393
|
+
"data-testid": d,
|
|
1394
|
+
id: d,
|
|
1403
1395
|
ref: m,
|
|
1404
1396
|
style: {
|
|
1405
1397
|
...pt,
|
|
@@ -1412,7 +1404,7 @@ function zt({
|
|
|
1412
1404
|
// This avoid edge cases like nested iframes
|
|
1413
1405
|
pointerEvents: `var(${Te})`
|
|
1414
1406
|
},
|
|
1415
|
-
children: /* @__PURE__ */
|
|
1407
|
+
children: /* @__PURE__ */ W(
|
|
1416
1408
|
"div",
|
|
1417
1409
|
{
|
|
1418
1410
|
className: t,
|
|
@@ -1455,28 +1447,28 @@ function mt({
|
|
|
1455
1447
|
panelId: n,
|
|
1456
1448
|
panelIndex: o
|
|
1457
1449
|
}) {
|
|
1458
|
-
let
|
|
1459
|
-
const
|
|
1460
|
-
(
|
|
1450
|
+
let r, s;
|
|
1451
|
+
const c = e[n], i = t.find(
|
|
1452
|
+
(a) => a.panelId === n
|
|
1461
1453
|
);
|
|
1462
1454
|
if (i) {
|
|
1463
|
-
const
|
|
1464
|
-
|
|
1465
|
-
layout:
|
|
1466
|
-
delta:
|
|
1455
|
+
const a = i.maxSize, l = s = i.collapsible ? i.collapsedSize : i.minSize, f = [o, o + 1];
|
|
1456
|
+
s = $({
|
|
1457
|
+
layout: V({
|
|
1458
|
+
delta: l - c,
|
|
1467
1459
|
initialLayout: e,
|
|
1468
1460
|
panelConstraints: t,
|
|
1469
|
-
pivotIndices:
|
|
1461
|
+
pivotIndices: f,
|
|
1470
1462
|
prevLayout: e,
|
|
1471
1463
|
trigger: "keyboard"
|
|
1472
1464
|
}),
|
|
1473
1465
|
panelConstraints: t
|
|
1474
|
-
})[n],
|
|
1475
|
-
layout:
|
|
1476
|
-
delta:
|
|
1466
|
+
})[n], r = $({
|
|
1467
|
+
layout: V({
|
|
1468
|
+
delta: a - c,
|
|
1477
1469
|
initialLayout: e,
|
|
1478
1470
|
panelConstraints: t,
|
|
1479
|
-
pivotIndices:
|
|
1471
|
+
pivotIndices: f,
|
|
1480
1472
|
prevLayout: e,
|
|
1481
1473
|
trigger: "keyboard"
|
|
1482
1474
|
}),
|
|
@@ -1485,9 +1477,9 @@ function mt({
|
|
|
1485
1477
|
}
|
|
1486
1478
|
return {
|
|
1487
1479
|
valueControls: n,
|
|
1488
|
-
valueMax:
|
|
1489
|
-
valueMin:
|
|
1490
|
-
valueNow:
|
|
1480
|
+
valueMax: r,
|
|
1481
|
+
valueMin: s,
|
|
1482
|
+
valueNow: c
|
|
1491
1483
|
};
|
|
1492
1484
|
}
|
|
1493
1485
|
function Lt({
|
|
@@ -1495,11 +1487,11 @@ function Lt({
|
|
|
1495
1487
|
className: t,
|
|
1496
1488
|
elementRef: n,
|
|
1497
1489
|
id: o,
|
|
1498
|
-
style:
|
|
1499
|
-
...
|
|
1490
|
+
style: r,
|
|
1491
|
+
...s
|
|
1500
1492
|
}) {
|
|
1501
|
-
const
|
|
1502
|
-
id:
|
|
1493
|
+
const c = ce(o), [i, a] = G({}), [l, f] = G("inactive"), [u, h] = G(null), y = fe(h, n), {
|
|
1494
|
+
id: d,
|
|
1503
1495
|
orientation: p,
|
|
1504
1496
|
registerSeparator: v
|
|
1505
1497
|
} = de(), m = p === "horizontal" ? "vertical" : "horizontal";
|
|
@@ -1507,11 +1499,11 @@ function Lt({
|
|
|
1507
1499
|
if (u !== null) {
|
|
1508
1500
|
const x = {
|
|
1509
1501
|
element: u,
|
|
1510
|
-
id:
|
|
1502
|
+
id: c
|
|
1511
1503
|
}, S = v(x), g = A.addListener(
|
|
1512
1504
|
"interactionStateChange",
|
|
1513
1505
|
(P) => {
|
|
1514
|
-
|
|
1506
|
+
f(
|
|
1515
1507
|
P.state !== "inactive" && P.hitRegions.some(
|
|
1516
1508
|
(E) => E.separator === x
|
|
1517
1509
|
) ? P.state : "inactive"
|
|
@@ -1522,11 +1514,11 @@ function Lt({
|
|
|
1522
1514
|
(P) => {
|
|
1523
1515
|
P.forEach(
|
|
1524
1516
|
({ derivedPanelConstraints: E, layout: U, separatorToPanels: te }, K) => {
|
|
1525
|
-
if (K.id ===
|
|
1517
|
+
if (K.id === d) {
|
|
1526
1518
|
const X = te.get(x);
|
|
1527
1519
|
if (X) {
|
|
1528
1520
|
const Y = X[0], ne = K.panels.indexOf(Y);
|
|
1529
|
-
|
|
1521
|
+
a(
|
|
1530
1522
|
mt({
|
|
1531
1523
|
layout: U,
|
|
1532
1524
|
panelConstraints: E,
|
|
@@ -1544,10 +1536,10 @@ function Lt({
|
|
|
1544
1536
|
g(), L(), S();
|
|
1545
1537
|
};
|
|
1546
1538
|
}
|
|
1547
|
-
}, [u,
|
|
1539
|
+
}, [u, d, c, v]), /* @__PURE__ */ W(
|
|
1548
1540
|
"div",
|
|
1549
1541
|
{
|
|
1550
|
-
...
|
|
1542
|
+
...s,
|
|
1551
1543
|
"aria-controls": i.valueControls,
|
|
1552
1544
|
"aria-orientation": m,
|
|
1553
1545
|
"aria-valuemax": i.valueMax,
|
|
@@ -1555,14 +1547,14 @@ function Lt({
|
|
|
1555
1547
|
"aria-valuenow": i.valueNow,
|
|
1556
1548
|
children: e,
|
|
1557
1549
|
className: t,
|
|
1558
|
-
"data-separator":
|
|
1559
|
-
"data-testid":
|
|
1560
|
-
id:
|
|
1550
|
+
"data-separator": l,
|
|
1551
|
+
"data-testid": c,
|
|
1552
|
+
id: c,
|
|
1561
1553
|
ref: y,
|
|
1562
1554
|
role: "separator",
|
|
1563
1555
|
style: {
|
|
1564
1556
|
flexBasis: "auto",
|
|
1565
|
-
...
|
|
1557
|
+
...r,
|
|
1566
1558
|
flexGrow: 0,
|
|
1567
1559
|
flexShrink: 0
|
|
1568
1560
|
},
|