react-resizable-panels 4.0.0-alpha.2 → 4.0.0-alpha.4
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,74 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as j } from "react/jsx-runtime";
|
|
3
|
-
import { useId as De, useLayoutEffect as
|
|
4
|
-
function
|
|
3
|
+
import { useId as De, useLayoutEffect as Ae, useEffect as $e, useRef as T, useCallback as Se, createContext as Ne, useImperativeHandle as xe, useState as G, useMemo as ze, useSyncExternalStore as _e, useContext as Fe } from "react";
|
|
4
|
+
function S(e, t = "Assertion error") {
|
|
5
|
+
if (!e)
|
|
6
|
+
throw Error(t);
|
|
7
|
+
}
|
|
8
|
+
function se(e, t) {
|
|
5
9
|
return t.sort(
|
|
6
|
-
e === "horizontal" ?
|
|
10
|
+
e === "horizontal" ? He : je
|
|
7
11
|
);
|
|
8
12
|
}
|
|
9
|
-
function
|
|
13
|
+
function He(e, t) {
|
|
10
14
|
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
11
15
|
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
12
16
|
}
|
|
13
|
-
function
|
|
17
|
+
function je(e, t) {
|
|
14
18
|
const n = e.element.offsetTop - t.element.offsetTop;
|
|
15
19
|
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
16
20
|
}
|
|
17
|
-
function
|
|
18
|
-
const { element: t, orientation: n, panels: o, separators: s } = e,
|
|
21
|
+
function be(e) {
|
|
22
|
+
const { element: t, orientation: n, panels: o, separators: s } = e, r = se(
|
|
19
23
|
n,
|
|
20
|
-
Array.from(t.children).filter((
|
|
21
|
-
).map(({ element:
|
|
22
|
-
let
|
|
23
|
-
for (const
|
|
24
|
-
const
|
|
25
|
-
(
|
|
24
|
+
Array.from(t.children).filter((l) => l instanceof HTMLElement).map((l) => ({ element: l }))
|
|
25
|
+
).map(({ element: l }) => l), c = [];
|
|
26
|
+
let i, a;
|
|
27
|
+
for (const l of r) {
|
|
28
|
+
const f = o.find(
|
|
29
|
+
(u) => u.element === l
|
|
26
30
|
);
|
|
27
|
-
if (
|
|
28
|
-
if (
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
+
if (f) {
|
|
32
|
+
if (i) {
|
|
33
|
+
const u = i.element.getBoundingClientRect(), m = l.getBoundingClientRect();
|
|
34
|
+
c.push({
|
|
31
35
|
group: e,
|
|
32
|
-
panels: [
|
|
33
|
-
separator:
|
|
36
|
+
panels: [i, f],
|
|
37
|
+
separator: a,
|
|
34
38
|
rect: n === "horizontal" ? new DOMRect(
|
|
35
|
-
|
|
39
|
+
u.right,
|
|
36
40
|
m.top,
|
|
37
|
-
m.left -
|
|
41
|
+
m.left - u.right,
|
|
38
42
|
m.height
|
|
39
43
|
) : new DOMRect(
|
|
40
44
|
m.left,
|
|
41
|
-
|
|
45
|
+
u.bottom,
|
|
42
46
|
m.width,
|
|
43
|
-
m.top -
|
|
47
|
+
m.top - u.bottom
|
|
44
48
|
)
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
|
-
|
|
51
|
+
i = f, a = void 0;
|
|
48
52
|
} else {
|
|
49
|
-
const
|
|
50
|
-
(m) => m.element ===
|
|
53
|
+
const u = s.find(
|
|
54
|
+
(m) => m.element === l
|
|
51
55
|
);
|
|
52
|
-
|
|
56
|
+
u ? a = u : (i = void 0, a = void 0);
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
|
-
return
|
|
59
|
+
return c;
|
|
56
60
|
}
|
|
57
|
-
function
|
|
61
|
+
function We(e, t) {
|
|
58
62
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
59
63
|
return t * o;
|
|
60
64
|
}
|
|
61
|
-
function
|
|
65
|
+
function Ue(e, t) {
|
|
62
66
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
63
67
|
return t * o;
|
|
64
68
|
}
|
|
65
|
-
function
|
|
69
|
+
function Be(e) {
|
|
66
70
|
return e / 100 * window.innerHeight;
|
|
67
71
|
}
|
|
68
|
-
function
|
|
72
|
+
function Ke(e) {
|
|
69
73
|
return e / 100 * window.innerWidth;
|
|
70
74
|
}
|
|
71
|
-
function
|
|
75
|
+
function Ve(e) {
|
|
72
76
|
switch (typeof e) {
|
|
73
77
|
case "number":
|
|
74
78
|
return [e, "px"];
|
|
@@ -78,14 +82,14 @@ function Ke(e) {
|
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
|
-
function
|
|
85
|
+
function J({
|
|
82
86
|
groupSize: e,
|
|
83
87
|
panelElement: t,
|
|
84
88
|
styleProp: n
|
|
85
89
|
}) {
|
|
86
90
|
let o;
|
|
87
|
-
const [s,
|
|
88
|
-
switch (
|
|
91
|
+
const [s, r] = Ve(n);
|
|
92
|
+
switch (r) {
|
|
89
93
|
case "%": {
|
|
90
94
|
o = s / 100 * e;
|
|
91
95
|
break;
|
|
@@ -95,88 +99,84 @@ function Y({
|
|
|
95
99
|
break;
|
|
96
100
|
}
|
|
97
101
|
case "rem": {
|
|
98
|
-
o =
|
|
102
|
+
o = Ue(t, s);
|
|
99
103
|
break;
|
|
100
104
|
}
|
|
101
105
|
case "em": {
|
|
102
|
-
o =
|
|
106
|
+
o = We(t, s);
|
|
103
107
|
break;
|
|
104
108
|
}
|
|
105
109
|
case "vh": {
|
|
106
|
-
o =
|
|
110
|
+
o = Be(s);
|
|
107
111
|
break;
|
|
108
112
|
}
|
|
109
113
|
case "vw": {
|
|
110
|
-
o =
|
|
114
|
+
o = Ke(s);
|
|
111
115
|
break;
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
return o;
|
|
115
119
|
}
|
|
116
|
-
function
|
|
120
|
+
function I(e) {
|
|
117
121
|
return parseFloat(e.toFixed(3));
|
|
118
122
|
}
|
|
119
|
-
function
|
|
123
|
+
function ce({
|
|
120
124
|
group: e
|
|
121
125
|
}) {
|
|
122
126
|
const { orientation: t, panels: n } = e;
|
|
123
127
|
return n.reduce((o, s) => (o += t === "horizontal" ? s.element.offsetWidth : s.element.offsetHeight, o), 0);
|
|
124
128
|
}
|
|
125
|
-
function
|
|
126
|
-
const { panels: t } = e, n =
|
|
129
|
+
function me(e) {
|
|
130
|
+
const { panels: t } = e, n = ce({ group: e });
|
|
127
131
|
return t.map((o) => {
|
|
128
|
-
const { element: s, panelConstraints:
|
|
129
|
-
let
|
|
130
|
-
if (
|
|
131
|
-
const
|
|
132
|
+
const { element: s, panelConstraints: r } = o;
|
|
133
|
+
let c = 0;
|
|
134
|
+
if (r.collapsedSize) {
|
|
135
|
+
const f = J({
|
|
132
136
|
groupSize: n,
|
|
133
137
|
panelElement: s,
|
|
134
|
-
styleProp:
|
|
138
|
+
styleProp: r.collapsedSize
|
|
135
139
|
});
|
|
136
|
-
|
|
140
|
+
c = I(f / n * 100);
|
|
137
141
|
}
|
|
138
|
-
let
|
|
139
|
-
if (
|
|
140
|
-
const
|
|
142
|
+
let i;
|
|
143
|
+
if (r.defaultSize) {
|
|
144
|
+
const f = J({
|
|
141
145
|
groupSize: n,
|
|
142
146
|
panelElement: s,
|
|
143
|
-
styleProp:
|
|
147
|
+
styleProp: r.defaultSize
|
|
144
148
|
});
|
|
145
|
-
|
|
149
|
+
i = I(f / n * 100);
|
|
146
150
|
}
|
|
147
|
-
let
|
|
148
|
-
if (
|
|
149
|
-
const
|
|
151
|
+
let a = 0;
|
|
152
|
+
if (r.minSize) {
|
|
153
|
+
const f = J({
|
|
150
154
|
groupSize: n,
|
|
151
155
|
panelElement: s,
|
|
152
|
-
styleProp:
|
|
156
|
+
styleProp: r.minSize
|
|
153
157
|
});
|
|
154
|
-
|
|
158
|
+
a = I(f / n * 100);
|
|
155
159
|
}
|
|
156
|
-
let
|
|
157
|
-
if (
|
|
158
|
-
const
|
|
160
|
+
let l = 100;
|
|
161
|
+
if (r.maxSize) {
|
|
162
|
+
const f = J({
|
|
159
163
|
groupSize: n,
|
|
160
164
|
panelElement: s,
|
|
161
|
-
styleProp:
|
|
165
|
+
styleProp: r.maxSize
|
|
162
166
|
});
|
|
163
|
-
|
|
167
|
+
l = I(f / n * 100);
|
|
164
168
|
}
|
|
165
169
|
return {
|
|
166
|
-
collapsedSize:
|
|
167
|
-
collapsible:
|
|
168
|
-
defaultSize:
|
|
169
|
-
minSize:
|
|
170
|
-
maxSize:
|
|
170
|
+
collapsedSize: c,
|
|
171
|
+
collapsible: r.collapsible === !0,
|
|
172
|
+
defaultSize: i,
|
|
173
|
+
minSize: a,
|
|
174
|
+
maxSize: l,
|
|
171
175
|
panelId: o.id
|
|
172
176
|
};
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
|
-
|
|
176
|
-
if (!e)
|
|
177
|
-
throw console.error(t), Error(t);
|
|
178
|
-
}
|
|
179
|
-
class Ve {
|
|
179
|
+
class qe {
|
|
180
180
|
#e = {};
|
|
181
181
|
addListener(t, n) {
|
|
182
182
|
const o = this.#e[t];
|
|
@@ -190,18 +190,18 @@ class Ve {
|
|
|
190
190
|
if (o.length === 1)
|
|
191
191
|
o[0].call(null, n);
|
|
192
192
|
else {
|
|
193
|
-
let s = !1,
|
|
194
|
-
const
|
|
195
|
-
for (let
|
|
196
|
-
const
|
|
193
|
+
let s = !1, r = null;
|
|
194
|
+
const c = Array.from(o);
|
|
195
|
+
for (let i = 0; i < c.length; i++) {
|
|
196
|
+
const a = c[i];
|
|
197
197
|
try {
|
|
198
|
-
|
|
199
|
-
} catch (
|
|
200
|
-
|
|
198
|
+
a.call(null, n);
|
|
199
|
+
} catch (l) {
|
|
200
|
+
r === null && (s = !0, r = l);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
if (s)
|
|
204
|
-
throw
|
|
204
|
+
throw r;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
removeAllListeners() {
|
|
@@ -215,45 +215,45 @@ class Ve {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
function
|
|
219
|
-
return Math.abs(
|
|
218
|
+
function w(e, t, n = 0) {
|
|
219
|
+
return Math.abs(I(e) - I(t)) <= n;
|
|
220
220
|
}
|
|
221
|
-
let
|
|
221
|
+
let C = {
|
|
222
222
|
cursorFlags: 0,
|
|
223
223
|
interactionState: {
|
|
224
224
|
state: "inactive"
|
|
225
225
|
},
|
|
226
226
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
227
227
|
};
|
|
228
|
-
const A = new
|
|
229
|
-
function
|
|
230
|
-
return
|
|
228
|
+
const A = new qe();
|
|
229
|
+
function O() {
|
|
230
|
+
return C;
|
|
231
231
|
}
|
|
232
232
|
function M(e) {
|
|
233
|
-
const t = typeof e == "function" ? e(
|
|
234
|
-
if (
|
|
235
|
-
return
|
|
236
|
-
const n =
|
|
237
|
-
return
|
|
238
|
-
...
|
|
233
|
+
const t = typeof e == "function" ? e(C) : e;
|
|
234
|
+
if (C === t)
|
|
235
|
+
return C;
|
|
236
|
+
const n = C;
|
|
237
|
+
return C = {
|
|
238
|
+
...C,
|
|
239
239
|
...t
|
|
240
|
-
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange",
|
|
241
|
-
o.derivedPanelConstraints.forEach((
|
|
242
|
-
if (
|
|
243
|
-
const { layout:
|
|
244
|
-
if (
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
o.layout[
|
|
248
|
-
),
|
|
249
|
-
|
|
250
|
-
|
|
240
|
+
}, t.cursorFlags !== void 0 && A.emit("cursorFlagsChange", C.cursorFlags), t.interactionState !== void 0 && A.emit("interactionStateChange", C.interactionState), t.mountedGroups !== void 0 && (C.mountedGroups.forEach((o, s) => {
|
|
241
|
+
o.derivedPanelConstraints.forEach((r) => {
|
|
242
|
+
if (r.collapsible) {
|
|
243
|
+
const { layout: c } = n.mountedGroups.get(s) ?? {};
|
|
244
|
+
if (c) {
|
|
245
|
+
const i = w(
|
|
246
|
+
r.collapsedSize,
|
|
247
|
+
o.layout[r.panelId]
|
|
248
|
+
), a = w(
|
|
249
|
+
r.collapsedSize,
|
|
250
|
+
c[r.panelId]
|
|
251
251
|
);
|
|
252
|
-
|
|
252
|
+
i && !a && (s.inMemoryLastExpandedPanelSizes[r.panelId] = c[r.panelId]);
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
});
|
|
256
|
-
}), A.emit("mountedGroupsChange",
|
|
256
|
+
}), A.emit("mountedGroupsChange", C.mountedGroups)), C;
|
|
257
257
|
}
|
|
258
258
|
function Xe(e, t) {
|
|
259
259
|
if (e.length !== t.length)
|
|
@@ -264,9 +264,9 @@ function Xe(e, t) {
|
|
|
264
264
|
return !0;
|
|
265
265
|
}
|
|
266
266
|
function W(e, t) {
|
|
267
|
-
return
|
|
267
|
+
return w(e, t) ? 0 : e > t ? 1 : -1;
|
|
268
268
|
}
|
|
269
|
-
function
|
|
269
|
+
function F({
|
|
270
270
|
panelConstraints: e,
|
|
271
271
|
size: t
|
|
272
272
|
}) {
|
|
@@ -274,162 +274,162 @@ function _({
|
|
|
274
274
|
collapsedSize: n = 0,
|
|
275
275
|
collapsible: o,
|
|
276
276
|
maxSize: s = 100,
|
|
277
|
-
minSize:
|
|
277
|
+
minSize: r = 0
|
|
278
278
|
} = e;
|
|
279
|
-
if (W(t,
|
|
279
|
+
if (W(t, r) < 0)
|
|
280
280
|
if (o) {
|
|
281
|
-
const
|
|
282
|
-
W(t,
|
|
281
|
+
const c = (n + r) / 2;
|
|
282
|
+
W(t, c) < 0 ? t = n : t = r;
|
|
283
283
|
} else
|
|
284
|
-
t =
|
|
285
|
-
return t = Math.min(s, t), t =
|
|
284
|
+
t = r;
|
|
285
|
+
return t = Math.min(s, t), t = I(t), t;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function U({
|
|
288
288
|
delta: e,
|
|
289
289
|
initialLayout: t,
|
|
290
290
|
panelConstraints: n,
|
|
291
291
|
pivotIndices: o,
|
|
292
292
|
prevLayout: s,
|
|
293
|
-
trigger:
|
|
293
|
+
trigger: r
|
|
294
294
|
}) {
|
|
295
|
-
if (
|
|
295
|
+
if (w(e, 0))
|
|
296
296
|
return t;
|
|
297
|
-
const
|
|
298
|
-
S(
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
297
|
+
const c = Object.values(t), i = Object.values(s), a = [...c], [l, f] = o;
|
|
298
|
+
S(l != null, "Invalid first pivot index"), S(f != null, "Invalid second pivot index");
|
|
299
|
+
let u = 0;
|
|
300
|
+
if (r === "keyboard") {
|
|
301
301
|
{
|
|
302
|
-
const
|
|
302
|
+
const d = e < 0 ? f : l, p = n[d];
|
|
303
303
|
S(
|
|
304
|
-
|
|
305
|
-
`Panel constraints not found for index ${
|
|
304
|
+
p,
|
|
305
|
+
`Panel constraints not found for index ${d}`
|
|
306
306
|
);
|
|
307
307
|
const {
|
|
308
308
|
collapsedSize: h = 0,
|
|
309
309
|
collapsible: v,
|
|
310
310
|
minSize: z = 0
|
|
311
|
-
} =
|
|
311
|
+
} = p;
|
|
312
312
|
if (v) {
|
|
313
|
-
const x =
|
|
313
|
+
const x = c[d];
|
|
314
314
|
if (S(
|
|
315
315
|
x != null,
|
|
316
|
-
`Previous layout not found for panel index ${
|
|
317
|
-
),
|
|
318
|
-
const
|
|
319
|
-
W(
|
|
316
|
+
`Previous layout not found for panel index ${d}`
|
|
317
|
+
), w(x, h)) {
|
|
318
|
+
const g = z - x;
|
|
319
|
+
W(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
{
|
|
324
|
-
const
|
|
324
|
+
const d = e < 0 ? l : f, p = n[d];
|
|
325
325
|
S(
|
|
326
|
-
|
|
327
|
-
`No panel constraints found for index ${
|
|
326
|
+
p,
|
|
327
|
+
`No panel constraints found for index ${d}`
|
|
328
328
|
);
|
|
329
329
|
const {
|
|
330
330
|
collapsedSize: h = 0,
|
|
331
331
|
collapsible: v,
|
|
332
332
|
minSize: z = 0
|
|
333
|
-
} =
|
|
333
|
+
} = p;
|
|
334
334
|
if (v) {
|
|
335
|
-
const x =
|
|
335
|
+
const x = c[d];
|
|
336
336
|
if (S(
|
|
337
337
|
x != null,
|
|
338
|
-
`Previous layout not found for panel index ${
|
|
339
|
-
),
|
|
340
|
-
const
|
|
341
|
-
W(
|
|
338
|
+
`Previous layout not found for panel index ${d}`
|
|
339
|
+
), w(x, z)) {
|
|
340
|
+
const g = x - h;
|
|
341
|
+
W(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
{
|
|
347
|
-
const
|
|
348
|
-
let
|
|
347
|
+
const d = e < 0 ? 1 : -1;
|
|
348
|
+
let p = e < 0 ? f : l, h = 0;
|
|
349
349
|
for (; ; ) {
|
|
350
|
-
const z =
|
|
350
|
+
const z = c[p];
|
|
351
351
|
S(
|
|
352
352
|
z != null,
|
|
353
|
-
`Previous layout not found for panel index ${
|
|
353
|
+
`Previous layout not found for panel index ${p}`
|
|
354
354
|
);
|
|
355
|
-
const
|
|
356
|
-
panelConstraints: n[
|
|
355
|
+
const g = F({
|
|
356
|
+
panelConstraints: n[p],
|
|
357
357
|
size: 100
|
|
358
358
|
}) - z;
|
|
359
|
-
if (h +=
|
|
359
|
+
if (h += g, p += d, p < 0 || p >= n.length)
|
|
360
360
|
break;
|
|
361
361
|
}
|
|
362
362
|
const v = Math.min(Math.abs(e), Math.abs(h));
|
|
363
363
|
e = e < 0 ? 0 - v : v;
|
|
364
364
|
}
|
|
365
365
|
{
|
|
366
|
-
let
|
|
367
|
-
for (;
|
|
368
|
-
const h = Math.abs(e) - Math.abs(
|
|
366
|
+
let p = e < 0 ? l : f;
|
|
367
|
+
for (; p >= 0 && p < n.length; ) {
|
|
368
|
+
const h = Math.abs(e) - Math.abs(u), v = c[p];
|
|
369
369
|
S(
|
|
370
370
|
v != null,
|
|
371
|
-
`Previous layout not found for panel index ${
|
|
371
|
+
`Previous layout not found for panel index ${p}`
|
|
372
372
|
);
|
|
373
|
-
const z = v - h, x =
|
|
374
|
-
panelConstraints: n[
|
|
373
|
+
const z = v - h, x = F({
|
|
374
|
+
panelConstraints: n[p],
|
|
375
375
|
size: z
|
|
376
376
|
});
|
|
377
|
-
if (!
|
|
377
|
+
if (!w(v, x) && (u += v - x, a[p] = x, u.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
378
378
|
numeric: !0
|
|
379
379
|
}) >= 0))
|
|
380
380
|
break;
|
|
381
|
-
e < 0 ?
|
|
381
|
+
e < 0 ? p-- : p++;
|
|
382
382
|
}
|
|
383
383
|
}
|
|
384
|
-
if (Xe(
|
|
384
|
+
if (Xe(i, a))
|
|
385
385
|
return s;
|
|
386
386
|
{
|
|
387
|
-
const
|
|
387
|
+
const d = e < 0 ? f : l, p = c[d];
|
|
388
388
|
S(
|
|
389
|
-
|
|
390
|
-
`Previous layout not found for panel index ${
|
|
389
|
+
p != null,
|
|
390
|
+
`Previous layout not found for panel index ${d}`
|
|
391
391
|
);
|
|
392
|
-
const h =
|
|
393
|
-
panelConstraints: n[
|
|
392
|
+
const h = p + u, v = F({
|
|
393
|
+
panelConstraints: n[d],
|
|
394
394
|
size: h
|
|
395
395
|
});
|
|
396
|
-
if (
|
|
397
|
-
let z = h - v,
|
|
398
|
-
for (;
|
|
399
|
-
const
|
|
396
|
+
if (a[d] = v, !w(v, h)) {
|
|
397
|
+
let z = h - v, g = e < 0 ? f : l;
|
|
398
|
+
for (; g >= 0 && g < n.length; ) {
|
|
399
|
+
const L = a[g];
|
|
400
400
|
S(
|
|
401
|
-
|
|
402
|
-
`Previous layout not found for panel index ${
|
|
401
|
+
L != null,
|
|
402
|
+
`Previous layout not found for panel index ${g}`
|
|
403
403
|
);
|
|
404
|
-
const
|
|
405
|
-
panelConstraints: n[
|
|
406
|
-
size:
|
|
404
|
+
const P = L + z, E = F({
|
|
405
|
+
panelConstraints: n[g],
|
|
406
|
+
size: P
|
|
407
407
|
});
|
|
408
|
-
if (L
|
|
408
|
+
if (w(L, E) || (z -= E - L, a[g] = E), w(z, 0))
|
|
409
409
|
break;
|
|
410
|
-
e > 0 ?
|
|
410
|
+
e > 0 ? g-- : g++;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
const m = Object.values(
|
|
415
|
-
(
|
|
414
|
+
const m = Object.values(a).reduce(
|
|
415
|
+
(d, p) => p + d,
|
|
416
416
|
0
|
|
417
417
|
);
|
|
418
|
-
if (!
|
|
418
|
+
if (!w(m, 100, 0.1))
|
|
419
419
|
return s;
|
|
420
|
-
const
|
|
421
|
-
return
|
|
420
|
+
const y = Object.keys(s);
|
|
421
|
+
return a.reduce((d, p, h) => (d[y[h]] = p, d), {});
|
|
422
422
|
}
|
|
423
|
-
function
|
|
423
|
+
function te(e) {
|
|
424
424
|
const t = e.parentElement;
|
|
425
425
|
S(t, "Parent group element not found");
|
|
426
|
-
const { mountedGroups: n } =
|
|
426
|
+
const { mountedGroups: n } = O();
|
|
427
427
|
for (const [o] of n)
|
|
428
428
|
if (o.element === t)
|
|
429
429
|
return o;
|
|
430
430
|
throw Error("Could not find parent Group for separator element");
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function B(e, t) {
|
|
433
433
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
434
434
|
return !1;
|
|
435
435
|
for (const n in e)
|
|
@@ -437,54 +437,54 @@ function ee(e, t) {
|
|
|
437
437
|
return !1;
|
|
438
438
|
return !0;
|
|
439
439
|
}
|
|
440
|
-
function
|
|
440
|
+
function $({
|
|
441
441
|
layout: e,
|
|
442
442
|
panelConstraints: t
|
|
443
443
|
}) {
|
|
444
444
|
const o = [...Object.values(e)], s = o.reduce(
|
|
445
|
-
(
|
|
445
|
+
(i, a) => i + a,
|
|
446
446
|
0
|
|
447
447
|
);
|
|
448
448
|
if (o.length !== t.length)
|
|
449
449
|
throw Error(
|
|
450
|
-
`Invalid ${t.length} panel layout: ${o.map((
|
|
450
|
+
`Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
|
|
451
451
|
);
|
|
452
|
-
if (!
|
|
453
|
-
for (let
|
|
454
|
-
const
|
|
455
|
-
S(
|
|
456
|
-
const
|
|
457
|
-
o[
|
|
452
|
+
if (!w(s, 100) && o.length > 0)
|
|
453
|
+
for (let i = 0; i < t.length; i++) {
|
|
454
|
+
const a = o[i];
|
|
455
|
+
S(a != null, `No layout data found for index ${i}`);
|
|
456
|
+
const l = 100 / s * a;
|
|
457
|
+
o[i] = l;
|
|
458
458
|
}
|
|
459
|
-
let
|
|
460
|
-
for (let
|
|
461
|
-
const
|
|
462
|
-
S(
|
|
463
|
-
const
|
|
464
|
-
panelConstraints: t[
|
|
465
|
-
size:
|
|
459
|
+
let r = 0;
|
|
460
|
+
for (let i = 0; i < t.length; i++) {
|
|
461
|
+
const a = o[i];
|
|
462
|
+
S(a != null, `No layout data found for index ${i}`);
|
|
463
|
+
const l = F({
|
|
464
|
+
panelConstraints: t[i],
|
|
465
|
+
size: a
|
|
466
466
|
});
|
|
467
|
-
|
|
467
|
+
a != l && (r += a - l, o[i] = l);
|
|
468
468
|
}
|
|
469
|
-
if (!
|
|
470
|
-
for (let
|
|
471
|
-
const
|
|
472
|
-
S(
|
|
473
|
-
const
|
|
474
|
-
panelConstraints: t[
|
|
475
|
-
size:
|
|
469
|
+
if (!w(r, 0))
|
|
470
|
+
for (let i = 0; i < t.length; i++) {
|
|
471
|
+
const a = o[i];
|
|
472
|
+
S(a != null, `No layout data found for index ${i}`);
|
|
473
|
+
const l = a + r, f = F({
|
|
474
|
+
panelConstraints: t[i],
|
|
475
|
+
size: l
|
|
476
476
|
});
|
|
477
|
-
if (
|
|
477
|
+
if (a !== f && (r -= f - a, o[i] = f, w(r, 0)))
|
|
478
478
|
break;
|
|
479
479
|
}
|
|
480
|
-
const
|
|
481
|
-
return o.reduce((
|
|
480
|
+
const c = Object.keys(e);
|
|
481
|
+
return o.reduce((i, a, l) => (i[c[l]] = a, i), {});
|
|
482
482
|
}
|
|
483
|
-
function
|
|
483
|
+
function we({
|
|
484
484
|
groupId: e
|
|
485
485
|
}) {
|
|
486
486
|
const t = () => {
|
|
487
|
-
const { mountedGroups: n } =
|
|
487
|
+
const { mountedGroups: n } = O();
|
|
488
488
|
for (const [o, s] of n)
|
|
489
489
|
if (o.id === e)
|
|
490
490
|
return { group: o, ...s };
|
|
@@ -499,115 +499,115 @@ function be({
|
|
|
499
499
|
const {
|
|
500
500
|
derivedPanelConstraints: o,
|
|
501
501
|
group: s,
|
|
502
|
-
layout:
|
|
503
|
-
separatorToPanels:
|
|
504
|
-
} = t(),
|
|
502
|
+
layout: r,
|
|
503
|
+
separatorToPanels: c
|
|
504
|
+
} = t(), i = $({
|
|
505
505
|
layout: n,
|
|
506
506
|
panelConstraints: o
|
|
507
507
|
});
|
|
508
|
-
return
|
|
509
|
-
mountedGroups: new Map(
|
|
508
|
+
return B(r, i) || M((a) => ({
|
|
509
|
+
mountedGroups: new Map(a.mountedGroups).set(s, {
|
|
510
510
|
derivedPanelConstraints: o,
|
|
511
|
-
layout:
|
|
512
|
-
separatorToPanels:
|
|
511
|
+
layout: i,
|
|
512
|
+
separatorToPanels: c
|
|
513
513
|
})
|
|
514
|
-
})),
|
|
514
|
+
})), i;
|
|
515
515
|
}
|
|
516
516
|
};
|
|
517
517
|
}
|
|
518
|
-
function
|
|
519
|
-
const { mountedGroups: t } =
|
|
518
|
+
function Le(e) {
|
|
519
|
+
const { mountedGroups: t } = O(), n = t.get(e);
|
|
520
520
|
return S(n, `Mounted Group ${e.id} not found`), n;
|
|
521
521
|
}
|
|
522
|
-
function
|
|
523
|
-
const n =
|
|
524
|
-
(
|
|
522
|
+
function D(e, t) {
|
|
523
|
+
const n = te(e), o = Le(n), s = n.separators.find(
|
|
524
|
+
(u) => u.element === e
|
|
525
525
|
);
|
|
526
526
|
S(s, "Matching separator not found");
|
|
527
|
-
const
|
|
528
|
-
S(
|
|
529
|
-
const
|
|
527
|
+
const r = o.separatorToPanels.get(s);
|
|
528
|
+
S(r, "Matching panels not found");
|
|
529
|
+
const c = r.map((u) => n.panels.indexOf(u)), a = we({ groupId: n.id }).getLayout(), l = U({
|
|
530
530
|
delta: t,
|
|
531
|
-
initialLayout:
|
|
531
|
+
initialLayout: a,
|
|
532
532
|
panelConstraints: o.derivedPanelConstraints,
|
|
533
|
-
pivotIndices:
|
|
534
|
-
prevLayout:
|
|
533
|
+
pivotIndices: c,
|
|
534
|
+
prevLayout: a,
|
|
535
535
|
trigger: "keyboard"
|
|
536
|
-
}),
|
|
537
|
-
layout:
|
|
536
|
+
}), f = $({
|
|
537
|
+
layout: l,
|
|
538
538
|
panelConstraints: o.derivedPanelConstraints
|
|
539
539
|
});
|
|
540
|
-
|
|
541
|
-
mountedGroups: new Map(
|
|
540
|
+
B(a, f) || M((u) => ({
|
|
541
|
+
mountedGroups: new Map(u.mountedGroups).set(n, {
|
|
542
542
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
543
|
-
layout:
|
|
543
|
+
layout: f,
|
|
544
544
|
separatorToPanels: o.separatorToPanels
|
|
545
545
|
})
|
|
546
546
|
}));
|
|
547
547
|
}
|
|
548
|
-
function
|
|
548
|
+
function he(e) {
|
|
549
549
|
if (e.defaultPrevented)
|
|
550
550
|
return;
|
|
551
|
-
const t = e.currentTarget, n =
|
|
551
|
+
const t = e.currentTarget, n = te(t);
|
|
552
552
|
if (!n.disabled)
|
|
553
553
|
switch (e.key) {
|
|
554
554
|
case "ArrowDown": {
|
|
555
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
555
|
+
e.preventDefault(), n.orientation === "vertical" && D(t, 5);
|
|
556
556
|
break;
|
|
557
557
|
}
|
|
558
558
|
case "ArrowLeft": {
|
|
559
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
559
|
+
e.preventDefault(), n.orientation === "horizontal" && D(t, -5);
|
|
560
560
|
break;
|
|
561
561
|
}
|
|
562
562
|
case "ArrowRight": {
|
|
563
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
563
|
+
e.preventDefault(), n.orientation === "horizontal" && D(t, 5);
|
|
564
564
|
break;
|
|
565
565
|
}
|
|
566
566
|
case "ArrowUp": {
|
|
567
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
567
|
+
e.preventDefault(), n.orientation === "vertical" && D(t, -5);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
case "End": {
|
|
571
|
-
e.preventDefault(),
|
|
571
|
+
e.preventDefault(), D(t, 100);
|
|
572
572
|
break;
|
|
573
573
|
}
|
|
574
574
|
case "Enter": {
|
|
575
575
|
e.preventDefault();
|
|
576
|
-
const o =
|
|
577
|
-
(
|
|
576
|
+
const o = te(t), { derivedPanelConstraints: s, layout: r, separatorToPanels: c } = Le(o), i = o.separators.find(
|
|
577
|
+
(u) => u.element === t
|
|
578
578
|
);
|
|
579
|
-
S(
|
|
580
|
-
const
|
|
581
|
-
S(
|
|
582
|
-
const
|
|
583
|
-
(
|
|
579
|
+
S(i, "Matching separator not found");
|
|
580
|
+
const a = c.get(i);
|
|
581
|
+
S(a, "Matching panels not found");
|
|
582
|
+
const l = a[0], f = s.find(
|
|
583
|
+
(u) => u.panelId === l.id
|
|
584
584
|
);
|
|
585
|
-
if (S(
|
|
586
|
-
const
|
|
587
|
-
|
|
585
|
+
if (S(f, "Panel metadata not found"), f.collapsible) {
|
|
586
|
+
const u = r[l.id], m = f.collapsedSize === u ? o.inMemoryLastExpandedPanelSizes[l.id] ?? f.minSize : f.collapsedSize;
|
|
587
|
+
D(t, m - u);
|
|
588
588
|
}
|
|
589
589
|
break;
|
|
590
590
|
}
|
|
591
591
|
case "F6": {
|
|
592
592
|
e.preventDefault();
|
|
593
|
-
const s =
|
|
594
|
-
(
|
|
595
|
-
),
|
|
596
|
-
(
|
|
593
|
+
const s = te(t).separators.map(
|
|
594
|
+
(a) => a.element
|
|
595
|
+
), r = Array.from(s).findIndex(
|
|
596
|
+
(a) => a === e.currentTarget
|
|
597
597
|
);
|
|
598
|
-
S(
|
|
599
|
-
const
|
|
600
|
-
s[
|
|
598
|
+
S(r !== null, "Index not found");
|
|
599
|
+
const c = e.shiftKey ? r > 0 ? r - 1 : s.length - 1 : r + 1 < s.length ? r + 1 : 0;
|
|
600
|
+
s[c].focus();
|
|
601
601
|
break;
|
|
602
602
|
}
|
|
603
603
|
case "Home": {
|
|
604
|
-
e.preventDefault(),
|
|
604
|
+
e.preventDefault(), D(t, -100);
|
|
605
605
|
break;
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
const Ye = (e) => e,
|
|
610
|
-
},
|
|
609
|
+
const Ye = (e) => e, ie = () => {
|
|
610
|
+
}, Pe = 1, Ee = 2, Ce = 4, Me = 8, ve = {
|
|
611
611
|
coarse: 10,
|
|
612
612
|
precise: 5
|
|
613
613
|
};
|
|
@@ -623,20 +623,20 @@ function Ze(e, t) {
|
|
|
623
623
|
)
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
|
-
function
|
|
626
|
+
function Je(e, t, n) {
|
|
627
627
|
let o, s = {
|
|
628
628
|
x: 1 / 0,
|
|
629
629
|
y: 1 / 0
|
|
630
630
|
};
|
|
631
|
-
for (const
|
|
632
|
-
const
|
|
631
|
+
for (const r of t) {
|
|
632
|
+
const c = Ze(n, r.rect);
|
|
633
633
|
switch (e) {
|
|
634
634
|
case "horizontal": {
|
|
635
|
-
|
|
635
|
+
c.x <= s.x && (o = r, s = c);
|
|
636
636
|
break;
|
|
637
637
|
}
|
|
638
638
|
case "vertical": {
|
|
639
|
-
|
|
639
|
+
c.y <= s.y && (o = r, s = c);
|
|
640
640
|
break;
|
|
641
641
|
}
|
|
642
642
|
}
|
|
@@ -646,42 +646,42 @@ function qe(e, t, n) {
|
|
|
646
646
|
hitRegion: o
|
|
647
647
|
} : void 0;
|
|
648
648
|
}
|
|
649
|
-
let
|
|
650
|
-
function
|
|
651
|
-
return
|
|
649
|
+
let Q;
|
|
650
|
+
function Qe() {
|
|
651
|
+
return Q === void 0 && (typeof matchMedia == "function" ? Q = !!matchMedia("(pointer:coarse)").matches : Q = !1), Q;
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function Re(e, t) {
|
|
654
654
|
const n = [];
|
|
655
655
|
return t.forEach((o, s) => {
|
|
656
656
|
if (s.disabled)
|
|
657
657
|
return;
|
|
658
|
-
const
|
|
658
|
+
const r = Qe() ? ve.coarse : ve.precise, c = be(s), i = Je(s.orientation, c, {
|
|
659
659
|
x: e.clientX,
|
|
660
660
|
y: e.clientY
|
|
661
661
|
});
|
|
662
|
-
|
|
662
|
+
i && i.distance.x <= r && i.distance.y <= r && n.push(i.hitRegion);
|
|
663
663
|
}), n;
|
|
664
664
|
}
|
|
665
|
-
function
|
|
665
|
+
function ye(e) {
|
|
666
666
|
if (e.defaultPrevented)
|
|
667
667
|
return;
|
|
668
|
-
const { mountedGroups: t } =
|
|
669
|
-
n.forEach((
|
|
670
|
-
o.add(
|
|
671
|
-
s.add(
|
|
672
|
-
}),
|
|
673
|
-
const
|
|
674
|
-
|
|
668
|
+
const { mountedGroups: t } = O(), n = Re(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map();
|
|
669
|
+
n.forEach((i) => {
|
|
670
|
+
o.add(i.group), i.panels.forEach((l) => {
|
|
671
|
+
s.add(l);
|
|
672
|
+
}), i.separator && r.add(i.separator);
|
|
673
|
+
const a = t.get(i.group);
|
|
674
|
+
a && c.set(i.group, a.layout);
|
|
675
675
|
}), M({
|
|
676
676
|
interactionState: {
|
|
677
677
|
hitRegions: n,
|
|
678
|
-
initialLayoutMap:
|
|
678
|
+
initialLayoutMap: c,
|
|
679
679
|
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
680
680
|
state: "active"
|
|
681
681
|
}
|
|
682
682
|
}), n.length && e.preventDefault();
|
|
683
683
|
}
|
|
684
|
-
function
|
|
684
|
+
function et({
|
|
685
685
|
cursorFlags: e,
|
|
686
686
|
groups: t,
|
|
687
687
|
state: n
|
|
@@ -690,9 +690,9 @@ function Qe({
|
|
|
690
690
|
switch (n) {
|
|
691
691
|
case "active":
|
|
692
692
|
case "hover":
|
|
693
|
-
t.forEach((
|
|
694
|
-
if (!
|
|
695
|
-
switch (
|
|
693
|
+
t.forEach((r) => {
|
|
694
|
+
if (!r.disableCursor)
|
|
695
|
+
switch (r.orientation) {
|
|
696
696
|
case "horizontal": {
|
|
697
697
|
o++;
|
|
698
698
|
break;
|
|
@@ -708,15 +708,15 @@ function Qe({
|
|
|
708
708
|
return null;
|
|
709
709
|
switch (n) {
|
|
710
710
|
case "active": {
|
|
711
|
-
const
|
|
711
|
+
const r = (e & Pe) !== 0, c = (e & Ee) !== 0, i = (e & Ce) !== 0, a = (e & Me) !== 0;
|
|
712
712
|
if (e) {
|
|
713
|
-
if (i)
|
|
714
|
-
return r ? "se-resize" : l ? "ne-resize" : "e-resize";
|
|
715
|
-
if (a)
|
|
716
|
-
return r ? "sw-resize" : l ? "nw-resize" : "w-resize";
|
|
717
713
|
if (r)
|
|
714
|
+
return i ? "se-resize" : a ? "ne-resize" : "e-resize";
|
|
715
|
+
if (c)
|
|
716
|
+
return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
|
|
717
|
+
if (i)
|
|
718
718
|
return "s-resize";
|
|
719
|
-
if (
|
|
719
|
+
if (a)
|
|
720
720
|
return "n-resize";
|
|
721
721
|
}
|
|
722
722
|
break;
|
|
@@ -724,33 +724,33 @@ function Qe({
|
|
|
724
724
|
}
|
|
725
725
|
return o > 0 && s > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
726
726
|
}
|
|
727
|
-
let
|
|
728
|
-
function
|
|
729
|
-
|
|
730
|
-
const { cursorFlags: e, interactionState: t } =
|
|
727
|
+
let re = null, k;
|
|
728
|
+
function ae() {
|
|
729
|
+
k === void 0 && (k = new CSSStyleSheet(), document.adoptedStyleSheets = [k]);
|
|
730
|
+
const { cursorFlags: e, interactionState: t } = O();
|
|
731
731
|
switch (t.state) {
|
|
732
732
|
case "active":
|
|
733
733
|
case "hover": {
|
|
734
|
-
const n =
|
|
734
|
+
const n = et({
|
|
735
735
|
cursorFlags: e,
|
|
736
736
|
groups: t.hitRegions.map((o) => o.group),
|
|
737
737
|
state: t.state
|
|
738
738
|
});
|
|
739
|
-
if (
|
|
739
|
+
if (re === n)
|
|
740
740
|
return;
|
|
741
|
-
|
|
741
|
+
re = n, n ? k.cssRules.length === 0 ? k.insertRule(`*{cursor: ${n} !important;}`) : k.replaceSync(`*{cursor: ${n} !important;}`) : k.cssRules.length === 1 && k.deleteRule(0);
|
|
742
742
|
break;
|
|
743
743
|
}
|
|
744
744
|
case "inactive": {
|
|
745
|
-
|
|
745
|
+
re = null, k.cssRules.length === 1 && k.deleteRule(0);
|
|
746
746
|
break;
|
|
747
747
|
}
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
function
|
|
750
|
+
function ee(e) {
|
|
751
751
|
if (e.defaultPrevented)
|
|
752
752
|
return;
|
|
753
|
-
const { interactionState: t, mountedGroups: n } =
|
|
753
|
+
const { interactionState: t, mountedGroups: n } = O();
|
|
754
754
|
switch (t.state) {
|
|
755
755
|
case "active": {
|
|
756
756
|
if (
|
|
@@ -758,7 +758,7 @@ function q(e) {
|
|
|
758
758
|
e.type !== "pointerleave" && e.buttons === 0
|
|
759
759
|
) {
|
|
760
760
|
M(
|
|
761
|
-
(
|
|
761
|
+
(r) => r.interactionState.state === "inactive" ? r : {
|
|
762
762
|
cursorFlags: 0,
|
|
763
763
|
interactionState: {
|
|
764
764
|
state: "inactive"
|
|
@@ -769,56 +769,56 @@ function q(e) {
|
|
|
769
769
|
}
|
|
770
770
|
let o = 0;
|
|
771
771
|
const s = new Map(n);
|
|
772
|
-
t.hitRegions.forEach((
|
|
773
|
-
const { disableCursor:
|
|
774
|
-
let
|
|
775
|
-
t.state === "active" && (
|
|
776
|
-
const
|
|
777
|
-
|
|
772
|
+
t.hitRegions.forEach((r) => {
|
|
773
|
+
const { disableCursor: c, element: i, orientation: a, panels: l } = r.group;
|
|
774
|
+
let f = 0;
|
|
775
|
+
t.state === "active" && (a === "horizontal" ? f = (e.clientX - t.pointerDownAtPoint.x) / i.offsetWidth * 100 : f = (e.clientY - t.pointerDownAtPoint.y) / i.offsetHeight * 100);
|
|
776
|
+
const u = t.initialLayoutMap.get(
|
|
777
|
+
r.group
|
|
778
778
|
), {
|
|
779
779
|
derivedPanelConstraints: m,
|
|
780
|
-
layout:
|
|
781
|
-
separatorToPanels:
|
|
782
|
-
} = n.get(
|
|
783
|
-
if (m &&
|
|
784
|
-
const
|
|
785
|
-
delta:
|
|
786
|
-
initialLayout:
|
|
780
|
+
layout: y,
|
|
781
|
+
separatorToPanels: d
|
|
782
|
+
} = n.get(r.group) ?? {};
|
|
783
|
+
if (m && u && y && d) {
|
|
784
|
+
const p = U({
|
|
785
|
+
delta: f,
|
|
786
|
+
initialLayout: u,
|
|
787
787
|
panelConstraints: m,
|
|
788
|
-
pivotIndices:
|
|
789
|
-
prevLayout:
|
|
788
|
+
pivotIndices: r.panels.map((h) => l.indexOf(h)),
|
|
789
|
+
prevLayout: y,
|
|
790
790
|
trigger: "mouse-or-touch"
|
|
791
791
|
});
|
|
792
|
-
if (
|
|
793
|
-
if (
|
|
794
|
-
switch (
|
|
792
|
+
if (B(p, y)) {
|
|
793
|
+
if (f !== 0 && !c)
|
|
794
|
+
switch (a) {
|
|
795
795
|
case "horizontal": {
|
|
796
|
-
o |=
|
|
796
|
+
o |= f < 0 ? Pe : Ee;
|
|
797
797
|
break;
|
|
798
798
|
}
|
|
799
799
|
case "vertical": {
|
|
800
|
-
o |=
|
|
800
|
+
o |= f < 0 ? Ce : Me;
|
|
801
801
|
break;
|
|
802
802
|
}
|
|
803
803
|
}
|
|
804
804
|
} else {
|
|
805
|
-
s.set(
|
|
805
|
+
s.set(r.group, {
|
|
806
806
|
derivedPanelConstraints: m,
|
|
807
|
-
layout:
|
|
808
|
-
separatorToPanels:
|
|
807
|
+
layout: p,
|
|
808
|
+
separatorToPanels: d
|
|
809
809
|
});
|
|
810
|
-
const h =
|
|
811
|
-
|
|
810
|
+
const h = r.group.panels.map(({ id: v }) => v).join(",");
|
|
811
|
+
r.group.inMemoryLayouts[h] = p;
|
|
812
812
|
}
|
|
813
813
|
}
|
|
814
814
|
}), M({
|
|
815
815
|
cursorFlags: o,
|
|
816
816
|
mountedGroups: s
|
|
817
|
-
}),
|
|
817
|
+
}), ae();
|
|
818
818
|
break;
|
|
819
819
|
}
|
|
820
820
|
default: {
|
|
821
|
-
const o =
|
|
821
|
+
const o = Re(e, n);
|
|
822
822
|
o.length === 0 ? t.state !== "inactive" && M({
|
|
823
823
|
interactionState: { state: "inactive" }
|
|
824
824
|
}) : M({
|
|
@@ -826,16 +826,16 @@ function q(e) {
|
|
|
826
826
|
hitRegions: o,
|
|
827
827
|
state: "hover"
|
|
828
828
|
}
|
|
829
|
-
}),
|
|
829
|
+
}), ae();
|
|
830
830
|
break;
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
function
|
|
834
|
+
function ge(e) {
|
|
835
835
|
if (e.defaultPrevented)
|
|
836
836
|
return;
|
|
837
837
|
e.preventDefault();
|
|
838
|
-
const { interactionState: t } =
|
|
838
|
+
const { interactionState: t } = O();
|
|
839
839
|
switch (t.state) {
|
|
840
840
|
case "active":
|
|
841
841
|
M({
|
|
@@ -843,110 +843,120 @@ function ye(e) {
|
|
|
843
843
|
interactionState: {
|
|
844
844
|
state: "inactive"
|
|
845
845
|
}
|
|
846
|
-
}),
|
|
846
|
+
}), ae();
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
function
|
|
849
|
+
function tt(e) {
|
|
850
850
|
let t = 0, n = 0;
|
|
851
851
|
const o = {};
|
|
852
|
-
for (const
|
|
853
|
-
if (
|
|
852
|
+
for (const r of e)
|
|
853
|
+
if (r.defaultSize !== void 0) {
|
|
854
854
|
t++;
|
|
855
|
-
const
|
|
856
|
-
n +=
|
|
855
|
+
const c = I(r.defaultSize);
|
|
856
|
+
n += c, o[r.panelId] = c;
|
|
857
857
|
} else
|
|
858
|
-
o[
|
|
858
|
+
o[r.panelId] = void 0;
|
|
859
859
|
const s = e.length - t;
|
|
860
860
|
if (s !== 0) {
|
|
861
|
-
const
|
|
862
|
-
for (const
|
|
863
|
-
|
|
861
|
+
const r = I((100 - n) / s);
|
|
862
|
+
for (const c of e)
|
|
863
|
+
c.defaultSize === void 0 && (o[c.panelId] = r);
|
|
864
864
|
}
|
|
865
865
|
return o;
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function nt(e, t, n) {
|
|
868
868
|
const o = n[0];
|
|
869
869
|
if (!o)
|
|
870
870
|
return;
|
|
871
|
-
const s = e.panels.find((
|
|
871
|
+
const s = e.panels.find((c) => c.element === t);
|
|
872
872
|
if (!s || !s.onResize)
|
|
873
873
|
return;
|
|
874
|
-
const
|
|
874
|
+
const r = ce({ group: e });
|
|
875
875
|
s.onResize(
|
|
876
876
|
{
|
|
877
|
-
asPercentage:
|
|
878
|
-
o.inlineSize /
|
|
877
|
+
asPercentage: I(
|
|
878
|
+
o.inlineSize / r * 100
|
|
879
879
|
),
|
|
880
880
|
inPixels: o.inlineSize
|
|
881
881
|
},
|
|
882
882
|
s.id
|
|
883
883
|
);
|
|
884
884
|
}
|
|
885
|
-
function
|
|
885
|
+
function ot(e) {
|
|
886
886
|
let t = !0;
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
887
|
+
S(
|
|
888
|
+
e.separators.length === 0 || e.separators.length < e.panels.length,
|
|
889
|
+
"Invalid Group configuration; too many Separator components"
|
|
890
|
+
);
|
|
891
|
+
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = new ResizeObserver((u) => {
|
|
892
|
+
for (const m of u) {
|
|
893
|
+
const { borderBoxSize: y, target: d } = m;
|
|
894
|
+
d === e.element ? t && M((p) => {
|
|
895
|
+
const h = p.mountedGroups.get(e);
|
|
896
|
+
if (h) {
|
|
897
|
+
const v = me(e), z = h.layout, x = $({
|
|
898
|
+
layout: z,
|
|
899
|
+
panelConstraints: v
|
|
896
900
|
});
|
|
897
901
|
return {
|
|
898
|
-
mountedGroups: new Map(
|
|
899
|
-
derivedPanelConstraints:
|
|
900
|
-
layout:
|
|
901
|
-
separatorToPanels:
|
|
902
|
+
mountedGroups: new Map(p.mountedGroups).set(e, {
|
|
903
|
+
derivedPanelConstraints: v,
|
|
904
|
+
layout: x,
|
|
905
|
+
separatorToPanels: h.separatorToPanels
|
|
902
906
|
})
|
|
903
907
|
};
|
|
904
908
|
}
|
|
905
|
-
return
|
|
906
|
-
}) :
|
|
909
|
+
return p;
|
|
910
|
+
}) : nt(e, d, y);
|
|
907
911
|
}
|
|
908
912
|
});
|
|
909
|
-
|
|
910
|
-
|
|
913
|
+
s.observe(e.element), e.panels.forEach((u) => {
|
|
914
|
+
S(
|
|
915
|
+
!n.has(u.id),
|
|
916
|
+
`Panel ids must be unique; id "${u.id}" was used more than once`
|
|
917
|
+
), n.add(u.id), u.onResize && s.observe(u.element);
|
|
911
918
|
});
|
|
912
|
-
const
|
|
919
|
+
const r = me(e), c = e.panels.map(({ id: u }) => u).join(","), i = e.inMemoryLayouts[c] ?? e.defaultLayout ?? tt(r), a = $({
|
|
913
920
|
layout: i,
|
|
914
|
-
panelConstraints:
|
|
915
|
-
}),
|
|
916
|
-
mountedGroups: new Map(
|
|
917
|
-
derivedPanelConstraints:
|
|
921
|
+
panelConstraints: r
|
|
922
|
+
}), l = be(e), f = M((u) => ({
|
|
923
|
+
mountedGroups: new Map(u.mountedGroups).set(e, {
|
|
924
|
+
derivedPanelConstraints: r,
|
|
918
925
|
layout: a,
|
|
919
926
|
separatorToPanels: new Map(
|
|
920
|
-
|
|
927
|
+
l.filter((m) => m.separator).map((m) => [m.separator, m.panels])
|
|
921
928
|
)
|
|
922
929
|
})
|
|
923
930
|
}));
|
|
924
|
-
return e.separators.forEach((
|
|
925
|
-
|
|
926
|
-
|
|
931
|
+
return e.separators.forEach((u) => {
|
|
932
|
+
S(
|
|
933
|
+
!o.has(u.id),
|
|
934
|
+
`Separator ids must be unique; id "${u.id}" was used more than once`
|
|
935
|
+
), o.add(u.id), u.element.addEventListener("keydown", he);
|
|
936
|
+
}), f.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ye), window.addEventListener("pointerleave", ee), window.addEventListener("pointermove", ee), window.addEventListener("pointerup", ge)), function() {
|
|
927
937
|
t = !1;
|
|
928
|
-
const
|
|
929
|
-
const
|
|
930
|
-
return
|
|
938
|
+
const m = M((y) => {
|
|
939
|
+
const d = new Map(y.mountedGroups);
|
|
940
|
+
return d.delete(e), { mountedGroups: d };
|
|
931
941
|
});
|
|
932
|
-
e.separators.forEach((
|
|
933
|
-
|
|
934
|
-
}),
|
|
942
|
+
e.separators.forEach((y) => {
|
|
943
|
+
y.element.removeEventListener("keydown", he);
|
|
944
|
+
}), m.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ye), window.removeEventListener("pointerleave", ee), window.removeEventListener("pointermove", ee), window.removeEventListener("pointerup", ge)), s.disconnect();
|
|
935
945
|
};
|
|
936
946
|
}
|
|
937
|
-
function
|
|
947
|
+
function ue(e) {
|
|
938
948
|
const t = De();
|
|
939
949
|
return `${e ?? t}`;
|
|
940
950
|
}
|
|
941
|
-
const H = typeof window < "u" ?
|
|
942
|
-
function
|
|
943
|
-
const t =
|
|
951
|
+
const H = typeof window < "u" ? Ae : $e;
|
|
952
|
+
function fe(e) {
|
|
953
|
+
const t = T(e);
|
|
944
954
|
return H(() => {
|
|
945
955
|
t.current = e;
|
|
946
|
-
}, [e]),
|
|
956
|
+
}, [e]), Se((n) => t.current?.(n), [t]);
|
|
947
957
|
}
|
|
948
|
-
function
|
|
949
|
-
return
|
|
958
|
+
function de(...e) {
|
|
959
|
+
return fe((t) => {
|
|
950
960
|
e.forEach((n) => {
|
|
951
961
|
if (n)
|
|
952
962
|
switch (typeof n) {
|
|
@@ -962,166 +972,169 @@ function fe(...e) {
|
|
|
962
972
|
});
|
|
963
973
|
});
|
|
964
974
|
}
|
|
965
|
-
const
|
|
966
|
-
function
|
|
975
|
+
const Ge = "--react-resizable-panels--panel--pointer-events";
|
|
976
|
+
function Ie(e, t) {
|
|
967
977
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
968
978
|
return `--react-resizable-panels--${n}--${o}`;
|
|
969
979
|
}
|
|
970
|
-
const
|
|
971
|
-
function
|
|
972
|
-
const n =
|
|
980
|
+
const ke = Ne(null);
|
|
981
|
+
function it(e, t) {
|
|
982
|
+
const n = T({
|
|
973
983
|
getLayout: () => ({}),
|
|
974
984
|
setLayout: Ye
|
|
975
985
|
});
|
|
976
|
-
|
|
986
|
+
xe(t, () => n.current, []), H(() => {
|
|
977
987
|
Object.assign(
|
|
978
988
|
n.current,
|
|
979
|
-
|
|
989
|
+
we({ groupId: e })
|
|
980
990
|
);
|
|
981
991
|
});
|
|
982
992
|
}
|
|
983
|
-
function
|
|
993
|
+
function dt({
|
|
984
994
|
children: e,
|
|
985
995
|
className: t,
|
|
986
996
|
defaultLayout: n,
|
|
987
997
|
disableCursor: o,
|
|
988
998
|
disabled: s,
|
|
989
|
-
elementRef:
|
|
990
|
-
groupRef:
|
|
991
|
-
id:
|
|
992
|
-
onLayoutChange:
|
|
993
|
-
orientation:
|
|
994
|
-
style:
|
|
999
|
+
elementRef: r,
|
|
1000
|
+
groupRef: c,
|
|
1001
|
+
id: i,
|
|
1002
|
+
onLayoutChange: a,
|
|
1003
|
+
orientation: l = "horizontal",
|
|
1004
|
+
style: f,
|
|
1005
|
+
...u
|
|
995
1006
|
}) {
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
}),
|
|
999
|
-
|
|
1000
|
-
const
|
|
1007
|
+
const m = T({}), y = fe((b) => {
|
|
1008
|
+
B(m.current, b) || (m.current = b, a?.(b));
|
|
1009
|
+
}), d = ue(i), [p, h] = G(!1), [v, z] = G(null), [x, g] = G(n ?? {}), [L, P] = G([]), [E, K] = G([]), ne = T({}), V = T({}), q = de(z, r);
|
|
1010
|
+
it(d, c);
|
|
1011
|
+
const X = ze(
|
|
1001
1012
|
() => ({
|
|
1002
|
-
id:
|
|
1003
|
-
orientation:
|
|
1004
|
-
registerPanel: (b) => (
|
|
1005
|
-
|
|
1013
|
+
id: d,
|
|
1014
|
+
orientation: l,
|
|
1015
|
+
registerPanel: (b) => (P((R) => se(l, [...R, b])), () => {
|
|
1016
|
+
P((R) => R.filter((N) => N !== b));
|
|
1006
1017
|
}),
|
|
1007
|
-
registerSeparator: (b) => (
|
|
1008
|
-
(
|
|
1018
|
+
registerSeparator: (b) => (K(
|
|
1019
|
+
(R) => se(l, [...R, b])
|
|
1009
1020
|
), () => {
|
|
1010
|
-
|
|
1011
|
-
(
|
|
1021
|
+
K(
|
|
1022
|
+
(R) => R.filter((N) => N !== b)
|
|
1012
1023
|
);
|
|
1013
1024
|
})
|
|
1014
1025
|
}),
|
|
1015
|
-
[
|
|
1026
|
+
[d, l]
|
|
1016
1027
|
);
|
|
1017
1028
|
H(() => {
|
|
1018
|
-
if (
|
|
1029
|
+
if (v !== null && L.length > 0) {
|
|
1019
1030
|
const b = {
|
|
1020
1031
|
defaultLayout: n,
|
|
1021
1032
|
disableCursor: !!o,
|
|
1022
1033
|
disabled: !!s,
|
|
1023
|
-
element:
|
|
1024
|
-
id:
|
|
1025
|
-
inMemoryLastExpandedPanelSizes:
|
|
1026
|
-
inMemoryLayouts:
|
|
1027
|
-
orientation:
|
|
1028
|
-
panels:
|
|
1029
|
-
separators:
|
|
1030
|
-
},
|
|
1031
|
-
|
|
1032
|
-
const
|
|
1034
|
+
element: v,
|
|
1035
|
+
id: d,
|
|
1036
|
+
inMemoryLastExpandedPanelSizes: ne.current,
|
|
1037
|
+
inMemoryLayouts: V.current,
|
|
1038
|
+
orientation: l,
|
|
1039
|
+
panels: L,
|
|
1040
|
+
separators: E
|
|
1041
|
+
}, R = ot(b), oe = O().mountedGroups.get(b);
|
|
1042
|
+
oe && (g(oe.layout), y?.(oe.layout));
|
|
1043
|
+
const Oe = A.addListener(
|
|
1033
1044
|
"interactionStateChange",
|
|
1034
|
-
(
|
|
1035
|
-
switch (
|
|
1045
|
+
(Z) => {
|
|
1046
|
+
switch (Z.state) {
|
|
1036
1047
|
case "active":
|
|
1037
1048
|
case "hover": {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
(
|
|
1049
|
+
h(
|
|
1050
|
+
Z.hitRegions.some(
|
|
1051
|
+
(_) => _.group === b
|
|
1041
1052
|
)
|
|
1042
1053
|
);
|
|
1043
1054
|
break;
|
|
1044
1055
|
}
|
|
1045
1056
|
}
|
|
1046
1057
|
}
|
|
1047
|
-
),
|
|
1058
|
+
), Te = A.addListener(
|
|
1048
1059
|
"mountedGroupsChange",
|
|
1049
|
-
(
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1060
|
+
(Z) => {
|
|
1061
|
+
const _ = Z.get(b);
|
|
1062
|
+
_ && _.derivedPanelConstraints.length > 0 && (g(_.layout), y?.(_.layout));
|
|
1052
1063
|
}
|
|
1053
1064
|
);
|
|
1054
1065
|
return () => {
|
|
1055
|
-
|
|
1066
|
+
R(), Oe(), Te();
|
|
1056
1067
|
};
|
|
1057
1068
|
}
|
|
1058
1069
|
}, [
|
|
1059
1070
|
n,
|
|
1060
1071
|
o,
|
|
1061
1072
|
s,
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
m,
|
|
1065
|
-
c,
|
|
1073
|
+
v,
|
|
1074
|
+
d,
|
|
1066
1075
|
y,
|
|
1067
|
-
|
|
1076
|
+
l,
|
|
1077
|
+
L,
|
|
1078
|
+
E
|
|
1068
1079
|
]);
|
|
1069
|
-
const
|
|
1070
|
-
[
|
|
1080
|
+
const Y = {
|
|
1081
|
+
[Ge]: p ? "none" : void 0
|
|
1071
1082
|
};
|
|
1072
|
-
for (const b in
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1083
|
+
for (const b in x) {
|
|
1084
|
+
const R = Ie(d, b), N = x[b];
|
|
1085
|
+
Y[R] = N;
|
|
1075
1086
|
}
|
|
1076
|
-
return /* @__PURE__ */ j(
|
|
1087
|
+
return /* @__PURE__ */ j(ke.Provider, { value: X, children: /* @__PURE__ */ j(
|
|
1077
1088
|
"div",
|
|
1078
1089
|
{
|
|
1079
|
-
|
|
1090
|
+
...u,
|
|
1091
|
+
"aria-orientation": l,
|
|
1080
1092
|
className: t,
|
|
1081
1093
|
"data-group": !0,
|
|
1082
|
-
"data-testid":
|
|
1083
|
-
|
|
1094
|
+
"data-testid": d,
|
|
1095
|
+
id: d,
|
|
1096
|
+
ref: q,
|
|
1084
1097
|
style: {
|
|
1085
|
-
...
|
|
1086
|
-
...
|
|
1098
|
+
...f,
|
|
1099
|
+
...Y,
|
|
1087
1100
|
display: "flex",
|
|
1088
|
-
flexDirection:
|
|
1101
|
+
flexDirection: l === "horizontal" ? "row" : "column",
|
|
1089
1102
|
flexWrap: "nowrap"
|
|
1090
1103
|
},
|
|
1091
1104
|
children: e
|
|
1092
1105
|
}
|
|
1093
1106
|
) });
|
|
1094
1107
|
}
|
|
1095
|
-
function
|
|
1108
|
+
function le(e) {
|
|
1096
1109
|
return `react-resizable-panels:${e}`;
|
|
1097
1110
|
}
|
|
1098
|
-
function
|
|
1111
|
+
function rt({
|
|
1099
1112
|
id: e,
|
|
1100
1113
|
layout: t,
|
|
1101
1114
|
storage: n
|
|
1102
1115
|
}) {
|
|
1103
1116
|
try {
|
|
1104
|
-
const o =
|
|
1117
|
+
const o = le(e);
|
|
1105
1118
|
n.setItem(o, JSON.stringify(t));
|
|
1106
1119
|
} catch (o) {
|
|
1107
1120
|
console.error(o);
|
|
1108
1121
|
}
|
|
1109
1122
|
}
|
|
1110
|
-
function
|
|
1123
|
+
function pt({
|
|
1111
1124
|
groupId: e,
|
|
1112
1125
|
storage: t
|
|
1113
1126
|
}) {
|
|
1114
|
-
const n =
|
|
1115
|
-
|
|
1116
|
-
() => t.getItem(
|
|
1117
|
-
() => t.getItem(
|
|
1118
|
-
), o =
|
|
1127
|
+
const n = _e(
|
|
1128
|
+
st,
|
|
1129
|
+
() => t.getItem(le(e)),
|
|
1130
|
+
() => t.getItem(le(e))
|
|
1131
|
+
), o = ze(
|
|
1119
1132
|
() => n ? JSON.parse(n) : null,
|
|
1120
1133
|
[n]
|
|
1121
|
-
), s =
|
|
1122
|
-
(
|
|
1134
|
+
), s = Se(
|
|
1135
|
+
(r) => rt({
|
|
1123
1136
|
id: e,
|
|
1124
|
-
layout:
|
|
1137
|
+
layout: r,
|
|
1125
1138
|
storage: t
|
|
1126
1139
|
}),
|
|
1127
1140
|
[e, t]
|
|
@@ -1131,128 +1144,169 @@ function dt({
|
|
|
1131
1144
|
onLayoutChange: s
|
|
1132
1145
|
};
|
|
1133
1146
|
}
|
|
1134
|
-
function
|
|
1147
|
+
function st() {
|
|
1135
1148
|
return function() {
|
|
1136
1149
|
};
|
|
1137
1150
|
}
|
|
1138
|
-
function pt() {
|
|
1139
|
-
return R(null);
|
|
1140
|
-
}
|
|
1141
1151
|
function mt() {
|
|
1142
|
-
return
|
|
1152
|
+
return G(null);
|
|
1143
1153
|
}
|
|
1144
|
-
function
|
|
1145
|
-
|
|
1146
|
-
return S(e, "Unexpected"), e;
|
|
1154
|
+
function ht() {
|
|
1155
|
+
return T(null);
|
|
1147
1156
|
}
|
|
1148
|
-
function
|
|
1157
|
+
function pe() {
|
|
1158
|
+
const e = Fe(ke);
|
|
1159
|
+
return S(
|
|
1160
|
+
e,
|
|
1161
|
+
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1162
|
+
), e;
|
|
1163
|
+
}
|
|
1164
|
+
function at({
|
|
1149
1165
|
groupId: e,
|
|
1150
1166
|
panelId: t
|
|
1151
1167
|
}) {
|
|
1152
1168
|
const n = () => {
|
|
1153
|
-
const { mountedGroups:
|
|
1154
|
-
for (const [
|
|
1155
|
-
|
|
1156
|
-
|
|
1169
|
+
const { mountedGroups: i } = O();
|
|
1170
|
+
for (const [
|
|
1171
|
+
a,
|
|
1172
|
+
{ derivedPanelConstraints: l, layout: f, separatorToPanels: u }
|
|
1173
|
+
] of i)
|
|
1174
|
+
if (a.id === e)
|
|
1175
|
+
return { derivedPanelConstraints: l, group: a, layout: f, separatorToPanels: u };
|
|
1157
1176
|
throw Error(`Group ${e} not found`);
|
|
1158
1177
|
}, o = () => {
|
|
1159
|
-
const
|
|
1160
|
-
(
|
|
1178
|
+
const i = n().derivedPanelConstraints.find(
|
|
1179
|
+
(a) => a.panelId === t
|
|
1161
1180
|
);
|
|
1162
|
-
if (
|
|
1163
|
-
return
|
|
1181
|
+
if (i !== void 0)
|
|
1182
|
+
return i;
|
|
1164
1183
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1165
1184
|
}, s = () => {
|
|
1166
|
-
const
|
|
1167
|
-
if (
|
|
1168
|
-
return
|
|
1185
|
+
const i = n().group.panels.find((a) => a.id === t);
|
|
1186
|
+
if (i !== void 0)
|
|
1187
|
+
return i;
|
|
1169
1188
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1170
|
-
},
|
|
1171
|
-
const
|
|
1172
|
-
if (
|
|
1173
|
-
return
|
|
1189
|
+
}, r = () => {
|
|
1190
|
+
const i = n().layout[t];
|
|
1191
|
+
if (i !== void 0)
|
|
1192
|
+
return i;
|
|
1174
1193
|
throw Error(`Layout not found for Panel ${t}`);
|
|
1194
|
+
}, c = (i) => {
|
|
1195
|
+
const a = r();
|
|
1196
|
+
if (i === a)
|
|
1197
|
+
return;
|
|
1198
|
+
const {
|
|
1199
|
+
derivedPanelConstraints: l,
|
|
1200
|
+
group: f,
|
|
1201
|
+
layout: u,
|
|
1202
|
+
separatorToPanels: m
|
|
1203
|
+
} = n(), y = f.panels.findIndex((v) => v.id === t), d = y === f.panels.length - 1, p = U({
|
|
1204
|
+
delta: d ? a - i : i - a,
|
|
1205
|
+
initialLayout: u,
|
|
1206
|
+
panelConstraints: l,
|
|
1207
|
+
pivotIndices: d ? [y - 1, y] : [y, y + 1],
|
|
1208
|
+
prevLayout: u,
|
|
1209
|
+
trigger: "imperative-api"
|
|
1210
|
+
}), h = $({
|
|
1211
|
+
layout: p,
|
|
1212
|
+
panelConstraints: l
|
|
1213
|
+
});
|
|
1214
|
+
B(u, h) || M((v) => ({
|
|
1215
|
+
mountedGroups: new Map(v.mountedGroups).set(f, {
|
|
1216
|
+
derivedPanelConstraints: l,
|
|
1217
|
+
layout: h,
|
|
1218
|
+
separatorToPanels: m
|
|
1219
|
+
})
|
|
1220
|
+
}));
|
|
1175
1221
|
};
|
|
1176
1222
|
return {
|
|
1177
1223
|
collapse: () => {
|
|
1178
|
-
const { collapsible:
|
|
1179
|
-
i();
|
|
1224
|
+
const { collapsible: i, collapsedSize: a } = o(), l = r();
|
|
1225
|
+
i && l !== a && c(a);
|
|
1180
1226
|
},
|
|
1181
1227
|
expand: () => {
|
|
1182
|
-
const { collapsible:
|
|
1183
|
-
i();
|
|
1228
|
+
const { collapsible: i, collapsedSize: a, minSize: l } = o(), f = r();
|
|
1229
|
+
i && f === a && c(l);
|
|
1184
1230
|
},
|
|
1185
1231
|
getSize: () => {
|
|
1186
|
-
const { group:
|
|
1232
|
+
const { group: i } = n(), a = r(), { element: l } = s(), f = i.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
1187
1233
|
return {
|
|
1188
|
-
asPercentage:
|
|
1189
|
-
inPixels:
|
|
1234
|
+
asPercentage: a,
|
|
1235
|
+
inPixels: f
|
|
1190
1236
|
};
|
|
1191
1237
|
},
|
|
1192
1238
|
isCollapsed: () => {
|
|
1193
|
-
const { collapsible:
|
|
1194
|
-
return
|
|
1239
|
+
const { collapsible: i, collapsedSize: a } = o(), l = r();
|
|
1240
|
+
return i && w(a, l);
|
|
1195
1241
|
},
|
|
1196
|
-
resize: (
|
|
1197
|
-
if (
|
|
1198
|
-
|
|
1242
|
+
resize: (i) => {
|
|
1243
|
+
if (r() !== i) {
|
|
1244
|
+
let l;
|
|
1245
|
+
switch (typeof i) {
|
|
1199
1246
|
case "number": {
|
|
1200
|
-
const { group:
|
|
1201
|
-
|
|
1247
|
+
const { group: f } = n(), u = ce({ group: f });
|
|
1248
|
+
l = I(i / u * 100);
|
|
1249
|
+
break;
|
|
1250
|
+
}
|
|
1251
|
+
case "string": {
|
|
1252
|
+
l = parseFloat(i);
|
|
1202
1253
|
break;
|
|
1203
1254
|
}
|
|
1204
1255
|
}
|
|
1256
|
+
c(l);
|
|
1257
|
+
}
|
|
1205
1258
|
}
|
|
1206
1259
|
};
|
|
1207
1260
|
}
|
|
1208
|
-
function
|
|
1209
|
-
const { id: n } =
|
|
1210
|
-
collapse:
|
|
1211
|
-
expand:
|
|
1261
|
+
function lt(e, t) {
|
|
1262
|
+
const { id: n } = pe(), o = T({
|
|
1263
|
+
collapse: ie,
|
|
1264
|
+
expand: ie,
|
|
1212
1265
|
getSize: () => ({
|
|
1213
1266
|
asPercentage: 0,
|
|
1214
1267
|
inPixels: 0
|
|
1215
1268
|
}),
|
|
1216
1269
|
isCollapsed: () => !1,
|
|
1217
|
-
resize:
|
|
1270
|
+
resize: ie
|
|
1218
1271
|
});
|
|
1219
|
-
|
|
1272
|
+
xe(t, () => o.current, []), H(() => {
|
|
1220
1273
|
Object.assign(
|
|
1221
1274
|
o.current,
|
|
1222
|
-
|
|
1275
|
+
at({ groupId: n, panelId: e })
|
|
1223
1276
|
);
|
|
1224
1277
|
});
|
|
1225
1278
|
}
|
|
1226
|
-
function
|
|
1279
|
+
function vt({
|
|
1227
1280
|
children: e,
|
|
1228
1281
|
className: t,
|
|
1229
1282
|
collapsedSize: n = 0,
|
|
1230
1283
|
collapsible: o = !1,
|
|
1231
1284
|
defaultSize: s,
|
|
1232
|
-
elementRef:
|
|
1233
|
-
id:
|
|
1234
|
-
maxSize:
|
|
1235
|
-
minSize:
|
|
1236
|
-
onResize:
|
|
1237
|
-
panelRef:
|
|
1238
|
-
style:
|
|
1285
|
+
elementRef: r,
|
|
1286
|
+
id: c,
|
|
1287
|
+
maxSize: i = "100",
|
|
1288
|
+
minSize: a = "0",
|
|
1289
|
+
onResize: l,
|
|
1290
|
+
panelRef: f,
|
|
1291
|
+
style: u,
|
|
1292
|
+
...m
|
|
1239
1293
|
}) {
|
|
1240
|
-
const
|
|
1241
|
-
|
|
1294
|
+
const y = !!c, d = ue(c), [p, h] = G(null), v = de(h, r), { id: z, registerPanel: x } = pe(), g = l !== null, L = fe((E) => {
|
|
1295
|
+
l?.(E, c);
|
|
1242
1296
|
});
|
|
1243
1297
|
H(() => {
|
|
1244
1298
|
if (p !== null)
|
|
1245
|
-
return
|
|
1299
|
+
return x({
|
|
1246
1300
|
element: p,
|
|
1247
|
-
id:
|
|
1248
|
-
idIsStable:
|
|
1249
|
-
onResize:
|
|
1301
|
+
id: d,
|
|
1302
|
+
idIsStable: y,
|
|
1303
|
+
onResize: g ? L : void 0,
|
|
1250
1304
|
panelConstraints: {
|
|
1251
1305
|
collapsedSize: n,
|
|
1252
1306
|
collapsible: o,
|
|
1253
1307
|
defaultSize: s,
|
|
1254
|
-
maxSize:
|
|
1255
|
-
minSize:
|
|
1308
|
+
maxSize: i,
|
|
1309
|
+
minSize: a
|
|
1256
1310
|
}
|
|
1257
1311
|
});
|
|
1258
1312
|
}, [
|
|
@@ -1260,30 +1314,32 @@ function ht({
|
|
|
1260
1314
|
o,
|
|
1261
1315
|
s,
|
|
1262
1316
|
p,
|
|
1263
|
-
x,
|
|
1264
1317
|
g,
|
|
1265
|
-
|
|
1266
|
-
r,
|
|
1267
|
-
l,
|
|
1318
|
+
d,
|
|
1268
1319
|
y,
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1320
|
+
i,
|
|
1321
|
+
a,
|
|
1322
|
+
L,
|
|
1323
|
+
x
|
|
1324
|
+
]), lt(d, f);
|
|
1325
|
+
const P = Ie(z, d);
|
|
1272
1326
|
return /* @__PURE__ */ j(
|
|
1273
1327
|
"div",
|
|
1274
1328
|
{
|
|
1329
|
+
...m,
|
|
1275
1330
|
"data-panel": !0,
|
|
1276
|
-
"data-testid":
|
|
1277
|
-
|
|
1331
|
+
"data-testid": d,
|
|
1332
|
+
id: d,
|
|
1333
|
+
ref: v,
|
|
1278
1334
|
style: {
|
|
1279
1335
|
flexBasis: 0,
|
|
1280
|
-
flexGrow: `var(${
|
|
1336
|
+
flexGrow: `var(${P}, 1)`,
|
|
1281
1337
|
flexShrink: 1,
|
|
1282
1338
|
// Prevent Panel content from interfering with panel size
|
|
1283
1339
|
overflow: "hidden",
|
|
1284
1340
|
// Disable pointer events inside of a panel during resize
|
|
1285
1341
|
// This avoid edge cases like nested iframes
|
|
1286
|
-
pointerEvents: `var(${
|
|
1342
|
+
pointerEvents: `var(${Ge})`
|
|
1287
1343
|
},
|
|
1288
1344
|
children: /* @__PURE__ */ j(
|
|
1289
1345
|
"div",
|
|
@@ -1292,7 +1348,7 @@ function ht({
|
|
|
1292
1348
|
style: {
|
|
1293
1349
|
width: "100%",
|
|
1294
1350
|
height: "100%",
|
|
1295
|
-
...
|
|
1351
|
+
...u
|
|
1296
1352
|
},
|
|
1297
1353
|
children: e
|
|
1298
1354
|
}
|
|
@@ -1300,40 +1356,40 @@ function ht({
|
|
|
1300
1356
|
}
|
|
1301
1357
|
);
|
|
1302
1358
|
}
|
|
1303
|
-
function vt() {
|
|
1304
|
-
return R(null);
|
|
1305
|
-
}
|
|
1306
1359
|
function yt() {
|
|
1307
|
-
return
|
|
1360
|
+
return G(null);
|
|
1361
|
+
}
|
|
1362
|
+
function gt() {
|
|
1363
|
+
return T(null);
|
|
1308
1364
|
}
|
|
1309
|
-
function
|
|
1365
|
+
function ct({
|
|
1310
1366
|
layout: e,
|
|
1311
1367
|
panelConstraints: t,
|
|
1312
1368
|
panelId: n,
|
|
1313
1369
|
panelIndex: o
|
|
1314
1370
|
}) {
|
|
1315
|
-
let s,
|
|
1316
|
-
const
|
|
1317
|
-
(
|
|
1371
|
+
let s, r;
|
|
1372
|
+
const c = e[n], i = t.find(
|
|
1373
|
+
(a) => a.panelId === n
|
|
1318
1374
|
);
|
|
1319
|
-
if (
|
|
1320
|
-
const
|
|
1321
|
-
|
|
1322
|
-
layout:
|
|
1323
|
-
delta:
|
|
1375
|
+
if (i) {
|
|
1376
|
+
const a = i.maxSize, l = r = i.collapsible ? i.collapsedSize : i.minSize, f = [o, o + 1];
|
|
1377
|
+
r = $({
|
|
1378
|
+
layout: U({
|
|
1379
|
+
delta: l - c,
|
|
1324
1380
|
initialLayout: e,
|
|
1325
1381
|
panelConstraints: t,
|
|
1326
|
-
pivotIndices:
|
|
1382
|
+
pivotIndices: f,
|
|
1327
1383
|
prevLayout: e,
|
|
1328
1384
|
trigger: "keyboard"
|
|
1329
1385
|
}),
|
|
1330
1386
|
panelConstraints: t
|
|
1331
|
-
})[n], s =
|
|
1332
|
-
layout:
|
|
1333
|
-
delta:
|
|
1387
|
+
})[n], s = $({
|
|
1388
|
+
layout: U({
|
|
1389
|
+
delta: a - c,
|
|
1334
1390
|
initialLayout: e,
|
|
1335
1391
|
panelConstraints: t,
|
|
1336
|
-
pivotIndices:
|
|
1392
|
+
pivotIndices: f,
|
|
1337
1393
|
prevLayout: e,
|
|
1338
1394
|
trigger: "keyboard"
|
|
1339
1395
|
}),
|
|
@@ -1341,52 +1397,54 @@ function lt({
|
|
|
1341
1397
|
})[n];
|
|
1342
1398
|
}
|
|
1343
1399
|
return {
|
|
1400
|
+
valueControls: n,
|
|
1344
1401
|
valueMax: s,
|
|
1345
|
-
valueMin:
|
|
1346
|
-
valueNow:
|
|
1402
|
+
valueMin: r,
|
|
1403
|
+
valueNow: c
|
|
1347
1404
|
};
|
|
1348
1405
|
}
|
|
1349
|
-
function
|
|
1406
|
+
function St({
|
|
1350
1407
|
children: e,
|
|
1351
1408
|
className: t,
|
|
1352
1409
|
elementRef: n,
|
|
1353
1410
|
id: o,
|
|
1354
|
-
style: s
|
|
1411
|
+
style: s,
|
|
1412
|
+
...r
|
|
1355
1413
|
}) {
|
|
1356
|
-
const
|
|
1357
|
-
id:
|
|
1414
|
+
const c = ue(o), [i, a] = G({}), [l, f] = G("inactive"), [u, m] = G(null), y = de(m, n), {
|
|
1415
|
+
id: d,
|
|
1358
1416
|
orientation: p,
|
|
1359
|
-
registerSeparator:
|
|
1360
|
-
} =
|
|
1417
|
+
registerSeparator: h
|
|
1418
|
+
} = pe(), v = p === "horizontal" ? "vertical" : "horizontal";
|
|
1361
1419
|
return H(() => {
|
|
1362
1420
|
if (u !== null) {
|
|
1363
|
-
const
|
|
1421
|
+
const z = {
|
|
1364
1422
|
element: u,
|
|
1365
|
-
id:
|
|
1366
|
-
},
|
|
1423
|
+
id: c
|
|
1424
|
+
}, x = h(z), g = A.addListener(
|
|
1367
1425
|
"interactionStateChange",
|
|
1368
|
-
(
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
(
|
|
1372
|
-
) ?
|
|
1426
|
+
(P) => {
|
|
1427
|
+
f(
|
|
1428
|
+
P.state !== "inactive" && P.hitRegions.some(
|
|
1429
|
+
(E) => E.separator === z
|
|
1430
|
+
) ? P.state : "inactive"
|
|
1373
1431
|
);
|
|
1374
1432
|
}
|
|
1375
|
-
),
|
|
1433
|
+
), L = A.addListener(
|
|
1376
1434
|
"mountedGroupsChange",
|
|
1377
|
-
(
|
|
1378
|
-
|
|
1379
|
-
({ derivedPanelConstraints:
|
|
1380
|
-
if (
|
|
1381
|
-
const
|
|
1382
|
-
if (
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
layout:
|
|
1387
|
-
panelConstraints:
|
|
1388
|
-
panelId:
|
|
1389
|
-
panelIndex:
|
|
1435
|
+
(P) => {
|
|
1436
|
+
P.forEach(
|
|
1437
|
+
({ derivedPanelConstraints: E, layout: K, separatorToPanels: ne }, V) => {
|
|
1438
|
+
if (V.id === d) {
|
|
1439
|
+
const q = ne.get(z);
|
|
1440
|
+
if (q) {
|
|
1441
|
+
const X = q[0], Y = V.panels.indexOf(X);
|
|
1442
|
+
a(
|
|
1443
|
+
ct({
|
|
1444
|
+
layout: K,
|
|
1445
|
+
panelConstraints: E,
|
|
1446
|
+
panelId: X.id,
|
|
1447
|
+
panelIndex: Y
|
|
1390
1448
|
})
|
|
1391
1449
|
);
|
|
1392
1450
|
}
|
|
@@ -1396,21 +1454,24 @@ function gt({
|
|
|
1396
1454
|
}
|
|
1397
1455
|
);
|
|
1398
1456
|
return () => {
|
|
1399
|
-
|
|
1457
|
+
g(), L(), x();
|
|
1400
1458
|
};
|
|
1401
1459
|
}
|
|
1402
|
-
}, [u,
|
|
1460
|
+
}, [u, d, c, h]), /* @__PURE__ */ j(
|
|
1403
1461
|
"div",
|
|
1404
1462
|
{
|
|
1405
|
-
|
|
1406
|
-
"aria-
|
|
1407
|
-
"aria-
|
|
1408
|
-
"aria-
|
|
1463
|
+
...r,
|
|
1464
|
+
"aria-controls": i.valueControls,
|
|
1465
|
+
"aria-orientation": v,
|
|
1466
|
+
"aria-valuemax": i.valueMax,
|
|
1467
|
+
"aria-valuemin": i.valueMin,
|
|
1468
|
+
"aria-valuenow": i.valueNow,
|
|
1409
1469
|
children: e,
|
|
1410
1470
|
className: t,
|
|
1411
1471
|
"data-separator": l,
|
|
1412
|
-
"data-testid":
|
|
1413
|
-
|
|
1472
|
+
"data-testid": c,
|
|
1473
|
+
id: c,
|
|
1474
|
+
ref: y,
|
|
1414
1475
|
role: "separator",
|
|
1415
1476
|
style: {
|
|
1416
1477
|
flexBasis: "auto",
|
|
@@ -1423,13 +1484,13 @@ function gt({
|
|
|
1423
1484
|
);
|
|
1424
1485
|
}
|
|
1425
1486
|
export {
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1487
|
+
dt as Group,
|
|
1488
|
+
vt as Panel,
|
|
1489
|
+
St as Separator,
|
|
1490
|
+
pt as useDefaultLayout,
|
|
1491
|
+
mt as useGroupCallbackRef,
|
|
1492
|
+
ht as useGroupRef,
|
|
1493
|
+
yt as usePanelCallbackRef,
|
|
1494
|
+
gt as usePanelRef
|
|
1434
1495
|
};
|
|
1435
1496
|
//# sourceMappingURL=react-resizable-panels.js.map
|