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