react-resizable-panels 4.0.9 → 4.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as K } from "react/jsx-runtime";
|
|
3
|
-
import { useId as
|
|
3
|
+
import { useId as Xe, useLayoutEffect as Ye, useEffect as Ce, useRef as O, useCallback as Ee, createContext as qe, useImperativeHandle as Me, useState as I, useMemo as Ie, useSyncExternalStore as Ze, useContext as Je } from "react";
|
|
4
4
|
function z(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
@@ -9,77 +9,145 @@ function B({
|
|
|
9
9
|
group: e
|
|
10
10
|
}) {
|
|
11
11
|
const { orientation: t, panels: n } = e;
|
|
12
|
-
return n.reduce((o,
|
|
12
|
+
return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
|
|
13
13
|
}
|
|
14
14
|
function se(e, t) {
|
|
15
15
|
return t.sort(
|
|
16
|
-
e === "horizontal" ?
|
|
16
|
+
e === "horizontal" ? Qe : et
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Qe(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 et(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
|
-
|
|
27
|
+
function Ge(e, t) {
|
|
28
|
+
return {
|
|
29
|
+
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
30
|
+
Math.abs(e.x - t.left),
|
|
31
|
+
Math.abs(e.x - t.right)
|
|
32
|
+
),
|
|
33
|
+
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(
|
|
34
|
+
Math.abs(e.y - t.top),
|
|
35
|
+
Math.abs(e.y - t.bottom)
|
|
36
|
+
)
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function tt({
|
|
40
|
+
orientation: e,
|
|
41
|
+
rects: t,
|
|
42
|
+
targetRect: n
|
|
43
|
+
}) {
|
|
44
|
+
const o = {
|
|
45
|
+
x: n.x + n.width / 2,
|
|
46
|
+
y: n.y + n.height / 2
|
|
47
|
+
};
|
|
48
|
+
let r, a = Number.MAX_VALUE;
|
|
49
|
+
for (const l of t) {
|
|
50
|
+
const { x: i, y: s } = Ge(o, l), u = e === "horizontal" ? i : s;
|
|
51
|
+
u < a && (a = u, r = l);
|
|
52
|
+
}
|
|
53
|
+
return z(r, "No rect found"), r;
|
|
54
|
+
}
|
|
55
|
+
function ke(e) {
|
|
56
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, a = se(
|
|
29
57
|
n,
|
|
30
|
-
Array.from(t.children).filter((
|
|
31
|
-
).map(({ element:
|
|
32
|
-
let i,
|
|
33
|
-
for (const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
59
|
+
).map(({ element: c }) => c), l = [];
|
|
60
|
+
let i = !1, s, u = [];
|
|
61
|
+
for (const c of a)
|
|
62
|
+
if (c.hasAttribute("data-panel")) {
|
|
63
|
+
const h = o.find(
|
|
64
|
+
(m) => m.element === c
|
|
65
|
+
);
|
|
66
|
+
if (h) {
|
|
67
|
+
if (s) {
|
|
68
|
+
const m = s.element.getBoundingClientRect(), p = c.getBoundingClientRect();
|
|
69
|
+
let f;
|
|
70
|
+
if (i) {
|
|
71
|
+
const d = n === "horizontal" ? new DOMRect(m.right, m.top, 0, m.height) : new DOMRect(
|
|
72
|
+
m.left,
|
|
73
|
+
m.bottom,
|
|
74
|
+
m.width,
|
|
75
|
+
0
|
|
76
|
+
), y = n === "horizontal" ? new DOMRect(p.left, p.top, 0, p.height) : new DOMRect(p.left, p.top, p.width, 0);
|
|
77
|
+
switch (u.length) {
|
|
78
|
+
case 0: {
|
|
79
|
+
f = [
|
|
80
|
+
d,
|
|
81
|
+
y
|
|
82
|
+
];
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 1: {
|
|
86
|
+
const g = u[0], v = tt({
|
|
87
|
+
orientation: n,
|
|
88
|
+
rects: [m, p],
|
|
89
|
+
targetRect: g.element.getBoundingClientRect()
|
|
90
|
+
});
|
|
91
|
+
f = [
|
|
92
|
+
g,
|
|
93
|
+
v === m ? y : d
|
|
94
|
+
];
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
f = u;
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
} else
|
|
103
|
+
u.length ? f = u : f = [
|
|
104
|
+
n === "horizontal" ? new DOMRect(
|
|
105
|
+
m.right,
|
|
106
|
+
p.top,
|
|
107
|
+
p.left - m.right,
|
|
108
|
+
p.height
|
|
109
|
+
) : new DOMRect(
|
|
110
|
+
p.left,
|
|
111
|
+
m.bottom,
|
|
112
|
+
p.width,
|
|
113
|
+
p.top - m.bottom
|
|
114
|
+
)
|
|
115
|
+
];
|
|
116
|
+
for (const d of f)
|
|
117
|
+
l.push({
|
|
118
|
+
group: e,
|
|
119
|
+
groupSize: B({ group: e }),
|
|
120
|
+
panels: [s, h],
|
|
121
|
+
separator: "width" in d ? void 0 : d,
|
|
122
|
+
rect: "width" in d ? d : d.element.getBoundingClientRect()
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
i = !1, s = h, u = [];
|
|
57
126
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(x) => x.element === u
|
|
127
|
+
} else if (c.hasAttribute("data-separator")) {
|
|
128
|
+
const h = r.find(
|
|
129
|
+
(m) => m.element === c
|
|
62
130
|
);
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
131
|
+
h ? u.push(h) : (s = void 0, u = []);
|
|
132
|
+
} else
|
|
133
|
+
i = !0;
|
|
66
134
|
return l;
|
|
67
135
|
}
|
|
68
|
-
function
|
|
136
|
+
function nt(e, t) {
|
|
69
137
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
70
138
|
return t * o;
|
|
71
139
|
}
|
|
72
|
-
function
|
|
140
|
+
function ot(e, t) {
|
|
73
141
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
74
142
|
return t * o;
|
|
75
143
|
}
|
|
76
|
-
function
|
|
144
|
+
function it(e) {
|
|
77
145
|
return e / 100 * window.innerHeight;
|
|
78
146
|
}
|
|
79
|
-
function
|
|
147
|
+
function rt(e) {
|
|
80
148
|
return e / 100 * window.innerWidth;
|
|
81
149
|
}
|
|
82
|
-
function
|
|
150
|
+
function st(e) {
|
|
83
151
|
switch (typeof e) {
|
|
84
152
|
case "number":
|
|
85
153
|
return [e, "px"];
|
|
@@ -95,36 +163,36 @@ function te({
|
|
|
95
163
|
styleProp: n
|
|
96
164
|
}) {
|
|
97
165
|
let o;
|
|
98
|
-
const [
|
|
166
|
+
const [r, a] = st(n);
|
|
99
167
|
switch (a) {
|
|
100
168
|
case "%": {
|
|
101
|
-
o =
|
|
169
|
+
o = r / 100 * e;
|
|
102
170
|
break;
|
|
103
171
|
}
|
|
104
172
|
case "px": {
|
|
105
|
-
o =
|
|
173
|
+
o = r;
|
|
106
174
|
break;
|
|
107
175
|
}
|
|
108
176
|
case "rem": {
|
|
109
|
-
o =
|
|
177
|
+
o = ot(t, r);
|
|
110
178
|
break;
|
|
111
179
|
}
|
|
112
180
|
case "em": {
|
|
113
|
-
o =
|
|
181
|
+
o = nt(t, r);
|
|
114
182
|
break;
|
|
115
183
|
}
|
|
116
184
|
case "vh": {
|
|
117
|
-
o =
|
|
185
|
+
o = it(r);
|
|
118
186
|
break;
|
|
119
187
|
}
|
|
120
188
|
case "vw": {
|
|
121
|
-
o =
|
|
189
|
+
o = rt(r);
|
|
122
190
|
break;
|
|
123
191
|
}
|
|
124
192
|
}
|
|
125
193
|
return o;
|
|
126
194
|
}
|
|
127
|
-
function
|
|
195
|
+
function G(e) {
|
|
128
196
|
return parseFloat(e.toFixed(3));
|
|
129
197
|
}
|
|
130
198
|
function ye(e) {
|
|
@@ -137,54 +205,54 @@ function ye(e) {
|
|
|
137
205
|
maxSize: 100,
|
|
138
206
|
panelId: o.id
|
|
139
207
|
})) : t.map((o) => {
|
|
140
|
-
const { element:
|
|
208
|
+
const { element: r, panelConstraints: a } = o;
|
|
141
209
|
let l = 0;
|
|
142
210
|
if (a.collapsedSize) {
|
|
143
211
|
const c = te({
|
|
144
212
|
groupSize: n,
|
|
145
|
-
panelElement:
|
|
213
|
+
panelElement: r,
|
|
146
214
|
styleProp: a.collapsedSize
|
|
147
215
|
});
|
|
148
|
-
l =
|
|
216
|
+
l = G(c / n * 100);
|
|
149
217
|
}
|
|
150
218
|
let i;
|
|
151
219
|
if (a.defaultSize) {
|
|
152
220
|
const c = te({
|
|
153
221
|
groupSize: n,
|
|
154
|
-
panelElement:
|
|
222
|
+
panelElement: r,
|
|
155
223
|
styleProp: a.defaultSize
|
|
156
224
|
});
|
|
157
|
-
i =
|
|
225
|
+
i = G(c / n * 100);
|
|
158
226
|
}
|
|
159
|
-
let
|
|
227
|
+
let s = 0;
|
|
160
228
|
if (a.minSize) {
|
|
161
229
|
const c = te({
|
|
162
230
|
groupSize: n,
|
|
163
|
-
panelElement:
|
|
231
|
+
panelElement: r,
|
|
164
232
|
styleProp: a.minSize
|
|
165
233
|
});
|
|
166
|
-
|
|
234
|
+
s = G(c / n * 100);
|
|
167
235
|
}
|
|
168
236
|
let u = 100;
|
|
169
237
|
if (a.maxSize) {
|
|
170
238
|
const c = te({
|
|
171
239
|
groupSize: n,
|
|
172
|
-
panelElement:
|
|
240
|
+
panelElement: r,
|
|
173
241
|
styleProp: a.maxSize
|
|
174
242
|
});
|
|
175
|
-
u =
|
|
243
|
+
u = G(c / n * 100);
|
|
176
244
|
}
|
|
177
245
|
return {
|
|
178
246
|
collapsedSize: l,
|
|
179
247
|
collapsible: a.collapsible === !0,
|
|
180
248
|
defaultSize: i,
|
|
181
|
-
minSize:
|
|
249
|
+
minSize: s,
|
|
182
250
|
maxSize: u,
|
|
183
251
|
panelId: o.id
|
|
184
252
|
};
|
|
185
253
|
});
|
|
186
254
|
}
|
|
187
|
-
class
|
|
255
|
+
class at {
|
|
188
256
|
#e = {};
|
|
189
257
|
addListener(t, n) {
|
|
190
258
|
const o = this.#e[t];
|
|
@@ -198,17 +266,17 @@ class rt {
|
|
|
198
266
|
if (o.length === 1)
|
|
199
267
|
o[0].call(null, n);
|
|
200
268
|
else {
|
|
201
|
-
let
|
|
269
|
+
let r = !1, a = null;
|
|
202
270
|
const l = Array.from(o);
|
|
203
271
|
for (let i = 0; i < l.length; i++) {
|
|
204
|
-
const
|
|
272
|
+
const s = l[i];
|
|
205
273
|
try {
|
|
206
|
-
|
|
274
|
+
s.call(null, n);
|
|
207
275
|
} catch (u) {
|
|
208
|
-
a === null && (
|
|
276
|
+
a === null && (r = !0, a = u);
|
|
209
277
|
}
|
|
210
278
|
}
|
|
211
|
-
if (
|
|
279
|
+
if (r)
|
|
212
280
|
throw a;
|
|
213
281
|
}
|
|
214
282
|
}
|
|
@@ -218,62 +286,62 @@ class rt {
|
|
|
218
286
|
removeListener(t, n) {
|
|
219
287
|
const o = this.#e[t];
|
|
220
288
|
if (o !== void 0) {
|
|
221
|
-
const
|
|
222
|
-
|
|
289
|
+
const r = o.indexOf(n);
|
|
290
|
+
r >= 0 && o.splice(r, 1);
|
|
223
291
|
}
|
|
224
292
|
}
|
|
225
293
|
}
|
|
226
294
|
function P(e, t, n = 0) {
|
|
227
|
-
return Math.abs(
|
|
295
|
+
return Math.abs(G(e) - G(t)) <= n;
|
|
228
296
|
}
|
|
229
|
-
let
|
|
297
|
+
let C = {
|
|
230
298
|
cursorFlags: 0,
|
|
231
299
|
interactionState: {
|
|
232
300
|
state: "inactive"
|
|
233
301
|
},
|
|
234
302
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
235
303
|
};
|
|
236
|
-
const _ = new
|
|
304
|
+
const _ = new at();
|
|
237
305
|
function D() {
|
|
238
|
-
return
|
|
306
|
+
return C;
|
|
239
307
|
}
|
|
240
308
|
function E(e) {
|
|
241
|
-
const t = typeof e == "function" ? e(
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
const n =
|
|
245
|
-
return
|
|
246
|
-
...
|
|
309
|
+
const t = typeof e == "function" ? e(C) : e;
|
|
310
|
+
if (C === t)
|
|
311
|
+
return C;
|
|
312
|
+
const n = C;
|
|
313
|
+
return C = {
|
|
314
|
+
...C,
|
|
247
315
|
...t
|
|
248
|
-
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange",
|
|
316
|
+
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange", C.cursorFlags), t.interactionState !== void 0 && _.emit("interactionStateChange", C.interactionState), t.mountedGroups !== void 0 && (C.mountedGroups.forEach((o, r) => {
|
|
249
317
|
o.derivedPanelConstraints.forEach((a) => {
|
|
250
318
|
if (a.collapsible) {
|
|
251
|
-
const { layout: l } = n.mountedGroups.get(
|
|
319
|
+
const { layout: l } = n.mountedGroups.get(r) ?? {};
|
|
252
320
|
if (l) {
|
|
253
321
|
const i = P(
|
|
254
322
|
a.collapsedSize,
|
|
255
323
|
o.layout[a.panelId]
|
|
256
|
-
),
|
|
324
|
+
), s = P(
|
|
257
325
|
a.collapsedSize,
|
|
258
326
|
l[a.panelId]
|
|
259
327
|
);
|
|
260
|
-
i && !
|
|
328
|
+
i && !s && (r.inMemoryLastExpandedPanelSizes[a.panelId] = l[a.panelId]);
|
|
261
329
|
}
|
|
262
330
|
}
|
|
263
331
|
});
|
|
264
|
-
}), _.emit("mountedGroupsChange",
|
|
332
|
+
}), _.emit("mountedGroupsChange", C.mountedGroups)), C;
|
|
265
333
|
}
|
|
266
|
-
const
|
|
267
|
-
},
|
|
334
|
+
const lt = (e) => e, ie = () => {
|
|
335
|
+
}, De = 1, Oe = 2, Te = 4, _e = 8, ge = {
|
|
268
336
|
coarse: 10,
|
|
269
337
|
precise: 5
|
|
270
338
|
};
|
|
271
|
-
function
|
|
339
|
+
function ut({
|
|
272
340
|
cursorFlags: e,
|
|
273
341
|
groups: t,
|
|
274
342
|
state: n
|
|
275
343
|
}) {
|
|
276
|
-
let o = 0,
|
|
344
|
+
let o = 0, r = 0;
|
|
277
345
|
switch (n) {
|
|
278
346
|
case "active":
|
|
279
347
|
case "hover":
|
|
@@ -285,31 +353,31 @@ function at({
|
|
|
285
353
|
break;
|
|
286
354
|
}
|
|
287
355
|
case "vertical": {
|
|
288
|
-
|
|
356
|
+
r++;
|
|
289
357
|
break;
|
|
290
358
|
}
|
|
291
359
|
}
|
|
292
360
|
});
|
|
293
361
|
}
|
|
294
|
-
if (o === 0 &&
|
|
362
|
+
if (o === 0 && r === 0)
|
|
295
363
|
return null;
|
|
296
364
|
switch (n) {
|
|
297
365
|
case "active": {
|
|
298
|
-
const a = (e &
|
|
366
|
+
const a = (e & De) !== 0, l = (e & Oe) !== 0, i = (e & Te) !== 0, s = (e & _e) !== 0;
|
|
299
367
|
if (e) {
|
|
300
368
|
if (a)
|
|
301
|
-
return i ? "se-resize" :
|
|
369
|
+
return i ? "se-resize" : s ? "ne-resize" : "e-resize";
|
|
302
370
|
if (l)
|
|
303
|
-
return i ? "sw-resize" :
|
|
371
|
+
return i ? "sw-resize" : s ? "nw-resize" : "w-resize";
|
|
304
372
|
if (i)
|
|
305
373
|
return "s-resize";
|
|
306
|
-
if (
|
|
374
|
+
if (s)
|
|
307
375
|
return "n-resize";
|
|
308
376
|
}
|
|
309
377
|
break;
|
|
310
378
|
}
|
|
311
379
|
}
|
|
312
|
-
return o > 0 &&
|
|
380
|
+
return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
313
381
|
}
|
|
314
382
|
let re, k;
|
|
315
383
|
function le() {
|
|
@@ -318,9 +386,9 @@ function le() {
|
|
|
318
386
|
switch (t.state) {
|
|
319
387
|
case "active":
|
|
320
388
|
case "hover": {
|
|
321
|
-
const n =
|
|
389
|
+
const n = ut({
|
|
322
390
|
cursorFlags: e,
|
|
323
|
-
groups: t.hitRegions.map((
|
|
391
|
+
groups: t.hitRegions.map((r) => r.group),
|
|
324
392
|
state: t.state
|
|
325
393
|
}), o = `*{cursor: ${n} !important; ${t.state === "active" ? "touch-action: none;" : ""} }`;
|
|
326
394
|
if (re === o)
|
|
@@ -334,7 +402,7 @@ function le() {
|
|
|
334
402
|
}
|
|
335
403
|
}
|
|
336
404
|
}
|
|
337
|
-
function
|
|
405
|
+
function ct(e, t) {
|
|
338
406
|
if (e.length !== t.length)
|
|
339
407
|
return !1;
|
|
340
408
|
for (let n = 0; n < e.length; n++)
|
|
@@ -352,7 +420,7 @@ function j({
|
|
|
352
420
|
const {
|
|
353
421
|
collapsedSize: n = 0,
|
|
354
422
|
collapsible: o,
|
|
355
|
-
maxSize:
|
|
423
|
+
maxSize: r = 100,
|
|
356
424
|
minSize: a = 0
|
|
357
425
|
} = e;
|
|
358
426
|
if (X(t, a) < 0)
|
|
@@ -361,143 +429,143 @@ function j({
|
|
|
361
429
|
X(t, l) < 0 ? t = n : t = a;
|
|
362
430
|
} else
|
|
363
431
|
t = a;
|
|
364
|
-
return t = Math.min(
|
|
432
|
+
return t = Math.min(r, t), t = G(t), t;
|
|
365
433
|
}
|
|
366
434
|
function Y({
|
|
367
435
|
delta: e,
|
|
368
436
|
initialLayout: t,
|
|
369
437
|
panelConstraints: n,
|
|
370
438
|
pivotIndices: o,
|
|
371
|
-
prevLayout:
|
|
439
|
+
prevLayout: r,
|
|
372
440
|
trigger: a
|
|
373
441
|
}) {
|
|
374
442
|
if (P(e, 0))
|
|
375
443
|
return t;
|
|
376
|
-
const l = Object.values(t), i = Object.values(
|
|
444
|
+
const l = Object.values(t), i = Object.values(r), s = [...l], [u, c] = o;
|
|
377
445
|
z(u != null, "Invalid first pivot index"), z(c != null, "Invalid second pivot index");
|
|
378
|
-
let
|
|
446
|
+
let h = 0;
|
|
379
447
|
if (a === "keyboard") {
|
|
380
448
|
{
|
|
381
|
-
const f = e < 0 ? c : u,
|
|
449
|
+
const f = e < 0 ? c : u, d = n[f];
|
|
382
450
|
z(
|
|
383
|
-
|
|
451
|
+
d,
|
|
384
452
|
`Panel constraints not found for index ${f}`
|
|
385
453
|
);
|
|
386
454
|
const {
|
|
387
|
-
collapsedSize:
|
|
388
|
-
collapsible:
|
|
389
|
-
minSize:
|
|
390
|
-
} =
|
|
391
|
-
if (
|
|
392
|
-
const
|
|
455
|
+
collapsedSize: y = 0,
|
|
456
|
+
collapsible: g,
|
|
457
|
+
minSize: v = 0
|
|
458
|
+
} = d;
|
|
459
|
+
if (g) {
|
|
460
|
+
const x = l[f];
|
|
393
461
|
if (z(
|
|
394
|
-
|
|
462
|
+
x != null,
|
|
395
463
|
`Previous layout not found for panel index ${f}`
|
|
396
|
-
), P(
|
|
397
|
-
const
|
|
398
|
-
X(
|
|
464
|
+
), P(x, y)) {
|
|
465
|
+
const S = v - x;
|
|
466
|
+
X(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
|
|
399
467
|
}
|
|
400
468
|
}
|
|
401
469
|
}
|
|
402
470
|
{
|
|
403
|
-
const f = e < 0 ? u : c,
|
|
471
|
+
const f = e < 0 ? u : c, d = n[f];
|
|
404
472
|
z(
|
|
405
|
-
|
|
473
|
+
d,
|
|
406
474
|
`No panel constraints found for index ${f}`
|
|
407
475
|
);
|
|
408
476
|
const {
|
|
409
|
-
collapsedSize:
|
|
410
|
-
collapsible:
|
|
411
|
-
minSize:
|
|
412
|
-
} =
|
|
413
|
-
if (
|
|
414
|
-
const
|
|
477
|
+
collapsedSize: y = 0,
|
|
478
|
+
collapsible: g,
|
|
479
|
+
minSize: v = 0
|
|
480
|
+
} = d;
|
|
481
|
+
if (g) {
|
|
482
|
+
const x = l[f];
|
|
415
483
|
if (z(
|
|
416
|
-
|
|
484
|
+
x != null,
|
|
417
485
|
`Previous layout not found for panel index ${f}`
|
|
418
|
-
), P(
|
|
419
|
-
const
|
|
420
|
-
X(
|
|
486
|
+
), P(x, v)) {
|
|
487
|
+
const S = x - y;
|
|
488
|
+
X(S, Math.abs(e)) > 0 && (e = e < 0 ? 0 - S : S);
|
|
421
489
|
}
|
|
422
490
|
}
|
|
423
491
|
}
|
|
424
492
|
}
|
|
425
493
|
{
|
|
426
494
|
const f = e < 0 ? 1 : -1;
|
|
427
|
-
let
|
|
495
|
+
let d = e < 0 ? c : u, y = 0;
|
|
428
496
|
for (; ; ) {
|
|
429
|
-
const
|
|
497
|
+
const v = l[d];
|
|
430
498
|
z(
|
|
431
|
-
|
|
432
|
-
`Previous layout not found for panel index ${
|
|
499
|
+
v != null,
|
|
500
|
+
`Previous layout not found for panel index ${d}`
|
|
433
501
|
);
|
|
434
|
-
const
|
|
435
|
-
panelConstraints: n[
|
|
502
|
+
const S = j({
|
|
503
|
+
panelConstraints: n[d],
|
|
436
504
|
size: 100
|
|
437
|
-
}) -
|
|
438
|
-
if (
|
|
505
|
+
}) - v;
|
|
506
|
+
if (y += S, d += f, d < 0 || d >= n.length)
|
|
439
507
|
break;
|
|
440
508
|
}
|
|
441
|
-
const
|
|
442
|
-
e = e < 0 ? 0 -
|
|
509
|
+
const g = Math.min(Math.abs(e), Math.abs(y));
|
|
510
|
+
e = e < 0 ? 0 - g : g;
|
|
443
511
|
}
|
|
444
512
|
{
|
|
445
|
-
let
|
|
446
|
-
for (;
|
|
447
|
-
const
|
|
513
|
+
let d = e < 0 ? u : c;
|
|
514
|
+
for (; d >= 0 && d < n.length; ) {
|
|
515
|
+
const y = Math.abs(e) - Math.abs(h), g = l[d];
|
|
448
516
|
z(
|
|
449
|
-
|
|
450
|
-
`Previous layout not found for panel index ${
|
|
517
|
+
g != null,
|
|
518
|
+
`Previous layout not found for panel index ${d}`
|
|
451
519
|
);
|
|
452
|
-
const
|
|
453
|
-
panelConstraints: n[
|
|
454
|
-
size:
|
|
520
|
+
const v = g - y, x = j({
|
|
521
|
+
panelConstraints: n[d],
|
|
522
|
+
size: v
|
|
455
523
|
});
|
|
456
|
-
if (!P(
|
|
524
|
+
if (!P(g, x) && (h += g - x, s[d] = x, h.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
457
525
|
numeric: !0
|
|
458
526
|
}) >= 0))
|
|
459
527
|
break;
|
|
460
|
-
e < 0 ?
|
|
528
|
+
e < 0 ? d-- : d++;
|
|
461
529
|
}
|
|
462
530
|
}
|
|
463
|
-
if (
|
|
464
|
-
return
|
|
531
|
+
if (ct(i, s))
|
|
532
|
+
return r;
|
|
465
533
|
{
|
|
466
|
-
const f = e < 0 ? c : u,
|
|
534
|
+
const f = e < 0 ? c : u, d = l[f];
|
|
467
535
|
z(
|
|
468
|
-
|
|
536
|
+
d != null,
|
|
469
537
|
`Previous layout not found for panel index ${f}`
|
|
470
538
|
);
|
|
471
|
-
const
|
|
539
|
+
const y = d + h, g = j({
|
|
472
540
|
panelConstraints: n[f],
|
|
473
|
-
size:
|
|
541
|
+
size: y
|
|
474
542
|
});
|
|
475
|
-
if (
|
|
476
|
-
let
|
|
477
|
-
for (;
|
|
478
|
-
const b =
|
|
543
|
+
if (s[f] = g, !P(g, y)) {
|
|
544
|
+
let v = y - g, S = e < 0 ? c : u;
|
|
545
|
+
for (; S >= 0 && S < n.length; ) {
|
|
546
|
+
const b = s[S];
|
|
479
547
|
z(
|
|
480
548
|
b != null,
|
|
481
|
-
`Previous layout not found for panel index ${
|
|
549
|
+
`Previous layout not found for panel index ${S}`
|
|
482
550
|
);
|
|
483
|
-
const L = b +
|
|
484
|
-
panelConstraints: n[
|
|
551
|
+
const L = b + v, R = j({
|
|
552
|
+
panelConstraints: n[S],
|
|
485
553
|
size: L
|
|
486
554
|
});
|
|
487
|
-
if (P(b,
|
|
555
|
+
if (P(b, R) || (v -= R - b, s[S] = R), P(v, 0))
|
|
488
556
|
break;
|
|
489
|
-
e > 0 ?
|
|
557
|
+
e > 0 ? S-- : S++;
|
|
490
558
|
}
|
|
491
559
|
}
|
|
492
560
|
}
|
|
493
|
-
const
|
|
494
|
-
(f,
|
|
561
|
+
const m = Object.values(s).reduce(
|
|
562
|
+
(f, d) => d + f,
|
|
495
563
|
0
|
|
496
564
|
);
|
|
497
|
-
if (!P(
|
|
498
|
-
return
|
|
499
|
-
const
|
|
500
|
-
return
|
|
565
|
+
if (!P(m, 100, 0.1))
|
|
566
|
+
return r;
|
|
567
|
+
const p = Object.keys(r);
|
|
568
|
+
return s.reduce((f, d, y) => (f[p[y]] = d, f), {});
|
|
501
569
|
}
|
|
502
570
|
function U(e, t) {
|
|
503
571
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -507,55 +575,55 @@ function U(e, t) {
|
|
|
507
575
|
return !1;
|
|
508
576
|
return !0;
|
|
509
577
|
}
|
|
510
|
-
function
|
|
578
|
+
function Ae({
|
|
511
579
|
event: e,
|
|
512
580
|
hitRegions: t,
|
|
513
581
|
initialLayoutMap: n,
|
|
514
582
|
mountedGroups: o,
|
|
515
|
-
pointerDownAtPoint:
|
|
583
|
+
pointerDownAtPoint: r
|
|
516
584
|
}) {
|
|
517
585
|
let a = 0;
|
|
518
586
|
const l = new Map(o);
|
|
519
587
|
t.forEach((i) => {
|
|
520
|
-
const { group:
|
|
521
|
-
let
|
|
522
|
-
|
|
523
|
-
const f = n.get(
|
|
524
|
-
defaultLayoutDeferred:
|
|
525
|
-
derivedPanelConstraints:
|
|
526
|
-
layout:
|
|
527
|
-
separatorToPanels:
|
|
528
|
-
} = o.get(
|
|
529
|
-
if (
|
|
530
|
-
const
|
|
531
|
-
delta:
|
|
588
|
+
const { group: s, groupSize: u } = i, { disableCursor: c, orientation: h, panels: m } = s;
|
|
589
|
+
let p = 0;
|
|
590
|
+
r ? h === "horizontal" ? p = (e.clientX - r.x) / u * 100 : p = (e.clientY - r.y) / u * 100 : h === "horizontal" ? p = e.clientX < 0 ? -100 : 100 : p = e.clientY < 0 ? -100 : 100;
|
|
591
|
+
const f = n.get(s), {
|
|
592
|
+
defaultLayoutDeferred: d,
|
|
593
|
+
derivedPanelConstraints: y,
|
|
594
|
+
layout: g,
|
|
595
|
+
separatorToPanels: v
|
|
596
|
+
} = o.get(s) ?? { defaultLayoutDeferred: !1 };
|
|
597
|
+
if (y && f && g && v) {
|
|
598
|
+
const x = Y({
|
|
599
|
+
delta: p,
|
|
532
600
|
initialLayout: f,
|
|
533
|
-
panelConstraints:
|
|
534
|
-
pivotIndices: i.panels.map((
|
|
535
|
-
prevLayout:
|
|
601
|
+
panelConstraints: y,
|
|
602
|
+
pivotIndices: i.panels.map((S) => m.indexOf(S)),
|
|
603
|
+
prevLayout: g,
|
|
536
604
|
trigger: "mouse-or-touch"
|
|
537
605
|
});
|
|
538
|
-
if (U(
|
|
539
|
-
if (
|
|
540
|
-
switch (
|
|
606
|
+
if (U(x, g)) {
|
|
607
|
+
if (p !== 0 && !c)
|
|
608
|
+
switch (h) {
|
|
541
609
|
case "horizontal": {
|
|
542
|
-
a |=
|
|
610
|
+
a |= p < 0 ? De : Oe;
|
|
543
611
|
break;
|
|
544
612
|
}
|
|
545
613
|
case "vertical": {
|
|
546
|
-
a |=
|
|
614
|
+
a |= p < 0 ? Te : _e;
|
|
547
615
|
break;
|
|
548
616
|
}
|
|
549
617
|
}
|
|
550
618
|
} else {
|
|
551
619
|
l.set(i.group, {
|
|
552
|
-
defaultLayoutDeferred:
|
|
553
|
-
derivedPanelConstraints:
|
|
554
|
-
layout:
|
|
555
|
-
separatorToPanels:
|
|
620
|
+
defaultLayoutDeferred: d,
|
|
621
|
+
derivedPanelConstraints: y,
|
|
622
|
+
layout: x,
|
|
623
|
+
separatorToPanels: v
|
|
556
624
|
});
|
|
557
|
-
const
|
|
558
|
-
i.group.inMemoryLayouts[
|
|
625
|
+
const S = i.group.panels.map(({ id: b }) => b).join(",");
|
|
626
|
+
i.group.inMemoryLayouts[S] = x;
|
|
559
627
|
}
|
|
560
628
|
}
|
|
561
629
|
}), E({
|
|
@@ -574,7 +642,7 @@ function ve(e) {
|
|
|
574
642
|
switch (t.state) {
|
|
575
643
|
case "active":
|
|
576
644
|
t.hitRegions.forEach((o) => {
|
|
577
|
-
e.currentTarget === o.group.element &&
|
|
645
|
+
e.currentTarget === o.group.element && Ae({
|
|
578
646
|
event: e,
|
|
579
647
|
hitRegions: t.hitRegions,
|
|
580
648
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -596,53 +664,53 @@ function A({
|
|
|
596
664
|
layout: e,
|
|
597
665
|
panelConstraints: t
|
|
598
666
|
}) {
|
|
599
|
-
const o = [...Object.values(e)],
|
|
600
|
-
(i,
|
|
667
|
+
const o = [...Object.values(e)], r = o.reduce(
|
|
668
|
+
(i, s) => i + s,
|
|
601
669
|
0
|
|
602
670
|
);
|
|
603
671
|
if (o.length !== t.length)
|
|
604
672
|
throw Error(
|
|
605
673
|
`Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
|
|
606
674
|
);
|
|
607
|
-
if (!P(
|
|
675
|
+
if (!P(r, 100) && o.length > 0)
|
|
608
676
|
for (let i = 0; i < t.length; i++) {
|
|
609
|
-
const
|
|
610
|
-
z(
|
|
611
|
-
const u = 100 /
|
|
677
|
+
const s = o[i];
|
|
678
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
679
|
+
const u = 100 / r * s;
|
|
612
680
|
o[i] = u;
|
|
613
681
|
}
|
|
614
682
|
let a = 0;
|
|
615
683
|
for (let i = 0; i < t.length; i++) {
|
|
616
|
-
const
|
|
617
|
-
z(
|
|
684
|
+
const s = o[i];
|
|
685
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
618
686
|
const u = j({
|
|
619
687
|
panelConstraints: t[i],
|
|
620
|
-
size:
|
|
688
|
+
size: s
|
|
621
689
|
});
|
|
622
|
-
|
|
690
|
+
s != u && (a += s - u, o[i] = u);
|
|
623
691
|
}
|
|
624
692
|
if (!P(a, 0))
|
|
625
693
|
for (let i = 0; i < t.length; i++) {
|
|
626
|
-
const
|
|
627
|
-
z(
|
|
628
|
-
const u =
|
|
694
|
+
const s = o[i];
|
|
695
|
+
z(s != null, `No layout data found for index ${i}`);
|
|
696
|
+
const u = s + a, c = j({
|
|
629
697
|
panelConstraints: t[i],
|
|
630
698
|
size: u
|
|
631
699
|
});
|
|
632
|
-
if (
|
|
700
|
+
if (s !== c && (a -= c - s, o[i] = c, P(a, 0)))
|
|
633
701
|
break;
|
|
634
702
|
}
|
|
635
703
|
const l = Object.keys(e);
|
|
636
|
-
return o.reduce((i,
|
|
704
|
+
return o.reduce((i, s, u) => (i[l[u]] = s, i), {});
|
|
637
705
|
}
|
|
638
|
-
function
|
|
706
|
+
function Ne({
|
|
639
707
|
groupId: e
|
|
640
708
|
}) {
|
|
641
709
|
const t = () => {
|
|
642
710
|
const { mountedGroups: n } = D();
|
|
643
|
-
for (const [o,
|
|
711
|
+
for (const [o, r] of n)
|
|
644
712
|
if (o.id === e)
|
|
645
|
-
return { group: o, ...
|
|
713
|
+
return { group: o, ...r };
|
|
646
714
|
throw Error(`Could not find Group with id "${e}"`);
|
|
647
715
|
};
|
|
648
716
|
return {
|
|
@@ -653,49 +721,49 @@ function Ae({
|
|
|
653
721
|
setLayout(n) {
|
|
654
722
|
const {
|
|
655
723
|
defaultLayoutDeferred: o,
|
|
656
|
-
derivedPanelConstraints:
|
|
724
|
+
derivedPanelConstraints: r,
|
|
657
725
|
group: a,
|
|
658
726
|
layout: l,
|
|
659
727
|
separatorToPanels: i
|
|
660
|
-
} = t(),
|
|
728
|
+
} = t(), s = A({
|
|
661
729
|
layout: n,
|
|
662
|
-
panelConstraints:
|
|
730
|
+
panelConstraints: r
|
|
663
731
|
});
|
|
664
|
-
return o ? l : (U(l,
|
|
732
|
+
return o ? l : (U(l, s) || E((u) => ({
|
|
665
733
|
mountedGroups: new Map(u.mountedGroups).set(a, {
|
|
666
734
|
defaultLayoutDeferred: o,
|
|
667
|
-
derivedPanelConstraints:
|
|
668
|
-
layout:
|
|
735
|
+
derivedPanelConstraints: r,
|
|
736
|
+
layout: s,
|
|
669
737
|
separatorToPanels: i
|
|
670
738
|
})
|
|
671
|
-
})),
|
|
739
|
+
})), s);
|
|
672
740
|
}
|
|
673
741
|
};
|
|
674
742
|
}
|
|
675
|
-
function
|
|
743
|
+
function $e(e) {
|
|
676
744
|
const { mountedGroups: t } = D(), n = t.get(e);
|
|
677
745
|
return z(n, `Mounted Group ${e.id} not found`), n;
|
|
678
746
|
}
|
|
679
747
|
function T(e, t) {
|
|
680
|
-
const n = oe(e), o =
|
|
681
|
-
(
|
|
748
|
+
const n = oe(e), o = $e(n), r = n.separators.find(
|
|
749
|
+
(h) => h.element === e
|
|
682
750
|
);
|
|
683
|
-
z(
|
|
684
|
-
const a = o.separatorToPanels.get(
|
|
751
|
+
z(r, "Matching separator not found");
|
|
752
|
+
const a = o.separatorToPanels.get(r);
|
|
685
753
|
z(a, "Matching panels not found");
|
|
686
|
-
const l = a.map((
|
|
754
|
+
const l = a.map((h) => n.panels.indexOf(h)), s = Ne({ groupId: n.id }).getLayout(), u = Y({
|
|
687
755
|
delta: t,
|
|
688
|
-
initialLayout:
|
|
756
|
+
initialLayout: s,
|
|
689
757
|
panelConstraints: o.derivedPanelConstraints,
|
|
690
758
|
pivotIndices: l,
|
|
691
|
-
prevLayout:
|
|
759
|
+
prevLayout: s,
|
|
692
760
|
trigger: "keyboard"
|
|
693
761
|
}), c = A({
|
|
694
762
|
layout: u,
|
|
695
763
|
panelConstraints: o.derivedPanelConstraints
|
|
696
764
|
});
|
|
697
|
-
U(
|
|
698
|
-
mountedGroups: new Map(
|
|
765
|
+
U(s, c) || E((h) => ({
|
|
766
|
+
mountedGroups: new Map(h.mountedGroups).set(n, {
|
|
699
767
|
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
700
768
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
701
769
|
layout: c,
|
|
@@ -731,31 +799,31 @@ function Se(e) {
|
|
|
731
799
|
}
|
|
732
800
|
case "Enter": {
|
|
733
801
|
e.preventDefault();
|
|
734
|
-
const o = oe(t), { derivedPanelConstraints:
|
|
735
|
-
(
|
|
802
|
+
const o = oe(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: l } = $e(o), i = o.separators.find(
|
|
803
|
+
(h) => h.element === t
|
|
736
804
|
);
|
|
737
805
|
z(i, "Matching separator not found");
|
|
738
|
-
const
|
|
739
|
-
z(
|
|
740
|
-
const u =
|
|
741
|
-
(
|
|
806
|
+
const s = l.get(i);
|
|
807
|
+
z(s, "Matching panels not found");
|
|
808
|
+
const u = s[0], c = r.find(
|
|
809
|
+
(h) => h.panelId === u.id
|
|
742
810
|
);
|
|
743
811
|
if (z(c, "Panel metadata not found"), c.collapsible) {
|
|
744
|
-
const
|
|
745
|
-
T(t,
|
|
812
|
+
const h = a[u.id], m = c.collapsedSize === h ? o.inMemoryLastExpandedPanelSizes[u.id] ?? c.minSize : c.collapsedSize;
|
|
813
|
+
T(t, m - h);
|
|
746
814
|
}
|
|
747
815
|
break;
|
|
748
816
|
}
|
|
749
817
|
case "F6": {
|
|
750
818
|
e.preventDefault();
|
|
751
|
-
const
|
|
752
|
-
(
|
|
753
|
-
), a = Array.from(
|
|
754
|
-
(
|
|
819
|
+
const r = oe(t).separators.map(
|
|
820
|
+
(s) => s.element
|
|
821
|
+
), a = Array.from(r).findIndex(
|
|
822
|
+
(s) => s === e.currentTarget
|
|
755
823
|
);
|
|
756
824
|
z(a !== null, "Index not found");
|
|
757
|
-
const l = e.shiftKey ? a > 0 ? a - 1 :
|
|
758
|
-
|
|
825
|
+
const l = e.shiftKey ? a > 0 ? a - 1 : r.length - 1 : a + 1 < r.length ? a + 1 : 0;
|
|
826
|
+
r[l].focus();
|
|
759
827
|
break;
|
|
760
828
|
}
|
|
761
829
|
case "Home": {
|
|
@@ -764,46 +832,34 @@ function Se(e) {
|
|
|
764
832
|
}
|
|
765
833
|
}
|
|
766
834
|
}
|
|
767
|
-
function
|
|
768
|
-
|
|
769
|
-
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
770
|
-
Math.abs(e.x - t.left),
|
|
771
|
-
Math.abs(e.x - t.right)
|
|
772
|
-
),
|
|
773
|
-
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(
|
|
774
|
-
Math.abs(e.y - t.top),
|
|
775
|
-
Math.abs(e.y - t.bottom)
|
|
776
|
-
)
|
|
777
|
-
};
|
|
778
|
-
}
|
|
779
|
-
function ct(e, t, n) {
|
|
780
|
-
let o, s = {
|
|
835
|
+
function ft(e, t, n) {
|
|
836
|
+
let o, r = {
|
|
781
837
|
x: 1 / 0,
|
|
782
838
|
y: 1 / 0
|
|
783
839
|
};
|
|
784
840
|
for (const a of t) {
|
|
785
|
-
const l =
|
|
841
|
+
const l = Ge(n, a.rect);
|
|
786
842
|
switch (e) {
|
|
787
843
|
case "horizontal": {
|
|
788
|
-
l.x <=
|
|
844
|
+
l.x <= r.x && (o = a, r = l);
|
|
789
845
|
break;
|
|
790
846
|
}
|
|
791
847
|
case "vertical": {
|
|
792
|
-
l.y <=
|
|
848
|
+
l.y <= r.y && (o = a, r = l);
|
|
793
849
|
break;
|
|
794
850
|
}
|
|
795
851
|
}
|
|
796
852
|
}
|
|
797
853
|
return o ? {
|
|
798
|
-
distance:
|
|
854
|
+
distance: r,
|
|
799
855
|
hitRegion: o
|
|
800
856
|
} : void 0;
|
|
801
857
|
}
|
|
802
858
|
let ne;
|
|
803
|
-
function
|
|
859
|
+
function dt() {
|
|
804
860
|
return ne === void 0 && (typeof matchMedia == "function" ? ne = !!matchMedia("(pointer:coarse)").matches : ne = !1), ne;
|
|
805
861
|
}
|
|
806
|
-
function
|
|
862
|
+
function pt(e, t) {
|
|
807
863
|
if (e === t) throw new Error("Cannot compare node with itself");
|
|
808
864
|
const n = {
|
|
809
865
|
a: we(e),
|
|
@@ -816,38 +872,38 @@ function dt(e, t) {
|
|
|
816
872
|
o,
|
|
817
873
|
"Stacking order can only be calculated for elements with a common ancestor"
|
|
818
874
|
);
|
|
819
|
-
const
|
|
875
|
+
const r = {
|
|
820
876
|
a: ze(xe(n.a)),
|
|
821
877
|
b: ze(xe(n.b))
|
|
822
878
|
};
|
|
823
|
-
if (
|
|
879
|
+
if (r.a === r.b) {
|
|
824
880
|
const a = o.childNodes, l = {
|
|
825
881
|
a: n.a.at(-1),
|
|
826
882
|
b: n.b.at(-1)
|
|
827
883
|
};
|
|
828
884
|
let i = a.length;
|
|
829
885
|
for (; i--; ) {
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
832
|
-
if (
|
|
886
|
+
const s = a[i];
|
|
887
|
+
if (s === l.a) return 1;
|
|
888
|
+
if (s === l.b) return -1;
|
|
833
889
|
}
|
|
834
890
|
}
|
|
835
|
-
return Math.sign(
|
|
891
|
+
return Math.sign(r.a - r.b);
|
|
836
892
|
}
|
|
837
|
-
const
|
|
893
|
+
const ht = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
838
894
|
function mt(e) {
|
|
839
|
-
const t = getComputedStyle(
|
|
895
|
+
const t = getComputedStyle(Fe(e) ?? e).display;
|
|
840
896
|
return t === "flex" || t === "inline-flex";
|
|
841
897
|
}
|
|
842
|
-
function
|
|
898
|
+
function yt(e) {
|
|
843
899
|
const t = getComputedStyle(e);
|
|
844
|
-
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || mt(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" ||
|
|
900
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || mt(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" || ht.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
845
901
|
}
|
|
846
902
|
function xe(e) {
|
|
847
903
|
let t = e.length;
|
|
848
904
|
for (; t--; ) {
|
|
849
905
|
const n = e[t];
|
|
850
|
-
if (z(n, "Missing node"),
|
|
906
|
+
if (z(n, "Missing node"), yt(n)) return n;
|
|
851
907
|
}
|
|
852
908
|
return null;
|
|
853
909
|
}
|
|
@@ -857,46 +913,46 @@ function ze(e) {
|
|
|
857
913
|
function we(e) {
|
|
858
914
|
const t = [];
|
|
859
915
|
for (; e; )
|
|
860
|
-
t.push(e), e =
|
|
916
|
+
t.push(e), e = Fe(e);
|
|
861
917
|
return t;
|
|
862
918
|
}
|
|
863
|
-
function
|
|
919
|
+
function Fe(e) {
|
|
864
920
|
const { parentNode: t } = e;
|
|
865
921
|
return t && t instanceof ShadowRoot ? t.host : t;
|
|
866
922
|
}
|
|
867
|
-
function
|
|
923
|
+
function gt(e, t) {
|
|
868
924
|
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;
|
|
869
925
|
}
|
|
870
|
-
function
|
|
926
|
+
function vt({
|
|
871
927
|
groupElement: e,
|
|
872
928
|
hitRegion: t,
|
|
873
929
|
pointerEventTarget: n
|
|
874
930
|
}) {
|
|
875
931
|
if (!(n instanceof HTMLElement) || n.contains(e) || e.contains(n))
|
|
876
932
|
return !0;
|
|
877
|
-
if (
|
|
933
|
+
if (pt(n, e) > 0) {
|
|
878
934
|
let o = n;
|
|
879
935
|
for (; o; ) {
|
|
880
936
|
if (o.contains(e))
|
|
881
937
|
return !0;
|
|
882
|
-
if (
|
|
938
|
+
if (gt(o.getBoundingClientRect(), t))
|
|
883
939
|
return !1;
|
|
884
940
|
o = o.parentElement;
|
|
885
941
|
}
|
|
886
942
|
}
|
|
887
943
|
return !0;
|
|
888
944
|
}
|
|
889
|
-
function
|
|
945
|
+
function He(e, t) {
|
|
890
946
|
const n = [];
|
|
891
|
-
return t.forEach((o,
|
|
892
|
-
if (
|
|
947
|
+
return t.forEach((o, r) => {
|
|
948
|
+
if (r.disabled)
|
|
893
949
|
return;
|
|
894
|
-
const a =
|
|
950
|
+
const a = dt() ? ge.coarse : ge.precise, l = ke(r), i = ft(r.orientation, l, {
|
|
895
951
|
x: e.clientX,
|
|
896
952
|
y: e.clientY
|
|
897
953
|
});
|
|
898
|
-
i && i.distance.x <= a && i.distance.y <= a &&
|
|
899
|
-
groupElement:
|
|
954
|
+
i && i.distance.x <= a && i.distance.y <= a && vt({
|
|
955
|
+
groupElement: r.element,
|
|
900
956
|
hitRegion: i.hitRegion.rect,
|
|
901
957
|
pointerEventTarget: e.target
|
|
902
958
|
}) && n.push(i.hitRegion);
|
|
@@ -905,14 +961,14 @@ function Fe(e, t) {
|
|
|
905
961
|
function be(e) {
|
|
906
962
|
if (e.defaultPrevented)
|
|
907
963
|
return;
|
|
908
|
-
const { mountedGroups: t } = D(), n =
|
|
964
|
+
const { mountedGroups: t } = D(), n = He(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
909
965
|
let i = !1;
|
|
910
|
-
n.forEach((
|
|
911
|
-
o.add(
|
|
912
|
-
|
|
913
|
-
}),
|
|
914
|
-
const u = t.get(
|
|
915
|
-
u && l.set(
|
|
966
|
+
n.forEach((s) => {
|
|
967
|
+
o.add(s.group), s.panels.forEach((c) => {
|
|
968
|
+
r.add(c);
|
|
969
|
+
}), s.separator && (a.add(s.separator), i || (i = !0, s.separator.element.focus()));
|
|
970
|
+
const u = t.get(s.group);
|
|
971
|
+
u && l.set(s.group, u.layout);
|
|
916
972
|
}), E({
|
|
917
973
|
interactionState: {
|
|
918
974
|
hitRegions: n,
|
|
@@ -942,7 +998,7 @@ function Le(e) {
|
|
|
942
998
|
);
|
|
943
999
|
return;
|
|
944
1000
|
}
|
|
945
|
-
|
|
1001
|
+
Ae({
|
|
946
1002
|
event: e,
|
|
947
1003
|
hitRegions: t.hitRegions,
|
|
948
1004
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -952,7 +1008,7 @@ function Le(e) {
|
|
|
952
1008
|
break;
|
|
953
1009
|
}
|
|
954
1010
|
default: {
|
|
955
|
-
const o =
|
|
1011
|
+
const o = He(e, n);
|
|
956
1012
|
o.length === 0 ? t.state !== "inactive" && E({
|
|
957
1013
|
interactionState: { state: "inactive" }
|
|
958
1014
|
}) : E({
|
|
@@ -980,121 +1036,120 @@ function Pe(e) {
|
|
|
980
1036
|
}), le();
|
|
981
1037
|
}
|
|
982
1038
|
}
|
|
983
|
-
function
|
|
1039
|
+
function Re(e) {
|
|
984
1040
|
let t = 0, n = 0;
|
|
985
1041
|
const o = {};
|
|
986
1042
|
for (const a of e)
|
|
987
1043
|
if (a.defaultSize !== void 0) {
|
|
988
1044
|
t++;
|
|
989
|
-
const l =
|
|
1045
|
+
const l = G(a.defaultSize);
|
|
990
1046
|
n += l, o[a.panelId] = l;
|
|
991
1047
|
} else
|
|
992
1048
|
o[a.panelId] = void 0;
|
|
993
|
-
const
|
|
994
|
-
if (
|
|
995
|
-
const a =
|
|
1049
|
+
const r = e.length - t;
|
|
1050
|
+
if (r !== 0) {
|
|
1051
|
+
const a = G((100 - n) / r);
|
|
996
1052
|
for (const l of e)
|
|
997
1053
|
l.defaultSize === void 0 && (o[l.panelId] = a);
|
|
998
1054
|
}
|
|
999
1055
|
return o;
|
|
1000
1056
|
}
|
|
1001
|
-
function
|
|
1057
|
+
function St(e, t, n) {
|
|
1002
1058
|
const o = n[0];
|
|
1003
1059
|
if (!o)
|
|
1004
1060
|
return;
|
|
1005
|
-
const
|
|
1006
|
-
if (!
|
|
1061
|
+
const r = e.panels.find((l) => l.element === t);
|
|
1062
|
+
if (!r || !r.onResize)
|
|
1007
1063
|
return;
|
|
1008
1064
|
const a = B({ group: e });
|
|
1009
|
-
|
|
1065
|
+
r.onResize(
|
|
1010
1066
|
{
|
|
1011
|
-
asPercentage:
|
|
1067
|
+
asPercentage: G(
|
|
1012
1068
|
o.inlineSize / a * 100
|
|
1013
1069
|
),
|
|
1014
1070
|
inPixels: o.inlineSize
|
|
1015
1071
|
},
|
|
1016
|
-
|
|
1072
|
+
r.id
|
|
1017
1073
|
);
|
|
1018
1074
|
}
|
|
1019
|
-
function
|
|
1075
|
+
function xt(e) {
|
|
1020
1076
|
let t = !0;
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = new ResizeObserver((m) => {
|
|
1026
|
-
for (const f of m) {
|
|
1027
|
-
const { borderBoxSize: p, target: h } = f;
|
|
1028
|
-
if (h === e.element) {
|
|
1077
|
+
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((p) => {
|
|
1078
|
+
for (const f of p) {
|
|
1079
|
+
const { borderBoxSize: d, target: y } = f;
|
|
1080
|
+
if (y === e.element) {
|
|
1029
1081
|
if (t) {
|
|
1030
1082
|
if (B({ group: e }) === 0)
|
|
1031
1083
|
return;
|
|
1032
|
-
E((
|
|
1033
|
-
const
|
|
1034
|
-
if (
|
|
1035
|
-
const
|
|
1084
|
+
E((v) => {
|
|
1085
|
+
const x = v.mountedGroups.get(e);
|
|
1086
|
+
if (x) {
|
|
1087
|
+
const S = ye(e), b = x.defaultLayoutDeferred ? Re(S) : x.layout, L = A({
|
|
1036
1088
|
layout: b,
|
|
1037
|
-
panelConstraints:
|
|
1089
|
+
panelConstraints: S
|
|
1038
1090
|
});
|
|
1039
|
-
return !
|
|
1040
|
-
mountedGroups: new Map(
|
|
1091
|
+
return !x.defaultLayoutDeferred && U(b, L) ? v : {
|
|
1092
|
+
mountedGroups: new Map(v.mountedGroups).set(e, {
|
|
1041
1093
|
defaultLayoutDeferred: !1,
|
|
1042
|
-
derivedPanelConstraints:
|
|
1094
|
+
derivedPanelConstraints: S,
|
|
1043
1095
|
layout: L,
|
|
1044
|
-
separatorToPanels:
|
|
1096
|
+
separatorToPanels: x.separatorToPanels
|
|
1045
1097
|
})
|
|
1046
1098
|
};
|
|
1047
1099
|
}
|
|
1048
|
-
return
|
|
1100
|
+
return v;
|
|
1049
1101
|
});
|
|
1050
1102
|
}
|
|
1051
1103
|
} else
|
|
1052
|
-
|
|
1104
|
+
St(e, y, d);
|
|
1053
1105
|
}
|
|
1054
1106
|
});
|
|
1055
|
-
|
|
1107
|
+
r.observe(e.element), e.panels.forEach((p) => {
|
|
1056
1108
|
z(
|
|
1057
|
-
!n.has(
|
|
1058
|
-
`Panel ids must be unique; id "${
|
|
1059
|
-
), n.add(
|
|
1109
|
+
!n.has(p.id),
|
|
1110
|
+
`Panel ids must be unique; id "${p.id}" was used more than once`
|
|
1111
|
+
), n.add(p.id), p.onResize && r.observe(p.element);
|
|
1060
1112
|
});
|
|
1061
|
-
const a = B({ group: e }), l = ye(e), i = e.panels.map(({ id:
|
|
1062
|
-
let
|
|
1063
|
-
|
|
1064
|
-
const u = e.inMemoryLayouts[i] ??
|
|
1113
|
+
const a = B({ group: e }), l = ye(e), i = e.panels.map(({ id: p }) => p).join(",");
|
|
1114
|
+
let s = e.defaultLayout;
|
|
1115
|
+
s && e.panels.length !== Object.keys(s).length && (s = void 0);
|
|
1116
|
+
const u = e.inMemoryLayouts[i] ?? s ?? Re(l), c = A({
|
|
1065
1117
|
layout: u,
|
|
1066
1118
|
panelConstraints: l
|
|
1067
|
-
}),
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1119
|
+
}), h = ke(e), m = E((p) => {
|
|
1120
|
+
const f = /* @__PURE__ */ new Map();
|
|
1121
|
+
return h.forEach((d) => {
|
|
1122
|
+
d.separator && f.set(d.separator, d.panels);
|
|
1123
|
+
}), {
|
|
1124
|
+
mountedGroups: new Map(p.mountedGroups).set(e, {
|
|
1125
|
+
defaultLayoutDeferred: a === 0,
|
|
1126
|
+
derivedPanelConstraints: l,
|
|
1127
|
+
layout: c,
|
|
1128
|
+
separatorToPanels: f
|
|
1129
|
+
})
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
return e.element.addEventListener("pointerleave", ve), e.separators.forEach((p) => {
|
|
1078
1133
|
z(
|
|
1079
|
-
!o.has(
|
|
1080
|
-
`Separator ids must be unique; id "${
|
|
1081
|
-
), o.add(
|
|
1082
|
-
}),
|
|
1134
|
+
!o.has(p.id),
|
|
1135
|
+
`Separator ids must be unique; id "${p.id}" was used more than once`
|
|
1136
|
+
), o.add(p.id), p.element.addEventListener("keydown", Se);
|
|
1137
|
+
}), m.mountedGroups.size === 1 && (window.addEventListener("pointerdown", be), window.addEventListener("pointermove", Le), window.addEventListener("pointerup", Pe)), function() {
|
|
1083
1138
|
t = !1;
|
|
1084
|
-
const f = E((
|
|
1085
|
-
const
|
|
1086
|
-
return
|
|
1139
|
+
const f = E((d) => {
|
|
1140
|
+
const y = new Map(d.mountedGroups);
|
|
1141
|
+
return y.delete(e), { mountedGroups: y };
|
|
1087
1142
|
});
|
|
1088
|
-
e.element.removeEventListener("pointerleave", ve), e.separators.forEach((
|
|
1089
|
-
|
|
1090
|
-
}), f.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", be), window.removeEventListener("pointermove", Le), window.removeEventListener("pointerup", Pe)),
|
|
1143
|
+
e.element.removeEventListener("pointerleave", ve), e.separators.forEach((d) => {
|
|
1144
|
+
d.element.removeEventListener("keydown", Se);
|
|
1145
|
+
}), f.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", be), window.removeEventListener("pointermove", Le), window.removeEventListener("pointerup", Pe)), r.disconnect();
|
|
1091
1146
|
};
|
|
1092
1147
|
}
|
|
1093
1148
|
function ue(e) {
|
|
1094
|
-
const t =
|
|
1149
|
+
const t = Xe();
|
|
1095
1150
|
return `${e ?? t}`;
|
|
1096
1151
|
}
|
|
1097
|
-
const N = typeof window < "u" ?
|
|
1152
|
+
const N = typeof window < "u" ? Ye : Ce;
|
|
1098
1153
|
function ce(e) {
|
|
1099
1154
|
const t = O(e);
|
|
1100
1155
|
return N(() => {
|
|
@@ -1118,28 +1173,28 @@ function fe(...e) {
|
|
|
1118
1173
|
});
|
|
1119
1174
|
});
|
|
1120
1175
|
}
|
|
1121
|
-
function
|
|
1176
|
+
function zt(e) {
|
|
1122
1177
|
const t = O({ ...e });
|
|
1123
1178
|
return N(() => {
|
|
1124
1179
|
for (const n in e)
|
|
1125
1180
|
t.current[n] = e[n];
|
|
1126
1181
|
}, [e]), t.current;
|
|
1127
1182
|
}
|
|
1128
|
-
const
|
|
1129
|
-
function
|
|
1183
|
+
const We = "--react-resizable-panels--panel--pointer-events";
|
|
1184
|
+
function je(e, t) {
|
|
1130
1185
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1131
1186
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1132
1187
|
}
|
|
1133
|
-
const
|
|
1134
|
-
function
|
|
1188
|
+
const Be = qe(null);
|
|
1189
|
+
function wt(e, t) {
|
|
1135
1190
|
const n = O({
|
|
1136
1191
|
getLayout: () => ({}),
|
|
1137
|
-
setLayout:
|
|
1192
|
+
setLayout: lt
|
|
1138
1193
|
});
|
|
1139
1194
|
Me(t, () => n.current, []), N(() => {
|
|
1140
1195
|
Object.assign(
|
|
1141
1196
|
n.current,
|
|
1142
|
-
|
|
1197
|
+
Ne({ groupId: e })
|
|
1143
1198
|
);
|
|
1144
1199
|
});
|
|
1145
1200
|
}
|
|
@@ -1148,23 +1203,23 @@ function Gt({
|
|
|
1148
1203
|
className: t,
|
|
1149
1204
|
defaultLayout: n,
|
|
1150
1205
|
disableCursor: o,
|
|
1151
|
-
disabled:
|
|
1206
|
+
disabled: r,
|
|
1152
1207
|
elementRef: a,
|
|
1153
1208
|
groupRef: l,
|
|
1154
1209
|
id: i,
|
|
1155
|
-
onLayoutChange:
|
|
1210
|
+
onLayoutChange: s,
|
|
1156
1211
|
orientation: u = "horizontal",
|
|
1157
1212
|
style: c,
|
|
1158
|
-
...
|
|
1213
|
+
...h
|
|
1159
1214
|
}) {
|
|
1160
|
-
const
|
|
1161
|
-
U(
|
|
1162
|
-
}), f = ue(i), [
|
|
1215
|
+
const m = O({}), p = ce((w) => {
|
|
1216
|
+
U(m.current, w) || (m.current = w, s?.(w));
|
|
1217
|
+
}), f = ue(i), [d, y] = I(!1), [g, v] = I(null), [x, S] = I(n ?? {}), [b, L] = I([]), [R, q] = I([]), Z = O({
|
|
1163
1218
|
lastExpandedPanelSizes: {},
|
|
1164
1219
|
layouts: {}
|
|
1165
|
-
}), J = fe(
|
|
1166
|
-
|
|
1167
|
-
const Q =
|
|
1220
|
+
}), J = fe(v, a);
|
|
1221
|
+
wt(f, l);
|
|
1222
|
+
const Q = Ie(
|
|
1168
1223
|
() => ({
|
|
1169
1224
|
id: f,
|
|
1170
1225
|
orientation: u,
|
|
@@ -1180,37 +1235,37 @@ function Gt({
|
|
|
1180
1235
|
})
|
|
1181
1236
|
}),
|
|
1182
1237
|
[f, u]
|
|
1183
|
-
), $ =
|
|
1238
|
+
), $ = zt({
|
|
1184
1239
|
defaultLayout: n,
|
|
1185
1240
|
disableCursor: o
|
|
1186
1241
|
}), V = O(null);
|
|
1187
1242
|
N(() => {
|
|
1188
|
-
if (
|
|
1243
|
+
if (g === null)
|
|
1189
1244
|
return;
|
|
1190
1245
|
const w = {
|
|
1191
1246
|
defaultLayout: $.defaultLayout,
|
|
1192
1247
|
disableCursor: !!$.disableCursor,
|
|
1193
|
-
disabled: !!
|
|
1194
|
-
element:
|
|
1248
|
+
disabled: !!r,
|
|
1249
|
+
element: g,
|
|
1195
1250
|
id: f,
|
|
1196
1251
|
inMemoryLastExpandedPanelSizes: Z.current.lastExpandedPanelSizes,
|
|
1197
1252
|
inMemoryLayouts: Z.current.layouts,
|
|
1198
1253
|
orientation: u,
|
|
1199
1254
|
panels: b,
|
|
1200
|
-
separators:
|
|
1255
|
+
separators: R
|
|
1201
1256
|
};
|
|
1202
1257
|
V.current = w;
|
|
1203
|
-
const M =
|
|
1204
|
-
if (
|
|
1205
|
-
const { defaultLayoutDeferred: H, derivedPanelConstraints: W, layout: ee } =
|
|
1206
|
-
!H && W.length > 0 && (
|
|
1258
|
+
const M = xt(w), he = D().mountedGroups.get(w);
|
|
1259
|
+
if (he) {
|
|
1260
|
+
const { defaultLayoutDeferred: H, derivedPanelConstraints: W, layout: ee } = he;
|
|
1261
|
+
!H && W.length > 0 && (S(ee), p?.(ee));
|
|
1207
1262
|
}
|
|
1208
|
-
const
|
|
1263
|
+
const Ue = _.addListener(
|
|
1209
1264
|
"interactionStateChange",
|
|
1210
1265
|
(H) => {
|
|
1211
1266
|
switch (H.state) {
|
|
1212
1267
|
case "active": {
|
|
1213
|
-
|
|
1268
|
+
y(
|
|
1214
1269
|
H.hitRegions.some(
|
|
1215
1270
|
(W) => W.group === w
|
|
1216
1271
|
)
|
|
@@ -1218,50 +1273,50 @@ function Gt({
|
|
|
1218
1273
|
break;
|
|
1219
1274
|
}
|
|
1220
1275
|
default: {
|
|
1221
|
-
|
|
1276
|
+
y(!1);
|
|
1222
1277
|
break;
|
|
1223
1278
|
}
|
|
1224
1279
|
}
|
|
1225
1280
|
}
|
|
1226
|
-
),
|
|
1281
|
+
), Ve = _.addListener(
|
|
1227
1282
|
"mountedGroupsChange",
|
|
1228
1283
|
(H) => {
|
|
1229
1284
|
const W = H.get(w);
|
|
1230
1285
|
if (W) {
|
|
1231
|
-
const { defaultLayoutDeferred: ee, derivedPanelConstraints:
|
|
1232
|
-
if (ee ||
|
|
1286
|
+
const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ke, layout: me } = W;
|
|
1287
|
+
if (ee || Ke.length === 0)
|
|
1233
1288
|
return;
|
|
1234
|
-
|
|
1289
|
+
S(me), p?.(me);
|
|
1235
1290
|
}
|
|
1236
1291
|
}
|
|
1237
1292
|
);
|
|
1238
1293
|
return () => {
|
|
1239
|
-
V.current = null, M(),
|
|
1294
|
+
V.current = null, M(), Ue(), Ve();
|
|
1240
1295
|
};
|
|
1241
1296
|
}, [
|
|
1242
|
-
|
|
1243
|
-
|
|
1297
|
+
r,
|
|
1298
|
+
g,
|
|
1244
1299
|
f,
|
|
1245
|
-
|
|
1300
|
+
p,
|
|
1246
1301
|
u,
|
|
1247
1302
|
b,
|
|
1248
|
-
|
|
1303
|
+
R,
|
|
1249
1304
|
$
|
|
1250
|
-
]),
|
|
1305
|
+
]), Ce(() => {
|
|
1251
1306
|
const w = V.current;
|
|
1252
1307
|
w && (w.defaultLayout = n, w.disableCursor = !!o);
|
|
1253
1308
|
});
|
|
1254
1309
|
const pe = {
|
|
1255
|
-
[
|
|
1310
|
+
[We]: d ? "none" : void 0
|
|
1256
1311
|
};
|
|
1257
|
-
for (const w in
|
|
1258
|
-
const M =
|
|
1312
|
+
for (const w in x) {
|
|
1313
|
+
const M = je(f, w), F = x[w];
|
|
1259
1314
|
pe[M] = F;
|
|
1260
1315
|
}
|
|
1261
|
-
return /* @__PURE__ */ K(
|
|
1316
|
+
return /* @__PURE__ */ K(Be.Provider, { value: Q, children: /* @__PURE__ */ K(
|
|
1262
1317
|
"div",
|
|
1263
1318
|
{
|
|
1264
|
-
...
|
|
1319
|
+
...h,
|
|
1265
1320
|
"aria-orientation": u,
|
|
1266
1321
|
className: t,
|
|
1267
1322
|
"data-group": !0,
|
|
@@ -1282,7 +1337,7 @@ function Gt({
|
|
|
1282
1337
|
function ae(e) {
|
|
1283
1338
|
return `react-resizable-panels:${e}`;
|
|
1284
1339
|
}
|
|
1285
|
-
function
|
|
1340
|
+
function bt({
|
|
1286
1341
|
id: e,
|
|
1287
1342
|
layout: t,
|
|
1288
1343
|
storage: n
|
|
@@ -1294,19 +1349,19 @@ function wt({
|
|
|
1294
1349
|
console.error(o);
|
|
1295
1350
|
}
|
|
1296
1351
|
}
|
|
1297
|
-
function
|
|
1352
|
+
function kt({
|
|
1298
1353
|
groupId: e,
|
|
1299
1354
|
storage: t
|
|
1300
1355
|
}) {
|
|
1301
|
-
const n =
|
|
1302
|
-
|
|
1356
|
+
const n = Ze(
|
|
1357
|
+
Lt,
|
|
1303
1358
|
() => t.getItem(ae(e)),
|
|
1304
1359
|
() => t.getItem(ae(e))
|
|
1305
|
-
), o =
|
|
1360
|
+
), o = Ie(
|
|
1306
1361
|
() => n ? JSON.parse(n) : void 0,
|
|
1307
1362
|
[n]
|
|
1308
|
-
),
|
|
1309
|
-
(a) =>
|
|
1363
|
+
), r = Ee(
|
|
1364
|
+
(a) => bt({
|
|
1310
1365
|
id: e,
|
|
1311
1366
|
layout: a,
|
|
1312
1367
|
storage: t
|
|
@@ -1315,59 +1370,59 @@ function It({
|
|
|
1315
1370
|
);
|
|
1316
1371
|
return {
|
|
1317
1372
|
defaultLayout: o,
|
|
1318
|
-
onLayoutChange:
|
|
1373
|
+
onLayoutChange: r
|
|
1319
1374
|
};
|
|
1320
1375
|
}
|
|
1321
|
-
function
|
|
1376
|
+
function Lt() {
|
|
1322
1377
|
return function() {
|
|
1323
1378
|
};
|
|
1324
1379
|
}
|
|
1325
|
-
function kt() {
|
|
1326
|
-
return G(null);
|
|
1327
|
-
}
|
|
1328
1380
|
function Dt() {
|
|
1381
|
+
return I(null);
|
|
1382
|
+
}
|
|
1383
|
+
function Ot() {
|
|
1329
1384
|
return O(null);
|
|
1330
1385
|
}
|
|
1331
1386
|
function de() {
|
|
1332
|
-
const e =
|
|
1387
|
+
const e = Je(Be);
|
|
1333
1388
|
return z(
|
|
1334
1389
|
e,
|
|
1335
1390
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1336
1391
|
), e;
|
|
1337
1392
|
}
|
|
1338
|
-
function
|
|
1393
|
+
function Pt({
|
|
1339
1394
|
groupId: e,
|
|
1340
1395
|
panelId: t
|
|
1341
1396
|
}) {
|
|
1342
1397
|
const n = () => {
|
|
1343
1398
|
const { mountedGroups: i } = D();
|
|
1344
1399
|
for (const [
|
|
1345
|
-
|
|
1400
|
+
s,
|
|
1346
1401
|
{
|
|
1347
1402
|
defaultLayoutDeferred: u,
|
|
1348
1403
|
derivedPanelConstraints: c,
|
|
1349
|
-
layout:
|
|
1350
|
-
separatorToPanels:
|
|
1404
|
+
layout: h,
|
|
1405
|
+
separatorToPanels: m
|
|
1351
1406
|
}
|
|
1352
1407
|
] of i)
|
|
1353
|
-
if (
|
|
1408
|
+
if (s.id === e)
|
|
1354
1409
|
return {
|
|
1355
1410
|
defaultLayoutDeferred: u,
|
|
1356
1411
|
derivedPanelConstraints: c,
|
|
1357
|
-
group:
|
|
1358
|
-
layout:
|
|
1359
|
-
separatorToPanels:
|
|
1412
|
+
group: s,
|
|
1413
|
+
layout: h,
|
|
1414
|
+
separatorToPanels: m
|
|
1360
1415
|
};
|
|
1361
1416
|
throw Error(`Group ${e} not found`);
|
|
1362
1417
|
}, o = () => {
|
|
1363
1418
|
const i = n().derivedPanelConstraints.find(
|
|
1364
|
-
(
|
|
1419
|
+
(s) => s.panelId === t
|
|
1365
1420
|
);
|
|
1366
1421
|
if (i !== void 0)
|
|
1367
1422
|
return i;
|
|
1368
1423
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1369
|
-
},
|
|
1370
|
-
const i = n().group.panels.find((
|
|
1424
|
+
}, r = () => {
|
|
1425
|
+
const i = n().group.panels.find((s) => s.id === t);
|
|
1371
1426
|
if (i !== void 0)
|
|
1372
1427
|
return i;
|
|
1373
1428
|
throw Error(`Layout not found for Panel ${t}`);
|
|
@@ -1377,62 +1432,62 @@ function Lt({
|
|
|
1377
1432
|
return i;
|
|
1378
1433
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1379
1434
|
}, l = (i) => {
|
|
1380
|
-
const
|
|
1381
|
-
if (i ===
|
|
1435
|
+
const s = a();
|
|
1436
|
+
if (i === s)
|
|
1382
1437
|
return;
|
|
1383
1438
|
const {
|
|
1384
1439
|
defaultLayoutDeferred: u,
|
|
1385
1440
|
derivedPanelConstraints: c,
|
|
1386
|
-
group:
|
|
1387
|
-
layout:
|
|
1388
|
-
separatorToPanels:
|
|
1389
|
-
} = n(), f =
|
|
1390
|
-
delta:
|
|
1391
|
-
initialLayout:
|
|
1441
|
+
group: h,
|
|
1442
|
+
layout: m,
|
|
1443
|
+
separatorToPanels: p
|
|
1444
|
+
} = n(), f = h.panels.findIndex((v) => v.id === t), d = f === h.panels.length - 1, y = Y({
|
|
1445
|
+
delta: d ? s - i : i - s,
|
|
1446
|
+
initialLayout: m,
|
|
1392
1447
|
panelConstraints: c,
|
|
1393
|
-
pivotIndices:
|
|
1394
|
-
prevLayout:
|
|
1448
|
+
pivotIndices: d ? [f - 1, f] : [f, f + 1],
|
|
1449
|
+
prevLayout: m,
|
|
1395
1450
|
trigger: "imperative-api"
|
|
1396
|
-
}),
|
|
1397
|
-
layout:
|
|
1451
|
+
}), g = A({
|
|
1452
|
+
layout: y,
|
|
1398
1453
|
panelConstraints: c
|
|
1399
1454
|
});
|
|
1400
|
-
U(
|
|
1401
|
-
mountedGroups: new Map(
|
|
1455
|
+
U(m, g) || E((v) => ({
|
|
1456
|
+
mountedGroups: new Map(v.mountedGroups).set(h, {
|
|
1402
1457
|
defaultLayoutDeferred: u,
|
|
1403
1458
|
derivedPanelConstraints: c,
|
|
1404
|
-
layout:
|
|
1405
|
-
separatorToPanels:
|
|
1459
|
+
layout: g,
|
|
1460
|
+
separatorToPanels: p
|
|
1406
1461
|
})
|
|
1407
1462
|
}));
|
|
1408
1463
|
};
|
|
1409
1464
|
return {
|
|
1410
1465
|
collapse: () => {
|
|
1411
|
-
const { collapsible: i, collapsedSize:
|
|
1412
|
-
i && u !==
|
|
1466
|
+
const { collapsible: i, collapsedSize: s } = o(), u = a();
|
|
1467
|
+
i && u !== s && l(s);
|
|
1413
1468
|
},
|
|
1414
1469
|
expand: () => {
|
|
1415
|
-
const { collapsible: i, collapsedSize:
|
|
1416
|
-
i && c ===
|
|
1470
|
+
const { collapsible: i, collapsedSize: s, minSize: u } = o(), c = a();
|
|
1471
|
+
i && c === s && l(u);
|
|
1417
1472
|
},
|
|
1418
1473
|
getSize: () => {
|
|
1419
|
-
const { group: i } = n(),
|
|
1474
|
+
const { group: i } = n(), s = a(), { element: u } = r(), c = i.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
|
|
1420
1475
|
return {
|
|
1421
|
-
asPercentage:
|
|
1476
|
+
asPercentage: s,
|
|
1422
1477
|
inPixels: c
|
|
1423
1478
|
};
|
|
1424
1479
|
},
|
|
1425
1480
|
isCollapsed: () => {
|
|
1426
|
-
const { collapsible: i, collapsedSize:
|
|
1427
|
-
return i && P(
|
|
1481
|
+
const { collapsible: i, collapsedSize: s } = o(), u = a();
|
|
1482
|
+
return i && P(s, u);
|
|
1428
1483
|
},
|
|
1429
1484
|
resize: (i) => {
|
|
1430
1485
|
if (a() !== i) {
|
|
1431
1486
|
let u;
|
|
1432
1487
|
switch (typeof i) {
|
|
1433
1488
|
case "number": {
|
|
1434
|
-
const { group: c } = n(),
|
|
1435
|
-
u =
|
|
1489
|
+
const { group: c } = n(), h = B({ group: c });
|
|
1490
|
+
u = G(i / h * 100);
|
|
1436
1491
|
break;
|
|
1437
1492
|
}
|
|
1438
1493
|
case "string": {
|
|
@@ -1445,7 +1500,7 @@ function Lt({
|
|
|
1445
1500
|
}
|
|
1446
1501
|
};
|
|
1447
1502
|
}
|
|
1448
|
-
function
|
|
1503
|
+
function Rt(e, t) {
|
|
1449
1504
|
const { id: n } = de(), o = O({
|
|
1450
1505
|
collapse: ie,
|
|
1451
1506
|
expand: ie,
|
|
@@ -1459,65 +1514,65 @@ function Pt(e, t) {
|
|
|
1459
1514
|
Me(t, () => o.current, []), N(() => {
|
|
1460
1515
|
Object.assign(
|
|
1461
1516
|
o.current,
|
|
1462
|
-
|
|
1517
|
+
Pt({ groupId: n, panelId: e })
|
|
1463
1518
|
);
|
|
1464
1519
|
});
|
|
1465
1520
|
}
|
|
1466
|
-
function
|
|
1521
|
+
function Tt({
|
|
1467
1522
|
children: e,
|
|
1468
1523
|
className: t,
|
|
1469
1524
|
collapsedSize: n = "0%",
|
|
1470
1525
|
collapsible: o = !1,
|
|
1471
|
-
defaultSize:
|
|
1526
|
+
defaultSize: r,
|
|
1472
1527
|
elementRef: a,
|
|
1473
1528
|
id: l,
|
|
1474
1529
|
maxSize: i = "100%",
|
|
1475
|
-
minSize:
|
|
1530
|
+
minSize: s = "0%",
|
|
1476
1531
|
onResize: u,
|
|
1477
1532
|
panelRef: c,
|
|
1478
|
-
style:
|
|
1479
|
-
...
|
|
1533
|
+
style: h,
|
|
1534
|
+
...m
|
|
1480
1535
|
}) {
|
|
1481
|
-
const
|
|
1482
|
-
u?.(
|
|
1536
|
+
const p = !!l, f = ue(l), [d, y] = I(null), g = fe(y, a), { id: v, registerPanel: x } = de(), S = u !== null, b = ce((R) => {
|
|
1537
|
+
u?.(R, l);
|
|
1483
1538
|
});
|
|
1484
1539
|
N(() => {
|
|
1485
|
-
if (
|
|
1486
|
-
return
|
|
1487
|
-
element:
|
|
1540
|
+
if (d !== null)
|
|
1541
|
+
return x({
|
|
1542
|
+
element: d,
|
|
1488
1543
|
id: f,
|
|
1489
|
-
idIsStable:
|
|
1490
|
-
onResize:
|
|
1544
|
+
idIsStable: p,
|
|
1545
|
+
onResize: S ? b : void 0,
|
|
1491
1546
|
panelConstraints: {
|
|
1492
1547
|
collapsedSize: n,
|
|
1493
1548
|
collapsible: o,
|
|
1494
|
-
defaultSize:
|
|
1549
|
+
defaultSize: r,
|
|
1495
1550
|
maxSize: i,
|
|
1496
|
-
minSize:
|
|
1551
|
+
minSize: s
|
|
1497
1552
|
}
|
|
1498
1553
|
});
|
|
1499
1554
|
}, [
|
|
1500
1555
|
n,
|
|
1501
1556
|
o,
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1557
|
+
r,
|
|
1558
|
+
d,
|
|
1559
|
+
S,
|
|
1505
1560
|
f,
|
|
1506
|
-
|
|
1561
|
+
p,
|
|
1507
1562
|
i,
|
|
1508
|
-
|
|
1563
|
+
s,
|
|
1509
1564
|
b,
|
|
1510
|
-
|
|
1511
|
-
]),
|
|
1512
|
-
const L =
|
|
1565
|
+
x
|
|
1566
|
+
]), Rt(f, c);
|
|
1567
|
+
const L = je(v, f);
|
|
1513
1568
|
return /* @__PURE__ */ K(
|
|
1514
1569
|
"div",
|
|
1515
1570
|
{
|
|
1516
|
-
...
|
|
1571
|
+
...m,
|
|
1517
1572
|
"data-panel": !0,
|
|
1518
1573
|
"data-testid": f,
|
|
1519
1574
|
id: f,
|
|
1520
|
-
ref:
|
|
1575
|
+
ref: g,
|
|
1521
1576
|
style: {
|
|
1522
1577
|
...Ct,
|
|
1523
1578
|
flexBasis: 0,
|
|
@@ -1527,7 +1582,7 @@ function Ot({
|
|
|
1527
1582
|
overflow: "hidden",
|
|
1528
1583
|
// Disable pointer events inside of a panel during resize
|
|
1529
1584
|
// This avoid edge cases like nested iframes
|
|
1530
|
-
pointerEvents: `var(${
|
|
1585
|
+
pointerEvents: `var(${We})`
|
|
1531
1586
|
},
|
|
1532
1587
|
children: /* @__PURE__ */ K(
|
|
1533
1588
|
"div",
|
|
@@ -1536,7 +1591,7 @@ function Ot({
|
|
|
1536
1591
|
style: {
|
|
1537
1592
|
width: "100%",
|
|
1538
1593
|
height: "100%",
|
|
1539
|
-
...
|
|
1594
|
+
...h
|
|
1540
1595
|
},
|
|
1541
1596
|
children: e
|
|
1542
1597
|
}
|
|
@@ -1560,24 +1615,24 @@ const Ct = {
|
|
|
1560
1615
|
padding: "unset",
|
|
1561
1616
|
margin: "unset"
|
|
1562
1617
|
};
|
|
1563
|
-
function Tt() {
|
|
1564
|
-
return G(null);
|
|
1565
|
-
}
|
|
1566
1618
|
function _t() {
|
|
1619
|
+
return I(null);
|
|
1620
|
+
}
|
|
1621
|
+
function At() {
|
|
1567
1622
|
return O(null);
|
|
1568
1623
|
}
|
|
1569
|
-
function
|
|
1624
|
+
function Et({
|
|
1570
1625
|
layout: e,
|
|
1571
1626
|
panelConstraints: t,
|
|
1572
1627
|
panelId: n,
|
|
1573
1628
|
panelIndex: o
|
|
1574
1629
|
}) {
|
|
1575
|
-
let
|
|
1630
|
+
let r, a;
|
|
1576
1631
|
const l = e[n], i = t.find(
|
|
1577
|
-
(
|
|
1632
|
+
(s) => s.panelId === n
|
|
1578
1633
|
);
|
|
1579
1634
|
if (i) {
|
|
1580
|
-
const
|
|
1635
|
+
const s = i.maxSize, u = a = i.collapsible ? i.collapsedSize : i.minSize, c = [o, o + 1];
|
|
1581
1636
|
a = A({
|
|
1582
1637
|
layout: Y({
|
|
1583
1638
|
delta: u - l,
|
|
@@ -1588,9 +1643,9 @@ function Rt({
|
|
|
1588
1643
|
trigger: "keyboard"
|
|
1589
1644
|
}),
|
|
1590
1645
|
panelConstraints: t
|
|
1591
|
-
})[n],
|
|
1646
|
+
})[n], r = A({
|
|
1592
1647
|
layout: Y({
|
|
1593
|
-
delta:
|
|
1648
|
+
delta: s - l,
|
|
1594
1649
|
initialLayout: e,
|
|
1595
1650
|
panelConstraints: t,
|
|
1596
1651
|
pivotIndices: c,
|
|
@@ -1602,35 +1657,35 @@ function Rt({
|
|
|
1602
1657
|
}
|
|
1603
1658
|
return {
|
|
1604
1659
|
valueControls: n,
|
|
1605
|
-
valueMax:
|
|
1660
|
+
valueMax: r,
|
|
1606
1661
|
valueMin: a,
|
|
1607
1662
|
valueNow: l
|
|
1608
1663
|
};
|
|
1609
1664
|
}
|
|
1610
|
-
function
|
|
1665
|
+
function Nt({
|
|
1611
1666
|
children: e,
|
|
1612
1667
|
className: t,
|
|
1613
1668
|
elementRef: n,
|
|
1614
1669
|
id: o,
|
|
1615
|
-
style:
|
|
1670
|
+
style: r,
|
|
1616
1671
|
...a
|
|
1617
1672
|
}) {
|
|
1618
|
-
const l = ue(o), [i,
|
|
1673
|
+
const l = ue(o), [i, s] = I({}), [u, c] = I("inactive"), [h, m] = I(null), p = fe(m, n), {
|
|
1619
1674
|
id: f,
|
|
1620
|
-
orientation:
|
|
1621
|
-
registerSeparator:
|
|
1622
|
-
} = de(),
|
|
1675
|
+
orientation: d,
|
|
1676
|
+
registerSeparator: y
|
|
1677
|
+
} = de(), g = d === "horizontal" ? "vertical" : "horizontal";
|
|
1623
1678
|
return N(() => {
|
|
1624
|
-
if (
|
|
1625
|
-
const
|
|
1626
|
-
element:
|
|
1679
|
+
if (h !== null) {
|
|
1680
|
+
const v = {
|
|
1681
|
+
element: h,
|
|
1627
1682
|
id: l
|
|
1628
|
-
},
|
|
1683
|
+
}, x = y(v), S = _.addListener(
|
|
1629
1684
|
"interactionStateChange",
|
|
1630
1685
|
(L) => {
|
|
1631
1686
|
c(
|
|
1632
1687
|
L.state !== "inactive" && L.hitRegions.some(
|
|
1633
|
-
(
|
|
1688
|
+
(R) => R.separator === v
|
|
1634
1689
|
) ? L.state : "inactive"
|
|
1635
1690
|
);
|
|
1636
1691
|
}
|
|
@@ -1638,15 +1693,15 @@ function At({
|
|
|
1638
1693
|
"mountedGroupsChange",
|
|
1639
1694
|
(L) => {
|
|
1640
1695
|
L.forEach(
|
|
1641
|
-
({ derivedPanelConstraints:
|
|
1696
|
+
({ derivedPanelConstraints: R, layout: q, separatorToPanels: Z }, J) => {
|
|
1642
1697
|
if (J.id === f) {
|
|
1643
|
-
const Q = Z.get(
|
|
1698
|
+
const Q = Z.get(v);
|
|
1644
1699
|
if (Q) {
|
|
1645
1700
|
const $ = Q[0], V = J.panels.indexOf($);
|
|
1646
|
-
|
|
1647
|
-
|
|
1701
|
+
s(
|
|
1702
|
+
Et({
|
|
1648
1703
|
layout: q,
|
|
1649
|
-
panelConstraints:
|
|
1704
|
+
panelConstraints: R,
|
|
1650
1705
|
panelId: $.id,
|
|
1651
1706
|
panelIndex: V
|
|
1652
1707
|
})
|
|
@@ -1658,15 +1713,15 @@ function At({
|
|
|
1658
1713
|
}
|
|
1659
1714
|
);
|
|
1660
1715
|
return () => {
|
|
1661
|
-
|
|
1716
|
+
S(), b(), x();
|
|
1662
1717
|
};
|
|
1663
1718
|
}
|
|
1664
|
-
}, [
|
|
1719
|
+
}, [h, f, l, y]), /* @__PURE__ */ K(
|
|
1665
1720
|
"div",
|
|
1666
1721
|
{
|
|
1667
1722
|
...a,
|
|
1668
1723
|
"aria-controls": i.valueControls,
|
|
1669
|
-
"aria-orientation":
|
|
1724
|
+
"aria-orientation": g,
|
|
1670
1725
|
"aria-valuemax": i.valueMax,
|
|
1671
1726
|
"aria-valuemin": i.valueMin,
|
|
1672
1727
|
"aria-valuenow": i.valueNow,
|
|
@@ -1675,11 +1730,11 @@ function At({
|
|
|
1675
1730
|
"data-separator": u,
|
|
1676
1731
|
"data-testid": l,
|
|
1677
1732
|
id: l,
|
|
1678
|
-
ref:
|
|
1733
|
+
ref: p,
|
|
1679
1734
|
role: "separator",
|
|
1680
1735
|
style: {
|
|
1681
1736
|
flexBasis: "auto",
|
|
1682
|
-
...
|
|
1737
|
+
...r,
|
|
1683
1738
|
flexGrow: 0,
|
|
1684
1739
|
flexShrink: 0
|
|
1685
1740
|
},
|
|
@@ -1689,12 +1744,12 @@ function At({
|
|
|
1689
1744
|
}
|
|
1690
1745
|
export {
|
|
1691
1746
|
Gt as Group,
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1747
|
+
Tt as Panel,
|
|
1748
|
+
Nt as Separator,
|
|
1749
|
+
kt as useDefaultLayout,
|
|
1750
|
+
Dt as useGroupCallbackRef,
|
|
1751
|
+
Ot as useGroupRef,
|
|
1752
|
+
_t as usePanelCallbackRef,
|
|
1753
|
+
At as usePanelRef
|
|
1699
1754
|
};
|
|
1700
1755
|
//# sourceMappingURL=react-resizable-panels.js.map
|